@synap-core/cli 1.8.0 → 1.11.0

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 (372) hide show
  1. package/dist/commands/agent-chat.d.ts +47 -0
  2. package/dist/commands/agent-chat.js +250 -0
  3. package/dist/commands/agent-chat.js.map +1 -0
  4. package/dist/commands/agent-run.js +3 -4
  5. package/dist/commands/agent-run.js.map +1 -1
  6. package/dist/commands/agents.js +85 -46
  7. package/dist/commands/agents.js.map +1 -1
  8. package/dist/commands/automation.js +2 -1
  9. package/dist/commands/automation.js.map +1 -1
  10. package/dist/commands/bridge-setup.d.ts +66 -0
  11. package/dist/commands/bridge-setup.js +1112 -0
  12. package/dist/commands/bridge-setup.js.map +1 -0
  13. package/dist/commands/cap-connections.d.ts +28 -0
  14. package/dist/commands/cap-connections.js +224 -0
  15. package/dist/commands/cap-connections.js.map +1 -0
  16. package/dist/commands/capability.d.ts +89 -0
  17. package/dist/commands/capability.js +1594 -0
  18. package/dist/commands/capability.js.map +1 -0
  19. package/dist/commands/centrality.d.ts +20 -0
  20. package/dist/commands/centrality.js +95 -0
  21. package/dist/commands/centrality.js.map +1 -0
  22. package/dist/commands/connect.d.ts +2 -0
  23. package/dist/commands/connect.js +16 -35
  24. package/dist/commands/connect.js.map +1 -1
  25. package/dist/commands/context.js +6 -7
  26. package/dist/commands/context.js.map +1 -1
  27. package/dist/commands/data-extra.d.ts +1 -0
  28. package/dist/commands/data-extra.js +41 -14
  29. package/dist/commands/data-extra.js.map +1 -1
  30. package/dist/commands/data.d.ts +4 -4
  31. package/dist/commands/data.js +254 -187
  32. package/dist/commands/data.js.map +1 -1
  33. package/dist/commands/diagnose.d.ts +20 -0
  34. package/dist/commands/diagnose.js +186 -0
  35. package/dist/commands/diagnose.js.map +1 -0
  36. package/dist/commands/digest.d.ts +17 -0
  37. package/dist/commands/digest.js +122 -0
  38. package/dist/commands/digest.js.map +1 -0
  39. package/dist/commands/discover.d.ts +2 -0
  40. package/dist/commands/discover.js +25 -8
  41. package/dist/commands/discover.js.map +1 -1
  42. package/dist/commands/doc.d.ts +14 -0
  43. package/dist/commands/doc.js +61 -4
  44. package/dist/commands/doc.js.map +1 -1
  45. package/dist/commands/doctor.d.ts +21 -0
  46. package/dist/commands/doctor.js +189 -0
  47. package/dist/commands/doctor.js.map +1 -0
  48. package/dist/commands/events.js +5 -2
  49. package/dist/commands/events.js.map +1 -1
  50. package/dist/commands/explain.d.ts +1 -1
  51. package/dist/commands/explain.js +18 -15
  52. package/dist/commands/explain.js.map +1 -1
  53. package/dist/commands/facet.d.ts +29 -0
  54. package/dist/commands/facet.js +113 -0
  55. package/dist/commands/facet.js.map +1 -0
  56. package/dist/commands/graph.js +7 -4
  57. package/dist/commands/graph.js.map +1 -1
  58. package/dist/commands/import.d.ts +38 -0
  59. package/dist/commands/import.js +471 -0
  60. package/dist/commands/import.js.map +1 -0
  61. package/dist/commands/init.js +35 -16
  62. package/dist/commands/init.js.map +1 -1
  63. package/dist/commands/keys.js +3 -4
  64. package/dist/commands/keys.js.map +1 -1
  65. package/dist/commands/knowledge.d.ts +8 -0
  66. package/dist/commands/knowledge.js +308 -33
  67. package/dist/commands/knowledge.js.map +1 -1
  68. package/dist/commands/launch.d.ts +50 -0
  69. package/dist/commands/launch.js +790 -0
  70. package/dist/commands/launch.js.map +1 -0
  71. package/dist/commands/lens.d.ts +45 -0
  72. package/dist/commands/lens.js +386 -0
  73. package/dist/commands/lens.js.map +1 -0
  74. package/dist/commands/market-authoring.d.ts +45 -0
  75. package/dist/commands/market-authoring.js +225 -0
  76. package/dist/commands/market-authoring.js.map +1 -0
  77. package/dist/commands/market.d.ts +224 -0
  78. package/dist/commands/market.js +1643 -0
  79. package/dist/commands/market.js.map +1 -0
  80. package/dist/commands/mcp.d.ts +64 -0
  81. package/dist/commands/mcp.js +265 -0
  82. package/dist/commands/mcp.js.map +1 -0
  83. package/dist/commands/observe.js +14 -11
  84. package/dist/commands/observe.js.map +1 -1
  85. package/dist/commands/open.d.ts +21 -4
  86. package/dist/commands/open.js +45 -4
  87. package/dist/commands/open.js.map +1 -1
  88. package/dist/commands/pod.d.ts +100 -0
  89. package/dist/commands/pod.js +359 -0
  90. package/dist/commands/pod.js.map +1 -0
  91. package/dist/commands/pods.d.ts +15 -0
  92. package/dist/commands/pods.js +233 -17
  93. package/dist/commands/pods.js.map +1 -1
  94. package/dist/commands/proposals-actions.js +43 -3
  95. package/dist/commands/proposals-actions.js.map +1 -1
  96. package/dist/commands/purge.d.ts +23 -0
  97. package/dist/commands/purge.js +148 -0
  98. package/dist/commands/purge.js.map +1 -0
  99. package/dist/commands/raycast.d.ts +15 -0
  100. package/dist/commands/raycast.js +153 -0
  101. package/dist/commands/raycast.js.map +1 -0
  102. package/dist/commands/sessions.js +47 -22
  103. package/dist/commands/sessions.js.map +1 -1
  104. package/dist/commands/skill-manage.d.ts +21 -0
  105. package/dist/commands/skill-manage.js +195 -0
  106. package/dist/commands/skill-manage.js.map +1 -0
  107. package/dist/commands/skills-commands.js +2 -1
  108. package/dist/commands/skills-commands.js.map +1 -1
  109. package/dist/commands/skills.js +7 -4
  110. package/dist/commands/skills.js.map +1 -1
  111. package/dist/commands/status.d.ts +3 -1
  112. package/dist/commands/status.js +166 -14
  113. package/dist/commands/status.js.map +1 -1
  114. package/dist/commands/statusline.d.ts +24 -0
  115. package/dist/commands/statusline.js +450 -0
  116. package/dist/commands/statusline.js.map +1 -0
  117. package/dist/commands/subscribe.js +2 -2
  118. package/dist/commands/subscribe.js.map +1 -1
  119. package/dist/commands/template.d.ts +42 -0
  120. package/dist/commands/template.js +191 -0
  121. package/dist/commands/template.js.map +1 -0
  122. package/dist/commands/tools.d.ts +30 -0
  123. package/dist/commands/tools.js +315 -0
  124. package/dist/commands/tools.js.map +1 -0
  125. package/dist/commands/upload.d.ts +30 -0
  126. package/dist/commands/upload.js +155 -0
  127. package/dist/commands/upload.js.map +1 -0
  128. package/dist/commands/versions.d.ts +27 -0
  129. package/dist/commands/versions.js +277 -0
  130. package/dist/commands/versions.js.map +1 -0
  131. package/dist/commands/view.js +3 -2
  132. package/dist/commands/view.js.map +1 -1
  133. package/dist/commands/whoami.d.ts +21 -0
  134. package/dist/commands/whoami.js +129 -0
  135. package/dist/commands/whoami.js.map +1 -0
  136. package/dist/index.js +894 -60
  137. package/dist/index.js.map +1 -1
  138. package/dist/lib/approval-poll.d.ts +42 -0
  139. package/dist/lib/approval-poll.js +52 -0
  140. package/dist/lib/approval-poll.js.map +1 -0
  141. package/dist/lib/auth.d.ts +29 -6
  142. package/dist/lib/auth.js +105 -94
  143. package/dist/lib/auth.js.map +1 -1
  144. package/dist/lib/bundle-version.d.ts +11 -0
  145. package/dist/lib/bundle-version.js +33 -0
  146. package/dist/lib/bundle-version.js.map +1 -0
  147. package/dist/lib/capture-lane.d.ts +30 -12
  148. package/dist/lib/capture-lane.js +73 -14
  149. package/dist/lib/capture-lane.js.map +1 -1
  150. package/dist/lib/capture-structure.d.ts +123 -0
  151. package/dist/lib/capture-structure.js +57 -0
  152. package/dist/lib/capture-structure.js.map +1 -0
  153. package/dist/lib/cp-packages.d.ts +177 -0
  154. package/dist/lib/cp-packages.js +389 -0
  155. package/dist/lib/cp-packages.js.map +1 -0
  156. package/dist/lib/describe-lens.d.ts +46 -0
  157. package/dist/lib/describe-lens.js +33 -0
  158. package/dist/lib/describe-lens.js.map +1 -0
  159. package/dist/lib/hub-client.d.ts +91 -1
  160. package/dist/lib/hub-client.js +565 -22
  161. package/dist/lib/hub-client.js.map +1 -1
  162. package/dist/lib/id.d.ts +23 -0
  163. package/dist/lib/id.js +35 -0
  164. package/dist/lib/id.js.map +1 -0
  165. package/dist/lib/installed.d.ts +51 -0
  166. package/dist/lib/installed.js +70 -0
  167. package/dist/lib/installed.js.map +1 -0
  168. package/dist/lib/next-steps.d.ts +61 -0
  169. package/dist/lib/next-steps.js +146 -0
  170. package/dist/lib/next-steps.js.map +1 -0
  171. package/dist/lib/pod.d.ts +144 -22
  172. package/dist/lib/pod.js +302 -64
  173. package/dist/lib/pod.js.map +1 -1
  174. package/dist/lib/project-ref.d.ts +95 -0
  175. package/dist/lib/project-ref.js +144 -0
  176. package/dist/lib/project-ref.js.map +1 -0
  177. package/dist/lib/project.d.ts +35 -0
  178. package/dist/lib/project.js +39 -0
  179. package/dist/lib/project.js.map +1 -0
  180. package/dist/lib/session-lens.d.ts +33 -0
  181. package/dist/lib/session-lens.js +76 -0
  182. package/dist/lib/session-lens.js.map +1 -0
  183. package/dist/lib/skill-import.d.ts +40 -0
  184. package/dist/lib/skill-import.js +203 -0
  185. package/dist/lib/skill-import.js.map +1 -0
  186. package/dist/lib/skills-installer.d.ts +17 -6
  187. package/dist/lib/skills-installer.js +133 -19
  188. package/dist/lib/skills-installer.js.map +1 -1
  189. package/dist/lib/suite.d.ts +28 -0
  190. package/dist/lib/suite.js +29 -0
  191. package/dist/lib/suite.js.map +1 -0
  192. package/dist/lib/superwhisper-import.d.ts +40 -0
  193. package/dist/lib/superwhisper-import.js +389 -0
  194. package/dist/lib/superwhisper-import.js.map +1 -0
  195. package/dist/lib/targets.d.ts +49 -1
  196. package/dist/lib/targets.js +420 -288
  197. package/dist/lib/targets.js.map +1 -1
  198. package/dist/lib/template-file.d.ts +74 -0
  199. package/dist/lib/template-file.js +140 -0
  200. package/dist/lib/template-file.js.map +1 -0
  201. package/dist/lib/unwrapList.d.ts +1 -0
  202. package/dist/lib/unwrapList.js +20 -0
  203. package/dist/lib/unwrapList.js.map +1 -0
  204. package/dist/utils/logger.d.ts +2 -0
  205. package/dist/utils/logger.js +10 -2
  206. package/dist/utils/logger.js.map +1 -1
  207. package/node_modules/@synap/hub-rest-client/dist/index.cjs +414 -34
  208. package/node_modules/@synap/hub-rest-client/dist/index.d.cts +762 -22
  209. package/node_modules/@synap/hub-rest-client/dist/index.d.ts +762 -22
  210. package/node_modules/@synap/hub-rest-client/dist/index.js +414 -34
  211. package/node_modules/@synap/hub-rest-client/package.json +1 -1
  212. package/node_modules/@synap/hub-rest-client/src/client.ts +525 -37
  213. package/node_modules/@synap/hub-rest-client/src/index.ts +42 -0
  214. package/node_modules/@synap/hub-rest-client/src/setup.ts +57 -1
  215. package/node_modules/@synap/hub-rest-client/src/types.ts +697 -37
  216. package/package.json +11 -5
  217. package/skills/agent-os/SKILL.md +218 -0
  218. package/skills/manifest.json +5 -0
  219. package/skills/onboard/SKILL.md +193 -0
  220. package/skills/synap/SKILL.md +1284 -58
  221. package/skills/synap/_order.txt +37 -0
  222. package/skills/synap/_skill.yaml +24 -0
  223. package/skills/synap/authentication.md +10 -0
  224. package/skills/synap/automations.md +264 -0
  225. package/skills/synap/capabilities.md +107 -0
  226. package/skills/synap/capture.md +50 -142
  227. package/skills/synap/cli-operations.md +107 -0
  228. package/skills/synap/common-mistakes.md +13 -0
  229. package/skills/synap/content-os.md +83 -0
  230. package/skills/synap/creative-loop.md +43 -0
  231. package/skills/synap/crm.md +117 -0
  232. package/skills/synap/diagnostics.md +35 -0
  233. package/skills/synap/digesting-a-channel.md +63 -0
  234. package/skills/synap/document-embeds.md +123 -0
  235. package/skills/synap/escalation-ladder.md +71 -0
  236. package/skills/synap/focus-sessions.md +47 -0
  237. package/skills/synap/governance-rules.md +64 -0
  238. package/skills/synap/governance.md +6 -6
  239. package/skills/synap/graph-gardening.md +21 -0
  240. package/skills/synap/inline-patterns.md +38 -0
  241. package/skills/synap/lenses.md +38 -0
  242. package/skills/synap/linking-principle.md +39 -0
  243. package/skills/synap/linking.md +1 -0
  244. package/skills/synap/mental-model.md +45 -0
  245. package/skills/synap/more.md +7 -0
  246. package/skills/synap/multi-entity-capture.md +12 -0
  247. package/skills/synap/next-action.md +37 -0
  248. package/skills/synap/north-star.md +17 -0
  249. package/skills/synap/operating-mode-rules.md +45 -0
  250. package/skills/synap/operating-mode.md +9 -0
  251. package/skills/synap/quick-reference.md +67 -0
  252. package/skills/synap/reading.md +43 -0
  253. package/skills/synap/recap.md +21 -0
  254. package/skills/synap/reflexes.md +46 -0
  255. package/skills/synap/response-style.md +21 -0
  256. package/skills/synap/scope.md +13 -0
  257. package/skills/synap/showing.md +17 -0
  258. package/skills/synap/user-model.md +25 -0
  259. package/skills/synap/viewframe-cells.md +290 -0
  260. package/skills/synap/work-flow.md +113 -0
  261. package/skills/synap/worked-examples.md +74 -0
  262. package/skills/synap/workspace-design.md +45 -0
  263. package/skills/synap/workspace-edges.md +49 -0
  264. package/skills/synap/writes.md +213 -0
  265. package/skills/synap-app/SKILL.md +319 -0
  266. package/skills/synap-app/_order.txt +5 -0
  267. package/skills/synap-app/_skill.yaml +20 -0
  268. package/skills/synap-app/creating-the-base-app.md +64 -0
  269. package/skills/synap-app/governance.md +42 -0
  270. package/skills/synap-app/install-commands.md +55 -0
  271. package/skills/synap-app/overview.md +50 -0
  272. package/skills/synap-app/using-the-sdk.md +73 -0
  273. package/skills/synap-market/SKILL.md +335 -0
  274. package/skills/synap-market/_order.txt +5 -0
  275. package/skills/synap-market/_skill.yaml +24 -0
  276. package/skills/synap-market/author-and-publish.md +75 -0
  277. package/skills/synap-market/discover-and-fetch.md +59 -0
  278. package/skills/synap-market/governance-and-catalog.md +56 -0
  279. package/skills/synap-market/install.md +55 -0
  280. package/skills/synap-market/overview.md +51 -0
  281. package/skills/synap-schema/SKILL.md +97 -6
  282. package/skills/synap-schema/_order.txt +13 -0
  283. package/skills/synap-schema/_skill.yaml +22 -0
  284. package/skills/synap-schema/before-you-touch.md +14 -0
  285. package/skills/synap-schema/common-mistakes.md +9 -0
  286. package/skills/synap-schema/creating-profiles.md +17 -0
  287. package/skills/synap-schema/discover-profiles.md +24 -0
  288. package/skills/synap-schema/entity-scope.md +8 -0
  289. package/skills/synap-schema/extend-vs-create.md +31 -0
  290. package/skills/synap-schema/more.md +6 -0
  291. package/skills/synap-schema/overlay-properties.md +22 -0
  292. package/skills/synap-schema/profiles.md +3 -0
  293. package/skills/synap-schema/property-defs.md +29 -0
  294. package/skills/synap-schema/read-before-write.md +50 -0
  295. package/skills/synap-schema/relations.md +18 -0
  296. package/skills/synap-schema/worked-example.md +30 -0
  297. package/skills/synap-ui/SKILL.md +26 -2
  298. package/skills/synap-ui/_order.txt +13 -0
  299. package/skills/synap-ui/_skill.yaml +23 -0
  300. package/skills/synap-ui/ai-companion.md +27 -0
  301. package/skills/synap-ui/arranging-bento.md +8 -0
  302. package/skills/synap-ui/before-you-build.md +20 -0
  303. package/skills/synap-ui/bento-layouts.md +35 -0
  304. package/skills/synap-ui/common-mistakes.md +10 -0
  305. package/skills/synap-ui/creating-views.md +26 -0
  306. package/skills/synap-ui/four-builds.md +24 -0
  307. package/skills/synap-ui/more.md +7 -0
  308. package/skills/synap-ui/proposing-vs-extending.md +11 -0
  309. package/skills/synap-ui/view-list.md +24 -0
  310. package/skills/synap-ui/views.md +3 -0
  311. package/skills/synap-ui/worked-example.md +18 -0
  312. package/skills/synap-ui/workspaces.md +47 -0
  313. package/templates/automations/bookmark-enrichment.automation.json +44 -0
  314. package/templates/automations/mail-feed.automation.json +86 -0
  315. package/templates/automations/url-bookmark-capture.automation.json +70 -0
  316. package/templates/skills/README.md +21 -0
  317. package/templates/skills/authoring-automations/SKILL.md +95 -0
  318. package/templates/skills/authoring-automations/reference/node-matrix.md +49 -0
  319. package/templates/skills/authoring-capabilities/SKILL.md +93 -0
  320. package/templates/skills/authoring-capabilities/reference/template-anatomy.md +70 -0
  321. package/templates/skills/authoring-playbooks/SKILL.md +102 -0
  322. package/templates/skills/authoring-playbooks/reference/stages-contract.md +35 -0
  323. package/templates/skills/authoring-playbooks/reference/worked-example.md +64 -0
  324. package/templates/skills/bookmark-enrichment/SKILL.md +40 -0
  325. package/templates/skills/coordinating-agents/SKILL.md +32 -0
  326. package/templates/skills/coordinating-branches/SKILL.md +27 -0
  327. package/templates/skills/mapping-the-server/SKILL.md +54 -0
  328. package/templates/skills/reading-client-progress/SKILL.md +65 -0
  329. package/templates/skills/routing-to-channels/SKILL.md +54 -0
  330. package/templates/skills/stellar-scf-grants-advisor/ASSOCIATE-CHEATSHEET.md +133 -0
  331. package/templates/skills/stellar-scf-grants-advisor/ASSOCIATE-ONBOARDING-GUIDE.md +761 -0
  332. package/templates/skills/stellar-scf-grants-advisor/CLIENT-FAQ.md +181 -0
  333. package/templates/skills/stellar-scf-grants-advisor/PARTNER-HANDOVER.md +130 -0
  334. package/templates/skills/stellar-scf-grants-advisor/SKILL.md +102 -0
  335. package/templates/skills/stellar-scf-grants-advisor/examples/README.md +43 -0
  336. package/templates/skills/stellar-scf-grants-advisor/examples/chat-summary-templates.md +158 -0
  337. package/templates/skills/stellar-scf-grants-advisor/examples/corpus-comparable-rows.md +136 -0
  338. package/templates/skills/stellar-scf-grants-advisor/examples/q10-team-rewrites.md +109 -0
  339. package/templates/skills/stellar-scf-grants-advisor/examples/q2-description-rewrites.md +88 -0
  340. package/templates/skills/stellar-scf-grants-advisor/examples/q6-integration-rewrites.md +107 -0
  341. package/templates/skills/stellar-scf-grants-advisor/examples/tranche-structures.md +176 -0
  342. package/templates/skills/stellar-scf-grants-advisor/reference/01-methodology.md +96 -0
  343. package/templates/skills/stellar-scf-grants-advisor/reference/02-scoring-framework.md +199 -0
  344. package/templates/skills/stellar-scf-grants-advisor/reference/03-rejection-patterns.md +241 -0
  345. package/templates/skills/stellar-scf-grants-advisor/reference/04-winner-patterns.md +120 -0
  346. package/templates/skills/stellar-scf-grants-advisor/reference/05-comeback-patterns.md +92 -0
  347. package/templates/skills/stellar-scf-grants-advisor/reference/06-budget-benchmarks.md +125 -0
  348. package/templates/skills/stellar-scf-grants-advisor/reference/07-integration-list.md +147 -0
  349. package/templates/skills/stellar-scf-grants-advisor/reference/08-abstract-fields.md +258 -0
  350. package/templates/skills/stellar-scf-grants-advisor/reference/09-build-fields.md +259 -0
  351. package/templates/skills/stellar-scf-grants-advisor/reference/10-corpus-winners.md +135 -0
  352. package/templates/skills/stellar-scf-grants-advisor/reference/11-corpus-rejects.md +267 -0
  353. package/templates/skills/stellar-scf-grants-advisor/reference/12-client-communication.md +131 -0
  354. package/templates/skills/stellar-scf-grants-advisor/reference/13-excel-output-spec.md +199 -0
  355. package/templates/skills/stellar-scf-grants-advisor/reference/14-worked-examples.md +160 -0
  356. package/templates/skills/stellar-scf-grants-advisor/templates/abstract-review-builder.py +253 -0
  357. package/templates/skills/stellar-scf-grants-advisor/templates/build-review-builder.py +213 -0
  358. package/dist/commands/connectors.d.ts +0 -31
  359. package/dist/commands/connectors.js +0 -276
  360. package/dist/commands/connectors.js.map +0 -1
  361. package/dist/commands/finish.d.ts +0 -25
  362. package/dist/commands/finish.js +0 -274
  363. package/dist/commands/finish.js.map +0 -1
  364. package/dist/commands/openclaw.d.ts +0 -40
  365. package/dist/commands/openclaw.js +0 -1148
  366. package/dist/commands/openclaw.js.map +0 -1
  367. package/dist/commands/security-audit.d.ts +0 -12
  368. package/dist/commands/security-audit.js +0 -100
  369. package/dist/commands/security-audit.js.map +0 -1
  370. package/dist/lib/hardening.d.ts +0 -18
  371. package/dist/lib/hardening.js +0 -214
  372. package/dist/lib/hardening.js.map +0 -1
