@lobu/runtime-server 24.3.0 → 24.5.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 (290) hide show
  1. package/dist/catalogs/skills.json +2 -2
  2. package/dist/component.json +1 -1
  3. package/dist/connectors/postgres.ts +77 -48
  4. package/dist/db/migrations/20261101010000_public_source_type_references.sql +157 -0
  5. package/dist/dependencies.bun.lock +115 -144
  6. package/dist/owletto/dist/assets/_-CCWuGXtQ.js +2 -0
  7. package/dist/owletto/dist/assets/_-DOJW1D-I.js +3 -0
  8. package/dist/owletto/dist/assets/_agentId-CJhQbi6k.js +2 -0
  9. package/dist/owletto/dist/assets/_agentId-DD4K1i6V.js +2 -0
  10. package/dist/owletto/dist/assets/_automationId-Cbd7B0mP.js +2 -0
  11. package/dist/owletto/dist/assets/_connectorKey._connectionId-DFpPep9B.js +2 -0
  12. package/dist/owletto/dist/assets/_connectorKey.index-n3iSDT74.js +2 -0
  13. package/dist/owletto/dist/assets/_conversationId-B1yGIGA9.js +2 -0
  14. package/dist/owletto/dist/assets/_eventId-B1H0-vD7.js +2 -0
  15. package/dist/owletto/dist/assets/_name-D30_V03t.js +2 -0
  16. package/dist/owletto/dist/assets/_owner-Be8O41u8.js +3 -0
  17. package/dist/owletto/dist/assets/_shape-C6YbloRh.js +2 -0
  18. package/dist/owletto/dist/assets/_skillKey-BMPvvoOI.js +2 -0
  19. package/dist/owletto/dist/assets/_slug-Bc4YIEA2.js +2 -0
  20. package/dist/owletto/dist/assets/_view-aoFDwEld.js +2 -0
  21. package/dist/owletto/dist/assets/_viewKey-DuNHc3cc.js +2 -0
  22. package/dist/owletto/dist/assets/_viewKey-rJ7A1zNx.js +2 -0
  23. package/dist/owletto/dist/assets/accept-invitation-pUl-c1KQ.js +2 -0
  24. package/dist/owletto/dist/assets/activity-route-view-DN0ZEAzr.js +2 -0
  25. package/dist/owletto/dist/assets/{agent-card-controls-DiU7Un5w.js → agent-card-controls-C5jNWgfq.js} +2 -2
  26. package/dist/owletto/dist/assets/agent-client-setup-list-DbXtJTsO.js +4 -0
  27. package/dist/owletto/dist/assets/agent-connect-pages-DcTuiSt9.js +2 -0
  28. package/dist/owletto/dist/assets/agent-editor-form-CdA5vLr8.js +2 -0
  29. package/dist/owletto/dist/assets/agent-guardrails-route-BJyfalBY.js +2 -0
  30. package/dist/owletto/dist/assets/agent-list-row-rF5LH-3k.js +2 -0
  31. package/dist/owletto/dist/assets/{agent-loading-shells-CamDtzHY.js → agent-loading-shells-ClY_O6lb.js} +2 -2
  32. package/dist/owletto/dist/assets/{agent-permissions-matrix-CgsQ8BK_.js → agent-permissions-matrix-bP1Qihv7.js} +2 -2
  33. package/dist/owletto/dist/assets/{agent-skill-context-lWbXKEm1.js → agent-skill-context-BAaGpvfS.js} +2 -2
  34. package/dist/owletto/dist/assets/agent-skills-route-Bv5luNdw.js +2 -0
  35. package/dist/owletto/dist/assets/agent-tab-intro-ednTs4WF.js +2 -0
  36. package/dist/owletto/dist/assets/agent-thread-WNk2HapT.js +6 -0
  37. package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +2 -0
  38. package/dist/owletto/dist/assets/agents-DY2S2SGE.js +2 -0
  39. package/dist/owletto/dist/assets/agents-workbench-bPTjdVS1.js +2 -0
  40. package/dist/owletto/dist/assets/app._appId-DrL5H5lB.js +2 -0
  41. package/dist/owletto/dist/assets/assist-composer-ClfFEVx7.js +2 -0
  42. package/dist/owletto/dist/assets/automation-detail-content-dFy1Huas.js +2 -0
  43. package/dist/owletto/dist/assets/automation-row-DCHM--aD.js +2 -0
  44. package/dist/owletto/dist/assets/automations-DY2S2SGE.js +2 -0
  45. package/dist/owletto/dist/assets/{calendar-DDCCSPW6.js → calendar-Ck0yOLYu.js} +2 -2
  46. package/dist/owletto/dist/assets/{callback-DFciMR8u.js → callback-DRABUOha.js} +2 -2
  47. package/dist/owletto/dist/assets/{card-BCsbrdGs.js → card-Bdi7VEwo.js} +2 -2
  48. package/dist/owletto/dist/assets/change-summary-PBoM6Asb.js +2 -0
  49. package/dist/owletto/dist/assets/{claim-BRua2b_7.js → claim-CUIG1Oc-.js} +2 -2
  50. package/dist/owletto/dist/assets/client-activity-scopes-CXOWB5co.js +2 -0
  51. package/dist/owletto/dist/assets/{client-rows-DiJQ5D1z.js → client-rows-36VnmgMK.js} +2 -2
  52. package/dist/owletto/dist/assets/clients-BJRcMk1A.js +2 -0
  53. package/dist/owletto/dist/assets/code-editor-DNuRKde1.js +16 -0
  54. package/dist/owletto/dist/assets/connect-CMcEQWls.js +2 -0
  55. package/dist/owletto/dist/assets/connect-menu-C-B-1xGR.js +2 -0
  56. package/dist/owletto/dist/assets/connect._clientId-tGipxP5a.js +2 -0
  57. package/dist/owletto/dist/assets/connected._clientId-DSGU78eV.js +2 -0
  58. package/dist/owletto/dist/assets/connected._clientId.activity-CPLbry8R.js +2 -0
  59. package/dist/owletto/dist/assets/connected._clientId.index-jSnGvzYs.js +2 -0
  60. package/dist/owletto/dist/assets/connection-feed-detail-BIlkK0Pd.js +2 -0
  61. package/dist/owletto/dist/assets/connection-q1bdnxCN.js +2 -0
  62. package/dist/owletto/dist/assets/{connections-browser-BMV8bf54.js → connections-browser-V-3td9DB.js} +2 -2
  63. package/dist/owletto/dist/assets/{connector-boxes-DqZA-FdG.js → connector-boxes-lFc-WP83.js} +2 -2
  64. package/dist/owletto/dist/assets/connector-page-shell-Cs1SjrYB.js +2 -0
  65. package/dist/owletto/dist/assets/{connector-provenance-BIg8P8WY.js → connector-provenance-aJFeeRIC.js} +2 -2
  66. package/dist/owletto/dist/assets/{connector-scope-lists-CJYz53YF.js → connector-scope-lists--vNdbOn0.js} +2 -2
  67. package/dist/owletto/dist/assets/connectors-BsvDMdsQ.js +2 -0
  68. package/dist/owletto/dist/assets/consent-DJV78pnz.js +2 -0
  69. package/dist/owletto/dist/assets/copy-button-DjMWgrBf.js +2 -0
  70. package/dist/owletto/dist/assets/{core.esm-A1UnFbGs.js → core.esm-CQzL3ObT.js} +3 -3
  71. package/dist/owletto/dist/assets/create-BmKx5vq3.js +2 -0
  72. package/dist/owletto/dist/assets/create-Rt0RbiD4.js +2 -0
  73. package/dist/owletto/dist/assets/create-automation-form-PEmSLMD6.js +3 -0
  74. package/dist/owletto/dist/assets/create-jBEuveV1.js +2 -0
  75. package/dist/owletto/dist/assets/create._connectorKey-DcxhYIYC.js +2 -0
  76. package/dist/owletto/dist/assets/device-Ba3RsIgb.js +2 -0
  77. package/dist/owletto/dist/assets/device-pin-tombstone-C79KIAIK.js +2 -0
  78. package/dist/owletto/dist/assets/device._deviceId-CIaoq9co.js +2 -0
  79. package/dist/owletto/dist/assets/{entity-avatar-CEV4ttUQ.js → entity-avatar-TVKjZxWQ.js} +2 -2
  80. package/dist/owletto/dist/assets/entity-options-daOOQo7O.js +2 -0
  81. package/dist/owletto/dist/assets/entity-page-BfJXvbxn.js +2 -0
  82. package/dist/owletto/dist/assets/entity-type-page-BLwH6qa7.js +2 -0
  83. package/dist/owletto/dist/assets/event-card-DVUB8my6.js +2 -0
  84. package/dist/owletto/dist/assets/event-detail-DkY95e5b.js +2 -0
  85. package/dist/owletto/dist/assets/{events-feed-VfU4csn2.js → events-feed-B9CZHI_P.js} +2 -2
  86. package/dist/owletto/dist/assets/filter-bar-wPaR12SS.js +2 -0
  87. package/dist/owletto/dist/assets/{full-page-spinner-C1Q_jEzD.js → full-page-spinner-BqmckkOf.js} +2 -2
  88. package/dist/owletto/dist/assets/guardrails-Csusrok2.js +2 -0
  89. package/dist/owletto/dist/assets/identity-Dmg3STO8.js +2 -0
  90. package/dist/owletto/dist/assets/index--ZWegctR.js +2 -0
  91. package/dist/owletto/dist/assets/{index-DFyBbp7b.js → index-B0kw2lFL.js} +2 -2
  92. package/dist/owletto/dist/assets/index-BKrdVwW9.js +2 -0
  93. package/dist/owletto/dist/assets/index-BUBcNNUY.js +2 -0
  94. package/dist/owletto/dist/assets/index-BUDr4-Yv.js +2 -0
  95. package/dist/owletto/dist/assets/index-BYPQWVwD.js +2 -0
  96. package/dist/owletto/dist/assets/index-BfpaPJPj.js +2 -0
  97. package/dist/owletto/dist/assets/index-BicNFLBW.js +2 -0
  98. package/dist/owletto/dist/assets/index-Bsdv5aks.js +2 -0
  99. package/dist/owletto/dist/assets/index-C186T2Rw.js +53 -0
  100. package/dist/owletto/dist/assets/index-CX0pJ9j9.js +2 -0
  101. package/dist/owletto/dist/assets/{index-DQxzeM37.js → index-CsrT07TJ.js} +2 -2
  102. package/dist/owletto/dist/assets/index-DdBTTN3y.js +7899 -0
  103. package/dist/owletto/dist/assets/index-DdYWarql.css +1 -0
  104. package/dist/owletto/dist/assets/index-JYEIN8nM.js +2 -0
  105. package/dist/owletto/dist/assets/index-Vcq4gwWv.js +2 -0
  106. package/dist/owletto/dist/assets/{index-DNtYqkiA.js → index-ijqrJaRB.js} +2 -2
  107. package/dist/owletto/dist/assets/{index-yIub2xUM.js → index-ikp_mTsf.js} +2 -2
  108. package/dist/owletto/dist/assets/json-diff-BaLL4Fsu.js +14 -0
  109. package/dist/owletto/dist/assets/{list-skeleton-Kzxi2OXB.js → list-skeleton-CXDLkYTg.js} +2 -2
  110. package/dist/owletto/dist/assets/login-u6LCgDYG.js +2 -0
  111. package/dist/owletto/dist/assets/{logout-Dt_VDilG.js → logout-JhmuWJEH.js} +2 -2
  112. package/dist/owletto/dist/assets/manage-gear-D8LMhehh.js +2 -0
  113. package/dist/owletto/dist/assets/{member-scope-gate-De75CR7W.js → member-scope-gate-4FQ0aanZ.js} +2 -2
  114. package/dist/owletto/dist/assets/memory-browse-page-CNZJbCJC.js +74 -0
  115. package/dist/owletto/dist/assets/model-jL871x2J.js +2 -0
  116. package/dist/owletto/dist/assets/model-selector-CgU8SJMF.js +2 -0
  117. package/dist/owletto/dist/assets/models-jdemgIZk.js +2 -0
  118. package/dist/owletto/dist/assets/nav-pill-DrFkuyUQ.js +2 -0
  119. package/dist/owletto/dist/assets/new-CcJOd5aH.js +2 -0
  120. package/dist/owletto/dist/assets/{new-BbdwuJPm.js → new-DgE1pVV0.js} +2 -2
  121. package/dist/owletto/dist/assets/new-OWwrYckd.js +2 -0
  122. package/dist/owletto/dist/assets/organization-CKM_oFX3.js +2 -0
  123. package/dist/owletto/dist/assets/peek-pane-content-D68BjguQ.js +2 -0
  124. package/dist/owletto/dist/assets/pending-seed-sml8Uf6e.js +2 -0
  125. package/dist/owletto/dist/assets/permissions-BvA9SATv.js +2 -0
  126. package/dist/owletto/dist/assets/proposal-review-shell-D6KABxah.js +2 -0
  127. package/dist/owletto/dist/assets/public-shell-ready-BIVCHQHe.js +2 -0
  128. package/dist/owletto/dist/assets/record-activity-C9gVBbF0.js +2 -0
  129. package/dist/owletto/dist/assets/{record-session-D07szzqN.js → record-session-R-uHNuby.js} +2 -2
  130. package/dist/owletto/dist/assets/{renderer-AJxSmE3-.js → renderer-DXfJaCCa.js} +23 -23
  131. package/dist/owletto/dist/assets/reset-password-Mx3baeNc.js +2 -0
  132. package/dist/owletto/dist/assets/run-activity-link-CaIBSRQj.js +2 -0
  133. package/dist/owletto/dist/assets/run-initiator-BvzQJYW9.js +2 -0
  134. package/dist/owletto/dist/assets/runs-fFJ1lPnw.js +2 -0
  135. package/dist/owletto/dist/assets/runs-panel-DEnZHTa5.js +2 -0
  136. package/dist/owletto/dist/assets/runs-table-XGnxJl7S.js +2 -0
  137. package/dist/owletto/dist/assets/{schema-type-editor-panel-C_Es0qDf.js → schema-type-editor-panel-C0_9VcSs.js} +2 -2
  138. package/dist/owletto/dist/assets/settings-CP4PjMQA.js +2 -0
  139. package/dist/owletto/dist/assets/settings-CgaUJMHH.js +2 -0
  140. package/dist/owletto/dist/assets/skills-D-e_h3a9.js +2 -0
  141. package/dist/owletto/dist/assets/{source-record-panels-CjFPgKKJ.js → source-record-panels-Bh0n4gGw.js} +2 -2
  142. package/dist/owletto/dist/assets/{status-dot-CSBtKT4g.js → status-dot-Cpq63I7p.js} +2 -2
  143. package/dist/owletto/dist/assets/{table-DHM-vCxP.js → table-BUqshjxa.js} +2 -2
  144. package/dist/owletto/dist/assets/{use-automations-C4TSie1i.js → use-automations-BLNjxq2K.js} +2 -2
  145. package/dist/owletto/dist/assets/use-login-redirect-CmyQW7GT.js +2 -0
  146. package/dist/owletto/dist/assets/{use-mention-search-PfZrNbu_.js → use-mention-search-dn3ws1WB.js} +3 -3
  147. package/dist/owletto/dist/assets/use-scroll-sentinel-DRyBMueA.js +2 -0
  148. package/dist/owletto/dist/assets/view-param-filters-CER47Tlz.js +2 -0
  149. package/dist/owletto/dist/assets/{views-access-required-2ubIf_3N.js → views-access-required-C_b9itZ2.js} +2 -2
  150. package/dist/owletto/dist/index.html +2 -2
  151. package/dist/server-main.bundle.mjs +54218 -51082
  152. package/dist/server.bundle.mjs +5 -5
  153. package/dist/verify.mjs +1 -1
  154. package/npm-shrinkwrap.json +351 -371
  155. package/package.json +3 -4
  156. package/vendor/connector-sdk/dist/reaction-client-types.d.ts +8 -2
  157. package/vendor/connector-sdk/dist/reaction-sdk.d.ts +5 -1
  158. package/vendor/connector-sdk/package.json +1 -1
  159. package/vendor/core/dist/contracts/agent-settings.d.ts +61 -6
  160. package/vendor/core/dist/contracts/agent-settings.js +10 -7
  161. package/vendor/core/dist/contracts/tools/manage-agents.d.ts +473 -98
  162. package/vendor/core/dist/contracts/tools/manage-agents.js +111 -2
  163. package/vendor/core/dist/contracts/tools/manage-automations.d.ts +21 -18
  164. package/vendor/core/dist/contracts/tools/manage-automations.js +15 -15
  165. package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
  166. package/vendor/core/dist/contracts/tools/manage-entity.d.ts +45 -20
  167. package/vendor/core/dist/contracts/tools/manage-entity.js +17 -5
  168. package/vendor/core/dist/contracts/tools/manage-inference-providers.d.ts +445 -0
  169. package/vendor/core/dist/contracts/tools/manage-inference-providers.js +133 -0
  170. package/vendor/core/dist/contracts/tools/manage-views.d.ts +4 -4
  171. package/vendor/core/dist/contracts/tools/manage-views.js +5 -3
  172. package/vendor/core/dist/contracts/worker/device-automation.js +4 -2
  173. package/vendor/core/dist/error-report.d.ts +73 -0
  174. package/vendor/core/dist/error-report.js +346 -0
  175. package/vendor/core/dist/index.d.ts +4 -1
  176. package/vendor/core/dist/index.js +7 -1
  177. package/vendor/core/dist/logger.js +15 -6
  178. package/vendor/core/dist/otel-fetch.d.ts +19 -0
  179. package/vendor/core/dist/otel-fetch.js +96 -0
  180. package/vendor/core/dist/otel.d.ts +22 -2
  181. package/vendor/core/dist/otel.js +95 -48
  182. package/vendor/core/dist/reserved.d.ts +1 -1
  183. package/vendor/core/dist/reserved.js +6 -4
  184. package/vendor/core/dist/tool-result.d.ts +8 -0
  185. package/vendor/core/dist/tool-result.js +61 -0
  186. package/vendor/core/dist/trace-context.d.ts +12 -0
  187. package/vendor/core/dist/trace-context.js +50 -0
  188. package/vendor/core/dist/utils/diagnostic-scrubber.js +1 -1
  189. package/vendor/core/dist/worker/auth.js +4 -0
  190. package/vendor/core/package.json +6 -1
  191. package/vendor/views/package.json +1 -1
  192. package/dist/owletto/dist/assets/_-XKF0m81R.js +0 -3
  193. package/dist/owletto/dist/assets/_-e8MbEBtw.js +0 -2
  194. package/dist/owletto/dist/assets/_agentId-Cv9goIFf.js +0 -2
  195. package/dist/owletto/dist/assets/_agentId-emObu67X.js +0 -2
  196. package/dist/owletto/dist/assets/_automationId-CfFFAYK1.js +0 -2
  197. package/dist/owletto/dist/assets/_connectorKey._connectionId-D6NKXSOE.js +0 -2
  198. package/dist/owletto/dist/assets/_connectorKey.index-DFrkLLTU.js +0 -2
  199. package/dist/owletto/dist/assets/_conversationId-D3vuAQPe.js +0 -2
  200. package/dist/owletto/dist/assets/_eventId-BV5SQaUA.js +0 -2
  201. package/dist/owletto/dist/assets/_name-DjtJMop4.js +0 -2
  202. package/dist/owletto/dist/assets/_owner-oBX68rb9.js +0 -3
  203. package/dist/owletto/dist/assets/_shape-C4lLPAwI.js +0 -2
  204. package/dist/owletto/dist/assets/_skillKey-Cw-7q6hI.js +0 -2
  205. package/dist/owletto/dist/assets/_slug-B2g5qzn3.js +0 -2
  206. package/dist/owletto/dist/assets/_viewKey-CIKGCtdK.js +0 -2
  207. package/dist/owletto/dist/assets/_viewKey-Dx4kJo7o.js +0 -2
  208. package/dist/owletto/dist/assets/accept-invitation-38lHBvjO.js +0 -2
  209. package/dist/owletto/dist/assets/activity-route-view-voRYSM3a.js +0 -2
  210. package/dist/owletto/dist/assets/agent-client-setup-list-Bkyw22GW.js +0 -5
  211. package/dist/owletto/dist/assets/agent-connect-pages-CpBxQCpx.js +0 -2
  212. package/dist/owletto/dist/assets/agent-editor-form-QrIDroFL.js +0 -2
  213. package/dist/owletto/dist/assets/agent-guardrails-route-CyoGSxcZ.js +0 -2
  214. package/dist/owletto/dist/assets/agent-skills-route-D-w3tY_2.js +0 -2
  215. package/dist/owletto/dist/assets/agent-subpage-shell-CLqpn5Tb.js +0 -2
  216. package/dist/owletto/dist/assets/agent-thread-CsRexwTv.js +0 -6
  217. package/dist/owletto/dist/assets/agents-DzH_FFKU.js +0 -2
  218. package/dist/owletto/dist/assets/agents-workbench-CmGrMvPC.js +0 -2
  219. package/dist/owletto/dist/assets/app._appId-BO7G38fL.js +0 -2
  220. package/dist/owletto/dist/assets/automation-detail-content-DMYxs6F6.js +0 -2
  221. package/dist/owletto/dist/assets/automations-DzH_FFKU.js +0 -2
  222. package/dist/owletto/dist/assets/client-activity-scopes-BLIy1Zc3.js +0 -2
  223. package/dist/owletto/dist/assets/clients-8-EpRjsm.js +0 -2
  224. package/dist/owletto/dist/assets/code-editor-BFZa4EIt.js +0 -16
  225. package/dist/owletto/dist/assets/connect-C0cHE9Xl.js +0 -2
  226. package/dist/owletto/dist/assets/connect-menu-D2K4tmvW.js +0 -2
  227. package/dist/owletto/dist/assets/connect._clientId-D4EG5a0v.js +0 -2
  228. package/dist/owletto/dist/assets/connected._clientId-DhoCT6sT.js +0 -2
  229. package/dist/owletto/dist/assets/connected._clientId.activity-Dn4qw2Us.js +0 -2
  230. package/dist/owletto/dist/assets/connected._clientId.index-BTI5JXA3.js +0 -2
  231. package/dist/owletto/dist/assets/connection-X9VU9Ijm.js +0 -2
  232. package/dist/owletto/dist/assets/connection-feed-detail-B6ydKasK.js +0 -2
  233. package/dist/owletto/dist/assets/connectors-BroKpwhB.js +0 -2
  234. package/dist/owletto/dist/assets/consent-fzLN-Qy7.js +0 -2
  235. package/dist/owletto/dist/assets/copy-button-Df7QXE0w.js +0 -2
  236. package/dist/owletto/dist/assets/create-BjwsYarn.js +0 -2
  237. package/dist/owletto/dist/assets/create-Dzr4mlr0.js +0 -2
  238. package/dist/owletto/dist/assets/create-automation-form-DHW6OUoS.js +0 -3
  239. package/dist/owletto/dist/assets/create-c94SPL21.js +0 -2
  240. package/dist/owletto/dist/assets/create._connectorKey-DLLn2nej.js +0 -2
  241. package/dist/owletto/dist/assets/cronstrue-xxpD1P2-.js +0 -2
  242. package/dist/owletto/dist/assets/device-C3AEoL5c.js +0 -2
  243. package/dist/owletto/dist/assets/device-pin-tombstone-B_te59GE.js +0 -2
  244. package/dist/owletto/dist/assets/device._deviceId-ZU09qrot.js +0 -2
  245. package/dist/owletto/dist/assets/entity-options-DJv2EhVV.js +0 -2
  246. package/dist/owletto/dist/assets/entity-page-BUghWZ1s.js +0 -2
  247. package/dist/owletto/dist/assets/entity-type-page-Lf6ONdpf.js +0 -2
  248. package/dist/owletto/dist/assets/event-card-CBlsG32u.js +0 -2
  249. package/dist/owletto/dist/assets/event-detail-BKSGEOdW.js +0 -2
  250. package/dist/owletto/dist/assets/filter-bar-COU0sBFQ.js +0 -2
  251. package/dist/owletto/dist/assets/guardrails-6ZJv1uzM.js +0 -2
  252. package/dist/owletto/dist/assets/identity-BaFLmbSo.js +0 -2
  253. package/dist/owletto/dist/assets/index-008wj-Pz.js +0 -7950
  254. package/dist/owletto/dist/assets/index-BaetvYLa.js +0 -2
  255. package/dist/owletto/dist/assets/index-BiEf5xOE.css +0 -1
  256. package/dist/owletto/dist/assets/index-BrDP4PCs.js +0 -2
  257. package/dist/owletto/dist/assets/index-BuXIeK7D.js +0 -2
  258. package/dist/owletto/dist/assets/index-CAVcR9za.js +0 -2
  259. package/dist/owletto/dist/assets/index-CMLfWGPU.js +0 -2
  260. package/dist/owletto/dist/assets/index-D0YEYP7N.js +0 -2
  261. package/dist/owletto/dist/assets/index-DkO0nPex.js +0 -2
  262. package/dist/owletto/dist/assets/index-KlRId0g6.js +0 -2
  263. package/dist/owletto/dist/assets/index-Ywnqi4A6.js +0 -2
  264. package/dist/owletto/dist/assets/index-wHFQv1aT.js +0 -12
  265. package/dist/owletto/dist/assets/index-xnxhf3Op.js +0 -2
  266. package/dist/owletto/dist/assets/json-diff-LE_vNZrM.js +0 -4
  267. package/dist/owletto/dist/assets/login-DWOT6jtS.js +0 -2
  268. package/dist/owletto/dist/assets/memory-browse-page-p2vIbfkC.js +0 -74
  269. package/dist/owletto/dist/assets/model-selector-3l9lY50C.js +0 -2
  270. package/dist/owletto/dist/assets/model-udnQ_S43.js +0 -2
  271. package/dist/owletto/dist/assets/models-CQj7GIOp.js +0 -2
  272. package/dist/owletto/dist/assets/new-BOwIHkre.js +0 -2
  273. package/dist/owletto/dist/assets/new-DTuFCQhV.js +0 -2
  274. package/dist/owletto/dist/assets/oauth-workspace-access-QPo4YwRX.js +0 -2
  275. package/dist/owletto/dist/assets/organization-BDzjnqPf.js +0 -2
  276. package/dist/owletto/dist/assets/peek-pane-content-D7yt0PrA.js +0 -2
  277. package/dist/owletto/dist/assets/permissions-CfoY4WFY.js +0 -2
  278. package/dist/owletto/dist/assets/proposal-review-shell-CVkLnnKo.js +0 -2
  279. package/dist/owletto/dist/assets/public-shell-ready-DXUTTGGp.js +0 -2
  280. package/dist/owletto/dist/assets/record-activity-BXhvJbd9.js +0 -2
  281. package/dist/owletto/dist/assets/reset-password-kRYyQuTY.js +0 -2
  282. package/dist/owletto/dist/assets/runs-lG2ChtOt.js +0 -2
  283. package/dist/owletto/dist/assets/runs-panel-LnGpHCAQ.js +0 -2
  284. package/dist/owletto/dist/assets/settings-CEAOg7fr.js +0 -2
  285. package/dist/owletto/dist/assets/settings-gGYXbFfd.js +0 -2
  286. package/dist/owletto/dist/assets/skills-BOL5c_Tk.js +0 -2
  287. package/dist/owletto/dist/assets/use-scroll-sentinel-D-fJx_Md.js +0 -2
  288. package/dist/owletto/dist/assets/view-param-filters-DkX4YdDT.js +0 -2
  289. /package/vendor/@better-auth-kysely-adapter/{.bun-tag-abf95749a412716 → .bun-tag-654b3a002b271269} +0 -0
  290. /package/vendor/postgres/{.bun-tag-22d644c2873790db → .bun-tag-c81dacd34e959a7a} +0 -0
