fnloom 0.2.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 (618) hide show
  1. package/README.md +102 -5
  2. package/package.json +12 -11
  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/install.ts +103 -7
  8. package/packages/cli/src/commands/manage.ts +7 -5
  9. package/packages/cli/src/commands/store.ts +172 -0
  10. package/packages/cli/src/hub.ts +26 -7
  11. package/packages/cli/src/io.ts +1 -0
  12. package/packages/cli/src/testing.ts +2 -1
  13. package/packages/core/package.json +4 -4
  14. package/packages/core/src/context-files.ts +3 -1
  15. package/packages/core/src/context-graph.ts +4 -0
  16. package/packages/core/src/context-plan.ts +451 -0
  17. package/packages/core/src/context-questions.ts +305 -0
  18. package/packages/core/src/fn-facts.ts +32 -4
  19. package/packages/core/src/identity.ts +1 -1
  20. package/packages/core/src/index.ts +4 -1
  21. package/packages/core/src/link.ts +70 -0
  22. package/packages/core/src/manifest.ts +20 -1
  23. package/packages/core/src/model-calls.ts +11 -2
  24. package/packages/core/src/package.ts +10 -0
  25. package/packages/core/src/query.ts +3 -2
  26. package/packages/core/src/records/content.ts +10 -2
  27. package/packages/core/src/records/runs.ts +12 -0
  28. package/packages/core/src/records/systems.ts +87 -5
  29. package/packages/core/src/run.ts +5 -0
  30. package/packages/core/src/stores.ts +473 -0
  31. package/packages/core/src/suggestions.ts +3 -0
  32. package/packages/core/src/system-pages.ts +14 -1
  33. package/packages/core/src/web.ts +114 -9
  34. package/packages/hub/package.json +13 -12
  35. package/packages/hub/src/access/hits.ts +1 -1
  36. package/packages/hub/src/api/admin-ops.ts +36 -4
  37. package/packages/hub/src/api/auth.ts +8 -4
  38. package/packages/hub/src/api/person-ops.ts +6 -0
  39. package/packages/hub/src/api/store-ops.ts +54 -0
  40. package/packages/hub/src/api/testing/rig.ts +2 -2
  41. package/packages/hub/src/api/tls.ts +2 -2
  42. package/packages/hub/src/api/web/build5.ts +2 -1
  43. package/packages/hub/src/api/web/context-plans.ts +25 -0
  44. package/packages/hub/src/api/web/context-review.ts +43 -0
  45. package/packages/hub/src/api/web/index.ts +4 -0
  46. package/packages/hub/src/api/web/pages.ts +14 -1
  47. package/packages/hub/src/api/web/review.ts +16 -0
  48. package/packages/hub/src/api/web/systems.ts +14 -2
  49. package/packages/hub/src/boot/admin-fns.ts +8 -0
  50. package/packages/hub/src/boot/admin-secrets.ts +10 -4
  51. package/packages/hub/src/boot/env.ts +6 -1
  52. package/packages/hub/src/boot/hub-fns.ts +3 -3
  53. package/packages/hub/src/boot/hub-groups.ts +2 -2
  54. package/packages/hub/src/boot/identity.ts +1 -1
  55. package/packages/hub/src/boot/index.ts +9 -0
  56. package/packages/hub/src/boot/modules.ts +12 -3
  57. package/packages/hub/src/boot/person-fns.ts +5 -0
  58. package/packages/hub/src/boot/plan-fns.ts +39 -0
  59. package/packages/hub/src/boot/start.ts +2 -1
  60. package/packages/hub/src/catalog/catalog.ts +44 -14
  61. package/packages/hub/src/catalog/index.ts +6 -2
  62. package/packages/hub/src/chat/testing.ts +2 -2
  63. package/packages/hub/src/contextor/brought.ts +5 -3
  64. package/packages/hub/src/contextor/testing.ts +4 -4
  65. package/packages/hub/src/execution/create.ts +2 -0
  66. package/packages/hub/src/execution/env.ts +2 -0
  67. package/packages/hub/src/execution/errors.ts +12 -0
  68. package/packages/hub/src/execution/executors.ts +14 -2
  69. package/packages/hub/src/execution/index.ts +8 -0
  70. package/packages/hub/src/execution/link-handlers.ts +16 -4
  71. package/packages/hub/src/execution/runs.ts +212 -11
  72. package/packages/hub/src/execution/testing.ts +2 -1
  73. package/packages/hub/src/fns/search.ts +23 -4
  74. package/packages/hub/src/graph/graph.ts +2 -2
  75. package/packages/hub/src/index/index.ts +9 -2
  76. package/packages/hub/src/index/indexer.ts +67 -16
  77. package/packages/hub/src/index/search.ts +1 -0
  78. package/packages/hub/src/index/suggester.ts +2 -2
  79. package/packages/hub/src/link/build.ts +47 -10
  80. package/packages/hub/src/link/connections.ts +41 -3
  81. package/packages/hub/src/link/describer.ts +19 -2
  82. package/packages/hub/src/link/env.ts +10 -0
  83. package/packages/hub/src/link/handlers.ts +6 -0
  84. package/packages/hub/src/link/index.ts +16 -4
  85. package/packages/hub/src/link/lifecycle.ts +11 -4
  86. package/packages/hub/src/link/packages.ts +17 -4
  87. package/packages/hub/src/link/pairing.ts +2 -2
  88. package/packages/hub/src/link/process.ts +10 -4
  89. package/packages/hub/src/link/rig.ts +6 -2
  90. package/packages/hub/src/link/status.ts +14 -0
  91. package/packages/hub/src/link/supervisor.ts +17 -1
  92. package/packages/hub/src/link/systems.ts +16 -5
  93. package/packages/hub/src/models/roles.ts +74 -7
  94. package/packages/hub/src/query/columns.ts +4 -1
  95. package/packages/hub/src/query/contexts.ts +10 -3
  96. package/packages/hub/src/questions/apply.ts +163 -0
  97. package/packages/hub/src/questions/carry.ts +30 -0
  98. package/packages/hub/src/questions/duplicates.ts +181 -0
  99. package/packages/hub/src/questions/index.ts +112 -0
  100. package/packages/hub/src/questions/metadata.ts +142 -0
  101. package/packages/hub/src/questions/pending.ts +64 -0
  102. package/packages/hub/src/questions/plan-match.ts +79 -0
  103. package/packages/hub/src/questions/plan-prompts.ts +110 -0
  104. package/packages/hub/src/questions/planner.ts +382 -0
  105. package/packages/hub/src/questions/plans.ts +353 -0
  106. package/packages/hub/src/questions/review.ts +253 -0
  107. package/packages/hub/src/questions/setting.ts +50 -0
  108. package/packages/hub/src/questions/testing.ts +131 -0
  109. package/packages/hub/src/questions/worker.ts +182 -0
  110. package/packages/hub/src/resources/context.ts +58 -20
  111. package/packages/hub/src/resources/create.ts +16 -4
  112. package/packages/hub/src/resources/env.ts +4 -0
  113. package/packages/hub/src/resources/fns.ts +6 -2
  114. package/packages/hub/src/resources/index.ts +8 -2
  115. package/packages/hub/src/resources/testing.ts +18 -2
  116. package/packages/hub/src/store/codec.ts +23 -5
  117. package/packages/hub/src/store/context-status.ts +56 -0
  118. package/packages/hub/src/store/derived.ts +53 -0
  119. package/packages/hub/src/store/hybrid.ts +33 -6
  120. package/packages/hub/src/store/lists.ts +2 -1
  121. package/packages/hub/src/store/migrate-fn-names.ts +5 -2
  122. package/packages/hub/src/store/rows.ts +8 -1
  123. package/packages/hub/src/store/schema.ts +2 -1
  124. package/packages/hub/src/store/sqlite.ts +2 -1
  125. package/packages/hub/src/stores/backups.ts +163 -0
  126. package/packages/hub/src/stores/drivers.ts +100 -0
  127. package/packages/hub/src/stores/guard.ts +116 -0
  128. package/packages/hub/src/stores/host.ts +459 -0
  129. package/packages/hub/src/stores/moves.ts +380 -0
  130. package/packages/hub/src/stores/plugin.ts +42 -0
  131. package/packages/hub/src/stores/service.ts +340 -0
  132. package/packages/hub/src/stores/testing.ts +149 -0
  133. package/packages/sdk/AUTHORING.md +1813 -218
  134. package/packages/sdk/package.json +12 -8
  135. package/packages/sdk/src/build.ts +3 -0
  136. package/packages/sdk/src/client.ts +22 -0
  137. package/packages/sdk/src/ctx.ts +51 -17
  138. package/packages/sdk/src/declare.ts +36 -12
  139. package/packages/sdk/src/hub.ts +222 -10
  140. package/packages/sdk/src/impl.ts +3 -3
  141. package/packages/sdk/src/index.ts +6 -3
  142. package/packages/sdk/src/manifest.ts +5 -0
  143. package/packages/sdk/src/providers.ts +2 -2
  144. package/packages/sdk/src/server/asks.ts +12 -1
  145. package/packages/sdk/src/server/env.ts +13 -1
  146. package/packages/sdk/src/server/host.ts +81 -10
  147. package/packages/sdk/src/server/index.ts +21 -2
  148. package/packages/sdk/src/server/package.ts +11 -2
  149. package/packages/sdk/src/server/run.ts +6 -1
  150. package/packages/sdk/src/server/runtime.ts +78 -22
  151. package/packages/sdk/src/server/start-gate.ts +174 -0
  152. package/packages/sdk/src/server/store/checksum.ts +162 -0
  153. package/packages/sdk/src/server/store/engines.ts +400 -0
  154. package/packages/sdk/src/server/store/extend.ts +25 -0
  155. package/packages/sdk/src/server/store/keeper.ts +392 -0
  156. package/packages/sdk/src/server/store/link-driver.ts +142 -0
  157. package/packages/sdk/src/server/store/measure.ts +45 -0
  158. package/packages/sdk/src/server/store/migrations.ts +238 -0
  159. package/packages/sdk/src/server/store/move.ts +488 -0
  160. package/packages/sdk/src/server/store/portable.ts +288 -0
  161. package/packages/sdk/src/server/store/stable.ts +146 -0
  162. package/packages/sdk/src/server/store/tables.ts +28 -0
  163. package/packages/sdk/src/server/store/vectors.ts +185 -0
  164. package/packages/sdk/src/server/store/work-checks.ts +288 -0
  165. package/packages/sdk/src/server/store/work.ts +369 -0
  166. package/packages/sdk/src/server/table.ts +3 -1
  167. package/packages/sdk/src/server/testing.ts +116 -3
  168. package/packages/sdk/src/store.ts +91 -0
  169. package/packages/sdk/src/system.ts +58 -30
  170. package/packages/sdk/src/testing/hub.ts +18 -5
  171. package/packages/web/dist/assets/{ActorSettingsView-BuMYRDqv.js → ActorSettingsView-v2k7v454.js} +2 -2
  172. package/packages/web/dist/assets/{AdminLayout-sLjVTrmV.js → AdminLayout-B6Jrc_4W.js} +2 -2
  173. package/packages/web/dist/assets/{ApiServiceForm-BrMTU-7u.js → ApiServiceForm-CuuQgOJc.js} +2 -2
  174. package/packages/web/dist/assets/{ApiServiceView-BMF2zD6Q.js → ApiServiceView-7bTHSO_Z.js} +2 -2
  175. package/packages/web/dist/assets/{ApiServicesView-bjLAWO_j.js → ApiServicesView-BXi24n49.js} +2 -2
  176. package/packages/web/dist/assets/{AppPage-DSzDKCFz.js → AppPage-CFmKZS8G.js} +2 -2
  177. package/packages/web/dist/assets/{AutoPairPicker-nV38ALjl.js → AutoPairPicker-C61gihmh.js} +2 -2
  178. package/packages/web/dist/assets/{BrowserFrame-Bic7U7jN.js → BrowserFrame-Sq9EmQRT.js} +2 -2
  179. package/packages/web/dist/assets/{ChartVisual-DWw7WsfN.js → ChartVisual-C4mgw4wh.js} +4 -4
  180. package/packages/web/dist/assets/ChatPage-CAhHE03Z.js +4 -0
  181. package/packages/web/dist/assets/{CodeViewer-xHS3Xah9.js → CodeViewer-tUNXZB77.js} +2 -2
  182. package/packages/web/dist/assets/{ConfigWithCustom-DreTUdf0.js → ConfigWithCustom-D_-rY66L.js} +3 -3
  183. package/packages/web/dist/assets/{ConfirmDialog-DjQUzNqk.js → ConfirmDialog-Dd3E4sJt.js} +2 -2
  184. package/packages/web/dist/assets/{ConnectPage-CfRDrXvJ.js → ConnectPage-CX9acyQH.js} +2 -2
  185. package/packages/web/dist/assets/ContextItemPage-Cv4G0k_o.css +1 -0
  186. package/packages/web/dist/assets/ContextItemPage-rUI3-T_L.js +2 -0
  187. package/packages/web/dist/assets/ContextPage-C8u0UnYl.css +1 -0
  188. package/packages/web/dist/assets/ContextPage-CtefzyKg.js +3 -0
  189. package/packages/web/dist/assets/ContextRow-Chx99Xac.css +1 -0
  190. package/packages/web/dist/assets/ContextRow-DrtPumZ5.js +2 -0
  191. package/packages/web/dist/assets/{DataPage-wSIoGcb5.js → DataPage-DDSsxHro.js} +2 -2
  192. package/packages/web/dist/assets/DataTypePage-BW9fWaz8.js +2 -0
  193. package/packages/web/dist/assets/{DesignPage-DidMUX8m.js → DesignPage-6e0XbOFC.js} +2 -2
  194. package/packages/web/dist/assets/{ExplorePage-MUyVydVB.js → ExplorePage-B7ND0W0l.js} +2 -2
  195. package/packages/web/dist/assets/{FnList-CjQRwYaT.js → FnList-Bx6H-kux.js} +2 -2
  196. package/packages/web/dist/assets/{FnPill-BshAvm2I.js → FnPill-Cp3KuLmP.js} +2 -2
  197. package/packages/web/dist/assets/FnView-C0XZdnsS.js +2 -0
  198. package/packages/web/dist/assets/{FnsView-CeqIoaBT.js → FnsView-GTH3p7a0.js} +2 -2
  199. package/packages/web/dist/assets/{GinExprView-DYVUwZrd.js → GinExprView-DGxns6lH.js} +2 -2
  200. package/packages/web/dist/assets/{GinForm-D3mwMRTQ.js → GinForm-BDBUzuDP.js} +2 -2
  201. package/packages/web/dist/assets/{GinTypeView-C0YifSmE.js → GinTypeView-CUsymbVf.js} +2 -2
  202. package/packages/web/dist/assets/{GinValueView-HfEPq9le.js → GinValueView-jsKIfiEA.js} +2 -2
  203. package/packages/web/dist/assets/{GraphPage-ySnuA4Hp.js → GraphPage-BCcPPsHu.js} +2 -2
  204. package/packages/web/dist/assets/{GraphPanel-Cy5-KGo1.js → GraphPanel-9tztGHmu.js} +2 -2
  205. package/packages/web/dist/assets/{HubPicker-C_vA752L.js → HubPicker-EoOErgmk.js} +2 -2
  206. package/packages/web/dist/assets/{InboxApprovals-DcPCCmZ5.js → InboxApprovals-Dkq7DFp_.js} +2 -2
  207. package/packages/web/dist/assets/{InboxPage-C2DT2nuF.js → InboxPage-CHhslePq.js} +2 -2
  208. package/packages/web/dist/assets/{InjectedList-CJsEFEbz.js → InjectedList-CSWqRiON.js} +2 -2
  209. package/packages/web/dist/assets/InstallDialog-D-VwfZYF.js +2 -0
  210. package/packages/web/dist/assets/{InstallDialog-yWLZK_zN.css → InstallDialog-K-j0sdHm.css} +1 -1
  211. package/packages/web/dist/assets/InstanceTypes-CwVSAULg.css +1 -0
  212. package/packages/web/dist/assets/InstanceTypes-D3rAEiE7.js +2 -0
  213. package/packages/web/dist/assets/InstanceView-DoH8C-1j.js +2 -0
  214. package/packages/web/dist/assets/InstanceView-_9uE70tS.css +1 -0
  215. package/packages/web/dist/assets/{ItemHistory-CUGa8b6s.js → ItemHistory-NQAP69ma.js} +2 -2
  216. package/packages/web/dist/assets/LimitsView-DY2C9nYS.js +2 -0
  217. package/packages/web/dist/assets/ListSearch-BunVrDO0.js +2 -0
  218. package/packages/web/dist/assets/{LlmCallDetails-2yQftCqd.js → LlmCallDetails-BoVNDTVs.js} +2 -2
  219. package/packages/web/dist/assets/{LlmCallsView-DOHX3r0K.js → LlmCallsView-BGpV92RC.js} +2 -2
  220. package/packages/web/dist/assets/{LoadState-DeXfLvYv.js → LoadState-h-K9bTYc.js} +2 -2
  221. package/packages/web/dist/assets/{McpDialog-CA_0WKWF.js → McpDialog-DhOCk6_E.js} +2 -2
  222. package/packages/web/dist/assets/{McpServerForm-CAG8Wp2N.js → McpServerForm-Cor3fI7s.js} +2 -2
  223. package/packages/web/dist/assets/McpServerView-ewXRPEmZ.js +2 -0
  224. package/packages/web/dist/assets/McpServersView-Dd0xmfws.js +2 -0
  225. package/packages/web/dist/assets/{McpView-CC2oNOMa.js → McpView-GPXdCMne.js} +2 -2
  226. package/packages/web/dist/assets/{McpsView-CwJvyyxV.js → McpsView-DJIR2JX5.js} +2 -2
  227. package/packages/web/dist/assets/{MemoryDialog-Dbvh5uLq.js → MemoryDialog-BTeIHQyA.js} +2 -2
  228. package/packages/web/dist/assets/{ModelCallsView-RvnW3EBP.js → ModelCallsView-DMcnwF2S.js} +2 -2
  229. package/packages/web/dist/assets/{ModelPicker-DcjwQFHC.js → ModelPicker-CgkMFxSO.js} +2 -2
  230. package/packages/web/dist/assets/ModelsView-cMHygeiK.js +2 -0
  231. package/packages/web/dist/assets/{NotFoundPage-CeSwzTV-.js → NotFoundPage-Tk92K7HN.js} +2 -2
  232. package/packages/web/dist/assets/PairPage-D0BK8CCw.js +2 -0
  233. package/packages/web/dist/assets/PairPage-D_aPS1Ot.css +1 -0
  234. package/packages/web/dist/assets/{PanelHost-BkrFAnPa.js → PanelHost-C-gKrxAk.js} +2 -2
  235. package/packages/web/dist/assets/{PeopleView-D1QGPYp7.js → PeopleView-DRfeNWK5.js} +2 -2
  236. package/packages/web/dist/assets/PoliciesView-BRi-QAuo.js +2 -0
  237. package/packages/web/dist/assets/{RefusalList-DQoyUoPG.js → RefusalList-DVO0bmeB.js} +2 -2
  238. package/packages/web/dist/assets/{RemoteAuthFields-nxGWfmhf.js → RemoteAuthFields-CgiufuqQ.js} +2 -2
  239. package/packages/web/dist/assets/{ResourceViewer-Po24y4pj.js → ResourceViewer-Do0chYxU.js} +2 -2
  240. package/packages/web/dist/assets/ResourcesPage-BBx2u2mw.js +2 -0
  241. package/packages/web/dist/assets/{ResultGrid-uoq4yUYj.js → ResultGrid-Bj-0I5HY.js} +2 -2
  242. package/packages/web/dist/assets/{ReviewSummaryStrip-k3HevESg.js → ReviewSummaryStrip-DO3p64Qj.js} +2 -2
  243. package/packages/web/dist/assets/ReviewView-DZF9E1hb.js +3 -0
  244. package/packages/web/dist/assets/{RuleRow-CoXDA-SH.js → RuleRow-DX9v4iGP.js} +2 -2
  245. package/packages/web/dist/assets/{RunCard-CBSGdwdQ.js → RunCard-BnrtK2Yp.js} +2 -2
  246. package/packages/web/dist/assets/{RunDetails-CGhQQ6OI.js → RunDetails-DjR206q6.js} +2 -2
  247. package/packages/web/dist/assets/{RunDot-Ch_45985.js → RunDot-lHRICdM5.js} +2 -2
  248. package/packages/web/dist/assets/{RunPage-C_t20pB7.js → RunPage-CbAQ_WPR.js} +2 -2
  249. package/packages/web/dist/assets/{RunProgress-VrZUHUEC.js → RunProgress-C3-B4tQf.js} +2 -2
  250. package/packages/web/dist/assets/RunsView-DMkPmkqX.js +2 -0
  251. package/packages/web/dist/assets/ServiceRows-4WythFpF.js +2 -0
  252. package/packages/web/dist/assets/{ServiceRows-6BU4-MeL.css → ServiceRows-HPQ0pN6b.css} +1 -1
  253. package/packages/web/dist/assets/SettingsPage-BN4oSzoL.js +3 -0
  254. package/packages/web/dist/assets/{SignInPage-DrXZ1sG2.js → SignInPage-ByqGEZfj.js} +2 -2
  255. package/packages/web/dist/assets/{StatusBadge-Dpb9uG5e.js → StatusBadge-CXne0sRZ.js} +2 -2
  256. package/packages/web/dist/assets/StorePlacementStep-B6SwTmdM.js +2 -0
  257. package/packages/web/dist/assets/StorePlacementStep-D_G4e3ue.css +1 -0
  258. package/packages/web/dist/assets/{SystemConfig-72qKRkUk.js → SystemConfig-vQDL_eUl.js} +2 -2
  259. package/packages/web/dist/assets/{SystemPageHost-DLNg2FYK.js → SystemPageHost-DrMrEPyh.js} +2 -2
  260. package/packages/web/dist/assets/SystemView-Be6TBM4j.js +2 -0
  261. package/packages/web/dist/assets/{SystemView-C8ScHUe2.css → SystemView-_9q6eDfV.css} +1 -1
  262. package/packages/web/dist/assets/{SystemsView-B6HEL9VS.css → SystemsView-CWKnupLW.css} +1 -1
  263. package/packages/web/dist/assets/SystemsView-DZtT3laz.js +2 -0
  264. package/packages/web/dist/assets/{TableViewer-BQ7bYLOP.js → TableViewer-Boxx86f5.js} +3 -3
  265. package/packages/web/dist/assets/{ThemePicker-C2nJ21Vd.js → ThemePicker-CIg_oRQX.js} +2 -2
  266. package/packages/web/dist/assets/{TurnTree-CORdfTHj.js → TurnTree-Ecm0yA5g.js} +2 -2
  267. package/packages/web/dist/assets/UserMessage-BlnqZDVU.js +9 -0
  268. package/packages/web/dist/assets/{ValueVisual-aXEUaQ5Y.js → ValueVisual-C-MWpp7c.js} +2 -2
  269. package/packages/web/dist/assets/WidgetView-DX4ejNb6.js +3 -0
  270. package/packages/web/dist/assets/actor-names-OdvpVZeb.js +4 -0
  271. package/packages/web/dist/assets/{fn-modal-DqcxUhOQ.js → fn-modal-B98MR7JN.js} +2 -2
  272. package/packages/web/dist/assets/{fn-notices-BYaH6IoA.js → fn-notices-CfTa1E8y.js} +2 -2
  273. package/packages/web/dist/assets/{formats-DI__ADVG.js → formats-JwoKfXIq.js} +2 -2
  274. package/packages/web/dist/assets/index-6ScWTFy2.js +4 -0
  275. package/packages/web/dist/assets/{index-CSisx5mi.css → index-CEslGcrX.css} +1 -1
  276. package/packages/web/dist/assets/{labels-BhJpmLWA.js → labels-BFbk11BE.js} +2 -2
  277. package/packages/web/dist/assets/{layout-DQKldU13.js → layout-D1gf481r.js} +2 -2
  278. package/packages/web/dist/assets/{metrics-Cio5ykX6.js → metrics-CBPX3W5Y.js} +2 -2
  279. package/packages/web/dist/assets/{problems-BZY0Dwif.js → problems-t1E_ovSz.js} +2 -2
  280. package/packages/web/dist/assets/{push-payload-D5efGCzd.js → push-payload-BeU1ADYt.js} +64 -64
  281. package/packages/web/dist/assets/{record-edits-CveFEsal.js → record-edits-Bfsi4lU3.js} +2 -2
  282. package/packages/web/dist/assets/{remote-config-BkaarDf3.js → remote-config-BNQhSDzB.js} +2 -2
  283. package/packages/web/dist/assets/{review-CGUGvRV9.js → review-fP-l9D6H.js} +3 -3
  284. package/packages/web/dist/assets/routes-DV4IJpwe.js +4 -0
  285. package/packages/web/dist/assets/runs-CveC2kKo.js +2 -0
  286. package/packages/web/dist/assets/{shared-DTpYDMc_.js → shared-LbaIHjbV.js} +2 -2
  287. package/packages/web/dist/assets/{size-BwnshyOe.js → size-Bh__w5aI.js} +2 -2
  288. package/packages/web/dist/assets/{sources-Bm-TrxhL.js → sources-VPrtgLIi.js} +2 -2
  289. package/packages/web/dist/assets/src-CT3TeFaM.js +43 -0
  290. package/packages/web/dist/assets/state-xfQqaQPX.js +2 -0
  291. package/packages/web/dist/assets/{systems-DIp94AET.js → systems-BqE3WTSF.js} +2 -2
  292. package/packages/web/dist/assets/ui-BzgWquIU.js +17 -0
  293. package/packages/web/dist/assets/{ui-C7ZH_6oC.css → ui-DycHjPTZ.css} +1 -1
  294. package/packages/web/dist/assets/{url-BIg5IhGs.js → url-DKGcECT1.js} +2 -2
  295. package/packages/web/dist/assets/{widget-host-BCf6Tlt5.js → widget-host-B87MTaTn.js} +2 -2
  296. package/packages/web/dist/assets/{widgets-CrbkovMT.js → widgets-BBCuSS6E.js} +2 -2
  297. package/packages/web/dist/index.html +44 -44
  298. package/packages/web/dist/sw.js +1 -1
  299. package/packages/web/package.json +2 -2
  300. package/premade/claude.zip +0 -0
  301. package/premade/database.zip +0 -0
  302. package/premade/web.zip +0 -0
  303. package/scripts/run-stack.ts +3 -2
  304. package/scripts/stack.ts +73 -16
  305. package/scripts/start.ts +11 -2
  306. package/systems/api/package.json +3 -3
  307. package/systems/code/package.json +3 -3
  308. package/systems/embedder/package.json +1 -1
  309. package/systems/fs/client/fakes.ts +2 -0
  310. package/systems/fs/client/index.ts +4 -2
  311. package/systems/fs/client/machines/CoreHeatmap.vue +94 -0
  312. package/systems/fs/client/machines/MachineFiles.vue +121 -0
  313. package/systems/fs/client/machines/MachineMetrics.vue +330 -0
  314. package/systems/fs/client/machines/MachinesPage.vue +119 -0
  315. package/systems/fs/client/machines/TimeChart.vue +128 -0
  316. package/systems/fs/client/machines/fakes.ts +95 -0
  317. package/systems/fs/client/machines/files/ChangesPane.vue +90 -0
  318. package/systems/fs/client/machines/files/CodeView.vue +158 -0
  319. package/systems/fs/client/machines/files/CommentComposer.vue +86 -0
  320. package/systems/fs/client/machines/files/CommentThread.vue +115 -0
  321. package/systems/fs/client/machines/files/CommitPane.vue +80 -0
  322. package/systems/fs/client/machines/files/ComparePane.vue +81 -0
  323. package/systems/fs/client/machines/files/FileHistory.vue +89 -0
  324. package/systems/fs/client/machines/files/FilePane.vue +199 -0
  325. package/systems/fs/client/machines/files/FileTree.vue +26 -0
  326. package/systems/fs/client/machines/files/FolderPane.vue +154 -0
  327. package/systems/fs/client/machines/files/HistoryPane.vue +106 -0
  328. package/systems/fs/client/machines/files/ImageView.vue +160 -0
  329. package/systems/fs/client/machines/files/PatchView.vue +31 -0
  330. package/systems/fs/client/machines/files/QuickOpen.vue +67 -0
  331. package/systems/fs/client/machines/files/SearchPane.vue +87 -0
  332. package/systems/fs/client/machines/files/TreeNode.vue +72 -0
  333. package/systems/fs/client/machines/files/api.ts +127 -0
  334. package/systems/fs/client/machines/files/fake-kinds.ts +16 -0
  335. package/systems/fs/client/machines/files/fakes.ts +305 -0
  336. package/systems/fs/client/machines/files/ink.ts +117 -0
  337. package/systems/fs/client/machines/files/logic.ts +205 -0
  338. package/systems/fs/client/machines/files/state.ts +187 -0
  339. package/systems/fs/client/machines/files/viewers/CsvView.vue +29 -0
  340. package/systems/fs/client/machines/files/viewers/HexView.vue +27 -0
  341. package/systems/fs/client/machines/files/viewers/HtmlView.vue +17 -0
  342. package/systems/fs/client/machines/files/viewers/JsonNode.vue +45 -0
  343. package/systems/fs/client/machines/files/viewers/JsonView.vue +25 -0
  344. package/systems/fs/client/machines/metrics.ts +245 -0
  345. package/systems/fs/client/machines/palette.ts +97 -0
  346. package/systems/fs/client/preview/machines.ts +323 -0
  347. package/systems/fs/context/authoring/index.md +4 -0
  348. package/systems/fs/context/authoring/parts/actions.md +5 -1
  349. package/systems/fs/context/authoring/parts/actions.reference.md +6 -2
  350. package/systems/fs/context/authoring/parts/calling.md +5 -1
  351. package/systems/fs/context/authoring/parts/calling.reference.md +4 -0
  352. package/systems/fs/context/authoring/parts/client.md +9 -1
  353. package/systems/fs/context/authoring/parts/client.reference/client.md +4 -0
  354. package/systems/fs/context/authoring/parts/client.reference/resultview.md +56 -53
  355. package/systems/fs/context/authoring/parts/client.reference/{fnpillprops.md → textareaprops.md} +58 -4
  356. package/systems/fs/context/authoring/parts/client.reference.md +8 -4
  357. package/systems/fs/context/authoring/parts/context/questions.md +49 -0
  358. package/systems/fs/context/authoring/parts/context.md +23 -1
  359. package/systems/fs/context/authoring/parts/context.reference.md +27 -3
  360. package/systems/fs/context/authoring/parts/contract.md +10 -0
  361. package/systems/fs/context/authoring/parts/contract.reference.md +26 -9
  362. package/systems/fs/context/authoring/parts/core-types/access-ts.md +4 -0
  363. package/systems/fs/context/authoring/parts/core-types/admin-ts.md +5 -1
  364. package/systems/fs/context/authoring/parts/core-types/api-index-ts.md +4 -0
  365. package/systems/fs/context/authoring/parts/core-types/approvals-ts.md +11 -7
  366. package/systems/fs/context/authoring/parts/core-types/auto-pair-ts.md +4 -0
  367. package/systems/fs/context/authoring/parts/core-types/checks-ts.md +4 -0
  368. package/systems/fs/context/authoring/parts/core-types/claims-ts.md +4 -0
  369. package/systems/fs/context/authoring/parts/core-types/config-secrets-ts.md +4 -0
  370. package/systems/fs/context/authoring/parts/core-types/connections-ts.md +4 -0
  371. package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +8 -0
  372. package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +5 -1
  373. package/systems/fs/context/authoring/parts/core-types/context-questions-ts.md +26 -0
  374. package/systems/fs/context/authoring/parts/core-types/contextdecl.md +9 -1
  375. package/systems/fs/context/authoring/parts/core-types/data-ts.md +4 -0
  376. package/systems/fs/context/authoring/parts/core-types/decisions-ts.md +4 -0
  377. package/systems/fs/context/authoring/parts/core-types/fn-block-ts.md +4 -0
  378. package/systems/fs/context/authoring/parts/core-types/fn-facts-ts.md +11 -0
  379. package/systems/fs/context/authoring/parts/core-types/gin-ts.md +4 -0
  380. package/systems/fs/context/authoring/parts/core-types/grants-ts.md +5 -1
  381. package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +18 -5
  382. package/systems/fs/context/authoring/parts/core-types/link-ts.md +7 -3
  383. package/systems/fs/context/authoring/parts/core-types/llm-ts.md +4 -0
  384. package/systems/fs/context/authoring/parts/core-types/manifest.md +15 -2
  385. package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +9 -1
  386. package/systems/fs/context/authoring/parts/core-types/mention-search-ts.md +4 -0
  387. package/systems/fs/context/authoring/parts/core-types/model-calls-ts.md +5 -1
  388. package/systems/fs/context/authoring/parts/core-types/model-names-ts.md +4 -0
  389. package/systems/fs/context/authoring/parts/core-types/modes-ts.md +4 -0
  390. package/systems/fs/context/authoring/parts/core-types/owner-runs-ts.md +4 -0
  391. package/systems/fs/context/authoring/parts/core-types/package-ts.md +9 -0
  392. package/systems/fs/context/authoring/parts/core-types/primitives-ts.md +4 -0
  393. package/systems/fs/context/authoring/parts/core-types/query-ts.md +4 -0
  394. package/systems/fs/context/authoring/parts/core-types/records-actors-ts.md +7 -3
  395. package/systems/fs/context/authoring/parts/core-types/records-chat-ts.md +4 -0
  396. package/systems/fs/context/authoring/parts/core-types/records-content-ts.md +4 -0
  397. package/systems/fs/context/authoring/parts/core-types/records-runs-ts.md +4 -0
  398. package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +4 -0
  399. package/systems/fs/context/authoring/parts/core-types/registries-ts.md +4 -0
  400. package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +4 -0
  401. package/systems/fs/context/authoring/parts/core-types/resources-ts.md +5 -1
  402. package/systems/fs/context/authoring/parts/core-types/run-ts.md +7 -0
  403. package/systems/fs/context/authoring/parts/core-types/sensitivity-ts.md +5 -1
  404. package/systems/fs/context/authoring/parts/core-types/stores-ts.md +199 -0
  405. package/systems/fs/context/authoring/parts/core-types/system-events-ts.md +8 -1
  406. package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +4 -0
  407. package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +4 -0
  408. package/systems/fs/context/authoring/parts/core-types/validation-ts.md +4 -0
  409. package/systems/fs/context/authoring/parts/core-types/visuals-ts.md +4 -0
  410. package/systems/fs/context/authoring/parts/core-types/web-ts.md +4 -0
  411. package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +4 -0
  412. package/systems/fs/context/authoring/parts/core-types.md +12 -2
  413. package/systems/fs/context/authoring/parts/ctx/update-result.md +33 -0
  414. package/systems/fs/context/authoring/parts/ctx.md +11 -1
  415. package/systems/fs/context/authoring/parts/ctx.reference/{hubai.md → adminnotices.md} +45 -4
  416. package/systems/fs/context/authoring/parts/ctx.reference/fnctx.md +21 -23
  417. package/systems/fs/context/authoring/parts/ctx.reference.md +8 -4
  418. package/systems/fs/context/authoring/parts/data.md +11 -6
  419. package/systems/fs/context/authoring/parts/data.reference.md +4 -0
  420. package/systems/fs/context/authoring/parts/examples/client-findview-vue.md +4 -0
  421. package/systems/fs/context/authoring/parts/examples/client-index-ts.md +4 -0
  422. package/systems/fs/context/authoring/parts/examples/client-notecard-vue.md +4 -0
  423. package/systems/fs/context/authoring/parts/examples/client-noteinput-vue.md +4 -0
  424. package/systems/fs/context/authoring/parts/examples/client-notespage-vue.md +4 -0
  425. package/systems/fs/context/authoring/parts/examples/client-reviewform-vue.md +4 -0
  426. package/systems/fs/context/authoring/parts/examples/client-wordcount-vue.md +4 -0
  427. package/systems/fs/context/authoring/parts/examples/package-json.md +4 -0
  428. package/systems/fs/context/authoring/parts/examples/server-env-ts.md +4 -0
  429. package/systems/fs/context/authoring/parts/examples/server-impl-ts.md +4 -0
  430. package/systems/fs/context/authoring/parts/examples/server-index-ts.md +4 -0
  431. package/systems/fs/context/authoring/parts/examples/server-main-ts.md +4 -0
  432. package/systems/fs/context/authoring/parts/examples/server-notes-test-ts.md +4 -0
  433. package/systems/fs/context/authoring/parts/examples/shared-index-ts.md +10 -0
  434. package/systems/fs/context/authoring/parts/examples/system-json.md +4 -0
  435. 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
  436. 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
  437. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-383-567.md +210 -0
  438. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +117 -0
  439. package/systems/fs/context/authoring/parts/examples/tsconfig-json.md +5 -1
  440. package/systems/fs/context/authoring/parts/examples.md +18 -11
  441. package/systems/fs/context/authoring/parts/fns.md +5 -1
  442. package/systems/fs/context/authoring/parts/fns.reference/fillclaims.md +5 -1
  443. package/systems/fs/context/authoring/parts/fns.reference/fn.md +6 -2
  444. package/systems/fs/context/authoring/parts/fns.reference.md +4 -0
  445. package/systems/fs/context/authoring/parts/folder.md +4 -0
  446. package/systems/fs/context/authoring/parts/gin.md +4 -0
  447. package/systems/fs/context/authoring/parts/gin.reference.md +4 -0
  448. package/systems/fs/context/authoring/parts/handlers-progress.md +5 -1
  449. package/systems/fs/context/authoring/parts/handlers-progress.reference.md +4 -0
  450. package/systems/fs/context/authoring/parts/hooks.md +5 -1
  451. package/systems/fs/context/authoring/parts/hooks.reference.md +5 -1
  452. package/systems/fs/context/authoring/parts/hub/context-questions.md +40 -0
  453. package/systems/fs/context/authoring/parts/hub/{hub-run-background.md → hub-ctx-from-resource.md} +51 -56
  454. package/systems/fs/context/authoring/parts/hub/hub-fns-load.md +35 -42
  455. package/systems/fs/context/authoring/parts/hub/hub-install-package.md +327 -0
  456. package/systems/fs/context/authoring/parts/hub/kinds-of-hub.md +8 -0
  457. package/systems/fs/context/authoring/parts/hub.md +14 -8
  458. package/systems/fs/context/authoring/parts/hub.reference.md +9 -0
  459. package/systems/fs/context/authoring/parts/internals/manifestof.md +4 -0
  460. package/systems/fs/context/authoring/parts/internals/permissionargs.md +4 -0
  461. package/systems/fs/context/authoring/parts/internals/usagefromwire.md +47 -2
  462. package/systems/fs/context/authoring/parts/internals.md +6 -2
  463. package/systems/fs/context/authoring/parts/kinds-agents.md +5 -1
  464. package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +4 -0
  465. package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +7 -3
  466. package/systems/fs/context/authoring/parts/kinds-agents.reference.md +4 -0
  467. package/systems/fs/context/authoring/parts/lifecycle.md +8 -3
  468. package/systems/fs/context/authoring/parts/lifecycle.reference.md +6 -2
  469. package/systems/fs/context/authoring/parts/mentions.md +5 -1
  470. package/systems/fs/context/authoring/parts/mentions.reference.md +6 -2
  471. package/systems/fs/context/authoring/parts/mistakes.md +7 -2
  472. package/systems/fs/context/authoring/parts/named-types.md +4 -0
  473. package/systems/fs/context/authoring/parts/named-types.reference.md +6 -2
  474. package/systems/fs/context/authoring/parts/outcomes.md +5 -1
  475. package/systems/fs/context/authoring/parts/outcomes.reference.md +4 -0
  476. package/systems/fs/context/authoring/parts/owner-runs.md +5 -1
  477. package/systems/fs/context/authoring/parts/owner-runs.reference.md +36 -11
  478. package/systems/fs/context/authoring/parts/packaging.md +10 -3
  479. package/systems/fs/context/authoring/parts/packaging.reference.md +7 -2
  480. package/systems/fs/context/authoring/parts/providers.md +5 -1
  481. package/systems/fs/context/authoring/parts/providers.reference.md +5 -1
  482. package/systems/fs/context/authoring/parts/remote.md +5 -1
  483. package/systems/fs/context/authoring/parts/remote.reference.md +4 -0
  484. package/systems/fs/context/authoring/parts/resources.md +5 -1
  485. package/systems/fs/context/authoring/parts/resources.reference.md +4 -0
  486. package/systems/fs/context/authoring/parts/server.md +5 -1
  487. package/systems/fs/context/authoring/parts/server.reference.md +41 -20
  488. package/systems/fs/context/authoring/parts/settings-attachments.md +5 -1
  489. package/systems/fs/context/authoring/parts/settings-attachments.reference.md +4 -0
  490. package/systems/fs/context/authoring/parts/start.md +5 -1
  491. package/systems/fs/context/authoring/parts/state-forms.md +5 -1
  492. package/systems/fs/context/authoring/parts/state-forms.reference.md +4 -0
  493. package/systems/fs/context/authoring/parts/store/ctx-store.md +49 -0
  494. package/systems/fs/context/authoring/parts/store/declare.md +32 -0
  495. package/systems/fs/context/authoring/parts/store/engines.md +25 -0
  496. package/systems/fs/context/authoring/parts/store/migrations.md +53 -0
  497. package/systems/fs/context/authoring/parts/store/moves.md +38 -0
  498. package/systems/fs/context/authoring/parts/store/placement.md +25 -0
  499. package/systems/fs/context/authoring/parts/store/serve.md +30 -0
  500. package/systems/fs/context/authoring/parts/store/store-tables.md +24 -0
  501. package/systems/fs/context/authoring/parts/store/vectors.md +32 -0
  502. package/systems/fs/context/authoring/parts/store/when-to-use.md +27 -0
  503. package/systems/fs/context/authoring/parts/store/work.md +37 -0
  504. package/systems/fs/context/authoring/parts/store.md +65 -0
  505. package/systems/fs/context/authoring/parts/store.reference.md +459 -0
  506. package/systems/fs/context/authoring/parts/testing.md +14 -1
  507. package/systems/fs/context/authoring/parts/testing.reference/{memoryjournal.md → equal.md} +55 -48
  508. package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +26 -45
  509. package/systems/fs/context/authoring/parts/testing.reference/{toolcall.md → kindprops.md} +111 -4
  510. package/systems/fs/context/authoring/parts/testing.reference/openmemorystore.md +105 -0
  511. package/systems/fs/context/authoring/parts/testing.reference.md +16 -9
  512. package/systems/fs/context/authoring/parts/widgets.md +5 -1
  513. package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +4 -0
  514. package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +4 -0
  515. package/systems/fs/context/authoring/parts/widgets.reference.md +4 -0
  516. package/systems/fs/context/authoring/topics/begin.md +4 -0
  517. package/systems/fs/context/authoring/topics/client.md +4 -0
  518. package/systems/fs/context/authoring/topics/declare.md +4 -0
  519. package/systems/fs/context/authoring/topics/examples.md +4 -0
  520. package/systems/fs/context/authoring/topics/fns.md +4 -0
  521. package/systems/fs/context/authoring/topics/server.md +4 -0
  522. package/systems/fs/context/authoring/topics/types.md +8 -1
  523. package/systems/fs/context/comments/answer.md +21 -0
  524. package/systems/fs/context/comments/find.md +23 -0
  525. package/systems/fs/context/comments/read.md +26 -0
  526. package/systems/fs/context/comments.md +23 -0
  527. package/systems/fs/context/files-page.md +30 -0
  528. package/systems/fs/context/guide/attachments.md +16 -0
  529. package/systems/fs/context/guide/change.md +23 -0
  530. package/systems/fs/context/guide/commands.md +19 -0
  531. package/systems/fs/context/guide/documents.md +21 -0
  532. package/systems/fs/context/guide/find.md +25 -0
  533. package/systems/fs/context/guide/paths.md +24 -0
  534. package/systems/fs/context/guide/read.md +21 -0
  535. package/systems/fs/context/machine/history.md +25 -0
  536. package/systems/fs/context/machine/now.md +25 -0
  537. package/systems/fs/context/machine/processes.md +20 -0
  538. package/systems/fs/context/machine/recording.md +19 -0
  539. package/systems/fs/context/machine.md +24 -0
  540. package/systems/fs/package.json +5 -3
  541. package/systems/fs/server/files-page/browse.ts +391 -0
  542. package/systems/fs/server/files-page/comments.ts +439 -0
  543. package/systems/fs/server/files-page/fns.ts +158 -0
  544. package/systems/fs/server/files-page/git-view.ts +391 -0
  545. package/systems/fs/server/files-page/kinds.ts +56 -0
  546. package/systems/fs/server/impl.ts +66 -7
  547. package/systems/fs/server/main.ts +20 -4
  548. package/systems/fs/server/metrics/collector.ts +424 -0
  549. package/systems/fs/server/metrics/index.ts +181 -0
  550. package/systems/fs/server/metrics/os.ts +144 -0
  551. package/systems/fs/server/metrics/parsers.ts +268 -0
  552. package/systems/fs/server/metrics/rrd.ts +363 -0
  553. package/systems/fs/server/metrics/testing.ts +80 -0
  554. package/systems/fs/server/snapshots.ts +216 -33
  555. package/systems/fs/server/testing.ts +15 -9
  556. package/systems/fs/shared/files-page.ts +506 -0
  557. package/systems/fs/shared/index.ts +137 -10
  558. package/systems/fs/shared/metrics.ts +179 -0
  559. package/systems/fs/system.json +10 -1
  560. package/systems/google-calendar/package.json +1 -1
  561. package/systems/input/package.json +3 -3
  562. package/systems/mcp/package.json +3 -3
  563. package/systems/mcp/server/oauth.ts +1 -1
  564. package/systems/ollama/package.json +3 -3
  565. package/systems/schedule/package.json +3 -4
  566. package/systems/schedule/server/env.ts +1 -1
  567. package/systems/schedule/server/fns.ts +5 -4
  568. package/systems/schedule/server/impl.ts +2 -2
  569. package/systems/schedule/server/import.ts +189 -0
  570. package/systems/schedule/server/index.ts +2 -0
  571. package/systems/schedule/server/main.ts +3 -1
  572. package/systems/schedule/server/placements.ts +41 -0
  573. package/systems/schedule/server/store.ts +159 -79
  574. package/systems/schedule/server/timer.ts +142 -107
  575. package/systems/schedule/shared/index.ts +2 -1
  576. package/systems/schedule/system.json +5 -1
  577. package/systems/schedule/tsconfig.json +1 -1
  578. package/systems/template/package.json +1 -1
  579. package/systems/widgets/package.json +3 -3
  580. package/packages/web/dist/assets/ChatPage-7Yebk7rl.js +0 -4
  581. package/packages/web/dist/assets/ContextItemPage-B6rJG3OT.js +0 -2
  582. package/packages/web/dist/assets/ContextItemPage-BRsWxOmu.css +0 -1
  583. package/packages/web/dist/assets/ContextPage-CloIZ_2y.js +0 -2
  584. package/packages/web/dist/assets/ContextPage-rYKxjiVI.css +0 -1
  585. package/packages/web/dist/assets/ContextRow-Byz_7HG-.css +0 -1
  586. package/packages/web/dist/assets/ContextRow-Dvv8CTFk.js +0 -2
  587. package/packages/web/dist/assets/DataTypePage-Ba_zBV4b.js +0 -4
  588. package/packages/web/dist/assets/FnView-B8MGAOoB.js +0 -2
  589. package/packages/web/dist/assets/InstallDialog-C9GDoUI2.js +0 -2
  590. package/packages/web/dist/assets/InstanceTypes-D8Jcxn70.js +0 -2
  591. package/packages/web/dist/assets/InstanceTypes-DAowwLB7.css +0 -1
  592. package/packages/web/dist/assets/InstanceView-CuBD3JPU.css +0 -1
  593. package/packages/web/dist/assets/InstanceView-p7tMaylE.js +0 -2
  594. package/packages/web/dist/assets/LimitsView-DsZG6u5P.js +0 -2
  595. package/packages/web/dist/assets/ListSearch-BK4p7Nxa.js +0 -2
  596. package/packages/web/dist/assets/McpServerView-CD8qw6W_.js +0 -2
  597. package/packages/web/dist/assets/McpServersView-DNycG35u.js +0 -2
  598. package/packages/web/dist/assets/ModelsView-C_iN19xt.js +0 -2
  599. package/packages/web/dist/assets/PairPage-Bs2KuRjC.css +0 -1
  600. package/packages/web/dist/assets/PairPage-TEXPpsqi.js +0 -2
  601. package/packages/web/dist/assets/PoliciesView-BU1fudNF.js +0 -2
  602. package/packages/web/dist/assets/ResourcesPage-YluNBqIv.js +0 -2
  603. package/packages/web/dist/assets/ReviewView-79Z5rU1v.js +0 -3
  604. package/packages/web/dist/assets/RunsView-Dz9Xsvu5.js +0 -2
  605. package/packages/web/dist/assets/ServiceRows-DNzDiutg.js +0 -2
  606. package/packages/web/dist/assets/SettingsPage-CykfuYj1.js +0 -3
  607. package/packages/web/dist/assets/SystemView-Es5wtkYU.js +0 -2
  608. package/packages/web/dist/assets/SystemsView-CeuSFhlF.js +0 -2
  609. package/packages/web/dist/assets/UserMessage-qyc8dG5D.js +0 -9
  610. package/packages/web/dist/assets/WidgetView-BZyDyYRI.js +0 -3
  611. package/packages/web/dist/assets/index-Bv42jNvr.js +0 -4
  612. package/packages/web/dist/assets/routes-qP_j74V5.js +0 -4
  613. package/packages/web/dist/assets/runs-k76usGfd.js +0 -2
  614. package/packages/web/dist/assets/src-DLK1P7oz.js +0 -43
  615. package/packages/web/dist/assets/state-CjE-qA2w.js +0 -2
  616. package/packages/web/dist/assets/ui-W12UYhVu.js +0 -17
  617. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-371-533.md +0 -183
  618. package/systems/fs/context/authoring/parts/hub/hub-auto-pair-revoke.md +0 -189
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # fnloom: installing and running it
2
2
 
