fnloom 0.2.0 → 0.4.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 (905) hide show
  1. package/README.md +123 -19
  2. package/package.json +15 -11
  3. package/packages/build/package.json +2 -2
  4. package/packages/build/src/tests.ts +2 -2
  5. package/packages/cli/package.json +1 -1
  6. package/packages/cli/src/cli.ts +4 -3
  7. package/packages/cli/src/command.ts +4 -2
  8. package/packages/cli/src/commands/install.ts +104 -8
  9. package/packages/cli/src/commands/manage.ts +7 -5
  10. package/packages/cli/src/commands/mcp.ts +6 -6
  11. package/packages/cli/src/commands/store.ts +172 -0
  12. package/packages/cli/src/hub.ts +45 -26
  13. package/packages/cli/src/index.ts +1 -1
  14. package/packages/cli/src/io.ts +3 -2
  15. package/packages/cli/src/local.ts +7 -7
  16. package/packages/cli/src/premade.ts +1 -1
  17. package/packages/cli/src/testing.ts +2 -1
  18. package/packages/core/package.json +4 -4
  19. package/packages/core/src/auto-pair.ts +1 -1
  20. package/packages/core/src/connections.ts +1 -14
  21. package/packages/core/src/context-files.ts +3 -1
  22. package/packages/core/src/context-graph.ts +5 -1
  23. package/packages/core/src/context-plan.ts +451 -0
  24. package/packages/core/src/context-questions.ts +305 -0
  25. package/packages/core/src/data.ts +1 -1
  26. package/packages/core/src/fn-facts.ts +32 -4
  27. package/packages/core/src/https.ts +2 -2
  28. package/packages/core/src/identity.ts +2 -2
  29. package/packages/core/src/image-embeddings.ts +1 -1
  30. package/packages/core/src/index.ts +9 -8
  31. package/packages/core/src/link.ts +71 -1
  32. package/packages/core/src/manifest.ts +22 -3
  33. package/packages/core/src/mention-search.ts +1 -1
  34. package/packages/core/src/model-calls.ts +11 -2
  35. package/packages/core/src/package.ts +11 -1
  36. package/packages/core/src/ports.ts +2 -2
  37. package/packages/core/src/query.ts +4 -3
  38. package/packages/core/src/records/chat.ts +1 -1
  39. package/packages/core/src/records/content.ts +10 -2
  40. package/packages/core/src/records/runs.ts +12 -0
  41. package/packages/core/src/records/spend.ts +4 -0
  42. package/packages/core/src/records/systems.ts +87 -5
  43. package/packages/core/src/registries.ts +9 -3
  44. package/packages/core/src/run.ts +5 -0
  45. package/packages/core/src/sso.ts +2 -2
  46. package/packages/core/src/stores.ts +473 -0
  47. package/packages/core/src/suggestions.ts +5 -2
  48. package/packages/core/src/system-pages.ts +46 -7
  49. package/packages/core/src/tables.ts +233 -0
  50. package/packages/core/src/visuals.ts +47 -139
  51. package/packages/core/src/web.ts +116 -11
  52. package/packages/core/src/widgets-v1.ts +78 -1
  53. package/packages/hub/package.json +15 -12
  54. package/packages/hub/src/access/hits.ts +1 -1
  55. package/packages/hub/src/api/admin-ops.ts +41 -9
  56. package/packages/hub/src/api/auth.ts +10 -6
  57. package/packages/hub/src/api/https.ts +6 -6
  58. package/packages/hub/src/api/identities.ts +1 -1
  59. package/packages/hub/src/api/person-ops.ts +6 -0
  60. package/packages/hub/src/api/reads.ts +1 -1
  61. package/packages/hub/src/api/secrets.ts +1 -1
  62. package/packages/hub/src/api/serve.ts +2 -2
  63. package/packages/hub/src/api/sso-route.ts +2 -2
  64. package/packages/hub/src/api/sso.ts +6 -6
  65. package/packages/hub/src/api/store-ops.ts +54 -0
  66. package/packages/hub/src/api/testing/rig.ts +3 -3
  67. package/packages/hub/src/api/tls.ts +4 -4
  68. package/packages/hub/src/api/web/auth.ts +1 -1
  69. package/packages/hub/src/api/web/build5.ts +2 -1
  70. package/packages/hub/src/api/web/context-plans.ts +25 -0
  71. package/packages/hub/src/api/web/context-review.ts +43 -0
  72. package/packages/hub/src/api/web/find.ts +1 -1
  73. package/packages/hub/src/api/web/index.ts +4 -0
  74. package/packages/hub/src/api/web/pages.ts +17 -3
  75. package/packages/hub/src/api/web/pickers.ts +4 -4
  76. package/packages/hub/src/api/web/review.ts +16 -0
  77. package/packages/hub/src/api/web/systems.ts +14 -2
  78. package/packages/hub/src/boot/admin-fns.ts +8 -0
  79. package/packages/hub/src/boot/admin-secrets.ts +10 -4
  80. package/packages/hub/src/boot/env.ts +82 -73
  81. package/packages/hub/src/boot/hub-fns.ts +4 -4
  82. package/packages/hub/src/boot/hub-groups.ts +2 -2
  83. package/packages/hub/src/boot/identity.ts +2 -2
  84. package/packages/hub/src/boot/index.ts +10 -1
  85. package/packages/hub/src/boot/info.ts +1 -1
  86. package/packages/hub/src/boot/keys.ts +6 -6
  87. package/packages/hub/src/boot/log.ts +4 -4
  88. package/packages/hub/src/boot/modules.ts +16 -7
  89. package/packages/hub/src/boot/person-fns.ts +5 -0
  90. package/packages/hub/src/boot/plan-fns.ts +39 -0
  91. package/packages/hub/src/boot/services.ts +9 -9
  92. package/packages/hub/src/boot/start.ts +25 -24
  93. package/packages/hub/src/catalog/catalog.ts +44 -14
  94. package/packages/hub/src/catalog/index.ts +6 -2
  95. package/packages/hub/src/chat/cache.ts +1 -1
  96. package/packages/hub/src/chat/chat.ts +1 -1
  97. package/packages/hub/src/chat/compare.ts +2 -2
  98. package/packages/hub/src/chat/deliveries.ts +1 -1
  99. package/packages/hub/src/chat/deps.ts +3 -3
  100. package/packages/hub/src/chat/enrich.ts +7 -7
  101. package/packages/hub/src/chat/env.ts +20 -20
  102. package/packages/hub/src/chat/mention-requests.ts +1 -1
  103. package/packages/hub/src/chat/mention-search.ts +1 -1
  104. package/packages/hub/src/chat/mentions.ts +3 -3
  105. package/packages/hub/src/chat/notifications.ts +2 -2
  106. package/packages/hub/src/chat/presence.ts +2 -2
  107. package/packages/hub/src/chat/sessions.ts +2 -2
  108. package/packages/hub/src/chat/suggestions.ts +8 -8
  109. package/packages/hub/src/chat/testing.ts +3 -3
  110. package/packages/hub/src/chat/turns.ts +6 -6
  111. package/packages/hub/src/chat/undo.ts +1 -1
  112. package/packages/hub/src/connections/create.ts +1 -1
  113. package/packages/hub/src/connections/env.ts +2 -2
  114. package/packages/hub/src/connections/service.ts +5 -9
  115. package/packages/hub/src/contextor/brought.ts +5 -3
  116. package/packages/hub/src/contextor/contextors.ts +9 -9
  117. package/packages/hub/src/contextor/crawl.ts +1 -1
  118. package/packages/hub/src/contextor/create.ts +5 -5
  119. package/packages/hub/src/contextor/dynamic.ts +5 -5
  120. package/packages/hub/src/contextor/env.ts +46 -46
  121. package/packages/hub/src/contextor/injected.ts +1 -1
  122. package/packages/hub/src/contextor/limits.ts +9 -9
  123. package/packages/hub/src/contextor/planner.ts +11 -11
  124. package/packages/hub/src/contextor/testing.ts +5 -5
  125. package/packages/hub/src/data/env.ts +3 -3
  126. package/packages/hub/src/data/service.ts +5 -5
  127. package/packages/hub/src/execution/agent.ts +8 -8
  128. package/packages/hub/src/execution/ai.ts +7 -7
  129. package/packages/hub/src/execution/create.ts +13 -6
  130. package/packages/hub/src/execution/env.ts +16 -14
  131. package/packages/hub/src/execution/errors.ts +12 -0
  132. package/packages/hub/src/execution/executors.ts +16 -4
  133. package/packages/hub/src/execution/gateway.ts +1 -1
  134. package/packages/hub/src/execution/index.ts +9 -1
  135. package/packages/hub/src/execution/ledger.ts +2 -2
  136. package/packages/hub/src/execution/limits.ts +2 -2
  137. package/packages/hub/src/execution/link-handlers.ts +16 -4
  138. package/packages/hub/src/execution/models.ts +2 -2
  139. package/packages/hub/src/execution/ports.ts +1 -1
  140. package/packages/hub/src/execution/providers.ts +55 -11
  141. package/packages/hub/src/execution/queues.ts +6 -6
  142. package/packages/hub/src/execution/runs.ts +216 -15
  143. package/packages/hub/src/execution/stream-guard.ts +2 -2
  144. package/packages/hub/src/execution/testing.ts +7 -6
  145. package/packages/hub/src/execution/wire.ts +3 -3
  146. package/packages/hub/src/fns/auto.ts +2 -2
  147. package/packages/hub/src/fns/client-logs.ts +2 -2
  148. package/packages/hub/src/fns/create.ts +2 -2
  149. package/packages/hub/src/fns/decided.ts +2 -2
  150. package/packages/hub/src/fns/env.ts +14 -14
  151. package/packages/hub/src/fns/examples.ts +3 -3
  152. package/packages/hub/src/fns/facts.ts +5 -5
  153. package/packages/hub/src/fns/search.ts +28 -9
  154. package/packages/hub/src/graph/graph.ts +3 -3
  155. package/packages/hub/src/index/context-sections.ts +1 -1
  156. package/packages/hub/src/index/embedders.ts +3 -3
  157. package/packages/hub/src/index/env.ts +12 -12
  158. package/packages/hub/src/index/index.ts +10 -3
  159. package/packages/hub/src/index/indexer.ts +71 -20
  160. package/packages/hub/src/index/search.ts +2 -1
  161. package/packages/hub/src/index/suggester.ts +2 -2
  162. package/packages/hub/src/index/testing.ts +2 -2
  163. package/packages/hub/src/link/build.ts +71 -34
  164. package/packages/hub/src/link/connections.ts +41 -3
  165. package/packages/hub/src/link/describer.ts +19 -2
  166. package/packages/hub/src/link/env.ts +21 -11
  167. package/packages/hub/src/link/grants.ts +10 -10
  168. package/packages/hub/src/link/handlers.ts +6 -0
  169. package/packages/hub/src/link/index.ts +16 -4
  170. package/packages/hub/src/link/lifecycle.ts +15 -8
  171. package/packages/hub/src/link/migrate-api.ts +55 -15
  172. package/packages/hub/src/link/packages.ts +17 -4
  173. package/packages/hub/src/link/pairing.ts +3 -3
  174. package/packages/hub/src/link/process.ts +11 -5
  175. package/packages/hub/src/link/rig.ts +15 -11
  176. package/packages/hub/src/link/status.ts +14 -0
  177. package/packages/hub/src/link/supervisor.ts +17 -1
  178. package/packages/hub/src/link/systems.ts +16 -5
  179. package/packages/hub/src/mcp/calls.ts +6 -6
  180. package/packages/hub/src/mcp/create.ts +5 -5
  181. package/packages/hub/src/mcp/env.ts +6 -6
  182. package/packages/hub/src/mcp/fns.ts +2 -2
  183. package/packages/hub/src/mcp/index.ts +2 -2
  184. package/packages/hub/src/mcp/sources.ts +3 -3
  185. package/packages/hub/src/mcp/tokens.ts +1 -1
  186. package/packages/hub/src/models/create.ts +1 -1
  187. package/packages/hub/src/models/decide.ts +2 -2
  188. package/packages/hub/src/models/index.ts +1 -1
  189. package/packages/hub/src/models/roles.ts +78 -11
  190. package/packages/hub/src/query/columns.ts +4 -1
  191. package/packages/hub/src/query/contexts.ts +10 -3
  192. package/packages/hub/src/query/env.ts +5 -5
  193. package/packages/hub/src/query/sources.ts +3 -3
  194. package/packages/hub/src/questions/apply.ts +163 -0
  195. package/packages/hub/src/questions/carry.ts +30 -0
  196. package/packages/hub/src/questions/duplicates.ts +181 -0
  197. package/packages/hub/src/questions/index.ts +112 -0
  198. package/packages/hub/src/questions/metadata.ts +142 -0
  199. package/packages/hub/src/questions/pending.ts +64 -0
  200. package/packages/hub/src/questions/plan-match.ts +79 -0
  201. package/packages/hub/src/questions/plan-prompts.ts +110 -0
  202. package/packages/hub/src/questions/planner.ts +382 -0
  203. package/packages/hub/src/questions/plans.ts +353 -0
  204. package/packages/hub/src/questions/review.ts +253 -0
  205. package/packages/hub/src/questions/setting.ts +50 -0
  206. package/packages/hub/src/questions/testing.ts +131 -0
  207. package/packages/hub/src/questions/worker.ts +182 -0
  208. package/packages/hub/src/resources/context.ts +61 -23
  209. package/packages/hub/src/resources/converters.ts +2 -2
  210. package/packages/hub/src/resources/create.ts +20 -8
  211. package/packages/hub/src/resources/env.ts +15 -11
  212. package/packages/hub/src/resources/fetch.ts +5 -5
  213. package/packages/hub/src/resources/fns.ts +6 -2
  214. package/packages/hub/src/resources/forms.ts +5 -5
  215. package/packages/hub/src/resources/index.ts +9 -3
  216. package/packages/hub/src/resources/library.ts +2 -2
  217. package/packages/hub/src/resources/raw.ts +1 -1
  218. package/packages/hub/src/resources/reader.ts +2 -2
  219. package/packages/hub/src/resources/sqlite-files.ts +1 -1
  220. package/packages/hub/src/resources/storage.ts +5 -5
  221. package/packages/hub/src/resources/testing.ts +22 -6
  222. package/packages/hub/src/store/codec.ts +23 -5
  223. package/packages/hub/src/store/context-status.ts +56 -0
  224. package/packages/hub/src/store/derived.ts +53 -0
  225. package/packages/hub/src/store/env.ts +4 -4
  226. package/packages/hub/src/store/hybrid.ts +37 -10
  227. package/packages/hub/src/store/lists.ts +2 -1
  228. package/packages/hub/src/store/migrate-fn-names.ts +5 -2
  229. package/packages/hub/src/store/rows.ts +8 -1
  230. package/packages/hub/src/store/schema.ts +2 -1
  231. package/packages/hub/src/store/sqlite.ts +5 -4
  232. package/packages/hub/src/stores/backups.ts +163 -0
  233. package/packages/hub/src/stores/drivers.ts +100 -0
  234. package/packages/hub/src/stores/guard.ts +116 -0
  235. package/packages/hub/src/stores/host.ts +459 -0
  236. package/packages/hub/src/stores/moves.ts +380 -0
  237. package/packages/hub/src/stores/plugin.ts +42 -0
  238. package/packages/hub/src/stores/service.ts +340 -0
  239. package/packages/hub/src/stores/testing.ts +149 -0
  240. package/packages/hub/src/tables/env.ts +3 -3
  241. package/packages/hub/src/tables/index.ts +5 -5
  242. package/packages/hub/src/tables/service.ts +7 -7
  243. package/packages/sdk/AUTHORING.md +3229 -1309
  244. package/packages/sdk/package.json +15 -8
  245. package/packages/sdk/src/agent.ts +1 -1
  246. package/packages/sdk/src/app-parts.ts +95 -0
  247. package/packages/sdk/src/authored.ts +26 -0
  248. package/packages/sdk/src/authoring.ts +13 -30
  249. package/packages/sdk/src/build.ts +3 -0
  250. package/packages/sdk/src/client-runtime.ts +24 -1
  251. package/packages/sdk/src/client-ui/AddServiceDialog.vue +43 -0
  252. package/packages/sdk/src/client-ui/InstanceNameField.vue +29 -0
  253. package/packages/sdk/src/client-ui/PairRowsEditor.vue +74 -0
  254. package/packages/sdk/src/client-ui/RemoteAuthFields.vue +95 -0
  255. package/packages/sdk/src/client-ui/ServiceRows.vue +57 -0
  256. package/packages/sdk/src/client-ui/draft.ts +10 -0
  257. package/packages/sdk/src/client-ui/host.ts +37 -0
  258. package/packages/sdk/src/client-ui/index.ts +19 -0
  259. package/packages/sdk/src/client-ui/loaded.ts +69 -0
  260. package/packages/sdk/src/client-ui/problems.ts +98 -0
  261. package/packages/sdk/src/client-ui/remote-config.ts +199 -0
  262. package/packages/sdk/src/client-ui/service-rows.ts +25 -0
  263. package/packages/sdk/src/client-ui/state.ts +14 -0
  264. package/packages/sdk/src/client-ui/testing.ts +147 -0
  265. package/packages/sdk/src/client-ui/vue-shim.d.ts +13 -0
  266. package/packages/sdk/src/client.ts +104 -11
  267. package/packages/sdk/src/ctx.ts +51 -17
  268. package/packages/sdk/src/declare.ts +36 -12
  269. package/packages/sdk/src/hub.ts +226 -14
  270. package/packages/sdk/src/impl.ts +3 -3
  271. package/packages/sdk/src/index.ts +19 -12
  272. package/packages/sdk/src/manifest.ts +5 -0
  273. package/packages/sdk/src/page-parts.ts +4 -0
  274. package/packages/sdk/src/program/env.ts +7 -7
  275. package/packages/sdk/src/program/runtime.ts +5 -5
  276. package/packages/sdk/src/program/tools.ts +3 -3
  277. package/packages/sdk/src/providers.ts +2 -2
  278. package/packages/sdk/src/remote-auth.ts +128 -7
  279. package/packages/sdk/src/server/asks.ts +12 -1
  280. package/packages/sdk/src/server/context-files.ts +1 -1
  281. package/packages/sdk/src/server/env.ts +47 -35
  282. package/packages/sdk/src/server/fake-hub-widgets.ts +7 -6
  283. package/packages/sdk/src/server/host.ts +106 -35
  284. package/packages/sdk/src/server/index.ts +23 -4
  285. package/packages/sdk/src/server/live.ts +4 -4
  286. package/packages/sdk/src/server/llm-wire.ts +4 -4
  287. package/packages/sdk/src/server/package.ts +11 -2
  288. package/packages/sdk/src/server/pairing.ts +1 -1
  289. package/packages/sdk/src/server/results.ts +4 -4
  290. package/packages/sdk/src/server/run.ts +6 -1
  291. package/packages/sdk/src/server/runtime.ts +78 -22
  292. package/packages/sdk/src/server/socket-guard.ts +1 -1
  293. package/packages/sdk/src/server/start-gate.ts +174 -0
  294. package/packages/sdk/src/server/store/checksum.ts +162 -0
  295. package/packages/sdk/src/server/store/engines.ts +400 -0
  296. package/packages/sdk/src/server/store/extend.ts +25 -0
  297. package/packages/sdk/src/server/store/keeper.ts +392 -0
  298. package/packages/sdk/src/server/store/link-driver.ts +142 -0
  299. package/packages/sdk/src/server/store/measure.ts +45 -0
  300. package/packages/sdk/src/server/store/migrations.ts +238 -0
  301. package/packages/sdk/src/server/store/move.ts +488 -0
  302. package/packages/sdk/src/server/store/portable.ts +288 -0
  303. package/packages/sdk/src/server/store/stable.ts +146 -0
  304. package/packages/sdk/src/server/store/tables.ts +28 -0
  305. package/packages/sdk/src/server/store/vectors.ts +185 -0
  306. package/packages/sdk/src/server/store/work-checks.ts +288 -0
  307. package/packages/sdk/src/server/store/work.ts +369 -0
  308. package/packages/sdk/src/server/supervise.ts +4 -4
  309. package/packages/sdk/src/server/table.ts +3 -1
  310. package/packages/sdk/src/server/testing.ts +116 -3
  311. package/packages/sdk/src/store.ts +91 -0
  312. package/packages/sdk/src/system.ts +58 -30
  313. package/packages/sdk/src/testing/env.ts +6 -6
  314. package/packages/sdk/src/testing/hub.ts +21 -6
  315. package/packages/sdk/src/testing/models.ts +3 -3
  316. package/packages/sdk/src/testing/openrouter.ts +3 -2
  317. package/packages/sdk/src/testing/preview.ts +7 -7
  318. package/packages/sdk/src/widgets.ts +21 -136
  319. package/packages/sdk/tsconfig.json +2 -2
  320. package/packages/web/dist/assets/{ActorSettingsView-BuMYRDqv.js → ActorSettingsView-CDszUbHz.js} +2 -2
  321. package/packages/web/dist/assets/AdminLayout-CFIz4GsQ.js +2 -0
  322. package/packages/web/dist/assets/{AdminLayout-1hbRPV3d.css → AdminLayout-ggcdQGlQ.css} +1 -1
  323. package/packages/web/dist/assets/{AppPage-DSzDKCFz.js → AppPage-BvoVTk6h.js} +2 -2
  324. package/packages/web/dist/assets/{AutoPairPicker-nV38ALjl.js → AutoPairPicker-CLjD-muP.js} +2 -2
  325. package/packages/web/dist/assets/{BrowserFrame-Bic7U7jN.js → BrowserFrame-BcN-A76X.js} +2 -2
  326. package/packages/web/dist/assets/ChatPage-DhTpAyM2.js +4 -0
  327. package/packages/web/dist/assets/{ChatPage-CbsRmktV.css → ChatPage-DjPv238m.css} +1 -1
  328. package/packages/web/dist/assets/{CodeViewer-xHS3Xah9.js → CodeViewer-K9jrTmFO.js} +2 -2
  329. package/packages/web/dist/assets/ConfigWithCustom-BvrvSVIp.js +3 -0
  330. package/packages/web/dist/assets/{ConfirmDialog-DjQUzNqk.js → ConfirmDialog-BDvLleYf.js} +2 -2
  331. package/packages/web/dist/assets/{ConnectPage-CfRDrXvJ.js → ConnectPage-Dg6IPNNh.js} +2 -2
  332. package/packages/web/dist/assets/ContextItemPage-Cv4G0k_o.css +1 -0
  333. package/packages/web/dist/assets/ContextItemPage-qisBQetR.js +2 -0
  334. package/packages/web/dist/assets/ContextPage-C8u0UnYl.css +1 -0
  335. package/packages/web/dist/assets/ContextPage-DXa6Yqk-.js +3 -0
  336. package/packages/web/dist/assets/ContextRow-Chx99Xac.css +1 -0
  337. package/packages/web/dist/assets/ContextRow-DDYnYRaL.js +2 -0
  338. package/packages/web/dist/assets/{DataPage-wSIoGcb5.js → DataPage-DOE_pKAY.js} +2 -2
  339. package/packages/web/dist/assets/DataTypePage-BnP_JELT.js +2 -0
  340. package/packages/web/dist/assets/{DataTypePage-Cr238Hx_.css → DataTypePage-CWrWvUPs.css} +1 -1
  341. package/packages/web/dist/assets/{DesignPage-DidMUX8m.js → DesignPage-B9MJbF10.js} +3 -3
  342. package/packages/web/dist/assets/{ExplorePage-MUyVydVB.js → ExplorePage-cRDQZRea.js} +2 -2
  343. package/packages/web/dist/assets/{FnPill-BshAvm2I.js → FnPill-CbLZCXYM.js} +2 -2
  344. package/packages/web/dist/assets/{FnView-B8MGAOoB.js → FnView-CG_wBKTP.js} +2 -2
  345. package/packages/web/dist/assets/{FnsView-CeqIoaBT.js → FnsView-BybyK12w.js} +2 -2
  346. package/packages/web/dist/assets/{GinExprView-DYVUwZrd.js → GinExprView-BYCKSD_n.js} +2 -2
  347. package/packages/web/dist/assets/{GinForm-D3mwMRTQ.js → GinForm-CXjYVf2_.js} +2 -2
  348. package/packages/web/dist/assets/{GinTypeView-C0YifSmE.js → GinTypeView-Bmbmx9e_.js} +2 -2
  349. package/packages/web/dist/assets/{GinValueView-HfEPq9le.js → GinValueView-CWUzS7ti.js} +2 -2
  350. package/packages/web/dist/assets/{GraphPage-ySnuA4Hp.js → GraphPage-D6OhckfJ.js} +2 -2
  351. package/packages/web/dist/assets/GraphPanel-BTitgA-K.js +2 -0
  352. package/packages/web/dist/assets/{HubPicker-C_vA752L.js → HubPicker-DVly8dLD.js} +2 -2
  353. package/packages/web/dist/assets/{InboxApprovals-DcPCCmZ5.js → InboxApprovals-BF84edZU.js} +2 -2
  354. package/packages/web/dist/assets/{InboxPage-C2DT2nuF.js → InboxPage-DohZ9EDP.js} +2 -2
  355. package/packages/web/dist/assets/InjectedList-e6qr1kdU.js +2 -0
  356. package/packages/web/dist/assets/InstallDialog-JJCKYs2s.js +2 -0
  357. package/packages/web/dist/assets/{InstallDialog-yWLZK_zN.css → InstallDialog-K-j0sdHm.css} +1 -1
  358. package/packages/web/dist/assets/InstanceTypes-BqUzx87o.js +2 -0
  359. package/packages/web/dist/assets/InstanceTypes-CwVSAULg.css +1 -0
  360. package/packages/web/dist/assets/InstanceView-C73pev7A.js +2 -0
  361. package/packages/web/dist/assets/InstanceView-_9uE70tS.css +1 -0
  362. package/packages/web/dist/assets/{ItemHistory-CUGa8b6s.js → ItemHistory-dbGgOZsw.js} +2 -2
  363. package/packages/web/dist/assets/LimitsView-Ddp5WakY.js +2 -0
  364. package/packages/web/dist/assets/ListSearch-CYNNAuMB.js +2 -0
  365. package/packages/web/dist/assets/{LlmCallDetails-2yQftCqd.js → LlmCallDetails-C9H5Hc2J.js} +2 -2
  366. package/packages/web/dist/assets/{LlmCallsView-DOHX3r0K.js → LlmCallsView-CBqyZ8Cj.js} +2 -2
  367. package/packages/web/dist/assets/{LoadState-DeXfLvYv.js → LoadState-B2YhZlyC.js} +2 -2
  368. package/packages/web/dist/assets/McpDialog-DhlLklIq.js +2 -0
  369. package/packages/web/dist/assets/{McpView-CC2oNOMa.js → McpView-D_ZmNO56.js} +2 -2
  370. package/packages/web/dist/assets/{McpsView-CwJvyyxV.js → McpsView-9_gwBuzw.js} +2 -2
  371. package/packages/web/dist/assets/{MemoryDialog-Dbvh5uLq.js → MemoryDialog-pTHIxKEX.js} +2 -2
  372. package/packages/web/dist/assets/{ModelCallsView-RvnW3EBP.js → ModelCallsView-FHv2XWRX.js} +2 -2
  373. package/packages/web/dist/assets/{ModelPicker-DcjwQFHC.js → ModelPicker-EqOuvVnE.js} +2 -2
  374. package/packages/web/dist/assets/ModelsView-D9UaL4PX.js +2 -0
  375. package/packages/web/dist/assets/{NotFoundPage-CeSwzTV-.js → NotFoundPage-BsuJysan.js} +2 -2
  376. package/packages/web/dist/assets/PairPage-B_ZXsbL4.js +2 -0
  377. package/packages/web/dist/assets/PairPage-D_aPS1Ot.css +1 -0
  378. package/packages/web/dist/assets/{PanelHost-BkrFAnPa.js → PanelHost-Dx-vNNl5.js} +2 -2
  379. package/packages/web/dist/assets/PeopleView-D6dmEgMs.js +2 -0
  380. package/packages/web/dist/assets/{PeopleView-CJ8yArTh.css → PeopleView-DBxdbT1C.css} +1 -1
  381. package/packages/web/dist/assets/PoliciesView-Bn4rm-ao.js +2 -0
  382. package/packages/web/dist/assets/{RefusalList-DQoyUoPG.js → RefusalList-aosRD1ie.js} +2 -2
  383. package/packages/web/dist/assets/RendererHost-Ym_SMkhp.css +1 -0
  384. package/packages/web/dist/assets/RendererHost-rjnpSgyQ.js +2 -0
  385. package/packages/web/dist/assets/{ResourceViewer-Po24y4pj.js → ResourceViewer-C4tRColf.js} +2 -2
  386. package/packages/web/dist/assets/ResourcesPage-7mCLBORZ.js +2 -0
  387. package/packages/web/dist/assets/ResultGrid-CL2WSYQH.css +1 -0
  388. package/packages/web/dist/assets/ResultGrid-GIMoQUAr.js +2 -0
  389. package/packages/web/dist/assets/{ReviewSummaryStrip-k3HevESg.js → ReviewSummaryStrip-Bvjn3Iq8.js} +2 -2
  390. package/packages/web/dist/assets/ReviewView-DIqsUedT.js +3 -0
  391. package/packages/web/dist/assets/{RuleRow-CoXDA-SH.js → RuleRow-zRg-e8Vj.js} +2 -2
  392. package/packages/web/dist/assets/RunCard-C7wOGaw8.js +2 -0
  393. package/packages/web/dist/assets/RunCard-CSDiz-Nt.css +1 -0
  394. package/packages/web/dist/assets/{RunDetails-CGhQQ6OI.js → RunDetails-W4GbE6AE.js} +2 -2
  395. package/packages/web/dist/assets/{RunDot-Ch_45985.js → RunDot-C46uzzNM.js} +2 -2
  396. package/packages/web/dist/assets/{RunPage-C_t20pB7.js → RunPage-DPLtZpeB.js} +2 -2
  397. package/packages/web/dist/assets/{RunProgress-VrZUHUEC.js → RunProgress-Cr_6TBaF.js} +2 -2
  398. package/packages/web/dist/assets/RunsView-tU350TPK.js +2 -0
  399. package/packages/web/dist/assets/{SettingsPage-CykfuYj1.js → SettingsPage-B8QmmMN3.js} +2 -2
  400. package/packages/web/dist/assets/{SettingsPage-t03BqXw8.css → SettingsPage-BTl3Ie4F.css} +1 -1
  401. package/packages/web/dist/assets/SignInPage-CXxLf7Rp.css +1 -0
  402. package/packages/web/dist/assets/{SignInPage-DrXZ1sG2.js → SignInPage-DTwdqlnB.js} +2 -2
  403. package/packages/web/dist/assets/{StatusBadge-Dpb9uG5e.js → StatusBadge-D7wKMAcD.js} +2 -2
  404. package/packages/web/dist/assets/StorePlacementStep-C04nRU-u.js +2 -0
  405. package/packages/web/dist/assets/StorePlacementStep-D_G4e3ue.css +1 -0
  406. package/packages/web/dist/assets/{SystemConfig-72qKRkUk.js → SystemConfig-CE3keXWq.js} +2 -2
  407. package/packages/web/dist/assets/SystemPageHost-CEhz4li8.js +2 -0
  408. package/packages/web/dist/assets/SystemPageHost-DX7LrFoN.css +1 -0
  409. package/packages/web/dist/assets/SystemView-CBFzEGfm.js +2 -0
  410. package/packages/web/dist/assets/{SystemView-C8ScHUe2.css → SystemView-_9q6eDfV.css} +1 -1
  411. package/packages/web/dist/assets/SystemsView-0G8JntMV.js +2 -0
  412. package/packages/web/dist/assets/{SystemsView-B6HEL9VS.css → SystemsView-CWKnupLW.css} +1 -1
  413. package/packages/web/dist/assets/TableView-BK0uwLHl.js +3 -0
  414. package/packages/web/dist/assets/TableView-B_4MViVb.css +1 -0
  415. package/packages/web/dist/assets/{TableViewer-BQ7bYLOP.js → TableViewer-nbMInGJJ.js} +2 -2
  416. package/packages/web/dist/assets/{ThemePicker-C2nJ21Vd.js → ThemePicker-fZpVSYqG.js} +2 -2
  417. package/packages/web/dist/assets/{TurnTree-CORdfTHj.js → TurnTree-Co-iBqhT.js} +2 -2
  418. package/packages/web/dist/assets/{UserMessage-BtECa8ka.css → UserMessage-B63G9sxC.css} +1 -1
  419. package/packages/web/dist/assets/{UserMessage-qyc8dG5D.js → UserMessage-CDjUxKY0.js} +6 -6
  420. package/packages/web/dist/assets/{ValueVisual-aXEUaQ5Y.js → ValueVisual-EJnCKgSy.js} +2 -2
  421. package/packages/web/dist/assets/actor-names-OdvpVZeb.js +4 -0
  422. package/packages/web/dist/assets/{fn-modal-DqcxUhOQ.js → fn-modal-DtE65mFt.js} +2 -2
  423. package/packages/web/dist/assets/{fn-notices-BYaH6IoA.js → fn-notices-CCZ-DFbi.js} +2 -2
  424. package/packages/web/dist/assets/{formats-DI__ADVG.js → formats-CyHV2siv.js} +2 -2
  425. package/packages/web/dist/assets/index-BY7M8QUk.css +1 -0
  426. package/packages/web/dist/assets/index-OZS2EluT.js +4 -0
  427. package/packages/web/dist/assets/{labels-BhJpmLWA.js → labels-CT7_K0Pt.js} +2 -2
  428. package/packages/web/dist/assets/{layout-DQKldU13.js → layout-B6fBDg80.js} +2 -2
  429. package/packages/web/dist/assets/loaded-LaPjk6mK.js +2 -0
  430. package/packages/web/dist/assets/{metrics-Cio5ykX6.js → metrics-9n8bKI7u.js} +2 -2
  431. package/packages/web/dist/assets/problems--AW4igVY.js +2 -0
  432. package/packages/web/dist/assets/{push-payload-D5efGCzd.js → push-payload-B3EcrsVz.js} +64 -64
  433. package/packages/web/dist/assets/record-edits-B-FWAbxR.js +2 -0
  434. package/packages/web/dist/assets/{review-CGUGvRV9.js → review-uLESCEz1.js} +3 -3
  435. package/packages/web/dist/assets/routes-B7Zmt8wh.js +4 -0
  436. package/packages/web/dist/assets/runs-CUb2PTFg.js +2 -0
  437. package/packages/web/dist/assets/{shared-DTpYDMc_.js → shared-Bxhw_9et.js} +2 -2
  438. package/packages/web/dist/assets/{sources-Bm-TrxhL.js → sources-YgkjgFLe.js} +2 -2
  439. package/packages/web/dist/assets/src-DY1fSFJS.js +43 -0
  440. package/packages/web/dist/assets/state-ChQDWWj-.js +2 -0
  441. package/packages/web/dist/assets/{systems-DIp94AET.js → systems-CjwjRySu.js} +2 -2
  442. package/packages/web/dist/assets/table-host-B_D9dmCz.js +2 -0
  443. package/packages/web/dist/assets/tables-CaxIuHdw.js +2 -0
  444. package/packages/web/dist/assets/ui-DWjytmDS.js +17 -0
  445. package/packages/web/dist/assets/{ui-C7ZH_6oC.css → ui-DycHjPTZ.css} +1 -1
  446. package/packages/web/dist/assets/{url-BIg5IhGs.js → url-DbGOI14W.js} +2 -2
  447. package/packages/web/dist/index.html +52 -50
  448. package/packages/web/dist/sw.js +1 -1
  449. package/packages/web/package.json +2 -4
  450. package/premade/claude.zip +0 -0
  451. package/premade/database.zip +0 -0
  452. package/premade/web.zip +0 -0
  453. package/scripts/dev-env.ts +9 -9
  454. package/scripts/run-stack.ts +17 -16
  455. package/scripts/stack.ts +76 -19
  456. package/scripts/start.ts +27 -18
  457. package/systems/api/client/ApiServiceForm.vue +55 -0
  458. package/systems/api/client/ServiceList.vue +90 -0
  459. package/systems/api/client/ServicePage.vue +142 -0
  460. package/systems/api/client/ServicesPage.vue +32 -0
  461. package/systems/api/client/index.ts +15 -0
  462. package/systems/api/client/logic.ts +140 -0
  463. package/systems/api/client/state.ts +92 -0
  464. package/systems/api/package.json +9 -6
  465. package/systems/api/server/authoring.ts +2 -1
  466. package/systems/api/server/env.ts +1 -1
  467. package/systems/api/server/guard.ts +1 -1
  468. package/systems/api/server/http.ts +3 -2
  469. package/systems/api/server/impl.ts +3 -2
  470. package/systems/api/server/main.ts +11 -7
  471. package/systems/api/server/openapi.ts +1 -1
  472. package/systems/api/server/program.ts +2 -1
  473. package/systems/api/server/services.ts +2 -1
  474. package/systems/api/shared/http.ts +2 -1
  475. package/systems/api/shared/index.ts +15 -5
  476. package/{packages/core/src/programs.ts → systems/api/shared/services.ts} +7 -51
  477. package/systems/api/system.json +2 -1
  478. package/systems/api/tsconfig.json +2 -2
  479. package/systems/code/package.json +4 -3
  480. package/systems/code/server/authoring.ts +2 -1
  481. package/systems/code/server/impl.ts +2 -1
  482. package/systems/code/server/main.ts +5 -5
  483. package/systems/code/shared/index.ts +2 -3
  484. package/systems/code/shared/program.ts +23 -0
  485. package/systems/embedder/package.json +1 -1
  486. package/systems/embedder/server/env.ts +1 -1
  487. package/systems/embedder/server/main.ts +5 -5
  488. package/systems/embedder/shared/index.ts +1 -1
  489. package/systems/fs/client/fakes.ts +2 -0
  490. package/systems/fs/client/index.ts +4 -2
  491. package/systems/fs/client/machines/CoreHeatmap.vue +94 -0
  492. package/systems/fs/client/machines/MachineFiles.vue +121 -0
  493. package/systems/fs/client/machines/MachineMetrics.vue +330 -0
  494. package/systems/fs/client/machines/MachinesPage.vue +119 -0
  495. package/systems/fs/client/machines/TimeChart.vue +128 -0
  496. package/systems/fs/client/machines/fakes.ts +95 -0
  497. package/systems/fs/client/machines/files/ChangesPane.vue +90 -0
  498. package/systems/fs/client/machines/files/CodeView.vue +158 -0
  499. package/systems/fs/client/machines/files/CommentComposer.vue +86 -0
  500. package/systems/fs/client/machines/files/CommentThread.vue +115 -0
  501. package/systems/fs/client/machines/files/CommitPane.vue +80 -0
  502. package/systems/fs/client/machines/files/ComparePane.vue +81 -0
  503. package/systems/fs/client/machines/files/FileHistory.vue +89 -0
  504. package/systems/fs/client/machines/files/FilePane.vue +199 -0
  505. package/systems/fs/client/machines/files/FileTree.vue +26 -0
  506. package/systems/fs/client/machines/files/FolderPane.vue +154 -0
  507. package/systems/fs/client/machines/files/HistoryPane.vue +106 -0
  508. package/systems/fs/client/machines/files/ImageView.vue +160 -0
  509. package/systems/fs/client/machines/files/PatchView.vue +31 -0
  510. package/systems/fs/client/machines/files/QuickOpen.vue +67 -0
  511. package/systems/fs/client/machines/files/SearchPane.vue +87 -0
  512. package/systems/fs/client/machines/files/TreeNode.vue +72 -0
  513. package/systems/fs/client/machines/files/api.ts +127 -0
  514. package/systems/fs/client/machines/files/fake-kinds.ts +16 -0
  515. package/systems/fs/client/machines/files/fakes.ts +305 -0
  516. package/systems/fs/client/machines/files/ink.ts +117 -0
  517. package/systems/fs/client/machines/files/logic.ts +205 -0
  518. package/systems/fs/client/machines/files/state.ts +187 -0
  519. package/systems/fs/client/machines/files/viewers/CsvView.vue +29 -0
  520. package/systems/fs/client/machines/files/viewers/HexView.vue +27 -0
  521. package/systems/fs/client/machines/files/viewers/HtmlView.vue +17 -0
  522. package/systems/fs/client/machines/files/viewers/JsonNode.vue +45 -0
  523. package/systems/fs/client/machines/files/viewers/JsonView.vue +25 -0
  524. package/systems/fs/client/machines/metrics.ts +245 -0
  525. package/systems/fs/client/machines/palette.ts +98 -0
  526. package/systems/fs/client/preview/machines.ts +323 -0
  527. package/systems/fs/context/authoring/index.md +4 -0
  528. package/systems/fs/context/authoring/parts/actions.md +5 -1
  529. package/systems/fs/context/authoring/parts/actions.reference.md +6 -2
  530. package/systems/fs/context/authoring/parts/calling.md +5 -1
  531. package/systems/fs/context/authoring/parts/calling.reference.md +4 -0
  532. package/systems/fs/context/authoring/parts/client.md +31 -5
  533. package/systems/fs/context/authoring/parts/client.reference/client.md +8 -13
  534. package/systems/fs/context/authoring/parts/client.reference/pageinbox.md +524 -0
  535. package/systems/fs/context/authoring/parts/client.reference/{resultview.md → visuals.md} +135 -163
  536. package/systems/fs/context/authoring/parts/client.reference.md +11 -7
  537. package/systems/fs/context/authoring/parts/context/questions.md +49 -0
  538. package/systems/fs/context/authoring/parts/context.md +24 -2
  539. package/systems/fs/context/authoring/parts/context.reference.md +27 -3
  540. package/systems/fs/context/authoring/parts/contract.md +11 -1
  541. package/systems/fs/context/authoring/parts/contract.reference.md +26 -9
  542. package/systems/fs/context/authoring/parts/core-types/access-ts.md +4 -0
  543. package/systems/fs/context/authoring/parts/core-types/admin-ts.md +6 -2
  544. package/systems/fs/context/authoring/parts/core-types/api-index-ts.md +4 -0
  545. package/systems/fs/context/authoring/parts/core-types/approvals-ts.md +11 -7
  546. package/systems/fs/context/authoring/parts/core-types/auto-pair-ts.md +4 -0
  547. package/systems/fs/context/authoring/parts/core-types/checks-ts.md +4 -0
  548. package/systems/fs/context/authoring/parts/core-types/claims-ts.md +4 -0
  549. package/systems/fs/context/authoring/parts/core-types/config-secrets-ts.md +4 -0
  550. package/systems/fs/context/authoring/parts/core-types/connections-ts.md +15 -0
  551. package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +9 -1
  552. package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +6 -2
  553. package/systems/fs/context/authoring/parts/core-types/context-questions-ts.md +26 -0
  554. package/systems/fs/context/authoring/parts/core-types/contextdecl.md +10 -2
  555. package/systems/fs/context/authoring/parts/core-types/data-ts.md +4 -0
  556. package/systems/fs/context/authoring/parts/core-types/decisions-ts.md +4 -0
  557. package/systems/fs/context/authoring/parts/core-types/fn-block-ts.md +4 -0
  558. package/systems/fs/context/authoring/parts/core-types/fn-facts-ts.md +11 -0
  559. package/systems/fs/context/authoring/parts/core-types/gin-ts.md +4 -0
  560. package/systems/fs/context/authoring/parts/core-types/grants-ts.md +5 -1
  561. package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +44 -6
  562. package/systems/fs/context/authoring/parts/core-types/link-ts.md +7 -3
  563. package/systems/fs/context/authoring/parts/core-types/llm-ts.md +4 -0
  564. package/systems/fs/context/authoring/parts/core-types/manifest.md +41 -3
  565. package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +34 -2
  566. package/systems/fs/context/authoring/parts/core-types/mention-search-ts.md +4 -0
  567. package/systems/fs/context/authoring/parts/core-types/model-calls-ts.md +5 -1
  568. package/systems/fs/context/authoring/parts/core-types/model-names-ts.md +4 -0
  569. package/systems/fs/context/authoring/parts/core-types/modes-ts.md +6 -2
  570. package/systems/fs/context/authoring/parts/core-types/owner-runs-ts.md +4 -0
  571. package/systems/fs/context/authoring/parts/core-types/package-ts.md +9 -0
  572. package/systems/fs/context/authoring/parts/core-types/primitives-ts.md +4 -0
  573. package/systems/fs/context/authoring/parts/core-types/query-ts.md +4 -0
  574. package/systems/fs/context/authoring/parts/core-types/records-actors-ts.md +7 -3
  575. package/systems/fs/context/authoring/parts/core-types/records-chat-ts.md +4 -0
  576. package/systems/fs/context/authoring/parts/core-types/records-content-ts.md +4 -0
  577. package/systems/fs/context/authoring/parts/core-types/records-runs-ts.md +4 -0
  578. package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +148 -0
  579. package/systems/fs/context/authoring/parts/core-types/registries-ts.md +101 -1
  580. package/systems/fs/context/authoring/parts/core-types/resources-ts.md +5 -1
  581. package/systems/fs/context/authoring/parts/core-types/run-ts.md +8 -1
  582. package/systems/fs/context/authoring/parts/core-types/sensitivity-ts.md +5 -1
  583. package/systems/fs/context/authoring/parts/core-types/stores-ts.md +199 -0
  584. package/systems/fs/context/authoring/parts/core-types/system-events-ts.md +8 -1
  585. package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +7 -1
  586. package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +5 -1
  587. package/systems/fs/context/authoring/parts/core-types/tables-ts.md +91 -0
  588. package/systems/fs/context/authoring/parts/core-types/validation-ts.md +4 -0
  589. package/systems/fs/context/authoring/parts/core-types/visuals-ts.md +4 -0
  590. package/systems/fs/context/authoring/parts/core-types/web-ts.md +4 -1
  591. package/systems/fs/context/authoring/parts/core-types.md +15 -8
  592. package/systems/fs/context/authoring/parts/ctx/update-result.md +33 -0
  593. package/systems/fs/context/authoring/parts/ctx.md +11 -1
  594. package/systems/fs/context/authoring/parts/ctx.reference/{hubai.md → adminnotices.md} +45 -4
  595. package/systems/fs/context/authoring/parts/ctx.reference/fnctx.md +21 -23
  596. package/systems/fs/context/authoring/parts/ctx.reference.md +8 -4
  597. package/systems/fs/context/authoring/parts/data.md +11 -6
  598. package/systems/fs/context/authoring/parts/data.reference.md +4 -0
  599. package/systems/fs/context/authoring/parts/examples/client-findview-vue.md +4 -0
  600. package/systems/fs/context/authoring/parts/examples/client-index-ts.md +4 -0
  601. package/systems/fs/context/authoring/parts/examples/client-notecard-vue.md +4 -0
  602. package/systems/fs/context/authoring/parts/examples/client-noteinput-vue.md +4 -0
  603. package/systems/fs/context/authoring/parts/examples/client-notespage-vue.md +4 -0
  604. package/systems/fs/context/authoring/parts/examples/client-reviewform-vue.md +4 -0
  605. package/systems/fs/context/authoring/parts/examples/client-wordcount-vue.md +4 -0
  606. package/systems/fs/context/authoring/parts/examples/package-json.md +4 -0
  607. package/systems/fs/context/authoring/parts/examples/server-env-ts.md +4 -0
  608. package/systems/fs/context/authoring/parts/examples/server-impl-ts.md +4 -0
  609. package/systems/fs/context/authoring/parts/examples/server-index-ts.md +4 -0
  610. package/systems/fs/context/authoring/parts/examples/server-main-ts.md +8 -4
  611. package/systems/fs/context/authoring/parts/examples/server-notes-test-ts.md +4 -0
  612. package/systems/fs/context/authoring/parts/examples/shared-index-ts.md +10 -0
  613. package/systems/fs/context/authoring/parts/examples/system-json.md +4 -0
  614. 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
  615. 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
  616. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-383-567.md +210 -0
  617. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +117 -0
  618. package/systems/fs/context/authoring/parts/examples/tsconfig-json.md +5 -1
  619. package/systems/fs/context/authoring/parts/examples.md +18 -11
  620. package/systems/fs/context/authoring/parts/fns.md +6 -2
  621. package/systems/fs/context/authoring/parts/fns.reference/fillclaims.md +5 -1
  622. package/systems/fs/context/authoring/parts/fns.reference/fn.md +6 -2
  623. package/systems/fs/context/authoring/parts/fns.reference.md +4 -0
  624. package/systems/fs/context/authoring/parts/folder.md +10 -6
  625. package/systems/fs/context/authoring/parts/gin.md +4 -0
  626. package/systems/fs/context/authoring/parts/gin.reference.md +4 -0
  627. package/systems/fs/context/authoring/parts/handlers-progress.md +5 -1
  628. package/systems/fs/context/authoring/parts/handlers-progress.reference.md +4 -0
  629. package/systems/fs/context/authoring/parts/hooks.md +5 -1
  630. package/systems/fs/context/authoring/parts/hooks.reference.md +5 -1
  631. package/systems/fs/context/authoring/parts/hub/context-questions.md +40 -0
  632. package/systems/fs/context/authoring/parts/hub/{hub-run-background.md → hub-ctx-from-resource.md} +52 -57
  633. package/systems/fs/context/authoring/parts/hub/hub-fns-load.md +35 -42
  634. package/systems/fs/context/authoring/parts/hub/hub-install-package.md +327 -0
  635. package/systems/fs/context/authoring/parts/hub/kinds-of-hub.md +8 -0
  636. package/systems/fs/context/authoring/parts/hub.md +14 -8
  637. package/systems/fs/context/authoring/parts/hub.reference.md +11 -2
  638. package/systems/fs/context/authoring/parts/internals/manifestof.md +6 -2
  639. package/systems/fs/context/authoring/parts/internals/permissionargs.md +8 -4
  640. package/systems/fs/context/authoring/parts/internals/usagefromwire.md +47 -2
  641. package/systems/fs/context/authoring/parts/internals.md +6 -2
  642. package/systems/fs/context/authoring/parts/kinds-agents.md +6 -2
  643. package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +10 -4
  644. package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +11 -7
  645. package/systems/fs/context/authoring/parts/kinds-agents.reference.md +4 -0
  646. package/systems/fs/context/authoring/parts/lifecycle.md +8 -3
  647. package/systems/fs/context/authoring/parts/lifecycle.reference.md +6 -2
  648. package/systems/fs/context/authoring/parts/mentions.md +5 -1
  649. package/systems/fs/context/authoring/parts/mentions.reference.md +6 -2
  650. package/systems/fs/context/authoring/parts/mistakes.md +7 -2
  651. package/systems/fs/context/authoring/parts/named-types.md +4 -0
  652. package/systems/fs/context/authoring/parts/named-types.reference.md +6 -2
  653. package/systems/fs/context/authoring/parts/outcomes.md +7 -3
  654. package/systems/fs/context/authoring/parts/outcomes.reference.md +6 -2
  655. package/systems/fs/context/authoring/parts/owner-runs.md +5 -1
  656. package/systems/fs/context/authoring/parts/owner-runs.reference.md +36 -11
  657. package/systems/fs/context/authoring/parts/packaging.md +14 -7
  658. package/systems/fs/context/authoring/parts/packaging.reference.md +7 -2
  659. package/systems/fs/context/authoring/parts/providers.md +5 -1
  660. package/systems/fs/context/authoring/parts/providers.reference.md +5 -1
  661. package/systems/fs/context/authoring/parts/remote.md +9 -5
  662. package/systems/fs/context/authoring/parts/remote.reference.md +204 -16
  663. package/systems/fs/context/authoring/parts/resources.md +5 -1
  664. package/systems/fs/context/authoring/parts/resources.reference.md +4 -0
  665. package/systems/fs/context/authoring/parts/server.md +12 -8
  666. package/systems/fs/context/authoring/parts/server.reference.md +55 -34
  667. package/systems/fs/context/authoring/parts/settings-attachments.md +5 -1
  668. package/systems/fs/context/authoring/parts/settings-attachments.reference.md +4 -0
  669. package/systems/fs/context/authoring/parts/start.md +5 -1
  670. package/systems/fs/context/authoring/parts/state-forms.md +5 -1
  671. package/systems/fs/context/authoring/parts/state-forms.reference.md +4 -0
  672. package/systems/fs/context/authoring/parts/store/ctx-store.md +49 -0
  673. package/systems/fs/context/authoring/parts/store/declare.md +32 -0
  674. package/systems/fs/context/authoring/parts/store/engines.md +25 -0
  675. package/systems/fs/context/authoring/parts/store/migrations.md +53 -0
  676. package/systems/fs/context/authoring/parts/store/moves.md +38 -0
  677. package/systems/fs/context/authoring/parts/store/placement.md +25 -0
  678. package/systems/fs/context/authoring/parts/store/serve.md +30 -0
  679. package/systems/fs/context/authoring/parts/store/store-tables.md +24 -0
  680. package/systems/fs/context/authoring/parts/store/vectors.md +32 -0
  681. package/systems/fs/context/authoring/parts/store/when-to-use.md +27 -0
  682. package/systems/fs/context/authoring/parts/store/work.md +37 -0
  683. package/systems/fs/context/authoring/parts/store.md +65 -0
  684. package/systems/fs/context/authoring/parts/store.reference.md +459 -0
  685. package/systems/fs/context/authoring/parts/testing.md +14 -1
  686. package/systems/fs/context/authoring/parts/testing.reference/{memoryjournal.md → equal.md} +57 -50
  687. package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +27 -46
  688. package/systems/fs/context/authoring/parts/testing.reference/{toolcall.md → kindprops.md} +128 -9
  689. package/systems/fs/context/authoring/parts/testing.reference/storeconnection.md +93 -0
  690. package/systems/fs/context/authoring/parts/testing.reference.md +16 -9
  691. package/systems/fs/context/authoring/parts/widgets.md +36 -22
  692. package/systems/fs/context/authoring/parts/widgets.reference.md +506 -8
  693. package/systems/fs/context/authoring/topics/begin.md +4 -0
  694. package/systems/fs/context/authoring/topics/client.md +4 -0
  695. package/systems/fs/context/authoring/topics/declare.md +4 -0
  696. package/systems/fs/context/authoring/topics/examples.md +4 -0
  697. package/systems/fs/context/authoring/topics/fns.md +4 -0
  698. package/systems/fs/context/authoring/topics/server.md +4 -0
  699. package/systems/fs/context/authoring/topics/types.md +8 -1
  700. package/systems/fs/context/comments/answer.md +21 -0
  701. package/systems/fs/context/comments/find.md +23 -0
  702. package/systems/fs/context/comments/read.md +26 -0
  703. package/systems/fs/context/comments.md +23 -0
  704. package/systems/fs/context/files-page.md +30 -0
  705. package/systems/fs/context/guide/attachments.md +16 -0
  706. package/systems/fs/context/guide/change.md +23 -0
  707. package/systems/fs/context/guide/commands.md +19 -0
  708. package/systems/fs/context/guide/documents.md +21 -0
  709. package/systems/fs/context/guide/find.md +25 -0
  710. package/systems/fs/context/guide/paths.md +24 -0
  711. package/systems/fs/context/guide/read.md +21 -0
  712. package/systems/fs/context/machine/history.md +25 -0
  713. package/systems/fs/context/machine/now.md +25 -0
  714. package/systems/fs/context/machine/processes.md +20 -0
  715. package/systems/fs/context/machine/recording.md +19 -0
  716. package/systems/fs/context/machine.md +24 -0
  717. package/systems/fs/package.json +5 -3
  718. package/systems/fs/server/files-page/browse.ts +391 -0
  719. package/systems/fs/server/files-page/comments.ts +439 -0
  720. package/systems/fs/server/files-page/fns.ts +158 -0
  721. package/systems/fs/server/files-page/git-view.ts +391 -0
  722. package/systems/fs/server/files-page/kinds.ts +56 -0
  723. package/systems/fs/server/hosting.ts +10 -10
  724. package/systems/fs/server/impl.ts +66 -7
  725. package/systems/fs/server/main.ts +28 -12
  726. package/systems/fs/server/metrics/collector.ts +424 -0
  727. package/systems/fs/server/metrics/index.ts +181 -0
  728. package/systems/fs/server/metrics/os.ts +144 -0
  729. package/systems/fs/server/metrics/parsers.ts +268 -0
  730. package/systems/fs/server/metrics/rrd.ts +363 -0
  731. package/systems/fs/server/metrics/testing.ts +80 -0
  732. package/systems/fs/server/shell.ts +1 -1
  733. package/systems/fs/server/snapshots.ts +216 -33
  734. package/systems/fs/server/testing.ts +15 -9
  735. package/systems/fs/shared/files-page.ts +506 -0
  736. package/systems/fs/shared/index.ts +138 -11
  737. package/systems/fs/shared/metrics.ts +179 -0
  738. package/systems/fs/system.json +10 -1
  739. package/systems/google-calendar/package.json +1 -1
  740. package/systems/google-calendar/server/main.ts +4 -4
  741. package/systems/input/package.json +3 -3
  742. package/systems/input/server/main.ts +6 -6
  743. package/systems/mcp/client/McpServerForm.vue +99 -0
  744. package/systems/mcp/client/ServerList.vue +78 -0
  745. package/systems/mcp/client/ServerPage.vue +194 -0
  746. package/systems/mcp/client/ServersPage.vue +32 -0
  747. package/systems/mcp/client/index.ts +15 -0
  748. package/systems/mcp/client/logic.ts +224 -0
  749. package/systems/mcp/client/state.ts +128 -0
  750. package/systems/mcp/package.json +9 -6
  751. package/systems/mcp/server/dial.ts +1 -1
  752. package/systems/mcp/server/impl.ts +2 -1
  753. package/systems/mcp/server/instance.ts +3 -5
  754. package/systems/mcp/server/main.ts +10 -6
  755. package/systems/mcp/server/mirror.ts +2 -3
  756. package/systems/mcp/server/oauth.ts +3 -2
  757. package/systems/mcp/server/server-link.ts +2 -1
  758. package/systems/mcp/shared/index.ts +15 -2
  759. package/{packages/core/src/mcp-servers.ts → systems/mcp/shared/servers.ts} +6 -5
  760. package/systems/mcp/system.json +2 -1
  761. package/systems/mcp/tsconfig.json +2 -2
  762. package/systems/ollama/package.json +3 -3
  763. package/systems/ollama/server/main.ts +5 -5
  764. package/systems/schedule/package.json +3 -4
  765. package/systems/schedule/server/env.ts +1 -1
  766. package/systems/schedule/server/fns.ts +5 -4
  767. package/systems/schedule/server/impl.ts +2 -2
  768. package/systems/schedule/server/import.ts +189 -0
  769. package/systems/schedule/server/index.ts +2 -0
  770. package/systems/schedule/server/main.ts +9 -7
  771. package/systems/schedule/server/placements.ts +41 -0
  772. package/systems/schedule/server/store.ts +159 -79
  773. package/systems/schedule/server/timer.ts +142 -107
  774. package/systems/schedule/shared/index.ts +2 -1
  775. package/systems/schedule/system.json +5 -1
  776. package/systems/schedule/tsconfig.json +1 -1
  777. package/systems/template/README.md +2 -2
  778. package/systems/template/package.json +1 -1
  779. package/systems/template/server/main.ts +4 -4
  780. package/systems/widgets/client/ChipRow.vue +22 -0
  781. package/systems/widgets/client/ProposalCard.vue +6 -5
  782. package/systems/widgets/client/SavedWidget.vue +11 -8
  783. package/systems/widgets/client/WidgetChips.vue +137 -0
  784. package/systems/widgets/client/WidgetView.vue +32 -0
  785. package/systems/widgets/client/charts/ChartVisual.vue +157 -0
  786. package/systems/widgets/client/charts/chart-data.ts +230 -0
  787. package/systems/widgets/client/charts/echarts-setup.ts +69 -0
  788. package/systems/widgets/client/charts/export.ts +36 -0
  789. package/systems/widgets/client/charts/families/calendar.ts +105 -0
  790. package/systems/widgets/client/charts/families/category.ts +186 -0
  791. package/systems/widgets/client/charts/families/crosstab.ts +113 -0
  792. package/systems/widgets/client/charts/families/distribution.ts +160 -0
  793. package/systems/widgets/client/charts/families/finance.ts +96 -0
  794. package/systems/widgets/client/charts/families/gauge.ts +75 -0
  795. package/systems/widgets/client/charts/families/hierarchy.ts +166 -0
  796. package/systems/widgets/client/charts/families/index.ts +21 -0
  797. package/systems/widgets/client/charts/families/network.ts +140 -0
  798. package/systems/widgets/client/charts/families/part.ts +61 -0
  799. package/systems/widgets/client/charts/families/profile.ts +30 -0
  800. package/systems/widgets/client/charts/families/progress.ts +76 -0
  801. package/systems/widgets/client/charts/families/range.ts +107 -0
  802. package/systems/widgets/client/charts/families/time.ts +177 -0
  803. package/systems/widgets/client/charts/families/timeline.ts +114 -0
  804. package/systems/widgets/client/charts/families/wide.ts +41 -0
  805. package/systems/widgets/client/charts/index.ts +37 -0
  806. package/systems/widgets/client/charts/maths.ts +139 -0
  807. package/systems/widgets/client/charts/size.ts +39 -0
  808. package/systems/widgets/client/chips.ts +150 -0
  809. package/systems/widgets/client/index.ts +18 -5
  810. package/systems/widgets/client/proposal.ts +2 -1
  811. package/systems/widgets/package.json +7 -4
  812. package/systems/widgets/server/authoring.ts +13 -7
  813. package/systems/widgets/server/env.ts +1 -1
  814. package/systems/widgets/server/impl.ts +10 -6
  815. package/systems/widgets/server/main.ts +6 -6
  816. package/systems/widgets/server/run.ts +16 -9
  817. package/systems/widgets/server/upgrade.ts +34 -0
  818. package/systems/widgets/shared/args.ts +137 -0
  819. package/systems/widgets/shared/charts.ts +243 -0
  820. package/systems/widgets/shared/index.ts +12 -3
  821. package/{packages/sdk/src → systems/widgets/shared}/relative-dates.ts +2 -1
  822. package/systems/widgets/shared/spec.ts +208 -0
  823. package/{packages/sdk/src → systems/widgets/shared}/widget-check.ts +7 -9
  824. package/{packages/sdk/src → systems/widgets/shared}/widget-schema.ts +4 -4
  825. package/packages/core/src/remote-auth.ts +0 -111
  826. package/packages/core/src/widgets.ts +0 -427
  827. package/packages/web/dist/assets/AdminLayout-sLjVTrmV.js +0 -2
  828. package/packages/web/dist/assets/ApiServiceForm-BrMTU-7u.js +0 -2
  829. package/packages/web/dist/assets/ApiServiceForm-BxprSaAq.css +0 -1
  830. package/packages/web/dist/assets/ApiServiceView-BMF2zD6Q.js +0 -2
  831. package/packages/web/dist/assets/ApiServiceView-BVmdRCjR.css +0 -1
  832. package/packages/web/dist/assets/ApiServicesView-BTLV6c8n.css +0 -1
  833. package/packages/web/dist/assets/ApiServicesView-bjLAWO_j.js +0 -2
  834. package/packages/web/dist/assets/ChartVisual-BnFG9aFi.css +0 -1
  835. package/packages/web/dist/assets/ChartVisual-DWw7WsfN.js +0 -11
  836. package/packages/web/dist/assets/ChatPage-7Yebk7rl.js +0 -4
  837. package/packages/web/dist/assets/ConfigWithCustom-DreTUdf0.js +0 -3
  838. package/packages/web/dist/assets/ContextItemPage-B6rJG3OT.js +0 -2
  839. package/packages/web/dist/assets/ContextItemPage-BRsWxOmu.css +0 -1
  840. package/packages/web/dist/assets/ContextPage-CloIZ_2y.js +0 -2
  841. package/packages/web/dist/assets/ContextPage-rYKxjiVI.css +0 -1
  842. package/packages/web/dist/assets/ContextRow-Byz_7HG-.css +0 -1
  843. package/packages/web/dist/assets/ContextRow-Dvv8CTFk.js +0 -2
  844. package/packages/web/dist/assets/DataTypePage-Ba_zBV4b.js +0 -4
  845. package/packages/web/dist/assets/FnList-BCnb4kOB.css +0 -1
  846. package/packages/web/dist/assets/FnList-CjQRwYaT.js +0 -2
  847. package/packages/web/dist/assets/GraphPanel-Cy5-KGo1.js +0 -2
  848. package/packages/web/dist/assets/InjectedList-CJsEFEbz.js +0 -2
  849. package/packages/web/dist/assets/InstallDialog-C9GDoUI2.js +0 -2
  850. package/packages/web/dist/assets/InstanceTypes-D8Jcxn70.js +0 -2
  851. package/packages/web/dist/assets/InstanceTypes-DAowwLB7.css +0 -1
  852. package/packages/web/dist/assets/InstanceView-CuBD3JPU.css +0 -1
  853. package/packages/web/dist/assets/InstanceView-p7tMaylE.js +0 -2
  854. package/packages/web/dist/assets/LimitsView-DsZG6u5P.js +0 -2
  855. package/packages/web/dist/assets/ListSearch-BK4p7Nxa.js +0 -2
  856. package/packages/web/dist/assets/McpDialog-CA_0WKWF.js +0 -2
  857. package/packages/web/dist/assets/McpServerForm-CAG8Wp2N.js +0 -2
  858. package/packages/web/dist/assets/McpServerForm-DsHaf5Um.css +0 -1
  859. package/packages/web/dist/assets/McpServerView-7I76EznB.css +0 -1
  860. package/packages/web/dist/assets/McpServerView-CD8qw6W_.js +0 -2
  861. package/packages/web/dist/assets/McpServersView-DNycG35u.js +0 -2
  862. package/packages/web/dist/assets/ModelsView-C_iN19xt.js +0 -2
  863. package/packages/web/dist/assets/PairPage-Bs2KuRjC.css +0 -1
  864. package/packages/web/dist/assets/PairPage-TEXPpsqi.js +0 -2
  865. package/packages/web/dist/assets/PeopleView-D1QGPYp7.js +0 -2
  866. package/packages/web/dist/assets/PoliciesView-BU1fudNF.js +0 -2
  867. package/packages/web/dist/assets/RemoteAuthFields-Dm44vz2t.css +0 -1
  868. package/packages/web/dist/assets/RemoteAuthFields-nxGWfmhf.js +0 -2
  869. package/packages/web/dist/assets/ResourcesPage-YluNBqIv.js +0 -2
  870. package/packages/web/dist/assets/ResultGrid-CuUQyTjW.css +0 -1
  871. package/packages/web/dist/assets/ResultGrid-uoq4yUYj.js +0 -2
  872. package/packages/web/dist/assets/ReviewView-79Z5rU1v.js +0 -3
  873. package/packages/web/dist/assets/RunCard-CBSGdwdQ.js +0 -2
  874. package/packages/web/dist/assets/RunCard-CfyRaDLS.css +0 -1
  875. package/packages/web/dist/assets/RunsView-Dz9Xsvu5.js +0 -2
  876. package/packages/web/dist/assets/ServiceRows-6BU4-MeL.css +0 -1
  877. package/packages/web/dist/assets/ServiceRows-DNzDiutg.js +0 -2
  878. package/packages/web/dist/assets/SignInPage-Djx-M-0U.css +0 -1
  879. package/packages/web/dist/assets/SystemPageHost-BeZ-6N0-.css +0 -1
  880. package/packages/web/dist/assets/SystemPageHost-DLNg2FYK.js +0 -2
  881. package/packages/web/dist/assets/SystemView-Es5wtkYU.js +0 -2
  882. package/packages/web/dist/assets/SystemsView-CeuSFhlF.js +0 -2
  883. package/packages/web/dist/assets/WidgetView-BZyDyYRI.js +0 -3
  884. package/packages/web/dist/assets/WidgetView-DQUDeFkB.css +0 -1
  885. package/packages/web/dist/assets/export-BwFkEtcm.js +0 -15
  886. package/packages/web/dist/assets/index-Bv42jNvr.js +0 -4
  887. package/packages/web/dist/assets/index-CSisx5mi.css +0 -1
  888. package/packages/web/dist/assets/problems-BZY0Dwif.js +0 -2
  889. package/packages/web/dist/assets/record-edits-CveFEsal.js +0 -2
  890. package/packages/web/dist/assets/remote-config-BkaarDf3.js +0 -2
  891. package/packages/web/dist/assets/routes-qP_j74V5.js +0 -4
  892. package/packages/web/dist/assets/runs-k76usGfd.js +0 -2
  893. package/packages/web/dist/assets/size-BwnshyOe.js +0 -2
  894. package/packages/web/dist/assets/src-DLK1P7oz.js +0 -43
  895. package/packages/web/dist/assets/state-CjE-qA2w.js +0 -2
  896. package/packages/web/dist/assets/ui-W12UYhVu.js +0 -17
  897. package/packages/web/dist/assets/widget-host-BCf6Tlt5.js +0 -2
  898. package/packages/web/dist/assets/widgets-CrbkovMT.js +0 -2
  899. package/systems/fs/context/authoring/parts/client.reference/fnpillprops.md +0 -141
  900. package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +0 -60
  901. package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +0 -299
  902. package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-371-533.md +0 -183
  903. package/systems/fs/context/authoring/parts/hub/hub-auto-pair-revoke.md +0 -189
  904. package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +0 -623
  905. package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +0 -150
