@osstack/protocol 0.13.0 → 0.20.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.
Files changed (52) hide show
  1. package/dist/generate.d.ts +1 -0
  2. package/dist/generate.d.ts.map +1 -1
  3. package/dist/generate.js +43 -1
  4. package/dist/generate.js.map +1 -1
  5. package/dist/graph-checkpoint.d.ts +409 -0
  6. package/dist/graph-checkpoint.d.ts.map +1 -0
  7. package/dist/graph-checkpoint.js +91 -0
  8. package/dist/graph-checkpoint.js.map +1 -0
  9. package/dist/graph-worker.d.ts +1663 -0
  10. package/dist/graph-worker.d.ts.map +1 -0
  11. package/dist/graph-worker.js +152 -0
  12. package/dist/graph-worker.js.map +1 -0
  13. package/dist/graph.d.ts +12875 -0
  14. package/dist/graph.d.ts.map +1 -0
  15. package/dist/graph.js +423 -0
  16. package/dist/graph.js.map +1 -0
  17. package/dist/index.d.ts +7 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +7 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/run.d.ts +2 -2
  22. package/dist/session-continuation-grant.d.ts +414 -0
  23. package/dist/session-continuation-grant.d.ts.map +1 -0
  24. package/dist/session-continuation-grant.js +59 -0
  25. package/dist/session-continuation-grant.js.map +1 -0
  26. package/dist/session-continuation.d.ts +129 -0
  27. package/dist/session-continuation.d.ts.map +1 -0
  28. package/dist/session-continuation.js +30 -0
  29. package/dist/session-continuation.js.map +1 -0
  30. package/dist/task.d.ts +2 -2
  31. package/package.json +2 -2
  32. package/schemas/continuation-grant-body.schema.json +189 -0
  33. package/schemas/continuation-output-check.schema.json +65 -0
  34. package/schemas/graph-checkpoint-request.schema.json +222 -0
  35. package/schemas/graph-checkpoint-response.schema.json +258 -0
  36. package/schemas/graph-worker.schema.json +546 -0
  37. package/schemas/graph.schema.json +1768 -0
  38. package/schemas/session-continuation-request.schema.json +62 -0
  39. package/schemas/session-decision.schema.json +107 -0
  40. package/schemas/signed-continuation-grant.schema.json +209 -0
  41. package/dist/autonomy.test.d.ts +0 -2
  42. package/dist/autonomy.test.d.ts.map +0 -1
  43. package/dist/autonomy.test.js +0 -201
  44. package/dist/autonomy.test.js.map +0 -1
  45. package/dist/protocol.test.d.ts +0 -2
  46. package/dist/protocol.test.d.ts.map +0 -1
  47. package/dist/protocol.test.js +0 -251
  48. package/dist/protocol.test.js.map +0 -1
  49. package/dist/schemas.test.d.ts +0 -2
  50. package/dist/schemas.test.d.ts.map +0 -1
  51. package/dist/schemas.test.js +0 -39
  52. package/dist/schemas.test.js.map +0 -1
