zcode-app-cli 3.14.4-33 → 3.15.3-35

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.
Files changed (75) hide show
  1. package/README.md +18 -4
  2. package/bin/zcode.js +4 -0
  3. package/docs/CONFIGURATION.md +68 -6
  4. package/docs/CONFIGURATION.zh-CN.md +52 -4
  5. package/docs/PROVIDER_CONFIG.md +25 -0
  6. package/docs/PROVIDER_CONFIG.zh-CN.md +20 -0
  7. package/package.json +4 -2
  8. package/vendor/cli-config.cjs +159 -0
  9. package/vendor/extraction.json +38 -5
  10. package/vendor/node_modules/@zcode/tui/dist/index.js +474 -85
  11. package/vendor/packages/browser-use-plugin/README.md +1 -1
  12. package/vendor/packages/browser-use-plugin/docs/api.json +1 -1
  13. package/vendor/packages/browser-use-plugin/docs/overview.md +6 -6
  14. package/vendor/packages/browser-use-plugin/docs/playwright.md +3 -3
  15. package/vendor/packages/browser-use-plugin/docs/workflow.md +2 -2
  16. package/vendor/packages/browser-use-plugin/scripts/browser-client.mjs +5 -7
  17. package/vendor/packages/browser-use-plugin/scripts/build.mjs +0 -1
  18. package/vendor/packages/browser-use-plugin/skills/control-browser/SKILL.md +9 -9
  19. package/vendor/packages/bundled-skills/skills/dynamic-workflows/SKILL.md +760 -687
  20. package/vendor/packages/bundled-skills/skills/dynamic-workflows/examples.md +310 -1
  21. package/vendor/packages/bundled-skills/skills/dynamic-workflows/patterns.md +336 -4
  22. package/vendor/packages/documents-plugin/.zcode-plugin/plugin.json +2 -2
  23. package/vendor/packages/documents-plugin/package.json +2 -2
  24. package/vendor/packages/documents-plugin/skills/docx/LICENSE.txt +10 -10
  25. package/vendor/packages/node-repl-host/.zcode-plugin/plugin.json +1 -1
  26. package/vendor/packages/node-repl-host/dist/mcp/server.js +116 -48
  27. package/vendor/packages/node-repl-host/package.json +1 -1
  28. package/vendor/packages/node-repl-host/scripts/build.mjs +4 -4
  29. package/vendor/packages/pdf-plugin/.zcode-plugin/plugin.json +2 -2
  30. package/vendor/packages/pdf-plugin/package.json +2 -2
  31. package/vendor/packages/pdf-plugin/skills/pdf/LICENSE.txt +10 -10
  32. package/vendor/packages/pdf-plugin/skills/pdf/references/resume-altacv.tex +1 -1
  33. package/vendor/packages/plugin-creator-plugin/skills/plugin-creator/SKILL.md +1 -1
  34. package/vendor/packages/plugin-creator-plugin/skills/plugin-creator/references/plugin-json-spec.md +1 -1
  35. package/vendor/packages/presentations-plugin/.zcode-plugin/plugin.json +2 -2
  36. package/vendor/packages/presentations-plugin/package.json +2 -2
  37. package/vendor/packages/presentations-plugin/skills/pptx/LICENSE.txt +10 -10
  38. package/vendor/packages/restore-legacy-sessions-plugin/skills/restore-legacy-sessions/SKILL.md +1 -1
  39. package/vendor/packages/spreadsheets-plugin/.zcode-plugin/plugin.json +2 -2
  40. package/vendor/packages/spreadsheets-plugin/package.json +2 -2
  41. package/vendor/packages/spreadsheets-plugin/skills/xlsx/LICENSE.txt +10 -10
  42. package/vendor/packages/visualize-plugin/.zcode-plugin/plugin.json +10 -0
  43. package/vendor/packages/visualize-plugin/package.json +8 -0
  44. package/vendor/packages/visualize-plugin/skills/visualize/LICENSE.md +5 -0
  45. package/vendor/packages/visualize-plugin/skills/visualize/SKILL.md +277 -0
  46. package/vendor/packages/visualize-plugin/skills/visualize/assets/calendar.js +273 -0
  47. package/vendor/packages/visualize-plugin/skills/visualize/assets/runtime-manifest.json +16 -0
  48. package/vendor/packages/visualize-plugin/skills/visualize/assets/standalone-host-bridge.js +256 -0
  49. package/vendor/packages/visualize-plugin/skills/visualize/assets/standalone-shell.js +183 -0
  50. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/d3-7.9.0.min.js +2 -0
  51. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/d3-7.9.0.min.js.LICENSE +13 -0
  52. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-core-1.7.3.min.js +1 -0
  53. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-core-1.7.3.min.js.LICENSE +20 -0
  54. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-dom-1.7.4.min.js +1 -0
  55. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/floating-ui-dom-1.7.4.min.js.LICENSE +20 -0
  56. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/lucide-1.17.0.js +19521 -0
  57. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/lucide-1.17.0.js.LICENSE +43 -0
  58. package/vendor/packages/visualize-plugin/skills/visualize/assets/vendor/manifest.json +57 -0
  59. package/vendor/packages/visualize-plugin/skills/visualize/assets/visualize.css +1222 -0
  60. package/vendor/packages/visualize-plugin/skills/visualize/assets/visualize.html +517 -0
  61. package/vendor/packages/visualize-plugin/skills/visualize/examples/calendar.html +10 -0
  62. package/vendor/packages/visualize-plugin/skills/visualize/references/api.md +128 -0
  63. package/vendor/packages/visualize-plugin/skills/visualize/references/styles.md +3 -0
  64. package/vendor/packages/visualize-plugin/skills/visualize/scripts/render.py +248 -0
  65. package/vendor/packages/visualize-plugin/skills/visualize/scripts/vendor.py +56 -0
  66. package/vendor/packages/visualize-plugin/skills/visualize/tweak.md +62 -0
  67. package/vendor/packages/visualize-plugin/skills/visualize/widgets/calendar.md +90 -0
  68. package/vendor/packages/zcode-cua-plugin/.zcode-plugin/plugin.json +1 -1
  69. package/vendor/packages/zcode-cua-plugin/docs/computer-use.md +1 -1
  70. package/vendor/packages/zcode-cua-plugin/package.json +1 -1
  71. package/vendor/packages/zcode-cua-plugin/scripts/computer-use-client.mjs +35 -41
  72. package/vendor/packages/zcode-guide-plugin/skills/zcode-configuration-guide/SKILL.md +2 -2
  73. package/vendor/provider/zcode-builtin.json +96 -1
  74. package/vendor/zcode.cjs +1622 -1425
  75. package/zcode-runtime.lock.json +3 -3
