@treeseed/sdk 0.13.0-rc.53 → 0.13.0-rc.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/agent-capacity/authority/agent-authority-presets.js +2 -1
- package/dist/agent-capacity/contracts/configuration/configuration.js +1 -1
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +240 -240
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +1 -1
- package/dist/capacity-provider/client.d.ts +18 -3
- package/dist/capacity-provider/client.js +6 -0
- package/dist/capacity-provider/contracts/governance.d.ts +28 -1
- package/dist/capacity-provider/index.d.ts +1 -0
- package/dist/capacity-provider/index.js +1 -0
- package/dist/capacity-provider/sandbox-contracts.d.ts +422 -0
- package/dist/capacity-provider/sandbox-contracts.js +71 -0
- package/dist/capacity-provider/validation.d.ts +2 -1
- package/dist/capacity-provider/validation.js +23 -0
- package/dist/content/validation/agent-operational-content-schemas.d.ts +76 -76
- package/dist/content/validation/auxiliary-content-schemas.d.ts +20 -20
- package/dist/content/validation/content-model-schemas.d.ts +570 -570
- package/dist/content/validation/portable-content-data.d.ts +61 -61
- package/dist/deployment/ai-mode.d.ts +4 -4
- package/dist/deployment/schemas.d.ts +418 -100
- package/dist/deployment/schemas.js +23 -1
- package/dist/development/schemas.d.ts +22 -22
- package/dist/operator-contracts/canonical-command-tree.js +63 -3
- package/dist/operator-contracts/catalog/communication-operations.d.ts +300 -33
- package/dist/operator-contracts/catalog/communication-operations.js +56 -2
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +261 -0
- package/dist/operator-contracts/catalog/inbox-operations.js +36 -0
- package/dist/operator-contracts/communication/contracts.d.ts +1261 -71
- package/dist/operator-contracts/communication/contracts.js +99 -7
- package/dist/operator-contracts/control-plane-operations.d.ts +592 -66
- package/dist/operator-contracts/control-plane-operations.js +4 -1
- package/dist/operator-contracts/inbox/contracts.d.ts +1099 -0
- package/dist/operator-contracts/inbox/contracts.js +134 -0
- package/dist/operator-contracts/index.d.ts +1 -0
- package/dist/operator-contracts/index.js +1 -0
- package/dist/operator-contracts/mcp.js +1 -1
- package/dist/security/encrypted-envelope.d.ts +177 -0
- package/dist/security/encrypted-envelope.js +34 -0
- package/dist/security/envelope-codec.d.ts +38 -0
- package/dist/security/envelope-codec.js +96 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.js +2 -0
- package/package.json +5 -1
|
@@ -19,9 +19,9 @@ export declare const agentActivityQuerySchema: z.ZodObject<{
|
|
|
19
19
|
type?: string | string[] | undefined;
|
|
20
20
|
limit?: number | undefined;
|
|
21
21
|
agent?: string | string[] | undefined;
|
|
22
|
+
after?: number | undefined;
|
|
22
23
|
agentClass?: string | string[] | undefined;
|
|
23
24
|
severity?: string | string[] | undefined;
|
|
24
|
-
after?: number | undefined;
|
|
25
25
|
}>;
|
|
26
26
|
export declare const agentActivityPageSchema: z.ZodObject<{
|
|
27
27
|
items: z.ZodArray<z.ZodType<AgentActivityEvent, z.ZodTypeDef, AgentActivityEvent>, "many">;
|
|
@@ -45,13 +45,28 @@ export declare class ProviderProtocolClient {
|
|
|
45
45
|
startAssignmentCloseout(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
46
46
|
preflightAssignmentCompletion(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
47
47
|
respondToAssignmentDiscussion(assignmentId: string, request: ProviderDiscussionResponseRequest, idempotencyKey: string): Promise<{
|
|
48
|
-
status: "responded" | "abstained";
|
|
49
|
-
schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
|
|
50
|
-
assignmentId: string;
|
|
51
48
|
invocationId: string;
|
|
49
|
+
assignmentId: string;
|
|
50
|
+
schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
|
|
51
|
+
status: "responded" | "abstained";
|
|
52
52
|
messageRef: string;
|
|
53
53
|
settledAt: string;
|
|
54
54
|
}>;
|
|
55
|
+
acknowledgeCommunicationNotification(assignmentId: string, request: {
|
|
56
|
+
providerId: string;
|
|
57
|
+
runnerId: string;
|
|
58
|
+
observedAt: string;
|
|
59
|
+
}): Promise<Record<string, unknown>>;
|
|
60
|
+
createCommunicationTraceEvent(assignmentId: string, request: {
|
|
61
|
+
leaseToken: string;
|
|
62
|
+
runnerId: string;
|
|
63
|
+
sequence: number;
|
|
64
|
+
type: string;
|
|
65
|
+
occurredAt: string;
|
|
66
|
+
summary: string;
|
|
67
|
+
payload: Record<string, unknown>;
|
|
68
|
+
protectedPayload?: Record<string, unknown>;
|
|
69
|
+
}): Promise<Record<string, unknown>>;
|
|
55
70
|
returnAssignment(assignmentId: string, request?: ProviderAssignmentLifecycleRequest): Promise<ProviderAssignmentLifecycleResult>;
|
|
56
71
|
completeAssignment(assignmentId: string, request?: ProviderAssignmentLifecycleRequest): Promise<ProviderAssignmentLifecycleResult>;
|
|
57
72
|
failAssignment(assignmentId: string, request?: ProviderAssignmentLifecycleRequest): Promise<ProviderAssignmentLifecycleResult>;
|
|
@@ -129,6 +129,12 @@ class ProviderProtocolClient {
|
|
|
129
129
|
respondToAssignmentDiscussion(assignmentId, request, idempotencyKey) {
|
|
130
130
|
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.discussionResponse, { path: { assignmentId }, body: request }, { idempotencyKey });
|
|
131
131
|
}
|
|
132
|
+
acknowledgeCommunicationNotification(assignmentId, request) {
|
|
133
|
+
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.notificationAcknowledge, { path: { assignmentId }, body: request });
|
|
134
|
+
}
|
|
135
|
+
createCommunicationTraceEvent(assignmentId, request) {
|
|
136
|
+
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.traceEvent, { path: { assignmentId }, body: request });
|
|
137
|
+
}
|
|
132
138
|
returnAssignment(assignmentId, request = {}) {
|
|
133
139
|
return this.invoke(CONTROL_PLANE_OPERATIONS.providers.returnAssignment, { path: { assignmentId }, body: request });
|
|
134
140
|
}
|
|
@@ -285,7 +285,7 @@ export type MinimumAssignmentDuration = {
|
|
|
285
285
|
export interface ProviderExecutionAdapterSnapshot {
|
|
286
286
|
id: string;
|
|
287
287
|
adapter: string;
|
|
288
|
-
isolation: 'process' | 'worker';
|
|
288
|
+
isolation: 'microvm' | 'process' | 'worker';
|
|
289
289
|
status: 'available' | 'degraded' | 'unavailable';
|
|
290
290
|
capabilities: string[];
|
|
291
291
|
laneIds: string[];
|
|
@@ -421,3 +421,30 @@ export interface CapacityProviderManifestV3 {
|
|
|
421
421
|
connections: ProviderConnectionConfig[];
|
|
422
422
|
metadata?: Record<string, unknown>;
|
|
423
423
|
}
|
|
424
|
+
export interface CapacityProviderSandboxProfile {
|
|
425
|
+
id: 'read' | 'unit' | 'integration' | 'platform' | 'connected' | string;
|
|
426
|
+
guestImage: string;
|
|
427
|
+
guestImageDigest: string;
|
|
428
|
+
defaultDenyNetwork: true;
|
|
429
|
+
resources: {
|
|
430
|
+
cpuCores: number;
|
|
431
|
+
memoryBytes: number;
|
|
432
|
+
diskBytes: number;
|
|
433
|
+
processLimit: number;
|
|
434
|
+
outputBytes: number;
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
export interface CapacityProviderManifestV4 extends Omit<CapacityProviderManifestV3, 'schemaVersion' | 'adapters'> {
|
|
438
|
+
schemaVersion: 4;
|
|
439
|
+
sandbox: {
|
|
440
|
+
required: true;
|
|
441
|
+
brokerSocket: string;
|
|
442
|
+
runtime: 'kata-runtime-rs-qemu';
|
|
443
|
+
profiles: CapacityProviderSandboxProfile[];
|
|
444
|
+
};
|
|
445
|
+
adapters: Array<Omit<CapacityProviderManifestV3['adapters'][number], 'isolation'> & {
|
|
446
|
+
isolation: 'microvm' | 'process' | 'worker';
|
|
447
|
+
sandboxProfileIds?: string[];
|
|
448
|
+
}>;
|
|
449
|
+
}
|
|
450
|
+
export type CapacityProviderManifest = CapacityProviderManifestV3 | CapacityProviderManifestV4;
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const sandboxProfile: z.ZodEnum<["read", "unit", "integration", "platform", "connected"]>;
|
|
3
|
+
export declare const sandboxAssignmentSchema: z.ZodObject<{
|
|
4
|
+
schemaVersion: z.ZodLiteral<"treeseed.sandbox-assignment/v1">;
|
|
5
|
+
assignmentId: z.ZodString;
|
|
6
|
+
attempt: z.ZodNumber;
|
|
7
|
+
runnerId: z.ZodString;
|
|
8
|
+
providerId: z.ZodString;
|
|
9
|
+
teamId: z.ZodString;
|
|
10
|
+
projectId: z.ZodString;
|
|
11
|
+
profile: z.ZodEnum<["read", "unit", "integration", "platform", "connected"]>;
|
|
12
|
+
guestImage: z.ZodString;
|
|
13
|
+
guestImageDigest: z.ZodString;
|
|
14
|
+
identityManifestDigest: z.ZodString;
|
|
15
|
+
contextManifestDigest: z.ZodString;
|
|
16
|
+
resources: z.ZodObject<{
|
|
17
|
+
cpuCores: z.ZodNumber;
|
|
18
|
+
memoryBytes: z.ZodNumber;
|
|
19
|
+
diskBytes: z.ZodNumber;
|
|
20
|
+
durationSeconds: z.ZodNumber;
|
|
21
|
+
processLimit: z.ZodNumber;
|
|
22
|
+
outputBytes: z.ZodNumber;
|
|
23
|
+
}, "strict", z.ZodTypeAny, {
|
|
24
|
+
cpuCores: number;
|
|
25
|
+
memoryBytes: number;
|
|
26
|
+
diskBytes: number;
|
|
27
|
+
durationSeconds: number;
|
|
28
|
+
processLimit: number;
|
|
29
|
+
outputBytes: number;
|
|
30
|
+
}, {
|
|
31
|
+
cpuCores: number;
|
|
32
|
+
memoryBytes: number;
|
|
33
|
+
diskBytes: number;
|
|
34
|
+
durationSeconds: number;
|
|
35
|
+
processLimit: number;
|
|
36
|
+
outputBytes: number;
|
|
37
|
+
}>;
|
|
38
|
+
inputs: z.ZodArray<z.ZodObject<{
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
digest: z.ZodString;
|
|
41
|
+
bytes: z.ZodNumber;
|
|
42
|
+
disposition: z.ZodEnum<["read-only", "copy-on-write"]>;
|
|
43
|
+
mediaType: z.ZodString;
|
|
44
|
+
targetPath: z.ZodString;
|
|
45
|
+
}, "strict", z.ZodTypeAny, {
|
|
46
|
+
id: string;
|
|
47
|
+
mediaType: string;
|
|
48
|
+
digest: string;
|
|
49
|
+
bytes: number;
|
|
50
|
+
disposition: "read-only" | "copy-on-write";
|
|
51
|
+
targetPath: string;
|
|
52
|
+
}, {
|
|
53
|
+
id: string;
|
|
54
|
+
mediaType: string;
|
|
55
|
+
digest: string;
|
|
56
|
+
bytes: number;
|
|
57
|
+
disposition: "read-only" | "copy-on-write";
|
|
58
|
+
targetPath: string;
|
|
59
|
+
}>, "many">;
|
|
60
|
+
outputs: z.ZodArray<z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
path: z.ZodString;
|
|
63
|
+
mediaType: z.ZodString;
|
|
64
|
+
maxBytes: z.ZodNumber;
|
|
65
|
+
}, "strict", z.ZodTypeAny, {
|
|
66
|
+
path: string;
|
|
67
|
+
id: string;
|
|
68
|
+
mediaType: string;
|
|
69
|
+
maxBytes: number;
|
|
70
|
+
}, {
|
|
71
|
+
path: string;
|
|
72
|
+
id: string;
|
|
73
|
+
mediaType: string;
|
|
74
|
+
maxBytes: number;
|
|
75
|
+
}>, "many">;
|
|
76
|
+
network: z.ZodObject<{
|
|
77
|
+
defaultDeny: z.ZodLiteral<true>;
|
|
78
|
+
relayUrl: z.ZodString;
|
|
79
|
+
allowedServices: z.ZodArray<z.ZodString, "many">;
|
|
80
|
+
connectedDevelopmentSessionId: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, "strict", z.ZodTypeAny, {
|
|
82
|
+
defaultDeny: true;
|
|
83
|
+
relayUrl: string;
|
|
84
|
+
allowedServices: string[];
|
|
85
|
+
connectedDevelopmentSessionId?: string | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
defaultDeny: true;
|
|
88
|
+
relayUrl: string;
|
|
89
|
+
allowedServices: string[];
|
|
90
|
+
connectedDevelopmentSessionId?: string | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
modelPolicy: z.ZodObject<{
|
|
93
|
+
provider: z.ZodString;
|
|
94
|
+
model: z.ZodString;
|
|
95
|
+
capabilities: z.ZodArray<z.ZodString, "many">;
|
|
96
|
+
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
maxCost: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
}, "strict", z.ZodTypeAny, {
|
|
100
|
+
provider: string;
|
|
101
|
+
capabilities: string[];
|
|
102
|
+
model: string;
|
|
103
|
+
maxInputTokens?: number | undefined;
|
|
104
|
+
maxOutputTokens?: number | undefined;
|
|
105
|
+
maxCost?: number | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
provider: string;
|
|
108
|
+
capabilities: string[];
|
|
109
|
+
model: string;
|
|
110
|
+
maxInputTokens?: number | undefined;
|
|
111
|
+
maxOutputTokens?: number | undefined;
|
|
112
|
+
maxCost?: number | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
credentialHandles: z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
profileId: z.ZodString;
|
|
117
|
+
revealAllowed: z.ZodLiteral<false>;
|
|
118
|
+
}, "strict", z.ZodTypeAny, {
|
|
119
|
+
id: string;
|
|
120
|
+
profileId: string;
|
|
121
|
+
revealAllowed: false;
|
|
122
|
+
}, {
|
|
123
|
+
id: string;
|
|
124
|
+
profileId: string;
|
|
125
|
+
revealAllowed: false;
|
|
126
|
+
}>, "many">;
|
|
127
|
+
treeDxHandleIds: z.ZodArray<z.ZodString, "many">;
|
|
128
|
+
leaseExpiresAt: z.ZodString;
|
|
129
|
+
signature: z.ZodObject<{
|
|
130
|
+
keyId: z.ZodString;
|
|
131
|
+
algorithm: z.ZodLiteral<"Ed25519">;
|
|
132
|
+
value: z.ZodString;
|
|
133
|
+
}, "strict", z.ZodTypeAny, {
|
|
134
|
+
value: string;
|
|
135
|
+
algorithm: "Ed25519";
|
|
136
|
+
keyId: string;
|
|
137
|
+
}, {
|
|
138
|
+
value: string;
|
|
139
|
+
algorithm: "Ed25519";
|
|
140
|
+
keyId: string;
|
|
141
|
+
}>;
|
|
142
|
+
}, "strict", z.ZodTypeAny, {
|
|
143
|
+
teamId: string;
|
|
144
|
+
assignmentId: string;
|
|
145
|
+
schemaVersion: "treeseed.sandbox-assignment/v1";
|
|
146
|
+
outputs: {
|
|
147
|
+
path: string;
|
|
148
|
+
id: string;
|
|
149
|
+
mediaType: string;
|
|
150
|
+
maxBytes: number;
|
|
151
|
+
}[];
|
|
152
|
+
resources: {
|
|
153
|
+
cpuCores: number;
|
|
154
|
+
memoryBytes: number;
|
|
155
|
+
diskBytes: number;
|
|
156
|
+
durationSeconds: number;
|
|
157
|
+
processLimit: number;
|
|
158
|
+
outputBytes: number;
|
|
159
|
+
};
|
|
160
|
+
projectId: string;
|
|
161
|
+
profile: "read" | "unit" | "integration" | "platform" | "connected";
|
|
162
|
+
network: {
|
|
163
|
+
defaultDeny: true;
|
|
164
|
+
relayUrl: string;
|
|
165
|
+
allowedServices: string[];
|
|
166
|
+
connectedDevelopmentSessionId?: string | undefined;
|
|
167
|
+
};
|
|
168
|
+
guestImage: string;
|
|
169
|
+
guestImageDigest: string;
|
|
170
|
+
providerId: string;
|
|
171
|
+
runnerId: string;
|
|
172
|
+
leaseExpiresAt: string;
|
|
173
|
+
attempt: number;
|
|
174
|
+
identityManifestDigest: string;
|
|
175
|
+
contextManifestDigest: string;
|
|
176
|
+
inputs: {
|
|
177
|
+
id: string;
|
|
178
|
+
mediaType: string;
|
|
179
|
+
digest: string;
|
|
180
|
+
bytes: number;
|
|
181
|
+
disposition: "read-only" | "copy-on-write";
|
|
182
|
+
targetPath: string;
|
|
183
|
+
}[];
|
|
184
|
+
modelPolicy: {
|
|
185
|
+
provider: string;
|
|
186
|
+
capabilities: string[];
|
|
187
|
+
model: string;
|
|
188
|
+
maxInputTokens?: number | undefined;
|
|
189
|
+
maxOutputTokens?: number | undefined;
|
|
190
|
+
maxCost?: number | undefined;
|
|
191
|
+
};
|
|
192
|
+
credentialHandles: {
|
|
193
|
+
id: string;
|
|
194
|
+
profileId: string;
|
|
195
|
+
revealAllowed: false;
|
|
196
|
+
}[];
|
|
197
|
+
treeDxHandleIds: string[];
|
|
198
|
+
signature: {
|
|
199
|
+
value: string;
|
|
200
|
+
algorithm: "Ed25519";
|
|
201
|
+
keyId: string;
|
|
202
|
+
};
|
|
203
|
+
}, {
|
|
204
|
+
teamId: string;
|
|
205
|
+
assignmentId: string;
|
|
206
|
+
schemaVersion: "treeseed.sandbox-assignment/v1";
|
|
207
|
+
outputs: {
|
|
208
|
+
path: string;
|
|
209
|
+
id: string;
|
|
210
|
+
mediaType: string;
|
|
211
|
+
maxBytes: number;
|
|
212
|
+
}[];
|
|
213
|
+
resources: {
|
|
214
|
+
cpuCores: number;
|
|
215
|
+
memoryBytes: number;
|
|
216
|
+
diskBytes: number;
|
|
217
|
+
durationSeconds: number;
|
|
218
|
+
processLimit: number;
|
|
219
|
+
outputBytes: number;
|
|
220
|
+
};
|
|
221
|
+
projectId: string;
|
|
222
|
+
profile: "read" | "unit" | "integration" | "platform" | "connected";
|
|
223
|
+
network: {
|
|
224
|
+
defaultDeny: true;
|
|
225
|
+
relayUrl: string;
|
|
226
|
+
allowedServices: string[];
|
|
227
|
+
connectedDevelopmentSessionId?: string | undefined;
|
|
228
|
+
};
|
|
229
|
+
guestImage: string;
|
|
230
|
+
guestImageDigest: string;
|
|
231
|
+
providerId: string;
|
|
232
|
+
runnerId: string;
|
|
233
|
+
leaseExpiresAt: string;
|
|
234
|
+
attempt: number;
|
|
235
|
+
identityManifestDigest: string;
|
|
236
|
+
contextManifestDigest: string;
|
|
237
|
+
inputs: {
|
|
238
|
+
id: string;
|
|
239
|
+
mediaType: string;
|
|
240
|
+
digest: string;
|
|
241
|
+
bytes: number;
|
|
242
|
+
disposition: "read-only" | "copy-on-write";
|
|
243
|
+
targetPath: string;
|
|
244
|
+
}[];
|
|
245
|
+
modelPolicy: {
|
|
246
|
+
provider: string;
|
|
247
|
+
capabilities: string[];
|
|
248
|
+
model: string;
|
|
249
|
+
maxInputTokens?: number | undefined;
|
|
250
|
+
maxOutputTokens?: number | undefined;
|
|
251
|
+
maxCost?: number | undefined;
|
|
252
|
+
};
|
|
253
|
+
credentialHandles: {
|
|
254
|
+
id: string;
|
|
255
|
+
profileId: string;
|
|
256
|
+
revealAllowed: false;
|
|
257
|
+
}[];
|
|
258
|
+
treeDxHandleIds: string[];
|
|
259
|
+
signature: {
|
|
260
|
+
value: string;
|
|
261
|
+
algorithm: "Ed25519";
|
|
262
|
+
keyId: string;
|
|
263
|
+
};
|
|
264
|
+
}>;
|
|
265
|
+
export declare const sandboxEventSchema: z.ZodObject<{
|
|
266
|
+
schemaVersion: z.ZodLiteral<"treeseed.sandbox-event/v1">;
|
|
267
|
+
sandboxId: z.ZodString;
|
|
268
|
+
assignmentId: z.ZodString;
|
|
269
|
+
sequence: z.ZodNumber;
|
|
270
|
+
occurredAt: z.ZodString;
|
|
271
|
+
type: z.ZodEnum<["sandbox.created", "sandbox.ready", "execution.started", "execution.progress", "tool.requested", "tool.completed", "execution.completed", "execution.failed", "sandbox.destroyed"]>;
|
|
272
|
+
payload: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
273
|
+
}, "strict", z.ZodTypeAny, {
|
|
274
|
+
assignmentId: string;
|
|
275
|
+
sequence: number;
|
|
276
|
+
schemaVersion: "treeseed.sandbox-event/v1";
|
|
277
|
+
type: "sandbox.created" | "sandbox.ready" | "execution.started" | "execution.progress" | "tool.requested" | "tool.completed" | "execution.completed" | "execution.failed" | "sandbox.destroyed";
|
|
278
|
+
payload: Record<string, unknown>;
|
|
279
|
+
occurredAt: string;
|
|
280
|
+
sandboxId: string;
|
|
281
|
+
}, {
|
|
282
|
+
assignmentId: string;
|
|
283
|
+
sequence: number;
|
|
284
|
+
schemaVersion: "treeseed.sandbox-event/v1";
|
|
285
|
+
type: "sandbox.created" | "sandbox.ready" | "execution.started" | "execution.progress" | "tool.requested" | "tool.completed" | "execution.completed" | "execution.failed" | "sandbox.destroyed";
|
|
286
|
+
occurredAt: string;
|
|
287
|
+
sandboxId: string;
|
|
288
|
+
payload?: Record<string, unknown> | undefined;
|
|
289
|
+
}>;
|
|
290
|
+
export declare const sandboxLeaseRenewalSchema: z.ZodObject<{
|
|
291
|
+
schemaVersion: z.ZodLiteral<"treeseed.sandbox-lease-renewal/v1">;
|
|
292
|
+
sandboxId: z.ZodString;
|
|
293
|
+
assignmentId: z.ZodString;
|
|
294
|
+
providerId: z.ZodString;
|
|
295
|
+
teamId: z.ZodString;
|
|
296
|
+
leaseExpiresAt: z.ZodString;
|
|
297
|
+
issuedAt: z.ZodString;
|
|
298
|
+
signature: z.ZodObject<{
|
|
299
|
+
keyId: z.ZodString;
|
|
300
|
+
algorithm: z.ZodLiteral<"Ed25519">;
|
|
301
|
+
value: z.ZodString;
|
|
302
|
+
}, "strict", z.ZodTypeAny, {
|
|
303
|
+
value: string;
|
|
304
|
+
algorithm: "Ed25519";
|
|
305
|
+
keyId: string;
|
|
306
|
+
}, {
|
|
307
|
+
value: string;
|
|
308
|
+
algorithm: "Ed25519";
|
|
309
|
+
keyId: string;
|
|
310
|
+
}>;
|
|
311
|
+
}, "strict", z.ZodTypeAny, {
|
|
312
|
+
teamId: string;
|
|
313
|
+
assignmentId: string;
|
|
314
|
+
schemaVersion: "treeseed.sandbox-lease-renewal/v1";
|
|
315
|
+
providerId: string;
|
|
316
|
+
leaseExpiresAt: string;
|
|
317
|
+
issuedAt: string;
|
|
318
|
+
signature: {
|
|
319
|
+
value: string;
|
|
320
|
+
algorithm: "Ed25519";
|
|
321
|
+
keyId: string;
|
|
322
|
+
};
|
|
323
|
+
sandboxId: string;
|
|
324
|
+
}, {
|
|
325
|
+
teamId: string;
|
|
326
|
+
assignmentId: string;
|
|
327
|
+
schemaVersion: "treeseed.sandbox-lease-renewal/v1";
|
|
328
|
+
providerId: string;
|
|
329
|
+
leaseExpiresAt: string;
|
|
330
|
+
issuedAt: string;
|
|
331
|
+
signature: {
|
|
332
|
+
value: string;
|
|
333
|
+
algorithm: "Ed25519";
|
|
334
|
+
keyId: string;
|
|
335
|
+
};
|
|
336
|
+
sandboxId: string;
|
|
337
|
+
}>;
|
|
338
|
+
export declare const sandboxResultSchema: z.ZodObject<{
|
|
339
|
+
schemaVersion: z.ZodLiteral<"treeseed.sandbox-result/v1">;
|
|
340
|
+
sandboxId: z.ZodString;
|
|
341
|
+
assignmentId: z.ZodString;
|
|
342
|
+
status: z.ZodEnum<["completed", "failed", "cancelled", "expired"]>;
|
|
343
|
+
summary: z.ZodString;
|
|
344
|
+
responseMarkdown: z.ZodOptional<z.ZodString>;
|
|
345
|
+
artifacts: z.ZodArray<z.ZodObject<{
|
|
346
|
+
id: z.ZodString;
|
|
347
|
+
path: z.ZodString;
|
|
348
|
+
digest: z.ZodString;
|
|
349
|
+
mediaType: z.ZodString;
|
|
350
|
+
bytes: z.ZodNumber;
|
|
351
|
+
}, "strict", z.ZodTypeAny, {
|
|
352
|
+
path: string;
|
|
353
|
+
id: string;
|
|
354
|
+
mediaType: string;
|
|
355
|
+
digest: string;
|
|
356
|
+
bytes: number;
|
|
357
|
+
}, {
|
|
358
|
+
path: string;
|
|
359
|
+
id: string;
|
|
360
|
+
mediaType: string;
|
|
361
|
+
digest: string;
|
|
362
|
+
bytes: number;
|
|
363
|
+
}>, "many">;
|
|
364
|
+
usage: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
365
|
+
diagnostics: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
366
|
+
teardown: z.ZodObject<{
|
|
367
|
+
verified: z.ZodBoolean;
|
|
368
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
369
|
+
}, "strict", z.ZodTypeAny, {
|
|
370
|
+
completedAt: string | null;
|
|
371
|
+
verified: boolean;
|
|
372
|
+
}, {
|
|
373
|
+
completedAt: string | null;
|
|
374
|
+
verified: boolean;
|
|
375
|
+
}>;
|
|
376
|
+
}, "strict", z.ZodTypeAny, {
|
|
377
|
+
assignmentId: string;
|
|
378
|
+
schemaVersion: "treeseed.sandbox-result/v1";
|
|
379
|
+
status: "expired" | "failed" | "completed" | "cancelled";
|
|
380
|
+
artifacts: {
|
|
381
|
+
path: string;
|
|
382
|
+
id: string;
|
|
383
|
+
mediaType: string;
|
|
384
|
+
digest: string;
|
|
385
|
+
bytes: number;
|
|
386
|
+
}[];
|
|
387
|
+
summary: string;
|
|
388
|
+
usage: Record<string, unknown>;
|
|
389
|
+
diagnostics: Record<string, unknown>;
|
|
390
|
+
sandboxId: string;
|
|
391
|
+
teardown: {
|
|
392
|
+
completedAt: string | null;
|
|
393
|
+
verified: boolean;
|
|
394
|
+
};
|
|
395
|
+
responseMarkdown?: string | undefined;
|
|
396
|
+
}, {
|
|
397
|
+
assignmentId: string;
|
|
398
|
+
schemaVersion: "treeseed.sandbox-result/v1";
|
|
399
|
+
status: "expired" | "failed" | "completed" | "cancelled";
|
|
400
|
+
artifacts: {
|
|
401
|
+
path: string;
|
|
402
|
+
id: string;
|
|
403
|
+
mediaType: string;
|
|
404
|
+
digest: string;
|
|
405
|
+
bytes: number;
|
|
406
|
+
}[];
|
|
407
|
+
summary: string;
|
|
408
|
+
sandboxId: string;
|
|
409
|
+
teardown: {
|
|
410
|
+
completedAt: string | null;
|
|
411
|
+
verified: boolean;
|
|
412
|
+
};
|
|
413
|
+
usage?: Record<string, unknown> | undefined;
|
|
414
|
+
diagnostics?: Record<string, unknown> | undefined;
|
|
415
|
+
responseMarkdown?: string | undefined;
|
|
416
|
+
}>;
|
|
417
|
+
export type SandboxAssignment = z.infer<typeof sandboxAssignmentSchema>;
|
|
418
|
+
export type SandboxEvent = z.infer<typeof sandboxEventSchema>;
|
|
419
|
+
export type SandboxLeaseRenewal = z.infer<typeof sandboxLeaseRenewalSchema>;
|
|
420
|
+
export type SandboxResult = z.infer<typeof sandboxResultSchema>;
|
|
421
|
+
export type SandboxEnvironmentProfile = z.infer<typeof sandboxProfile>;
|
|
422
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const identifier = z.string().regex(/^[a-z][a-z0-9._-]{0,127}$/u);
|
|
3
|
+
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
4
|
+
const sandboxProfile = z.enum(["read", "unit", "integration", "platform", "connected"]);
|
|
5
|
+
const sandboxAssignmentSchema = z.object({
|
|
6
|
+
schemaVersion: z.literal("treeseed.sandbox-assignment/v1"),
|
|
7
|
+
assignmentId: z.string().min(1),
|
|
8
|
+
attempt: z.number().int().positive(),
|
|
9
|
+
runnerId: z.string().min(1),
|
|
10
|
+
providerId: z.string().min(1),
|
|
11
|
+
teamId: z.string().min(1),
|
|
12
|
+
projectId: z.string().min(1),
|
|
13
|
+
profile: sandboxProfile,
|
|
14
|
+
guestImage: z.string().min(1),
|
|
15
|
+
guestImageDigest: digest,
|
|
16
|
+
identityManifestDigest: digest,
|
|
17
|
+
contextManifestDigest: digest,
|
|
18
|
+
resources: z.object({
|
|
19
|
+
cpuCores: z.number().positive(),
|
|
20
|
+
memoryBytes: z.number().int().positive(),
|
|
21
|
+
diskBytes: z.number().int().positive(),
|
|
22
|
+
durationSeconds: z.number().int().positive(),
|
|
23
|
+
processLimit: z.number().int().positive(),
|
|
24
|
+
outputBytes: z.number().int().positive()
|
|
25
|
+
}).strict(),
|
|
26
|
+
inputs: z.array(z.object({ id: identifier, digest, bytes: z.number().int().nonnegative(), disposition: z.enum(["read-only", "copy-on-write"]), mediaType: z.string().min(1), targetPath: z.string().startsWith("/workspace/") }).strict()),
|
|
27
|
+
outputs: z.array(z.object({ id: identifier, path: z.string().startsWith("/run/treeseed-output/"), mediaType: z.string().min(1), maxBytes: z.number().int().positive() }).strict()),
|
|
28
|
+
network: z.object({ defaultDeny: z.literal(true), relayUrl: z.string().url().startsWith("https://"), allowedServices: z.array(identifier), connectedDevelopmentSessionId: z.string().min(1).optional() }).strict(),
|
|
29
|
+
modelPolicy: z.object({ provider: identifier, model: z.string().min(1), capabilities: z.array(identifier), maxInputTokens: z.number().int().positive().optional(), maxOutputTokens: z.number().int().positive().optional(), maxCost: z.number().nonnegative().optional() }).strict(),
|
|
30
|
+
credentialHandles: z.array(z.object({ id: identifier, profileId: identifier, revealAllowed: z.literal(false) }).strict()),
|
|
31
|
+
treeDxHandleIds: z.array(z.string().min(1)),
|
|
32
|
+
leaseExpiresAt: z.string().datetime(),
|
|
33
|
+
signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
|
|
34
|
+
}).strict();
|
|
35
|
+
const sandboxEventSchema = z.object({
|
|
36
|
+
schemaVersion: z.literal("treeseed.sandbox-event/v1"),
|
|
37
|
+
sandboxId: z.string().min(1),
|
|
38
|
+
assignmentId: z.string().min(1),
|
|
39
|
+
sequence: z.number().int().nonnegative(),
|
|
40
|
+
occurredAt: z.string().datetime(),
|
|
41
|
+
type: z.enum(["sandbox.created", "sandbox.ready", "execution.started", "execution.progress", "tool.requested", "tool.completed", "execution.completed", "execution.failed", "sandbox.destroyed"]),
|
|
42
|
+
payload: z.record(z.unknown()).default({})
|
|
43
|
+
}).strict();
|
|
44
|
+
const sandboxLeaseRenewalSchema = z.object({
|
|
45
|
+
schemaVersion: z.literal("treeseed.sandbox-lease-renewal/v1"),
|
|
46
|
+
sandboxId: z.string().min(1),
|
|
47
|
+
assignmentId: z.string().min(1),
|
|
48
|
+
providerId: z.string().min(1),
|
|
49
|
+
teamId: z.string().min(1),
|
|
50
|
+
leaseExpiresAt: z.string().datetime(),
|
|
51
|
+
issuedAt: z.string().datetime(),
|
|
52
|
+
signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
|
|
53
|
+
}).strict();
|
|
54
|
+
const sandboxResultSchema = z.object({
|
|
55
|
+
schemaVersion: z.literal("treeseed.sandbox-result/v1"),
|
|
56
|
+
sandboxId: z.string().min(1),
|
|
57
|
+
assignmentId: z.string().min(1),
|
|
58
|
+
status: z.enum(["completed", "failed", "cancelled", "expired"]),
|
|
59
|
+
summary: z.string(),
|
|
60
|
+
responseMarkdown: z.string().optional(),
|
|
61
|
+
artifacts: z.array(z.object({ id: identifier, path: z.string().startsWith("/run/treeseed-output/"), digest, mediaType: z.string().min(1), bytes: z.number().int().nonnegative() }).strict()),
|
|
62
|
+
usage: z.record(z.unknown()).default({}),
|
|
63
|
+
diagnostics: z.record(z.unknown()).default({}),
|
|
64
|
+
teardown: z.object({ verified: z.boolean(), completedAt: z.string().datetime().nullable() }).strict()
|
|
65
|
+
}).strict();
|
|
66
|
+
export {
|
|
67
|
+
sandboxAssignmentSchema,
|
|
68
|
+
sandboxEventSchema,
|
|
69
|
+
sandboxLeaseRenewalSchema,
|
|
70
|
+
sandboxResultSchema
|
|
71
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CapacityProviderManifestV3, type CapacityProviderProofPayload, type CapacityProviderPublicJwk, type ProviderSupplyOffer } from './contracts/index.js';
|
|
1
|
+
import { type CapacityProviderManifestV3, type CapacityProviderManifestV4, type CapacityProviderProofPayload, type CapacityProviderPublicJwk, type ProviderSupplyOffer } from './contracts/index.js';
|
|
2
2
|
export interface CapacityProviderContractDiagnostic {
|
|
3
3
|
code: string;
|
|
4
4
|
path: string;
|
|
@@ -20,6 +20,7 @@ export declare function validateCapacityProviderProofPayload(payload: CapacityPr
|
|
|
20
20
|
}): CapacityProviderContractValidation;
|
|
21
21
|
export declare function validateProviderSupplyOffer(offer: ProviderSupplyOffer, path?: string): CapacityProviderContractValidation;
|
|
22
22
|
export declare function validateCapacityProviderManifestV3(manifest: CapacityProviderManifestV3): CapacityProviderContractValidation;
|
|
23
|
+
export declare function validateCapacityProviderManifestV4(manifest: CapacityProviderManifestV4): CapacityProviderContractValidation;
|
|
23
24
|
export declare function capacityProviderSecurityDefaults(): {
|
|
24
25
|
proofTtlSeconds: number;
|
|
25
26
|
accessTokenTtlSeconds: number;
|
|
@@ -175,6 +175,28 @@ function validateCapacityProviderManifestV3(manifest) {
|
|
|
175
175
|
if (explicitShare > 100) add(diagnostics, "provider_connection_share_exceeded", "connections", "Explicit connection shares may not exceed 100 percent.");
|
|
176
176
|
return result(diagnostics);
|
|
177
177
|
}
|
|
178
|
+
function validateCapacityProviderManifestV4(manifest) {
|
|
179
|
+
const compatible = {
|
|
180
|
+
...manifest,
|
|
181
|
+
schemaVersion: 3,
|
|
182
|
+
adapters: manifest.adapters.map((adapter) => ({ ...adapter, isolation: adapter.isolation === "microvm" ? "process" : adapter.isolation }))
|
|
183
|
+
};
|
|
184
|
+
const diagnostics = validateCapacityProviderManifestV3(compatible).diagnostics;
|
|
185
|
+
if (manifest.schemaVersion !== 4) add(diagnostics, "provider_manifest_schema_invalid", "schemaVersion", "Capacity provider manifest schemaVersion must be 4.");
|
|
186
|
+
if (manifest.sandbox?.required !== true || manifest.sandbox?.runtime !== "kata-runtime-rs-qemu") add(diagnostics, "provider_sandbox_required", "sandbox", "Manifest v4 requires the Kata runtime-rs QEMU sandbox.");
|
|
187
|
+
if (!manifest.sandbox?.brokerSocket?.startsWith("/run/treeseed/")) add(diagnostics, "provider_sandbox_socket_invalid", "sandbox.brokerSocket", "Sandbox broker socket must remain under /run/treeseed.");
|
|
188
|
+
const profiles = new Set((manifest.sandbox?.profiles ?? []).map((profile) => profile.id));
|
|
189
|
+
for (const [index, profile] of (manifest.sandbox?.profiles ?? []).entries()) {
|
|
190
|
+
if (!["read", "unit", "integration", "platform", "connected"].includes(profile.id)) add(diagnostics, "provider_sandbox_profile_invalid", `sandbox.profiles[${index}].id`, "Sandbox profile must be one of read, unit, integration, platform, or connected.");
|
|
191
|
+
if (!/^sha256:[a-f0-9]{64}$/u.test(profile.guestImageDigest)) add(diagnostics, "provider_sandbox_image_digest_invalid", `sandbox.profiles[${index}].guestImageDigest`, "Guest images require an immutable SHA-256 digest.");
|
|
192
|
+
if (profile.defaultDenyNetwork !== true) add(diagnostics, "provider_sandbox_network_policy_invalid", `sandbox.profiles[${index}].defaultDenyNetwork`, "Sandbox networking must default deny.");
|
|
193
|
+
}
|
|
194
|
+
for (const [index, adapter] of manifest.adapters.entries()) {
|
|
195
|
+
if (adapter.isolation !== "microvm") add(diagnostics, "provider_v4_microvm_required", `adapters[${index}].isolation`, "Manifest v4 adapters must use microvm isolation.");
|
|
196
|
+
for (const profile of adapter.sandboxProfileIds ?? []) if (!profiles.has(profile)) add(diagnostics, "provider_sandbox_profile_unknown", `adapters[${index}].sandboxProfileIds`, `Unknown sandbox profile ${profile}.`);
|
|
197
|
+
}
|
|
198
|
+
return result(diagnostics);
|
|
199
|
+
}
|
|
178
200
|
function capacityProviderSecurityDefaults() {
|
|
179
201
|
return {
|
|
180
202
|
proofTtlSeconds: CAPACITY_PROVIDER_PROOF_TTL_SECONDS,
|
|
@@ -188,6 +210,7 @@ export {
|
|
|
188
210
|
nonEmpty,
|
|
189
211
|
result,
|
|
190
212
|
validateCapacityProviderManifestV3,
|
|
213
|
+
validateCapacityProviderManifestV4,
|
|
191
214
|
validateCapacityProviderProofPayload,
|
|
192
215
|
validateCapacityProviderPublicJwk,
|
|
193
216
|
validateProviderSupplyOffer
|