@treeseed/sdk 0.13.0-rc.82 → 0.13.0-rc.84

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-03T03:47:38.642Z"}
1
+ {"completedAt":"2026-09-03T07:35:45.110Z"}
@@ -1,7 +1,7 @@
1
1
  export declare const ARTIFACT_MUTATION_RECEIPT_SCHEMA: "treeseed.artifact-mutation-receipt/v1";
2
2
  export type ArtifactMutationKind = 'treedx-content' | 'source-checkpoint';
3
3
  export type ArtifactMutationPhase = 'provisional' | 'integrated';
4
- import type { AgentWorkExecutionMode, UpstreamMutationPolicy } from './contracts/support/execution-mode.js';
4
+ import type { AgentWorkExecutionMode, UpstreamMutationPolicy } from './contracts/support/authority/execution-mode.js';
5
5
  export interface ArtifactMutationEvidence {
6
6
  ref: string;
7
7
  digest?: string | null;
@@ -1,5 +1,5 @@
1
1
  export type AgentExecutionMode = 'planning' | 'acting';
2
- export type AgentWorkExecutionMode = import('../../support/execution-mode.js').AgentWorkExecutionMode;
2
+ import type { AgentWorkExecutionMode } from '../../support/authority/execution-mode.js';
3
3
  export type ProviderAssignmentStatus = 'pending' | 'leased' | 'running' | 'completed' | 'failed' | 'returned' | 'expired' | 'cancelled';
4
4
  export type ProviderAssignmentLeaseState = 'unleased' | 'leased' | 'released' | 'expired';
5
5
  export type AgentModeRunStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
@@ -1,6 +1,6 @@
1
1
  /** Portable durable records shared by workday control-plane and operator consumers. */
2
2
  import type { WorkdayAgentSelection } from '../../../workday.js';
3
- import type { AgentWorkExecutionMode } from '../../support/execution-mode.js';
3
+ import type { AgentWorkExecutionMode } from '../../support/authority/execution-mode.js';
4
4
  export type CapacityWorkdayRunStatus = 'queued' | 'running' | 'completed' | 'cancelled' | 'failed' | 'degraded';
5
5
  export type CapacityWorkdayEventStatus = 'recorded' | 'active' | 'completed' | 'warning' | 'error' | 'failed';
6
6
  export type CapacityWorkdayDemandSource = 'objective' | 'question' | 'proposal' | 'decision-review' | 'knowledge-gap' | 'release-readiness' | 'idle-intent' | 'planning-input' | 'capacity-plan' | 'assignment-completion' | 'assignment-blockage' | 'workday-summary' | 'handoff' | 'research-workflow';
@@ -1,9 +1,9 @@
1
1
  import type { CapacityPageInfo } from '../../../capacity/capacity-core/capacity-pagination.js';
2
2
  import type { ExecutionCapabilityDemand, ExecutionCapabilitySupply } from '../../../types/agents.js';
3
- import type { AgentCapacityEnvelope, AgentExecutionMode, AgentModeRun, DecisionExecutionInput, ProviderAssignment, ProviderAssignmentSynthesisSource, TreeDxProxyHandle, WorkdayCapacityEnvelope } from '../capacity/assignments/assignment-records.js';
4
- import type { AgentKernelPolicy, AgentKernelProfile } from '../projects/agents/project-agent-class.js';
3
+ import type { AgentCapacityEnvelope, AgentExecutionMode, AgentModeRun, AgentModeRunUsageSettlement, DecisionExecutionInput, ProviderAssignment, ProviderAssignmentSynthesisSource, TreeDxProxyHandle, WorkdayCapacityEnvelope } from '../capacity/assignments/assignment-records.js';
4
+ import type { AgentKernelPolicy, AgentKernelProfile, ProjectAgentClass } from '../projects/agents/project-agent-class.js';
5
5
  import type { CapacityLedgerEntry, CapacityReservation, CapacityUsageActual } from '../support/financial-records.js';
6
- import type { WorkdayCapacityEnvelopeRecord } from '../support/planning-records.js';
6
+ import type { DecisionPlanningStatus, WorkdayCapacityEnvelopeRecord } from '../support/planning-records.js';
7
7
  export type AgentKernelModeExecutionStatus = 'completed' | 'waiting' | 'failed' | 'returned';
8
8
  export type AgentKernelModeFallbackCode = 'assignment_missing_project_or_agent' | 'assignment_governance_provenance_missing' | 'assignment_lease_expired' | 'assignment_mode_not_allowed' | 'assignment_missing_capacity_envelope' | 'assignment_missing_decision_input' | 'assignment_handler_failed' | 'assignment_project_not_synced' | 'assignment_agent_not_found' | 'assignment_insufficient_capability' | 'assignment_decision_not_ready' | 'assignment_capacity_plan_not_accepted' | 'assignment_capacity_not_reserved' | 'assignment_capability_handle_invalid' | 'assignment_capability_handle_secret_material' | 'assignment_capability_handle_write_not_ready' | 'assignment_capability_handle_workspace_denied' | 'assignment_repository_ref_scope_invalid' | 'assignment_workflow_operation_denied' | 'assignment_eligibility_capability_mismatch' | 'assignment_retry_policy_exceeded' | 'assignment_treedx_proxy_scope_invalid' | 'assignment_fallback_quota_exceeded' | 'assignment_output_invalid';
9
9
  export interface AgentCapacityPlan {
@@ -189,7 +189,7 @@ export interface DecisionAssignmentGraph {
189
189
  edges: DecisionAssignmentGraphEdge[];
190
190
  compiledAt?: string | null;
191
191
  compiledBy: 'api-control-plane';
192
- executionMode?: import('./execution-mode.js').AgentWorkExecutionMode;
192
+ executionMode?: import('./authority/execution-mode.js').AgentWorkExecutionMode;
193
193
  metadata?: Record<string, unknown>;
194
194
  }
195
195
  export interface DecisionAssignmentGraphRecord extends DecisionAssignmentGraph {
@@ -2,3 +2,4 @@ export * from '../secrets-capability/service-provider-contracts.js';
2
2
  export * from '../secrets-capability/provider-operation-contracts.js';
3
3
  export * from '../secrets-capability/workflow-operation-contracts.js';
4
4
  export * from '../secrets-capability/service-vault-contracts.js';
5
+ export * from '../secrets-capability/service-vault-crypto.js';
@@ -2,3 +2,4 @@ export * from "../secrets-capability/service-provider-contracts.js";
2
2
  export * from "../secrets-capability/provider-operation-contracts.js";
3
3
  export * from "../secrets-capability/workflow-operation-contracts.js";
4
4
  export * from "../secrets-capability/service-vault-contracts.js";
5
+ export * from "../secrets-capability/service-vault-crypto.js";
@@ -59,92 +59,8 @@ export declare const HOSTED_TOPOLOGY_OPERATIONS: {
59
59
  connectionRef: string;
60
60
  }>>;
61
61
  };
62
- }, {
63
- schemaVersion: "treeseed.hosted-topology-plan/v1";
64
- blockers: {
65
- code: "connection-unavailable" | "state-backend-unavailable" | "dependency-cycle" | "observation-unhealthy" | "adoption-drift";
66
- message: string;
67
- resourceId?: string | undefined;
68
- }[];
69
- planDigest: string;
70
- actions: {
71
- action: "noop" | "create" | "adopt" | "update";
72
- resourceId: string;
73
- kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
74
- provider: "cloudflare" | "railway";
75
- providerResourceId: string | null;
76
- desiredResource: {
77
- id: string;
78
- kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
79
- provider: "cloudflare" | "railway";
80
- adoption: {
81
- mode: "adopt-or-create";
82
- replacement: "forbidden";
83
- externalIdInput?: string | undefined;
84
- };
85
- dependsOn?: string[] | undefined;
86
- parameters?: Record<string, {
87
- input: string;
88
- } | {
89
- artifact: string;
90
- } | {
91
- resourceOutput: {
92
- resourceId: string;
93
- output: string;
94
- };
95
- } | {
96
- literal: string | number | boolean;
97
- }> | undefined;
98
- };
99
- desiredDigest: string;
100
- previousDigest: string | null;
101
- }[];
102
- teamId: string;
103
- environment: "production" | "staging";
104
- executable: false;
105
- artifacts: Record<string, {
106
- digest: string;
107
- source: string;
108
- kind: "archive";
109
- format: "tar+gzip";
110
- } | {
111
- digest: string;
112
- source: string;
113
- kind: "file";
114
- mediaType: string;
115
- } | {
116
- digest: string;
117
- kind: "oci-image";
118
- identity: string;
119
- }>;
120
- planId: string;
121
- deploymentId: string;
122
- stackId: string;
123
- stateBackend: {
124
- key: string;
125
- type: "s3";
126
- schemaVersion: "treeseed.hosted-state-backend/v1";
127
- teamId: string;
128
- environment: "production" | "staging";
129
- deploymentId: string;
130
- stackId: string;
131
- connectionRef: string;
132
- bucket: string;
133
- region: string;
134
- encryptionKeyRef: string;
135
- bindingDigest: string;
136
- endpoint?: string | undefined;
137
- usePathStyle?: boolean | undefined;
138
- } | null;
139
- providerConnections: Partial<Record<"cloudflare" | "railway", {
140
- connectionRef: string;
141
- nonSecretConfig: Record<string, string | number | boolean>;
142
- }>>;
143
- declarationDigest: string;
144
- topologyId: string;
145
- platformCommit: string;
146
- approvalRequired: boolean;
147
- }>;
62
+ credentialLeaseIds?: string[] | undefined;
63
+ }, Record<string, unknown>>;
148
64
  readonly apply: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