package/README.md CHANGED
@@ -140,7 +140,7 @@ multi-line editor; slash-command, unified `@` workspace/Plugin references and
140
140
  session events; `/mode`, `/model`, `/resume`, `/plugins` and other upstream
141
141
  slash commands; searchable model and reasoning-effort selectors, plus MCP and
142
142
  workflow panels; status-bar-only Shift+Tab mode cycling
143
- (`build` → `edit` → `yolo`), independent `/plan` toggling with an input-border indicator, Ctrl+N model and empty-prompt Tab effort
143
+ (`build` → `edit` → `guarded` → `yolo`), independent `/plan` toggling with an input-border indicator, Ctrl+N model and empty-prompt Tab effort
144
144
  cycling; structured session-goal status in the right side of the turn footer;
145
145
  animated active-turn timer with a static `ZCODE_TUI_REDUCED_MOTION=1`
146
146
  fallback; responsive context-remaining and session-token metrics.
@@ -308,7 +308,8 @@ picker to return to input selection, then `Esc` again to close rewind.
308
308
  /queue pause|resume pause or resume automatic draft submission
309
309
  /edit-message rewind to an earlier question and edit it
310
310
  /retry rewind to an earlier question and send it again
311
- /workflows inspect workflow progress, artifacts and recovery
311
+ /workflows inspect, tune and save workflow runs
312
+ /workflows saved list saved definitions and start a new run
312
313
  /tasks inspect and manage background tasks
313
314
  /tasks message <id> <text> send guidance to a running background agent
314
315
  /tasks resume <id> [text] resume a stopped or failed background agent
@@ -325,6 +326,16 @@ picker to return to input selection, then `Esc` again to close rewind.
325
326
  runtime's own `/clear` is an alias of `/new` and starts a fresh session, so it
326
327
  is forwarded to the runtime unchanged.
327
328
 
329
+ Workflow creation and saved-workflow startup require the native workflow mode
330
+ to be enabled explicitly: start the CLI with `--workflow-mode alwaysOn` or
331
+ `--workflow-mode onDemand` (the runtime default is `disabled`). During a
332
+ workflow approval, `Change concurrency` and, when supported, `Change default
333
+ model` apply only to that workflow. From `/workflows`, `Adjust concurrency`
334
+ changes a live run in place without replaying or restarting it. `Save workflow`
335
+ writes the run's actual script to `.zcode/workflows`; `/workflows saved` starts
336
+ a new run from that definition and validates its arguments through the native
337
+ runtime.
338
+
328
339
  `/queue` manages local next-turn drafts and pauses automatic sending while its
329
340
  picker is open. Inputs already accepted by the runtime cannot be edited here.
330
341
  `/queue pause` persists across turns until `/queue resume`. Moving a draft to
@@ -510,7 +521,10 @@ zcode --prompt 'Reply with exactly: ok'
510
521
 
511
522
  The browser authorization uses the registered ZCode client ID. The runtime
512
523
  stores the login and resolves Coding Plan access using its native account
513
- provider registry. The credential file remains private (mode 600). These
524
+ provider registry. `/login bigmodel-coding-plan` first reuses a BigModel
525
+ session that Desktop stored in the shared credential file, without opening a
526
+ browser; set `ZCODE_CLI_BIGMODEL_REUSE_SESSION=0` to always sign in again. An
527
+ open TUI session switches to the newly saved model after any login. The credential file remains private (mode 600). These
514
528
  overrides leave Desktop's credentials and provider configuration untouched.
515
529
  Client headers and a local usage row do not independently prove server-side
516
530
  bonus accounting.
@@ -525,7 +539,7 @@ models demonstrate explicit overrides and manual configuration.
525
539
  [Provider 配置字段参考](./docs/PROVIDER_CONFIG.zh-CN.md)。
526
540
  The project follows the current upstream runtime and configuration schema.
527
541
 
528
- Three model-access paths are supported: Z.AI OAuth, Z.AI/BigModel
542
+ Three model-access paths are supported: Z.AI/BigModel OAuth, Z.AI/BigModel
529
543
  Coding Plan API key, or a direct API key with a custom provider. For detailed
530
544
  setup steps, retries/timeouts, theme, and turn-completion notifications, see
531
545
  [Configuration](./docs/CONFIGURATION.md).
