voratiq 0.1.0-beta.20 → 0.1.0-beta.21

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 (85) hide show
  1. package/dist/agents/runtime/policy.d.ts +1 -1
  2. package/dist/bin.js +50 -19
  3. package/dist/cli/contract.d.ts +35 -5
  4. package/dist/cli/contract.js +42 -5
  5. package/dist/cli/list.js +4 -1
  6. package/dist/cli/message.d.ts +28 -0
  7. package/dist/cli/message.js +147 -0
  8. package/dist/cli/operator-envelope.d.ts +22 -1
  9. package/dist/cli/operator-envelope.js +48 -3
  10. package/dist/cli/reduce.js +5 -2
  11. package/dist/cli/verify.js +6 -2
  12. package/dist/commands/list/command.d.ts +1 -0
  13. package/dist/commands/list/command.js +117 -7
  14. package/dist/commands/message/command.d.ts +23 -0
  15. package/dist/commands/message/command.js +215 -0
  16. package/dist/commands/message/errors.d.ts +9 -0
  17. package/dist/commands/message/errors.js +20 -0
  18. package/dist/commands/message/lifecycle.d.ts +14 -0
  19. package/dist/commands/message/lifecycle.js +128 -0
  20. package/dist/commands/reduce/command.d.ts +1 -0
  21. package/dist/commands/reduce/command.js +3 -1
  22. package/dist/commands/reduce/targets.d.ts +1 -0
  23. package/dist/commands/reduce/targets.js +48 -2
  24. package/dist/commands/shared/resolve-stage-competitors.js +4 -1
  25. package/dist/commands/verify/command.d.ts +1 -0
  26. package/dist/commands/verify/command.js +2 -1
  27. package/dist/commands/verify/max-parallel.d.ts +1 -1
  28. package/dist/commands/verify/max-parallel.js +3 -1
  29. package/dist/commands/verify/targets.d.ts +2 -1
  30. package/dist/commands/verify/targets.js +154 -22
  31. package/dist/configs/agents/defaults.js +25 -25
  32. package/dist/configs/orchestration/bootstrap.d.ts +6 -1
  33. package/dist/configs/orchestration/bootstrap.js +27 -6
  34. package/dist/configs/orchestration/types.d.ts +25 -10
  35. package/dist/configs/orchestration/types.js +10 -6
  36. package/dist/configs/verification/types.d.ts +5 -0
  37. package/dist/configs/verification/types.js +3 -0
  38. package/dist/contracts/list.d.ts +38 -4
  39. package/dist/contracts/list.js +30 -1
  40. package/dist/domain/message/competition/adapter.d.ts +36 -0
  41. package/dist/domain/message/competition/adapter.js +197 -0
  42. package/dist/domain/message/competition/prompt.d.ts +8 -0
  43. package/dist/domain/message/competition/prompt.js +29 -0
  44. package/dist/domain/message/model/mutators.d.ts +17 -0
  45. package/dist/domain/message/model/mutators.js +107 -0
  46. package/dist/domain/message/model/types.d.ts +100 -0
  47. package/dist/domain/message/model/types.js +87 -0
  48. package/dist/domain/message/persistence/adapter.d.ts +43 -0
  49. package/dist/domain/message/persistence/adapter.js +124 -0
  50. package/dist/domain/reduce/competition/adapter.d.ts +1 -0
  51. package/dist/domain/reduce/competition/adapter.js +57 -4
  52. package/dist/domain/reduce/competition/prompt.d.ts +1 -1
  53. package/dist/domain/reduce/model/types.d.ts +3 -0
  54. package/dist/domain/reduce/model/types.js +2 -1
  55. package/dist/domain/verify/competition/adapter.js +8 -5
  56. package/dist/domain/verify/competition/programmatic.js +3 -0
  57. package/dist/domain/verify/competition/prompt.js +6 -0
  58. package/dist/domain/verify/competition/rubric.js +7 -1
  59. package/dist/domain/verify/competition/shared-layout.d.ts +42 -2
  60. package/dist/domain/verify/competition/shared-layout.js +92 -21
  61. package/dist/domain/verify/competition/target.d.ts +17 -0
  62. package/dist/domain/verify/model/types.d.ts +20 -2
  63. package/dist/domain/verify/model/types.js +15 -2
  64. package/dist/mcp/server.d.ts +2 -2
  65. package/dist/mcp/server.js +30 -13
  66. package/dist/policy/verification.js +2 -0
  67. package/dist/preflight/index.d.ts +2 -0
  68. package/dist/preflight/index.js +3 -1
  69. package/dist/render/transcripts/list.d.ts +2 -0
  70. package/dist/render/transcripts/list.js +24 -0
  71. package/dist/render/transcripts/message.d.ts +72 -0
  72. package/dist/render/transcripts/message.js +362 -0
  73. package/dist/render/transcripts/stage-progress.d.ts +1 -1
  74. package/dist/render/transcripts/verify.d.ts +4 -0
  75. package/dist/render/transcripts/verify.js +7 -1
  76. package/dist/render/utils/transcript-shell.d.ts +1 -1
  77. package/dist/render/utils/transcript-shell.js +6 -0
  78. package/dist/status/index.d.ts +21 -0
  79. package/dist/status/index.js +30 -0
  80. package/dist/workspace/setup.js +13 -7
  81. package/dist/workspace/structure.d.ts +14 -6
  82. package/dist/workspace/structure.js +25 -9
  83. package/dist/workspace/verification-defaults.d.ts +1 -1
  84. package/dist/workspace/verification-defaults.js +255 -0
  85. package/package.json +15 -16
