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.
- package/README.md +18 -22
- package/dist/agents/launch/chat.d.ts +3 -1
- package/dist/agents/launch/chat.js +2 -0
- package/dist/bin.js +28 -7
- package/dist/cli/auto.js +1 -0
- package/dist/cli/contract.d.ts +26 -17
- package/dist/cli/contract.js +3 -1
- package/dist/cli/doctor.d.ts +12 -0
- package/dist/cli/doctor.js +115 -0
- package/dist/cli/list.js +4 -1
- package/dist/cli/operator-envelope.d.ts +19 -6
- package/dist/cli/operator-envelope.js +61 -1
- package/dist/cli/run.js +2 -0
- package/dist/cli/verify.d.ts +1 -1
- package/dist/cli/verify.js +48 -9
- package/dist/commands/auto/command.d.ts +1 -0
- package/dist/commands/auto/command.js +22 -12
- package/dist/commands/auto/errors.js +1 -1
- package/dist/commands/doctor/agents.d.ts +5 -0
- package/dist/commands/{init → doctor}/agents.js +37 -19
- package/dist/commands/doctor/command.d.ts +22 -0
- package/dist/commands/doctor/command.js +99 -0
- package/dist/commands/doctor/environment.d.ts +2 -0
- package/dist/commands/{init → doctor}/environment.js +38 -6
- package/dist/commands/{init/types.d.ts → doctor/fix-types.d.ts} +30 -9
- package/dist/commands/doctor/fix.d.ts +2 -0
- package/dist/commands/{init/command.js → doctor/fix.js} +106 -10
- package/dist/commands/doctor/reconcile.d.ts +2 -0
- package/dist/commands/doctor/reconcile.js +101 -0
- package/dist/commands/interactive/lifecycle.d.ts +2 -0
- package/dist/commands/interactive/lifecycle.js +8 -0
- package/dist/commands/list/command.d.ts +1 -0
- package/dist/commands/list/command.js +211 -352
- package/dist/commands/list/normalization.d.ts +56 -0
- package/dist/commands/list/normalization.js +317 -0
- package/dist/commands/message/command.d.ts +2 -1
- package/dist/commands/message/command.js +35 -14
- package/dist/commands/message/errors.d.ts +12 -3
- package/dist/commands/message/errors.js +19 -3
- package/dist/commands/reduce/command.js +16 -17
- package/dist/commands/reduce/errors.d.ts +2 -2
- package/dist/commands/reduce/errors.js +3 -3
- package/dist/commands/reduce/targets.js +11 -2
- package/dist/commands/root-launcher/command.js +12 -6
- package/dist/commands/run/command.d.ts +1 -0
- package/dist/commands/run/command.js +4 -1
- package/dist/commands/run/record-init.d.ts +2 -0
- package/dist/commands/run/record-init.js +2 -1
- package/dist/commands/run/spec-provenance.d.ts +37 -0
- package/dist/commands/run/spec-provenance.js +384 -0
- package/dist/commands/run/validation.d.ts +4 -0
- package/dist/commands/run/validation.js +25 -62
- package/dist/commands/spec/command.js +19 -6
- package/dist/commands/spec/errors.d.ts +5 -0
- package/dist/commands/spec/errors.js +9 -0
- package/dist/commands/verify/agents.d.ts +4 -2
- package/dist/commands/verify/agents.js +4 -11
- package/dist/commands/verify/command.js +15 -5
- package/dist/commands/verify/errors.d.ts +12 -0
- package/dist/commands/verify/errors.js +22 -0
- package/dist/commands/verify/targets.js +108 -12
- package/dist/competition/shared/preflight.d.ts +1 -1
- package/dist/competition/shared/preflight.js +15 -2
- package/dist/contracts/list.d.ts +129 -149
- package/dist/contracts/list.js +47 -99
- package/dist/domain/interactive/persistence/adapter.d.ts +23 -0
- package/dist/domain/interactive/persistence/adapter.js +42 -0
- package/dist/domain/message/model/types.d.ts +32 -0
- package/dist/domain/message/model/types.js +25 -0
- package/dist/domain/reduce/competition/adapter.js +21 -7
- package/dist/domain/reduce/competition/finalize.d.ts +7 -0
- package/dist/domain/reduce/competition/finalize.js +19 -0
- package/dist/domain/reduce/model/types.d.ts +3 -3
- package/dist/domain/run/competition/agents/artifacts.js +4 -2
- package/dist/domain/run/competition/errors.d.ts +1 -1
- package/dist/domain/run/competition/errors.js +4 -7
- package/dist/domain/run/model/types.d.ts +384 -0
- package/dist/domain/run/model/types.js +87 -0
- package/dist/domain/spec/competition/adapter.d.ts +1 -0
- package/dist/domain/spec/competition/adapter.js +6 -1
- package/dist/domain/spec/model/types.d.ts +3 -0
- package/dist/domain/spec/model/types.js +5 -0
- package/dist/domain/verify/competition/finalize.d.ts +9 -0
- package/dist/domain/verify/competition/finalize.js +22 -3
- package/dist/domain/verify/model/types.d.ts +2 -2
- package/dist/interactive/providers/mcp.d.ts +1 -0
- package/dist/interactive/providers/mcp.js +45 -7
- package/dist/interactive/substrate.js +20 -3
- package/dist/mcp/server.js +26 -9
- package/dist/policy/verification.js +18 -1
- package/dist/preflight/agents.d.ts +24 -0
- package/dist/preflight/agents.js +71 -0
- package/dist/preflight/environment.d.ts +6 -0
- package/dist/preflight/environment.js +17 -0
- package/dist/preflight/formatting.d.ts +5 -0
- package/dist/preflight/formatting.js +20 -0
- package/dist/preflight/index.d.ts +2 -0
- package/dist/preflight/index.js +5 -9
- package/dist/preflight/operator.d.ts +32 -0
- package/dist/preflight/operator.js +40 -0
- package/dist/preflight/settings.d.ts +2 -0
- package/dist/preflight/settings.js +17 -0
- package/dist/render/transcripts/interactive.d.ts +16 -0
- package/dist/render/transcripts/interactive.js +42 -0
- package/dist/render/transcripts/list.d.ts +41 -0
- package/dist/render/transcripts/list.js +152 -3
- package/dist/render/transcripts/message.d.ts +2 -1
- package/dist/render/transcripts/message.js +19 -20
- package/dist/render/transcripts/reduce.d.ts +1 -0
- package/dist/render/transcripts/reduce.js +21 -21
- package/dist/render/transcripts/root-launcher.js +2 -12
- package/dist/render/transcripts/run.d.ts +3 -0
- package/dist/render/transcripts/run.js +30 -4
- package/dist/render/transcripts/spec.js +5 -8
- package/dist/render/transcripts/verify.d.ts +5 -3
- package/dist/render/transcripts/verify.js +44 -31
- package/dist/render/utils/duration.d.ts +5 -0
- package/dist/render/utils/duration.js +6 -0
- package/dist/render/utils/runs.d.ts +1 -0
- package/dist/render/utils/runs.js +1 -0
- package/dist/render/utils/transcript-shell.d.ts +2 -1
- package/dist/render/utils/transcript-shell.js +19 -6
- package/dist/utils/errors.d.ts +2 -1
- package/dist/utils/errors.js +3 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.js +25 -2
- package/dist/utils/list-target.d.ts +4 -0
- package/dist/utils/list-target.js +35 -0
- package/dist/utils/terminal.d.ts +1 -0
- package/dist/utils/terminal.js +11 -0
- package/dist/workspace/chat/artifacts.d.ts +7 -0
- package/dist/workspace/chat/artifacts.js +94 -3
- package/dist/workspace/errors.js +2 -2
- package/dist/workspace/managed-state.d.ts +32 -0
- package/dist/workspace/managed-state.js +103 -0
- package/dist/workspace/setup.js +66 -2
- package/dist/workspace/shim.d.ts +1 -0
- package/dist/workspace/shim.js +3 -3
- package/dist/workspace/structure.d.ts +1 -0
- package/dist/workspace/structure.js +1 -0
- package/package.json +2 -2
- package/dist/cli/init.d.ts +0 -15
- package/dist/cli/init.js +0 -70
- package/dist/commands/init/agents.d.ts +0 -4
- package/dist/commands/init/command.d.ts +0 -2
- package/dist/commands/init/environment.d.ts +0 -2
- package/dist/render/transcripts/init.d.ts +0 -7
- package/dist/render/transcripts/init.js +0 -83
- /package/dist/commands/{init/types.js → doctor/fix-types.js} +0 -0
package/dist/contracts/list.d.ts
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
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
|
|
12
|
-
|
|
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
|
|
25
|
-
|
|
28
|
+
export interface ListJsonChanges {
|
|
29
|
+
filesChanged?: number;
|
|
30
|
+
insertions?: number;
|
|
31
|
+
deletions?: number;
|
|
26
32
|
}
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
38
|
+
export interface ListJsonAgent {
|
|
45
39
|
agentId: string | null;
|
|
46
|
-
verifier: string;
|
|
47
40
|
status: string;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
export interface
|
|
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: "
|
|
81
|
-
|
|
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
|
-
|
|
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 =
|
|
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<"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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 {};
|
package/dist/contracts/list.js
CHANGED
|
@@ -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
|
|
14
|
+
export const listJsonModeSchema = z.enum(listJsonModes);
|
|
15
|
+
const listJsonSessionTargetRefSchema = z
|
|
13
16
|
.object({
|
|
14
|
-
kind:
|
|
15
|
-
|
|
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
|
|
22
|
+
const listJsonFileTargetRefSchema = z
|
|
54
23
|
.object({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
duration: z.string(),
|
|
24
|
+
kind: z.literal("file"),
|
|
25
|
+
path: z.string(),
|
|
58
26
|
})
|
|
59
27
|
.passthrough();
|
|
60
|
-
const
|
|
28
|
+
const listJsonTargetRefSchema = z.discriminatedUnion("kind", [
|
|
29
|
+
listJsonSessionTargetRefSchema,
|
|
30
|
+
listJsonFileTargetRefSchema,
|
|
31
|
+
]);
|
|
32
|
+
const listJsonSessionBaseSchema = z
|
|
61
33
|
.object({
|
|
62
|
-
|
|
63
|
-
|
|
34
|
+
operator: listOperatorSchema,
|
|
35
|
+
sessionId: z.string(),
|
|
64
36
|
status: z.string(),
|
|
65
|
-
|
|
37
|
+
createdAt: z.string(),
|
|
38
|
+
target: listJsonTargetRefSchema.optional(),
|
|
66
39
|
})
|
|
67
40
|
.passthrough();
|
|
68
|
-
const
|
|
69
|
-
.
|
|
70
|
-
|
|
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
|
|
46
|
+
const listJsonChangesSchema = z
|
|
76
47
|
.object({
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
53
|
+
const listJsonArtifactSchema = z
|
|
83
54
|
.object({
|
|
84
|
-
kind: z.
|
|
85
|
-
|
|
86
|
-
path: z.string()
|
|
55
|
+
kind: z.string(),
|
|
56
|
+
role: z.enum(["output", "data"]),
|
|
57
|
+
path: z.string(),
|
|
87
58
|
})
|
|
88
59
|
.passthrough();
|
|
89
|
-
const
|
|
60
|
+
const listJsonAgentSchema = z
|
|
90
61
|
.object({
|
|
91
|
-
kind: z.literal("result"),
|
|
92
62
|
agentId: z.string().nullable(),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
.
|
|
97
|
-
|
|
98
|
-
.
|
|
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 =
|
|
105
|
-
.
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
112
|
-
|
|
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
|
|
80
|
+
const listJsonListOutputSchema = z
|
|
127
81
|
.object({
|
|
128
82
|
operator: listOperatorSchema,
|
|
129
|
-
mode: z.literal("
|
|
130
|
-
|
|
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
|
-
|
|
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<{
|