@@ -8,7 +8,7 @@
8
8
  "version": "1.0.0",
9
9
  "description": "Set up new Lobu agents end to end and operate existing Lobu projects and memory: interview, scaffold, validate, authenticate, connect feeds, execute operations, and test Automations.",
10
10
  "detail": {
11
- "instructions": "# Lobu\n\nUse this skill when setting up a brand-new Lobu agent from scratch (follow \"Onboarding a New Project\" below) or when running, validating, evaluating, or connecting an existing Lobu project, or operating Lobu memory from a coding agent.\n\nThe `AGENTS.md` generated into a new project is the source of truth for the config API (the `define*` helpers, connectors, auth, Automations, memory) — this skill does not duplicate it. For an existing project, jump to \"Core Model\" + the relevant reference section below.\n\n## Onboarding a New Project\n\nUse this playbook when a new user asks you to build them a Lobu agent from scratch. Set it up end to end: ground yourself in what the user already has, interview, discover, scaffold, prove the complete local path, then offer the deployment choice. Do not call the setup complete until every path the user selected has actually passed end to end. If an external provider, authorization, deployment, or rate limit blocks the proof, name the exact blocker and leave the setup as blocked rather than claiming success.\n\n### 1. Ground yourself in what the user already has\n\nBefore interviewing, look at what already exists so your questions and suggestions are personal rather than a blank slate. This is discovery, not a design decision — do not let it skip the interview.\n\n- Local: run `lobu context list` to see existing contexts (`--json` adds `loggedIn`, which reports stored credentials, not session validity); check the current directory and home for existing Lobu projects (`lobu.config.ts`), configured MCP servers, and CLI auth state. Note what the user already set up.\n- Cloud: if the user has an active session (do not create one just to look), call `client.organizations.list()`, `client.agents.list()` for each org, `client.catalog.listInstalled({ kinds: [\"connectors\"] })`, and `search_memory` for prior knowledge. This reveals existing agents, connectors, and memory you can build on.\n- Tell the user what you are looking at so they can correct you, and let what you find shape the options you offer. Never treat this discovery as an identity signal: orgs, emails, or domains never prove a company or product, and never mention a competitor or third party unless it actually appears in what you found.\n\nDo NOT ask for a login email during the interview. Email is only needed when a managed connector actually requires a session (step 3) or when the user chooses cloud deployment (step 6); ask for it at that point. Treat identity only as identity; never infer a company from an email address or domain.\n\n### 2. Interview with concrete, personalized options\n\nInterview the user one question at a time; wait for each answer, do not guess, and do not batch the questions. Anchor each question in what you found in step 1. Instead of asking \"what agent do you want?\" as a blank slate, summarize what you see and offer two or three concrete alternatives to choose from:\n\n- \"You already have org X with connectors A and B installed and N existing agents. Do you want to (a) add a new agent on top of those, (b) extend one of the existing agents, or (c) start something standalone?\"\n- \"For what it should do, the common shapes are (a) a triage agent that reads incoming chat and files a ticket, (b) a scheduled report that summarizes new activity each morning, (c) a research agent that answers questions from your connected tools. Which fits, or what would you change?\"\n\nOffer a default so the user can answer \"the first one\" — decisive users and undecided users both move faster with a concrete menu.\n\n- What company or product is this for?\n- What does it do, and who does it serve?\n- What is its public domain? (optional for a personal project)\n- Do I have permission to research the public website and other public sources?\n- What is the agent for?\n- What should we call it?\n- Who uses it: just me, my team, or each of my customers?\n- How should it behave, and what may it do unattended versus only with approval?\n- What should it remember? Model this as one to three entity types.\n- Where does its data come from? Pick one connector or custom source to start.\n- Where should people talk to it? Offer Web UI, API or SDK, MCP, Slack, Teams, WhatsApp, Discord, Google Chat, and Telegram without forcing a chat platform. If Slack is chosen, ask whether to join Lobu's hosted workspace for a quick start, install Lobu into an existing workspace, or use a custom Slack app; then ask whether to test the DM with Lobu, a named channel, or both, and whether people knowledge means conversation participants, bound-channel members, or the full workspace directory.\n- Should anything run on a schedule?\n- Which supported LLM provider credential does the user have?\n\nIf the user gave permission to research and has a public domain, research the company before proposing the design. Summarize its product, customers, workflows, and useful signals, and cite the public sources you used. Then propose one to three entity types, their relationships, the first data source, one or two useful Automations, and suitable interaction channels. Play back a short numbered plan and wait for confirmation before scaffolding anything.\n\n### 3. Discover the surface before choosing how to scaffold\n\nCheck Node is 22-24 or 26+ (only Node 25 is unsupported), then run `lobu context list` and identify the named Lobu Cloud context; do not assume the active context still points to cloud after a local run. If a managed or cloud connector was chosen and there is no session, ask for the login email at that point, explain that Lobu will email an approval link, and run `lobu login --email <confirmed-address> --context <cloud-name>`. The person approving must sign in with that same email; knowing an address never grants access. After a successful login, an empty organization membership list is a tenancy/discovery result, not an authentication failure: call `client.organizations.list()` and explain the result. Never revoke or repeat login with `--force` unless the user separately approves that re-authentication.\n\nUse ClientSDK through Lobu MCP with the explicit cloud context. From the CLI, account discovery works before selecting an active org with `lobu memory run query_sdk '{\"title\":\"Find managed connection providers\",\"script\":\"export default async (_ctx, client) => client.organizations.list()\"}'`; `lobu call` over REST requires an active org. Call `client.organizations.list()` to find public organizations offering managed connections. Call `client.catalog.listInstalled({ kinds: [\"connectors\"] })`; if the connector is not installed, call `client.catalog.listCatalog({ kinds: [\"connectors\"] })`. Inspect the selected entry's `detail.auth_schema`, `detail.options_schema`, `detail.feeds_schema`, and `detail.automation_events` instead of guessing field names. On account-scoped `/mcp`, select an authorized home workspace first with `const home = await client.org(homeSlug)` and call `home.connections.connectManaged`; put the public provider org in `managed_by_org`, rather than selecting that provider org with `client.org`. This call runs against cloud, not the embedded runtime. If a matching live managed offer exists, explain it and call `client.connections.connectManaged` only after consent. Complete the returned user authorization, then run `lobu context use <cloud-name>` immediately before executing its `local_bootstrap_command` from the parent directory where the new project should be created; use `--here` only after entering an empty directory, and do not create a blank Lobu scaffold first. Ask for bring-your-own OAuth credentials only if no managed offer exists or the user prefers their own app.\n\n**If no connector in the catalog matches the data source, do not report \"no integration exists\"** — author a custom connector: write `connectors/<name>.connector.ts` in the project, register it with `connectorFromFile(\"./connectors/<name>.connector.ts\")`, and model it on the [npm downloads example](https://github.com/lobu-ai/lobu/blob/main/examples/lobu-crm/npm-downloads.connector.ts). See [Connector authoring](https://github.com/lobu-ai/lobu/blob/main/docs/connector-authoring.md) for the full contract; the end-to-end entity/event/Automation model is in [Lobu concepts](https://github.com/lobu-ai/lobu/blob/main/docs/CONCEPTS.md).\n\n### 4. Scaffold and build from the confirmed plan\n\nIf managed auth supplied a `local_bootstrap_command`, use the project it generated. Otherwise run `npx @lobu/cli@latest init` with the confirmed name and provider. Postgres is built in, so `lobu run` starts an embedded database; ask for `DATABASE_URL` only if the user chooses external Postgres. Read the generated `AGENTS.md` completely before editing `lobu.config.ts`. Use the canonical reference at `https://github.com/lobu-ai/lobu/blob/main/examples/lobu-crm/lobu.config.ts` when needed; do not assume that example exists in the new project's filesystem. Briefly explain how the chosen feed may use checkpoints to collect incrementally, emits events, builds shared entity memory, and gives both chat and Automations the same governed context.\n\n`feeds_schema.<feed>.eventKinds` are the default Automation trigger catalog for feed connectors: every declared kind is a subscribable event type (`event_type` = the kind slug) for any feed that emits the kind. A feed's first successful non-dry sync establishes its baseline without activation; later inserts of a matching kind activate subscribers. A kind with `updatedEvent: true` also offers `<kind>.updated` for supersedes whose `occurred_at` strictly advances past the previous head. The original kind stays insert-only; unchanged rows, volatile-only updates and same-time reformats stay quiet. Subscribe to both types for new items and later activity. Feed-scoped filtering is not yet available (events dedupe by connection + origin id, so a `feed_key` match would miss origins first seen by another feed). `automation_events` (now derived from eventKinds when a connector declares none) is the trigger picker's list. If no declared kind matches the use case, use a scheduled Automation with a bounded named SQL source and read event text from `payload_text`. Validate the query against the running local schema before relying on it. If `feeds_schema` is empty, do not invent or trigger a feed; chat integrations such as Slack can deliver incoming messages directly. For Slack or Telegram, prefer `defineConnection` with `credentialMode: \"hosted\"` so no bot token is required; `lobu run` prints the exact hosted-workspace join URL, own-workspace install URL when available, and short-lived link command. This hosted chat path requires a cloud session and the agent applied to that cloud workspace; the link targets the cloud agent. It does not create a local Slack data connection or prove local Slack search. Use those returned values instead of constructing URLs. A printed `/lobu link <code>` is one-time: redeem it in the first selected DM or channel. In an installed workspace whose installer is linked to Lobu, bind each additional surface with `/lobu link <agent-id>`; otherwise generate a fresh code for that surface. Mention Lobu in a channel test and verify the App Home separately. Lobu email login and Slack installation are separate: the email link authorizes Lobu CLI access, while an existing-workspace install requires the user or workspace admin to approve Slack's OAuth screen. Never describe Slack consent as an email approval. Use `credentialMode: \"byo\"` only if the user chooses their own app. Tell the user once which remaining secrets are required and add only `secret(\"ENV_NAME\")` placeholders to config. Never open or request permission to read `.env`; inspect `.env.example` when present and declared secret placeholder names only. Never read, print, invent, or paste a real secret into source or chat.\n\nIf the user wants the agent to know people in Slack, ask whether that means conversation participants, members of bound channels, or the full workspace directory. Installing the app proves none of those by itself. Verify the selected scope by inspecting the people or member entities Lobu actually materialized and by asking the agent a roster question. If human-readable names or non-participants are unavailable, identify that exact product gap; never claim the complete workspace directory was synced.\n\n### 5. Prove the complete local path\n\nChange into the generated project directory and verify `pwd` contains the intended `lobu.config.ts`; never run project commands from its parent. Run `npx @lobu/cli@latest validate`, boot with `npx @lobu/cli@latest run`, and verify health and the local Web UI. With the embedded database default, `lobu run` creates and selects the local context and auto-applies the project; with an external `DATABASE_URL`, it does neither, so authenticate and apply to that runtime explicitly. Send a harmless direct chat message without tools.\n\nBefore consent to access provider data, inspect only catalog, connection, auth-profile, and feed metadata. For browser access, inspect the paired device and connection metadata without invoking browser actions. Durable managed OAuth and env-profile credentials stay at the gateway. Do not run a feed or connector dry-run before consent, because a dry-run may still read provider data. Ask explicitly before accessing real provider data. Only after approval, dry-run the connector or feed server-side and trigger the selected feed manually if that connector actually declares one. A feed dry-run records its run but persists no collected events, entities, attachments, checkpoint changes, or feed sync state. Run each Automation once, poll `client.operations.getRun` with its returned `run_id`, and show each completed run plus any declared result event or entity. For a run-result-only or reaction-only Automation, use the completed run and the Automation `view_url` returned by Lobu. For Slack, treat DM, channel mention, App Home, and requested member discovery as four separate checks. Keep actions in approval mode unless the user explicitly approves execution. If any step fails, fix it and rerun that step; do not silently substitute a different path.\n\n### 6. Offer the deployment choice\n\nAfter the local proof, ask the user whether to keep running locally or deploy to Lobu Cloud. Explain that the embedded local runtime and Lobu Cloud are separate targets, and that keeping it local needs no further setup. Only if the user chooses cloud deployment, ask for the login email to identify the deployer, explain that Lobu will email an approval link, and run `lobu login --email <confirmed-address> --context <cloud-name>`; the person approving must sign in with that same email. Because `lobu apply` has no context flag, use `lobu context list` and then `lobu context use <cloud-name>` to select an explicit cloud context before deployment. Run `lobu apply --dry-run` first, show the target organization and exact plan, and wait for confirmation before applying. After apply, use only authoritative `view_url` values and link commands returned by Lobu; never construct URLs. Present the working access choices: Web UI, direct agent chat, API or SDK, MCP, and any channels the user selected.\n\n## Core Model\n\n- **Lobu** is the agent framework, runtime, deployment layer, and memory surface.\n- Keep framework configuration in `lobu.config.ts` (TypeScript, `defineConfig` from `@lobu/cli/config`).\n- Keep agent identity and instructions in `IDENTITY.md`, `SOUL.md`, and `USER.md`.\n- Keep reusable capability bundles in `skills/<name>/SKILL.md` or `agents/<agent>/skills/<name>/SKILL.md`.\n- Use `lobu login` for CLI authentication. Do not use a separate memory login command.\n- Use `lobu connect` for MCP client and skill setup.\n- Use `lobu memory ...` for memory operations, seeding, and direct tool calls.\n\nReference the canonical docs before guessing how a feature works:\n[Lobu concepts](https://github.com/lobu-ai/lobu/blob/main/docs/CONCEPTS.md)\n(entities vs events, identity, end-to-end lifecycle),\n[Automations](https://github.com/lobu-ai/lobu/blob/main/docs/AUTOMATIONS.md)\n(trigger/source/output contract), and\n[Connector authoring](https://github.com/lobu-ai/lobu/blob/main/docs/connector-authoring.md)\n(custom connectors).\n\n## Project Checklist\n\n1. Read `lobu.config.ts` first.\n2. Read the active agent files under `agents/<id>/`.\n3. Check local skills under `skills/` and `agents/<id>/skills/`.\n4. Use `lobu validate` after config changes.\n5. Discover the live SDK and connector surface with `search_sdk`; never guess a method, connector key, feed key, connection id, or operation key.\n6. When prompt or Automation changes, run evals via promptfoo (see `examples/personal-finance/evals/promptfooconfig.yaml`). The in-house `lobu eval` command has been removed.\n\n## Common Commands\n\n```bash\nnpx @lobu/cli@latest init my-agent\nnpx @lobu/cli@latest run\nnpx @lobu/cli@latest validate\nnpx @lobu/cli@latest login\n```\n\n## Authentication\n\n- Interactive (human at a terminal): `lobu login` runs the device-code flow with a browser approval.\n- CI / your own automation: `LOBU_API_TOKEN`, or `lobu login --token <pat>`.\n- Local `lobu run`: the CLI mints credentials automatically over loopback — no prompt.\n- Headless, on a *user's* behalf: `lobu login --email <address>`. The server emails the user a one-click approval link and the CLI polls until they approve, then stores the scoped credential — no TTY, no pre-minted token. This is the auth.md \"user_claimed\" flow.\n\nAn external agent not using this CLI can drive the same flow over HTTP: read `<origin>/auth.md` (linked from the `agent_auth` block in `<origin>/.well-known/oauth-authorization-server`) for the endpoints. Today only the email user_claimed flow exists (no zero-touch ID-JAG). Never fabricate a token.\n\n## Organization Deletion\n\nTreat organization deletion as permanent and restricted to organization owners. The supported path is the **Organization settings** page, opened from that workspace's settings button in the organization switcher. ClientSDK and Lobu CLI intentionally expose no organization-delete method. When asked to delete organizations, identify each exact target and its data impact read-only, surface one production organization at a time for explicit confirmation, then direct an owner to that page or use their logged-in browser only when explicitly authorized. Never invent a hosted URL, call the raw Better Auth route, bypass a failed authorization check, delete organization rows directly, or batch confirmations.\n\nCloud CLI OAuth/PAT credentials are not a Better Auth browser session. A `401` or `403` is a stop signal: report the authorization boundary and leave the organization intact.\n\n<!-- lobu-memory-guidance:start -->\n## Memory Defaults\n\nYour long-term memory is powered by Lobu. Do NOT use local files (memory/, MEMORY.md) for memory.\n- Lobu automatically recalls relevant memories when you receive a message.\n- To save something, call save_memory with the content and an appropriate semantic_type.\n- To search, call search_memory. Results include view_url links to the web interface.\n- NEVER construct Lobu URLs yourself. When the user asks for a link, call search_memory to get the correct view_url.\n- When the user says \"remember this\", save it to Lobu immediately.\n- When a message changes a fact you already stored (an updated preference, status, count, location, or plan), first search_memory for the prior memory to get its id, then save_memory the new value with supersedes_event_id set to that id. This replaces the stale value so future recalls return the current one; the old value stays in history but is hidden from normal search.\n<!-- lobu-memory-guidance:end -->\n\n## Lobu Memory\n\nConfigure project-scoped memory in `lobu.config.ts` by setting the org on `defineConfig` and declaring the schema with the `define*` helpers:\n\n```ts\nimport { defineConfig, defineEntityType } from \"@lobu/cli/config\";\n\nconst ticket = defineEntityType({\n key: \"ticket\",\n name: \"Ticket\",\n properties: {\n subject: {\n type: \"string\",\n title: \"Subject\",\n \"x-table-label\": \"Subject\",\n \"x-table-column\": true,\n },\n },\n});\n\nexport default defineConfig({\n org: \"my-org\",\n orgName: \"My workspace\",\n agents: [/* ... */],\n entities: [ticket],\n});\n```\n\nThe entity schema also renders the record page form. Give every array `items` and every object `properties` (bare ones render as raw JSON), put the label in `title` and help text in `description`, mark derived fields `readOnly: true`, and declare every field an Automation writes.\n\nSeed data records still live as YAML under `./data`. Then seed or operate the memory workspace with:\n\n```bash\nlobu login\nlobu memory org set <org-slug>\nlobu memory health --org <org-slug>\nlobu memory seed --org <org-slug>\nlobu memory run search_memory '{\"query\":\"Acme\"}' --org <org-slug>\n```\n\nUse `search_memory` first when the user asks about a specific entity or workspace memory. Use `save_memory` to persist durable memory. To update existing knowledge, search first, then save with `supersedes_event_id` so the old row is tombstoned rather than deleted.\n\n## MCP Client Setup\n\nUse the actual MCP URL for the user's runtime. Never hardcode a hosted URL unless the user explicitly asks for that instance.\n\nCommon setup commands:\n\n```bash\n# Claude Code\nlobu connect claude-code --url <mcp-url>\n\n# Codex\nlobu connect codex --url <mcp-url>\n\n# Antigravity\nlobu connect antigravity --url <mcp-url>\n\n# OpenCode\nlobu connect opencode --url <mcp-url>\n```\n\nRun `lobu connect --url <mcp-url>` without a client id to choose interactively. For ChatGPT, Claude Desktop, Cursor, and other browser-managed clients, the same command applies the safe local configuration it can and prints the exact remaining client handoff. Complete OAuth in the client, not through a separate Lobu CLI login.\n\n## Browser-Authenticated Connectors\n\nFor connectors that need a signed-in browser, pair the Owletto Chrome extension\nand sign in on the source site in that browser. Browser operations run through\nthat paired device; external remote-debugging endpoints and CLI browser-auth\ncapture are no longer supported.\n\nNothing answers a JS dialog (alert, confirm, prompt, beforeunload) on the\nagent's behalf. A browser action it blocks fails, and the failed result's\n`output` carries `tab_id` and `dialog` (`dialog_id`, `type`, `message`). In\n`run_sdk`, catch the `operations.execute` error and read `error.details.output`\nrather than parsing the error text (an uncaught failure returns the same value\nas the `run_sdk` result's `error.details`, and a background run's\n`operations.getRun` returns the same `output`), then answer with the\nconnection's `handle_dialog` operation. An unanswered dialog is handed to the user after two minutes.\n\nTo test a configured feed without writing ingested data, discover the current\nfeed methods with `search_sdk`, then use `client.feeds.trigger({ feed_id, dry_run: true })`\nthrough `run_sdk` or `lobu call run_sdk` (with a `title` arg). Inspect `client.feeds.get({ feed_id })`\nfor the completed run's preview. The dry run uses normal device routing and\nauthorization checks and may access the upstream provider, so obtain consent first.\n\n## Agent-Facing Tool Surface\n\nThe normal MCP surface is intentionally small. Flat administrative tools are not advertised to agents; compose through these tools instead:\n\n- `search_memory` and `save_memory` for direct knowledge recall and persistence.\n- `search_sdk` to discover current ClientSDK methods, signatures, connector feed keys, operations, access requirements, and examples. Pass `mode: \"read\"` when you only need methods safe for `query_sdk`.\n- `query_sdk` for read-only TypeScript and `query_sql` for governed, paginated SQL reads.\n- `run_sdk` for mutations and external operations. Use `lobu call run_sdk --arg title='…' --arg script='…'` from the CLI for the same ClientSDK scripting workflow; `run_sdk`, `query_sdk`, and `query_sql` calls need a short `title` naming them in the activity feed.\n\nSearch before create to avoid duplicates. Prefer a read or dry run before mutations, never fabricate returned URLs or identifiers, and never delete from `events`; supersede or tombstone instead.\n\n## Custom Views\n\nWhen a user would benefit from exploring data, offer or build an interactive view: linked charts, searchable tables, filters, drilldowns, scenario controls, or a Canvas/SVG visualization. Prefer an existing view when it already answers the question. Views are ordinary React, so authors can compose their own components; the default components are a starting point.\n\nViews are custom React panels attached to entity types, records, events, or the workspace Data hub. They render in the web app and MCP hosts (Claude and other MCP Apps hosts); chat channels get links to views, not the views themselves. Author them in `views/<type>/<key>.tsx` and ship with `lobu apply` (list them via `viewFromFile` in `defineConfig`), or set single-file sources over MCP with `manage_views` (owner/admin only).\n\nModule shape (the server resolves React, React DOM, `@lobu/views` and `@lobu/views/components`; other dependencies need the CLI path with `node_modules` present):\n\n```tsx\nimport { defineView, sql, useAction, useParams, useQuery } from \"@lobu/views\";\nimport {\n Card,\n DataTable,\n EmptyState,\n ErrorState,\n FilterBar,\n LoadingState,\n SearchField,\n TruncatedNotice,\n} from \"@lobu/views/components\";\n\nexport const view = defineView({\n key: \"pipeline\",\n attach: [{ collection: \"deal\" }],\n params: { stage: { type: \"string\", default: \"open\" } },\n actions: { markWon: { emits: \"deal.won\" } },\n});\n\nexport default function Pipeline() {\n const [params, setParams] = useParams();\n const deals = useQuery<Array<{ id: string; title: string }>>(\n sql`SELECT id, title FROM deal WHERE stage = ${params.stage} LIMIT 100`\n );\n const markWon = useAction(\"markWon\");\n const rows = deals.data ?? [];\n // Keep the filter mounted across query states: an early return on\n // loading/error would unmount the focused input on every keystroke\n // (each keystroke re-queries). Render states inline instead.\n return (\n <Card\n title=\"Pipeline\"\n actions={<button type=\"button\" onClick={() => markWon({})}>Mark won</button>}\n >\n <FilterBar><SearchField label=\"Stage\" value={String(params.stage)} onChange={(v) => setParams({ stage: v })} /></FilterBar>\n {deals.loading && <LoadingState text=\"Loading deals…\" />}\n {deals.error && <ErrorState message={deals.error} errorCode={deals.errorCode} />}\n {!deals.loading && !deals.error && rows.length === 0 && (\n <EmptyState title=\"No deals in this stage.\" />\n )}\n {!deals.loading && !deals.error && rows.length > 0 && (\n <DataTable columns={[{ key: \"title\", header: \"Title\" }]} rows={rows} keyOf={(r) => r.id} />\n )}\n {deals.truncated && <TruncatedNotice shown={rows.length} />}\n </Card>\n );\n}\n```\n\n`defineView` is the view's only declaration: `key`, optional `name` (defaults to the key) and `description`, `attach`, `params` and `actions` are read from it, never passed separately, so `manage_views` `set` takes just the source. Write it out as a literal (no variables, spreads or `${}` templates): the server reads it without running the module.\n\n`attach` lists the pages a view appears on, one per entry: `{ record: \"deal\" }` is a card on every deal's page above its activity (`{ record: \"deal\", id: 7 }` pins one record), `{ collection: \"deal\", when? }` a tab on the deal list page, `{ workspace: true }` a Data hub tab, `{ event: \"deal.won\", type? }` one event's page. One view can list several pages and branch on `useScope()` when it answers the same question at each scale. A record card renders with `useHost().displayMode === \"inline\"` inside `container.maxHeight` (the host clips past it): render a summary there with a \"See all\" that calls `requestDisplayMode(\"fullscreen\")`, and the full view when `displayMode` is `\"fullscreen\"` (the peek, a full page, a tab).\n\nWorkspace attachment does not render individual events. For an event presentation, attach to its specific `semantic_type` (event kind), optionally restricted to a linked entity type with `type`; a metadata schema name does not select the view. Avoid binding a specialized renderer to a generic kind such as `summary`. Register a dedicated kind in the workspace's event-kind registry and have its producer emit it. On event pages and event peeks, read `useScope().event` by exact ID and select that ID from the returned lineage; never substitute the latest event or let a URL date param change the subject. A shared workspace/event module should branch on `scope.event`, keeping history selection on its workspace surface. Preserve a readable stored body for fallback and evidence.\n\nBefore reporting a view working, open each attached surface, including an event page and peek when declared. Exercise filtering, drilldown, keyboard navigation, and a narrow pane; check loading, missing/error, and truncated data states. Refresh and reopen an earlier event of the kind to verify the view stays on that event rather than jumping to the newest one. Views render in an iframe, so an empty parent-page DOM is not evidence the view is empty; inspect the frame through an authorized browser or accessibility surface. A successful compile proves only that the bundle was built.\n\nRules that are load-bearing, not style:\n\n- Reads go through `useQuery` (`sql`, a `query_sdk` script string, or a read-only `tool()`). `query_sql` allows 500 rows max with a 5 second timeout — branch on the typed `errorCode` (e.g. `UPSTREAM_TIMEOUT`), never on message text, and render `truncated` honestly instead of passing partial data off as complete. Each `query_sql` cell is bounded too: strings keep their first 4,000 Unicode code points plus \"… [truncated]\"; JSON values over 16 KiB become `{ _truncated: true, bytes }` (attachments become null with `attachments_truncated`). `truncatedColumns` names the affected columns. Select smaller elements or fields, for example one array element per row with `jsonb_array_elements(...)`, and paginate as needed; each returned cell is still subject to these limits.\n- Never aggregate history in a view: no `GROUP BY`, `DISTINCT ON`, per-row regexp, or leading-wildcard `LIKE` over `events` or other growing tables. For \"latest state\" views, have an Automation maintain keyed event outputs (each run supersedes the previous event with the same key) and read the current head with `read_knowledge`.\n- Writes go only through declared view actions (`useAction` → `invoke_view_action`), which emit the declared event kind and can activate workspace-triggered Automations. Action `value` payloads are capped at 4000 JSON chars — save content first, then pass the id. A subject shown from a superseded event rejects with 409; refetch and ask the user to re-confirm rather than retrying blindly.\n- Link with `Link` from `@lobu/views/components` (or `useHost().openLink`): `href=\"<type>/<slug>\"` opens that record in the workspace, a full URL opens a new tab. A plain `<a href>` goes nowhere inside the sandboxed frame.\n- Views run in a sandboxed frame with no direct network: no fetch, no third-party calls at runtime. Bundle shared code via the CLI path; the MCP `manage_views` path compiles `react` + `@lobu/views` (+components) only.\n- Never early-return the whole view on loading/error: each filter keystroke re-queries, so an early return unmounts the focused input mid-typing. Keep filters mounted and render query states inline in the results area.\n- Params sync to the URL on Lobu hosts only; elsewhere they stay frame-local. `refetch()` re-reads on demand; only Lobu hosts push live data-changed refreshes.\n\n## Connectors, Feeds, and Operations\n\nConnectors are the primary integration path for third-party services. The\nend-to-end model (entities vs events, the run lifecycle) is in\n`docs/CONCEPTS.md`; authoring a new connector when none matches is in\n`docs/connector-authoring.md`. Do not freeze a connector lifecycle in project\ninstructions because it can drift from the deployed SDK:\n\n1. Call `search_sdk` with the service name immediately before acting. It returns installed and installable connectors, declared feed keys, readiness, and the caller-aware live lifecycle. Then, before requesting app credentials, call `client.connections.setupOptions({ connector_key })` against the selected runtime: it discovers verified cloud-managed OAuth and hosted chat alongside local setup, so follow the URLs and instructions it returns. `cloud_status: \"unavailable\"` is a discovery outage, not evidence that managed auth is absent. Options are offers, not connected accounts.\n2. Always follow the methods it returns in order instead of relying on a remembered connect/feed/operation sequence. Repeat discovery after authorization or state changes so the next step reflects the live connector and current caller.\n3. Treat `access: operate` as `mcp:write` and `access: administer` as workspace owner/admin plus `mcp:admin`. If discovery asks for MCP reauthorization or an owner/admin handoff, follow that instruction; never attempt methods it withheld as unavailable.\n\nSource-backed feeds query the provider only through an explicit `client.feeds.readMany({ reads: [...] })` call; `search_memory` stays local and reports unqueried source feeds in `coverage`, while `client.feeds.get` returns metadata without source access. Feeds with `sync` may persist events for search and relational queries. For connector actions, use the live discovery result's operation target and readiness. If readiness is disconnected, follow the returned next action instead of guessing a connection. Surface approval-gated `pending_approval` as a waiting state, not a failure.\n\n## Data Ingestion\n\n- Use `lobu memory seed` for small declarative YAML datasets under `./data`; it processes records sequentially and is not a bulk-backfill path.\n- Use `client.knowledge.save` for schema-less semantic history such as messages, notes, observations, and content. Pass `supersedes_event_id` when replacing an existing fact.\n- Use `client.entities.create` / `client.entities.update` only for strict structured records that match declared entity schemas.\n- For large backfills, send bounded chunks through `run_sdk` / `lobu call run_sdk` and use `Promise.allSettled` so conflicts and partial failures remain visible.\n\n```ts\nexport default async (_ctx, client) => {\n const records = [\n { content: \"...\", semantic_type: \"note\" },\n { content: \"...\", semantic_type: \"observation\" },\n ];\n return Promise.allSettled(records.map((record) => client.knowledge.save(record)));\n};\n```",
11
+ "instructions": "# Lobu\n\nUse this skill when setting up a brand-new Lobu agent from scratch (follow \"Onboarding a New Project\" below) or when running, validating, evaluating, or connecting an existing Lobu project, or operating Lobu memory from a coding agent.\n\nThe `AGENTS.md` generated into a new project is the source of truth for the config API (the `define*` helpers, connectors, auth, Automations, memory) — this skill does not duplicate it. For an existing project, jump to \"Core Model\" + the relevant reference section below.\n\n## Onboarding a New Project\n\nUse this playbook when a new user asks you to build them a Lobu agent from scratch. Set it up end to end: ground yourself in what the user already has, interview, discover, scaffold, prove the complete local path, then offer the deployment choice. Do not call the setup complete until every path the user selected has actually passed end to end. If an external provider, authorization, deployment, or rate limit blocks the proof, name the exact blocker and leave the setup as blocked rather than claiming success.\n\n### 1. Ground yourself in what the user already has\n\nBefore interviewing, look at what already exists so your questions and suggestions are personal rather than a blank slate. This is discovery, not a design decision — do not let it skip the interview.\n\n- Local: run `lobu context list` to see existing contexts (`--json` adds `loggedIn`, which reports stored credentials, not session validity); check the current directory and home for existing Lobu projects (`lobu.config.ts`), configured MCP servers, and CLI auth state. Note what the user already set up.\n- Cloud: if the user has an active session (do not create one just to look), call `client.organizations.list()`, `client.agents.list()` for each org, `client.catalog.listInstalled({ kinds: [\"connectors\"] })`, and `search_memory` for prior knowledge. This reveals existing agents, connectors, and memory you can build on.\n- Tell the user what you are looking at so they can correct you, and let what you find shape the options you offer. Never treat this discovery as an identity signal: orgs, emails, or domains never prove a company or product, and never mention a competitor or third party unless it actually appears in what you found.\n\nDo NOT ask for a login email during the interview. Email is only needed when a managed connector actually requires a session (step 3) or when the user chooses cloud deployment (step 6); ask for it at that point. Treat identity only as identity; never infer a company from an email address or domain.\n\n### 2. Interview with concrete, personalized options\n\nInterview the user one question at a time; wait for each answer, do not guess, and do not batch the questions. Anchor each question in what you found in step 1. Instead of asking \"what agent do you want?\" as a blank slate, summarize what you see and offer two or three concrete alternatives to choose from:\n\n- \"You already have org X with connectors A and B installed and N existing agents. Do you want to (a) add a new agent on top of those, (b) extend one of the existing agents, or (c) start something standalone?\"\n- \"For what it should do, the common shapes are (a) a triage agent that reads incoming chat and files a ticket, (b) a scheduled report that summarizes new activity each morning, (c) a research agent that answers questions from your connected tools. Which fits, or what would you change?\"\n\nOffer a default so the user can answer \"the first one\" — decisive users and undecided users both move faster with a concrete menu.\n\n- What company or product is this for?\n- What does it do, and who does it serve?\n- What is its public domain? (optional for a personal project)\n- Do I have permission to research the public website and other public sources?\n- What is the agent for?\n- What should we call it?\n- Who uses it: just me, my team, or each of my customers?\n- How should it behave, and what may it do unattended versus only with approval?\n- What should it remember? Model this as one to three entity types.\n- Where does its data come from? Pick one connector or custom source to start.\n- Where should people talk to it? Offer Web UI, API or SDK, MCP, Slack, Teams, WhatsApp, Discord, Google Chat, and Telegram without forcing a chat platform. If Slack is chosen, ask whether to join Lobu's hosted workspace for a quick start, install Lobu into an existing workspace, or use a custom Slack app; then ask whether to test the DM with Lobu, a named channel, or both, and whether people knowledge means conversation participants, bound-channel members, or the full workspace directory.\n- Should anything run on a schedule?\n- Which supported LLM provider credential does the user have?\n\nIf the user gave permission to research and has a public domain, research the company before proposing the design. Summarize its product, customers, workflows, and useful signals, and cite the public sources you used. Then propose one to three entity types, their relationships, the first data source, one or two useful Automations, and suitable interaction channels. Play back a short numbered plan and wait for confirmation before scaffolding anything.\n\n### 3. Discover the surface before choosing how to scaffold\n\nCheck Node is 26.x, then run `lobu context list` and identify the named Lobu Cloud context; do not assume the active context still points to cloud after a local run. If a managed or cloud connector was chosen and there is no session, ask for the login email at that point, explain that Lobu will email an approval link, and run `lobu login --email <confirmed-address> --context <cloud-name>`. The person approving must sign in with that same email; knowing an address never grants access. After a successful login, an empty organization membership list is a tenancy/discovery result, not an authentication failure: call `client.organizations.list()` and explain the result. Never revoke or repeat login with `--force` unless the user separately approves that re-authentication.\n\nUse ClientSDK through Lobu MCP with the explicit cloud context. From the CLI, account discovery works before selecting an active org with `lobu memory run query_sdk '{\"title\":\"Find managed connection providers\",\"script\":\"export default async (_ctx, client) => client.organizations.list()\"}'`; `lobu call` over REST requires an active org. Call `client.organizations.list()` to find public organizations offering managed connections. Call `client.catalog.listInstalled({ kinds: [\"connectors\"] })`; if the connector is not installed, call `client.catalog.listCatalog({ kinds: [\"connectors\"] })`. Inspect the selected entry's `detail.auth_schema`, `detail.options_schema`, `detail.feeds_schema`, and `detail.automation_events` instead of guessing field names. On account-scoped `/mcp`, select an authorized home workspace first with `const home = await client.org(homeSlug)` and call `home.connections.connectManaged`; put the public provider org in `managed_by_org`, rather than selecting that provider org with `client.org`. This call runs against cloud, not the embedded runtime. If a matching live managed offer exists, explain it and call `client.connections.connectManaged` only after consent. Complete the returned user authorization, then run `lobu context use <cloud-name>` immediately before executing its `local_bootstrap_command` from the parent directory where the new project should be created; use `--here` only after entering an empty directory, and do not create a blank Lobu scaffold first. Ask for bring-your-own OAuth credentials only if no managed offer exists or the user prefers their own app.\n\n**If no connector in the catalog matches the data source, do not report \"no integration exists\"** — author a custom connector: write `connectors/<name>.connector.ts` in the project, register it with `connectorFromFile(\"./connectors/<name>.connector.ts\")`, and model it on the [npm downloads example](https://github.com/lobu-ai/lobu/blob/main/examples/lobu-crm/npm-downloads.connector.ts). See [Connector authoring](https://github.com/lobu-ai/lobu/blob/main/docs/connector-authoring.md) for the full contract; the end-to-end entity/event/Automation model is in [Lobu concepts](https://github.com/lobu-ai/lobu/blob/main/docs/CONCEPTS.md).\n\n### 4. Scaffold and build from the confirmed plan\n\nIf managed auth supplied a `local_bootstrap_command`, use the project it generated. Otherwise run `npx @lobu/cli@latest init` with the confirmed name and provider. Postgres is built in, so `lobu run` starts an embedded database; ask for `DATABASE_URL` only if the user chooses external Postgres. Read the generated `AGENTS.md` completely before editing `lobu.config.ts`. Use the canonical reference at `https://github.com/lobu-ai/lobu/blob/main/examples/lobu-crm/lobu.config.ts` when needed; do not assume that example exists in the new project's filesystem. Briefly explain how the chosen feed may use checkpoints to collect incrementally, emits events, builds shared entity memory, and gives both chat and Automations the same governed context.\n\n`feeds_schema.<feed>.eventKinds` are the default Automation trigger catalog for feed connectors: every declared kind is a subscribable event type (`event_type` = the kind slug) for any feed that emits the kind. A feed's first successful non-dry sync establishes its baseline without activation; later inserts of a matching kind activate subscribers. A kind with `updatedEvent: true` also offers `<kind>.updated` for supersedes whose `occurred_at` strictly advances past the previous head. The original kind stays insert-only; unchanged rows, volatile-only updates and same-time reformats stay quiet. Subscribe to both types for new items and later activity. Feed-scoped filtering is not yet available (events dedupe by connection + origin id, so a `feed_key` match would miss origins first seen by another feed). `automation_events` (now derived from eventKinds when a connector declares none) is the trigger picker's list. If no declared kind matches the use case, use a scheduled Automation with a bounded named SQL source and read event text from `payload_text`. Validate the query against the running local schema before relying on it. If `feeds_schema` is empty, do not invent or trigger a feed; chat integrations such as Slack can deliver incoming messages directly. For Slack or Telegram, prefer `defineConnection` with `credentialMode: \"hosted\"` so no bot token is required; `lobu run` prints the exact hosted-workspace join URL, own-workspace install URL when available, and short-lived link command. This hosted chat path requires a cloud session and the agent applied to that cloud workspace; the link targets the cloud agent. It does not create a local Slack data connection or prove local Slack search. Use those returned values instead of constructing URLs. A printed `/lobu link <code>` is one-time: redeem it in the first selected DM or channel. In an installed workspace whose installer is linked to Lobu, bind each additional surface with `/lobu link <agent-id>`; otherwise generate a fresh code for that surface. Mention Lobu in a channel test and verify the App Home separately. Lobu email login and Slack installation are separate: the email link authorizes Lobu CLI access, while an existing-workspace install requires the user or workspace admin to approve Slack's OAuth screen. Never describe Slack consent as an email approval. Use `credentialMode: \"byo\"` only if the user chooses their own app. Tell the user once which remaining secrets are required and add only `secret(\"ENV_NAME\")` placeholders to config. Never open or request permission to read `.env`; inspect `.env.example` when present and declared secret placeholder names only. Never read, print, invent, or paste a real secret into source or chat.\n\nIf the user wants the agent to know people in Slack, ask whether that means conversation participants, members of bound channels, or the full workspace directory. Installing the app proves none of those by itself. Verify the selected scope by inspecting the people or member entities Lobu actually materialized and by asking the agent a roster question. If human-readable names or non-participants are unavailable, identify that exact product gap; never claim the complete workspace directory was synced.\n\n### 5. Prove the complete local path\n\nChange into the generated project directory and verify `pwd` contains the intended `lobu.config.ts`; never run project commands from its parent. Run `npx @lobu/cli@latest validate`, boot with `npx @lobu/cli@latest run`, and verify health and the local Web UI. With the embedded database default, `lobu run` creates and selects the local context and auto-applies the project; with an external `DATABASE_URL`, it does neither, so authenticate and apply to that runtime explicitly. Send a harmless direct chat message without tools.\n\nBefore consent to access provider data, inspect only catalog, connection, auth-profile, and feed metadata. For browser access, inspect the paired device and connection metadata without invoking browser actions. Durable managed OAuth and env-profile credentials stay at the gateway. Do not run a feed or connector dry-run before consent, because a dry-run may still read provider data. Ask explicitly before accessing real provider data. Only after approval, dry-run the connector or feed server-side and trigger the selected feed manually if that connector actually declares one. A feed dry-run records its run but persists no collected events, entities, attachments, checkpoint changes, or feed sync state. Run each Automation once, poll `client.operations.getRun` with its returned `run_id`, and show each completed run plus any declared result event or entity. For a run-result-only or reaction-only Automation, use the completed run and the Automation `view_url` returned by Lobu. For Slack, treat DM, channel mention, App Home, and requested member discovery as four separate checks. Keep actions in approval mode unless the user explicitly approves execution. If any step fails, fix it and rerun that step; do not silently substitute a different path.\n\n### 6. Offer the deployment choice\n\nAfter the local proof, ask the user whether to keep running locally or deploy to Lobu Cloud. Explain that the embedded local runtime and Lobu Cloud are separate targets, and that keeping it local needs no further setup. Only if the user chooses cloud deployment, ask for the login email to identify the deployer, explain that Lobu will email an approval link, and run `lobu login --email <confirmed-address> --context <cloud-name>`; the person approving must sign in with that same email. Because `lobu apply` has no context flag, use `lobu context list` and then `lobu context use <cloud-name>` to select an explicit cloud context before deployment. Run `lobu apply --dry-run` first, show the target organization and exact plan, and wait for confirmation before applying. After apply, use only authoritative `view_url` values and link commands returned by Lobu; never construct URLs. Present the working access choices: Web UI, direct agent chat, API or SDK, MCP, and any channels the user selected.\n\n## Core Model\n\n- **Lobu** is the agent framework, runtime, deployment layer, and memory surface.\n- Keep framework configuration in `lobu.config.ts` (TypeScript, `defineConfig` from `@lobu/cli/config`).\n- Keep agent identity and instructions in `IDENTITY.md`, `SOUL.md`, and `USER.md`.\n- Keep reusable capability bundles in `skills/<name>/SKILL.md` or `agents/<agent>/skills/<name>/SKILL.md`.\n- Use `lobu login` for CLI authentication. Do not use a separate memory login command.\n- Use `lobu connect` for MCP client and skill setup.\n- Use `lobu memory ...` for memory operations, seeding, and direct tool calls.\n\nReference the canonical docs before guessing how a feature works:\n[Lobu concepts](https://github.com/lobu-ai/lobu/blob/main/docs/CONCEPTS.md)\n(entities vs events, identity, end-to-end lifecycle),\n[Automations](https://github.com/lobu-ai/lobu/blob/main/docs/AUTOMATIONS.md)\n(trigger/source/output contract), and\n[Connector authoring](https://github.com/lobu-ai/lobu/blob/main/docs/connector-authoring.md)\n(custom connectors).\n\n## Project Checklist\n\n1. Read `lobu.config.ts` first.\n2. Read the active agent files under `agents/<id>/`.\n3. Check local skills under `skills/` and `agents/<id>/skills/`.\n4. Use `lobu validate` after config changes.\n5. Discover the live SDK and connector surface with `search_sdk`; never guess a method, connector key, feed key, connection id, or operation key.\n6. When prompt or Automation changes, run evals via promptfoo (see `examples/personal-finance/evals/promptfooconfig.yaml`). The in-house `lobu eval` command has been removed.\n\n## Common Commands\n\n```bash\nnpx @lobu/cli@latest init my-agent\nnpx @lobu/cli@latest run\nnpx @lobu/cli@latest validate\nnpx @lobu/cli@latest login\n```\n\n## Authentication\n\n- Interactive (human at a terminal): `lobu login` runs the device-code flow with a browser approval.\n- CI / your own automation: `LOBU_API_TOKEN`, or `lobu login --token <pat>`.\n- Local `lobu run`: the CLI mints credentials automatically over loopback — no prompt.\n- Headless, on a *user's* behalf: `lobu login --email <address>`. The server emails the user a one-click approval link and the CLI polls until they approve, then stores the scoped credential — no TTY, no pre-minted token. This is the auth.md \"user_claimed\" flow.\n\nAn external agent not using this CLI can drive the same flow over HTTP: read `<origin>/auth.md` (linked from the `agent_auth` block in `<origin>/.well-known/oauth-authorization-server`) for the endpoints. Today only the email user_claimed flow exists (no zero-touch ID-JAG). Never fabricate a token.\n\n## Organization Deletion\n\nTreat organization deletion as permanent and restricted to organization owners. The supported path is the **Organization settings** page, opened from that workspace's settings button in the organization switcher. ClientSDK and Lobu CLI intentionally expose no organization-delete method. When asked to delete organizations, identify each exact target and its data impact read-only, surface one production organization at a time for explicit confirmation, then direct an owner to that page or use their logged-in browser only when explicitly authorized. Never invent a hosted URL, call the raw Better Auth route, bypass a failed authorization check, delete organization rows directly, or batch confirmations.\n\nCloud CLI OAuth/PAT credentials are not a Better Auth browser session. A `401` or `403` is a stop signal: report the authorization boundary and leave the organization intact.\n\n<!-- lobu-memory-guidance:start -->\n## Memory Defaults\n\nYour long-term memory is powered by Lobu. Do NOT use local files (memory/, MEMORY.md) for memory.\n- Lobu automatically recalls relevant memories when you receive a message.\n- To save something, call save_memory with the content and an appropriate semantic_type.\n- To search, call search_memory. Results include view_url links to the web interface.\n- NEVER construct Lobu URLs yourself. When the user asks for a link, call search_memory to get the correct view_url.\n- When the user says \"remember this\", save it to Lobu immediately.\n- When a message changes a fact you already stored (an updated preference, status, count, location, or plan), first search_memory for the prior memory to get its id, then save_memory the new value with supersedes_event_id set to that id. This replaces the stale value so future recalls return the current one; the old value stays in history but is hidden from normal search.\n<!-- lobu-memory-guidance:end -->\n\n## Lobu Memory\n\nConfigure project-scoped memory in `lobu.config.ts` by setting the org on `defineConfig` and declaring the schema with the `define*` helpers:\n\n```ts\nimport { defineConfig, defineEntityType } from \"@lobu/cli/config\";\n\nconst ticket = defineEntityType({\n key: \"ticket\",\n name: \"Ticket\",\n properties: {\n subject: {\n type: \"string\",\n title: \"Subject\",\n \"x-table-label\": \"Subject\",\n \"x-table-column\": true,\n },\n },\n});\n\nexport default defineConfig({\n org: \"my-org\",\n orgName: \"My workspace\",\n agents: [/* ... */],\n entities: [ticket],\n});\n```\n\nThe entity schema also renders the record page form. Give every array `items` and every object `properties` (bare ones render as raw JSON), put the label in `title` and help text in `description`, mark derived fields `readOnly: true`, and declare every field an Automation writes.\n\nSeed data records still live as YAML under `./data`. Then seed or operate the memory workspace with:\n\n```bash\nlobu login\nlobu memory org set <org-slug>\nlobu memory health --org <org-slug>\nlobu memory seed --org <org-slug>\nlobu memory run search_memory '{\"query\":\"Acme\"}' --org <org-slug>\n```\n\nUse `search_memory` first when the user asks about a specific entity or workspace memory. Use `save_memory` to persist durable memory. To update existing knowledge, search first, then save with `supersedes_event_id` so the old row is tombstoned rather than deleted.\n\n## MCP Client Setup\n\nUse the actual MCP URL for the user's runtime. Never hardcode a hosted URL unless the user explicitly asks for that instance.\n\nCommon setup commands:\n\n```bash\n# Claude Code\nlobu connect claude-code --url <mcp-url>\n\n# Codex\nlobu connect codex --url <mcp-url>\n\n# Antigravity\nlobu connect antigravity --url <mcp-url>\n\n# OpenCode\nlobu connect opencode --url <mcp-url>\n```\n\nRun `lobu connect --url <mcp-url>` without a client id to choose interactively. For ChatGPT, Claude Desktop, Cursor, and other browser-managed clients, the same command applies the safe local configuration it can and prints the exact remaining client handoff. Complete OAuth in the client, not through a separate Lobu CLI login.\n\n## Browser-Authenticated Connectors\n\nFor connectors that need a signed-in browser, pair the Owletto Chrome extension\nand sign in on the source site in that browser. Browser operations run through\nthat paired device; external remote-debugging endpoints and CLI browser-auth\ncapture are no longer supported.\n\nNothing answers a JS dialog (alert, confirm, prompt, beforeunload) on the\nagent's behalf. A browser action it blocks fails, and the failed result's\n`output` carries `tab_id` and `dialog` (`dialog_id`, `type`, `message`). In\n`run_sdk`, catch the `operations.execute` error and read `error.details.output`\nrather than parsing the error text (an uncaught failure returns the same value\nas the `run_sdk` result's `error.details`, and a background run's\n`operations.getRun` returns the same `output`), then answer with the\nconnection's `handle_dialog` operation. An unanswered dialog is handed to the user after two minutes.\n\nTo test a configured feed without writing ingested data, discover the current\nfeed methods with `search_sdk`, then use `client.feeds.trigger({ feed_id, dry_run: true })`\nthrough `run_sdk` or `lobu call run_sdk` (with a `title` arg). Inspect `client.feeds.get({ feed_id })`\nfor the completed run's preview. The dry run uses normal device routing and\nauthorization checks and may access the upstream provider, so obtain consent first.\n\n## Agent-Facing Tool Surface\n\nThe normal MCP surface is intentionally small. Flat administrative tools are not advertised to agents; compose through these tools instead:\n\n- `search_memory` and `save_memory` for direct knowledge recall and persistence.\n- `search_sdk` to discover current ClientSDK methods, signatures, connector feed keys, operations, access requirements, and examples. Pass `mode: \"read\"` when you only need methods safe for `query_sdk`.\n- `query_sdk` for read-only TypeScript and `query_sql` for governed, paginated SQL reads.\n- `run_sdk` for mutations and external operations. Use `lobu call run_sdk --arg title='…' --arg script='…'` from the CLI for the same ClientSDK scripting workflow; `run_sdk`, `query_sdk`, and `query_sql` calls need a short `title` naming them in the activity feed.\n\nSearch before create to avoid duplicates. Prefer a read or dry run before mutations, never fabricate returned URLs or identifiers, and never delete from `events`; supersede or tombstone instead.\n\n## Custom Views\n\nBefore authoring UI, inspect available native entity/event pages, existing views (`client.views.list()` and `client.views.get({ key })`), and the project's shared components and overrides. Honor explicit user designs and reuse UI from the top down:\n\n1. Use the largest existing surface or component that meets the task. Configure its segment, filters, search, saved preset and layout before replacing its UI.\n2. If that surface cannot meet a concrete requirement, compose its exported parts, such as an individual table, board, graph or shared collection controls when available. Preserve shared selection and action handling instead of rebuilding that logic.\n3. If those parts still do not fit, use smaller shared primitives and write custom UI only for the remaining gap. Explain the unmet requirement that forced each step down.\n\nCheck the current exports and target host before choosing an import; native renderer registrations do not imply React exports. Surface a missing export as a platform gap rather than inventing an API or silently copying the native implementation. `@lobu/views/components` currently supplies theme-aware defaults such as `Card`, `DataTable`, filters, charts, links and query-state components. When exploration needs specialized linked charts, drilldowns, scenario controls or Canvas/SVG, compose a React view from the suitable existing components.\n\nNative JSON templates use the target renderer's registered component names and overrides; inspect what that host actually supplies. React views compose imported components in their own bundle, independently of that native renderer map.\n\nViews are custom React panels attached to entity types, records, events, or the workspace Data hub. They render in the web app and MCP hosts (Claude and other MCP Apps hosts); chat channels get links to views, not the views themselves. Author them in `views/<type>/<key>.tsx` and ship with `lobu apply` (list them via `viewFromFile` in `defineConfig`), or set sources over MCP with `client.views.set` (owner/admin only).\n\nModule shape (the server resolves React, React DOM, `@lobu/views` and `@lobu/views/components`; other dependencies need the CLI path with `node_modules` present):\n\n```tsx\nimport { defineView, sql, useAction, useParams, useQuery } from \"@lobu/views\";\nimport {\n Card,\n DataTable,\n EmptyState,\n ErrorState,\n FilterBar,\n LoadingState,\n SearchField,\n TruncatedNotice,\n} from \"@lobu/views/components\";\n\nexport const view = defineView({\n key: \"pipeline\",\n attach: [{ collection: \"deal\" }],\n params: { stage: { type: \"string\", default: \"open\" } },\n actions: { markWon: { emits: \"deal.won\" } },\n});\n\nexport default function Pipeline() {\n const [params, setParams] = useParams();\n const deals = useQuery<Array<{ id: string; title: string }>>(\n sql`SELECT id, title FROM deal WHERE stage = ${params.stage} LIMIT 100`\n );\n const markWon = useAction(\"markWon\");\n const rows = deals.data ?? [];\n // Keep the filter mounted across query states: an early return on\n // loading/error would unmount the focused input on every keystroke\n // (each keystroke re-queries). Render states inline instead.\n return (\n <Card\n title=\"Pipeline\"\n actions={<button type=\"button\" onClick={() => markWon({})}>Mark won</button>}\n >\n <FilterBar><SearchField label=\"Stage\" value={String(params.stage)} onChange={(v) => setParams({ stage: v })} /></FilterBar>\n {deals.loading && <LoadingState text=\"Loading deals…\" />}\n {deals.error && <ErrorState message={deals.error} errorCode={deals.errorCode} />}\n {!deals.loading && !deals.error && rows.length === 0 && (\n <EmptyState title=\"No deals in this stage.\" />\n )}\n {!deals.loading && !deals.error && rows.length > 0 && (\n <DataTable columns={[{ key: \"title\", header: \"Title\" }]} rows={rows} keyOf={(r) => r.id} />\n )}\n {deals.truncated && <TruncatedNotice shown={rows.length} />}\n </Card>\n );\n}\n```\n\n`defineView` is the view's only declaration: `key`, optional `name` (defaults to the key) and `description`, `attach`, `params` and `actions` are read from it, never passed separately. `views.set` always requires `source_code` containing the entrypoint module, including when retaining multiple files. Write `defineView` out as a literal (no variables, spreads or `${}` templates): the server reads it without running the module.\n\nFor a multi-file view, `files` maps relative paths to complete source strings and `entrypoint` names the view module. Include all three inputs below; `source_code` must exactly equal `files[entrypoint]`:\n\n```ts\nawait client.views.set({\n source_code: files[entrypoint],\n source_files: { entrypoint, files },\n dependencies: {}, // Local files and the host-provided runtime need no extra packages.\n});\n```\n\n`attach` lists the pages a view appears on, one per entry: `{ record: \"deal\" }` is a card on every deal's page above its activity (`{ record: \"deal\", id: 7 }` pins one record), `{ collection: \"deal\", when? }` a tab on the deal list page, `{ workspace: true }` a Data hub tab, `{ event: \"deal.won\", type? }` one event's page. One view can list several pages and branch on `useScope()` when it answers the same question at each scale. A record card renders with `useHost().displayMode === \"inline\"` inside `container.maxHeight` (the host clips past it): render a summary there with a \"See all\" that calls `requestDisplayMode(\"fullscreen\")`, and the full view when `displayMode` is `\"fullscreen\"` (the peek, a full page, a tab).\n\nWorkspace attachment does not render individual events. For an event presentation, attach to its specific `semantic_type` (event kind), optionally restricted to a linked entity type with `type`; a metadata schema name does not select the view. Avoid binding a specialized renderer to a generic kind such as `summary`. Register a dedicated kind in the workspace's event-kind registry and have its producer emit it. On event pages and event peeks, read `useScope().event` by exact ID and select that ID from the returned lineage; never substitute the latest event or let a URL date param change the subject. A shared workspace/event module should branch on `scope.event`, keeping history selection on its workspace surface. Preserve a readable stored body for fallback and evidence.\n\nBefore reporting a view working, open each attached surface, including an event page and peek when declared. Exercise filtering, drilldown, keyboard navigation, and a narrow pane; check loading, missing/error, and truncated data states. Refresh and reopen an earlier event of the kind to verify the view stays on that event rather than jumping to the newest one. Views render in an iframe, so an empty parent-page DOM is not evidence the view is empty; inspect the frame through an authorized browser or accessibility surface. A successful compile proves only that the bundle was built.\n\nRules that are load-bearing, not style:\n\n- Reads go through `useQuery` (`sql`, a `query_sdk` script string, or a read-only `tool()`). `query_sql` allows 500 rows max with a 5 second timeout — branch on the typed `errorCode` (e.g. `UPSTREAM_TIMEOUT`), never on message text, and render `truncated` honestly instead of passing partial data off as complete. Each `query_sql` cell is bounded too: strings keep their first 4,000 Unicode code points plus \"… [truncated]\"; JSON values over 16 KiB become `{ _truncated: true, bytes }` (attachments become null with `attachments_truncated`). `truncatedColumns` names the affected columns. Select smaller elements or fields, for example one array element per row with `jsonb_array_elements(...)`, and paginate as needed; each returned cell is still subject to these limits.\n- Never aggregate history in a view: no `GROUP BY`, `DISTINCT ON`, per-row regexp, or leading-wildcard `LIKE` over `events` or other growing tables. For \"latest state\" views, have an Automation maintain keyed event outputs (each run supersedes the previous event with the same key) and read the current head with `read_knowledge`.\n- Writes go only through declared view actions (`useAction` → `invoke_view_action`), which emit the declared event kind and can activate workspace-triggered Automations. Action `value` payloads are capped at 4000 JSON chars — save content first, then pass the id. A subject shown from a superseded event rejects with 409; refetch and ask the user to re-confirm rather than retrying blindly.\n- Link with `Link` from `@lobu/views/components` (or `useHost().openLink`): `href=\"<type>/<slug>\"` opens that record in the workspace, a full URL opens a new tab. A plain `<a href>` goes nowhere inside the sandboxed frame.\n- Views run in a sandboxed frame with no direct network: no fetch, no third-party calls at runtime. Reuse local React components through relative imports and `source_files: { entrypoint, files }` plus `dependencies: {}` for local-only components with `views.set`, or use `viewFromFile` + `lobu apply`. Extra npm dependencies need the CLI-bundled `compiled_code`; listing `dependencies` alone does not install packages.\n- Never early-return the whole view on loading/error: each filter keystroke re-queries, so an early return unmounts the focused input mid-typing. Keep filters mounted and render query states inline in the results area.\n- Params sync to the URL on Lobu hosts only; elsewhere they stay frame-local. `refetch()` re-reads on demand; only Lobu hosts push live data-changed refreshes.\n\n## Connectors, Feeds, and Operations\n\nConnectors are the primary integration path for third-party services. The\nend-to-end model (entities vs events, the run lifecycle) is in\n`docs/CONCEPTS.md`; authoring a new connector when none matches is in\n`docs/connector-authoring.md`. Do not freeze a connector lifecycle in project\ninstructions because it can drift from the deployed SDK:\n\n1. Call `search_sdk` with the service name immediately before acting. It returns installed and installable connectors, declared feed keys, readiness, and the caller-aware live lifecycle. Then, before requesting app credentials, call `client.connections.setupOptions({ connector_key })` against the selected runtime: it discovers verified cloud-managed OAuth and hosted chat alongside local setup, so follow the URLs and instructions it returns. `cloud_status: \"unavailable\"` is a discovery outage, not evidence that managed auth is absent. Options are offers, not connected accounts.\n2. Always follow the methods it returns in order instead of relying on a remembered connect/feed/operation sequence. Repeat discovery after authorization or state changes so the next step reflects the live connector and current caller.\n3. Treat `access: operate` as `mcp:write` and `access: administer` as workspace owner/admin plus `mcp:admin`. If discovery asks for MCP reauthorization or an owner/admin handoff, follow that instruction; never attempt methods it withheld as unavailable.\n\nSource-backed feeds query the provider only through an explicit `client.feeds.readMany({ reads: [...] })` call; `search_memory` stays local and reports unqueried source feeds in `coverage`, while `client.feeds.get` returns metadata without source access. Feeds with `sync` may persist events for search and relational queries. For connector actions, use the live discovery result's operation target and readiness. If readiness is disconnected, follow the returned next action instead of guessing a connection. Surface approval-gated `pending_approval` as a waiting state, not a failure.\n\n## Data Ingestion\n\n- Use `lobu memory seed` for small declarative YAML datasets under `./data`; it processes records sequentially and is not a bulk-backfill path.\n- Use `client.knowledge.save` for schema-less semantic history such as messages, notes, observations, and content. Pass `supersedes_event_id` when replacing an existing fact.\n- Use `client.entities.create` / `client.entities.update` only for strict structured records that match declared entity schemas.\n- For large backfills, send bounded chunks through `run_sdk` / `lobu call run_sdk` and use `Promise.allSettled` so conflicts and partial failures remain visible.\n\n```ts\nexport default async (_ctx, client) => {\n const records = [\n { content: \"...\", semantic_type: \"note\" },\n { content: \"...\", semantic_type: \"observation\" },\n ];\n return Promise.allSettled(records.map((record) => client.knowledge.save(record)));\n};\n```",
12
12
  "hidden": false
13
13
  }
