@cleocode/contracts 2026.6.12 → 2026.6.14

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 (216) hide show
  1. package/dist/__tests__/operation-def.test.js +5 -1
  2. package/dist/__tests__/operation-def.test.js.map +1 -1
  3. package/dist/__tests__/provider-def.test.d.ts +12 -0
  4. package/dist/__tests__/provider-def.test.d.ts.map +1 -0
  5. package/dist/__tests__/provider-def.test.js +84 -0
  6. package/dist/__tests__/provider-def.test.js.map +1 -0
  7. package/dist/__tests__/sealed-credential.test.d.ts +19 -0
  8. package/dist/__tests__/sealed-credential.test.d.ts.map +1 -0
  9. package/dist/__tests__/sealed-credential.test.js +74 -0
  10. package/dist/__tests__/sealed-credential.test.js.map +1 -0
  11. package/dist/__tests__/service-provider.test.d.ts +17 -0
  12. package/dist/__tests__/service-provider.test.d.ts.map +1 -0
  13. package/dist/__tests__/service-provider.test.js +108 -0
  14. package/dist/__tests__/service-provider.test.js.map +1 -0
  15. package/dist/__tests__/skill-executor-contract.test.js +3 -0
  16. package/dist/__tests__/skill-executor-contract.test.js.map +1 -1
  17. package/dist/acceptance-gate.d.ts +2 -3
  18. package/dist/acceptance-gate.d.ts.map +1 -1
  19. package/dist/boundary.d.ts +52 -0
  20. package/dist/boundary.d.ts.map +1 -1
  21. package/dist/boundary.js +24 -19
  22. package/dist/boundary.js.map +1 -1
  23. package/dist/conduit.d.ts +171 -0
  24. package/dist/conduit.d.ts.map +1 -1
  25. package/dist/config/index.d.ts +23 -0
  26. package/dist/config/index.d.ts.map +1 -0
  27. package/dist/config/index.js +22 -0
  28. package/dist/config/index.js.map +1 -0
  29. package/dist/config.d.ts +104 -1
  30. package/dist/config.d.ts.map +1 -1
  31. package/dist/data-accessor.d.ts +21 -1
  32. package/dist/data-accessor.d.ts.map +1 -1
  33. package/dist/data-accessor.js.map +1 -1
  34. package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.d.ts +21 -0
  35. package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.d.ts.map +1 -0
  36. package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js +84 -0
  37. package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js.map +1 -0
  38. package/dist/dispatch/identity.d.ts +1 -1
  39. package/dist/dispatch/identity.d.ts.map +1 -1
  40. package/dist/dispatch/identity.js +25 -0
  41. package/dist/dispatch/identity.js.map +1 -1
  42. package/dist/dispatch/operation-def.d.ts +20 -0
  43. package/dist/dispatch/operation-def.d.ts.map +1 -1
  44. package/dist/dispatch/operations-registry.d.ts.map +1 -1
  45. package/dist/dispatch/operations-registry.js +1044 -182
  46. package/dist/dispatch/operations-registry.js.map +1 -1
  47. package/dist/docs/read.d.ts +2 -2
  48. package/dist/index.d.ts +25 -11
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +17 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/lease-ipc/__tests__/freeze.test.d.ts +15 -0
  53. package/dist/lease-ipc/__tests__/freeze.test.d.ts.map +1 -0
  54. package/dist/lease-ipc/__tests__/freeze.test.js +313 -0
  55. package/dist/lease-ipc/__tests__/freeze.test.js.map +1 -0
  56. package/dist/lease-ipc/index.d.ts +17 -0
  57. package/dist/lease-ipc/index.d.ts.map +1 -0
  58. package/dist/lease-ipc/index.js +16 -0
  59. package/dist/lease-ipc/index.js.map +1 -0
  60. package/dist/lease-ipc/messages.d.ts +918 -0
  61. package/dist/lease-ipc/messages.d.ts.map +1 -0
  62. package/dist/lease-ipc/messages.js +476 -0
  63. package/dist/lease-ipc/messages.js.map +1 -0
  64. package/dist/lease-ipc/version.d.ts +41 -0
  65. package/dist/lease-ipc/version.d.ts.map +1 -0
  66. package/dist/lease-ipc/version.js +43 -0
  67. package/dist/lease-ipc/version.js.map +1 -0
  68. package/dist/llm/catalog-schema.d.ts +242 -0
  69. package/dist/llm/catalog-schema.d.ts.map +1 -0
  70. package/dist/llm/catalog-schema.js +153 -0
  71. package/dist/llm/catalog-schema.js.map +1 -0
  72. package/dist/llm/catalog-schema.json +139 -0
  73. package/dist/llm/index.d.ts +15 -0
  74. package/dist/llm/index.d.ts.map +1 -0
  75. package/dist/llm/index.js +14 -0
  76. package/dist/llm/index.js.map +1 -0
  77. package/dist/llm/interfaces.d.ts +23 -0
  78. package/dist/llm/interfaces.d.ts.map +1 -1
  79. package/dist/llm/oauth.d.ts +16 -2
  80. package/dist/llm/oauth.d.ts.map +1 -1
  81. package/dist/llm/onboarding.d.ts +126 -0
  82. package/dist/llm/onboarding.d.ts.map +1 -0
  83. package/dist/llm/onboarding.js +34 -0
  84. package/dist/llm/onboarding.js.map +1 -0
  85. package/dist/llm/provider-def.d.ts +254 -0
  86. package/dist/llm/provider-def.d.ts.map +1 -0
  87. package/dist/llm/provider-def.js +93 -0
  88. package/dist/llm/provider-def.js.map +1 -0
  89. package/dist/llm/sealed-credential.d.ts +164 -0
  90. package/dist/llm/sealed-credential.d.ts.map +1 -0
  91. package/dist/llm/sealed-credential.js +43 -0
  92. package/dist/llm/sealed-credential.js.map +1 -0
  93. package/dist/llm/system-of-use.d.ts +383 -0
  94. package/dist/llm/system-of-use.d.ts.map +1 -0
  95. package/dist/llm/system-of-use.js +238 -0
  96. package/dist/llm/system-of-use.js.map +1 -0
  97. package/dist/llm/system-resolver.d.ts +87 -11
  98. package/dist/llm/system-resolver.d.ts.map +1 -1
  99. package/dist/llm/system-resolver.js +14 -7
  100. package/dist/llm/system-resolver.js.map +1 -1
  101. package/dist/operations/__tests__/ensures-schema-registry.test.d.ts +17 -0
  102. package/dist/operations/__tests__/ensures-schema-registry.test.d.ts.map +1 -0
  103. package/dist/operations/__tests__/ensures-schema-registry.test.js +113 -0
  104. package/dist/operations/__tests__/ensures-schema-registry.test.js.map +1 -0
  105. package/dist/operations/admin.d.ts +124 -1
  106. package/dist/operations/admin.d.ts.map +1 -1
  107. package/dist/operations/ensures-schema-registry.d.ts +172 -0
  108. package/dist/operations/ensures-schema-registry.d.ts.map +1 -0
  109. package/dist/operations/ensures-schema-registry.js +226 -0
  110. package/dist/operations/ensures-schema-registry.js.map +1 -0
  111. package/dist/operations/entities.d.ts +110 -0
  112. package/dist/operations/entities.d.ts.map +1 -0
  113. package/dist/operations/entities.js +695 -0
  114. package/dist/operations/entities.js.map +1 -0
  115. package/dist/operations/llm.d.ts +116 -9
  116. package/dist/operations/llm.d.ts.map +1 -1
  117. package/dist/operations/output-contracts-data.d.ts.map +1 -1
  118. package/dist/operations/output-contracts-data.js +230 -0
  119. package/dist/operations/output-contracts-data.js.map +1 -1
  120. package/dist/operations/service.d.ts +68 -0
  121. package/dist/operations/service.d.ts.map +1 -0
  122. package/dist/operations/service.js +336 -0
  123. package/dist/operations/service.js.map +1 -0
  124. package/dist/operations/tasks.d.ts +109 -0
  125. package/dist/operations/tasks.d.ts.map +1 -1
  126. package/dist/operations/tasks.js.map +1 -1
  127. package/dist/operations/validate.d.ts +1 -12
  128. package/dist/operations/validate.d.ts.map +1 -1
  129. package/dist/operations/validate.js +1 -1
  130. package/dist/playbook.d.ts +116 -0
  131. package/dist/playbook.d.ts.map +1 -1
  132. package/dist/release/plan.d.ts +5 -5
  133. package/dist/session.d.ts +11 -0
  134. package/dist/session.d.ts.map +1 -1
  135. package/dist/session.js.map +1 -1
  136. package/dist/templates/manifest.d.ts +1 -1
  137. package/dist/tools/agent-tools.d.ts +231 -0
  138. package/dist/tools/agent-tools.d.ts.map +1 -0
  139. package/dist/tools/agent-tools.js +25 -0
  140. package/dist/tools/agent-tools.js.map +1 -0
  141. package/dist/tools/atomic.d.ts +19 -0
  142. package/dist/tools/atomic.d.ts.map +1 -1
  143. package/dist/tools/atomic.js +17 -0
  144. package/dist/tools/atomic.js.map +1 -1
  145. package/dist/tools/index.d.ts +2 -0
  146. package/dist/tools/index.d.ts.map +1 -1
  147. package/dist/tools/skill-executor.d.ts +7 -0
  148. package/dist/tools/skill-executor.d.ts.map +1 -1
  149. package/dist/tools/web-tools.d.ts +217 -0
  150. package/dist/tools/web-tools.d.ts.map +1 -0
  151. package/dist/tools/web-tools.js +31 -0
  152. package/dist/tools/web-tools.js.map +1 -0
  153. package/dist/vault/service-provider.d.ts +343 -0
  154. package/dist/vault/service-provider.d.ts.map +1 -0
  155. package/dist/vault/service-provider.js +857 -0
  156. package/dist/vault/service-provider.js.map +1 -0
  157. package/dist/workgraph.d.ts +12 -12
  158. package/package.json +14 -2
  159. package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
  160. package/src/__tests__/operation-def.test.ts +7 -1
  161. package/src/__tests__/provider-def.test.ts +93 -0
  162. package/src/__tests__/sealed-credential.test.ts +100 -0
  163. package/src/__tests__/service-provider.test.ts +129 -0
  164. package/src/__tests__/skill-executor-contract.test.ts +3 -0
  165. package/src/acceptance-gate.ts +2 -3
  166. package/src/boundary.ts +70 -20
  167. package/src/conduit.ts +200 -0
  168. package/src/config/index.ts +35 -0
  169. package/src/config.ts +106 -1
  170. package/src/data-accessor.ts +22 -1
  171. package/src/dispatch/__tests__/tasks-gateway-crud-ops.test.ts +99 -0
  172. package/src/dispatch/identity.ts +25 -0
  173. package/src/dispatch/operation-def.ts +21 -0
  174. package/src/dispatch/operations-registry.ts +1083 -176
  175. package/src/index.ts +240 -25
  176. package/src/lease-ipc/__tests__/freeze.test.ts +342 -0
  177. package/src/lease-ipc/index.ts +75 -0
  178. package/src/lease-ipc/messages.ts +588 -0
  179. package/src/lease-ipc/version.ts +46 -0
  180. package/src/llm/catalog-schema.json +139 -0
  181. package/src/llm/catalog-schema.ts +184 -0
  182. package/src/llm/index.ts +29 -0
  183. package/src/llm/interfaces.ts +23 -0
  184. package/src/llm/oauth.ts +16 -2
  185. package/src/llm/onboarding.ts +131 -0
  186. package/src/llm/provider-def.ts +291 -0
  187. package/src/llm/sealed-credential.ts +166 -0
  188. package/src/llm/system-of-use.ts +503 -0
  189. package/src/llm/system-resolver.ts +91 -11
  190. package/src/operations/__tests__/ensures-schema-registry.test.ts +169 -0
  191. package/src/operations/admin.ts +144 -0
  192. package/src/operations/ensures-schema-registry.ts +260 -0
  193. package/src/operations/entities.ts +758 -0
  194. package/src/operations/llm.ts +120 -8
  195. package/src/operations/output-contracts-data.ts +264 -0
  196. package/src/operations/service.ts +360 -0
  197. package/src/operations/tasks.ts +119 -0
  198. package/src/operations/validate.ts +1 -14
  199. package/src/playbook.ts +117 -0
  200. package/src/session.ts +11 -0
  201. package/src/tools/agent-tools.ts +270 -0
  202. package/src/tools/atomic.ts +21 -0
  203. package/src/tools/index.ts +46 -0
  204. package/src/tools/skill-executor.ts +7 -0
  205. package/src/tools/web-tools.ts +247 -0
  206. package/src/vault/service-provider.ts +1137 -0
  207. package/dist/tessera.d.ts +0 -32
  208. package/dist/tessera.d.ts.map +0 -1
  209. package/dist/tessera.js +0 -11
  210. package/dist/tessera.js.map +0 -1
  211. package/dist/warp-chain.d.ts +0 -129
  212. package/dist/warp-chain.d.ts.map +0 -1
  213. package/dist/warp-chain.js +0 -13
  214. package/dist/warp-chain.js.map +0 -1
  215. package/src/tessera.ts +0 -35
  216. package/src/warp-chain.ts +0 -185
