@claudexor/schema 3.0.4 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/agent-capabilities.d.ts +45 -8
  2. package/dist/agent-capabilities.d.ts.map +1 -1
  3. package/dist/agent-capabilities.js +14 -0
  4. package/dist/agent-capabilities.js.map +1 -1
  5. package/dist/apply-eligibility.d.ts +384 -18
  6. package/dist/apply-eligibility.d.ts.map +1 -1
  7. package/dist/apply-eligibility.js +20 -1
  8. package/dist/apply-eligibility.js.map +1 -1
  9. package/dist/budget.d.ts +84 -9
  10. package/dist/budget.d.ts.map +1 -1
  11. package/dist/budget.js +46 -0
  12. package/dist/budget.js.map +1 -1
  13. package/dist/config.d.ts +97 -65
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/config.js +12 -1
  16. package/dist/config.js.map +1 -1
  17. package/dist/control-operation-responses.d.ts +311 -89
  18. package/dist/control-operation-responses.d.ts.map +1 -1
  19. package/dist/control-operation-responses.js +33 -3
  20. package/dist/control-operation-responses.js.map +1 -1
  21. package/dist/control-run-detail.d.ts +613 -163
  22. package/dist/control-run-detail.d.ts.map +1 -1
  23. package/dist/control-run-detail.js +28 -2
  24. package/dist/control-run-detail.js.map +1 -1
  25. package/dist/control-run-retry.d.ts +1 -1
  26. package/dist/control-run-scope.d.ts +1 -1
  27. package/dist/control-thread-apply.d.ts +10 -0
  28. package/dist/control-thread-apply.d.ts.map +1 -1
  29. package/dist/control.d.ts +791 -232
  30. package/dist/control.d.ts.map +1 -1
  31. package/dist/control.js +76 -2
  32. package/dist/control.js.map +1 -1
  33. package/dist/decision.d.ts +205 -9
  34. package/dist/decision.d.ts.map +1 -1
  35. package/dist/decision.js +69 -1
  36. package/dist/decision.js.map +1 -1
  37. package/dist/deep-scan.d.ts +27 -0
  38. package/dist/deep-scan.d.ts.map +1 -0
  39. package/dist/deep-scan.js +27 -0
  40. package/dist/deep-scan.js.map +1 -0
  41. package/dist/delivery.d.ts +13 -0
  42. package/dist/delivery.d.ts.map +1 -1
  43. package/dist/delivery.js +15 -0
  44. package/dist/delivery.js.map +1 -1
  45. package/dist/effort.d.ts +132 -0
  46. package/dist/effort.d.ts.map +1 -0
  47. package/dist/effort.js +167 -0
  48. package/dist/effort.js.map +1 -0
  49. package/dist/events.d.ts +59 -4
  50. package/dist/events.d.ts.map +1 -1
  51. package/dist/events.js +91 -0
  52. package/dist/events.js.map +1 -1
  53. package/dist/gate.d.ts +2 -2
  54. package/dist/harness.d.ts +209 -28
  55. package/dist/harness.d.ts.map +1 -1
  56. package/dist/harness.js +107 -14
  57. package/dist/harness.js.map +1 -1
  58. package/dist/index.d.ts +4 -0
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +4 -0
  61. package/dist/index.js.map +1 -1
  62. package/dist/operation.d.ts +193 -10
  63. package/dist/operation.d.ts.map +1 -1
  64. package/dist/operation.js +45 -0
  65. package/dist/operation.js.map +1 -1
  66. package/dist/output-schema-dialect.d.ts +22 -0
  67. package/dist/output-schema-dialect.d.ts.map +1 -0
  68. package/dist/output-schema-dialect.js +37 -0
  69. package/dist/output-schema-dialect.js.map +1 -0
  70. package/dist/output-schema.d.ts +26 -2
  71. package/dist/output-schema.d.ts.map +1 -1
  72. package/dist/output-schema.js +313 -16
  73. package/dist/output-schema.js.map +1 -1
  74. package/dist/plan.d.ts +2 -2
  75. package/dist/problem.d.ts +3 -3
  76. package/dist/project.d.ts +47 -12
  77. package/dist/project.d.ts.map +1 -1
  78. package/dist/project.js +32 -0
  79. package/dist/project.js.map +1 -1
  80. package/dist/readiness.d.ts +62 -7
  81. package/dist/readiness.d.ts.map +1 -1
  82. package/dist/recovery.d.ts +14 -14
  83. package/dist/review.d.ts +7 -7
  84. package/dist/route.d.ts +2 -2
  85. package/dist/setup.d.ts +288 -94
  86. package/dist/setup.d.ts.map +1 -1
  87. package/dist/setup.js +90 -6
  88. package/dist/setup.js.map +1 -1
  89. package/dist/status-projection.d.ts +79 -4
  90. package/dist/status-projection.d.ts.map +1 -1
  91. package/dist/status-projection.js +161 -4
  92. package/dist/status-projection.js.map +1 -1
  93. package/dist/task.d.ts +70 -53
  94. package/dist/task.d.ts.map +1 -1
  95. package/dist/task.js +18 -8
  96. package/dist/task.js.map +1 -1
  97. package/dist/telemetry.d.ts +795 -32
  98. package/dist/telemetry.d.ts.map +1 -1
  99. package/dist/telemetry.js +177 -4
  100. package/dist/telemetry.js.map +1 -1
  101. package/dist/tool-ref.d.ts +14 -0
  102. package/dist/tool-ref.d.ts.map +1 -1
  103. package/dist/tool-ref.js +15 -0
  104. package/dist/tool-ref.js.map +1 -1
  105. package/dist/work-report.d.ts +131 -0
  106. package/dist/work-report.d.ts.map +1 -0
  107. package/dist/work-report.js +124 -0
  108. package/dist/work-report.js.map +1 -0
  109. package/dist/workspace.d.ts +2 -2
  110. package/generated/AgentCapabilityCatalog.schema.json +39 -8
  111. package/generated/ControlApplyCheckResponse.schema.json +5 -0
  112. package/generated/ControlDeliveryResponse.schema.json +14 -0
  113. package/generated/ControlHarnessListResponse.schema.json +64 -9
  114. package/generated/ControlHarnessSettingsPatch.schema.json +4 -8
  115. package/generated/ControlOperationCatalog.schema.json +74 -0
  116. package/generated/ControlOperationDescriptor.schema.json +74 -0
  117. package/generated/ControlOperationParameter.schema.json +75 -0
  118. package/generated/ControlProjectRemoveReceipt.schema.json +58 -0
  119. package/generated/ControlRunAgainDraft.schema.json +14 -7
  120. package/generated/ControlRunDetail.schema.json +406 -16
  121. package/generated/ControlRunListResponse.schema.json +232 -10
  122. package/generated/ControlRunStartRequest.schema.json +14 -7
  123. package/generated/ControlRunSummary.schema.json +218 -9
  124. package/generated/ControlSettingsSnapshot.schema.json +4 -8
  125. package/generated/ControlSettingsUpdateRequest.schema.json +4 -8
  126. package/generated/ControlSetupJobCreateRequest.schema.json +2 -1
  127. package/generated/ControlSetupJobEvent.schema.json +28 -0
  128. package/generated/ControlSetupJobSnapshot.schema.json +28 -0
  129. package/generated/ControlThreadApplyResponse.schema.json +14 -0
  130. package/generated/ControlThreadDetail.schema.json +94 -1
  131. package/generated/ControlThreadTurnRequest.schema.json +14 -7
  132. package/generated/DecisionRecord.schema.json +178 -2
  133. package/generated/GlobalConfig.schema.json +4 -8
  134. package/generated/HarnessEvent.schema.json +79 -1
  135. package/generated/HarnessManifest.schema.json +64 -9
  136. package/generated/HarnessStatusDto.schema.json +64 -9
  137. package/generated/McpRunHandleResult.schema.json +286 -1
  138. package/generated/McpRunToolResult.schema.json +171 -1
  139. package/generated/ProjectConfig.schema.json +26 -0
  140. package/generated/RoutePoolDegradedPayload.schema.json +79 -0
  141. package/generated/RunEvent.schema.json +8 -1
  142. package/generated/RunFailure.schema.json +23 -1
  143. package/generated/RunTelemetry.schema.json +376 -1
  144. package/generated/StructuredOutputConformance.schema.json +83 -0
  145. package/generated/TaskContract.schema.json +13 -1
  146. package/package.json +2 -2
