voratiq 0.1.0-beta.22 → 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.
Files changed (120) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/runtime/policy.js +2 -1
  3. package/dist/auth/providers/utils.js +1 -1
  4. package/dist/cli/auto.js +3 -16
  5. package/dist/cli/list.js +2 -1
  6. package/dist/cli/message.js +16 -11
  7. package/dist/cli/operator-envelope.d.ts +8 -1
  8. package/dist/cli/operator-envelope.js +34 -2
  9. package/dist/cli/option-parsers.d.ts +2 -0
  10. package/dist/cli/option-parsers.js +7 -0
  11. package/dist/cli/output.d.ts +1 -5
  12. package/dist/cli/reduce.js +5 -13
  13. package/dist/cli/run.js +3 -12
  14. package/dist/cli/spec.js +4 -10
  15. package/dist/cli/verify.js +8 -18
  16. package/dist/commands/auto/command.js +0 -3
  17. package/dist/commands/auto/validation.js +3 -1
  18. package/dist/commands/doctor/agents.js +3 -1
  19. package/dist/commands/doctor/command.js +2 -1
  20. package/dist/commands/doctor/environment.js +3 -1
  21. package/dist/commands/doctor/fix.js +3 -1
  22. package/dist/commands/doctor/reconcile.js +3 -1
  23. package/dist/commands/interactive/lifecycle.js +8 -0
  24. package/dist/commands/list/command.js +33 -12
  25. package/dist/commands/list/normalization.d.ts +2 -7
  26. package/dist/commands/list/normalization.js +8 -16
  27. package/dist/commands/list/records.d.ts +9 -0
  28. package/dist/commands/list/records.js +6 -0
  29. package/dist/commands/message/command.d.ts +0 -1
  30. package/dist/commands/message/command.js +10 -18
  31. package/dist/commands/prune/command.js +4 -1
  32. package/dist/commands/reduce/targets.js +1 -1
  33. package/dist/commands/run/record-init.js +6 -0
  34. package/dist/commands/shared/resolve-stage-competitors.js +2 -1
  35. package/dist/commands/spec/command.js +46 -133
  36. package/dist/commands/verify/command.js +8 -1
  37. package/dist/commands/verify/lifecycle.js +1 -1
  38. package/dist/commands/verify/targets.js +1 -1
  39. package/dist/competition/shared/teardown.d.ts +7 -0
  40. package/dist/competition/shared/teardown.js +6 -0
  41. package/dist/configs/agents/defaults.js +13 -44
  42. package/dist/configs/agents/loader.js +1 -1
  43. package/dist/configs/environment/loader.js +2 -1
  44. package/dist/configs/orchestration/loader.js +2 -1
  45. package/dist/configs/sandbox/loader.js +2 -1
  46. package/dist/configs/settings/loader.js +1 -1
  47. package/dist/configs/verification/loader.js +2 -1
  48. package/dist/domain/interactive/model/types.d.ts +2 -0
  49. package/dist/domain/interactive/model/types.js +16 -1
  50. package/dist/domain/interactive/persistence/adapter.js +25 -5
  51. package/dist/domain/interactive/prompt.d.ts +1 -1
  52. package/dist/domain/interactive/prompt.js +1 -1
  53. package/dist/domain/interactive/session-env.d.ts +10 -0
  54. package/dist/domain/interactive/session-env.js +25 -0
  55. package/dist/domain/message/competition/adapter.js +3 -9
  56. package/dist/domain/message/model/types.d.ts +0 -1
  57. package/dist/domain/message/model/types.js +0 -1
  58. package/dist/domain/reduce/competition/adapter.js +9 -9
  59. package/dist/domain/run/competition/agents/lifecycle.js +1 -1
  60. package/dist/domain/run/competition/agents/workspace.js +2 -1
  61. package/dist/domain/run/competition/reports.js +2 -1
  62. package/dist/domain/run/model/enhanced.d.ts +1 -1
  63. package/dist/domain/run/model/enhanced.js +2 -1
  64. package/dist/domain/spec/competition/adapter.js +3 -9
  65. package/dist/domain/spec/model/mutators.d.ts +20 -0
  66. package/dist/domain/spec/model/mutators.js +146 -0
  67. package/dist/domain/spec/persistence/adapter.d.ts +1 -0
  68. package/dist/domain/spec/persistence/adapter.js +7 -2
  69. package/dist/domain/verify/competition/adapter.d.ts +1 -1
  70. package/dist/domain/verify/competition/adapter.js +4 -9
  71. package/dist/domain/verify/competition/programmatic.js +2 -1
  72. package/dist/domain/verify/competition/prompt.js +1 -1
  73. package/dist/domain/verify/competition/shared-layout.js +1 -1
  74. package/dist/interactive/providers/launch.d.ts +2 -0
  75. package/dist/interactive/providers/launch.js +19 -2
  76. package/dist/interactive/substrate.js +12 -2
  77. package/dist/mcp/server.d.ts +1 -0
  78. package/dist/mcp/server.js +312 -36
  79. package/dist/policy/auto.d.ts +0 -1
  80. package/dist/policy/auto.js +3 -14
  81. package/dist/preflight/index.js +2 -1
  82. package/dist/render/transcripts/apply.js +2 -1
  83. package/dist/render/transcripts/message.d.ts +1 -4
  84. package/dist/render/transcripts/message.js +10 -54
  85. package/dist/render/transcripts/reduce.d.ts +1 -4
  86. package/dist/render/transcripts/reduce.js +10 -54
  87. package/dist/render/transcripts/run.d.ts +1 -4
  88. package/dist/render/transcripts/run.js +8 -45
  89. package/dist/render/transcripts/spec.d.ts +1 -4
  90. package/dist/render/transcripts/spec.js +10 -54
  91. package/dist/render/transcripts/verify.d.ts +1 -4
  92. package/dist/render/transcripts/verify.js +10 -54
  93. package/dist/render/utils/cli-writer.d.ts +4 -0
  94. package/dist/render/utils/cli-writer.js +1 -0
  95. package/dist/render/utils/progressive-render.d.ts +3 -0
  96. package/dist/render/utils/progressive-render.js +44 -0
  97. package/dist/utils/diff.d.ts +2 -0
  98. package/dist/utils/diff.js +1 -0
  99. package/dist/utils/swarm-session-ack.d.ts +9 -0
  100. package/dist/utils/swarm-session-ack.js +17 -0
  101. package/dist/workspace/artifact-paths.d.ts +55 -0
  102. package/dist/workspace/artifact-paths.js +106 -0
  103. package/dist/workspace/chat/artifacts.js +1 -1
  104. package/dist/workspace/chat/native-usage.js +1 -1
  105. package/dist/workspace/chat/sources.d.ts +2 -5
  106. package/dist/workspace/chat/sources.js +4 -4
  107. package/dist/workspace/constants.d.ts +47 -0
  108. package/dist/workspace/constants.js +47 -0
  109. package/dist/workspace/layout.js +3 -1
  110. package/dist/workspace/managed-state.js +2 -1
  111. package/dist/workspace/path-formatters.d.ts +9 -0
  112. package/dist/workspace/path-formatters.js +46 -0
  113. package/dist/workspace/path-resolvers.d.ts +1 -0
  114. package/dist/workspace/path-resolvers.js +5 -0
  115. package/dist/workspace/session-paths.d.ts +16 -0
  116. package/dist/workspace/session-paths.js +59 -0
  117. package/dist/workspace/setup.js +2 -1
  118. package/package.json +1 -1
  119. package/dist/workspace/structure.d.ts +0 -144
  120. package/dist/workspace/structure.js +0 -320
