@treeseed/sdk 0.13.0-rc.18 → 0.13.0-rc.19

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.
Files changed (250) hide show
  1. package/README.md +19 -9
  2. package/dist/agent-capacity/artifacts.d.ts +17 -1
  3. package/dist/content/validation/agent-operational-content-schemas.d.ts +8 -8
  4. package/dist/content/validation/auxiliary-content-schemas.d.ts +12 -12
  5. package/dist/content/validation/content-model-schemas.d.ts +28 -28
  6. package/dist/content/validation/portable-content-data.d.ts +4 -4
  7. package/dist/operator-contracts/canonical-command-tree.js +16 -0
  8. package/dist/operator-contracts/control-plane-operation.d.ts +7 -0
  9. package/dist/operator-contracts/control-plane-operation.js +3 -0
  10. package/dist/operator-contracts/control-plane-operations.d.ts +280 -39
  11. package/dist/operator-contracts/control-plane-operations.js +89 -38
  12. package/dist/operator-contracts/operation-builder.d.ts +17 -0
  13. package/dist/operator-contracts/operation-builder.js +60 -0
  14. package/dist/treedx/client.d.ts +589 -0
  15. package/dist/treedx/client.js +39 -0
  16. package/dist/treedx/contract.d.ts +32 -0
  17. package/dist/treedx/contract.js +63 -0
  18. package/dist/treedx/index.d.ts +3 -0
  19. package/dist/treedx/index.js +2 -0
  20. package/dist/treedx/types.d.ts +8 -7
  21. package/dist/treedx/types.js +0 -7
  22. package/package.json +8 -10
  23. package/dist/treedx/accounts/auth.d.ts +0 -17
  24. package/dist/treedx/accounts/auth.js +0 -48
  25. package/dist/treedx/client/accounts/contracts/auth-mode.d.ts +0 -3
  26. package/dist/treedx/client/accounts/contracts/auth-mode.js +0 -6
  27. package/dist/treedx/client/build/creation/build-context.d.ts +0 -3
  28. package/dist/treedx/client/build/creation/build-context.js +0 -7
  29. package/dist/treedx/client/build/creation/build-snapshot.d.ts +0 -3
  30. package/dist/treedx/client/build/creation/build-snapshot.js +0 -8
  31. package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.d.ts +0 -3
  32. package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.js +0 -7
  33. package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.d.ts +0 -6
  34. package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.js +0 -10
  35. package/dist/treedx/client/methods.d.ts +0 -102
  36. package/dist/treedx/client/methods.js +0 -209
  37. package/dist/treedx/client/persistence/contracts/restore-storage.d.ts +0 -3
  38. package/dist/treedx/client/persistence/contracts/restore-storage.js +0 -6
  39. package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.d.ts +0 -3
  40. package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.js +0 -6
  41. package/dist/treedx/client/repositories/creation/register-repository.d.ts +0 -3
  42. package/dist/treedx/client/repositories/creation/register-repository.js +0 -7
  43. package/dist/treedx/client/repositories/queries/get-repository.d.ts +0 -3
  44. package/dist/treedx/client/repositories/queries/get-repository.js +0 -7
  45. package/dist/treedx/client/repositories/queries/list-repository-paths.d.ts +0 -3
  46. package/dist/treedx/client/repositories/queries/list-repository-paths.js +0 -7
  47. package/dist/treedx/client/repositories/queries/list-repository-refs.d.ts +0 -3
  48. package/dist/treedx/client/repositories/queries/list-repository-refs.js +0 -12
  49. package/dist/treedx/client/repositories/queries/query-repository.d.ts +0 -3
  50. package/dist/treedx/client/repositories/queries/query-repository.js +0 -7
  51. package/dist/treedx/client/repositories/queries/read-repository-file.d.ts +0 -3
  52. package/dist/treedx/client/repositories/queries/read-repository-file.js +0 -6
  53. package/dist/treedx/client/repositories/queries/read-repository-files.d.ts +0 -3
  54. package/dist/treedx/client/repositories/queries/read-repository-files.js +0 -7
  55. package/dist/treedx/client/repositories/queries/search-repository-files.d.ts +0 -3
  56. package/dist/treedx/client/repositories/queries/search-repository-files.js +0 -7
  57. package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.d.ts +0 -3
  58. package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.js +0 -9
  59. package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.d.ts +0 -3
  60. package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.js +0 -6
  61. package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.d.ts +0 -3
  62. package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.js +0 -7
  63. package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.d.ts +0 -5
  64. package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.js +0 -7
  65. package/dist/treedx/client/support/contracts/treedx/health/contracts/health.d.ts +0 -3
  66. package/dist/treedx/client/support/contracts/treedx/health/contracts/health.js +0 -6
  67. package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.d.ts +0 -3
  68. package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.js +0 -7
  69. package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.d.ts +0 -2
  70. package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.js +0 -19
  71. package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.d.ts +0 -3
  72. package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.js +0 -7
  73. package/dist/treedx/client/support/contracts/treedx/health/contracts/status.d.ts +0 -3
  74. package/dist/treedx/client/support/contracts/treedx/health/contracts/status.js +0 -6
  75. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.d.ts +0 -3
  76. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.js +0 -7
  77. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.d.ts +0 -3
  78. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.js +0 -6
  79. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.d.ts +0 -3
  80. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.js +0 -7
  81. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.d.ts +0 -6
  82. package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.js +0 -23
  83. package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.d.ts +0 -3
  84. package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.js +0 -8
  85. package/dist/treedx/client/support/contracts/treedx/search/contracts/search.d.ts +0 -3
  86. package/dist/treedx/client/support/contracts/treedx/search/contracts/search.js +0 -7
  87. package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.d.ts +0 -3
  88. package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.js +0 -8
  89. package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.d.ts +0 -3
  90. package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.js +0 -8
  91. package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.d.ts +0 -2
  92. package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.js +0 -15
  93. package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.d.ts +0 -2
  94. package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.js +0 -38
  95. package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.d.ts +0 -2
  96. package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.js +0 -15
  97. package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.d.ts +0 -2
  98. package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.js +0 -15
  99. package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.d.ts +0 -2
  100. package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.js +0 -14
  101. package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.d.ts +0 -2
  102. package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.js +0 -14
  103. package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.d.ts +0 -6
  104. package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.js +0 -41
  105. package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.d.ts +0 -2
  106. package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.js +0 -14
  107. package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.d.ts +0 -3
  108. package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.js +0 -7
  109. package/dist/treedx/client/support/creation/apply-changeset.d.ts +0 -3
  110. package/dist/treedx/client/support/creation/apply-changeset.js +0 -10
  111. package/dist/treedx/client/support/creation/apply-storage-migration.d.ts +0 -3
  112. package/dist/treedx/client/support/creation/apply-storage-migration.js +0 -7
  113. package/dist/treedx/client/support/creation/create-migration.d.ts +0 -6
  114. package/dist/treedx/client/support/creation/create-migration.js +0 -7
  115. package/dist/treedx/client/support/creation/export-artifact.d.ts +0 -3
  116. package/dist/treedx/client/support/creation/export-artifact.js +0 -8
  117. package/dist/treedx/client/support/creation/plan-storage-migration.d.ts +0 -3
  118. package/dist/treedx/client/support/creation/plan-storage-migration.js +0 -7
  119. package/dist/treedx/client/support/creation/request-binary.d.ts +0 -6
  120. package/dist/treedx/client/support/creation/request-binary.js +0 -42
  121. package/dist/treedx/client/support/creation/write-file.d.ts +0 -3
  122. package/dist/treedx/client/support/creation/write-file.js +0 -10
  123. package/dist/treedx/client/support/creation/write-files.d.ts +0 -3
  124. package/dist/treedx/client/support/creation/write-files.js +0 -12
  125. package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.d.ts +0 -3
  126. package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.js +0 -7
  127. package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.d.ts +0 -3
  128. package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.js +0 -7
  129. package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.d.ts +0 -3
  130. package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.js +0 -9
  131. package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.d.ts +0 -4
  132. package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.js +0 -6
  133. package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.d.ts +0 -3
  134. package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.js +0 -7
  135. package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.d.ts +0 -3
  136. package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.js +0 -7
  137. package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.d.ts +0 -3
  138. package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.js +0 -7
  139. package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.d.ts +0 -3
  140. package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.js +0 -7
  141. package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.d.ts +0 -3
  142. package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.js +0 -10
  143. package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.d.ts +0 -3
  144. package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.js +0 -9
  145. package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.d.ts +0 -3
  146. package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.js +0 -7
  147. package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.d.ts +0 -6
  148. package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.js +0 -7
  149. package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.d.ts +0 -6
  150. package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.js +0 -7
  151. package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.d.ts +0 -6
  152. package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.js +0 -6
  153. package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.d.ts +0 -15
  154. package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.js +0 -6
  155. package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.d.ts +0 -3
  156. package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.js +0 -7
  157. package/dist/treedx/client/support/retirement/cleanup-artifacts.d.ts +0 -3
  158. package/dist/treedx/client/support/retirement/cleanup-artifacts.js +0 -7
  159. package/dist/treedx/client/support/retirement/delete-artifact.d.ts +0 -3
  160. package/dist/treedx/client/support/retirement/delete-artifact.js +0 -7
  161. package/dist/treedx/client/support/retirement/delete-file.d.ts +0 -3
  162. package/dist/treedx/client/support/retirement/delete-file.js +0 -10
  163. package/dist/treedx/client/support/retirement/rollback-storage-migration.d.ts +0 -3
  164. package/dist/treedx/client/support/retirement/rollback-storage-migration.js +0 -7
  165. package/dist/treedx/client/support/updates/patch-file.d.ts +0 -3
  166. package/dist/treedx/client/support/updates/patch-file.js +0 -10
  167. package/dist/treedx/client/support/updates/refresh-search-index.d.ts +0 -3
  168. package/dist/treedx/client/support/updates/refresh-search-index.js +0 -8
  169. package/dist/treedx/client/treedx/blobs/contracts/download-blob.d.ts +0 -3
  170. package/dist/treedx/client/treedx/blobs/contracts/download-blob.js +0 -6
  171. package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.d.ts +0 -3
  172. package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.js +0 -8
  173. package/dist/treedx/client/treedx/blobs/creation/request-blob-download.d.ts +0 -3
  174. package/dist/treedx/client/treedx/blobs/creation/request-blob-download.js +0 -27
  175. package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.d.ts +0 -3
  176. package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.js +0 -41
  177. package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.d.ts +0 -3
  178. package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.js +0 -27
  179. package/dist/treedx/client/treedx/blobs/creation/upload-blob.d.ts +0 -3
  180. package/dist/treedx/client/treedx/blobs/creation/upload-blob.js +0 -6
  181. package/dist/treedx/client/treedx/blobs/creation/write-blob.d.ts +0 -3
  182. package/dist/treedx/client/treedx/blobs/creation/write-blob.js +0 -8
  183. package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.d.ts +0 -3
  184. package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.js +0 -8
  185. package/dist/treedx/client/treedx/blobs/queries/read-blob.d.ts +0 -3
  186. package/dist/treedx/client/treedx/blobs/queries/read-blob.js +0 -10
  187. package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.d.ts +0 -3
  188. package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.js +0 -7
  189. package/dist/treedx/client/treedx/blobs/retirement/delete-blob.d.ts +0 -3
  190. package/dist/treedx/client/treedx/blobs/retirement/delete-blob.js +0 -8
  191. package/dist/treedx/client/treedx/federation/contracts/federated-query.d.ts +0 -3
  192. package/dist/treedx/client/treedx/federation/contracts/federated-query.js +0 -7
  193. package/dist/treedx/client/treedx/federation/creation/plan-federated-query.d.ts +0 -3
  194. package/dist/treedx/client/treedx/federation/creation/plan-federated-query.js +0 -6
  195. package/dist/treedx/client/treedx/federation/queries/check-mirror-health.d.ts +0 -3
  196. package/dist/treedx/client/treedx/federation/queries/check-mirror-health.js +0 -7
  197. package/dist/treedx/client/treedx/federation/updates/promote-mirror.d.ts +0 -3
  198. package/dist/treedx/client/treedx/federation/updates/promote-mirror.js +0 -7
  199. package/dist/treedx/client/treedx/federation/updates/sync-mirror.d.ts +0 -3
  200. package/dist/treedx/client/treedx/federation/updates/sync-mirror.js +0 -7
  201. package/dist/treedx/client/treedx/graph/contracts/federated-context.d.ts +0 -3
  202. package/dist/treedx/client/treedx/graph/contracts/federated-context.js +0 -7
  203. package/dist/treedx/client/treedx/graph/contracts/federated-graph.d.ts +0 -3
  204. package/dist/treedx/client/treedx/graph/contracts/federated-graph.js +0 -7
  205. package/dist/treedx/client/treedx/graph/contracts/graph-search.d.ts +0 -3
  206. package/dist/treedx/client/treedx/graph/contracts/graph-search.js +0 -8
  207. package/dist/treedx/client/treedx/graph/queries/get-graph-node.d.ts +0 -3
  208. package/dist/treedx/client/treedx/graph/queries/get-graph-node.js +0 -10
  209. package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.d.ts +0 -3
  210. package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.js +0 -7
  211. package/dist/treedx/client/treedx/graph/queries/get-subgraph.d.ts +0 -3
  212. package/dist/treedx/client/treedx/graph/queries/get-subgraph.js +0 -7
  213. package/dist/treedx/client/treedx/graph/queries/query-graph.d.ts +0 -3
  214. package/dist/treedx/client/treedx/graph/queries/query-graph.js +0 -7
  215. package/dist/treedx/client/treedx/graph/queries/search-graph-entities.d.ts +0 -3
  216. package/dist/treedx/client/treedx/graph/queries/search-graph-entities.js +0 -6
  217. package/dist/treedx/client/treedx/graph/queries/search-graph-files.d.ts +0 -3
  218. package/dist/treedx/client/treedx/graph/queries/search-graph-files.js +0 -6
  219. package/dist/treedx/client/treedx/graph/queries/search-graph-sections.d.ts +0 -3
  220. package/dist/treedx/client/treedx/graph/queries/search-graph-sections.js +0 -6
  221. package/dist/treedx/client/treedx/graph/updates/refresh-graph.d.ts +0 -3
  222. package/dist/treedx/client/treedx/graph/updates/refresh-graph.js +0 -7
  223. package/dist/treedx/client/treedx/search/contracts/federated-search.d.ts +0 -3
  224. package/dist/treedx/client/treedx/search/contracts/federated-search.js +0 -7
  225. package/dist/treedx/client/treedx/workspaces/creation/create-workspace.d.ts +0 -3
  226. package/dist/treedx/client/treedx/workspaces/creation/create-workspace.js +0 -7
  227. package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.d.ts +0 -3
  228. package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.js +0 -12
  229. package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.d.ts +0 -2
  230. package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.js +0 -6
  231. package/dist/treedx/generated/openapi-types.d.ts +0 -3662
  232. package/dist/treedx/generated/openapi-types.js +0 -0
  233. package/dist/treedx/support/client.d.ts +0 -251
  234. package/dist/treedx/support/client.js +0 -252
  235. package/dist/treedx/support/errors.d.ts +0 -13
  236. package/dist/treedx/support/errors.js +0 -17
  237. package/dist/treedx/types/tree-dx-actor.d.ts +0 -209
  238. package/dist/treedx/types/tree-dx-actor.js +0 -8
  239. package/dist/treedx/types/tree-dx-artifact-list-response.d.ts +0 -13
  240. package/dist/treedx/types/tree-dx-artifact-list-response.js +0 -0
  241. package/dist/treedx/types/tree-dx-changeset.d.ts +0 -51
  242. package/dist/treedx/types/tree-dx-changeset.js +0 -6
  243. package/dist/treedx/types/tree-dx-context-request.d.ts +0 -245
  244. package/dist/treedx/types/tree-dx-context-request.js +0 -0
  245. package/dist/treedx/types/tree-dx-exec-result.d.ts +0 -249
  246. package/dist/treedx/types/tree-dx-exec-result.js +0 -0
  247. package/dist/treedx/types/tree-dx-list-tree-request.d.ts +0 -222
  248. package/dist/treedx/types/tree-dx-list-tree-request.js +0 -0
  249. package/dist/treedx/types/tree-dx-push-request.d.ts +0 -229
  250. package/dist/treedx/types/tree-dx-push-request.js +0 -0
