stitchkit 0.129.0 → 0.130.1

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 (163) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/agent-executor/acp/v1-connect.d.ts +87 -19
  3. package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
  4. package/dist/agent-executor/acp/v1-driver.d.ts +4 -2
  5. package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
  6. package/dist/agent-executor/acp/v1-handlers.d.ts +56 -0
  7. package/dist/agent-executor/acp/v1-handlers.d.ts.map +1 -0
  8. package/dist/agent-executor/acp/v1-map.d.ts +13 -2
  9. package/dist/agent-executor/acp/v1-map.d.ts.map +1 -1
  10. package/dist/agent-executor/acp/v1-permission.d.ts +44 -0
  11. package/dist/agent-executor/acp/v1-permission.d.ts.map +1 -0
  12. package/dist/agent-executor/acp/v1-protocol.d.ts +63 -10
  13. package/dist/agent-executor/acp/v1-protocol.d.ts.map +1 -1
  14. package/dist/agent-executor/acp/v1-session.d.ts +34 -7
  15. package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
  16. package/dist/agent-executor/acp/v1-turn.d.ts +51 -13
  17. package/dist/agent-executor/acp/v1-turn.d.ts.map +1 -1
  18. package/dist/agent-executor/claude/classify.d.ts +10 -0
  19. package/dist/agent-executor/claude/classify.d.ts.map +1 -1
  20. package/dist/agent-executor/claude/cli-driver.d.ts +4 -1
  21. package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
  22. package/dist/agent-executor/claude/events.d.ts +146 -0
  23. package/dist/agent-executor/claude/events.d.ts.map +1 -0
  24. package/dist/agent-executor/claude/limits.d.ts +7 -1
  25. package/dist/agent-executor/claude/limits.d.ts.map +1 -1
  26. package/dist/agent-executor/claude/protocol.d.ts +49 -9
  27. package/dist/agent-executor/claude/protocol.d.ts.map +1 -1
  28. package/dist/agent-executor/claude/session.d.ts +2 -0
  29. package/dist/agent-executor/claude/session.d.ts.map +1 -1
  30. package/dist/agent-executor/claude-sdk/controls.d.ts +10 -1
  31. package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -1
  32. package/dist/agent-executor/claude-sdk/driver.d.ts +97 -3
  33. package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
  34. package/dist/agent-executor/claude-sdk/probe.d.ts +29 -0
  35. package/dist/agent-executor/claude-sdk/probe.d.ts.map +1 -0
  36. package/dist/agent-executor/claude-sdk/query-loop.d.ts +53 -5
  37. package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
  38. package/dist/agent-executor/claude-sdk/query-options.d.ts +2 -0
  39. package/dist/agent-executor/claude-sdk/query-options.d.ts.map +1 -1
  40. package/dist/agent-executor/claude-sdk/session.d.ts +2 -3
  41. package/dist/agent-executor/claude-sdk/session.d.ts.map +1 -1
  42. package/dist/agent-executor/claude-sdk/turn-usage.d.ts +81 -0
  43. package/dist/agent-executor/claude-sdk/turn-usage.d.ts.map +1 -0
  44. package/dist/agent-executor/codex/classify.d.ts +4 -0
  45. package/dist/agent-executor/codex/classify.d.ts.map +1 -1
  46. package/dist/agent-executor/codex/connect.d.ts +5 -2
  47. package/dist/agent-executor/codex/connect.d.ts.map +1 -1
  48. package/dist/agent-executor/codex/control-client.d.ts +206 -0
  49. package/dist/agent-executor/codex/control-client.d.ts.map +1 -0
  50. package/dist/agent-executor/codex/driver.d.ts +35 -5
  51. package/dist/agent-executor/codex/driver.d.ts.map +1 -1
  52. package/dist/agent-executor/codex/handlers.d.ts +52 -0
  53. package/dist/agent-executor/codex/handlers.d.ts.map +1 -0
  54. package/dist/agent-executor/codex/limits.d.ts.map +1 -1
  55. package/dist/agent-executor/codex/protocol.d.ts +128 -0
  56. package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
  57. package/dist/agent-executor/codex/request-answers.d.ts +101 -0
  58. package/dist/agent-executor/codex/request-answers.d.ts.map +1 -0
  59. package/dist/agent-executor/codex/session-controls.d.ts +124 -61
  60. package/dist/agent-executor/codex/session-controls.d.ts.map +1 -1
  61. package/dist/agent-executor/codex/session.d.ts +10 -36
  62. package/dist/agent-executor/codex/session.d.ts.map +1 -1
  63. package/dist/agent-executor/codex/shared-server.d.ts +31 -0
  64. package/dist/agent-executor/codex/shared-server.d.ts.map +1 -0
  65. package/dist/agent-executor/codex/shared-thread.d.ts +46 -0
  66. package/dist/agent-executor/codex/shared-thread.d.ts.map +1 -0
  67. package/dist/agent-executor/codex/thread-controls.d.ts +144 -0
  68. package/dist/agent-executor/codex/thread-controls.d.ts.map +1 -0
  69. package/dist/agent-executor/codex/thread-open.d.ts +66 -0
  70. package/dist/agent-executor/codex/thread-open.d.ts.map +1 -0
  71. package/dist/agent-executor/codex/turn-input.d.ts +47 -0
  72. package/dist/agent-executor/codex/turn-input.d.ts.map +1 -0
  73. package/dist/agent-executor/contract.d.ts +77 -0
  74. package/dist/agent-executor/contract.d.ts.map +1 -1
  75. package/dist/agent-executor/engine.d.ts +6 -2
  76. package/dist/agent-executor/engine.d.ts.map +1 -1
  77. package/dist/agent-executor/executor-contract.d.ts +54 -0
  78. package/dist/agent-executor/executor-contract.d.ts.map +1 -1
  79. package/dist/agent-executor/handoff-schemas.d.ts +407 -0
  80. package/dist/agent-executor/handoff-schemas.d.ts.map +1 -0
  81. package/dist/agent-executor/handoff.d.ts +12 -0
  82. package/dist/agent-executor/handoff.d.ts.map +1 -0
  83. package/dist/agent-executor/hello.d.ts +72 -0
  84. package/dist/agent-executor/hello.d.ts.map +1 -1
  85. package/dist/agent-executor/image-input.d.ts +22 -0
  86. package/dist/agent-executor/image-input.d.ts.map +1 -1
  87. package/dist/agent-executor/projection.d.ts +2 -2
  88. package/dist/agent-executor/projection.d.ts.map +1 -1
  89. package/dist/agent-executor/session-primitives.d.ts +10 -1
  90. package/dist/agent-executor/session-primitives.d.ts.map +1 -1
  91. package/dist/agent-executor/testing/conformance.d.ts.map +1 -1
  92. package/dist/agent-executor/testing/replay-driver.d.ts +41 -0
  93. package/dist/agent-executor/testing/replay-driver.d.ts.map +1 -0
  94. package/dist/agent-executor/testing/replay-gate.d.ts +11 -0
  95. package/dist/agent-executor/testing/replay-gate.d.ts.map +1 -0
  96. package/dist/agent-executor/testing/replay-runner.d.ts +27 -0
  97. package/dist/agent-executor/testing/replay-runner.d.ts.map +1 -0
  98. package/dist/agent-executor/testing/replay-scenarios.d.ts +21 -0
  99. package/dist/agent-executor/testing/replay-scenarios.d.ts.map +1 -0
  100. package/dist/agent-executor/testing/replay-transcript.d.ts +296 -0
  101. package/dist/agent-executor/testing/replay-transcript.d.ts.map +1 -0
  102. package/dist/agent-executor/vocabulary.d.ts +135 -0
  103. package/dist/agent-executor/vocabulary.d.ts.map +1 -1
  104. package/dist/agent-runtime/branch-observations.d.ts +18 -18
  105. package/dist/agent-runtime/branch-provider.d.ts +2 -2
  106. package/dist/agent-runtime/deferred-tool-selection.d.ts.map +1 -1
  107. package/dist/agent-runtime/sql-rows.d.ts +10 -10
  108. package/dist/agent-runtime/store-conformance-lifecycle.d.ts +20 -20
  109. package/dist/agent-runtime/store-conformance-support.d.ts +10 -10
  110. package/dist/agent-runtime/terminal-commit.d.ts +10 -10
  111. package/dist/entrypoints/agent-executor/acp.d.ts +4 -1
  112. package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -1
  113. package/dist/entrypoints/agent-executor/acp.js +847 -214
  114. package/dist/entrypoints/agent-executor/claude-sdk.d.ts +5 -1
  115. package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -1
  116. package/dist/entrypoints/agent-executor/claude-sdk.js +713 -205
  117. package/dist/entrypoints/agent-executor/claude.js +44 -19
  118. package/dist/entrypoints/agent-executor/codex.d.ts +10 -2
  119. package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
  120. package/dist/entrypoints/agent-executor/codex.js +2269 -600
  121. package/dist/entrypoints/agent-executor/testing.d.ts +4 -0
  122. package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -1
  123. package/dist/entrypoints/agent-executor/testing.js +1002 -2
  124. package/dist/entrypoints/agent-executor.d.ts +4 -2
  125. package/dist/entrypoints/agent-executor.d.ts.map +1 -1
  126. package/dist/entrypoints/agent-executor.js +411 -23
  127. package/dist/entrypoints/agent-runtime.js +4 -23
  128. package/dist/entrypoints/tools/mcp.d.ts +1 -0
  129. package/dist/entrypoints/tools/mcp.d.ts.map +1 -1
  130. package/dist/entrypoints/tools/mcp.js +1 -1
  131. package/dist/entrypoints/tools/toolkit.js +1 -1
  132. package/dist/{index-wv2amqm4.js → index-2s8sy57y.js} +36 -103
  133. package/dist/{index-afb6z77w.js → index-dbp6xemn.js} +75 -7
  134. package/dist/{index-bjmj2q1z.js → index-jrn3prgm.js} +1 -1
  135. package/dist/index-kne9g2c5.js +30 -0
  136. package/dist/index-p1qmpq0p.js +1300 -0
  137. package/dist/{index-7jqn3b3g.js → index-v759mzed.js} +152 -2
  138. package/dist/{index-cbhxhma2.js → index-x5ayy5bn.js} +1 -0
  139. package/dist/index-y0a4gt1s.js +142 -0
  140. package/dist/tools/internal/rank-tools.d.ts +10 -0
  141. package/dist/tools/internal/rank-tools.d.ts.map +1 -0
  142. package/dist/tools/mcp/handler.d.ts +7 -3
  143. package/dist/tools/mcp/handler.d.ts.map +1 -1
  144. package/dist/tools/mcp/lazy-discovery.d.ts +47 -0
  145. package/dist/tools/mcp/lazy-discovery.d.ts.map +1 -0
  146. package/dist/tools/mcp/mount.d.ts +7 -0
  147. package/dist/tools/mcp/mount.d.ts.map +1 -1
  148. package/dist/tools/mcp/register.d.ts +2 -2
  149. package/dist/tools/mcp/register.d.ts.map +1 -1
  150. package/llms/agent-executor-acp.txt +7 -8
  151. package/llms/agent-executor-claude-sdk.txt +4 -2
  152. package/llms/agent-executor-codex.txt +8 -4
  153. package/llms/agent-executor-testing.txt +5 -1
  154. package/llms/agent-executor.txt +7 -6
  155. package/llms/stitchkit.txt +74 -74
  156. package/llms/tools-mcp.txt +3 -2
  157. package/llms/tools.txt +24 -0
  158. package/llms/{upgrading-0.128.0-0.129.0.txt → upgrading-0.128.0-0.130.0.txt} +30 -3
  159. package/llms/upgrading.txt +1 -1
  160. package/llms-full.txt +159 -97
  161. package/llms.txt +8 -8
  162. package/package.json +1 -1
  163. package/dist/index-y71zn1gw.js +0 -586
