@deepseek-ai/dsh-subagent-codex 0.1.0-rc.6 → 0.1.0-rc.8
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.i18n.yaml +2 -2
- package/README.md +72 -20
- package/README.zh.md +72 -20
- package/cordis.patch.yml +5 -0
- package/lib/index.js +482 -91
- package/lib/types/index.d.ts +11 -6
- package/lib/types/run.d.ts +17 -8
- package/lib/types/wire.d.ts +49 -1
- package/package.json +25 -20
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/subagent/subagent-codex/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 975f353b9f1bc6fab61a4c0eb40ebaf50c436623
|
|
6
|
+
README.zh.md: c51f35d9e419e621b5a2cc3101de6bd5e56aa145
|
package/README.md
CHANGED
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
This package registers
|
|
5
|
+
This package registers a Profile-named Codex subagent provider whose default name is `codex`. Each accepted run starts the official package-local Codex wrapper with `app-server --stdio` in the delegating Session's workspace, creates one ephemeral Codex thread, submits one self-contained text task, and returns either the selected final answer or a separate safe failure diagnostic through the shared [`dsh-subagent`](../subagent/README.md) result contract.
|
|
6
6
|
|
|
7
7
|
## Start and ownership
|
|
8
8
|
|
|
9
|
-
`start(request)` accepts only a non-empty sequence of text blocks and derives the child cwd from the parent Session. It then spawns the fixed command through [`dsh-subprocess`](../../subprocess/subprocess/README.md), performs `initialize` → `initialized
|
|
9
|
+
`start(request)` accepts only a non-empty sequence of text blocks and derives the child cwd from the parent Session. It then spawns the fixed command through [`dsh-subprocess`](../../subprocess/subprocess/README.md), performs `initialize` → `initialized`, maps the Profile-selected mode into official `thread/start` approval/reviewer/sandbox fields beside `{ cwd, ephemeral: true }`, and publishes the run only after Codex returns a valid ephemeral thread. A failure or cancellation before publication closes the wire, terminates the managed process tree, waits for it to exit, and rejects `start()`. Non-cancellation rejections expose only the fixed `initialize` or `thread-start` stage plus an already observed process outcome; raw product and Host errors remain on internal cause chains.
|
|
10
10
|
|
|
11
11
|
The published `run.result` starts exactly one turn. It accepts only notifications for that run's thread and turn, then waits for the authoritative `turn/completed` terminal notification. The latest `agentMessage` with `phase: "final_answer"` wins; when Codex emits no explicit final phase, the latest message with `phase: null` is the compatibility fallback. Commentary never replaces either answer, and a successful turn with no nonblank answer settles as an error.
|
|
12
12
|
|
|
13
|
-
For command and file approvals, the unattended provider selects a non-approval decision offered by the request, preferring `cancel`; the stable 0.147.0 request shape without an offered-decision list falls back to `decline`. It answers permission requests with an empty turn-scoped permission set, answers user-input requests with no answers, and declines MCP elicitation. A request with no legal unattended response, or any unknown server request, fails the run.
|
|
13
|
+
For command and file approvals, the unattended provider selects a non-approval decision offered by the request, preferring `cancel`; the stable 0.147.0 request shape without an offered-decision list falls back to `decline`. It answers permission requests with an empty turn-scoped permission set, answers user-input requests with no answers, and declines MCP elicitation. A request with no legal unattended response, or any unknown server request, fails the run. The wire records only the effective mode, request category, decision, and fixed safe reason. It also recognizes declined command/file items and `sandboxError` terminals. Codex 0.147.0 writes some early `never` rejections and sandbox violations only to structured stderr, so the Provider pipes stderr, forwards it unchanged to the host, and matches two fixed signatures in a bounded per-run tail; raw stderr never enters the diagnostic.
|
|
14
14
|
|
|
15
|
-
Local cancellation wins the result race and maps to `aborted`.
|
|
15
|
+
Local cancellation wins the result race and maps to `aborted`. For failed turns, the diagnostic preserves all eleven string and five object variants in the Codex 0.147.0 `codexErrorInfo` union; the four connection/stream variants retain a numeric `httpStatusCode` when supplied, while `activeTurnNotSteerable` does not expose `turnKind`. The diagnostic also names `turn-start`, `turn`, or `process`, independently includes available exit code and signal, and uses `unknown` for unrecognized or malformed values without copying raw fields. `contextWindowExceeded` remains `max-tokens`; every other remote interruption or failure remains `error`, and the provider produces no `refusal`. A contributing permission decision follows the structured failure line. Successful and locally cancelled runs omit both facts.
|
|
16
|
+
|
|
17
|
+
`dispose()` is idempotent: it requests a best-effort `turn/interrupt` with both current ids when they are known, closes the JSON-RPC wire, ends stdin, invokes the shared process-tree termination escalation, waits for whole-tree exit, and detaches the stderr observer. Independent cleanup rejection uses the fixed `teardown` stage and any available process outcome. When startup and rollback both fail, the top-level aggregate message preserves both safe stage lines while the raw failures remain internal.
|
|
16
18
|
|
|
17
19
|
## Capabilities and context
|
|
18
20
|
|
|
@@ -22,33 +24,81 @@ The provider advertises no optional start-time capabilities and reports `inherit
|
|
|
22
24
|
|
|
23
25
|
| Key | Default | Meaning |
|
|
24
26
|
|---|---|---|
|
|
27
|
+
| `providerName` | `codex` | Non-empty registry name on `ctx.subagents`; each mounted instance needs a unique value. |
|
|
25
28
|
| `env` | `{}` | Explicit child environment layered over the subprocess seam's credential-scrubbed parent environment. |
|
|
29
|
+
| `permissionMode` | `never` | Native non-interactive approval and sandbox mode fixed for every thread from this Provider instance. |
|
|
26
30
|
| `disposeGraceMs` | `3000` | Positive finite grace in milliseconds, no greater than [`MAX_TIMER_DELAY_MS`](../../util/timeout/README.md), between the shared process-tree owner's termination tiers; disposal then waits for whole-tree exit. |
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
| `permissionMode` value | `thread/start` fields | Native behavior |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `never` | `approvalPolicy: never`; sandbox omitted | Never ask for approval; execution failures return to the model under the native sandbox. |
|
|
35
|
+
| `approve-for-me` | `approvalPolicy: on-request`, `approvalsReviewer: auto_review`, `sandbox: workspace-write` | Route permission requests through Codex automatic review without a human. |
|
|
36
|
+
| `dangerously-bypass-approvals-and-sandbox` | `approvalPolicy: never`, `sandbox: danger-full-access` | Skip approval and sandbox enforcement; this value must be selected explicitly. |
|
|
37
|
+
|
|
38
|
+
Production resolves the `codex` bin declared by its pinned `@openai/codex@0.147.0` dependency and launches that JavaScript wrapper with the current Node executable. The wrapper selects the matching native platform payload; the provider neither inspects nor falls back to a host `codex` on `PATH`. Native Codex configuration and authentication remain authoritative through the parent cwd, `HOME`, and `CODEX_HOME`, while the Provider overrides only the selected thread approval/reviewer/sandbox fields. All other project, model, provider, MCP, hook, skill, and account settings remain native. The plugin does not select a model, create `CODEX_HOME`, log in, or probe an account. Credential-shaped ambient variables are removed by the subprocess seam before the explicit `env` overlay is applied.
|
|
39
|
+
|
|
40
|
+
This package is an optional Profile Bundle. Install it into the target Profile, then restart that Profile; installation brings the official wrapper and one compatible native platform payload into that Profile, while the declared `cordis.patch.yml` layer registers only the dormant `codex` Host provider and starts no Codex process. Removing the package withdraws that provider and its private runtime closure on the next Profile start.
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
dsh plugin --profile <name> add @deepseek-ai/dsh-subagent-codex
|
|
44
|
+
dsh plugin --profile <name> remove @deepseek-ai/dsh-subagent-codex
|
|
45
|
+
dsh --profile <name>
|
|
46
|
+
```
|
|
29
47
|
|
|
30
|
-
|
|
48
|
+
Installation controls Host availability, not model permission. The Bundle supplies the dormant default `codex` row; the Profile may replace that row's complete config or mount additional rows with distinct `providerName`, `permissionMode`, and `env` values. Loading an instance starts no Codex process until a bound tool calls it. Each `dsh-tool-subagent` row names one provider and needs its own `toolName`, so the model sees static tools rather than a dynamic provider selector. Full Agent Presets carry a matching default product tool row with `disabled: true`; copy a preset and remove that field to expose `subagent_codex` only to agents composed from the copy. Its `one-shot` policy keeps omitted or `false` `run_in_background` calls in the foreground, while explicit `true` returns a parent-owned Job id for `job_output` or `job_kill`. The base host and full presets already provide the generic Job registry and controls.
|
|
49
|
+
|
|
50
|
+
The standalone composition below shows the complete explicit capability. A Profile based on `@deepseek-ai/dsh-base` keeps its existing Job rows, adds the product provider and tool rows, and does not mount duplicate Job services.
|
|
31
51
|
|
|
32
52
|
```yaml
|
|
33
|
-
- id: subagent-codex
|
|
53
|
+
- id: subagent-codex-safe
|
|
54
|
+
name: '@deepseek-ai/dsh-subagent-codex'
|
|
55
|
+
config:
|
|
56
|
+
providerName: codex-safe
|
|
57
|
+
permissionMode: never
|
|
58
|
+
env:
|
|
59
|
+
OPENAI_API_KEY: !!js process.env.OPENAI_API_KEY
|
|
60
|
+
|
|
61
|
+
- id: subagent-codex-bypass
|
|
34
62
|
name: '@deepseek-ai/dsh-subagent-codex'
|
|
35
63
|
config:
|
|
64
|
+
providerName: codex-bypass
|
|
65
|
+
permissionMode: dangerously-bypass-approvals-and-sandbox
|
|
36
66
|
env:
|
|
37
67
|
OPENAI_API_KEY: !!js process.env.OPENAI_API_KEY
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
- id: jobs
|
|
72
|
+
name: '@deepseek-ai/dsh-jobs-local'
|
|
73
|
+
|
|
74
|
+
- id: tool-jobs
|
|
75
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
38
76
|
|
|
39
|
-
- id: tool-subagent-codex
|
|
77
|
+
- id: tool-subagent-codex-safe
|
|
40
78
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
41
79
|
disabled: true
|
|
42
80
|
config:
|
|
43
|
-
provider: codex
|
|
44
|
-
toolName:
|
|
45
|
-
|
|
81
|
+
provider: codex-safe
|
|
82
|
+
toolName: subagent_codex_safe
|
|
83
|
+
backgroundMode: one-shot
|
|
84
|
+
maxDepth: provider-managed
|
|
85
|
+
|
|
86
|
+
- id: tool-subagent-codex-bypass
|
|
87
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
88
|
+
config:
|
|
89
|
+
provider: codex-bypass
|
|
90
|
+
toolName: subagent_codex_bypass
|
|
91
|
+
backgroundMode: one-shot
|
|
46
92
|
maxDepth: provider-managed
|
|
47
93
|
```
|
|
48
94
|
|
|
49
95
|
## Product compatibility and evidence
|
|
50
96
|
|
|
51
|
-
The production wire intentionally implements only the app-server methods required by this one-shot contract.
|
|
97
|
+
The production wire intentionally implements only the app-server methods required by this one-shot contract. The runtime dependency and all six optional-dependency aliases are pinned to `@openai/codex@0.147.0` / `codex-cli 0.147.0`. A normal install selects one payload for the current OS and CPU. For the current darwin-arm64 payload, `npm pack --dry-run --json @openai/codex@0.147.0-darwin-arm64` reports 111,199,052 packed bytes and 274,777,843 unpacked bytes. That package contains native `codex`, `codex-code-mode-host`, `rg`, and `zsh` resources; other platforms may differ, and these values are disclosure rather than an installation threshold.
|
|
98
|
+
|
|
99
|
+
Generated schema evidence and package tests pin all sixteen error-info variants, HTTP-status locations, six lifecycle stages, process outcomes, stop-reason mapping, unknown fallback, sanitization, permission ordering, cancellation, concurrency, and cleanup aggregation. The keyless real-product test drives the package wrapper against a loopback Responses fixture and observes the package-local argv, exact Bearer key, original task, byte-exact final answer, thread-level `never` overriding ambient `on-request`, automatic-review startup, unattended rejection without file side effects, a real `internalServerError`, explicit dangerous-bypass writing in suite-owned temporary storage, process/protocol failure with safe exit facts, and wrapper/native quiescence. The same tier proves two named instances retain separate environments and native modes.
|
|
100
|
+
|
|
101
|
+
Installing with optional dependencies omitted, using an unsupported platform, or losing the selected payload makes the first delegation fail at `initialize` with the safe `unknown` category and any observed process outcome. Raw wrapper text remains on Host stderr; the provider neither probes a host CLI nor retries with one. An isolated wrapper fixture separately proves the native payload failure and absence of host fallback.
|
|
52
102
|
|
|
53
103
|
## Model Experience
|
|
54
104
|
|
|
@@ -56,7 +106,7 @@ The production wire intentionally implements only the app-server methods require
|
|
|
56
106
|
|
|
57
107
|
#### What the model sees
|
|
58
108
|
|
|
59
|
-
The Codex child receives the standalone text blocks as one turn in a fresh ephemeral thread. Its workspace is the parent Session cwd
|
|
109
|
+
The Codex child receives the standalone text blocks as one turn in a fresh ephemeral thread. Its workspace is the parent Session cwd; its model, system instructions, tools, and authentication come from native Codex configuration, the selected Provider instance's Profile configuration fixes the thread's environment, non-interactive approval policy, and sandbox mode, and the executable version comes from the Bundle's pinned platform payload.
|
|
60
110
|
|
|
61
111
|
#### Token effect
|
|
62
112
|
|
|
@@ -66,26 +116,28 @@ The child pays for an independent Codex context and turn. Child tokens do not en
|
|
|
66
116
|
|
|
67
117
|
Independent of the parent request cache. Reuse depends only on Codex's own provider, model, instructions, tools, and ephemeral-thread request.
|
|
68
118
|
|
|
69
|
-
### Parent
|
|
119
|
+
### Parent scheduling and results, indirectly
|
|
70
120
|
|
|
71
121
|
#### What the model sees
|
|
72
122
|
|
|
73
|
-
Through `dsh-tool-subagent`,
|
|
123
|
+
Through `dsh-tool-subagent`, a foreground call gives the parent the selected final Codex answer or an error containing the stop reason and optional safe diagnostic for a non-completed result. The diagnostic can distinguish the fixed error-info category, protocol stage, numeric HTTP status, and observed process outcome without copying product prose. A background call first returns a Job id; the generic job controls later deliver a completion notice, expose the same final answer or failed status detail through `job_output`, and let `job_kill` request cancellation. Codex commentary, reasoning, tool activity, raw stderr, workspace diffs, usage, product ids, commands, paths, and protocol payloads are not copied into the parent Session.
|
|
74
124
|
|
|
75
125
|
#### Token effect
|
|
76
126
|
|
|
77
|
-
|
|
127
|
+
Foreground input grows by the retained final answer or error. Background input also includes the start acknowledgement, completion notice, and any `job_output`, `job_kill`, or later status results; child tokens still do not enter the parent context. This provider adds no parent tool schema by itself.
|
|
78
128
|
|
|
79
129
|
#### KV Cache effect
|
|
80
130
|
|
|
81
|
-
Append-only:
|
|
131
|
+
Append-only: foreground adds one result after the reusable parent prefix, while background appends the Job acknowledgement, notice, and later control or collection results. Background scheduling can add a notice-driven turn, but none of these messages rewrites the earlier prefix.
|
|
82
132
|
|
|
83
133
|
## Known Limitations and Deferred Work
|
|
84
134
|
|
|
85
135
|
- **One fresh process, thread, and turn per run** — there is no continuation, resume, pooling, progress stream, or product-session persistence.
|
|
86
|
-
- **
|
|
136
|
+
- **Static instance selection** — Profile rows fix provider names and tool bindings; calls cannot choose a provider dynamically, and every exposed tool needs a unique `toolName`.
|
|
137
|
+
- **Authentication and account state remain native** — the Bundle supplies the CLI but does not create an account, log in, trust a project, or rewrite Codex settings; configuration and authentication failures surface with their lifecycle stage and the safe `unknown` fallback rather than a separate public taxonomy.
|
|
138
|
+
- **The native platform payload is required at delegation time** — installs that omit optional dependencies, unsupported platforms, and missing or damaged payloads fail at the first run; there is no host-CLI fallback.
|
|
87
139
|
- **Compatibility is pinned by development evidence** — upgrading from the verified 0.147.0 protocol baseline requires regenerating upstream schema evidence and rerunning handshake, answer-selection, approval, cancellation, keyless real-product, and credentialed DeepSeek nonce tests.
|
|
88
|
-
- **No human approval path** — known unattended approval requests are denied and unknown server requests fail closed;
|
|
89
|
-
- **
|
|
140
|
+
- **No human approval path** — known unattended approval requests are denied and unknown server requests fail closed; the three Profile modes never create a DSH interaction channel or per-call allow policy.
|
|
141
|
+
- **Assistant payload is final text only** — a failed run may additionally expose the separate safe diagnostic; reasoning, commentary, intermediate messages, tool traffic, usage, raw stderr, and workspace diffs remain outside the parent Session, while generic Job ids, notices, and status come from the shared job runtime.
|
|
90
142
|
- **No optional shared capabilities** — output schemas, child personas, tool filtering, and harness depth enforcement are rejected by the shared service for this provider.
|
|
91
143
|
- **No wall-clock timeout or side-effect rollback** — the caller cancels long work, and files or external systems changed before cancellation are not restored.
|
package/README.zh.md
CHANGED
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
本包注册由 Profile 命名、默认名称为 `codex` 的 Codex subagent 提供方。每次接受运行请求后,它都会在发起委托的会话工作区中使用 `app-server --stdio` 启动官方包内 Codex wrapper,创建一个临时 Codex 线程,提交一个自包含的文本任务,并通过共享的 [`dsh-subagent`](../subagent/README.md) 结果约定返回选定的最终答案或独立的安全失败诊断。
|
|
6
6
|
|
|
7
7
|
## 启动与所有权
|
|
8
8
|
|
|
9
|
-
`start(request)` 只接受非空的文本块序列,并根据父会话确定子级 cwd。随后,它通过 [`dsh-subprocess`](../../subprocess/subprocess/README.md) spawn 固定命令,依次执行 `initialize` → `initialized
|
|
9
|
+
`start(request)` 只接受非空的文本块序列,并根据父会话确定子级 cwd。随后,它通过 [`dsh-subprocess`](../../subprocess/subprocess/README.md) spawn 固定命令,依次执行 `initialize` → `initialized`,把 Profile 选择的模式映射为官方 `thread/start` approval/reviewer/sandbox 字段并与 `{ cwd, ephemeral: true }` 一起发送,且仅在 Codex 返回有效的临时线程后才发布此次运行。若在发布前发生失败或取消,它会关闭通信链路、终止受管进程树并等待其退出,然后拒绝 `start()` 调用。非取消拒绝只公开固定的 `initialize` 或 `thread-start` 阶段及已经观测到的进程结果;原始产品与 Host 错误只保留在内部 cause 链中。
|
|
10
10
|
|
|
11
11
|
已发布的 `run.result` 恰好启动一个轮次。它只接受与此次运行的线程和轮次匹配的通知,随后等待权威的终止通知 `turn/completed`。以最后一条 `phase: "final_answer"` 的 `agentMessage` 为准;若 Codex 没有发出明确的最终阶段,则以最后一条 `phase: null` 的消息作为兼容性回退。过程说明绝不会取代上述任一答案;成功完成的轮次若没有非空白答案,结果也会判为错误。
|
|
12
12
|
|
|
13
|
-
对于命令与文件审批,无人值守的提供方会从请求给出的决策选项中选择一项不予批准的决策,并优先选择 `cancel`;稳定的 0.147.0 请求形态没有决策选项列表,因此回退到 `decline`。它对权限请求返回作用域限于当前轮次的空权限集,不向用户输入请求提供任何答案,并拒绝 MCP elicitation。若请求在无人值守模式下没有合法响应,或是未知服务器请求,此次运行就会失败。
|
|
13
|
+
对于命令与文件审批,无人值守的提供方会从请求给出的决策选项中选择一项不予批准的决策,并优先选择 `cancel`;稳定的 0.147.0 请求形态没有决策选项列表,因此回退到 `decline`。它对权限请求返回作用域限于当前轮次的空权限集,不向用户输入请求提供任何答案,并拒绝 MCP elicitation。若请求在无人值守模式下没有合法响应,或是未知服务器请求,此次运行就会失败。wire 只记录有效模式、请求类别、决定与固定的安全原因,也会识别被拒绝的命令/文件 item 和 `sandboxError` 终态。Codex 0.147.0 的部分早期 `never` 拒绝和 sandbox violation 只写入结构化 stderr,因此提供方会 pipe stderr、原样转发给 Host,并在每次运行的有界尾缓冲中匹配两个固定签名;原始 stderr 不会进入诊断。
|
|
14
14
|
|
|
15
|
-
本地取消会在结果竞态中胜出并映射为 `aborted
|
|
15
|
+
本地取消会在结果竞态中胜出并映射为 `aborted`。对于失败轮次,诊断会保留 Codex 0.147.0 `codexErrorInfo` 联合中的全部十一种字符串与五种对象 variant;四种连接/stream variant 会在上游提供时保留数值 `httpStatusCode`,而 `activeTurnNotSteerable` 不公开 `turnKind`。诊断还会注明 `turn-start`、`turn` 或 `process`,分别包含可用的退出码与信号,并对无法识别或格式错误的值使用 `unknown`,且不复制原始字段。`contextWindowExceeded` 仍映射为 `max-tokens`;其他任何远端中断或失败仍映射为 `error`,且该提供方不会产生 `refusal`。参与失败的权限决定会跟在结构化失败行之后。成功与本地取消都不附带这两类事实。
|
|
16
|
+
|
|
17
|
+
`dispose()`(资源释放)具有幂等性:如果当前的两个标识符均已知,它会尽力请求 `turn/interrupt`,关闭 JSON-RPC 通信链路,结束标准输入,调用共享的进程树逐级终止机制,等待整棵进程树退出,并移除 stderr observer。独立清理拒绝使用固定的 `teardown` 阶段与可用进程结果。当启动与回滚同时失败时,顶层聚合消息会保留两条安全阶段说明,而原始失败仍只在内部可见。
|
|
16
18
|
|
|
17
19
|
## 能力与上下文
|
|
18
20
|
|
|
@@ -22,33 +24,81 @@
|
|
|
22
24
|
|
|
23
25
|
| 配置键 | 默认值 | 含义 |
|
|
24
26
|
|---|---|---|
|
|
27
|
+
| `providerName` | `codex` | `ctx.subagents` 中的非空注册名称;每个已挂载实例都需要唯一值。 |
|
|
25
28
|
| `env` | `{}` | 显式指定的子进程环境,叠加在由子进程 seam 清除凭证后的父环境之上。 |
|
|
29
|
+
| `permissionMode` | `never` | 为该提供方实例的每个线程固定原生非交互审批与沙箱模式。 |
|
|
26
30
|
| `disposeGraceMs` | `3000` | 共享进程树责任方各终止层级之间的宽限期,单位为毫秒且须为正有限值,并不得大于仓库共享的 [`MAX_TIMER_DELAY_MS`](../../util/timeout/README.md);随后资源释放会等待整棵进程树退出。 |
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
| `permissionMode` 值 | `thread/start` 字段 | 原生行为 |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `never` | `approvalPolicy: never`;省略 sandbox | 永不请求审批;执行失败会在原生 sandbox 下返回模型。 |
|
|
35
|
+
| `approve-for-me` | `approvalPolicy: on-request`、`approvalsReviewer: auto_review`、`sandbox: workspace-write` | 由 Codex 自动评审权限请求,不等待人工。 |
|
|
36
|
+
| `dangerously-bypass-approvals-and-sandbox` | `approvalPolicy: never`、`sandbox: danger-full-access` | 跳过审批与 sandbox;必须显式选择该值。 |
|
|
37
|
+
|
|
38
|
+
生产环境会解析锁定的 `@openai/codex@0.147.0` 依赖所声明的 `codex` bin,并使用当前 Node 可执行文件启动该 JavaScript wrapper。Wrapper 会选择匹配的原生平台载荷;提供方既不检查也不回退 `PATH` 中的宿主 `codex`。父会话 cwd、`HOME` 与 `CODEX_HOME` 继续让原生 Codex 配置和身份验证保持权威,而提供方只覆盖选定线程的 approval/reviewer/sandbox 字段。其他项目、模型、provider、MCP、hook、skill 与账户设置仍由原生机制负责。本插件不选择模型、不创建 `CODEX_HOME`、不执行登录,也不探测账户。子进程 seam 会先移除具有凭证特征的环境变量,再应用显式 `env` 覆盖。
|
|
39
|
+
|
|
40
|
+
本包是可选的 Profile Bundle。将它安装进目标 Profile 后重启该 Profile;安装会把官方 wrapper 与一个兼容的原生平台载荷带入该 Profile,而包所声明的 `cordis.patch.yml` 层只注册休眠的 `codex` Host provider,不会启动 Codex 进程。移除该包后,下一次 Profile 启动会撤回这一 provider 及其私有运行时闭包。
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
dsh plugin --profile <name> add @deepseek-ai/dsh-subagent-codex
|
|
44
|
+
dsh plugin --profile <name> remove @deepseek-ai/dsh-subagent-codex
|
|
45
|
+
dsh --profile <name>
|
|
46
|
+
```
|
|
29
47
|
|
|
30
|
-
|
|
48
|
+
安装决定 Host 可用性,而不是模型权限。Bundle 会提供休眠的默认 `codex` 配置项;Profile 可以替换该配置项的完整 config,也可以挂载更多具有不同 `providerName`、`permissionMode` 与 `env` 的配置项。加载实例本身不会在绑定工具调用前启动 Codex 进程。每个 `dsh-tool-subagent` 配置项指定一个提供方,并需要独立的 `toolName`,因此模型看到的是静态工具,而不是动态提供方选择器。完整 Agent Preset 携带对应的默认产品工具行并设置 `disabled: true`;复制一个 preset 后删除该字段,即可只向由该副本组装的 agent 暴露 `subagent_codex`。其 `one-shot` 策略会让省略 `run_in_background` 或传入 `false` 的调用继续在前台等待,而显式传入 `true` 会返回由父 agent 拥有的 Job ID,供 `job_output` 或 `job_kill` 使用。base host(基础宿主)与完整 preset 已提供通用作业注册表和控制工具。
|
|
49
|
+
|
|
50
|
+
下列独立组装展示完整的显式能力。基于 `@deepseek-ai/dsh-base` 的 Profile 保留已有 Job 配置项,新增产品提供方与工具配置项,而且不重复挂载 Job 服务。
|
|
31
51
|
|
|
32
52
|
```yaml
|
|
33
|
-
- id: subagent-codex
|
|
53
|
+
- id: subagent-codex-safe
|
|
54
|
+
name: '@deepseek-ai/dsh-subagent-codex'
|
|
55
|
+
config:
|
|
56
|
+
providerName: codex-safe
|
|
57
|
+
permissionMode: never
|
|
58
|
+
env:
|
|
59
|
+
OPENAI_API_KEY: !!js process.env.OPENAI_API_KEY
|
|
60
|
+
|
|
61
|
+
- id: subagent-codex-bypass
|
|
34
62
|
name: '@deepseek-ai/dsh-subagent-codex'
|
|
35
63
|
config:
|
|
64
|
+
providerName: codex-bypass
|
|
65
|
+
permissionMode: dangerously-bypass-approvals-and-sandbox
|
|
36
66
|
env:
|
|
37
67
|
OPENAI_API_KEY: !!js process.env.OPENAI_API_KEY
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
- id: jobs
|
|
72
|
+
name: '@deepseek-ai/dsh-jobs-local'
|
|
73
|
+
|
|
74
|
+
- id: tool-jobs
|
|
75
|
+
name: '@deepseek-ai/dsh-tool-jobs'
|
|
38
76
|
|
|
39
|
-
- id: tool-subagent-codex
|
|
77
|
+
- id: tool-subagent-codex-safe
|
|
40
78
|
name: '@deepseek-ai/dsh-tool-subagent'
|
|
41
79
|
disabled: true
|
|
42
80
|
config:
|
|
43
|
-
provider: codex
|
|
44
|
-
toolName:
|
|
45
|
-
|
|
81
|
+
provider: codex-safe
|
|
82
|
+
toolName: subagent_codex_safe
|
|
83
|
+
backgroundMode: one-shot
|
|
84
|
+
maxDepth: provider-managed
|
|
85
|
+
|
|
86
|
+
- id: tool-subagent-codex-bypass
|
|
87
|
+
name: '@deepseek-ai/dsh-tool-subagent'
|
|
88
|
+
config:
|
|
89
|
+
provider: codex-bypass
|
|
90
|
+
toolName: subagent_codex_bypass
|
|
91
|
+
backgroundMode: one-shot
|
|
46
92
|
maxDepth: provider-managed
|
|
47
93
|
```
|
|
48
94
|
|
|
49
95
|
## 产品兼容性与证据
|
|
50
96
|
|
|
51
|
-
生产环境的协议层有意只实现这一单次执行约定所需的 app-server
|
|
97
|
+
生产环境的协议层有意只实现这一单次执行约定所需的 app-server 方法。运行时依赖与六个 optional-dependency alias 均锁定到 `@openai/codex@0.147.0` / `codex-cli 0.147.0`。普通安装会按当前操作系统与 CPU 选择一个载荷。对于当前 darwin-arm64 载荷,`npm pack --dry-run --json @openai/codex@0.147.0-darwin-arm64` 报告压缩包为 111,199,052 字节、解包后为 274,777,843 字节。该包包含原生 `codex`、`codex-code-mode-host`、`rg` 与 `zsh` 资源;其他平台可能不同,这些数值只用于披露而不是安装阈值。
|
|
98
|
+
|
|
99
|
+
生成的 schema 证据与包测试会固定全部十六种 error-info variant、HTTP status 所在位置、六个生命周期阶段、进程结果、终止原因映射、unknown 回退、脱敏、权限顺序、取消、并发与清理聚合。无密钥真实产品测试会驱动包内 wrapper 连接回环 Responses fixture,并观测包内 argv、确切的 Bearer 密钥、原始任务、逐字节完全一致的最终回答、线程级 `never` 对环境中 `on-request` 的覆盖、自动评审启动、不产生文件副作用的无人值守拒绝、真实 `internalServerError`、测试拥有临时存储中的显式危险绕过写入、携带安全退出事实的进程/协议失败,以及 wrapper/原生进程完全停稳。同一层级还会证明两个命名实例保留彼此独立的环境与原生模式。
|
|
100
|
+
|
|
101
|
+
如果安装时省略 optional dependencies、当前平台不受支持,或所选载荷缺失,第一次委派会在 `initialize` 阶段以安全 `unknown` 类别和已观测到的进程结果失败。原始 wrapper 文本只保留在 Host stderr;提供方既不会探测宿主 CLI,也不会用它重试。独立 wrapper fixture 会另行证明原生载荷失败与不存在宿主回退。
|
|
52
102
|
|
|
53
103
|
## 模型体验
|
|
54
104
|
|
|
@@ -56,7 +106,7 @@
|
|
|
56
106
|
|
|
57
107
|
#### 模型看到的内容
|
|
58
108
|
|
|
59
|
-
Codex 子级会在一个全新的临时线程中,以单个轮次接收这些独立文本块。它的工作区是父会话 cwd
|
|
109
|
+
Codex 子级会在一个全新的临时线程中,以单个轮次接收这些独立文本块。它的工作区是父会话 cwd;其模型、系统指令、工具和身份验证来自原生 Codex 配置,所选提供方实例的 Profile 配置会固定该线程的环境、非交互审批策略与沙箱模式,而可执行版本来自 Bundle 锁定的平台载荷。
|
|
60
110
|
|
|
61
111
|
#### 对 token 的影响
|
|
62
112
|
|
|
@@ -66,26 +116,28 @@ Codex 子级会在一个全新的临时线程中,以单个轮次接收这些
|
|
|
66
116
|
|
|
67
117
|
这与父请求缓存相互独立。能否复用只取决于 Codex 自身的提供方、模型、指令、工具和临时线程请求。
|
|
68
118
|
|
|
69
|
-
###
|
|
119
|
+
### 父级调度与结果(间接)
|
|
70
120
|
|
|
71
121
|
#### 模型看到的内容
|
|
72
122
|
|
|
73
|
-
通过 `dsh-tool-subagent
|
|
123
|
+
通过 `dsh-tool-subagent`,前台调用会让父级模型看到选定的 Codex 最终答案;若结果未完成,错误中会包含终止原因和可选的安全诊断。该诊断可以区分固定 error-info 类别、协议阶段、数值 HTTP status 和已观测的进程结果,而不复制产品正文。后台调用会先返回 Job id;随后通用作业控制面会送达完成通知,通过 `job_output` 公开同一最终答案或失败状态 detail,并允许 `job_kill` 请求取消。Codex 的过程说明、推理(reasoning)、工具活动、原始 stderr、工作区差异、用量信息、产品标识符、命令、路径和协议载荷均不会复制到父会话。
|
|
74
124
|
|
|
75
125
|
#### 对 token 的影响
|
|
76
126
|
|
|
77
|
-
|
|
127
|
+
前台输入会增加工具结果中保留的最终答案或错误内容。后台输入还会包含启动确认、完成通知,以及 `job_output`、`job_kill` 或后续状态结果;子任务 token 仍不会进入父级上下文。本提供方自身不添加父级工具 schema。
|
|
78
128
|
|
|
79
129
|
#### 对 KV Cache 的影响
|
|
80
130
|
|
|
81
|
-
|
|
131
|
+
仅追加:前台会在可复用的父请求前缀后增加一个结果,后台则会继续追加 Job 启动确认、通知以及后续控制或收集结果。后台调度可能增加一个由通知唤醒的轮次,但这些消息都不会改写更早的前缀。
|
|
82
132
|
|
|
83
133
|
## 已知限制与后续工作
|
|
84
134
|
|
|
85
135
|
- **每次运行均新建一个进程、一个线程和一个轮次**:不支持续接、恢复、池化、进度流或产品会话持久化。
|
|
86
|
-
-
|
|
136
|
+
- **静态选择实例**:Profile 配置项固定提供方名称与工具绑定;调用无法动态选择提供方,而且每个公开工具都需要唯一的 `toolName`。
|
|
137
|
+
- **身份验证与账户状态仍由原生机制管理**:Bundle 会提供 CLI,但不会创建账户、登录、信任项目或改写 Codex 设置;配置与身份验证失败会公开其生命周期阶段与安全的 `unknown` 回退,而不会增加单独的公开分类体系。
|
|
138
|
+
- **委派时必须存在原生平台载荷**:省略 optional dependencies 的安装、不受支持的平台以及缺失或损坏的载荷都会在第一次运行时失败;不会回退到宿主 CLI。
|
|
87
139
|
- **兼容性由开发证据锁定**:若要从已验证的 0.147.0 协议基线升级,必须重新生成上游 schema 证据,并重新运行握手、答案选择、审批、取消、无密钥真实产品以及带密钥的 DeepSeek 随机数测试。
|
|
88
|
-
-
|
|
89
|
-
-
|
|
140
|
+
- **没有人工审批路径**:已知的无人值守审批请求会被拒绝,未知服务器请求会以默认拒绝方式使运行失败;三种 Profile 模式都不会创建 DSH 交互通道或逐次调用 allow 策略。
|
|
141
|
+
- **assistant 载荷仅包含最终文本**:失败运行可以额外公开独立的安全诊断;推理、过程说明、中间消息、工具通信、用量信息、原始 stderr 和工作区差异不会进入父会话,通用 Job id、通知与状态来自共享作业运行时。
|
|
90
142
|
- **没有可选的共享能力**:对于本提供方,共享服务会拒绝输出 schema、子任务角色设定、工具筛选和 harness 深度强制约束。
|
|
91
143
|
- **没有按实际经过时间触发的超时或副作用回滚**:长时间运行的工作由调用方取消,且取消前已更改的文件或外部系统不会恢复原状。
|