14
14
  },
@@ -18,7 +18,7 @@
18
18
  "version": "1.0.0",
19
19
  "description": "Contribute safely to the Lobu monorepo: worktrees, package rules, red-to-green fixes, validation gates, SDK-first operations, PRs, and rollout checks.",
20
20
  "detail": {
21
- "instructions": "# Lobu Operator — Repo Guide\n\nThis is a fast index, not a replacement for repository instructions. Root `AGENTS.md` and the nearest package `AGENTS.md` are authoritative; `CLAUDE.md` includes the root rules for Claude sessions.\n\n## Before You Act\n\n1. Read root `AGENTS.md`, the touched package's nearest `AGENTS.md`, and the relevant `docs/GOTCHAS.md` section.\n2. Read the concept docs before touching automation: `docs/CONCEPTS.md` (entities vs events, identity, end-to-end lifecycle), `docs/AUTOMATIONS.md` (Automation contract), `docs/connector-authoring.md` (custom connectors), `docs/README.md` (index).\n3. Run `make task-setup NAME=<slug>` and work only in the resulting `.claude/worktrees/<slug>/` directory. Never switch branches or edit in the main checkout.\n4. Read `lobu.config.ts` when configuration or runtime semantics matters; inspect the active agent and skill directories because composition is data-driven.\n5. Reproduce a bug before changing code. Capture red→fix→green evidence and exercise every branch touched; a typecheck alone is not completion.\n\n## Dev Workflow\n\n```bash\nmake task-setup NAME=<slug>\ncd .claude/worktrees/<slug>\nmake dev # gateway + workers + Vite on the allocated port\nmake clean-workers # reap an orphaned gateway from a crashed dev run\n```\n\nPrerequisites are Bun, the supported Node version, and Postgres with pgvector via `DATABASE_URL`. `make dev` uses the shared local Postgres; `make dev-embedded` uses per-worktree embedded Postgres. Read `.env.local` for the allocated ports.\n\n## Correctness Invariants\n\n- Design for at least three replicas. Shared required state and cross-pod signals belong in Postgres, never a process-local singleton or `Map`.\n- `events` is append-only. Replace or hide records with superseding/tombstone events; never delete history.\n- User-facing reads must not aggregate growing history. Materialize bounded answers on writes and read them back by index.\n- Never bulk-delete production organizations. Treat apparently empty organizations as real signups requiring individual confirmation.\n- Workers receive placeholders/proxied access, device-pinned credentials, or short-lived provider-derived leases—never durable stored credentials.\n- Agent-facing vocabulary always says **Automation**; engine-only vocabulary stays internal.\n- Durable dispatch and delivery failures fail closed. Retry, defer, or surface terminal failure; never reinterpret an ambiguous coordination error as permission to proceed.\n\n## Validate and Ship\n\nRun focused tests while iterating, then the settled-diff gates in this order:\n\n```bash\nbun test <path> # focused local iteration\nmake pr-fast # broad required graph; Daytona sandbox, else local\nmake review-fix # unposted fixer pass; inspect its edits\ngit add -- <paths> # explicit paths only, never -A\nmake pr-full # full staged Linux graph; Daytona sandbox, else local\ngit commit -m '<type>(<scope>): <summary>'\ngit diff --name-only origin/main...HEAD\ngit push -u origin <branch>\ngh pr create\nmake review # once, on settled HEAD\ngh pr checks <number> --required\ngh pr merge <number> --squash --admin\n```\n\nGitHub CI (`ci.yml`) is the canonical gate: free on this public repo, full Linux graph in ~5–7 min per PR. `make pre-pr` runs the fast local gates (typecheck, knip, lint, naming) before push; `make review` requires CI green for HEAD. `make pr-full` (Daytona ephemeral sandbox, else local) is optional tooling, not part of the required loop. Stage every intended new file explicitly before pushing.\n\nNever bypass a check that has not reported. For a production-visible change, wait for deployment and prove the PR's squash merge commit is an ancestor of the deployed SHA before running the live check. Clean up the task worktree with `make task-clean` after merge.\n\n## Data Integration & Knowledge Ingestion\n\n- Discover the current ClientSDK with `search_sdk`; use `query_sdk` for reads and `run_sdk` / `lobu call run_sdk` (with a `title` arg) for writes.\n- Connectors plus feeds are the normal integration path. Use `connections.connect`, follow any `setup_required` continuation, then create and trigger a feed with `feeds.create` and `feeds.trigger`.\n- Find connector actions with `operations.listAvailable` and execute the returned target with `operations.execute`; do not guess operation or connection identifiers.\n- Use `knowledge.save` for schema-less semantic history and `entities.create` / `entities.update` for strict structured records. Chunk bulk work and use `Promise.allSettled` so conflicts are explicit.\n- `lobu memory seed` is suitable for small declarative YAML datasets, not large backfills.",
21
+ "instructions": "# Lobu Operator — Repo Guide\n\nThis is a fast index, not a replacement for repository instructions. Root `AGENTS.md` and the nearest package `AGENTS.md` are authoritative; `CLAUDE.md` includes the root rules for Claude sessions.\n\n## Before You Act\n\n1. Read root `AGENTS.md`, the touched package's nearest `AGENTS.md`, and the relevant `docs/GOTCHAS.md` section.\n2. Read the concept docs before touching automation: `docs/CONCEPTS.md` (entities vs events, identity, end-to-end lifecycle), `docs/AUTOMATIONS.md` (Automation contract), `docs/connector-authoring.md` (custom connectors), `docs/README.md` (index).\n3. Run `make task-setup NAME=<slug>` and work only in the resulting `.claude/worktrees/<slug>/` directory. Never switch branches or edit in the main checkout.\n4. Read `lobu.config.ts` when configuration or runtime semantics matters; inspect the active agent and skill directories because composition is data-driven.\n5. Reproduce a bug before changing code. Capture red→fix→green evidence and exercise every branch touched; a typecheck alone is not completion.\n\n## Dev Workflow\n\n```bash\nmake task-setup NAME=<slug>\ncd .claude/worktrees/<slug>\nmake dev # gateway + workers + Vite on the allocated port\nmake clean-workers # reap an orphaned gateway from a crashed dev run\n```\n\nPrerequisites are Bun, the supported Node version, and Postgres with pgvector via `DATABASE_URL`. `make dev` uses the shared local Postgres; `make dev-embedded` uses per-worktree embedded Postgres. Read `.env.local` for the allocated ports.\n\n## Correctness Invariants\n\n- Design for at least three replicas. Shared required state and cross-pod signals belong in Postgres, never a process-local singleton or `Map`.\n- `events` is append-only. Replace or hide records with superseding/tombstone events; never delete history.\n- User-facing reads must not aggregate growing history. Materialize bounded answers on writes and read them back by index.\n- Never bulk-delete production organizations. Treat apparently empty organizations as real signups requiring individual confirmation.\n- Workers receive placeholders/proxied access, device-pinned credentials, or short-lived provider-derived leases—never durable stored credentials.\n- Agent-facing vocabulary always says **Automation**; engine-only vocabulary stays internal.\n- Durable dispatch and delivery failures fail closed. Retry, defer, or surface terminal failure; never reinterpret an ambiguous coordination error as permission to proceed.\n\n## Validate and Ship\n\nRun focused tests while iterating, then the settled-diff gates in this order:\n\n```bash\nbun test <path> # focused local iteration\ngit add -- <paths> # explicit paths only, never -A\nmake pre-pr # fast local gates before commit/push\ngit commit -m '<type>(<scope>): <summary>'\ngit diff --name-only origin/main...HEAD\ngit push -u origin <branch>\ngh pr create\nmake review # bounded review/fix/independent verification\nmake ui-review\nmake land N=<number>\n```\n\nGitHub CI (`ci.yml`) is the canonical gate: free on this public repo, full Linux graph in ~5–7 min per PR. `make pre-pr` runs the fast local gates (typecheck, knip, lint, naming) before push; `make review` can run alongside CI and publishes success only after exact-HEAD CI passes. Optional findings never reopen a pass; the branch has two automatic write attempts across all invocations/resumes. `make pr-full` (Daytona ephemeral sandbox, else local) is optional tooling, not part of the required loop. Stage every intended new file explicitly before pushing.\n\nNever bypass a check that has not reported. For a production-visible change, wait for deployment and prove the PR's squash merge commit is an ancestor of the deployed SHA before running the live check. Clean up the task worktree with `make task-clean` after merge.\n\n## Data Integration & Knowledge Ingestion\n\n- Discover the current ClientSDK with `search_sdk`; use `query_sdk` for reads and `run_sdk` / `lobu call run_sdk` (with a `title` arg) for writes.\n- Connectors plus feeds are the normal integration path. Use `connections.connect`, follow any `setup_required` continuation, then create and trigger a feed with `feeds.create` and `feeds.trigger`.\n- Find connector actions with `operations.listAvailable` and execute the returned target with `operations.execute`; do not guess operation or connection identifiers.\n- Use `knowledge.save` for schema-less semantic history and `entities.create` / `entities.update` for strict structured records. Chunk bulk work and use `Promise.allSettled` so conflicts are explicit.\n- `lobu memory seed` is suitable for small declarative YAML datasets, not large backfills.",
22
22
  "hidden": true
23
23
  }
