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.
Files changed (222) hide show
  1. package/README.md +19 -23
  2. package/dist/agents/launch/chat.d.ts +3 -1
  3. package/dist/agents/launch/chat.js +2 -0
  4. package/dist/agents/runtime/policy.js +2 -1
  5. package/dist/auth/providers/utils.js +1 -1
  6. package/dist/bin.js +28 -7
  7. package/dist/cli/auto.js +4 -16
  8. package/dist/cli/contract.d.ts +26 -17
  9. package/dist/cli/contract.js +3 -1
  10. package/dist/cli/doctor.d.ts +12 -0
  11. package/dist/cli/doctor.js +115 -0
  12. package/dist/cli/list.js +5 -1
  13. package/dist/cli/message.js +16 -11
  14. package/dist/cli/operator-envelope.d.ts +27 -7
  15. package/dist/cli/operator-envelope.js +95 -3
  16. package/dist/cli/option-parsers.d.ts +2 -0
  17. package/dist/cli/option-parsers.js +7 -0
  18. package/dist/cli/output.d.ts +1 -5
  19. package/dist/cli/reduce.js +5 -13
  20. package/dist/cli/run.js +5 -12
  21. package/dist/cli/spec.js +4 -10
  22. package/dist/cli/verify.d.ts +1 -1
  23. package/dist/cli/verify.js +51 -22
  24. package/dist/commands/auto/command.d.ts +1 -0
  25. package/dist/commands/auto/command.js +22 -15
  26. package/dist/commands/auto/errors.js +1 -1
  27. package/dist/commands/auto/validation.js +3 -1
  28. package/dist/commands/doctor/agents.d.ts +5 -0
  29. package/dist/commands/{init → doctor}/agents.js +40 -20
  30. package/dist/commands/doctor/command.d.ts +22 -0
  31. package/dist/commands/doctor/command.js +100 -0
  32. package/dist/commands/doctor/environment.d.ts +2 -0
  33. package/dist/commands/{init → doctor}/environment.js +41 -7
  34. package/dist/commands/{init/types.d.ts → doctor/fix-types.d.ts} +30 -9
  35. package/dist/commands/doctor/fix.d.ts +2 -0
  36. package/dist/commands/{init/command.js → doctor/fix.js} +109 -11
  37. package/dist/commands/doctor/reconcile.d.ts +2 -0
  38. package/dist/commands/doctor/reconcile.js +103 -0
  39. package/dist/commands/interactive/lifecycle.d.ts +2 -0
  40. package/dist/commands/interactive/lifecycle.js +16 -0
  41. package/dist/commands/list/command.d.ts +1 -0
  42. package/dist/commands/list/command.js +241 -361
  43. package/dist/commands/list/normalization.d.ts +51 -0
  44. package/dist/commands/list/normalization.js +309 -0
  45. package/dist/commands/list/records.d.ts +9 -0
  46. package/dist/commands/list/records.js +6 -0
  47. package/dist/commands/message/command.d.ts +2 -2
  48. package/dist/commands/message/command.js +29 -16
  49. package/dist/commands/message/errors.d.ts +12 -3
  50. package/dist/commands/message/errors.js +19 -3
  51. package/dist/commands/prune/command.js +4 -1
  52. package/dist/commands/reduce/command.js +16 -17
  53. package/dist/commands/reduce/errors.d.ts +2 -2
  54. package/dist/commands/reduce/errors.js +3 -3
  55. package/dist/commands/reduce/targets.js +12 -3
  56. package/dist/commands/root-launcher/command.js +12 -6
  57. package/dist/commands/run/command.d.ts +1 -0
  58. package/dist/commands/run/command.js +4 -1
  59. package/dist/commands/run/record-init.d.ts +2 -0
  60. package/dist/commands/run/record-init.js +8 -1
  61. package/dist/commands/run/spec-provenance.d.ts +37 -0
  62. package/dist/commands/run/spec-provenance.js +384 -0
  63. package/dist/commands/run/validation.d.ts +4 -0
  64. package/dist/commands/run/validation.js +25 -62
  65. package/dist/commands/shared/resolve-stage-competitors.js +2 -1
  66. package/dist/commands/spec/command.js +64 -138
  67. package/dist/commands/spec/errors.d.ts +5 -0
  68. package/dist/commands/spec/errors.js +9 -0
  69. package/dist/commands/verify/agents.d.ts +4 -2
  70. package/dist/commands/verify/agents.js +4 -11
  71. package/dist/commands/verify/command.js +23 -6
  72. package/dist/commands/verify/errors.d.ts +12 -0
  73. package/dist/commands/verify/errors.js +22 -0
  74. package/dist/commands/verify/lifecycle.js +1 -1
  75. package/dist/commands/verify/targets.js +108 -12
  76. package/dist/competition/shared/preflight.d.ts +1 -1
  77. package/dist/competition/shared/preflight.js +15 -2
  78. package/dist/competition/shared/teardown.d.ts +7 -0
  79. package/dist/competition/shared/teardown.js +6 -0
  80. package/dist/configs/agents/defaults.js +13 -44
  81. package/dist/configs/agents/loader.js +1 -1
  82. package/dist/configs/environment/loader.js +2 -1
  83. package/dist/configs/orchestration/loader.js +2 -1
  84. package/dist/configs/sandbox/loader.js +2 -1
  85. package/dist/configs/settings/loader.js +1 -1
  86. package/dist/configs/verification/loader.js +2 -1
  87. package/dist/contracts/list.d.ts +129 -149
  88. package/dist/contracts/list.js +47 -99
  89. package/dist/domain/interactive/model/types.d.ts +2 -0
  90. package/dist/domain/interactive/model/types.js +16 -1
  91. package/dist/domain/interactive/persistence/adapter.d.ts +23 -0
  92. package/dist/domain/interactive/persistence/adapter.js +67 -5
  93. package/dist/domain/interactive/prompt.d.ts +1 -1
  94. package/dist/domain/interactive/prompt.js +1 -1
  95. package/dist/domain/interactive/session-env.d.ts +10 -0
  96. package/dist/domain/interactive/session-env.js +25 -0
  97. package/dist/domain/message/competition/adapter.js +3 -9
  98. package/dist/domain/message/model/types.d.ts +32 -1
  99. package/dist/domain/message/model/types.js +25 -1
  100. package/dist/domain/reduce/competition/adapter.js +30 -16
  101. package/dist/domain/reduce/competition/finalize.d.ts +7 -0
  102. package/dist/domain/reduce/competition/finalize.js +19 -0
  103. package/dist/domain/reduce/model/types.d.ts +3 -3
  104. package/dist/domain/run/competition/agents/artifacts.js +4 -2
  105. package/dist/domain/run/competition/agents/lifecycle.js +1 -1
  106. package/dist/domain/run/competition/agents/workspace.js +2 -1
  107. package/dist/domain/run/competition/errors.d.ts +1 -1
  108. package/dist/domain/run/competition/errors.js +4 -7
  109. package/dist/domain/run/competition/reports.js +2 -1
  110. package/dist/domain/run/model/enhanced.d.ts +1 -1
  111. package/dist/domain/run/model/enhanced.js +2 -1
  112. package/dist/domain/run/model/types.d.ts +384 -0
  113. package/dist/domain/run/model/types.js +87 -0
  114. package/dist/domain/spec/competition/adapter.d.ts +1 -0
  115. package/dist/domain/spec/competition/adapter.js +9 -10
  116. package/dist/domain/spec/model/mutators.d.ts +20 -0
  117. package/dist/domain/spec/model/mutators.js +146 -0
  118. package/dist/domain/spec/model/types.d.ts +3 -0
  119. package/dist/domain/spec/model/types.js +5 -0
  120. package/dist/domain/spec/persistence/adapter.d.ts +1 -0
  121. package/dist/domain/spec/persistence/adapter.js +7 -2
  122. package/dist/domain/verify/competition/adapter.d.ts +1 -1
  123. package/dist/domain/verify/competition/adapter.js +4 -9
  124. package/dist/domain/verify/competition/finalize.d.ts +9 -0
  125. package/dist/domain/verify/competition/finalize.js +22 -3
  126. package/dist/domain/verify/competition/programmatic.js +2 -1
  127. package/dist/domain/verify/competition/prompt.js +1 -1
  128. package/dist/domain/verify/competition/shared-layout.js +1 -1
  129. package/dist/domain/verify/model/types.d.ts +2 -2
  130. package/dist/interactive/providers/launch.d.ts +2 -0
  131. package/dist/interactive/providers/launch.js +19 -2
  132. package/dist/interactive/providers/mcp.d.ts +1 -0
  133. package/dist/interactive/providers/mcp.js +45 -7
  134. package/dist/interactive/substrate.js +32 -5
  135. package/dist/mcp/server.d.ts +1 -0
  136. package/dist/mcp/server.js +337 -44
  137. package/dist/policy/auto.d.ts +0 -1
  138. package/dist/policy/auto.js +3 -14
  139. package/dist/policy/verification.js +18 -1
  140. package/dist/preflight/agents.d.ts +24 -0
  141. package/dist/preflight/agents.js +71 -0
  142. package/dist/preflight/environment.d.ts +6 -0
  143. package/dist/preflight/environment.js +17 -0
  144. package/dist/preflight/formatting.d.ts +5 -0
  145. package/dist/preflight/formatting.js +20 -0
  146. package/dist/preflight/index.d.ts +2 -0
  147. package/dist/preflight/index.js +6 -9
  148. package/dist/preflight/operator.d.ts +32 -0
  149. package/dist/preflight/operator.js +40 -0
  150. package/dist/preflight/settings.d.ts +2 -0
  151. package/dist/preflight/settings.js +17 -0
  152. package/dist/render/transcripts/apply.js +2 -1
  153. package/dist/render/transcripts/interactive.d.ts +16 -0
  154. package/dist/render/transcripts/interactive.js +42 -0
  155. package/dist/render/transcripts/list.d.ts +41 -0
  156. package/dist/render/transcripts/list.js +152 -3
  157. package/dist/render/transcripts/message.d.ts +3 -5
  158. package/dist/render/transcripts/message.js +29 -74
  159. package/dist/render/transcripts/reduce.d.ts +2 -4
  160. package/dist/render/transcripts/reduce.js +31 -75
  161. package/dist/render/transcripts/root-launcher.js +2 -12
  162. package/dist/render/transcripts/run.d.ts +4 -4
  163. package/dist/render/transcripts/run.js +36 -47
  164. package/dist/render/transcripts/spec.d.ts +1 -4
  165. package/dist/render/transcripts/spec.js +15 -62
  166. package/dist/render/transcripts/verify.d.ts +6 -7
  167. package/dist/render/transcripts/verify.js +54 -85
  168. package/dist/render/utils/cli-writer.d.ts +4 -0
  169. package/dist/render/utils/cli-writer.js +1 -0
  170. package/dist/render/utils/duration.d.ts +5 -0
  171. package/dist/render/utils/duration.js +6 -0
  172. package/dist/render/utils/progressive-render.d.ts +3 -0
  173. package/dist/render/utils/progressive-render.js +44 -0
  174. package/dist/render/utils/runs.d.ts +1 -0
  175. package/dist/render/utils/runs.js +1 -0
  176. package/dist/render/utils/transcript-shell.d.ts +2 -1
  177. package/dist/render/utils/transcript-shell.js +19 -6
  178. package/dist/utils/diff.d.ts +2 -0
  179. package/dist/utils/diff.js +1 -0
  180. package/dist/utils/errors.d.ts +2 -1
  181. package/dist/utils/errors.js +3 -1
  182. package/dist/utils/git.d.ts +1 -1
  183. package/dist/utils/git.js +25 -2
  184. package/dist/utils/list-target.d.ts +4 -0
  185. package/dist/utils/list-target.js +35 -0
  186. package/dist/utils/swarm-session-ack.d.ts +9 -0
  187. package/dist/utils/swarm-session-ack.js +17 -0
  188. package/dist/utils/terminal.d.ts +1 -0
  189. package/dist/utils/terminal.js +11 -0
  190. package/dist/workspace/artifact-paths.d.ts +55 -0
  191. package/dist/workspace/artifact-paths.js +106 -0
  192. package/dist/workspace/chat/artifacts.d.ts +7 -0
  193. package/dist/workspace/chat/artifacts.js +95 -4
  194. package/dist/workspace/chat/native-usage.js +1 -1
  195. package/dist/workspace/chat/sources.d.ts +2 -5
  196. package/dist/workspace/chat/sources.js +4 -4
  197. package/dist/workspace/constants.d.ts +47 -0
  198. package/dist/workspace/constants.js +47 -0
  199. package/dist/workspace/errors.js +2 -2
  200. package/dist/workspace/layout.js +3 -1
  201. package/dist/workspace/managed-state.d.ts +32 -0
  202. package/dist/workspace/managed-state.js +104 -0
  203. package/dist/workspace/path-formatters.d.ts +9 -0
  204. package/dist/workspace/path-formatters.js +46 -0
  205. package/dist/workspace/path-resolvers.d.ts +1 -0
  206. package/dist/workspace/path-resolvers.js +5 -0
  207. package/dist/workspace/session-paths.d.ts +16 -0
  208. package/dist/workspace/session-paths.js +59 -0
  209. package/dist/workspace/setup.js +67 -2
  210. package/dist/workspace/shim.d.ts +1 -0
  211. package/dist/workspace/shim.js +3 -3
  212. package/package.json +2 -2
  213. package/dist/cli/init.d.ts +0 -15
  214. package/dist/cli/init.js +0 -70
  215. package/dist/commands/init/agents.d.ts +0 -4
  216. package/dist/commands/init/command.d.ts +0 -2
  217. package/dist/commands/init/environment.d.ts +0 -2
  218. package/dist/render/transcripts/init.d.ts +0 -7
  219. package/dist/render/transcripts/init.js +0 -83
  220. package/dist/workspace/structure.d.ts +0 -143
  221. package/dist/workspace/structure.js +0 -319
  222. /package/dist/commands/{init/types.js → doctor/fix-types.js} +0 -0
