@claudexor/cli 1.0.1 → 2.1.3

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 (221) hide show
  1. package/dist/acp-surface-runner.d.ts +17 -0
  2. package/dist/acp-surface-runner.d.ts.map +1 -0
  3. package/dist/acp-surface-runner.js +187 -0
  4. package/dist/acp-surface-runner.js.map +1 -0
  5. package/dist/args.d.ts.map +1 -1
  6. package/dist/args.js.map +1 -1
  7. package/dist/bridge-serve.d.ts +3 -0
  8. package/dist/bridge-serve.d.ts.map +1 -0
  9. package/dist/bridge-serve.js +39 -0
  10. package/dist/bridge-serve.js.map +1 -0
  11. package/dist/capabilities.d.ts.map +1 -1
  12. package/dist/capabilities.js +12 -3
  13. package/dist/capabilities.js.map +1 -1
  14. package/dist/claude-oauth-usage.d.ts +33 -0
  15. package/dist/claude-oauth-usage.d.ts.map +1 -0
  16. package/dist/claude-oauth-usage.js +190 -0
  17. package/dist/claude-oauth-usage.js.map +1 -0
  18. package/dist/claude-statusline.d.ts +25 -0
  19. package/dist/claude-statusline.d.ts.map +1 -0
  20. package/dist/claude-statusline.js +259 -0
  21. package/dist/claude-statusline.js.map +1 -0
  22. package/dist/claudexord.js +346 -543
  23. package/dist/claudexord.js.map +1 -1
  24. package/dist/cli-io.d.ts +8 -9
  25. package/dist/cli-io.d.ts.map +1 -1
  26. package/dist/cli-io.js +11 -7
  27. package/dist/cli-io.js.map +1 -1
  28. package/dist/cli.js +475 -516
  29. package/dist/cli.js.map +1 -1
  30. package/dist/codex-quota-source.d.ts +11 -0
  31. package/dist/codex-quota-source.d.ts.map +1 -0
  32. package/dist/codex-quota-source.js +181 -0
  33. package/dist/codex-quota-source.js.map +1 -0
  34. package/dist/command-flags.d.ts +18 -0
  35. package/dist/command-flags.d.ts.map +1 -0
  36. package/dist/command-flags.js +124 -0
  37. package/dist/command-flags.js.map +1 -0
  38. package/dist/command-registry.d.ts +2 -40
  39. package/dist/command-registry.d.ts.map +1 -1
  40. package/dist/command-registry.js +74 -164
  41. package/dist/command-registry.js.map +1 -1
  42. package/dist/control-services.d.ts +2490 -0
  43. package/dist/control-services.d.ts.map +1 -0
  44. package/dist/control-services.js +453 -0
  45. package/dist/control-services.js.map +1 -0
  46. package/dist/credential-commands.d.ts +9 -0
  47. package/dist/credential-commands.d.ts.map +1 -0
  48. package/dist/credential-commands.js +224 -0
  49. package/dist/credential-commands.js.map +1 -0
  50. package/dist/daemon-lifecycle.d.ts +7 -3
  51. package/dist/daemon-lifecycle.d.ts.map +1 -1
  52. package/dist/daemon-lifecycle.js +40 -12
  53. package/dist/daemon-lifecycle.js.map +1 -1
  54. package/dist/daemon-run.d.ts +2 -0
  55. package/dist/daemon-run.d.ts.map +1 -1
  56. package/dist/daemon-run.js +62 -14
  57. package/dist/daemon-run.js.map +1 -1
  58. package/dist/daemon-runtime-shutdown.d.ts +58 -0
  59. package/dist/daemon-runtime-shutdown.d.ts.map +1 -0
  60. package/dist/daemon-runtime-shutdown.js +142 -0
  61. package/dist/daemon-runtime-shutdown.js.map +1 -0
  62. package/dist/decision.d.ts.map +1 -1
  63. package/dist/decision.js +12 -3
  64. package/dist/decision.js.map +1 -1
  65. package/dist/live.d.ts +29 -0
  66. package/dist/live.d.ts.map +1 -1
  67. package/dist/live.js +117 -6
  68. package/dist/live.js.map +1 -1
  69. package/dist/local-attachment.d.ts +14 -0
  70. package/dist/local-attachment.d.ts.map +1 -0
  71. package/dist/local-attachment.js +67 -0
  72. package/dist/local-attachment.js.map +1 -0
  73. package/dist/mcp-runner.d.ts +4 -15
  74. package/dist/mcp-runner.d.ts.map +1 -1
  75. package/dist/mcp-runner.js +276 -145
  76. package/dist/mcp-runner.js.map +1 -1
  77. package/dist/native-login.d.ts +21 -0
  78. package/dist/native-login.d.ts.map +1 -0
  79. package/dist/native-login.js +110 -0
  80. package/dist/native-login.js.map +1 -0
  81. package/dist/ops-commands.d.ts +8 -6
  82. package/dist/ops-commands.d.ts.map +1 -1
  83. package/dist/ops-commands.js +250 -168
  84. package/dist/ops-commands.js.map +1 -1
  85. package/dist/orchestrate-options.d.ts.map +1 -1
  86. package/dist/orchestrate-options.js +1 -1
  87. package/dist/orchestrate-options.js.map +1 -1
  88. package/dist/orphan-reaper.d.ts +4 -5
  89. package/dist/orphan-reaper.d.ts.map +1 -1
  90. package/dist/orphan-reaper.js +29 -56
  91. package/dist/orphan-reaper.js.map +1 -1
  92. package/dist/orphan-sweeper.d.ts +1 -2
  93. package/dist/orphan-sweeper.d.ts.map +1 -1
  94. package/dist/orphan-sweeper.js +29 -48
  95. package/dist/orphan-sweeper.js.map +1 -1
  96. package/dist/plugins.d.ts.map +1 -1
  97. package/dist/plugins.js +196 -64
  98. package/dist/plugins.js.map +1 -1
  99. package/dist/primary-output.d.ts.map +1 -1
  100. package/dist/primary-output.js.map +1 -1
  101. package/dist/profile-compatibility.d.ts +6 -0
  102. package/dist/profile-compatibility.d.ts.map +1 -0
  103. package/dist/profile-compatibility.js +21 -0
  104. package/dist/profile-compatibility.js.map +1 -0
  105. package/dist/profile-registration.d.ts +15 -0
  106. package/dist/profile-registration.d.ts.map +1 -0
  107. package/dist/profile-registration.js +68 -0
  108. package/dist/profile-registration.js.map +1 -0
  109. package/dist/project-command.d.ts +3 -0
  110. package/dist/project-command.d.ts.map +1 -0
  111. package/dist/project-command.js +87 -0
  112. package/dist/project-command.js.map +1 -0
  113. package/dist/quota-command.d.ts +3 -0
  114. package/dist/quota-command.d.ts.map +1 -0
  115. package/dist/quota-command.js +59 -0
  116. package/dist/quota-command.js.map +1 -0
  117. package/dist/registry.d.ts +1 -1
  118. package/dist/registry.d.ts.map +1 -1
  119. package/dist/registry.js +16 -4
  120. package/dist/registry.js.map +1 -1
  121. package/dist/release.d.ts.map +1 -1
  122. package/dist/release.js +15 -3
  123. package/dist/release.js.map +1 -1
  124. package/dist/repl.d.ts +3 -8
  125. package/dist/repl.d.ts.map +1 -1
  126. package/dist/repl.js +23 -122
  127. package/dist/repl.js.map +1 -1
  128. package/dist/request-preflight.d.ts +13 -0
  129. package/dist/request-preflight.d.ts.map +1 -0
  130. package/dist/request-preflight.js +81 -0
  131. package/dist/request-preflight.js.map +1 -0
  132. package/dist/retention-service.d.ts +24 -0
  133. package/dist/retention-service.d.ts.map +1 -0
  134. package/dist/retention-service.js +100 -0
  135. package/dist/retention-service.js.map +1 -0
  136. package/dist/retry-command-specs.d.ts +3 -0
  137. package/dist/retry-command-specs.d.ts.map +1 -0
  138. package/dist/retry-command-specs.js +21 -0
  139. package/dist/retry-command-specs.js.map +1 -0
  140. package/dist/retry-command.d.ts +4 -0
  141. package/dist/retry-command.d.ts.map +1 -0
  142. package/dist/retry-command.js +57 -0
  143. package/dist/retry-command.js.map +1 -0
  144. package/dist/review-command.d.ts.map +1 -1
  145. package/dist/review-command.js +47 -12
  146. package/dist/review-command.js.map +1 -1
  147. package/dist/run-options.d.ts +2 -2
  148. package/dist/run-options.d.ts.map +1 -1
  149. package/dist/run-options.js +27 -5
  150. package/dist/run-options.js.map +1 -1
  151. package/dist/settings-command.d.ts.map +1 -1
  152. package/dist/settings-command.js +143 -188
  153. package/dist/settings-command.js.map +1 -1
  154. package/dist/settings-service.d.ts +50 -0
  155. package/dist/settings-service.d.ts.map +1 -1
  156. package/dist/settings-service.js +67 -1
  157. package/dist/settings-service.js.map +1 -1
  158. package/dist/setup-job-reducer.d.ts +9 -0
  159. package/dist/setup-job-reducer.d.ts.map +1 -0
  160. package/dist/setup-job-reducer.js +290 -0
  161. package/dist/setup-job-reducer.js.map +1 -0
  162. package/dist/setup-job-store.d.ts +250 -0
  163. package/dist/setup-job-store.d.ts.map +1 -0
  164. package/dist/setup-job-store.js +359 -0
  165. package/dist/setup-job-store.js.map +1 -0
  166. package/dist/setup-job-support.d.ts +27 -0
  167. package/dist/setup-job-support.d.ts.map +1 -0
  168. package/dist/setup-job-support.js +141 -0
  169. package/dist/setup-job-support.js.map +1 -0
  170. package/dist/setup-jobs.d.ts +437 -22
  171. package/dist/setup-jobs.d.ts.map +1 -1
  172. package/dist/setup-jobs.js +813 -423
  173. package/dist/setup-jobs.js.map +1 -1
  174. package/dist/setup-lifecycle-binding.d.ts +40 -0
  175. package/dist/setup-lifecycle-binding.d.ts.map +1 -0
  176. package/dist/setup-lifecycle-binding.js +159 -0
  177. package/dist/setup-lifecycle-binding.js.map +1 -0
  178. package/dist/setup-login-protocol.d.ts +13 -0
  179. package/dist/setup-login-protocol.d.ts.map +1 -0
  180. package/dist/setup-login-protocol.js +179 -0
  181. package/dist/setup-login-protocol.js.map +1 -0
  182. package/dist/setup-login-runner.d.ts +20 -0
  183. package/dist/setup-login-runner.d.ts.map +1 -0
  184. package/dist/setup-login-runner.js +225 -0
  185. package/dist/setup-login-runner.js.map +1 -0
  186. package/dist/setup-supervisor.d.ts +53 -0
  187. package/dist/setup-supervisor.d.ts.map +1 -0
  188. package/dist/setup-supervisor.js +177 -0
  189. package/dist/setup-supervisor.js.map +1 -0
  190. package/dist/spec-thread-scope.d.ts +3 -0
  191. package/dist/spec-thread-scope.d.ts.map +1 -0
  192. package/dist/spec-thread-scope.js +9 -0
  193. package/dist/spec-thread-scope.js.map +1 -0
  194. package/dist/spec.d.ts +9 -20
  195. package/dist/spec.d.ts.map +1 -1
  196. package/dist/spec.js +49 -21
  197. package/dist/spec.js.map +1 -1
  198. package/dist/thread-delivery.d.ts +18 -0
  199. package/dist/thread-delivery.d.ts.map +1 -0
  200. package/dist/thread-delivery.js +67 -0
  201. package/dist/thread-delivery.js.map +1 -0
  202. package/dist/thread-select.d.ts +9 -0
  203. package/dist/thread-select.d.ts.map +1 -0
  204. package/dist/thread-select.js +12 -0
  205. package/dist/thread-select.js.map +1 -0
  206. package/dist/trust-command.d.ts.map +1 -1
  207. package/dist/trust-command.js +69 -61
  208. package/dist/trust-command.js.map +1 -1
  209. package/dist/trust-services.d.ts +5 -6
  210. package/dist/trust-services.d.ts.map +1 -1
  211. package/dist/trust-services.js +42 -13
  212. package/dist/trust-services.js.map +1 -1
  213. package/package.json +24 -22
  214. package/dist/attachment-resolver.d.ts +0 -11
  215. package/dist/attachment-resolver.d.ts.map +0 -1
  216. package/dist/attachment-resolver.js +0 -61
  217. package/dist/attachment-resolver.js.map +0 -1
  218. package/dist/settings-display.d.ts +0 -3
  219. package/dist/settings-display.d.ts.map +0 -1
  220. package/dist/settings-display.js +0 -33
  221. package/dist/settings-display.js.map +0 -1