@@ -10,6 +10,8 @@
10
10
  */
11
11
 
12
12
  import { DOCS_LIFECYCLE_STATUSES } from '../operations/docs.js';
13
+ import { OUTPUT_CONTRACTS } from '../operations/output-contracts-data.js';
14
+ import { tasksUpdateInputContract } from '../operations/tasks.js';
13
15
  import type { CanonicalDomain, Gateway, OperationDef, ParamDef, Tier } from './operation-def.js';
14
16
 
15
17
  export type { CanonicalDomain, Gateway, OperationDef, ParamDef, Tier };
@@ -241,6 +243,41 @@ export const OPERATIONS: OperationDef[] = [
241
243
  },
242
244
  ] satisfies ParamDef[],
243
245
  },
246
+ // T11785 (epic T11556 · E1-GATEWAY-CRUD) — the FIRST streaming task op. Served
247
+ // as `GET /v1/tasks/subscribe` → a `text/event-stream` body of
248
+ // `GatewayStreamEvent` frames (task/board created/updated/deleted lifecycle
249
+ // events), scoped to an optional saga/parent root. Studio's interactive Kanban
250
+ // (T11929) and the Pi-TUI board consume it for live updates. The default
251
+ // source ships a bounded heartbeat producer (stream-sources.ts); the daemon
252
+ // injects its real origin-tailing source via `registerStreamSource`.
253
+ {
254
+ gateway: 'query',
255
+ domain: 'tasks',
256
+ operation: 'subscribe',
257
+ description:
258
+ 'tasks.subscribe (query, streaming) — SSE stream of task/board lifecycle events (created/updated/deleted), optionally scoped to a saga/parent root',
259
+ tier: 2,
260
+ idempotent: true,
261
+ sessionRequired: false,
262
+ streaming: true,
263
+ requiredParams: [],
264
+ params: [
265
+ {
266
+ name: 'root',
267
+ type: 'string',
268
+ required: false,
269
+ description:
270
+ 'Optional saga/parent task ID to scope the event stream to (omit for the whole board)',
271
+ },
272
+ {
273
+ name: 'ticks',
274
+ type: 'number',
275
+ required: false,
276
+ description:
277
+ 'Maximum number of event frames to emit before the terminal `done` frame (default: open-ended until client disconnect)',
278
+ },
279
+ ] satisfies ParamDef[],
280
+ },
244
281
  {
245
282
  gateway: 'query',
246
283
  domain: 'tasks',
@@ -790,6 +827,32 @@ export const OPERATIONS: OperationDef[] = [
790
827
  requiredParams: [],
791
828
  params: [],
792
829
  },
830
+ // T11921 — gateway SSE streaming on /v1. The agent/worker/board event stream
831
+ // the Studio Kanban (T11929) + Pi-TUI (T11936) consume as a realtime
832
+ // transport. Served as `GET /v1/orchestrate/events` → a `text/event-stream`
833
+ // body of `GatewayStreamEvent` frames terminated by a `done` frame, NOT as a
834
+ // unary POST. Secrets never touch the wire — the source resolves server-side.
835
+ {
836
+ gateway: 'query',
837
+ domain: 'orchestrate',
838
+ operation: 'events',
839
+ description:
840
+ 'orchestrate.events (query, streaming) — SSE stream of agent/worker/board lifecycle events',
841
+ tier: 2,
842
+ idempotent: true,
843
+ sessionRequired: false,
844
+ streaming: true,
845
+ requiredParams: [],
846
+ params: [
847
+ {
848
+ name: 'ticks',
849
+ type: 'number',
850
+ required: false,
851
+ description:
852
+ 'Maximum number of event frames to emit before the terminal `done` frame (default: open-ended until client disconnect)',
853
+ },
854
+ ] satisfies ParamDef[],
855
+ },
793
856
  // T811 — IVTR multi-agent enforcement
794
857
  {
795
858
  gateway: 'query',
@@ -1462,37 +1525,6 @@ export const OPERATIONS: OperationDef[] = [
1462
1525
  requiredParams: [],
1463
1526
  params: [],
1464
1527
  },
1465
- // T5405: WarpChain pipeline operations
1466
- {
1467
- gateway: 'query',
1468
- domain: 'pipeline',
1469
- operation: 'chain.show',
1470
- description: 'pipeline.chain.show (query) — get chain definition by ID',
1471
- tier: 2,
1472
- idempotent: true,
1473
- sessionRequired: false,
1474
- requiredParams: ['chainId'],
1475
- params: [
1476
- {
1477
- name: 'chainId',
1478
- type: 'string',
1479
- required: true,
1480
- description: 'chainId parameter',
1481
- cli: { positional: true },
1482
- },
1483
- ] satisfies ParamDef[],
1484
- },
1485
- {
1486
- gateway: 'query',
1487
- domain: 'pipeline',
1488
- operation: 'chain.list',
1489
- description: 'pipeline.chain.list (query) — list all chain definitions',
1490
- tier: 2,
1491
- idempotent: true,
1492
- sessionRequired: false,
1493
- requiredParams: [],
1494
- params: [],
1495
- },
1496
1528
  {
1497
1529
  gateway: 'query',
1498
1530
  domain: 'check',
@@ -1690,26 +1722,6 @@ export const OPERATIONS: OperationDef[] = [
1690
1722
  },
1691
1723
  ],
1692
1724
  },
1693
- // T5405: WarpChain validation query
1694
- {
1695
- gateway: 'query',
1696
- domain: 'check',
1697
- operation: 'chain.validate',
1698
- description: 'check.chain.validate (query) — validate a WarpChain definition',
1699
- tier: 2,
1700
- idempotent: true,
1701
- sessionRequired: false,
1702
- requiredParams: ['chain'],
1703
- params: [
1704
- {
1705
- name: 'chain',
1706
- type: 'string',
1707
- required: true,
1708
- description: 'chain parameter',
1709
- cli: { positional: true },
1710
- },
1711
- ] satisfies ParamDef[],
1712
- },
1713
1725
  // T646: Canon drift detection — CI gate
1714
1726
  {
1715
1727
  gateway: 'query',
@@ -1809,6 +1821,73 @@ export const OPERATIONS: OperationDef[] = [
1809
1821
  requiredParams: [],
1810
1822
  params: [],
1811
1823
  },
1824
+ {
1825
+ gateway: 'query',
1826
+ domain: 'admin',
1827
+ operation: 'config.get',
1828
+ description:
1829
+ 'admin.config.get (query) — resolve a single config value via the ConfigManifest cascade (T11917)',
1830
+ tier: 1,
1831
+ idempotent: true,
1832
+ sessionRequired: false,
1833
+ requiredParams: ['key'],
1834
+ params: [
1835
+ {
1836
+ name: 'key',
1837
+ type: 'string',
1838
+ required: true,
1839
+ description: 'Dot-notation config key to read (e.g. "release.branchModel")',
1840
+ cli: { positional: true },
1841
+ },
1842
+ {
1843
+ name: 'scope',
1844
+ type: 'string',
1845
+ required: false,
1846
+ description: 'Cascade slice to read from. Defaults to merged.',
1847
+ enum: ['global', 'project', 'merged'],
1848
+ },
1849
+ ] satisfies ParamDef[],
1850
+ },
1851
+ {
1852
+ gateway: 'query',
1853
+ domain: 'admin',
1854
+ operation: 'config.list',
1855
+ description:
1856
+ 'admin.config.list (query) — resolve the full config cascade and its flattened keys (T11917)',
1857
+ tier: 1,
1858
+ idempotent: true,
1859
+ sessionRequired: false,
1860
+ requiredParams: [],
1861
+ params: [
1862
+ {
1863
+ name: 'scope',
1864
+ type: 'string',
1865
+ required: false,
1866
+ description: 'Cascade slice to project. Defaults to merged.',
1867
+ enum: ['global', 'project', 'merged'],
1868
+ },
1869
+ ] satisfies ParamDef[],
1870
+ },
1871
+ {
1872
+ gateway: 'query',
1873
+ domain: 'admin',
1874
+ operation: 'config.validate',
1875
+ description:
1876
+ 'admin.config.validate (query) — schema-validate a scoped config file via its manifest entry (T11917)',
1877
+ tier: 1,
1878
+ idempotent: true,
1879
+ sessionRequired: false,
1880
+ requiredParams: [],
1881
+ params: [
1882
+ {
1883
+ name: 'scope',
1884
+ type: 'string',
1885
+ required: false,
1886
+ description: 'Scope to validate (global or project). Defaults to project.',
1887
+ enum: ['global', 'project'],
1888
+ },
1889
+ ] satisfies ParamDef[],
1890
+ },
1812
1891
  {
1813
1892
  gateway: 'query',
1814
1893
  domain: 'admin',
@@ -2490,10 +2569,18 @@ export const OPERATIONS: OperationDef[] = [
2490
2569
  ] satisfies ParamDef[],
2491
2570
  },
2492
2571
  {
2572
+ // T11784 (epic T11556 · E1-GATEWAY-CRUD) — the OperationDef.params used to
2573
+ // declare ONLY `taskId`, so every other mutable field a Studio form binds
2574
+ // to was invisible to dispatch introspection (`cleo update --describe`, the
2575
+ // SDK `describeOperation`) and silently dropped at the dispatch boundary.
2576
+ // The full mutable-field set is now enumerated here, grounded in
2577
+ // {@link TasksUpdateQueryParams} / {@link TASKS_UPDATE_INPUT_SCHEMA}; a
2578
+ // regression test (operations-registry tasks-update parity) asserts the
2579
+ // param names stay in sync with the schema's `properties`.
2493
2580
  gateway: 'mutate',
2494
2581
  domain: 'tasks',
2495
2582
  operation: 'update',
2496
- description: 'tasks.update (mutate)',
2583
+ description: 'tasks.update (mutate) — partial update; only supplied fields are mutated',
2497
2584
  tier: 0,
2498
2585
  idempotent: false,
2499
2586
  sessionRequired: false,
@@ -2503,10 +2590,183 @@ export const OPERATIONS: OperationDef[] = [
2503
2590
  name: 'taskId',
2504
2591
  type: 'string',
2505
2592
  required: true,
2506
- description: 'taskId parameter',
2593
+ description: 'Task ID to update',
2507
2594
  cli: { positional: true },
2508
2595
  },
2596
+ { name: 'title', type: 'string', required: false, description: 'New title (3–500 chars)' },
2597
+ {
2598
+ name: 'description',
2599
+ type: 'string',
2600
+ required: false,
2601
+ description: 'New description',
2602
+ cli: { flag: 'description', short: '-d' },
2603
+ },
2604
+ {
2605
+ name: 'status',
2606
+ type: 'string',
2607
+ required: false,
2608
+ description: 'New status',
2609
+ enum: ['pending', 'active', 'blocked', 'done', 'cancelled'] as const,
2610
+ cli: { flag: 'status', short: '-s' },
2611
+ },
2612
+ {
2613
+ name: 'priority',
2614
+ type: 'string',
2615
+ required: false,
2616
+ description: 'New priority (orthogonal to severity)',
2617
+ enum: ['low', 'medium', 'high', 'critical'] as const,
2618
+ cli: { flag: 'priority', short: '-p' },
2619
+ },
2620
+ { name: 'notes', type: 'string', required: false, description: 'Append a note entry' },
2621
+ {
2622
+ name: 'labels',
2623
+ type: 'array',
2624
+ required: false,
2625
+ description: 'Replace labels (comma-separated)',
2626
+ cli: { flag: 'labels', short: '-l' },
2627
+ },
2628
+ {
2629
+ name: 'addLabels',
2630
+ type: 'array',
2631
+ required: false,
2632
+ description: 'Add labels incrementally',
2633
+ },
2634
+ {
2635
+ name: 'removeLabels',
2636
+ type: 'array',
2637
+ required: false,
2638
+ description: 'Remove labels incrementally',
2639
+ },
2640
+ {
2641
+ name: 'depends',
2642
+ type: 'array',
2643
+ required: false,
2644
+ description: 'Replace dependency task IDs',
2645
+ cli: { flag: 'depends', short: '-D' },
2646
+ },
2647
+ {
2648
+ name: 'addDepends',
2649
+ type: 'array',
2650
+ required: false,
2651
+ description: 'Add dependency task IDs incrementally',
2652
+ },
2653
+ {
2654
+ name: 'removeDepends',
2655
+ type: 'array',
2656
+ required: false,
2657
+ description: 'Remove dependency task IDs incrementally',
2658
+ },
2659
+ {
2660
+ name: 'acceptance',
2661
+ type: 'array',
2662
+ required: false,
2663
+ description: 'Replace acceptance criteria (pipe-separated)',
2664
+ },
2665
+ {
2666
+ name: 'parent',
2667
+ type: 'string',
2668
+ required: false,
2669
+ description: 'Set parent task ID (null/empty promotes to root)',
2670
+ },
2671
+ {
2672
+ name: 'type',
2673
+ type: 'string',
2674
+ required: false,
2675
+ description: 'New hierarchy type',
2676
+ enum: ['saga', 'epic', 'task', 'subtask'] as const,
2677
+ cli: { flag: 'type', short: '-t' },
2678
+ },
2679
+ {
2680
+ name: 'size',
2681
+ type: 'string',
2682
+ required: false,
2683
+ description: 'New scope-size estimate',
2684
+ enum: ['small', 'medium', 'large'] as const,
2685
+ },
2686
+ {
2687
+ name: 'files',
2688
+ type: 'array',
2689
+ required: false,
2690
+ description: 'Replace associated file paths',
2691
+ },
2692
+ {
2693
+ name: 'addFiles',
2694
+ type: 'array',
2695
+ required: false,
2696
+ description: 'Add file paths incrementally',
2697
+ },
2698
+ {
2699
+ name: 'removeFiles',
2700
+ type: 'array',
2701
+ required: false,
2702
+ description: 'Remove file paths incrementally',
2703
+ },
2704
+ {
2705
+ name: 'pipelineStage',
2706
+ type: 'string',
2707
+ required: false,
2708
+ description: 'Set pipeline stage (forward-only)',
2709
+ },
2710
+ {
2711
+ name: 'kind',
2712
+ type: 'string',
2713
+ required: false,
2714
+ description: 'Task kind / intent axis (orthogonal to type)',
2715
+ enum: ['work', 'research', 'experiment', 'bug', 'spike', 'release'] as const,
2716
+ },
2717
+ {
2718
+ name: 'scope',
2719
+ type: 'string',
2720
+ required: false,
2721
+ description: 'Task scope / granularity axis',
2722
+ enum: ['project', 'feature', 'unit'] as const,
2723
+ },
2724
+ {
2725
+ name: 'severity',
2726
+ type: 'string',
2727
+ required: false,
2728
+ description: 'Severity level (orthogonal to priority)',
2729
+ enum: ['P0', 'P1', 'P2', 'P3'] as const,
2730
+ },
2731
+ {
2732
+ name: 'reason',
2733
+ type: 'string',
2734
+ required: false,
2735
+ description: 'Operator override reason for the AC-immutability guard',
2736
+ },
2737
+ {
2738
+ name: 'dependsWaiver',
2739
+ type: 'string',
2740
+ required: false,
2741
+ description: 'Justification to waive the critical-priority --depends requirement',
2742
+ },
2743
+ {
2744
+ name: 'clearBlockedBy',
2745
+ type: 'boolean',
2746
+ required: false,
2747
+ description: 'Clear the free-text blockedBy reason',
2748
+ },
2749
+ {
2750
+ name: 'relates',
2751
+ type: 'array',
2752
+ required: false,
2753
+ description: 'Replace related-task edges ({taskId, type, reason?})',
2754
+ },
2755
+ {
2756
+ name: 'addRelates',
2757
+ type: 'array',
2758
+ required: false,
2759
+ description: 'Add related-task edges without overwriting existing',
2760
+ },
2761
+ {
2762
+ name: 'removeRelates',
2763
+ type: 'array',
2764
+ required: false,
2765
+ description: 'Remove related-task edges by taskId',
2766
+ },
2509
2767
  ] satisfies ParamDef[],
2768
+ inputSchema: tasksUpdateInputContract,
2769
+ outputSchema: OUTPUT_CONTRACTS['tasks.update'],
2510
2770
  },
2511
2771
  {
2512
2772
  gateway: 'mutate',
@@ -2651,18 +2911,110 @@ export const OPERATIONS: OperationDef[] = [
2651
2911
  },
2652
2912
  ] satisfies ParamDef[],
2653
2913
  },
