@claudexor/orchestrator 4.8.1 → 5.0.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 (223) hide show
  1. package/dist/account-pool.d.ts +4 -1
  2. package/dist/account-pool.d.ts.map +1 -1
  3. package/dist/account-pool.js +25 -19
  4. package/dist/account-pool.js.map +1 -1
  5. package/dist/account-resolution.d.ts +1 -4
  6. package/dist/account-resolution.d.ts.map +1 -1
  7. package/dist/account-resolution.js +19 -42
  8. package/dist/account-resolution.js.map +1 -1
  9. package/dist/attemptOutputMarkers.d.ts +7 -0
  10. package/dist/attemptOutputMarkers.d.ts.map +1 -1
  11. package/dist/attemptOutputMarkers.js +1 -1
  12. package/dist/attemptOutputMarkers.js.map +1 -1
  13. package/dist/attemptTelemetry.d.ts +4 -1
  14. package/dist/attemptTelemetry.d.ts.map +1 -1
  15. package/dist/attemptTelemetry.js +9 -26
  16. package/dist/attemptTelemetry.js.map +1 -1
  17. package/dist/candidateEvidence.d.ts +12 -9
  18. package/dist/candidateEvidence.d.ts.map +1 -1
  19. package/dist/candidateEvidence.js +38 -13
  20. package/dist/candidateEvidence.js.map +1 -1
  21. package/dist/candidateOutputs.d.ts +44 -22
  22. package/dist/candidateOutputs.d.ts.map +1 -1
  23. package/dist/candidateOutputs.js +116 -72
  24. package/dist/candidateOutputs.js.map +1 -1
  25. package/dist/candidateReview.d.ts.map +1 -1
  26. package/dist/candidateReview.js +44 -8
  27. package/dist/candidateReview.js.map +1 -1
  28. package/dist/candidateTerminals.d.ts +1 -0
  29. package/dist/candidateTerminals.d.ts.map +1 -1
  30. package/dist/candidateTerminals.js +11 -6
  31. package/dist/candidateTerminals.js.map +1 -1
  32. package/dist/candidateWorkProduct.d.ts +2 -1
  33. package/dist/candidateWorkProduct.d.ts.map +1 -1
  34. package/dist/candidateWorkProduct.js +6 -3
  35. package/dist/candidateWorkProduct.js.map +1 -1
  36. package/dist/captureRefusal.d.ts +29 -1
  37. package/dist/captureRefusal.d.ts.map +1 -1
  38. package/dist/captureRefusal.js +114 -8
  39. package/dist/captureRefusal.js.map +1 -1
  40. package/dist/continuation-chain.test-support.d.ts +473 -0
  41. package/dist/continuation-chain.test-support.d.ts.map +1 -0
  42. package/dist/continuation-chain.test-support.js +206 -0
  43. package/dist/continuation-chain.test-support.js.map +1 -0
  44. package/dist/continuation-custody.d.ts +4 -1
  45. package/dist/continuation-custody.d.ts.map +1 -1
  46. package/dist/continuation-custody.js +68 -28
  47. package/dist/continuation-custody.js.map +1 -1
  48. package/dist/continuation-evidence-io.d.ts +30 -4
  49. package/dist/continuation-evidence-io.d.ts.map +1 -1
  50. package/dist/continuation-evidence-io.js +162 -46
  51. package/dist/continuation-evidence-io.js.map +1 -1
  52. package/dist/continuation-evidence.d.ts +40 -3
  53. package/dist/continuation-evidence.d.ts.map +1 -1
  54. package/dist/continuation-evidence.js +85 -11
  55. package/dist/continuation-evidence.js.map +1 -1
  56. package/dist/continuation-input.d.ts +10 -1
  57. package/dist/continuation-input.d.ts.map +1 -1
  58. package/dist/continuation-input.js +21 -20
  59. package/dist/continuation-input.js.map +1 -1
  60. package/dist/continuation-later.d.ts +30 -0
  61. package/dist/continuation-later.d.ts.map +1 -0
  62. package/dist/continuation-later.js +108 -0
  63. package/dist/continuation-later.js.map +1 -0
  64. package/dist/continue-from.d.ts +4 -3
  65. package/dist/continue-from.d.ts.map +1 -1
  66. package/dist/continue-from.js +62 -26
  67. package/dist/continue-from.js.map +1 -1
  68. package/dist/continuity-notice.d.ts +3 -1
  69. package/dist/continuity-notice.d.ts.map +1 -1
  70. package/dist/continuity-notice.js +3 -1
  71. package/dist/continuity-notice.js.map +1 -1
  72. package/dist/continuity-terminal.d.ts +16 -0
  73. package/dist/continuity-terminal.d.ts.map +1 -1
  74. package/dist/continuity-terminal.js +21 -0
  75. package/dist/continuity-terminal.js.map +1 -1
  76. package/dist/continuity.d.ts +1 -1
  77. package/dist/continuity.d.ts.map +1 -1
  78. package/dist/contract-gates.d.ts.map +1 -1
  79. package/dist/contract-gates.js +11 -6
  80. package/dist/contract-gates.js.map +1 -1
  81. package/dist/credential-cooldown.d.ts +2 -1
  82. package/dist/credential-cooldown.d.ts.map +1 -1
  83. package/dist/credential-cooldown.js +16 -7
  84. package/dist/credential-cooldown.js.map +1 -1
  85. package/dist/credential-preflight.d.ts.map +1 -1
  86. package/dist/credential-preflight.js +10 -7
  87. package/dist/credential-preflight.js.map +1 -1
  88. package/dist/credential-profile-rotation.d.ts +10 -3
  89. package/dist/credential-profile-rotation.d.ts.map +1 -1
  90. package/dist/credential-profile-rotation.js +28 -26
  91. package/dist/credential-profile-rotation.js.map +1 -1
  92. package/dist/deepScanReducer.d.ts +0 -3
  93. package/dist/deepScanReducer.d.ts.map +1 -1
  94. package/dist/deepScanReducer.js +22 -26
  95. package/dist/deepScanReducer.js.map +1 -1
  96. package/dist/delegationFailure.d.ts +34 -5
  97. package/dist/delegationFailure.d.ts.map +1 -1
  98. package/dist/delegationFailure.js +6 -4
  99. package/dist/delegationFailure.js.map +1 -1
  100. package/dist/delegationToolEvidence.d.ts +2 -0
  101. package/dist/delegationToolEvidence.d.ts.map +1 -1
  102. package/dist/delegationToolEvidence.js +21 -0
  103. package/dist/delegationToolEvidence.js.map +1 -1
  104. package/dist/diffReview.d.ts +1 -8
  105. package/dist/diffReview.d.ts.map +1 -1
  106. package/dist/diffReview.js +3 -18
  107. package/dist/diffReview.js.map +1 -1
  108. package/dist/directoryCandidate.d.ts +1 -1
  109. package/dist/directoryCandidate.d.ts.map +1 -1
  110. package/dist/directoryCandidate.js +13 -13
  111. package/dist/directoryCandidate.js.map +1 -1
  112. package/dist/inrun-continuity-carrier.d.ts +11 -1
  113. package/dist/inrun-continuity-carrier.d.ts.map +1 -1
  114. package/dist/inrun-continuity-carrier.js +32 -10
  115. package/dist/inrun-continuity-carrier.js.map +1 -1
  116. package/dist/inrun-continuity-types.d.ts +17 -4
  117. package/dist/inrun-continuity-types.d.ts.map +1 -1
  118. package/dist/inrun-continuity.d.ts +8 -3
  119. package/dist/inrun-continuity.d.ts.map +1 -1
  120. package/dist/inrun-continuity.js +41 -37
  121. package/dist/inrun-continuity.js.map +1 -1
  122. package/dist/inrun-continuity.test-support.d.ts +69 -4
  123. package/dist/inrun-continuity.test-support.d.ts.map +1 -1
  124. package/dist/inrun-continuity.test-support.js +12 -2
  125. package/dist/inrun-continuity.test-support.js.map +1 -1
  126. package/dist/modelGovernance.d.ts +87 -9
  127. package/dist/modelGovernance.d.ts.map +1 -1
  128. package/dist/modelGovernance.js +110 -15
  129. package/dist/modelGovernance.js.map +1 -1
  130. package/dist/orchestrator-credentials.d.ts +9 -4
  131. package/dist/orchestrator-credentials.d.ts.map +1 -1
  132. package/dist/orchestrator-credentials.js +14 -6
  133. package/dist/orchestrator-credentials.js.map +1 -1
  134. package/dist/orchestrator.d.ts +1 -2
  135. package/dist/orchestrator.d.ts.map +1 -1
  136. package/dist/orchestrator.js +248 -224
  137. package/dist/orchestrator.js.map +1 -1
  138. package/dist/planFinalize.d.ts.map +1 -1
  139. package/dist/planFinalize.js +3 -7
  140. package/dist/planFinalize.js.map +1 -1
  141. package/dist/planRun.js +2 -2
  142. package/dist/planRun.js.map +1 -1
  143. package/dist/plannerAttempt.d.ts +0 -2
  144. package/dist/plannerAttempt.d.ts.map +1 -1
  145. package/dist/plannerAttempt.js +64 -30
  146. package/dist/plannerAttempt.js.map +1 -1
  147. package/dist/policyFindings.d.ts +3 -0
  148. package/dist/policyFindings.d.ts.map +1 -1
  149. package/dist/policyFindings.js +11 -1
  150. package/dist/policyFindings.js.map +1 -1
  151. package/dist/pool-attempt-evidence.d.ts +1 -1
  152. package/dist/pool-attempt-evidence.d.ts.map +1 -1
  153. package/dist/pool-attempt-evidence.js +1 -1
  154. package/dist/pool-attempt-evidence.js.map +1 -1
  155. package/dist/primary-divergence.d.ts +7 -2
  156. package/dist/primary-divergence.d.ts.map +1 -1
  157. package/dist/primary-divergence.js +13 -5
  158. package/dist/primary-divergence.js.map +1 -1
  159. package/dist/quota-refusal-scope.d.ts +39 -1
  160. package/dist/quota-refusal-scope.d.ts.map +1 -1
  161. package/dist/quota-refusal-scope.js +95 -1
  162. package/dist/quota-refusal-scope.js.map +1 -1
  163. package/dist/readonlyTerminals.d.ts +0 -1
  164. package/dist/readonlyTerminals.d.ts.map +1 -1
  165. package/dist/readonlyTerminals.js +5 -3
  166. package/dist/readonlyTerminals.js.map +1 -1
  167. package/dist/requestRequirements.d.ts +23 -0
  168. package/dist/requestRequirements.d.ts.map +1 -1
  169. package/dist/requestRequirements.js +22 -0
  170. package/dist/requestRequirements.js.map +1 -1
  171. package/dist/resultNotice.d.ts +14 -0
  172. package/dist/resultNotice.d.ts.map +1 -0
  173. package/dist/resultNotice.js +21 -0
  174. package/dist/resultNotice.js.map +1 -0
  175. package/dist/reviewerInventory.d.ts +47 -0
  176. package/dist/reviewerInventory.d.ts.map +1 -0
  177. package/dist/reviewerInventory.js +74 -0
  178. package/dist/reviewerInventory.js.map +1 -0
  179. package/dist/reviewerPanel.d.ts.map +1 -1
  180. package/dist/reviewerPanel.js +37 -60
  181. package/dist/reviewerPanel.js.map +1 -1
  182. package/dist/routing-failure.d.ts +2 -1
  183. package/dist/routing-failure.d.ts.map +1 -1
  184. package/dist/routing-failure.js +2 -0
  185. package/dist/routing-failure.js.map +1 -1
  186. package/dist/runAdmission.d.ts.map +1 -1
  187. package/dist/runAdmission.js +1 -14
  188. package/dist/runAdmission.js.map +1 -1
  189. package/dist/runEventLog.js +2 -2
  190. package/dist/runEventLog.js.map +1 -1
  191. package/dist/runFactsBuilder.d.ts.map +1 -1
  192. package/dist/runFactsBuilder.js +18 -10
  193. package/dist/runFactsBuilder.js.map +1 -1
  194. package/dist/runFactsDeliverable.d.ts.map +1 -1
  195. package/dist/runFactsDeliverable.js +7 -1
  196. package/dist/runFactsDeliverable.js.map +1 -1
  197. package/dist/runSupport.d.ts +5 -10
  198. package/dist/runSupport.d.ts.map +1 -1
  199. package/dist/runSupport.js +40 -40
  200. package/dist/runSupport.js.map +1 -1
  201. package/dist/runTerminalResults.d.ts +9 -1
  202. package/dist/runTerminalResults.d.ts.map +1 -1
  203. package/dist/runTerminalResults.js +27 -5
  204. package/dist/runTerminalResults.js.map +1 -1
  205. package/dist/savedCandidate.d.ts +43 -0
  206. package/dist/savedCandidate.d.ts.map +1 -0
  207. package/dist/savedCandidate.js +88 -0
  208. package/dist/savedCandidate.js.map +1 -0
  209. package/dist/secretDiff.d.ts +85 -46
  210. package/dist/secretDiff.d.ts.map +1 -1
  211. package/dist/secretDiff.js +123 -126
  212. package/dist/secretDiff.js.map +1 -1
  213. package/dist/task-contract-builder.d.ts.map +1 -1
  214. package/dist/task-contract-builder.js +5 -7
  215. package/dist/task-contract-builder.js.map +1 -1
  216. package/dist/workReportEnvelope.d.ts.map +1 -1
  217. package/dist/workReportEnvelope.js +4 -16
  218. package/dist/workReportEnvelope.js.map +1 -1
  219. package/package.json +17 -17
  220. package/dist/persistedPatch.d.ts +0 -55
  221. package/dist/persistedPatch.d.ts.map +0 -1
  222. package/dist/persistedPatch.js +0 -132
  223. package/dist/persistedPatch.js.map +0 -1
