@treeseed/sdk 0.13.0-rc.68 → 0.13.0-rc.70

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.
@@ -1 +1 @@
1
- {"completedAt":"2026-09-01T09:57:27.022Z"}
1
+ {"completedAt":"2026-09-01T21:09:39.160Z"}
@@ -0,0 +1,255 @@
1
+ import { z } from 'zod';
2
+ export declare const providerRegistrationCodeStatusSchema: z.ZodObject<{
3
+ schemaVersion: z.ZodLiteral<"treeseed.provider-registration-code-status/v1">;
4
+ teamId: z.ZodString;
5
+ generation: z.ZodNumber;
6
+ codePrefix: z.ZodString;
7
+ rotatedAt: z.ZodString;
8
+ }, "strict", z.ZodTypeAny, {
9
+ schemaVersion: "treeseed.provider-registration-code-status/v1";
10
+ teamId: string;
11
+ rotatedAt: string;
12
+ generation: number;
13
+ codePrefix: string;
14
+ }, {
15
+ schemaVersion: "treeseed.provider-registration-code-status/v1";
16
+ teamId: string;
17
+ rotatedAt: string;
18
+ generation: number;
19
+ codePrefix: string;
20
+ }>;
21
+ export declare const providerRegistrationCodeReceiptSchema: z.ZodObject<{
22
+ schemaVersion: z.ZodLiteral<"treeseed.provider-registration-code-receipt/v1">;
23
+ teamId: z.ZodString;
24
+ generation: z.ZodNumber;
25
+ codePrefix: z.ZodString;
26
+ registrationCode: z.ZodString;
27
+ rotatedAt: z.ZodString;
28
+ }, "strict", z.ZodTypeAny, {
29
+ schemaVersion: "treeseed.provider-registration-code-receipt/v1";
30
+ teamId: string;
31
+ rotatedAt: string;
32
+ generation: number;
33
+ codePrefix: string;
34
+ registrationCode: string;
35
+ }, {
36
+ schemaVersion: "treeseed.provider-registration-code-receipt/v1";
37
+ teamId: string;
38
+ rotatedAt: string;
39
+ generation: number;
40
+ codePrefix: string;
41
+ registrationCode: string;
42
+ }>;
43
+ export declare const providerEnvironmentVariableDescriptorSchema: z.ZodObject<{
44
+ name: z.ZodString;
45
+ available: z.ZodBoolean;
46
+ rotatedAt: z.ZodOptional<z.ZodString>;
47
+ }, "strict", z.ZodTypeAny, {
48
+ name: string;
49
+ available: boolean;
50
+ rotatedAt?: string | undefined;
51
+ }, {
52
+ name: string;
53
+ available: boolean;
54
+ rotatedAt?: string | undefined;
55
+ }>;
56
+ export declare const providerEnvironmentProfileDescriptorSchema: z.ZodEffects<z.ZodObject<{
57
+ schemaVersion: z.ZodLiteral<"treeseed.provider-environment-profile/v1">;
58
+ id: z.ZodString;
59
+ generation: z.ZodNumber;
60
+ variables: z.ZodArray<z.ZodObject<{
61
+ name: z.ZodString;
62
+ available: z.ZodBoolean;
63
+ rotatedAt: z.ZodOptional<z.ZodString>;
64
+ }, "strict", z.ZodTypeAny, {
65
+ name: string;
66
+ available: boolean;
67
+ rotatedAt?: string | undefined;
68
+ }, {
69
+ name: string;
70
+ available: boolean;
71
+ rotatedAt?: string | undefined;
72
+ }>, "many">;
73
+ updatedAt: z.ZodString;
74
+ }, "strict", z.ZodTypeAny, {
75
+ schemaVersion: "treeseed.provider-environment-profile/v1";
76
+ id: string;
77
+ variables: {
78
+ name: string;
79
+ available: boolean;
80
+ rotatedAt?: string | undefined;
81
+ }[];
82
+ generation: number;
83
+ updatedAt: string;
84
+ }, {
85
+ schemaVersion: "treeseed.provider-environment-profile/v1";
86
+ id: string;
87
+ variables: {
88
+ name: string;
89
+ available: boolean;
90
+ rotatedAt?: string | undefined;
91
+ }[];
92
+ generation: number;
93
+ updatedAt: string;
94
+ }>, {
95
+ schemaVersion: "treeseed.provider-environment-profile/v1";
96
+ id: string;
97
+ variables: {
98
+ name: string;
99
+ available: boolean;
100
+ rotatedAt?: string | undefined;
101
+ }[];
102
+ generation: number;
103
+ updatedAt: string;
104
+ }, {
105
+ schemaVersion: "treeseed.provider-environment-profile/v1";
106
+ id: string;
107
+ variables: {
108
+ name: string;
109
+ available: boolean;
110
+ rotatedAt?: string | undefined;
111
+ }[];
112
+ generation: number;
113
+ updatedAt: string;
114
+ }>;
115
+ export declare const assignmentEnvironmentGrantSchema: z.ZodEffects<z.ZodObject<{
116
+ schemaVersion: z.ZodLiteral<"treeseed.assignment-environment-grant/v1">;
117
+ grantId: z.ZodString;
118
+ assignmentId: z.ZodString;
119
+ providerId: z.ZodString;
120
+ teamId: z.ZodString;
121
+ projectId: z.ZodString;
122
+ profileId: z.ZodString;
123
+ variables: z.ZodArray<z.ZodString, "many">;
124
+ network: z.ZodObject<{
125
+ allowed: z.ZodBoolean;
126
+ destinations: z.ZodArray<z.ZodString, "many">;
127
+ }, "strict", z.ZodTypeAny, {
128
+ allowed: boolean;
129
+ destinations: string[];
130
+ }, {
131
+ allowed: boolean;
132
+ destinations: string[];
133
+ }>;
134
+ policy: z.ZodObject<{
135
+ handlerDeclarationDigest: z.ZodString;
136
+ providerOfferDigest: z.ZodString;
137
+ providerPermissionDigest: z.ZodString;
138
+ teamApprovalDigest: z.ZodString;
139
+ assignmentGrantDigest: z.ZodString;
140
+ sandboxPolicyDigest: z.ZodString;
141
+ }, "strict", z.ZodTypeAny, {
142
+ handlerDeclarationDigest: string;
143
+ providerOfferDigest: string;
144
+ providerPermissionDigest: string;
145
+ teamApprovalDigest: string;
146
+ assignmentGrantDigest: string;
147
+ sandboxPolicyDigest: string;
148
+ }, {
149
+ handlerDeclarationDigest: string;
150
+ providerOfferDigest: string;
151
+ providerPermissionDigest: string;
152
+ teamApprovalDigest: string;
153
+ assignmentGrantDigest: string;
154
+ sandboxPolicyDigest: string;
155
+ }>;
156
+ issuedAt: z.ZodString;
157
+ expiresAt: z.ZodString;
158
+ }, "strict", z.ZodTypeAny, {
159
+ schemaVersion: "treeseed.assignment-environment-grant/v1";
160
+ projectId: string;
161
+ teamId: string;
162
+ providerId: string;
163
+ issuedAt: string;
164
+ expiresAt: string;
165
+ variables: string[];
166
+ assignmentId: string;
167
+ profileId: string;
168
+ network: {
169
+ allowed: boolean;
170
+ destinations: string[];
171
+ };
172
+ policy: {
173
+ handlerDeclarationDigest: string;
174
+ providerOfferDigest: string;
175
+ providerPermissionDigest: string;
176
+ teamApprovalDigest: string;
177
+ assignmentGrantDigest: string;
178
+ sandboxPolicyDigest: string;
179
+ };
180
+ grantId: string;
181
+ }, {
182
+ schemaVersion: "treeseed.assignment-environment-grant/v1";
183
+ projectId: string;
184
+ teamId: string;
185
+ providerId: string;
186
+ issuedAt: string;
187
+ expiresAt: string;
188
+ variables: string[];
189
+ assignmentId: string;
190
+ profileId: string;
191
+ network: {
192
+ allowed: boolean;
193
+ destinations: string[];
194
+ };
195
+ policy: {
196
+ handlerDeclarationDigest: string;
197
+ providerOfferDigest: string;
198
+ providerPermissionDigest: string;
199
+ teamApprovalDigest: string;
200
+ assignmentGrantDigest: string;
201
+ sandboxPolicyDigest: string;
202
+ };
203
+ grantId: string;
204
+ }>, {
205
+ schemaVersion: "treeseed.assignment-environment-grant/v1";
206
+ projectId: string;
207
+ teamId: string;
208
+ providerId: string;
209
+ issuedAt: string;
210
+ expiresAt: string;
211
+ variables: string[];
212
+ assignmentId: string;
213
+ profileId: string;
214
+ network: {
215
+ allowed: boolean;
216
+ destinations: string[];
217
+ };
218
+ policy: {
219
+ handlerDeclarationDigest: string;
220
+ providerOfferDigest: string;
221
+ providerPermissionDigest: string;
222
+ teamApprovalDigest: string;
223
+ assignmentGrantDigest: string;
224
+ sandboxPolicyDigest: string;
225
+ };
226
+ grantId: string;
227
+ }, {
228
+ schemaVersion: "treeseed.assignment-environment-grant/v1";
229
+ projectId: string;
230
+ teamId: string;
231
+ providerId: string;
232
+ issuedAt: string;
233
+ expiresAt: string;
234
+ variables: string[];
235
+ assignmentId: string;
236
+ profileId: string;
237
+ network: {
238
+ allowed: boolean;
239
+ destinations: string[];
240
+ };
241
+ policy: {
242
+ handlerDeclarationDigest: string;
243
+ providerOfferDigest: string;
244
+ providerPermissionDigest: string;
245
+ teamApprovalDigest: string;
246
+ assignmentGrantDigest: string;
247
+ sandboxPolicyDigest: string;
248
+ };
249
+ grantId: string;
250
+ }>;
251
+ export type ProviderRegistrationCodeStatus = z.infer<typeof providerRegistrationCodeStatusSchema>;
252
+ export type ProviderRegistrationCodeReceipt = z.infer<typeof providerRegistrationCodeReceiptSchema>;
253
+ export type ProviderEnvironmentVariableDescriptor = z.infer<typeof providerEnvironmentVariableDescriptorSchema>;
254
+ export type ProviderEnvironmentProfileDescriptor = z.infer<typeof providerEnvironmentProfileDescriptorSchema>;
255
+ export type AssignmentEnvironmentGrant = z.infer<typeof assignmentEnvironmentGrantSchema>;
@@ -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 variableName = z.string().regex(/^[A-Z_][A-Z0-9_]*$/u);
5
+ const maximumGrantLifetimeMs = 24 * 60 * 60 * 1e3;
6
+ const providerRegistrationCodeStatusSchema = z.object({
7
+ schemaVersion: z.literal("treeseed.provider-registration-code-status/v1"),
8
+ teamId: z.string().min(1),
9
+ generation: z.number().int().positive(),
10
+ codePrefix: z.string().min(1),
11
+ rotatedAt: z.string().datetime()
12
+ }).strict();
13
+ const providerRegistrationCodeReceiptSchema = z.object({
14
+ schemaVersion: z.literal("treeseed.provider-registration-code-receipt/v1"),
15
+ teamId: z.string().min(1),
16
+ generation: z.number().int().positive(),
17
+ codePrefix: z.string().min(1),
18
+ registrationCode: z.string().min(16),
19
+ rotatedAt: z.string().datetime()
20
+ }).strict();
21
+ const providerEnvironmentVariableDescriptorSchema = z.object({
22
+ name: variableName,
23
+ available: z.boolean(),
24
+ rotatedAt: z.string().datetime().optional()
25
+ }).strict();
26
+ const providerEnvironmentProfileDescriptorSchema = z.object({
27
+ schemaVersion: z.literal("treeseed.provider-environment-profile/v1"),
28
+ id: identifier,
29
+ generation: z.number().int().positive(),
30
+ variables: z.array(providerEnvironmentVariableDescriptorSchema),
31
+ updatedAt: z.string().datetime()
32
+ }).strict().superRefine((profile, context) => {
33
+ const names = /* @__PURE__ */ new Set();
34
+ for (const [index, variable] of profile.variables.entries()) {
35
+ if (names.has(variable.name)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["variables", index, "name"], message: "Environment variable names must be unique within a profile." });
36
+ names.add(variable.name);
37
+ }
38
+ });
39
+ const assignmentEnvironmentGrantSchema = z.object({
40
+ schemaVersion: z.literal("treeseed.assignment-environment-grant/v1"),
41
+ grantId: identifier,
42
+ assignmentId: z.string().min(1),
43
+ providerId: z.string().min(1),
44
+ teamId: z.string().min(1),
45
+ projectId: z.string().min(1),
46
+ profileId: identifier,
47
+ variables: z.array(variableName).min(1),
48
+ network: z.object({ allowed: z.boolean(), destinations: z.array(z.string().min(1)) }).strict(),
49
+ policy: z.object({
50
+ handlerDeclarationDigest: digest,
51
+ providerOfferDigest: digest,
52
+ providerPermissionDigest: digest,
53
+ teamApprovalDigest: digest,
54
+ assignmentGrantDigest: digest,
55
+ sandboxPolicyDigest: digest
56
+ }).strict(),
57
+ issuedAt: z.string().datetime(),
58
+ expiresAt: z.string().datetime()
59
+ }).strict().superRefine((grant, context) => {
60
+ if (new Set(grant.variables).size !== grant.variables.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["variables"], message: "Granted environment variables must be unique." });
61
+ if (Date.parse(grant.expiresAt) <= Date.parse(grant.issuedAt)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["expiresAt"], message: "Environment grants must expire after issuance." });
62
+ if (Date.parse(grant.expiresAt) - Date.parse(grant.issuedAt) > maximumGrantLifetimeMs) context.addIssue({ code: z.ZodIssueCode.custom, path: ["expiresAt"], message: "Environment grants cannot exceed 24 hours." });
63
+ if (!grant.network.allowed && grant.network.destinations.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["network", "destinations"], message: "Denied network authority cannot declare destinations." });
64
+ });
65
+ export {
66
+ assignmentEnvironmentGrantSchema,
67
+ providerEnvironmentProfileDescriptorSchema,
68
+ providerEnvironmentVariableDescriptorSchema,
69
+ providerRegistrationCodeReceiptSchema,
70
+ providerRegistrationCodeStatusSchema
71
+ };
@@ -1,2 +1,3 @@
1
1
  export * from './capacity-facts.js';