@@ -5,8 +5,31 @@
5
5
  * vendor transport gets a strict (all-required + additionalProperties:false)
6
6
  * form. Shared owner for both transforms, harness-agnostic.
7
7
  */
8
+ /**
9
+ * Compile the D-16 transport ENVELOPE that wraps a caller output schema (or a
10
+ * bare string, or nothing) with the WorkReport half. This is the schema that
11
+ * rides `HarnessRunSpec.output_schema` on a work_report-capable route; the
12
+ * caller's ORIGINAL schema stays the conformance authority for `output` after
13
+ * unwrap (grounding §5 — the contract keeps both, never overwriting the
14
+ * caller's copy). `output` controls the no-vs-with-caller shape:
15
+ * - a strictified caller schema → `{ work_report, output: <schema> }`
16
+ * - "string" → `{ work_report, output: {type:"string"} }`
17
+ * (codex/cursor final_message routes with no caller schema: the markdown
18
+ * deliverable rides the string so the constrained final message can carry it)
19
+ * - null → `{ work_report }` only
20
+ * (claude side_tool route with no caller schema: the WorkReport rides its
21
+ * StructuredOutput tool while the final message stays markdown = deliverable)
22
+ */
23
+ export declare function buildWorkReportEnvelope(output: Record<string, unknown> | "string" | null): Record<string, unknown>;
8
24
  /** A caller-supplied output schema the structured-output routes cannot carry. */
25
+ /** Every fail-closed shape refusal is caller-actionable: it must surface as
26
+ * the same typed `invalid_output_schema` contract the compile-failure path
27
+ * uses (W24 errorCode/errorStatus), never as an untyped 500. */
9
28
  export declare class UnsupportedOutputSchemaError extends Error {
29
+ readonly status = 400;
30
+ readonly code = "invalid_output_schema";
31
+ readonly retryable = false;
32
+ readonly requiredActions: string[];
10
33
  }
11
34
  /**
12
35
  * Validate a CALLER-supplied per-run output schema and return it UNCHANGED —
@@ -20,8 +43,9 @@ export declare class UnsupportedOutputSchemaError extends Error {
20
43
  * LIVE-VERIFIED to reject rather than let a vendor 400 surface mid-run: the
21
44
  * root must be an inline `type: "object"` (claude materializes --json-schema as
22
45
  * a StructuredOutput tool whose input_schema needs a top-level type; a
23
- * $ref-wrapped root 400s), `$ref` is refused anywhere, and `format` is refused
24
- * while the pinned claude (<2.1.205) silently drops a format-bearing schema.
46
+ * $ref-wrapped root 400s), references must be resolvable local JSON Pointers,
47
+ * and `format` is refused while the pinned claude (<2.1.205) silently drops a
48
+ * format-bearing schema. Local refs are inlined in the transport-only copy.
25
49
  */
