@osstack/protocol 0.15.0 → 0.22.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/attention.d.ts +863 -0
- package/dist/attention.d.ts.map +1 -0
- package/dist/attention.js +112 -0
- package/dist/attention.js.map +1 -0
- package/dist/autonomy.d.ts +14 -14
- package/dist/delivery-contract.d.ts +734 -0
- package/dist/delivery-contract.d.ts.map +1 -0
- package/dist/delivery-contract.js +111 -0
- package/dist/delivery-contract.js.map +1 -0
- package/dist/envelope.d.ts +42 -42
- package/dist/event.d.ts +4 -4
- package/dist/follow-up-delivery.d.ts +1831 -0
- package/dist/follow-up-delivery.d.ts.map +1 -0
- package/dist/follow-up-delivery.js +174 -0
- package/dist/follow-up-delivery.js.map +1 -0
- package/dist/follow-up.d.ts +1100 -0
- package/dist/follow-up.d.ts.map +1 -0
- package/dist/follow-up.js +28 -0
- package/dist/follow-up.js.map +1 -0
- package/dist/generate.d.ts +1 -0
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +61 -1
- package/dist/generate.js.map +1 -1
- package/dist/graph-checkpoint.d.ts +409 -0
- package/dist/graph-checkpoint.d.ts.map +1 -0
- package/dist/graph-checkpoint.js +91 -0
- package/dist/graph-checkpoint.js.map +1 -0
- package/dist/graph-worker.d.ts +1663 -0
- package/dist/graph-worker.d.ts.map +1 -0
- package/dist/graph-worker.js +152 -0
- package/dist/graph-worker.js.map +1 -0
- package/dist/graph.d.ts +13169 -0
- package/dist/graph.d.ts.map +1 -0
- package/dist/graph.js +427 -0
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +10 -10
- package/dist/run.d.ts +4 -4
- package/dist/session-continuation-grant.d.ts +414 -0
- package/dist/session-continuation-grant.d.ts.map +1 -0
- package/dist/session-continuation-grant.js +59 -0
- package/dist/session-continuation-grant.js.map +1 -0
- package/dist/session-continuation.d.ts +129 -0
- package/dist/session-continuation.d.ts.map +1 -0
- package/dist/session-continuation.js +30 -0
- package/dist/session-continuation.js.map +1 -0
- package/dist/task.d.ts +2 -2
- package/package.json +11 -10
- package/schemas/attention-inbox.schema.json +271 -0
- package/schemas/attention-status.schema.json +434 -0
- package/schemas/continuation-grant-body.schema.json +189 -0
- package/schemas/continuation-output-check.schema.json +65 -0
- package/schemas/delivery-contract-v2.schema.json +238 -0
- package/schemas/delivery-verification-receipt-v2.schema.json +223 -0
- package/schemas/follow-up-create-params.schema.json +78 -0
- package/schemas/follow-up-draft-params.schema.json +39 -0
- package/schemas/follow-up-list-params.schema.json +42 -0
- package/schemas/follow-up-list-result.schema.json +241 -0
- package/schemas/follow-up-mutation-result.schema.json +361 -0
- package/schemas/follow-up-obligation.schema.json +343 -0
- package/schemas/follow-up-resolve-params.schema.json +53 -0
- package/schemas/frozen-delivery-contract-v2.schema.json +258 -0
- package/schemas/graph-checkpoint-request.schema.json +222 -0
- package/schemas/graph-checkpoint-response.schema.json +258 -0
- package/schemas/graph-worker.schema.json +546 -0
- package/schemas/graph.schema.json +1798 -0
- package/schemas/session-continuation-request.schema.json +62 -0
- package/schemas/session-decision.schema.json +107 -0
- package/schemas/signed-continuation-grant.schema.json +209 -0
- package/LICENSE +0 -21
package/dist/policy.d.ts
CHANGED
|
@@ -59,24 +59,24 @@ export declare const PolicyOutcome: z.ZodObject<{
|
|
|
59
59
|
rule_id: string;
|
|
60
60
|
}>, "many">;
|
|
61
61
|
}, "strict", z.ZodTypeAny, {
|
|
62
|
+
total: number;
|
|
62
63
|
candidate: {
|
|
63
64
|
agent_id: string;
|
|
64
65
|
cost_tier: "low" | "high" | "mid";
|
|
65
66
|
capabilities: unknown[];
|
|
66
67
|
};
|
|
67
|
-
total: number;
|
|
68
68
|
breakdown: {
|
|
69
69
|
value: number;
|
|
70
70
|
reason: string;
|
|
71
71
|
rule_id: string;
|
|
72
72
|
}[];
|
|
73
73
|
}, {
|
|
74
|
+
total: number;
|
|
74
75
|
candidate: {
|
|
75
76
|
agent_id: string;
|
|
76
77
|
cost_tier: "low" | "high" | "mid";
|
|
77
78
|
capabilities: unknown[];
|
|
78
79
|
};
|
|
79
|
-
total: number;
|
|
80
80
|
breakdown: {
|
|
81
81
|
value: number;
|
|
82
82
|
reason: string;
|
|
@@ -128,24 +128,24 @@ export declare const PolicyDecision: z.ZodObject<{
|
|
|
128
128
|
rule_id: string;
|
|
129
129
|
}>, "many">;
|
|
130
130
|
}, "strict", z.ZodTypeAny, {
|
|
131
|
+
total: number;
|
|
131
132
|
candidate: {
|
|
132
133
|
agent_id: string;
|
|
133
134
|
cost_tier: "low" | "high" | "mid";
|
|
134
135
|
capabilities: unknown[];
|
|
135
136
|
};
|
|
136
|
-
total: number;
|
|
137
137
|
breakdown: {
|
|
138
138
|
value: number;
|
|
139
139
|
reason: string;
|
|
140
140
|
rule_id: string;
|
|
141
141
|
}[];
|
|
142
142
|
}, {
|
|
143
|
+
total: number;
|
|
143
144
|
candidate: {
|
|
144
145
|
agent_id: string;
|
|
145
146
|
cost_tier: "low" | "high" | "mid";
|
|
146
147
|
capabilities: unknown[];
|
|
147
148
|
};
|
|
148
|
-
total: number;
|
|
149
149
|
breakdown: {
|
|
150
150
|
value: number;
|
|
151
151
|
reason: string;
|
|
@@ -183,24 +183,24 @@ export declare const PolicyDecision: z.ZodObject<{
|
|
|
183
183
|
rule_id: string;
|
|
184
184
|
}>, "many">;
|
|
185
185
|
}, "strict", z.ZodTypeAny, {
|
|
186
|
+
total: number;
|
|
186
187
|
candidate: {
|
|
187
188
|
agent_id: string;
|
|
188
189
|
cost_tier: "low" | "high" | "mid";
|
|
189
190
|
capabilities: unknown[];
|
|
190
191
|
};
|
|
191
|
-
total: number;
|
|
192
192
|
breakdown: {
|
|
193
193
|
value: number;
|
|
194
194
|
reason: string;
|
|
195
195
|
rule_id: string;
|
|
196
196
|
}[];
|
|
197
197
|
}, {
|
|
198
|
+
total: number;
|
|
198
199
|
candidate: {
|
|
199
200
|
agent_id: string;
|
|
200
201
|
cost_tier: "low" | "high" | "mid";
|
|
201
202
|
capabilities: unknown[];
|
|
202
203
|
};
|
|
203
|
-
total: number;
|
|
204
204
|
breakdown: {
|
|
205
205
|
value: number;
|
|
206
206
|
reason: string;
|
|
@@ -219,12 +219,12 @@ export declare const PolicyDecision: z.ZodObject<{
|
|
|
219
219
|
}>;
|
|
220
220
|
}, "strict", z.ZodTypeAny, {
|
|
221
221
|
winner: {
|
|
222
|
+
total: number;
|
|
222
223
|
candidate: {
|
|
223
224
|
agent_id: string;
|
|
224
225
|
cost_tier: "low" | "high" | "mid";
|
|
225
226
|
capabilities: unknown[];
|
|
226
227
|
};
|
|
227
|
-
total: number;
|
|
228
228
|
breakdown: {
|
|
229
229
|
value: number;
|
|
230
230
|
reason: string;
|
|
@@ -232,12 +232,12 @@ export declare const PolicyDecision: z.ZodObject<{
|
|
|
232
232
|
}[];
|
|
233
233
|
} | null;
|
|
234
234
|
ranked: {
|
|
235
|
+
total: number;
|
|
235
236
|
candidate: {
|
|
236
237
|
agent_id: string;
|
|
237
238
|
cost_tier: "low" | "high" | "mid";
|
|
238
239
|
capabilities: unknown[];
|
|
239
240
|
};
|
|
240
|
-
total: number;
|
|
241
241
|
breakdown: {
|
|
242
242
|
value: number;
|
|
243
243
|
reason: string;
|
|
@@ -250,12 +250,12 @@ export declare const PolicyDecision: z.ZodObject<{
|
|
|
250
250
|
};
|
|
251
251
|
}, {
|
|
252
252
|
winner: {
|
|
253
|
+
total: number;
|
|
253
254
|
candidate: {
|
|
254
255
|
agent_id: string;
|
|
255
256
|
cost_tier: "low" | "high" | "mid";
|
|
256
257
|
capabilities: unknown[];
|
|
257
258
|
};
|
|
258
|
-
total: number;
|
|
259
259
|
breakdown: {
|
|
260
260
|
value: number;
|
|
261
261
|
reason: string;
|
|
@@ -263,12 +263,12 @@ export declare const PolicyDecision: z.ZodObject<{
|
|
|
263
263
|
}[];
|
|
264
264
|
} | null;
|
|
265
265
|
ranked: {
|
|
266
|
+
total: number;
|
|
266
267
|
candidate: {
|
|
267
268
|
agent_id: string;
|
|
268
269
|
cost_tier: "low" | "high" | "mid";
|
|
269
270
|
capabilities: unknown[];
|
|
270
271
|
};
|
|
271
|
-
total: number;
|
|
272
272
|
breakdown: {
|
|
273
273
|
value: number;
|
|
274
274
|
reason: string;
|
package/dist/run.d.ts
CHANGED
|
@@ -13,21 +13,21 @@ export declare const RunSummary: z.ZodObject<{
|
|
|
13
13
|
summary: z.ZodOptional<z.ZodString>;
|
|
14
14
|
}, "strict", z.ZodTypeAny, {
|
|
15
15
|
run_id: string;
|
|
16
|
-
agent_id: string;
|
|
17
16
|
task_id: string;
|
|
18
17
|
outcome: "cancelled" | "completed" | "failed";
|
|
18
|
+
agent_id: string;
|
|
19
19
|
started_at: string;
|
|
20
|
-
completed_at?: string | undefined;
|
|
21
20
|
duration_ms?: number | undefined;
|
|
21
|
+
completed_at?: string | undefined;
|
|
22
22
|
summary?: string | undefined;
|
|
23
23
|
}, {
|
|
24
24
|
run_id: string;
|
|
25
|
-
agent_id: string;
|
|
26
25
|
task_id: string;
|
|
27
26
|
outcome: "cancelled" | "completed" | "failed";
|
|
27
|
+
agent_id: string;
|
|
28
28
|
started_at: string;
|
|
29
|
-
completed_at?: string | undefined;
|
|
30
29
|
duration_ms?: number | undefined;
|
|
30
|
+
completed_at?: string | undefined;
|
|
31
31
|
summary?: string | undefined;
|
|
32
32
|
}>;
|
|
33
33
|
export type RunSummary = z.infer<typeof RunSummary>;
|
|
@@ -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
|
+
checks: ({
|
|
62
|
+
expected: string;
|
|
63
|
+
kind: "text_equals";
|
|
64
|
+
} | {
|
|
65
|
+
path: string[];
|
|
66
|
+
expected: string | number | boolean | null;
|
|
67
|
+
kind: "json_value_equals";
|
|
68
|
+
})[];
|
|
69
|
+
instruction: string;
|
|
70
|
+
max_retries: number;
|
|
71
|
+
retry_instruction?: string | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
phase: string;
|
|
74
|
+
checks: ({
|
|
75
|
+
expected: string;
|
|
76
|
+
kind: "text_equals";
|
|
77
|
+
} | {
|
|
78
|
+
path: string[];
|
|
79
|
+
expected: string | number | boolean | null;
|
|
80
|
+
kind: "json_value_equals";
|
|
81
|
+
})[];
|
|
82
|
+
instruction: string;
|
|
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
|
+
checks: ({
|
|
138
|
+
expected: string;
|
|
139
|
+
kind: "text_equals";
|
|
140
|
+
} | {
|
|
141
|
+
path: string[];
|
|
142
|
+
expected: string | number | boolean | null;
|
|
143
|
+
kind: "json_value_equals";
|
|
144
|
+
})[];
|
|
145
|
+
instruction: string;
|
|
146
|
+
max_retries: number;
|
|
147
|
+
retry_instruction?: string | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
phase: string;
|
|
150
|
+
checks: ({
|
|
151
|
+
expected: string;
|
|
152
|
+
kind: "text_equals";
|
|
153
|
+
} | {
|
|
154
|
+
path: string[];
|
|
155
|
+
expected: string | number | boolean | null;
|
|
156
|
+
kind: "json_value_equals";
|
|
157
|
+
})[];
|
|
158
|
+
instruction: string;
|
|
159
|
+
retry_instruction?: string | undefined;
|
|
160
|
+
max_retries?: number | undefined;
|
|
161
|
+
}>, "many">;
|
|
162
|
+
}, "strict", z.ZodTypeAny, {
|
|
163
|
+
version: 1;
|
|
164
|
+
grant_id: string;
|
|
165
|
+
session_id: string;
|
|
166
|
+
repo_path: string;
|
|
167
|
+
expires_at: string;
|
|
168
|
+
issued_at: string;
|
|
169
|
+
runtime_id: string;
|
|
170
|
+
runtime_policy_sha256: 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
|
+
checks: ({
|
|
179
|
+
expected: string;
|
|
180
|
+
kind: "text_equals";
|
|
181
|
+
} | {
|
|
182
|
+
path: string[];
|
|
183
|
+
expected: string | number | boolean | null;
|
|
184
|
+
kind: "json_value_equals";
|
|
185
|
+
})[];
|
|
186
|
+
instruction: string;
|
|
187
|
+
max_retries: number;
|
|
188
|
+
retry_instruction?: string | undefined;
|
|
189
|
+
}[];
|
|
190
|
+
}, {
|
|
191
|
+
version: 1;
|
|
192
|
+
grant_id: string;
|
|
193
|
+
session_id: string;
|
|
194
|
+
repo_path: string;
|
|
195
|
+
expires_at: string;
|
|
196
|
+
issued_at: string;
|
|
197
|
+
runtime_id: string;
|
|
198
|
+
runtime_policy_sha256: 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
|
+
checks: ({
|
|
207
|
+
expected: string;
|
|
208
|
+
kind: "text_equals";
|
|
209
|
+
} | {
|
|
210
|
+
path: string[];
|
|
211
|
+
expected: string | number | boolean | null;
|
|
212
|
+
kind: "json_value_equals";
|
|
213
|
+
})[];
|
|
214
|
+
instruction: string;
|
|
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
|
+
checks: ({
|
|
265
|
+
expected: string;
|
|
266
|
+
kind: "text_equals";
|
|
267
|
+
} | {
|
|
268
|
+
path: string[];
|
|
269
|
+
expected: string | number | boolean | null;
|
|
270
|
+
kind: "json_value_equals";
|
|
271
|
+
})[];
|
|
272
|
+
instruction: string;
|
|
273
|
+
max_retries: number;
|
|
274
|
+
retry_instruction?: string | undefined;
|
|
275
|
+
}, {
|
|
276
|
+
phase: string;
|
|
277
|
+
checks: ({
|
|
278
|
+
expected: string;
|
|
279
|
+
kind: "text_equals";
|
|
280
|
+
} | {
|
|
281
|
+
path: string[];
|
|
282
|
+
expected: string | number | boolean | null;
|
|
283
|
+
kind: "json_value_equals";
|
|
284
|
+
})[];
|
|
285
|
+
instruction: string;
|
|
286
|
+
retry_instruction?: string | undefined;
|
|
287
|
+
max_retries?: number | undefined;
|
|
288
|
+
}>, "many">;
|
|
289
|
+
}, "strict", z.ZodTypeAny, {
|
|
290
|
+
version: 1;
|
|
291
|
+
grant_id: string;
|
|
292
|
+
session_id: string;
|
|
293
|
+
repo_path: string;
|
|
294
|
+
expires_at: string;
|
|
295
|
+
issued_at: string;
|
|
296
|
+
runtime_id: string;
|
|
297
|
+
runtime_policy_sha256: 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
|
+
checks: ({
|
|
306
|
+
expected: string;
|
|
307
|
+
kind: "text_equals";
|
|
308
|
+
} | {
|
|
309
|
+
path: string[];
|
|
310
|
+
expected: string | number | boolean | null;
|
|
311
|
+
kind: "json_value_equals";
|
|
312
|
+
})[];
|
|
313
|
+
instruction: string;
|
|
314
|
+
max_retries: number;
|
|
315
|
+
retry_instruction?: string | undefined;
|
|
316
|
+
}[];
|
|
317
|
+
}, {
|
|
318
|
+
version: 1;
|
|
319
|
+
grant_id: string;
|
|
320
|
+
session_id: string;
|
|
321
|
+
repo_path: string;
|
|
322
|
+
expires_at: string;
|
|
323
|
+
issued_at: string;
|
|
324
|
+
runtime_id: string;
|
|
325
|
+
runtime_policy_sha256: 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
|
+
checks: ({
|
|
334
|
+
expected: string;
|
|
335
|
+
kind: "text_equals";
|
|
336
|
+
} | {
|
|
337
|
+
path: string[];
|
|
338
|
+
expected: string | number | boolean | null;
|
|
339
|
+
kind: "json_value_equals";
|
|
340
|
+
})[];
|
|
341
|
+
instruction: string;
|
|
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
|
+
version: 1;
|
|
353
|
+
grant_id: string;
|
|
354
|
+
session_id: string;
|
|
355
|
+
repo_path: string;
|
|
356
|
+
expires_at: string;
|
|
357
|
+
issued_at: string;
|
|
358
|
+
runtime_id: string;
|
|
359
|
+
runtime_policy_sha256: 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
|
+
checks: ({
|
|
368
|
+
expected: string;
|
|
369
|
+
kind: "text_equals";
|
|
370
|
+
} | {
|
|
371
|
+
path: string[];
|
|
372
|
+
expected: string | number | boolean | null;
|
|
373
|
+
kind: "json_value_equals";
|
|
374
|
+
})[];
|
|
375
|
+
instruction: string;
|
|
376
|
+
max_retries: number;
|
|
377
|
+
retry_instruction?: string | undefined;
|
|
378
|
+
}[];
|
|
379
|
+
};
|
|
380
|
+
}, {
|
|
381
|
+
key_id: string;
|
|
382
|
+
signature: string;
|
|
383
|
+
body: {
|
|
384
|
+
version: 1;
|
|
385
|
+
grant_id: string;
|
|
386
|
+
session_id: string;
|
|
387
|
+
repo_path: string;
|
|
388
|
+
expires_at: string;
|
|
389
|
+
issued_at: string;
|
|
390
|
+
runtime_id: string;
|
|
391
|
+
runtime_policy_sha256: 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
|
+
checks: ({
|
|
400
|
+
expected: string;
|
|
401
|
+
kind: "text_equals";
|
|
402
|
+
} | {
|
|
403
|
+
path: string[];
|
|
404
|
+
expected: string | number | boolean | null;
|
|
405
|
+
kind: "json_value_equals";
|
|
406
|
+
})[];
|
|
407
|
+
instruction: string;
|
|
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,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;AAC7C,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CACtD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAClC,8CAA8C,CAC/C,CAAC;AACF,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,KAAK,CAC9C,2DAA2D,EAC3D,oCAAoC,CACrC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,2CAA2C,CAAC,CAAC;AAExF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACtD,CAAC,CAAC,MAAM,CAA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