@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
package/dist/spec.d.ts ADDED
@@ -0,0 +1,561 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * SpecPack — the frozen, versioned, diffable specification produced by the
4
+ * spec interview (the hierarchical clarify-quiz). It is the SSOT a run is held
5
+ * to: a SpecPack maps deterministically into a TaskContract. Unlike spec-first
6
+ * tools that regenerate an opaque blob, this is spec-anchored: versioned with
7
+ * section-level diffs across revisions.
8
+ */
9
+ export declare const InterviewQuestionKind: z.ZodEnum<["single", "multi", "text"]>;
10
+ export type InterviewQuestionKind = z.infer<typeof InterviewQuestionKind>;
11
+ export declare const InterviewOption: z.ZodObject<{
12
+ id: z.ZodString;
13
+ label: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ id: string;
16
+ label: string;
17
+ }, {
18
+ id: string;
19
+ label: string;
20
+ }>;
21
+ export type InterviewOption = z.infer<typeof InterviewOption>;
22
+ /** One quiz card. `tier` expresses the hierarchical depth (0 = foundational). */
23
+ export declare const InterviewQuestion: z.ZodObject<{
24
+ id: z.ZodString;
25
+ tier: z.ZodDefault<z.ZodNumber>;
26
+ prompt: z.ZodString;
27
+ kind: z.ZodDefault<z.ZodEnum<["single", "multi", "text"]>>;
28
+ options: z.ZodDefault<z.ZodArray<z.ZodObject<{
29
+ id: z.ZodString;
30
+ label: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ id: string;
33
+ label: string;
34
+ }, {
35
+ id: string;
36
+ label: string;
37
+ }>, "many">>;
38
+ /** Whether free-text is accepted in addition to / instead of options. */
39
+ allow_text: z.ZodDefault<z.ZodBoolean>;
40
+ rationale: z.ZodOptional<z.ZodString>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ options: {
43
+ id: string;
44
+ label: string;
45
+ }[];
46
+ id: string;
47
+ kind: "text" | "single" | "multi";
48
+ prompt: string;
49
+ tier: number;
50
+ allow_text: boolean;
51
+ rationale?: string | undefined;
52
+ }, {
53
+ id: string;
54
+ prompt: string;
55
+ options?: {
56
+ id: string;
57
+ label: string;
58
+ }[] | undefined;
59
+ kind?: "text" | "single" | "multi" | undefined;
60
+ tier?: number | undefined;
61
+ allow_text?: boolean | undefined;
62
+ rationale?: string | undefined;
63
+ }>;
64
+ export type InterviewQuestion = z.infer<typeof InterviewQuestion>;
65
+ export declare const InterviewAnswer: z.ZodObject<{
66
+ question_id: z.ZodString;
67
+ option_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
68
+ text: z.ZodDefault<z.ZodNullable<z.ZodString>>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ question_id: string;
71
+ text: string | null;
72
+ option_ids: string[];
73
+ }, {
74
+ question_id: string;
75
+ text?: string | null | undefined;
76
+ option_ids?: string[] | undefined;
77
+ }>;
78
+ export type InterviewAnswer = z.infer<typeof InterviewAnswer>;
79
+ /**
80
+ * An explicit unresolved ambiguity (NEEDS_CLARIFICATION). The interview refuses
81
+ * to freeze while any of these are `open` — nothing is silently guessed.
82
+ */
83
+ export declare const ClarificationItem: z.ZodObject<{
84
+ id: z.ZodString;
85
+ claim: z.ZodString;
86
+ status: z.ZodDefault<z.ZodEnum<["open", "resolved"]>>;
87
+ resolution: z.ZodDefault<z.ZodNullable<z.ZodString>>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ status: "open" | "resolved";
90
+ id: string;
91
+ claim: string;
92
+ resolution: string | null;
93
+ }, {
94
+ id: string;
95
+ claim: string;
96
+ status?: "open" | "resolved" | undefined;
97
+ resolution?: string | null | undefined;
98
+ }>;
99
+ export type ClarificationItem = z.infer<typeof ClarificationItem>;
100
+ /** Acceptance criterion in EARS style ("WHEN <cond>, THE SYSTEM SHALL <behavior>"). */
101
+ export declare const SpecAcceptanceCriterion: z.ZodObject<{
102
+ id: z.ZodString;
103
+ behavior: z.ZodString;
104
+ required: z.ZodDefault<z.ZodBoolean>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ id: string;
107
+ required: boolean;
108
+ behavior: string;
109
+ }, {
110
+ id: string;
111
+ behavior: string;
112
+ required?: boolean | undefined;
113
+ }>;
114
+ export type SpecAcceptanceCriterion = z.infer<typeof SpecAcceptanceCriterion>;
115
+ /** A dependency-ordered task in the implementation checklist. */
116
+ export declare const SpecTask: z.ZodObject<{
117
+ id: z.ZodString;
118
+ title: z.ZodString;
119
+ depends_on: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
120
+ done: z.ZodDefault<z.ZodBoolean>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ id: string;
123
+ title: string;
124
+ done: boolean;
125
+ depends_on: string[];
126
+ }, {
127
+ id: string;
128
+ title: string;
129
+ done?: boolean | undefined;
130
+ depends_on?: string[] | undefined;
131
+ }>;
132
+ export type SpecTask = z.infer<typeof SpecTask>;
133
+ export declare const SpecConstraints: z.ZodObject<{
134
+ /** Spec-owned protected paths can raise review risk; per-run approvals cannot be frozen into a spec. */
135
+ protected_paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
136
+ }, "strict", z.ZodTypeAny, {
137
+ protected_paths: string[];
138
+ }, {
139
+ protected_paths?: string[] | undefined;
140
+ }>;
141
+ export type SpecConstraints = z.infer<typeof SpecConstraints>;
142
+ /**
143
+ * Schema-level invariants (SSOT, enforced on every parse — even when loaded from
144
+ * disk, not just via the engine): a frozen spec cannot carry open clarifications,
145
+ * and a "resolved" clarification must record a non-empty resolution. This makes a
146
+ * frozen-but-ambiguous SpecPack unrepresentable — no silent guessing.
147
+ */
148
+ export declare const SpecPack: z.ZodEffects<z.ZodObject<{
149
+ schema_version: z.ZodLiteral<2>;
150
+ id: z.ZodString;
151
+ created_at: z.ZodString;
152
+ /** Monotonic revision; each freeze increments it (spec-anchored history). */
153
+ version: z.ZodDefault<z.ZodNumber>;
154
+ frozen: z.ZodDefault<z.ZodBoolean>;
155
+ intent: z.ZodObject<{
156
+ raw: z.ZodString;
157
+ normalized: z.ZodOptional<z.ZodString>;
158
+ }, "strip", z.ZodTypeAny, {
159
+ raw: string;
160
+ normalized?: string | undefined;
161
+ }, {
162
+ raw: string;
163
+ normalized?: string | undefined;
164
+ }>;
165
+ summary: z.ZodDefault<z.ZodString>;
166
+ success_criteria: z.ZodDefault<z.ZodArray<z.ZodObject<{
167
+ id: z.ZodString;
168
+ behavior: z.ZodString;
169
+ required: z.ZodDefault<z.ZodBoolean>;
170
+ }, "strip", z.ZodTypeAny, {
171
+ id: string;
172
+ required: boolean;
173
+ behavior: string;
174
+ }, {
175
+ id: string;
176
+ behavior: string;
177
+ required?: boolean | undefined;
178
+ }>, "many">>;
179
+ non_goals: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
180
+ forbidden_approaches: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
181
+ decided_tradeoffs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
182
+ constraints: z.ZodDefault<z.ZodObject<{
183
+ /** Spec-owned protected paths can raise review risk; per-run approvals cannot be frozen into a spec. */
184
+ protected_paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
185
+ }, "strict", z.ZodTypeAny, {
186
+ protected_paths: string[];
187
+ }, {
188
+ protected_paths?: string[] | undefined;
189
+ }>>;
190
+ tests: z.ZodDefault<z.ZodArray<z.ZodObject<{
191
+ id: z.ZodString;
192
+ command: z.ZodString;
193
+ required: z.ZodDefault<z.ZodBoolean>;
194
+ }, "strip", z.ZodTypeAny, {
195
+ id: string;
196
+ command: string;
197
+ required: boolean;
198
+ }, {
199
+ id: string;
200
+ command: string;
201
+ required?: boolean | undefined;
202
+ }>, "many">>;
203
+ tasks: z.ZodDefault<z.ZodArray<z.ZodObject<{
204
+ id: z.ZodString;
205
+ title: z.ZodString;
206
+ depends_on: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
207
+ done: z.ZodDefault<z.ZodBoolean>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ id: string;
210
+ title: string;
211
+ done: boolean;
212
+ depends_on: string[];
213
+ }, {
214
+ id: string;
215
+ title: string;
216
+ done?: boolean | undefined;
217
+ depends_on?: string[] | undefined;
218
+ }>, "many">>;
219
+ open_questions: z.ZodDefault<z.ZodArray<z.ZodObject<{
220
+ id: z.ZodString;
221
+ claim: z.ZodString;
222
+ status: z.ZodDefault<z.ZodEnum<["open", "resolved"]>>;
223
+ resolution: z.ZodDefault<z.ZodNullable<z.ZodString>>;
224
+ }, "strip", z.ZodTypeAny, {
225
+ status: "open" | "resolved";
226
+ id: string;
227
+ claim: string;
228
+ resolution: string | null;
229
+ }, {
230
+ id: string;
231
+ claim: string;
232
+ status?: "open" | "resolved" | undefined;
233
+ resolution?: string | null | undefined;
234
+ }>, "many">>;
235
+ interview: z.ZodDefault<z.ZodObject<{
236
+ questions: z.ZodDefault<z.ZodArray<z.ZodObject<{
237
+ id: z.ZodString;
238
+ tier: z.ZodDefault<z.ZodNumber>;
239
+ prompt: z.ZodString;
240
+ kind: z.ZodDefault<z.ZodEnum<["single", "multi", "text"]>>;
241
+ options: z.ZodDefault<z.ZodArray<z.ZodObject<{
242
+ id: z.ZodString;
243
+ label: z.ZodString;
244
+ }, "strip", z.ZodTypeAny, {
245
+ id: string;
246
+ label: string;
247
+ }, {
248
+ id: string;
249
+ label: string;
250
+ }>, "many">>;
251
+ /** Whether free-text is accepted in addition to / instead of options. */
252
+ allow_text: z.ZodDefault<z.ZodBoolean>;
253
+ rationale: z.ZodOptional<z.ZodString>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ options: {
256
+ id: string;
257
+ label: string;
258
+ }[];
259
+ id: string;
260
+ kind: "text" | "single" | "multi";
261
+ prompt: string;
262
+ tier: number;
263
+ allow_text: boolean;
264
+ rationale?: string | undefined;
265
+ }, {
266
+ id: string;
267
+ prompt: string;
268
+ options?: {
269
+ id: string;
270
+ label: string;
271
+ }[] | undefined;
272
+ kind?: "text" | "single" | "multi" | undefined;
273
+ tier?: number | undefined;
274
+ allow_text?: boolean | undefined;
275
+ rationale?: string | undefined;
276
+ }>, "many">>;
277
+ answers: z.ZodDefault<z.ZodArray<z.ZodObject<{
278
+ question_id: z.ZodString;
279
+ option_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
280
+ text: z.ZodDefault<z.ZodNullable<z.ZodString>>;
281
+ }, "strip", z.ZodTypeAny, {
282
+ question_id: string;
283
+ text: string | null;
284
+ option_ids: string[];
285
+ }, {
286
+ question_id: string;
287
+ text?: string | null | undefined;
288
+ option_ids?: string[] | undefined;
289
+ }>, "many">>;
290
+ }, "strip", z.ZodTypeAny, {
291
+ questions: {
292
+ options: {
293
+ id: string;
294
+ label: string;
295
+ }[];
296
+ id: string;
297
+ kind: "text" | "single" | "multi";
298
+ prompt: string;
299
+ tier: number;
300
+ allow_text: boolean;
301
+ rationale?: string | undefined;
302
+ }[];
303
+ answers: {
304
+ question_id: string;
305
+ text: string | null;
306
+ option_ids: string[];
307
+ }[];
308
+ }, {
309
+ questions?: {
310
+ id: string;
311
+ prompt: string;
312
+ options?: {
313
+ id: string;
314
+ label: string;
315
+ }[] | undefined;
316
+ kind?: "text" | "single" | "multi" | undefined;
317
+ tier?: number | undefined;
318
+ allow_text?: boolean | undefined;
319
+ rationale?: string | undefined;
320
+ }[] | undefined;
321
+ answers?: {
322
+ question_id: string;
323
+ text?: string | null | undefined;
324
+ option_ids?: string[] | undefined;
325
+ }[] | undefined;
326
+ }>>;
327
+ }, "strip", z.ZodTypeAny, {
328
+ id: string;
329
+ version: number;
330
+ intent: {
331
+ raw: string;
332
+ normalized?: string | undefined;
333
+ };
334
+ schema_version: 2;
335
+ created_at: string;
336
+ summary: string;
337
+ tests: {
338
+ id: string;
339
+ command: string;
340
+ required: boolean;
341
+ }[];
342
+ success_criteria: {
343
+ id: string;
344
+ required: boolean;
345
+ behavior: string;
346
+ }[];
347
+ non_goals: string[];
348
+ forbidden_approaches: string[];
349
+ decided_tradeoffs: string[];
350
+ constraints: {
351
+ protected_paths: string[];
352
+ };
353
+ frozen: boolean;
354
+ tasks: {
355
+ id: string;
356
+ title: string;
357
+ done: boolean;
358
+ depends_on: string[];
359
+ }[];
360
+ open_questions: {
361
+ status: "open" | "resolved";
362
+ id: string;
363
+ claim: string;
364
+ resolution: string | null;
365
+ }[];
366
+ interview: {
367
+ questions: {
368
+ options: {
369
+ id: string;
370
+ label: string;
371
+ }[];
372
+ id: string;
373
+ kind: "text" | "single" | "multi";
374
+ prompt: string;
375
+ tier: number;
376
+ allow_text: boolean;
377
+ rationale?: string | undefined;
378
+ }[];
379
+ answers: {
380
+ question_id: string;
381
+ text: string | null;
382
+ option_ids: string[];
383
+ }[];
384
+ };
385
+ }, {
386
+ id: string;
387
+ intent: {
388
+ raw: string;
389
+ normalized?: string | undefined;
390
+ };
391
+ schema_version: 2;
392
+ created_at: string;
393
+ version?: number | undefined;
394
+ summary?: string | undefined;
395
+ tests?: {
396
+ id: string;
397
+ command: string;
398
+ required?: boolean | undefined;
399
+ }[] | undefined;
400
+ success_criteria?: {
401
+ id: string;
402
+ behavior: string;
403
+ required?: boolean | undefined;
404
+ }[] | undefined;
405
+ non_goals?: string[] | undefined;
406
+ forbidden_approaches?: string[] | undefined;
407
+ decided_tradeoffs?: string[] | undefined;
408
+ constraints?: {
409
+ protected_paths?: string[] | undefined;
410
+ } | undefined;
411
+ frozen?: boolean | undefined;
412
+ tasks?: {
413
+ id: string;
414
+ title: string;
415
+ done?: boolean | undefined;
416
+ depends_on?: string[] | undefined;
417
+ }[] | undefined;
418
+ open_questions?: {
419
+ id: string;
420
+ claim: string;
421
+ status?: "open" | "resolved" | undefined;
422
+ resolution?: string | null | undefined;
423
+ }[] | undefined;
424
+ interview?: {
425
+ questions?: {
426
+ id: string;
427
+ prompt: string;
428
+ options?: {
429
+ id: string;
430
+ label: string;
431
+ }[] | undefined;
432
+ kind?: "text" | "single" | "multi" | undefined;
433
+ tier?: number | undefined;
434
+ allow_text?: boolean | undefined;
435
+ rationale?: string | undefined;
436
+ }[] | undefined;
437
+ answers?: {
438
+ question_id: string;
439
+ text?: string | null | undefined;
440
+ option_ids?: string[] | undefined;
441
+ }[] | undefined;
442
+ } | undefined;
443
+ }>, {
444
+ id: string;
445
+ version: number;
446
+ intent: {
447
+ raw: string;
448
+ normalized?: string | undefined;
449
+ };
450
+ schema_version: 2;
451
+ created_at: string;
452
+ summary: string;
453
+ tests: {
454
+ id: string;
455
+ command: string;
456
+ required: boolean;
457
+ }[];
458
+ success_criteria: {
459
+ id: string;
460
+ required: boolean;
461
+ behavior: string;
462
+ }[];
463
+ non_goals: string[];
464
+ forbidden_approaches: string[];
465
+ decided_tradeoffs: string[];
466
+ constraints: {
467
+ protected_paths: string[];
468
+ };
469
+ frozen: boolean;
470
+ tasks: {
471
+ id: string;
472
+ title: string;
473
+ done: boolean;
474
+ depends_on: string[];
475
+ }[];
476
+ open_questions: {
477
+ status: "open" | "resolved";
478
+ id: string;
479
+ claim: string;
480
+ resolution: string | null;
481
+ }[];
482
+ interview: {
483
+ questions: {
484
+ options: {
485
+ id: string;
486
+ label: string;
487
+ }[];
488
+ id: string;
489
+ kind: "text" | "single" | "multi";
490
+ prompt: string;
491
+ tier: number;
492
+ allow_text: boolean;
493
+ rationale?: string | undefined;
494
+ }[];
495
+ answers: {
496
+ question_id: string;
497
+ text: string | null;
498
+ option_ids: string[];
499
+ }[];
500
+ };
501
+ }, {
502
+ id: string;
503
+ intent: {
504
+ raw: string;
505
+ normalized?: string | undefined;
506
+ };
507
+ schema_version: 2;
508
+ created_at: string;
509
+ version?: number | undefined;
510
+ summary?: string | undefined;
511
+ tests?: {
512
+ id: string;
513
+ command: string;
514
+ required?: boolean | undefined;
515
+ }[] | undefined;
516
+ success_criteria?: {
517
+ id: string;
518
+ behavior: string;
519
+ required?: boolean | undefined;
520
+ }[] | undefined;
521
+ non_goals?: string[] | undefined;
522
+ forbidden_approaches?: string[] | undefined;
523
+ decided_tradeoffs?: string[] | undefined;
524
+ constraints?: {
525
+ protected_paths?: string[] | undefined;
526
+ } | undefined;
527
+ frozen?: boolean | undefined;
528
+ tasks?: {
529
+ id: string;
530
+ title: string;
531
+ done?: boolean | undefined;
532
+ depends_on?: string[] | undefined;
533
+ }[] | undefined;
534
+ open_questions?: {
535
+ id: string;
536
+ claim: string;
537
+ status?: "open" | "resolved" | undefined;
538
+ resolution?: string | null | undefined;
539
+ }[] | undefined;
540
+ interview?: {
541
+ questions?: {
542
+ id: string;
543
+ prompt: string;
544
+ options?: {
545
+ id: string;
546
+ label: string;
547
+ }[] | undefined;
548
+ kind?: "text" | "single" | "multi" | undefined;
549
+ tier?: number | undefined;
550
+ allow_text?: boolean | undefined;
551
+ rationale?: string | undefined;
552
+ }[] | undefined;
553
+ answers?: {
554
+ question_id: string;
555
+ text?: string | null | undefined;
556
+ option_ids?: string[] | undefined;
557
+ }[] | undefined;
558
+ } | undefined;
559
+ }>;
560
+ export type SpecPack = z.infer<typeof SpecPack>;
561
+ //# sourceMappingURL=spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;GAMG;AAEH,eAAO,MAAM,qBAAqB,wCAEiE,CAAC;AACpG,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,eAAO,MAAM,eAAe;;;;;;;;;EAKkC,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,iFAAiF;AACjF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;IAO1B,yEAAyE;;;;;;;;;;;;;;;;;;;;;;;;;EAI1B,CAAC;AACpD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe;;;;;;;;;;;;EAM+B,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAO2F,CAAC;AAC1H,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,uFAAuF;AACvF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;EAMc,CAAC;AACnD,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,iEAAiE;AACjE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;EAOoD,CAAC;AAC1E,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,eAAO,MAAM,eAAe;IAExB,wGAAwG;;;;;;EAO5D,CAAC;AACjD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAiC9D;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;IAjCnB,6EAA6E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAd3E,wGAAwG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YArDxG,yEAAyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuH5E,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
package/dist/spec.js ADDED
@@ -0,0 +1,133 @@
1
+ import { z } from "zod";
2
+ import { Id, IsoTimestamp, SchemaVersion } from "./primitives.js";
3
+ import { TestCommand } from "./task.js";
4
+ /**
5
+ * SpecPack — the frozen, versioned, diffable specification produced by the
6
+ * spec interview (the hierarchical clarify-quiz). It is the SSOT a run is held
7
+ * to: a SpecPack maps deterministically into a TaskContract. Unlike spec-first
8
+ * tools that regenerate an opaque blob, this is spec-anchored: versioned with
9
+ * section-level diffs across revisions.
10
+ */
11
+ export const InterviewQuestionKind = z
12
+ .enum(["single", "multi", "text"])
13
+ .describe("Answer shape of an interview question: single choice, multiple choice, or free text.");
14
+ export const InterviewOption = z
15
+ .object({
16
+ id: Id.describe("Option id."),
17
+ label: z.string().describe("Human-readable option label."),
18
+ })
19
+ .describe("One selectable option of an interview question.");
20
+ /** One quiz card. `tier` expresses the hierarchical depth (0 = foundational). */
21
+ export const InterviewQuestion = z
22
+ .object({
23
+ id: Id.describe("Question id."),
24
+ tier: z.number().int().nonnegative().default(0).describe("Hierarchical depth of the question (0 = foundational)."),
25
+ prompt: z.string().describe("The question text shown to the user."),
26
+ kind: InterviewQuestionKind.default("single"),
27
+ options: z.array(InterviewOption).default([]).describe("Selectable options; empty for pure free-text questions."),
28
+ /** Whether free-text is accepted in addition to / instead of options. */
29
+ allow_text: z.boolean().default(false).describe("Whether free-text is accepted in addition to or instead of options."),
30
+ rationale: z.string().optional().describe("Why this question matters for the spec."),
31
+ })
32
+ .describe("One quiz card of the spec interview.");
33
+ export const InterviewAnswer = z
34
+ .object({
35
+ question_id: Id.describe("Id of the question being answered."),
36
+ option_ids: z.array(Id).default([]).describe("Ids of the selected options."),
37
+ text: z.string().nullable().default(null).describe("Free-text answer; null when only options were selected."),
38
+ })
39
+ .describe("The user's answer to one interview question.");
40
+ /**
41
+ * An explicit unresolved ambiguity (NEEDS_CLARIFICATION). The interview refuses
42
+ * to freeze while any of these are `open` — nothing is silently guessed.
43
+ */
44
+ export const ClarificationItem = z
45
+ .object({
46
+ id: Id.describe("Clarification id."),
47
+ claim: z.string().describe("The ambiguous claim or open question that needs resolution."),
48
+ status: z.enum(["open", "resolved"]).default("open").describe("Whether the ambiguity is still open or has been resolved."),
49
+ resolution: z.string().nullable().default(null).describe("How the ambiguity was resolved; null while open."),
50
+ })
51
+ .describe("An explicit unresolved ambiguity (NEEDS_CLARIFICATION); the interview refuses to freeze while any is open.");
52
+ /** Acceptance criterion in EARS style ("WHEN <cond>, THE SYSTEM SHALL <behavior>"). */
53
+ export const SpecAcceptanceCriterion = z
54
+ .object({
55
+ id: Id.describe("Criterion id."),
56
+ behavior: z.string().describe("Required behavior, EARS style (WHEN <condition>, THE SYSTEM SHALL <behavior>)."),
57
+ required: z.boolean().default(true).describe("Whether this criterion is required (vs advisory)."),
58
+ })
59
+ .describe("Acceptance criterion in EARS style.");
60
+ /** A dependency-ordered task in the implementation checklist. */
61
+ export const SpecTask = z
62
+ .object({
63
+ id: Id.describe("Task id."),
64
+ title: z.string().describe("Human-readable task title."),
65
+ depends_on: z.array(Id).default([]).describe("Ids of tasks that must complete first."),
66
+ done: z.boolean().default(false).describe("Whether the task has been completed."),
67
+ })
68
+ .describe("A dependency-ordered task in the implementation checklist.");
69
+ export const SpecConstraints = z
70
+ .object({
71
+ /** Spec-owned protected paths can raise review risk; per-run approvals cannot be frozen into a spec. */
72
+ protected_paths: z
73
+ .array(z.string())
74
+ .default([])
75
+ .describe("Spec-owned protected path globs that raise review risk; per-run approvals cannot be frozen into a spec."),
76
+ })
77
+ .strict()
78
+ .describe("Constraints frozen into the spec.");
79
+ const SpecPackBase = z.object({
80
+ schema_version: SchemaVersion,
81
+ id: Id.describe("SpecPack id."),
82
+ created_at: IsoTimestamp.describe("When this SpecPack revision was created."),
83
+ /** Monotonic revision; each freeze increments it (spec-anchored history). */
84
+ version: z.number().int().positive().default(1).describe("Monotonic revision; each freeze increments it."),
85
+ frozen: z.boolean().default(false).describe("Whether the spec is frozen (immutable and runnable)."),
86
+ intent: z
87
+ .object({
88
+ raw: z.string().describe("The user's original request, verbatim."),
89
+ normalized: z.string().optional().describe("Optional normalized restatement of the request."),
90
+ })
91
+ .describe("The user intent this spec captures."),
92
+ summary: z.string().default("").describe("Short human-readable summary of the spec."),
93
+ success_criteria: z.array(SpecAcceptanceCriterion).default([]).describe("Acceptance criteria the implementation is held to."),
94
+ non_goals: z.array(z.string()).default([]).describe("Explicitly out-of-scope outcomes."),
95
+ forbidden_approaches: z.array(z.string()).default([]).describe("Approaches the implementation must not take."),
96
+ decided_tradeoffs: z.array(z.string()).default([]).describe("Tradeoffs already decided during the interview."),
97
+ constraints: SpecConstraints.default({}),
98
+ tests: z.array(TestCommand).default([]).describe("Deterministic test commands frozen into the spec."),
99
+ tasks: z.array(SpecTask).default([]).describe("Dependency-ordered implementation checklist."),
100
+ open_questions: z.array(ClarificationItem).default([]).describe("Unresolved ambiguities; must all be resolved before freezing."),
101
+ interview: z
102
+ .object({
103
+ questions: z.array(InterviewQuestion).default([]).describe("Questions asked during the interview."),
104
+ answers: z.array(InterviewAnswer).default([]).describe("The user's answers."),
105
+ })
106
+ .default({ questions: [], answers: [] })
107
+ .describe("The clarify-quiz transcript this spec was built from."),
108
+ });
109
+ /**
110
+ * Schema-level invariants (SSOT, enforced on every parse — even when loaded from
111
+ * disk, not just via the engine): a frozen spec cannot carry open clarifications,
112
+ * and a "resolved" clarification must record a non-empty resolution. This makes a
113
+ * frozen-but-ambiguous SpecPack unrepresentable — no silent guessing.
114
+ */
115
+ export const SpecPack = SpecPackBase.superRefine((data, ctx) => {
116
+ if (data.frozen && data.open_questions.some((q) => q.status === "open")) {
117
+ ctx.addIssue({
118
+ code: z.ZodIssueCode.custom,
119
+ path: ["open_questions"],
120
+ message: "a frozen SpecPack cannot have open clarifications",
121
+ });
122
+ }
123
+ data.open_questions.forEach((q, i) => {
124
+ if (q.status === "resolved" && (q.resolution === null || q.resolution.trim() === "")) {
125
+ ctx.addIssue({
126
+ code: z.ZodIssueCode.custom,
127
+ path: ["open_questions", i, "resolution"],
128
+ message: "a resolved clarification must have a non-empty resolution",
129
+ });
130
+ }
131
+ });
132
+ }).describe("The frozen, versioned, diffable specification produced by the spec interview; the SSOT a run is held to, mapping deterministically into a TaskContract.");
133
+ //# sourceMappingURL=spec.js.map