@@ -23,114 +23,123 @@ import { storeEnv } from '../store/env.ts';
23
23
  /** Where the hub listens and keeps its data. */
24
24
  export const hubEnv = env({
25
25
  ...HUB_PORT,
26
- HARNESS_HOST: z.string().default('0.0.0.0').describe('The address the hub binds to.'),
27
- HARNESS_NAME: z.string().optional().describe('The name people see for this hub (the brand, sign-in page, tab title, install name, notifications). An admin\'s setting in the app wins; unset: "Harness".'),
28
- HARNESS_DATA: z.string().default('.harness').describe('The data folder: database, files, installed systems, logs.'),
26
+ FNLOOM_HOST: z.string().default('0.0.0.0').describe('The address the hub binds to.'),
27
+ FNLOOM_NAME: z.string().optional().describe('The name people see for this hub (the brand, sign-in page, tab title, install name, notifications). An admin\'s setting in the app wins; unset: "fnloom".'),
28
+ FNLOOM_DATA: z.string().default('.harness').describe('The data folder: database, files, installed systems, logs.'),
29
29
  }).add({
30
- HARNESS_URL: (e) => z.string().default(`http://localhost:${e.HARNESS_PORT}`).describe('The public URL, for pairing links and push. Defaults to this machine on `HARNESS_PORT`.'),
31
- HARNESS_DB_FILE: (e) => z.string().default(`${e.HARNESS_DATA}/hub.sqlite`).describe('The SQLite database file.'),
32
- HARNESS_FILES_DIR: (e) => z.string().default(`${e.HARNESS_DATA}/files`).describe('Where uploaded and stored files are kept.'),
33
- HARNESS_SYSTEMS_DIR: (e) => z.string().default(`${e.HARNESS_DATA}/systems`).describe('Where installed systems are unpacked.'),
34
- HARNESS_LOG_DIR: (e) => z.string().default(`${e.HARNESS_DATA}/logs`).describe('Where daily log files are written.'),
35
- HARNESS_KEYS_FILE: (e) => z.string().default(`${e.HARNESS_DATA}/keys.json`).describe('The secrets the hub makes for itself when they aren\'t given (JWT, encryption, files, VAPID keys).'),
30
+ FNLOOM_URL: (e) => z.string().default(`http://localhost:${e.FNLOOM_PORT}`).describe('The public URL, for pairing links and push. Defaults to this machine on `FNLOOM_PORT`.'),
31
+ FNLOOM_DB_FILE: (e) => z.string().default(`${e.FNLOOM_DATA}/hub.sqlite`).describe('The SQLite database file.'),
32
+ FNLOOM_FILES_DIR: (e) => z.string().default(`${e.FNLOOM_DATA}/files`).describe('Where uploaded and stored files are kept.'),
33
+ FNLOOM_SYSTEMS_DIR: (e) => z.string().default(`${e.FNLOOM_DATA}/systems`).describe('Where installed systems are unpacked.'),
34
+ FNLOOM_STORES_DIR: (e) => z.string().default(`${e.FNLOOM_DATA}/stores`).describe('Where the hub keeps the stores of systems placed on the hub: one SQLite file per instance, `<system>/<instance>.db`.'),
35
+ FNLOOM_STORE_DRIVERS_DIR: (e) => z.string().default(`${e.FNLOOM_DATA}/store-drivers`).describe('Where the hub installs the Postgres and SQL Server drivers (pg; tedious and tarn) when a system\'s store is placed in one of those databases. The base install leaves them out; systems the hub starts load them from here.'),
36
+ FNLOOM_LOG_DIR: (e) => z.string().default(`${e.FNLOOM_DATA}/logs`).describe('Where daily log files are written.'),
37
+ FNLOOM_KEYS_FILE: (e) => z.string().default(`${e.FNLOOM_DATA}/keys.json`).describe('The secrets the hub makes for itself when they aren\'t given (JWT, encryption, files, VAPID keys).'),
36
38
  });