@@ -1,10 +1,10 @@
1
1
  import { copyFile, mkdir, rm, symlink, writeFile } from "node:fs/promises";
2
- import { dirname, join, relative as relativePath, resolve, sep, } from "node:path";
2
+ import { basename, dirname, join, relative as relativePath, resolve, sep, } from "node:path";
3
3
  import { pathExists } from "../../../utils/fs.js";
4
4
  import { createDetachedWorktree, removeWorktree } from "../../../utils/git.js";
5
5
  import { ensureWorkspaceDependencies } from "../../../workspace/dependencies.js";
6
6
  import { buildAgentWorkspacePaths, } from "../../../workspace/layout.js";
7
- import { VORATIQ_VERIFICATION_SESSIONS_DIR } from "../../../workspace/structure.js";
7
+ import { MESSAGE_RESPONSE_FILENAME, VORATIQ_VERIFICATION_SESSIONS_DIR, } from "../../../workspace/structure.js";
8
8
  import { aliasForCandidate } from "./blinding.js";
9
9
  const BLINDED_VERIFY_SPEC_ARTIFACT_ALLOWLIST = [
10
10
  {
@@ -36,20 +36,22 @@ export async function prepareSharedVerificationInputs(options) {
36
36
  const sharedInputsAbsolute = resolve(sharedRootAbsolute, "inputs");
37
37
  const referenceRepoAbsolute = resolve(sharedRootAbsolute, "reference", "repo");
38
38
  await mkdir(sharedInputsAbsolute, { recursive: true });
39
- await mkdir(dirname(referenceRepoAbsolute), { recursive: true });
40
39
  let detachedWorktreeCreated = false;
41
40
  try {
42
- await createDetachedWorktree({
43
- root,
44
- worktreePath: referenceRepoAbsolute,
45
- baseRevision: resolvedTarget.baseRevisionSha,
46
- });
47
- detachedWorktreeCreated = true;
48
- await ensureWorkspaceDependencies({
49
- root,
50
- workspacePath: referenceRepoAbsolute,
51
- environment,
52
- });
41
+ if ("baseRevisionSha" in resolvedTarget) {
42
+ await mkdir(dirname(referenceRepoAbsolute), { recursive: true });
43
+ await createDetachedWorktree({
44
+ root,
45
+ worktreePath: referenceRepoAbsolute,
46
+ baseRevision: resolvedTarget.baseRevisionSha,
47
+ });
48
+ detachedWorktreeCreated = true;
49
+ await ensureWorkspaceDependencies({
50
+ root,
51
+ workspacePath: referenceRepoAbsolute,
52
+ environment,
53
+ });
54
+ }
53
55
  if ("specRecord" in resolvedTarget) {
54
56
  const descriptionAbsolute = resolve(sharedInputsAbsolute, "description.md");
55
57
  await writeFile(descriptionAbsolute, `${resolvedTarget.specRecord.description.trimEnd()}\n`, "utf8");
@@ -126,6 +128,38 @@ export async function prepareSharedVerificationInputs(options) {
126
128
  candidates,
127
129
  };
128
130
  }
131
+ if ("messageRecord" in resolvedTarget) {
132
+ const promptAbsolute = resolve(sharedInputsAbsolute, "prompt.md");
133
+ await writeFile(promptAbsolute, `${resolvedTarget.messageRecord.prompt.trimEnd()}\n`, "utf8");
134
+ const candidatesDir = resolve(sharedInputsAbsolute, "candidates");
135
+ await mkdir(candidatesDir, { recursive: true });
136
+ const candidates = await Promise.all(resolvedTarget.messageRecord.recipients
137
+ .filter((recipient) => recipient.status === "succeeded" &&
138
+ typeof recipient.outputPath === "string" &&
139
+ basename(recipient.outputPath) === MESSAGE_RESPONSE_FILENAME)
140
+ .map(async (recipient) => {
141
+ const alias = aliasForCandidate(recipient.agentId, aliasMap);
142
+ const dir = resolve(candidatesDir, alias);
143
+ await mkdir(dir, { recursive: true });
144
+ await copyRetainedVerificationArtifact({
145
+ root,
146
+ sourceRelativePath: recipient.outputPath,
147
+ destinationAbsolute: resolve(dir, "response.md"),
148
+ ownerLabel: `Message \`${resolvedTarget.target.sessionId}\` recipient \`${recipient.agentId}\``,
149
+ artifactLabel: "response.md",
150
+ required: true,
151
+ });
152
+ return { alias };
153
+ }));
154
+ return {
155
+ kind: "message",
156
+ sharedRootAbsolute,
157
+ sharedInputsAbsolute,
158
+ worktreesToRemove: [],
159
+ promptAbsolute,
160
+ candidates,
161
+ };
162
+ }
129
163
  const candidatesDir = resolve(sharedInputsAbsolute, "candidates");
130
164
  await mkdir(candidatesDir, { recursive: true });
131
165
  const candidates = await Promise.all(resolvedTarget.reductionRecord.reducers
@@ -144,6 +178,16 @@ export async function prepareSharedVerificationInputs(options) {
144
178
  });
145
179
  return { alias };
146
180
  }));
181
+ if ("referenceRepoUnavailable" in resolvedTarget) {
182
+ return {
183
+ kind: "reduce-no-reference",
184
+ sharedRootAbsolute,
185
+ sharedInputsAbsolute,
186
+ worktreesToRemove: [],
187
+ referenceRepoUnavailable: resolvedTarget.referenceRepoUnavailable,
188
+ candidates,
189
+ };
190
+ }
147
191
  return {
148
192
  kind: "reduce",
149
193
  sharedRootAbsolute,
@@ -216,6 +260,26 @@ export function buildStagedVerificationInputs(options) {
216
260
  })),