149
65
  teamId: string;
150
66
  }, {}, {
@@ -246,6 +162,7 @@ export declare const HOSTED_TOPOLOGY_OPERATIONS: {
246
162
  platformCommit: string;
247
163
  approvalRequired: boolean;
248
164
  };
165
+ credentialLeaseIds?: string[] | undefined;
249
166
  }, Record<string, unknown>>;
250
167
  readonly status: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
251
168
  teamId: string;
@@ -290,34 +207,220 @@ export declare const HOSTED_TOPOLOGY_OPERATIONS: {
290
207
  readonly rollback: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
291
208
  teamId: string;
292
209
  }, {}, {
293
- rollback: {
294
- schemaVersion: "treeseed.hosted-topology-rollback/v1";
210
+ approval: {
211
+ schemaVersion: "treeseed.hosted-topology-rollback-execution-approval/v1";
295
212
  teamId: string;
296
213
  environment: "production" | "staging";
297
- operations: {
298
- action: "noop" | "restore" | "delete-created";
299
- resourceId: string;
300
- providerResourceId: string;
301
- targetDigest: string | null;
302
- }[];
303
214
  deploymentId: string;
304
215
  stackId: string;
305
216
  backendBindingDigest: string;
306
- rollbackId: string;
307
- sourceReceiptId: string;
308
- rollbackDigest: string;
217
+ decision: "approved";
218
+ approvedBy: string;
219
+ approvedAt: string;
220
+ executionDigest: string;
309
221
  };
310
- approval: {
311
- schemaVersion: "treeseed.hosted-topology-rollback-approval/v1";
222
+ execution: {
223
+ schemaVersion: "treeseed.hosted-topology-rollback-execution/v1";
312
224
  teamId: string;
313
225
  environment: "production" | "staging";
226
+ rollback: {
227
+ schemaVersion: "treeseed.hosted-topology-rollback/v1";
228
+ teamId: string;
229
+ environment: "production" | "staging";
230
+ operations: {
231
+ action: "noop" | "restore" | "delete-created";
232
+ resourceId: string;
233
+ providerResourceId: string;
234
+ targetDigest: string | null;
235
+ }[];
236
+ deploymentId: string;
237
+ stackId: string;
238
+ backendBindingDigest: string;
239
+ rollbackId: string;
240
+ sourceReceiptId: string;
241
+ rollbackDigest: string;
242
+ };
314
243
  deploymentId: string;
315
244
  stackId: string;
245
+ topologyId: string;
316
246
  backendBindingDigest: string;
317
- decision: "approved";
318
- approvedBy: string;
319
- approvedAt: string;
320
- rollbackDigest: string;
247
+ sourceReceiptId: string;
248
+ sourcePlanDigest: string;
249
+ targetPlanDigest: string;
250
+ executionDigest: string;
251
+ };
252
+ sourcePlan: {
253
+ schemaVersion: "treeseed.hosted-topology-plan/v1";
254
+ blockers: {
255
+ code: "connection-unavailable" | "state-backend-unavailable" | "dependency-cycle" | "observation-unhealthy" | "adoption-drift";
256
+ message: string;
257
+ resourceId?: string | undefined;
258
+ }[];
259
+ planDigest: string;
260
+ actions: {
261
+ action: "noop" | "create" | "adopt" | "update";
262
+ resourceId: string;
263
+ kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
264
+ provider: "cloudflare" | "railway";
265
+ providerResourceId: string | null;
266
+ desiredResource: {
267
+ id: string;
268
+ kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
269
+ provider: "cloudflare" | "railway";
270
+ adoption: {
271
+ mode: "adopt-or-create";
272
+ replacement: "forbidden";
273
+ externalIdInput?: string | undefined;
274
+ };
275
+ dependsOn?: string[] | undefined;
276
+ parameters?: Record<string, {
277
+ input: string;
278
+ } | {
279
+ artifact: string;
280
+ } | {
281
+ resourceOutput: {
282
+ resourceId: string;
283
+ output: string;
284
+ };
285
+ } | {
286
+ literal: string | number | boolean;
287
+ }> | undefined;
288
+ };
289
+ desiredDigest: string;
290
+ previousDigest: string | null;
291
+ }[];
292
+ teamId: string;
293
+ environment: "production" | "staging";
294
+ executable: false;
295
+ artifacts: Record<string, {
296
+ digest: string;
297
+ source: string;
298
+ kind: "archive";
299
+ format: "tar+gzip";
300
+ } | {
301
+ digest: string;
302
+ source: string;
303
+ kind: "file";
304
+ mediaType: string;
305
+ } | {
306
+ digest: string;
307
+ kind: "oci-image";
308
+ identity: string;
309
+ }>;
310
+ planId: string;
311
+ deploymentId: string;
312
+ stackId: string;
313
+ stateBackend: {
314
+ key: string;
315
+ type: "s3";
316
+ schemaVersion: "treeseed.hosted-state-backend/v1";
317
+ teamId: string;
318
+ environment: "production" | "staging";
319
+ deploymentId: string;
320
+ stackId: string;
321
+ connectionRef: string;
322
+ bucket: string;
323
+ region: string;
324
+ encryptionKeyRef: string;
325
+ bindingDigest: string;
326
+ endpoint?: string | undefined;
327
+ usePathStyle?: boolean | undefined;
328
+ } | null;
329
+ providerConnections: Partial<Record<"cloudflare" | "railway", {
330
+ connectionRef: string;
331
+ nonSecretConfig: Record<string, string | number | boolean>;
332
+ }>>;
333
+ declarationDigest: string;
334
+ topologyId: string;
335
+ platformCommit: string;
336
+ approvalRequired: boolean;
337
+ };
338
+ targetPlan: {
339
+ schemaVersion: "treeseed.hosted-topology-plan/v1";
340
+ blockers: {
341
+ code: "connection-unavailable" | "state-backend-unavailable" | "dependency-cycle" | "observation-unhealthy" | "adoption-drift";
342
+ message: string;
343
+ resourceId?: string | undefined;
344
+ }[];
345
+ planDigest: string;
346
+ actions: {
347
+ action: "noop" | "create" | "adopt" | "update";
348
+ resourceId: string;
349
+ kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
350
+ provider: "cloudflare" | "railway";
351
+ providerResourceId: string | null;
352
+ desiredResource: {
353
+ id: string;
354
+ kind: "admin-application" | "pages-application" | "dns-record" | "tls-policy" | "api-proxy" | "control-plane-api" | "postgresql" | "operations-runner" | "treedx-service";
355
+ provider: "cloudflare" | "railway";
356
+ adoption: {
357
+ mode: "adopt-or-create";
358
+ replacement: "forbidden";
359
+ externalIdInput?: string | undefined;
360
+ };
361
+ dependsOn?: string[] | undefined;
362
+ parameters?: Record<string, {
363
+ input: string;
364
+ } | {
365
+ artifact: string;
366
+ } | {
367
+ resourceOutput: {
368
+ resourceId: string;
369
+ output: string;
370
+ };
371
+ } | {
372
+ literal: string | number | boolean;
373
+ }> | undefined;
374
+ };
375
+ desiredDigest: string;
376
+ previousDigest: string | null;
377
+ }[];
378
+ teamId: string;
379
+ environment: "production" | "staging";
380
+ executable: false;
381
+ artifacts: Record<string, {
382
+ digest: string;
383
+ source: string;
384
+ kind: "archive";
385
+ format: "tar+gzip";
386
+ } | {
387
+ digest: string;
388
+ source: string;
389
+ kind: "file";
390
+ mediaType: string;
391
+ } | {
392
+ digest: string;
393
+ kind: "oci-image";
394
+ identity: string;
395
+ }>;
396
+ planId: string;
397
+ deploymentId: string;
398
+ stackId: string;
399
+ stateBackend: {
400
+ key: string;
401
+ type: "s3";
402
+ schemaVersion: "treeseed.hosted-state-backend/v1";
403
+ teamId: string;
404
+ environment: "production" | "staging";
405
+ deploymentId: string;
406
+ stackId: string;
407
+ connectionRef: string;
408
+ bucket: string;
409
+ region: string;
410
+ encryptionKeyRef: string;
411
+ bindingDigest: string;
412
+ endpoint?: string | undefined;
413
+ usePathStyle?: boolean | undefined;
414
+ } | null;
415
+ providerConnections: Partial<Record<"cloudflare" | "railway", {
416
+ connectionRef: string;
417
+ nonSecretConfig: Record<string, string | number | boolean>;
418
+ }>>;
419
+ declarationDigest: string;
420
+ topologyId: string;
421
+ platformCommit: string;
422
+ approvalRequired: boolean;
321
423
  };
424
+ credentialLeaseIds?: string[] | undefined;
322
425
  }, Record<string, unknown>>;
323
426
  };
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
- import { hostedTopologyApprovalSchema, hostedTopologyDeclarationSchema, hostedTopologyPlanSchema, hostedTopologyReceiptSchema, hostedTopologyRollbackApprovalSchema, hostedTopologyRollbackSchema } from "../../deployment/hosted-topology.js";
2
+ import { hostedTopologyApprovalSchema, hostedTopologyDeclarationSchema, hostedTopologyPlanSchema, hostedTopologyReceiptSchema, hostedTopologyRollbackExecutionApprovalSchema, hostedTopologyRollbackExecutionSchema } from "../../deployment/hosted-topology.js";
3
3
  import { defineOperation } from "../operation-builder.js";
4
4
  const teamPath = z.object({ teamId: z.string().min(1) }).strict();
5
5
  const empty = z.object({}).strict();
6
6
  const none = z.undefined();
7
7
  const operationReceipt = z.record(z.unknown());
8
+ const credentialLeaseIds = z.array(z.string().min(1)).min(1).optional();
8
9
  const HOSTED_TOPOLOGY_OPERATIONS = {
9
10
  plan: defineOperation({
10
11
  operationId: "infrastructure.topology.plan",
@@ -21,7 +22,7 @@ const HOSTED_TOPOLOGY_OPERATIONS = {
21
22
  cacheScope: "none",
22
23
  pagination: "none",
23
24
  idempotencyRequired: false
24
- }, { path: teamPath, query: empty, body: z.object({ declaration: hostedTopologyDeclarationSchema }).strict(), output: hostedTopologyPlanSchema }),
25
+ }, { path: teamPath, query: empty, body: z.object({ declaration: hostedTopologyDeclarationSchema, credentialLeaseIds }).strict(), output: operationReceipt }),
25
26
  apply: defineOperation({
26
27
  operationId: "infrastructure.topology.apply",
27
28
  description: "Apply an exact approved hosted topology plan through the operations runner.",
@@ -38,7 +39,7 @@ const HOSTED_TOPOLOGY_OPERATIONS = {
38
39
  pagination: "none",
39
40
  concurrencyRequired: true,
40
41
  redactedPaths: ["body.approval.approvedBy"]
41
- }, { path: teamPath, query: empty, body: z.object({ plan: hostedTopologyPlanSchema, approval: hostedTopologyApprovalSchema }).strict(), output: operationReceipt }),
42
+ }, { path: teamPath, query: empty, body: z.object({ plan: hostedTopologyPlanSchema, approval: hostedTopologyApprovalSchema, credentialLeaseIds }).strict(), output: operationReceipt }),
42
43
  status: defineOperation({
43
44
  operationId: "infrastructure.topology.status",
44
45
  description: "Read the latest authoritative hosted topology receipt and operation state.",
@@ -70,7 +71,13 @@ const HOSTED_TOPOLOGY_OPERATIONS = {
70
71
  pagination: "none",
71
72
  concurrencyRequired: true,
72
73
  redactedPaths: ["body.approval.approvedBy"]
73
- }, { path: teamPath, query: empty, body: z.object({ rollback: hostedTopologyRollbackSchema, approval: hostedTopologyRollbackApprovalSchema }).strict(), output: operationReceipt })
74
+ }, { path: teamPath, query: empty, body: z.object({
75
+ execution: hostedTopologyRollbackExecutionSchema,
76
+ approval: hostedTopologyRollbackExecutionApprovalSchema,
77
+ sourcePlan: hostedTopologyPlanSchema,
78
+ targetPlan: hostedTopologyPlanSchema,
79
+ credentialLeaseIds
80
+ }).strict(), output: operationReceipt })
74
81
  };
