@agent-deck/shared 2.1.0 → 2.2.0
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- 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/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
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './schemas/store';
|
|
|
11
11
|
export * from './schemas/session-bootstrap';
|
|
12
12
|
export * from './schemas/trusted-session';
|
|
13
13
|
export * from './schemas/card-usage';
|
|
14
|
+
export * from './schemas/agent-run';
|
|
14
15
|
export * from './types/api';
|
|
15
16
|
export { OAuthDiscoveryResult } from './types/oauth';
|
|
16
17
|
export * from './utils';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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|
29
29
|
__exportStar(require("./schemas/session-bootstrap"), exports);
|
|
30
30
|
__exportStar(require("./schemas/trusted-session"), exports);
|
|
31
31
|
__exportStar(require("./schemas/card-usage"), exports);
|
|
32
|
+
__exportStar(require("./schemas/agent-run"), exports);
|
|
32
33
|
// Additional types not covered by schemas
|
|
33
34
|
__exportStar(require("./types/api"), exports);
|
|
34
35
|
// Utils
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wCAAwC;AACxC,oDAAkC;AAClC,iDAA+B;AAC/B,uDAAqC;AACrC,kDAAgC;AAChC,qDAAmC;AACnC,2DAAyC;AACzC,4DAA0C;AAC1C,yDAAuC;AACvC,0DAAwC;AACxC,kDAAgC;AAChC,8DAA4C;AAC5C,4DAA0C;AAC1C,uDAAqC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wCAAwC;AACxC,oDAAkC;AAClC,iDAA+B;AAC/B,uDAAqC;AACrC,kDAAgC;AAChC,qDAAmC;AACnC,2DAAyC;AACzC,4DAA0C;AAC1C,yDAAuC;AACvC,0DAAwC;AACxC,kDAAgC;AAChC,8DAA4C;AAC5C,4DAA0C;AAC1C,uDAAqC;AACrC,sDAAoC;AAEpC,0CAA0C;AAC1C,8CAA4B;AAG5B,QAAQ;AACR,0CAAwB;AACxB,mEAQqC;AAPnC,kIAAA,2BAA2B,OAAA;AAC3B,yHAAA,kBAAkB,OAAA;AAClB,4HAAA,qBAAqB,OAAA;AACrB,0HAAA,mBAAmB,OAAA;AACnB,+HAAA,wBAAwB,OAAA;AAI1B,iEAIoC;AAHlC,oIAAA,8BAA8B,OAAA;AAC9B,+HAAA,yBAAyB,OAAA;AACzB,6HAAA,uBAAuB,OAAA;AAGzB,YAAY;AACZ,yDAUkC;AAThC,wHAAA,wBAAwB,OAAA;AACxB,2HAAA,2BAA2B,OAAA;AAC3B,uHAAA,uBAAuB,OAAA;AACvB,2HAAA,2BAA2B,OAAA;AAC3B,yHAAA,yBAAyB,OAAA;AACzB,6HAAA,6BAA6B,OAAA;AAC7B,mIAAA,mCAAmC,OAAA;AACnC,iIAAA,iCAAiC,OAAA;AACjC,6HAAA,6BAA6B,OAAA;AAE/B,+DASqC;AARnC,4HAAA,yBAAyB,OAAA;AACzB,8HAAA,2BAA2B,OAAA;AAC3B,2HAAA,wBAAwB,OAAA;AACxB,sHAAA,mBAAmB,OAAA;AACnB,yHAAA,sBAAsB,OAAA;AACtB,yHAAA,sBAAsB,OAAA;AACtB,6HAAA,0BAA0B,OAAA;AAC1B,8HAAA,2BAA2B,OAAA;AAE7B,uDAAuH;AAA9G,6GAAA,cAAc,OAAA;AAAE,iHAAA,kBAAkB,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAAE,kHAAA,mBAAmB,OAAA"}
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-run.d.ts","sourceRoot":"","sources":["../../src/schemas/agent-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AAEH,uDAAuD;AACvD,eAAO,MAAM,0BAA0B,QAAY,CAAC;AACpD,8DAA8D;AAC9D,eAAO,MAAM,kCAAkC,QAAa,CAAC;AAC7D,uEAAuE;AACvE,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAC9D,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAClD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C,eAAO,MAAM,oBAAoB,kDAAgD,CAAC;AAClF,eAAO,MAAM,mBAAmB,iCAA+B,CAAC;AAEhE,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB,aAAoD,CAAC;AAElF,eAAO,MAAM,4BAA4B,aAI2C,CAAC;AAMrF,eAAO,MAAM,2BAA2B;;;IAIpC,yDAAyD;;;IAUzD,2DAA2D;;IAE3D,6DAA6D;;IAE7D;;;;OAIG;;;;;;;;;;;;;;;;;;EAGI,CAAC;AAEZ;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,0EAAwE,CAAC;AACzG,eAAO,MAAM,yBAAyB,iDAAkD,CAAC;AAEzF,eAAO,MAAM,4BAA4B;;;;;;;;;EAK9B,CAAC;AAEZ,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,aAAsD,CAAC;AACrF,eAAO,MAAM,eAAe,aAAqC,CAAC;AAClE,mEAAmE;AACnE,eAAO,MAA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C,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAC9F,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,iBAAiB,CAAC;CAC/B,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAEzF"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AgentRunErrorCodeSchema = exports.FinalizeAgentRunResponseSchema = exports.FinalizeAgentRunRequestSchema = exports.AgentRunChangesResponseSchema = exports.FinalizationManifestEntrySchema = exports.FinalizationFileModeSchema = exports.FINALIZATION_REVIEW_ID_MAX_CHARS = exports.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS = exports.FINALIZATION_PATH_MAX_CHARS = exports.FINALIZATION_MANIFEST_MAX_FILES = exports.AgentRunCapabilitiesResponseSchema = exports.AgentRunClientCapabilitySchema = exports.AgentRunEventsResponseSchema = exports.AgentRunEventsQuerySchema = exports.AgentRunEventSchema = exports.AgentRunStatusSchema = exports.AgentRunFinalizationStatusSchema = exports.FinalizationStateSchema = exports.FinalizationBaselineRefSchema = exports.Sha256HexSchema = exports.GitObjectIdSchema = exports.CreateAgentRunResponseSchema = exports.AGENT_RUN_TERMINAL_STATES = exports.AgentRunStateSchema = exports.CreateAgentRunRequestSchema = exports.AgentRunIdempotencyKeySchema = exports.AgentRunIdSchema = exports.AgentRunToolsSchema = exports.AgentRunClientSchema = exports.AGENT_RUN_EVENTS_MAX_LIMIT = exports.AGENT_RUN_EVENTS_DEFAULT_LIMIT = exports.AGENT_RUN_IDEMPOTENCY_HEADER = exports.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES = exports.AGENT_RUN_PROMPT_MAX_CHARS = void 0;
|
|
4
|
+
exports.agentRunError = agentRunError;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
/**
|
|
7
|
+
* Agent run HTTP contract (NOT-480): one coding-agent attempt on the Agent
|
|
8
|
+
* Deck host, started or continued by an authenticated remote coordinator.
|
|
9
|
+
*
|
|
10
|
+
* Responses carry only public lifecycle fields and normalized events —
|
|
11
|
+
* never a host pid, a private log path, credentials, or an Authorization
|
|
12
|
+
* value. Success bodies are wrapped as `{ success: true, data }`.
|
|
13
|
+
*/
|
|
14
|
+
/** Prompt bound checked before launch (characters). */
|
|
15
|
+
exports.AGENT_RUN_PROMPT_MAX_CHARS = 64 * 1024;
|
|
16
|
+
/** Whole-request bound for `POST /api/agent-runs` (bytes). */
|
|
17
|
+
exports.AGENT_RUN_REQUEST_BODY_LIMIT_BYTES = 256 * 1024;
|
|
18
|
+
/** Required on `POST /api/agent-runs`; scoped to the calling grant. */
|
|
19
|
+
exports.AGENT_RUN_IDEMPOTENCY_HEADER = 'idempotency-key';
|
|
20
|
+
exports.AGENT_RUN_EVENTS_DEFAULT_LIMIT = 200;
|
|
21
|
+
exports.AGENT_RUN_EVENTS_MAX_LIMIT = 1000;
|
|
22
|
+
exports.AgentRunClientSchema = zod_1.z.enum(['claude', 'codex', 'cursor', 'muse']);
|
|
23
|
+
exports.AgentRunToolsSchema = zod_1.z.enum(['readonly', 'edit']);
|
|
24
|
+
/** Opaque run id (`run-<UTC stamp>-<hex>`). */
|
|
25
|
+
exports.AgentRunIdSchema = zod_1.z.string().regex(/^run-\d{8}T\d{6}-[0-9a-f]{6}$/);
|
|
26
|
+
exports.AgentRunIdempotencyKeySchema = zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.min(1)
|
|
29
|
+
.max(200)
|
|
30
|
+
.regex(/^[\x21-\x7e]+$/, 'Idempotency-Key must be printable ASCII without spaces');
|
|
31
|
+
function isAbsoluteHostPath(value) {
|
|
32
|
+
return value.startsWith('/') || /^[A-Za-z]:[\\/]/.test(value);
|
|
33
|
+
}
|
|
34
|
+
exports.CreateAgentRunRequestSchema = zod_1.z
|
|
35
|
+
.object({
|
|
36
|
+
deckId: zod_1.z.string().min(1).max(200),
|
|
37
|
+
client: exports.AgentRunClientSchema,
|
|
38
|
+
/** Absolute working directory on the Agent Deck host. */
|
|
39
|
+
cwd: zod_1.z
|
|
40
|
+
.string()
|
|
41
|
+
.min(1)
|
|
42
|
+
.max(4096)
|
|
43
|
+
.refine(isAbsoluteHostPath, 'cwd must be an absolute path on the Agent Deck host'),
|
|
44
|
+
prompt: zod_1.z
|
|
45
|
+
.string()
|
|
46
|
+
.max(exports.AGENT_RUN_PROMPT_MAX_CHARS)
|
|
47
|
+
.refine((value) => value.trim().length > 0, 'prompt must not be empty'),
|
|
48
|
+
/** Explicit tool profile; `readonly` only when omitted. */
|
|
49
|
+
tools: exports.AgentRunToolsSchema.default('readonly'),
|
|
50
|
+
/** Opaque client session id from an earlier run's status. */
|
|
51
|
+
resumeSessionId: zod_1.z.string().min(1).max(512).optional(),
|
|
52
|
+
/**
|
|
53
|
+
* NOT-486: capture a private pre-launch Git baseline so this run can be
|
|
54
|
+
* finalized into one local commit. Valid only with `tools: "edit"`, a Git
|
|
55
|
+
* worktree `cwd`, and a clean Git index.
|
|
56
|
+
*/
|
|
57
|
+
prepareFinalization: zod_1.z.boolean().default(false),
|
|
58
|
+
})
|
|
59
|
+
.strict();
|
|
60
|
+
/**
|
|
61
|
+
* Lifecycle state. `starting` is the launch acknowledgement (record written,
|
|
62
|
+
* no event yet); `running` has emitted events; `ended`, `error`, `died`, and
|
|
63
|
+
* `canceled` (NOT-481: operator cancellation, never an execution error) are
|
|
64
|
+
* terminal. `running` never implies success.
|
|
65
|
+
*/
|
|
66
|
+
exports.AgentRunStateSchema = zod_1.z.enum(['starting', 'running', 'ended', 'error', 'died', 'canceled']);
|
|
67
|
+
exports.AGENT_RUN_TERMINAL_STATES = ['ended', 'error', 'died', 'canceled'];
|
|
68
|
+
exports.CreateAgentRunResponseSchema = zod_1.z
|
|
69
|
+
.object({
|
|
70
|
+
runId: exports.AgentRunIdSchema,
|
|
71
|
+
state: exports.AgentRunStateSchema,
|
|
72
|
+
})
|
|
73
|
+
.strict();
|
|
74
|
+
/** Lowercase hex Git object id (SHA-1 or SHA-256 repositories). */
|
|
75
|
+
exports.GitObjectIdSchema = zod_1.z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/);
|
|
76
|
+
exports.Sha256HexSchema = zod_1.z.string().regex(/^[0-9a-f]{64}$/);
|
|
77
|
+
/** Opaque reference to a run's private pre-launch Git baseline. */
|
|
78
|
+
exports.FinalizationBaselineRefSchema = zod_1.z.string().regex(/^bl_[0-9a-f]{24}$/);
|
|
79
|
+
/**
|
|
80
|
+
* `prepared`: baseline captured, not finalized; `finalizing`: one finalize
|
|
81
|
+
* request is in progress; `finalized`: one local commit was created.
|
|
82
|
+
*/
|
|
83
|
+
exports.FinalizationStateSchema = zod_1.z.enum(['prepared', 'finalizing', 'finalized']);
|
|
84
|
+
/** Public finalization fields on a prepared run (never a host path or file content). */
|
|
85
|
+
exports.AgentRunFinalizationStatusSchema = zod_1.z
|
|
86
|
+
.object({
|
|
87
|
+
baselineRef: exports.FinalizationBaselineRefSchema,
|
|
88
|
+
baselineDigest: exports.Sha256HexSchema,
|
|
89
|
+
state: exports.FinalizationStateSchema,
|
|
90
|
+
commit: exports.GitObjectIdSchema.nullable(),
|
|
91
|
+
})
|
|
92
|
+
.strict();
|
|
93
|
+
exports.AgentRunStatusSchema = zod_1.z
|
|
94
|
+
.object({
|
|
95
|
+
runId: exports.AgentRunIdSchema,
|
|
96
|
+
deckId: zod_1.z.string(),
|
|
97
|
+
client: exports.AgentRunClientSchema,
|
|
98
|
+
tools: exports.AgentRunToolsSchema,
|
|
99
|
+
state: exports.AgentRunStateSchema,
|
|
100
|
+
/** Opaque client session id; pass as `resumeSessionId` to continue. */
|
|
101
|
+
sessionId: zod_1.z.string().nullable(),
|
|
102
|
+
startedAt: zod_1.z.string(),
|
|
103
|
+
lastEventAt: zod_1.z.string().nullable(),
|
|
104
|
+
/** NOT-486: present only when the run was started with `prepareFinalization`. */
|
|
105
|
+
finalization: exports.AgentRunFinalizationStatusSchema.nullable(),
|
|
106
|
+
})
|
|
107
|
+
.strict();
|
|
108
|
+
const eventBase = { seq: zod_1.z.number().int().positive(), ts: zod_1.z.string() };
|
|
109
|
+
/**
|
|
110
|
+
* Normalized run events, in log order. `seq` is the event's 1-based position
|
|
111
|
+
* in the canonical log: stable across reads and strictly increasing.
|
|
112
|
+
*/
|
|
113
|
+
exports.AgentRunEventSchema = zod_1.z.discriminatedUnion('type', [
|
|
114
|
+
zod_1.z.object({ ...eventBase, type: zod_1.z.literal('text'), text: zod_1.z.string() }).strict(),
|
|
115
|
+
zod_1.z.object({ ...eventBase, type: zod_1.z.literal('tool'), name: zod_1.z.string() }).strict(),
|
|
116
|
+
zod_1.z
|
|
117
|
+
.object({ ...eventBase, type: zod_1.z.literal('notice'), message: zod_1.z.string(), sessionId: zod_1.z.string().nullable() })
|
|
118
|
+
.strict(),
|
|
119
|
+
zod_1.z
|
|
120
|
+
.object({
|
|
121
|
+
...eventBase,
|
|
122
|
+
type: zod_1.z.literal('result'),
|
|
123
|
+
subtype: zod_1.z.string(),
|
|
124
|
+
result: zod_1.z.unknown(),
|
|
125
|
+
sessionId: zod_1.z.string().nullable(),
|
|
126
|
+
})
|
|
127
|
+
.strict(),
|
|
128
|
+
zod_1.z.object({ ...eventBase, type: zod_1.z.literal('end'), sessionId: zod_1.z.string().nullable() }).strict(),
|
|
129
|
+
zod_1.z
|
|
130
|
+
.object({ ...eventBase, type: zod_1.z.literal('error'), message: zod_1.z.string(), sessionId: zod_1.z.string().nullable() })
|
|
131
|
+
.strict(),
|
|
132
|
+
/** Terminal operator cancellation (NOT-481); no event follows it. */
|
|
133
|
+
zod_1.z.object({ ...eventBase, type: zod_1.z.literal('canceled'), sessionId: zod_1.z.string().nullable() }).strict(),
|
|
134
|
+
]);
|
|
135
|
+
exports.AgentRunEventsQuerySchema = zod_1.z
|
|
136
|
+
.object({
|
|
137
|
+
/** Cursor from a previous read's `nextCursor`; omitted reads from the start. */
|
|
138
|
+
after: zod_1.z.string().regex(/^\d+$/).optional(),
|
|
139
|
+
limit: zod_1.z.coerce.number().int().min(1).max(exports.AGENT_RUN_EVENTS_MAX_LIMIT).optional(),
|
|
140
|
+
})
|
|
141
|
+
.strict();
|
|
142
|
+
exports.AgentRunEventsResponseSchema = zod_1.z
|
|
143
|
+
.object({
|
|
144
|
+
runId: exports.AgentRunIdSchema,
|
|
145
|
+
state: exports.AgentRunStateSchema,
|
|
146
|
+
events: zod_1.z.array(exports.AgentRunEventSchema),
|
|
147
|
+
/** Pass as `after` to read the next page; unchanged when nothing new arrived. */
|
|
148
|
+
nextCursor: zod_1.z.string(),
|
|
149
|
+
})
|
|
150
|
+
.strict();
|
|
151
|
+
/**
|
|
152
|
+
* `GET /api/agent-runs/capabilities` (NOT-481): only clients whose real host
|
|
153
|
+
* preflight (installed and signed in) passes are listed. `start`/`resume`
|
|
154
|
+
* name the tool profiles the client can enforce; `same_profile_provenance`
|
|
155
|
+
* means a resume continues only a session an Agent Deck run on this host
|
|
156
|
+
* started with the same deck, cwd, and tools.
|
|
157
|
+
*/
|
|
158
|
+
exports.AgentRunClientCapabilitySchema = zod_1.z
|
|
159
|
+
.object({
|
|
160
|
+
client: exports.AgentRunClientSchema,
|
|
161
|
+
start: zod_1.z.array(exports.AgentRunToolsSchema),
|
|
162
|
+
resume: zod_1.z.array(exports.AgentRunToolsSchema),
|
|
163
|
+
resumeRequires: zod_1.z.enum(['none', 'same_profile_provenance']),
|
|
164
|
+
})
|
|
165
|
+
.strict();
|
|
166
|
+
exports.AgentRunCapabilitiesResponseSchema = zod_1.z
|
|
167
|
+
.object({
|
|
168
|
+
/** Runs execute on the Agent Deck host; `cwd` is a path on that host. */
|
|
169
|
+
host: zod_1.z.literal('same-host'),
|
|
170
|
+
clients: zod_1.z.array(exports.AgentRunClientCapabilitySchema),
|
|
171
|
+
})
|
|
172
|
+
.strict();
|
|
173
|
+
/**
|
|
174
|
+
* NOT-486: one manifest entry. Repository-relative POSIX path; `sha256` is
|
|
175
|
+
* the SHA-256 of the exact working-tree bytes and `mode` the Git file mode.
|
|
176
|
+
* A deleted path carries `sha256: null` and `mode: null`.
|
|
177
|
+
*/
|
|
178
|
+
exports.FINALIZATION_MANIFEST_MAX_FILES = 1000;
|
|
179
|
+
exports.FINALIZATION_PATH_MAX_CHARS = 1024;
|
|
180
|
+
exports.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS = 8192;
|
|
181
|
+
exports.FINALIZATION_REVIEW_ID_MAX_CHARS = 200;
|
|
182
|
+
exports.FinalizationFileModeSchema = zod_1.z.enum(['100644', '100755']);
|
|
183
|
+
exports.FinalizationManifestEntrySchema = zod_1.z
|
|
184
|
+
.object({
|
|
185
|
+
path: zod_1.z.string().min(1).max(exports.FINALIZATION_PATH_MAX_CHARS),
|
|
186
|
+
sha256: exports.Sha256HexSchema.nullable(),
|
|
187
|
+
mode: exports.FinalizationFileModeSchema.nullable(),
|
|
188
|
+
})
|
|
189
|
+
.strict()
|
|
190
|
+
.refine((entry) => (entry.sha256 === null) === (entry.mode === null), {
|
|
191
|
+
message: 'sha256 and mode are both null (deleted) or both set',
|
|
192
|
+
});
|
|
193
|
+
/** `GET /api/agent-runs/:runId/changes`: the candidate manifest, ordered by path. */
|
|
194
|
+
exports.AgentRunChangesResponseSchema = zod_1.z
|
|
195
|
+
.object({
|
|
196
|
+
runId: exports.AgentRunIdSchema,
|
|
197
|
+
baselineRef: exports.FinalizationBaselineRefSchema,
|
|
198
|
+
baselineDigest: exports.Sha256HexSchema,
|
|
199
|
+
/** Pass as `expectedBaseCommit` when finalizing. */
|
|
200
|
+
baseCommit: exports.GitObjectIdSchema,
|
|
201
|
+
files: zod_1.z.array(exports.FinalizationManifestEntrySchema),
|
|
202
|
+
manifestDigest: exports.Sha256HexSchema,
|
|
203
|
+
})
|
|
204
|
+
.strict();
|
|
205
|
+
/** `POST /api/agent-runs/:runId/finalize` (requires `Idempotency-Key`). */
|
|
206
|
+
exports.FinalizeAgentRunRequestSchema = zod_1.z
|
|
207
|
+
.object({
|
|
208
|
+
baselineDigest: exports.Sha256HexSchema,
|
|
209
|
+
expectedBaseCommit: exports.GitObjectIdSchema,
|
|
210
|
+
reviewId: zod_1.z
|
|
211
|
+
.string()
|
|
212
|
+
.min(1)
|
|
213
|
+
.max(exports.FINALIZATION_REVIEW_ID_MAX_CHARS)
|
|
214
|
+
.regex(/^[\x21-\x7e]+$/, 'reviewId must be printable ASCII without spaces'),
|
|
215
|
+
commitMessage: zod_1.z
|
|
216
|
+
.string()
|
|
217
|
+
.max(exports.FINALIZATION_COMMIT_MESSAGE_MAX_CHARS)
|
|
218
|
+
.refine((value) => value.trim().length > 0, 'commitMessage must not be empty')
|
|
219
|
+
.refine((value) => !value.includes('\u0000'), 'commitMessage must not contain NUL'),
|
|
220
|
+
files: zod_1.z.array(exports.FinalizationManifestEntrySchema).min(1).max(exports.FINALIZATION_MANIFEST_MAX_FILES),
|
|
221
|
+
})
|
|
222
|
+
.strict();
|
|
223
|
+
exports.FinalizeAgentRunResponseSchema = zod_1.z
|
|
224
|
+
.object({
|
|
225
|
+
runId: exports.AgentRunIdSchema,
|
|
226
|
+
finalizationState: zod_1.z.literal('finalized'),
|
|
227
|
+
commit: exports.GitObjectIdSchema,
|
|
228
|
+
tree: exports.GitObjectIdSchema,
|
|
229
|
+
parent: exports.GitObjectIdSchema,
|
|
230
|
+
manifestDigest: exports.Sha256HexSchema,
|
|
231
|
+
fileCount: zod_1.z.number().int().positive(),
|
|
232
|
+
reviewId: zod_1.z.string(),
|
|
233
|
+
})
|
|
234
|
+
.strict();
|
|
235
|
+
/** Run-specific error codes (auth failures use the trusted-session codes). */
|
|
236
|
+
exports.AgentRunErrorCodeSchema = zod_1.z.enum([
|
|
237
|
+
'INVALID_REQUEST',
|
|
238
|
+
'REQUEST_TOO_LARGE',
|
|
239
|
+
'IDEMPOTENCY_KEY_REQUIRED',
|
|
240
|
+
'IDEMPOTENCY_CONFLICT',
|
|
241
|
+
'DECK_NOT_FOUND',
|
|
242
|
+
'WORKSPACE_INVALID',
|
|
243
|
+
'WORKSPACE_MISMATCH',
|
|
244
|
+
'CLIENT_UNAVAILABLE',
|
|
245
|
+
'PROFILE_UNSUPPORTED',
|
|
246
|
+
'RESUME_UNVERIFIED',
|
|
247
|
+
'RUN_NOT_FOUND',
|
|
248
|
+
'RUN_NOT_CANCELABLE',
|
|
249
|
+
// NOT-486: finalization.
|
|
250
|
+
'FINALIZATION_INVALID',
|
|
251
|
+
'FINALIZATION_NOT_PREPARED',
|
|
252
|
+
'RUN_NOT_TERMINAL',
|
|
253
|
+
'BASE_MISMATCH',
|
|
254
|
+
'INDEX_DIRTY',
|
|
255
|
+
'BASELINE_MISMATCH',
|
|
256
|
+
'PATH_INVALID',
|
|
257
|
+
'PATH_UNEXPECTED',
|
|
258
|
+
'DIGEST_MISMATCH',
|
|
259
|
+
'GIT_LOCK_CONFLICT',
|
|
260
|
+
'REF_RACE',
|
|
261
|
+
'FINALIZATION_CANCELED',
|
|
262
|
+
'FINALIZATION_FAILED',
|
|
263
|
+
]);
|
|
264
|
+
function agentRunError(code, message) {
|
|
265
|
+
return { success: false, error: message, error_code: code };
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=agent-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-run.js","sourceRoot":"","sources":["../../src/schemas/agent-run.ts"],"names":[],"mappings":";;;AAwTA,sCAEC;AA1TD,6BAAwB;AAExB;;;;;;;GAOG;AAEH,uDAAuD;AAC1C,QAAA,0BAA0B,GAAG,EAAE,GAAG,IAAI,CAAC;AACpD,8DAA8D;AACjD,QAAA,kCAAkC,GAAG,GAAG,GAAG,IAAI,CAAC;AAC7D,uEAAuE;AAC1D,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AACjD,QAAA,8BAA8B,GAAG,GAAG,CAAC;AACrC,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAElC,QAAA,oBAAoB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACrE,QAAA,mBAAmB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhE,+CAA+C;AAClC,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;AAErE,QAAA,4BAA4B,GAAG,OAAC;KAC1C,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,KAA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E,yBAAiB;IACvB,MAAM,EAAE,yBAAiB;IACzB,cAAc,EAAE,uBAAe;IAC/B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;CACrB,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,8EAA8E;AACjE,QAAA,uBAAuB,GAAG,OAAC,CAAC,IAAI,CAAC;IAC5C,iBAAiB;IACjB,mBAAmB;IACnB,0BAA0B;IAC1B,sBAAsB;IACtB,gBAAgB;IAChB,mBAAmB;IACnB,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;IACrB,mBAAmB;IACnB,eAAe;IACf,oBAAoB;IACpB,yBAAyB;IACzB,sBAAsB;IACtB,2BAA2B;IAC3B,kBAAkB;IAClB,eAAe;IACf,aAAa;IACb,mBAAmB;IACnB,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,UAAU;IACV,uBAAuB;IACvB,qBAAqB;CACtB,CAAC,CAAC;AA4BH,SAAgB,aAAa,CAAC,IAAuB,EAAE,OAAe;IACpE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const AgentSessionModeSchema: z.ZodEnum<["normal", "agent-admin"]>;
|
|
3
|
-
export declare const TrustedSessionErrorCodeSchema: z.ZodEnum<["GRANT_REQUIRED", "SESSION_INVALID", "SESSION_REVOKED", "RESOURCE_OUT_OF_SCOPE", "ADMIN_REQUIRED", "DASHBOARD_REQUIRED", "ADMIN_CHALLENGE_EXPIRED", "DECK_FIXED", "SWITCH_APPROVAL_REQUIRED", "DECK_SWITCH_EXPIRED", "DECK_SWITCH_CONSUMED"]>;
|
|
3
|
+
export declare const TrustedSessionErrorCodeSchema: z.ZodEnum<["GRANT_REQUIRED", "SESSION_INVALID", "SESSION_REVOKED", "RESOURCE_OUT_OF_SCOPE", "ADMIN_REQUIRED", "DASHBOARD_REQUIRED", "ADMIN_CHALLENGE_EXPIRED", "DECK_FIXED", "SWITCH_APPROVAL_REQUIRED", "DECK_SWITCH_EXPIRED", "DECK_SWITCH_CONSUMED", "RUN_CAPABILITY_REQUIRED", "FINALIZATION_CAPABILITY_REQUIRED"]>;
|
|
4
4
|
/** @deprecated Legacy v2 grant file shape — CLI reads for migration only (NOT-108). */
|
|
5
5
|
export declare const WorkspaceGrantStatusSchema: z.ZodEnum<["pending", "active", "revoked"]>;
|
|
6
6
|
export declare const RuntimeSessionSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted-session.d.ts","sourceRoot":"","sources":["../../src/schemas/trusted-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB,sCAAoC,CAAC;AAExE,eAAO,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"trusted-session.d.ts","sourceRoot":"","sources":["../../src/schemas/trusted-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB,sCAAoC,CAAC;AAExE,eAAO,MAAM,6BAA6B,yTAoBxC,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,0BAA0B,6CAA2C,CAAC;AAEnF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;EAUtB,CAAC;AAEZ,gEAAgE;AAChE,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY9B,CAAC;AAEZ,oFAAoF;AACpF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA+B,CAAC;AAEtE,yDAAyD;AACzD,eAAO,M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AAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AAEZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -21,6 +21,10 @@ exports.TrustedSessionErrorCodeSchema = zod_1.z.enum([
|
|
|
21
21
|
'DECK_SWITCH_EXPIRED',
|
|
22
22
|
/** Deck-switch request already resolved; repeat resolution is a no-op (NOT-207). */
|
|
23
23
|
'DECK_SWITCH_CONSUMED',
|
|
24
|
+
/** Grant lacks the explicit agent-run capability (NOT-480). */
|
|
25
|
+
'RUN_CAPABILITY_REQUIRED',
|
|
26
|
+
/** Grant lacks the explicit run-finalization capability (NOT-486). */
|
|
27
|
+
'FINALIZATION_CAPABILITY_REQUIRED',
|
|
24
28
|
]);
|
|
25
29
|
/** @deprecated Legacy v2 grant file shape — CLI reads for migration only (NOT-108). */
|
|
26
30
|
exports.WorkspaceGrantStatusSchema = zod_1.z.enum(['pending', 'active', 'revoked']);
|
|
@@ -85,6 +89,8 @@ function httpStatusForTrustedError(code) {
|
|
|
85
89
|
case 'DASHBOARD_REQUIRED':
|
|
86
90
|
case 'DECK_FIXED':
|
|
87
91
|
case 'SWITCH_APPROVAL_REQUIRED':
|
|
92
|
+
case 'RUN_CAPABILITY_REQUIRED':
|
|
93
|
+
case 'FINALIZATION_CAPABILITY_REQUIRED':
|
|
88
94
|
return 403;
|
|
89
95
|
case 'DECK_SWITCH_CONSUMED':
|
|
90
96
|
return 409;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trusted-session.js","sourceRoot":"","sources":["../../src/schemas/trusted-session.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"trusted-session.js","sourceRoot":"","sources":["../../src/schemas/trusted-session.ts"],"names":[],"mappings":";;;AA+FA,kDAKC;A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