package/bin/zcode.js CHANGED
@@ -918,6 +918,7 @@ async function requestAppServer(request) {
918
918
  if (envelope?.error) throw new AppServerRequestError(envelope.error.message?.trim() || "App-server request failed.", envelope.error.code, envelope.error.data);
919
919
  if (code !== 0) throw processError(stderr.trim() || `App-server exited with status ${code}.`, code);
920
920
  if (!envelope || !("result" in envelope)) throw new Error(stderr.trim() || "App-server did not return a response envelope.");
921
+ if (stderr) request.onStderr?.(stderr);
921
922
  return envelope.result;
922
923
  } finally {
923
924
  if (forceTerminationTimer) clearTimeout(forceTerminationTimer);
@@ -1941,6 +1942,9 @@ async function main(args) {
1941
1942
  request: async ({ method, params, signal, workingDirectory }) => await requestAppServer({
1942
1943
  method,
1943
1944
  params,
1945
+ onStderr: (stderr) => {
1946
+ for (const line of stderr.split(/\r?\n/u)) if (line.startsWith("ZCode Built-in: ignoring unavailable ZCODE_BUILTIN_PROVIDER_CONFIG_FILE ")) process.stderr.write(`${line}\n`);
1947
+ },
1944
1948
  signal: signal ?? pluginAbortController.signal,
1945
1949
  transport: {
1946
1950
  args: [runtimePath, "app-server"],
@@ -200,7 +200,7 @@ Plugin controls remain under `plugins`, hook declarations under
200
200
  These paths distinguish the packaged CLI from the upstream application. The
201
201
  source references below are pinned to upstream
202
202
  [`29628c9` / `v3.14.3`](https://github.com/zai-org/ZCode/tree/29628c9acdb81b703bbd4080c207a0e7ce5e276e).
203
- This package's runtime lock selects the separate Desktop 3.14.4 artifact; the
203
+ This package's runtime lock selects the separate Desktop 3.15.1 artifact; the
204
204
  public source snapshot is not an assertion of that artifact's build commit.
205
205
 
206
206
  | Client / source | User MCP file | JSON path |
@@ -307,6 +307,10 @@ provider configuration is recognized directly; no desktop import step is needed.
307
307
  authorization. `--no-browser` prints the authorization URL.
308
308
  - **Z.AI/BigModel Coding Plan API key:** open `/login` and choose the masked
309
309
  API-key option. The official runtime owns credential and provider persistence.
310
+ - **BigModel browser OAuth:** choose **BigModel Coding Plan** in `/login`, or run
311
+ `/login bigmodel-coding-plan`. The CLI exchanges the authorization code through
312
+ the official ZCode token service used by Desktop. No OAuth app secret needs to
313
+ be configured in the CLI.
310
314
  - **Custom provider:** configure the native provider file directly. Any provider
311
315
  ID can be used; a separate OAuth login is unnecessary.
312
316
 
@@ -318,7 +322,34 @@ For macOS OAuth, the CLI temporarily registers a callback receiver, checks
318
322
  `state`, restores the previous `zcode://` handler and sends the callback through
319
323
  stdin. The runtime exchanges the token, stores encrypted credentials, resolves
320
324
  the Coding Plan API key and saves the native default model. The TUI then rereads
321
- provider configuration. BigModel uses the runtime's localhost callback.
325
+ provider configuration. BigModel uses the runtime's localhost callback, checks
326
+ `state`, and sends the matching callback URI and state to
327
+ `https://zcode.z.ai/api/v1/oauth/token`. Both the BigModel access token and ZCode
328
+ JWT are saved in the native encrypted credential store before account setup
329
+ completes. The callback must reach the machine running the CLI; with SSH, forward
330
+ the port shown in the callback URL to that machine.
331
+
332
+ On Windows, the CLI opens the browser through PowerShell so the authorization
333
+ URL's query parameters survive command-line parsing. If opening it manually,
334
+ copy the entire URL, including `redirect` and `state`, into the browser address
335
+ bar instead of passing it to `cmd.exe /c start`.
336
+
337
+ If BigModel's authorization page shows `--` for the account name or reports a
338
+ missing account ID, try signing in at [BigModel](https://bigmodel.cn/login) in
339
+ the same browser first, then run `/login bigmodel-coding-plan` again. This error
340
+ occurs on the website before the CLI receives an authorization code. The account
341
+ ID comes from the website's login session; it is not the OAuth `appId`. If the
342
+ browser asks to access apps or services on this device, allow it for this login
343
+ so it can reach the localhost callback.
344
+
345
+ For API-key setup without a browser or SSH callback forwarding, get your key from the
346
+ [Coding Plan overview](https://bigmodel.cn/coding-plan/personal/overview), then
347
+ choose **BigModel Coding Plan API Key** in `/login`. The native runtime encrypts
348
+ the key and saves the account provider's default model; manual plaintext edits
349
+ to `provider_config.json` are unnecessary. Login and subsequent requests must
350
+ use the same credential file and `ZCODE_CREDENTIAL_SECRET` (if set). Credentials
351
+ encrypted with another secret must be configured again with the CLI's key-entry
352
+ flow; ciphertext is not an API key.
322
353
 
323
354
  ## Custom provider
324
355
 
@@ -394,10 +425,27 @@ there is no need to write upstream capability values into every personal model.
394
425
 
395
426
  ## Permission and planning state
396
427
 
397
- The CLI follows Desktop's three selectable permission modes: `build` (ask before
398
- changes), `edit` (edit automatically), and `yolo` (full access). `/mode` opens the
399
- picker; Shift+Tab cycles these three options. The internal `auto` value is not a
400
- menu option.
428
+ The CLI exposes four permission modes: `build` (ask before changes), `edit`
429
+ (edit automatically), `guarded` (autonomous mode; confirm risky commands), and
430
+ `yolo` (full access). `/mode` opens the picker; Shift+Tab cycles these four options.
431
+ Use `/mode guarded` or start with `--mode guarded` to enable autonomous mode.
432
+ Risk assessment and confirmation are handled by the native runtime, including
433
+ for child agents and workflows. The internal `auto` value is not a menu option.
434
+
435
+ ### Workflow mode
436
+
437
+ Workflow features follow the native runtime's `--workflow-mode` setting. The
438
+ default is `disabled`; use `--workflow-mode alwaysOn` or
439
+ `--workflow-mode onDemand` to create, tune, or start workflows. `/workflows`
440
+ inspects live runs, changes concurrency in place, and saves the current script;
441
+ `/workflows saved` lists project and global definitions and starts a new run
442
+ from a definition rather than replaying old progress.
443
+
444
+ In runtime 3.15.1, risk confirmations are single-use: the picker offers only
445
+ **Allow once** and **Deny**, never a project or session-wide grant. Guarded is a
446
+ rule-based confirmation policy, not a sandbox or a guarantee that every
447
+ potentially destructive command will be recognized. Planning restrictions still
448
+ take precedence when Plan is enabled.
401
449
 
402
450
  `/plan` toggles planning independently. `/plan on` and `/plan off` set it
403
451
  explicitly. Changing permissions keeps the Plan switch unchanged; toggling Plan
@@ -551,6 +599,20 @@ terminal application is used as both the sender and click target. Exact tab or
551
599
  pane restoration remains terminal-dependent; use the default `auto` setting so
552
600
  OSC-capable terminals can preserve their native session behavior.
553
601
 
602
+ DEC focus reporting is enabled in every TUI mode and notification setting, and
603
+ also drives cursor visibility: while another pane or terminal window has focus,
604
+ ZCode hides the hardware cursor so multiplexer splits (tmux panes, split
605
+ terminal windows) only show a live cursor in the focused session. Focus is
606
+ last-known — if the TUI restarts mid-session (display-mode switch, suspended
607
+ login) while another pane takes focus, the cursor can reappear until the next
608
+ focus change. Terminals that do not report focus keep the cursor visible.
609
+ tmux only forwards focus events when `focus-events` is enabled:
610
+
611
+ ```tmux
612
+ # ~/.tmux.conf
613
+ set -g focus-events on
614
+ ```
615
+
554
616
  Open the interactive settings picker inside the TUI (both commands are
555
617
  equivalent):
556
618
 
@@ -173,7 +173,7 @@ MCP 服务器按名称合并。当前 runtime 中,**同名服务器的用户
173
173
 
174
174
  下面区分本发行包与上游应用。源码引用固定在上游
175
175
  [`29628c9` / `v3.14.3`](https://github.com/zai-org/ZCode/tree/29628c9acdb81b703bbd4080c207a0e7ce5e276e)。
176
- 本项目 runtime lock 选择的是独立发布的 Desktop 3.14.4 产物,不能据此认定该产物
176
+ 本项目 runtime lock 选择的是独立发布的 Desktop 3.15.1 产物,不能据此认定该产物
177
177
  由这个公开源码提交构建。
178
178
 
179
179
  | 客户端/配置源 | 用户级 MCP 文件 | JSON 路径 |
@@ -265,6 +265,9 @@ Provider 文件中的 `config.defaultModelSelection` 决定新会话使用的模
265
265
  `--no-browser` 只输出授权链接。
266
266
  - **Z.AI/BigModel Coding Plan API Key:** 打开 `/login`,选择掩码输入的 API Key 选项。
267
267
  凭证和 provider 的保存由官方 runtime 负责。
268
+ - **BigModel 浏览器 OAuth:** 在 `/login` 中选择 **BigModel Coding Plan**,或运行
269
+ `/login bigmodel-coding-plan`。CLI 通过 Desktop 使用的官方 ZCode 令牌服务交换授权码,
270
+ 无需在 CLI 中配置 OAuth 应用密钥。
268
271
  - **自定义 provider:** 直接配置原生 provider 文件,可使用自定义 ID,无需额外 OAuth 登录。
269
272
 
270
273
  普通的 `zcode login` 会识别已经配置的原生默认模型并提示配置路径。
@@ -272,7 +275,26 @@ Provider 文件中的 `config.defaultModelSelection` 决定新会话使用的模
272
275
 
273
276
  macOS OAuth 会临时注册回调接收器、校验 `state`,恢复原来的 `zcode://` 处理程序,并通过
274
277
  stdin 把回调交给 runtime。Runtime 交换令牌、保存加密凭证、解析 Coding Plan API Key,
275
- 再保存原生默认模型;TUI 随后重新读取 provider 配置。BigModel 使用 runtime 的 localhost 回调。
278
+ 再保存原生默认模型;TUI 随后重新读取 provider 配置。BigModel 使用 runtime 的 localhost
279
+ 回调,校验 `state` 后,将匹配的回调地址和 state 提交到
280
+ `https://zcode.z.ai/api/v1/oauth/token`。BigModel access token 和 ZCode JWT 均通过原生
281
+ 凭证存储加密保存。回调须能访问运行 CLI 的机器;SSH 环境需要将回调 URL 中的端口转发到该机器。
282
+
283
+ Windows 上,CLI 通过 PowerShell 打开浏览器,保留授权链接中的全部查询参数。
284
+ 手动打开时,请将包含 `redirect` 和 `state` 的完整 URL 粘贴到浏览器地址栏,
285
+ 避免通过 `cmd.exe /c start` 传递链接。
286
+
287
+ 若 BigModel 授权页的账号名称显示为 `--`,或提示缺少账号 ID,可先在同一浏览器中
288
+ 登录 [BigModel 官网](https://bigmodel.cn/login),再重新运行 `/login bigmodel-coding-plan`。
289
+ 该错误发生在网页端,早于 CLI 收到授权码;账号 ID 来自网站登录会话,并非 OAuth 的 `appId`。
290
+ 浏览器若询问是否允许访问此设备上的应用或服务,请为此次登录允许访问,以便完成 localhost 回调。
291
+
292
+ 不使用浏览器或 SSH 回调端口转发时,可在
293
+ [Coding Plan 概览](https://bigmodel.cn/coding-plan/personal/overview) 获取密钥,
294
+ 再在 `/login` 中选择 **BigModel Coding Plan API Key**。原生 runtime 会加密保存密钥并设置
295
+ 账号 provider 的默认模型,无需手动在 `provider_config.json` 中填写明文密钥。
296
+ 登录和后续请求须使用同一凭证文件及 `ZCODE_CREDENTIAL_SECRET`(若已设置)。
297
+ 其他密钥加密的凭证需要通过 CLI 的密钥输入流程重新配置,不能将密文当作 API Key 使用。
276
298
 
277
299
  ## 自定义 Provider
278
300
 
@@ -339,10 +361,24 @@ Anthropic 兼容接口使用 `anthropic-messages`,Chat Completions 使用
339
361
 
340
362
  ## 权限模式与计划状态
341
363
 
342
- CLI 与桌面端一样提供三种权限模式:`build`(变更前确认)、`edit`(自动编辑)、
343
- `yolo`(完全访问)。`/mode` 打开选择器,Shift+Tab 在三种模式间循环。
364
+ CLI 提供四种权限模式:`build`(变更前确认)、`edit`(自动编辑)、
365
+ `guarded`(自主模式,风险指令执行前确认)、`yolo`(完全访问)。
366
+ `/mode` 打开选择器,Shift+Tab 在四种模式间循环。
367
+ 使用 `/mode guarded` 或启动参数 `--mode guarded` 开启自主模式。
368
+ 风险判定和确认由原生 runtime 负责,子代理和工作流也保留该保护。
344
369
  底层的 `auto` 值不作为菜单选项。
345
370
 
371
+ ### 工作流模式
372
+
373
+ 工作流能力由原生 runtime 的 `--workflow-mode` 控制。默认值是 `disabled`;使用
374
+ `--workflow-mode alwaysOn` 或 `--workflow-mode onDemand` 才能创建、调整和启动工作流。
375
+ `/workflows` 可查看运行中的工作流、原地调整并发或保存当前脚本;`/workflows saved`
376
+ 列出项目级和全局已保存定义,并从定义启动一个新的 run,而不是回放旧进度。
377
+
378
+ runtime 3.15.1 的风险确认只允许本次授权:选择器仅提供 **Allow once** 和 **Deny**,
379
+ 不会提供项目或会话级永久放行。自主模式是基于规则的确认策略,不是沙箱,
380
+ 也不保证识别所有潜在破坏性指令。Plan 开启时,计划模式的执行限制仍然优先。
381
+
346
382
  `/plan` 独立切换计划开关,也可以用 `/plan on`、`/plan off` 明确指定状态。
347
383
  切换权限不会改变 Plan 开关,切换 Plan 也不会改变权限。验证由原生 runtime 负责,
348
384
  包括 Plan 与进行中的 Goal 不可同时开启的限制。
@@ -466,6 +502,18 @@ macOS 的 `terminal-notifier`、Linux 的 `notify-send` 或 Windows 的 `SnoreTo
466
502
  macOS 会将检测到的终端 App 用作发送者和点击目标。能否恢复精确的标签页或窗格取决于终端;
467
503
  默认 `auto` 可以保留支持 OSC 的终端原生行为。
468
504
 
505
+ DEC 焦点报告在任何 TUI 模式和通知设置下都会启用,同时驱动光标可见性:
506
+ 当其他窗格或终端窗口获得焦点时,ZCode 会隐藏硬件光标,使多路复用器分屏
507
+ (tmux 窗格、拆分终端窗口)只在获得焦点的会话中显示活动光标。
508
+ 焦点状态为“最后已知”——若 TUI 在会话中重启(显示模式切换、挂起的登录)期间
509
+ 其他窗格获得焦点,光标可能重新出现,直到下一次焦点变化。
510
+ 不支持焦点报告的终端会保持光标可见。tmux 只有在启用 `focus-events` 时才会转发焦点事件:
511
+
512
+ ```tmux
513
+ # ~/.tmux.conf
514
+ set -g focus-events on
515
+ ```
516
+
469
517
  在 TUI 中打开设置:
470
518
 
471
519
  ```text
@@ -12,6 +12,31 @@ for the `mcp.servers` structure and HTTP/stdio examples.
12
12
  provider schema. It is valid JSON without comments. This reference explains the
13
13
  fields, alternatives and restrictions that cannot be expressed as JSON comments.
14
14
 
15
+ ## Built-in catalog environment overrides
16
+
17
+ The CLI normally discovers its bundled catalog at `vendor/provider/zcode-builtin.json`
18
+ and initializes a separate active snapshot. It does not require
19
+ `ZCODE_BUILTIN_PROVIDER_CONFIG_FILE` to be set.
20
+
21
+ A valid override is preserved. Blank override values are treated as unset. If an
22
+ inherited override points to a missing, unreadable or invalid built-in release,
23
+ the CLI warns and recovers using a validated bundled catalog, preserving the
24
+ personal provider path and normal active-snapshot initialization. A valid
25
+ `ZCODE_BUILTIN_PROVIDER_BUNDLED_CONFIG_FILE` is preferred during recovery;
26
+ otherwise the runtime discovers the packaged catalog. If no valid fallback is
27
+ available, the original startup failure is not hidden. Recovery does not modify
28
+ the invalid override file.
29
+
30
+ On older CLI versions, remove a stale override for a single invocation:
31
+
32
+ ```sh
33
+ env -u ZCODE_BUILTIN_PROVIDER_CONFIG_FILE zcode plugins marketplace update <marketplace>
34
+ ```
35
+
36
+ If this resolves the failure, remove or correct the inherited path in the shell
37
+ or host launcher that sets it. Do not copy the bundled catalog into arbitrary
38
+ Desktop-version cache directories.
39
+
15
40
  ## Using the example
16
41
 
17
42
  The example deliberately contains three different model configurations:
@@ -11,6 +11,26 @@ ZCode 桌面端与 CLI 共用 `~/.zcode/v2/provider_config.json`,文件名使
11
11
  它是可以解析的标准 JSON,不包含注释;各字段的含义、可选值及互斥关系由本文说明。
12
12
  本文的“智能配置”对应英文界面的 **Smart configuration**。
13
13
 
14
+ ## 内置目录环境变量覆盖
15
+
16
+ CLI 默认自动发现 `vendor/provider/zcode-builtin.json`,并初始化独立的 active 快照,
17
+ 不需要设置 `ZCODE_BUILTIN_PROVIDER_CONFIG_FILE`。
18
+
19
+ 有效的覆盖路径保持不变;空字符串或纯空白按未设置处理。继承的覆盖路径指向不存在、
20
+ 不可读或无效的 built-in release 时,CLI 会告警,并使用已验证的 bundled 目录恢复,
21
+ 保留个人 provider 路径及正常的 active 快照初始化。恢复时优先使用有效的
22
+ `ZCODE_BUILTIN_PROVIDER_BUNDLED_CONFIG_FILE`,否则由 runtime 自动发现包内目录。
23
+ 没有有效 fallback 时,不会掩盖原有启动失败;恢复过程也不会修改无效覆盖文件。
24
+
25
+ 旧版 CLI 可在单次调用中移除失效的覆盖变量:
26
+
27
+ ```sh
28
+ env -u ZCODE_BUILTIN_PROVIDER_CONFIG_FILE zcode plugins marketplace update <marketplace>
29
+ ```
30
+
31
+ 若这样可以恢复,请检查并移除或修正 shell、宿主启动器注入的旧路径,不要将 bundled
32
+ 目录手动复制到任意 Desktop 版本的缓存目录。
33
+
14
34
  ## 使用示例文件
15
35
 
16
36
  示例包含三种用途不同的模型:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-app-cli",
3
- "version": "3.14.4-33",
3
+ "version": "3.15.3-35",
4
4
  "description": "Unofficial terminal client for the ZCode agent runtime",
5
5
  "keywords": [
6
6
  "agent",
@@ -60,7 +60,9 @@
60
60
  "sync:local": "bun run build && bun scripts/sync-runtime.ts --app /Applications/ZCode.app",
61
61
  "check": "bun run build && bun scripts/check-runtime.ts",
62
62
  "check:oauth-callback": "bun scripts/smoke-oauth-callback.ts",
63
- "check:tui": "bun scripts/smoke-tui.ts && bun scripts/smoke-tui-features.ts && bun scripts/smoke-tui-clear.ts && bun scripts/smoke-tui-session-title.ts && bun scripts/smoke-tui-pressure.ts && bun scripts/smoke-tui-widths.ts && bun scripts/smoke-tui-fullscreen.ts && bun scripts/smoke-tui-fullscreen-switch.ts && bun scripts/smoke-tui-fullscreen-layout.ts",
63
+ "check:tui": "bun scripts/smoke-tui.ts && bun scripts/smoke-tui-features.ts && bun scripts/smoke-tui-clear.ts && bun scripts/smoke-tui-session-title.ts && bun scripts/smoke-tui-pressure.ts && bun scripts/smoke-tui-widths.ts && bun scripts/smoke-tui-fullscreen.ts && bun scripts/smoke-tui-fullscreen-switch.ts && bun scripts/smoke-tui-fullscreen-layout.ts && bun run check:tui:focus",
64
+ "check:tui:focus": "bun scripts/smoke-tui-focus.ts regular off always && bun scripts/smoke-tui-focus.ts fullscreen off always && bun scripts/smoke-tui-focus.ts regular bel unfocused && bun scripts/smoke-tui-focus.ts fullscreen bel unfocused && bun scripts/smoke-tui-focus.ts fullscreen off always built",
65
+ "check:tui:focus:manual": "bun scripts/manual-tui-focus.ts",
64
66
  "check:tui-scenarios": "bun run test:tui",
65
67
  "test": "bun run test:unit",
66
68
  "test:all": "bun run test:unit && bun run test:tui && bun run test:runtime && bun run test:node",
@@ -5,6 +5,7 @@ let node_path = require("node:path");
5
5
  let node_crypto = require("node:crypto");
6
6
  let node_os = require("node:os");
7
7
  let node_async_hooks = require("node:async_hooks");
8
+ let node_buffer = require("node:buffer");
8
9
  //#region src/config-paths.ts
9
10
  function homeCliSettingsPath(env, platform, fallbackHome) {
10
11
  const path = platform === "win32" ? node_path.win32 : node_path.posix;
@@ -181,6 +182,92 @@ async function sendTuiBackgroundTaskMessage(app, bridge, input) {
181
182
  });
182
183
  }
183
184
  //#endregion
185
+ //#region src/runtime-workflow-bridge.ts
186
+ async function startTuiSavedWorkflow(app, input) {
187
+ if (app.runtime?.config?.dynamicWorkflowEnabled !== true) return {
188
+ ok: false,
189
+ reason: "workflow_disabled",
190
+ message: "Restart with --workflow-mode alwaysOn or onDemand to run workflows."
191
+ };
192
+ if (input.scope !== "project" && input.scope !== "global") throw new Error("Choose project or global workflow scope.");
193
+ if (!app.startSavedWorkflow) return {
194
+ ok: false,
195
+ reason: "unsupported"
196
+ };
197
+ return await app.startSavedWorkflow(input);
198
+ }
199
+ function createTuiWorkflowManagement(deps) {
200
+ const workspace = {
201
+ workspacePath: deps.cwd,
202
+ workspaceKey: deps.cwd
203
+ };
204
+ const scope = (value) => {
205
+ if (value !== "project" && value !== "global") throw new Error("Choose project or global workflow scope.");
206
+ return value;
207
+ };
208
+ const ownedTask = async (runId) => {
209
+ const task = await deps.port.getTask(runId);
210
+ return task?.parentSessionId === deps.sessionId ? task : void 0;
211
+ };
212
+ return {
213
+ retuneWorkflowConcurrency: async (input) => {
214
+ if (input.maxConcurrency !== null && (!Number.isSafeInteger(input.maxConcurrency) || input.maxConcurrency < 1)) throw new Error("Concurrency must be a positive integer or null for the default.");
215
+ const task = await ownedTask(input.runId);
216
+ if (!task) return {
217
+ ok: false,
218
+ reason: "not_found"
219
+ };
220
+ const status = task.runStatus ?? task.status;
221
+ if (status !== "running" && status !== "pending") return {
222
+ ok: false,
223
+ reason: "not_live"
224
+ };
225
+ if (!deps.port.retuneConcurrency) return {
226
+ ok: false,
227
+ reason: "unsupported"
228
+ };
229
+ return await deps.port.retuneConcurrency(input);
230
+ },
231
+ listSavedWorkflows: async () => {
232
+ const results = await Promise.all(["project", "global"].map(async (value) => {
233
+ const result = await deps.native.list({
234
+ workspace,
235
+ scope: value
236
+ });
237
+ return {
238
+ workflows: result.workflows ?? [],
239
+ invalid: result.invalid ?? []
240
+ };
241
+ }));
242
+ return {
243
+ workflows: results.flatMap((result) => result.workflows),
244
+ invalid: results.flatMap((result) => result.invalid)
245
+ };
246
+ },
247
+ readSavedWorkflow: async (input) => {
248
+ return await deps.native.read({
249
+ workspace,
250
+ name: input.name,
251
+ scope: scope(input.scope)
252
+ });
253
+ },
254
+ saveWorkflowRun: async (input) => {
255
+ if (!await ownedTask(input.runId)) return {
256
+ ok: false,
257
+ reason: "not_found"
258
+ };
259
+ return await deps.native.save({ deps: { sessionStore: deps.sessionStore } }, {
260
+ workspace,
261
+ runId: input.runId,
262
+ name: input.name,
263
+ scope: scope(input.scope),
264
+ meta: { description: input.description },
265
+ overwrite: input.overwrite === true
266
+ });
267
+ }
268
+ };
269
+ }
270
+ //#endregion
184
271
  //#region src/runtime-background-restore.ts
185
272
  const maximumReminderLength = 4e3;
186
273
  async function restoreSessionChildren(app, sessionId, queries) {
@@ -662,6 +749,74 @@ function appServerRegistryOptions(env, createRefreshReporter) {
662
749
  return appServerAuthMode(env) === "host" ? {} : { standalone: createRefreshReporter(process.stderr) };
663
750
  }
664
751
  //#endregion
752
+ //#region src/bigmodel-oauth.ts
753
+ function record$1(value) {
754
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
755
+ }
756
+ function nonempty(value) {
757
+ return typeof value === "string" ? value.trim() || void 0 : void 0;
758
+ }
759
+ /** Match Desktop's BigModelProviderAdapter: the official server owns the app secret. */
760
+ async function exchangeBigmodelOAuthCode(options) {
761
+ options.abortSignal?.throwIfAborted();
762
+ if (!nonempty(options.code) || !nonempty(options.redirectUri) || !nonempty(options.state)) throw new Error("BigModel OAuth requires an authorization code, redirect URI and state.");
763
+ const response = await options.httpClient.request({
764
+ body: new TextEncoder().encode(JSON.stringify({
765
+ provider: "bigmodel",
766
+ code: options.code,
767
+ redirect_uri: options.redirectUri,
768
+ state: options.state
769
+ })),
770
+ headers: { "Content-Type": "application/json" },
771
+ maxResponseBytes: 65536,
772
+ method: "POST",
773
+ trace: options.trace,
774
+ url: "https://zcode.z.ai/api/v1/oauth/token"
775
+ }, options.abortSignal);
776
+ let envelope;
777
+ try {
778
+ envelope = record$1(JSON.parse(new TextDecoder().decode(response.body)));
779
+ } catch {
780
+ throw new Error(`BigModel OAuth HTTP ${response.status}: token response is not valid JSON.`);
781
+ }
782
+ const message = nonempty(envelope.msg);
783
+ if (response.status < 200 || response.status >= 300) throw new Error(`BigModel OAuth HTTP ${response.status}${message ? `: ${message}` : "."}`);
784
+ if (envelope.code !== void 0 && envelope.code !== 0) throw new Error(`BigModel OAuth token exchange failed${message ? `: ${message}` : "."}`);
785
+ const data = record$1(envelope.data), bigmodel = record$1(data.bigmodel);
786
+ const zcodeJwtToken = nonempty(data.token);
787
+ const accessToken = nonempty(bigmodel.access_token) ?? nonempty(bigmodel.accessToken) ?? nonempty(data.access_token) ?? nonempty(data.accessToken);
788
+ if (!zcodeJwtToken) throw new Error("BigModel OAuth token response is missing data.token.");
789
+ if (!accessToken) throw new Error("BigModel OAuth token response is missing data.bigmodel.access_token.");
790
+ const refreshToken = nonempty(bigmodel.refresh_token) ?? nonempty(bigmodel.refreshToken);
791
+ return {
792
+ accessToken,
793
+ zcodeJwtToken,
794
+ ...refreshToken ? { refreshToken } : {}
795
+ };
796
+ }
797
+ //#endregion
798
+ //#region src/browser-open.ts
799
+ function browserOpenCommand(platform, url) {
800
+ if (platform === "darwin") return {
801
+ executable: "open",
802
+ args: [url]
803
+ };
804
+ if (platform !== "win32") return {
805
+ executable: "xdg-open",
806
+ args: [url]
807
+ };
808
+ const command = `Start-Process -FilePath ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('${node_buffer.Buffer.from(url, "utf8").toString("base64")}')))`;
809
+ return {
810
+ executable: "powershell.exe",
811
+ args: [
812
+ "-NoProfile",
813
+ "-NonInteractive",
814
+ "-EncodedCommand",
815
+ node_buffer.Buffer.from(command, "utf16le").toString("base64")
816
+ ]
817
+ };
818
+ }
819
+ //#endregion
665
820
  //#region src/config-diagnostics.ts
666
821
  const schemaDiagnosticPrefix = /^(?:<config>|modelStream|permission|storage|network|features|memory|mcp|plugins|skills|skill|command|logging|ui|toolConcurrency|modelAnomalyGuard|hooks)(?:[.:[\]]|$)/u;
667
822
  function publicDiagnostic(diagnostic, scope) {
@@ -872,6 +1027,9 @@ async function migrateLegacyProviders(options) {
872
1027
  //#endregion
873
1028
  exports.appServerRegistryOptions = appServerRegistryOptions;
874
1029
  exports.assertSessionModelReady = assertSessionModelReady;
1030
+ exports.browserOpenCommand = browserOpenCommand;
1031
+ exports.createTuiWorkflowManagement = createTuiWorkflowManagement;
1032
+ exports.exchangeBigmodelOAuthCode = exchangeBigmodelOAuthCode;
875
1033
  exports.inspectRuntimeConfiguration = inspectRuntimeConfiguration;
876
1034
  exports.installSqliteWriteRecovery = installSqliteWriteRecovery;
877
1035
  exports.mergeDesktopSettings = mergeDesktopSettings;
@@ -883,4 +1041,5 @@ exports.readTuiRuntimeProjection = readTuiRuntimeProjection;
883
1041
  exports.restoreTuiBackgroundTasks = restoreTuiBackgroundTasks;
884
1042
  exports.sendTuiBackgroundTaskMessage = sendTuiBackgroundTaskMessage;
885
1043
  exports.sqliteRecoveryStats = sqliteRecoveryStats;
1044
+ exports.startTuiSavedWorkflow = startTuiSavedWorkflow;
886
1045
  exports.writeConfigurationDoctor = writeConfigurationDoctor;
@@ -1,9 +1,9 @@
1
1
  {
2
- "appVersion": "3.14.4",
2
+ "appVersion": "3.15.3",
3
3
  "cliVersion": "0.16.9",
4
- "extractedAt": "2026-10-08T06:18:19.033Z",
5
- "sha512": "CMaAUbHehEEGuClDJeJI30ufA0zAgzfXgzV4ES200EuGDt0yYhEpzvtjayxvE/ag9T9ThnDg1eP4o3j9HkCHKg==",
6
- "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.14.4/linux-x64/ZCode-3.14.4-linux-x64.deb",
4
+ "extractedAt": "2026-10-13T15:46:21.567Z",
5
+ "sha512": "9RigUj20tjuaskzBt2sgWLtIuUaIET67x5joShRIgwLlbFcO/oWt1eemrlLn5ZskXUMzcUHtUTCKU8+mHF7kQQ==",
6
+ "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.15.3/linux-x64/ZCode-3.15.3-linux-x64.deb",
7
7
  "runtimeCapabilities": {
8
8
  "schemaVersion": 1,
9
9
  "cli": {
@@ -81,6 +81,9 @@
81
81
  "surface": {
82
82
  "type": "string"
83
83
  },
84
+ "workflow-mode": {
85
+ "type": "string"
86
+ },
84
87
  "all": {
85
88
  "type": "boolean"
86
89
  },
@@ -101,6 +104,11 @@
101
104
  }
102
105
  },
103
106
  "runtimePatches": [
107
+ {
108
+ "id": "tui-workflow-management",
109
+ "requirement": "required",
110
+ "status": "applied"
111
+ },
104
112
  {
105
113
  "id": "tui-workflow-reducer",
106
114
  "requirement": "optional",
@@ -121,6 +129,11 @@
121
129
  "requirement": "required",
122
130
  "status": "applied"
123
131
  },
132
+ {
133
+ "id": "builtin-provider-env-recovery",
134
+ "requirement": "required",
135
+ "status": "applied"
136
+ },
124
137
  {
125
138
  "id": "configuration-diagnostics",
126
139
  "requirement": "required",
@@ -136,6 +149,11 @@
136
149
  "requirement": "optional",
137
150
  "status": "applied"
138
151
  },
152
+ {
153
+ "id": "resolved-context-window",
154
+ "requirement": "required",
155
+ "status": "applied"
156
+ },
139
157
  {
140
158
  "id": "tui-bridge",
141
159
  "requirement": "required",
@@ -169,7 +187,7 @@
169
187
  {
170
188
  "id": "http-no-content",
171
189
  "requirement": "required",
172
- "status": "applied"
190
+ "status": "already_present"
173
191
  },
174
192
  {
175
193
  "id": "network-retry-classification",
@@ -206,11 +224,26 @@
206
224
  "requirement": "required",
207
225
  "status": "applied"
208
226
  },
227
+ {
228
+ "id": "bigmodel-oauth",
229
+ "requirement": "required",
230
+ "status": "already_present"
231
+ },
232
+ {
233
+ "id": "browser-url-opening",
234
+ "requirement": "required",
235
+ "status": "applied"
236
+ },
209
237
  {
210
238
  "id": "desktop-oauth",
211
239
  "requirement": "required",
212
240
  "status": "applied"
213
241
  },
242
+ {
243
+ "id": "bigmodel-session-reuse",
244
+ "requirement": "optional",
245
+ "status": "applied"
246
+ },
214
247
  {
215
248
  "id": "login-model-defaults",
216
249
  "requirement": "required",