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
|
@@ -1,86 +1,49 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { verifyAgentProviders } from "../../agents/runtime/auth.js";
|
|
3
|
-
import { loadAgentCatalogDiagnostics } from "../../configs/agents/loader.js";
|
|
4
|
-
import { EnvironmentConfigParseError, MissingEnvironmentConfigError, } from "../../configs/environment/errors.js";
|
|
5
|
-
import { DEFAULT_ENVIRONMENT_FILE_DISPLAY, loadEnvironmentConfig, } from "../../configs/environment/loader.js";
|
|
6
|
-
import { loadRepoSettings } from "../../configs/settings/loader.js";
|
|
7
1
|
import { NoAgentsEnabledError, RunPreflightError, } from "../../domain/run/competition/errors.js";
|
|
8
2
|
import { RunOptionValidationError } from "../../domain/run/model/errors.js";
|
|
9
|
-
import {
|
|
3
|
+
import { loadOperatorEnvironment } from "../../preflight/environment.js";
|
|
4
|
+
import { prepareConfiguredOperatorReadiness } from "../../preflight/operator.js";
|
|
10
5
|
import { getHeadRevision } from "../../utils/git.js";
|
|
11
|
-
import { WorkspaceMissingEntryError } from "../../workspace/errors.js";
|
|
12
6
|
import { resolveEffectiveMaxParallel } from "../shared/max-parallel.js";
|
|
7
|
+
import { loadRunSpecInput } from "./spec-provenance.js";
|
|
13
8
|
/**
|
|
14
9
|
* Validate command parameters, load spec, and prepare execution prerequisites.
|
|
15
10
|
*/
|
|
16
11
|
export async function validateAndPrepare(input) {
|
|
17
|
-
const { root, specAbsolutePath, resolvedAgentIds, maxParallel: requestedMaxParallel, } = input;
|
|
12
|
+
const { root, specAbsolutePath, specDisplayPath, specsFilePath, resolvedAgentIds, maxParallel: requestedMaxParallel, } = input;
|
|
18
13
|
if (requestedMaxParallel !== undefined &&
|
|
19
14
|
(!Number.isInteger(requestedMaxParallel) || requestedMaxParallel <= 0)) {
|
|
20
15
|
throw new RunOptionValidationError("maxParallel", "must be a positive integer");
|
|
21
16
|
}
|
|
22
|
-
const specContent = await
|
|
17
|
+
const { specContent, specTarget } = await loadRunSpecInput({
|
|
18
|
+
root,
|
|
19
|
+
specAbsolutePath,
|
|
20
|
+
specDisplayPath: specDisplayPath ?? specAbsolutePath,
|
|
21
|
+
specsFilePath,
|
|
22
|
+
});
|
|
23
23
|
const baseRevisionSha = await getHeadRevision(root);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const agentDiagnostics = loadAgentCatalogDiagnostics({ root });
|
|
32
|
-
preflightIssues.push(...agentDiagnostics.issues.filter((issue) => selectedAgentIds.has(issue.agentId)));
|
|
33
|
-
const catalogById = new Map(agentDiagnostics.catalog.map((agent) => [agent.id, agent]));
|
|
34
|
-
agents = resolvedAgentIds.flatMap((agentId) => {
|
|
35
|
-
const agent = catalogById.get(agentId);
|
|
36
|
-
return agent ? [agent] : [];
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
const agentDiagnostics = loadAgentCatalogDiagnostics({ root });
|
|
41
|
-
const enabledAgents = agentDiagnostics.enabledAgents;
|
|
42
|
-
if (enabledAgents.length === 0) {
|
|
43
|
-
throw new NoAgentsEnabledError();
|
|
44
|
-
}
|
|
45
|
-
preflightIssues.push(...agentDiagnostics.issues);
|
|
46
|
-
agents = agentDiagnostics.catalog;
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
loadRepoSettings({ root });
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
preflightIssues.push({
|
|
53
|
-
agentId: "settings",
|
|
54
|
-
message: toErrorMessage(error),
|
|
55
|
-
});
|
|
24
|
+
const preflight = await prepareConfiguredOperatorReadiness({
|
|
25
|
+
root,
|
|
26
|
+
resolvedAgentIds,
|
|
27
|
+
includeEnvironment: false,
|
|
28
|
+
});
|
|
29
|
+
if (preflight.noAgentsEnabled) {
|
|
30
|
+
throw new NoAgentsEnabledError();
|
|
56
31
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
id: agent.id,
|
|
60
|
-
provider: agent.provider,
|
|
61
|
-
})));
|
|
62
|
-
preflightIssues.push(...providerIssues);
|
|
63
|
-
if (preflightIssues.length > 0) {
|
|
64
|
-
throw new RunPreflightError(preflightIssues, preProviderIssueCount === 0 ? [] : undefined);
|
|
32
|
+
if (preflight.issues.length > 0) {
|
|
33
|
+
throw new RunPreflightError(preflight.issues, preflight.preProviderIssueCount);
|
|
65
34
|
}
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (error instanceof MissingEnvironmentConfigError ||
|
|
72
|
-
error instanceof EnvironmentConfigParseError) {
|
|
73
|
-
throw new WorkspaceMissingEntryError(DEFAULT_ENVIRONMENT_FILE_DISPLAY);
|
|
74
|
-
}
|
|
75
|
-
throw error;
|
|
76
|
-
}
|
|
77
|
-
})();
|
|
35
|
+
const agents = preflight.agents;
|
|
36
|
+
const environment = loadOperatorEnvironment({
|
|
37
|
+
root,
|
|
38
|
+
errorMode: "workspace-missing",
|
|
39
|
+
});
|
|
78
40
|
const effectiveMaxParallel = resolveEffectiveMaxParallel({
|
|
79
41
|
competitorCount: agents.length,
|
|
80
42
|
requestedMaxParallel,
|
|
81
43
|
});
|
|
82
44
|
return {
|
|
83
45
|
specContent,
|
|
46
|
+
specTarget,
|
|
84
47
|
baseRevisionSha,
|
|
85
48
|
agents,
|
|
86
49
|
effectiveMaxParallel,
|
|
@@ -4,7 +4,8 @@ import { loadAgentById } from "../../configs/agents/loader.js";
|
|
|
4
4
|
import { loadOrchestrationConfig } from "../../configs/orchestration/loader.js";
|
|
5
5
|
import { HintedError } from "../../utils/errors.js";
|
|
6
6
|
import { readUtf8File } from "../../utils/fs.js";
|
|
7
|
-
import {
|
|
7
|
+
import { VORATIQ_AGENTS_FILE, VORATIQ_ORCHESTRATION_FILE, } from "../../workspace/constants.js";
|
|
8
|
+
import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
|
|
8
9
|
const ORCHESTRATION_CONFIG_DISPLAY_PATH = VORATIQ_ORCHESTRATION_FILE;
|
|
9
10
|
const DEFAULT_PROFILE_NAME = "default";
|
|
10
11
|
export function resolveStageCompetitors(input) {
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { executeCompetitionWithAdapter } from "../../competition/command-adapter.js";
|
|
2
2
|
import { AgentNotFoundError } from "../../configs/agents/errors.js";
|
|
3
|
-
import { loadEnvironmentConfig } from "../../configs/environment/loader.js";
|
|
4
|
-
import { buildLifecycleStartFields, buildOperationLifecycleCompleteFields, } from "../../domain/shared/lifecycle.js";
|
|
5
3
|
import { createSpecCompetitionAdapter, } from "../../domain/spec/competition/adapter.js";
|
|
4
|
+
import { createSpecRecordMutators } from "../../domain/spec/model/mutators.js";
|
|
6
5
|
import { deriveSpecStatusFromAgents, } from "../../domain/spec/model/types.js";
|
|
7
|
-
import { appendSpecRecord,
|
|
6
|
+
import { appendSpecRecord, flushSpecRecordBuffer, } from "../../domain/spec/persistence/adapter.js";
|
|
8
7
|
import { buildPersistedExtraContextFields } from "../../extra-context/contract.js";
|
|
8
|
+
import { loadOperatorEnvironment } from "../../preflight/environment.js";
|
|
9
|
+
import { prepareConfiguredOperatorReadiness } from "../../preflight/operator.js";
|
|
9
10
|
import { toErrorMessage } from "../../utils/errors.js";
|
|
10
11
|
import { getHeadRevision } from "../../utils/git.js";
|
|
12
|
+
import { emitSwarmSessionAcknowledgement } from "../../utils/swarm-session-ack.js";
|
|
11
13
|
import { resolveEffectiveMaxParallel } from "../shared/max-parallel.js";
|
|
12
14
|
import { resolveStageCompetitors } from "../shared/resolve-stage-competitors.js";
|
|
13
15
|
import { generateSessionId } from "../shared/session-id.js";
|
|
14
|
-
import { SpecAgentNotFoundError, SpecGenerationFailedError } from "./errors.js";
|
|
16
|
+
import { SpecAgentNotFoundError, SpecGenerationFailedError, SpecPreflightError, } from "./errors.js";
|
|
15
17
|
export async function executeSpecCommand(input) {
|
|
16
18
|
const { root, specsFilePath, description, agentIds: cliAgentIds, profileName, maxParallel: requestedMaxParallel, title: providedTitle, extraContextFiles = [], onStatus, renderer, } = input;
|
|
17
|
-
let
|
|
19
|
+
let resolvedAgentIds;
|
|
18
20
|
try {
|
|
19
21
|
const normalizedCliIds = cliAgentIds && cliAgentIds.length > 0 ? [...cliAgentIds] : undefined;
|
|
20
22
|
const resolution = resolveStageCompetitors({
|
|
@@ -22,9 +24,10 @@ export async function executeSpecCommand(input) {
|
|
|
22
24
|
stageId: "spec",
|
|
23
25
|
cliAgentIds: normalizedCliIds,
|
|
24
26
|
profileName,
|
|
27
|
+
includeDefinitions: false,
|
|
25
28
|
});
|
|
26
|
-
|
|
27
|
-
if (
|
|
29
|
+
resolvedAgentIds = resolution.agentIds;
|
|
30
|
+
if (resolvedAgentIds.length === 0) {
|
|
28
31
|
throw new SpecGenerationFailedError(["Spec agent resolution failed."]);
|
|
29
32
|
}
|
|
30
33
|
}
|
|
@@ -34,7 +37,16 @@ export async function executeSpecCommand(input) {
|
|
|
34
37
|
}
|
|
35
38
|
throw error;
|
|
36
39
|
}
|
|
37
|
-
const
|
|
40
|
+
const preflight = await prepareConfiguredOperatorReadiness({
|
|
41
|
+
root,
|
|
42
|
+
resolvedAgentIds,
|
|
43
|
+
includeEnvironment: false,
|
|
44
|
+
});
|
|
45
|
+
if (preflight.issues.length > 0) {
|
|
46
|
+
throw new SpecPreflightError(preflight.issues, preflight.preProviderIssueCount);
|
|
47
|
+
}
|
|
48
|
+
const competitors = preflight.agents;
|
|
49
|
+
const environment = loadOperatorEnvironment({ root });
|
|
38
50
|
const effectiveMaxParallel = resolveEffectiveMaxParallel({
|
|
39
51
|
competitorCount: competitors.length,
|
|
40
52
|
requestedMaxParallel,
|
|
@@ -65,6 +77,16 @@ export async function executeSpecCommand(input) {
|
|
|
65
77
|
specsFilePath,
|
|
66
78
|
record,
|
|
67
79
|
});
|
|
80
|
+
await emitSwarmSessionAcknowledgement({
|
|
81
|
+
operator: "spec",
|
|
82
|
+
sessionId,
|
|
83
|
+
status: "running",
|
|
84
|
+
});
|
|
85
|
+
const mutators = createSpecRecordMutators({
|
|
86
|
+
root,
|
|
87
|
+
specsFilePath,
|
|
88
|
+
sessionId,
|
|
89
|
+
});
|
|
68
90
|
let currentAgents = [...initialAgents];
|
|
69
91
|
onStatus?.("Generating specification…");
|
|
70
92
|
renderer?.begin({
|
|
@@ -90,14 +112,15 @@ export async function executeSpecCommand(input) {
|
|
|
90
112
|
adapter: {
|
|
91
113
|
...baseAdapter,
|
|
92
114
|
onPreparationFailure: async (result) => {
|
|
93
|
-
|
|
94
|
-
root,
|
|
95
|
-
specsFilePath,
|
|
96
|
-
sessionId,
|
|
115
|
+
const updatedRecord = await mutators.recordAgentSnapshot({
|
|
97
116
|
agentId: result.agentId,
|
|
117
|
+
status: "failed",
|
|
118
|
+
startedAt: new Date().toISOString(),
|
|
119
|
+
completedAt: new Date().toISOString(),
|
|
98
120
|
tokenUsage: result.tokenUsage,
|
|
99
121
|
error: result.error ?? null,
|
|
100
122
|
});
|
|
123
|
+
currentAgents = [...updatedRecord.agents];
|
|
101
124
|
const failedAgent = currentAgents.find((agent) => agent.agentId === result.agentId);
|
|
102
125
|
renderer?.update({
|
|
103
126
|
agentId: result.agentId,
|
|
@@ -110,12 +133,10 @@ export async function executeSpecCommand(input) {
|
|
|
110
133
|
},
|
|
111
134
|
onCandidateRunning: async (prepared, index) => {
|
|
112
135
|
await baseAdapter.onCandidateRunning?.(prepared, index);
|
|
113
|
-
|
|
114
|
-
root,
|
|
115
|
-
specsFilePath,
|
|
116
|
-
sessionId,
|
|
136
|
+
const updatedRecord = await mutators.recordAgentRunning({
|
|
117
137
|
agentId: prepared.candidate.id,
|
|
118
138
|
});
|
|
139
|
+
currentAgents = [...updatedRecord.agents];
|
|
119
140
|
const runningAgent = currentAgents.find((agent) => agent.agentId === prepared.candidate.id);
|
|
120
141
|
renderer?.update({
|
|
121
142
|
agentId: prepared.candidate.id,
|
|
@@ -124,12 +145,8 @@ export async function executeSpecCommand(input) {
|
|
|
124
145
|
});
|
|
125
146
|
},
|
|
126
147
|
onCandidateCompleted: async (_prepared, result) => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
specsFilePath,
|
|
130
|
-
sessionId,
|
|
131
|
-
result,
|
|
132
|
-
});
|
|
148
|
+
const updatedRecord = await mutators.recordAgentSnapshot(toSpecAgentEntry(result));
|
|
149
|
+
currentAgents = [...updatedRecord.agents];
|
|
133
150
|
const completedAgent = currentAgents.find((agent) => agent.agentId === result.agentId);
|
|
134
151
|
renderer?.update({
|
|
135
152
|
agentId: result.agentId,
|
|
@@ -145,10 +162,7 @@ export async function executeSpecCommand(input) {
|
|
|
145
162
|
}
|
|
146
163
|
catch (error) {
|
|
147
164
|
const detail = toErrorMessage(error);
|
|
148
|
-
await
|
|
149
|
-
root,
|
|
150
|
-
specsFilePath,
|
|
151
|
-
sessionId,
|
|
165
|
+
await mutators.completeSpec({
|
|
152
166
|
status: "failed",
|
|
153
167
|
error: detail,
|
|
154
168
|
});
|
|
@@ -161,10 +175,7 @@ export async function executeSpecCommand(input) {
|
|
|
161
175
|
: mapExecutionResultsToSpecAgents(executionResults, startedAt);
|
|
162
176
|
// Derive session status from agent outcomes.
|
|
163
177
|
const sessionStatus = deriveSpecStatusFromAgents(agentEntries.map((a) => a.status));
|
|
164
|
-
const latestRecord = await
|
|
165
|
-
root,
|
|
166
|
-
specsFilePath,
|
|
167
|
-
sessionId,
|
|
178
|
+
const latestRecord = await mutators.completeSpec({
|
|
168
179
|
status: sessionStatus,
|
|
169
180
|
agents: agentEntries,
|
|
170
181
|
error: sessionStatus === "failed" ? collectAgentErrors(agentEntries) : undefined,
|
|
@@ -195,114 +206,6 @@ function collectAgentErrors(agents) {
|
|
|
195
206
|
.map((a) => `${a.agentId}: ${a.error}`);
|
|
196
207
|
return errors.length > 0 ? errors.join("; ") : null;
|
|
197
208
|
}
|
|
198
|
-
async function persistSpecAgentRunning(options) {
|
|
199
|
-
const { root, specsFilePath, sessionId, agentId } = options;
|
|
200
|
-
const timestamp = new Date().toISOString();
|
|
201
|
-
const updated = await rewriteSpecRecord({
|
|
202
|
-
root,
|
|
203
|
-
specsFilePath,
|
|
204
|
-
sessionId,
|
|
205
|
-
mutate: (record) => ({
|
|
206
|
-
...record,
|
|
207
|
-
agents: record.agents.map((agent) => agent.agentId === agentId
|
|
208
|
-
? {
|
|
209
|
-
...agent,
|
|
210
|
-
status: "running",
|
|
211
|
-
...buildLifecycleStartFields({
|
|
212
|
-
existingStartedAt: agent.startedAt,
|
|
213
|
-
timestamp,
|
|
214
|
-
}),
|
|
215
|
-
completedAt: undefined,
|
|
216
|
-
error: null,
|
|
217
|
-
}
|
|
218
|
-
: agent),
|
|
219
|
-
}),
|
|
220
|
-
});
|
|
221
|
-
return [...updated.agents];
|
|
222
|
-
}
|
|
223
|
-
async function persistSpecAgentCompletion(options) {
|
|
224
|
-
const { root, specsFilePath, sessionId, result } = options;
|
|
225
|
-
const completedAt = new Date().toISOString();
|
|
226
|
-
const updated = await rewriteSpecRecord({
|
|
227
|
-
root,
|
|
228
|
-
specsFilePath,
|
|
229
|
-
sessionId,
|
|
230
|
-
mutate: (record) => ({
|
|
231
|
-
...record,
|
|
232
|
-
agents: record.agents.map((agent) => {
|
|
233
|
-
if (agent.agentId !== result.agentId) {
|
|
234
|
-
return agent;
|
|
235
|
-
}
|
|
236
|
-
const startedAt = buildLifecycleStartFields({
|
|
237
|
-
existingStartedAt: agent.startedAt,
|
|
238
|
-
timestamp: completedAt,
|
|
239
|
-
}).startedAt;
|
|
240
|
-
const completeFields = buildOperationLifecycleCompleteFields({
|
|
241
|
-
existing: {
|
|
242
|
-
startedAt,
|
|
243
|
-
completedAt: agent.completedAt,
|
|
244
|
-
},
|
|
245
|
-
completedAt,
|
|
246
|
-
});
|
|
247
|
-
if (result.status === "succeeded") {
|
|
248
|
-
return {
|
|
249
|
-
...agent,
|
|
250
|
-
status: "succeeded",
|
|
251
|
-
...completeFields,
|
|
252
|
-
outputPath: result.outputPath,
|
|
253
|
-
dataPath: result.dataPath,
|
|
254
|
-
tokenUsage: result.tokenUsage,
|
|
255
|
-
error: null,
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
return {
|
|
259
|
-
...agent,
|
|
260
|
-
status: "failed",
|
|
261
|
-
...completeFields,
|
|
262
|
-
tokenUsage: result.tokenUsage,
|
|
263
|
-
error: result.error ?? null,
|
|
264
|
-
};
|
|
265
|
-
}),
|
|
266
|
-
}),
|
|
267
|
-
});
|
|
268
|
-
return [...updated.agents];
|
|
269
|
-
}
|
|
270
|
-
async function persistSpecAgentFailure(options) {
|
|
271
|
-
const { root, specsFilePath, sessionId, agentId, tokenUsage, error } = options;
|
|
272
|
-
const completedAt = new Date().toISOString();
|
|
273
|
-
const updated = await rewriteSpecRecord({
|
|
274
|
-
root,
|
|
275
|
-
specsFilePath,
|
|
276
|
-
sessionId,
|
|
277
|
-
mutate: (record) => ({
|
|
278
|
-
...record,
|
|
279
|
-
agents: record.agents.map((agent) => {
|
|
280
|
-
if (agent.agentId !== agentId) {
|
|
281
|
-
return agent;
|
|
282
|
-
}
|
|
283
|
-
const startedAt = buildLifecycleStartFields({
|
|
284
|
-
existingStartedAt: agent.startedAt,
|
|
285
|
-
timestamp: completedAt,
|
|
286
|
-
}).startedAt;
|
|
287
|
-
const completeFields = buildOperationLifecycleCompleteFields({
|
|
288
|
-
existing: {
|
|
289
|
-
startedAt,
|
|
290
|
-
completedAt: agent.completedAt,
|
|
291
|
-
},
|
|
292
|
-
completedAt,
|
|
293
|
-
});
|
|
294
|
-
return {
|
|
295
|
-
...agent,
|
|
296
|
-
status: "failed",
|
|
297
|
-
...completeFields,
|
|
298
|
-
...(tokenUsage ? { tokenUsage } : {}),
|
|
299
|
-
error: error ?? null,
|
|
300
|
-
};
|
|
301
|
-
}),
|
|
302
|
-
}),
|
|
303
|
-
});
|
|
304
|
-
return [...updated.agents];
|
|
305
|
-
}
|
|
306
209
|
function mapExecutionResultsToSpecAgents(executionResults, startedAt) {
|
|
307
210
|
return executionResults.map((result) => {
|
|
308
211
|
const completedAt = new Date().toISOString();
|
|
@@ -317,6 +220,7 @@ function mapExecutionResultsToSpecAgents(executionResults, startedAt) {
|
|
|
317
220
|
status: "succeeded",
|
|
318
221
|
outputPath: result.outputPath,
|
|
319
222
|
dataPath: result.dataPath,
|
|
223
|
+
contentHash: result.contentHash,
|
|
320
224
|
tokenUsage: result.tokenUsage,
|
|
321
225
|
};
|
|
322
226
|
}
|
|
@@ -328,3 +232,25 @@ function mapExecutionResultsToSpecAgents(executionResults, startedAt) {
|
|
|
328
232
|
};
|
|
329
233
|
});
|
|
330
234
|
}
|
|
235
|
+
function toSpecAgentEntry(result) {
|
|
236
|
+
const completedAt = new Date().toISOString();
|
|
237
|
+
if (result.status === "succeeded") {
|
|
238
|
+
return {
|
|
239
|
+
agentId: result.agentId,
|
|
240
|
+
status: "succeeded",
|
|
241
|
+
completedAt,
|
|
242
|
+
outputPath: result.outputPath,
|
|
243
|
+
dataPath: result.dataPath,
|
|
244
|
+
contentHash: result.contentHash,
|
|
245
|
+
tokenUsage: result.tokenUsage,
|
|
246
|
+
error: null,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
agentId: result.agentId,
|
|
251
|
+
status: "failed",
|
|
252
|
+
completedAt,
|
|
253
|
+
tokenUsage: result.tokenUsage,
|
|
254
|
+
error: result.error ?? null,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliError } from "../../cli/errors.js";
|
|
2
|
+
import type { PreflightIssue } from "../../competition/shared/preflight.js";
|
|
2
3
|
export declare class SpecError extends CliError {
|
|
3
4
|
constructor(headline: string, detailLines?: readonly string[], hintLines?: readonly string[]);
|
|
4
5
|
}
|
|
@@ -9,3 +10,7 @@ export declare class SpecAgentNotFoundError extends SpecError {
|
|
|
9
10
|
export declare class SpecGenerationFailedError extends SpecError {
|
|
10
11
|
constructor(detailLines?: readonly string[]);
|
|
11
12
|
}
|
|
13
|
+
export declare class SpecPreflightError extends SpecError {
|
|
14
|
+
readonly issues: readonly PreflightIssue[];
|
|
15
|
+
constructor(issues: readonly PreflightIssue[], preProviderIssueCount: number);
|
|
16
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CliError } from "../../cli/errors.js";
|
|
2
|
+
import { formatOperatorPreflightIssueLines, resolveOperatorPreflightHintLines, } from "../../preflight/formatting.js";
|
|
2
3
|
export class SpecError extends CliError {
|
|
3
4
|
constructor(headline, detailLines = [], hintLines = []) {
|
|
4
5
|
super(headline, detailLines, hintLines);
|
|
@@ -21,3 +22,11 @@ export class SpecGenerationFailedError extends SpecError {
|
|
|
21
22
|
this.name = "SpecGenerationFailedError";
|
|
22
23
|
}
|
|
23
24
|
}
|
|
25
|
+
export class SpecPreflightError extends SpecError {
|
|
26
|
+
issues;
|
|
27
|
+
constructor(issues, preProviderIssueCount) {
|
|
28
|
+
super("Preflight failed. Aborting specification generation.", formatOperatorPreflightIssueLines(issues), resolveOperatorPreflightHintLines(issues, preProviderIssueCount) ?? []);
|
|
29
|
+
this.issues = Array.from(issues);
|
|
30
|
+
this.name = "SpecPreflightError";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -4,5 +4,7 @@ export declare function resolveVerificationAgents(options: {
|
|
|
4
4
|
root: string;
|
|
5
5
|
agentOverrideFlag?: string;
|
|
6
6
|
profileName?: string;
|
|
7
|
-
}):
|
|
8
|
-
|
|
7
|
+
}): {
|
|
8
|
+
readonly agentIds: readonly string[];
|
|
9
|
+
readonly competitors: readonly AgentDefinition[];
|
|
10
|
+
};
|
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
import { verifyAgentProviders } from "../../agents/runtime/auth.js";
|
|
2
1
|
import { AgentNotFoundError } from "../../configs/agents/errors.js";
|
|
3
2
|
import { resolveStageCompetitors } from "../shared/resolve-stage-competitors.js";
|
|
3
|
+
import { VerifyAgentNotFoundError } from "./errors.js";
|
|
4
4
|
export function resolveVerificationAgents(options) {
|
|
5
5
|
const { agentIds, root, agentOverrideFlag, profileName } = options;
|
|
6
6
|
try {
|
|
7
|
-
|
|
7
|
+
return resolveStageCompetitors({
|
|
8
8
|
root,
|
|
9
9
|
stageId: "verify",
|
|
10
10
|
cliAgentIds: agentIds,
|
|
11
11
|
cliOverrideFlag: agentOverrideFlag,
|
|
12
12
|
profileName,
|
|
13
|
+
includeDefinitions: false,
|
|
13
14
|
});
|
|
14
|
-
return [...resolution.competitors];
|
|
15
15
|
}
|
|
16
16
|
catch (error) {
|
|
17
17
|
if (error instanceof AgentNotFoundError) {
|
|
18
|
-
throw new
|
|
18
|
+
throw new VerifyAgentNotFoundError(error.agentId);
|
|
19
19
|
}
|
|
20
20
|
throw error;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
export async function assertVerifierPreflight(agents) {
|
|
24
|
-
const providerIssues = await verifyAgentProviders(agents.map((agent) => ({ id: agent.id, provider: agent.provider })));
|
|
25
|
-
if (providerIssues.length > 0) {
|
|
26
|
-
const detail = providerIssues.map((issue) => issue.message).join("; ");
|
|
27
|
-
throw new Error(`Verifier preflight failed: ${detail}`);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { teardownSessionAuth } from "../../agents/runtime/registry.js";
|
|
2
2
|
import { createTeardownController } from "../../competition/shared/teardown.js";
|
|
3
|
-
import { loadEnvironmentConfig } from "../../configs/environment/loader.js";
|
|
4
3
|
import { loadVerificationConfig } from "../../configs/verification/loader.js";
|
|
5
4
|
import { buildBlindedAliasMap } from "../../domain/verify/competition/blinding.js";
|
|
6
5
|
import { deriveVerificationStatusFromMethods, maybePersistSelectedSpecPath, } from "../../domain/verify/competition/finalize.js";
|
|
@@ -9,11 +8,16 @@ import { executeAndPersistRubricMethods } from "../../domain/verify/competition/
|
|
|
9
8
|
import { createVerificationRecordMutators } from "../../domain/verify/model/mutators.js";
|
|
10
9
|
import { appendVerificationRecord, flushVerificationRecordBuffer, } from "../../domain/verify/persistence/adapter.js";
|
|
11
10
|
import { buildPersistedExtraContextFields } from "../../extra-context/contract.js";
|
|
11
|
+
import { loadOperatorEnvironment } from "../../preflight/environment.js";
|
|
12
|
+
import { prepareConfiguredOperatorReadiness } from "../../preflight/operator.js";
|
|
12
13
|
import { toErrorMessage } from "../../utils/errors.js";
|
|
13
14
|
import { normalizePathForDisplay, relativeToRoot } from "../../utils/path.js";
|
|
14
|
-
import {
|
|
15
|
+
import { emitSwarmSessionAcknowledgement } from "../../utils/swarm-session-ack.js";
|
|
16
|
+
import { VORATIQ_VERIFICATION_SESSIONS_DIR } from "../../workspace/constants.js";
|
|
17
|
+
import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
|
|
15
18
|
import { generateSessionId } from "../shared/session-id.js";
|
|
16
|
-
import {
|
|
19
|
+
import { resolveVerificationAgents } from "./agents.js";
|
|
20
|
+
import { VerifyPreflightError } from "./errors.js";
|
|
17
21
|
import { finalizeActiveVerification, registerActiveVerification, } from "./lifecycle.js";
|
|
18
22
|
import { resolveVerifyRubricMaxParallel } from "./max-parallel.js";
|
|
19
23
|
import { resolveVerifyTarget } from "./targets.js";
|
|
@@ -29,14 +33,22 @@ export async function executeVerifyCommand(input) {
|
|
|
29
33
|
target,
|
|
30
34
|
});
|
|
31
35
|
const verificationConfig = loadVerificationConfig({ root });
|
|
32
|
-
const
|
|
36
|
+
const verificationPlan = resolveVerificationAgents({
|
|
33
37
|
agentIds,
|
|
34
38
|
root,
|
|
35
39
|
agentOverrideFlag,
|
|
36
40
|
profileName,
|
|
37
41
|
});
|
|
38
|
-
await
|
|
39
|
-
|
|
42
|
+
const preflight = await prepareConfiguredOperatorReadiness({
|
|
43
|
+
root,
|
|
44
|
+
resolvedAgentIds: verificationPlan.agentIds,
|
|
45
|
+
includeEnvironment: false,
|
|
46
|
+
});
|
|
47
|
+
if (preflight.issues.length > 0) {
|
|
48
|
+
throw new VerifyPreflightError(preflight.issues, preflight.preProviderIssueCount);
|
|
49
|
+
}
|
|
50
|
+
const verificationAgents = preflight.agents;
|
|
51
|
+
const environment = loadOperatorEnvironment({ root });
|
|
40
52
|
const verificationId = generateSessionId();
|
|
41
53
|
const createdAt = new Date().toISOString();
|
|
42
54
|
const aliasMap = buildBlindedAliasMap(resolvedTarget);
|
|
@@ -59,6 +71,11 @@ export async function executeVerifyCommand(input) {
|
|
|
59
71
|
methods: [],
|
|
60
72
|
},
|
|
61
73
|
});
|
|
74
|
+
await emitSwarmSessionAcknowledgement({
|
|
75
|
+
operator: "verify",
|
|
76
|
+
sessionId: verificationId,
|
|
77
|
+
status: "queued",
|
|
78
|
+
});
|
|
62
79
|
renderer?.begin({
|
|
63
80
|
verificationId,
|
|
64
81
|
createdAt,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CliError } from "../../cli/errors.js";
|
|
2
|
+
import type { PreflightIssue } from "../../competition/shared/preflight.js";
|
|
3
|
+
export declare class VerifyError extends CliError {
|
|
4
|
+
constructor(headline: string, detailLines?: readonly string[], hintLines?: readonly string[]);
|
|
5
|
+
}
|
|
6
|
+
export declare class VerifyAgentNotFoundError extends VerifyError {
|
|
7
|
+
constructor(agentId: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class VerifyPreflightError extends VerifyError {
|
|
10
|
+
readonly issues: readonly PreflightIssue[];
|
|
11
|
+
constructor(issues: readonly PreflightIssue[], preProviderIssueCount: number);
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CliError } from "../../cli/errors.js";
|
|
2
|
+
import { formatOperatorPreflightIssueLines, resolveOperatorPreflightHintLines, } from "../../preflight/formatting.js";
|
|
3
|
+
export class VerifyError extends CliError {
|
|
4
|
+
constructor(headline, detailLines = [], hintLines = []) {
|
|
5
|
+
super(headline, detailLines, hintLines);
|
|
6
|
+
this.name = "VerifyError";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class VerifyAgentNotFoundError extends VerifyError {
|
|
10
|
+
constructor(agentId) {
|
|
11
|
+
super(`Verifier agent not found: ${agentId}`);
|
|
12
|
+
this.name = "VerifyAgentNotFoundError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class VerifyPreflightError extends VerifyError {
|
|
16
|
+
issues;
|
|
17
|
+
constructor(issues, preProviderIssueCount) {
|
|
18
|
+
super("Preflight failed. Aborting verification.", formatOperatorPreflightIssueLines(issues), resolveOperatorPreflightHintLines(issues, preProviderIssueCount) ?? []);
|
|
19
|
+
this.issues = Array.from(issues);
|
|
20
|
+
this.name = "VerifyPreflightError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -3,7 +3,7 @@ import { buildOperationLifecycleCompleteFields, buildRecordLifecycleCompleteFiel
|
|
|
3
3
|
import { writeVerificationArtifact } from "../../domain/verify/competition/artifacts.js";
|
|
4
4
|
import { flushVerificationRecordBuffer, readVerificationRecords, rewriteVerificationRecord, } from "../../domain/verify/persistence/adapter.js";
|
|
5
5
|
import { toErrorMessage } from "../../utils/errors.js";
|
|
6
|
-
import { getVerificationProgrammaticResultPath, getVerificationRubricResultPath, } from "../../workspace/
|
|
6
|
+
import { getVerificationProgrammaticResultPath, getVerificationRubricResultPath, } from "../../workspace/artifact-paths.js";
|
|
7
7
|
export const VERIFY_ABORT_DETAIL = "Verification aborted before completion.";
|
|
8
8
|
let activeVerification;
|
|
9
9
|
let terminationInFlight = false;
|