37
39
 
38
40
  /** The HTTP front: the built web app, uploads, docs, sockets and load shedding. */
39
41
  export const httpEnv = env({
40
- HARNESS_WEB_DIST: z.string().default('').describe('The built web app the hub serves (`npm run build`). Empty: `packages/web/dist` beside the hub package.'),
41
- HARNESS_DOCS: z.boolean().default(false).describe('Serve the API docs (`/docs/swagger`, `/docs/redoc`, `/docs/asyncapi`).'),
42
- HARNESS_HTTPS: z.boolean().default(true).describe('Answer https (and wss) on the hub\'s port as well as http, so the app installs and notifications work on other devices. Until an admin switches it in Settings › Hub. The certificate is the hub\'s own (its authority, in `<HARNESS_DATA>/tls`), unless HARNESS_TLS_CERT and HARNESS_TLS_KEY are set.'),
43
- HARNESS_TLS_CERT: z.string().optional().describe('A certificate file (PEM, with its chain) to serve https with instead of the hub\'s own: from `tailscale cert`, mkcert or a real authority. Needs HARNESS_TLS_KEY. Read again when it changes.'),
44
- HARNESS_TLS_KEY: z.string().optional().describe('The private key file (PEM) of HARNESS_TLS_CERT.'),
45
- HARNESS_MAX_UPLOAD: z.number().int().min(1).default(100 * 1024 * 1024).describe('The largest upload, in bytes.'),
46
- HARNESS_PRESIGN_TTL: z.number().int().min(1_000).default(600_000).describe('How long a presigned upload or download URL stays valid.'),
47
- HARNESS_WS_HEARTBEAT: z.number().int().min(1_000).default(30_000).describe('The WebSocket ping interval; a connection that misses a pong is dropped.'),
48
- HARNESS_WS_MAX_MESSAGE: z.number().int().min(16_384).default(4_194_304).describe('The largest message a browser socket may send, in bytes; a bigger one closes the socket.'),
49
- HARNESS_WS_TOKEN_MARGIN: z.number().int().min(0).default(10_000).describe('A browser socket is closed this long before its access token expires, so it reconnects with a fresh one.'),
50
- HARNESS_SHED_THRESHOLD: z.number().int().min(1).default(200).describe('Event-loop delay (running average) that counts as overloaded.'),
51
- HARNESS_SHED_SUSTAINED: z.number().int().min(0).default(1_000).describe('How long the loop must stay overloaded before requests are refused.'),
52
- HARNESS_SHED_RECOVER: z.number().int().min(0).default(2_000).describe('How long it must stay healthy before requests are accepted again.'),
53
- HARNESS_SHUTDOWN_TIMEOUT: z.number().int().min(1_000).default(30_000).describe('How long the hub waits for everything to stop on shutdown.'),
42
+ FNLOOM_WEB_DIST: z.string().default('').describe('The built web app the hub serves (`npm run build`). Empty: `packages/web/dist` beside the hub package.'),
43
+ FNLOOM_DOCS: z.boolean().default(false).describe('Serve the API docs (`/docs/swagger`, `/docs/redoc`, `/docs/asyncapi`).'),
44
+ FNLOOM_HTTPS: z.boolean().default(true).describe('Answer https (and wss) on the hub\'s port as well as http, so the app installs and notifications work on other devices. Until an admin switches it in Settings › Hub. The certificate is the hub\'s own (its authority, in `<FNLOOM_DATA>/tls`), unless FNLOOM_TLS_CERT and FNLOOM_TLS_KEY are set.'),
45
+ FNLOOM_TLS_CERT: z.string().optional().describe('A certificate file (PEM, with its chain) to serve https with instead of the hub\'s own: from `tailscale cert`, mkcert or a real authority. Needs FNLOOM_TLS_KEY. Read again when it changes.'),
46
+ FNLOOM_TLS_KEY: z.string().optional().describe('The private key file (PEM) of FNLOOM_TLS_CERT.'),
47
+ FNLOOM_MAX_UPLOAD: z.number().int().min(1).default(100 * 1024 * 1024).describe('The largest upload, in bytes.'),
48
+ FNLOOM_PRESIGN_TTL: z.number().int().min(1_000).default(600_000).describe('How long a presigned upload or download URL stays valid.'),
49
+ FNLOOM_WS_HEARTBEAT: z.number().int().min(1_000).default(30_000).describe('The WebSocket ping interval; a connection that misses a pong is dropped.'),
50
+ FNLOOM_WS_MAX_MESSAGE: z.number().int().min(16_384).default(4_194_304).describe('The largest message a browser socket may send, in bytes; a bigger one closes the socket.'),
51
+ FNLOOM_WS_TOKEN_MARGIN: z.number().int().min(0).default(10_000).describe('A browser socket is closed this long before its access token expires, so it reconnects with a fresh one.'),
52
+ FNLOOM_SHED_THRESHOLD: z.number().int().min(1).default(200).describe('Event-loop delay (running average) that counts as overloaded.'),
53
+ FNLOOM_SHED_SUSTAINED: z.number().int().min(0).default(1_000).describe('How long the loop must stay overloaded before requests are refused.'),
54
+ FNLOOM_SHED_RECOVER: z.number().int().min(0).default(2_000).describe('How long it must stay healthy before requests are accepted again.'),
55
+ FNLOOM_SHUTDOWN_TIMEOUT: z.number().int().min(1_000).default(30_000).describe('How long the hub waits for everything to stop on shutdown.'),
54
56
  });
