voratiq 0.1.0-beta.21 → 0.1.0-beta.22

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 (149) hide show
  1. package/README.md +18 -22
  2. package/dist/agents/launch/chat.d.ts +3 -1
  3. package/dist/agents/launch/chat.js +2 -0
  4. package/dist/bin.js +28 -7
  5. package/dist/cli/auto.js +1 -0
  6. package/dist/cli/contract.d.ts +26 -17
  7. package/dist/cli/contract.js +3 -1
  8. package/dist/cli/doctor.d.ts +12 -0
  9. package/dist/cli/doctor.js +115 -0
  10. package/dist/cli/list.js +4 -1
  11. package/dist/cli/operator-envelope.d.ts +19 -6
  12. package/dist/cli/operator-envelope.js +61 -1
  13. package/dist/cli/run.js +2 -0
  14. package/dist/cli/verify.d.ts +1 -1
  15. package/dist/cli/verify.js +48 -9
  16. package/dist/commands/auto/command.d.ts +1 -0
  17. package/dist/commands/auto/command.js +22 -12
  18. package/dist/commands/auto/errors.js +1 -1
  19. package/dist/commands/doctor/agents.d.ts +5 -0
  20. package/dist/commands/{init → doctor}/agents.js +37 -19
  21. package/dist/commands/doctor/command.d.ts +22 -0
  22. package/dist/commands/doctor/command.js +99 -0
  23. package/dist/commands/doctor/environment.d.ts +2 -0
  24. package/dist/commands/{init → doctor}/environment.js +38 -6
  25. package/dist/commands/{init/types.d.ts → doctor/fix-types.d.ts} +30 -9
  26. package/dist/commands/doctor/fix.d.ts +2 -0
  27. package/dist/commands/{init/command.js → doctor/fix.js} +106 -10
  28. package/dist/commands/doctor/reconcile.d.ts +2 -0
  29. package/dist/commands/doctor/reconcile.js +101 -0
  30. package/dist/commands/interactive/lifecycle.d.ts +2 -0
  31. package/dist/commands/interactive/lifecycle.js +8 -0
  32. package/dist/commands/list/command.d.ts +1 -0
  33. package/dist/commands/list/command.js +211 -352
  34. package/dist/commands/list/normalization.d.ts +56 -0
  35. package/dist/commands/list/normalization.js +317 -0
  36. package/dist/commands/message/command.d.ts +2 -1
  37. package/dist/commands/message/command.js +35 -14
  38. package/dist/commands/message/errors.d.ts +12 -3
  39. package/dist/commands/message/errors.js +19 -3
  40. package/dist/commands/reduce/command.js +16 -17
  41. package/dist/commands/reduce/errors.d.ts +2 -2
  42. package/dist/commands/reduce/errors.js +3 -3
  43. package/dist/commands/reduce/targets.js +11 -2
  44. package/dist/commands/root-launcher/command.js +12 -6
  45. package/dist/commands/run/command.d.ts +1 -0
  46. package/dist/commands/run/command.js +4 -1
  47. package/dist/commands/run/record-init.d.ts +2 -0
  48. package/dist/commands/run/record-init.js +2 -1
  49. package/dist/commands/run/spec-provenance.d.ts +37 -0
  50. package/dist/commands/run/spec-provenance.js +384 -0
  51. package/dist/commands/run/validation.d.ts +4 -0
  52. package/dist/commands/run/validation.js +25 -62
  53. package/dist/commands/spec/command.js +19 -6
  54. package/dist/commands/spec/errors.d.ts +5 -0
  55. package/dist/commands/spec/errors.js +9 -0
  56. package/dist/commands/verify/agents.d.ts +4 -2
  57. package/dist/commands/verify/agents.js +4 -11
  58. package/dist/commands/verify/command.js +15 -5
  59. package/dist/commands/verify/errors.d.ts +12 -0
  60. package/dist/commands/verify/errors.js +22 -0
  61. package/dist/commands/verify/targets.js +108 -12
  62. package/dist/competition/shared/preflight.d.ts +1 -1
  63. package/dist/competition/shared/preflight.js +15 -2
  64. package/dist/contracts/list.d.ts +129 -149
  65. package/dist/contracts/list.js +47 -99
  66. package/dist/domain/interactive/persistence/adapter.d.ts +23 -0
  67. package/dist/domain/interactive/persistence/adapter.js +42 -0
  68. package/dist/domain/message/model/types.d.ts +32 -0
  69. package/dist/domain/message/model/types.js +25 -0
  70. package/dist/domain/reduce/competition/adapter.js +21 -7
  71. package/dist/domain/reduce/competition/finalize.d.ts +7 -0
  72. package/dist/domain/reduce/competition/finalize.js +19 -0
  73. package/dist/domain/reduce/model/types.d.ts +3 -3
  74. package/dist/domain/run/competition/agents/artifacts.js +4 -2
  75. package/dist/domain/run/competition/errors.d.ts +1 -1
  76. package/dist/domain/run/competition/errors.js +4 -7
  77. package/dist/domain/run/model/types.d.ts +384 -0
  78. package/dist/domain/run/model/types.js +87 -0
  79. package/dist/domain/spec/competition/adapter.d.ts +1 -0
  80. package/dist/domain/spec/competition/adapter.js +6 -1
  81. package/dist/domain/spec/model/types.d.ts +3 -0
  82. package/dist/domain/spec/model/types.js +5 -0
  83. package/dist/domain/verify/competition/finalize.d.ts +9 -0
  84. package/dist/domain/verify/competition/finalize.js +22 -3
  85. package/dist/domain/verify/model/types.d.ts +2 -2
  86. package/dist/interactive/providers/mcp.d.ts +1 -0
  87. package/dist/interactive/providers/mcp.js +45 -7
  88. package/dist/interactive/substrate.js +20 -3
  89. package/dist/mcp/server.js +26 -9
  90. package/dist/policy/verification.js +18 -1
  91. package/dist/preflight/agents.d.ts +24 -0
  92. package/dist/preflight/agents.js +71 -0
  93. package/dist/preflight/environment.d.ts +6 -0
  94. package/dist/preflight/environment.js +17 -0
  95. package/dist/preflight/formatting.d.ts +5 -0
  96. package/dist/preflight/formatting.js +20 -0
  97. package/dist/preflight/index.d.ts +2 -0
  98. package/dist/preflight/index.js +5 -9
  99. package/dist/preflight/operator.d.ts +32 -0
  100. package/dist/preflight/operator.js +40 -0
  101. package/dist/preflight/settings.d.ts +2 -0
  102. package/dist/preflight/settings.js +17 -0
  103. package/dist/render/transcripts/interactive.d.ts +16 -0
  104. package/dist/render/transcripts/interactive.js +42 -0
  105. package/dist/render/transcripts/list.d.ts +41 -0
  106. package/dist/render/transcripts/list.js +152 -3
  107. package/dist/render/transcripts/message.d.ts +2 -1
  108. package/dist/render/transcripts/message.js +19 -20
  109. package/dist/render/transcripts/reduce.d.ts +1 -0
  110. package/dist/render/transcripts/reduce.js +21 -21
  111. package/dist/render/transcripts/root-launcher.js +2 -12
  112. package/dist/render/transcripts/run.d.ts +3 -0
  113. package/dist/render/transcripts/run.js +30 -4
  114. package/dist/render/transcripts/spec.js +5 -8
  115. package/dist/render/transcripts/verify.d.ts +5 -3
  116. package/dist/render/transcripts/verify.js +44 -31
  117. package/dist/render/utils/duration.d.ts +5 -0
  118. package/dist/render/utils/duration.js +6 -0
  119. package/dist/render/utils/runs.d.ts +1 -0
  120. package/dist/render/utils/runs.js +1 -0
  121. package/dist/render/utils/transcript-shell.d.ts +2 -1
  122. package/dist/render/utils/transcript-shell.js +19 -6
  123. package/dist/utils/errors.d.ts +2 -1
  124. package/dist/utils/errors.js +3 -1
  125. package/dist/utils/git.d.ts +1 -1
  126. package/dist/utils/git.js +25 -2
  127. package/dist/utils/list-target.d.ts +4 -0
  128. package/dist/utils/list-target.js +35 -0
  129. package/dist/utils/terminal.d.ts +1 -0
  130. package/dist/utils/terminal.js +11 -0
  131. package/dist/workspace/chat/artifacts.d.ts +7 -0
  132. package/dist/workspace/chat/artifacts.js +94 -3
  133. package/dist/workspace/errors.js +2 -2
  134. package/dist/workspace/managed-state.d.ts +32 -0
  135. package/dist/workspace/managed-state.js +103 -0
  136. package/dist/workspace/setup.js +66 -2
  137. package/dist/workspace/shim.d.ts +1 -0
  138. package/dist/workspace/shim.js +3 -3
  139. package/dist/workspace/structure.d.ts +1 -0
  140. package/dist/workspace/structure.js +1 -0
  141. package/package.json +2 -2
  142. package/dist/cli/init.d.ts +0 -15
  143. package/dist/cli/init.js +0 -70
  144. package/dist/commands/init/agents.d.ts +0 -4
  145. package/dist/commands/init/command.d.ts +0 -2
  146. package/dist/commands/init/environment.d.ts +0 -2
  147. package/dist/render/transcripts/init.d.ts +0 -7
  148. package/dist/render/transcripts/init.js +0 -83
  149. /package/dist/commands/{init/types.js → doctor/fix-types.js} +0 -0
