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
package/dist/cli/list.js
CHANGED
|
@@ -2,7 +2,8 @@ import { Command } from "commander";
|
|
|
2
2
|
import { executeListCommand } from "../commands/list/command.js";
|
|
3
3
|
import { resolveCliContext } from "../preflight/index.js";
|
|
4
4
|
import { parsePositiveInteger } from "../utils/validators.js";
|
|
5
|
-
import {
|
|
5
|
+
import { VORATIQ_INTERACTIVE_FILE, VORATIQ_MESSAGE_FILE, VORATIQ_REDUCTION_FILE, VORATIQ_VERIFICATION_FILE, } from "../workspace/constants.js";
|
|
6
|
+
import { resolveWorkspacePath } from "../workspace/path-resolvers.js";
|
|
6
7
|
import { parseListInspectionCommandOptions } from "./contract.js";
|
|
7
8
|
import { writeCommandOutput } from "./output.js";
|
|
8
9
|
export async function runListCommand(options) {
|
|
@@ -19,6 +20,8 @@ export async function runListCommand(options) {
|
|
|
19
20
|
resolveWorkspacePath(root, VORATIQ_MESSAGE_FILE),
|
|
20
21
|
verificationsFilePath: workspacePaths.verificationsFile ??
|
|
21
22
|
resolveWorkspacePath(root, VORATIQ_VERIFICATION_FILE),
|
|
23
|
+
interactiveFilePath: workspacePaths.interactiveFile ??
|
|
24
|
+
resolveWorkspacePath(root, VORATIQ_INTERACTIVE_FILE),
|
|
22
25
|
operator: options.operator,
|
|
23
26
|
sessionId: options.sessionId,
|
|
24
27
|
limit: options.limit,
|
|
@@ -45,6 +48,7 @@ export function createListCommand() {
|
|
|
45
48
|
.option("--reduce [session-id]", "List reduction sessions or show one reduction session")
|
|
46
49
|
.option("--verify [session-id]", "List verification sessions or show one verification session")
|
|
47
50
|
.option("--message [session-id]", "List message sessions or show one message session")
|
|
51
|
+
.option("--interactive [session-id]", "List interactive sessions or show one interactive session")
|
|
48
52
|
.option("--limit <count>", "Show only the N most recent sessions (default: 10)", parseLimitOption)
|
|
49
53
|
.option("--verbose", "Show all statuses for the selected operator in table mode")
|
|
50
54
|
.option("--json", "Emit machine-readable list output")
|
package/dist/cli/message.js
CHANGED
|
@@ -4,15 +4,17 @@ import { checkPlatformSupport } from "../agents/runtime/sandbox.js";
|
|
|
4
4
|
import { executeMessageCommand } from "../commands/message/command.js";
|
|
5
5
|
import { buildMarkdownPreviewLines } from "../commands/shared/preview.js";
|
|
6
6
|
import { resolveExtraContextFiles } from "../competition/shared/extra-context.js";
|
|
7
|
+
import { resolveInteractiveSessionEnvLineage } from "../domain/interactive/session-env.js";
|
|
7
8
|
import { ensureSandboxDependencies, resolveCliContext, } from "../preflight/index.js";
|
|
8
9
|
import { createMessageRenderer, formatMessageElapsed, formatMessageRecipientDuration, renderMessageTranscript, } from "../render/transcripts/message.js";
|
|
9
10
|
import { renderWorkspaceAutoInitializedNotice } from "../render/transcripts/shared.js";
|
|
10
11
|
import { createStageStartLineEmitter } from "../render/utils/stage-output.js";
|
|
11
12
|
import { resolvePath } from "../utils/path.js";
|
|
12
|
-
import {
|
|
13
|
-
import { resolveWorkspacePath
|
|
13
|
+
import { VORATIQ_MESSAGE_FILE } from "../workspace/constants.js";
|
|
14
|
+
import { resolveWorkspacePath } from "../workspace/path-resolvers.js";
|
|
14
15
|
import { parseMessageExecutionCommandOptions } from "./contract.js";
|
|
15
16
|
import { buildMessageOperatorEnvelope, createSilentCliWriter, writeOperatorResultEnvelope, } from "./operator-envelope.js";
|
|
17
|
+
import { collectRepeatedStringOption, parseMaxParallelOption, } from "./option-parsers.js";
|
|
16
18
|
import { writeCommandOutput } from "./output.js";
|
|
17
19
|
export async function runMessageCommand(options) {
|
|
18
20
|
const { prompt, agentIds, profile, maxParallel, extraContext, json = false, stdout, stderr, writeOutput, } = options;
|
|
@@ -52,6 +54,10 @@ export async function runMessageCommand(options) {
|
|
|
52
54
|
stdout: rendererStdout,
|
|
53
55
|
stderr: rendererStderr,
|
|
54
56
|
});
|
|
57
|
+
const envLineage = await resolveInteractiveSessionEnvLineage({
|
|
58
|
+
root,
|
|
59
|
+
envValue: process.env.VORATIQ_INTERACTIVE_SESSION_ID,
|
|
60
|
+
});
|
|
55
61
|
const execution = await executeMessageCommand({
|
|
56
62
|
root,
|
|
57
63
|
messagesFilePath: workspacePaths.messagesFile ??
|
|
@@ -61,7 +67,12 @@ export async function runMessageCommand(options) {
|
|
|
61
67
|
profileName: profile,
|
|
62
68
|
maxParallel,
|
|
63
69
|
extraContextFiles,
|
|
64
|
-
|
|
70
|
+
target: envLineage.kind === "trusted"
|
|
71
|
+
? {
|
|
72
|
+
kind: "interactive",
|
|
73
|
+
sessionId: envLineage.sessionId,
|
|
74
|
+
}
|
|
75
|
+
: undefined,
|
|
65
76
|
renderer,
|
|
66
77
|
});
|
|
67
78
|
const body = renderMessageTranscript({
|
|
@@ -101,24 +112,18 @@ export async function runMessageCommand(options) {
|
|
|
101
112
|
})),
|
|
102
113
|
};
|
|
103
114
|
}
|
|
104
|
-
function collectStringOption(value, previous) {
|
|
105
|
-
return [...previous, value];
|
|
106
|
-
}
|
|
107
|
-
function parseMaxParallelOption(value) {
|
|
108
|
-
return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
|
|
109
|
-
}
|
|
110
115
|
export function createMessageCommand() {
|
|
111
116
|
return new Command("message")
|
|
112
117
|
.description("Send an isolated prompt to one or more agents")
|
|
113
118
|
.requiredOption("--prompt <text>", "Prompt to send")
|
|
114
119
|
.addOption(new Option("--agent <agent-id>", "Set recipient agents directly (repeatable; order preserved)")
|
|
115
120
|
.default([], "")
|
|
116
|
-
.argParser(
|
|
121
|
+
.argParser(collectRepeatedStringOption))
|
|
117
122
|
.option("--profile <name>", 'Orchestration profile (default: "default")')
|
|
118
123
|
.option("--max-parallel <count>", "Max concurrent recipients (default: all)", parseMaxParallelOption)
|
|
119
124
|
.addOption(new Option("--extra-context <path>", "Stage an extra context file into each recipient workspace (repeatable)")
|
|
120
125
|
.default([], "")
|
|
121
|
-
.argParser(
|
|
126
|
+
.argParser(collectRepeatedStringOption))
|
|
122
127
|
.option("--json", "Emit a machine-readable result envelope")
|
|
123
128
|
.allowExcessArguments(false)
|
|
124
129
|
.action(async (options, command) => {
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { ReductionTarget } from "../domain/reduce/model/types.js";
|
|
3
|
+
import type { RunSpecTarget } from "../domain/run/model/types.js";
|
|
3
4
|
import type { SelectionDecision } from "../policy/index.js";
|
|
4
5
|
import type { ReductionStatus, RunStatus, VerificationStatus } from "../status/index.js";
|
|
5
6
|
import { externalExecutionOperators } from "./contract.js";
|
|
6
7
|
export type EnvelopeOperator = (typeof externalExecutionOperators)[number];
|
|
7
|
-
export type EnvelopeStatus = "succeeded" | "failed" | "unresolved";
|
|
8
|
+
export type EnvelopeStatus = "queued" | "running" | "succeeded" | "failed" | "unresolved";
|
|
8
9
|
export interface EnvelopeArtifactRef {
|
|
9
10
|
kind: string;
|
|
10
11
|
path: string;
|
|
11
12
|
role?: string;
|
|
12
13
|
agentId?: string;
|
|
13
14
|
}
|
|
15
|
+
export interface EnvelopeTargetRef {
|
|
16
|
+
kind: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
lineage?: string;
|
|
19
|
+
issueCode?: string;
|
|
20
|
+
currentContentHash?: string;
|
|
21
|
+
source?: {
|
|
22
|
+
kind?: string;
|
|
23
|
+
sessionId?: string;
|
|
24
|
+
agentId?: string;
|
|
25
|
+
outputPath?: string;
|
|
26
|
+
contentHash?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
14
29
|
export interface OperatorResultEnvelope {
|
|
15
30
|
version: 1;
|
|
16
31
|
operator: EnvelopeOperator;
|
|
@@ -24,10 +39,7 @@ export interface OperatorResultEnvelope {
|
|
|
24
39
|
messageId?: string;
|
|
25
40
|
agentId?: string;
|
|
26
41
|
};
|
|
27
|
-
target?:
|
|
28
|
-
kind: string;
|
|
29
|
-
sessionId: string;
|
|
30
|
-
};
|
|
42
|
+
target?: EnvelopeTargetRef;
|
|
31
43
|
artifacts: EnvelopeArtifactRef[];
|
|
32
44
|
selection?: {
|
|
33
45
|
state: "resolvable" | "unresolved";
|
|
@@ -51,14 +63,16 @@ export declare const operatorResultEnvelopeSchema: z.ZodObject<{
|
|
|
51
63
|
version: z.ZodLiteral<1>;
|
|
52
64
|
operator: z.ZodEnum<{
|
|
53
65
|
message: "message";
|
|
66
|
+
spec: "spec";
|
|
54
67
|
reduce: "reduce";
|
|
55
68
|
apply: "apply";
|
|
56
|
-
spec: "spec";
|
|
57
69
|
run: "run";
|
|
58
70
|
verify: "verify";
|
|
59
71
|
prune: "prune";
|
|
60
72
|
}>;
|
|
61
73
|
status: z.ZodEnum<{
|
|
74
|
+
queued: "queued";
|
|
75
|
+
running: "running";
|
|
62
76
|
succeeded: "succeeded";
|
|
63
77
|
failed: "failed";
|
|
64
78
|
unresolved: "unresolved";
|
|
@@ -114,7 +128,7 @@ export interface VerifyEnvelopeInput {
|
|
|
114
128
|
sessionId: string;
|
|
115
129
|
};
|
|
116
130
|
outputPath: string;
|
|
117
|
-
status: VerificationStatus;
|
|
131
|
+
status: VerificationStatus | "unresolved";
|
|
118
132
|
selection?: SelectionDecision;
|
|
119
133
|
selectedSpecPath?: string;
|
|
120
134
|
warningMessage?: string;
|
|
@@ -166,11 +180,17 @@ export declare function buildSpecOperatorEnvelope(options: {
|
|
|
166
180
|
export declare function buildRunOperatorEnvelope(options: {
|
|
167
181
|
runId: string;
|
|
168
182
|
specPath: string;
|
|
183
|
+
specTarget?: RunSpecTarget;
|
|
169
184
|
status: RunStatus;
|
|
170
185
|
}): OperatorResultEnvelope;
|
|
171
186
|
export declare function buildVerifyOperatorEnvelope(options: VerifyEnvelopeInput): OperatorResultEnvelope;
|
|
172
187
|
export declare function buildReduceOperatorEnvelope(options: ReduceEnvelopeInput): OperatorResultEnvelope;
|
|
173
188
|
export declare function buildMessageOperatorEnvelope(options: MessageEnvelopeInput): OperatorResultEnvelope;
|
|
189
|
+
export declare function buildSwarmSessionAcknowledgementEnvelope(options: {
|
|
190
|
+
operator: Extract<EnvelopeOperator, "spec" | "run" | "reduce" | "verify" | "message">;
|
|
191
|
+
sessionId: string;
|
|
192
|
+
status: Extract<EnvelopeStatus, "queued" | "running" | "succeeded" | "failed">;
|
|
193
|
+
}): OperatorResultEnvelope;
|
|
174
194
|
export declare function buildApplyOperatorEnvelope(options: ApplyEnvelopeInput): OperatorResultEnvelope;
|
|
175
195
|
export declare function buildPruneOperatorEnvelope(options: PruneEnvelopeInput): OperatorResultEnvelope;
|
|
176
196
|
export declare function writeOperatorResultEnvelope(envelope: OperatorResultEnvelope, exitCode?: number): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { getMessageSessionDirectoryPath, getReductionSessionDirectoryPath, getRunDirectoryPath, getSpecSessionDirectoryPath, } from "../workspace/
|
|
2
|
+
import { getMessageSessionDirectoryPath, getReductionSessionDirectoryPath, getRunDirectoryPath, getSpecSessionDirectoryPath, getVerificationSessionDirectoryPath, } from "../workspace/session-paths.js";
|
|
3
3
|
import { externalExecutionOperators } from "./contract.js";
|
|
4
4
|
import { toCliError } from "./errors.js";
|
|
5
5
|
export const operatorResultEnvelopeSchema = z
|
|
6
6
|
.object({
|
|
7
7
|
version: z.literal(1),
|
|
8
8
|
operator: z.enum(externalExecutionOperators),
|
|
9
|
-
status: z.enum(["succeeded", "failed", "unresolved"]),
|
|
9
|
+
status: z.enum(["queued", "running", "succeeded", "failed", "unresolved"]),
|
|
10
10
|
timestamp: z.string(),
|
|
11
11
|
ids: z
|
|
12
12
|
.object({
|
|
@@ -131,6 +131,8 @@ export function buildSpecOperatorEnvelope(options) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
export function buildRunOperatorEnvelope(options) {
|
|
134
|
+
const target = buildRunEnvelopeTarget(options.specTarget);
|
|
135
|
+
const alerts = buildRunEnvelopeAlerts(options.specTarget);
|
|
134
136
|
return buildOperatorEnvelope({
|
|
135
137
|
operator: "run",
|
|
136
138
|
status: normalizeTerminalStatus(options.status),
|
|
@@ -149,10 +151,12 @@ export function buildRunOperatorEnvelope(options) {
|
|
|
149
151
|
path: options.specPath,
|
|
150
152
|
},
|
|
151
153
|
],
|
|
154
|
+
target,
|
|
155
|
+
alerts,
|
|
152
156
|
});
|
|
153
157
|
}
|
|
154
158
|
export function buildVerifyOperatorEnvelope(options) {
|
|
155
|
-
const status = options.selection?.state === "unresolved"
|
|
159
|
+
const status = options.status === "unresolved" || options.selection?.state === "unresolved"
|
|
156
160
|
? "unresolved"
|
|
157
161
|
: normalizeTerminalStatus(options.status);
|
|
158
162
|
const ids = {
|
|
@@ -232,6 +236,9 @@ export function buildReduceOperatorEnvelope(options) {
|
|
|
232
236
|
if (options.target.type === "reduce") {
|
|
233
237
|
ids.reductionId = options.target.id;
|
|
234
238
|
}
|
|
239
|
+
if (options.target.type === "message") {
|
|
240
|
+
ids.messageId = options.target.id;
|
|
241
|
+
}
|
|
235
242
|
return buildOperatorEnvelope({
|
|
236
243
|
operator: "reduce",
|
|
237
244
|
status: normalizeTerminalStatus(options.status),
|
|
@@ -278,6 +285,38 @@ export function buildMessageOperatorEnvelope(options) {
|
|
|
278
285
|
],
|
|
279
286
|
});
|
|
280
287
|
}
|
|
288
|
+
export function buildSwarmSessionAcknowledgementEnvelope(options) {
|
|
289
|
+
const ids = options.operator === "run"
|
|
290
|
+
? { runId: options.sessionId }
|
|
291
|
+
: { sessionId: options.sessionId };
|
|
292
|
+
const sessionPath = options.operator === "spec"
|
|
293
|
+
? getSpecSessionDirectoryPath(options.sessionId)
|
|
294
|
+
: options.operator === "run"
|
|
295
|
+
? getRunDirectoryPath(options.sessionId)
|
|
296
|
+
: options.operator === "reduce"
|
|
297
|
+
? getReductionSessionDirectoryPath(options.sessionId)
|
|
298
|
+
: options.operator === "verify"
|
|
299
|
+
? getVerificationSessionDirectoryPath(options.sessionId)
|
|
300
|
+
: getMessageSessionDirectoryPath(options.sessionId);
|
|
301
|
+
return buildOperatorEnvelope({
|
|
302
|
+
operator: options.operator,
|
|
303
|
+
status: options.status,
|
|
304
|
+
ids,
|
|
305
|
+
artifacts: [
|
|
306
|
+
{
|
|
307
|
+
kind: "session",
|
|
308
|
+
role: "session",
|
|
309
|
+
path: sessionPath,
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
alerts: [
|
|
313
|
+
{
|
|
314
|
+
level: "info",
|
|
315
|
+
message: "Recorded swarm session acknowledged. Use `voratiq_list` to inspect progress instead of retrying.",
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
});
|
|
319
|
+
}
|
|
281
320
|
export function buildApplyOperatorEnvelope(options) {
|
|
282
321
|
return buildOperatorEnvelope({
|
|
283
322
|
operator: "apply",
|
|
@@ -331,6 +370,59 @@ export function buildPruneOperatorEnvelope(options) {
|
|
|
331
370
|
: [],
|
|
332
371
|
});
|
|
333
372
|
}
|
|
373
|
+
function buildRunEnvelopeTarget(specTarget) {
|
|
374
|
+
if (specTarget?.kind === "spec") {
|
|
375
|
+
return {
|
|
376
|
+
kind: "spec",
|
|
377
|
+
sessionId: specTarget.sessionId,
|
|
378
|
+
...(specTarget.provenance
|
|
379
|
+
? buildRunEnvelopeProvenanceFields(specTarget.provenance)
|
|
380
|
+
: {}),
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
if (specTarget?.kind === "file" &&
|
|
384
|
+
specTarget.provenance?.source?.sessionId &&
|
|
385
|
+
specTarget.provenance.lineage === "invalid") {
|
|
386
|
+
return {
|
|
387
|
+
kind: "spec",
|
|
388
|
+
sessionId: specTarget.provenance.source.sessionId,
|
|
389
|
+
...buildRunEnvelopeProvenanceFields(specTarget.provenance),
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
return undefined;
|
|
393
|
+
}
|
|
394
|
+
function buildRunEnvelopeAlerts(specTarget) {
|
|
395
|
+
if (specTarget?.provenance?.lineage !== "invalid") {
|
|
396
|
+
return undefined;
|
|
397
|
+
}
|
|
398
|
+
return [
|
|
399
|
+
{
|
|
400
|
+
level: "warn",
|
|
401
|
+
message: specTarget.provenance.issueCode === "stale_source"
|
|
402
|
+
? "Run spec ancestry metadata referenced a stale or mismatched spec artifact."
|
|
403
|
+
: "Run spec ancestry metadata was malformed and was ignored.",
|
|
404
|
+
},
|
|
405
|
+
];
|
|
406
|
+
}
|
|
407
|
+
function buildRunEnvelopeProvenanceFields(provenance) {
|
|
408
|
+
return {
|
|
409
|
+
lineage: provenance.lineage,
|
|
410
|
+
...(provenance.lineage === "invalid"
|
|
411
|
+
? { issueCode: provenance.issueCode }
|
|
412
|
+
: {}),
|
|
413
|
+
...("currentContentHash" in provenance &&
|
|
414
|
+
typeof provenance.currentContentHash === "string"
|
|
415
|
+
? { currentContentHash: provenance.currentContentHash }
|
|
416
|
+
: {}),
|
|
417
|
+
...(provenance.source
|
|
418
|
+
? {
|
|
419
|
+
source: {
|
|
420
|
+
...provenance.source,
|
|
421
|
+
},
|
|
422
|
+
}
|
|
423
|
+
: {}),
|
|
424
|
+
};
|
|
425
|
+
}
|
|
334
426
|
export function writeOperatorResultEnvelope(envelope, exitCode) {
|
|
335
427
|
process.stdout.write(`${JSON.stringify(envelope)}\n`);
|
|
336
428
|
if (typeof exitCode === "number") {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { parsePositiveInteger } from "../utils/validators.js";
|
|
2
|
+
export function collectRepeatedStringOption(value, previous) {
|
|
3
|
+
return [...previous, value];
|
|
4
|
+
}
|
|
5
|
+
export function parseMaxParallelOption(value) {
|
|
6
|
+
return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
|
|
7
|
+
}
|
package/dist/cli/output.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
+
import type { CliWriter } from "../render/utils/cli-writer.js";
|
|
1
2
|
import { type FormatCliOutputOptions } from "../utils/output.js";
|
|
2
|
-
type CliWriter = Pick<NodeJS.WriteStream, "write"> & {
|
|
3
|
-
isTTY?: boolean;
|
|
4
|
-
columns?: number;
|
|
5
|
-
};
|
|
6
3
|
export type AlertSeverity = "info" | "warn" | "error";
|
|
7
4
|
export interface Alert {
|
|
8
5
|
readonly severity: AlertSeverity;
|
|
@@ -25,4 +22,3 @@ export interface ChainedCommandOutput {
|
|
|
25
22
|
export declare function beginChainedCommandOutput(): ChainedCommandOutput;
|
|
26
23
|
export declare function writeCommandOutput(payload: CommandOutputPayload): void;
|
|
27
24
|
export declare function renderCommandOutput(payload: CommandOutputPayload): void;
|
|
28
|
-
export {};
|
package/dist/cli/reduce.js
CHANGED
|
@@ -10,10 +10,11 @@ import { ensureSandboxDependencies, resolveCliContext, } from "../preflight/inde
|
|
|
10
10
|
import { createReduceRenderer, formatReduceElapsed, formatReducerDuration, renderReduceTranscript, } from "../render/transcripts/reduce.js";
|
|
11
11
|
import { createStageStartLineEmitter } from "../render/utils/stage-output.js";
|
|
12
12
|
import { normalizePathForDisplay, relativeToRoot, resolvePath, } from "../utils/path.js";
|
|
13
|
-
import {
|
|
14
|
-
import { resolveWorkspacePath
|
|
13
|
+
import { VORATIQ_MESSAGE_FILE, VORATIQ_REDUCTION_FILE, VORATIQ_VERIFICATION_FILE, } from "../workspace/constants.js";
|
|
14
|
+
import { resolveWorkspacePath } from "../workspace/path-resolvers.js";
|
|
15
15
|
import { parseReduceExecutionCommandOptions } from "./contract.js";
|
|
16
16
|
import { buildReduceOperatorEnvelope, createSilentCliWriter, writeOperatorResultEnvelope, } from "./operator-envelope.js";
|
|
17
|
+
import { collectRepeatedStringOption, parseMaxParallelOption, } from "./option-parsers.js";
|
|
17
18
|
import { writeCommandOutput } from "./output.js";
|
|
18
19
|
export async function runReduceCommand(options) {
|
|
19
20
|
const { target, agentIds, agentOverrideFlag, profile, maxParallel, extraContext, json = false, suppressHint, writeOutput, stdout, stderr, } = options;
|
|
@@ -147,15 +148,6 @@ function formatReductionSnippet(reduction) {
|
|
|
147
148
|
}
|
|
148
149
|
return lines.join("\n");
|
|
149
150
|
}
|
|
150
|
-
function collectAgentOption(value, previous) {
|
|
151
|
-
return [...previous, value];
|
|
152
|
-
}
|
|
153
|
-
function collectExtraContextOption(value, previous) {
|
|
154
|
-
return [...previous, value];
|
|
155
|
-
}
|
|
156
|
-
function parseMaxParallelOption(value) {
|
|
157
|
-
return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
|
|
158
|
-
}
|
|
159
151
|
export function createReduceCommand() {
|
|
160
152
|
return new Command("reduce")
|
|
161
153
|
.description("Reduce artifact sets into a summarized form")
|
|
@@ -166,12 +158,12 @@ export function createReduceCommand() {
|
|
|
166
158
|
.addOption(new Option("--message <message-id>", "Message session to reduce"))
|
|
167
159
|
.addOption(new Option("--agent <agent-id>", "Set reducers directly (repeatable; order preserved)")
|
|
168
160
|
.default([], "")
|
|
169
|
-
.argParser(
|
|
161
|
+
.argParser(collectRepeatedStringOption))
|
|
170
162
|
.option("--profile <name>", 'Orchestration profile (default: "default")')
|
|
171
163
|
.option("--max-parallel <count>", "Max concurrent reducers (default: all)", parseMaxParallelOption)
|
|
172
164
|
.addOption(new Option("--extra-context <path>", "Stage an extra context file into each reducer workspace (repeatable)")
|
|
173
165
|
.default([], "")
|
|
174
|
-
.argParser(
|
|
166
|
+
.argParser(collectRepeatedStringOption))
|
|
175
167
|
.option("--json", "Emit a machine-readable result envelope")
|
|
176
168
|
.allowExcessArguments(false)
|
|
177
169
|
.action(async (options, command) => {
|
package/dist/cli/run.js
CHANGED
|
@@ -9,9 +9,9 @@ import { createRunRenderer } from "../render/transcripts/run.js";
|
|
|
9
9
|
import { renderWorkspaceAutoInitializedNotice } from "../render/transcripts/shared.js";
|
|
10
10
|
import { createStageStartLineEmitter } from "../render/utils/stage-output.js";
|
|
11
11
|
import { mapRunStatusToExitCode } from "../status/index.js";
|
|
12
|
-
import { parsePositiveInteger } from "../utils/validators.js";
|
|
13
12
|
import { parseRunExecutionCommandOptions } from "./contract.js";
|
|
14
13
|
import { buildRunOperatorEnvelope, createSilentCliWriter, writeOperatorResultEnvelope, } from "./operator-envelope.js";
|
|
14
|
+
import { collectRepeatedStringOption, parseMaxParallelOption, } from "./option-parsers.js";
|
|
15
15
|
import { writeCommandOutput } from "./output.js";
|
|
16
16
|
export async function runRunCommand(options) {
|
|
17
17
|
const { specPath, agentIds, agentOverrideFlag, profile, maxParallel, branch, extraContext, json = false, suppressHint, suppressLeadingBlankLine, suppressTrailingBlankLine, stdout, stderr, writeOutput, } = options;
|
|
@@ -61,6 +61,7 @@ export async function runRunCommand(options) {
|
|
|
61
61
|
const report = await executeRunCommand({
|
|
62
62
|
root,
|
|
63
63
|
runsFilePath: workspacePaths.runsFile,
|
|
64
|
+
specsFilePath: workspacePaths.specsFile,
|
|
64
65
|
specAbsolutePath: absolutePath,
|
|
65
66
|
specDisplayPath: displayPath,
|
|
66
67
|
agentIds,
|
|
@@ -90,28 +91,19 @@ export function deriveBranchNameFromSpecPath(specPath) {
|
|
|
90
91
|
}
|
|
91
92
|
return base.slice(0, lastDotIndex);
|
|
92
93
|
}
|
|
93
|
-
function collectAgentOption(value, previous) {
|
|
94
|
-
return [...previous, value];
|
|
95
|
-
}
|
|
96
|
-
function collectExtraContextOption(value, previous) {
|
|
97
|
-
return [...previous, value];
|
|
98
|
-
}
|
|
99
|
-
function parseMaxParallelOption(value) {
|
|
100
|
-
return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
|
|
101
|
-
}
|
|
102
94
|
export function createRunCommand() {
|
|
103
95
|
return new Command("run")
|
|
104
96
|
.description("Execute agents against a spec")
|
|
105
97
|
.requiredOption("--spec <path>", "Path to the spec file")
|
|
106
98
|
.addOption(new Option("--agent <agent-id>", "Set agents directly (repeatable; order preserved)")
|
|
107
99
|
.default([], "")
|
|
108
|
-
.argParser(
|
|
100
|
+
.argParser(collectRepeatedStringOption))
|
|
109
101
|
.option("--profile <name>", 'Orchestration profile (default: "default")')
|
|
110
102
|
.option("--max-parallel <count>", "Max concurrent agents (default: all)", parseMaxParallelOption)
|
|
111
103
|
.option("--branch", "Create or checkout a branch named after the spec")
|
|
112
104
|
.addOption(new Option("--extra-context <path>", "Stage an extra context file into each agent workspace (repeatable)")
|
|
113
105
|
.default([], "")
|
|
114
|
-
.argParser(
|
|
106
|
+
.argParser(collectRepeatedStringOption))
|
|
115
107
|
.option("--json", "Emit a machine-readable result envelope")
|
|
116
108
|
.allowExcessArguments(false)
|
|
117
109
|
.action(async (options, command) => {
|
|
@@ -131,6 +123,7 @@ export function createRunCommand() {
|
|
|
131
123
|
writeOperatorResultEnvelope(buildRunOperatorEnvelope({
|
|
132
124
|
runId: result.report.runId,
|
|
133
125
|
specPath: result.report.spec.path,
|
|
126
|
+
specTarget: result.report.spec.target,
|
|
134
127
|
status: result.report.status,
|
|
135
128
|
}), result.exitCode);
|
|
136
129
|
return;
|
package/dist/cli/spec.js
CHANGED
|
@@ -9,10 +9,10 @@ import { renderWorkspaceAutoInitializedNotice } from "../render/transcripts/shar
|
|
|
9
9
|
import { createSpecRenderer, formatSpecAgentDuration, formatSpecElapsed, renderSpecTranscript, } from "../render/transcripts/spec.js";
|
|
10
10
|
import { createStageStartLineEmitter } from "../render/utils/stage-output.js";
|
|
11
11
|
import { resolvePath } from "../utils/path.js";
|
|
12
|
-
import {
|
|
13
|
-
import { getSpecSessionDirectoryPath } from "../workspace/structure.js";
|
|
12
|
+
import { getSpecSessionDirectoryPath } from "../workspace/session-paths.js";
|
|
14
13
|
import { parseSpecExecutionCommandOptions } from "./contract.js";
|
|
15
14
|
import { buildSpecOperatorEnvelope, createSilentCliWriter, writeOperatorResultEnvelope, } from "./operator-envelope.js";
|
|
15
|
+
import { collectRepeatedStringOption, parseMaxParallelOption, } from "./option-parsers.js";
|
|
16
16
|
import { writeCommandOutput } from "./output.js";
|
|
17
17
|
export async function runSpecCommand(options) {
|
|
18
18
|
const { description, agentIds, profile, maxParallel, title, extraContext, json = false, suppressHint, suppressLeadingBlankLine, suppressTrailingBlankLine, stdout, stderr, writeOutput, } = options;
|
|
@@ -135,18 +135,12 @@ function formatSpecPreview(spec) {
|
|
|
135
135
|
return lines.join("\n");
|
|
136
136
|
}
|
|
137
137
|
export function createSpecCommand() {
|
|
138
|
-
const parseMaxParallelOption = (value) => parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
|
|
139
|
-
const collectAgentOption = (value, previous) => [
|
|
140
|
-
...previous,
|
|
141
|
-
value,
|
|
142
|
-
];
|
|
143
|
-
const collectExtraContextOption = (value, previous) => [...previous, value];
|
|
144
138
|
return new Command("spec")
|
|
145
139
|
.description("Generate a spec from a task description")
|
|
146
140
|
.requiredOption("--description <text>", "Task description")
|
|
147
141
|
.addOption(new Option("--agent <agent-id>", "Set agents directly (repeatable; order preserved)")
|
|
148
142
|
.default([], "")
|
|
149
|
-
.argParser(
|
|
143
|
+
.argParser(collectRepeatedStringOption))
|
|
150
144
|
.option("--profile <name>", 'Orchestration profile (default: "default")')
|
|
151
145
|
.addOption(new Option("--max-parallel <count>", "Max concurrent agents")
|
|
152
146
|
.argParser(parseMaxParallelOption)
|
|
@@ -154,7 +148,7 @@ export function createSpecCommand() {
|
|
|
154
148
|
.option("--title <text>", "Spec title; agent infers if omitted")
|
|
155
149
|
.addOption(new Option("--extra-context <path>", "Stage an extra context file into the spec workspace (repeatable)")
|
|
156
150
|
.default([], "")
|
|
157
|
-
.argParser(
|
|
151
|
+
.argParser(collectRepeatedStringOption))
|
|
158
152
|
.option("--json", "Emit a machine-readable result envelope")
|
|
159
153
|
.allowExcessArguments(false)
|
|
160
154
|
.action(async (options, command) => {
|
package/dist/cli/verify.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface VerifyCommandOptions {
|
|
|
22
22
|
}
|
|
23
23
|
export interface VerifyCommandResult {
|
|
24
24
|
verificationId: string;
|
|
25
|
-
status: VerificationRecord["status"];
|
|
25
|
+
status: VerificationRecord["status"] | "unresolved";
|
|
26
26
|
target: VerificationRecord["target"];
|
|
27
27
|
body: string;
|
|
28
28
|
exitCode?: number;
|
package/dist/cli/verify.js
CHANGED
|
@@ -18,11 +18,26 @@ import { TERMINAL_VERIFICATION_STATUSES } from "../status/index.js";
|
|
|
18
18
|
import { colorize } from "../utils/colors.js";
|
|
19
19
|
import { toErrorMessage } from "../utils/errors.js";
|
|
20
20
|
import { normalizePathForDisplay, relativeToRoot, resolvePath, } from "../utils/path.js";
|
|
21
|
-
import {
|
|
22
|
-
import { resolveWorkspacePath
|
|
21
|
+
import { VORATIQ_MESSAGE_FILE, VORATIQ_REDUCTION_FILE, VORATIQ_VERIFICATION_FILE, VORATIQ_VERIFICATION_SESSIONS_DIR, } from "../workspace/constants.js";
|
|
22
|
+
import { resolveWorkspacePath } from "../workspace/path-resolvers.js";
|
|
23
23
|
import { parseVerifyExecutionCommandOptions } from "./contract.js";
|
|
24
24
|
import { buildVerifyOperatorEnvelope, createSilentCliWriter, writeOperatorResultEnvelope, } from "./operator-envelope.js";
|
|
25
|
+
import { collectRepeatedStringOption, parseMaxParallelOption, } from "./option-parsers.js";
|
|
25
26
|
import { writeCommandOutput } from "./output.js";
|
|
27
|
+
const UNRESOLVED_VERIFICATION_MESSAGE = "Verification did not produce a resolvable candidate; manual review required.";
|
|
28
|
+
function resolveVerifyManualActionMessage(options) {
|
|
29
|
+
const { targetKind, status, selection, selectedSpecPath } = options;
|
|
30
|
+
if (status !== "succeeded") {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
if (targetKind === "spec" && !selectedSpecPath) {
|
|
34
|
+
return UNRESOLVED_VERIFICATION_MESSAGE;
|
|
35
|
+
}
|
|
36
|
+
if (selection?.decision.state !== "unresolved") {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return UNRESOLVED_VERIFICATION_MESSAGE;
|
|
40
|
+
}
|
|
26
41
|
export async function runVerifyCommand(options) {
|
|
27
42
|
const { target, agentIds, agentOverrideFlag, profile, maxParallel, extraContext, json = false, suppressHint, stdout, stderr, writeOutput, } = options;
|
|
28
43
|
const effectiveWriteOutput = json
|
|
@@ -97,10 +112,30 @@ export async function runVerifyCommand(options) {
|
|
|
97
112
|
return undefined;
|
|
98
113
|
});
|
|
99
114
|
const selectionWarnings = (selection?.warnings ?? []).map((warning) => `Warning: ${warning}`);
|
|
115
|
+
const selectedSpecPath = execution.record.target.kind === "spec" &&
|
|
116
|
+
typeof execution.record.target.specPath === "string"
|
|
117
|
+
? execution.record.target.specPath
|
|
118
|
+
: undefined;
|
|
119
|
+
const manualActionMessage = resolveVerifyManualActionMessage({
|
|
120
|
+
targetKind: execution.record.target.kind,
|
|
121
|
+
status: execution.record.status,
|
|
122
|
+
selection,
|
|
123
|
+
selectedSpecPath,
|
|
124
|
+
});
|
|
100
125
|
const warningMessage = [
|
|
101
126
|
...selectionWarnings,
|
|
102
127
|
...(selectionPolicyWarning ? [selectionPolicyWarning] : []),
|
|
128
|
+
...(manualActionMessage ? [manualActionMessage] : []),
|
|
103
129
|
].join("\n");
|
|
130
|
+
const displayStatus = selection?.decision.state === "unresolved"
|
|
131
|
+
? "unresolved"
|
|
132
|
+
: execution.record.status;
|
|
133
|
+
if (displayStatus === "unresolved" && !json) {
|
|
134
|
+
renderer.complete("unresolved", {
|
|
135
|
+
startedAt: execution.record.startedAt,
|
|
136
|
+
completedAt: execution.record.completedAt,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
104
139
|
const recommendedRunAgent = execution.record.target.kind === "run" &&
|
|
105
140
|
selection !== undefined &&
|
|
106
141
|
selection.decision.state === "resolvable"
|
|
@@ -109,9 +144,10 @@ export async function runVerifyCommand(options) {
|
|
|
109
144
|
const hintMessage = suppressHint ||
|
|
110
145
|
selectionPolicyWarning ||
|
|
111
146
|
execution.record.target.kind !== "run" ||
|
|
112
|
-
execution.record.status !== "succeeded"
|
|
147
|
+
execution.record.status !== "succeeded" ||
|
|
148
|
+
selection?.decision.state !== "resolvable"
|
|
113
149
|
? undefined
|
|
114
|
-
: `To apply a solution:\n voratiq apply --run ${execution.record.target.sessionId} --agent ${recommendedRunAgent
|
|
150
|
+
: `To apply a solution:\n voratiq apply --run ${execution.record.target.sessionId} --agent ${recommendedRunAgent}`;
|
|
115
151
|
const outputPath = normalizePathForDisplay(relativeToRoot(root, resolveWorkspacePath(root, VORATIQ_VERIFICATION_SESSIONS_DIR, execution.verificationId)));
|
|
116
152
|
const body = renderVerifyTranscript({
|
|
117
153
|
verificationId: execution.verificationId,
|
|
@@ -123,7 +159,7 @@ export async function runVerifyCommand(options) {
|
|
|
123
159
|
}) ?? "—",
|
|
124
160
|
workspacePath: normalizePathForDisplay(relativeToRoot(root, resolveWorkspacePath(root, VORATIQ_VERIFICATION_SESSIONS_DIR, execution.verificationId))),
|
|
125
161
|
target: execution.record.target,
|
|
126
|
-
status:
|
|
162
|
+
status: displayStatus,
|
|
127
163
|
methods: methodBlocks,
|
|
128
164
|
suppressHint,
|
|
129
165
|
...(warningMessage ? { warningMessage } : {}),
|
|
@@ -133,28 +169,21 @@ export async function runVerifyCommand(options) {
|
|
|
133
169
|
});
|
|
134
170
|
return {
|
|
135
171
|
verificationId: execution.verificationId,
|
|
136
|
-
status:
|
|
172
|
+
status: displayStatus,
|
|
137
173
|
target: execution.record.target,
|
|
138
174
|
body,
|
|
139
|
-
exitCode: execution.record.status === "succeeded"
|
|
175
|
+
exitCode: execution.record.status === "succeeded" &&
|
|
176
|
+
selection?.decision.state !== "unresolved" &&
|
|
177
|
+
!(execution.record.target.kind === "spec" &&
|
|
178
|
+
typeof selectedSpecPath !== "string")
|
|
179
|
+
? 0
|
|
180
|
+
: 1,
|
|
140
181
|
outputPath,
|
|
141
|
-
...(
|
|
142
|
-
typeof execution.record.target.specPath === "string"
|
|
143
|
-
? { selectedSpecPath: execution.record.target.specPath }
|
|
144
|
-
: {}),
|
|
182
|
+
...(selectedSpecPath ? { selectedSpecPath } : {}),
|
|
145
183
|
selection,
|
|
146
184
|
...(warningMessage ? { warningMessage } : {}),
|
|
147
185
|
};
|
|
148
186
|
}
|
|
149
|
-
function collectAgentOption(value, previous) {
|
|
150
|
-
return [...previous, value];
|
|
151
|
-
}
|
|
152
|
-
function collectExtraContextOption(value, previous) {
|
|
153
|
-
return [...previous, value];
|
|
154
|
-
}
|
|
155
|
-
function parseMaxParallelOption(value) {
|
|
156
|
-
return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
|
|
157
|
-
}
|
|
158
187
|
export function createVerifyCommand() {
|
|
159
188
|
return new Command("verify")
|
|
160
189
|
.description("Verify a recorded spec, run, reduction, or message session")
|
|
@@ -164,12 +193,12 @@ export function createVerifyCommand() {
|
|
|
164
193
|
.addOption(new Option("--message <message-id>", "Message session to verify"))
|
|
165
194
|
.addOption(new Option("--agent <agent-id>", "Set verifiers directly (repeatable; order preserved)")
|
|
166
195
|
.default([], "")
|
|
167
|
-
.argParser(
|
|
196
|
+
.argParser(collectRepeatedStringOption))
|
|
168
197
|
.option("--profile <name>", 'Orchestration profile (default: "default")')
|
|
169
198
|
.option("--max-parallel <count>", "Max concurrent verifiers (default: all)", parseMaxParallelOption)
|
|
170
199
|
.addOption(new Option("--extra-context <path>", "Stage an extra context file into each verifier workspace (repeatable)")
|
|
171
200
|
.default([], "")
|
|
172
|
-
.argParser(
|
|
201
|
+
.argParser(collectRepeatedStringOption))
|
|
173
202
|
.option("--json", "Emit a machine-readable result envelope")
|
|
174
203
|
.allowExcessArguments(false)
|
|
175
204
|
.action(async (options, command) => {
|