@@ -2,43 +2,13 @@ import { getAgentStatusStyle, getRunStatusStyle } from "../../status/colors.js";
2
2
  import { TERMINAL_SPEC_STATUSES } from "../../status/index.js";
3
3
  import { formatAgentErrorLine } from "../utils/agents.js";
4
4
  import { formatAgentBadge } from "../utils/badges.js";
5
- import { formatRenderLifecycleDuration } from "../utils/duration.js";
5
+ import { formatRenderLifecycleDuration, formatRenderLifecycleRowDuration, } from "../utils/duration.js";
6
6
  import { createInteractiveFrameRenderer } from "../utils/interactive-frame.js";
7
+ import { clearRefreshIntervalHandle, formatProgressiveRenderErrorDetail, parseProgressTimestamp, } from "../utils/progressive-render.js";
7
8
  import { buildStageFrameLines, buildStageFrameSections, renderStageFinalFrame, } from "../utils/stage-output.js";
8
9
  import { renderTranscript } from "../utils/transcript.js";
9
10
  import { buildStandardSessionShellSection, formatTranscriptStatusLabel, renderTranscriptStatusTable, resolveTranscriptShellStyle, resolveTranscriptShellStyleFromWriter, } from "../utils/transcript-shell.js";
10
11
  const DASH = "—";