2914
+ // T11786 (epic T11556 · E1-GATEWAY-CRUD) — bulk task mutate ops the Studio
2915
+ // interactive Kanban (M6) binds to: within-column re-rank, atomic multi-move,
2916
+ // and first-class assignee (distinct from the agent claim lock).
2654
2917
  {
2655
2918
  gateway: 'mutate',
2656
2919
  domain: 'tasks',
2657
- operation: 'relates.add',
2658
- description: 'tasks.relates.add (mutate)',
2920
+ operation: 'reorder-rank',
2921
+ description:
2922
+ 'tasks.reorder-rank (mutate) — within-column positional re-rank from an explicit top-to-bottom task-ID order (Kanban drag-reorder)',
2659
2923
  tier: 1,
2660
2924
  idempotent: false,
2661
2925
  sessionRequired: false,
2662
- requiredParams: ['taskId', 'type'],
2926
+ requiredParams: ['orderedIds'],
2663
2927
  params: [
2664
2928
  {
2665
- name: 'taskId',
2929
+ name: 'orderedIds',
2930
+ type: 'array',
2931
+ required: true,
2932
+ description:
2933
+ 'Ordered task IDs describing the desired top-to-bottom column order; each task position is set to its 1-based index',
2934
+ },
2935
+ ] satisfies ParamDef[],
2936
+ outputSchema: OUTPUT_CONTRACTS['tasks.reorder-rank'],
2937
+ },
2938
+ {
2939
+ gateway: 'mutate',
2940
+ domain: 'tasks',
2941
+ operation: 'bulk-move',
2942
+ description:
2943
+ 'tasks.bulk-move (mutate) — atomically move N tasks to a new status and/or pipeline stage in a single transaction (Kanban multi-card column move)',
2944
+ tier: 1,
2945
+ idempotent: false,
2946
+ sessionRequired: false,
2947
+ requiredParams: ['taskIds'],
2948
+ params: [
2949
+ {
2950
+ name: 'taskIds',
2951
+ type: 'array',
2952
+ required: true,
2953
+ description: 'Task IDs to move (all-or-nothing; any failure rolls back every move)',
2954
+ },
2955
+ {
2956
+ name: 'status',
2957
+ type: 'string',
2958
+ required: false,
2959
+ description: 'Target lifecycle status applied to every task',
2960
+ enum: [
2961
+ 'pending',
2962
+ 'active',
2963
+ 'blocked',
2964
+ 'done',
2965
+ 'cancelled',
2966
+ 'archived',
2967
+ 'proposed',
2968
+ ] as const,
2969
+ },
2970
+ {
2971
+ name: 'pipelineStage',
2972
+ type: 'string',
2973
+ required: false,
2974
+ description: 'Target pipeline stage applied to every task (forward-only)',
2975
+ },
2976
+ ] satisfies ParamDef[],
2977
+ outputSchema: OUTPUT_CONTRACTS['tasks.bulk-move'],
2978
+ },
2979
+ {
2980
+ gateway: 'mutate',
2981
+ domain: 'tasks',
2982
+ operation: 'assignee',
2983
+ description:
2984
+ 'tasks.assignee (mutate) — set/clear a first-class human assignee (DISTINCT from the agent claim/unclaim lock; pass assignee:null to clear)',
2985
+ tier: 1,
2986
+ idempotent: true,
2987
+ sessionRequired: false,
2988
+ requiredParams: ['taskId'],
2989
+ params: [
2990
+ {
2991
+ name: 'taskId',
2992
+ type: 'string',
2993
+ required: true,
2994
+ description: 'Task ID whose assignee is being set or cleared',
2995
+ cli: { positional: true },
2996
+ },
2997
+ {
2998
+ name: 'assignee',
2999
+ type: 'string',
3000
+ required: false,
3001
+ description: 'Assignee to set; omit / empty / null clears the assignee',
3002
+ },
3003
+ ] satisfies ParamDef[],
3004
+ outputSchema: OUTPUT_CONTRACTS['tasks.assignee'],
3005
+ },
3006
+ {
3007
+ gateway: 'mutate',
3008
+ domain: 'tasks',
3009
+ operation: 'relates.add',
3010
+ description: 'tasks.relates.add (mutate)',
3011
+ tier: 1,
3012
+ idempotent: false,
3013
+ sessionRequired: false,
3014
+ requiredParams: ['taskId', 'type'],
3015
+ params: [
3016
+ {
3017
+ name: 'taskId',
2666
3018
  type: 'string',
2667
3019
  required: true,
2668
3020
  description: 'taskId parameter',
@@ -4248,77 +4600,6 @@ export const OPERATIONS: OperationDef[] = [
4248
4600
  { name: 'force', type: 'boolean', required: false, description: 'Required safety flag' },
4249
4601
  ],
4250
4602
  },
4251
- // T5405: WarpChain pipeline mutate operations
4252
- {
4253
- gateway: 'mutate',
4254
- domain: 'pipeline',
4255
- operation: 'chain.add',
4256
- description: 'pipeline.chain.add (mutate) — store a validated chain definition',
4257
- tier: 2,
4258
- idempotent: false,
4259
- sessionRequired: false,
4260
- requiredParams: ['chain'],
4261
- params: [
4262
- {
4263
- name: 'chain',
4264
- type: 'string',
4265
- required: true,
4266
- description: 'chain parameter',
4267
- cli: { positional: true },
4268
- },
4269
- ] satisfies ParamDef[],
4270
- },
4271
- {
4272
- gateway: 'mutate',
4273
- domain: 'pipeline',
4274
- operation: 'chain.instantiate',
4275
- description: 'pipeline.chain.instantiate (mutate) — create chain instance for epic',
4276
- tier: 2,
4277
- idempotent: false,
4278
- sessionRequired: false,
4279
- requiredParams: ['chainId', 'epicId'],
4280
- params: [
4281
- {
4282
- name: 'chainId',
4283
- type: 'string',
4284
- required: true,
4285
- description: 'chainId parameter',
4286
- cli: { positional: true },
4287
- },
4288
- {
4289
- name: 'epicId',
4290
- type: 'string',
4291
- required: true,
4292
- description: 'epicId parameter',
4293
- cli: { positional: true },
4294
- },
4295
- ] satisfies ParamDef[],
4296
- },
4297
- {
4298
- gateway: 'mutate',
4299
- domain: 'pipeline',
4300
- operation: 'chain.advance',
4301
- description: 'pipeline.chain.advance (mutate) — advance instance to next stage',
4302
- tier: 2,
4303
- idempotent: false,
4304
- sessionRequired: false,
4305
- requiredParams: ['instanceId', 'nextStage'],
4306
- params: [
4307
- {
4308
- name: 'instanceId',
4309
- type: 'string',
4310
- required: true,
4311
- description: 'instanceId parameter',
4312
- cli: { positional: true },
4313
- },
4314
- {
4315
- name: 'nextStage',
4316
- type: 'string',
4317
- required: true,
4318
- description: 'nextStage parameter',
4319
- },
4320
- ] satisfies ParamDef[],
4321
- },
4322
4603
  {
4323
4604
  gateway: 'mutate',
4324
4605
  domain: 'check',
@@ -4553,6 +4834,32 @@ export const OPERATIONS: OperationDef[] = [
4553
4834
  },
4554
4835
  ],
4555
4836
  },
4837
+ {
4838
+ gateway: 'mutate',
4839
+ domain: 'admin',
4840
+ operation: 'config.unset',
4841
+ description:
4842
+ 'admin.config.unset (mutate) — remove a key from a scoped config file (idempotent) (T11917)',
4843
+ tier: 1,
4844
+ idempotent: true,
4845
+ sessionRequired: false,
4846
+ requiredParams: ['key'],
4847
+ params: [
4848
+ {
4849
+ name: 'key',
4850
+ type: 'string',
4851
+ required: true,
4852
+ description: 'Dot-notation config key to remove',
4853
+ cli: { positional: true },
4854
+ },
4855
+ {
4856
+ name: 'global',
4857
+ type: 'boolean',
4858
+ required: false,
4859
+ description: 'Remove from the global file instead of the project file',
4860
+ },
4861
+ ] satisfies ParamDef[],
4862
+ },
4556
4863
  {
4557
4864
  gateway: 'query',
4558
4865
  domain: 'admin',
@@ -6603,54 +6910,6 @@ export const OPERATIONS: OperationDef[] = [
6603
6910
  },
6604
6911
  ] satisfies ParamDef[],
6605
6912
  },