217
261
  };
218
262
  }
263
+ if (sharedInputs.kind === "message") {
264
+ return {
265
+ kind: "message",
266
+ promptPath: toWorkspaceRelative(workspacePaths.workspacePath, resolve(inputsRoot, "prompt.md")),
267
+ candidates: sharedInputs.candidates.map((candidate) => ({
268
+ alias: candidate.alias,
269
+ responsePath: toWorkspaceRelative(workspacePaths.workspacePath, resolve(inputsRoot, "candidates", candidate.alias, "response.md")),
270
+ })),
271
+ };
272
+ }
273
+ if (sharedInputs.kind === "reduce-no-reference") {
274
+ return {
275
+ kind: "reduce-no-reference",
276
+ referenceRepoUnavailable: sharedInputs.referenceRepoUnavailable,
277
+ candidates: sharedInputs.candidates.map((candidate) => ({
278
+ alias: candidate.alias,
279
+ reductionPath: toWorkspaceRelative(workspacePaths.workspacePath, resolve(inputsRoot, "candidates", candidate.alias, "reduction.md")),
280
+ })),
281
+ };
282
+ }
219
283
  return {
220
284
  kind: "reduce",
221
285
  referenceRepoPath: "reference_repo",
@@ -225,17 +289,24 @@ export function buildStagedVerificationInputs(options) {
225
289
  })),
226
290
  };
227
291
  }
