@xiangyixie/dsh-superagent 0.14.9 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,21 @@ along with the next code release. A doc-only version leaves `lib/` and `bin/`
8
8
  byte-identical to the version before it, and the pinned install line in the
9
9
  README is updated to the version being released.
10
10
 
11
+ ## 0.15.0 — 2026-11-16
12
+
13
+ ### 变化
14
+
15
+ - **界面上的字改成人话。** 空状态、按钮、提醒、审批卡、报错和向导都按你当下要做的事
16
+ 写一句话:具体名词代替抽象名词,不用「一键」「赋能」这类词,不排比,不客套,也不堆
17
+ 感叹号。文案分两处:页面里的固定句子在 `public/console.html`,服务端回给你的错误说明
18
+ 在 `lib/console.js`;状态词、耗时、提醒标题这些跟着 run 记录自动生成。
19
+ - **调度板:一眼看到几条线在跑。** 有任务在跑时,对话上方出现一块调度板:每一步一条
20
+ 时间条,按真实的开始、结束时间画;板头写清同时跑几条任务线、并行几步、几步在等前
21
+ 一步、几条在排队,每行的任务线标题旁是状态和耗时。数据全部读现有 run 记录(含
22
+ `subtasks` 的 `startedAt`/`finishedAt`/`waitingOn` 和 `limits.maxParallel`、
23
+ `queue.position`),没有第二套状态。窗口窄到 720px 时每一步改成上下两行,时间条
24
+ 占满宽度,不会挤在一起。
25
+
11
26
  ## 0.14.9 — 2026-11-16
12
27
 
13
28
  ### 变化
package/README.en.md CHANGED
@@ -36,12 +36,12 @@ Three steps. The desktop app and the CLI install the same plugin; each step says
36
36
 
37
37
  ### 1. Install
38
38
 
39
- Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.14.9` → install.
39
+ Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.15.0` → install.
40
40
 
41
41
  CLI:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.9
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.0
45
45
  ```
46
46
 
47
47
  **Restart DSH** afterwards — plugins are loaded once at host startup. You can also add the [plugin index](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json) on the **Discover** page for one-click installs; upgrades are always remove-then-add.
@@ -1666,7 +1666,7 @@ appears to "hang" until the ignored-abort child returns.
1666
1666
 
1667
1667
  | What you see | What it means | What to do |
1668
1668
  | --- | --- | --- |
1669
- | `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.9` and read the host log for `[dsh-superagent]` lines. |
1669
+ | `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.15.0` and read the host log for `[dsh-superagent]` lines. |
1670
1670
  | `Cannot find module .../lib/control.js` (or `watch.js` / `report.js` / `wizard.js`), or `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` in the host log | The copy in that profile is incomplete — an `add` that was interrupted leaves a partial extraction. From 0.14.3 the entry point names the missing file itself. The published package is not the cause: every version ships all thirty-four `lib/` files. | Delete the plugin's directory under the profile's `node_modules` (scoped `@xiangyixie/dsh-superagent`, or unscoped `dsh-superagent` from an older tarball install) and run the same `add` command again, with the version number. Do not copy files in by hand. |
1671
1671
  | `[error] the model provider rejected the API key` | The key env var is missing in the process that started the host. | Export `DEEPSEEK_API_KEY` (the default route) or the variable your route names, then restart `dsh`. |
1672
1672
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | The profile's route has no credential in the environment. | Set the env var named for that route and restart. The error line names the route, so use that, not this page. |
package/README.md CHANGED
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
36
36
 
37
37
  ### 1. 装
38
38
 
39
- 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.14.9` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.15.0` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.9
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.0
45
45
  ```
46
46
 
47
47
  装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
1090
1090
 
1091
1091
  | 你看到的 | 含义 | 怎么办 |
1092
1092
  | --- | --- | --- |
1093
- | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.9` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.15.0` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1094
1094
  | `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
1095
1095
  | `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
1096
1096
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
package/README.zh.md CHANGED
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
36
36
 
37
37
  ### 1. 装
38
38
 
39
- 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.14.9` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.15.0` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.14.9
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.0
45
45
  ```
46
46
 
47
47
  装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
1090
1090
 
1091
1091
  | 你看到的 | 含义 | 怎么办 |
1092
1092
  | --- | --- | --- |
1093
- | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.14.9` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.15.0` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1094
1094
  | `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
