@agent-deck/shared 2.1.1 → 2.2.1
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/dist/constants/client-scope.d.ts +8 -0
- package/dist/constants/client-scope.d.ts.map +1 -1
- package/dist/constants/client-scope.js +9 -1
- package/dist/constants/client-scope.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas/agent-run.d.ts +749 -0
- package/dist/schemas/agent-run.d.ts.map +1 -0
- package/dist/schemas/agent-run.js +267 -0
- package/dist/schemas/agent-run.js.map +1 -0
- package/dist/schemas/card-usage.d.ts +7 -0
- package/dist/schemas/card-usage.d.ts.map +1 -1
- package/dist/schemas/card-usage.js +10 -0
- package/dist/schemas/card-usage.js.map +1 -1
- package/dist/schemas/deck-display.d.ts +8 -0
- package/dist/schemas/deck-display.d.ts.map +1 -1
- package/dist/schemas/deck-display.js +12 -1
- package/dist/schemas/deck-display.js.map +1 -1
- package/dist/schemas/trusted-session.d.ts +1 -1
- package/dist/schemas/trusted-session.d.ts.map +1 -1
- package/dist/schemas/trusted-session.js +6 -0
- package/dist/schemas/trusted-session.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Agent run HTTP contract (NOT-480): one coding-agent attempt on the Agent
|
|
4
|
+
* Deck host, started or continued by an authenticated remote coordinator.
|
|
5
|
+
*
|
|
6
|
+
* Responses carry only public lifecycle fields and normalized events —
|
|
7
|
+
* never a host pid, a private log path, credentials, or an Authorization
|
|
8
|
+
* value. Success bodies are wrapped as `{ success: true, data }`.
|
|
9
|
+
*/
|
|
10
|
+
/** Prompt bound checked before launch (characters). */
|
|
11
|
+
export declare const AGENT_RUN_PROMPT_MAX_CHARS: number;
|
|
12
|
+
/** Whole-request bound for `POST /api/agent-runs` (bytes). */
|
|
13
|
+
export declare const AGENT_RUN_REQUEST_BODY_LIMIT_BYTES: number;
|
|
14
|
+
/** Required on `POST /api/agent-runs`; scoped to the calling grant. */
|
|
15
|
+
export declare const AGENT_RUN_IDEMPOTENCY_HEADER = "idempotency-key";
|
|
16
|
+
export declare const AGENT_RUN_EVENTS_DEFAULT_LIMIT = 200;
|
|
17
|
+
export declare const AGENT_RUN_EVENTS_MAX_LIMIT = 1000;
|
|
18
|
+
export declare const AgentRunClientSchema: z.ZodEnum<["claude", "codex", "cursor", "muse"]>;
|
|
19
|
+
export declare const AgentRunToolsSchema: z.ZodEnum<["readonly", "edit"]>;
|
|
20
|
+
/** Opaque run id (`run-<UTC stamp>-<hex>`). */
|
|
21
|
+
export declare const AgentRunIdSchema: z.ZodString;
|
|
22
|
+
export declare const AgentRunIdempotencyKeySchema: z.ZodString;
|
|
23
|
+
export declare const CreateAgentRunRequestSchema: z.ZodObject<{
|
|
24
|
+
deckId: z.ZodString;
|
|
25
|
+
client: z.ZodEnum<["claude", "codex", "cursor", "muse"]>;
|
|
26
|
+
/** Absolute working directory on the Agent Deck host. */
|
|
27
|
+
cwd: z.ZodEffects<z.ZodString, string, string>;
|
|
28
|
+
prompt: z.ZodEffects<z.ZodString, string, string>;
|
|
29
|
+
/** Explicit tool profile; `readonly` only when omitted. */
|
|
30
|
+
tools: z.ZodDefault<z.ZodEnum<["readonly", "edit"]>>;
|
|
31
|
+
/** Opaque client session id from an earlier run's status. */
|
|
32
|
+
resumeSessionId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
/**
|
|
34
|
+
* NOT-486: capture a private pre-launch Git baseline so this run can be
|
|
35
|
+
* finalized into one local commit. Valid only with `tools: "edit"`, a Git
|
|
36
|
+
* worktree `cwd`, and a clean Git index.
|
|
37
|
+
*/
|
|
38
|
+
prepareFinalization: z.ZodDefault<z.ZodBoolean>;
|
|
39
|
+
}, "strict", z.ZodTypeAny, {
|
|
40
|
+
tools: "readonly" | "edit";
|
|
41
|
+
deckId: string;
|
|
42
|
+
cwd: string;
|
|
43
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
44
|
+
prompt: string;
|
|
45
|
+
prepareFinalization: boolean;
|
|
46
|
+
resumeSessionId?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
deckId: string;
|
|
49
|
+
cwd: string;
|
|
50
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
51
|
+
prompt: string;
|
|
52
|
+
tools?: "readonly" | "edit" | undefined;
|
|
53
|
+
resumeSessionId?: string | undefined;
|
|
54
|
+
prepareFinalization?: boolean | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Lifecycle state. `starting` is the launch acknowledgement (record written,
|
|
58
|
+
* no event yet); `running` has emitted events; `ended`, `error`, `died`, and
|
|
59
|
+
* `canceled` (NOT-481: operator cancellation, never an execution error) are
|
|
60
|
+
* terminal. `running` never implies success.
|
|
61
|
+
*/
|
|
62
|
+
export declare const AgentRunStateSchema: z.ZodEnum<["starting", "running", "ended", "error", "died", "canceled"]>;
|
|
63
|
+
export declare const AGENT_RUN_TERMINAL_STATES: readonly ["ended", "error", "died", "canceled"];
|
|
64
|
+
export declare const CreateAgentRunResponseSchema: z.ZodObject<{
|
|
65
|
+
runId: z.ZodString;
|
|
66
|
+
state: z.ZodEnum<["starting", "running", "ended", "error", "died", "canceled"]>;
|
|
67
|
+
}, "strict", z.ZodTypeAny, {
|
|
68
|
+
state: "error" | "starting" | "running" | "ended" | "died" | "canceled";
|
|
69
|
+
runId: string;
|
|
70
|
+
}, {
|
|
71
|
+
state: "error" | "starting" | "running" | "ended" | "died" | "canceled";
|
|
72
|
+
runId: string;
|
|
73
|
+
}>;
|
|
74
|
+
/** Lowercase hex Git object id (SHA-1 or SHA-256 repositories). */
|
|
75
|
+
export declare const GitObjectIdSchema: z.ZodString;
|
|
76
|
+
export declare const Sha256HexSchema: z.ZodString;
|
|
77
|
+
/** Opaque reference to a run's private pre-launch Git baseline. */
|
|
78
|
+
export declare const FinalizationBaselineRefSchema: z.ZodString;
|
|
79
|
+
/**
|
|
80
|
+
* `prepared`: baseline captured, not finalized; `finalizing`: one finalize
|
|
81
|
+
* request is in progress; `finalized`: one local commit was created.
|
|
82
|
+
*/
|
|
83
|
+
export declare const FinalizationStateSchema: z.ZodEnum<["prepared", "finalizing", "finalized"]>;
|
|
84
|
+
/** Public finalization fields on a prepared run (never a host path or file content). */
|
|
85
|
+
export declare const AgentRunFinalizationStatusSchema: z.ZodObject<{
|
|
86
|
+
baselineRef: z.ZodString;
|
|
87
|
+
baselineDigest: z.ZodString;
|
|
88
|
+
state: z.ZodEnum<["prepared", "finalizing", "finalized"]>;
|
|
89
|
+
commit: z.ZodNullable<z.ZodString>;
|
|
90
|
+
}, "strict", z.ZodTypeAny, {
|
|
91
|
+
state: "prepared" | "finalizing" | "finalized";
|
|
92
|
+
baselineRef: string;
|
|
93
|
+
baselineDigest: string;
|
|
94
|
+
commit: string | null;
|
|
95
|
+
}, {
|
|
96
|
+
state: "prepared" | "finalizing" | "finalized";
|
|
97
|
+
baselineRef: string;
|
|
98
|
+
baselineDigest: string;
|
|
99
|
+
commit: string | null;
|
|
100
|
+
}>;
|
|
101
|
+
export declare const AgentRunStatusSchema: z.ZodObject<{
|
|
102
|
+
runId: z.ZodString;
|
|
103
|
+
deckId: z.ZodString;
|
|
104
|
+
client: z.ZodEnum<["claude", "codex", "cursor", "muse"]>;
|
|
105
|
+
tools: z.ZodEnum<["readonly", "edit"]>;
|
|
106
|
+
state: z.ZodEnum<["starting", "running", "ended", "error", "died", "canceled"]>;
|
|
107
|
+
/** Opaque client session id; pass as `resumeSessionId` to continue. */
|
|
108
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
109
|
+
startedAt: z.ZodString;
|
|
110
|
+
lastEventAt: z.ZodNullable<z.ZodString>;
|
|
111
|
+
/** NOT-486: present only when the run was started with `prepareFinalization`. */
|
|
112
|
+
finalization: z.ZodNullable<z.ZodObject<{
|
|
113
|
+
baselineRef: z.ZodString;
|
|
114
|
+
baselineDigest: z.ZodString;
|
|
115
|
+
state: z.ZodEnum<["prepared", "finalizing", "finalized"]>;
|
|
116
|
+
commit: z.ZodNullable<z.ZodString>;
|
|
117
|
+
}, "strict", z.ZodTypeAny, {
|
|
118
|
+
state: "prepared" | "finalizing" | "finalized";
|
|
119
|
+
baselineRef: string;
|
|
120
|
+
baselineDigest: string;
|
|
121
|
+
commit: string | null;
|
|
122
|
+
}, {
|
|
123
|
+
state: "prepared" | "finalizing" | "finalized";
|
|
124
|
+
baselineRef: string;
|
|
125
|
+
baselineDigest: string;
|
|
126
|
+
commit: string | null;
|
|
127
|
+
}>>;
|
|
128
|
+
}, "strict", z.ZodTypeAny, {
|
|
129
|
+
tools: "readonly" | "edit";
|
|
130
|
+
deckId: string;
|
|
131
|
+
startedAt: string;
|
|
132
|
+
state: "error" | "starting" | "running" | "ended" | "died" | "canceled";
|
|
133
|
+
sessionId: string | null;
|
|
134
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
135
|
+
runId: string;
|
|
136
|
+
lastEventAt: string | null;
|
|
137
|
+
finalization: {
|
|
138
|
+
state: "prepared" | "finalizing" | "finalized";
|
|
139
|
+
baselineRef: string;
|
|
140
|
+
baselineDigest: string;
|
|
141
|
+
commit: string | null;
|
|
142
|
+
} | null;
|
|
143
|
+
}, {
|
|
144
|
+
tools: "readonly" | "edit";
|
|
145
|
+
deckId: string;
|
|
146
|
+
startedAt: string;
|
|
147
|
+
state: "error" | "starting" | "running" | "ended" | "died" | "canceled";
|
|
148
|
+
sessionId: string | null;
|
|
149
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
150
|
+
runId: string;
|
|
151
|
+
lastEventAt: string | null;
|
|
152
|
+
finalization: {
|
|
153
|
+
state: "prepared" | "finalizing" | "finalized";
|
|
154
|
+
baselineRef: string;
|
|
155
|
+
baselineDigest: string;
|
|
156
|
+
commit: string | null;
|
|
157
|
+
} | null;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* Normalized run events, in log order. `seq` is the event's 1-based position
|
|
161
|
+
* in the canonical log: stable across reads and strictly increasing.
|
|
162
|
+
*/
|
|
163
|
+
export declare const AgentRunEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"text">;
|
|
165
|
+
text: z.ZodString;
|
|
166
|
+
seq: z.ZodNumber;
|
|
167
|
+
ts: z.ZodString;
|
|
168
|
+
}, "strict", z.ZodTypeAny, {
|
|
169
|
+
type: "text";
|
|
170
|
+
text: string;
|
|
171
|
+
seq: number;
|
|
172
|
+
ts: string;
|
|
173
|
+
}, {
|
|
174
|
+
type: "text";
|
|
175
|
+
text: string;
|
|
176
|
+
seq: number;
|
|
177
|
+
ts: string;
|
|
178
|
+
}>, z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"tool">;
|
|
180
|
+
name: z.ZodString;
|
|
181
|
+
seq: z.ZodNumber;
|
|
182
|
+
ts: z.ZodString;
|
|
183
|
+
}, "strict", z.ZodTypeAny, {
|
|
184
|
+
name: string;
|
|
185
|
+
type: "tool";
|
|
186
|
+
seq: number;
|
|
187
|
+
ts: string;
|
|
188
|
+
}, {
|
|
189
|
+
name: string;
|
|
190
|
+
type: "tool";
|
|
191
|
+
seq: number;
|
|
192
|
+
ts: string;
|
|
193
|
+
}>, z.ZodObject<{
|
|
194
|
+
type: z.ZodLiteral<"notice">;
|
|
195
|
+
message: z.ZodString;
|
|
196
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
197
|
+
seq: z.ZodNumber;
|
|
198
|
+
ts: z.ZodString;
|
|
199
|
+
}, "strict", z.ZodTypeAny, {
|
|
200
|
+
type: "notice";
|
|
201
|
+
message: string;
|
|
202
|
+
sessionId: string | null;
|
|
203
|
+
seq: number;
|
|
204
|
+
ts: string;
|
|
205
|
+
}, {
|
|
206
|
+
type: "notice";
|
|
207
|
+
message: string;
|
|
208
|
+
sessionId: string | null;
|
|
209
|
+
seq: number;
|
|
210
|
+
ts: string;
|
|
211
|
+
}>, z.ZodObject<{
|
|
212
|
+
type: z.ZodLiteral<"result">;
|
|
213
|
+
subtype: z.ZodString;
|
|
214
|
+
result: z.ZodUnknown;
|
|
215
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
216
|
+
seq: z.ZodNumber;
|
|
217
|
+
ts: z.ZodString;
|
|
218
|
+
}, "strict", z.ZodTypeAny, {
|
|
219
|
+
type: "result";
|
|
220
|
+
sessionId: string | null;
|
|
221
|
+
seq: number;
|
|
222
|
+
ts: string;
|
|
223
|
+
subtype: string;
|
|
224
|
+
result?: unknown;
|
|
225
|
+
}, {
|
|
226
|
+
type: "result";
|
|
227
|
+
sessionId: string | null;
|
|
228
|
+
seq: number;
|
|
229
|
+
ts: string;
|
|
230
|
+
subtype: string;
|
|
231
|
+
result?: unknown;
|
|
232
|
+
}>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"end">;
|
|
234
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
235
|
+
seq: z.ZodNumber;
|
|
236
|
+
ts: z.ZodString;
|
|
237
|
+
}, "strict", z.ZodTypeAny, {
|
|
238
|
+
type: "end";
|
|
239
|
+
sessionId: string | null;
|
|
240
|
+
seq: number;
|
|
241
|
+
ts: string;
|
|
242
|
+
}, {
|
|
243
|
+
type: "end";
|
|
244
|
+
sessionId: string | null;
|
|
245
|
+
seq: number;
|
|
246
|
+
ts: string;
|
|
247
|
+
}>, z.ZodObject<{
|
|
248
|
+
type: z.ZodLiteral<"error">;
|
|
249
|
+
message: z.ZodString;
|
|
250
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
251
|
+
seq: z.ZodNumber;
|
|
252
|
+
ts: z.ZodString;
|
|
253
|
+
}, "strict", z.ZodTypeAny, {
|
|
254
|
+
type: "error";
|
|
255
|
+
message: string;
|
|
256
|
+
sessionId: string | null;
|
|
257
|
+
seq: number;
|
|
258
|
+
ts: string;
|
|
259
|
+
}, {
|
|
260
|
+
type: "error";
|
|
261
|
+
message: string;
|
|
262
|
+
sessionId: string | null;
|
|
263
|
+
seq: number;
|
|
264
|
+
ts: string;
|
|
265
|
+
}>, z.ZodObject<{
|
|
266
|
+
type: z.ZodLiteral<"canceled">;
|
|
267
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
268
|
+
seq: z.ZodNumber;
|
|
269
|
+
ts: z.ZodString;
|
|
270
|
+
}, "strict", z.ZodTypeAny, {
|
|
271
|
+
type: "canceled";
|
|
272
|
+
sessionId: string | null;
|
|
273
|
+
seq: number;
|
|
274
|
+
ts: string;
|
|
275
|
+
}, {
|
|
276
|
+
type: "canceled";
|
|
277
|
+
sessionId: string | null;
|
|
278
|
+
seq: number;
|
|
279
|
+
ts: string;
|
|
280
|
+
}>]>;
|
|
281
|
+
export declare const AgentRunEventsQuerySchema: z.ZodObject<{
|
|
282
|
+
/** Cursor from a previous read's `nextCursor`; omitted reads from the start. */
|
|
283
|
+
after: z.ZodOptional<z.ZodString>;
|
|
284
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
285
|
+
}, "strict", z.ZodTypeAny, {
|
|
286
|
+
after?: string | undefined;
|
|
287
|
+
limit?: number | undefined;
|
|
288
|
+
}, {
|
|
289
|
+
after?: string | undefined;
|
|
290
|
+
limit?: number | undefined;
|
|
291
|
+
}>;
|
|
292
|
+
export declare const AgentRunEventsResponseSchema: z.ZodObject<{
|
|
293
|
+
runId: z.ZodString;
|
|
294
|
+
state: z.ZodEnum<["starting", "running", "ended", "error", "died", "canceled"]>;
|
|
295
|
+
events: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
296
|
+
type: z.ZodLiteral<"text">;
|
|
297
|
+
text: z.ZodString;
|
|
298
|
+
seq: z.ZodNumber;
|
|
299
|
+
ts: z.ZodString;
|
|
300
|
+
}, "strict", z.ZodTypeAny, {
|
|
301
|
+
type: "text";
|
|
302
|
+
text: string;
|
|
303
|
+
seq: number;
|
|
304
|
+
ts: string;
|
|
305
|
+
}, {
|
|
306
|
+
type: "text";
|
|
307
|
+
text: string;
|
|
308
|
+
seq: number;
|
|
309
|
+
ts: string;
|
|
310
|
+
}>, z.ZodObject<{
|
|
311
|
+
type: z.ZodLiteral<"tool">;
|
|
312
|
+
name: z.ZodString;
|
|
313
|
+
seq: z.ZodNumber;
|
|
314
|
+
ts: z.ZodString;
|
|
315
|
+
}, "strict", z.ZodTypeAny, {
|
|
316
|
+
name: string;
|
|
317
|
+
type: "tool";
|
|
318
|
+
seq: number;
|
|
319
|
+
ts: string;
|
|
320
|
+
}, {
|
|
321
|
+
name: string;
|
|
322
|
+
type: "tool";
|
|
323
|
+
seq: number;
|
|
324
|
+
ts: string;
|
|
325
|
+
}>, z.ZodObject<{
|
|
326
|
+
type: z.ZodLiteral<"notice">;
|
|
327
|
+
message: z.ZodString;
|
|
328
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
329
|
+
seq: z.ZodNumber;
|
|
330
|
+
ts: z.ZodString;
|
|
331
|
+
}, "strict", z.ZodTypeAny, {
|
|
332
|
+
type: "notice";
|
|
333
|
+
message: string;
|
|
334
|
+
sessionId: string | null;
|
|
335
|
+
seq: number;
|
|
336
|
+
ts: string;
|
|
337
|
+
}, {
|
|
338
|
+
type: "notice";
|
|
339
|
+
message: string;
|
|
340
|
+
sessionId: string | null;
|
|
341
|
+
seq: number;
|
|
342
|
+
ts: string;
|
|
343
|
+
}>, z.ZodObject<{
|
|
344
|
+
type: z.ZodLiteral<"result">;
|
|
345
|
+
subtype: z.ZodString;
|
|
346
|
+
result: z.ZodUnknown;
|
|
347
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
348
|
+
seq: z.ZodNumber;
|
|
349
|
+
ts: z.ZodString;
|
|
350
|
+
}, "strict", z.ZodTypeAny, {
|
|
351
|
+
type: "result";
|
|
352
|
+
sessionId: string | null;
|
|
353
|
+
seq: number;
|
|
354
|
+
ts: string;
|
|
355
|
+
subtype: string;
|
|
356
|
+
result?: unknown;
|
|
357
|
+
}, {
|
|
358
|
+
type: "result";
|
|
359
|
+
sessionId: string | null;
|
|
360
|
+
seq: number;
|
|
361
|
+
ts: string;
|
|
362
|
+
subtype: string;
|
|
363
|
+
result?: unknown;
|
|
364
|
+
}>, z.ZodObject<{
|
|
365
|
+
type: z.ZodLiteral<"end">;
|
|
366
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
367
|
+
seq: z.ZodNumber;
|
|
368
|
+
ts: z.ZodString;
|
|
369
|
+
}, "strict", z.ZodTypeAny, {
|
|
370
|
+
type: "end";
|
|
371
|
+
sessionId: string | null;
|
|
372
|
+
seq: number;
|
|
373
|
+
ts: string;
|
|
374
|
+
}, {
|
|
375
|
+
type: "end";
|
|
376
|
+
sessionId: string | null;
|
|
377
|
+
seq: number;
|
|
378
|
+
ts: string;
|
|
379
|
+
}>, z.ZodObject<{
|
|
380
|
+
type: z.ZodLiteral<"error">;
|
|
381
|
+
message: z.ZodString;
|
|
382
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
383
|
+
seq: z.ZodNumber;
|
|
384
|
+
ts: z.ZodString;
|
|
385
|
+
}, "strict", z.ZodTypeAny, {
|
|
386
|
+
type: "error";
|
|
387
|
+
message: string;
|
|
388
|
+
sessionId: string | null;
|
|
389
|
+
seq: number;
|
|
390
|
+
ts: string;
|
|
391
|
+
}, {
|
|
392
|
+
type: "error";
|
|
393
|
+
message: string;
|
|
394
|
+
sessionId: string | null;
|
|
395
|
+
seq: number;
|
|
396
|
+
ts: string;
|
|
397
|
+
}>, z.ZodObject<{
|
|
398
|
+
type: z.ZodLiteral<"canceled">;
|
|
399
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
400
|
+
seq: z.ZodNumber;
|
|
401
|
+
ts: z.ZodString;
|
|
402
|
+
}, "strict", z.ZodTypeAny, {
|
|
403
|
+
type: "canceled";
|
|
404
|
+
sessionId: string | null;
|
|
405
|
+
seq: number;
|
|
406
|
+
ts: string;
|
|
407
|
+
}, {
|
|
408
|
+
type: "canceled";
|
|
409
|
+
sessionId: string | null;
|
|
410
|
+
seq: number;
|
|
411
|
+
ts: string;
|
|
412
|
+
}>]>, "many">;
|
|
413
|
+
/** Pass as `after` to read the next page; unchanged when nothing new arrived. */
|
|
414
|
+
nextCursor: z.ZodString;
|
|
415
|
+
}, "strict", z.ZodTypeAny, {
|
|
416
|
+
state: "error" | "starting" | "running" | "ended" | "died" | "canceled";
|
|
417
|
+
runId: string;
|
|
418
|
+
events: ({
|
|
419
|
+
type: "text";
|
|
420
|
+
text: string;
|
|
421
|
+
seq: number;
|
|
422
|
+
ts: string;
|
|
423
|
+
} | {
|
|
424
|
+
name: string;
|
|
425
|
+
type: "tool";
|
|
426
|
+
seq: number;
|
|
427
|
+
ts: string;
|
|
428
|
+
} | {
|
|
429
|
+
type: "notice";
|
|
430
|
+
message: string;
|
|
431
|
+
sessionId: string | null;
|
|
432
|
+
seq: number;
|
|
433
|
+
ts: string;
|
|
434
|
+
} | {
|
|
435
|
+
type: "result";
|
|
436
|
+
sessionId: string | null;
|
|
437
|
+
seq: number;
|
|
438
|
+
ts: string;
|
|
439
|
+
subtype: string;
|
|
440
|
+
result?: unknown;
|
|
441
|
+
} | {
|
|
442
|
+
type: "end";
|
|
443
|
+
sessionId: string | null;
|
|
444
|
+
seq: number;
|
|
445
|
+
ts: string;
|
|
446
|
+
} | {
|
|
447
|
+
type: "error";
|
|
448
|
+
message: string;
|
|
449
|
+
sessionId: string | null;
|
|
450
|
+
seq: number;
|
|
451
|
+
ts: string;
|
|
452
|
+
} | {
|
|
453
|
+
type: "canceled";
|
|
454
|
+
sessionId: string | null;
|
|
455
|
+
seq: number;
|
|
456
|
+
ts: string;
|
|
457
|
+
})[];
|
|
458
|
+
nextCursor: string;
|
|
459
|
+
}, {
|
|
460
|
+
state: "error" | "starting" | "running" | "ended" | "died" | "canceled";
|
|
461
|
+
runId: string;
|
|
462
|
+
events: ({
|
|
463
|
+
type: "text";
|
|
464
|
+
text: string;
|
|
465
|
+
seq: number;
|
|
466
|
+
ts: string;
|
|
467
|
+
} | {
|
|
468
|
+
name: string;
|
|
469
|
+
type: "tool";
|
|
470
|
+
seq: number;
|
|
471
|
+
ts: string;
|
|
472
|
+
} | {
|
|
473
|
+
type: "notice";
|
|
474
|
+
message: string;
|
|
475
|
+
sessionId: string | null;
|
|
476
|
+
seq: number;
|
|
477
|
+
ts: string;
|
|
478
|
+
} | {
|
|
479
|
+
type: "result";
|
|
480
|
+
sessionId: string | null;
|
|
481
|
+
seq: number;
|
|
482
|
+
ts: string;
|
|
483
|
+
subtype: string;
|
|
484
|
+
result?: unknown;
|
|
485
|
+
} | {
|
|
486
|
+
type: "end";
|
|
487
|
+
sessionId: string | null;
|
|
488
|
+
seq: number;
|
|
489
|
+
ts: string;
|
|
490
|
+
} | {
|
|
491
|
+
type: "error";
|
|
492
|
+
message: string;
|
|
493
|
+
sessionId: string | null;
|
|
494
|
+
seq: number;
|
|
495
|
+
ts: string;
|
|
496
|
+
} | {
|
|
497
|
+
type: "canceled";
|
|
498
|
+
sessionId: string | null;
|
|
499
|
+
seq: number;
|
|
500
|
+
ts: string;
|
|
501
|
+
})[];
|
|
502
|
+
nextCursor: string;
|
|
503
|
+
}>;
|
|
504
|
+
/**
|
|
505
|
+
* `GET /api/agent-runs/capabilities` (NOT-481): only clients whose real host
|
|
506
|
+
* preflight (installed and signed in) passes are listed. `start`/`resume`
|
|
507
|
+
* name the tool profiles the client can enforce; `same_profile_provenance`
|
|
508
|
+
* means a resume continues only a session an Agent Deck run on this host
|
|
509
|
+
* started with the same deck, cwd, and tools.
|
|
510
|
+
*/
|
|
511
|
+
export declare const AgentRunClientCapabilitySchema: z.ZodObject<{
|
|
512
|
+
client: z.ZodEnum<["claude", "codex", "cursor", "muse"]>;
|
|
513
|
+
start: z.ZodArray<z.ZodEnum<["readonly", "edit"]>, "many">;
|
|
514
|
+
resume: z.ZodArray<z.ZodEnum<["readonly", "edit"]>, "many">;
|
|
515
|
+
resumeRequires: z.ZodEnum<["none", "same_profile_provenance"]>;
|
|
516
|
+
}, "strict", z.ZodTypeAny, {
|
|
517
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
518
|
+
start: ("readonly" | "edit")[];
|
|
519
|
+
resume: ("readonly" | "edit")[];
|
|
520
|
+
resumeRequires: "none" | "same_profile_provenance";
|
|
521
|
+
}, {
|
|
522
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
523
|
+
start: ("readonly" | "edit")[];
|
|
524
|
+
resume: ("readonly" | "edit")[];
|
|
525
|
+
resumeRequires: "none" | "same_profile_provenance";
|
|
526
|
+
}>;
|
|
527
|
+
export declare const AgentRunCapabilitiesResponseSchema: z.ZodObject<{
|
|
528
|
+
/** Runs execute on the Agent Deck host; `cwd` is a path on that host. */
|
|
529
|
+
host: z.ZodLiteral<"same-host">;
|
|
530
|
+
clients: z.ZodArray<z.ZodObject<{
|
|
531
|
+
client: z.ZodEnum<["claude", "codex", "cursor", "muse"]>;
|
|
532
|
+
start: z.ZodArray<z.ZodEnum<["readonly", "edit"]>, "many">;
|
|
533
|
+
resume: z.ZodArray<z.ZodEnum<["readonly", "edit"]>, "many">;
|
|
534
|
+
resumeRequires: z.ZodEnum<["none", "same_profile_provenance"]>;
|
|
535
|
+
}, "strict", z.ZodTypeAny, {
|
|
536
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
537
|
+
start: ("readonly" | "edit")[];
|
|
538
|
+
resume: ("readonly" | "edit")[];
|
|
539
|
+
resumeRequires: "none" | "same_profile_provenance";
|
|
540
|
+
}, {
|
|
541
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
542
|
+
start: ("readonly" | "edit")[];
|
|
543
|
+
resume: ("readonly" | "edit")[];
|
|
544
|
+
resumeRequires: "none" | "same_profile_provenance";
|
|
545
|
+
}>, "many">;
|
|
546
|
+
}, "strict", z.ZodTypeAny, {
|
|
547
|
+
host: "same-host";
|
|
548
|
+
clients: {
|
|
549
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
550
|
+
start: ("readonly" | "edit")[];
|
|
551
|
+
resume: ("readonly" | "edit")[];
|
|
552
|
+
resumeRequires: "none" | "same_profile_provenance";
|
|
553
|
+
}[];
|
|
554
|
+
}, {
|
|
555
|
+
host: "same-host";
|
|
556
|
+
clients: {
|
|
557
|
+
client: "claude" | "cursor" | "codex" | "muse";
|
|
558
|
+
start: ("readonly" | "edit")[];
|
|
559
|
+
resume: ("readonly" | "edit")[];
|
|
560
|
+
resumeRequires: "none" | "same_profile_provenance";
|
|
561
|
+
}[];
|
|
562
|
+
}>;
|
|
563
|
+
/**
|
|
564
|
+
* NOT-486: one manifest entry. Repository-relative POSIX path; `sha256` is
|
|
565
|
+
* the SHA-256 of the exact working-tree bytes and `mode` the Git file mode.
|
|
566
|
+
* A deleted path carries `sha256: null` and `mode: null`.
|
|
567
|
+
*/
|
|
568
|
+
export declare const FINALIZATION_MANIFEST_MAX_FILES = 1000;
|
|
569
|
+
export declare const FINALIZATION_PATH_MAX_CHARS = 1024;
|
|
570
|
+
export declare const FINALIZATION_COMMIT_MESSAGE_MAX_CHARS = 8192;
|
|
571
|
+
export declare const FINALIZATION_REVIEW_ID_MAX_CHARS = 200;
|
|
572
|
+
export declare const FinalizationFileModeSchema: z.ZodEnum<["100644", "100755"]>;
|
|
573
|
+
export declare const FinalizationManifestEntrySchema: z.ZodEffects<z.ZodObject<{
|
|
574
|
+
path: z.ZodString;
|
|
575
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
576
|
+
mode: z.ZodNullable<z.ZodEnum<["100644", "100755"]>>;
|
|
577
|
+
}, "strict", z.ZodTypeAny, {
|
|
578
|
+
path: string;
|
|
579
|
+
mode: "100644" | "100755" | null;
|
|
580
|
+
sha256: string | null;
|
|
581
|
+
}, {
|
|
582
|
+
path: string;
|
|
583
|
+
mode: "100644" | "100755" | null;
|
|
584
|
+
sha256: string | null;
|
|
585
|
+
}>, {
|
|
586
|
+
path: string;
|
|
587
|
+
mode: "100644" | "100755" | null;
|
|
588
|
+
sha256: string | null;
|
|
589
|
+
}, {
|
|
590
|
+
path: string;
|
|
591
|
+
mode: "100644" | "100755" | null;
|
|
592
|
+
sha256: string | null;
|
|
593
|
+
}>;
|
|
594
|
+
/** `GET /api/agent-runs/:runId/changes`: the candidate manifest, ordered by path. */
|
|
595
|
+
export declare const AgentRunChangesResponseSchema: z.ZodObject<{
|
|
596
|
+
runId: z.ZodString;
|
|
597
|
+
baselineRef: z.ZodString;
|
|
598
|
+
baselineDigest: z.ZodString;
|
|
599
|
+
/** Pass as `expectedBaseCommit` when finalizing. */
|
|
600
|
+
baseCommit: z.ZodString;
|
|
601
|
+
files: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
602
|
+
path: z.ZodString;
|
|
603
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
604
|
+
mode: z.ZodNullable<z.ZodEnum<["100644", "100755"]>>;
|
|
605
|
+
}, "strict", z.ZodTypeAny, {
|
|
606
|
+
path: string;
|
|
607
|
+
mode: "100644" | "100755" | null;
|
|
608
|
+
sha256: string | null;
|
|
609
|
+
}, {
|
|
610
|
+
path: string;
|
|
611
|
+
mode: "100644" | "100755" | null;
|
|
612
|
+
sha256: string | null;
|
|
613
|
+
}>, {
|
|
614
|
+
path: string;
|
|
615
|
+
mode: "100644" | "100755" | null;
|
|
616
|
+
sha256: string | null;
|
|
617
|
+
}, {
|
|
618
|
+
path: string;
|
|
619
|
+
mode: "100644" | "100755" | null;
|
|
620
|
+
sha256: string | null;
|
|
621
|
+
}>, "many">;
|
|
622
|
+
manifestDigest: z.ZodString;
|
|
623
|
+
}, "strict", z.ZodTypeAny, {
|
|
624
|
+
runId: string;
|
|
625
|
+
baselineRef: string;
|
|
626
|
+
baselineDigest: string;
|
|
627
|
+
baseCommit: string;
|
|
628
|
+
files: {
|
|
629
|
+
path: string;
|
|
630
|
+
mode: "100644" | "100755" | null;
|
|
631
|
+
sha256: string | null;
|
|
632
|
+
}[];
|
|
633
|
+
manifestDigest: string;
|
|
634
|
+
}, {
|
|
635
|
+
runId: string;
|
|
636
|
+
baselineRef: string;
|
|
637
|
+
baselineDigest: string;
|
|
638
|
+
baseCommit: string;
|
|
639
|
+
files: {
|
|
640
|
+
path: string;
|
|
641
|
+
mode: "100644" | "100755" | null;
|
|
642
|
+
sha256: string | null;
|
|
643
|
+
}[];
|
|
644
|
+
manifestDigest: string;
|
|
645
|
+
}>;
|
|
646
|
+
/** `POST /api/agent-runs/:runId/finalize` (requires `Idempotency-Key`). */
|
|
647
|
+
export declare const FinalizeAgentRunRequestSchema: z.ZodObject<{
|
|
648
|
+
baselineDigest: z.ZodString;
|
|
649
|
+
expectedBaseCommit: z.ZodString;
|
|
650
|
+
reviewId: z.ZodString;
|
|
651
|
+
commitMessage: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
652
|
+
files: z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
653
|
+
path: z.ZodString;
|
|
654
|
+
sha256: z.ZodNullable<z.ZodString>;
|
|
655
|
+
mode: z.ZodNullable<z.ZodEnum<["100644", "100755"]>>;
|
|
656
|
+
}, "strict", z.ZodTypeAny, {
|
|
657
|
+
path: string;
|
|
658
|
+
mode: "100644" | "100755" | null;
|
|
659
|
+
sha256: string | null;
|
|
660
|
+
}, {
|
|
661
|
+
path: string;
|
|
662
|
+
mode: "100644" | "100755" | null;
|
|
663
|
+
sha256: string | null;
|
|
664
|
+
}>, {
|
|
665
|
+
path: string;
|
|
666
|
+
mode: "100644" | "100755" | null;
|
|
667
|
+
sha256: string | null;
|
|
668
|
+
}, {
|
|
669
|
+
path: string;
|
|
670
|
+
mode: "100644" | "100755" | null;
|
|
671
|
+
sha256: string | null;
|
|
672
|
+
}>, "many">;
|
|
673
|
+
}, "strict", z.ZodTypeAny, {
|
|
674
|
+
baselineDigest: string;
|
|
675
|
+
files: {
|
|
676
|
+
path: string;
|
|
677
|
+
mode: "100644" | "100755" | null;
|
|
678
|
+
sha256: string | null;
|
|
679
|
+
}[];
|
|
680
|
+
expectedBaseCommit: string;
|
|
681
|
+
reviewId: string;
|
|
682
|
+
commitMessage: string;
|
|
683
|
+
}, {
|
|
684
|
+
baselineDigest: string;
|
|
685
|
+
files: {
|
|
686
|
+
path: string;
|
|
687
|
+
mode: "100644" | "100755" | null;
|
|
688
|
+
sha256: string | null;
|
|
689
|
+
}[];
|
|
690
|
+
expectedBaseCommit: string;
|
|
691
|
+
reviewId: string;
|
|
692
|
+
commitMessage: string;
|
|
693
|
+
}>;
|
|
694
|
+
export declare const FinalizeAgentRunResponseSchema: z.ZodObject<{
|
|
695
|
+
runId: z.ZodString;
|
|
696
|
+
finalizationState: z.ZodLiteral<"finalized">;
|
|
697
|
+
commit: z.ZodString;
|
|
698
|
+
tree: z.ZodString;
|
|
699
|
+
parent: z.ZodString;
|
|
700
|
+
manifestDigest: z.ZodString;
|
|
701
|
+
fileCount: z.ZodNumber;
|
|
702
|
+
reviewId: z.ZodString;
|
|
703
|
+
}, "strict", z.ZodTypeAny, {
|
|
704
|
+
runId: string;
|
|
705
|
+
commit: string;
|
|
706
|
+
manifestDigest: string;
|
|
707
|
+
reviewId: string;
|
|
708
|
+
finalizationState: "finalized";
|
|
709
|
+
tree: string;
|
|
710
|
+
parent: string;
|
|
711
|
+
fileCount: number;
|
|
712
|
+
}, {
|
|
713
|
+
runId: string;
|
|
714
|
+
commit: string;
|
|
715
|
+
manifestDigest: string;
|
|
716
|
+
reviewId: string;
|
|
717
|
+
finalizationState: "finalized";
|
|
718
|
+
tree: string;
|
|
719
|
+
parent: string;
|
|
720
|
+
fileCount: number;
|
|
721
|
+
}>;
|
|
722
|
+
/** Run-specific error codes (auth failures use the trusted-session codes). */
|
|
723
|
+
export declare const AgentRunErrorCodeSchema: z.ZodEnum<["INVALID_REQUEST", "REQUEST_TOO_LARGE", "IDEMPOTENCY_KEY_REQUIRED", "IDEMPOTENCY_CONFLICT", "DECK_NOT_FOUND", "WORKSPACE_INVALID", "WORKSPACE_MISMATCH", "CLIENT_UNAVAILABLE", "PROFILE_UNSUPPORTED", "RESUME_UNVERIFIED", "RUN_NOT_FOUND", "RUN_NOT_CANCELABLE", "FINALIZATION_INVALID", "FINALIZATION_NOT_PREPARED", "RUN_NOT_TERMINAL", "BASE_MISMATCH", "INDEX_DIRTY", "BASELINE_MISMATCH", "PATH_INVALID", "PATH_UNEXPECTED", "DIGEST_MISMATCH", "GIT_LOCK_CONFLICT", "REF_RACE", "FINALIZATION_CANCELED", "FINALIZATION_FAILED"]>;
|
|
724
|
+
export type AgentRunClient = z.infer<typeof AgentRunClientSchema>;
|
|
725
|
+
export type AgentRunTools = z.infer<typeof AgentRunToolsSchema>;
|
|
726
|
+
export type CreateAgentRunRequest = z.infer<typeof CreateAgentRunRequestSchema>;
|
|
727
|
+
export type CreateAgentRunResponse = z.infer<typeof CreateAgentRunResponseSchema>;
|
|
728
|
+
export type AgentRunState = z.infer<typeof AgentRunStateSchema>;
|
|
729
|
+
export type AgentRunStatus = z.infer<typeof AgentRunStatusSchema>;
|
|
730
|
+
export type AgentRunEvent = z.infer<typeof AgentRunEventSchema>;
|
|
731
|
+
export type AgentRunEventsQuery = z.infer<typeof AgentRunEventsQuerySchema>;
|
|
732
|
+
export type AgentRunEventsResponse = z.infer<typeof AgentRunEventsResponseSchema>;
|
|
733
|
+
export type AgentRunErrorCode = z.infer<typeof AgentRunErrorCodeSchema>;
|
|
734
|
+
export type AgentRunClientCapability = z.infer<typeof AgentRunClientCapabilitySchema>;
|
|
735
|
+
export type AgentRunCapabilitiesResponse = z.infer<typeof AgentRunCapabilitiesResponseSchema>;
|
|
736
|
+
export type FinalizationState = z.infer<typeof FinalizationStateSchema>;
|
|
737
|
+
export type AgentRunFinalizationStatus = z.infer<typeof AgentRunFinalizationStatusSchema>;
|
|
738
|
+
export type FinalizationFileMode = z.infer<typeof FinalizationFileModeSchema>;
|
|
739
|
+
export type FinalizationManifestEntry = z.infer<typeof FinalizationManifestEntrySchema>;
|
|
740
|
+
export type AgentRunChangesResponse = z.infer<typeof AgentRunChangesResponseSchema>;
|
|
741
|
+
export type FinalizeAgentRunRequest = z.infer<typeof FinalizeAgentRunRequestSchema>;
|
|
742
|
+
export type FinalizeAgentRunResponse = z.infer<typeof FinalizeAgentRunResponseSchema>;
|
|
743
|
+
export type AgentRunErrorBody = {
|
|
744
|
+
success: false;
|
|
745
|
+
error: string;
|
|
746
|
+
error_code: AgentRunErrorCode;
|
|
747
|
+
};
|
|
748
|
+
export declare function agentRunError(code: AgentRunErrorCode, message: string): AgentRunErrorBody;
|
|
749
|
+
//# sourceMappingURL=agent-run.d.ts.map
|