26
50
  export declare function normalizeUserOutputSchema(schema: Record<string, unknown>): Record<string, unknown>;
27
51
  /** Vendor-strict transport form of a validated output schema (all keys
@@ -1 +1 @@
1
- {"version":3,"file":"output-schema.d.ts","sourceRoot":"","sources":["../src/output-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iFAAiF;AACjF,qBAAa,4BAA6B,SAAQ,KAAK;CAAG;AAE1D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+BzB;AAED;;0FAE0F;AAC1F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9F;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiCnF"}
1
+ {"version":3,"file":"output-schema.d.ts","sourceRoot":"","sources":["../src/output-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,GAAG,IAAI,GAChD,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzB;AAED,iFAAiF;AACjF;;iEAEiE;AACjE,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,MAAM,OAAO;IACtB,QAAQ,CAAC,IAAI,2BAA2B;IACxC,QAAQ,CAAC,SAAS,SAAS;IAC3B,QAAQ,CAAC,eAAe,WAA+C;CACxE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBzB;AAED;;0FAE0F;AAC1F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAO9F;AAyUD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiCnF"}
@@ -5,8 +5,40 @@
5
5
  * vendor transport gets a strict (all-required + additionalProperties:false)
6
6
  * form. Shared owner for both transforms, harness-agnostic.
7
7
  */
8
+ import { WORK_REPORT_TRANSPORT_SCHEMA } from "./work-report.js";
9
+ /**
10
+ * Compile the D-16 transport ENVELOPE that wraps a caller output schema (or a
11
+ * bare string, or nothing) with the WorkReport half. This is the schema that
12
+ * rides `HarnessRunSpec.output_schema` on a work_report-capable route; the
13
+ * caller's ORIGINAL schema stays the conformance authority for `output` after
14
+ * unwrap (grounding §5 — the contract keeps both, never overwriting the
15
+ * caller's copy). `output` controls the no-vs-with-caller shape:
16
+ * - a strictified caller schema → `{ work_report, output: <schema> }`
17
+ * - "string" → `{ work_report, output: {type:"string"} }`
18
+ * (codex/cursor final_message routes with no caller schema: the markdown
19
+ * deliverable rides the string so the constrained final message can carry it)
20
+ * - null → `{ work_report }` only
21
+ * (claude side_tool route with no caller schema: the WorkReport rides its
22
+ * StructuredOutput tool while the final message stays markdown = deliverable)
23
+ */
24
+ export function buildWorkReportEnvelope(output) {
25
+ const properties = { work_report: WORK_REPORT_TRANSPORT_SCHEMA };
26
+ const required = ["work_report"];
27
+ if (output !== null) {
28
+ properties["output"] = output === "string" ? { type: "string" } : output;
29
+ required.push("output");
30
+ }
31
+ return { type: "object", properties, required, additionalProperties: false };
32
+ }
8
33
  /** A caller-supplied output schema the structured-output routes cannot carry. */
34
+ /** Every fail-closed shape refusal is caller-actionable: it must surface as
35
+ * the same typed `invalid_output_schema` contract the compile-failure path
36
+ * uses (W24 errorCode/errorStatus), never as an untyped 500. */
9
37
  export class UnsupportedOutputSchemaError extends Error {
38
+ status = 400;
39
+ code = "invalid_output_schema";
40
+ retryable = false;
41
+ requiredActions = ["fix the output schema and retry the run"];
10
42
  }
11
43
  /**
12
44
  * Validate a CALLER-supplied per-run output schema and return it UNCHANGED —
@@ -20,26 +52,18 @@ export class UnsupportedOutputSchemaError extends Error {
20
52
  * LIVE-VERIFIED to reject rather than let a vendor 400 surface mid-run: the
21
53
  * root must be an inline `type: "object"` (claude materializes --json-schema as
22
54
  * a StructuredOutput tool whose input_schema needs a top-level type; a
23
- * $ref-wrapped root 400s), `$ref` is refused anywhere, and `format` is refused
24
- * while the pinned claude (<2.1.205) silently drops a format-bearing schema.
55
+ * $ref-wrapped root 400s), references must be resolvable local JSON Pointers,
56
+ * and `format` is refused while the pinned claude (<2.1.205) silently drops a
57
+ * format-bearing schema. Local refs are inlined in the transport-only copy.
25
58
  */
