fnloom 0.1.0 → 0.3.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 (705) hide show
  1. package/README.md +133 -23
  2. package/package.json +13 -17
  3. package/packages/build/package.json +2 -2
  4. package/packages/cli/package.json +1 -1
  5. package/packages/cli/src/cli.ts +2 -1
  6. package/packages/cli/src/command.ts +2 -0
  7. package/packages/cli/src/commands/available.ts +63 -22
  8. package/packages/cli/src/commands/install.ts +182 -28
  9. package/packages/cli/src/commands/manage.ts +7 -5
  10. package/packages/cli/src/commands/store.ts +172 -0
  11. package/packages/cli/src/hub.ts +26 -7
  12. package/packages/cli/src/index.ts +3 -2
  13. package/packages/cli/src/io.ts +1 -0
  14. package/packages/cli/src/local.ts +6 -0
  15. package/packages/cli/src/premade.ts +80 -0
  16. package/packages/cli/src/testing.ts +2 -1
  17. package/packages/core/package.json +4 -4
  18. package/packages/core/src/context-files.ts +3 -1
  19. package/packages/core/src/context-graph.ts +4 -0
  20. package/packages/core/src/context-plan.ts +451 -0
  21. package/packages/core/src/context-questions.ts +305 -0
  22. package/packages/core/src/fn-facts.ts +32 -4
  23. package/packages/core/src/identity.ts +1 -1
  24. package/packages/core/src/index.ts +4 -1
  25. package/packages/core/src/link.ts +70 -0
  26. package/packages/core/src/manifest.ts +20 -1
  27. package/packages/core/src/model-calls.ts +11 -2
  28. package/packages/core/src/package.ts +10 -0
  29. package/packages/core/src/query.ts +3 -2
  30. package/packages/core/src/records/content.ts +10 -2
  31. package/packages/core/src/records/runs.ts +12 -0
  32. package/packages/core/src/records/systems.ts +87 -5
  33. package/packages/core/src/run.ts +5 -0
  34. package/packages/core/src/stores.ts +473 -0
  35. package/packages/core/src/suggestions.ts +3 -0
  36. package/packages/core/src/system-pages.ts +14 -1
  37. package/packages/core/src/web.ts +114 -9
  38. package/packages/hub/package.json +13 -12
  39. package/packages/hub/src/access/hits.ts +1 -1
  40. package/packages/hub/src/api/admin-ops.ts +36 -4
  41. package/packages/hub/src/api/auth.ts +8 -4
  42. package/packages/hub/src/api/person-ops.ts +6 -0
  43. package/packages/hub/src/api/store-ops.ts +54 -0
  44. package/packages/hub/src/api/testing/rig.ts +2 -2
  45. package/packages/hub/src/api/tls.ts +2 -2
  46. package/packages/hub/src/api/web/build5.ts +2 -1
  47. package/packages/hub/src/api/web/context-plans.ts +25 -0
  48. package/packages/hub/src/api/web/context-review.ts +43 -0
  49. package/packages/hub/src/api/web/index.ts +4 -0
  50. package/packages/hub/src/api/web/pages.ts +14 -1
  51. package/packages/hub/src/api/web/review.ts +16 -0
  52. package/packages/hub/src/api/web/systems.ts +14 -2
  53. package/packages/hub/src/boot/admin-fns.ts +8 -0
  54. package/packages/hub/src/boot/admin-secrets.ts +10 -4
  55. package/packages/hub/src/boot/env.ts +6 -1
  56. package/packages/hub/src/boot/hub-fns.ts +3 -3
  57. package/packages/hub/src/boot/hub-groups.ts +2 -2
  58. package/packages/hub/src/boot/identity.ts +1 -1
  59. package/packages/hub/src/boot/index.ts +9 -0
  60. package/packages/hub/src/boot/modules.ts +12 -3
  61. package/packages/hub/src/boot/person-fns.ts +5 -0
  62. package/packages/hub/src/boot/plan-fns.ts +39 -0
  63. package/packages/hub/src/boot/start.ts +2 -1
  64. package/packages/hub/src/catalog/catalog.ts +44 -14
  65. package/packages/hub/src/catalog/index.ts +6 -2
  66. package/packages/hub/src/chat/testing.ts +2 -2
  67. package/packages/hub/src/contextor/brought.ts +5 -3
  68. package/packages/hub/src/contextor/testing.ts +4 -4
  69. package/packages/hub/src/execution/create.ts +2 -0
  70. package/packages/hub/src/execution/env.ts +2 -0
  71. package/packages/hub/src/execution/errors.ts +12 -0
  72. package/packages/hub/src/execution/executors.ts +14 -2
  73. package/packages/hub/src/execution/index.ts +8 -0
  74. package/packages/hub/src/execution/link-handlers.ts +16 -4
  75. package/packages/hub/src/execution/runs.ts +212 -11
  76. package/packages/hub/src/execution/testing.ts +2 -1
  77. package/packages/hub/src/fns/search.ts +23 -4
  78. package/packages/hub/src/graph/graph.ts +2 -2
  79. package/packages/hub/src/index/index.ts +9 -2
  80. package/packages/hub/src/index/indexer.ts +67 -16
  81. package/packages/hub/src/index/search.ts +1 -0
  82. package/packages/hub/src/index/suggester.ts +2 -2
  83. package/packages/hub/src/link/build.ts +47 -10
  84. package/packages/hub/src/link/connections.ts +41 -3
  85. package/packages/hub/src/link/describer.ts +19 -2
  86. package/packages/hub/src/link/env.ts +10 -0
  87. package/packages/hub/src/link/handlers.ts +6 -0
  88. package/packages/hub/src/link/index.ts +16 -4
  89. package/packages/hub/src/link/lifecycle.ts +11 -4
  90. package/packages/hub/src/link/packages.ts +17 -4
  91. package/packages/hub/src/link/pairing.ts +2 -2
  92. package/packages/hub/src/link/process.ts +15 -4
  93. package/packages/hub/src/link/rig.ts +6 -2
  94. package/packages/hub/src/link/status.ts +14 -0
  95. package/packages/hub/src/link/supervisor.ts +17 -1
  96. package/packages/hub/src/link/systems.ts +16 -5
  97. package/packages/hub/src/models/roles.ts +74 -7
  98. package/packages/hub/src/query/columns.ts +4 -1
  99. package/packages/hub/src/query/contexts.ts +10 -3
  100. package/packages/hub/src/questions/apply.ts +163 -0
  101. package/packages/hub/src/questions/carry.ts +30 -0
  102. package/packages/hub/src/questions/duplicates.ts +181 -0
  103. package/packages/hub/src/questions/index.ts +112 -0
  104. package/packages/hub/src/questions/metadata.ts +142 -0
  105. package/packages/hub/src/questions/pending.ts +64 -0
  106. package/packages/hub/src/questions/plan-match.ts +79 -0
  107. package/packages/hub/src/questions/plan-prompts.ts +110 -0
  108. package/packages/hub/src/questions/planner.ts +382 -0
  109. package/packages/hub/src/questions/plans.ts +353 -0
  110. package/packages/hub/src/questions/review.ts +253 -0
  111. package/packages/hub/src/questions/setting.ts +50 -0
  112. package/packages/hub/src/questions/testing.ts +131 -0
  113. package/packages/hub/src/questions/worker.ts +182 -0
  114. package/packages/hub/src/resources/context.ts +58 -20
  115. package/packages/hub/src/resources/create.ts +16 -4
  116. package/packages/hub/src/resources/env.ts +4 -0
  117. package/packages/hub/src/resources/fns.ts +6 -2
  118. package/packages/hub/src/resources/index.ts +8 -2
  119. package/packages/hub/src/resources/testing.ts +18 -2
  120. package/packages/hub/src/store/codec.ts +23 -5
  121. package/packages/hub/src/store/context-status.ts +56 -0
  122. package/packages/hub/src/store/derived.ts +53 -0
  123. package/packages/hub/src/store/hybrid.ts +33 -6
  124. package/packages/hub/src/store/lists.ts +2 -1
  125. package/packages/hub/src/store/migrate-fn-names.ts +5 -2
  126. package/packages/hub/src/store/rows.ts +8 -1
  127. package/packages/hub/src/store/schema.ts +2 -1
  128. package/packages/hub/src/store/sqlite.ts +2 -1
  129. package/packages/hub/src/stores/backups.ts +163 -0
  130. package/packages/hub/src/stores/drivers.ts +100 -0
  131. package/packages/hub/src/stores/guard.ts +116 -0
  132. package/packages/hub/src/stores/host.ts +459 -0
  133. package/packages/hub/src/stores/moves.ts +380 -0
  134. package/packages/hub/src/stores/plugin.ts +42 -0
  135. package/packages/hub/src/stores/service.ts +340 -0
  136. package/packages/hub/src/stores/testing.ts +149 -0
  137. package/packages/sdk/AUTHORING.md +1813 -218
  138. package/packages/sdk/package.json +12 -8
  139. package/packages/sdk/src/build.ts +3 -0
  140. package/packages/sdk/src/client.ts +22 -0
  141. package/packages/sdk/src/ctx.ts +51 -17
  142. package/packages/sdk/src/declare.ts +36 -12
  143. package/packages/sdk/src/hub.ts +222 -10
  144. package/packages/sdk/src/impl.ts +3 -3
  145. package/packages/sdk/src/index.ts +6 -3
  146. package/packages/sdk/src/manifest.ts +5 -0
  147. package/packages/sdk/src/providers.ts +2 -2
  148. package/packages/sdk/src/server/asks.ts +12 -1
  149. package/packages/sdk/src/server/env.ts +13 -1
  150. package/packages/sdk/src/server/host.ts +81 -10
  151. package/packages/sdk/src/server/index.ts +21 -2
  152. package/packages/sdk/src/server/package.ts +11 -2
  153. package/packages/sdk/src/server/run.ts +6 -1
  154. package/packages/sdk/src/server/runtime.ts +78 -22
  155. package/packages/sdk/src/server/start-gate.ts +174 -0
  156. package/packages/sdk/src/server/store/checksum.ts +162 -0
  157. package/packages/sdk/src/server/store/engines.ts +400 -0
  158. package/packages/sdk/src/server/store/extend.ts +25 -0
  159. package/packages/sdk/src/server/store/keeper.ts +392 -0
  160. package/packages/sdk/src/server/store/link-driver.ts +142 -0
  161. package/packages/sdk/src/server/store/measure.ts +45 -0
  162. package/packages/sdk/src/server/store/migrations.ts +238 -0
  163. package/packages/sdk/src/server/store/move.ts +488 -0
  164. package/packages/sdk/src/server/store/portable.ts +288 -0
  165. package/packages/sdk/src/server/store/stable.ts +146 -0
  166. package/packages/sdk/src/server/store/tables.ts +28 -0
  167. package/packages/sdk/src/server/store/vectors.ts +185 -0
  168. package/packages/sdk/src/server/store/work-checks.ts +288 -0
  169. package/packages/sdk/src/server/store/work.ts +369 -0
  170. package/packages/sdk/src/server/table.ts +3 -1
  171. package/packages/sdk/src/server/testing.ts +116 -3
  172. package/packages/sdk/src/store.ts +91 -0
  173. package/packages/sdk/src/system.ts +58 -30
  174. package/packages/sdk/src/testing/hub.ts +18 -5
  175. package/packages/web/dist/assets/{ActorSettingsView-BuMYRDqv.js → ActorSettingsView-v2k7v454.js} +2 -2
  176. package/packages/web/dist/assets/{AdminLayout-sLjVTrmV.js → AdminLayout-B6Jrc_4W.js} +2 -2
  177. package/packages/web/dist/assets/{ApiServiceForm-BrMTU-7u.js → ApiServiceForm-CuuQgOJc.js} +2 -2
  178. package/packages/web/dist/assets/{ApiServiceView-BMF2zD6Q.js → ApiServiceView-7bTHSO_Z.js} +2 -2
  179. package/packages/web/dist/assets/{ApiServicesView-bjLAWO_j.js → ApiServicesView-BXi24n49.js} +2 -2
  180. package/packages/web/dist/assets/{AppPage-DSzDKCFz.js → AppPage-CFmKZS8G.js} +2 -2
  181. package/packages/web/dist/assets/{AutoPairPicker-nV38ALjl.js → AutoPairPicker-C61gihmh.js} +2 -2
  182. package/packages/web/dist/assets/{BrowserFrame-Bic7U7jN.js → BrowserFrame-Sq9EmQRT.js} +2 -2
  183. package/packages/web/dist/assets/{ChartVisual-DWw7WsfN.js → ChartVisual-C4mgw4wh.js} +4 -4
  184. package/packages/web/dist/assets/ChatPage-CAhHE03Z.js +4 -0
  185. package/packages/web/dist/assets/{CodeViewer-xHS3Xah9.js → CodeViewer-tUNXZB77.js} +2 -2
  186. package/packages/web/dist/assets/{ConfigWithCustom-DreTUdf0.js → ConfigWithCustom-D_-rY66L.js} +3 -3
  187. package/packages/web/dist/assets/{ConfirmDialog-DjQUzNqk.js → ConfirmDialog-Dd3E4sJt.js} +2 -2
  188. package/packages/web/dist/assets/{ConnectPage-CfRDrXvJ.js → ConnectPage-CX9acyQH.js} +2 -2
  189. package/packages/web/dist/assets/ContextItemPage-Cv4G0k_o.css +1 -0
  190. package/packages/web/dist/assets/ContextItemPage-rUI3-T_L.js +2 -0
  191. package/packages/web/dist/assets/ContextPage-C8u0UnYl.css +1 -0
  192. package/packages/web/dist/assets/ContextPage-CtefzyKg.js +3 -0
  193. package/packages/web/dist/assets/ContextRow-Chx99Xac.css +1 -0
  194. package/packages/web/dist/assets/ContextRow-DrtPumZ5.js +2 -0
  195. package/packages/web/dist/assets/{DataPage-wSIoGcb5.js → DataPage-DDSsxHro.js} +2 -2
  196. package/packages/web/dist/assets/DataTypePage-BW9fWaz8.js +2 -0
  197. package/packages/web/dist/assets/{DesignPage-DidMUX8m.js → DesignPage-6e0XbOFC.js} +2 -2
  198. package/packages/web/dist/assets/{ExplorePage-MUyVydVB.js → ExplorePage-B7ND0W0l.js} +2 -2
  199. package/packages/web/dist/assets/{FnList-CjQRwYaT.js → FnList-Bx6H-kux.js} +2 -2
  200. package/packages/web/dist/assets/{FnPill-BshAvm2I.js → FnPill-Cp3KuLmP.js} +2 -2
  201. package/packages/web/dist/assets/FnView-C0XZdnsS.js +2 -0
  202. package/packages/web/dist/assets/{FnsView-CeqIoaBT.js → FnsView-GTH3p7a0.js} +2 -2
  203. package/packages/web/dist/assets/{GinExprView-DYVUwZrd.js → GinExprView-DGxns6lH.js} +2 -2
  204. package/packages/web/dist/assets/{GinForm-D3mwMRTQ.js → GinForm-BDBUzuDP.js} +2 -2
  205. package/packages/web/dist/assets/{GinTypeView-C0YifSmE.js → GinTypeView-CUsymbVf.js} +2 -2
  206. package/packages/web/dist/assets/{GinValueView-HfEPq9le.js → GinValueView-jsKIfiEA.js} +2 -2
  207. package/packages/web/dist/assets/{GraphPage-ySnuA4Hp.js → GraphPage-BCcPPsHu.js} +2 -2
  208. package/packages/web/dist/assets/{GraphPanel-Cy5-KGo1.js → GraphPanel-9tztGHmu.js} +2 -2
  209. package/packages/web/dist/assets/{HubPicker-C_vA752L.js → HubPicker-EoOErgmk.js} +2 -2
  210. package/packages/web/dist/assets/{InboxApprovals-DcPCCmZ5.js → InboxApprovals-Dkq7DFp_.js} +2 -2
  211. package/packages/web/dist/assets/{InboxPage-C2DT2nuF.js → InboxPage-CHhslePq.js} +2 -2
  212. package/packages/web/dist/assets/{InjectedList-CJsEFEbz.js → InjectedList-CSWqRiON.js} +2 -2
  213. package/packages/web/dist/assets/InstallDialog-D-VwfZYF.js +2 -0
  214. package/packages/web/dist/assets/{InstallDialog-yWLZK_zN.css → InstallDialog-K-j0sdHm.css} +1 -1
  215. package/packages/web/dist/assets/InstanceTypes-CwVSAULg.css +1 -0
  216. package/packages/web/dist/assets/InstanceTypes-D3rAEiE7.js +2 -0
  217. package/packages/web/dist/assets/InstanceView-DoH8C-1j.js +2 -0
  218. package/packages/web/dist/assets/InstanceView-_9uE70tS.css +1 -0
  219. package/packages/web/dist/assets/{ItemHistory-CUGa8b6s.js → ItemHistory-NQAP69ma.js} +2 -2
  220. package/packages/web/dist/assets/LimitsView-DY2C9nYS.js +2 -0
  221. package/packages/web/dist/assets/ListSearch-BunVrDO0.js +2 -0
  222. package/packages/web/dist/assets/{LlmCallDetails-2yQftCqd.js → LlmCallDetails-BoVNDTVs.js} +2 -2
  223. package/packages/web/dist/assets/{LlmCallsView-DOHX3r0K.js → LlmCallsView-BGpV92RC.js} +2 -2
  224. package/packages/web/dist/assets/{LoadState-DeXfLvYv.js → LoadState-h-K9bTYc.js} +2 -2
  225. package/packages/web/dist/assets/{McpDialog-CA_0WKWF.js → McpDialog-DhOCk6_E.js} +2 -2
  226. package/packages/web/dist/assets/{McpServerForm-CAG8Wp2N.js → McpServerForm-Cor3fI7s.js} +2 -2
  227. package/packages/web/dist/assets/McpServerView-ewXRPEmZ.js +2 -0
  228. package/packages/web/dist/assets/McpServersView-Dd0xmfws.js +2 -0
  229. package/packages/web/dist/assets/{McpView-CC2oNOMa.js → McpView-GPXdCMne.js} +2 -2
  230. package/packages/web/dist/assets/{McpsView-CwJvyyxV.js → McpsView-DJIR2JX5.js} +2 -2
  231. package/packages/web/dist/assets/{MemoryDialog-Dbvh5uLq.js → MemoryDialog-BTeIHQyA.js} +2 -2
  232. package/packages/web/dist/assets/{ModelCallsView-RvnW3EBP.js → ModelCallsView-DMcnwF2S.js} +2 -2
  233. package/packages/web/dist/assets/{ModelPicker-DcjwQFHC.js → ModelPicker-CgkMFxSO.js} +2 -2
  234. package/packages/web/dist/assets/ModelsView-cMHygeiK.js +2 -0
  235. package/packages/web/dist/assets/{NotFoundPage-CeSwzTV-.js → NotFoundPage-Tk92K7HN.js} +2 -2
  236. package/packages/web/dist/assets/PairPage-D0BK8CCw.js +2 -0
  237. package/packages/web/dist/assets/PairPage-D_aPS1Ot.css +1 -0
  238. package/packages/web/dist/assets/{PanelHost-BkrFAnPa.js → PanelHost-C-gKrxAk.js} +2 -2
  239. package/packages/web/dist/assets/{PeopleView-D1QGPYp7.js → PeopleView-DRfeNWK5.js} +2 -2
  240. package/packages/web/dist/assets/PoliciesView-BRi-QAuo.js +2 -0
  241. package/packages/web/dist/assets/{RefusalList-DQoyUoPG.js → RefusalList-DVO0bmeB.js} +2 -2
  242. package/packages/web/dist/assets/{RemoteAuthFields-nxGWfmhf.js → RemoteAuthFields-CgiufuqQ.js} +2 -2
  243. package/packages/web/dist/assets/{ResourceViewer-Po24y4pj.js → ResourceViewer-Do0chYxU.js} +2 -2
  244. package/packages/web/dist/assets/ResourcesPage-BBx2u2mw.js +2 -0
  245. package/packages/web/dist/assets/{ResultGrid-uoq4yUYj.js → ResultGrid-Bj-0I5HY.js} +2 -2
  246. package/packages/web/dist/assets/{ReviewSummaryStrip-k3HevESg.js → ReviewSummaryStrip-DO3p64Qj.js} +2 -2
  247. package/packages/web/dist/assets/ReviewView-DZF9E1hb.js +3 -0
  248. package/packages/web/dist/assets/{RuleRow-CoXDA-SH.js → RuleRow-DX9v4iGP.js} +2 -2
  249. package/packages/web/dist/assets/{RunCard-CBSGdwdQ.js → RunCard-BnrtK2Yp.js} +2 -2
  250. package/packages/web/dist/assets/{RunDetails-CGhQQ6OI.js → RunDetails-DjR206q6.js} +2 -2
  251. package/packages/web/dist/assets/{RunDot-Ch_45985.js → RunDot-lHRICdM5.js} +2 -2
  252. package/packages/web/dist/assets/{RunPage-C_t20pB7.js → RunPage-CbAQ_WPR.js} +2 -2
  253. package/packages/web/dist/assets/{RunProgress-VrZUHUEC.js → RunProgress-C3-B4tQf.js} +2 -2
  254. package/packages/web/dist/assets/RunsView-DMkPmkqX.js +2 -0
  255. package/packages/web/dist/assets/ServiceRows-4WythFpF.js +2 -0
  256. package/packages/web/dist/assets/{ServiceRows-6BU4-MeL.css → ServiceRows-HPQ0pN6b.css} +1 -1
  257. package/packages/web/dist/assets/SettingsPage-BN4oSzoL.js +3 -0
  258. package/packages/web/dist/assets/{SignInPage-DrXZ1sG2.js → SignInPage-ByqGEZfj.js} +2 -2
  259. package/packages/web/dist/assets/{StatusBadge-Dpb9uG5e.js → StatusBadge-CXne0sRZ.js} +2 -2
  260. package/packages/web/dist/assets/StorePlacementStep-B6SwTmdM.js +2 -0
  261. package/packages/web/dist/assets/StorePlacementStep-D_G4e3ue.css +1 -0
  262. package/packages/web/dist/assets/{SystemConfig-72qKRkUk.js → SystemConfig-vQDL_eUl.js} +2 -2
  263. package/packages/web/dist/assets/{SystemPageHost-DLNg2FYK.js → SystemPageHost-DrMrEPyh.js} +2 -2
  264. package/packages/web/dist/assets/SystemView-Be6TBM4j.js +2 -0
  265. package/packages/web/dist/assets/{SystemView-C8ScHUe2.css → SystemView-_9q6eDfV.css} +1 -1
  266. package/packages/web/dist/assets/{SystemsView-B6HEL9VS.css → SystemsView-CWKnupLW.css} +1 -1
  267. package/packages/web/dist/assets/SystemsView-DZtT3laz.js +2 -0
  268. package/packages/web/dist/assets/{TableViewer-BQ7bYLOP.js → TableViewer-Boxx86f5.js} +3 -3
  269. package/packages/web/dist/assets/{ThemePicker-C2nJ21Vd.js → ThemePicker-CIg_oRQX.js} +2 -2
  270. package/packages/web/dist/assets/{TurnTree-CORdfTHj.js → TurnTree-Ecm0yA5g.js} +2 -2
  271. package/packages/web/dist/assets/UserMessage-BlnqZDVU.js +9 -0
  272. package/packages/web/dist/assets/{ValueVisual-aXEUaQ5Y.js → ValueVisual-C-MWpp7c.js} +2 -2
  273. package/packages/web/dist/assets/WidgetView-DX4ejNb6.js +3 -0
  274. package/packages/web/dist/assets/actor-names-OdvpVZeb.js +4 -0
  275. package/packages/web/dist/assets/{fn-modal-DqcxUhOQ.js → fn-modal-B98MR7JN.js} +2 -2
  276. package/packages/web/dist/assets/{fn-notices-BYaH6IoA.js → fn-notices-CfTa1E8y.js} +2 -2
  277. package/packages/web/dist/assets/{formats-DI__ADVG.js → formats-JwoKfXIq.js} +2 -2
  278. package/packages/web/dist/assets/index-6ScWTFy2.js +4 -0
  279. package/packages/web/dist/assets/{index-CSisx5mi.css → index-CEslGcrX.css} +1 -1
  280. package/packages/web/dist/assets/{labels-BhJpmLWA.js → labels-BFbk11BE.js} +2 -2
  281. package/packages/web/dist/assets/{layout-DQKldU13.js → layout-D1gf481r.js} +2 -2
  282. package/packages/web/dist/assets/{metrics-Cio5ykX6.js → metrics-CBPX3W5Y.js} +2 -2
  283. package/packages/web/dist/assets/{problems-BZY0Dwif.js → problems-t1E_ovSz.js} +2 -2
  284. package/packages/web/dist/assets/{push-payload-D5efGCzd.js → push-payload-BeU1ADYt.js} +64 -64
  285. package/packages/web/dist/assets/{record-edits-CveFEsal.js → record-edits-Bfsi4lU3.js} +2 -2
  286. package/packages/web/dist/assets/{remote-config-BkaarDf3.js → remote-config-BNQhSDzB.js} +2 -2
  287. package/packages/web/dist/assets/{review-CGUGvRV9.js → review-fP-l9D6H.js} +3 -3
  288. package/packages/web/dist/assets/routes-DV4IJpwe.js +4 -0
  289. package/packages/web/dist/assets/runs-CveC2kKo.js +2 -0
  290. package/packages/web/dist/assets/{shared-DTpYDMc_.js → shared-LbaIHjbV.js} +2 -2
  291. package/packages/web/dist/assets/{size-BwnshyOe.js → size-Bh__w5aI.js} +2 -2
  292. package/packages/web/dist/assets/{sources-Bm-TrxhL.js → sources-VPrtgLIi.js} +2 -2
  293. package/packages/web/dist/assets/src-CT3TeFaM.js +43 -0
  294. package/packages/web/dist/assets/state-xfQqaQPX.js +2 -0
  295. package/packages/web/dist/assets/{systems-DIp94AET.js → systems-BqE3WTSF.js} +2 -2
  296. package/packages/web/dist/assets/ui-BzgWquIU.js +17 -0
  297. package/packages/web/dist/assets/{ui-C7ZH_6oC.css → ui-DycHjPTZ.css} +1 -1
  298. package/packages/web/dist/assets/{url-BIg5IhGs.js → url-DKGcECT1.js} +2 -2
  299. package/packages/web/dist/assets/{widget-host-BCf6Tlt5.js → widget-host-B87MTaTn.js} +2 -2
  300. package/packages/web/dist/assets/{widgets-CrbkovMT.js → widgets-BBCuSS6E.js} +2 -2
  301. package/packages/web/dist/index.html +44 -44
  302. package/packages/web/dist/sw.js +1 -1
  303. package/packages/web/package.json +2 -2
  304. package/premade/claude.zip +0 -0
  305. package/premade/database.zip +0 -0
  306. package/premade/web.zip +0 -0
  307. package/scripts/dev-env.ts +4 -4
  308. package/scripts/run-stack.ts +3 -2
  309. package/scripts/stack.ts +115 -43
  310. package/scripts/start.ts +36 -17
  311. package/systems/api/package.json +3 -3
  312. package/systems/code/package.json +3 -3
  313. package/systems/embedder/package.json +1 -1
  314. package/systems/fs/client/fakes.ts +2 -0
  315. package/systems/fs/client/index.ts +4 -2
  316. package/systems/fs/client/machines/CoreHeatmap.vue +94 -0
  317. package/systems/fs/client/machines/MachineFiles.vue +121 -0
  318. package/systems/fs/client/machines/MachineMetrics.vue +330 -0
  319. package/systems/fs/client/machines/MachinesPage.vue +119 -0
  320. package/systems/fs/client/machines/TimeChart.vue +128 -0
  321. package/systems/fs/client/machines/fakes.ts +95 -0
  322. package/systems/fs/client/machines/files/ChangesPane.vue +90 -0
  323. package/systems/fs/client/machines/files/CodeView.vue +158 -0
  324. package/systems/fs/client/machines/files/CommentComposer.vue +86 -0
  325. package/systems/fs/client/machines/files/CommentThread.vue +115 -0
  326. package/systems/fs/client/machines/files/CommitPane.vue +80 -0
  327. package/systems/fs/client/machines/files/ComparePane.vue +81 -0
  328. package/systems/fs/client/machines/files/FileHistory.vue +89 -0
  329. package/systems/fs/client/machines/files/FilePane.vue +199 -0
  330. package/systems/fs/client/machines/files/FileTree.vue +26 -0
  331. package/systems/fs/client/machines/files/FolderPane.vue +154 -0
  332. package/systems/fs/client/machines/files/HistoryPane.vue +106 -0
  333. package/systems/fs/client/machines/files/ImageView.vue +160 -0
  334. package/systems/fs/client/machines/files/PatchView.vue +31 -0
  335. package/systems/fs/client/machines/files/QuickOpen.vue +67 -0
  336. package/systems/fs/client/machines/files/SearchPane.vue +87 -0
  337. package/systems/fs/client/machines/files/TreeNode.vue +72 -0
  338. package/systems/fs/client/machines/files/api.ts +127 -0
  339. package/systems/fs/client/machines/files/fake-kinds.ts +16 -0
  340. package/systems/fs/client/machines/files/fakes.ts +305 -0
  341. package/systems/fs/client/machines/files/ink.ts +117 -0
  342. package/systems/fs/client/machines/files/logic.ts +205 -0
  343. package/systems/fs/client/machines/files/state.ts +187 -0
  344. package/systems/fs/client/machines/files/viewers/CsvView.vue +29 -0
  345. package/systems/fs/client/machines/files/viewers/HexView.vue +27 -0
  346. package/systems/fs/client/machines/files/viewers/HtmlView.vue +17 -0
  347. package/systems/fs/client/machines/files/viewers/JsonNode.vue +45 -0
  348. package/systems/fs/client/machines/files/viewers/JsonView.vue +25 -0
  349. package/systems/fs/client/machines/metrics.ts +245 -0
  350. package/systems/fs/client/machines/palette.ts +97 -0
  351. package/systems/fs/client/preview/machines.ts +323 -0
  352. package/systems/fs/context/authoring/index.md +4 -0
  353. package/systems/fs/context/authoring/parts/actions.md +5 -1
  354. package/systems/fs/context/authoring/parts/actions.reference.md +6 -2
  355. package/systems/fs/context/authoring/parts/calling.md +5 -1
  356. package/systems/fs/context/authoring/parts/calling.reference.md +4 -0
  357. package/systems/fs/context/authoring/parts/client.md +9 -1
  358. package/systems/fs/context/authoring/parts/client.reference/client.md +4 -0
  359. package/systems/fs/context/authoring/parts/client.reference/resultview.md +56 -53
  360. package/systems/fs/context/authoring/parts/client.reference/{fnpillprops.md → textareaprops.md} +58 -4
  361. package/systems/fs/context/authoring/parts/client.reference.md +8 -4
  362. package/systems/fs/context/authoring/parts/context/questions.md +49 -0
  363. package/systems/fs/context/authoring/parts/context.md +23 -1
  364. package/systems/fs/context/authoring/parts/context.reference.md +27 -3
  365. package/systems/fs/context/authoring/parts/contract.md +10 -0
  366. package/systems/fs/context/authoring/parts/contract.reference.md +26 -9
  367. package/systems/fs/context/authoring/parts/core-types/access-ts.md +4 -0
  368. package/systems/fs/context/authoring/parts/core-types/admin-ts.md +5 -1
  369. package/systems/fs/context/authoring/parts/core-types/api-index-ts.md +4 -0
  370. package/systems/fs/context/authoring/parts/core-types/approvals-ts.md +11 -7
  371. package/systems/fs/context/authoring/parts/core-types/auto-pair-ts.md +4 -0
  372. package/systems/fs/context/authoring/parts/core-types/checks-ts.md +4 -0
  373. package/systems/fs/context/authoring/parts/core-types/claims-ts.md +4 -0
  374. package/systems/fs/context/authoring/parts/core-types/config-secrets-ts.md +4 -0
  375. package/systems/fs/context/authoring/parts/core-types/connections-ts.md +4 -0
  376. package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +8 -0
  377. package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +5 -1
  378. package/systems/fs/context/authoring/parts/core-types/context-questions-ts.md +26 -0
  379. package/systems/fs/context/authoring/parts/core-types/contextdecl.md +9 -1
  380. package/systems/fs/context/authoring/parts/core-types/data-ts.md +4 -0
  381. package/systems/fs/context/authoring/parts/core-types/decisions-ts.md +4 -0
  382. package/systems/fs/context/authoring/parts/core-types/fn-block-ts.md +4 -0
  383. package/systems/fs/context/authoring/parts/core-types/fn-facts-ts.md +11 -0
  384. package/systems/fs/context/authoring/parts/core-types/gin-ts.md +4 -0
  385. package/systems/fs/context/authoring/parts/core-types/grants-ts.md +5 -1
  386. package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +18 -5
  387. package/systems/fs/context/authoring/parts/core-types/link-ts.md +7 -3
  388. package/systems/fs/context/authoring/parts/core-types/llm-ts.md +4 -0
  389. package/systems/fs/context/authoring/parts/core-types/manifest.md +15 -2
  390. package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +9 -1
  391. package/systems/fs/context/authoring/parts/core-types/mention-search-ts.md +4 -0
  392. package/systems/fs/context/authoring/parts/core-types/model-calls-ts.md +5 -1
  393. package/systems/fs/context/authoring/parts/core-types/model-names-ts.md +4 -0
  394. package/systems/fs/context/authoring/parts/core-types/modes-ts.md +4 -0
  395. package/systems/fs/context/authoring/parts/core-types/owner-runs-ts.md +4 -0
  396. package/systems/fs/context/authoring/parts/core-types/package-ts.md +9 -0
  397. package/systems/fs/context/authoring/parts/core-types/primitives-ts.md +4 -0
  398. package/systems/fs/context/authoring/parts/core-types/query-ts.md +4 -0
  399. package/systems/fs/context/authoring/parts/core-types/records-actors-ts.md +7 -3
  400. package/systems/fs/context/authoring/parts/core-types/records-chat-ts.md +4 -0
  401. package/systems/fs/context/authoring/parts/core-types/records-content-ts.md +4 -0
  402. package/systems/fs/context/authoring/parts/core-types/records-runs-ts.md +4 -0
  403. package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +4 -0
  404. package/systems/fs/context/authoring/parts/core-types/registries-ts.md +4 -0
  405. package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +4 -0
  406. package/systems/fs/context/authoring/parts/core-types/resources-ts.md +5 -1
  407. package/systems/fs/context/authoring/parts/core-types/run-ts.md +7 -0
  408. package/systems/fs/context/authoring/parts/core-types/sensitivity-ts.md +5 -1
  409. package/systems/fs/context/authoring/parts/core-types/stores-ts.md +199 -0
  410. package/systems/fs/context/authoring/parts/core-types/system-events-ts.md +8 -1
  411. package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +4 -0
  412. package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +4 -0
  413. package/systems/fs/context/authoring/parts/core-types/validation-ts.md +4 -0
  414. package/systems/fs/context/authoring/parts/core-types/visuals-ts.md +4 -0
  415. package/systems/fs/context/authoring/parts/core-types/web-ts.md +4 -0
  416. package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +4 -0
  417. package/systems/fs/context/authoring/parts/core-types.md +12 -2
  418. package/systems/fs/context/authoring/parts/ctx/update-result.md +33 -0
  419. package/systems/fs/context/authoring/parts/ctx.md +11 -1
  420. package/systems/fs/context/authoring/parts/ctx.reference/{hubai.md → adminnotices.md} +45 -4
  421. package/systems/fs/context/authoring/parts/ctx.reference/fnctx.md +21 -23
  422. package/systems/fs/context/authoring/parts/ctx.reference.md +8 -4
  423. package/systems/fs/context/authoring/parts/data.md +11 -6
  424. package/systems/fs/context/authoring/parts/data.reference.md +4 -0
  425. package/systems/fs/context/authoring/parts/examples/client-findview-vue.md +4 -0
  426. package/systems/fs/context/authoring/parts/examples/client-index-ts.md +4 -0
  427. package/systems/fs/context/authoring/parts/examples/client-notecard-vue.md +4 -0
  428. package/systems/fs/context/authoring/parts/examples/client-noteinput-vue.md +4 -0
  429. package/systems/fs/context/authoring/parts/examples/client-notespage-vue.md +4 -0
  430. package/systems/fs/context/authoring/parts/examples/client-reviewform-vue.md +4 -0
  431. package/systems/fs/context/authoring/parts/examples/client-wordcount-vue.md +4 -0
  432. package/systems/fs/context/authoring/parts/examples/package-json.md +4 -0
  433. package/systems/fs/context/authoring/parts/examples/server-env-ts.md +4 -0
  434. package/systems/fs/context/authoring/parts/examples/server-impl-ts.md +4 -0
  435. package/systems/fs/context/authoring/parts/examples/server-index-ts.md +4 -0
  436. package/systems/fs/context/authoring/parts/examples/server-main-ts.md +4 -0
  437. package/systems/fs/context/authoring/parts/examples/server-notes-test-ts.md +4 -0
  438. package/systems/fs/context/authoring/parts/examples/shared-index-ts.md +10 -0
  439. package/systems/fs/context/authoring/parts/examples/system-json.md +4 -0
  440. package/systems/fs/context/authoring/parts/examples/{systems-fs-shared-index-ts-lines-1-189.md → systems-fs-shared-index-ts-lines-1-178.md} +23 -30
  441. package/systems/fs/context/authoring/parts/examples/{systems-fs-shared-index-ts-lines-190-370.md → systems-fs-shared-index-ts-lines-179-382.md} +33 -6
  442. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-383-567.md +210 -0
  443. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +117 -0
  444. package/systems/fs/context/authoring/parts/examples/tsconfig-json.md +5 -1
  445. package/systems/fs/context/authoring/parts/examples.md +18 -11
  446. package/systems/fs/context/authoring/parts/fns.md +5 -1
  447. package/systems/fs/context/authoring/parts/fns.reference/fillclaims.md +5 -1
  448. package/systems/fs/context/authoring/parts/fns.reference/fn.md +6 -2
  449. package/systems/fs/context/authoring/parts/fns.reference.md +4 -0
  450. package/systems/fs/context/authoring/parts/folder.md +4 -0
  451. package/systems/fs/context/authoring/parts/gin.md +4 -0
  452. package/systems/fs/context/authoring/parts/gin.reference.md +4 -0
  453. package/systems/fs/context/authoring/parts/handlers-progress.md +5 -1
  454. package/systems/fs/context/authoring/parts/handlers-progress.reference.md +4 -0
  455. package/systems/fs/context/authoring/parts/hooks.md +5 -1
  456. package/systems/fs/context/authoring/parts/hooks.reference.md +5 -1
  457. package/systems/fs/context/authoring/parts/hub/context-questions.md +40 -0
  458. package/systems/fs/context/authoring/parts/hub/{hub-run-background.md → hub-ctx-from-resource.md} +51 -56
  459. package/systems/fs/context/authoring/parts/hub/hub-fns-load.md +35 -42
  460. package/systems/fs/context/authoring/parts/hub/hub-install-package.md +327 -0
  461. package/systems/fs/context/authoring/parts/hub/kinds-of-hub.md +8 -0
  462. package/systems/fs/context/authoring/parts/hub.md +14 -8
  463. package/systems/fs/context/authoring/parts/hub.reference.md +9 -0
  464. package/systems/fs/context/authoring/parts/internals/manifestof.md +4 -0
  465. package/systems/fs/context/authoring/parts/internals/permissionargs.md +4 -0
  466. package/systems/fs/context/authoring/parts/internals/usagefromwire.md +47 -2
  467. package/systems/fs/context/authoring/parts/internals.md +6 -2
  468. package/systems/fs/context/authoring/parts/kinds-agents.md +5 -1
  469. package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +4 -0
  470. package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +7 -3
  471. package/systems/fs/context/authoring/parts/kinds-agents.reference.md +4 -0
  472. package/systems/fs/context/authoring/parts/lifecycle.md +8 -3
  473. package/systems/fs/context/authoring/parts/lifecycle.reference.md +6 -2
  474. package/systems/fs/context/authoring/parts/mentions.md +5 -1
  475. package/systems/fs/context/authoring/parts/mentions.reference.md +6 -2
  476. package/systems/fs/context/authoring/parts/mistakes.md +7 -2
  477. package/systems/fs/context/authoring/parts/named-types.md +4 -0
  478. package/systems/fs/context/authoring/parts/named-types.reference.md +6 -2
  479. package/systems/fs/context/authoring/parts/outcomes.md +5 -1
  480. package/systems/fs/context/authoring/parts/outcomes.reference.md +4 -0
  481. package/systems/fs/context/authoring/parts/owner-runs.md +5 -1
  482. package/systems/fs/context/authoring/parts/owner-runs.reference.md +36 -11
  483. package/systems/fs/context/authoring/parts/packaging.md +10 -3
  484. package/systems/fs/context/authoring/parts/packaging.reference.md +7 -2
  485. package/systems/fs/context/authoring/parts/providers.md +5 -1
  486. package/systems/fs/context/authoring/parts/providers.reference.md +5 -1
  487. package/systems/fs/context/authoring/parts/remote.md +5 -1
  488. package/systems/fs/context/authoring/parts/remote.reference.md +4 -0
  489. package/systems/fs/context/authoring/parts/resources.md +5 -1
  490. package/systems/fs/context/authoring/parts/resources.reference.md +4 -0
  491. package/systems/fs/context/authoring/parts/server.md +5 -1
  492. package/systems/fs/context/authoring/parts/server.reference.md +41 -20
  493. package/systems/fs/context/authoring/parts/settings-attachments.md +5 -1
  494. package/systems/fs/context/authoring/parts/settings-attachments.reference.md +4 -0
  495. package/systems/fs/context/authoring/parts/start.md +5 -1
  496. package/systems/fs/context/authoring/parts/state-forms.md +5 -1
  497. package/systems/fs/context/authoring/parts/state-forms.reference.md +4 -0
  498. package/systems/fs/context/authoring/parts/store/ctx-store.md +49 -0
  499. package/systems/fs/context/authoring/parts/store/declare.md +32 -0
  500. package/systems/fs/context/authoring/parts/store/engines.md +25 -0
  501. package/systems/fs/context/authoring/parts/store/migrations.md +53 -0
  502. package/systems/fs/context/authoring/parts/store/moves.md +38 -0
  503. package/systems/fs/context/authoring/parts/store/placement.md +25 -0
  504. package/systems/fs/context/authoring/parts/store/serve.md +30 -0
  505. package/systems/fs/context/authoring/parts/store/store-tables.md +24 -0
  506. package/systems/fs/context/authoring/parts/store/vectors.md +32 -0
  507. package/systems/fs/context/authoring/parts/store/when-to-use.md +27 -0
  508. package/systems/fs/context/authoring/parts/store/work.md +37 -0
  509. package/systems/fs/context/authoring/parts/store.md +65 -0
  510. package/systems/fs/context/authoring/parts/store.reference.md +459 -0
  511. package/systems/fs/context/authoring/parts/testing.md +14 -1
  512. package/systems/fs/context/authoring/parts/testing.reference/{memoryjournal.md → equal.md} +55 -48
  513. package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +26 -45
  514. package/systems/fs/context/authoring/parts/testing.reference/{toolcall.md → kindprops.md} +111 -4
  515. package/systems/fs/context/authoring/parts/testing.reference/openmemorystore.md +105 -0
  516. package/systems/fs/context/authoring/parts/testing.reference.md +16 -9
  517. package/systems/fs/context/authoring/parts/widgets.md +5 -1
  518. package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +4 -0
  519. package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +4 -0
  520. package/systems/fs/context/authoring/parts/widgets.reference.md +4 -0
  521. package/systems/fs/context/authoring/topics/begin.md +4 -0
  522. package/systems/fs/context/authoring/topics/client.md +4 -0
  523. package/systems/fs/context/authoring/topics/declare.md +4 -0
  524. package/systems/fs/context/authoring/topics/examples.md +4 -0
  525. package/systems/fs/context/authoring/topics/fns.md +4 -0
  526. package/systems/fs/context/authoring/topics/server.md +4 -0
  527. package/systems/fs/context/authoring/topics/types.md +8 -1
  528. package/systems/fs/context/comments/answer.md +21 -0
  529. package/systems/fs/context/comments/find.md +23 -0
  530. package/systems/fs/context/comments/read.md +26 -0
  531. package/systems/fs/context/comments.md +23 -0
  532. package/systems/fs/context/files-page.md +30 -0
  533. package/systems/fs/context/guide/attachments.md +16 -0
  534. package/systems/fs/context/guide/change.md +23 -0
  535. package/systems/fs/context/guide/commands.md +19 -0
  536. package/systems/fs/context/guide/documents.md +21 -0
  537. package/systems/fs/context/guide/find.md +25 -0
  538. package/systems/fs/context/guide/paths.md +24 -0
  539. package/systems/fs/context/guide/read.md +21 -0
  540. package/systems/fs/context/machine/history.md +25 -0
  541. package/systems/fs/context/machine/now.md +25 -0
  542. package/systems/fs/context/machine/processes.md +20 -0
  543. package/systems/fs/context/machine/recording.md +19 -0
  544. package/systems/fs/context/machine.md +24 -0
  545. package/systems/fs/package.json +5 -3
  546. package/systems/fs/server/files-page/browse.ts +391 -0
  547. package/systems/fs/server/files-page/comments.ts +439 -0
  548. package/systems/fs/server/files-page/fns.ts +158 -0
  549. package/systems/fs/server/files-page/git-view.ts +391 -0
  550. package/systems/fs/server/files-page/kinds.ts +56 -0
  551. package/systems/fs/server/impl.ts +66 -7
  552. package/systems/fs/server/main.ts +20 -4
  553. package/systems/fs/server/metrics/collector.ts +424 -0
  554. package/systems/fs/server/metrics/index.ts +181 -0
  555. package/systems/fs/server/metrics/os.ts +144 -0
  556. package/systems/fs/server/metrics/parsers.ts +268 -0
  557. package/systems/fs/server/metrics/rrd.ts +363 -0
  558. package/systems/fs/server/metrics/testing.ts +80 -0
  559. package/systems/fs/server/snapshots.ts +216 -33
  560. package/systems/fs/server/testing.ts +15 -9
  561. package/systems/fs/shared/files-page.ts +506 -0
  562. package/systems/fs/shared/index.ts +137 -10
  563. package/systems/fs/shared/metrics.ts +179 -0
  564. package/systems/fs/system.json +10 -1
  565. package/systems/google-calendar/package.json +1 -1
  566. package/systems/input/package.json +3 -3
  567. package/systems/mcp/package.json +3 -3
  568. package/systems/mcp/server/oauth.ts +1 -1
  569. package/systems/ollama/package.json +3 -3
  570. package/systems/schedule/package.json +3 -4
  571. package/systems/schedule/server/env.ts +1 -1
  572. package/systems/schedule/server/fns.ts +5 -4
  573. package/systems/schedule/server/impl.ts +2 -2
  574. package/systems/schedule/server/import.ts +189 -0
  575. package/systems/schedule/server/index.ts +2 -0
  576. package/systems/schedule/server/main.ts +3 -1
  577. package/systems/schedule/server/placements.ts +41 -0
  578. package/systems/schedule/server/store.ts +159 -79
  579. package/systems/schedule/server/timer.ts +142 -107
  580. package/systems/schedule/shared/index.ts +2 -1
  581. package/systems/schedule/system.json +5 -1
  582. package/systems/schedule/tsconfig.json +1 -1
  583. package/systems/template/package.json +1 -1
  584. package/systems/widgets/package.json +3 -3
  585. package/packages/web/dist/assets/ChatPage-7Yebk7rl.js +0 -4
  586. package/packages/web/dist/assets/ContextItemPage-B6rJG3OT.js +0 -2
  587. package/packages/web/dist/assets/ContextItemPage-BRsWxOmu.css +0 -1
  588. package/packages/web/dist/assets/ContextPage-CloIZ_2y.js +0 -2
  589. package/packages/web/dist/assets/ContextPage-rYKxjiVI.css +0 -1
  590. package/packages/web/dist/assets/ContextRow-Byz_7HG-.css +0 -1
  591. package/packages/web/dist/assets/ContextRow-Dvv8CTFk.js +0 -2
  592. package/packages/web/dist/assets/DataTypePage-Ba_zBV4b.js +0 -4
  593. package/packages/web/dist/assets/FnView-B8MGAOoB.js +0 -2
  594. package/packages/web/dist/assets/InstallDialog-C9GDoUI2.js +0 -2
  595. package/packages/web/dist/assets/InstanceTypes-D8Jcxn70.js +0 -2
  596. package/packages/web/dist/assets/InstanceTypes-DAowwLB7.css +0 -1
  597. package/packages/web/dist/assets/InstanceView-CuBD3JPU.css +0 -1
  598. package/packages/web/dist/assets/InstanceView-p7tMaylE.js +0 -2
  599. package/packages/web/dist/assets/LimitsView-DsZG6u5P.js +0 -2
  600. package/packages/web/dist/assets/ListSearch-BK4p7Nxa.js +0 -2
  601. package/packages/web/dist/assets/McpServerView-CD8qw6W_.js +0 -2
  602. package/packages/web/dist/assets/McpServersView-DNycG35u.js +0 -2
  603. package/packages/web/dist/assets/ModelsView-C_iN19xt.js +0 -2
  604. package/packages/web/dist/assets/PairPage-Bs2KuRjC.css +0 -1
  605. package/packages/web/dist/assets/PairPage-TEXPpsqi.js +0 -2
  606. package/packages/web/dist/assets/PoliciesView-BU1fudNF.js +0 -2
  607. package/packages/web/dist/assets/ResourcesPage-YluNBqIv.js +0 -2
  608. package/packages/web/dist/assets/ReviewView-79Z5rU1v.js +0 -3
  609. package/packages/web/dist/assets/RunsView-Dz9Xsvu5.js +0 -2
  610. package/packages/web/dist/assets/ServiceRows-DNzDiutg.js +0 -2
  611. package/packages/web/dist/assets/SettingsPage-CykfuYj1.js +0 -3
  612. package/packages/web/dist/assets/SystemView-Es5wtkYU.js +0 -2
  613. package/packages/web/dist/assets/SystemsView-CeuSFhlF.js +0 -2
  614. package/packages/web/dist/assets/UserMessage-qyc8dG5D.js +0 -9
  615. package/packages/web/dist/assets/WidgetView-BZyDyYRI.js +0 -3
  616. package/packages/web/dist/assets/index-Bv42jNvr.js +0 -4
  617. package/packages/web/dist/assets/routes-qP_j74V5.js +0 -4
  618. package/packages/web/dist/assets/runs-k76usGfd.js +0 -2
  619. package/packages/web/dist/assets/src-DLK1P7oz.js +0 -43
  620. package/packages/web/dist/assets/state-CjE-qA2w.js +0 -2
  621. package/packages/web/dist/assets/ui-W12UYhVu.js +0 -17
  622. package/systems/claude/client/FleetPage.vue +0 -132
  623. package/systems/claude/client/NewSessionForm.vue +0 -62
  624. package/systems/claude/client/SessionList.vue +0 -64
  625. package/systems/claude/client/SessionPage.vue +0 -199
  626. package/systems/claude/client/TaskList.vue +0 -61
  627. package/systems/claude/client/fakes.ts +0 -186
  628. package/systems/claude/client/host.ts +0 -23
  629. package/systems/claude/client/index.ts +0 -15
  630. package/systems/claude/client/logic.ts +0 -270
  631. package/systems/claude/client/state.ts +0 -344
  632. package/systems/claude/package.json +0 -23
  633. package/systems/claude/server/agent-sdk.ts +0 -379
  634. package/systems/claude/server/driver.ts +0 -153
  635. package/systems/claude/server/env.ts +0 -64
  636. package/systems/claude/server/fake-driver.ts +0 -112
  637. package/systems/claude/server/fleet.ts +0 -376
  638. package/systems/claude/server/impl.ts +0 -568
  639. package/systems/claude/server/index.ts +0 -8
  640. package/systems/claude/server/main.ts +0 -38
  641. package/systems/claude/server/preview.ts +0 -76
  642. package/systems/claude/server/questions.ts +0 -117
  643. package/systems/claude/server/transcript.ts +0 -83
  644. package/systems/claude/shared/index.ts +0 -262
  645. package/systems/claude/shared/session.ts +0 -284
  646. package/systems/claude/shared/shapes.ts +0 -106
  647. package/systems/claude/system.json +0 -18
  648. package/systems/claude/tsconfig.json +0 -6
  649. package/systems/database/package.json +0 -25
  650. package/systems/database/server/author.ts +0 -41
  651. package/systems/database/server/authoring.ts +0 -322
  652. package/systems/database/server/catalog.ts +0 -117
  653. package/systems/database/server/compile.ts +0 -332
  654. package/systems/database/server/dialects.ts +0 -17
  655. package/systems/database/server/drivers/database.ts +0 -71
  656. package/systems/database/server/drivers/index.ts +0 -23
  657. package/systems/database/server/drivers/postgres.ts +0 -157
  658. package/systems/database/server/drivers/sqlite.ts +0 -151
  659. package/systems/database/server/drivers/sqlserver.ts +0 -176
  660. package/systems/database/server/env.ts +0 -35
  661. package/systems/database/server/fixture.ts +0 -169
  662. package/systems/database/server/impl.ts +0 -793
  663. package/systems/database/server/index.ts +0 -7
  664. package/systems/database/server/instance.ts +0 -398
  665. package/systems/database/server/main.ts +0 -47
  666. package/systems/database/server/pick.ts +0 -97
  667. package/systems/database/server/queries.ts +0 -390
  668. package/systems/database/server/results.ts +0 -39
  669. package/systems/database/server/schema.ts +0 -59
  670. package/systems/database/server/table-fns.ts +0 -237
  671. package/systems/database/server/types.ts +0 -253
  672. package/systems/database/shared/index.ts +0 -544
  673. package/systems/database/shared/shapes.ts +0 -413
  674. package/systems/database/system.json +0 -14
  675. package/systems/database/tsconfig.json +0 -6
  676. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-371-533.md +0 -183
  677. package/systems/fs/context/authoring/parts/hub/hub-auto-pair-revoke.md +0 -189
  678. package/systems/web/client/ReadView.vue +0 -110
  679. package/systems/web/client/SearchView.vue +0 -215
  680. package/systems/web/client/StatusChip.vue +0 -38
  681. package/systems/web/client/fakes.ts +0 -48
  682. package/systems/web/client/index.ts +0 -15
  683. package/systems/web/client/view.ts +0 -131
  684. package/systems/web/package.json +0 -22
  685. package/systems/web/server/chrome.ts +0 -121
  686. package/systems/web/server/crawl.ts +0 -333
  687. package/systems/web/server/env.ts +0 -63
  688. package/systems/web/server/guard.ts +0 -60
  689. package/systems/web/server/http.ts +0 -89
  690. package/systems/web/server/impl.ts +0 -203
  691. package/systems/web/server/index.ts +0 -71
  692. package/systems/web/server/loader.ts +0 -104
  693. package/systems/web/server/main.ts +0 -70
  694. package/systems/web/server/mentions.ts +0 -111
  695. package/systems/web/server/problem.ts +0 -72
  696. package/systems/web/server/renderer.ts +0 -243
  697. package/systems/web/server/robots.ts +0 -75
  698. package/systems/web/server/searches.ts +0 -29
  699. package/systems/web/server/tavily.ts +0 -144
  700. package/systems/web/server/testing.ts +0 -165
  701. package/systems/web/server/uploads.ts +0 -33
  702. package/systems/web/shared/index.ts +0 -343
  703. package/systems/web/shared/urls.ts +0 -60
  704. package/systems/web/system.json +0 -15
  705. package/systems/web/tsconfig.json +0 -6
