fnloom 0.3.0 → 0.4.1
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.
- package/README.md +27 -20
- package/package.json +14 -11
- package/packages/build/package.json +2 -2
- package/packages/build/src/tests.ts +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/cli.ts +2 -2
- package/packages/cli/src/command.ts +2 -2
- package/packages/cli/src/commands/install.ts +1 -1
- package/packages/cli/src/commands/mcp.ts +6 -6
- package/packages/cli/src/commands/store.ts +3 -3
- package/packages/cli/src/hub.ts +25 -25
- package/packages/cli/src/index.ts +1 -1
- package/packages/cli/src/io.ts +2 -2
- package/packages/cli/src/local.ts +7 -7
- package/packages/cli/src/premade.ts +1 -1
- package/packages/core/package.json +4 -4
- package/packages/core/src/auto-pair.ts +1 -1
- package/packages/core/src/connections.ts +1 -14
- package/packages/core/src/context-graph.ts +1 -1
- package/packages/core/src/data.ts +1 -1
- package/packages/core/src/gin-a.ts +13 -2
- package/packages/core/src/https.ts +2 -2
- package/packages/core/src/identity.ts +1 -1
- package/packages/core/src/image-embeddings.ts +1 -1
- package/packages/core/src/index.ts +5 -7
- package/packages/core/src/link.ts +1 -1
- package/packages/core/src/manifest.ts +2 -2
- package/packages/core/src/mention-search.ts +1 -1
- package/packages/core/src/model-calls.ts +1 -1
- package/packages/core/src/package.ts +1 -1
- package/packages/core/src/ports.ts +2 -2
- package/packages/core/src/query.ts +1 -1
- package/packages/core/src/records/chat.ts +1 -1
- package/packages/core/src/records/runs.ts +1 -1
- package/packages/core/src/records/spend.ts +4 -0
- package/packages/core/src/registries.ts +9 -3
- package/packages/core/src/sso.ts +2 -2
- package/packages/core/src/stores.ts +1 -1
- package/packages/core/src/suggestions.ts +2 -2
- package/packages/core/src/system-pages.ts +32 -6
- package/packages/core/src/tables.ts +233 -0
- package/packages/core/src/visuals.ts +47 -139
- package/packages/core/src/web.ts +2 -2
- package/packages/core/src/widgets-v1.ts +78 -1
- package/packages/hub/package.json +13 -11
- package/packages/hub/src/api/admin-ops.ts +5 -5
- package/packages/hub/src/api/auth.ts +2 -2
- package/packages/hub/src/api/https.ts +6 -6
- package/packages/hub/src/api/identities.ts +1 -1
- package/packages/hub/src/api/reads.ts +1 -1
- package/packages/hub/src/api/secrets.ts +1 -1
- package/packages/hub/src/api/serve.ts +2 -2
- package/packages/hub/src/api/sso-route.ts +2 -2
- package/packages/hub/src/api/sso.ts +6 -6
- package/packages/hub/src/api/store-ops.ts +9 -2
- package/packages/hub/src/api/testing/rig.ts +1 -1
- package/packages/hub/src/api/tls.ts +2 -2
- package/packages/hub/src/api/web/auth.ts +1 -1
- package/packages/hub/src/api/web/find.ts +1 -1
- package/packages/hub/src/api/web/pages.ts +4 -3
- package/packages/hub/src/api/web/pickers.ts +4 -4
- package/packages/hub/src/boot/env.ts +82 -78
- package/packages/hub/src/boot/hub-fns.ts +1 -1
- package/packages/hub/src/boot/identity.ts +2 -2
- package/packages/hub/src/boot/index.ts +1 -1
- package/packages/hub/src/boot/info.ts +1 -1
- package/packages/hub/src/boot/keys.ts +6 -6
- package/packages/hub/src/boot/log.ts +4 -4
- package/packages/hub/src/boot/modules.ts +4 -4
- package/packages/hub/src/boot/services.ts +9 -9
- package/packages/hub/src/boot/start.ts +23 -23
- package/packages/hub/src/catalog/catalog.ts +3 -2
- package/packages/hub/src/chat/cache.ts +1 -1
- package/packages/hub/src/chat/chat.ts +1 -1
- package/packages/hub/src/chat/compare.ts +2 -2
- package/packages/hub/src/chat/deliveries.ts +1 -1
- package/packages/hub/src/chat/deps.ts +3 -3
- package/packages/hub/src/chat/enrich.ts +7 -7
- package/packages/hub/src/chat/env.ts +20 -20
- package/packages/hub/src/chat/mention-requests.ts +1 -1
- package/packages/hub/src/chat/mention-search.ts +1 -1
- package/packages/hub/src/chat/mentions.ts +3 -3
- package/packages/hub/src/chat/notifications.ts +2 -2
- package/packages/hub/src/chat/presence.ts +2 -2
- package/packages/hub/src/chat/sessions.ts +2 -2
- package/packages/hub/src/chat/suggestions.ts +8 -8
- package/packages/hub/src/chat/testing.ts +1 -1
- package/packages/hub/src/chat/turns.ts +6 -6
- package/packages/hub/src/chat/undo.ts +1 -1
- package/packages/hub/src/connections/create.ts +1 -1
- package/packages/hub/src/connections/env.ts +2 -2
- package/packages/hub/src/connections/service.ts +5 -9
- package/packages/hub/src/contextor/contextors.ts +9 -9
- package/packages/hub/src/contextor/crawl.ts +1 -1
- package/packages/hub/src/contextor/create.ts +5 -5
- package/packages/hub/src/contextor/dynamic.ts +5 -5
- package/packages/hub/src/contextor/env.ts +46 -46
- package/packages/hub/src/contextor/injected.ts +1 -1
- package/packages/hub/src/contextor/limits.ts +9 -9
- package/packages/hub/src/contextor/planner.ts +11 -11
- package/packages/hub/src/contextor/testing.ts +1 -1
- package/packages/hub/src/data/env.ts +3 -3
- package/packages/hub/src/data/service.ts +5 -5
- package/packages/hub/src/execution/agent.ts +8 -8
- package/packages/hub/src/execution/ai.ts +7 -7
- package/packages/hub/src/execution/create.ts +11 -6
- package/packages/hub/src/execution/env.ts +16 -16
- package/packages/hub/src/execution/executors.ts +2 -2
- package/packages/hub/src/execution/gateway.ts +1 -1
- package/packages/hub/src/execution/index.ts +1 -1
- package/packages/hub/src/execution/ledger.ts +2 -2
- package/packages/hub/src/execution/limits.ts +2 -2
- package/packages/hub/src/execution/models.ts +2 -2
- package/packages/hub/src/execution/ports.ts +1 -1
- package/packages/hub/src/execution/providers.ts +55 -11
- package/packages/hub/src/execution/queues.ts +6 -6
- package/packages/hub/src/execution/runs.ts +10 -10
- package/packages/hub/src/execution/stream-guard.ts +2 -2
- package/packages/hub/src/execution/testing.ts +5 -5
- package/packages/hub/src/execution/wire.ts +3 -3
- package/packages/hub/src/fns/auto.ts +2 -2
- package/packages/hub/src/fns/client-logs.ts +2 -2
- package/packages/hub/src/fns/create.ts +2 -2
- package/packages/hub/src/fns/decided.ts +2 -2
- package/packages/hub/src/fns/env.ts +14 -14
- package/packages/hub/src/fns/examples.ts +3 -3
- package/packages/hub/src/fns/facts.ts +5 -5
- package/packages/hub/src/fns/search.ts +5 -5
- package/packages/hub/src/graph/graph.ts +1 -1
- package/packages/hub/src/index/context-sections.ts +1 -1
- package/packages/hub/src/index/embedders.ts +3 -3
- package/packages/hub/src/index/env.ts +12 -12
- package/packages/hub/src/index/index.ts +1 -1
- package/packages/hub/src/index/indexer.ts +4 -4
- package/packages/hub/src/index/search.ts +1 -1
- package/packages/hub/src/index/testing.ts +2 -2
- package/packages/hub/src/link/build.ts +32 -32
- package/packages/hub/src/link/env.ts +14 -14
- package/packages/hub/src/link/grants.ts +10 -10
- package/packages/hub/src/link/lifecycle.ts +4 -4
- package/packages/hub/src/link/migrate-api.ts +55 -15
- package/packages/hub/src/link/pairing.ts +1 -1
- package/packages/hub/src/link/process.ts +1 -1
- package/packages/hub/src/link/rig.ts +12 -12
- package/packages/hub/src/link/supervisor.ts +1 -1
- package/packages/hub/src/mcp/calls.ts +6 -6
- package/packages/hub/src/mcp/create.ts +5 -5
- package/packages/hub/src/mcp/env.ts +6 -6
- package/packages/hub/src/mcp/fns.ts +2 -2
- package/packages/hub/src/mcp/index.ts +2 -2
- package/packages/hub/src/mcp/sources.ts +3 -3
- package/packages/hub/src/mcp/tokens.ts +1 -1
- package/packages/hub/src/models/create.ts +1 -1
- package/packages/hub/src/models/decide.ts +2 -2
- package/packages/hub/src/models/index.ts +1 -1
- package/packages/hub/src/models/roles.ts +12 -12
- package/packages/hub/src/query/env.ts +5 -5
- package/packages/hub/src/query/sources.ts +3 -3
- package/packages/hub/src/questions/plans.ts +1 -1
- package/packages/hub/src/questions/worker.ts +2 -2
- package/packages/hub/src/resources/context.ts +3 -3
- package/packages/hub/src/resources/converters.ts +2 -2
- package/packages/hub/src/resources/create.ts +6 -6
- package/packages/hub/src/resources/env.ts +15 -15
- package/packages/hub/src/resources/fetch.ts +5 -5
- package/packages/hub/src/resources/forms.ts +5 -5
- package/packages/hub/src/resources/index.ts +1 -1
- package/packages/hub/src/resources/library.ts +2 -2
- package/packages/hub/src/resources/raw.ts +1 -1
- package/packages/hub/src/resources/reader.ts +2 -2
- package/packages/hub/src/resources/sqlite-files.ts +1 -1
- package/packages/hub/src/resources/storage.ts +5 -5
- package/packages/hub/src/resources/testing.ts +6 -6
- package/packages/hub/src/store/env.ts +4 -4
- package/packages/hub/src/store/hybrid.ts +4 -4
- package/packages/hub/src/store/sqlite.ts +3 -3
- package/packages/hub/src/stores/drivers.ts +2 -2
- package/packages/hub/src/stores/host.ts +3 -3
- package/packages/hub/src/stores/moves.ts +2 -2
- package/packages/hub/src/stores/service.ts +2 -2
- package/packages/hub/src/tables/env.ts +3 -3
- package/packages/hub/src/tables/index.ts +5 -5
- package/packages/hub/src/tables/service.ts +7 -7
- package/packages/sdk/AUTHORING.md +1206 -881
- package/packages/sdk/package.json +11 -8
- package/packages/sdk/src/agent.ts +1 -1
- package/packages/sdk/src/app-parts.ts +95 -0
- package/packages/sdk/src/authored.ts +26 -0
- package/packages/sdk/src/authoring.ts +13 -30
- package/packages/sdk/src/client-runtime.ts +24 -1
- package/packages/sdk/src/client-ui/AddServiceDialog.vue +43 -0
- package/packages/sdk/src/client-ui/InstanceNameField.vue +29 -0
- package/packages/sdk/src/client-ui/PairRowsEditor.vue +74 -0
- package/packages/sdk/src/client-ui/RemoteAuthFields.vue +95 -0
- package/packages/sdk/src/client-ui/ServiceRows.vue +57 -0
- package/packages/sdk/src/client-ui/draft.ts +10 -0
- package/packages/sdk/src/client-ui/host.ts +37 -0
- package/packages/sdk/src/client-ui/index.ts +19 -0
- package/packages/sdk/src/client-ui/loaded.ts +69 -0
- package/packages/sdk/src/client-ui/problems.ts +98 -0
- package/packages/sdk/src/client-ui/remote-config.ts +199 -0
- package/packages/sdk/src/client-ui/service-rows.ts +25 -0
- package/packages/sdk/src/client-ui/state.ts +14 -0
- package/packages/sdk/src/client-ui/testing.ts +147 -0
- package/packages/sdk/src/client-ui/vue-shim.d.ts +13 -0
- package/packages/sdk/src/client.ts +82 -11
- package/packages/sdk/src/hub.ts +4 -4
- package/packages/sdk/src/index.ts +13 -9
- package/packages/sdk/src/page-parts.ts +4 -0
- package/packages/sdk/src/program/env.ts +7 -7
- package/packages/sdk/src/program/runtime.ts +5 -5
- package/packages/sdk/src/program/tools.ts +3 -3
- package/packages/sdk/src/remote-auth.ts +128 -7
- package/packages/sdk/src/server/context-files.ts +1 -1
- package/packages/sdk/src/server/env.ts +36 -36
- package/packages/sdk/src/server/fake-hub-widgets.ts +7 -6
- package/packages/sdk/src/server/host.ts +28 -28
- package/packages/sdk/src/server/index.ts +2 -2
- package/packages/sdk/src/server/live.ts +4 -4
- package/packages/sdk/src/server/llm-wire.ts +54 -5
- package/packages/sdk/src/server/pairing.ts +1 -1
- package/packages/sdk/src/server/results.ts +4 -4
- package/packages/sdk/src/server/socket-guard.ts +1 -1
- package/packages/sdk/src/server/start-gate.ts +2 -2
- package/packages/sdk/src/server/store/engines.ts +2 -2
- package/packages/sdk/src/server/store/keeper.ts +2 -2
- package/packages/sdk/src/server/supervise.ts +4 -4
- package/packages/sdk/src/testing/env.ts +6 -6
- package/packages/sdk/src/testing/hub.ts +3 -1
- package/packages/sdk/src/testing/models.ts +3 -3
- package/packages/sdk/src/testing/openrouter.ts +3 -2
- package/packages/sdk/src/testing/preview.ts +7 -7
- package/packages/sdk/src/widgets.ts +21 -136
- package/packages/sdk/tsconfig.json +2 -2
- package/packages/web/dist/assets/{ActorSettingsView-v2k7v454.js → ActorSettingsView-CiWhrnP4.js} +2 -2
- package/packages/web/dist/assets/AdminLayout-CjVNzmYD.js +2 -0
- package/packages/web/dist/assets/{AdminLayout-1hbRPV3d.css → AdminLayout-ggcdQGlQ.css} +1 -1
- package/packages/web/dist/assets/{AppPage-CFmKZS8G.js → AppPage-D_kkUatv.js} +2 -2
- package/packages/web/dist/assets/{AutoPairPicker-C61gihmh.js → AutoPairPicker-BdCHi7dL.js} +2 -2
- package/packages/web/dist/assets/{BrowserFrame-Sq9EmQRT.js → BrowserFrame-CVQvfCB8.js} +2 -2
- package/packages/web/dist/assets/ChatPage-CPZJ8ya6.js +4 -0
- package/packages/web/dist/assets/{ChatPage-CbsRmktV.css → ChatPage-DjPv238m.css} +1 -1
- package/packages/web/dist/assets/{CodeViewer-tUNXZB77.js → CodeViewer-DzWZyAp4.js} +2 -2
- package/packages/web/dist/assets/ConfigWithCustom-C49loznj.js +3 -0
- package/packages/web/dist/assets/{ConfirmDialog-Dd3E4sJt.js → ConfirmDialog-BtugUGEY.js} +2 -2
- package/packages/web/dist/assets/{ConnectPage-CX9acyQH.js → ConnectPage-D8k2nSdX.js} +2 -2
- package/packages/web/dist/assets/ContextItemPage-DC4FGi8V.js +2 -0
- package/packages/web/dist/assets/ContextPage-MlEkKMq0.js +3 -0
- package/packages/web/dist/assets/{ContextRow-DrtPumZ5.js → ContextRow-BN26Di1B.js} +2 -2
- package/packages/web/dist/assets/{DataPage-DDSsxHro.js → DataPage-CvOYkEkS.js} +2 -2
- package/packages/web/dist/assets/DataTypePage-CDEL6BHp.js +2 -0
- package/packages/web/dist/assets/{DataTypePage-Cr238Hx_.css → DataTypePage-CWrWvUPs.css} +1 -1
- package/packages/web/dist/assets/{DesignPage-6e0XbOFC.js → DesignPage-D-MsKLuP.js} +3 -3
- package/packages/web/dist/assets/{ExplorePage-B7ND0W0l.js → ExplorePage-CNQpEe_8.js} +2 -2
- package/packages/web/dist/assets/{FnPill-Cp3KuLmP.js → FnPill-Dm5mmffj.js} +2 -2
- package/packages/web/dist/assets/{FnView-C0XZdnsS.js → FnView-oiIU5vka.js} +2 -2
- package/packages/web/dist/assets/{FnsView-GTH3p7a0.js → FnsView-DgIfza4W.js} +2 -2
- package/packages/web/dist/assets/{GinExprView-DGxns6lH.js → GinExprView-C19g0UgI.js} +2 -2
- package/packages/web/dist/assets/{GinForm-BDBUzuDP.js → GinForm-p7UsKQ3s.js} +2 -2
- package/packages/web/dist/assets/{GinTypeView-CUsymbVf.js → GinTypeView-DvdHc0V4.js} +2 -2
- package/packages/web/dist/assets/{GinValueView-jsKIfiEA.js → GinValueView-D6c7E4C_.js} +2 -2
- package/packages/web/dist/assets/{GraphPage-BCcPPsHu.js → GraphPage-BTamx4d-.js} +2 -2
- package/packages/web/dist/assets/GraphPanel-DKpbijQD.js +2 -0
- package/packages/web/dist/assets/{HubPicker-EoOErgmk.js → HubPicker-DfXIcUz1.js} +2 -2
- package/packages/web/dist/assets/{InboxApprovals-Dkq7DFp_.js → InboxApprovals-B9qwPCHR.js} +2 -2
- package/packages/web/dist/assets/{InboxPage-CHhslePq.js → InboxPage-j2lF00uW.js} +2 -2
- package/packages/web/dist/assets/InjectedList-BTGvy8GB.js +2 -0
- package/packages/web/dist/assets/{InstallDialog-D-VwfZYF.js → InstallDialog-BRJXLSMJ.js} +2 -2
- package/packages/web/dist/assets/InstanceTypes-DYdolFFW.js +2 -0
- package/packages/web/dist/assets/InstanceView-C5dJLBPe.js +2 -0
- package/packages/web/dist/assets/{ItemHistory-NQAP69ma.js → ItemHistory-vsyIMjIX.js} +2 -2
- package/packages/web/dist/assets/LimitsView-BtbQzkX1.js +2 -0
- package/packages/web/dist/assets/{ListSearch-BunVrDO0.js → ListSearch-BdVW9FHD.js} +2 -2
- package/packages/web/dist/assets/{LlmCallDetails-BoVNDTVs.js → LlmCallDetails-Cd7qtybU.js} +2 -2
- package/packages/web/dist/assets/{LlmCallsView-BGpV92RC.js → LlmCallsView-CrZB_I1H.js} +2 -2
- package/packages/web/dist/assets/{LoadState-h-K9bTYc.js → LoadState-8UknKQ6e.js} +2 -2
- package/packages/web/dist/assets/McpDialog-r-qJDHOO.js +2 -0
- package/packages/web/dist/assets/{McpView-GPXdCMne.js → McpView-FeDQWGxu.js} +2 -2
- package/packages/web/dist/assets/{McpsView-DJIR2JX5.js → McpsView-Czd2yUdE.js} +2 -2
- package/packages/web/dist/assets/{MemoryDialog-BTeIHQyA.js → MemoryDialog-DDiT6wO1.js} +2 -2
- package/packages/web/dist/assets/{ModelCallsView-DMcnwF2S.js → ModelCallsView-DsdztwCR.js} +2 -2
- package/packages/web/dist/assets/{ModelPicker-CgkMFxSO.js → ModelPicker-Df_3l8nS.js} +2 -2
- package/packages/web/dist/assets/ModelsView-YXwRDgWv.js +2 -0
- package/packages/web/dist/assets/{NotFoundPage-Tk92K7HN.js → NotFoundPage-DDEOlB6B.js} +2 -2
- package/packages/web/dist/assets/{PairPage-D0BK8CCw.js → PairPage-D3uHAkh1.js} +2 -2
- package/packages/web/dist/assets/{PanelHost-C-gKrxAk.js → PanelHost-BzWYqH39.js} +2 -2
- package/packages/web/dist/assets/PeopleView-Cg9RO5SF.js +2 -0
- package/packages/web/dist/assets/{PeopleView-CJ8yArTh.css → PeopleView-DBxdbT1C.css} +1 -1
- package/packages/web/dist/assets/{PoliciesView-BRi-QAuo.js → PoliciesView-BoshL7RQ.js} +2 -2
- package/packages/web/dist/assets/{RefusalList-DVO0bmeB.js → RefusalList-DnLIfmi-.js} +2 -2
- package/packages/web/dist/assets/RendererHost-CmkaVEX0.js +2 -0
- package/packages/web/dist/assets/RendererHost-Ym_SMkhp.css +1 -0
- package/packages/web/dist/assets/{ResourceViewer-Do0chYxU.js → ResourceViewer-CSAY6xIs.js} +2 -2
- package/packages/web/dist/assets/ResourcesPage-DAoa9mDs.js +2 -0
- package/packages/web/dist/assets/ResultGrid-CL2WSYQH.css +1 -0
- package/packages/web/dist/assets/ResultGrid-DSyc0btv.js +2 -0
- package/packages/web/dist/assets/{ReviewSummaryStrip-DO3p64Qj.js → ReviewSummaryStrip-Bzy-KGz_.js} +2 -2
- package/packages/web/dist/assets/ReviewView-Cwq8Az_B.js +3 -0
- package/packages/web/dist/assets/{RuleRow-DX9v4iGP.js → RuleRow-DAvl2m9p.js} +2 -2
- package/packages/web/dist/assets/RunCard-BMyRkKxJ.js +2 -0
- package/packages/web/dist/assets/RunCard-CSDiz-Nt.css +1 -0
- package/packages/web/dist/assets/{RunDetails-DjR206q6.js → RunDetails-Bvyr1HYK.js} +2 -2
- package/packages/web/dist/assets/{RunDot-lHRICdM5.js → RunDot-Lfrt5XR3.js} +2 -2
- package/packages/web/dist/assets/{RunPage-CbAQ_WPR.js → RunPage-C0-wY6Uz.js} +2 -2
- package/packages/web/dist/assets/{RunProgress-C3-B4tQf.js → RunProgress-BbzwzrTK.js} +2 -2
- package/packages/web/dist/assets/{RunsView-DMkPmkqX.js → RunsView-so-UV2Cq.js} +2 -2
- package/packages/web/dist/assets/SettingsPage-B4SQLk09.js +3 -0
- package/packages/web/dist/assets/{SettingsPage-t03BqXw8.css → SettingsPage-BTl3Ie4F.css} +1 -1
- package/packages/web/dist/assets/SignInPage-CXxLf7Rp.css +1 -0
- package/packages/web/dist/assets/{SignInPage-ByqGEZfj.js → SignInPage-Ck-v3eH0.js} +2 -2
- package/packages/web/dist/assets/{StatusBadge-CXne0sRZ.js → StatusBadge-C4NawPsO.js} +2 -2
- package/packages/web/dist/assets/{StorePlacementStep-B6SwTmdM.js → StorePlacementStep-DjLWeQF9.js} +2 -2
- package/packages/web/dist/assets/{SystemConfig-vQDL_eUl.js → SystemConfig-B5C5B3b0.js} +2 -2
- package/packages/web/dist/assets/SystemPageHost-DX7LrFoN.css +1 -0
- package/packages/web/dist/assets/SystemPageHost-DoyQlhKM.js +2 -0
- package/packages/web/dist/assets/SystemView-CTdpay8I.js +2 -0
- package/packages/web/dist/assets/SystemsView-Cnv2moRw.js +2 -0
- package/packages/web/dist/assets/TableView-BK_95qHT.js +3 -0
- package/packages/web/dist/assets/TableView-B_4MViVb.css +1 -0
- package/packages/web/dist/assets/{TableViewer-Boxx86f5.js → TableViewer-CRsIxdku.js} +3 -3
- package/packages/web/dist/assets/{ThemePicker-CIg_oRQX.js → ThemePicker-BlW7qvUd.js} +2 -2
- package/packages/web/dist/assets/{TurnTree-Ecm0yA5g.js → TurnTree-D6OYRutQ.js} +2 -2
- package/packages/web/dist/assets/{UserMessage-BtECa8ka.css → UserMessage-B63G9sxC.css} +1 -1
- package/packages/web/dist/assets/{UserMessage-BlnqZDVU.js → UserMessage-DJH2bXqv.js} +6 -6
- package/packages/web/dist/assets/{ValueVisual-C-MWpp7c.js → ValueVisual-BJUrdkHO.js} +2 -2
- package/packages/web/dist/assets/{fn-modal-B98MR7JN.js → fn-modal-DFtN7Kn-.js} +2 -2
- package/packages/web/dist/assets/{fn-notices-CfTa1E8y.js → fn-notices-C8HXeo7m.js} +2 -2
- package/packages/web/dist/assets/{formats-JwoKfXIq.js → formats-CHSYhY4X.js} +2 -2
- package/packages/web/dist/assets/index-BY7M8QUk.css +1 -0
- package/packages/web/dist/assets/index-Uz-h2M5K.js +4 -0
- package/packages/web/dist/assets/{labels-BFbk11BE.js → labels-DkV96Md_.js} +2 -2
- package/packages/web/dist/assets/{layout-D1gf481r.js → layout-CTAHAwIH.js} +2 -2
- package/packages/web/dist/assets/loaded-BrwmsuZY.js +2 -0
- package/packages/web/dist/assets/{metrics-CBPX3W5Y.js → metrics-BBvD6KSk.js} +2 -2
- package/packages/web/dist/assets/problems-CI9huk1n.js +2 -0
- package/packages/web/dist/assets/{push-payload-BeU1ADYt.js → push-payload-C1ppI5V2.js} +64 -64
- package/packages/web/dist/assets/record-edits-DFJBcNnL.js +2 -0
- package/packages/web/dist/assets/{review-fP-l9D6H.js → review-DlP8FQiO.js} +3 -3
- package/packages/web/dist/assets/routes-oIISbS5Z.js +4 -0
- package/packages/web/dist/assets/{runs-CveC2kKo.js → runs-BWVBevgu.js} +2 -2
- package/packages/web/dist/assets/{shared-LbaIHjbV.js → shared-Bc4GJbiE.js} +2 -2
- package/packages/web/dist/assets/{sources-VPrtgLIi.js → sources-gONU9kk2.js} +2 -2
- package/packages/web/dist/assets/src-ClMFVauH.js +43 -0
- package/packages/web/dist/assets/state-BQlvjJzT.js +2 -0
- package/packages/web/dist/assets/{systems-BqE3WTSF.js → systems-Dt01wDhP.js} +2 -2
- package/packages/web/dist/assets/table-host-BvEY0Zxn.js +2 -0
- package/packages/web/dist/assets/tables-CkqGZ0Yq.js +2 -0
- package/packages/web/dist/assets/{ui-BzgWquIU.js → ui-CjoSgSyZ.js} +5 -5
- package/packages/web/dist/assets/{url-DKGcECT1.js → url-Deh5u3O5.js} +2 -2
- package/packages/web/dist/index.html +49 -47
- package/packages/web/dist/sw.js +1 -1
- package/packages/web/package.json +2 -4
- package/premade/claude.zip +0 -0
- package/premade/database.zip +0 -0
- package/premade/web.zip +0 -0
- package/scripts/dev-env.ts +9 -9
- package/scripts/run-stack.ts +15 -15
- package/scripts/stack.ts +3 -3
- package/scripts/start.ts +18 -18
- package/systems/api/client/ApiServiceForm.vue +55 -0
- package/systems/api/client/ServiceList.vue +90 -0
- package/systems/api/client/ServicePage.vue +142 -0
- package/systems/api/client/ServicesPage.vue +32 -0
- package/systems/api/client/index.ts +15 -0
- package/systems/api/client/logic.ts +140 -0
- package/systems/api/client/state.ts +92 -0
- package/systems/api/package.json +9 -6
- package/systems/api/server/authoring.ts +2 -1
- package/systems/api/server/env.ts +1 -1
- package/systems/api/server/guard.ts +1 -1
- package/systems/api/server/http.ts +3 -2
- package/systems/api/server/impl.ts +3 -2
- package/systems/api/server/main.ts +11 -7
- package/systems/api/server/openapi.ts +1 -1
- package/systems/api/server/program.ts +2 -1
- package/systems/api/server/services.ts +2 -1
- package/systems/api/shared/http.ts +2 -1
- package/systems/api/shared/index.ts +15 -5
- package/{packages/core/src/programs.ts → systems/api/shared/services.ts} +7 -51
- package/systems/api/system.json +2 -1
- package/systems/api/tsconfig.json +2 -2
- package/systems/code/package.json +4 -3
- package/systems/code/server/authoring.ts +2 -1
- package/systems/code/server/impl.ts +2 -1
- package/systems/code/server/main.ts +5 -5
- package/systems/code/shared/index.ts +2 -3
- package/systems/code/shared/program.ts +23 -0
- package/systems/embedder/package.json +1 -1
- package/systems/embedder/server/env.ts +1 -1
- package/systems/embedder/server/main.ts +5 -5
- package/systems/embedder/shared/index.ts +1 -1
- package/systems/fs/client/machines/fakes.ts +1 -1
- package/systems/fs/client/machines/files/CommentComposer.vue +6 -3
- package/systems/fs/client/machines/files/FilePane.vue +2 -2
- package/systems/fs/client/machines/files/fakes.ts +1 -1
- package/systems/fs/client/machines/palette.ts +3 -2
- package/systems/fs/context/authoring/parts/client.md +23 -5
- package/systems/fs/context/authoring/parts/client.reference/client.md +7 -16
- package/systems/fs/context/authoring/parts/client.reference/pageinbox.md +524 -0
- package/systems/fs/context/authoring/parts/client.reference/{resultview.md → visuals.md} +85 -116
- package/systems/fs/context/authoring/parts/client.reference.md +8 -8
- package/systems/fs/context/authoring/parts/context.md +1 -1
- package/systems/fs/context/authoring/parts/contract.md +1 -1
- package/systems/fs/context/authoring/parts/core-types/admin-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/connections-ts.md +12 -1
- package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/contextdecl.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +27 -2
- package/systems/fs/context/authoring/parts/core-types/manifest.md +27 -2
- package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +26 -2
- package/systems/fs/context/authoring/parts/core-types/modes-ts.md +3 -3
- package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +145 -1
- package/systems/fs/context/authoring/parts/core-types/registries-ts.md +98 -2
- package/systems/fs/context/authoring/parts/core-types/run-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +4 -2
- package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/tables-ts.md +91 -0
- package/systems/fs/context/authoring/parts/core-types/web-ts.md +1 -2
- package/systems/fs/context/authoring/parts/core-types.md +5 -8
- package/systems/fs/context/authoring/parts/examples/server-main-ts.md +4 -4
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +1 -1
- package/systems/fs/context/authoring/parts/fns.md +1 -1
- package/systems/fs/context/authoring/parts/folder.md +6 -6
- package/systems/fs/context/authoring/parts/hub/hub-ctx-from-resource.md +2 -2
- package/systems/fs/context/authoring/parts/hub/hub-install-package.md +2 -2
- package/systems/fs/context/authoring/parts/hub.reference.md +3 -3
- package/systems/fs/context/authoring/parts/internals/manifestof.md +2 -2
- package/systems/fs/context/authoring/parts/internals/permissionargs.md +4 -4
- package/systems/fs/context/authoring/parts/kinds-agents.md +1 -1
- package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +7 -5
- package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +4 -4
- package/systems/fs/context/authoring/parts/outcomes.md +2 -2
- package/systems/fs/context/authoring/parts/outcomes.reference.md +2 -2
- package/systems/fs/context/authoring/parts/packaging.md +4 -4
- package/systems/fs/context/authoring/parts/remote.md +5 -5
- package/systems/fs/context/authoring/parts/remote.reference.md +201 -17
- package/systems/fs/context/authoring/parts/server.md +7 -7
- package/systems/fs/context/authoring/parts/server.reference.md +15 -15
- package/systems/fs/context/authoring/parts/testing.reference/equal.md +3 -3
- package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +1 -1
- package/systems/fs/context/authoring/parts/testing.reference/kindprops.md +22 -10
- package/systems/fs/context/authoring/parts/testing.reference/{openmemorystore.md → storeconnection.md} +7 -19
- package/systems/fs/context/authoring/parts/testing.reference.md +5 -5
- package/systems/fs/context/authoring/parts/widgets.md +32 -22
- package/systems/fs/context/authoring/parts/widgets.reference.md +503 -9
- package/systems/fs/package.json +3 -3
- package/systems/fs/server/hosting.ts +10 -10
- package/systems/fs/server/main.ts +8 -8
- package/systems/fs/server/metrics/os.ts +50 -29
- package/systems/fs/server/shell.ts +1 -1
- package/systems/fs/shared/index.ts +1 -1
- package/systems/google-calendar/package.json +1 -1
- package/systems/google-calendar/server/main.ts +4 -4
- package/systems/input/package.json +3 -3
- package/systems/input/server/main.ts +6 -6
- package/systems/mcp/client/McpServerForm.vue +99 -0
- package/systems/mcp/client/ServerList.vue +78 -0
- package/systems/mcp/client/ServerPage.vue +194 -0
- package/systems/mcp/client/ServersPage.vue +32 -0
- package/systems/mcp/client/index.ts +15 -0
- package/systems/mcp/client/logic.ts +224 -0
- package/systems/mcp/client/state.ts +128 -0
- package/systems/mcp/package.json +9 -6
- package/systems/mcp/server/dial.ts +1 -1
- package/systems/mcp/server/impl.ts +2 -1
- package/systems/mcp/server/instance.ts +3 -5
- package/systems/mcp/server/main.ts +10 -6
- package/systems/mcp/server/mirror.ts +2 -3
- package/systems/mcp/server/oauth.ts +2 -1
- package/systems/mcp/server/server-link.ts +2 -1
- package/systems/mcp/shared/index.ts +15 -2
- package/{packages/core/src/mcp-servers.ts → systems/mcp/shared/servers.ts} +6 -5
- package/systems/mcp/system.json +2 -1
- package/systems/mcp/tsconfig.json +2 -2
- package/systems/ollama/package.json +3 -3
- package/systems/ollama/server/main.ts +5 -5
- package/systems/schedule/package.json +3 -3
- package/systems/schedule/server/main.ts +6 -6
- package/systems/template/README.md +2 -2
- package/systems/template/package.json +1 -1
- package/systems/template/server/main.ts +4 -4
- package/systems/widgets/client/ChipRow.vue +22 -0
- package/systems/widgets/client/ProposalCard.vue +6 -5
- package/systems/widgets/client/SavedWidget.vue +11 -8
- package/systems/widgets/client/WidgetChips.vue +137 -0
- package/systems/widgets/client/WidgetView.vue +32 -0
- package/systems/widgets/client/charts/ChartVisual.vue +157 -0
- package/systems/widgets/client/charts/chart-data.ts +230 -0
- package/systems/widgets/client/charts/echarts-setup.ts +69 -0
- package/systems/widgets/client/charts/export.ts +36 -0
- package/systems/widgets/client/charts/families/calendar.ts +105 -0
- package/systems/widgets/client/charts/families/category.ts +186 -0
- package/systems/widgets/client/charts/families/crosstab.ts +113 -0
- package/systems/widgets/client/charts/families/distribution.ts +160 -0
- package/systems/widgets/client/charts/families/finance.ts +96 -0
- package/systems/widgets/client/charts/families/gauge.ts +75 -0
- package/systems/widgets/client/charts/families/hierarchy.ts +166 -0
- package/systems/widgets/client/charts/families/index.ts +21 -0
- package/systems/widgets/client/charts/families/network.ts +140 -0
- package/systems/widgets/client/charts/families/part.ts +61 -0
- package/systems/widgets/client/charts/families/profile.ts +30 -0
- package/systems/widgets/client/charts/families/progress.ts +76 -0
- package/systems/widgets/client/charts/families/range.ts +107 -0
- package/systems/widgets/client/charts/families/time.ts +177 -0
- package/systems/widgets/client/charts/families/timeline.ts +114 -0
- package/systems/widgets/client/charts/families/wide.ts +41 -0
- package/systems/widgets/client/charts/index.ts +37 -0
- package/systems/widgets/client/charts/maths.ts +139 -0
- package/systems/widgets/client/charts/size.ts +39 -0
- package/systems/widgets/client/chips.ts +150 -0
- package/systems/widgets/client/index.ts +18 -5
- package/systems/widgets/client/proposal.ts +2 -1
- package/systems/widgets/package.json +7 -4
- package/systems/widgets/server/authoring.ts +13 -7
- package/systems/widgets/server/env.ts +1 -1
- package/systems/widgets/server/impl.ts +10 -6
- package/systems/widgets/server/main.ts +6 -6
- package/systems/widgets/server/run.ts +16 -9
- package/systems/widgets/server/upgrade.ts +34 -0
- package/systems/widgets/shared/args.ts +137 -0
- package/systems/widgets/shared/charts.ts +243 -0
- package/systems/widgets/shared/index.ts +12 -3
- package/{packages/sdk/src → systems/widgets/shared}/relative-dates.ts +2 -1
- package/systems/widgets/shared/spec.ts +208 -0
- package/{packages/sdk/src → systems/widgets/shared}/widget-check.ts +7 -9
- package/{packages/sdk/src → systems/widgets/shared}/widget-schema.ts +4 -4
- package/packages/core/src/remote-auth.ts +0 -111
- package/packages/core/src/widgets.ts +0 -427
- package/packages/web/dist/assets/AdminLayout-B6Jrc_4W.js +0 -2
- package/packages/web/dist/assets/ApiServiceForm-BxprSaAq.css +0 -1
- package/packages/web/dist/assets/ApiServiceForm-CuuQgOJc.js +0 -2
- package/packages/web/dist/assets/ApiServiceView-7bTHSO_Z.js +0 -2
- package/packages/web/dist/assets/ApiServiceView-BVmdRCjR.css +0 -1
- package/packages/web/dist/assets/ApiServicesView-BTLV6c8n.css +0 -1
- package/packages/web/dist/assets/ApiServicesView-BXi24n49.js +0 -2
- package/packages/web/dist/assets/ChartVisual-BnFG9aFi.css +0 -1
- package/packages/web/dist/assets/ChartVisual-C4mgw4wh.js +0 -11
- package/packages/web/dist/assets/ChatPage-CAhHE03Z.js +0 -4
- package/packages/web/dist/assets/ConfigWithCustom-D_-rY66L.js +0 -3
- package/packages/web/dist/assets/ContextItemPage-rUI3-T_L.js +0 -2
- package/packages/web/dist/assets/ContextPage-CtefzyKg.js +0 -3
- package/packages/web/dist/assets/DataTypePage-BW9fWaz8.js +0 -2
- package/packages/web/dist/assets/FnList-BCnb4kOB.css +0 -1
- package/packages/web/dist/assets/FnList-Bx6H-kux.js +0 -2
- package/packages/web/dist/assets/GraphPanel-9tztGHmu.js +0 -2
- package/packages/web/dist/assets/InjectedList-CSWqRiON.js +0 -2
- package/packages/web/dist/assets/InstanceTypes-D3rAEiE7.js +0 -2
- package/packages/web/dist/assets/InstanceView-DoH8C-1j.js +0 -2
- package/packages/web/dist/assets/LimitsView-DY2C9nYS.js +0 -2
- package/packages/web/dist/assets/McpDialog-DhOCk6_E.js +0 -2
- package/packages/web/dist/assets/McpServerForm-Cor3fI7s.js +0 -2
- package/packages/web/dist/assets/McpServerForm-DsHaf5Um.css +0 -1
- package/packages/web/dist/assets/McpServerView-7I76EznB.css +0 -1
- package/packages/web/dist/assets/McpServerView-ewXRPEmZ.js +0 -2
- package/packages/web/dist/assets/McpServersView-Dd0xmfws.js +0 -2
- package/packages/web/dist/assets/ModelsView-cMHygeiK.js +0 -2
- package/packages/web/dist/assets/PeopleView-DRfeNWK5.js +0 -2
- package/packages/web/dist/assets/RemoteAuthFields-CgiufuqQ.js +0 -2
- package/packages/web/dist/assets/RemoteAuthFields-Dm44vz2t.css +0 -1
- package/packages/web/dist/assets/ResourcesPage-BBx2u2mw.js +0 -2
- package/packages/web/dist/assets/ResultGrid-Bj-0I5HY.js +0 -2
- package/packages/web/dist/assets/ResultGrid-CuUQyTjW.css +0 -1
- package/packages/web/dist/assets/ReviewView-DZF9E1hb.js +0 -3
- package/packages/web/dist/assets/RunCard-BnrtK2Yp.js +0 -2
- package/packages/web/dist/assets/RunCard-CfyRaDLS.css +0 -1
- package/packages/web/dist/assets/ServiceRows-4WythFpF.js +0 -2
- package/packages/web/dist/assets/ServiceRows-HPQ0pN6b.css +0 -1
- package/packages/web/dist/assets/SettingsPage-BN4oSzoL.js +0 -3
- package/packages/web/dist/assets/SignInPage-Djx-M-0U.css +0 -1
- package/packages/web/dist/assets/SystemPageHost-BeZ-6N0-.css +0 -1
- package/packages/web/dist/assets/SystemPageHost-DrMrEPyh.js +0 -2
- package/packages/web/dist/assets/SystemView-Be6TBM4j.js +0 -2
- package/packages/web/dist/assets/SystemsView-DZtT3laz.js +0 -2
- package/packages/web/dist/assets/WidgetView-DQUDeFkB.css +0 -1
- package/packages/web/dist/assets/WidgetView-DX4ejNb6.js +0 -3
- package/packages/web/dist/assets/export-BwFkEtcm.js +0 -15
- package/packages/web/dist/assets/index-6ScWTFy2.js +0 -4
- package/packages/web/dist/assets/index-CEslGcrX.css +0 -1
- package/packages/web/dist/assets/problems-t1E_ovSz.js +0 -2
- package/packages/web/dist/assets/record-edits-Bfsi4lU3.js +0 -2
- package/packages/web/dist/assets/remote-config-BNQhSDzB.js +0 -2
- package/packages/web/dist/assets/routes-DV4IJpwe.js +0 -4
- package/packages/web/dist/assets/size-Bh__w5aI.js +0 -2
- package/packages/web/dist/assets/src-CT3TeFaM.js +0 -43
- package/packages/web/dist/assets/state-xfQqaQPX.js +0 -2
- package/packages/web/dist/assets/widget-host-B87MTaTn.js +0 -2
- package/packages/web/dist/assets/widgets-BBCuSS6E.js +0 -2
- package/systems/fs/context/authoring/parts/client.reference/textareaprops.md +0 -195
- package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +0 -64
- package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +0 -303
- package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +0 -627
- package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +0 -154
|
@@ -14,23 +14,23 @@ import { PAIRING_QR_MODES } from './pairing.ts';
|
|
|
14
14
|
* so the names can't drift.
|
|
15
15
|
*/
|
|
16
16
|
export const SYSTEM_ENV = {
|
|
17
|
-
hub: '
|
|
18
|
-
state: '
|
|
17
|
+
hub: 'FNLOOM_HUB',
|
|
18
|
+
state: 'FNLOOM_SYSTEM_STATE',
|
|
19
19
|
/** Which copy of the system this process is (`main` when unset); a fleet's instances each have their own. */
|
|
20
|
-
instance: '
|
|
20
|
+
instance: 'FNLOOM_INSTANCE',
|
|
21
21
|
/** The instance's own data folder, outside the package, kept across upgrades and exported with its data. */
|
|
22
|
-
data: '
|
|
22
|
+
data: 'FNLOOM_SYSTEM_DATA',
|
|
23
23
|
/** The instance's cache folder: rebuildable, never exported. */
|
|
24
|
-
cache: '
|
|
25
|
-
name: '
|
|
26
|
-
pairingToken: '
|
|
27
|
-
supervised: '
|
|
28
|
-
restartCode: '
|
|
24
|
+
cache: 'FNLOOM_SYSTEM_CACHE',
|
|
25
|
+
name: 'FNLOOM_SYSTEM_NAME',
|
|
26
|
+
pairingToken: 'FNLOOM_PAIRING_TOKEN',
|
|
27
|
+
supervised: 'FNLOOM_SUPERVISED',
|
|
28
|
+
restartCode: 'FNLOOM_RESTART_CODE',
|
|
29
29
|
/**
|
|
30
30
|
* The hub's folder of database drivers (`pg`, `tedious`, `tarn`), which it installs when a store is placed in
|
|
31
31
|
* Postgres or SQL Server: a store that opens there loads them from it when the system has none of its own.
|
|
32
32
|
*/
|
|
33
|
-
storeDrivers: '
|
|
33
|
+
storeDrivers: 'FNLOOM_STORE_DRIVERS',
|
|
34
34
|
} as const;
|
|
35
35
|
|
|
36
36
|
/** The exit code a supervised system exits with to ask the hub for a restart, unless the hub sets another. */
|
|
@@ -60,50 +60,50 @@ export function placeFolders(state: string, named: { readonly [SYSTEM_ENV.data]?
|
|
|
60
60
|
|
|
61
61
|
export const sdkEnv = env({
|
|
62
62
|
/** How often the link pings the hub; a missed pong reconnects. */
|
|
63
|
-
|
|
63
|
+
FNLOOM_LINK_HEARTBEAT: z.number().int().min(1_000).default(15_000),
|
|
64
64
|
/** How long to wait for a pong before reconnecting. */
|
|
65
|
-
|
|
65
|
+
FNLOOM_LINK_HEARTBEAT_TIMEOUT: z.number().int().min(500).default(10_000),
|
|
66
66
|
/** First reconnect delay; it doubles up to the max. */
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
FNLOOM_LINK_BACKOFF: z.number().int().min(10).default(500),
|
|
68
|
+
FNLOOM_LINK_BACKOFF_MAX: z.number().int().min(100).default(30_000),
|
|
69
69
|
/** Largest frame and chunk assumed until the hub's welcome sets its own limits. */
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
FNLOOM_LINK_MAX_FRAME: z.number().int().min(1_024).default(1_000_000),
|
|
71
|
+
FNLOOM_LINK_MAX_CHUNK: z.number().int().min(1_024).default(256_000),
|
|
72
72
|
/** How long without a connection before the system logs that the hub is unreachable; `ServeOptions.connectTimeout` overrides it. */
|
|
73
|
-
|
|
74
|
-
/** How long to wait before saying hello again when the hub is limiting auto-pair attempts (its window is
|
|
75
|
-
|
|
73
|
+
FNLOOM_CONNECT_TIMEOUT: z.number().int().min(100).default(10_000),
|
|
74
|
+
/** How long to wait before saying hello again when the hub is limiting auto-pair attempts (its window is FNLOOM_AUTO_PAIR_WINDOW). */
|
|
75
|
+
FNLOOM_AUTO_PAIR_RETRY: z.number().int().min(1_000).default(60_000),
|
|
76
76
|
/** How long a call through the MCP face may run. */
|
|
77
|
-
|
|
77
|
+
FNLOOM_MCP_TIMEOUT: z.number().int().min(1_000).default(600_000),
|
|
78
78
|
/** The largest request body the MCP face accepts over HTTP, in bytes. */
|
|
79
|
-
|
|
79
|
+
FNLOOM_MCP_MAX_BODY: z.number().int().min(1_024).default(1_048_576),
|
|
80
80
|
/** Outcomes kept in the journal, so a run the hub sends again after a reconnect isn't run twice. */
|
|
81
|
-
|
|
81
|
+
FNLOOM_JOURNAL_SIZE: z.number().int().min(10).default(2_000),
|
|
82
82
|
/** Tries for a session state update when other writes keep getting in first. */
|
|
83
|
-
|
|
83
|
+
FNLOOM_STATE_RETRIES: z.number().int().min(1).default(8),
|
|
84
84
|
/** Config versions kept, so a run keeps the value it started with. */
|
|
85
|
-
|
|
85
|
+
FNLOOM_CONFIG_VERSIONS: z.number().int().min(1).default(8),
|
|
86
86
|
/** Largest resource text sent inline; longer text is served by content ref. */
|
|
87
|
-
|
|
87
|
+
FNLOOM_INLINE_TEXT: z.number().int().min(1_024).default(256_000),
|
|
88
88
|
/** Tokens (about four characters each) of rows a result block shows the model; the person always sees them all. */
|
|
89
|
-
|
|
89
|
+
FNLOOM_RESULT_SAMPLE_TOKENS: z.number().int().min(0).default(1_500),
|
|
90
90
|
/** The most characters of one text cell in a result block's sample; longer text is cut. */
|
|
91
|
-
|
|
91
|
+
FNLOOM_RESULT_CELL_CHARS: z.number().int().min(20).default(300),
|
|
92
92
|
/** Bytes of content kept for the hub to fetch by ref. */
|
|
93
|
-
|
|
93
|
+
FNLOOM_CONTENT_CACHE: z.number().int().min(1_024).default(64_000_000),
|
|
94
94
|
/** Watch the system's context folder and send each change to the hub as it is saved (for development). */
|
|
95
|
-
|
|
95
|
+
FNLOOM_CONTEXT_WATCH: z.boolean().default(false),
|
|
96
96
|
/** How long the context folder must be quiet before a change is read and sent. */
|
|
97
|
-
|
|
97
|
+
FNLOOM_CONTEXT_DEBOUNCE: z.number().int().min(10).default(250),
|
|
98
98
|
/** For a system that supervises others (fs's hosted systems): the longest wait between restarts after crashes. */
|
|
99
|
-
|
|
99
|
+
FNLOOM_SUPERVISE_BACKOFF_MAX: z.number().int().min(100).default(300_000),
|
|
100
100
|
/** For a system that supervises others: how many characters of a child's output are kept for its exit report. */
|
|
101
|
-
|
|
101
|
+
FNLOOM_SUPERVISE_OUTPUT_TAIL: z.number().int().min(256).default(8_192),
|
|
102
102
|
/**
|
|
103
103
|
* How long a call waits for the system's store to be open and migrated, and for its `started` lifecycle to finish,
|
|
104
104
|
* before it is refused.
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
FNLOOM_STORE_HOLD: z.number().int().min(0).default(STORE_HOLD),
|
|
107
107
|
/** For a store in Postgres or SQL Server: the folder the hub installed their drivers in, tried when the system has none. */
|
|
108
108
|
[SYSTEM_ENV.storeDrivers]: z.string().min(1).optional(),
|
|
109
109
|
/** Which copy of the system this process is: `main` unless it is one of a fleet. */
|
|
@@ -114,9 +114,9 @@ export const sdkEnv = env({
|
|
|
114
114
|
/** The exit code that asks a supervising hub for a restart. */
|
|
115
115
|
[SYSTEM_ENV.restartCode]: z.number().int().min(1).max(255).default(RESTART_CODE),
|
|
116
116
|
/** When a waiting system prints its pairing link as a QR code: on a terminal (`auto`), `always`, or `never` (logged only). */
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
FNLOOM_PAIRING_QR: z.enum(PAIRING_QR_MODES).default('auto'),
|
|
118
|
+
FNLOOM_LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
|
|
119
|
+
FNLOOM_LOG_JSON: z.boolean().default(false),
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
/** The parsed SDK tunables. */
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The hub's widget fns in memory, for tests of systems that draw from tables (the widgets system, a system with its
|
|
3
|
-
* own visual): `hub/read_table` answers from the tables a test registers per fn, `hub/visuals` from `visuals` (
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* own visual): `hub/read_table` answers from the tables a test registers per fn, `hub/visuals` from `visuals` (the
|
|
4
|
+
* table and value cards, then the system's own contributions, which `testHub` adds, then whatever a test adds), and
|
|
5
|
+
* `hub/row_actions` derives the menu from the row fns a test registers per row type with the SDK's own
|
|
6
|
+
* `rowActionOptions`, as the hub does. `FakeHub` holds one as `widgets`.
|
|
6
7
|
*/
|
|
7
8
|
import { Json, ReadTableArgs, ResultTable, RowActionsQuery, SystemName, type ContributionView, type QualifiedName, type RunSettled } from '@harness/core';
|
|
8
9
|
import { hub } from '../hub.ts';
|
|
9
|
-
import { BUILT_IN_CONTRIBUTIONS,
|
|
10
|
+
import { BUILT_IN_CONTRIBUTIONS, rowActionOptions, type RowFn } from '../widgets.ts';
|
|
10
11
|
|
|
11
12
|
/** The hub fns this fake answers, by the hub contract's names. */
|
|
12
13
|
export const HUB_WIDGET_FNS = { readTable: hub.fns.read_table.name, visuals: hub.fns.visuals.name, rowActions: hub.fns.row_actions.name } as const;
|
|
@@ -22,7 +23,7 @@ interface HubCall {
|
|
|
22
23
|
|
|
23
24
|
/** The hub's widget fns in memory. */
|
|
24
25
|
export class FakeHubWidgets {
|
|
25
|
-
/** What `hub/visuals` answers: the
|
|
26
|
+
/** What `hub/visuals` answers: the table and value cards as the hub contributes them; `testHub` pushes the system's own. */
|
|
26
27
|
readonly visuals: ContributionView[] = BUILT_IN_CONTRIBUTIONS.map((entry) => ({ ...entry, system: SystemName.parse('hub') }));
|
|
27
28
|
/** Every `hub/read_table` call, in order: the fn and the args it ran with. */
|
|
28
29
|
readonly reads: ReadTableArgs[] = [];
|
|
@@ -47,7 +48,7 @@ export class FakeHubWidgets {
|
|
|
47
48
|
case HUB_WIDGET_FNS.visuals: return { status: 'done', result: Json.parse(this.visuals) };
|
|
48
49
|
case HUB_WIDGET_FNS.rowActions: {
|
|
49
50
|
const query = RowActionsQuery.parse(call.args);
|
|
50
|
-
return { status: 'done', result: Json.parse(
|
|
51
|
+
return { status: 'done', result: Json.parse(rowActionOptions(query.types.flatMap((type) => this.#rowFns.get(type) ?? []), query.narrow)) };
|
|
51
52
|
}
|
|
52
53
|
default: return undefined;
|
|
53
54
|
}
|
|
@@ -83,7 +83,7 @@ export interface LinkHostDeps {
|
|
|
83
83
|
readonly env?: SdkEnv;
|
|
84
84
|
/** The process logger. Default: console, plus the hub while connected. */
|
|
85
85
|
readonly logger?: (sink: (line: LogLine) => void) => Logger;
|
|
86
|
-
/** Shows a pending pairing. Default: a QR code on a terminal (`
|
|
86
|
+
/** Shows a pending pairing. Default: a QR code on a terminal (`FNLOOM_PAIRING_QR`), else a log line. */
|
|
87
87
|
readonly pairing?: PairingDisplay;
|
|
88
88
|
/** Makes the instance's data and cache folders before the system starts. Default: `mkdir -p` each. */
|
|
89
89
|
readonly folders?: (dirs: readonly string[]) => Promise<void>;
|
|
@@ -112,7 +112,7 @@ export interface LoggedHost {
|
|
|
112
112
|
export function loggedHost(name: string, deps: Omit<LinkHostDeps, 'logger'> = {}, output: 'stdout' | 'stderr' = 'stdout'): LoggedHost {
|
|
113
113
|
const env = deps.env ?? sdkEnv.parse();
|
|
114
114
|
let toHub: (line: LogLine) => void = () => undefined;
|
|
115
|
-
const logger = systemLogger({ level: env.
|
|
115
|
+
const logger = systemLogger({ level: env.FNLOOM_LOG_LEVEL, json: env.FNLOOM_LOG_JSON, sink: (line) => { toHub(line); }, console: output });
|
|
116
116
|
const host = new LinkHost({ ...deps, env, logger: (sink) => { toHub = sink; return logger; } });
|
|
117
117
|
return { host, log: new ScopedLog(logger, { system: name }) };
|
|
118
118
|
}
|
|
@@ -163,7 +163,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
163
163
|
readonly #log: ScopedLog;
|
|
164
164
|
/** This process start, so the hub tells a restart from a reconnect. */
|
|
165
165
|
readonly #boot = randomUUID();
|
|
166
|
-
/** The instance this is: asked for from `
|
|
166
|
+
/** The instance this is: asked for from `FNLOOM_INSTANCE`, then the name the hub's welcome gives it. */
|
|
167
167
|
#instance: InstanceName;
|
|
168
168
|
#pairingDisplay: PairingDisplay | undefined;
|
|
169
169
|
readonly #stop = new AbortController();
|
|
@@ -215,7 +215,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
215
215
|
this.#link = linkUrl(options.hub);
|
|
216
216
|
this.#deps = deps;
|
|
217
217
|
this.#env = deps.env ?? sdkEnv.parse();
|
|
218
|
-
this.#limits = LinkLimits.parse({ maxFrame: this.#env.
|
|
218
|
+
this.#limits = LinkLimits.parse({ maxFrame: this.#env.FNLOOM_LINK_MAX_FRAME, maxChunk: this.#env.FNLOOM_LINK_MAX_CHUNK, heartbeat: this.#env.FNLOOM_LINK_HEARTBEAT });
|
|
219
219
|
this.#pairingToken = options.pairingToken;
|
|
220
220
|
this.#instance = this.#env[SYSTEM_ENV.instance];
|
|
221
221
|
const sink = (line: LogLine): void => {
|
|
@@ -223,8 +223,8 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
223
223
|
if (hub !== undefined) { hub.call('log', line).catch(() => undefined); }
|
|
224
224
|
};
|
|
225
225
|
this.#logger = deps.logger?.(sink) ?? systemLogger({
|
|
226
|
-
level: this.#env.
|
|
227
|
-
json: this.#env.
|
|
226
|
+
level: this.#env.FNLOOM_LOG_LEVEL,
|
|
227
|
+
json: this.#env.FNLOOM_LOG_JSON,
|
|
228
228
|
sink,
|
|
229
229
|
console: options.mcp !== undefined && 'stdio' in options.mcp ? 'stderr' : 'stdout',
|
|
230
230
|
});
|
|
@@ -232,12 +232,12 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
232
232
|
this.#table = new SystemTable(contract, table);
|
|
233
233
|
this.#lifecycle = table.lifecycle ?? {};
|
|
234
234
|
// calls that run the system's code wait for `started` to finish: only a system that has one
|
|
235
|
-
this.#startGate = this.#lifecycle.started === undefined ? undefined : new StartGate({ system: contract.name, hold: this.#env.
|
|
236
|
-
this.#config =new ConfigStore(configTypeOf(contract.defs), this.#env.
|
|
235
|
+
this.#startGate = this.#lifecycle.started === undefined ? undefined : new StartGate({ system: contract.name, hold: this.#env.FNLOOM_STORE_HOLD });
|
|
236
|
+
this.#config =new ConfigStore(configTypeOf(contract.defs), this.#env.FNLOOM_CONFIG_VERSIONS);
|
|
237
237
|
this.#keys = deps.keys?.(options.state) ?? new FileKeyStore(options.state);
|
|
238
|
-
this.#journal = deps.journal?.(options.state, this.#env.
|
|
239
|
-
this.#process = deps.process ?? new NodeProcess({ supervised: this.#env.
|
|
240
|
-
this.#content = new LocalContent(this.#env.
|
|
238
|
+
this.#journal = deps.journal?.(options.state, this.#env.FNLOOM_JOURNAL_SIZE) ?? new FileJournal(options.state, this.#env.FNLOOM_JOURNAL_SIZE);
|
|
239
|
+
this.#process = deps.process ?? new NodeProcess({ supervised: this.#env.FNLOOM_SUPERVISED, restartCode: this.#env.FNLOOM_RESTART_CODE });
|
|
240
|
+
this.#content = new LocalContent(this.#env.FNLOOM_CONTENT_CACHE);
|
|
241
241
|
if (contract.defs.store !== undefined && options.store === undefined) {
|
|
242
242
|
throw new Error(`${contract.name} declares a store, so serve needs its migrations: serve(contract, impl, { ..., store: { migrations } }).`);
|
|
243
243
|
}
|
|
@@ -276,7 +276,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
276
276
|
if (decl !== undefined) {
|
|
277
277
|
this.#store = new StoreKeeper({
|
|
278
278
|
system: this.name, decl, migrations: this.#options.store?.migrations ?? [], dataDir: place.dataDir, hub: hubAccess, log: this.#log,
|
|
279
|
-
now: this.#deps.now ?? Date.now, signal: this.#stop.signal, hold: this.#env.
|
|
279
|
+
now: this.#deps.now ?? Date.now, signal: this.#stop.signal, hold: this.#env.FNLOOM_STORE_HOLD, drivers: this.#env[SYSTEM_ENV.storeDrivers],
|
|
280
280
|
...(this.#deps.storeConnect === undefined ? {} : { connectLocal: this.#deps.storeConnect }),
|
|
281
281
|
});
|
|
282
282
|
}
|
|
@@ -292,7 +292,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
292
292
|
fetch: this.#options.fetch ?? globalThis.fetch,
|
|
293
293
|
log: this.#log,
|
|
294
294
|
place,
|
|
295
|
-
stateRetries: this.#env.
|
|
295
|
+
stateRetries: this.#env.FNLOOM_STATE_RETRIES,
|
|
296
296
|
now: this.#deps.now ?? Date.now,
|
|
297
297
|
config: (version) => this.#config.at(version),
|
|
298
298
|
currentConfig: () => this.#config.current?.version,
|
|
@@ -306,7 +306,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
306
306
|
config: this.#config,
|
|
307
307
|
content: this.#content,
|
|
308
308
|
signal: this.#stop.signal,
|
|
309
|
-
inlineText: this.#env.
|
|
309
|
+
inlineText: this.#env.FNLOOM_INLINE_TEXT,
|
|
310
310
|
...(store === undefined ? {} : { storeReady: (signal?: AbortSignal) => store.whenReady(signal), storeCheckpoint: () => store.checkpoint() }),
|
|
311
311
|
...(mover === undefined ? {} : { storeMover: mover }),
|
|
312
312
|
...(this.#startGate === undefined ? {} : { startGate: this.#startGate }),
|
|
@@ -319,10 +319,10 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
319
319
|
},
|
|
320
320
|
});
|
|
321
321
|
const transport = this.#deps.transport ?? new WsLinkTransport({
|
|
322
|
-
heartbeat: this.#env.
|
|
323
|
-
heartbeatTimeout: this.#env.
|
|
324
|
-
backoff: this.#env.
|
|
325
|
-
backoffMax: this.#env.
|
|
322
|
+
heartbeat: this.#env.FNLOOM_LINK_HEARTBEAT,
|
|
323
|
+
heartbeatTimeout: this.#env.FNLOOM_LINK_HEARTBEAT_TIMEOUT,
|
|
324
|
+
backoff: this.#env.FNLOOM_LINK_BACKOFF,
|
|
325
|
+
backoffMax: this.#env.FNLOOM_LINK_BACKOFF_MAX,
|
|
326
326
|
});
|
|
327
327
|
const socket = transport.open(this.#link);
|
|
328
328
|
this.#socket = socket;
|
|
@@ -338,7 +338,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
338
338
|
await this.#lifecycleRunner.up();
|
|
339
339
|
this.#watchReachable(socket.state);
|
|
340
340
|
if (this.#options.mcp !== undefined) {
|
|
341
|
-
this.#mcp = new McpFace(this.#table, runEnv, this.#version, { timeout: this.#env.
|
|
341
|
+
this.#mcp = new McpFace(this.#table, runEnv, this.#version, { timeout: this.#env.FNLOOM_MCP_TIMEOUT, maxBody: this.#env.FNLOOM_MCP_MAX_BODY }, this.#runtime);
|
|
342
342
|
await this.#mcp.serve(this.#options.mcp);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -548,8 +548,8 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
550
|
if (error instanceof ApiError && error.code === 'AUTO_PAIR_LIMITED') {
|
|
551
|
-
this.#log.warn('system.auto-pair.limited', { instance: this.#instance, retryIn: this.#env.
|
|
552
|
-
setTimeout(() => { if (connection === this.#connection && !this.#stop.signal.aborted) { void this.#handshake(connection); } }, this.#env.
|
|
551
|
+
this.#log.warn('system.auto-pair.limited', { instance: this.#instance, retryIn: this.#env.FNLOOM_AUTO_PAIR_RETRY });
|
|
552
|
+
setTimeout(() => { if (connection === this.#connection && !this.#stop.signal.aborted) { void this.#handshake(connection); } }, this.#env.FNLOOM_AUTO_PAIR_RETRY).unref();
|
|
553
553
|
return;
|
|
554
554
|
}
|
|
555
555
|
this.#log.error('system.handshake-failed', { error: messageOf(error) });
|
|
@@ -695,7 +695,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
695
695
|
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
696
696
|
|
|
697
697
|
/**
|
|
698
|
-
* Which instance this is and its folders, made if missing: the hub's (`
|
|
698
|
+
* Which instance this is and its folders, made if missing: the hub's (`FNLOOM_SYSTEM_DATA` / `_CACHE`) for what it
|
|
699
699
|
* installs, else `data` and `cache` in the state folder. `instance` reads the current name, which the welcome sets.
|
|
700
700
|
*/
|
|
701
701
|
async #place(): Promise<SystemPlace> {
|
|
@@ -720,7 +720,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
720
720
|
} catch (error) {
|
|
721
721
|
this.#log.warn('system.pairing-info-failed', { error: messageOf(error) });
|
|
722
722
|
}
|
|
723
|
-
this.#pairingDisplay ??= this.#deps.pairing ?? pairingDisplayFor(this.#env.
|
|
723
|
+
this.#pairingDisplay ??= this.#deps.pairing ?? pairingDisplayFor(this.#env.FNLOOM_PAIRING_QR, {
|
|
724
724
|
log: this.#log,
|
|
725
725
|
tty: process.stdout.isTTY,
|
|
726
726
|
write: (text) => { process.stdout.write(`${text}\n`); },
|
|
@@ -751,7 +751,7 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
751
751
|
return;
|
|
752
752
|
}
|
|
753
753
|
if (this.#unreachable !== undefined) { return; }
|
|
754
|
-
const after = this.#options.connectTimeout ?? this.#env.
|
|
754
|
+
const after = this.#options.connectTimeout ?? this.#env.FNLOOM_CONNECT_TIMEOUT;
|
|
755
755
|
this.#unreachable = setTimeout(() => {
|
|
756
756
|
if (this.#socket?.state !== 'open' && !this.#stop.signal.aborted) { this.#log.warn('system.hub-unreachable', { hub: this.#link, after }); }
|
|
757
757
|
}, after);
|
|
@@ -777,11 +777,11 @@ class LinkedSystem<N extends string, C extends ContractShape> implements Running
|
|
|
777
777
|
const folder = await readContextFolder(dir);
|
|
778
778
|
if (folder.problems.length > 0) { throw new ContextFolderError(folder.problems); }
|
|
779
779
|
if (folder.files.length > 0) { this.#table.patch({ upsert: { context: folder.files.map((file) => file.decl) } }); }
|
|
780
|
-
if (!this.#env.
|
|
780
|
+
if (!this.#env.FNLOOM_CONTEXT_WATCH) { return; }
|
|
781
781
|
this.#unwatchContext = watchContextFolder(dir, folder.files.map((file) => file.decl), (change) => this.patch(change), {
|
|
782
|
-
debounce: this.#env.
|
|
783
|
-
retry: this.#env.
|
|
784
|
-
retryMax: this.#env.
|
|
782
|
+
debounce: this.#env.FNLOOM_CONTEXT_DEBOUNCE,
|
|
783
|
+
retry: this.#env.FNLOOM_LINK_BACKOFF,
|
|
784
|
+
retryMax: this.#env.FNLOOM_LINK_BACKOFF_MAX,
|
|
785
785
|
events: {
|
|
786
786
|
problems: (problems) => { for (const problem of problems) { this.#log.warn('context.problem', { problem: formatContextProblem(problem) }); } },
|
|
787
787
|
sent: (change) => { this.#log.info('context.sent', { upserted: change.upsert?.context?.length ?? 0, removed: change.remove?.context?.length ?? 0 }); },
|
|
@@ -57,7 +57,7 @@ export interface ServeOptions {
|
|
|
57
57
|
/**
|
|
58
58
|
* The system's context folder (markdown files with YAML headers, `context-files.ts`), sent as its context; `false`
|
|
59
59
|
* for none. Default: `context/` beside its `system.json`, when there is one. A folder with problems stops the start;
|
|
60
|
-
* with `
|
|
60
|
+
* with `FNLOOM_CONTEXT_WATCH` its changes go to the hub live.
|
|
61
61
|
*/
|
|
62
62
|
context?: string | false;
|
|
63
63
|
/**
|
|
@@ -68,7 +68,7 @@ export interface ServeOptions {
|
|
|
68
68
|
store?: StoreServeOptions;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
/** Where the MCP face listens: stdin/stdout, or MCP Streamable HTTP on a port (any path; body limit `
|
|
71
|
+
/** Where the MCP face listens: stdin/stdout, or MCP Streamable HTTP on a port (any path; body limit `FNLOOM_MCP_MAX_BODY`). */
|
|
72
72
|
export type McpServe = { stdio: true } | { http: { port: number; host?: string } };
|
|
73
73
|
|
|
74
74
|
|
|
@@ -9,14 +9,14 @@ export const liveEnv = env({
|
|
|
9
9
|
/** The OpenRouter key; live tests skip without it. */
|
|
10
10
|
OPENROUTER_API_KEY: z.string().optional(),
|
|
11
11
|
/** The model tried first: GPT-6 Luna, cheap and paid (the owner's choice, 2026-11-13, once the free models' daily limit ran out). */
|
|
12
|
-
|
|
12
|
+
FNLOOM_LIVE_MODEL: z.string().default('openai/gpt-6-luna'),
|
|
13
13
|
/** Models tried, in order, when the first is busy or rate limited (none by default). */
|
|
14
|
-
|
|
14
|
+
FNLOOM_LIVE_FALLBACKS: z.string().default(''),
|
|
15
15
|
/** The EmbeddingGemma service the embedder tests call. */
|
|
16
|
-
|
|
16
|
+
FNLOOM_LIVE_EMBEDDER_URL: z.string().default('http://127.0.0.1:8760'),
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
/** The models to try, first choice first. */
|
|
20
20
|
export function liveModels(): string[] {
|
|
21
|
-
return [liveEnv.get('
|
|
21
|
+
return [liveEnv.get('FNLOOM_LIVE_MODEL'), ...liveEnv.get('FNLOOM_LIVE_FALLBACKS').split(',').map((m) => m.trim()).filter((m) => m !== '')];
|
|
22
22
|
}
|
|
@@ -32,7 +32,7 @@ export const llmWireEnv = env({
|
|
|
32
32
|
* took 10 to 20 ms of the hub's event loop each time (iteration 1, rep 3); the rebuilt bound schema is kept instead
|
|
33
33
|
* (and with it the renderings it memoizes per model dialect).
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
FNLOOM_WIRE_SCHEMA_CACHE: z.coerce.number().int().min(0).default(64),
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
/** How `LlmWire` treats what the wire can't carry. */
|
|
@@ -265,16 +265,65 @@ export function isObjectSchema(schema: Bound<any>): schema is Bound<object> {
|
|
|
265
265
|
return node !== undefined && (node.kind === 'object' || node.kind === 'record' || node.kind === 'intersection');
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
/**
|
|
268
|
+
/** A `$defs` name every model's JSON schema reader resolves: no `/` or `~`, which a `$ref` must escape. */
|
|
269
|
+
const SAFE_DEF = /^[A-Za-z0-9_.-]+$/;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* A JSON schema whose `$defs` names are safe in a `$ref` as they are. A def named after a qualified type
|
|
273
|
+
* (`api/HttpHeader`) needs a JSON-pointer escaped ref (`#/$defs/api~1HttpHeader`), which OpenAI's own endpoint refuses
|
|
274
|
+
* ("reference to component ... which was not found") while other providers of the same model read it. `@aeye/schema`
|
|
275
|
+
* (0.11.2 on) emits pointer-safe `$defs` keys itself, so schemas a system renders already arrive safe; this still
|
|
276
|
+
* covers raw wire JSON written some other way (an older SDK, a hand-made schema). Renamed defs keep their schemas;
|
|
277
|
+
* only the names (which no model or code sees) change, and each ref follows its def.
|
|
278
|
+
*/
|
|
279
|
+
export function pointerSafeDefs(schema: Record<string, Json>): Record<string, Json> {
|
|
280
|
+
const defs = schema['$defs'];
|
|
281
|
+
if (typeof defs !== 'object' || defs === null || Array.isArray(defs)) return schema;
|
|
282
|
+
const names = Object.keys(defs);
|
|
283
|
+
if (names.every((name) => SAFE_DEF.test(name))) return schema;
|
|
284
|
+
const taken = new Set(names.filter((name) => SAFE_DEF.test(name)));
|
|
285
|
+
const renamed = new Map<string, string>();
|
|
286
|
+
for (const name of names) {
|
|
287
|
+
if (SAFE_DEF.test(name)) continue;
|
|
288
|
+
const base = name.replace(/[^A-Za-z0-9_.-]/g, '_');
|
|
289
|
+
let safe = base;
|
|
290
|
+
for (let n = 2; taken.has(safe); n += 1) safe = `${base}_${String(n)}`;
|
|
291
|
+
taken.add(safe);
|
|
292
|
+
renamed.set(name, safe);
|
|
293
|
+
}
|
|
294
|
+
const unescape = (segment: string) => segment.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
295
|
+
const walk = (value: Json): Json => {
|
|
296
|
+
if (Array.isArray(value)) return value.map(walk);
|
|
297
|
+
if (typeof value !== 'object' || value === null) return value;
|
|
298
|
+
const out: Record<string, Json> = {};
|
|
299
|
+
for (const [key, child] of Object.entries(value)) {
|
|
300
|
+
if (key === '$ref' && typeof child === 'string' && child.startsWith('#/$defs/')) {
|
|
301
|
+
const [segment = '', ...rest] = child.slice('#/$defs/'.length).split('/');
|
|
302
|
+
const target = renamed.get(unescape(segment));
|
|
303
|
+
out[key] = target === undefined ? child : ['#/$defs', target, ...rest].join('/');
|
|
304
|
+
} else {
|
|
305
|
+
out[key] = walk(child);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
return out;
|
|
309
|
+
};
|
|
310
|
+
const walked = walk(schema);
|
|
311
|
+
if (typeof walked !== 'object' || walked === null || Array.isArray(walked)) return schema;
|
|
312
|
+
const safeDefs = walked['$defs'];
|
|
313
|
+
if (typeof safeDefs !== 'object' || safeDefs === null || Array.isArray(safeDefs)) return walked;
|
|
314
|
+
return { ...walked, $defs: Object.fromEntries(Object.entries(safeDefs).map(([name, def]) => [renamed.get(name) ?? name, def])) };
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/** Schemas rebuilt from the wire by their JSON, least recently used first (`FNLOOM_WIRE_SCHEMA_CACHE`). */
|
|
269
318
|
const rebuilt = new Map<string, Bound<unknown>>();
|
|
270
319
|
|
|
271
320
|
/**
|
|
272
321
|
* A (lenient) JSON schema from the wire rebuilt as a bound `a` schema (`a.fromJSONSchema`), for the provider to plan
|
|
273
|
-
* for its model. The same JSON gives the same bound (kept, `
|
|
322
|
+
* for its model. The same JSON gives the same bound (kept, `FNLOOM_WIRE_SCHEMA_CACHE`), so a schema sent every round
|
|
274
323
|
* is rebuilt once and rendered once per model dialect (a bound memoizes its renderings).
|
|
275
324
|
*/
|
|
276
325
|
export function schemaFromWire(schema: Json): Bound<unknown> {
|
|
277
|
-
const size = llmWireEnv.get('
|
|
326
|
+
const size = llmWireEnv.get('FNLOOM_WIRE_SCHEMA_CACHE');
|
|
278
327
|
const key = size === 0 ? undefined : JSON.stringify(schema);
|
|
279
328
|
const known = key === undefined ? undefined : rebuilt.get(key);
|
|
280
329
|
if (key !== undefined && known !== undefined) {
|
|
@@ -283,7 +332,7 @@ export function schemaFromWire(schema: Json): Bound<unknown> {
|
|
|
283
332
|
return known;
|
|
284
333
|
}
|
|
285
334
|
if (typeof schema !== 'object' || schema === null || Array.isArray(schema)) { throw new Error('Expected a JSON schema object.'); }
|
|
286
|
-
const made = a.fromJSONSchema(schema).bind();
|
|
335
|
+
const made = a.fromJSONSchema(pointerSafeDefs(schema)).bind();
|
|
287
336
|
if (key !== undefined) {
|
|
288
337
|
rebuilt.set(key, made);
|
|
289
338
|
while (rebuilt.size > size) { const oldest = rebuilt.keys().next().value; if (oldest === undefined) break; rebuilt.delete(oldest); }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Showing a pairing to the person who approves it. While a new system waits for approval the SDK hands the hub's
|
|
3
3
|
* pairing reply to a `PairingDisplay`: `TerminalPairingDisplay` prints a QR code of the pairing link (scan it with a
|
|
4
4
|
* phone, sign in, set the config and pair) with the code in large letters; `LogPairingDisplay` only logs them, for
|
|
5
|
-
* processes nobody watches. Which one a host uses follows `
|
|
5
|
+
* processes nobody watches. Which one a host uses follows `FNLOOM_PAIRING_QR`.
|
|
6
6
|
*/
|
|
7
7
|
import type { InstanceName, Timestamp } from '@harness/core';
|
|
8
8
|
import QRCode from 'qrcode';
|
|
@@ -17,9 +17,9 @@ export interface ResultBlockOptions {
|
|
|
17
17
|
readonly args?: Readonly<Record<string, Json>>;
|
|
18
18
|
/** What the person sees the rows as (default `a table`), for the sentence the model reads. */
|
|
19
19
|
readonly visual?: string;
|
|
20
|
-
/** The sample's token budget. Default: `
|
|
20
|
+
/** The sample's token budget. Default: `FNLOOM_RESULT_SAMPLE_TOKENS`. */
|
|
21
21
|
readonly budget?: number;
|
|
22
|
-
/** The most characters of one text cell in the sample. Default: `
|
|
22
|
+
/** The most characters of one text cell in the sample. Default: `FNLOOM_RESULT_CELL_CHARS`. */
|
|
23
23
|
readonly cellChars?: number;
|
|
24
24
|
/** Whether a person is watching the run (`RunInfo.watched === true`), so the rows are shown to them. Default true. */
|
|
25
25
|
readonly watched?: boolean;
|
|
@@ -48,8 +48,8 @@ export function resultBlock(table: ResultTable, options: ResultBlockOptions): Re
|
|
|
48
48
|
/** The result block for rows shown to the person. */
|
|
49
49
|
function shownBlock(table: ResultTable, options: ResultBlockOptions): ResultBlock {
|
|
50
50
|
const tunables = options.budget === undefined || options.cellChars === undefined ? sdkEnv.parse() : undefined;
|
|
51
|
-
const budget = options.budget ?? tunables?.
|
|
52
|
-
const cellChars = options.cellChars ?? tunables?.
|
|
51
|
+
const budget = options.budget ?? tunables?.FNLOOM_RESULT_SAMPLE_TOKENS ?? 0;
|
|
52
|
+
const cellChars = options.cellChars ?? tunables?.FNLOOM_RESULT_CELL_CHARS ?? 0;
|
|
53
53
|
const rowCount = table.rows.length;
|
|
54
54
|
const { sample, cut } = sampleOf(table, budget, cellChars);
|
|
55
55
|
const nextPage = nextPageOf(table, options);
|
|
@@ -146,7 +146,7 @@ export function guardNetwork(options: GuardOptions): void {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/** The variable a supervisor names a child's allowed endpoints in (`endpointsText`), for `hosted-network-guard.ts`. */
|
|
149
|
-
export const NETWORK_ALLOW_VAR = '
|
|
149
|
+
export const NETWORK_ALLOW_VAR = 'FNLOOM_NETWORK_ALLOW';
|
|
150
150
|
|
|
151
151
|
/** The start of the line a guarded system prints for a refused attempt, followed by what was asked for. */
|
|
152
152
|
const NETWORK_REFUSED = 'harness.network.refused ';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* that run the system's own code wait, so nothing is answered from state `started` hasn't set up yet. The store gate
|
|
4
4
|
* (`StoreKeeper.whenReady`) comes first; this one follows it. A system without `started` has no gate.
|
|
5
5
|
*
|
|
6
|
-
* - Every wait is bounded by the hold (`
|
|
6
|
+
* - Every wait is bounded by the hold (`FNLOOM_STORE_HOLD`): once it runs out the call is refused, "<system> is still
|
|
7
7
|
* starting" (`SYSTEM_STARTING`), as a store that isn't ready refuses.
|
|
8
8
|
* - A `started` that throws refuses what waits and what comes after with why (`SYSTEM_START_FAILED`), until a later
|
|
9
9
|
* start (a reconnect, or a new config) succeeds.
|
|
@@ -32,7 +32,7 @@ type Verdict = 'go' | 'refuse' | 'wait';
|
|
|
32
32
|
/** What the gate is built from. */
|
|
33
33
|
export interface StartGateParts {
|
|
34
34
|
readonly system: string;
|
|
35
|
-
/** How long a call waits for the start before it is refused (`
|
|
35
|
+
/** How long a call waits for the start before it is refused (`FNLOOM_STORE_HOLD`). */
|
|
36
36
|
readonly hold: number;
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* server bundle: a system with a store lists the ones it can use in its `system.json` `server.external`
|
|
12
12
|
* (`STORE_DRIVER_MODULES`), and the installer fetches them beside a zip's bundle. The base package ships without
|
|
13
13
|
* `pg`, `tedious` and `tarn`: a system that runs from its source folder gets them from the hub, which installs them
|
|
14
|
-
* into its drivers folder when the store is placed in Postgres or SQL Server (`
|
|
14
|
+
* into its drivers folder when the store is placed in Postgres or SQL Server (`FNLOOM_STORE_DRIVERS`), and `load`
|
|
15
15
|
* looks there when the system has none of its own.
|
|
16
16
|
*/
|
|
17
17
|
import { randomBytes } from 'node:crypto';
|
|
@@ -360,7 +360,7 @@ async function checkVectors(db: AnyKysely, engine: ExternalEngine): Promise<void
|
|
|
360
360
|
|
|
361
361
|
/**
|
|
362
362
|
* Open an external store: Postgres or SQL Server, its tables in `schema`. Its driver is the system's own, else the
|
|
363
|
-
* one in the hub's drivers folder (`drivers`, `
|
|
363
|
+
* one in the hub's drivers folder (`drivers`, `FNLOOM_STORE_DRIVERS`).
|
|
364
364
|
*/
|
|
365
365
|
export async function openExternalStore(engine: ExternalEngine, connection: string, schema: string, vectors: boolean, drivers?: string): Promise<StoreConnection> {
|
|
366
366
|
const dialect = engine === 'postgres' ? await postgresDialect(connection, drivers) : await sqlServerDialect(connection, drivers);
|
|
@@ -42,7 +42,7 @@ export interface StoreKeeperParts {
|
|
|
42
42
|
readonly now: () => number;
|
|
43
43
|
/** Aborts when the system stops. */
|
|
44
44
|
readonly signal: AbortSignal;
|
|
45
|
-
/** How long a call waits for the store before it is refused (`
|
|
45
|
+
/** How long a call waits for the store before it is refused (`FNLOOM_STORE_HOLD`). */
|
|
46
46
|
readonly hold: number;
|
|
47
47
|
/**
|
|
48
48
|
* How long after a status report the hub didn't take it is sent again (doubling each time, up to 30 s); default
|
|
@@ -56,7 +56,7 @@ export interface StoreKeeperParts {
|
|
|
56
56
|
* store in memory, or in a folder of its own. The other placements still open on the real engines.
|
|
57
57
|
*/
|
|
58
58
|
readonly connectLocal?: () => Promise<StoreConnection>;
|
|
59
|
-
/** The hub's drivers folder (`
|
|
59
|
+
/** The hub's drivers folder (`FNLOOM_STORE_DRIVERS`): a store in Postgres or SQL Server finds its driver there when the system has none. */
|
|
60
60
|
readonly drivers?: string | undefined;
|
|
61
61
|
/** How often a ready store's tables are counted again for the Storage panel (`STORE_MEASURE_EVERY`). */
|
|
62
62
|
readonly measureEvery?: number;
|
|
@@ -14,7 +14,7 @@ import { SYSTEM_ENV, sdkEnv } from './env.ts';
|
|
|
14
14
|
export const RunningStatus = z.enum(['connecting', 'pairing', 'needs-config', 'connected', 'disconnected', 'stopped']);
|
|
15
15
|
export type RunningStatus = z.infer<typeof RunningStatus>;
|
|
16
16
|
|
|
17
|
-
/** The log key a system writes its status changes under. A supervisor reads them from a child's JSON log lines (`
|
|
17
|
+
/** The log key a system writes its status changes under. A supervisor reads them from a child's JSON log lines (`FNLOOM_LOG_JSON`). */
|
|
18
18
|
export const STATUS_LOG = 'system.status';
|
|
19
19
|
|
|
20
20
|
/** A status change as a JSON log line. */
|
|
@@ -114,7 +114,7 @@ const IDENTITY_ENV: ReadonlySet<string> = new Set(Object.values(SYSTEM_ENV));
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* The harness variables a child inherits, by name: the SDK runtime tunables (`sdkEnv`: link timing, log level, ...),
|
|
117
|
-
* never the parent's instance identity. An explicit list, not a `
|
|
117
|
+
* never the parent's instance identity. An explicit list, not a `FNLOOM_` prefix, so a parent's own settings and
|
|
118
118
|
* secrets (the hub's admin password, signing and encryption keys) never reach a child.
|
|
119
119
|
*/
|
|
120
120
|
export const SHARED_ENV: readonly string[] = sdkEnv.describe().flatMap((field) => field.vars).filter((name) => !IDENTITY_ENV.has(name));
|
|
@@ -168,7 +168,7 @@ export interface NodeStarterOptions {
|
|
|
168
168
|
readonly baseEnv: Readonly<Record<string, string | undefined>>;
|
|
169
169
|
/** Node flags put first when a command runs this Node binary (the parent's loader, e.g. tsx; `permissionArgs`). */
|
|
170
170
|
readonly nodeArgs?: readonly string[] | undefined;
|
|
171
|
-
/** Characters of output kept for the exit report (`
|
|
171
|
+
/** Characters of output kept for the exit report (`FNLOOM_SUPERVISE_OUTPUT_TAIL`). */
|
|
172
172
|
readonly outputTail: number;
|
|
173
173
|
}
|
|
174
174
|
|
|
@@ -217,7 +217,7 @@ const HOUR = 3_600_000;
|
|
|
217
217
|
|
|
218
218
|
/** How `CrashPolicy` decides. */
|
|
219
219
|
export interface CrashPolicyOptions {
|
|
220
|
-
/** The longest wait between restarts (`
|
|
220
|
+
/** The longest wait between restarts (`FNLOOM_SUPERVISE_BACKOFF_MAX`). */
|
|
221
221
|
readonly maxWait: number;
|
|
222
222
|
/** The exit code that asks for an immediate restart (`RESTART_CODE` unless the supervisor sets another). */
|
|
223
223
|
readonly restartCode: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The test kit's tunables. The real model's key and ids are the live tests' slice (`liveEnv`: `OPENROUTER_API_KEY`,
|
|
3
|
-
* `
|
|
3
|
+
* `FNLOOM_LIVE_MODEL`, `FNLOOM_LIVE_FALLBACKS`); this slice holds the previews'.
|
|
4
4
|
*/
|
|
5
5
|
import { env } from '@ayepi/env';
|
|
6
6
|
import { z } from 'zod';
|
|
@@ -10,15 +10,15 @@ const Size = z.string().regex(/^\d+x\d+$/);
|
|
|
10
10
|
|
|
11
11
|
export const kitEnv = env({
|
|
12
12
|
/** Shoot component previews (`preview()`); off, it only bundles each component. `harness test --previews` sets it. */
|
|
13
|
-
|
|
13
|
+
FNLOOM_PREVIEWS: z.boolean().default(false),
|
|
14
14
|
/** Where previews and their gallery are written. */
|
|
15
|
-
|
|
15
|
+
FNLOOM_PREVIEW_DIR: z.string().default('.harness-test/previews'),
|
|
16
16
|
/** The phone viewport. */
|
|
17
|
-
|
|
17
|
+
FNLOOM_PREVIEW_PHONE: Size.default('390x844'),
|
|
18
18
|
/** The desktop viewport. */
|
|
19
|
-
|
|
19
|
+
FNLOOM_PREVIEW_DESKTOP: Size.default('1280x800'),
|
|
20
20
|
/** The CSS files of the app's look (its tokens and base), comma separated; default the web app's own. */
|
|
21
|
-
|
|
21
|
+
FNLOOM_PREVIEW_THEME: z.string().optional(),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
/** A viewport size from its `<width>x<height>` text. */
|