cc-codeconductor 1.7.0 → 1.7.2

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 (29) hide show
  1. package/README.md +11 -10
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +2689 -528
  4. package/dist/library.js +859 -715
  5. package/dist/validation/schemas.d.ts +784 -138
  6. package/dist/validation/scoped-context-schemas.d.ts +1074 -0
  7. package/package.json +3 -2
  8. package/presets/agy/skills/database-migrations/SKILL.md +64 -0
  9. package/presets/agy/skills/rust-async/SKILL.md +64 -0
  10. package/presets/agy/skills/rust-engineering/SKILL.md +69 -0
  11. package/presets/agy/skills/rust-sqlx/SKILL.md +64 -0
  12. package/presets/claude/settings.json +1 -8
  13. package/presets/claude/skills/database-migrations/SKILL.md +64 -0
  14. package/presets/claude/skills/rust-async/SKILL.md +64 -0
  15. package/presets/claude/skills/rust-engineering/SKILL.md +69 -0
  16. package/presets/claude/skills/rust-sqlx/SKILL.md +64 -0
  17. package/presets/codex/skills/database-migrations/SKILL.md +64 -0
  18. package/presets/codex/skills/rust-async/SKILL.md +64 -0
  19. package/presets/codex/skills/rust-engineering/SKILL.md +69 -0
  20. package/presets/codex/skills/rust-sqlx/SKILL.md +64 -0
  21. package/presets/cursor/skills/database-migrations/SKILL.md +64 -0
  22. package/presets/cursor/skills/rust-async/SKILL.md +64 -0
  23. package/presets/cursor/skills/rust-engineering/SKILL.md +69 -0
  24. package/presets/cursor/skills/rust-sqlx/SKILL.md +64 -0
  25. package/presets/opencode/skills/database-migrations/SKILL.md +64 -0
  26. package/presets/opencode/skills/rust-async/SKILL.md +64 -0
  27. package/presets/opencode/skills/rust-engineering/SKILL.md +69 -0
  28. package/presets/opencode/skills/rust-sqlx/SKILL.md +64 -0
  29. package/src/presets/shared-skills.yml +8 -0
package/dist/library.js CHANGED
@@ -31,9 +31,136 @@ var init_runner_target = __esm(() => {
31
31
  INDIVIDUAL_TARGETS = ["opencode", "claude", "codex", "gemini", "cursor", "agy", "pi", "muse"];
32
32
  });
33
33
 
34
+ // src/validation/scoped-context-schemas.ts
35
+ import { z } from "zod";
36
+ var ContainedRelPath, Sha256, NonEmpty, RuleKindSchema, OriginClassSchema, ScopedRuleSchema, ScopedRuleFileSchema, RecipeStatusSchema, RecipeStepSchema, VerificationRecipeSchema, ContextManifestSchema, RuleViewSchema, ScopedContextSchema, DetectionStatusSchema, DependencyEvidenceSchema, ProjectScopeProfileSchema;
37
+ var init_scoped_context_schemas = __esm(() => {
38
+ ContainedRelPath = z.string().min(1).refine((p) => !p.startsWith("/") && !/^[A-Za-z]:/.test(p) && !p.includes("\\") && !p.includes("\x00") && !p.split("/").includes(".."), "path must be relative and contained in the authorized root");
39
+ Sha256 = z.string().regex(/^[0-9a-f]{64}$/);
40
+ NonEmpty = z.string().trim().min(1);
41
+ RuleKindSchema = z.enum(["default", "invariant"]);
42
+ OriginClassSchema = z.enum(["engine", "stack", "repository", "task"]);
43
+ ScopedRuleSchema = z.object({
44
+ id: z.string().regex(/^[a-z0-9]+(\.[a-z0-9-]+)+$/),
45
+ kind: RuleKindSchema,
46
+ scopeRoot: z.union([z.literal("."), ContainedRelPath]),
47
+ paths: z.object({
48
+ files: z.array(ContainedRelPath).default([]),
49
+ subtrees: z.array(ContainedRelPath).default([])
50
+ }).strict().default({ files: [], subtrees: [] }),
51
+ when: z.object({
52
+ languages: z.array(NonEmpty).optional(),
53
+ roles: z.array(NonEmpty).optional()
54
+ }).strict().default({}),
55
+ trigger: NonEmpty,
56
+ action: NonEmpty,
57
+ reason: NonEmpty,
58
+ exceptions: NonEmpty,
59
+ verification: z.object({ recipeIds: z.array(NonEmpty).min(1) }).strict(),
60
+ references: z.array(NonEmpty).default([])
61
+ }).strict();
62
+ ScopedRuleFileSchema = z.object({
63
+ schemaVersion: z.literal(1),
64
+ rules: z.array(ScopedRuleSchema).min(1)
65
+ }).strict();
66
+ RecipeStatusSchema = z.enum(["PASS", "FAIL", "BLOCKED", "SKIPPED"]);
67
+ RecipeStepSchema = z.object({
68
+ executable: z.string().regex(/^[A-Za-z0-9_-]+$/),
69
+ argv: z.array(z.string().refine((a) => !a.includes("\x00"))),
70
+ cwd: z.union([z.literal("."), ContainedRelPath]),
71
+ timeoutSeconds: z.number().int().min(1).max(3600),
72
+ expectedExitCodes: z.array(z.number().int()).min(1),
73
+ environment: z.record(z.string()).default({})
74
+ }).strict();
75
+ VerificationRecipeSchema = z.object({
76
+ schemaVersion: z.literal(1),
77
+ id: z.string().regex(/^[a-z0-9][a-z0-9-]*$/),
78
+ version: z.number().int().min(1),
79
+ scope: z.object({
80
+ workspaceRoot: z.union([z.literal("."), ContainedRelPath]),
81
+ manifest: ContainedRelPath,
82
+ package: NonEmpty.optional()
83
+ }).strict(),
84
+ prerequisites: z.object({
85
+ tools: z.array(NonEmpty),
86
+ lockfileRequired: z.boolean(),
87
+ dependencyCacheRequired: z.boolean()
88
+ }).strict(),
89
+ steps: z.array(RecipeStepSchema).min(1),
90
+ evidence: z.object({
91
+ requireObservedExecution: z.literal(true),
92
+ requireCandidateUnchanged: z.boolean()
93
+ }).strict()
94
+ }).strict();
95
+ ContextManifestSchema = z.object({
96
+ schemaVersion: z.literal(1),
97
+ scope: z.object({ files: z.array(ContainedRelPath), role: NonEmpty }).strict(),
98
+ profiles: z.array(z.unknown()),
99
+ skills: z.array(z.object({ id: NonEmpty, version: NonEmpty }).strict()),
100
+ rules: z.array(z.object({
101
+ id: NonEmpty,
102
+ kind: RuleKindSchema,
103
+ originClass: OriginClassSchema,
104
+ scopeRoot: z.string(),
105
+ depth: z.number().int().min(0),
106
+ sourcePath: NonEmpty,
107
+ contentHash: Sha256,
108
+ appliesTo: z.array(ContainedRelPath).min(1)
109
+ }).strict()),
110
+ overrides: z.array(z.object({ id: NonEmpty, winner: NonEmpty, loser: NonEmpty }).strict()),
111
+ omittedReferences: z.array(z.object({ ref: NonEmpty, reason: NonEmpty }).strict()),
112
+ diagnostics: z.array(z.object({
113
+ code: NonEmpty,
114
+ severity: z.enum(["info", "warning", "blocking"]),
115
+ message: NonEmpty
116
+ }).strict()),
117
+ budget: z.object({ maxBytes: z.number().int().min(0), usedBytes: z.number().int().min(0) }).strict(),
118
+ hash: Sha256
119
+ }).strict();
120
+ RuleViewSchema = z.object({
121
+ id: NonEmpty,
122
+ kind: RuleKindSchema,
123
+ trigger: NonEmpty,
124
+ action: NonEmpty,
125
+ exceptions: NonEmpty,
126
+ verify: z.array(NonEmpty),
127
+ appliesTo: z.array(ContainedRelPath).min(1),
128
+ source: NonEmpty
129
+ }).strict();
130
+ ScopedContextSchema = z.object({
131
+ manifest: ContextManifestSchema,
132
+ view: z.object({ hash: Sha256, rules: z.array(RuleViewSchema) }).strict()
133
+ }).strict();
134
+ DetectionStatusSchema = z.enum(["confirmed", "indicative", "inconclusive", "absent"]);
135
+ DependencyEvidenceSchema = z.object({
136
+ file: NonEmpty,
137
+ section: NonEmpty,
138
+ key: NonEmpty,
139
+ name: NonEmpty,
140
+ alias: NonEmpty.optional(),
141
+ category: z.enum(["normal", "dev", "build"]),
142
+ optional: z.boolean(),
143
+ features: z.array(z.string()),
144
+ defaultFeatures: z.boolean(),
145
+ target: z.string().optional(),
146
+ owner: NonEmpty,
147
+ resolution: z.enum(["declared", "workspace-inherited", "unresolved"])
148
+ }).strict();
149
+ ProjectScopeProfileSchema = z.object({
150
+ root: z.string(),
151
+ language: NonEmpty,
152
+ status: DetectionStatusSchema,
153
+ packages: z.array(z.object({ name: NonEmpty, manifest: NonEmpty, workspaceRoot: z.string().optional() }).strict()),
154
+ capabilities: z.array(z.string()),
155
+ declaredDatabaseBackends: z.array(z.string()),
156
+ dependencyEvidence: z.array(DependencyEvidenceSchema),
157
+ diagnostics: z.array(z.object({ code: NonEmpty, message: NonEmpty }).strict())
158
+ }).strict();
159
+ });
160
+
34
161
  // src/validation/schemas.ts
35
162
  import { isAbsolute } from "node:path";
