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
|
@@ -32,7 +32,7 @@ export interface LifecycleOptions {
|
|
|
32
32
|
readonly bus: EventBus;
|
|
33
33
|
readonly log: Logger;
|
|
34
34
|
readonly clock: () => number;
|
|
35
|
-
readonly settings: Pick<ReviewEnv, '
|
|
35
|
+
readonly settings: Pick<ReviewEnv, 'FNLOOM_REVIEW_SYSTEMS'>;
|
|
36
36
|
/** Asks a system for its resource roots again, so a system going live (or a root switched on) is indexed. */
|
|
37
37
|
readonly resources?: () => Pick<ResourceRouter, 'refresh'>;
|
|
38
38
|
}
|
|
@@ -199,7 +199,7 @@ export class SystemLifecycle {
|
|
|
199
199
|
|
|
200
200
|
/** The stage a newly paired system starts at. */
|
|
201
201
|
get firstStage(): SystemStage {
|
|
202
|
-
return this.#options.settings.
|
|
202
|
+
return this.#options.settings.FNLOOM_REVIEW_SYSTEMS ? 'installed' : 'live';
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
/** A system's stage; rows from before build 7 have none and are live. */
|
|
@@ -217,7 +217,7 @@ export class SystemLifecycle {
|
|
|
217
217
|
* renderers, pages and config component run as the admin): none while the system is installed and not yet live,
|
|
218
218
|
* while the build is switched off or waits in a pending review, or while the contract it came with is neither the
|
|
219
219
|
* live one nor the one waiting (just imported, not yet compared). A system that went live before reviews (no review
|
|
220
|
-
* row) keeps the build it had. With `
|
|
220
|
+
* row) keeps the build it had. With `FNLOOM_REVIEW_SYSTEMS` off, every contract is live as it arrives.
|
|
221
221
|
*/
|
|
222
222
|
async approvedClient(system: SystemName): Promise<ClientAssets | undefined> {
|
|
223
223
|
const { store, catalog } = this.#options;
|
|
@@ -467,7 +467,7 @@ export class SystemLifecycle {
|
|
|
467
467
|
const live: LiveContract = review?.live ?? {
|
|
468
468
|
version: before?.version ?? after.version, hash: before?.hash ?? after.hash, grants: before?.grants ?? after.grants ?? { hub: [] }, runtime: [], by: record.actor, at: clock(),
|
|
469
469
|
};
|
|
470
|
-
if (before === undefined || !settings.
|
|
470
|
+
if (before === undefined || !settings.FNLOOM_REVIEW_SYSTEMS) {
|
|
471
471
|
await store.table('systemReviews').put({ ...(review ?? {}), system, live: { ...live, hash: after.hash, version: after.version, grants: after.grants ?? live.grants }, updatedAt: clock() });
|
|
472
472
|
return;
|
|
473
473
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Moving the api system from one instance per service to one instance whose services are records (to-do phase 4).
|
|
3
3
|
* Before, each API service was its own `api` instance: its config an `ApiServiceConfig` (a shared token sealed in it),
|
|
4
4
|
* its people's connections keyed by the instance, and its fns routed to it. Now the one `api` instance authors fns
|
|
5
|
-
* like `code`, each service is an `api/Service` record (
|
|
5
|
+
* like `code`, each service is an `api/Service` record (the api system's `ApiService`) and connections are keyed by the
|
|
6
|
+
* service.
|
|
6
7
|
*
|
|
7
8
|
* For each `api` instance that still holds a service config, once per start and before systems connect:
|
|
8
9
|
*
|
|
@@ -17,11 +18,9 @@
|
|
|
17
18
|
* An instance with no service config left is already moved, so running it again changes nothing.
|
|
18
19
|
*/
|
|
19
20
|
import type { Logger } from '@ayepi/log';
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from '@harness/core';
|
|
24
|
-
import { accountLabel } from '@harness/sdk';
|
|
21
|
+
import { ConnectKey, DataRecord, Json, MAIN_INSTANCE, mintId, recordVersionId, SystemName, type ActorId, type IdRandom, type InstanceRecord, type RecordStorage, type UserConnection } from '@harness/core';
|
|
22
|
+
import { accountLabel, HeaderValues, RemoteCredentials, TypedAuth } from '@harness/sdk';
|
|
23
|
+
import { z } from 'zod';
|
|
25
24
|
import { indexKey, searchText } from '../data/service.ts';
|
|
26
25
|
import { allRows } from '../store/rows.ts';
|
|
27
26
|
import type { HubStore } from '../store/index.ts';
|
|
@@ -49,7 +48,48 @@ export interface ApiMigration {
|
|
|
49
48
|
readonly removed: number;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
/**
|
|
52
|
+
* What the migration knows of the api system, as it was when services became records. The hub never imports a system,
|
|
53
|
+
* so these few names are written here; the api system's own (`systems/api/shared/services.ts`) must keep them.
|
|
54
|
+
*/
|
|
55
|
+
const API = SystemName.parse('api');
|
|
56
|
+
/** The stored type of api services. */
|
|
57
|
+
export const API_SERVICE_TYPE = 'api/Service';
|
|
58
|
+
/** How the api system keeps its service records: searched by label, name, description and base URL. */
|
|
59
|
+
const API_SERVICE_RECORDS = {
|
|
60
|
+
shape: 'table', owner: 'shared', writers: 'admins', search: { text: ['label', 'name', 'description', 'baseUrl'], embed: false },
|
|
61
|
+
} as const satisfies RecordStorage;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Before the one-instance api: one service as its own `api` instance's config, a shared token sealed in it. Read once,
|
|
65
|
+
* here, to turn each such instance into a service record of the one instance.
|
|
66
|
+
*/
|
|
67
|
+
export const ApiServiceConfig = z.object({
|
|
68
|
+
label: z.string().min(1),
|
|
69
|
+
description: z.string().optional(),
|
|
70
|
+
baseUrl: z.url(),
|
|
71
|
+
/** How it signs in: no OAuth, since an API service names no endpoints to sign in through. */
|
|
72
|
+
auth: TypedAuth.default({ kind: 'none' }),
|
|
73
|
+
headers: HeaderValues.optional(),
|
|
74
|
+
openapi: z.url().optional(),
|
|
75
|
+
timeout: z.number().int().min(1000).default(60_000),
|
|
76
|
+
maxBody: z.number().int().min(1024).default(2 * 1024 * 1024),
|
|
77
|
+
});
|
|
78
|
+
export type ApiServiceConfig = z.infer<typeof ApiServiceConfig>;
|
|
79
|
+
|
|
80
|
+
/** A service record as the migration writes it: the api system's `ApiService`, holding no secret. */
|
|
81
|
+
interface ServiceRecord {
|
|
82
|
+
readonly name: ConnectKey;
|
|
83
|
+
readonly label: string;
|
|
84
|
+
readonly description?: string;
|
|
85
|
+
readonly baseUrl: string;
|
|
86
|
+
readonly allowPrivate: boolean;
|
|
87
|
+
readonly auth: { readonly kind: 'none' } | { readonly kind: 'bearer'; readonly per: 'shared' | 'person' } | { readonly kind: 'headers'; readonly per: 'shared' | 'person'; readonly names: readonly string[] };
|
|
88
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
89
|
+
readonly openapi?: string;
|
|
90
|
+
readonly timeout: number;
|
|
91
|
+
readonly maxBody: number;
|
|
92
|
+
}
|
|
53
93
|
|
|
54
94
|
/** The instance kept as the one api instance: `main`, else the first paired. */
|
|
55
95
|
function keptInstance(rows: readonly InstanceRecord[]): InstanceRecord | undefined {
|
|
@@ -66,16 +106,16 @@ function sharedCredentials(config: ApiServiceConfig): RemoteCredentials | undefi
|
|
|
66
106
|
}
|
|
67
107
|
|
|
68
108
|
/** A legacy config as the service record it becomes (no secret in it). */
|
|
69
|
-
function serviceOf(name: ConnectKey, config: ApiServiceConfig):
|
|
109
|
+
function serviceOf(name: ConnectKey, config: ApiServiceConfig): ServiceRecord {
|
|
70
110
|
const auth = config.auth.kind === 'none' ? { kind: 'none' as const }
|
|
71
111
|
: config.auth.kind === 'bearer' ? { kind: 'bearer' as const, per: config.auth.per }
|
|
72
112
|
: { kind: 'headers' as const, per: config.auth.per, names: config.auth.names };
|
|
73
|
-
return
|
|
74
|
-
name, label: config.label, baseUrl: config.baseUrl, auth, timeout: config.timeout, maxBody: config.maxBody,
|
|
113
|
+
return {
|
|
114
|
+
name, label: config.label, baseUrl: config.baseUrl, allowPrivate: false, auth, timeout: config.timeout, maxBody: config.maxBody,
|
|
75
115
|
...(config.description === undefined ? {} : { description: config.description }),
|
|
76
116
|
...(config.headers === undefined ? {} : { headers: config.headers }),
|
|
77
117
|
...(config.openapi === undefined ? {} : { openapi: config.openapi }),
|
|
78
|
-
}
|
|
118
|
+
};
|
|
79
119
|
}
|
|
80
120
|
|
|
81
121
|
/** Turn every per-service `api` instance into a service record of the one instance. */
|
|
@@ -129,7 +169,7 @@ async function serviceRecord(store: HubStore, name: ConnectKey): Promise<DataRec
|
|
|
129
169
|
}
|
|
130
170
|
|
|
131
171
|
/** Add the service record, its first version and its search text, as a save of it would. */
|
|
132
|
-
async function addRecord(deps: ApiMigrationDeps, service:
|
|
172
|
+
async function addRecord(deps: ApiMigrationDeps, service: ServiceRecord, by: ActorId): Promise<void> {
|
|
133
173
|
const now = deps.clock();
|
|
134
174
|
const value = Json.parse(service);
|
|
135
175
|
const record = DataRecord.parse({
|
|
@@ -143,12 +183,12 @@ async function addRecord(deps: ApiMigrationDeps, service: ApiService, by: ActorI
|
|
|
143
183
|
}
|
|
144
184
|
|
|
145
185
|
/** Credentials as the api system keeps them: bound to the base URL they were given for. */
|
|
146
|
-
function bound(credentials: RemoteCredentials, service:
|
|
186
|
+
function bound(credentials: RemoteCredentials, service: ServiceRecord): string {
|
|
147
187
|
return JSON.stringify({ ...credentials, baseUrl: service.baseUrl });
|
|
148
188
|
}
|
|
149
189
|
|
|
150
190
|
/** The service's shared token or headers as the admin's connection, shared with everyone (unless there is one). */
|
|
151
|
-
async function addSharedConnection(deps: ApiMigrationDeps, service:
|
|
191
|
+
async function addSharedConnection(deps: ApiMigrationDeps, service: ServiceRecord, credentials: RemoteCredentials, owner: ActorId): Promise<void> {
|
|
152
192
|
const table = deps.store.table('connections');
|
|
153
193
|
const existing = await allRows(table, { where: { system: API, owner } });
|
|
154
194
|
if (existing.some((row) => row.key === service.name && row.share.visibility === 'public')) return;
|
|
@@ -163,7 +203,7 @@ async function addSharedConnection(deps: ApiMigrationDeps, service: ApiService,
|
|
|
163
203
|
}
|
|
164
204
|
|
|
165
205
|
/** The instance's connections keyed by its service, their credentials bound to its base URL. How many moved. */
|
|
166
|
-
async function keyConnections(deps: ApiMigrationDeps, row: InstanceRecord, service:
|
|
206
|
+
async function keyConnections(deps: ApiMigrationDeps, row: InstanceRecord, service: ServiceRecord): Promise<number> {
|
|
167
207
|
const table = deps.store.table('connections');
|
|
168
208
|
let moved = 0;
|
|
169
209
|
for (const connection of await allRows(table, { where: { system: API, instance: row.instance } })) {
|
|
@@ -54,7 +54,7 @@ export interface PairingOptions {
|
|
|
54
54
|
readonly configSecrets: (system: SystemName) => Promise<readonly ConfigPath[] | undefined>;
|
|
55
55
|
/** Seals the secret fields of a config chosen at approval. */
|
|
56
56
|
readonly secrets: ConfigSecretKeeper;
|
|
57
|
-
/** The hub as phones reach it (`
|
|
57
|
+
/** The hub as phones reach it (`FNLOOM_PUBLIC_URL`); unset, links use the address the system dialed. */
|
|
58
58
|
readonly publicUrl?: string | undefined;
|
|
59
59
|
/** How long a pairing request waits for an admin. */
|
|
60
60
|
readonly timeout: number;
|
|
@@ -53,7 +53,7 @@ export class NodeInstaller implements Installer {
|
|
|
53
53
|
readonly #zips: ZipSource | undefined;
|
|
54
54
|
readonly #maxBytes: number;
|
|
55
55
|
|
|
56
|
-
/** `npm` and `maxBytes` are the packaging settings (`
|
|
56
|
+
/** `npm` and `maxBytes` are the packaging settings (`FNLOOM_NPM`, `FNLOOM_PACKAGE_MAX`). */
|
|
57
57
|
constructor(options: { npm: string; maxBytes: number; git?: string; zips?: ZipSource }) {
|
|
58
58
|
this.#npm = options.npm;
|
|
59
59
|
this.#git = options.git ?? 'git';
|
|
@@ -26,21 +26,21 @@ import { JwtSystemTokens } from './tokens.ts';
|
|
|
26
26
|
|
|
27
27
|
/** The settings the rig builds with: small chunks so content is fetched in several, a minute to pair. */
|
|
28
28
|
export const RIG_SETTINGS: SystemsSettings = {
|
|
29
|
-
hub: {
|
|
29
|
+
hub: { FNLOOM_URL: 'http://hub:4300/', FNLOOM_SYSTEMS_DIR: '.harness-test/systems', FNLOOM_STORES_DIR: '.harness-test/stores', FNLOOM_STORE_DRIVERS_DIR: '.harness-test/store-drivers' },
|
|
30
30
|
packaging: {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
FNLOOM_PUBLIC_URL: undefined, FNLOOM_AUTO_PAIR_LIMIT: 3, FNLOOM_AUTO_PAIR_WINDOW: 60_000, FNLOOM_AUTO_PAIR_EXPIRY: 7_776_000_000, FNLOOM_PACKAGE_MAX: 10_000_000, FNLOOM_NPM: 'npm', FNLOOM_BUNDLED_SYSTEMS: '',
|
|
32
|
+
FNLOOM_STORE_LEASE: 30_000, FNLOOM_STORE_HOLD: 120_000, FNLOOM_STORE_MOVE_DRAIN: 60_000,
|
|
33
33
|
},
|
|
34
34
|
link: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
FNLOOM_MAX_FRAME: 262_144, FNLOOM_MAX_CHUNK: 1_024, FNLOOM_HEARTBEAT: 15_000, FNLOOM_PAIRING_TIMEOUT: 60_000, FNLOOM_PAIRING_GRANT_TTL: 60_000, FNLOOM_STOP_TIMEOUT: 1_000,
|
|
36
|
+
FNLOOM_RESTART_BACKOFF: 5, FNLOOM_RESTARTS_PER_HOUR: 2, FNLOOM_RESTART_BACKOFF_MAX: 300_000, FNLOOM_PROCESS_OUTPUT_TAIL: 8_192,
|
|
37
|
+
FNLOOM_PAIRING_LIMIT: 20, FNLOOM_PAIRING_LIMIT_TOTAL: 100, FNLOOM_PAIRING_WINDOW: 60_000, FNLOOM_LINK_HELLO_TIMEOUT: 15_000,
|
|
38
|
+
FNLOOM_LINK_UNLINKED_PER_ADDRESS: 8, FNLOOM_LINK_UNLINKED_MAX: 64, FNLOOM_LINK_MAX_UPLOADS: 16,
|
|
39
39
|
},
|
|
40
|
-
model: {
|
|
41
|
-
index: {
|
|
42
|
-
search: {
|
|
43
|
-
review: {
|
|
40
|
+
model: { FNLOOM_EMBEDDER_DOCUMENT: 'vectors/document', FNLOOM_EMBEDDER_QUERY: 'vectors/query', FNLOOM_EMBED_BATCH: 8 },
|
|
41
|
+
index: { FNLOOM_EMBED_WAIT: 1, FNLOOM_EMBED_POLL: 2, FNLOOM_EMBED_INTERACTIVE: 2, FNLOOM_EMBED_BACKGROUND: 1, FNLOOM_INDEX_MAX_TEXT: 500, FNLOOM_SEARCH_OVERFETCH: 3, FNLOOM_SEARCH_EMBED_WAIT: 1_000, FNLOOM_INDEX_CRAWL_MAX: 1_000, FNLOOM_INDEX_EMBED_BATCH: 8, FNLOOM_INDEX_RETRY: 50, FNLOOM_INDEX_RETRY_MOST: 200, FNLOOM_INDEX_IMAGE_MAX: 1_000_000 },
|
|
42
|
+
search: { FNLOOM_SEARCH_RRF_K: 60, FNLOOM_SEARCH_DEPTH: 4 },
|
|
43
|
+
review: { FNLOOM_REVIEW_SYSTEMS: false, FNLOOM_GRANTS: 'log', FNLOOM_REFUSALS_PAUSE: 5, FNLOOM_REFUSALS_WINDOW: 60_000 },
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/** A launcher for rigs that never start processes. */
|
|
@@ -57,7 +57,7 @@ export async function linkRig(options: { publicUrl?: string; review?: Partial<Sy
|
|
|
57
57
|
const vault = new AesSecretVault({ store, box: new SecretBox('a-key-that-is-long-enough-for-the-hub-0123'), clock });
|
|
58
58
|
const settings: SystemsSettings = {
|
|
59
59
|
...RIG_SETTINGS,
|
|
60
|
-
...(options.publicUrl === undefined ? {} : { packaging: { ...RIG_SETTINGS.packaging,
|
|
60
|
+
...(options.publicUrl === undefined ? {} : { packaging: { ...RIG_SETTINGS.packaging, FNLOOM_PUBLIC_URL: options.publicUrl } }),
|
|
61
61
|
review: { ...RIG_SETTINGS.review, ...options.review },
|
|
62
62
|
link: { ...RIG_SETTINGS.link, ...options.link },
|
|
63
63
|
};
|
|
@@ -68,7 +68,7 @@ export interface SupervisorSettings {
|
|
|
68
68
|
readonly perHour: number;
|
|
69
69
|
/** The longest wait between restarts. */
|
|
70
70
|
readonly maxBackoff: number;
|
|
71
|
-
/** The hub's database drivers folder (`
|
|
71
|
+
/** The hub's database drivers folder (`FNLOOM_STORE_DRIVERS_DIR`), told to every system it starts (`FNLOOM_STORE_DRIVERS`). */
|
|
72
72
|
readonly storeDrivers?: string;
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One MCP tool call as a real run (`McpRunner`): a turn for the MCP's person (their limits, at interactive priority),
|
|
3
3
|
* the run of the fn with that person as its actor and the MCP's actor as its caller (so policies, approvals, budgets,
|
|
4
|
-
* the ledger and metrics all apply), a wait bounded by `
|
|
5
|
-
* `
|
|
4
|
+
* the ledger and metrics all apply), a wait bounded by `FNLOOM_HUB_MCP_ASK_TIMEOUT` while it needs approval and
|
|
5
|
+
* `FNLOOM_HUB_MCP_RUN_TIMEOUT` in all, the run cancelled when the client goes away, and the outcome as an MCP result:
|
|
6
6
|
* done is its value (structured when it is an object), refused input is an error the model can correct, a failure or
|
|
7
|
-
* a cancel is an error. Each MCP may start `
|
|
7
|
+
* a cancel is an error. Each MCP may start `FNLOOM_HUB_MCP_RATE` calls a minute.
|
|
8
8
|
*/
|
|
9
9
|
import { errorResult, jsonResult, type McpCaller, type McpToolResult } from '@ayepi/mcp';
|
|
10
10
|
import type { Logger } from '@ayepi/log';
|
|
@@ -24,7 +24,7 @@ export interface McpRunnerDeps {
|
|
|
24
24
|
readonly rate: Limiter;
|
|
25
25
|
readonly clock: () => number;
|
|
26
26
|
readonly log: Logger;
|
|
27
|
-
readonly settings: Pick<McpEnv, '
|
|
27
|
+
readonly settings: Pick<McpEnv, 'FNLOOM_HUB_MCP_ASK_TIMEOUT' | 'FNLOOM_HUB_MCP_RUN_TIMEOUT'>;
|
|
28
28
|
/** Wait (tests make it instant); the default is a timer. */
|
|
29
29
|
readonly sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
|
|
30
30
|
}
|
|
@@ -112,10 +112,10 @@ export class McpRunner {
|
|
|
112
112
|
settled.then(() => { resolve('settled'); }, () => { resolve('settled'); });
|
|
113
113
|
if (signal.aborted) resolve('gone');
|
|
114
114
|
else signal.addEventListener('abort', () => { resolve('gone'); }, { once: true });
|
|
115
|
-
void sleep(settings.
|
|
115
|
+
void sleep(settings.FNLOOM_HUB_MCP_ASK_TIMEOUT, stop.signal).then(async () => {
|
|
116
116
|
if (!stop.signal.aborted && (await this.#deps.runs().get(run))?.status === 'awaiting-approval') resolve('unapproved');
|
|
117
117
|
});
|
|
118
|
-
void sleep(settings.
|
|
118
|
+
void sleep(settings.FNLOOM_HUB_MCP_RUN_TIMEOUT, stop.signal).then(() => { if (!stop.signal.aborted) resolve('timeout'); });
|
|
119
119
|
});
|
|
120
120
|
stop.abort();
|
|
121
121
|
if (outcome === 'settled') return undefined;
|
|
@@ -21,21 +21,21 @@ export const mcpModule: ModuleFactory<'mcp'> = ({ hub }) => {
|
|
|
21
21
|
const settings = hub.settings.mcpEnv;
|
|
22
22
|
const clock = (): number => hub.clock();
|
|
23
23
|
const registry: StoreMcpRegistry = new StoreMcpRegistry({
|
|
24
|
-
store: hub.store, bus: hub.bus, clock, log: hub.log, publicUrl: hub.settings.packagingEnv.
|
|
24
|
+
store: hub.store, bus: hub.bus, clock, log: hub.log, publicUrl: hub.settings.packagingEnv.FNLOOM_PUBLIC_URL ?? hub.settings.hubEnv.FNLOOM_URL,
|
|
25
25
|
// the endpoints are made below; this is only called once the hub is serving
|
|
26
26
|
sessions: (mcp): number => endpoints.sessionCount(mcp),
|
|
27
27
|
});
|
|
28
28
|
const scopes = new CatalogMcpScopes({ catalog: () => hub.catalog, resources: () => hub.link.resources, registry: () => registry, bus: hub.bus });
|
|
29
|
-
const tokens = new JwtMcpTokens({ keys: () => hub.store.ports.work.store, registry: () => registry, clock, log: hub.log, maxTtl: settings.
|
|
29
|
+
const tokens = new JwtMcpTokens({ keys: () => hub.store.ports.work.store, registry: () => registry, clock, log: hub.log, maxTtl: settings.FNLOOM_HUB_MCP_TOKEN_TTL });
|
|
30
30
|
const runner = new McpRunner({
|
|
31
31
|
store: hub.store, runs: () => hub.execution.runs, limits: () => hub.execution.limits, clock, log: hub.log, settings,
|
|
32
|
-
rate: limiter({ limit: settings.
|
|
32
|
+
rate: limiter({ limit: settings.FNLOOM_HUB_MCP_RATE, window: 60_000, algorithm: 'sliding-window', prefix: 'mcp:', store: hub.store.ports.rate }),
|
|
33
33
|
});
|
|
34
34
|
const sources = { scopes: () => scopes, catalog: () => hub.catalog, resources: () => hub.link.resources, content: () => hub.api.content };
|
|
35
35
|
const endpoints: HubMcpEndpoints = new HubMcpEndpoints({
|
|
36
|
-
registry: () => registry, tokens: () => tokens, bus: hub.bus, clock, log: hub.log, maxBody: settings.
|
|
36
|
+
registry: () => registry, tokens: () => tokens, bus: hub.bus, clock, log: hub.log, maxBody: settings.FNLOOM_HUB_MCP_MAX_BODY, idleTimeout: settings.FNLOOM_HUB_MCP_IDLE_TIMEOUT,
|
|
37
37
|
// MCP clients show the env's name (an admin's later rename shows on the next start)
|
|
38
|
-
serverInfo: { name: hubNameOf(undefined, hub.settings.hubEnv.
|
|
38
|
+
serverInfo: { name: hubNameOf(undefined, hub.settings.hubEnv.FNLOOM_NAME).name, version: HUB_INFO.version },
|
|
39
39
|
list: async () => allRows(hub.store.table('mcps'), { where: { enabled: true } }),
|
|
40
40
|
parts: (mcp) => ({
|
|
41
41
|
tools: new HubMcpTools(mcp, { registry: () => registry, scopes: () => scopes, catalog: () => hub.catalog, runner, log: hub.log, access: () => hub.access }),
|
|
@@ -7,12 +7,12 @@ import { z } from 'zod';
|
|
|
7
7
|
|
|
8
8
|
/** Hub MCP tunables. */
|
|
9
9
|
export const mcpEnv = env({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
FNLOOM_HUB_MCP_MAX_BODY: z.number().int().min(1_024).default(1_048_576).describe('The largest request body a hub MCP accepts, in bytes.'),
|
|
11
|
+
FNLOOM_HUB_MCP_ASK_TIMEOUT: z.number().int().min(1_000).default(600_000).describe('How long an MCP call waits for a person\'s approval before it ends as not approved.'),
|
|
12
|
+
FNLOOM_HUB_MCP_RUN_TIMEOUT: z.number().int().min(1_000).default(1_800_000).describe('How long one MCP call may take in all.'),
|
|
13
|
+
FNLOOM_HUB_MCP_TOKEN_TTL: z.number().int().min(60_000).default(3_600_000).describe('How long a minted MCP session token lasts.'),
|
|
14
|
+
FNLOOM_HUB_MCP_IDLE_TIMEOUT: z.number().int().min(60_000).default(1_800_000).describe('How long an MCP session may go with no request and no open event stream before it ends (a client that went away without saying so).'),
|
|
15
|
+
FNLOOM_HUB_MCP_RATE: z.number().int().min(1).default(120).describe('Most calls one MCP may start per minute.'),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
/** The parsed hub MCP tunables. */
|
|
@@ -10,14 +10,14 @@ import type { McpEnv } from './env.ts';
|
|
|
10
10
|
import type { McpTokens } from './index.ts';
|
|
11
11
|
|
|
12
12
|
/** Register the mcp module's hub fns. Services are read when a fn runs. */
|
|
13
|
-
export function registerMcpFns(fns: HubFns, deps: { readonly tokens: () => Pick<McpTokens, 'mint'>; readonly settings: Pick<McpEnv, '
|
|
13
|
+
export function registerMcpFns(fns: HubFns, deps: { readonly tokens: () => Pick<McpTokens, 'mint'>; readonly settings: Pick<McpEnv, 'FNLOOM_HUB_MCP_TOKEN_TTL'> }): void {
|
|
14
14
|
fns.register(hub.fns.mint_mcp_token, async (raw, ctx) => {
|
|
15
15
|
// the contract declares the args from this schema (`ginAs`); parsing adds the brands
|
|
16
16
|
const args = MintMcpTokenArgs.parse(raw);
|
|
17
17
|
const from = ctx.request.run.system.from?.system;
|
|
18
18
|
const system = from === undefined ? undefined : SystemName.safeParse(from);
|
|
19
19
|
if (system?.success !== true) throw new Error('only a system\'s fn may mint an MCP token, for a session it starts');
|
|
20
|
-
const minted = await deps.tokens().mint({ mcp: args.mcp, label: args.label, ttl: args.ttl ?? deps.settings.
|
|
20
|
+
const minted = await deps.tokens().mint({ mcp: args.mcp, label: args.label, ttl: args.ttl ?? deps.settings.FNLOOM_HUB_MCP_TOKEN_TTL, system: system.data });
|
|
21
21
|
return { token: minted.token, expiresAt: new Date(minted.expiresAt) };
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - `McpEndpoints` mounts the servers and answers HTTP; tool sources are `each` (one tool per fn, `<system>_<local>`)
|
|
12
12
|
* or `static` (the chat's static toolset, scoped to the MCP). Outcomes map to MCP results: done → structured
|
|
13
13
|
* content, invalid input → `isError` with the problems (the model can correct them), failed or cancelled →
|
|
14
|
-
* `isError`; an approval wait keeps the call open until `
|
|
14
|
+
* `isError`; an approval wait keeps the call open until `FNLOOM_HUB_MCP_ASK_TIMEOUT`.
|
|
15
15
|
* - `McpTokens` mints short-lived session tokens for grantee systems (`hub/mint_mcp_token`), so a Claude system can
|
|
16
16
|
* give each Claude Code session its own labelled credential without the secret leaving the hub.
|
|
17
17
|
*
|
|
@@ -62,7 +62,7 @@ export interface McpEndpoints {
|
|
|
62
62
|
|
|
63
63
|
/** Short-lived session tokens minted from an MCP for its grantee systems. */
|
|
64
64
|
export interface McpTokens {
|
|
65
|
-
/** Refused unless the system is one of the MCP's grantees. `ttl` is capped at `
|
|
65
|
+
/** Refused unless the system is one of the MCP's grantees. `ttl` is capped at `FNLOOM_HUB_MCP_TOKEN_TTL`. */
|
|
66
66
|
mint(input: { mcp: HubMcpId; label: string; ttl: number; system: SystemName }): Promise<{ token: string; expiresAt: number }>;
|
|
67
67
|
verify(token: string): Promise<McpTokenClaims | undefined>;
|
|
68
68
|
}
|
|
@@ -19,9 +19,9 @@ import type { ResourceRouter } from '../link/index.ts';
|
|
|
19
19
|
import type { McpScopes } from './index.ts';
|
|
20
20
|
|
|
21
21
|
/** The scheme of the hub's own views served as MCP resources. */
|
|
22
|
-
export const
|
|
23
|
-
const TYPES = `${
|
|
24
|
-
const CONTEXT = `${
|
|
22
|
+
export const FNLOOM_SCHEME = 'harness://';
|
|
23
|
+
const TYPES = `${FNLOOM_SCHEME}types/`;
|
|
24
|
+
const CONTEXT = `${FNLOOM_SCHEME}context/`;
|
|
25
25
|
|
|
26
26
|
/** The URI of a type's or context item's view: `harness://types/fs/Entry`. */
|
|
27
27
|
export function viewUri(kind: 'types' | 'context', name: QualifiedName): string {
|
|
@@ -23,7 +23,7 @@ export interface JwtMcpTokensDeps {
|
|
|
23
23
|
readonly registry: () => Pick<McpRegistry, 'record'>;
|
|
24
24
|
readonly clock: () => number;
|
|
25
25
|
readonly log: Logger;
|
|
26
|
-
/** The longest a token may last (`
|
|
26
|
+
/** The longest a token may last (`FNLOOM_HUB_MCP_TOKEN_TTL`). */
|
|
27
27
|
readonly maxTtl: number;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -52,7 +52,7 @@ export const modelsModule: ModuleFactory<'models'> = ({ hub }) => {
|
|
|
52
52
|
const decider = new HubDecider({
|
|
53
53
|
roles,
|
|
54
54
|
llm: { decide: (input, site, signal) => hub.execution.llm.decide(input, site, signal), models: () => hub.execution.llm.models() },
|
|
55
|
-
parallel: hub.settings.modelEnv.
|
|
55
|
+
parallel: hub.settings.modelEnv.FNLOOM_DECIDE_PARALLEL,
|
|
56
56
|
});
|
|
57
57
|
return {
|
|
58
58
|
services: { roles, gateway, decider },
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 64) and the bytes of input and questions per call (`ModelInfo.maxRequestBytes`; System One takes 64 KiB), and aeye
|
|
5
5
|
* refuses a call over a cap without splitting it (`DecisionLimitError`). So every hub caller that asks questions
|
|
6
6
|
* (suggestions, systems' `decide`, `ctx_crawl`) goes through `HubDecider.ask`, which splits them here, in order,
|
|
7
|
-
* one call per batch, up to `
|
|
7
|
+
* one call per batch, up to `FNLOOM_DECIDE_PARALLEL` calls at once (each still waits its turn on the hub's LLM queue),
|
|
8
8
|
* and gets every answer back by name. The model is the `decide` role's unless the job chose one,
|
|
9
9
|
* and the role's threshold says how likely a yes/no answer must be to count as yes.
|
|
10
10
|
*/
|
|
@@ -90,7 +90,7 @@ export async function decideInBatches(
|
|
|
90
90
|
export interface HubDeciderDeps {
|
|
91
91
|
readonly roles: Pick<ModelRoles, 'get' | 'resolveModel'>;
|
|
92
92
|
readonly llm: Pick<LlmGateway, 'decide' | 'models'>;
|
|
93
|
-
/** How many of one decision's calls run at once (`
|
|
93
|
+
/** How many of one decision's calls run at once (`FNLOOM_DECIDE_PARALLEL`); one at a time when unset. */
|
|
94
94
|
readonly parallel?: number;
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* - `ModelRoles`: which model (and provider) the hub uses for each job that isn't an agent's own choice: the default
|
|
5
5
|
* chat model, transcribing audio, dictation (or the browser's speech recognition), speaking answers, describing
|
|
6
6
|
* images and reading text in them. Set in the admin's model settings or by asking in chat (`hub/set_model_role`);
|
|
7
|
-
* without a setting a role falls back to its env default (`
|
|
7
|
+
* without a setting a role falls back to its env default (`FNLOOM_TRANSCRIBE_MODEL`, `FNLOOM_DEFAULT_MODEL`) or
|
|
8
8
|
* is off. `ChatCapabilities.voiceInput` and `.dictation` follow it.
|
|
9
9
|
* - `ModelGateway`: embeddings, images, transcription, speech and decisions for systems (the `model` link endpoint
|
|
10
10
|
* behind the SDK's forwarding provider) and for the hub's own work (forms, dictation), each budgeted, rate-limited and
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Model roles in the hub store (`ModelRoles`, table `modelRoles`): which model, and optionally which configured
|
|
3
3
|
* provider, does each job the hub picks a model for itself. A role without a stored choice falls back to its env
|
|
4
|
-
* default (`
|
|
5
|
-
* `
|
|
4
|
+
* default (`FNLOOM_DEFAULT_MODEL` for chat; `FNLOOM_TRANSCRIBE_MODEL` for transcription and a model-engine dictation;
|
|
5
|
+
* `FNLOOM_PLAN_MODEL` for plans; `FNLOOM_DECIDE_MODEL` for decisions; `FNLOOM_METADATA_MODEL` for context metadata,
|
|
6
6
|
* which otherwise borrows the decide role's model when it can chat, else the chat role's) or is off. A choice resolves against the models configured providers offer, and a model that can't do the role's
|
|
7
7
|
* job (a chat model asked to hear audio) is reported as a problem, not used.
|
|
8
8
|
*/
|
|
@@ -20,14 +20,14 @@ const ROLE_ABILITIES: Record<ModelRole, ModelCapability> = ROLE_CAPABILITY;
|
|
|
20
20
|
|
|
21
21
|
/** The env defaults roles fall back to. */
|
|
22
22
|
export interface RoleDefaults {
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
23
|
+
readonly FNLOOM_DEFAULT_MODEL: string;
|
|
24
|
+
readonly FNLOOM_TRANSCRIBE_MODEL: string;
|
|
25
25
|
/** The plan role's model (`hub/ctx_plan`); empty or absent leaves the role off. */
|
|
26
|
-
readonly
|
|
26
|
+
readonly FNLOOM_PLAN_MODEL?: string;
|
|
27
27
|
/** The decide role's model (a decision model, e.g. typesafe/jev-1.14 on OpenRouter); empty or absent leaves it off. */
|
|
28
|
-
readonly
|
|
28
|
+
readonly FNLOOM_DECIDE_MODEL?: string;
|
|
29
29
|
/** The metadata role's model; empty or absent borrows the decide role's model (or the chat role's, `metadataFallback`). */
|
|
30
|
-
readonly
|
|
30
|
+
readonly FNLOOM_METADATA_MODEL?: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** What the roles use. */
|
|
@@ -43,15 +43,15 @@ export interface ModelRolesDeps {
|
|
|
43
43
|
|
|
44
44
|
/** A role's env default, or undefined when the role has none (it is off). */
|
|
45
45
|
export function defaultChoice(role: ModelRole, defaults: RoleDefaults): RoleChoice | undefined {
|
|
46
|
-
const transcribe = defaults.
|
|
46
|
+
const transcribe = defaults.FNLOOM_TRANSCRIBE_MODEL;
|
|
47
47
|
switch (role) {
|
|
48
|
-
case 'chat': return defaults.
|
|
48
|
+
case 'chat': return defaults.FNLOOM_DEFAULT_MODEL === '' ? undefined : { role, model: { model: defaults.FNLOOM_DEFAULT_MODEL } };
|
|
49
49
|
case 'transcribe': return transcribe === '' ? undefined : { role, model: { model: transcribe } };
|
|
50
50
|
case 'dictate': return transcribe === '' ? undefined : { role, engine: { engine: 'model', model: { model: transcribe } } };
|
|
51
|
-
case 'plan': return (defaults.
|
|
52
|
-
case 'decide': return (defaults.
|
|
51
|
+
case 'plan': return (defaults.FNLOOM_PLAN_MODEL ?? '') === '' ? undefined : { role, model: { model: defaults.FNLOOM_PLAN_MODEL ?? '' } };
|
|
52
|
+
case 'decide': return (defaults.FNLOOM_DECIDE_MODEL ?? '') === '' ? undefined : { role, model: { model: defaults.FNLOOM_DECIDE_MODEL ?? '' }, threshold: DEFAULT_DECIDE_THRESHOLD };
|
|
53
53
|
// without one, metadata borrows the decide role's model, or the chat role's (`StoreModelRoles.get`)
|
|
54
|
-
case 'metadata': return (defaults.
|
|
54
|
+
case 'metadata': return (defaults.FNLOOM_METADATA_MODEL ?? '') === '' ? undefined : { role, model: { model: defaults.FNLOOM_METADATA_MODEL ?? '' } };
|
|
55
55
|
case 'speak': case 'describe': case 'ocr': return undefined;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -6,11 +6,11 @@ import { z } from 'zod';
|
|
|
6
6
|
|
|
7
7
|
/** Query tunables. */
|
|
8
8
|
export const queryEnv = env({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
FNLOOM_QUERY_SCAN: z.number().int().min(100).default(5_000).describe('The most rows a list query reads before filtering, sorting and paging them. Exact, number and date filters and number sorts go to the store first; a query cut by this says partial.'),
|
|
10
|
+
FNLOOM_QUERY_PAGE: z.number().int().min(1).max(200).default(50).describe('The rows a list query returns when it doesn\'t say how many.'),
|
|
11
|
+
FNLOOM_GRAPH_LIMIT: z.number().int().min(10).max(1_000).default(200).describe('The most nodes a graph answer holds when it does not say; past it, neighbours become "+N more" stubs.'),
|
|
12
|
+
FNLOOM_PICK_SCAN: z.number().int().min(50).default(2_000).describe('The most rows a picker reads from one table (fns, context, resources, people) before ranking them by what was typed.'),
|
|
13
|
+
FNLOOM_PICK_LIMIT: z.number().int().min(1).max(50).default(20).describe('The options a picker gets when it does not say how many.'),
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
/** The parsed query tunables. */
|
|
@@ -193,8 +193,8 @@ export function listSources(
|
|
|
193
193
|
const [access, read] = await Promise.all([hub.access.scope(viewer.id), scan]);
|
|
194
194
|
return { ...read, rows: read.rows.filter((row) => sees(access, row)) };
|
|
195
195
|
};
|
|
196
|
-
const max = settings.
|
|
197
|
-
const page = settings.
|
|
196
|
+
const max = settings.FNLOOM_QUERY_SCAN;
|
|
197
|
+
const page = settings.FNLOOM_QUERY_PAGE;
|
|
198
198
|
/** The sessions a viewer owns (a member's model calls are those of their sessions), and whether the read was cut. */
|
|
199
199
|
const ownSessions = (viewer: QueryViewer): Promise<Scan<SessionId>> =>
|
|
200
200
|
mapped(newest(store.table('sessions'), { owner: viewer.id }, [['updatedAt', 'desc']], max), (rows) => rows.map((s) => s.id));
|
|
@@ -325,7 +325,7 @@ export function listSources(
|
|
|
325
325
|
},
|
|
326
326
|
}),
|
|
327
327
|
// the graph's nodes, as the viewer may see them: the graph builds them for the query's text and filters
|
|
328
|
-
graph: new GraphSource({ graph: new HubGraph({ store, catalog: hub.catalog, limit: settings.
|
|
328
|
+
graph: new GraphSource({ graph: new HubGraph({ store, catalog: hub.catalog, limit: settings.FNLOOM_GRAPH_LIMIT }), access: hub.access, page }),
|
|
329
329
|
// SSO: people and groups (admins), the actors table's rows of that kind, all in SQL
|
|
330
330
|
users: new SqlSource({
|
|
331
331
|
list: 'users', table: 'actors', store, access: hub.access, columns: USER_COLUMNS, text: USER_TEXT, page, scan: max,
|
|
@@ -68,7 +68,7 @@ export interface ContextPlansDeps {
|
|
|
68
68
|
* What planning says when there is no embedder. An embedder never comes from a provider configured under Models
|
|
69
69
|
* (OpenRouter, OpenAI): only from a system that offers an embedding model (`index/embedders.ts`).
|
|
70
70
|
*/
|
|
71
|
-
export const EMBEDDER_MISSING = 'an embedder (embedders come only from systems, not from the providers under Models: the embedder system, which starts with the hub when
|
|
71
|
+
export const EMBEDDER_MISSING = 'an embedder (embedders come only from systems, not from the providers under Models: the embedder system, which starts with the hub when FNLOOM_EMBEDDER_URL names an EmbeddingGemma service, or the ollama system with an embedding model named in FNLOOM_EMBEDDER_DOCUMENT and FNLOOM_EMBEDDER_QUERY)';
|
|
72
72
|
|
|
73
73
|
/** Why planning can't run now, said to whoever asked. */
|
|
74
74
|
export class PlanNotReady extends Error {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The background job of context as questions (plan `context-questions`). It works a few items at a time
|
|
3
|
-
* (`
|
|
4
|
-
* work (context or the catalog changed, a model role was set) and every `
|
|
3
|
+
* (`FNLOOM_CONTEXT_METADATA_BATCH`), one pass after another while work remains, whenever something may have given it
|
|
4
|
+
* work (context or the catalog changed, a model role was set) and every `FNLOOM_CONTEXT_METADATA_INTERVAL` besides.
|
|
5
5
|
* Its model calls go on the hub's LLM queue as background work, behind anything a person waits for.
|
|
6
6
|
*
|
|
7
7
|
* Each pass:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Context made from resources, memory, and the context list (`ContextLibrary`).
|
|
3
3
|
*
|
|
4
4
|
* **From a resource**: one item per section of the resource's primary form, under a resource-level parent that
|
|
5
|
-
* holds the outline. A section longer than `
|
|
5
|
+
* holds the outline. A section longer than `FNLOOM_CONTEXT_PIECE_TOKENS` becomes a chain of pieces (`next`), so a
|
|
6
6
|
* small model can take one piece at a time. Each item has `about` edges to the resource (and its section), and the
|
|
7
7
|
* parent has `related` edges to the context made from resources this one links to. Names come from the URI and the
|
|
8
8
|
* section key (`resource/<slug>-<hash>`), so running it again updates the same items, and pieces a shorter section no
|
|
@@ -80,7 +80,7 @@ export interface StoreContextLibraryOptions {
|
|
|
80
80
|
readonly indexer: () => Pick<Indexer, 'upsert' | 'remove'>;
|
|
81
81
|
readonly log: Logger;
|
|
82
82
|
readonly clock: () => number;
|
|
83
|
-
readonly settings: Pick<ResourcesEnv, '
|
|
83
|
+
readonly settings: Pick<ResourcesEnv, 'FNLOOM_CONTEXT_PIECE_TOKENS'>;
|
|
84
84
|
/** The hub's own actor: who rewrites live context when its source changes. */
|
|
85
85
|
readonly hubActor: ActorId;
|
|
86
86
|
/** Told when an item was written, linked or forgotten. */
|
|
@@ -288,7 +288,7 @@ export class StoreContextLibrary implements ContextLibrary {
|
|
|
288
288
|
/** The items of one section: one, or a chain of pieces when it is long. */
|
|
289
289
|
#pieces(section: Section, text: string, at: { args: ContextFromResourceArgs; parent: QualifiedName; name: string; origin: ContextOrigin }): Made[] {
|
|
290
290
|
const { args, parent, origin } = at;
|
|
291
|
-
const maxChars = this.#o.settings.
|
|
291
|
+
const maxChars = this.#o.settings.FNLOOM_CONTEXT_PIECE_TOKENS * CHARS_PER_TOKEN;
|
|
292
292
|
const pieces = piecesOf(text, maxChars);
|
|
293
293
|
const identity = `${args.uri}#${section.key}`;
|
|
294
294
|
const names = pieces.map((_piece, i) => madeName(RESOURCE, `${at.name} ${section.title}${i === 0 ? '' : ` ${i + 1}`}`, i === 0 ? identity : `${identity}~${i + 1}`));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converting raw content with `@aeye/resources`: one shared registry (`createDefaultResourceRegistry`) for the whole
|
|
3
3
|
* hub, so a markdown page looks the same whichever path read it. A converted version is the library's own
|
|
4
|
-
* `ResourceVersion` (core's `ConvertedVersion`), stored as JSON. Tables are capped at `
|
|
4
|
+
* `ResourceVersion` (core's `ConvertedVersion`), stored as JSON. Tables are capped at `FNLOOM_TABLE_ROWS` rows each,
|
|
5
5
|
* with the real counts kept in the version's metadata (`TableCounts`), so a huge sheet never fills a form.
|
|
6
6
|
*/
|
|
7
7
|
import { CODE_TYPES, type ResourceRegistry, type ResourceSource } from '@aeye/resources';
|
|
@@ -35,7 +35,7 @@ export function capTables(version: ConvertedVersion, maxRows: number): Converted
|
|
|
35
35
|
|
|
36
36
|
/** What the library converters need. */
|
|
37
37
|
export interface RegistryConvertersOptions {
|
|
38
|
-
/** Rows kept per table (`
|
|
38
|
+
/** Rows kept per table (`FNLOOM_TABLE_ROWS`). */
|
|
39
39
|
readonly maxRows: number;
|
|
40
40
|
/** The registry to convert with (default: the library's built-ins). */
|
|
41
41
|
readonly registry?: ResourceRegistry;
|