@@ -1,207 +1,187 @@
1
1
  import { z } from "zod";
2
- export declare const listOperators: readonly ["spec", "run", "reduce", "verify", "message"];
2
+ export declare const listOperators: readonly ["spec", "run", "reduce", "verify", "message", "interactive"];
3
3
  export declare const listModes: readonly ["table", "detail"];
4
+ export declare const listJsonModes: readonly ["list", "detail"];
4
5
  export type ListOperator = (typeof listOperators)[number];
5
6
  export type ListMode = (typeof listModes)[number];
6
- interface ListJsonRecordBase {
7
- id: string;
7
+ export type ListJsonMode = (typeof listJsonModes)[number];
8
+ export type SessionListJsonTargetRef = {
9
+ kind: ListOperator;
10
+ sessionId: string;
11
+ agentId?: string;
12
+ };
13
+ export type FileListJsonTargetRef = {
14
+ kind: "file";
15
+ path: string;
16
+ };
17
+ export type ListJsonTargetRef = SessionListJsonTargetRef | FileListJsonTargetRef;
18
+ export interface ListJsonSessionBase {
19
+ operator: ListOperator;
20
+ sessionId: string;
8
21
  status: string;
9
22
  createdAt: string;
23
+ target?: ListJsonTargetRef;
10
24
  }
11
- interface ListJsonTargetRef {
12
- kind: string;
13
- id: string;
14
- }
15
- export interface RunListJsonTableRecord extends ListJsonRecordBase {
16
- specPath: string;
17
- }
18
- export interface SpecListJsonTableRecord extends ListJsonRecordBase {
19
- description: string | null;
20
- }
21
- export interface TargetedListJsonTableRecord extends ListJsonRecordBase {
22
- target: ListJsonTargetRef;
25
+ export interface ListJsonSummarySession extends ListJsonSessionBase {
26
+ description?: string | null;
23
27
  }
24
- export interface MessageListJsonTableRecord extends ListJsonRecordBase {
25
- promptPreview: string | null;
28
+ export interface ListJsonChanges {
29
+ filesChanged?: number;
30
+ insertions?: number;
31
+ deletions?: number;
26
32
  }
27
- export type ListJsonTableRecord = RunListJsonTableRecord | SpecListJsonTableRecord | TargetedListJsonTableRecord | MessageListJsonTableRecord;
28
- export interface RunListJsonRow {
29
- agentId: string;
30
- status: string;
31
- duration: string;
32
- changes: string | null;
33
- }
34
- export interface SpecListJsonRow {
35
- agentId: string;
36
- status: string;
37
- duration: string;
38
- }
39
- export interface ReduceListJsonRow {
40
- agentId: string;
41
- status: string;
42
- duration: string;
33
+ export interface ListJsonArtifact {
34
+ kind: string;
35
+ role: "output" | "data";
36
+ path: string;
43
37
  }
44
- export interface VerifyListJsonRow {
38
+ export interface ListJsonAgent {
45
39
  agentId: string | null;
46
- verifier: string;
47
40
  status: string;
48
- duration: string;
49
- }
50
- export interface MessageListJsonRow {
51
- agentId: string;
52
- status: string;
53
- duration: string;
54
- }
55
- export type ListJsonRow = RunListJsonRow | SpecListJsonRow | ReduceListJsonRow | VerifyListJsonRow | MessageListJsonRow;
56
- export interface SpecListJsonArtifact {
57
- kind: "spec";
58
- agentId: string;
59
- path: string | null;
60
- }
61
- export interface ReductionListJsonArtifact {
62
- kind: "reduction";
63
- agentId: string;
64
- path: string | null;
65
- }
66
- export interface VerificationListJsonArtifact {
67
- kind: "result";
68
- agentId: string | null;
69
- verifier: string;
70
- path: string | null;
71
- }
72
- export interface MessageListJsonArtifact {
73
- kind: "output";
74
- agentId: string;
75
- path: string | null;
76
- }
77
- export type ListJsonArtifact = SpecListJsonArtifact | ReductionListJsonArtifact | VerificationListJsonArtifact | MessageListJsonArtifact;
78
- export interface ListJsonTableOutput {
41
+ startedAt?: string;
42
+ completedAt?: string;
43
+ verifier?: string;
44
+ changes?: ListJsonChanges;
45
+ artifacts: ListJsonArtifact[];
46
+ }
47
+ export interface ListJsonDetailSession extends ListJsonSessionBase {
48
+ startedAt?: string;
49
+ completedAt?: string;
50
+ workspacePath: string;
51
+ description?: string | null;
52
+ agents: ListJsonAgent[];
53
+ }
54
+ export interface ListJsonListOutput {
79
55
  operator: ListOperator;
80
- mode: "table";
81
- records: ListJsonTableRecord[];
56
+ mode: "list";
57
+ sessions: ListJsonSummarySession[];
82
58
  warnings: string[];
83
59
  }
84
60
  export interface ListJsonDetailOutput {
85
61
  operator: ListOperator;
86
62
  mode: "detail";
87
- sessionId: string;
88
- session: {
89
- id: string;
90
- status: string;
91
- createdAt: string;
92
- elapsed?: string;
93
- workspacePath: string;
94
- target?: ListJsonTargetRef;
95
- rows: ListJsonRow[];
96
- artifacts: ListJsonArtifact[];
97
- } | null;
63
+ session: ListJsonDetailSession | null;
98
64
  warnings: string[];
99
65
  }
100
- export type ListJsonOutput = ListJsonTableOutput | ListJsonDetailOutput;
66
+ export type ListJsonOutput = ListJsonListOutput | ListJsonDetailOutput;
101
67
  export declare const listOperatorSchema: z.ZodEnum<{
102
68
  message: "message";
103
- reduce: "reduce";
104
69
  spec: "spec";
70
+ reduce: "reduce";
105
71
  run: "run";
106
72
  verify: "verify";
73
+ interactive: "interactive";
107
74
  }>;
108
75
  export declare const listModeSchema: z.ZodEnum<{
109
76
  detail: "detail";
110
77
  table: "table";
111
78
  }>;
79
+ export declare const listJsonModeSchema: z.ZodEnum<{
80
+ detail: "detail";
81
+ list: "list";
82
+ }>;
112
83
  export declare const listJsonOutputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
84
  operator: z.ZodEnum<{
114
85
  message: "message";
115
- reduce: "reduce";
116
86
  spec: "spec";
87
+ reduce: "reduce";
117
88
  run: "run";
118
89
  verify: "verify";
90
+ interactive: "interactive";
119
91
  }>;
120
- mode: z.ZodLiteral<"table">;
121
- records: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
122
- id: z.ZodString;
123
- status: z.ZodString;
124
- createdAt: z.ZodString;
125
- specPath: z.ZodString;
126
- }, z.core.$loose>, z.ZodObject<{
127
- id: z.ZodString;
92
+ mode: z.ZodLiteral<"list">;
93
+ sessions: z.ZodArray<z.ZodObject<{
94
+ operator: z.ZodEnum<{
95
+ message: "message";
96
+ spec: "spec";
97
+ reduce: "reduce";
98
+ run: "run";
99
+ verify: "verify";
100
+ interactive: "interactive";
101
+ }>;
102
+ sessionId: z.ZodString;
128
103
  status: z.ZodString;
129
104
  createdAt: z.ZodString;
130
- description: z.ZodNullable<z.ZodString>;
131
- }, z.core.$loose>, z.ZodObject<{
132
- id: z.ZodString;
133
- status: z.ZodString;
134
- createdAt: z.ZodString;
135
- target: z.ZodObject<{
136
- kind: z.ZodString;
137
- id: z.ZodString;
138
- }, z.core.$loose>;
139
- }, z.core.$loose>, z.ZodObject<{
140
- id: z.ZodString;
141
- status: z.ZodString;
142
- createdAt: z.ZodString;
143
- promptPreview: z.ZodNullable<z.ZodString>;
144
- }, z.core.$loose>]>>;
105
+ target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
106
+ kind: z.ZodEnum<{
107
+ message: "message";
108
+ spec: "spec";
109
+ reduce: "reduce";
110
+ run: "run";
111
+ verify: "verify";
112
+ interactive: "interactive";
113
+ }>;
114
+ sessionId: z.ZodString;
115
+ agentId: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$loose>, z.ZodObject<{
117
+ kind: z.ZodLiteral<"file">;
118
+ path: z.ZodString;
119
+ }, z.core.$loose>], "kind">>;
120
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
+ }, z.core.$loose>>;
145
122
  warnings: z.ZodArray<z.ZodString>;
146
123
  }, z.core.$loose>, z.ZodObject<{
147
124
  operator: z.ZodEnum<{
148
125
  message: "message";
149
- reduce: "reduce";
150
126
  spec: "spec";
127
+ reduce: "reduce";
151
128
  run: "run";
152
129
  verify: "verify";
130
+ interactive: "interactive";
153
131
  }>;
154
132
  mode: z.ZodLiteral<"detail">;
155
- sessionId: z.ZodString;
156
133
  session: z.ZodNullable<z.ZodObject<{
157
- id: z.ZodString;
134
+ operator: z.ZodEnum<{
135
+ message: "message";
136
+ spec: "spec";
137
+ reduce: "reduce";
138
+ run: "run";
139
+ verify: "verify";
140
+ interactive: "interactive";
141
+ }>;
142
+ sessionId: z.ZodString;
158
143
  status: z.ZodString;
159
144
  createdAt: z.ZodString;
160
- elapsed: z.ZodOptional<z.ZodString>;
161
- workspacePath: z.ZodString;
162
- target: z.ZodOptional<z.ZodObject<{
163
- kind: z.ZodString;
164
- id: z.ZodString;
165
- }, z.core.$loose>>;
166
- rows: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
167
- agentId: z.ZodString;
168
- status: z.ZodString;
169
- duration: z.ZodString;
170
- changes: z.ZodNullable<z.ZodString>;
171
- }, z.core.$loose>, z.ZodObject<{
172
- agentId: z.ZodString;
173
- status: z.ZodString;
174
- duration: z.ZodString;
145
+ target: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
146
+ kind: z.ZodEnum<{
147
+ message: "message";
148
+ spec: "spec";
149
+ reduce: "reduce";
150
+ run: "run";
151
+ verify: "verify";
152
+ interactive: "interactive";
153
+ }>;
154
+ sessionId: z.ZodString;
155
+ agentId: z.ZodOptional<z.ZodString>;
175
156
  }, z.core.$loose>, z.ZodObject<{
157
+ kind: z.ZodLiteral<"file">;
158
+ path: z.ZodString;
159
+ }, z.core.$loose>], "kind">>;
160
+ startedAt: z.ZodOptional<z.ZodString>;
161
+ completedAt: z.ZodOptional<z.ZodString>;
162
+ workspacePath: z.ZodString;
163
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ agents: z.ZodArray<z.ZodObject<{
176
165
  agentId: z.ZodNullable<z.ZodString>;
177
- verifier: z.ZodString;
178
- status: z.ZodString;
179
- duration: z.ZodString;
180
- }, z.core.$loose>, z.ZodObject<{
181
- agentId: z.ZodString;
182
166
  status: z.ZodString;
183
- duration: z.ZodString;
184
- }, z.core.$loose>]>>;
185
- artifacts: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
186
- kind: z.ZodLiteral<"spec">;
187
- agentId: z.ZodString;
188
- path: z.ZodNullable<z.ZodString>;
189
- }, z.core.$loose>, z.ZodObject<{
190
- kind: z.ZodLiteral<"reduction">;
191
- agentId: z.ZodString;
192
- path: z.ZodNullable<z.ZodString>;
193
- }, z.core.$loose>, z.ZodObject<{
194
- kind: z.ZodLiteral<"result">;
195
- agentId: z.ZodNullable<z.ZodString>;
196
- verifier: z.ZodString;
197
- path: z.ZodNullable<z.ZodString>;
198
- }, z.core.$loose>, z.ZodObject<{
199
- kind: z.ZodLiteral<"output">;
200
- agentId: z.ZodString;
201
- path: z.ZodNullable<z.ZodString>;
202
- }, z.core.$loose>]>>;
167
+ startedAt: z.ZodOptional<z.ZodString>;
168
+ completedAt: z.ZodOptional<z.ZodString>;
169
+ verifier: z.ZodOptional<z.ZodString>;
170
+ changes: z.ZodOptional<z.ZodObject<{
171
+ filesChanged: z.ZodOptional<z.ZodNumber>;
172
+ insertions: z.ZodOptional<z.ZodNumber>;
173
+ deletions: z.ZodOptional<z.ZodNumber>;
174
+ }, z.core.$loose>>;
175
+ artifacts: z.ZodArray<z.ZodObject<{
176
+ kind: z.ZodString;
177
+ role: z.ZodEnum<{
178
+ output: "output";
179
+ data: "data";
180
+ }>;
181
+ path: z.ZodString;
182
+ }, z.core.$loose>>;
183
+ }, z.core.$loose>>;
203
184
  }, z.core.$loose>>;