@@ -52,6 +52,9 @@ function validateControlPlaneCatalog(catalog) {
52
52
  }
53
53
  for (const duplicate of duplicates(operation.surfaces)) diagnostics.push({ code: "surface_duplicate", path: `${path}.surfaces`, message: `Duplicate operation surface ${duplicate}.` });
54
54
  for (const duplicate of duplicates(operation.oauthScopes)) diagnostics.push({ code: "oauth_scope_duplicate", path: `${path}.oauthScopes`, message: `Duplicate OAuth scope ${duplicate}.` });
55
+ if (operation.upstream && (!operation.upstream.operationId || !/^sha256:[0-9a-f]{64}$/u.test(operation.upstream.contractDigest))) {
56
+ diagnostics.push({ code: "upstream_binding_invalid", path: `${path}.upstream`, message: "Upstream bindings require an operation ID and exact SHA-256 contract digest." });
57
+ }
55
58
  const elevatedRisk = operation.riskClass !== "ordinary";
56
59
  if (elevatedRisk !== (operation.confirmation === "input_required")) {
57
60
  diagnostics.push({ code: "confirmation_policy_invalid", path: `${path}.confirmation`, message: "Elevated-risk operations require input_required; ordinary operations must not." });
@@ -598,45 +598,286 @@ export declare const CONTROL_PLANE_OPERATIONS: {
598
598
  readonly bindLibrary: ControlPlaneOperationBinding<{
599
599
  projectId: string;
600
600
  }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
601
- readonly createRepository: ControlPlaneOperationBinding<{
602
- projectId: string;
603
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
604
- readonly createWorkspace: ControlPlaneOperationBinding<{
605
- projectId: string;
606
- repoId: string;
607
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
608
- readonly readWorkspaceFile: ControlPlaneOperationBinding<{
609
- projectId: string;
610
- workspaceId: string;
611
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
612
- readonly applyChangeset: ControlPlaneOperationBinding<{
613
- projectId: string;
614
- workspaceId: string;
615
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
616
- readonly searchWorkspace: ControlPlaneOperationBinding<{
617
- projectId: string;
618
- workspaceId: string;
619
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
620
- readonly commitWorkspace: ControlPlaneOperationBinding<{
621
- projectId: string;
622
- workspaceId: string;
623
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
624
- readonly closeWorkspace: ControlPlaneOperationBinding<{
625
- projectId: string;
626
- workspaceId: string;
627
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
628
- readonly readRepositoryFiles: ControlPlaneOperationBinding<{
629
- projectId: string;
630
- repoId: string;
631
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
632
- readonly listRepositoryPaths: ControlPlaneOperationBinding<{
633
- projectId: string;
634
- repoId: string;
635
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
636
- readonly buildRepositoryContext: ControlPlaneOperationBinding<{
637
- projectId: string;
638
- repoId: string;
639
- }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
601
+ readonly serviceContract: ControlPlaneOperationBinding<{
602
+ projectId: string;
603
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
604
+ readonly health: ControlPlaneOperationBinding<{
605
+ projectId: string;
606
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
607
+ readonly readiness: ControlPlaneOperationBinding<{
608
+ projectId: string;
609
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
610
+ readonly version: ControlPlaneOperationBinding<{
611
+ projectId: string;
612
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
613
+ readonly capabilities: ControlPlaneOperationBinding<{
614
+ projectId: string;
615
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
616
+ readonly effectiveScope: ControlPlaneOperationBinding<{
617
+ projectId: string;
618
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
619
+ readonly repositories: {
620
+ readonly list: ControlPlaneOperationBinding<{
621
+ projectId: string;
622
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
623
+ readonly create: ControlPlaneOperationBinding<{
624
+ projectId: string;
625
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
626
+ readonly show: ControlPlaneOperationBinding<{
627
+ projectId: string;
628
+ repoId: string;
629
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
630
+ readonly status: ControlPlaneOperationBinding<{
631
+ projectId: string;
632
+ repoId: string;
633
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
634
+ readonly refs: ControlPlaneOperationBinding<{
635
+ projectId: string;
636
+ repoId: string;
637
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
638
+ readonly sync: ControlPlaneOperationBinding<{
639
+ projectId: string;
640
+ repoId: string;
641
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
642
+ readonly push: ControlPlaneOperationBinding<{
643
+ projectId: string;
644
+ repoId: string;
645
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
646
+ readonly promoteRef: ControlPlaneOperationBinding<{
647
+ projectId: string;
648
+ repoId: string;
649
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
650
+ readonly retireRef: ControlPlaneOperationBinding<{
651
+ projectId: string;
652
+ repoId: string;
653
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
654
+ readonly readFiles: ControlPlaneOperationBinding<{
655
+ projectId: string;
656
+ repoId: string;
657
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
658
+ readonly listPaths: ControlPlaneOperationBinding<{
659
+ projectId: string;
660
+ repoId: string;
661
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
662
+ readonly searchFiles: ControlPlaneOperationBinding<{
663
+ projectId: string;
664
+ repoId: string;
665
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
666
+ readonly query: ControlPlaneOperationBinding<{
667
+ projectId: string;
668
+ repoId: string;
669
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
670
+ };
671
+ readonly workspaces: {
672
+ readonly list: ControlPlaneOperationBinding<{
673
+ projectId: string;
674
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
675
+ readonly create: ControlPlaneOperationBinding<{
676
+ projectId: string;
677
+ repoId: string;
678
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
679
+ readonly show: ControlPlaneOperationBinding<{
680
+ projectId: string;
681
+ workspaceId: string;
682
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
683
+ readonly status: ControlPlaneOperationBinding<{
684
+ projectId: string;
685
+ workspaceId: string;
686
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
687
+ readonly diff: ControlPlaneOperationBinding<{
688
+ projectId: string;
689
+ workspaceId: string;
690
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
691
+ readonly tree: ControlPlaneOperationBinding<{
692
+ projectId: string;
693
+ workspaceId: string;
694
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
695
+ readonly close: ControlPlaneOperationBinding<{
696
+ projectId: string;
697
+ workspaceId: string;
698
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
699
+ readonly abandon: ControlPlaneOperationBinding<{
700
+ projectId: string;
701
+ workspaceId: string;
702
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
703
+ };
704
+ readonly files: {
705
+ readonly read: ControlPlaneOperationBinding<{
706
+ projectId: string;
707
+ workspaceId: string;
708
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
709
+ readonly write: ControlPlaneOperationBinding<{
710
+ projectId: string;
711
+ workspaceId: string;
712
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
713
+ readonly writeBatch: ControlPlaneOperationBinding<{
714
+ projectId: string;
715
+ workspaceId: string;
716
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
717
+ readonly patch: ControlPlaneOperationBinding<{
718
+ projectId: string;
719
+ workspaceId: string;
720
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
721
+ readonly remove: ControlPlaneOperationBinding<{
722
+ projectId: string;
723
+ workspaceId: string;
724
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
725
+ readonly search: ControlPlaneOperationBinding<{
726
+ projectId: string;
727
+ workspaceId: string;
728
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
729
+ readonly applyChangeset: ControlPlaneOperationBinding<{
730
+ projectId: string;
731
+ workspaceId: string;
732
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
733
+ readonly commit: ControlPlaneOperationBinding<{
734
+ projectId: string;
735
+ workspaceId: string;
736
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
737
+ };
738
+ readonly blobs: {
739
+ readonly read: ControlPlaneOperationBinding<{
740
+ projectId: string;
741
+ repoId: string;
742
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
743
+ readonly write: ControlPlaneOperationBinding<{
744
+ projectId: string;
745
+ workspaceId: string;
746
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
747
+ readonly remove: ControlPlaneOperationBinding<{
748
+ projectId: string;
749
+ workspaceId: string;
750
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
751
+ readonly download: ControlPlaneOperationBinding<{
752
+ projectId: string;
753
+ workspaceId: string;
754
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
755
+ readonly upload: ControlPlaneOperationBinding<{
756
+ projectId: string;
757
+ workspaceId: string;
758
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
759
+ readonly createUpload: ControlPlaneOperationBinding<{
760
+ projectId: string;
761
+ workspaceId: string;
762
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
763
+ readonly uploadPart: ControlPlaneOperationBinding<{
764
+ projectId: string;
765
+ workspaceId: string;
766
+ uploadId: string;
767
+ partNumber: string;
768
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
769
+ readonly completeUpload: ControlPlaneOperationBinding<{
770
+ projectId: string;
771
+ workspaceId: string;
772
+ uploadId: string;
773
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
774
+ readonly abortUpload: ControlPlaneOperationBinding<{
775
+ projectId: string;
776
+ workspaceId: string;
777
+ uploadId: string;
778
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
779
+ };
780
+ readonly graph: {
781
+ readonly refresh: ControlPlaneOperationBinding<{
782
+ projectId: string;
783
+ repoId: string;
784
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
785
+ readonly refreshJob: ControlPlaneOperationBinding<{
786
+ projectId: string;
787
+ repoId: string;
788
+ jobId: string;
789
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
790
+ readonly query: ControlPlaneOperationBinding<{
791
+ projectId: string;
792
+ repoId: string;
793
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
794
+ readonly node: ControlPlaneOperationBinding<{
795
+ projectId: string;
796
+ repoId: string;
797
+ nodeId: string;
798
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
799
+ readonly related: ControlPlaneOperationBinding<{
800
+ projectId: string;
801
+ repoId: string;
802
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
803
+ readonly subgraph: ControlPlaneOperationBinding<{
804
+ projectId: string;
805
+ repoId: string;
806
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
807
+ readonly searchFiles: ControlPlaneOperationBinding<{
808
+ projectId: string;
809
+ repoId: string;
810
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
811
+ readonly searchSections: ControlPlaneOperationBinding<{
812
+ projectId: string;
813
+ repoId: string;
814
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
815
+ readonly searchEntities: ControlPlaneOperationBinding<{
816
+ projectId: string;
817
+ repoId: string;
818
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
819
+ };
820
+ readonly context: {
821
+ readonly build: ControlPlaneOperationBinding<{
822
+ projectId: string;
823
+ repoId: string;
824
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
825
+ readonly parse: ControlPlaneOperationBinding<{
826
+ projectId: string;
827
+ repoId: string;
828
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
829
+ };
830
+ readonly federated: {
831
+ readonly search: ControlPlaneOperationBinding<{
832
+ projectId: string;
833
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
834
+ readonly query: ControlPlaneOperationBinding<{
835
+ projectId: string;
836
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
837
+ readonly context: ControlPlaneOperationBinding<{
838
+ projectId: string;
839
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
840
+ readonly graph: ControlPlaneOperationBinding<{
841
+ projectId: string;
842
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
843
+ };
844
+ readonly snapshots: {
845
+ readonly build: ControlPlaneOperationBinding<{
846
+ projectId: string;
847
+ repoId: string;
848
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
849
+ readonly show: ControlPlaneOperationBinding<{
850
+ projectId: string;
851
+ repoId: string;
852
+ snapshotId: string;
853
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
854
+ };
855
+ readonly artifacts: {
856
+ readonly export: ControlPlaneOperationBinding<{
857
+ projectId: string;
858
+ repoId: string;
859
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
860
+ readonly list: ControlPlaneOperationBinding<{
861
+ projectId: string;
862
+ repoId: string;
863
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
864
+ readonly show: ControlPlaneOperationBinding<{
865
+ projectId: string;
866
+ artifactId: string;
867
+ repoId: string;
868
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
869
+ readonly remove: ControlPlaneOperationBinding<{
870
+ projectId: string;
871
+ artifactId: string;
872
+ repoId: string;
873
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
874
+ };
875
+ readonly searchIndex: {
876
+ readonly status: ControlPlaneOperationBinding<{
877
+ projectId: string;
878
+ repoId: string;
879
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
880
+ };
640
881
  };
641
882
  readonly providers: {
642
883
  readonly register: ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
@@ -1,34 +1,9 @@
1
1
  import { z } from "zod";
2
- import {
3
- CONTROL_PLANE_OPERATION_SCHEMA_VERSION
4
- } from "./control-plane-operation.js";
2
+ import { defineOperation as define, defineTreeDxProxyOperation as treedxProxy } from "./operation-builder.js";
5
3
  const empty = z.object({}).strict();
6
4
  const none = z.undefined();
7
5
  const record = z.record(z.unknown());
8
6
  const payload = record;
9
- function define(definition, schema) {
10
- const { parameters, redactedPaths = [], idempotencyRequired, concurrencyRequired, ...descriptor } = definition;
11
- const mutation = definition.kind === "mutation";
12
- return {
13
- descriptor: {
14
- ...descriptor,
15
- authentication: definition.authentication ?? (definition.oauthScopes.length ? "oauth" : "anonymous"),
16
- schemaVersion: CONTROL_PLANE_OPERATION_SCHEMA_VERSION,
17
- schemas: {
18
- input: `treeseed.${definition.operationId}.input/v1`,
19
- output: `treeseed.${definition.operationId}.output/v1`,
20
- errors: "treeseed.problem/v1",
21
- ...parameters ? { parameters } : {}
22
- },
23
- idempotency: { required: idempotencyRequired ?? mutation, header: "Idempotency-Key" },
24
- concurrency: { required: concurrencyRequired ?? false, readHeader: "ETag", writeHeader: "If-Match" },
25
- audited: definition.surfaces.some((surface) => surface !== "internal"),
26
- receipt: mutation,
27
- redactedPaths
28
- },
29
- schema
30
- };
31
- }
32
7
  function read(operationId, path, capability, surfaces = ["rest"]) {
33
8
  return define({
34
9
  operationId,
@@ -353,18 +328,94 @@ const CONTROL_PLANE_OPERATIONS = {
353
328
  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" })
354
329
  },
355
330
  treedx: {
356
- library: resource("treedx.library.show", "GET", "/v1/projects/{projectId}/treedx-library", { projectId: z.string().min(1) }, { capability: "treedx.read" }),
357
- bindLibrary: resource("treedx.library.bind", "POST", "/v1/projects/{projectId}/treedx-library", { projectId: z.string().min(1) }, { capability: "treedx.write" }),
358
- createRepository: resource("treedx.repositories.create", "POST", "/v1/dx/projects/{projectId}/repos", { projectId: z.string().min(1) }, { capability: "treedx.write", authentication: "oauth_or_provider" }),
359
- createWorkspace: resource("treedx.workspaces.create", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/workspaces", { projectId: z.string().min(1), repoId: z.string().min(1) }, { capability: "treedx.write", authentication: "oauth_or_provider" }),
360
- readWorkspaceFile: resource("treedx.workspaces.files.read", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/files", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { capability: "treedx.read", authentication: "oauth_or_provider" }),
361
- applyChangeset: resource("treedx.workspaces.changesets.apply", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/changesets", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { capability: "treedx.write", authentication: "oauth_or_provider" }),
362
- searchWorkspace: resource("treedx.workspaces.search", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/search", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { capability: "treedx.read", authentication: "oauth_or_provider", scopes: ["treeseed:read"] }),
363
- commitWorkspace: resource("treedx.workspaces.commit", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/commit", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { capability: "treedx.write", authentication: "oauth_or_provider" }),
364
- closeWorkspace: resource("treedx.workspaces.close", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/close", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { capability: "treedx.write", authentication: "oauth_or_provider" }),
365
- readRepositoryFiles: resource("treedx.repositories.files.read", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/files/read", { projectId: z.string().min(1), repoId: z.string().min(1) }, { capability: "treedx.read", authentication: "oauth_or_provider", scopes: ["treeseed:read"] }),
366
- listRepositoryPaths: resource("treedx.repositories.paths.list", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/paths/list", { projectId: z.string().min(1), repoId: z.string().min(1) }, { capability: "treedx.read", authentication: "oauth_or_provider", scopes: ["treeseed:read"] }),
367
- buildRepositoryContext: resource("treedx.repositories.context.build", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/context/build", { projectId: z.string().min(1), repoId: z.string().min(1) }, { capability: "treedx.read", authentication: "oauth_or_provider", scopes: ["treeseed:read"] })
331
+ library: resource("treedx.library.show", "GET", "/v1/projects/{projectId}/treedx-library", { projectId: z.string().min(1) }, { capability: "treedx.read", surfaces: ["rest", "cli", "mcp_resource"] }),
332
+ bindLibrary: resource("treedx.library.bind", "POST", "/v1/projects/{projectId}/treedx-library", { projectId: z.string().min(1) }, { capability: "treedx.write", surfaces: ["rest", "cli"] }),
333
+ serviceContract: treedxProxy("treedx.service.contract", null, "GET", "/v1/dx/projects/{projectId}/service-contract", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_resource"] }),
334
+ health: treedxProxy("treedx.health.show", "getHealth", "GET", "/v1/dx/projects/{projectId}/health", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
335
+ readiness: treedxProxy("treedx.readiness.show", "getReadiness", "GET", "/v1/dx/projects/{projectId}/readiness", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_resource"] }),
336
+ version: treedxProxy("treedx.version.show", "getVersion", "GET", "/v1/dx/projects/{projectId}/version", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_resource"] }),
337
+ capabilities: treedxProxy("treedx.capabilities.list", "listCapabilities", "GET", "/v1/dx/projects/{projectId}/capabilities", { projectId: z.string().min(1) }, { surfaces: ["rest", "cli", "mcp_tool", "mcp_resource"] }),
338
+ effectiveScope: treedxProxy("treedx.scope.show", "getEffectiveScope", "GET", "/v1/dx/projects/{projectId}/effective-scope", { projectId: z.string().min(1) }, { surfaces: ["rest", "mcp_resource"] }),
339
+ repositories: {
340
+ list: treedxProxy("treedx.repositories.list", "listRepositories", "GET", "/v1/dx/projects/{projectId}/repos", { projectId: z.string().min(1) }, { pagination: "cursor" }),
341
+ create: treedxProxy("treedx.repositories.create", "createRepository", "POST", "/v1/dx/projects/{projectId}/repos", { projectId: z.string().min(1) }),
342
+ show: treedxProxy("treedx.repositories.show", "getRepository", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}", { projectId: z.string().min(1), repoId: z.string().min(1) }),
343
+ status: treedxProxy("treedx.repositories.status", "getRepositoryStatus", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/status", { projectId: z.string().min(1), repoId: z.string().min(1) }),
344
+ refs: treedxProxy("treedx.repositories.refs", "listRepositoryRefs", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/refs", { projectId: z.string().min(1), repoId: z.string().min(1) }),
345
+ sync: treedxProxy("treedx.repositories.sync", "syncRepository", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/sync", { projectId: z.string().min(1), repoId: z.string().min(1) }),
346
+ push: treedxProxy("treedx.repositories.push", "pushRepository", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/push", { projectId: z.string().min(1), repoId: z.string().min(1) }, { risk: "authority" }),
347
+ promoteRef: treedxProxy("treedx.repositories.refs.promote", "promoteRepositoryRef", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/refs/promote", { projectId: z.string().min(1), repoId: z.string().min(1) }, { risk: "authority" }),
348
+ retireRef: treedxProxy("treedx.repositories.refs.retire", "retireRepositoryRef", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/refs/retire", { projectId: z.string().min(1), repoId: z.string().min(1) }, { risk: "destructive" }),
349
+ readFiles: treedxProxy("treedx.repositories.files.read", "readRepositoryFile", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/files/read", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
350
+ listPaths: treedxProxy("treedx.repositories.paths.list", "listRepositoryPaths", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/paths/list", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true, pagination: "cursor" }),
351
+ searchFiles: treedxProxy("treedx.repositories.files.search", "searchRepositoryFiles", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/files/search", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true, pagination: "cursor" }),
352
+ 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 })
353
+ },
354
+ workspaces: {
355
+ 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" }),
356
+ create: treedxProxy("treedx.workspaces.create", "createWorkspace", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/workspaces", { projectId: z.string().min(1), repoId: z.string().min(1) }),
357
+ 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"] }),
358
+ status: treedxProxy("treedx.workspaces.status", "getWorkspaceStatus", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/status", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
359
+ diff: treedxProxy("treedx.workspaces.diff", "getWorkspaceDiff", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/diff", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
360
+ tree: treedxProxy("treedx.workspaces.tree", "listWorkspaceTree", "GET", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/tree", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
361
+ close: treedxProxy("treedx.workspaces.close", "closeWorkspace", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/close", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
362
+ 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"] })
363
+ },
364
+ files: {
365
+ 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) }),
366
+ write: treedxProxy("treedx.workspaces.files.write", "writeWorkspaceFile", "PUT", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/files", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
367
+ writeBatch: treedxProxy("treedx.workspaces.files.batch", "writeWorkspaceFiles", "PUT", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/files/batch", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
368
+ patch: treedxProxy("treedx.workspaces.files.patch", "patchWorkspaceFile", "PATCH", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/files", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
369
+ remove: treedxProxy("treedx.workspaces.files.delete", "deleteWorkspaceFile", "DELETE", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/files", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { risk: "destructive" }),
370
+ search: treedxProxy("treedx.workspaces.files.search", "searchWorkspace", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/search", { projectId: z.string().min(1), workspaceId: z.string().min(1) }, { read: true, pagination: "cursor" }),
371
+ applyChangeset: treedxProxy("treedx.workspaces.changesets.apply", "applyWorkspaceChangeset", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/changesets", { projectId: z.string().min(1), workspaceId: z.string().min(1) }),
372
+ commit: treedxProxy("treedx.workspaces.commit", "commitWorkspace", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/commit", { projectId: z.string().min(1), workspaceId: z.string().min(1) })
373
+ },
374
+ blobs: {
375
+ 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 }),
376
+ 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) }),
377
+ 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" }),
378
+ 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"] }),
379
+ 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) }),
380
+ 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) }),
381
+ 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) }),
382
+ completeUpload: treedxProxy("treedx.workspaces.blobs.uploads.complete", "completeWorkspaceBlobUpload", "POST", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/uploads/{uploadId}/complete", { projectId: z.string().min(1), workspaceId: z.string().min(1), uploadId: z.string().min(1) }),
383
+ abortUpload: treedxProxy("treedx.workspaces.blobs.uploads.abort", "abortWorkspaceBlobUpload", "DELETE", "/v1/dx/projects/{projectId}/workspaces/{workspaceId}/blobs/uploads/{uploadId}", { projectId: z.string().min(1), workspaceId: z.string().min(1), uploadId: z.string().min(1) }, { risk: "destructive" })
384
+ },
385
+ graph: {
386
+ refresh: treedxProxy("treedx.repositories.graph.refresh", "refreshRepositoryGraph", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/refresh", { projectId: z.string().min(1), repoId: z.string().min(1) }),
387
+ refreshJob: treedxProxy("treedx.repositories.graph.jobs.show", "getGraphRefreshJob", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/jobs/{jobId}", { projectId: z.string().min(1), repoId: z.string().min(1), jobId: z.string().min(1) }),
388
+ query: treedxProxy("treedx.repositories.graph.query", "queryRepositoryGraph", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/query", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
389
+ node: treedxProxy("treedx.repositories.graph.nodes.show", "getGraphNode", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/nodes/{nodeId}", { projectId: z.string().min(1), repoId: z.string().min(1), nodeId: z.string().min(1) }),
390
+ related: treedxProxy("treedx.repositories.graph.related", "getRelatedGraphNodes", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/related", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
391
+ subgraph: treedxProxy("treedx.repositories.graph.subgraph", "getGraphSubgraph", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/subgraph", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
392
+ searchFiles: treedxProxy("treedx.repositories.graph.files.search", "searchGraphFiles", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/search/files", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
393
+ searchSections: treedxProxy("treedx.repositories.graph.sections.search", "searchGraphSections", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/search/sections", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
394
+ searchEntities: treedxProxy("treedx.repositories.graph.entities.search", "searchGraphEntities", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/graph/search/entities", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true })
395
+ },
396
+ context: {
397
+ build: treedxProxy("treedx.repositories.context.build", "buildContext", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/context/build", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true }),
398
+ parse: treedxProxy("treedx.repositories.context.parse", "parseContextQuery", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/context/parse", { projectId: z.string().min(1), repoId: z.string().min(1) }, { read: true })
399
+ },
400
+ federated: {
401
+ search: treedxProxy("treedx.federated.search", "federatedSearch", "POST", "/v1/dx/projects/{projectId}/search", { projectId: z.string().min(1) }, { read: true, pagination: "cursor" }),
402
+ query: treedxProxy("treedx.federated.query", "federatedQuery", "POST", "/v1/dx/projects/{projectId}/query", { projectId: z.string().min(1) }, { read: true }),
403
+ context: treedxProxy("treedx.federated.context", "federatedContextBuild", "POST", "/v1/dx/projects/{projectId}/context", { projectId: z.string().min(1) }, { read: true }),
404
+ graph: treedxProxy("treedx.federated.graph", "federatedGraphQuery", "POST", "/v1/dx/projects/{projectId}/graph", { projectId: z.string().min(1) }, { read: true })
405
+ },
406
+ snapshots: {
407
+ build: treedxProxy("treedx.repositories.snapshots.build", "buildSnapshot", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/snapshots", { projectId: z.string().min(1), repoId: z.string().min(1) }),
408
+ show: treedxProxy("treedx.repositories.snapshots.show", "getSnapshot", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/snapshots/{snapshotId}", { projectId: z.string().min(1), repoId: z.string().min(1), snapshotId: z.string().min(1) })
409
+ },
410
+ artifacts: {
411
+ export: treedxProxy("treedx.repositories.artifacts.export", "exportArtifact", "POST", "/v1/dx/projects/{projectId}/repos/{repoId}/artifacts", { projectId: z.string().min(1), repoId: z.string().min(1) }),
412
+ list: treedxProxy("treedx.repositories.artifacts.list", "listArtifacts", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/artifacts", { projectId: z.string().min(1), repoId: z.string().min(1) }, { pagination: "cursor" }),
413
+ show: treedxProxy("treedx.repositories.artifacts.show", "getArtifact", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/artifacts/{artifactId}", { projectId: z.string().min(1), repoId: z.string().min(1), artifactId: z.string().min(1) }),
414
+ remove: treedxProxy("treedx.repositories.artifacts.delete", "deleteArtifact", "DELETE", "/v1/dx/projects/{projectId}/repos/{repoId}/artifacts/{artifactId}", { projectId: z.string().min(1), repoId: z.string().min(1), artifactId: z.string().min(1) }, { risk: "destructive" })
415
+ },
416
+ searchIndex: {
417
+ status: treedxProxy("treedx.repositories.search.index.status", "getSearchIndexStatus", "GET", "/v1/dx/projects/{projectId}/repos/{repoId}/search-index", { projectId: z.string().min(1), repoId: z.string().min(1) })
418
+ }
368
419
  },
369
420
  providers: {
370
421
  register: noPathProvider("providers.register", "POST", "/v1/provider-registrations", { redactedPaths: ["body.registrationKey"] }),
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { type ControlPlaneOperationBinding, type ControlPlaneOperationDescriptor } from './control-plane-operation.js';
3
+ type Definition = Omit<ControlPlaneOperationDescriptor, 'schemaVersion' | 'schemas' | 'idempotency' | 'concurrency' | 'audited' | 'receipt' | 'redactedPaths' | 'authentication'> & {
4
+ parameters?: string;
5
+ redactedPaths?: string[];
6
+ idempotencyRequired?: boolean;
7
+ concurrencyRequired?: boolean;
8
+ authentication?: ControlPlaneOperationDescriptor['authentication'];
9
+ };
10
+ export declare function defineOperation<TPath, TQuery, TBody, TOutput>(definition: Definition, schema: ControlPlaneOperationBinding<TPath, TQuery, TBody, TOutput>['schema']): ControlPlaneOperationBinding<TPath, TQuery, TBody, TOutput>;
11
+ export declare function defineTreeDxProxyOperation<T extends z.ZodRawShape>(operationId: `${string}.${string}`, upstreamOperationId: string | null, method: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT', path: `/v1/${string}`, pathShape: T, options?: {
12
+ read?: boolean;
13
+ risk?: ControlPlaneOperationDescriptor['riskClass'];
14
+ surfaces?: ControlPlaneOperationDescriptor['surfaces'];
15
+ pagination?: ControlPlaneOperationDescriptor['pagination'];
16
+ }): ControlPlaneOperationBinding<z.objectUtil.addQuestionMarks<z.baseObjectOutputType<T>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
17
+ export {};
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ import { TREEDX_OPENAPI_CONTRACT } from "@treeseed/treedx/openapi";
3
+ import {
4
+ CONTROL_PLANE_OPERATION_SCHEMA_VERSION
5
+ } from "./control-plane-operation.js";
6
+ function defineOperation(definition, schema) {
7
+ const { parameters, redactedPaths = [], idempotencyRequired, concurrencyRequired, ...descriptor } = definition;
8
+ const mutation = definition.kind === "mutation";
9
+ return {
10
+ descriptor: {
11
+ ...descriptor,
12
+ authentication: definition.authentication ?? (definition.oauthScopes.length ? "oauth" : "anonymous"),
13
+ schemaVersion: CONTROL_PLANE_OPERATION_SCHEMA_VERSION,
14
+ schemas: {
15
+ input: `treeseed.${definition.operationId}.input/v1`,
16
+ output: `treeseed.${definition.operationId}.output/v1`,
17
+ errors: "treeseed.problem/v1",
18
+ ...parameters ? { parameters } : {}
19
+ },
20
+ idempotency: { required: idempotencyRequired ?? mutation, header: "Idempotency-Key" },
21
+ concurrency: { required: concurrencyRequired ?? false, readHeader: "ETag", writeHeader: "If-Match" },
22
+ audited: definition.surfaces.some((surface) => surface !== "internal"),
23
+ receipt: mutation,
24
+ redactedPaths
25
+ },
26
+ schema
27
+ };
28
+ }
29
+ const empty = z.object({}).strict();
30
+ const none = z.undefined();
31
+ const record = z.record(z.unknown());
32
+ function defineTreeDxProxyOperation(operationId, upstreamOperationId, method, path, pathShape, options = {}) {
33
+ const kind = options.read ?? method === "GET" ? "read" : "mutation";
34
+ const riskClass = options.risk ?? "ordinary";
35
+ return defineOperation({
36
+ operationId,
37
+ description: `${kind === "read" ? "Read" : "Apply"} ${operationId} through the project-scoped TreeDX proxy.`,
38
+ rest: { method, path },
39
+ ...Object.keys(pathShape).length ? { parameters: `treeseed.${operationId}.parameters/v1` } : {},
40
+ capability: kind === "read" ? "treedx.read" : "treedx.write",
41
+ authentication: "oauth_or_provider",
42
+ oauthScopes: kind === "read" ? ["treeseed:read"] : ["treeseed:projects:write"],
43
+ kind,
44
+ riskClass,
45
+ confirmation: riskClass === "ordinary" ? "never" : "input_required",
46
+ surfaces: options.surfaces ?? ["rest", "mcp_tool", ...method === "GET" ? ["mcp_resource"] : []],
47
+ cacheScope: kind === "read" ? "project" : "none",
48
+ pagination: options.pagination ?? "none",
49
+ ...upstreamOperationId ? { upstream: { service: "treedx", operationId: upstreamOperationId, contractVersion: TREEDX_OPENAPI_CONTRACT.openapiVersion, contractDigest: TREEDX_OPENAPI_CONTRACT.openapiSha256 } } : {}
50
+ }, {
51
+ path: z.object(pathShape).strict(),
52
+ query: method === "GET" ? record : empty,
53
+ body: method === "GET" ? none : record,
54
+ output: record
55
+ });
56
+ }
57
+ export {
58
+ defineOperation,
59
+ defineTreeDxProxyOperation
60
+ };