@ckanner/flywheel 0.32.1 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +7 -0
  3. package/README.zh-CN.md +5 -0
  4. package/THIRD_PARTY_NOTICES.md +42 -0
  5. package/bin/runtime.js +25 -31
  6. package/cordis.patch.yml +5 -0
  7. package/dist/bridge.mjs +421 -0
  8. package/dist/claude-code-pro-bridge.mjs +82 -0
  9. package/dist/claude-code-pro-worker.mjs +5 -0
  10. package/dist/client.js +4078 -0
  11. package/dist/codex-pro-bridge.mjs +75 -0
  12. package/dist/codex-pro-worker.mjs +5 -0
  13. package/dist/console-read.mjs +51 -0
  14. package/dist/control.mjs +218 -0
  15. package/dist/index.mjs +185 -0
  16. package/dist/installation.mjs +56 -0
  17. package/dist/machine-worker.mjs +241 -0
  18. package/dist/policy.mjs +91 -0
  19. package/dist/prewarm.mjs +136 -0
  20. package/dist/protocol.mjs +260 -0
  21. package/dist/task-association.mjs +127 -0
  22. package/dist/worker.mjs +52 -0
  23. package/dist/workspaces.mjs +42 -0
  24. package/docs/README.md +1 -1
  25. package/docs/README.zh-CN.md +1 -1
  26. package/docs/design.md +7 -4
  27. package/docs/en/configuration.md +1 -1
  28. package/docs/en/contributing.md +5 -6
  29. package/docs/en/flow-console.md +1 -1
  30. package/docs/en/getting-started.md +9 -2
  31. package/docs/en/releasing.md +132 -174
  32. package/docs/validation/2026-11-13-release-0.32.1.md +83 -0
  33. package/docs/validation/2026-11-14-single-package.md +60 -0
  34. package/docs/validation/README.md +2 -0
  35. package/docs/zh-CN/configuration.md +1 -1
  36. package/docs/zh-CN/contributing.md +4 -5
  37. package/docs/zh-CN/flow-console.md +1 -1
  38. package/docs/zh-CN/getting-started.md +7 -3
  39. package/docs/zh-CN/releasing.md +97 -81
  40. package/native/darwin-amd64/flywheel +0 -0
  41. package/native/darwin-arm64/flywheel +0 -0
  42. package/native/linux-amd64/flywheel +0 -0
  43. package/native/linux-arm64/flywheel +0 -0
  44. package/native/manifest.json +22 -0
  45. package/node_modules/dsh-subagent-codex-pro/CHANGELOG.md +403 -0
  46. package/node_modules/dsh-subagent-codex-pro/LICENSE +21 -0
  47. package/node_modules/dsh-subagent-codex-pro/README.md +557 -0
  48. package/node_modules/dsh-subagent-codex-pro/cordis.patch.yml +30 -0
  49. package/node_modules/dsh-subagent-codex-pro/docs/README.zh.md +355 -0
  50. package/node_modules/dsh-subagent-codex-pro/docs/machine-lifecycle-validation.md +65 -0
  51. package/node_modules/dsh-subagent-codex-pro/docs/machine-lifecycle.md +144 -0
  52. package/node_modules/dsh-subagent-codex-pro/docs/machine-lifecycle.zh.md +98 -0
  53. package/node_modules/dsh-subagent-codex-pro/docs/machine.md +194 -0
  54. package/node_modules/dsh-subagent-codex-pro/docs/orchestration.zh.md +86 -0
  55. package/node_modules/dsh-subagent-codex-pro/lib/codex-exec.js +68 -0
  56. package/node_modules/dsh-subagent-codex-pro/lib/codex-exec.js.map +1 -0
  57. package/node_modules/dsh-subagent-codex-pro/lib/dsh-types.js +15 -0
  58. package/node_modules/dsh-subagent-codex-pro/lib/dsh-types.js.map +1 -0
  59. package/node_modules/dsh-subagent-codex-pro/lib/index.js +830 -0
  60. package/node_modules/dsh-subagent-codex-pro/lib/index.js.map +1 -0
  61. package/node_modules/dsh-subagent-codex-pro/lib/jobs.js +35 -0
  62. package/node_modules/dsh-subagent-codex-pro/lib/jobs.js.map +1 -0
  63. package/node_modules/dsh-subagent-codex-pro/lib/jsonrpc.js +229 -0
  64. package/node_modules/dsh-subagent-codex-pro/lib/jsonrpc.js.map +1 -0
  65. package/node_modules/dsh-subagent-codex-pro/lib/machine-cli.js +101 -0
  66. package/node_modules/dsh-subagent-codex-pro/lib/machine-cli.js.map +1 -0
  67. package/node_modules/dsh-subagent-codex-pro/lib/machine-local.js +122 -0
  68. package/node_modules/dsh-subagent-codex-pro/lib/machine-local.js.map +1 -0
  69. package/node_modules/dsh-subagent-codex-pro/lib/machine-recovery.js +167 -0
  70. package/node_modules/dsh-subagent-codex-pro/lib/machine-recovery.js.map +1 -0
  71. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervision.js +141 -0
  72. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervision.js.map +1 -0
  73. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervisor.js +128 -0
  74. package/node_modules/dsh-subagent-codex-pro/lib/machine-supervisor.js.map +1 -0
  75. package/node_modules/dsh-subagent-codex-pro/lib/machine.js +104 -0
  76. package/node_modules/dsh-subagent-codex-pro/lib/machine.js.map +1 -0
  77. package/node_modules/dsh-subagent-codex-pro/lib/process-guardian.js +156 -0
  78. package/node_modules/dsh-subagent-codex-pro/lib/process-guardian.js.map +1 -0
  79. package/node_modules/dsh-subagent-codex-pro/lib/run.js +842 -0
  80. package/node_modules/dsh-subagent-codex-pro/lib/run.js.map +1 -0
  81. package/node_modules/dsh-subagent-codex-pro/lib/structured.js +329 -0
  82. package/node_modules/dsh-subagent-codex-pro/lib/structured.js.map +1 -0
  83. package/node_modules/dsh-subagent-codex-pro/lib/tool.js +295 -0
  84. package/node_modules/dsh-subagent-codex-pro/lib/tool.js.map +1 -0
  85. package/node_modules/dsh-subagent-codex-pro/lib/types/codex-exec.d.ts +88 -0
  86. package/node_modules/dsh-subagent-codex-pro/lib/types/codex-exec.d.ts.map +1 -0
  87. package/node_modules/dsh-subagent-codex-pro/lib/types/dsh-types.d.ts +179 -0
  88. package/node_modules/dsh-subagent-codex-pro/lib/types/dsh-types.d.ts.map +1 -0
  89. package/node_modules/dsh-subagent-codex-pro/lib/types/index.d.ts +266 -0
  90. package/node_modules/dsh-subagent-codex-pro/lib/types/index.d.ts.map +1 -0
  91. package/node_modules/dsh-subagent-codex-pro/lib/types/jobs.d.ts +34 -0
  92. package/node_modules/dsh-subagent-codex-pro/lib/types/jobs.d.ts.map +1 -0
  93. package/node_modules/dsh-subagent-codex-pro/lib/types/jsonrpc.d.ts +113 -0
  94. package/node_modules/dsh-subagent-codex-pro/lib/types/jsonrpc.d.ts.map +1 -0
  95. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-cli.d.ts +3 -0
  96. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-cli.d.ts.map +1 -0
  97. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-local.d.ts +4 -0
  98. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-local.d.ts.map +1 -0
  99. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-recovery.d.ts +53 -0
  100. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-recovery.d.ts.map +1 -0
  101. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-supervision.d.ts +8 -0
  102. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-supervision.d.ts.map +1 -0
  103. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-supervisor.d.ts +2 -0
  104. package/node_modules/dsh-subagent-codex-pro/lib/types/machine-supervisor.d.ts.map +1 -0
  105. package/node_modules/dsh-subagent-codex-pro/lib/types/machine.d.ts +70 -0
  106. package/node_modules/dsh-subagent-codex-pro/lib/types/machine.d.ts.map +1 -0
  107. package/node_modules/dsh-subagent-codex-pro/lib/types/process-guardian.d.ts +22 -0
  108. package/node_modules/dsh-subagent-codex-pro/lib/types/process-guardian.d.ts.map +1 -0
  109. package/node_modules/dsh-subagent-codex-pro/lib/types/run.d.ts +386 -0
  110. package/node_modules/dsh-subagent-codex-pro/lib/types/run.d.ts.map +1 -0
  111. package/node_modules/dsh-subagent-codex-pro/lib/types/structured.d.ts +35 -0
  112. package/node_modules/dsh-subagent-codex-pro/lib/types/structured.d.ts.map +1 -0
  113. package/node_modules/dsh-subagent-codex-pro/lib/types/tool.d.ts +107 -0
  114. package/node_modules/dsh-subagent-codex-pro/lib/types/tool.d.ts.map +1 -0
  115. package/node_modules/dsh-subagent-codex-pro/lib/types/usage.d.ts +131 -0
  116. package/node_modules/dsh-subagent-codex-pro/lib/types/usage.d.ts.map +1 -0
  117. package/node_modules/dsh-subagent-codex-pro/lib/types/wire.d.ts +321 -0
  118. package/node_modules/dsh-subagent-codex-pro/lib/types/wire.d.ts.map +1 -0
  119. package/node_modules/dsh-subagent-codex-pro/lib/usage.js +356 -0
  120. package/node_modules/dsh-subagent-codex-pro/lib/usage.js.map +1 -0
  121. package/node_modules/dsh-subagent-codex-pro/lib/wire.js +986 -0
  122. package/node_modules/dsh-subagent-codex-pro/lib/wire.js.map +1 -0
  123. package/node_modules/dsh-subagent-codex-pro/package.json +76 -0
  124. package/npm/install.js +59 -6
  125. package/package.json +74 -12
  126. package/plugins/dsh/LICENSE +21 -0
  127. package/plugins/dsh/PROTOCOL.md +607 -0
  128. package/plugins/dsh/README.en.md +4 -0
  129. package/plugins/dsh/README.md +342 -0
  130. package/plugins/dsh/README.zh-CN.md +279 -0
  131. package/plugins/dsh/THIRD_PARTY_NOTICES.md +42 -0
  132. package/plugins/dsh/vendor/README.md +17 -0
  133. package/plugins/dsh/vendor/codex-pro.json +16 -0
