@treeseed/sdk 0.13.0-rc.124 → 0.13.0-rc.125

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.
@@ -106,6 +106,7 @@ const operationBindings = {
106
106
  "host security recovery verify": local("local.host.security.recovery.verify"),
107
107
  "host sandbox status": local("local.host.sandbox.status"),
108
108
  "host sandbox doctor": local("local.host.sandbox.doctor"),
109
+ "host sandbox source export": local("local.host.sandbox.source.export"),
109
110
  "host fleet status": local("local.host.fleet.status"),
110
111
  "host recovery status": local("local.host.recovery.status"),
111
112
  "host recovery retry": local("local.host.recovery.retry"),
@@ -330,7 +331,7 @@ const commandTree = {
330
331
  addOptions(leaf("reset", "mutation", "backend", "destructive"), [{ name: "--environment", description: "Exact storage environment to empty and recreate.", type: "string", required: true }])
331
332
  ]),
332
333
  branch("security", [leaf("plan"), hostSecurityInitialize(), leaf("status"), leaf("verify"), hostSecurityRotate(), branch("recovery", [hostRecoveryVerify()])]),
333
- branch("sandbox", [leaf("status"), leaf("doctor")]),
334
+ branch("sandbox", [leaf("status"), leaf("doctor"), branch("source", [addOptions(leaf("export"), [{ name: "--payload", description: "Exact published source selection as JSON; validated by the owning local manager.", type: "string", required: true }])])]),
334
335
  branch("fleet", [leaf("status")]),
335
336
  branch("update", [leaf("status"), leaf("check", "mutation"), leaf("apply", "mutation", void 0, "authority"), leaf("channel", "mutation", "track", "authority"), leaf("pause", "mutation", void 0, "authority"), leaf("resume", "mutation", void 0, "authority")]),
336
337
  branch("component", [leaf("list"), leaf("status", "read", "component"), leaf("enable", "mutation", "component", "authority"), leaf("disable", "mutation", "component", "destructive")]),
@@ -30,7 +30,7 @@ function operation(operationId, method, path, pathShape, options) {
30
30
  });
31
31
  }
32
32
  const adminAccountOperations = {
33
- publicProfile: operation("accounts.profile.public.show", "GET", "/v1/users/by-username/{username}/profile", { username: z.string().min(1) }, { capability: "accounts.public.read", authentication: "anonymous", cacheScope: "public", surfaces: ["rest", "mcp_resource"] }),
33
+ publicProfile: operation("accounts.profile.public.show", "GET", "/v1/users/by-username/{username}/profile", { username: z.string().min(1) }, { capability: "accounts.public.read", authentication: "anonymous", cacheScope: "public", surfaces: ["rest"] }),
34
34
  updateUsername: operation("accounts.username.update", "PATCH", "/v1/auth/web/username", {}, { capability: "accounts.write", concurrency: true }),
35
35
  notificationPreferences: operation("accounts.notification.preferences.show", "GET", "/v1/auth/web/notifications/preferences", {}, { capability: "accounts.read" }),
36
36
  updateNotificationPreferences: operation("accounts.notification.preferences.update", "PUT", "/v1/auth/web/notifications/preferences", {}, { capability: "accounts.write", concurrency: true }),
@@ -22,7 +22,7 @@ function inboxOperations() {
22
22
  body: none,
23
23
  output: inboxItemPageSchema
24
24
  }),
25
- show: defineOperation({ operationId: "inbox.items.show", description: "Read one inbox item and its thread.", rest: { method: "GET", path: "/v1/teams/{teamId}/inbox/items/{itemId}" }, parameters: "treeseed.inbox.items.show.parameters/v1", capability: "governance.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_resource"], cacheScope: "principal", pagination: "none" }, { path: itemPath, query: empty, body: none, output: inboxItemSchema }),
25
+ show: defineOperation({ operationId: "inbox.items.show", description: "Read one inbox item and its thread.", rest: { method: "GET", path: "/v1/teams/{teamId}/inbox/items/{itemId}" }, parameters: "treeseed.inbox.items.show.parameters/v1", capability: "governance.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"], cacheScope: "principal", pagination: "none" }, { path: itemPath, query: empty, body: none, output: inboxItemSchema }),
26
26
  events: defineOperation({ operationId: "inbox.events.list", description: "Long-poll ordered inbox events.", rest: { method: "GET", path: "/v1/teams/{teamId}/inbox/events" }, parameters: "treeseed.inbox.events.list.parameters/v1", capability: "governance.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_resource"], cacheScope: "principal", pagination: "cursor" }, { path: z.object({ teamId: z.string() }).strict(), query: z.object({ after: z.string().optional(), waitSeconds: z.coerce.number().int().min(0).max(30).optional(), limit: z.coerce.number().int().min(1).max(500).optional() }).strict(), body: none, output: inboxTimelineSchema }),
27
27
  createQuestion: defineOperation({ operationId: "inbox.questions.create", description: "Create and route a TreeDX-backed project question.", rest: { method: "POST", path: "/v1/teams/{teamId}/inbox/questions" }, parameters: "treeseed.inbox.questions.create.parameters/v1", capability: "governance.write", authentication: "oauth", oauthScopes: ["treeseed:knowledge:write", "treeseed:execution"], kind: "mutation", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "none", pagination: "none" }, { path: z.object({ teamId: z.string() }).strict(), query: empty, body: inboxQuestionCreateSchema, output: inboxMutationReceiptSchema }),
28
28
  getDraft: defineOperation({ operationId: "inbox.drafts.show", description: "Read the current principal private inbox draft.", rest: { method: "GET", path: "/v1/teams/{teamId}/inbox/items/{itemId}/drafts/{purpose}" }, parameters: "treeseed.inbox.drafts.show.parameters/v1", capability: "governance.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli"], cacheScope: "principal", pagination: "none" }, { path: itemPath.extend({ purpose: inboxDraftPurposeSchema }), query: empty, body: none, output: inboxDraftSchema.nullable() }),
