@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
@@ -86,6 +86,9 @@ var HubRestClient = class {
86
86
  base;
87
87
  headers;
88
88
  timeoutMs;
89
+ readTimeoutMs;
90
+ writeTimeoutMs;
91
+ maxAttempts;
89
92
  workspaceId;
90
93
  /** Cached from GET /users/me — avoids repeated identity calls. */
91
94
  resolvedUserId = null;
@@ -97,6 +100,9 @@ var HubRestClient = class {
97
100
  };
98
101
  this.workspaceId = config.workspaceId;
99
102
  this.timeoutMs = config.timeoutMs ?? 3e4;
103
+ this.readTimeoutMs = config.readTimeoutMs ?? this.timeoutMs;
104
+ this.writeTimeoutMs = config.writeTimeoutMs ?? this.timeoutMs;
105
+ this.maxAttempts = Math.max(1, config.maxAttempts ?? 3);
100
106
  }
101
107
  /** User id for the current API key (Hub REST requires userId on several GETs). */
102
108
  async resolveUserId() {
@@ -105,25 +111,80 @@ var HubRestClient = class {
105
111
  this.resolvedUserId = me.id;
106
112
  return me.id;
107
113
  }
108
- async request(method, path, body, signal) {
114
+ /**
115
+ * The ONE shared request loop. Per-method timeout (GET = read, else write, or a
116
+ * caller override) + up to `maxAttempts` with exponential backoff. Retries ONLY
117
+ * on a network failure or 5xx; NEVER on a 4xx or a caller abort. Returns the raw
118
+ * `Response` for any non-5xx (ok OR 4xx) — the typed entry points below decide
119
+ * how to interpret it. This is the single source of retry/timeout truth, shared
120
+ * by the CLI and the IS's `ISHubClient` (which reuses the protected entry points
121
+ * rather than re-implementing fetch).
122
+ */
123
+ async fetchWithRetry(method, path, body, signal, timeoutMsOverride) {
109
124
  const url = `${this.base}${path}`;
110
- const timeout = AbortSignal.timeout(this.timeoutMs);
111
- const combined = signal ? AbortSignal.any([signal, timeout]) : timeout;
112
- const res = await fetch(url, {
113
- method,
114
- headers: this.headers,
115
- body: body !== void 0 ? JSON.stringify(body) : void 0,
116
- signal: combined
117
- });
118
- if (!res.ok) {
119
- const errorBody = await res.json().catch(() => ({}));
120
- throw new HubApiError(
121
- formatHubErrorMessage(res.status, res.statusText, errorBody),
122
- res.status,
123
- errorBody
124
- );
125
+ const perAttemptTimeout = timeoutMsOverride ?? (method.toUpperCase() === "GET" ? this.readTimeoutMs : this.writeTimeoutMs);
126
+ let lastError;
127
+ for (let attempt = 0; attempt < this.maxAttempts; attempt++) {
128
+ if (attempt > 0) {
129
+ await new Promise((r) => setTimeout(r, 1e3 * attempt));
130
+ }
131
+ const timeout = AbortSignal.timeout(perAttemptTimeout);
132
+ const combined = signal ? AbortSignal.any([signal, timeout]) : timeout;
133
+ try {
134
+ const res = await fetch(url, {
135
+ method,
136
+ headers: this.headers,
137
+ body: body !== void 0 ? JSON.stringify(body) : void 0,
138
+ signal: combined
139
+ });
140
+ if (res.status < 500) return res;
141
+ lastError = new Error(`HTTP ${res.status}`);
142
+ } catch (err) {
143
+ if (signal?.aborted) throw err;
144
+ lastError = err;
145
+ }
125
146
  }
126
- return res.json();
147
+ throw lastError;
148
+ }
149
+ /** Build a HubApiError from a non-ok Response (reads the JSON error body). */
150
+ async toHubError(res) {
151
+ const errorBody = await res.json().catch(() => ({}));
152
+ return new HubApiError(
153
+ formatHubErrorMessage(res.status, res.statusText, errorBody),
154
+ res.status,
155
+ errorBody
156
+ );
157
+ }
158
+ /** Parse a 2xx body, tolerating an empty/204 response (returns undefined). */
159
+ async parseBody(res) {
160
+ const text = await res.text();
161
+ return text ? JSON.parse(text) : void 0;
162
+ }
163
+ /**
164
+ * Typed JSON request — throws `HubApiError` on any non-2xx. Protected so the IS
165
+ * subclass reuses it. Tolerates an empty/204 body (returns `undefined`).
166
+ */
167
+ async request(method, path, body, signal) {
168
+ const res = await this.fetchWithRetry(method, path, body, signal);
169
+ if (!res.ok) throw await this.toHubError(res);
170
+ return this.parseBody(res);
171
+ }
172
+ /**
173
+ * Like `request<T>` but returns `null` on 404/403 (the "absent/forbidden →
174
+ * empty" contract several IS reads use) instead of throwing.
175
+ */
176
+ async requestOrNull(method, path, body, signal) {
177
+ const res = await this.fetchWithRetry(method, path, body, signal);
178
+ if (res.status === 404 || res.status === 403) return null;
179
+ if (!res.ok) throw await this.toHubError(res);
180
+ return this.parseBody(res);
181
+ }
182
+ /**
183
+ * The raw `Response` (same retry/timeout infra), for the few callers that read
184
+ * `.text()`, branch on status themselves, or need a per-call timeout override.
185
+ */
186
+ async requestRaw(method, path, body, signal, timeoutMsOverride) {
187
+ return this.fetchWithRetry(method, path, body, signal, timeoutMsOverride);
127
188
  }
128
189
  // ─── Identity ─────────────────────────────────────────────────────────────
129
190
  async getMe() {
@@ -195,16 +256,39 @@ var HubRestClient = class {
195
256
  return unwrapList(result);
196
257
  }
197
258
  async createEntity(input) {
259
+ const { content, url, status, priority, dueDate, properties, ...rest } = input;
198
260
  return this.request("POST", "/api/hub/entities", {
199
- ...input,
200
- workspaceId: input.workspaceId ?? this.workspaceId
261
+ ...rest,
262
+ // Entity placement is a write decision, never an ambient client default.
263
+ // Omitted means pod/base behavior; an explicit workspace opts into its
264
+ // overlay/membership lens. This deliberately differs from read helpers.
265
+ ...rest.workspaceId ? { workspaceId: rest.workspaceId } : {},
266
+ ...content !== void 0 ? { content } : {},
267
+ properties: {
268
+ ...properties,
269
+ ...url !== void 0 ? { url } : {},
270
+ ...status !== void 0 ? { status } : {},
271
+ ...priority !== void 0 ? { priority } : {},
272
+ ...dueDate !== void 0 ? { dueDate } : {}
273
+ }
201
274
  });
202
275
  }
203
276
  async updateEntity(id, input) {
277
+ const { properties, content, url, status, priority, dueDate, ...rest } = input;
204
278
  return this.request(
205
279
  "PATCH",
206
280
  `/api/hub/entities/${id}`,
207
- input
281
+ {
282
+ ...rest,
283
+ metadata: {
284
+ ...properties,
285
+ ...content !== void 0 ? { content } : {},
286
+ ...url !== void 0 ? { url } : {},
287
+ ...status !== void 0 ? { status } : {},
288
+ ...priority !== void 0 ? { priority } : {},
289
+ ...dueDate !== void 0 ? { dueDate } : {}
290
+ }
291
+ }
208
292
  );
209
293
  }
210
294
  // ─── Unified Search ───────────────────────────────────────────────────────
@@ -264,6 +348,28 @@ var HubRestClient = class {
264
348
  type: input.type
265
349
  });
266
350
  }
351
+ /**
352
+ * Attach a role-profile through the canonical governed facet door. A result
353
+ * may be `proposed`; callers must surface its review information instead of
354
+ * claiming the role was applied.
355
+ */
356
+ async attachFacet(input) {
357
+ const userId = await this.resolveUserId();
358
+ return this.request(
359
+ "POST",
360
+ `/api/hub/entities/${input.entityId}/facets`,
361
+ {
362
+ userId,
363
+ profileSlug: input.profileSlug,
364
+ profileId: input.profileId,
365
+ workspaceId: input.workspaceId ?? this.workspaceId,
366
+ contextEntityId: input.contextEntityId,
367
+ status: input.status,
368
+ properties: input.properties,
369
+ reasoning: input.reasoning
370
+ }
371
+ );
372
+ }
267
373
  /**
268
374
  * Delete a relation by ID (get from getRelations()).
269
375
  */
@@ -297,10 +403,10 @@ var HubRestClient = class {
297
403
  );
298
404
  }
299
405
  /**
300
- * Unified view of everything connected to an entity. Merges three sources:
406
+ * Unified view of everything connected to an entity across the local graph:
301
407
  * 1. Graph relations — explicit rows in the relations table (both directions)
302
- * 2. Structural links — entities whose `entity_id` properties point to this entity
303
- * 3. Thread connections — chat threads that touched this entity
408
+ * 2. Structural links — inbound and outbound `entity_id` property edges
409
+ * 3. Channel and focus-session connections around this entity
304
410
  *
305
411
  * Prefer this over `getRelations()` / `traverseGraph()` when you want the complete
306
412
  * picture — those only see the relations table and miss property-based links that
@@ -323,15 +429,31 @@ var HubRestClient = class {
323
429
  `/api/hub/entities/${entityId}/connections?${params}`
324
430
  );
325
431
  }
432
+ // ─── Session orientation & profile discovery ─────────────────────────────
433
+ /**
434
+ * Canonical session bootstrap shared by the MCP, CLI, and external surfaces.
435
+ * It is deliberately a lens map, not a profile/schema dump; use discover()
436
+ * only for the selected profiles needed by the next action.
437
+ */
438
+ async orient(options) {
439
+ const params = new URLSearchParams();
440
+ if (options?.detail) params.set("detail", options.detail);
441
+ if (options?.scope?.length) params.set("scope", options.scope.join(","));
442
+ if (options?.workspaceId) params.set("workspaceId", options.workspaceId);
443
+ if (options?.projectId) params.set("projectId", options.projectId);
444
+ const qs = params.toString() ? `?${params}` : "";
445
+ return this.request("GET", `/api/hub/orient${qs}`);
446
+ }
326
447
  // ─── Profiles & Schema ────────────────────────────────────────────────────
327
448
  /**
328
449
  * List all entity profile types in the workspace.
329
450
  * Always call before creating entities to discover what types are available.
330
451
  * Returns system profiles (always present) + custom workspace profiles.
331
452
  */
332
- async listProfiles(workspaceId) {
453
+ async listProfiles(workspaceId, options) {
333
454
  const userId = await this.resolveUserId();
334
455
  const params = new URLSearchParams({ userId, workspaceId });
456
+ if (options?.detail) params.set("detail", options.detail);
335
457
  const result = await this.request("GET", `/api/hub/profiles?${params}`);
336
458
  return unwrapList(result);
337
459
  }
@@ -352,10 +474,16 @@ var HubRestClient = class {
352
474
  * schemas (including custom workspace profiles) and the canonical CLI
353
475
  * command map. Replaces static skill file profile descriptions.
354
476
  */
355
- async discover(workspaceId) {
477
+ async discover(options) {
356
478
  const userId = await this.resolveUserId();
357
- const wsId = workspaceId ?? this.workspaceId ?? "";
358
- const params = new URLSearchParams({ userId, workspaceId: wsId });
479
+ const normalized = typeof options === "string" ? { workspaceId: options } : options ?? {};
480
+ const params = new URLSearchParams({ userId });
481
+ if (normalized.workspaceId)
482
+ params.set("workspaceId", normalized.workspaceId);
483
+ if (normalized.summary !== void 0)
484
+ params.set("summary", String(normalized.summary));
485
+ if (normalized.profileSlugs?.length)
486
+ params.set("profileSlugs", normalized.profileSlugs.join(","));
359
487
  return this.request(
360
488
  "GET",
361
489
  `/api/hub/discover?${params}`
@@ -517,10 +645,12 @@ var HubRestClient = class {
517
645
  */
518
646
  async listProposals(options) {
519
647
  const userId = await this.resolveUserId();
520
- const wsId = options?.workspaceId ?? this.workspaceId;
521
648
  const params = new URLSearchParams({ userId });
649
+ if (options?.scope !== "all") {
650
+ const wsId = options?.workspaceId ?? this.workspaceId;
651
+ if (wsId) params.set("workspaceId", wsId);
652
+ }
522
653
  if (options?.status) params.set("status", options.status);
523
- if (wsId) params.set("workspaceId", wsId);
524
654
  if (options?.limit) params.set("limit", String(options.limit));
525
655
  const result = await this.request("GET", `/api/hub/proposals?${params}`);
526
656
  return unwrapList(result);
@@ -567,9 +697,51 @@ var HubRestClient = class {
567
697
  name: input.name,
568
698
  type: input.type,
569
699
  profileId: input.profileSlug,
570
- config: input.config
700
+ config: input.config,
701
+ metadata: input.metadata,
702
+ agentUserId: input.agentUserId,
703
+ reasoning: input.reasoning,
704
+ sourceMessageId: input.sourceMessageId
571
705
  });
572
706
  }
707
+ /** Update a view through the existing governed Hub route. */
708
+ async updateView(viewId, input) {
709
+ const userId = input.userId ?? await this.resolveUserId();
710
+ return this.request(
711
+ "PATCH",
712
+ `/api/hub/views/${viewId}`,
713
+ {
714
+ userId,
715
+ workspaceId: input.workspaceId ?? this.workspaceId,
716
+ name: input.name,
717
+ config: input.config,
718
+ metadata: input.metadata,
719
+ agentUserId: input.agentUserId,
720
+ reasoning: input.reasoning,
721
+ sourceMessageId: input.sourceMessageId
722
+ }
723
+ );
724
+ }
725
+ /** Replace a bento view's widget arrangement through the existing Hub route. */
726
+ async arrangeBentoView(viewId, input) {
727
+ const userId = input.userId ?? await this.resolveUserId();
728
+ const workspaceId = input.workspaceId ?? this.workspaceId;
729
+ if (!workspaceId) {
730
+ throw new Error("workspaceId is required for arrangeBentoView");
731
+ }
732
+ return this.request(
733
+ "POST",
734
+ `/api/hub/views/${viewId}/arrange`,
735
+ {
736
+ userId,
737
+ workspaceId,
738
+ widgets: input.widgets,
739
+ agentUserId: input.agentUserId,
740
+ reasoning: input.reasoning,
741
+ sourceMessageId: input.sourceMessageId
742
+ }
743
+ );
744
+ }
573
745
  // ─── Documents ────────────────────────────────────────────────────────────
574
746
  /**
575
747
  * Get a document by ID with full markdown content.
@@ -577,10 +749,11 @@ var HubRestClient = class {
577
749
  async getDocument(documentId) {
578
750
  const userId = await this.resolveUserId();
579
751
  const params = new URLSearchParams({ userId });
580
- return this.request(
752
+ const result = await this.request(
581
753
  "GET",
582
754
  `/api/hub/documents/${documentId}?${params}`
583
755
  );
756
+ return "document" in result ? result.document : result;
584
757
  }
585
758
  /**
586
759
  * Create a document. Use for long-form content: meeting notes, research, writeups.
@@ -592,9 +765,140 @@ var HubRestClient = class {
592
765
  userId,
593
766
  workspaceId: input.workspaceId ?? this.workspaceId,
594
767
  title: input.title,
595
- content: input.content ?? ""
768
+ content: input.content ?? "",
769
+ type: input.type,
770
+ reasoning: input.reasoning,
771
+ agentUserId: input.agentUserId,
772
+ sourceMessageId: input.sourceMessageId,
773
+ sessionId: input.sessionId
596
774
  });
597
775
  }
776
+ /** Propose a full document-content replacement through the governed Hub route. */
777
+ async updateDocument(documentId, input) {
778
+ const userId = await this.resolveUserId();
779
+ return this.request(
780
+ "PATCH",
781
+ `/api/hub/documents/${documentId}`,
782
+ {
783
+ userId,
784
+ content: input.content,
785
+ title: input.title,
786
+ agentUserId: input.agentUserId,
787
+ sourceMessageId: input.sourceMessageId,
788
+ sessionId: input.sessionId
789
+ }
790
+ );
791
+ }
792
+ /** Submit a structured, reviewable document-edit proposal. */
793
+ async createDocumentProposal(input) {
794
+ const userId = await this.resolveUserId();
795
+ return this.request(
796
+ "POST",
797
+ "/api/hub/documents/proposals",
798
+ {
799
+ userId,
800
+ ...input
801
+ }
802
+ );
803
+ }
804
+ // ─── Capabilities & teaching substrate ───────────────────────────────────
805
+ /** Flat capability read-model. Prefer getCapabilityCatalog() for presentation. */
806
+ async listCapabilities(options) {
807
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
808
+ if (!workspaceId) {
809
+ throw new Error("workspaceId is required for listCapabilities");
810
+ }
811
+ const params = new URLSearchParams({ workspaceId });
812
+ const result = await this.request(
813
+ "GET",
814
+ `/api/hub/capabilities?${params}`
815
+ );
816
+ return result.capabilities;
817
+ }
818
+ /** Status-computed, pack-grouped capability catalog for every external surface. */
819
+ async getCapabilityCatalog(options) {
820
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
821
+ if (!workspaceId) {
822
+ throw new Error("workspaceId is required for getCapabilityCatalog");
823
+ }
824
+ const params = new URLSearchParams({ workspaceId });
825
+ if (options?.extraKey) params.set("extraKey", options.extraKey);
826
+ return this.request(
827
+ "GET",
828
+ `/api/hub/capabilities/catalog?${params}`
829
+ );
830
+ }
831
+ /** List only approved, connected actions that this client can execute now. */
832
+ async listRunnableCapabilityActions(options) {
833
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
834
+ if (!workspaceId) {
835
+ throw new Error(
836
+ "workspaceId is required for listRunnableCapabilityActions"
837
+ );
838
+ }
839
+ const params = new URLSearchParams({ workspaceId });
840
+ if (options?.query) params.set("query", options.query);
841
+ if (options?.kind) params.set("kind", options.kind);
842
+ if (options?.limit !== void 0)
843
+ params.set("limit", String(options.limit));
844
+ return this.request(
845
+ "GET",
846
+ `/api/hub/capabilities/actions?${params}`
847
+ );
848
+ }
849
+ /** Run one registered capability through the shared governance gate. */
850
+ async executeCapability(input) {
851
+ return this.request(
852
+ "POST",
853
+ "/api/hub/capabilities/execute",
854
+ {
855
+ ...input,
856
+ // Graph proposals follow the same explicit-scope rule as direct writes.
857
+ ...input.workspaceId ? { workspaceId: input.workspaceId } : {}
858
+ }
859
+ );
860
+ }
861
+ /** List the compact system teaching catalog, or search the available skill index. */
862
+ async listAgentSkills(options) {
863
+ const params = new URLSearchParams();
864
+ if (options?.topic) params.set("topic", options.topic);
865
+ if (options?.query) params.set("q", options.query);
866
+ if (options?.tag) params.set("tag", options.tag);
867
+ if (options?.system !== void 0)
868
+ params.set("system", String(options.system));
869
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
870
+ if (workspaceId) params.set("workspaceId", workspaceId);
871
+ if (options?.limit !== void 0)
872
+ params.set("limit", String(options.limit));
873
+ if (options?.offset !== void 0)
874
+ params.set("offset", String(options.offset));
875
+ const qs = params.toString() ? `?${params}` : "";
876
+ return this.request(
877
+ "GET",
878
+ `/api/hub/agent-skills${qs}`
879
+ );
880
+ }
881
+ /** Load one skill body only when it is relevant to the agent's next action. */
882
+ async getAgentSkillBySlug(slug, options) {
883
+ const workspaceId = options?.workspaceId ?? this.workspaceId;
884
+ const qs = workspaceId ? `?${new URLSearchParams({ workspaceId })}` : "";
885
+ return this.request(
886
+ "GET",
887
+ `/api/hub/agent-skills/by-slug/${encodeURIComponent(slug)}${qs}`
888
+ );
889
+ }
890
+ /** Compose just-in-time teaching and governance briefs for selected tools. */
891
+ async getCapabilityBriefs(input) {
892
+ if (input.tools.length === 0) return { briefs: {} };
893
+ const workspaceId = input.workspaceId ?? this.workspaceId;
894
+ const params = new URLSearchParams({ tools: input.tools.join(",") });
895
+ if (workspaceId) params.set("workspaceId", workspaceId);
896
+ if (input.door) params.set("door", input.door);
897
+ return this.request(
898
+ "GET",
899
+ `/api/hub/briefs?${params}`
900
+ );
901
+ }
598
902
  // ─── Commands & Agents ────────────────────────────────────────────────────
599
903
  /**
600
904
  * List available commands (automation shortcuts) in the workspace.
@@ -678,10 +982,61 @@ var HubRestClient = class {
678
982
  userId,
679
983
  entities: input.entities,
680
984
  relations: input.relations ?? [],
681
- workspaceId: input.workspaceId ?? this.workspaceId
985
+ workspaceId: input.workspaceId ?? this.workspaceId,
986
+ // Keep this exact routing bundle in lockstep with CaptureExecuteInput
987
+ // and the REST codec. Dropping it here silently made CLI/Raycast capture
988
+ // behave differently from MCP despite all three using the same backend.
989
+ projectId: input.projectId,
990
+ targetWorkspaceId: input.targetWorkspaceId,
991
+ keepRaw: input.keepRaw,
992
+ file: input.file,
993
+ idempotencyKey: input.idempotencyKey,
994
+ workspaceRouting: input.workspaceRouting,
995
+ aiWorkspaceId: input.aiWorkspaceId,
996
+ aiWorkspaceConfidence: input.aiWorkspaceConfidence,
997
+ aiWorkspaceReason: input.aiWorkspaceReason
682
998
  }
683
999
  );
684
1000
  }
1001
+ /**
1002
+ * Submit a designed entity graph as ONE reviewable composite proposal.
1003
+ *
1004
+ * This is intentionally distinct from captureExecute(): execute materializes
1005
+ * a prior structure result immediately, while this door keeps an autonomous
1006
+ * graph plan reviewable and applies entities, relations, and bindings together
1007
+ * only after approval.
1008
+ */
1009
+ async submitCaptureGraph(input) {
1010
+ const { workspaceId, relations, bindings, ...body } = input;
1011
+ return this.request(
1012
+ "POST",
1013
+ "/api/hub/capture/graph",
1014
+ {
1015
+ ...body,
1016
+ // Proposal audience and schema overlays are explicit write choices.
1017
+ ...workspaceId ? { workspaceId } : {},
1018
+ relations: relations ?? [],
1019
+ bindings: bindings ?? []
1020
+ }
1021
+ );
1022
+ }
1023
+ // ─── Recall: the one door ──────────────────────────────────────────────────
1024
+ /**
1025
+ * `ask` — the unified recall verb. Routes a natural-language question across
1026
+ * all knowledge substrates (semantic entities, procedural runbooks, episodic
1027
+ * facts) server-side and returns ONE provenance-tagged answer. The canonical
1028
+ * recall door — prefer it over the fragmented searchEntities / recallMemory.
1029
+ * The server builds the profile catalog from the caller's workspace; the
1030
+ * client only sends the query (+ optional scope).
1031
+ */
1032
+ async ask(input) {
1033
+ return this.request("POST", "/api/hub/knowledge/ask", {
1034
+ query: input.query,
1035
+ workspaceId: input.workspaceId ?? this.workspaceId,
1036
+ limit: input.limit,
1037
+ parseOnly: input.parseOnly
1038
+ });
1039
+ }
685
1040
  // ─── Automations ───────────────────────────────────────────────────────────
686
1041
  /**
687
1042
  * List automations for the current user, optionally filtered by workspace and status.
@@ -835,6 +1190,30 @@ var HubRestClient = class {
835
1190
  function normalizeUrl2(url) {
836
1191
  return url.replace(/\/$/, "");
837
1192
  }
1193
+ function assertValidPodUrl(url, opts = {}) {
1194
+ let parsed;
1195
+ try {
1196
+ parsed = new URL(url);
1197
+ } catch {
1198
+ throw new HubApiError(`Invalid pod URL: ${url}`, 0, {
1199
+ code: "INVALID_POD_URL"
1200
+ });
1201
+ }
1202
+ if (parsed.username || parsed.password) {
1203
+ throw new HubApiError("Pod URL must not contain embedded credentials", 0, {
1204
+ code: "INVALID_POD_URL"
1205
+ });
1206
+ }
1207
+ const isHttps = parsed.protocol === "https:";
1208
+ const isHttp = parsed.protocol === "http:";
1209
+ if (!isHttps && !(isHttp && opts.allowHttp)) {
1210
+ throw new HubApiError(
1211
+ `Pod URL must use https:// (got ${parsed.protocol}//)`,
1212
+ 0,
1213
+ { code: "INSECURE_POD_URL" }
1214
+ );
1215
+ }
1216
+ }
838
1217
  async function checkPodHealth(podUrl) {
839
1218
  const url = normalizeUrl2(podUrl);
840
1219
  const status = { url, healthy: false };
@@ -851,7 +1230,8 @@ async function checkPodHealth(podUrl) {
851
1230
  }
852
1231
  return status;
853
1232
  }
854
- async function setupAgent(podUrl, provisioningToken, agentType = "openclaw") {
1233
+ async function setupAgent(podUrl, provisioningToken, agentType, opts = {}) {
1234
+ assertValidPodUrl(podUrl, { allowHttp: opts.allowHttp });
855
1235
  const url = normalizeUrl2(podUrl);
856
1236
  const res = await fetch(`${url}/api/hub/setup/agent`, {
857
1237
  method: "POST",