292
+ export function sharedInputsUseReferenceRepo(sharedInputs) {
293
+ return (sharedInputs.kind === "spec" ||
294
+ sharedInputs.kind === "run" ||
295
+ sharedInputs.kind === "reduce");
296
+ }
228
297
  export async function attachVerifierWorkspaceMounts(options) {
229
- const { workspacePath, contextPath, sharedInputsAbsolute, referenceRepoAbsolute, } = options;
298
+ const { workspacePath, contextPath, sharedInputs } = options;
230
299
  await attachSharedInputsToVerifierWorkspace({
231
300
  workspacePath,
232
- sharedInputsAbsolute,
233
- });
234
- await attachWorkspaceDirectorySymlink({
235
- workspacePath,
236
- mountName: "reference_repo",
237
- targetAbsolutePath: referenceRepoAbsolute,
301
+ sharedInputsAbsolute: sharedInputs.sharedInputsAbsolute,
238
302
  });
303
+ if (sharedInputsUseReferenceRepo(sharedInputs)) {
304
+ await attachWorkspaceDirectorySymlink({
305
+ workspacePath,
306
+ mountName: "reference_repo",
307
+ targetAbsolutePath: sharedInputs.referenceRepoAbsolute,
308
+ });
309
+ }
239
310
  await attachWorkspaceDirectorySymlink({
240
311
  workspacePath,
241
312
  mountName: "context",
@@ -1,3 +1,4 @@
1
+ import type { MessageRecord } from "../../message/model/types.js";
1
2
  import type { ReductionRecord } from "../../reduce/model/types.js";
2
3
  import type { RunRecord } from "../../run/model/types.js";
3
4
  import type { SpecRecord } from "../../spec/model/types.js";
@@ -27,4 +28,20 @@ export type ResolvedVerificationTarget = {
27
28
  kind: "reduce";
28
29
  }>;
29
30
  reductionRecord: ReductionRecord;
31
+ } | {
32
+ competitiveCandidates: readonly VerificationCompetitiveCandidate[];
33
+ target: Extract<VerificationTarget, {
34
+ kind: "reduce";
35
+ }>;
36
+ reductionRecord: ReductionRecord;
37
+ referenceRepoUnavailable: {
38
+ reason: "message-lineage";
39
+ messageSessionId: string;
40
+ };
41
+ } | {
42
+ competitiveCandidates: readonly VerificationCompetitiveCandidate[];
43
+ target: Extract<VerificationTarget, {
44
+ kind: "message";
45
+ }>;
46
+ messageRecord: MessageRecord;
30
47
  };
@@ -3,13 +3,14 @@ import { type VerificationStatus } from "../../../status/index.js";
3
3
  export { TERMINAL_VERIFICATION_STATUSES, verificationStatusSchema, } from "../../../status/index.js";
4
4
  export type { RubricRecommendation, RubricResultPayload, } from "../rubric-result.js";
5
5
  export type { VerificationStatus };
6
- declare const VERIFICATION_TARGET_KIND_VALUES: readonly ["spec", "run", "reduce"];
6
+ declare const VERIFICATION_TARGET_KIND_VALUES: readonly ["spec", "run", "reduce", "message"];
7
7
  declare const VERIFICATION_METHOD_KIND_VALUES: readonly ["programmatic", "rubric"];
8
8
  declare const VERIFICATION_SCOPE_KIND_VALUES: readonly ["target", "run", "candidate"];
9
9
  export type VerificationTargetKind = (typeof VERIFICATION_TARGET_KIND_VALUES)[number];
10
10
  export type VerificationMethodKind = (typeof VERIFICATION_METHOD_KIND_VALUES)[number];
11
11
  export type VerificationScopeKind = (typeof VERIFICATION_SCOPE_KIND_VALUES)[number];
12
12
  export declare const verificationTargetKindSchema: z.ZodEnum<{
13
+ message: "message";
13
14
  reduce: "reduce";
14
15
  spec: "spec";
15
16
  run: "run";
@@ -19,8 +20,8 @@ export declare const verificationMethodKindSchema: z.ZodEnum<{
19
20
  rubric: "rubric";
20
21
  }>;
21
22
  export declare const verificationScopeKindSchema: z.ZodEnum<{
22
- run: "run";
23
23
  target: "target";
24
+ run: "run";
24
25
  candidate: "candidate";
25
26
  }>;
26
27
  export declare const specVerificationTargetSchema: z.ZodObject<{
@@ -37,6 +38,10 @@ export declare const reduceVerificationTargetSchema: z.ZodObject<{
37
38
  kind: z.ZodLiteral<"reduce">;
38
39
  sessionId: z.ZodString;
39
40
  }, z.core.$strict>;
41
+ export declare const messageVerificationTargetSchema: z.ZodObject<{
42
+ kind: z.ZodLiteral<"message">;
43
+ sessionId: z.ZodString;
44
+ }, z.core.$strict>;
40
45
  export declare const verificationTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
41
46
  kind: z.ZodLiteral<"spec">;
42
47
  sessionId: z.ZodString;
@@ -48,6 +53,9 @@ export declare const verificationTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObj
48
53
  }, z.core.$strict>, z.ZodObject<{
49
54
  kind: z.ZodLiteral<"reduce">;
50
55
  sessionId: z.ZodString;
56
+ }, z.core.$strict>, z.ZodObject<{
57
+ kind: z.ZodLiteral<"message">;
58
+ sessionId: z.ZodString;
51
59
  }, z.core.$strict>], "kind">;
52
60
  export type VerificationTarget = z.infer<typeof verificationTargetSchema>;
53
61
  export declare const verificationScopeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -139,6 +147,9 @@ export declare const programmaticResultArtifactSchema: z.ZodDiscriminatedUnion<[
139
147
  }, z.core.$strict>, z.ZodObject<{
140
148
  kind: z.ZodLiteral<"reduce">;
141
149
  sessionId: z.ZodString;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ kind: z.ZodLiteral<"message">;
152
+ sessionId: z.ZodString;
142
153
  }, z.core.$strict>]>;
143
154
  scope: z.ZodLiteral<"target">;
144
155
  results: z.ZodArray<z.ZodObject<{
@@ -223,6 +234,9 @@ export declare const verificationResultArtifactSchema: z.ZodUnion<readonly [z.Zo
223
234
  }, z.core.$strict>, z.ZodObject<{
224
235
  kind: z.ZodLiteral<"reduce">;
225
236
  sessionId: z.ZodString;
237
+ }, z.core.$strict>, z.ZodObject<{
238
+ kind: z.ZodLiteral<"message">;
239
+ sessionId: z.ZodString;
226
240
  }, z.core.$strict>]>;
227
241
  scope: z.ZodLiteral<"target">;
228
242
  results: z.ZodArray<z.ZodObject<{
@@ -310,6 +324,9 @@ export declare const verificationRecordSchema: z.ZodObject<{
310
324
  }, z.core.$strict>, z.ZodObject<{
311
325
  kind: z.ZodLiteral<"reduce">;
312
326
  sessionId: z.ZodString;
327
+ }, z.core.$strict>, z.ZodObject<{
328
+ kind: z.ZodLiteral<"message">;
329
+ sessionId: z.ZodString;
313
330
  }, z.core.$strict>], "kind">;
314
331
  extraContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
315
332
  extraContextMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -381,6 +398,7 @@ export declare const verificationIndexEntrySchema: z.ZodObject<{
381
398
  aborted: "aborted";
382
399
  }>;
383
400
  targetKind: z.ZodEnum<{
401
+ message: "message";
384
402
  reduce: "reduce";
385
403
  spec: "spec";
386
404
  run: "run";
@@ -9,7 +9,12 @@ import { validateRecordLifecycleTimestamps } from "../../shared/lifecycle.js";
9
9
  import { BLINDED_ALIAS_PATTERN } from "../blinding/aliases.js";
10
10
  import { rubricResultPayloadSchema, safeParseRubricRecommendationFromResult, } from "../rubric-result.js";
11
11
  export { TERMINAL_VERIFICATION_STATUSES, verificationStatusSchema, } from "../../../status/index.js";
12
- const VERIFICATION_TARGET_KIND_VALUES = ["spec", "run", "reduce"];
12
+ const VERIFICATION_TARGET_KIND_VALUES = [
13
+ "spec",
14
+ "run",
15
+ "reduce",
16
+ "message",
17
+ ];
13
18
  const VERIFICATION_METHOD_KIND_VALUES = ["programmatic", "rubric"];
14
19
  const VERIFICATION_SCOPE_KIND_VALUES = ["target", "run", "candidate"];
15
20
  const RUBRIC_FINDING_SEVERITY_VALUES = ["info", "warning", "error"];
@@ -39,10 +44,17 @@ export const reduceVerificationTargetSchema = z
39
44
  sessionId: z.string().min(1),
40
45
  })
