@claudexor/schema 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -0
  3. package/dist/agent-capabilities.d.ts +366 -0
  4. package/dist/agent-capabilities.d.ts.map +1 -0
  5. package/dist/agent-capabilities.js +125 -0
  6. package/dist/agent-capabilities.js.map +1 -0
  7. package/dist/apply-eligibility.d.ts +76 -0
  8. package/dist/apply-eligibility.d.ts.map +1 -0
  9. package/dist/apply-eligibility.js +37 -0
  10. package/dist/apply-eligibility.js.map +1 -0
  11. package/dist/attachment.d.ts +69 -0
  12. package/dist/attachment.d.ts.map +1 -0
  13. package/dist/attachment.js +54 -0
  14. package/dist/attachment.js.map +1 -0
  15. package/dist/budget.d.ts +75 -0
  16. package/dist/budget.d.ts.map +1 -0
  17. package/dist/budget.js +54 -0
  18. package/dist/budget.js.map +1 -0
  19. package/dist/config.d.ts +743 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +194 -0
  22. package/dist/config.js.map +1 -0
  23. package/dist/context.d.ts +222 -0
  24. package/dist/context.d.ts.map +1 -0
  25. package/dist/context.js +70 -0
  26. package/dist/context.js.map +1 -0
  27. package/dist/control-run-detail.d.ts +1686 -0
  28. package/dist/control-run-detail.d.ts.map +1 -0
  29. package/dist/control-run-detail.js +107 -0
  30. package/dist/control-run-detail.js.map +1 -0
  31. package/dist/control-trust.d.ts +79 -0
  32. package/dist/control-trust.d.ts.map +1 -0
  33. package/dist/control-trust.js +39 -0
  34. package/dist/control-trust.js.map +1 -0
  35. package/dist/control.d.ts +4226 -0
  36. package/dist/control.d.ts.map +1 -0
  37. package/dist/control.js +1022 -0
  38. package/dist/control.js.map +1 -0
  39. package/dist/decision.d.ts +208 -0
  40. package/dist/decision.d.ts.map +1 -0
  41. package/dist/decision.js +98 -0
  42. package/dist/decision.js.map +1 -0
  43. package/dist/events.d.ts +70 -0
  44. package/dist/events.d.ts.map +1 -0
  45. package/dist/events.js +105 -0
  46. package/dist/events.js.map +1 -0
  47. package/dist/gate.d.ts +37 -0
  48. package/dist/gate.d.ts.map +1 -0
  49. package/dist/gate.js +20 -0
  50. package/dist/gate.js.map +1 -0
  51. package/dist/harness.d.ts +1418 -0
  52. package/dist/harness.d.ts.map +1 -0
  53. package/dist/harness.js +552 -0
  54. package/dist/harness.js.map +1 -0
  55. package/dist/index.d.ts +32 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +32 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/orchestrate.d.ts +428 -0
  60. package/dist/orchestrate.d.ts.map +1 -0
  61. package/dist/orchestrate.js +246 -0
  62. package/dist/orchestrate.js.map +1 -0
  63. package/dist/primitives.d.ts +71 -0
  64. package/dist/primitives.d.ts.map +1 -0
  65. package/dist/primitives.js +114 -0
  66. package/dist/primitives.js.map +1 -0
  67. package/dist/review.d.ts +220 -0
  68. package/dist/review.d.ts.map +1 -0
  69. package/dist/review.js +91 -0
  70. package/dist/review.js.map +1 -0
  71. package/dist/route.d.ts +67 -0
  72. package/dist/route.d.ts.map +1 -0
  73. package/dist/route.js +33 -0
  74. package/dist/route.js.map +1 -0
  75. package/dist/spec.d.ts +561 -0
  76. package/dist/spec.d.ts.map +1 -0
  77. package/dist/spec.js +133 -0
  78. package/dist/spec.js.map +1 -0
  79. package/dist/surface-run-controls.d.ts +14 -0
  80. package/dist/surface-run-controls.d.ts.map +1 -0
  81. package/dist/surface-run-controls.js +142 -0
  82. package/dist/surface-run-controls.js.map +1 -0
  83. package/dist/task.d.ts +565 -0
  84. package/dist/task.d.ts.map +1 -0
  85. package/dist/task.js +186 -0
  86. package/dist/task.js.map +1 -0
  87. package/dist/telemetry.d.ts +660 -0
  88. package/dist/telemetry.d.ts.map +1 -0
  89. package/dist/telemetry.js +140 -0
  90. package/dist/telemetry.js.map +1 -0
  91. package/dist/thread.d.ts +348 -0
  92. package/dist/thread.d.ts.map +1 -0
  93. package/dist/thread.js +194 -0
  94. package/dist/thread.js.map +1 -0
  95. package/dist/workproduct.d.ts +31 -0
  96. package/dist/workproduct.d.ts.map +1 -0
  97. package/dist/workproduct.js +25 -0
  98. package/dist/workproduct.js.map +1 -0
  99. package/dist/workspace.d.ts +53 -0
  100. package/dist/workspace.d.ts.map +1 -0
  101. package/dist/workspace.js +30 -0
  102. package/dist/workspace.js.map +1 -0
  103. package/generated/AgentCapabilityCatalog.schema.json +389 -0
  104. package/generated/ApplyEligibility.schema.json +44 -0
  105. package/generated/BudgetLease.schema.json +95 -0
  106. package/generated/BudgetObservation.schema.json +76 -0
  107. package/generated/ConformanceReport.schema.json +107 -0
  108. package/generated/ContextPack.schema.json +186 -0
  109. package/generated/ControlApplyCheckRequest.schema.json +54 -0
  110. package/generated/ControlApplyRequest.schema.json +74 -0
  111. package/generated/ControlHarnessListResponse.schema.json +498 -0
  112. package/generated/ControlHarnessModelsResponse.schema.json +78 -0
  113. package/generated/ControlHarnessSettingsPatch.schema.json +130 -0
  114. package/generated/ControlInteractionAnswerRequest.schema.json +48 -0
  115. package/generated/ControlInteractionAnswerResponse.schema.json +35 -0
  116. package/generated/ControlPendingInteraction.schema.json +129 -0
  117. package/generated/ControlQueuedRunInfo.schema.json +44 -0
  118. package/generated/ControlRunControlRequest.schema.json +61 -0
  119. package/generated/ControlRunControlResponse.schema.json +40 -0
  120. package/generated/ControlRunDecisionRequest.schema.json +98 -0
  121. package/generated/ControlRunDecisionResponse.schema.json +40 -0
  122. package/generated/ControlRunDetail.schema.json +1925 -0
  123. package/generated/ControlRunStartInfo.schema.json +33 -0
  124. package/generated/ControlRunStartRequest.schema.json +429 -0
  125. package/generated/ControlRunSummary.schema.json +666 -0
  126. package/generated/ControlSecretListResponse.schema.json +57 -0
  127. package/generated/ControlSettingsSnapshot.schema.json +281 -0
  128. package/generated/ControlSettingsUpdateRequest.schema.json +212 -0
  129. package/generated/ControlSetupJob.schema.json +148 -0
  130. package/generated/ControlSetupJobConfirmRequest.schema.json +18 -0
  131. package/generated/ControlSetupJobCreateRequest.schema.json +38 -0
  132. package/generated/ControlSetupJobEvent.schema.json +58 -0
  133. package/generated/ControlSetupJobListResponse.schema.json +162 -0
  134. package/generated/ControlSpecFreezeRequest.schema.json +83 -0
  135. package/generated/ControlSpecQuestionsRequest.schema.json +80 -0
  136. package/generated/ControlThread.schema.json +129 -0
  137. package/generated/ControlThreadApplyRequest.schema.json +32 -0
  138. package/generated/ControlThreadApplyResponse.schema.json +47 -0
  139. package/generated/ControlThreadCreateRequest.schema.json +107 -0
  140. package/generated/ControlThreadDetail.schema.json +515 -0
  141. package/generated/ControlThreadListResponse.schema.json +141 -0
  142. package/generated/ControlThreadUpdateRequest.schema.json +46 -0
  143. package/generated/ControlTrustListResponse.schema.json +59 -0
  144. package/generated/ControlTrustState.schema.json +45 -0
  145. package/generated/ControlTrustUpdateRequest.schema.json +26 -0
  146. package/generated/DecisionRecord.schema.json +232 -0
  147. package/generated/GateResult.schema.json +81 -0
  148. package/generated/GlobalConfig.schema.json +313 -0
  149. package/generated/HarnessEvent.schema.json +360 -0
  150. package/generated/HarnessManifest.schema.json +350 -0
  151. package/generated/HarnessModel.schema.json +41 -0
  152. package/generated/HarnessStatusDto.schema.json +486 -0
  153. package/generated/McpRunToolResult.schema.json +91 -0
  154. package/generated/OrchestrateContract.schema.json +93 -0
  155. package/generated/OrchestratePlan.schema.json +244 -0
  156. package/generated/OrchestratePlanProgress.schema.json +103 -0
  157. package/generated/ProjectConfig.schema.json +95 -0
  158. package/generated/ReviewFinding.schema.json +226 -0
  159. package/generated/RouteFallbackPayload.schema.json +79 -0
  160. package/generated/RouteProof.schema.json +111 -0
  161. package/generated/RunControl.schema.json +51 -0
  162. package/generated/RunEvent.schema.json +103 -0
  163. package/generated/RunFailure.schema.json +98 -0
  164. package/generated/RunTelemetry.schema.json +433 -0
  165. package/generated/SecretMetadata.schema.json +34 -0
  166. package/generated/Session.schema.json +80 -0
  167. package/generated/SessionReboundLineage.schema.json +73 -0
  168. package/generated/SpecPack.schema.json +372 -0
  169. package/generated/TaskContract.schema.json +501 -0
  170. package/generated/Thread.schema.json +176 -0
  171. package/generated/ThreadTurn.schema.json +172 -0
  172. package/generated/TrustConfig.schema.json +44 -0
  173. package/generated/WorkProduct.schema.json +60 -0
  174. package/generated/WorkspaceEnvelope.schema.json +94 -0
  175. package/package.json +43 -0
