fnloom 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -19
- package/package.json +15 -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 +4 -3
- package/packages/cli/src/command.ts +4 -2
- package/packages/cli/src/commands/install.ts +104 -8
- package/packages/cli/src/commands/manage.ts +7 -5
- package/packages/cli/src/commands/mcp.ts +6 -6
- package/packages/cli/src/commands/store.ts +172 -0
- package/packages/cli/src/hub.ts +45 -26
- package/packages/cli/src/index.ts +1 -1
- package/packages/cli/src/io.ts +3 -2
- package/packages/cli/src/local.ts +7 -7
- package/packages/cli/src/premade.ts +1 -1
- package/packages/cli/src/testing.ts +2 -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-files.ts +3 -1
- package/packages/core/src/context-graph.ts +5 -1
- package/packages/core/src/context-plan.ts +451 -0
- package/packages/core/src/context-questions.ts +305 -0
- package/packages/core/src/data.ts +1 -1
- package/packages/core/src/fn-facts.ts +32 -4
- package/packages/core/src/https.ts +2 -2
- package/packages/core/src/identity.ts +2 -2
- package/packages/core/src/image-embeddings.ts +1 -1
- package/packages/core/src/index.ts +9 -8
- package/packages/core/src/link.ts +71 -1
- package/packages/core/src/manifest.ts +22 -3
- package/packages/core/src/mention-search.ts +1 -1
- package/packages/core/src/model-calls.ts +11 -2
- package/packages/core/src/package.ts +11 -1
- package/packages/core/src/ports.ts +2 -2
- package/packages/core/src/query.ts +4 -3
- package/packages/core/src/records/chat.ts +1 -1
- package/packages/core/src/records/content.ts +10 -2
- package/packages/core/src/records/runs.ts +12 -0
- package/packages/core/src/records/spend.ts +4 -0
- package/packages/core/src/records/systems.ts +87 -5
- package/packages/core/src/registries.ts +9 -3
- package/packages/core/src/run.ts +5 -0
- package/packages/core/src/sso.ts +2 -2
- package/packages/core/src/stores.ts +473 -0
- package/packages/core/src/suggestions.ts +5 -2
- package/packages/core/src/system-pages.ts +46 -7
- package/packages/core/src/tables.ts +233 -0
- package/packages/core/src/visuals.ts +47 -139
- package/packages/core/src/web.ts +116 -11
- package/packages/core/src/widgets-v1.ts +78 -1
- package/packages/hub/package.json +15 -12
- package/packages/hub/src/access/hits.ts +1 -1
- package/packages/hub/src/api/admin-ops.ts +41 -9
- package/packages/hub/src/api/auth.ts +10 -6
- package/packages/hub/src/api/https.ts +6 -6
- package/packages/hub/src/api/identities.ts +1 -1
- package/packages/hub/src/api/person-ops.ts +6 -0
- 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 +54 -0
- package/packages/hub/src/api/testing/rig.ts +3 -3
- package/packages/hub/src/api/tls.ts +4 -4
- package/packages/hub/src/api/web/auth.ts +1 -1
- package/packages/hub/src/api/web/build5.ts +2 -1
- package/packages/hub/src/api/web/context-plans.ts +25 -0
- package/packages/hub/src/api/web/context-review.ts +43 -0
- package/packages/hub/src/api/web/find.ts +1 -1
- package/packages/hub/src/api/web/index.ts +4 -0
- package/packages/hub/src/api/web/pages.ts +17 -3
- package/packages/hub/src/api/web/pickers.ts +4 -4
- package/packages/hub/src/api/web/review.ts +16 -0
- package/packages/hub/src/api/web/systems.ts +14 -2
- package/packages/hub/src/boot/admin-fns.ts +8 -0
- package/packages/hub/src/boot/admin-secrets.ts +10 -4
- package/packages/hub/src/boot/env.ts +82 -73
- package/packages/hub/src/boot/hub-fns.ts +4 -4
- package/packages/hub/src/boot/hub-groups.ts +2 -2
- package/packages/hub/src/boot/identity.ts +2 -2
- package/packages/hub/src/boot/index.ts +10 -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 +16 -7
- package/packages/hub/src/boot/person-fns.ts +5 -0
- package/packages/hub/src/boot/plan-fns.ts +39 -0
- package/packages/hub/src/boot/services.ts +9 -9
- package/packages/hub/src/boot/start.ts +25 -24
- package/packages/hub/src/catalog/catalog.ts +44 -14
- package/packages/hub/src/catalog/index.ts +6 -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 +3 -3
- 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/brought.ts +5 -3
- 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 +5 -5
- 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 +13 -6
- package/packages/hub/src/execution/env.ts +16 -14
- package/packages/hub/src/execution/errors.ts +12 -0
- package/packages/hub/src/execution/executors.ts +16 -4
- package/packages/hub/src/execution/gateway.ts +1 -1
- package/packages/hub/src/execution/index.ts +9 -1
- package/packages/hub/src/execution/ledger.ts +2 -2
- package/packages/hub/src/execution/limits.ts +2 -2
- package/packages/hub/src/execution/link-handlers.ts +16 -4
- 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 +216 -15
- package/packages/hub/src/execution/stream-guard.ts +2 -2
- package/packages/hub/src/execution/testing.ts +7 -6
- 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 +28 -9
- package/packages/hub/src/graph/graph.ts +3 -3
- 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 +10 -3
- package/packages/hub/src/index/indexer.ts +71 -20
- package/packages/hub/src/index/search.ts +2 -1
- package/packages/hub/src/index/suggester.ts +2 -2
- package/packages/hub/src/index/testing.ts +2 -2
- package/packages/hub/src/link/build.ts +71 -34
- package/packages/hub/src/link/connections.ts +41 -3
- package/packages/hub/src/link/describer.ts +19 -2
- package/packages/hub/src/link/env.ts +21 -11
- package/packages/hub/src/link/grants.ts +10 -10
- package/packages/hub/src/link/handlers.ts +6 -0
- package/packages/hub/src/link/index.ts +16 -4
- package/packages/hub/src/link/lifecycle.ts +15 -8
- package/packages/hub/src/link/migrate-api.ts +55 -15
- package/packages/hub/src/link/packages.ts +17 -4
- package/packages/hub/src/link/pairing.ts +3 -3
- package/packages/hub/src/link/process.ts +11 -5
- package/packages/hub/src/link/rig.ts +15 -11
- package/packages/hub/src/link/status.ts +14 -0
- package/packages/hub/src/link/supervisor.ts +17 -1
- package/packages/hub/src/link/systems.ts +16 -5
- 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 +78 -11
- package/packages/hub/src/query/columns.ts +4 -1
- package/packages/hub/src/query/contexts.ts +10 -3
- package/packages/hub/src/query/env.ts +5 -5
- package/packages/hub/src/query/sources.ts +3 -3
- package/packages/hub/src/questions/apply.ts +163 -0
- package/packages/hub/src/questions/carry.ts +30 -0
- package/packages/hub/src/questions/duplicates.ts +181 -0
- package/packages/hub/src/questions/index.ts +112 -0
- package/packages/hub/src/questions/metadata.ts +142 -0
- package/packages/hub/src/questions/pending.ts +64 -0
- package/packages/hub/src/questions/plan-match.ts +79 -0
- package/packages/hub/src/questions/plan-prompts.ts +110 -0
- package/packages/hub/src/questions/planner.ts +382 -0
- package/packages/hub/src/questions/plans.ts +353 -0
- package/packages/hub/src/questions/review.ts +253 -0
- package/packages/hub/src/questions/setting.ts +50 -0
- package/packages/hub/src/questions/testing.ts +131 -0
- package/packages/hub/src/questions/worker.ts +182 -0
- package/packages/hub/src/resources/context.ts +61 -23
- package/packages/hub/src/resources/converters.ts +2 -2
- package/packages/hub/src/resources/create.ts +20 -8
- package/packages/hub/src/resources/env.ts +15 -11
- package/packages/hub/src/resources/fetch.ts +5 -5
- package/packages/hub/src/resources/fns.ts +6 -2
- package/packages/hub/src/resources/forms.ts +5 -5
- package/packages/hub/src/resources/index.ts +9 -3
- 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 +22 -6
- package/packages/hub/src/store/codec.ts +23 -5
- package/packages/hub/src/store/context-status.ts +56 -0
- package/packages/hub/src/store/derived.ts +53 -0
- package/packages/hub/src/store/env.ts +4 -4
- package/packages/hub/src/store/hybrid.ts +37 -10
- package/packages/hub/src/store/lists.ts +2 -1
- package/packages/hub/src/store/migrate-fn-names.ts +5 -2
- package/packages/hub/src/store/rows.ts +8 -1
- package/packages/hub/src/store/schema.ts +2 -1
- package/packages/hub/src/store/sqlite.ts +5 -4
- package/packages/hub/src/stores/backups.ts +163 -0
- package/packages/hub/src/stores/drivers.ts +100 -0
- package/packages/hub/src/stores/guard.ts +116 -0
- package/packages/hub/src/stores/host.ts +459 -0
- package/packages/hub/src/stores/moves.ts +380 -0
- package/packages/hub/src/stores/plugin.ts +42 -0
- package/packages/hub/src/stores/service.ts +340 -0
- package/packages/hub/src/stores/testing.ts +149 -0
- 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 +3229 -1309
- package/packages/sdk/package.json +15 -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/build.ts +3 -0
- 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 +104 -11
- package/packages/sdk/src/ctx.ts +51 -17
- package/packages/sdk/src/declare.ts +36 -12
- package/packages/sdk/src/hub.ts +226 -14
- package/packages/sdk/src/impl.ts +3 -3
- package/packages/sdk/src/index.ts +19 -12
- package/packages/sdk/src/manifest.ts +5 -0
- 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/providers.ts +2 -2
- package/packages/sdk/src/remote-auth.ts +128 -7
- package/packages/sdk/src/server/asks.ts +12 -1
- package/packages/sdk/src/server/context-files.ts +1 -1
- package/packages/sdk/src/server/env.ts +47 -35
- package/packages/sdk/src/server/fake-hub-widgets.ts +7 -6
- package/packages/sdk/src/server/host.ts +106 -35
- package/packages/sdk/src/server/index.ts +23 -4
- package/packages/sdk/src/server/live.ts +4 -4
- package/packages/sdk/src/server/llm-wire.ts +4 -4
- package/packages/sdk/src/server/package.ts +11 -2
- package/packages/sdk/src/server/pairing.ts +1 -1
- package/packages/sdk/src/server/results.ts +4 -4
- package/packages/sdk/src/server/run.ts +6 -1
- package/packages/sdk/src/server/runtime.ts +78 -22
- package/packages/sdk/src/server/socket-guard.ts +1 -1
- package/packages/sdk/src/server/start-gate.ts +174 -0
- package/packages/sdk/src/server/store/checksum.ts +162 -0
- package/packages/sdk/src/server/store/engines.ts +400 -0
- package/packages/sdk/src/server/store/extend.ts +25 -0
- package/packages/sdk/src/server/store/keeper.ts +392 -0
- package/packages/sdk/src/server/store/link-driver.ts +142 -0
- package/packages/sdk/src/server/store/measure.ts +45 -0
- package/packages/sdk/src/server/store/migrations.ts +238 -0
- package/packages/sdk/src/server/store/move.ts +488 -0
- package/packages/sdk/src/server/store/portable.ts +288 -0
- package/packages/sdk/src/server/store/stable.ts +146 -0
- package/packages/sdk/src/server/store/tables.ts +28 -0
- package/packages/sdk/src/server/store/vectors.ts +185 -0
- package/packages/sdk/src/server/store/work-checks.ts +288 -0
- package/packages/sdk/src/server/store/work.ts +369 -0
- package/packages/sdk/src/server/supervise.ts +4 -4
- package/packages/sdk/src/server/table.ts +3 -1
- package/packages/sdk/src/server/testing.ts +116 -3
- package/packages/sdk/src/store.ts +91 -0
- package/packages/sdk/src/system.ts +58 -30
- package/packages/sdk/src/testing/env.ts +6 -6
- package/packages/sdk/src/testing/hub.ts +21 -6
- 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-BuMYRDqv.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-DSzDKCFz.js → AppPage-BvoVTk6h.js} +2 -2
- package/packages/web/dist/assets/{AutoPairPicker-nV38ALjl.js → AutoPairPicker-CLjD-muP.js} +2 -2
- package/packages/web/dist/assets/{BrowserFrame-Bic7U7jN.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-xHS3Xah9.js → CodeViewer-K9jrTmFO.js} +2 -2
- package/packages/web/dist/assets/ConfigWithCustom-BvrvSVIp.js +3 -0
- package/packages/web/dist/assets/{ConfirmDialog-DjQUzNqk.js → ConfirmDialog-BDvLleYf.js} +2 -2
- package/packages/web/dist/assets/{ConnectPage-CfRDrXvJ.js → ConnectPage-Dg6IPNNh.js} +2 -2
- package/packages/web/dist/assets/ContextItemPage-Cv4G0k_o.css +1 -0
- package/packages/web/dist/assets/ContextItemPage-qisBQetR.js +2 -0
- package/packages/web/dist/assets/ContextPage-C8u0UnYl.css +1 -0
- package/packages/web/dist/assets/ContextPage-DXa6Yqk-.js +3 -0
- package/packages/web/dist/assets/ContextRow-Chx99Xac.css +1 -0
- package/packages/web/dist/assets/ContextRow-DDYnYRaL.js +2 -0
- package/packages/web/dist/assets/{DataPage-wSIoGcb5.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-DidMUX8m.js → DesignPage-B9MJbF10.js} +3 -3
- package/packages/web/dist/assets/{ExplorePage-MUyVydVB.js → ExplorePage-cRDQZRea.js} +2 -2
- package/packages/web/dist/assets/{FnPill-BshAvm2I.js → FnPill-CbLZCXYM.js} +2 -2
- package/packages/web/dist/assets/{FnView-B8MGAOoB.js → FnView-CG_wBKTP.js} +2 -2
- package/packages/web/dist/assets/{FnsView-CeqIoaBT.js → FnsView-BybyK12w.js} +2 -2
- package/packages/web/dist/assets/{GinExprView-DYVUwZrd.js → GinExprView-BYCKSD_n.js} +2 -2
- package/packages/web/dist/assets/{GinForm-D3mwMRTQ.js → GinForm-CXjYVf2_.js} +2 -2
- package/packages/web/dist/assets/{GinTypeView-C0YifSmE.js → GinTypeView-Bmbmx9e_.js} +2 -2
- package/packages/web/dist/assets/{GinValueView-HfEPq9le.js → GinValueView-CWUzS7ti.js} +2 -2
- package/packages/web/dist/assets/{GraphPage-ySnuA4Hp.js → GraphPage-D6OhckfJ.js} +2 -2
- package/packages/web/dist/assets/GraphPanel-BTitgA-K.js +2 -0
- package/packages/web/dist/assets/{HubPicker-C_vA752L.js → HubPicker-DVly8dLD.js} +2 -2
- package/packages/web/dist/assets/{InboxApprovals-DcPCCmZ5.js → InboxApprovals-BF84edZU.js} +2 -2
- package/packages/web/dist/assets/{InboxPage-C2DT2nuF.js → InboxPage-DohZ9EDP.js} +2 -2
- package/packages/web/dist/assets/InjectedList-e6qr1kdU.js +2 -0
- package/packages/web/dist/assets/InstallDialog-JJCKYs2s.js +2 -0
- package/packages/web/dist/assets/{InstallDialog-yWLZK_zN.css → InstallDialog-K-j0sdHm.css} +1 -1
- package/packages/web/dist/assets/InstanceTypes-BqUzx87o.js +2 -0
- package/packages/web/dist/assets/InstanceTypes-CwVSAULg.css +1 -0
- package/packages/web/dist/assets/InstanceView-C73pev7A.js +2 -0
- package/packages/web/dist/assets/InstanceView-_9uE70tS.css +1 -0
- package/packages/web/dist/assets/{ItemHistory-CUGa8b6s.js → ItemHistory-dbGgOZsw.js} +2 -2
- package/packages/web/dist/assets/LimitsView-Ddp5WakY.js +2 -0
- package/packages/web/dist/assets/ListSearch-CYNNAuMB.js +2 -0
- package/packages/web/dist/assets/{LlmCallDetails-2yQftCqd.js → LlmCallDetails-C9H5Hc2J.js} +2 -2
- package/packages/web/dist/assets/{LlmCallsView-DOHX3r0K.js → LlmCallsView-CBqyZ8Cj.js} +2 -2
- package/packages/web/dist/assets/{LoadState-DeXfLvYv.js → LoadState-B2YhZlyC.js} +2 -2
- package/packages/web/dist/assets/McpDialog-DhlLklIq.js +2 -0
- package/packages/web/dist/assets/{McpView-CC2oNOMa.js → McpView-D_ZmNO56.js} +2 -2
- package/packages/web/dist/assets/{McpsView-CwJvyyxV.js → McpsView-9_gwBuzw.js} +2 -2
- package/packages/web/dist/assets/{MemoryDialog-Dbvh5uLq.js → MemoryDialog-pTHIxKEX.js} +2 -2
- package/packages/web/dist/assets/{ModelCallsView-RvnW3EBP.js → ModelCallsView-FHv2XWRX.js} +2 -2
- package/packages/web/dist/assets/{ModelPicker-DcjwQFHC.js → ModelPicker-EqOuvVnE.js} +2 -2
- package/packages/web/dist/assets/ModelsView-D9UaL4PX.js +2 -0
- package/packages/web/dist/assets/{NotFoundPage-CeSwzTV-.js → NotFoundPage-BsuJysan.js} +2 -2
- package/packages/web/dist/assets/PairPage-B_ZXsbL4.js +2 -0
- package/packages/web/dist/assets/PairPage-D_aPS1Ot.css +1 -0
- package/packages/web/dist/assets/{PanelHost-BkrFAnPa.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-Bn4rm-ao.js +2 -0
- package/packages/web/dist/assets/{RefusalList-DQoyUoPG.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-Po24y4pj.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-k3HevESg.js → ReviewSummaryStrip-Bvjn3Iq8.js} +2 -2
- package/packages/web/dist/assets/ReviewView-DIqsUedT.js +3 -0
- package/packages/web/dist/assets/{RuleRow-CoXDA-SH.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-CGhQQ6OI.js → RunDetails-W4GbE6AE.js} +2 -2
- package/packages/web/dist/assets/{RunDot-Ch_45985.js → RunDot-C46uzzNM.js} +2 -2
- package/packages/web/dist/assets/{RunPage-C_t20pB7.js → RunPage-DPLtZpeB.js} +2 -2
- package/packages/web/dist/assets/{RunProgress-VrZUHUEC.js → RunProgress-Cr_6TBaF.js} +2 -2
- package/packages/web/dist/assets/RunsView-tU350TPK.js +2 -0
- package/packages/web/dist/assets/{SettingsPage-CykfuYj1.js → SettingsPage-B8QmmMN3.js} +2 -2
- 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-DrXZ1sG2.js → SignInPage-DTwdqlnB.js} +2 -2
- package/packages/web/dist/assets/{StatusBadge-Dpb9uG5e.js → StatusBadge-D7wKMAcD.js} +2 -2
- package/packages/web/dist/assets/StorePlacementStep-C04nRU-u.js +2 -0
- package/packages/web/dist/assets/StorePlacementStep-D_G4e3ue.css +1 -0
- package/packages/web/dist/assets/{SystemConfig-72qKRkUk.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/{SystemView-C8ScHUe2.css → SystemView-_9q6eDfV.css} +1 -1
- package/packages/web/dist/assets/SystemsView-0G8JntMV.js +2 -0
- package/packages/web/dist/assets/{SystemsView-B6HEL9VS.css → SystemsView-CWKnupLW.css} +1 -1
- 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-BQ7bYLOP.js → TableViewer-nbMInGJJ.js} +2 -2
- package/packages/web/dist/assets/{ThemePicker-C2nJ21Vd.js → ThemePicker-fZpVSYqG.js} +2 -2
- package/packages/web/dist/assets/{TurnTree-CORdfTHj.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-qyc8dG5D.js → UserMessage-CDjUxKY0.js} +6 -6
- package/packages/web/dist/assets/{ValueVisual-aXEUaQ5Y.js → ValueVisual-EJnCKgSy.js} +2 -2
- package/packages/web/dist/assets/actor-names-OdvpVZeb.js +4 -0
- package/packages/web/dist/assets/{fn-modal-DqcxUhOQ.js → fn-modal-DtE65mFt.js} +2 -2
- package/packages/web/dist/assets/{fn-notices-BYaH6IoA.js → fn-notices-CCZ-DFbi.js} +2 -2
- package/packages/web/dist/assets/{formats-DI__ADVG.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-BhJpmLWA.js → labels-CT7_K0Pt.js} +2 -2
- package/packages/web/dist/assets/{layout-DQKldU13.js → layout-B6fBDg80.js} +2 -2
- package/packages/web/dist/assets/loaded-LaPjk6mK.js +2 -0
- package/packages/web/dist/assets/{metrics-Cio5ykX6.js → metrics-9n8bKI7u.js} +2 -2
- package/packages/web/dist/assets/problems--AW4igVY.js +2 -0
- package/packages/web/dist/assets/{push-payload-D5efGCzd.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-CGUGvRV9.js → review-uLESCEz1.js} +3 -3
- package/packages/web/dist/assets/routes-B7Zmt8wh.js +4 -0
- package/packages/web/dist/assets/runs-CUb2PTFg.js +2 -0
- package/packages/web/dist/assets/{shared-DTpYDMc_.js → shared-Bxhw_9et.js} +2 -2
- package/packages/web/dist/assets/{sources-Bm-TrxhL.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-DIp94AET.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-DWjytmDS.js +17 -0
- package/packages/web/dist/assets/{ui-C7ZH_6oC.css → ui-DycHjPTZ.css} +1 -1
- package/packages/web/dist/assets/{url-BIg5IhGs.js → url-DbGOI14W.js} +2 -2
- package/packages/web/dist/index.html +52 -50
- 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 +17 -16
- package/scripts/stack.ts +76 -19
- package/scripts/start.ts +27 -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/fakes.ts +2 -0
- package/systems/fs/client/index.ts +4 -2
- package/systems/fs/client/machines/CoreHeatmap.vue +94 -0
- package/systems/fs/client/machines/MachineFiles.vue +121 -0
- package/systems/fs/client/machines/MachineMetrics.vue +330 -0
- package/systems/fs/client/machines/MachinesPage.vue +119 -0
- package/systems/fs/client/machines/TimeChart.vue +128 -0
- package/systems/fs/client/machines/fakes.ts +95 -0
- package/systems/fs/client/machines/files/ChangesPane.vue +90 -0
- package/systems/fs/client/machines/files/CodeView.vue +158 -0
- package/systems/fs/client/machines/files/CommentComposer.vue +86 -0
- package/systems/fs/client/machines/files/CommentThread.vue +115 -0
- package/systems/fs/client/machines/files/CommitPane.vue +80 -0
- package/systems/fs/client/machines/files/ComparePane.vue +81 -0
- package/systems/fs/client/machines/files/FileHistory.vue +89 -0
- package/systems/fs/client/machines/files/FilePane.vue +199 -0
- package/systems/fs/client/machines/files/FileTree.vue +26 -0
- package/systems/fs/client/machines/files/FolderPane.vue +154 -0
- package/systems/fs/client/machines/files/HistoryPane.vue +106 -0
- package/systems/fs/client/machines/files/ImageView.vue +160 -0
- package/systems/fs/client/machines/files/PatchView.vue +31 -0
- package/systems/fs/client/machines/files/QuickOpen.vue +67 -0
- package/systems/fs/client/machines/files/SearchPane.vue +87 -0
- package/systems/fs/client/machines/files/TreeNode.vue +72 -0
- package/systems/fs/client/machines/files/api.ts +127 -0
- package/systems/fs/client/machines/files/fake-kinds.ts +16 -0
- package/systems/fs/client/machines/files/fakes.ts +305 -0
- package/systems/fs/client/machines/files/ink.ts +117 -0
- package/systems/fs/client/machines/files/logic.ts +205 -0
- package/systems/fs/client/machines/files/state.ts +187 -0
- package/systems/fs/client/machines/files/viewers/CsvView.vue +29 -0
- package/systems/fs/client/machines/files/viewers/HexView.vue +27 -0
- package/systems/fs/client/machines/files/viewers/HtmlView.vue +17 -0
- package/systems/fs/client/machines/files/viewers/JsonNode.vue +45 -0
- package/systems/fs/client/machines/files/viewers/JsonView.vue +25 -0
- package/systems/fs/client/machines/metrics.ts +245 -0
- package/systems/fs/client/machines/palette.ts +98 -0
- package/systems/fs/client/preview/machines.ts +323 -0
- package/systems/fs/context/authoring/index.md +4 -0
- package/systems/fs/context/authoring/parts/actions.md +5 -1
- package/systems/fs/context/authoring/parts/actions.reference.md +6 -2
- package/systems/fs/context/authoring/parts/calling.md +5 -1
- package/systems/fs/context/authoring/parts/calling.reference.md +4 -0
- package/systems/fs/context/authoring/parts/client.md +31 -5
- package/systems/fs/context/authoring/parts/client.reference/client.md +8 -13
- package/systems/fs/context/authoring/parts/client.reference/pageinbox.md +524 -0
- package/systems/fs/context/authoring/parts/client.reference/{resultview.md → visuals.md} +135 -163
- package/systems/fs/context/authoring/parts/client.reference.md +11 -7
- package/systems/fs/context/authoring/parts/context/questions.md +49 -0
- package/systems/fs/context/authoring/parts/context.md +24 -2
- package/systems/fs/context/authoring/parts/context.reference.md +27 -3
- package/systems/fs/context/authoring/parts/contract.md +11 -1
- package/systems/fs/context/authoring/parts/contract.reference.md +26 -9
- package/systems/fs/context/authoring/parts/core-types/access-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/admin-ts.md +6 -2
- package/systems/fs/context/authoring/parts/core-types/api-index-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/approvals-ts.md +11 -7
- package/systems/fs/context/authoring/parts/core-types/auto-pair-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/checks-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/claims-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/config-secrets-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/connections-ts.md +15 -0
- package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +9 -1
- package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +6 -2
- package/systems/fs/context/authoring/parts/core-types/context-questions-ts.md +26 -0
- package/systems/fs/context/authoring/parts/core-types/contextdecl.md +10 -2
- package/systems/fs/context/authoring/parts/core-types/data-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/decisions-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/fn-block-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/fn-facts-ts.md +11 -0
- package/systems/fs/context/authoring/parts/core-types/gin-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/grants-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +44 -6
- package/systems/fs/context/authoring/parts/core-types/link-ts.md +7 -3
- package/systems/fs/context/authoring/parts/core-types/llm-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/manifest.md +41 -3
- package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +34 -2
- package/systems/fs/context/authoring/parts/core-types/mention-search-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/model-calls-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/model-names-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/modes-ts.md +6 -2
- package/systems/fs/context/authoring/parts/core-types/owner-runs-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/package-ts.md +9 -0
- package/systems/fs/context/authoring/parts/core-types/primitives-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/query-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-actors-ts.md +7 -3
- package/systems/fs/context/authoring/parts/core-types/records-chat-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-content-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-runs-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +148 -0
- package/systems/fs/context/authoring/parts/core-types/registries-ts.md +101 -1
- package/systems/fs/context/authoring/parts/core-types/resources-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/run-ts.md +8 -1
- package/systems/fs/context/authoring/parts/core-types/sensitivity-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/stores-ts.md +199 -0
- package/systems/fs/context/authoring/parts/core-types/system-events-ts.md +8 -1
- package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +7 -1
- package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +5 -1
- package/systems/fs/context/authoring/parts/core-types/tables-ts.md +91 -0
- package/systems/fs/context/authoring/parts/core-types/validation-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/visuals-ts.md +4 -0
- package/systems/fs/context/authoring/parts/core-types/web-ts.md +4 -1
- package/systems/fs/context/authoring/parts/core-types.md +15 -8
- package/systems/fs/context/authoring/parts/ctx/update-result.md +33 -0
- package/systems/fs/context/authoring/parts/ctx.md +11 -1
- package/systems/fs/context/authoring/parts/ctx.reference/{hubai.md → adminnotices.md} +45 -4
- package/systems/fs/context/authoring/parts/ctx.reference/fnctx.md +21 -23
- package/systems/fs/context/authoring/parts/ctx.reference.md +8 -4
- package/systems/fs/context/authoring/parts/data.md +11 -6
- package/systems/fs/context/authoring/parts/data.reference.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-findview-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-index-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-notecard-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-noteinput-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-notespage-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-reviewform-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/client-wordcount-vue.md +4 -0
- package/systems/fs/context/authoring/parts/examples/package-json.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-env-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-impl-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-index-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/server-main-ts.md +8 -4
- package/systems/fs/context/authoring/parts/examples/server-notes-test-ts.md +4 -0
- package/systems/fs/context/authoring/parts/examples/shared-index-ts.md +10 -0
- package/systems/fs/context/authoring/parts/examples/system-json.md +4 -0
- package/systems/fs/context/authoring/parts/examples/{systems-fs-shared-index-ts-lines-1-189.md → systems-fs-shared-index-ts-lines-1-178.md} +23 -30
- package/systems/fs/context/authoring/parts/examples/{systems-fs-shared-index-ts-lines-190-370.md → systems-fs-shared-index-ts-lines-179-382.md} +33 -6
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-383-567.md +210 -0
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +117 -0
- package/systems/fs/context/authoring/parts/examples/tsconfig-json.md +5 -1
- package/systems/fs/context/authoring/parts/examples.md +18 -11
- package/systems/fs/context/authoring/parts/fns.md +6 -2
- package/systems/fs/context/authoring/parts/fns.reference/fillclaims.md +5 -1
- package/systems/fs/context/authoring/parts/fns.reference/fn.md +6 -2
- package/systems/fs/context/authoring/parts/fns.reference.md +4 -0
- package/systems/fs/context/authoring/parts/folder.md +10 -6
- package/systems/fs/context/authoring/parts/gin.md +4 -0
- package/systems/fs/context/authoring/parts/gin.reference.md +4 -0
- package/systems/fs/context/authoring/parts/handlers-progress.md +5 -1
- package/systems/fs/context/authoring/parts/handlers-progress.reference.md +4 -0
- package/systems/fs/context/authoring/parts/hooks.md +5 -1
- package/systems/fs/context/authoring/parts/hooks.reference.md +5 -1
- package/systems/fs/context/authoring/parts/hub/context-questions.md +40 -0
- package/systems/fs/context/authoring/parts/hub/{hub-run-background.md → hub-ctx-from-resource.md} +52 -57
- package/systems/fs/context/authoring/parts/hub/hub-fns-load.md +35 -42
- package/systems/fs/context/authoring/parts/hub/hub-install-package.md +327 -0
- package/systems/fs/context/authoring/parts/hub/kinds-of-hub.md +8 -0
- package/systems/fs/context/authoring/parts/hub.md +14 -8
- package/systems/fs/context/authoring/parts/hub.reference.md +11 -2
- package/systems/fs/context/authoring/parts/internals/manifestof.md +6 -2
- package/systems/fs/context/authoring/parts/internals/permissionargs.md +8 -4
- package/systems/fs/context/authoring/parts/internals/usagefromwire.md +47 -2
- package/systems/fs/context/authoring/parts/internals.md +6 -2
- package/systems/fs/context/authoring/parts/kinds-agents.md +6 -2
- package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +10 -4
- package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +11 -7
- package/systems/fs/context/authoring/parts/kinds-agents.reference.md +4 -0
- package/systems/fs/context/authoring/parts/lifecycle.md +8 -3
- package/systems/fs/context/authoring/parts/lifecycle.reference.md +6 -2
- package/systems/fs/context/authoring/parts/mentions.md +5 -1
- package/systems/fs/context/authoring/parts/mentions.reference.md +6 -2
- package/systems/fs/context/authoring/parts/mistakes.md +7 -2
- package/systems/fs/context/authoring/parts/named-types.md +4 -0
- package/systems/fs/context/authoring/parts/named-types.reference.md +6 -2
- package/systems/fs/context/authoring/parts/outcomes.md +7 -3
- package/systems/fs/context/authoring/parts/outcomes.reference.md +6 -2
- package/systems/fs/context/authoring/parts/owner-runs.md +5 -1
- package/systems/fs/context/authoring/parts/owner-runs.reference.md +36 -11
- package/systems/fs/context/authoring/parts/packaging.md +14 -7
- package/systems/fs/context/authoring/parts/packaging.reference.md +7 -2
- package/systems/fs/context/authoring/parts/providers.md +5 -1
- package/systems/fs/context/authoring/parts/providers.reference.md +5 -1
- package/systems/fs/context/authoring/parts/remote.md +9 -5
- package/systems/fs/context/authoring/parts/remote.reference.md +204 -16
- package/systems/fs/context/authoring/parts/resources.md +5 -1
- package/systems/fs/context/authoring/parts/resources.reference.md +4 -0
- package/systems/fs/context/authoring/parts/server.md +12 -8
- package/systems/fs/context/authoring/parts/server.reference.md +55 -34
- package/systems/fs/context/authoring/parts/settings-attachments.md +5 -1
- package/systems/fs/context/authoring/parts/settings-attachments.reference.md +4 -0
- package/systems/fs/context/authoring/parts/start.md +5 -1
- package/systems/fs/context/authoring/parts/state-forms.md +5 -1
- package/systems/fs/context/authoring/parts/state-forms.reference.md +4 -0
- package/systems/fs/context/authoring/parts/store/ctx-store.md +49 -0
- package/systems/fs/context/authoring/parts/store/declare.md +32 -0
- package/systems/fs/context/authoring/parts/store/engines.md +25 -0
- package/systems/fs/context/authoring/parts/store/migrations.md +53 -0
- package/systems/fs/context/authoring/parts/store/moves.md +38 -0
- package/systems/fs/context/authoring/parts/store/placement.md +25 -0
- package/systems/fs/context/authoring/parts/store/serve.md +30 -0
- package/systems/fs/context/authoring/parts/store/store-tables.md +24 -0
- package/systems/fs/context/authoring/parts/store/vectors.md +32 -0
- package/systems/fs/context/authoring/parts/store/when-to-use.md +27 -0
- package/systems/fs/context/authoring/parts/store/work.md +37 -0
- package/systems/fs/context/authoring/parts/store.md +65 -0
- package/systems/fs/context/authoring/parts/store.reference.md +459 -0
- package/systems/fs/context/authoring/parts/testing.md +14 -1
- package/systems/fs/context/authoring/parts/testing.reference/{memoryjournal.md → equal.md} +57 -50
- package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +27 -46
- package/systems/fs/context/authoring/parts/testing.reference/{toolcall.md → kindprops.md} +128 -9
- package/systems/fs/context/authoring/parts/testing.reference/storeconnection.md +93 -0
- package/systems/fs/context/authoring/parts/testing.reference.md +16 -9
- package/systems/fs/context/authoring/parts/widgets.md +36 -22
- package/systems/fs/context/authoring/parts/widgets.reference.md +506 -8
- package/systems/fs/context/authoring/topics/begin.md +4 -0
- package/systems/fs/context/authoring/topics/client.md +4 -0
- package/systems/fs/context/authoring/topics/declare.md +4 -0
- package/systems/fs/context/authoring/topics/examples.md +4 -0
- package/systems/fs/context/authoring/topics/fns.md +4 -0
- package/systems/fs/context/authoring/topics/server.md +4 -0
- package/systems/fs/context/authoring/topics/types.md +8 -1
- package/systems/fs/context/comments/answer.md +21 -0
- package/systems/fs/context/comments/find.md +23 -0
- package/systems/fs/context/comments/read.md +26 -0
- package/systems/fs/context/comments.md +23 -0
- package/systems/fs/context/files-page.md +30 -0
- package/systems/fs/context/guide/attachments.md +16 -0
- package/systems/fs/context/guide/change.md +23 -0
- package/systems/fs/context/guide/commands.md +19 -0
- package/systems/fs/context/guide/documents.md +21 -0
- package/systems/fs/context/guide/find.md +25 -0
- package/systems/fs/context/guide/paths.md +24 -0
- package/systems/fs/context/guide/read.md +21 -0
- package/systems/fs/context/machine/history.md +25 -0
- package/systems/fs/context/machine/now.md +25 -0
- package/systems/fs/context/machine/processes.md +20 -0
- package/systems/fs/context/machine/recording.md +19 -0
- package/systems/fs/context/machine.md +24 -0
- package/systems/fs/package.json +5 -3
- package/systems/fs/server/files-page/browse.ts +391 -0
- package/systems/fs/server/files-page/comments.ts +439 -0
- package/systems/fs/server/files-page/fns.ts +158 -0
- package/systems/fs/server/files-page/git-view.ts +391 -0
- package/systems/fs/server/files-page/kinds.ts +56 -0
- package/systems/fs/server/hosting.ts +10 -10
- package/systems/fs/server/impl.ts +66 -7
- package/systems/fs/server/main.ts +28 -12
- package/systems/fs/server/metrics/collector.ts +424 -0
- package/systems/fs/server/metrics/index.ts +181 -0
- package/systems/fs/server/metrics/os.ts +144 -0
- package/systems/fs/server/metrics/parsers.ts +268 -0
- package/systems/fs/server/metrics/rrd.ts +363 -0
- package/systems/fs/server/metrics/testing.ts +80 -0
- package/systems/fs/server/shell.ts +1 -1
- package/systems/fs/server/snapshots.ts +216 -33
- package/systems/fs/server/testing.ts +15 -9
- package/systems/fs/shared/files-page.ts +506 -0
- package/systems/fs/shared/index.ts +138 -11
- package/systems/fs/shared/metrics.ts +179 -0
- package/systems/fs/system.json +10 -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 +3 -2
- 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 -4
- package/systems/schedule/server/env.ts +1 -1
- package/systems/schedule/server/fns.ts +5 -4
- package/systems/schedule/server/impl.ts +2 -2
- package/systems/schedule/server/import.ts +189 -0
- package/systems/schedule/server/index.ts +2 -0
- package/systems/schedule/server/main.ts +9 -7
- package/systems/schedule/server/placements.ts +41 -0
- package/systems/schedule/server/store.ts +159 -79
- package/systems/schedule/server/timer.ts +142 -107
- package/systems/schedule/shared/index.ts +2 -1
- package/systems/schedule/system.json +5 -1
- package/systems/schedule/tsconfig.json +1 -1
- 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-sLjVTrmV.js +0 -2
- package/packages/web/dist/assets/ApiServiceForm-BrMTU-7u.js +0 -2
- package/packages/web/dist/assets/ApiServiceForm-BxprSaAq.css +0 -1
- package/packages/web/dist/assets/ApiServiceView-BMF2zD6Q.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-bjLAWO_j.js +0 -2
- package/packages/web/dist/assets/ChartVisual-BnFG9aFi.css +0 -1
- package/packages/web/dist/assets/ChartVisual-DWw7WsfN.js +0 -11
- package/packages/web/dist/assets/ChatPage-7Yebk7rl.js +0 -4
- package/packages/web/dist/assets/ConfigWithCustom-DreTUdf0.js +0 -3
- package/packages/web/dist/assets/ContextItemPage-B6rJG3OT.js +0 -2
- package/packages/web/dist/assets/ContextItemPage-BRsWxOmu.css +0 -1
- package/packages/web/dist/assets/ContextPage-CloIZ_2y.js +0 -2
- package/packages/web/dist/assets/ContextPage-rYKxjiVI.css +0 -1
- package/packages/web/dist/assets/ContextRow-Byz_7HG-.css +0 -1
- package/packages/web/dist/assets/ContextRow-Dvv8CTFk.js +0 -2
- package/packages/web/dist/assets/DataTypePage-Ba_zBV4b.js +0 -4
- package/packages/web/dist/assets/FnList-BCnb4kOB.css +0 -1
- package/packages/web/dist/assets/FnList-CjQRwYaT.js +0 -2
- package/packages/web/dist/assets/GraphPanel-Cy5-KGo1.js +0 -2
- package/packages/web/dist/assets/InjectedList-CJsEFEbz.js +0 -2
- package/packages/web/dist/assets/InstallDialog-C9GDoUI2.js +0 -2
- package/packages/web/dist/assets/InstanceTypes-D8Jcxn70.js +0 -2
- package/packages/web/dist/assets/InstanceTypes-DAowwLB7.css +0 -1
- package/packages/web/dist/assets/InstanceView-CuBD3JPU.css +0 -1
- package/packages/web/dist/assets/InstanceView-p7tMaylE.js +0 -2
- package/packages/web/dist/assets/LimitsView-DsZG6u5P.js +0 -2
- package/packages/web/dist/assets/ListSearch-BK4p7Nxa.js +0 -2
- package/packages/web/dist/assets/McpDialog-CA_0WKWF.js +0 -2
- package/packages/web/dist/assets/McpServerForm-CAG8Wp2N.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-CD8qw6W_.js +0 -2
- package/packages/web/dist/assets/McpServersView-DNycG35u.js +0 -2
- package/packages/web/dist/assets/ModelsView-C_iN19xt.js +0 -2
- package/packages/web/dist/assets/PairPage-Bs2KuRjC.css +0 -1
- package/packages/web/dist/assets/PairPage-TEXPpsqi.js +0 -2
- package/packages/web/dist/assets/PeopleView-D1QGPYp7.js +0 -2
- package/packages/web/dist/assets/PoliciesView-BU1fudNF.js +0 -2
- package/packages/web/dist/assets/RemoteAuthFields-Dm44vz2t.css +0 -1
- package/packages/web/dist/assets/RemoteAuthFields-nxGWfmhf.js +0 -2
- package/packages/web/dist/assets/ResourcesPage-YluNBqIv.js +0 -2
- package/packages/web/dist/assets/ResultGrid-CuUQyTjW.css +0 -1
- package/packages/web/dist/assets/ResultGrid-uoq4yUYj.js +0 -2
- package/packages/web/dist/assets/ReviewView-79Z5rU1v.js +0 -3
- package/packages/web/dist/assets/RunCard-CBSGdwdQ.js +0 -2
- package/packages/web/dist/assets/RunCard-CfyRaDLS.css +0 -1
- package/packages/web/dist/assets/RunsView-Dz9Xsvu5.js +0 -2
- package/packages/web/dist/assets/ServiceRows-6BU4-MeL.css +0 -1
- package/packages/web/dist/assets/ServiceRows-DNzDiutg.js +0 -2
- 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-DLNg2FYK.js +0 -2
- package/packages/web/dist/assets/SystemView-Es5wtkYU.js +0 -2
- package/packages/web/dist/assets/SystemsView-CeuSFhlF.js +0 -2
- package/packages/web/dist/assets/WidgetView-BZyDyYRI.js +0 -3
- package/packages/web/dist/assets/WidgetView-DQUDeFkB.css +0 -1
- package/packages/web/dist/assets/export-BwFkEtcm.js +0 -15
- package/packages/web/dist/assets/index-Bv42jNvr.js +0 -4
- package/packages/web/dist/assets/index-CSisx5mi.css +0 -1
- package/packages/web/dist/assets/problems-BZY0Dwif.js +0 -2
- package/packages/web/dist/assets/record-edits-CveFEsal.js +0 -2
- package/packages/web/dist/assets/remote-config-BkaarDf3.js +0 -2
- package/packages/web/dist/assets/routes-qP_j74V5.js +0 -4
- package/packages/web/dist/assets/runs-k76usGfd.js +0 -2
- package/packages/web/dist/assets/size-BwnshyOe.js +0 -2
- package/packages/web/dist/assets/src-DLK1P7oz.js +0 -43
- package/packages/web/dist/assets/state-CjE-qA2w.js +0 -2
- package/packages/web/dist/assets/ui-W12UYhVu.js +0 -17
- package/packages/web/dist/assets/widget-host-BCf6Tlt5.js +0 -2
- package/packages/web/dist/assets/widgets-CrbkovMT.js +0 -2
- package/systems/fs/context/authoring/parts/client.reference/fnpillprops.md +0 -141
- package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +0 -60
- package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +0 -299
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-371-533.md +0 -183
- package/systems/fs/context/authoring/parts/hub/hub-auto-pair-revoke.md +0 -189
- package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +0 -623
- package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +0 -150
|
@@ -3,20 +3,30 @@
|
|
|
3
3
|
* installed packages get their externals.
|
|
4
4
|
*/
|
|
5
5
|
import { env } from '@ayepi/env';
|
|
6
|
+
import { STORE_HOLD, STORE_LEASE, STORE_MOVE_DRAIN } from '@harness/core';
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
|
|
8
9
|
export const packagingEnv = env({
|
|
9
|
-
|
|
10
|
+
FNLOOM_PUBLIC_URL: z.url().optional().describe(
|
|
10
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.',
|
|
11
12
|
),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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(
|
|
17
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.',
|
|
18
19
|
),
|
|
19
|
-
|
|
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
|
+
'How long a transaction on a store the hub keeps may go without a statement before the hub rolls it back, in milliseconds.',
|
|
23
|
+
),
|
|
24
|
+
FNLOOM_STORE_HOLD: z.number().int().min(0).default(STORE_HOLD).describe(
|
|
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
|
+
),
|
|
27
|
+
FNLOOM_STORE_MOVE_DRAIN: z.number().int().min(0).default(STORE_MOVE_DRAIN).describe(
|
|
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
|
+
),
|
|
20
30
|
});
|
|
21
31
|
|
|
22
32
|
/** The parsed packaging tunables. */
|
|
@@ -28,14 +38,14 @@ export type PackagingEnv = ReturnType<typeof packagingEnv.parse>;
|
|
|
28
38
|
* is refused and logged; one that keeps going is paused.
|
|
29
39
|
*/
|
|
30
40
|
export const reviewEnv = env({
|
|
31
|
-
|
|
41
|
+
FNLOOM_REVIEW_SYSTEMS: z.boolean().default(true).describe(
|
|
32
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).',
|
|
33
43
|
),
|
|
34
|
-
|
|
44
|
+
FNLOOM_GRANTS: z.enum(['enforce', 'log']).default('enforce').describe(
|
|
35
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).',
|
|
36
46
|
),
|
|
37
|
-
|
|
38
|
-
|
|
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.'),
|
|
39
49
|
});
|
|
40
50
|
|
|
41
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> {
|
|
@@ -34,6 +34,7 @@ import { Serial } from '../catalog/serial.ts';
|
|
|
34
34
|
import type { SystemGrantGuard } from './grants.ts';
|
|
35
35
|
import type { SystemLifecycle } from './lifecycle.ts';
|
|
36
36
|
import type { EventBus } from '../bus.ts';
|
|
37
|
+
import type { SystemStores } from '../stores/service.ts';
|
|
37
38
|
|
|
38
39
|
const endpoints = hubLinkSpec.endpoints;
|
|
39
40
|
|
|
@@ -78,6 +79,8 @@ export interface LinkHandlerOptions {
|
|
|
78
79
|
readonly pairingLimits: Pick<PairingLimits, 'check'>;
|
|
79
80
|
/** Counts and times sockets until they are linked. */
|
|
80
81
|
readonly gate?: Pick<LinkGate, 'helloed' | 'linked'>;
|
|
82
|
+
/** Where each instance's store lives, told in its welcome. */
|
|
83
|
+
readonly stores?: Pick<SystemStores, 'welcome'>;
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
|
|
@@ -255,6 +258,8 @@ export class LinkHandshake {
|
|
|
255
258
|
const manifest = await catalog.manifest(hello.name);
|
|
256
259
|
const sendManifest = manifest === undefined || record.manifestHash !== hello.manifestHash;
|
|
257
260
|
const session: LinkSession = { ...ref, boot: hello.boot };
|
|
261
|
+
// where its store lives, kept for the connection before it can ask to open one
|
|
262
|
+
const store = await this.#options.stores?.welcome(record);
|
|
258
263
|
links.establish(conn, session);
|
|
259
264
|
this.#options.gate?.linked(conn);
|
|
260
265
|
await instances.sync(ref, { version: hello.version, lastSeenAt: clock(), address: await this.#options.address(conn.req) });
|
|
@@ -269,6 +274,7 @@ export class LinkHandshake {
|
|
|
269
274
|
sendManifest,
|
|
270
275
|
limits,
|
|
271
276
|
...(autoPair === undefined ? {} : { autoPair }),
|
|
277
|
+
...(store === undefined ? {} : { store }),
|
|
272
278
|
};
|
|
273
279
|
}
|
|
274
280
|
|
|
@@ -14,7 +14,7 @@ import type { Peer } from '@ayepi/core';
|
|
|
14
14
|
import type {
|
|
15
15
|
ActorId, AutoPairChoice, ConfigValue, ContentRef, ImportReport, InstallSource, InstalledSystem, InstanceName, InstanceRecord, InstanceRef, InvalidInput, Json, LinkSession,
|
|
16
16
|
Page, PairingId, PairingRequest, QualifiedName, ReadWant, ResourceChange, ResourceLink, ResourceRead, ResourceRoot, ResourceStat, ResourceUri, Section,
|
|
17
|
-
FnRouting, PairingGrant, PairingGrantRequest, SessionId, StopReason, SwitchItem, SystemEnabled, SystemLinkSpec, SystemName, Timestamp,
|
|
17
|
+
FnRouting, PairingGrant, PairingGrantRequest, SessionId, StopReason, StorePlacementInput, SwitchItem, SystemEnabled, SystemLinkSpec, SystemName, Timestamp,
|
|
18
18
|
} from '@harness/core';
|
|
19
19
|
|
|
20
20
|
export type { SystemOutput } from './output.ts';
|
|
@@ -37,6 +37,8 @@ export interface ConnectionChange {
|
|
|
37
37
|
readonly system: SystemName;
|
|
38
38
|
readonly instance: InstanceName;
|
|
39
39
|
readonly connected: boolean;
|
|
40
|
+
/** On a connect: the instance was connected already, and this connection replaced the older one. */
|
|
41
|
+
readonly replaced?: boolean;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/** Connected instances. A system may have several connected at once (a fleet); each replaces only its own older connection. */
|
|
@@ -135,6 +137,11 @@ export interface InstallInput {
|
|
|
135
137
|
readonly fleet?: boolean | undefined;
|
|
136
138
|
/** Build 9: what the instance's row says about it (`InstanceRecord.description`). */
|
|
137
139
|
readonly description?: string | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Where its store lives, for a system whose contract declares one (`stores.ts`): with the system when absent. An
|
|
142
|
+
* external database's connection is sealed before it is kept.
|
|
143
|
+
*/
|
|
144
|
+
readonly store?: StorePlacementInput | undefined;
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
/** Package zips and data exports (the packaging slice and the CLI). */
|
|
@@ -144,14 +151,15 @@ export interface Packages {
|
|
|
144
151
|
* folder), placed under `versions/<version>`, paired, configured and started. A name already installed is refused
|
|
145
152
|
* unless the package allows a fleet and the instance is new; `data` is a data export to restore into the instance.
|
|
146
153
|
*/
|
|
147
|
-
installZip(input: { zip: ContentRef; instance?: InstanceName; config?: Json; data?: ContentRef; autoStart?: boolean; by: ActorId }): Promise<InstanceRef>;
|
|
154
|
+
installZip(input: { zip: ContentRef; instance?: InstanceName; config?: Json; data?: ContentRef; autoStart?: boolean; store?: StorePlacementInput; by: ActorId }): Promise<InstanceRef>;
|
|
148
155
|
/**
|
|
149
156
|
* Zip an instance's data folder with `export.json` and, only when `withSecrets` is set, `config.json` (the hub can't
|
|
150
157
|
* tell secret config fields from others, so the config is left out unless asked for). Returns its content ref.
|
|
151
158
|
*/
|
|
152
159
|
exportData(input: { ref: InstanceRef; withSecrets: boolean; by: ActorId }): Promise<ContentRef>;
|
|
153
160
|
/** Forget one instance: stop it, uninstall it if the hub runs it, and mark it removed. */
|
|
154
|
-
|
|
161
|
+
/** Remove one instance; `keepStore` (default true) keeps its store as an orphaned backup, false deletes it. */
|
|
162
|
+
removeInstance(ref: InstanceRef, by: ActorId, keepStore?: boolean): Promise<void>;
|
|
155
163
|
}
|
|
156
164
|
|
|
157
165
|
/** What an admin switches and removes, beyond config. */
|
|
@@ -164,7 +172,11 @@ export interface SystemAdmin {
|
|
|
164
172
|
/** Turn one of a system's fns or context items on or off by itself. */
|
|
165
173
|
switchItem(item: SwitchItem, by: ActorId): Promise<{ on: boolean }>;
|
|
166
174
|
/** Remove a system and every instance: each is asked to stop, and its fns stay unavailable until one is paired again. */
|
|
167
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Remove a system (every instance). `keepStore` (default true) keeps each instance's store, listed as an orphaned
|
|
177
|
+
* backup it picks up again when it comes back; false deletes it (an external database is never dropped).
|
|
178
|
+
*/
|
|
179
|
+
remove(system: SystemName, by: ActorId, keepStore?: boolean): Promise<{ fnsUnavailable: number }>;
|
|
168
180
|
/** Import its stored manifest again (see `Catalog.reimport`) and recompute availability. */
|
|
169
181
|
reimport(system: SystemName): Promise<ImportReport>;
|
|
170
182
|
}
|
|
@@ -13,7 +13,7 @@ import { reject as refuse } from '@ayepi/core';
|
|
|
13
13
|
import type { Logger } from '@ayepi/log';
|
|
14
14
|
import { canonicalJson } from '@harness/sdk';
|
|
15
15
|
import {
|
|
16
|
-
DECLINED_KEPT, effectCovered, FnDecl, type ClientAssets, FnKindName, Json, MANIFEST_SECTION_NAMES, qualify, QualifiedName, runtimeNames, SystemProviderDecl,
|
|
16
|
+
DECLINED_KEPT, effectCovered, liveStatus, withStatus, FnDecl, type ClientAssets, FnKindName, Json, MANIFEST_SECTION_NAMES, qualify, QualifiedName, runtimeNames, SystemProviderDecl,
|
|
17
17
|
type ActorId, type ChangeRef, type ContractChange, type DeclaredBy, type DeclinedChange, type GoLiveRequest, type ReviewDecided, type ReviewDecision, type ItemRef, type ItemSection, type LiveContract, type Manifest, type PendingReview,
|
|
18
18
|
type RegistryEffect, type RegistryThing, type SwitchPart, type SystemName, type SystemReviewRecord, type SystemStage,
|
|
19
19
|
} from '@harness/core';
|
|
@@ -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;
|
|
@@ -265,7 +265,7 @@ export class SystemLifecycle {
|
|
|
265
265
|
const add = (item: ItemRef): void => { out.set(itemKey(item), item); };
|
|
266
266
|
for (const row of switches) { add({ section: row.section, name: row.name }); }
|
|
267
267
|
for (const fn of fns) { if (fn.disabled) { add({ section: 'fns', name: fn.name }); } }
|
|
268
|
-
for (const item of context) { if (item.
|
|
268
|
+
for (const item of context) { if (item.status === 'hidden') { add({ section: 'context', name: item.name }); } }
|
|
269
269
|
for (const change of review?.pending?.changes ?? []) {
|
|
270
270
|
const item = change.change === 'removed' ? undefined : itemOf(change);
|
|
271
271
|
if (item !== undefined) { add(item); }
|
|
@@ -301,7 +301,11 @@ export class SystemLifecycle {
|
|
|
301
301
|
}
|
|
302
302
|
for (const row of await allRows(tx.table('context'), { where: { system } })) {
|
|
303
303
|
const item: ItemRef = { section: 'context', name: row.name };
|
|
304
|
-
|
|
304
|
+
// off is hidden; back on is active again (an item hidden for another reason, or pending something, is left alone)
|
|
305
|
+
const off = wanted.has(itemKey(item));
|
|
306
|
+
if (touched(item) && (row.status === 'hidden') !== off && (off ? liveStatus(row.status) : true)) {
|
|
307
|
+
await tx.table('context').put(withStatus(row, off ? 'hidden' : 'active', { by, reason: off ? 'Switched off with its system\'s review.' : undefined, at: clock() }));
|
|
308
|
+
}
|
|
305
309
|
}
|
|
306
310
|
for (const row of await allRows(tx.table('itemSwitches'), { where: { system } })) {
|
|
307
311
|
if (touched(row) && !wanted.has(itemKey(row))) { await tx.table('itemSwitches').remove({ system, section: row.section, name: row.name }); }
|
|
@@ -463,7 +467,7 @@ export class SystemLifecycle {
|
|
|
463
467
|
const live: LiveContract = review?.live ?? {
|
|
464
468
|
version: before?.version ?? after.version, hash: before?.hash ?? after.hash, grants: before?.grants ?? after.grants ?? { hub: [] }, runtime: [], by: record.actor, at: clock(),
|
|
465
469
|
};
|
|
466
|
-
if (before === undefined || !settings.
|
|
470
|
+
if (before === undefined || !settings.FNLOOM_REVIEW_SYSTEMS) {
|
|
467
471
|
await store.table('systemReviews').put({ ...(review ?? {}), system, live: { ...live, hash: after.hash, version: after.version, grants: after.grants ?? live.grants }, updatedAt: clock() });
|
|
468
472
|
return;
|
|
469
473
|
}
|
|
@@ -482,7 +486,10 @@ export class SystemLifecycle {
|
|
|
482
486
|
for (const change of waiting) {
|
|
483
487
|
if (change.section !== 'context' || change.change === 'removed') { continue; }
|
|
484
488
|
const name = QualifiedName.parse(change.name);
|
|
485
|
-
|
|
489
|
+
const row = await store.table('context').get(name);
|
|
490
|
+
if (row !== undefined && liveStatus(row.status)) {
|
|
491
|
+
await store.table('context').put(withStatus(row, 'hidden', { by: record.actor, reason: 'Waiting for an admin to review its system\'s new contract.', at: clock() }));
|
|
492
|
+
}
|
|
486
493
|
}
|
|
487
494
|
if (pending !== undefined || review?.pending !== undefined) {
|
|
488
495
|
await catalog.refreshAvailability(system);
|
|
@@ -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 } })) {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ApiError, reject as refuse } from '@ayepi/core';
|
|
9
9
|
import type { Logger } from '@ayepi/log';
|
|
10
|
-
import { EXPORT_NOT_READY, MAIN_INSTANCE, PACKAGE_FORMAT, instanceLabel, packageFileName, type ActorId, type ContentRef, type InstanceName, type InstanceRef, type Json } from '@harness/core';
|
|
10
|
+
import { EXPORT_NOT_READY, MAIN_INSTANCE, PACKAGE_FORMAT, instanceLabel, packageFileName, type ActorId, type ContentRef, type InstanceName, type InstanceRef, type Json, type StorePlacementInput } from '@harness/core';
|
|
11
11
|
import type { ContentStore } from '../api/index.ts';
|
|
12
12
|
import { messageOf } from '../catalog/scope.ts';
|
|
13
13
|
import type { InstanceKeeper } from './status.ts';
|
|
@@ -16,6 +16,7 @@ import { PackageError, readExport, readPackage, readTree, sealExport, unzip, wri
|
|
|
16
16
|
import type { ZipSource } from './process.ts';
|
|
17
17
|
import type { ProcessSupervisor } from './supervisor.ts';
|
|
18
18
|
import type { StoreSystemAdmin } from './systems.ts';
|
|
19
|
+
import type { StoreBackups } from '../stores/backups.ts';
|
|
19
20
|
|
|
20
21
|
/** The content store calls packages use. */
|
|
21
22
|
export type PackageContent = Pick<ContentStore, 'put' | 'open'>;
|
|
@@ -25,6 +26,8 @@ export interface PackagesOptions {
|
|
|
25
26
|
readonly content: () => PackageContent;
|
|
26
27
|
readonly supervisor: ProcessSupervisor;
|
|
27
28
|
readonly admin: StoreSystemAdmin;
|
|
29
|
+
/** What happens to a removed instance's store (looked up when used). */
|
|
30
|
+
readonly storeBackups?: () => Pick<StoreBackups, 'release'>;
|
|
28
31
|
readonly instances: InstanceKeeper;
|
|
29
32
|
readonly links: LinkService;
|
|
30
33
|
/** Configs with their secrets revealed, for an export made with secrets. */
|
|
@@ -78,7 +81,7 @@ export class HubPackages implements Packages {
|
|
|
78
81
|
return { bytes: (hash) => contentBytes(this.#options.content(), hash) };
|
|
79
82
|
}
|
|
80
83
|
|
|
81
|
-
async installZip(input: { zip: ContentRef; instance?: InstanceName; config?: Json; data?: ContentRef; autoStart?: boolean; by: ActorId }): Promise<InstanceRef> {
|
|
84
|
+
async installZip(input: { zip: ContentRef; instance?: InstanceName; config?: Json; data?: ContentRef; autoStart?: boolean; store?: StorePlacementInput; by: ActorId }): Promise<InstanceRef> {
|
|
82
85
|
const { supervisor, instances, log } = this.#options;
|
|
83
86
|
const { manifest } = this.#checked(await this.#bytes(input.zip.hash), (entries) => readPackage(entries));
|
|
84
87
|
const ref: InstanceRef = { system: manifest.name, instance: input.instance ?? MAIN_INSTANCE };
|
|
@@ -92,6 +95,7 @@ export class HubPackages implements Packages {
|
|
|
92
95
|
if (input.data !== undefined || input.config !== undefined) {
|
|
93
96
|
throw refuse(409, 'UPGRADE_KEEPS_DATA', `${instanceLabel(ref)} is installed: an upgrade keeps its data and config, so a data export or config goes only with a new instance`);
|
|
94
97
|
}
|
|
98
|
+
// an upgrade keeps its store where it is (a placement given with it is not a move: that is the Storage panel's)
|
|
95
99
|
await supervisor.upgradeTo(ref.system, source);
|
|
96
100
|
return ref;
|
|
97
101
|
}
|
|
@@ -101,7 +105,10 @@ export class HubPackages implements Packages {
|
|
|
101
105
|
}
|
|
102
106
|
const config = input.config ?? restore?.config;
|
|
103
107
|
const autoStart = input.autoStart ?? true;
|
|
104
|
-
await supervisor.install({
|
|
108
|
+
await supervisor.install({
|
|
109
|
+
source, instance: ref.instance, by: input.by, autoStart: autoStart && restore === undefined, ...(config === undefined ? {} : { config }),
|
|
110
|
+
...(input.store === undefined ? {} : { store: input.store }),
|
|
111
|
+
});
|
|
105
112
|
if (restore !== undefined) {
|
|
106
113
|
await writeTree(restore.data, supervisor.dirsOf(ref).data);
|
|
107
114
|
log.info('packages.data.restored', { system: ref.system, instance: ref.instance, files: restore.data.length, from: restore.info.exportedAt });
|
|
@@ -133,9 +140,15 @@ export class HubPackages implements Packages {
|
|
|
133
140
|
return ref;
|
|
134
141
|
}
|
|
135
142
|
|
|
136
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Remove one instance: uninstalled when the hub installed it, then marked removed. Its store is kept (the default:
|
|
145
|
+
* listed as an orphaned backup, picked up again when the instance comes back) or deleted first, while it is still
|
|
146
|
+
* connected, so a store with the system is deleted by the system itself.
|
|
147
|
+
*/
|
|
148
|
+
async removeInstance(ref: InstanceRef, by: ActorId, keepStore = true): Promise<void> {
|
|
137
149
|
const record = await this.#options.instances.get(ref);
|
|
138
150
|
if (record === undefined) { throw refuse(404, 'NO_INSTANCE', `no instance ${instanceLabel(ref)}`); }
|
|
151
|
+
if (record.status !== 'removed') { await this.#options.storeBackups?.().release(ref, keepStore, by); }
|
|
139
152
|
if (record.installed !== undefined) { await this.#options.supervisor.uninstall(ref.system, ref.instance); }
|
|
140
153
|
await this.#options.admin.removeInstance(ref, by);
|
|
141
154
|
}
|
|
@@ -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;
|
|
@@ -199,7 +199,7 @@ export class StorePairingService implements PairingService {
|
|
|
199
199
|
} else {
|
|
200
200
|
// the same address asking again for the same name: this hello takes the request over, so it is announced once
|
|
201
201
|
// (what the earlier socket said about itself was its own, so it goes)
|
|
202
|
-
const { description: _description, configType: _type, configSecrets: _secrets, replaces: _replaces, ...earlier } = fromThere;
|
|
202
|
+
const { description: _description, configType: _type, configSecrets: _secrets, store: _store, replaces: _replaces, ...earlier } = fromThere;
|
|
203
203
|
request = await store.table('pairings').put({ ...earlier, ...base, createdAt: earlier.createdAt, expiresAt: earlier.expiresAt, code: pairingCode() });
|
|
204
204
|
this.#waiting.delete(request.id);
|
|
205
205
|
this.#options.bus.publish('pairing', { pairing: request });
|
|
@@ -225,7 +225,7 @@ export class StorePairingService implements PairingService {
|
|
|
225
225
|
if (rekeys && request.method === 'code') { throw rekeyNeedsToken(request.name); }
|
|
226
226
|
const updated = await this.#options.store.table('pairings').put({
|
|
227
227
|
...request, description: info.description, instance: info.instance, ...(info.configType === undefined ? {} : { configType: info.configType }),
|
|
228
|
-
...(info.configSecrets === undefined ? {} : { configSecrets: info.configSecrets }),
|
|
228
|
+
...(info.configSecrets === undefined ? {} : { configSecrets: info.configSecrets }), ...(info.store === undefined ? {} : { store: info.store }),
|
|
229
229
|
...(rekeys ? { replaces: request.name } : {}),
|
|
230
230
|
});
|
|
231
231
|
this.#options.bus.publish('pairing', { pairing: updated });
|
|
@@ -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';
|
|
@@ -89,10 +89,16 @@ export class NodeInstaller implements Installer {
|
|
|
89
89
|
if (!entries.some((entry) => entry.path === 'package.json')) {
|
|
90
90
|
await writeFile(join(dir, 'package.json'), `${JSON.stringify({ private: true, type: 'module' }, null, 2)}\n`);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
if (externals.length > 0) {
|
|
94
|
-
await run(this.#npm, ['install', '--prefix', dir, '--omit=dev', '--no-save', '--no-package-lock', ...externals], { shell: process.platform === 'win32' });
|
|
95
|
-
}
|
|
92
|
+
await this.installPackages(dir, Object.entries(checked.manifest.server.external).map(([name, range]) => `${name}@${range}`));
|
|
96
93
|
return this.describe(dir);
|
|
97
94
|
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* `npm install` packages (`name@range`) into a folder's `node_modules`, left off its package.json: a zip system's
|
|
98
|
+
* `server.external`, or the drivers an external store needs (`stores/drivers.ts`).
|
|
99
|
+
*/
|
|
100
|
+
async installPackages(dir: string, specs: readonly string[]): Promise<void> {
|
|
101
|
+
if (specs.length === 0) { return; }
|
|
102
|
+
await run(this.#npm, ['install', '--prefix', dir, '--omit=dev', '--no-save', '--no-package-lock', ...specs], { shell: process.platform === 'win32' });
|
|
103
|
+
}
|
|
98
104
|
}
|
|
@@ -26,18 +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: {
|
|
30
|
-
packaging: {
|
|
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
|
+
packaging: {
|
|
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
|
+
},
|
|
31
34
|
link: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,
|
|
36
39
|
},
|
|
37
|
-
model: {
|
|
38
|
-
index: {
|
|
39
|
-
search: {
|
|
40
|
-
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 },
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
/** A launcher for rigs that never start processes. */
|
|
@@ -54,7 +57,7 @@ export async function linkRig(options: { publicUrl?: string; review?: Partial<Sy
|
|
|
54
57
|
const vault = new AesSecretVault({ store, box: new SecretBox('a-key-that-is-long-enough-for-the-hub-0123'), clock });
|
|
55
58
|
const settings: SystemsSettings = {
|
|
56
59
|
...RIG_SETTINGS,
|
|
57
|
-
...(options.publicUrl === undefined ? {} : { packaging: { ...RIG_SETTINGS.packaging,
|
|
60
|
+
...(options.publicUrl === undefined ? {} : { packaging: { ...RIG_SETTINGS.packaging, FNLOOM_PUBLIC_URL: options.publicUrl } }),
|
|
58
61
|
review: { ...RIG_SETTINGS.review, ...options.review },
|
|
59
62
|
link: { ...RIG_SETTINGS.link, ...options.link },
|
|
60
63
|
};
|
|
@@ -158,6 +161,7 @@ export class FakeSystem {
|
|
|
158
161
|
run: notHere, control: notHere, undo: notHere, handler: notHere, child: notHere, context: notHere, hook: notHere, mentions: notHere,
|
|
159
162
|
mentionHover: notHere, mentionText: notHere, action: notHere, form: notHere, restart: notHere,
|
|
160
163
|
validate: notHere, preview: notHere, flags: notHere, claims: notHere, checkArgs: notHere, estimate: notHere, providerChat: notHere, providerDecide: notHere, connectStart: notHere, connectFinish: notHere, disconnect: notHere,
|
|
164
|
+
storeProbe: notHere, storeMove: notHere, storeMoveEnd: notHere, storeDiscard: notHere,
|
|
161
165
|
})]);
|
|
162
166
|
const ws: ClientWs = {
|
|
163
167
|
send: (frame) => { if (this.conn !== null) { void this.#app.ws.message(this.conn, frame); } },
|
|
@@ -95,6 +95,20 @@ export class InstanceKeeper {
|
|
|
95
95
|
return result.saved;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Make every instance row agree with the connections there are now: one that says connected (or needs config) with
|
|
100
|
+
* no live connection is written disconnected, its system's status with it. A hub that was killed never wrote its
|
|
101
|
+
* systems' disconnects, so at boot their rows still say connected; until they connect again (from this boot) nothing
|
|
102
|
+
* may treat them as ready (`fnloom start`'s banner, a run sent to them), and their connecting again must read as a
|
|
103
|
+
* change (`system.status`, which sends their waiting runs). Returns the instances it changed.
|
|
104
|
+
*/
|
|
105
|
+
async reconcile(): Promise<InstanceRef[]> {
|
|
106
|
+
const stale = (await allRows(this.#store.table('instances'))).filter((record) =>
|
|
107
|
+
(record.status === 'connected' || record.status === 'needs-config') && this.#links.connection(record.system, record.instance) === undefined);
|
|
108
|
+
for (const record of stale) { await this.sync({ system: record.system, instance: record.instance }); }
|
|
109
|
+
return stale.map((record) => ({ system: record.system, instance: record.instance }));
|
|
110
|
+
}
|
|
111
|
+
|
|
98
112
|
/**
|
|
99
113
|
* Change a system's own row (its switches, its default instance) and recompute its status. Throws when the system
|
|
100
114
|
* is unknown.
|