204
185
  warnings: z.ZodArray<z.ZodString>;
205
186
  }, z.core.$loose>], "mode">;
206
187
  export declare function parseListJsonOutput(input: unknown): ListJsonOutput;
207
- export {};
@@ -5,134 +5,83 @@ export const listOperators = [
5
5
  "reduce",
6
6
  "verify",
7
7
  "message",
8
+ "interactive",
8
9
  ];
9
10
  export const listModes = ["table", "detail"];
11
+ export const listJsonModes = ["list", "detail"];
10
12
  export const listOperatorSchema = z.enum(listOperators);
11
13
  export const listModeSchema = z.enum(listModes);
12
- const listJsonTargetRefSchema = z
14
+ export const listJsonModeSchema = z.enum(listJsonModes);
15
+ const listJsonSessionTargetRefSchema = z
13
16
  .object({
14
- kind: z.string(),
15
- id: z.string(),
16
- })
17
- .passthrough();
18
- const listJsonRecordBaseSchema = z
19
- .object({
20
- id: z.string(),
21
- status: z.string(),
22
- createdAt: z.string(),
23
- })
24
- .passthrough();
25
- const runListJsonTableRecordSchema = listJsonRecordBaseSchema
26
- .extend({
27
- specPath: z.string(),
28
- })
29
- .passthrough();
30
- const specListJsonTableRecordSchema = listJsonRecordBaseSchema
31
- .extend({
32
- description: z.string().nullable(),
33
- })
34
- .passthrough();
35
- const targetedListJsonTableRecordSchema = listJsonRecordBaseSchema
36
- .extend({
37
- target: listJsonTargetRefSchema,
38
- })
39
- .passthrough();
40
- const messageListJsonTableRecordSchema = listJsonRecordBaseSchema
41
- .extend({
42
- promptPreview: z.string().nullable(),
43
- })
44
- .passthrough();
45
- const runListJsonRowSchema = z
46
- .object({
47
- agentId: z.string(),
48
- status: z.string(),
49
- duration: z.string(),
50
- changes: z.string().nullable(),
17
+ kind: listOperatorSchema,
18
+ sessionId: z.string(),
19
+ agentId: z.string().optional(),
51
20
  })