36
- import { z } from "zod";
163
+ import { z as z2 } from "zod";
37
164
  function isContainedRelativePath(value) {
38
165
  if (value === "" || isAbsolute(value))
39
166
  return false;
@@ -159,11 +286,12 @@ function validateSkillsRegistry(data) {
159
286
  var CouncilAgentSpecSchema, CouncilSpecSchema, ProjectProfileSchema, CompileCheckConfigSchema, LoopConfigSchema, CodeConductorConfigSchema, RunnerTargetSchema, InstallStrategySchema, ContainedRelativePathSchema, ManifestEntrySchema, InstallManifestSchema, ToolProviderNamesSchema, PermissionProviderNamesSchema, ModelConfigSchema, SkillFrontmatterSchema, CommandFrontmatterSchema, TargetCapabilitiesSchema, ContractTargetSchema, ContractFormatSchema, AgentContractSchema, CouncilFindingSchema, CouncilVerdictInputSchema, ConsensusConfigSchema, CouncilVerdictSchema, ClaudeAgentFileSchema, OpenCodeAgentFileSchema, SentryStackFrameSchema, SentryWebhookSchema, MemoryPointerSchema, MemoryIndexSchema, GoalTaskSchema, GoalGraphSchema, ConfidenceLevelSchema, ProductNodeTypeSchema, GraphRelationSchema, KnowledgeEntitySchema, DecisionSchema, EvidenceSchema, TddValidationRecordSchema, CanonicalTaskCardStatusSchema, CanonicalTaskCardSchema, ProductGraphNodeSchema, ProductGraphEdgeSchema, ProductGraphSchema, ProductMetaSchema, ProductEventTypeSchema, ProductEventSchema, OperationalStateSchema, StrategicMemorySchema, ImpactReportSchema, BusinessReviewOutputSchema, VerificationReportSchema, BacklogStatusSchema, BacklogTypeSchema, BacklogPrioritySchema, BacklogGlobalSchema, BacklogItemSchema, BacklogDocumentSchema, OpenspecTaskCardPhaseSchema, OpenspecTaskCardStatusSchema, OpenspecTaskCardSchema, OpenspecStateSchema, SpecAnalyzeFindingSchema, SpecAnalyzeReportSchema, WorkflowCommandSchema, CcepOutputFormatSchema, CommandEnvelopeSchema, WorkflowPhaseSchema, WorkflowRiskRuleSchema, WorkflowProfileSchema, ExecutionContextSchema, PlannerOutputSchema, AgentArtifactSchema, AgentOutputSchema, ImplementerTestsSchema, ImplementerOutputSchema, ReviewAxisSchema, ReviewFindingSchema, ReviewerOutputSchema, TechnicalPlanOutputSchema, FixIntakeOutputSchema, ScorecardVerdictSchema, ScorecardCriterionIdSchema, ScorecardCriterionSchema, ScorecardRecordSchema, TaskOutcomeSourceSchema, TaskOutcomeStatusSchema, DeliveryRouteSchema, TokenUsageSchema, DeliveryTelemetrySchema, DeliveryLedgerTaskSchema, DeliveryLedgerSchema, HandoffEnvelopeSchema, RepoRelativePathSchema, DeliveryLedgerRequestSchema, TaskOutcomeSchema, HarnessComponentIdSchema, HarnessComponentLayerSchema, HarnessToggleKindSchema, HarnessCatalogEntrySchema, HarnessCatalogSchema, HarnessOverlaySchema, HarnessExperimentSchema, HarnessSuiteTaskSchema, HarnessSuiteSchema, EvaluationIndexSchema, ExecutionProfileNameSchema, ExecutionProfileSchema, SkillsRegistrySchema;
160
287
  var init_schemas = __esm(() => {
161
288
  init_runner_target();
162
- CouncilAgentSpecSchema = z.object({
163
- id: z.string(),
164
- role: z.string(),
165
- context: z.enum(["repo-readonly", "prompt-only"]),
166
- modelHint: z.enum([
289
+ init_scoped_context_schemas();
290
+ CouncilAgentSpecSchema = z2.object({
291
+ id: z2.string(),
292
+ role: z2.string(),
293
+ context: z2.enum(["repo-readonly", "prompt-only"]),
294
+ modelHint: z2.enum([
167
295
  "strong-reasoning",
168
296
  "security-reasoning",
169
297
  "balanced",
@@ -171,64 +299,65 @@ var init_schemas = __esm(() => {
171
299
  "analytical",
172
300
  "adversarial"
173
301
  ]),
174
- focus: z.array(z.string())
175
- });
176
- CouncilSpecSchema = z.object({
177
- name: z.string(),
178
- version: z.string(),
179
- description: z.string(),
180
- outputContract: z.string(),
181
- agents: z.array(CouncilAgentSpecSchema).min(1).refine((agents) => new Set(agents.map((a) => a.id.trim().toLowerCase())).size === agents.length, { message: "council agent ids must be unique" })
182
- });
183
- ProjectProfileSchema = z.object({
184
- rootDir: z.string(),
185
- languages: z.array(z.string()),
186
- runtimes: z.array(z.string()),
187
- packageManagers: z.array(z.string()),
188
- frameworks: z.array(z.string()),
189
- signals: z.array(z.string()),
190
- confidence: z.enum(["low", "medium", "high"])
191
- });
192
- CompileCheckConfigSchema = z.object({
193
- enabled: z.boolean(),
194
- command: z.string().optional(),
195
- timeoutMs: z.number().positive().optional()
196
- });
197
- LoopConfigSchema = z.object({
198
- enabled: z.boolean().optional().default(true),
199
- maxIterations: z.number().int().positive().optional().default(3),
200
- maxTokenBudget: z.number().nonnegative().optional().default(0),
201
- compaction: z.object({
202
- enabled: z.boolean().optional().default(true),
203
- historyFile: z.string().optional()
302
+ focus: z2.array(z2.string())
303
+ });
304
+ CouncilSpecSchema = z2.object({
305
+ name: z2.string(),
306
+ version: z2.string(),
307
+ description: z2.string(),
308
+ outputContract: z2.string(),
309
+ agents: z2.array(CouncilAgentSpecSchema).min(1).refine((agents) => new Set(agents.map((a) => a.id.trim().toLowerCase())).size === agents.length, { message: "council agent ids must be unique" })
310
+ });
311
+ ProjectProfileSchema = z2.object({
312
+ rootDir: z2.string(),
313
+ languages: z2.array(z2.string()),
314
+ runtimes: z2.array(z2.string()),
315
+ packageManagers: z2.array(z2.string()),
316
+ frameworks: z2.array(z2.string()),
317
+ signals: z2.array(z2.string()),
318
+ confidence: z2.enum(["low", "medium", "high"]),
319
+ scopes: z2.array(ProjectScopeProfileSchema).optional()
320
+ });
321
+ CompileCheckConfigSchema = z2.object({
322
+ enabled: z2.boolean(),
323
+ command: z2.string().optional(),
324
+ timeoutMs: z2.number().positive().optional()
325
+ });
326
+ LoopConfigSchema = z2.object({
327
+ enabled: z2.boolean().optional().default(true),
328
+ maxIterations: z2.number().int().positive().optional().default(3),
329
+ maxTokenBudget: z2.number().nonnegative().optional().default(0),
330
+ compaction: z2.object({
331
+ enabled: z2.boolean().optional().default(true),
332
+ historyFile: z2.string().optional()
204
333
  }).optional()
205
334
  });
206
- CodeConductorConfigSchema = z.object({
207
- version: z.string(),
208
- project: z.object({
209
- name: z.string(),
210
- profile: z.string().optional()
335
+ CodeConductorConfigSchema = z2.object({
336
+ version: z2.string(),
337
+ project: z2.object({
338
+ name: z2.string(),
339
+ profile: z2.string().optional()
211
340
  }),
212
- defaults: z.object({
213
- target: z.enum(INDIVIDUAL_TARGETS),
214
- overwrite: z.boolean(),
215
- locale: z.enum(["en", "es"]).optional().default("en")
341
+ defaults: z2.object({
342
+ target: z2.enum(INDIVIDUAL_TARGETS),
343
+ overwrite: z2.boolean(),
344
+ locale: z2.enum(["en", "es"]).optional().default("en")
216
345
  }),
217
- presets: z.object({
218
- council: z.object({
219
- enabled: z.boolean(),
220
- version: z.string()
346
+ presets: z2.object({
347
+ council: z2.object({
348
+ enabled: z2.boolean(),
349
+ version: z2.string()
221
350
  })
222
351
  }),
223
- safety: z.object({
224
- destructiveCommands: z.array(z.string()),
225
- secretPatterns: z.array(z.string()),
352
+ safety: z2.object({
353
+ destructiveCommands: z2.array(z2.string()),
354
+ secretPatterns: z2.array(z2.string()),
226
355
  compileCheck: CompileCheckConfigSchema.optional()
227
356
  }),
228
357
  loop: LoopConfigSchema.optional()
229
358
  });
230
- RunnerTargetSchema = z.enum(RUNNER_TARGETS);
231
- InstallStrategySchema = z.enum([
359
+ RunnerTargetSchema = z2.enum(RUNNER_TARGETS);
360
+ InstallStrategySchema = z2.enum([
232
361
  "overwrite",
233
362
  "append",
234
363
  "merge-json",
@@ -236,64 +365,64 @@ var init_schemas = __esm(() => {
236
365
  "create-only",
237
366
  "skip"
238
367
  ]);
239
- ContainedRelativePathSchema = z.string().refine(isContainedRelativePath, (value) => ({
368
+ ContainedRelativePathSchema = z2.string().refine(isContainedRelativePath, (value) => ({
240
369
  message: `Path must be relative without ".." segments: ${value}`
241
370
  }));
242
- ManifestEntrySchema = z.object({
371
+ ManifestEntrySchema = z2.object({
243
372
  src: ContainedRelativePathSchema,
244
373
  dest: ContainedRelativePathSchema,
245
374
  strategy: InstallStrategySchema,
246
375
  globalStrategy: InstallStrategySchema.optional(),
247
- template: z.boolean().optional()
248
- });
249
- InstallManifestSchema = z.object({
250
- target: z.enum(INDIVIDUAL_TARGETS),
251
- entries: z.array(ManifestEntrySchema)
252
- });
253
- ToolProviderNamesSchema = z.record(z.string(), z.string());
254
- PermissionProviderNamesSchema = z.record(z.string(), z.string());
255
- ModelConfigSchema = z.object({
256
- target: z.enum(INDIVIDUAL_TARGETS),
257
- agents: z.record(z.string(), z.object({
258
- claude: z.string().optional(),
259
- opencode: z.string().optional(),
260
- codex: z.string().optional(),
261
- gemini: z.string().optional(),
262
- cursor: z.string().optional(),
263
- agy: z.string().optional(),
264
- pi: z.string().optional(),
265
- grok: z.string().optional(),
266
- muse: z.string().optional()
376
+ template: z2.boolean().optional()
377
+ });
378
+ InstallManifestSchema = z2.object({
379
+ target: z2.enum(INDIVIDUAL_TARGETS),
380
+ entries: z2.array(ManifestEntrySchema)
381
+ });
382
+ ToolProviderNamesSchema = z2.record(z2.string(), z2.string());
383
+ PermissionProviderNamesSchema = z2.record(z2.string(), z2.string());
384
+ ModelConfigSchema = z2.object({
385
+ target: z2.enum(INDIVIDUAL_TARGETS),
386
+ agents: z2.record(z2.string(), z2.object({
387
+ claude: z2.string().optional(),
388
+ opencode: z2.string().optional(),
389
+ codex: z2.string().optional(),
390
+ gemini: z2.string().optional(),
391
+ cursor: z2.string().optional(),
392
+ agy: z2.string().optional(),
393
+ pi: z2.string().optional(),
394
+ grok: z2.string().optional(),
395
+ muse: z2.string().optional()
267
396
  })),
268
- tools: z.record(z.string(), ToolProviderNamesSchema).optional(),
397
+ tools: z2.record(z2.string(), ToolProviderNamesSchema).optional(),
269
398
  permissions: PermissionProviderNamesSchema.optional()
270
399
  });
271
- SkillFrontmatterSchema = z.object({
272
- name: z.string().trim().min(1, "name must not be empty"),
273
- description: z.string().trim().min(1, "description must not be empty").max(1024, "description must be 1024 characters or fewer"),
274
- id: z.string().trim().min(1).optional()
400
+ SkillFrontmatterSchema = z2.object({
401
+ name: z2.string().trim().min(1, "name must not be empty"),
402
+ description: z2.string().trim().min(1, "description must not be empty").max(1024, "description must be 1024 characters or fewer"),
403
+ id: z2.string().trim().min(1).optional()
275
404
  }).passthrough();
276
- CommandFrontmatterSchema = z.object({
277
- description: z.string().trim().min(1, "description must not be empty").max(1024, "description must be 1024 characters or fewer"),
278
- "argument-hint": z.string().trim().min(1).optional(),
279
- "allowed-tools": z.string().trim().min(1).optional(),
280
- model: z.string().trim().min(1).optional(),
281
- "disable-model-invocation": z.boolean().optional()
405
+ CommandFrontmatterSchema = z2.object({
406
+ description: z2.string().trim().min(1, "description must not be empty").max(1024, "description must be 1024 characters or fewer"),
407
+ "argument-hint": z2.string().trim().min(1).optional(),
408
+ "allowed-tools": z2.string().trim().min(1).optional(),
409
+ model: z2.string().trim().min(1).optional(),
410
+ "disable-model-invocation": z2.boolean().optional()
282
411
  }).passthrough();
283
- TargetCapabilitiesSchema = z.object({
284
- target: z.enum(INDIVIDUAL_TARGETS),
285
- invocation: z.enum(["colon", "hyphen", "dollar"]),
286
- commandFormat: z.enum(["markdown", "toml", "skill"]),
287
- contextFile: z.string().trim().min(1),
288
- subagentInvocationStyle: z.enum(["task-tool", "adopt-role", "invoke-with-context"]).optional(),
289
- capabilities: z.object({
290
- subagents: z.boolean(),
291
- hooks: z.boolean(),
292
- mcp: z.boolean(),
293
- council: z.boolean()
412
+ TargetCapabilitiesSchema = z2.object({
413
+ target: z2.enum(INDIVIDUAL_TARGETS),
414
+ invocation: z2.enum(["colon", "hyphen", "dollar"]),
415
+ commandFormat: z2.enum(["markdown", "toml", "skill"]),
416
+ contextFile: z2.string().trim().min(1),
417
+ subagentInvocationStyle: z2.enum(["task-tool", "adopt-role", "invoke-with-context"]).optional(),
418
+ capabilities: z2.object({
419
+ subagents: z2.boolean(),
420
+ hooks: z2.boolean(),
421
+ mcp: z2.boolean(),
422
+ council: z2.boolean()
294
423
  })
295
424
  });
296
- ContractTargetSchema = z.enum([
425
+ ContractTargetSchema = z2.enum([
297
426
  "claude",
298
427
  "opencode",
299
428
  "codex",
@@ -301,41 +430,41 @@ var init_schemas = __esm(() => {
301
430
  "cursor",
302
431
  "agy"
303
432
  ]);
304
- ContractFormatSchema = z.object({
433
+ ContractFormatSchema = z2.object({
305
434
  target: ContractTargetSchema,
306
- options: z.record(z.unknown()).optional()
435
+ options: z2.record(z2.unknown()).optional()
307
436
  });
308
- AgentContractSchema = z.object({
437
+ AgentContractSchema = z2.object({
309
438
  council: CouncilSpecSchema,
310
- targets: z.array(ContractFormatSchema),
311
- contractVersion: z.string(),
312
- renderHints: z.record(ContractTargetSchema, z.record(z.unknown())).optional()
313
- });
314
- CouncilFindingSchema = z.object({
315
- category: z.string(),
316
- severity: z.enum(["info", "warning", "critical"]),
317
- message: z.string(),
318
- agentId: z.string()
319
- });
320
- CouncilVerdictInputSchema = z.object({
321
- agentId: z.string().min(1).refine((id) => id.trim().length > 0),
322
- agentRole: z.string(),
323
- status: z.enum(["APPROVED", "REJECTED", "ABSTAIN"]),
324
- securityVeto: z.boolean(),
325
- complianceVeto: z.boolean().optional(),
326
- confidence: z.number().min(0).max(1),
327
- findings: z.array(CouncilFindingSchema),
328
- summary: z.string(),
329
- candidateHash: z.string().min(1).optional()
330
- });
331
- ConsensusConfigSchema = z.object({
332
- algorithm: z.enum(["majority", "unanimous"]),
333
- allowSecurityVeto: z.boolean(),
334
- allowComplianceVeto: z.boolean().optional(),
335
- expectedAgentIds: z.array(z.string().min(1).refine((id) => id.trim().length > 0)).min(1).refine((ids) => new Set(ids.map((id) => id.trim().toLowerCase())).size === ids.length).optional(),
336
- quorum: z.number().int().positive().optional(),
337
- criticalFindingsPolicy: z.enum(["escalate", "reject", "ignore"]).optional(),
338
- candidateHash: z.string().min(1).optional()
439
+ targets: z2.array(ContractFormatSchema),
440
+ contractVersion: z2.string(),
441
+ renderHints: z2.record(ContractTargetSchema, z2.record(z2.unknown())).optional()
442
+ });
443
+ CouncilFindingSchema = z2.object({
444
+ category: z2.string(),
445
+ severity: z2.enum(["info", "warning", "critical"]),
446
+ message: z2.string(),
447
+ agentId: z2.string()
448
+ });
449
+ CouncilVerdictInputSchema = z2.object({
450
+ agentId: z2.string().min(1).refine((id) => id.trim().length > 0),
451
+ agentRole: z2.string(),
452
+ status: z2.enum(["APPROVED", "REJECTED", "ABSTAIN"]),
453
+ securityVeto: z2.boolean(),
454
+ complianceVeto: z2.boolean().optional(),
455
+ confidence: z2.number().min(0).max(1),
456
+ findings: z2.array(CouncilFindingSchema),
457
+ summary: z2.string(),
458
+ candidateHash: z2.string().min(1).optional()
459
+ });
460
+ ConsensusConfigSchema = z2.object({
461
+ algorithm: z2.enum(["majority", "unanimous"]),
462
+ allowSecurityVeto: z2.boolean(),
463
+ allowComplianceVeto: z2.boolean().optional(),
464
+ expectedAgentIds: z2.array(z2.string().min(1).refine((id) => id.trim().length > 0)).min(1).refine((ids) => new Set(ids.map((id) => id.trim().toLowerCase())).size === ids.length).optional(),
465
+ quorum: z2.number().int().positive().optional(),
466
+ criticalFindingsPolicy: z2.enum(["escalate", "reject", "ignore"]).optional(),
467
+ candidateHash: z2.string().min(1).optional()
339
468
  }).refine((config) => config.algorithm !== "unanimous" || config.expectedAgentIds !== undefined, {
340
469
  message: "unanimous consensus requires a non-empty expectedAgentIds roster",
341
470
  path: ["expectedAgentIds"]
@@ -343,77 +472,77 @@ var init_schemas = __esm(() => {
343
472
  message: "allowSecurityVeto requires at least one security agent in expectedAgentIds",
344
473
  path: ["expectedAgentIds"]
345
474
  });
346
- CouncilVerdictSchema = z.object({
347
- status: z.enum(["APPROVED", "REJECTED", "ESCALATED"]),
348
- totalAgents: z.number(),
349
- approvedCount: z.number(),
350
- rejectedCount: z.number(),
351
- abstainedCount: z.number(),
352
- vetoApplied: z.boolean(),
353
- complianceVetoApplied: z.boolean().optional(),
354
- vetoByAgentId: z.string().optional(),
355
- averageConfidence: z.number().min(0).max(1).optional(),
356
- findings: z.array(CouncilFindingSchema),
357
- summary: z.string(),
358
- individualVerdicts: z.array(CouncilVerdictInputSchema)
359
- });
360
- ClaudeAgentFileSchema = z.object({
361
- path: z.string().startsWith(".claude/"),
362
- content: z.string(),
363
- overwrite: z.boolean()
364
- });
365
- OpenCodeAgentFileSchema = z.object({
366
- path: z.string().startsWith(".opencode/"),
367
- content: z.string(),
368
- overwrite: z.boolean()
369
- });
370
- SentryStackFrameSchema = z.object({
371
- filename: z.string(),
372
- function: z.string(),
373
- lineNo: z.number(),
374
- colNo: z.number().optional(),
375
- context: z.array(z.string())
376
- });
377
- SentryWebhookSchema = z.object({
378
- issueId: z.string(),
379
- title: z.string(),
380
- culprit: z.string(),
381
- filename: z.string().optional(),
382
- stackTrace: z.array(SentryStackFrameSchema),
383
- environment: z.string().optional(),
384
- release: z.string().optional()
385
- });
386
- MemoryPointerSchema = z.object({
387
- topic_key: z.string().min(1).max(128),
388
- id: z.number().int().positive(),
389
- file: z.string().min(1),
390
- summary: z.string().min(1).max(200),
391
- timestamp: z.string().datetime(),
392
- tags: z.array(z.string().max(64)).max(10).optional().default([])
393
- });
394
- MemoryIndexSchema = z.object({
395
- version: z.literal(1),
396
- pointers: z.array(MemoryPointerSchema)
397
- });
398
- GoalTaskSchema = z.object({
399
- id: z.string(),
400
- title: z.string(),
401
- type: z.enum(["feature", "fix", "refactor", "test", "docs"]),
402
- risk: z.enum(["low", "medium", "high"]),
403
- priority: z.enum(["P0", "P1", "P2", "P3"]).optional(),
404
- status: z.enum(["pending", "in-progress", "done", "blocked"]),
405
- depends_on: z.array(z.string()).optional().default([]),
406
- acceptance_criteria: z.array(z.string()),
407
- blocked_reason: z.string().optional(),
408
- context_scope: z.enum(["isolated", "continuation", "full"]).optional().default("isolated")
409
- });
410
- GoalGraphSchema = z.object({
411
- objective: z.string(),
412
- tasks: z.array(GoalTaskSchema),
413
- created_at: z.string()
414
- });
415
- ConfidenceLevelSchema = z.enum(["low", "medium", "high"]);
416
- ProductNodeTypeSchema = z.enum([
475
+ CouncilVerdictSchema = z2.object({
476
+ status: z2.enum(["APPROVED", "REJECTED", "ESCALATED"]),
477
+ totalAgents: z2.number(),
478
+ approvedCount: z2.number(),
479
+ rejectedCount: z2.number(),
480
+ abstainedCount: z2.number(),
481
+ vetoApplied: z2.boolean(),
482
+ complianceVetoApplied: z2.boolean().optional(),
483
+ vetoByAgentId: z2.string().optional(),
484
+ averageConfidence: z2.number().min(0).max(1).optional(),
485
+ findings: z2.array(CouncilFindingSchema),
486
+ summary: z2.string(),
487
+ individualVerdicts: z2.array(CouncilVerdictInputSchema)
488
+ });
489
+ ClaudeAgentFileSchema = z2.object({
490
+ path: z2.string().startsWith(".claude/"),
491
+ content: z2.string(),
492
+ overwrite: z2.boolean()
493
+ });
494
+ OpenCodeAgentFileSchema = z2.object({
495
+ path: z2.string().startsWith(".opencode/"),
496
+ content: z2.string(),
497
+ overwrite: z2.boolean()
498
+ });
499
+ SentryStackFrameSchema = z2.object({
500
+ filename: z2.string(),
501
+ function: z2.string(),
502
+ lineNo: z2.number(),
503
+ colNo: z2.number().optional(),
504
+ context: z2.array(z2.string())
505
+ });
506
+ SentryWebhookSchema = z2.object({
507
+ issueId: z2.string(),
508
+ title: z2.string(),
509
+ culprit: z2.string(),
510
+ filename: z2.string().optional(),
511
+ stackTrace: z2.array(SentryStackFrameSchema),
512
+ environment: z2.string().optional(),
513
+ release: z2.string().optional()
514
+ });
515
+ MemoryPointerSchema = z2.object({
516
+ topic_key: z2.string().min(1).max(128),
517
+ id: z2.number().int().positive(),
518
+ file: z2.string().min(1),
519
+ summary: z2.string().min(1).max(200),
520
+ timestamp: z2.string().datetime(),
521
+ tags: z2.array(z2.string().max(64)).max(10).optional().default([])
522
+ });
523
+ MemoryIndexSchema = z2.object({
524
+ version: z2.literal(1),
525
+ pointers: z2.array(MemoryPointerSchema)
526
+ });
527
+ GoalTaskSchema = z2.object({
528
+ id: z2.string(),
529
+ title: z2.string(),
530
+ type: z2.enum(["feature", "fix", "refactor", "test", "docs"]),
531
+ risk: z2.enum(["low", "medium", "high"]),
532
+ priority: z2.enum(["P0", "P1", "P2", "P3"]).optional(),
533
+ status: z2.enum(["pending", "in-progress", "done", "blocked"]),
534
+ depends_on: z2.array(z2.string()).optional().default([]),
535
+ acceptance_criteria: z2.array(z2.string()),
536
+ blocked_reason: z2.string().optional(),
537
+ context_scope: z2.enum(["isolated", "continuation", "full"]).optional().default("isolated")
538
+ });
539
+ GoalGraphSchema = z2.object({
540
+ objective: z2.string(),
541
+ tasks: z2.array(GoalTaskSchema),
542
+ created_at: z2.string()
543
+ });
544
+ ConfidenceLevelSchema = z2.enum(["low", "medium", "high"]);
545
+ ProductNodeTypeSchema = z2.enum([
417
546
  "product",
418
547
  "domain",
419
548
  "capability",
@@ -427,7 +556,7 @@ var init_schemas = __esm(() => {
427
556
  "task",
428
557
  "evidence"
429
558
  ]);
430
- GraphRelationSchema = z.enum([
559
+ GraphRelationSchema = z2.enum([
431
560
  "implements",
432
561
  "depends_on",
433
562
  "documents",
@@ -436,51 +565,51 @@ var init_schemas = __esm(() => {
436
565
  "blocks",
437
566
  "contains"
438
567
  ]);
439
- KnowledgeEntitySchema = z.object({
568
+ KnowledgeEntitySchema = z2.object({
440
569
  type: ProductNodeTypeSchema,
441
- id: z.string(),
442
- name: z.string(),
443
- source: z.string(),
444
- version: z.string().optional(),
570
+ id: z2.string(),
571
+ name: z2.string(),
572
+ source: z2.string(),
573
+ version: z2.string().optional(),
445
574
  confidence: ConfidenceLevelSchema,
446
- relations: z.array(z.object({
447
- targetId: z.string(),
575
+ relations: z2.array(z2.object({
576
+ targetId: z2.string(),
448
577
  relation: GraphRelationSchema
449
578
  })).default([]),
450
- data: z.record(z.string(), z.unknown()).optional().default({})
451
- });
452
- DecisionSchema = z.object({
453
- id: z.string(),
454
- context: z.string(),
455
- alternatives: z.array(z.string()).default([]),
456
- chosenOption: z.string(),
457
- rationale: z.string(),
458
- consequences: z.array(z.string()).default([]),
459
- date: z.string(),
460
- linkedTasks: z.array(z.string()).default([]),
461
- linkedComponents: z.array(z.string()).default([]),
462
- source: z.string().optional()
463
- });
464
- EvidenceSchema = z.object({
465
- id: z.string(),
466
- source: z.string(),
467
- type: z.string(),
468
- timestamp: z.string(),
469
- relatedTask: z.string().optional(),
470
- relatedDecision: z.string().optional(),
471
- confidence: z.number().min(0).max(1),
472
- checksum: z.string().optional(),
473
- summary: z.string().optional(),
474
- data: z.record(z.string(), z.unknown()).optional()
475
- });
476
- TddValidationRecordSchema = z.object({
477
- taskId: z.string().min(1),
478
- evidenceId: z.string().min(1),
479
- receiptNonce: z.string().regex(/^[0-9a-f]{32}$/),
480
- manifestHash: z.string().regex(/^[0-9a-f]{64}$/),
481
- validatedAt: z.string().datetime()
579
+ data: z2.record(z2.string(), z2.unknown()).optional().default({})
580
+ });
581
+ DecisionSchema = z2.object({
582
+ id: z2.string(),
583
+ context: z2.string(),
584
+ alternatives: z2.array(z2.string()).default([]),
585
+ chosenOption: z2.string(),
586
+ rationale: z2.string(),
587
+ consequences: z2.array(z2.string()).default([]),
588
+ date: z2.string(),
589
+ linkedTasks: z2.array(z2.string()).default([]),
590
+ linkedComponents: z2.array(z2.string()).default([]),
591
+ source: z2.string().optional()
592
+ });
593
+ EvidenceSchema = z2.object({
594
+ id: z2.string(),
595
+ source: z2.string(),
596
+ type: z2.string(),
597
+ timestamp: z2.string(),
598
+ relatedTask: z2.string().optional(),
599
+ relatedDecision: z2.string().optional(),
600
+ confidence: z2.number().min(0).max(1),
601
+ checksum: z2.string().optional(),
602
+ summary: z2.string().optional(),
603
+ data: z2.record(z2.string(), z2.unknown()).optional()
604
+ });
605
+ TddValidationRecordSchema = z2.object({
606
+ taskId: z2.string().min(1),
607
+ evidenceId: z2.string().min(1),
608
+ receiptNonce: z2.string().regex(/^[0-9a-f]{32}$/),
609
+ manifestHash: z2.string().regex(/^[0-9a-f]{64}$/),
610
+ validatedAt: z2.string().datetime()
482
611
  }).strict();
483
- CanonicalTaskCardStatusSchema = z.enum([
612
+ CanonicalTaskCardStatusSchema = z2.enum([
484
613
  "draft",
485
614
  "ready",
486
615
  "in-progress",
@@ -488,60 +617,60 @@ var init_schemas = __esm(() => {
488
617
  "done",
489
618
  "blocked"
490
619
  ]);
491
- CanonicalTaskCardSchema = z.object({
492
- id: z.string(),
493
- title: z.string(),
494
- objective: z.string(),
495
- context: z.string(),
496
- acceptanceCriteria: z.array(z.string()),
497
- dependencies: z.array(z.string()).default([]),
498
- constraints: z.array(z.string()).default([]),
499
- risk: z.enum(["low", "medium", "high"]),
500
- targetFiles: z.array(z.string()).default([]),
501
- agentType: z.string(),
502
- evidenceRequired: z.array(z.string()).default([]),
620
+ CanonicalTaskCardSchema = z2.object({
621
+ id: z2.string(),
622
+ title: z2.string(),
623
+ objective: z2.string(),
624
+ context: z2.string(),
625
+ acceptanceCriteria: z2.array(z2.string()),
626
+ dependencies: z2.array(z2.string()).default([]),
627
+ constraints: z2.array(z2.string()).default([]),
628
+ risk: z2.enum(["low", "medium", "high"]),
629
+ targetFiles: z2.array(z2.string()).default([]),
630
+ agentType: z2.string(),
631
+ evidenceRequired: z2.array(z2.string()).default([]),
503
632
  status: CanonicalTaskCardStatusSchema,
504
- type: z.enum(["feature", "fix", "refactor", "review", "docs", "test"]),
505
- linkedCapabilities: z.array(z.string()).default([]),
506
- boundaries: z.array(z.string()).default([]),
507
- requiresHumanReview: z.boolean().optional(),
508
- requiresTests: z.boolean().optional(),
509
- contextScope: z.enum(["isolated", "continuation", "full"]).optional(),
510
- actualBehavior: z.string().optional(),
511
- expectedBehavior: z.string().optional(),
512
- reproductionSteps: z.array(z.string()).optional(),
513
- domain: z.string().optional(),
514
- authorization: z.string().optional()
515
- });
516
- ProductGraphNodeSchema = z.object({
517
- id: z.string(),
633
+ type: z2.enum(["feature", "fix", "refactor", "review", "docs", "test"]),
634
+ linkedCapabilities: z2.array(z2.string()).default([]),
635
+ boundaries: z2.array(z2.string()).default([]),
636
+ requiresHumanReview: z2.boolean().optional(),
637
+ requiresTests: z2.boolean().optional(),
638
+ contextScope: z2.enum(["isolated", "continuation", "full"]).optional(),
639
+ actualBehavior: z2.string().optional(),
640
+ expectedBehavior: z2.string().optional(),
641
+ reproductionSteps: z2.array(z2.string()).optional(),
642
+ domain: z2.string().optional(),
643
+ authorization: z2.string().optional()
644
+ });
645
+ ProductGraphNodeSchema = z2.object({
646
+ id: z2.string(),
518
647
  type: ProductNodeTypeSchema,
519
- name: z.string(),
520
- data: z.record(z.string(), z.unknown()).default({}),
521
- source: z.string().optional(),
648
+ name: z2.string(),
649
+ data: z2.record(z2.string(), z2.unknown()).default({}),
650
+ source: z2.string().optional(),
522
651
  confidence: ConfidenceLevelSchema.optional(),
523
- version: z.string().optional()
652
+ version: z2.string().optional()
524
653
  });
525
- ProductGraphEdgeSchema = z.object({
526
- from: z.string(),
527
- to: z.string(),
654
+ ProductGraphEdgeSchema = z2.object({
655
+ from: z2.string(),
656
+ to: z2.string(),
528
657
  relation: GraphRelationSchema
529
658
  });
530
- ProductGraphSchema = z.object({
531
- version: z.literal(1),
532
- productId: z.string(),
533
- productName: z.string(),
534
- nodes: z.array(ProductGraphNodeSchema),
535
- edges: z.array(ProductGraphEdgeSchema),
536
- updatedAt: z.string()
537
- });
538
- ProductMetaSchema = z.object({
539
- version: z.literal(1),
540
- graphVersion: z.string(),
541
- lastIngestAt: z.string().optional(),
542
- sourceHashes: z.record(z.string(), z.string()).default({})
543
- });
544
- ProductEventTypeSchema = z.enum([
659
+ ProductGraphSchema = z2.object({
660
+ version: z2.literal(1),
661
+ productId: z2.string(),
662
+ productName: z2.string(),
663
+ nodes: z2.array(ProductGraphNodeSchema),
664
+ edges: z2.array(ProductGraphEdgeSchema),
665
+ updatedAt: z2.string()
666
+ });
667
+ ProductMetaSchema = z2.object({
668
+ version: z2.literal(1),
669
+ graphVersion: z2.string(),
670
+ lastIngestAt: z2.string().optional(),
671
+ sourceHashes: z2.record(z2.string(), z2.string()).default({})
672
+ });
673
+ ProductEventTypeSchema = z2.enum([
545
674
  "task.started",
546
675
  "task.completed",
547
676
  "lock.recovered",
@@ -554,64 +683,64 @@ var init_schemas = __esm(() => {
554
683
  "feedback.processed",
555
684
  "context.compiled"
556
685
  ]);
557
- ProductEventSchema = z.object({
558
- id: z.string(),
686
+ ProductEventSchema = z2.object({
687
+ id: z2.string(),
559
688
  type: ProductEventTypeSchema,
560
- timestamp: z.string(),
561
- payload: z.record(z.string(), z.unknown()).default({})
562
- });
563
- OperationalStateSchema = z.object({
564
- version: z.literal(1),
565
- activeAgents: z.array(z.string()).default([]),
566
- activeTaskIds: z.array(z.string()).default([]),
567
- blockers: z.array(z.object({
568
- taskId: z.string(),
569
- reason: z.string(),
570
- since: z.string()
689
+ timestamp: z2.string(),
690
+ payload: z2.record(z2.string(), z2.unknown()).default({})
691
+ });
692
+ OperationalStateSchema = z2.object({
693
+ version: z2.literal(1),
694
+ activeAgents: z2.array(z2.string()).default([]),
695
+ activeTaskIds: z2.array(z2.string()).default([]),
696
+ blockers: z2.array(z2.object({
697
+ taskId: z2.string(),
698
+ reason: z2.string(),
699
+ since: z2.string()
571
700
  })).default([]),
572
- sprintFocus: z.string().optional(),
573
- updatedAt: z.string()
574
- });
575
- StrategicMemorySchema = z.object({
576
- version: z.literal(1),
577
- kpis: z.array(z.object({
578
- name: z.string(),
579
- target: z.string(),
580
- current: z.string().optional()
701
+ sprintFocus: z2.string().optional(),
702
+ updatedAt: z2.string()
703
+ });
704
+ StrategicMemorySchema = z2.object({
705
+ version: z2.literal(1),
706
+ kpis: z2.array(z2.object({
707
+ name: z2.string(),
708
+ target: z2.string(),
709
+ current: z2.string().optional()
581
710
  })).default([]),
582
- quarterlyFocus: z.string().optional(),
583
- tradeoffs: z.array(z.string()).default([]),
584
- updatedAt: z.string()
585
- });
586
- ImpactReportSchema = z.object({
587
- target: z.string(),
588
- brokenEndpoints: z.array(z.string()).default([]),
589
- brokenContracts: z.array(z.string()).default([]),
590
- affectedTests: z.array(z.string()).default([]),
591
- affectedFlows: z.array(z.string()).default([]),
592
- affectedComponents: z.array(z.string()).default([]),
593
- summary: z.string()
594
- });
595
- BusinessReviewOutputSchema = z.object({
596
- status: z.enum(["proceed", "defer", "reject"]),
597
- roiEstimate: z.string().optional(),
598
- userImpact: z.string().optional(),
599
- eliminationRisk: z.string().optional(),
600
- questions: z.array(z.string()).default([]),
601
- confidence: z.number().min(0).max(1)
602
- });
603
- VerificationReportSchema = z.object({
604
- taskId: z.string(),
605
- passed: z.boolean(),
606
- checks: z.array(z.object({
607
- name: z.string(),
608
- passed: z.boolean(),
609
- message: z.string()
711
+ quarterlyFocus: z2.string().optional(),
712
+ tradeoffs: z2.array(z2.string()).default([]),
713
+ updatedAt: z2.string()
714
+ });
715
+ ImpactReportSchema = z2.object({
716
+ target: z2.string(),
717
+ brokenEndpoints: z2.array(z2.string()).default([]),
718
+ brokenContracts: z2.array(z2.string()).default([]),
719
+ affectedTests: z2.array(z2.string()).default([]),
720
+ affectedFlows: z2.array(z2.string()).default([]),
721
+ affectedComponents: z2.array(z2.string()).default([]),
722
+ summary: z2.string()
723
+ });
724
+ BusinessReviewOutputSchema = z2.object({
725
+ status: z2.enum(["proceed", "defer", "reject"]),
726
+ roiEstimate: z2.string().optional(),
727
+ userImpact: z2.string().optional(),
728
+ eliminationRisk: z2.string().optional(),
729
+ questions: z2.array(z2.string()).default([]),
730
+ confidence: z2.number().min(0).max(1)
731
+ });
732
+ VerificationReportSchema = z2.object({
733
+ taskId: z2.string(),
734
+ passed: z2.boolean(),
735
+ checks: z2.array(z2.object({
736
+ name: z2.string(),
737
+ passed: z2.boolean(),
738
+ message: z2.string()
610
739
  })),
611
- evidenceIds: z.array(z.string()).default([]),
612
- confidence: z.number().min(0).max(1)
740
+ evidenceIds: z2.array(z2.string()).default([]),
741
+ confidence: z2.number().min(0).max(1)
613
742
  });
614
- BacklogStatusSchema = z.enum([
743
+ BacklogStatusSchema = z2.enum([
615
744
  "TODO",
616
745
  "READY",
617
746
  "PLANNED",
@@ -620,89 +749,89 @@ var init_schemas = __esm(() => {
620
749
  "REVIEW",
621
750
  "DONE"
622
751
  ]);
623
- BacklogTypeSchema = z.enum(["feature", "bug", "refactor", "tech-debt"]);
624
- BacklogPrioritySchema = z.enum(["P0", "P1", "P2", "P3"]);
625
- BacklogGlobalSchema = z.object({
626
- product: z.string().min(1),
627
- strategy: z.string().min(1),
628
- policy: z.string().min(1),
629
- reviewRequired: z.boolean(),
630
- tddRequired: z.boolean()
631
- });
632
- BacklogItemSchema = z.object({
633
- id: z.string().regex(/^BC-\d{3,}$/),
634
- title: z.string().min(1),
752
+ BacklogTypeSchema = z2.enum(["feature", "bug", "refactor", "tech-debt"]);
753
+ BacklogPrioritySchema = z2.enum(["P0", "P1", "P2", "P3"]);
754
+ BacklogGlobalSchema = z2.object({
755
+ product: z2.string().min(1),
756
+ strategy: z2.string().min(1),
757
+ policy: z2.string().min(1),
758
+ reviewRequired: z2.boolean(),
759
+ tddRequired: z2.boolean()
760
+ });
761
+ BacklogItemSchema = z2.object({
762
+ id: z2.string().regex(/^BC-\d{3,}$/),
763
+ title: z2.string().min(1),
635
764
  priority: BacklogPrioritySchema,
636
765
  status: BacklogStatusSchema,
637
766
  type: BacklogTypeSchema,
638
- owner: z.string().optional(),
639
- dependencies: z.array(z.string()).default([]),
640
- description: z.string().min(1),
641
- scope: z.string().min(1),
642
- outOfScope: z.string().default(""),
643
- businessValue: z.string().optional(),
644
- acceptanceCriteria: z.array(z.string().min(1)).min(1),
645
- risks: z.string().optional(),
646
- progress: z.number().int().min(0).max(100),
647
- branch: z.string().optional(),
648
- reviewer: z.string().optional(),
649
- lastUpdate: z.string().optional()
650
- });
651
- BacklogDocumentSchema = z.object({
767
+ owner: z2.string().optional(),
768
+ dependencies: z2.array(z2.string()).default([]),
769
+ description: z2.string().min(1),
770
+ scope: z2.string().min(1),
771
+ outOfScope: z2.string().default(""),
772
+ businessValue: z2.string().optional(),
773
+ acceptanceCriteria: z2.array(z2.string().min(1)).min(1),
774
+ risks: z2.string().optional(),
775
+ progress: z2.number().int().min(0).max(100),
776
+ branch: z2.string().optional(),
777
+ reviewer: z2.string().optional(),
778
+ lastUpdate: z2.string().optional()
779
+ });
780
+ BacklogDocumentSchema = z2.object({
652
781
  global: BacklogGlobalSchema,
653
- items: z.array(BacklogItemSchema),
654
- archive: z.array(BacklogItemSchema).default([])
782
+ items: z2.array(BacklogItemSchema),
783
+ archive: z2.array(BacklogItemSchema).default([])
655
784
  });
656
- OpenspecTaskCardPhaseSchema = z.enum([
785
+ OpenspecTaskCardPhaseSchema = z2.enum([
657
786
  "discover",
658
787
  "design",
659
788
  "implement",
660
789
  "test",
661
790
  "review"
662
791
  ]);
663
- OpenspecTaskCardStatusSchema = z.enum(["pending", "doing", "blocked", "done"]);
664
- OpenspecTaskCardSchema = z.object({
665
- id: z.string(),
666
- backlogId: z.string(),
792
+ OpenspecTaskCardStatusSchema = z2.enum(["pending", "doing", "blocked", "done"]);
793
+ OpenspecTaskCardSchema = z2.object({
794
+ id: z2.string(),
795
+ backlogId: z2.string(),
667
796
  phase: OpenspecTaskCardPhaseSchema,
668
- title: z.string(),
669
- prompt: z.string(),
670
- agent: z.string(),
671
- modelHint: z.string().optional(),
672
- dependsOn: z.array(z.string()).default([]),
673
- acceptanceCriteria: z.array(z.string()),
797
+ title: z2.string(),
798
+ prompt: z2.string(),
799
+ agent: z2.string(),
800
+ modelHint: z2.string().optional(),
801
+ dependsOn: z2.array(z2.string()).default([]),
802
+ acceptanceCriteria: z2.array(z2.string()),
674
803
  status: OpenspecTaskCardStatusSchema,
675
- itemHash: z.string().optional()
676
- });
677
- OpenspecStateSchema = z.object({
678
- version: z.literal(1),
679
- activeItemId: z.string().optional(),
680
- taskCards: z.array(OpenspecTaskCardSchema).default([]),
681
- lastScanHash: z.string().optional(),
682
- lastScanAt: z.string().optional(),
683
- changePaths: z.record(z.string(), z.string()).optional().default({}),
684
- itemSnapshots: z.record(z.string(), z.string()).optional().default({}),
685
- itemBaseCommits: z.record(z.string(), z.string()).optional()
686
- });
687
- SpecAnalyzeFindingSchema = z.object({
688
- severity: z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW"]),
689
- code: z.string(),
690
- message: z.string()
691
- });
692
- SpecAnalyzeReportSchema = z.object({
693
- changePath: z.string(),
694
- frIds: z.array(z.string()),
695
- scIds: z.array(z.string()),
696
- mappedFr: z.array(z.string()),
697
- mappedSc: z.array(z.string()),
698
- mappedToTests: z.array(z.string()),
699
- frCoveragePct: z.number(),
700
- scCoveragePct: z.number(),
701
- testCoveragePct: z.number(),
702
- findings: z.array(SpecAnalyzeFindingSchema),
703
- stop: z.boolean()
704
- });
705
- WorkflowCommandSchema = z.enum([
804
+ itemHash: z2.string().optional()
805
+ });
806
+ OpenspecStateSchema = z2.object({
807
+ version: z2.literal(1),
808
+ activeItemId: z2.string().optional(),
809
+ taskCards: z2.array(OpenspecTaskCardSchema).default([]),
810
+ lastScanHash: z2.string().optional(),
811
+ lastScanAt: z2.string().optional(),
812
+ changePaths: z2.record(z2.string(), z2.string()).optional().default({}),
813
+ itemSnapshots: z2.record(z2.string(), z2.string()).optional().default({}),
814
+ itemBaseCommits: z2.record(z2.string(), z2.string()).optional()
815
+ });
816
+ SpecAnalyzeFindingSchema = z2.object({
817
+ severity: z2.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW"]),
818
+ code: z2.string(),
819
+ message: z2.string()
820
+ });
821
+ SpecAnalyzeReportSchema = z2.object({
822
+ changePath: z2.string(),
823
+ frIds: z2.array(z2.string()),
824
+ scIds: z2.array(z2.string()),
825
+ mappedFr: z2.array(z2.string()),
826
+ mappedSc: z2.array(z2.string()),
827
+ mappedToTests: z2.array(z2.string()),
828
+ frCoveragePct: z2.number(),
829
+ scCoveragePct: z2.number(),
830
+ testCoveragePct: z2.number(),
831
+ findings: z2.array(SpecAnalyzeFindingSchema),
832
+ stop: z2.boolean()
833
+ });
834
+ WorkflowCommandSchema = z2.enum([
706
835
  "feature",
707
836
  "fix",
708
837
  "refactor",
@@ -726,148 +855,149 @@ var init_schemas = __esm(() => {
726
855
  "security",
727
856
  "odd"
728
857
  ]);
729
- CcepOutputFormatSchema = z.enum(["taskcard", "plan", "verdict"]);
730
- CommandEnvelopeSchema = z.object({
731
- protocolVersion: z.literal("ccep-1"),
858
+ CcepOutputFormatSchema = z2.enum(["taskcard", "plan", "verdict"]);
859
+ CommandEnvelopeSchema = z2.object({
860
+ protocolVersion: z2.literal("ccep-1"),
732
861
  command: WorkflowCommandSchema,
733
- userRequest: z.string(),
734
- projectId: z.string(),
735
- repoContext: z.object({
736
- domain: z.string().optional(),
737
- stack: z.array(z.string()),
738
- existingModules: z.array(z.string()).default([]),
739
- architecture: z.string().optional()
862
+ userRequest: z2.string(),
863
+ projectId: z2.string(),
864
+ repoContext: z2.object({
865
+ domain: z2.string().optional(),
866
+ stack: z2.array(z2.string()),
867
+ existingModules: z2.array(z2.string()).default([]),
868
+ architecture: z2.string().optional()
740
869
  }),
741
- constraints: z.object({
870
+ constraints: z2.object({
742
871
  outputFormat: CcepOutputFormatSchema,
743
- needConfirmation: z.boolean(),
744
- riskThreshold: z.enum(["low", "medium", "high"])
872
+ needConfirmation: z2.boolean(),
873
+ riskThreshold: z2.enum(["low", "medium", "high"])
745
874
  }),
746
- executionPolicy: z.object({
747
- modelMode: z.literal("structured"),
748
- maxVariance: z.literal("low")
875
+ executionPolicy: z2.object({
876
+ modelMode: z2.literal("structured"),
877
+ maxVariance: z2.literal("low")
749
878
  })
750
879
  });
751
- WorkflowPhaseSchema = z.object({
752
- id: z.string(),
753
- agent: z.string().optional(),
754
- agents: z.array(z.string()).optional(),
755
- skill: z.string().optional(),
756
- type: z.string().optional(),
757
- outputSchema: z.string().optional(),
758
- stopGate: z.string().optional(),
759
- dependsOn: z.array(z.string()).optional(),
760
- requires: z.string().optional(),
761
- parallelWith: z.array(z.string()).optional()
762
- });
763
- WorkflowRiskRuleSchema = z.object({
764
- when: z.object({
765
- risk: z.union([
766
- z.enum(["low", "medium", "high"]),
767
- z.array(z.enum(["low", "medium", "high"]))
880
+ WorkflowPhaseSchema = z2.object({
881
+ id: z2.string(),
882
+ agent: z2.string().optional(),
883
+ agents: z2.array(z2.string()).optional(),
884
+ skill: z2.string().optional(),
885
+ type: z2.string().optional(),
886
+ outputSchema: z2.string().optional(),
887
+ stopGate: z2.string().optional(),
888
+ dependsOn: z2.array(z2.string()).optional(),
889
+ requires: z2.string().optional(),
890
+ parallelWith: z2.array(z2.string()).optional()
891
+ });
892
+ WorkflowRiskRuleSchema = z2.object({
893
+ when: z2.object({
894
+ risk: z2.union([
895
+ z2.enum(["low", "medium", "high"]),
896
+ z2.array(z2.enum(["low", "medium", "high"]))
768
897
  ])
769
898
  }),
770
- then: z.array(z.string())
899
+ then: z2.array(z2.string())
771
900
  });
772
- WorkflowProfileSchema = z.object({
773
- id: z.string(),
774
- version: z.number().int().positive(),
901
+ WorkflowProfileSchema = z2.object({
902
+ id: z2.string(),
903
+ version: z2.number().int().positive(),
775
904
  command: WorkflowCommandSchema,
776
- taskCard: z.object({
777
- type: z.string(),
778
- requiredFields: z.array(z.string()),
779
- optionalFields: z.array(z.string()).optional()
905
+ taskCard: z2.object({
906
+ type: z2.string(),
907
+ requiredFields: z2.array(z2.string()),
908
+ optionalFields: z2.array(z2.string()).optional()
780
909
  }).optional(),
781
- intakeSchema: z.string().optional(),
782
- phases: z.array(WorkflowPhaseSchema),
783
- routing: z.object({
784
- default: z.array(z.string()),
785
- riskRules: z.array(WorkflowRiskRuleSchema).optional()
910
+ intakeSchema: z2.string().optional(),
911
+ phases: z2.array(WorkflowPhaseSchema),
912
+ routing: z2.object({
913
+ default: z2.array(z2.string()),
914
+ riskRules: z2.array(WorkflowRiskRuleSchema).optional()
786
915
  }),
787
- confirmationGate: z.object({
788
- stopOnHighRisk: z.boolean(),
789
- stopOnQuestions: z.boolean()
916
+ confirmationGate: z2.object({
917
+ stopOnHighRisk: z2.boolean(),
918
+ stopOnQuestions: z2.boolean()
790
919
  })
791
920
  }).refine((profile) => profile.id === profile.command, {
792
921
  message: "Workflow profile id must match command"
793
922
  });
794
- ExecutionContextSchema = z.object({
923
+ ExecutionContextSchema = z2.object({
795
924
  envelope: CommandEnvelopeSchema,
796
925
  profile: WorkflowProfileSchema,
797
- intent: z.object({
926
+ intent: z2.object({
798
927
  type: WorkflowCommandSchema,
799
- goal: z.string(),
800
- domain: z.string().optional(),
801
- entity: z.string().optional(),
802
- operation: z.string().optional()
928
+ goal: z2.string(),
929
+ domain: z2.string().optional(),
930
+ entity: z2.string().optional(),
931
+ operation: z2.string().optional()
803
932
  }),
804
- project: z.object({
805
- name: z.string(),
806
- rootDir: z.string(),
807
- stack: z.array(z.string()).optional()
933
+ project: z2.object({
934
+ name: z2.string(),
935
+ rootDir: z2.string(),
936
+ stack: z2.array(z2.string()).optional()
808
937
  }),
809
- knowledge: z.record(z.string(), z.unknown()).default({}),
810
- ast: z.object({
811
- source: z.enum(["detect", "graphify", "manual", "product-graph"]),
812
- confidence: z.enum(["low", "medium", "high"]),
813
- domains: z.array(z.unknown()).optional(),
814
- rules: z.array(z.string()).optional()
938
+ knowledge: z2.record(z2.string(), z2.unknown()).default({}),
939
+ ast: z2.object({
940
+ source: z2.enum(["detect", "graphify", "manual", "product-graph"]),
941
+ confidence: z2.enum(["low", "medium", "high"]),
942
+ domains: z2.array(z2.unknown()).optional(),
943
+ rules: z2.array(z2.string()).optional()
815
944
  }),
816
- policies: z.object({
817
- architecture: z.string(),
818
- testing: z.string(),
819
- documentation: z.string(),
820
- breakingChanges: z.string()
945
+ policies: z2.object({
946
+ architecture: z2.string(),
947
+ testing: z2.string(),
948
+ documentation: z2.string(),
949
+ breakingChanges: z2.string()
821
950
  }),
822
- currentPhase: z.string().optional(),
823
- outputSchema: z.string()
824
- });
825
- PlannerOutputSchema = z.object({
826
- status: z.enum(["success", "needs_clarification"]),
827
- confidence: z.number().min(0).max(1),
828
- goal: z.string(),
829
- assumptions: z.array(z.string()),
830
- risks: z.array(z.object({
831
- type: z.string(),
832
- description: z.string(),
833
- severity: z.enum(["low", "medium", "high"])
951
+ currentPhase: z2.string().optional(),
952
+ outputSchema: z2.string(),
953
+ scopedContext: ScopedContextSchema.optional()
954
+ });
955
+ PlannerOutputSchema = z2.object({
956
+ status: z2.enum(["success", "needs_clarification"]),
957
+ confidence: z2.number().min(0).max(1),
958
+ goal: z2.string(),
959
+ assumptions: z2.array(z2.string()),
960
+ risks: z2.array(z2.object({
961
+ type: z2.string(),
962
+ description: z2.string(),
963
+ severity: z2.enum(["low", "medium", "high"])
834
964
  })),
835
- tasks: z.array(z.object({
836
- id: z.string(),
837
- title: z.string(),
838
- priority: z.string(),
839
- estimate: z.string(),
840
- dependencies: z.array(z.string())
965
+ tasks: z2.array(z2.object({
966
+ id: z2.string(),
967
+ title: z2.string(),
968
+ priority: z2.string(),
969
+ estimate: z2.string(),
970
+ dependencies: z2.array(z2.string())
841
971
  })),
842
- questionsForUser: z.array(z.string()),
843
- needsConfirmation: z.boolean()
844
- });
845
- AgentArtifactSchema = z.object({
846
- type: z.string(),
847
- path: z.string().optional(),
848
- content: z.string().optional()
849
- });
850
- AgentOutputSchema = z.object({
851
- status: z.enum(["success", "failure", "blocked", "needs_clarification"]),
852
- confidence: z.number().min(0).max(1),
853
- warnings: z.array(z.string()).default([]),
854
- artifacts: z.array(AgentArtifactSchema).default([]),
855
- next_actions: z.array(z.string()).default([])
856
- });
857
- ImplementerTestsSchema = z.object({
858
- runner: z.string(),
859
- result: z.enum(["passed", "failed"]),
860
- failedTests: z.array(z.string()).optional()
972
+ questionsForUser: z2.array(z2.string()),
973
+ needsConfirmation: z2.boolean()
974
+ });
975
+ AgentArtifactSchema = z2.object({
976
+ type: z2.string(),
977
+ path: z2.string().optional(),
978
+ content: z2.string().optional()
979
+ });
980
+ AgentOutputSchema = z2.object({
981
+ status: z2.enum(["success", "failure", "blocked", "needs_clarification"]),
982
+ confidence: z2.number().min(0).max(1),
983
+ warnings: z2.array(z2.string()).default([]),
984
+ artifacts: z2.array(AgentArtifactSchema).default([]),
985
+ next_actions: z2.array(z2.string()).default([])
986
+ });
987
+ ImplementerTestsSchema = z2.object({
988
+ runner: z2.string(),
989
+ result: z2.enum(["passed", "failed"]),
990
+ failedTests: z2.array(z2.string()).optional()
861
991
  });
862
992
  ImplementerOutputSchema = AgentOutputSchema.extend({
863
- status: z.enum(["success", "failure", "blocked"]),
864
- filesChanged: z.array(z.object({
865
- path: z.string(),
866
- summary: z.string()
993
+ status: z2.enum(["success", "failure", "blocked"]),
994
+ filesChanged: z2.array(z2.object({
995
+ path: z2.string(),
996
+ summary: z2.string()
867
997
  })).default([]),
868
998
  tests: ImplementerTestsSchema.optional()
869
999
  });
870
- ReviewAxisSchema = z.enum([
1000
+ ReviewAxisSchema = z2.enum([
871
1001
  "complexity",
872
1002
  "cost",
873
1003
  "performance",
@@ -876,35 +1006,35 @@ var init_schemas = __esm(() => {
876
1006
  "scalability",
877
1007
  "style"
878
1008
  ]);
879
- ReviewFindingSchema = z.object({
880
- severity: z.enum(["CRITICAL", "WARNING", "SUGGESTION"]),
881
- message: z.string(),
882
- axis: z.union([ReviewAxisSchema, z.string()]),
883
- path: z.string().optional(),
884
- line: z.number().int().optional()
885
- });
886
- ReviewerOutputSchema = z.object({
887
- status: z.enum(["pass", "fail"]),
888
- confidence: z.number().min(0).max(1),
889
- verdict: z.enum(["approved", "approved_with_warnings", "blocked"]),
890
- warnings: z.array(z.string()).default([]),
891
- findings: z.array(ReviewFindingSchema).default([]),
892
- artifacts: z.array(AgentArtifactSchema).default([]),
893
- next_actions: z.array(z.string()).default([])
894
- });
895
- TechnicalPlanOutputSchema = z.object({
896
- approach: z.string(),
897
- filesAffected: z.array(z.string()).default([]),
898
- risks: z.array(z.string()).default([]),
899
- openQuestions: z.array(z.string()).optional()
900
- });
901
- FixIntakeOutputSchema = z.object({
902
- actualBehavior: z.string(),
903
- expectedBehavior: z.string(),
904
- reproductionSteps: z.array(z.string())
905
- });
906
- ScorecardVerdictSchema = z.enum(["PASS", "REVISE", "REJECT"]);
907
- ScorecardCriterionIdSchema = z.enum([
1009
+ ReviewFindingSchema = z2.object({
1010
+ severity: z2.enum(["CRITICAL", "WARNING", "SUGGESTION"]),
1011
+ message: z2.string(),
1012
+ axis: z2.union([ReviewAxisSchema, z2.string()]),
1013
+ path: z2.string().optional(),
1014
+ line: z2.number().int().optional()
1015
+ });
1016
+ ReviewerOutputSchema = z2.object({
1017
+ status: z2.enum(["pass", "fail"]),
1018
+ confidence: z2.number().min(0).max(1),
1019
+ verdict: z2.enum(["approved", "approved_with_warnings", "blocked"]),
1020
+ warnings: z2.array(z2.string()).default([]),
1021
+ findings: z2.array(ReviewFindingSchema).default([]),
1022
+ artifacts: z2.array(AgentArtifactSchema).default([]),
1023
+ next_actions: z2.array(z2.string()).default([])
1024
+ });
1025
+ TechnicalPlanOutputSchema = z2.object({
1026
+ approach: z2.string(),
1027
+ filesAffected: z2.array(z2.string()).default([]),
1028
+ risks: z2.array(z2.string()).default([]),
1029
+ openQuestions: z2.array(z2.string()).optional()
1030
+ });
1031
+ FixIntakeOutputSchema = z2.object({
1032
+ actualBehavior: z2.string(),
1033
+ expectedBehavior: z2.string(),
1034
+ reproductionSteps: z2.array(z2.string())
1035
+ });
1036
+ ScorecardVerdictSchema = z2.enum(["PASS", "REVISE", "REJECT"]);
1037
+ ScorecardCriterionIdSchema = z2.enum([
908
1038
  "acceptance",
909
1039
  "minimal_diff",
910
1040
  "tests",
@@ -914,140 +1044,140 @@ var init_schemas = __esm(() => {
914
1044
  "context_discipline",
915
1045
  "cc_gain"
916
1046
  ]);
917
- ScorecardCriterionSchema = z.object({
1047
+ ScorecardCriterionSchema = z2.object({
918
1048
  id: ScorecardCriterionIdSchema,
919
- label: z.string(),
920
- weight: z.number().min(0).max(1),
921
- score: z.number().int().min(0).max(3).nullable(),
922
- unmeasured: z.boolean().optional(),
923
- notes: z.string().optional(),
924
- autoSuggested: z.boolean().optional()
925
- });
926
- ScorecardRecordSchema = z.object({
927
- id: z.string(),
928
- taskId: z.string(),
929
- agent: z.string(),
930
- model: z.string().optional(),
931
- contractVersion: z.string(),
932
- evaluator: z.string().optional(),
933
- criteria: z.array(ScorecardCriterionSchema),
934
- weightedScore: z.number(),
1049
+ label: z2.string(),
1050
+ weight: z2.number().min(0).max(1),
1051
+ score: z2.number().int().min(0).max(3).nullable(),
1052
+ unmeasured: z2.boolean().optional(),
1053
+ notes: z2.string().optional(),
1054
+ autoSuggested: z2.boolean().optional()
1055
+ });
1056
+ ScorecardRecordSchema = z2.object({
1057
+ id: z2.string(),
1058
+ taskId: z2.string(),
1059
+ agent: z2.string(),
1060
+ model: z2.string().optional(),
1061
+ contractVersion: z2.string(),
1062
+ evaluator: z2.string().optional(),
1063
+ criteria: z2.array(ScorecardCriterionSchema),
1064
+ weightedScore: z2.number(),
935
1065
  verdict: ScorecardVerdictSchema,
936
- findings: z.array(z.string()).optional().default([]),
937
- createdAt: z.string(),
938
- backlogId: z.string().optional(),
939
- source: z.enum(["openspec", "review", "manual", "pipeline"]).optional()
1066
+ findings: z2.array(z2.string()).optional().default([]),
1067
+ createdAt: z2.string(),
1068
+ backlogId: z2.string().optional(),
1069
+ source: z2.enum(["openspec", "review", "manual", "pipeline"]).optional()
940
1070
  });
941
- TaskOutcomeSourceSchema = z.enum(["openspec", "review", "manual", "pipeline"]);
942
- TaskOutcomeStatusSchema = z.enum([
1071
+ TaskOutcomeSourceSchema = z2.enum(["openspec", "review", "manual", "pipeline"]);
1072
+ TaskOutcomeStatusSchema = z2.enum([
943
1073
  "phase_done",
944
1074
  "phase_failed",
945
1075
  "pass",
946
1076
  "revise",
947
1077
  "reject"
948
1078
  ]);
949
- DeliveryRouteSchema = z.enum(["read-only", "small", "tracked", "openspec"]);
950
- TokenUsageSchema = z.union([
951
- z.object({
952
- status: z.literal("known"),
953
- total: z.number().nonnegative()
1079
+ DeliveryRouteSchema = z2.enum(["read-only", "small", "tracked", "openspec"]);
1080
+ TokenUsageSchema = z2.union([
1081
+ z2.object({
1082
+ status: z2.literal("known"),
1083
+ total: z2.number().nonnegative()
954
1084
  }),
955
- z.object({ status: z.literal("unknown") })
1085
+ z2.object({ status: z2.literal("unknown") })
956
1086
  ]);
957
- DeliveryTelemetrySchema = z.object({
1087
+ DeliveryTelemetrySchema = z2.object({
958
1088
  route: DeliveryRouteSchema,
959
- contextBytes: z.number().int().nonnegative().optional(),
960
- handoffs: z.number().int().nonnegative().optional(),
961
- checks: z.array(z.string().min(1)).optional(),
1089
+ contextBytes: z2.number().int().nonnegative().optional(),
1090
+ handoffs: z2.number().int().nonnegative().optional(),
1091
+ checks: z2.array(z2.string().min(1)).optional(),
962
1092
  tokenUsage: TokenUsageSchema
963
1093
  });
964
- DeliveryLedgerTaskSchema = z.object({
965
- id: z.string().min(1),
966
- title: z.string().min(1),
967
- status: z.enum(["pending", "done", "blocked"])
1094
+ DeliveryLedgerTaskSchema = z2.object({
1095
+ id: z2.string().min(1),
1096
+ title: z2.string().min(1),
1097
+ status: z2.enum(["pending", "done", "blocked"])
968
1098
  });
969
- DeliveryLedgerSchema = z.object({
970
- version: z.literal(1),
971
- id: z.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),
1099
+ DeliveryLedgerSchema = z2.object({
1100
+ version: z2.literal(1),
1101
+ id: z2.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),
972
1102
  taskCard: CanonicalTaskCardSchema,
973
- tasks: z.array(DeliveryLedgerTaskSchema).min(1),
974
- evidence: z.array(z.string().min(1)),
975
- nextStep: z.string().min(1),
976
- memoryTopicKey: z.string().min(1),
977
- workspace: z.record(z.string(), z.string()),
978
- technicalPlanPath: z.string().min(1).optional(),
979
- createdAt: z.string().datetime(),
980
- updatedAt: z.string().datetime()
981
- });
982
- HandoffEnvelopeSchema = z.object({
983
- version: z.literal(1),
984
- task: z.object({
985
- id: z.string().min(1),
986
- objective: z.string().min(1),
987
- acceptanceCriteria: z.array(z.string().min(1)),
1103
+ tasks: z2.array(DeliveryLedgerTaskSchema).min(1),
1104
+ evidence: z2.array(z2.string().min(1)),
1105
+ nextStep: z2.string().min(1),
1106
+ memoryTopicKey: z2.string().min(1),
1107
+ workspace: z2.record(z2.string(), z2.string()),
1108
+ technicalPlanPath: z2.string().min(1).optional(),
1109
+ createdAt: z2.string().datetime(),
1110
+ updatedAt: z2.string().datetime()
1111
+ });
1112
+ HandoffEnvelopeSchema = z2.object({
1113
+ version: z2.literal(1),
1114
+ task: z2.object({
1115
+ id: z2.string().min(1),
1116
+ objective: z2.string().min(1),
1117
+ acceptanceCriteria: z2.array(z2.string().min(1)),
988
1118
  status: CanonicalTaskCardStatusSchema
989
1119
  }),
990
- decisions: z.object({
991
- constraints: z.array(z.string()),
992
- unresolved: z.array(z.string())
1120
+ decisions: z2.object({
1121
+ constraints: z2.array(z2.string()),
1122
+ unresolved: z2.array(z2.string())
993
1123
  }),
994
- scope: z.object({
995
- relevantFiles: z.array(z.string()),
996
- boundaries: z.array(z.string())
1124
+ scope: z2.object({
1125
+ relevantFiles: z2.array(z2.string()),
1126
+ boundaries: z2.array(z2.string())
997
1127
  }),
998
- verification: z.object({
999
- evidence: z.array(z.string())
1128
+ verification: z2.object({
1129
+ evidence: z2.array(z2.string())
1000
1130
  }),
1001
- change: z.object({
1002
- touchedFiles: z.array(z.string())
1131
+ change: z2.object({
1132
+ touchedFiles: z2.array(z2.string())
1003
1133
  }),
1004
- next: z.object({
1005
- role: z.string().min(1),
1006
- objective: z.string().min(1)
1134
+ next: z2.object({
1135
+ role: z2.string().min(1),
1136
+ objective: z2.string().min(1)
1007
1137
  }),
1008
- sources: z.object({
1009
- deliveryLedger: z.string().min(1),
1010
- memoryTopicKey: z.string().min(1),
1011
- technicalPlanPath: z.string().min(1).optional()
1138
+ sources: z2.object({
1139
+ deliveryLedger: z2.string().min(1),
1140
+ memoryTopicKey: z2.string().min(1),
1141
+ technicalPlanPath: z2.string().min(1).optional()
1012
1142
  })
1013
1143
  });
1014
- RepoRelativePathSchema = z.string().min(1).refine((path) => !/^([/\\]|[A-Za-z]:)/.test(path) && !path.split(/[/\\]/).includes(".."), 'Path must be relative to the repository and must not contain ".." segments');
1015
- DeliveryLedgerRequestSchema = z.object({
1016
- id: z.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),
1017
- authorized: z.boolean(),
1144
+ RepoRelativePathSchema = z2.string().min(1).refine((path) => !/^([/\\]|[A-Za-z]:)/.test(path) && !path.split(/[/\\]/).includes(".."), 'Path must be relative to the repository and must not contain ".." segments');
1145
+ DeliveryLedgerRequestSchema = z2.object({
1146
+ id: z2.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),
1147
+ authorized: z2.boolean(),
1018
1148
  route: DeliveryRouteSchema,
1019
1149
  taskCard: CanonicalTaskCardSchema,
1020
- tasks: z.array(DeliveryLedgerTaskSchema).min(1),
1021
- nextStep: z.string().min(1),
1150
+ tasks: z2.array(DeliveryLedgerTaskSchema).min(1),
1151
+ nextStep: z2.string().min(1),
1022
1152
  technicalPlanPath: RepoRelativePathSchema.optional()
1023
1153
  });
1024
- TaskOutcomeSchema = z.object({
1025
- id: z.string(),
1026
- taskId: z.string(),
1154
+ TaskOutcomeSchema = z2.object({
1155
+ id: z2.string(),
1156
+ taskId: z2.string(),
1027
1157
  source: TaskOutcomeSourceSchema,
1028
- agent: z.string(),
1029
- model: z.string(),
1030
- contractVersion: z.string(),
1031
- timestamp: z.string(),
1158
+ agent: z2.string(),
1159
+ model: z2.string(),
1160
+ contractVersion: z2.string(),
1161
+ timestamp: z2.string(),
1032
1162
  status: TaskOutcomeStatusSchema.optional(),
1033
1163
  verdict: ScorecardVerdictSchema.optional(),
1034
- weightedScore: z.number().optional(),
1035
- taskCardId: z.string().optional(),
1036
- backlogId: z.string().optional(),
1037
- phase: z.string().optional(),
1038
- scorecardId: z.string().optional(),
1039
- tokensIn: z.number().optional(),
1040
- tokensOut: z.number().optional(),
1041
- costUsd: z.number().optional(),
1042
- durationMs: z.number().optional(),
1043
- experimentId: z.string().optional(),
1044
- variantId: z.string().optional(),
1045
- suiteTaskId: z.string().optional(),
1046
- harnessFingerprint: z.string().optional(),
1047
- disabledComponents: z.array(z.string()).optional(),
1164
+ weightedScore: z2.number().optional(),
1165
+ taskCardId: z2.string().optional(),
1166
+ backlogId: z2.string().optional(),
1167
+ phase: z2.string().optional(),
1168
+ scorecardId: z2.string().optional(),
1169
+ tokensIn: z2.number().optional(),
1170
+ tokensOut: z2.number().optional(),
1171
+ costUsd: z2.number().optional(),
1172
+ durationMs: z2.number().optional(),
1173
+ experimentId: z2.string().optional(),
1174
+ variantId: z2.string().optional(),
1175
+ suiteTaskId: z2.string().optional(),
1176
+ harnessFingerprint: z2.string().optional(),
1177
+ disabledComponents: z2.array(z2.string()).optional(),
1048
1178
  delivery: DeliveryTelemetrySchema.optional()
1049
1179
  });
1050
- HarnessComponentIdSchema = z.enum([
1180
+ HarnessComponentIdSchema = z2.enum([
1051
1181
  "wayfinding",
1052
1182
  "intake",
1053
1183
  "design",
@@ -1059,86 +1189,86 @@ var init_schemas = __esm(() => {
1059
1189
  "council",
1060
1190
  "product_graph"
1061
1191
  ]);
1062
- HarnessComponentLayerSchema = z.enum([
1192
+ HarnessComponentLayerSchema = z2.enum([
1063
1193
  "phase",
1064
1194
  "gate",
1065
1195
  "loop",
1066
1196
  "knowledge",
1067
1197
  "council"
1068
1198
  ]);
1069
- HarnessToggleKindSchema = z.enum([
1199
+ HarnessToggleKindSchema = z2.enum([
1070
1200
  "ccep_phase",
1071
1201
  "ccep_gates",
1072
1202
  "config_loop",
1073
1203
  "config_council",
1074
1204
  "product_graph"
1075
1205
  ]);
1076
- HarnessCatalogEntrySchema = z.object({
1206
+ HarnessCatalogEntrySchema = z2.object({
1077
1207
  id: HarnessComponentIdSchema,
1078
1208
  layer: HarnessComponentLayerSchema,
1079
- label: z.string(),
1080
- defaultOn: z.boolean().default(true),
1081
- toggle: z.object({
1209
+ label: z2.string(),
1210
+ defaultOn: z2.boolean().default(true),
1211
+ toggle: z2.object({
1082
1212
  kind: HarnessToggleKindSchema,
1083
- phaseId: z.string().optional()
1213
+ phaseId: z2.string().optional()
1084
1214
  })
1085
1215
  });
1086
- HarnessCatalogSchema = z.object({
1087
- version: z.literal(1),
1088
- components: z.array(HarnessCatalogEntrySchema).min(1)
1089
- });
1090
- HarnessOverlaySchema = z.object({
1091
- experimentId: z.string().optional(),
1092
- variantId: z.string(),
1093
- disabledComponents: z.array(HarnessComponentIdSchema),
1094
- disableProductGraph: z.boolean().optional().default(false),
1095
- contractVersion: z.string().optional(),
1096
- ccepProfile: z.string().optional().default("feature")
1097
- });
1098
- HarnessExperimentSchema = z.object({
1099
- id: z.string(),
1100
- suiteId: z.string(),
1101
- createdAt: z.string(),
1102
- contractVersion: z.string(),
1103
- components: z.array(HarnessComponentIdSchema),
1104
- variants: z.array(z.string()).min(1),
1105
- suiteTaskIds: z.array(z.string()),
1106
- suitePath: z.string().optional()
1107
- });
1108
- HarnessSuiteTaskSchema = z.object({
1109
- id: z.string(),
1110
- title: z.string(),
1111
- type: z.enum(["feature", "fix", "refactor"]),
1112
- risk: z.enum(["low", "medium", "high"]).default("low"),
1113
- prompt: z.string(),
1114
- scope: z.string(),
1115
- acceptanceCriteria: z.array(z.string()).min(1),
1116
- testCommand: z.string().optional()
1117
- });
1118
- HarnessSuiteSchema = z.object({
1119
- id: z.string(),
1120
- version: z.number().int().positive(),
1121
- fixtureDir: z.string().optional(),
1122
- tasks: z.array(HarnessSuiteTaskSchema).min(1)
1123
- });
1124
- EvaluationIndexSchema = z.object({
1125
- version: z.literal(1),
1126
- lastOutcomeId: z.string().optional()
1127
- });
1128
- ExecutionProfileNameSchema = z.enum(["balanced", "quality", "economical"]);
1129
- ExecutionProfileSchema = z.object({
1216
+ HarnessCatalogSchema = z2.object({
1217
+ version: z2.literal(1),
1218
+ components: z2.array(HarnessCatalogEntrySchema).min(1)
1219
+ });
1220
+ HarnessOverlaySchema = z2.object({
1221
+ experimentId: z2.string().optional(),
1222
+ variantId: z2.string(),
1223
+ disabledComponents: z2.array(HarnessComponentIdSchema),
1224
+ disableProductGraph: z2.boolean().optional().default(false),
1225
+ contractVersion: z2.string().optional(),
1226
+ ccepProfile: z2.string().optional().default("feature")
1227
+ });
1228
+ HarnessExperimentSchema = z2.object({
1229
+ id: z2.string(),
1230
+ suiteId: z2.string(),
1231
+ createdAt: z2.string(),
1232
+ contractVersion: z2.string(),
1233
+ components: z2.array(HarnessComponentIdSchema),
1234
+ variants: z2.array(z2.string()).min(1),
1235
+ suiteTaskIds: z2.array(z2.string()),
1236
+ suitePath: z2.string().optional()
1237
+ });
1238
+ HarnessSuiteTaskSchema = z2.object({
1239
+ id: z2.string(),
1240
+ title: z2.string(),
1241
+ type: z2.enum(["feature", "fix", "refactor"]),
1242
+ risk: z2.enum(["low", "medium", "high"]).default("low"),
1243
+ prompt: z2.string(),
1244
+ scope: z2.string(),
1245
+ acceptanceCriteria: z2.array(z2.string()).min(1),
1246
+ testCommand: z2.string().optional()
1247
+ });
1248
+ HarnessSuiteSchema = z2.object({
1249
+ id: z2.string(),
1250
+ version: z2.number().int().positive(),
1251
+ fixtureDir: z2.string().optional(),
1252
+ tasks: z2.array(HarnessSuiteTaskSchema).min(1)
1253
+ });
1254
+ EvaluationIndexSchema = z2.object({
1255
+ version: z2.literal(1),
1256
+ lastOutcomeId: z2.string().optional()
1257
+ });
1258
+ ExecutionProfileNameSchema = z2.enum(["balanced", "quality", "economical"]);
1259
+ ExecutionProfileSchema = z2.object({
1130
1260
  profile: ExecutionProfileNameSchema.default("balanced"),
1131
- target: z.enum(INDIVIDUAL_TARGETS).optional(),
1132
- overrides: z.record(z.string(), z.string()).optional().default({}),
1133
- subagentPolicy: z.object({
1134
- orchestrator: z.enum(["primary", "delegate"]).optional(),
1135
- testerReviewer: z.enum(["primary", "delegate"]).optional()
1261
+ target: z2.enum(INDIVIDUAL_TARGETS).optional(),
1262
+ overrides: z2.record(z2.string(), z2.string()).optional().default({}),
1263
+ subagentPolicy: z2.object({
1264
+ orchestrator: z2.enum(["primary", "delegate"]).optional(),
1265
+ testerReviewer: z2.enum(["primary", "delegate"]).optional()
1136
1266
  }).optional()
1137
1267
  });
1138
- SkillsRegistrySchema = z.object({
1139
- version: z.literal(1),
1140
- skills: z.record(z.string().min(1).regex(/^[a-z0-9\-]+$/), z.object({
1141
- version: z.string().min(1)
1268
+ SkillsRegistrySchema = z2.object({
1269
+ version: z2.literal(1),
1270
+ skills: z2.record(z2.string().min(1).regex(/^[a-z0-9\-]+$/), z2.object({
1271
+ version: z2.string().min(1)
1142
1272
  }))
1143
1273
  });
1144
1274
  });
@@ -3261,6 +3391,7 @@ async function runLoopForProject(projectRoot, options) {
3261
3391
 
3262
3392
  // src/index.ts
3263
3393
  init_schemas();
3394
+ init_scoped_context_schemas();
3264
3395
  export {
3265
3396
  AgentArtifactSchema,
3266
3397
  AgentContractSchema,
@@ -3282,6 +3413,7 @@ export {
3282
3413
  CompileCheckConfigSchema,
3283
3414
  ConfidenceLevelSchema,
3284
3415
  ConsensusConfigSchema,
3416
+ ContextManifestSchema,
3285
3417
  ContractFormatSchema,
3286
3418
  ContractTargetSchema,
3287
3419
  CouncilAgentSpecSchema,
@@ -3295,6 +3427,8 @@ export {
3295
3427
  DeliveryLedgerTaskSchema,
3296
3428
  DeliveryRouteSchema,
3297
3429
  DeliveryTelemetrySchema,
3430
+ DependencyEvidenceSchema,
3431
+ DetectionStatusSchema,
3298
3432
  EvaluationIndexSchema,
3299
3433
  EvidenceSchema,
3300
3434
  ExecutionContextSchema,
@@ -3332,6 +3466,7 @@ export {
3332
3466
  OpenspecTaskCardSchema,
3333
3467
  OpenspecTaskCardStatusSchema,
3334
3468
  OperationalStateSchema,
3469
+ OriginClassSchema,
3335
3470
  PermissionProviderNamesSchema,
3336
3471
  PlannerOutputSchema,
3337
3472
  ProductEventSchema,
@@ -3342,10 +3477,18 @@ export {
3342
3477
  ProductMetaSchema,
3343
3478
  ProductNodeTypeSchema,
3344
3479
  ProjectProfileSchema,
3480
+ ProjectScopeProfileSchema,
3481
+ RecipeStatusSchema,
3482
+ RecipeStepSchema,
3345
3483
  ReviewAxisSchema,
3346
3484
  ReviewFindingSchema,
3347
3485
  ReviewerOutputSchema,
3486
+ RuleKindSchema,
3487
+ RuleViewSchema,
3348
3488
  RunnerTargetSchema,
3489
+ ScopedContextSchema,
3490
+ ScopedRuleFileSchema,
3491
+ ScopedRuleSchema,
3349
3492
  ScorecardCriterionIdSchema,
3350
3493
  ScorecardCriterionSchema,
3351
3494
  ScorecardRecordSchema,
@@ -3365,6 +3508,7 @@ export {
3365
3508
  TechnicalPlanOutputSchema,
3366
3509
  TokenUsageSchema,
3367
3510
  ToolProviderNamesSchema,
3511
+ VerificationRecipeSchema,
3368
3512
  VerificationReportSchema,
3369
3513
  WorkflowCommandSchema,
3370
3514
  WorkflowPhaseSchema,