6606
- // orchestrate — tessera template operations (T5411)
6607
- // tessera.show removed — merged into tessera.list via optional id param (T5615)
6608
- {
6609
- gateway: 'query',
6610
- domain: 'orchestrate',
6611
- operation: 'tessera.list',
6612
- description:
6613
- 'orchestrate.tessera.list (query) — list Tessera templates; absorbs tessera.show via optional id param',
6614
- tier: 1,
6615
- idempotent: true,
6616
- sessionRequired: false,
6617
- requiredParams: [],
6618
- params: [
6619
- {
6620
- name: 'id',
6621
- type: 'string',
6622
- required: false,
6623
- description: 'Optional template ID for single-item lookup (replaces tessera.show)',
6624
- },
6625
- ],
6626
- },
6627
- {
6628
- gateway: 'mutate',
6629
- domain: 'orchestrate',
6630
- operation: 'tessera.instantiate',
6631
- description:
6632
- 'orchestrate.tessera.instantiate (mutate) — instantiate a Tessera template into a chain instance',
6633
- tier: 1,
6634
- idempotent: false,
6635
- sessionRequired: false,
6636
- requiredParams: ['templateId', 'epicId'],
6637
- params: [
6638
- {
6639
- name: 'templateId',
6640
- type: 'string',
6641
- required: true,
6642
- description: 'templateId parameter',
6643
- cli: { positional: true },
6644
- },
6645
- {
6646
- name: 'epicId',
6647
- type: 'string',
6648
- required: true,
6649
- description: 'epicId parameter',
6650
- cli: { positional: true },
6651
- },
6652
- ] satisfies ParamDef[],
6653
- },
6654
6913
  // orchestrate — Wave 7a dispatch ops (T408, T409, T410, T415)