26
59
  export function normalizeUserOutputSchema(schema) {
27
60
  if (schema["type"] !== "object" || typeof schema["properties"] !== "object") {
28
61
  throw new UnsupportedOutputSchemaError('outputSchema root must be an inline object schema ({"type":"object","properties":{...}}); $ref-wrapped or non-object roots are rejected by the native structured-output routes');
29
62
  }
30
- const hasRef = (value) => {
31
- if (Array.isArray(value))
32
- return value.some(hasRef);
33
- if (!value || typeof value !== "object")
34
- return false;
35
- const obj = value;
36
- if ("$ref" in obj)
37
- return true;
38
- return Object.values(obj).some(hasRef);
39
- };
40
- if (hasRef(schema)) {
41
- throw new UnsupportedOutputSchemaError("outputSchema must not contain $ref (native structured-output routes do not resolve references); inline the referenced shapes");
42
- }
63
+ // Validate every local reference now, before the run is announced. The
64
+ // returned copy is intentionally discarded here: the original schema stays
65
+ // the conformance authority and is compiled by the dialect-aware validator.
66
+ dereferenceLocalOutputSchema(schema);
43
67
  const hasFormat = (value) => {
44
68
  if (Array.isArray(value))
45
69
  return value.some(hasFormat);
@@ -59,7 +83,280 @@ export function normalizeUserOutputSchema(schema) {
59
83
  * required, additionalProperties:false, optionals nullable). Used ONLY to
60
84
  * constrain the harness — NEVER to judge conformance (see normalizeUserOutputSchema). */
61
85
  export function strictifyOutputSchema(schema) {
62
- return strictifyForStructuredOutput(schema);
86
+ const transportSchema = strictifyForStructuredOutput(dereferenceLocalOutputSchema(schema));
87
+ // `$schema` chooses the engine-side conformance validator. Native provider
88
+ // transports accept a strict JSON Schema subset and do not need this
89
+ // meta-schema declaration; keep it only on the untouched caller authority.
90
+ delete transportSchema["$schema"];
91
+ return transportSchema;
92
+ }
93
+ function decodeJsonPointerToken(token) {
94
+ if (/~(?:[^01]|$)/.test(token)) {
95
+ throw new UnsupportedOutputSchemaError(`outputSchema contains an invalid local $ref JSON Pointer token: ${JSON.stringify(token)}`);
96
+ }
97
+ return token.replace(/~1/g, "/").replace(/~0/g, "~");
98
+ }
99
+ function localRefTokens(ref) {
100
+ if (!ref.startsWith("#")) {
101
+ throw new UnsupportedOutputSchemaError(`outputSchema $ref must be a local JSON Pointer fragment; external refs are unsupported: ${ref}`);
102
+ }
103
+ let pointer;
104
+ try {
105
+ // URI-fragment decoding precedes JSON Pointer tokenization (RFC 6901 §6).
106
+ // In particular, `%2F` is a pointer separator, not a slash inside one key.
107
+ pointer = decodeURIComponent(ref.slice(1));
108
+ }
109
+ catch {
110
+ throw new UnsupportedOutputSchemaError(`outputSchema contains an invalid percent-encoded local $ref: ${JSON.stringify(ref)}`);
111
+ }
112
+ if (!pointer.startsWith("/")) {
113
+ throw new UnsupportedOutputSchemaError(`outputSchema $ref must resolve from a local JSON Pointer beginning with '/'; anchors and root refs are unsupported: ${ref}`);
114
+ }
115
+ return pointer.slice(1).split("/").map(decodeJsonPointerToken);
116
+ }
117
+ function localRefTarget(root, ref) {
118
+ let current = root;
119
+ for (const token of localRefTokens(ref)) {
120
+ if (!current ||
121
+ typeof current !== "object" ||
122
+ !Object.prototype.hasOwnProperty.call(current, token)) {
123
+ throw new UnsupportedOutputSchemaError(`outputSchema $ref does not resolve: ${ref}`);
124
+ }
125
+ current = current[token];
126
+ }
127
+ return current;
128
+ }
129
+ const SCHEMA_MAP_KEYWORDS = new Set([
130
+ "properties",
131
+ "patternProperties",
132
+ "$defs",
133
+ "definitions",
134
+ "dependentSchemas",
135
+ ]);
136
+ const SCHEMA_ARRAY_KEYWORDS = new Set(["allOf", "anyOf", "oneOf", "prefixItems"]);
137
+ const SCHEMA_VALUE_KEYWORDS = new Set([
138
+ "additionalProperties",
139
+ "unevaluatedProperties",
140
+ "propertyNames",
141
+ "contains",
142
+ "not",
143
+ "if",
144
+ "then",
145
+ "else",
146
+ "additionalItems",
147
+ "unevaluatedItems",
148
+ "contentSchema",
149
+ ]);
150
+ const REF_ANNOTATION_KEYWORDS = new Set([
151
+ "title",
152
+ "description",
153
+ "$comment",
154
+ "default",
155
+ "examples",
156
+ "deprecated",
157
+ "readOnly",
158
+ "writeOnly",
159
+ ]);
160
+ /** Fail-closed ceiling for schema nesting: deeper documents would risk a raw
161
+ * RangeError (stack exhaustion) in the recursive walks instead of a typed
162
+ * refusal. No legitimate output contract nests anywhere near this. */
163
+ const MAX_SCHEMA_DEPTH = 256;
164
+ /**
165
+ * Generic deep scan of the WHOLE document — every object node, not just
166
+ * keyword-reachable schema positions. A $ref may point at any JSON Pointer
167
+ * (including subtrees under ad-hoc non-keyword keys), and unreferenced
168
+ * non-keyword subtrees are copied verbatim into the vendor transport, so
169
+ * dynamic/recursive/scoped semantics anywhere in the document must fail
170
+ * closed at preflight. Map-keyword containers skip the key check on the map
171
+ * itself (property NAMES may legitimately collide with keywords) but their
172
+ * values are scanned. Keyword-shaped keys inside data values (default,
173
+ * examples) are refused too — fail closed beats a mid-run vendor 400.
174
+ */
175
+ function assertSupportedReferenceScope(root) {
176
+ const scan = (value, depth) => {
177
+ if (typeof value === "boolean" || !value || typeof value !== "object")
178
+ return;
179
+ if (depth > MAX_SCHEMA_DEPTH) {
180
+ throw new UnsupportedOutputSchemaError(`outputSchema nesting exceeds ${MAX_SCHEMA_DEPTH} levels; flatten the schema`);
181
+ }
182
+ if (Array.isArray(value)) {
183
+ for (const item of value)
184
+ scan(item, depth + 1);
185
+ return;
186
+ }
187
+ const schema = value;
188
+ for (const keyword of ["$dynamicRef", "$recursiveRef", "$dynamicAnchor", "$recursiveAnchor"]) {
189
+ if (keyword in schema) {
190
+ throw new UnsupportedOutputSchemaError(`outputSchema ${keyword} is unsupported by native structured-output transport; use an inline local $ref without dynamic or recursive scope`);
191
+ }
192
+ }
193
+ if (depth > 0 && typeof schema["$id"] === "string") {
194
+ throw new UnsupportedOutputSchemaError("outputSchema cannot carry nested $id scopes for native transport; inline the scoped schema or remove the nested $id");
195
+ }
196
+ // $ref values are validated document-wide, not just in schema positions:
197
+ // an external ref anywhere would otherwise ride a verbatim-copied subtree
198
+ // into the vendor transport instead of failing closed here.
199
+ const refValue = schema["$ref"];
200
+ if (refValue !== undefined) {
201
+ if (typeof refValue !== "string") {
202
+ throw new UnsupportedOutputSchemaError("outputSchema $ref must be a string");
203
+ }
204
+ localRefTokens(refValue);
205
+ }
206
+ for (const [key, child] of Object.entries(schema)) {
207
+ if (SCHEMA_MAP_KEYWORDS.has(key) &&
208
+ child &&
209
+ typeof child === "object" &&
210
+ !Array.isArray(child)) {
211
+ for (const entry of Object.values(child))
212
+ scan(entry, depth + 2);
213
+ }
214
+ else {
215
+ scan(child, depth + 1);
216
+ }
217
+ }
218
+ };
219
+ scan(root, 0);
220
+ }
221
+ /** Fail-closed ceiling for transport dereference work: each $ref occurrence
222
+ * re-copies its target, so N doubling layers expand ~2^N nodes and an
223
+ * adversarial schema could exhaust the daemon during preflight. */
224
+ const MAX_DEREFERENCE_NODES = 10_000;
225
+ function containsRefDeep(value) {
226
+ if (!value || typeof value !== "object")
227
+ return false;
228
+ if (Array.isArray(value))
229
+ return value.some(containsRefDeep);
230
+ const obj = value;
231
+ if ("$ref" in obj)
232
+ return true;
233
+ return Object.values(obj).some(containsRefDeep);
234
+ }
235
+ /**
236
+ * Build the provider transport authority by inlining resolvable local refs.
237
+ * The caller's original schema remains untouched for Ajv conformance and
238
+ * hashing. Native transports never see `$ref`, `$defs`, or `definitions`.
239
+ */
240
+ function dereferenceLocalOutputSchema(root) {
241
+ assertSupportedReferenceScope(root);
242
+ let visitedNodes = 0;
243
+ const walkSchema = (value, resolving, depth) => {
244
+ if (typeof value === "boolean")
245
+ return value;
246
+ if (!value || typeof value !== "object" || Array.isArray(value))
247
+ return value;
248
+ if (++visitedNodes > MAX_DEREFERENCE_NODES) {
249
+ throw new UnsupportedOutputSchemaError("outputSchema local $ref expansion exceeds the transport budget; inline or simplify the shared definitions");
250
+ }
251
+ // The EXPANDED tree is capped too: a flat $defs chain of single-level
252
+ // refs keeps the source shallow while resolution recurses one frame per
253
+ // link — that must be a typed refusal, never stack exhaustion, and it
254
+ // also bounds every later walk over the transport copy (strictify).
255
+ if (depth > MAX_SCHEMA_DEPTH) {
256
+ throw new UnsupportedOutputSchemaError(`outputSchema local $ref expansion nests past ${MAX_SCHEMA_DEPTH} levels; flatten the reference chain`);
257
+ }
258
+ const source = value;
259
+ const refValue = source["$ref"];
260
+ if (refValue !== undefined) {
261
+ if (typeof refValue !== "string") {
262
+ throw new UnsupportedOutputSchemaError("outputSchema $ref must be a string");
263
+ }
264
+ if (resolving.includes(refValue)) {
265
+ throw new UnsupportedOutputSchemaError(`outputSchema contains a cyclic local $ref: ${[...resolving, refValue].join(" -> ")}`);
266
+ }
267
+ const unsupportedSiblings = Object.keys(source).filter((key) => key !== "$ref" && !REF_ANNOTATION_KEYWORDS.has(key));
268
+ if (unsupportedSiblings.length > 0) {
269
+ throw new UnsupportedOutputSchemaError(`outputSchema $ref siblings are unsupported for native transport (${unsupportedSiblings.join(", ")}); inline the combined constraints`);
270
+ }
271
+ const target = walkSchema(localRefTarget(root, refValue), [...resolving, refValue], depth + 1);
272
+ if (!target || typeof target !== "object" || Array.isArray(target)) {
273
+ throw new UnsupportedOutputSchemaError(`outputSchema local $ref must resolve to an object schema for native transport: ${refValue}`);
274
+ }
275
+ const annotations = Object.fromEntries(Object.entries(source).filter(([key]) => REF_ANNOTATION_KEYWORDS.has(key)));
276
+ return { ...target, ...annotations };
277
+ }
278
+ const output = {};
279
+ // defineProperty, not assignment: an own "__proto__" key from JSON.parse
280
+ // must round-trip as an own data property instead of hitting the
281
+ // Object.prototype setter (which would silently drop the key).
282
+ const setOwn = (key, val) => {
283
+ Object.defineProperty(output, key, {
284
+ value: val,
285
+ enumerable: true,
286
+ writable: true,
287
+ configurable: true,
288
+ });
289
+ };
290
+ for (const [key, child] of Object.entries(source)) {
291
+ // Definitions are source-only after all references have been inlined.
292
+ if (key === "$defs" || key === "definitions")
293
+ continue;
294
+ if (key === "unevaluatedProperties") {
295
+ const hasCrossSchemaApplicator = [
296
+ "allOf",
297
+ "anyOf",
298
+ "oneOf",
299
+ "if",
300
+ "then",
301
+ "else",
302
+ "dependentSchemas",
303
+ ].some((keyword) => keyword in source);
304
+ if (child !== false ||
305
+ source["type"] !== "object" ||
306
+ !source["properties"] ||
307
+ typeof source["properties"] !== "object" ||
308
+ Array.isArray(source["properties"]) ||
309
+ hasCrossSchemaApplicator) {
310
+ throw new UnsupportedOutputSchemaError("outputSchema unevaluatedProperties can be transported only when false on an inline object with local properties and no cross-schema applicators; otherwise inline the evaluated properties and use additionalProperties:false");
311
+ }
312
+ // strictifyForStructuredOutput adds additionalProperties:false to this
313
+ // same object, which is equivalent for the proven simple shape.
314
+ continue;
315
+ }
316
+ if (key === "unevaluatedItems") {
317
+ throw new UnsupportedOutputSchemaError("outputSchema unevaluatedItems is unsupported by native structured-output transport; express the item constraints inline");
318
+ }
319
+ if (SCHEMA_MAP_KEYWORDS.has(key) &&
320
+ child &&
321
+ typeof child === "object" &&
322
+ !Array.isArray(child)) {
323
+ setOwn(key, Object.fromEntries(Object.entries(child).map(([name, schema]) => [
324
+ name,
325
+ walkSchema(schema, resolving, depth + 2),
326
+ ])));
327
+ }
328
+ else if (SCHEMA_ARRAY_KEYWORDS.has(key) && Array.isArray(child)) {
329
+ setOwn(key, child.map((schema) => walkSchema(schema, resolving, depth + 2)));
330
+ }
331
+ else if (key === "items") {
332
+ setOwn(key, Array.isArray(child)
333
+ ? child.map((schema) => walkSchema(schema, resolving, depth + 2))
334
+ : walkSchema(child, resolving, depth + 1));
335
+ }
336
+ else if (key === "dependencies" &&
337
+ child &&
338
+ typeof child === "object" &&
339
+ !Array.isArray(child)) {
340
+ setOwn(key, Object.fromEntries(Object.entries(child).map(([name, dependency]) => [
341
+ name,
342
+ Array.isArray(dependency) ? dependency : walkSchema(dependency, resolving, depth + 2),
343
+ ])));
344
+ }
345
+ else if (SCHEMA_VALUE_KEYWORDS.has(key)) {
346
+ setOwn(key, walkSchema(child, resolving, depth + 1));
347
+ }
348
+ else {
349
+ // Verbatim-copied subtrees (unknown/non-schema keys) never get their
350
+ // refs resolved, and the native routes 400 on any $ref they see.
351
+ if (containsRefDeep(child)) {
352
+ throw new UnsupportedOutputSchemaError(`outputSchema $ref under non-schema key ${JSON.stringify(key)} cannot be resolved for native transport; move the reference under a schema keyword or inline it`);
353
+ }
354
+ setOwn(key, child);
355
+ }
356
+ }
357
+ return output;
358
+ };
359
+ return walkSchema(root, [], 0);
63
360
  }
64
361
  /**
65
362
  * Vendor STRICT structured-output mode (LIVE-VERIFIED against codex 0.137 /
@@ -1 +1 @@
1
- {"version":3,"file":"output-schema.js","sourceRoot":"","sources":["../src/output-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,iFAAiF;AACjF,MAAM,OAAO,4BAA6B,SAAQ,KAAK;CAAG;AAE1D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAA+B;IAE/B,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC5E,MAAM,IAAI,4BAA4B,CACpC,gLAAgL,CACjL,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,KAAc,EAAW,EAAE;QACzC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACtD,MAAM,GAAG,GAAG,KAAgC,CAAC;QAC7C,IAAI,MAAM,IAAI,GAAG;YAAE,OAAO,IAAI,CAAC;QAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC,CAAC;IACF,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,4BAA4B,CACp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GAAG,IAA+B,CAAC;oBAC1C,IAAI,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC;wBAC1D,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;oBAClC,CAAC;yBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAE,CAAC,CAAC,MAAM,CAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;wBACjF,CAAC,CAAC,MAAM,CAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;oBACxC,CAAC;gBACH,CAAC;YACH,CAAC;YACD,GAAG,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrC,GAAG,CAAC,sBAAsB,CAAC,GAAG,KAAK,CAAC;QACtC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IACF,OAAO,IAAI,CAAC,IAAI,CAA4B,CAAC;AAC/C,CAAC"}
package/dist/plan.d.ts CHANGED
@@ -123,10 +123,10 @@ export declare const PlanReadiness: z.ZodObject<{
123
123
  state: z.ZodEnum<["ready", "needs_answers", "unverified"]>;
124
124
  questionCount: z.ZodDefault<z.ZodNumber>;
125
125
  }, "strict", z.ZodTypeAny, {
126
- state: "ready" | "needs_answers" | "unverified";
126
+ state: "ready" | "unverified" | "needs_answers";
127
127
  questionCount: number;
128
128
  }, {
129
- state: "ready" | "needs_answers" | "unverified";
129
+ state: "ready" | "unverified" | "needs_answers";
130
130
  questionCount?: number | undefined;
131
131
  }>;
132
132
  export type PlanReadiness = z.infer<typeof PlanReadiness>;
package/dist/problem.d.ts CHANGED
@@ -12,18 +12,18 @@ export declare const ControlProblem: z.ZodObject<{
12
12
  code: string;
13
13
  message: string;
14
14
  evidenceRefs: string[];
15
- retryable: boolean;
16
15
  context: Record<string, unknown>;
17
- fieldErrors: Record<string, string[]>;
16
+ retryable: boolean;
18
17
  requiredActions: string[];
18
+ fieldErrors: Record<string, string[]>;
19
19
  }, {
20
20
  code: string;
21
21
  message: string;
22
22
  retryable: boolean;
23
23
  evidenceRefs?: string[] | undefined;
24
24
  context?: Record<string, unknown> | undefined;
25
- fieldErrors?: Record<string, string[]> | undefined;
26
25
  requiredActions?: string[] | undefined;
26
+ fieldErrors?: Record<string, string[]> | undefined;
27
27
  }>;
28
28
  export type ControlProblem = z.infer<typeof ControlProblem>;
29
29
  //# sourceMappingURL=problem.d.ts.map
package/dist/project.d.ts CHANGED
@@ -32,11 +32,11 @@ export declare const ProjectNesting: z.ZodObject<{
32
32
  }, "strict", z.ZodTypeAny, {
33
33
  root: string;
34
34
  projectId: string;
35
- relation: "inside" | "contains";
35
+ relation: "contains" | "inside";
36
36
  }, {
37
37
  root: string;
38
38
  projectId: string;
39
- relation: "inside" | "contains";
39
+ relation: "contains" | "inside";
40
40
  }>;
41
41
  export type ProjectNesting = z.infer<typeof ProjectNesting>;
42
42
  export declare const ControlProject: z.ZodObject<{
@@ -52,11 +52,11 @@ export declare const ControlProject: z.ZodObject<{
52
52
  }, "strict", z.ZodTypeAny, {
53
53
  root: string;
54
54
  projectId: string;
55
- relation: "inside" | "contains";
55
+ relation: "contains" | "inside";
56
56
  }, {
57
57
  root: string;
58
58
  projectId: string;
59
- relation: "inside" | "contains";
59
+ relation: "contains" | "inside";
60
60
  }>, "many">>;
61
61
  }, "strict", z.ZodTypeAny, {
62
62
  schemaVersion: 2;
@@ -67,7 +67,7 @@ export declare const ControlProject: z.ZodObject<{
67
67
  nesting: {
68
68
  root: string;
69
69
  projectId: string;
70
- relation: "inside" | "contains";
70
+ relation: "contains" | "inside";
71
71
  }[];
72
72
  }, {
73
73
  schemaVersion: 2;
@@ -78,7 +78,7 @@ export declare const ControlProject: z.ZodObject<{
78
78
  nesting?: {
79
79
  root: string;
80
80
  projectId: string;
81
- relation: "inside" | "contains";
81
+ relation: "contains" | "inside";
82
82
  }[] | undefined;
83
83
  }>;
84
84
  export type ControlProject = z.infer<typeof ControlProject>;
@@ -96,11 +96,11 @@ export declare const ControlProjectListResponse: z.ZodObject<{
96
96
  }, "strict", z.ZodTypeAny, {
97
97
  root: string;
98
98
  projectId: string;
99
- relation: "inside" | "contains";
99
+ relation: "contains" | "inside";
100
100
  }, {
101
101
  root: string;
102
102
  projectId: string;
103
- relation: "inside" | "contains";
103
+ relation: "contains" | "inside";
104
104
  }>, "many">>;
105
105
  }, "strict", z.ZodTypeAny, {
106
106
  schemaVersion: 2;
@@ -111,7 +111,7 @@ export declare const ControlProjectListResponse: z.ZodObject<{
111
111
  nesting: {
112
112
  root: string;
113
113
  projectId: string;
114
- relation: "inside" | "contains";
114
+ relation: "contains" | "inside";
115
115
  }[];
116
116
  }, {
117
117
  schemaVersion: 2;
@@ -122,7 +122,7 @@ export declare const ControlProjectListResponse: z.ZodObject<{
122
122
  nesting?: {
123
123
  root: string;
124
124
  projectId: string;
125
- relation: "inside" | "contains";
125
+ relation: "contains" | "inside";
126
126
  }[] | undefined;
127
127
  }>, "many">;
128
128
  }, "strict", z.ZodTypeAny, {
@@ -135,7 +135,7 @@ export declare const ControlProjectListResponse: z.ZodObject<{
135
135
  nesting: {
136
136
  root: string;
137
137
  projectId: string;
138
- relation: "inside" | "contains";
138
+ relation: "contains" | "inside";
139
139
  }[];
140
140
  }[];
141
141
  }, {
@@ -148,7 +148,7 @@ export declare const ControlProjectListResponse: z.ZodObject<{
148
148
  nesting?: {
149
149
  root: string;
150
150
  projectId: string;
151
- relation: "inside" | "contains";
151
+ relation: "contains" | "inside";
152
152
  }[] | undefined;
153
153
  }[];
154
154
  }>;
@@ -169,4 +169,39 @@ export declare const ControlProjectRelinkRequest: z.ZodObject<{
169
169
  root: string;
170
170
  }>;
171
171
  export type ControlProjectRelinkRequest = z.infer<typeof ControlProjectRelinkRequest>;
172
+ /**
173
+ * Receipt for DELETE /v2/projects/:id (QA-049). Removing a durable project
174
+ * retires the global-registry entry and ARCHIVES the project's journal
175
+ * partition (renamed out of the active journal tree — never deleted — the same
176
+ * non-destructive move the partition-quarantine path uses). Run artifact trees
177
+ * are left in place for normal GC/retention; remove never deletes them or the
178
+ * user's project directory. Refused with a typed 409 while any non-purged
179
+ * thread or live/queued run still references the project.
180
+ */
181
+ export declare const ControlProjectRemoveReceipt: z.ZodObject<{
182
+ projectId: z.ZodString;
183
+ root: z.ZodString;
184
+ registryRemoved: z.ZodLiteral<true>;
185
+ journalPartitionArchived: z.ZodBoolean;
186
+ archivedPartitionPath: z.ZodNullable<z.ZodString>;
187
+ artifactsRetained: z.ZodLiteral<true>;
188
+ activeRunCheck: z.ZodLiteral<"snapshot">;
189
+ }, "strict", z.ZodTypeAny, {
190
+ root: string;
191
+ projectId: string;
192
+ registryRemoved: true;
193
+ journalPartitionArchived: boolean;
194
+ archivedPartitionPath: string | null;
195
+ artifactsRetained: true;
196
+ activeRunCheck: "snapshot";
197
+ }, {
198
+ root: string;
199
+ projectId: string;
200
+ registryRemoved: true;
201
+ journalPartitionArchived: boolean;
202
+ archivedPartitionPath: string | null;
203
+ artifactsRetained: true;
204
+ activeRunCheck: "snapshot";
205
+ }>;
206
+ export type ControlProjectRemoveReceipt = z.infer<typeof ControlProjectRemoveReceipt>;
172
207
  //# sourceMappingURL=project.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,wDAAwD;AACxD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;EASoE,CAAC;AACzF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C;;;;wEAIwE;AACxE,eAAO,MAAM,cAAc;;;;;;;;;;;;EAOiE,CAAC;AAC7F,MAAM,MAA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,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA2D,CAAC;AACnG,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEpF,eAAO,MAAM,6BAA6B;;;;;;EAAiD,CAAC;AAC5F,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAE1F,eAAO,MAAM,2BAA2B;;;;;;EAAiD,CAAC;AAC1F,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEtF;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;EAgCrC,CAAC;AACJ,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
package/dist/project.js CHANGED
@@ -41,4 +41,36 @@ export const ControlProject = z
41
41
  export const ControlProjectListResponse = z.object({ projects: z.array(ControlProject) }).strict();
42
42
  export const ControlProjectRegisterRequest = z.object({ root: z.string().min(1) }).strict();
43
43
  export const ControlProjectRelinkRequest = z.object({ root: z.string().min(1) }).strict();
44
+ /**
45
+ * Receipt for DELETE /v2/projects/:id (QA-049). Removing a durable project
46
+ * retires the global-registry entry and ARCHIVES the project's journal
47
+ * partition (renamed out of the active journal tree — never deleted — the same
48
+ * non-destructive move the partition-quarantine path uses). Run artifact trees
49
+ * are left in place for normal GC/retention; remove never deletes them or the
50
+ * user's project directory. Refused with a typed 409 while any non-purged
51
+ * thread or live/queued run still references the project.
52
+ */
53
+ export const ControlProjectRemoveReceipt = z
54
+ .object({
55
+ projectId: Id.describe("The retired project's stable id."),
56
+ root: z.string().min(1).describe("The project's canonical root at removal time."),
57
+ registryRemoved: z
58
+ .literal(true)
59
+ .describe("The durable global-registry entry (and its indexes) were removed."),
60
+ journalPartitionArchived: z
61
+ .boolean()
62
+ .describe("Whether the project's journal partition directory was archived (renamed out of the active journal tree). False only when the partition never materialized on disk."),
63
+ archivedPartitionPath: z
64
+ .string()
65
+ .nullable()
66
+ .describe("Absolute path the partition journal was archived to, or null when there was no partition directory to archive."),
67
+ artifactsRetained: z
68
+ .literal(true)
69
+ .describe("Run artifact trees are left in place for normal GC/retention — remove never deletes run bytes or the user's project directory."),
70
+ activeRunCheck: z
71
+ .literal("snapshot")
72
+ .describe("How the live/queued-run fence was evaluated. Always 'snapshot': the active-run set is read once (an async daemon IPC job-list read) BEFORE the synchronous removal, so a run that starts in the narrow window between the snapshot and the removal is NOT fenced. Honest disclosure of a TOCTOU race the current architecture cannot close inside the sync section; see docs/ARCHITECTURE.md."),
73
+ })
74
+ .strict()
75
+ .describe("DELETE /v2/projects/:id receipt: registry entry removed, journal partition archived, artifacts left to GC.");
44
76
  //# sourceMappingURL=project.js.map