@@ -0,0 +1,101 @@
1
+ import { type EngineRequestTurn } from '../engine-requests.js';
2
+ import { type InteractionReply } from '../executor-contract.js';
3
+ import type { JsonRpcValue } from '../json-rpc-peer.js';
4
+ import type { CodexTurnState } from './classify.js';
5
+ import { type CodexMcpElicitationMode } from './protocol.js';
6
+ /** Known Codex app-server request methods handled by the driver. */
7
+ export type CodexServerRequestMethod = 'item/commandExecution/requestApproval' | 'item/fileChange/requestApproval' | 'item/permissions/requestApproval' | 'item/tool/requestUserInput' | 'mcpServer/elicitation/request';
8
+ /** Metadata kept with one held Codex approval, permissions, user-input, or MCP elicitation request. */
9
+ export interface CodexRequestDetail {
10
+ readonly method: CodexServerRequestMethod;
11
+ readonly kind?: string;
12
+ readonly availableDecisions?: readonly JsonRpcValue[];
13
+ readonly permissions?: JsonRpcValue;
14
+ readonly elicitationMode?: CodexMcpElicitationMode;
15
+ }
16
+ /** The turn running in a session, and the engine's requests it is still to answer. */
17
+ export interface CodexTurnSlot extends EngineRequestTurn<JsonRpcValue, CodexRequestDetail> {
18
+ readonly state: CodexTurnState;
19
+ codexTurnId?: string;
20
+ }
21
+ /** An external/TUI server request held outside `startTurn()`. */
22
+ export interface PendingExternalCodexRequest {
23
+ readonly detail: CodexRequestDetail;
24
+ readonly turnId: string;
25
+ resolve(answer: JsonRpcValue): void;
26
+ }
27
+ export declare function isKnownCodexRequestMethod(method: string): method is CodexServerRequestMethod;
28
+ /** Extract a non-empty Codex turn identifier from raw notification/request params when present. */
29
+ export declare function externalCodexTurnIdOf(params: unknown): string;
30
+ export declare function parseCodexApprovalRequest(method: CodexServerRequestMethod, params: unknown): {
31
+ detail: CodexRequestDetail;
32
+ deltaFields: {
33
+ callId?: string | undefined;
34
+ prompt?: string | undefined;
35
+ input?: import("zod").JSONType | undefined;
36
+ };
37
+ };
38
+ export declare function parseCodexInputRequest(params: unknown): {
39
+ detail: CodexRequestDetail;
40
+ deltaFields: {
41
+ callId?: string | undefined;
42
+ input: import("zod").JSONType;
43
+ };
44
+ };
45
+ export declare function parseCodexPermissionsRequest(params: unknown): {
46
+ detail: CodexRequestDetail;
47
+ deltaFields: {
48
+ callId?: string | undefined;
49
+ prompt?: string | undefined;
50
+ input: import("zod").JSONType;
51
+ };
52
+ };
53
+ export declare function parseCodexElicitationRequest(params: unknown): {
54
+ detail: CodexRequestDetail;
55
+ deltaFields: {
56
+ callId?: string | undefined;
57
+ toolName?: string | undefined;
58
+ prompt: string;
59
+ input: import("zod").JSONType;
60
+ };
61
+ };
62
+ /** Parse any known Codex server request into its normalized delta kind, fields, and held detail. */
63
+ export declare function parseCodexServerRequest(method: CodexServerRequestMethod, params: unknown): {
64
+ detail: CodexRequestDetail;
65
+ deltaFields: {
66
+ callId?: string | undefined;
67
+ prompt?: string | undefined;
68
+ input?: import("zod").JSONType | undefined;
69
+ };
70
+ kind: 'approval';
71
+ } | {
72
+ detail: CodexRequestDetail;
73
+ deltaFields: {
74
+ callId?: string | undefined;
75
+ input: import("zod").JSONType;
76
+ };
77
+ kind: 'input';
78
+ };
79
+ export declare function codexStoppedAnswer(method: string): JsonRpcValue;
80
+ export declare const codexStopped: (waiting: {
81
+ detail: {
82
+ method: string;
83
+ };
84
+ }) => import("zod").JSONType;
85
+ /**
86
+ * Validate and build the Codex JSON-RPC response payload for one held approval, permissions,
87
+ * user-input, or MCP elicitation request. Refuses unsupported `updatedInput`, invalid kinds,
88
+ * `humanCommand` session approvals, or disallowed `availableDecisions` before state is mutated.
89
+ */
90
+ export declare function buildCodexRequestAnswer(detail: CodexRequestDetail, rawReply: InteractionReply['reply']): JsonRpcValue;
91
+ /** Answer one pending request owned by the active turn (`turn.respond`). */
92
+ export declare function answerActiveCodexTurnRequest(turn: CodexTurnSlot, interactionId: string, rawReply: InteractionReply['reply']): void;
93
+ /** Answer one pending external request (`event.respond` / `session.respond` / `control.respond`). */
94
+ export declare function answerCodexSessionRequest(input: {
95
+ turn: CodexTurnSlot | undefined;
96
+ externalPending: Map<string, PendingExternalCodexRequest>;
97
+ expectedEntry?: PendingExternalCodexRequest;
98
+ interactionId: string;
99
+ reply: InteractionReply['reply'];
100
+ }): void;
101
+ //# sourceMappingURL=request-answers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-answers.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/request-answers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,sBAAsB,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAQL,KAAK,uBAAuB,EAK7B,MAAM,YAAY,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,wBAAwB,GAChC,uCAAuC,GACvC,iCAAiC,GACjC,kCAAkC,GAClC,4BAA4B,GAC5B,+BAA+B,CAAC;AAEpC,uGAAuG;AACvG,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAC;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACtD,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,eAAe,CAAC,EAAE,uBAAuB,CAAC;CACpD;AAED,sFAAsF;AACtF,MAAM,WAAW,aAAc,SAAQ,iBAAiB,CAAC,YAAY,EAAE,kBAAkB,CAAC;IACxF,QAAQ,CAAC,KAAK,EAAE,cAAc,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AO,CAAC,GAClC,IAAI,CAON;AAED,qGAAqG;AACrG,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IAC1D,aAAa,CAAC,EAAE,2BAA2B,CAAC;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CAClC,GAAG,IAAI,CAiBP"}
@@ -1,8 +1,16 @@
1
- import type { AgentMessagePart } from '../../agent-parts/parts.js';
2
1
  import type { AgentEngineDriver, AgentEngineSession, AgentEngineTurn } from '../engine.js';
