@treeseed/sdk 0.13.0-rc.54 → 0.13.0-rc.56
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/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +0 -2
- package/dist/agent-capacity/contracts/configuration/configuration.js +1 -1
- package/dist/agent-capacity/validation/activity-profile.js +18 -9
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +715 -793
- package/dist/agent-capacity/validation/agent-definition-schema.js +8 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +12 -12
- package/dist/capacity-provider/capability-ontology.d.ts +1211 -0
- package/dist/capacity-provider/capability-ontology.js +200 -0
- package/dist/capacity-provider/client.d.ts +3 -3
- package/dist/capacity-provider/contracts/governance.d.ts +63 -1
- package/dist/capacity-provider/core-capability-catalog.d.ts +47 -0
- package/dist/capacity-provider/core-capability-catalog.js +63 -0
- package/dist/capacity-provider/environment-catalog.d.ts +877 -0
- package/dist/capacity-provider/environment-catalog.js +116 -0
- package/dist/capacity-provider/index.d.ts +4 -0
- package/dist/capacity-provider/index.js +4 -0
- package/dist/capacity-provider/sandbox-contracts.d.ts +543 -0
- package/dist/capacity-provider/sandbox-contracts.js +86 -0
- package/dist/capacity-provider/validation.d.ts +3 -1
- package/dist/capacity-provider/validation.js +56 -0
- package/dist/content/validation/agent-operational-content-schemas.d.ts +76 -76
- package/dist/content/validation/auxiliary-content-schemas.d.ts +16 -16
- package/dist/content/validation/content-model-schemas.d.ts +1462 -1605
- package/dist/content/validation/portable-content-data.d.ts +139 -152
- package/dist/deployment/ai-mode.d.ts +4 -4
- package/dist/deployment/schemas.d.ts +410 -92
- package/dist/deployment/schemas.js +23 -1
- package/dist/development/schemas.d.ts +22 -22
- package/dist/operator-contracts/canonical-command-tree.js +45 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.d.ts +164 -0
- package/dist/operator-contracts/catalog/capability-ontology-operations.js +24 -0
- package/dist/operator-contracts/catalog/communication-operations.d.ts +50 -50
- package/dist/operator-contracts/catalog/control-plane-catalog.d.ts +6 -0
- package/dist/operator-contracts/catalog/control-plane-catalog.js +18 -0
- package/dist/operator-contracts/catalog/inbox-operations.d.ts +25 -25
- package/dist/operator-contracts/communication/contracts.d.ts +139 -139
- package/dist/operator-contracts/control-plane-operations.d.ts +588 -420
- package/dist/operator-contracts/control-plane-operations.js +7 -10
- package/dist/operator-contracts/inbox/contracts.d.ts +77 -77
- package/dist/operator-contracts/index.d.ts +1 -0
- package/dist/operator-contracts/index.js +1 -0
- 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/dist/types/agents/agent-activity-profile.d.ts +15 -33
- package/package.json +5 -1
|
@@ -0,0 +1,86 @@
|
|
|
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 = identifier;
|
|
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
|
+
environmentContract: z.object({ id: identifier, version: z.string().regex(/^\d+\.\d+\.\d+$/u), digest, capabilities: z.array(identifier) }).strict().optional(),
|
|
15
|
+
guestImage: z.string().min(1),
|
|
16
|
+
guestImageDigest: digest,
|
|
17
|
+
identityManifestDigest: digest,
|
|
18
|
+
contextManifestDigest: digest,
|
|
19
|
+
resources: z.object({
|
|
20
|
+
cpuCores: z.number().positive(),
|
|
21
|
+
memoryBytes: z.number().int().positive(),
|
|
22
|
+
diskBytes: z.number().int().positive(),
|
|
23
|
+
durationSeconds: z.number().int().positive(),
|
|
24
|
+
processLimit: z.number().int().positive(),
|
|
25
|
+
outputBytes: z.number().int().positive()
|
|
26
|
+
}).strict(),
|
|
27
|
+
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()),
|
|
28
|
+
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()),
|
|
29
|
+
network: z.object({ defaultDeny: z.literal(true), relayUrl: z.string().url().startsWith("https://"), allowedServices: z.array(identifier), connectedDevelopmentSessionId: z.string().min(1).optional() }).strict(),
|
|
30
|
+
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(),
|
|
31
|
+
credentialHandles: z.array(z.object({ id: identifier, profileId: identifier, revealAllowed: z.literal(false) }).strict()),
|
|
32
|
+
treeDxHandleIds: z.array(z.string().min(1)),
|
|
33
|
+
leaseExpiresAt: z.string().datetime(),
|
|
34
|
+
signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
|
|
35
|
+
}).strict();
|
|
36
|
+
const sandboxEventSchema = z.object({
|
|
37
|
+
schemaVersion: z.literal("treeseed.sandbox-event/v1"),
|
|
38
|
+
sandboxId: z.string().min(1),
|
|
39
|
+
assignmentId: z.string().min(1),
|
|
40
|
+
sequence: z.number().int().nonnegative(),
|
|
41
|
+
occurredAt: z.string().datetime(),
|
|
42
|
+
type: z.enum(["sandbox.created", "sandbox.ready", "execution.started", "execution.progress", "tool.requested", "tool.completed", "execution.completed", "execution.failed", "sandbox.destroyed"]),
|
|
43
|
+
payload: z.record(z.unknown()).default({})
|
|
44
|
+
}).strict();
|
|
45
|
+
const sandboxLeaseRenewalSchema = z.object({
|
|
46
|
+
schemaVersion: z.literal("treeseed.sandbox-lease-renewal/v1"),
|
|
47
|
+
sandboxId: z.string().min(1),
|
|
48
|
+
assignmentId: z.string().min(1),
|
|
49
|
+
providerId: z.string().min(1),
|
|
50
|
+
teamId: z.string().min(1),
|
|
51
|
+
leaseExpiresAt: z.string().datetime(),
|
|
52
|
+
issuedAt: z.string().datetime(),
|
|
53
|
+
signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
|
|
54
|
+
}).strict();
|
|
55
|
+
const sandboxResultSchema = z.object({
|
|
56
|
+
schemaVersion: z.literal("treeseed.sandbox-result/v1"),
|
|
57
|
+
sandboxId: z.string().min(1),
|
|
58
|
+
assignmentId: z.string().min(1),
|
|
59
|
+
status: z.enum(["completed", "failed", "cancelled", "expired"]),
|
|
60
|
+
summary: z.string(),
|
|
61
|
+
responseMarkdown: z.string().optional(),
|
|
62
|
+
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()),
|
|
63
|
+
usage: z.record(z.unknown()).default({}),
|
|
64
|
+
diagnostics: z.record(z.unknown()).default({}),
|
|
65
|
+
teardown: z.object({ verified: z.boolean(), completedAt: z.string().datetime().nullable() }).strict()
|
|
66
|
+
}).strict();
|
|
67
|
+
const providerEnvironmentReceiptSchema = z.object({
|
|
68
|
+
schemaVersion: z.literal("treeseed.provider-environment-receipt/v1"),
|
|
69
|
+
assignmentId: z.string().min(1),
|
|
70
|
+
offerId: identifier,
|
|
71
|
+
providerId: z.string().min(1),
|
|
72
|
+
imageDigest: digest,
|
|
73
|
+
baseLineage: z.object({ baseImageDigest: digest, provenanceDigest: digest, architectures: z.array(z.enum(["amd64", "arm64"])).min(1) }).strict(),
|
|
74
|
+
securityAttestationDigest: digest,
|
|
75
|
+
brokerVersion: z.string().min(1),
|
|
76
|
+
teardown: z.object({ verified: z.boolean(), completedAt: z.string().datetime().nullable() }).strict(),
|
|
77
|
+
createdAt: z.string().datetime(),
|
|
78
|
+
signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
|
|
79
|
+
}).strict();
|
|
80
|
+
export {
|
|
81
|
+
providerEnvironmentReceiptSchema,
|
|
82
|
+
sandboxAssignmentSchema,
|
|
83
|
+
sandboxEventSchema,
|
|
84
|
+
sandboxLeaseRenewalSchema,
|
|
85
|
+
sandboxResultSchema
|
|
86
|
+
};
|
|
@@ -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 CapacityProviderManifestV5, 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,8 @@ 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;
|
|
24
|
+
export declare function validateCapacityProviderManifestV5(manifest: CapacityProviderManifestV5): CapacityProviderContractValidation;
|
|
23
25
|
export declare function capacityProviderSecurityDefaults(): {
|
|
24
26
|
proofTtlSeconds: number;
|
|
25
27
|
accessTokenTtlSeconds: number;
|
|
@@ -175,6 +175,60 @@ 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 (!/^[a-z][a-z0-9._-]{0,127}$/u.test(profile.id)) add(diagnostics, "provider_sandbox_profile_invalid", `sandbox.profiles[${index}].id`, "Sandbox profile id must be a provider-local identifier.");
|
|
191
|
+
if (profile.contract) {
|
|
192
|
+
if (!/^[a-z][a-z0-9._-]{0,127}$/u.test(profile.contract.id) || !/^\d+\.\d+\.\d+$/u.test(profile.contract.version) || !/^sha256:[a-f0-9]{64}$/u.test(profile.contract.digest)) add(diagnostics, "provider_sandbox_contract_invalid", `sandbox.profiles[${index}].contract`, "Portable sandbox contracts require an id, exact semantic version, and immutable digest.");
|
|
193
|
+
if (!Array.isArray(profile.contract.capabilities) || profile.contract.capabilities.some((capability) => !/^[a-z][a-z0-9._-]{0,127}$/u.test(capability))) add(diagnostics, "provider_sandbox_contract_capabilities_invalid", `sandbox.profiles[${index}].contract.capabilities`, "Sandbox contract capabilities must be portable identifiers.");
|
|
194
|
+
}
|
|
195
|
+
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.");
|
|
196
|
+
if (profile.defaultDenyNetwork !== true) add(diagnostics, "provider_sandbox_network_policy_invalid", `sandbox.profiles[${index}].defaultDenyNetwork`, "Sandbox networking must default deny.");
|
|
197
|
+
}
|
|
198
|
+
for (const [index, adapter] of manifest.adapters.entries()) {
|
|
199
|
+
if (adapter.isolation !== "microvm") add(diagnostics, "provider_v4_microvm_required", `adapters[${index}].isolation`, "Manifest v4 adapters must use microvm isolation.");
|
|
200
|
+
for (const profile of adapter.sandboxProfileIds ?? []) if (!profiles.has(profile)) add(diagnostics, "provider_sandbox_profile_unknown", `adapters[${index}].sandboxProfileIds`, `Unknown sandbox profile ${profile}.`);
|
|
201
|
+
for (const [purpose, profile] of Object.entries(adapter.defaultSandboxProfiles ?? {})) if (!profiles.has(profile)) add(diagnostics, "provider_sandbox_default_unknown", `adapters[${index}].defaultSandboxProfiles.${purpose}`, `Unknown default sandbox profile ${profile}.`);
|
|
202
|
+
}
|
|
203
|
+
return result(diagnostics);
|
|
204
|
+
}
|
|
205
|
+
function validateCapacityProviderManifestV5(manifest) {
|
|
206
|
+
const compatible = { ...manifest, schemaVersion: 4, adapters: manifest.adapters.map((adapter) => ({
|
|
207
|
+
...adapter,
|
|
208
|
+
capabilities: [...new Set(adapter.offers.flatMap(({ offer }) => offer.capabilities.map(({ id }) => id)))],
|
|
209
|
+
sandboxProfileIds: [...new Set(adapter.offers.map(({ sandboxProfileId }) => sandboxProfileId))],
|
|
210
|
+
defaultSandboxProfiles: void 0
|
|
211
|
+
})) };
|
|
212
|
+
const diagnostics = validateCapacityProviderManifestV4(compatible).diagnostics.filter((entry) => entry.code !== "provider_sandbox_default_unknown");
|
|
213
|
+
if (manifest.schemaVersion !== 5) add(diagnostics, "provider_manifest_schema_invalid", "schemaVersion", "Capacity provider manifest schemaVersion must be 5.");
|
|
214
|
+
if (!Number.isInteger(manifest.ontology?.generation) || manifest.ontology.generation < 1 || !/^sha256:[a-f0-9]{64}$/u.test(manifest.ontology?.digest ?? "")) add(diagnostics, "provider_ontology_binding_invalid", "ontology", "Manifest v5 requires an exact ontology generation and digest.");
|
|
215
|
+
const profiles = new Set(manifest.sandbox.profiles.map(({ id }) => id)), offerIds = /* @__PURE__ */ new Set();
|
|
216
|
+
for (const [profileIndex, profile] of manifest.sandbox.profiles.entries()) {
|
|
217
|
+
if (!profile.lineage || !/^sha256:[a-f0-9]{64}$/u.test(profile.lineage.baseImageDigest) || !/^sha256:[a-f0-9]{64}$/u.test(profile.lineage.provenanceDigest) || !profile.lineage.architectures.length || !profile.lineage.signature.value) add(diagnostics, "provider_sandbox_lineage_required", `sandbox.profiles[${profileIndex}].lineage`, "Manifest v5 sandbox images require signed exact sandbox-base lineage and architectures.");
|
|
218
|
+
}
|
|
219
|
+
for (const [adapterIndex, adapter] of manifest.adapters.entries()) {
|
|
220
|
+
if (!adapter.offers.length) add(diagnostics, "provider_adapter_offers_required", `adapters[${adapterIndex}].offers`, "Every v5 adapter must expose at least one standardized capability offer.");
|
|
221
|
+
for (const [offerIndex, binding] of adapter.offers.entries()) {
|
|
222
|
+
const path = `adapters[${adapterIndex}].offers[${offerIndex}]`;
|
|
223
|
+
if (offerIds.has(binding.offer.offerId)) add(diagnostics, "provider_offer_id_duplicate", `${path}.offer.offerId`, "Offer ids must be provider-global unique.");
|
|
224
|
+
offerIds.add(binding.offer.offerId);
|
|
225
|
+
if (!profiles.has(binding.sandboxProfileId)) add(diagnostics, "provider_offer_sandbox_unknown", `${path}.sandboxProfileId`, "Offer references an unknown provider-local sandbox profile.");
|
|
226
|
+
if (binding.offer.capabilities.some((reference) => !reference.id.startsWith("treeseed.") && !reference.id.startsWith("provider."))) add(diagnostics, "provider_offer_capability_namespace_invalid", `${path}.offer.capabilities`, "Offers require standardized TreeSeed or provider capability references.");
|
|
227
|
+
if (binding.offer.conformance.some((entry) => entry.status !== "passed")) add(diagnostics, "provider_offer_conformance_failed", `${path}.offer.conformance`, "Only passing capability conformance may be advertised.");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return result(diagnostics);
|
|
231
|
+
}
|
|
178
232
|
function capacityProviderSecurityDefaults() {
|
|
179
233
|
return {
|
|
180
234
|
proofTtlSeconds: CAPACITY_PROVIDER_PROOF_TTL_SECONDS,
|
|
@@ -188,6 +242,8 @@ export {
|
|
|
188
242
|
nonEmpty,
|
|
189
243
|
result,
|
|
190
244
|
validateCapacityProviderManifestV3,
|
|
245
|
+
validateCapacityProviderManifestV4,
|
|
246
|
+
validateCapacityProviderManifestV5,
|
|
191
247
|
validateCapacityProviderProofPayload,
|
|
192
248
|
validateCapacityProviderPublicJwk,
|
|
193
249
|
validateProviderSupplyOffer
|