1095
1095
  | `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
1096
1096
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
package/lib/index.js CHANGED
@@ -3546,6 +3546,7 @@ export function apply(ctx, config) {
3546
3546
  const subtasks = Array.isArray(run.subtasks)
3547
3547
  ? run.subtasks.map(subtask => ({
3548
3548
  index: subtask.index ?? null,
3549
+ key: subtask.key ?? null,
3549
3550
  title: subtask.title ?? null,
3550
3551
  status: subtask.status ?? null,
3551
3552
  childId: subtask.childId ?? null,
@@ -3553,6 +3554,11 @@ export function apply(ctx, config) {
3553
3554
  // every lane looks equally busy.
3554
3555
  startedAt: subtask.startedAt ?? null,
3555
3556
  finishedAt: subtask.finishedAt ?? null,
3557
+ // The scheduler already records why a step has not started. Passing
3558
+ // those edges through lets the page draw the same order, instead of
3559
+ // guessing a queue of its own.
3560
+ dependsOn: Array.isArray(subtask.dependsOn) ? subtask.dependsOn.slice(0, 12) : [],
3561
+ waitingOn: Array.isArray(subtask.waitingOn) ? subtask.waitingOn.slice(0, 12) : [],
3556
3562
  tool: subtask.status === 'running' ? runningToolName(subtask.childId) : null,
3557
3563
  }))
3558
3564
  : []
@@ -3562,8 +3568,22 @@ export function apply(ctx, config) {
3562
3568
  goal: run.goal,
3563
3569
  status: run.status,
3564
3570
  createdAt: run.createdAt ?? null,
3571
+ startedAt: run.startedAt ?? null,
3565
3572
  finishedAt: run.finishedAt ?? null,
3566
3573
  parentSessionId: run.parentSessionId ?? null,
3574
+ // The cap the scheduler really used, and the line it is holding in the
3575
+ // queue, are read from the run record rather than re-derived here.
3576
+ limits: run.limits
3577
+ ? { maxParallel: run.limits.maxParallel ?? null, maxSubtasks: run.limits.maxSubtasks ?? null }
3578
+ : null,
3579
+ queue: run.queue
3580
+ ? {
3581
+ waiting: run.queue.waiting === true,
3582
+ position: run.queue.position ?? null,
3583
+ of: run.queue.of ?? null,
3584
+ enqueuedAt: run.queue.enqueuedAt ?? null,
3585
+ }
3586
+ : null,
3567
3587
  cost: cost
3568
3588
  ? {
3569
3589
  totalMicros: cost.totalMicros,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiangyixie/dsh-superagent",
3
- "version": "0.14.9",
3
+ "version": "0.15.0",
4
4
  "description": "长周期自主执行插件:一个目标拆成可并行的子任务,交付一份合并报告,重启后仍可继续。",
5
5
  "author": "Admire (LittleChenLiya)",
6
6
  "type": "module",
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Superagent 专属空间</title>
6
+ <title>Superagent 控制台</title>
7
7
  <style>
8
8
  :root {
9
9
  color-scheme: dark;
@@ -627,6 +627,56 @@
627
627
  .step.failed .sdot { background: var(--red); }
628
628
  .lane-progress-text { margin-top: 5px; color: var(--faint); font-size: 10.5px; }
629
629
 
630
+ /* ---- schedule board: what runs now, what waits, on one time axis ---- */
631
+ .schedule-wrap { flex: none; padding: 0 22px 10px; max-height: 38vh; overflow: auto; }
632
+ .schedule-wrap[hidden] { display: none; }
633
+ .sched {
634
+ margin: 0 0 10px; padding: 9px 10px 10px;
635
+ border: 1px solid var(--line-soft); border-radius: 10px; background: #0c1217;
636
+ }
637
+ .sched-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; margin-bottom: 7px; }
638
+ .sched-title { color: var(--muted); font-size: 11px; font-weight: 600; }
639
+ .sched-facts { color: var(--faint); font-size: 10.5px; }
640
+ .sched-axis { margin-left: auto; color: var(--faint); font: 10px var(--mono); white-space: nowrap; }
641
+ .sched-run { min-width: 0; padding: 6px 0 2px; border-top: 1px dashed var(--line-soft); }
642
+ .sched-run:first-of-type { border-top: 0; padding-top: 0; }
643
+ .sched-run-head { display: flex; align-items: center; gap: 7px; min-width: 0; margin-bottom: 4px; }
644
+ .sched-goal {
645
+ flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
646
+ color: var(--muted); font-size: 11.5px;
647
+ }
648
+ .sched-time { flex: none; color: var(--faint); font: 10px var(--mono); white-space: nowrap; }
649
+ .sched-row {
650
+ display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
651
+ gap: 8px; align-items: center; min-width: 0; padding: 2px 0;
652
+ }
653
+ .sched-label {
654
+ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
655
+ color: var(--muted); font-size: 10.5px;
656
+ }
657
+ .sched-label .n { color: var(--faint); font-family: var(--mono); margin-right: 4px; }
658
+ .sched-note { color: var(--faint); font-size: 10px; }
659
+ .sched-track {
660
+ position: relative; height: 9px; min-width: 0;
661
+ border-radius: 999px; background: #131c22; overflow: hidden;
662
+ }
663
+ .sched-bar {
664
+ position: absolute; top: 0; bottom: 0; min-width: 2px; border-radius: 999px;
665
+ background: #3a4a55;
666
+ }
667
+ .sched-bar.running { background: var(--amber); }
668
+ .sched-bar.completed { background: var(--green); }
669
+ .sched-bar.failed, .sched-bar.cancelled { background: var(--red); }
670
+ .sched-bar.waiting {
671
+ left: 0; right: 0; background: transparent;
672
+ border: 1px dashed rgba(246, 193, 119, .45);
673
+ }
674
+ .sched-bar.pending { left: 0; right: 0; background: #1d272e; }
675
+ .sched-bar.skipped { left: 0; right: 0; background: repeating-linear-gradient(90deg, #2a3740 0 6px, transparent 6px 11px); }
676
+ .sched-empty { color: var(--faint); font-size: 10.5px; padding: 2px 0 3px; }
677
+ .sched-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; color: var(--faint); font-size: 10px; }
678
+ .sched-legend i { display: inline-block; width: 7px; height: 7px; margin-right: 3px; border-radius: 2px; vertical-align: -1px; }
679
+
630
680
  .summary {
631
681
  margin-top: 10px; padding: 10px 11px; border-radius: 10px;
632
682
  border: 1px solid rgba(99, 214, 164, .28); background: rgba(99, 214, 164, .05);
@@ -699,7 +749,14 @@
699
749
  .brand { min-width: 0; }
700
750
  .brand div span { display: none; }
701
751
  .hint { display: none; }
702
- .messages { padding: 16px 14px 22px; }
752
+ .messages { padding: 16px 14px 22px; }
753
+ .schedule-wrap { padding: 0 14px 10px; max-height: 44vh; }
754
+ /* One column per step: the label sits above its bar, so a narrow screen
755
+ keeps the order and the durations instead of squeezing both sideways. */
756
+ .sched-row { grid-template-columns: minmax(0, 1fr); gap: 3px; }
757
+ .sched-label { white-space: normal; overflow: visible; text-overflow: clip; }
758
+ .sched-axis { margin-left: 0; }
759
+ .sched-goal { white-space: normal; }
703
760
  }
704
761
  </style>
705
762
  </head>
@@ -708,7 +765,7 @@
708
765
  <header class="topbar">
709
766
  <div class="brand">
710
767
  <div class="mark">S</div>
711
- <div><strong>Superagent</strong><span>专属空间</span></div>
768
+ <div><strong>Superagent</strong><span>控制台</span></div>
712
769
  </div>
713
770
  <div class="topbar-mid">
714
771
  <span id="modeBadge" class="badge"><span class="pulse"></span><span id="modeText">连接中</span></span>
@@ -735,14 +792,14 @@
735
792
  <div class="chat-head">
736
793
  <div>
737
794
  <h1>Superagent</h1>
738
- <p>说一句就行 · 自动拆成任务线并行推进 · 跑完在这一条对话里汇总</p>
795
+ <p>说一句要做什么;它自己决定一步做完还是拆开并行,跑完在这里汇总</p>
739
796
  </div>
740
797
  <div id="typing" class="typing" hidden><span></span><span></span><span></span><em id="typingText" style="font-style:normal;margin-left:3px">运行中</em></div>
741
798
  </div>
742
- <div id="messages" class="messages" aria-live="polite"></div>
743
- <form id="composer" class="composer" autocomplete="off">
799
+ <section id="scheduleWrap" class="schedule-wrap" aria-label="调度" hidden></section>
800
+ <div id="messages" class="messages" aria-live="polite"></div> <form id="composer" class="composer" autocomplete="off">
744
801
  <div class="composer-box">
745
- <textarea id="input" rows="1" placeholder="直接说你想让它做什么…" disabled></textarea>
802
+ <textarea id="input" rows="1" placeholder="要做什么…" disabled></textarea>
746
803
  <div class="composer-bar">
747
804
  <span class="hint">Enter 发送 · Shift+Enter 换行</span>
748
805
  <button id="send" class="send" type="submit" aria-label="发送" disabled>↑</button>
@@ -787,7 +844,7 @@
787
844
  <h3>会话</h3>
788
845
  <div id="advSession" class="adv-kv"></div>
789
846
  <div class="adv-actions">
790
- <button id="wizardOpen" class="btn tiny" type="button">首次使用向导</button>
847
+ <button id="wizardOpen" class="btn tiny" type="button">配置向导</button>
791
848
  </div>
792
849
  </section>
793
850
  <section class="adv-sec">
@@ -813,9 +870,9 @@
813
870
  <div id="gate" class="gate" hidden>
814
871
  <form id="gateForm" class="gate-card">
815
872
  <div class="mark">S</div>
816
- <h1>连接 Superagent Console</h1>
817
- <p>从宿主状态目录的 <code>console.json</code> 读取一次性 token。控制台只监听 127.0.0.1,token 每次启动都会重新生成。</p>
818
- <label for="tokenInput">访问令牌</label>
873
+ <h1>连接 Superagent 控制台</h1>
874
+ <p>token 在宿主状态目录的 <code>console.json</code> 里,每次启动都会换。控制台只监听 127.0.0.1。</p>
875
+ <label for="tokenInput">token</label>
819
876
  <input id="tokenInput" type="password" autocomplete="off" spellcheck="false" placeholder="粘贴 token">
820
877
  <button type="submit">连接</button>
821
878
  <p id="gateError" class="error"></p>
@@ -827,8 +884,8 @@
827
884
  <dialog id="wizardDialog">
828
885
  <div class="wiz-head">
829
886
  <div>
830
- <span class="kicker">首次使用向导</span>
831
- <h2>用鼠标完成配置,并当场试跑</h2>
887
+ <span class="kicker">首次配置</span>
888
+ <h2>填好配置,当场试跑</h2>
832
889
  </div>
833
890
  <button id="wizardClose" type="button" aria-label="关闭">×</button>
834
891
  </div>
@@ -855,7 +912,8 @@
855
912
 
856
913
  const TOKEN_KEY = 'dsh-superagent-console-token'
857
914
  const $ = id => document.getElementById(id)
858
- const messagesEl = $('messages')
915
+ const messagesEl = $('messages')
916
+ const scheduleWrapEl = $('scheduleWrap')
859
917
  const inputEl = $('input')
860
918
  const sendEl = $('send')
861
919
  const composerEl = $('composer')
@@ -932,6 +990,7 @@
932
990
  preset: null,
933
991
  laneEls: new Map(),
934
992
  runAnchors: new Map(),
993
+ scheduleSig: '',
935
994
  attentionSeen: new Set(),
936
995
  approvals: new Map(),
937
996
  sessions: [],
@@ -999,7 +1058,7 @@
999
1058
 
1000
1059
  function statusText(status) {
1001
1060
  const map = {
1002
- queued: '排队中', planning: '规划中', running: '运行中', aggregating: '汇总中',
1061
+ queued: '排队中', planning: '拆步骤中', running: '运行中', aggregating: '汇总中',
1003
1062
  completed: '已完成', failed: '失败', cancelled: '已取消', interrupted: '已中断',
1004
1063
  blocked: '已阻塞',
1005
1064
  }
@@ -1063,8 +1122,8 @@
1063
1122
 
1064
1123
  function setSession(sessionId) {
1065
1124
  STATE.sessionId = sessionId
1066
- sessionLabelEl.textContent = sessionId ? `session ${shortId(sessionId)}` : 'no session'
1067
- sessionLabelEl.title = sessionId || 'Host Session id'
1125
+ sessionLabelEl.textContent = sessionId ? `session ${shortId(sessionId)}` : '没有会话'
1126
+ sessionLabelEl.title = sessionId || '宿主会话 id'
1068
1127
  }
1069
1128
 
1070
1129
  function scrollToEnd() {
@@ -1131,13 +1190,13 @@
1131
1190
  if (message.role === 'assistant') {
1132
1191
  const copy = el('button', '', '复制')
1133
1192
  copy.type = 'button'
1134
- copy.title = '复制这条回复的完整文本'
1193
+ copy.title = '复制这条回复的全文'
1135
1194
  copy.addEventListener('click', () => copyMessage(message, copy))
1136
1195
  actions.append(copy)
1137
1196
  } else {
1138
1197
  const edit = el('button', '', '编辑并重发')
1139
1198
  edit.type = 'button'
1140
- edit.title = '把这条原文放回输入框,改完再发送'
1199
+ edit.title = '把原文放回输入框,改完再发'
1141
1200
  edit.addEventListener('click', () => editMessage(message))
1142
1201
  actions.append(edit)
1143
1202
  }
@@ -1183,10 +1242,10 @@
1183
1242
  async function copyMessage(message, button) {
1184
1243
  const copied = await copyText(formatTextOf(message))
1185
1244
  if (!copied) {
1186
- pushToast('复制失败,可以手动选中文字。', 'err')
1245
+ pushToast('复制失败。手动选中文字再复制。', 'err')
1187
1246
  return
1188
1247
  }
1189
- pushToast('已复制这条回复。', 'ok')
1248
+ pushToast('已复制。', 'ok')
1190
1249
  button.textContent = '已复制'
1191
1250
  setTimeout(() => { button.textContent = '复制' }, 1600)
1192
1251
  }
@@ -1199,7 +1258,7 @@
1199
1258
  inputEl.dispatchEvent(new Event('input'))
1200
1259
  inputEl.focus()
1201
1260
  try { inputEl.setSelectionRange(text.length, text.length) } catch { /* not focusable yet */ }
1202
- pushToast('原文已放回输入框,改完点发送。', 'ok')
1261
+ pushToast('已放回输入框,改完点发送。', 'ok')
1203
1262
  }
1204
1263
 
1205
1264
  function summarizeArgs(value) {
@@ -1227,7 +1286,7 @@
1227
1286
  if (tool.done) {
1228
1287
  const details = el('details')
1229
1288
  details.append(el('summary', failed ? 'err-mark' : '', failed ? '失败原因' : '结果'))
1230
- details.append(el('pre', '', tool.result || (failed ? '工具没有返回错误文本。' : '')))
1289
+ details.append(el('pre', '', tool.result || (failed ? '工具没有给出错误说明。' : '')))
1231
1290
  chip.append(details)
1232
1291
  }
1233
1292
  return chip
@@ -1286,15 +1345,15 @@
1286
1345
  if (STATE.mode !== 'chat') {
1287
1346
  wrap.classList.add('unavailable')
1288
1347
  wrap.append(el('div', 'orb', '!'))
1289
- wrap.append(el('h1', '', '对话不可用'))
1290
- wrap.append(el('p', '', '这个宿主没有提供可对话的 Session。控制台不会画一个假聊天框。'))
1348
+ wrap.append(el('h1', '', '这里不能对话'))
1349
+ wrap.append(el('p', '', '宿主没有可用的会话,所以这里不能开始对话。'))
1291
1350
  if (STATE.capabilities?.reason) wrap.append(el('div', 'reason', STATE.capabilities.reason))
1292
1351
  messagesEl.append(wrap)
1293
1352
  return
1294
1353
  }
1295
1354
  wrap.append(el('div', 'orb', 'S'))
1296
- wrap.append(el('h1', '', '今天想推进什么?'))
1297
- wrap.append(el('p', '', '这里是 Superagent 的专属空间,和宿主的普通会话分开。直接说一句就行:它会自己判断是一步做完,还是拆成几条任务线并行推进;跑完在这一条对话里汇总,并把可以点开的产物放在这里。'))
1355
+ wrap.append(el('h1', '', '要做什么?'))
1356
+ wrap.append(el('p', '', '写下要做的事。它自己决定一步做完,还是拆成几条同时做;跑完在这里汇总,能点开的产物也放在这里。'))
1298
1357
  const examples = el('div', 'examples')
1299
1358
  const samples = [
1300
1359
  '把这周的项目进度整理成一页 HTML 报告',
@@ -1394,7 +1453,7 @@
1394
1453
  noticeCountEl.textContent = unread > 99 ? '99+' : String(unread)
1395
1454
  noticeOpenEl.classList.toggle('has-unread', unread > 0)
1396
1455
  noticeOpenEl.title = unread > 0 ? `${unread} 条没看过的提醒` : '提醒'
1397
- const base = 'Superagent 专属空间'
1456
+ const base = 'Superagent 控制台'
1398
1457
  document.title = unread > 0 ? `(${unread}) ${base}` : base
1399
1458
  if (!noticePanelEl.hidden) renderNoticeList()
1400
1459
  }
@@ -1402,7 +1461,7 @@
1402
1461
  function renderNoticeList() {
1403
1462
  noticeListEl.textContent = ''
1404
1463
  if (STATE.notices.length === 0) {
1405
- noticeListEl.append(el('div', 'notice-empty', '还没有提醒。任务跑完、没走通或等你批准时会出现在这里。'))
1464
+ noticeListEl.append(el('div', 'notice-empty', '没有提醒。任务跑完、失败或等你批准时会出现在这里。'))
1406
1465
  return
1407
1466
  }
1408
1467
  for (const notice of STATE.notices) {
@@ -1506,21 +1565,21 @@
1506
1565
  const list = Array.from(files || []).filter(Boolean)
1507
1566
  if (list.length === 0) return
1508
1567
  if (STATE.mode !== 'chat') {
1509
- pushToast('还没连上,等对话就绪再放文件。', 'err')
1568
+ pushToast('还没连上,等对话准备好再放文件。', 'err')
1510
1569
  return
1511
1570
  }
1512
1571
  for (const file of list) {
1513
1572
  const ext = uploadExtOf(file.name)
1514
1573
  if (!UPLOAD_EXTS.has(ext)) {
1515
- pushToast(`不能放 ${ext || '没有扩展名的'} 文件;可以放:${UPLOAD_HINT}。`, 'err')
1574
+ pushToast(`不能放 ${ext || '没有扩展名的'} 文件。可以放:${UPLOAD_HINT}。`, 'err')
1516
1575
  continue
1517
1576
  }
1518
1577
  if (file.size > UPLOAD_MAX) {
1519
- pushToast(`${file.name} 有 ${uploadSizeText(file.size)},超过 ${uploadSizeText(UPLOAD_MAX)} 的上限。`, 'err')
1578
+ pushToast(`${file.name} 有 ${uploadSizeText(file.size)},超过 ${uploadSizeText(UPLOAD_MAX)} 上限。`, 'err')
1520
1579
  continue
1521
1580
  }
1522
1581
  if (file.size === 0) {
1523
- pushToast(`${file.name} 是空文件,没有放进去。`, 'err')
1582
+ pushToast(`${file.name} 是空文件,没放进去。`, 'err')
1524
1583
  continue
1525
1584
  }
1526
1585
  try {
@@ -1530,7 +1589,7 @@
1530
1589
  body: { sessionId: STATE.sessionId, name: file.name, data: base64OfBytes(bytes) },
1531
1590
  })
1532
1591
  insertUploadPath(data.path)
1533
- pushToast(`已放进工作区:${data.name}(路径已写进消息)。`, 'ok')
1592
+ pushToast(`已放进工作区:${data.name}。路径写进了消息。`, 'ok')
1534
1593
  } catch (error) {
1535
1594
  const hint = error.hint ? `。${error.hint}` : ''
1536
1595
  pushToast(`放不进去:${messageOf(error)}${hint}`, 'err')
@@ -1596,11 +1655,214 @@
1596
1655
  }
1597
1656
  }
1598
1657
 
1658
+ // ---------- schedule board ----------
1659
+ //
1660
+ // The board is a projection of the run records the host already writes: run
1661
+ // status, each step's status/startedAt/finishedAt, the waitingOn keys the
1662
+ // graph scheduler sets, and the run's own maxParallel/queue. Nothing here
1663
+ // invents a second queue or recomputes progress.
1664
+
1665
+ function timeOf(value) {
1666
+ const ms = typeof value === 'number' ? value : Date.parse(value)
1667
+ return Number.isFinite(ms) ? ms : null
1668
+ }
1669
+
1670
+ function scheduleAxis(runs) {
1671
+ let start = Infinity
1672
+ let end = 0
1673
+ for (const run of runs) {
1674
+ const created = timeOf(run.createdAt)
1675
+ if (created !== null) {
1676
+ start = Math.min(start, created)
1677
+ end = Math.max(end, created)
1678
+ }
1679
+ for (const subtask of Array.isArray(run.subtasks) ? run.subtasks : []) {
1680
+ const began = timeOf(subtask.startedAt)
1681
+ if (began !== null) {
1682
+ start = Math.min(start, began)
1683
+ end = Math.max(end, began)
1684
+ }
1685
+ const ended = timeOf(subtask.finishedAt)
1686
+ if (ended !== null) end = Math.max(end, ended)
1687
+ }
1688
+ const finished = timeOf(run.finishedAt)
1689
+ if (finished !== null) end = Math.max(end, finished)
1690
+ }
1691
+ if (!Number.isFinite(start)) start = Date.now()
1692
+ const live = runs.some(run => !isTerminal(run.status))
1693
+ const right = Math.max(end, live ? Date.now() : 0, start + 1000)
1694
+ return { start, end: right, live }
1695
+ }
1696
+
1697
+ function scheduleStats(runs) {
1698
+ const active = runs.filter(run => !isTerminal(run.status) && run.status !== 'queued')
1699
+ const queued = runs.filter(run => run.status === 'queued')
1700
+ const steps = runs.flatMap(run => (Array.isArray(run.subtasks) ? run.subtasks : []))
1701
+ const running = steps.filter(subtask => subtask.status === 'running').length
1702
+ const waiting = steps.filter(subtask => subtask.status === 'waiting').length
1703
+ const cap = runs.reduce((best, run) => Math.max(best, Number(run.limits?.maxParallel) || 0), 0)
1704
+ return { active, queued, running, waiting, cap }
1705
+ }
1706
+
1707
+ function stepTitleOf(run, key) {
1708
+ const hit = (Array.isArray(run.subtasks) ? run.subtasks : []).find(subtask => subtask.key === key)
1709
+ return hit ? stepLabel(hit) : String(key)
1710
+ }
1711
+
1712
+ function scheduleBar(subtask, run, axis) {
1713
+ const began = timeOf(subtask.startedAt) ?? timeOf(run.startedAt) ?? timeOf(run.createdAt)
1714
+ if (began === null) return null
1715
+ const ended = timeOf(subtask.finishedAt) ?? (subtask.status === 'running' ? Date.now() : null)
1716
+ if (ended === null) return null
1717
+ const span = Math.max(1000, axis.end - axis.start)
1718
+ const left = Math.max(0, Math.min(99, ((began - axis.start) / span) * 100))
1719
+ const width = Math.max(1.2, Math.min(100 - left, ((ended - began) / span) * 100))
1720
+ return { left, width }
1721
+ }
1722
+
1723
+ function scheduleRow(run, subtask, axis) {
1724
+ const row = el('div', 'sched-row')
1725
+ const label = el('div', 'sched-label')
1726
+ label.title = stepLabel(subtask)
1727
+ label.append(el('span', 'n', subtask.key || String(subtask.index ?? '·')))
1728
+ label.append(document.createTextNode(stepLabel(subtask)))
1729
+ const notes = []
1730
+ if (subtask.status === 'running' && subtask.tool) notes.push(`工具 ${subtask.tool}`)
1731
+ const waits = Array.isArray(subtask.waitingOn) ? subtask.waitingOn : []
1732
+ if (waits.length > 0) notes.push(`等「${waits.map(key => stepTitleOf(run, key)).join('」「')}」`)
1733
+ else if (subtask.status === 'waiting') notes.push('等前一步')
1734
+ if (subtask.status === 'skipped') notes.push('跳过')
1735
+ if (notes.length > 0) label.append(el('span', 'sched-note', ` · ${notes.join(' · ')}`))
1736
+ row.append(label)
1737
+
1738
+ const track = el('div', 'sched-track')
1739
+ const range = scheduleBar(subtask, run, axis)
1740
+ const status = subtask.status || 'pending'
1741
+ const bar = el('i', `sched-bar ${status}`)
1742
+ if (range) {
1743
+ bar.style.left = `${range.left}%`
1744
+ bar.style.width = `${range.width}%`
1745
+ if (status === 'running') {
1746
+ const began = timeOf(subtask.startedAt) ?? timeOf(run.startedAt) ?? timeOf(run.createdAt)
1747
+ if (began !== null) bar.dataset.start = String(began)
1748
+ }
1749
+ }
1750
+ track.append(bar)
1751
+ row.append(track)
1752
+ return row
1753
+ }
1754
+
1755
+ function scheduleElement(runs) {
1756
+ const stats = scheduleStats(runs)
1757
+ const axis = scheduleAxis(runs)
1758
+ const box = el('div', 'sched')
1759
+ box.dataset.axisStart = String(axis.start)
1760
+ box.dataset.live = axis.live ? '1' : ''
1761
+
1762
+ const head = el('div', 'sched-head')
1763
+ head.append(el('span', 'sched-title', '调度'))
1764
+ const facts = []
1765
+ if (stats.running > 0) facts.push(`并行 ${stats.running}${stats.cap > 0 ? `/${stats.cap}` : ''} 步`)
1766
+ if (stats.active.length > 0) facts.push(`${stats.active.length} 条任务线在跑`)
1767
+ if (stats.waiting > 0) facts.push(`${stats.waiting} 步等前一步`)
1768
+ if (stats.queued.length > 0) facts.push(`${stats.queued.length} 条排队`)
1769
+ if (facts.length === 0) facts.push(runs.every(run => isTerminal(run.status)) ? '这一轮已结束' : '还没有步骤在跑')
1770
+ head.append(el('span', 'sched-facts', facts.join(' · ')))
1771
+ head.append(el('span', 'sched-axis', formatClock(axis.end - axis.start)))
1772
+ box.append(head)
1773
+
1774
+ for (const run of runs) {
1775
+ const section = el('div', 'sched-run')
1776
+ const runHead = el('div', 'sched-run-head')
1777
+ runHead.append(el('span', 'sched-goal', run.goal || '这条任务线'))
1778
+ runHead.append(el('span', `status-pill ${statusClass(run.status)}`, laneStatusText(run)))
1779
+ if (run.status === 'queued') {
1780
+ const queue = run.queue || {}
1781
+ runHead.append(el('span', 'sched-time', queue.position
1782
+ ? `排第 ${queue.position}${queue.of ? ` / ${queue.of}` : ''}`
1783
+ : '排队中'))
1784
+ } else {
1785
+ runHead.append(el('span', 'sched-time', laneElapsed(run)))
1786
+ }
1787
+ section.append(runHead)
1788
+
1789
+ const subtasks = Array.isArray(run.subtasks) ? run.subtasks : []
1790
+ if (subtasks.length === 0) {
1791
+ section.append(el('div', 'sched-empty', run.status === 'queued'
1792
+ ? '等前面的任务线跑完再开始'
1793
+ : run.status === 'planning' ? '拆步骤中,还没有步骤时间' : '还没有步骤记录'))
1794
+ } else {
1795
+ for (const subtask of subtasks.slice(0, 10)) section.append(scheduleRow(run, subtask, axis))
1796
+ if (subtasks.length > 10) section.append(el('div', 'sched-empty', `还有 ${subtasks.length - 10} 个步骤`))
1797
+ }
1798
+ box.append(section)
1799
+ }
1800
+
1801
+ const legend = el('div', 'sched-legend')
1802
+ for (const [kind, text] of [
1803
+ ['running', '在跑'],
1804
+ ['waiting', '等前一步'],
1805
+ ['completed', '完成'],
1806
+ ['failed', '失败'],
1807
+ ]) {
1808
+ const item = el('span')
1809
+ const dot = el('i')
1810
+ dot.style.background = kind === 'running' ? 'var(--amber)'
1811
+ : kind === 'completed' ? 'var(--green)'
1812
+ : kind === 'failed' ? 'var(--red)' : 'transparent'
1813
+ if (kind === 'waiting') dot.style.border = '1px dashed rgba(246, 193, 119, .55)'
1814
+ item.append(dot, document.createTextNode(text))
1815
+ legend.append(item)
1816
+ }
1817
+ box.append(legend)
1818
+ return box
1819
+ }
1820
+
1821
+ /** One board for every line the host is still working on. */
1822
+ function renderSchedule() {
1823
+ const runs = STATE.runs.filter(run => !isTerminal(run.status))
1824
+ if (runs.length === 0) {
1825
+ scheduleWrapEl.hidden = true
1826
+ if (STATE.scheduleSig !== '') {
1827
+ STATE.scheduleSig = ''
1828
+ scheduleWrapEl.replaceChildren()
1829
+ }
1830
+ return
1831
+ }
1832
+ const signature = runs.map(run => [
1833
+ run.id, laneSignature(run), run.queue?.position ?? '', run.queue?.waiting ? 'queued' : '',
1834
+ ].join(':')).join('#')
1835
+ if (signature === STATE.scheduleSig) return
1836
+ STATE.scheduleSig = signature
1837
+ scheduleWrapEl.hidden = false
1838
+ scheduleWrapEl.replaceChildren(scheduleElement(runs))
1839
+ }
1840
+
1841
+ /** Running bars grow with the clock between run frames. */
1842
+ function tickSchedule() {
1843
+ const now = Date.now()
1844
+ for (const box of document.querySelectorAll('.sched')) {
1845
+ const start = Number(box.dataset.axisStart)
1846
+ if (!Number.isFinite(start)) continue
1847
+ for (const bar of box.querySelectorAll('.sched-bar[data-start]')) {
1848
+ const began = Number(bar.dataset.start)
1849
+ if (!Number.isFinite(began)) continue
1850
+ const span = Math.max(1000, now - start)
1851
+ const left = Math.max(0, Math.min(99, ((began - start) / span) * 100))
1852
+ const width = Math.max(1.2, Math.min(100 - left, ((now - began) / span) * 100))
1853
+ bar.style.left = `${left}%`
1854
+ bar.style.width = `${width}%`
1855
+ }
1856
+ const label = box.querySelector('.sched-axis')
1857
+ if (label && box.dataset.live === '1') label.textContent = formatClock(now - start)
1858
+ }
1859
+ }
1860
+
1599
1861
  function syncStopAll() {
1600
1862
  const active = STATE.runs.filter(run => !isTerminal(run.status))
1601
1863
  stopAllEl.hidden = active.length === 0
1602
1864
  stopAllEl.disabled = STATE.mode !== 'chat' || active.length === 0 || STATE.stopAllBusy
1603
- stopAllEl.textContent = STATE.stopAllBusy ? '正在停止…' : '停止这一轮'
1865
+ stopAllEl.textContent = STATE.stopAllBusy ? '停止中…' : '停止这一轮'
1604
1866
  }
1605
1867
 
1606
1868
  async function stopRun(runId) {
@@ -1645,17 +1907,17 @@
1645
1907
  function currentAction(run) {
1646
1908
  const subtasks = Array.isArray(run.subtasks) ? run.subtasks : []
1647
1909
  if (STATE.cancelRequested.has(run.id) && !isTerminal(run.status)) return '已请求停止,等宿主确认'
1648
- if (run.status === 'queued') return '排队,等前一条任务线让出位置'
1649
- if (run.status === 'planning') return '正在拆步骤'
1650
- if (run.status === 'aggregating') return '正在汇总各步骤的结果'
1910
+ if (run.status === 'queued') return '排队,等前面的任务线跑完'
1911
+ if (run.status === 'planning') return '拆分步骤中'
1912
+ if (run.status === 'aggregating') return '汇总各步骤的结果'
1651
1913
  if (run.status === 'completed') return '已交付,产物见汇总'
1652
1914
  if (isTerminal(run.status)) return run.status === 'cancelled' ? '已取消' : '没走通,原因见汇总'
1653
1915
  const running = subtasks.filter(subtask => subtask.status === 'running')
1654
1916
  if (running.length > 1) return `同时推进 ${running.length} 个步骤`
1655
- if (running.length === 1) return `正在做:${stepLabel(running[0])}`
1917
+ if (running.length === 1) return `正在做 ${stepLabel(running[0])}`
1656
1918
  const next = subtasks.find(subtask => subtask.status !== 'completed' && subtask.status !== 'failed')
1657
- if (next) return `准备:${stepLabel(next)}`
1658
- return '正在推进'
1919
+ if (next) return `接下来 ${stepLabel(next)}`
1920
+ return '进行中'
1659
1921
  }
1660
1922
 
1661
1923
  /** Tools the running steps report right now; empty when unknown, never guessed. */
@@ -1668,12 +1930,20 @@
1668
1930
 
1669
1931
  function laneSignature(run) {
1670
1932
  const steps = Array.isArray(run.subtasks)
1671
- ? run.subtasks.map(subtask => `${subtask.status}:${subtask.title}:${subtask.tool || ''}`).join(',')
1933
+ ? run.subtasks.map(subtask => [
1934
+ subtask.status, subtask.key || '', subtask.title, subtask.tool || '',
1935
+ subtask.startedAt || '', subtask.finishedAt || '',
1936
+ (subtask.waitingOn || []).join('.'), (subtask.dependsOn || []).join('.'),
1937
+ ].join(':')).join(',')
1672
1938
  : ''
1673
1939
  const attention = Array.isArray(run.attention)
1674
1940
  ? run.attention.map(item => `${item.id}:${item.question}`).join(',')
1675
1941
  : ''
1676
- return [run.status, steps, attention, run.report ? run.report.length : 0, run.finishedAt || '', STATE.cancelRequested.has(run.id) ? 'stopping' : ''].join('|')
1942
+ return [
1943
+ run.status, steps, attention, run.report ? run.report.length : 0, run.finishedAt || '',
1944
+ STATE.cancelRequested.has(run.id) ? 'stopping' : '',
1945
+ run.limits?.maxParallel ?? '', run.queue?.position ?? '', run.queue?.waiting ? 'queued' : '',
1946
+ ].join('|')
1677
1947
  }
1678
1948
 
1679
1949
  /**
@@ -1945,7 +2215,7 @@
1945
2215
  const done = runs.every(run => isTerminal(run.status))
1946
2216
  const head = el('div', `lane-group-head${done ? ' done' : ''}`)
1947
2217
  head.append(el('span', 'dot'))
1948
- head.append(el('span', '', done ? `这一轮完成 · ${runs.length} 条任务线` : `推进中 · ${runs.length} 条任务线`))
2218
+ head.append(el('span', '', done ? `这一轮完成 · ${runs.length} 条任务线` : `进行中 · ${runs.length} 条任务线`))
1949
2219
  node.append(head)
1950
2220
  for (const run of runs) node.append(laneElement(run))
1951
2221
  if (done) node.append(summaryElement(runs))
@@ -1987,6 +2257,7 @@
1987
2257
  if (!run || isTerminal(run.status)) STATE.cancelRequested.delete(id)
1988
2258
  }
1989
2259
  syncStopAll()
2260
+ renderSchedule()
1990
2261
  renderHistory()
1991
2262
  }
1992
2263
 
@@ -2030,7 +2301,7 @@
2030
2301
  if (historyDrawerEl.hidden) return
2031
2302
  historyListEl.replaceChildren()
2032
2303
  if (STATE.sessionsBusy && STATE.sessions.length === 0) {
2033
- historyListEl.append(el('p', 'adv-note', '正在读取对话…'))
2304
+ historyListEl.append(el('p', 'adv-note', '读取中…'))
2034
2305
  return
2035
2306
  }
2036
2307
  if (STATE.sessionNote) {
@@ -2172,7 +2443,7 @@
2172
2443
  const failed = runs.filter(run => isTerminal(run.status) && run.status !== 'completed')
2173
2444
  const box = el('div', `summary${failed.length > 0 ? ' bad' : ''}`)
2174
2445
  box.append(el('div', 'st', failed.length > 0
2175
- ? `完成,${failed.length} 条任务线没走通`
2446
+ ? `完成 · ${failed.length} 条任务线失败`
2176
2447
  : `全部完成 · ${runs.length} 条任务线`))
2177
2448
 
2178
2449
  const first = runs.map(run => Date.parse(run.createdAt)).filter(Number.isFinite).sort((a, b) => a - b)[0]
@@ -2196,7 +2467,7 @@
2196
2467
  for (const item of artifacts) list.append(artifactElement(item))
2197
2468
  box.append(list)
2198
2469
  } else {
2199
- box.append(el('div', 'sd', '这次没有可以点开的产物;完整汇总在下面。'))
2470
+ box.append(el('div', 'sd', '这次没有能点开的产物,完整汇总在下面。'))
2200
2471
  }
2201
2472
 
2202
2473
  const details = el('details', 'report')
@@ -2204,7 +2475,7 @@
2204
2475
  for (const run of runs) {
2205
2476
  const block = el('div', 'sum-run')
2206
2477
  block.append(el('div', 'sum-run-title', `${run.goal || '任务线'} · ${laneStatusText(run)}`))
2207
- block.append(el('pre', '', run.report || '(这条任务线没有返回报告)'))
2478
+ block.append(el('pre', '', run.report || '(这条任务线没有报告)'))
2208
2479
  details.append(block)
2209
2480
  }
2210
2481
  box.append(details)
@@ -2218,7 +2489,7 @@
2218
2489
  function attentionElement(run, item) {
2219
2490
  const card = el('div', 'attention-card')
2220
2491
  card.append(el('div', 'kicker', '需要你决定'))
2221
- card.append(el('p', '', item.question || '运行中的任务在等一个决定'))
2492
+ card.append(el('p', '', item.question || '任务在等一个决定'))
2222
2493
  if (item.reason) card.append(el('p', 'reason', item.reason))
2223
2494
 
2224
2495
  const key = draftKey(run.id, item.id)
@@ -2274,7 +2545,7 @@
2274
2545
  body: { sessionId: STATE.sessionId, runId, attentionId, answer },
2275
2546
  })
2276
2547
  STATE.drafts.delete(key)
2277
- pushToast('决定已提交,任务线会在下一个边界应用。', 'ok')
2548
+ pushToast('已提交。任务线会在下一步用上这个决定。', 'ok')
2278
2549
  } catch (error) {
2279
2550
  pushToast(`提交失败:${messageOf(error)}`, 'err')
2280
2551
  } finally {
@@ -2353,7 +2624,7 @@
2353
2624
  }
2354
2625
  const tool = `${approval.toolName || ''}`.toLowerCase()
2355
2626
  const clip = value => (value.length > CALL_PREVIEW_LIMIT
2356
- ? { text: `${value.slice(0, CALL_PREVIEW_LIMIT)}\n…`, note: `共 ${value.length} 字符,这里先看前 ${CALL_PREVIEW_LIMIT} 字符。` }
2627
+ ? { text: `${value.slice(0, CALL_PREVIEW_LIMIT)}\n…`, note: `共 ${value.length} 字符,这里显示前 ${CALL_PREVIEW_LIMIT} 字符。` }
2357
2628
  : { text: value, note: '' })
2358
2629
  if (/write|edit|patch|apply|create|append/.test(tool)) {
2359
2630
  const body = pick('content', 'contents', 'text', 'new_string', 'newText', 'patch', 'diff')
@@ -2378,7 +2649,7 @@
2378
2649
  const target = approvalTarget(approval)
2379
2650
  if (target) card.append(el('div', 'where', `要动的位置:${target}`))
2380
2651
  const reason = approval.displayReason?.zh || approval.reason
2381
- card.append(el('p', 'why', reason || '宿主的工具调用被拦住了,需要你明确决定这一次。'))
2652
+ card.append(el('p', 'why', reason || '宿主拦住了这次工具调用,需要你决定。'))
2382
2653
  const preview = approvalCallPreview(approval)
2383
2654
  if (preview) {
2384
2655
  const details = el('details', 'call')
@@ -2418,8 +2689,8 @@
2418
2689
  const left = expiresAt - Date.now()
2419
2690
  node.classList.toggle('soon', left > 0 && left <= 60_000)
2420
2691
  node.classList.toggle('over', left <= 0)
2421
- if (left <= 0) node.textContent = `已超过有效期(${timeLabel(expiresAt)}),宿主会按拒绝处理;再发起会重新询问。`
2422
- else node.textContent = `剩余有效时间 ${formatClock(left)}(约到 ${timeLabel(expiresAt)})`
2692
+ if (left <= 0) node.textContent = `已过有效期(${timeLabel(expiresAt)}),宿主按拒绝处理。再发起会重新询问。`
2693
+ else node.textContent = `还剩 ${formatClock(left)}(约到 ${timeLabel(expiresAt)})`
2423
2694
  }
2424
2695
 
2425
2696
  function updateApprovalClocks() {
@@ -2431,8 +2702,8 @@
2431
2702
  entry.node.querySelector('.options')?.remove()
2432
2703
  const state = entry.node.querySelector('.state')
2433
2704
  if (!state) return
2434
- if (entry.decided === 'allow') state.textContent = '已允许这一次(只对这一条调用生效)'
2435
- else if (entry.decided === 'allow-tool') state.textContent = `已允许,并在本会话内放行 ${entry.approval?.toolName || '这个工具'}(换对话后恢复询问)`
2705
+ if (entry.decided === 'allow') state.textContent = '已允许这一次。只对这一条调用生效。'
2706
+ else if (entry.decided === 'allow-tool') state.textContent = `已允许,本会话内 ${entry.approval?.toolName || '这个工具'} 不再询问;换对话后恢复。`
2436
2707
  else if (entry.decided === 'reject') state.textContent = '已拒绝'
2437
2708
  else if (entry.decided === 'expired') state.textContent = '已过有效期,宿主按拒绝处理'
2438
2709
  else if (entry.decided === 'cancelled') state.textContent = '没有回答,按拒绝处理'
@@ -2474,22 +2745,22 @@
2474
2745
  if (!entry || entry.decided) return
2475
2746
  const state = entry.node.querySelector('.state')
2476
2747
  for (const button of entry.node.querySelectorAll('button')) button.disabled = true
2477
- const pending = { allow: '正在允许这一次…', 'allow-tool': '正在允许这个工具…', reject: '正在拒绝…' }
2478
- if (state) state.textContent = pending[decision] || '正在提交…'
2748
+ const pending = { allow: '允许中…', 'allow-tool': '放行中…', reject: '拒绝中…' }
2749
+ if (state) state.textContent = pending[decision] || '提交中…'
2479
2750
  try {
2480
2751
  await api('/api/console/approval', { method: 'POST', body: { id, decision } })
2481
2752
  entry.decided = decision
2482
2753
  settleApprovalNode(entry)
2483
2754
  const done = {
2484
- allow: '已允许这一次;只对这一条调用生效。',
2485
- 'allow-tool': '已允许:本会话内同一个工具不再询问(换对话后恢复)。',
2755
+ allow: '已允许这一次,只对这一条调用生效。',
2756
+ 'allow-tool': '已允许。本会话内这个工具不再询问,换对话后恢复。',
2486
2757
  reject: '已拒绝这一条调用。',
2487
2758
  }
2488
2759
  pushToast(done[decision] || '已提交。', 'ok')
2489
2760
  } catch (error) {
2490
2761
  for (const button of entry.node.querySelectorAll('button')) button.disabled = false
2491
- if (state) state.textContent = `没有提交成功:${messageOf(error)}`
2492
- pushToast(`审批没有提交成功:${messageOf(error)}`, 'err')
2762
+ if (state) state.textContent = `提交失败:${messageOf(error)}`
2763
+ pushToast(`审批没提交上:${messageOf(error)}`, 'err')
2493
2764
  }
2494
2765
  }
2495
2766
 
@@ -2509,7 +2780,7 @@
2509
2780
  if (data.report) renderMarkdownInto(dialogReportEl, data.report)
2510
2781
  else {
2511
2782
  dialogReportEl.textContent = ''
2512
- dialogReportEl.append(el('p', '', '(这个 run 还没有报告)'))
2783
+ dialogReportEl.append(el('p', '', '(这条任务线还没有报告)'))
2513
2784
  }
2514
2785
  reportDialogEl.showModal()
2515
2786
  } catch (error) {
@@ -2571,9 +2842,9 @@
2571
2842
  if (frame.action === 'asked' && approval && approval.id) {
2572
2843
  seatApproval(approval)
2573
2844
  refreshNotices({ toastNew: true })
2574
- pushToast('有一个工具调用在等你决定。', 'warn')
2845
+ pushToast('有工具调用等你决定。', 'warn')
2575
2846
  } else if (frame.action === 'auto') {
2576
- pushToast(`已按本会话的许可放行 ${frame.toolName || '这个工具'},没有再打断你。`, 'ok')
2847
+ pushToast(`已放行 ${frame.toolName || '这个工具'},本会话内不再询问。`, 'ok')
2577
2848
  } else if ((frame.action === 'decided' || frame.action === 'expired') && frame.id) {
2578
2849
  const entry = STATE.approvals.get(frame.id)
2579
2850
  if (entry) {
@@ -2606,10 +2877,10 @@
2606
2877
  if (frame.code === 'follow-failed' || frame.code === 'state-failed') {
2607
2878
  setConn('warn', '流中断')
2608
2879
  }
2609
- pushToast(frame.message || '控制台流发生错误', 'err')
2880
+ pushToast(frame.message || '控制台连接出错', 'err')
2610
2881
  break
2611
2882
  case 'truncated':
2612
- pushToast('有一段历史过大,已截断显示。', 'err')
2883
+ pushToast('历史太长,只显示了一部分。', 'err')
2613
2884
  break
2614
2885
  case 'closed':
2615
2886
  setConn('warn', '已关闭')
@@ -2923,7 +3194,7 @@
2923
3194
  chip.append(el('span', 'dot'))
2924
3195
  chip.append(el('span', '', item.label))
2925
3196
  chip.append(el('span', 'env-value', item.value || ''))
2926
- chip.append(el('span', 'env-action', '点这里处理'))
3197
+ chip.append(el('span', 'env-action', '去处理'))
2927
3198
  chip.addEventListener('click', () => wizardOpen(item.action?.step || 1))
2928
3199
  envItemsEl.append(chip)
2929
3200
  }
@@ -3037,9 +3308,9 @@
3037
3308
  }
3038
3309
 
3039
3310
  function renderWizardStep1() {
3040
- wizardBodyEl.append(el('p', 'wiz-lead', '先看看宿主和环境是否准备好了。不通过的项可以直接点“点这里处理”,不需要读错误码。'))
3311
+ wizardBodyEl.append(el('p', 'wiz-lead', '先检查宿主和环境。没通过的项直接点“去处理”。'))
3041
3312
  if (!WIZ.status) {
3042
- wizardBodyEl.append(WIZ.statusPending > 0 ? wizardBusyNode('正在检查环境…') : el('p', 'wiz-note', '还没有读到检查结果。'))
3313
+ wizardBodyEl.append(WIZ.statusPending > 0 ? wizardBusyNode('检查中…') : el('p', 'wiz-note', '还没有读到检查结果。'))
3043
3314
  } else {
3044
3315
  const list = el('div', 'wiz-checks')
3045
3316
  for (const item of WIZ.status.environment || []) {
@@ -3052,7 +3323,7 @@
3052
3323
  if (item.hint) body.append(el('div', 'hint', item.hint))
3053
3324
  row.append(body)
3054
3325
  if (!item.ok && item.action) {
3055
- const button = el('button', '', '点这里处理')
3326
+ const button = el('button', '', '去处理')
3056
3327
  button.type = 'button'
3057
3328
  button.addEventListener('click', () => wizardHandleAction(item.action))
3058
3329
  row.append(button)
@@ -3061,7 +3332,7 @@
3061
3332
  }
3062
3333
  wizardBodyEl.append(list)
3063
3334
  if (WIZ.status.profile?.patchPath) {
3064
- wizardBodyEl.append(el('p', 'wiz-note', `配置文件:${WIZ.status.profile.patchPath}。写入前会自动备份,失败可以一键回滚。`))
3335
+ wizardBodyEl.append(el('p', 'wiz-note', `配置文件:${WIZ.status.profile.patchPath}。写入前会备份,出问题可以回滚。`))
3065
3336
  }
3066
3337
  }
3067
3338
  const error = wizardErrorNode()
@@ -3103,7 +3374,7 @@
3103
3374
 
3104
3375
  function renderWizardStep2() {
3105
3376
  const status = WIZ.status
3106
- wizardBodyEl.append(el('p', 'wiz-lead', '填你的 OpenAI 兼容端点。默认值已经填好,通常只需要粘贴 key。'))
3377
+ wizardBodyEl.append(el('p', 'wiz-lead', '填 OpenAI 兼容端点。默认值已经填好,一般只要粘贴 key。'))
3107
3378
  const form = el('div', 'wiz-form')
3108
3379
  form.append(wizardField('provider', '提供商名', 'text', 'haoduo', '小写字母、数字、短横线,会作为配置里的提供方 id。'))
3109
3380
  form.append(wizardField('baseURL', 'Base URL', 'text', 'https://byte.haoduotoken.com/v1', 'OpenAI 兼容端点,通常以 /v1 结尾。'))
@@ -3121,7 +3392,7 @@
3121
3392
  input.value = WIZ.form.apiKey ?? ''
3122
3393
  input.placeholder = status?.key?.configured
3123
3394
  ? `已保存 ${status.key.mask || '(内容不可回读)'},留空则沿用`
3124
- : '粘贴你的 API key'
3395
+ : '粘贴 API key'
3125
3396
  input.addEventListener('input', () => {
3126
3397
  WIZ.form.apiKey = input.value
3127
3398
  WIZ.formTouched = true
@@ -3132,7 +3403,7 @@
3132
3403
  badge.id = 'wizKeyBadge'
3133
3404
  row.append(input, badge)
3134
3405
  keyWrap.append(labelEl, row)
3135
- keyWrap.append(el('div', 'wiz-note', 'key 只写入宿主凭据库(或你已有的用户环境变量);不会写进仓库、配置或日志,页面不显示完整值。'))
3406
+ keyWrap.append(el('div', 'wiz-note', 'key 只写入宿主凭据库(或你已有的用户环境变量),不写进仓库、配置和日志,页面也不显示完整值。'))
3136
3407
  form.append(keyWrap)
3137
3408
  wizardBodyEl.append(form)
3138
3409
 
@@ -3176,7 +3447,7 @@
3176
3447
  function renderWizardStep3() {
3177
3448
  const preview = WIZ.preview
3178
3449
  if (!preview) {
3179
- wizardBodyEl.append(el('p', 'wiz-note', '先回到上一步做一次检查。'))
3450
+ wizardBodyEl.append(el('p', 'wiz-note', '回到上一步检查一次。'))
3180
3451
  wizardFootEl.replaceChildren()
3181
3452
  const back = el('button', 'wiz-secondary', '返回')
3182
3453
  back.type = 'button'
@@ -3184,7 +3455,7 @@
3184
3455
  wizardFootEl.append(back)
3185
3456
  return
3186
3457
  }
3187
- wizardBodyEl.append(el('p', 'wiz-lead', '这是将要写入的摘要。你不需要看 YAML;写入前会自动备份,失败可以一键回滚。'))
3458
+ wizardBodyEl.append(el('p', 'wiz-lead', '这是要写入的内容。不用看 YAML;写入前会备份,出问题可以回滚。'))
3188
3459
  const list = el('ul', 'wiz-summary')
3189
3460
  for (const line of preview.summary || []) list.append(el('li', '', line))
3190
3461
  wizardBodyEl.append(list)
@@ -3200,12 +3471,12 @@
3200
3471
  add('模型', preview.model)
3201
3472
  add('key', `${preview.key.mask || '沿用已保存的 key'}(引用 ${preview.key.ref})`)
3202
3473
  add('配置文件', preview.target.patchPath)
3203
- add('备份', '写入前保存;可在下一步点“回滚上次写入”恢复')
3474
+ add('备份', '写入前保存,下一步可以回滚')
3204
3475
  wizardBodyEl.append(kv)
3205
3476
 
3206
3477
  const error = wizardErrorNode()
3207
3478
  if (error) wizardBodyEl.append(error)
3208
- if (WIZ.busy === 'save') wizardBodyEl.append(wizardBusyNode('正在写入配置并保存 key…'))
3479
+ if (WIZ.busy === 'save') wizardBodyEl.append(wizardBusyNode('写入中…'))
3209
3480
  wizardBodyEl.append(el('p', 'wiz-note', preview.note || ''))
3210
3481
 
3211
3482
  wizardFootEl.replaceChildren()
@@ -3258,7 +3529,7 @@
3258
3529
  function renderWizardStep4() {
3259
3530
  const trial = WIZ.trial
3260
3531
  if (WIZ.busy === 'trial') {
3261
- wizardBodyEl.append(wizardBusyNode('正在临时目录里跑一个小任务(建文件并读回)…'))
3532
+ wizardBodyEl.append(wizardBusyNode('在临时目录建一个文件再读回来…'))
3262
3533
  wizardBodyEl.append(el('p', 'wiz-note', '不会碰你的项目目录。模型回复和工具调用会显示在下面。'))
3263
3534
  wizardFootEl.replaceChildren()
3264
3535
  const again = el('button', 'wiz-secondary', '试跑中…')
@@ -3269,7 +3540,7 @@
3269
3540
  }
3270
3541
 
3271
3542
  if (!trial) {
3272
- wizardBodyEl.append(el('p', 'wiz-lead', '最后一步:在系统临时目录里建一个文件并读回。它不会碰你的真实项目。'))
3543
+ wizardBodyEl.append(el('p', 'wiz-lead', '最后一步:在系统临时目录建一个文件再读回来,不碰你的项目。'))
3273
3544
  if (WIZ.saved) {
3274
3545
  const kv = el('div', 'wiz-kv')
3275
3546
  const add = (label, value) => {
@@ -3299,12 +3570,12 @@
3299
3570
  verdict.append(el('span', 'big', trial.ok ? '✓' : '!'))
3300
3571
  const text = el('div')
3301
3572
  text.append(el('div', 't', trial.ok
3302
- ? '试跑成功:它真的在临时目录里干了活。'
3573
+ ? '试跑通过:文件建好,也读回来了。'
3303
3574
  : (emptyRun ? '试跑没有跑起来' : '试跑没有完全成功')))
3304
3575
  text.append(el('div', 'd', trial.ok
3305
3576
  ? `用时 ${(trial.elapsedMs / 1000).toFixed(1)} 秒 · 会话 ${shortId(trial.sessionId)}`
3306
3577
  : (emptyRun
3307
- ? '这一轮没有模型回复。宿主可能还没切换到新模型,点“重新试跑”再来一次。'
3578
+ ? '这一轮没有模型回复。宿主可能还没换到新模型,点“重新试跑”再试。'
3308
3579
  : (trial.hint || '看下面的步骤和提示。'))))
3309
3580
  verdict.append(text)
3310
3581
  wizardBodyEl.append(verdict)
@@ -3387,13 +3658,13 @@
3387
3658
  try {
3388
3659
  const data = await api('/api/console/wizard/trial', { method: 'POST', body: {} })
3389
3660
  WIZ.trial = data
3390
- if (data.ok) pushToast('试跑成功:它真的在临时目录里干了活。', 'ok')
3661
+ if (data.ok) pushToast('试跑通过:文件建好,也读回来了。', 'ok')
3391
3662
  else pushToast('试跑没成功,按提示处理。', 'err')
3392
3663
  await wizardLoad({ probe: false })
3393
3664
  } catch (error) {
3394
3665
  WIZ.error = {
3395
3666
  message: messageOf(error),
3396
- hint: error.hint || (!error.status ? '宿主可能正在热加载配置,等两秒再点一次“开始试跑”。' : null),
3667
+ hint: error.hint || (!error.status ? '宿主可能在热加载配置,等两秒再点“开始试跑”。' : null),
3397
3668
  code: error.code,
3398
3669
  }
3399
3670
  } finally {
@@ -3435,7 +3706,7 @@
3435
3706
  else setConn('warn', '未连接')
3436
3707
  } catch (error) {
3437
3708
  if (error.status === 401) {
3438
- showGate('令牌无效或已轮换,请重新读取 console.json。')
3709
+ showGate('token 无效或已换新,重新读一次 console.json。')
3439
3710
  return
3440
3711
  }
3441
3712
  setMode('unavailable', { chat: false, reason: `${messageOf(error)}${error.hint ? `\n${error.hint}` : ''}` })
@@ -3494,7 +3765,7 @@
3494
3765
  } catch (error) {
3495
3766
  if (controller.signal.aborted) return
3496
3767
  if (error.status === 401) {
3497
- showGate('令牌无效或已轮换,请重新读取 console.json。')
3768
+ showGate('token 无效或已换新,重新读一次 console.json。')
3498
3769
  return
3499
3770
  }
3500
3771
  setConn('warn', '重连中')
@@ -3700,6 +3971,7 @@
3700
3971
  stopAllEl.addEventListener('click', stopAllRuns)
3701
3972
  setInterval(() => {
3702
3973
  tickLaneClocks()
3974
+ tickSchedule()
3703
3975
  updateApprovalClocks()
3704
3976
  }, 1000)
3705
3977
  $('historyOpen').addEventListener('click', () => drawerOpen('history'))