@deepseek-ai/dsh-subagent-codex 0.1.0-rc.7 → 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.
@@ -1,29 +1,34 @@
1
1
  /**
2
- * Fixed Codex one-shot subagent provider. Every accepted run starts a fresh
3
- * official `codex app-server --stdio` process in the delegating Session's
4
- * workspace and publishes only after an ephemeral thread exists.
2
+ * Profile-named Codex one-shot subagent provider. Every accepted run starts a
3
+ * fresh official package-local Codex wrapper with `app-server --stdio` in the
4
+ * delegating Session's workspace and publishes only after an ephemeral thread exists.
5
5
  *
6
6
  * @module @deepseek-ai/dsh-subagent-codex
7
7
  */
8
8
  import type { Context } from '@deepseek-ai/cordis';
9
9
  import z from '@deepseek-ai/schemastery';
10
+ import { type CodexPermissionMode } from './run.ts';
10
11
  export declare const name = "subagent-codex";
11
12
  export declare const inject: string[];
12
- /** Deployment-owned environment and process-release bound. */
13
+ /** Deployment-owned permission, environment, and process-release settings. */
13
14
  export interface Config {
15
+ /** Provider name on `ctx.subagents` (default `codex`). */
16
+ providerName?: string;
14
17
  /**
15
18
  * Explicit environment entries layered over the subprocess seam's
16
19
  * credential-scrubbed parent environment.
17
20
  */
18
21
  env?: Record<string, string>;
22
+ /** Native non-interactive permission mode fixed for this Provider instance. */
23
+ permissionMode?: CodexPermissionMode;
19
24
  /** Grace in milliseconds for app-server process-tree termination. */
20
25
  disposeGraceMs?: number;
21
26
  }
22
27
  export declare const Config: z<Config>;
23
28
  /**
24
- * Register the fixed `codex` provider.
29
+ * Register one Profile-named Codex provider.
25
30
  * @param ctx - context carrying shared subagent and subprocess services.
26
- * @param config - explicit child environment and disposal grace.
31
+ * @param config - registry name, permission mode, child environment, and disposal grace.
27
32
  */
28
33
  export declare function apply(ctx: Context, config: Config): void;
29
34
  //# sourceMappingURL=index.d.ts.map
@@ -12,20 +12,29 @@ import type { SubprocessHandle, SubprocessSpawnSpec } from '@deepseek-ai/dsh-sub
12
12
  import { CodexAppServerWire } from './wire.ts';
13
13
  /** Default POSIX grace between subprocess termination tiers. */
14
14
  export declare const DEFAULT_DISPOSE_GRACE_MS = 3000;
15
+ /** Profile-selectable non-interactive Codex permission mode. */
16
+ export type CodexPermissionMode = 'never' | 'approve-for-me' | 'dangerously-bypass-approvals-and-sandbox';
17
+ /** Native non-interactive Codex modes mapped to official `thread/start` fields. */
18
+ export declare const CODEX_PERMISSION_MODES: readonly ["never", "approve-for-me", "dangerously-bypass-approvals-and-sandbox"];
19
+ /** Safe default for unattended Codex runs. */
20
+ export declare const DEFAULT_CODEX_PERMISSION_MODE: CodexPermissionMode;
15
21
  /**
16
- * Resolve the fixed app-server command for a platform.
17
- *
18
- * Windows npm and pnpm installs expose `codex.cmd`, which requires `cmd.exe`;
19
- * the argv is constant so no task or configuration text enters the
20
- * shell boundary.
21
- * @param platform - host platform used to select the executable boundary.
22
- * @returns argv for the fixed Codex app-server command.
22
+ * Hide an unpublished Host failure behind fixed safe startup facts.
23
+ * @param cause Original Host failure retained for internal diagnostics.
24
+ * @returns A startup failure whose message contains only fixed safe facts.
25
+ */
26
+ export declare function codexStartupFailure(cause: unknown): Error;
27
+ /**
28
+ * Fixed package-local app-server command, independent of the host `PATH`.
29
+ * @returns Node, the official wrapper, and the fixed app-server arguments.
23
30
  */