75
82
  export {
76
83
  HOSTED_TOPOLOGY_OPERATIONS
@@ -0,0 +1,17 @@
1
+ export declare const SERVICE_VAULT_OPERATIONS: {
2
+ readonly userVaultKey: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
3
+ readonly putUserVaultKey: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
4
+ readonly teamVault: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
5
+ readonly initializeTeamVault: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
6
+ readonly resetTeamVault: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
7
+ readonly rotateTeamVault: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
8
+ readonly vaultGrantCandidates: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
9
+ readonly createVaultGrant: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
10
+ readonly deleteVaultGrant: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
11
+ readonly vaultCredentialEnvelopes: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
12
+ readonly credentialEnvelopes: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
13
+ readonly putCredentialEnvelope: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
14
+ readonly createOperationLease: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
15
+ readonly operationLease: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
16
+ readonly putOperationLeasePayload: import("../../control-plane-operation.js").ControlPlaneOperationBinding<any, {}, any, any>;
17
+ };
@@ -0,0 +1,158 @@
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
+ const teamPath = z.object({ teamId: z.string().min(1) }).strict();
7
+ function vaultOperation(operationId, method, path, pathSchema, options = {}) {
8
+ const read = method === "GET", risk = options.risk ?? "ordinary";
9
+ return defineOperation({
10
+ operationId,
11
+ description: `${read ? "Read" : "Apply"} ${operationId}.`,
12
+ rest: { method, path },
13
+ capability: read ? "secrets.read" : "secrets.write",
14
+ ...path.includes("{") ? { parameters: `treeseed.${operationId}.parameters/v1` } : {},
15
+ authentication: "oauth",
16
+ oauthScopes: read ? ["treeseed:read"] : ["treeseed:projects:write"],
17
+ kind: read ? "read" : "mutation",
18
+ riskClass: risk,
19
+ confirmation: risk === "ordinary" ? "never" : "input_required",
20
+ surfaces: ["rest"],
21
+ cacheScope: read ? "principal" : "none",
22
+ pagination: "none",
23
+ redactedPaths: options.redactedPaths
24
+ }, { path: pathSchema, query: read ? record : empty, body: read ? none : options.body ?? record, output: options.output ?? record });
25
+ }
26
+ const nullableRecord = record.nullable(), records = z.array(record);
27
+ const encryptedPrivateKeyEnvelope = z.object({
28
+ version: z.literal("service-vault-v1"),
29
+ algorithm: z.literal("xchacha20-poly1305-ietf"),
30
+ kdf: z.object({ algorithm: z.literal("argon2id"), opsLimit: z.number().int().positive(), memLimit: z.number().int().positive(), salt: z.string().min(1) }).strict(),
31
+ nonce: z.string().min(1),
32
+ ciphertext: z.string().min(1),
33
+ publicKey: z.string().min(1)
34
+ }).strict();
35
+ const encryptedCredentialEnvelope = z.object({
36
+ version: z.literal("service-vault-v1"),
37
+ algorithm: z.literal("xchacha20-poly1305-ietf"),
38
+ ciphertext: z.string().min(1),
39
+ nonce: z.string().min(1),
40
+ wrappedKey: z.string().min(1),
41
+ wrappedKeyNonce: z.string().min(1),
42
+ associatedData: z.string().min(1),
43
+ associatedDataDigest: z.string().min(1),
44
+ fingerprint: z.string().min(1)
45
+ }).strict();
46
+ const SERVICE_VAULT_OPERATIONS = {
47
+ userVaultKey: vaultOperation("services.vault.user.key.show", "GET", "/v1/users/me/vault-key", empty, { output: nullableRecord }),
48
+ putUserVaultKey: vaultOperation(
49
+ "services.vault.user.key.put",
50
+ "PUT",
51
+ "/v1/users/me/vault-key",
52
+ empty,
53
+ { risk: "credential", redactedPaths: ["body.encryptedPrivateKeyEnvelope"], body: z.object({ publicKey: z.string().min(1), encryptedPrivateKeyEnvelope }).strict() }
54
+ ),
55
+ teamVault: vaultOperation("services.vault.team.show", "GET", "/v1/teams/{teamId}/vault", teamPath, { output: nullableRecord }),
56
+ initializeTeamVault: vaultOperation(
57
+ "services.vault.team.initialize",
58
+ "POST",
59
+ "/v1/teams/{teamId}/vault",
60
+ teamPath,
61
+ { risk: "credential", redactedPaths: ["body.wrappedTeamVaultKey"], body: z.object({ userVaultKeyId: z.string().min(1), wrappedTeamVaultKey: z.string().min(1), encryptionVersion: z.literal("service-vault-v1") }).strict() }
62
+ ),
63
+ resetTeamVault: vaultOperation(
64
+ "services.vault.team.reset",
65
+ "POST",
66
+ "/v1/teams/{teamId}/vault/reset",
67
+ teamPath,
68
+ { risk: "destructive", redactedPaths: ["body.wrappedTeamVaultKey", "body.currentPassword"], body: z.object({ userVaultKeyId: z.string().min(1), wrappedTeamVaultKey: z.string().min(1), encryptionVersion: z.literal("service-vault-v1"), confirmation: z.string().min(1), currentPassword: z.string().min(1) }).strict() }
69
+ ),
70
+ rotateTeamVault: vaultOperation(
71
+ "services.vault.team.rotate",
72
+ "POST",
73
+ "/v1/teams/{teamId}/vault/rotate",
74
+ teamPath,
75
+ { risk: "credential", redactedPaths: ["body.envelopes", "body.grants"], body: z.object({
76
+ expectedKeyVersion: z.number().int().positive(),
77
+ envelopes: z.array(z.object({ id: z.string().min(1), envelope: encryptedCredentialEnvelope }).strict()),
78
+ grants: z.array(z.object({ userId: z.string().min(1), userVaultKeyId: z.string().min(1), wrappedTeamVaultKey: z.string().min(1) }).strict()).min(1)
79
+ }).strict() }
80
+ ),
81
+ vaultGrantCandidates: vaultOperation("services.vault.grant.candidates.list", "GET", "/v1/teams/{teamId}/vault/grant-candidates", teamPath, { output: records }),
82
+ createVaultGrant: vaultOperation(
83
+ "services.vault.grants.create",
84
+ "POST",
85
+ "/v1/teams/{teamId}/vault/grants",
86
+ teamPath,
87
+ { risk: "credential", redactedPaths: ["body.wrappedTeamVaultKey"], body: z.object({ userId: z.string().min(1), userVaultKeyId: z.string().min(1), wrappedTeamVaultKey: z.string().min(1) }).strict() }
88
+ ),
89
+ deleteVaultGrant: vaultOperation(
90
+ "services.vault.grants.delete",
91
+ "DELETE",
92
+ "/v1/teams/{teamId}/vault/grants/{grantId}",
93
+ z.object({ teamId: z.string().min(1), grantId: z.string().min(1) }).strict(),
94
+ { risk: "destructive" }
95
+ ),
96
+ vaultCredentialEnvelopes: vaultOperation(
97
+ "services.vault.credential.envelopes.list",
98
+ "GET",
99
+ "/v1/teams/{teamId}/vault/credential-envelopes",
100
+ teamPath,
101
+ { output: records }
102
+ ),
103
+ credentialEnvelopes: vaultOperation(
104
+ "services.credential.envelopes.list",
105
+ "GET",
106
+ "/v1/teams/{teamId}/services/{connectionId}/credential-envelopes",
107
+ z.object({ teamId: z.string().min(1), connectionId: z.string().min(1) }).strict(),
108
+ { output: records }
109
+ ),
110
+ putCredentialEnvelope: vaultOperation(
111
+ "services.credential.envelopes.put",
112
+ "POST",
113
+ "/v1/teams/{teamId}/services/{connectionId}/credential-envelopes",
114
+ z.object({ teamId: z.string().min(1), connectionId: z.string().min(1) }).strict(),
115
+ { risk: "credential", redactedPaths: ["body.envelope"], body: z.object({ definitionId: z.string().min(1), fieldKey: z.string().min(1), keyVersion: z.number().int().positive(), envelope: encryptedCredentialEnvelope }).strict() }
116
+ ),
117
+ createOperationLease: vaultOperation(
118
+ "services.operation.leases.create",
119
+ "POST",
120
+ "/v1/teams/{teamId}/service-operation-leases",
121
+ teamPath,
122
+ { risk: "authority", body: z.object({
123
+ connectionId: z.string().min(1),
124
+ capabilityType: z.string().min(1),
125
+ credentialProfileId: z.string().min(1),
126
+ purpose: z.enum([
127
+ "provider-connection-validation",
128
+ "remote-git-publication",
129
+ "workflow-dispatch",
130
+ "workflow-configuration",
131
+ "hosted-topology-plan",
132
+ "hosted-topology-apply",
133
+ "hosted-topology-readback",
134
+ "hosted-topology-rollback"
135
+ ]),
136
+ idempotencyKey: z.string().min(1).optional(),
137
+ resourceScope: record.optional(),
138
+ hostedBinding: record.optional(),
139
+ authorityRequests: z.array(record).optional()
140
+ }).strict() }
141
+ ),
142
+ operationLease: vaultOperation(
143
+ "services.operation.leases.show",
144
+ "GET",
145
+ "/v1/teams/{teamId}/service-operation-leases/{leaseId}",
146
+ z.object({ teamId: z.string().min(1), leaseId: z.string().min(1) }).strict()
147
+ ),
148
+ putOperationLeasePayload: vaultOperation(
149
+ "services.operation.leases.payload.put",
150
+ "PUT",
151
+ "/v1/teams/{teamId}/service-operation-leases/{leaseId}/payload",
152
+ z.object({ teamId: z.string().min(1), leaseId: z.string().min(1) }).strict(),
153
+ { risk: "credential", redactedPaths: ["body.sealedPayload"], body: z.object({ sealedPayload: z.string().min(1) }).strict() }
154
+ )
155
+ };
156
+ export {
157
+ SERVICE_VAULT_OPERATIONS
158
+ };