2
+ export * from './environment-profiles.js';
2
3
  export * from './governance.js';
@@ -1,2 +1,3 @@
1
1
  export * from "./capacity-facts.js";
2
+ export * from "./environment-profiles.js";
2
3
  export * from "./governance.js";
@@ -173,7 +173,11 @@ class ControlPlaneClient {
173
173
  code: "control_plane_response_invalid"
174
174
  }, response.headers);
175
175
  }
176
- return payload;
176
+ const envelope = payload;
177
+ const etag = response.headers.get("etag");
178
+ const contractDigest = response.headers.get("x-treeseed-contract-digest");
179
+ if (!etag && !contractDigest) return envelope;
180
+ return { ...envelope, meta: { ...envelope.meta ?? {}, ...etag ? { etag } : {}, ...contractDigest ? { contractDigest } : {} } };
177
181
  }
178
182
  }
179
183
  export {
@@ -1,3 +1,4 @@
1
+ import { hostProviderEnvironmentBranch, PROVIDER_ENVIRONMENT_COMMAND_BINDINGS, providerEnvironmentBranches } from "./catalog/provider-environment-commands.js";
1
2
  const unavailable = (reason = "This capability is not enabled until its control-plane operation is accepted.") => ({
2
3
  kind: "unavailable",
3
4
  code: "standards_migration_not_enabled",
@@ -10,6 +11,7 @@ const operation = (operationId, input = []) => ({ kind: "operation", operationId
10
11
  const page = () => [field("query", "status", "option"), field("query", "limit", "option", "limit", false, "integer"), field("query", "cursor", "option")];
11
12
  const aiNode = () => field("path", "nodeId", "context", "node", true);
12
13
  const operationBindings = {
14
+ ...PROVIDER_ENVIRONMENT_COMMAND_BINDINGS,
13
15
  "auth login": protocol("protocol.oauth.device.login"),
14
16
  "auth logout": protocol("protocol.oauth.revoke"),
15
17
  "auth status": operation("accounts.current.show"),
@@ -393,7 +395,7 @@ const commandTree = {
393
395
  branch("config", [leaf("show"), leaf("plan", "read", "file"), leaf("apply", "mutation", "file", "authority"), configurationAdopt()]),
394
396
  leaf("topology"),
395
397
  leaf("connections"),
396
- branch("provider", [leaf("status"), branch("credentials", [leaf("list"), leaf("status"), hostProviderCredentialInitialize()])]),
398
+ branch("provider", [leaf("status"), branch("credentials", [leaf("list"), leaf("status"), hostProviderCredentialInitialize()]), hostProviderEnvironmentBranch()]),
397
399
  branch("storage", [
398
400
  leaf("status"),
399
401
  addOptions(leaf("connect", "mutation", "backend", "credential"), [{ name: "--account-id", description: "Optional Cloudflare account ID when the bootstrap authority reaches multiple accounts.", type: "string" }]),
@@ -428,6 +430,7 @@ const commandTree = {
428
430
  leaf("diagnose", "read", "provider"),
429
431
  leaf("connect", "mutation", void 0, "credential"),
430
432
  leaf("disconnect", "mutation", "connection", "destructive"),
433
+ ...providerEnvironmentBranches(),
431
434
  branch("requests", [leaf("list"), leaf("show", "read", "request"), leaf("approve", "mutation", "request", "authority"), leaf("reject", "mutation", "request", "authority")]),
432
435
  branch("credentials", [leaf("status", "read", "connection"), leaf("rotate", "mutation", "connection", "credential"), leaf("revoke", "mutation", "connection", "irreversible")]),
433
436
  branch("offers", [leaf("show", "read", "connection"), leaf("validate", "read", "file"), leaf("plan", "read", "file"), leaf("apply", "mutation", "file", "authority")])
@@ -0,0 +1,4 @@
1
+ import type { CommandExecutionBinding, CommandNodeDescriptor } from '../command-tree.js';
2
+ export declare const PROVIDER_ENVIRONMENT_COMMAND_BINDINGS: Record<string, CommandExecutionBinding>;
3
+ export declare function hostProviderEnvironmentBranch(): CommandNodeDescriptor;
4
+ export declare function providerEnvironmentBranches(): CommandNodeDescriptor[];
@@ -0,0 +1,69 @@
1
+ const plan = { name: "--plan", description: "Return the exact proposed outcome without mutation.", type: "boolean" };
2
+ const local = (handlerId) => ({ kind: "local", handlerId });
3
+ const operation = (operationId, input) => ({ kind: "operation", operationId, input });
4
+ const path = (field, source, name, required = true) => ({ target: "path", field, source, name, required, transform: "identity" });
5
+ const PROVIDER_ENVIRONMENT_COMMAND_BINDINGS = {
6
+ "host provider environment list": local("local.host.provider.environment.list"),
7
+ "host provider environment show": local("local.host.provider.environment.show"),
8
+ "host provider environment status": local("local.host.provider.environment.status"),
9
+ "host provider environment set": local("local.host.provider.environment.set"),
10
+ "host provider environment import": local("local.host.provider.environment.import"),
11
+ "host provider environment unset": local("local.host.provider.environment.unset"),
12
+ "host provider environment rotate": local("local.host.provider.environment.rotate"),
13
+ "host provider environment verify": local("local.host.provider.environment.verify"),
14
+ "providers registration code status": operation("providers.registration.code.status", [path("teamId", "context", "team")]),
15
+ "providers registration code reveal": operation("providers.registration.code.reveal", [path("teamId", "context", "team")]),
16
+ "providers registration code rotate": operation("providers.registration.code.rotate", [path("teamId", "context", "team")]),
17
+ "providers environments list": operation("providers.environment.profiles.list", [path("teamId", "context", "team"), path("providerId", "argument", "provider"), { target: "query", field: "status", source: "option", name: "status", transform: "identity" }, { target: "query", field: "limit", source: "option", name: "limit", transform: "integer" }, { target: "query", field: "cursor", source: "option", name: "cursor", transform: "identity" }]),
18
+ "providers environments show": operation("providers.environment.profiles.show", [path("teamId", "context", "team"), path("providerId", "argument", "provider"), path("profileId", "argument", "profile")]),
19
+ "providers environments grant": operation("providers.environment.grants.put", [path("teamId", "context", "team"), path("assignmentId", "argument", "assignment"), { target: "body", field: "file", source: "option", name: "input", required: true, transform: "identity" }]),
20
+ "providers environments revoke": operation("providers.environment.grants.revoke", [path("teamId", "context", "team"), path("assignmentId", "argument", "assignment")])
21
+ };
22
+ const profileArguments = [{ name: "profile", description: "Provider-local environment profile.", required: true }];
23
+ const valueArguments = [...profileArguments, { name: "name", description: "Environment variable name.", required: true }];
24
+ const localMutation = (segment, confirmation, description) => ({
25
+ segment,
26
+ description,
27
+ kind: "mutation",
28
+ arguments: valueArguments,
29
+ options: [plan, ...segment === "unset" ? [] : [{ name: "--stdin", description: "Read the replacement value from standard input instead of the hidden prompt.", type: "boolean" }]],
30
+ authorization: { capability: "host.provider.environment.write", confirmation },
31
+ resultSchemaId: "treeseed.provider-environment-profile/v1",
32
+ execution: local(`local.host.provider.environment.${segment}`)
33
+ });
34
+ function hostProviderEnvironmentBranch() {
35
+ const read = (segment) => ({ segment, description: `${segment} a provider-local environment profile.`, kind: "read", arguments: profileArguments, resultSchemaId: "treeseed.provider-environment-profile/v1", execution: local(`local.host.provider.environment.${segment}`) });
36
+ return { nodeType: "branch", segment: "environment", description: "Provider-local environment profile operations.", children: [
37
+ { nodeType: "leaf", segment: "list", description: "List provider-local environment profiles without values.", kind: "read", resultSchemaId: "treeseed.provider-environment-profile-page/v1", execution: local("local.host.provider.environment.list") },
38
+ { nodeType: "leaf", ...read("show") },
39
+ { nodeType: "leaf", ...read("status") },
40
+ { nodeType: "leaf", ...localMutation("set", "credential", "Set one provider-local environment value through a hidden prompt or standard input.") },
41
+ {
42
+ nodeType: "leaf",
43
+ segment: "import",
44
+ description: "Import provider-local environment values from an env file.",
45
+ kind: "mutation",
46
+ arguments: profileArguments,
47
+ options: [plan, { name: "--env-file", description: "Local env file whose values remain under provider custody.", type: "string", required: true }],
48
+ authorization: { capability: "host.provider.environment.write", confirmation: "credential" },
49
+ resultSchemaId: "treeseed.provider-environment-profile/v1",
50
+ execution: local("local.host.provider.environment.import")
51
+ },
52
+ { nodeType: "leaf", ...localMutation("unset", "destructive", "Remove one provider-local environment value.") },
53
+ { nodeType: "leaf", ...localMutation("rotate", "credential", "Replace one provider-local environment value and advance its generation.") },
54
+ { nodeType: "leaf", ...read("verify") }
55
+ ] };
56
+ }
57
+ function providerEnvironmentBranches() {
58
+ const remote = { kind: "unavailable", code: "standards_migration_not_enabled", reason: "Execution binding is attached from the canonical operation map." };
59
+ const leaf = (segment, kind, arguments_, confirmation = "never", options = kind === "mutation" ? [plan] : void 0) => ({ nodeType: "leaf", segment, description: `${segment} provider environment authority.`, kind, arguments: arguments_, options, authorization: kind === "mutation" ? { capability: `command.${segment}`, confirmation } : void 0, resultSchemaId: `treeseed.command.${segment}/v1`, execution: remote });
60
+ return [
61
+ { nodeType: "branch", segment: "registration", description: "Team provider registration operations.", children: [{ nodeType: "branch", segment: "code", description: "Team provider registration-code operations.", children: [leaf("status", "read", void 0), leaf("reveal", "mutation", void 0, "credential"), leaf("rotate", "mutation", void 0, "credential")] }] },
62
+ { nodeType: "branch", segment: "environments", description: "Provider environment descriptor and grant operations.", children: [leaf("list", "read", [{ name: "provider", description: "Provider identity.", required: true }]), leaf("show", "read", [{ name: "provider", description: "Provider identity.", required: true }, { name: "profile", description: "Profile identity.", required: true }]), leaf("grant", "mutation", [{ name: "assignment", description: "Assignment identity.", required: true }], "authority", [plan, { name: "--input", description: "Digest-bound environment grant document.", type: "string", required: true }]), leaf("revoke", "mutation", [{ name: "assignment", description: "Assignment identity.", required: true }], "destructive")] }
63
+ ];
64
+ }
65
+ export {
66
+ PROVIDER_ENVIRONMENT_COMMAND_BINDINGS,
67
+ hostProviderEnvironmentBranch,
68
+ providerEnvironmentBranches
69
+ };
@@ -0,0 +1,41 @@
1
+ export declare const PROVIDER_ENVIRONMENT_OPERATIONS: {
2
+ readonly registrationCode: {
3
+ readonly status: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
4
+ teamId: string;
5
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
6
+ readonly reveal: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
7
+ teamId: string;
8
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
9
+ readonly rotate: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
10
+ teamId: string;
11
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
12
+ };
13
+ readonly environmentProfiles: {
14
+ readonly list: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
15
+ teamId: string;
16
+ providerId: string;
17
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
18
+ readonly show: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
19
+ teamId: string;
20
+ providerId: string;
21
+ profileId: string;
22
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
23
+ readonly publish: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
24
+ profileId: string;
25
+ }, {}, Record<string, unknown>, Record<string, unknown>>;
26
+ };
27
+ readonly environmentGrants: {
28
+ readonly show: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
29
+ teamId: string;
30
+ assignmentId: string;
31
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
32
+ readonly put: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
33
+ teamId: string;
34
+ assignmentId: string;
35
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
36
+ readonly revoke: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
37
+ teamId: string;
38
+ assignmentId: string;
39
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
40
+ };
41
+ };
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ import { defineOperation } from "../operation-builder.js";
3
+ const empty = z.object({}).strict();
4
+ const none = z.undefined();
5
+ const record = z.record(z.unknown());
6
+ function teamOperation(operationId, method, path, pathShape, options = {}) {
7
+ const kind = method === "GET" ? "read" : "mutation";
8
+ const riskClass = options.risk ?? "ordinary";
9
+ return defineOperation({
10
+ operationId,
11
+ description: `${kind === "read" ? "Read" : "Apply"} ${operationId}.`,
12
+ rest: { method, path },
13
+ parameters: `treeseed.${operationId}.parameters/v1`,
14
+ capability: options.capability ?? (kind === "read" ? "providers.read" : "providers.write"),
15
+ authentication: "oauth",
16
+ oauthScopes: kind === "read" ? ["treeseed:read"] : ["treeseed:admin"],
17
+ kind,
18
+ riskClass,
19
+ confirmation: riskClass === "ordinary" ? "never" : "input_required",
20
+ surfaces: ["rest", "cli"],
21
+ cacheScope: kind === "read" ? "principal" : "none",
22
+ pagination: options.pagination ?? "none",
23
+ concurrencyRequired: options.concurrency ?? ["DELETE", "PUT"].includes(method),
24
+ redactedPaths: options.redactedPaths
25
+ }, { path: z.object(pathShape).strict(), query: kind === "read" ? record : empty, body: kind === "read" ? none : record, output: record });
26
+ }
27
+ const providerPublish = defineOperation({
28
+ operationId: "providers.environment.profiles.publish",
29
+ description: "Publish a value-free provider environment profile descriptor.",
30
+ rest: { method: "PUT", path: "/v1/provider/environment-profiles/{profileId}" },
31
+ parameters: "treeseed.providers.environment.profiles.publish.parameters/v1",
32
+ capability: "providers.execute",
33
+ authentication: "provider",
34
+ oauthScopes: [],
35
+ kind: "mutation",
36
+ riskClass: "ordinary",
37
+ confirmation: "never",
38
+ surfaces: ["rest"],
39
+ cacheScope: "none",
40
+ pagination: "none"
41
+ }, { path: z.object({ profileId: z.string().min(1) }).strict(), query: empty, body: record, output: record });
42
+ const PROVIDER_ENVIRONMENT_OPERATIONS = {
43
+ registrationCode: {
44
+ status: teamOperation("providers.registration.code.status", "GET", "/v1/teams/{teamId}/capacity-provider-registration-code", { teamId: z.string().min(1) }),
45
+ reveal: teamOperation("providers.registration.code.reveal", "POST", "/v1/teams/{teamId}/capacity-provider-registration-code/reveal", { teamId: z.string().min(1) }, { risk: "credential", redactedPaths: ["output.registrationCode"] }),
46
+ rotate: teamOperation("providers.registration.code.rotate", "POST", "/v1/teams/{teamId}/capacity-provider-registration-code/rotate", { teamId: z.string().min(1) }, { risk: "credential", redactedPaths: ["output.registrationCode"], concurrency: true })
47
+ },
48
+ environmentProfiles: {
49
+ list: teamOperation("providers.environment.profiles.list", "GET", "/v1/teams/{teamId}/capacity-providers/{providerId}/environment-profiles", { teamId: z.string().min(1), providerId: z.string().min(1) }, { pagination: "cursor" }),
50
+ show: teamOperation("providers.environment.profiles.show", "GET", "/v1/teams/{teamId}/capacity-providers/{providerId}/environment-profiles/{profileId}", { teamId: z.string().min(1), providerId: z.string().min(1), profileId: z.string().min(1) }),
51
+ publish: providerPublish
52
+ },
53
+ environmentGrants: {
54
+ show: teamOperation("providers.environment.grants.show", "GET", "/v1/teams/{teamId}/assignments/{assignmentId}/environment-grant", { teamId: z.string().min(1), assignmentId: z.string().min(1) }),
55
+ put: teamOperation("providers.environment.grants.put", "PUT", "/v1/teams/{teamId}/assignments/{assignmentId}/environment-grant", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { risk: "authority" }),
56
+ revoke: teamOperation("providers.environment.grants.revoke", "DELETE", "/v1/teams/{teamId}/assignments/{assignmentId}/environment-grant", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { risk: "destructive" })
57
+ }
58
+ };
59
+ export {
60
+ PROVIDER_ENVIRONMENT_OPERATIONS
61
+ };
@@ -1955,6 +1955,17 @@ export declare const CONTROL_PLANE_OPERATIONS: {
1955
1955
  readonly connect: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
1956
1956
  teamId: string;
1957
1957
  }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
1958
+ readonly registrationCode: {
1959
+ readonly status: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
1960
+ teamId: string;
1961
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
1962
+ readonly reveal: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
1963
+ teamId: string;
1964
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
1965
+ readonly rotate: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
1966
+ teamId: string;
1967
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
1968
+ };
1958
1969
  readonly disconnect: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
1959
1970
  teamId: string;
1960
1971
  connectionId: string;
@@ -1990,6 +2001,34 @@ export declare const CONTROL_PLANE_OPERATIONS: {
1990
2001
  connectionId: string;
1991
2002
  }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
1992
2003
  };
2004
+ readonly environmentProfiles: {
2005
+ readonly list: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2006
+ teamId: string;
2007
+ providerId: string;
2008
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
2009
+ readonly show: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2010
+ teamId: string;
2011
+ providerId: string;
2012
+ profileId: string;
2013
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
2014
+ readonly publish: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2015
+ profileId: string;
2016
+ }, {}, Record<string, unknown>, Record<string, unknown>>;
2017
+ };
2018
+ readonly environmentGrants: {
2019
+ readonly show: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2020
+ teamId: string;
2021
+ assignmentId: string;
2022
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
2023
+ readonly put: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2024
+ teamId: string;
2025
+ assignmentId: string;
2026
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
2027
+ readonly revoke: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2028
+ teamId: string;
2029
+ assignmentId: string;
2030
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
2031
+ };
1993
2032
  readonly register: import("./control-plane-operation.js").ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
1994
2033
  readonly registration: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
1995
2034
  requestId: string;
@@ -6,6 +6,7 @@ import { adminAccountOperations, adminTeamOperations } from "./catalog/admin-acc
6
6
  import { TREEAI_CONTROL_PLANE_OPERATIONS } from "./catalog/treeai-operations.js";
7
7
  import { capabilityOntologyOperations } from "./catalog/capability-ontology-operations.js";
8
8
  import { knowledgeShareOperations } from "./catalog/knowledge-share-operations.js";
9
+ import { PROVIDER_ENVIRONMENT_OPERATIONS } from "./catalog/provider-environment-operations.js";
9
10
  import { buildControlPlaneCatalog, flattenControlPlaneOperations } from "./catalog/control-plane-catalog.js";
10
11
  const empty = z.object({}).strict();
11
12
  const none = z.undefined();
@@ -465,6 +466,7 @@ const CONTROL_PLANE_OPERATIONS = {
465
466
  status: resource("providers.status", "GET", "/v1/teams/{teamId}/capacity-providers/{providerId}/status", { teamId: z.string().min(1), providerId: z.string().min(1) }, { capability: "providers.read", surfaces: ["rest", "cli", "mcp_tool"] }),
466
467
  diagnose: resource("providers.diagnose", "GET", "/v1/teams/{teamId}/capacity-providers/{providerId}/diagnosis", { teamId: z.string().min(1), providerId: z.string().min(1) }, { capability: "providers.read", surfaces: ["rest", "cli", "mcp_tool"] }),
467
468
  connect: resource("providers.connect", "POST", "/v1/teams/{teamId}/capacity-provider-connections", { teamId: z.string().min(1) }, { capability: "providers.write", scopes: ["treeseed:admin"], surfaces: ["rest", "cli"], risk: "credential", redactedPaths: ["body.enrollmentToken"] }),
469
+ registrationCode: PROVIDER_ENVIRONMENT_OPERATIONS.registrationCode,
468
470
  disconnect: resource("providers.disconnect", "POST", "/v1/teams/{teamId}/capacity-provider-connections/{connectionId}/disconnect", { teamId: z.string().min(1), connectionId: z.string().min(1) }, { capability: "providers.write", scopes: ["treeseed:admin"], surfaces: ["rest", "cli"], risk: "destructive" }),
469
471
  requests: {
470
472
  list: resource("providers.requests.list", "GET", "/v1/teams/{teamId}/capacity-provider-requests", { teamId: z.string().min(1) }, { capability: "providers.read", surfaces: ["rest", "cli"], pagination: "cursor" }),
@@ -477,6 +479,8 @@ const CONTROL_PLANE_OPERATIONS = {
477
479
  rotate: resource("providers.credentials.rotate", "POST", "/v1/teams/{teamId}/capacity-provider-connections/{connectionId}/credentials/rotate", { teamId: z.string().min(1), connectionId: z.string().min(1) }, { capability: "providers.write", scopes: ["treeseed:admin"], surfaces: ["rest", "cli"], risk: "credential" }),
478
480
  revoke: resource("providers.credentials.revoke", "POST", "/v1/teams/{teamId}/capacity-provider-connections/{connectionId}/credentials/revoke", { teamId: z.string().min(1), connectionId: z.string().min(1) }, { capability: "providers.write", scopes: ["treeseed:admin"], surfaces: ["rest", "cli"], risk: "irreversible" })
479
481
  },
482
+ environmentProfiles: PROVIDER_ENVIRONMENT_OPERATIONS.environmentProfiles,
483
+ environmentGrants: PROVIDER_ENVIRONMENT_OPERATIONS.environmentGrants,
480
484
  register: noPathProvider("providers.register", "POST", "/v1/provider-registrations", { authentication: "signed_request", redactedPaths: ["body.registrationKey"] }),
481
485
  registration: providerPath("providers.registration.show", "GET", "/v1/provider-registrations/{requestId}", { requestId: z.string().min(1) }, { authentication: "signed_request", read: true }),
482
486
  exchangeCredential: providerPath("providers.registration.credential", "POST", "/v1/provider-registrations/{requestId}/credential", { requestId: z.string().min(1) }, { authentication: "signed_request", redactedPaths: ["body.proof"] }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.13.0-rc.68",
3
+ "version": "0.13.0-rc.70",
4
4
  "description": "Portable TreeSeed contracts, standards, and typed remote control-plane clients.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {