zcode-app-cli 3.17.1-42 → 3.17.2-44
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 +11 -0
- package/bin/zcode.js +4 -4
- package/docs/CONFIGURATION.md +16 -1
- package/docs/CONFIGURATION.zh-CN.md +12 -1
- package/docs/HEADLESS.md +61 -0
- package/docs/HOST_INTEGRATION.md +4 -0
- package/docs/THIRD_PARTY_CONTENT.md +4 -1
- package/package.json +2 -1
- package/vendor/cli-config.cjs +90 -0
- package/vendor/extraction.json +14 -4
- package/vendor/node_modules/@zcode/tui/dist/index.js +38 -4
- package/vendor/packages/node-repl-host/dist/mcp/server.js +1 -1
- package/vendor/packages/zcode-guide-plugin/skills/diagnosing-commands/SKILL.md +2 -2
- package/vendor/zcode.cjs +1016 -1008
- 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.17.
|
|
26
|
+
Desktop 3.17.2 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
|
@@ -228,6 +228,14 @@ into a request that loads each selected Skill through the runtime's `Skill`
|
|
|
228
228
|
tool before carrying out the visible user request. Unknown `$` tokens remain
|
|
229
229
|
ordinary prompt text.
|
|
230
230
|
|
|
231
|
+
Skills also appear in `/` command completion, marked `Skill` with their
|
|
232
|
+
descriptions. Type `/` and filter by name, or enter `/<skill-name> <task>`
|
|
233
|
+
directly (for example, `/audit review the current changes`). These shortcuts
|
|
234
|
+
use the runtime's `/skill <name> <task>` route. Duplicate identifiers use the
|
|
235
|
+
first discovered entry; plugin Skills retain their qualified names. Built-in
|
|
236
|
+
commands, their aliases and custom commands take precedence over skill
|
|
237
|
+
shortcuts with the same name; use `$name` or `/skill name` for those Skills.
|
|
238
|
+
|
|
231
239
|
Use `@plugin` when the whole Plugin is relevant, including its MCP servers or
|
|
232
240
|
Subagents. Use `$plugin:skill` when one exact Skill must be loaded before the
|
|
233
241
|
task starts.
|
|
@@ -500,6 +508,9 @@ Without `--effort`, `--model` uses the model's default level. Both flags require
|
|
|
500
508
|
`--prompt` (or `-p`) and leave the saved default for new sessions unchanged; the
|
|
501
509
|
run's model and effort are recorded on that session.
|
|
502
510
|
|
|
511
|
+
For automation and long-running `-p` jobs, see [headless execution](./docs/HEADLESS.md)
|
|
512
|
+
for output completion, cancellation, background execution and validation limits.
|
|
513
|
+
|
|
503
514
|
ZCode reads MCP servers, hooks, plugins, permissions, network, storage and display
|
|
504
515
|
settings from `~/.zcode/cli/setting.json` (or
|
|
505
516
|
`%USERPROFILE%\.zcode\cli\setting.json` on Windows). Project settings use
|
package/bin/zcode.js
CHANGED
|
@@ -1853,14 +1853,14 @@ async function runRuntime(node, args, extraEnv = {}) {
|
|
|
1853
1853
|
let forwardedSignal = false;
|
|
1854
1854
|
const forwardSignal = (signal) => {
|
|
1855
1855
|
forwardedSignal = true;
|
|
1856
|
-
if (
|
|
1856
|
+
if (child.exitCode === null && child.signalCode === null) child.kill(signal);
|
|
1857
1857
|
};
|
|
1858
1858
|
const onSigint = () => forwardSignal("SIGINT");
|
|
1859
1859
|
const onSigterm = () => forwardSignal("SIGTERM");
|
|
1860
1860
|
const onSighup = () => forwardSignal("SIGHUP");
|
|
1861
|
-
process.
|
|
1862
|
-
process.
|
|
1863
|
-
if (process.platform !== "win32") process.
|
|
1861
|
+
process.on("SIGINT", onSigint);
|
|
1862
|
+
process.on("SIGTERM", onSigterm);
|
|
1863
|
+
if (process.platform !== "win32") process.on("SIGHUP", onSighup);
|
|
1864
1864
|
try {
|
|
1865
1865
|
const code = await waitForChild(child, tuiInvocation ? (error) => appendTuiRuntimeDiagnostic((error.stack ?? error.message) + "\n", diagnosticState) : void 0);
|
|
1866
1866
|
if (tuiInvocation && code !== 0 && !forwardedSignal) process.stderr.write(tuiRuntimeFailureMessage(code, diagnosticState));
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -205,7 +205,7 @@ Plugin controls remain under `plugins`, hook declarations under
|
|
|
205
205
|
These paths distinguish the packaged CLI from the upstream application. The
|
|
206
206
|
source references below are pinned to upstream
|
|
207
207
|
[`29628c9` / `v3.14.3`](https://github.com/zai-org/ZCode/tree/29628c9acdb81b703bbd4080c207a0e7ce5e276e).
|
|
208
|
-
This package's runtime lock selects the separate Desktop 3.17.
|
|
208
|
+
This package's runtime lock selects the separate Desktop 3.17.2 / runtime 0.17.1 artifact; the
|
|
209
209
|
public source snapshot is not an assertion of that artifact's build commit.
|
|
210
210
|
The configuration boundaries were rechecked on 2026-10-20 against
|
|
211
211
|
[`0a1fc56` / `0.17.0`](https://github.com/zai-org/ZCode/tree/0a1fc56d279fd1001f78387bd81aec1c26767411).
|
|
@@ -334,6 +334,21 @@ Z.AI credentials use Desktop's business-token format. Older CLI OAuth credential
|
|
|
334
334
|
are converted after successful validation on their first request; failed
|
|
335
335
|
validation or a concurrent login never overwrites the newer shared session.
|
|
336
336
|
|
|
337
|
+
Start Plan uses the same ZCode OAuth login as Coding Plan; there is no second
|
|
338
|
+
Start Plan sign-in. An existing Desktop session works without another login.
|
|
339
|
+
Choose `account:zai-start-plan/<model>` or `account:bigmodel-start-plan/<model>`
|
|
340
|
+
in `/model`, or pass it with `--model`. Start Plan requests use the shared ZCode
|
|
341
|
+
JWT directly, without exchanging a Coding Plan project token. The runtime still
|
|
342
|
+
builds and signs the requests. Switching models does not change the saved login.
|
|
343
|
+
|
|
344
|
+
Start Plan providers are available locally when the active account has a valid
|
|
345
|
+
ZCode JWT and profile; the server determines the account's actual grants, model
|
|
346
|
+
availability and remaining quota. A manual Coding Plan API key alone is not a
|
|
347
|
+
ZCode session. Missing, expired or rejected session tokens require the shared
|
|
348
|
+
ZCode login to be renewed, not an additional plan-specific login. Start Plan
|
|
349
|
+
requests never fall back to paid Coding Plan credentials. New requests follow
|
|
350
|
+
the current Desktop account; retries cannot switch accounts or tokens mid-turn.
|
|
351
|
+
|
|
337
352
|
For macOS OAuth, the CLI temporarily registers a callback receiver, checks
|
|
338
353
|
`state`, restores the previous `zcode://` handler and sends the callback through
|
|
339
354
|
stdin. The runtime resolves business and project access before publishing
|
|
@@ -176,7 +176,7 @@ CLI 目前没有信任管理命令,可在 Desktop 中批准相应工作区声
|
|
|
176
176
|
|
|
177
177
|
下面区分本发行包与上游应用。源码引用固定在上游
|
|
178
178
|
[`29628c9` / `v3.14.3`](https://github.com/zai-org/ZCode/tree/29628c9acdb81b703bbd4080c207a0e7ce5e276e)。
|
|
179
|
-
本项目 runtime lock 选择的是独立发布的 Desktop 3.17.
|
|
179
|
+
本项目 runtime lock 选择的是独立发布的 Desktop 3.17.2 / runtime 0.17.1 产物,不能据此认定该产物
|
|
180
180
|
由这个公开源码提交构建。
|
|
181
181
|
2026-10-20 已针对
|
|
182
182
|
[`0a1fc56` / `0.17.0`](https://github.com/zai-org/ZCode/tree/0a1fc56d279fd1001f78387bd81aec1c26767411)
|
|
@@ -284,6 +284,17 @@ Provider 文件中的 `config.defaultModelSelection` 决定新会话使用的模
|
|
|
284
284
|
显式配置的手动 API Key 仍使用其独立的账号选择。Z.AI 凭证统一采用桌面端的业务令牌格式;
|
|
285
285
|
旧版 CLI 保存的 OAuth 令牌会在首次请求验证成功后转换,验证失败或并发登录不会覆盖更新的共享会话。
|
|
286
286
|
|
|
287
|
+
Start Plan 与 Coding Plan 共用同一次 ZCode OAuth 登录,不需要第二次套餐授权;已有桌面端
|
|
288
|
+
会话也无需再次登录。在 `/model` 中选择 `account:zai-start-plan/<model>` 或
|
|
289
|
+
`account:bigmodel-start-plan/<model>`,也可以通过 `--model` 指定。Start Plan 请求直接使用
|
|
290
|
+
共享的 ZCode JWT,不兑换 Coding Plan 项目令牌;请求仍由官方 runtime 构建和签名。
|
|
291
|
+
切换模型不会改变已保存的登录状态。
|
|
292
|
+
|
|
293
|
+
本地仅在当前账号的 ZCode JWT 和资料有效时提供 Start Plan provider;具体活动授权、可用模型
|
|
294
|
+
和剩余额度由服务端判定。仅有手动 Coding Plan API Key 不等于已经登录 ZCode。会话缺失、
|
|
295
|
+
过期或被拒绝时,需要更新共享的 ZCode 登录,而不是新增套餐专属登录。Start Plan 请求不会
|
|
296
|
+
回退使用付费 Coding Plan 凭证。新请求跟随桌面端当前账号,同一请求重试时禁止切换账号或令牌。
|
|
297
|
+
|
|
287
298
|
macOS OAuth 会临时注册回调接收器、校验 `state`,恢复原来的 `zcode://` 处理程序,并通过
|
|
288
299
|
stdin 把回调交给 runtime。Runtime 先取得业务和项目访问令牌,再保存加密登录凭证与
|
|
289
300
|
原生默认模型;TUI 随后重新读取 provider 配置。BigModel 使用 runtime 的 localhost
|
package/docs/HEADLESS.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Headless execution
|
|
2
|
+
|
|
3
|
+
`zcode -p 'task'` runs without a TUI. It is a foreground command, not a daemon,
|
|
4
|
+
and headless mode is separate from the browser's `--browser-use=headless` setting.
|
|
5
|
+
|
|
6
|
+
## Long-running jobs
|
|
7
|
+
|
|
8
|
+
- The prompt lifecycle keeps the Node event loop alive until prompt work and
|
|
9
|
+
cleanup finish, including waits that otherwise have only unreferenced timers.
|
|
10
|
+
This keepalive is not a task timeout or progress heartbeat.
|
|
11
|
+
- The launcher adds no overall job deadline. Model, tool, network, workflow and
|
|
12
|
+
cleanup policies still apply. Use a host supervisor for an overall deadline;
|
|
13
|
+
model retry settings are not a job timeout.
|
|
14
|
+
- Text and JSON output normally arrive at completion. For observable progress,
|
|
15
|
+
use `--output-format stream-json` and consume the JSONL stream incrementally.
|
|
16
|
+
A quiet interval during a tool call or retry is not by itself a failure.
|
|
17
|
+
- Consume stdout **and** stderr. Completion waits for queued writes to reach
|
|
18
|
+
their consumers rather than allowing the runtime's exit watchdog to discard
|
|
19
|
+
them. If a consumer stops reading, completion can wait until it resumes or
|
|
20
|
+
the job is cancelled. This does not guarantee the consumer has persisted data.
|
|
21
|
+
- With `stream-json`, require both exit status 0 and a terminal `result` record.
|
|
22
|
+
A missing result is incomplete even if the process reports status 0.
|
|
23
|
+
|
|
24
|
+
On POSIX systems, `SIGINT`, `SIGTERM` and `SIGHUP` are forwarded to the runtime
|
|
25
|
+
until it actually exits, including repeated signals during cleanup. Cancellation
|
|
26
|
+
must not be interpreted as success; conventional exit statuses are 130, 143
|
|
27
|
+
and 129 respectively. `SIGKILL` cannot run cleanup.
|
|
28
|
+
|
|
29
|
+
Headless mode does not make terminal logout safe automatically. Use a service
|
|
30
|
+
manager or explicitly detach a job if it must survive the shell/SSH connection:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
nohup zcode -p 'your task' --output-format stream-json \
|
|
34
|
+
>run.jsonl 2>run.stderr </dev/null &
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Record the PID and exit status in your supervisor if you need reliable
|
|
38
|
+
cancellation and completion tracking. Configure permissions deliberately;
|
|
39
|
+
headless execution does not provide the TUI's interactive approval experience.
|
|
40
|
+
|
|
41
|
+
## Regression coverage and limits
|
|
42
|
+
|
|
43
|
+
Local HTTP fixtures and real Node child processes exercise:
|
|
44
|
+
|
|
45
|
+
- Connection-reset recovery, incomplete SSE recovery and exhausted recovery.
|
|
46
|
+
- HTTP 503 retry backoff without a test-only keepalive preload.
|
|
47
|
+
- A 512 KiB answer in text, JSON and stream-JSON, including a consumer that
|
|
48
|
+
delays reading for 10 seconds; stream-JSON also has a normal-reader control.
|
|
49
|
+
- `-p` cancellation during retry backoff and repeated launcher termination signals.
|
|
50
|
+
- Unreferenced pending work, success/failure handle cleanup and output-write errors.
|
|
51
|
+
|
|
52
|
+
The slow-reader case previously reproduced exit status 0 without the final result.
|
|
53
|
+
The repeated-signal case previously left the runtime alive after its launcher exited.
|
|
54
|
+
The lifecycle wrapper and launcher signal forwarding address those failures.
|
|
55
|
+
|
|
56
|
+
These are bounded regression tests, not an hours-long soak test. They do not
|
|
57
|
+
establish a fixed memory ceiling or cover every plugin, MCP server, background
|
|
58
|
+
workflow or real provider outage. Streaming output does not imply constant-memory
|
|
59
|
+
execution: the native runtime still retains turn events and the final answer.
|
|
60
|
+
For unattended production jobs, monitor process memory, disk space and progress,
|
|
61
|
+
and keep resumable session state rather than relying only on captured stdout.
|
package/docs/HOST_INTEGRATION.md
CHANGED
|
@@ -35,6 +35,10 @@ to replace the CLI package without changing its own process model.
|
|
|
35
35
|
- For non-interactive commands, preserve the inherited standard-stream
|
|
36
36
|
contract; the command's documented output is the only supported machine
|
|
37
37
|
interface.
|
|
38
|
+
- Consume both stdout and stderr throughout a headless run. A successful run
|
|
39
|
+
waits for pending output writes before exiting; a blocked consumer can delay
|
|
40
|
+
completion. With `--output-format stream-json`, check both exit status and the
|
|
41
|
+
terminal `result` record. See [headless execution](./HEADLESS.md).
|
|
38
42
|
- Set the child's working directory to the workspace the user selected. The
|
|
39
43
|
launcher passes it to the runtime.
|
|
40
44
|
|
|
@@ -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.17.
|
|
21
|
+
runtime lock selects Desktop 3.17.2. 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.
|
|
@@ -44,6 +44,9 @@ patches; the patch report is in `vendor/extraction.json`.
|
|
|
44
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
|
+
Desktop 3.17.2 also includes `zcode-site-plugin` 0.4.2, whose package and plugin
|
|
48
|
+
manifests declare MIT. Its bundled `dist/THIRD_PARTY_NOTICES.txt` is retained.
|
|
49
|
+
|
|
47
50
|
| Package directory | Manifest declaration |
|
|
48
51
|
| --- | --- |
|
|
49
52
|
| `browser-use-plugin` | MIT |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcode-app-cli",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.2-44",
|
|
4
4
|
"description": "Unofficial terminal client for the ZCode agent runtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"docs/PROVIDER_CONFIG.md",
|
|
40
40
|
"docs/PROVIDER_CONFIG.zh-CN.md",
|
|
41
41
|
"docs/HOST_INTEGRATION.md",
|
|
42
|
+
"docs/HEADLESS.md",
|
|
42
43
|
"docs/THIRD_PARTY_CONTENT.md",
|
|
43
44
|
"LICENSES/Apache-2.0.txt",
|
|
44
45
|
"LICENSES/README.md",
|
package/vendor/cli-config.cjs
CHANGED
|
@@ -949,6 +949,74 @@ function zaiBusinessAccessToken(material) {
|
|
|
949
949
|
return token;
|
|
950
950
|
}
|
|
951
951
|
//#endregion
|
|
952
|
+
//#region src/start-plan.ts
|
|
953
|
+
function usableToken(value) {
|
|
954
|
+
const token = value?.trim().replace(/^Bearer\s+/iu, "").trim();
|
|
955
|
+
const parts = token?.split(".");
|
|
956
|
+
if (!parts || parts.length !== 3 || parts.some((part) => !part)) return void 0;
|
|
957
|
+
try {
|
|
958
|
+
const claims = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
|
|
959
|
+
if (!claims || typeof claims !== "object" || Array.isArray(claims)) return void 0;
|
|
960
|
+
const now = Date.now() / 1e3;
|
|
961
|
+
if (claims.exp !== void 0 && (typeof claims.exp !== "number" || !Number.isFinite(claims.exp) || claims.exp <= now)) return void 0;
|
|
962
|
+
if (claims.nbf !== void 0 && (typeof claims.nbf !== "number" || !Number.isFinite(claims.nbf) || claims.nbf > now)) return void 0;
|
|
963
|
+
return token;
|
|
964
|
+
} catch {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
async function readStartPlanSession(store, signal) {
|
|
969
|
+
signal?.throwIfAborted();
|
|
970
|
+
const activeKey = "oauth:active_provider", tokenKey = "zcodejwttoken";
|
|
971
|
+
const active = await store.loadMany([activeKey]);
|
|
972
|
+
signal?.throwIfAborted();
|
|
973
|
+
const family = active[activeKey];
|
|
974
|
+
if (family !== "zai" && family !== "bigmodel") return void 0;
|
|
975
|
+
const profileKey = `oauth:${family}:user_info`;
|
|
976
|
+
const keys = [
|
|
977
|
+
activeKey,
|
|
978
|
+
tokenKey,
|
|
979
|
+
profileKey
|
|
980
|
+
];
|
|
981
|
+
const values = await store.loadMany(keys);
|
|
982
|
+
signal?.throwIfAborted();
|
|
983
|
+
const identity = profileIdentity(values[profileKey]), token = usableToken(values[tokenKey]);
|
|
984
|
+
if (values[activeKey] !== family || !identity || !token) return void 0;
|
|
985
|
+
const current = await store.loadMany(keys);
|
|
986
|
+
signal?.throwIfAborted();
|
|
987
|
+
if (keys.some((key) => current[key] !== values[key])) return void 0;
|
|
988
|
+
return {
|
|
989
|
+
family,
|
|
990
|
+
identity,
|
|
991
|
+
token
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
async function refreshStandaloneStartPlanRequest(store, input) {
|
|
995
|
+
input.abortSignal?.throwIfAborted();
|
|
996
|
+
const family = input.accountAccess?.accountType;
|
|
997
|
+
if (input.accountAccess?.mode !== "start-plan" || family !== "zai" && family !== "bigmodel" || input.providerId.trim() !== `account:${family}-start-plan`) throw new Error("start_plan_account_required");
|
|
998
|
+
const session = await readStartPlanSession(store, input.abortSignal);
|
|
999
|
+
if (!session || session.family !== family) {
|
|
1000
|
+
if (input.expectedAccountScope || input.rejectedProjectTokenFingerprint) throw new Error("project_token_scope_invalidated");
|
|
1001
|
+
throw new Error("start_plan_login_required: Sign in to ZCode once to use both Coding Plan and Start Plan; a Coding Plan API key alone is not a ZCode session.");
|
|
1002
|
+
}
|
|
1003
|
+
const accountScope = (0, node_crypto.createHash)("sha256").update(JSON.stringify([
|
|
1004
|
+
input.providerId.trim(),
|
|
1005
|
+
session.family,
|
|
1006
|
+
session.identity,
|
|
1007
|
+
session.token
|
|
1008
|
+
])).digest("hex");
|
|
1009
|
+
if (input.expectedAccountScope && input.expectedAccountScope !== accountScope || input.rejectedProjectTokenFingerprint && !input.expectedAccountScope) throw new Error("project_token_scope_invalidated");
|
|
1010
|
+
if (input.rejectedProjectTokenFingerprint === (0, node_crypto.createHash)("sha256").update(session.token).digest("hex")) throw new Error("start_plan_session_rejected: ZCode rejected the shared session; sign in to ZCode again.");
|
|
1011
|
+
return {
|
|
1012
|
+
headersApplied: true,
|
|
1013
|
+
requestAuth: {
|
|
1014
|
+
apiKey: session.token,
|
|
1015
|
+
accountScope
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
//#endregion
|
|
952
1020
|
//#region src/config-diagnostics.ts
|
|
953
1021
|
const schemaDiagnosticPrefix = /^(?:<config>|modelStream|permission|storage|network|features|memory|mcp|plugins|skills|skill|command|logging|ui|toolConcurrency|modelAnomalyGuard|hooks)(?:[.:[\]]|$)/u;
|
|
954
1022
|
function publicDiagnostic(diagnostic, scope) {
|
|
@@ -1041,6 +1109,25 @@ function writeConfigurationDoctor(output, report) {
|
|
|
1041
1109
|
return report.ok ? 0 : 1;
|
|
1042
1110
|
}
|
|
1043
1111
|
//#endregion
|
|
1112
|
+
//#region src/runtime-headless-lifecycle.ts
|
|
1113
|
+
function flushOutput(stream) {
|
|
1114
|
+
return new Promise((resolve, reject) => {
|
|
1115
|
+
stream.write("", (error) => error ? reject(error) : resolve());
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
async function withHeadlessPromptLifecycle(output, run) {
|
|
1119
|
+
const keepAlive = setInterval(() => {}, 1e3);
|
|
1120
|
+
try {
|
|
1121
|
+
return await run();
|
|
1122
|
+
} finally {
|
|
1123
|
+
try {
|
|
1124
|
+
await Promise.all([flushOutput(output.stdout), flushOutput(output.stderr)]);
|
|
1125
|
+
} finally {
|
|
1126
|
+
clearInterval(keepAlive);
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
//#endregion
|
|
1044
1131
|
//#region src/runtime-config-bridge.ts
|
|
1045
1132
|
function record(value) {
|
|
1046
1133
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -1172,12 +1259,15 @@ exports.providerMigrationNeeded = providerMigrationNeeded;
|
|
|
1172
1259
|
exports.pruneSqliteUsage = pruneSqliteUsage;
|
|
1173
1260
|
exports.readSessionModelState = readSessionModelState;
|
|
1174
1261
|
exports.readSessionResumeTarget = readSessionResumeTarget;
|
|
1262
|
+
exports.readStartPlanSession = readStartPlanSession;
|
|
1175
1263
|
exports.readTuiRuntimeProjection = readTuiRuntimeProjection;
|
|
1264
|
+
exports.refreshStandaloneStartPlanRequest = refreshStandaloneStartPlanRequest;
|
|
1176
1265
|
exports.restoreTuiBackgroundTasks = restoreTuiBackgroundTasks;
|
|
1177
1266
|
exports.sendTuiBackgroundTaskMessage = sendTuiBackgroundTaskMessage;
|
|
1178
1267
|
exports.sharedOAuthCredentialReader = sharedOAuthCredentialReader;
|
|
1179
1268
|
exports.sqliteRecoveryStats = sqliteRecoveryStats;
|
|
1180
1269
|
exports.startTuiSavedWorkflow = startTuiSavedWorkflow;
|
|
1270
|
+
exports.withHeadlessPromptLifecycle = withHeadlessPromptLifecycle;
|
|
1181
1271
|
exports.withRecursiveWorkspacePathSuggestions = withRecursiveWorkspacePathSuggestions;
|
|
1182
1272
|
exports.writeConfigurationDoctor = writeConfigurationDoctor;
|
|
1183
1273
|
exports.zaiBusinessAccessToken = zaiBusinessAccessToken;
|
package/vendor/extraction.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"appVersion": "3.17.
|
|
2
|
+
"appVersion": "3.17.2",
|
|
3
3
|
"cliVersion": "0.17.1",
|
|
4
|
-
"extractedAt": "2026-
|
|
5
|
-
"sha512": "/
|
|
6
|
-
"source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.17.
|
|
4
|
+
"extractedAt": "2026-11-03T13:07:26.089Z",
|
|
5
|
+
"sha512": "d+0Fn/LD8C33LbxzD9jV3Er1JKg9uHii+mcSakVGd1o93WQtCNkfzrOR1DKCk6j2f26YjY5XbgWBYwCY6ROfqg==",
|
|
6
|
+
"source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.17.2/linux-x64/ZCode-3.17.2-linux-x64.deb",
|
|
7
7
|
"runtimeCapabilities": {
|
|
8
8
|
"schemaVersion": 1,
|
|
9
9
|
"cli": {
|
|
@@ -212,6 +212,11 @@
|
|
|
212
212
|
"requirement": "required",
|
|
213
213
|
"status": "applied"
|
|
214
214
|
},
|
|
215
|
+
{
|
|
216
|
+
"id": "headless-lifecycle",
|
|
217
|
+
"requirement": "required",
|
|
218
|
+
"status": "applied"
|
|
219
|
+
},
|
|
215
220
|
{
|
|
216
221
|
"id": "sqlite-busy-timeout",
|
|
217
222
|
"requirement": "required",
|
|
@@ -262,6 +267,11 @@
|
|
|
262
267
|
"requirement": "required",
|
|
263
268
|
"status": "applied"
|
|
264
269
|
},
|
|
270
|
+
{
|
|
271
|
+
"id": "start-plan-standalone",
|
|
272
|
+
"requirement": "optional",
|
|
273
|
+
"status": "applied"
|
|
274
|
+
},
|
|
265
275
|
{
|
|
266
276
|
"id": "login-model-defaults",
|
|
267
277
|
"requirement": "required",
|
|
@@ -164137,6 +164137,11 @@ const skillDescriptionLimit = 140;
|
|
|
164137
164137
|
const skillIdentifierLimit = 256;
|
|
164138
164138
|
const skillIdentifierPattern = /^[A-Za-z0-9._-]+(?::[A-Za-z0-9._-]+)*$/u;
|
|
164139
164139
|
const skillMentionPattern = /(^|\s)\$([A-Za-z0-9._:-]+)/gu;
|
|
164140
|
+
const reservedSlashCommandNames = [
|
|
164141
|
+
"skill",
|
|
164142
|
+
"quit",
|
|
164143
|
+
"workflow"
|
|
164144
|
+
];
|
|
164140
164145
|
var SkillCatalog = class {
|
|
164141
164146
|
listSkills;
|
|
164142
164147
|
cached;
|
|
@@ -164176,6 +164181,19 @@ var SkillCatalog = class {
|
|
|
164176
164181
|
text: buildSkillInvocationPrompt(identifiers, input)
|
|
164177
164182
|
} : void 0;
|
|
164178
164183
|
}
|
|
164184
|
+
async listSlashCommands(reservedNames) {
|
|
164185
|
+
const reserved = new Set([...reservedSlashCommandNames, ...reservedNames].map((name) => name.toLowerCase()));
|
|
164186
|
+
return (await this.list()).filter((skill) => !reserved.has(skill.identifier.toLowerCase()));
|
|
164187
|
+
}
|
|
164188
|
+
async prepareSlashCommand(input, reservedNames) {
|
|
164189
|
+
const match = /^\/([^\s/]+)(?:\s+([\s\S]*))?$/u.exec(input);
|
|
164190
|
+
if (!match) return void 0;
|
|
164191
|
+
if ([...reservedSlashCommandNames, ...reservedNames].some((name) => name.toLowerCase() === match[1].toLowerCase())) return;
|
|
164192
|
+
const skill = (await this.listSlashCommands(reservedNames)).find((entry) => entry.identifier === match[1]);
|
|
164193
|
+
if (!skill) return void 0;
|
|
164194
|
+
const task = match[2]?.trim();
|
|
164195
|
+
return `/skill ${skill.identifier}${task ? ` ${task}` : ""}`;
|
|
164196
|
+
}
|
|
164179
164197
|
};
|
|
164180
164198
|
function normalizeSkillEntries(result) {
|
|
164181
164199
|
if (!isRecord(result) || !Array.isArray(result.skills)) return [];
|
|
@@ -166080,19 +166098,34 @@ const windowsDrivePattern = /^[a-zA-Z]:(?:\/|$)/u;
|
|
|
166080
166098
|
* with runtime-native Plugin references, while `$` selects a specific Skill.
|
|
166081
166099
|
*/
|
|
166082
166100
|
var WorkspaceAutocompleteProvider = class {
|
|
166101
|
+
commands;
|
|
166102
|
+
basePath;
|
|
166083
166103
|
listWorkspacePathSuggestions;
|
|
166104
|
+
reservedCommandNames;
|
|
166084
166105
|
fallback;
|
|
166085
166106
|
plugins;
|
|
166086
166107
|
skills;
|
|
166087
166108
|
triggerCharacters = ["$"];
|
|
166088
|
-
constructor(commands, basePath, listWorkspacePathSuggestions, skillSource, pluginSource) {
|
|
166109
|
+
constructor(commands = [], basePath, listWorkspacePathSuggestions, skillSource, pluginSource, reservedCommandNames = []) {
|
|
166110
|
+
this.commands = commands;
|
|
166111
|
+
this.basePath = basePath;
|
|
166089
166112
|
this.listWorkspacePathSuggestions = listWorkspacePathSuggestions;
|
|
166113
|
+
this.reservedCommandNames = reservedCommandNames;
|
|
166090
166114
|
this.fallback = new CombinedAutocompleteProvider(commands, basePath, null);
|
|
166091
166115
|
this.skills = skillSource instanceof SkillCatalog ? skillSource : new SkillCatalog(skillSource);
|
|
166092
166116
|
this.plugins = pluginSource instanceof PluginReferenceCatalog ? pluginSource : new PluginReferenceCatalog(pluginSource);
|
|
166093
166117
|
}
|
|
166094
166118
|
async getSuggestions(lines, cursorLine, cursorCol, options) {
|
|
166095
166119
|
const currentLine = lines[cursorLine] ?? "";
|
|
166120
|
+
const commandText = currentLine.slice(0, cursorCol).trimStart();
|
|
166121
|
+
if (!options.force && /^\/[^\s/]*$/u.test(commandText)) {
|
|
166122
|
+
const skills = await this.skills.listSlashCommands([...this.reservedCommandNames, ...this.commands.map((command) => "name" in command ? command.name : command.value)]);
|
|
166123
|
+
if (options.signal.aborted) return null;
|
|
166124
|
+
return await new CombinedAutocompleteProvider([...this.commands, ...skills.map((skill) => ({
|
|
166125
|
+
name: skill.identifier,
|
|
166126
|
+
description: skill.description ? `Skill: ${skill.description}` : "Skill"
|
|
166127
|
+
}))], this.basePath, null).getSuggestions(lines, cursorLine, cursorCol, options);
|
|
166128
|
+
}
|
|
166096
166129
|
const skillPrefix = extractSkillDollarPrefix(currentLine.slice(0, cursorCol));
|
|
166097
166130
|
if (skillPrefix) {
|
|
166098
166131
|
const skills = await this.skills.list();
|
|
@@ -167230,7 +167263,7 @@ var ZCodeTui = class {
|
|
|
167230
167263
|
for (const input of [...this.editorHistory].reverse()) editor.addToHistory(input);
|
|
167231
167264
|
const commands = this.autocompleteCommands();
|
|
167232
167265
|
const workspaceDirectory = this.options.workspaceDirectory ?? process.cwd();
|
|
167233
|
-
editor.setAutocompleteProvider(new WorkspaceAutocompleteProvider(commands, workspaceDirectory, this.options.listWorkspacePathSuggestions, this.skillCatalog, this.options.listPluginReferences ?? createRuntimePluginReferenceLister(workspaceDirectory)));
|
|
167266
|
+
editor.setAutocompleteProvider(new WorkspaceAutocompleteProvider(commands, workspaceDirectory, this.options.listWorkspacePathSuggestions, this.skillCatalog, this.options.listPluginReferences ?? createRuntimePluginReferenceLister(workspaceDirectory), (this.options.slashCommands ?? []).flatMap((command) => command.aliases ?? [])));
|
|
167234
167267
|
editor.onSubmit = (text) => void this.submit(text);
|
|
167235
167268
|
return editor;
|
|
167236
167269
|
}
|
|
@@ -167821,7 +167854,8 @@ var ZCodeTui = class {
|
|
|
167821
167854
|
await this.runSuspendedLogin(submission.displayInput);
|
|
167822
167855
|
return;
|
|
167823
167856
|
}
|
|
167824
|
-
const
|
|
167857
|
+
const skillPrompt = input.startsWith("/") ? void 0 : await this.skillCatalog.preparePrompt(input);
|
|
167858
|
+
const runtimeInput = (input.startsWith("/") ? await this.skillCatalog.prepareSlashCommand(input, [...this.autocompleteCommands().map((command) => command.name), ...(this.options.slashCommands ?? []).flatMap((command) => command.aliases ?? [])]) : void 0) ?? skillPrompt?.text ?? input;
|
|
167825
167859
|
this.transcript.clearSearch();
|
|
167826
167860
|
this.transcript.clearCursor();
|
|
167827
167861
|
const steering = this.primaryTurnActive;
|
|
@@ -167910,7 +167944,7 @@ var ZCodeTui = class {
|
|
|
167910
167944
|
let nextCommand;
|
|
167911
167945
|
try {
|
|
167912
167946
|
if (input.startsWith("/") || !this.options.sendInput) {
|
|
167913
|
-
const result = await this.options.submitPrompt(input.startsWith("/") ?
|
|
167947
|
+
const result = await this.options.submitPrompt(input.startsWith("/") ? runtimeInput : promptInput(runtimeInput, attachments), callOptions);
|
|
167914
167948
|
await this.handleResult(result, true, settingTargetForCommand(input));
|
|
167915
167949
|
if (/^\/login\s+\S/iu.test(input) && isRecord(result) && result.loginRequired === false) await this.adoptLoginModel();
|
|
167916
167950
|
accepted = true;
|
|
@@ -83730,7 +83730,7 @@ var ZCODE_CUA_HELPER_BUILD_ID;
|
|
|
83730
83730
|
var init_cua_version = __esm({
|
|
83731
83731
|
"src/broker/shared/cua-version.ts"() {
|
|
83732
83732
|
"use strict";
|
|
83733
|
-
ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-
|
|
83733
|
+
ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-326130-a2d1ba73" : "";
|
|
83734
83734
|
}
|
|
83735
83735
|
});
|
|
83736
83736
|
var init_shared = __esm({
|
|
@@ -50,7 +50,7 @@ There is also an **interactive-surface-only** filter: a command whose name match
|
|
|
50
50
|
5. **Empty command is dropped** — both the description and the body are empty. → Add a `description:` or at least one non-empty body line.
|
|
51
51
|
6. **Unknown frontmatter key (misspelling)** — `model`/`skills`/`allowed-tools` have no effect. → Use the hyphenated keys: `allowed-tools` (not `allowed_tools`), `argument-hint`, `disable-noninteractive`.
|
|
52
52
|
7. **`$ARGUMENTS`/`$1` does not substitute** — the placeholder appears literally or is empty. The body has no placeholder (arguments are appended under "User arguments:" by design), `$1` is out of range, or a form like `${ARGUMENTS}` is not recognized. → Use the exact `$ARGUMENTS`/`$1` tokens.
|
|
53
|
-
8. **Dynamic shell
|
|
53
|
+
8. **Dynamic shell does not run on its own** — a `` !`...` `` or fenced `!` block is not executed when the command is invoked, and its output is not pasted in beforehand. ZCode rewrites each block into an instruction for the model to run that command with the Bash tool, so it appears as a normal tool call with the usual approval prompt (and plan mode can deny it). → Expect that tool call; if the command must not depend on shell output, use static text or `$ARGUMENTS` instead.
|
|
54
54
|
9. **A plugin command is missing** — a disabled plugin contributes no command roots, or a local same-named file is shadowing it. → Enable the plugin in **Settings → Plugin Management**, and ensure no local duplicate shadows it.
|
|
55
55
|
10. **Disabled by configuration** — a valid command silently disappears. The configuration disables it by the command file's absolute path (not the command name). → Set that path's `enable` to `true` or remove it.
|
|
56
56
|
11. **`/` versus `:` confusion** — `/review/code` reports not found although `review/code.md` exists. Subdirectories map to `:`, so the real name is `review:code`. → Invoke `/review:code`.
|
|
@@ -62,5 +62,5 @@ There is also an **interactive-surface-only** filter: a command whose name match
|
|
|
62
62
|
2. **Confirm the file and its root.** Ensure the `.md` sits directly under a scanned commands root for the current working directory — pitfall 1 — and that its name is valid — pitfall 2.
|
|
63
63
|
3. **Check the frontmatter.** A missing/garbled key points to the flat-parser rules (pitfall 4) or an empty command (pitfall 5); a key with no effect is likely a misspelling (pitfall 6).
|
|
64
64
|
4. **Resolve a duplicate.** For a given name, the winner is the first in discovery order; find and rename or remove the copy you do not want.
|
|
65
|
-
5. **Check the body.** Verify the argument placeholders (pitfall 7) and
|
|
65
|
+
5. **Check the body.** Verify the argument placeholders (pitfall 7) and whether a dynamic shell block is handed to the model as a tool call (pitfall 8).
|
|
66
66
|
6. **Still missing with no obvious cause?** Check for a configuration disable (pitfall 10, by absolute file path), a disabled plugin (pitfall 9), or reserved-name filtering (pitfall 12).
|