zcode-app-cli 3.16.2-38 → 3.16.3-40
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/LICENSES/README.md +1 -1
- package/README.md +19 -4
- package/bin/zcode.js +47 -16
- package/docs/CONFIGURATION.md +2 -1
- package/docs/CONFIGURATION.zh-CN.md +2 -1
- package/docs/THIRD_PARTY_CONTENT.md +2 -2
- package/package.json +2 -2
- package/vendor/cli-config.cjs +21 -0
- package/vendor/extraction.json +9 -4
- package/vendor/node_modules/@zcode/tui/dist/index.js +79 -22
- package/vendor/packages/documents-plugin/.zcode-plugin/plugin.json +3 -2
- package/vendor/packages/documents-plugin/dist/server.mjs +201 -152
- package/vendor/packages/documents-plugin/dist/ui/bundle-0.txt +1 -1
- package/vendor/packages/documents-plugin/dist/ui/panel.html +1 -1
- package/vendor/packages/documents-plugin/package.json +1 -1
- package/vendor/packages/node-repl-host/dist/mcp/server.js +1 -1
- package/vendor/packages/pdf-plugin/.zcode-plugin/plugin.json +3 -2
- package/vendor/packages/pdf-plugin/dist/server.mjs +201 -152
- package/vendor/packages/pdf-plugin/dist/ui/bundle-0.txt +1 -1
- package/vendor/packages/pdf-plugin/dist/ui/panel.html +1 -1
- package/vendor/packages/pdf-plugin/package.json +1 -1
- package/vendor/packages/presentations-plugin/.zcode-plugin/plugin.json +3 -2
- package/vendor/packages/presentations-plugin/dist/server.mjs +201 -152
- package/vendor/packages/presentations-plugin/dist/ui/bundle-0.txt +1 -1
- package/vendor/packages/presentations-plugin/dist/ui/panel.html +1 -1
- package/vendor/packages/presentations-plugin/package.json +1 -1
- package/vendor/packages/spreadsheets-plugin/.zcode-plugin/plugin.json +3 -2
- package/vendor/packages/spreadsheets-plugin/dist/server.mjs +201 -152
- package/vendor/packages/spreadsheets-plugin/dist/ui/bundle-0.txt +1 -1
- package/vendor/packages/spreadsheets-plugin/dist/ui/panel.html +1 -1
- package/vendor/packages/spreadsheets-plugin/package.json +1 -1
- package/vendor/zcode.cjs +1033 -1031
- package/zcode-runtime.lock.json +3 -3
package/LICENSES/README.md
CHANGED
|
@@ -23,7 +23,7 @@ their upstream originals byte for byte.
|
|
|
23
23
|
revision. It is copied in its original language.
|
|
24
24
|
|
|
25
25
|
The public source revision declares version 3.14.0. It is distinct from the
|
|
26
|
-
Desktop 3.16.
|
|
26
|
+
Desktop 3.16.3 artifact pinned by this project's runtime lock. These notices
|
|
27
27
|
preserve upstream attribution; they are not a claim that this CLI was built
|
|
28
28
|
from that exact commit. The third-party inventory covers multiple upstream
|
|
29
29
|
distributions and may list components absent from our npm package.
|
package/README.md
CHANGED
|
@@ -140,8 +140,8 @@ 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` → `guarded` → `yolo`), independent `/plan` toggling with an input-border indicator, Ctrl+N model and
|
|
144
|
-
cycling; structured session-goal status in the right side of the turn footer;
|
|
143
|
+
(`build` → `edit` → `guarded` → `yolo`), independent `/plan` toggling with an input-border indicator, Ctrl+N model and Ctrl+T effort
|
|
144
|
+
cycling (Tab also cycles effort on an empty prompt); 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.
|
|
147
147
|
|
|
@@ -322,6 +322,12 @@ picker to return to input selection, then `Esc` again to close rewind.
|
|
|
322
322
|
/cls clear the visible transcript only
|
|
323
323
|
```
|
|
324
324
|
|
|
325
|
+
New sessions are saved when you submit their first input or explicitly rename them.
|
|
326
|
+
Exiting an untouched session does not save it or print a resume command. Renaming
|
|
327
|
+
an empty session saves it immediately, including its custom title, so it can be
|
|
328
|
+
resumed before its first turn. Resume commands are shown only for saved sessions;
|
|
329
|
+
an invalid resume target is rejected without replacing the current session.
|
|
330
|
+
|
|
325
331
|
`/cls` clears what the TUI displays without touching the session. The
|
|
326
332
|
runtime's own `/clear` is an alias of `/new` and starts a fresh session, so it
|
|
327
333
|
is forwarded to the runtime unchanged.
|
|
@@ -474,16 +480,25 @@ not available on `PATH`.
|
|
|
474
480
|
|
|
475
481
|
## Configuration
|
|
476
482
|
|
|
477
|
-
Select a model for one headless prompt without changing the
|
|
483
|
+
Select a model and reasoning effort for one headless prompt without changing the
|
|
484
|
+
saved default:
|
|
478
485
|
|
|
479
486
|
```bash
|
|
480
|
-
zcode --model account:zai-individual-coding-plan/GLM-5.3-Flash --prompt 'Reply with exactly: ok'
|
|
487
|
+
zcode --model account:zai-individual-coding-plan/GLM-5.3-Flash --effort high --prompt 'Reply with exactly: ok'
|
|
481
488
|
```
|
|
482
489
|
|
|
483
490
|
`--model` requires a full provider/model ID and `--prompt` (or `-p`). It also
|
|
484
491
|
overrides a resumed session's model for that run. Unknown or unavailable models
|
|
485
492
|
fail before a prompt is sent, rather than falling back to the default.
|
|
486
493
|
|
|
494
|
+
`--effort` selects the model's reasoning level for that prompt. Levels are
|
|
495
|
+
model-specific (for example `disabled`, `low`, `high` and `max`); run the TUI's
|
|
496
|
+
`/effort list` for the current model, or inspect `optionSpecs.reasoningLevel` in
|
|
497
|
+
the provider catalog. `--effort auto` keeps the current or resumed default.
|
|
498
|
+
Without `--effort`, `--model` uses the model's default level. Both flags require
|
|
499
|
+
`--prompt` (or `-p`) and leave the saved default for new sessions unchanged; the
|
|
500
|
+
run's model and effort are recorded on that session.
|
|
501
|
+
|
|
487
502
|
ZCode reads MCP servers, hooks, plugins, permissions, network, storage and display
|
|
488
503
|
settings from `~/.zcode/cli/setting.json` (or
|
|
489
504
|
`%USERPROFILE%\.zcode\cli\setting.json` on Windows). Project settings use
|
package/bin/zcode.js
CHANGED
|
@@ -1476,7 +1476,10 @@ async function missingCodingPlanKey(options = {}) {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
//#endregion
|
|
1478
1478
|
//#region src/prompt-model.ts
|
|
1479
|
-
function
|
|
1479
|
+
function removalIndexes(token) {
|
|
1480
|
+
return token.inlineValue ? [token.index] : [token.index, token.index + 1];
|
|
1481
|
+
}
|
|
1482
|
+
function extractPromptOverrides(args, optionTypes) {
|
|
1480
1483
|
const parsed = parseArgs({
|
|
1481
1484
|
args,
|
|
1482
1485
|
allowPositionals: true,
|
|
@@ -1488,21 +1491,35 @@ function extractPromptModel(args, optionTypes) {
|
|
|
1488
1491
|
type: "string",
|
|
1489
1492
|
short: "p"
|
|
1490
1493
|
},
|
|
1491
|
-
model: { type: "string" }
|
|
1494
|
+
model: { type: "string" },
|
|
1495
|
+
effort: { type: "string" }
|
|
1492
1496
|
}
|
|
1493
1497
|
});
|
|
1494
|
-
const
|
|
1495
|
-
|
|
1496
|
-
if (
|
|
1497
|
-
if (
|
|
1498
|
-
|
|
1499
|
-
if (
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1502
|
-
|
|
1498
|
+
const modelTokens = parsed.tokens.filter((token) => token.kind === "option" && token.name === "model");
|
|
1499
|
+
const effortTokens = parsed.tokens.filter((token) => token.kind === "option" && token.name === "effort");
|
|
1500
|
+
if (modelTokens.length === 0 && effortTokens.length === 0) return { args };
|
|
1501
|
+
if (modelTokens.length !== 0 && modelTokens.length !== 1) throw new Error("Specify --model only once.");
|
|
1502
|
+
if (effortTokens.length !== 0 && effortTokens.length !== 1) throw new Error("Specify --effort only once.");
|
|
1503
|
+
if (typeof parsed.values.prompt !== "string") throw new Error(`${modelTokens.length ? "--model" : "--effort"} requires --prompt or -p.`);
|
|
1504
|
+
const removed = /* @__PURE__ */ new Set();
|
|
1505
|
+
let model;
|
|
1506
|
+
let effort;
|
|
1507
|
+
if (modelTokens.length === 1) {
|
|
1508
|
+
if (typeof parsed.values.model !== "string") throw new Error("--model must be a provider/model ID.");
|
|
1509
|
+
model = parsed.values.model.trim();
|
|
1510
|
+
if (!/^[^/\s]+\/\S+$/u.test(model)) throw new Error("--model must be a provider/model ID.");
|
|
1511
|
+
for (const index of removalIndexes(modelTokens[0])) removed.add(index);
|
|
1512
|
+
}
|
|
1513
|
+
if (effortTokens.length === 1) {
|
|
1514
|
+
if (typeof parsed.values.effort !== "string") throw new Error("--effort requires a value.");
|
|
1515
|
+
effort = parsed.values.effort.trim();
|
|
1516
|
+
if (!effort || effort.startsWith("-") || /\s/u.test(effort)) throw new Error("--effort requires a single effort level.");
|
|
1517
|
+
for (const index of removalIndexes(effortTokens[0])) removed.add(index);
|
|
1518
|
+
}
|
|
1503
1519
|
return {
|
|
1504
1520
|
args: args.filter((_, index) => !removed.has(index)),
|
|
1505
|
-
model
|
|
1521
|
+
model,
|
|
1522
|
+
effort
|
|
1506
1523
|
};
|
|
1507
1524
|
}
|
|
1508
1525
|
//#endregion
|
|
@@ -1730,6 +1747,7 @@ function runtimeEnvironment(extra = {}, inspectConfiguration = false) {
|
|
|
1730
1747
|
delete env.ZCODE_CLI_OAUTH_CALLBACK_STDIN;
|
|
1731
1748
|
delete env.ZCODE_CLI_MIGRATE_CONFIG;
|
|
1732
1749
|
delete env.ZCODE_CLI_PROMPT_MODEL;
|
|
1750
|
+
delete env.ZCODE_CLI_PROMPT_EFFORT;
|
|
1733
1751
|
const distributionVersion = readDistributionVersion();
|
|
1734
1752
|
const appVersion = readJsonVersion(extractionMetadataPath, "appVersion");
|
|
1735
1753
|
const inherited = {
|
|
@@ -1776,6 +1794,12 @@ async function waitForChild(child, onError = (error) => console.error("Error: "
|
|
|
1776
1794
|
});
|
|
1777
1795
|
}
|
|
1778
1796
|
function appendTuiRuntimeDiagnostic(chunk, state) {
|
|
1797
|
+
const lines = `${state.pendingLine ?? ""}${chunk.toString()}`.split(/\r?\n/u);
|
|
1798
|
+
state.pendingLine = lines.pop()?.slice(-1024);
|
|
1799
|
+
for (const line of lines) {
|
|
1800
|
+
const missing = /^Error: Session not found: ([A-Za-z0-9_-]{1,512})$/u.exec(line);
|
|
1801
|
+
if (missing) state.sessionError = `Session not found: ${missing[1]}`;
|
|
1802
|
+
}
|
|
1779
1803
|
if (state.bytes >= tuiRuntimeLogLimitBytes) return;
|
|
1780
1804
|
const text = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
1781
1805
|
try {
|
|
@@ -1805,7 +1829,8 @@ function appendTuiRuntimeDiagnostic(chunk, state) {
|
|
|
1805
1829
|
}
|
|
1806
1830
|
}
|
|
1807
1831
|
function tuiRuntimeFailureMessage(code, state) {
|
|
1808
|
-
|
|
1832
|
+
const diagnostic = state.path && !state.writeFailed ? ` Diagnostics: ${state.path}` : " Runtime diagnostics could not be written.";
|
|
1833
|
+
return `Error: ${state.sessionError ?? `ZCode runtime exited with status ${code}`}.${diagnostic}\n`;
|
|
1809
1834
|
}
|
|
1810
1835
|
async function runRuntime(node, args, extraEnv = {}) {
|
|
1811
1836
|
const tuiInvocation = isTuiRuntimeInvocation(args);
|
|
@@ -1883,10 +1908,12 @@ async function main(args) {
|
|
|
1883
1908
|
return 0;
|
|
1884
1909
|
}
|
|
1885
1910
|
let promptModel;
|
|
1911
|
+
let promptEffort;
|
|
1886
1912
|
try {
|
|
1887
|
-
const parsed =
|
|
1913
|
+
const parsed = extractPromptOverrides(args, readRuntimeCliOptionTypes());
|
|
1888
1914
|
args = parsed.args;
|
|
1889
1915
|
promptModel = parsed.model;
|
|
1916
|
+
promptEffort = parsed.effort;
|
|
1890
1917
|
} catch (error) {
|
|
1891
1918
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
1892
1919
|
return 1;
|
|
@@ -2016,9 +2043,13 @@ async function main(args) {
|
|
|
2016
2043
|
const runtimeArgs = withDefaultBrowserUse(login.args);
|
|
2017
2044
|
const code = await runRuntime(node, runtimeArgs, {
|
|
2018
2045
|
...firstRunSetupEnv(setupPending, runtimeArgs),
|
|
2019
|
-
...promptModel ? { ZCODE_CLI_PROMPT_MODEL: promptModel } : {}
|
|
2046
|
+
...promptModel ? { ZCODE_CLI_PROMPT_MODEL: promptModel } : {},
|
|
2047
|
+
...promptEffort ? { ZCODE_CLI_PROMPT_EFFORT: promptEffort } : {}
|
|
2020
2048
|
});
|
|
2021
|
-
if (code === 0 && (args.includes("--help") || args.includes("-h")))
|
|
2049
|
+
if (code === 0 && (args.includes("--help") || args.includes("-h"))) {
|
|
2050
|
+
console.log("\n --model <provider/model> Select a model for this --prompt run without changing the saved default.");
|
|
2051
|
+
console.log(" --effort <level> Select the model reasoning effort for this --prompt run; auto keeps the default.");
|
|
2052
|
+
}
|
|
2022
2053
|
return code;
|
|
2023
2054
|
} catch (error) {
|
|
2024
2055
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -101,6 +101,7 @@ reported rather than replaced by old settings.
|
|
|
101
101
|
| Providers and model metadata | Shared native `provider_config.json` |
|
|
102
102
|
| Default model in `/settings` | Writes the shared default and applies it to the current session |
|
|
103
103
|
| `/model`, model cycling and reasoning effort | Change/persist this session's native selection; shared default stays unchanged |
|
|
104
|
+
| `--model` / `--effort` on `--prompt` | Per-run model and reasoning-level override; the saved default for new sessions stays unchanged |
|
|
104
105
|
| `/new` | Reads the current shared default |
|
|
105
106
|
| Resume/restart | Restores the session's model and reasoning options |
|
|
106
107
|
| Language and memory | Reads Desktop `localePreference` / `memoryEnabled`; explicit CLI settings override these values |
|
|
@@ -200,7 +201,7 @@ Plugin controls remain under `plugins`, hook declarations under
|
|
|
200
201
|
These paths distinguish the packaged CLI from the upstream application. The
|
|
201
202
|
source references below are pinned to upstream
|
|
202
203
|
[`29628c9` / `v3.14.3`](https://github.com/zai-org/ZCode/tree/29628c9acdb81b703bbd4080c207a0e7ce5e276e).
|
|
203
|
-
This package's runtime lock selects the separate Desktop 3.16.
|
|
204
|
+
This package's runtime lock selects the separate Desktop 3.16.3 artifact; the
|
|
204
205
|
public source snapshot is not an assertion of that artifact's build commit.
|
|
205
206
|
The configuration boundaries were rechecked on 2026-10-20 against
|
|
206
207
|
[`0a1fc56` / `0.17.0`](https://github.com/zai-org/ZCode/tree/0a1fc56d279fd1001f78387bd81aec1c26767411).
|
|
@@ -84,6 +84,7 @@ CLI 专属字段迁移到 `~/.zcode/cli/setting.json`,省略 provider、main/l
|
|
|
84
84
|
| Provider 和模型元数据 | 共享的原生 `provider_config.json` |
|
|
85
85
|
| `/settings` 中的默认模型 | 写入共享默认选择,并应用到当前会话 |
|
|
86
86
|
| `/model`、模型循环切换、推理强度 | 修改并保存当前会话选择,不改共享默认值 |
|
|
87
|
+
| `--prompt` 上的 `--model`/`--effort` | 仅覆盖本次运行的模型和推理强度;不改共享默认值(会话会记录本次选择) |
|
|
87
88
|
| `/new` | 读取当前共享默认模型 |
|
|
88
89
|
| 恢复会话/重启 | 恢复该会话保存的模型和推理选项 |
|
|
89
90
|
| 语言与记忆 | 读取桌面端 `localePreference`/`memoryEnabled`,显式 CLI 设置优先 |
|
|
@@ -173,7 +174,7 @@ MCP 服务器按名称合并。当前 runtime 中,**同名服务器的用户
|
|
|
173
174
|
|
|
174
175
|
下面区分本发行包与上游应用。源码引用固定在上游
|
|
175
176
|
[`29628c9` / `v3.14.3`](https://github.com/zai-org/ZCode/tree/29628c9acdb81b703bbd4080c207a0e7ce5e276e)。
|
|
176
|
-
本项目 runtime lock 选择的是独立发布的 Desktop 3.16.
|
|
177
|
+
本项目 runtime lock 选择的是独立发布的 Desktop 3.16.3 产物,不能据此认定该产物
|
|
177
178
|
由这个公开源码提交构建。
|
|
178
179
|
2026-10-20 已针对
|
|
179
180
|
[`0a1fc56` / `0.17.0`](https://github.com/zai-org/ZCode/tree/0a1fc56d279fd1001f78387bd81aec1c26767411)
|
|
@@ -18,7 +18,7 @@ compatibility patches applied.
|
|
|
18
18
|
|
|
19
19
|
The [upstream notices shipped here](../LICENSES/README.md) come from a separately
|
|
20
20
|
pinned public source revision. That revision declares version 3.14.0; the current
|
|
21
|
-
runtime lock selects Desktop 3.16.
|
|
21
|
+
runtime lock selects Desktop 3.16.3. The notices are a conservative upstream
|
|
22
22
|
inventory, not proof that the extracted binary was built from that exact commit
|
|
23
23
|
or that every listed component is included in this npm package. Review artifact
|
|
24
24
|
contents and applicable terms when updating the runtime.
|
|
@@ -41,7 +41,7 @@ patches; the patch report is in `vendor/extraction.json`.
|
|
|
41
41
|
|
|
42
42
|
## Plugin declarations
|
|
43
43
|
|
|
44
|
-
These are the declarations observed in the Desktop 3.16.
|
|
44
|
+
These are the declarations observed in the Desktop 3.16.3 packages, not a
|
|
45
45
|
replacement for nested dependency or asset licenses:
|
|
46
46
|
|
|
47
47
|
| Package directory | Manifest declaration |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcode-app-cli",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.3-40",
|
|
4
4
|
"description": "Unofficial terminal client for the ZCode agent runtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"test:node": "node --test test/node/*.test.cjs",
|
|
73
73
|
"test:tui": "bun run test:tui:component && bun run test:tui:e2e",
|
|
74
74
|
"test:tui:component": "bun test test/tui/scenario-http.test.ts test/tui/scenario-runtime.test.ts test/tui/scenario-shell.test.ts test/tui/scenario-workspace.test.ts test/tui/terminal-screen.test.ts",
|
|
75
|
-
"test:tui:e2e": "bun test test/tui/allowlisted-shell.test.ts test/tui/dynamic-workflows.test.ts test/tui/http-mock.test.ts test/tui/input-actions.test.ts test/tui/model-resume.test.ts test/tui/model-status.test.ts test/tui/permission-request-queue.test.ts test/tui/run-scenario.test.ts test/tui/runtime-refresh.test.ts test/tui/session-rename.test.ts test/tui/startup.test.ts test/tui/terminal-session.test.ts test/tui/write-and-diff.test.ts",
|
|
75
|
+
"test:tui:e2e": "bun test test/tui/allowlisted-shell.test.ts test/tui/dynamic-workflows.test.ts test/tui/http-mock.test.ts test/tui/input-actions.test.ts test/tui/model-resume.test.ts test/tui/model-status.test.ts test/tui/permission-request-queue.test.ts test/tui/run-scenario.test.ts test/tui/runtime-refresh.test.ts test/tui/session-lifecycle.test.ts test/tui/session-rename.test.ts test/tui/startup.test.ts test/tui/terminal-exit.test.ts test/tui/terminal-session.test.ts test/tui/write-and-diff.test.ts",
|
|
76
76
|
"test:tui:host": "bun test test/tui/scenario-mountx.test.ts",
|
|
77
77
|
"test:tui:manual": "bun scripts/tui-scenario.ts --manual",
|
|
78
78
|
"test:tui-scenario": "bun scripts/tui-scenario.ts",
|
package/vendor/cli-config.cjs
CHANGED
|
@@ -98,6 +98,24 @@ function assertSessionModelReady(options) {
|
|
|
98
98
|
if (state.issue) throw new Error(`${state.issue.message} Resume interactively with zcode --resume ${options.sessionId} and use /model to choose a replacement. No model request was sent.`);
|
|
99
99
|
}
|
|
100
100
|
//#endregion
|
|
101
|
+
//#region src/runtime-session-lifecycle.ts
|
|
102
|
+
async function assertResumableSession(store, sessionId) {
|
|
103
|
+
const session = await store.getSession(sessionId);
|
|
104
|
+
if (!session || session.time?.deleted !== void 0) throw new Error(`Session not found: ${sessionId}`);
|
|
105
|
+
}
|
|
106
|
+
async function ensureSessionForTitle(runtime, options) {
|
|
107
|
+
if (!runtime.sessionId || !runtime.sessionStore || !runtime.ensureSessionPersistedForExternalActivity) throw new Error("Session persistence is unavailable in this runtime.");
|
|
108
|
+
await runtime.ensureSessionPersistedForExternalActivity(options.title, { traceContext: options.traceContext ?? runtime.rootTraceContext });
|
|
109
|
+
await assertResumableSession(runtime.sessionStore, runtime.sessionId);
|
|
110
|
+
}
|
|
111
|
+
async function readSessionResumeTarget(app) {
|
|
112
|
+
const sessionId = app.sessionId ?? app.runtime?.sessionId;
|
|
113
|
+
const store = app.sessionStore ?? app.runtime?.sessionStore;
|
|
114
|
+
if (!sessionId || !store) return void 0;
|
|
115
|
+
const session = await store.getSession(sessionId);
|
|
116
|
+
return session && session.time?.deleted === void 0 ? sessionId : void 0;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
101
119
|
//#region src/runtime-tui-bridge.ts
|
|
102
120
|
const maximumTaskMessageLength = 2e4;
|
|
103
121
|
const maximumTaskSummaryLength = 200;
|
|
@@ -1077,9 +1095,11 @@ async function migrateLegacyProviders(options) {
|
|
|
1077
1095
|
}
|
|
1078
1096
|
//#endregion
|
|
1079
1097
|
exports.appServerRegistryOptions = appServerRegistryOptions;
|
|
1098
|
+
exports.assertResumableSession = assertResumableSession;
|
|
1080
1099
|
exports.assertSessionModelReady = assertSessionModelReady;
|
|
1081
1100
|
exports.browserOpenCommand = browserOpenCommand;
|
|
1082
1101
|
exports.createTuiWorkflowManagement = createTuiWorkflowManagement;
|
|
1102
|
+
exports.ensureSessionForTitle = ensureSessionForTitle;
|
|
1083
1103
|
exports.exchangeBigmodelOAuthCode = exchangeBigmodelOAuthCode;
|
|
1084
1104
|
exports.inspectRuntimeConfiguration = inspectRuntimeConfiguration;
|
|
1085
1105
|
exports.installSqliteWriteRecovery = installSqliteWriteRecovery;
|
|
@@ -1088,6 +1108,7 @@ exports.migrateLegacyProviders = migrateLegacyProviders;
|
|
|
1088
1108
|
exports.providerMigrationNeeded = providerMigrationNeeded;
|
|
1089
1109
|
exports.pruneSqliteUsage = pruneSqliteUsage;
|
|
1090
1110
|
exports.readSessionModelState = readSessionModelState;
|
|
1111
|
+
exports.readSessionResumeTarget = readSessionResumeTarget;
|
|
1091
1112
|
exports.readTuiRuntimeProjection = readTuiRuntimeProjection;
|
|
1092
1113
|
exports.restoreTuiBackgroundTasks = restoreTuiBackgroundTasks;
|
|
1093
1114
|
exports.sendTuiBackgroundTaskMessage = sendTuiBackgroundTaskMessage;
|
package/vendor/extraction.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"appVersion": "3.16.
|
|
2
|
+
"appVersion": "3.16.3",
|
|
3
3
|
"cliVersion": "0.17.0",
|
|
4
|
-
"extractedAt": "2026-10-
|
|
5
|
-
"sha512": "
|
|
6
|
-
"source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.16.
|
|
4
|
+
"extractedAt": "2026-10-26T05:32:54.703Z",
|
|
5
|
+
"sha512": "WvOb2B4NnRdNFIAKuMJ+S0vCT+uQfVfpiFPLsraG8KQCHTXQRsvC58OkTz79snfbmmCkAetXUi/RJ39bKG+T8g==",
|
|
6
|
+
"source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.16.3/linux-x64/ZCode-3.16.3-linux-x64.deb",
|
|
7
7
|
"runtimeCapabilities": {
|
|
8
8
|
"schemaVersion": 1,
|
|
9
9
|
"cli": {
|
|
@@ -147,6 +147,11 @@
|
|
|
147
147
|
"requirement": "required",
|
|
148
148
|
"status": "applied"
|
|
149
149
|
},
|
|
150
|
+
{
|
|
151
|
+
"id": "session-lifecycle",
|
|
152
|
+
"requirement": "required",
|
|
153
|
+
"status": "applied"
|
|
154
|
+
},
|
|
150
155
|
{
|
|
151
156
|
"id": "official-mcp-availability",
|
|
152
157
|
"requirement": "optional",
|
|
@@ -406,6 +406,15 @@ function watchStreamErrors(sources, onError) {
|
|
|
406
406
|
};
|
|
407
407
|
}
|
|
408
408
|
//#endregion
|
|
409
|
+
//#region packages/zcode-tui/src/terminal-cleanup.ts
|
|
410
|
+
/** Disable enhanced keyboard reporting and consume in-flight releases before restoring the terminal. */
|
|
411
|
+
async function stopTui(ui) {
|
|
412
|
+
try {
|
|
413
|
+
await ui.terminal.drainInput();
|
|
414
|
+
} catch {}
|
|
415
|
+
ui.stop();
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
409
418
|
//#region packages/zcode-tui/src/startup.ts
|
|
410
419
|
async function loadTuiStartupOptions(options) {
|
|
411
420
|
const loadStartupOptions = options.loadStartupOptions;
|
|
@@ -434,15 +443,16 @@ async function loadTuiStartupOptions(options) {
|
|
|
434
443
|
return { consume: true };
|
|
435
444
|
});
|
|
436
445
|
const removeStreamErrorGuards = watchStreamErrors([process.stdout, process.stderr], () => cancel(1));
|
|
437
|
-
process.
|
|
438
|
-
process.
|
|
439
|
-
if (process.platform !== "win32") process.
|
|
446
|
+
process.on("SIGINT", onSigint);
|
|
447
|
+
process.on("SIGTERM", onSigterm);
|
|
448
|
+
if (process.platform !== "win32") process.on("SIGHUP", onSighup);
|
|
449
|
+
let readyOptions;
|
|
440
450
|
try {
|
|
441
451
|
ui.start();
|
|
442
452
|
ui.renderNow();
|
|
443
453
|
await new Promise((resolve) => setImmediate(resolve));
|
|
444
454
|
if (cancelled) return void 0;
|
|
445
|
-
|
|
455
|
+
readyOptions = await Promise.race([Promise.resolve().then(async () => {
|
|
446
456
|
if (cancelled) return void 0;
|
|
447
457
|
const startup = await loadStartupOptions();
|
|
448
458
|
return cancelled ? void 0 : {
|
|
@@ -451,21 +461,22 @@ async function loadTuiStartupOptions(options) {
|
|
|
451
461
|
};
|
|
452
462
|
}), cancellation]);
|
|
453
463
|
} finally {
|
|
454
|
-
process.off("SIGINT", onSigint);
|
|
455
|
-
process.off("SIGTERM", onSigterm);
|
|
456
|
-
if (process.platform !== "win32") process.off("SIGHUP", onSighup);
|
|
457
464
|
try {
|
|
458
465
|
ui.clear();
|
|
459
466
|
ui.renderNow();
|
|
460
467
|
} finally {
|
|
461
468
|
try {
|
|
462
|
-
ui
|
|
469
|
+
await stopTui(ui);
|
|
463
470
|
} finally {
|
|
464
471
|
await new Promise((resolve) => setImmediate(resolve));
|
|
472
|
+
process.off("SIGINT", onSigint);
|
|
473
|
+
process.off("SIGTERM", onSigterm);
|
|
474
|
+
if (process.platform !== "win32") process.off("SIGHUP", onSighup);
|
|
465
475
|
removeStreamErrorGuards();
|
|
466
476
|
}
|
|
467
477
|
}
|
|
468
478
|
}
|
|
479
|
+
return cancelled ? void 0 : readyOptions;
|
|
469
480
|
}
|
|
470
481
|
//#endregion
|
|
471
482
|
//#region packages/zcode-tui/src/prompt-preflight.ts
|
|
@@ -158170,7 +158181,7 @@ function normalizeEvent(value) {
|
|
|
158170
158181
|
partId: asString(body.partId) ?? asString(body.partID) ?? part?.partId,
|
|
158171
158182
|
sessionId: asString(value.sessionId) ?? asString(value.sessionID) ?? asString(params?.sessionId) ?? asString(params?.sessionID) ?? asString(payload?.sessionId) ?? asString(payload?.sessionID) ?? asString(body.sessionId) ?? asString(body.sessionID) ?? part?.sessionId,
|
|
158172
158183
|
turnId: envelopeString("turnId") ?? envelopeString("turnID"),
|
|
158173
|
-
eventId: asString(value.eventId) ?? (params && asString(params.eventId)) ?? asString(value.id) ?? (params && asString(params.id)) ?? asString(body.eventId)
|
|
158184
|
+
eventId: asString(value.eventId) ?? (params && asString(params.eventId)) ?? asString(value.id) ?? (params && asString(params.id)) ?? asString(body.eventId),
|
|
158174
158185
|
inputSource: envelopeString("inputSource"),
|
|
158175
158186
|
taskId: envelopeString("taskId") ?? envelopeString("taskID") ?? (originMeta && asString(originMeta.workId)),
|
|
158176
158187
|
taskIds: strings("taskIds") ?? strings("taskIDs") ?? (originMeta && (Array.isArray(originMeta.workIds) ? originMeta.workIds.filter((item) => typeof item === "string") : asString(originMeta.workId) ? [asString(originMeta.workId)] : void 0)),
|
|
@@ -158236,6 +158247,34 @@ function normalizeEvent(value) {
|
|
|
158236
158247
|
function isModelCancellationEvent(event) {
|
|
158237
158248
|
return event.type === "model_request_failed" && (event.reason?.toLowerCase() === "cancelled" || event.errorCode?.toLowerCase() === "model_request_cancelled" || event.exceptionType?.toLowerCase() === "aborterror");
|
|
158238
158249
|
}
|
|
158250
|
+
/**
|
|
158251
|
+
* The runtime forwards every session event to each live subscription (the
|
|
158252
|
+
* active prompt, steers, watchers kept open around background-task
|
|
158253
|
+
* notification turns), so one event can reach the TUI several times.
|
|
158254
|
+
* Streamed deltas are appended rather than replaced, so each redelivery
|
|
158255
|
+
* would render again — exact redeliveries of an already-seen event
|
|
158256
|
+
* (same eventId, or the same delivered object when no id is attached)
|
|
158257
|
+
* must be dropped. Distinct events never share a key: separate deliveries
|
|
158258
|
+
* are separate objects, and legitimately repeated delta content produces
|
|
158259
|
+
* new event objects each time.
|
|
158260
|
+
*/
|
|
158261
|
+
function createStreamEventRedeliveryFilter(capacity = 256) {
|
|
158262
|
+
const recent = /* @__PURE__ */ new Map();
|
|
158263
|
+
return { duplicate(value, event) {
|
|
158264
|
+
const key = event.eventId ?? value;
|
|
158265
|
+
if (recent.has(key)) {
|
|
158266
|
+
recent.delete(key);
|
|
158267
|
+
recent.set(key, true);
|
|
158268
|
+
return true;
|
|
158269
|
+
}
|
|
158270
|
+
recent.set(key, true);
|
|
158271
|
+
if (recent.size > capacity) {
|
|
158272
|
+
const oldest = recent.keys().next().value;
|
|
158273
|
+
if (oldest !== void 0) recent.delete(oldest);
|
|
158274
|
+
}
|
|
158275
|
+
return false;
|
|
158276
|
+
} };
|
|
158277
|
+
}
|
|
158239
158278
|
const toolCancellationValues = /* @__PURE__ */ new Set([
|
|
158240
158279
|
"aborterror",
|
|
158241
158280
|
"cancelled",
|
|
@@ -166708,6 +166747,7 @@ var ZCodeTui = class {
|
|
|
166708
166747
|
attachmentBar;
|
|
166709
166748
|
editor;
|
|
166710
166749
|
assistantStream;
|
|
166750
|
+
deliveredStreamEvents = createStreamEventRedeliveryFilter();
|
|
166711
166751
|
notifications;
|
|
166712
166752
|
skillCatalog;
|
|
166713
166753
|
done;
|
|
@@ -166913,9 +166953,9 @@ var ZCodeTui = class {
|
|
|
166913
166953
|
const onSigterm = () => this.handleSignal("SIGTERM");
|
|
166914
166954
|
const onSighup = () => this.handleSignal("SIGHUP");
|
|
166915
166955
|
this.installStreamErrorGuards();
|
|
166916
|
-
process.
|
|
166917
|
-
process.
|
|
166918
|
-
if (process.platform !== "win32") process.
|
|
166956
|
+
process.on("SIGINT", onSigint);
|
|
166957
|
+
process.on("SIGTERM", onSigterm);
|
|
166958
|
+
if (process.platform !== "win32") process.on("SIGHUP", onSighup);
|
|
166919
166959
|
let startAttempted = false;
|
|
166920
166960
|
try {
|
|
166921
166961
|
if (this.stopped) {
|
|
@@ -166959,16 +166999,16 @@ var ZCodeTui = class {
|
|
|
166959
166999
|
if (this.sessionModelIssue) this.recoverSessionModel();
|
|
166960
167000
|
await this.done;
|
|
166961
167001
|
} finally {
|
|
166962
|
-
process.off("SIGINT", onSigint);
|
|
166963
|
-
process.off("SIGTERM", onSigterm);
|
|
166964
|
-
if (process.platform !== "win32") process.off("SIGHUP", onSighup);
|
|
166965
167002
|
try {
|
|
166966
|
-
if (startAttempted
|
|
167003
|
+
if (startAttempted) {
|
|
166967
167004
|
this.stop();
|
|
166968
167005
|
await this.done;
|
|
166969
167006
|
}
|
|
166970
167007
|
} finally {
|
|
166971
167008
|
await new Promise((resolve) => setImmediate(resolve));
|
|
167009
|
+
process.off("SIGINT", onSigint);
|
|
167010
|
+
process.off("SIGTERM", onSigterm);
|
|
167011
|
+
if (process.platform !== "win32") process.off("SIGHUP", onSighup);
|
|
166972
167012
|
this.removeStreamErrorGuards?.();
|
|
166973
167013
|
this.removeStreamErrorGuards = void 0;
|
|
166974
167014
|
}
|
|
@@ -167548,6 +167588,10 @@ var ZCodeTui = class {
|
|
|
167548
167588
|
this.switchModel();
|
|
167549
167589
|
return { consume: true };
|
|
167550
167590
|
}
|
|
167591
|
+
if (matchesKey(data, "ctrl+t")) {
|
|
167592
|
+
this.switchEffort();
|
|
167593
|
+
return { consume: true };
|
|
167594
|
+
}
|
|
167551
167595
|
if (matchesKey(data, "tab") && (this.turnAbortController || this.inputQueue.paused) && Boolean(this.editor.getText().trim()) && !this.editor.isShowingAutocomplete()) {
|
|
167552
167596
|
this.queueCurrentEditorInput();
|
|
167553
167597
|
return { consume: true };
|
|
@@ -168160,6 +168204,7 @@ var ZCodeTui = class {
|
|
|
168160
168204
|
if (turnEpoch !== void 0 && turnEpoch !== this.activeTurnEpoch) return;
|
|
168161
168205
|
const event = normalizeEvent(value);
|
|
168162
168206
|
if (!event || this.isForeignSessionEvent(event)) return;
|
|
168207
|
+
if (this.deliveredStreamEvents.duplicate(event.raw, event)) return;
|
|
168163
168208
|
if (runtimeContextRefreshNeeded(event)) this.runtimeContextCache.invalidate();
|
|
168164
168209
|
if (this.handleDynamicWorkflowEvent(value, event.type)) return;
|
|
168165
168210
|
const taskScoped = this.backgroundTaskEvents.isTaskScoped(event);
|
|
@@ -171441,6 +171486,18 @@ var ZCodeTui = class {
|
|
|
171441
171486
|
if (timeout) clearTimeout(timeout);
|
|
171442
171487
|
if (usage !== void 0) this.applySessionUsage(usage);
|
|
171443
171488
|
}
|
|
171489
|
+
async readExitResumeTarget() {
|
|
171490
|
+
const readSessionResumeTarget = this.options.readSessionResumeTarget;
|
|
171491
|
+
if (!readSessionResumeTarget) return void 0;
|
|
171492
|
+
let timeout;
|
|
171493
|
+
try {
|
|
171494
|
+
return await Promise.race([Promise.resolve().then(() => readSessionResumeTarget()).catch(() => void 0), new Promise((resolve) => {
|
|
171495
|
+
timeout = setTimeout(() => resolve(void 0), exitUsageQueryTimeoutMs);
|
|
171496
|
+
})]);
|
|
171497
|
+
} finally {
|
|
171498
|
+
if (timeout) clearTimeout(timeout);
|
|
171499
|
+
}
|
|
171500
|
+
}
|
|
171444
171501
|
finishTurn(unfinishedToolState = "interrupted") {
|
|
171445
171502
|
const notification = this.pendingTurnNotification;
|
|
171446
171503
|
const notificationDetail = notification === "completed" ? this.turnAssistantText : this.pendingTurnNotificationDetail;
|
|
@@ -171454,7 +171511,7 @@ var ZCodeTui = class {
|
|
|
171454
171511
|
if (unfinishedToolState === "cancelled") {
|
|
171455
171512
|
this.turnWork.cancel();
|
|
171456
171513
|
this.settleTurnTiming();
|
|
171457
|
-
} else if (!this.turnWork.finishForeground(Boolean(this.options.readRuntimeProjection))) this.settleTurnTiming();
|
|
171514
|
+
} else if (!this.turnWork.finishForeground(Boolean(this.options.readRuntimeProjection) && unfinishedToolState !== "failed")) this.settleTurnTiming();
|
|
171458
171515
|
this.activity = void 0;
|
|
171459
171516
|
this.refreshSessionTerminalTitle();
|
|
171460
171517
|
this.updateTurnStatus();
|
|
@@ -171510,18 +171567,18 @@ var ZCodeTui = class {
|
|
|
171510
171567
|
try {
|
|
171511
171568
|
this.notifications.stop();
|
|
171512
171569
|
} catch {}
|
|
171513
|
-
try {
|
|
171514
|
-
this.ui.stop();
|
|
171515
|
-
} catch {}
|
|
171516
171570
|
this.finishStop(elapsedMilliseconds);
|
|
171517
171571
|
}
|
|
171518
171572
|
async finishStop(elapsedMilliseconds) {
|
|
171519
171573
|
try {
|
|
171520
|
-
|
|
171574
|
+
try {
|
|
171575
|
+
await stopTui(this.ui);
|
|
171576
|
+
} catch {}
|
|
171577
|
+
const [, resumeTarget] = await Promise.all([this.refreshExitUsage(), this.readExitResumeTarget()]);
|
|
171521
171578
|
const summary = buildExitSummary({
|
|
171522
171579
|
elapsedMilliseconds,
|
|
171523
171580
|
metrics: this.sessionMetrics,
|
|
171524
|
-
sessionId:
|
|
171581
|
+
sessionId: resumeTarget,
|
|
171525
171582
|
width: this.ui.terminal.columns
|
|
171526
171583
|
});
|
|
171527
171584
|
const lines = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "documents",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "DOCX document production skills and a Word viewer panel, published as an official ZCode plugin.",
|
|
5
5
|
"description_i18n": {
|
|
6
6
|
"en": "Word document production skills for DOCX: create, edit, format, review, and comment. View Word files in a side panel: reference passages in chat, and the agent can read, search, point at and capture them.",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"cwd": "${ZCODE_PROJECT_DIR}",
|
|
21
21
|
"env": {
|
|
22
22
|
"ZCODE_WORKSPACE_ROOT": "${ZCODE_PROJECT_DIR}"
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
|
+
"isolation": "workspace"
|
|
24
25
|
}
|
|
25
26
|
},
|
|
26
27
|
"ui": {
|