@@ -33,6 +33,7 @@ import type {
33
33
  CaptureStructureResponse,
34
34
  CaptureExecuteInput,
35
35
  CaptureExecuteResponse,
36
+ AskResponse,
36
37
  HubDocument,
37
38
  HubRelation,
38
39
  HubGraphResult,
@@ -40,6 +41,9 @@ import type {
40
41
  HubProfile,
41
42
  HubPropertyDef,
42
43
  HubDiscoverResult,
44
+ HubDiscoverOptions,
45
+ HubOrientOptions,
46
+ HubOrientResult,
43
47
  HubThread,
44
48
  HubMessage,
45
49
  HubThreadContext,
@@ -52,9 +56,29 @@ import type {
52
56
  HubGovernanceResult,
53
57
  CreateThreadInput,
54
58
  CreateRelationInput,
59
+ AttachFacetInput,
60
+ HubAttachFacetResult,
55
61
  CreateViewInput,
62
+ UpdateViewInput,
63
+ ArrangeBentoViewInput,
64
+ HubBentoArrangementResult,
56
65
  ExecuteCommandInput,
57
66
  CreateDocumentInput,
67
+ UpdateDocumentInput,
68
+ CreateDocumentProposalInput,
69
+ HubDocumentProposalResult,
70
+ HubCapability,
71
+ HubCapabilityCatalogResult,
72
+ HubRunnableCapabilityActionsResult,
73
+ ExecuteCapabilityInput,
74
+ ExecuteCapabilityResult,
75
+ ListAgentSkillsOptions,
76
+ HubAgentSkillsResult,
77
+ HubAgentSkill,
78
+ GetCapabilityBriefsInput,
79
+ HubCapabilityBriefsResult,
80
+ SubmitCaptureGraphInput,
81
+ SubmitCaptureGraphResult,
58
82
  HubAutomation,
59
83
  CreateAutomationInput,
60
84
  UpdateAutomationInput,
@@ -73,8 +97,17 @@ export interface HubRestClientConfig {
73
97
  apiKey: string;
74
98
  /** Default workspace ID — used when not specified per call */
75
99
  workspaceId?: string;
76
- /** Optional request timeout in ms (default: 30000) */
100
+ /** Optional request timeout in ms (default: 30000). Fallback when read/write timeouts are unset. */
77
101
  timeoutMs?: number;
102
+ /** Optional read (GET) timeout in ms (default: timeoutMs ?? 30000). */
103
+ readTimeoutMs?: number;
104
+ /** Optional write (non-GET) timeout in ms (default: timeoutMs ?? 30000). */
105
+ writeTimeoutMs?: number;
106
+ /**
107
+ * Max attempts for a request (default: 3). Retries ONLY on network failure or
108
+ * 5xx — never on 4xx, never on a caller-provided abort. Set to 1 to disable.
109
+ */
110
+ maxAttempts?: number;
78
111
  }
79
112
 
80
113
  function normalizeUrl(url: string): string {
@@ -108,9 +141,7 @@ function unwrapList<T>(result: T[] | HubListResponse<T>): T[] {
108
141
  /** Hub GET /workspaces returns `{ workspaces }`, not `{ data }`. */
109
142
  function unwrapWorkspacesResponse(
110
143
  result:
111
- | HubWorkspace[]
112
- | HubListResponse<HubWorkspace>
113
- | HubWorkspacesListResponse
144
+ HubWorkspace[] | HubListResponse<HubWorkspace> | HubWorkspacesListResponse
114
145
  ): HubWorkspace[] {
115
146
  if (Array.isArray(result)) return result;
116
147
  if (result && typeof result === "object" && "workspaces" in result) {
@@ -131,6 +162,9 @@ export class HubRestClient {
131
162
  private readonly base: string;
132
163
  private readonly headers: Record<string, string>;
133
164
  private readonly timeoutMs: number;
165
+ private readonly readTimeoutMs: number;
166
+ private readonly writeTimeoutMs: number;
167
+ private readonly maxAttempts: number;
134
168
  readonly workspaceId: string | undefined;
135
169
 
136
170
  /** Cached from GET /users/me — avoids repeated identity calls. */
@@ -144,6 +178,9 @@ export class HubRestClient {
144
178
  };
145
179
  this.workspaceId = config.workspaceId;
146
180
  this.timeoutMs = config.timeoutMs ?? 30_000;
181
+ this.readTimeoutMs = config.readTimeoutMs ?? this.timeoutMs;
182
+ this.writeTimeoutMs = config.writeTimeoutMs ?? this.timeoutMs;
183
+ this.maxAttempts = Math.max(1, config.maxAttempts ?? 3);
147
184
  }
148
185
 
149
186
  /** User id for the current API key (Hub REST requires userId on several GETs). */
@@ -154,33 +191,112 @@ export class HubRestClient {
154
191
  return me.id;
155
192
  }
156
193
 
157
- private async request<T>(
194
+ /**
195
+ * The ONE shared request loop. Per-method timeout (GET = read, else write, or a
196
+ * caller override) + up to `maxAttempts` with exponential backoff. Retries ONLY
197
+ * on a network failure or 5xx; NEVER on a 4xx or a caller abort. Returns the raw
198
+ * `Response` for any non-5xx (ok OR 4xx) — the typed entry points below decide
199
+ * how to interpret it. This is the single source of retry/timeout truth, shared
200
+ * by the CLI and the IS's `ISHubClient` (which reuses the protected entry points
201
+ * rather than re-implementing fetch).
202
+ */
203
+ private async fetchWithRetry(
204
+ method: string,
205
+ path: string,
206
+ body?: unknown,
207
+ signal?: AbortSignal,
208
+ timeoutMsOverride?: number
209
+ ): Promise<Response> {
210
+ const url = `${this.base}${path}`;
211
+ const perAttemptTimeout =
212
+ timeoutMsOverride ??
213
+ (method.toUpperCase() === "GET"
214
+ ? this.readTimeoutMs
215
+ : this.writeTimeoutMs);
216
+
217
+ let lastError: unknown;
218
+ for (let attempt = 0; attempt < this.maxAttempts; attempt++) {
219
+ if (attempt > 0) {
220
+ await new Promise((r) => setTimeout(r, 1_000 * attempt)); // 0, 1s, 2s, …
221
+ }
222
+ const timeout = AbortSignal.timeout(perAttemptTimeout);
223
+ const combined = signal ? AbortSignal.any([signal, timeout]) : timeout;
224
+ try {
225
+ const res = await fetch(url, {
226
+ method,
227
+ headers: this.headers,
228
+ body: body !== undefined ? JSON.stringify(body) : undefined,
229
+ signal: combined,
230
+ });
231
+ if (res.status < 500) return res; // ok or 4xx — caller decides; never retry
232
+ lastError = new Error(`HTTP ${res.status}`); // 5xx — retry until exhausted
233
+ } catch (err) {
234
+ if (signal?.aborted) throw err; // caller asked to abort — honor it
235
+ lastError = err; // network/abort-timeout — retry
236
+ }
237
+ }
238
+ throw lastError;
239
+ }
240
+
241
+ /** Build a HubApiError from a non-ok Response (reads the JSON error body). */
242
+ private async toHubError(res: Response): Promise<HubApiError> {
243
+ const errorBody = await res.json().catch(() => ({}));
244
+ return new HubApiError(
245
+ formatHubErrorMessage(res.status, res.statusText, errorBody),
246
+ res.status,
247
+ errorBody
248
+ );
249
+ }
250
+
251
+ /** Parse a 2xx body, tolerating an empty/204 response (returns undefined). */
252
+ private async parseBody<T>(res: Response): Promise<T> {
253
+ const text = await res.text();
254
+ return (text ? JSON.parse(text) : undefined) as T;
255
+ }
256
+
257
+ /**
258
+ * Typed JSON request — throws `HubApiError` on any non-2xx. Protected so the IS
259
+ * subclass reuses it. Tolerates an empty/204 body (returns `undefined`).
260
+ */
261
+ protected async request<T>(
158
262
  method: string,
159
263
  path: string,
160
264
  body?: unknown,
161
265
  signal?: AbortSignal
162
266
  ): Promise<T> {
163
- const url = `${this.base}${path}`;
164
- const timeout = AbortSignal.timeout(this.timeoutMs);
165
- const combined = signal ? AbortSignal.any([signal, timeout]) : timeout;
166
-
167
- const res = await fetch(url, {
168
- method,
169
- headers: this.headers,
170
- body: body !== undefined ? JSON.stringify(body) : undefined,
171
- signal: combined,
172
- });
267
+ const res = await this.fetchWithRetry(method, path, body, signal);
268
+ if (!res.ok) throw await this.toHubError(res);
269
+ return this.parseBody<T>(res);
270
+ }
173
271
 
174
- if (!res.ok) {
175
- const errorBody = await res.json().catch(() => ({}));
176
- throw new HubApiError(
177
- formatHubErrorMessage(res.status, res.statusText, errorBody),
178
- res.status,
179
- errorBody
180
- );
181
- }
272
+ /**
273
+ * Like `request<T>` but returns `null` on 404/403 (the "absent/forbidden →
274
+ * empty" contract several IS reads use) instead of throwing.
275
+ */
276
+ protected async requestOrNull<T>(
277
+ method: string,
278
+ path: string,
279
+ body?: unknown,
280
+ signal?: AbortSignal
281
+ ): Promise<T | null> {
282
+ const res = await this.fetchWithRetry(method, path, body, signal);
283
+ if (res.status === 404 || res.status === 403) return null;
284
+ if (!res.ok) throw await this.toHubError(res);
285
+ return this.parseBody<T | null>(res);
286
+ }
182
287
 
183
- return res.json() as Promise<T>;
288
+ /**
289
+ * The raw `Response` (same retry/timeout infra), for the few callers that read
290
+ * `.text()`, branch on status themselves, or need a per-call timeout override.
291
+ */
292
+ protected async requestRaw(
293
+ method: string,
294
+ path: string,
295
+ body?: unknown,
296
+ signal?: AbortSignal,
297
+ timeoutMsOverride?: number
298
+ ): Promise<Response> {
299
+ return this.fetchWithRetry(method, path, body, signal, timeoutMsOverride);
184
300
  }
185
301
 
186
302
  // ─── Identity ─────────────────────────────────────────────────────────────
@@ -292,9 +408,22 @@ export class HubRestClient {
292
408
  }
293
409
 
294
410
  async createEntity(input: CreateEntityInput): Promise<HubGovernanceResult> {
411
+ const { content, url, status, priority, dueDate, properties, ...rest } =
412
+ input;
295
413
  return this.request<HubGovernanceResult>("POST", "/api/hub/entities", {
296
- ...input,
297
- workspaceId: input.workspaceId ?? this.workspaceId,
414
+ ...rest,
415
+ // Entity placement is a write decision, never an ambient client default.
416
+ // Omitted means pod/base behavior; an explicit workspace opts into its
417
+ // overlay/membership lens. This deliberately differs from read helpers.
418
+ ...(rest.workspaceId ? { workspaceId: rest.workspaceId } : {}),
419
+ ...(content !== undefined ? { content } : {}),
420
+ properties: {
421
+ ...properties,
422
+ ...(url !== undefined ? { url } : {}),
423
+ ...(status !== undefined ? { status } : {}),
424
+ ...(priority !== undefined ? { priority } : {}),
425
+ ...(dueDate !== undefined ? { dueDate } : {}),
426
+ },
298
427
  });
299
428
  }
300
429
 
@@ -305,10 +434,22 @@ export class HubRestClient {
305
434
  // Backend may return a full entity (approved) or a governance envelope
306
435
  // (proposed/denied). Callers MUST check `status` first when governance
307
436
  // is likely — e.g., agent-owned workspaces, destructive updates.
437
+ const { properties, content, url, status, priority, dueDate, ...rest } =
438
+ input;
308
439
  return this.request<HubEntity | HubGovernanceResult>(
309
440
  "PATCH",
310
441
  `/api/hub/entities/${id}`,
311
- input
442
+ {
443
+ ...rest,
444
+ metadata: {
445
+ ...properties,
446
+ ...(content !== undefined ? { content } : {}),
447
+ ...(url !== undefined ? { url } : {}),
448
+ ...(status !== undefined ? { status } : {}),
449
+ ...(priority !== undefined ? { priority } : {}),
450
+ ...(dueDate !== undefined ? { dueDate } : {}),
451
+ },
452
+ }
312
453
  );
313
454
  }
314
455
 
@@ -389,6 +530,29 @@ export class HubRestClient {
389
530
  });
390
531
  }
391
532
 
533
+ /**
534
+ * Attach a role-profile through the canonical governed facet door. A result
535
+ * may be `proposed`; callers must surface its review information instead of
536
+ * claiming the role was applied.
537
+ */
538
+ async attachFacet(input: AttachFacetInput): Promise<HubAttachFacetResult> {
539
+ const userId = await this.resolveUserId();
540
+ return this.request<HubAttachFacetResult>(
541
+ "POST",
542
+ `/api/hub/entities/${input.entityId}/facets`,
543
+ {
544
+ userId,
545
+ profileSlug: input.profileSlug,
546
+ profileId: input.profileId,
547
+ workspaceId: input.workspaceId ?? this.workspaceId,
548
+ contextEntityId: input.contextEntityId,
549
+ status: input.status,
550
+ properties: input.properties,
551
+ reasoning: input.reasoning,
552
+ }
553
+ );
554
+ }
555
+
392
556
  /**
393
557
  * Delete a relation by ID (get from getRelations()).
394
558
  */
@@ -427,10 +591,10 @@ export class HubRestClient {
427
591
  }
428
592
 
429
593
  /**
430
- * Unified view of everything connected to an entity. Merges three sources:
594
+ * Unified view of everything connected to an entity across the local graph:
431
595
  * 1. Graph relations — explicit rows in the relations table (both directions)
432
- * 2. Structural links — entities whose `entity_id` properties point to this entity
433
- * 3. Thread connections — chat threads that touched this entity
596
+ * 2. Structural links — inbound and outbound `entity_id` property edges
597
+ * 3. Channel and focus-session connections around this entity
434
598
  *
435
599
  * Prefer this over `getRelations()` / `traverseGraph()` when you want the complete
436
600
  * picture — those only see the relations table and miss property-based links that
@@ -457,6 +621,23 @@ export class HubRestClient {
457
621
  );
458
622
  }
459
623
 
624
+ // ─── Session orientation & profile discovery ─────────────────────────────
625
+
626
+ /**
627
+ * Canonical session bootstrap shared by the MCP, CLI, and external surfaces.
628
+ * It is deliberately a lens map, not a profile/schema dump; use discover()
629
+ * only for the selected profiles needed by the next action.
630
+ */
631
+ async orient(options?: HubOrientOptions): Promise<HubOrientResult> {
632
+ const params = new URLSearchParams();
633
+ if (options?.detail) params.set("detail", options.detail);
634
+ if (options?.scope?.length) params.set("scope", options.scope.join(","));
635
+ if (options?.workspaceId) params.set("workspaceId", options.workspaceId);
636
+ if (options?.projectId) params.set("projectId", options.projectId);
637
+ const qs = params.toString() ? `?${params}` : "";
638
+ return this.request<HubOrientResult>("GET", `/api/hub/orient${qs}`);
639
+ }
640
+
460
641
  // ─── Profiles & Schema ────────────────────────────────────────────────────
461
642
 
462
643
  /**
@@ -464,9 +645,13 @@ export class HubRestClient {
464
645
  * Always call before creating entities to discover what types are available.
465
646
  * Returns system profiles (always present) + custom workspace profiles.
466
647
  */
467
- async listProfiles(workspaceId: string): Promise<HubProfile[]> {
648
+ async listProfiles(
649
+ workspaceId: string,
650
+ options?: { detail?: "full" }
651
+ ): Promise<HubProfile[]> {
468
652
  const userId = await this.resolveUserId();
469
653
  const params = new URLSearchParams({ userId, workspaceId });
654
+ if (options?.detail) params.set("detail", options.detail);
470
655
  const result = await this.request<
471
656
  HubProfile[] | HubListResponse<HubProfile>
472
657
  >("GET", `/api/hub/profiles?${params}`);
@@ -496,10 +681,21 @@ export class HubRestClient {
496
681
  * schemas (including custom workspace profiles) and the canonical CLI
497
682
  * command map. Replaces static skill file profile descriptions.
498
683
  */
499
- async discover(workspaceId?: string): Promise<HubDiscoverResult> {
684
+ async discover(
685
+ options?: string | HubDiscoverOptions
686
+ ): Promise<HubDiscoverResult> {
500
687
  const userId = await this.resolveUserId();
501
- const wsId = workspaceId ?? this.workspaceId ?? "";
502
- const params = new URLSearchParams({ userId, workspaceId: wsId });
688
+ const normalized =
689
+ typeof options === "string" ? { workspaceId: options } : (options ?? {});
690
+ const params = new URLSearchParams({ userId });
691
+ // No configured fallback: an omitted workspace asks for the base schema,
692
+ // while an explicit one resolves only that workspace's overlays.
693
+ if (normalized.workspaceId)
694
+ params.set("workspaceId", normalized.workspaceId);
695
+ if (normalized.summary !== undefined)
696
+ params.set("summary", String(normalized.summary));
697
+ if (normalized.profileSlugs?.length)
698
+ params.set("profileSlugs", normalized.profileSlugs.join(","));
503
699
  return this.request<HubDiscoverResult>(
504
700
  "GET",
505
701
  `/api/hub/discover?${params}`
@@ -724,13 +920,23 @@ export class HubRestClient {
724
920
  async listProposals(options?: {
725
921
  status?: "pending" | "approved" | "rejected";
726
922
  workspaceId?: string;
923
+ /**
924
+ * "workspace" (default) — applies the client workspaceId filter.
925
+ * "all" — omits workspaceId so results span every workspace the user can see.
926
+ */
927
+ scope?: "workspace" | "all";
727
928
  limit?: number;
728
929
  }): Promise<HubProposal[]> {
729
930
  const userId = await this.resolveUserId();
730
- const wsId = options?.workspaceId ?? this.workspaceId;
731
931
  const params = new URLSearchParams({ userId });
932
+ // When scope === "all", intentionally omit workspaceId — matches searchEntities/
933
+ // getRecentEntities so a "review everything" caller isn't silently narrowed to
934
+ // just the connection's default workspace.
935
+ if (options?.scope !== "all") {
936
+ const wsId = options?.workspaceId ?? this.workspaceId;
937
+ if (wsId) params.set("workspaceId", wsId);
938
+ }
732
939
  if (options?.status) params.set("status", options.status);
733
- if (wsId) params.set("workspaceId", wsId);
734
940
  if (options?.limit) params.set("limit", String(options.limit));
735
941
  const result = await this.request<
736
942
  HubProposal[] | HubListResponse<HubProposal>
@@ -791,9 +997,59 @@ export class HubRestClient {
791
997
  type: input.type,
792
998
  profileId: input.profileSlug,
793
999
  config: input.config,
1000
+ metadata: input.metadata,
1001
+ agentUserId: input.agentUserId,
1002
+ reasoning: input.reasoning,
1003
+ sourceMessageId: input.sourceMessageId,
794
1004
  });
795
1005
  }
796
1006
 
1007
+ /** Update a view through the existing governed Hub route. */
1008
+ async updateView(
1009
+ viewId: string,
1010
+ input: UpdateViewInput
1011
+ ): Promise<HubView | HubGovernanceResult> {
1012
+ const userId = input.userId ?? (await this.resolveUserId());
1013
+ return this.request<HubView | HubGovernanceResult>(
1014
+ "PATCH",
1015
+ `/api/hub/views/${viewId}`,
1016
+ {
1017
+ userId,
1018
+ workspaceId: input.workspaceId ?? this.workspaceId,
1019
+ name: input.name,
1020
+ config: input.config,
1021
+ metadata: input.metadata,
1022
+ agentUserId: input.agentUserId,
1023
+ reasoning: input.reasoning,
1024
+ sourceMessageId: input.sourceMessageId,
1025
+ }
1026
+ );
1027
+ }
1028
+
1029
+ /** Replace a bento view's widget arrangement through the existing Hub route. */
1030
+ async arrangeBentoView(
1031
+ viewId: string,
1032
+ input: ArrangeBentoViewInput
1033
+ ): Promise<HubBentoArrangementResult> {
1034
+ const userId = input.userId ?? (await this.resolveUserId());
1035
+ const workspaceId = input.workspaceId ?? this.workspaceId;
1036
+ if (!workspaceId) {
1037
+ throw new Error("workspaceId is required for arrangeBentoView");
1038
+ }
1039
+ return this.request<HubBentoArrangementResult>(
1040
+ "POST",
1041
+ `/api/hub/views/${viewId}/arrange`,
1042
+ {
1043
+ userId,
1044
+ workspaceId,
1045
+ widgets: input.widgets,
1046
+ agentUserId: input.agentUserId,
1047
+ reasoning: input.reasoning,
1048
+ sourceMessageId: input.sourceMessageId,
1049
+ }
1050
+ );
1051
+ }
1052
+
797
1053
  // ─── Documents ────────────────────────────────────────────────────────────
798
1054
 
799
1055
  /**
@@ -802,10 +1058,11 @@ export class HubRestClient {
802
1058
  async getDocument(documentId: string): Promise<HubDocument> {
803
1059
  const userId = await this.resolveUserId();
804
1060
  const params = new URLSearchParams({ userId });
805
- return this.request<HubDocument>(
1061
+ const result = await this.request<HubDocument | { document: HubDocument }>(
806
1062
  "GET",
807
1063
  `/api/hub/documents/${documentId}?${params}`
808
1064
  );
1065
+ return "document" in result ? result.document : result;
809
1066
  }
810
1067
 
811
1068
  /**
@@ -821,9 +1078,174 @@ export class HubRestClient {
821
1078
  workspaceId: input.workspaceId ?? this.workspaceId,
822
1079
  title: input.title,
823
1080
  content: input.content ?? "",
1081
+ type: input.type,
1082
+ reasoning: input.reasoning,
1083
+ agentUserId: input.agentUserId,
1084
+ sourceMessageId: input.sourceMessageId,
1085
+ sessionId: input.sessionId,
824
1086
  });
825
1087
  }
826
1088
 
1089
+ /** Propose a full document-content replacement through the governed Hub route. */
1090
+ async updateDocument(
1091
+ documentId: string,
1092
+ input: UpdateDocumentInput
1093
+ ): Promise<HubDocumentProposalResult> {
1094
+ const userId = await this.resolveUserId();
1095
+ return this.request<HubDocumentProposalResult>(
1096
+ "PATCH",
1097
+ `/api/hub/documents/${documentId}`,
1098
+ {
1099
+ userId,
1100
+ content: input.content,
1101
+ title: input.title,
1102
+ agentUserId: input.agentUserId,
1103
+ sourceMessageId: input.sourceMessageId,
1104
+ sessionId: input.sessionId,
1105
+ }
1106
+ );
1107
+ }
1108
+
1109
+ /** Submit a structured, reviewable document-edit proposal. */
1110
+ async createDocumentProposal(
1111
+ input: CreateDocumentProposalInput
1112
+ ): Promise<HubDocumentProposalResult> {
1113
+ const userId = await this.resolveUserId();
1114
+ return this.request<HubDocumentProposalResult>(
1115
+ "POST",
1116
+ "/api/hub/documents/proposals",
1117
+ {
1118
+ userId,
1119
+ ...input,
1120
+ }
1121
+ );
1122
+ }
1123
+
1124
+ // ─── Capabilities & teaching substrate ───────────────────────────────────
1125
+
1126
+ /** Flat capability read-model. Prefer getCapabilityCatalog() for presentation. */
1127
+ async listCapabilities(options?: {
1128
+ workspaceId?: string;
1129
+ }): Promise<HubCapability[]> {
1130
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
1131
+ if (!workspaceId) {
1132
+ throw new Error("workspaceId is required for listCapabilities");
1133
+ }
1134
+ const params = new URLSearchParams({ workspaceId });
1135
+ const result = await this.request<{ capabilities: HubCapability[] }>(
1136
+ "GET",
1137
+ `/api/hub/capabilities?${params}`
1138
+ );
1139
+ return result.capabilities;
1140
+ }
1141
+
1142
+ /** Status-computed, pack-grouped capability catalog for every external surface. */
1143
+ async getCapabilityCatalog(options?: {
1144
+ workspaceId?: string;
1145
+ extraKey?: string;
1146
+ }): Promise<HubCapabilityCatalogResult> {
1147
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
1148
+ if (!workspaceId) {
1149
+ throw new Error("workspaceId is required for getCapabilityCatalog");
1150
+ }
1151
+ const params = new URLSearchParams({ workspaceId });
1152
+ if (options?.extraKey) params.set("extraKey", options.extraKey);
1153
+ return this.request<HubCapabilityCatalogResult>(
1154
+ "GET",
1155
+ `/api/hub/capabilities/catalog?${params}`
1156
+ );
1157
+ }
1158
+
1159
+ /** List only approved, connected actions that this client can execute now. */
1160
+ async listRunnableCapabilityActions(options?: {
1161
+ workspaceId?: string;
1162
+ query?: string;
1163
+ kind?: string;
1164
+ limit?: number;
1165
+ }): Promise<HubRunnableCapabilityActionsResult> {
1166
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
1167
+ if (!workspaceId) {
1168
+ throw new Error(
1169
+ "workspaceId is required for listRunnableCapabilityActions"
1170
+ );
1171
+ }
1172
+ const params = new URLSearchParams({ workspaceId });
1173
+ if (options?.query) params.set("query", options.query);
1174
+ if (options?.kind) params.set("kind", options.kind);
1175
+ if (options?.limit !== undefined)
1176
+ params.set("limit", String(options.limit));
1177
+ return this.request<HubRunnableCapabilityActionsResult>(
1178
+ "GET",
1179
+ `/api/hub/capabilities/actions?${params}`
1180
+ );
1181
+ }
1182
+
1183
+ /** Run one registered capability through the shared governance gate. */
1184
+ async executeCapability(
1185
+ input: ExecuteCapabilityInput
1186
+ ): Promise<ExecuteCapabilityResult> {
1187
+ return this.request<ExecuteCapabilityResult>(
1188
+ "POST",
1189
+ "/api/hub/capabilities/execute",
1190
+ {
1191
+ ...input,
1192
+ // Graph proposals follow the same explicit-scope rule as direct writes.
1193
+ ...(input.workspaceId ? { workspaceId: input.workspaceId } : {}),
1194
+ }
1195
+ );
1196
+ }
1197
+
1198
+ /** List the compact system teaching catalog, or search the available skill index. */
1199
+ async listAgentSkills(
1200
+ options?: ListAgentSkillsOptions
1201
+ ): Promise<HubAgentSkillsResult> {
1202
+ const params = new URLSearchParams();
1203
+ if (options?.topic) params.set("topic", options.topic);
1204
+ if (options?.query) params.set("q", options.query);
1205
+ if (options?.tag) params.set("tag", options.tag);
1206
+ if (options?.system !== undefined)
1207
+ params.set("system", String(options.system));
1208
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
1209
+ if (workspaceId) params.set("workspaceId", workspaceId);
1210
+ if (options?.limit !== undefined)
1211
+ params.set("limit", String(options.limit));
1212
+ if (options?.offset !== undefined)
1213
+ params.set("offset", String(options.offset));
1214
+ const qs = params.toString() ? `?${params}` : "";
1215
+ return this.request<HubAgentSkillsResult>(
1216
+ "GET",
1217
+ `/api/hub/agent-skills${qs}`
1218
+ );
1219
+ }
1220
+
1221
+ /** Load one skill body only when it is relevant to the agent's next action. */
1222
+ async getAgentSkillBySlug(
1223
+ slug: string,
1224
+ options?: { workspaceId?: string }
1225
+ ): Promise<HubAgentSkill> {
1226
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
1227
+ const qs = workspaceId ? `?${new URLSearchParams({ workspaceId })}` : "";
1228
+ return this.request<HubAgentSkill>(
1229
+ "GET",
1230
+ `/api/hub/agent-skills/by-slug/${encodeURIComponent(slug)}${qs}`
1231
+ );
1232
+ }
1233
+
1234
+ /** Compose just-in-time teaching and governance briefs for selected tools. */
1235
+ async getCapabilityBriefs(
1236
+ input: GetCapabilityBriefsInput
1237
+ ): Promise<HubCapabilityBriefsResult> {
1238
+ if (input.tools.length === 0) return { briefs: {} };
1239
+ const workspaceId = input.workspaceId ?? this.workspaceId;
1240
+ const params = new URLSearchParams({ tools: input.tools.join(",") });
1241
+ if (workspaceId) params.set("workspaceId", workspaceId);
1242
+ if (input.door) params.set("door", input.door);
1243
+ return this.request<HubCapabilityBriefsResult>(
1244
+ "GET",
1245
+ `/api/hub/briefs?${params}`
1246
+ );
1247
+ }
1248
+
827
1249
  // ─── Commands & Agents ────────────────────────────────────────────────────
828
1250
 
829
1251
  /**
@@ -933,10 +1355,76 @@ export class HubRestClient {
933
1355
  entities: input.entities,
934
1356
  relations: input.relations ?? [],
935
1357
  workspaceId: input.workspaceId ?? this.workspaceId,
1358
+ // Keep this exact routing bundle in lockstep with CaptureExecuteInput
1359
+ // and the REST codec. Dropping it here silently made CLI/Raycast capture
1360
+ // behave differently from MCP despite all three using the same backend.
1361
+ projectId: input.projectId,
1362
+ targetWorkspaceId: input.targetWorkspaceId,
1363
+ keepRaw: input.keepRaw,
1364
+ file: input.file,
1365
+ idempotencyKey: input.idempotencyKey,
1366
+ workspaceRouting: input.workspaceRouting,
1367
+ aiWorkspaceId: input.aiWorkspaceId,
1368
+ aiWorkspaceConfidence: input.aiWorkspaceConfidence,
1369
+ aiWorkspaceReason: input.aiWorkspaceReason,
1370
+ }
1371
+ );
1372
+ }
1373
+
1374
+ /**
1375
+ * Submit a designed entity graph as ONE reviewable composite proposal.
1376
+ *
1377
+ * This is intentionally distinct from captureExecute(): execute materializes
1378
+ * a prior structure result immediately, while this door keeps an autonomous
1379
+ * graph plan reviewable and applies entities, relations, and bindings together
1380
+ * only after approval.
1381
+ */
1382
+ async submitCaptureGraph(
1383
+ input: SubmitCaptureGraphInput
1384
+ ): Promise<SubmitCaptureGraphResult> {
1385
+ const { workspaceId, relations, bindings, ...body } = input;
1386
+ return this.request<SubmitCaptureGraphResult>(
1387
+ "POST",
1388
+ "/api/hub/capture/graph",
1389
+ {
1390
+ ...body,
1391
+ // Proposal audience and schema overlays are explicit write choices.
1392
+ ...(workspaceId ? { workspaceId } : {}),
1393
+ relations: relations ?? [],
1394
+ bindings: bindings ?? [],
936
1395
  }
937
1396
  );
938
1397
  }
939
1398
 
1399
+ // ─── Recall: the one door ──────────────────────────────────────────────────
1400
+
1401
+ /**
1402
+ * `ask` — the unified recall verb. Routes a natural-language question across
1403
+ * all knowledge substrates (semantic entities, procedural runbooks, episodic
1404
+ * facts) server-side and returns ONE provenance-tagged answer. The canonical
1405
+ * recall door — prefer it over the fragmented searchEntities / recallMemory.
1406
+ * The server builds the profile catalog from the caller's workspace; the
1407
+ * client only sends the query (+ optional scope).
1408
+ */
1409
+ async ask(input: {
1410
+ query: string;
1411
+ workspaceId?: string;
1412
+ limit?: number;
1413
+ /**
1414
+ * Return just the glass-box understanding + routing (no retrieval) — for a
1415
+ * caller that routes a query before fetching results (e.g. a palette
1416
+ * completing a type word). `answers` comes back empty.
1417
+ */
1418
+ parseOnly?: boolean;
1419
+ }): Promise<AskResponse> {
1420
+ return this.request<AskResponse>("POST", "/api/hub/knowledge/ask", {
1421
+ query: input.query,
1422
+ workspaceId: input.workspaceId ?? this.workspaceId,
1423
+ limit: input.limit,
1424
+ parseOnly: input.parseOnly,
1425
+ });
1426
+ }
1427
+
940
1428
  // ─── Automations ───────────────────────────────────────────────────────────
941
1429
 
942
1430
  /**