@treeseed/sdk 0.13.0-rc.45 → 0.13.0-rc.48
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/deployment/schemas.d.ts +162 -162
- package/dist/development/schemas.d.ts +260 -0
- package/dist/development/schemas.js +47 -1
- package/dist/operator-contracts/canonical-command-tree.js +24 -0
- package/dist/operator-contracts/catalog/treeai-operations.d.ts +14 -0
- package/dist/operator-contracts/catalog/treeai-operations.js +62 -0
- package/dist/operator-contracts/control-plane-operation.d.ts +1 -1
- package/dist/operator-contracts/control-plane-operations.d.ts +2 -1
- package/dist/operator-contracts/control-plane-operations.js +2 -0
- package/dist/treeai/catalog.d.ts +1 -0
- package/dist/treeai/catalog.js +1 -0
- package/dist/treeai/client.d.ts +913 -0
- package/dist/treeai/client.js +44 -0
- package/dist/treeai/contract.d.ts +42 -0
- package/dist/treeai/contract.js +51 -0
- package/dist/treeai/generated/upstream.d.ts +890 -0
- package/dist/treeai/generated/upstream.js +4 -0
- package/dist/treeai/index.d.ts +4 -0
- package/dist/treeai/index.js +4 -0
- package/dist/treedx/client.d.ts +2 -2
- package/package.json +6 -1
|
@@ -3141,9 +3141,269 @@ export declare const developmentCandidateSchema: z.ZodEffects<z.ZodObject<{
|
|
|
3141
3141
|
};
|
|
3142
3142
|
promotable: boolean;
|
|
3143
3143
|
}>;
|
|
3144
|
+
/** Exact, immutable custody record used to promote an already-built candidate. */
|
|
3145
|
+
export declare const releaseEvidenceSchema: z.ZodEffects<z.ZodObject<{
|
|
3146
|
+
schemaVersion: z.ZodLiteral<"treeseed.release-evidence/v1">;
|
|
3147
|
+
candidate: z.ZodObject<{
|
|
3148
|
+
id: z.ZodString;
|
|
3149
|
+
receiptDigest: z.ZodString;
|
|
3150
|
+
sourceCommit: z.ZodString;
|
|
3151
|
+
stagingRef: z.ZodString;
|
|
3152
|
+
workflowRunId: z.ZodString;
|
|
3153
|
+
createdAt: z.ZodString;
|
|
3154
|
+
}, "strict", z.ZodTypeAny, {
|
|
3155
|
+
id: string;
|
|
3156
|
+
createdAt: string;
|
|
3157
|
+
receiptDigest: string;
|
|
3158
|
+
sourceCommit: string;
|
|
3159
|
+
stagingRef: string;
|
|
3160
|
+
workflowRunId: string;
|
|
3161
|
+
}, {
|
|
3162
|
+
id: string;
|
|
3163
|
+
createdAt: string;
|
|
3164
|
+
receiptDigest: string;
|
|
3165
|
+
sourceCommit: string;
|
|
3166
|
+
stagingRef: string;
|
|
3167
|
+
workflowRunId: string;
|
|
3168
|
+
}>;
|
|
3169
|
+
packages: z.ZodArray<z.ZodObject<{
|
|
3170
|
+
projectId: z.ZodString;
|
|
3171
|
+
name: z.ZodString;
|
|
3172
|
+
version: z.ZodString;
|
|
3173
|
+
minimumBump: z.ZodEnum<["none", "patch", "minor", "major"]>;
|
|
3174
|
+
}, "strict", z.ZodTypeAny, {
|
|
3175
|
+
projectId: string;
|
|
3176
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3177
|
+
name: string;
|
|
3178
|
+
version: string;
|
|
3179
|
+
}, {
|
|
3180
|
+
projectId: string;
|
|
3181
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3182
|
+
name: string;
|
|
3183
|
+
version: string;
|
|
3184
|
+
}>, "many">;
|
|
3185
|
+
artifacts: z.ZodArray<z.ZodObject<{
|
|
3186
|
+
id: z.ZodString;
|
|
3187
|
+
kind: z.ZodEnum<["npm-package", "oci-image", "archive", "executable", "sbom", "contract-bundle", "compatibility-attestation", "component-manifest", "compose", "provenance"]>;
|
|
3188
|
+
identity: z.ZodString;
|
|
3189
|
+
digest: z.ZodString;
|
|
3190
|
+
mediaType: z.ZodString;
|
|
3191
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
3192
|
+
}, "strict", z.ZodTypeAny, {
|
|
3193
|
+
kind: "npm-package" | "oci-image" | "archive" | "executable" | "contract-bundle" | "sbom" | "compatibility-attestation" | "component-manifest" | "compose" | "provenance";
|
|
3194
|
+
id: string;
|
|
3195
|
+
mediaType: string;
|
|
3196
|
+
identity: string;
|
|
3197
|
+
digest: string;
|
|
3198
|
+
size?: number | undefined;
|
|
3199
|
+
}, {
|
|
3200
|
+
kind: "npm-package" | "oci-image" | "archive" | "executable" | "contract-bundle" | "sbom" | "compatibility-attestation" | "component-manifest" | "compose" | "provenance";
|
|
3201
|
+
id: string;
|
|
3202
|
+
mediaType: string;
|
|
3203
|
+
identity: string;
|
|
3204
|
+
digest: string;
|
|
3205
|
+
size?: number | undefined;
|
|
3206
|
+
}>, "many">;
|
|
3207
|
+
contractBundles: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3208
|
+
id: z.ZodString;
|
|
3209
|
+
digest: z.ZodString;
|
|
3210
|
+
}, "strict", z.ZodTypeAny, {
|
|
3211
|
+
id: string;
|
|
3212
|
+
digest: string;
|
|
3213
|
+
}, {
|
|
3214
|
+
id: string;
|
|
3215
|
+
digest: string;
|
|
3216
|
+
}>, "many">>;
|
|
3217
|
+
compatibilityAttestations: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3218
|
+
contractId: z.ZodString;
|
|
3219
|
+
digest: z.ZodString;
|
|
3220
|
+
compatible: z.ZodLiteral<true>;
|
|
3221
|
+
minimumBump: z.ZodEnum<["none", "patch", "minor", "major"]>;
|
|
3222
|
+
}, "strict", z.ZodTypeAny, {
|
|
3223
|
+
digest: string;
|
|
3224
|
+
contractId: string;
|
|
3225
|
+
compatible: true;
|
|
3226
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3227
|
+
}, {
|
|
3228
|
+
digest: string;
|
|
3229
|
+
contractId: string;
|
|
3230
|
+
compatible: true;
|
|
3231
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3232
|
+
}>, "many">>;
|
|
3233
|
+
verification: z.ZodObject<{
|
|
3234
|
+
status: z.ZodLiteral<"passed">;
|
|
3235
|
+
operations: z.ZodArray<z.ZodString, "many">;
|
|
3236
|
+
completedAt: z.ZodString;
|
|
3237
|
+
}, "strict", z.ZodTypeAny, {
|
|
3238
|
+
status: "passed";
|
|
3239
|
+
operations: string[];
|
|
3240
|
+
completedAt: string;
|
|
3241
|
+
}, {
|
|
3242
|
+
status: "passed";
|
|
3243
|
+
operations: string[];
|
|
3244
|
+
completedAt: string;
|
|
3245
|
+
}>;
|
|
3246
|
+
}, "strict", z.ZodTypeAny, {
|
|
3247
|
+
candidate: {
|
|
3248
|
+
id: string;
|
|
3249
|
+
createdAt: string;
|
|
3250
|
+
receiptDigest: string;
|
|
3251
|
+
sourceCommit: string;
|
|
3252
|
+
stagingRef: string;
|
|
3253
|
+
workflowRunId: string;
|
|
3254
|
+
};
|
|
3255
|
+
artifacts: {
|
|
3256
|
+
kind: "npm-package" | "oci-image" | "archive" | "executable" | "contract-bundle" | "sbom" | "compatibility-attestation" | "component-manifest" | "compose" | "provenance";
|
|
3257
|
+
id: string;
|
|
3258
|
+
mediaType: string;
|
|
3259
|
+
identity: string;
|
|
3260
|
+
digest: string;
|
|
3261
|
+
size?: number | undefined;
|
|
3262
|
+
}[];
|
|
3263
|
+
schemaVersion: "treeseed.release-evidence/v1";
|
|
3264
|
+
compatibilityAttestations: {
|
|
3265
|
+
digest: string;
|
|
3266
|
+
contractId: string;
|
|
3267
|
+
compatible: true;
|
|
3268
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3269
|
+
}[];
|
|
3270
|
+
verification: {
|
|
3271
|
+
status: "passed";
|
|
3272
|
+
operations: string[];
|
|
3273
|
+
completedAt: string;
|
|
3274
|
+
};
|
|
3275
|
+
packages: {
|
|
3276
|
+
projectId: string;
|
|
3277
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3278
|
+
name: string;
|
|
3279
|
+
version: string;
|
|
3280
|
+
}[];
|
|
3281
|
+
contractBundles: {
|
|
3282
|
+
id: string;
|
|
3283
|
+
digest: string;
|
|
3284
|
+
}[];
|
|
3285
|
+
}, {
|
|
3286
|
+
candidate: {
|
|
3287
|
+
id: string;
|
|
3288
|
+
createdAt: string;
|
|
3289
|
+
receiptDigest: string;
|
|
3290
|
+
sourceCommit: string;
|
|
3291
|
+
stagingRef: string;
|
|
3292
|
+
workflowRunId: string;
|
|
3293
|
+
};
|
|
3294
|
+
artifacts: {
|
|
3295
|
+
kind: "npm-package" | "oci-image" | "archive" | "executable" | "contract-bundle" | "sbom" | "compatibility-attestation" | "component-manifest" | "compose" | "provenance";
|
|
3296
|
+
id: string;
|
|
3297
|
+
mediaType: string;
|
|
3298
|
+
identity: string;
|
|
3299
|
+
digest: string;
|
|
3300
|
+
size?: number | undefined;
|
|
3301
|
+
}[];
|
|
3302
|
+
schemaVersion: "treeseed.release-evidence/v1";
|
|
3303
|
+
verification: {
|
|
3304
|
+
status: "passed";
|
|
3305
|
+
operations: string[];
|
|
3306
|
+
completedAt: string;
|
|
3307
|
+
};
|
|
3308
|
+
packages: {
|
|
3309
|
+
projectId: string;
|
|
3310
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3311
|
+
name: string;
|
|
3312
|
+
version: string;
|
|
3313
|
+
}[];
|
|
3314
|
+
compatibilityAttestations?: {
|
|
3315
|
+
digest: string;
|
|
3316
|
+
contractId: string;
|
|
3317
|
+
compatible: true;
|
|
3318
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3319
|
+
}[] | undefined;
|
|
3320
|
+
contractBundles?: {
|
|
3321
|
+
id: string;
|
|
3322
|
+
digest: string;
|
|
3323
|
+
}[] | undefined;
|
|
3324
|
+
}>, {
|
|
3325
|
+
candidate: {
|
|
3326
|
+
id: string;
|
|
3327
|
+
createdAt: string;
|
|
3328
|
+
receiptDigest: string;
|
|
3329
|
+
sourceCommit: string;
|
|
3330
|
+
stagingRef: string;
|
|
3331
|
+
workflowRunId: string;
|
|
3332
|
+
};
|
|
3333
|
+
artifacts: {
|
|
3334
|
+
kind: "npm-package" | "oci-image" | "archive" | "executable" | "contract-bundle" | "sbom" | "compatibility-attestation" | "component-manifest" | "compose" | "provenance";
|
|
3335
|
+
id: string;
|
|
3336
|
+
mediaType: string;
|
|
3337
|
+
identity: string;
|
|
3338
|
+
digest: string;
|
|
3339
|
+
size?: number | undefined;
|
|
3340
|
+
}[];
|
|
3341
|
+
schemaVersion: "treeseed.release-evidence/v1";
|
|
3342
|
+
compatibilityAttestations: {
|
|
3343
|
+
digest: string;
|
|
3344
|
+
contractId: string;
|
|
3345
|
+
compatible: true;
|
|
3346
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3347
|
+
}[];
|
|
3348
|
+
verification: {
|
|
3349
|
+
status: "passed";
|
|
3350
|
+
operations: string[];
|
|
3351
|
+
completedAt: string;
|
|
3352
|
+
};
|
|
3353
|
+
packages: {
|
|
3354
|
+
projectId: string;
|
|
3355
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3356
|
+
name: string;
|
|
3357
|
+
version: string;
|
|
3358
|
+
}[];
|
|
3359
|
+
contractBundles: {
|
|
3360
|
+
id: string;
|
|
3361
|
+
digest: string;
|
|
3362
|
+
}[];
|
|
3363
|
+
}, {
|
|
3364
|
+
candidate: {
|
|
3365
|
+
id: string;
|
|
3366
|
+
createdAt: string;
|
|
3367
|
+
receiptDigest: string;
|
|
3368
|
+
sourceCommit: string;
|
|
3369
|
+
stagingRef: string;
|
|
3370
|
+
workflowRunId: string;
|
|
3371
|
+
};
|
|
3372
|
+
artifacts: {
|
|
3373
|
+
kind: "npm-package" | "oci-image" | "archive" | "executable" | "contract-bundle" | "sbom" | "compatibility-attestation" | "component-manifest" | "compose" | "provenance";
|
|
3374
|
+
id: string;
|
|
3375
|
+
mediaType: string;
|
|
3376
|
+
identity: string;
|
|
3377
|
+
digest: string;
|
|
3378
|
+
size?: number | undefined;
|
|
3379
|
+
}[];
|
|
3380
|
+
schemaVersion: "treeseed.release-evidence/v1";
|
|
3381
|
+
verification: {
|
|
3382
|
+
status: "passed";
|
|
3383
|
+
operations: string[];
|
|
3384
|
+
completedAt: string;
|
|
3385
|
+
};
|
|
3386
|
+
packages: {
|
|
3387
|
+
projectId: string;
|
|
3388
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3389
|
+
name: string;
|
|
3390
|
+
version: string;
|
|
3391
|
+
}[];
|
|
3392
|
+
compatibilityAttestations?: {
|
|
3393
|
+
digest: string;
|
|
3394
|
+
contractId: string;
|
|
3395
|
+
compatible: true;
|
|
3396
|
+
minimumBump: "none" | "patch" | "minor" | "major";
|
|
3397
|
+
}[] | undefined;
|
|
3398
|
+
contractBundles?: {
|
|
3399
|
+
id: string;
|
|
3400
|
+
digest: string;
|
|
3401
|
+
}[] | undefined;
|
|
3402
|
+
}>;
|
|
3144
3403
|
export type DevelopmentRuntime = z.infer<typeof developmentRuntimeSchema>;
|
|
3145
3404
|
export type DevelopmentTarget = z.infer<typeof developmentTargetSchema>;
|
|
3146
3405
|
export type DevelopmentSession = z.infer<typeof developmentSessionSchema>;
|
|
3147
3406
|
export type DevelopmentCandidate = z.infer<typeof developmentCandidateSchema>;
|
|
3148
3407
|
export type DevelopmentMode = z.infer<typeof developmentModeSchema>;
|
|
3149
3408
|
export type DevelopmentReaction = z.infer<typeof developmentReactionSchema>;
|
|
3409
|
+
export type ReleaseEvidence = z.infer<typeof releaseEvidenceSchema>;
|
|
@@ -140,6 +140,51 @@ const developmentCandidateSchema = z.object({
|
|
|
140
140
|
}).strict().superRefine((candidate, context) => {
|
|
141
141
|
if (candidate.source.some((source) => source.dirty) && candidate.promotable) context.addIssue({ code: z.ZodIssueCode.custom, path: ["promotable"], message: "Candidates containing dirty source cannot be promotable." });
|
|
142
142
|
if (candidate.verification.status !== "passed" && candidate.promotable) context.addIssue({ code: z.ZodIssueCode.custom, path: ["promotable"], message: "Only verified candidates can be promotable." });
|
|
143
|
+
if (candidate.promotable && candidate.source.some((source) => !Object.keys(candidate.dependencyGenerations).some((key) => key === source.projectId || key.startsWith(`${source.projectId}.`)))) {
|
|
144
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ["dependencyGenerations"], message: "Promotable candidates must bind a completed generation for every source project." });
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const releaseArtifactSchema = z.object({
|
|
148
|
+
id: identifier,
|
|
149
|
+
kind: z.enum(["npm-package", "oci-image", "archive", "executable", "sbom", "contract-bundle", "compatibility-attestation", "component-manifest", "compose", "provenance"]),
|
|
150
|
+
identity: z.string().min(1).max(2048),
|
|
151
|
+
digest,
|
|
152
|
+
mediaType: z.string().min(1).max(256),
|
|
153
|
+
size: z.number().int().nonnegative().optional()
|
|
154
|
+
}).strict();
|
|
155
|
+
const releaseEvidenceSchema = z.object({
|
|
156
|
+
schemaVersion: z.literal("treeseed.release-evidence/v1"),
|
|
157
|
+
candidate: z.object({
|
|
158
|
+
id: identifier,
|
|
159
|
+
receiptDigest: digest,
|
|
160
|
+
sourceCommit: gitCommit,
|
|
161
|
+
stagingRef: z.string().min(1).max(256),
|
|
162
|
+
workflowRunId: z.string().regex(/^[1-9][0-9]*$/u),
|
|
163
|
+
createdAt: z.string().datetime()
|
|
164
|
+
}).strict(),
|
|
165
|
+
packages: z.array(z.object({
|
|
166
|
+
projectId: identifier,
|
|
167
|
+
name: z.string().min(1).max(256),
|
|
168
|
+
version: z.string().min(1).max(128),
|
|
169
|
+
minimumBump: z.enum(["none", "patch", "minor", "major"])
|
|
170
|
+
}).strict()).min(1),
|
|
171
|
+
artifacts: z.array(releaseArtifactSchema).min(1),
|
|
172
|
+
contractBundles: z.array(z.object({ id: identifier, digest }).strict()).default([]),
|
|
173
|
+
compatibilityAttestations: z.array(z.object({ contractId: z.string().min(1), digest, compatible: z.literal(true), minimumBump: z.enum(["none", "patch", "minor", "major"]) }).strict()).default([]),
|
|
174
|
+
verification: z.object({
|
|
175
|
+
status: z.literal("passed"),
|
|
176
|
+
operations: z.array(z.string().min(1)).min(1),
|
|
177
|
+
completedAt: z.string().datetime()
|
|
178
|
+
}).strict()
|
|
179
|
+
}).strict().superRefine((evidence, context) => {
|
|
180
|
+
const identities = evidence.artifacts.map((artifact) => artifact.identity);
|
|
181
|
+
if (new Set(identities).size !== identities.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["artifacts"], message: "Release artifact identities must be unique." });
|
|
182
|
+
for (const bundle of evidence.contractBundles) {
|
|
183
|
+
if (!evidence.artifacts.some((artifact) => artifact.kind === "contract-bundle" && artifact.digest === bundle.digest)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["contractBundles"], message: `Contract bundle ${bundle.id} is not present in artifact custody.` });
|
|
184
|
+
}
|
|
185
|
+
for (const attestation of evidence.compatibilityAttestations) {
|
|
186
|
+
if (!evidence.artifacts.some((artifact) => artifact.kind === "compatibility-attestation" && artifact.digest === attestation.digest)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["compatibilityAttestations"], message: `Compatibility attestation ${attestation.contractId} is not present in artifact custody.` });
|
|
187
|
+
}
|
|
143
188
|
});
|
|
144
189
|
export {
|
|
145
190
|
developmentCandidateSchema,
|
|
@@ -149,5 +194,6 @@ export {
|
|
|
149
194
|
developmentSessionSchema,
|
|
150
195
|
developmentStatePolicySchema,
|
|
151
196
|
developmentTargetKindSchema,
|
|
152
|
-
developmentTargetSchema
|
|
197
|
+
developmentTargetSchema,
|
|
198
|
+
releaseEvidenceSchema
|
|
153
199
|
};
|
|
@@ -8,6 +8,7 @@ const local = (handlerId) => ({ kind: "local", handlerId });
|
|
|
8
8
|
const field = (target, name, source, sourceName = name, required = false, transform = "identity") => ({ target, field: name, source, name: sourceName, required, transform });
|
|
9
9
|
const operation = (operationId, input = []) => ({ kind: "operation", operationId, input });
|
|
10
10
|
const page = () => [field("query", "status", "option"), field("query", "limit", "option", "limit", false, "integer"), field("query", "cursor", "option")];
|
|
11
|
+
const aiNode = () => field("path", "nodeId", "context", "node", true);
|
|
11
12
|
const operationBindings = {
|
|
12
13
|
"auth login": protocol("protocol.oauth.device.login"),
|
|
13
14
|
"auth logout": protocol("protocol.oauth.revoke"),
|
|
@@ -110,6 +111,21 @@ const operationBindings = {
|
|
|
110
111
|
"projects treedx workspaces list": operation("treedx.workspaces.list", [field("path", "projectId", "argument", "project", true), ...page()]),
|
|
111
112
|
"projects treedx workspaces show": operation("treedx.workspaces.show", [field("path", "projectId", "context", "project", true), field("path", "workspaceId", "argument", "workspace", true)]),
|
|
112
113
|
"projects treedx workspaces abandon": operation("treedx.workspaces.abandon", [field("path", "projectId", "context", "project", true), field("path", "workspaceId", "argument", "workspace", true)]),
|
|
114
|
+
"ai status": operation("treeai.qualification.get.status", [aiNode()]),
|
|
115
|
+
"ai mode show": operation("treeai.qualification.get.mode", [aiNode()]),
|
|
116
|
+
"ai mode set": operation("treeai.qualification.post.mode", [aiNode(), field("body", "mode", "argument", "mode", true)]),
|
|
117
|
+
"ai inference models": operation("treeai.inference.get.models", [aiNode()]),
|
|
118
|
+
"ai inference jobs": operation("treeai.inference.get.jobs", [aiNode()]),
|
|
119
|
+
"ai inference rollback": operation("treeai.inference.post.deployments.rollback", [aiNode()]),
|
|
120
|
+
"ai training libraries": operation("treeai.training.get.libraries", [aiNode()]),
|
|
121
|
+
"ai training jobs": operation("treeai.training.get.jobs", [aiNode()]),
|
|
122
|
+
"ai training runs": operation("treeai.training.get.library.runs", [aiNode()]),
|
|
123
|
+
"ai lab status": operation("treeai.lab.get.status", [aiNode()]),
|
|
124
|
+
"ai lab agents": operation("treeai.lab.get.agents", [aiNode()]),
|
|
125
|
+
"ai lab libraries": operation("treeai.lab.get.libraries", [aiNode()]),
|
|
126
|
+
"ai qualify status": operation("treeai.qualification.get.qualification.profile", [aiNode()]),
|
|
127
|
+
"ai qualify run": operation("treeai.qualification.post.qualification.campaigns", [aiNode()]),
|
|
128
|
+
"ai qualify campaigns": operation("treeai.qualification.get.qualification.campaigns", [aiNode()]),
|
|
113
129
|
"library show": local("local.library.show"),
|
|
114
130
|
"library status": local("local.library.status"),
|
|
115
131
|
"library paths": local("local.library.paths"),
|
|
@@ -299,6 +315,14 @@ const commandTree = {
|
|
|
299
315
|
leaf("capabilities", "read", "project"),
|
|
300
316
|
branch("workspaces", [leaf("list", "read", "project"), leaf("show", "read", "workspace"), leaf("abandon", "mutation", "workspace", "destructive")])
|
|
301
317
|
])]),
|
|
318
|
+
branch("ai", [
|
|
319
|
+
leaf("status"),
|
|
320
|
+
branch("mode", [leaf("show"), leaf("set", "mutation", "mode", "authority")]),
|
|
321
|
+
branch("inference", [leaf("models"), leaf("jobs"), leaf("rollback", "mutation", void 0, "destructive")]),
|
|
322
|
+
branch("training", [leaf("libraries"), leaf("jobs"), leaf("runs")]),
|
|
323
|
+
branch("lab", [leaf("status"), leaf("agents"), leaf("libraries")]),
|
|
324
|
+
branch("qualify", [leaf("status"), leaf("run", "mutation", void 0, "authority"), leaf("campaigns")])
|
|
325
|
+
]),
|
|
302
326
|
branch("library", [
|
|
303
327
|
libraryRead("show"),
|
|
304
328
|
libraryRead("status"),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ControlPlaneOperationBinding } from '../control-plane-operation.js';
|
|
2
|
+
export declare const TREEAI_OPENAPI_DIGESTS: {
|
|
3
|
+
readonly inference: "sha256:3a00f1d91635d87d0aad2c6d329f495ff210f393bc9851570aa3e3ad1f5c1db4";
|
|
4
|
+
readonly training: "sha256:89dc70cecc85079853e4f177827d681e66f4b24b93ef17713051b99f07c2fe00";
|
|
5
|
+
readonly lab: "sha256:bccafa27b00a63b9fb22b132b850f9af6e77d44047dbc8966344088266d65898";
|
|
6
|
+
readonly qualification: "sha256:3f68b78845ec19c5de389663f1cb677ab4df0683ecd113c4f5780885a89370b7";
|
|
7
|
+
};
|
|
8
|
+
export declare const TREEAI_CONTROL_PLANE_OPERATION_LIST: readonly ControlPlaneOperationBinding<{
|
|
9
|
+
nodeId: string;
|
|
10
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>[];
|
|
11
|
+
export declare const TREEAI_CONTROL_PLANE_OPERATIONS: Readonly<Record<string, ControlPlaneOperationBinding<any, any, any, any>>>;
|
|
12
|
+
export declare function treeAiControlPlaneOperation(upstreamOperationId: string): ControlPlaneOperationBinding<{
|
|
13
|
+
nodeId: string;
|
|
14
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineOperation } from "../operation-builder.js";
|
|
3
|
+
import { TREEAI_UPSTREAM_OPERATIONS } from "../../treeai/generated/upstream.js";
|
|
4
|
+
const TREEAI_OPENAPI_DIGESTS = {
|
|
5
|
+
inference: "sha256:3a00f1d91635d87d0aad2c6d329f495ff210f393bc9851570aa3e3ad1f5c1db4",
|
|
6
|
+
training: "sha256:89dc70cecc85079853e4f177827d681e66f4b24b93ef17713051b99f07c2fe00",
|
|
7
|
+
lab: "sha256:bccafa27b00a63b9fb22b132b850f9af6e77d44047dbc8966344088266d65898",
|
|
8
|
+
qualification: "sha256:3f68b78845ec19c5de389663f1cb677ab4df0683ecd113c4f5780885a89370b7"
|
|
9
|
+
};
|
|
10
|
+
function treeSeedOperationId(operation) {
|
|
11
|
+
return `treeai.${operation.operationId.toLowerCase().replace(/[^a-z0-9]+/gu, ".").replace(/^\.|\.$/gu, "")}`;
|
|
12
|
+
}
|
|
13
|
+
function risk(operation) {
|
|
14
|
+
if (/rollback|cancel|disable/u.test(operation.operationId)) return "destructive";
|
|
15
|
+
if (operation.kind === "mutation" && (/promot|enable|activate|campaigns/u.test(operation.operationId) || /(?:^|\.)mode(?:\.|$)/u.test(operation.operationId))) return "authority";
|
|
16
|
+
return "ordinary";
|
|
17
|
+
}
|
|
18
|
+
function pathShape(path) {
|
|
19
|
+
return Object.fromEntries([...path.matchAll(/\{([^}]+)\}/gu)].map((match) => [match[1], z.string().min(1)]));
|
|
20
|
+
}
|
|
21
|
+
function binding(operation) {
|
|
22
|
+
const method = operation.method;
|
|
23
|
+
const kind = operation.kind;
|
|
24
|
+
const riskClass = risk(operation);
|
|
25
|
+
const path = `/v1/ai/nodes/{nodeId}/${operation.service}${operation.path}`;
|
|
26
|
+
return defineOperation({
|
|
27
|
+
operationId: treeSeedOperationId(operation),
|
|
28
|
+
description: `${operation.summary} through a node-scoped TreeAI proxy.`,
|
|
29
|
+
rest: { method, path },
|
|
30
|
+
parameters: `treeseed.${treeSeedOperationId(operation)}.parameters/v1`,
|
|
31
|
+
capability: `treeai.${operation.service}.${kind}`,
|
|
32
|
+
authentication: "oauth_or_provider",
|
|
33
|
+
oauthScopes: kind === "read" ? ["treeseed:read"] : ["treeseed:execution"],
|
|
34
|
+
kind,
|
|
35
|
+
riskClass,
|
|
36
|
+
confirmation: riskClass === "ordinary" ? "never" : "input_required",
|
|
37
|
+
idempotencyRequired: kind === "mutation",
|
|
38
|
+
surfaces: ["rest", "cli"],
|
|
39
|
+
cacheScope: kind === "read" ? "principal" : "none",
|
|
40
|
+
pagination: "none",
|
|
41
|
+
redactedPaths: ["headers.authorization"],
|
|
42
|
+
upstream: { service: "treeai", operationId: operation.operationId, contractVersion: "3.1.1", contractDigest: TREEAI_OPENAPI_DIGESTS[operation.service] }
|
|
43
|
+
}, {
|
|
44
|
+
path: z.object({ nodeId: z.string().min(1), ...pathShape(operation.path) }).strict(),
|
|
45
|
+
query: kind === "read" ? z.record(z.unknown()) : z.object({}).strict(),
|
|
46
|
+
body: kind === "read" ? z.undefined() : z.record(z.unknown()),
|
|
47
|
+
output: z.record(z.unknown())
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
const TREEAI_CONTROL_PLANE_OPERATION_LIST = Object.freeze(TREEAI_UPSTREAM_OPERATIONS.map(binding));
|
|
51
|
+
const TREEAI_CONTROL_PLANE_OPERATIONS = Object.freeze(Object.fromEntries(TREEAI_CONTROL_PLANE_OPERATION_LIST.map((item) => [item.descriptor.operationId, item])));
|
|
52
|
+
function treeAiControlPlaneOperation(upstreamOperationId) {
|
|
53
|
+
const operation = TREEAI_CONTROL_PLANE_OPERATION_LIST.find((item) => item.descriptor.upstream?.operationId === upstreamOperationId);
|
|
54
|
+
if (!operation) throw new Error(`Unknown TreeAI operation ${upstreamOperationId}.`);
|
|
55
|
+
return operation;
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
TREEAI_CONTROL_PLANE_OPERATIONS,
|
|
59
|
+
TREEAI_CONTROL_PLANE_OPERATION_LIST,
|
|
60
|
+
TREEAI_OPENAPI_DIGESTS,
|
|
61
|
+
treeAiControlPlaneOperation
|
|
62
|
+
};
|
|
@@ -28,7 +28,7 @@ export interface ControlPlaneConcurrencyContract {
|
|
|
28
28
|
writeHeader: 'If-Match';
|
|
29
29
|
}
|
|
30
30
|
export interface ControlPlaneUpstreamBinding {
|
|
31
|
-
service: 'treedx';
|
|
31
|
+
service: 'treedx' | 'treeai';
|
|
32
32
|
operationId: string;
|
|
33
33
|
contractVersion: string;
|
|
34
34
|
contractDigest: `sha256:${string}`;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ControlPlaneOperationBinding, type ControlPlaneOperationDescriptor } from './control-plane-operation.js';
|
|
2
2
|
export declare const CONTROL_PLANE_OPERATIONS: {
|
|
3
|
+
readonly treeai: Readonly<Record<string, ControlPlaneOperationBinding<any, any, any, any>>>;
|
|
3
4
|
readonly status: {
|
|
4
5
|
readonly show: ControlPlaneOperationBinding<{}, {}, undefined, Record<string, unknown>>;
|
|
5
6
|
};
|
|
@@ -999,8 +1000,8 @@ export declare const CONTROL_PLANE_OPERATIONS: {
|
|
|
999
1000
|
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
1000
1001
|
readonly node: ControlPlaneOperationBinding<{
|
|
1001
1002
|
projectId: string;
|
|
1002
|
-
repoId: string;
|
|
1003
1003
|
nodeId: string;
|
|
1004
|
+
repoId: string;
|
|
1004
1005
|
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
1005
1006
|
readonly related: ControlPlaneOperationBinding<{
|
|
1006
1007
|
projectId: string;
|
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { defineOperation as define, defineTreeDxProxyOperation as treedxProxy } from "./operation-builder.js";
|
|
3
3
|
import { communicationOperations, providerDiscussionResponseOperation } from "./catalog/communication-operations.js";
|
|
4
4
|
import { adminAccountOperations, adminTeamOperations } from "./catalog/admin-account-team-operations.js";
|
|
5
|
+
import { TREEAI_CONTROL_PLANE_OPERATIONS } from "./catalog/treeai-operations.js";
|
|
5
6
|
const empty = z.object({}).strict();
|
|
6
7
|
const none = z.undefined();
|
|
7
8
|
const record = z.record(z.unknown());
|
|
@@ -96,6 +97,7 @@ function resource(operationId, method, path, pathShape, options = { capability:
|
|
|
96
97
|
}, { path: z.object(pathShape).strict(), query: kind === "read" ? record : empty, body: kind === "read" ? none : record, output: payload });
|
|
97
98
|
}
|
|
98
99
|
const CONTROL_PLANE_OPERATIONS = {
|
|
100
|
+
treeai: TREEAI_CONTROL_PLANE_OPERATIONS,
|
|
99
101
|
status: {
|
|
100
102
|
show: read("status.show", "/v1/status", "status.read", ["rest", "cli", "mcp_tool", "mcp_resource"])
|
|
101
103
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../operator-contracts/catalog/treeai-operations.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../operator-contracts/catalog/treeai-operations.js";
|