@@ -16,7 +16,7 @@
16
16
  * (`niches`), so an ordinary request finds the fns and guides it needs first; it stays searchable. A model's search
17
17
  * (`Asker.forModel`) never finds a fn whose visibility leaves the model out, since it could never load it.
18
18
  */
19
- import { contextOff, effectsLine, nicheOf, QualifiedName, slashedName, typeMatches, type SystemName, type ContextRecord, type Filter, type IndexedKind, type SearchSection, type RegistryEffect, type FnRecord, type FnSearchHit, type FnSearchPage, type FnSearchQuery, type RowOf, type SearchHit, type SearchItemKind } from '@harness/core';
19
+ import { effectsLine, hitAnswer, modelSeesContext, searchStatuses, nicheOf, QualifiedName, slashedName, typeMatches, type SystemName, type ContextRecord, type Filter, type IndexedKind, type SearchSection, type RegistryEffect, type FnRecord, type FnSearchHit, type FnSearchPage, type FnSearchQuery, type RowOf, type SearchHit, type SearchItemKind } from '@harness/core';
20
20
  import type { Catalog } from '../catalog/index.ts';
21
21
  import type { AccessService } from '../access/index.ts';
22
22
  import { seesContextAs } from '../access/scope.ts';
@@ -67,6 +67,21 @@ function contextOnly(query: FnSearchQuery): boolean {
67
67
  return query.filters !== undefined || query.scopes !== undefined;
68
68
  }