@@ -0,0 +1,266 @@
1
+ /**
2
+ * A Codex delegation that can carry a model and a reasoning effort.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * `@deepseek-ai/dsh-subagent-codex` declares `NO_START_CAPABILITIES`, so its
7
+ * `tool-subagent` row cannot enable `modelSelectionSettings` — that requires a
8
+ * provider declaring `agentOptions`, which the Codex provider does not. The
9
+ * Codex protocol supports the choices this package exposes: `model` on
10
+ * `thread/start`, per-turn `effort` on `turn/start`, and model/cwd/permission
11
+ * overrides on `thread/resume` (0.165+). The official adapter sends none of
12
+ * them; a thinking level is not a `thread/start` field in 0.165/0.166.
13
+ *
14
+ * Enabling the flag on a Codex row of our own provider was tried and did not
15
+ * work: the row vanished with no tool and no error, while a control row — same
16
+ * provider, same row, flag off — registered fine. That defect belongs to the
17
+ * flag, not to the provider, and is reported upstream.
18
+ *
19
+ * ## What this does instead
20
+ *
21
+ * Two things, both under this package's control:
22
+ *
23
+ * 1. **Execution** is a port of the official app-server adapter (`wire.ts`,
24
+ * `run.ts`), with `model` on `thread/start`, `effort` on `turn/start`, and
25
+ * explicit model/cwd/permission overrides plus effective-config verification
26
+ * on `thread/resume`. That is the same protocol the official provider speaks,
27
+ * including its initialize handshake, ephemeral thread, unattended approval
28
+ * decisions, and terminal-answer selection.
29
+ * 2. **The tool** is registered on `agent/created` into that Agent's own context
30
+ * — the path `dsh-plugin-lcu` uses — so the harness's preset-row machinery
31
+ * stays out of the way. `presets` names the presets that get it.
32
+ *
33
+ * `model` and `reasoning_effort` appear while this plugin's independent
34
+ * modelSelection setting is enabled. Codex model ids are not DSH LLM routes.
35
+ *
36
+ * @module dsh-subagent-codex-pro
37
+ */
38
+ import type { Context, SubagentProviderLike, SubagentRunLike, SubagentStartRequestLike } from './dsh-types.ts';
39
+ import type { CodexPermissionMode } from './wire.ts';
40
+ /** Cordis plugin name. */
41
+ export declare const name = "codex-pro";
42
+ /**
43
+ * The services this plugin cannot work without.
44
+ *
45
+ * `subagents` is the provider registry. Everything else — the Agent registry,
46
+ * the preset registry, the host opt-in — is looked up with `ctx.get`, so a
47
+ * deployment missing one degrades instead of failing to load.
48
+ */
49
+ export declare const inject: string[];
50
+ /** Plugin configuration. */
51
+ export interface Config {
52
+ /** Provider name to register under. Must differ from the official `codex`. */
53
+ providerName?: string;
54
+ /** Codex executable; the app-server is started as `<command> app-server --stdio`. */
55
+ command?: string;
56
+ /** Default model when a call does not name one. */
57
+ model?: string;
58
+ /** Default reasoning effort when a call does not name one. */
59
+ reasoningEffort?: string;
60
+ /**
61
+ * Whether an Agent may name a model and a thinking level for a delegation.
62
+ *
63
+ * This plugin's own control, deliberately independent of the Host's
64
+ * `subagent-model-selection` setting. That setting authorizes a child **LLM
65
+ * route** chosen from the DSH model catalog and billed as tokens; a Codex
66
+ * delegation names a **Codex model id** governed by the Codex CLI's own
67
+ * subscription. The two are different resources with different namespaces, so
68
+ * the Host's list can neither authorize nor constrain this choice — reading it
69
+ * would only couple this tool to a setting that has nothing to say about it.
70
+ *
71
+ * Defaults to true: being able to name the model is the point of this package.
72
+ */
73
+ modelSelection?: boolean;
74
+ /** Unattended permission policy for the child thread. */
75
+ permissionMode?: CodexPermissionMode;
76
+ /** Extra environment entries for the child. */
77
+ env?: Record<string, string>;
78
+ /** Agent preset ids whose sessions receive the delegation tool. */
79
+ presets?: string[];
80
+ /**
81
+ * How long a delegated Codex thread lives.
82
+ *
83
+ * - `ephemeral` (the default) is a throwaway run: nothing is written that the
84
+ * Codex CLI or the Codex application can list afterwards.
85
+ * - `persistent` gives every delegation its own durable thread, which the Codex
86
+ * CLI and application list under the session's working directory and
87
+ * `thread_id` can continue.
88
+ * - `session` reuses one durable thread for the whole Agent session, so a
89
+ * session that delegates ten times leaves one thread rather than ten, and
90
+ * after the first delegation each call continues the same conversation —
91
+ * which keeps the prompt prefix stable and lets the model's cache do its
92
+ * work. A call may still override either choice, and pass `thread_id` to
93
+ * continue a thread of its own.
94
+ */
95
+ threadMode?: 'ephemeral' | 'persistent' | 'session';
96
+ /**
97
+ * Deadline for one delegation in milliseconds; `0` disables it.
98
+ *
99
+ * A delegation that hangs is otherwise invisible: the job stays `running`, the
100
+ * session waits, and nothing is logged. The deadline turns that into a failure
101
+ * with a reason. Defaults to ten minutes, which is generous against a task
102
+ * class whose own documentation says "a minute or more".
103
+ */
104
+ runTimeoutMs?: number;
105
+ /**
106
+ * What the app-server records as the thread's originator.
107
+ *
108
+ * This is what decides whether the Codex desktop application lists a thread:
109
+ * that client filters its list to the single value `Codex Desktop`, so the
110
+ * default here is that literal. Overriding it trades desktop visibility for an
111
+ * honest name — a thread the application will not show is still listed by the
112
+ * Codex CLI and still resumable.
113
+ */
114
+ originator?: string;
115
+ }
116
+ /**
117
+ * Check a caller-named deadline.
118
+ *
119
+ * A duration, so it must be a whole number of milliseconds: negative and
120
+ * fractional values have no meaning, and silently rounding one would give a
121
+ * caller a deadline it did not ask for. `0` is allowed and means no deadline,
122
+ * which is what the plugin's own configuration uses to disable it.
123
+ *
124
+ * @param value - the deadline a call named.
125
+ * @returns the deadline, unchanged.
126
+ * @throws when it is not a whole non-negative number of milliseconds.
127
+ */
128
+ export declare function checkedTimeout(value: number): number;
129
+ /**
130
+ * Check a caller-named output schema's shape.
131
+ *
132
+ * The harness applies the same rule to a schema it passes a provider —
133
+ * `assertObjectJsonSchema` — so matching it means a schema this tool accepts is
134
+ * one the harness would too. Only the root is checked: it must be an object with
135
+ * `type: "object"`, because Codex constrains a whole answer and a bare array or
136
+ * scalar has nowhere to put the shape.
137
+ *
138
+ * @param value - the schema a call named.
139
+ * @returns the schema, unchanged.
140
+ * @throws when it is not an object-rooted JSON Schema.
141
+ */
142
+ export declare function checkedOutputSchema(value: unknown): Record<string, unknown>;
143
+ /**
144
+ * Check one caller-named image path.
145
+ *
146
+ * The path must be absolute and must name a file this plugin could hand the
147
+ * app-server. Whether it exists is checked where the run is prepared, next to
148
+ * the check for the working directory, because that is where a real path is.
149
+ *
150
+ * @param requested - the path a call named.
151
+ * @returns the path, unchanged.
152
+ * @throws when it is not an absolute path.
153
+ */
154
+ export declare function checkedImagePath(requested: string): string;
155
+ /**
156
+ * Check a caller-named working directory's shape.
157
+ *
158
+ * Only the shape is checked — absolute and non-empty — so the rule is testable
159
+ * without a filesystem. Whether the path exists and is a directory is checked
160
+ * where the run is prepared, because that is where a real path matters.
161
+ *
162
+ * @param requested - the path a call named.
163
+ * @returns the path, unchanged.
164
+ * @throws when it is not an absolute path.
165
+ */
166
+ export declare function checkedWorkdir(requested: string): string;
167
+ /**
168
+ * Whether a model route's declared modalities refuse images.
169
+ *
170
+ * This is the harness's own rule, and matching it exactly is the point: an image
171
+ * is refused only when the route **declares** input modalities and `image` is not
172
+ * among them. An undeclared route is left to the harness, which rejects an
173
+ * attachment for a model that cannot read it anyway.
174
+ *
175
+ * Being stricter cost a real screenshot. The default `deepseek-flash` entry
176
+ * declares `['text', 'image']`, and an earlier guard here failed closed whenever
177
+ * the route could not be resolved — which turned every image into a text note in
178
+ * a session that could have displayed it.
179
+ *
180
+ * @param info - the resolved model route, when it could be resolved.
181
+ * @returns whether the route says it cannot take images.
182
+ */
183
+ export declare function routeRefusesImages(info: {
184
+ readonly inputModalities?: readonly string[];
185
+ } | undefined): boolean;
186
+ /**
187
+ * A line naming where each image is, appended to the text.
188
+ *
189
+ * A foreground call carries the pictures as blocks, but a background call's
190
+ * result is a string by contract — its reader sees this text and nothing else. So
191
+ * the paths go in the text as well: a screenshot a background delegation took is
192
+ * still a file on this host, and naming it is the difference between the work
193
+ * being usable and being lost.
194
+ *
195
+ * @param text - the delegation's answer.
196
+ * @param images - the images the run produced.
197
+ * @returns the answer with the image line appended.
198
+ */
199
+ export declare function withImageNote(text: string, images: readonly {
200
+ readonly path?: string;
201
+ }[]): string;
202
+ /** Tool calls may narrow their configured policy, never expand it implicitly. */
203
+ export declare function resolvePermissionOverride(configured: CodexPermissionMode, requested: CodexPermissionMode | undefined): CodexPermissionMode;
204
+ /**
205
+ * One delegation to Codex, exposed as a provider the harness can start.
206
+ *
207
+ * Exported so the provider adapter can be exercised against the same fake
208
+ * app-server as the tool path; the plugin's `apply` is its only production
209
+ * constructor.
210
+ */
211
+ export declare class CodexExecProvider implements SubagentProviderLike {
212
+ readonly name: string;
213
+ readonly inheritsParentContext = false;
214
+ /**
215
+ * The declaration that unlocks the delegation tool's model surface.
216
+ *
217
+ * `agentOptions: true` is what `tool-subagent` checks before accepting either a
218
+ * configured `agentOptions` or `modelSelectionSettings: true` on its row.
219
+ */
220
+ readonly capabilities: {
221
+ readonly agentOptions: true;
222
+ readonly agentPreset: false;
223
+ readonly outputSchema: true;
224
+ readonly depthLimit: false;
225
+ };
226
+ /**
227
+ * The resolved configuration.
228
+ *
229
+ * A plain field rather than a constructor parameter property: Node's
230
+ * type-stripping mode rejects that syntax outright, which made this module
231
+ * unimportable from a test and left its pure helpers untestable.
232
+ */
233
+ readonly resolved: Required<Pick<Config, 'command' | 'providerName' | 'permissionMode'>> & Config;
234
+ constructor(resolved: Required<Pick<Config, 'command' | 'providerName' | 'permissionMode'>> & Config);
235
+ /**
236
+ * Start one Codex run over the app-server protocol.
237
+ *
238
+ * @param request - the delegation the harness resolved.
239
+ * @returns a run handle; its `result` settles with the child's final message.
240
+ */
241
+ start(request: SubagentStartRequestLike): Promise<SubagentRunLike>;
242
+ }
243
+ /**
244
+ * Register the provider and the delegation tool.
245
+ *
246
+ * @param ctx - context carrying the subagent registry.
247
+ * @param config - provider name, defaults, and the presets to serve.
248
+ */
249
+ export declare function apply(ctx: Context, config?: Config): void;
250
+ /**
251
+ * Append the thread marker to a human-text delegation result.
252
+ *
253
+ * A machine-readable answer (one carrying `output_schema`) must stay valid JSON:
254
+ * appending a marker would make the whole result unparseable. Such a run keeps
255
+ * its thread id in the result envelope/diagnostic log instead of in the text.
256
+ *
257
+ * @param outcome - the finished run.
258
+ * @param mode - the thread mode the run used.
259
+ * @param machineOutput - whether the answer is schema-constrained JSON.
260
+ * @returns the text to report.
261
+ */
262
+ export declare function withThreadMarker(outcome: {
263
+ readonly text: string;
264
+ readonly threadId: string | undefined;
265
+ }, mode: 'ephemeral' | 'persistent', machineOutput: boolean): string;
266
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAOH,OAAO,KAAK,EAEV,OAAO,EAEP,oBAAoB,EACpB,eAAe,EACf,wBAAwB,EACzB,MAAM,gBAAgB,CAAA;AAKvB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAEpD,0BAA0B;AAC1B,eAAO,MAAM,IAAI,cAAc,CAAA;AAE/B;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,UAAgB,CAAA;AAEnC,4BAA4B;AAC5B,MAAM,WAAW,MAAM;IACrB,8EAA8E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giving: a producer's `done` must
5
+ * resolve to a `JobOutcome` — `{ status, detail?, result? }` — and it must never
6
+ * reject. Returning the delegation's text directly leaves a bare string where the
7
+ * registry expects that record, which then fails validation on *every* read of
8
+ * the job, so `job_output` **and** `job_list` both report "value is not lossless
9
+ * JSON" and the model can never collect its own result.
10
+ *
11
+ * @module dsh-subagent-codex-pro/jobs
12
+ */
13
+ /** The settlement record a producer's `done` must resolve to. */
14
+ export interface JobOutcomeLike {
15
+ readonly status: 'completed' | 'killed' | 'failed';
16
+ readonly detail?: string;
17
+ /** The delegation's final message, handed out once by the model's next read. */
18
+ readonly result?: string;
19
+ }
20
+ /**
21
+ * Wrap one delegation as a job outcome.
22
+ *
23
+ * Never rejects: the contract requires a settlement record even when the work
24
+ * failed, so a rejection becomes `status: 'failed'` with the reason in `detail`.
25
+ *
26
+ * @param delegation - the running delegation's promise, already carrying the
27
+ * thread marker the runner appended.
28
+ * @returns the outcome record the jobs registry accepts.
29
+ */
30
+ export declare function settleJob(delegation: Promise<{
31
+ readonly text: string;
32
+ readonly threadId: string | undefined;
33
+ }>): Promise<JobOutcomeLike>;
34
+ //# sourceMappingURL=jobs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../src/jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAA;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,OAAO,CAAC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC,GACpF,OAAO,CAAC,cAAc,CAAC,CAUzB"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Newline-delimited JSON-RPC 2.0 over a child process's stdio.
3
+ *
4
+ * The official Codex provider gets this from
5
+ * `@deepseek-ai/dsh-sdk-protocol`'s `JsonRpcLineTransport`. This plugin keeps
6
+ * zero runtime dependencies, so the transport lives here — and it is a small,
7
+ * well-understood piece: frame by line, correlate by id, surface every failure
8
+ * instead of leaving a caller pending forever.
9
+ *
10
+ * Framing: one JSON object per line, `\n`-terminated, on both directions. A
11
+ * partial line is buffered; a malformed line is reported and skipped, because a
12
+ * protocol peer that emits one bad frame should not take the session down.
13
+ *
14
+ * @module dsh-subagent-codex-pro/jsonrpc
15
+ */
16
+ /** One decoded JSON-RPC message. */
17
+ export interface JsonRpcMessage {
18
+ readonly jsonrpc?: string;
19
+ readonly id?: number | string;
20
+ readonly method?: string;
21
+ readonly params?: unknown;
22
+ readonly result?: unknown;
23
+ readonly error?: {
24
+ readonly code?: number;
25
+ readonly message?: string;
26
+ readonly data?: unknown;
27
+ };
28
+ }
29
+ /** What the owner does with messages that are not responses. */
30
+ export interface TransportHooks {
31
+ /**
32
+ * Handle a request from the peer. The resolved value becomes its `result`; a
33
+ * throw becomes its `error`.
34
+ *
35
+ * @param method - the JSON-RPC method.
36
+ * @param params - its params.
37
+ * @returns the result to send back.
38
+ */
39
+ onRequest?(method: string, params: unknown): Promise<unknown> | unknown;
40
+ /**
41
+ * Handle a notification.
42
+ *
43
+ * @param method - the JSON-RPC method.
44
+ * @param params - its params.
45
+ */
46
+ onNotification?(method: string, params: unknown): void;
47
+ /**
48
+ * Report a transport-level failure (bad frame, write error).
49
+ *
50
+ * @param error - what went wrong.
51
+ */
52
+ onProblem?(error: Error): void;
53
+ }
54
+ /** The writable side of a transport. */
55
+ export interface TransportWritable {
56
+ write(chunk: string): unknown;
57
+ }
58
+ /** The readable side of a transport. */
59
+ export interface TransportReadable {
60
+ on(event: 'data', listener: (chunk: Buffer | string) => void): unknown;
61
+ }
62
+ /** A JSON-RPC peer speaking one object per line. */
63
+ export declare class LineTransport {
64
+ #private;
65
+ constructor(toPeer: TransportWritable, fromPeer: TransportReadable, hooks?: TransportHooks);
66
+ /**
67
+ * Replace the message hooks.
68
+ *
69
+ * The wire installs its handlers after construction, which keeps the transport
70
+ * independent of the product methods layered on top of it.
71
+ *
72
+ * @param hooks - the handlers to install.
73
+ */
74
+ setHooks(hooks: TransportHooks): void;
75
+ /**
76
+ * Wait until everything written so far has left this process.
77
+ *
78
+ * Writes go to the peer's stream synchronously, so there is nothing to drain;
79
+ * the method exists because the protocol's handshake uses it as an explicit
80
+ * write barrier between `initialized` and `thread/start`.
81
+ *
82
+ * @returns a promise that is already settled.
83
+ */
84
+ flush(): Promise<void>;
85
+ /**
86
+ * Send one request and await its response.
87
+ *
88
+ * @param method - the JSON-RPC method.
89
+ * @param params - its params.
90
+ * @param options - optional caller cancellation and a response deadline.
91
+ * @returns the peer's `result`.
92
+ */
93
+ request(method: string, params: unknown, options?: {
94
+ signal?: AbortSignal | undefined;
95
+ timeoutMs?: number | undefined;
96
+ }): Promise<unknown>;
97
+ /**
98
+ * Send one notification; nothing is awaited.
99
+ *
100
+ * @param method - the JSON-RPC method.
101
+ * @param params - its params.
102
+ */
103
+ notify(method: string, params?: unknown): void;
104
+ /**
105
+ * Fail every in-flight request and stop reading.
106
+ *
107
+ * @param reason - why the transport is going away.
108
+ */
109
+ dispose(reason?: Error): void;
110
+ /** How many requests are still awaiting a response. */
111
+ get pendingCount(): number;
112
+ }
113
+ //# sourceMappingURL=jsonrpc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonrpc.d.ts","sourceRoot":"","sources":["../../src/jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oCAAoC;AACpC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ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IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA8C9I;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAK9C;;;;OAIG;IACH,OAAO,CAAC,MAAM,QAA2C,GAAG,IAAI;IAUhE,uDAAuD;IACvD,IAAI,YAAY,IAAI,MAAM,CAEzB;CAmEF"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=machine-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-cli.d.ts","sourceRoot":"","sources":["../../src/machine-cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { type MachineRequest, type MachineOptions, type MachineReceipt } from './machine.ts';
2
+ /** Private supervisor entry; callers use runMachine so caller death cannot lose cleanup persistence. */
3
+ export declare function runMachineLocal(value: MachineRequest, options?: MachineOptions, id?: string, persistReceipt?: (receipt: MachineReceipt) => void): Promise<MachineReceipt>;
4
+ //# sourceMappingURL=machine-local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-local.d.ts","sourceRoot":"","sources":["../../src/machine-local.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAoBjH,wGAAwG;AACxG,wBAAsB,eAAe,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,GAAE,cAAmB,EAAE,EAAE,GAAE,MAAqB,EAClH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,cAAc,CAAC,CAyF7E"}
@@ -0,0 +1,53 @@
1
+ import type { MachineReceipt } from './machine.ts';
2
+ export declare const MACHINE_LIFECYCLE_VERSION: 1;
3
+ export declare const MACHINE_LIFECYCLE_CAPABILITIES: Readonly<{
4
+ version: 1;
5
+ durableJournal: true;
6
+ readOnlyRecovery: true;
7
+ threadReadyBeforeDispatch: true;
8
+ }>;
9
+ export interface MachineLifecycleEvent {
10
+ readonly lifecycleVersion: 1;
11
+ readonly type: 'lifecycle';
12
+ readonly requestId: string;
13
+ readonly runId: string;
14
+ readonly sequence: number;
15
+ readonly event: 'thread-ready' | 'dispatch-intent' | 'dispatch-possible' | 'turn-accepted' | 'terminal' | 'cleanup-confirmed';
16
+ readonly threadId: string | null;
17
+ readonly turnId: string | null;
18
+ /** Requested history mode; thread-ready configuration carries the backend evidence. */
19
+ readonly persistent: boolean;
20
+ readonly configuration: Readonly<Record<string, unknown>> | null;
21
+ readonly dispatch: 'not-dispatched' | 'possible' | 'accepted';
22
+ readonly outcome: 'unknown' | 'completed' | 'failed' | 'cancelled';
23
+ readonly cleanupConfirmed: boolean;
24
+ }
25
+ export interface MachineRecoveryRequest {
26
+ readonly protocol: 1;
27
+ readonly requestId: string;
28
+ readonly runId: string;
29
+ readonly recoveryDirectory: string;
30
+ }
31
+ export interface MachineRecoveryReceipt {
32
+ readonly protocol: 1;
33
+ readonly type: 'recovery';
34
+ readonly requestId: string;
35
+ readonly runId: string;
36
+ readonly status: 'terminal' | 'pending' | 'unknown';
37
+ readonly receipt: MachineReceipt | null;
38
+ readonly lifecycle: MachineLifecycleEvent | null;
39
+ readonly reason: string;
40
+ }
41
+ /** A recovery path is deliberately not a search root, an alias or a symlink. */
42
+ export declare function validateRecoveryDirectory(value: unknown, existing?: boolean): asserts value is string;
43
+ export declare function validLifecycle(value: unknown, requestId: string, runId: string): value is MachineLifecycleEvent;
44
+ /** One writer, exclusive directory admission, atomic replacement and directory fsync. */
45
+ export declare class MachineJournal {
46
+ #private;
47
+ constructor(directory: string, requestId: string, runId: string);
48
+ lifecycle(event: MachineLifecycleEvent): void;
49
+ receipt(receipt: MachineReceipt): void;
50
+ }
51
+ /** Read exactly one owned journal. Never starts a process, contacts a model or changes files. */
52
+ export declare function recoverMachine(value: MachineRecoveryRequest): Promise<MachineRecoveryReceipt>;
53
+ //# sourceMappingURL=machine-recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-recovery.d.ts","sourceRoot":"","sources":["../../src/machine-recovery.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,eAAO,MAAM,yBAAyB,EAAG,CAAU,CAAA;AACnD,eAAO,MAAM,8BAA8B;;;;;EAEzC,CAAA;AAEF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAA;IAC5B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,eAAe,GAAG,UAAU,GAAG,mBAAmB,CAAA;IAC7H,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,uFAAuF;IACvF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAA;IAChE,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAAA;IAC7D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vC;AAED,iGAAiG;AACjG,wBAAsB,cAAc,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAiCnG"}
@@ -0,0 +1,8 @@
1
+ import type { MachineOptions, MachineReceipt, MachineRequest } from './machine.ts';
2
+ export interface MachineHostOptions {
3
+ readonly env: Readonly<Record<string, string | undefined>>;
4
+ readonly recoveryDirectory?: string;
5
+ }
6
+ /** This promise rejects on incomplete evidence; it never fabricates a successful receipt. */
7
+ export declare function superviseMachine(request: MachineRequest, options: MachineOptions): Promise<MachineReceipt>;
8
+ //# sourceMappingURL=machine-supervision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-supervision.d.ts","sourceRoot":"","sources":["../../src/machine-supervision.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAGlF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC1D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CACpC;AAED,6FAA6F;AAC7F,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CA0FhH"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=machine-supervisor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-supervisor.d.ts","sourceRoot":"","sources":["../../src/machine-supervisor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,70 @@
1
+ import type { CodexRunFailure, CodexRunOutcome } from './run.ts';
2
+ import { type MachineLifecycleEvent } from './machine-recovery.ts';
3
+ export { MACHINE_LIFECYCLE_VERSION, MACHINE_LIFECYCLE_CAPABILITIES, recoverMachine } from './machine-recovery.ts';
4
+ export type { MachineLifecycleEvent, MachineRecoveryRequest, MachineRecoveryReceipt } from './machine-recovery.ts';
5
+ export declare const MACHINE_PROTOCOL_VERSION: 1;
6
+ /** Caller input contains no credentials. Child authentication stays in its environment. */
7
+ export interface MachineRequest {
8
+ readonly protocol: 1;
9
+ readonly requestId: string;
10
+ readonly prompt: string;
11
+ readonly cwd: string;
12
+ readonly model: string;
13
+ readonly effort: string;
14
+ readonly permissionMode: 'read-only' | 'workspace-write' | 'dangerously-bypass-approvals-and-sandbox';
15
+ readonly command?: string;
16
+ readonly timeoutMs?: number;
17
+ readonly maxOutputBytes?: number;
18
+ readonly threadMode?: 'ephemeral' | 'persistent';
19
+ readonly threadId?: string;
20
+ readonly images?: readonly string[];
21
+ readonly outputSchema?: Record<string, unknown>;
22
+ }
23
+ export interface MachineOptions {
24
+ readonly signal?: AbortSignal;
25
+ readonly env?: Readonly<Record<string, string>>;
26
+ readonly onProgress?: (text: string) => void;
27
+ /** Returning resolves the caller's durable checkpoint ACK. Rejection stops dispatch. */
28
+ readonly onLifecycle?: (event: MachineLifecycleEvent) => Promise<void> | void;
29
+ /** A NEW private directory; its canonical parent must already exist. Never reused. */
30
+ readonly recoveryDirectory?: string;
31
+ }
32
+ /** The result is not mixed into the model's structured answer or human thread marker. */
33
+ export interface MachineReceipt {
34
+ readonly protocol: 1;
35
+ readonly type: 'result';
36
+ readonly requestId: string;
37
+ readonly runId: string;
38
+ readonly ok: boolean;
39
+ readonly requested: {
40
+ readonly cwd: string;
41
+ readonly model: string;
42
+ readonly effort: string;
43
+ readonly permissionMode: MachineRequest['permissionMode'];
44
+ readonly threadId: string | null;
45
+ };
46
+ readonly outcome: CodexRunOutcome | null;
47
+ readonly failure: {
48
+ readonly stage: string;
49
+ readonly category: string;
50
+ readonly diagnostic: string;
51
+ readonly execution: CodexRunFailure['execution'] | null;
52
+ readonly configuration: CodexRunFailure['configuration'] | null;
53
+ readonly usage: CodexRunFailure['usage'] | null;
54
+ readonly rateLimits: CodexRunFailure['rateLimits'] | null;
55
+ readonly turnConfiguration: CodexRunFailure['turnConfiguration'] | null;
56
+ readonly cleanup: CodexRunFailure['cleanup'] | null;
57
+ } | null;
58
+ readonly costUSD: null;
59
+ readonly costStatus: 'unknown';
60
+ }
61
+ export declare class MachineInputError extends Error {
62
+ readonly code = "INVALID_REQUEST";
63
+ constructor(message: string);
64
+ }
65
+ /** Validate before starting any process; unknown options never silently disappear. */
66
+ export declare function parseMachineRequest(value: unknown): MachineRequest;
67
+ /** A machine run never invents an exit code, usage, effective effort, or dollar cost. */
68
+ export declare function runMachine(value: MachineRequest, options?: MachineOptions): Promise<MachineReceipt>;
69
+ export type { CodexRunOutcome } from './run.ts';
70
+ //# sourceMappingURL=machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../src/machine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAGhE,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAE7F,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACjH,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAElH,eAAO,MAAM,wBAAwB,EAAG,CAAU,CAAA;AAElD,2FAA2F;AAC3F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,cAAc,EAAE,WAAW,GAAG,iB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,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAmB7G;AAED,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Private POSIX group guardian for one Codex app-server.
3
+ *
4
+ * The caller creates this process as a group leader and establishes the IPC
5
+ * lifeline in the same spawn operation. Codex inherits this group, but never
6
+ * the IPC descriptor. An abruptly killed caller therefore closes the lifeline
7
+ * even if Codex is hung, before or after initialization. The guardian then
8
+ * terminates only its own group with a finite TERM/KILL sequence.
9
+ *
10
+ * A live caller can request a normal stop with SIGTERM/SIGINT. In that case the
11
+ * caller keeps ownership and confirms the group itself, so this process exits
12
+ * as soon as the app-server exits instead of making every normal delegation
13
+ * sleep the whole dispose grace. A caller death (IPC disconnect) keeps the
14
+ * full grace: there the guardian is the last group owner and must clean up
15
+ * descendants that outlive the app-server.
16
+ *
17
+ * Normal cleanup is confirmed by the surviving caller with kill(-pgid, 0).
18
+ * Emergency cleanup cannot write a final receipt after killing this guardian;
19
+ * missing app-server exit facts must remain unknown in the caller's receipt.
20
+ */
21
+ export {};
22
+ //# sourceMappingURL=process-guardian.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-guardian.d.ts","sourceRoot":"","sources":["../../src/process-guardian.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}