zcode-app-cli 3.14.3-28 → 3.14.4-30
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/README.md +5 -0
- package/bin/zcode.js +2 -0
- package/docs/CONFIGURATION.md +28 -0
- package/docs/CONFIGURATION.zh-CN.md +23 -0
- package/package.json +2 -1
- package/vendor/cli-config.cjs +455 -91
- package/vendor/extraction.json +14 -4
- package/vendor/node_modules/@zcode/tui/dist/index.js +3 -8
- package/vendor/packages/node-repl-host/dist/mcp/server.js +1 -1
- package/vendor/zcode.cjs +5 -5
- package/zcode-runtime.lock.json +3 -3
package/README.md
CHANGED
|
@@ -481,6 +481,11 @@ Coding Plan API key, or a direct API key with a custom provider. For detailed
|
|
|
481
481
|
setup steps, retries/timeouts, theme, and turn-completion notifications, see
|
|
482
482
|
[Configuration](./docs/CONFIGURATION.md).
|
|
483
483
|
|
|
484
|
+
`zcode app-server` reuses local CLI login by default. Clients that supply account
|
|
485
|
+
configuration and request auth must launch it with `ZCODE_APP_SERVER_AUTH_MODE=host`.
|
|
486
|
+
See [app-server authentication](./docs/CONFIGURATION.md#app-server-authentication)
|
|
487
|
+
for credential ownership and protocol behavior.
|
|
488
|
+
|
|
484
489
|
## Local development
|
|
485
490
|
|
|
486
491
|
Install dependencies and start the client with live TypeScript and auto-sync
|
package/bin/zcode.js
CHANGED
|
@@ -6,6 +6,7 @@ import { basename, dirname, join, posix, resolve, sep, win32 } from "node:path";
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
8
8
|
import { access, chmod, link, mkdir, mkdtemp, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
9
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
10
|
import { StringDecoder } from "node:string_decoder";
|
|
10
11
|
import { createInterface } from "node:readline/promises";
|
|
11
12
|
import { parseArgs } from "node:util";
|
|
@@ -327,6 +328,7 @@ async function markSetupPending(env = process.env) {
|
|
|
327
328
|
async function clearSetupPending(env = process.env) {
|
|
328
329
|
await rm(setupPendingPath(env), { force: true }).catch(() => {});
|
|
329
330
|
}
|
|
331
|
+
new AsyncLocalStorage();
|
|
330
332
|
//#endregion
|
|
331
333
|
//#region src/runtime-config-bridge.ts
|
|
332
334
|
function providerMigrationNeeded(env = process.env) {
|
package/docs/CONFIGURATION.md
CHANGED
|
@@ -30,6 +30,34 @@ Provider settings are created by native login or configured using
|
|
|
30
30
|
[provider field reference](PROVIDER_CONFIG.md) explains every supported personal
|
|
31
31
|
configuration field, Desktop editor mapping and automatic catalog inheritance.
|
|
32
32
|
|
|
33
|
+
## App-server authentication
|
|
34
|
+
|
|
35
|
+
`zcode app-server` defaults to `standalone` authentication: it reuses the native
|
|
36
|
+
credentials saved by CLI login and supplies its own model-request auth. Log in
|
|
37
|
+
with `zcode login` before starting an account-backed session.
|
|
38
|
+
|
|
39
|
+
Clients that own account login must explicitly select `host` when spawning the
|
|
40
|
+
server:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
ZCODE_APP_SERVER_AUTH_MODE=host zcode app-server
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For a programmatic launcher, set `ZCODE_APP_SERVER_AUTH_MODE: "host"` in the child
|
|
47
|
+
process environment. Host mode preserves `provider/updateAccountConfig` and
|
|
48
|
+
`interaction/requestProviderRuntimeHeaders`; the client owns account updates
|
|
49
|
+
and request-credential refresh. It does not read the standalone credential file.
|
|
50
|
+
|
|
51
|
+
The mode is fixed for the server process. Restart to change it. Missing or
|
|
52
|
+
rejected credentials never switch to the other source; an unknown mode fails
|
|
53
|
+
startup. Standalone mode rejects host account updates. Personal API-key providers
|
|
54
|
+
remain available through the native provider configuration in either mode.
|
|
55
|
+
|
|
56
|
+
This follows the credential-ownership distinction in [Codex app-server
|
|
57
|
+
authentication](https://developers.openai.com/codex/app-server#authentication-modes).
|
|
58
|
+
ZCode selects the mode at startup and retains its native protocol; it does not
|
|
59
|
+
implement Codex's `account/login/start` or `account/read` endpoints.
|
|
60
|
+
|
|
33
61
|
## Startup migration
|
|
34
62
|
|
|
35
63
|
The CLI follows the Desktop migration rules and uses the runtime's native parser
|
|
@@ -27,6 +27,29 @@ CLI 通用设置仍使用用户目录中的 `~/.zcode/cli/setting.json`。
|
|
|
27
27
|
[Provider 配置字段参考](PROVIDER_CONFIG.zh-CN.md) 列出了全部个人配置字段、桌面端字段对应关系
|
|
28
28
|
及上游目录继承规则。
|
|
29
29
|
|
|
30
|
+
## App-server 登录与鉴权
|
|
31
|
+
|
|
32
|
+
`zcode app-server` 默认使用 `standalone` 模式,读取 CLI 登录保存的原生凭据,
|
|
33
|
+
并在请求模型时自行提供鉴权信息。使用账号模型前先运行 `zcode login`。
|
|
34
|
+
|
|
35
|
+
如果调用方自己管理账号,启动服务时显式选择 `host`:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
ZCODE_APP_SERVER_AUTH_MODE=host zcode app-server
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
程序启动子进程时,在其环境变量中设置 `ZCODE_APP_SERVER_AUTH_MODE: "host"` 即可。
|
|
42
|
+
该模式保留 `provider/updateAccountConfig` 和 `interaction/requestProviderRuntimeHeaders`,
|
|
43
|
+
由客户端负责账号更新和请求凭据刷新,不读取本机的 standalone 凭据文件。
|
|
44
|
+
|
|
45
|
+
模式在服务启动时确定,切换需要重启。凭据缺失或鉴权失败不会自动改用另一方的账号;
|
|
46
|
+
模式名称无效时启动失败。Standalone 模式拒绝客户端覆盖账号配置。
|
|
47
|
+
两种模式都保留通过原生 provider 配置使用个人 API key 的能力。
|
|
48
|
+
|
|
49
|
+
设计参考 [Codex app-server 的鉴权模式](https://developers.openai.com/codex/app-server#authentication-modes),
|
|
50
|
+
明确区分谁负责管理凭据。ZCode 使用启动配置选择模式并保留自己的协议,
|
|
51
|
+
没有实现 Codex 的 `account/login/start`、`account/read` 接口。
|
|
52
|
+
|
|
30
53
|
## 启动迁移
|
|
31
54
|
|
|
32
55
|
CLI 参考桌面端迁移规则,使用 runtime 的原生解析器和带文件锁的 provider 仓库。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zcode-app-cli",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.4-30",
|
|
4
4
|
"description": "Unofficial terminal client for the ZCode agent runtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@xterm/headless": "6.0.0",
|
|
99
|
+
"acorn": "^8.15.0",
|
|
99
100
|
"beautiful-mermaid": "^1.1.3",
|
|
100
101
|
"bun-types": "1.4.1",
|
|
101
102
|
"cli-highlight": "^2.1.11",
|