24
24
  }
@@ -4,6 +4,6 @@
4
4
  "server": "dist/server.bundle.mjs",
5
5
  "embeddingsServer": "dist/embeddings-server.mjs"
6
6
  },
7
- "version": "24.3.0",
7
+ "version": "24.5.0",
8
8
  "verify": "dist/verify.mjs"
9
9
  }
@@ -166,63 +166,91 @@ function escapeLike(term: string): string {
166
166
  return term.replace(/[\\%_]/g, (c) => `\\${c}`);
167
167
  }
168
168
 
169
+ /** Opening `$$` / `$tag$` of a dollar-quoted string, matched at `lastIndex`. */
170
+ const DOLLAR_QUOTE_RE = /\$(?:[A-Za-z_][A-Za-z0-9_]*)?\$/y;
171
+
169
172
  /**
170
- * True if `sql` has a `LIMIT`/`OFFSET` keyword at paren-depth 0 (a TOP-level
171
- * one), scanning past string literals, quoted identifiers, and comments so a
172
- * `'limit'` literal or a `"limit"` column never false-matches. An inner LIMIT
173
- * inside a subquery sits at depth > 0 and is allowed. Works without the AST, so
174
- * it gates both the parseable and the token-fallback paths identically.
173
+ * Blank out string literals, quoted identifiers, dollar-quoted strings and
174
+ * comments (same length, so positions survive) so the structural checks only
175
+ * see executable tokens — a `';'`, `':name'`, `'$1'` or `"limit"` inside a
176
+ * literal must never trip them. Unterminated literals/comments mask to the end;
177
+ * Postgres reports those itself.
175
178
  */