3
- import { type DriverImageOptions, type InlinedPart } from '../image-input.js';
2
+ import type { InteractionReply } from '../executor-contract.js';
3
+ import type { ExecutorDriverCapabilities } from '../hello.js';
4
+ import type { DriverImageOptions } from '../image-input.js';
4
5
  import type { JsonRpcPeer, JsonRpcValue } from '../json-rpc-peer.js';
6
+ import type { ExecutorProfileConfig } from '../profile.js';
7
+ import type { ExecutorStartupPhase } from '../vocabulary.js';
8
+ import type { CodexControlClient, CodexControlConnectInput, CodexControlConnection, CodexListItemsParams, CodexListTurnsParams, CodexReadThreadParams } from './control-client.js';
5
9
  import { type CodexApprovalPolicy, type CodexCollaborationMode, type CodexSandboxMode, type CodexThreadContext } from './protocol.js';
10
+ import type { CodexSharedServer, CodexSharedServerOpenInput } from './shared-server.js';
11
+ import { type CodexInjectItemsParams, type CodexInterruptTurnParams, type CodexRevertThreadParams, type CodexRevertThreadResult, type CodexSetThreadNameParams, type CodexUpdateThreadMetadataParams } from './thread-controls.js';
12
+ import type { CodexResumeThreadParams } from './thread-open.js';
13
+ import { type CodexTurnInputPart, type InlinedCodexPart } from './turn-input.js';
6
14
  /** Policy and configuration fields forwarded to Codex `thread/start`, `thread/resume`, and `thread/fork`. */
