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
@@ -1,20 +1,21 @@
1
+ import { readInteractiveRecords, } from "../../domain/interactive/persistence/adapter.js";
1
2
  import { readMessageRecords, } from "../../domain/message/persistence/adapter.js";
2
3
  import { readReductionRecords, } from "../../domain/reduce/persistence/adapter.js";
3
4
  import { readRunRecords, } from "../../domain/run/persistence/adapter.js";
4
5
  import { readSpecRecords, } from "../../domain/spec/persistence/adapter.js";
5
6
  import { TERMINAL_VERIFICATION_STATUSES } from "../../domain/verify/model/types.js";
6
7
  import { readVerificationRecords, } from "../../domain/verify/persistence/adapter.js";
7
- import { renderListTableTranscript, renderMessageList, renderReduceList, renderRunList, renderSpecList, renderVerifyList, } from "../../render/transcripts/list.js";
8
+ import { renderInteractiveTranscript } from "../../render/transcripts/interactive.js";
9
+ import { renderInteractiveListTable, renderListTableTranscript, renderMessageListTable, renderReduceListTable, renderRunListTable, renderSpecListTable, renderVerifyListTable, } from "../../render/transcripts/list.js";
8
10
  import { formatMessageElapsed, formatMessageRecipientDuration, renderMessageTranscript, } from "../../render/transcripts/message.js";
9
11
  import { formatReduceElapsed, formatReducerDuration, renderReduceTranscript, } from "../../render/transcripts/reduce.js";
10
- import { formatRunElapsed, renderRunTranscript, } from "../../render/transcripts/run.js";
12
+ import { renderRunTranscript } from "../../render/transcripts/run.js";
11
13
  import { formatSpecAgentDuration, formatSpecElapsed, renderSpecTranscript, } from "../../render/transcripts/spec.js";
12
14
  import { formatVerifyElapsed, renderVerifyTranscript, } from "../../render/transcripts/verify.js";
13
- import { formatAgentDuration } from "../../render/utils/agents.js";
14
- import { formatRenderLifecycleDuration } from "../../render/utils/duration.js";
15
- import { formatCompactDiffStatistics } from "../../utils/diff.js";
15
+ import { formatRenderLifecycleDuration, formatRenderLifecycleRowDuration, } from "../../render/utils/duration.js";
16
16
  import { pathExists } from "../../utils/fs.js";
17
- import { getMessageSessionDirectoryPath, getReductionSessionDirectoryPath, getRunDirectoryPath, getSpecSessionDirectoryPath, getVerificationSessionDirectoryPath, } from "../../workspace/structure.js";
17
+ import { formatTargetDisplay, formatTargetTablePreview, normalizeListDetailSession, normalizeListSession, toListJsonTargetRef, } from "./normalization.js";
18
+ import { getListRecordId } from "./records.js";
18
19
  const DEFAULT_LIMIT = 10;
19
20
  const DASH = "—";
20
21
  export async function executeListCommand(input) {
@@ -30,21 +31,22 @@ export async function executeListCommand(input) {
30
31
  }
31
32
  async function executeTableMode(input) {
32
33
  const { operator, limit, verbose = false } = input;
33
- const query = await readOperatorRecords({ ...input, limit: undefined });
34
- const filtered = verbose
35
- ? query.records
36
- : query.records.filter((record) => shouldIncludeInDefaultTable(operator, getRecordStatus(record)));
37
- const records = filtered.slice(0, limit);
34
+ const predicate = verbose
35
+ ? undefined
36
+ : (record) => shouldIncludeInDefaultTable(operator, getRecordStatus(record));
37
+ const query = await readOperatorRecords({ ...input, limit, predicate });
38
+ const records = query.records;
39
+ const sessions = records.map((record) => normalizeListSession(operator, record));
38
40
  const warnings = query.warnings;
39
- const output = renderTableOutput(operator, records);
41
+ const output = renderTableOutput(operator, records, sessions);
40
42
  return {
41
43
  warnings,
42
44
  output,
43
45
  mode: "table",
44
46
  json: {
45
47
  operator,
46
- mode: "table",
47
- records: records.map((record) => toJsonTableRecord(operator, record)),
48
+ mode: "list",
49
+ sessions: sessions.map(toJsonSummarySession),
48
50
  warnings,
49
51
  },
50
52
  };
@@ -70,74 +72,117 @@ async function executeDetailMode(input) {
70
72
  json: {
71
73
  operator,
72
74
  mode: "detail",
73
- sessionId,
74
75
  session: null,
75
76
  warnings,
76
77
  },
77
78
  };
78
79
  }
80
+ const detailSession = normalizeListDetailSession(operator, record);
79
81
  return {
80
82
  warnings,
81
- output: renderDetailOutput(operator, record),
83
+ output: renderDetailOutput(operator, detailSession),
82
84
  mode: "detail",
83
85
  json: {
84
86
  operator,
85
87
  mode: "detail",
86
- sessionId,
87
- session: toJsonDetailSession(operator, record),
88
+ session: toJsonDetailSession(detailSession),
88
89
  warnings,
89
90
  },
90
91
  };
91
92
  }