@@ -0,0 +1,414 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Equality against persisted assistant_text only. These checks attest to the
4
+ * declared output contract, never open-ended task quality or an R3 approval.
5
+ * A JSON path is a sequence of literal keys; [] selects the root primitive.
6
+ * Consumers must use own-property traversal, not eval or prototype lookup.
7
+ */
8
+ export declare const OutputCheck: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
9
+ kind: z.ZodLiteral<"text_equals">;
10
+ expected: z.ZodString;
11
+ }, "strict", z.ZodTypeAny, {
12
+ expected: string;
13
+ kind: "text_equals";
14
+ }, {
15
+ expected: string;
16
+ kind: "text_equals";
17
+ }>, z.ZodObject<{
18
+ kind: z.ZodLiteral<"json_value_equals">;
19
+ path: z.ZodArray<z.ZodString, "many">;
20
+ expected: z.ZodUnion<[z.ZodNull, z.ZodString, z.ZodNumber, z.ZodBoolean]>;
21
+ }, "strict", z.ZodTypeAny, {
22
+ path: string[];
23
+ expected: string | number | boolean | null;
24
+ kind: "json_value_equals";
25
+ }, {
26
+ path: string[];
27
+ expected: string | number | boolean | null;
28
+ kind: "json_value_equals";
29
+ }>]>;
30
+ export type OutputCheck = z.infer<typeof OutputCheck>;
31
+ /** The checks must pass before the frozen instruction for this step is sent. */
32
+ export declare const ContinuationGrantStep: z.ZodObject<{
33
+ phase: z.ZodString;
34
+ instruction: z.ZodEffects<z.ZodString, string, string>;
35
+ checks: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
36
+ kind: z.ZodLiteral<"text_equals">;
37
+ expected: z.ZodString;
38
+ }, "strict", z.ZodTypeAny, {
39
+ expected: string;
40
+ kind: "text_equals";
41
+ }, {
42
+ expected: string;
43
+ kind: "text_equals";
44
+ }>, z.ZodObject<{
45
+ kind: z.ZodLiteral<"json_value_equals">;
46
+ path: z.ZodArray<z.ZodString, "many">;
47
+ expected: z.ZodUnion<[z.ZodNull, z.ZodString, z.ZodNumber, z.ZodBoolean]>;
48
+ }, "strict", z.ZodTypeAny, {
49
+ path: string[];
50
+ expected: string | number | boolean | null;
51
+ kind: "json_value_equals";
52
+ }, {
53
+ path: string[];
54
+ expected: string | number | boolean | null;
55
+ kind: "json_value_equals";
56
+ }>]>, "many">;
57
+ retry_instruction: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
58
+ max_retries: z.ZodDefault<z.ZodNumber>;
59
+ }, "strict", z.ZodTypeAny, {
60
+ phase: string;
61
+ instruction: string;
62
+ checks: ({
63
+ expected: string;
64
+ kind: "text_equals";
65
+ } | {
66
+ path: string[];
67
+ expected: string | number | boolean | null;
68
+ kind: "json_value_equals";
69
+ })[];
70
+ max_retries: number;
71
+ retry_instruction?: string | undefined;
72
+ }, {
73
+ phase: string;
74
+ instruction: string;
75
+ checks: ({
76
+ expected: string;
77
+ kind: "text_equals";
78
+ } | {
79
+ path: string[];
80
+ expected: string | number | boolean | null;
81
+ kind: "json_value_equals";
82
+ })[];
83
+ retry_instruction?: string | undefined;
84
+ max_retries?: number | undefined;
85
+ }>;
86
+ export type ContinuationGrantStep = z.infer<typeof ContinuationGrantStep>;
87
+ /**
88
+ * A finite delegation bound to one session, runtime policy, repository and
89
+ * initial turn/version. "Completed" means all delegated instructions were sent
90
+ * and completed; it does not mean the user's overall objective was achieved.
91
+ * Signature verification, time validity and durable consumption are runtime
92
+ * responsibilities. This schema does not grant GitHub or R3 approval powers.
93
+ */
94
+ export declare const ContinuationGrantBody: z.ZodObject<{
95
+ version: z.ZodLiteral<1>;
96
+ grant_id: z.ZodString;
97
+ session_id: z.ZodString;
98
+ runtime_id: z.ZodString;
99
+ runtime_policy_sha256: z.ZodString;
100
+ repo_path: z.ZodEffects<z.ZodString, string, string>;
101
+ initial_turn_id: z.ZodString;
102
+ initial_version: z.ZodNumber;
103
+ issued_at: z.ZodString;
104
+ expires_at: z.ZodString;
105
+ max_resumes: z.ZodNumber;
106
+ max_checks: z.ZodNumber;
107
+ turn_timeout_ms: z.ZodNumber;
108
+ steps: z.ZodArray<z.ZodObject<{
109
+ phase: z.ZodString;
110
+ instruction: z.ZodEffects<z.ZodString, string, string>;
111
+ checks: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
112
+ kind: z.ZodLiteral<"text_equals">;
113
+ expected: z.ZodString;
114
+ }, "strict", z.ZodTypeAny, {
115
+ expected: string;
116
+ kind: "text_equals";
117
+ }, {
118
+ expected: string;
119
+ kind: "text_equals";
120
+ }>, z.ZodObject<{
121
+ kind: z.ZodLiteral<"json_value_equals">;
122
+ path: z.ZodArray<z.ZodString, "many">;
123
+ expected: z.ZodUnion<[z.ZodNull, z.ZodString, z.ZodNumber, z.ZodBoolean]>;
124
+ }, "strict", z.ZodTypeAny, {
125
+ path: string[];
126
+ expected: string | number | boolean | null;
127
+ kind: "json_value_equals";
128
+ }, {
129
+ path: string[];
130
+ expected: string | number | boolean | null;
131
+ kind: "json_value_equals";
132
+ }>]>, "many">;
133
+ retry_instruction: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
134
+ max_retries: z.ZodDefault<z.ZodNumber>;
135
+ }, "strict", z.ZodTypeAny, {
136
+ phase: string;
137
+ instruction: string;
138
+ checks: ({
139
+ expected: string;
140
+ kind: "text_equals";
141
+ } | {
142
+ path: string[];
143
+ expected: string | number | boolean | null;
144
+ kind: "json_value_equals";
145
+ })[];
146
+ max_retries: number;
147
+ retry_instruction?: string | undefined;
148
+ }, {
149
+ phase: string;
150
+ instruction: string;
151
+ checks: ({
152
+ expected: string;
153
+ kind: "text_equals";
154
+ } | {
155
+ path: string[];
156
+ expected: string | number | boolean | null;
157
+ kind: "json_value_equals";
158
+ })[];
159
+ retry_instruction?: string | undefined;
160
+ max_retries?: number | undefined;
161
+ }>, "many">;
162
+ }, "strict", z.ZodTypeAny, {
163
+ expires_at: string;
164
+ issued_at: string;
165
+ session_id: string;
166
+ version: 1;
167
+ grant_id: string;
168
+ runtime_id: string;
169
+ runtime_policy_sha256: string;
170
+ repo_path: string;
171
+ initial_turn_id: string;
172
+ initial_version: number;
173
+ max_resumes: number;
174
+ max_checks: number;
175
+ turn_timeout_ms: number;
176
+ steps: {
177
+ phase: string;
178
+ instruction: string;
179
+ checks: ({
180
+ expected: string;
181
+ kind: "text_equals";
182
+ } | {
183
+ path: string[];
184
+ expected: string | number | boolean | null;
185
+ kind: "json_value_equals";
186
+ })[];
187
+ max_retries: number;
188
+ retry_instruction?: string | undefined;
189
+ }[];
190
+ }, {
191
+ expires_at: string;
192
+ issued_at: string;
193
+ session_id: string;
194
+ version: 1;
195
+ grant_id: string;
196
+ runtime_id: string;
197
+ runtime_policy_sha256: string;
198
+ repo_path: string;
199
+ initial_turn_id: string;
200
+ initial_version: number;
201
+ max_resumes: number;
202
+ max_checks: number;
203
+ turn_timeout_ms: number;
204
+ steps: {
205
+ phase: string;
206
+ instruction: string;
207
+ checks: ({
208
+ expected: string;
209
+ kind: "text_equals";
210
+ } | {
211
+ path: string[];
212
+ expected: string | number | boolean | null;
213
+ kind: "json_value_equals";
214
+ })[];
215
+ retry_instruction?: string | undefined;
216
+ max_retries?: number | undefined;
217
+ }[];
218
+ }>;
219
+ export type ContinuationGrantBody = z.infer<typeof ContinuationGrantBody>;
220
+ export declare const SignedContinuationGrant: z.ZodObject<{
221
+ body: z.ZodObject<{
222
+ version: z.ZodLiteral<1>;
223
+ grant_id: z.ZodString;
224
+ session_id: z.ZodString;
225
+ runtime_id: z.ZodString;
226
+ runtime_policy_sha256: z.ZodString;
227
+ repo_path: z.ZodEffects<z.ZodString, string, string>;
228
+ initial_turn_id: z.ZodString;
229
+ initial_version: z.ZodNumber;
230
+ issued_at: z.ZodString;
231
+ expires_at: z.ZodString;
232
+ max_resumes: z.ZodNumber;
233
+ max_checks: z.ZodNumber;
234
+ turn_timeout_ms: z.ZodNumber;
235
+ steps: z.ZodArray<z.ZodObject<{
236
+ phase: z.ZodString;
237
+ instruction: z.ZodEffects<z.ZodString, string, string>;
238
+ checks: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
239
+ kind: z.ZodLiteral<"text_equals">;
240
+ expected: z.ZodString;
241
+ }, "strict", z.ZodTypeAny, {
242
+ expected: string;
243
+ kind: "text_equals";
244
+ }, {
245
+ expected: string;
246
+ kind: "text_equals";
247
+ }>, z.ZodObject<{
248
+ kind: z.ZodLiteral<"json_value_equals">;
249
+ path: z.ZodArray<z.ZodString, "many">;
250
+ expected: z.ZodUnion<[z.ZodNull, z.ZodString, z.ZodNumber, z.ZodBoolean]>;
251
+ }, "strict", z.ZodTypeAny, {
252
+ path: string[];
253
+ expected: string | number | boolean | null;
254
+ kind: "json_value_equals";
255
+ }, {
256
+ path: string[];
257
+ expected: string | number | boolean | null;
258
+ kind: "json_value_equals";
259
+ }>]>, "many">;
260
+ retry_instruction: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
261
+ max_retries: z.ZodDefault<z.ZodNumber>;
262
+ }, "strict", z.ZodTypeAny, {
263
+ phase: string;
264
+ instruction: string;
265
+ checks: ({
266
+ expected: string;
267
+ kind: "text_equals";
268
+ } | {
269
+ path: string[];
270
+ expected: string | number | boolean | null;
271
+ kind: "json_value_equals";
272
+ })[];
273
+ max_retries: number;
274
+ retry_instruction?: string | undefined;
275
+ }, {
276
+ phase: string;
277
+ instruction: string;
278
+ checks: ({
279
+ expected: string;
280
+ kind: "text_equals";
281
+ } | {
282
+ path: string[];
283
+ expected: string | number | boolean | null;
284
+ kind: "json_value_equals";
285
+ })[];
286
+ retry_instruction?: string | undefined;
287
+ max_retries?: number | undefined;
288
+ }>, "many">;
289
+ }, "strict", z.ZodTypeAny, {
290
+ expires_at: string;
291
+ issued_at: string;
292
+ session_id: string;
293
+ version: 1;
294
+ grant_id: string;
295
+ runtime_id: string;
296
+ runtime_policy_sha256: string;
297
+ repo_path: string;
298
+ initial_turn_id: string;
299
+ initial_version: number;
300
+ max_resumes: number;
301
+ max_checks: number;
302
+ turn_timeout_ms: number;
303
+ steps: {
304
+ phase: string;
305
+ instruction: string;
306
+ checks: ({
307
+ expected: string;
308
+ kind: "text_equals";
309
+ } | {
310
+ path: string[];
311
+ expected: string | number | boolean | null;
312
+ kind: "json_value_equals";
313
+ })[];
314
+ max_retries: number;
315
+ retry_instruction?: string | undefined;
316
+ }[];
317
+ }, {
318
+ expires_at: string;
319
+ issued_at: string;
320
+ session_id: string;
321
+ version: 1;
322
+ grant_id: string;
323
+ runtime_id: string;
324
+ runtime_policy_sha256: string;
325
+ repo_path: string;
326
+ initial_turn_id: string;
327
+ initial_version: number;
328
+ max_resumes: number;
329
+ max_checks: number;
330
+ turn_timeout_ms: number;
331
+ steps: {
332
+ phase: string;
333
+ instruction: string;
334
+ checks: ({
335
+ expected: string;
336
+ kind: "text_equals";
337
+ } | {
338
+ path: string[];
339
+ expected: string | number | boolean | null;
340
+ kind: "json_value_equals";
341
+ })[];
342
+ retry_instruction?: string | undefined;
343
+ max_retries?: number | undefined;
344
+ }[];
345
+ }>;
346
+ key_id: z.ZodString;
347
+ signature: z.ZodString;
348
+ }, "strict", z.ZodTypeAny, {
349
+ key_id: string;
350
+ signature: string;
351
+ body: {
352
+ expires_at: string;
353
+ issued_at: string;
354
+ session_id: string;
355
+ version: 1;
356
+ grant_id: string;
357
+ runtime_id: string;
358
+ runtime_policy_sha256: string;
359
+ repo_path: string;
360
+ initial_turn_id: string;
361
+ initial_version: number;
362
+ max_resumes: number;
363
+ max_checks: number;
364
+ turn_timeout_ms: number;
365
+ steps: {
366
+ phase: string;
367
+ instruction: string;
368
+ checks: ({
369
+ expected: string;
370
+ kind: "text_equals";
371
+ } | {
372
+ path: string[];
373
+ expected: string | number | boolean | null;
374
+ kind: "json_value_equals";
375
+ })[];
376
+ max_retries: number;
377
+ retry_instruction?: string | undefined;
378
+ }[];
379
+ };
380
+ }, {
381
+ key_id: string;
382
+ signature: string;
383
+ body: {
384
+ expires_at: string;
385
+ issued_at: string;
386
+ session_id: string;
387
+ version: 1;
388
+ grant_id: string;
389
+ runtime_id: string;
390
+ runtime_policy_sha256: string;
391
+ repo_path: string;
392
+ initial_turn_id: string;
393
+ initial_version: number;
394
+ max_resumes: number;
395
+ max_checks: number;
396
+ turn_timeout_ms: number;
397
+ steps: {
398
+ phase: string;
399
+ instruction: string;
400
+ checks: ({
401
+ expected: string;
402
+ kind: "text_equals";
403
+ } | {
404
+ path: string[];
405
+ expected: string | number | boolean | null;
406
+ kind: "json_value_equals";
407
+ })[];
408
+ retry_instruction?: string | undefined;
409
+ max_retries?: number | undefined;
410
+ }[];
411
+ };
412
+ }>;
413
+ export type SignedContinuationGrant = z.infer<typeof SignedContinuationGrant>;
414
+ //# sourceMappingURL=session-continuation-grant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-continuation-grant.d.ts","sourceRoot":"","sources":["../src/session-continuation-grant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;IAUtB,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,gFAAgF;AAChF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMvB,CAAC;AACZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAevB,CAAC;AACZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOzB,CAAC;AACZ,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+ const Id = z.string().trim().min(1).max(256);
3
+ const Timestamp = z.string().datetime({ offset: true });
4
+ const Instruction = z.string().min(1).max(16_000).refine((value) => value.trim().length > 0, "instruction must contain non-whitespace text");
5
+ const AbsolutePath = z.string().max(4_096).regex(/^(?:\/|[A-Za-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+(?:[\\/]|$))/, "repo_path must be an absolute path").refine((value) => !value.includes("\0"), "repo_path must not contain NUL characters");
6
+ /**
7
+ * Equality against persisted assistant_text only. These checks attest to the
8
+ * declared output contract, never open-ended task quality or an R3 approval.
9
+ * A JSON path is a sequence of literal keys; [] selects the root primitive.
10
+ * Consumers must use own-property traversal, not eval or prototype lookup.
11
+ */
12
+ export const OutputCheck = z.discriminatedUnion("kind", [
13
+ z.object({
14
+ kind: z.literal("text_equals"),
15
+ expected: z.string().max(4_000),
16
+ }).strict(),
17
+ z.object({
18
+ kind: z.literal("json_value_equals"),
19
+ path: z.array(z.string().max(256)).max(8),
20
+ expected: z.union([z.null(), z.string().max(4_000), z.number().finite(), z.boolean()]),
21
+ }).strict(),
22
+ ]);
23
+ /** The checks must pass before the frozen instruction for this step is sent. */
24
+ export const ContinuationGrantStep = z.object({
25
+ phase: Id,
26
+ instruction: Instruction,
27
+ checks: z.array(OutputCheck).min(1).max(16),
28
+ retry_instruction: Instruction.optional(),
29
+ max_retries: z.number().int().min(0).max(3).default(0),
30
+ }).strict();
31
+ /**
32
+ * A finite delegation bound to one session, runtime policy, repository and
33
+ * initial turn/version. "Completed" means all delegated instructions were sent
34
+ * and completed; it does not mean the user's overall objective was achieved.
35
+ * Signature verification, time validity and durable consumption are runtime
36
+ * responsibilities. This schema does not grant GitHub or R3 approval powers.
37
+ */
38
+ export const ContinuationGrantBody = z.object({
39
+ version: z.literal(1),
40
+ grant_id: Id,
41
+ session_id: Id,
42
+ runtime_id: Id,
43
+ runtime_policy_sha256: z.string().regex(/^[a-f0-9]{64}$/),
44
+ repo_path: AbsolutePath,
45
+ initial_turn_id: Id,
46
+ initial_version: z.number().int().min(1),
47
+ issued_at: Timestamp,
48
+ expires_at: Timestamp,
49
+ max_resumes: z.number().int().min(1).max(32),
50
+ max_checks: z.number().int().min(1).max(64),
51
+ turn_timeout_ms: z.number().int().min(100).max(300_000),
52
+ steps: z.array(ContinuationGrantStep).min(1).max(16),
53
+ }).strict();
54
+ export const SignedContinuationGrant = z.object({
55
+ body: ContinuationGrantBody,
56
+ key_id: Id,
57
+ signature: z.string().regex(/^[A-Za-z0-9+/]{85}[AQgw]==$/, "signature must be canonical base64 for a 64-byte Ed25519 signature"),
58
+ }).strict();
59
+ //# sourceMappingURL=session-continuation-grant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-continuation-grant.js","sourceRoot":"","sources":["../src/session-continuation-grant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,C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WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3C,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;IACvD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;CACrD,CAAC,CAAC,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,qBAAqB;IAC3B,MAAM,EAAE,EAAE;IACV,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CACzB,6BAA6B,EAC7B,oEAAoE,CACrE;CACF,CAAC,CAAC,MAAM,EAAE,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { z } from "zod";
2
+ export declare const SessionGateKind: z.ZodEnum<["phase_continue", "task_authorization", "risk_approval", "external_input"]>;
3
+ export type SessionGateKind = z.infer<typeof SessionGateKind>;
4
+ /** An agent-reported request, never a grant or proof that a gate passed. */
5
+ export declare const SessionContinuationRequest: z.ZodObject<{
6
+ version: z.ZodLiteral<1>;
7
+ gate_kind: z.ZodEnum<["phase_continue", "task_authorization", "risk_approval", "external_input"]>;
8
+ phase: z.ZodString;
9
+ next_action: z.ZodString;
10
+ evidence_refs: z.ZodArray<z.ZodObject<{
11
+ evidence_id: z.ZodString;
12
+ sha256: z.ZodString;
13
+ }, "strict", z.ZodTypeAny, {
14
+ sha256: string;
15
+ evidence_id: string;
16
+ }, {
17
+ sha256: string;
18
+ evidence_id: string;
19
+ }>, "many">;
20
+ }, "strict", z.ZodTypeAny, {
21
+ phase: string;
22
+ evidence_refs: {
23
+ sha256: string;
24
+ evidence_id: string;
25
+ }[];
26
+ version: 1;
27
+ gate_kind: "phase_continue" | "task_authorization" | "risk_approval" | "external_input";
28
+ next_action: string;
29
+ }, {
30
+ phase: string;
31
+ evidence_refs: {
32
+ sha256: string;
33
+ evidence_id: string;
34
+ }[];
35
+ version: 1;
36
+ gate_kind: "phase_continue" | "task_authorization" | "risk_approval" | "external_input";
37
+ next_action: string;
38
+ }>;
39
+ export type SessionContinuationRequest = z.infer<typeof SessionContinuationRequest>;
40
+ export declare const SessionDecision: z.ZodObject<{
41
+ decision_id: z.ZodString;
42
+ question: z.ZodString;
43
+ choices: z.ZodEffects<z.ZodArray<z.ZodObject<{
44
+ choice_id: z.ZodString;
45
+ label: z.ZodString;
46
+ }, "strict", z.ZodTypeAny, {
47
+ choice_id: string;
48
+ label: string;
49
+ }, {
50
+ choice_id: string;
51
+ label: string;
52
+ }>, "many">, {
53
+ choice_id: string;
54
+ label: string;
55
+ }[], {
56
+ choice_id: string;
57
+ label: string;
58
+ }[]>;
59
+ continuation: z.ZodOptional<z.ZodObject<{
60
+ version: z.ZodLiteral<1>;
61
+ gate_kind: z.ZodEnum<["phase_continue", "task_authorization", "risk_approval", "external_input"]>;
62
+ phase: z.ZodString;
63
+ next_action: z.ZodString;
64
+ evidence_refs: z.ZodArray<z.ZodObject<{
65
+ evidence_id: z.ZodString;
66
+ sha256: z.ZodString;
67
+ }, "strict", z.ZodTypeAny, {
68
+ sha256: string;
69
+ evidence_id: string;
70
+ }, {
71
+ sha256: string;
72
+ evidence_id: string;
73
+ }>, "many">;
74
+ }, "strict", z.ZodTypeAny, {
75
+ phase: string;
76
+ evidence_refs: {
77
+ sha256: string;
78
+ evidence_id: string;
79
+ }[];
80
+ version: 1;
81
+ gate_kind: "phase_continue" | "task_authorization" | "risk_approval" | "external_input";
82
+ next_action: string;
83
+ }, {
84
+ phase: string;
85
+ evidence_refs: {
86
+ sha256: string;
87
+ evidence_id: string;
88
+ }[];
89
+ version: 1;
90
+ gate_kind: "phase_continue" | "task_authorization" | "risk_approval" | "external_input";
91
+ next_action: string;
92
+ }>>;
93
+ }, "strict", z.ZodTypeAny, {
94
+ decision_id: string;
95
+ question: string;
96
+ choices: {
97
+ choice_id: string;
98
+ label: string;
99
+ }[];
100
+ continuation?: {
101
+ phase: string;
102
+ evidence_refs: {
103
+ sha256: string;
104
+ evidence_id: string;
105
+ }[];
106
+ version: 1;
107
+ gate_kind: "phase_continue" | "task_authorization" | "risk_approval" | "external_input";
108
+ next_action: string;
109
+ } | undefined;
110
+ }, {
111
+ decision_id: string;
112
+ question: string;
113
+ choices: {
114
+ choice_id: string;
115
+ label: string;
116
+ }[];
117
+ continuation?: {
118
+ phase: string;
119
+ evidence_refs: {
120
+ sha256: string;
121
+ evidence_id: string;
122
+ }[];
123
+ version: 1;
124
+ gate_kind: "phase_continue" | "task_authorization" | "risk_approval" | "external_input";
125
+ next_action: string;
126
+ } | undefined;
127
+ }>;
128
+ export type SessionDecision = z.infer<typeof SessionDecision>;
129
+ //# sourceMappingURL=session-continuation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-continuation.d.ts","sourceRoot":"","sources":["../src/session-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe,wFAK1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,4EAA4E;AAC5E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AACZ,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEpF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYjB,CAAC;AACZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ const Id = z.string().trim().min(1).max(256);
3
+ export const SessionGateKind = z.enum([
4
+ "phase_continue",
5
+ "task_authorization",
6
+ "risk_approval",
7
+ "external_input",
8
+ ]);
9
+ /** An agent-reported request, never a grant or proof that a gate passed. */
10
+ export const SessionContinuationRequest = z.object({
11
+ version: z.literal(1),
12
+ gate_kind: SessionGateKind,
13
+ phase: Id,
14
+ next_action: z.string().trim().min(1).max(1_000),
15
+ evidence_refs: z.array(z.object({
16
+ evidence_id: Id,
17
+ sha256: z.string().regex(/^[a-f0-9]{64}$/),
18
+ }).strict()).max(32),
19
+ }).strict();
20
+ export const SessionDecision = z.object({
21
+ decision_id: Id,
22
+ question: z.string().trim().min(1).max(1_000),
23
+ // Empty choices remain valid for legacy adapters requesting free-form input.
24
+ choices: z.array(z.object({
25
+ choice_id: Id,
26
+ label: z.string().trim().min(1).max(160),
27
+ }).strict()).max(8).refine((choices) => new Set(choices.map((choice) => choice.choice_id)).size === choices.length, "choice IDs must be unique"),
28
+ continuation: SessionContinuationRequest.optional(),
29
+ }).strict();
30
+ //# sourceMappingURL=session-continuation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-continuation.js","sourceRoot":"","sources":["../src/session-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;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AC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,EACvF,2BAA2B,CAC5B;IACD,YAAY,EAAE,0BAA0B,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC,MAAM,EAAE,CAAC"}
package/dist/task.d.ts CHANGED
@@ -20,18 +20,18 @@ export declare const Task: z.ZodObject<{
20
20
  */
21
21
  evaluation: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
22
22
  }, "strict", z.ZodTypeAny, {
23
+ source: "git_diff" | "gh_issue" | "github_branch" | "ci_log" | "task_queue" | "manual";
23
24
  task_id: string;
24
25
  capability: string;
25
26
  prompt: string;
26
- source: "git_diff" | "gh_issue" | "github_branch" | "ci_log" | "task_queue" | "manual";
27
27
  priority: number;
28
28
  context?: Record<string, unknown> | undefined;
29
29
  evaluation?: unknown[] | undefined;
30
30
  }, {
31
+ source: "git_diff" | "gh_issue" | "github_branch" | "ci_log" | "task_queue" | "manual";
31
32
  task_id: string;
32
33
  capability: string;
33
34
  prompt: string;
34
- source: "git_diff" | "gh_issue" | "github_branch" | "ci_log" | "task_queue" | "manual";
35
35
  priority?: number | undefined;
36
36
  context?: Record<string, unknown> | undefined;
37
37
  evaluation?: unknown[] | undefined;