From 0154cc733b9b269cad6559126e6e2a112102ca02 Mon Sep 17 00:00:00 2001 From: zhanglinghao Date: Sun, 22 Nov 2026 21:37:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Studio=20=E7=9A=84=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E6=9C=89=E4=BA=86=E6=A0=B7=E7=89=87=E5=A2=99=EF=BC=9B=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E5=88=97=E7=9A=84=E4=B8=8B=E6=8B=89=E6=A1=86=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E6=88=AA=E5=AD=97=EF=BC=8C=E6=B2=A1=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E5=8F=AA=E8=AF=B4=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 空间页:官网那四支 showcase 片子的样片墙,每张卡写类型、时长、画幅、风格,一个"照这个做一支"只把一句话写进开新片子的框里,不发送。空间没片子时展开,有了自己的片子收在下面。 - 服务:GET /samples/.jpg|.mp4 只给这四张封面和(下载过的)四支片子;/api/projects 多一个 samples。 - 官网三句带上同样的风格和配方 id,test_wording.py 对着官网逐字查,点名的风格和配方都要在仓库里。 - agent.js:下拉框按内容定宽;登录提示按顺序只说一次(Claude Code 的登录检查可能在没做成的那一句之后才到)。stand-in 多一个 --late-auth。 --- changes/studio-sample-wall.md | 5 +++ docs/site/index.html | 6 +-- tools/ci.sh | 9 +++++ tools/desk/README.md | 4 +- tools/desk/fixtures/agents/fake_acp.py | 12 ++++-- tools/desk/server.py | 16 +++++++- tools/desk/static/agent.css | 2 +- tools/desk/static/agent.js | 46 ++++++++++++++++++---- tools/desk/static/core.js | 24 ++++++++++++ tools/desk/static/studio.css | 20 ++++++++++ tools/desk/static/studio.js | 37 +++++++++++++++++- tools/desk/test_agents.py | 18 +++++++-- tools/desk/test_wording.py | 53 +++++++++++++++++++++++++- 13 files changed, 229 insertions(+), 23 deletions(-) create mode 100644 changes/studio-sample-wall.md diff --git a/changes/studio-sample-wall.md b/changes/studio-sample-wall.md new file mode 100644 index 00000000..10249071 --- /dev/null +++ b/changes/studio-sample-wall.md @@ -0,0 +1,5 @@ +**Studio 的空间有了样片墙:照着工作台自己的片子开一支;对话列的下拉框不再截字,没登录的提示只说一次** +- Why: 刚装好打开 Studio,空间是空的,除了右边一列没东西可看,也不知道第一句该说什么。 +- 样片墙:官网放的那四支片子(竖屏科普、数学讲解、手绘短片、发布短片),每张卡写类型、时长、竖屏还是横屏、风格(库里有的带上风格的 id)。按钮"照这个做一支"只把一句话写进开新片子的框里,不发送、不开始任何事:这句话和官网那张卡复制的一样,点名库里的风格(`styles/dark-math`、`watercolor-pastoral`、`product-keynote`)和取自发布短片的三张配方;有要填的空就选中它,框里原来写的 ⌘Z 拿得回来。还没有片子时样片墙展开着;有了自己的片子,它收在片子下面,点开再看。画面是官网的封面图;用 `tools/fetch_media.sh` 下载过片子的,鼠标停在卡上放 4 秒。 +- 官网那三句(数学讲解、手绘短片、发布短片)也带上了同样的风格和配方,两处一字不差;`tools/desk/test_wording.py` 对着官网查,句子里点名的风格和配方都要在仓库里。 +- 对话列:选 agent 的下拉框把名字写全(以前在 1440×900 下是"Claude Code(没装");没登录时发一句,怎么登录只说一次,不管 agent 先报"没登录"还是先说这一句没做成。 diff --git a/docs/site/index.html b/docs/site/index.html index a1e8a00f..2a48a11e 100644 --- a/docs/site/index.html +++ b/docs/site/index.html @@ -1140,7 +1140,7 @@