41
46
  .strict();
47
+ export const messageVerificationTargetSchema = z
48
+ .object({
49
+ kind: z.literal("message"),
50
+ sessionId: z.string().min(1),
51
+ })
52
+ .strict();
42
53
  export const verificationTargetSchema = z.discriminatedUnion("kind", [
43
54
  specVerificationTargetSchema,
44
55
  runVerificationTargetSchema,
45
56
  reduceVerificationTargetSchema,
57
+ messageVerificationTargetSchema,
46
58
  ]);
47
59
  export const verificationScopeSchema = z.discriminatedUnion("kind", [
48
60
  z.object({ kind: z.literal("target") }).strict(),
@@ -151,6 +163,7 @@ export const programmaticResultArtifactSchema = z.discriminatedUnion("scope", [
151
163
  target: z.union([
152
164
  specVerificationTargetSchema,
153
165
  reduceVerificationTargetSchema,
166
+ messageVerificationTargetSchema,
154
167
  ]),
155
168
  scope: z.literal("target"),
156
169
  results: z.array(programmaticCheckResultSchema),
@@ -260,7 +273,7 @@ export const verificationRecordSchema = z
260
273
  ctx.addIssue({
261
274
  code: z.ZodIssueCode.custom,
262
275
  path: ["methods"],
263
- message: "spec and reduce verification refs must use `target` scope only",
276
+ message: "spec, reduce, and message verification refs must use `target` scope only",
264
277
  });
265
278
  }
266
279
  }
@@ -1,9 +1,9 @@
1
1
  import { createEntrypointVoratiqCliTarget as createEntrypointCliTarget, resolveVoratiqCliTarget, type VoratiqCliTarget } from "../utils/voratiq-cli-target.js";
2
2
  export declare const VORATIQ_MCP_PROTOCOL_VERSION: "2025-11-25";
3
3
  export declare const VORATIQ_SUPPORTED_MCP_PROTOCOL_VERSIONS: readonly ["2025-11-25", "2025-06-18", "2024-11-05"];
4
- export type VoratiqMcpExecutionToolName = "voratiq_spec" | "voratiq_run" | "voratiq_reduce" | "voratiq_verify" | "voratiq_apply" | "voratiq_prune";
4
+ export type VoratiqMcpExecutionToolName = "voratiq_spec" | "voratiq_run" | "voratiq_reduce" | "voratiq_verify" | "voratiq_message" | "voratiq_apply" | "voratiq_prune";
5
5
  export type VoratiqMcpToolName = VoratiqMcpExecutionToolName | "voratiq_list";
6
- export type VoratiqMcpOperator = "spec" | "run" | "reduce" | "verify" | "apply" | "prune" | "list";
6
+ export type VoratiqMcpOperator = "spec" | "run" | "reduce" | "verify" | "message" | "apply" | "list" | "prune";
7
7
  export type TransportFailureKind = "invalid_input" | "spawn_failed" | "malformed_json" | "contract_mismatch";
8
8
  export interface TransportFailureResult {
9
9
  failureKind: TransportFailureKind;
@@ -1,7 +1,7 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import process from "node:process";
3
3
  import { z } from "zod";
4
- import { externalApplyExecutionInputSchema, externalListInspectionInputSchema, externalPruneExecutionInputSchema, externalReduceExecutionInputSchema, externalRunExecutionInputSchema, externalSpecExecutionInputSchema, externalVerifyExecutionInputSchema, } from "../cli/contract.js";
4
+ import { externalApplyExecutionInputSchema, externalListInspectionInputSchema, externalMessageExecutionInputSchema, externalPruneExecutionInputSchema, externalReduceExecutionInputSchema, externalRunExecutionInputSchema, externalSpecExecutionInputSchema, externalVerifyExecutionInputSchema, } from "../cli/contract.js";
5
5
  import { operatorResultEnvelopeSchema, } from "../cli/operator-envelope.js";
6
6
  import { listJsonOutputSchema, } from "../contracts/list.js";
7
7
  import { getVoratiqVersion } from "../utils/version.js";
@@ -62,11 +62,19 @@ const toolSpecs = [
62
62
  {
63
63
  name: "voratiq_verify",
64
64
  operator: "verify",
65
- description: "Verify a Voratiq spec, run, or reduction session and record the evaluation result.",
65
+ description: "Verify a Voratiq spec, run, reduction, or message session and record the evaluation result.",
66
66
  inputSchemaSource: externalVerifyExecutionInputSchema,
67
67
  buildArgs: (input) => buildVerifyExecutionArgs(input),
68
68
  outputContract: "execution",
69
69
  },
70
+ {
71
+ name: "voratiq_message",
72
+ operator: "message",
73
+ description: "Send an isolated prompt to one or more Voratiq agents and persist their independent replies as a durable message session.",
74
+ inputSchemaSource: externalMessageExecutionInputSchema,
75
+ buildArgs: (input) => buildMessageExecutionArgs(input),
76
+ outputContract: "execution",
77
+ },
70
78
  {
71
79
  name: "voratiq_apply",
72
80
  operator: "apply",
@@ -75,6 +83,15 @@ const toolSpecs = [
75
83
  buildArgs: (input) => buildApplyExecutionArgs(input),
76
84
  outputContract: "execution",
77
85
  },
86
+ {
87
+ name: "voratiq_list",
88
+ operator: "list",
89
+ description: "List recorded Voratiq sessions for one operator (`spec`, `run`, `reduce`, `verify`, or `message`) in table or detail mode.",
90
+ inputSchemaSource: externalListInspectionInputSchema,
91
+ mcpInputSchema: createListMcpInputSchema(),
92
+ buildArgs: (input) => buildListInspectionArgs(input),
93
+ outputContract: "list",
94
+ },
78
95
  {
79
96
  name: "voratiq_prune",
80
97
  operator: "prune",
@@ -84,22 +101,13 @@ const toolSpecs = [
84
101
  buildArgs: (input) => buildPruneExecutionArgs(input),
85
102
  outputContract: "execution",
86
103
  },
87
- {
88
- name: "voratiq_list",
89
- operator: "list",
90
- description: "List recorded Voratiq sessions for one operator (`spec`, `run`, `reduce`, or `verify`) in table or detail mode.",
91
- inputSchemaSource: externalListInspectionInputSchema,
92
- mcpInputSchema: createListMcpInputSchema(),
93
- buildArgs: (input) => buildListInspectionArgs(input),
94
- outputContract: "list",
95
- },
96
104
  ];
97
105
  const toolDefinitions = toolSpecs.map((tool) => ({
98
106
  name: tool.name,
99
107
  description: tool.description,
100
108
  inputSchema: tool.mcpInputSchema ?? toToolInputJsonSchema(tool.inputSchemaSource),
101
109
  }));
102
- const VORATIQ_MCP_SERVER_INSTRUCTIONS = "Voratiq tools operate on Voratiq workflow state in the current repository. Use voratiq_list for questions about recent or specific spec, run, reduce, or verify sessions. Use voratiq_spec, voratiq_run, voratiq_verify, voratiq_apply, and voratiq_prune for the normal Voratiq workflow. Prefer these tools over shell inspection when the task is about Voratiq workflow history or state.";
110
+ const VORATIQ_MCP_SERVER_INSTRUCTIONS = "Voratiq tools operate on Voratiq workflow state in the current repository. Use voratiq_list for questions about recent or specific spec, run, reduce, verify, or message sessions. Use voratiq_spec, voratiq_run, voratiq_reduce, voratiq_verify, voratiq_message, voratiq_apply, and voratiq_prune for the normal Voratiq workflow. Prefer these tools over shell inspection when the task is about Voratiq workflow history or state.";
103
111
  const toolSpecsByName = new Map(toolSpecs.map((tool) => [tool.name, tool]));
104
112
  export function getVoratiqMcpToolDefinitions() {
105
113
  return toolDefinitions;
@@ -416,6 +424,15 @@ function buildRunExecutionArgs(input) {
416
424
  args.push("--json");
417
425
  return args;
418
426
  }
427
+ function buildMessageExecutionArgs(input) {
428
+ const args = ["message", "--prompt", input.prompt];
429
+ appendRepeatedStringFlag(args, "--agent", input.agentIds);
430
+ appendOptionalStringFlag(args, "--profile", input.profile);
431
+ appendOptionalNumberFlag(args, "--max-parallel", input.maxParallel);
432
+ appendRepeatedStringFlag(args, "--extra-context", input.extraContext);
433
+ args.push("--json");
434
+ return args;
435
+ }
419
436
  function buildReduceExecutionArgs(input) {
420
437
  const args = ["reduce", `--${input.target.type}`, input.target.id];
421
438
  appendRepeatedStringFlag(args, "--agent", input.agentIds);
@@ -556,7 +573,7 @@ function createPruneMcpInputSchema() {
556
573
  function createListMcpInputSchema() {
557
574
  return toToolInputJsonSchema(z
558
575
  .object({
559
- operator: z.enum(["spec", "run", "reduce", "verify"]),
576
+ operator: z.enum(["spec", "run", "reduce", "verify", "message"]),
560
577
  mode: z
561
578
  .enum(["table", "detail"])
562
579
  .describe("Use `detail` only when inspecting a specific session."),
@@ -253,6 +253,8 @@ function resolveStageVerificationTemplateForTarget(target) {
253
253
  return "run-verification";
254
254
  case "reduce":
255
255
  return "reduce-verification";
256
+ case "message":
257
+ return "message-verification";
256
258
  }
257
259
  }
258
260
  function resolveCanonicalCandidateIds(options) {
@@ -9,6 +9,8 @@ export interface WorkspacePaths {
9
9
  runsFile: string;
10
10
  reductionsDir?: string;
11
11
  reductionsFile?: string;
12
+ messagesDir?: string;
13
+ messagesFile?: string;
12
14
  specsDir: string;
13
15
  specsFile: string;
14
16
  verificationsDir?: string;
@@ -5,7 +5,7 @@ import { assertGitRepository, runGitCommand, } from "../utils/git.js";
5
5
  import { relativeToRoot } from "../utils/path.js";
6
6
  import { collectMissingSandboxDependencies, formatSandboxDependencyList, } from "../workspace/sandbox-requirements.js";
7
7
  import { repairWorkspaceStructure, validateWorkspace, } from "../workspace/setup.js";
8
- import { resolveWorkspacePath, VORATIQ_REDUCTION_DIR, VORATIQ_REDUCTION_FILE, VORATIQ_RUN_DIR, VORATIQ_RUN_FILE, VORATIQ_SPEC_DIR, VORATIQ_SPEC_FILE, VORATIQ_VERIFICATION_DIR, VORATIQ_VERIFICATION_FILE, } from "../workspace/structure.js";
8
+ import { resolveWorkspacePath, VORATIQ_MESSAGE_DIR, VORATIQ_MESSAGE_FILE, VORATIQ_REDUCTION_DIR, VORATIQ_REDUCTION_FILE, VORATIQ_RUN_DIR, VORATIQ_RUN_FILE, VORATIQ_SPEC_DIR, VORATIQ_SPEC_FILE, VORATIQ_VERIFICATION_DIR, VORATIQ_VERIFICATION_FILE, } from "../workspace/structure.js";
9
9
  import { DirtyWorkingTreeError, SandboxDependenciesError, SpecNotFoundError, } from "./errors.js";
10
10
  export async function resolveCliContext(options = {}) {
11
11
  const { requireWorkspace = true, workspaceAutoInitMode = "never", restoreShippedVerificationTemplates = true, } = options;
@@ -43,6 +43,8 @@ export async function resolveCliContext(options = {}) {
43
43
  runsFile: resolveWorkspacePath(root, VORATIQ_RUN_FILE),
44
44
  reductionsDir: resolveWorkspacePath(root, VORATIQ_REDUCTION_DIR),
45
45
  reductionsFile: resolveWorkspacePath(root, VORATIQ_REDUCTION_FILE),
46
+ messagesDir: resolveWorkspacePath(root, VORATIQ_MESSAGE_DIR),
47
+ messagesFile: resolveWorkspacePath(root, VORATIQ_MESSAGE_FILE),
46
48
  specsDir: resolveWorkspacePath(root, VORATIQ_SPEC_DIR),
47
49
  specsFile: resolveWorkspacePath(root, VORATIQ_SPEC_FILE),
48
50
  verificationsDir: resolveWorkspacePath(root, VORATIQ_VERIFICATION_DIR),
@@ -1,3 +1,4 @@
1
+ import type { MessageRecord } from "../../domain/message/model/types.js";
1
2
  import type { ReductionRecord } from "../../domain/reduce/model/types.js";
2
3
  import type { RunRecord } from "../../domain/run/model/types.js";
3
4
  import type { SpecRecord } from "../../domain/spec/model/types.js";
@@ -6,5 +7,6 @@ export declare function renderRunList(records: readonly RunRecord[]): string;
6
7
  export declare function renderListTranscript(records: readonly RunRecord[]): string;
7
8
  export declare function renderSpecList(records: readonly SpecRecord[]): string;
8
9
  export declare function renderReduceList(records: readonly ReductionRecord[]): string;
10
+ export declare function renderMessageList(records: readonly MessageRecord[]): string;
9
11
  export declare function renderVerifyList(records: readonly VerificationRecord[]): string;
10
12
  export declare function renderListTableTranscript(tableOutput: string): string;
@@ -3,6 +3,7 @@ import { renderTable } from "../utils/table.js";
3
3
  import { renderTranscript } from "../utils/transcript.js";
4
4
  const DASH = "—";
5
5
  const SPEC_DESCRIPTION_PREVIEW_LENGTH = 32;
6
+ const MESSAGE_PROMPT_PREVIEW_LENGTH = 32;
6
7
  export function renderRunList(records) {
7
8
  const rows = records.map((record) => ({
8
9
  run: record.runId,
@@ -77,6 +78,29 @@ export function renderReduceList(records) {
77
78
  rows: records,
78
79
  }).join("\n");
79
80
  }
81
+ export function renderMessageList(records) {
82
+ return renderTable({
83
+ columns: [
84
+ {
85
+ header: "MESSAGE",
86
+ accessor: (record) => record.sessionId,
87
+ },
88
+ {
89
+ header: "PROMPT",
90
+ accessor: (record) => truncatePreview(record.prompt, MESSAGE_PROMPT_PREVIEW_LENGTH),
91
+ },
92
+ {
93
+ header: "STATUS",
94
+ accessor: (record) => record.status.toUpperCase(),
95
+ },
96
+ {
97
+ header: "CREATED",
98
+ accessor: (record) => formatRunTimestamp(record.createdAt),
99
+ },
100
+ ],
101
+ rows: records,
102
+ }).join("\n");
103
+ }
80
104
  export function renderVerifyList(records) {
81
105
  return renderTable({
82
106
  columns: [
@@ -0,0 +1,72 @@
1
+ import type { ExtractedTokenUsage } from "../../domain/run/model/types.js";
2
+ import type { TokenUsageResult } from "../../workspace/chat/token-usage-result.js";
3
+ type CliWriter = Pick<NodeJS.WriteStream, "write"> & {
4
+ isTTY?: boolean;
5
+ columns?: number;
6
+ };
7
+ export interface MessageProgressContext {
8
+ messageId: string;
9
+ createdAt: string;
10
+ startedAt?: string;
11
+ completedAt?: string;
12
+ workspacePath: string;
13
+ status: "queued" | "running" | "succeeded" | "failed" | "aborted";
14
+ }
15
+ export interface MessageProgressRecipientRecord {
16
+ agentId: string;
17
+ status: "queued" | "running" | "succeeded" | "failed" | "aborted";
18
+ startedAt?: string;
19
+ completedAt?: string;
20
+ outputPath?: string;
21
+ tokenUsage?: ExtractedTokenUsage;
22
+ tokenUsageResult?: TokenUsageResult;
23
+ error?: string | null;
24
+ }
25
+ export interface MessageProgressRenderer {
26
+ begin(context?: MessageProgressContext): void;
27
+ update(record: MessageProgressRecipientRecord): void;
28
+ complete(status?: MessageProgressContext["status"], lifecycle?: {
29
+ startedAt?: string;
30
+ completedAt?: string;
31
+ }): void;
32
+ }
33
+ export interface MessageTranscriptRecipientBlock {
34
+ agentId: string;
35
+ status: "queued" | "running" | "succeeded" | "failed" | "aborted";
36
+ duration: string;
37
+ outputPath?: string;
38
+ previewLines?: readonly string[];
39
+ errorLine?: string;
40
+ }
41
+ export interface MessageTranscriptOptions {
42
+ messageId: string;
43
+ createdAt: string;
44
+ elapsed: string;
45
+ workspacePath: string;
46
+ status: "queued" | "running" | "succeeded" | "failed" | "aborted";
47
+ recipients: readonly MessageTranscriptRecipientBlock[];
48
+ isTty?: boolean;
49
+ includeSummarySection?: boolean;
50
+ }
51
+ interface MessageRendererOptions {
52
+ stdout?: CliWriter;
53
+ stderr?: CliWriter;
54
+ now?: () => number;
55
+ suppressLeadingBlankLine?: boolean;
56
+ suppressTrailingBlankLine?: boolean;
57
+ }
58
+ export declare function createMessageRenderer(options?: MessageRendererOptions): MessageProgressRenderer;
59
+ export declare function renderMessageTranscript(options: MessageTranscriptOptions): string;
60
+ export declare function formatMessageElapsed(input: {
61
+ status: MessageProgressContext["status"];
62
+ startedAt?: string;
63
+ completedAt?: string;
64
+ now?: number;
65
+ }): string | undefined;
66
+ export declare function formatMessageRecipientDuration(input: {
67
+ status: MessageProgressRecipientRecord["status"];
68
+ startedAt?: string;
69
+ completedAt?: string;
70
+ now?: number;
71
+ }): string | undefined;
72
+ export {};