@@ -0,0 +1,37 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * ApplyEligibility — the derived "can this run's WorkProduct be applied RIGHT
4
+ * NOW, and if not, what unblocks it" verdict. ONE producer (the delivery
5
+ * gate's deriveApplyEligibility over validateApplyGate + the apply hint);
6
+ * projected on GET /runs/:id, MCP structured results, and CLI --json output
7
+ * so every surface answers identically instead of re-implying eligibility
8
+ * from raw state fields.
9
+ */
10
+ export const ApplyEligibility = z
11
+ .object({
12
+ eligible: z.boolean().describe("True when the apply gate would accept this run's patch right now."),
13
+ state: z
14
+ .string()
15
+ .nullable()
16
+ .describe("The gate's state classification (e.g. blocked | ungated | review_not_run | no_op | ok) when known."),
17
+ reason: z.string().nullable().describe("The gate's refusal text when not eligible (null when eligible)."),
18
+ requiredAction: z
19
+ .string()
20
+ .nullable()
21
+ .describe("Honest guidance for what actually unblocks apply (typed operator decision, add gates, re-run, or nothing to apply)."),
22
+ })
23
+ .describe("Derived apply-gate verdict for a run's WorkProduct (single producer in the delivery gate).");
24
+ /**
25
+ * The structured result shape MCP run tools return (structuredContent).
26
+ * Text content mirrors it for hosts without structured-output support.
27
+ */
28
+ export const McpRunToolResult = z
29
+ .object({
30
+ summary: z.string().describe("Human-readable outcome summary (same text as the tool's text content)."),
31
+ runId: z.string().nullable().describe("Daemon run id (recovery handle for inspect/follow/apply/decision); null for in-process read-only runs."),
32
+ runDir: z.string().nullable().describe("Artifact directory of the run; null when not persisted."),
33
+ status: z.string().nullable().describe("Terminal run status (success | blocked | failed | cancelled | ...)."),
34
+ applyEligibility: ApplyEligibility.nullable().describe("Apply-gate verdict for mutating runs; null for read-only routes or when no patch exists."),
35
+ })
36
+ .describe("Structured MCP tool result for Claudexor run tools.");
37
+ //# sourceMappingURL=apply-eligibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-eligibility.js","sourceRoot":"","sources":["../src/apply-eligibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,mEAAmE,CAAC;IACnG,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,oGAAoG,CAAC;IACjH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;IACzG,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,qHAAqH,CAAC;CACnI,CAAC;KACD,QAAQ,CAAC,4FAA4F,CAAC,CAAC;AAG1G;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wEAAwE,CAAC;IACtG,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wGAAwG,CAAC;IAC/I,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IACjG,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qEAAqE,CAAC;IAC7G,gBAAgB,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0FAA0F,CAAC;CACnJ,CAAC;KACD,QAAQ,CAAC,qDAAqD,CAAC,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * A user- or agent-provided file/image attached to a turn. `path` is the
4
+ * resolved on-disk location in the scoped attachment store (kept OUTSIDE any
5
+ * worktree so `git add -A` cannot capture it); an adapter reads bytes from
6
+ * there to forward to its harness in that harness's native shape.
7
+ */
8
+ export declare const AttachmentKind: z.ZodEnum<["image", "file"]>;
9
+ export type AttachmentKind = z.infer<typeof AttachmentKind>;
10
+ export declare const Attachment: z.ZodObject<{
11
+ id: z.ZodString;
12
+ kind: z.ZodDefault<z.ZodEnum<["image", "file"]>>;
13
+ mime: z.ZodDefault<z.ZodString>;
14
+ name: z.ZodDefault<z.ZodString>;
15
+ /** Resolved local path in the scoped attachment store. */
16
+ path: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ path: string;
19
+ id: string;
20
+ kind: "image" | "file";
21
+ mime: string;
22
+ name: string;
23
+ }, {
24
+ path: string;
25
+ id: string;
26
+ kind?: "image" | "file" | undefined;
27
+ mime?: string | undefined;
28
+ name?: string | undefined;
29
+ }>;
30
+ export type Attachment = z.infer<typeof Attachment>;
31
+ /**
32
+ * Inbound attachment on a control request. Thread/composer uploads may arrive
33
+ * base64-inline (`data`) for a fresh upload; direct non-thread run enqueue
34
+ * accepts only non-empty absolute existing file paths so bytes cannot persist in
35
+ * the daemon job registry. The daemon/turn store resolves inbound bytes to a
36
+ * durable {@link Attachment}. Exactly one of `data` / `path` is expected; both
37
+ * null is rejected by the resolver (fail loud, never a silent empty attachment).
38
+ */
39
+ export declare const AttachmentInput: z.ZodObject<{
40
+ kind: z.ZodDefault<z.ZodEnum<["image", "file"]>>;
41
+ mime: z.ZodDefault<z.ZodString>;
42
+ name: z.ZodDefault<z.ZodString>;
43
+ data: z.ZodDefault<z.ZodNullable<z.ZodString>>;
44
+ path: z.ZodDefault<z.ZodNullable<z.ZodString>>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ path: string | null;
47
+ kind: "image" | "file";
48
+ mime: string;
49
+ name: string;
50
+ data: string | null;
51
+ }, {
52
+ path?: string | null | undefined;
53
+ kind?: "image" | "file" | undefined;
54
+ mime?: string | undefined;
55
+ name?: string | undefined;
56
+ data?: string | null | undefined;
57
+ }>;
58
+ export type AttachmentInput = z.infer<typeof AttachmentInput>;
59
+ /**
60
+ * How a harness accepts image input, declared by its adapter manifest and used
61
+ * for honest UI gating + per-adapter serialization (never a normalized wire
62
+ * format): `file_path` (codex `-i`), `base64_stream` (claude stream-json image
63
+ * block), `base64_inline` (raw-api `image_url` data URL), or `none` (cursor /
64
+ * opencode — image attachments are disabled/routed to a vision-capable harness
65
+ * rather than silently dropped; generic file attachments still use Attachment).
66
+ */
67
+ export declare const ImageInputMode: z.ZodEnum<["file_path", "base64_stream", "base64_inline", "none"]>;
68
+ export type ImageInputMode = z.infer<typeof ImageInputMode>;
69
+ //# sourceMappingURL=attachment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AACH,eAAO,MAAM,cAAc,8BAEqD,CAAC;AACjF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,UAAU;;;;;IAMnB,0DAA0D;;;;;;;;;;;;;;EAK3D,CAAC;AACJ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAczB,CAAC;AACJ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,oEAIxB,CAAC;AACJ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { Id } from "./primitives.js";
3
+ /**
4
+ * A user- or agent-provided file/image attached to a turn. `path` is the
5
+ * resolved on-disk location in the scoped attachment store (kept OUTSIDE any
6
+ * worktree so `git add -A` cannot capture it); an adapter reads bytes from
7
+ * there to forward to its harness in that harness's native shape.
8
+ */
9
+ export const AttachmentKind = z
10
+ .enum(["image", "file"])
11
+ .describe("Kind of attachment: image (vision input) or file (generic bytes).");
12
+ export const Attachment = z
13
+ .object({
14
+ id: Id.describe("Attachment id."),
15
+ kind: AttachmentKind.default("file"),
16
+ mime: z.string().default("application/octet-stream").describe("MIME type of the attachment content."),
17
+ name: z.string().default("").describe("Original file name as provided by the user or agent."),
18
+ /** Resolved local path in the scoped attachment store. */
19
+ path: z.string().describe("Resolved local path in the scoped attachment store (kept outside any worktree)."),
20
+ })
21
+ .describe("A user- or agent-provided file/image attached to a turn, stored in the scoped attachment store and forwarded to harnesses in their native shape.");
22
+ /**
23
+ * Inbound attachment on a control request. Thread/composer uploads may arrive
24
+ * base64-inline (`data`) for a fresh upload; direct non-thread run enqueue
25
+ * accepts only non-empty absolute existing file paths so bytes cannot persist in
26
+ * the daemon job registry. The daemon/turn store resolves inbound bytes to a
27
+ * durable {@link Attachment}. Exactly one of `data` / `path` is expected; both
28
+ * null is rejected by the resolver (fail loud, never a silent empty attachment).
29
+ */
30
+ export const AttachmentInput = z
31
+ .object({
32
+ kind: AttachmentKind.default("file"),
33
+ mime: z.string().default("application/octet-stream").describe("MIME type of the attachment content."),
34
+ name: z.string().default("").describe("Original file name for the attachment."),
35
+ data: z.string().nullable().default(null).describe("Base64-inline attachment bytes for a fresh upload; null when path is used instead."),
36
+ path: z
37
+ .string()
38
+ .nullable()
39
+ .default(null)
40
+ .describe("Absolute existing file path to read bytes from; null when data is used instead."),
41
+ })
42
+ .describe("Inbound attachment on a control request; exactly one of data (base64-inline) or path (absolute existing file) is expected, resolved by the daemon into a durable Attachment.");
43
+ /**
44
+ * How a harness accepts image input, declared by its adapter manifest and used
45
+ * for honest UI gating + per-adapter serialization (never a normalized wire
46
+ * format): `file_path` (codex `-i`), `base64_stream` (claude stream-json image
47
+ * block), `base64_inline` (raw-api `image_url` data URL), or `none` (cursor /
48
+ * opencode — image attachments are disabled/routed to a vision-capable harness
49
+ * rather than silently dropped; generic file attachments still use Attachment).
50
+ */
51
+ export const ImageInputMode = z
52
+ .enum(["file_path", "base64_stream", "base64_inline", "none"])
53
+ .describe("How a harness accepts image input: file_path (CLI file argument), base64_stream (base64 image block on the stream), base64_inline (data-URL in the request), or none (no vision input on this route).");
54
+ //# sourceMappingURL=attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment.js","sourceRoot":"","sources":["../src/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;KACvB,QAAQ,CAAC,mEAAmE,CAAC,CAAC;AAGjF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,CAAC;IACN,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IACjC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACrG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IAC7F,0DAA0D;IAC1D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iFAAiF,CAAC;CAC7G,CAAC;KACD,QAAQ,CACP,kJAAkJ,CACnJ,CAAC;AAGJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACrG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IAC/E,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,oFAAoF,CAAC;IACxI,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,iFAAiF,CAAC;CAC/F,CAAC;KACD,QAAQ,CACP,8KAA8K,CAC/K,CAAC;AAGJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,IAAI,CAAC,CAAC,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;KAC7D,QAAQ,CACP,uMAAuM,CACxM,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { z } from "zod";
2
+ export declare const AuthMode: z.ZodEnum<["local_session", "api_key", "unknown"]>;
3
+ export type AuthMode = z.infer<typeof AuthMode>;
4
+ export declare const Portfolio: z.ZodEnum<["daily-rich", "balanced", "cheapest", "strongest", "burn", "subscription-first", "api-overflow", "conserve-claude", "conserve-codex"]>;
5
+ export type Portfolio = z.infer<typeof Portfolio>;
6
+ /** A pre-call reservation. Created before work; settled after. Never post-hoc only. */
7
+ export declare const BudgetLease: z.ZodObject<{
8
+ lease_id: z.ZodString;
9
+ task_id: z.ZodString;
10
+ attempt_id: z.ZodOptional<z.ZodString>;
11
+ intent: z.ZodEnum<["plan", "spec", "implement", "create_from_scratch", "repair", "review", "verify", "synthesize", "explain", "audit", "orchestrate"]>;
12
+ harness_id: z.ZodString;
13
+ model_hint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
14
+ max_usd: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
15
+ reason: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
16
+ created_at: z.ZodString;
17
+ state: z.ZodDefault<z.ZodEnum<["reserved", "settled", "cancelled"]>>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ harness_id: string;
20
+ intent: "plan" | "audit" | "orchestrate" | "spec" | "implement" | "create_from_scratch" | "repair" | "review" | "verify" | "synthesize" | "explain";
21
+ model_hint: string | null;
22
+ max_usd: number | null;
23
+ created_at: string;
24
+ state: "cancelled" | "reserved" | "settled";
25
+ reason: string[];
26
+ lease_id: string;
27
+ task_id: string;
28
+ attempt_id?: string | undefined;
29
+ }, {
30
+ harness_id: string;
31
+ intent: "plan" | "audit" | "orchestrate" | "spec" | "implement" | "create_from_scratch" | "repair" | "review" | "verify" | "synthesize" | "explain";
32
+ created_at: string;
33
+ lease_id: string;
34
+ task_id: string;
35
+ model_hint?: string | null | undefined;
36
+ max_usd?: number | null | undefined;
37
+ state?: "cancelled" | "reserved" | "settled" | undefined;
38
+ reason?: string[] | undefined;
39
+ attempt_id?: string | undefined;
40
+ }>;
41
+ export type BudgetLease = z.infer<typeof BudgetLease>;
42
+ /** An observed quota/usage signal (rate-limit error, used-percent, reset hint). */
43
+ export declare const BudgetObservation: z.ZodObject<{
44
+ harness_id: z.ZodString;
45
+ ts: z.ZodString;
46
+ quality: z.ZodEnum<["exact", "native", "observed", "manual", "unknown"]>;
47
+ kind: z.ZodEnum<["spend", "rate_limited", "used_percent", "cooldown", "manual"]>;
48
+ usd: z.ZodOptional<z.ZodNumber>;
49
+ used_percent: z.ZodOptional<z.ZodNumber>;
50
+ resets_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ cooldown_until: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ detail: z.ZodOptional<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ kind: "rate_limited" | "manual" | "used_percent" | "spend" | "cooldown";
55
+ harness_id: string;
56
+ ts: string;
57
+ quality: "exact" | "unknown" | "manual" | "native" | "observed";
58
+ detail?: string | undefined;
59
+ used_percent?: number | undefined;
60
+ resets_at?: string | null | undefined;
61
+ usd?: number | undefined;
62
+ cooldown_until?: string | null | undefined;
63
+ }, {
64
+ kind: "rate_limited" | "manual" | "used_percent" | "spend" | "cooldown";
65
+ harness_id: string;
66
+ ts: string;
67
+ quality: "exact" | "unknown" | "manual" | "native" | "observed";
68
+ detail?: string | undefined;
69
+ used_percent?: number | undefined;
70
+ resets_at?: string | null | undefined;
71
+ usd?: number | undefined;
72
+ cooldown_until?: string | null | undefined;
73
+ }>;
74
+ export type BudgetObservation = z.infer<typeof BudgetObservation>;
75
+ //# sourceMappingURL=budget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../src/budget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,QAAQ,oDAEuE,CAAC;AAC7F,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,SAAS,mJAcnB,CAAC;AACJ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,uFAAuF;AACvF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBiF,CAAC;AAC1G,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,mFAAmF;AACnF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc2F,CAAC;AAC1H,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
package/dist/budget.js ADDED
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ import { Id, Intent } from "./primitives.js";
3
+ import { SignalQuality } from "./harness.js";
4
+ export const AuthMode = z
5
+ .enum(["local_session", "api_key", "unknown"])
6
+ .describe("Auth mode a route runs under: a native local session, an API key, or unknown.");
7
+ export const Portfolio = z
8
+ .enum([
9
+ "daily-rich",
10
+ "balanced",
11
+ "cheapest",
12
+ "strongest",
13
+ "burn",
14
+ "subscription-first",
15
+ "api-overflow",
16
+ "conserve-claude",
17
+ "conserve-codex",
18
+ ])
19
+ .describe("Budget portfolio weighting the harness router's quality/cost/latency and subscription-vs-API preferences (e.g. cheapest minimizes spend, burn maximizes quality, conserve-* deprioritizes one vendor).");
20
+ /** A pre-call reservation. Created before work; settled after. Never post-hoc only. */
21
+ export const BudgetLease = z
22
+ .object({
23
+ lease_id: Id.describe("Lease id."),
24
+ task_id: Id.describe("Task the lease belongs to."),
25
+ attempt_id: Id.optional().describe("Attempt the lease covers, when scoped to one."),
26
+ intent: Intent,
27
+ harness_id: Id.describe("Harness the reservation is for."),
28
+ model_hint: z.string().nullable().default(null).describe("Requested model for the reserved call; null = harness default."),
29
+ max_usd: z.number().nullable().default(null).describe("USD cap reserved for the call; null = no cap."),
30
+ reason: z.array(z.string()).default([]).describe("Human-readable reasons the lease was created."),
31
+ created_at: z.string().describe("When the lease was created."),
32
+ state: z
33
+ .enum(["reserved", "settled", "cancelled"])
34
+ .default("reserved")
35
+ .describe("Lifecycle state: reserved before work, settled after, or cancelled."),
36
+ })
37
+ .describe("A pre-call budget reservation, created before work and settled after; never post-hoc only.");
38
+ /** An observed quota/usage signal (rate-limit error, used-percent, reset hint). */
39
+ export const BudgetObservation = z
40
+ .object({
41
+ harness_id: Id.describe("Harness the observation is about."),
42
+ ts: z.string().describe("When the signal was observed."),
43
+ quality: SignalQuality,
44
+ kind: z
45
+ .enum(["spend", "rate_limited", "used_percent", "cooldown", "manual"])
46
+ .describe("What was observed: spend, a rate-limit hit, a used-percent reading, a cooldown, or a manual entry."),
47
+ usd: z.number().optional().describe("Observed spend in USD, for spend observations."),
48
+ used_percent: z.number().optional().describe("Consumed share of the rate window (0-100), for used_percent observations."),
49
+ resets_at: z.string().nullable().optional().describe("When the rate window resets, when reported."),
50
+ cooldown_until: z.string().nullable().optional().describe("Until when the harness is in cooldown, when set."),
51
+ detail: z.string().optional().describe("Redacted human-readable detail."),
52
+ })
53
+ .describe("An observed quota/usage signal (rate-limit error, used-percent, reset hint) recorded in the budget ledger.");
54
+ //# sourceMappingURL=budget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"budget.js","sourceRoot":"","sources":["../src/budget.ts"],"names":[],"mappings":"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"}