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
|
@@ -5,7 +5,8 @@ import { SessionRecordParseError } from "../../../persistence/errors.js";
|
|
|
5
5
|
import { acquireHistoryLock } from "../../../persistence/history-lock.js";
|
|
6
6
|
import { createSessionStore, } from "../../../persistence/session-store.js";
|
|
7
7
|
import { assertRepoRelativePath, resolvePath } from "../../../utils/path.js";
|
|
8
|
-
import { getInteractiveHistoryLockPath, getInteractiveIndexPath, getInteractiveSessionArtifactsDirectoryPath, getInteractiveSessionDirectoryPath, getInteractiveSessionRecordPath, getInteractiveSessionsDirectoryPath, } from "../../../workspace/
|
|
8
|
+
import { getInteractiveHistoryLockPath, getInteractiveIndexPath, getInteractiveSessionArtifactsDirectoryPath, getInteractiveSessionDirectoryPath, getInteractiveSessionRecordPath, getInteractiveSessionsDirectoryPath, } from "../../../workspace/session-paths.js";
|
|
9
|
+
import { buildLifecycleStartFields, buildRecordLifecycleCompleteFields, } from "../../shared/lifecycle.js";
|
|
9
10
|
import { interactiveSessionIndexRecordSchema, interactiveSessionRecordSchema, } from "../model/types.js";
|
|
10
11
|
const INTERACTIVE_INDEX_VERSION = 1;
|
|
11
12
|
const interactivePersistence = createSessionStore({
|
|
@@ -36,6 +37,23 @@ export function resolveInteractiveSessionPaths(root, sessionId) {
|
|
|
36
37
|
runtimePath: resolvePath(root, getInteractiveSessionDirectoryPath(sessionId), "runtime"),
|
|
37
38
|
};
|
|
38
39
|
}
|
|
40
|
+
export async function readInteractiveRecords(options) {
|
|
41
|
+
const { root, interactiveFilePath, limit, predicate, onWarning } = options;
|
|
42
|
+
const paths = buildInteractivePaths(root, interactiveFilePath);
|
|
43
|
+
try {
|
|
44
|
+
return await interactivePersistence.readRecords({
|
|
45
|
+
paths,
|
|
46
|
+
limit,
|
|
47
|
+
predicate,
|
|
48
|
+
onWarning: onWarning
|
|
49
|
+
? (warning) => onWarning(mapWarning(warning))
|
|
50
|
+
: undefined,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw mapSessionStoreError(error, sessionStoreErrorMapper);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
39
57
|
export async function ensureInteractiveSessionDirectories(options) {
|
|
40
58
|
const { sessionRoot, artifactsPath, runtimePath } = options;
|
|
41
59
|
await Promise.all([
|
|
@@ -74,10 +92,29 @@ export async function updateInteractiveSessionStatus(options) {
|
|
|
74
92
|
return await rewriteInteractiveSessionRecord({
|
|
75
93
|
root,
|
|
76
94
|
sessionId,
|
|
77
|
-
mutate: (record) =>
|
|
78
|
-
|
|
79
|
-
status
|
|
80
|
-
|
|
95
|
+
mutate: (record) => {
|
|
96
|
+
const timestamp = new Date().toISOString();
|
|
97
|
+
if (status === "running") {
|
|
98
|
+
return {
|
|
99
|
+
...record,
|
|
100
|
+
status,
|
|
101
|
+
...buildLifecycleStartFields({
|
|
102
|
+
existingStartedAt: record.startedAt,
|
|
103
|
+
timestamp,
|
|
104
|
+
}),
|
|
105
|
+
completedAt: undefined,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
...record,
|
|
110
|
+
status,
|
|
111
|
+
...buildRecordLifecycleCompleteFields({
|
|
112
|
+
existing: record,
|
|
113
|
+
startedAt: record.startedAt ?? record.createdAt,
|
|
114
|
+
completedAt: timestamp,
|
|
115
|
+
}),
|
|
116
|
+
};
|
|
117
|
+
},
|
|
81
118
|
forceFlush: true,
|
|
82
119
|
});
|
|
83
120
|
}
|
|
@@ -128,6 +165,31 @@ function buildInteractiveSessionStorePaths(root) {
|
|
|
128
165
|
lockPath: resolvePath(root, getInteractiveHistoryLockPath()),
|
|
129
166
|
};
|
|
130
167
|
}
|
|
168
|
+
function buildInteractivePaths(root, interactiveFilePath) {
|
|
169
|
+
return {
|
|
170
|
+
root,
|
|
171
|
+
indexPath: interactiveFilePath,
|
|
172
|
+
sessionsDir: resolvePath(root, getInteractiveSessionsDirectoryPath()),
|
|
173
|
+
lockPath: resolvePath(root, getInteractiveHistoryLockPath()),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function mapWarning(warning) {
|
|
177
|
+
if (warning.kind === "parse-error") {
|
|
178
|
+
return {
|
|
179
|
+
kind: "parse-error",
|
|
180
|
+
sessionId: warning.sessionId,
|
|
181
|
+
recordPath: warning.recordPath,
|
|
182
|
+
displayPath: warning.displayPath,
|
|
183
|
+
details: warning.details,
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
kind: "missing-record",
|
|
188
|
+
sessionId: warning.sessionId,
|
|
189
|
+
recordPath: warning.recordPath,
|
|
190
|
+
displayPath: warning.displayPath,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
131
193
|
function parseInteractiveRecord(path, raw) {
|
|
132
194
|
let parsed;
|
|
133
195
|
try {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ToolAttachmentStatus } from "./model/types.js";
|
|
2
|
-
export declare const FIRST_PARTY_ATTACHED_LAUNCH_PROMPT: "
|
|
2
|
+
export declare const FIRST_PARTY_ATTACHED_LAUNCH_PROMPT: "Voratiq MCP tools are attached to this repository: voratiq_spec, voratiq_run, voratiq_reduce, voratiq_verify, voratiq_message, voratiq_list, voratiq_apply, and voratiq_prune. For Voratiq session history and workflow actions, prefer these tools over bash, search, or direct file reads. Read the guide resource at voratiq://guide for the full operator reference, workflow composition, and usage guidance.";
|
|
3
3
|
export declare function resolveFirstPartyLaunchPrompt(toolAttachmentStatus: ToolAttachmentStatus): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const FIRST_PARTY_ATTACHED_LAUNCH_PROMPT = "
|
|
1
|
+
export const FIRST_PARTY_ATTACHED_LAUNCH_PROMPT = "Voratiq MCP tools are attached to this repository: voratiq_spec, voratiq_run, voratiq_reduce, voratiq_verify, voratiq_message, voratiq_list, voratiq_apply, and voratiq_prune. For Voratiq session history and workflow actions, prefer these tools over bash, search, or direct file reads. Read the guide resource at voratiq://guide for the full operator reference, workflow composition, and usage guidance.";
|
|
2
2
|
export function resolveFirstPartyLaunchPrompt(toolAttachmentStatus) {
|
|
3
3
|
if (toolAttachmentStatus !== "attached") {
|
|
4
4
|
return undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type InteractiveSessionEnvLineage = {
|
|
2
|
+
kind: "trusted";
|
|
3
|
+
sessionId: string;
|
|
4
|
+
} | {
|
|
5
|
+
kind: "ignore";
|
|
6
|
+
};
|
|
7
|
+
export declare function resolveInteractiveSessionEnvLineage(options: {
|
|
8
|
+
root: string;
|
|
9
|
+
envValue: string | undefined;
|
|
10
|
+
}): Promise<InteractiveSessionEnvLineage>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getInteractiveSessionRecordSnapshot } from "./persistence/adapter.js";
|
|
2
|
+
// Resolve whether the VORATIQ_INTERACTIVE_SESSION_ID env value still points at
|
|
3
|
+
// a live interactive session. Env values inherited from a stale shell or a
|
|
4
|
+
// stale MCP config must not be persisted as lineage; callers treat "ignore"
|
|
5
|
+
// the same as "no env was set" so the original no-lineage message behavior
|
|
6
|
+
// applies. I/O failures fall through to "ignore" to fail safe.
|
|
7
|
+
export async function resolveInteractiveSessionEnvLineage(options) {
|
|
8
|
+
const envValue = options.envValue?.trim();
|
|
9
|
+
if (!envValue) {
|
|
10
|
+
return { kind: "ignore" };
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
const record = await getInteractiveSessionRecordSnapshot({
|
|
14
|
+
root: options.root,
|
|
15
|
+
sessionId: envValue,
|
|
16
|
+
});
|
|
17
|
+
if (!record || record.status !== "running") {
|
|
18
|
+
return { kind: "ignore" };
|
|
19
|
+
}
|
|
20
|
+
return { kind: "trusted", sessionId: envValue };
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return { kind: "ignore" };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -5,14 +5,14 @@ import { runSandboxedAgent } from "../../../agents/runtime/harness.js";
|
|
|
5
5
|
import { teardownSessionAuth } from "../../../agents/runtime/registry.js";
|
|
6
6
|
import { stageExtraContextFiles, } from "../../../competition/shared/extra-context.js";
|
|
7
7
|
import { composeStageSandboxPolicy } from "../../../competition/shared/sandbox-policy.js";
|
|
8
|
-
import { createTeardownController, runTeardown, } from "../../../competition/shared/teardown.js";
|
|
8
|
+
import { createTeardownController, registerScratchWorkspaceTeardownPaths, runTeardown, } from "../../../competition/shared/teardown.js";
|
|
9
9
|
import { buildUnavailableTokenUsageResult, resolveTokenUsage, } from "../../../domain/shared/token-usage.js";
|
|
10
10
|
import { toErrorMessage } from "../../../utils/errors.js";
|
|
11
11
|
import { normalizePathForDisplay, relativeToRoot, resolvePath, } from "../../../utils/path.js";
|
|
12
12
|
import { extractProviderNativeTokenUsageForSession } from "../../../workspace/chat/native-usage.js";
|
|
13
|
+
import { MESSAGE_RESPONSE_FILENAME, VORATIQ_MESSAGE_DIR, } from "../../../workspace/constants.js";
|
|
13
14
|
import { scaffoldAgentSessionWorkspace, } from "../../../workspace/layout.js";
|
|
14
15
|
import { promoteWorkspaceFile } from "../../../workspace/promotion.js";
|
|
15
|
-
import { MESSAGE_RESPONSE_FILENAME, VORATIQ_MESSAGE_DIR, } from "../../../workspace/structure.js";
|
|
16
16
|
import { buildMessagePrompt } from "./prompt.js";
|
|
17
17
|
export function createMessageCompetitionAdapter(input) {
|
|
18
18
|
const { root, messageId, prompt, environment, extraContextFiles = [], teardown: providedTeardown, } = input;
|
|
@@ -39,7 +39,7 @@ export function createMessageCompetitionAdapter(input) {
|
|
|
39
39
|
sessionId: messageId,
|
|
40
40
|
agentId: candidate.id,
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
registerScratchWorkspaceTeardownPaths(teardown, workspacePaths, candidate.id);
|
|
43
43
|
await stageExtraContextFiles({
|
|
44
44
|
contextPath: workspacePaths.contextPath,
|
|
45
45
|
files: extraContextFiles,
|
|
@@ -180,12 +180,6 @@ export function createMessageCompetitionAdapter(input) {
|
|
|
180
180
|
sortResults: compareMessageExecutionsByAgentId,
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
-
function registerScratchWorkspaceTeardown(teardown, workspacePaths, agentId) {
|
|
184
|
-
teardown.addPath(workspacePaths.workspacePath, `${agentId} workspace`);
|
|
185
|
-
teardown.addPath(workspacePaths.contextPath, `${agentId} context`);
|
|
186
|
-
teardown.addPath(workspacePaths.runtimePath, `${agentId} runtime`);
|
|
187
|
-
teardown.addPath(workspacePaths.sandboxPath, `${agentId} sandbox`);
|
|
188
|
-
}
|
|
189
183
|
function compareMessageExecutionsByAgentId(left, right) {
|
|
190
184
|
return left.agentId.localeCompare(right.agentId);
|
|
191
185
|
}
|
|
@@ -2,6 +2,27 @@ import { z } from "zod";
|
|
|
2
2
|
import { type MessageRecipientStatus, messageRecipientStatusSchema, type MessageStatus, messageStatusSchema, TERMINAL_MESSAGE_RECIPIENT_STATUSES, TERMINAL_MESSAGE_STATUSES } from "../../../status/index.js";
|
|
3
3
|
export type { MessageRecipientStatus, MessageStatus };
|
|
4
4
|
export { messageRecipientStatusSchema, messageStatusSchema, TERMINAL_MESSAGE_RECIPIENT_STATUSES, TERMINAL_MESSAGE_STATUSES, };
|
|
5
|
+
declare const MESSAGE_TARGET_KIND_VALUES: readonly ["interactive", "run", "spec", "reduce", "verify"];
|
|
6
|
+
export type MessageTargetKind = (typeof MESSAGE_TARGET_KIND_VALUES)[number];
|
|
7
|
+
export declare const messageTargetKindSchema: z.ZodEnum<{
|
|
8
|
+
spec: "spec";
|
|
9
|
+
reduce: "reduce";
|
|
10
|
+
run: "run";
|
|
11
|
+
verify: "verify";
|
|
12
|
+
interactive: "interactive";
|
|
13
|
+
}>;
|
|
14
|
+
export declare const messageTargetSchema: z.ZodObject<{
|
|
15
|
+
kind: z.ZodEnum<{
|
|
16
|
+
spec: "spec";
|
|
17
|
+
reduce: "reduce";
|
|
18
|
+
run: "run";
|
|
19
|
+
verify: "verify";
|
|
20
|
+
interactive: "interactive";
|
|
21
|
+
}>;
|
|
22
|
+
sessionId: z.ZodString;
|
|
23
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export type MessageTarget = z.infer<typeof messageTargetSchema>;
|
|
5
26
|
export declare const messageRecipientEntrySchema: z.ZodObject<{
|
|
6
27
|
agentId: z.ZodString;
|
|
7
28
|
status: z.ZodEnum<{
|
|
@@ -52,7 +73,17 @@ export declare const messageRecordSchema: z.ZodObject<{
|
|
|
52
73
|
}>;
|
|
53
74
|
baseRevisionSha: z.ZodOptional<z.ZodString>;
|
|
54
75
|
prompt: z.ZodString;
|
|
55
|
-
|
|
76
|
+
target: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
kind: z.ZodEnum<{
|
|
78
|
+
spec: "spec";
|
|
79
|
+
reduce: "reduce";
|
|
80
|
+
run: "run";
|
|
81
|
+
verify: "verify";
|
|
82
|
+
interactive: "interactive";
|
|
83
|
+
}>;
|
|
84
|
+
sessionId: z.ZodString;
|
|
85
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strict>>;
|
|
56
87
|
extraContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
88
|
extraContextMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
89
|
stagedPath: z.ZodString;
|
|
@@ -9,6 +9,30 @@ export { messageRecipientStatusSchema, messageStatusSchema, TERMINAL_MESSAGE_REC
|
|
|
9
9
|
const RUNNING_MESSAGE_RECORD_STATUSES = [
|
|
10
10
|
"running",
|
|
11
11
|
];
|
|
12
|
+
const MESSAGE_TARGET_KIND_VALUES = [
|
|
13
|
+
"interactive",
|
|
14
|
+
"run",
|
|
15
|
+
"spec",
|
|
16
|
+
"reduce",
|
|
17
|
+
"verify",
|
|
18
|
+
];
|
|
19
|
+
export const messageTargetKindSchema = z.enum(MESSAGE_TARGET_KIND_VALUES);
|
|
20
|
+
export const messageTargetSchema = z
|
|
21
|
+
.object({
|
|
22
|
+
kind: messageTargetKindSchema,
|
|
23
|
+
sessionId: z.string().min(1),
|
|
24
|
+
agentId: agentIdSchema.optional(),
|
|
25
|
+
})
|
|
26
|
+
.strict()
|
|
27
|
+
.superRefine((target, ctx) => {
|
|
28
|
+
if (target.kind === "interactive" && target.agentId) {
|
|
29
|
+
ctx.addIssue({
|
|
30
|
+
code: z.ZodIssueCode.custom,
|
|
31
|
+
path: ["agentId"],
|
|
32
|
+
message: "interactive message targets must not persist an `agentId` lane reference",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
12
36
|
export const messageRecipientEntrySchema = z
|
|
13
37
|
.object({
|
|
14
38
|
agentId: agentIdSchema,
|
|
@@ -48,7 +72,7 @@ export const messageRecordSchema = z
|
|
|
48
72
|
status: messageStatusSchema,
|
|
49
73
|
baseRevisionSha: z.string().optional(),
|
|
50
74
|
prompt: z.string(),
|
|
51
|
-
|
|
75
|
+
target: messageTargetSchema.optional(),
|
|
52
76
|
extraContext: z.array(persistedExtraContextPathSchema).optional(),
|
|
53
77
|
extraContextMetadata: z.array(extraContextMetadataEntrySchema).optional(),
|
|
54
78
|
recipients: z
|
|
@@ -6,8 +6,9 @@ import { teardownSessionAuth } from "../../../agents/runtime/registry.js";
|
|
|
6
6
|
import { RunNotFoundCliError } from "../../../cli/errors.js";
|
|
7
7
|
import { stageExtraContextFiles, } from "../../../competition/shared/extra-context.js";
|
|
8
8
|
import { composeStageSandboxPolicy } from "../../../competition/shared/sandbox-policy.js";
|
|
9
|
-
import { createTeardownController, runTeardown, } from "../../../competition/shared/teardown.js";
|
|
9
|
+
import { createTeardownController, registerScratchWorkspaceTeardownPaths, runTeardown, } from "../../../competition/shared/teardown.js";
|
|
10
10
|
import { readMessageRecords } from "../../../domain/message/persistence/adapter.js";
|
|
11
|
+
import { deriveReductionStatusFromReducers } from "../../../domain/reduce/competition/finalize.js";
|
|
11
12
|
import { validateReductionOutputContract } from "../../../domain/reduce/competition/output-validation.js";
|
|
12
13
|
import { buildReducePrompt } from "../../../domain/reduce/competition/prompt.js";
|
|
13
14
|
import { parseReductionArtifact } from "../../../domain/reduce/competition/reduction.js";
|
|
@@ -23,10 +24,11 @@ import { buildPersistedExtraContextFields } from "../../../extra-context/contrac
|
|
|
23
24
|
import { emitStageProgressEvent } from "../../../render/transcripts/stage-progress.js";
|
|
24
25
|
import { toErrorMessage } from "../../../utils/errors.js";
|
|
25
26
|
import { normalizePathForDisplay, relativeToRoot, resolvePath, } from "../../../utils/path.js";
|
|
27
|
+
import { emitSwarmSessionAcknowledgement } from "../../../utils/swarm-session-ack.js";
|
|
26
28
|
import { extractProviderNativeTokenUsageForSession } from "../../../workspace/chat/native-usage.js";
|
|
29
|
+
import { MESSAGE_RESPONSE_FILENAME, REDUCTION_ARTIFACT_INFO_FILENAME, REDUCTION_DATA_FILENAME, REDUCTION_FILENAME, VORATIQ_REDUCTION_DIR, } from "../../../workspace/constants.js";
|
|
27
30
|
import { scaffoldAgentSessionWorkspace, } from "../../../workspace/layout.js";
|
|
28
31
|
import { promoteWorkspaceFile } from "../../../workspace/promotion.js";
|
|
29
|
-
import { MESSAGE_RESPONSE_FILENAME, REDUCTION_ARTIFACT_INFO_FILENAME, REDUCTION_DATA_FILENAME, REDUCTION_FILENAME, VORATIQ_REDUCTION_DIR, } from "../../../workspace/structure.js";
|
|
30
32
|
export function createReduceCompetitionAdapter(input) {
|
|
31
33
|
const { root, reductionId, createdAt, reductionsFilePath, specsFilePath, runsFilePath, messagesFilePath, verificationsFilePath, target, environment, extraContextFiles = [], renderer, } = input;
|
|
32
34
|
let failure;
|
|
@@ -87,6 +89,11 @@ export function createReduceCompetitionAdapter(input) {
|
|
|
87
89
|
reductionsFilePath,
|
|
88
90
|
record,
|
|
89
91
|
});
|
|
92
|
+
await emitSwarmSessionAcknowledgement({
|
|
93
|
+
operator: "reduce",
|
|
94
|
+
sessionId: reductionId,
|
|
95
|
+
status: "queued",
|
|
96
|
+
});
|
|
90
97
|
const prepared = [];
|
|
91
98
|
for (const candidate of candidates) {
|
|
92
99
|
tokenUsageIdentityByReducerAgentId.set(candidate.id, {
|
|
@@ -99,7 +106,7 @@ export function createReduceCompetitionAdapter(input) {
|
|
|
99
106
|
sessionId: reductionId,
|
|
100
107
|
agentId: candidate.id,
|
|
101
108
|
});
|
|
102
|
-
|
|
109
|
+
registerScratchWorkspaceTeardownPaths(teardown, workspacePaths, candidate.id);
|
|
103
110
|
await stageReductionTargetContext({
|
|
104
111
|
workspacePath: workspacePaths.workspacePath,
|
|
105
112
|
targetContext,
|
|
@@ -323,7 +330,7 @@ export function createReduceCompetitionAdapter(input) {
|
|
|
323
330
|
};
|
|
324
331
|
},
|
|
325
332
|
finalizeCompetition: async () => {
|
|
326
|
-
|
|
333
|
+
let finalizedStatus;
|
|
327
334
|
const completedAt = new Date().toISOString();
|
|
328
335
|
await rewriteReductionRecord({
|
|
329
336
|
root,
|
|
@@ -335,25 +342,30 @@ export function createReduceCompetitionAdapter(input) {
|
|
|
335
342
|
startedAt: record.startedAt ?? completedAt,
|
|
336
343
|
completedAt,
|
|
337
344
|
});
|
|
338
|
-
const status =
|
|
345
|
+
const status = deriveReductionStatusFromReducers(record.reducers);
|
|
346
|
+
finalizedStatus = status;
|
|
339
347
|
return {
|
|
340
348
|
...record,
|
|
341
349
|
status,
|
|
342
350
|
...recordComplete,
|
|
343
|
-
error: failed
|
|
351
|
+
error: status === "failed" && failure !== undefined
|
|
352
|
+
? toErrorMessage(failure)
|
|
353
|
+
: null,
|
|
344
354
|
reducers: record.reducers.map((reducer) => {
|
|
345
355
|
if (reducer.status !== "running" && reducer.status !== "queued") {
|
|
346
356
|
return reducer;
|
|
347
357
|
}
|
|
348
358
|
return {
|
|
349
359
|
...reducer,
|
|
350
|
-
status,
|
|
360
|
+
status: "failed",
|
|
351
361
|
...buildOperationLifecycleCompleteFields({
|
|
352
362
|
existing: reducer,
|
|
353
363
|
startedAt: reducer.startedAt ?? recordComplete.completedAt,
|
|
354
364
|
completedAt: recordComplete.completedAt,
|
|
355
365
|
}),
|
|
356
|
-
error:
|
|
366
|
+
error: failure !== undefined
|
|
367
|
+
? toErrorMessage(failure)
|
|
368
|
+
: reducer.error,
|
|
357
369
|
};
|
|
358
370
|
}),
|
|
359
371
|
};
|
|
@@ -396,10 +408,11 @@ export function createReduceCompetitionAdapter(input) {
|
|
|
396
408
|
});
|
|
397
409
|
}
|
|
398
410
|
else {
|
|
411
|
+
const status = finalizedStatus ?? (failure === undefined ? "succeeded" : "failed");
|
|
399
412
|
emitStageProgressEvent(renderer, {
|
|
400
413
|
type: "stage.status",
|
|
401
414
|
stage: "reduce",
|
|
402
|
-
status
|
|
415
|
+
status,
|
|
403
416
|
});
|
|
404
417
|
}
|
|
405
418
|
await runTeardown(teardown);
|
|
@@ -412,12 +425,6 @@ export function createReduceCompetitionAdapter(input) {
|
|
|
412
425
|
},
|
|
413
426
|
};
|
|
414
427
|
}
|
|
415
|
-
function registerScratchWorkspaceTeardown(teardown, workspacePaths, agentId) {
|
|
416
|
-
teardown.addPath(workspacePaths.workspacePath, `${agentId} workspace`);
|
|
417
|
-
teardown.addPath(workspacePaths.contextPath, `${agentId} context`);
|
|
418
|
-
teardown.addPath(workspacePaths.runtimePath, `${agentId} runtime`);
|
|
419
|
-
teardown.addPath(workspacePaths.sandboxPath, `${agentId} sandbox`);
|
|
420
|
-
}
|
|
421
428
|
async function rewriteOrAppendReductionRecord(options) {
|
|
422
429
|
const { root, reductionsFilePath, record } = options;
|
|
423
430
|
const existing = await readReductionRecords({
|
|
@@ -617,6 +624,9 @@ async function prepareVerificationTargetContext(options) {
|
|
|
617
624
|
...(method.error ? { error: method.error } : {}),
|
|
618
625
|
});
|
|
619
626
|
}
|
|
627
|
+
if (artifacts.length === 0) {
|
|
628
|
+
throw new Error(`Verification session \`${target.id}\` has no reduction-ready artifacts.`);
|
|
629
|
+
}
|
|
620
630
|
return {
|
|
621
631
|
target,
|
|
622
632
|
displayPath: `.voratiq/verify/sessions/${record.sessionId}`,
|
|
@@ -647,7 +657,11 @@ async function prepareReductionTargetContextInternal(options) {
|
|
|
647
657
|
}
|
|
648
658
|
const stagedFiles = [];
|
|
649
659
|
const artifacts = [];
|
|
650
|
-
|
|
660
|
+
const succeededReducers = record.reducers.filter((reducer) => reducer.status === "succeeded" && typeof reducer.outputPath === "string");
|
|
661
|
+
if (succeededReducers.length === 0) {
|
|
662
|
+
throw new Error(`Reduction session \`${target.id}\` has no successful reduction artifacts.`);
|
|
663
|
+
}
|
|
664
|
+
for (const reducer of succeededReducers) {
|
|
651
665
|
const reductionRelative = `inputs/reducers/${reducer.agentId}/reduction.md`;
|
|
652
666
|
stagedFiles.push({
|
|
653
667
|
sourceAbsolutePath: resolvePath(root, reducer.outputPath),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReductionRecord } from "../model/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Derive the reduction session status from per-reducer outcomes.
|
|
4
|
+
* Returns "succeeded" when at least one reducer succeeds, "aborted" when all
|
|
5
|
+
* terminal reducers aborted, and "failed" otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare function deriveReductionStatusFromReducers(reducers: readonly Pick<ReductionRecord["reducers"][number], "status">[]): ReductionRecord["status"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive the reduction session status from per-reducer outcomes.
|
|
3
|
+
* Returns "succeeded" when at least one reducer succeeds, "aborted" when all
|
|
4
|
+
* terminal reducers aborted, and "failed" otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export function deriveReductionStatusFromReducers(reducers) {
|
|
7
|
+
const terminalReducers = reducers.filter((reducer) => reducer.status === "succeeded" ||
|
|
8
|
+
reducer.status === "failed" ||
|
|
9
|
+
reducer.status === "aborted");
|
|
10
|
+
const hasSucceeded = terminalReducers.some((reducer) => reducer.status === "succeeded");
|
|
11
|
+
if (hasSucceeded) {
|
|
12
|
+
return "succeeded";
|
|
13
|
+
}
|
|
14
|
+
if (terminalReducers.length > 0 &&
|
|
15
|
+
terminalReducers.every((reducer) => reducer.status === "aborted")) {
|
|
16
|
+
return "aborted";
|
|
17
|
+
}
|
|
18
|
+
return "failed";
|
|
19
|
+
}
|
|
@@ -4,8 +4,8 @@ export type { ReductionStatus };
|
|
|
4
4
|
export { reductionStatusSchema, TERMINAL_REDUCTION_STATUSES };
|
|
5
5
|
export declare const reductionTargetTypeSchema: z.ZodEnum<{
|
|
6
6
|
message: "message";
|
|
7
|
-
reduce: "reduce";
|
|
8
7
|
spec: "spec";
|
|
8
|
+
reduce: "reduce";
|
|
9
9
|
run: "run";
|
|
10
10
|
verify: "verify";
|
|
11
11
|
}>;
|
|
@@ -13,8 +13,8 @@ export type ReductionTargetType = z.infer<typeof reductionTargetTypeSchema>;
|
|
|
13
13
|
export declare const reductionTargetSchema: z.ZodObject<{
|
|
14
14
|
type: z.ZodEnum<{
|
|
15
15
|
message: "message";
|
|
16
|
-
reduce: "reduce";
|
|
17
16
|
spec: "spec";
|
|
17
|
+
reduce: "reduce";
|
|
18
18
|
run: "run";
|
|
19
19
|
verify: "verify";
|
|
20
20
|
}>;
|
|
@@ -60,8 +60,8 @@ export declare const reductionRecordSchema: z.ZodObject<{
|
|
|
60
60
|
target: z.ZodObject<{
|
|
61
61
|
type: z.ZodEnum<{
|
|
62
62
|
message: "message";
|
|
63
|
-
reduce: "reduce";
|
|
64
63
|
spec: "spec";
|
|
64
|
+
reduce: "reduce";
|
|
65
65
|
run: "run";
|
|
66
66
|
verify: "verify";
|
|
67
67
|
}>;
|
|
@@ -7,7 +7,9 @@ import { gitAddAll, gitCommitAll, gitDiff, gitDiffShortStat, gitHasStagedChanges
|
|
|
7
7
|
import { enforceCredentialExclusion } from "../../../../workspace/credential-guard.js";
|
|
8
8
|
import { cleanupWorkspaceDependencies, ensureWorkspaceDependencies, WorkspaceDependencyCleanupError, } from "../../../../workspace/dependencies.js";
|
|
9
9
|
import { promoteWorkspaceFile } from "../../../../workspace/promotion.js";
|
|
10
|
+
import { WORKSPACE_SHIM_RELATIVE_PATH } from "../../../../workspace/shim.js";
|
|
10
11
|
import { WORKSPACE_SUMMARY_FILENAME, } from "./workspace.js";
|
|
12
|
+
const EXPORT_EXCLUDED_PATHS = [WORKSPACE_SHIM_RELATIVE_PATH.join("/")];
|
|
11
13
|
export async function collectAgentArtifacts(options) {
|
|
12
14
|
const { baseRevisionSha, workspacePaths, root, environment, persona } = options;
|
|
13
15
|
const { workspacePath, artifactsPath, summaryPath, diffPath } = workspacePaths;
|
|
@@ -33,7 +35,7 @@ export async function collectAgentArtifacts(options) {
|
|
|
33
35
|
let artifactResult;
|
|
34
36
|
let dependencyRestoreError;
|
|
35
37
|
try {
|
|
36
|
-
await runGitStep("Git add failed", async () => gitAddAll(workspacePath));
|
|
38
|
+
await runGitStep("Git add failed", async () => gitAddAll(workspacePath, EXPORT_EXCLUDED_PATHS));
|
|
37
39
|
const hasChangesBeforeSummary = await gitHasStagedChanges(workspacePath);
|
|
38
40
|
if (!hasChangesBeforeSummary) {
|
|
39
41
|
throw new AgentProcessError({
|
|
@@ -45,7 +47,7 @@ export async function collectAgentArtifacts(options) {
|
|
|
45
47
|
artifactsPath,
|
|
46
48
|
summaryPath,
|
|
47
49
|
});
|
|
48
|
-
await runGitStep("Git add failed", async () => gitAddAll(workspacePath));
|
|
50
|
+
await runGitStep("Git add failed", async () => gitAddAll(workspacePath, EXPORT_EXCLUDED_PATHS));
|
|
49
51
|
const hasChanges = await gitHasStagedChanges(workspacePath);
|
|
50
52
|
if (!hasChanges) {
|
|
51
53
|
throw new AgentProcessError({
|
|
@@ -6,7 +6,7 @@ import { AgentProcessError, GitOperationError, RunCommandError, } from "../../..
|
|
|
6
6
|
import { toErrorMessage } from "../../../../utils/errors.js";
|
|
7
7
|
import { GIT_AUTHOR_EMAIL, GIT_AUTHOR_NAME } from "../../../../utils/git.js";
|
|
8
8
|
import { extractProviderNativeTokenUsageForSession } from "../../../../workspace/chat/native-usage.js";
|
|
9
|
-
import { VORATIQ_RUN_DIR } from "../../../../workspace/
|
|
9
|
+
import { VORATIQ_RUN_DIR } from "../../../../workspace/constants.js";
|
|
10
10
|
import { runPostProcessingAndCollectArtifacts } from "./post-processing.js";
|
|
11
11
|
export async function runPreparedAgent(execution) {
|
|
12
12
|
return await executeAgentLifecycle(execution);
|
|
@@ -2,8 +2,9 @@ import { mkdir, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
3
|
import { normalizePathForDisplay, resolvePath, } from "../../../../utils/path.js";
|
|
4
4
|
import { prepareAgentWorkspace } from "../../../../workspace/agents.js";
|
|
5
|
+
import { getAgentSessionDiffPath, getAgentSessionSummaryPath, } from "../../../../workspace/artifact-paths.js";
|
|
6
|
+
import { VORATIQ_RUN_DIR } from "../../../../workspace/constants.js";
|
|
5
7
|
import { buildAgentWorkspacePaths, } from "../../../../workspace/layout.js";
|
|
6
|
-
import { getAgentSessionDiffPath, getAgentSessionSummaryPath, VORATIQ_RUN_DIR, } from "../../../../workspace/structure.js";
|
|
7
8
|
export const WORKSPACE_SUMMARY_FILENAME = ".summary.txt";
|
|
8
9
|
export async function buildRunAgentWorkspace(options) {
|
|
9
10
|
const { root, runId, agentId, baseRevisionSha, environment } = options;
|
|
@@ -52,7 +52,7 @@ export declare class AuthProviderStageError extends RunCommandError {
|
|
|
52
52
|
export declare class RunPreflightError extends RunCommandError {
|
|
53
53
|
readonly kind: "workspace-setup";
|
|
54
54
|
readonly issues: readonly PreflightIssue[];
|
|
55
|
-
constructor(issues: readonly PreflightIssue[],
|
|
55
|
+
constructor(issues: readonly PreflightIssue[], preProviderIssueCount?: number);
|
|
56
56
|
}
|
|
57
57
|
export declare class NoAgentsEnabledError extends RunCommandError {
|
|
58
58
|
readonly kind: "workspace-setup";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { formatOperatorPreflightIssueLines, resolveOperatorPreflightHintLines, } from "../../../preflight/formatting.js";
|
|
2
2
|
import { DisplayableError, } from "../../../utils/errors.js";
|
|
3
3
|
export class RunCommandError extends DisplayableError {
|
|
4
4
|
constructor(message, options = {}) {
|
|
@@ -76,16 +76,13 @@ export class AuthProviderStageError extends RunCommandError {
|
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const RUN_PREFLIGHT_UNLABELED_AGENT_IDS = ["settings"];
|
|
80
79
|
export class RunPreflightError extends RunCommandError {
|
|
81
80
|
kind = "workspace-setup";
|
|
82
81
|
issues;
|
|
83
|
-
constructor(issues,
|
|
82
|
+
constructor(issues, preProviderIssueCount = issues.length) {
|
|
84
83
|
super("Preflight failed. Aborting run.", {
|
|
85
|
-
detailLines:
|
|
86
|
-
|
|
87
|
-
}),
|
|
88
|
-
hintLines,
|
|
84
|
+
detailLines: formatOperatorPreflightIssueLines(issues),
|
|
85
|
+
hintLines: resolveOperatorPreflightHintLines(issues, preProviderIssueCount) ?? [],
|
|
89
86
|
});
|
|
90
87
|
this.issues = Array.from(issues);
|
|
91
88
|
this.name = "RunPreflightError";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { buildAgentArtifactPaths,
|
|
1
|
+
import { buildAgentArtifactPaths, getAgentManifestPath, } from "../../../workspace/artifact-paths.js";
|
|
2
|
+
import { getAgentDirectoryPath } from "../../../workspace/session-paths.js";
|
|
2
3
|
import { RunReportInvariantError } from "./errors.js";
|
|
3
4
|
export function finalizeAgentResult(runId, record, derivations) {
|
|
4
5
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentArtifactPaths } from "../../../workspace/
|
|
1
|
+
import { type AgentArtifactPaths } from "../../../workspace/artifact-paths.js";
|
|
2
2
|
import type { AgentStatus, ExtractedTokenUsage, RunApplyStatus, RunAutoOutcome, RunRecord, RunSpecDescriptor } from "./types.js";
|
|
3
3
|
export interface AgentInvocationEnhanced {
|
|
4
4
|
agentId: string;
|
|
@@ -2,7 +2,8 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { normalizeDiffStatistics } from "../../../utils/diff.js";
|
|
4
4
|
import { isFileSystemError } from "../../../utils/fs.js";
|
|
5
|
-
import { buildAgentArtifactPaths,
|
|
5
|
+
import { buildAgentArtifactPaths, getAgentManifestPath, } from "../../../workspace/artifact-paths.js";
|
|
6
|
+
import { getAgentDirectoryPath } from "../../../workspace/session-paths.js";
|
|
6
7
|
export function buildRunRecordEnhanced(record) {
|
|
7
8
|
const agents = (record.agents ?? []).map((agent) => {
|
|
8
9
|
const baseDirectory = getAgentDirectoryPath(record.runId, agent.agentId);
|