@treeseed/sdk 0.13.0-rc.11 → 0.13.0-rc.13
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.
|
@@ -7,6 +7,7 @@ export type ControlPlaneConfirmationPolicy = 'never' | 'input_required';
|
|
|
7
7
|
export type ControlPlaneOperationSurface = 'rest' | 'cli' | 'mcp_tool' | 'mcp_resource' | 'internal';
|
|
8
8
|
export type ControlPlaneCacheScope = 'none' | 'principal' | 'team' | 'project' | 'public';
|
|
9
9
|
export type ControlPlanePaginationKind = 'none' | 'cursor';
|
|
10
|
+
export type ControlPlaneAuthenticationKind = 'anonymous' | 'oauth' | 'provider' | 'signed_request';
|
|
10
11
|
export interface ControlPlaneRestBinding {
|
|
11
12
|
method: ControlPlaneHttpMethod;
|
|
12
13
|
path: `/v1/${string}`;
|
|
@@ -33,6 +34,7 @@ export interface ControlPlaneOperationDescriptor {
|
|
|
33
34
|
rest?: ControlPlaneRestBinding;
|
|
34
35
|
schemas: ControlPlaneSchemaBinding;
|
|
35
36
|
capability: string;
|
|
37
|
+
authentication: ControlPlaneAuthenticationKind;
|
|
36
38
|
oauthScopes: OAuthScope[];
|
|
37
39
|
kind: ControlPlaneOperationKind;
|
|
38
40
|
riskClass: ControlPlaneRiskClass;
|
|
@@ -44,6 +44,15 @@ function validateControlPlaneCatalog(catalog) {
|
|
|
44
44
|
for (const scope of operation.oauthScopes) {
|
|
45
45
|
if (!TREESEED_OAUTH_SCOPES.includes(scope)) diagnostics.push({ code: "oauth_scope_invalid", path: `${path}.oauthScopes`, message: `Unknown OAuth scope ${scope}.` });
|
|
46
46
|
}
|
|
47
|
+
if (operation.authentication === "oauth" && operation.oauthScopes.length === 0) {
|
|
48
|
+
diagnostics.push({ code: "oauth_scope_required", path: `${path}.oauthScopes`, message: "OAuth-authenticated operations require at least one OAuth scope." });
|
|
49
|
+
}
|
|
50
|
+
if (operation.authentication !== "oauth" && operation.oauthScopes.length > 0) {
|
|
51
|
+
diagnostics.push({ code: "oauth_scope_forbidden", path: `${path}.oauthScopes`, message: "Only OAuth-authenticated operations may declare OAuth scopes." });
|
|
52
|
+
}
|
|
53
|
+
if (operation.authentication === "provider" && operation.capability !== "providers.execute") {
|
|
54
|
+
diagnostics.push({ code: "provider_auth_capability_invalid", path: `${path}.capability`, message: "Provider-authenticated operations require providers.execute." });
|
|
55
|
+
}
|
|
47
56
|
for (const duplicate of duplicates(operation.surfaces)) diagnostics.push({ code: "surface_duplicate", path: `${path}.surfaces`, message: `Duplicate operation surface ${duplicate}.` });
|
|
48
57
|
for (const duplicate of duplicates(operation.oauthScopes)) diagnostics.push({ code: "oauth_scope_duplicate", path: `${path}.oauthScopes`, message: `Duplicate OAuth scope ${duplicate}.` });
|
|
49
58
|
const elevatedRisk = operation.riskClass !== "ordinary";
|
|
@@ -314,6 +314,36 @@ export declare const CONTROL_PLANE_OPERATIONS: {
|
|
|
314
314
|
projectId: string;
|
|
315
315
|
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
316
316
|
};
|
|
317
|
+
readonly services: {
|
|
318
|
+
readonly providers: ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
319
|
+
readonly connections: ControlPlaneOperationBinding<{
|
|
320
|
+
teamId: string;
|
|
321
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
322
|
+
readonly connection: ControlPlaneOperationBinding<{
|
|
323
|
+
teamId: string;
|
|
324
|
+
connectionId: string;
|
|
325
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
326
|
+
readonly createConnection: ControlPlaneOperationBinding<{
|
|
327
|
+
teamId: string;
|
|
328
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
329
|
+
readonly updateConnection: ControlPlaneOperationBinding<{
|
|
330
|
+
teamId: string;
|
|
331
|
+
connectionId: string;
|
|
332
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
333
|
+
readonly disconnect: ControlPlaneOperationBinding<{
|
|
334
|
+
teamId: string;
|
|
335
|
+
connectionId: string;
|
|
336
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
337
|
+
readonly authorities: ControlPlaneOperationBinding<{
|
|
338
|
+
teamId: string;
|
|
339
|
+
connectionId: string;
|
|
340
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
341
|
+
readonly putAuthority: ControlPlaneOperationBinding<{
|
|
342
|
+
teamId: string;
|
|
343
|
+
profileId: string;
|
|
344
|
+
connectionId: string;
|
|
345
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
346
|
+
};
|
|
317
347
|
readonly agents: {
|
|
318
348
|
readonly list: ControlPlaneOperationBinding<{
|
|
319
349
|
projectId: string;
|
|
@@ -12,6 +12,7 @@ function define(definition, schema) {
|
|
|
12
12
|
return {
|
|
13
13
|
descriptor: {
|
|
14
14
|
...descriptor,
|
|
15
|
+
authentication: definition.authentication ?? (definition.oauthScopes.length ? "oauth" : "anonymous"),
|
|
15
16
|
schemaVersion: CONTROL_PLANE_OPERATION_SCHEMA_VERSION,
|
|
16
17
|
schemas: {
|
|
17
18
|
input: `treeseed.${definition.operationId}.input/v1`,
|
|
@@ -34,6 +35,7 @@ function read(operationId, path, capability, surfaces = ["rest"]) {
|
|
|
34
35
|
description: `Read ${operationId}.`,
|
|
35
36
|
rest: { method: "GET", path },
|
|
36
37
|
capability,
|
|
38
|
+
authentication: "oauth",
|
|
37
39
|
oauthScopes: ["treeseed:read"],
|
|
38
40
|
kind: "read",
|
|
39
41
|
riskClass: "ordinary",
|
|
@@ -51,7 +53,8 @@ function providerPath(operationId, method, path, pathShape, options = {}) {
|
|
|
51
53
|
rest: { method, path },
|
|
52
54
|
parameters: `treeseed.${operationId}.parameters/v1`,
|
|
53
55
|
capability: "providers.execute",
|
|
54
|
-
|
|
56
|
+
authentication: "provider",
|
|
57
|
+
oauthScopes: [],
|
|
55
58
|
kind,
|
|
56
59
|
riskClass: "ordinary",
|
|
57
60
|
confirmation: "never",
|
|
@@ -66,7 +69,8 @@ const noPathProvider = (operationId, method, path, options = {}) => define({
|
|
|
66
69
|
description: `${options.read ? "Read" : "Apply"} ${operationId}.`,
|
|
67
70
|
rest: { method, path },
|
|
68
71
|
capability: "providers.execute",
|
|
69
|
-
|
|
72
|
+
authentication: "provider",
|
|
73
|
+
oauthScopes: [],
|
|
70
74
|
kind: options.read ? "read" : "mutation",
|
|
71
75
|
riskClass: "ordinary",
|
|
72
76
|
confirmation: "never",
|
|
@@ -84,6 +88,7 @@ function resource(operationId, method, path, pathShape, options = { capability:
|
|
|
84
88
|
rest: { method, path },
|
|
85
89
|
...Object.keys(pathShape).length ? { parameters: `treeseed.${operationId}.parameters/v1` } : {},
|
|
86
90
|
capability: options.capability,
|
|
91
|
+
authentication: options.authentication ?? ((options.scopes ?? (kind === "read" ? ["treeseed:read"] : ["treeseed:projects:write"])).length ? "oauth" : "anonymous"),
|
|
87
92
|
oauthScopes: options.scopes ?? (kind === "read" ? ["treeseed:read"] : ["treeseed:projects:write"]),
|
|
88
93
|
kind,
|
|
89
94
|
riskClass,
|
|
@@ -162,7 +167,7 @@ const CONTROL_PLANE_OPERATIONS = {
|
|
|
162
167
|
members: resource("teams.members.list", "GET", "/v1/teams/{teamId}/members", { teamId: z.string().min(1) }, { capability: "teams.read", pagination: "cursor" }),
|
|
163
168
|
invite: resource("teams.invites.create", "POST", "/v1/teams/{teamId}/invites", { teamId: z.string().min(1) }, { capability: "teams.write" }),
|
|
164
169
|
invites: resource("teams.invites.list", "GET", "/v1/teams/{teamId}/invites", { teamId: z.string().min(1) }, { capability: "teams.read", pagination: "cursor" }),
|
|
165
|
-
inviteShow: resource("teams.invites.show", "GET", "/v1/team-invites/{token}", { token: z.string().min(1) }, { capability: "teams.join", scopes: [], redactedPaths: ["path.token"] }),
|
|
170
|
+
inviteShow: resource("teams.invites.show", "GET", "/v1/team-invites/{token}", { token: z.string().min(1) }, { capability: "teams.join", scopes: [], authentication: "signed_request", redactedPaths: ["path.token"] }),
|
|
166
171
|
inviteAccept: resource("teams.invites.accept", "POST", "/v1/team-invites/{token}/accept", { token: z.string().min(1) }, { capability: "teams.join", redactedPaths: ["path.token"] }),
|
|
167
172
|
updateMember: resource("teams.members.update", "PATCH", "/v1/teams/{teamId}/members/{membershipId}", { teamId: z.string().min(1), membershipId: z.string().min(1) }, { capability: "teams.write", concurrency: true }),
|
|
168
173
|
removeMember: resource("teams.members.delete", "DELETE", "/v1/teams/{teamId}/members/{membershipId}", { teamId: z.string().min(1), membershipId: z.string().min(1) }, { capability: "teams.write", risk: "destructive", concurrency: true }),
|
|
@@ -218,8 +223,8 @@ const CONTROL_PLANE_OPERATIONS = {
|
|
|
218
223
|
},
|
|
219
224
|
repositories: {
|
|
220
225
|
githubSetup: resource("repositories.github.setup", "POST", "/v1/provider-connectors/github/{kind}/setup", { kind: z.string().min(1) }, { capability: "repositories.connect", scopes: ["treeseed:projects:write"], risk: "authority" }),
|
|
221
|
-
githubCallback: resource("repositories.github.callback", "GET", "/v1/provider-connectors/github/{kind}/callback", { kind: z.string().min(1) }, { capability: "repositories.connect", scopes: [] }),
|
|
222
|
-
githubWebhook: resource("repositories.github.webhook", "POST", "/v1/provider-webhooks/github/{kind}", { kind: z.string().min(1) }, { capability: "repositories.webhook", scopes: [], redactedPaths: ["body"] }),
|
|
226
|
+
githubCallback: resource("repositories.github.callback", "GET", "/v1/provider-connectors/github/{kind}/callback", { kind: z.string().min(1) }, { capability: "repositories.connect", scopes: [], authentication: "signed_request" }),
|
|
227
|
+
githubWebhook: resource("repositories.github.webhook", "POST", "/v1/provider-webhooks/github/{kind}", { kind: z.string().min(1) }, { capability: "repositories.webhook", scopes: [], authentication: "signed_request", redactedPaths: ["body"] }),
|
|
223
228
|
workflowOperations: resource("repositories.workflows.list", "GET", "/v1/projects/{projectId}/workflow-operations", { projectId: z.string().min(1) }, { capability: "workflows.read", pagination: "cursor" }),
|
|
224
229
|
workflowRuns: resource("repositories.workflow.runs.list", "GET", "/v1/projects/{projectId}/workflow-operation-runs", { projectId: z.string().min(1) }, { capability: "workflows.read", pagination: "cursor" }),
|
|
225
230
|
updateWorkflow: resource("repositories.workflows.update", "PUT", "/v1/projects/{projectId}/workflow-operations/{operationId}", { projectId: z.string().min(1), operationId: z.string().min(1) }, { capability: "workflows.write", concurrency: true }),
|
|
@@ -235,6 +240,16 @@ const CONTROL_PLANE_OPERATIONS = {
|
|
|
235
240
|
putWorkflowVariable: resource("repositories.workflow.variables.put", "PUT", "/v1/projects/{projectId}/workflow-configuration/variables/{name}", { projectId: z.string().min(1), name: z.string().min(1) }, { capability: "workflows.write", concurrency: true }),
|
|
236
241
|
deleteWorkflowVariable: resource("repositories.workflow.variables.delete", "DELETE", "/v1/projects/{projectId}/workflow-configuration/variables/{name}", { projectId: z.string().min(1), name: z.string().min(1) }, { capability: "workflows.write", risk: "destructive", concurrency: true })
|
|
237
242
|
},
|
|
243
|
+
services: {
|
|
244
|
+
providers: resource("services.providers.list", "GET", "/v1/service-providers", {}, { capability: "services.read", surfaces: ["rest", "cli", "mcp_tool"] }),
|
|
245
|
+
connections: resource("services.connections.list", "GET", "/v1/teams/{teamId}/services", { teamId: z.string().min(1) }, { capability: "services.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
|
|
246
|
+
connection: resource("services.connections.show", "GET", "/v1/teams/{teamId}/services/{connectionId}", { teamId: z.string().min(1), connectionId: z.string().min(1) }, { capability: "services.read", surfaces: ["rest", "cli", "mcp_resource"] }),
|
|
247
|
+
createConnection: resource("services.connections.create", "POST", "/v1/teams/{teamId}/services", { teamId: z.string().min(1) }, { capability: "services.write", surfaces: ["rest", "cli", "mcp_tool"] }),
|
|
248
|
+
updateConnection: resource("services.connections.update", "PUT", "/v1/teams/{teamId}/services/{connectionId}", { teamId: z.string().min(1), connectionId: z.string().min(1) }, { capability: "services.write", surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
|
|
249
|
+
disconnect: resource("services.connections.disconnect", "DELETE", "/v1/teams/{teamId}/services/{connectionId}", { teamId: z.string().min(1), connectionId: z.string().min(1) }, { capability: "services.write", surfaces: ["rest", "cli", "mcp_tool"], risk: "destructive", concurrency: true }),
|
|
250
|
+
authorities: resource("services.credential.authorities.list", "GET", "/v1/teams/{teamId}/services/{connectionId}/credential-authorities", { teamId: z.string().min(1), connectionId: z.string().min(1) }, { capability: "secrets.read", surfaces: ["rest", "cli"], pagination: "cursor" }),
|
|
251
|
+
putAuthority: resource("services.credential.authorities.put", "PUT", "/v1/teams/{teamId}/services/{connectionId}/credential-authorities/{profileId}", { teamId: z.string().min(1), connectionId: z.string().min(1), profileId: z.string().min(1) }, { capability: "secrets.write", surfaces: ["rest", "cli"], risk: "credential", concurrency: true, redactedPaths: ["body"] })
|
|
252
|
+
},
|
|
238
253
|
agents: {
|
|
239
254
|
list: resource("agents.list", "GET", "/v1/projects/{projectId}/agents", { projectId: z.string().min(1) }, { capability: "agents.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
|
|
240
255
|
show: resource("agents.show", "GET", "/v1/projects/{projectId}/agents/{agentSlug}", { projectId: z.string().min(1), agentSlug: z.string().min(1) }, { capability: "agents.read", surfaces: ["rest", "cli", "mcp_resource"] }),
|