voratiq 0.1.0-beta.21 → 0.1.0-beta.23
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 +19 -23
- package/dist/agents/launch/chat.d.ts +3 -1
- package/dist/agents/launch/chat.js +2 -0
- package/dist/agents/runtime/policy.js +2 -1
- package/dist/auth/providers/utils.js +1 -1
- package/dist/bin.js +28 -7
- package/dist/cli/auto.js +4 -16
- package/dist/cli/contract.d.ts +26 -17
- package/dist/cli/contract.js +3 -1
- package/dist/cli/doctor.d.ts +12 -0
- package/dist/cli/doctor.js +115 -0
- package/dist/cli/list.js +5 -1
- package/dist/cli/message.js +16 -11
- package/dist/cli/operator-envelope.d.ts +27 -7
- package/dist/cli/operator-envelope.js +95 -3
- package/dist/cli/option-parsers.d.ts +2 -0
- package/dist/cli/option-parsers.js +7 -0
- package/dist/cli/output.d.ts +1 -5
- package/dist/cli/reduce.js +5 -13
- package/dist/cli/run.js +5 -12
- package/dist/cli/spec.js +4 -10
- package/dist/cli/verify.d.ts +1 -1
- package/dist/cli/verify.js +51 -22
- package/dist/commands/auto/command.d.ts +1 -0
- package/dist/commands/auto/command.js +22 -15
- package/dist/commands/auto/errors.js +1 -1
- package/dist/commands/auto/validation.js +3 -1
- package/dist/commands/doctor/agents.d.ts +5 -0
- package/dist/commands/{init → doctor}/agents.js +40 -20
- package/dist/commands/doctor/command.d.ts +22 -0
- package/dist/commands/doctor/command.js +100 -0
- package/dist/commands/doctor/environment.d.ts +2 -0
- package/dist/commands/{init → doctor}/environment.js +41 -7
- package/dist/commands/{init/types.d.ts → doctor/fix-types.d.ts} +30 -9
- package/dist/commands/doctor/fix.d.ts +2 -0
- package/dist/commands/{init/command.js → doctor/fix.js} +109 -11
- package/dist/commands/doctor/reconcile.d.ts +2 -0
- package/dist/commands/doctor/reconcile.js +103 -0
- package/dist/commands/interactive/lifecycle.d.ts +2 -0
- package/dist/commands/interactive/lifecycle.js +16 -0
- package/dist/commands/list/command.d.ts +1 -0
- package/dist/commands/list/command.js +241 -361
- package/dist/commands/list/normalization.d.ts +51 -0
- package/dist/commands/list/normalization.js +309 -0
- package/dist/commands/list/records.d.ts +9 -0
- package/dist/commands/list/records.js +6 -0
- package/dist/commands/message/command.d.ts +2 -2
- package/dist/commands/message/command.js +29 -16
- package/dist/commands/message/errors.d.ts +12 -3
- package/dist/commands/message/errors.js +19 -3
- package/dist/commands/prune/command.js +4 -1
- package/dist/commands/reduce/command.js +16 -17
- package/dist/commands/reduce/errors.d.ts +2 -2
- package/dist/commands/reduce/errors.js +3 -3
- package/dist/commands/reduce/targets.js +12 -3
- package/dist/commands/root-launcher/command.js +12 -6
- package/dist/commands/run/command.d.ts +1 -0
- package/dist/commands/run/command.js +4 -1
- package/dist/commands/run/record-init.d.ts +2 -0
- package/dist/commands/run/record-init.js +8 -1
- package/dist/commands/run/spec-provenance.d.ts +37 -0
- package/dist/commands/run/spec-provenance.js +384 -0
- package/dist/commands/run/validation.d.ts +4 -0
- package/dist/commands/run/validation.js +25 -62
- package/dist/commands/shared/resolve-stage-competitors.js +2 -1
- package/dist/commands/spec/command.js +64 -138
- package/dist/commands/spec/errors.d.ts +5 -0
- package/dist/commands/spec/errors.js +9 -0
- package/dist/commands/verify/agents.d.ts +4 -2
- package/dist/commands/verify/agents.js +4 -11
- package/dist/commands/verify/command.js +23 -6
- package/dist/commands/verify/errors.d.ts +12 -0
- package/dist/commands/verify/errors.js +22 -0
- package/dist/commands/verify/lifecycle.js +1 -1
- package/dist/commands/verify/targets.js +108 -12
- package/dist/competition/shared/preflight.d.ts +1 -1
- package/dist/competition/shared/preflight.js +15 -2
- package/dist/competition/shared/teardown.d.ts +7 -0
- package/dist/competition/shared/teardown.js +6 -0
- package/dist/configs/agents/defaults.js +13 -44
- package/dist/configs/agents/loader.js +1 -1
- package/dist/configs/environment/loader.js +2 -1
- package/dist/configs/orchestration/loader.js +2 -1
- package/dist/configs/sandbox/loader.js +2 -1
- package/dist/configs/settings/loader.js +1 -1
- package/dist/configs/verification/loader.js +2 -1
- package/dist/contracts/list.d.ts +129 -149
- package/dist/contracts/list.js +47 -99
- package/dist/domain/interactive/model/types.d.ts +2 -0
- package/dist/domain/interactive/model/types.js +16 -1
- package/dist/domain/interactive/persistence/adapter.d.ts +23 -0
- package/dist/domain/interactive/persistence/adapter.js +67 -5
- package/dist/domain/interactive/prompt.d.ts +1 -1
- package/dist/domain/interactive/prompt.js +1 -1
- package/dist/domain/interactive/session-env.d.ts +10 -0
- package/dist/domain/interactive/session-env.js +25 -0
- package/dist/domain/message/competition/adapter.js +3 -9
- package/dist/domain/message/model/types.d.ts +32 -1
- package/dist/domain/message/model/types.js +25 -1
- package/dist/domain/reduce/competition/adapter.js +30 -16
- package/dist/domain/reduce/competition/finalize.d.ts +7 -0
- package/dist/domain/reduce/competition/finalize.js +19 -0
- package/dist/domain/reduce/model/types.d.ts +3 -3
- package/dist/domain/run/competition/agents/artifacts.js +4 -2
- package/dist/domain/run/competition/agents/lifecycle.js +1 -1
- package/dist/domain/run/competition/agents/workspace.js +2 -1
- package/dist/domain/run/competition/errors.d.ts +1 -1
- package/dist/domain/run/competition/errors.js +4 -7
- package/dist/domain/run/competition/reports.js +2 -1
- package/dist/domain/run/model/enhanced.d.ts +1 -1
- package/dist/domain/run/model/enhanced.js +2 -1
- package/dist/domain/run/model/types.d.ts +384 -0
- package/dist/domain/run/model/types.js +87 -0
- package/dist/domain/spec/competition/adapter.d.ts +1 -0
- package/dist/domain/spec/competition/adapter.js +9 -10
- package/dist/domain/spec/model/mutators.d.ts +20 -0
- package/dist/domain/spec/model/mutators.js +146 -0
- package/dist/domain/spec/model/types.d.ts +3 -0
- package/dist/domain/spec/model/types.js +5 -0
- package/dist/domain/spec/persistence/adapter.d.ts +1 -0
- package/dist/domain/spec/persistence/adapter.js +7 -2
- package/dist/domain/verify/competition/adapter.d.ts +1 -1
- package/dist/domain/verify/competition/adapter.js +4 -9
- package/dist/domain/verify/competition/finalize.d.ts +9 -0
- package/dist/domain/verify/competition/finalize.js +22 -3
- package/dist/domain/verify/competition/programmatic.js +2 -1
- package/dist/domain/verify/competition/prompt.js +1 -1
- package/dist/domain/verify/competition/shared-layout.js +1 -1
- package/dist/domain/verify/model/types.d.ts +2 -2
- package/dist/interactive/providers/launch.d.ts +2 -0
- package/dist/interactive/providers/launch.js +19 -2
- package/dist/interactive/providers/mcp.d.ts +1 -0
- package/dist/interactive/providers/mcp.js +45 -7
- package/dist/interactive/substrate.js +32 -5
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +337 -44
- package/dist/policy/auto.d.ts +0 -1
- package/dist/policy/auto.js +3 -14
- package/dist/policy/verification.js +18 -1
- package/dist/preflight/agents.d.ts +24 -0
- package/dist/preflight/agents.js +71 -0
- package/dist/preflight/environment.d.ts +6 -0
- package/dist/preflight/environment.js +17 -0
- package/dist/preflight/formatting.d.ts +5 -0
- package/dist/preflight/formatting.js +20 -0
- package/dist/preflight/index.d.ts +2 -0
- package/dist/preflight/index.js +6 -9
- package/dist/preflight/operator.d.ts +32 -0
- package/dist/preflight/operator.js +40 -0
- package/dist/preflight/settings.d.ts +2 -0
- package/dist/preflight/settings.js +17 -0
- package/dist/render/transcripts/apply.js +2 -1
- package/dist/render/transcripts/interactive.d.ts +16 -0
- package/dist/render/transcripts/interactive.js +42 -0
- package/dist/render/transcripts/list.d.ts +41 -0
- package/dist/render/transcripts/list.js +152 -3
- package/dist/render/transcripts/message.d.ts +3 -5
- package/dist/render/transcripts/message.js +29 -74
- package/dist/render/transcripts/reduce.d.ts +2 -4
- package/dist/render/transcripts/reduce.js +31 -75
- package/dist/render/transcripts/root-launcher.js +2 -12
- package/dist/render/transcripts/run.d.ts +4 -4
- package/dist/render/transcripts/run.js +36 -47
- package/dist/render/transcripts/spec.d.ts +1 -4
- package/dist/render/transcripts/spec.js +15 -62
- package/dist/render/transcripts/verify.d.ts +6 -7
- package/dist/render/transcripts/verify.js +54 -85
- package/dist/render/utils/cli-writer.d.ts +4 -0
- package/dist/render/utils/cli-writer.js +1 -0
- package/dist/render/utils/duration.d.ts +5 -0
- package/dist/render/utils/duration.js +6 -0
- package/dist/render/utils/progressive-render.d.ts +3 -0
- package/dist/render/utils/progressive-render.js +44 -0
- package/dist/render/utils/runs.d.ts +1 -0
- package/dist/render/utils/runs.js +1 -0
- package/dist/render/utils/transcript-shell.d.ts +2 -1
- package/dist/render/utils/transcript-shell.js +19 -6
- package/dist/utils/diff.d.ts +2 -0
- package/dist/utils/diff.js +1 -0
- package/dist/utils/errors.d.ts +2 -1
- package/dist/utils/errors.js +3 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.js +25 -2
- package/dist/utils/list-target.d.ts +4 -0
- package/dist/utils/list-target.js +35 -0
- package/dist/utils/swarm-session-ack.d.ts +9 -0
- package/dist/utils/swarm-session-ack.js +17 -0
- package/dist/utils/terminal.d.ts +1 -0
- package/dist/utils/terminal.js +11 -0
- package/dist/workspace/artifact-paths.d.ts +55 -0
- package/dist/workspace/artifact-paths.js +106 -0
- package/dist/workspace/chat/artifacts.d.ts +7 -0
- package/dist/workspace/chat/artifacts.js +95 -4
- package/dist/workspace/chat/native-usage.js +1 -1
- package/dist/workspace/chat/sources.d.ts +2 -5
- package/dist/workspace/chat/sources.js +4 -4
- package/dist/workspace/constants.d.ts +47 -0
- package/dist/workspace/constants.js +47 -0
- package/dist/workspace/errors.js +2 -2
- package/dist/workspace/layout.js +3 -1
- package/dist/workspace/managed-state.d.ts +32 -0
- package/dist/workspace/managed-state.js +104 -0
- package/dist/workspace/path-formatters.d.ts +9 -0
- package/dist/workspace/path-formatters.js +46 -0
- package/dist/workspace/path-resolvers.d.ts +1 -0
- package/dist/workspace/path-resolvers.js +5 -0
- package/dist/workspace/session-paths.d.ts +16 -0
- package/dist/workspace/session-paths.js +59 -0
- package/dist/workspace/setup.js +67 -2
- package/dist/workspace/shim.d.ts +1 -0
- package/dist/workspace/shim.js +3 -3
- package/package.json +2 -2
- package/dist/cli/init.d.ts +0 -15
- package/dist/cli/init.js +0 -70
- package/dist/commands/init/agents.d.ts +0 -4
- package/dist/commands/init/command.d.ts +0 -2
- package/dist/commands/init/environment.d.ts +0 -2
- package/dist/render/transcripts/init.d.ts +0 -7
- package/dist/render/transcripts/init.js +0 -83
- package/dist/workspace/structure.d.ts +0 -143
- package/dist/workspace/structure.js +0 -319
- /package/dist/commands/{init/types.js → doctor/fix-types.js} +0 -0
|
@@ -3,8 +3,327 @@ import { type AgentStatus, agentStatusSchema, IN_PROGRESS_AGENT_STATUSES, TERMIN
|
|
|
3
3
|
import type { TokenUsageResult } from "../../../workspace/chat/token-usage-result.js";
|
|
4
4
|
export type { AgentStatus };
|
|
5
5
|
export { agentStatusSchema, IN_PROGRESS_AGENT_STATUSES, TERMINAL_AGENT_STATUSES, };
|
|
6
|
+
export declare const runSpecTargetKindSchema: z.ZodEnum<{
|
|
7
|
+
file: "file";
|
|
8
|
+
spec: "spec";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const runSpecProvenanceLineageSchema: z.ZodEnum<{
|
|
11
|
+
exact: "exact";
|
|
12
|
+
derived: "derived";
|
|
13
|
+
derived_modified: "derived_modified";
|
|
14
|
+
invalid: "invalid";
|
|
15
|
+
}>;
|
|
16
|
+
export declare const runSpecProvenanceIssueSchema: z.ZodEnum<{
|
|
17
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
18
|
+
stale_source: "stale_source";
|
|
19
|
+
}>;
|
|
20
|
+
export declare const runSpecContentHashSchema: z.ZodString;
|
|
21
|
+
export declare const runSpecSourceDescriptorSchema: z.ZodObject<{
|
|
22
|
+
kind: z.ZodLiteral<"spec">;
|
|
23
|
+
sessionId: z.ZodString;
|
|
24
|
+
agentId: z.ZodString;
|
|
25
|
+
outputPath: z.ZodString;
|
|
26
|
+
contentHash: z.ZodString;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export type RunSpecSourceDescriptor = z.infer<typeof runSpecSourceDescriptorSchema>;
|
|
29
|
+
export declare const runSpecSourceHintSchema: z.ZodObject<{
|
|
30
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
31
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
32
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
34
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strict>;
|
|
36
|
+
export declare const exactRunSpecProvenanceSchema: z.ZodObject<{
|
|
37
|
+
lineage: z.ZodLiteral<"exact">;
|
|
38
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
kind: z.ZodLiteral<"spec">;
|
|
40
|
+
sessionId: z.ZodString;
|
|
41
|
+
agentId: z.ZodString;
|
|
42
|
+
outputPath: z.ZodString;
|
|
43
|
+
contentHash: z.ZodString;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export declare const derivedRunSpecProvenanceSchema: z.ZodObject<{
|
|
47
|
+
lineage: z.ZodLiteral<"derived">;
|
|
48
|
+
source: z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"spec">;
|
|
50
|
+
sessionId: z.ZodString;
|
|
51
|
+
agentId: z.ZodString;
|
|
52
|
+
outputPath: z.ZodString;
|
|
53
|
+
contentHash: z.ZodString;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
currentContentHash: z.ZodString;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
export declare const derivedModifiedRunSpecProvenanceSchema: z.ZodObject<{
|
|
58
|
+
lineage: z.ZodLiteral<"derived_modified">;
|
|
59
|
+
source: z.ZodObject<{
|
|
60
|
+
kind: z.ZodLiteral<"spec">;
|
|
61
|
+
sessionId: z.ZodString;
|
|
62
|
+
agentId: z.ZodString;
|
|
63
|
+
outputPath: z.ZodString;
|
|
64
|
+
contentHash: z.ZodString;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
currentContentHash: z.ZodString;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
export declare const invalidRunSpecProvenanceSchema: z.ZodObject<{
|
|
69
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
70
|
+
issueCode: z.ZodEnum<{
|
|
71
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
72
|
+
stale_source: "stale_source";
|
|
73
|
+
}>;
|
|
74
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
76
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
77
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
78
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
79
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export declare const runSpecProvenanceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
84
|
+
lineage: z.ZodLiteral<"exact">;
|
|
85
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
kind: z.ZodLiteral<"spec">;
|
|
87
|
+
sessionId: z.ZodString;
|
|
88
|
+
agentId: z.ZodString;
|
|
89
|
+
outputPath: z.ZodString;
|
|
90
|
+
contentHash: z.ZodString;
|
|
91
|
+
}, z.core.$strict>>;
|
|
92
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
93
|
+
lineage: z.ZodLiteral<"derived">;
|
|
94
|
+
source: z.ZodObject<{
|
|
95
|
+
kind: z.ZodLiteral<"spec">;
|
|
96
|
+
sessionId: z.ZodString;
|
|
97
|
+
agentId: z.ZodString;
|
|
98
|
+
outputPath: z.ZodString;
|
|
99
|
+
contentHash: z.ZodString;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
currentContentHash: z.ZodString;
|
|
102
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
103
|
+
lineage: z.ZodLiteral<"derived_modified">;
|
|
104
|
+
source: z.ZodObject<{
|
|
105
|
+
kind: z.ZodLiteral<"spec">;
|
|
106
|
+
sessionId: z.ZodString;
|
|
107
|
+
agentId: z.ZodString;
|
|
108
|
+
outputPath: z.ZodString;
|
|
109
|
+
contentHash: z.ZodString;
|
|
110
|
+
}, z.core.$strict>;
|
|
111
|
+
currentContentHash: z.ZodString;
|
|
112
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
113
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
114
|
+
issueCode: z.ZodEnum<{
|
|
115
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
116
|
+
stale_source: "stale_source";
|
|
117
|
+
}>;
|
|
118
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
120
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
121
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
122
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
123
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
124
|
+
}, z.core.$strict>>;
|
|
125
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$strict>]>;
|
|
127
|
+
export type RunSpecProvenance = z.infer<typeof runSpecProvenanceSchema>;
|
|
128
|
+
export declare const fileRunSpecTargetSchema: z.ZodObject<{
|
|
129
|
+
kind: z.ZodLiteral<"file">;
|
|
130
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
132
|
+
issueCode: z.ZodEnum<{
|
|
133
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
134
|
+
stale_source: "stale_source";
|
|
135
|
+
}>;
|
|
136
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
138
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
139
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
140
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
141
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
142
|
+
}, z.core.$strict>>;
|
|
143
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
export declare const sessionRunSpecTargetSchema: z.ZodObject<{
|
|
147
|
+
kind: z.ZodLiteral<"spec">;
|
|
148
|
+
sessionId: z.ZodString;
|
|
149
|
+
provenance: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
150
|
+
lineage: z.ZodLiteral<"exact">;
|
|
151
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
kind: z.ZodLiteral<"spec">;
|
|
153
|
+
sessionId: z.ZodString;
|
|
154
|
+
agentId: z.ZodString;
|
|
155
|
+
outputPath: z.ZodString;
|
|
156
|
+
contentHash: z.ZodString;
|
|
157
|
+
}, z.core.$strict>>;
|
|
158
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
159
|
+
lineage: z.ZodLiteral<"derived">;
|
|
160
|
+
source: z.ZodObject<{
|
|
161
|
+
kind: z.ZodLiteral<"spec">;
|
|
162
|
+
sessionId: z.ZodString;
|
|
163
|
+
agentId: z.ZodString;
|
|
164
|
+
outputPath: z.ZodString;
|
|
165
|
+
contentHash: z.ZodString;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
currentContentHash: z.ZodString;
|
|
168
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
169
|
+
lineage: z.ZodLiteral<"derived_modified">;
|
|
170
|
+
source: z.ZodObject<{
|
|
171
|
+
kind: z.ZodLiteral<"spec">;
|
|
172
|
+
sessionId: z.ZodString;
|
|
173
|
+
agentId: z.ZodString;
|
|
174
|
+
outputPath: z.ZodString;
|
|
175
|
+
contentHash: z.ZodString;
|
|
176
|
+
}, z.core.$strict>;
|
|
177
|
+
currentContentHash: z.ZodString;
|
|
178
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
179
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
180
|
+
issueCode: z.ZodEnum<{
|
|
181
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
182
|
+
stale_source: "stale_source";
|
|
183
|
+
}>;
|
|
184
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
186
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
187
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
188
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
189
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
190
|
+
}, z.core.$strict>>;
|
|
191
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
192
|
+
}, z.core.$strict>]>>;
|
|
193
|
+
}, z.core.$strict>;
|
|
194
|
+
export declare const runSpecTargetSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
195
|
+
kind: z.ZodLiteral<"file">;
|
|
196
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
197
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
198
|
+
issueCode: z.ZodEnum<{
|
|
199
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
200
|
+
stale_source: "stale_source";
|
|
201
|
+
}>;
|
|
202
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
204
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
205
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
206
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
207
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
208
|
+
}, z.core.$strict>>;
|
|
209
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, z.core.$strict>>;
|
|
211
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
212
|
+
kind: z.ZodLiteral<"spec">;
|
|
213
|
+
sessionId: z.ZodString;
|
|
214
|
+
provenance: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
215
|
+
lineage: z.ZodLiteral<"exact">;
|
|
216
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
217
|
+
kind: z.ZodLiteral<"spec">;
|
|
218
|
+
sessionId: z.ZodString;
|
|
219
|
+
agentId: z.ZodString;
|
|
220
|
+
outputPath: z.ZodString;
|
|
221
|
+
contentHash: z.ZodString;
|
|
222
|
+
}, z.core.$strict>>;
|
|
223
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
224
|
+
lineage: z.ZodLiteral<"derived">;
|
|
225
|
+
source: z.ZodObject<{
|
|
226
|
+
kind: z.ZodLiteral<"spec">;
|
|
227
|
+
sessionId: z.ZodString;
|
|
228
|
+
agentId: z.ZodString;
|
|
229
|
+
outputPath: z.ZodString;
|
|
230
|
+
contentHash: z.ZodString;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
currentContentHash: z.ZodString;
|
|
233
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
234
|
+
lineage: z.ZodLiteral<"derived_modified">;
|
|
235
|
+
source: z.ZodObject<{
|
|
236
|
+
kind: z.ZodLiteral<"spec">;
|
|
237
|
+
sessionId: z.ZodString;
|
|
238
|
+
agentId: z.ZodString;
|
|
239
|
+
outputPath: z.ZodString;
|
|
240
|
+
contentHash: z.ZodString;
|
|
241
|
+
}, z.core.$strict>;
|
|
242
|
+
currentContentHash: z.ZodString;
|
|
243
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
244
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
245
|
+
issueCode: z.ZodEnum<{
|
|
246
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
247
|
+
stale_source: "stale_source";
|
|
248
|
+
}>;
|
|
249
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
250
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
251
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
252
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
253
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
254
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
255
|
+
}, z.core.$strict>>;
|
|
256
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
257
|
+
}, z.core.$strict>]>>;
|
|
258
|
+
}, z.core.$strict>]>;
|
|
259
|
+
export type RunSpecTarget = z.infer<typeof runSpecTargetSchema>;
|
|
6
260
|
export declare const runSpecDescriptorSchema: z.ZodObject<{
|
|
7
261
|
path: z.ZodString;
|
|
262
|
+
target: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
263
|
+
kind: z.ZodLiteral<"file">;
|
|
264
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
265
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
266
|
+
issueCode: z.ZodEnum<{
|
|
267
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
268
|
+
stale_source: "stale_source";
|
|
269
|
+
}>;
|
|
270
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
271
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
272
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
273
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
274
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
275
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
276
|
+
}, z.core.$strict>>;
|
|
277
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
278
|
+
}, z.core.$strict>>;
|
|
279
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
280
|
+
kind: z.ZodLiteral<"spec">;
|
|
281
|
+
sessionId: z.ZodString;
|
|
282
|
+
provenance: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
283
|
+
lineage: z.ZodLiteral<"exact">;
|
|
284
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
285
|
+
kind: z.ZodLiteral<"spec">;
|
|
286
|
+
sessionId: z.ZodString;
|
|
287
|
+
agentId: z.ZodString;
|
|
288
|
+
outputPath: z.ZodString;
|
|
289
|
+
contentHash: z.ZodString;
|
|
290
|
+
}, z.core.$strict>>;
|
|
291
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
292
|
+
lineage: z.ZodLiteral<"derived">;
|
|
293
|
+
source: z.ZodObject<{
|
|
294
|
+
kind: z.ZodLiteral<"spec">;
|
|
295
|
+
sessionId: z.ZodString;
|
|
296
|
+
agentId: z.ZodString;
|
|
297
|
+
outputPath: z.ZodString;
|
|
298
|
+
contentHash: z.ZodString;
|
|
299
|
+
}, z.core.$strict>;
|
|
300
|
+
currentContentHash: z.ZodString;
|
|
301
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
302
|
+
lineage: z.ZodLiteral<"derived_modified">;
|
|
303
|
+
source: z.ZodObject<{
|
|
304
|
+
kind: z.ZodLiteral<"spec">;
|
|
305
|
+
sessionId: z.ZodString;
|
|
306
|
+
agentId: z.ZodString;
|
|
307
|
+
outputPath: z.ZodString;
|
|
308
|
+
contentHash: z.ZodString;
|
|
309
|
+
}, z.core.$strict>;
|
|
310
|
+
currentContentHash: z.ZodString;
|
|
311
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
312
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
313
|
+
issueCode: z.ZodEnum<{
|
|
314
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
315
|
+
stale_source: "stale_source";
|
|
316
|
+
}>;
|
|
317
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
318
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
319
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
320
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
321
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
322
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
323
|
+
}, z.core.$strict>>;
|
|
324
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
325
|
+
}, z.core.$strict>]>>;
|
|
326
|
+
}, z.core.$strict>]>>;
|
|
8
327
|
}, z.core.$strip>;
|
|
9
328
|
export type RunSpecDescriptor = z.infer<typeof runSpecDescriptorSchema>;
|
|
10
329
|
export declare const CHAT_USAGE_PROVIDER_IDS: readonly ["claude", "codex", "gemini"];
|
|
@@ -224,6 +543,71 @@ export declare const runRecordSchema: z.ZodObject<{
|
|
|
224
543
|
rootPath: z.ZodString;
|
|
225
544
|
spec: z.ZodObject<{
|
|
226
545
|
path: z.ZodString;
|
|
546
|
+
target: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
547
|
+
kind: z.ZodLiteral<"file">;
|
|
548
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
549
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
550
|
+
issueCode: z.ZodEnum<{
|
|
551
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
552
|
+
stale_source: "stale_source";
|
|
553
|
+
}>;
|
|
554
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
555
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
556
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
557
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
558
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
559
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
560
|
+
}, z.core.$strict>>;
|
|
561
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
562
|
+
}, z.core.$strict>>;
|
|
563
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
564
|
+
kind: z.ZodLiteral<"spec">;
|
|
565
|
+
sessionId: z.ZodString;
|
|
566
|
+
provenance: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
567
|
+
lineage: z.ZodLiteral<"exact">;
|
|
568
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
569
|
+
kind: z.ZodLiteral<"spec">;
|
|
570
|
+
sessionId: z.ZodString;
|
|
571
|
+
agentId: z.ZodString;
|
|
572
|
+
outputPath: z.ZodString;
|
|
573
|
+
contentHash: z.ZodString;
|
|
574
|
+
}, z.core.$strict>>;
|
|
575
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
576
|
+
lineage: z.ZodLiteral<"derived">;
|
|
577
|
+
source: z.ZodObject<{
|
|
578
|
+
kind: z.ZodLiteral<"spec">;
|
|
579
|
+
sessionId: z.ZodString;
|
|
580
|
+
agentId: z.ZodString;
|
|
581
|
+
outputPath: z.ZodString;
|
|
582
|
+
contentHash: z.ZodString;
|
|
583
|
+
}, z.core.$strict>;
|
|
584
|
+
currentContentHash: z.ZodString;
|
|
585
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
586
|
+
lineage: z.ZodLiteral<"derived_modified">;
|
|
587
|
+
source: z.ZodObject<{
|
|
588
|
+
kind: z.ZodLiteral<"spec">;
|
|
589
|
+
sessionId: z.ZodString;
|
|
590
|
+
agentId: z.ZodString;
|
|
591
|
+
outputPath: z.ZodString;
|
|
592
|
+
contentHash: z.ZodString;
|
|
593
|
+
}, z.core.$strict>;
|
|
594
|
+
currentContentHash: z.ZodString;
|
|
595
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
596
|
+
lineage: z.ZodLiteral<"invalid">;
|
|
597
|
+
issueCode: z.ZodEnum<{
|
|
598
|
+
malformed_frontmatter: "malformed_frontmatter";
|
|
599
|
+
stale_source: "stale_source";
|
|
600
|
+
}>;
|
|
601
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
602
|
+
kind: z.ZodOptional<z.ZodLiteral<"spec">>;
|
|
603
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
604
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
605
|
+
outputPath: z.ZodOptional<z.ZodString>;
|
|
606
|
+
contentHash: z.ZodOptional<z.ZodString>;
|
|
607
|
+
}, z.core.$strict>>;
|
|
608
|
+
currentContentHash: z.ZodOptional<z.ZodString>;
|
|
609
|
+
}, z.core.$strict>]>>;
|
|
610
|
+
}, z.core.$strict>]>>;
|
|
227
611
|
}, z.core.$strip>;
|
|
228
612
|
extraContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
229
613
|
extraContextMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -5,8 +5,95 @@ import { repoRelativeRecordPathSchema } from "../../../persistence/record-path-s
|
|
|
5
5
|
import { agentStatusSchema, applyStatusSchema as applyStatusValueSchema, IN_PROGRESS_AGENT_STATUSES, runStatusSchema, TERMINAL_AGENT_STATUSES, TERMINAL_RUN_STATUSES, } from "../../../status/index.js";
|
|
6
6
|
import { validateOperationLifecycleTimestamps, validateRecordLifecycleTimestamps, } from "../../shared/lifecycle.js";
|
|
7
7
|
export { agentStatusSchema, IN_PROGRESS_AGENT_STATUSES, TERMINAL_AGENT_STATUSES, };
|
|
8
|
+
const RUN_SPEC_TARGET_KIND_VALUES = ["file", "spec"];
|
|
9
|
+
const RUN_SPEC_PROVENANCE_LINEAGE_VALUES = [
|
|
10
|
+
"exact",
|
|
11
|
+
"derived",
|
|
12
|
+
"derived_modified",
|
|
13
|
+
"invalid",
|
|
14
|
+
];
|
|
15
|
+
const RUN_SPEC_PROVENANCE_ISSUE_VALUES = [
|
|
16
|
+
"malformed_frontmatter",
|
|
17
|
+
"stale_source",
|
|
18
|
+
];
|
|
19
|
+
export const runSpecTargetKindSchema = z.enum(RUN_SPEC_TARGET_KIND_VALUES);
|
|
20
|
+
export const runSpecProvenanceLineageSchema = z.enum(RUN_SPEC_PROVENANCE_LINEAGE_VALUES);
|
|
21
|
+
export const runSpecProvenanceIssueSchema = z.enum(RUN_SPEC_PROVENANCE_ISSUE_VALUES);
|
|
22
|
+
export const runSpecContentHashSchema = z
|
|
23
|
+
.string()
|
|
24
|
+
.regex(/^sha256:[a-f0-9]{64}$/u);
|
|
25
|
+
export const runSpecSourceDescriptorSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
kind: z.literal("spec"),
|
|
28
|
+
sessionId: z.string().min(1),
|
|
29
|
+
agentId: agentIdSchema,
|
|
30
|
+
outputPath: repoRelativeRecordPathSchema,
|
|
31
|
+
contentHash: runSpecContentHashSchema,
|
|
32
|
+
})
|
|
33
|
+
.strict();
|
|
34
|
+
export const runSpecSourceHintSchema = z
|
|
35
|
+
.object({
|
|
36
|
+
kind: z.literal("spec").optional(),
|
|
37
|
+
sessionId: z.string().min(1).optional(),
|
|
38
|
+
agentId: agentIdSchema.optional(),
|
|
39
|
+
outputPath: repoRelativeRecordPathSchema.optional(),
|
|
40
|
+
contentHash: runSpecContentHashSchema.optional(),
|
|
41
|
+
})
|
|
42
|
+
.strict();
|
|
43
|
+
export const exactRunSpecProvenanceSchema = z
|
|
44
|
+
.object({
|
|
45
|
+
lineage: z.literal("exact"),
|
|
46
|
+
source: runSpecSourceDescriptorSchema.optional(),
|
|
47
|
+
})
|
|
48
|
+
.strict();
|
|
49
|
+
export const derivedRunSpecProvenanceSchema = z
|
|
50
|
+
.object({
|
|
51
|
+
lineage: z.literal("derived"),
|
|
52
|
+
source: runSpecSourceDescriptorSchema,
|
|
53
|
+
currentContentHash: runSpecContentHashSchema,
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
export const derivedModifiedRunSpecProvenanceSchema = z
|
|
57
|
+
.object({
|
|
58
|
+
lineage: z.literal("derived_modified"),
|
|
59
|
+
source: runSpecSourceDescriptorSchema,
|
|
60
|
+
currentContentHash: runSpecContentHashSchema,
|
|
61
|
+
})
|
|
62
|
+
.strict();
|
|
63
|
+
export const invalidRunSpecProvenanceSchema = z
|
|
64
|
+
.object({
|
|
65
|
+
lineage: z.literal("invalid"),
|
|
66
|
+
issueCode: runSpecProvenanceIssueSchema,
|
|
67
|
+
source: runSpecSourceHintSchema.optional(),
|
|
68
|
+
currentContentHash: runSpecContentHashSchema.optional(),
|
|
69
|
+
})
|
|
70
|
+
.strict();
|
|
71
|
+
export const runSpecProvenanceSchema = z.union([
|
|
72
|
+
exactRunSpecProvenanceSchema,
|
|
73
|
+
derivedRunSpecProvenanceSchema,
|
|
74
|
+
derivedModifiedRunSpecProvenanceSchema,
|
|
75
|
+
invalidRunSpecProvenanceSchema,
|
|
76
|
+
]);
|
|
77
|
+
export const fileRunSpecTargetSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
kind: z.literal("file"),
|
|
80
|
+
provenance: invalidRunSpecProvenanceSchema.optional(),
|
|
81
|
+
})
|
|
82
|
+
.strict();
|
|
83
|
+
export const sessionRunSpecTargetSchema = z
|
|
84
|
+
.object({
|
|
85
|
+
kind: z.literal("spec"),
|
|
86
|
+
sessionId: z.string().min(1),
|
|
87
|
+
provenance: runSpecProvenanceSchema.optional(),
|
|
88
|
+
})
|
|
89
|
+
.strict();
|
|
90
|
+
export const runSpecTargetSchema = z.union([
|
|
91
|
+
fileRunSpecTargetSchema,
|
|
92
|
+
sessionRunSpecTargetSchema,
|
|
93
|
+
]);
|
|
8
94
|
export const runSpecDescriptorSchema = z.object({
|
|
9
95
|
path: repoRelativeRecordPathSchema,
|
|
96
|
+
target: runSpecTargetSchema.optional(),
|
|
10
97
|
});
|
|
11
98
|
const CHAT_ARTIFACT_FORMATS = [
|
|
12
99
|
"json",
|
|
@@ -15,6 +15,7 @@ export interface SpecCompetitionExecution {
|
|
|
15
15
|
readonly agentId: string;
|
|
16
16
|
readonly outputPath?: string;
|
|
17
17
|
readonly dataPath?: string;
|
|
18
|
+
readonly contentHash?: `sha256:${string}`;
|
|
18
19
|
readonly status: "succeeded" | "failed";
|
|
19
20
|
readonly tokenUsage?: ExtractedTokenUsage;
|
|
20
21
|
readonly tokenUsageResult: TokenUsageResult;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { readFile } from "node:fs/promises";
|
|
2
3
|
import { join } from "node:path";
|
|
3
4
|
import { detectAgentProcessFailureDetail } from "../../../agents/runtime/failures.js";
|
|
@@ -5,7 +6,7 @@ import { runSandboxedAgent } from "../../../agents/runtime/harness.js";
|
|
|
5
6
|
import { teardownSessionAuth } from "../../../agents/runtime/registry.js";
|
|
6
7
|
import { stageExtraContextFiles, } from "../../../competition/shared/extra-context.js";
|
|
7
8
|
import { composeStageSandboxPolicy } from "../../../competition/shared/sandbox-policy.js";
|
|
8
|
-
import { createTeardownController, runTeardown, } from "../../../competition/shared/teardown.js";
|
|
9
|
+
import { createTeardownController, registerScratchWorkspaceTeardownPaths, runTeardown, } from "../../../competition/shared/teardown.js";
|
|
9
10
|
import { buildUnavailableTokenUsageResult, resolveTokenUsage, } from "../../../domain/shared/token-usage.js";
|
|
10
11
|
import { buildSpecPrompt } from "../../../domain/spec/competition/prompt.js";
|
|
11
12
|
import { parseSpecData } from "../../../domain/spec/model/output.js";
|
|
@@ -13,9 +14,9 @@ import { toErrorMessage } from "../../../utils/errors.js";
|
|
|
13
14
|
import { normalizePathForDisplay, relativeToRoot, } from "../../../utils/path.js";
|
|
14
15
|
import { slugify } from "../../../utils/slug.js";
|
|
15
16
|
import { extractProviderNativeTokenUsageForSession } from "../../../workspace/chat/native-usage.js";
|
|
17
|
+
import { VORATIQ_SPEC_DIR } from "../../../workspace/constants.js";
|
|
16
18
|
import { buildAgentSessionWorkspacePaths, scaffoldAgentWorkspace, } from "../../../workspace/layout.js";
|
|
17
19
|
import { promoteWorkspaceFile } from "../../../workspace/promotion.js";
|
|
18
|
-
import { VORATIQ_SPEC_DIR } from "../../../workspace/structure.js";
|
|
19
20
|
const SPEC_MARKDOWN_FILENAME = "spec.md";
|
|
20
21
|
const SPEC_DATA_FILENAME = "spec.json";
|
|
21
22
|
export function createSpecCompetitionAdapter(input) {
|
|
@@ -40,7 +41,7 @@ export function createSpecCompetitionAdapter(input) {
|
|
|
40
41
|
sessionId,
|
|
41
42
|
agentId: candidate.id,
|
|
42
43
|
});
|
|
43
|
-
|
|
44
|
+
registerScratchWorkspaceTeardownPaths(teardown, workspacePaths, candidate.id);
|
|
44
45
|
try {
|
|
45
46
|
await scaffoldAgentWorkspace(workspacePaths);
|
|
46
47
|
await stageExtraContextFiles({
|
|
@@ -138,7 +139,7 @@ export function createSpecCompetitionAdapter(input) {
|
|
|
138
139
|
}
|
|
139
140
|
const stagedMarkdownPath = join(workspacePaths.workspacePath, SPEC_MARKDOWN_FILENAME);
|
|
140
141
|
const stagedDataPath = join(workspacePaths.workspacePath, SPEC_DATA_FILENAME);
|
|
141
|
-
await readFile(stagedMarkdownPath, "utf8");
|
|
142
|
+
const markdownContent = await readFile(stagedMarkdownPath, "utf8");
|
|
142
143
|
const specData = parseSpecData(await readFile(stagedDataPath, "utf8"));
|
|
143
144
|
const artifactBasename = slugify(specData.title, "spec");
|
|
144
145
|
const artifactMarkdownFilename = `${artifactBasename}.md`;
|
|
@@ -161,6 +162,7 @@ export function createSpecCompetitionAdapter(input) {
|
|
|
161
162
|
agentId: candidate.id,
|
|
162
163
|
outputPath: normalizePathForDisplay(relativeToRoot(root, markdownPromoteResult.artifactPath)),
|
|
163
164
|
dataPath: normalizePathForDisplay(relativeToRoot(root, dataPromoteResult.artifactPath)),
|
|
165
|
+
contentHash: hashSpecContent(markdownContent),
|
|
164
166
|
status: "succeeded",
|
|
165
167
|
tokenUsage,
|
|
166
168
|
tokenUsageResult,
|
|
@@ -185,12 +187,9 @@ export function createSpecCompetitionAdapter(input) {
|
|
|
185
187
|
sortResults: compareSpecExecutionsByAgentId,
|
|
186
188
|
};
|
|
187
189
|
}
|
|
188
|
-
function registerScratchWorkspaceTeardown(teardown, workspacePaths, agentId) {
|
|
189
|
-
teardown.addPath(workspacePaths.workspacePath, `${agentId} workspace`);
|
|
190
|
-
teardown.addPath(workspacePaths.contextPath, `${agentId} context`);
|
|
191
|
-
teardown.addPath(workspacePaths.runtimePath, `${agentId} runtime`);
|
|
192
|
-
teardown.addPath(workspacePaths.sandboxPath, `${agentId} sandbox`);
|
|
193
|
-
}
|
|
194
190
|
function compareSpecExecutionsByAgentId(left, right) {
|
|
195
191
|
return left.agentId.localeCompare(right.agentId);
|
|
196
192
|
}
|
|
193
|
+
function hashSpecContent(content) {
|
|
194
|
+
return `sha256:${createHash("sha256").update(content, "utf8").digest("hex")}`;
|
|
195
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SpecAgentEntry, SpecRecord, SpecRecordStatus } from "./types.js";
|
|
2
|
+
export interface SpecRecordMutators {
|
|
3
|
+
recordAgentRunning: (options: {
|
|
4
|
+
agentId: string;
|
|
5
|
+
timestamp?: string;
|
|
6
|
+
}) => Promise<SpecRecord>;
|
|
7
|
+
recordAgentSnapshot: (agent: SpecAgentEntry) => Promise<SpecRecord>;
|
|
8
|
+
completeSpec: (options: {
|
|
9
|
+
status: SpecRecordStatus;
|
|
10
|
+
agents?: readonly SpecAgentEntry[];
|
|
11
|
+
error?: string | null;
|
|
12
|
+
}) => Promise<SpecRecord>;
|
|
13
|
+
readRecord: () => Promise<SpecRecord | undefined>;
|
|
14
|
+
}
|
|
15
|
+
export interface CreateSpecRecordMutatorsInput {
|
|
16
|
+
readonly root: string;
|
|
17
|
+
readonly specsFilePath: string;
|
|
18
|
+
readonly sessionId: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function createSpecRecordMutators(input: CreateSpecRecordMutatorsInput): SpecRecordMutators;
|