69
69
 
70
+ /**
71
+ * Whether a query finds a context item by its status (plan `context-questions`): with `off` (the context page's list)
72
+ * every item but an open plan question; otherwise not one switched off with its system, and only the query's statuses
73
+ * (`searchStatuses`: active and pending removal unless it says, plus not applicable when asked). A `pending_plan`
74
+ * question is never found here (only `hub/ctx_plan`'s own matching, `questions/plan-match.ts`, sees them). For a model
75
+ * (`forModel`), never what a model may not see (`modelSeesContext`: hidden, pending approval, a not-applicable item
76
+ * with no answer).
77
+ */
78
+ function contextWanted(query: FnSearchQuery, record: ContextRecord, forModel: boolean): boolean {
79
+ if (record.status === 'pending_plan') return false;
80
+ if (forModel && !modelSeesContext(record)) return false;
81
+ if (query.off === true) return true;
82
+ return record.systemOff !== true && searchStatuses(query).has(record.status);
83
+ }
84
+
70
85
  /** Whether a context item is a memory of one of the query's scopes, when the query names any. */
71
86
  function inScopes(query: FnSearchQuery, record: ContextRecord): boolean {
72
87
  return query.scopes === undefined || (record.origin?.type === 'memory' && query.scopes.includes(record.origin.scope.to));
@@ -148,7 +163,7 @@ export class StoreFnSearch implements FnSearch {
148
163
  const filters = contextFilters(query);
149
164
  for (let offset = 0; out.length < most; offset += CONTEXT_PAGE) {
150
165
  const page = await store.lists.find({ table: 'context', fields: CONTEXT_COLUMNS, filters, keys: query.names, sort: [{ field: 'name', dir: 'asc' }], offset, limit: CONTEXT_PAGE });
151
- for (const row of page.items) if (query.off === true || !contextOff(row)) out.push(row.name);
166
+ for (const row of page.items) if (contextWanted(query, row, false)) out.push(row.name);
152
167
  if (page.items.length < CONTEXT_PAGE) return out.length < most ? out : undefined;
153
168
  }
154
169
  return undefined;
@@ -217,6 +232,7 @@ export class StoreFnSearch implements FnSearch {
217
232
  text, kinds: indexKinds(items), limit: pool,
218
233
  ...(candidates === undefined ? {} : { within: await this.#within(candidates) }),
219
234
  ...(query.match === undefined ? {} : { match: query.match }),
235
+ ...(query.semanticOver === undefined ? {} : { semanticOver: query.semanticOver }),
220
236
  ...(query.systems === undefined ? {} : { systems: query.systems }),
221
237
  keep: async (hit) => {
222
238
  const kind = hit.kind === 'contextSection' ? 'context' : hit.kind;
@@ -252,7 +268,7 @@ export class StoreFnSearch implements FnSearch {
252
268
  for await (const row of rows(store.table('fnFacts'), { order: [['fn', 'asc']] })) if (await take({ kind: 'fn', key: row.fn })) return out;
253
269
  }
254
270
  if (items.includes('context')) {
255
- for await (const row of rows(store.table('context'), { order: [['name', 'asc']] })) if ((query.off === true || !contextOff(row)) && await take({ kind: 'context', key: row.name })) return out;
271
+ for await (const row of rows(store.table('context'), { order: [['name', 'asc']] })) if (contextWanted(query, row, false) && await take({ kind: 'context', key: row.name })) return out;
256
272
  }
257
273
  return out;
258
274
  }
@@ -263,7 +279,7 @@ export class StoreFnSearch implements FnSearch {
263
279
  const catalog = this.#deps.catalog();
264
280
  if (candidate.kind === 'context') {
265
281
  const record = await catalog.context(candidate.key);
266
- if (record === undefined || (query.off !== true && contextOff(record)) || !inScopes(query, record) || !seesContextAs(asker.access, record, asker.session)) return undefined;
282
+ if (record === undefined || !contextWanted(query, record, asker.forModel === true) || !inScopes(query, record) || !seesContextAs(asker.access, record, asker.session)) return undefined;
267
283
  return contextHit(record, found);
268
284
  }
269
285
  const record = await catalog.fn(candidate.key);
@@ -307,9 +323,12 @@ export class StoreFnSearch implements FnSearch {
307
323
  function contextHit(record: ContextRecord, found: Scored | undefined): FnSearchHit {
308
324
  const section = found?.section === undefined ? undefined : sectionOf(record, found.section);
309
325
  const niche = nicheOf(record.decl);
326
+ const answer = hitAnswer(record);
310
327
  return {
311
328
  item: 'context', name: record.name, system: record.system, description: record.decl.description, ...scoresOf(found),
312
329
  ...(section === undefined ? {} : { section }), ...(niche === undefined ? {} : { niche }), available: true,
330
+ ...(record.decl.question === undefined ? {} : { question: record.decl.question }), ...(answer === undefined ? {} : { answer }),
331
+ ...(record.status === 'active' ? {} : { status: record.status, ...(record.statusReason === undefined ? {} : { statusReason: record.statusReason }) }),
313
332
  };
314
333
  }
315
334
 
@@ -18,7 +18,7 @@
18
18
  import { reject } from '@ayepi/core';
19
19
  import {
20
20
  fieldOf, GRAPH_EDGE_VERBS, GraphNodeKind, LIST_FIELDS, QualifiedName, queryProblems, splitName, SystemName,
21
- linkTargetKey, type Filter,
21
+ contextOff, linkTargetKey, type Filter,
22
22
  type Audience, type ContextLink, type ContextRecord, type FnFactsRecord, type FnRecord, type FnTypeUse, type FnUse, type GraphEdge, type GraphEdgeKind, type GraphMore, type GraphNode, type GraphNodeId,
23
23
  type GraphPage, type GraphQuery, type InstanceRecord, type KindRecord, type LinkRelation, type Manifest, type SystemRecord, type TypeRecord,
24
24
  } from '@harness/core';
@@ -531,7 +531,7 @@ function fnNode(fn: FnRecord, facts: FnFactsRecord | undefined, examples: number
531
531
 
532
532
  /** A context item's node; the hub's own (memories, resources) have no system. */
533
533
  function contextNode(item: ContextRecord, stage: GraphNode['facts']['stage'], pending: boolean): GraphNode {
534
- const off = item.disabled === true || item.systemOff === true;
534
+ const off = contextOff(item);
535
535
  return {
536
536
  id: nodeId('context', item.name), kind: 'context', name: item.name, about: item.decl.description, ...(item.system === HUB_SYSTEM ? {} : { system: item.system }), external: false,
537
537
  facts: { visibility: item.decl.suggest, on: !off, ...(stage === undefined ? {} : { stage }), ...(pending ? { pending: true } : {}) },
@@ -13,7 +13,7 @@
13
13
  import type {
14
14
  ConvertedVersion, EmbedderAbilities, EmbedImage, EmbedInput, FormKind, IndexedKind, IndexStatus, QualifiedName, ResourceLink, ResourceRoot, ResourceStat, ResourceUri, SearchHit, SectionDiff, SessionId, SystemName,
15
15
  } from '@harness/core';
16
- import type { Suggestion } from '@harness/core';
16
+ import type { SemanticOver, Suggestion } from '@harness/core';
17
17
  import type { EmbedLane } from './batch.ts';
18
18
 
19
19
  /** An embed function: one vector per input (a text, or an image for one that embeds images), in order. */
@@ -56,8 +56,10 @@ export interface IndexItem {
56
56
  readonly kind: IndexedKind;
57
57
  readonly key: string;
58
58
  readonly text: string;
59
+ /** What is embedded when it isn't `text` (`IndexEntry.embedText`: a context item's question). */
60
+ readonly embedText?: string;
59
61
  readonly system?: SystemName;
60
- /** The item this one is a part of (a `contextSection`'s context item, an `image`'s context item). */
62
+ /** The item this one is a part of (a `contextSection`'s, `contextContent`'s or `image`'s context item). */
61
63
  readonly parent?: string;
62
64
  /**
63
65
  * An `image` item's picture: `source` the resource URI whose bytes are embedded, or the http(s) URL a context item
@@ -133,6 +135,11 @@ export interface SearchQuery {
133
135
  readonly excludeKeys?: readonly string[];
134
136
  /** Words, meaning, or both (the default). */
135
137
  readonly match?: 'text' | 'semantic' | 'hybrid';
138
+ /**
139
+ * What meaning compares the query with for context items: their `embedding` (of the question; the default) or their
140
+ * `contentEmbedding` (the `contextContent` rows, found as their items).
141
+ */
142
+ readonly semanticOver?: SemanticOver;
136
143
  /**
137
144
  * Search by a picture: it is embedded in the image space and compared with the images there (and with the text too
138
145
  * when the space is shared). Nothing is found by meaning without an image space. `text` may still add words.
@@ -74,7 +74,10 @@ export interface IndexerOptions {
74
74
  export const MAX_PICTURE_BYTES = 5_000_000;
75
75
 
76
76
  /** The kinds that are parts of a context item (`IndexEntry.parent`): found, kept current and dropped with it. */
77
- const CONTEXT_PARTS = ['contextSection', 'image'] as const satisfies readonly IndexedKind[];
77
+ const CONTEXT_PARTS = ['contextSection', 'image', 'contextContent'] as const satisfies readonly IndexedKind[];
78
+
79
+ /** The kinds kept only as vectors, never in the full-text index (a context item's words are its `context` row's). */
80
+ const VECTOR_ONLY: ReadonlySet<IndexedKind> = new Set<IndexedKind>(['contextContent']);
78
81
 
79
82
  /** The kinds of index rows embedded as text, in the text space (every kind but pictures). */
80
83
  const TEXT_KINDS = INDEXED_KINDS.filter((kind) => kind !== 'image');
@@ -92,9 +95,14 @@ export function imageVectorHash(hash: string, space: QualifiedName): string {
92
95
  return `${imageVectorPrefix(space)}${hash}`;
93
96
  }
94
97
 
95
- /** An item's hash: its text's, and for a picture its source and version too (a new picture is embedded again). */
96
- function itemHash(text: string, item: Pick<IndexItem, 'image'>): string {
97
- return sha256Hex(item.image === undefined ? text : `${text}\n${item.image.source}\n${item.image.version ?? ''}`);
98
+ /**
99
+ * An item's hash: its text's, with what it embeds instead when that differs (a context item's question), and for a
100
+ * picture its source and version too (a new picture is embedded again).
101
+ */
102
+ function itemHash(text: string, item: Pick<IndexItem, 'image' | 'embedText'>): string {
103
+ // an embed text that is the text itself hashes as the text alone, so rows indexed before it existed stay current
104
+ const embedded = item.embedText === undefined || item.embedText === text ? text : `${text}\n\u0000${item.embedText}`;
105
+ return sha256Hex(item.image === undefined ? embedded : `${embedded}\n${item.image.source}\n${item.image.version ?? ''}`);
98
106
  }
99
107
 
100
108
  /** How many rows a loop of store calls handles before it gives way to the event loop. */
@@ -116,11 +124,36 @@ export function fnText(name: string, decl: FnDecl): string {
116
124
  return [`${name}: ${decl.description}`, decl.instructions, decl.tags.length > 0 ? `Tags: ${decl.tags.join(', ')}` : undefined].filter((l) => l !== undefined).join('\n');
117
125
  }
118
126
 
119
- /** Context's indexed text: its description and content. */
120
- export function contextText(name: string, decl: ContextDecl): string {
127
+ /** Context's content as indexed and embedded (`contentEmbedding`): its description, `/command` and content. */
128
+ export function contextContentText(name: string, decl: ContextDecl): string {
121
129
  return [`${name}: ${decl.description}`, decl.command === undefined ? undefined : `/${decl.command.name}`, decl.content].filter((l) => l !== undefined).join('\n');
122
130
  }
123
131
 
132
+ /** Context's indexed text, which words find: its question, when it applies, then its content (`contextContentText`). */
133
+ export function contextText(name: string, decl: ContextDecl): string {
134
+ const content = contextContentText(name, decl);
135
+ const lead = [decl.question === undefined ? undefined : `Question: ${decl.question}`, decl.when === undefined ? undefined : `When: ${decl.when}`].filter((l) => l !== undefined);
136
+ // the heading sections are cut from the text, so the question goes after the first line (the name and description)
137
+ if (lead.length === 0) return content;
138
+ const at = content.indexOf('\n');
139
+ return at < 0 ? [content, ...lead].join('\n') : [content.slice(0, at), ...lead, content.slice(at + 1)].join('\n');
140
+ }
141
+
142
+ /**
143
+ * A context item's index items: its `context` row (words over `contextText`; its vector, the `embedding`, of its
144
+ * question, or of its content when it has none) and its `contextContent` row (no words; its vector, the
145
+ * `contentEmbedding`, always of its content). Without a question both embed the same text, so the two vectors are the
146
+ * same (one embedding call: `#embedInto` embeds equal inputs once). Both are re-embedded when either text changes.
147
+ */
148
+ export function contextIndexItems(name: string, decl: ContextDecl, system: SystemName | undefined): IndexItem[] {
149
+ const content = contextContentText(name, decl);
150
+ const own = system === undefined ? {} : { system };
151
+ return [
152
+ { kind: 'context', key: name, text: contextText(name, decl), embedText: decl.question ?? content, ...own },
153
+ { kind: 'contextContent', key: name, text: content, parent: name, ...own },
154
+ ];
155
+ }
156
+
124
157
  /** A named type's indexed text. */
125
158
  export function typeText(record: TypeRecord): string {
126
159
  return `${record.name} (${record.display.label}): ${record.description}`;
@@ -248,11 +281,13 @@ export class StoreIndexer implements Indexer {
248
281
  for (const [index, item] of items.entries()) {
249
282
  await breathe(index);
250
283
  const text = item.text.slice(0, maxText);
251
- const hash = itemHash(text, item);
284
+ const embedText = item.embedText?.slice(0, maxText);
285
+ const hash = itemHash(text, { ...item, ...(embedText === undefined ? {} : { embedText }) });
252
286
  const existing = await store.table('index').get({ embedder: document, kind: item.kind, key: item.key });
253
287
  if (existing?.hash === hash) { if (this.#waiting(existing)) { rows.push(existing); } continue; }
254
288
  rows.push(await store.table('index').put({
255
289
  kind: item.kind, key: item.key, text, hash, embedder: document, updatedAt: clock(),
290
+ ...(embedText === undefined || embedText === text ? {} : { embedText }),
256
291
  ...(item.system === undefined ? {} : { system: item.system }),
257
292
  ...(item.parent === undefined ? {} : { parent: item.parent }),
258
293
  ...(item.image === undefined ? {} : { image: item.image.source }),
@@ -260,7 +295,7 @@ export class StoreIndexer implements Indexer {
260
295
  }));
261
296
  }
262
297
  if (rows.length === 0) { return; }
263
- await store.text.upsert(rows.map((r) => ({ kind: r.kind, key: r.key, text: r.text })));
298
+ await store.text.upsert(rows.filter((r) => !VECTOR_ONLY.has(r.kind)).map((r) => ({ kind: r.kind, key: r.key, text: r.text })));
264
299
  const embedding = this.#embed(rows.filter((r) => this.#waiting(r)));
265
300
  // `#embed` logs its own failures, so a background embedding never rejects
266
301
  if (options.vectors === 'background') { void embedding; return; }
@@ -288,16 +323,20 @@ export class StoreIndexer implements Indexer {
288
323
  }
289
324
 
290
325
  /**
291
- * Index the heading sections of every context item that has headings but none of its sections indexed yet (an item
292
- * indexed before sections were), read a page at a time; each item is asked of the database by its first section.
326
+ * Index the parts of every context item that has some not indexed yet (an item indexed by an older hub): its heading
327
+ * sections, when it has headings but its first isn't indexed, and its `contextContent` row (its second vector), read a
328
+ * page at a time; each item is asked of the database by its first section and its content row.
293
329
  */
294
330
  async catchUpSections(): Promise<void> {
295
331
  const { store, document } = this.#options;
296
332
  const missing: IndexItem[] = [];
297
333
  for await (const record of storedRows(store.table('context'))) {
298
- const item: IndexItem = { kind: 'context', key: record.name, text: contextText(record.name, record.decl), system: record.system };
299
- const first = contextSectionItems(item)[0];
300
- if (first !== undefined && (await store.table('index').get({ embedder: document, kind: 'contextSection', key: first.key })) === undefined) { missing.push(item); }
334
+ const items = contextIndexItems(record.name, record.decl, record.system);
335
+ const first = items.flatMap((item) => contextSectionItems(item))[0];
336
+ const index = store.table('index');
337
+ const noSections = first !== undefined && (await index.get({ embedder: document, kind: 'contextSection', key: first.key })) === undefined;
338
+ const noContent = (await index.get({ embedder: document, kind: 'contextContent', key: record.name })) === undefined;
339
+ if (noSections || noContent) { missing.push(...items); }
301
340
  if (missing.length >= SECTION_CATCH_UP) { await this.upsert(missing.splice(0), { vectors: 'background' }); }
302
341
  }
303
342
  if (missing.length > 0) { await this.upsert(missing, { vectors: 'background' }); }
@@ -390,7 +429,7 @@ export class StoreIndexer implements Indexer {
390
429
  const { store, catalog, document } = this.#options;
391
430
  const items: IndexItem[] = [
392
431
  ...(await catalog.fns({ system })).map((fn): IndexItem => ({ kind: 'fn', key: fn.name, text: fnText(fn.name, fn.decl), system })),
393
- ...(await allRows(store.table('context'), { where: { system } })).map((c): IndexItem => ({ kind: 'context', key: c.name, text: contextText(c.name, c.decl), system })),
432
+ ...(await allRows(store.table('context'), { where: { system } })).flatMap((c) => contextIndexItems(c.name, c.decl, system)),
394
433
  ...(await allRows(store.table('types'), { where: { system } })).map((t): IndexItem => ({ kind: 'type', key: t.name, text: typeText(t), system })),
395
434
  ];
396
435
  await this.upsert(items);
@@ -498,7 +537,7 @@ export class StoreIndexer implements Indexer {
498
537
  try {
499
538
  if (active !== undefined && texts.length > 0) {
500
539
  await this.#sized(active.document.dimensions);
501
- await this.#embedInto(texts, active.document, document, (row) => Promise.resolve(row.text), progress);
540
+ await this.#embedInto(texts, active.document, document, (row) => Promise.resolve(row.embedText ?? row.text), progress);
502
541
  }
503
542
  if (space !== undefined && pictures.length > 0) {
504
543
  await this.#sizedImages(space);
@@ -530,7 +569,19 @@ export class StoreIndexer implements Indexer {
530
569
  const read = (await Promise.all(part.map(async (row) => ({ row, input: await input(row) }))))
531
570
  .filter((entry): entry is { row: IndexEntry; input: EmbedInput } => entry.input !== undefined);
532
571
  if (read.length > 0) {
533
- const vectors = await batcher.embed(name, read.map((entry) => entry.input), 'background');
572
+ // equal text inputs are embedded once (a context item without a question: its two vectors are one)
573
+ const unique = new Map<string, number>();
574
+ const inputs: EmbedInput[] = [];
575
+ const slot = read.map(({ input }) => {
576
+ if (typeof input !== 'string') { inputs.push(input); return inputs.length - 1; }
577
+ const seen = unique.get(input);
578
+ if (seen !== undefined) { return seen; }
579
+ inputs.push(input);
580
+ unique.set(input, inputs.length - 1);
581
+ return inputs.length - 1;
582
+ });
583
+ const embedded = await batcher.embed(name, inputs, 'background');
584
+ const vectors = slot.map((at) => embedded[at]);
534
585
  const good = read.flatMap(({ row }, i) => {
535
586
  const vector = vectors[i];
536
587
  if (vector?.length === dimensions) { return [{ row, vector }]; }
@@ -71,6 +71,7 @@ export class IndexSearch implements Search {
71
71
  ...(query.within === undefined ? {} : { within: query.within }), ...(query.prefix === undefined ? {} : { prefix: query.prefix }),
72
72
  ...(query.excludeKeys === undefined || query.excludeKeys.length === 0 ? {} : { excludeKeys: query.excludeKeys }),
73
73
  ...(query.match === undefined ? {} : { match: query.match }),
74
+ ...(query.semanticOver === undefined ? {} : { semanticOver: query.semanticOver }),
74
75
  };
75
76
  const lists = await Promise.all((await this.#spaces(query)).map((ask) => this.#ask(ask, words, query)));
76
77
  // two spaces' lists, each fused on its own, merge by rank (a share of each list's best, so the two compare)
@@ -4,7 +4,7 @@
4
4
  * similarities of meaning, so a threshold can tell a fit from noise: while the query can't be embedded (no embedder,
5
5
  * or one too busy to answer in time) nothing is suggested, rather than whatever the words ranked first.
6
6
  */
7
- import { QualifiedName, splitName, type SessionId, type Suggestion } from '@harness/core';
7
+ import { contextOff, QualifiedName, splitName, type SessionId, type Suggestion } from '@harness/core';
8
8
  import { HUB_SYSTEM } from '../catalog/availability.ts';
9
9
  import type { Catalog } from '../catalog/index.ts';
10
10
  import type { HubStore } from '../store/index.ts';
@@ -59,7 +59,7 @@ export class IndexSuggester implements Suggester {
59
59
 
60
60
  async #context(name: QualifiedName, score: number): Promise<Suggestion | undefined> {
61
61
  const context = await this.#catalog.context(name);
62
- if (context === undefined || context.decl.suggest === 'none' || (await this.#catalog.availability(name)) !== true) { return undefined; }
62
+ if (context === undefined || contextOff(context) || context.decl.suggest === 'none' || (await this.#catalog.availability(name)) !== true) { return undefined; }
63
63
  return { kind: 'context', name, description: context.decl.description, score };
64
64
  }
65
65
  }
@@ -49,10 +49,16 @@ import { InstanceKeeper } from './status.ts';
49
49
  import { ConfigSecretKeeper, type ConfigVault } from './config-secrets.ts';
50
50
  import { ProcessSupervisor, grantedNetwork } from './supervisor.ts';
51
51
  import { StoreSystemAdmin } from './systems.ts';
52
+ import { SystemStoreHost } from '../stores/host.ts';
53
+ import { storesLinkPlugin } from '../stores/plugin.ts';
54
+ import { StoreBackups } from '../stores/backups.ts';
55
+ import { StoreMoves, type MoveRuns } from '../stores/moves.ts';
56
+ import { SystemStores } from '../stores/service.ts';
57
+ import { StoreDrivers, type DriverInstaller } from '../stores/drivers.ts';
52
58
 
53
59
  /** The settings the system side reads, from the env slices. */
54
60
  export interface SystemsSettings {
55
- readonly hub: Pick<HubSettings['hubEnv'], 'HARNESS_URL' | 'HARNESS_SYSTEMS_DIR'>;
61
+ readonly hub: Pick<HubSettings['hubEnv'], 'HARNESS_URL' | 'HARNESS_SYSTEMS_DIR' | 'HARNESS_STORES_DIR' | 'HARNESS_STORE_DRIVERS_DIR'>;
56
62
  readonly link: HubSettings['linkEnv'];
57
63
  readonly packaging: PackagingEnv;
58
64
  readonly model: Pick<HubSettings['modelEnv'], 'HARNESS_EMBEDDER_DOCUMENT' | 'HARNESS_EMBEDDER_QUERY' | 'HARNESS_EMBED_BATCH'>;
@@ -73,6 +79,8 @@ export interface SystemsOptions {
73
79
  readonly launcher: ProcessStarter;
74
80
  /** How systems are fetched (default: npm, git and package zips from `content`). */
75
81
  readonly installer?: Installer;
82
+ /** Installs the database drivers an external store needs (default: npm, as the installer installs a zip's externals). */
83
+ readonly driverInstaller?: DriverInstaller;
76
84
  /** The hub's content store, where uploaded package zips and data exports live (looked up when used). */
77
85
  readonly content: () => PackageContent;
78
86
  /** The hub's secrets, where config secret fields are sealed (the api module's, looked up when used). */
@@ -85,6 +93,8 @@ export interface SystemsOptions {
85
93
  readonly ai?: () => HubEmbeds | undefined;
86
94
  /** Plan item 7: whether a hub model role has a model set, for fns that need one (`CatalogOptions.roleSet`). */
87
95
  readonly roleSet?: CatalogOptions['roleSet'];
96
+ /** The hub's runs, as a store move drains them (the execution module's, looked up when a move starts). */
97
+ readonly runs?: () => MoveRuns | undefined;
88
98
  }
89
99
 
90
100
  /** The link URL systems connect to, from the hub's public URL. */
@@ -121,18 +131,39 @@ export function buildSystems(options: SystemsOptions) {
121
131
  });
122
132
  const config = new StoreConfigService({ log, clock, catalog, bus, links: connections, instances, secrets: configSecrets });
123
133
  const resources = new PeerResourceRouter({ links: connections, catalog, bus, log, maxChunk: settings.link.HARNESS_MAX_CHUNK });
124
- const admin = new StoreSystemAdmin({ store, log, catalog, links: connections, instances, autoPairs, stopTimeout: settings.link.HARNESS_STOP_TIMEOUT });
134
+ const admin = new StoreSystemAdmin({ store, log, catalog, links: connections, instances, autoPairs, stopTimeout: settings.link.HARNESS_STOP_TIMEOUT, storeBackups: () => storeBackups });
125
135
  const grants = new SystemGrantGuard({ store, catalog, bus, log, clock, admin: () => admin, settings: settings.review });
126
136
  const router = new FleetRouter({ links: connections, resources, store, instances });
127
- const installer = options.installer ?? new NodeInstaller({
137
+ const npmInstaller = new NodeInstaller({
128
138
  npm: settings.packaging.HARNESS_NPM, maxBytes: settings.packaging.HARNESS_PACKAGE_MAX, zips: { bytes: (hash) => contentBytes(options.content(), hash) },
129
139
  });
140
+ const installer = options.installer ?? npmInstaller;
141
+ // the Postgres and SQL Server drivers, installed when a store is placed in one (the base package leaves them out)
142
+ const drivers = new StoreDrivers({ dir: settings.hub.HARNESS_STORE_DRIVERS_DIR, installer: options.driverInstaller ?? npmInstaller, log });
143
+ // system stores: the files the hub keeps for stores placed on it, each instance's store state, and holding calls
144
+ const storeHost = new SystemStoreHost({ dir: settings.hub.HARNESS_STORES_DIR, log, clock, lease: settings.packaging.HARNESS_STORE_LEASE });
145
+ const stores = new SystemStores({
146
+ host: storeHost, catalog, instances, links: connections, vault: options.secrets, log, clock, hold: settings.packaging.HARNESS_STORE_HOLD, drivers,
147
+ });
148
+ connections.holdWith((ref, endpoint) => stores.hold(ref, endpoint));
149
+ // the catalog's own re-describing never waits on a store getting ready: that would wait on itself (`describer.ts`)
150
+ describer.unreachableWhile((ref) => stores.holding(ref));
151
+ // moving a store between placements, and its backups (old copies, and stores kept when an instance was removed)
152
+ const moves = new StoreMoves({
153
+ stores, host: storeHost, catalog, instances, links: connections, vault: options.secrets, log, clock, drain: settings.packaging.HARNESS_STORE_MOVE_DRAIN, drivers,
154
+ runs: () => {
155
+ const runs = options.runs?.();
156
+ if (runs === undefined) { throw new Error('the hub has no run service yet'); }
157
+ return runs;
158
+ },
159
+ });
160
+ const storeBackups = new StoreBackups({ host: storeHost, catalog, instances, links: connections, vault: options.secrets, log, clock });
130
161
  const relay = new SystemEventRelay({ bus, links: connections, catalog, log });
131
162
  const output = new MemorySystemOutput({ bus, clock });
132
163
  const supervisor = new ProcessSupervisor({
133
- store, log, clock, links: connections, pairing, config, instances, launcher: options.launcher, installer, network: grantedNetwork(grants, bus),
164
+ store, log, clock, links: connections, pairing, config, instances, launcher: options.launcher, installer, network: grantedNetwork(grants, bus), stores,
134
165
  settings: {
135
- systemsDir: settings.hub.HARNESS_SYSTEMS_DIR, hubLink: linkUrl(settings.hub.HARNESS_URL), stopTimeout: settings.link.HARNESS_STOP_TIMEOUT,
166
+ systemsDir: settings.hub.HARNESS_SYSTEMS_DIR, hubLink: linkUrl(settings.hub.HARNESS_URL), stopTimeout: settings.link.HARNESS_STOP_TIMEOUT, storeDrivers: drivers.dir,
136
167
  backoff: settings.link.HARNESS_RESTART_BACKOFF, perHour: settings.link.HARNESS_RESTARTS_PER_HOUR, maxBackoff: settings.link.HARNESS_RESTART_BACKOFF_MAX,
137
168
  },
138
169
  });
@@ -160,7 +191,7 @@ export function buildSystems(options: SystemsOptions) {
160
191
  const suggest = new IndexSuggester({ store, catalog, search });
161
192
 
162
193
  const packages = new HubPackages({
163
- content: options.content, supervisor, admin, instances, links: connections, config, exportTimeout: settings.link.HARNESS_STOP_TIMEOUT, log, clock,
194
+ content: options.content, supervisor, admin, instances, links: connections, config, exportTimeout: settings.link.HARNESS_STOP_TIMEOUT, log, clock, storeBackups: () => storeBackups,
164
195
  maxBytes: settings.packaging.HARNESS_PACKAGE_MAX,
165
196
  });
166
197
 
@@ -174,25 +205,30 @@ export function buildSystems(options: SystemsOptions) {
174
205
  helloTimeout: settings.link.HARNESS_LINK_HELLO_TIMEOUT, linkTimeout: settings.link.HARNESS_PAIRING_TIMEOUT,
175
206
  });
176
207
  const handshake = new LinkHandshake({
177
- log, clock, catalog, links: connections, pairing, autoPairs, config, instances, tokens, resources, output, lifecycle, grants, bus, address, pairingLimits, gate,
208
+ log, clock, catalog, links: connections, pairing, autoPairs, config, instances, tokens, resources, output, lifecycle, grants, bus, address, pairingLimits, gate, stores,
178
209
  limits: { maxFrame: settings.link.HARNESS_MAX_FRAME, maxChunk: settings.link.HARNESS_MAX_CHUNK, heartbeat: settings.link.HARNESS_HEARTBEAT },
179
210
  });
180
211
 
181
212
  let stopIndexer: (() => void) | undefined;
182
213
  let stopOutput: (() => void) | undefined;
183
214
  return {
184
- catalog, connections, pairing, autoPairs, config, instances, resources, admin, relay, supervisor, packages, router, handshake, output, lifecycle, grants, gate,
215
+ catalog, connections, pairing, autoPairs, config, instances, resources, admin, relay, supervisor, packages, router, handshake, output, lifecycle, grants, gate, stores, moves, storeBackups,
185
216
  index: { embedders, indexer, search, suggest, sectioning, batcher, images },
186
217
  /** The link plugin to install on the hub link server. */
187
218
  plugin: linkPlugin(handshake, { log, clock }),
219
+ /** The system stores' slice of the hub link (status, and the endpoints of a store on the hub). */
220
+ storesPlugin: storesLinkPlugin(() => stores, () => moves),
188
221
  /**
189
222
  * Move build 1's single-instance system rows onto instances, then the per-service api instances onto service
190
223
  * records of the one api instance (before systems connect).
191
224
  */
192
225
  async migrate(): Promise<number> {
193
- const instances = await migrateLegacyInstances(store, log);
226
+ const migrated = await migrateLegacyInstances(store, log);
194
227
  const api = await migrateApiServices({ store, vault: options.secrets, log, clock });
195
- return instances + api.services + api.removed;
228
+ // rows a killed hub left saying connected: nothing is connected yet at boot
229
+ const stale = await instances.reconcile();
230
+ if (stale.length > 0) { log.info('link.status.reconciled', { disconnected: stale.map((ref) => `${ref.system}@${ref.instance}`) }); }
231
+ return migrated + api.services + api.removed;
196
232
  },
197
233
  /** Start following the bus (indexing) and the embedders. */
198
234
  start(): void {
@@ -208,6 +244,7 @@ export function buildSystems(options: SystemsOptions) {
208
244
  stopOutput?.();
209
245
  relay.stop();
210
246
  await batcher.stop();
247
+ await storeHost.closeAll();
211
248
  },
212
249
  };
213
250
  }
@@ -11,6 +11,36 @@ import { MAIN_INSTANCE, instanceLabel, systemLinkSpec, type InstanceName, type I
11
11
  import type { ConnectionChange, LinkService, SystemConnection } from './index.ts';
12
12
  import { messageOf } from '../catalog/scope.ts';
13
13
 
14
+ /**
15
+ * Holds one call to an instance before it goes (its store isn't ready yet: `stores/service.ts`); resolves when it may
16
+ * go, rejects when it is refused. Endpoints it doesn't hold resolve at once.
17
+ */
18
+ export type CallHold = (ref: InstanceRef, endpoint: string) => Promise<void>;
19
+
20
+ /**
21
+ * A connection's peer, with each call first passing `hold`. Only calls that answer once are held; a streaming call
22
+ * (`providerChat`) goes at once.
23
+ */
24
+ export function heldPeer(peer: Peer<SystemLinkSpec>, ref: InstanceRef, hold: () => CallHold | undefined): Peer<SystemLinkSpec> {
25
+ return {
26
+ get conn() { return peer.conn; },
27
+ get open() { return peer.open; },
28
+ get signal() { return peer.signal; },
29
+ on: peer.on,
30
+ call: (name, ...args) => {
31
+ const held = hold();
32
+ if (held === undefined || name === 'providerChat') { return peer.call(name, ...args); }
33
+ const after = async (): Promise<unknown> => {
34
+ await held(ref, name);
35
+ const answer: unknown = await peer.call(name, ...args);
36
+ return answer;
37
+ };
38
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- every held endpoint answers once, so its call is a promise of the same answer, after the hold
39
+ return after() as ReturnType<typeof peer.call<typeof name>>;
40
+ },
41
+ };
42
+ }
43
+
14
44
  /** The link service over a `Peers` registry. */
15
45
  export class PeerLinkService implements LinkService {
16
46
  /** The registry to pass to the hub link server as `peers`. */
@@ -21,6 +51,8 @@ export class PeerLinkService implements LinkService {
21
51
  /** Connections by `system@instance`. */
22
52
  readonly #connections = new Map<string, SystemConnection>();
23
53
  readonly #listeners = new Set<(change: ConnectionChange) => void>();
54
+ /** Holds calls to an instance whose store isn't ready (set once the stores are built). */
55
+ #hold: CallHold | undefined;
24
56
 
25
57
  constructor(options: { log: Logger; clock: () => number; peers?: Peers<SystemLinkSpec> }) {
26
58
  this.#log = options.log;
@@ -39,13 +71,19 @@ export class PeerLinkService implements LinkService {
39
71
  return this.peers.get(conn);
40
72
  }
41
73
 
74
+ /** Hold every connection's calls with `hold` from now on (the system stores: calls wait for a store to be ready). */
75
+ holdWith(hold: CallHold): void {
76
+ this.#hold = hold;
77
+ }
78
+
42
79
  /** The handshake proved who is on `conn`: it is now that instance's connection. */
43
80
  establish(conn: WsConn, session: LinkSession): SystemConnection {
44
- const peer = this.peers.of(conn);
81
+ const peer = heldPeer(this.peers.of(conn), { system: session.system, instance: session.instance }, () => this.#hold);
45
82
  const key = instanceLabel(session);
46
83
  const previous = this.#connections.get(key);
47
84
  const fields = { system: session.system, instance: session.instance, boot: session.boot };
48
- if (previous !== undefined && previous.peer.conn !== conn) {
85
+ const replaced = previous !== undefined && previous.peer.conn !== conn;
86
+ if (replaced) {
49
87
  this.#sessions.delete(previous.peer.conn);
50
88
  this.#log.info('link.replaced', { ...fields, previous: previous.boot });
51
89
  }
@@ -53,7 +91,7 @@ export class PeerLinkService implements LinkService {
53
91
  this.#sessions.set(conn, session);
54
92
  this.#connections.set(key, connection);
55
93
  this.#log.info('link.connected', fields);
56
- this.#emit({ system: session.system, instance: session.instance, connected: true });
94
+ this.#emit({ system: session.system, instance: session.instance, connected: true, ...(replaced ? { replaced: true } : {}) });
57
95
  return connection;
58
96
  }
59
97
 
@@ -1,5 +1,5 @@
1
1
  /** Kinds describe their fns on their own system: the hub asks it over the link (`check`). */
2
- import { splitName, SystemName, type InstanceName, type Json, type KindDescription, type QualifiedName } from '@harness/core';
2
+ import { splitName, SystemName, type InstanceName, type InstanceRef, type Json, type KindDescription, type QualifiedName } from '@harness/core';
3
3
  import type { KindDescriber } from '../catalog/index.ts';
4
4
  import type { LinkService } from './index.ts';
5
5
 
@@ -8,22 +8,39 @@ export class KindUnreachable extends Error {
8
8
  override readonly name = 'KindUnreachable';
9
9
  }
10
10
 
11
+ /** Whether calls to an instance are held now, its store not ready (`SystemStores.holding`). */
12
+ export type StoreHolding = (ref: InstanceRef) => Promise<boolean>;
13
+
11
14
  /**
12
15
  * Asks the connected system that defines a kind to check and describe a payload: the fn's own instance when it belongs
13
16
  * to one (a database's saved query is described where its tables are), else the system's default connection.
17
+ *
18
+ * The call would be held while the system's store isn't ready. The catalog's own re-describing must not wait for that:
19
+ * it runs inside the instance's status changes, and the store's readiness reports (and the handshake) wait on those,
20
+ * so a held `check` could only end when the hold ran out. Unless the caller asks to `wait` (someone authoring a fn),
21
+ * a system whose store isn't ready is unreachable at once; its fns are described again when it reports ready.
14
22
  */
15
23
  export class LinkKindDescriber implements KindDescriber {
16
24
  readonly #links: LinkService;
25
+ #holding: StoreHolding | undefined;
17
26
 
18
27
  constructor(links: LinkService) {
19
28
  this.#links = links;
20
29
  }
21
30
 
22
- async describe(kind: QualifiedName, payload: Json, instance?: InstanceName): Promise<{ problems: string[]; description?: KindDescription | undefined }> {
31
+ /** Treat an instance whose calls `holding` says are held as unreachable, unless a describe asks to wait. */
32
+ unreachableWhile(holding: StoreHolding): void {
33
+ this.#holding = holding;
34
+ }
35
+
36
+ async describe(kind: QualifiedName, payload: Json, instance?: InstanceName, options: { readonly wait?: boolean } = {}): Promise<{ problems: string[]; description?: KindDescription | undefined }> {
23
37
  const { system, local } = splitName(kind);
24
38
  const name = SystemName.parse(system);
25
39
  const connection = this.#links.connection(name, instance);
26
40
  if (connection === undefined) { throw new KindUnreachable(`${instance === undefined ? system : `${system} ${instance}`} is not connected, so ${kind} can't describe a payload`); }
41
+ if (options.wait !== true && await this.#holding?.({ system: connection.system, instance: connection.instance }) === true) {
42
+ throw new KindUnreachable(`${system} is getting its storage ready, so ${kind} can't describe a payload now`);
43
+ }
27
44
  return connection.peer.call('check', { kind: local, payload });
28
45
  }
29
46
  }
@@ -3,6 +3,7 @@
3
3
  * installed packages get their externals.
4
4
  */
5
5
  import { env } from '@ayepi/env';
6
+ import { STORE_HOLD, STORE_LEASE, STORE_MOVE_DRAIN } from '@harness/core';
6
7
  import { z } from 'zod';
7
8
 
8
9
  export const packagingEnv = env({
@@ -17,6 +18,15 @@ export const packagingEnv = env({
17
18
  'Build 9: the folder of bundled system folders an admin adds instances of from the browser (an MCP server, an API service). Empty: the repository `systems/` folder beside the hub package.',
18
19
  ),
19
20
  HARNESS_NPM: z.string().default(process.platform === 'win32' ? 'npm.cmd' : 'npm').describe('The npm the hub installs packages and their native externals with.'),
21
+ HARNESS_STORE_LEASE: z.number().int().min(1_000).default(STORE_LEASE).describe(
22
+ 'How long a transaction on a store the hub keeps may go without a statement before the hub rolls it back, in milliseconds.',
23
+ ),
24
+ HARNESS_STORE_HOLD: z.number().int().min(0).default(STORE_HOLD).describe(
25
+ 'How long a call to a system whose store isn\'t ready yet waits before it is refused ("getting its storage ready"), in milliseconds.',
26
+ ),
27
+ HARNESS_STORE_MOVE_DRAIN: z.number().int().min(0).default(STORE_MOVE_DRAIN).describe(
28
+ 'How long a store move gives the runs still going on its system to finish before it asks the admin to cancel them or keep waiting, in milliseconds.',
29
+ ),
20
30
  });
21
31
 
22
32
  /** The parsed packaging tunables. */
@@ -34,6 +34,7 @@ import { Serial } from '../catalog/serial.ts';
34
34
  import type { SystemGrantGuard } from './grants.ts';
35
35
  import type { SystemLifecycle } from './lifecycle.ts';
36
36
  import type { EventBus } from '../bus.ts';
37
+ import type { SystemStores } from '../stores/service.ts';
37
38
 
38
39
  const endpoints = hubLinkSpec.endpoints;
39
40
 
@@ -78,6 +79,8 @@ export interface LinkHandlerOptions {
78
79
  readonly pairingLimits: Pick<PairingLimits, 'check'>;
79
80
  /** Counts and times sockets until they are linked. */
80
81
  readonly gate?: Pick<LinkGate, 'helloed' | 'linked'>;
82
+ /** Where each instance's store lives, told in its welcome. */
83
+ readonly stores?: Pick<SystemStores, 'welcome'>;
81
84
  }
82
85
 
83
86
 
@@ -255,6 +258,8 @@ export class LinkHandshake {
255
258
  const manifest = await catalog.manifest(hello.name);
256
259
  const sendManifest = manifest === undefined || record.manifestHash !== hello.manifestHash;
257
260
  const session: LinkSession = { ...ref, boot: hello.boot };
261
+ // where its store lives, kept for the connection before it can ask to open one
262
+ const store = await this.#options.stores?.welcome(record);
258
263
  links.establish(conn, session);
259
264
  this.#options.gate?.linked(conn);
260
265
  await instances.sync(ref, { version: hello.version, lastSeenAt: clock(), address: await this.#options.address(conn.req) });
@@ -269,6 +274,7 @@ export class LinkHandshake {
269
274
  sendManifest,
270
275
  limits,
271
276
  ...(autoPair === undefined ? {} : { autoPair }),
277
+ ...(store === undefined ? {} : { store }),
272
278
  };
273
279
  }
274
280