04Check & deliver查与交 Contact sheet of the math explainer contact sheet联系表 -
Math explainer, 3Blue1Brown style数学讲解,3Blue1Brown 风格Building a square wave from sine waves用正弦波搭出方波Manim · 25 s · English narrationManim · 25 秒 · 英文旁白
Quick draft: a 25-second math explainer in the 3Blue1Brown style, on why the odd numbers from 1 always add up to a square.快速出一版 25 秒的数学讲解,3Blue1Brown 的风格:为什么从 1 开始的连续奇数加起来总是平方数。
+
Math explainer, 3Blue1Brown style数学讲解,3Blue1Brown 风格Building a square wave from sine waves用正弦波搭出方波Manim · 25 s · English narrationManim · 25 秒 · 英文旁白
Quick draft: a 25-second math explainer in the Dark Math style (styles/dark-math), on why the odd numbers from 1 always add up to a square.快速出一版 25 秒的数学讲解,用「暗底数学」风格(styles/dark-math):为什么从 1 开始的连续奇数加起来总是平方数。
Every film ships with its paper trail每支片子都附带完整的制作记录 diff --git a/tools/ci.sh b/tools/ci.sh index 7375a044..7b93f818 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -4123,6 +4123,15 @@ want(s == 200 and h.get("Content-Security-Policy", "").startswith("sandbox"), "a for p in (f"/f/{K}/..%2fzh/BRIEF.md", f"/f/{K}/../zh/BRIEF.md", "/f/nope-x/BRIEF.md", "/api/p/nope-x/data", f"/api/p/{K}/gate/9", "/api/data", "/p/BRIEF.md"): want(req("GET", p)[0] == 404, f"{p} answered") want(req("GET", "/api/projects", host="evil.test")[0] == 403, "another Host answered") +# the space's sample wall: the four showcase posters always, each film only when it is in the clone, and nothing else of the clone +smp = json.loads(req("GET", "/api/projects")[2]).get("samples") +s, h, img = req("GET", "/samples/short.jpg") +want(isinstance(smp, list) and set(smp) <= {"short", "math", "handdrawn", "launch"} and s == 200 and h.get("Content-Type") == "image/jpeg" and img[:2] == b"\xff\xd8" + and all(req("GET", f"/samples/{x}.jpg")[0] == 200 for x in ("math", "handdrawn", "launch")) + and all(req("GET", f"/samples/{x}.mp4")[0] == (200 if x in smp else 404) for x in ("short", "math", "handdrawn", "launch")), + f"the sample wall's posters and films: {smp} {s} {h.get('Content-Type')}") +for p in ("/samples/nope.jpg", "/samples/short.png", "/samples/..%2fserver.py", "/samples/", "/samples/short.jpg/x"): + want(req("GET", p)[0] == 404, f"{p} answered") fb = lambda **k: json.dumps(dict({"round": "3", "lang": "zh", "decisions": {"draft": "OK"}, "defaulted": ["voice"], "general": "", "items": [{"target": "least:S04", "status": "change", "label": "没把握:S04", "text": "再大一点"}], "pid": pid(root + "/demo")}, **k)).encode() H = {"Content-Type": "application/json", "X-Desk-Token": token} diff --git a/tools/desk/README.md b/tools/desk/README.md index f364d038..89690b8c 100644 --- a/tools/desk/README.md +++ b/tools/desk/README.md @@ -66,6 +66,7 @@ bin/vh desk agents install # 装那一家的 ACP 适配器 - **外壳**:左边一列模块(空间、立意、大纲、分镜、声音、成片、交付、素材、账本;有一站在等人时,它的模块亮一个琥珀点)。顶上一条流程:立意 ① · 大纲 ① · 分镜 ② · 声音 · 成片 ③ · 交付,每一站的灯取这支片子自己的停(`bin/vh status` 的 stations):过了是绿,等你是琥珀,agent 在做是紫(只在它真的在做时:这支片子里有 `bin/vh` 命令在跑,或者右栏这一轮正在进行;轮到它、但这会儿没人在做的一站是灰的"还没定"),还没到是灰,这支片子不在这一站停是一个空心的点。右边一整列见下面。 - **空间**(`#/`):一张卡一支片,等人的在前,卡上写等人定什么;鼠标停在卡上,卡上的片子静音播 4 秒。卡上的画面按这个顺序取:等人时取这一轮要人看的(第一张立意卡的帧,没有就是它的片子、第一张图、第一个关键帧);不等人时取封面(`out/final/covers/`、`out/final/cover*`、`out/review/cover*`),没有就是当前成片的中间一帧(浏览器自己从视频里取,服务不跑 ffmpeg),再没有是分镜关键帧,最后是 `out/review/`、`out/check/`、`out/frames/` 里最新的一张图。 + - **样片墙**:片子下面是"照着样片开始":工作台自己做的四支片子(`showcase/` 里官网也放的那四支,同样的顺序:竖屏科普、数学讲解、手绘短片、发布短片),每张卡写类型、时长、竖屏还是横屏和尺寸、风格(库里有这个风格的,带上它的 id),一个按钮"照这个做一支"。按钮只把一句话写进对话那一列开新片子的框里(窄屏上那一列在下面,框会滚到眼前):和官网那张卡复制的一字不差(`tools/desk/test_wording.py` 对着官网查),点名库里的风格(`styles/`)和取自这支片子的配方;有要你填的空([在这里贴上它的链接])就选中它;框里原来写的,⌘Z 拿得回来;空间这一列正开着一段对话时,先换成开新片子的框(那段对话照旧在历史里、接着做)。它不发送、不开始任何事。画面是官网的封面图(`docs/site/img/`),这份克隆里有这支片子(`tools/fetch_media.sh` 下载过)时,鼠标停在卡上静音放 4 秒。空间里还没有片子时样片墙展开着,就是这一页;有了自己的片子,它收在片子下面成一行,点开再看(这个浏览器记住开没开)。 - **交出去以后**:这一站的意见交给 agent 以后(这一站在等 agent),"这一站"那一页不再摆着没选过似的卡片,而是"交给 agent 的":每件决定选了哪个、每条意见、什么时候交的,下面一个"改了再交",点了才把卡片摆回来;底下那一条写"已经交给 agent 了",按钮歇着,标签页上也不再写"等你定"。没交成功时,服务回一个 `reason`(`token`、`origin`、`page_changed`、`invalid`、`too_big`、`slow`、`moved`),页面照它用人的语言说发生了什么、该做什么,不把服务的英文原样放上去。 - **现在到哪了**:进了一支片子,右栏两页(对话、这一站)的上面是一句短话,说这支片子现在怎么样、轮到谁,下面一行小一点的字说细节(停在哪、留了什么、做好的文件,文件点得开),都是 `bin/vh status` 的 `now:` 那几行(中文或英文;英文和终端里一字不差),再下面至多一个按钮:要人看的一站是"去看初版"这种,转到那一站的模块(已经在那一页就不放);要 agent 接着做的(意见交了没人取、agent 停下了、引擎没装、暂停了)是"让 agent 来看意见""让 agent 接着做":点一下,在这支片子最近的对话里(没有就开一个)发一句写好的话:只用 `standing.py` 词表里的字、数字和时间拼成(命令名不在词表里时只认 `bin/vh` 命令名的样子),不放项目文件里的别的文字;输入框里人自己的草稿不动,这句话照样在对话记录里,记的是人说的。下面一行小字是这支片子的打算(`plan`:多长、竖屏横屏、有没有旁白、在哪几处停给人看),从 BRIEF 和停的计划读,模板里没填的不写。空间的卡片上写这一句的短的那一半("停下了""正在渲染,340 / 900 帧""意见还没人取"),轮到人的(等人看、意见没人取、停下了、暂停了)亮琥珀色。每种情况说什么,见下面"一个项目到哪了"的 `now`。 - **一支片子**(`#/p/<键>[/<模块>]`):打开在等人的那一站的模块(关卡 ① 立意,② 分镜,③ 成片);没人等时打开正在做的那一站,再没有就是成片。关卡不再是另一页:等人那一站的模块就是这一轮的关卡页,要你定的事在右栏。照原型排的模块自己画关卡页的画面(立意卡、镜头),关卡页里其余的东西(替你定的、附录、别的图)接在模块下面;成片模块把关卡页的画面放在它的时间线上。`#/p/<键>/gate/<页>` 打开那一页所在的模块,之前的页只看不交。 @@ -98,7 +99,7 @@ bin/vh desk agents install # 装那一家的 ACP 适配器 - **起进程用干净的环境**之外,代理和证书照带:`HTTPS_PROXY`、`HTTP_PROXY`、`ALL_PROXY`、`NO_PROXY`(大小写都认)、`NODE_EXTRA_CA_CERTS`、`SSL_CERT_FILE`、`SSL_CERT_DIR`、`REQUESTS_CA_BUNDLE`,靠它们上网的人照样连得上。 - **模式和个人设置照终端里的,模型和推理档是 Studio 的**:会话开出来用的是你自己的设置(Claude 的模式、放行规则、skills、插件;Codex 的模式;DeepSeek Harness 桌面版的模型)。模型和推理档:新开的对话先用你上次在 Studio 里给这一家挑的(这台电脑上记一份,在适配器所在的文件夹里,`$OVH_AGENTS_DIR/picks.json`,不进项目),没挑过就用 Studio 的默认:Claude Code 是 Opus 5.5、推理档 xhigh(照 agent 报上来的选项认:名字是 Opus 5.5 或者值是 `claude-opus-5-5` 的模型,值是 `xhigh` 的推理档;它不报这两样就用它自己的默认),Codex 用它自己的,DeepSeek Harness 的推理档取桌面版的设置。只设 agent 自己报上来的值、它接受了才记下;正在说话的对话不会在背后被改(接回的对话什么都不设;接不回、只好重开的,和新对话一样)。挑的只给这一次对话用,不改你在终端里的默认(读过钉住的适配器源码,2026-11-17):Claude Code 的模型走 `set_model`,是这个会话里的覆盖,推理档进的是内存里的 flag 设置层,适配器不发写设置文件的 `update_settings`;Codex 只改适配器内存里这个会话的状态,下一轮带过去;DeepSeek Harness 记在这个对话自己的记录里,而且它用的是控制台自己的 `DSH_HOME`,不是你的 `~/.dsh`。顶上一行的“模型”“思考深度”是两个菜单,改了就是这个对话用的,也记成下一次新对话的起点;模式和其余设置收在旁边一个按钮里。开新对话的框里(还没开过对话时,在“和它说话”那一页上)写着会用什么开始,这次运行里见过它的选项时就是两个菜单,在那里挑的只给这个新对话用、也记下来。推理档越高,想得越久,用掉你订阅的额度也越多:在顶上的“思考深度”里调低就行,下一次新对话也从这一档开始。Claude 开新对话时可以关掉“带上我的个人设置”:只读项目自己的设置(`settingSources: project, local`),实测你的 42 个个人 skill、插件带的子 agent 都不带了;模式仍是 Claude Code 自己的默认(没有设置时它从"自己判断"开始),可以在顶上改。 - **一个会话的记录**:每一件事是一个事件,追加写进 `<项目>/.ovh/agents/.jsonl`(`.json` 是它的头:哪家 agent、它自己的会话号、带没带个人设置):你说的话、agent 的每一条更新(边写边出的文字、想法、工具调用和它的改动、计划、上下文用量和花费)、每一次请你批准和怎么答的、每一轮的开始和结束。项目里的路径写成相对路径,家目录写成 `~`,太长的输出截短(agent 自己的话和请你批准的内容不截;请你批准的那一条原样记,路径也不改写:`cd /tmp && rm -rf <项目>/x` 改写成相对路径就成了另一条命令);agent 列出的个人 skill 只记个数,Claude 的"子 agent"设置只记在用的那一个和一共几个(名字来自你的插件);边写边出的文字隔 0.12 秒并成一条记(一轮几万个碎片不会变成几万行)。这个文件夹里有一个内容是 `*` 的 `.gitignore`:放在自己 git 仓库里的项目,`git add -A` 也不会把对话加进去。页面用 SSE(`EventSource`,带 Last-Event-ID)读它:关了重开、断了重连,补上错过的,没答的批准卡重新出现。服务重启后,会话从这份记录读回来;接着说话时,能接回原会话的(Claude、Codex 的 `session/load`,DeepSeek Harness 的 `session/resume`)就接回,接不回的开新的并写一句"它记不得前面的话"。 -- **画什么**:你说的话(带着"对着"什么);agent 的文字边到边显示(DeepSeek Harness 是整段一起到,中间显示"在做,回复会整段一起到"和它正在用的工具);每个工具调用一张卡:读了哪个文件、跑了什么命令、改了哪里(有改动对比的画对比),输出折起来;请你批准时一张琥珀色的卡,把请求里的东西一样不少摆出来:它给这一步起的标题,输入里的每一个字段(键和值原样、转义过;认识的配一句人话,比如 `dangerouslyDisableSandbox` 是"不用沙箱跑"、`run_in_background` 是"在后台跑",`description` 标明是"它自己的说明",不认识的原样列出),涉及的位置,它附的话,改动对比(不截)。这些放在一个限高、能滚动的框里,不做首尾拼接;框装不下时,"允许"那几个按钮要等你滚到底、或点"全部展开"才能点,旁边写着为什么,"不行"随时能点。一条请求长到这里显示不全(一个字段超过 20 万字),就只能拒绝,服务端也这样拦。按钮用这一页的话(允许这一次、这个对话里同类的都允许、不允许……),下面并排写着它给的选项原文(它可能写明一个选项管到哪儿);问题就放在那个工具的卡里;它在等时输入框上面多一条"在等你批准",点一下回到那张卡;它的计划;想法折起来;不认识的消息按通用样子显示(名字和原样内容),不报错。顶上写着它现在在干什么(在想、在跑某条命令、在写回复、等你批准)和几秒了;下面一行是“模型”“推理”两个菜单和一个写着模式的按钮(点开是模式和其余设置),右边是上下文用量和这个对话的花费(agent 报了才有);额度警告(比如 Claude 订阅 7 天额度用到多少、哪天恢复)只在 agent 报了警告时单独一行;没登录或登录过期时,写清怎么登录。被你拒绝的命令写成"你没允许,所以没做",请求照样完整显示。 +- **画什么**:你说的话(带着"对着"什么);agent 的文字边到边显示(DeepSeek Harness 是整段一起到,中间显示"在做,回复会整段一起到"和它正在用的工具);每个工具调用一张卡:读了哪个文件、跑了什么命令、改了哪里(有改动对比的画对比),输出折起来;请你批准时一张琥珀色的卡,把请求里的东西一样不少摆出来:它给这一步起的标题,输入里的每一个字段(键和值原样、转义过;认识的配一句人话,比如 `dangerouslyDisableSandbox` 是"不用沙箱跑"、`run_in_background` 是"在后台跑",`description` 标明是"它自己的说明",不认识的原样列出),涉及的位置,它附的话,改动对比(不截)。这些放在一个限高、能滚动的框里,不做首尾拼接;框装不下时,"允许"那几个按钮要等你滚到底、或点"全部展开"才能点,旁边写着为什么,"不行"随时能点。一条请求长到这里显示不全(一个字段超过 20 万字),就只能拒绝,服务端也这样拦。按钮用这一页的话(允许这一次、这个对话里同类的都允许、不允许……),下面并排写着它给的选项原文(它可能写明一个选项管到哪儿);问题就放在那个工具的卡里;它在等时输入框上面多一条"在等你批准",点一下回到那张卡;它的计划;想法折起来;不认识的消息按通用样子显示(名字和原样内容),不报错。顶上写着它现在在干什么(在想、在跑某条命令、在写回复、等你批准)和几秒了;下面一行是“模型”“推理”两个菜单和一个写着模式的按钮(点开是模式和其余设置),右边是上下文用量和这个对话的花费(agent 报了才有);额度警告(比如 Claude 订阅 7 天额度用到多少、哪天恢复)只在 agent 报了警告时单独一行;没登录或登录过期时,写清怎么登录,只说一次:先来的那一条(它报的"没登录",或者没做成的这一句)说怎么登录,后面的只说这一句没做,直到有一句做成了(又登录上了)。被你拒绝的命令写成"你没允许,所以没做",请求照样完整显示。 - **停止**:先把没答的批准都回成取消,再让这一轮停下。适配器收到停止以后 `OVH_AGENT_STOP_GRACE` 秒(默认 8)还没结束这一轮,就在这里结束它、放掉项目锁、重启这个适配器(接着说话时接回原对话),这一列写清发生了什么;不会因为一个不理停止的适配器把项目锁上几个小时。 - **输入框**:回车发送,Shift+回车换行(输入法选字时的回车不算);"对着"跟着你在模块里选中的东西,发出去时附一句控制台自己写的说明(哪一镜、哪一段时间、哪个模块),不带项目文件里的文字。 - **项目锁**:一轮开始前查四样,有就不发,写清是谁占着:控制台里别的对话(`<项目>/.ovh/agent.lock`,一轮进行时拿着,O_EXCL 建,进程不在了就当没锁);终端里正在跑的 `bin/vh` 命令(活动记录,控制台自己的 agent 起的不算);终端里一个 agent 在等这一轮的提交(`bin/vh desk wait` 或 `bin/vh gate --wait` 的 `.listening`;等着的那条 `bin/vh gate` 不另算成在跑的命令);文件夹里开着的 agent 程序(`lsof` 找得到时:在这个文件夹起的 claude、codex,以及用 node、python 跑的 dsh 这类命令行)。后两种不一定在改东西,你可以点"仍然发这一句"(话里写明两边可能改到同一处);前两种直接不发。锁是建议性的,和 `bin/vh` 其他命令各自的锁(混音的、素材台账的、反馈的)不共用文件,互不等待。 @@ -124,6 +125,7 @@ bin/vh desk agents install # 装那一家的 ACP 适配器 | `GET /api/hello` | 页面手里的令牌是不是这一次运行的(`X-Desk-Token`):200 是;403 `{ok: false, reopen: true}` 不是(控制台重启过,或者这个页面不是从窗口打开的):Studio 自己的窗口这时自己换一个新窗口,别的页面给一个"在 Studio 窗口里打开"的按钮 | | `GET /static/<文件>` | `ui.css`、`ui.js`(关卡视图的,静态页内嵌的是同两份)、`studio.css`、`studio.js`(控制台的外壳和成片模块)、`modules.css`、`modules.js`(其余模块)、`core.js`(控制台和静态页共用的文字和小函数) | | `GET /api/projects` | `{version, home, roots, count, waiting, projects}`:`bin/vh projects` 的每一行,等人的在前,其余按最后一次动静从新到旧,交付了的在最后;加 `key`(地址里的项目键,见下面)、`picture`(`{path, kind: image \| video, from, href}`:封面,`bin/vh thumbs` 的镜头图,片子本身,联系表,关卡页里的图,分镜关键帧,最新的一张图,只取在的文件)、`ask`(等人时:`{gate, title, title_en, question, questions, summary, decisions}`:`questions` 是这一页的问题,最多四个,`summary` 是这一页的那一句);`title` 在 BRIEF 没写片名时取最新一页关卡页的标题里关卡名之前的那一段 | +| `GET /samples/.jpg`、`.mp4` | 空间的样片墙(`server.py` 的 `SAMPLES`,四支,`short`、`math`、`handdrawn`、`launch`):官网那张封面图;片子本身,这份克隆里有时(没有就 404;`GET /api/projects` 的 `samples` 列出有的那几支)。只给这几个文件,克隆里别的一概不给 | | `GET /api/p/<键>/data` | `bin/vh desk data` 的内容,加 `status`(`bin/vh status --json`)、`key`、`home`、`pid`(这个项目文件夹的身份:真实路径的 SHA-1,提交要带上)、`only`、`current`(这一轮的页名)、`round_open`(这一轮那一站还没定:不是 done、skipped;这时提交带上它还没交过、或交过以后改了的决定),和 `studio`(`film` 是成片模块播的那一支,只取在的文件;这一站没点名片子、`bin/vh status` 的那支又没有声音、BRIEF 也没说要无声片时,换成有声音、而且不比它旧的一支(分镜的 animatic、关卡页的 film 或 animatic,新的页在前;`bin/vh status` 本身不变);换了时 `film_instead` 是没放的那支,缩略图、波形和检查的问题都是那支的,不给(读数写明放的是哪个文件,不写第几版);`film_sound` 是它有没有声音(true、false,ffprobe 看不了是 null;一个文件只看一次,大小和时间不变就记着);要的那支不在时,`film_missing` 是它的路径;`sheet` 是最新的联系表;成片模块用的:`timeline` 是 `bin/vh timeline --resolved` 的内容;`thumbs`、`peaks` 是 `bin/vh thumbs`、`peaks` 做过才有的记录;`check` 和 `findings` 是最近一次检查的结论和带时间的问题,没过和要注意的;读不出来的那一样是 `null`,原因记在 `warnings`),和 `mods`(其余模块读的,都是已有命令写下的文件:`loudness` `{integrated, true_peak, lra, target, severity}` 和 `silences`、`checks`(最近一次检查的每条 finding:`kind, severity, message, t, t1`);`pace`(旁白时间轴里 `bin/vh pace` 写的 `reference, unit, speech, with_pauses` 和逐句的 `lines`)、`voice`(旁白用的音色)、`audition`(最新的 `audition.json`:`{file, provider, unit, text, voices: [{voice, file, duration, pitch_hz, speech_rate, misread, error}]}`)、`lifts`(最新的 `*.beats.json` 的候选落点);`covers` `[{path, ratio, id, text}]`、`subs`(字幕文件);`assets`(台账里没删的每一件:`{id, kind, path, there, system, license, license_name, source, url, aigc, used_by, note}`;`system` 是系统自带的字体(`/System/Library/…`、`/Library/Fonts/`、Windows 的 Fonts 这些),算在,不算在项目外;没有台账是 `null`)、`refs`(`research/refs.json`)、`digests` `[{id, path, bytes}]`;没有台账时 `assets_notes` `{file, rows: [{file, source, license, there}]}` 是 NOTES.md 里旧的素材台账表(`there` 对链接是 `null`);每一部分各读各的:读不出的那部分是空的,`errors` 写着它的文件和原因,别的照样有;只读项目里面的文件,指到项目外的链接不跟,和 `/f/` 一样) | | `GET /api/p/<键>/gate/<页>[?lang=zh\|en]` | 那一页的关卡视图:`{version, gate, current, this_round, title, lang, takeall, html, errors, warnings, decisions: [{id, question, recommend, options}], summary, cards, marks, not_reviewed}`;`html` 和静态页同一份标记,文件地址换成 `/f/<键>/…`;`cards` 是所有决定的选项卡(右栏用,同一份标记),`marks` 是没把握和请你听的地方 `[{kind: least \| listen, t, t1, id, note, target}]` | | `GET /api/p/<键>/stage` | 不等人时的画面:`{kind: "video", path, html}`(同一个播放器和标尺),或 `{kind: "image", path, href}`,或 `{kind: null}` | diff --git a/tools/desk/fixtures/agents/fake_acp.py b/tools/desk/fixtures/agents/fake_acp.py index 39f0346f..01894b91 100644 --- a/tools/desk/fixtures/agents/fake_acp.py +++ b/tools/desk/fixtures/agents/fake_acp.py @@ -9,7 +9,8 @@ turn to stop, 计划/plan → a plan and an update kind no client knows, 想/think → codex's thoughts; anything else → reading BRIEF.md. A request to approve waits for the client's answer; a cancel ends the turn at once, as the real ones did. Like DeepSeek Harness, the dsh stand-in does not end when its stdin closes: only a signal stops it. --signed-out: as an agent -whose login expired (auth/status_update unauthenticated; a prompt answers with the adapter's words and fails). 卡住/"hang": +whose login expired (auth/status_update unauthenticated; a prompt answers with the adapter's words and fails); with +--late-auth it says so only after the failed prompt, as Claude Code's own login check can. 卡住/"hang": never answers the prompt and ignores the cancel, as a broken adapter would. Requests a hostile agent might make: 长命令/long-ask (the dangerous part at the end), 超长/huge-ask (too long to show), 藏命令/hidden-ask (a second command on a line of its own in the middle of a long one), 绕沙箱/no-sandbox (a short command with dangerouslyDisableSandbox and other fields). --stubborn-child: @@ -36,6 +37,7 @@ SPEED = float(sys.argv[sys.argv.index("--speed") + 1]) if "--speed" in sys.argv else float(os.environ.get("FAKE_ACP_SPEED") or 1.0) LOGIN_MARKER = Path(sys.argv[sys.argv.index("--login-marker") + 1]) if "--login-marker" in sys.argv else None SIGNED_OUT = "--signed-out" in sys.argv or (LOGIN_MARKER is not None and not LOGIN_MARKER.exists()) +LATE_AUTH = "--late-auth" in sys.argv # with --signed-out: says it is signed out only after the failed prompt (Claude Code's login check can) NO_OPUS = "--no-opus" in sys.argv FX = json.loads((HERE / f"{KIND}.json").read_text(encoding="utf-8")) CLAUDE = json.loads((HERE / "claude.json").read_text(encoding="utf-8")) @@ -329,7 +331,7 @@ def handle(msg): if m == "session/load": # a load replays the conversation as updates first send({"jsonrpc": "2.0", "method": "session/update", "params": {"sessionId": sid, "update": { "sessionUpdate": "user_message_chunk", "content": {"type": "text", "text": "(replayed)"}}}}) - if SIGNED_OUT: # the real adapter says so before it answers session/new + if SIGNED_OUT and not LATE_AUTH: # the real adapter says so before it answers session/new send({"jsonrpc": "2.0", "method": "auth/status_update", "params": {"state": "unauthenticated"}}) return send({"jsonrpc": "2.0", "id": rid, "result": dict(cfg, **({"sessionId": sid} if m == "session/new" else {}))}) if m == "session/set_mode": @@ -354,7 +356,11 @@ def handle(msg): if SIGNED_OUT: send({"jsonrpc": "2.0", "method": "session/update", "params": {"sessionId": sid, "update": {"sessionUpdate": "agent_message_chunk", "messageId": "m-auth", "content": {"type": "text", "text": "Failed to authenticate: OAuth session expired and could not be refreshed"}}}}) - return send({"jsonrpc": "2.0", "id": rid, "error": {"code": -32000, "message": "Authentication required"}}) + send({"jsonrpc": "2.0", "id": rid, "error": {"code": -32000, "message": "Authentication required"}}) + if LATE_AUTH: + time.sleep(0.3) + send({"jsonrpc": "2.0", "method": "auth/status_update", "params": {"state": "unauthenticated"}}) + return Path(os.environ.get("FAKE_ACP_LOG") or os.devnull).open("a").write(json.dumps({"prompt": p.get("prompt")}, ensure_ascii=False) + "\n") threading.Thread(target=run_turn, args=(rid, sid, text), daemon=True).start() return diff --git a/tools/desk/server.py b/tools/desk/server.py index cc72ec94..06821755 100644 --- a/tools/desk/server.py +++ b/tools/desk/server.py @@ -21,6 +21,9 @@ studio.css and studio.js (the console's shell and the cut), modules.css and modules.js (the other modules), core.js (the words and helpers a static page shares) GET /api/projects every project: bin/vh projects' rows, each with its key, a picture, and what it waits for + (samples: which of the sample wall's films are in this clone) + GET /samples/.jpg|.mp4 the space's sample wall: a showcase film's poster (the homepage's), and the film itself once + tools/fetch_media.sh has put it in the clone; these and nothing else of the clone (SAMPLES) GET /api/p//data one project, read fresh: reader.read_project, plus bin/vh status (status), its key and what the cut module lays out (studio: the resolved timeline, thumbnails, peaks, findings), and what the other modules read besides (mods: loudness, voices, lifts, covers, the asset @@ -95,6 +98,13 @@ "agent.css": "text/css; charset=utf-8", "agent.js": "text/javascript; charset=utf-8", "reader.css": "text/css; charset=utf-8", "reader.js": "text/javascript; charset=utf-8", "settings.css": "text/css; charset=utf-8", "settings.js": "text/javascript; charset=utf-8"} +# GET /samples/.jpg|.mp4: the space's sample wall (studio.js SAMPLES): the repo's own showcase films, the same four the +# homepage shows, each with the homepage's poster, and the film itself once tools/fetch_media.sh has put it in this clone. +# These files and nothing else of the clone: the showcase is in no root, so /f/ cannot give them. +SAMPLES = {"short": ("docs/site/img/02-doppler.jpg", "showcase/02-short-leo-doppler/media/final.mp4"), # the homepage's order + "math": ("docs/site/img/03-fourier.jpg", "showcase/03-math-fourier/media/final.mp4"), + "handdrawn": ("docs/site/img/01-clawd.jpg", "showcase/01-handdrawn-clawd-leaf/media/final.mp4"), + "launch": ("docs/site/img/00-launch.jpg", "showcase/00-promo-launch-film/media/final.mp4")} # GET /v//: a project file on a page of its own (Studio's app opens the console's new-page links there) VIEW = {"image": {".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg", ".avif", ".bmp"}, "video": {".mp4", ".mov", ".m4v", ".webm"}, "audio": {".mp3", ".wav", ".m4a", ".aac", ".ogg", ".oga", ".flac", ".opus"}, "page": {".html", ".htm"}, "markdown": {".md", ".markdown"}, @@ -1063,6 +1073,9 @@ def do_GET(self): return self._send(200, (HERE / "static" / path[8:]).read_bytes(), STATIC[path[8:]]) if path == "/api/projects": return self._projects() + m = re.fullmatch(r"/samples/([a-z]+)\.(jpg|mp4)", path) + if m and m.group(1) in SAMPLES: + return self._file(WORKSPACE, SAMPLES[m.group(1)][m.group(2) == "mp4"]) if path == "/api/hello": # does the page hold this run's token? (one from an earlier run does not count); if not, why, and the way out given = self.headers.get("X-Desk-Token", "").encode("utf-8", "replace") ok = secrets.compare_digest(given, srv.token.encode("ascii")) @@ -1277,7 +1290,8 @@ def _projects(self): -float((r.get("last_activity") or {}).get("t") or 0), r.get("name") or "") rows.sort(key=rank) self._json({"version": 1, "home": self.server.own_key, "roots": rec["roots"], "count": len(rows), - "waiting": sum(1 for r in rows if r.get("state") == "waiting_person"), "projects": rows}) + "waiting": sum(1 for r in rows if r.get("state") == "waiting_person"), "projects": rows, + "samples": [k for k, (_, film) in SAMPLES.items() if (WORKSPACE / film).is_file()]}) # the wall's films in this clone def _data(self, project, key): try: diff --git a/tools/desk/static/agent.css b/tools/desk/static/agent.css index c6d64c94..1ed15429 100644 --- a/tools/desk/static/agent.css +++ b/tools/desk/static/agent.css @@ -25,7 +25,7 @@ .ag-orb{width:9px;height:9px;border-radius:50%;background:var(--rule-2);flex:none} .ag-orb.agent{background:var(--agent);box-shadow:0 0 8px var(--agent)} .ag-orb.wait{background:var(--wait)}.ag-orb.live{background:var(--live)} -.ag-top select{max-width:150px;min-width:0;flex:0 1 auto;border:1px solid var(--rule-2);background:var(--panel-2);color:var(--ink-hi);font:500 var(--fs-small) var(--sans);padding:3px 6px;border-radius:var(--r-ctl)} +.ag-top select{flex:none;field-sizing:content;border:1px solid var(--rule-2);background:var(--panel-2);color:var(--ink-hi);font:500 var(--fs-small) var(--sans);padding:3px 6px;border-radius:var(--r-ctl)} .ag-state{flex:1 1 auto;font-size:var(--fs-small);color:var(--ink-2);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .ag-state.agent{color:var(--agent)}.ag-state.wait{color:var(--wait)}.ag-state.live{color:var(--live)} .ag-state .mono{font-size:11px;color:var(--ink-3);margin-left:4px} diff --git a/tools/desk/static/agent.js b/tools/desk/static/agent.js index a26da025..27a2948d 100644 --- a/tools/desk/static/agent.js +++ b/tools/desk/static/agent.js @@ -546,7 +546,7 @@ const AGENT = (() => { function itemHtml(it) { const a = esc(label()); if (it.kind === "user") return `
${it.scope && it.scope.label ? `${esc(at("t_on", { x: cut(it.scope.label, 40) }))}` : ""}

${esc(it.text)}

`; - if (it.kind === "msg" && /^\s*(Failed to authenticate|Authentication required|Not logged in)/i.test(it.text)) return `
${esc(at("raw_said"))}
${md(it.text)}
`; + if (it.kind === "msg" && /^\s*(Failed to authenticate|Authentication required|Not logged in|Invalid API key)/i.test(it.text)) return `
${esc(at("raw_said"))}
${md(it.text)}
`; if (it.kind === "msg") return `
${a}
${md(it.text)}
`; if (it.kind === "thought") return it.text.trim() ? `
${esc(at("thought"))}
${md(it.text)}
` : ""; if (it.kind === "tool") { @@ -565,13 +565,13 @@ const AGENT = (() => { if (it.kind === "plan") return `
${esc(at("plan_h"))}
    ${it.entries.map((p) => `
  1. ${esc(p.content || "")}
  2. `).join("")}
`; if (it.kind === "end") { if (it.stop === "cancelled") return `

${esc(at(it.asked ? "turn_cancelled" : "turn_halted"))}${it.took ? " · " + esc(secs(it.took)) : ""}

`; // Codex ends a turn so after a refusal - if (it.error && /auth/i.test(it.error)) return S.items.some((x) => x.kind === "notice" && x.code === "signed_out") ? `

${esc(at("turn_signed_out"))}

` + if (it.error && /auth/i.test(it.error)) return !HINTS.has(it.key) ? `

${esc(at("turn_signed_out"))}

` : `

${esc(at("n_signed_out", { a: label(), l: at("login_" + KIND) }))}

`; // "Authentication required" if (it.error === "agent_stuck") return ""; // the notice after it says what happened if (it.error) return `

${esc(it.error === "agent_gone" ? at("turn_gone") : it.error === "desk_restart" ? at("turn_restart") : at("turn_error", { e: cut(it.error, 160) }))}

`; return it.took ? `

${esc(at("turn_took", { s: secs(it.took) }))}

` : ""; } - if (it.kind === "notice" && it.code === "signed_out") return `

${esc(at("n_signed_out", { a: label(), l: at("login_" + KIND) }))}

`; + if (it.kind === "notice" && it.code === "signed_out") return HINTS.has(it.key) ? `

${esc(at("n_signed_out", { a: label(), l: at("login_" + KIND) }))}

` : ""; if (it.kind === "notice" && it.code === "place_busy") return `

${esc(at("n_place_busy", { x: it.name || "", w: it.who || "?" }))}

`; if (it.kind === "notice" && it.code === "placed") return `

${esc(at("n_placed", { x: it.name || "" }))}

`; if (it.kind === "notice" && /^own/.test(it.code || "")) return `

${esc(at("n_" + it.code, { a: label() }))}

`; @@ -580,6 +580,17 @@ const AGENT = (() => { if (it.kind === "unknown") return `
${esc(at("unknown", { a: label() }))}
${esc(cut(JSON.stringify(it.u, null, 1), 2000))}
`; return ""; } + let HINTS = new Set(); // the lines that say how to sign in (loginHints): the others say it no more + function loginHints(items) { // how to sign in, said once a stretch: the first of the "not signed in" notices and failed turns + // says it, the ones after it only that the sentence wasn't done (a turn), or nothing (a notice), until a turn ends well (signed in + // again). Decided in order, so a notice that comes after the failed turn (Claude Code's login check can) doesn't say it twice + const out = new Set(); let said = false; + for (const x of items || []) { + if (x.kind === "end" && !x.error) said = false; + else if ((x.kind === "notice" && x.code === "signed_out") || (x.kind === "end" && x.error && /auth/i.test(x.error))) { if (!said) out.add(x.key); said = true; } + } + return out; + } function permOf(toolId) { let out = null; for (const p of Object.values(S.perms)) if (p.tool && p.tool.toolCallId === toolId) out = p; return out; } function askHead(pm) { return `
${esc(at("perm_h", { a: label(), v: verbWords(pm.tool || {}) }))}${pm.answered ? "" : `${esc(at("perm_wait"))}`}
`; } const FIELD = { command: "f_command", description: "f_description", timeout: "f_timeout", file_path: "f_file", path: "f_file", notebook_path: "f_file", @@ -649,7 +660,7 @@ const AGENT = (() => { : at({ stop: "perm_by_stop", timeout: "perm_by_timeout", agent_gone: "perm_by_gone", desk_restart: "perm_by_restart", turn_end: "perm_by_turn", desk_stop: "perm_by_desk" }[ans.by] || "perm_by_turn", { m: Math.round(((INFO && INFO.approval_timeout) || 600) / 60) }); return `

${esc(by)}

`; } - const DOM = new Map(); // an item's key → [its version, its element]: only what changed is drawn again + const DOM = new Map(); // an item's key → [its version, its element, whether it says how to sign in]: only what changed is drawn again function renderThread() { const th = $("#agThread"); if (!th) return; if (!S || !S.items.length || NEWBOX) { @@ -662,15 +673,16 @@ const AGENT = (() => { const stick = th.scrollHeight - th.scrollTop - th.clientHeight < 40; if (th.querySelector(".ag-empty, .ag-new")) th.innerHTML = ""; const wk = th.querySelector(".ag-working"); if (wk) wk.remove(); + HINTS = loginHints(S.items); for (const it of S.items) { - const was = DOM.get(it.key); - if (was && was[0] === it.v && was[1].isConnected) continue; + const was = DOM.get(it.key), hint = HINTS.has(it.key); + if (was && was[0] === it.v && was[2] === hint && was[1].isConnected) continue; const box = document.createElement("div"); box.className = "ag-item"; box.dataset.k = it.key; const open = was ? [...was[1].querySelectorAll("details")].map((x) => x.open) : []; box.innerHTML = itemHtml(it); [...box.querySelectorAll("details")].forEach((x, i) => { if (open[i]) x.open = true; }); if (was && was[1].isConnected) was[1].replaceWith(box); else th.appendChild(box); - DOM.set(it.key, [it.v, box]); + DOM.set(it.key, [it.v, box, hint]); } if (S.running) th.insertAdjacentHTML("beforeend", workingHtml()); wireThread(th); @@ -842,6 +854,24 @@ const AGENT = (() => { token(t) { TOKEN_ = t; }, // the token the page got after it loaded: its code traded, or another tab's of this run (studio.js) lang() { if (KEYP) { const f = $("#agFoot"); if (f) f.dataset.ready = ""; const h = $("#agHead"); if (h) h.dataset.ready = ""; const b = $("#colTabs"); if (b) b.dataset.html = ""; DOM.clear(); render(); } }, tabs, setTab, fresh, + async offer(e, id) { // the space's sample wall (studio.js): the person's click puts that sample's sentence (Studio's own words, + // core.js smp__say, never a page's or a file's) in the box for a new film, and sends nothing. A conversation open on the + // space gives way to a new film's box first (it stays in the history and goes on); what the person had written is replaced + // as typing would (⌘Z brings it back); a […] to fill in is selected + const sample = /^[a-z]+$/.test(String(id || "")) ? word(`smp_${id}_say`) : null; + if (!e || !e.isTrusted || KEYP !== SPACE || typeof sample !== "string") return false; + if (S && S.items.length) await fresh(); + const ta = $("#agSay"); if (!ta) return false; + ta.focus(); ta.select(); + let typed = false; + try { typed = !ta.disabled && document.execCommand("insertText", false, sample) && String(ta.value) === sample; } catch (x) { typed = false; } + if (!typed) ta.value = sample; + store_.set(`desk:agent:say:${KEYP}`, ta.value); + const m = /[[^]]*]|\[[^\]]*\]/.exec(sample); + if (m) ta.setSelectionRange(m.index, m.index + m[0].length); else ta.setSelectionRange(sample.length, sample.length); + ta.scrollIntoView({ block: "nearest" }); + return true; + }, listening(on) { if (LISTEN !== !!on) { LISTEN = !!on; if (KEYP && KEYP !== SPACE) renderHead(); } }, async tell(e, text) { // Studio's own button (the column's one action): its own words (bin/vh status's, Studio's word table and numbers), sent in this // film's conversation, the newest one, else a new one; the box keeps the person's draft (it is filled only by them) @@ -853,6 +883,6 @@ const AGENT = (() => { }, _again: (e) => again(e), // for tools/desk/test_agents.py (node): the busy line's "anyway" after a refused carry-on busy: () => !!(S && S.running && KEYP !== SPACE), // a turn in this film's column now (the flow strip's agent lamp) - _md: md, _diff: diffLines, _ask: (pm, d) => askHtml(pm, d), _defaultKind: defaultKind, _state: () => (S ? { id: S.id, items: S.items.length, seq: S.seq, es: ES ? ES.readyState : null, url: ES ? ES.url.replace(/token=[^&]*/, "token=…") : null } : null), // for tools/desk/test_agents.py (node): the escaping and the diff, without a page + _md: md, _diff: diffLines, _hints: (items) => [...loginHints(items)], _ask: (pm, d) => askHtml(pm, d), _defaultKind: defaultKind, _state: () => (S ? { id: S.id, items: S.items.length, seq: S.seq, es: ES ? ES.readyState : null, url: ES ? ES.url.replace(/token=[^&]*/, "token=…") : null } : null), // for tools/desk/test_agents.py (node): the escaping and the diff, without a page }; })(); diff --git a/tools/desk/static/core.js b/tools/desk/static/core.js index ba946715..9b0b215f 100644 --- a/tools/desk/static/core.js +++ b/tools/desk/static/core.js @@ -22,6 +22,18 @@ const STR = { ask_prefix: "用 OpenVideoHarness 做一支片子:", films: "片子", home_meta: "{n} 支 · {w} 支等你", home_meta0: "{n} 支", g_wait: "等你看", no_projects: "这里还没有片子。在右边写一句想做什么,agent 就开一支。", + smp_h: "照着样片开始", smp_fold: "照着样片开始 · {n} 支", + smp_b: "工作台自己做的几支片子。点「照这个做一支」,开新片子的框里就写好一句话:换成你的题目再发送。点它不会开始做。", + smp_go: "照这个做一支", smp_filled: "写进开新片子的框里了:换成你的题目,再发送", + smp_secs: "{s} 秒", smp_tall: "竖屏", smp_wide: "横屏", smp_style: "风格", + smp_short_type: "竖屏科普", smp_short_style: "深墨蓝底、扁平图形、一种橙色强调", + smp_short_say: "快速出一版 25 秒的竖屏科普,讲为什么天空是蓝的。", + smp_math_type: "数学讲解", smp_math_style: "暗底数学", + smp_math_say: "快速出一版 25 秒的数学讲解,用「暗底数学」风格(styles/dark-math):为什么从 1 开始的连续奇数加起来总是平方数。", + smp_handdrawn_type: "手绘短片", smp_handdrawn_style: "水彩田园", + smp_handdrawn_say: "快速出一版 12 秒的手绘小短片,用「水彩田园」风格(styles/watercolor-pastoral):一只猫追着一架被风吹走的纸飞机。", + smp_launch_type: "发布短片", smp_launch_style: "产品发布片", + smp_launch_say: "快速出一版 20 秒的发布短片,用「产品发布片」风格(styles/product-keynote),镜头参考配方 zoom-through、cut-the-curve、oversized-cursor,介绍我的开源项目:[在这里贴上它的链接]。", st_waiting_person: "等你看", st_waiting_agent: "agent 在做", st_in_progress: "在做", st_delivered: "已交付", st_paused: "暂停", st_no_record: "没有审阅记录", st_not_started: "没开始", st_skipped: "跳过", st_done: "已定", agent_list: "agent 在做", @@ -167,6 +179,18 @@ const STR = { th_darkfield: "Darkfield", th_prism: "Prism", th_bridge: "Bridge", skip: "Skip to content", rail: "Modules", flow: "This film's stops", ask_prefix: "Make a film with OpenVideoHarness: ", films: "Films", home_meta: "{n} · {w} waiting for you", home_meta0: "{n}", g_wait: "Waiting for you", no_projects: "No films here yet. Write what you want to make on the right, and an agent starts one.", + smp_h: "Start from a sample", smp_fold: "Start from a sample · {n}", + smp_b: "Films this harness made. Press “Make one like this” and the new film's box gets a sentence: put your own subject in, then send it. Pressing it starts nothing.", + smp_go: "Make one like this", smp_filled: "It's in the new film's box: put your own subject in, then send it", + smp_secs: "{s} s", smp_tall: "vertical", smp_wide: "landscape", smp_style: "Style", + smp_short_type: "Vertical science short", smp_short_style: "deep ink-blue ground, flat shapes, one orange accent", + smp_short_say: "Quick draft: a 25-second vertical science short on why the sky is blue.", + smp_math_type: "Math explainer", smp_math_style: "Dark Math", + smp_math_say: "Quick draft: a 25-second math explainer in the Dark Math style (styles/dark-math), on why the odd numbers from 1 always add up to a square.", + smp_handdrawn_type: "Hand-drawn short", smp_handdrawn_style: "Watercolor Pastoral", + smp_handdrawn_say: "Quick draft: a 12-second hand-drawn short in the Watercolor Pastoral style (styles/watercolor-pastoral) of a cat chasing a paper plane the wind carries off.", + smp_launch_type: "Launch short", smp_launch_style: "Product Keynote", + smp_launch_say: "Quick draft: a 20-second launch short in the Product Keynote style (styles/product-keynote), with the recipes zoom-through, cut-the-curve and oversized-cursor, for my open-source project, [paste its link here].", st_waiting_person: "waiting for you", st_waiting_agent: "agent working", st_in_progress: "in progress", st_delivered: "delivered", st_paused: "paused", st_no_record: "no review record", st_not_started: "not started", st_skipped: "skipped", st_done: "decided", agent_list: "The agent is on", diff --git a/tools/desk/static/studio.css b/tools/desk/static/studio.css index 0d0b4e79..d95f68f6 100644 --- a/tools/desk/static/studio.css +++ b/tools/desk/static/studio.css @@ -143,6 +143,26 @@ html.shell-other .topbar{padding-right:calc(14px + 100vw - env(titlebar-area-x, .pcard-meta .mono{font-size:11px} .pcard-ask{font-size:var(--fs-small);color:var(--ink-2);line-height:1.45;padding-left:9px;border-left:2px solid var(--wait)} .pcard .err{font-size:var(--fs-label);color:var(--live)} +/* the sample wall (studio.js wallHtml): the showcase films under your own, folded once you have some; the button puts a sentence in the box */ +.smp-wall{margin-top:34px} +.smp-wall>summary{list-style:none;cursor:pointer}.smp-wall>summary::-webkit-details-marker{display:none} +.smp-wall>summary>h2,.smp-wall>h2{display:flex;align-items:baseline;gap:10px;margin:0 0 12px;font:500 var(--fs-small)/1.4 var(--sans);color:var(--ink-2);letter-spacing:var(--label-track);text-transform:var(--label-case)} +.smp-wall>summary>h2::before{content:"▸";color:var(--ink-2);font-size:14px;transition:transform .16s var(--ease)} +.smp-wall[open]>summary>h2::before{transform:rotate(90deg)} +.smp-wall>summary:hover>h2{color:var(--ink)} +.smp-wall>summary>h2::after,.smp-wall>h2::after{content:"";flex:1;border-top:1px solid var(--rule);transform:translateY(-4px)} +.smp-wall h2 .n{font-family:var(--mono);color:var(--ink-3)} +.smp-cards{grid-template-columns:repeat(auto-fill,minmax(190px,1fr))} /* the four side by side on a laptop */ +.smp-b{margin:0 0 16px;max-width:46em;font-size:var(--fs-small);color:var(--ink-2);line-height:1.55} +.smp .well img{position:relative} +.smp .well.tall img,.smp .well.tall video{object-fit:contain} +.smp .well video{position:absolute;inset:0;opacity:0;transition:opacity .2s var(--ease)} +.smp:hover .well video{opacity:1} +.smp-style{font-size:var(--fs-label);color:var(--ink-2);line-height:1.45} +.smp-style code{font-size:11px;color:var(--ink-3);white-space:nowrap} +.pcard.smp{display:flex;flex-direction:column} /* the buttons on one line, whatever the lines above them */ +.smp-act{display:flex;align-items:center;gap:10px;margin-top:auto;padding-top:2px} +@media (prefers-reduced-motion:reduce){.smp .well video{transition:none}} .roots{margin-top:26px;font-size:var(--fs-label);color:var(--ink-3)} .lacks{margin:-4px 0 22px;padding:10px 14px;border:1px solid var(--rule);border-radius:var(--r-card);background:var(--panel);font-size:var(--fs-small);color:var(--ink-2);max-width:62em} .lacks h2{margin:0 0 4px;font:500 var(--fs-label)/1.4 var(--sans);color:var(--ink-3)} diff --git a/tools/desk/static/studio.js b/tools/desk/static/studio.js index f9691893..d8cc6982 100644 --- a/tools/desk/static/studio.js +++ b/tools/desk/static/studio.js @@ -198,14 +198,49 @@ async function showHome(quiet) { ${sect("g_wait", wait, `
${wait.map(heroCard).join("")}
`)} ${sect("g_doing", doing, `
${doing.map(card).join("")}
`)} ${sect("g_done", done, `
${done.map(card).join("")}
`)} + ${wallHtml(rows.length)} ${roots.length ? `

${esc(t("roots_n", { n: roots.length }))}

` : ""}`; const area = $("#stage"), y = area.scrollTop; area.innerHTML = html; if (quiet) area.scrollTop = y; - midFrames(area); hoverClips(area); spaceRunning(); + midFrames(area); hoverClips(area); spaceRunning(); wallWire(area); machine(); clearTimeout(homeTimer); homeTimer = setTimeout(() => { if (parse().view === "home") showHome(true); }, 15000); } +/* the sample wall: the repo's own showcase films, the four the homepage shows (docs/site/index.html), each with the homepage's + poster and "make one like this" sentence (core.js smp_*; tools/desk/test_wording.py holds the two to each other). Its one + button puts the sentence in the space's box for a new film and starts nothing. An empty space shows it open, as the page; + with films of your own it is folded under them, one click away (this viewer's choice is kept) */ +const SAMPLES = [ // the server gives each poster and film at /samples/.jpg|.mp4 (server.py SAMPLES); the numbers are the films' own + { id: "short", secs: 24.8, w: 1080, h: 1920 }, + { id: "math", secs: 25, w: 1920, h: 1080, style: "dark-math" }, + { id: "handdrawn", secs: 12, w: 1920, h: 1080, style: "watercolor-pastoral" }, + { id: "launch", secs: 20, w: 1920, h: 1080, style: "product-keynote" }, +]; +let wallOpen = (() => { try { return localStorage.getItem("desk:samples") === "open"; } catch (e) { return false; } })(); +function wallHtml(films) { + const here = new Set((LIST && LIST.samples) || []); + const cards = SAMPLES.map((x) => { + const tall = x.h > x.w, kind = t(`smp_${x.id}_type`); + return `
+ ${esc(kind.slice(0, 1))}${here.has(x.id) ? `` : ""} + ${esc(kind)} + ${esc(t("smp_secs", { s: x.secs }))}${esc(t(tall ? "smp_tall" : "smp_wide"))} ${x.w}×${x.h} + ${esc(t("smp_style"))}${esc(COLON())}${esc(t(`smp_${x.id}_style`))}${x.style ? ` ${esc(x.style)}` : ""} +
`; + }).join(""); + const body = `

${esc(t("smp_b"))}

${cards}
`; + const head = `

${esc(t("smp_h"))}${SAMPLES.length}

`; + return films ? `
${head}${body}
` + : `
${head}${body}
`; +} +function wallWire(root) { + const d = $("#smpWall", root); + if (d) d.addEventListener("toggle", () => { wallOpen = d.open; try { localStorage.setItem("desk:samples", d.open ? "open" : ""); } catch (e) { /* private window */ } }); + $$("[data-smp-go]", root).forEach((b) => b.addEventListener("click", async (e) => { + if (await AGENT.offer(e, b.dataset.smpGo)) toast(t("smp_filled")); + })); +} /* what this machine still lacks (bin/vh doctor, asked once a run by the console): a quiet panel on the space, nothing when all is there */ let MACHINE = null, machineAt = 0; async function machine() { // asked once a page; again (a minute later at most) while something is missing: the person may have fixed it diff --git a/tools/desk/test_agents.py b/tools/desk/test_agents.py index 47024a7c..5b34b46d 100644 --- a/tools/desk/test_agents.py +++ b/tools/desk/test_agents.py @@ -145,9 +145,13 @@ def page_check(): for fn in ("send", "answer", "stop", "setting"): if not re.search(r"async function " + fn + r"\(e\b[^)]*\) \{\s*if \(!e \|\| !e\.isTrusted\b", js): return f"{fn}() does not start by checking event.isTrusted" - sets = re.findall(r"(?:ta|\$\(\"#agSay\"\))\.value\s*=\s*([^;]+);", js) - if sorted(set(x.strip() for x in sets)) != ['""', 'store_.get(`desk:agent:say:${KEYP}`) || ""']: + sets = re.findall(r"(?:ta|\$\(\"#agSay\"\))\.value\s*=\s*([^;]+);", js) + re.findall(r'execCommand\("insertText", false, ([^)]+)\)', js) + if sorted(set(x.strip() for x in sets)) != ['""', 'sample', 'store_.get(`desk:agent:say:${KEYP}`) || ""']: return f"the box is filled from something else: {sets}" + # the one other thing that fills it: the sample wall's button, with Studio's own sentence for that sample, on a real click + if len(re.findall(r"\bsample\s*=[^=]", js)) != 1 or not re.search(r'const sample = /\^\[a-z\]\+\$/\.test\(String\(id \|\| ""\)\) \? word\(`smp_\$\{id\}_say`\) : null;\s*' + r'if \(!e \|\| !e\.isTrusted\b', js): + return "the sample wall fills the box from something other than Studio's own sentence, or without a real click" if "
({ key, kind: "msg", text }), C = (key, error) => ({ key, kind: "end", stop: "cancelled", error }); +const drawn = { // what the column shows for each order: how to sign in must be on screen once a stretch (folded words don't count) + msg_then_end: g.AGENT._draw([U("u1"), M("m1", "Not logged in · Please run /login"), E("e1", "Authentication required")]), + end_then_notice: g.AGENT._draw([U("u1"), E("e1", "Authentication required"), N("n2", "signed_out")]), + notice_then_end: g.AGENT._draw([N("n1", "signed_out"), U("u1"), E("e1", "Authentication required")]), + stopped_for_it: g.AGENT._draw([U("u1"), C("e1", "Authentication required"), N("n2", "signed_out")]), + its_words_alone: g.AGENT._draw([U("u1"), M("m1", "Invalid API key · Please run /login"), E("e1", null)]), + stopped_no_reset: g.AGENT._draw([U("u1"), E("e1", "Authentication required"), U("u2"), C("e2", null), U("u3"), E("e3", "Authentication required")]), + signed_in_again: g.AGENT._draw([N("n1", "signed_out"), U("u1"), E("e1", null), N("n3", "signed_out")]), +}; +console.log(JSON.stringify({ md, rows: d.rows, hidden, sandbox, hints, drawn })); """ out = subprocess.run([node, "-e", prog, str(HERE / "static")], capture_output=True, text=True, timeout=30) if out.returncode: @@ -201,6 +252,9 @@ def page_check(): return "the hidden second command is not shown, or the command is not whole" if r["hints"] != [["n1"], ["e1"], ["n1", "n3"]]: return f"how to sign in is not said once a stretch: {r['hints']}" + seen = {k: sum(re.sub(r"", "", h, flags=re.S).count("/login") for h in v) for k, v in r["drawn"].items()} + if seen != dict({k: 1 for k in r["drawn"]}, signed_in_again=2): + return f"how to sign in is not on screen exactly once a stretch: {seen}" sb = r["sandbox"] if not all(k in sb for k in ("dangerouslyDisableSandbox", "不用沙箱跑", "run_in_background", "在后台跑", "x_unknown", "<b>elsewhere</b>", "它自己的说明")) or "elsewhere" in sb: return f"the request's fields: {sb[:300]}" diff --git a/tools/desk/test_wording.py b/tools/desk/test_wording.py index 0c23ea24..38474ce3 100644 --- a/tools/desk/test_wording.py +++ b/tools/desk/test_wording.py @@ -20,8 +20,8 @@ r"硬规则|写成意见|记成点评|提交|锁时|样板章|样帧|锁画面|项目|BRIEF|\.md\b|bin/vh|" + CODE) RETIRED_EN = re.compile(r"(?i)\bdesk\b|\bconsole\b|\bgate\b|checkpoint|\bround\b|\bcomments?\b|feedback|submission|\bsubmit|\(s\)|untouched|" r"to allow|\bcontext\b|\bproxy\b|hard rule|conversation|bin/vh|\.md\b|timing lock|sample chapter|first cut|" + CODE) -WORDS_KEEP = {"proj_ph", # the film's folder inside a command, in that command's tooltip (<项目> / ) - "smp_launch_say"} # the homepage's sentence the person sends to the agent: 我的开源项目 is their software, not a film +WORDS_KEEP = {"proj_ph"} # the film's folder inside a command, in that command's tooltip (<项目> / ) +WORDS_OK = {"smp_launch_say": "我的开源项目"} # a word a key may say: the homepage's sentence names the person's software, not a film TERMINAL_OK = re.compile(r"bin/vh|\.md\b|\bproxy\b") # a terminal line may name the command to run, a file, the network's proxy CJK = re.compile(r"[一-鿿]") PROSE = re.compile(r"[A-Za-z]{2,}[,:;.!?]? [A-Za-z]{2,}") # English words a space apart: not an identifier, a key or a file name @@ -173,7 +173,7 @@ def wording_check(): bad.append(f"{name}.{key} only in {'/'.join(v)}") elif k not in WORDS_KEEP: for lang, rx in (("zh", RETIRED_ZH), ("en", RETIRED_EN)): - m = rx.search(str(v[lang])) + m = rx.search(str(v[lang]).replace(WORDS_OK.get(k, "\0"), "")) if m: bad.append(f"{name}.{key} ({lang}) says {m.group(0)!r}") core = (HERE / "static" / "core.js").read_text(encoding="utf-8")