6655
6914
  {
6656
6915
  gateway: 'query',
@@ -8956,4 +9215,652 @@ export const OPERATIONS: OperationDef[] = [
8956
9215
  },
8957
9216
  ] satisfies ParamDef[],
8958
9217
  },
9218
+
9219
+ // ── selfimprove mutate: run (T11889 / T11889-D — the self-dogfooding loop) ──
9220
+ // Boots ONE sandbox → replays the named canned scenario → diffs result
9221
+ // envelopes vs the golden → on a regression emits ONE leased `selfimprove_dhq`
9222
+ // row and opens ONE DRAFT PR. The walking skeleton's default scenario is
9223
+ // query-only so the in-process replay never mutates. DEFAULT OFF: without
9224
+ // `execute` the loop runs DRY-RUN (replay + diff + report; NO DB write, NO PR).
9225
+ // The CORE engine (`runSelfImprove`) owns boot/replay/diff/persist/egress +
9226
+ // the budget + circuit-breaker; the dispatch handler is a thin delegate that
9227
+ // supplies the in-process `ReplayDispatch` port (Gate-6). `sessionRequired`
9228
+ // links each run to its origin session for provenance.
9229
+ {
9230
+ gateway: 'mutate',
9231
+ domain: 'selfimprove',
9232
+ operation: 'run',
9233
+ description:
9234
+ 'selfimprove.run (mutate) — boot ONE sandbox, replay a canned dogfood scenario, diff vs golden; on regression emit ONE leased selfimprove_dhq row + ONE DRAFT PR. Default OFF — requires --execute (else DRY-RUN). Budget-capped + circuit-broken (T11889 / T11889-D).',
9235
+ tier: 2,
9236
+ idempotent: false,
9237
+ sessionRequired: true,
9238
+ requiredParams: ['scenario'],
9239
+ params: [
9240
+ {
9241
+ name: 'scenario',
9242
+ type: 'string',
9243
+ required: true,
9244
+ description: 'Canned dogfood scenario name to replay (e.g. dhq-replay-find)',
9245
+ },
9246
+ {
9247
+ name: 'execute',
9248
+ type: 'boolean',
9249
+ required: false,
9250
+ description:
9251
+ 'Permit mutation (leased DHQ UPSERT) + egress (draft PR). DEFAULT false ⇒ DRY-RUN (replay + diff + report only — no DB write, no PR).',
9252
+ },
9253
+ {
9254
+ name: 'dryRun',
9255
+ type: 'boolean',
9256
+ required: false,
9257
+ description:
9258
+ 'Force DRY-RUN explicitly (no DB write, no PR). Equivalent to omitting --execute; the loop is default-OFF.',
9259
+ },
9260
+ {
9261
+ name: 'backend',
9262
+ type: 'string',
9263
+ required: false,
9264
+ description:
9265
+ "Confinement backend preference: 'gondolin' (micro-VM; degrades to the in-process guarded env when VM infra is absent — the CI path) | 'guarded'. Default: gondolin.",
9266
+ },
9267
+ ] satisfies ParamDef[],
9268
+ },
9269
+
9270
+ // ── service domain: universal service-vault OAuth flow (T11939 · epic T11765) ──
9271
+ // Four verbs driving the declarative SERVICE_PROVIDERS registry: auth-url (query
9272
+ // — build a PKCE authorization URL), exchange (mutate — persist encrypted tokens
9273
+ // from an auth code), refresh (mutate — renew an access token honoring the
9274
+ // per-provider RefreshConfig), self-heal (mutate — resolve + transparently
9275
+ // refresh a past-expiry connection). The flow lives in CORE (store/service-oauth.ts).
9276
+ {
9277
+ gateway: 'query',
9278
+ domain: 'service',
9279
+ operation: 'auth-url',
9280
+ description:
9281
+ 'service.auth-url (query) — build a PKCE OAuth authorization URL for a service provider; returns the URL + the code verifier + state to round-trip into service.exchange.',
9282
+ tier: 2,
9283
+ idempotent: false,
9284
+ sessionRequired: false,
9285
+ requiredParams: ['provider'],
9286
+ params: [
9287
+ {
9288
+ name: 'provider',
9289
+ type: 'string',
9290
+ required: true,
9291
+ description:
9292
+ 'Service provider key (e.g. github, google, notion) — must be in SERVICE_PROVIDERS.',
9293
+ },
9294
+ {
9295
+ name: 'state',
9296
+ type: 'string',
9297
+ required: false,
9298
+ description: 'Opaque CSRF state to embed; a random value is generated when omitted.',
9299
+ },
9300
+ {
9301
+ name: 'scope',
9302
+ type: 'string',
9303
+ required: false,
9304
+ description: 'Scope override (e.g. a BYOC custom scope). Defaults to the provider scope.',
9305
+ },
9306
+ {
9307
+ name: 'redirectUri',
9308
+ type: 'string',
9309
+ required: false,
9310
+ description: 'Redirect URI override. Defaults to the provider loopback redirect.',
9311
+ },
9312
+ ] satisfies ParamDef[],
9313
+ },
9314
+ {
9315
+ gateway: 'mutate',
9316
+ domain: 'service',
9317
+ operation: 'exchange',
9318
+ description:
9319
+ 'service.exchange (mutate) — exchange an OAuth authorization code (+ PKCE verifier) for tokens and PERSIST them encryptGlobal-encrypted into service_connections. Returns the non-secret connection identity.',
9320
+ tier: 2,
9321
+ idempotent: false,
9322
+ sessionRequired: false,
9323
+ requiredParams: ['provider', 'code', 'codeVerifier', 'redirectUri'],
9324
+ params: [
9325
+ { name: 'provider', type: 'string', required: true, description: 'Service provider key.' },
9326
+ {
9327
+ name: 'code',
9328
+ type: 'string',
9329
+ required: true,
9330
+ description: 'Authorization code from the redirect callback.',
9331
+ },
9332
+ {
9333
+ name: 'codeVerifier',
9334
+ type: 'string',
9335
+ required: true,
9336
+ description: 'PKCE code verifier from service.auth-url (round-tripped).',
9337
+ },
9338
+ {
9339
+ name: 'redirectUri',
9340
+ type: 'string',
9341
+ required: true,
9342
+ description: 'Redirect URI used in service.auth-url (must match).',
9343
+ },
9344
+ {
9345
+ name: 'label',
9346
+ type: 'string',
9347
+ required: false,
9348
+ description: 'Connection label, unique within the provider. Defaults to "default".',
9349
+ },
9350
+ ] satisfies ParamDef[],
9351
+ },
9352
+ {
9353
+ gateway: 'mutate',
9354
+ domain: 'service',
9355
+ operation: 'refresh',
9356
+ description:
9357
+ 'service.refresh (mutate) — refresh a service connection access token honoring the per-provider RefreshConfig (Form/Json × Body/BasicAuth, plus github-app / service-account-jwt / client-credentials variants); re-encrypts + persists the new blob.',
9358
+ tier: 2,
9359
+ idempotent: false,
9360
+ sessionRequired: false,
9361
+ requiredParams: ['agentId', 'provider', 'label'],
9362
+ params: [
9363
+ {
9364
+ name: 'agentId',
9365
+ type: 'string',
9366
+ required: true,
9367
+ description: 'Agent requesting the refresh (trust-gated).',
9368
+ },
9369
+ { name: 'provider', type: 'string', required: true, description: 'Service provider key.' },
9370
+ { name: 'label', type: 'string', required: true, description: 'Connection label.' },
9371
+ {
9372
+ name: 'approved',
9373
+ type: 'boolean',
9374
+ required: false,
9375
+ description: 'Out-of-band manual-approval flag forwarded to the trust gate.',
9376
+ },
9377
+ ] satisfies ParamDef[],
9378
+ },
9379
+ {
9380
+ gateway: 'mutate',
9381
+ domain: 'service',
9382
+ operation: 'self-heal',
9383
+ description:
9384
+ 'service.self-heal (mutate) — resolve a service connection and, when its expires_at is past, transparently refresh + re-encrypt + persist; returns a fresh sealed-credential reference (agents never see a stale token).',
9385
+ tier: 2,
9386
+ idempotent: true,
9387
+ sessionRequired: false,
9388
+ requiredParams: ['agentId', 'provider', 'label'],
9389
+ params: [
9390
+ {
9391
+ name: 'agentId',
9392
+ type: 'string',
9393
+ required: true,
9394
+ description: 'Agent requesting the connection (trust-gated).',
9395
+ },
9396
+ { name: 'provider', type: 'string', required: true, description: 'Service provider key.' },
9397
+ { name: 'label', type: 'string', required: true, description: 'Connection label.' },
9398
+ {
9399
+ name: 'approved',
9400
+ type: 'boolean',
9401
+ required: false,
9402
+ description: 'Out-of-band manual-approval flag forwarded to the trust gate.',
9403
+ },
9404
+ ] satisfies ParamDef[],
9405
+ },
9406
+
9407
+ // ── service domain: user-facing service-vault CLI verbs (T11941 · M2-W4) ──
9408
+ // Four verbs making the universal vault USABLE from the CLI: connect (mutate —
9409
+ // store a credential via token-direct or paste-code OAuth exchange), list
9410
+ // (query — redacted connection views, NEVER the token), revoke (mutate — hard
9411
+ // delete + cascade agent grants), status (query — connection health: expired?
9412
+ // needsRefresh?). Thin handlers delegate to CORE accessor + service-oauth.
9413
+ {
9414
+ gateway: 'mutate',
9415
+ domain: 'service',
9416
+ operation: 'connect',
9417
+ description:
9418
+ 'service.connect (mutate) — connect a service credential: store an already-obtained token (--token) OR exchange an OAuth authorization code (--paste-code + --code-verifier + --redirect-uri). Persists the token blob encryptGlobal-encrypted; returns the NON-SECRET connection identity (never the token).',
9419
+ tier: 2,
9420
+ idempotent: false,
9421
+ sessionRequired: false,
9422
+ requiredParams: ['provider'],
9423
+ params: [
9424
+ {
9425
+ name: 'provider',
9426
+ type: 'string',
9427
+ required: true,
9428
+ description: 'Service provider key (e.g. github, google, notion).',
9429
+ },
9430
+ {
9431
+ name: 'label',
9432
+ type: 'string',
9433
+ required: false,
9434
+ description: "Connection label, unique within the provider. Defaults to 'default'.",
9435
+ },
9436
+ {
9437
+ name: 'token',
9438
+ type: 'string',
9439
+ required: false,
9440
+ description: 'Direct access token to store (token-direct mode). SECRET — never echoed.',
9441
+ },
9442
+ {
9443
+ name: 'refreshToken',
9444
+ type: 'string',
9445
+ required: false,
9446
+ description: 'Optional refresh token paired with --token. SECRET.',
9447
+ },
9448
+ {
9449
+ name: 'expiresAt',
9450
+ type: 'string',
9451
+ required: false,
9452
+ description: 'ISO-8601 access-token expiry (token-direct mode).',
9453
+ },
9454
+ {
9455
+ name: 'code',
9456
+ type: 'string',
9457
+ required: false,
9458
+ description: 'OAuth authorization code from the redirect callback (paste-code mode).',
9459
+ },
9460
+ {
9461
+ name: 'codeVerifier',
9462
+ type: 'string',
9463
+ required: false,
9464
+ description: 'PKCE code verifier from service.auth-url, round-tripped (paste-code mode).',
9465
+ },
9466
+ {
9467
+ name: 'redirectUri',
9468
+ type: 'string',
9469
+ required: false,
9470
+ description: 'Redirect URI used in service.auth-url; must match (paste-code mode).',
9471
+ },
9472
+ ] satisfies ParamDef[],
9473
+ },
9474
+ {
9475
+ gateway: 'query',
9476
+ domain: 'service',
9477
+ operation: 'list',
9478
+ description:
9479
+ 'service.list (query) — list service connections as NON-SECRET views (provider/label/status/scopes/expiresAt/hasCredentials). The decrypted token is NEVER surfaced.',
9480
+ tier: 2,
9481
+ idempotent: true,
9482
+ sessionRequired: false,
9483
+ requiredParams: [],
9484
+ params: [
9485
+ {
9486
+ name: 'provider',
9487
+ type: 'string',
9488
+ required: false,
9489
+ description: 'Optional provider filter; lists all providers when omitted.',
9490
+ },
9491
+ ] satisfies ParamDef[],
9492
+ },
9493
+ {
9494
+ gateway: 'mutate',
9495
+ domain: 'service',
9496
+ operation: 'revoke',
9497
+ description:
9498
+ 'service.revoke (mutate) — DELETE a service connection and CASCADE its agent_service_grants. Returns the {count, deleted, grantsRemoved} envelope (count=0 when no such connection).',
9499
+ tier: 2,
9500
+ idempotent: false,
9501
+ sessionRequired: false,
9502
+ requiredParams: ['provider', 'label'],
9503
+ params: [
9504
+ { name: 'provider', type: 'string', required: true, description: 'Service provider key.' },
9505
+ {
9506
+ name: 'label',
9507
+ type: 'string',
9508
+ required: true,
9509
+ description: 'Connection label to revoke.',
9510
+ },
9511
+ ] satisfies ParamDef[],
9512
+ },
9513
+ {
9514
+ gateway: 'query',
9515
+ domain: 'service',
9516
+ operation: 'status',
9517
+ description:
9518
+ 'service.status (query) — report connection health: each connection adds `expired` + `needsRefresh` booleans computed from expires_at. NON-SECRET; never surfaces a token.',
9519
+ tier: 2,
9520
+ idempotent: true,
9521
+ sessionRequired: false,
9522
+ requiredParams: [],
9523
+ params: [
9524
+ {
9525
+ name: 'provider',
9526
+ type: 'string',
9527
+ required: false,
9528
+ description: 'Optional provider filter; reports all connections when omitted.',
9529
+ },
9530
+ ] satisfies ParamDef[],
9531
+ },
9532
+
9533
+ // ── 5-entity provider experience (T11700 · epic T11666 · North-Star §2) ──
9534
+ // The addressable Provider / Alias / Account / Model / Profile surface. Each op
9535
+ // dispatches to the CORE entity-ops layer (llm/entity-ops.ts), which is a thin
9536
+ // composition over the ALREADY-MERGED accessors: the credential pool
9537
+ // (account.* — secret-bearing, redacted to tokenPreview), the declarative
9538
+ // `providers` table (#1039), the `models_catalog` table (#1037), and the
9539
+ // resolver-consumed `llm.profiles[name]` config (profile.*). The secret-bearing
9540
+ // ops carry NO `mcpExposed` flag → they are MCP-default-denied (AC5/AC7); read
9541
+ // ops are also unary CLI/RPC/HTTP (no `mcpExposed`), keeping the MCP surface
9542
+ // curated. INPUT + OUTPUT contracts live in contracts/operations/entities.ts.
9543
+
9544
+ // account.* — the credential pool (the rename/successor of the secret-bearing
9545
+ // `llm` pool ops). `account.add` is SECRET-BEARING (cli-only; MCP-denied).
9546
+ {
9547
+ gateway: 'mutate',
9548
+ domain: 'account',
9549
+ operation: 'add',
9550
+ description:
9551
+ 'account.add (mutate) — store a pooled provider credential. SECRET-BEARING (cli-only): accepts an API key / OAuth token and persists it encrypted; returns the NON-SECRET redacted view (tokenPreview last-4 ONLY — never the raw secret).',
9552
+ tier: 2,
9553
+ idempotent: false,
9554
+ sessionRequired: false,
9555
+ requiredParams: ['provider', 'token'],
9556
+ params: [
9557
+ {
9558
+ name: 'provider',
9559
+ type: 'string',
9560
+ required: true,
9561
+ description: 'LLM provider transport key (e.g. anthropic, openai).',
9562
+ cli: { positional: true },
9563
+ },
9564
+ {
9565
+ name: 'token',
9566
+ type: 'string',
9567
+ required: true,
9568
+ description: 'API key or OAuth bearer token to persist. SECRET — never echoed.',
9569
+ },
9570
+ {
9571
+ name: 'label',
9572
+ type: 'string',
9573
+ required: false,
9574
+ description: "Account label, unique within the provider (default: 'default').",
9575
+ },
9576
+ {
9577
+ name: 'baseUrl',
9578
+ type: 'string',
9579
+ required: false,
9580
+ description: 'Optional override for the provider base URL.',
9581
+ },
9582
+ {
9583
+ name: 'authType',
9584
+ type: 'string',
9585
+ required: false,
9586
+ description: "Explicit auth-type override ('api_key' | 'oauth' | 'aws_sdk').",
9587
+ },
9588
+ {
9589
+ name: 'priority',
9590
+ type: 'number',
9591
+ required: false,
9592
+ description: 'Optional priority override (lower wins).',
9593
+ },
9594
+ ] satisfies ParamDef[],
9595
+ },
9596
+ {
9597
+ gateway: 'query',
9598
+ domain: 'account',
9599
+ operation: 'list',
9600
+ description:
9601
+ 'account.list (query) — list pooled accounts as NON-SECRET redacted views (provider/label/authType/tokenPreview). The decrypted secret is NEVER surfaced.',
9602
+ tier: 2,
9603
+ idempotent: true,
9604
+ sessionRequired: false,
9605
+ requiredParams: [],
9606
+ params: [
9607
+ {
9608
+ name: 'provider',
9609
+ type: 'string',
9610
+ required: false,
9611
+ description: 'Optional provider filter; lists all providers when omitted.',
9612
+ },
9613
+ ] satisfies ParamDef[],
9614
+ },
9615
+ {
9616
+ gateway: 'mutate',
9617
+ domain: 'account',
9618
+ operation: 'remove',
9619
+ description:
9620
+ 'account.remove (mutate) — delete a (provider, label) account from the pool. Returns the {count, deleted} envelope (count=0 when absent — idempotent).',
9621
+ tier: 2,
9622
+ idempotent: true,
9623
+ sessionRequired: false,
9624
+ requiredParams: ['provider', 'label'],
9625
+ params: [
9626
+ {
9627
+ name: 'provider',
9628
+ type: 'string',
9629
+ required: true,
9630
+ description: 'LLM provider transport key.',
9631
+ cli: { positional: true },
9632
+ },
9633
+ {
9634
+ name: 'label',
9635
+ type: 'string',
9636
+ required: true,
9637
+ description: 'Account label to remove.',
9638
+ },
9639
+ ] satisfies ParamDef[],
9640
+ },
9641
+
9642
+ // provider.* — the declarative `providers` table (#1039) + alias resolution.
9643
+ {
9644
+ gateway: 'query',
9645
+ domain: 'provider',
9646
+ operation: 'list',
9647
+ description:
9648
+ 'provider.list (query) — list every declarative provider as a NON-SECRET view (id/displayName/aliases/authMethods/modelsDevId) from the providers table.',
9649
+ tier: 1,
9650
+ idempotent: true,
9651
+ sessionRequired: false,
9652
+ requiredParams: [],
9653
+ params: [] satisfies ParamDef[],
9654
+ },
9655
+ {
9656
+ gateway: 'query',
9657
+ domain: 'provider',
9658
+ operation: 'show',
9659
+ description:
9660
+ 'provider.show (query) — resolve ONE provider by id OR case-insensitive alias against the declarative alias index; returns the provider view + the id/alias matched.',
9661
+ tier: 1,
9662
+ idempotent: true,
9663
+ sessionRequired: false,
9664
+ requiredParams: ['provider'],
9665
+ params: [
9666
+ {
9667
+ name: 'provider',
9668
+ type: 'string',
9669
+ required: true,
9670
+ description: 'Provider id OR a case-insensitive alias.',
9671
+ cli: { positional: true },
9672
+ },
9673
+ ] satisfies ParamDef[],
9674
+ },
9675
+ {
9676
+ gateway: 'mutate',
9677
+ domain: 'provider',
9678
+ operation: 'connect',
9679
+ description:
9680
+ 'provider.connect (mutate) — connect a provider by storing a token as one of its accounts (token-direct). SECRET-BEARING (cli-only): resolves the provider (id/alias) then delegates to the secret-bearing account write; returns the NON-SECRET account identity (never the raw token). OAuth flows route through `cleo service`.',
9681
+ tier: 2,
9682
+ idempotent: false,
9683
+ sessionRequired: false,
9684
+ requiredParams: ['provider'],
9685
+ params: [
9686
+ {
9687
+ name: 'provider',
9688
+ type: 'string',
9689
+ required: true,
9690
+ description: 'Provider id or alias to connect.',
9691
+ cli: { positional: true },
9692
+ },
9693
+ {
9694
+ name: 'token',
9695
+ type: 'string',
9696
+ required: false,
9697
+ description: 'Direct API key / bearer token to store (token-direct mode). SECRET.',
9698
+ },
9699
+ {
9700
+ name: 'label',
9701
+ type: 'string',
9702
+ required: false,
9703
+ description: "Account label to create (default: 'default').",
9704
+ },
9705
+ {
9706
+ name: 'authType',
9707
+ type: 'string',
9708
+ required: false,
9709
+ description: "Explicit auth-type override ('api_key' | 'oauth' | 'aws_sdk').",
9710
+ },
9711
+ ] satisfies ParamDef[],
9712
+ },
9713
+
9714
+ // model.* — the models.dev catalog (`models_catalog` table, #1037). QUERY-ONLY.
9715
+ {
9716
+ gateway: 'query',
9717
+ domain: 'model',
9718
+ operation: 'query',
9719
+ description:
9720
+ 'model.query (query) — read the models.dev catalog (models_catalog table) newest-first by release date; optionally filtered by provider (models.dev id) and capped by --limit. Returns NON-SECRET catalog views.',
9721
+ tier: 1,
9722
+ idempotent: true,
9723
+ sessionRequired: false,
9724
+ requiredParams: [],
9725
+ params: [
9726
+ {
9727
+ name: 'provider',
9728
+ type: 'string',
9729
+ required: false,
9730
+ description:
9731
+ 'Optional provider filter (models.dev id); queries all providers when omitted.',
9732
+ },
9733
+ {
9734
+ name: 'limit',
9735
+ type: 'number',
9736
+ required: false,
9737
+ description: 'Optional cap on the number of rows returned (newest-first).',
9738
+ },
9739
+ ] satisfies ParamDef[],
9740
+ },
9741
+ {
9742
+ gateway: 'query',
9743
+ domain: 'model',
9744
+ operation: 'show',
9745
+ description:
9746
+ 'model.show (query) — resolve ONE catalog model by id; returns {found, model} (found=false when the id is absent — not an error).',
9747
+ tier: 1,
9748
+ idempotent: true,
9749
+ sessionRequired: false,
9750
+ requiredParams: ['model'],
9751
+ params: [
9752
+ {
9753
+ name: 'model',
9754
+ type: 'string',
9755
+ required: true,
9756
+ description: 'Model id (catalog key) to resolve.',
9757
+ cli: { positional: true },
9758
+ },
9759
+ ] satisfies ParamDef[],
9760
+ },
9761
+
9762
+ // profile.* — the named binding account+model[+params+role], persisted into
9763
+ // `llm.profiles[name]` (the resolver-consumed config SSoT).
9764
+ {
9765
+ gateway: 'mutate',
9766
+ domain: 'profile',
9767
+ operation: 'create',
9768
+ description:
9769
+ 'profile.create (mutate) — bind an account + model into a named, addressable profile. Validates the binding (the pinned account must exist; the model must be in the catalog) then persists into llm.profiles[name]. Returns {count, created, profile}.',
9770
+ tier: 2,
9771
+ idempotent: false,
9772
+ sessionRequired: false,
9773
+ requiredParams: ['name', 'provider', 'model'],
9774
+ params: [
9775
+ {
9776
+ name: 'name',
9777
+ type: 'string',
9778
+ required: true,
9779
+ description: 'Profile name (the addressable handle).',
9780
+ cli: { positional: true },
9781
+ },
9782
+ {
9783
+ name: 'provider',
9784
+ type: 'string',
9785
+ required: true,
9786
+ description: 'Provider transport the bound account belongs to.',
9787
+ },
9788
+ {
9789
+ name: 'model',
9790
+ type: 'string',
9791
+ required: true,
9792
+ description: 'Model id to bind (validated against the catalog).',
9793
+ },
9794
+ {
9795
+ name: 'label',
9796
+ type: 'string',
9797
+ required: false,
9798
+ description: 'Account label to pin (the credential binding). Validated to exist.',
9799
+ },
9800
+ {
9801
+ name: 'role',
9802
+ type: 'string',
9803
+ required: false,
9804
+ description: 'Optional role this profile occupies (extraction | consolidation | …).',
9805
+ },
9806
+ ] satisfies ParamDef[],
9807
+ },
9808
+ {
9809
+ gateway: 'query',
9810
+ domain: 'profile',
9811
+ operation: 'list',
9812
+ description:
9813
+ 'profile.list (query) — list every named profile from llm.profiles (name + provider + model + optional credentialLabel).',
9814
+ tier: 2,
9815
+ idempotent: true,
9816
+ sessionRequired: false,
9817
+ requiredParams: [],
9818
+ params: [] satisfies ParamDef[],
9819
+ },
9820
+ {
9821
+ gateway: 'mutate',
9822
+ domain: 'profile',
9823
+ operation: 'pin',
9824
+ description:
9825
+ 'profile.pin (mutate) — pin a role to a named profile (llm.roles[role].profile). The role must be a valid background role and the profile must already exist.',
9826
+ tier: 2,
9827
+ idempotent: true,
9828
+ sessionRequired: false,
9829
+ requiredParams: ['name', 'role'],
9830
+ params: [
9831
+ {
9832
+ name: 'name',
9833
+ type: 'string',
9834
+ required: true,
9835
+ description: 'Profile name to pin (must exist).',
9836
+ cli: { positional: true },
9837
+ },
9838
+ {
9839
+ name: 'role',
9840
+ type: 'string',
9841
+ required: true,
9842
+ description: 'Role to pin to this profile (extraction | consolidation | derivation | …).',
9843
+ },
9844
+ ] satisfies ParamDef[],
9845
+ },
9846
+ {
9847
+ gateway: 'mutate',
9848
+ domain: 'profile',
9849
+ operation: 'use',
9850
+ description:
9851
+ 'profile.use (mutate) — set a named profile as the global default binding (llm.defaultProfile). The profile must already exist.',
9852
+ tier: 2,
9853
+ idempotent: true,
9854
+ sessionRequired: false,
9855
+ requiredParams: ['name'],
9856
+ params: [
9857
+ {
9858
+ name: 'name',
9859
+ type: 'string',
9860
+ required: true,
9861
+ description: 'Profile name to mark as default (must exist).',
9862
+ cli: { positional: true },
9863
+ },
9864
+ ] satisfies ParamDef[],
9865
+ },
8959
9866
  ];