3
3
  fnloom is a web-based agent harness: one **hub** that owns every model call, person, permission and record, and
4
- **systems** that connect to it to add fns (tools), types, resources and screens. It runs on your own computer; you
4
+ **systems** that connect to it to add fns, types, resources and screens. It runs on your own computer; you
5
5
  use it from a browser on that computer, or from a phone or another computer on the same network.
6
6
 
7
7
  This page covers installing it from npm, starting it, signing in and installing the premade systems. For working on
@@ -40,7 +40,7 @@ It starts the hub, the app and the lightweight premade systems (fs, input, code,
40
40
  start it makes the admin account and prints everything you need:
41
41
 
42
42
  ```text
43
- The harness is running.
43
+ fnloom is running.
44
44
  Open: http://127.0.0.1:4300
45
45
  Or: http://192.168.1.20:4300 (a phone on this network: https://192.168.1.20:4300, see Settings > App)
46
46
  Sign in: admin@harness.local
@@ -48,7 +48,7 @@ The harness is running.
48
48
  fs serves: /home/you/projects
49
49
  ```
50
50
 
51
- Open the address, sign in with that email and password, and add a model provider under **Models › Providers** (or
51
+ Open the address, sign in with that email and password, and add a model provider under **Admin › Models › Add provider** (or
52
52
  set `OPENROUTER_API_KEY` before the first start, and the hub configures OpenRouter itself). Ctrl+C stops everything;
53
53
  `fnloom start` again picks up where it left off.
54
54
 
@@ -67,6 +67,12 @@ for your review.
67
67
  | | `HARNESS_ADMIN_EMAIL`, `HARNESS_ADMIN_PASSWORD` | made on the first start | your own admin account instead of the generated one (set before the first start) |
68
68
  | | `OPENROUTER_API_KEY` | none | configures the OpenRouter provider on the first start |
69
69
  | | `HARNESS_DEFAULT_MODEL` | `openrouter/auto` | the chat agent's model until an admin picks one |
70
+ | | `HARNESS_DECIDE_MODEL` | none | the decision model (fast typed yes/no and choice answers), e.g. `typesafe/jev-1.14` on OpenRouter; used for duplicate checks, suggestions and plans |
71
+ | | `HARNESS_PLAN_MODEL` | none | the model plans (`hub/ctx_plan`) write their questions and options with, e.g. `anthropic/claude-haiku-5.5` |
72
+ | | `HARNESS_METADATA_MODEL` | the decision model if it can write text, else the chat model | the model that fills in each context item's question, when and the rest |
73
+
74
+ Each of these is only the starting choice: an admin can change any of them under **Admin › Models › Roles**, which
75
+ also shows which fallback a role is using and why.
70
76
 
71
77
  Settings can be in the environment or in a `.env` file in the folder you start in. Every other hub setting is listed
72
78
  in `.env.example` in the repository.
@@ -129,7 +135,19 @@ A system that needs config and was installed without it connects and waits: fill
129
135
  The config each one takes:
130
136
 
131
137
  - **schedule**: nothing (it starts with `fnloom start`). Its limits (schedules per person, firings per day, the
132
- shortest gap between firings) all have defaults; change them on its page in the app.
138
+ shortest gap between firings) all have defaults; change them on its page in the app. Its timer (what it knows of
139
+ each schedule, its recent firings, and the queue of firings coming next) is in its store: a SQLite file in its data
140
+ folder (`store/store.db`) unless its store was put on the hub or in Postgres or SQL Server. An older version kept
141
+ these in `schedule.db` in the same folder; the first start with the store brings that file's schedules, firings and
142
+ queued firings in and renames it `schedule.db.imported`, which you can delete once schedules run as before.
143
+ - **fs**: nothing (it starts with `fnloom start`, serving the folder it started in, or `--root`, as one root named
144
+ after that folder, or `files` for a drive's root; a data folder made before keeps its root's name). Its undo snapshots
145
+ (the copy of a file taken before each write, edit or remove) stay files in its data folder (`snapshots/`), pruned by
146
+ its `snapshots` limits; their index (which file each copy was of, and when) is in its store, like schedule's. An
147
+ older version's `snapshots/index.json` is brought in on the first start and renamed `index.json.imported`.
148
+ To see a machine on the **Machines** page (and let the agent read it with `fs/metrics_read`), tick
149
+ `metrics.record` in that fs instance's config: it then records CPU, memory, drives, network, disk and GPU into its
150
+ store (written once a minute; `metrics.syncEvery` changes that), off until an admin turns it on.
133
151
  - **database**: one instance per database; the first install also installs **widgets** (charts and tables over its
134
152
  queries) when the hub doesn't have it. Installing widgets on its own works too, and says it wants database. For a
135
153
  new SQLite file in the system's data folder:
@@ -157,7 +175,10 @@ The config each one takes:
157
175
  - **google-calendar**: a Google OAuth client (a "Web application" client) with `<hub>/connect/callback` among its
158
176
  redirect URIs: `{ "clientId": "…", "clientSecret": "…", "hubUrl": "http://127.0.0.1:4300" }`. Each person then
159
177
  connects their own calendar on the Calendar page.
160
- - **embedder**: an EmbeddingGemma service: `{ "url": "http://127.0.0.1:8760" }`.
178
+ - **embedder**: an EmbeddingGemma service: `{ "url": "http://127.0.0.1:8760" }`. Search by meaning, suggestions
179
+ and plans (`hub/ctx_plan`) need an embedder, and an embedder only ever comes from a system: this one, or ollama
180
+ with an embedding model (name it in `HARNESS_EMBEDDER_DOCUMENT` and `HARNESS_EMBEDDER_QUERY` as `<system>/<model>`).
181
+ A provider set up under **Models** (OpenRouter, OpenAI) never gives the index an embedder.
161
182
  - **ollama**: an Ollama that already runs, `{ "server": { "mode": "url", "url": "http://127.0.0.1:11434" } }`, or
162
183
  one it installs and runs itself in its data folder once an admin approves:
163
184
  `{ "server": { "mode": "managed", "autoStart": false } }`.
@@ -166,10 +187,86 @@ The config each one takes:
166
187
  - **mcp**: nothing to install by hand: add each MCP server under **Admin › MCP servers** (stdio, HTTP or SSE), and the
167
188
  hub runs one instance of the mcp system for it.
168
189
 
190
+ ### A system's own store
191
+
192
+ Some systems keep a small database of their own (a **store**: schedule's timers, for one). Where it lives is chosen
193
+ when the system is installed: with the system (the default, a SQLite file in its data folder), on the hub (a file in
194
+ the hub's data folder, so it is in the hub's backups), or in a Postgres or SQL Server database you name, in a schema
195
+ of its own. **Admin › Systems › <name> › Storage** shows where it is, its size, tables and migrations, and its
196
+ backups; `fnloom system store <name>` shows the same.
197
+
198
+ **Moving it.** On the Storage panel, or:
199
+
200
+ ```sh
201
+ fnloom system store move <name> --to hub
202
+ fnloom system store move <name> --to system
203
+ fnloom system store move <name> --to external --engine postgres --url - --schema <schema> # the URL on stdin
204
+ ```
205
+
206
+ (`--url` also reads `HARNESS_STORE_URL`; a URL on the command line can be seen by other programs on the machine.)
207
+ While it moves, the system's work waits (each call up to two minutes). Runs still going get a minute to finish; if
208
+ some are still going after that, the move waits for you to cancel them or keep waiting (on the panel, or
209
+ `fnloom system store answer <name> cancel|wait`); `--cancel-runs` or `--keep-waiting` answers in advance. The old copy
210
+ is kept as a backup until you delete it on the panel. A move that fails part-way changes nothing: the store stays
211
+ where it was and the panel says why. The target must be empty, and a store with vectors needs a database that can
212
+ hold them (pgvector on Postgres, SQL Server 2025); the move is refused up front otherwise.
213
+
214
+ **Removing a system** asks whether to keep its store, and keeps it unless you say otherwise
215
+ (`fnloom system uninstall <name> --delete-store` deletes it). A kept store is listed as a backup, and installing the
216
+ same system (and instance) again with the same placement picks it up where it was. Deleting removes the hub's file or
217
+ the system's store folder. An external database is never dropped by the hub: its tables stay in their schema, for
218
+ you to drop when you want them gone.
219
+
169
220
  You can also install a system from a folder (`fnloom system install ./my-system`), a package zip made by
170
221
  `fnloom system pack`, or npm (`fnloom system install some-system@1.0.0`). `fnloom system new <name>` starts a new
171
222
  one from the template.
172
223
 
224
+ ### Where a system keeps its data
225
+
226
+ Some systems keep a small database of their own (a store): schedule's timers, say. When you install one you choose
227
+ where that store lives. Each instance of a system gets its own.
228
+
229
+ | Choice | What it means |
230
+ |---|---|
231
+ | **With the system** (the default) | A SQLite file in the system's own data folder, on the machine it runs on. Fast, and nothing to set up. It goes if the system's folder is deleted. |
232
+ | **On the hub** | A SQLite file in the hub's data folder (`<data>/stores/<system>/<instance>.db`), beside the hub's own data and in its backups. It stays if the system is removed or reinstalled. A system on another machine reaches it over the network. |
233
+ | **External database** | A Postgres or SQL Server database you run, in a schema you name. You look after it and its backups; the hub never drops it. |
234
+
235
+ In the app the install dialog, and the pairing page for a system that asks to pair, ask "Where should <system> keep
236
+ its data?" with **With the system** picked. For an external database you give the engine, the connection URL
237
+ (`postgres://user:password@host:5432/database`, `sqlserver://user:password@host:1433/database?encrypt=true`) and the
238
+ schema. The hub keeps the connection sealed as a secret and never shows it again.
239
+
240
+ From the command line:
241
+
242
+ ```sh
243
+ fnloom system install <name> --store system # the default
244
+ fnloom system install <name> --store hub
245
+ fnloom system install <name> --store external --store-engine postgres --store-url-env NOTES_DB --store-schema notes
246
+ ```
247
+
248
+ `--store-url-env <VAR>` reads the connection URL from that environment variable. `--store-url <url>` works too, but
249
+ it puts the database password in your shell history, and the command warns about it.
250
+
251
+ Only some systems keep a store (database, for one, keeps none). For a system the hub already knows keeps none,
252
+ `--store hub` or `--store external` is refused; for one the hub hasn't seen yet, the install says
253
+ "<name> keeps no store of its own; --store was ignored" once the system connects.
254
+
255
+ The base install leaves out the Postgres and SQL Server drivers, to stay small. When you put a store in one of them
256
+ (at install, or by moving it there), the hub installs that database's driver (`pg`, or `tedious` and `tarn`) with npm
257
+ into `<data>/store-drivers` (`HARNESS_STORE_DRIVERS_DIR`), once, and the systems it starts load it from there. This
258
+ needs the machine to reach the npm registry; if the install fails, the hub refuses the placement and says how to
259
+ install the driver by hand. A system installed from a package zip brings its own drivers.
260
+
261
+ A system whose store keeps vectors (for searching by meaning) needs an engine that can hold them: SQLite always
262
+ can; Postgres needs the pgvector extension (`CREATE EXTENSION vector`), and SQL Server needs SQL Server 2025 or
263
+ newer. The hub refuses an engine the system's store doesn't accept, and says why.
264
+
265
+ **Admin › Systems › <name> › Storage** shows where the store lives and on what engine, its size, each table's row
266
+ count, its state (preparing, migrating, ready, moving, or failed with the error), its migrations (applied with when,
267
+ pending, and the one that failed), and the snapshots taken before migrations ran. While a store isn't ready the hub
268
+ holds calls to the system for up to 2 minutes, and the panel says so.
269
+
173
270
  ## Updating and removing
174
271
 
175
272
  - Update: stop it (Ctrl+C), `npm install -g fnloom@latest`, start it again. Your data folder stays as it is.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fnloom",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A web-based agent harness you run yourself: one hub that owns every model call, person and permission, and systems that add fns, types, resources and screens.",
5
5
  "keywords": [
6
6
  "agent",
@@ -27,16 +27,16 @@
27
27
  "postinstall": "node scripts/release/link.cjs"
28
28
  },
29
29
  "dependencies": {
30
- "@aeye/ai": "0.10.1",
31
- "@aeye/aws": "0.10.1",
32
- "@aeye/core": "0.10.1",
33
- "@aeye/gin": "0.10.1",
34
- "@aeye/models": "0.10.1",
35
- "@aeye/ollama": "0.10.1",
36
- "@aeye/openai": "0.10.1",
37
- "@aeye/openrouter": "0.10.1",
38
- "@aeye/resources": "0.10.1",
39
- "@aeye/schema": "0.10.1",
30
+ "@aeye/ai": "0.10.2",
31
+ "@aeye/aws": "0.10.2",
32
+ "@aeye/core": "0.10.2",
33
+ "@aeye/gin": "0.10.2",
34
+ "@aeye/models": "0.10.2",
35
+ "@aeye/ollama": "0.10.2",
36
+ "@aeye/openai": "0.10.2",
37
+ "@aeye/openrouter": "0.10.2",
38
+ "@aeye/resources": "0.10.2",
39
+ "@aeye/schema": "0.10.2",
40
40
  "@ayepi/auth": "0.6.0",
41
41
  "@ayepi/cache": "0.6.0",
42
42
  "@ayepi/codec": "0.6.0",
@@ -56,6 +56,7 @@
56
56
  "@vitejs/plugin-vue": "6.0.10",
57
57
  "better-sqlite3": "12.11.1",
58
58
  "dayspan": "1.3.0",
59
+ "echarts": "6.1.0",
59
60
  "js-yaml": "4.3.2",
60
61
  "jszip": "3.10.2",
61
62
  "kysely": "0.28.19",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@aeye/gin": "^0.10.1",
3
+ "@aeye/gin": "^0.10.2",
4
4
  "@harness/core": "*",
5
5
  "@harness/sdk": "*",
6
6
  "typescript": "~5.9",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "name": "@harness/build",
11
11
  "private": true,
12
- "version": "0.2.0",
12
+ "version": "0.3.0",
13
13
  "license": "Apache-2.0",
14
14
  "type": "module",
15
15
  "description": "Building systems: typecheck, a self-contained server bundle, client renderers, the context folder check and the bundle scan. Shared by the CLI and fs.",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "name": "@harness/cli",
15
15
  "private": true,
16
- "version": "0.2.0",
16
+ "version": "0.3.0",
17
17
  "license": "Apache-2.0",
18
18
  "type": "module",
19
19
  "description": "The harness CLI: make, build, pack and install systems, export their data, and bridge a hub MCP to stdio.",
@@ -11,6 +11,7 @@ import { buildCommand } from './commands/build.ts';
11
11
  import { exportDataCommand } from './commands/data.ts';
12
12
  import { installCommand } from './commands/install.ts';
13
13
  import { listCommand, startCommand, stopCommand, uninstallCommand, upgradeCommand } from './commands/manage.ts';
14
+ import { storeAnswerCommand, storeCommand, storeMoveCommand } from './commands/store.ts';
14
15
  import { mcpCommand } from './commands/mcp.ts';
15
16
  import { newCommand } from './commands/new.ts';
16
17
  import { packCommand } from './commands/pack.ts';
@@ -21,7 +22,7 @@ import { CLI_NAME } from './local.ts';
21
22
  /** Every command, in the order help lists them. */
22
23
  export const COMMANDS = [
23
24
  startHarnessCommand, availableCommand, newCommand, buildCommand, testCommand, packCommand, installCommand, exportDataCommand, listCommand, startCommand, stopCommand, upgradeCommand, uninstallCommand,
24
- mcpCommand,
25
+ storeCommand, storeMoveCommand, storeAnswerCommand, mcpCommand,
25
26
  ] as const satisfies readonly CliCommand[];
26
27
 
27
28
  /** A command's call as people type it: `harness system build [dir] [--skip-typecheck]`. */
@@ -22,6 +22,8 @@ export interface CliOutput {
22
22
  export interface CliIo {
23
23
  readonly out: CliOutput;
24
24
  readonly files: CliFiles;
25
+ /** The process's environment (`--store-url-env` reads a variable from it). */
26
+ readonly env: Readonly<Record<string, string | undefined>>;
25
27
  /** The folder relative paths are read against. */
26
28
  readonly cwd: string;
27
29
  /** Builds systems (typecheck, bundle, client). */
@@ -8,9 +8,15 @@
8
8
  * folder). A premade system installed by name goes live, and brings the systems `premade.ts` says go with it
9
9
  * (database brings widgets). Anything else is an npm package (`name@version`; give a version, `database@latest`, for
10
10
  * an npm package named like a premade system). It then waits for the system to connect and says where it got to.
11
+ *
12
+ * `--store system|hub|external` says where a system that keeps its own store keeps it: with the system (the default),
13
+ * on the hub, or in an external Postgres or SQL Server database (`--store-engine`, `--store-schema`, and the
14
+ * connection URL from `--store-url-env <VAR>`, or `--store-url <url>`, which lands in shell history). For a system that
15
+ * keeps no store, the hub refuses a place for one when it knows the contract already; otherwise the install says, once
16
+ * the system connects, that `--store` was ignored.
11
17
  */
12
18
  import { basename, resolve } from 'node:path';
13
- import { InstanceName, Json, SystemName, instanceLabel, type InstallSource, type SystemStatus } from '@harness/core';
19
+ import { ExternalEngine, InstanceName, Json, StorePlacementInput, StoreSchema, SystemName, instanceLabel, type InstallSource, type SystemStatus } from '@harness/core';
14
20
  import { z } from 'zod';
15
21
  import { HUB_OPTIONS, command, type CliIo } from '../command.ts';
16
22
  import type { HubSession } from '../hub.ts';
@@ -58,6 +64,51 @@ export async function waitForSystem(io: CliIo, hub: HubSession, target: { system
58
64
  }
59
65
  }
60
66
 
67
+ /** The `--store` choices: with the system (the default), on the hub, or an external database. */
68
+ export const StoreFlag = z.enum(['system', 'hub', 'external']);
69
+
70
+ /** The `--store-*` options, as parsed. */
71
+ export interface StoreFlags {
72
+ readonly store?: z.infer<typeof StoreFlag> | undefined;
73
+ readonly 'store-engine'?: z.infer<typeof ExternalEngine> | undefined;
74
+ readonly 'store-url'?: string | undefined;
75
+ readonly 'store-url-env'?: string | undefined;
76
+ readonly 'store-schema'?: string | undefined;
77
+ }
78
+
79
+ /** What reading the `--store-*` options gave: a placement (none when `--store` wasn't given), or why not. */
80
+ export type StoreFlagsRead = { readonly ok: true; readonly store?: StorePlacementInput; readonly warnings: readonly string[] } | { readonly ok: false; readonly problem: string };
81
+
82
+ /** What a `--store-url` on the command line is warned about. */
83
+ export const STORE_URL_HISTORY = '--store-url puts the database password in your shell history: prefer --store-url-env <VAR>, with the URL in that environment variable.';
84
+
85
+ /**
86
+ * Read the `--store-*` options into the placement `installSystem` and `installPackage` take. `--store external` needs
87
+ * an engine, a connection (`--store-url`, or `--store-url-env` naming the environment variable that holds it) and a
88
+ * schema; the other placements take none of them. A URL typed on the command line works, with a warning.
89
+ */
90
+ export function storePlacement(flags: StoreFlags, env: Readonly<Record<string, string | undefined>>): StoreFlagsRead {
91
+ const externalOnly = flags['store-engine'] !== undefined || flags['store-url'] !== undefined || flags['store-url-env'] !== undefined || flags['store-schema'] !== undefined;
92
+ if (flags.store === undefined) {
93
+ return externalOnly ? { ok: false, problem: '--store-engine, --store-url, --store-url-env and --store-schema go with --store external' } : { ok: true, warnings: [] };
94
+ }
95
+ if (flags.store !== 'external') {
96
+ return externalOnly ? { ok: false, problem: `--store ${flags.store} takes no --store-engine, --store-url or --store-schema: those are for --store external` } : { ok: true, store: { placement: flags.store }, warnings: [] };
97
+ }
98
+ const engine = flags['store-engine'];
99
+ if (engine === undefined) { return { ok: false, problem: '--store external needs --store-engine postgres or --store-engine sqlserver' }; }
100
+ if (flags['store-url'] !== undefined && flags['store-url-env'] !== undefined) { return { ok: false, problem: 'give the connection once: --store-url or --store-url-env, not both' }; }
101
+ const variable = flags['store-url-env'];
102
+ const connection = variable === undefined ? flags['store-url'] : env[variable];
103
+ if (variable !== undefined && (connection === undefined || connection === '')) { return { ok: false, problem: `--store-url-env ${variable}: that environment variable is not set` }; }
104
+ if (connection === undefined) { return { ok: false, problem: '--store external needs its connection: --store-url-env <VAR> (or --store-url <url>)' }; }
105
+ const schema = StoreSchema.safeParse(flags['store-schema']);
106
+ if (flags['store-schema'] === undefined) { return { ok: false, problem: '--store external needs --store-schema <schema>, the schema its tables go in' }; }
107
+ if (!schema.success) { return { ok: false, problem: `--store-schema: ${schema.error.issues[0]?.message ?? 'not a schema name'}` }; }
108
+ const store = StorePlacementInput.parse({ placement: 'external', engine, connection, schema: schema.data });
109
+ return { ok: true, store, warnings: variable === undefined ? [STORE_URL_HISTORY] : [] };
110
+ }
111
+
61
112
  /** One install: where from, and what goes with it. */
62
113
  interface Install {
63
114
  /** A zip, a folder or an npm spec, resolved. */
@@ -67,26 +118,55 @@ interface Install {
67
118
  readonly instance?: InstanceName | undefined;
68
119
  readonly data?: string | undefined;
69
120
  readonly autoStart: boolean;
121
+ /** Where its store lives (`--store`), for a system that keeps one. */
122
+ readonly store?: StorePlacementInput | undefined;
70
123
  }
71
124
 
72
125
  /** Install one system on the hub; says what it installed. */
73
126
  async function installOne(io: CliIo, hub: HubSession, install: Install, spec: string): Promise<{ system: SystemName; instance?: InstanceName }> {
74
- const { config, instance, autoStart } = install;
127
+ const { config, instance, autoStart, store } = install;
128
+ const placed = store === undefined ? {} : { store };
75
129
  if (install.kind === 'zip') {
76
130
  const zip = await uploadFile(io, hub, install.path);
77
131
  const data = install.data === undefined ? undefined : await uploadFile(io, hub, resolve(io.cwd, install.data));
78
132
  const ref = await hub.api.call('installPackage', {
79
- zip, autoStart, ...(instance === undefined ? {} : { instance }), ...(config === undefined ? {} : { config }), ...(data === undefined ? {} : { data }),
133
+ zip, autoStart, ...(instance === undefined ? {} : { instance }), ...(config === undefined ? {} : { config }), ...(data === undefined ? {} : { data }), ...placed,
80
134
  });
81
135
  io.out.line(`installed ${ref.system}@${ref.instance}`);
82
136
  return ref;
83
137
  }
84
138
  const source: InstallSource = install.kind === 'folder' ? { path: install.path } : npmSpec(spec);
85
- const installed = { system: (await hub.api.call('installSystem', { source, autoStart, ...(config === undefined ? {} : { config }) })).name };
139
+ const installed = { system: (await hub.api.call('installSystem', { source, autoStart, ...(config === undefined ? {} : { config }), ...placed })).name };
86
140
  io.out.line(`installed ${installed.system}`);
87
141
  return installed;
88
142
  }
89
143
 
144
+ /** What the hub knows of a system's store: it keeps one, it keeps none, or its contract hasn't reached the hub. */
145
+ async function storeOf(hub: HubSession, system: SystemName): Promise<'keeps' | 'none' | 'unknown'> {
146
+ const view = await hub.api.call('system', { system }).catch(() => undefined);
147
+ if (view === undefined || view.manifestHash === '') { return 'unknown'; }
148
+ return view.store === undefined ? 'none' : 'keeps';
149
+ }
150
+
151
+ /** What `--store` is warned with for a system whose contract, once it arrived, keeps no store. */
152
+ export function storeIgnored(system: string): string {
153
+ return `${system} keeps no store of its own; --store was ignored`;
154
+ }
155
+
156
+ /**
157
+ * Once an installed system that was given `--store` is connected: when its contract keeps no store, say the flag did
158
+ * nothing (a contract the hub knew before the install is refused by the hub instead). Waits up to `wait` for it.
159
+ */
160
+ async function warnIfNoStore(io: CliIo, hub: HubSession, system: SystemName, wait: number): Promise<void> {
161
+ const deadline = Date.now() + wait;
162
+ for (;;) {
163
+ const store = await storeOf(hub, system);
164
+ if (store === 'none') { io.out.warn(storeIgnored(system)); return; }
165
+ if (store === 'keeps' || Date.now() >= deadline) { return; }
166
+ await io.sleep(500);
167
+ }
168
+ }
169
+
90
170
  /** Wait for a premade system to connect, then put it live; false when it didn't get there. */
91
171
  async function connectAndGoLive(io: CliIo, hub: HubSession, installed: { system: SystemName; instance?: InstanceName | undefined }, wait: number): Promise<boolean> {
92
172
  if (!await waitForSystem(io, hub, installed, wait)) { return false; }
@@ -101,7 +181,8 @@ async function connectAndGoLive(io: CliIo, hub: HubSession, installed: { system:
101
181
  export const installCommand = command({
102
182
  path: ['system', 'install'],
103
183
  summary: 'Install a package zip, a folder, a premade system by name or an npm package on a hub, which pairs, configures and starts it.',
104
- usage: '<zip | folder | premade-name | npm-spec> [--config <file.json>] [--instance <name>] [--data <export.zip>] [--no-start] [--wait <ms>]',
184
+ usage: '<zip | folder | premade-name | npm-spec> [--config <file.json>] [--instance <name>] [--data <export.zip>] [--no-start] [--wait <ms>] '
185
+ + '[--store system|hub|external [--store-engine postgres|sqlserver --store-url-env <VAR> | --store-url <url> --store-schema <schema>]]',
105
186
  args: z.object({
106
187
  positionals: z.tuple([z.string().min(1)]),
107
188
  values: z.object({
@@ -111,9 +192,18 @@ export const installCommand = command({
111
192
  data: z.string().optional(),
112
193
  'no-start': z.boolean().default(false),
113
194
  wait: z.string().regex(/^\d+$/).optional(),
195
+ // where the system keeps its own data, for one that keeps a store: with the system unless given
196
+ store: StoreFlag.optional(),
197
+ 'store-engine': ExternalEngine.optional(),
198
+ 'store-url': z.string().min(1).optional(),
199
+ 'store-url-env': z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'an environment variable name').optional(),
200
+ 'store-schema': z.string().optional(),
114
201
  }),
115
202
  }),
116
203
  async run({ positionals: [target], values }, io) {
204
+ const placement = storePlacement(values, io.env);
205
+ if (!placement.ok) { io.out.warn(placement.problem); return 1; }
206
+ for (const warning of placement.warnings) { io.out.warn(warning); }
117
207
  const given = resolve(io.cwd, target);
118
208
  const stat = await io.files.stat(given);
119
209
  // a bare name that is no file or folder here, but names a premade system: that system's folder or package zip
@@ -141,7 +231,8 @@ export const installCommand = command({
141
231
  for (const name of about?.with ?? []) {
142
232
  if (!await isInstalled(hub, name)) { along.push(name); }
143
233
  }
144
- const installed = await installOne(io, hub, { path, kind, config, instance, data: values.data, autoStart }, target);
234
+ // the placement is the named system's; what goes along with it keeps its store with itself
235
+ const installed = await installOne(io, hub, { path, kind, config, instance, data: values.data, autoStart, store: placement.store }, target);
145
236
  const companions: Array<{ system: SystemName }> = [];
146
237
  for (const name of along) {
147
238
  const where = await bundledSystem(io, name);
@@ -156,8 +247,13 @@ export const installCommand = command({
156
247
  if (missing.length > 0) { io.out.line(about.note.replaceAll('harness system', `${CLI_NAME} system`)); }
157
248
  }
158
249
  if (!autoStart) { return 0; }
159
- if (premade === undefined) { return await waitForSystem(io, hub, installed, wait) ? 0 : 1; }
250
+ if (premade === undefined) {
251
+ const connected = await waitForSystem(io, hub, installed, wait);
252
+ if (connected && placement.store !== undefined) { await warnIfNoStore(io, hub, installed.system, wait); }
253
+ return connected ? 0 : 1;
254
+ }
160
255
  let ok = await connectAndGoLive(io, hub, installed, wait);
256
+ if (ok && placement.store !== undefined) { await warnIfNoStore(io, hub, installed.system, wait); }
161
257
  for (const companion of companions) { ok = await connectAndGoLive(io, hub, companion, wait) && ok; }
162
258
  return ok ? 0 : 1;
163
259
  } finally {
@@ -88,16 +88,18 @@ export const upgradeCommand = command({
88
88
 
89
89
  export const uninstallCommand = command({
90
90
  path: ['system', 'uninstall'],
91
- summary: 'Stop and remove an installed system’s instances (one with --instance); their data folders stay.',
92
- usage: '<system> [--instance <name>]',
93
- args: z.object({ positionals: z.tuple([SystemName]), values: z.object({ ...HUB_OPTIONS, instance: InstanceName.optional() }) }),
91
+ summary: 'Stop and remove an installed system’s instances (one with --instance); their data folders stay, and so does each one’s own store unless --delete-store.',
92
+ usage: '<system> [--instance <name>] [--delete-store]',
93
+ args: z.object({ positionals: z.tuple([SystemName]), values: z.object({ ...HUB_OPTIONS, instance: InstanceName.optional(), 'delete-store': z.boolean().optional() }) }),
94
94
  run: ({ positionals: [system], values }, io) => withHub(io, values, async (hub) => {
95
95
  const all = await hub.api.call('instances', { system });
96
96
  const targets = all.filter((i) => i.status !== 'removed' && (values.instance === undefined || i.instance === values.instance));
97
97
  if (targets.length === 0) { io.out.warn(`${system} has no instance${values.instance === undefined ? '' : ` ${values.instance}`} to remove`); return 1; }
98
98
  for (const target of targets) {
99
- await hub.api.call('removeInstance', { system, instance: target.instance });
100
- io.out.line(`removed ${system}@${target.instance}`);
99
+ // a system's own store is kept (and picked up again if it comes back) unless asked to delete it
100
+ const keepStore = values['delete-store'] !== true;
101
+ await hub.api.call('removeInstance', { system, instance: target.instance, keepStore });
102
+ io.out.line(`removed ${system}@${target.instance}${keepStore ? '' : ', its store deleted'}`);
101
103
  }
102
104
  return 0;
103
105
  }),
@@ -0,0 +1,172 @@
1
+ /**
2
+ * The commands over a system's own store (for a system whose contract declares one): `system store` shows where it
3
+ * lives and how it stands, `system store move` moves it to the hub, to the system, or to an external Postgres or SQL
4
+ * Server database and follows the move until it ends, and `system store answer` answers a move waiting on runs still
5
+ * going. Each is a thin call to the hub's admin endpoints (`systemStore`, `systemStoreMove`, ...).
6
+ */
7
+ import { ExternalEngine, InstanceName, StoreMoveAnswer, StoreSchema, SystemName, type StoreBackup, type StoreMove, type StorePlacementInput, type StoreView } from '@harness/core';
8
+ import { z } from 'zod';
9
+ import { HUB_OPTIONS, command, type CliIo, type HubOptions } from '../command.ts';
10
+ import { secretOption, type HubSession } from '../hub.ts';
11
+
12
+ /** Run with a hub, closing it afterwards. */
13
+ async function withHub(io: CliIo, options: HubOptions, use: (hub: HubSession) => Promise<number>): Promise<number> {
14
+ const hub = await io.hub(options);
15
+ try {
16
+ return await use(hub);
17
+ } finally {
18
+ hub.close();
19
+ }
20
+ }
21
+
22
+ /** A placement in a few words: `on the hub`, `with the system`, `external postgres (schema notes)`. */
23
+ export function placementWords(placement: StoreView['placement']): string {
24
+ if (placement.placement === 'hub') { return 'on the hub'; }
25
+ if (placement.placement === 'system') { return 'with the system'; }
26
+ return `external ${placement.engine} (schema ${placement.schema})`;
27
+ }
28
+
29
+ /** Bytes in a few characters: `512 B`, `3.4 MB`. */
30
+ function size(bytes: number): string {
31
+ if (bytes < 1024) { return `${bytes} B`; }
32
+ const units = ['KB', 'MB', 'GB', 'TB'];
33
+ let value = bytes / 1024;
34
+ let unit = 0;
35
+ while (value >= 1024 && unit < units.length - 1) { value /= 1024; unit += 1; }
36
+ return `${value.toFixed(1)} ${units[unit] ?? 'TB'}`;
37
+ }
38
+
39
+ /** A backup as a line: its id, where, size, and why it is kept. */
40
+ function backupLine(backup: StoreBackup): string {
41
+ const why = backup.orphaned ? 'kept when its instance was removed' : 'left by a move';
42
+ return ` ${backup.id} ${placementWords(backup.where)}${backup.bytes === undefined ? '' : `, ${size(backup.bytes)}`}, ${why}, ${new Date(backup.at).toISOString()}`;
43
+ }
44
+
45
+ /** A move as a line: its phase and how far it has got. */
46
+ export function moveLine(move: StoreMove): string {
47
+ const { progress } = move;
48
+ const parts = [`move ${placementWords(move.from)} → ${placementWords(move.to)}: ${move.phase}`];
49
+ if (move.phase === 'draining' || move.phase === 'waiting') { parts.push(`${move.running.length} runs still going`); }
50
+ if (progress.step !== undefined) { parts.push(progress.step); }
51
+ if (progress.tables.total > 0) { parts.push(`tables ${progress.tables.done}/${progress.tables.total}`); }
52
+ if (progress.rows > 0) { parts.push(`${progress.rows} rows`); }
53
+ if (progress.bytes.total > 0) { parts.push(`${size(progress.bytes.done)} of ${size(progress.bytes.total)}`); }
54
+ if (move.error !== undefined) { parts.push(move.error); }
55
+ return parts.join(', ');
56
+ }
57
+
58
+ /**
59
+ * Its size and tables, as the Storage panel shows them, wherever it is: the hub's file and count for a store on the
60
+ * hub, else what the system last measured (an external database's size isn't measured, its tables are).
61
+ */
62
+ function measureLines(view: StoreView): string[] {
63
+ const bytes = view.file?.bytes ?? view.measure?.bytes;
64
+ const lines = [` size: ${bytes !== undefined ? size(bytes) : view.placement.placement === 'external' ? 'not measured for an external database' : 'not measured yet'}`];
65
+ const { measure } = view;
66
+ if (measure === undefined) { return lines; }
67
+ if (measure.tables.length === 0) { return [...lines, ' tables: none']; }
68
+ const width = Math.max(...measure.tables.map((t) => t.name.length));
69
+ lines.push(` tables (counted ${new Date(measure.at).toISOString()}):`, ...measure.tables.map((t) => ` ${t.name.padEnd(width)} ${t.rows} ${t.rows === 1 ? 'row' : 'rows'}`));
70
+ if (measure.more === true) { lines.push(' and more, not counted'); }
71
+ return lines;
72
+ }
73
+
74
+ /** The store view as lines. */
75
+ export function storeLines(view: StoreView): string[] {
76
+ const status = view.status;
77
+ const lines = [
78
+ `${view.system}@${view.instance}: ${view.decl.description}`,
79
+ ` where: ${placementWords(view.placement)}`,
80
+ ` state: ${status?.state ?? 'not opened yet'}${status?.error === undefined ? '' : ` (${status.error})`}${view.holding ? ', calls are held' : ''}`,
81
+ ...measureLines(view),
82
+ ];
83
+ if (status !== undefined) {
84
+ lines.push(` migrations: ${status.migrations.applied.length} applied${status.migrations.pending.length === 0 ? '' : `, pending ${status.migrations.pending.join(', ')}`}`);
85
+ }
86
+ if (view.move !== undefined) { lines.push(` ${moveLine(view.move)}`); }
87
+ lines.push(view.backups.length === 0 ? ' backups: none' : 'backups:', ...view.backups.map(backupLine));
88
+ return lines;
89
+ }
90
+
91
+ const TARGET = { ...HUB_OPTIONS, instance: InstanceName.optional() } as const;
92
+
93
+ export const storeCommand = command({
94
+ path: ['system', 'store'],
95
+ summary: 'Show a system’s own store: where it lives, its state, size and tables, its migrations, its backups and its move.',
96
+ usage: '<system> [--instance <name>]',
97
+ args: z.object({ positionals: z.tuple([SystemName]), values: z.object(TARGET) }),
98
+ run: ({ positionals: [system], values }, io) => withHub(io, values, async (hub) => {
99
+ const view = await hub.api.call('systemStore', { system, ...(values.instance === undefined ? {} : { instance: values.instance }) });
100
+ for (const line of storeLines(view)) { io.out.line(line); }
101
+ return 0;
102
+ }),
103
+ });
104
+
105
+ /** How often `store move` looks at the move again. */
106
+ const FOLLOW_EVERY = 1_000;
107
+
108
+ export const storeMoveCommand = command({
109
+ path: ['system', 'store', 'move'],
110
+ summary: 'Move a system’s store to the hub, the system, or an external database, and follow the move until it ends.',
111
+ usage: '<system> --to hub|system|external [--engine postgres|sqlserver --url <url|-> --schema <name>] [--instance <name>] [--cancel-runs | --keep-waiting]',
112
+ args: z.object({
113
+ positionals: z.tuple([SystemName]),
114
+ values: z.object({
115
+ ...TARGET,
116
+ to: z.enum(['hub', 'system', 'external']),
117
+ engine: ExternalEngine.optional(),
118
+ /** The external database's connection URL, or `-` to read it from stdin; default `HARNESS_STORE_URL`. */
119
+ url: z.string().optional(),
120
+ schema: StoreSchema.optional(),
121
+ 'cancel-runs': z.boolean().optional(),
122
+ 'keep-waiting': z.boolean().optional(),
123
+ }),
124
+ }),
125
+ run: async ({ positionals: [system], values }, io) => {
126
+ let to: StorePlacementInput;
127
+ if (values.to === 'external') {
128
+ const url = await secretOption(values.url, io, { flag: '--url', env: 'HARNESS_STORE_URL', stdin: true }) ?? io.settings.HARNESS_STORE_URL;
129
+ if (values.engine === undefined || url === undefined || values.schema === undefined) {
130
+ io.out.warn('--to external needs --engine, --url (or HARNESS_STORE_URL) and --schema');
131
+ return 2;
132
+ }
133
+ to = { placement: 'external' as const, engine: values.engine, connection: url, schema: values.schema };
134
+ } else {
135
+ to = { placement: values.to };
136
+ }
137
+ if (values['cancel-runs'] === true && values['keep-waiting'] === true) { io.out.warn('give --cancel-runs or --keep-waiting, not both'); return 2; }
138
+ const runs = values['cancel-runs'] === true ? 'cancel' : values['keep-waiting'] === true ? 'wait' : 'ask';
139
+ const instance = values.instance === undefined ? {} : { instance: values.instance };
140
+ return withHub(io, values, async (hub) => {
141
+ let move = await hub.api.call('systemStoreMove', { system, ...instance, to, runs });
142
+ io.out.line(moveLine(move));
143
+ let said = moveLine(move);
144
+ let asked = false;
145
+ while (move.phase !== 'done' && move.phase !== 'failed') {
146
+ await io.sleep(FOLLOW_EVERY);
147
+ move = (await hub.api.call('systemStoreMoveState', { system, ...instance })).move ?? move;
148
+ const line = moveLine(move);
149
+ if (line !== said) { io.out.line(line); said = line; }
150
+ if (move.phase === 'waiting' && !asked) {
151
+ asked = true;
152
+ io.out.warn(`runs are still going after a minute: answer with \`system store answer ${system} cancel\` (cancel them) or \`... wait\` (keep waiting)`);
153
+ }
154
+ }
155
+ if (move.phase === 'failed') { return 1; }
156
+ for (const backup of move.backups) { io.out.line(`old copy kept:${backupLine(backup)}`); }
157
+ return 0;
158
+ });
159
+ },
160
+ });
161
+
162
+ export const storeAnswerCommand = command({
163
+ path: ['system', 'store', 'answer'],
164
+ summary: 'Answer a store move waiting on runs still going: cancel them, or keep waiting until they finish.',
165
+ usage: '<system> cancel|wait [--instance <name>]',
166
+ args: z.object({ positionals: z.tuple([SystemName, StoreMoveAnswer]), values: z.object(TARGET) }),
167
+ run: ({ positionals: [system, answer], values }, io) => withHub(io, values, async (hub) => {
168
+ const move = await hub.api.call('systemStoreMoveAnswer', { system, ...(values.instance === undefined ? {} : { instance: values.instance }), answer });
169
+ io.out.line(moveLine(move));
170
+ return 0;
171
+ }),
172
+ });