24
- export declare function codexAppServerArgv(platform?: NodeJS.Platform): string[];
31
+ export declare function codexAppServerArgv(): string[];
25
32
  /** Fully resolved inputs for one Codex app-server run. */
26
33
  export interface CodexRunSpec {
27
34
  /** Parent Session workspace, also supplied to `thread/start`. */
28
35
  readonly cwd: string;
36
+ /** Profile-selected native non-interactive permission mode. */
37
+ readonly permissionMode: CodexPermissionMode;
29
38
  /** Explicit deployment/test environment layered after the shared scrub. */
30
39
  readonly env: Record<string, string>;
31
40
  /** Subprocess termination grace passed to the shared process-tree owner. */
@@ -9,6 +9,13 @@
9
9
  import type { Readable, Writable } from 'node:stream';
10
10
  import type { ContentBlock } from '@deepseek-ai/dsh-llm';
11
11
  import type { SubagentResult } from '@deepseek-ai/dsh-subagent';
12
+ import type { CodexPermissionMode } from './run.ts';
13
+ /** Product facts owned by the Codex wire after publication. */
14
+ export interface CodexWireFailureFacts {
15
+ readonly stage: 'turn-start' | 'turn';
16
+ readonly category: string;
17
+ readonly httpStatus?: number | undefined;
18
+ }
12
19
  /**
13
20
  * One app-server connection and its single ephemeral thread/turn.
14
21
  *
@@ -17,6 +24,7 @@ import type { SubagentResult } from '@deepseek-ai/dsh-subagent';
17
24
  */
18
25
  export declare class CodexAppServerWire {
19
26
  private readonly input;
27
+ private readonly permissionMode;
20
28
  private readonly transport;
21
29
  private readonly fatal;
22
30
  private threadId;
@@ -26,10 +34,23 @@ export declare class CodexAppServerWire {
26
34
  private readonly earlyTurnNotifications;
27
35
  private lastFinalAnswer;
28
36
  private lastUnphasedAnswer;
37
+ private diagnostic;
38
+ private failure;
39
+ private diagnosticOrder;
40
+ private observationOrder;
41
+ private pendingDiagnostic;
42
+ private stderrTail;
43
+ private inputEnded;
44
+ private terminalObserved;
29
45
  private closed;
30
- constructor(input: Readable, output: Writable);
46
+ constructor(input: Readable, output: Writable, permissionMode: CodexPermissionMode);
31
47
  /** Start reading app-server frames. */
32
48
  start(): void;
49
+ /**
50
+ * Whether protocol output ended before a terminal turn notification.
51
+ * @returns `true` only for an early protocol close without a terminal turn.
52
+ */
53
+ endedBeforeTerminal(): boolean;
33
54
  /**
34
55
  * Perform the required app-server initialize/initialized handshake.
35
56
  * @param signal - unpublished-start cancellation.
@@ -59,6 +80,23 @@ export declare class CodexAppServerWire {
59
80
  * @returns the selected final or nullable-phase text block, if any.
60
81
  */
61
82
  collectOutput(): ContentBlock[];
83
+ /**
84
+ * The latest safe unattended permission fact observed for this run.
85
+ * @returns provider-authored diagnostic text, when one was observed.
86
+ */
87
+ collectDiagnostic(): string | undefined;
88
+ /**
89
+ * The structured failure fact observed for this published turn.
90
+ * Call only after a non-completed return or rejection from {@link runTurn}.
91
+ * @returns the fixed stage/category pair and optional HTTP status.
92
+ */
93
+ collectFailure(): CodexWireFailureFacts;
94
+ /**
95
+ * Observe product stderr while retaining only enough tail to recognize fixed
96
+ * permission signatures. The raw text is never copied into the diagnostic.
97
+ * @param chunk - one decoded stderr chunk already forwarded to the host.
98
+ */
99
+ observeStderr(chunk: string): void;
62
100
  /** Detach JSON-RPC listeners and reject outstanding requests. Idempotent. */
63
101
  close(): void;
64
102
  private guarded;
@@ -68,7 +106,17 @@ export declare class CodexAppServerWire {
68
106
  private readonly onInputEnd;
69
107
  private observePendingTurnId;
70
108
  private commitTurnId;
109
+ /**
110
+ * Validate the request's thread and turn association.
111
+ * @returns `true` when the matching turn is still provisional, so the caller
112
+ * defers its diagnostic until `commitTurnId()`.
113
+ */
71
114
  private validateRunIds;
115
+ private recordRequestDiagnostic;
116
+ private recordDiagnostic;
117
+ private recordFailure;
118
+ private nextObservationOrder;
119
+ private recordDeclinedItem;
72
120
  private handleServerRequest;
73
121
  private handleNotification;
74
122
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-subagent-codex",
3
3
  "description": "One-shot Codex subagent provider over the official app-server protocol",
4
- "version": "0.1.0-rc.7",
4
+ "version": "0.1.0-rc.8",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -28,35 +28,40 @@
28
28
  "files": [
29
29
  "lib/index.js",
30
30
  "lib/invariant.js",
31
+ "cordis.patch.yml",
31
32
  "lib/types/**/*.d.ts"
32
33
  ],
33
34
  "license": "MIT",
35
+ "dsh": {
36
+ "bundle": {
37
+ "patch": "./cordis.patch.yml"
38
+ }
39
+ },
34
40
  "peerDependencies": {
35
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
36
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
37
- "@deepseek-ai/dsh-sdk-protocol": "^0.1.0-rc.7",
38
- "@deepseek-ai/dsh-session": "^0.1.0-rc.7",
39
- "@deepseek-ai/dsh-subagent": "^0.1.0-rc.7",
40
- "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.7",
41
- "@deepseek-ai/dsh-timeout": "^0.1.0-rc.7",
42
- "@deepseek-ai/cordis": "^4.0.1"
41
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
42
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.8",
43
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.8",
44
+ "@deepseek-ai/dsh-subagent": "^0.1.0-rc.8",
45
+ "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.8",
46
+ "@deepseek-ai/cordis": "^4.0.1",
47
+ "@deepseek-ai/dsh-timeout": "^0.1.0-rc.8"
43
48
  },
44
49
  "dependencies": {
50
+ "@openai/codex": "0.147.0",
51
+ "@deepseek-ai/dsh-sdk-protocol": "^0.1.0-rc.8",
45
52
  "@deepseek-ai/schemastery": "^3.18.1"
46
53
  },
47
54
  "devDependencies": {
48
- "@openai/codex": "0.147.0",
49
55
  "@deepseek-ai/cordis-plugin-loader": "^1.0.2",
50
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.7",
51
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
52
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
53
- "@deepseek-ai/dsh-loader-smoke": "^0.1.0-rc.7",
54
- "@deepseek-ai/dsh-sdk-protocol": "^0.1.0-rc.7",
55
- "@deepseek-ai/dsh-session": "^0.1.0-rc.7",
56
- "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.7",
57
- "@deepseek-ai/dsh-subagent": "^0.1.0-rc.7",
58
- "@deepseek-ai/dsh-timeout": "^0.1.0-rc.7",
56
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.8",
57
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.8",
58
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.8",
59
+ "@deepseek-ai/dsh-loader-smoke": "^0.1.0-rc.8",
60
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.8",
61
+ "@deepseek-ai/dsh-subagent": "^0.1.0-rc.8",
62
+ "@deepseek-ai/dsh-subprocess-local": "^0.1.0-rc.8",
59
63
  "@deepseek-ai/cordis": "^4.0.1",
60
- "@deepseek-ai/dsh-subprocess-local": "^0.1.0-rc.7"
64
+ "@deepseek-ai/dsh-timeout": "^0.1.0-rc.8",
65
+ "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.8"
61
66
  }
62
67
  }