@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
@@ -0,0 +1,319 @@
1
+ ---
2
+ name: synap-app
3
+ description: >
4
+ Use this skill when the user wants to BUILD THEIR OWN APP on top of Synap — a
5
+ personal project or a product — using Synap as the backend (auth, typed data
6
+ API, realtime). Two paths: add the SDK (@synap-core/sdk) to an existing app,
7
+ or scaffold the opinionated Next.js + HeroUI base app (npx create-synap-app).
8
+ Triggers: "build an app on Synap", "use Synap as my backend", "scaffold a
9
+ Synap project", "add the Synap SDK", "connect my app to my pod",
10
+ "npx create-synap-app". NOT the `synap` skill (capture/recall in a pod) nor
11
+ `synap-ui` (views inside the pod's own UI) — this is about writing app CODE.
12
+ metadata:
13
+ openclaw:
14
+ requires:
15
+ env: []
16
+ optional_env: [SYNAP_POD_URL, SYNAP_WORKSPACE_ID]
17
+ primaryEnv: null
18
+ homepage: https://synap.live
19
+ capabilities: [sdk, scaffold, auth, realtime]
20
+ os: [macos, linux, windows]
21
+ userInvocable: true
22
+ ---
23
+
24
+ # Building an app on Synap
25
+
26
+ Synap is a sovereign data pod with a complete, typed API. You build an app on it
27
+ the same way you'd build on any backend — except the backend is the user's own
28
+ pod, and **every write is governed** (see `governance.md`).
29
+
30
+ ## Decide the path first
31
+
32
+ | The user has… | Do this | Read |
33
+ |---|---|---|
34
+ | an existing app (any framework) | add the SDK | `using-the-sdk.md`, `install-commands.md` |
35
+ | nothing yet, wants a full app fast | scaffold the base app | `creating-the-base-app.md`, `install-commands.md` |
36
+ | a server / script / CLI (no browser) | SDK with a session token or API key | `using-the-sdk.md` |
37
+
38
+ Both paths use the same underlying packages; only the amount of scaffolding differs.
39
+
40
+ ## The packages (all published under `@synap-core/*`)
41
+
42
+ - `@synap-core/sdk` — typed tRPC client. `createSynapClient({ podUrl, ... })`. **The one you almost always want.**
43
+ - `@synap-core/react` — React/TanStack-Query bindings (`SynapProvider`, hooks).
44
+ - `@synap-core/sdk-realtime` — Socket.IO presence/live-updates (`createRealtimeClient`).
45
+ - `@synap-core/auth` — sign-in orchestration (Synap Cloud + pod handshake), framework-agnostic.
46
+ - `@synap-core/auth-bootstrap` — zero-dep server helpers (`setupAgent`, `handshake`) for machine clients.
47
+
48
+ Pin `@^1.0.0` on `sdk`/`react` so you never resolve an old, abandoned `0.x`.
49
+
50
+ ## The three rules that trip people up
51
+
52
+ 1. **A write can come back `"proposed"` — that is SUCCESS, not an error.** It means
53
+ the change is queued for the pod owner's review (like a PR). Surface the review,
54
+ don't retry. Full contract: `governance.md`.
55
+ 2. **The pod URL has no `/trpc` suffix and no trailing slash.** The SDK appends `/trpc`.
56
+ 3. **Non-browser clients (server/CLI/mobile) authenticate with a token or API key**,
57
+ never a cookie. Browser apps use the Synap Cloud sign-in flow (`@synap-core/auth`).
58
+
59
+ ## Get a pod to build against
60
+
61
+ - **Self-host (free):** `git clone` the backend, `docker compose up -d` (run its
62
+ `install.sh` to generate secrets). Pod answers on `:4000`.
63
+ - **Managed (paid):** sign up at synap.live and provision a pod.
64
+
65
+ You can develop the base app with **no pod at all** using its mock mode
66
+ (`NEXT_PUBLIC_BASE_MOCK_MODE=true`).
67
+
68
+ ## Honest scope
69
+
70
+ Building on the user's OWN pod is fully supported today. Building a **multi-tenant
71
+ commercial app** where *other* people connect *their* pods is **not yet supported**
72
+ — per-app data scoping is still being built. If the user asks for that, say so;
73
+ don't architect around a capability that isn't there.
74
+
75
+ ---
76
+
77
+ # Install & scaffold commands
78
+
79
+ ## Scaffold a full app (recommended for a fresh start)
80
+
81
+ ```bash
82
+ npx create-synap-app my-app
83
+ ```
84
+
85
+ Creates a Next.js + HeroUI project from the base template, with the SDK, auth,
86
+ app shell, command palette, realtime, and mock mode pre-wired. It also drops an
87
+ `AGENTS.md` into the project so your AI coding tool knows how to work with it.
88
+
89
+ ## Add the SDK to an existing app
90
+
91
+ ```bash
92
+ # npm
93
+ npm install @synap-core/sdk@^1.0.0
94
+
95
+ # with React bindings
96
+ npm install @synap-core/sdk@^1.0.0 @synap-core/react@^1.0.0
97
+
98
+ # realtime
99
+ npm install @synap-core/sdk-realtime
100
+
101
+ # auth (browser sign-in) or auth-bootstrap (server credential bootstrap)
102
+ npm install @synap-core/auth # or @synap-core/auth-bootstrap
103
+ ```
104
+
105
+ Pin `@^1.0.0` on `sdk`/`react`. **Do not** install unpinned `@synap-core/sdk` —
106
+ older `0.x` versions on the registry are a different, abandoned package.
107
+
108
+ ## Get this knowledge into your AI coding tool
109
+
110
+ ```bash
111
+ # add the app-creation skill (this skill) to a connected AI tool
112
+ synap skills get synap-app
113
+
114
+ # or wire a tool end-to-end (skills + MCP), any target
115
+ synap connect --target=cursor # or claude, openclaw, …
116
+ ```
117
+
118
+ Alternatively, the scaffolded project ships an `AGENTS.md` at its root — most AI
119
+ coding tools read it automatically, so a freshly-scaffolded app teaches the AI
120
+ how to build on it with zero extra setup.
121
+
122
+ ## Verify an install actually works
123
+
124
+ Publishing bugs have shipped uninstallable Synap packages before. After adding a
125
+ package, confirm it resolves in a clean directory:
126
+
127
+ ```bash
128
+ mkdir /tmp/synap-check && cd /tmp/synap-check && npm init -y
129
+ npm install @synap-core/sdk@^1.0.0
130
+ node -e "console.log(typeof require('@synap-core/sdk').createSynapClient)" # → function
131
+ ```
132
+
133
+ ---
134
+
135
+ # Using the SDK
136
+
137
+ ## Vanilla / TypeScript / server / CLI — `@synap-core/sdk`
138
+
139
+ ```ts
140
+ import { createSynapClient } from "@synap-core/sdk";
141
+
142
+ const synap = createSynapClient({
143
+ podUrl: "https://pod.example.com", // NO trailing slash, NO /trpc suffix
144
+ apiKey: process.env.SYNAP_API_KEY, // or sessionToken (see auth below)
145
+ workspaceId: process.env.SYNAP_WORKSPACE_ID ?? "",
146
+ });
147
+
148
+ // It's a typed tRPC client — full autocomplete over every router.
149
+ const me = await synap.users.me.query();
150
+ const entities = await synap.entities.list.query({ /* filter */ });
151
+ const result = await synap.entities.create.mutate({ /* ... */ });
152
+ // result may be { status: "proposed", ... } — that is success. See governance.md.
153
+ ```
154
+
155
+ ### Auth modes (pick ONE)
156
+ - **`apiKey`** — a Bearer key generated in the workspace's developer settings.
157
+ Best for servers, scripts, CLIs.
158
+ - **`sessionToken`** — an Ory Kratos session token, sent as `X-Session-Token`.
159
+ Best for non-browser clients that completed a sign-in.
160
+ - **cookie fallback** — omit both; the client uses the ambient Kratos cookie.
161
+ Browser, same-origin only.
162
+
163
+ For machine clients that need to bootstrap a credential, use
164
+ `@synap-core/auth-bootstrap` (`setupAgent(provisioningToken)` → API key,
165
+ `handshake(jwt)` → session token). Zero-dependency, safe in edge/serverless.
166
+
167
+ ## React — `@synap-core/react`
168
+
169
+ ```tsx
170
+ import { SynapProvider, useSynapContext } from "@synap-core/react";
171
+
172
+ function App() {
173
+ return (
174
+ <SynapProvider podUrl={podUrl} sessionToken={token} workspaceId={ws}>
175
+ <Dashboard />
176
+ </SynapProvider>
177
+ );
178
+ }
179
+ ```
180
+
181
+ `SynapProvider` honours every `createSynapClient` option, incl. `sessionToken`
182
+ and `onAuthError` (a 401 handler). `react` is a peer of your app's React — it
183
+ does not bundle its own.
184
+
185
+ ## Realtime — `@synap-core/sdk-realtime`
186
+
187
+ ```ts
188
+ import { createRealtimeClient } from "@synap-core/sdk-realtime";
189
+
190
+ const rt = createRealtimeClient({ podUrl, sessionToken });
191
+ const stop = rt.onInvalidate((target) => {
192
+ // e.g. refetch the affected query
193
+ });
194
+ ```
195
+
196
+ Websocket-only transport (credentials never ride a long-poll URL) and it refuses
197
+ to send credentials over non-TLS unless you explicitly pass `allowInsecure`.
198
+
199
+ ## Two transports, on purpose
200
+ - `@synap-core/sdk` (tRPC) — for apps. Typed, hooks, realtime.
201
+ - `@synap-core/hub-rest-client` (REST, zero-dep) — for agents/CLIs/scripts. Carries
202
+ agent verbs the tRPC surface has no first-class path for (`ask`, `orient`,
203
+ `discover`). Use it when you want a dependency-free REST client, not a full app.
204
+
205
+ ## Keep types fresh
206
+ The SDK is typed by `@synap-core/api-types`, generated from the pod's live router.
207
+ If the pod adds a procedure and you don't see it, bump `@synap-core/api-types`.
208
+
209
+ ---
210
+
211
+ # Creating the base app
212
+
213
+ The base app is an opinionated, batteries-included starter: **Next.js 16 (App
214
+ Router) + React 19 + HeroUI + Tailwind**, with auth (incl. TOTP), an app shell
215
+ (tabs + slide-in right panel), a Cmd+K command palette, a realtime bridge, and a
216
+ mock mode — all pre-wired. You add your screens; the plumbing is done.
217
+
218
+ ## Scaffold it
219
+
220
+ ```bash
221
+ npx create-synap-app my-app
222
+ cd my-app
223
+ cp .env.example .env.local # fill in your pod / control-plane URLs
224
+ pnpm dev # http://localhost:3010
225
+ ```
226
+
227
+ Develop with **no pod** by setting `NEXT_PUBLIC_BASE_MOCK_MODE=true`.
228
+
229
+ ## What's where
230
+
231
+ ```
232
+ app/
233
+ layout.tsx Root layout → ClientProviders (client-only, see below)
234
+ ClientProviders Loads the provider tree with { ssr: false } (REQUIRED — see rule 1)
235
+ providers.tsx The real provider stack (auth, tRPC, realtime, palette)
236
+ (app)/home Your home screen — replace this
237
+ login/ onboarding First-run + auth screens
238
+ lib/
239
+ registerAll.ts Boot hook — registers cells/views (override in your app)
240
+ auth.ts mockMode Session + mock helpers
241
+ components/layout/
242
+ AppShell Root layout primitive — pass your sidebar as `leftNav`
243
+ ```
244
+
245
+ ## Four rules that keep the build green (all Next 16 / Turbopack specifics)
246
+
247
+ 1. **The provider tree must load client-only.** `app/ClientProviders.tsx` does
248
+ `dynamic(() => import("./providers"), { ssr: false })`. base's provider tree
249
+ pulls a dep that touches `window` at module scope, which crashes a server
250
+ render. base is a client app shell — there is nothing to server-render — so
251
+ this is correct, not a hack. Keep it.
252
+ 2. **`config.matcher` in `middleware.ts` must be an inline literal**, not a value
253
+ read from a helper — Next's static analyzer can't parse an expression there.
254
+ 3. **In `globals.css`, `@import` must come before the `@tailwind` directives.**
255
+ Turbopack enforces the CSS spec strictly.
256
+ 4. **Build with Turbopack (the default) — do NOT pass `--webpack`.** In Next 16
257
+ the legacy `--webpack` flag silently produces nothing (exit 0, no output). If
258
+ you add a webpack alias, port it to `turbopack.resolveAlias` in `next.config.ts`.
259
+
260
+ ## Deriving your own app
261
+
262
+ 1. Rename the namespaced storage keys (`base:session`, `base-workspace`, …) so
263
+ two Synap apps don't share state in one browser. The README lists every key.
264
+ 2. Replace `app/(app)/home/page.tsx` with your dashboard.
265
+ 3. Pass your sidebar: `<AppShell leftNav={<MySidebar />}>`.
266
+ 4. Register app-specific Cmd+K commands with `useRegisterCommand([...])`.
267
+ 5. Register only the cells you need in `lib/registerAll.ts` (a lean template
268
+ registers fewer than the full set).
269
+
270
+ ## Auth flow (already wired)
271
+
272
+ `/login` → Synap Cloud sign-in (email + password or magic link) → optional TOTP →
273
+ pod picker → handshake → session stored → `/home`. Self-hosted pods fall back to
274
+ the pod's own Kratos at `/login?mode=kratos`. You don't build this; you theme it.
275
+
276
+ ---
277
+
278
+ # Governance — `"proposed"` is success, not an error
279
+
280
+ This is the single most important thing to get right when writing code that
281
+ mutates a Synap pod.
282
+
283
+ ## The contract
284
+
285
+ Every mutation (`entities.create`, `entities.update`, `relations.create`, …)
286
+ resolves to one of three outcomes, decided **by the pod**, not by your app:
287
+
288
+ | Outcome | Meaning | What your code should do |
289
+ |---|---|---|
290
+ | `approved` | applied immediately | proceed |
291
+ | `proposed` | queued for the pod owner's review (like a PR) | **surface the review — do NOT treat as failure, do NOT retry** |
292
+ | `denied` | the principal may not do this | show why; do not retry blindly |
293
+
294
+ ## Why it matters for your code
295
+
296
+ - **Never treat `proposed` as an error.** It is the normal, healthy path for any
297
+ write that governance decides a human should see first. Retrying a `proposed`
298
+ write creates duplicates.
299
+ - **Never `try/catch` a `proposed` as if it threw.** It's a successful response
300
+ with a status, not an exception.
301
+ - **Surface the review link/id** so the user can approve it. An unreviewed
302
+ proposal is not yet in the graph — it won't show up in reads until approved.
303
+
304
+ ## Pattern
305
+
306
+ ```ts
307
+ const res = await synap.entities.create.mutate(input);
308
+ switch (res.status) {
309
+ case "approved": /* it's live */ break;
310
+ case "proposed": /* tell the user: "queued for review" + show res.proposalId */ break;
311
+ case "denied": /* show res.reason; don't retry */ break;
312
+ }
313
+ ```
314
+
315
+ ## Idempotency
316
+
317
+ If you must retry a create after a network error, pass an idempotency key where
318
+ the API accepts one — a `proposed` write that you retry without one will
319
+ duplicate on approval. When unsure, read back before re-creating.
@@ -0,0 +1,5 @@
1
+ overview.md
2
+ install-commands.md
3
+ using-the-sdk.md
4
+ creating-the-base-app.md
5
+ governance.md
@@ -0,0 +1,20 @@
1
+ name: synap-app
2
+ description: >
3
+ Use this skill when the user wants to BUILD THEIR OWN APP on top of Synap — a
4
+ personal project or a product — using Synap as the backend (auth, typed data
5
+ API, realtime). Two paths: add the SDK (@synap-core/sdk) to an existing app,
6
+ or scaffold the opinionated Next.js + HeroUI base app (npx create-synap-app).
7
+ Triggers: "build an app on Synap", "use Synap as my backend", "scaffold a
8
+ Synap project", "add the Synap SDK", "connect my app to my pod",
9
+ "npx create-synap-app". NOT the `synap` skill (capture/recall in a pod) nor
10
+ `synap-ui` (views inside the pod's own UI) — this is about writing app CODE.
11
+ metadata:
12
+ openclaw:
13
+ requires:
14
+ env: []
15
+ optional_env: [SYNAP_POD_URL, SYNAP_WORKSPACE_ID]
16
+ primaryEnv: null
17
+ homepage: https://synap.live
18
+ capabilities: [sdk, scaffold, auth, realtime]
19
+ os: [macos, linux, windows]
20
+ userInvocable: true
@@ -0,0 +1,64 @@
1
+ # Creating the base app
2
+
3
+ The base app is an opinionated, batteries-included starter: **Next.js 16 (App
4
+ Router) + React 19 + HeroUI + Tailwind**, with auth (incl. TOTP), an app shell
5
+ (tabs + slide-in right panel), a Cmd+K command palette, a realtime bridge, and a
6
+ mock mode — all pre-wired. You add your screens; the plumbing is done.
7
+
8
+ ## Scaffold it
9
+
10
+ ```bash
11
+ npx create-synap-app my-app
12
+ cd my-app
13
+ cp .env.example .env.local # fill in your pod / control-plane URLs
14
+ pnpm dev # http://localhost:3010
15
+ ```
16
+
17
+ Develop with **no pod** by setting `NEXT_PUBLIC_BASE_MOCK_MODE=true`.
18
+
19
+ ## What's where
20
+
21
+ ```
22
+ app/
23
+ layout.tsx Root layout → ClientProviders (client-only, see below)
24
+ ClientProviders Loads the provider tree with { ssr: false } (REQUIRED — see rule 1)
25
+ providers.tsx The real provider stack (auth, tRPC, realtime, palette)
26
+ (app)/home Your home screen — replace this
27
+ login/ onboarding First-run + auth screens
28
+ lib/
29
+ registerAll.ts Boot hook — registers cells/views (override in your app)
30
+ auth.ts mockMode Session + mock helpers
31
+ components/layout/
32
+ AppShell Root layout primitive — pass your sidebar as `leftNav`
33
+ ```
34
+
35
+ ## Four rules that keep the build green (all Next 16 / Turbopack specifics)
36
+
37
+ 1. **The provider tree must load client-only.** `app/ClientProviders.tsx` does
38
+ `dynamic(() => import("./providers"), { ssr: false })`. base's provider tree
39
+ pulls a dep that touches `window` at module scope, which crashes a server
40
+ render. base is a client app shell — there is nothing to server-render — so
41
+ this is correct, not a hack. Keep it.
42
+ 2. **`config.matcher` in `middleware.ts` must be an inline literal**, not a value
43
+ read from a helper — Next's static analyzer can't parse an expression there.
44
+ 3. **In `globals.css`, `@import` must come before the `@tailwind` directives.**
45
+ Turbopack enforces the CSS spec strictly.
46
+ 4. **Build with Turbopack (the default) — do NOT pass `--webpack`.** In Next 16
47
+ the legacy `--webpack` flag silently produces nothing (exit 0, no output). If
48
+ you add a webpack alias, port it to `turbopack.resolveAlias` in `next.config.ts`.
49
+
50
+ ## Deriving your own app
51
+
52
+ 1. Rename the namespaced storage keys (`base:session`, `base-workspace`, …) so
53
+ two Synap apps don't share state in one browser. The README lists every key.
54
+ 2. Replace `app/(app)/home/page.tsx` with your dashboard.
55
+ 3. Pass your sidebar: `<AppShell leftNav={<MySidebar />}>`.
56
+ 4. Register app-specific Cmd+K commands with `useRegisterCommand([...])`.
57
+ 5. Register only the cells you need in `lib/registerAll.ts` (a lean template
58
+ registers fewer than the full set).
59
+
60
+ ## Auth flow (already wired)
61
+
62
+ `/login` → Synap Cloud sign-in (email + password or magic link) → optional TOTP →
63
+ pod picker → handshake → session stored → `/home`. Self-hosted pods fall back to
64
+ the pod's own Kratos at `/login?mode=kratos`. You don't build this; you theme it.
@@ -0,0 +1,42 @@
1
+ # Governance — `"proposed"` is success, not an error
2
+
3
+ This is the single most important thing to get right when writing code that
4
+ mutates a Synap pod.
5
+
6
+ ## The contract
7
+
8
+ Every mutation (`entities.create`, `entities.update`, `relations.create`, …)
9
+ resolves to one of three outcomes, decided **by the pod**, not by your app:
10
+
11
+ | Outcome | Meaning | What your code should do |
12
+ |---|---|---|
13
+ | `approved` | applied immediately | proceed |
14
+ | `proposed` | queued for the pod owner's review (like a PR) | **surface the review — do NOT treat as failure, do NOT retry** |
15
+ | `denied` | the principal may not do this | show why; do not retry blindly |
16
+
17
+ ## Why it matters for your code
18
+
19
+ - **Never treat `proposed` as an error.** It is the normal, healthy path for any
20
+ write that governance decides a human should see first. Retrying a `proposed`
21
+ write creates duplicates.
22
+ - **Never `try/catch` a `proposed` as if it threw.** It's a successful response
23
+ with a status, not an exception.
24
+ - **Surface the review link/id** so the user can approve it. An unreviewed
25
+ proposal is not yet in the graph — it won't show up in reads until approved.
26
+
27
+ ## Pattern
28
+
29
+ ```ts
30
+ const res = await synap.entities.create.mutate(input);
31
+ switch (res.status) {
32
+ case "approved": /* it's live */ break;
33
+ case "proposed": /* tell the user: "queued for review" + show res.proposalId */ break;
34
+ case "denied": /* show res.reason; don't retry */ break;
35
+ }
36
+ ```
37
+
38
+ ## Idempotency
39
+
40
+ If you must retry a create after a network error, pass an idempotency key where
41
+ the API accepts one — a `proposed` write that you retry without one will
42
+ duplicate on approval. When unsure, read back before re-creating.
@@ -0,0 +1,55 @@
1
+ # Install & scaffold commands
2
+
3
+ ## Scaffold a full app (recommended for a fresh start)
4
+
5
+ ```bash
6
+ npx create-synap-app my-app
7
+ ```
8
+
9
+ Creates a Next.js + HeroUI project from the base template, with the SDK, auth,
10
+ app shell, command palette, realtime, and mock mode pre-wired. It also drops an
11
+ `AGENTS.md` into the project so your AI coding tool knows how to work with it.
12
+
13
+ ## Add the SDK to an existing app
14
+
15
+ ```bash
16
+ # npm
17
+ npm install @synap-core/sdk@^1.0.0
18
+
19
+ # with React bindings
20
+ npm install @synap-core/sdk@^1.0.0 @synap-core/react@^1.0.0
21
+
22
+ # realtime
23
+ npm install @synap-core/sdk-realtime
24
+
25
+ # auth (browser sign-in) or auth-bootstrap (server credential bootstrap)
26
+ npm install @synap-core/auth # or @synap-core/auth-bootstrap
27
+ ```
28
+
29
+ Pin `@^1.0.0` on `sdk`/`react`. **Do not** install unpinned `@synap-core/sdk` —
30
+ older `0.x` versions on the registry are a different, abandoned package.
31
+
32
+ ## Get this knowledge into your AI coding tool
33
+
34
+ ```bash
35
+ # add the app-creation skill (this skill) to a connected AI tool
36
+ synap skills get synap-app
37
+
38
+ # or wire a tool end-to-end (skills + MCP), any target
39
+ synap connect --target=cursor # or claude, openclaw, …
40
+ ```
41
+
42
+ Alternatively, the scaffolded project ships an `AGENTS.md` at its root — most AI
43
+ coding tools read it automatically, so a freshly-scaffolded app teaches the AI
44
+ how to build on it with zero extra setup.
45
+
46
+ ## Verify an install actually works
47
+
48
+ Publishing bugs have shipped uninstallable Synap packages before. After adding a
49
+ package, confirm it resolves in a clean directory:
50
+
51
+ ```bash
52
+ mkdir /tmp/synap-check && cd /tmp/synap-check && npm init -y
53
+ npm install @synap-core/sdk@^1.0.0
54
+ node -e "console.log(typeof require('@synap-core/sdk').createSynapClient)" # → function
55
+ ```
@@ -0,0 +1,50 @@
1
+ # Building an app on Synap
2
+
3
+ Synap is a sovereign data pod with a complete, typed API. You build an app on it
4
+ the same way you'd build on any backend — except the backend is the user's own
5
+ pod, and **every write is governed** (see `governance.md`).
6
+
7
+ ## Decide the path first
8
+
9
+ | The user has… | Do this | Read |
10
+ |---|---|---|
11
+ | an existing app (any framework) | add the SDK | `using-the-sdk.md`, `install-commands.md` |
12
+ | nothing yet, wants a full app fast | scaffold the base app | `creating-the-base-app.md`, `install-commands.md` |
13
+ | a server / script / CLI (no browser) | SDK with a session token or API key | `using-the-sdk.md` |
14
+
15
+ Both paths use the same underlying packages; only the amount of scaffolding differs.
16
+
17
+ ## The packages (all published under `@synap-core/*`)
18
+
19
+ - `@synap-core/sdk` — typed tRPC client. `createSynapClient({ podUrl, ... })`. **The one you almost always want.**
20
+ - `@synap-core/react` — React/TanStack-Query bindings (`SynapProvider`, hooks).
21
+ - `@synap-core/sdk-realtime` — Socket.IO presence/live-updates (`createRealtimeClient`).
22
+ - `@synap-core/auth` — sign-in orchestration (Synap Cloud + pod handshake), framework-agnostic.
23
+ - `@synap-core/auth-bootstrap` — zero-dep server helpers (`setupAgent`, `handshake`) for machine clients.
24
+
25
+ Pin `@^1.0.0` on `sdk`/`react` so you never resolve an old, abandoned `0.x`.
26
+
27
+ ## The three rules that trip people up
28
+
29
+ 1. **A write can come back `"proposed"` — that is SUCCESS, not an error.** It means
30
+ the change is queued for the pod owner's review (like a PR). Surface the review,
31
+ don't retry. Full contract: `governance.md`.
32
+ 2. **The pod URL has no `/trpc` suffix and no trailing slash.** The SDK appends `/trpc`.
33
+ 3. **Non-browser clients (server/CLI/mobile) authenticate with a token or API key**,
34
+ never a cookie. Browser apps use the Synap Cloud sign-in flow (`@synap-core/auth`).
35
+
36
+ ## Get a pod to build against
37
+
38
+ - **Self-host (free):** `git clone` the backend, `docker compose up -d` (run its
39
+ `install.sh` to generate secrets). Pod answers on `:4000`.
40
+ - **Managed (paid):** sign up at synap.live and provision a pod.
41
+
42
+ You can develop the base app with **no pod at all** using its mock mode
43
+ (`NEXT_PUBLIC_BASE_MOCK_MODE=true`).
44
+
45
+ ## Honest scope
46
+
47
+ Building on the user's OWN pod is fully supported today. Building a **multi-tenant
48
+ commercial app** where *other* people connect *their* pods is **not yet supported**
49
+ — per-app data scoping is still being built. If the user asks for that, say so;
50
+ don't architect around a capability that isn't there.
@@ -0,0 +1,73 @@
1
+ # Using the SDK
2
+
3
+ ## Vanilla / TypeScript / server / CLI — `@synap-core/sdk`
4
+
5
+ ```ts
6
+ import { createSynapClient } from "@synap-core/sdk";
7
+
8
+ const synap = createSynapClient({
9
+ podUrl: "https://pod.example.com", // NO trailing slash, NO /trpc suffix
10
+ apiKey: process.env.SYNAP_API_KEY, // or sessionToken (see auth below)
11
+ workspaceId: process.env.SYNAP_WORKSPACE_ID ?? "",
12
+ });
13
+
14
+ // It's a typed tRPC client — full autocomplete over every router.
15
+ const me = await synap.users.me.query();
16
+ const entities = await synap.entities.list.query({ /* filter */ });
17
+ const result = await synap.entities.create.mutate({ /* ... */ });
18
+ // result may be { status: "proposed", ... } — that is success. See governance.md.
19
+ ```
20
+
21
+ ### Auth modes (pick ONE)
22
+ - **`apiKey`** — a Bearer key generated in the workspace's developer settings.
23
+ Best for servers, scripts, CLIs.
24
+ - **`sessionToken`** — an Ory Kratos session token, sent as `X-Session-Token`.
25
+ Best for non-browser clients that completed a sign-in.
26
+ - **cookie fallback** — omit both; the client uses the ambient Kratos cookie.
27
+ Browser, same-origin only.
28
+
29
+ For machine clients that need to bootstrap a credential, use
30
+ `@synap-core/auth-bootstrap` (`setupAgent(provisioningToken)` → API key,
31
+ `handshake(jwt)` → session token). Zero-dependency, safe in edge/serverless.
32
+
33
+ ## React — `@synap-core/react`
34
+
35
+ ```tsx
36
+ import { SynapProvider, useSynapContext } from "@synap-core/react";
37
+
38
+ function App() {
39
+ return (
40
+ <SynapProvider podUrl={podUrl} sessionToken={token} workspaceId={ws}>
41
+ <Dashboard />
42
+ </SynapProvider>
43
+ );
44
+ }
45
+ ```
46
+
47
+ `SynapProvider` honours every `createSynapClient` option, incl. `sessionToken`
48
+ and `onAuthError` (a 401 handler). `react` is a peer of your app's React — it
49
+ does not bundle its own.
50
+
51
+ ## Realtime — `@synap-core/sdk-realtime`
52
+
53
+ ```ts
54
+ import { createRealtimeClient } from "@synap-core/sdk-realtime";
55
+
56
+ const rt = createRealtimeClient({ podUrl, sessionToken });
57
+ const stop = rt.onInvalidate((target) => {
58
+ // e.g. refetch the affected query
59
+ });
60
+ ```
61
+
62
+ Websocket-only transport (credentials never ride a long-poll URL) and it refuses
63
+ to send credentials over non-TLS unless you explicitly pass `allowInsecure`.
64
+
65
+ ## Two transports, on purpose
66
+ - `@synap-core/sdk` (tRPC) — for apps. Typed, hooks, realtime.
67
+ - `@synap-core/hub-rest-client` (REST, zero-dep) — for agents/CLIs/scripts. Carries
68
+ agent verbs the tRPC surface has no first-class path for (`ask`, `orient`,
69
+ `discover`). Use it when you want a dependency-free REST client, not a full app.
70
+
71
+ ## Keep types fresh
72
+ The SDK is typed by `@synap-core/api-types`, generated from the pod's live router.
73
+ If the pod adds a procedure and you don't see it, bump `@synap-core/api-types`.