92
- function renderTableOutput(operator, records) {
93
+ function renderTableOutput(operator, records, sessions) {
93
94
  if (records.length === 0) {
94
95
  return undefined;
95
96
  }
96
97
  const table = operator === "run"
97
- ? renderRunList(records)
98
+ ? renderRunListTable(sessions.map((session) => ({
99
+ id: session.sessionId,
100
+ target: session.target
101
+ ? formatTargetTablePreview(session.target)
102
+ : DASH,
103
+ status: session.status,
104
+ createdAt: session.createdAt,
105
+ })))
98
106
  : operator === "spec"
99
- ? renderSpecList(records)
107
+ ? renderSpecListTable(sessions.map((session) => {
108
+ return {
109
+ id: session.sessionId,
110
+ description: session.description ?? null,
111
+ status: session.status,
112
+ createdAt: session.createdAt,
113
+ };
114
+ }))
100
115
  : operator === "message"
101
- ? renderMessageList(records)
102
- : operator === "reduce"
103
- ? renderReduceList(records)
104
- : renderVerifyList(records);
116
+ ? renderMessageListTable(sessions.map((session) => ({
117
+ id: session.sessionId,
118
+ target: session.target
119
+ ? formatTargetTablePreview(session.target)
120
+ : DASH,
121
+ status: session.status,
122
+ createdAt: session.createdAt,
123
+ })))
124
+ : operator === "interactive"
125
+ ? renderInteractiveListTable(sessions.map((session) => ({
126
+ id: session.sessionId,
127
+ status: session.status,
128
+ createdAt: session.createdAt,
129
+ })))
130
+ : operator === "reduce"
131
+ ? renderReduceListTable(sessions.map((session) => ({
132
+ id: session.sessionId,
133
+ target: session.target
134
+ ? formatTargetTablePreview(session.target)
135
+ : DASH,
136
+ status: session.status,
137
+ createdAt: session.createdAt,
138
+ })))
139
+ : renderVerifyListTable(sessions.map((session) => ({
140
+ id: session.sessionId,
141
+ target: session.target
142
+ ? formatTargetTablePreview(session.target)
143
+ : DASH,
144
+ status: session.status,
145
+ createdAt: session.createdAt,
146
+ })));
105
147
  return renderListTableTranscript(table);
106
148
  }
107
- function renderDetailOutput(operator, record) {
149
+ function renderDetailOutput(operator, session) {
108
150
  if (operator === "run") {
109
- const runRecord = record;
110
151
  return renderRunTranscript({
111
- runId: runRecord.runId,
112
- status: runRecord.status,
113
- workspacePath: getRunDirectoryPath(runRecord.runId),
114
- createdAt: runRecord.createdAt,
115
- startedAt: runRecord.startedAt,
116
- completedAt: runRecord.completedAt,
117
- agents: runRecord.agents.map((agent) => ({
118
- agentId: agent.agentId,
152
+ runId: session.sessionId,
153
+ status: session.status,
154
+ workspacePath: session.workspacePath,
155
+ createdAt: session.createdAt,
156
+ startedAt: session.startedAt,
157
+ completedAt: session.completedAt,
158
+ targetDisplay: session.target
159
+ ? formatTargetDisplay(session.target)
160
+ : undefined,
161
+ agents: session.agents.map((agent) => ({
162
+ agentId: agent.agentId ?? DASH,
119
163
  status: agent.status,
120
164
  startedAt: agent.startedAt,
121
165
  completedAt: agent.completedAt,
122
166
  diffStatistics: agent.diffStatistics,
167
+ outputPath: agent.outputPath,
168
+ errorLine: agent.errorLine,
123
169
  })),
124
170
  isTty: process.stdout.isTTY,
125
171
  });
126
172
  }
127
173
  if (operator === "spec") {
128
- const specRecord = record;
129
174
  return renderSpecTranscript({
130
- sessionId: specRecord.sessionId,
131
- createdAt: specRecord.createdAt,
175
+ sessionId: session.sessionId,
176
+ createdAt: session.createdAt,
132
177
  elapsed: formatSpecElapsed({
133
- status: specRecord.status,
134
- startedAt: specRecord.startedAt,
135
- completedAt: specRecord.completedAt,
178
+ status: session.status,
179
+ startedAt: session.startedAt,
180
+ completedAt: session.completedAt,
136
181
  }) ?? DASH,
137
- workspacePath: getSpecSessionDirectoryPath(specRecord.sessionId),
138
- status: specRecord.status,
139
- agents: specRecord.agents.map((agent) => ({
140
- agentId: agent.agentId,
182
+ workspacePath: session.workspacePath,
183
+ status: session.status,
184
+ agents: session.agents.map((agent) => ({
185
+ agentId: agent.agentId ?? DASH,
141
186
  status: agent.status,
142
187
  duration: formatSpecAgentDuration({
143
188
  status: agent.status,
@@ -146,346 +191,155 @@ function renderDetailOutput(operator, record) {
146
191
  }),
147
192
  outputPath: agent.outputPath,
148
193
  dataPath: agent.dataPath,
149
- errorLine: agent.error ?? undefined,
194
+ errorLine: agent.errorLine,
150
195
  })),
151
196
  isTty: process.stdout.isTTY,
152
197
  }, { suppressHint: true });
153
198
  }
154
199
  if (operator === "reduce") {
155
- const reductionRecord = record;
156
200
  return renderReduceTranscript({
157
- reductionId: reductionRecord.sessionId,
158
- createdAt: reductionRecord.createdAt,
201
+ reductionId: session.sessionId,
202
+ createdAt: session.createdAt,
159
203
  elapsed: formatReduceElapsed({
160
- status: reductionRecord.status,
161
- startedAt: reductionRecord.startedAt,
162
- completedAt: reductionRecord.completedAt,
204
+ status: session.status,
205
+ startedAt: session.startedAt,
206
+ completedAt: session.completedAt,
163
207
  }) ?? DASH,
164
- workspacePath: getReductionSessionDirectoryPath(reductionRecord.sessionId),
165
- status: reductionRecord.status,
166
- reducers: reductionRecord.reducers.map((reducer) => ({
167
- reducerAgentId: reducer.agentId,
168
- status: reducer.status,
208
+ workspacePath: session.workspacePath,
209
+ status: session.status,
210
+ targetDisplay: session.target
211
+ ? formatTargetDisplay(session.target)
212
+ : undefined,
213
+ reducers: session.agents.map((agent) => ({
214
+ reducerAgentId: agent.agentId ?? DASH,
215
+ status: agent.status,
169
216
  duration: formatReducerDuration({
170
- status: reducer.status,
171
- startedAt: reducer.startedAt,
172
- completedAt: reducer.completedAt,
217
+ status: agent.status,
218
+ startedAt: agent.startedAt,
219
+ completedAt: agent.completedAt,
173
220
  }),
174
- outputPath: reducer.outputPath,
175
- dataPath: reducer.dataPath,
176
- errorLine: reducer.error ?? undefined,
221
+ outputPath: agent.outputPath,
222
+ dataPath: agent.dataPath,
223
+ errorLine: agent.errorLine,
177
224
  })),
178
225
  suppressHint: true,
179
226
  isTty: process.stdout.isTTY,
180
227
  });
181
228
  }
182
229
  if (operator === "message") {
183
- const messageRecord = record;
184
230
  return renderMessageTranscript({
185
- messageId: messageRecord.sessionId,
186
- createdAt: messageRecord.createdAt,
231
+ messageId: session.sessionId,
232
+ createdAt: session.createdAt,
187
233
  elapsed: formatMessageElapsed({
188
- status: messageRecord.status,
189
- startedAt: messageRecord.startedAt,
190
- completedAt: messageRecord.completedAt,
234
+ status: session.status,
235
+ startedAt: session.startedAt,
236
+ completedAt: session.completedAt,
191
237
  }) ?? DASH,
192
- workspacePath: getMessageSessionDirectoryPath(messageRecord.sessionId),
193
- status: messageRecord.status,
194
- recipients: messageRecord.recipients.map((recipient) => ({
195
- agentId: recipient.agentId,
196
- status: recipient.status,
238
+ workspacePath: session.workspacePath,
239
+ status: session.status,
240
+ targetDisplay: session.target
241
+ ? formatTargetDisplay(session.target)
242
+ : undefined,
243
+ recipients: session.agents.map((agent) => ({
244
+ agentId: agent.agentId ?? DASH,
245
+ status: agent.status,
197
246
  duration: formatMessageRecipientDuration({
198
- status: recipient.status,
199
- startedAt: recipient.startedAt,
200
- completedAt: recipient.completedAt,
201
- }) ?? DASH,
202
- outputPath: recipient.outputPath,
203
- errorLine: recipient.error ?? undefined,
247
+ status: agent.status,
248
+ startedAt: agent.startedAt,
249
+ completedAt: agent.completedAt,
250
+ }),
251
+ outputPath: agent.outputPath,
252
+ errorLine: agent.errorLine,
204
253
  })),
205
254
  isTty: process.stdout.isTTY,
206
255
  });
207
256
  }
208
- const verificationRecord = record;
257
+ if (operator === "interactive") {
258
+ const interactiveAgent = session.agents[0];
259
+ return renderInteractiveTranscript({
260
+ sessionId: session.sessionId,
261
+ createdAt: session.createdAt,
262
+ elapsed: formatInteractiveElapsed({
263
+ status: session.status,
264
+ startedAt: session.startedAt,
265
+ completedAt: session.completedAt,
266
+ }) ?? DASH,
267
+ workspacePath: session.workspacePath,
268
+ status: session.status,
269
+ agents: [
270
+ {
271
+ agentId: interactiveAgent?.agentId ?? DASH,
272
+ status: interactiveAgent?.status ??
273
+ "failed",
274
+ duration: formatInteractiveAgentDuration(interactiveAgent),
275
+ outputPath: interactiveAgent?.outputPath,
276
+ },
277
+ ],
278
+ isTty: process.stdout.isTTY,
279
+ });
280
+ }
209
281
  return renderVerifyTranscript({
210
- verificationId: verificationRecord.sessionId,
211
- createdAt: verificationRecord.createdAt,
282
+ verificationId: session.sessionId,
283
+ createdAt: session.createdAt,
212
284
  elapsed: formatVerifyElapsed({
213
- status: verificationRecord.status,
214
- startedAt: verificationRecord.startedAt,
215
- completedAt: verificationRecord.completedAt,
285
+ status: session.status,
286
+ startedAt: session.startedAt,
287
+ completedAt: session.completedAt,
216
288
  }) ?? DASH,
217
- workspacePath: getVerificationSessionDirectoryPath(verificationRecord.sessionId),
218
- target: verificationRecord.target,
219
- status: verificationRecord.status,
220
- methods: verificationRecord.methods.map((method) => ({
221
- verifierLabel: method.method === "programmatic"
222
- ? "programmatic"
223
- : (method.template ?? "rubric"),
224
- agentLabel: method.verifierId,
225
- status: method.status,
226
- duration: formatVerifyMethodDuration(method),
227
- artifactPath: method.artifactPath,
228
- errorLine: method.error ?? undefined,
289
+ workspacePath: session.workspacePath,
290
+ targetDisplay: session.target
291
+ ? formatTargetDisplay(session.target)
292
+ : undefined,
293
+ status: session.status,
294
+ methods: session.agents.map((agent) => ({
295
+ verifierLabel: agent.verifier ?? "rubric",
296
+ agentLabel: agent.agentId ?? undefined,
297
+ status: agent.status,
298
+ duration: formatVerifyAgentDuration(agent),
299
+ artifactPath: agent.outputPath,
300
+ errorLine: agent.errorLine,
229
301
  })),
230
302
  suppressHint: true,
231
303
  isTty: process.stdout.isTTY,
232
304
  });
233
305
  }
234
- function toJsonTableRecord(operator, record) {
235
- if (operator === "run") {
236
- const runRecord = record;
237
- return {
238
- id: runRecord.runId,
239
- status: runRecord.status,
240
- createdAt: runRecord.createdAt,
241
- specPath: runRecord.spec.path,
242
- };
243
- }
244
- if (operator === "spec") {
245
- const specRecord = record;
246
- return {
247
- id: specRecord.sessionId,
248
- status: specRecord.status,
249
- createdAt: specRecord.createdAt,
250
- description: normalizeDescription(specRecord.description),
251
- };
252
- }
253
- if (operator === "reduce") {
254
- const reductionRecord = record;
255
- return {
256
- id: reductionRecord.sessionId,
257
- status: reductionRecord.status,
258
- createdAt: reductionRecord.createdAt,
259
- target: {
260
- kind: reductionRecord.target.type,
261
- id: reductionRecord.target.id,
262
- },
263
- };
264
- }
265
- if (operator === "message") {
266
- const messageRecord = record;
267
- return {
268
- id: messageRecord.sessionId,
269
- status: messageRecord.status,
270
- createdAt: messageRecord.createdAt,
271
- promptPreview: normalizePreviewText(messageRecord.prompt),
272
- };
273
- }
274
- const verificationRecord = record;
275
- return {
276
- id: verificationRecord.sessionId,
277
- status: verificationRecord.status,
278
- createdAt: verificationRecord.createdAt,
279
- target: {
280
- kind: verificationRecord.target.kind,
281
- id: verificationRecord.target.sessionId,
282
- },
283
- };
284
- }
285
- function toJsonDetailSession(operator, record) {
286
- if (operator === "run") {
287
- const runRecord = record;
288
- return {
289
- id: runRecord.runId,
290
- status: runRecord.status,
291
- createdAt: runRecord.createdAt,
292
- elapsed: formatRunRecordElapsed(runRecord),
293
- workspacePath: getRunDirectoryPath(runRecord.runId),
294
- rows: runRecord.agents.map(toRunJsonRow),
295
- artifacts: [],
296
- };
297
- }
298
- if (operator === "spec") {
299
- const specRecord = record;
300
- return {
301
- id: specRecord.sessionId,
302
- status: specRecord.status,
303
- createdAt: specRecord.createdAt,
304
- elapsed: formatSpecRecordElapsed(specRecord),
305
- workspacePath: getSpecSessionDirectoryPath(specRecord.sessionId),
306
- rows: specRecord.agents.map(toSpecJsonRow),
307
- artifacts: specRecord.agents.map(toSpecArtifact),
308
- };
309
- }
310
- if (operator === "reduce") {
311
- const reductionRecord = record;
312
- return {
313
- id: reductionRecord.sessionId,
314
- status: reductionRecord.status,
315
- createdAt: reductionRecord.createdAt,
316
- elapsed: formatReductionRecordElapsed(reductionRecord),
317
- workspacePath: getReductionSessionDirectoryPath(reductionRecord.sessionId),
318
- target: {
319
- kind: reductionRecord.target.type,
320
- id: reductionRecord.target.id,
321
- },
322
- rows: reductionRecord.reducers.map(toReductionJsonRow),
323
- artifacts: reductionRecord.reducers.map(toReductionArtifact),
324
- };
325
- }
326
- if (operator === "message") {
327
- const messageRecord = record;
328
- return {
329
- id: messageRecord.sessionId,
330
- status: messageRecord.status,
331
- createdAt: messageRecord.createdAt,
332
- elapsed: formatMessageRecordElapsed(messageRecord),
333
- workspacePath: getMessageSessionDirectoryPath(messageRecord.sessionId),
334
- rows: messageRecord.recipients.map(toMessageJsonRow),
335
- artifacts: messageRecord.recipients.flatMap(toMessageArtifacts),
336
- };
337
- }
338
- const verificationRecord = record;
306
+ function toJsonSummarySession(session) {
339
307
  return {
340
- id: verificationRecord.sessionId,
341
- status: verificationRecord.status,
342
- createdAt: verificationRecord.createdAt,
343
- elapsed: formatVerificationRecordElapsed(verificationRecord),
344
- workspacePath: getVerificationSessionDirectoryPath(verificationRecord.sessionId),
345
- target: {
346
- kind: verificationRecord.target.kind,
347
- id: verificationRecord.target.sessionId,
348
- },
349
- rows: verificationRecord.methods.map(toVerificationJsonRow),
350
- artifacts: verificationRecord.methods.map(toVerificationArtifact),
308
+ operator: session.operator,
309
+ sessionId: session.sessionId,
310
+ status: session.status,
311
+ createdAt: session.createdAt,
312
+ ...(session.target ? { target: toListJsonTargetRef(session.target) } : {}),
313
+ ...(session.description !== undefined
314
+ ? { description: session.description }
315
+ : {}),
351
316
  };
352
317
  }
353
- function formatRunRecordElapsed(record) {
354
- return formatRunElapsed({
355
- status: record.status,
356
- startedAt: record.startedAt,
357
- completedAt: record.completedAt,
358
- });
359
- }
360
- function formatSpecRecordElapsed(record) {
361
- return formatSpecElapsed({
362
- status: record.status,
363
- startedAt: record.startedAt,
364
- completedAt: record.completedAt,
365
- });
366
- }
367
- function formatReductionRecordElapsed(record) {
368
- return formatReduceElapsed({
369
- status: record.status,
370
- startedAt: record.startedAt,
371
- completedAt: record.completedAt,
372
- });
373
- }
374
- function formatMessageRecordElapsed(record) {
375
- return formatMessageElapsed({
376
- status: record.status,
377
- startedAt: record.startedAt,
378
- completedAt: record.completedAt,
379
- });
380
- }
381
- function normalizePreviewText(value) {
382
- if (!value) {
383
- return null;
384
- }
385
- const normalized = value.replace(/\s+/gu, " ").trim();
386
- return normalized.length > 0 ? normalized : null;
387
- }
388
- function formatVerificationRecordElapsed(record) {
389
- return formatVerifyElapsed({
390
- status: record.status,
391
- startedAt: record.startedAt,
392
- completedAt: record.completedAt,
393
- });
394
- }
395
- function formatRunRowDuration(agent) {
396
- return agent.status === "running"
397
- ? DASH
398
- : (formatAgentDuration(agent) ?? DASH);
399
- }
400
- function toRunJsonRow(agent) {
318
+ function toJsonDetailSession(session) {
401
319
  return {
402
- agentId: agent.agentId,
403
- status: agent.status,
404
- duration: formatRunRowDuration(agent),
405
- changes: formatCompactDiffStatistics(agent.diffStatistics) ?? null,
320
+ operator: session.operator,
321
+ sessionId: session.sessionId,
322
+ status: session.status,
323
+ createdAt: session.createdAt,
324
+ ...(session.startedAt ? { startedAt: session.startedAt } : {}),
325
+ ...(session.completedAt ? { completedAt: session.completedAt } : {}),
326
+ workspacePath: session.workspacePath,
327
+ ...(session.target ? { target: toListJsonTargetRef(session.target) } : {}),
328
+ ...(session.description !== undefined
329
+ ? { description: session.description }
330
+ : {}),
331
+ agents: session.agents.map(toJsonAgent),
406
332
  };
407
333
  }
408
- function formatSpecRowDuration(agent) {
409
- return (formatSpecAgentDuration({
410
- status: agent.status,
411
- startedAt: agent.startedAt,
412
- completedAt: agent.completedAt,
413
- }) ?? DASH);
414
- }
415
- function toSpecJsonRow(agent) {
334
+ function toJsonAgent(agent) {
416
335
  return {
417
336
  agentId: agent.agentId,
418
337
  status: agent.status,
419
- duration: formatSpecRowDuration(agent),
420
- };
421
- }
422
- function toSpecArtifact(agent) {
423
- return {
424
- kind: "spec",
425
- agentId: agent.agentId,
426
- path: agent.outputPath ?? null,
427
- };
428
- }
429
- function formatReductionRowDuration(reducer) {
430
- return (formatReducerDuration({
431
- status: reducer.status,
432
- startedAt: reducer.startedAt,
433
- completedAt: reducer.completedAt,
434
- }) ?? DASH);
435
- }
436
- function toReductionJsonRow(reducer) {
437
- return {
438
- agentId: reducer.agentId,
439
- status: reducer.status,
440
- duration: formatReductionRowDuration(reducer),
441
- };
442
- }
443
- function toReductionArtifact(reducer) {
444
- return {
445
- kind: "reduction",
446
- agentId: reducer.agentId,
447
- path: reducer.outputPath ?? null,
448
- };
449
- }
450
- function toMessageJsonRow(recipient) {
451
- return {
452
- agentId: recipient.agentId,
453
- status: recipient.status,
454
- duration: formatMessageRecipientDuration({
455
- status: recipient.status,
456
- startedAt: recipient.startedAt,
457
- completedAt: recipient.completedAt,
458
- }) ?? DASH,
459
- };
460
- }
461
- function toMessageArtifacts(recipient) {
462
- return [
463
- {
464
- kind: "output",
465
- agentId: recipient.agentId,
466
- path: recipient.outputPath ?? null,
467
- },
468
- ];
469
- }
470
- function getVerificationMethodLabel(method) {
471
- return method.method === "programmatic"
472
- ? "programmatic"
473
- : (method.template ?? "rubric");
474
- }
475
- function toVerificationJsonRow(method) {
476
- return {
477
- agentId: method.verifierId ?? null,
478
- verifier: getVerificationMethodLabel(method),
479
- status: method.status,
480
- duration: formatVerifyMethodDuration(method),
481
- };
482
- }
483
- function toVerificationArtifact(method) {
484
- return {
485
- kind: "result",
486
- agentId: method.verifierId ?? null,
487
- verifier: getVerificationMethodLabel(method),
488
- path: method.artifactPath ?? null,
338
+ ...(agent.startedAt ? { startedAt: agent.startedAt } : {}),
339
+ ...(agent.completedAt ? { completedAt: agent.completedAt } : {}),
340
+ ...(agent.verifier ? { verifier: agent.verifier } : {}),
341
+ ...(agent.changes ? { changes: agent.changes } : {}),
342
+ artifacts: agent.artifacts,
489
343
  };
490
344
  }
491
345
  function shouldIncludeInDefaultTable(operator, status) {
@@ -567,6 +421,23 @@ async function readOperatorRecords(input) {
567
421
  warnings: warnings.map(formatSessionWarning),
568
422
  };
569
423
  }
424
+ if (operator === "interactive") {
425
+ if (!(await pathExists(input.interactiveFilePath))) {
426
+ return { records: [], warnings: [] };
427
+ }
428
+ const warnings = [];
429
+ const records = await readInteractiveRecords({
430
+ root,
431
+ interactiveFilePath: input.interactiveFilePath,
432
+ limit: input.limit,
433
+ predicate: input.predicate,
434
+ onWarning: (warning) => warnings.push(warning),
435
+ });
436
+ return {
437
+ records,
438
+ warnings: warnings.map(formatSessionWarning),
439
+ };
440
+ }
570
441
  if (!(await pathExists(input.verificationsFilePath))) {
571
442
  return { records: [], warnings: [] };
572
443
  }
@@ -590,28 +461,37 @@ function getRecordStatus(record) {
590
461
  return record.status;
591
462
  }
592
463
  function getRecordId(operator, record) {
593
- if (operator === "run") {
594
- return record.runId;
595
- }
596
- return record.sessionId;
464
+ return getListRecordId(operator, record);
597
465
  }
598
466
  function formatSessionWarning(warning) {
599
467
  return `Ignoring corrupt session ${warning.displayPath}`;
600
468
  }
601
- function normalizeDescription(value) {
602
- if (!value) {
603
- return null;
604
- }
605
- const normalized = value.replace(/\s+/g, " ").trim();
606
- return normalized.length > 0 ? normalized : null;
607
- }
608
- function formatVerifyMethodDuration(method) {
609
- return (formatRenderLifecycleDuration({
469
+ function formatVerifyAgentDuration(agent) {
470
+ return formatRenderLifecycleRowDuration({
610
471
  lifecycle: {
611
- status: method.status,
612
- startedAt: method.startedAt,
613
- completedAt: method.completedAt,
472
+ status: agent.status,
473
+ startedAt: agent.startedAt,
474
+ completedAt: agent.completedAt,
614
475
  },
615
476
  terminalStatuses: TERMINAL_VERIFICATION_STATUSES,
616
- }) ?? DASH);
477
+ });
478
+ }
479
+ function formatInteractiveElapsed(input) {
480
+ return formatRenderLifecycleDuration({
481
+ lifecycle: input,
482
+ terminalStatuses: ["succeeded", "failed"],
483
+ });
484
+ }
485
+ function formatInteractiveAgentDuration(agent) {
486
+ if (!agent) {
487
+ return DASH;
488
+ }
489
+ return formatRenderLifecycleRowDuration({
490
+ lifecycle: {
491
+ status: agent.status,
492
+ startedAt: agent.startedAt,
493
+ completedAt: agent.completedAt,
494
+ },
495
+ terminalStatuses: ["succeeded", "failed"],
496
+ });
617
497
  }