cc-codeconductor 1.7.1 → 1.8.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.
- package/README.md +6 -6
- package/dist/core/goal/goal-state.d.ts +18 -0
- package/dist/core/hooks/hook-runner.d.ts +75 -0
- package/dist/core/orchestrator/runtime-orchestrator.d.ts +11 -3
- package/dist/core/telemetry/hook-telemetry.d.ts +55 -0
- package/dist/core/telemetry/schema.d.ts +94 -0
- package/dist/core/telemetry/store.d.ts +43 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8527 -1109
- package/dist/library.js +1462 -738
- package/dist/validation/schemas.d.ts +927 -146
- package/dist/validation/scoped-context-schemas.d.ts +1074 -0
- package/docs/generated/cli.md +11 -1
- package/package.json +5 -2
- package/presets/agy/scripts/invoke-hook.cjs +15 -2
- package/presets/agy/skills/database-migrations/SKILL.md +64 -0
- package/presets/agy/skills/rust-async/SKILL.md +64 -0
- package/presets/agy/skills/rust-engineering/SKILL.md +69 -0
- package/presets/agy/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/claude/settings.json +34 -8
- package/presets/claude/skills/database-migrations/SKILL.md +64 -0
- package/presets/claude/skills/rust-async/SKILL.md +64 -0
- package/presets/claude/skills/rust-engineering/SKILL.md +69 -0
- package/presets/claude/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/codex/skills/database-migrations/SKILL.md +64 -0
- package/presets/codex/skills/rust-async/SKILL.md +64 -0
- package/presets/codex/skills/rust-engineering/SKILL.md +69 -0
- package/presets/codex/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/cursor/skills/database-migrations/SKILL.md +64 -0
- package/presets/cursor/skills/rust-async/SKILL.md +64 -0
- package/presets/cursor/skills/rust-engineering/SKILL.md +69 -0
- package/presets/cursor/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/opencode/skills/database-migrations/SKILL.md +64 -0
- package/presets/opencode/skills/rust-async/SKILL.md +64 -0
- package/presets/opencode/skills/rust-engineering/SKILL.md +69 -0
- package/presets/opencode/skills/rust-sqlx/SKILL.md +64 -0
- package/presets/shared/invoke-hook.cjs +15 -2
- package/pricing/pricing.v1.json +130 -0
- package/schemas/harness-telemetry.v1.json +239 -0
- 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;
|
|
@@ -156,14 +283,15 @@ function validateProductEvent(data) {
|
|
|
156
283
|
function validateSkillsRegistry(data) {
|
|
157
284
|
return SkillsRegistrySchema.parse(data);
|
|
158
285
|
}
|
|
159
|
-
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;
|
|
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, CodeIndexSymbolSchema, CodeIndexSchema, 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, EdgeCaseSchema, 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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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:
|
|
175
|
-
});
|
|
176
|
-
CouncilSpecSchema =
|
|
177
|
-
name:
|
|
178
|
-
version:
|
|
179
|
-
description:
|
|
180
|
-
outputContract:
|
|
181
|
-
agents:
|
|
182
|
-
});
|
|
183
|
-
ProjectProfileSchema =
|
|
184
|
-
rootDir:
|
|
185
|
-
languages:
|
|
186
|
-
runtimes:
|
|
187
|
-
packageManagers:
|
|
188
|
-
frameworks:
|
|
189
|
-
signals:
|
|
190
|
-
confidence:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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 =
|
|
207
|
-
version:
|
|
208
|
-
project:
|
|
209
|
-
name:
|
|
210
|
-
profile:
|
|
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:
|
|
213
|
-
target:
|
|
214
|
-
overwrite:
|
|
215
|
-
locale:
|
|
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:
|
|
218
|
-
council:
|
|
219
|
-
enabled:
|
|
220
|
-
version:
|
|
346
|
+
presets: z2.object({
|
|
347
|
+
council: z2.object({
|
|
348
|
+
enabled: z2.boolean(),
|
|
349
|
+
version: z2.string()
|
|
221
350
|
})
|
|
222
351
|
}),
|
|
223
|
-
safety:
|
|
224
|
-
destructiveCommands:
|
|
225
|
-
secretPatterns:
|
|
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 =
|
|
231
|
-
InstallStrategySchema =
|
|
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 =
|
|
368
|
+
ContainedRelativePathSchema = z2.string().refine(isContainedRelativePath, (value) => ({
|
|
240
369
|
message: `Path must be relative without ".." segments: ${value}`
|
|
241
370
|
}));
|
|
242
|
-
ManifestEntrySchema =
|
|
371
|
+
ManifestEntrySchema = z2.object({
|
|
243
372
|
src: ContainedRelativePathSchema,
|
|
244
373
|
dest: ContainedRelativePathSchema,
|
|
245
374
|
strategy: InstallStrategySchema,
|
|
246
375
|
globalStrategy: InstallStrategySchema.optional(),
|
|
247
|
-
template:
|
|
248
|
-
});
|
|
249
|
-
InstallManifestSchema =
|
|
250
|
-
target:
|
|
251
|
-
entries:
|
|
252
|
-
});
|
|
253
|
-
ToolProviderNamesSchema =
|
|
254
|
-
PermissionProviderNamesSchema =
|
|
255
|
-
ModelConfigSchema =
|
|
256
|
-
target:
|
|
257
|
-
agents:
|
|
258
|
-
claude:
|
|
259
|
-
opencode:
|
|
260
|
-
codex:
|
|
261
|
-
gemini:
|
|
262
|
-
cursor:
|
|
263
|
-
agy:
|
|
264
|
-
pi:
|
|
265
|
-
grok:
|
|
266
|
-
muse:
|
|
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:
|
|
397
|
+
tools: z2.record(z2.string(), ToolProviderNamesSchema).optional(),
|
|
269
398
|
permissions: PermissionProviderNamesSchema.optional()
|
|
270
399
|
});
|
|
271
|
-
SkillFrontmatterSchema =
|
|
272
|
-
name:
|
|
273
|
-
description:
|
|
274
|
-
id:
|
|
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 =
|
|
277
|
-
description:
|
|
278
|
-
"argument-hint":
|
|
279
|
-
"allowed-tools":
|
|
280
|
-
model:
|
|
281
|
-
"disable-model-invocation":
|
|
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 =
|
|
284
|
-
target:
|
|
285
|
-
invocation:
|
|
286
|
-
commandFormat:
|
|
287
|
-
contextFile:
|
|
288
|
-
subagentInvocationStyle:
|
|
289
|
-
capabilities:
|
|
290
|
-
subagents:
|
|
291
|
-
hooks:
|
|
292
|
-
mcp:
|
|
293
|
-
council:
|
|
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 =
|
|
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 =
|
|
433
|
+
ContractFormatSchema = z2.object({
|
|
305
434
|
target: ContractTargetSchema,
|
|
306
|
-
options:
|
|
435
|
+
options: z2.record(z2.unknown()).optional()
|
|
307
436
|
});
|
|
308
|
-
AgentContractSchema =
|
|
437
|
+
AgentContractSchema = z2.object({
|
|
309
438
|
council: CouncilSpecSchema,
|
|
310
|
-
targets:
|
|
311
|
-
contractVersion:
|
|
312
|
-
renderHints:
|
|
313
|
-
});
|
|
314
|
-
CouncilFindingSchema =
|
|
315
|
-
category:
|
|
316
|
-
severity:
|
|
317
|
-
message:
|
|
318
|
-
agentId:
|
|
319
|
-
});
|
|
320
|
-
CouncilVerdictInputSchema =
|
|
321
|
-
agentId:
|
|
322
|
-
agentRole:
|
|
323
|
-
status:
|
|
324
|
-
securityVeto:
|
|
325
|
-
complianceVeto:
|
|
326
|
-
confidence:
|
|
327
|
-
findings:
|
|
328
|
-
summary:
|
|
329
|
-
candidateHash:
|
|
330
|
-
});
|
|
331
|
-
ConsensusConfigSchema =
|
|
332
|
-
algorithm:
|
|
333
|
-
allowSecurityVeto:
|
|
334
|
-
allowComplianceVeto:
|
|
335
|
-
expectedAgentIds:
|
|
336
|
-
quorum:
|
|
337
|
-
criticalFindingsPolicy:
|
|
338
|
-
candidateHash:
|
|
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,90 @@ var init_schemas = __esm(() => {
|
|
|
343
472
|
message: "allowSecurityVeto requires at least one security agent in expectedAgentIds",
|
|
344
473
|
path: ["expectedAgentIds"]
|
|
345
474
|
});
|
|
346
|
-
CouncilVerdictSchema =
|
|
347
|
-
status:
|
|
348
|
-
totalAgents:
|
|
349
|
-
approvedCount:
|
|
350
|
-
rejectedCount:
|
|
351
|
-
abstainedCount:
|
|
352
|
-
vetoApplied:
|
|
353
|
-
complianceVetoApplied:
|
|
354
|
-
vetoByAgentId:
|
|
355
|
-
averageConfidence:
|
|
356
|
-
findings:
|
|
357
|
-
summary:
|
|
358
|
-
individualVerdicts:
|
|
359
|
-
});
|
|
360
|
-
ClaudeAgentFileSchema =
|
|
361
|
-
path:
|
|
362
|
-
content:
|
|
363
|
-
overwrite:
|
|
364
|
-
});
|
|
365
|
-
OpenCodeAgentFileSchema =
|
|
366
|
-
path:
|
|
367
|
-
content:
|
|
368
|
-
overwrite:
|
|
369
|
-
});
|
|
370
|
-
SentryStackFrameSchema =
|
|
371
|
-
filename:
|
|
372
|
-
function:
|
|
373
|
-
lineNo:
|
|
374
|
-
colNo:
|
|
375
|
-
context:
|
|
376
|
-
});
|
|
377
|
-
SentryWebhookSchema =
|
|
378
|
-
issueId:
|
|
379
|
-
title:
|
|
380
|
-
culprit:
|
|
381
|
-
filename:
|
|
382
|
-
stackTrace:
|
|
383
|
-
environment:
|
|
384
|
-
release:
|
|
385
|
-
});
|
|
386
|
-
MemoryPointerSchema =
|
|
387
|
-
topic_key:
|
|
388
|
-
id:
|
|
389
|
-
file:
|
|
390
|
-
summary:
|
|
391
|
-
timestamp:
|
|
392
|
-
tags:
|
|
393
|
-
});
|
|
394
|
-
MemoryIndexSchema =
|
|
395
|
-
version:
|
|
396
|
-
pointers:
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
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
|
+
CodeIndexSymbolSchema = z2.object({
|
|
528
|
+
name: z2.string().min(1),
|
|
529
|
+
kind: z2.enum(["function", "class", "interface", "type", "const"]),
|
|
530
|
+
startLine: z2.number().int().positive(),
|
|
531
|
+
endLine: z2.number().int().positive()
|
|
532
|
+
});
|
|
533
|
+
CodeIndexSchema = z2.object({
|
|
534
|
+
version: z2.literal(1),
|
|
535
|
+
generatedAt: z2.string(),
|
|
536
|
+
files: z2.record(z2.string(), z2.array(CodeIndexSymbolSchema))
|
|
537
|
+
});
|
|
538
|
+
GoalTaskSchema = z2.object({
|
|
539
|
+
id: z2.string(),
|
|
540
|
+
title: z2.string(),
|
|
541
|
+
type: z2.enum(["feature", "fix", "refactor", "test", "docs"]),
|
|
542
|
+
risk: z2.enum(["low", "medium", "high"]),
|
|
543
|
+
priority: z2.enum(["P0", "P1", "P2", "P3"]).optional(),
|
|
544
|
+
status: z2.enum(["pending", "in-progress", "done", "blocked"]),
|
|
545
|
+
depends_on: z2.array(z2.string()).optional().default([]),
|
|
546
|
+
acceptance_criteria: z2.array(z2.string()),
|
|
547
|
+
blocked_reason: z2.string().optional(),
|
|
548
|
+
context_scope: z2.enum(["isolated", "continuation", "full"]).optional().default("isolated"),
|
|
549
|
+
consecutive_failures: z2.number().int().nonnegative().optional(),
|
|
550
|
+
frozen: z2.boolean().optional()
|
|
551
|
+
});
|
|
552
|
+
GoalGraphSchema = z2.object({
|
|
553
|
+
objective: z2.string(),
|
|
554
|
+
tasks: z2.array(GoalTaskSchema),
|
|
555
|
+
created_at: z2.string()
|
|
556
|
+
});
|
|
557
|
+
ConfidenceLevelSchema = z2.enum(["low", "medium", "high"]);
|
|
558
|
+
ProductNodeTypeSchema = z2.enum([
|
|
417
559
|
"product",
|
|
418
560
|
"domain",
|
|
419
561
|
"capability",
|
|
@@ -427,7 +569,7 @@ var init_schemas = __esm(() => {
|
|
|
427
569
|
"task",
|
|
428
570
|
"evidence"
|
|
429
571
|
]);
|
|
430
|
-
GraphRelationSchema =
|
|
572
|
+
GraphRelationSchema = z2.enum([
|
|
431
573
|
"implements",
|
|
432
574
|
"depends_on",
|
|
433
575
|
"documents",
|
|
@@ -436,51 +578,51 @@ var init_schemas = __esm(() => {
|
|
|
436
578
|
"blocks",
|
|
437
579
|
"contains"
|
|
438
580
|
]);
|
|
439
|
-
KnowledgeEntitySchema =
|
|
581
|
+
KnowledgeEntitySchema = z2.object({
|
|
440
582
|
type: ProductNodeTypeSchema,
|
|
441
|
-
id:
|
|
442
|
-
name:
|
|
443
|
-
source:
|
|
444
|
-
version:
|
|
583
|
+
id: z2.string(),
|
|
584
|
+
name: z2.string(),
|
|
585
|
+
source: z2.string(),
|
|
586
|
+
version: z2.string().optional(),
|
|
445
587
|
confidence: ConfidenceLevelSchema,
|
|
446
|
-
relations:
|
|
447
|
-
targetId:
|
|
588
|
+
relations: z2.array(z2.object({
|
|
589
|
+
targetId: z2.string(),
|
|
448
590
|
relation: GraphRelationSchema
|
|
449
591
|
})).default([]),
|
|
450
|
-
data:
|
|
451
|
-
});
|
|
452
|
-
DecisionSchema =
|
|
453
|
-
id:
|
|
454
|
-
context:
|
|
455
|
-
alternatives:
|
|
456
|
-
chosenOption:
|
|
457
|
-
rationale:
|
|
458
|
-
consequences:
|
|
459
|
-
date:
|
|
460
|
-
linkedTasks:
|
|
461
|
-
linkedComponents:
|
|
462
|
-
source:
|
|
463
|
-
});
|
|
464
|
-
EvidenceSchema =
|
|
465
|
-
id:
|
|
466
|
-
source:
|
|
467
|
-
type:
|
|
468
|
-
timestamp:
|
|
469
|
-
relatedTask:
|
|
470
|
-
relatedDecision:
|
|
471
|
-
confidence:
|
|
472
|
-
checksum:
|
|
473
|
-
summary:
|
|
474
|
-
data:
|
|
475
|
-
});
|
|
476
|
-
TddValidationRecordSchema =
|
|
477
|
-
taskId:
|
|
478
|
-
evidenceId:
|
|
479
|
-
receiptNonce:
|
|
480
|
-
manifestHash:
|
|
481
|
-
validatedAt:
|
|
592
|
+
data: z2.record(z2.string(), z2.unknown()).optional().default({})
|
|
593
|
+
});
|
|
594
|
+
DecisionSchema = z2.object({
|
|
595
|
+
id: z2.string(),
|
|
596
|
+
context: z2.string(),
|
|
597
|
+
alternatives: z2.array(z2.string()).default([]),
|
|
598
|
+
chosenOption: z2.string(),
|
|
599
|
+
rationale: z2.string(),
|
|
600
|
+
consequences: z2.array(z2.string()).default([]),
|
|
601
|
+
date: z2.string(),
|
|
602
|
+
linkedTasks: z2.array(z2.string()).default([]),
|
|
603
|
+
linkedComponents: z2.array(z2.string()).default([]),
|
|
604
|
+
source: z2.string().optional()
|
|
605
|
+
});
|
|
606
|
+
EvidenceSchema = z2.object({
|
|
607
|
+
id: z2.string(),
|
|
608
|
+
source: z2.string(),
|
|
609
|
+
type: z2.string(),
|
|
610
|
+
timestamp: z2.string(),
|
|
611
|
+
relatedTask: z2.string().optional(),
|
|
612
|
+
relatedDecision: z2.string().optional(),
|
|
613
|
+
confidence: z2.number().min(0).max(1),
|
|
614
|
+
checksum: z2.string().optional(),
|
|
615
|
+
summary: z2.string().optional(),
|
|
616
|
+
data: z2.record(z2.string(), z2.unknown()).optional()
|
|
617
|
+
});
|
|
618
|
+
TddValidationRecordSchema = z2.object({
|
|
619
|
+
taskId: z2.string().min(1),
|
|
620
|
+
evidenceId: z2.string().min(1),
|
|
621
|
+
receiptNonce: z2.string().regex(/^[0-9a-f]{32}$/),
|
|
622
|
+
manifestHash: z2.string().regex(/^[0-9a-f]{64}$/),
|
|
623
|
+
validatedAt: z2.string().datetime()
|
|
482
624
|
}).strict();
|
|
483
|
-
CanonicalTaskCardStatusSchema =
|
|
625
|
+
CanonicalTaskCardStatusSchema = z2.enum([
|
|
484
626
|
"draft",
|
|
485
627
|
"ready",
|
|
486
628
|
"in-progress",
|
|
@@ -488,60 +630,60 @@ var init_schemas = __esm(() => {
|
|
|
488
630
|
"done",
|
|
489
631
|
"blocked"
|
|
490
632
|
]);
|
|
491
|
-
CanonicalTaskCardSchema =
|
|
492
|
-
id:
|
|
493
|
-
title:
|
|
494
|
-
objective:
|
|
495
|
-
context:
|
|
496
|
-
acceptanceCriteria:
|
|
497
|
-
dependencies:
|
|
498
|
-
constraints:
|
|
499
|
-
risk:
|
|
500
|
-
targetFiles:
|
|
501
|
-
agentType:
|
|
502
|
-
evidenceRequired:
|
|
633
|
+
CanonicalTaskCardSchema = z2.object({
|
|
634
|
+
id: z2.string(),
|
|
635
|
+
title: z2.string(),
|
|
636
|
+
objective: z2.string(),
|
|
637
|
+
context: z2.string(),
|
|
638
|
+
acceptanceCriteria: z2.array(z2.string()),
|
|
639
|
+
dependencies: z2.array(z2.string()).default([]),
|
|
640
|
+
constraints: z2.array(z2.string()).default([]),
|
|
641
|
+
risk: z2.enum(["low", "medium", "high"]),
|
|
642
|
+
targetFiles: z2.array(z2.string()).default([]),
|
|
643
|
+
agentType: z2.string(),
|
|
644
|
+
evidenceRequired: z2.array(z2.string()).default([]),
|
|
503
645
|
status: CanonicalTaskCardStatusSchema,
|
|
504
|
-
type:
|
|
505
|
-
linkedCapabilities:
|
|
506
|
-
boundaries:
|
|
507
|
-
requiresHumanReview:
|
|
508
|
-
requiresTests:
|
|
509
|
-
contextScope:
|
|
510
|
-
actualBehavior:
|
|
511
|
-
expectedBehavior:
|
|
512
|
-
reproductionSteps:
|
|
513
|
-
domain:
|
|
514
|
-
authorization:
|
|
515
|
-
});
|
|
516
|
-
ProductGraphNodeSchema =
|
|
517
|
-
id:
|
|
646
|
+
type: z2.enum(["feature", "fix", "refactor", "review", "docs", "test"]),
|
|
647
|
+
linkedCapabilities: z2.array(z2.string()).default([]),
|
|
648
|
+
boundaries: z2.array(z2.string()).default([]),
|
|
649
|
+
requiresHumanReview: z2.boolean().optional(),
|
|
650
|
+
requiresTests: z2.boolean().optional(),
|
|
651
|
+
contextScope: z2.enum(["isolated", "continuation", "full"]).optional(),
|
|
652
|
+
actualBehavior: z2.string().optional(),
|
|
653
|
+
expectedBehavior: z2.string().optional(),
|
|
654
|
+
reproductionSteps: z2.array(z2.string()).optional(),
|
|
655
|
+
domain: z2.string().optional(),
|
|
656
|
+
authorization: z2.string().optional()
|
|
657
|
+
});
|
|
658
|
+
ProductGraphNodeSchema = z2.object({
|
|
659
|
+
id: z2.string(),
|
|
518
660
|
type: ProductNodeTypeSchema,
|
|
519
|
-
name:
|
|
520
|
-
data:
|
|
521
|
-
source:
|
|
661
|
+
name: z2.string(),
|
|
662
|
+
data: z2.record(z2.string(), z2.unknown()).default({}),
|
|
663
|
+
source: z2.string().optional(),
|
|
522
664
|
confidence: ConfidenceLevelSchema.optional(),
|
|
523
|
-
version:
|
|
665
|
+
version: z2.string().optional()
|
|
524
666
|
});
|
|
525
|
-
ProductGraphEdgeSchema =
|
|
526
|
-
from:
|
|
527
|
-
to:
|
|
667
|
+
ProductGraphEdgeSchema = z2.object({
|
|
668
|
+
from: z2.string(),
|
|
669
|
+
to: z2.string(),
|
|
528
670
|
relation: GraphRelationSchema
|
|
529
671
|
});
|
|
530
|
-
ProductGraphSchema =
|
|
531
|
-
version:
|
|
532
|
-
productId:
|
|
533
|
-
productName:
|
|
534
|
-
nodes:
|
|
535
|
-
edges:
|
|
536
|
-
updatedAt:
|
|
537
|
-
});
|
|
538
|
-
ProductMetaSchema =
|
|
539
|
-
version:
|
|
540
|
-
graphVersion:
|
|
541
|
-
lastIngestAt:
|
|
542
|
-
sourceHashes:
|
|
543
|
-
});
|
|
544
|
-
ProductEventTypeSchema =
|
|
672
|
+
ProductGraphSchema = z2.object({
|
|
673
|
+
version: z2.literal(1),
|
|
674
|
+
productId: z2.string(),
|
|
675
|
+
productName: z2.string(),
|
|
676
|
+
nodes: z2.array(ProductGraphNodeSchema),
|
|
677
|
+
edges: z2.array(ProductGraphEdgeSchema),
|
|
678
|
+
updatedAt: z2.string()
|
|
679
|
+
});
|
|
680
|
+
ProductMetaSchema = z2.object({
|
|
681
|
+
version: z2.literal(1),
|
|
682
|
+
graphVersion: z2.string(),
|
|
683
|
+
lastIngestAt: z2.string().optional(),
|
|
684
|
+
sourceHashes: z2.record(z2.string(), z2.string()).default({})
|
|
685
|
+
});
|
|
686
|
+
ProductEventTypeSchema = z2.enum([
|
|
545
687
|
"task.started",
|
|
546
688
|
"task.completed",
|
|
547
689
|
"lock.recovered",
|
|
@@ -554,64 +696,64 @@ var init_schemas = __esm(() => {
|
|
|
554
696
|
"feedback.processed",
|
|
555
697
|
"context.compiled"
|
|
556
698
|
]);
|
|
557
|
-
ProductEventSchema =
|
|
558
|
-
id:
|
|
699
|
+
ProductEventSchema = z2.object({
|
|
700
|
+
id: z2.string(),
|
|
559
701
|
type: ProductEventTypeSchema,
|
|
560
|
-
timestamp:
|
|
561
|
-
payload:
|
|
562
|
-
});
|
|
563
|
-
OperationalStateSchema =
|
|
564
|
-
version:
|
|
565
|
-
activeAgents:
|
|
566
|
-
activeTaskIds:
|
|
567
|
-
blockers:
|
|
568
|
-
taskId:
|
|
569
|
-
reason:
|
|
570
|
-
since:
|
|
702
|
+
timestamp: z2.string(),
|
|
703
|
+
payload: z2.record(z2.string(), z2.unknown()).default({})
|
|
704
|
+
});
|
|
705
|
+
OperationalStateSchema = z2.object({
|
|
706
|
+
version: z2.literal(1),
|
|
707
|
+
activeAgents: z2.array(z2.string()).default([]),
|
|
708
|
+
activeTaskIds: z2.array(z2.string()).default([]),
|
|
709
|
+
blockers: z2.array(z2.object({
|
|
710
|
+
taskId: z2.string(),
|
|
711
|
+
reason: z2.string(),
|
|
712
|
+
since: z2.string()
|
|
571
713
|
})).default([]),
|
|
572
|
-
sprintFocus:
|
|
573
|
-
updatedAt:
|
|
574
|
-
});
|
|
575
|
-
StrategicMemorySchema =
|
|
576
|
-
version:
|
|
577
|
-
kpis:
|
|
578
|
-
name:
|
|
579
|
-
target:
|
|
580
|
-
current:
|
|
714
|
+
sprintFocus: z2.string().optional(),
|
|
715
|
+
updatedAt: z2.string()
|
|
716
|
+
});
|
|
717
|
+
StrategicMemorySchema = z2.object({
|
|
718
|
+
version: z2.literal(1),
|
|
719
|
+
kpis: z2.array(z2.object({
|
|
720
|
+
name: z2.string(),
|
|
721
|
+
target: z2.string(),
|
|
722
|
+
current: z2.string().optional()
|
|
581
723
|
})).default([]),
|
|
582
|
-
quarterlyFocus:
|
|
583
|
-
tradeoffs:
|
|
584
|
-
updatedAt:
|
|
585
|
-
});
|
|
586
|
-
ImpactReportSchema =
|
|
587
|
-
target:
|
|
588
|
-
brokenEndpoints:
|
|
589
|
-
brokenContracts:
|
|
590
|
-
affectedTests:
|
|
591
|
-
affectedFlows:
|
|
592
|
-
affectedComponents:
|
|
593
|
-
summary:
|
|
594
|
-
});
|
|
595
|
-
BusinessReviewOutputSchema =
|
|
596
|
-
status:
|
|
597
|
-
roiEstimate:
|
|
598
|
-
userImpact:
|
|
599
|
-
eliminationRisk:
|
|
600
|
-
questions:
|
|
601
|
-
confidence:
|
|
602
|
-
});
|
|
603
|
-
VerificationReportSchema =
|
|
604
|
-
taskId:
|
|
605
|
-
passed:
|
|
606
|
-
checks:
|
|
607
|
-
name:
|
|
608
|
-
passed:
|
|
609
|
-
message:
|
|
724
|
+
quarterlyFocus: z2.string().optional(),
|
|
725
|
+
tradeoffs: z2.array(z2.string()).default([]),
|
|
726
|
+
updatedAt: z2.string()
|
|
727
|
+
});
|
|
728
|
+
ImpactReportSchema = z2.object({
|
|
729
|
+
target: z2.string(),
|
|
730
|
+
brokenEndpoints: z2.array(z2.string()).default([]),
|
|
731
|
+
brokenContracts: z2.array(z2.string()).default([]),
|
|
732
|
+
affectedTests: z2.array(z2.string()).default([]),
|
|
733
|
+
affectedFlows: z2.array(z2.string()).default([]),
|
|
734
|
+
affectedComponents: z2.array(z2.string()).default([]),
|
|
735
|
+
summary: z2.string()
|
|
736
|
+
});
|
|
737
|
+
BusinessReviewOutputSchema = z2.object({
|
|
738
|
+
status: z2.enum(["proceed", "defer", "reject"]),
|
|
739
|
+
roiEstimate: z2.string().optional(),
|
|
740
|
+
userImpact: z2.string().optional(),
|
|
741
|
+
eliminationRisk: z2.string().optional(),
|
|
742
|
+
questions: z2.array(z2.string()).default([]),
|
|
743
|
+
confidence: z2.number().min(0).max(1)
|
|
744
|
+
});
|
|
745
|
+
VerificationReportSchema = z2.object({
|
|
746
|
+
taskId: z2.string(),
|
|
747
|
+
passed: z2.boolean(),
|
|
748
|
+
checks: z2.array(z2.object({
|
|
749
|
+
name: z2.string(),
|
|
750
|
+
passed: z2.boolean(),
|
|
751
|
+
message: z2.string()
|
|
610
752
|
})),
|
|
611
|
-
evidenceIds:
|
|
612
|
-
confidence:
|
|
753
|
+
evidenceIds: z2.array(z2.string()).default([]),
|
|
754
|
+
confidence: z2.number().min(0).max(1)
|
|
613
755
|
});
|
|
614
|
-
BacklogStatusSchema =
|
|
756
|
+
BacklogStatusSchema = z2.enum([
|
|
615
757
|
"TODO",
|
|
616
758
|
"READY",
|
|
617
759
|
"PLANNED",
|
|
@@ -620,89 +762,89 @@ var init_schemas = __esm(() => {
|
|
|
620
762
|
"REVIEW",
|
|
621
763
|
"DONE"
|
|
622
764
|
]);
|
|
623
|
-
BacklogTypeSchema =
|
|
624
|
-
BacklogPrioritySchema =
|
|
625
|
-
BacklogGlobalSchema =
|
|
626
|
-
product:
|
|
627
|
-
strategy:
|
|
628
|
-
policy:
|
|
629
|
-
reviewRequired:
|
|
630
|
-
tddRequired:
|
|
631
|
-
});
|
|
632
|
-
BacklogItemSchema =
|
|
633
|
-
id:
|
|
634
|
-
title:
|
|
765
|
+
BacklogTypeSchema = z2.enum(["feature", "bug", "refactor", "tech-debt"]);
|
|
766
|
+
BacklogPrioritySchema = z2.enum(["P0", "P1", "P2", "P3"]);
|
|
767
|
+
BacklogGlobalSchema = z2.object({
|
|
768
|
+
product: z2.string().min(1),
|
|
769
|
+
strategy: z2.string().min(1),
|
|
770
|
+
policy: z2.string().min(1),
|
|
771
|
+
reviewRequired: z2.boolean(),
|
|
772
|
+
tddRequired: z2.boolean()
|
|
773
|
+
});
|
|
774
|
+
BacklogItemSchema = z2.object({
|
|
775
|
+
id: z2.string().regex(/^BC-\d{3,}$/),
|
|
776
|
+
title: z2.string().min(1),
|
|
635
777
|
priority: BacklogPrioritySchema,
|
|
636
778
|
status: BacklogStatusSchema,
|
|
637
779
|
type: BacklogTypeSchema,
|
|
638
|
-
owner:
|
|
639
|
-
dependencies:
|
|
640
|
-
description:
|
|
641
|
-
scope:
|
|
642
|
-
outOfScope:
|
|
643
|
-
businessValue:
|
|
644
|
-
acceptanceCriteria:
|
|
645
|
-
risks:
|
|
646
|
-
progress:
|
|
647
|
-
branch:
|
|
648
|
-
reviewer:
|
|
649
|
-
lastUpdate:
|
|
650
|
-
});
|
|
651
|
-
BacklogDocumentSchema =
|
|
780
|
+
owner: z2.string().optional(),
|
|
781
|
+
dependencies: z2.array(z2.string()).default([]),
|
|
782
|
+
description: z2.string().min(1),
|
|
783
|
+
scope: z2.string().min(1),
|
|
784
|
+
outOfScope: z2.string().default(""),
|
|
785
|
+
businessValue: z2.string().optional(),
|
|
786
|
+
acceptanceCriteria: z2.array(z2.string().min(1)).min(1),
|
|
787
|
+
risks: z2.string().optional(),
|
|
788
|
+
progress: z2.number().int().min(0).max(100),
|
|
789
|
+
branch: z2.string().optional(),
|
|
790
|
+
reviewer: z2.string().optional(),
|
|
791
|
+
lastUpdate: z2.string().optional()
|
|
792
|
+
});
|
|
793
|
+
BacklogDocumentSchema = z2.object({
|
|
652
794
|
global: BacklogGlobalSchema,
|
|
653
|
-
items:
|
|
654
|
-
archive:
|
|
795
|
+
items: z2.array(BacklogItemSchema),
|
|
796
|
+
archive: z2.array(BacklogItemSchema).default([])
|
|
655
797
|
});
|
|
656
|
-
OpenspecTaskCardPhaseSchema =
|
|
798
|
+
OpenspecTaskCardPhaseSchema = z2.enum([
|
|
657
799
|
"discover",
|
|
658
800
|
"design",
|
|
659
801
|
"implement",
|
|
660
802
|
"test",
|
|
661
803
|
"review"
|
|
662
804
|
]);
|
|
663
|
-
OpenspecTaskCardStatusSchema =
|
|
664
|
-
OpenspecTaskCardSchema =
|
|
665
|
-
id:
|
|
666
|
-
backlogId:
|
|
805
|
+
OpenspecTaskCardStatusSchema = z2.enum(["pending", "doing", "blocked", "done"]);
|
|
806
|
+
OpenspecTaskCardSchema = z2.object({
|
|
807
|
+
id: z2.string(),
|
|
808
|
+
backlogId: z2.string(),
|
|
667
809
|
phase: OpenspecTaskCardPhaseSchema,
|
|
668
|
-
title:
|
|
669
|
-
prompt:
|
|
670
|
-
agent:
|
|
671
|
-
modelHint:
|
|
672
|
-
dependsOn:
|
|
673
|
-
acceptanceCriteria:
|
|
810
|
+
title: z2.string(),
|
|
811
|
+
prompt: z2.string(),
|
|
812
|
+
agent: z2.string(),
|
|
813
|
+
modelHint: z2.string().optional(),
|
|
814
|
+
dependsOn: z2.array(z2.string()).default([]),
|
|
815
|
+
acceptanceCriteria: z2.array(z2.string()),
|
|
674
816
|
status: OpenspecTaskCardStatusSchema,
|
|
675
|
-
itemHash:
|
|
676
|
-
});
|
|
677
|
-
OpenspecStateSchema =
|
|
678
|
-
version:
|
|
679
|
-
activeItemId:
|
|
680
|
-
taskCards:
|
|
681
|
-
lastScanHash:
|
|
682
|
-
lastScanAt:
|
|
683
|
-
changePaths:
|
|
684
|
-
itemSnapshots:
|
|
685
|
-
itemBaseCommits:
|
|
686
|
-
});
|
|
687
|
-
SpecAnalyzeFindingSchema =
|
|
688
|
-
severity:
|
|
689
|
-
code:
|
|
690
|
-
message:
|
|
691
|
-
});
|
|
692
|
-
SpecAnalyzeReportSchema =
|
|
693
|
-
changePath:
|
|
694
|
-
frIds:
|
|
695
|
-
scIds:
|
|
696
|
-
mappedFr:
|
|
697
|
-
mappedSc:
|
|
698
|
-
mappedToTests:
|
|
699
|
-
frCoveragePct:
|
|
700
|
-
scCoveragePct:
|
|
701
|
-
testCoveragePct:
|
|
702
|
-
findings:
|
|
703
|
-
stop:
|
|
704
|
-
});
|
|
705
|
-
WorkflowCommandSchema =
|
|
817
|
+
itemHash: z2.string().optional()
|
|
818
|
+
});
|
|
819
|
+
OpenspecStateSchema = z2.object({
|
|
820
|
+
version: z2.literal(1),
|
|
821
|
+
activeItemId: z2.string().optional(),
|
|
822
|
+
taskCards: z2.array(OpenspecTaskCardSchema).default([]),
|
|
823
|
+
lastScanHash: z2.string().optional(),
|
|
824
|
+
lastScanAt: z2.string().optional(),
|
|
825
|
+
changePaths: z2.record(z2.string(), z2.string()).optional().default({}),
|
|
826
|
+
itemSnapshots: z2.record(z2.string(), z2.string()).optional().default({}),
|
|
827
|
+
itemBaseCommits: z2.record(z2.string(), z2.string()).optional()
|
|
828
|
+
});
|
|
829
|
+
SpecAnalyzeFindingSchema = z2.object({
|
|
830
|
+
severity: z2.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW"]),
|
|
831
|
+
code: z2.string(),
|
|
832
|
+
message: z2.string()
|
|
833
|
+
});
|
|
834
|
+
SpecAnalyzeReportSchema = z2.object({
|
|
835
|
+
changePath: z2.string(),
|
|
836
|
+
frIds: z2.array(z2.string()),
|
|
837
|
+
scIds: z2.array(z2.string()),
|
|
838
|
+
mappedFr: z2.array(z2.string()),
|
|
839
|
+
mappedSc: z2.array(z2.string()),
|
|
840
|
+
mappedToTests: z2.array(z2.string()),
|
|
841
|
+
frCoveragePct: z2.number(),
|
|
842
|
+
scCoveragePct: z2.number(),
|
|
843
|
+
testCoveragePct: z2.number(),
|
|
844
|
+
findings: z2.array(SpecAnalyzeFindingSchema),
|
|
845
|
+
stop: z2.boolean()
|
|
846
|
+
});
|
|
847
|
+
WorkflowCommandSchema = z2.enum([
|
|
706
848
|
"feature",
|
|
707
849
|
"fix",
|
|
708
850
|
"refactor",
|
|
@@ -726,148 +868,149 @@ var init_schemas = __esm(() => {
|
|
|
726
868
|
"security",
|
|
727
869
|
"odd"
|
|
728
870
|
]);
|
|
729
|
-
CcepOutputFormatSchema =
|
|
730
|
-
CommandEnvelopeSchema =
|
|
731
|
-
protocolVersion:
|
|
871
|
+
CcepOutputFormatSchema = z2.enum(["taskcard", "plan", "verdict"]);
|
|
872
|
+
CommandEnvelopeSchema = z2.object({
|
|
873
|
+
protocolVersion: z2.literal("ccep-1"),
|
|
732
874
|
command: WorkflowCommandSchema,
|
|
733
|
-
userRequest:
|
|
734
|
-
projectId:
|
|
735
|
-
repoContext:
|
|
736
|
-
domain:
|
|
737
|
-
stack:
|
|
738
|
-
existingModules:
|
|
739
|
-
architecture:
|
|
875
|
+
userRequest: z2.string(),
|
|
876
|
+
projectId: z2.string(),
|
|
877
|
+
repoContext: z2.object({
|
|
878
|
+
domain: z2.string().optional(),
|
|
879
|
+
stack: z2.array(z2.string()),
|
|
880
|
+
existingModules: z2.array(z2.string()).default([]),
|
|
881
|
+
architecture: z2.string().optional()
|
|
740
882
|
}),
|
|
741
|
-
constraints:
|
|
883
|
+
constraints: z2.object({
|
|
742
884
|
outputFormat: CcepOutputFormatSchema,
|
|
743
|
-
needConfirmation:
|
|
744
|
-
riskThreshold:
|
|
885
|
+
needConfirmation: z2.boolean(),
|
|
886
|
+
riskThreshold: z2.enum(["low", "medium", "high"])
|
|
745
887
|
}),
|
|
746
|
-
executionPolicy:
|
|
747
|
-
modelMode:
|
|
748
|
-
maxVariance:
|
|
888
|
+
executionPolicy: z2.object({
|
|
889
|
+
modelMode: z2.literal("structured"),
|
|
890
|
+
maxVariance: z2.literal("low")
|
|
749
891
|
})
|
|
750
892
|
});
|
|
751
|
-
WorkflowPhaseSchema =
|
|
752
|
-
id:
|
|
753
|
-
agent:
|
|
754
|
-
agents:
|
|
755
|
-
skill:
|
|
756
|
-
type:
|
|
757
|
-
outputSchema:
|
|
758
|
-
stopGate:
|
|
759
|
-
dependsOn:
|
|
760
|
-
requires:
|
|
761
|
-
parallelWith:
|
|
762
|
-
});
|
|
763
|
-
WorkflowRiskRuleSchema =
|
|
764
|
-
when:
|
|
765
|
-
risk:
|
|
766
|
-
|
|
767
|
-
|
|
893
|
+
WorkflowPhaseSchema = z2.object({
|
|
894
|
+
id: z2.string(),
|
|
895
|
+
agent: z2.string().optional(),
|
|
896
|
+
agents: z2.array(z2.string()).optional(),
|
|
897
|
+
skill: z2.string().optional(),
|
|
898
|
+
type: z2.string().optional(),
|
|
899
|
+
outputSchema: z2.string().optional(),
|
|
900
|
+
stopGate: z2.string().optional(),
|
|
901
|
+
dependsOn: z2.array(z2.string()).optional(),
|
|
902
|
+
requires: z2.string().optional(),
|
|
903
|
+
parallelWith: z2.array(z2.string()).optional()
|
|
904
|
+
});
|
|
905
|
+
WorkflowRiskRuleSchema = z2.object({
|
|
906
|
+
when: z2.object({
|
|
907
|
+
risk: z2.union([
|
|
908
|
+
z2.enum(["low", "medium", "high"]),
|
|
909
|
+
z2.array(z2.enum(["low", "medium", "high"]))
|
|
768
910
|
])
|
|
769
911
|
}),
|
|
770
|
-
then:
|
|
912
|
+
then: z2.array(z2.string())
|
|
771
913
|
});
|
|
772
|
-
WorkflowProfileSchema =
|
|
773
|
-
id:
|
|
774
|
-
version:
|
|
914
|
+
WorkflowProfileSchema = z2.object({
|
|
915
|
+
id: z2.string(),
|
|
916
|
+
version: z2.number().int().positive(),
|
|
775
917
|
command: WorkflowCommandSchema,
|
|
776
|
-
taskCard:
|
|
777
|
-
type:
|
|
778
|
-
requiredFields:
|
|
779
|
-
optionalFields:
|
|
918
|
+
taskCard: z2.object({
|
|
919
|
+
type: z2.string(),
|
|
920
|
+
requiredFields: z2.array(z2.string()),
|
|
921
|
+
optionalFields: z2.array(z2.string()).optional()
|
|
780
922
|
}).optional(),
|
|
781
|
-
intakeSchema:
|
|
782
|
-
phases:
|
|
783
|
-
routing:
|
|
784
|
-
default:
|
|
785
|
-
riskRules:
|
|
923
|
+
intakeSchema: z2.string().optional(),
|
|
924
|
+
phases: z2.array(WorkflowPhaseSchema),
|
|
925
|
+
routing: z2.object({
|
|
926
|
+
default: z2.array(z2.string()),
|
|
927
|
+
riskRules: z2.array(WorkflowRiskRuleSchema).optional()
|
|
786
928
|
}),
|
|
787
|
-
confirmationGate:
|
|
788
|
-
stopOnHighRisk:
|
|
789
|
-
stopOnQuestions:
|
|
929
|
+
confirmationGate: z2.object({
|
|
930
|
+
stopOnHighRisk: z2.boolean(),
|
|
931
|
+
stopOnQuestions: z2.boolean()
|
|
790
932
|
})
|
|
791
933
|
}).refine((profile) => profile.id === profile.command, {
|
|
792
934
|
message: "Workflow profile id must match command"
|
|
793
935
|
});
|
|
794
|
-
ExecutionContextSchema =
|
|
936
|
+
ExecutionContextSchema = z2.object({
|
|
795
937
|
envelope: CommandEnvelopeSchema,
|
|
796
938
|
profile: WorkflowProfileSchema,
|
|
797
|
-
intent:
|
|
939
|
+
intent: z2.object({
|
|
798
940
|
type: WorkflowCommandSchema,
|
|
799
|
-
goal:
|
|
800
|
-
domain:
|
|
801
|
-
entity:
|
|
802
|
-
operation:
|
|
941
|
+
goal: z2.string(),
|
|
942
|
+
domain: z2.string().optional(),
|
|
943
|
+
entity: z2.string().optional(),
|
|
944
|
+
operation: z2.string().optional()
|
|
803
945
|
}),
|
|
804
|
-
project:
|
|
805
|
-
name:
|
|
806
|
-
rootDir:
|
|
807
|
-
stack:
|
|
946
|
+
project: z2.object({
|
|
947
|
+
name: z2.string(),
|
|
948
|
+
rootDir: z2.string(),
|
|
949
|
+
stack: z2.array(z2.string()).optional()
|
|
808
950
|
}),
|
|
809
|
-
knowledge:
|
|
810
|
-
ast:
|
|
811
|
-
source:
|
|
812
|
-
confidence:
|
|
813
|
-
domains:
|
|
814
|
-
rules:
|
|
951
|
+
knowledge: z2.record(z2.string(), z2.unknown()).default({}),
|
|
952
|
+
ast: z2.object({
|
|
953
|
+
source: z2.enum(["detect", "graphify", "manual", "product-graph"]),
|
|
954
|
+
confidence: z2.enum(["low", "medium", "high"]),
|
|
955
|
+
domains: z2.array(z2.unknown()).optional(),
|
|
956
|
+
rules: z2.array(z2.string()).optional()
|
|
815
957
|
}),
|
|
816
|
-
policies:
|
|
817
|
-
architecture:
|
|
818
|
-
testing:
|
|
819
|
-
documentation:
|
|
820
|
-
breakingChanges:
|
|
958
|
+
policies: z2.object({
|
|
959
|
+
architecture: z2.string(),
|
|
960
|
+
testing: z2.string(),
|
|
961
|
+
documentation: z2.string(),
|
|
962
|
+
breakingChanges: z2.string()
|
|
821
963
|
}),
|
|
822
|
-
currentPhase:
|
|
823
|
-
outputSchema:
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
964
|
+
currentPhase: z2.string().optional(),
|
|
965
|
+
outputSchema: z2.string(),
|
|
966
|
+
scopedContext: ScopedContextSchema.optional()
|
|
967
|
+
});
|
|
968
|
+
PlannerOutputSchema = z2.object({
|
|
969
|
+
status: z2.enum(["success", "needs_clarification"]),
|
|
970
|
+
confidence: z2.number().min(0).max(1),
|
|
971
|
+
goal: z2.string(),
|
|
972
|
+
assumptions: z2.array(z2.string()),
|
|
973
|
+
risks: z2.array(z2.object({
|
|
974
|
+
type: z2.string(),
|
|
975
|
+
description: z2.string(),
|
|
976
|
+
severity: z2.enum(["low", "medium", "high"])
|
|
834
977
|
})),
|
|
835
|
-
tasks:
|
|
836
|
-
id:
|
|
837
|
-
title:
|
|
838
|
-
priority:
|
|
839
|
-
estimate:
|
|
840
|
-
dependencies:
|
|
978
|
+
tasks: z2.array(z2.object({
|
|
979
|
+
id: z2.string(),
|
|
980
|
+
title: z2.string(),
|
|
981
|
+
priority: z2.string(),
|
|
982
|
+
estimate: z2.string(),
|
|
983
|
+
dependencies: z2.array(z2.string())
|
|
841
984
|
})),
|
|
842
|
-
questionsForUser:
|
|
843
|
-
needsConfirmation:
|
|
844
|
-
});
|
|
845
|
-
AgentArtifactSchema =
|
|
846
|
-
type:
|
|
847
|
-
path:
|
|
848
|
-
content:
|
|
849
|
-
});
|
|
850
|
-
AgentOutputSchema =
|
|
851
|
-
status:
|
|
852
|
-
confidence:
|
|
853
|
-
warnings:
|
|
854
|
-
artifacts:
|
|
855
|
-
next_actions:
|
|
856
|
-
});
|
|
857
|
-
ImplementerTestsSchema =
|
|
858
|
-
runner:
|
|
859
|
-
result:
|
|
860
|
-
failedTests:
|
|
985
|
+
questionsForUser: z2.array(z2.string()),
|
|
986
|
+
needsConfirmation: z2.boolean()
|
|
987
|
+
});
|
|
988
|
+
AgentArtifactSchema = z2.object({
|
|
989
|
+
type: z2.string(),
|
|
990
|
+
path: z2.string().optional(),
|
|
991
|
+
content: z2.string().optional()
|
|
992
|
+
});
|
|
993
|
+
AgentOutputSchema = z2.object({
|
|
994
|
+
status: z2.enum(["success", "failure", "blocked", "needs_clarification"]),
|
|
995
|
+
confidence: z2.number().min(0).max(1),
|
|
996
|
+
warnings: z2.array(z2.string()).default([]),
|
|
997
|
+
artifacts: z2.array(AgentArtifactSchema).default([]),
|
|
998
|
+
next_actions: z2.array(z2.string()).default([])
|
|
999
|
+
});
|
|
1000
|
+
ImplementerTestsSchema = z2.object({
|
|
1001
|
+
runner: z2.string(),
|
|
1002
|
+
result: z2.enum(["passed", "failed"]),
|
|
1003
|
+
failedTests: z2.array(z2.string()).optional()
|
|
861
1004
|
});
|
|
862
1005
|
ImplementerOutputSchema = AgentOutputSchema.extend({
|
|
863
|
-
status:
|
|
864
|
-
filesChanged:
|
|
865
|
-
path:
|
|
866
|
-
summary:
|
|
1006
|
+
status: z2.enum(["success", "failure", "blocked"]),
|
|
1007
|
+
filesChanged: z2.array(z2.object({
|
|
1008
|
+
path: z2.string(),
|
|
1009
|
+
summary: z2.string()
|
|
867
1010
|
})).default([]),
|
|
868
1011
|
tests: ImplementerTestsSchema.optional()
|
|
869
1012
|
});
|
|
870
|
-
ReviewAxisSchema =
|
|
1013
|
+
ReviewAxisSchema = z2.enum([
|
|
871
1014
|
"complexity",
|
|
872
1015
|
"cost",
|
|
873
1016
|
"performance",
|
|
@@ -876,35 +1019,42 @@ var init_schemas = __esm(() => {
|
|
|
876
1019
|
"scalability",
|
|
877
1020
|
"style"
|
|
878
1021
|
]);
|
|
879
|
-
ReviewFindingSchema =
|
|
880
|
-
severity:
|
|
881
|
-
message:
|
|
882
|
-
axis:
|
|
883
|
-
path:
|
|
884
|
-
line:
|
|
885
|
-
});
|
|
886
|
-
ReviewerOutputSchema =
|
|
887
|
-
status:
|
|
888
|
-
confidence:
|
|
889
|
-
verdict:
|
|
890
|
-
warnings:
|
|
891
|
-
findings:
|
|
892
|
-
artifacts:
|
|
893
|
-
next_actions:
|
|
894
|
-
});
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1022
|
+
ReviewFindingSchema = z2.object({
|
|
1023
|
+
severity: z2.enum(["CRITICAL", "WARNING", "SUGGESTION"]),
|
|
1024
|
+
message: z2.string(),
|
|
1025
|
+
axis: z2.union([ReviewAxisSchema, z2.string()]),
|
|
1026
|
+
path: z2.string().optional(),
|
|
1027
|
+
line: z2.number().int().optional()
|
|
1028
|
+
});
|
|
1029
|
+
ReviewerOutputSchema = z2.object({
|
|
1030
|
+
status: z2.enum(["pass", "fail"]),
|
|
1031
|
+
confidence: z2.number().min(0).max(1),
|
|
1032
|
+
verdict: z2.enum(["approved", "approved_with_warnings", "blocked"]),
|
|
1033
|
+
warnings: z2.array(z2.string()).default([]),
|
|
1034
|
+
findings: z2.array(ReviewFindingSchema).default([]),
|
|
1035
|
+
artifacts: z2.array(AgentArtifactSchema).default([]),
|
|
1036
|
+
next_actions: z2.array(z2.string()).default([])
|
|
1037
|
+
});
|
|
1038
|
+
EdgeCaseSchema = z2.object({
|
|
1039
|
+
scenario: z2.string().min(1),
|
|
1040
|
+
input: z2.string().min(1),
|
|
1041
|
+
expected: z2.string().min(1)
|
|
1042
|
+
});
|
|
1043
|
+
TechnicalPlanOutputSchema = z2.object({
|
|
1044
|
+
approach: z2.string(),
|
|
1045
|
+
filesAffected: z2.array(z2.string()).default([]),
|
|
1046
|
+
risks: z2.array(z2.string()).default([]),
|
|
1047
|
+
openQuestions: z2.array(z2.string()).optional(),
|
|
1048
|
+
edgeCases: z2.array(EdgeCaseSchema).min(1),
|
|
1049
|
+
symbolsAffected: z2.record(z2.string(), z2.array(z2.string())).default({})
|
|
1050
|
+
});
|
|
1051
|
+
FixIntakeOutputSchema = z2.object({
|
|
1052
|
+
actualBehavior: z2.string(),
|
|
1053
|
+
expectedBehavior: z2.string(),
|
|
1054
|
+
reproductionSteps: z2.array(z2.string())
|
|
1055
|
+
});
|
|
1056
|
+
ScorecardVerdictSchema = z2.enum(["PASS", "REVISE", "REJECT"]);
|
|
1057
|
+
ScorecardCriterionIdSchema = z2.enum([
|
|
908
1058
|
"acceptance",
|
|
909
1059
|
"minimal_diff",
|
|
910
1060
|
"tests",
|
|
@@ -914,140 +1064,155 @@ var init_schemas = __esm(() => {
|
|
|
914
1064
|
"context_discipline",
|
|
915
1065
|
"cc_gain"
|
|
916
1066
|
]);
|
|
917
|
-
ScorecardCriterionSchema =
|
|
1067
|
+
ScorecardCriterionSchema = z2.object({
|
|
918
1068
|
id: ScorecardCriterionIdSchema,
|
|
919
|
-
label:
|
|
920
|
-
weight:
|
|
921
|
-
score:
|
|
922
|
-
unmeasured:
|
|
923
|
-
notes:
|
|
924
|
-
autoSuggested:
|
|
925
|
-
});
|
|
926
|
-
ScorecardRecordSchema =
|
|
927
|
-
id:
|
|
928
|
-
taskId:
|
|
929
|
-
agent:
|
|
930
|
-
model:
|
|
931
|
-
contractVersion:
|
|
932
|
-
evaluator:
|
|
933
|
-
criteria:
|
|
934
|
-
weightedScore:
|
|
1069
|
+
label: z2.string(),
|
|
1070
|
+
weight: z2.number().min(0).max(1),
|
|
1071
|
+
score: z2.number().int().min(0).max(3).nullable(),
|
|
1072
|
+
unmeasured: z2.boolean().optional(),
|
|
1073
|
+
notes: z2.string().optional(),
|
|
1074
|
+
autoSuggested: z2.boolean().optional()
|
|
1075
|
+
});
|
|
1076
|
+
ScorecardRecordSchema = z2.object({
|
|
1077
|
+
id: z2.string(),
|
|
1078
|
+
taskId: z2.string(),
|
|
1079
|
+
agent: z2.string(),
|
|
1080
|
+
model: z2.string().optional(),
|
|
1081
|
+
contractVersion: z2.string(),
|
|
1082
|
+
evaluator: z2.string().optional(),
|
|
1083
|
+
criteria: z2.array(ScorecardCriterionSchema),
|
|
1084
|
+
weightedScore: z2.number(),
|
|
935
1085
|
verdict: ScorecardVerdictSchema,
|
|
936
|
-
findings:
|
|
937
|
-
createdAt:
|
|
938
|
-
backlogId:
|
|
939
|
-
source:
|
|
1086
|
+
findings: z2.array(z2.string()).optional().default([]),
|
|
1087
|
+
createdAt: z2.string(),
|
|
1088
|
+
backlogId: z2.string().optional(),
|
|
1089
|
+
source: z2.enum(["openspec", "review", "manual", "pipeline"]).optional()
|
|
940
1090
|
});
|
|
941
|
-
TaskOutcomeSourceSchema =
|
|
942
|
-
TaskOutcomeStatusSchema =
|
|
1091
|
+
TaskOutcomeSourceSchema = z2.enum(["openspec", "review", "manual", "pipeline"]);
|
|
1092
|
+
TaskOutcomeStatusSchema = z2.enum([
|
|
943
1093
|
"phase_done",
|
|
944
1094
|
"phase_failed",
|
|
945
1095
|
"pass",
|
|
946
1096
|
"revise",
|
|
947
1097
|
"reject"
|
|
948
1098
|
]);
|
|
949
|
-
DeliveryRouteSchema =
|
|
950
|
-
TokenUsageSchema =
|
|
951
|
-
|
|
952
|
-
status:
|
|
953
|
-
total:
|
|
1099
|
+
DeliveryRouteSchema = z2.enum(["read-only", "small", "tracked", "openspec"]);
|
|
1100
|
+
TokenUsageSchema = z2.union([
|
|
1101
|
+
z2.object({
|
|
1102
|
+
status: z2.literal("known"),
|
|
1103
|
+
total: z2.number().nonnegative()
|
|
954
1104
|
}),
|
|
955
|
-
|
|
1105
|
+
z2.object({ status: z2.literal("unknown") })
|
|
956
1106
|
]);
|
|
957
|
-
DeliveryTelemetrySchema =
|
|
1107
|
+
DeliveryTelemetrySchema = z2.object({
|
|
958
1108
|
route: DeliveryRouteSchema,
|
|
959
|
-
contextBytes:
|
|
960
|
-
handoffs:
|
|
961
|
-
checks:
|
|
1109
|
+
contextBytes: z2.number().int().nonnegative().optional(),
|
|
1110
|
+
handoffs: z2.number().int().nonnegative().optional(),
|
|
1111
|
+
checks: z2.array(z2.string().min(1)).optional(),
|
|
962
1112
|
tokenUsage: TokenUsageSchema
|
|
963
1113
|
});
|
|
964
|
-
DeliveryLedgerTaskSchema =
|
|
965
|
-
id:
|
|
966
|
-
title:
|
|
967
|
-
status:
|
|
1114
|
+
DeliveryLedgerTaskSchema = z2.object({
|
|
1115
|
+
id: z2.string().min(1),
|
|
1116
|
+
title: z2.string().min(1),
|
|
1117
|
+
status: z2.enum(["pending", "done", "blocked"])
|
|
968
1118
|
});
|
|
969
|
-
DeliveryLedgerSchema =
|
|
970
|
-
version:
|
|
971
|
-
id:
|
|
1119
|
+
DeliveryLedgerSchema = z2.object({
|
|
1120
|
+
version: z2.literal(1),
|
|
1121
|
+
id: z2.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),
|
|
972
1122
|
taskCard: CanonicalTaskCardSchema,
|
|
973
|
-
tasks:
|
|
974
|
-
evidence:
|
|
975
|
-
nextStep:
|
|
976
|
-
memoryTopicKey:
|
|
977
|
-
workspace:
|
|
978
|
-
technicalPlanPath:
|
|
979
|
-
createdAt:
|
|
980
|
-
updatedAt:
|
|
981
|
-
});
|
|
982
|
-
HandoffEnvelopeSchema =
|
|
983
|
-
version:
|
|
984
|
-
task:
|
|
985
|
-
id:
|
|
986
|
-
objective:
|
|
987
|
-
acceptanceCriteria:
|
|
1123
|
+
tasks: z2.array(DeliveryLedgerTaskSchema).min(1),
|
|
1124
|
+
evidence: z2.array(z2.string().min(1)),
|
|
1125
|
+
nextStep: z2.string().min(1),
|
|
1126
|
+
memoryTopicKey: z2.string().min(1),
|
|
1127
|
+
workspace: z2.record(z2.string(), z2.string()),
|
|
1128
|
+
technicalPlanPath: z2.string().min(1).optional(),
|
|
1129
|
+
createdAt: z2.string().datetime(),
|
|
1130
|
+
updatedAt: z2.string().datetime()
|
|
1131
|
+
});
|
|
1132
|
+
HandoffEnvelopeSchema = z2.object({
|
|
1133
|
+
version: z2.literal(1),
|
|
1134
|
+
task: z2.object({
|
|
1135
|
+
id: z2.string().min(1),
|
|
1136
|
+
objective: z2.string().min(1),
|
|
1137
|
+
acceptanceCriteria: z2.array(z2.string().min(1)),
|
|
988
1138
|
status: CanonicalTaskCardStatusSchema
|
|
989
1139
|
}),
|
|
990
|
-
decisions:
|
|
991
|
-
constraints:
|
|
992
|
-
unresolved:
|
|
1140
|
+
decisions: z2.object({
|
|
1141
|
+
constraints: z2.array(z2.string()),
|
|
1142
|
+
unresolved: z2.array(z2.string())
|
|
993
1143
|
}),
|
|
994
|
-
scope:
|
|
995
|
-
relevantFiles:
|
|
996
|
-
boundaries:
|
|
1144
|
+
scope: z2.object({
|
|
1145
|
+
relevantFiles: z2.array(z2.string()),
|
|
1146
|
+
boundaries: z2.array(z2.string())
|
|
997
1147
|
}),
|
|
998
|
-
verification:
|
|
999
|
-
evidence:
|
|
1148
|
+
verification: z2.object({
|
|
1149
|
+
evidence: z2.array(z2.string())
|
|
1000
1150
|
}),
|
|
1001
|
-
change:
|
|
1002
|
-
touchedFiles:
|
|
1151
|
+
change: z2.object({
|
|
1152
|
+
touchedFiles: z2.array(z2.string())
|
|
1003
1153
|
}),
|
|
1004
|
-
next:
|
|
1005
|
-
role:
|
|
1006
|
-
objective:
|
|
1154
|
+
next: z2.object({
|
|
1155
|
+
role: z2.string().min(1),
|
|
1156
|
+
objective: z2.string().min(1)
|
|
1007
1157
|
}),
|
|
1008
|
-
sources:
|
|
1009
|
-
deliveryLedger:
|
|
1010
|
-
memoryTopicKey:
|
|
1011
|
-
technicalPlanPath:
|
|
1158
|
+
sources: z2.object({
|
|
1159
|
+
deliveryLedger: z2.string().min(1),
|
|
1160
|
+
memoryTopicKey: z2.string().min(1),
|
|
1161
|
+
technicalPlanPath: z2.string().min(1).optional()
|
|
1012
1162
|
})
|
|
1013
1163
|
});
|
|
1014
|
-
RepoRelativePathSchema =
|
|
1015
|
-
DeliveryLedgerRequestSchema =
|
|
1016
|
-
id:
|
|
1017
|
-
authorized:
|
|
1164
|
+
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');
|
|
1165
|
+
DeliveryLedgerRequestSchema = z2.object({
|
|
1166
|
+
id: z2.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/),
|
|
1167
|
+
authorized: z2.boolean(),
|
|
1018
1168
|
route: DeliveryRouteSchema,
|
|
1019
1169
|
taskCard: CanonicalTaskCardSchema,
|
|
1020
|
-
tasks:
|
|
1021
|
-
nextStep:
|
|
1170
|
+
tasks: z2.array(DeliveryLedgerTaskSchema).min(1),
|
|
1171
|
+
nextStep: z2.string().min(1),
|
|
1022
1172
|
technicalPlanPath: RepoRelativePathSchema.optional()
|
|
1023
1173
|
});
|
|
1024
|
-
TaskOutcomeSchema =
|
|
1025
|
-
id:
|
|
1026
|
-
taskId:
|
|
1174
|
+
TaskOutcomeSchema = z2.object({
|
|
1175
|
+
id: z2.string(),
|
|
1176
|
+
taskId: z2.string(),
|
|
1027
1177
|
source: TaskOutcomeSourceSchema,
|
|
1028
|
-
agent:
|
|
1029
|
-
model:
|
|
1030
|
-
contractVersion:
|
|
1031
|
-
timestamp:
|
|
1178
|
+
agent: z2.string(),
|
|
1179
|
+
model: z2.string(),
|
|
1180
|
+
contractVersion: z2.string(),
|
|
1181
|
+
timestamp: z2.string(),
|
|
1032
1182
|
status: TaskOutcomeStatusSchema.optional(),
|
|
1033
1183
|
verdict: ScorecardVerdictSchema.optional(),
|
|
1034
|
-
weightedScore:
|
|
1035
|
-
taskCardId:
|
|
1036
|
-
backlogId:
|
|
1037
|
-
phase:
|
|
1038
|
-
scorecardId:
|
|
1039
|
-
tokensIn:
|
|
1040
|
-
tokensOut:
|
|
1041
|
-
costUsd:
|
|
1042
|
-
durationMs:
|
|
1043
|
-
experimentId:
|
|
1044
|
-
variantId:
|
|
1045
|
-
suiteTaskId:
|
|
1046
|
-
harnessFingerprint:
|
|
1047
|
-
disabledComponents:
|
|
1048
|
-
delivery: DeliveryTelemetrySchema.optional()
|
|
1049
|
-
|
|
1050
|
-
|
|
1184
|
+
weightedScore: z2.number().optional(),
|
|
1185
|
+
taskCardId: z2.string().optional(),
|
|
1186
|
+
backlogId: z2.string().optional(),
|
|
1187
|
+
phase: z2.string().optional(),
|
|
1188
|
+
scorecardId: z2.string().optional(),
|
|
1189
|
+
tokensIn: z2.number().optional(),
|
|
1190
|
+
tokensOut: z2.number().optional(),
|
|
1191
|
+
costUsd: z2.number().optional(),
|
|
1192
|
+
durationMs: z2.number().optional(),
|
|
1193
|
+
experimentId: z2.string().optional(),
|
|
1194
|
+
variantId: z2.string().optional(),
|
|
1195
|
+
suiteTaskId: z2.string().optional(),
|
|
1196
|
+
harnessFingerprint: z2.string().optional(),
|
|
1197
|
+
disabledComponents: z2.array(z2.string()).optional(),
|
|
1198
|
+
delivery: DeliveryTelemetrySchema.optional(),
|
|
1199
|
+
cacheRead: z2.number().nullable().optional(),
|
|
1200
|
+
cacheWrite: z2.number().nullable().optional(),
|
|
1201
|
+
calls: z2.number().nullable().optional(),
|
|
1202
|
+
iterations: z2.number().nullable().optional(),
|
|
1203
|
+
retries: z2.number().nullable().optional(),
|
|
1204
|
+
usageSource: z2.enum([
|
|
1205
|
+
"cc-json",
|
|
1206
|
+
"cc-otel",
|
|
1207
|
+
"cc-transcript",
|
|
1208
|
+
"openrouter-usage",
|
|
1209
|
+
"codex-json",
|
|
1210
|
+
"harness",
|
|
1211
|
+
"none"
|
|
1212
|
+
]).nullable().optional(),
|
|
1213
|
+
pricingVersion: z2.string().nullable().optional()
|
|
1214
|
+
});
|
|
1215
|
+
HarnessComponentIdSchema = z2.enum([
|
|
1051
1216
|
"wayfinding",
|
|
1052
1217
|
"intake",
|
|
1053
1218
|
"design",
|
|
@@ -1059,86 +1224,86 @@ var init_schemas = __esm(() => {
|
|
|
1059
1224
|
"council",
|
|
1060
1225
|
"product_graph"
|
|
1061
1226
|
]);
|
|
1062
|
-
HarnessComponentLayerSchema =
|
|
1227
|
+
HarnessComponentLayerSchema = z2.enum([
|
|
1063
1228
|
"phase",
|
|
1064
1229
|
"gate",
|
|
1065
1230
|
"loop",
|
|
1066
1231
|
"knowledge",
|
|
1067
1232
|
"council"
|
|
1068
1233
|
]);
|
|
1069
|
-
HarnessToggleKindSchema =
|
|
1234
|
+
HarnessToggleKindSchema = z2.enum([
|
|
1070
1235
|
"ccep_phase",
|
|
1071
1236
|
"ccep_gates",
|
|
1072
1237
|
"config_loop",
|
|
1073
1238
|
"config_council",
|
|
1074
1239
|
"product_graph"
|
|
1075
1240
|
]);
|
|
1076
|
-
HarnessCatalogEntrySchema =
|
|
1241
|
+
HarnessCatalogEntrySchema = z2.object({
|
|
1077
1242
|
id: HarnessComponentIdSchema,
|
|
1078
1243
|
layer: HarnessComponentLayerSchema,
|
|
1079
|
-
label:
|
|
1080
|
-
defaultOn:
|
|
1081
|
-
toggle:
|
|
1244
|
+
label: z2.string(),
|
|
1245
|
+
defaultOn: z2.boolean().default(true),
|
|
1246
|
+
toggle: z2.object({
|
|
1082
1247
|
kind: HarnessToggleKindSchema,
|
|
1083
|
-
phaseId:
|
|
1248
|
+
phaseId: z2.string().optional()
|
|
1084
1249
|
})
|
|
1085
1250
|
});
|
|
1086
|
-
HarnessCatalogSchema =
|
|
1087
|
-
version:
|
|
1088
|
-
components:
|
|
1089
|
-
});
|
|
1090
|
-
HarnessOverlaySchema =
|
|
1091
|
-
experimentId:
|
|
1092
|
-
variantId:
|
|
1093
|
-
disabledComponents:
|
|
1094
|
-
disableProductGraph:
|
|
1095
|
-
contractVersion:
|
|
1096
|
-
ccepProfile:
|
|
1097
|
-
});
|
|
1098
|
-
HarnessExperimentSchema =
|
|
1099
|
-
id:
|
|
1100
|
-
suiteId:
|
|
1101
|
-
createdAt:
|
|
1102
|
-
contractVersion:
|
|
1103
|
-
components:
|
|
1104
|
-
variants:
|
|
1105
|
-
suiteTaskIds:
|
|
1106
|
-
suitePath:
|
|
1107
|
-
});
|
|
1108
|
-
HarnessSuiteTaskSchema =
|
|
1109
|
-
id:
|
|
1110
|
-
title:
|
|
1111
|
-
type:
|
|
1112
|
-
risk:
|
|
1113
|
-
prompt:
|
|
1114
|
-
scope:
|
|
1115
|
-
acceptanceCriteria:
|
|
1116
|
-
testCommand:
|
|
1117
|
-
});
|
|
1118
|
-
HarnessSuiteSchema =
|
|
1119
|
-
id:
|
|
1120
|
-
version:
|
|
1121
|
-
fixtureDir:
|
|
1122
|
-
tasks:
|
|
1123
|
-
});
|
|
1124
|
-
EvaluationIndexSchema =
|
|
1125
|
-
version:
|
|
1126
|
-
lastOutcomeId:
|
|
1127
|
-
});
|
|
1128
|
-
ExecutionProfileNameSchema =
|
|
1129
|
-
ExecutionProfileSchema =
|
|
1251
|
+
HarnessCatalogSchema = z2.object({
|
|
1252
|
+
version: z2.literal(1),
|
|
1253
|
+
components: z2.array(HarnessCatalogEntrySchema).min(1)
|
|
1254
|
+
});
|
|
1255
|
+
HarnessOverlaySchema = z2.object({
|
|
1256
|
+
experimentId: z2.string().optional(),
|
|
1257
|
+
variantId: z2.string(),
|
|
1258
|
+
disabledComponents: z2.array(HarnessComponentIdSchema),
|
|
1259
|
+
disableProductGraph: z2.boolean().optional().default(false),
|
|
1260
|
+
contractVersion: z2.string().optional(),
|
|
1261
|
+
ccepProfile: z2.string().optional().default("feature")
|
|
1262
|
+
});
|
|
1263
|
+
HarnessExperimentSchema = z2.object({
|
|
1264
|
+
id: z2.string(),
|
|
1265
|
+
suiteId: z2.string(),
|
|
1266
|
+
createdAt: z2.string(),
|
|
1267
|
+
contractVersion: z2.string(),
|
|
1268
|
+
components: z2.array(HarnessComponentIdSchema),
|
|
1269
|
+
variants: z2.array(z2.string()).min(1),
|
|
1270
|
+
suiteTaskIds: z2.array(z2.string()),
|
|
1271
|
+
suitePath: z2.string().optional()
|
|
1272
|
+
});
|
|
1273
|
+
HarnessSuiteTaskSchema = z2.object({
|
|
1274
|
+
id: z2.string(),
|
|
1275
|
+
title: z2.string(),
|
|
1276
|
+
type: z2.enum(["feature", "fix", "refactor", "review"]),
|
|
1277
|
+
risk: z2.enum(["low", "medium", "high"]).default("low"),
|
|
1278
|
+
prompt: z2.string(),
|
|
1279
|
+
scope: z2.string(),
|
|
1280
|
+
acceptanceCriteria: z2.array(z2.string()).min(1),
|
|
1281
|
+
testCommand: z2.string().optional()
|
|
1282
|
+
});
|
|
1283
|
+
HarnessSuiteSchema = z2.object({
|
|
1284
|
+
id: z2.string(),
|
|
1285
|
+
version: z2.number().int().positive(),
|
|
1286
|
+
fixtureDir: z2.string().optional(),
|
|
1287
|
+
tasks: z2.array(HarnessSuiteTaskSchema).min(1)
|
|
1288
|
+
});
|
|
1289
|
+
EvaluationIndexSchema = z2.object({
|
|
1290
|
+
version: z2.literal(1),
|
|
1291
|
+
lastOutcomeId: z2.string().optional()
|
|
1292
|
+
});
|
|
1293
|
+
ExecutionProfileNameSchema = z2.enum(["balanced", "quality", "economical"]);
|
|
1294
|
+
ExecutionProfileSchema = z2.object({
|
|
1130
1295
|
profile: ExecutionProfileNameSchema.default("balanced"),
|
|
1131
|
-
target:
|
|
1132
|
-
overrides:
|
|
1133
|
-
subagentPolicy:
|
|
1134
|
-
orchestrator:
|
|
1135
|
-
testerReviewer:
|
|
1296
|
+
target: z2.enum(INDIVIDUAL_TARGETS).optional(),
|
|
1297
|
+
overrides: z2.record(z2.string(), z2.string()).optional().default({}),
|
|
1298
|
+
subagentPolicy: z2.object({
|
|
1299
|
+
orchestrator: z2.enum(["primary", "delegate"]).optional(),
|
|
1300
|
+
testerReviewer: z2.enum(["primary", "delegate"]).optional()
|
|
1136
1301
|
}).optional()
|
|
1137
1302
|
});
|
|
1138
|
-
SkillsRegistrySchema =
|
|
1139
|
-
version:
|
|
1140
|
-
skills:
|
|
1141
|
-
version:
|
|
1303
|
+
SkillsRegistrySchema = z2.object({
|
|
1304
|
+
version: z2.literal(1),
|
|
1305
|
+
skills: z2.record(z2.string().min(1).regex(/^[a-z0-9\-]+$/), z2.object({
|
|
1306
|
+
version: z2.string().min(1)
|
|
1142
1307
|
}))
|
|
1143
1308
|
});
|
|
1144
1309
|
});
|
|
@@ -1343,9 +1508,12 @@ var init_lock = __esm(() => {
|
|
|
1343
1508
|
// src/core/goal/goal-state.ts
|
|
1344
1509
|
var exports_goal_state = {};
|
|
1345
1510
|
__export(exports_goal_state, {
|
|
1511
|
+
BREAKER_TRIP_THRESHOLD: () => BREAKER_TRIP_THRESHOLD,
|
|
1346
1512
|
loadGoal: () => loadGoal,
|
|
1347
1513
|
markTaskBlocked: () => markTaskBlocked,
|
|
1348
1514
|
propagateBlockedTasks: () => propagateBlockedTasks,
|
|
1515
|
+
recordTaskStrike: () => recordTaskStrike,
|
|
1516
|
+
unfreezeTask: () => unfreezeTask,
|
|
1349
1517
|
writeGoal: () => writeGoal
|
|
1350
1518
|
});
|
|
1351
1519
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -1469,7 +1637,61 @@ async function markTaskBlockedUnlocked(projectRoot, taskId, reason) {
|
|
|
1469
1637
|
propagateBlockedTasks(graph);
|
|
1470
1638
|
return writeGoal(projectRoot, graph);
|
|
1471
1639
|
}
|
|
1472
|
-
|
|
1640
|
+
async function recordTaskStrike(projectRoot, taskId, reason) {
|
|
1641
|
+
return withQueueLock(projectRoot, () => recordTaskStrikeUnlocked(projectRoot, taskId, reason));
|
|
1642
|
+
}
|
|
1643
|
+
async function recordTaskStrikeUnlocked(projectRoot, taskId, reason) {
|
|
1644
|
+
const loadResult = await loadGoal(projectRoot);
|
|
1645
|
+
if (!loadResult.success)
|
|
1646
|
+
return loadResult;
|
|
1647
|
+
const graph = loadResult.data;
|
|
1648
|
+
const task = graph.tasks.find((t) => t.id === taskId);
|
|
1649
|
+
if (!task) {
|
|
1650
|
+
return err(new Error(`Task "${taskId}" not found in goal graph`));
|
|
1651
|
+
}
|
|
1652
|
+
if (task.status === "done") {
|
|
1653
|
+
return err(new Error(`Task "${taskId}" is done and cannot accrue failures`));
|
|
1654
|
+
}
|
|
1655
|
+
const failures = (task.consecutive_failures ?? 0) + 1;
|
|
1656
|
+
task.consecutive_failures = failures;
|
|
1657
|
+
const tripped = failures >= BREAKER_TRIP_THRESHOLD || task.frozen === true;
|
|
1658
|
+
if (tripped) {
|
|
1659
|
+
task.consecutive_failures = Math.min(failures, BREAKER_TRIP_THRESHOLD);
|
|
1660
|
+
if (task.frozen !== true) {
|
|
1661
|
+
task.status = "blocked";
|
|
1662
|
+
task.frozen = true;
|
|
1663
|
+
task.blocked_reason = `Circuit breaker tripped after ${BREAKER_TRIP_THRESHOLD} consecutive failures ` + `(last: ${reason}). Escalate to debug agent or /cc-help.`;
|
|
1664
|
+
propagateBlockedTasks(graph);
|
|
1665
|
+
}
|
|
1666
|
+
const write2 = await writeGoal(projectRoot, graph);
|
|
1667
|
+
if (!write2.success)
|
|
1668
|
+
return write2;
|
|
1669
|
+
return ok({ taskId, failures: task.consecutive_failures, tripped: true });
|
|
1670
|
+
}
|
|
1671
|
+
const write = await writeGoal(projectRoot, graph);
|
|
1672
|
+
if (!write.success)
|
|
1673
|
+
return write;
|
|
1674
|
+
return ok({ taskId, failures, tripped: false });
|
|
1675
|
+
}
|
|
1676
|
+
async function unfreezeTask(projectRoot, taskId) {
|
|
1677
|
+
return withQueueLock(projectRoot, () => unfreezeTaskUnlocked(projectRoot, taskId));
|
|
1678
|
+
}
|
|
1679
|
+
async function unfreezeTaskUnlocked(projectRoot, taskId) {
|
|
1680
|
+
const loadResult = await loadGoal(projectRoot);
|
|
1681
|
+
if (!loadResult.success)
|
|
1682
|
+
return loadResult;
|
|
1683
|
+
const graph = loadResult.data;
|
|
1684
|
+
const task = graph.tasks.find((t) => t.id === taskId);
|
|
1685
|
+
if (!task) {
|
|
1686
|
+
return err(new Error(`Task "${taskId}" not found in goal graph`));
|
|
1687
|
+
}
|
|
1688
|
+
task.status = "pending";
|
|
1689
|
+
task.consecutive_failures = 0;
|
|
1690
|
+
task.frozen = false;
|
|
1691
|
+
task.blocked_reason = undefined;
|
|
1692
|
+
return writeGoal(projectRoot, graph);
|
|
1693
|
+
}
|
|
1694
|
+
var GOAL_FILE = ".codeconductor/current-goal.yml", BREAKER_TRIP_THRESHOLD = 3;
|
|
1473
1695
|
var init_goal_state = __esm(() => {
|
|
1474
1696
|
init_schemas();
|
|
1475
1697
|
init_lock();
|
|
@@ -1651,8 +1873,8 @@ async function clearActiveTask(projectRoot, taskId) {
|
|
|
1651
1873
|
// src/core/verification/verification-runner.ts
|
|
1652
1874
|
init_schemas();
|
|
1653
1875
|
import { existsSync } from "node:fs";
|
|
1654
|
-
import { readFile as
|
|
1655
|
-
import { dirname, join as
|
|
1876
|
+
import { readFile as readFile10 } from "node:fs/promises";
|
|
1877
|
+
import { dirname as dirname2, join as join4, resolve as resolve11 } from "node:path";
|
|
1656
1878
|
|
|
1657
1879
|
// src/core/config/config-loader.ts
|
|
1658
1880
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
@@ -1959,7 +2181,7 @@ async function runCompileCheck(options) {
|
|
|
1959
2181
|
// src/core/verification/verification-runner.ts
|
|
1960
2182
|
init_paths();
|
|
1961
2183
|
init_episodic_store();
|
|
1962
|
-
import { mkdir as
|
|
2184
|
+
import { mkdir as mkdir8, readdir as readdir3, writeFile as writeFile6 } from "node:fs/promises";
|
|
1963
2185
|
|
|
1964
2186
|
// src/core/verification/rdd-receipt.ts
|
|
1965
2187
|
import { createHash as createHash2, randomBytes } from "node:crypto";
|
|
@@ -2107,6 +2329,253 @@ async function verifyReceipt(projectRoot, receipt) {
|
|
|
2107
2329
|
};
|
|
2108
2330
|
}
|
|
2109
2331
|
|
|
2332
|
+
// src/core/telemetry/hook-telemetry.ts
|
|
2333
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
2334
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
2335
|
+
import { resolve as resolve10 } from "node:path";
|
|
2336
|
+
|
|
2337
|
+
// src/core/presets/package-paths.ts
|
|
2338
|
+
import { dirname, resolve as resolve7, sep as sep2 } from "node:path";
|
|
2339
|
+
import { fileURLToPath } from "node:url";
|
|
2340
|
+
var moduleDir = dirname(fileURLToPath(import.meta.url));
|
|
2341
|
+
var PACKAGE_ROOT = moduleDir.endsWith(`${sep2}dist`) ? resolve7(moduleDir, "..") : resolve7(moduleDir, "..", "..", "..");
|
|
2342
|
+
var SRC_PRESETS_DIR = resolve7(PACKAGE_ROOT, "src", "presets");
|
|
2343
|
+
var ROOT_PRESETS_DIR = resolve7(PACKAGE_ROOT, "presets");
|
|
2344
|
+
var POLICY_PATH = resolve7(PACKAGE_ROOT, "policy.yml");
|
|
2345
|
+
var SKILLS_REGISTRY_PATH = resolve7(PACKAGE_ROOT, "skills-registry.json");
|
|
2346
|
+
|
|
2347
|
+
// src/core/telemetry/schema.ts
|
|
2348
|
+
import { resolve as resolve8 } from "node:path";
|
|
2349
|
+
var HARNESS_TELEMETRY_SCHEMA = "harness-telemetry/v1";
|
|
2350
|
+
var HARNESS_TELEMETRY_SCHEMA_PATH = resolve8(PACKAGE_ROOT, "schemas", "harness-telemetry.v1.json");
|
|
2351
|
+
var EVENT_NAMES = new Set([
|
|
2352
|
+
"run.start",
|
|
2353
|
+
"run.end",
|
|
2354
|
+
"task.start",
|
|
2355
|
+
"task.end",
|
|
2356
|
+
"agent.end",
|
|
2357
|
+
"model.call",
|
|
2358
|
+
"verification",
|
|
2359
|
+
"retry",
|
|
2360
|
+
"iteration"
|
|
2361
|
+
]);
|
|
2362
|
+
var HARNESS_NAMES = new Set(["codeconductor", "microsdd"]);
|
|
2363
|
+
function isHarnessTelemetryEvent(value) {
|
|
2364
|
+
if (value === null || typeof value !== "object")
|
|
2365
|
+
return false;
|
|
2366
|
+
const v = value;
|
|
2367
|
+
if (v.schema !== HARNESS_TELEMETRY_SCHEMA)
|
|
2368
|
+
return false;
|
|
2369
|
+
if (typeof v.ts !== "string" || v.ts.length === 0)
|
|
2370
|
+
return false;
|
|
2371
|
+
if (typeof v.runId !== "string" || v.runId.length === 0)
|
|
2372
|
+
return false;
|
|
2373
|
+
if (typeof v.event !== "string" || !EVENT_NAMES.has(v.event))
|
|
2374
|
+
return false;
|
|
2375
|
+
if (v.harness === null || typeof v.harness !== "object")
|
|
2376
|
+
return false;
|
|
2377
|
+
const harness = v.harness;
|
|
2378
|
+
if (typeof harness.name !== "string" || !HARNESS_NAMES.has(harness.name))
|
|
2379
|
+
return false;
|
|
2380
|
+
return true;
|
|
2381
|
+
}
|
|
2382
|
+
function assertHarnessTelemetryEvent(value) {
|
|
2383
|
+
if (!isHarnessTelemetryEvent(value)) {
|
|
2384
|
+
throw new Error("Invalid harness-telemetry/v1 event");
|
|
2385
|
+
}
|
|
2386
|
+
return value;
|
|
2387
|
+
}
|
|
2388
|
+
function createBaseEvent(input) {
|
|
2389
|
+
return {
|
|
2390
|
+
schema: HARNESS_TELEMETRY_SCHEMA,
|
|
2391
|
+
ts: input.ts ?? new Date().toISOString(),
|
|
2392
|
+
harness: {
|
|
2393
|
+
name: input.harnessName ?? "codeconductor",
|
|
2394
|
+
version: input.harnessVersion ?? null,
|
|
2395
|
+
commit: input.harnessCommit ?? null,
|
|
2396
|
+
promptCompilerVersion: null,
|
|
2397
|
+
promptFingerprint: null
|
|
2398
|
+
},
|
|
2399
|
+
runId: input.runId,
|
|
2400
|
+
taskId: null,
|
|
2401
|
+
agent: null,
|
|
2402
|
+
event: input.event,
|
|
2403
|
+
host: null,
|
|
2404
|
+
model: null,
|
|
2405
|
+
usage: null,
|
|
2406
|
+
cost: null,
|
|
2407
|
+
loop: null,
|
|
2408
|
+
verification: null,
|
|
2409
|
+
durationMs: null,
|
|
2410
|
+
outcome: null,
|
|
2411
|
+
source: null,
|
|
2412
|
+
privacy: input.privacy ?? "standard"
|
|
2413
|
+
};
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
// src/core/telemetry/store.ts
|
|
2417
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
2418
|
+
import { appendFile as appendFile2, mkdir as mkdir7, readFile as readFile8, readdir as readdir2, unlink as unlink3, writeFile as writeFile5 } from "node:fs/promises";
|
|
2419
|
+
import { join as join3, resolve as resolve9 } from "node:path";
|
|
2420
|
+
import { parse as parseYaml } from "yaml";
|
|
2421
|
+
var TELEMETRY_DIR = ".codeconductor/telemetry";
|
|
2422
|
+
var REPORTS_DIR = ".codeconductor/reports";
|
|
2423
|
+
var PROJECT_CONFIG = ".codeconductor/config.yml";
|
|
2424
|
+
var DEFAULT_REPORT = {
|
|
2425
|
+
level: "off",
|
|
2426
|
+
history: true,
|
|
2427
|
+
privacy: "standard"
|
|
2428
|
+
};
|
|
2429
|
+
async function resolveReportSettings(projectRoot, overrides = {}) {
|
|
2430
|
+
let project = {};
|
|
2431
|
+
try {
|
|
2432
|
+
const raw = await readFile8(resolve9(projectRoot, PROJECT_CONFIG), "utf-8");
|
|
2433
|
+
const data = parseYaml(raw);
|
|
2434
|
+
if (data?.report && typeof data.report === "object") {
|
|
2435
|
+
const r = data.report;
|
|
2436
|
+
project = {
|
|
2437
|
+
level: r.level === "off" || r.level === "minimal" || r.level === "detailed" ? r.level : undefined,
|
|
2438
|
+
history: typeof r.history === "boolean" ? r.history : undefined,
|
|
2439
|
+
privacy: r.privacy === "standard" || r.privacy === "strict" ? r.privacy : undefined
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
} catch {}
|
|
2443
|
+
const envHistory = process.env.CC_REPORT_HISTORY;
|
|
2444
|
+
const envPrivacy = process.env.CC_REPORT_PRIVACY;
|
|
2445
|
+
const envLevel = process.env.CC_REPORT;
|
|
2446
|
+
const level = overrides.level ?? (envLevel === "off" || envLevel === "minimal" || envLevel === "detailed" ? envLevel : undefined) ?? project.level ?? DEFAULT_REPORT.level;
|
|
2447
|
+
const historyCandidates = [
|
|
2448
|
+
overrides.history,
|
|
2449
|
+
envHistory === "false" ? false : envHistory === "true" ? true : undefined,
|
|
2450
|
+
project.history,
|
|
2451
|
+
DEFAULT_REPORT.history
|
|
2452
|
+
].filter((v) => typeof v === "boolean");
|
|
2453
|
+
const history = historyCandidates.includes(false) ? false : historyCandidates[0] ?? DEFAULT_REPORT.history;
|
|
2454
|
+
const privacy = overrides.privacy ?? (envPrivacy === "standard" || envPrivacy === "strict" ? envPrivacy : undefined) ?? project.privacy ?? DEFAULT_REPORT.privacy;
|
|
2455
|
+
return { level, history, privacy };
|
|
2456
|
+
}
|
|
2457
|
+
function applyPrivacy(event, privacy) {
|
|
2458
|
+
const next = { ...event, privacy };
|
|
2459
|
+
if (privacy !== "strict") {
|
|
2460
|
+
if (next.loop?.retryReason && next.loop.retryReason.length > 120) {
|
|
2461
|
+
next.loop = { ...next.loop, retryReason: next.loop.retryReason.slice(0, 120) };
|
|
2462
|
+
}
|
|
2463
|
+
return next;
|
|
2464
|
+
}
|
|
2465
|
+
next.model = next.model ? { id: null, provider: next.model.provider, effort: next.model.effort } : null;
|
|
2466
|
+
next.agent = next.agent ? { role: next.agent.role, agentId: null } : null;
|
|
2467
|
+
if (next.loop?.retryReason) {
|
|
2468
|
+
const hash = createHash3("sha256").update(next.loop.retryReason).digest("hex").slice(0, 16);
|
|
2469
|
+
next.loop = { ...next.loop, retryReason: `sha256:${hash}` };
|
|
2470
|
+
}
|
|
2471
|
+
return next;
|
|
2472
|
+
}
|
|
2473
|
+
async function ensureTelemetryDirs(projectRoot) {
|
|
2474
|
+
const telemetryDir = resolve9(projectRoot, TELEMETRY_DIR);
|
|
2475
|
+
const reportsDir = resolve9(projectRoot, REPORTS_DIR);
|
|
2476
|
+
await mkdir7(telemetryDir, { recursive: true });
|
|
2477
|
+
await mkdir7(reportsDir, { recursive: true });
|
|
2478
|
+
return { telemetryDir, reportsDir };
|
|
2479
|
+
}
|
|
2480
|
+
function telemetryRunPath(projectRoot, runId) {
|
|
2481
|
+
const safe = runId.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
2482
|
+
return resolve9(projectRoot, TELEMETRY_DIR, `${safe}.jsonl`);
|
|
2483
|
+
}
|
|
2484
|
+
async function appendTelemetryEvent(projectRoot, event, options = {}) {
|
|
2485
|
+
try {
|
|
2486
|
+
const settings = await resolveReportSettings(projectRoot, {
|
|
2487
|
+
history: options.history,
|
|
2488
|
+
privacy: options.privacy
|
|
2489
|
+
});
|
|
2490
|
+
if (!settings.history) {
|
|
2491
|
+
return ok({ written: false, path: null });
|
|
2492
|
+
}
|
|
2493
|
+
const validated = assertHarnessTelemetryEvent(event);
|
|
2494
|
+
const scrubbed = applyPrivacy(validated, options.privacy ?? settings.privacy);
|
|
2495
|
+
const { telemetryDir } = await ensureTelemetryDirs(projectRoot);
|
|
2496
|
+
const path = telemetryRunPath(projectRoot, scrubbed.runId);
|
|
2497
|
+
await mkdir7(telemetryDir, { recursive: true });
|
|
2498
|
+
await appendFile2(path, JSON.stringify(scrubbed) + `
|
|
2499
|
+
`, "utf-8");
|
|
2500
|
+
return ok({ written: true, path });
|
|
2501
|
+
} catch (e) {
|
|
2502
|
+
return err(e instanceof Error ? e : new Error(String(e)));
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
// src/core/telemetry/hook-telemetry.ts
|
|
2507
|
+
function formatRetryReason(reason, privacy) {
|
|
2508
|
+
if (privacy === "strict") {
|
|
2509
|
+
return `sha256:${createHash4("sha256").update(reason).digest("hex").slice(0, 16)}`;
|
|
2510
|
+
}
|
|
2511
|
+
return reason.length > 120 ? reason.slice(0, 120) : reason;
|
|
2512
|
+
}
|
|
2513
|
+
async function harnessMeta() {
|
|
2514
|
+
try {
|
|
2515
|
+
const pkg = JSON.parse(await readFile9(resolve10(PACKAGE_ROOT, "package.json"), "utf-8"));
|
|
2516
|
+
return { version: typeof pkg.version === "string" ? pkg.version : null, commit: null };
|
|
2517
|
+
} catch {
|
|
2518
|
+
return { version: null, commit: null };
|
|
2519
|
+
}
|
|
2520
|
+
}
|
|
2521
|
+
async function emit(projectRoot, event) {
|
|
2522
|
+
await appendTelemetryEvent(projectRoot, event);
|
|
2523
|
+
}
|
|
2524
|
+
async function emitLoopIteration(projectRoot, input) {
|
|
2525
|
+
const settings = await resolveReportSettings(projectRoot);
|
|
2526
|
+
const meta = await harnessMeta();
|
|
2527
|
+
const event = createBaseEvent({
|
|
2528
|
+
runId: input.runId,
|
|
2529
|
+
event: "iteration",
|
|
2530
|
+
harnessVersion: meta.version,
|
|
2531
|
+
privacy: settings.privacy
|
|
2532
|
+
});
|
|
2533
|
+
event.taskId = input.taskId ?? null;
|
|
2534
|
+
event.loop = {
|
|
2535
|
+
iteration: input.iteration,
|
|
2536
|
+
retryReason: null,
|
|
2537
|
+
maxIterations: input.maxIterations
|
|
2538
|
+
};
|
|
2539
|
+
event.source = { usage: "harness", reliability: "high" };
|
|
2540
|
+
await emit(projectRoot, event);
|
|
2541
|
+
}
|
|
2542
|
+
async function emitLoopRetry(projectRoot, input) {
|
|
2543
|
+
const settings = await resolveReportSettings(projectRoot);
|
|
2544
|
+
const meta = await harnessMeta();
|
|
2545
|
+
const event = createBaseEvent({
|
|
2546
|
+
runId: input.runId,
|
|
2547
|
+
event: "retry",
|
|
2548
|
+
harnessVersion: meta.version,
|
|
2549
|
+
privacy: settings.privacy
|
|
2550
|
+
});
|
|
2551
|
+
event.taskId = input.taskId ?? null;
|
|
2552
|
+
event.loop = {
|
|
2553
|
+
iteration: input.iteration,
|
|
2554
|
+
retryReason: formatRetryReason(input.feedback, settings.privacy),
|
|
2555
|
+
maxIterations: input.maxIterations
|
|
2556
|
+
};
|
|
2557
|
+
event.source = { usage: "harness", reliability: "high" };
|
|
2558
|
+
await emit(projectRoot, event);
|
|
2559
|
+
}
|
|
2560
|
+
async function emitVerificationGate(projectRoot, input) {
|
|
2561
|
+
const settings = await resolveReportSettings(projectRoot);
|
|
2562
|
+
const meta = await harnessMeta();
|
|
2563
|
+
const event = createBaseEvent({
|
|
2564
|
+
runId: input.runId,
|
|
2565
|
+
event: "verification",
|
|
2566
|
+
harnessVersion: meta.version,
|
|
2567
|
+
privacy: settings.privacy
|
|
2568
|
+
});
|
|
2569
|
+
event.taskId = input.taskId;
|
|
2570
|
+
event.verification = {
|
|
2571
|
+
gate: input.gate,
|
|
2572
|
+
passed: input.passed,
|
|
2573
|
+
durationMs: input.durationMs ?? null
|
|
2574
|
+
};
|
|
2575
|
+
event.source = { usage: "harness", reliability: "high" };
|
|
2576
|
+
await emit(projectRoot, event);
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2110
2579
|
// src/core/verification/verification-runner.ts
|
|
2111
2580
|
function isPassingEvidence(ev) {
|
|
2112
2581
|
switch (ev.type) {
|
|
@@ -2133,8 +2602,8 @@ async function isCurrentPassingEvidence(projectRoot, ev) {
|
|
|
2133
2602
|
return (await verifyReceipt(projectRoot, receipt)).valid;
|
|
2134
2603
|
}
|
|
2135
2604
|
function evidenceFilePath(evDir, id) {
|
|
2136
|
-
const path =
|
|
2137
|
-
if (
|
|
2605
|
+
const path = resolve11(evDir, `${id.replace(/[^A-Za-z0-9_-]/g, "_")}.json`);
|
|
2606
|
+
if (dirname2(path) !== resolve11(evDir)) {
|
|
2138
2607
|
return err(new Error(`Refusing to write evidence for "${id}" outside ${evDir}`));
|
|
2139
2608
|
}
|
|
2140
2609
|
return ok(path);
|
|
@@ -2145,8 +2614,8 @@ async function persistEvidence(projectRoot, evidence) {
|
|
|
2145
2614
|
if (!evidencePath.success)
|
|
2146
2615
|
return evidencePath;
|
|
2147
2616
|
try {
|
|
2148
|
-
await
|
|
2149
|
-
await
|
|
2617
|
+
await mkdir8(evDir, { recursive: true });
|
|
2618
|
+
await writeFile6(evidencePath.data, JSON.stringify(evidence, null, 2), "utf-8");
|
|
2150
2619
|
} catch (e) {
|
|
2151
2620
|
return err(e instanceof Error ? e : new Error(String(e)));
|
|
2152
2621
|
}
|
|
@@ -2160,7 +2629,7 @@ async function collectTaskEvidence(projectRoot, taskId) {
|
|
|
2160
2629
|
return ok({ records, invalid });
|
|
2161
2630
|
let files;
|
|
2162
2631
|
try {
|
|
2163
|
-
files = await
|
|
2632
|
+
files = await readdir3(evDir);
|
|
2164
2633
|
} catch (e) {
|
|
2165
2634
|
return err(e instanceof Error ? e : new Error(String(e)));
|
|
2166
2635
|
}
|
|
@@ -2168,7 +2637,7 @@ async function collectTaskEvidence(projectRoot, taskId) {
|
|
|
2168
2637
|
if (!file.endsWith(".json"))
|
|
2169
2638
|
continue;
|
|
2170
2639
|
try {
|
|
2171
|
-
const raw = await
|
|
2640
|
+
const raw = await readFile10(join4(evDir, file), "utf-8");
|
|
2172
2641
|
const ev = EvidenceSchema.parse(JSON.parse(raw));
|
|
2173
2642
|
if (ev.relatedTask === taskId)
|
|
2174
2643
|
records.push(ev);
|
|
@@ -2312,6 +2781,16 @@ async function runVerification(projectRoot, taskId, goal, options) {
|
|
|
2312
2781
|
});
|
|
2313
2782
|
if (!event.success)
|
|
2314
2783
|
return event;
|
|
2784
|
+
const runId = `r-verify-${taskId}`;
|
|
2785
|
+
for (const check of checks) {
|
|
2786
|
+
await emitVerificationGate(projectRoot, {
|
|
2787
|
+
runId,
|
|
2788
|
+
taskId,
|
|
2789
|
+
gate: check.name,
|
|
2790
|
+
passed: check.passed,
|
|
2791
|
+
durationMs: null
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2315
2794
|
return ok({ passed, checks, evidenceIds });
|
|
2316
2795
|
}
|
|
2317
2796
|
async function gateTaskCompletion(projectRoot, taskId, evidenceRequired, evidenceIds) {
|
|
@@ -2422,7 +2901,7 @@ async function readRunnerTddEvidence(projectRoot, taskId, evidenceId) {
|
|
|
2422
2901
|
return path;
|
|
2423
2902
|
let raw;
|
|
2424
2903
|
try {
|
|
2425
|
-
raw = await
|
|
2904
|
+
raw = await readFile10(path.data, "utf-8");
|
|
2426
2905
|
} catch (e) {
|
|
2427
2906
|
return err(e instanceof Error ? e : new Error(String(e)));
|
|
2428
2907
|
}
|
|
@@ -2470,14 +2949,14 @@ async function listRunnerTddRecords(projectRoot, taskId) {
|
|
|
2470
2949
|
return collected.data.records.filter((ev) => ev.type === "tdd" && ev.source === TDD_EVIDENCE_SOURCE && ev.data?.capturedBy === TDD_CAPTURED_BY);
|
|
2471
2950
|
}
|
|
2472
2951
|
function tddValidationFilePath(projectRoot, taskId) {
|
|
2473
|
-
return evidenceFilePath(
|
|
2952
|
+
return evidenceFilePath(join4(resolve11(projectRoot), ".codeconductor", "tdd-validations"), taskId);
|
|
2474
2953
|
}
|
|
2475
2954
|
async function loadTddValidation(projectRoot, taskId) {
|
|
2476
2955
|
const path = tddValidationFilePath(projectRoot, taskId);
|
|
2477
2956
|
if (!path.success)
|
|
2478
2957
|
return;
|
|
2479
2958
|
try {
|
|
2480
|
-
const record = TddValidationRecordSchema.parse(JSON.parse(await
|
|
2959
|
+
const record = TddValidationRecordSchema.parse(JSON.parse(await readFile10(path.data, "utf-8")));
|
|
2481
2960
|
return record.taskId === taskId ? record : undefined;
|
|
2482
2961
|
} catch {
|
|
2483
2962
|
return;
|
|
@@ -2504,8 +2983,165 @@ async function hasTddRunnerEvidence(projectRoot, taskId, expectedPhase) {
|
|
|
2504
2983
|
}
|
|
2505
2984
|
return false;
|
|
2506
2985
|
}
|
|
2986
|
+
// src/core/hooks/hook-runner.ts
|
|
2987
|
+
var DEFAULT_PROTECTED_PATTERNS = [
|
|
2988
|
+
"tests/",
|
|
2989
|
+
"test/",
|
|
2990
|
+
"specs/",
|
|
2991
|
+
"contracts/",
|
|
2992
|
+
".test.",
|
|
2993
|
+
".spec.",
|
|
2994
|
+
"_test.",
|
|
2995
|
+
"_spec."
|
|
2996
|
+
];
|
|
2997
|
+
function normalizeHookPath(filePath, path) {
|
|
2998
|
+
const windowsPath = filePath.includes("\\") || /^[a-z]:\//i.test(filePath);
|
|
2999
|
+
const normalized = path.replace(/\\/g, "/");
|
|
3000
|
+
return windowsPath ? normalized.toLowerCase() : normalized;
|
|
3001
|
+
}
|
|
3002
|
+
function scopeMatchesFile(filePath, scopeFiles) {
|
|
3003
|
+
if (scopeFiles.length === 0)
|
|
3004
|
+
return false;
|
|
3005
|
+
const normalizedPath = normalizeHookPath(filePath, filePath);
|
|
3006
|
+
return scopeFiles.some((entry) => {
|
|
3007
|
+
const pattern = normalizeHookPath(filePath, entry).replace(/\*\*/g, "");
|
|
3008
|
+
return pattern !== "" && normalizedPath.includes(pattern);
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
function evaluateScopeAccess(filePath, scopeFiles) {
|
|
3012
|
+
if (scopeFiles.length === 0)
|
|
3013
|
+
return { allowed: true };
|
|
3014
|
+
if (!scopeMatchesFile(filePath, scopeFiles)) {
|
|
3015
|
+
return { allowed: false, reason: `ScopeViolation: File '${filePath}' is outside the task scope.` };
|
|
3016
|
+
}
|
|
3017
|
+
return { allowed: true };
|
|
3018
|
+
}
|
|
3019
|
+
var DISPATCH_MODES = [
|
|
3020
|
+
"full",
|
|
3021
|
+
"surgical-fix",
|
|
3022
|
+
"refactor-only",
|
|
3023
|
+
"test-add",
|
|
3024
|
+
"scaffold",
|
|
3025
|
+
"rename-move",
|
|
3026
|
+
"dep-bump"
|
|
3027
|
+
];
|
|
3028
|
+
function isDispatchMode(raw) {
|
|
3029
|
+
return typeof raw === "string" && DISPATCH_MODES.includes(raw);
|
|
3030
|
+
}
|
|
3031
|
+
var DEP_MANIFESTS = new Set([
|
|
3032
|
+
"package.json",
|
|
3033
|
+
"package-lock.json",
|
|
3034
|
+
"bun.lock",
|
|
3035
|
+
"yarn.lock",
|
|
3036
|
+
"pnpm-lock.yaml",
|
|
3037
|
+
"cargo.toml",
|
|
3038
|
+
"cargo.lock",
|
|
3039
|
+
"go.mod",
|
|
3040
|
+
"go.sum",
|
|
3041
|
+
"requirements.txt",
|
|
3042
|
+
"pyproject.toml",
|
|
3043
|
+
"poetry.lock",
|
|
3044
|
+
"gemfile",
|
|
3045
|
+
"gemfile.lock",
|
|
3046
|
+
"pom.xml",
|
|
3047
|
+
"build.gradle",
|
|
3048
|
+
"build.gradle.kts",
|
|
3049
|
+
"composer.json",
|
|
3050
|
+
"composer.lock"
|
|
3051
|
+
]);
|
|
3052
|
+
function isTestFile(filePath) {
|
|
3053
|
+
const normalized = normalizeHookPath(filePath, filePath);
|
|
3054
|
+
return DEFAULT_PROTECTED_PATTERNS.some((p) => normalized.includes(normalizeHookPath(filePath, p)));
|
|
3055
|
+
}
|
|
3056
|
+
function evaluateDispatchMode(mode, input) {
|
|
3057
|
+
const { filePath, command } = input;
|
|
3058
|
+
if (mode === "rename-move") {
|
|
3059
|
+
if (filePath) {
|
|
3060
|
+
return { allowed: false, reason: `DispatchMode(rename-move): file writes denied, rename via git mv instead of touching '${filePath}'.` };
|
|
3061
|
+
}
|
|
3062
|
+
if (command) {
|
|
3063
|
+
const normalized = stripGitBinary(normalizeCommand(command));
|
|
3064
|
+
if (/^git\s+mv\b/i.test(normalized))
|
|
3065
|
+
return { allowed: true };
|
|
3066
|
+
return { allowed: false, reason: "DispatchMode(rename-move): only `git mv` commands allowed." };
|
|
3067
|
+
}
|
|
3068
|
+
return { allowed: true };
|
|
3069
|
+
}
|
|
3070
|
+
if (!filePath)
|
|
3071
|
+
return { allowed: true };
|
|
3072
|
+
switch (mode) {
|
|
3073
|
+
case "full":
|
|
3074
|
+
if (isTestFile(filePath)) {
|
|
3075
|
+
return { allowed: false, reason: `DispatchMode(full): test files are read-only, use test-add for '${filePath}'.` };
|
|
3076
|
+
}
|
|
3077
|
+
return { allowed: true };
|
|
3078
|
+
case "surgical-fix": {
|
|
3079
|
+
if (!input.scopeFiles || input.scopeFiles.length === 0) {
|
|
3080
|
+
return { allowed: false, reason: "DispatchMode(surgical-fix): requires --scope with the task boundary." };
|
|
3081
|
+
}
|
|
3082
|
+
const scope = evaluateScopeAccess(filePath, input.scopeFiles);
|
|
3083
|
+
if (!scope.allowed)
|
|
3084
|
+
return scope;
|
|
3085
|
+
if (input.exists !== true) {
|
|
3086
|
+
return {
|
|
3087
|
+
allowed: false,
|
|
3088
|
+
reason: input.exists === false ? `DispatchMode(surgical-fix): no new files, use scaffold for '${filePath}'.` : `DispatchMode(surgical-fix): cannot verify '${filePath}' exists.`
|
|
3089
|
+
};
|
|
3090
|
+
}
|
|
3091
|
+
if (isTestFile(filePath)) {
|
|
3092
|
+
return { allowed: false, reason: `DispatchMode(surgical-fix): tests are frozen, '${filePath}' is out of mode.` };
|
|
3093
|
+
}
|
|
3094
|
+
return { allowed: true };
|
|
3095
|
+
}
|
|
3096
|
+
case "refactor-only":
|
|
3097
|
+
if (input.exists !== true) {
|
|
3098
|
+
return {
|
|
3099
|
+
allowed: false,
|
|
3100
|
+
reason: input.exists === false ? `DispatchMode(refactor-only): no new files, use scaffold for '${filePath}'.` : `DispatchMode(refactor-only): cannot verify '${filePath}' exists.`
|
|
3101
|
+
};
|
|
3102
|
+
}
|
|
3103
|
+
return { allowed: true };
|
|
3104
|
+
case "test-add":
|
|
3105
|
+
if (!isTestFile(filePath)) {
|
|
3106
|
+
return { allowed: false, reason: `DispatchMode(test-add): only test files are writable, got '${filePath}'.` };
|
|
3107
|
+
}
|
|
3108
|
+
return { allowed: true };
|
|
3109
|
+
case "scaffold":
|
|
3110
|
+
if (input.exists !== false) {
|
|
3111
|
+
return {
|
|
3112
|
+
allowed: false,
|
|
3113
|
+
reason: input.exists === true ? `DispatchMode(scaffold): '${filePath}' already exists.` : `DispatchMode(scaffold): cannot verify '${filePath}' is new.`
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
3116
|
+
return { allowed: true };
|
|
3117
|
+
case "dep-bump": {
|
|
3118
|
+
const base = filePath.replace(/\\/g, "/").split("/").pop().toLowerCase();
|
|
3119
|
+
if (!DEP_MANIFESTS.has(base)) {
|
|
3120
|
+
return { allowed: false, reason: `DispatchMode(dep-bump): only manifests/lockfiles are writable, got '${filePath}'.` };
|
|
3121
|
+
}
|
|
3122
|
+
return { allowed: true };
|
|
3123
|
+
}
|
|
3124
|
+
default: {
|
|
3125
|
+
const _exhaustive = mode;
|
|
3126
|
+
return { allowed: true };
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
var DELEGATION_TOOLS = new Set(["task", "subagent"]);
|
|
3131
|
+
function normalizeCommand(raw) {
|
|
3132
|
+
return raw.replace(/\s+/g, " ").trim();
|
|
3133
|
+
}
|
|
3134
|
+
function stripGitBinary(command) {
|
|
3135
|
+
const match = command.match(/^(?:&\s*)?("[^"]+"|'[^']+'|[^\s]+)([\s\S]*)$/);
|
|
3136
|
+
if (!match)
|
|
3137
|
+
return command;
|
|
3138
|
+
const binary = match[1].replace(/^["']|["']$/g, "").replace(/\\/g, "/").split("/").pop();
|
|
3139
|
+
return /^git(?:\.exe)?$/i.test(binary ?? "") ? `git${match[2]}` : command;
|
|
3140
|
+
}
|
|
2507
3141
|
|
|
2508
3142
|
// src/core/orchestrator/runtime-orchestrator.ts
|
|
3143
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
3144
|
+
import { join as join5 } from "node:path";
|
|
2509
3145
|
async function rollbackTaskStatus(projectRoot, graph, task, previousStatus, previousState, cause) {
|
|
2510
3146
|
return withQueueLock(projectRoot, async () => {
|
|
2511
3147
|
task.status = previousStatus;
|
|
@@ -2567,16 +3203,49 @@ function buildTaskEnvelope(card, projectRoot, projectName) {
|
|
|
2567
3203
|
}
|
|
2568
3204
|
};
|
|
2569
3205
|
}
|
|
2570
|
-
|
|
2571
|
-
|
|
3206
|
+
function taskTypeToDispatchMode(type) {
|
|
3207
|
+
switch (type) {
|
|
3208
|
+
case "fix":
|
|
3209
|
+
return "surgical-fix";
|
|
3210
|
+
case "refactor":
|
|
3211
|
+
return "refactor-only";
|
|
3212
|
+
case "test":
|
|
3213
|
+
return "test-add";
|
|
3214
|
+
case "feature":
|
|
3215
|
+
case "docs":
|
|
3216
|
+
return "full";
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
function resolveEffectiveMode(type, override) {
|
|
3220
|
+
if (override === undefined)
|
|
3221
|
+
return ok(taskTypeToDispatchMode(type));
|
|
3222
|
+
if (!isDispatchMode(override)) {
|
|
3223
|
+
return err(new Error(`Unknown dispatch mode: ${override}. Use: ${DISPATCH_MODES.join(", ")}`));
|
|
3224
|
+
}
|
|
3225
|
+
return ok(override);
|
|
3226
|
+
}
|
|
3227
|
+
function checkDispatchClearance(projectRoot, mode, targetFiles) {
|
|
3228
|
+
for (const file of targetFiles) {
|
|
3229
|
+
const verdict = evaluateDispatchMode(mode, {
|
|
3230
|
+
filePath: file,
|
|
3231
|
+
scopeFiles: targetFiles,
|
|
3232
|
+
exists: existsSync2(join5(projectRoot, file))
|
|
3233
|
+
});
|
|
3234
|
+
if (!verdict.allowed)
|
|
3235
|
+
return err(new Error(`Dispatch denied: ${verdict.reason}`));
|
|
3236
|
+
}
|
|
3237
|
+
return ok(undefined);
|
|
3238
|
+
}
|
|
3239
|
+
async function getNextTask(projectRoot, projectName, dispatchMode) {
|
|
3240
|
+
return withQueueLock(projectRoot, () => getNextTaskUnlocked(projectRoot, projectName, dispatchMode));
|
|
2572
3241
|
}
|
|
2573
|
-
async function startTask(projectRoot, taskId, agent) {
|
|
2574
|
-
return withQueueLock(projectRoot, () => startTaskUnlocked(projectRoot, taskId, agent));
|
|
3242
|
+
async function startTask(projectRoot, taskId, agent, dispatchMode) {
|
|
3243
|
+
return withQueueLock(projectRoot, () => startTaskUnlocked(projectRoot, taskId, agent, dispatchMode));
|
|
2575
3244
|
}
|
|
2576
3245
|
async function completeTask(projectRoot, taskId, evidenceIds) {
|
|
2577
3246
|
return withQueueLock(projectRoot, () => completeTaskUnlocked(projectRoot, taskId, evidenceIds));
|
|
2578
3247
|
}
|
|
2579
|
-
async function getNextTaskUnlocked(projectRoot, projectName) {
|
|
3248
|
+
async function getNextTaskUnlocked(projectRoot, projectName, dispatchOverride) {
|
|
2580
3249
|
const goalResult = await loadGoal(projectRoot);
|
|
2581
3250
|
if (!goalResult.success)
|
|
2582
3251
|
return goalResult;
|
|
@@ -2594,15 +3263,23 @@ async function getNextTaskUnlocked(projectRoot, projectName) {
|
|
|
2594
3263
|
}
|
|
2595
3264
|
const task = ready[0];
|
|
2596
3265
|
const enrichedTask = enriched.enrichedTasks.find((t) => t.id === task.id);
|
|
3266
|
+
const effective = resolveEffectiveMode(enrichedTask.type, dispatchOverride);
|
|
3267
|
+
if (!effective.success)
|
|
3268
|
+
return effective;
|
|
3269
|
+
const dispatchMode = effective.data;
|
|
3270
|
+
const clearance = checkDispatchClearance(projectRoot, dispatchMode, enrichedTask.targetFiles);
|
|
3271
|
+
if (!clearance.success)
|
|
3272
|
+
return clearance;
|
|
2597
3273
|
const card = goalTaskToCanonicalCard(enrichedTask, enriched.objective);
|
|
2598
3274
|
const envelope = buildTaskEnvelope(card, projectRoot, projectName);
|
|
2599
3275
|
return ok({
|
|
2600
3276
|
task: card,
|
|
2601
3277
|
envelope,
|
|
2602
|
-
readyCount: ready.length
|
|
3278
|
+
readyCount: ready.length,
|
|
3279
|
+
dispatchMode
|
|
2603
3280
|
});
|
|
2604
3281
|
}
|
|
2605
|
-
async function startTaskUnlocked(projectRoot, taskId, agent) {
|
|
3282
|
+
async function startTaskUnlocked(projectRoot, taskId, agent, dispatchOverride) {
|
|
2606
3283
|
const goalResult = await loadGoal(projectRoot);
|
|
2607
3284
|
if (!goalResult.success)
|
|
2608
3285
|
return goalResult;
|
|
@@ -2616,6 +3293,15 @@ async function startTaskUnlocked(projectRoot, taskId, agent) {
|
|
|
2616
3293
|
const unmet = (task.depends_on ?? []).filter((id) => !done.has(id));
|
|
2617
3294
|
if (unmet.length > 0)
|
|
2618
3295
|
return err(new Error(`Task ${taskId} has unmet dependencies: ${unmet.join(", ")}`));
|
|
3296
|
+
const graphResult = await loadGraph(projectRoot);
|
|
3297
|
+
const enriched = enrichGoalWithProduct(goalResult.data, graphResult.success ? graphResult.data : undefined);
|
|
3298
|
+
const enrichedTask = enriched.enrichedTasks.find((t) => t.id === taskId);
|
|
3299
|
+
const effective = resolveEffectiveMode(task.type, dispatchOverride);
|
|
3300
|
+
if (!effective.success)
|
|
3301
|
+
return effective;
|
|
3302
|
+
const clearance = checkDispatchClearance(projectRoot, effective.data, enrichedTask?.targetFiles ?? []);
|
|
3303
|
+
if (!clearance.success)
|
|
3304
|
+
return clearance;
|
|
2619
3305
|
const stateBefore = await loadOperationalState(projectRoot);
|
|
2620
3306
|
if (!stateBefore.success)
|
|
2621
3307
|
return stateBefore;
|
|
@@ -3024,10 +3710,18 @@ async function runLoop(generateFn, compileCheckFn, config = {}, taskTitle = "com
|
|
|
3024
3710
|
let feedbackText;
|
|
3025
3711
|
let compileCheck;
|
|
3026
3712
|
let compileCheckSkipReason;
|
|
3713
|
+
const projectRoot = config.cwd ?? process.cwd();
|
|
3714
|
+
const loopRunId = `r-loop-${Date.now().toString(36)}`;
|
|
3027
3715
|
logTransition(state.phase, "INIT", state.iteration);
|
|
3028
3716
|
const startResult = loopStateMachine(state, { type: "START" });
|
|
3029
3717
|
state = startResult.state;
|
|
3030
3718
|
logTransition(state.phase, "START", state.iteration);
|
|
3719
|
+
await emitLoopIteration(projectRoot, {
|
|
3720
|
+
runId: loopRunId,
|
|
3721
|
+
taskId: taskTitle,
|
|
3722
|
+
iteration: state.iteration,
|
|
3723
|
+
maxIterations
|
|
3724
|
+
});
|
|
3031
3725
|
while (true) {
|
|
3032
3726
|
const hit = await engine.evaluate();
|
|
3033
3727
|
if (hit) {
|
|
@@ -3076,9 +3770,22 @@ async function runLoop(generateFn, compileCheckFn, config = {}, taskTitle = "com
|
|
|
3076
3770
|
case "FEEDBACK": {
|
|
3077
3771
|
logTransition(state.phase, "FORMAT_FEEDBACK", state.iteration);
|
|
3078
3772
|
feedbackText = formatFeedback(state.errors);
|
|
3773
|
+
await emitLoopRetry(projectRoot, {
|
|
3774
|
+
runId: loopRunId,
|
|
3775
|
+
taskId: taskTitle,
|
|
3776
|
+
iteration: state.iteration,
|
|
3777
|
+
maxIterations,
|
|
3778
|
+
feedback: feedbackText
|
|
3779
|
+
});
|
|
3079
3780
|
const fbResult = loopStateMachine(state, { type: "FEEDBACK_FORMATTED" });
|
|
3080
3781
|
state = fbResult.state;
|
|
3081
3782
|
logTransition(state.phase, "FEEDBACK_FORMATTED", state.iteration);
|
|
3783
|
+
await emitLoopIteration(projectRoot, {
|
|
3784
|
+
runId: loopRunId,
|
|
3785
|
+
taskId: taskTitle,
|
|
3786
|
+
iteration: state.iteration,
|
|
3787
|
+
maxIterations
|
|
3788
|
+
});
|
|
3082
3789
|
break;
|
|
3083
3790
|
}
|
|
3084
3791
|
case "DONE": {
|
|
@@ -3261,6 +3968,7 @@ async function runLoopForProject(projectRoot, options) {
|
|
|
3261
3968
|
|
|
3262
3969
|
// src/index.ts
|
|
3263
3970
|
init_schemas();
|
|
3971
|
+
init_scoped_context_schemas();
|
|
3264
3972
|
export {
|
|
3265
3973
|
AgentArtifactSchema,
|
|
3266
3974
|
AgentContractSchema,
|
|
@@ -3277,11 +3985,14 @@ export {
|
|
|
3277
3985
|
CcepOutputFormatSchema,
|
|
3278
3986
|
ClaudeAgentFileSchema,
|
|
3279
3987
|
CodeConductorConfigSchema,
|
|
3988
|
+
CodeIndexSchema,
|
|
3989
|
+
CodeIndexSymbolSchema,
|
|
3280
3990
|
CommandEnvelopeSchema,
|
|
3281
3991
|
CommandFrontmatterSchema,
|
|
3282
3992
|
CompileCheckConfigSchema,
|
|
3283
3993
|
ConfidenceLevelSchema,
|
|
3284
3994
|
ConsensusConfigSchema,
|
|
3995
|
+
ContextManifestSchema,
|
|
3285
3996
|
ContractFormatSchema,
|
|
3286
3997
|
ContractTargetSchema,
|
|
3287
3998
|
CouncilAgentSpecSchema,
|
|
@@ -3295,6 +4006,9 @@ export {
|
|
|
3295
4006
|
DeliveryLedgerTaskSchema,
|
|
3296
4007
|
DeliveryRouteSchema,
|
|
3297
4008
|
DeliveryTelemetrySchema,
|
|
4009
|
+
DependencyEvidenceSchema,
|
|
4010
|
+
DetectionStatusSchema,
|
|
4011
|
+
EdgeCaseSchema,
|
|
3298
4012
|
EvaluationIndexSchema,
|
|
3299
4013
|
EvidenceSchema,
|
|
3300
4014
|
ExecutionContextSchema,
|
|
@@ -3332,6 +4046,7 @@ export {
|
|
|
3332
4046
|
OpenspecTaskCardSchema,
|
|
3333
4047
|
OpenspecTaskCardStatusSchema,
|
|
3334
4048
|
OperationalStateSchema,
|
|
4049
|
+
OriginClassSchema,
|
|
3335
4050
|
PermissionProviderNamesSchema,
|
|
3336
4051
|
PlannerOutputSchema,
|
|
3337
4052
|
ProductEventSchema,
|
|
@@ -3342,10 +4057,18 @@ export {
|
|
|
3342
4057
|
ProductMetaSchema,
|
|
3343
4058
|
ProductNodeTypeSchema,
|
|
3344
4059
|
ProjectProfileSchema,
|
|
4060
|
+
ProjectScopeProfileSchema,
|
|
4061
|
+
RecipeStatusSchema,
|
|
4062
|
+
RecipeStepSchema,
|
|
3345
4063
|
ReviewAxisSchema,
|
|
3346
4064
|
ReviewFindingSchema,
|
|
3347
4065
|
ReviewerOutputSchema,
|
|
4066
|
+
RuleKindSchema,
|
|
4067
|
+
RuleViewSchema,
|
|
3348
4068
|
RunnerTargetSchema,
|
|
4069
|
+
ScopedContextSchema,
|
|
4070
|
+
ScopedRuleFileSchema,
|
|
4071
|
+
ScopedRuleSchema,
|
|
3349
4072
|
ScorecardCriterionIdSchema,
|
|
3350
4073
|
ScorecardCriterionSchema,
|
|
3351
4074
|
ScorecardRecordSchema,
|
|
@@ -3365,6 +4088,7 @@ export {
|
|
|
3365
4088
|
TechnicalPlanOutputSchema,
|
|
3366
4089
|
TokenUsageSchema,
|
|
3367
4090
|
ToolProviderNamesSchema,
|
|
4091
|
+
VerificationRecipeSchema,
|
|
3368
4092
|
VerificationReportSchema,
|
|
3369
4093
|
WorkflowCommandSchema,
|
|
3370
4094
|
WorkflowPhaseSchema,
|