@@ -4,15 +4,15 @@ import { knowledgeShareGrantInputSchema, knowledgeShareSchema, teamKnowledgeRequ
4
4
  const none = z.undefined(), empty = z.object({}).strict(), teamPath = z.object({ teamId: z.string().min(1) }).strict();
5
5
  const sharePath = z.object({ teamId: z.string().min(1), shareId: z.string().min(1) }).strict();
6
6
  const parameters = (operationId) => `treeseed.${operationId}.parameters/v1`;
7
- const readDescriptor = (operationId, path) => ({ operationId, description: `Read ${operationId}.`, rest: { method: "GET", path }, parameters: parameters(operationId), capability: "knowledge.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "principal", pagination: "none" });
7
+ const readDescriptor = (operationId, path) => ({ operationId, description: `Read ${operationId}.`, rest: { method: "GET", path }, parameters: parameters(operationId), capability: "knowledge.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli"], cacheScope: "principal", pagination: "none" });
8
8
  const execute = (operationId, path) => define({ operationId, description: `Execute ${operationId} across authorized team knowledge.`, rest: { method: "POST", path }, parameters: parameters(operationId), capability: "knowledge.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "mcp_tool"], cacheScope: "none", pagination: "none" }, { path: teamPath, query: empty, body: teamKnowledgeRequestSchema, output: z.record(z.unknown()) });
9
9
  function knowledgeShareOperations() {
10
10
  return {
11
11
  shares: {
12
12
  list: define(readDescriptor("knowledge.shares.list", "/v1/teams/{teamId}/knowledge/shares"), { path: teamPath, query: empty, body: none, output: z.object({ items: z.array(knowledgeShareSchema) }).strict() }),
13
13
  show: define(readDescriptor("knowledge.shares.show", "/v1/teams/{teamId}/knowledge/shares/{shareId}"), { path: sharePath, query: empty, body: none, output: knowledgeShareSchema }),
14
- grant: define({ operationId: "knowledge.shares.grant", description: "Grant bounded read-only knowledge access to another team.", rest: { method: "POST", path: "/v1/teams/{teamId}/knowledge/shares" }, parameters: parameters("knowledge.shares.grant"), capability: "knowledge.share", authentication: "oauth", oauthScopes: ["treeseed:projects:write"], kind: "mutation", riskClass: "authority", confirmation: "input_required", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "none", pagination: "none" }, { path: teamPath, query: empty, body: knowledgeShareGrantInputSchema, output: knowledgeShareSchema }),
15
- revoke: define({ operationId: "knowledge.shares.revoke", description: "Revoke a cross-team knowledge share.", rest: { method: "DELETE", path: "/v1/teams/{teamId}/knowledge/shares/{shareId}" }, parameters: parameters("knowledge.shares.revoke"), capability: "knowledge.share", authentication: "oauth", oauthScopes: ["treeseed:projects:write"], kind: "mutation", riskClass: "authority", confirmation: "input_required", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "none", pagination: "none" }, { path: sharePath, query: empty, body: empty, output: knowledgeShareSchema })
14
+ grant: define({ operationId: "knowledge.shares.grant", description: "Grant bounded read-only knowledge access to another team.", rest: { method: "POST", path: "/v1/teams/{teamId}/knowledge/shares" }, parameters: parameters("knowledge.shares.grant"), capability: "knowledge.share", authentication: "oauth", oauthScopes: ["treeseed:projects:write"], kind: "mutation", riskClass: "authority", confirmation: "input_required", surfaces: ["rest", "cli"], cacheScope: "none", pagination: "none" }, { path: teamPath, query: empty, body: knowledgeShareGrantInputSchema, output: knowledgeShareSchema }),
15
+ revoke: define({ operationId: "knowledge.shares.revoke", description: "Revoke a cross-team knowledge share.", rest: { method: "DELETE", path: "/v1/teams/{teamId}/knowledge/shares/{shareId}" }, parameters: parameters("knowledge.shares.revoke"), capability: "knowledge.share", authentication: "oauth", oauthScopes: ["treeseed:projects:write"], kind: "mutation", riskClass: "authority", confirmation: "input_required", surfaces: ["rest", "cli"], cacheScope: "none", pagination: "none" }, { path: sharePath, query: empty, body: empty, output: knowledgeShareSchema })
16
16
  },
17
17
  teamSearch: execute("knowledge.team.search", "/v1/teams/{teamId}/knowledge/search"),
18
18
  teamQuery: execute("knowledge.team.query", "/v1/teams/{teamId}/knowledge/query"),
@@ -15,7 +15,7 @@ const read = (operationId, path, parameters, query, pagination) => defineOperati
15
15
  kind: "read",
16
16
  riskClass: "ordinary",
17
17
  confirmation: "never",
18
- surfaces: ["rest", "cli"],
18
+ surfaces: ["rest", "cli", "mcp_tool"],
19
19
  cacheScope: "principal",
20
20
  pagination
21
21
  }, { path: parameters, query, body: z.undefined(), output });
@@ -1,7 +1,8 @@
1
1
  import { zodToJsonSchema } from "zod-to-json-schema";
2
+ import { exportSchemaConstraints } from "../content/validation/schema-constraints.js";
2
3
  function controlPlaneSchemaJson(schema, target = "openApi3") {
3
4
  if (target !== "openApi3" && target !== "jsonSchema7") throw new Error("Unsupported control-plane schema dialect.");
4
- return zodToJsonSchema(schema, { target, $refStrategy: "none" });
5
+ return zodToJsonSchema(schema, { target, $refStrategy: "none", postProcess: exportSchemaConstraints });
5
6
  }
6
7
  const CONTROL_PLANE_OPERATION_SCHEMA_VERSION = "treeseed.control-plane-operation/v1";
7
8
  const TREESEED_OAUTH_SCOPES = [
@@ -132,10 +132,10 @@ const CONTROL_PLANE_OPERATIONS = {
132
132
  pagination: "cursor"
133
133
  }, { path: empty, query: z.object({ teamId: z.string().min(1).optional(), limit: z.coerce.number().int().positive().max(200).optional(), cursor: z.string().min(1).optional() }).strict(), body: none, output: payload }),
134
134
  show: resource("projects.show", "GET", "/v1/projects/{projectId}", { projectId: z.string().min(1) }, { capability: "projects.read", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
135
- create: resource("projects.create", "POST", "/v1/teams/{teamId}/projects", { teamId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli", "mcp_tool"] }),
136
- update: resource("projects.update", "PUT", "/v1/projects/{projectId}", { projectId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
137
- archive: resource("projects.archive", "POST", "/v1/projects/{projectId}/archive", { projectId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli", "mcp_tool"], risk: "destructive", concurrency: true }),
138
- restore: resource("projects.restore", "POST", "/v1/projects/{projectId}/restore", { projectId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
135
+ create: resource("projects.create", "POST", "/v1/teams/{teamId}/projects", { teamId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli"] }),
136
+ update: resource("projects.update", "PUT", "/v1/projects/{projectId}", { projectId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli"], concurrency: true }),
137
+ archive: resource("projects.archive", "POST", "/v1/projects/{projectId}/archive", { projectId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli"], risk: "destructive", concurrency: true }),
138
+ restore: resource("projects.restore", "POST", "/v1/projects/{projectId}/restore", { projectId: z.string().min(1) }, { capability: "projects.write", surfaces: ["rest", "cli"], concurrency: true }),
139
139
  deletionBlockers: resource("projects.deletion.blockers", "GET", "/v1/projects/{projectId}/deletion-blockers", { projectId: z.string().min(1) }, { capability: "projects.read" }),
140
140
  remove: resource("projects.delete", "DELETE", "/v1/projects/{projectId}", { projectId: z.string().min(1) }, { capability: "projects.delete", risk: "irreversible", concurrency: true }),
141
141
  access: resource("projects.access.show", "GET", "/v1/projects/{projectId}/access", { projectId: z.string().min(1) }, { capability: "projects.read" }),
@@ -146,7 +146,7 @@ const CONTROL_PLANE_OPERATIONS = {
146
146
  },
147
147
  accounts: {
148
148
  ...adminAccountOperations,
149
- current: resource("accounts.current.show", "GET", "/v1/me", {}, { capability: "accounts.read", surfaces: ["rest", "cli", "mcp_resource"] }),
149
+ current: resource("accounts.current.show", "GET", "/v1/me", {}, { capability: "accounts.read", surfaces: ["rest", "cli"] }),
150
150
  register: resource("accounts.register", "POST", "/v1/auth/web/sign-up", {}, { capability: "accounts.register", scopes: [], redactedPaths: ["body.password"] }),
151
151
  confirmEmail: resource("accounts.email.confirm", "POST", "/v1/auth/web/confirm-email", {}, { capability: "accounts.register", scopes: [], redactedPaths: ["body.token"] }),
152
152
  requestPasswordReset: resource("accounts.password.reset.request", "POST", "/v1/auth/web/password-reset/request", {}, { capability: "accounts.register", scopes: [] }),
@@ -171,8 +171,8 @@ const CONTROL_PLANE_OPERATIONS = {
171
171
  teams: {
172
172
  ...adminTeamOperations,
173
173
  list: resource("teams.list", "GET", "/v1/teams", {}, { capability: "teams.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
174
- create: resource("teams.create", "POST", "/v1/teams", {}, { capability: "teams.write", surfaces: ["rest", "cli", "mcp_tool"] }),
175
- profile: resource("teams.profile.show", "GET", "/v1/teams/by-name/{name}/profile", { name: z.string().min(1) }, { capability: "teams.read", scopes: [], authentication: "anonymous", cacheScope: "public", surfaces: ["rest", "mcp_resource"] }),
174
+ create: resource("teams.create", "POST", "/v1/teams", {}, { capability: "teams.write", surfaces: ["rest", "cli"] }),
175
+ profile: resource("teams.profile.show", "GET", "/v1/teams/by-name/{name}/profile", { name: z.string().min(1) }, { capability: "teams.read", scopes: [], authentication: "anonymous", cacheScope: "public", surfaces: ["rest"] }),
176
176
  update: resource("teams.update", "PATCH", "/v1/teams/{teamId}", { teamId: z.string().min(1) }, { capability: "teams.write", concurrency: true }),
177
177
  access: resource("teams.access.show", "GET", "/v1/teams/{teamId}/access", { teamId: z.string().min(1) }, { capability: "teams.read" }),
178
178
  members: resource("teams.members.list", "GET", "/v1/teams/{teamId}/members", { teamId: z.string().min(1) }, { capability: "teams.read", pagination: "cursor" }),
@@ -189,8 +189,8 @@ const CONTROL_PLANE_OPERATIONS = {
189
189
  leave: resource("teams.leave", "POST", "/v1/teams/{teamId}/leave", { teamId: z.string().min(1) }, { capability: "teams.write", risk: "destructive" })
190
190
  },
191
191
  discussions: {
192
- list: resource("discussions.list", "GET", "/v1/discussions", {}, { capability: "discussions.read", surfaces: ["rest", "mcp_tool", "mcp_resource"], pagination: "cursor" }),
193
- create: resource("discussions.create", "POST", "/v1/discussions", {}, { capability: "discussions.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "mcp_tool"] }),
192
+ list: resource("discussions.list", "GET", "/v1/discussions", {}, { capability: "discussions.read", surfaces: ["rest"], pagination: "cursor" }),
193
+ create: resource("discussions.create", "POST", "/v1/discussions", {}, { capability: "discussions.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest"] }),
194
194
  updateStatus: resource("discussions.status.update", "POST", "/v1/discussions/{discussionId}/status", { discussionId: z.string().min(1) }, { capability: "discussions.write", scopes: ["treeseed:knowledge:write"], concurrency: true })
195
195
  },
196
196
  knowledge: {
@@ -202,25 +202,25 @@ const CONTROL_PLANE_OPERATIONS = {
202
202
  search: resource("knowledge.search", "GET", "/v1/knowledge/search", {}, { capability: "knowledge.read", surfaces: ["rest", "mcp_tool"], pagination: "cursor" }),
203
203
  teamCatalog: resource("knowledge.catalog.team", "GET", "/v1/teams/{teamId}/knowledge/catalog", { teamId: z.string().min(1) }, { capability: "knowledge.read", pagination: "cursor" }),
204
204
  projectCatalog: resource("knowledge.catalog.project", "GET", "/v1/projects/{projectId}/knowledge/catalog", { projectId: z.string().min(1) }, { capability: "knowledge.read", pagination: "cursor" }),
205
- createWorkspace: resource("knowledge.workspaces.create", "POST", "/v1/projects/{projectId}/knowledge/workspaces", { projectId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli"] }),
206
- workspace: resource("knowledge.workspaces.show", "GET", "/v1/knowledge/workspaces/{workspaceId}", { workspaceId: z.string().min(1) }, { capability: "knowledge.read", surfaces: ["rest", "cli"] }),
207
- workspaceContent: resource("knowledge.workspaces.content.show", "GET", "/v1/knowledge/workspaces/{workspaceId}/content", { workspaceId: z.string().min(1) }, { capability: "knowledge.read", surfaces: ["rest", "cli"] }),
208
- updateWorkspaceContent: resource("knowledge.workspaces.content.update", "PUT", "/v1/knowledge/workspaces/{workspaceId}/content", { workspaceId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli"], concurrency: true }),
209
- workspaceDiff: resource("knowledge.workspaces.diff", "GET", "/v1/knowledge/workspaces/{workspaceId}/diff", { workspaceId: z.string().min(1) }, { capability: "knowledge.read", surfaces: ["rest", "cli"] }),
210
- abandonWorkspace: resource("knowledge.workspaces.abandon", "POST", "/v1/knowledge/workspaces/{workspaceId}/abandon", { workspaceId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli"], risk: "destructive", concurrency: true }),
211
- submitWorkspace: resource("knowledge.workspaces.submit", "POST", "/v1/knowledge/workspaces/{workspaceId}/submit", { workspaceId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli"], concurrency: true }),
212
- reviews: resource("knowledge.reviews.list", "GET", "/v1/teams/{teamId}/knowledge/reviews", { teamId: z.string().min(1) }, { capability: "knowledge.review", surfaces: ["rest", "cli"], pagination: "cursor" }),
205
+ createWorkspace: resource("knowledge.workspaces.create", "POST", "/v1/projects/{projectId}/knowledge/workspaces", { projectId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli", "mcp_tool"] }),
206
+ workspace: resource("knowledge.workspaces.show", "GET", "/v1/knowledge/workspaces/{workspaceId}", { workspaceId: z.string().min(1) }, { capability: "knowledge.read", surfaces: ["rest", "cli", "mcp_tool"] }),
207
+ workspaceContent: resource("knowledge.workspaces.content.show", "GET", "/v1/knowledge/workspaces/{workspaceId}/content", { workspaceId: z.string().min(1) }, { capability: "knowledge.read", surfaces: ["rest", "cli", "mcp_tool"] }),
208
+ updateWorkspaceContent: resource("knowledge.workspaces.content.update", "PUT", "/v1/knowledge/workspaces/{workspaceId}/content", { workspaceId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
209
+ workspaceDiff: resource("knowledge.workspaces.diff", "GET", "/v1/knowledge/workspaces/{workspaceId}/diff", { workspaceId: z.string().min(1) }, { capability: "knowledge.read", surfaces: ["rest", "cli", "mcp_tool"] }),
210
+ abandonWorkspace: resource("knowledge.workspaces.abandon", "POST", "/v1/knowledge/workspaces/{workspaceId}/abandon", { workspaceId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli", "mcp_tool"], risk: "destructive", concurrency: true }),
211
+ submitWorkspace: resource("knowledge.workspaces.submit", "POST", "/v1/knowledge/workspaces/{workspaceId}/submit", { workspaceId: z.string().min(1) }, { capability: "knowledge.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
212
+ reviews: resource("knowledge.reviews.list", "GET", "/v1/teams/{teamId}/knowledge/reviews", { teamId: z.string().min(1) }, { capability: "knowledge.review", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
213
213
  commentReview: resource("knowledge.reviews.comments.create", "POST", "/v1/knowledge/reviews/{reviewId}/comments", { reviewId: z.string().min(1) }, { capability: "knowledge.review", scopes: ["treeseed:knowledge:write"] }),
214
- decideReview: resource("knowledge.reviews.decide", "POST", "/v1/knowledge/reviews/{reviewId}/decision", { reviewId: z.string().min(1) }, { capability: "knowledge.review", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli"], concurrency: true }),
215
- publishReview: resource("knowledge.reviews.publish", "POST", "/v1/knowledge/reviews/{reviewId}/publish", { reviewId: z.string().min(1) }, { capability: "knowledge.publish", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli"], concurrency: true })
214
+ decideReview: resource("knowledge.reviews.decide", "POST", "/v1/knowledge/reviews/{reviewId}/decision", { reviewId: z.string().min(1) }, { capability: "knowledge.review", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
215
+ publishReview: resource("knowledge.reviews.publish", "POST", "/v1/knowledge/reviews/{reviewId}/publish", { reviewId: z.string().min(1) }, { capability: "knowledge.publish", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "cli", "mcp_tool"], concurrency: true })
216
216
  },
217
217
  governance: {
218
218
  proposals: resource("governance.proposals.list", "GET", "/v1/projects/{projectId}/proposals", { projectId: z.string().min(1) }, { capability: "governance.read", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"], pagination: "cursor" }),
219
219
  createProposal: resource("governance.proposals.create", "POST", "/v1/projects/{projectId}/proposals", { projectId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli", "mcp_tool"] }),
220
- proposal: resource("governance.proposals.show", "GET", "/v1/projects/{projectId}/proposals/{proposalId}", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.read", surfaces: ["rest", "cli", "mcp_resource"] }),
221
- updateProposal: resource("governance.proposals.update", "PATCH", "/v1/projects/{projectId}/proposals/{proposalId}", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli"], concurrency: true }),
220
+ proposal: resource("governance.proposals.show", "GET", "/v1/projects/{projectId}/proposals/{proposalId}", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.read", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
221
+ updateProposal: resource("governance.proposals.update", "PATCH", "/v1/projects/{projectId}/proposals/{proposalId}", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
222
222
  resolveProposalFeedback: resource("governance.proposals.feedback.resolve", "POST", "/v1/projects/{projectId}/proposals/{proposalId}/feedback/{feedbackId}/resolve", { projectId: z.string().min(1), proposalId: z.string().min(1), feedbackId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli"], concurrency: true }),
223
- openProposal: resource("governance.proposals.open", "POST", "/v1/projects/{projectId}/proposals/{proposalId}/open", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli"], concurrency: true }),
223
+ openProposal: resource("governance.proposals.open", "POST", "/v1/projects/{projectId}/proposals/{proposalId}/open", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli", "mcp_tool"], concurrency: true }),
224
224
  startVoting: resource("governance.proposals.voting.start", "POST", "/v1/projects/{projectId}/proposals/{proposalId}/start-voting", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli"], concurrency: true }),
225
225
  vote: resource("governance.proposals.vote", "POST", "/v1/projects/{projectId}/proposals/{proposalId}/vote", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli"] }),
226
226
  evaluate: resource("governance.proposals.evaluate", "POST", "/v1/projects/{projectId}/proposals/{proposalId}/evaluate", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.decide", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli"], concurrency: true }),
@@ -228,7 +228,7 @@ const CONTROL_PLANE_OPERATIONS = {
228
228
  supersede: resource("governance.proposals.supersede", "POST", "/v1/projects/{projectId}/proposals/{proposalId}/supersede", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.write", scopes: ["treeseed:governance:write"], surfaces: ["rest", "cli"], concurrency: true }),
229
229
  proposalEvents: resource("governance.proposals.events", "GET", "/v1/projects/{projectId}/proposals/{proposalId}/events", { projectId: z.string().min(1), proposalId: z.string().min(1) }, { capability: "governance.read", pagination: "cursor" }),
230
230
  decisions: resource("governance.decisions.list", "GET", "/v1/projects/{projectId}/decisions", { projectId: z.string().min(1) }, { capability: "governance.read", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"], pagination: "cursor" }),
231
- decision: resource("governance.decisions.show", "GET", "/v1/projects/{projectId}/decisions/{decisionId}", { projectId: z.string().min(1), decisionId: z.string().min(1) }, { capability: "governance.read", surfaces: ["rest", "cli", "mcp_resource"] }),
231
+ decision: resource("governance.decisions.show", "GET", "/v1/projects/{projectId}/decisions/{decisionId}", { projectId: z.string().min(1), decisionId: z.string().min(1) }, { capability: "governance.read", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
232
232
  decisionEvents: resource("governance.decisions.events", "GET", "/v1/projects/{projectId}/decisions/{decisionId}/events", { projectId: z.string().min(1), decisionId: z.string().min(1) }, { capability: "governance.read", pagination: "cursor" }),
233
233
  approvals: resource("governance.approvals.list", "GET", "/v1/projects/{projectId}/approvals", { projectId: z.string().min(1) }, { capability: "governance.read", pagination: "cursor" }),
234
234
  approval: resource("governance.approvals.show", "GET", "/v1/projects/{projectId}/approvals/{approvalId}", { projectId: z.string().min(1), approvalId: z.string().min(1) }, { capability: "governance.read" }),
@@ -236,10 +236,10 @@ const CONTROL_PLANE_OPERATIONS = {
236
236
  },
237
237
  execution: EXECUTION_OPERATIONS,
238
238
  research: {
239
- createWorkflow: resource("research.workflows.create", "POST", "/v1/projects/{projectId}/research-workflows", { projectId: z.string().min(1) }, { capability: "research.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "mcp_tool"] }),
240
- workflows: resource("research.workflows.list", "GET", "/v1/projects/{projectId}/research-workflows", { projectId: z.string().min(1) }, { capability: "research.read", surfaces: ["rest", "mcp_tool", "mcp_resource"], pagination: "cursor" }),
241
- workflow: resource("research.workflows.show", "GET", "/v1/research-workflows/{workflowId}", { workflowId: z.string().min(1) }, { capability: "research.read", surfaces: ["rest", "mcp_resource"] }),
242
- completeStage: resource("research.workflows.stages.complete", "POST", "/v1/research-workflows/{workflowId}/stages/{stage}/complete", { workflowId: z.string().min(1), stage: z.string().min(1) }, { capability: "research.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest", "mcp_tool"], concurrency: true })
239
+ createWorkflow: resource("research.workflows.create", "POST", "/v1/projects/{projectId}/research-workflows", { projectId: z.string().min(1) }, { capability: "research.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest"] }),
240
+ workflows: resource("research.workflows.list", "GET", "/v1/projects/{projectId}/research-workflows", { projectId: z.string().min(1) }, { capability: "research.read", surfaces: ["rest"], pagination: "cursor" }),
241
+ workflow: resource("research.workflows.show", "GET", "/v1/research-workflows/{workflowId}", { workflowId: z.string().min(1) }, { capability: "research.read", surfaces: ["rest"] }),
242
+ completeStage: resource("research.workflows.stages.complete", "POST", "/v1/research-workflows/{workflowId}/stages/{stage}/complete", { workflowId: z.string().min(1), stage: z.string().min(1) }, { capability: "research.write", scopes: ["treeseed:knowledge:write"], surfaces: ["rest"], concurrency: true })
243
243
  },
244
244
  repositories: {
245
245
  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" }),
@@ -262,12 +262,12 @@ const CONTROL_PLANE_OPERATIONS = {
262
262
  },
263
263
  services: {
264
264
  ...SECRET_OPERATIONS,
265
- providers: resource("services.providers.list", "GET", "/v1/service-providers", {}, { capability: "services.read", surfaces: ["rest", "cli", "mcp_tool"] }),
266
- 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" }),
267
- 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"] }),
268
- createConnection: resource("services.connections.create", "POST", "/v1/teams/{teamId}/services", { teamId: z.string().min(1) }, { capability: "services.write", surfaces: ["rest", "cli", "mcp_tool"], risk: "credential" }),
269
- 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 }),
270
- 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 }),
265
+ providers: resource("services.providers.list", "GET", "/v1/service-providers", {}, { capability: "services.read", surfaces: ["rest", "cli"] }),
266
+ connections: resource("services.connections.list", "GET", "/v1/teams/{teamId}/services", { teamId: z.string().min(1) }, { capability: "services.read", surfaces: ["rest", "cli"], pagination: "cursor" }),
267
+ 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"] }),
268
+ createConnection: resource("services.connections.create", "POST", "/v1/teams/{teamId}/services", { teamId: z.string().min(1) }, { capability: "services.write", surfaces: ["rest", "cli"], risk: "credential" }),
269
+ 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"], concurrency: true }),
270
+ 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"], risk: "destructive", concurrency: true }),
271
271
  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" })
272
272
  },
273
273
  agents: {
@@ -296,7 +296,7 @@ const CONTROL_PLANE_OPERATIONS = {
296
296
  explain: resource("capacity.explain", "GET", "/v1/teams/{teamId}/capacity/explanation", { teamId: z.string().min(1) }, { capability: "capacity.read", surfaces: ["rest", "cli", "mcp_tool"] }),
297
297
  usage: resource("capacity.usage", "GET", "/v1/teams/{teamId}/capacity/usage", { teamId: z.string().min(1) }, { capability: "capacity.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
298
298
  ledger: resource("capacity.ledger", "GET", "/v1/teams/{teamId}/capacity/ledger", { teamId: z.string().min(1) }, { capability: "capacity.read", surfaces: ["rest", "cli"], pagination: "cursor" }),
299
- audit: resource("capacity.audit", "GET", "/v1/teams/{teamId}/capacity/audit", { teamId: z.string().min(1) }, { capability: "capacity.read", surfaces: ["rest", "cli"], pagination: "cursor" }),
299
+ audit: resource("capacity.audit", "GET", "/v1/teams/{teamId}/capacity/audit", { teamId: z.string().min(1) }, { capability: "capacity.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
300
300
  lanes: resource("capacity.lanes.list", "GET", "/v1/teams/{teamId}/capacity/lanes", { teamId: z.string().min(1) }, { capability: "capacity.read", surfaces: ["rest", "mcp_tool"], pagination: "cursor" }),
301
301
  grants: resource("capacity.grants.list", "GET", "/v1/teams/{teamId}/capacity-grants", { teamId: z.string().min(1) }, { capability: "capacity.read", pagination: "cursor" }),
302
302
  grant: resource("capacity.grants.show", "GET", "/v1/teams/{teamId}/capacity-grants/{grantId}", { teamId: z.string().min(1), grantId: z.string().min(1) }, { capability: "capacity.read" })
@@ -305,10 +305,10 @@ const CONTROL_PLANE_OPERATIONS = {
305
305
  ...WORKDAY_PROFILE_OPERATIONS,
306
306
  list: resource("workdays.list", "GET", "/v1/teams/{teamId}/workday-runs", { teamId: z.string().min(1) }, { capability: "workdays.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
307
307
  preflight: resource("workdays.plan", "POST", "/v1/teams/{teamId}/workday-runs/preflight", { teamId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], body: workdayIntent }),
308
- start: resource("workdays.start", "POST", "/v1/teams/{teamId}/workday-runs", { teamId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], risk: "authority" }),
309
- show: resource("workdays.show", "GET", "/v1/teams/{teamId}/workday-runs/{runId}", { teamId: z.string().min(1), runId: z.string().min(1) }, { capability: "workdays.read", surfaces: ["rest", "cli", "mcp_resource"] }),
308
+ start: resource("workdays.start", "POST", "/v1/teams/{teamId}/workday-runs", { teamId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], risk: "authority", body: z.object({ preflightId: z.string().min(1), preflightDigest: z.string().min(1) }).strict() }),
309
+ show: resource("workdays.show", "GET", "/v1/teams/{teamId}/workday-runs/{runId}", { teamId: z.string().min(1), runId: z.string().min(1) }, { capability: "workdays.read", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
310
310
  stop: resource("workdays.stop", "POST", "/v1/teams/{teamId}/workday-runs/{runId}/stop", { teamId: z.string().min(1), runId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], risk: "authority" }),
311
- events: resource("workdays.events.list", "GET", "/v1/teams/{teamId}/workday-runs/{runId}/events", { teamId: z.string().min(1), runId: z.string().min(1) }, { capability: "workdays.read", surfaces: ["rest", "cli"], pagination: "cursor" }),
311
+ events: resource("workdays.events.list", "GET", "/v1/teams/{teamId}/workday-runs/{runId}/events", { teamId: z.string().min(1), runId: z.string().min(1) }, { capability: "workdays.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
312
312
  schedules: resource("workdays.schedules.list", "GET", "/v1/teams/{teamId}/workday-schedules", { teamId: z.string().min(1) }, { capability: "workdays.read", surfaces: ["rest", "cli"], pagination: "cursor" }),
313
313
  createSchedule: resource("workdays.schedules.create", "POST", "/v1/teams/{teamId}/workday-schedules", { teamId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli"], risk: "authority", body: scheduledWorkdayIntent }),
314
314
  updateSchedule: resource("workdays.schedules.update", "PATCH", "/v1/teams/{teamId}/workday-schedules/{scheduleId}", { teamId: z.string().min(1), scheduleId: z.string().min(1) }, { capability: "workdays.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli"], concurrency: true })
@@ -316,7 +316,7 @@ const CONTROL_PLANE_OPERATIONS = {
316
316
  assignments: {
317
317
  recover: resource("assignments.recover", "POST", "/v1/teams/{teamId}/capacity/assignments/{assignmentId}/recover", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { capability: "assignments.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], risk: "destructive", body: z.object({ expectedStateVersion: z.number().int().positive().max(Number.MAX_SAFE_INTEGER), reason: z.string().trim().min(1).max(2e3) }).strict() }),
318
318
  list: resource("assignments.list", "GET", "/v1/teams/{teamId}/capacity/assignments", { teamId: z.string().min(1) }, { capability: "assignments.read", surfaces: ["rest", "cli", "mcp_tool"], pagination: "cursor" }),
319
- show: resource("assignments.show", "GET", "/v1/teams/{teamId}/capacity/assignments/{assignmentId}", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { capability: "assignments.read", surfaces: ["rest", "cli", "mcp_resource"] }),
319
+ show: resource("assignments.show", "GET", "/v1/teams/{teamId}/capacity/assignments/{assignmentId}", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { capability: "assignments.read", surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
320
320
  explain: resource("assignments.explain", "GET", "/v1/teams/{teamId}/capacity/assignments/{assignmentId}/explanation", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { capability: "assignments.read", surfaces: ["rest", "cli", "mcp_tool"] }),
321
321
  cancel: resource("assignments.cancel", "POST", "/v1/teams/{teamId}/capacity/assignments/{assignmentId}/cancel", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { capability: "assignments.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], risk: "destructive" }),
322
322
  retry: resource("assignments.retry", "POST", "/v1/teams/{teamId}/capacity/assignments/{assignmentId}/requeue", { teamId: z.string().min(1), assignmentId: z.string().min(1) }, { capability: "assignments.execute", scopes: ["treeseed:execution"], surfaces: ["rest", "cli", "mcp_tool"], risk: "authority" })
@@ -341,7 +341,7 @@ const CONTROL_PLANE_OPERATIONS = {
341
341
  resolveResources: resource("seeds.resources.resolve", "POST", "/v1/seeds/resources/resolve", {}, { capability: "seeds.read", scopes: ["treeseed:admin"] })
342
342
  },
343
343
  feedback: {
344
- create: resource("feedback.create", "POST", "/v1/feedback", {}, { capability: "feedback.write", authentication: "oauth", scopes: [], surfaces: ["rest", "mcp_tool"] }),
344
+ create: resource("feedback.create", "POST", "/v1/feedback", {}, { capability: "feedback.write", authentication: "oauth", scopes: [], surfaces: ["rest"] }),
345
345
  list: resource("feedback.list", "GET", "/v1/admin/feedback", {}, { capability: "feedback.admin", scopes: ["treeseed:admin"], pagination: "cursor" }),
346
346
  show: resource("feedback.show", "GET", "/v1/admin/feedback/{feedbackId}", { feedbackId: z.string().min(1) }, { capability: "feedback.admin", scopes: ["treeseed:admin"] }),
347
347
  updateStatus: resource("feedback.status.update", "PATCH", "/v1/admin/feedback/{feedbackId}/status", { feedbackId: z.string().min(1) }, { capability: "feedback.admin", scopes: ["treeseed:admin"], concurrency: true })
@@ -354,14 +354,14 @@ const CONTROL_PLANE_OPERATIONS = {
354
354
  actionResult: resource("realtime.actions.result", "POST", "/v1/client-sessions/{sessionId}/actions/{actionId}/result", { sessionId: z.string().min(1), actionId: z.string().min(1) }, { capability: "realtime.write" })
355
355
  },
356
356
  treedx: {
357
- library: resource("treedx.library.show", "GET", "/v1/projects/{projectId}/treedx-library", { projectId: z.string().min(1) }, { capability: "treedx.read", surfaces: ["rest", "cli", "mcp_resource"] }),
357
+ library: resource("treedx.library.show", "GET", "/v1/projects/{projectId}/treedx-library", { projectId: z.string().min(1) }, { capability: "treedx.read", surfaces: ["rest", "cli"] }),
358
358
  bindLibrary: resource("treedx.library.bind", "POST", "/v1/projects/{projectId}/treedx-library", { projectId: z.string().min(1) }, { capability: "treedx.write", surfaces: ["rest", "cli"] }),
359
- serviceContract: treedxProxy("treedx.service.contract", null, "GET", "/v1/dx/projects/{projectId}/service-contract", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_resource"] }),
360
- health: treedxProxy("treedx.health.show", "getHealth", "GET", "/v1/dx/projects/{projectId}/health", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
361
- readiness: treedxProxy("treedx.readiness.show", "getReadiness", "GET", "/v1/dx/projects/{projectId}/readiness", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_resource"] }),
362
- version: treedxProxy("treedx.version.show", "getVersion", "GET", "/v1/dx/projects/{projectId}/version", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_resource"] }),
363
- capabilities: treedxProxy("treedx.capabilities.list", "listCapabilities", "GET", "/v1/dx/projects/{projectId}/capabilities", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
364
- effectiveScope: treedxProxy("treedx.scope.show", "getEffectiveScope", "GET", "/v1/dx/projects/{projectId}/effective-scope", { projectId: z.string().min(1) }, { surfaces: ["rest", "mcp_resource"] }),
359
+ serviceContract: treedxProxy("treedx.service.contract", null, "GET", "/v1/dx/projects/{projectId}/service-contract", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli"] }),
360
+ health: treedxProxy("treedx.health.show", "getHealth", "GET", "/v1/dx/projects/{projectId}/health", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli"] }),
361
+ readiness: treedxProxy("treedx.readiness.show", "getReadiness", "GET", "/v1/dx/projects/{projectId}/readiness", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli"] }),
362
+ version: treedxProxy("treedx.version.show", "getVersion", "GET", "/v1/dx/projects/{projectId}/version", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli"] }),
363
+ capabilities: treedxProxy("treedx.capabilities.list", "listCapabilities", "GET", "/v1/dx/projects/{projectId}/capabilities", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli"] }),
364
+ effectiveScope: treedxProxy("treedx.scope.show", "getEffectiveScope", "GET", "/v1/dx/projects/{projectId}/effective-scope", { projectId: z.string().min(1) }, { surfaces: ["rest"] }),
365
365
  repositories: {
366
366
  list: treedxProxy("treedx.repositories.list", "listRepositories", "GET", "/v1/dx/projects/{projectId}/repos", { projectId: z.string().min(1) }, { pagination: "cursor" }),
367
367
  create: treedxProxy("treedx.repositories.create", "createRepository", "POST", "/v1/dx/projects/{projectId}/repos", { projectId: z.string().min(1) }),
@@ -379,14 +379,14 @@ const CONTROL_PLANE_OPERATIONS = {
379
379
  query: treedxProxy("treedx.repositories.query", "queryRepository", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/query", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true })
380
380
  },
381
381
  workspaces: {
382
- list: treedxProxy("treedx.workspaces.list", null, "GET", "/v1/dx/projects/{projectId}/workspaces", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"], pagination: "cursor" }),
382
+ list: treedxProxy("treedx.workspaces.list", null, "GET", "/v1/dx/projects/{projectId}/workspaces", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli"], pagination: "cursor" }),
383
383
  create: treedxProxy("treedx.workspaces.create", "createWorkspace", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/workspaces", { projectId: z.string().min(1), repoId: z.string().min(1) }),
384
- show: treedxProxy("treedx.workspaces.show", "getWorkspace", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
384
+ show: treedxProxy("treedx.workspaces.show", "getWorkspace", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { surfaces: ["rest", "cli"] }),
385
385
  status: treedxProxy("treedx.workspaces.status", "getWorkspaceStatus", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/status", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
386
386
  diff: treedxProxy("treedx.workspaces.diff", "getWorkspaceDiff", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/diff", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
387
387
  tree: treedxProxy("treedx.workspaces.tree", "listWorkspaceTree", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/tree", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
388
388
  close: treedxProxy("treedx.workspaces.close", "closeWorkspace", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/close", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
389
- abandon: treedxProxy("treedx.workspaces.abandon", "abandonWorkspace", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/abandon", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { risk: "destructive", surfaces: ["rest", "cli", "mcp_tool"] })
389
+ abandon: treedxProxy("treedx.workspaces.abandon", "abandonWorkspace", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/abandon", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { risk: "destructive", surfaces: ["rest", "cli"] })
390
390
  },
391
391
  files: {
392
392
  read: treedxProxy("treedx.workspaces.files.read", "readWorkspaceFile", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/files", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
@@ -402,7 +402,7 @@ const CONTROL_PLANE_OPERATIONS = {
402
402
  read: treedxProxy("treedx.repositories.blobs.read", "readRepositoryBlob", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/blobs/read", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
403
403
  write: treedxProxy("treedx.workspaces.blobs.write", "writeWorkspaceBlob", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/write", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
404
404
  remove: treedxProxy("treedx.workspaces.blobs.delete", "deleteWorkspaceBlob", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/delete", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { risk: "destructive" }),
405
- download: treedxProxy("treedx.workspaces.blobs.download", "downloadWorkspaceBlob", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/download", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { surfaces: ["rest", "mcp_tool"] }),
405
+ download: treedxProxy("treedx.workspaces.blobs.download", "downloadWorkspaceBlob", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/download", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { surfaces: ["rest"] }),
406
406
  upload: treedxProxy("treedx.workspaces.blobs.upload", "uploadWorkspaceBlob", "PUT", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/upload", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
407
407
  createUpload: treedxProxy("treedx.workspaces.blobs.uploads.create", "createWorkspaceBlobUpload", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/uploads", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
408
408
  uploadPart: treedxProxy("treedx.workspaces.blobs.uploads.parts.write", "uploadWorkspaceBlobPart", "PUT", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/uploads/{uploadId}/parts/{partNumber}", { projectId: z.string().min(1), workspaceId: z.string().min(1), uploadId: z.string().min(1), partNumber: z.string().min(1) }),
@@ -48,7 +48,7 @@ const record = z.record(z.unknown());
48
48
  function defineTreeDxProxyOperation(operationId, upstreamOperationId, method, path, pathShape, options = {}) {
49
49
  const kind = options.read ?? method === "GET" ? "read" : "mutation";
50
50
  const riskClass = options.risk ?? "ordinary";
51
- const surfaces = options.surfaces ?? ["rest", "mcp_tool", ...method === "GET" ? ["mcp_resource"] : []];
51
+ const surfaces = options.surfaces ?? ["rest"];
52
52
  return defineOperation({
53
53
  operationId,
54
54
  description: `${kind === "read" ? "Read" : "Apply"} ${operationId} through the project-scoped TreeDX proxy.`,
@@ -181,7 +181,7 @@ export declare const workdayIntentSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<
181
181
  maxConcurrency?: number | undefined;
182
182
  } | undefined;
183
183
  }>, any, any>;
184
- export declare const workdayIntentRequestSchema: z.ZodEffects<z.ZodType<Record<string, unknown>, z.ZodTypeDef, Record<string, unknown>>, any, Record<string, unknown>>;
184
+ export declare const workdayIntentRequestSchema: z.ZodEffects<z.ZodType<Record<string, unknown>, z.ZodTypeDef, Record<string, unknown>>, Record<string, unknown>, Record<string, unknown>>;
185
185
  export type WorkdayDemandMode = 'planning' | 'acting';
186
186
  export interface WorkdayIntent {
187
187
  schemaVersion: 'treeseed.workday-intent/v1';
@@ -1,7 +1,7 @@
1
1
  import { workdayAllocationOverridesSchema } from "../agent-capacity/contracts/capacity/workdays/workday-allocation.js";
2
2
  import { z } from "zod";
3
3
  import { leaseSchema } from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
4
- import { alternativeProperties, conditionalFields, exclusiveProperties, exclusiveUnion, uniqueArray } from "../content/validation/schema-constraints.js";
4
+ import { alternativeProperties, conditionalFields, exclusiveProperties, exclusiveUnion, preserveInputOrder, uniqueArray } from "../content/validation/schema-constraints.js";
5
5
  import { normalizeWorkdayAgentSelection } from "../agent-capacity/workday.js";
6
6
  const identifier = leaseSchema.shape.id, timestamp = leaseSchema.shape.acquiredAt;
7
7
  const selectedIdentities = uniqueArray(z.array(identifier).min(1).max(64));
@@ -43,14 +43,10 @@ const requestIntentFields = z.preprocess((value) => {
43
43
  }, exclusiveProperties(conditionalFields(workdayIntentFields.partial({ schemaVersion: true, teamId: true }), continuationRules), ["endsAt", "durationSeconds"])).superRefine((intent, context) => {
44
44
  if (!validIntentRange(intent)) context.addIssue({ code: z.ZodIssueCode.custom, path: ["endsAt"], message: "endsAt must be after startsAt." });
45
45
  });
46
- const workdayIntentRequestSchema = z.custom((value) => Boolean(value && typeof value === "object" && !Array.isArray(value))).transform((intent, context) => {
47
- const parsed = requestIntentFields.safeParse(intent);
48
- if (!parsed.success) {
49
- for (const issue of parsed.error.issues) context.addIssue(issue);
50
- return z.NEVER;
51
- }
52
- return { ...intent, ...parsed.data, ...parsed.data.decisionIds ? { decisionIds: [...parsed.data.decisionIds].sort() } : {} };
53
- });
46
+ const workdayIntentRequestSchema = preserveInputOrder(requestIntentFields.transform((intent) => ({
47
+ ...intent,
48
+ ...intent.decisionIds ? { decisionIds: [...intent.decisionIds].sort() } : {}
49
+ })));
54
50
  function validIntentRange(intent) {
55
51
  return intent.endsAt === void 0 || Date.parse(intent.endsAt) > Date.parse(intent.startsAt);
56
52
  }