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
@@ -0,0 +1,305 @@
1
+ /**
2
+ * Context as questions (plan `context-questions-2026-11-28`). Every context item is one question and its answer: its
3
+ * `question` (the item worded as one question), `when` (the situations it is for, written for a model), when it was last
4
+ * modified, and a status that says whether it is in use. A metadata model fills the question and the rest for hub
5
+ * items, and splits an item that answers several questions into one item per question. A decision model checks new and
6
+ * extracted items against their nearest neighbours: one that asks the same question as an older one marks the older as
7
+ * a possible duplicate, and answers that disagree are flagged on both as a contradiction. Admins work through these in
8
+ * the Context page's Review.
9
+ *
10
+ * **Statuses** (`ContextStatus`):
11
+ * - `active`: in use, the default.
12
+ * - `hidden`: switched off by a person (a forgotten memory, an item an admin hid, a duplicate merged away).
13
+ * - `not_applicable`: a question a plan ruled out ("You chose Postgres for 'Which database?'"); a model sees it only
14
+ * when it has an answer, and only when asked for (`returnNotApplicable`).
15
+ * - `pending_approval`: new context from a system or a resource, waiting for an admin (the "New context from systems
16
+ * and resources" setting); never searched or loaded until approved.
17
+ * - `pending_removal`: its system dropped it in a new contract, or its resource section went away; it keeps working
18
+ * until an admin confirms the removal (which removes it) or rejects it (which restores it).
19
+ * - `pending_plan`: an open question a plan made, with no answer yet; only the plan's own matching sees it.
20
+ *
21
+ * This module holds the shapes and the rules every reader applies; the hub does the work.
22
+ */
23
+ import { z } from 'zod';
24
+ import { ActorId, QualifiedName, Timestamp } from './primitives.ts';
25
+
26
+ // ─── Statuses ─────────────────────────────────────────────────────────────────
27
+
28
+ /** Every status a context item can have (see the module). */
29
+ export const CONTEXT_STATUSES = ['active', 'hidden', 'not_applicable', 'pending_approval', 'pending_removal', 'pending_plan'] as const;
30
+ export const ContextStatus = z.enum(CONTEXT_STATUSES);
31
+ export type ContextStatus = z.infer<typeof ContextStatus>;
32
+
33
+ /** The statuses a search may ask for: every one but `pending_plan`, which only a plan's own matching sees. */
34
+ export const SEARCHABLE_STATUSES = ['active', 'hidden', 'not_applicable', 'pending_approval', 'pending_removal'] as const satisfies readonly ContextStatus[];
35
+ export const SearchableStatus = z.enum(SEARCHABLE_STATUSES);
36
+ export type SearchableStatus = z.infer<typeof SearchableStatus>;
37
+
38
+ /** What a normal search returns, and what a model's context is chosen from: items in use, including those waiting to be removed. */
39
+ export const LIVE_STATUSES = ['active', 'pending_removal'] as const satisfies readonly ContextStatus[];
40
+
41
+ /** The statuses that put an item in front of an admin in Review. */
42
+ export const REVIEW_STATUSES = ['pending_approval', 'pending_removal'] as const satisfies readonly ContextStatus[];
43
+
44
+ /** Whether a status is one a normal search returns and a model's context is chosen from (`LIVE_STATUSES`). */
45
+ export function liveStatus(status: ContextStatus): boolean {
46
+ return status === 'active' || status === 'pending_removal';
47
+ }
48
+
49
+ /** Who asked the question an item answers: a person, a system (its own guides), or something worth researching. */
50
+ export const CONTEXT_ASKERS = ['person', 'system', 'research'] as const;
51
+ export const ContextAskedBy = z.enum(CONTEXT_ASKERS);
52
+ export type ContextAskedBy = z.infer<typeof ContextAskedBy>;
53
+
54
+ /** One change of an item's status: what it became, what it was, who changed it, why, and when. Newest last. */
55
+ export const ContextStatusChange = z.object({
56
+ status: ContextStatus,
57
+ from: ContextStatus.optional(),
58
+ by: ActorId,
59
+ reason: z.string().optional(),
60
+ at: Timestamp,
61
+ });
62
+ export type ContextStatusChange = z.infer<typeof ContextStatusChange>;
63
+
64
+ /** The most status changes an item keeps; older ones fall off the front. */
65
+ export const STATUS_HISTORY_MAX = 50;
66
+
67
+ // ─── Flags, metadata, splits ──────────────────────────────────────────────────
68
+
69
+ /**
70
+ * A flag one item carries about another (`duplicate`, `contradiction`): the other item, how close their questions are
71
+ * (cosine similarity of their `embedding`, 0 to 1, when both have one), the decision model's reason, and when.
72
+ */
73
+ export const ContextFlag = z.object({
74
+ of: QualifiedName,
75
+ similarity: z.number().min(0).max(1).optional(),
76
+ reason: z.string(),
77
+ at: Timestamp,
78
+ });
79
+ export type ContextFlag = z.infer<typeof ContextFlag>;
80
+
81
+ /** The fields the metadata model fills (`ContextMetadata.fields` lists which it filled). */
82
+ export const METADATA_FIELDS = ['question', 'when', 'askedBy', 'validUntil'] as const;
83
+ export const MetadataField = z.enum(METADATA_FIELDS);
84
+ export type MetadataField = z.infer<typeof MetadataField>;
85
+
86
+ /**
87
+ * Which model filled an item's metadata, when, the hash of the content it read (`contentHash`, so a change to the
88
+ * content fills it again), and the fields it filled.
89
+ */
90
+ export const ContextMetadata = z.object({
91
+ model: z.string(),
92
+ at: Timestamp,
93
+ contentHash: z.string(),
94
+ fields: z.array(MetadataField),
95
+ });
96
+ export type ContextMetadata = z.infer<typeof ContextMetadata>;
97
+
98
+ /**
99
+ * How an item that answered several questions was split: `into` on the original (the items made from it, one per
100
+ * question), `from` on each item made from it.
101
+ */
102
+ export const ContextSplit = z.object({
103
+ from: QualifiedName.optional(),
104
+ into: z.array(QualifiedName).optional(),
105
+ });
106
+ export type ContextSplit = z.infer<typeof ContextSplit>;
107
+
108
+ // ─── The admin's setting for new context ──────────────────────────────────────
109
+
110
+ /** The hub option holding what new context from systems and resources starts as. */
111
+ export const NEW_CONTEXT_STATUS_OPTION = 'newContextStatus';
112
+
113
+ /**
114
+ * What new context from systems and resources starts as: `active` (in use at once, as before), `pending_approval` (an
115
+ * admin approves each in Review), or `hidden` (off until an admin shows it). Memory is always active at once.
116
+ */
117
+ export const NEW_CONTEXT_STATUSES = ['active', 'pending_approval', 'hidden'] as const satisfies readonly ContextStatus[];
118
+ export const NewContextStatus = z.enum(NEW_CONTEXT_STATUSES);
119
+ export type NewContextStatus = z.infer<typeof NewContextStatus>;
120
+ export const NEW_CONTEXT_STATUS_DEFAULT: NewContextStatus = 'active';
121
+
122
+ /** The setting with who set it and when (absent: the default). */
123
+ export const NewContextStatusView = z.object({ value: NewContextStatus, setBy: ActorId.optional(), updatedAt: Timestamp.optional() });
124
+ export type NewContextStatusView = z.infer<typeof NewContextStatusView>;
125
+
126
+ // ─── Search ───────────────────────────────────────────────────────────────────
127
+
128
+ /**
129
+ * What semantic search compares the query with: each item's `embedding` (its question's, or its content's when it has
130
+ * no question; the default), or its `contentEmbedding` (always its content's).
131
+ */
132
+ export const SEMANTIC_OVER = ['question', 'content'] as const;
133
+ export const SemanticOver = z.enum(SEMANTIC_OVER);
134
+ export type SemanticOver = z.infer<typeof SemanticOver>;
135
+
136
+ /** The status filters a search takes: which statuses (default active + pending removal), and not-applicable answers too. */
137
+ export const ContextStatusFilters = z.object({
138
+ /** Only items with these statuses; `active` and `pending_removal` when absent. `pending_plan` is never searched. */
139
+ statuses: z.array(SearchableStatus).min(1).optional(),
140
+ /** Also return `not_applicable` items (a question a plan ruled out), with the reason in `statusReason`. */
141
+ returnNotApplicable: z.boolean().optional(),
142
+ semanticOver: SemanticOver.optional(),
143
+ });
144
+ export type ContextStatusFilters = z.infer<typeof ContextStatusFilters>;
145
+
146
+ /** The statuses a search keeps: its `statuses` (else active + pending removal), plus not_applicable when asked for. */
147
+ export function searchStatuses(filters: Pick<ContextStatusFilters, 'statuses' | 'returnNotApplicable'>): ReadonlySet<ContextStatus> {
148
+ const out = new Set<ContextStatus>(filters.statuses ?? LIVE_STATUSES);
149
+ if (filters.returnNotApplicable === true) out.add('not_applicable');
150
+ return out;
151
+ }
152
+
153
+ // ─── Hub fns and endpoints (args and results) ──────────────────────────────────
154
+
155
+ /**
156
+ * What `hub/ctx_status` does to each item: `approve` (pending approval → active), `hide` (→ hidden), `restore` (hidden,
157
+ * not applicable or pending removal → active; for pending removal it rejects the removal), `confirm_removal` (pending
158
+ * removal → the item is removed for good).
159
+ */
160
+ export const CONTEXT_STATUS_ACTIONS = ['approve', 'hide', 'restore', 'confirm_removal'] as const;
161
+ export const ContextStatusAction = z.enum(CONTEXT_STATUS_ACTIONS);
162
+ export type ContextStatusAction = z.infer<typeof ContextStatusAction>;
163
+
164
+ /** `hub/ctx_status`: one action on up to 200 items, with the reason kept in each item's status history. */
165
+ export const ContextStatusArgs = z.object({
166
+ names: z.array(QualifiedName).min(1).max(200),
167
+ action: ContextStatusAction,
168
+ /** Why, in a sentence a person reads later; kept as the item's `statusReason` and in its history. */
169
+ reason: z.string().min(1).max(500).optional(),
170
+ });
171
+ export type ContextStatusArgs = z.infer<typeof ContextStatusArgs>;
172
+
173
+ /** What `hub/ctx_status` did: each item changed (to its new status, or `removed`), and each it left, with why. */
174
+ export const ContextStatusResult = z.object({
175
+ changed: z.array(z.object({ name: QualifiedName, status: z.union([ContextStatus, z.literal('removed')]) })),
176
+ skipped: z.array(z.object({ name: QualifiedName, reason: z.string() })),
177
+ });
178
+ export type ContextStatusResult = z.infer<typeof ContextStatusResult>;
179
+
180
+ /** What puts an item in Review: a possible duplicate, a contradiction, a new item to approve, or a removal to confirm. */
181
+ export const CONTEXT_REVIEW_KINDS = ['duplicate', 'contradiction', 'pending_approval', 'pending_removal'] as const;
182
+ export const ContextReviewKind = z.enum(CONTEXT_REVIEW_KINDS);
183
+ export type ContextReviewKind = z.infer<typeof ContextReviewKind>;
184
+
185
+ /** `hub/ctx_review`: the Review queue, of some kinds (all when absent), of some systems, a page at a time. */
186
+ export const ContextReviewQuery = z.object({
187
+ kinds: z.array(ContextReviewKind).min(1).optional(),
188
+ systems: z.array(z.string().min(1)).min(1).optional(),
189
+ limit: z.number().int().min(1).max(200).optional(),
190
+ /** The `next` of the page before. */
191
+ cursor: z.string().optional(),
192
+ });
193
+ export type ContextReviewQuery = z.infer<typeof ContextReviewQuery>;
194
+
195
+ /** An item as Review shows it: enough to judge it without opening it. */
196
+ export const ContextReviewItem = z.object({
197
+ name: QualifiedName,
198
+ system: z.string(),
199
+ title: z.string(),
200
+ question: z.string().optional(),
201
+ status: ContextStatus,
202
+ statusReason: z.string().optional(),
203
+ lastModified: Timestamp,
204
+ /** The start of its content (at most 300 characters). */
205
+ excerpt: z.string().optional(),
206
+ });
207
+ export type ContextReviewItem = z.infer<typeof ContextReviewItem>;
208
+
209
+ /** One entry of Review: what it is about, the item, and for a duplicate or a contradiction the other item and the flag. */
210
+ export const ContextReviewEntry = z.object({
211
+ kind: ContextReviewKind,
212
+ item: ContextReviewItem,
213
+ other: ContextReviewItem.optional(),
214
+ flag: ContextFlag.optional(),
215
+ });
216
+ export type ContextReviewEntry = z.infer<typeof ContextReviewEntry>;
217
+
218
+ /** A page of Review, with how many entries of each kind there are in all (for the tab's counts). */
219
+ export const ContextReviewPage = z.object({
220
+ items: z.array(ContextReviewEntry),
221
+ next: z.string().optional(),
222
+ counts: z.object({ duplicate: z.number().int().min(0), contradiction: z.number().int().min(0), pending_approval: z.number().int().min(0), pending_removal: z.number().int().min(0) }),
223
+ });
224
+ export type ContextReviewPage = z.infer<typeof ContextReviewPage>;
225
+
226
+ /** `hub/ctx_merge`: keep one item; the other's links and mentions move to it, and the other is hidden. */
227
+ export const ContextMergeArgs = z.object({
228
+ keep: QualifiedName,
229
+ drop: QualifiedName,
230
+ reason: z.string().min(1).max(500).optional(),
231
+ });
232
+ export type ContextMergeArgs = z.infer<typeof ContextMergeArgs>;
233
+
234
+ /** What a merge did: the items, and how many links and mentions moved. */
235
+ export const ContextMergeResult = z.object({
236
+ kept: QualifiedName,
237
+ hidden: QualifiedName,
238
+ links: z.number().int().min(0),
239
+ mentions: z.number().int().min(0),
240
+ });
241
+ export type ContextMergeResult = z.infer<typeof ContextMergeResult>;
242
+
243
+ /** `hub/ctx_not_duplicate`: the two items are not duplicates; the flag is cleared and the pair never flagged again. */
244
+ export const ContextNotDuplicateArgs = z.object({ name: QualifiedName, of: QualifiedName });
245
+ export type ContextNotDuplicateArgs = z.infer<typeof ContextNotDuplicateArgs>;
246
+
247
+ /** `hub/ctx_reextract`: fill these items' metadata again now (and split them again when they answer several questions). */
248
+ export const ContextReextractArgs = z.object({ names: z.array(QualifiedName).min(1).max(20) });
249
+ export type ContextReextractArgs = z.infer<typeof ContextReextractArgs>;
250
+
251
+ /** What re-extraction did, per item: the fields filled and the items it was split into, or why it couldn't. */
252
+ export const ContextReextractResult = z.object({
253
+ done: z.array(z.object({ name: QualifiedName, fields: z.array(MetadataField), split: z.array(QualifiedName).optional() })),
254
+ failed: z.array(z.object({ name: QualifiedName, reason: z.string() })),
255
+ });
256
+ export type ContextReextractResult = z.infer<typeof ContextReextractResult>;
257
+
258
+ /** One item's metadata and status history, for its page (`contextMetadata`). */
259
+ export const ContextMetadataView = z.object({
260
+ name: QualifiedName,
261
+ question: z.string().optional(),
262
+ when: z.string().optional(),
263
+ askedBy: ContextAskedBy.optional(),
264
+ validUntil: Timestamp.optional(),
265
+ lastModified: Timestamp,
266
+ status: ContextStatus,
267
+ statusReason: z.string().optional(),
268
+ statusHistory: z.array(ContextStatusChange),
269
+ metadata: ContextMetadata.optional(),
270
+ /** Whether its content changed since its metadata was filled (it is filled again in the background). */
271
+ metadataStale: z.boolean(),
272
+ duplicate: ContextFlag.optional(),
273
+ contradiction: ContextFlag.optional(),
274
+ notDuplicates: z.array(QualifiedName),
275
+ split: ContextSplit.optional(),
276
+ });
277
+ export type ContextMetadataView = z.infer<typeof ContextMetadataView>;
278
+
279
+ /** The longest `answer` a search hit carries. */
280
+ export const HIT_ANSWER_MAX = 200;
281
+
282
+ /** The first line of a plan question's answer (`context-plan.ts` `answerContent`, kept in step with it). */
283
+ const PLAN_ANSWER_PREFIX = 'Picked: ';
284
+
285
+ /**
286
+ * The short answer a search hit for an answered question shows inline, so a model gets the decision without loading the
287
+ * whole item: the first line of its content, cut to `HIT_ANSWER_MAX`. A question a plan answered (`hub/ctx_answer`)
288
+ * shows the option picked, with the person's own words after it when they wrote some ("Postgres — it needs JSON
289
+ * columns"). Undefined for an item with no question, no content, or no answer yet (an open plan question's options are
290
+ * not an answer).
291
+ */
292
+ export function hitAnswer(item: { readonly decl: { readonly question?: string | undefined; readonly content?: string | undefined }; readonly status?: ContextStatus }): string | undefined {
293
+ const { question, content } = item.decl;
294
+ if (question === undefined || content === undefined || item.status === 'pending_plan') return undefined;
295
+ const lines = content.split('\n').map((part) => part.trim()).filter((part) => part !== '');
296
+ const [first, second] = lines;
297
+ if (first === undefined) return undefined;
298
+ let line = first;
299
+ if (first.startsWith(PLAN_ANSWER_PREFIX)) {
300
+ const picked = first.slice(PLAN_ANSWER_PREFIX.length);
301
+ // the person's words follow the picks, unless the options list comes straight after
302
+ line = second !== undefined && second !== 'Options:' ? `${picked} — ${second}` : picked;
303
+ }
304
+ return line.length > HIT_ANSWER_MAX ? `${line.slice(0, HIT_ANSWER_MAX - 1)}…` : line;
305
+ }
@@ -25,6 +25,7 @@ import { ResourceUri, SectionKey } from './resources.ts';
25
25
  import { Filter } from './query.ts';