package/README.md CHANGED
@@ -15,7 +15,7 @@ npm install -g voratiq
15
15
 
16
16
  - Node 20+
17
17
  - git
18
- - 1+ AI coding agent (Claude [>=2.1.63](https://github.com/anthropics/claude-code?tab=readme-ov-file#get-started), Codex [>=0.107.0](https://github.com/openai/codex?tab=readme-ov-file#quickstart), or Gemini [>=0.31.0](https://github.com/google-gemini/gemini-cli?tab=readme-ov-file#quick-install))
18
+ - 1+ AI coding agent (Claude [>=2.1.111](https://github.com/anthropics/claude-code?tab=readme-ov-file#get-started), Codex [>=0.107.0](https://github.com/openai/codex?tab=readme-ov-file#quickstart), or Gemini [>=0.31.0](https://github.com/google-gemini/gemini-cli?tab=readme-ov-file#quick-install))
19
19
  - macOS: `ripgrep`
20
20
  - Linux (Debian/Ubuntu): `bubblewrap`, `socat`, `ripgrep`
21
21
 
@@ -1,5 +1,6 @@
1
1
  import { isAbsolute, relative, resolve as resolveAbsolute } from "node:path";
2
- import { resolveWorkspacePath, VORATIQ_AGENTS_FILE, VORATIQ_ENVIRONMENT_FILE, VORATIQ_HISTORY_LOCK_FILENAME, VORATIQ_ORCHESTRATION_FILE, VORATIQ_REDUCTION_DIR, VORATIQ_RUN_DIR, VORATIQ_RUN_FILE, VORATIQ_SANDBOX_FILE, VORATIQ_SPEC_DIR, VORATIQ_VERIFICATION_DIR, } from "../../workspace/structure.js";
2
+ import { VORATIQ_AGENTS_FILE, VORATIQ_ENVIRONMENT_FILE, VORATIQ_HISTORY_LOCK_FILENAME, VORATIQ_ORCHESTRATION_FILE, VORATIQ_REDUCTION_DIR, VORATIQ_RUN_DIR, VORATIQ_RUN_FILE, VORATIQ_SANDBOX_FILE, VORATIQ_SPEC_DIR, VORATIQ_VERIFICATION_DIR, } from "../../workspace/constants.js";
3
+ import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
3
4
  export function buildSandboxPolicy(input) {
4
5
  const { stageId, root, workspacePath, sandboxHomePath, sandboxSettingsPath, runtimePath, artifactsPath, repoRootPath, providerFilesystem, providerNetwork, policyOverrides, stageDenyWritePaths = [], stageDenyReadPaths = [], } = input;
5
6
  const baseline = buildBaselineFilesystemPolicy({
@@ -2,7 +2,7 @@ import { constants as fsConstants } from "node:fs";
2
2
  import { access, chmod, copyFile, mkdir, rm, stat, writeFile, } from "node:fs/promises";
3
3
  import { isAbsolute, resolve as resolveNative } from "node:path";
4
4
  import { isMissing } from "../../utils/fs.js";
5
- import { SANDBOX_DIRNAME } from "../../workspace/structure.js";
5
+ import { SANDBOX_DIRNAME } from "../../workspace/constants.js";
6
6
  const STAGED_FILE_MODE = 0o600;
7
7
  export function resolveProviderHome(runtime, envVar, defaultSubdir) {
8
8
  const configured = runtime.env[envVar]?.trim();
package/dist/cli/auto.js CHANGED
@@ -9,22 +9,13 @@ import { renderWorkspaceAutoInitializedNotice } from "../render/transcripts/shar
9
9
  import { renderCliError } from "../render/utils/errors.js";
10
10
  import { HintedError } from "../utils/errors.js";
11
11
  import { formatAlertMessage } from "../utils/output.js";
12
- import { parsePositiveInteger } from "../utils/validators.js";
13
12
  import { runApplyCommand } from "./apply.js";
14
13
  import { toCliError } from "./errors.js";
14
+ import { collectRepeatedStringOption, parseMaxParallelOption, } from "./option-parsers.js";
15
15
  import { beginChainedCommandOutput, writeCommandOutput } from "./output.js";
16
16
  import { runRunCommand } from "./run.js";
17
17
  import { runSpecCommand } from "./spec.js";
18
18
  import { runVerifyCommand } from "./verify.js";
19
- function parseMaxParallelOption(value) {
20
- return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
21
- }
22
- function collectRunAgentOption(value, previous) {
23
- return [...previous, value];
24
- }
25
- function collectVerifyAgentOption(value, previous) {
26
- return [...previous, value];
27
- }
28
19
  function replayAutoCommandEvent(event) {
29
20
  if (event.kind === "body") {
30
21
  writeCommandOutput({
@@ -45,10 +36,6 @@ function replayAutoCommandEvent(event) {
45
36
  writeCommandOutput({ body: renderCliError(toCliError(event.error)) });
46
37
  return;
47
38
  }
48
- const warningBody = formatAlertMessage("Action required", "yellow", event.detail);
49
- writeCommandOutput({
50
- body: event.separateWithDivider ? `---\n\n${warningBody}` : warningBody,
51
- });
52
39
  }
53
40
  async function persistAutoOutcome(options) {
54
41
  const { runId, outcome } = options;
@@ -207,10 +194,10 @@ export function createAutoCommand() {
207
194
  .option("--description <text>", "Generate a spec, then run and verify it")
208
195
  .addOption(new Option("--run-agent <agent-id>", "Set run-stage agents directly (repeatable; order preserved)")
209
196
  .default([], "")
210
- .argParser(collectRunAgentOption))
197
+ .argParser(collectRepeatedStringOption))
211
198
  .addOption(new Option("--verify-agent <agent-id>", "Set verify-stage agents directly (repeatable)")
212
199
  .default([], "")
213
- .argParser(collectVerifyAgentOption))
200
+ .argParser(collectRepeatedStringOption))
214
201
  .option("--profile <name>", 'Orchestration profile (default: "default")')
215
202
  .option("--max-parallel <count>", "Max concurrent agents/verifiers", parseMaxParallelOption)
216
203
  .option("--branch", "Create or checkout a branch named after the spec")
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 { resolveWorkspacePath, VORATIQ_INTERACTIVE_FILE, VORATIQ_MESSAGE_FILE, VORATIQ_REDUCTION_FILE, VORATIQ_VERIFICATION_FILE, } from "../workspace/structure.js";
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) {
@@ -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 { parsePositiveInteger } from "../utils/validators.js";
13
- import { resolveWorkspacePath, VORATIQ_MESSAGE_FILE, } from "../workspace/structure.js";
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
- sourceInteractiveSessionId: process.env.VORATIQ_INTERACTIVE_SESSION_ID?.trim() || undefined,
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(collectStringOption))
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(collectStringOption))
126
+ .argParser(collectRepeatedStringOption))
122
127
  .option("--json", "Emit a machine-readable result envelope")
123
128
  .allowExcessArguments(false)
124
129
  .action(async (options, command) => {
@@ -5,7 +5,7 @@ import type { SelectionDecision } from "../policy/index.js";
5
5
  import type { ReductionStatus, RunStatus, VerificationStatus } from "../status/index.js";
6
6
  import { externalExecutionOperators } from "./contract.js";
7
7
  export type EnvelopeOperator = (typeof externalExecutionOperators)[number];
8
- export type EnvelopeStatus = "succeeded" | "failed" | "unresolved";
8
+ export type EnvelopeStatus = "queued" | "running" | "succeeded" | "failed" | "unresolved";
9
9
  export interface EnvelopeArtifactRef {
10
10
  kind: string;
11
11
  path: string;
@@ -71,6 +71,8 @@ export declare const operatorResultEnvelopeSchema: z.ZodObject<{
71
71
  prune: "prune";
72
72
  }>;
73
73
  status: z.ZodEnum<{
74
+ queued: "queued";
75
+ running: "running";
74
76
  succeeded: "succeeded";
75
77
  failed: "failed";
76
78
  unresolved: "unresolved";
@@ -184,6 +186,11 @@ export declare function buildRunOperatorEnvelope(options: {
184
186
  export declare function buildVerifyOperatorEnvelope(options: VerifyEnvelopeInput): OperatorResultEnvelope;
185
187
  export declare function buildReduceOperatorEnvelope(options: ReduceEnvelopeInput): OperatorResultEnvelope;
186
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;
187
194
  export declare function buildApplyOperatorEnvelope(options: ApplyEnvelopeInput): OperatorResultEnvelope;
188
195
  export declare function buildPruneOperatorEnvelope(options: PruneEnvelopeInput): OperatorResultEnvelope;
189
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/structure.js";
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({
@@ -285,6 +285,38 @@ export function buildMessageOperatorEnvelope(options) {
285
285
  ],
286
286
  });
287
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
+ }
288
320
  export function buildApplyOperatorEnvelope(options) {
289
321
  return buildOperatorEnvelope({
290
322
  operator: "apply",
@@ -0,0 +1,2 @@
1
+ export declare function collectRepeatedStringOption(value: string, previous: string[]): string[];
2
+ export declare function parseMaxParallelOption(value: string): 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
+ }
@@ -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 {};
@@ -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 { parsePositiveInteger } from "../utils/validators.js";
14
- import { resolveWorkspacePath, VORATIQ_MESSAGE_FILE, VORATIQ_REDUCTION_FILE, VORATIQ_VERIFICATION_FILE, } from "../workspace/structure.js";
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(collectAgentOption))
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(collectExtraContextOption))
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;
@@ -91,28 +91,19 @@ export function deriveBranchNameFromSpecPath(specPath) {
91
91
  }
92
92
  return base.slice(0, lastDotIndex);
93
93
  }
94
- function collectAgentOption(value, previous) {
95
- return [...previous, value];
96
- }
97
- function collectExtraContextOption(value, previous) {
98
- return [...previous, value];
99
- }
100
- function parseMaxParallelOption(value) {
101
- return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
102
- }
103
94
  export function createRunCommand() {
104
95
  return new Command("run")
105
96
  .description("Execute agents against a spec")
106
97
  .requiredOption("--spec <path>", "Path to the spec file")
107
98
  .addOption(new Option("--agent <agent-id>", "Set agents directly (repeatable; order preserved)")
108
99
  .default([], "")
109
- .argParser(collectAgentOption))
100
+ .argParser(collectRepeatedStringOption))
110
101
  .option("--profile <name>", 'Orchestration profile (default: "default")')
111
102
  .option("--max-parallel <count>", "Max concurrent agents (default: all)", parseMaxParallelOption)
112
103
  .option("--branch", "Create or checkout a branch named after the spec")
113
104
  .addOption(new Option("--extra-context <path>", "Stage an extra context file into each agent workspace (repeatable)")
114
105
  .default([], "")
115
- .argParser(collectExtraContextOption))
106
+ .argParser(collectRepeatedStringOption))
116
107
  .option("--json", "Emit a machine-readable result envelope")
117
108
  .allowExcessArguments(false)
118
109
  .action(async (options, command) => {
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 { parsePositiveInteger } from "../utils/validators.js";
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(collectAgentOption))
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(collectExtraContextOption))
151
+ .argParser(collectRepeatedStringOption))
158
152
  .option("--json", "Emit a machine-readable result envelope")
159
153
  .allowExcessArguments(false)
160
154
  .action(async (options, command) => {
@@ -18,26 +18,25 @@ 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 { parsePositiveInteger } from "../utils/validators.js";
22
- import { resolveWorkspacePath, VORATIQ_MESSAGE_FILE, VORATIQ_REDUCTION_FILE, VORATIQ_VERIFICATION_FILE, VORATIQ_VERIFICATION_SESSIONS_DIR, } from "../workspace/structure.js";
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.";
26
28
  function resolveVerifyManualActionMessage(options) {
27
29
  const { targetKind, status, selection, selectedSpecPath } = options;
28
30
  if (status !== "succeeded") {
29
31
  return undefined;
30
32
  }
31
33
  if (targetKind === "spec" && !selectedSpecPath) {
32
- return "Verification did not select a spec path; manual review required.";
34
+ return UNRESOLVED_VERIFICATION_MESSAGE;
33
35
  }
34
36
  if (selection?.decision.state !== "unresolved") {
35
37
  return undefined;
36
38
  }
37
- if (targetKind === "run") {
38
- return "Verification did not produce a resolvable candidate; manual selection required.";
39
- }
40
- return "Verification did not produce a resolvable result; manual review required.";
39
+ return UNRESOLVED_VERIFICATION_MESSAGE;
41
40
  }
42
41
  export async function runVerifyCommand(options) {
43
42
  const { target, agentIds, agentOverrideFlag, profile, maxParallel, extraContext, json = false, suppressHint, stdout, stderr, writeOutput, } = options;
@@ -185,15 +184,6 @@ export async function runVerifyCommand(options) {
185
184
  ...(warningMessage ? { warningMessage } : {}),
186
185
  };
187
186
  }
188
- function collectAgentOption(value, previous) {
189
- return [...previous, value];
190
- }
191
- function collectExtraContextOption(value, previous) {
192
- return [...previous, value];
193
- }
194
- function parseMaxParallelOption(value) {
195
- return parsePositiveInteger(value, "Expected positive integer after --max-parallel", "--max-parallel must be greater than 0");
196
- }
197
187
  export function createVerifyCommand() {
198
188
  return new Command("verify")
199
189
  .description("Verify a recorded spec, run, reduction, or message session")
@@ -203,12 +193,12 @@ export function createVerifyCommand() {
203
193
  .addOption(new Option("--message <message-id>", "Message session to verify"))
204
194
  .addOption(new Option("--agent <agent-id>", "Set verifiers directly (repeatable; order preserved)")
205
195
  .default([], "")
206
- .argParser(collectAgentOption))
196
+ .argParser(collectRepeatedStringOption))
207
197
  .option("--profile <name>", 'Orchestration profile (default: "default")')
208
198
  .option("--max-parallel <count>", "Max concurrent verifiers (default: all)", parseMaxParallelOption)
209
199
  .addOption(new Option("--extra-context <path>", "Stage an extra context file into each verifier workspace (repeatable)")
210
200
  .default([], "")
211
- .argParser(collectExtraContextOption))
201
+ .argParser(collectRepeatedStringOption))
212
202
  .option("--json", "Emit a machine-readable result envelope")
213
203
  .allowExcessArguments(false)
214
204
  .action(async (options, command) => {
@@ -114,7 +114,6 @@ export async function executeAutoCommand(options, dependencies) {
114
114
  }
115
115
  else if (specVerifyResult.selection) {
116
116
  const specSelectionDisposition = classifyAutoVerificationSelection({
117
- targetKind: "spec",
118
117
  selection: specVerifyResult.selection,
119
118
  });
120
119
  if (specSelectionDisposition.kind !== "action_required") {
@@ -239,7 +238,6 @@ export async function executeAutoCommand(options, dependencies) {
239
238
  }
240
239
  if (verifySelection?.state === "unresolved") {
241
240
  const verifySelectionDisposition = classifyAutoVerificationSelection({
242
- targetKind: "run",
243
241
  selection: verifySelection,
244
242
  });
245
243
  applyAutoVerificationSelectionDisposition({
@@ -280,7 +278,6 @@ export async function executeAutoCommand(options, dependencies) {
280
278
  });
281
279
  }
282
280
  classifyAutoVerificationSelection({
283
- targetKind: "run",
284
281
  selection: verifySelection,
285
282
  });
286
283
  if (verifySelection.state !== "resolvable") {
@@ -1,7 +1,9 @@
1
1
  import { join } from "node:path";
2
2
  import { HintedError } from "../../utils/errors.js";
3
3
  import { isDirectory, isFile } from "../../utils/fs.js";
4
- import { formatWorkspacePath, resolveWorkspacePath, VORATIQ_VERIFICATION_TEMPLATES_DIR, } from "../../workspace/structure.js";
4
+ import { VORATIQ_VERIFICATION_TEMPLATES_DIR } from "../../workspace/constants.js";
5
+ import { formatWorkspacePath } from "../../workspace/path-formatters.js";
6
+ import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
5
7
  import { AutoPreflightError } from "./errors.js";
6
8
  export async function validateAutoVerificationConfig(options) {
7
9
  const requiredSelectors = resolveRequiredAutoSelectors(options.command);
@@ -2,8 +2,10 @@ import { getAgentDefaultId, getSupportedAgentDefaults, } from "../../configs/age
2
2
  import { readAgentsConfig } from "../../configs/agents/loader.js";
3
3
  import { detectBinary } from "../../utils/binaries.js";
4
4
  import { isDefaultYamlTemplate, loadYamlConfig, writeConfigIfChanged, } from "../../utils/yaml.js";
5
+ import { VORATIQ_AGENTS_FILE } from "../../workspace/constants.js";
5
6
  import { isManagedAgentsFingerprintMatch, readManagedState, } from "../../workspace/managed-state.js";
6
- import { formatWorkspacePath, resolveWorkspacePath, VORATIQ_AGENTS_FILE, } from "../../workspace/structure.js";
7
+ import { formatWorkspacePath } from "../../workspace/path-formatters.js";
8
+ import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
7
9
  import { buildDefaultAgentsTemplate, serializeAgentsConfigEntries, } from "../../workspace/templates.js";
8
10
  export const AGENTS_CONFIG_DISPLAY_PATH = formatWorkspacePath(VORATIQ_AGENTS_FILE);
9
11
  export async function bootstrapDoctorAgents(root, preset, options) {
@@ -5,8 +5,9 @@ import { prepareConfiguredOperatorReadiness } from "../../preflight/operator.js"
5
5
  import { toErrorMessage } from "../../utils/errors.js";
6
6
  import { pathExists } from "../../utils/fs.js";
7
7
  import { WorkspaceError, WorkspaceMissingEntryError, } from "../../workspace/errors.js";
8
+ import { formatWorkspacePath } from "../../workspace/path-formatters.js";
9
+ import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
8
10
  import { repairWorkspaceStructure, validateWorkspace, } from "../../workspace/setup.js";
9
- import { formatWorkspacePath, resolveWorkspacePath, } from "../../workspace/structure.js";
10
11
  import { executeDoctorBootstrap } from "./fix.js";
11
12
  import { executeDoctorReconcile } from "./reconcile.js";
12
13
  const DOCTOR_PREFLIGHT_UNLABELED_AGENT_IDS = ["settings"];
@@ -3,7 +3,9 @@ import { EnvironmentConfigParseError } from "../../configs/environment/errors.js
3
3
  import { readEnvironmentConfig, serializeEnvironmentConfig, } from "../../configs/environment/loader.js";
4
4
  import { getNodeDependencyRoots, getPythonEnvironmentPath, isNodeEnvironmentDisabled, isPythonEnvironmentDisabled, } from "../../configs/environment/types.js";
5
5
  import { persistYamlConfig, readConfigSnapshot } from "../../utils/yaml.js";
6
- import { formatWorkspacePath, resolveWorkspacePath, VORATIQ_ENVIRONMENT_FILE, } from "../../workspace/structure.js";
6
+ import { VORATIQ_ENVIRONMENT_FILE } from "../../workspace/constants.js";
7
+ import { formatWorkspacePath } from "../../workspace/path-formatters.js";
8
+ import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
7
9
  import { buildDefaultEnvironmentTemplate } from "../../workspace/templates.js";
8
10
  const ENVIRONMENT_CONFIG_DISPLAY_PATH = formatWorkspacePath(VORATIQ_ENVIRONMENT_FILE);
9
11
  export async function reconcileDoctorEnvironment(root, options) {
@@ -5,9 +5,11 @@ import { loadEnvironmentConfig } from "../../configs/environment/loader.js";
5
5
  import { buildDefaultOrchestrationTemplate } from "../../configs/orchestration/bootstrap.js";
6
6
  import { pathExists } from "../../utils/fs.js";
7
7
  import { normalizeConfigText, readConfigSnapshot, writeConfigIfChanged, } from "../../utils/yaml.js";
8
+ import { VORATIQ_AGENTS_FILE, VORATIQ_ORCHESTRATION_FILE, VORATIQ_SANDBOX_FILE, } from "../../workspace/constants.js";
8
9
  import { updateManagedState } from "../../workspace/managed-state.js";
10
+ import { formatWorkspacePath } from "../../workspace/path-formatters.js";
11
+ import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
9
12
  import { createWorkspace } from "../../workspace/setup.js";
10
- import { formatWorkspacePath, resolveWorkspacePath, VORATIQ_AGENTS_FILE, VORATIQ_ORCHESTRATION_FILE, VORATIQ_SANDBOX_FILE, } from "../../workspace/structure.js";
11
13
  import { listAgentPresetTemplates, serializeAgentsConfigEntries, } from "../../workspace/templates.js";
12
14
  import { bootstrapDoctorAgents } from "./agents.js";
13
15
  import { reconcileDoctorEnvironment } from "./environment.js";
@@ -3,9 +3,11 @@ import { readAgentsConfig } from "../../configs/agents/loader.js";
3
3
  import { buildDefaultOrchestrationTemplate } from "../../configs/orchestration/bootstrap.js";
4
4
  import { pathExists } from "../../utils/fs.js";
5
5
  import { readConfigSnapshot, writeConfigIfChanged } from "../../utils/yaml.js";
6
+ import { VORATIQ_ORCHESTRATION_FILE } from "../../workspace/constants.js";
6
7
  import { computeManagedFingerprint, isManagedFingerprintMatch, readManagedState, updateManagedState, } from "../../workspace/managed-state.js";
8
+ import { formatWorkspacePath } from "../../workspace/path-formatters.js";
9
+ import { resolveWorkspacePath } from "../../workspace/path-resolvers.js";
7
10
  import { createWorkspace } from "../../workspace/setup.js";
8
- import { formatWorkspacePath, resolveWorkspacePath, VORATIQ_ORCHESTRATION_FILE, } from "../../workspace/structure.js";
9
11
  import { reconcileManagedDoctorAgents } from "./agents.js";
10
12
  import { reconcileDoctorEnvironment } from "./environment.js";
11
13
  export async function executeDoctorReconcile(input) {
@@ -1,5 +1,6 @@
1
1
  import { runTeardown } from "../../competition/shared/teardown.js";
2
2
  import { disposeInteractiveSessionBuffer, getInteractiveSessionRecordSnapshot, rewriteInteractiveSessionRecord, } from "../../domain/interactive/persistence/adapter.js";
3
+ import { buildRecordLifecycleCompleteFields } from "../../domain/shared/lifecycle.js";
3
4
  import { toErrorMessage } from "../../utils/errors.js";
4
5
  const INTERACTIVE_TERMINATION_WAIT_MS = 1_000;
5
6
  let activeInteractive;
@@ -122,15 +123,22 @@ async function waitForInteractiveCompletion(completion) {
122
123
  ]);
123
124
  }
124
125
  function buildTerminatedRecord(record, status, reason) {
126
+ const lifecycle = buildRecordLifecycleCompleteFields({
127
+ existing: record,
128
+ startedAt: record.startedAt ?? record.createdAt,
129
+ completedAt: new Date().toISOString(),
130
+ });
125
131
  if (status === "aborted") {
126
132
  return {
127
133
  ...record,
128
134
  status: "succeeded",
135
+ ...lifecycle,
129
136
  };
130
137
  }
131
138
  return {
132
139
  ...record,
133
140
  status: "failed",
141
+ ...lifecycle,
134
142
  error: {
135
143
  code: "provider_launch_failed",
136
144
  message: buildTerminationMessage(status, reason),