55
57
 
56
58
  /** Sign-in and secrets. Secrets are generated and stored in the data folder when not given. */
57
59
  export const authEnv = env({
58
- HARNESS_JWT_SECRET: z.string().min(32).optional().describe('Signs access and refresh tokens (at least 32 characters). Made and stored when not given.'),
59
- HARNESS_SECRET_KEY: z.string().min(32).optional().describe('Encrypts stored secrets such as provider keys (at least 32 characters). Made and stored when not given.'),
60
- HARNESS_ADMIN_EMAIL: z.email().optional().describe('The single admin account\'s email. Made on the first start.'),
61
- HARNESS_ADMIN_PASSWORD: z.string().min(8).optional().describe('The single admin account\'s password (at least 8 characters).'),
62
- HARNESS_ACCESS_TTL: z.number().int().min(60_000).default(900_000).describe('How long an access token lasts.'),
63
- HARNESS_REFRESH_TTL: z.number().int().min(3_600_000).default(30 * 86_400_000).describe('How long a refresh token lasts.'),
64
- HARNESS_PASSWORD_COST: z.number().int().min(10).max(20).default(15).describe('scrypt\'s cost as a power of two (15: 32 768 rounds).'),
65
- HARNESS_FILES_SECRET: z.string().min(32).optional().describe('Signs presigned file URLs.'),
66
- HARNESS_SSO_PROVIDERS: IdentityProviderConfigs.default([]).describe(
60
+ FNLOOM_JWT_SECRET: z.string().min(32).optional().describe('Signs access and refresh tokens (at least 32 characters). Made and stored when not given.'),
61
+ FNLOOM_SECRET_KEY: z.string().min(32).optional().describe('Encrypts stored secrets such as provider keys (at least 32 characters). Made and stored when not given.'),
62
+ FNLOOM_ADMIN_EMAIL: z.email().optional().describe('The single admin account\'s email. Made on the first start.'),
63
+ FNLOOM_ADMIN_PASSWORD: z.string().min(8).optional().describe('The single admin account\'s password (at least 8 characters).'),
64
+ FNLOOM_ACCESS_TTL: z.number().int().min(60_000).default(900_000).describe('How long an access token lasts.'),
65
+ FNLOOM_REFRESH_TTL: z.number().int().min(3_600_000).default(30 * 86_400_000).describe('How long a refresh token lasts.'),
66
+ FNLOOM_PASSWORD_COST: z.number().int().min(10).max(20).default(15).describe('scrypt\'s cost as a power of two (15: 32 768 rounds).'),
67
+ FNLOOM_FILES_SECRET: z.string().min(32).optional().describe('Signs presigned file URLs.'),
68
+ FNLOOM_SSO_PROVIDERS: IdentityProviderConfigs.default([]).describe(
67
69
  'Single sign-on: the OpenID Connect providers people can sign in with, as a JSON list. Each is '
68
70
  + '{"id":"okta","label":"Okta","issuer":"https://example.okta.com","clientId":"...","clientSecret":"...","claims":{"role":"groups","admin":["harness-admins"],"groups":"groups"}}: '
69
- + 'issuer is the issuer or its discovery URL; register <HARNESS_URL>/auth/sso/callback as the redirect URI. '
71
+ + 'issuer is the issuer or its discovery URL; register <FNLOOM_URL>/auth/sso/callback as the redirect URI. '
70
72
  + 'Optional: scope (default "openid email profile"), userinfo (default true), claims.member (role values one of which is needed to sign in). '
71
73
  + 'Once one is set, only the first admin keeps a password, as a break-glass sign-in.',
72
74
  ),
73
- HARNESS_SSO_WINDOW: z.number().int().min(10_000).default(600_000).describe('How long a person has to come back from a sign-in provider before the sign-in stops working.'),
75
+ FNLOOM_SSO_WINDOW: z.number().int().min(10_000).default(600_000).describe('How long a person has to come back from a sign-in provider before the sign-in stops working.'),
74
76
  });
75
77
 
76
78
  /** Queues and timing. */
77
79
  export const queueEnv = env({
78
- HARNESS_LLM_CONCURRENCY: z.number().int().min(1).default(4).describe('How many LLM calls run at once.'),
79
- HARNESS_RUN_CONCURRENCY: z.number().int().min(1).default(8).describe('Per system.'),
80
- HARNESS_TOOL_TIMEOUT: z.number().int().min(1_000).default(30_000).describe('A tool running longer than this stops blocking the agent, if a user is active in the session.'),
81
- HARNESS_ACTIVE_WINDOW: z.number().int().min(1_000).default(120_000).describe('How recently a user must have been active to count as present.'),
82
- HARNESS_DEFAULT_PRIORITY: z.enum(PRIORITIES).default('interactive').describe('The priority of work no rule gives one.'),
83
- HARNESS_TURN_COST: z.number().min(0).default(0.5).describe('The most one turn may spend, in dollars, unless a budget says otherwise.'),
84
- HARNESS_TURN_TIME: z.number().int().min(1_000).default(600_000).describe('The longest one turn may run, unless a budget says otherwise.'),
85
- HARNESS_BUDGET_MARGIN: z.number().min(1).default(1.25).describe('Reserve this much more than the estimate before an LLM call.'),
80
+ FNLOOM_LLM_CONCURRENCY: z.number().int().min(1).default(4).describe('How many LLM calls run at once.'),
81
+ FNLOOM_RUN_CONCURRENCY: z.number().int().min(1).default(8).describe('Per system.'),
82
+ FNLOOM_TOOL_TIMEOUT: z.number().int().min(1_000).default(30_000).describe('A tool running longer than this stops blocking the agent, if a user is active in the session.'),
83
+ FNLOOM_ACTIVE_WINDOW: z.number().int().min(1_000).default(120_000).describe('How recently a user must have been active to count as present.'),
84
+ FNLOOM_DEFAULT_PRIORITY: z.enum(PRIORITIES).default('interactive').describe('The priority of work no rule gives one.'),
85
+ FNLOOM_TURN_COST: z.number().min(0).default(0.5).describe('The most one turn may spend, in dollars, unless a budget says otherwise.'),
86
+ FNLOOM_TURN_TIME: z.number().int().min(1_000).default(600_000).describe('The longest one turn may run, unless a budget says otherwise.'),
87
+ FNLOOM_BUDGET_MARGIN: z.number().min(1).default(1.25).describe('Reserve this much more than the estimate before an LLM call.'),
86
88
  });
87
89
 
88
90
  /** The system link. */
89
91
  export const linkEnv = env({
90
- HARNESS_MAX_FRAME: z.number().int().min(16_384).default(4_194_304).describe('The largest frame a system link accepts, in bytes; a bigger one closes the link.'),
91
- HARNESS_MAX_CHUNK: z.number().int().min(16_384).default(131_072).describe('The largest chunk a stream is cut into on a system link, in bytes.'),
92
- HARNESS_HEARTBEAT: z.number().int().min(1_000).default(15_000).describe('How often a system link is pinged; a link that misses a pong is dropped.'),
93
- HARNESS_PAIRING_TIMEOUT: z.number().int().min(10_000).default(600_000).describe('How long a pairing request waits for an admin.'),
94
- HARNESS_PAIRING_LIMIT: z.number().int().min(1).default(10).describe('Most pairing requests (with a code or auto pair) from one address in HARNESS_PAIRING_WINDOW.'),
95
- HARNESS_PAIRING_LIMIT_TOTAL: z.number().int().min(1).default(60).describe('Most pairing requests from every address together in HARNESS_PAIRING_WINDOW.'),
96
- HARNESS_PAIRING_WINDOW: z.number().int().min(1_000).default(600_000).describe('The window pairing requests are counted in, in milliseconds.'),
97
- HARNESS_LINK_HELLO_TIMEOUT: z.number().int().min(1_000).default(15_000).describe('How long a new system link may take to say hello before it is closed.'),
98
- HARNESS_LINK_UNLINKED_PER_ADDRESS: z.number().int().min(1).default(32).describe('Most system links from one address that have not finished the handshake (waiting to pair counts) at once.'),
99
- HARNESS_LINK_UNLINKED_MAX: z.number().int().min(1).default(128).describe('Most system links from every address that have not finished the handshake at once.'),
100
- HARNESS_LINK_MAX_UPLOADS: z.number().int().min(1).default(16).describe('Most uploads one system may have in progress at once.'),
101
- HARNESS_PAIRING_GRANT_TTL: z.number().int().min(5_000).default(60_000).describe('How long a pairing token granted to an approved install run stays good.'),
102
- HARNESS_STOP_TIMEOUT: z.number().int().min(100).default(10_000).describe('How long an installed system has to stop before it is killed.'),
103
- HARNESS_RESTART_BACKOFF: z.number().int().min(100).default(2_000).describe('The first delay before an installed system that exited is started again.'),
104
- HARNESS_RESTARTS_PER_HOUR: z.number().int().min(1).default(10).describe('Most restarts of one installed system in an hour before it is left stopped.'),
105
- HARNESS_RESTART_BACKOFF_MAX: z.number().int().min(100).default(300_000).describe('The longest wait before an installed system that keeps crashing is started again.'),
106
- HARNESS_PROCESS_OUTPUT_TAIL: z.number().int().min(256).default(8_192).describe('How many characters of what an installed system printed are kept for the admin page when it exits.'),
92
+ FNLOOM_MAX_FRAME: z.number().int().min(16_384).default(4_194_304).describe('The largest frame a system link accepts, in bytes; a bigger one closes the link.'),
93
+ FNLOOM_MAX_CHUNK: z.number().int().min(16_384).default(131_072).describe('The largest chunk a stream is cut into on a system link, in bytes.'),
94
+ FNLOOM_HEARTBEAT: z.number().int().min(1_000).default(15_000).describe('How often a system link is pinged; a link that misses a pong is dropped.'),
95
+ FNLOOM_PAIRING_TIMEOUT: z.number().int().min(10_000).default(600_000).describe('How long a pairing request waits for an admin.'),
96
+ FNLOOM_PAIRING_LIMIT: z.number().int().min(1).default(10).describe('Most pairing requests (with a code or auto pair) from one address in FNLOOM_PAIRING_WINDOW.'),
97
+ FNLOOM_PAIRING_LIMIT_TOTAL: z.number().int().min(1).default(60).describe('Most pairing requests from every address together in FNLOOM_PAIRING_WINDOW.'),
98
+ FNLOOM_PAIRING_WINDOW: z.number().int().min(1_000).default(600_000).describe('The window pairing requests are counted in, in milliseconds.'),
99
+ FNLOOM_LINK_HELLO_TIMEOUT: z.number().int().min(1_000).default(15_000).describe('How long a new system link may take to say hello before it is closed.'),
100
+ FNLOOM_LINK_UNLINKED_PER_ADDRESS: z.number().int().min(1).default(32).describe('Most system links from one address that have not finished the handshake (waiting to pair counts) at once.'),
101
+ FNLOOM_LINK_UNLINKED_MAX: z.number().int().min(1).default(128).describe('Most system links from every address that have not finished the handshake at once.'),
102
+ FNLOOM_LINK_MAX_UPLOADS: z.number().int().min(1).default(16).describe('Most uploads one system may have in progress at once.'),
103
+ FNLOOM_PAIRING_GRANT_TTL: z.number().int().min(5_000).default(60_000).describe('How long a pairing token granted to an approved install run stays good.'),
104
+ FNLOOM_STOP_TIMEOUT: z.number().int().min(100).default(10_000).describe('How long an installed system has to stop before it is killed.'),
105
+ FNLOOM_RESTART_BACKOFF: z.number().int().min(100).default(2_000).describe('The first delay before an installed system that exited is started again.'),
106
+ FNLOOM_RESTARTS_PER_HOUR: z.number().int().min(1).default(10).describe('Most restarts of one installed system in an hour before it is left stopped.'),
107
+ FNLOOM_RESTART_BACKOFF_MAX: z.number().int().min(100).default(300_000).describe('The longest wait before an installed system that keeps crashing is started again.'),
108
+ FNLOOM_PROCESS_OUTPUT_TAIL: z.number().int().min(256).default(8_192).describe('How many characters of what an installed system printed are kept for the admin page when it exits.'),
107
109
  });
108
110
 
109
111
  /** Models, embeddings and the index. */
110
112
  export const modelEnv = env({
113
+ OPENAI_API_KEY: z.string().optional().describe('An OpenAI key; configures the openai provider on first start.'),
114
+ ANTHROPIC_API_KEY: z.string().optional().describe('An Anthropic key; configures the anthropic provider (Claude) on first start.'),
115
+ GEMINI_API_KEY: z.string().optional().describe('A Gemini API key (from Google AI Studio); configures the google provider on first start. GOOGLE_API_KEY works too.'),
116
+ GOOGLE_API_KEY: z.string().optional().describe('Another name for GEMINI_API_KEY, used when that is not set.'),
111
117
  OPENROUTER_API_KEY: z.string().optional().describe('An OpenRouter key; configures the openrouter provider on first start.'),
112
- HARNESS_TRANSCRIBE_MODEL: z.string().default('').describe('The model voice input is transcribed with: a model with hearing from a configured provider (for example whisper-1 on OpenAI). Empty turns voice input off.'),
113
- HARNESS_DEFAULT_MODEL: z.string().default('openrouter/auto').describe('The model the chat agent uses until an admin picks one.'),
114
- HARNESS_EMBEDDER_DOCUMENT: z.string().default('embedder/document').describe('The embedder that embeds indexed text (documents): the embedding model of a system\'s provider, named <system>/<model>.'),
115
- HARNESS_EMBEDDER_QUERY: z.string().default('embedder/query').describe('The embedder that embeds search text (queries), in the same vector space as the document embedder.'),
116
- HARNESS_EMBED_BATCH: z.number().int().min(1).default(32).describe('Most texts in one embed batch.'),
117
- HARNESS_SUGGESTIONS: z.number().int().min(0).default(6).describe('How many fns and context the composer suggests.'),
118
- HARNESS_DECIDE_PARALLEL: z.number().int().min(1).default(2).describe('How many calls one decision split over several calls (a crawl level, judging a search) makes at once; each still waits its turn on the LLM queue (HARNESS_LLM_CONCURRENCY). 1 asks them one after another.'),
118
+ FNLOOM_TRANSCRIBE_MODEL: z.string().default('').describe('The model voice input is transcribed with: a model with hearing from a configured provider (for example whisper-1 on OpenAI). Empty turns voice input off.'),
119
+ FNLOOM_DEFAULT_MODEL: z.string().default('openrouter/auto').describe('The model the chat agent uses until an admin picks one.'),
120
+ FNLOOM_PLAN_MODEL: z.string().default('').describe('The model hub/ctx_plan plans with until an admin picks one under Models > Roles (for example anthropic/claude-haiku-5.5 on OpenRouter). Empty: plans stay off until a plan model is picked.'),
121
+ FNLOOM_DECIDE_MODEL: z.string().default('').describe('The decision model (typed yes/no and choice answers) until an admin picks one under Models > Roles, for example typesafe/jev-1.14 on OpenRouter. Empty: decisions stay off until one is picked.'),
122
+ FNLOOM_METADATA_MODEL: z.string().default('').describe('The model that writes context metadata (each item as the question it answers, when it applies) until an admin picks one under Models > Roles; it must be able to chat. Empty: it uses the decision model when that model can chat, else the chat model, and stays off while no decision model is set.'),
123
+ FNLOOM_EMBEDDER_DOCUMENT: z.string().default('embedder/document').describe('The embedder that embeds indexed text (documents): the embedding model of a system\'s provider, named <system>/<model>.'),
124
+ FNLOOM_EMBEDDER_QUERY: z.string().default('embedder/query').describe('The embedder that embeds search text (queries), in the same vector space as the document embedder.'),
125
+ FNLOOM_EMBED_BATCH: z.number().int().min(1).default(32).describe('Most texts in one embed batch.'),
126
+ FNLOOM_SUGGESTIONS: z.number().int().min(0).default(6).describe('How many fns and context the composer suggests.'),
127
+ FNLOOM_DECIDE_PARALLEL: z.number().int().min(1).default(2).describe('How many calls one decision split over several calls (a crawl level, judging a search) makes at once; each still waits its turn on the LLM queue (FNLOOM_LLM_CONCURRENCY). 1 asks them one after another.'),
119
128
  });
120
129
 
121
130
  /** Logging. */
122
131
  export const logEnv = env({
123
- HARNESS_LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info').describe('The lowest level that is logged.'),
124
- HARNESS_LOG_JSON: z.boolean().default(false).describe('Log JSON lines instead of readable text.'),
125
- HARNESS_LOG_FILES: z.boolean().default(true).describe('Also write logs to daily files in the log folder.'),
126
- HARNESS_LOG_KEEP: z.number().int().min(1).default(7).describe('How many daily log files to keep.'),
132
+ FNLOOM_LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info').describe('The lowest level that is logged.'),
133
+ FNLOOM_LOG_JSON: z.boolean().default(false).describe('Log JSON lines instead of readable text.'),
134
+ FNLOOM_LOG_FILES: z.boolean().default(true).describe('Also write logs to daily files in the log folder.'),
135
+ FNLOOM_LOG_KEEP: z.number().int().min(1).default(7).describe('How many daily log files to keep.'),
127
136
  });
128
137
 
129
138
  /** Web push (VAPID). Keys are generated and stored when not given. */
130
139
  export const pushEnv = env({
131
- HARNESS_VAPID_PUBLIC: z.string().optional().describe('The web push public key. Made and stored when not given.'),
132
- HARNESS_VAPID_PRIVATE: z.string().optional().describe('The web push private key. Made and stored when not given.'),
133
- HARNESS_VAPID_SUBJECT: z.string().default('mailto:admin@localhost').describe('The contact web push services are given.'),
140
+ FNLOOM_VAPID_PUBLIC: z.string().optional().describe('The web push public key. Made and stored when not given.'),
141
+ FNLOOM_VAPID_PRIVATE: z.string().optional().describe('The web push private key. Made and stored when not given.'),
142
+ FNLOOM_VAPID_SUBJECT: z.string().default('mailto:admin@localhost').describe('The contact web push services are given.'),
134
143
  });
135
144
 
136
145
  /** Every slice by name, so each module takes its own and an admin page can list them. Module slices live beside their module. */
@@ -5,7 +5,7 @@
5
5
  * typed and checked by the contract's gin types. Services are read when a fn runs, never while registering. Every one
6
6
  * keeps to what the run's person may see and use (their `AccessScope`): search hits, loads and results alike.
7
7
  */
8
- import { itemVersionId, mintId, type Policy, mapConcurrent, clipMarked, ContextCrawlArgs, contextOff, effectCovered, effectsLine, CtxSearchArgs, ctxSearchQuery, FnDecl, FnExamplesQuery, FnRouting, FnSearchArgs, fnsSearchQuery, QualifiedName, qualify, splitName, SystemName, type FnRefusal, type ContextCrawlResult, type ContextRecord, type CrawledContext, type FnSearchPage, type FnSearchQuery, type LoadContextResult, type LoadFnsResult, type SearchItemKind, type ActorId, type FnExample, Json, type IndexedKind, type RegistryEffect, type Run, type Session, type SessionId } from '@harness/core';
8
+ import { itemVersionId, mintId, type Policy, mapConcurrent, clipMarked, ContextCrawlArgs, modelSeesContext, effectCovered, effectsLine, CtxSearchArgs, ctxSearchQuery, FnDecl, FnExamplesQuery, FnRouting, FnSearchArgs, fnsSearchQuery, QualifiedName, qualify, splitName, SystemName, type FnRefusal, type ContextCrawlResult, type ContextRecord, type CrawledContext, type FnSearchPage, type FnSearchQuery, type LoadContextResult, type LoadFnsResult, type SearchItemKind, type ActorId, type FnExample, Json, type IndexedKind, type RegistryEffect, type Run, type Session, type SessionId } from '@harness/core';
9
9
  import { AllowedRuns, canonicalJson, hub, parseValue, RemovedFn, SAVE_FN_TAKEN, SavedFn, sha256, wireType } from '@harness/sdk';
10
10
  import type { AccessService } from '../access/index.ts';
11
11
  import type { FnFactsService, FnsServices } from '../fns/index.ts';
@@ -71,7 +71,7 @@ export interface HubFnDeps {
71
71
  readonly decider: () => Pick<Decider, 'model' | 'ask'>;
72
72
  /** The scope of the hub MCP a run's caller is, so `fns_search` keeps to it (none: no MCP). */
73
73
  readonly mcpScope?: (caller: ActorId) => Promise<Pick<FnScope, 'fns' | 'context'> | undefined>;
74
- /** With a `load` search decision, the most kept hits of each kind `hub/fns_search` loads (`HARNESS_SEARCH_LOAD_MAX`; 5 when not given). */
74
+ /** With a `load` search decision, the most kept hits of each kind `hub/fns_search` loads (`FNLOOM_SEARCH_LOAD_MAX`; 5 when not given). */
75
75
  readonly searchLoadMax?: number;
76
76
  }
77
77
 
@@ -138,7 +138,7 @@ export const CONTEXT_CRAWL_PURPOSE = 'ctx_crawl';
138
138
 
139
139
  /** Whether the asker may load a context item by name now: switched on, of a system the session uses, and visible to them. */
140
140
  async function mayLoad(deps: Pick<HubFnDeps, 'catalog'>, { session, access }: Asker, record: ContextRecord): Promise<boolean> {
141
- return !contextOff(record) && allowsSystem(session, record.system) && seesContextNamed(access, (name) => deps.catalog().context(name), record.name, session.id);
141
+ return modelSeesContext(record) && allowsSystem(session, record.system) && seesContextNamed(access, (name) => deps.catalog().context(name), record.name, session.id);
142
142
  }
143
143
 
144
144
  /**
@@ -169,7 +169,7 @@ async function loadIntoSession(deps: HubFnDeps, asker: Asker, names: readonly Qu
169
169
  for (const name of await withImports(deps.catalog(), names)) {
170
170
  const parsed = QualifiedName.safeParse(name);
171
171
  const record = parsed.success ? await lookup(parsed.data) : undefined;
172
- if (parsed.success && record !== undefined && !contextOff(record) && allowsSystem(session, splitName(parsed.data).system) && await seesContextNamed(access, lookup, parsed.data, session.id)) {
172
+ if (parsed.success && record !== undefined && modelSeesContext(record) && allowsSystem(session, splitName(parsed.data).system) && await seesContextNamed(access, lookup, parsed.data, session.id)) {
173
173
  loaded.push(parsed.data);
174
174
  records.push(record);
175
175
  }
@@ -9,11 +9,11 @@ import { GENERAL_GROUP, type ApiGroupDecl, type FnDecl, type Manifest } from '@h
9
9
  const GROUPS: ReadonlyArray<ApiGroupDecl & { readonly fns: readonly string[] }> = [
10
10
  { name: 'chat', title: 'Chat', description: 'Chat agents, sessions and their messages, and asking the person.', fns: ['chat', 'chat_small', 'ask_user', 'sessions_list', 'session_messages', 'session_create', 'session_update', 'session_delete'] },
11
11
  { name: 'catalog', title: 'Fns and types', description: 'Find, inspect, load, save and remove fns; read types, any list by query, the graph and item histories.', fns: ['fns_search', 'fns_examples', 'fns_get', 'fns_save', 'fns_remove', 'fns_allow_runs', 'fns_load', 'fns_drop', 'inspect', 'load', 'unload', 'types_get', 'query', 'graph', 'item_versions'] },
12
- { name: 'context', title: 'Context and memory', description: 'Find, read, load, drop and crawl context items, remember and forget, link context, and see and switch what is injected into agents.', fns: ['ctx_search', 'ctx_load', 'ctx_drop', 'ctx_crawl', 'ctx_get', 'remember', 'forget', 'memory_update', 'ctx_from_resource', 'ctx_link', 'ctx_unlink', 'ctx_injections_list', 'ctx_injection_set'] },
12
+ { name: 'context', title: 'Context and memory', description: 'Find, read, load, drop and crawl context items, remember and forget, link context, see and switch what is injected into agents, review context (statuses, duplicates, contradictions, metadata), and plan: turn a request into a decision tree of questions, answer it and plan deeper.', fns: ['ctx_search', 'ctx_load', 'ctx_drop', 'ctx_crawl', 'ctx_get', 'remember', 'forget', 'memory_update', 'ctx_from_resource', 'ctx_link', 'ctx_unlink', 'ctx_injections_list', 'ctx_injection_set', 'ctx_review', 'ctx_status', 'ctx_merge', 'ctx_not_duplicate', 'ctx_reextract', 'ctx_new_status_get', 'ctx_new_status_set', 'ctx_plan', 'ctx_plan_get', 'ctx_answer', 'ctx_plan_expand'] },
13
13
  { name: 'resources', title: 'Resources and files', description: 'Search, read, import, convert and send resources, and explore systems\' files.', fns: ['search_resources', 'resource_list', 'resource_read', 'resource_outline', 'resource_send', 'image_read', 'resource_convert', 'resource_import', 'resource_rename', 'resource_delete', 'explore_roots', 'explore_list', 'explore_read'] },
14
14
  { name: 'data', title: 'Data', description: 'Records of stored types: find, read, save, change and remove them, list the stored types, and read any fn\'s table with its visuals and row actions.', fns: ['data_sets', 'records_find', 'record_get', 'records_table', 'record_versions', 'record_save', 'record_update', 'record_remove', 'read_table', 'visuals', 'row_actions'] },
15
15
  { name: 'runs', title: 'Runs and spending', description: 'Follow, list and undo runs, read model calls, and how fns have been doing.', fns: ['run_status', 'run_wait', 'runs_list', 'run_get', 'run_tree', 'llm_call', 'model_calls', 'fns_metrics', 'run_background', 'turn_undo', 'system_calls'] },
16
- { name: 'systems', title: 'Systems', description: 'See, install, configure, switch and pair systems and their instances.', fns: ['systems_list', 'system_get', 'system_fns', 'system_logs', 'configure_system', 'enable_system', 'switch_item', 'remove_system', 'install_system', 'start_system', 'stop_system', 'restart_system', 'upgrade_system', 'system_reimport', 'export_system_data', 'install_package', 'add_instance', 'remove_instance', 'instances_list', 'approve_pairing', 'create_pairing_token', 'pairings_list', 'auto_pairs_list', 'auto_pair_revoke'] },
16
+ { name: 'systems', title: 'Systems', description: 'See, install, configure, switch and pair systems and their instances, and move their own stores.', fns: ['systems_list', 'system_get', 'system_fns', 'system_logs', 'configure_system', 'enable_system', 'switch_item', 'remove_system', 'install_system', 'start_system', 'stop_system', 'restart_system', 'upgrade_system', 'system_reimport', 'export_system_data', 'install_package', 'add_instance', 'remove_instance', 'instances_list', 'approve_pairing', 'create_pairing_token', 'pairings_list', 'auto_pairs_list', 'auto_pair_revoke', 'system_store', 'system_store_move', 'system_store_move_state', 'system_store_move_answer', 'system_store_backups', 'system_store_backup_delete'] },
17
17
  { name: 'models', title: 'Models', description: 'Model providers, which model does which job, and model limits.', fns: ['model_roles', 'model_limits', 'set_model_role', 'clear_model_role', 'set_model_limits', 'configure_provider', 'set_model_category', 'providers_list', 'suggest_decision_get', 'suggest_decision_set', 'search_decision_get', 'search_decision_set'] },
18
18
  { name: 'people', title: 'People and sharing', description: 'People, groups, their settings, how they sign in, who sees what, and per-person connections.', fns: ['add_user', 'add_group', 'update_user', 'set_membership', 'set_sign_in_policy', 'set_sign_in_limits', 'set_proxy_trust', 'actors_list', 'actor_settings_list', 'set_actor_setting', 'access_set', 'connection_update', 'connection_disconnect'] },
19
19
  { name: 'rules', title: 'Budgets and rules', description: 'Budgets, priorities and approval policies.', fns: ['set_budget', 'set_priority', 'set_policy', 'remove_rule', 'budgets_list', 'policies_list', 'priority_rules_list'] },
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The hub's display name (build 8, `core/identity.ts`): the admin's setting (the hub option `hub.name`), else the env
3
- * setting `HARNESS_NAME`, else "Harness". Read from the store on every ask (no process copy, so a second hub process
3
+ * setting `FNLOOM_NAME`, else "fnloom". Read from the store on every ask (no process copy, so a second hub process
4
4
  * or a direct write is seen at once); a change is published so every open tab shows the new name, and the hub's own
5
5
  * actor is renamed with it.
6
6
  */
@@ -29,7 +29,7 @@ export interface HubIdentityOptions {
29
29
  readonly store: HubStore;
30
30
  readonly bus: EventBus;
31
31
  readonly clock: () => number;
32
- /** `HARNESS_NAME`, when set. */
32
+ /** `FNLOOM_NAME`, when set. */
33
33
  readonly envName: string | undefined;
34
34
  readonly version: string;
35
35
  /** The hub's own system name, whose actor carries the display name. */
@@ -29,6 +29,9 @@ import type {
29
29
  import type { AutoPairService } from '../link/auto-pair.ts';
30
30
  import type { SystemGrantGuard } from '../link/grants.ts';
31
31
  import type { LinkGate } from '../link/gate.ts';
32
+ import type { SystemStores } from '../stores/service.ts';
33
+ import type { StoreMoves } from '../stores/moves.ts';
34
+ import type { StoreBackups } from '../stores/backups.ts';
32
35
  import type { SystemLifecycle } from '../link/lifecycle.ts';
33
36
  import type { HubStore, StoreFactory } from '../store/index.ts';
34
37
  import type { AccessService } from '../access/index.ts';
@@ -68,6 +71,12 @@ export interface HubServices {
68
71
  readonly grants: SystemGrantGuard;
69
72
  /** How many `/link` sockets that haven't finished the handshake are kept, and for how long. */
70
73
  readonly gate: LinkGate;
74
+ /** System stores: where each instance's store lives, how it stands, the stores kept on the hub, and holding calls. */
75
+ readonly stores: SystemStores;
76
+ /** Moving a store between placements: its phases, the runs it waits for, and the copy crossing the link. */
77
+ readonly moves: StoreMoves;
78
+ /** A store's backups (old copies, stores kept at removal), and what happens to a store when its instance is removed. */
79
+ readonly storeBackups: StoreBackups;
71
80
  };
72
81
  readonly execution: {
73
82
  readonly runs: RunService; readonly agents: AgentLoop; readonly llm: LlmGateway; readonly limits: LimitResolver; readonly ledger: Ledger;
@@ -181,7 +190,7 @@ export interface StartOptions {
181
190
  readonly clock?: () => number;
182
191
  /** Use this logger instead of making one (tests). */
183
192
  readonly log?: Logger;
184
- /** Listen on this port instead of `HARNESS_PORT` (0: any free port). */
193
+ /** Listen on this port instead of `FNLOOM_PORT` (0: any free port). */
185
194
  readonly port?: number;
186
195
  /** Handle SIGINT / SIGTERM / SIGBREAK (the process entry does; tests don't). */
187
196
  readonly signals?: boolean;
@@ -16,7 +16,7 @@ export const HUB_INFO = {
16
16
  version: Package.parse(JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'))).version,
17
17
  } as const;
18
18
 
19
- /** Build 9: the bundled systems folder (`HARNESS_BUNDLED_SYSTEMS`), or, when it is empty, the repository's `systems/`. */
19
+ /** Build 9: the bundled systems folder (`FNLOOM_BUNDLED_SYSTEMS`), or, when it is empty, the repository's `systems/`. */
20
20
  export function bundledSystemsDir(setting: string): string {
21
21
  return setting === '' ? fileURLToPath(new URL('../../../../systems/', import.meta.url)) : setting;
22
22
  }
@@ -33,7 +33,7 @@ export const randomSecret = (): string => randomBytes(32).toString('base64url');
33
33
 
34
34
  /** Read the keys file, fill what's missing, write it back if anything was made, then let the environment win. */
35
35
  export async function loadKeys(settings: Pick<HubSettings, 'hubEnv' | 'authEnv' | 'pushEnv'>, make: KeyMaker): Promise<HubKeys> {
36
- const file = settings.hubEnv.HARNESS_KEYS_FILE;
36
+ const file = settings.hubEnv.FNLOOM_KEYS_FILE;
37
37
  const stored: StoredKeys = await readFile(file, 'utf8').then((text) => StoredKeys.parse(JSON.parse(text)), (error: unknown) => {
38
38
  if (error instanceof Error && 'code' in error && error.code === 'ENOENT') { return StoredKeys.parse({}); }
39
39
  throw error;
@@ -50,11 +50,11 @@ export async function loadKeys(settings: Pick<HubSettings, 'hubEnv' | 'authEnv'
50
50
  }
51
51
  const { authEnv, pushEnv } = settings;
52
52
  return {
53
- jwtSecret: authEnv.HARNESS_JWT_SECRET ?? keys.jwtSecret,
54
- secretKey: authEnv.HARNESS_SECRET_KEY ?? keys.secretKey,
55
- filesSecret: authEnv.HARNESS_FILES_SECRET ?? keys.filesSecret,
56
- vapid: pushEnv.HARNESS_VAPID_PUBLIC !== undefined && pushEnv.HARNESS_VAPID_PRIVATE !== undefined
57
- ? { publicKey: pushEnv.HARNESS_VAPID_PUBLIC, privateKey: pushEnv.HARNESS_VAPID_PRIVATE }
53
+ jwtSecret: authEnv.FNLOOM_JWT_SECRET ?? keys.jwtSecret,
54
+ secretKey: authEnv.FNLOOM_SECRET_KEY ?? keys.secretKey,
55
+ filesSecret: authEnv.FNLOOM_FILES_SECRET ?? keys.filesSecret,
56
+ vapid: pushEnv.FNLOOM_VAPID_PUBLIC !== undefined && pushEnv.FNLOOM_VAPID_PRIVATE !== undefined
57
+ ? { publicKey: pushEnv.FNLOOM_VAPID_PUBLIC, privateKey: pushEnv.FNLOOM_VAPID_PRIVATE }
58
58
  : keys.vapid,
59
59
  };
60
60
  }
@@ -18,12 +18,12 @@ export function makeLogger(settings: Pick<HubSettings, 'logEnv' | 'hubEnv'>, now
18
18
  const { logEnv, hubEnv } = settings;
19
19
  // Made before `interceptConsole()`: the transport binds the console's methods now, so lines never loop back.
20
20
  const transports: Transport[] = [consoleTransport()];
21
- if (logEnv.HARNESS_LOG_FILES) {
22
- transports.push(fileTransport({ path: join(hubEnv.HARNESS_LOG_DIR, 'hub.log'), strategy: 'date', maxFiles: logEnv.HARNESS_LOG_KEEP, structured: true }));
21
+ if (logEnv.FNLOOM_LOG_FILES) {
22
+ transports.push(fileTransport({ path: join(hubEnv.FNLOOM_LOG_DIR, 'hub.log'), strategy: 'date', maxFiles: logEnv.FNLOOM_LOG_KEEP, structured: true }));
23
23
  }
24
24
  return createLogger({
25
- level: logEnv.HARNESS_LOG_LEVEL,
26
- structured: logEnv.HARNESS_LOG_JSON,
25
+ level: logEnv.FNLOOM_LOG_LEVEL,
26
+ structured: logEnv.FNLOOM_LOG_JSON,
27
27
  transports,
28
28
  sanitize: { sensitiveKeys: SENSITIVE_KEYS, maxStringLength: 4_000, maxArrayLength: 50 },
29
29
  ...(now === undefined ? {} : { now }),
@@ -25,6 +25,7 @@ import { registerPersonFns } from './person-fns.ts';
25
25
  import { NodeStarter, type ProcessStarter } from '@harness/sdk/server';
26
26
  import type { Installer } from '../link/process.ts';
27
27
  import { openSqliteStore } from '../store/sqlite.ts';
28
+ import { allRows } from '../store/rows.ts';
28
29
  import { adminOperations, type AdminOperations } from '../api/admin-ops.ts';
29
30
  import { hubReads, type HubReads } from '../api/reads.ts';
30
31
  import { registerMcpFns } from '../mcp/fns.ts';
@@ -33,6 +34,7 @@ import { registerAdminFns } from './admin-fns.ts';
33
34
  import { AdminArgSecrets } from './admin-secrets.ts';
34
35
  import { registerReadFns } from './read-fns.ts';
35
36
  import { registerHubFns } from './hub-fns.ts';
37
+ import { registerPlanFns } from './plan-fns.ts';
36
38
  import { HUB_INFO } from './info.ts';
37
39
  import { migrateOldVersions } from '../catalog/versions.ts';
38
40
  import { withHubGroups } from './hub-groups.ts';
@@ -90,7 +92,7 @@ function systemsModules(seams: ModuleSeams): Pick<HubModules, 'catalog' | 'link'
90
92
  hub: hub.settings.hubEnv, link: hub.settings.linkEnv, packaging: hub.settings.packagingEnv, model: hub.settings.modelEnv, index: hub.settings.indexEnv,
91
93
  search: hub.settings.storeEnv, review: hub.settings.reviewEnv,
92
94
  },
93
- launcher: seams.launcher ?? new NodeStarter({ baseEnv: process.env, nodeArgs: process.execArgv, outputTail: hub.settings.linkEnv.HARNESS_PROCESS_OUTPUT_TAIL }),
95
+ launcher: seams.launcher ?? new NodeStarter({ baseEnv: process.env, nodeArgs: process.execArgv, outputTail: hub.settings.linkEnv.FNLOOM_PROCESS_OUTPUT_TAIL }),
94
96
  ...(seams.installer === undefined ? {} : { installer: seams.installer }),
95
97
  content: () => hub.api.content,
96
98
  secrets: () => hub.api.secrets,
@@ -98,6 +100,12 @@ function systemsModules(seams: ModuleSeams): Pick<HubModules, 'catalog' | 'link'
98
100
  ai: () => hub.execution.llm,
99
101
  // plan item 7: fns that need a model role (`hub/ctx_crawl` needs `decide`) are off while it has no model
100
102
  roleSet: (role) => hub.models.roles.isSet(role),
103
+ // a store move waits for the instance's running runs, and cancels them when the admin says so
104
+ runs: () => ({
105
+ running: async (ref) => (await allRows(hub.store.table('runs'), { where: { status: 'running' } }))
106
+ .filter((run) => run.system === ref.system && run.instance === ref.instance).map((run) => run.id),
107
+ cancel: (run, by) => hub.execution.runs.cancel(run, by),
108
+ }),
101
109
  });
102
110
  builds.set(context, built);
103
111
  return built;
@@ -125,18 +133,18 @@ function systemsModules(seams: ModuleSeams): Pick<HubModules, 'catalog' | 'link'
125
133
  link: (context) => {
126
134
  const { hub } = context;
127
135
  const systems = systemsOf(context);
128
- const { connections, pairing, config, supervisor, admin, resources, output, packages, router, autoPairs, lifecycle, grants, gate } = systems;
136
+ const { connections, pairing, config, supervisor, admin, resources, output, packages, router, autoPairs, lifecycle, grants, gate, stores, moves, storeBackups } = systems;
129
137
  return {
130
- services: { connections, pairing, config, supervisor, admin, resources, output, packages, instances: router, autoPairs, tokens: context.systemTokens, lifecycle, grants, gate },
138
+ services: { connections, pairing, config, supervisor, admin, resources, output, packages, instances: router, autoPairs, tokens: context.systemTokens, lifecycle, grants, gate, stores, moves, storeBackups },
131
139
  hooks: {
132
140
  // build 1's single-instance rows move onto instances before any system can connect
133
141
  work: { up: async () => { await systems.migrate(); } },
134
142
  links: { up: () => { systems.start(); return Promise.resolve(); }, pre: () => systems.stop() },
135
143
  },
136
- linkPlugins: [systems.plugin, linkServicesPlugin({
144
+ linkPlugins: [systems.plugin, systems.storesPlugin, linkServicesPlugin({
137
145
  store: () => hub.store, catalog: () => serviceCatalog(hub.catalog), content: () => hub.api.content, state: () => hub.chat.state, turns: () => hub.chat.turns,
138
- maxUpload: hub.settings.httpEnv.HARNESS_MAX_UPLOAD, uploadTtl: hub.settings.httpEnv.HARNESS_PRESIGN_TTL,
139
- maxUploads: hub.settings.linkEnv.HARNESS_LINK_MAX_UPLOADS, clock: hub.clock,
146
+ maxUpload: hub.settings.httpEnv.FNLOOM_MAX_UPLOAD, uploadTtl: hub.settings.httpEnv.FNLOOM_PRESIGN_TTL,
147
+ maxUploads: hub.settings.linkEnv.FNLOOM_LINK_MAX_UPLOADS, clock: hub.clock,
140
148
  access: (actor) => hub.access.scope(actor), bus: () => hub.bus,
141
149
  }), ownerRunsPlugin({
142
150
  // a system's runs of its own kinds' fns, started as their owners, and its notices to people (`runs` grant)
@@ -208,7 +216,7 @@ export function registerHubContract(
208
216
  };
209
217
  registerHubFns(module.hubFns, {
210
218
  store: () => hub.store, catalog: () => hub.catalog, search: () => hub.index.search, sessions: () => hub.chat.sessions, handlers: () => module.handlers,
211
- access: (actor) => hub.access.scope(actor), sharing: () => hub.access, fns: () => hub.fns, facts: () => hub.fns.facts, views: () => hub.contextor.views, mcpScope, decider: () => hub.models.decider, searchLoadMax: hub.settings.fnsEnv.HARNESS_SEARCH_LOAD_MAX,
219
+ access: (actor) => hub.access.scope(actor), sharing: () => hub.access, fns: () => hub.fns, facts: () => hub.fns.facts, views: () => hub.contextor.views, mcpScope, decider: () => hub.models.decider, searchLoadMax: hub.settings.fnsEnv.FNLOOM_SEARCH_LOAD_MAX,
212
220
  });
213
221
  let ops: AdminOperations | undefined;
214
222
  registerAdminFns(module.hubFns, () => (ops ??= adminOperations(hub)));
@@ -222,6 +230,7 @@ export function registerHubContract(
222
230
  registerPersonFns(module.hubFns, {
223
231
  person: () => (person ??= personOperations(hub)), explore: () => (explore ??= exploreOperations(hub)), adminReads: () => (adminReads ??= adminReadOperations(hub)),
224
232
  });
233
+ registerPlanFns(module.hubFns, () => hub.resources.questions.plans);
225
234
  registerDataFns(module.hubFns, { data: () => hub.data, access: (actor) => hub.access.scope(actor) });
226
235
  let tables: TableService | undefined;
227
236
  registerTableFns(module.hubFns, () => (tables ??= tableServiceOf(hub)));
@@ -66,6 +66,11 @@ export function registerPersonFns(fns: HubFns, ops: PersonFnOps): void {
66
66
  suggest_decision_get: run(ADMIN_READ_ENDPOINTS.suggest_decision_get, () => ops.adminReads().suggest_decision_get),
67
67
  search_decision_get: run(ADMIN_READ_ENDPOINTS.search_decision_get, () => ops.adminReads().search_decision_get),
68
68
  ctx_injections_list: run(ADMIN_READ_ENDPOINTS.ctx_injections_list, () => ops.adminReads().ctx_injections_list),
69
+ ctx_review: run(ADMIN_READ_ENDPOINTS.ctx_review, () => ops.adminReads().ctx_review),
70
+ ctx_new_status_get: run(ADMIN_READ_ENDPOINTS.ctx_new_status_get, () => ops.adminReads().ctx_new_status_get),
71
+ system_store: run(ADMIN_READ_ENDPOINTS.system_store, () => ops.adminReads().system_store),
72
+ system_store_move_state: run(ADMIN_READ_ENDPOINTS.system_store_move_state, () => ops.adminReads().system_store_move_state),
73
+ system_store_backups: run(ADMIN_READ_ENDPOINTS.system_store_backups, () => ops.adminReads().system_store_backups),
69
74
  };
70
75
  for (const [name, impl] of Object.entries(person)) if (isName(name, HUB_PERSON_ENDPOINTS)) fns.register(hub.fns[name], impl);
71
76
  for (const [name, impl] of Object.entries(explore)) if (isName(name, HUB_EXPLORE_ENDPOINTS)) fns.register(hub.fns[name], impl);
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The plan fns (plan `context-questions`): `hub/ctx_plan` makes a plan (its run's result is the plan),
3
+ * `hub/ctx_plan_get` reads one as it is now, `hub/ctx_answer` answers its questions and `hub/ctx_plan_expand` plans
4
+ * deeper or re-plans; the last two change the plan run's saved result. Each runs `ContextPlans` as the run's person,
5
+ * the same operation the Context page's endpoints run. Planning reports its progress on its run's card.
6
+ */
7
+ import { ContextAnswerArgs, ContextPlanArgs, ContextPlanExpandArgs, ContextPlanGetArgs } from '@harness/core';
8
+ import { hub } from '@harness/sdk';
9
+ import type { HubFnCtx, HubFns } from '../execution/executors.ts';
10
+ import { fnError, RunRefused } from '../execution/errors.ts';
11
+ import { PlanNotReady, type ContextPlans } from '../questions/plans.ts';
12
+ import { PlanFailed } from '../questions/planner.ts';
13
+
14
+ /** The error code of a plan refused because a model it needs isn't set. */
15
+ export const PLAN_NOT_READY = 'plan-not-ready';
16
+
17
+ /** Refuse with the reason when planning can't run (a model missing, the model gave nothing). */
18
+ async function refusing<T>(work: () => Promise<T>): Promise<T> {
19
+ try {
20
+ return await work();
21
+ } catch (error) {
22
+ if (error instanceof PlanNotReady) throw new RunRefused(fnError('caller', error.message, PLAN_NOT_READY));
23
+ if (error instanceof PlanFailed) throw new RunRefused(fnError('caller', error.message, 'plan-failed'));
24
+ throw error;
25
+ }
26
+ }
27
+
28
+ /** The run a plan fn works in, as `ContextPlans` takes it. */
29
+ function runCtx(ctx: HubFnCtx) {
30
+ return { run: ctx.request.run.id, signal: ctx.signal, progress: (report: Parameters<HubFnCtx['progress']>[0]) => { ctx.progress(report); } };
31
+ }
32
+
33
+ /** Register the plan fns. */
34
+ export function registerPlanFns(fns: HubFns, plans: () => ContextPlans): void {
35
+ fns.register(hub.fns.ctx_plan, (args, ctx) => refusing(() => plans().plan(ContextPlanArgs.parse(args), { actor: ctx.request.run.user.id }, runCtx(ctx))));
36
+ fns.register(hub.fns.ctx_plan_get, (args, ctx) => plans().get(ContextPlanGetArgs.parse(args), { actor: ctx.request.run.user.id }));
37
+ fns.register(hub.fns.ctx_answer, (args, ctx) => plans().answer(ContextAnswerArgs.parse(args), { actor: ctx.request.run.user.id }));
38
+ fns.register(hub.fns.ctx_plan_expand, (args, ctx) => refusing(() => plans().expand(ContextPlanExpandArgs.parse(args), { actor: ctx.request.run.user.id }, runCtx(ctx))));
39
+ }
@@ -44,7 +44,7 @@ export interface ApiParts {
44
44
  readonly pushSender: PushSender;
45
45
  /** How SSO providers are reached (tests give a fake issuer); the global fetch when not given. */
46
46
  readonly oidcFetch?: typeof fetch;
47
- /** Where the hub keeps its own certificate authority (tests give a folder of their own); `<HARNESS_DATA>/tls` when not given. */
47
+ /** Where the hub keeps its own certificate authority (tests give a folder of their own); `<FNLOOM_DATA>/tls` when not given. */
48
48
  readonly tls?: TlsFolder;
49
49
  }
50
50
 
@@ -54,23 +54,23 @@ export type ApiServices = HubServices['api'] & { readonly auth: HubAuthenticator
54
54
  /** Make the api module's services. */
55
55
  export function apiServices(base: BaseServices, parts: ApiParts): ApiServices {
56
56
  const { settings, store, clock, log, bus } = base;
57
- const identity = new StoreHubIdentity({ store, bus, clock, envName: settings.hubEnv.HARNESS_NAME, version: HUB_INFO.version, hub: HUB_SYSTEM });
58
- const providers = settings.authEnv.HARNESS_SSO_PROVIDERS;
59
- const { HARNESS_TLS_CERT: tlsCert, HARNESS_TLS_KEY: tlsKey } = settings.httpEnv;
57
+ const identity = new StoreHubIdentity({ store, bus, clock, envName: settings.hubEnv.FNLOOM_NAME, version: HUB_INFO.version, hub: HUB_SYSTEM });
58
+ const providers = settings.authEnv.FNLOOM_SSO_PROVIDERS;
59
+ const { FNLOOM_TLS_CERT: tlsCert, FNLOOM_TLS_KEY: tlsKey } = settings.httpEnv;
60
60
  const tlsFiles = tlsCert !== undefined && tlsKey !== undefined ? { cert: tlsCert, key: tlsKey } : undefined;
61
61
  const auth = new HubAuthenticator({
62
- store, clock, identity, secret: parts.keys.jwtSecret, hasher: new ScryptHasher(settings.authEnv.HARNESS_PASSWORD_COST),
63
- accessTtl: settings.authEnv.HARNESS_ACCESS_TTL, refreshTtl: settings.authEnv.HARNESS_REFRESH_TTL, providers, bus,
62
+ store, clock, identity, secret: parts.keys.jwtSecret, hasher: new ScryptHasher(settings.authEnv.FNLOOM_PASSWORD_COST),
63
+ accessTtl: settings.authEnv.FNLOOM_ACCESS_TTL, refreshTtl: settings.authEnv.FNLOOM_REFRESH_TTL, providers, bus,
64
64
  });
65
65
  return {
66
66
  identity,
67
67
  auth,
68
68
  sso: new OidcSignIns({
69
- providers, auth, store, log, clock, hubUrl: settings.hubEnv.HARNESS_URL, window: settings.authEnv.HARNESS_SSO_WINDOW,
69
+ providers, auth, store, log, clock, hubUrl: settings.hubEnv.FNLOOM_URL, window: settings.authEnv.FNLOOM_SSO_WINDOW,
70
70
  ...(parts.oidcFetch === undefined ? {} : { fetch: parts.oidcFetch }),
71
71
  }),
72
72
  content: new FileContentStore({
73
- files: parts.files, presign: parts.presign, maxUpload: settings.httpEnv.HARNESS_MAX_UPLOAD, presignTtl: settings.httpEnv.HARNESS_PRESIGN_TTL, clock,
73
+ files: parts.files, presign: parts.presign, maxUpload: settings.httpEnv.FNLOOM_MAX_UPLOAD, presignTtl: settings.httpEnv.FNLOOM_PRESIGN_TTL, clock,
74
74
  }),
75
75
  push: new WebPushService({
76
76
  store, sender: parts.pushSender, publicKey: parts.keys.vapid.publicKey, identity,
@@ -79,7 +79,7 @@ export function apiServices(base: BaseServices, parts: ApiParts): ApiServices {
79
79
  relay: new BusEventRelay({ bus, store }),
80
80
  secrets: new AesSecretVault({ store, box: new SecretBox(parts.keys.secretKey), clock }),
81
81
  https: new HubHttps({
82
- store, clock, folder: parts.tls ?? new TlsFolder(join(settings.hubEnv.HARNESS_DATA, 'tls')), on: settings.httpEnv.HARNESS_HTTPS, hubUrl: settings.hubEnv.HARNESS_URL,
82
+ store, clock, folder: parts.tls ?? new TlsFolder(join(settings.hubEnv.FNLOOM_DATA, 'tls')), on: settings.httpEnv.FNLOOM_HTTPS, hubUrl: settings.hubEnv.FNLOOM_URL,
83
83
  ...(tlsFiles === undefined ? {} : { files: tlsFiles }),
84
84
  onError: (error) => { log.warn('https.certificate.failed', {}, error); },
85
85
  }),