11
- function formatErrorDetail(error) {
12
- if (error instanceof Error) {
13
- return error.message;
14
- }
15
- if (typeof error === "string") {
16
- return error;
17
- }
18
- if (error === null || error === undefined) {
19
- return "unknown error";
20
- }
21
- if (typeof error === "number" ||
22
- typeof error === "boolean" ||
23
- typeof error === "bigint") {
24
- return `${error}`;
25
- }
26
- if (typeof error === "symbol") {
27
- return error.description ?? error.toString();
28
- }
29
- if (typeof error === "object") {
30
- try {
31
- const serialized = JSON.stringify(error);
32
- if (serialized) {
33
- return serialized;
34
- }
35
- }
36
- catch {
37
- // Ignore serialization errors and fall back.
38
- }
39
- }
40
- return "unknown error";
41
- }
42
12
  function buildSpecStageShell(options) {
43
13
  return {
44
14
  metadataLines: buildStandardSessionShellSection({
@@ -70,13 +40,6 @@ export function createSpecRenderer(options = {}) {
70
40
  const interactiveFrameRenderer = createInteractiveFrameRenderer(stdout);
71
41
  const agentOrder = [];
72
42
  const agentRecords = new Map();
73
- function stopRefreshLoop() {
74
- if (!refreshInterval) {
75
- return;
76
- }
77
- clearInterval(refreshInterval);
78
- refreshInterval = undefined;
79
- }
80
43
  function hasRunningAgents() {
81
44
  for (const agent of agentRecords.values()) {
82
45
  if (agent.status === "running") {
@@ -87,7 +50,7 @@ export function createSpecRenderer(options = {}) {
87
50
  }
88
51
  function syncRefreshLoop() {
89
52
  if (!stdout.isTTY || disabled || !context || !hasRunningAgents()) {
90
- stopRefreshLoop();
53
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
91
54
  return;
92
55
  }
93
56
  if (refreshInterval) {
@@ -96,7 +59,7 @@ export function createSpecRenderer(options = {}) {
96
59
  refreshInterval = setInterval(() => {
97
60
  guard(() => {
98
61
  if (!stdout.isTTY || disabled || !context || !hasRunningAgents()) {
99
- stopRefreshLoop();
62
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
100
63
  return;
101
64
  }
102
65
  const nextElapsed = formatSpecElapsed(context, now());
@@ -117,25 +80,15 @@ export function createSpecRenderer(options = {}) {
117
80
  }
118
81
  catch (error) {
119
82
  disabled = true;
120
- stopRefreshLoop();
83
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
121
84
  if (!warningLogged) {
122
85
  warningLogged = true;
123
- stderr.write(`[voratiq] Progressive spec output disabled: ${formatErrorDetail(error)}\n`);
86
+ stderr.write(`[voratiq] Progressive spec output disabled: ${formatProgressiveRenderErrorDetail(error)}\n`);
124
87
  }
125
88
  }
126
89
  }
127
- function safeParse(value) {
128
- if (!value) {
129
- return undefined;
130
- }
131
- const parsed = Date.parse(value);
132
- return Number.isNaN(parsed) ? undefined : parsed;
133
- }
134
90
  function formatDuration(record) {
135
- if (record.status === "running") {
136
- return DASH;
137
- }
138
- return (formatRenderLifecycleDuration({
91
+ return formatRenderLifecycleRowDuration({
139
92
  lifecycle: {
140
93
  status: record.status,
141
94
  startedAt: record.startedAt,
@@ -143,21 +96,21 @@ export function createSpecRenderer(options = {}) {
143
96
  },
144
97
  terminalStatuses: ["succeeded", "failed"],
145
98
  now: now(),
146
- }) ?? DASH);
99
+ });
147
100
  }
148
101
  function syncContextLifecycleFromAgentRecords() {
149
102
  if (!context) {
150
103
  return;
151
104
  }
152
- let earliestStartedAt = safeParse(context.startedAt);
153
- let latestCompletedAt = safeParse(context.completedAt);
105
+ let earliestStartedAt = parseProgressTimestamp(context.startedAt);
106
+ let latestCompletedAt = parseProgressTimestamp(context.completedAt);
154
107
  for (const agent of agentRecords.values()) {
155
- const startedAt = safeParse(agent.startedAt);
108
+ const startedAt = parseProgressTimestamp(agent.startedAt);
156
109
  if (startedAt !== undefined &&
157
110
  (earliestStartedAt === undefined || startedAt < earliestStartedAt)) {
158
111
  earliestStartedAt = startedAt;
159
112
  }
160
- const completedAt = safeParse(agent.completedAt);
113
+ const completedAt = parseProgressTimestamp(agent.completedAt);
161
114
  if (completedAt !== undefined &&
162
115
  (latestCompletedAt === undefined || completedAt > latestCompletedAt)) {
163
116
  latestCompletedAt = completedAt;
@@ -289,7 +242,7 @@ export function createSpecRenderer(options = {}) {
289
242
  });
290
243
  },
291
244
  complete(status, lifecycle) {
292
- stopRefreshLoop();
245
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
293
246
  guard(() => {
294
247
  if (context && lifecycle) {
295
248
  context = {
@@ -325,7 +278,7 @@ export function formatSpecElapsed(options, now) {
325
278
  });
326
279
  }
327
280
  export function formatSpecAgentDuration(options) {
328
- return (formatRenderLifecycleDuration({
281
+ return formatRenderLifecycleRowDuration({
329
282
  lifecycle: {
330
283
  status: options.status,
331
284
  startedAt: options.startedAt,
@@ -333,7 +286,7 @@ export function formatSpecAgentDuration(options) {
333
286
  },
334
287
  terminalStatuses: ["succeeded", "failed"],
335
288
  now: options.now,
336
- }) ?? DASH);
289
+ });
337
290
  }
338
291
  export function renderSpecTranscript(input, options = {}) {
339
292
  const { suppressHint } = options;
@@ -1,17 +1,15 @@
1
1
  import type { ExtractedTokenUsage } from "../../domain/run/model/types.js";
2
2
  import type { TokenUsageResult } from "../../workspace/chat/token-usage-result.js";
3
+ import type { CliWriter } from "../utils/cli-writer.js";
3
4
  import type { StageProgressEventConsumer } from "./stage-progress.js";
4
- type CliWriter = Pick<NodeJS.WriteStream, "write"> & {
5
- isTTY?: boolean;
6
- columns?: number;
7
- };
5
+ type VerifyTranscriptStatus = "queued" | "running" | "succeeded" | "failed" | "aborted" | "unresolved";
8
6
  export interface VerifyProgressContext {
9
7
  verificationId: string;
10
8
  createdAt: string;
11
9
  startedAt?: string;
12
10
  completedAt?: string;
13
11
  workspacePath: string;
14
- status: "queued" | "running" | "succeeded" | "failed" | "aborted";
12
+ status: VerifyTranscriptStatus;
15
13
  }
16
14
  export interface VerifyProgressMethodRecord {
17
15
  methodKey: string;
@@ -34,7 +32,7 @@ interface VerifyRendererOptions {
34
32
  export interface VerifyProgressRenderer extends StageProgressEventConsumer<VerifyProgressContext, VerifyProgressMethodRecord> {
35
33
  begin(context?: VerifyProgressContext): void;
36
34
  update(record: VerifyProgressMethodRecord): void;
37
- complete(status?: VerifyProgressContext["status"], lifecycle?: {
35
+ complete(status?: VerifyTranscriptStatus, lifecycle?: {
38
36
  startedAt?: string;
39
37
  completedAt?: string;
40
38
  }): void;
@@ -54,11 +52,12 @@ export declare function renderVerifyTranscript(options: {
54
52
  createdAt: string;
55
53
  elapsed: string;
56
54
  workspacePath: string;
55
+ targetDisplay?: string;
57
56
  target?: {
58
57
  kind: string;
59
58
  sessionId: string;
60
59
  };
61
- status: "queued" | "running" | "succeeded" | "failed" | "aborted";
60
+ status: VerifyTranscriptStatus;
62
61
  methods: readonly VerifyTranscriptMethodBlock[];
63
62
  suppressHint?: boolean;
64
63
  warningMessage?: string;
@@ -1,57 +1,35 @@
1
1
  import { getRunStatusStyle } from "../../status/colors.js";
2
2
  import { TERMINAL_VERIFICATION_STATUSES } from "../../status/index.js";
3
- import { formatRenderLifecycleDuration } from "../utils/duration.js";
3
+ import { formatRenderLifecycleDuration, formatRenderLifecycleRowDuration, } from "../utils/duration.js";
4
4
  import { createInteractiveFrameRenderer } from "../utils/interactive-frame.js";
5
+ import { clearRefreshIntervalHandle, formatProgressiveRenderErrorDetail, parseProgressTimestamp, } from "../utils/progressive-render.js";
5
6
  import { buildStageFrameLines, buildStageFrameSections, } from "../utils/stage-output.js";
6
7
  import { renderTable } from "../utils/table.js";
7
8
  import { renderTranscript } from "../utils/transcript.js";
8
9
  import { buildStandardSessionShellSection, formatTranscriptErrorLine, formatTranscriptStatusLabel, resolveTranscriptShellStyle, resolveTranscriptShellStyleFromWriter, } from "../utils/transcript-shell.js";
9
10
  const DASH = "—";
10
- function formatErrorDetail(error) {
11
- if (error instanceof Error) {
12
- return error.message;
13
- }
14
- if (typeof error === "string") {
15
- return error;
16
- }
17
- if (error === null || error === undefined) {
18
- return "unknown error";
19
- }
20
- if (typeof error === "number" ||
21
- typeof error === "boolean" ||
22
- typeof error === "bigint") {
23
- return `${error}`;
24
- }
25
- if (typeof error === "symbol") {
26
- return error.description ?? error.toString();
27
- }
28
- if (typeof error === "object") {
29
- try {
30
- const serialized = JSON.stringify(error);
31
- if (serialized) {
32
- return serialized;
33
- }
34
- }
35
- catch {
36
- // Ignore serialization errors and fall back.
37
- }
38
- }
39
- return "unknown error";
40
- }
11
+ const VERIFY_TRANSCRIPT_TERMINAL_STATUSES = [
12
+ ...TERMINAL_VERIFICATION_STATUSES,
13
+ "unresolved",
14
+ ];
41
15
  function buildVerifyStageShell(options) {
16
+ const metadataLines = buildStandardSessionShellSection({
17
+ badgeText: options.verificationId,
18
+ badgeVariant: "verify",
19
+ status: {
20
+ value: options.status,
21
+ color: options.status === "unresolved"
22
+ ? "yellow"
23
+ : getRunStatusStyle(options.status).cli,
24
+ },
25
+ elapsed: options.elapsed,
26
+ createdAt: options.createdAt,
27
+ workspacePath: options.workspacePath,
28
+ targetDisplay: options.targetDisplay,
29
+ style: options.style,
30
+ });
42
31
  return {
43
- metadataLines: buildStandardSessionShellSection({
44
- badgeText: options.verificationId,
45
- badgeVariant: "verify",
46
- status: {
47
- value: options.status,
48
- color: getRunStatusStyle(options.status).cli,
49
- },
50
- elapsed: options.elapsed,
51
- createdAt: options.createdAt,
52
- workspacePath: options.workspacePath,
53
- style: options.style,
54
- }),
32
+ metadataLines,
55
33
  statusTableLines: options.tableLines ?? [],
56
34
  };
57
35
  }
@@ -97,13 +75,6 @@ export function createVerifyRenderer(options = {}) {
97
75
  const interactiveFrameRenderer = createInteractiveFrameRenderer(stdout);
98
76
  const methodOrder = [];
99
77
  const methodRecords = new Map();
100
- function stopRefreshLoop() {
101
- if (!refreshInterval) {
102
- return;
103
- }
104
- clearInterval(refreshInterval);
105
- refreshInterval = undefined;
106
- }
107
78
  function hasRunningMethods() {
108
79
  for (const method of methodRecords.values()) {
109
80
  if (method.status === "running") {
@@ -114,7 +85,7 @@ export function createVerifyRenderer(options = {}) {
114
85
  }
115
86
  function syncRefreshLoop() {
116
87
  if (!stdout.isTTY || disabled || !context || !hasRunningMethods()) {
117
- stopRefreshLoop();
88
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
118
89
  return;
119
90
  }
120
91
  if (refreshInterval) {
@@ -123,7 +94,7 @@ export function createVerifyRenderer(options = {}) {
123
94
  refreshInterval = setInterval(() => {
124
95
  guard(() => {
125
96
  if (!stdout.isTTY || disabled || !context || !hasRunningMethods()) {
126
- stopRefreshLoop();
97
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
127
98
  return;
128
99
  }
129
100
  const nextElapsed = formatVerifyElapsed(context, now());
@@ -144,25 +115,15 @@ export function createVerifyRenderer(options = {}) {
144
115
  }
145
116
  catch (error) {
146
117
  disabled = true;
147
- stopRefreshLoop();
118
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
148
119
  if (!warningLogged) {
149
120
  warningLogged = true;
150
- stderr.write(`[voratiq] Progressive verify output disabled: ${formatErrorDetail(error)}\n`);
121
+ stderr.write(`[voratiq] Progressive verify output disabled: ${formatProgressiveRenderErrorDetail(error)}\n`);
151
122
  }
152
123
  }
153
124
  }
154
- function safeParse(value) {
155
- if (!value) {
156
- return undefined;
157
- }
158
- const parsed = Date.parse(value);
159
- return Number.isNaN(parsed) ? undefined : parsed;
160
- }
161
125
  function formatDuration(record) {
162
- if (record.status === "running") {
163
- return DASH;
164
- }
165
- return (formatRenderLifecycleDuration({
126
+ return formatRenderLifecycleRowDuration({
166
127
  lifecycle: {
167
128
  status: record.status,
168
129
  startedAt: record.startedAt,
@@ -170,21 +131,21 @@ export function createVerifyRenderer(options = {}) {
170
131
  },
171
132
  terminalStatuses: TERMINAL_VERIFICATION_STATUSES,
172
133
  now: now(),
173
- }) ?? DASH);
134
+ });
174
135
  }
175
136
  function syncContextLifecycleFromMethods() {
176
137
  if (!context) {
177
138
  return;
178
139
  }
179
- let earliestStartedAt = safeParse(context.startedAt);
180
- let latestCompletedAt = safeParse(context.completedAt);
140
+ let earliestStartedAt = parseProgressTimestamp(context.startedAt);
141
+ let latestCompletedAt = parseProgressTimestamp(context.completedAt);
181
142
  for (const method of methodRecords.values()) {
182
- const startedAt = safeParse(method.startedAt);
143
+ const startedAt = parseProgressTimestamp(method.startedAt);
183
144
  if (startedAt !== undefined &&
184
145
  (earliestStartedAt === undefined || startedAt < earliestStartedAt)) {
185
146
  earliestStartedAt = startedAt;
186
147
  }
187
- const completedAt = safeParse(method.completedAt);
148
+ const completedAt = parseProgressTimestamp(method.completedAt);
188
149
  if (completedAt !== undefined &&
189
150
  (latestCompletedAt === undefined || completedAt > latestCompletedAt)) {
190
151
  latestCompletedAt = completedAt;
@@ -311,7 +272,18 @@ export function createVerifyRenderer(options = {}) {
311
272
  });
312
273
  },
313
274
  complete(status, lifecycle) {
314
- stopRefreshLoop();
275
+ refreshInterval = clearRefreshIntervalHandle(refreshInterval);
276
+ const allowTerminalOverride = disabled &&
277
+ stdout.isTTY === true &&
278
+ context !== undefined &&
279
+ status !== undefined &&
280
+ context.status !== status;
281
+ if (disabled && !allowTerminalOverride) {
282
+ return;
283
+ }
284
+ if (allowTerminalOverride) {
285
+ disabled = false;
286
+ }
315
287
  guard(() => {
316
288
  if (context && lifecycle) {
317
289
  context = {
@@ -321,11 +293,11 @@ export function createVerifyRenderer(options = {}) {
321
293
  };
322
294
  }
323
295
  if (status) {
324
- this.onProgressEvent({
325
- type: "stage.status",
326
- stage: "verify",
327
- status,
328
- });
296
+ if (context) {
297
+ context = { ...context, status };
298
+ }
299
+ render();
300
+ syncRefreshLoop();
329
301
  }
330
302
  else {
331
303
  render();
@@ -336,10 +308,12 @@ export function createVerifyRenderer(options = {}) {
336
308
  };
337
309
  }
338
310
  export function renderVerifyTranscript(options) {
339
- const { verificationId, createdAt, elapsed, workspacePath, target, status, methods, suppressHint, warningMessage, hintMessage, isTty, includeSummarySection = true, } = options;
311
+ const { verificationId, createdAt, elapsed, workspacePath, targetDisplay, target, status, methods, suppressHint, warningMessage, hintMessage, isTty, includeSummarySection = true, } = options;
340
312
  const style = { isTty };
341
313
  const resolvedStyle = resolveTranscriptShellStyle(style);
342
314
  const sections = [];
315
+ const resolvedTargetDisplay = targetDisplay ??
316
+ (target ? `${target.kind}:${target.sessionId}` : undefined);
343
317
  if (includeSummarySection) {
344
318
  const metadataLines = buildVerifyStageShell({
345
319
  verificationId,
@@ -347,6 +321,7 @@ export function renderVerifyTranscript(options) {
347
321
  elapsed,
348
322
  workspacePath,
349
323
  status,
324
+ targetDisplay: resolvedTargetDisplay,
350
325
  tableLines: methods.length === 0
351
326
  ? []
352
327
  : buildVerifyMethodTable(methods.map((method) => ({
@@ -363,12 +338,6 @@ export function renderVerifyTranscript(options) {
363
338
  if (methods.length > 0) {
364
339
  sections.push(["---"]);
365
340
  }
366
- if (target) {
367
- sections.push([`Target: ${target.kind}:${target.sessionId}`]);
368
- if (methods.length > 0) {
369
- sections.push(["---"]);
370
- }
371
- }
372
341
  methods.forEach((method, index) => {
373
342
  const block = [`Agent: ${method.agentLabel ?? DASH}`];
374
343
  block.push("", `Verifier: ${method.verifierLabel}`);
@@ -403,7 +372,7 @@ export function formatVerifyElapsed(source, now) {
403
372
  startedAt: source.startedAt,
404
373
  completedAt: source.completedAt,
405
374
  },
406
- terminalStatuses: TERMINAL_VERIFICATION_STATUSES,
375
+ terminalStatuses: VERIFY_TRANSCRIPT_TERMINAL_STATUSES,
407
376
  now,
408
377
  });
409
378
  }
@@ -0,0 +1,4 @@
1
+ export type CliWriter = Pick<NodeJS.WriteStream, "write"> & {
2
+ isTTY?: boolean;
3
+ columns?: number;
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -9,4 +9,9 @@ export declare function formatRenderLifecycleDuration<TStatus extends string>(op
9
9
  terminalStatuses: readonly TStatus[];
10
10
  now?: number;
11
11
  }): string | undefined;
12
+ export declare function formatRenderLifecycleRowDuration<TStatus extends string>(options: {
13
+ lifecycle: LifecycleExecutionDurationInput<TStatus>;
14
+ terminalStatuses: readonly TStatus[];
15
+ now?: number;
16
+ }): string;
12
17
  export declare function formatDurationLabel(durationMs: number): string | undefined;
@@ -15,6 +15,12 @@ export function formatRenderLifecycleDuration(options) {
15
15
  }
16
16
  return formatDurationLabel(durationMs);
17
17
  }
18
+ export function formatRenderLifecycleRowDuration(options) {
19
+ if (!options.terminalStatuses.includes(options.lifecycle.status)) {
20
+ return "—";
21
+ }
22
+ return formatRenderLifecycleDuration(options) ?? "—";
23
+ }
18
24
  export function formatDurationLabel(durationMs) {
19
25
  if (!Number.isFinite(durationMs) || durationMs < 0) {
20
26
  return undefined;
@@ -0,0 +1,3 @@
1
+ export declare function formatProgressiveRenderErrorDetail(error: unknown): string;
2
+ export declare function parseProgressTimestamp(value?: string): number | undefined;
3
+ export declare function clearRefreshIntervalHandle(refreshInterval?: ReturnType<typeof setInterval>): undefined;
@@ -0,0 +1,44 @@
1
+ export function formatProgressiveRenderErrorDetail(error) {
2
+ if (error instanceof Error) {
3
+ return error.message;
4
+ }
5
+ if (typeof error === "string") {
6
+ return error;
7
+ }
8
+ if (error === null || error === undefined) {
9
+ return "unknown error";
10
+ }
11
+ if (typeof error === "number" ||
12
+ typeof error === "boolean" ||
13
+ typeof error === "bigint") {
14
+ return `${error}`;
15
+ }
16
+ if (typeof error === "symbol") {
17
+ return error.description ?? error.toString();
18
+ }
19
+ if (typeof error === "object") {
20
+ try {
21
+ const serialized = JSON.stringify(error);
22
+ if (serialized) {
23
+ return serialized;
24
+ }
25
+ }
26
+ catch {
27
+ // Ignore serialization errors and fall back.
28
+ }
29
+ }
30
+ return "unknown error";
31
+ }
32
+ export function parseProgressTimestamp(value) {
33
+ if (!value) {
34
+ return undefined;
35
+ }
36
+ const parsed = Date.parse(value);
37
+ return Number.isNaN(parsed) ? undefined : parsed;
38
+ }
39
+ export function clearRefreshIntervalHandle(refreshInterval) {
40
+ if (refreshInterval) {
41
+ clearInterval(refreshInterval);
42
+ }
43
+ return undefined;
44
+ }
@@ -6,5 +6,6 @@ export interface RunDisplayInfo {
6
6
  workspacePath?: string;
7
7
  elapsed?: string;
8
8
  createdAt?: string;
9
+ targetDisplay?: string;
9
10
  }
10
11
  export declare function buildRunMetadataSectionWithStyle(info: RunDisplayInfo, style?: TranscriptShellStyleOptions): string[];
@@ -13,6 +13,7 @@ export function buildRunMetadataSectionWithStyle(info, style = {}) {
13
13
  elapsed: info.elapsed,
14
14
  createdAt: info.createdAt,
15
15
  workspacePath: info.workspacePath,
16
+ targetDisplay: info.targetDisplay,
16
17
  style,
17
18
  });
18
19
  }
@@ -15,7 +15,7 @@ export declare function resolveTranscriptShellStyle(options?: TranscriptShellSty
15
15
  export declare function resolveTranscriptShellStyleFromWriter(writer: TerminalLikeWriter, options?: {
16
16
  forceTty?: boolean;
17
17
  }): TranscriptShellStyleOptions;
18
- export type TranscriptBadgeVariant = "run" | "verify" | "reduce" | "spec" | "message" | "agent";
18
+ export type TranscriptBadgeVariant = "run" | "verify" | "reduce" | "spec" | "message" | "interactive" | "agent";
19
19
  export declare function formatTranscriptBadge(text: string, variant: TranscriptBadgeVariant, style: TranscriptShellStyle): string;
20
20
  export declare function formatTranscriptStatusLabel(status: string, color: TerminalColor, style: TranscriptShellStyle): string;
21
21
  export declare function formatTranscriptErrorLine(message: string, style: TranscriptShellStyle): string;
@@ -49,6 +49,7 @@ export declare function buildStandardSessionShellSection(options: {
49
49
  elapsed?: string;
50
50
  createdAt?: string;
51
51
  workspacePath?: string;
52
+ targetDisplay?: string;
52
53
  style?: TranscriptShellStyleOptions;
53
54
  }): string[];
54
55
  export interface TranscriptStatusTableColumn<Row> {
@@ -21,7 +21,8 @@ const BRAND_COLOR = "164;203;153";
21
21
  const VERIFY_COLOR = "255;238;140";
22
22
  const REDUCE_COLOR = "226;159;115";
23
23
  const SPEC_COLOR = "144;190;228";
24
- const MESSAGE_COLOR = "245;242;235";
24
+ const MESSAGE_COLOR = "252;251;248";
25
+ const INTERACTIVE_COLOR = "219;221;224";
25
26
  const BADGE_STYLES = {
26
27
  run: {
27
28
  foreground: `${ESC}38;2;0;0;0m`,
@@ -48,6 +49,11 @@ const BADGE_STYLES = {
48
49
  background: `${ESC}48;2;${MESSAGE_COLOR}m`,
49
50
  bold: true,
50
51
  },
52
+ interactive: {
53
+ foreground: `${ESC}38;2;0;0;0m`,
54
+ background: `${ESC}48;2;${INTERACTIVE_COLOR}m`,
55
+ bold: true,
56
+ },
51
57
  agent: {
52
58
  bold: true,
53
59
  },
@@ -129,15 +135,22 @@ export function buildTranscriptShellSection(options) {
129
135
  return lines;
130
136
  }
131
137
  export function buildStandardSessionShellSection(options) {
138
+ const detailRows = buildStandardSessionDetailRows({
139
+ elapsed: options.elapsed,
140
+ createdAt: options.createdAt,
141
+ workspacePath: options.workspacePath,
142
+ });
143
+ if (options.targetDisplay) {
144
+ detailRows.push({
145
+ label: "Target",
146
+ value: options.targetDisplay,
147
+ });
148
+ }
132
149
  return buildTranscriptShellSection({
133
150
  badgeText: options.badgeText,
134
151
  badgeVariant: options.badgeVariant,
135
152
  status: options.status,
136
- detailRows: buildStandardSessionDetailRows({
137
- elapsed: options.elapsed,
138
- createdAt: options.createdAt,
139
- workspacePath: options.workspacePath,
140
- }),
153
+ detailRows,
141
154
  style: options.style,
142
155
  });
143
156
  }
@@ -3,6 +3,8 @@
3
3
  * Trims surrounding whitespace and guards against oversized strings.
4
4
  */
5
5
  export declare function normalizeDiffStatistics(value?: string | null): string | undefined;
6
+ declare function extractStat(pattern: RegExp, input: string): number | undefined;
7
+ export { extractStat };
6
8
  /**
7
9
  * Produce a compact representation such as `3f +12/-2` for the CHANGES column.
8
10
  */
@@ -27,6 +27,7 @@ function extractStat(pattern, input) {
27
27
  const parsed = Number.parseInt(match[1], 10);
28
28
  return Number.isNaN(parsed) ? undefined : parsed;
29
29
  }
30
+ export { extractStat };
30
31
  /**
31
32
  * Produce a compact representation such as `3f +12/-2` for the CHANGES column.
32
33
  */
@@ -1,7 +1,8 @@
1
1
  export type GitRepositoryErrorReason = "no_repository" | "not_repository_root";
2
2
  export declare class GitRepositoryError extends Error {
3
3
  readonly reason: GitRepositoryErrorReason;
4
- constructor(message: string, reason: GitRepositoryErrorReason);
4
+ readonly repositoryRoot?: string;
5
+ constructor(message: string, reason: GitRepositoryErrorReason, repositoryRoot?: string);
5
6
  }
6
7
  export declare class ValidationError extends Error {
7
8
  constructor(message: string);
@@ -1,9 +1,11 @@
1
1
  export class GitRepositoryError extends Error {
2
2
  reason;
3
- constructor(message, reason) {
3
+ repositoryRoot;
4
+ constructor(message, reason, repositoryRoot) {
4
5
  super(message);
5
6
  this.name = "GitRepositoryError";
6
7
  this.reason = reason;
8
+ this.repositoryRoot = repositoryRoot;
7
9
  }
8
10
  }
9
11
  export class ValidationError extends Error {
@@ -31,7 +31,7 @@ export declare function removeWorktree(options: {
31
31
  root: string;
32
32
  worktreePath: string;
33
33
  }): Promise<void>;
34
- export declare function gitAddAll(cwd: string): Promise<void>;
34
+ export declare function gitAddAll(cwd: string, excludedPaths?: readonly string[]): Promise<void>;
35
35
  export declare function gitHasStagedChanges(cwd: string): Promise<boolean>;
36
36
  export interface GitCommitOptions {
37
37
  cwd: string;