fnloom 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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/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/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 +4 -4
- 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-CDszUbHz.js} +2 -2
- package/packages/web/dist/assets/AdminLayout-CFIz4GsQ.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-BvoVTk6h.js} +2 -2
- package/packages/web/dist/assets/{AutoPairPicker-C61gihmh.js → AutoPairPicker-CLjD-muP.js} +2 -2
- package/packages/web/dist/assets/{BrowserFrame-Sq9EmQRT.js → BrowserFrame-BcN-A76X.js} +2 -2
- package/packages/web/dist/assets/ChatPage-DhTpAyM2.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-K9jrTmFO.js} +2 -2
- package/packages/web/dist/assets/ConfigWithCustom-BvrvSVIp.js +3 -0
- package/packages/web/dist/assets/{ConfirmDialog-Dd3E4sJt.js → ConfirmDialog-BDvLleYf.js} +2 -2
- package/packages/web/dist/assets/{ConnectPage-CX9acyQH.js → ConnectPage-Dg6IPNNh.js} +2 -2
- package/packages/web/dist/assets/ContextItemPage-qisBQetR.js +2 -0
- package/packages/web/dist/assets/ContextPage-DXa6Yqk-.js +3 -0
- package/packages/web/dist/assets/{ContextRow-DrtPumZ5.js → ContextRow-DDYnYRaL.js} +2 -2
- package/packages/web/dist/assets/{DataPage-DDSsxHro.js → DataPage-DOE_pKAY.js} +2 -2
- package/packages/web/dist/assets/DataTypePage-BnP_JELT.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-B9MJbF10.js} +3 -3
- package/packages/web/dist/assets/{ExplorePage-B7ND0W0l.js → ExplorePage-cRDQZRea.js} +2 -2
- package/packages/web/dist/assets/{FnPill-Cp3KuLmP.js → FnPill-CbLZCXYM.js} +2 -2
- package/packages/web/dist/assets/{FnView-C0XZdnsS.js → FnView-CG_wBKTP.js} +2 -2
- package/packages/web/dist/assets/{FnsView-GTH3p7a0.js → FnsView-BybyK12w.js} +2 -2
- package/packages/web/dist/assets/{GinExprView-DGxns6lH.js → GinExprView-BYCKSD_n.js} +2 -2
- package/packages/web/dist/assets/{GinForm-BDBUzuDP.js → GinForm-CXjYVf2_.js} +2 -2
- package/packages/web/dist/assets/{GinTypeView-CUsymbVf.js → GinTypeView-Bmbmx9e_.js} +2 -2
- package/packages/web/dist/assets/{GinValueView-jsKIfiEA.js → GinValueView-CWUzS7ti.js} +2 -2
- package/packages/web/dist/assets/{GraphPage-BCcPPsHu.js → GraphPage-D6OhckfJ.js} +2 -2
- package/packages/web/dist/assets/GraphPanel-BTitgA-K.js +2 -0
- package/packages/web/dist/assets/{HubPicker-EoOErgmk.js → HubPicker-DVly8dLD.js} +2 -2
- package/packages/web/dist/assets/{InboxApprovals-Dkq7DFp_.js → InboxApprovals-BF84edZU.js} +2 -2
- package/packages/web/dist/assets/{InboxPage-CHhslePq.js → InboxPage-DohZ9EDP.js} +2 -2
- package/packages/web/dist/assets/InjectedList-e6qr1kdU.js +2 -0
- package/packages/web/dist/assets/{InstallDialog-D-VwfZYF.js → InstallDialog-JJCKYs2s.js} +2 -2
- package/packages/web/dist/assets/InstanceTypes-BqUzx87o.js +2 -0
- package/packages/web/dist/assets/InstanceView-C73pev7A.js +2 -0
- package/packages/web/dist/assets/{ItemHistory-NQAP69ma.js → ItemHistory-dbGgOZsw.js} +2 -2
- package/packages/web/dist/assets/LimitsView-Ddp5WakY.js +2 -0
- package/packages/web/dist/assets/{ListSearch-BunVrDO0.js → ListSearch-CYNNAuMB.js} +2 -2
- package/packages/web/dist/assets/{LlmCallDetails-BoVNDTVs.js → LlmCallDetails-C9H5Hc2J.js} +2 -2
- package/packages/web/dist/assets/{LlmCallsView-BGpV92RC.js → LlmCallsView-CBqyZ8Cj.js} +2 -2
- package/packages/web/dist/assets/{LoadState-h-K9bTYc.js → LoadState-B2YhZlyC.js} +2 -2
- package/packages/web/dist/assets/McpDialog-DhlLklIq.js +2 -0
- package/packages/web/dist/assets/{McpView-GPXdCMne.js → McpView-D_ZmNO56.js} +2 -2
- package/packages/web/dist/assets/{McpsView-DJIR2JX5.js → McpsView-9_gwBuzw.js} +2 -2
- package/packages/web/dist/assets/{MemoryDialog-BTeIHQyA.js → MemoryDialog-pTHIxKEX.js} +2 -2
- package/packages/web/dist/assets/{ModelCallsView-DMcnwF2S.js → ModelCallsView-FHv2XWRX.js} +2 -2
- package/packages/web/dist/assets/{ModelPicker-CgkMFxSO.js → ModelPicker-EqOuvVnE.js} +2 -2
- package/packages/web/dist/assets/ModelsView-D9UaL4PX.js +2 -0
- package/packages/web/dist/assets/{NotFoundPage-Tk92K7HN.js → NotFoundPage-BsuJysan.js} +2 -2
- package/packages/web/dist/assets/{PairPage-D0BK8CCw.js → PairPage-B_ZXsbL4.js} +2 -2
- package/packages/web/dist/assets/{PanelHost-C-gKrxAk.js → PanelHost-Dx-vNNl5.js} +2 -2
- package/packages/web/dist/assets/PeopleView-D6dmEgMs.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-Bn4rm-ao.js} +2 -2
- package/packages/web/dist/assets/{RefusalList-DVO0bmeB.js → RefusalList-aosRD1ie.js} +2 -2
- package/packages/web/dist/assets/RendererHost-Ym_SMkhp.css +1 -0
- package/packages/web/dist/assets/RendererHost-rjnpSgyQ.js +2 -0
- package/packages/web/dist/assets/{ResourceViewer-Do0chYxU.js → ResourceViewer-C4tRColf.js} +2 -2
- package/packages/web/dist/assets/ResourcesPage-7mCLBORZ.js +2 -0
- package/packages/web/dist/assets/ResultGrid-CL2WSYQH.css +1 -0
- package/packages/web/dist/assets/ResultGrid-GIMoQUAr.js +2 -0
- package/packages/web/dist/assets/{ReviewSummaryStrip-DO3p64Qj.js → ReviewSummaryStrip-Bvjn3Iq8.js} +2 -2
- package/packages/web/dist/assets/ReviewView-DIqsUedT.js +3 -0
- package/packages/web/dist/assets/{RuleRow-DX9v4iGP.js → RuleRow-zRg-e8Vj.js} +2 -2
- package/packages/web/dist/assets/RunCard-C7wOGaw8.js +2 -0
- package/packages/web/dist/assets/RunCard-CSDiz-Nt.css +1 -0
- package/packages/web/dist/assets/{RunDetails-DjR206q6.js → RunDetails-W4GbE6AE.js} +2 -2
- package/packages/web/dist/assets/{RunDot-lHRICdM5.js → RunDot-C46uzzNM.js} +2 -2
- package/packages/web/dist/assets/{RunPage-CbAQ_WPR.js → RunPage-DPLtZpeB.js} +2 -2
- package/packages/web/dist/assets/{RunProgress-C3-B4tQf.js → RunProgress-Cr_6TBaF.js} +2 -2
- package/packages/web/dist/assets/{RunsView-DMkPmkqX.js → RunsView-tU350TPK.js} +2 -2
- package/packages/web/dist/assets/SettingsPage-B8QmmMN3.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-DTwdqlnB.js} +2 -2
- package/packages/web/dist/assets/{StatusBadge-CXne0sRZ.js → StatusBadge-D7wKMAcD.js} +2 -2
- package/packages/web/dist/assets/{StorePlacementStep-B6SwTmdM.js → StorePlacementStep-C04nRU-u.js} +2 -2
- package/packages/web/dist/assets/{SystemConfig-vQDL_eUl.js → SystemConfig-CE3keXWq.js} +2 -2
- package/packages/web/dist/assets/SystemPageHost-CEhz4li8.js +2 -0
- package/packages/web/dist/assets/SystemPageHost-DX7LrFoN.css +1 -0
- package/packages/web/dist/assets/SystemView-CBFzEGfm.js +2 -0
- package/packages/web/dist/assets/SystemsView-0G8JntMV.js +2 -0
- package/packages/web/dist/assets/TableView-BK0uwLHl.js +3 -0
- package/packages/web/dist/assets/TableView-B_4MViVb.css +1 -0
- package/packages/web/dist/assets/{TableViewer-Boxx86f5.js → TableViewer-nbMInGJJ.js} +3 -3
- package/packages/web/dist/assets/{ThemePicker-CIg_oRQX.js → ThemePicker-fZpVSYqG.js} +2 -2
- package/packages/web/dist/assets/{TurnTree-Ecm0yA5g.js → TurnTree-Co-iBqhT.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-CDjUxKY0.js} +6 -6
- package/packages/web/dist/assets/{ValueVisual-C-MWpp7c.js → ValueVisual-EJnCKgSy.js} +2 -2
- package/packages/web/dist/assets/{fn-modal-B98MR7JN.js → fn-modal-DtE65mFt.js} +2 -2
- package/packages/web/dist/assets/{fn-notices-CfTa1E8y.js → fn-notices-CCZ-DFbi.js} +2 -2
- package/packages/web/dist/assets/{formats-JwoKfXIq.js → formats-CyHV2siv.js} +2 -2
- package/packages/web/dist/assets/index-BY7M8QUk.css +1 -0
- package/packages/web/dist/assets/index-OZS2EluT.js +4 -0
- package/packages/web/dist/assets/{labels-BFbk11BE.js → labels-CT7_K0Pt.js} +2 -2
- package/packages/web/dist/assets/{layout-D1gf481r.js → layout-B6fBDg80.js} +2 -2
- package/packages/web/dist/assets/loaded-LaPjk6mK.js +2 -0
- package/packages/web/dist/assets/{metrics-CBPX3W5Y.js → metrics-9n8bKI7u.js} +2 -2
- package/packages/web/dist/assets/problems--AW4igVY.js +2 -0
- package/packages/web/dist/assets/{push-payload-BeU1ADYt.js → push-payload-B3EcrsVz.js} +64 -64
- package/packages/web/dist/assets/record-edits-B-FWAbxR.js +2 -0
- package/packages/web/dist/assets/{review-fP-l9D6H.js → review-uLESCEz1.js} +3 -3
- package/packages/web/dist/assets/routes-B7Zmt8wh.js +4 -0
- package/packages/web/dist/assets/{runs-CveC2kKo.js → runs-CUb2PTFg.js} +2 -2
- package/packages/web/dist/assets/{shared-LbaIHjbV.js → shared-Bxhw_9et.js} +2 -2
- package/packages/web/dist/assets/{sources-VPrtgLIi.js → sources-YgkjgFLe.js} +2 -2
- package/packages/web/dist/assets/src-DY1fSFJS.js +43 -0
- package/packages/web/dist/assets/state-ChQDWWj-.js +2 -0
- package/packages/web/dist/assets/{systems-BqE3WTSF.js → systems-CjwjRySu.js} +2 -2
- package/packages/web/dist/assets/table-host-B_D9dmCz.js +2 -0
- package/packages/web/dist/assets/tables-CaxIuHdw.js +2 -0
- package/packages/web/dist/assets/{ui-BzgWquIU.js → ui-DWjytmDS.js} +5 -5
- package/packages/web/dist/assets/{url-DKGcECT1.js → url-DbGOI14W.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/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/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
|
@@ -50,7 +50,7 @@ export interface SearchDecisionsDeps {
|
|
|
50
50
|
readonly llm: () => Pick<LlmGateway, 'chat'>;
|
|
51
51
|
readonly clock: () => Timestamp;
|
|
52
52
|
readonly log: Pick<Logger, 'info' | 'warn'>;
|
|
53
|
-
readonly tuning: Pick<FnsTuning, '
|
|
53
|
+
readonly tuning: Pick<FnsTuning, 'FNLOOM_SEARCH_DECISION_TIMEOUT'>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/** What the search was for: its text, and the turn's latest user message when it runs inside one. */
|
|
@@ -186,7 +186,7 @@ export class SearchDecisions {
|
|
|
186
186
|
async #judge(item: SearchItemKind, setting: Judging, purpose: SearchPurpose, hits: readonly FnSearchHit[], run: RunId | undefined): Promise<{ kept?: ReadonlySet<FnSearchHit>; filtered: SearchFiltered }> {
|
|
187
187
|
const calls: ModelCallId[] = [];
|
|
188
188
|
const site = { purpose: SEARCH_DECISION_PURPOSES[item], ...(run === undefined ? {} : { run }) };
|
|
189
|
-
const signal = AbortSignal.timeout(this.#deps.tuning.
|
|
189
|
+
const signal = AbortSignal.timeout(this.#deps.tuning.FNLOOM_SEARCH_DECISION_TIMEOUT);
|
|
190
190
|
const withCalls = (): Pick<SearchFiltered, 'calls'> => (calls.length === 0 ? {} : { calls: [...calls] });
|
|
191
191
|
try {
|
|
192
192
|
const judged = setting.by === 'llm'
|
|
@@ -3,20 +3,20 @@ import { env } from '@ayepi/env';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
export const fnsEnv = env({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
FNLOOM_FN_SEARCH_LIMIT: z.number().int().min(1).max(100).default(20).describe('How many fns and context items a search returns when the asker doesn\'t say.'),
|
|
7
|
+
FNLOOM_FN_SEARCH_NICHE_WEIGHT: z.number().min(0).max(1).default(0.5).describe('What the rank of a developer, admin or reference hit is multiplied by when the search does not name its niche (`FnSearchQuery.niches`), so an ordinary request finds what it needs first; 1 ranks it like the rest.'),
|
|
8
|
+
FNLOOM_SEARCH_DECISION_TIMEOUT: z.number().int().min(500).default(15_000).describe('How long the search decision model (or LLM) an admin chose has to filter one page of hits of a kind before every hit is kept.'),
|
|
9
|
+
FNLOOM_SEARCH_LOAD_MAX: z.number().int().min(0).max(20).default(5).describe('With a search decision whose action is `load`, the most kept hits `hub/fns_search` (fns) and `hub/ctx_search` (context) each load into the chat, best first.'),
|
|
10
|
+
FNLOOM_FN_SEARCH_CANDIDATES: z.number().int().min(10).default(5_000).describe('The most items a filtered search ranks by words and meaning; filters that let more through rank the whole index instead.'),
|
|
11
|
+
FNLOOM_FN_PROMPT_EXAMPLES: z.number().int().min(0).max(20).default(2).describe('How many examples of a fn go into the prompt with it when the fn doesn\'t say (`FnDecl.promptExamples`), the most relevant to the turn first.'),
|
|
12
|
+
FNLOOM_FN_EXAMPLES_PAGE: z.number().int().min(1).max(50).default(10).describe('How many examples a `hub/fns_examples` page holds when the asker doesn\'t say.'),
|
|
13
|
+
FNLOOM_FN_ESTIMATE_TIMEOUT: z.number().int().min(100).default(5_000).describe('How long the system of a kind may take to estimate what a fn of the kind costs, before the history is used instead.'),
|
|
14
|
+
FNLOOM_FN_LONG_RUNNING: z.number().int().min(1_000).default(60_000).describe('A fn whose typical run takes longer than this is long-running: the chat says how long it usually takes.'),
|
|
15
|
+
FNLOOM_FN_FACTS_DEPTH: z.number().int().min(1).max(20).default(8).describe('How deep the fns a fn uses are followed when its facts are worked out.'),
|
|
16
|
+
FNLOOM_FN_HISTORY_DAYS: z.number().int().min(1).max(365).default(30).describe('How many days of run history cost and time estimates read.'),
|
|
17
|
+
FNLOOM_AUTO_CLASSIFIER_WAIT: z.number().int().min(1_000).default(20_000).describe('The longest the auto mode classifier is waited for; past it (or on an error) the call waits for the person.'),
|
|
18
|
+
FNLOOM_CLIENT_LOG_MAX_BYTES: z.number().int().min(1_024).default(1_048_576).describe('The largest a person\'s browser log file grows before the next lines start a new one.'),
|
|
19
|
+
FNLOOM_CLIENT_LOG_QUIET: z.number().int().min(1_000).default(300_000).describe('After this long without a line from a person\'s browser, the next line starts a new log file.'),
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
/** The parsed fns tunables. */
|
|
@@ -21,7 +21,7 @@ export interface FnExamplesDeps {
|
|
|
21
21
|
readonly indexer: () => Pick<Indexer, 'upsert' | 'remove'>;
|
|
22
22
|
readonly search: () => Pick<Search, 'search'>;
|
|
23
23
|
readonly clock: () => number;
|
|
24
|
-
readonly tuning: Pick<FnsTuning, '
|
|
24
|
+
readonly tuning: Pick<FnsTuning, 'FNLOOM_FN_EXAMPLES_PAGE' | 'FNLOOM_FN_SEARCH_CANDIDATES'>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/** The text an example is found by: the fn, what it shows, its args and (when given) its result. */
|
|
@@ -64,7 +64,7 @@ export class StoreFnExamples implements FnExamples {
|
|
|
64
64
|
async page(query: FnExamplesQuery, asker: Asker): Promise<FnExamplesPage> {
|
|
65
65
|
const fn = await this.#deps.catalog().fn(query.fn);
|
|
66
66
|
if (fn === undefined || !asker.access.seesFn(fn)) throw reject(404, 'NO_FN', `there is no fn ${query.fn}`);
|
|
67
|
-
const limit = query.limit ?? this.#deps.tuning.
|
|
67
|
+
const limit = query.limit ?? this.#deps.tuning.FNLOOM_FN_EXAMPLES_PAGE;
|
|
68
68
|
const offset = query.offset ?? 0;
|
|
69
69
|
const table = this.#deps.store().table('fnExamples');
|
|
70
70
|
const total = await table.count({ fn: fn.name });
|
|
@@ -102,7 +102,7 @@ export class StoreFnExamples implements FnExamples {
|
|
|
102
102
|
*/
|
|
103
103
|
async #ranked(fn: QualifiedName, text: string, limit: number): Promise<FnExamplesPage['items']> {
|
|
104
104
|
const table = this.#deps.store().table('fnExamples');
|
|
105
|
-
const cap = this.#deps.tuning.
|
|
105
|
+
const cap = this.#deps.tuning.FNLOOM_FN_SEARCH_CANDIDATES;
|
|
106
106
|
const ids = (await table.find({ where: { fn }, order: [['order', 'asc']], limit: cap + 1 })).items;
|
|
107
107
|
if (ids.length === 0) return [];
|
|
108
108
|
const found = new Map<string, FnExampleRecord>(ids.length > cap ? [] : ids.map((row) => [row.id, row]));
|
|
@@ -35,7 +35,7 @@ export interface FnFactsDeps {
|
|
|
35
35
|
/** The estimators, asked in order (`costs.ts`). */
|
|
36
36
|
readonly estimators: readonly CostEstimator[];
|
|
37
37
|
readonly clock: () => number;
|
|
38
|
-
readonly tuning: Pick<FnsTuning, '
|
|
38
|
+
readonly tuning: Pick<FnsTuning, 'FNLOOM_FN_FACTS_DEPTH' | 'FNLOOM_FN_LONG_RUNNING' | 'FNLOOM_FN_HISTORY_DAYS'>;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** A fn's own facts, before what it uses is folded in. */
|
|
@@ -85,7 +85,7 @@ export class StoreFnFacts implements FnFactsService {
|
|
|
85
85
|
const fn = await this.#deps.catalog().fn(name);
|
|
86
86
|
if (fn === undefined) throw new Error(`there is no fn ${name}`);
|
|
87
87
|
const stored = await this.#stored(fn);
|
|
88
|
-
const history = await this.#deps.metrics().days(fn.name, this.#deps.tuning.
|
|
88
|
+
const history = await this.#deps.metrics().days(fn.name, this.#deps.tuning.FNLOOM_FN_HISTORY_DAYS);
|
|
89
89
|
const cost = await estimateCost(this.#deps.estimators, { fn, free: stored.free, args, history });
|
|
90
90
|
const times = runTimes(history);
|
|
91
91
|
const notice = this.#notice(fn.name, times);
|
|
@@ -99,7 +99,7 @@ export class StoreFnFacts implements FnFactsService {
|
|
|
99
99
|
async notices(fns: readonly QualifiedName[]): Promise<ReadonlyMap<QualifiedName, string>> {
|
|
100
100
|
const out = new Map<QualifiedName, string>();
|
|
101
101
|
for (const name of new Set(fns)) {
|
|
102
|
-
const notice = this.#notice(name, runTimes(await this.#deps.metrics().days(name, this.#deps.tuning.
|
|
102
|
+
const notice = this.#notice(name, runTimes(await this.#deps.metrics().days(name, this.#deps.tuning.FNLOOM_FN_HISTORY_DAYS)));
|
|
103
103
|
if (notice !== undefined) out.set(name, notice);
|
|
104
104
|
}
|
|
105
105
|
return out;
|
|
@@ -107,7 +107,7 @@ export class StoreFnFacts implements FnFactsService {
|
|
|
107
107
|
|
|
108
108
|
/** The long-running warning of a fn whose typical run time is over the limit; undefined for one that runs quickly. */
|
|
109
109
|
#notice(name: QualifiedName, times: RunTimes | undefined): string | undefined {
|
|
110
|
-
return times !== undefined && times.typical > this.#deps.tuning.
|
|
110
|
+
return times !== undefined && times.typical > this.#deps.tuning.FNLOOM_FN_LONG_RUNNING ? `${name} usually takes ${aboutDuration(times.typical)}.` : undefined;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
async modes(fns: readonly QualifiedName[]): Promise<ReadonlyMap<QualifiedName, FnMode>> {
|
|
@@ -164,7 +164,7 @@ export class StoreFnFacts implements FnFactsService {
|
|
|
164
164
|
const registry = [...own.registry];
|
|
165
165
|
const seen = new Set<QualifiedName>([fn.name]);
|
|
166
166
|
let next = [...own.uses];
|
|
167
|
-
for (let depth = 0; depth < this.#deps.tuning.
|
|
167
|
+
for (let depth = 0; depth < this.#deps.tuning.FNLOOM_FN_FACTS_DEPTH && next.length > 0; depth++) {
|
|
168
168
|
const later: QualifiedName[] = [];
|
|
169
169
|
for (const name of next) {
|
|
170
170
|
if (seen.has(name)) continue;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* found it (`matched`: words, meaning or both).
|
|
13
13
|
*
|
|
14
14
|
* Developer, admin and reference material (`Niche`, `nicheOf`: the authoring guides, admin fns, API listings) ranks
|
|
15
|
-
* below the rest: its rank is multiplied by `
|
|
15
|
+
* below the rest: its rank is multiplied by `FNLOOM_FN_SEARCH_NICHE_WEIGHT` unless the query names its niche
|
|
16
16
|
* (`niches`), so an ordinary request finds the fns and guides it needs first; it stays searchable. A model's search
|
|
17
17
|
* (`Asker.forModel`) never finds a fn whose visibility leaves the model out, since it could never load it.
|
|
18
18
|
*/
|
|
@@ -38,7 +38,7 @@ export interface FnSearchDeps {
|
|
|
38
38
|
readonly search: () => Pick<Search, 'search'>;
|
|
39
39
|
readonly views: () => Pick<FnViewSource, 'view'>;
|
|
40
40
|
readonly access: () => Pick<AccessService, 'sharing'>;
|
|
41
|
-
readonly tuning: Pick<FnsTuning, '
|
|
41
|
+
readonly tuning: Pick<FnsTuning, 'FNLOOM_FN_SEARCH_LIMIT' | 'FNLOOM_FN_SEARCH_CANDIDATES' | 'FNLOOM_FN_SEARCH_NICHE_WEIGHT'>;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/** An item the filters let through. */
|
|
@@ -103,7 +103,7 @@ export class StoreFnSearch implements FnSearch {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
async search(query: FnSearchQuery, asker: Asker): Promise<FnSearchPage> {
|
|
106
|
-
const limit = query.limit ?? this.#deps.tuning.
|
|
106
|
+
const limit = query.limit ?? this.#deps.tuning.FNLOOM_FN_SEARCH_LIMIT;
|
|
107
107
|
const offset = query.offset ?? 0;
|
|
108
108
|
// the context list's filters and memory scopes match context only, and the fn-only filters fns only
|
|
109
109
|
const items: SearchItemKind[] = (query.items ?? ['fn', 'context']).filter((item) => (item === 'fn' ? !contextOnly(query) : !fnOnly(query)));
|
|
@@ -126,7 +126,7 @@ export class StoreFnSearch implements FnSearch {
|
|
|
126
126
|
*/
|
|
127
127
|
async #candidates(query: FnSearchQuery, items: readonly SearchItemKind[]): Promise<Candidate[] | undefined> {
|
|
128
128
|
if (query.systems === undefined && query.names === undefined && query.filters === undefined && !fnOnly(query)) return undefined;
|
|
129
|
-
const cap = this.#deps.tuning.
|
|
129
|
+
const cap = this.#deps.tuning.FNLOOM_FN_SEARCH_CANDIDATES;
|
|
130
130
|
const store = this.#deps.store();
|
|
131
131
|
const out: Candidate[] = [];
|
|
132
132
|
if (items.includes('fn')) {
|
|
@@ -225,7 +225,7 @@ export class StoreFnSearch implements FnSearch {
|
|
|
225
225
|
const out: FnSearchHit[] = [];
|
|
226
226
|
// a context item found by its text and by its sections counts once, at its best
|
|
227
227
|
const seen = new Set<string>();
|
|
228
|
-
const weight = this.#deps.tuning.
|
|
228
|
+
const weight = this.#deps.tuning.FNLOOM_FN_SEARCH_NICHE_WEIGHT;
|
|
229
229
|
// niche hits move down the order, so more are ranked than the page needs and the best kept after
|
|
230
230
|
const pool = weight < 1 ? wanted * NICHE_POOL : wanted;
|
|
231
231
|
await this.#deps.search().search({
|
|
@@ -34,7 +34,7 @@ import type { FieldAccessors } from '../query/index.ts';
|
|
|
34
34
|
export interface GraphDeps {
|
|
35
35
|
readonly store: HubStore;
|
|
36
36
|
readonly catalog: Pick<Catalog, 'manifest'>;
|
|
37
|
-
/** The most nodes an answer holds when the query doesn't say (`
|
|
37
|
+
/** The most nodes an answer holds when the query doesn't say (`FNLOOM_GRAPH_LIMIT`). */
|
|
38
38
|
readonly limit: number;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A context item's sections: its indexed text (`contextText`) cut at its markdown headings by `@aeye/resources`
|
|
3
3
|
* (`splitMarkdownSections`, fenced code skipped), each keyed by its heading path through the SDK's `sectionKeys`, as
|
|
4
4
|
* resources are (`hub/headings`). Each heading section is indexed as its own `contextSection` item under its context
|
|
5
|
-
* (`IndexEntry.parent`), so search finds content past the item's own indexed text (`
|
|
5
|
+
* (`IndexEntry.parent`), so search finds content past the item's own indexed text (`FNLOOM_INDEX_MAX_TEXT`) and a hit
|
|
6
6
|
* says which section matched. The text before the first heading is the item's own; an item with no headings has no
|
|
7
7
|
* sections, its whole text being the item.
|
|
8
8
|
*/
|
|
@@ -130,11 +130,11 @@ export interface SystemEmbeddersOptions {
|
|
|
130
130
|
readonly offered: Pick<OfferedProviders, 'list' | 'watch'>;
|
|
131
131
|
readonly bus: Pick<EventBus, 'publish'>;
|
|
132
132
|
readonly log: Logger;
|
|
133
|
-
/** The embedder that embeds what is stored (`modelEnv.
|
|
133
|
+
/** The embedder that embeds what is stored (`modelEnv.FNLOOM_EMBEDDER_DOCUMENT`). */
|
|
134
134
|
readonly document: QualifiedName;
|
|
135
|
-
/** The embedder that embeds what is searched for (`modelEnv.
|
|
135
|
+
/** The embedder that embeds what is searched for (`modelEnv.FNLOOM_EMBEDDER_QUERY`). */
|
|
136
136
|
readonly query: QualifiedName;
|
|
137
|
-
/** Inputs per embed call (`modelEnv.
|
|
137
|
+
/** Inputs per embed call (`modelEnv.FNLOOM_EMBED_BATCH`). */
|
|
138
138
|
readonly batch: number;
|
|
139
139
|
/** The hub's AI, looked up when an embed is made (the execution module's LLM gateway; undefined until it is built). */
|
|
140
140
|
readonly ai: () => HubEmbeds | undefined;
|
|
@@ -7,18 +7,18 @@ import { z } from 'zod';
|
|
|
7
7
|
import { MAX_PICTURE_BYTES } from './indexer.ts';
|
|
8
8
|
|
|
9
9
|
export const indexEnv = env({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
FNLOOM_EMBED_WAIT: z.number().int().min(0).default(15).describe('How long an embed batch waits for more texts after its first before it is sent.'),
|
|
11
|
+
FNLOOM_EMBED_POLL: z.number().int().min(1).default(10).describe('How often the embed queues look for new texts.'),
|
|
12
|
+
FNLOOM_EMBED_INTERACTIVE: z.number().int().min(1).default(2).describe('How many embed batches for people and agents waiting now (search, suggestions) run at once.'),
|
|
13
|
+
FNLOOM_EMBED_BACKGROUND: z.number().int().min(1).default(1).describe('How many embed batches for indexing and systems run at once; the rest wait, so the embedder stays free for people.'),
|
|
14
|
+
FNLOOM_INDEX_MAX_TEXT: z.number().int().min(100).default(4_000).describe('The most characters of a section, fn or context that are embedded.'),
|
|
15
|
+
FNLOOM_SEARCH_OVERFETCH: z.number().int().min(1).default(3).describe('How many extra candidates search asks for when it filters by system.'),
|
|
16
|
+
FNLOOM_SEARCH_EMBED_WAIT: z.number().int().min(0).default(4_000).describe('The longest search waits for its query\'s embedding (a busy embedder may be indexing) before it searches by words alone.'),
|
|
17
|
+
FNLOOM_INDEX_EMBED_BATCH: z.number().int().min(1).default(16).describe('How many index rows are embedded and saved together in a catch-up (at most FNLOOM_EMBED_BATCH, so a chunk is one embed call); each chunk is saved as it lands, so a failure loses at most one, and a failure halves the next chunks until a catch-up gets through. Small enough that a busy embedder answers one within its timeout.'),
|
|
18
|
+
FNLOOM_INDEX_RETRY: z.number().int().min(1).default(5_000).describe('How long after a failed embedding the index first tries again; the wait doubles after each failure.'),
|
|
19
|
+
FNLOOM_INDEX_RETRY_MOST: z.number().int().min(1).default(300_000).describe('The longest the index waits before trying a failed embedding again.'),
|
|
20
|
+
FNLOOM_INDEX_IMAGE_MAX: z.number().int().min(1).default(MAX_PICTURE_BYTES).describe('The most bytes of a picture the image space embeds; a larger one is indexed by its caption alone.'),
|
|
21
|
+
FNLOOM_INDEX_CRAWL_MAX: z.number().int().min(1).default(20_000).describe('The most resources one crawl of a root (on connect, for roots that index everything) looks at.'),
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
/** The parsed index tunables. */
|
|
@@ -107,7 +107,7 @@ export interface PrimaryText {
|
|
|
107
107
|
export interface IndexReader {
|
|
108
108
|
/** The system that serves a URI and its root's index policy, or undefined when nothing serves it. */
|
|
109
109
|
route(uri: ResourceUri): { system: SystemName; index: ResourceRoot['index'] } | undefined;
|
|
110
|
-
/** A resource's text in its primary form. Never spends on a model unless the hub is set to (`
|
|
110
|
+
/** A resource's text in its primary form. Never spends on a model unless the hub is set to (`FNLOOM_DESCRIBE_ON_INDEX`). */
|
|
111
111
|
primary(uri: ResourceUri, signal?: AbortSignal): Promise<PrimaryText>;
|
|
112
112
|
/** An image resource's bytes and type, for the image space (undefined when it isn't an image or can't be read). */
|
|
113
113
|
picture?(uri: ResourceUri, signal?: AbortSignal): Promise<{ readonly bytes: Uint8Array; readonly mime: string } | undefined>;
|
|
@@ -62,15 +62,15 @@ export interface IndexerOptions {
|
|
|
62
62
|
readonly maxText: number;
|
|
63
63
|
/** The most resources one crawl of a root looks at. */
|
|
64
64
|
readonly maxCrawl: number;
|
|
65
|
-
/** Rows embedded and saved together (`
|
|
65
|
+
/** Rows embedded and saved together (`FNLOOM_INDEX_EMBED_BATCH`): one embedder call's worth per chunk at most. */
|
|
66
66
|
readonly chunk: number;
|
|
67
67
|
/** How long after a failed embedding a backfill is tried again, at first and at most (it doubles between). */
|
|
68
68
|
readonly retry: { readonly first: number; readonly most: number };
|
|
69
|
-
/** The most bytes of a picture that are embedded (`
|
|
69
|
+
/** The most bytes of a picture that are embedded (`FNLOOM_INDEX_IMAGE_MAX`); a larger one is left out. */
|
|
70
70
|
readonly maxPicture?: number;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
/** The most bytes of a picture embedded when the options don't say (`
|
|
73
|
+
/** The most bytes of a picture embedded when the options don't say (`FNLOOM_INDEX_IMAGE_MAX`'s default). */
|
|
74
74
|
export const MAX_PICTURE_BYTES = 5_000_000;
|
|
75
75
|
|
|
76
76
|
/** The kinds that are parts of a context item (`IndexEntry.parent`): found, kept current and dropped with it. */
|
|
@@ -514,7 +514,7 @@ export class StoreIndexer implements Indexer {
|
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
/**
|
|
517
|
-
* Embed rows, a bounded chunk at a time (`chunk`, `
|
|
517
|
+
* Embed rows, a bounded chunk at a time (`chunk`, `FNLOOM_INDEX_EMBED_BATCH`, halved after a failure): text with the document embedder, if
|
|
518
518
|
* it is connected, and pictures with the image space's, if there is one. Each chunk's vectors are saved (and its rows
|
|
519
519
|
* marked embedded) as it lands. Embedding runs one call of this at a time, so a catch-up and the upserts beside it
|
|
520
520
|
* never flood the embedder, and a row embedded meanwhile is skipped. A row given a vector of the wrong size, or a
|
|
@@ -37,7 +37,7 @@ export interface IndexSearchOptions {
|
|
|
37
37
|
readonly document: QualifiedName;
|
|
38
38
|
/** How many times more candidates to ask for when results are filtered by system. */
|
|
39
39
|
readonly overfetch: number;
|
|
40
|
-
/** The longest the query's embedding is waited for, in ms (`
|
|
40
|
+
/** The longest the query's embedding is waited for, in ms (`FNLOOM_SEARCH_EMBED_WAIT`). */
|
|
41
41
|
readonly embedWait: number;
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -70,13 +70,13 @@ export function contextItem(record: ContextRecord): IndexItem {
|
|
|
70
70
|
export function wordsFnSearch(store: HubStore, catalog: Pick<Catalog, 'fn' | 'context'>): { search: StoreFnSearch; stop: () => Promise<void> } {
|
|
71
71
|
const { log } = memoryLog();
|
|
72
72
|
const batcher = new EmbedBatcher({ embedders: NO_EMBEDDERS, log, size: 8, wait: 1, poll: 2, concurrency: { interactive: 1, background: 1 } });
|
|
73
|
-
const hybrid = new HybridSearch({ vectors: store.vectors, text: store.text }, {
|
|
73
|
+
const hybrid = new HybridSearch({ vectors: store.vectors, text: store.text }, { FNLOOM_SEARCH_RRF_K: 60, FNLOOM_SEARCH_DEPTH: 4 });
|
|
74
74
|
const index = new IndexSearch({ store, hybrid, embedders: NO_EMBEDDERS, batcher, log, document: TEST_DOCUMENT, overfetch: 3, embedWait: 50 });
|
|
75
75
|
const views: Pick<FnViewSource, 'view'> = { view: () => Promise.resolve(undefined) };
|
|
76
76
|
const access: Pick<AccessService, 'sharing'> = { sharing: () => Promise.resolve({ owner: ActorId.parse('act_hub'), visibility: 'public', with: [] }) };
|
|
77
77
|
const search = new StoreFnSearch({
|
|
78
78
|
store: () => store, catalog: () => catalog, search: () => index, views: () => views, access: () => access,
|
|
79
|
-
tuning: {
|
|
79
|
+
tuning: { FNLOOM_FN_SEARCH_LIMIT: 20, FNLOOM_FN_SEARCH_CANDIDATES: 100, FNLOOM_FN_SEARCH_NICHE_WEIGHT: 0.5 },
|
|
80
80
|
});
|
|
81
81
|
return { search, stop: () => batcher.stop() };
|
|
82
82
|
}
|
|
@@ -58,12 +58,12 @@ import { StoreDrivers, type DriverInstaller } from '../stores/drivers.ts';
|
|
|
58
58
|
|
|
59
59
|
/** The settings the system side reads, from the env slices. */
|
|
60
60
|
export interface SystemsSettings {
|
|
61
|
-
readonly hub: Pick<HubSettings['hubEnv'], '
|
|
61
|
+
readonly hub: Pick<HubSettings['hubEnv'], 'FNLOOM_URL' | 'FNLOOM_SYSTEMS_DIR' | 'FNLOOM_STORES_DIR' | 'FNLOOM_STORE_DRIVERS_DIR'>;
|
|
62
62
|
readonly link: HubSettings['linkEnv'];
|
|
63
63
|
readonly packaging: PackagingEnv;
|
|
64
|
-
readonly model: Pick<HubSettings['modelEnv'], '
|
|
64
|
+
readonly model: Pick<HubSettings['modelEnv'], 'FNLOOM_EMBEDDER_DOCUMENT' | 'FNLOOM_EMBEDDER_QUERY' | 'FNLOOM_EMBED_BATCH'>;
|
|
65
65
|
readonly index: IndexTuning;
|
|
66
|
-
readonly search: Pick<StoreTuning, '
|
|
66
|
+
readonly search: Pick<StoreTuning, 'FNLOOM_SEARCH_RRF_K' | 'FNLOOM_SEARCH_DEPTH'>;
|
|
67
67
|
readonly review: ReviewEnv;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -107,8 +107,8 @@ export function linkUrl(hubUrl: string): string {
|
|
|
107
107
|
/** Build the catalog, link and index services, wired to each other. */
|
|
108
108
|
export function buildSystems(options: SystemsOptions) {
|
|
109
109
|
const { store, bus, log, clock, settings, tokens } = options;
|
|
110
|
-
const document = QualifiedName.parse(settings.model.
|
|
111
|
-
const query = QualifiedName.parse(settings.model.
|
|
110
|
+
const document = QualifiedName.parse(settings.model.FNLOOM_EMBEDDER_DOCUMENT);
|
|
111
|
+
const query = QualifiedName.parse(settings.model.FNLOOM_EMBEDDER_QUERY);
|
|
112
112
|
|
|
113
113
|
const connections = new PeerLinkService({ log, clock, ...(options.peers === undefined ? {} : { peers: options.peers }) });
|
|
114
114
|
// every kind is described by its system over the link (the hub's own kinds need no description)
|
|
@@ -117,40 +117,40 @@ export function buildSystems(options: SystemsOptions) {
|
|
|
117
117
|
const instances = new InstanceKeeper({ store, bus, catalog, links: connections });
|
|
118
118
|
const configSecrets = new ConfigSecretKeeper(options.secrets);
|
|
119
119
|
const autoPairs = new StoreAutoPairs({
|
|
120
|
-
store, log, clock, rate: store.ports.rate, limit: settings.packaging.
|
|
121
|
-
expiry: settings.packaging.
|
|
120
|
+
store, log, clock, rate: store.ports.rate, limit: settings.packaging.FNLOOM_AUTO_PAIR_LIMIT, window: settings.packaging.FNLOOM_AUTO_PAIR_WINDOW,
|
|
121
|
+
expiry: settings.packaging.FNLOOM_AUTO_PAIR_EXPIRY,
|
|
122
122
|
});
|
|
123
123
|
const lifecycle = new SystemLifecycle({ store, catalog, bus, log, clock, settings: settings.review, resources: () => resources });
|
|
124
124
|
const pairing = new StorePairingService({
|
|
125
125
|
firstStage: () => lifecycle.firstStage, keepChecks: (system, checks) => lifecycle.setChecks(system, checks),
|
|
126
|
-
store, bus, log, clock, instances, autoPairs, timeout: settings.link.
|
|
127
|
-
grantTtl: settings.link.
|
|
126
|
+
store, bus, log, clock, instances, autoPairs, timeout: settings.link.FNLOOM_PAIRING_TIMEOUT, publicUrl: settings.packaging.FNLOOM_PUBLIC_URL,
|
|
127
|
+
grantTtl: settings.link.FNLOOM_PAIRING_GRANT_TTL, fn: (name) => catalog.fn(name),
|
|
128
128
|
check: (system, type, value) => catalog.check(system, type, value),
|
|
129
129
|
configType: async (system) => (await catalog.manifest(system))?.config,
|
|
130
130
|
configSecrets: async (system) => (await catalog.manifest(system))?.configSecrets, secrets: configSecrets,
|
|
131
131
|
});
|
|
132
132
|
const config = new StoreConfigService({ log, clock, catalog, bus, links: connections, instances, secrets: configSecrets });
|
|
133
|
-
const resources = new PeerResourceRouter({ links: connections, catalog, bus, log, maxChunk: settings.link.
|
|
134
|
-
const admin = new StoreSystemAdmin({ store, log, catalog, links: connections, instances, autoPairs, stopTimeout: settings.link.
|
|
133
|
+
const resources = new PeerResourceRouter({ links: connections, catalog, bus, log, maxChunk: settings.link.FNLOOM_MAX_CHUNK });
|
|
134
|
+
const admin = new StoreSystemAdmin({ store, log, catalog, links: connections, instances, autoPairs, stopTimeout: settings.link.FNLOOM_STOP_TIMEOUT, storeBackups: () => storeBackups });
|
|
135
135
|
const grants = new SystemGrantGuard({ store, catalog, bus, log, clock, admin: () => admin, settings: settings.review });
|
|
136
136
|
const router = new FleetRouter({ links: connections, resources, store, instances });
|
|
137
137
|
const npmInstaller = new NodeInstaller({
|
|
138
|
-
npm: settings.packaging.
|
|
138
|
+
npm: settings.packaging.FNLOOM_NPM, maxBytes: settings.packaging.FNLOOM_PACKAGE_MAX, zips: { bytes: (hash) => contentBytes(options.content(), hash) },
|
|
139
139
|
});
|
|
140
140
|
const installer = options.installer ?? npmInstaller;
|
|
141
141
|
// the Postgres and SQL Server drivers, installed when a store is placed in one (the base package leaves them out)
|
|
142
|
-
const drivers = new StoreDrivers({ dir: settings.hub.
|
|
142
|
+
const drivers = new StoreDrivers({ dir: settings.hub.FNLOOM_STORE_DRIVERS_DIR, installer: options.driverInstaller ?? npmInstaller, log });
|
|
143
143
|
// system stores: the files the hub keeps for stores placed on it, each instance's store state, and holding calls
|
|
144
|
-
const storeHost = new SystemStoreHost({ dir: settings.hub.
|
|
144
|
+
const storeHost = new SystemStoreHost({ dir: settings.hub.FNLOOM_STORES_DIR, log, clock, lease: settings.packaging.FNLOOM_STORE_LEASE });
|
|
145
145
|
const stores = new SystemStores({
|
|
146
|
-
host: storeHost, catalog, instances, links: connections, vault: options.secrets, log, clock, hold: settings.packaging.
|
|
146
|
+
host: storeHost, catalog, instances, links: connections, vault: options.secrets, log, clock, hold: settings.packaging.FNLOOM_STORE_HOLD, drivers,
|
|
147
147
|
});
|
|
148
148
|
connections.holdWith((ref, endpoint) => stores.hold(ref, endpoint));
|
|
149
149
|
// the catalog's own re-describing never waits on a store getting ready: that would wait on itself (`describer.ts`)
|
|
150
150
|
describer.unreachableWhile((ref) => stores.holding(ref));
|
|
151
151
|
// moving a store between placements, and its backups (old copies, and stores kept when an instance was removed)
|
|
152
152
|
const moves = new StoreMoves({
|
|
153
|
-
stores, host: storeHost, catalog, instances, links: connections, vault: options.secrets, log, clock, drain: settings.packaging.
|
|
153
|
+
stores, host: storeHost, catalog, instances, links: connections, vault: options.secrets, log, clock, drain: settings.packaging.FNLOOM_STORE_MOVE_DRAIN, drivers,
|
|
154
154
|
runs: () => {
|
|
155
155
|
const runs = options.runs?.();
|
|
156
156
|
if (runs === undefined) { throw new Error('the hub has no run service yet'); }
|
|
@@ -163,8 +163,8 @@ export function buildSystems(options: SystemsOptions) {
|
|
|
163
163
|
const supervisor = new ProcessSupervisor({
|
|
164
164
|
store, log, clock, links: connections, pairing, config, instances, launcher: options.launcher, installer, network: grantedNetwork(grants, bus), stores,
|
|
165
165
|
settings: {
|
|
166
|
-
systemsDir: settings.hub.
|
|
167
|
-
backoff: settings.link.
|
|
166
|
+
systemsDir: settings.hub.FNLOOM_SYSTEMS_DIR, hubLink: linkUrl(settings.hub.FNLOOM_URL), stopTimeout: settings.link.FNLOOM_STOP_TIMEOUT, storeDrivers: drivers.dir,
|
|
167
|
+
backoff: settings.link.FNLOOM_RESTART_BACKOFF, perHour: settings.link.FNLOOM_RESTARTS_PER_HOUR, maxBackoff: settings.link.FNLOOM_RESTART_BACKOFF_MAX,
|
|
168
168
|
},
|
|
169
169
|
});
|
|
170
170
|
|
|
@@ -173,40 +173,40 @@ export function buildSystems(options: SystemsOptions) {
|
|
|
173
173
|
// where images are embedded: the admin's setting, which the embedders read at each refresh
|
|
174
174
|
const images: ImageEmbeddingSettings = new ImageEmbeddingSettings({ store, clock, document, embedders: () => embedders });
|
|
175
175
|
const embedders: SystemEmbedders = new SystemEmbedders({
|
|
176
|
-
offered, connections, bus, log, document, query, batch: settings.model.
|
|
176
|
+
offered, connections, bus, log, document, query, batch: settings.model.FNLOOM_EMBED_BATCH, ai: () => options.ai?.(),
|
|
177
177
|
imageSetting: () => images.value(),
|
|
178
178
|
});
|
|
179
179
|
const batcher = new EmbedBatcher({
|
|
180
|
-
embedders, log, size: settings.model.
|
|
181
|
-
concurrency: { interactive: settings.index.
|
|
180
|
+
embedders, log, size: settings.model.FNLOOM_EMBED_BATCH, wait: settings.index.FNLOOM_EMBED_WAIT, poll: settings.index.FNLOOM_EMBED_POLL,
|
|
181
|
+
concurrency: { interactive: settings.index.FNLOOM_EMBED_INTERACTIVE, background: settings.index.FNLOOM_EMBED_BACKGROUND },
|
|
182
182
|
});
|
|
183
183
|
const sectioning = new Sectioning({ store, catalog, router: resources });
|
|
184
|
-
const indexer = new StoreIndexer({ store, bus, log, clock, catalog, embedders, batcher, router: resources, sectioning, document, maxText: settings.index.
|
|
184
|
+
const indexer = new StoreIndexer({ store, bus, log, clock, catalog, embedders, batcher, router: resources, sectioning, document, maxText: settings.index.FNLOOM_INDEX_MAX_TEXT, maxCrawl: settings.index.FNLOOM_INDEX_CRAWL_MAX,
|
|
185
185
|
// a chunk is one embed call: a bigger one would be split into calls that keep running after the first fails
|
|
186
|
-
chunk: Math.min(settings.index.
|
|
187
|
-
retry: { first: settings.index.
|
|
186
|
+
chunk: Math.min(settings.index.FNLOOM_INDEX_EMBED_BATCH, settings.model.FNLOOM_EMBED_BATCH),
|
|
187
|
+
retry: { first: settings.index.FNLOOM_INDEX_RETRY, most: settings.index.FNLOOM_INDEX_RETRY_MOST }, maxPicture: settings.index.FNLOOM_INDEX_IMAGE_MAX,
|
|
188
188
|
});
|
|
189
189
|
const hybrid = new HybridSearch({ vectors: store.vectors, text: store.text }, settings.search);
|
|
190
|
-
const search = new IndexSearch({ store, hybrid, embedders, batcher, log, document, overfetch: settings.index.
|
|
190
|
+
const search = new IndexSearch({ store, hybrid, embedders, batcher, log, document, overfetch: settings.index.FNLOOM_SEARCH_OVERFETCH, embedWait: settings.index.FNLOOM_SEARCH_EMBED_WAIT });
|
|
191
191
|
const suggest = new IndexSuggester({ store, catalog, search });
|
|
192
192
|
|
|
193
193
|
const packages = new HubPackages({
|
|
194
|
-
content: options.content, supervisor, admin, instances, links: connections, config, exportTimeout: settings.link.
|
|
195
|
-
maxBytes: settings.packaging.
|
|
194
|
+
content: options.content, supervisor, admin, instances, links: connections, config, exportTimeout: settings.link.FNLOOM_STOP_TIMEOUT, log, clock, storeBackups: () => storeBackups,
|
|
195
|
+
maxBytes: settings.packaging.FNLOOM_PACKAGE_MAX,
|
|
196
196
|
});
|
|
197
197
|
|
|
198
198
|
// where a socket comes from, by the admin's proxy setting, for the pairing limits and the socket caps
|
|
199
199
|
const address = (req: Request): Promise<string> => clientAddress(req, store);
|
|
200
200
|
const pairingLimits = new PairingLimits({
|
|
201
|
-
perAddress: settings.link.
|
|
201
|
+
perAddress: settings.link.FNLOOM_PAIRING_LIMIT, total: settings.link.FNLOOM_PAIRING_LIMIT_TOTAL, window: settings.link.FNLOOM_PAIRING_WINDOW, clock, log, rate: store.ports.rate,
|
|
202
202
|
});
|
|
203
203
|
const gate = new LinkGate({
|
|
204
|
-
log, peers: connections.peers, address, perAddress: settings.link.
|
|
205
|
-
helloTimeout: settings.link.
|
|
204
|
+
log, peers: connections.peers, address, perAddress: settings.link.FNLOOM_LINK_UNLINKED_PER_ADDRESS, total: settings.link.FNLOOM_LINK_UNLINKED_MAX,
|
|
205
|
+
helloTimeout: settings.link.FNLOOM_LINK_HELLO_TIMEOUT, linkTimeout: settings.link.FNLOOM_PAIRING_TIMEOUT,
|
|
206
206
|
});
|
|
207
207
|
const handshake = new LinkHandshake({
|
|
208
208
|
log, clock, catalog, links: connections, pairing, autoPairs, config, instances, tokens, resources, output, lifecycle, grants, bus, address, pairingLimits, gate, stores,
|
|
209
|
-
limits: { maxFrame: settings.link.
|
|
209
|
+
limits: { maxFrame: settings.link.FNLOOM_MAX_FRAME, maxChunk: settings.link.FNLOOM_MAX_CHUNK, heartbeat: settings.link.FNLOOM_HEARTBEAT },
|
|
210
210
|
});
|
|
211
211
|
|
|
212
212
|
let stopIndexer: (() => void) | undefined;
|
|
@@ -239,7 +239,7 @@ export function buildSystems(options: SystemsOptions) {
|
|
|
239
239
|
/** Stop installed systems, ask the rest to stop, and stop the index's work. */
|
|
240
240
|
async stop(): Promise<void> {
|
|
241
241
|
await supervisor.stopAll('shutdown');
|
|
242
|
-
await connections.stopAll('shutdown', settings.link.
|
|
242
|
+
await connections.stopAll('shutdown', settings.link.FNLOOM_STOP_TIMEOUT);
|
|
243
243
|
stopIndexer?.();
|
|
244
244
|
stopOutput?.();
|
|
245
245
|
relay.stop();
|
|
@@ -7,24 +7,24 @@ import { STORE_HOLD, STORE_LEASE, STORE_MOVE_DRAIN } from '@harness/core';
|
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
|
|
9
9
|
export const packagingEnv = env({
|
|
10
|
-
|
|
10
|
+
FNLOOM_PUBLIC_URL: z.url().optional().describe(
|
|
11
11
|
'The hub as a phone or another machine reaches it, for pairing links and QR codes (`https://hub.example`). Unset: built from the address the system used to reach the hub.',
|
|
12
12
|
),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
FNLOOM_AUTO_PAIR_LIMIT: z.number().int().min(1).default(10).describe('Most auto-pair attempts per address, and per secret, in FNLOOM_AUTO_PAIR_WINDOW.'),
|
|
14
|
+
FNLOOM_AUTO_PAIR_WINDOW: z.number().int().min(1_000).default(600_000).describe('The window auto-pair attempts are counted in, in milliseconds.'),
|
|
15
|
+
FNLOOM_AUTO_PAIR_EXPIRY: z.number().int().min(60_000).default(90 * 24 * 60 * 60 * 1000).describe('How long an auto-pair secret lasts when the admin picks no expiry, in milliseconds (90 days).'),
|
|
16
|
+
FNLOOM_PACKAGE_MAX: z.number().int().min(1_024).default(200_000_000).describe('The largest package zip or data export the hub unpacks, in bytes (unpacked).'),
|
|
17
|
+
FNLOOM_BUNDLED_SYSTEMS: z.string().default('').describe(
|
|
18
18
|
'Build 9: the folder of bundled system folders an admin adds instances of from the browser (an MCP server, an API service). Empty: the repository `systems/` folder beside the hub package.',
|
|
19
19
|
),
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
FNLOOM_NPM: z.string().default(process.platform === 'win32' ? 'npm.cmd' : 'npm').describe('The npm the hub installs packages and their native externals with.'),
|
|
21
|
+
FNLOOM_STORE_LEASE: z.number().int().min(1_000).default(STORE_LEASE).describe(
|
|
22
22
|
'How long a transaction on a store the hub keeps may go without a statement before the hub rolls it back, in milliseconds.',
|
|
23
23
|
),
|
|
24
|
-
|
|
24
|
+
FNLOOM_STORE_HOLD: z.number().int().min(0).default(STORE_HOLD).describe(
|
|
25
25
|
'How long a call to a system whose store isn\'t ready yet waits before it is refused ("getting its storage ready"), in milliseconds.',
|
|
26
26
|
),
|
|
27
|
-
|
|
27
|
+
FNLOOM_STORE_MOVE_DRAIN: z.number().int().min(0).default(STORE_MOVE_DRAIN).describe(
|
|
28
28
|
'How long a store move gives the runs still going on its system to finish before it asks the admin to cancel them or keep waiting, in milliseconds.',
|
|
29
29
|
),
|
|
30
30
|
});
|
|
@@ -38,14 +38,14 @@ export type PackagingEnv = ReturnType<typeof packagingEnv.parse>;
|
|
|
38
38
|
* is refused and logged; one that keeps going is paused.
|
|
39
39
|
*/
|
|
40
40
|
export const reviewEnv = env({
|
|
41
|
-
|
|
41
|
+
FNLOOM_REVIEW_SYSTEMS: z.boolean().default(true).describe(
|
|
42
42
|
'Whether a newly paired system waits for an admin to review it and go live, and a live system\'s contract changes wait for approval. Off: systems go live as they pair (tests, a hub only you use).',
|
|
43
43
|
),
|
|
44
|
-
|
|
44
|
+
FNLOOM_GRANTS: z.enum(['enforce', 'log']).default('enforce').describe(
|
|
45
45
|
'What the hub does with a call past what a system declared (its grants, fn modes, types and calls): `enforce` refuses and logs it; `log` only logs it (development).',
|
|
46
46
|
),
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
FNLOOM_REFUSALS_PAUSE: z.number().int().min(1).default(20).describe('Refusals of one system within FNLOOM_REFUSALS_WINDOW that switch its functions off and tell the admins.'),
|
|
48
|
+
FNLOOM_REFUSALS_WINDOW: z.number().int().min(1_000).default(600_000).describe('The window refusals are counted in, in milliseconds.'),
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
/** The parsed review tunables. */
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* and to its mode: saving needs `write`, removing `delete`
|
|
12
12
|
* - **models and spend:** the model roles and models it may use, and its per-run and per-day caps
|
|
13
13
|
*
|
|
14
|
-
* Each refusal is a `RefusalRecord`. Past `
|
|
15
|
-
* functions are switched off and the admins are told (`system.paused`). With `
|
|
14
|
+
* Each refusal is a `RefusalRecord`. Past `FNLOOM_REFUSALS_PAUSE` refusals in `FNLOOM_REFUSALS_WINDOW`, the system's
|
|
15
|
+
* functions are switched off and the admins are told (`system.paused`). With `FNLOOM_GRANTS=log` refusals are only logged.
|
|
16
16
|
*/
|
|
17
17
|
import { reject as refuse } from '@ayepi/core';
|
|
18
18
|
import type { Logger } from '@ayepi/log';
|
|
@@ -92,7 +92,7 @@ export interface GrantGuardOptions {
|
|
|
92
92
|
readonly clock: () => number;
|
|
93
93
|
/** Switches a paused system's functions off. */
|
|
94
94
|
readonly admin: () => Pick<SystemAdmin, 'setEnabled'>;
|
|
95
|
-
readonly settings: Pick<ReviewEnv, '
|
|
95
|
+
readonly settings: Pick<ReviewEnv, 'FNLOOM_GRANTS' | 'FNLOOM_REFUSALS_PAUSE' | 'FNLOOM_REFUSALS_WINDOW'>;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/** One day, for the per-day spend cap. */
|
|
@@ -119,14 +119,14 @@ export class SystemGrantGuard {
|
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* Check one call a linked system makes, before it reaches its handler. Throws a 403 with the reason when it is
|
|
122
|
-
* refused (and logs it); with `
|
|
122
|
+
* refused (and logs it); with `FNLOOM_GRANTS=log` it only logs it.
|
|
123
123
|
*/
|
|
124
124
|
async check(link: LinkSession, endpoint: string, body: unknown): Promise<void> {
|
|
125
125
|
if (link.system === HUB_SYSTEM) { return; }
|
|
126
126
|
const refusal = await this.#decide(link, endpoint, body);
|
|
127
127
|
if (refusal === undefined) { return; }
|
|
128
128
|
await this.refused(link, refusal);
|
|
129
|
-
if (this.#options.settings.
|
|
129
|
+
if (this.#options.settings.FNLOOM_GRANTS === 'enforce') { throw refuse(403, 'NOT_GRANTED', refusal.detail); }
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/** Keep a refusal (also those fs's supervisor reports), and pause a system that keeps going past them. */
|
|
@@ -137,21 +137,21 @@ export class SystemGrantGuard {
|
|
|
137
137
|
...(refusal.run === undefined ? {} : { run: refusal.run }), ...(refusal.fn === undefined ? {} : { fn: refusal.fn }),
|
|
138
138
|
};
|
|
139
139
|
await store.table('refusals').insert(record);
|
|
140
|
-
log.warn('system.refused', { system: link.system, instance: link.instance, rule: refusal.rule, attempt: refusal.attempt, detail: refusal.detail, enforced: settings.
|
|
141
|
-
if (settings.
|
|
140
|
+
log.warn('system.refused', { system: link.system, instance: link.instance, rule: refusal.rule, attempt: refusal.attempt, detail: refusal.detail, enforced: settings.FNLOOM_GRANTS === 'enforce' });
|
|
141
|
+
if (settings.FNLOOM_GRANTS === 'enforce') { await this.#pauseIfOver(link.system); }
|
|
142
142
|
return record;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
async #pauseIfOver(system: SystemName): Promise<void> {
|
|
146
146
|
const { store, clock, settings, bus, log } = this.#options;
|
|
147
|
-
const recent = await store.table('refusals').count({ system, at: { gt: clock() - settings.
|
|
148
|
-
if (recent < settings.
|
|
147
|
+
const recent = await store.table('refusals').count({ system, at: { gt: clock() - settings.FNLOOM_REFUSALS_WINDOW } });
|
|
148
|
+
if (recent < settings.FNLOOM_REFUSALS_PAUSE) { return; }
|
|
149
149
|
const record = await store.table('systems').get(system);
|
|
150
150
|
if (record === undefined || !record.enabled.functions) { return; }
|
|
151
151
|
await this.#options.admin().setEnabled(system, { functions: false }, record.actor);
|
|
152
152
|
await this.#options.catalog.refreshAvailability(system);
|
|
153
153
|
bus.publish('system.paused', { system, refusals: recent });
|
|
154
|
-
log.warn('system.paused', { system, refusals: recent, window: settings.
|
|
154
|
+
log.warn('system.paused', { system, refusals: recent, window: settings.FNLOOM_REFUSALS_WINDOW });
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
async #decide(link: LinkSession, endpoint: string, body: unknown): Promise<Refusal | undefined> {
|