52
21
  .passthrough();
53
- const stageListJsonRowSchema = z
22
+ const listJsonFileTargetRefSchema = z
54
23
  .object({
55
- agentId: z.string(),
56
- status: z.string(),
57
- duration: z.string(),
24
+ kind: z.literal("file"),
25
+ path: z.string(),
58
26
  })
59
27
  .passthrough();
60
- const verifyListJsonRowSchema = z
28
+ const listJsonTargetRefSchema = z.discriminatedUnion("kind", [
29
+ listJsonSessionTargetRefSchema,
30
+ listJsonFileTargetRefSchema,
31
+ ]);
32
+ const listJsonSessionBaseSchema = z
61
33
  .object({
62
- agentId: z.string().nullable(),
63
- verifier: z.string(),
34
+ operator: listOperatorSchema,
35
+ sessionId: z.string(),
64
36
  status: z.string(),
65
- duration: z.string(),
37
+ createdAt: z.string(),
38
+ target: listJsonTargetRefSchema.optional(),
66
39
  })
67
40
  .passthrough();
68
- const messageListJsonRowSchema = z
69
- .object({
70
- agentId: z.string(),
71
- status: z.string(),
72
- duration: z.string(),
41
+ const listJsonSummarySessionSchema = listJsonSessionBaseSchema
42
+ .extend({
43
+ description: z.string().nullable().optional(),
73
44
  })
74
45
  .passthrough();
75
- const specListJsonArtifactSchema = z
46
+ const listJsonChangesSchema = z
76
47
  .object({
77
- kind: z.literal("spec"),
78
- agentId: z.string(),
79
- path: z.string().nullable(),
48
+ filesChanged: z.number().int().nonnegative().optional(),
49
+ insertions: z.number().int().nonnegative().optional(),
50
+ deletions: z.number().int().nonnegative().optional(),
80
51
  })
81
52
  .passthrough();
82
- const reductionListJsonArtifactSchema = z
53
+ const listJsonArtifactSchema = z
83
54
  .object({
84
- kind: z.literal("reduction"),
85
- agentId: z.string(),
86
- path: z.string().nullable(),
55
+ kind: z.string(),
56
+ role: z.enum(["output", "data"]),
57
+ path: z.string(),
87
58
  })
88
59
  .passthrough();
89
- const verificationListJsonArtifactSchema = z
60
+ const listJsonAgentSchema = z
90
61
  .object({
91
- kind: z.literal("result"),
92
62
  agentId: z.string().nullable(),
93
- verifier: z.string(),
94
- path: z.string().nullable(),
95
- })
96
- .passthrough();
97
- const messageListJsonArtifactSchema = z
98
- .object({
99
- kind: z.literal("output"),
100
- agentId: z.string(),
101
- path: z.string().nullable(),
63
+ status: z.string(),
64
+ startedAt: z.string().optional(),
65
+ completedAt: z.string().optional(),
66
+ verifier: z.string().optional(),
67
+ changes: listJsonChangesSchema.optional(),
68
+ artifacts: z.array(listJsonArtifactSchema),
102
69
  })
103
70
  .passthrough();
104
- const listJsonDetailSessionSchema = z
105
- .object({
106
- id: z.string(),
107
- status: z.string(),
108
- createdAt: z.string(),
109
- elapsed: z.string().optional(),
71
+ const listJsonDetailSessionSchema = listJsonSessionBaseSchema
72
+ .extend({
73
+ startedAt: z.string().optional(),
74
+ completedAt: z.string().optional(),
110
75
  workspacePath: z.string(),
111
- target: listJsonTargetRefSchema.optional(),
112
- rows: z.array(z.union([
113
- runListJsonRowSchema,
114
- stageListJsonRowSchema,
115
- verifyListJsonRowSchema,
116
- messageListJsonRowSchema,
117
- ])),
118
- artifacts: z.array(z.union([
119
- specListJsonArtifactSchema,
120
- reductionListJsonArtifactSchema,
121
- verificationListJsonArtifactSchema,
122
- messageListJsonArtifactSchema,
123
- ])),
76
+ description: z.string().nullable().optional(),
77
+ agents: z.array(listJsonAgentSchema),
124
78
  })
125
79
  .passthrough();
126
- const listJsonTableOutputSchema = z
80
+ const listJsonListOutputSchema = z
127
81
  .object({
128
82
  operator: listOperatorSchema,
129
- mode: z.literal("table"),
130
- records: z.array(z.union([
131
- runListJsonTableRecordSchema,
132
- specListJsonTableRecordSchema,
133
- targetedListJsonTableRecordSchema,
134
- messageListJsonTableRecordSchema,
135
- ])),
83
+ mode: z.literal("list"),
84
+ sessions: z.array(listJsonSummarySessionSchema),
136
85
  warnings: z.array(z.string()),
137
86
  })
138
87
  .passthrough();
@@ -140,13 +89,12 @@ const listJsonDetailOutputSchema = z
140
89
  .object({
141
90
  operator: listOperatorSchema,
142
91
  mode: z.literal("detail"),
143
- sessionId: z.string(),
144
92
  session: listJsonDetailSessionSchema.nullable(),
145
93
  warnings: z.array(z.string()),
146
94
  })
147
95
  .passthrough();
148
96
  export const listJsonOutputSchema = z.discriminatedUnion("mode", [
149
- listJsonTableOutputSchema,
97
+ listJsonListOutputSchema,
150
98
  listJsonDetailOutputSchema,
151
99
  ]);
152
100
  export function parseListJsonOutput(input) {
@@ -6,7 +6,30 @@ export interface InteractiveSessionPaths {
6
6
  artifactsPath: string;
7
7
  runtimePath: string;
8
8
  }
9
+ export type InteractiveRecordPredicate = (record: InteractiveSessionRecord) => boolean;
10
+ export interface InteractiveRecordWarningMissing {
11
+ kind: "missing-record";
12
+ sessionId: string;
13
+ recordPath: string;
14
+ displayPath: string;
15
+ }
16
+ export interface InteractiveRecordWarningParse {
17
+ kind: "parse-error";
18
+ sessionId: string;
19
+ recordPath: string;
20
+ displayPath: string;
21
+ details: string;
22
+ }
23
+ export type InteractiveRecordWarning = InteractiveRecordWarningMissing | InteractiveRecordWarningParse;
24
+ export interface ReadInteractiveRecordsOptions {
25
+ root: string;
26
+ interactiveFilePath: string;
27
+ limit?: number;
28
+ predicate?: InteractiveRecordPredicate;
29
+ onWarning?: (warning: InteractiveRecordWarning) => void;
30
+ }
9
31
  export declare function resolveInteractiveSessionPaths(root: string, sessionId: string): InteractiveSessionPaths;
32
+ export declare function readInteractiveRecords(options: ReadInteractiveRecordsOptions): Promise<InteractiveSessionRecord[]>;
10
33
  export declare function ensureInteractiveSessionDirectories(options: {
11
34
  sessionRoot: string;
12
35
  artifactsPath: string;
@@ -36,6 +36,23 @@ export function resolveInteractiveSessionPaths(root, sessionId) {
36
36
  runtimePath: resolvePath(root, getInteractiveSessionDirectoryPath(sessionId), "runtime"),
37
37
  };
38
38
  }
39
+ export async function readInteractiveRecords(options) {
40
+ const { root, interactiveFilePath, limit, predicate, onWarning } = options;
41
+ const paths = buildInteractivePaths(root, interactiveFilePath);
42
+ try {
43
+ return await interactivePersistence.readRecords({
44
+ paths,
45
+ limit,
46
+ predicate,
47
+ onWarning: onWarning
48
+ ? (warning) => onWarning(mapWarning(warning))
49
+ : undefined,
50
+ });
51
+ }
52
+ catch (error) {
53
+ throw mapSessionStoreError(error, sessionStoreErrorMapper);
54
+ }
55
+ }
39
56
  export async function ensureInteractiveSessionDirectories(options) {
40
57
  const { sessionRoot, artifactsPath, runtimePath } = options;
41
58
  await Promise.all([
@@ -128,6 +145,31 @@ function buildInteractiveSessionStorePaths(root) {
128
145
  lockPath: resolvePath(root, getInteractiveHistoryLockPath()),
129
146
  };
130
147
  }
148
+ function buildInteractivePaths(root, interactiveFilePath) {
149
+ return {
150
+ root,
151
+ indexPath: interactiveFilePath,
152
+ sessionsDir: resolvePath(root, getInteractiveSessionsDirectoryPath()),
153
+ lockPath: resolvePath(root, getInteractiveHistoryLockPath()),
154
+ };
155
+ }
156
+ function mapWarning(warning) {
157
+ if (warning.kind === "parse-error") {
158
+ return {
159
+ kind: "parse-error",
160
+ sessionId: warning.sessionId,
161
+ recordPath: warning.recordPath,
162
+ displayPath: warning.displayPath,
163
+ details: warning.details,
164
+ };
165
+ }
166
+ return {
167
+ kind: "missing-record",
168
+ sessionId: warning.sessionId,
169
+ recordPath: warning.recordPath,
170
+ displayPath: warning.displayPath,
171
+ };
172
+ }
131
173
  function parseInteractiveRecord(path, raw) {
132
174
  let parsed;
133
175
  try {
@@ -2,6 +2,27 @@ import { z } from "zod";
2
2
  import { type MessageRecipientStatus, messageRecipientStatusSchema, type MessageStatus, messageStatusSchema, TERMINAL_MESSAGE_RECIPIENT_STATUSES, TERMINAL_MESSAGE_STATUSES } from "../../../status/index.js";
3
3
  export type { MessageRecipientStatus, MessageStatus };
4
4
  export { messageRecipientStatusSchema, messageStatusSchema, TERMINAL_MESSAGE_RECIPIENT_STATUSES, TERMINAL_MESSAGE_STATUSES, };
5
+ declare const MESSAGE_TARGET_KIND_VALUES: readonly ["interactive", "run", "spec", "reduce", "verify"];
6
+ export type MessageTargetKind = (typeof MESSAGE_TARGET_KIND_VALUES)[number];
7
+ export declare const messageTargetKindSchema: z.ZodEnum<{
8
+ spec: "spec";
9
+ reduce: "reduce";
10
+ run: "run";
11
+ verify: "verify";
12
+ interactive: "interactive";
13
+ }>;
14
+ export declare const messageTargetSchema: z.ZodObject<{
15
+ kind: z.ZodEnum<{
16
+ spec: "spec";
17
+ reduce: "reduce";
18
+ run: "run";
19
+ verify: "verify";
20
+ interactive: "interactive";
21
+ }>;
22
+ sessionId: z.ZodString;
23
+ agentId: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strict>;
25
+ export type MessageTarget = z.infer<typeof messageTargetSchema>;
5
26
  export declare const messageRecipientEntrySchema: z.ZodObject<{
6
27
  agentId: z.ZodString;
7
28
  status: z.ZodEnum<{
@@ -52,6 +73,17 @@ export declare const messageRecordSchema: z.ZodObject<{
52
73
  }>;
53
74
  baseRevisionSha: z.ZodOptional<z.ZodString>;
54
75
  prompt: z.ZodString;
76
+ target: z.ZodOptional<z.ZodObject<{
77
+ kind: z.ZodEnum<{
78
+ spec: "spec";
79
+ reduce: "reduce";
80
+ run: "run";
81
+ verify: "verify";
82
+ interactive: "interactive";
83
+ }>;
84
+ sessionId: z.ZodString;
85
+ agentId: z.ZodOptional<z.ZodString>;
86
+ }, z.core.$strict>>;
55
87
  sourceInteractiveSessionId: z.ZodOptional<z.ZodString>;
56
88
  extraContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
57
89
  extraContextMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{