@@ -0,0 +1,473 @@
1
+ import type { HarnessAdapter, HarnessContinuityCapability } from "@claudexor/core";
2
+ import { type HarnessEvent, type HarnessRunSpec, type RunEvent } from "@claudexor/schema";
3
+ import { type OrchestratorResult, type RunInput } from "./orchestrator.js";
4
+ import type { RunContinuation } from "./continuation-custody.js";
5
+ export declare const WORK_ORDER = "WORK-ORDER-7f3a: build the dashboard";
6
+ export interface ChainSpawn {
7
+ label: string;
8
+ nth: number;
9
+ profile: string;
10
+ resume: string | null;
11
+ prompt: string;
12
+ model: string | null;
13
+ cwd: string;
14
+ }
15
+ export type Emit = (ev: Partial<HarnessEvent>) => HarnessEvent;
16
+ export type ChainScript = (ctx: ChainSpawn & {
17
+ spec: HarnessRunSpec;
18
+ emit: Emit;
19
+ seed: (sid: string) => void;
20
+ }) => Generator<HarnessEvent>;
21
+ export interface ChainFixture {
22
+ root: string;
23
+ stores: Record<string, string>;
24
+ spawns: ChainSpawn[];
25
+ adapter: HarnessAdapter;
26
+ label: {
27
+ current: string;
28
+ };
29
+ }
30
+ /** A movable fake store: sessions live under `<locator>/sessions/<sid>.jsonl`. */
31
+ export declare function movableStore(retire?: (file: string) => void): HarnessContinuityCapability;
32
+ export declare function chainFixture(opts: {
33
+ profiles: string[];
34
+ maxRetries?: number;
35
+ fallbackModel?: string;
36
+ continuity?: HarnessContinuityCapability;
37
+ }, script: ChainScript): ChainFixture;
38
+ export interface ChainRun {
39
+ result: OrchestratorResult;
40
+ events: RunEvent[];
41
+ receipts: Record<string, unknown>[];
42
+ resumable: Record<string, unknown> | undefined;
43
+ }
44
+ export declare function runLabelled(f: ChainFixture, label: string, input: Partial<RunInput>): Promise<ChainRun>;
45
+ /** The facts the daemon resolves for a successor of `pred` (its own ancestors first). */
46
+ export declare function continuing(pred: ChainRun, workOrder: string, ancestors?: ChainRun[], over?: Partial<NonNullable<RunContinuation["from"]>>): RunContinuation;
47
+ export declare const limitStop: (emit: Emit) => {
48
+ account_usage?: {
49
+ code: string;
50
+ detail: string | null;
51
+ }[] | undefined;
52
+ quota?: {
53
+ source: "agy_command_usage" | "claude_api_retry" | "claude_oauth_usage" | "claude_rate_limit_event" | "claude_statusline" | "codex_app_server" | "codex_app_server_event" | "codex_image_response" | "codex_rollout" | "cursor_rate_limit" | "grok_rate_limit";
54
+ plan_label: string | null;
55
+ subject_id: string | null;
56
+ constraints: {
57
+ id: string;
58
+ label: string;
59
+ applies_to_models?: string[] | null | undefined;
60
+ applies_to_model_prefixes?: string[] | undefined;
61
+ applies_to_unspecified_model?: boolean | undefined;
62
+ applies_to_request_kinds?: ("image" | "text")[] | undefined;
63
+ used_ratio: number | null;
64
+ window_seconds: number | null;
65
+ resets_at: string | null;
66
+ cooldown_until: string | null;
67
+ }[];
68
+ } | undefined;
69
+ observed_model?: string | undefined;
70
+ observed_model_catalog_match?: {
71
+ label: string;
72
+ id: string;
73
+ source: "account_catalog";
74
+ profile_id: string | null;
75
+ } | undefined;
76
+ speech?: {
77
+ key: string;
78
+ op: "abandoned" | "complete" | "fragment";
79
+ } | undefined;
80
+ request_refusal?: {
81
+ scope: "turn_text";
82
+ unit: "unicode_scalars";
83
+ source: string;
84
+ kind: "input_too_large";
85
+ limit: number | null;
86
+ actual: number | null;
87
+ native_code: string;
88
+ } | {
89
+ kind: "vendor_cli_too_old";
90
+ native_code: "claude_code_version_too_old";
91
+ source: "claude_stdout";
92
+ binary_path: string | null;
93
+ installed_version: string | null;
94
+ } | {
95
+ kind: "credential_source_unconfirmed";
96
+ native_code: "grok_credential_source_unconfirmed";
97
+ source: "grok_init";
98
+ reported_source: string;
99
+ } | undefined;
100
+ effort_resolution?: {
101
+ requested: string | null;
102
+ submitted: string | null;
103
+ resolution: "downward" | "exact" | "floor" | "omitted" | "rejected" | "unverifiable";
104
+ source: "account_catalog" | "adapter" | "live_probe" | "versioned_snapshot";
105
+ parameter: string | null;
106
+ observed: string | null;
107
+ observedSource: string | null;
108
+ reason?: string | undefined;
109
+ } | undefined;
110
+ processing?: {
111
+ requested: "economy" | "fast" | "standard" | null;
112
+ submitted: "economy" | "fast" | "standard" | null;
113
+ submittedNative: string | null;
114
+ observed: "economy" | "fast" | "mixed" | "standard" | "unknown";
115
+ observedNative: string[];
116
+ reason: string | null;
117
+ source: string;
118
+ } | undefined;
119
+ processing_cost_basis?: {
120
+ nativeMode: string | null;
121
+ kind: "cash" | "included" | "paid_credits" | "unknown" | "valuation";
122
+ source: string;
123
+ debit?: "unobserved" | undefined;
124
+ } | undefined;
125
+ prompt_cache_ttl?: {
126
+ requested: "1h" | "5m" | null;
127
+ submitted: "1h" | "5m" | null;
128
+ reason: string | null;
129
+ observed: "1h" | "5m" | "mixed" | "none" | "unknown";
130
+ write_5m_tokens: number | null;
131
+ write_1h_tokens: number | null;
132
+ } | undefined;
133
+ type: "completed" | "context" | "error" | "file_change" | "interaction_requested" | "message" | "patch_produced" | "started" | "status" | "thinking" | "tool_call" | "tool_result" | "usage";
134
+ session_id: string;
135
+ ts: string;
136
+ text?: string | undefined;
137
+ final?: boolean | undefined;
138
+ tool?: {
139
+ name: string;
140
+ kind: "command" | "file" | "mcp" | "other" | "search" | "web";
141
+ use_id?: string | undefined;
142
+ target?: string | undefined;
143
+ status?: "cancelled" | "denied" | "error" | "ok" | undefined;
144
+ phase?: "completed" | "started" | undefined;
145
+ error_summary?: string | undefined;
146
+ content_summary?: string | undefined;
147
+ exit_code?: number | undefined;
148
+ command_outcome?: {
149
+ state: "backgrounded" | "exited" | "timed_out" | "unknown";
150
+ signal?: string | undefined;
151
+ timeout_ms?: number | undefined;
152
+ background_reason?: "requested" | "timeout" | undefined;
153
+ shell_id?: string | undefined;
154
+ pid?: number | undefined;
155
+ } | undefined;
156
+ web_retrieval?: "dispatched" | "failed" | "verified" | undefined;
157
+ } | undefined;
158
+ interaction?: {
159
+ interaction_id: string;
160
+ questions: {
161
+ id: string;
162
+ question: string;
163
+ header: string | null;
164
+ options: {
165
+ label: string;
166
+ description: string | null;
167
+ }[];
168
+ multi_select: boolean;
169
+ }[];
170
+ source_tool: string | null;
171
+ } | undefined;
172
+ patch_envelope?: {
173
+ schema_version: 1;
174
+ context_packet_hash: string;
175
+ base_tree_sha: string;
176
+ patch: string;
177
+ patch_hash: string;
178
+ touched_paths: {
179
+ path: string;
180
+ expected_blob_oid: string | null;
181
+ }[];
182
+ } | undefined;
183
+ refusal_code?: "raw_context_exceeds_window" | "raw_patch_apply_failed" | "raw_patch_base_mismatch" | "raw_patch_binary_unsupported" | "raw_patch_digest_mismatch" | "raw_patch_missing_evidence" | "raw_patch_outside_scope" | "raw_patch_path_traversal" | "raw_patch_requires_isolation" | "raw_patch_stale_preimage" | "raw_patch_truncated" | undefined;
184
+ raw_context?: {
185
+ model: string;
186
+ estimated_request_tokens: number;
187
+ budget: {
188
+ estimator: "chars_div_4";
189
+ basis: "assumed_ceiling" | "model_context_window";
190
+ model: string | null;
191
+ context_window: number | null;
192
+ output_allowance_tokens: number | null;
193
+ framing_tokens: number | null;
194
+ selection_limit_tokens: number;
195
+ estimated_packet_tokens: number;
196
+ omitted_for_budget: number;
197
+ mandatory_paths: string[];
198
+ };
199
+ } | undefined;
200
+ permission_denial?: {
201
+ permission: string;
202
+ source: string;
203
+ } | undefined;
204
+ usage?: {
205
+ input_tokens?: number | undefined;
206
+ output_tokens?: number | undefined;
207
+ cached_input_tokens?: number | undefined;
208
+ input_token_usage?: {
209
+ total_tokens: number | null;
210
+ cache_read_tokens: number | null;
211
+ cache_write_tokens: number | null;
212
+ } | undefined;
213
+ cost_usd?: number | undefined;
214
+ cost_basis?: {
215
+ kind: "cash" | "unknown" | "valuation";
216
+ source: string;
217
+ } | undefined;
218
+ estimated?: boolean | undefined;
219
+ } | undefined;
220
+ credential_route?: "local" | "managed_api_key" | "vendor_native" | undefined;
221
+ credential_source?: "api_key_env" | "api_key_flag" | "native_session" | "none" | "oauth_token_env" | "provider_auth_file" | undefined;
222
+ credential_profile_id?: string | undefined;
223
+ plan_progress?: {
224
+ items: {
225
+ id: string;
226
+ title: string;
227
+ status: "completed" | "in_progress" | "pending";
228
+ }[];
229
+ } | undefined;
230
+ rate_limit?: {
231
+ constraint_id?: string | undefined;
232
+ applies_to_request_kinds?: ("image" | "text")[] | undefined;
233
+ applies_to_models?: string[] | null | undefined;
234
+ applies_to_model_prefixes?: string[] | undefined;
235
+ resets_at: string | null;
236
+ retry_delay_ms: number | null;
237
+ } | undefined;
238
+ status?: {
239
+ kind: "api_retry";
240
+ attempt?: number | undefined;
241
+ max_retries?: number | undefined;
242
+ retry_delay_ms?: number | undefined;
243
+ error_category?: "authentication_failed" | "billing_error" | "invalid_request" | "max_output_tokens" | "model_not_found" | "oauth_org_not_allowed" | "overloaded" | "rate_limit" | "server_error" | "timeout" | "unknown" | undefined;
244
+ } | undefined;
245
+ transient?: {
246
+ kind: "network" | "service_unavailable" | "stream_disconnect" | "timeout" | "unknown";
247
+ retry_delay_ms: number | null;
248
+ } | undefined;
249
+ context?: {
250
+ kind: "capacity_exhausted" | "compaction_completed" | "compaction_started";
251
+ cause: "blocking_limit" | "prompt_too_long" | "repeated_refill" | "unknown" | "window_exceeded";
252
+ native_code: string | null;
253
+ trigger: "auto" | "manual" | null;
254
+ pre_tokens: number | null;
255
+ } | undefined;
256
+ error?: string | undefined;
257
+ aborted?: boolean | undefined;
258
+ payload?: Record<string, unknown> | undefined;
259
+ }[];
260
+ export declare const crash: (emit: Emit) => {
261
+ account_usage?: {
262
+ code: string;
263
+ detail: string | null;
264
+ }[] | undefined;
265
+ quota?: {
266
+ source: "agy_command_usage" | "claude_api_retry" | "claude_oauth_usage" | "claude_rate_limit_event" | "claude_statusline" | "codex_app_server" | "codex_app_server_event" | "codex_image_response" | "codex_rollout" | "cursor_rate_limit" | "grok_rate_limit";
267
+ plan_label: string | null;
268
+ subject_id: string | null;
269
+ constraints: {
270
+ id: string;
271
+ label: string;
272
+ applies_to_models?: string[] | null | undefined;
273
+ applies_to_model_prefixes?: string[] | undefined;
274
+ applies_to_unspecified_model?: boolean | undefined;
275
+ applies_to_request_kinds?: ("image" | "text")[] | undefined;
276
+ used_ratio: number | null;
277
+ window_seconds: number | null;
278
+ resets_at: string | null;
279
+ cooldown_until: string | null;
280
+ }[];
281
+ } | undefined;
282
+ observed_model?: string | undefined;
283
+ observed_model_catalog_match?: {
284
+ label: string;
285
+ id: string;
286
+ source: "account_catalog";
287
+ profile_id: string | null;
288
+ } | undefined;
289
+ speech?: {
290
+ key: string;
291
+ op: "abandoned" | "complete" | "fragment";
292
+ } | undefined;
293
+ request_refusal?: {
294
+ scope: "turn_text";
295
+ unit: "unicode_scalars";
296
+ source: string;
297
+ kind: "input_too_large";
298
+ limit: number | null;
299
+ actual: number | null;
300
+ native_code: string;
301
+ } | {
302
+ kind: "vendor_cli_too_old";
303
+ native_code: "claude_code_version_too_old";
304
+ source: "claude_stdout";
305
+ binary_path: string | null;
306
+ installed_version: string | null;
307
+ } | {
308
+ kind: "credential_source_unconfirmed";
309
+ native_code: "grok_credential_source_unconfirmed";
310
+ source: "grok_init";
311
+ reported_source: string;
312
+ } | undefined;
313
+ effort_resolution?: {
314
+ requested: string | null;
315
+ submitted: string | null;
316
+ resolution: "downward" | "exact" | "floor" | "omitted" | "rejected" | "unverifiable";
317
+ source: "account_catalog" | "adapter" | "live_probe" | "versioned_snapshot";
318
+ parameter: string | null;
319
+ observed: string | null;
320
+ observedSource: string | null;
321
+ reason?: string | undefined;
322
+ } | undefined;
323
+ processing?: {
324
+ requested: "economy" | "fast" | "standard" | null;
325
+ submitted: "economy" | "fast" | "standard" | null;
326
+ submittedNative: string | null;
327
+ observed: "economy" | "fast" | "mixed" | "standard" | "unknown";
328
+ observedNative: string[];
329
+ reason: string | null;
330
+ source: string;
331
+ } | undefined;
332
+ processing_cost_basis?: {
333
+ nativeMode: string | null;
334
+ kind: "cash" | "included" | "paid_credits" | "unknown" | "valuation";
335
+ source: string;
336
+ debit?: "unobserved" | undefined;
337
+ } | undefined;
338
+ prompt_cache_ttl?: {
339
+ requested: "1h" | "5m" | null;
340
+ submitted: "1h" | "5m" | null;
341
+ reason: string | null;
342
+ observed: "1h" | "5m" | "mixed" | "none" | "unknown";
343
+ write_5m_tokens: number | null;
344
+ write_1h_tokens: number | null;
345
+ } | undefined;
346
+ type: "completed" | "context" | "error" | "file_change" | "interaction_requested" | "message" | "patch_produced" | "started" | "status" | "thinking" | "tool_call" | "tool_result" | "usage";
347
+ session_id: string;
348
+ ts: string;
349
+ text?: string | undefined;
350
+ final?: boolean | undefined;
351
+ tool?: {
352
+ name: string;
353
+ kind: "command" | "file" | "mcp" | "other" | "search" | "web";
354
+ use_id?: string | undefined;
355
+ target?: string | undefined;
356
+ status?: "cancelled" | "denied" | "error" | "ok" | undefined;
357
+ phase?: "completed" | "started" | undefined;
358
+ error_summary?: string | undefined;
359
+ content_summary?: string | undefined;
360
+ exit_code?: number | undefined;
361
+ command_outcome?: {
362
+ state: "backgrounded" | "exited" | "timed_out" | "unknown";
363
+ signal?: string | undefined;
364
+ timeout_ms?: number | undefined;
365
+ background_reason?: "requested" | "timeout" | undefined;
366
+ shell_id?: string | undefined;
367
+ pid?: number | undefined;
368
+ } | undefined;
369
+ web_retrieval?: "dispatched" | "failed" | "verified" | undefined;
370
+ } | undefined;
371
+ interaction?: {
372
+ interaction_id: string;
373
+ questions: {
374
+ id: string;
375
+ question: string;
376
+ header: string | null;
377
+ options: {
378
+ label: string;
379
+ description: string | null;
380
+ }[];
381
+ multi_select: boolean;
382
+ }[];
383
+ source_tool: string | null;
384
+ } | undefined;
385
+ patch_envelope?: {
386
+ schema_version: 1;
387
+ context_packet_hash: string;
388
+ base_tree_sha: string;
389
+ patch: string;
390
+ patch_hash: string;
391
+ touched_paths: {
392
+ path: string;
393
+ expected_blob_oid: string | null;
394
+ }[];
395
+ } | undefined;
396
+ refusal_code?: "raw_context_exceeds_window" | "raw_patch_apply_failed" | "raw_patch_base_mismatch" | "raw_patch_binary_unsupported" | "raw_patch_digest_mismatch" | "raw_patch_missing_evidence" | "raw_patch_outside_scope" | "raw_patch_path_traversal" | "raw_patch_requires_isolation" | "raw_patch_stale_preimage" | "raw_patch_truncated" | undefined;
397
+ raw_context?: {
398
+ model: string;
399
+ estimated_request_tokens: number;
400
+ budget: {
401
+ estimator: "chars_div_4";
402
+ basis: "assumed_ceiling" | "model_context_window";
403
+ model: string | null;
404
+ context_window: number | null;
405
+ output_allowance_tokens: number | null;
406
+ framing_tokens: number | null;
407
+ selection_limit_tokens: number;
408
+ estimated_packet_tokens: number;
409
+ omitted_for_budget: number;
410
+ mandatory_paths: string[];
411
+ };
412
+ } | undefined;
413
+ permission_denial?: {
414
+ permission: string;
415
+ source: string;
416
+ } | undefined;
417
+ usage?: {
418
+ input_tokens?: number | undefined;
419
+ output_tokens?: number | undefined;
420
+ cached_input_tokens?: number | undefined;
421
+ input_token_usage?: {
422
+ total_tokens: number | null;
423
+ cache_read_tokens: number | null;
424
+ cache_write_tokens: number | null;
425
+ } | undefined;
426
+ cost_usd?: number | undefined;
427
+ cost_basis?: {
428
+ kind: "cash" | "unknown" | "valuation";
429
+ source: string;
430
+ } | undefined;
431
+ estimated?: boolean | undefined;
432
+ } | undefined;
433
+ credential_route?: "local" | "managed_api_key" | "vendor_native" | undefined;
434
+ credential_source?: "api_key_env" | "api_key_flag" | "native_session" | "none" | "oauth_token_env" | "provider_auth_file" | undefined;
435
+ credential_profile_id?: string | undefined;
436
+ plan_progress?: {
437
+ items: {
438
+ id: string;
439
+ title: string;
440
+ status: "completed" | "in_progress" | "pending";
441
+ }[];
442
+ } | undefined;
443
+ rate_limit?: {
444
+ constraint_id?: string | undefined;
445
+ applies_to_request_kinds?: ("image" | "text")[] | undefined;
446
+ applies_to_models?: string[] | null | undefined;
447
+ applies_to_model_prefixes?: string[] | undefined;
448
+ resets_at: string | null;
449
+ retry_delay_ms: number | null;
450
+ } | undefined;
451
+ status?: {
452
+ kind: "api_retry";
453
+ attempt?: number | undefined;
454
+ max_retries?: number | undefined;
455
+ retry_delay_ms?: number | undefined;
456
+ error_category?: "authentication_failed" | "billing_error" | "invalid_request" | "max_output_tokens" | "model_not_found" | "oauth_org_not_allowed" | "overloaded" | "rate_limit" | "server_error" | "timeout" | "unknown" | undefined;
457
+ } | undefined;
458
+ transient?: {
459
+ kind: "network" | "service_unavailable" | "stream_disconnect" | "timeout" | "unknown";
460
+ retry_delay_ms: number | null;
461
+ } | undefined;
462
+ context?: {
463
+ kind: "capacity_exhausted" | "compaction_completed" | "compaction_started";
464
+ cause: "blocking_limit" | "prompt_too_long" | "repeated_refill" | "unknown" | "window_exceeded";
465
+ native_code: string | null;
466
+ trigger: "auto" | "manual" | null;
467
+ pre_tokens: number | null;
468
+ } | undefined;
469
+ error?: string | undefined;
470
+ aborted?: boolean | undefined;
471
+ payload?: Record<string, unknown> | undefined;
472
+ }[];
473
+ //# sourceMappingURL=continuation-chain.test-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continuation-chain.test-support.d.ts","sourceRoot":"","sources":["../src/continuation-chain.test-support.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,206 @@
1
+ /**
2
+ * A `continueFrom` chain of real Orchestrator runs on one scripted fake
3
+ * harness (no vendor calls): each run is labelled (A, B, C...) so a script
4
+ * can answer per run and per spawn, and the successor receives exactly the
5
+ * continuation facts the daemon runner resolves.
6
+ */
7
+ import { afterEach } from "vitest";
8
+ import { execFileSync } from "node:child_process";
9
+ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
10
+ import { tmpdir } from "node:os";
11
+ import { join } from "node:path";
12
+ import { ConformanceReport, HarnessManifest, } from "@claudexor/schema";
13
+ import { Orchestrator } from "./orchestrator.js";
14
+ const roots = [];
15
+ afterEach(() => roots.splice(0).forEach((root) => rmSync(root, { recursive: true, force: true })));
16
+ export const WORK_ORDER = "WORK-ORDER-7f3a: build the dashboard";
17
+ /** A movable fake store: sessions live under `<locator>/sessions/<sid>.jsonl`. */
18
+ export function movableStore(retire = (file) => rmSync(file)) {
19
+ const fileFor = (env, sid) => join(String(env["CLAUDEXOR_PROFILE_LOCATOR"] ?? "/nowhere"), "sessions", `${sid}.jsonl`);
20
+ return {
21
+ async locate(ref, env) {
22
+ const file = fileFor(env, ref.nativeSessionId);
23
+ return existsSync(file)
24
+ ? { found: true, file, mtimeMs: Date.now(), sidecars: [] }
25
+ : { found: false };
26
+ },
27
+ async move(located, _fromEnv, toEnv) {
28
+ const sid = located.nativeSessionId ?? "?";
29
+ const target = fileFor(toEnv, sid);
30
+ execFileSync("mkdir", ["-p", join(target, "..")]);
31
+ writeFileSync(target, readFileSync(located.file));
32
+ return { ok: true, resumeRef: { nativeSessionId: sid }, retire: () => retire(located.file) };
33
+ },
34
+ };
35
+ }
36
+ export function chainFixture(opts, script) {
37
+ const root = mkdtempSync(join(tmpdir(), "cx-chain-"));
38
+ roots.push(root);
39
+ execFileSync("git", ["init", "-b", "main"], { cwd: root, stdio: "pipe" });
40
+ writeFileSync(join(root, "README.md"), "fixture\n");
41
+ execFileSync("git", ["add", "README.md"], { cwd: root });
42
+ execFileSync("git", ["-c", "user.name=Fixture", "-c", "user.email=fixture@example.test", "commit", "-m", "base"], { cwd: root, stdio: "pipe" });
43
+ const stores = Object.fromEntries(opts.profiles.map((id) => [id, join(root, `store-${id}`)]));
44
+ writeFileSync(join(process.env.CLAUDEXOR_CONFIG_DIR, "config.yaml"), JSON.stringify({
45
+ runtime: {
46
+ transient_retry: {
47
+ max_retries: opts.maxRetries ?? 0,
48
+ initial_delay_ms: 1,
49
+ max_delay_ms: 2,
50
+ },
51
+ },
52
+ credential_profiles: opts.profiles.map((id) => ({
53
+ profile_id: id,
54
+ harness_id: "fake",
55
+ display_name: id,
56
+ credential_kind: "config_dir_login",
57
+ isolation_locator: stores[id],
58
+ })),
59
+ harnesses: {
60
+ fake: {
61
+ ...(opts.fallbackModel ? { fallback_model: opts.fallbackModel } : {}),
62
+ profile_policy: { limit_action: "rotate" },
63
+ },
64
+ },
65
+ }));
66
+ const spawns = [];
67
+ const label = { current: "A" };
68
+ const adapter = {
69
+ id: "fake",
70
+ continuity: opts.continuity ?? movableStore(),
71
+ async discover() {
72
+ return HarnessManifest.parse({
73
+ id: "fake",
74
+ display_name: "fake",
75
+ kind: "local_cli",
76
+ provider_family: "local",
77
+ capabilities: {
78
+ implement: true,
79
+ read_files: true,
80
+ effort_levels: ["high"],
81
+ repair: true,
82
+ explain: true,
83
+ audit: true,
84
+ known_models: ["m1", "m2"],
85
+ },
86
+ auth_modes: ["local_session"],
87
+ access_profiles_supported: ["workspace_write", "readonly"],
88
+ });
89
+ },
90
+ async doctor() {
91
+ return ConformanceReport.parse({
92
+ harness_id: "fake",
93
+ status: "ok",
94
+ enabled_intents: ["implement", "repair", "explain", "audit"],
95
+ auth_sources: [
96
+ { source: "native_session", availability: "available", verification: "passed" },
97
+ ],
98
+ });
99
+ },
100
+ async probeCredentialProfile(profile) {
101
+ return {
102
+ profile_id: profile.profile_id,
103
+ harness_id: "fake",
104
+ availability: "available",
105
+ verification: "passed",
106
+ verification_source: "local_store",
107
+ last_verified_at: new Date().toISOString(),
108
+ };
109
+ },
110
+ async models() {
111
+ return ["m1", "m2"].map((id) => ({ id, label: null, context_window: null, routes: null }));
112
+ },
113
+ async *run(spec) {
114
+ const profile = spec.credential_profile.profile_id;
115
+ const ctx = {
116
+ label: label.current,
117
+ nth: spawns.filter((s) => s.label === label.current).length + 1,
118
+ profile,
119
+ resume: spec.resume_session_id ?? null,
120
+ prompt: spec.prompt,
121
+ model: spec.model_hint ?? null,
122
+ cwd: spec.cwd,
123
+ };
124
+ spawns.push(ctx);
125
+ const emit = (ev) => ({
126
+ session_id: spec.session_id,
127
+ ts: new Date().toISOString(),
128
+ credential_route: "vendor_native",
129
+ credential_profile_id: profile,
130
+ ...ev,
131
+ });
132
+ const seed = (sid) => {
133
+ execFileSync("mkdir", ["-p", join(stores[profile], "sessions")]);
134
+ writeFileSync(join(stores[profile], "sessions", `${sid}.jsonl`), `{"sid":"${sid}"}\n`);
135
+ };
136
+ yield* script({ ...ctx, spec, emit, seed });
137
+ },
138
+ };
139
+ return { root, stores, spawns, adapter, label };
140
+ }
141
+ export async function runLabelled(f, label, input) {
142
+ f.label.current = label;
143
+ const events = [];
144
+ const result = await new Orchestrator({
145
+ registry: new Map([["fake", f.adapter]]),
146
+ reviewers: [],
147
+ }).run({
148
+ repoRoot: f.root,
149
+ mode: "agent",
150
+ prompt: WORK_ORDER,
151
+ harnesses: ["fake"],
152
+ review: false,
153
+ models: { fake: "m1" },
154
+ effort: "high",
155
+ authPreference: "subscription",
156
+ web: "off",
157
+ ...input,
158
+ onEvent: (event) => events.push(event),
159
+ });
160
+ const terminal = events.find((e) => ["run.failed", "run.completed", "run.blocked"].includes(e.type));
161
+ return {
162
+ result,
163
+ events,
164
+ receipts: events
165
+ .filter((e) => e.type === "run.continuity")
166
+ .map((e) => e.payload["receipt"]),
167
+ resumable: terminal?.payload["resumable"],
168
+ };
169
+ }
170
+ /** The facts the daemon resolves for a successor of `pred` (its own ancestors first). */
171
+ export function continuing(pred, workOrder, ancestors = [], over = {}) {
172
+ return {
173
+ retain: true,
174
+ from: {
175
+ runId: pred.result.runId,
176
+ runDir: pred.result.runDir,
177
+ state: pred.result.lifecycle,
178
+ workOrder,
179
+ preference: "auto",
180
+ ancestors: ancestors.map((run) => ({
181
+ runId: run.result.runId,
182
+ runDir: run.result.runDir,
183
+ state: run.result.lifecycle,
184
+ })),
185
+ ...over,
186
+ },
187
+ };
188
+ }
189
+ export const limitStop = (emit) => [
190
+ emit({
191
+ type: "status",
192
+ status: { kind: "api_retry", error_category: "rate_limit" },
193
+ rate_limit: {
194
+ resets_at: "2026-10-06T21:00:00.000Z",
195
+ retry_delay_ms: null,
196
+ constraint_id: "five_hour",
197
+ },
198
+ }),
199
+ emit({ type: "error", error: "usage limit reached" }),
200
+ emit({ type: "completed" }),
201
+ ];
202
+ export const crash = (emit) => [
203
+ emit({ type: "error", error: "connection reset" }),
204
+ emit({ type: "completed", payload: { exit_code: 1, harness_reported_error: true } }),
205
+ ];
206
+ //# sourceMappingURL=continuation-chain.test-support.js.map