@@ -0,0 +1,2490 @@
1
+ import { type OperatorDecisionRecord, JournalManager, InteractionRegistry, ProjectPartitions, ProjectStore, ResourceStore, QuotaRegistry } from "@claudexor/daemon";
2
+ import { listTrustService, updateTrustService } from "./trust-services.js";
3
+ import { type ResourceAttachmentRef, type ControlSpecAnswersRequest, type ControlSpecQuestionsRequest } from "@claudexor/schema";
4
+ import { AuthReadinessService } from "@claudexor/gateway";
5
+ import { createSetupJobManager } from "./setup-jobs.js";
6
+ import { SetupJobStore } from "./setup-job-store.js";
7
+ import { SetupLifecycleBinding } from "./setup-lifecycle-binding.js";
8
+ import { type ThreadApplyOptions } from "./thread-delivery.js";
9
+ type SetupJobManager = ReturnType<typeof createSetupJobManager>;
10
+ type SetupBinding = SetupLifecycleBinding<SetupJobStore, SetupJobManager>;
11
+ type HarnessListInput = {
12
+ fresh?: boolean;
13
+ includeFakes?: boolean;
14
+ harnessIds?: string[];
15
+ };
16
+ export declare function controlServices(interactions: InteractionRegistry, projects: () => ProjectStore, threads: ProjectPartitions, setupBinding: SetupBinding, journalManager: JournalManager, authReadiness: AuthReadinessService, resources: ResourceStore, quotaRegistry: () => QuotaRegistry, daemonJobs: () => Promise<Array<{
17
+ runId?: string;
18
+ state: string;
19
+ finishedAt?: string;
20
+ }>>): {
21
+ preflightRunRequirements: (request: import("@claudexor/schema").ControlRunStartRequest) => Promise<void>;
22
+ createUpload: (input: unknown, idempotencyKey: string) => Promise<{
23
+ state: "cancelled" | "open" | "uploading" | "uploaded";
24
+ uploadId: string;
25
+ receivedBytes: number;
26
+ expectedBytes: number;
27
+ }>;
28
+ writeUpload: (uploadId: string, chunks: AsyncIterable<Uint8Array>) => Promise<{
29
+ state: "cancelled" | "open" | "uploading" | "uploaded";
30
+ uploadId: string;
31
+ receivedBytes: number;
32
+ expectedBytes: number;
33
+ }>;
34
+ uploadStatus: (uploadId: string) => Promise<{
35
+ state: "cancelled" | "open" | "uploading" | "uploaded";
36
+ uploadId: string;
37
+ receivedBytes: number;
38
+ expectedBytes: number;
39
+ }>;
40
+ cancelUpload: (uploadId: string) => Promise<{
41
+ state: "cancelled" | "open" | "uploading" | "uploaded";
42
+ uploadId: string;
43
+ receivedBytes: number;
44
+ expectedBytes: number;
45
+ }>;
46
+ finalizeUpload: (uploadId: string, expectedSha256: string | undefined, idempotencyKey: string) => Promise<{
47
+ name: string;
48
+ kind: "file" | "image";
49
+ resourceId: string;
50
+ mime: string;
51
+ sha256: string;
52
+ sizeBytes: number;
53
+ createdAt: string;
54
+ deduplicated: boolean;
55
+ }>;
56
+ validateResources: (refs: ResourceAttachmentRef[]) => Promise<void>;
57
+ runRetention: import("./retention-service.js").RetentionRunner;
58
+ listProjects: () => Promise<{
59
+ projects: unknown[];
60
+ }>;
61
+ registerProject: (input: Parameters<ProjectStore["register"]>[0]) => Promise<{
62
+ created_at: string;
63
+ schema_version: 2;
64
+ id: string;
65
+ updated_at: string;
66
+ root: string;
67
+ }>;
68
+ relinkProject: (id: string, root: string) => Promise<{
69
+ created_at: string;
70
+ schema_version: 2;
71
+ id: string;
72
+ updated_at: string;
73
+ root: string;
74
+ }>;
75
+ createThread: (input: unknown) => Promise<{
76
+ state: "active" | "closed" | "trashed" | "purged";
77
+ created_at: string;
78
+ workspace: {
79
+ mode: "in_place" | "isolated";
80
+ worktree_path: string | null;
81
+ base_sha: string | null;
82
+ delivered_through_run_id: string | null;
83
+ };
84
+ mode: "ask" | "plan" | "audit" | "agent" | "orchestrate";
85
+ schema_version: 2;
86
+ id: string;
87
+ auth_preference: "auto" | "subscription" | "api_key";
88
+ credential_profile_id: string | null;
89
+ title: string | null;
90
+ updated_at: string;
91
+ repo: {
92
+ root: string;
93
+ base_ref: string;
94
+ } | null;
95
+ primary_harness: string | null;
96
+ eligible_harnesses: string[];
97
+ run_ids: string[];
98
+ head_run_id: string | null;
99
+ trashed_at: string | null;
100
+ purge_after: string | null;
101
+ pre_trash_state: "active" | "closed" | null;
102
+ }>;
103
+ listThreads: () => Promise<{
104
+ threads: unknown[];
105
+ }>;
106
+ threadDetail: (id: string) => Promise<{
107
+ thread: unknown;
108
+ sessions: unknown[];
109
+ turns: unknown[];
110
+ }>;
111
+ createThreadTurn: (id: string, prompt: string, opts: {
112
+ kind?: unknown;
113
+ parentRunId?: string | null;
114
+ planRunId?: string | null;
115
+ attachments?: ResourceAttachmentRef[];
116
+ idempotency?: {
117
+ key: string;
118
+ client: string;
119
+ request: unknown;
120
+ };
121
+ }) => Promise<{
122
+ created_at: string;
123
+ kind: "initial" | "followup" | "decision";
124
+ id: string;
125
+ prompt: string;
126
+ attachments: {
127
+ path: string;
128
+ name: string;
129
+ kind: "file" | "image";
130
+ resource_id: string;
131
+ mime: string;
132
+ sha256: string;
133
+ size_bytes: number;
134
+ }[];
135
+ thread_id: string;
136
+ run_id: string | null;
137
+ parent_run_id: string | null;
138
+ plan_run_id: string | null;
139
+ enqueue_error: {
140
+ code: string | null;
141
+ message: string;
142
+ retryable: boolean;
143
+ failed_at: string;
144
+ } | null;
145
+ }>;
146
+ updateThread: (id: string, patch: {
147
+ title?: string;
148
+ state?: string;
149
+ primaryHarness?: string | null;
150
+ credentialProfileId?: string | null;
151
+ eligibleHarnesses?: string[];
152
+ }) => Promise<{
153
+ state: "active" | "closed" | "trashed" | "purged";
154
+ created_at: string;
155
+ workspace: {
156
+ mode: "in_place" | "isolated";
157
+ worktree_path: string | null;
158
+ base_sha: string | null;
159
+ delivered_through_run_id: string | null;
160
+ };
161
+ mode: "ask" | "plan" | "audit" | "agent" | "orchestrate";
162
+ schema_version: 2;
163
+ id: string;
164
+ auth_preference: "auto" | "subscription" | "api_key";
165
+ credential_profile_id: string | null;
166
+ title: string | null;
167
+ updated_at: string;
168
+ repo: {
169
+ root: string;
170
+ base_ref: string;
171
+ } | null;
172
+ primary_harness: string | null;
173
+ eligible_harnesses: string[];
174
+ run_ids: string[];
175
+ head_run_id: string | null;
176
+ trashed_at: string | null;
177
+ purge_after: string | null;
178
+ pre_trash_state: "active" | "closed" | null;
179
+ }>;
180
+ trashThread: (id: string) => Promise<{
181
+ state: "active" | "closed" | "trashed" | "purged";
182
+ created_at: string;
183
+ workspace: {
184
+ mode: "in_place" | "isolated";
185
+ worktree_path: string | null;
186
+ base_sha: string | null;
187
+ delivered_through_run_id: string | null;
188
+ };
189
+ mode: "ask" | "plan" | "audit" | "agent" | "orchestrate";
190
+ schema_version: 2;
191
+ id: string;
192
+ auth_preference: "auto" | "subscription" | "api_key";
193
+ credential_profile_id: string | null;
194
+ title: string | null;
195
+ updated_at: string;
196
+ repo: {
197
+ root: string;
198
+ base_ref: string;
199
+ } | null;
200
+ primary_harness: string | null;
201
+ eligible_harnesses: string[];
202
+ run_ids: string[];
203
+ head_run_id: string | null;
204
+ trashed_at: string | null;
205
+ purge_after: string | null;
206
+ pre_trash_state: "active" | "closed" | null;
207
+ }>;
208
+ restoreThread: (id: string) => Promise<{
209
+ state: "active" | "closed" | "trashed" | "purged";
210
+ created_at: string;
211
+ workspace: {
212
+ mode: "in_place" | "isolated";
213
+ worktree_path: string | null;
214
+ base_sha: string | null;
215
+ delivered_through_run_id: string | null;
216
+ };
217
+ mode: "ask" | "plan" | "audit" | "agent" | "orchestrate";
218
+ schema_version: 2;
219
+ id: string;
220
+ auth_preference: "auto" | "subscription" | "api_key";
221
+ credential_profile_id: string | null;
222
+ title: string | null;
223
+ updated_at: string;
224
+ repo: {
225
+ root: string;
226
+ base_ref: string;
227
+ } | null;
228
+ primary_harness: string | null;
229
+ eligible_harnesses: string[];
230
+ run_ids: string[];
231
+ head_run_id: string | null;
232
+ trashed_at: string | null;
233
+ purge_after: string | null;
234
+ pre_trash_state: "active" | "closed" | null;
235
+ }>;
236
+ purgeThread: (id: string) => Promise<{
237
+ state: "active" | "closed" | "trashed" | "purged";
238
+ created_at: string;
239
+ workspace: {
240
+ mode: "in_place" | "isolated";
241
+ worktree_path: string | null;
242
+ base_sha: string | null;
243
+ delivered_through_run_id: string | null;
244
+ };
245
+ mode: "ask" | "plan" | "audit" | "agent" | "orchestrate";
246
+ schema_version: 2;
247
+ id: string;
248
+ auth_preference: "auto" | "subscription" | "api_key";
249
+ credential_profile_id: string | null;
250
+ title: string | null;
251
+ updated_at: string;
252
+ repo: {
253
+ root: string;
254
+ base_ref: string;
255
+ } | null;
256
+ primary_harness: string | null;
257
+ eligible_harnesses: string[];
258
+ run_ids: string[];
259
+ head_run_id: string | null;
260
+ trashed_at: string | null;
261
+ purge_after: string | null;
262
+ pre_trash_state: "active" | "closed" | null;
263
+ }>;
264
+ applyThread: (id: string, opts: ThreadApplyOptions) => Promise<{
265
+ applied: boolean;
266
+ status: string;
267
+ headMoved: boolean;
268
+ detail: string | null;
269
+ delivery: import("@claudexor/schema").ControlDeliveryResponse | null;
270
+ }>;
271
+ setTurnEnqueueError: (turnId: string, message: string, code: string | null, retryable?: boolean) => void;
272
+ listTrust: typeof listTrustService;
273
+ updateTrust: typeof updateTrustService;
274
+ pendingInteractions: (runId: string) => {
275
+ harnessId: string | null;
276
+ attemptId: string | null;
277
+ questions: {
278
+ options: {
279
+ label: string;
280
+ description: string | null;
281
+ }[];
282
+ id: string;
283
+ question: string;
284
+ header: string | null;
285
+ multi_select: boolean;
286
+ }[];
287
+ runId: string;
288
+ interactionId: string;
289
+ sourceTool: string | null;
290
+ requestedAt: string;
291
+ timeoutAt: string | null;
292
+ }[];
293
+ answerInteraction: (runId: string, interactionId: string, answers: unknown) => {
294
+ status: import("@claudexor/daemon").InteractionAnswerStatus;
295
+ message?: string;
296
+ };
297
+ operatorDecision: (runId: string, params: unknown) => OperatorDecisionRecord | null;
298
+ recordOperatorDecision: (runId: string, params: unknown, decision: Omit<OperatorDecisionRecord, "runId">, idempotency?: {
299
+ key: string;
300
+ client: string;
301
+ request: unknown;
302
+ }) => OperatorDecisionRecord;
303
+ beginDelivery: (params: unknown, input: {
304
+ key: string;
305
+ client: string;
306
+ operation: string;
307
+ request: unknown;
308
+ }) => Promise<{
309
+ reused: boolean;
310
+ id: string;
311
+ state: import("@claudexor/daemon").JobState;
312
+ params: unknown;
313
+ result?: unknown;
314
+ error?: string;
315
+ errorCode?: string;
316
+ errorStatus?: number;
317
+ createdAt: string;
318
+ runId?: string;
319
+ taskId?: string;
320
+ runDir?: string;
321
+ startedAt?: string;
322
+ finishedAt?: string;
323
+ }>;
324
+ completeDelivery: (id: string, result: unknown) => Promise<void>;
325
+ failDelivery: (id: string, error: unknown) => Promise<void>;
326
+ harnesses: (input?: HarnessListInput) => Promise<{
327
+ harnesses: {
328
+ configuredModel: string | null;
329
+ configuredModelCheck: {
330
+ status: "ok" | "rejected";
331
+ message?: string | null;
332
+ } | null;
333
+ readiness: {
334
+ status: "pass" | "fail" | "skip";
335
+ detail: string | null;
336
+ kind: "binary" | "auth" | "model" | "smoke" | "probe";
337
+ id: string;
338
+ title: string;
339
+ }[];
340
+ id: string;
341
+ available: boolean;
342
+ status: "ok" | "degraded" | "unavailable";
343
+ manifest: import("@claudexor/schema").HarnessManifest | null;
344
+ enabledIntents: import("@claudexor/schema").Intent[];
345
+ routableIntents: import("@claudexor/schema").Intent[];
346
+ disabledIntents: import("@claudexor/schema").Intent[];
347
+ checks: import("@claudexor/schema").ConformanceCheck[];
348
+ reasons: string[];
349
+ authSources: import("@claudexor/schema").AuthSourceReadiness[];
350
+ }[];
351
+ }>;
352
+ harnessModels: (input: {
353
+ harnessId: string;
354
+ route?: "local_session" | "api_key";
355
+ }) => Promise<{
356
+ source: "none" | "api" | "manifest";
357
+ harnessId: string;
358
+ verifiedAgainst: string | null;
359
+ models: {
360
+ id: string;
361
+ label: string | null;
362
+ routes: ("api_key" | "local_session")[] | null;
363
+ context_window: number | null;
364
+ }[];
365
+ }>;
366
+ authReadiness: (input: {
367
+ harnessId: string;
368
+ request: unknown;
369
+ }) => Promise<{
370
+ authRequest: "auto" | "subscription" | "api_key";
371
+ harnessId: string;
372
+ requestedSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
373
+ observedAt: string;
374
+ readiness: {
375
+ source: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
376
+ availability: "unknown" | "available" | "unavailable";
377
+ verification: "passed" | "failed" | "not_run";
378
+ detail?: string | undefined;
379
+ };
380
+ }>;
381
+ agentCapabilities: () => Promise<{
382
+ generatedAt: string;
383
+ ok: true;
384
+ version: string;
385
+ mutability: {
386
+ readOnlyModes: ("ask" | "plan" | "audit" | "agent" | "orchestrate")[];
387
+ writeModes: ("ask" | "plan" | "audit" | "agent" | "orchestrate")[];
388
+ isolationKinds: ("live" | "envelope")[];
389
+ workspaceModes: ("in_place" | "isolated")[];
390
+ accessProfiles: ("readonly" | "workspace_write" | "full" | "external_sandbox_full" | "inherit_native")[];
391
+ applyModes: ("apply" | "commit" | "branch" | "pr")[];
392
+ };
393
+ harnesses: {
394
+ status: "unavailable" | "ok" | "degraded";
395
+ enabled: boolean;
396
+ displayName: string;
397
+ id: string;
398
+ reasons: string[];
399
+ providerFamily: "openai" | "anthropic" | "google" | "cursor" | "opencode" | "xai" | "local" | "unknown";
400
+ enabledIntents: string[];
401
+ disabledIntents: string[];
402
+ configuredModel: string | null;
403
+ configuredModelValid: boolean | null;
404
+ models: {
405
+ source: "none" | "api" | "manifest";
406
+ count: number;
407
+ verifiedAgainst: string | null;
408
+ };
409
+ webPolicy: "none" | "native" | "tools" | "uncontrolled";
410
+ attachmentInputs: {
411
+ kind: "file" | "image";
412
+ mime_types: string[];
413
+ max_bytes: number;
414
+ max_count: number;
415
+ transport: "file_path" | "base64_stream" | "base64_inline" | "text_inline";
416
+ }[];
417
+ effortLevels: ("low" | "medium" | "high" | "xhigh" | "max")[];
418
+ accessProfilesSupported: ("readonly" | "workspace_write" | "full" | "external_sandbox_full" | "inherit_native")[];
419
+ readonlyMechanism: "none" | "fs_sandbox" | "permission_deny" | "tool_allowlist";
420
+ }[];
421
+ availableHarnesses: string[];
422
+ modes: ("ask" | "plan" | "audit" | "agent" | "orchestrate")[];
423
+ runControlKeys: string[];
424
+ cliCommands: {
425
+ id: string;
426
+ mutability: "read" | "write" | "delivery" | "ops";
427
+ stability: "stable" | "experimental";
428
+ recovery: boolean;
429
+ }[];
430
+ mcpTools: string[];
431
+ runApplyStates: string[];
432
+ }>;
433
+ createSetupJob: (input: {
434
+ request: unknown;
435
+ idempotencyKey: string;
436
+ clientId: string;
437
+ }) => Promise<{
438
+ message: string;
439
+ harness: "cursor" | "codex" | "claude";
440
+ startedAt: string | null;
441
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
442
+ profileId: string | null;
443
+ command: string | null;
444
+ createdAt: string;
445
+ jobId: string;
446
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
447
+ finishedAt: string | null;
448
+ action: "login";
449
+ guideUrl: string | null;
450
+ outcome?: {
451
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
452
+ exitCode?: number | null | undefined;
453
+ signal?: string | null | undefined;
454
+ } | undefined;
455
+ execution?: {
456
+ observedAt: string;
457
+ commandDigest: string;
458
+ executionId: string;
459
+ manifestDigest: string;
460
+ processGroup: {
461
+ schemaVersion: 1;
462
+ pgid: number;
463
+ leader: {
464
+ status: "known";
465
+ source: "procfs_stat" | "proc_pidinfo";
466
+ pid: number;
467
+ platform: "linux" | "darwin";
468
+ startToken: string;
469
+ processGroupId: number;
470
+ };
471
+ };
472
+ permitIssuedAt?: string | undefined;
473
+ } | undefined;
474
+ deadlineAt?: string | undefined;
475
+ authCapability?: {
476
+ attemptId: string;
477
+ challengeDigest: string;
478
+ requestDigest: string;
479
+ disclosure: {
480
+ schemaVersion: 1;
481
+ protocolVersion: 1;
482
+ harness: string;
483
+ requested: "auto" | "subscription" | "api_key";
484
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
485
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
486
+ networkScope: "selected_harness_only";
487
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
488
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
489
+ mayConsumeQuota: boolean;
490
+ generatedAt: string;
491
+ };
492
+ state: "disclosed";
493
+ } | {
494
+ attemptId: string;
495
+ startedAt: string;
496
+ challengeDigest: string;
497
+ requestDigest: string;
498
+ disclosure: {
499
+ schemaVersion: 1;
500
+ protocolVersion: 1;
501
+ harness: string;
502
+ requested: "auto" | "subscription" | "api_key";
503
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
504
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
505
+ networkScope: "selected_harness_only";
506
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
507
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
508
+ mayConsumeQuota: boolean;
509
+ generatedAt: string;
510
+ };
511
+ state: "running";
512
+ } | {
513
+ attemptId: string;
514
+ startedAt: string;
515
+ completedAt: string;
516
+ challengeDigest: string;
517
+ requestDigest: string;
518
+ disclosure: {
519
+ schemaVersion: 1;
520
+ protocolVersion: 1;
521
+ harness: string;
522
+ requested: "auto" | "subscription" | "api_key";
523
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
524
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
525
+ networkScope: "selected_harness_only";
526
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
527
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
528
+ mayConsumeQuota: boolean;
529
+ generatedAt: string;
530
+ };
531
+ state: "completed";
532
+ receipt: {
533
+ availability: "unknown" | "available" | "unavailable";
534
+ verification: "passed" | "failed" | "not_run";
535
+ harness: string;
536
+ requested: "auto" | "subscription" | "api_key";
537
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
538
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
539
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
540
+ receiptId: string;
541
+ attemptId: string;
542
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
543
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
544
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
545
+ costKnowledge: "exact" | "unknown" | "estimated";
546
+ startedAt: string;
547
+ completedAt: string;
548
+ challengeDigest: string;
549
+ requestDigest: string;
550
+ responseDigest: string;
551
+ streamDigest: string;
552
+ scratchBeforeDigest: string;
553
+ scratchAfterDigest: string;
554
+ stream: {
555
+ aborted: boolean;
556
+ startedEvents: number;
557
+ completedEvents: number;
558
+ errorEvents: number;
559
+ unexpectedToolEvents: number;
560
+ interactionEvents: number;
561
+ sessionMismatchEvents: number;
562
+ eventsAfterCompleted: number;
563
+ };
564
+ evidenceRefs: string[];
565
+ costUsd?: number | undefined;
566
+ };
567
+ } | {
568
+ attemptId: string;
569
+ startedAt: string;
570
+ challengeDigest: string;
571
+ requestDigest: string;
572
+ disclosure: {
573
+ schemaVersion: 1;
574
+ protocolVersion: 1;
575
+ harness: string;
576
+ requested: "auto" | "subscription" | "api_key";
577
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
578
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
579
+ networkScope: "selected_harness_only";
580
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
581
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
582
+ mayConsumeQuota: boolean;
583
+ generatedAt: string;
584
+ };
585
+ state: "interrupted_unknown";
586
+ interruptedAt: string;
587
+ } | undefined;
588
+ authorization?: {
589
+ args: string[];
590
+ commandDigest: string;
591
+ executionId: string;
592
+ manifestDigest: string;
593
+ executable: {
594
+ sha256: string;
595
+ mode: number;
596
+ realpath: string;
597
+ size: number;
598
+ device: string;
599
+ inode: string;
600
+ };
601
+ } | undefined;
602
+ nativeCommand?: {
603
+ commandDigest: string;
604
+ finishedAt: string;
605
+ executionId: string;
606
+ manifestDigest: string;
607
+ permitIssuedAt: string | null;
608
+ commandStarted: boolean;
609
+ exitCode: number | null;
610
+ signal: string | null;
611
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
612
+ } | undefined;
613
+ terminationReconciliation?: {
614
+ status: "empty";
615
+ observedAt: string;
616
+ } | undefined;
617
+ }>;
618
+ listSetupJobs: (input?: unknown) => Promise<{
619
+ jobs: {
620
+ message: string;
621
+ harness: "cursor" | "codex" | "claude";
622
+ startedAt: string | null;
623
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
624
+ profileId: string | null;
625
+ command: string | null;
626
+ createdAt: string;
627
+ jobId: string;
628
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
629
+ finishedAt: string | null;
630
+ action: "login";
631
+ guideUrl: string | null;
632
+ outcome?: {
633
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
634
+ exitCode?: number | null | undefined;
635
+ signal?: string | null | undefined;
636
+ } | undefined;
637
+ execution?: {
638
+ observedAt: string;
639
+ commandDigest: string;
640
+ executionId: string;
641
+ manifestDigest: string;
642
+ processGroup: {
643
+ schemaVersion: 1;
644
+ pgid: number;
645
+ leader: {
646
+ status: "known";
647
+ source: "procfs_stat" | "proc_pidinfo";
648
+ pid: number;
649
+ platform: "linux" | "darwin";
650
+ startToken: string;
651
+ processGroupId: number;
652
+ };
653
+ };
654
+ permitIssuedAt?: string | undefined;
655
+ } | undefined;
656
+ deadlineAt?: string | undefined;
657
+ authCapability?: {
658
+ attemptId: string;
659
+ challengeDigest: string;
660
+ requestDigest: string;
661
+ disclosure: {
662
+ schemaVersion: 1;
663
+ protocolVersion: 1;
664
+ harness: string;
665
+ requested: "auto" | "subscription" | "api_key";
666
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
667
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
668
+ networkScope: "selected_harness_only";
669
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
670
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
671
+ mayConsumeQuota: boolean;
672
+ generatedAt: string;
673
+ };
674
+ state: "disclosed";
675
+ } | {
676
+ attemptId: string;
677
+ startedAt: string;
678
+ challengeDigest: string;
679
+ requestDigest: string;
680
+ disclosure: {
681
+ schemaVersion: 1;
682
+ protocolVersion: 1;
683
+ harness: string;
684
+ requested: "auto" | "subscription" | "api_key";
685
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
686
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
687
+ networkScope: "selected_harness_only";
688
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
689
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
690
+ mayConsumeQuota: boolean;
691
+ generatedAt: string;
692
+ };
693
+ state: "running";
694
+ } | {
695
+ attemptId: string;
696
+ startedAt: string;
697
+ completedAt: string;
698
+ challengeDigest: string;
699
+ requestDigest: string;
700
+ disclosure: {
701
+ schemaVersion: 1;
702
+ protocolVersion: 1;
703
+ harness: string;
704
+ requested: "auto" | "subscription" | "api_key";
705
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
706
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
707
+ networkScope: "selected_harness_only";
708
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
709
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
710
+ mayConsumeQuota: boolean;
711
+ generatedAt: string;
712
+ };
713
+ state: "completed";
714
+ receipt: {
715
+ availability: "unknown" | "available" | "unavailable";
716
+ verification: "passed" | "failed" | "not_run";
717
+ harness: string;
718
+ requested: "auto" | "subscription" | "api_key";
719
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
720
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
721
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
722
+ receiptId: string;
723
+ attemptId: string;
724
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
725
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
726
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
727
+ costKnowledge: "exact" | "unknown" | "estimated";
728
+ startedAt: string;
729
+ completedAt: string;
730
+ challengeDigest: string;
731
+ requestDigest: string;
732
+ responseDigest: string;
733
+ streamDigest: string;
734
+ scratchBeforeDigest: string;
735
+ scratchAfterDigest: string;
736
+ stream: {
737
+ aborted: boolean;
738
+ startedEvents: number;
739
+ completedEvents: number;
740
+ errorEvents: number;
741
+ unexpectedToolEvents: number;
742
+ interactionEvents: number;
743
+ sessionMismatchEvents: number;
744
+ eventsAfterCompleted: number;
745
+ };
746
+ evidenceRefs: string[];
747
+ costUsd?: number | undefined;
748
+ };
749
+ } | {
750
+ attemptId: string;
751
+ startedAt: string;
752
+ challengeDigest: string;
753
+ requestDigest: string;
754
+ disclosure: {
755
+ schemaVersion: 1;
756
+ protocolVersion: 1;
757
+ harness: string;
758
+ requested: "auto" | "subscription" | "api_key";
759
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
760
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
761
+ networkScope: "selected_harness_only";
762
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
763
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
764
+ mayConsumeQuota: boolean;
765
+ generatedAt: string;
766
+ };
767
+ state: "interrupted_unknown";
768
+ interruptedAt: string;
769
+ } | undefined;
770
+ authorization?: {
771
+ args: string[];
772
+ commandDigest: string;
773
+ executionId: string;
774
+ manifestDigest: string;
775
+ executable: {
776
+ sha256: string;
777
+ mode: number;
778
+ realpath: string;
779
+ size: number;
780
+ device: string;
781
+ inode: string;
782
+ };
783
+ } | undefined;
784
+ nativeCommand?: {
785
+ commandDigest: string;
786
+ finishedAt: string;
787
+ executionId: string;
788
+ manifestDigest: string;
789
+ permitIssuedAt: string | null;
790
+ commandStarted: boolean;
791
+ exitCode: number | null;
792
+ signal: string | null;
793
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
794
+ } | undefined;
795
+ terminationReconciliation?: {
796
+ status: "empty";
797
+ observedAt: string;
798
+ } | undefined;
799
+ }[];
800
+ }>;
801
+ setupJobStatus: (input: unknown) => Promise<{
802
+ message: string;
803
+ harness: "cursor" | "codex" | "claude";
804
+ startedAt: string | null;
805
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
806
+ profileId: string | null;
807
+ command: string | null;
808
+ createdAt: string;
809
+ jobId: string;
810
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
811
+ finishedAt: string | null;
812
+ action: "login";
813
+ guideUrl: string | null;
814
+ outcome?: {
815
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
816
+ exitCode?: number | null | undefined;
817
+ signal?: string | null | undefined;
818
+ } | undefined;
819
+ execution?: {
820
+ observedAt: string;
821
+ commandDigest: string;
822
+ executionId: string;
823
+ manifestDigest: string;
824
+ processGroup: {
825
+ schemaVersion: 1;
826
+ pgid: number;
827
+ leader: {
828
+ status: "known";
829
+ source: "procfs_stat" | "proc_pidinfo";
830
+ pid: number;
831
+ platform: "linux" | "darwin";
832
+ startToken: string;
833
+ processGroupId: number;
834
+ };
835
+ };
836
+ permitIssuedAt?: string | undefined;
837
+ } | undefined;
838
+ deadlineAt?: string | undefined;
839
+ authCapability?: {
840
+ attemptId: string;
841
+ challengeDigest: string;
842
+ requestDigest: string;
843
+ disclosure: {
844
+ schemaVersion: 1;
845
+ protocolVersion: 1;
846
+ harness: string;
847
+ requested: "auto" | "subscription" | "api_key";
848
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
849
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
850
+ networkScope: "selected_harness_only";
851
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
852
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
853
+ mayConsumeQuota: boolean;
854
+ generatedAt: string;
855
+ };
856
+ state: "disclosed";
857
+ } | {
858
+ attemptId: string;
859
+ startedAt: string;
860
+ challengeDigest: string;
861
+ requestDigest: string;
862
+ disclosure: {
863
+ schemaVersion: 1;
864
+ protocolVersion: 1;
865
+ harness: string;
866
+ requested: "auto" | "subscription" | "api_key";
867
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
868
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
869
+ networkScope: "selected_harness_only";
870
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
871
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
872
+ mayConsumeQuota: boolean;
873
+ generatedAt: string;
874
+ };
875
+ state: "running";
876
+ } | {
877
+ attemptId: string;
878
+ startedAt: string;
879
+ completedAt: string;
880
+ challengeDigest: string;
881
+ requestDigest: string;
882
+ disclosure: {
883
+ schemaVersion: 1;
884
+ protocolVersion: 1;
885
+ harness: string;
886
+ requested: "auto" | "subscription" | "api_key";
887
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
888
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
889
+ networkScope: "selected_harness_only";
890
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
891
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
892
+ mayConsumeQuota: boolean;
893
+ generatedAt: string;
894
+ };
895
+ state: "completed";
896
+ receipt: {
897
+ availability: "unknown" | "available" | "unavailable";
898
+ verification: "passed" | "failed" | "not_run";
899
+ harness: string;
900
+ requested: "auto" | "subscription" | "api_key";
901
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
902
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
903
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
904
+ receiptId: string;
905
+ attemptId: string;
906
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
907
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
908
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
909
+ costKnowledge: "exact" | "unknown" | "estimated";
910
+ startedAt: string;
911
+ completedAt: string;
912
+ challengeDigest: string;
913
+ requestDigest: string;
914
+ responseDigest: string;
915
+ streamDigest: string;
916
+ scratchBeforeDigest: string;
917
+ scratchAfterDigest: string;
918
+ stream: {
919
+ aborted: boolean;
920
+ startedEvents: number;
921
+ completedEvents: number;
922
+ errorEvents: number;
923
+ unexpectedToolEvents: number;
924
+ interactionEvents: number;
925
+ sessionMismatchEvents: number;
926
+ eventsAfterCompleted: number;
927
+ };
928
+ evidenceRefs: string[];
929
+ costUsd?: number | undefined;
930
+ };
931
+ } | {
932
+ attemptId: string;
933
+ startedAt: string;
934
+ challengeDigest: string;
935
+ requestDigest: string;
936
+ disclosure: {
937
+ schemaVersion: 1;
938
+ protocolVersion: 1;
939
+ harness: string;
940
+ requested: "auto" | "subscription" | "api_key";
941
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
942
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
943
+ networkScope: "selected_harness_only";
944
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
945
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
946
+ mayConsumeQuota: boolean;
947
+ generatedAt: string;
948
+ };
949
+ state: "interrupted_unknown";
950
+ interruptedAt: string;
951
+ } | undefined;
952
+ authorization?: {
953
+ args: string[];
954
+ commandDigest: string;
955
+ executionId: string;
956
+ manifestDigest: string;
957
+ executable: {
958
+ sha256: string;
959
+ mode: number;
960
+ realpath: string;
961
+ size: number;
962
+ device: string;
963
+ inode: string;
964
+ };
965
+ } | undefined;
966
+ nativeCommand?: {
967
+ commandDigest: string;
968
+ finishedAt: string;
969
+ executionId: string;
970
+ manifestDigest: string;
971
+ permitIssuedAt: string | null;
972
+ commandStarted: boolean;
973
+ exitCode: number | null;
974
+ signal: string | null;
975
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
976
+ } | undefined;
977
+ terminationReconciliation?: {
978
+ status: "empty";
979
+ observedAt: string;
980
+ } | undefined;
981
+ }>;
982
+ setupJobSnapshot: (input: unknown) => Promise<{
983
+ cursor: string;
984
+ sequence: number;
985
+ job: {
986
+ message: string;
987
+ harness: "cursor" | "codex" | "claude";
988
+ startedAt: string | null;
989
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
990
+ profileId: string | null;
991
+ command: string | null;
992
+ createdAt: string;
993
+ jobId: string;
994
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
995
+ finishedAt: string | null;
996
+ action: "login";
997
+ guideUrl: string | null;
998
+ outcome?: {
999
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
1000
+ exitCode?: number | null | undefined;
1001
+ signal?: string | null | undefined;
1002
+ } | undefined;
1003
+ execution?: {
1004
+ observedAt: string;
1005
+ commandDigest: string;
1006
+ executionId: string;
1007
+ manifestDigest: string;
1008
+ processGroup: {
1009
+ schemaVersion: 1;
1010
+ pgid: number;
1011
+ leader: {
1012
+ status: "known";
1013
+ source: "procfs_stat" | "proc_pidinfo";
1014
+ pid: number;
1015
+ platform: "linux" | "darwin";
1016
+ startToken: string;
1017
+ processGroupId: number;
1018
+ };
1019
+ };
1020
+ permitIssuedAt?: string | undefined;
1021
+ } | undefined;
1022
+ deadlineAt?: string | undefined;
1023
+ authCapability?: {
1024
+ attemptId: string;
1025
+ challengeDigest: string;
1026
+ requestDigest: string;
1027
+ disclosure: {
1028
+ schemaVersion: 1;
1029
+ protocolVersion: 1;
1030
+ harness: string;
1031
+ requested: "auto" | "subscription" | "api_key";
1032
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1033
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1034
+ networkScope: "selected_harness_only";
1035
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1036
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1037
+ mayConsumeQuota: boolean;
1038
+ generatedAt: string;
1039
+ };
1040
+ state: "disclosed";
1041
+ } | {
1042
+ attemptId: string;
1043
+ startedAt: string;
1044
+ challengeDigest: string;
1045
+ requestDigest: string;
1046
+ disclosure: {
1047
+ schemaVersion: 1;
1048
+ protocolVersion: 1;
1049
+ harness: string;
1050
+ requested: "auto" | "subscription" | "api_key";
1051
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1052
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1053
+ networkScope: "selected_harness_only";
1054
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1055
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1056
+ mayConsumeQuota: boolean;
1057
+ generatedAt: string;
1058
+ };
1059
+ state: "running";
1060
+ } | {
1061
+ attemptId: string;
1062
+ startedAt: string;
1063
+ completedAt: string;
1064
+ challengeDigest: string;
1065
+ requestDigest: string;
1066
+ disclosure: {
1067
+ schemaVersion: 1;
1068
+ protocolVersion: 1;
1069
+ harness: string;
1070
+ requested: "auto" | "subscription" | "api_key";
1071
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1072
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1073
+ networkScope: "selected_harness_only";
1074
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1075
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1076
+ mayConsumeQuota: boolean;
1077
+ generatedAt: string;
1078
+ };
1079
+ state: "completed";
1080
+ receipt: {
1081
+ availability: "unknown" | "available" | "unavailable";
1082
+ verification: "passed" | "failed" | "not_run";
1083
+ harness: string;
1084
+ requested: "auto" | "subscription" | "api_key";
1085
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1086
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1087
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1088
+ receiptId: string;
1089
+ attemptId: string;
1090
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
1091
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
1092
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
1093
+ costKnowledge: "exact" | "unknown" | "estimated";
1094
+ startedAt: string;
1095
+ completedAt: string;
1096
+ challengeDigest: string;
1097
+ requestDigest: string;
1098
+ responseDigest: string;
1099
+ streamDigest: string;
1100
+ scratchBeforeDigest: string;
1101
+ scratchAfterDigest: string;
1102
+ stream: {
1103
+ aborted: boolean;
1104
+ startedEvents: number;
1105
+ completedEvents: number;
1106
+ errorEvents: number;
1107
+ unexpectedToolEvents: number;
1108
+ interactionEvents: number;
1109
+ sessionMismatchEvents: number;
1110
+ eventsAfterCompleted: number;
1111
+ };
1112
+ evidenceRefs: string[];
1113
+ costUsd?: number | undefined;
1114
+ };
1115
+ } | {
1116
+ attemptId: string;
1117
+ startedAt: string;
1118
+ challengeDigest: string;
1119
+ requestDigest: string;
1120
+ disclosure: {
1121
+ schemaVersion: 1;
1122
+ protocolVersion: 1;
1123
+ harness: string;
1124
+ requested: "auto" | "subscription" | "api_key";
1125
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1126
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1127
+ networkScope: "selected_harness_only";
1128
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1129
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1130
+ mayConsumeQuota: boolean;
1131
+ generatedAt: string;
1132
+ };
1133
+ state: "interrupted_unknown";
1134
+ interruptedAt: string;
1135
+ } | undefined;
1136
+ authorization?: {
1137
+ args: string[];
1138
+ commandDigest: string;
1139
+ executionId: string;
1140
+ manifestDigest: string;
1141
+ executable: {
1142
+ sha256: string;
1143
+ mode: number;
1144
+ realpath: string;
1145
+ size: number;
1146
+ device: string;
1147
+ inode: string;
1148
+ };
1149
+ } | undefined;
1150
+ nativeCommand?: {
1151
+ commandDigest: string;
1152
+ finishedAt: string;
1153
+ executionId: string;
1154
+ manifestDigest: string;
1155
+ permitIssuedAt: string | null;
1156
+ commandStarted: boolean;
1157
+ exitCode: number | null;
1158
+ signal: string | null;
1159
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
1160
+ } | undefined;
1161
+ terminationReconciliation?: {
1162
+ status: "empty";
1163
+ observedAt: string;
1164
+ } | undefined;
1165
+ };
1166
+ }>;
1167
+ setupJobEvents: (input: unknown) => Promise<{
1168
+ message: string;
1169
+ cursor: string;
1170
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
1171
+ kind: "status";
1172
+ time: string;
1173
+ jobId: string;
1174
+ previousCursor: string | null;
1175
+ sequence: number;
1176
+ job: {
1177
+ message: string;
1178
+ harness: "cursor" | "codex" | "claude";
1179
+ startedAt: string | null;
1180
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
1181
+ profileId: string | null;
1182
+ command: string | null;
1183
+ createdAt: string;
1184
+ jobId: string;
1185
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
1186
+ finishedAt: string | null;
1187
+ action: "login";
1188
+ guideUrl: string | null;
1189
+ outcome?: {
1190
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
1191
+ exitCode?: number | null | undefined;
1192
+ signal?: string | null | undefined;
1193
+ } | undefined;
1194
+ execution?: {
1195
+ observedAt: string;
1196
+ commandDigest: string;
1197
+ executionId: string;
1198
+ manifestDigest: string;
1199
+ processGroup: {
1200
+ schemaVersion: 1;
1201
+ pgid: number;
1202
+ leader: {
1203
+ status: "known";
1204
+ source: "procfs_stat" | "proc_pidinfo";
1205
+ pid: number;
1206
+ platform: "linux" | "darwin";
1207
+ startToken: string;
1208
+ processGroupId: number;
1209
+ };
1210
+ };
1211
+ permitIssuedAt?: string | undefined;
1212
+ } | undefined;
1213
+ deadlineAt?: string | undefined;
1214
+ authCapability?: {
1215
+ attemptId: string;
1216
+ challengeDigest: string;
1217
+ requestDigest: string;
1218
+ disclosure: {
1219
+ schemaVersion: 1;
1220
+ protocolVersion: 1;
1221
+ harness: string;
1222
+ requested: "auto" | "subscription" | "api_key";
1223
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1224
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1225
+ networkScope: "selected_harness_only";
1226
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1227
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1228
+ mayConsumeQuota: boolean;
1229
+ generatedAt: string;
1230
+ };
1231
+ state: "disclosed";
1232
+ } | {
1233
+ attemptId: string;
1234
+ startedAt: string;
1235
+ challengeDigest: string;
1236
+ requestDigest: string;
1237
+ disclosure: {
1238
+ schemaVersion: 1;
1239
+ protocolVersion: 1;
1240
+ harness: string;
1241
+ requested: "auto" | "subscription" | "api_key";
1242
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1243
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1244
+ networkScope: "selected_harness_only";
1245
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1246
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1247
+ mayConsumeQuota: boolean;
1248
+ generatedAt: string;
1249
+ };
1250
+ state: "running";
1251
+ } | {
1252
+ attemptId: string;
1253
+ startedAt: string;
1254
+ completedAt: string;
1255
+ challengeDigest: string;
1256
+ requestDigest: string;
1257
+ disclosure: {
1258
+ schemaVersion: 1;
1259
+ protocolVersion: 1;
1260
+ harness: string;
1261
+ requested: "auto" | "subscription" | "api_key";
1262
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1263
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1264
+ networkScope: "selected_harness_only";
1265
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1266
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1267
+ mayConsumeQuota: boolean;
1268
+ generatedAt: string;
1269
+ };
1270
+ state: "completed";
1271
+ receipt: {
1272
+ availability: "unknown" | "available" | "unavailable";
1273
+ verification: "passed" | "failed" | "not_run";
1274
+ harness: string;
1275
+ requested: "auto" | "subscription" | "api_key";
1276
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1277
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1278
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1279
+ receiptId: string;
1280
+ attemptId: string;
1281
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
1282
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
1283
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
1284
+ costKnowledge: "exact" | "unknown" | "estimated";
1285
+ startedAt: string;
1286
+ completedAt: string;
1287
+ challengeDigest: string;
1288
+ requestDigest: string;
1289
+ responseDigest: string;
1290
+ streamDigest: string;
1291
+ scratchBeforeDigest: string;
1292
+ scratchAfterDigest: string;
1293
+ stream: {
1294
+ aborted: boolean;
1295
+ startedEvents: number;
1296
+ completedEvents: number;
1297
+ errorEvents: number;
1298
+ unexpectedToolEvents: number;
1299
+ interactionEvents: number;
1300
+ sessionMismatchEvents: number;
1301
+ eventsAfterCompleted: number;
1302
+ };
1303
+ evidenceRefs: string[];
1304
+ costUsd?: number | undefined;
1305
+ };
1306
+ } | {
1307
+ attemptId: string;
1308
+ startedAt: string;
1309
+ challengeDigest: string;
1310
+ requestDigest: string;
1311
+ disclosure: {
1312
+ schemaVersion: 1;
1313
+ protocolVersion: 1;
1314
+ harness: string;
1315
+ requested: "auto" | "subscription" | "api_key";
1316
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1317
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1318
+ networkScope: "selected_harness_only";
1319
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1320
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1321
+ mayConsumeQuota: boolean;
1322
+ generatedAt: string;
1323
+ };
1324
+ state: "interrupted_unknown";
1325
+ interruptedAt: string;
1326
+ } | undefined;
1327
+ authorization?: {
1328
+ args: string[];
1329
+ commandDigest: string;
1330
+ executionId: string;
1331
+ manifestDigest: string;
1332
+ executable: {
1333
+ sha256: string;
1334
+ mode: number;
1335
+ realpath: string;
1336
+ size: number;
1337
+ device: string;
1338
+ inode: string;
1339
+ };
1340
+ } | undefined;
1341
+ nativeCommand?: {
1342
+ commandDigest: string;
1343
+ finishedAt: string;
1344
+ executionId: string;
1345
+ manifestDigest: string;
1346
+ permitIssuedAt: string | null;
1347
+ commandStarted: boolean;
1348
+ exitCode: number | null;
1349
+ signal: string | null;
1350
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
1351
+ } | undefined;
1352
+ terminationReconciliation?: {
1353
+ status: "empty";
1354
+ observedAt: string;
1355
+ } | undefined;
1356
+ };
1357
+ }[]>;
1358
+ cancelSetupJob: (input: unknown) => Promise<{
1359
+ message: string;
1360
+ harness: "cursor" | "codex" | "claude";
1361
+ startedAt: string | null;
1362
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
1363
+ profileId: string | null;
1364
+ command: string | null;
1365
+ createdAt: string;
1366
+ jobId: string;
1367
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
1368
+ finishedAt: string | null;
1369
+ action: "login";
1370
+ guideUrl: string | null;
1371
+ outcome?: {
1372
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
1373
+ exitCode?: number | null | undefined;
1374
+ signal?: string | null | undefined;
1375
+ } | undefined;
1376
+ execution?: {
1377
+ observedAt: string;
1378
+ commandDigest: string;
1379
+ executionId: string;
1380
+ manifestDigest: string;
1381
+ processGroup: {
1382
+ schemaVersion: 1;
1383
+ pgid: number;
1384
+ leader: {
1385
+ status: "known";
1386
+ source: "procfs_stat" | "proc_pidinfo";
1387
+ pid: number;
1388
+ platform: "linux" | "darwin";
1389
+ startToken: string;
1390
+ processGroupId: number;
1391
+ };
1392
+ };
1393
+ permitIssuedAt?: string | undefined;
1394
+ } | undefined;
1395
+ deadlineAt?: string | undefined;
1396
+ authCapability?: {
1397
+ attemptId: string;
1398
+ challengeDigest: string;
1399
+ requestDigest: string;
1400
+ disclosure: {
1401
+ schemaVersion: 1;
1402
+ protocolVersion: 1;
1403
+ harness: string;
1404
+ requested: "auto" | "subscription" | "api_key";
1405
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1406
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1407
+ networkScope: "selected_harness_only";
1408
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1409
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1410
+ mayConsumeQuota: boolean;
1411
+ generatedAt: string;
1412
+ };
1413
+ state: "disclosed";
1414
+ } | {
1415
+ attemptId: string;
1416
+ startedAt: string;
1417
+ challengeDigest: string;
1418
+ requestDigest: string;
1419
+ disclosure: {
1420
+ schemaVersion: 1;
1421
+ protocolVersion: 1;
1422
+ harness: string;
1423
+ requested: "auto" | "subscription" | "api_key";
1424
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1425
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1426
+ networkScope: "selected_harness_only";
1427
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1428
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1429
+ mayConsumeQuota: boolean;
1430
+ generatedAt: string;
1431
+ };
1432
+ state: "running";
1433
+ } | {
1434
+ attemptId: string;
1435
+ startedAt: string;
1436
+ completedAt: string;
1437
+ challengeDigest: string;
1438
+ requestDigest: string;
1439
+ disclosure: {
1440
+ schemaVersion: 1;
1441
+ protocolVersion: 1;
1442
+ harness: string;
1443
+ requested: "auto" | "subscription" | "api_key";
1444
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1445
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1446
+ networkScope: "selected_harness_only";
1447
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1448
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1449
+ mayConsumeQuota: boolean;
1450
+ generatedAt: string;
1451
+ };
1452
+ state: "completed";
1453
+ receipt: {
1454
+ availability: "unknown" | "available" | "unavailable";
1455
+ verification: "passed" | "failed" | "not_run";
1456
+ harness: string;
1457
+ requested: "auto" | "subscription" | "api_key";
1458
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1459
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1460
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1461
+ receiptId: string;
1462
+ attemptId: string;
1463
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
1464
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
1465
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
1466
+ costKnowledge: "exact" | "unknown" | "estimated";
1467
+ startedAt: string;
1468
+ completedAt: string;
1469
+ challengeDigest: string;
1470
+ requestDigest: string;
1471
+ responseDigest: string;
1472
+ streamDigest: string;
1473
+ scratchBeforeDigest: string;
1474
+ scratchAfterDigest: string;
1475
+ stream: {
1476
+ aborted: boolean;
1477
+ startedEvents: number;
1478
+ completedEvents: number;
1479
+ errorEvents: number;
1480
+ unexpectedToolEvents: number;
1481
+ interactionEvents: number;
1482
+ sessionMismatchEvents: number;
1483
+ eventsAfterCompleted: number;
1484
+ };
1485
+ evidenceRefs: string[];
1486
+ costUsd?: number | undefined;
1487
+ };
1488
+ } | {
1489
+ attemptId: string;
1490
+ startedAt: string;
1491
+ challengeDigest: string;
1492
+ requestDigest: string;
1493
+ disclosure: {
1494
+ schemaVersion: 1;
1495
+ protocolVersion: 1;
1496
+ harness: string;
1497
+ requested: "auto" | "subscription" | "api_key";
1498
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1499
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1500
+ networkScope: "selected_harness_only";
1501
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1502
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1503
+ mayConsumeQuota: boolean;
1504
+ generatedAt: string;
1505
+ };
1506
+ state: "interrupted_unknown";
1507
+ interruptedAt: string;
1508
+ } | undefined;
1509
+ authorization?: {
1510
+ args: string[];
1511
+ commandDigest: string;
1512
+ executionId: string;
1513
+ manifestDigest: string;
1514
+ executable: {
1515
+ sha256: string;
1516
+ mode: number;
1517
+ realpath: string;
1518
+ size: number;
1519
+ device: string;
1520
+ inode: string;
1521
+ };
1522
+ } | undefined;
1523
+ nativeCommand?: {
1524
+ commandDigest: string;
1525
+ finishedAt: string;
1526
+ executionId: string;
1527
+ manifestDigest: string;
1528
+ permitIssuedAt: string | null;
1529
+ commandStarted: boolean;
1530
+ exitCode: number | null;
1531
+ signal: string | null;
1532
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
1533
+ } | undefined;
1534
+ terminationReconciliation?: {
1535
+ status: "empty";
1536
+ observedAt: string;
1537
+ } | undefined;
1538
+ }>;
1539
+ reconcileSetupJob: (input: unknown) => Promise<{
1540
+ message: string;
1541
+ harness: "cursor" | "codex" | "claude";
1542
+ startedAt: string | null;
1543
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
1544
+ profileId: string | null;
1545
+ command: string | null;
1546
+ createdAt: string;
1547
+ jobId: string;
1548
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
1549
+ finishedAt: string | null;
1550
+ action: "login";
1551
+ guideUrl: string | null;
1552
+ outcome?: {
1553
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
1554
+ exitCode?: number | null | undefined;
1555
+ signal?: string | null | undefined;
1556
+ } | undefined;
1557
+ execution?: {
1558
+ observedAt: string;
1559
+ commandDigest: string;
1560
+ executionId: string;
1561
+ manifestDigest: string;
1562
+ processGroup: {
1563
+ schemaVersion: 1;
1564
+ pgid: number;
1565
+ leader: {
1566
+ status: "known";
1567
+ source: "procfs_stat" | "proc_pidinfo";
1568
+ pid: number;
1569
+ platform: "linux" | "darwin";
1570
+ startToken: string;
1571
+ processGroupId: number;
1572
+ };
1573
+ };
1574
+ permitIssuedAt?: string | undefined;
1575
+ } | undefined;
1576
+ deadlineAt?: string | undefined;
1577
+ authCapability?: {
1578
+ attemptId: string;
1579
+ challengeDigest: string;
1580
+ requestDigest: string;
1581
+ disclosure: {
1582
+ schemaVersion: 1;
1583
+ protocolVersion: 1;
1584
+ harness: string;
1585
+ requested: "auto" | "subscription" | "api_key";
1586
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1587
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1588
+ networkScope: "selected_harness_only";
1589
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1590
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1591
+ mayConsumeQuota: boolean;
1592
+ generatedAt: string;
1593
+ };
1594
+ state: "disclosed";
1595
+ } | {
1596
+ attemptId: string;
1597
+ startedAt: string;
1598
+ challengeDigest: string;
1599
+ requestDigest: string;
1600
+ disclosure: {
1601
+ schemaVersion: 1;
1602
+ protocolVersion: 1;
1603
+ harness: string;
1604
+ requested: "auto" | "subscription" | "api_key";
1605
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1606
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1607
+ networkScope: "selected_harness_only";
1608
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1609
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1610
+ mayConsumeQuota: boolean;
1611
+ generatedAt: string;
1612
+ };
1613
+ state: "running";
1614
+ } | {
1615
+ attemptId: string;
1616
+ startedAt: string;
1617
+ completedAt: string;
1618
+ challengeDigest: string;
1619
+ requestDigest: string;
1620
+ disclosure: {
1621
+ schemaVersion: 1;
1622
+ protocolVersion: 1;
1623
+ harness: string;
1624
+ requested: "auto" | "subscription" | "api_key";
1625
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1626
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1627
+ networkScope: "selected_harness_only";
1628
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1629
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1630
+ mayConsumeQuota: boolean;
1631
+ generatedAt: string;
1632
+ };
1633
+ state: "completed";
1634
+ receipt: {
1635
+ availability: "unknown" | "available" | "unavailable";
1636
+ verification: "passed" | "failed" | "not_run";
1637
+ harness: string;
1638
+ requested: "auto" | "subscription" | "api_key";
1639
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1640
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1641
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1642
+ receiptId: string;
1643
+ attemptId: string;
1644
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
1645
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
1646
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
1647
+ costKnowledge: "exact" | "unknown" | "estimated";
1648
+ startedAt: string;
1649
+ completedAt: string;
1650
+ challengeDigest: string;
1651
+ requestDigest: string;
1652
+ responseDigest: string;
1653
+ streamDigest: string;
1654
+ scratchBeforeDigest: string;
1655
+ scratchAfterDigest: string;
1656
+ stream: {
1657
+ aborted: boolean;
1658
+ startedEvents: number;
1659
+ completedEvents: number;
1660
+ errorEvents: number;
1661
+ unexpectedToolEvents: number;
1662
+ interactionEvents: number;
1663
+ sessionMismatchEvents: number;
1664
+ eventsAfterCompleted: number;
1665
+ };
1666
+ evidenceRefs: string[];
1667
+ costUsd?: number | undefined;
1668
+ };
1669
+ } | {
1670
+ attemptId: string;
1671
+ startedAt: string;
1672
+ challengeDigest: string;
1673
+ requestDigest: string;
1674
+ disclosure: {
1675
+ schemaVersion: 1;
1676
+ protocolVersion: 1;
1677
+ harness: string;
1678
+ requested: "auto" | "subscription" | "api_key";
1679
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1680
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1681
+ networkScope: "selected_harness_only";
1682
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1683
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1684
+ mayConsumeQuota: boolean;
1685
+ generatedAt: string;
1686
+ };
1687
+ state: "interrupted_unknown";
1688
+ interruptedAt: string;
1689
+ } | undefined;
1690
+ authorization?: {
1691
+ args: string[];
1692
+ commandDigest: string;
1693
+ executionId: string;
1694
+ manifestDigest: string;
1695
+ executable: {
1696
+ sha256: string;
1697
+ mode: number;
1698
+ realpath: string;
1699
+ size: number;
1700
+ device: string;
1701
+ inode: string;
1702
+ };
1703
+ } | undefined;
1704
+ nativeCommand?: {
1705
+ commandDigest: string;
1706
+ finishedAt: string;
1707
+ executionId: string;
1708
+ manifestDigest: string;
1709
+ permitIssuedAt: string | null;
1710
+ commandStarted: boolean;
1711
+ exitCode: number | null;
1712
+ signal: string | null;
1713
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
1714
+ } | undefined;
1715
+ terminationReconciliation?: {
1716
+ status: "empty";
1717
+ observedAt: string;
1718
+ } | undefined;
1719
+ }>;
1720
+ extendSetupJob: (input: unknown) => Promise<{
1721
+ message: string;
1722
+ harness: "cursor" | "codex" | "claude";
1723
+ startedAt: string | null;
1724
+ state: "failed" | "cancelled" | "running" | "interrupted_unknown" | "queued" | "succeeded" | "timed_out" | "waiting_for_input" | "not_supported";
1725
+ profileId: string | null;
1726
+ command: string | null;
1727
+ createdAt: string;
1728
+ jobId: string;
1729
+ phase: "completed" | "preparing" | "launching" | "awaiting_user" | "verifying" | "cancelling";
1730
+ finishedAt: string | null;
1731
+ action: "login";
1732
+ guideUrl: string | null;
1733
+ outcome?: {
1734
+ reason: "completed" | "interrupted_unknown" | "timed_out" | "not_supported" | "launch_failed" | "command_failed" | "auth_not_ready" | "capability_verification_failed" | "credential_route_mismatch" | "cancelled_by_user" | "cancelled_on_restart" | "interrupted" | "termination_unconfirmed";
1735
+ exitCode?: number | null | undefined;
1736
+ signal?: string | null | undefined;
1737
+ } | undefined;
1738
+ execution?: {
1739
+ observedAt: string;
1740
+ commandDigest: string;
1741
+ executionId: string;
1742
+ manifestDigest: string;
1743
+ processGroup: {
1744
+ schemaVersion: 1;
1745
+ pgid: number;
1746
+ leader: {
1747
+ status: "known";
1748
+ source: "procfs_stat" | "proc_pidinfo";
1749
+ pid: number;
1750
+ platform: "linux" | "darwin";
1751
+ startToken: string;
1752
+ processGroupId: number;
1753
+ };
1754
+ };
1755
+ permitIssuedAt?: string | undefined;
1756
+ } | undefined;
1757
+ deadlineAt?: string | undefined;
1758
+ authCapability?: {
1759
+ attemptId: string;
1760
+ challengeDigest: string;
1761
+ requestDigest: string;
1762
+ disclosure: {
1763
+ schemaVersion: 1;
1764
+ protocolVersion: 1;
1765
+ harness: string;
1766
+ requested: "auto" | "subscription" | "api_key";
1767
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1768
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1769
+ networkScope: "selected_harness_only";
1770
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1771
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1772
+ mayConsumeQuota: boolean;
1773
+ generatedAt: string;
1774
+ };
1775
+ state: "disclosed";
1776
+ } | {
1777
+ attemptId: string;
1778
+ startedAt: string;
1779
+ challengeDigest: string;
1780
+ requestDigest: string;
1781
+ disclosure: {
1782
+ schemaVersion: 1;
1783
+ protocolVersion: 1;
1784
+ harness: string;
1785
+ requested: "auto" | "subscription" | "api_key";
1786
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1787
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1788
+ networkScope: "selected_harness_only";
1789
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1790
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1791
+ mayConsumeQuota: boolean;
1792
+ generatedAt: string;
1793
+ };
1794
+ state: "running";
1795
+ } | {
1796
+ attemptId: string;
1797
+ startedAt: string;
1798
+ completedAt: string;
1799
+ challengeDigest: string;
1800
+ requestDigest: string;
1801
+ disclosure: {
1802
+ schemaVersion: 1;
1803
+ protocolVersion: 1;
1804
+ harness: string;
1805
+ requested: "auto" | "subscription" | "api_key";
1806
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1807
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1808
+ networkScope: "selected_harness_only";
1809
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1810
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1811
+ mayConsumeQuota: boolean;
1812
+ generatedAt: string;
1813
+ };
1814
+ state: "completed";
1815
+ receipt: {
1816
+ availability: "unknown" | "available" | "unavailable";
1817
+ verification: "passed" | "failed" | "not_run";
1818
+ harness: string;
1819
+ requested: "auto" | "subscription" | "api_key";
1820
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1821
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1822
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1823
+ receiptId: string;
1824
+ attemptId: string;
1825
+ effective: "local" | "vendor_native" | "managed_api_key" | null;
1826
+ effectiveSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none" | null;
1827
+ selectionReason: "harness_error" | "exact_requested_route" | "adapter_unavailable" | "request_mismatch" | "route_missing" | "route_mismatch" | "source_missing" | "source_mismatch" | "adapter_error" | "missing_completion" | "response_mismatch" | "scratch_mutated" | "protocol_violation" | "adapter_identity_mismatch" | "cancelled";
1828
+ costKnowledge: "exact" | "unknown" | "estimated";
1829
+ startedAt: string;
1830
+ completedAt: string;
1831
+ challengeDigest: string;
1832
+ requestDigest: string;
1833
+ responseDigest: string;
1834
+ streamDigest: string;
1835
+ scratchBeforeDigest: string;
1836
+ scratchAfterDigest: string;
1837
+ stream: {
1838
+ aborted: boolean;
1839
+ startedEvents: number;
1840
+ completedEvents: number;
1841
+ errorEvents: number;
1842
+ unexpectedToolEvents: number;
1843
+ interactionEvents: number;
1844
+ sessionMismatchEvents: number;
1845
+ eventsAfterCompleted: number;
1846
+ };
1847
+ evidenceRefs: string[];
1848
+ costUsd?: number | undefined;
1849
+ };
1850
+ } | {
1851
+ attemptId: string;
1852
+ startedAt: string;
1853
+ challengeDigest: string;
1854
+ requestDigest: string;
1855
+ disclosure: {
1856
+ schemaVersion: 1;
1857
+ protocolVersion: 1;
1858
+ harness: string;
1859
+ requested: "auto" | "subscription" | "api_key";
1860
+ requiredRoute: "local" | "vendor_native" | "managed_api_key";
1861
+ requiredSource: "native_session" | "oauth_token_env" | "api_key_env" | "api_key_flag" | "provider_auth_file" | "none";
1862
+ networkScope: "selected_harness_only";
1863
+ billingKnowledge: "unknown" | "proven_zero" | "subscription_entitlement" | "metered";
1864
+ incrementalCostKnowledge: "exact" | "unknown" | "estimated";
1865
+ mayConsumeQuota: boolean;
1866
+ generatedAt: string;
1867
+ };
1868
+ state: "interrupted_unknown";
1869
+ interruptedAt: string;
1870
+ } | undefined;
1871
+ authorization?: {
1872
+ args: string[];
1873
+ commandDigest: string;
1874
+ executionId: string;
1875
+ manifestDigest: string;
1876
+ executable: {
1877
+ sha256: string;
1878
+ mode: number;
1879
+ realpath: string;
1880
+ size: number;
1881
+ device: string;
1882
+ inode: string;
1883
+ };
1884
+ } | undefined;
1885
+ nativeCommand?: {
1886
+ commandDigest: string;
1887
+ finishedAt: string;
1888
+ executionId: string;
1889
+ manifestDigest: string;
1890
+ permitIssuedAt: string | null;
1891
+ commandStarted: boolean;
1892
+ exitCode: number | null;
1893
+ signal: string | null;
1894
+ errorCode?: "permit_timeout" | "spawn_failed" | undefined;
1895
+ } | undefined;
1896
+ terminationReconciliation?: {
1897
+ status: "empty";
1898
+ observedAt: string;
1899
+ } | undefined;
1900
+ }>;
1901
+ journalEvents: (partition: string, afterCursor?: string) => Promise<{
1902
+ type: string;
1903
+ cursor: string;
1904
+ observedAt: string;
1905
+ schemaVersion: 1;
1906
+ partition: string;
1907
+ payload?: unknown;
1908
+ }[]>;
1909
+ recoveryInspectPartition: (partition: string) => Promise<{
1910
+ status: "ready" | "recovery_required";
1911
+ observedAt: string;
1912
+ schemaVersion: 1;
1913
+ evidenceRefs: string[];
1914
+ recovery: {
1915
+ status: "ready";
1916
+ discardedTailBytes: number;
1917
+ } | {
1918
+ status: "recovery_required";
1919
+ reason: string;
1920
+ discardedTailBytes: number;
1921
+ location: {
1922
+ kind: "byte";
1923
+ byteOffset: number;
1924
+ } | {
1925
+ kind: "cursor";
1926
+ seq: number;
1927
+ epoch: string;
1928
+ };
1929
+ };
1930
+ partition: string;
1931
+ generation: number;
1932
+ fingerprint: string;
1933
+ }>;
1934
+ recoveryValidatePartition: (partition: string) => Promise<{
1935
+ status: "ready" | "recovery_required";
1936
+ observedAt: string;
1937
+ schemaVersion: 1;
1938
+ evidenceRefs: string[];
1939
+ recovery: {
1940
+ status: "ready";
1941
+ discardedTailBytes: number;
1942
+ } | {
1943
+ status: "recovery_required";
1944
+ reason: string;
1945
+ discardedTailBytes: number;
1946
+ location: {
1947
+ kind: "byte";
1948
+ byteOffset: number;
1949
+ } | {
1950
+ kind: "cursor";
1951
+ seq: number;
1952
+ epoch: string;
1953
+ };
1954
+ };
1955
+ partition: string;
1956
+ generation: number;
1957
+ fingerprint: string;
1958
+ projectionStatus: {
1959
+ status: "valid" | "invalid";
1960
+ detail: string | null;
1961
+ name: string;
1962
+ }[];
1963
+ }>;
1964
+ recoveryExportPartition: (partition: string) => Promise<{
1965
+ schemaVersion: 1;
1966
+ createdAt: string;
1967
+ partition: string;
1968
+ fingerprint: string;
1969
+ exportId: string;
1970
+ bundlePath: string;
1971
+ manifestSha256: string;
1972
+ }>;
1973
+ recoveryQuarantinePartition: (partition: string, input: unknown) => Promise<{
1974
+ schemaVersion: 1;
1975
+ completedAt: string;
1976
+ partition: string;
1977
+ operationId: string;
1978
+ previousFingerprint: string;
1979
+ quarantineArtifactId: string;
1980
+ quarantinePath: string;
1981
+ newEpoch: string;
1982
+ } | null>;
1983
+ settings: () => Promise<{
1984
+ sources: string[];
1985
+ interactionTimeoutMs: number;
1986
+ routing: {
1987
+ defaultPolicy: "auto" | "primary";
1988
+ primaryHarness: string | null;
1989
+ eligibleHarnesses: string[];
1990
+ envInheritance: "mirror_native" | "clean";
1991
+ authPreference: "auto" | "api_key" | "subscription";
1992
+ goal: "auto" | "quality" | "economy";
1993
+ paidFallback: "never" | "when_unavailable" | "allowed_within_cap";
1994
+ qualityTiers: Partial<Record<"synthesize" | "plan" | "audit" | "orchestrate" | "spec" | "review" | "implement" | "create_from_scratch" | "repair" | "verify" | "explain", {
1995
+ harness: string;
1996
+ model: string;
1997
+ effort: "low" | "medium" | "high" | "xhigh" | "max";
1998
+ }[][]>>;
1999
+ };
2000
+ budget: {
2001
+ paidBudgetPerRun: {
2002
+ kind: "unlimited";
2003
+ } | {
2004
+ kind: "finite";
2005
+ maxUsd: number;
2006
+ };
2007
+ };
2008
+ runtime: {
2009
+ reviewerTimeoutMs: number;
2010
+ harnessInactivityTimeoutMs: number;
2011
+ transientRetry: {
2012
+ maxRetries: number;
2013
+ initialDelayMs: number;
2014
+ maxDelayMs: number;
2015
+ };
2016
+ };
2017
+ harnesses: {
2018
+ [k: string]: {
2019
+ enabled: boolean;
2020
+ defaultModel: string | null;
2021
+ effort: "low" | "medium" | "high" | "xhigh" | "max" | null;
2022
+ maxTurns: number | null;
2023
+ maxRounds: number | null;
2024
+ toolsAllow: string[];
2025
+ toolsDeny: string[];
2026
+ fallbackModel: string | null;
2027
+ web: "auto" | "live" | "off" | "cached";
2028
+ authPreference: "auto" | "api_key" | "subscription";
2029
+ profileLimitAction: "ask" | "fail" | "rotate";
2030
+ };
2031
+ };
2032
+ }>;
2033
+ quota: () => Promise<{
2034
+ snapshots: {
2035
+ source: "codex_app_server" | "codex_rollout" | "claude_statusline" | "claude_api_retry" | "claude_oauth_usage";
2036
+ subject: {
2037
+ harness: string;
2038
+ credential_route: "local" | "vendor_native" | "managed_api_key";
2039
+ plan_label: string | null;
2040
+ subject_id: string | null;
2041
+ };
2042
+ constraints: {
2043
+ id: string;
2044
+ label: string;
2045
+ used_ratio: number | null;
2046
+ window_seconds: number | null;
2047
+ resets_at: string | null;
2048
+ cooldown_until: string | null;
2049
+ }[];
2050
+ observed_at: string;
2051
+ freshness: "unknown" | "fresh" | "stale";
2052
+ }[];
2053
+ refreshed_at: string | null;
2054
+ }>;
2055
+ refreshQuota: () => Promise<{
2056
+ snapshots: {
2057
+ source: "codex_app_server" | "codex_rollout" | "claude_statusline" | "claude_api_retry" | "claude_oauth_usage";
2058
+ subject: {
2059
+ harness: string;
2060
+ credential_route: "local" | "vendor_native" | "managed_api_key";
2061
+ plan_label: string | null;
2062
+ subject_id: string | null;
2063
+ };
2064
+ constraints: {
2065
+ id: string;
2066
+ label: string;
2067
+ used_ratio: number | null;
2068
+ window_seconds: number | null;
2069
+ resets_at: string | null;
2070
+ cooldown_until: string | null;
2071
+ }[];
2072
+ observed_at: string;
2073
+ freshness: "unknown" | "fresh" | "stale";
2074
+ }[];
2075
+ refreshed_at: string | null;
2076
+ }>;
2077
+ credentialProfiles: () => Promise<{
2078
+ profiles: {
2079
+ profile: {
2080
+ profile_id: string;
2081
+ harness_id: string;
2082
+ display_name: string;
2083
+ credential_kind: "api_key" | "config_dir_login" | "oauth_token";
2084
+ isolation_locator: string | null;
2085
+ secret_ref: string | null;
2086
+ enabled: boolean;
2087
+ created_at: string | null;
2088
+ };
2089
+ status: {
2090
+ availability: "unknown" | "available" | "unavailable";
2091
+ verification: "passed" | "failed" | "not_run";
2092
+ profile_id: string;
2093
+ harness_id: string;
2094
+ last_verified_at: string | null;
2095
+ detail?: string | undefined;
2096
+ };
2097
+ }[];
2098
+ }>;
2099
+ deleteCredentialProfile: (input: unknown) => Promise<{
2100
+ cleanupWarning?: string | undefined;
2101
+ profile: {
2102
+ profile_id: string;
2103
+ harness_id: string;
2104
+ display_name: string;
2105
+ credential_kind: "api_key" | "config_dir_login" | "oauth_token";
2106
+ isolation_locator: string | null;
2107
+ secret_ref: string | null;
2108
+ enabled: boolean;
2109
+ created_at: string | null;
2110
+ };
2111
+ removed: boolean;
2112
+ credentialCleanup: "none" | "config_dir_removed" | "secret_deleted";
2113
+ }>;
2114
+ createCredentialProfile: (input: unknown) => Promise<{
2115
+ profile: {
2116
+ profile_id: string;
2117
+ harness_id: string;
2118
+ display_name: string;
2119
+ credential_kind: "api_key" | "config_dir_login" | "oauth_token";
2120
+ isolation_locator: string | null;
2121
+ secret_ref: string | null;
2122
+ enabled: boolean;
2123
+ created_at: string | null;
2124
+ };
2125
+ status: {
2126
+ availability: "unknown" | "available" | "unavailable";
2127
+ verification: "passed" | "failed" | "not_run";
2128
+ profile_id: string;
2129
+ harness_id: string;
2130
+ last_verified_at: string | null;
2131
+ detail?: string | undefined;
2132
+ };
2133
+ }>;
2134
+ updateSettings: (patch: unknown) => Promise<{
2135
+ sources: string[];
2136
+ interactionTimeoutMs: number;
2137
+ routing: {
2138
+ defaultPolicy: "auto" | "primary";
2139
+ primaryHarness: string | null;
2140
+ eligibleHarnesses: string[];
2141
+ envInheritance: "mirror_native" | "clean";
2142
+ authPreference: "auto" | "api_key" | "subscription";
2143
+ goal: "auto" | "quality" | "economy";
2144
+ paidFallback: "never" | "when_unavailable" | "allowed_within_cap";
2145
+ qualityTiers: Partial<Record<"synthesize" | "plan" | "audit" | "orchestrate" | "spec" | "review" | "implement" | "create_from_scratch" | "repair" | "verify" | "explain", {
2146
+ harness: string;
2147
+ model: string;
2148
+ effort: "low" | "medium" | "high" | "xhigh" | "max";
2149
+ }[][]>>;
2150
+ };
2151
+ budget: {
2152
+ paidBudgetPerRun: {
2153
+ kind: "unlimited";
2154
+ } | {
2155
+ kind: "finite";
2156
+ maxUsd: number;
2157
+ };
2158
+ };
2159
+ runtime: {
2160
+ reviewerTimeoutMs: number;
2161
+ harnessInactivityTimeoutMs: number;
2162
+ transientRetry: {
2163
+ maxRetries: number;
2164
+ initialDelayMs: number;
2165
+ maxDelayMs: number;
2166
+ };
2167
+ };
2168
+ harnesses: {
2169
+ [k: string]: {
2170
+ enabled: boolean;
2171
+ defaultModel: string | null;
2172
+ effort: "low" | "medium" | "high" | "xhigh" | "max" | null;
2173
+ maxTurns: number | null;
2174
+ maxRounds: number | null;
2175
+ toolsAllow: string[];
2176
+ toolsDeny: string[];
2177
+ fallbackModel: string | null;
2178
+ web: "auto" | "live" | "off" | "cached";
2179
+ authPreference: "auto" | "api_key" | "subscription";
2180
+ profileLimitAction: "ask" | "fail" | "rotate";
2181
+ };
2182
+ };
2183
+ }>;
2184
+ listSecrets: () => Promise<{
2185
+ backend: "file";
2186
+ secrets: {
2187
+ name: string;
2188
+ backend: "file";
2189
+ present: true;
2190
+ }[];
2191
+ }>;
2192
+ setSecret: (input: unknown) => Promise<{
2193
+ warning?: string | undefined;
2194
+ name: string;
2195
+ backend: "file";
2196
+ stored: boolean;
2197
+ }>;
2198
+ deleteSecret: (name: string) => Promise<{
2199
+ name: string;
2200
+ deleted: boolean;
2201
+ }>;
2202
+ createSpecSession: (input: {
2203
+ request: ControlSpecQuestionsRequest;
2204
+ idempotencyKey: string;
2205
+ clientId: string;
2206
+ }) => Promise<{
2207
+ state: "failed" | "cancelled" | "interrupted_unknown" | "questions" | "frozen" | "grounding" | "answered" | "freezing";
2208
+ error: string | null;
2209
+ createdAt: string;
2210
+ prompt: string;
2211
+ questions: {
2212
+ options: {
2213
+ id: string;
2214
+ label: string;
2215
+ }[];
2216
+ kind: "text" | "single" | "multi";
2217
+ id: string;
2218
+ prompt: string;
2219
+ tier: number;
2220
+ allow_text: boolean;
2221
+ rationale?: string | undefined;
2222
+ }[];
2223
+ answers: {
2224
+ question_id: string;
2225
+ text: string | null;
2226
+ option_ids: string[];
2227
+ }[];
2228
+ planRunId: string | null;
2229
+ scope: {
2230
+ kind: "project";
2231
+ root: string;
2232
+ context: "auto";
2233
+ };
2234
+ specPath: string | null;
2235
+ specId: string | null;
2236
+ specHash: string | null;
2237
+ threadId: string | null;
2238
+ sessionId: string;
2239
+ updatedAt: string;
2240
+ priorDecisions: {
2241
+ question: string;
2242
+ answer: string;
2243
+ }[];
2244
+ specDir: string | null;
2245
+ }>;
2246
+ listSpecSessions: () => Promise<{
2247
+ sessions: {
2248
+ state: "failed" | "cancelled" | "interrupted_unknown" | "questions" | "frozen" | "grounding" | "answered" | "freezing";
2249
+ error: string | null;
2250
+ createdAt: string;
2251
+ prompt: string;
2252
+ questions: {
2253
+ options: {
2254
+ id: string;
2255
+ label: string;
2256
+ }[];
2257
+ kind: "text" | "single" | "multi";
2258
+ id: string;
2259
+ prompt: string;
2260
+ tier: number;
2261
+ allow_text: boolean;
2262
+ rationale?: string | undefined;
2263
+ }[];
2264
+ answers: {
2265
+ question_id: string;
2266
+ text: string | null;
2267
+ option_ids: string[];
2268
+ }[];
2269
+ planRunId: string | null;
2270
+ scope: {
2271
+ kind: "project";
2272
+ root: string;
2273
+ context: "auto";
2274
+ };
2275
+ specPath: string | null;
2276
+ specId: string | null;
2277
+ specHash: string | null;
2278
+ threadId: string | null;
2279
+ sessionId: string;
2280
+ updatedAt: string;
2281
+ priorDecisions: {
2282
+ question: string;
2283
+ answer: string;
2284
+ }[];
2285
+ specDir: string | null;
2286
+ }[];
2287
+ }>;
2288
+ getSpecSession: (id: string) => Promise<{
2289
+ state: "failed" | "cancelled" | "interrupted_unknown" | "questions" | "frozen" | "grounding" | "answered" | "freezing";
2290
+ error: string | null;
2291
+ createdAt: string;
2292
+ prompt: string;
2293
+ questions: {
2294
+ options: {
2295
+ id: string;
2296
+ label: string;
2297
+ }[];
2298
+ kind: "text" | "single" | "multi";
2299
+ id: string;
2300
+ prompt: string;
2301
+ tier: number;
2302
+ allow_text: boolean;
2303
+ rationale?: string | undefined;
2304
+ }[];
2305
+ answers: {
2306
+ question_id: string;
2307
+ text: string | null;
2308
+ option_ids: string[];
2309
+ }[];
2310
+ planRunId: string | null;
2311
+ scope: {
2312
+ kind: "project";
2313
+ root: string;
2314
+ context: "auto";
2315
+ };
2316
+ specPath: string | null;
2317
+ specId: string | null;
2318
+ specHash: string | null;
2319
+ threadId: string | null;
2320
+ sessionId: string;
2321
+ updatedAt: string;
2322
+ priorDecisions: {
2323
+ question: string;
2324
+ answer: string;
2325
+ }[];
2326
+ specDir: string | null;
2327
+ } | undefined>;
2328
+ answerSpecSession: (id: string, input: ControlSpecAnswersRequest) => Promise<{
2329
+ state: "failed" | "cancelled" | "interrupted_unknown" | "questions" | "frozen" | "grounding" | "answered" | "freezing";
2330
+ error: string | null;
2331
+ createdAt: string;
2332
+ prompt: string;
2333
+ questions: {
2334
+ options: {
2335
+ id: string;
2336
+ label: string;
2337
+ }[];
2338
+ kind: "text" | "single" | "multi";
2339
+ id: string;
2340
+ prompt: string;
2341
+ tier: number;
2342
+ allow_text: boolean;
2343
+ rationale?: string | undefined;
2344
+ }[];
2345
+ answers: {
2346
+ question_id: string;
2347
+ text: string | null;
2348
+ option_ids: string[];
2349
+ }[];
2350
+ planRunId: string | null;
2351
+ scope: {
2352
+ kind: "project";
2353
+ root: string;
2354
+ context: "auto";
2355
+ };
2356
+ specPath: string | null;
2357
+ specId: string | null;
2358
+ specHash: string | null;
2359
+ threadId: string | null;
2360
+ sessionId: string;
2361
+ updatedAt: string;
2362
+ priorDecisions: {
2363
+ question: string;
2364
+ answer: string;
2365
+ }[];
2366
+ specDir: string | null;
2367
+ }>;
2368
+ freezeSpecSession: (id: string) => Promise<{
2369
+ state: "failed" | "cancelled" | "interrupted_unknown" | "questions" | "frozen" | "grounding" | "answered" | "freezing";
2370
+ error: string | null;
2371
+ createdAt: string;
2372
+ prompt: string;
2373
+ questions: {
2374
+ options: {
2375
+ id: string;
2376
+ label: string;
2377
+ }[];
2378
+ kind: "text" | "single" | "multi";
2379
+ id: string;
2380
+ prompt: string;
2381
+ tier: number;
2382
+ allow_text: boolean;
2383
+ rationale?: string | undefined;
2384
+ }[];
2385
+ answers: {
2386
+ question_id: string;
2387
+ text: string | null;
2388
+ option_ids: string[];
2389
+ }[];
2390
+ planRunId: string | null;
2391
+ scope: {
2392
+ kind: "project";
2393
+ root: string;
2394
+ context: "auto";
2395
+ };
2396
+ specPath: string | null;
2397
+ specId: string | null;
2398
+ specHash: string | null;
2399
+ threadId: string | null;
2400
+ sessionId: string;
2401
+ updatedAt: string;
2402
+ priorDecisions: {
2403
+ question: string;
2404
+ answer: string;
2405
+ }[];
2406
+ specDir: string | null;
2407
+ }>;
2408
+ cancelSpecSession: (id: string) => Promise<{
2409
+ state: "failed" | "cancelled" | "interrupted_unknown" | "questions" | "frozen" | "grounding" | "answered" | "freezing";
2410
+ error: string | null;
2411
+ createdAt: string;
2412
+ prompt: string;
2413
+ questions: {
2414
+ options: {
2415
+ id: string;
2416
+ label: string;
2417
+ }[];
2418
+ kind: "text" | "single" | "multi";
2419
+ id: string;
2420
+ prompt: string;
2421
+ tier: number;
2422
+ allow_text: boolean;
2423
+ rationale?: string | undefined;
2424
+ }[];
2425
+ answers: {
2426
+ question_id: string;
2427
+ text: string | null;
2428
+ option_ids: string[];
2429
+ }[];
2430
+ planRunId: string | null;
2431
+ scope: {
2432
+ kind: "project";
2433
+ root: string;
2434
+ context: "auto";
2435
+ };
2436
+ specPath: string | null;
2437
+ specId: string | null;
2438
+ specHash: string | null;
2439
+ threadId: string | null;
2440
+ sessionId: string;
2441
+ updatedAt: string;
2442
+ priorDecisions: {
2443
+ question: string;
2444
+ answer: string;
2445
+ }[];
2446
+ specDir: string | null;
2447
+ }>;
2448
+ resumeSpecSession: (id: string) => Promise<{
2449
+ state: "failed" | "cancelled" | "interrupted_unknown" | "questions" | "frozen" | "grounding" | "answered" | "freezing";
2450
+ error: string | null;
2451
+ createdAt: string;
2452
+ prompt: string;
2453
+ questions: {
2454
+ options: {
2455
+ id: string;
2456
+ label: string;
2457
+ }[];
2458
+ kind: "text" | "single" | "multi";
2459
+ id: string;
2460
+ prompt: string;
2461
+ tier: number;
2462
+ allow_text: boolean;
2463
+ rationale?: string | undefined;
2464
+ }[];
2465
+ answers: {
2466
+ question_id: string;
2467
+ text: string | null;
2468
+ option_ids: string[];
2469
+ }[];
2470
+ planRunId: string | null;
2471
+ scope: {
2472
+ kind: "project";
2473
+ root: string;
2474
+ context: "auto";
2475
+ };
2476
+ specPath: string | null;
2477
+ specId: string | null;
2478
+ specHash: string | null;
2479
+ threadId: string | null;
2480
+ sessionId: string;
2481
+ updatedAt: string;
2482
+ priorDecisions: {
2483
+ question: string;
2484
+ answer: string;
2485
+ }[];
2486
+ specDir: string | null;
2487
+ }>;
2488
+ };
2489
+ export {};
2490
+ //# sourceMappingURL=control-services.d.ts.map