26
26
  import { ContextRecord } from './records/systems.ts';
27
27
  import { CONTEXT_ORIGIN_TYPES, type MemoryScope } from './context-graph.ts';
28
+ import { ContextStatus, ContextStatusFilters } from './context-questions.ts';
28
29
  import { SearchMatchedBy } from './records/content.ts';
29
30
 
30
31
  /** A fn example's id. */
@@ -132,8 +133,14 @@ export const FnSearchQuery = z.object({
132
133
  names: z.array(QualifiedName).min(1).max(100).optional(),
133
134
  /** Only context items these context list filters let through (`LIST_FIELDS.contexts`), run in the database. */
134
135
  filters: z.array(Filter).max(20).optional(),
135
- /** Context items switched off are hits too (the context page lists them, marked); left out by default. */
136
+ /** Context items of every status, and those switched off with their system, are hits too (the context page lists them, marked); left out by default. */
136
137
  off: z.boolean().optional(),
138
+ /** Only context items with these statuses (`ContextStatus`); `active` and `pending_removal` when absent. Never `pending_plan`. */
139
+ statuses: ContextStatusFilters.shape.statuses,
140
+ /** Also find `not_applicable` context items (questions a plan ruled out). A model only gets those that have an answer. */
141
+ returnNotApplicable: ContextStatusFilters.shape.returnNotApplicable,
142
+ /** What meaning compares the text with for context: each item's question (the default; its content when it has none), or its content. */
143
+ semanticOver: ContextStatusFilters.shape.semanticOver,
137
144
  /** Only memories of these scopes (`MemoryScope.to`); only context matches a query with them. */
138
145
  scopes: z.array(z.enum(MEMORY_SCOPE_KINDS)).min(1).optional(),
139
146
  /** Only fns that can be used now (default true; `hub/fns_search` for the model defaults to false); false keeps the rest too, each marked with what blocks it (`FnSearchHit.blocked`). */
@@ -164,7 +171,7 @@ export const FN_SEARCH_TYPES_DOCS = 'Only fns that read (`reads`) or write (`wri
164
171
  * never context: that is `hub/ctx_search`), the context-only filters, the context page's own `filters` and `off`, and
165
172
  * `match` (the search merges words and meaning itself), so the tool's spec in every prompt stays small.
166
173
  */
167
- export const FnSearchArgs = FnSearchQuery.omit({ items: true, match: true, filters: true, off: true, scopes: true }).extend({
174
+ export const FnSearchArgs = FnSearchQuery.omit({ items: true, match: true, filters: true, off: true, scopes: true, statuses: true, returnNotApplicable: true, semanticOver: true }).extend({
168
175
  kinds: FnSearchQuery.shape.kinds.describe(FN_SEARCH_KINDS_DOCS),
169
176
  // a fn's name as the model's tools spell it, read back at the boundary (`g.fnName()`), so the one spelling works here too
170
177
  names: z.array(FnNameValue).min(1).max(100).optional().describe(FN_SEARCH_NAMES_DOCS),
@@ -188,6 +195,16 @@ export const CtxSearchArgs = z.object({
188
195
  tags: z.array(z.string().min(1)).min(1).max(20).optional(),
189
196
  names: FnSearchQuery.shape.names,
190
197
  niches: FnSearchQuery.shape.niches,
198
+ /**
199
+ * Also find questions a plan ruled out (`not_applicable`), each with why (`statusReason`); only those that have an
200
+ * answer come back. Leave it out unless you need to know what was decided against.
201
+ */
202
+ returnNotApplicable: z.boolean().optional().describe('Also find questions a plan ruled out (status not_applicable), each with why it was ruled out; only ones that have an answer come back. Leave it out unless you need to know what was decided against.'),
203
+ /**
204
+ * What the meaning of `text` is compared with: each item's question (the default, best for a question or a need in
205
+ * plain words), or its content (for a phrase you expect inside the text).
206
+ */
207
+ semanticOver: FnSearchQuery.shape.semanticOver.describe('What the meaning of `text` is compared with: `question` (the default: each item is worded as the question it answers, so ask in plain words) or `content` (the item\'s text itself, for a phrase you expect inside it).'),
191
208
  order: FnSearchQuery.shape.order,
192
209
  offset: FnSearchQuery.shape.offset,
193
210
  limit: FnSearchQuery.shape.limit,
@@ -235,6 +252,13 @@ export const FnSearchHit = z.object({
235
252
  matched: SearchMatchedBy.optional(),
236
253
  /** A context item found by one of its heading sections: which (its key, heading path and title). */
237
254
  section: SearchSection.optional(),
255
+ /** A context item: the question it answers. */
256
+ question: z.string().optional(),
257
+ /** A context item that answers a question: its answer in short (`hitAnswer`), so the decision is read without loading it. */
258
+ answer: z.string().optional(),
259
+ /** A context item's status when it isn't `active` (`pending_removal`, or `not_applicable` when asked for), and why. */
260
+ status: ContextStatus.optional(),
261
+ statusReason: z.string().optional(),
238
262
  /** Material only some searches are for (`Niche`): ranked below the rest unless the query named it. */
239
263
  niche: Niche.optional(),
240
264
  /** Whether the asker can use it now; what blocks it when false. */
@@ -257,8 +281,12 @@ export type FnSearchHit = z.infer<typeof FnSearchHit>;
257
281
  export const SearchFound = FnSearchHit.pick({ rank: true, similarity: true, matched: true, section: true });
258
282
  export type SearchFound = z.infer<typeof SearchFound>;
259
283
 
260
- /** A row of the context list (`contexts`): the item, and how the list's text search found it when it has text. */
261
- export const ContextListItem = ContextRecord.extend({ found: SearchFound.optional() });
284
+ /**
285
+ * A row of the context list (`contexts`): the item, how the list's text search found it when it has text, and whether
286
+ * its text changed since its metadata was filled (`metadataStale`, as `ContextMetadataView` says it; absent when it has
287
+ * no metadata), so the row can say so without the hub's content hash.
288
+ */
289
+ export const ContextListItem = ContextRecord.extend({ found: SearchFound.optional(), metadataStale: z.boolean().optional() });
262
290
  export type ContextListItem = z.infer<typeof ContextListItem>;
263
291
 
264
292
  /**
@@ -7,7 +7,7 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  /** The name when neither the setting nor the env names one. */
10
- export const DEFAULT_HUB_NAME = 'Harness';
10
+ export const DEFAULT_HUB_NAME = 'fnloom';
11
11
 
12
12
  /** The hub option the admin's choice is stored under. */
13
13
  export const HUB_NAME_OPTION = 'hub.name';
@@ -16,7 +16,7 @@
16
16
  * - `system-events`: the hub events systems subscribe to.
17
17
  * - `web`: the web API spec (`hubWebSpec`) and its events.
18
18
  * - `modes`: chat modes, contextors, model limits and what a prompt held.
19
- * - `context-graph`: context origins and weighted links; `people-only`: fields only a person sets, by hand.
19
+ * - `context-graph`: context origins and weighted links; `context-questions`: context as questions (statuses, duplicate and contradiction flags, metadata, splits); `context-plan`: `hub/ctx_plan`'s decision trees (limits, answers, what is ruled out, the markdown export); `people-only`: fields only a person sets, by hand.
20
20
  * - `resource-forms`: raw content, converted and made forms, sources, families; `media-types`: what content is, from its bytes then its name.
21
21
  * - `model-calls`: every model call of every modality, and model roles.
22
22
  * - `metrics`: fn metrics.
@@ -51,6 +51,8 @@ export * from './urls.ts';
51
51
  export * from './https.ts';
52
52
  export * from './modes.ts';
53
53
  export * from './context-graph.ts';
54
+ export * from './context-questions.ts';
55
+ export * from './context-plan.ts';
54
56
  export * from './people-only.ts';
55
57
  export * from './objects.ts';
56
58
  export * from './ports.ts';
@@ -125,5 +127,6 @@ export * from './mention-search.ts';
125
127
  export * from './remote-auth.ts';
126
128
  export * from './mcp-servers.ts';
127
129
  export * from './sso.ts';
130
+ export * from './stores.ts';
128
131
  export * from './programs.ts';
129
132
  export * from './flow.ts';
@@ -18,6 +18,7 @@ import { ValidateAnswer, ValidateRequest } from './validation.ts';
18
18
  import { ApprovedRun, ArgsCheckAnswer, ArgsCheckRequest, PairingGrant, PairingGrantRequest, PreviewRequest, ProposeRun, ProposedRun } from './approvals.ts';
19
19
  import { HubModelInfo } from './admin.ts';
20
20
  import { HostRefusal, PreviewAnswer } from './lifecycle.ts';
21
+ import { StoreBackupId, StoreLease, StoreLeaseId, StoreMoveId, StoreMoveProgress, StoreOpen, StoreResult, StoreSnapshotName, StoreStatement, StoreStatusReport } from './stores.ts';
21
22
  import { DecideAnswer, DecideRequest } from './decisions.ts';
22
23
  import { DataRecord, RecordGet, RecordPage, RecordQuery, RecordRemove, RecordSave, RecordTableQuery } from './data.ts';
23
24
  import { MentionRequestId, MentionResourceHits, MentionResourceSearch } from './mention-search.ts';
@@ -118,6 +119,11 @@ export const Welcome = z.object({
118
119
  limits: LinkLimits,
119
120
  /** A new auto-pair secret: when one was granted at pairing, or rotated because the last one was used. */
120
121
  autoPair: AutoPairGrant.optional(),
122
+ /**
123
+ * Where the instance's store lives (`stores.ts`): with the system unless the admin chose otherwise. A system whose
124
+ * contract declares no store ignores it. An external database's connection comes revealed.
125
+ */
126
+ store: StoreOpen.optional(),
121
127
  });
122
128
  export type Welcome = z.infer<typeof Welcome>;
123
129
 
@@ -234,6 +240,12 @@ const linked = use(linkTel, linkSession).group({
234
240
  progress: { body: z.object({ run: RunId, progress: ProgressReport }), ws: 'pg' },
235
241
  allow: { body: z.object({ run: RunId, operations: AllowedOperations.partial() }), ws: 'al' },
236
242
  undoWith: { body: z.object({ run: RunId, undo: Json }), ws: 'uw' },
243
+ /**
244
+ * Replace the saved result of a finished run of one of this system's fns (`ctx.updateResult`): a choice made on its
245
+ * card changed what the run produced. The hub checks the value with the fn's result type, keeps it, and tells every
246
+ * chat showing the run to read it again. Only the system's own runs, and only finished (`done`) ones.
247
+ */
248
+ updateResult: { body: z.object({ run: RunId, result: Json }), response: z.object({ revision: z.number().int().min(1) }), ws: 'ur' },
237
249
  /** Attach to the run's assistant message: a system attachment (its data checked by the hub too) or a link. */
238
250
  attach: {
239
251
  body: z.object({
@@ -366,6 +378,37 @@ const linked = use(linkTel, linkSession).group({
366
378
  recordTable: { body: RecordTableQuery, response: ResultTable, ws: 'rtb' },
367
379
  saveRecord: { body: RecordSave, response: DataRecord, ws: 'rsv' },
368
380
  removeRecord: { body: RecordRemove, response: z.object({ removed: z.boolean() }), ws: 'rrm' },
381
+ // System stores (`stores.ts`). All but `storeStatus` are for a store kept on the hub, and refused for any other.
382
+ /** Open the instance's store on the hub (its file is made the first time); answers once it is open. */
383
+ storeOpen: { body: z.object({}), response: z.object({ bytes: z.number().int().min(0) }), ws: 'sto' },
384
+ /**
385
+ * Run one compiled statement on the instance's store: alone (waiting for an open transaction to end), or inside its
386
+ * transaction when `lease` is given (which renews the lease). Refused: ATTACH, DETACH, load_extension, VACUUM,
387
+ * transaction statements, and pragmas outside a small allowed list.
388
+ */
389
+ storeRun: { body: StoreStatement, response: StoreResult, ws: 'stq' },
390
+ /** Begin a transaction on the store; the hub rolls it back when its lease lapses with no statement. */
391
+ storeBegin: { body: z.object({}), response: StoreLease, ws: 'stb' },
392
+ storeCommit: { body: z.object({ lease: StoreLeaseId }), ws: 'stc' },
393
+ storeRollback: { body: z.object({ lease: StoreLeaseId }), ws: 'str' },
394
+ /** Copy the store aside (`VACUUM INTO`) before migrations run; the hub keeps the last few. */
395
+ storeSnapshot: { body: z.object({}), response: z.object({ snapshot: StoreSnapshotName }), ws: 'stn' },
396
+ /** Put a snapshot back in place of the store (a migration failed part-way). */
397
+ storeRestore: { body: z.object({ snapshot: StoreSnapshotName }), ws: 'stx' },
398
+ /** The instance's store state and migrations, whatever its placement: the hub holds calls until it says `ready`. */
399
+ storeStatus: { body: StoreStatusReport, ws: 'sts' },
400
+ // Moving a store (`stores.ts`): the system copies it, and these carry a SQLite copy to and from the hub. Each is
401
+ // refused unless the asking instance has that move going on now.
402
+ /** Make a whole copy of the store the hub keeps (`VACUUM INTO`) for a move from the hub: its size and sha-256. */
403
+ storeExport: { body: z.object({ move: StoreMoveId }), response: z.object({ bytes: z.number().int().min(0), hash: z.string().regex(/^[0-9a-f]{64}$/) }), ws: 'ste' },
404
+ /** A chunk of that copy, base64. */
405
+ storeDownload: { body: z.object({ move: StoreMoveId, offset: z.number().int().min(0), length: z.number().int().min(1).max(4_000_000) }), response: z.object({ chunk: z.string() }), ws: 'std' },
406
+ /** A chunk of the copy for a move to the hub, base64, at its offset. */
407
+ storeUpload: { body: z.object({ move: StoreMoveId, offset: z.number().int().min(0), chunk: z.string().max(6_000_000) }), ws: 'stu' },
408
+ /** The copy is all sent: the hub checks its size and sha-256 against these, and refuses it if they differ. */
409
+ storeUploadDone: { body: z.object({ move: StoreMoveId, bytes: z.number().int().min(0), hash: z.string().regex(/^[0-9a-f]{64}$/) }), ws: 'stud' },
410
+ /** How far the copy has got, for the admin's view of the move. */
411
+ storeMoveProgress: { body: z.object({ move: StoreMoveId, progress: StoreMoveProgress }), ws: 'stmp' },
369
412
  });
370
413
 
371
414
  /** What a system calls on the hub. */
@@ -480,6 +523,33 @@ export const systemLinkSpec = spec({
480
523
  * ctx)`, whose read-only calls are children of the queued run. Problems settle the run as invalid input.
481
524
  */
482
525
  checkArgs: endpoint({ body: ArgsCheckRequest, response: ArgsCheckAnswer, ws: 'cka' }),
526
+ // Moving a store (`stores.ts`). The copy runs in the system, which reaches its own file, an external database, and
527
+ // the hub's file over the link.
528
+ /**
529
+ * Whether the store could move to `to`: the target is reachable, empty, and can hold the store's vectors (pgvector,
530
+ * SQL Server 2025, each vector set within the engine's size). Problems in plain words; empty when it can.
531
+ */
532
+ storeProbe: endpoint({ body: z.object({ to: StoreOpen }), response: z.object({ problems: z.array(z.string()) }), ws: 'spb' }),
533
+ /**
534
+ * Close the store and copy it from `from` to `to`, reporting progress (`storeMoveProgress`). Answers once the copy
535
+ * is whole and checked; on a failure the copy is thrown away, the store opens on `from` again, and it is refused.
536
+ */
537
+ storeMove: endpoint({
538
+ body: z.object({ move: StoreMoveId, from: StoreOpen, to: StoreOpen }),
539
+ response: z.object({ tables: z.number().int().min(0), rows: z.number().int().min(0), bytes: z.number().int().min(0) }),
540
+ ws: 'smv',
541
+ }),
542
+ /**
543
+ * End a move: `switched` keeps the old copy with the system as a backup (when it was with the system) and opens
544
+ * the store on `to`; `aborted` throws the new copy away and opens it on `from` again.
545
+ */
546
+ storeMoveEnd: endpoint({
547
+ body: z.object({ move: StoreMoveId, outcome: z.enum(['switched', 'aborted']), from: StoreOpen, to: StoreOpen }),
548
+ response: z.object({ backups: z.array(z.object({ id: StoreBackupId, bytes: z.number().int().min(0) })) }),
549
+ ws: 'sme',
550
+ }),
551
+ /** Delete a store's files with the system: one backup, or the store itself (the instance is removed, "delete it"). */
552
+ storeDiscard: endpoint({ body: z.discriminatedUnion('what', [z.object({ what: z.literal('store') }), z.object({ what: z.literal('backup'), backup: StoreBackupId })]), ws: 'sdc' }),
483
553
  },
484
554
  });
485
555
  export type SystemLinkSpec = typeof systemLinkSpec;
@@ -6,7 +6,7 @@
6
6
  import { z } from 'zod';
7
7
  import { DeclaredLink } from './context-graph.ts';
8
8
  import { GinTypeDef } from './gin.ts';
9
- import { ADMIN_TAG, ActorKind, Audience, LocalName, Duration, FnKindName, InstanceName, Json, QualifiedName, SessionId, SystemName, TurnId } from './primitives.ts';
9
+ import { ADMIN_TAG, ActorKind, Audience, LocalName, Duration, FnKindName, InstanceName, Json, QualifiedName, SessionId, SystemName, Timestamp, TurnId } from './primitives.ts';
10
10
  import { SectionMatch, Link } from './resources.ts';
11
11
  import { Display, FnLimits, Operations, ProgressDecl, TimeInfo, UserInfo } from './run.ts';
12
12
  import { StatusTemplates } from './status.ts';
@@ -23,8 +23,10 @@ import { RecordStorage } from './data.ts';
23
23
  import { ApiGroupDecl } from './api-index.ts';
24
24
  import { ChatModeType } from './modes.ts';
25
25
  import { ModelRole } from './model-calls.ts';
26
+ import { StoreDecl } from './stores.ts';
26
27
  import { ClaimTemplate } from './claims.ts';
27
28
  import { InjectDecl } from './inject.ts';
29
+ import { ContextAskedBy } from './context-questions.ts';
28
30
 
29
31
 
30
32
  /** How values of a named type are shown: in mention chips, hover cards and inputs. */
@@ -370,6 +372,21 @@ export const ContextDecl = z.object({
370
372
  choices: z.array(ContextChoice).optional(),
371
373
  /** Weighted links to other context, fns, types and resources. */
372
374
  links: z.array(DeclaredLink).optional(),
375
+ /**
376
+ * The item as one question it answers ("How do I write a system's fns?"), so people and models find it by asking.
377
+ * Its semantic search compares with the question. For hub items the metadata model writes it when it is absent.
378
+ */
379
+ question: z.string().min(1).max(500).optional(),
380
+ /** When it is the right thing to read, written for a model ("When the person asks to change how a fn retries."). */
381
+ when: z.string().min(1).max(500).optional(),
382
+ /** When its text last changed at its source (ms since the epoch); the hub uses when it first saw this version when absent. */
383
+ lastModified: Timestamp.optional(),
384
+ /**
385
+ * Who would ask its question: `person` (about their own life, work or choices), `system` (how a piece of software or
386
+ * the harness works or should be used: a system's guides are this) or `research` (a fact that could be looked up).
387
+ * The metadata model fills it for hub items when it is absent.
388
+ */
389
+ askedBy: ContextAskedBy.optional(),
373
390
  });
374
391
  export type ContextDecl = z.infer<typeof ContextDecl>;
375
392
 
@@ -499,6 +516,8 @@ export const Manifest = z.object({
499
516
  pages: SystemPages.optional(),
500
517
  /** Build 8: its API groups, each described once (`FnDecl.group`). */
501
518
  groups: z.array(ApiGroupDecl).optional(),
519
+ /** Its own SQL store (`store()` in the contract); where it lives is the admin's choice at install (`stores.ts`). */
520
+ store: StoreDecl.optional(),
502
521
  });
503
522
  export type Manifest = z.infer<typeof Manifest>;
504
523
 
@@ -150,8 +150,12 @@ export type ModelForwardResult = z.infer<typeof ModelForwardResult>;
150
150
  * `transcribe`: audio resources and recordings. `dictate`: the composer's voice input. `speak`: reading answers aloud.
151
151
  * `describe`: describing images. `ocr`: reading the text in images and scanned pages. `decide`: a decision model
152
152
  * (aeye's `ai.decide`) for typed answers: suggestions when set to it, `ctx_crawl`'s links, and systems' `decide`.
153
+ * `metadata`: fills context items' metadata (their question, when they apply, who asked) and splits an item that
154
+ * answers several questions; without a model of its own (a setting, or `HARNESS_METADATA_MODEL`) it uses the decide
155
+ * role's model when that model can chat, else the chat role's. `plan`: `hub/ctx_plan`'s model, which lists the
156
+ * questions a plan needs answered and the options for each; it has no default.
153
157
  */
154
- export const MODEL_ROLES = ['chat', 'transcribe', 'dictate', 'speak', 'describe', 'ocr', 'decide'] as const;
158
+ export const MODEL_ROLES = ['chat', 'transcribe', 'dictate', 'speak', 'describe', 'ocr', 'decide', 'metadata', 'plan'] as const;
155
159
  export const ModelRole = z.enum(MODEL_ROLES);
156
160
  export type ModelRole = z.infer<typeof ModelRole>;
157
161
 
@@ -160,7 +164,7 @@ export type ModelRole = z.infer<typeof ModelRole>;
160
164
  * aeye's `ModelCapability` at compile time; the admin's role editor offers the able models first.
161
165
  */
162
166
  export const ROLE_CAPABILITY = {
163
- chat: 'chat', transcribe: 'hearing', dictate: 'hearing', speak: 'audio', describe: 'vision', ocr: 'vision', decide: 'decision',
167
+ chat: 'chat', transcribe: 'hearing', dictate: 'hearing', speak: 'audio', describe: 'vision', ocr: 'vision', decide: 'decision', metadata: 'chat', plan: 'chat',
164
168
  } as const satisfies Record<ModelRole, string>;
165
169
 
166
170
  /** A model for a role, optionally pinned to one configured provider (when several serve the same model). */
@@ -219,5 +223,10 @@ export const ModelRoleView = z.object({
219
223
  from: z.enum(['setting', 'env', 'none']),
220
224
  /** What the choice resolves to now; absent without a choice, or for dictation in the browser (no model). */
221
225
  resolved: RoleResolution.optional(),
226
+ /**
227
+ * When the role has no model of its own and borrows another role's (only `metadata` does: the decide role's model
228
+ * when that model can chat, else the chat role's): the role it borrows from, and why, in words for the roles page.
229
+ */
230
+ fallback: z.object({ role: ModelRole, reason: z.string() }).optional(),
222
231
  });
223
232
  export type ModelRoleView = z.infer<typeof ModelRoleView>;
@@ -11,6 +11,7 @@ import { GinTypeDef } from './gin.ts';
11
11
  import { ActorId, ApprovalId, InstanceName, InstanceRef, Json, PairingId, QualifiedName, SystemName, Timestamp } from './primitives.ts';
12
12
  import { CONTENT_HASH } from './resources.ts';
13
13
  import { InstalledSystem, InstanceConfig, InstanceMode, SystemStatus } from './records/systems.ts';
14
+ import { InstanceStore, StoreDecl, StorePlacementInput } from './stores.ts';
14
15
 
15
16
  /** The package format this hub reads. */
16
17
  export const PACKAGE_FORMAT = 1;
@@ -122,6 +123,11 @@ export const InstanceRecord = z.object({
122
123
  address: z.string().optional(),
123
124
  /** Build 9: how people connect to it, for an instance-scoped `connect` system (`instanceConnect` on the hub link). */
124
125
  connect: InstanceConnect.optional(),
126
+ /**
127
+ * Where its store lives and the last status it reported, for a system whose contract declares one (`stores.ts`).
128
+ * Absent until the admin chose a placement or the system first reported on its store: it is with the system then.
129
+ */
130
+ store: InstanceStore.optional(),
125
131
  });
126
132
  export type InstanceRecord = z.infer<typeof InstanceRecord>;
127
133
 
@@ -152,6 +158,8 @@ export const PairingInfo = z.object({
152
158
  configType: GinTypeDef.optional(),
153
159
  /** Its config's secret fields, which the pairing page asks for as passwords and the hub seals. */
154
160
  configSecrets: ConfigSecrets.optional(),
161
+ /** Its own SQL store, as its contract declares it: the pairing page asks where it should live. */
162
+ store: StoreDecl.optional(),
155
163
  });
156
164
  export type PairingInfo = z.infer<typeof PairingInfo>;
157
165
 
@@ -191,5 +199,7 @@ export const AddInstance = z.object({
191
199
  description: z.string().optional(),
192
200
  /** Its config, checked against the system's config type (secret fields sealed). */
193
201
  config: Json,
202
+ /** Where its store lives, for a system that keeps one (`stores.ts`): with the system unless given. */
203
+ store: StorePlacementInput.optional(),
194
204
  });
195
205
  export type AddInstance = z.infer<typeof AddInstance>;