@treeseed/sdk 0.13.0-rc.55 → 0.13.0-rc.57
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/validation/activity-profile.js +18 -9
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +558 -636
- package/dist/agent-capacity/validation/agent-definition-schema.js +8 -28
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +11 -11
- package/dist/capacity-provider/capability-ontology.d.ts +1211 -0
- package/dist/capacity-provider/capability-ontology.js +200 -0
- package/dist/capacity-provider/contracts/governance.d.ts +37 -2
- 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 +3 -0
- package/dist/capacity-provider/index.js +3 -0
- package/dist/capacity-provider/sandbox-contracts.d.ts +147 -26
- package/dist/capacity-provider/sandbox-contracts.js +16 -1
- package/dist/capacity-provider/validation.d.ts +2 -1
- package/dist/capacity-provider/validation.js +34 -1
- package/dist/content/validation/agent-operational-content-schemas.d.ts +16 -16
- package/dist/content/validation/auxiliary-content-schemas.d.ts +2 -2
- package/dist/content/validation/content-model-schemas.d.ts +1077 -1220
- package/dist/content/validation/portable-content-data.d.ts +104 -117
- package/dist/deployment/schemas.d.ts +169 -25
- package/dist/deployment/schemas.js +27 -1
- package/dist/operator-contracts/canonical-command-tree.js +17 -1
- 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/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 +3 -3
- package/dist/operator-contracts/control-plane-operations.d.ts +513 -345
- package/dist/operator-contracts/control-plane-operations.js +7 -10
- package/dist/operator-contracts/inbox/contracts.d.ts +16 -16
- package/dist/operator-contracts/index.d.ts +1 -0
- package/dist/operator-contracts/index.js +1 -0
- package/dist/types/agents/agent-activity-profile.d.ts +15 -33
- package/package.json +1 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
4
|
+
const semver = z.string().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u);
|
|
5
|
+
const identifier = z.string().regex(/^[a-z][a-z0-9.-]{1,191}$/u);
|
|
6
|
+
const capabilityId = z.string().regex(/^(?:treeseed\.[a-z][a-z0-9.-]*|provider\.[a-f0-9]{16,64}\.[a-z][a-z0-9.-]*)$/u);
|
|
7
|
+
const jsonSchema = z.record(z.unknown());
|
|
8
|
+
const capabilityReferenceSchema = z.object({ id: capabilityId, version: semver, digest }).strict();
|
|
9
|
+
const artifactContractSchema = z.object({ id: identifier, version: semver, digest, mediaTypes: z.array(z.string().min(1)).default([]) }).strict();
|
|
10
|
+
const configurationFieldSchema = z.object({
|
|
11
|
+
key: identifier,
|
|
12
|
+
description: z.string().min(1),
|
|
13
|
+
schema: jsonSchema,
|
|
14
|
+
requirementSupport: z.array(z.enum(["required", "preferred"])).min(1),
|
|
15
|
+
securityCritical: z.boolean().default(false)
|
|
16
|
+
}).strict();
|
|
17
|
+
const capabilityDefinitionSchema = z.object({
|
|
18
|
+
schemaVersion: z.literal("treeseed.capability-definition/v1"),
|
|
19
|
+
id: capabilityId,
|
|
20
|
+
version: semver,
|
|
21
|
+
digest,
|
|
22
|
+
family: z.enum(["coordination", "research", "data", "engineering", "publishing", "external-work"]),
|
|
23
|
+
title: z.string().min(1),
|
|
24
|
+
description: z.string().min(1),
|
|
25
|
+
status: z.enum(["active", "deprecated", "revoked"]),
|
|
26
|
+
features: z.array(identifier),
|
|
27
|
+
inputs: z.array(artifactContractSchema),
|
|
28
|
+
outputs: z.array(artifactContractSchema),
|
|
29
|
+
configuration: z.array(configurationFieldSchema),
|
|
30
|
+
permissionClasses: z.array(identifier),
|
|
31
|
+
contextModes: z.array(identifier),
|
|
32
|
+
interactionModes: z.array(identifier),
|
|
33
|
+
implies: z.array(capabilityReferenceSchema),
|
|
34
|
+
conflicts: z.array(capabilityReferenceSchema),
|
|
35
|
+
qualificationTier: z.enum(["signed-attestation", "automated-suite", "reviewed-certification"]),
|
|
36
|
+
createdAt: z.string().datetime()
|
|
37
|
+
}).strict();
|
|
38
|
+
const capabilityOntologySchema = z.object({
|
|
39
|
+
schemaVersion: z.literal("treeseed.capability-ontology/v1"),
|
|
40
|
+
generation: z.number().int().positive(),
|
|
41
|
+
digest,
|
|
42
|
+
definitions: z.array(capabilityDefinitionSchema),
|
|
43
|
+
aliases: z.record(capabilityId),
|
|
44
|
+
createdAt: z.string().datetime(),
|
|
45
|
+
signature: z.object({ keyId: identifier, algorithm: z.enum(["Ed25519", "release-catalog"]), value: z.string().min(1) }).strict()
|
|
46
|
+
}).strict().superRefine((catalog, context) => {
|
|
47
|
+
const keys = catalog.definitions.map((entry) => `${entry.id}@${entry.version}`);
|
|
48
|
+
if (new Set(keys).size !== keys.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["definitions"], message: "Capability definitions must be unique by id and version." });
|
|
49
|
+
});
|
|
50
|
+
const configuredValueSchema = z.object({ value: z.unknown(), requirement: z.enum(["required", "preferred"]) }).strict();
|
|
51
|
+
const capabilityDemandSchema = z.object({
|
|
52
|
+
schemaVersion: z.literal("treeseed.capability-demand/v1"),
|
|
53
|
+
ontologyGeneration: z.number().int().positive(),
|
|
54
|
+
requirements: z.array(z.object({
|
|
55
|
+
capabilityId,
|
|
56
|
+
versionRange: z.string().min(1),
|
|
57
|
+
requirement: z.enum(["required", "preferred"]),
|
|
58
|
+
alternativeGroup: identifier.nullable().default(null),
|
|
59
|
+
requiredFeatures: z.array(identifier).default([]),
|
|
60
|
+
configuration: z.record(configuredValueSchema).default({})
|
|
61
|
+
}).strict()).min(1),
|
|
62
|
+
resolved: z.array(capabilityReferenceSchema),
|
|
63
|
+
permissionClasses: z.array(identifier),
|
|
64
|
+
contextModes: z.array(identifier),
|
|
65
|
+
inputContracts: z.array(artifactContractSchema),
|
|
66
|
+
outputContracts: z.array(artifactContractSchema),
|
|
67
|
+
demandDigest: digest
|
|
68
|
+
}).strict();
|
|
69
|
+
const capabilityConformanceSchema = z.object({
|
|
70
|
+
schemaVersion: z.literal("treeseed.capability-conformance/v1"),
|
|
71
|
+
providerId: z.string().min(1),
|
|
72
|
+
capability: capabilityReferenceSchema,
|
|
73
|
+
tier: z.enum(["signed-attestation", "automated-suite", "reviewed-certification"]),
|
|
74
|
+
status: z.enum(["passed", "failed", "revoked"]),
|
|
75
|
+
evidenceDigest: digest,
|
|
76
|
+
suite: z.object({ id: identifier, version: semver }).strict().nullable(),
|
|
77
|
+
issuedAt: z.string().datetime(),
|
|
78
|
+
expiresAt: z.string().datetime().nullable(),
|
|
79
|
+
signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
|
|
80
|
+
}).strict();
|
|
81
|
+
const capabilityOfferSchema = z.object({
|
|
82
|
+
schemaVersion: z.literal("treeseed.capability-offer/v1"),
|
|
83
|
+
offerId: identifier,
|
|
84
|
+
capabilities: z.array(capabilityReferenceSchema).min(1),
|
|
85
|
+
features: z.array(identifier),
|
|
86
|
+
configurationSupport: z.record(z.object({ required: z.boolean(), preferred: z.boolean() }).strict()),
|
|
87
|
+
permissionClasses: z.array(identifier),
|
|
88
|
+
contextModes: z.array(identifier),
|
|
89
|
+
inputContracts: z.array(artifactContractSchema),
|
|
90
|
+
outputContracts: z.array(artifactContractSchema),
|
|
91
|
+
interactionModes: z.array(identifier),
|
|
92
|
+
conformance: z.array(capabilityConformanceSchema).min(1),
|
|
93
|
+
limits: z.record(z.unknown()),
|
|
94
|
+
commercial: z.object({ currency: z.string().min(3).max(3).nullable(), estimatedCost: z.number().nonnegative().nullable() }).strict(),
|
|
95
|
+
region: z.string().min(1).nullable(),
|
|
96
|
+
trust: z.array(identifier),
|
|
97
|
+
offerDigest: digest
|
|
98
|
+
}).strict();
|
|
99
|
+
const capabilityNegotiationReceiptSchema = z.object({
|
|
100
|
+
schemaVersion: z.literal("treeseed.capability-negotiation/v1"),
|
|
101
|
+
demandDigest: digest,
|
|
102
|
+
offerDigest: digest,
|
|
103
|
+
eligible: z.boolean(),
|
|
104
|
+
resolvedCapabilities: z.array(capabilityReferenceSchema),
|
|
105
|
+
omittedPreferred: z.array(z.string()),
|
|
106
|
+
reasons: z.array(z.string()),
|
|
107
|
+
receiptDigest: digest
|
|
108
|
+
}).strict();
|
|
109
|
+
function canonical(value) {
|
|
110
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
111
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
112
|
+
return `{${Object.entries(value).filter(([, item]) => item !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`).join(",")}}`;
|
|
113
|
+
}
|
|
114
|
+
function capabilityContractDigest(value) {
|
|
115
|
+
return `sha256:${createHash("sha256").update(canonical(value)).digest("hex")}`;
|
|
116
|
+
}
|
|
117
|
+
function capabilityDefinitionDigest(value) {
|
|
118
|
+
return capabilityContractDigest(value);
|
|
119
|
+
}
|
|
120
|
+
function capabilityOfferDigest(value) {
|
|
121
|
+
return capabilityContractDigest(value);
|
|
122
|
+
}
|
|
123
|
+
function capabilityDemandDigest(value) {
|
|
124
|
+
return capabilityContractDigest(value);
|
|
125
|
+
}
|
|
126
|
+
function semverSatisfies(version, range) {
|
|
127
|
+
const parse = (input) => /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-|$)/u.exec(input)?.slice(1, 4).map(Number) ?? null;
|
|
128
|
+
const actual = parse(version);
|
|
129
|
+
if (!actual) return false;
|
|
130
|
+
const compare = (left, right) => left[0] - right[0] || left[1] - right[1] || left[2] - right[2];
|
|
131
|
+
if (range.includes("||")) return range.split("||").some((part) => semverSatisfies(version, part.trim()));
|
|
132
|
+
if (/\s/u.test(range.trim())) return range.trim().split(/\s+/u).every((part) => semverSatisfies(version, part));
|
|
133
|
+
for (const operator of [">=", "<=", ">", "<"]) if (range.startsWith(operator)) {
|
|
134
|
+
const expected = parse(range.slice(operator.length));
|
|
135
|
+
if (!expected) return false;
|
|
136
|
+
const result = compare(actual, expected);
|
|
137
|
+
return operator === ">=" ? result >= 0 : operator === "<=" ? result <= 0 : operator === ">" ? result > 0 : result < 0;
|
|
138
|
+
}
|
|
139
|
+
if (range.startsWith("^")) {
|
|
140
|
+
const expected = parse(range.slice(1));
|
|
141
|
+
if (!expected || compare(actual, expected) < 0) return false;
|
|
142
|
+
return expected[0] > 0 ? actual[0] === expected[0] : expected[1] > 0 ? actual[0] === 0 && actual[1] === expected[1] : compare(actual, [0, 0, expected[2] + 1]) < 0;
|
|
143
|
+
}
|
|
144
|
+
if (range.startsWith("~")) {
|
|
145
|
+
const expected = parse(range.slice(1));
|
|
146
|
+
return Boolean(expected && actual[0] === expected[0] && actual[1] === expected[1] && compare(actual, expected) >= 0);
|
|
147
|
+
}
|
|
148
|
+
if (/^\d+\.x$/u.test(range)) return actual[0] === Number(range.split(".")[0]);
|
|
149
|
+
const exact = parse(range);
|
|
150
|
+
return Boolean(exact && compare(actual, exact) === 0);
|
|
151
|
+
}
|
|
152
|
+
function negotiateCapabilityOffer(demand, offer) {
|
|
153
|
+
const reasons = [], omittedPreferred = [], resolvedCapabilities = [];
|
|
154
|
+
const alternatives = /* @__PURE__ */ new Map();
|
|
155
|
+
for (const requirement of demand.requirements) {
|
|
156
|
+
const candidates = offer.capabilities.filter((capability) => capability.id === requirement.capabilityId && semverSatisfies(capability.version, requirement.versionRange));
|
|
157
|
+
const compatible = candidates.find((capability) => demand.resolved.some((resolved) => resolved.id === capability.id && resolved.version === capability.version && resolved.digest === capability.digest));
|
|
158
|
+
const featureCompatible = compatible && requirement.requiredFeatures.every((feature) => offer.features.includes(feature));
|
|
159
|
+
const configMissing = Object.entries(requirement.configuration).filter(([key, configured]) => configured.requirement === "required" && offer.configurationSupport[key]?.required !== true).map(([key]) => key);
|
|
160
|
+
const satisfied = Boolean(featureCompatible && configMissing.length === 0);
|
|
161
|
+
if (requirement.alternativeGroup) {
|
|
162
|
+
const group = alternatives.get(requirement.alternativeGroup) ?? { satisfied: false, required: false };
|
|
163
|
+
alternatives.set(requirement.alternativeGroup, { satisfied: group.satisfied || satisfied, required: group.required || requirement.requirement === "required" });
|
|
164
|
+
} else if (!satisfied && requirement.requirement === "required") reasons.push(`missing_required_capability:${requirement.capabilityId}`);
|
|
165
|
+
else if (!satisfied) omittedPreferred.push(`capability:${requirement.capabilityId}`);
|
|
166
|
+
if (satisfied && compatible) resolvedCapabilities.push(compatible);
|
|
167
|
+
for (const [key, configured] of Object.entries(requirement.configuration)) if (configured.requirement === "preferred" && offer.configurationSupport[key]?.preferred !== true) omittedPreferred.push(`configuration:${requirement.capabilityId}:${key}`);
|
|
168
|
+
}
|
|
169
|
+
for (const [group, state] of alternatives) if (!state.satisfied && state.required) reasons.push(`missing_required_alternative:${group}`);
|
|
170
|
+
else if (!state.satisfied) omittedPreferred.push(`alternative:${group}`);
|
|
171
|
+
for (const permission of demand.permissionClasses) if (!offer.permissionClasses.includes(permission)) reasons.push(`missing_permission_support:${permission}`);
|
|
172
|
+
for (const mode of demand.contextModes) if (!offer.contextModes.includes(mode)) reasons.push(`missing_context_mode:${mode}`);
|
|
173
|
+
for (const contract of demand.inputContracts) if (!offer.inputContracts.some((candidate) => candidate.id === contract.id && candidate.version === contract.version && candidate.digest === contract.digest)) reasons.push(`missing_input_contract:${contract.id}`);
|
|
174
|
+
for (const contract of demand.outputContracts) if (!offer.outputContracts.some((candidate) => candidate.id === contract.id && candidate.version === contract.version && candidate.digest === contract.digest)) reasons.push(`missing_output_contract:${contract.id}`);
|
|
175
|
+
const material = {
|
|
176
|
+
schemaVersion: "treeseed.capability-negotiation/v1",
|
|
177
|
+
demandDigest: demand.demandDigest,
|
|
178
|
+
offerDigest: offer.offerDigest,
|
|
179
|
+
eligible: reasons.length === 0,
|
|
180
|
+
resolvedCapabilities,
|
|
181
|
+
omittedPreferred: [...new Set(omittedPreferred)].sort(),
|
|
182
|
+
reasons: [...new Set(reasons)].sort()
|
|
183
|
+
};
|
|
184
|
+
return capabilityNegotiationReceiptSchema.parse({ ...material, receiptDigest: capabilityContractDigest(material) });
|
|
185
|
+
}
|
|
186
|
+
export {
|
|
187
|
+
capabilityConformanceSchema,
|
|
188
|
+
capabilityContractDigest,
|
|
189
|
+
capabilityDefinitionDigest,
|
|
190
|
+
capabilityDefinitionSchema,
|
|
191
|
+
capabilityDemandDigest,
|
|
192
|
+
capabilityDemandSchema,
|
|
193
|
+
capabilityNegotiationReceiptSchema,
|
|
194
|
+
capabilityOfferDigest,
|
|
195
|
+
capabilityOfferSchema,
|
|
196
|
+
capabilityOntologySchema,
|
|
197
|
+
capabilityReferenceSchema,
|
|
198
|
+
negotiateCapabilityOffer,
|
|
199
|
+
semverSatisfies
|
|
200
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ResearchSourcePolicy } from '../../agent-capacity/contracts/support/research-source-policy.js';
|
|
2
|
+
import type { CapabilityOffer } from '../capability-ontology.js';
|
|
2
3
|
export declare const CAPACITY_PROVIDER_IDENTITY_ALGORITHM: "Ed25519";
|
|
3
4
|
export declare const CAPACITY_PROVIDER_PROOF_TTL_SECONDS = 300;
|
|
4
5
|
export declare const CAPACITY_PROVIDER_ACCESS_TOKEN_TTL_SECONDS = 900;
|
|
@@ -422,9 +423,25 @@ export interface CapacityProviderManifestV3 {
|
|
|
422
423
|
metadata?: Record<string, unknown>;
|
|
423
424
|
}
|
|
424
425
|
export interface CapacityProviderSandboxProfile {
|
|
425
|
-
id:
|
|
426
|
+
id: string;
|
|
427
|
+
contract?: {
|
|
428
|
+
id: string;
|
|
429
|
+
version: string;
|
|
430
|
+
digest: string;
|
|
431
|
+
capabilities: string[];
|
|
432
|
+
};
|
|
426
433
|
guestImage: string;
|
|
427
434
|
guestImageDigest: string;
|
|
435
|
+
lineage?: {
|
|
436
|
+
baseImageDigest: string;
|
|
437
|
+
provenanceDigest: string;
|
|
438
|
+
architectures: Array<'amd64' | 'arm64'>;
|
|
439
|
+
signature: {
|
|
440
|
+
keyId: string;
|
|
441
|
+
algorithm: 'cosign' | 'Ed25519';
|
|
442
|
+
value: string;
|
|
443
|
+
};
|
|
444
|
+
};
|
|
428
445
|
defaultDenyNetwork: true;
|
|
429
446
|
resources: {
|
|
430
447
|
cpuCores: number;
|
|
@@ -445,6 +462,24 @@ export interface CapacityProviderManifestV4 extends Omit<CapacityProviderManifes
|
|
|
445
462
|
adapters: Array<Omit<CapacityProviderManifestV3['adapters'][number], 'isolation'> & {
|
|
446
463
|
isolation: 'microvm' | 'process' | 'worker';
|
|
447
464
|
sandboxProfileIds?: string[];
|
|
465
|
+
defaultSandboxProfiles?: {
|
|
466
|
+
conversation: string;
|
|
467
|
+
execution: string;
|
|
468
|
+
};
|
|
469
|
+
}>;
|
|
470
|
+
}
|
|
471
|
+
export interface CapacityProviderManifestV5 extends Omit<CapacityProviderManifestV4, 'schemaVersion' | 'adapters'> {
|
|
472
|
+
schemaVersion: 5;
|
|
473
|
+
ontology: {
|
|
474
|
+
generation: number;
|
|
475
|
+
digest: string;
|
|
476
|
+
};
|
|
477
|
+
adapters: Array<Omit<CapacityProviderManifestV4['adapters'][number], 'capabilities' | 'sandboxProfileIds' | 'defaultSandboxProfiles'> & {
|
|
478
|
+
isolation: 'microvm';
|
|
479
|
+
offers: Array<{
|
|
480
|
+
offer: CapabilityOffer;
|
|
481
|
+
sandboxProfileId: string;
|
|
482
|
+
}>;
|
|
448
483
|
}>;
|
|
449
484
|
}
|
|
450
|
-
export type CapacityProviderManifest = CapacityProviderManifestV3 | CapacityProviderManifestV4;
|
|
485
|
+
export type CapacityProviderManifest = CapacityProviderManifestV3 | CapacityProviderManifestV4 | CapacityProviderManifestV5;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export declare const CORE_CAPABILITY_DEFINITIONS: {
|
|
2
|
+
schemaVersion: "treeseed.capability-definition/v1";
|
|
3
|
+
status: "active" | "deprecated" | "revoked";
|
|
4
|
+
createdAt: string;
|
|
5
|
+
id: string;
|
|
6
|
+
outputs: {
|
|
7
|
+
id: string;
|
|
8
|
+
digest: string;
|
|
9
|
+
version: string;
|
|
10
|
+
mediaTypes: string[];
|
|
11
|
+
}[];
|
|
12
|
+
digest: string;
|
|
13
|
+
version: string;
|
|
14
|
+
description: string;
|
|
15
|
+
configuration: {
|
|
16
|
+
key: string;
|
|
17
|
+
description: string;
|
|
18
|
+
schema: Record<string, unknown>;
|
|
19
|
+
requirementSupport: ("required" | "preferred")[];
|
|
20
|
+
securityCritical: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
family: "research" | "coordination" | "data" | "engineering" | "publishing" | "external-work";
|
|
23
|
+
title: string;
|
|
24
|
+
features: string[];
|
|
25
|
+
inputs: {
|
|
26
|
+
id: string;
|
|
27
|
+
digest: string;
|
|
28
|
+
version: string;
|
|
29
|
+
mediaTypes: string[];
|
|
30
|
+
}[];
|
|
31
|
+
permissionClasses: string[];
|
|
32
|
+
contextModes: string[];
|
|
33
|
+
interactionModes: string[];
|
|
34
|
+
implies: {
|
|
35
|
+
id: string;
|
|
36
|
+
digest: string;
|
|
37
|
+
version: string;
|
|
38
|
+
}[];
|
|
39
|
+
conflicts: {
|
|
40
|
+
id: string;
|
|
41
|
+
digest: string;
|
|
42
|
+
version: string;
|
|
43
|
+
}[];
|
|
44
|
+
qualificationTier: "signed-attestation" | "automated-suite" | "reviewed-certification";
|
|
45
|
+
}[];
|
|
46
|
+
export declare const LEGACY_CAPABILITY_ALIASES: Record<string, string>;
|
|
47
|
+
export declare function resolveLegacyCapability(value: string, activityType?: string): string | null;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { capabilityDefinitionDigest, capabilityDefinitionSchema } from "./capability-ontology.js";
|
|
2
|
+
const createdAt = "2026-08-29T00:00:00.000Z";
|
|
3
|
+
const services = {
|
|
4
|
+
coordination: ["conversation", "question-answering", "planning", "estimation", "review", "reporting", "human-task-routing", "decision-support"],
|
|
5
|
+
research: ["web", "literature", "market", "repository", "dataset-discovery", "retrieval", "extraction", "verification", "citation", "synthesis", "experimentation"],
|
|
6
|
+
data: ["source-connection", "extraction", "ingestion", "synchronization", "schema-inference", "schema-mapping", "normalization", "transformation", "enrichment", "entity-resolution", "validation", "quality-analysis", "lineage", "statistical-analysis", "visualization", "export"],
|
|
7
|
+
engineering: ["architecture", "repository-analysis", "code-change", "refactoring", "dependency-update", "build", "unit-testing", "integration-testing", "end-to-end-testing", "debugging", "review", "security-analysis", "performance-analysis", "accessibility", "infrastructure", "deployment", "release", "operations"],
|
|
8
|
+
publishing: ["drafting", "editing", "translation", "structured-content", "documentation", "cms", "repository", "package-artifact", "site-build", "site-deployment", "syndication", "release-notes"],
|
|
9
|
+
"external-work": ["ticket-management", "workflow-execution", "notification", "human-service-fulfillment", "artifact-delivery"]
|
|
10
|
+
};
|
|
11
|
+
function definition(family, service) {
|
|
12
|
+
const configuration = [
|
|
13
|
+
["instructions.system", "Provider-neutral system instruction delivery."],
|
|
14
|
+
["instructions.task", "Provider-neutral task instruction delivery."],
|
|
15
|
+
["instructions.templates", "Immutable instruction template delivery."],
|
|
16
|
+
["context.queries", "Resolved context query manifest delivery."],
|
|
17
|
+
["tools.policy", "Assignment-scoped tool policy enforcement."]
|
|
18
|
+
].map(([key, description]) => ({ key, description, schema: {}, requirementSupport: ["required", "preferred"], securityCritical: true }));
|
|
19
|
+
const material = {
|
|
20
|
+
schemaVersion: "treeseed.capability-definition/v1",
|
|
21
|
+
id: `treeseed.${family}.${service}`,
|
|
22
|
+
version: "1.0.0",
|
|
23
|
+
family,
|
|
24
|
+
title: service.split("-").map((part) => `${part[0]?.toUpperCase()}${part.slice(1)}`).join(" "),
|
|
25
|
+
description: `Standard TreeSeed ${family} capability for ${service.replaceAll("-", " ")}.`,
|
|
26
|
+
status: "active",
|
|
27
|
+
features: [],
|
|
28
|
+
inputs: [],
|
|
29
|
+
outputs: [],
|
|
30
|
+
configuration,
|
|
31
|
+
permissionClasses: ["content-policy", "repository-policy", "network-policy", "shell-policy", "tool-policy"],
|
|
32
|
+
contextModes: ["inline", "manifest"],
|
|
33
|
+
interactionModes: ["asynchronous", "interactive"],
|
|
34
|
+
implies: [],
|
|
35
|
+
conflicts: [],
|
|
36
|
+
qualificationTier: ["security-analysis", "deployment", "release", "operations", "human-service-fulfillment"].includes(service) ? "automated-suite" : "signed-attestation",
|
|
37
|
+
createdAt
|
|
38
|
+
};
|
|
39
|
+
return capabilityDefinitionSchema.parse({ ...material, digest: capabilityDefinitionDigest(material) });
|
|
40
|
+
}
|
|
41
|
+
const CORE_CAPABILITY_DEFINITIONS = Object.entries(services).flatMap(([family, values]) => values.map((service) => definition(family, service)));
|
|
42
|
+
const LEGACY_CAPABILITY_ALIASES = {
|
|
43
|
+
communication: "treeseed.coordination.conversation",
|
|
44
|
+
reporting: "treeseed.coordination.reporting",
|
|
45
|
+
"terminal-reporting": "treeseed.coordination.reporting",
|
|
46
|
+
"independent-review": "treeseed.engineering.review",
|
|
47
|
+
"governed-revision": "treeseed.engineering.code-change",
|
|
48
|
+
repository_work: "treeseed.engineering.repository-analysis",
|
|
49
|
+
"repository-read": "treeseed.engineering.repository-analysis",
|
|
50
|
+
research: "treeseed.research.synthesis",
|
|
51
|
+
planning: "treeseed.coordination.planning"
|
|
52
|
+
};
|
|
53
|
+
function resolveLegacyCapability(value, activityType) {
|
|
54
|
+
if (value === "agent-execution") return { chat: "treeseed.coordination.conversation", acting: "treeseed.engineering.code-change", reviewing: "treeseed.engineering.review", estimating: "treeseed.coordination.estimation", reporting: "treeseed.coordination.reporting", planning: "treeseed.coordination.planning" }[activityType ?? ""] ?? null;
|
|
55
|
+
if (value === "repository_work" && activityType === "acting") return "treeseed.engineering.code-change";
|
|
56
|
+
if (value.startsWith("engineering:")) return value.endsWith(":review") ? "treeseed.engineering.review" : "treeseed.engineering.code-change";
|
|
57
|
+
return LEGACY_CAPABILITY_ALIASES[value] ?? (value.startsWith("treeseed.") || value.startsWith("provider.") ? value : null);
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
CORE_CAPABILITY_DEFINITIONS,
|
|
61
|
+
LEGACY_CAPABILITY_ALIASES,
|
|
62
|
+
resolveLegacyCapability
|
|
63
|
+
};
|