176
- function hasTopLevelLimitOrOffset(sql: string): boolean {
179
+ function executableSql(sql: string): string {
177
180
  const n = sql.length;
178
- let depth = 0;
181
+ let result = '';
179
182
  let i = 0;
180
183
  while (i < n) {
184
+ const start = i;
181
185
  const c = sql[i];
182
- if (c === "'") {
183
- i++;
184
- while (i < n && sql[i] !== "'") i++;
185
- i++;
186
- continue;
187
- }
188
- if (c === '"') {
189
- i++;
190
- while (i < n && sql[i] !== '"') i++;
186
+ if (c === "'" || c === '"') {
187
+ // E'…' strings escape with backslash; plain ones only double the quote.
188
+ const backslashEscapes =
189
+ c === "'" &&
190
+ /[eE]/.test(sql[i - 1] ?? '') &&
191
+ !/[A-Za-z0-9_$]/.test(sql[i - 2] ?? '');
191
192
  i++;
192
- continue;
193
- }
194
- if (c === '-' && sql[i + 1] === '-') {
195
- i += 2;
193
+ while (i < n) {
194
+ if (backslashEscapes && sql[i] === '\\') {
195
+ i += 2;
196
+ continue;
197
+ }
198
+ if (sql[i++] === c) {
199
+ if (sql[i] !== c) break;
200
+ i++;
201
+ }
202
+ }
203
+ } else if (c === '$' && !/[A-Za-z0-9_$]/.test(sql[i - 1] ?? '')) {
204
+ DOLLAR_QUOTE_RE.lastIndex = i;
205
+ const delimiter = DOLLAR_QUOTE_RE.exec(sql)?.[0];
206
+ if (!delimiter) {
207
+ result += c;
208
+ i++;
209
+ continue;
210
+ }
211
+ const end = sql.indexOf(delimiter, i + delimiter.length);
212
+ i = end < 0 ? n : end + delimiter.length;
213
+ } else if (c === '-' && sql[i + 1] === '-') {
196
214
  while (i < n && sql[i] !== '\n') i++;
197
- continue;
198
- }
199
- if (c === '/' && sql[i + 1] === '*') {
215
+ } else if (c === '/' && sql[i + 1] === '*') {
216
+ let depth = 1;
200
217
  i += 2;
201
- while (i < n && !(sql[i] === '*' && sql[i + 1] === '/')) i++;
202
- i += 2;
203
- continue;
204
- }
205
- if (c === '(') {
206
- depth++;
207
- i++;
208
- continue;
209
- }
210
- if (c === ')') {
211
- if (depth > 0) depth--;
218
+ while (i < n && depth > 0) {
219
+ if (sql[i] === '/' && sql[i + 1] === '*') {
220
+ depth++;
221
+ i += 2;
222
+ } else if (sql[i] === '*' && sql[i + 1] === '/') {
223
+ depth--;
224
+ i += 2;
225
+ } else {
226
+ i++;
227
+ }
228
+ }
229
+ } else {
230
+ result += c;
212
231
  i++;
213
232
  continue;
214
233
  }
215
- if (/[A-Za-z_]/.test(c)) {
216
- let j = i + 1;
217
- while (j < n && /[A-Za-z0-9_$]/.test(sql[j])) j++;
218
- if (depth === 0) {
219
- const word = sql.slice(i, j).toLowerCase();
220
- if (word === 'limit' || word === 'offset') return true;
221
- }
222
- i = j;
223
- continue;
234
+ result += ' '.repeat(Math.min(i, n) - start);
235
+ }
236
+ return result;
237
+ }
238
+
239
+ /**
240
+ * True if `sql` (already masked by executableSql) has a LIMIT/OFFSET keyword
241
+ * at paren-depth 0. An inner LIMIT inside a subquery sits at depth > 0 and is
242
+ * allowed.
243
+ */
244
+ function hasTopLevelLimitOrOffset(sql: string): boolean {
245
+ let depth = 0;
246
+ for (const [token] of sql.matchAll(/[A-Za-z_][A-Za-z0-9_$]*|[()]/g)) {
247
+ if (token === '(') {
248
+ depth++;
249
+ } else if (token === ')') {
250
+ depth = Math.max(0, depth - 1);
251
+ } else if (depth === 0 && /^(limit|offset)$/i.test(token)) {
252
+ return true;
224
253
  }
225
- i++;
226
254
  }
227
255
  return false;
228
256
  }
@@ -253,18 +281,19 @@ function queryValidationError(message: string) {
253
281
  function validateReadOnlySelect(raw: string): string {
254
282
  const stripped = raw.trim().replace(/;\s*$/, '');
255
283
  if (!stripped) throw queryValidationError('query is empty');
256
- if (stripped.includes(';')) {
284
+ const executable = executableSql(stripped);
285
+ if (executable.includes(';')) {
257
286
  throw queryValidationError('query must be a single statement (no embedded ";").');
258
287
  }
259
- if (/\$\d/.test(stripped) || /(^|[^:]):[A-Za-z_]/.test(stripped)) {
288
+ if (/\$\d/.test(executable) || /(^|[^:]):[A-Za-z_]/.test(executable)) {
260
289
  throw queryValidationError('query must not contain bind parameters ($1, :name).');
261
290
  }
262
291
  // Allow a leading "(" for "(SELECT …) UNION …" / parenthesized selects.
263
- const head = stripped.replace(/^\s*\(+\s*/, '');
292
+ const head = executable.replace(/^\s*\(+\s*/, '').trimStart();
264
293
  if (!/^(select|with)\b/i.test(head)) {
265
294
  throw queryValidationError('query must be a single read-only SELECT (or WITH … SELECT).');
266
295
  }
267
- if (hasTopLevelLimitOrOffset(stripped)) {
296
+ if (hasTopLevelLimitOrOffset(executable)) {
268
297
  throw queryValidationError(
269
298
  'query must not include a top-level LIMIT/OFFSET — the connector adds pagination automatically (an inner LIMIT inside a subquery is fine).',
270
299
  );
@@ -0,0 +1,157 @@
1
+ -- squawk-ignore-file prefer-robust-stmts
2
+ -- migrate:up
3
+ -- lobu:quiesce old readers resolve saved source type IDs by local slug and must not serve cross-workspace endpoints
4
+ -- Trigger bodies only: immutable type IDs and verbatim keys are reused; no data rewrite, tables, columns or indexes.
5
+ CREATE OR REPLACE FUNCTION lobu_guard_source_relationships() RETURNS trigger LANGUAGE plpgsql AS $$
6
+ DECLARE rt entity_relationship_types; source_type entity_types; type_id bigint;
7
+ BEGIN
8
+ IF TG_OP = 'UPDATE' AND (OLD.from_entity_type_id IS NOT NULL OR OLD.to_entity_type_id IS NOT NULL) AND
9
+ (NEW.from_entity_id, NEW.from_entity_type_id, NEW.from_source_key, NEW.to_entity_id, NEW.to_entity_type_id, NEW.to_source_key)
10
+ IS DISTINCT FROM
11
+ (OLD.from_entity_id, OLD.from_entity_type_id, OLD.from_source_key, OLD.to_entity_id, OLD.to_entity_type_id, OLD.to_source_key) THEN
12
+ RAISE EXCEPTION 'Source relationship endpoints are immutable; unlink and create a new relationship';
13
+ END IF;
14
+ IF NEW.from_entity_type_id IS NULL AND NEW.to_entity_type_id IS NULL THEN RETURN NEW; END IF;
15
+ SELECT * INTO rt FROM entity_relationship_types WHERE id = NEW.relationship_type_id FOR SHARE;
16
+ IF rt.purpose IN ('authorization', 'identity') OR rt.slug = 'member_of' THEN
17
+ RAISE EXCEPTION 'Authorization and identity associations require stored endpoints';
18
+ END IF;
19
+ -- Withdrawals remain possible after a source disconnect or disappearance.
20
+ IF NEW.deleted_at IS NOT NULL THEN RETURN NEW; END IF;
21
+ FOR type_id IN SELECT DISTINCT id FROM unnest(ARRAY[NEW.from_entity_type_id, NEW.to_entity_type_id]) AS ids(id)
22
+ WHERE id IS NOT NULL ORDER BY id LOOP
23
+ SELECT * INTO source_type FROM entity_types WHERE id = type_id FOR SHARE;
24
+ IF source_type.deleted_at IS NOT NULL OR source_type.backing_sql IS NULL
25
+ OR source_type.metadata_schema->>'x-lobu-record-key' IS NULL THEN
26
+ RAISE EXCEPTION 'Source endpoints require a live workspace type with a declared stable record key';
27
+ END IF;
28
+ -- The authoring side is always local. The target may name a type owned by
29
+ -- a public workspace; source ACLs are additionally enforced at read/write.
30
+ IF source_type.organization_id IS DISTINCT FROM NEW.organization_id
31
+ AND (NEW.from_entity_type_id = type_id OR NOT EXISTS (
32
+ SELECT 1 FROM organization WHERE id = source_type.organization_id AND visibility = 'public'
33
+ )) THEN
34
+ RAISE EXCEPTION 'Source relationship requires a local source and a local or public target';
35
+ END IF;
36
+ END LOOP;
37
+ RETURN NEW;
38
+ END $$;
39
+
40
+ CREATE OR REPLACE FUNCTION lobu_guard_source_type_contract() RETURNS trigger LANGUAGE plpgsql AS $$
41
+ DECLARE blocking_ids bigint[];
42
+ BEGIN
43
+ -- The publisher's own live edges block deletion and every contract change.
44
+ IF (NEW.deleted_at, NEW.backing_sql, NEW.backing_source, NEW.metadata_schema->>'x-lobu-record-key')
45
+ IS DISTINCT FROM (OLD.deleted_at, OLD.backing_sql, OLD.backing_source, OLD.metadata_schema->>'x-lobu-record-key') THEN
46
+ SELECT array_agg(id) INTO blocking_ids FROM (
47
+ SELECT id FROM entity_relationships WHERE organization_id = OLD.organization_id AND deleted_at IS NULL
48
+ AND (from_entity_type_id = OLD.id OR to_entity_type_id = OLD.id) ORDER BY id LIMIT 25
49
+ ) AS blockers;
50
+ IF blocking_ids IS NOT NULL THEN
51
+ RAISE EXCEPTION 'Source record contract has live relationships; unlink relationship IDs % then retry changing backing, key, or deleting the type (at most 25 shown)', blocking_ids
52
+ USING ERRCODE = 'check_violation', CONSTRAINT = 'entity_types_source_relationship_contract';
53
+ END IF;
54
+ END IF;
55
+ -- Other workspaces' edges never veto deletion or a backing edit: a retired
56
+ -- type withholds them. The key column is what every stored key means, so it
57
+ -- cannot change in place while any workspace holds a live edge; a new type
58
+ -- (new ID) replaces it instead. Other workspaces' relationship IDs stay private.
59
+ IF NEW.metadata_schema->>'x-lobu-record-key' IS DISTINCT FROM OLD.metadata_schema->>'x-lobu-record-key'
60
+ AND (EXISTS (SELECT 1 FROM entity_relationships WHERE to_entity_type_id = OLD.id AND deleted_at IS NULL)
61
+ OR EXISTS (SELECT 1 FROM entity_relationships WHERE from_entity_type_id = OLD.id AND deleted_at IS NULL)) THEN
62
+ RAISE EXCEPTION 'Other workspaces link to records by this key; delete this type and create a new one to change its record key'
63
+ USING ERRCODE = 'check_violation', CONSTRAINT = 'entity_types_source_relationship_contract';
64
+ END IF;
65
+ RETURN NEW;
66
+ END $$;
67
+
68
+ CREATE OR REPLACE FUNCTION lobu_guard_source_relationship_type() RETURNS trigger LANGUAGE plpgsql AS $$
69
+ DECLARE blocking_ids bigint[];
70
+ BEGIN
71
+ IF (NEW.purpose IN ('authorization', 'identity') OR NEW.slug = 'member_of')
72
+ AND EXISTS (SELECT 1 FROM entity_relationships WHERE relationship_type_id = OLD.id
73
+ AND deleted_at IS NULL AND (from_entity_type_id IS NOT NULL OR to_entity_type_id IS NOT NULL)) THEN
74
+ SELECT array_agg(id) INTO blocking_ids FROM (
75
+ SELECT id FROM entity_relationships WHERE relationship_type_id = OLD.id AND organization_id = OLD.organization_id
76
+ AND deleted_at IS NULL AND (from_entity_type_id IS NOT NULL OR to_entity_type_id IS NOT NULL) ORDER BY id LIMIT 25
77
+ ) AS blockers;
78
+ IF blocking_ids IS NULL THEN
79
+ RAISE EXCEPTION 'Source relationships in other workspaces use this relationship type, so it cannot become an authorization or identity association'
80
+ USING ERRCODE = 'check_violation', CONSTRAINT = 'entity_relationship_types_source_endpoint_purpose';
81
+ END IF;
82
+ RAISE EXCEPTION 'Source relationships cannot become authorization or identity associations; unlink relationship IDs % then retry (at most 25 shown)', blocking_ids
83
+ USING ERRCODE = 'check_violation', CONSTRAINT = 'entity_relationship_types_source_endpoint_purpose';
84
+ END IF;
85
+ RETURN NEW;
86
+ END $$;
87
+
88
+ -- migrate:down
89
+ -- Refuse rollback while the old binary would resolve a foreign type ID by local slug.
90
+ DO $$ BEGIN
91
+ IF EXISTS (
92
+ SELECT 1 FROM entity_relationships r JOIN entity_types t ON t.id = r.to_entity_type_id
93
+ WHERE t.organization_id IS DISTINCT FROM r.organization_id
94
+ ) THEN
95
+ RAISE EXCEPTION 'Cannot roll back while cross-workspace source relationships exist';
96
+ END IF;
97
+ END $$;
98
+ CREATE OR REPLACE FUNCTION lobu_guard_source_relationships() RETURNS trigger LANGUAGE plpgsql AS $$
99
+ DECLARE rt entity_relationship_types; source_type entity_types; type_id bigint;
100
+ BEGIN
101
+ IF TG_OP = 'UPDATE' AND (OLD.from_entity_type_id IS NOT NULL OR OLD.to_entity_type_id IS NOT NULL) AND
102
+ (NEW.from_entity_id, NEW.from_entity_type_id, NEW.from_source_key, NEW.to_entity_id, NEW.to_entity_type_id, NEW.to_source_key)
103
+ IS DISTINCT FROM
104
+ (OLD.from_entity_id, OLD.from_entity_type_id, OLD.from_source_key, OLD.to_entity_id, OLD.to_entity_type_id, OLD.to_source_key) THEN
105
+ RAISE EXCEPTION 'Source relationship endpoints are immutable; unlink and create a new relationship';
106
+ END IF;
107
+ IF NEW.from_entity_type_id IS NULL AND NEW.to_entity_type_id IS NULL THEN RETURN NEW; END IF;
108
+ SELECT * INTO rt FROM entity_relationship_types WHERE id = NEW.relationship_type_id FOR SHARE;
109
+ IF rt.purpose IN ('authorization', 'identity') OR rt.slug = 'member_of' THEN
110
+ RAISE EXCEPTION 'Authorization and identity associations require stored endpoints';
111
+ END IF;
112
+ -- Withdrawals remain possible after a source disconnect or disappearance.
113
+ IF NEW.deleted_at IS NOT NULL THEN RETURN NEW; END IF;
114
+ FOR type_id IN SELECT DISTINCT id FROM unnest(ARRAY[NEW.from_entity_type_id, NEW.to_entity_type_id]) AS ids(id)
115
+ WHERE id IS NOT NULL ORDER BY id LOOP
116
+ SELECT * INTO source_type FROM entity_types WHERE id = type_id FOR SHARE;
117
+ IF source_type.deleted_at IS NOT NULL OR source_type.backing_sql IS NULL
118
+ OR source_type.organization_id IS DISTINCT FROM NEW.organization_id
119
+ OR source_type.metadata_schema->>'x-lobu-record-key' IS NULL THEN
120
+ RAISE EXCEPTION 'Source endpoints require a live workspace type with a declared stable record key';
121
+ END IF;
122
+ END LOOP;
123
+ RETURN NEW;
124
+ END $$;
125
+
126
+ CREATE OR REPLACE FUNCTION lobu_guard_source_type_contract() RETURNS trigger LANGUAGE plpgsql AS $$
127
+ DECLARE blocking_ids bigint[];
128
+ BEGIN
129
+ IF (NEW.deleted_at, NEW.backing_sql, NEW.backing_source, NEW.metadata_schema->>'x-lobu-record-key')
130
+ IS DISTINCT FROM (OLD.deleted_at, OLD.backing_sql, OLD.backing_source, OLD.metadata_schema->>'x-lobu-record-key')
131
+ AND (EXISTS (SELECT 1 FROM entity_relationships WHERE from_entity_type_id = OLD.id AND deleted_at IS NULL)
132
+ OR EXISTS (SELECT 1 FROM entity_relationships WHERE to_entity_type_id = OLD.id AND deleted_at IS NULL)) THEN
133
+ SELECT array_agg(id) INTO blocking_ids FROM (
134
+ SELECT id FROM entity_relationships WHERE organization_id = OLD.organization_id AND deleted_at IS NULL
135
+ AND (from_entity_type_id = OLD.id OR to_entity_type_id = OLD.id) ORDER BY id LIMIT 25
136
+ ) AS blockers;
137
+ RAISE EXCEPTION 'Source record contract has live relationships; unlink relationship IDs % then retry changing backing, key, or deleting the type (at most 25 shown)', blocking_ids
138
+ USING ERRCODE = 'check_violation', CONSTRAINT = 'entity_types_source_relationship_contract';
139
+ END IF;
140
+ RETURN NEW;
141
+ END $$;
142
+
143
+ CREATE OR REPLACE FUNCTION lobu_guard_source_relationship_type() RETURNS trigger LANGUAGE plpgsql AS $$
144
+ DECLARE blocking_ids bigint[];
145
+ BEGIN
146
+ IF (NEW.purpose IN ('authorization', 'identity') OR NEW.slug = 'member_of')
147
+ AND EXISTS (SELECT 1 FROM entity_relationships WHERE relationship_type_id = OLD.id
148
+ AND deleted_at IS NULL AND (from_entity_type_id IS NOT NULL OR to_entity_type_id IS NOT NULL)) THEN
149
+ SELECT array_agg(id) INTO blocking_ids FROM (
150
+ SELECT id FROM entity_relationships WHERE relationship_type_id = OLD.id AND organization_id = OLD.organization_id
151
+ AND deleted_at IS NULL AND (from_entity_type_id IS NOT NULL OR to_entity_type_id IS NOT NULL) ORDER BY id LIMIT 25
152
+ ) AS blockers;
153
+ RAISE EXCEPTION 'Source relationships cannot become authorization or identity associations; unlink relationship IDs % then retry (at most 25 shown)', blocking_ids
154
+ USING ERRCODE = 'check_violation', CONSTRAINT = 'entity_relationship_types_source_endpoint_purpose';
155
+ END IF;
156
+ RETURN NEW;
157
+ END $$;