7
15
  export interface CodexThreadPolicyOverrides {
8
16
  /** Model identifier to use for the thread. */
@@ -20,45 +28,13 @@ export interface CodexThreadPolicyOverrides {
20
28
  /** Codex app-server config overrides for the thread (sandbox writable roots, disabled MCP/plugins/features, network policy). */
21
29
  readonly config?: Readonly<Record<string, JsonRpcValue>>;
22
30
  }
23
- /** Read-only and inspection RPCs exposed during thread setup (`prepareThread` / `verifyThread`) and on {@link CodexSession}. */
24
- export interface CodexControlClient {
25
- /** Read effective Codex configuration (`config/read`). */
26
- readConfig(params?: {
27
- readonly cwd?: string;
28
- readonly includeLayers?: boolean;
29
- }): Promise<JsonRpcValue>;
30
- /** List MCP servers and their statuses (`mcpServerStatus/list`). */
31
- listMcpServerStatus(params?: {
32
- readonly cursor?: string;
33
- readonly limit?: number;
34
- readonly threadId?: string;
35
- readonly serverName?: string;
36
- readonly detail?: string;
37
- }): Promise<JsonRpcValue>;
38
- /** List discovered Codex skills (`skills/list`). */
39
- listSkills(params?: {
40
- readonly cwds?: readonly string[];
41
- readonly forceReload?: boolean;
42
- }): Promise<JsonRpcValue>;
43
- /** List available models (`model/list`). */
44
- listModels(params?: {
45
- readonly cursor?: string;
46
- readonly limit?: number;
47
- readonly includeHidden?: boolean;
48
- readonly modelProvider?: string;
49
- }): Promise<JsonRpcValue>;
50
- /** Read active account information (`account/read`). */
51
- readAccount(params?: {
52
- readonly refreshToken?: boolean;
53
- }): Promise<JsonRpcValue>;
54
- /** Read the raw `account/rateLimits/read` response envelope. */
55
- readRateLimits(): Promise<JsonRpcValue>;
56
- }
57
- /** Input to {@link CodexSession.startTurn}, extending the portable turn input with Codex per-turn overrides. */
31
+ /** Input to {@link CodexSession.startTurn}, extending the portable turn input with Codex per-turn overrides, `localImage`, and `skill` items. */
58
32
  export interface CodexTurnInput {
59
33
  readonly turnId: string;
60
34
  readonly clientId: string;
61
- readonly input: readonly AgentMessagePart[];
35
+ readonly input: readonly CodexTurnInputPart[];
36
+ /** Per-turn working directory override forwarded on `turn/start`. */
37
+ readonly cwd?: string;
62
38
  /** Per-turn model override forwarded on `turn/start`. */
63
39
  readonly model?: string;
64
40
  /**
@@ -77,11 +53,16 @@ export interface CodexTurnInput {
77
53
  /** Per-turn runtime workspace roots override. */
78
54
  readonly runtimeWorkspaceRoots?: readonly string[];
79
55
  }
56
+ /** Codex turn handle returned by {@link CodexSession.startTurn}, exposing the server-assigned `nativeTurnId`. */
57
+ export interface CodexTurn extends AgentEngineTurn {
58
+ /** Native turn identifier assigned by Codex in the `turn/start` response (`turn.id`). */
59
+ readonly nativeTurnId: string;
60
+ }
80
61
  /** Input to {@link CodexSession.steerTurn} (`turn/steer`). */
81
62
  export interface CodexSteerTurnInput {
82
- readonly input: readonly AgentMessagePart[];
63
+ readonly input: readonly CodexTurnInputPart[];
83
64
  readonly clientId?: string;
84
- /** Optional guard asserting which active Codex turn id is being steered. */
65
+ /** Active Codex turn id guard; required when steering an external/TUI turn without a local `startTurn()`. */
85
66
  readonly expectedTurnId?: string;
86
67
  }
87
68
  /** Options for {@link CodexSession.forkThread} (`thread/fork`). */
@@ -90,38 +71,124 @@ export interface CodexForkThreadOptions extends CodexThreadPolicyOverrides {
90
71
  readonly beforeTurnId?: string;
91
72
  readonly lastTurnId?: string;
92
73
  readonly excludeTurns?: boolean;
74
+ /** Carry the source thread's goal into the fork without starting automatic continuation. */
75
+ readonly deferGoalContinuation?: boolean;
76
+ }
77
+ /** Options to open a new {@link CodexSession} directly via `thread/fork` instead of `thread/start`. */
78
+ export interface CodexOpenForkOptions extends CodexThreadPolicyOverrides {
79
+ /** Existing thread id to fork from. */
80
+ readonly threadId: string;
81
+ readonly beforeTurnId?: string;
82
+ readonly lastTurnId?: string;
83
+ /** Defaults to `true` when omitted so large threads do not inline full history into the fork reply. */
84
+ readonly excludeTurns?: boolean;
85
+ /** Carry the source thread's goal into the fork without starting automatic continuation. */
86
+ readonly deferGoalContinuation?: boolean;
87
+ }
88
+ /** Input to {@link CodexDriver.open}, extending {@link AgentEngineDriver.open} with `forkFrom`. */
89
+ export interface CodexOpenInput {
90
+ readonly profile: ExecutorProfileConfig;
91
+ readonly cwd: string;
92
+ /** Resume this native thread via `thread/resume` (mutually exclusive with `forkFrom`). */
93
+ readonly nativeThreadId?: string;
94
+ /** Open the session by forking an existing thread via `thread/fork` (mutually exclusive with `nativeThreadId`). */
95
+ readonly forkFrom?: CodexOpenForkOptions;
96
+ /** Optional observer invoked with startup phases (`spawning`, `initializing`, `verifying`) during open. */
97
+ readonly onStartupPhase?: (phase: ExecutorStartupPhase) => void;
98
+ readonly signal?: AbortSignal;
93
99
  }
94
100
  /** Result returned by {@link CodexSession.forkThread} without mutating the current session. */
95
101
  export interface CodexForkedThread {
96
102
  readonly nativeThreadId: string;
97
103
  readonly threadContext: CodexThreadContext;
98
104
  }
99
- /** Extended Codex session handle exposing `providerPid`, applied `threadContext`, and live app-server controls. */
105
+ /** Extended Codex session handle exposing `providerPid`, `userAgent`, applied `threadContext`, and live app-server controls. */
100
106
  export interface CodexSession extends AgentEngineSession, CodexControlClient {
101
107
  /** OS process id of the spawned `codex app-server`, or `undefined` when attached via `unix-connect`. */
102
108
  readonly providerPid: number | undefined;
103
- /** Applied thread settings reported by `thread/start` or `thread/resume`. */
109
+ /** Server-reported `userAgent` from the `initialize` response, or `undefined` when omitted. */
110
+ readonly userAgent: string | undefined;
111
+ /** Applied thread settings reported by `thread/start`, `thread/resume`, or `thread/fork`. */
104
112
  readonly threadContext: CodexThreadContext;
105
- /** Start a turn with optional per-turn Codex overrides. */
106
- startTurn(input: CodexTurnInput): Promise<AgentEngineTurn>;
107
- /** Steer the currently running turn with additional input (`turn/steer`). */
108
- steerTurn(input: CodexSteerTurnInput): Promise<{
113
+ /** Start a turn with optional per-turn Codex overrides, `localImage`, and `skill` items; resolves with `nativeTurnId`. */
114
+ startTurn(input: CodexTurnInput): Promise<CodexTurn>;
115
+ /** Answer a pending request from either the active turn or an external/TUI server request. */
116
+ respond(interactionId: string, reply: InteractionReply['reply']): Promise<void>;
117
+ /** Read thread metadata (`thread/read`); defaults `threadId` to this session's `nativeThreadId`. */
118
+ readThread(params?: Omit<CodexReadThreadParams, 'threadId'> & {
119
+ readonly threadId?: string;
120
+ }): Promise<JsonRpcValue>;
121
+ /** List turns (`thread/turns/list`); defaults `threadId` to this session's `nativeThreadId`. */
122
+ listTurns(params?: Omit<CodexListTurnsParams, 'threadId'> & {
123
+ readonly threadId?: string;
124
+ }): Promise<JsonRpcValue>;
125
+ /** List items (`thread/items/list`); defaults `threadId` to this session's `nativeThreadId`. */
126
+ listItems(params?: Omit<CodexListItemsParams, 'threadId'> & {
127
+ readonly threadId?: string;
128
+ }): Promise<JsonRpcValue>;
129
+ /** Resume a thread (`thread/resume`, defaulting `excludeTurns` to `true`); defaults `threadId` to `nativeThreadId` and does not mutate cached `threadContext`. */
130
+ resumeThread(params?: Omit<CodexResumeThreadParams, 'threadId'> & {
131
+ readonly threadId?: string;
132
+ }): Promise<JsonRpcValue>;
133
+ /** Revert thread durable history before `beforeTurnId` (`thread/revert`); defaults `threadId` to `nativeThreadId`. */
134
+ revertThread(params: Omit<CodexRevertThreadParams, 'threadId'> & {
135
+ readonly threadId?: string;
136
+ }): Promise<CodexRevertThreadResult>;
137
+ /** Inject raw Responses API items (`thread/inject_items`); defaults `threadId` to `nativeThreadId`. */
138
+ injectItems(params: Omit<CodexInjectItemsParams, 'threadId'> & {
139
+ readonly threadId?: string;
140
+ }): Promise<JsonRpcValue>;
141
+ /** Unsubscribe this connection (`thread/unsubscribe`); defaults `threadId` to `nativeThreadId`. */
142
+ unsubscribeThread(params?: {
143
+ readonly threadId?: string;
144
+ }): Promise<JsonRpcValue>;
145
+ /** Archive a thread (`thread/archive`); defaults `threadId` to `nativeThreadId`. */
146
+ archiveThread(params?: {
147
+ readonly threadId?: string;
148
+ }): Promise<JsonRpcValue>;
149
+ /** Unarchive a thread (`thread/unarchive`); defaults `threadId` to `nativeThreadId`. */
150
+ unarchiveThread(params?: {
151
+ readonly threadId?: string;
152
+ }): Promise<JsonRpcValue>;
153
+ /** Patch thread metadata (`thread/metadata/update`); defaults `threadId` to `nativeThreadId`. */
154
+ updateThreadMetadata(params?: Omit<CodexUpdateThreadMetadataParams, 'threadId'> & {
155
+ readonly threadId?: string;
156
+ }): Promise<JsonRpcValue>;
157
+ /** Set thread display name (`thread/name/set`); defaults `threadId` to `nativeThreadId`. */
158
+ setThreadName(params: Omit<CodexSetThreadNameParams, 'threadId'> & {
159
+ readonly threadId?: string;
160
+ }): Promise<JsonRpcValue>;
161
+ /** Interrupt a running turn (`turn/interrupt`), including external/TUI or reconnected turns; defaults `threadId` to `nativeThreadId`. */
162
+ interruptTurn(params: Omit<CodexInterruptTurnParams, 'threadId'> & {
163
+ readonly threadId?: string;
164
+ }): Promise<void>;
165
+ /** Steer an active turn with additional input (`turn/steer`); accepts explicit `expectedTurnId` for external/TUI turns and optional `threadId`. */
166
+ steerTurn(input: CodexSteerTurnInput & {
167
+ readonly threadId?: string;
168
+ }): Promise<{
109
169
  readonly turnId: string;
110
170
  }>;
111
171
  /** Fork the session's thread into a new thread id without mutating the current session (`thread/fork`). */
112
172
  forkThread(options?: CodexForkThreadOptions): Promise<CodexForkedThread>;
113
- /** Request context compaction for the current thread (`thread/compact/start`). */
114
- compactThread(): Promise<void>;
173
+ /** Request context compaction (`thread/compact/start`); defaults `threadId` to `nativeThreadId`. */
174
+ compactThread(params?: {
175
+ readonly threadId?: string;
176
+ }): Promise<void>;
115
177
  }
116
- /** Codex driver returned by {@link createCodexDriver}; `open()` resolves to a {@link CodexSession}. */
178
+ /** Codex driver returned by {@link createCodexDriver}; `open()` resolves to {@link CodexSession} and `connectControl()` opens a threadless control link. */
117
179
  export interface CodexDriver extends AgentEngineDriver {
118
180
  readonly engine: 'codex';
119
181
  readonly reconcile: 'client-id';
182
+ readonly capabilities: ExecutorDriverCapabilities;
120
183
  findInput: NonNullable<AgentEngineDriver['findInput']>;
121
- open(input: Parameters<AgentEngineDriver['open']>[0]): Promise<CodexSession>;
184
+ open(input: CodexOpenInput): Promise<CodexSession>;
185
+ /** Connect to `codex app-server` without starting, resuming, or forking a thread. */
186
+ connectControl(input: CodexControlConnectInput): Promise<CodexControlConnection>;
187
+ /** Open a shared headless `stdio` `codex app-server` multiplexing multiple threads (ADR 0329). */
188
+ openSharedServer(input: CodexSharedServerOpenInput): Promise<CodexSharedServer>;
122
189
  }
123
- /** Encode validated host-inlined text and image parts into Codex app-server wire input items. */
124
- export declare function codexTurnInput(parts: readonly InlinedPart[]): JsonRpcValue[];
190
+ /** Validate `beforeTurnId` and `lastTurnId` mutual exclusion for `thread/fork`. */
191
+ export declare function validateCodexForkBounds(options: Pick<CodexForkThreadOptions, 'beforeTurnId' | 'lastTurnId'>, caller: string): void;
125
192
  /** Validate `runtimeWorkspaceRoots` and `config` policy overrides before sending them to Codex. */
126
193
  export declare function validateCodexPolicyOverrides(overrides: Pick<CodexThreadPolicyOverrides, 'runtimeWorkspaceRoots' | 'config'>, caller: string): void;
127
194
  /** Build JSON-RPC params for `thread/start`, `thread/resume`, or `thread/fork` from merged policy fields. */
@@ -129,13 +196,8 @@ export declare function buildCodexThreadPolicyParams(base: CodexThreadPolicyOver
129
196
  /** Validate per-turn overrides eagerly before host image files are read. */
130
197
  export declare function validateCodexTurnStartOverrides(turnInput: CodexTurnInput, activeModelProvider: string | undefined): void;
131
198
  /** Build validated `turn/start` RPC parameters from turn input and inlined parts. */
132
- export declare function buildCodexTurnStartParams(threadId: string, turnInput: CodexTurnInput, parts: readonly InlinedPart[], activeModelProvider: string | undefined): Record<string, JsonRpcValue>;
133
- /** Create the read/inspection control facade backed by an active Codex JSON-RPC peer. */
134
- export declare function createCodexControlClient(input: {
135
- peer: JsonRpcPeer;
136
- ensureAlive(): void;
137
- }): CodexControlClient;
138
- /** Create thread/turn control methods (`steerTurn`, `forkThread`, `compactThread`) for a live Codex session. */
199
+ export declare function buildCodexTurnStartParams(threadId: string, turnInput: CodexTurnInput, parts: readonly InlinedCodexPart[], activeModelProvider: string | undefined): Record<string, JsonRpcValue>;
200
+ /** Create session-bound turn/thread mutators (`steerTurn`, `forkThread`) for a live Codex session. */
139
201
  export declare function createCodexSessionMutators(input: {
140
202
  peer: JsonRpcPeer;
141
203
  threadId: string;
@@ -146,10 +208,11 @@ export declare function createCodexSessionMutators(input: {
146
208
  readonly codexTurnId?: string;
147
209
  } | undefined;
148
210
  }): {
149
- steerTurn(steerInput: CodexSteerTurnInput): Promise<{
211
+ steerTurn(steerInput: CodexSteerTurnInput & {
212
+ readonly threadId?: string;
213
+ }): Promise<{
150
214
  readonly turnId: string;
151
215
  }>;
152
216
  forkThread(options?: CodexForkThreadOptions): Promise<CodexForkedThread>;
153
- compactThread(): Promise<void>;
154
217
  };
155
218
  //# sourceMappingURL=session-controls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-controls.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/session-controls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACxF,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAe,MAAM,gBAAgB,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAElE,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAE3B,KAAK,gBAAgB,EAErB,KAAK,kBAAkB,EAGxB,MAAM,YAAY,CAAC;AAEpB,6GAA6G;AAC7G,MAAM,WAAW,0BAA0B;IACzC,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,6CAA6C;IAC7C,QAAQ,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IAC9C,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,CA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AC,CAuB9B;AAED,sGAAsG;AACtG,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,kBAAkB,CAAC;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,IAAI,IAAI,CAAC;IACpB,aAAa,IAAI;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;CAChE;IAES,SAAS,aACD,mBAAmB,GAAG;QAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/D,OAAO,CAAC;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IA0EjC,UAAU,WAAU,sBAAsB,GAAQ,OAAO,CAAC,iBAAiB,CAAC;EAuBrF"}
@@ -1,39 +1,13 @@
1
- import type { PlanLimits } from '../hello.js';
2
- import { type DriverImageOptions } from '../image-input.js';
3
- import { type JsonRpcValue } from '../json-rpc-peer.js';
4
- import { type ExecutorProfileConfig } from '../profile.js';
5
- import { type CodexConnectConfig } from './connect.js';
6
- import { type CodexThreadContext } from './protocol.js';
7
- import { type CodexControlClient, type CodexSession, type CodexThreadPolicyOverrides } from './session-controls.js';
8
- export interface CodexSessionConfig extends DriverImageOptions, CodexConnectConfig {
9
- readonly model?: string;
10
- readonly modelProvider?: string;
11
- readonly approvalPolicy: CodexThreadPolicyOverrides['approvalPolicy'];
12
- readonly sandbox: CodexThreadPolicyOverrides['sandbox'];
13
- readonly developerInstructions?: string;
14
- readonly runtimeWorkspaceRoots?: readonly string[];
15
- readonly config?: Readonly<Record<string, JsonRpcValue>>;
16
- readonly prepareThread?: (context: {
17
- readonly controls: CodexControlClient;
18
- readonly cwd: string;
19
- readonly nativeThreadId?: string;
20
- }) => Promise<CodexThreadPolicyOverrides | undefined> | CodexThreadPolicyOverrides | undefined;
21
- readonly verifyThread?: (context: {
22
- readonly nativeThreadId: string;
23
- readonly threadContext: CodexThreadContext;
24
- readonly controls: CodexControlClient;
25
- }) => Promise<void> | void;
26
- readonly limits: Map<string, PlanLimits>;
27
- }
1
+ import { type CodexControlConnectInput, type CodexControlConnection } from './control-client.js';
2
+ import { type CodexOpenInput, type CodexSession } from './session-controls.js';
3
+ import { type CodexSessionConfig } from './thread-open.js';
28
4
  /**
29
- * One app-server connection holding one thread. Server requests the driver knows
30
- * become `request` deltas answered by `respond`; any other is refused at once with
31
- * `-32601`, so no unanswered request hangs a turn.
5
+ * One app-server connection holding one thread. Server requests during `startTurn()` become
6
+ * `request` deltas answered by `respond` (and also reach `onServerRequest` when
7
+ * `serverRequestDelivery` is `'all'`); external/TUI requests route through `onServerRequest`
8
+ * when configured, and unknown methods are refused `-32601`.
32
9
  */
33
- export declare function openCodexSession(config: CodexSessionConfig, input: {
34
- profile: ExecutorProfileConfig;
35
- cwd: string;
36
- nativeThreadId?: string;
37
- signal?: AbortSignal;
38
- }): Promise<CodexSession>;
10
+ export declare function openCodexSession(config: CodexSessionConfig, input: CodexOpenInput): Promise<CodexSession>;
11
+ /** Open a threadless app-server connection (no `thread/start`) for metadata reads or external observation. */
12
+ export declare function openCodexControlConnection(config: CodexSessionConfig, input: CodexControlConnectInput): Promise<CodexControlConnection>;
39
13
  //# sourceMappingURL=session.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/session.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,KAAK,kBAAkB,EAAoB,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,YAAY,CAAC;AASvE,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,WAAW,CAAC;AAElE,OAAO,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CAAC,CAAC;CAC1C;AAiPD;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE;IACL,OAAO,EAAE,qBAAqB,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,GACA,OAAO,CAAC,YAAY,CAAC,CAmJvB"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/session.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAE5B,MAAM,kBAAkB,CAAC;AAa1B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EAGlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,YAAY,CAAC,CAqKvB;AAED,8GAA8G;AAC9G,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,sBAAsB,CAAC,CAmFjC"}
@@ -0,0 +1,31 @@
1
+ import type { ExecutorDriverCapabilities } from '../hello.js';
2
+ import { type ExecutorProfileConfig } from '../profile.js';
3
+ import type { ExecutorStartupPhase } from '../vocabulary.js';
4
+ import { type CodexControlClient } from './control-client.js';
5
+ import type { CodexSession } from './session-controls.js';
6
+ import { type CodexSharedServerThreadInput } from './shared-thread.js';
7
+ import { type CodexSessionConfig } from './thread-open.js';
8
+ /** Input to {@link CodexDriver.openSharedServer} for a headless multi-thread `codex app-server`. */
9
+ export interface CodexSharedServerOpenInput {
10
+ readonly profile: ExecutorProfileConfig;
11
+ readonly cwd: string;
12
+ /** Maximum concurrent open threads multiplexed on this shared server (`1..256`). Default `32`. */
13
+ readonly maxThreads?: number;
14
+ /** Optional observer invoked with startup phases (`spawning`, `initializing`) during server startup. */
15
+ readonly onStartupPhase?: (phase: ExecutorStartupPhase) => void;
16
+ readonly signal?: AbortSignal;
17
+ }
18
+ /** Shared headless `codex app-server` multiplexing up to `maxThreads` independent {@link CodexSession}s. */
19
+ export interface CodexSharedServer extends CodexControlClient {
20
+ readonly providerPid: number | undefined;
21
+ /** Server-reported `userAgent` from the `initialize` response, or `undefined` when omitted. */
22
+ readonly userAgent: string | undefined;
23
+ readonly maxThreads: number;
24
+ readonly activeThreadCount: number;
25
+ readonly capabilities: ExecutorDriverCapabilities;
26
+ openThread(input: CodexSharedServerThreadInput): Promise<CodexSession>;
27
+ close(): Promise<void>;
28
+ }
29
+ /** Open a single `stdio` `codex app-server` multiplexing up to `maxThreads` independent sessions. */
30
+ export declare function openCodexSharedServer(config: CodexSessionConfig, baseCapabilities: ExecutorDriverCapabilities, input: CodexSharedServerOpenInput): Promise<CodexSharedServer>;
31
+ //# sourceMappingURL=shared-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-server.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/shared-server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,KAAK,qBAAqB,EAAiB,MAAM,YAAY,CAAC;AAEvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,KAAK,kBAAkB,EAA4B,MAAM,kBAAkB,CAAC;AAGrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,KAAK,4BAA4B,EAIlC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,kBAAkB,EAA2B,MAAM,eAAe,CAAC;AAKjF,oGAAoG;AACpG,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,kGAAkG;IAClG,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wGAAwG;IACxG,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAChE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,4GAA4G;AAC5G,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,0BAA0B,CAAC;IAClD,UAAU,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACvE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AA6CD,qGAAqG;AACrG,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,kBAAkB,EAC1B,gBAAgB,EAAE,0BAA0B,EAC5C,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,iBAAiB,CAAC,CA8I5B"}
@@ -0,0 +1,46 @@
1
+ import type { JsonRpcPeer } from '../json-rpc-peer.js';
2
+ import type { ExecutorProfileConfig } from '../profile.js';
3
+ import type { ExecutorStartupPhase } from '../vocabulary.js';
4
+ import { createCodexHandlers } from './handlers.js';
5
+ import { type CodexTurnSlot, type PendingExternalCodexRequest } from './request-answers.js';
6
+ import { type CodexOpenForkOptions, type CodexSession } from './session-controls.js';
7
+ import { type CodexSessionConfig } from './thread-open.js';
8
+ /** Input to {@link CodexSharedServer.openThread} for opening one thread over a shared server. */
9
+ export interface CodexSharedServerThreadInput {
10
+ readonly cwd: string;
11
+ /** Resume this native thread via `thread/resume` (mutually exclusive with `forkFrom`). */
12
+ readonly nativeThreadId?: string;
13
+ /** Open the thread by forking an existing thread via `thread/fork` (mutually exclusive with `nativeThreadId`). */
14
+ readonly forkFrom?: CodexOpenForkOptions;
15
+ /** Optional observer invoked with startup phases (`verifying`) during thread open. */
16
+ readonly onStartupPhase?: (phase: ExecutorStartupPhase) => void;
17
+ readonly signal?: AbortSignal;
18
+ }
19
+ export interface SharedThreadSlot {
20
+ readonly threadId: string;
21
+ current: CodexTurnSlot | undefined;
22
+ readonly externalPending: Map<string, PendingExternalCodexRequest>;
23
+ readonly handlers: ReturnType<typeof createCodexHandlers>;
24
+ closed: boolean;
25
+ dead: Error | undefined;
26
+ readonly abortThread: () => void;
27
+ readonly releaseThreadSignal: () => void;
28
+ }
29
+ export interface SharedServerState {
30
+ readonly config: CodexSessionConfig;
31
+ readonly profile: ExecutorProfileConfig;
32
+ readonly peer: JsonRpcPeer;
33
+ readonly providerPid: number | undefined;
34
+ readonly userAgent: string | undefined;
35
+ readonly maxThreads: number;
36
+ readonly onBeforeInterruptTurn: (threadId: string, turnId: string) => void;
37
+ readonly serverSignal: AbortSignal;
38
+ readonly threads: Map<string, SharedThreadSlot>;
39
+ readonly openingNativeThreadIds: Set<string>;
40
+ openingThreads: number;
41
+ readonly isServerClosing: () => boolean;
42
+ readonly getServerDead: () => Error | undefined;
43
+ readonly ensureServerAlive: () => void;
44
+ }
45
+ export declare function openSharedCodexThread(state: SharedServerState, threadInput: CodexSharedServerThreadInput): Promise<CodexSession>;
46
+ //# sourceMappingURL=shared-thread.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-thread.d.ts","sourceRoot":"","sources":["../../../src/agent-executor/codex/shared-thread.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAA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