fnloom 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -20
- package/package.json +14 -11
- package/packages/build/package.json +2 -2
- package/packages/build/src/tests.ts +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/cli.ts +2 -2
- package/packages/cli/src/command.ts +2 -2
- package/packages/cli/src/commands/install.ts +1 -1
- package/packages/cli/src/commands/mcp.ts +6 -6
- package/packages/cli/src/commands/store.ts +3 -3
- package/packages/cli/src/hub.ts +25 -25
- package/packages/cli/src/index.ts +1 -1
- package/packages/cli/src/io.ts +2 -2
- package/packages/cli/src/local.ts +7 -7
- package/packages/cli/src/premade.ts +1 -1
- package/packages/core/package.json +4 -4
- package/packages/core/src/auto-pair.ts +1 -1
- package/packages/core/src/connections.ts +1 -14
- package/packages/core/src/context-graph.ts +1 -1
- package/packages/core/src/data.ts +1 -1
- package/packages/core/src/https.ts +2 -2
- package/packages/core/src/identity.ts +1 -1
- package/packages/core/src/image-embeddings.ts +1 -1
- package/packages/core/src/index.ts +5 -7
- package/packages/core/src/link.ts +1 -1
- package/packages/core/src/manifest.ts +2 -2
- package/packages/core/src/mention-search.ts +1 -1
- package/packages/core/src/model-calls.ts +1 -1
- package/packages/core/src/package.ts +1 -1
- package/packages/core/src/ports.ts +2 -2
- package/packages/core/src/query.ts +1 -1
- package/packages/core/src/records/chat.ts +1 -1
- package/packages/core/src/records/runs.ts +1 -1
- package/packages/core/src/records/spend.ts +4 -0
- package/packages/core/src/registries.ts +9 -3
- package/packages/core/src/sso.ts +2 -2
- package/packages/core/src/stores.ts +1 -1
- package/packages/core/src/suggestions.ts +2 -2
- package/packages/core/src/system-pages.ts +32 -6
- package/packages/core/src/tables.ts +233 -0
- package/packages/core/src/visuals.ts +47 -139
- package/packages/core/src/web.ts +2 -2
- package/packages/core/src/widgets-v1.ts +78 -1
- package/packages/hub/package.json +13 -11
- package/packages/hub/src/api/admin-ops.ts +5 -5
- package/packages/hub/src/api/auth.ts +2 -2
- package/packages/hub/src/api/https.ts +6 -6
- package/packages/hub/src/api/identities.ts +1 -1
- package/packages/hub/src/api/reads.ts +1 -1
- package/packages/hub/src/api/secrets.ts +1 -1
- package/packages/hub/src/api/serve.ts +2 -2
- package/packages/hub/src/api/sso-route.ts +2 -2
- package/packages/hub/src/api/sso.ts +6 -6
- package/packages/hub/src/api/testing/rig.ts +1 -1
- package/packages/hub/src/api/tls.ts +2 -2
- package/packages/hub/src/api/web/auth.ts +1 -1
- package/packages/hub/src/api/web/find.ts +1 -1
- package/packages/hub/src/api/web/pages.ts +4 -3
- package/packages/hub/src/api/web/pickers.ts +4 -4
- package/packages/hub/src/boot/env.ts +82 -78
- package/packages/hub/src/boot/hub-fns.ts +1 -1
- package/packages/hub/src/boot/identity.ts +2 -2
- package/packages/hub/src/boot/index.ts +1 -1
- package/packages/hub/src/boot/info.ts +1 -1
- package/packages/hub/src/boot/keys.ts +6 -6
- package/packages/hub/src/boot/log.ts +4 -4
- package/packages/hub/src/boot/modules.ts +4 -4
- package/packages/hub/src/boot/services.ts +9 -9
- package/packages/hub/src/boot/start.ts +23 -23
- package/packages/hub/src/chat/cache.ts +1 -1
- package/packages/hub/src/chat/chat.ts +1 -1
- package/packages/hub/src/chat/compare.ts +2 -2
- package/packages/hub/src/chat/deliveries.ts +1 -1
- package/packages/hub/src/chat/deps.ts +3 -3
- package/packages/hub/src/chat/enrich.ts +7 -7
- package/packages/hub/src/chat/env.ts +20 -20
- package/packages/hub/src/chat/mention-requests.ts +1 -1
- package/packages/hub/src/chat/mention-search.ts +1 -1
- package/packages/hub/src/chat/mentions.ts +3 -3
- package/packages/hub/src/chat/notifications.ts +2 -2
- package/packages/hub/src/chat/presence.ts +2 -2
- package/packages/hub/src/chat/sessions.ts +2 -2
- package/packages/hub/src/chat/suggestions.ts +8 -8
- package/packages/hub/src/chat/testing.ts +1 -1
- package/packages/hub/src/chat/turns.ts +6 -6
- package/packages/hub/src/chat/undo.ts +1 -1
- package/packages/hub/src/connections/create.ts +1 -1
- package/packages/hub/src/connections/env.ts +2 -2
- package/packages/hub/src/connections/service.ts +5 -9
- package/packages/hub/src/contextor/contextors.ts +9 -9
- package/packages/hub/src/contextor/crawl.ts +1 -1
- package/packages/hub/src/contextor/create.ts +5 -5
- package/packages/hub/src/contextor/dynamic.ts +5 -5
- package/packages/hub/src/contextor/env.ts +46 -46
- package/packages/hub/src/contextor/injected.ts +1 -1
- package/packages/hub/src/contextor/limits.ts +9 -9
- package/packages/hub/src/contextor/planner.ts +11 -11
- package/packages/hub/src/contextor/testing.ts +1 -1
- package/packages/hub/src/data/env.ts +3 -3
- package/packages/hub/src/data/service.ts +5 -5
- package/packages/hub/src/execution/agent.ts +8 -8
- package/packages/hub/src/execution/ai.ts +7 -7
- package/packages/hub/src/execution/create.ts +11 -6
- package/packages/hub/src/execution/env.ts +16 -16
- package/packages/hub/src/execution/executors.ts +2 -2
- package/packages/hub/src/execution/gateway.ts +1 -1
- package/packages/hub/src/execution/index.ts +1 -1
- package/packages/hub/src/execution/ledger.ts +2 -2
- package/packages/hub/src/execution/limits.ts +2 -2
- package/packages/hub/src/execution/models.ts +2 -2
- package/packages/hub/src/execution/ports.ts +1 -1
- package/packages/hub/src/execution/providers.ts +55 -11
- package/packages/hub/src/execution/queues.ts +6 -6
- package/packages/hub/src/execution/runs.ts +10 -10
- package/packages/hub/src/execution/stream-guard.ts +2 -2
- package/packages/hub/src/execution/testing.ts +5 -5
- package/packages/hub/src/execution/wire.ts +3 -3
- package/packages/hub/src/fns/auto.ts +2 -2
- package/packages/hub/src/fns/client-logs.ts +2 -2
- package/packages/hub/src/fns/create.ts +2 -2
- package/packages/hub/src/fns/decided.ts +2 -2
- package/packages/hub/src/fns/env.ts +14 -14
- package/packages/hub/src/fns/examples.ts +3 -3
- package/packages/hub/src/fns/facts.ts +5 -5
- package/packages/hub/src/fns/search.ts +5 -5
- package/packages/hub/src/graph/graph.ts +1 -1
- package/packages/hub/src/index/context-sections.ts +1 -1
- package/packages/hub/src/index/embedders.ts +3 -3
- package/packages/hub/src/index/env.ts +12 -12
- package/packages/hub/src/index/index.ts +1 -1
- package/packages/hub/src/index/indexer.ts +4 -4
- package/packages/hub/src/index/search.ts +1 -1
- package/packages/hub/src/index/testing.ts +2 -2
- package/packages/hub/src/link/build.ts +32 -32
- package/packages/hub/src/link/env.ts +14 -14
- package/packages/hub/src/link/grants.ts +10 -10
- package/packages/hub/src/link/lifecycle.ts +4 -4
- package/packages/hub/src/link/migrate-api.ts +55 -15
- package/packages/hub/src/link/pairing.ts +1 -1
- package/packages/hub/src/link/process.ts +1 -1
- package/packages/hub/src/link/rig.ts +12 -12
- package/packages/hub/src/link/supervisor.ts +1 -1
- package/packages/hub/src/mcp/calls.ts +6 -6
- package/packages/hub/src/mcp/create.ts +5 -5
- package/packages/hub/src/mcp/env.ts +6 -6
- package/packages/hub/src/mcp/fns.ts +2 -2
- package/packages/hub/src/mcp/index.ts +2 -2
- package/packages/hub/src/mcp/sources.ts +3 -3
- package/packages/hub/src/mcp/tokens.ts +1 -1
- package/packages/hub/src/models/create.ts +1 -1
- package/packages/hub/src/models/decide.ts +2 -2
- package/packages/hub/src/models/index.ts +1 -1
- package/packages/hub/src/models/roles.ts +12 -12
- package/packages/hub/src/query/env.ts +5 -5
- package/packages/hub/src/query/sources.ts +3 -3
- package/packages/hub/src/questions/plans.ts +1 -1
- package/packages/hub/src/questions/worker.ts +2 -2
- package/packages/hub/src/resources/context.ts +3 -3
- package/packages/hub/src/resources/converters.ts +2 -2
- package/packages/hub/src/resources/create.ts +6 -6
- package/packages/hub/src/resources/env.ts +15 -15
- package/packages/hub/src/resources/fetch.ts +5 -5
- package/packages/hub/src/resources/forms.ts +5 -5
- package/packages/hub/src/resources/index.ts +1 -1
- package/packages/hub/src/resources/library.ts +2 -2
- package/packages/hub/src/resources/raw.ts +1 -1
- package/packages/hub/src/resources/reader.ts +2 -2
- package/packages/hub/src/resources/sqlite-files.ts +1 -1
- package/packages/hub/src/resources/storage.ts +5 -5
- package/packages/hub/src/resources/testing.ts +6 -6
- package/packages/hub/src/store/env.ts +4 -4
- package/packages/hub/src/store/hybrid.ts +4 -4
- package/packages/hub/src/store/sqlite.ts +3 -3
- package/packages/hub/src/stores/drivers.ts +2 -2
- package/packages/hub/src/stores/host.ts +3 -3
- package/packages/hub/src/stores/moves.ts +2 -2
- package/packages/hub/src/stores/service.ts +2 -2
- package/packages/hub/src/tables/env.ts +3 -3
- package/packages/hub/src/tables/index.ts +5 -5
- package/packages/hub/src/tables/service.ts +7 -7
- package/packages/sdk/AUTHORING.md +1206 -881
- package/packages/sdk/package.json +11 -8
- package/packages/sdk/src/agent.ts +1 -1
- package/packages/sdk/src/app-parts.ts +95 -0
- package/packages/sdk/src/authored.ts +26 -0
- package/packages/sdk/src/authoring.ts +13 -30
- package/packages/sdk/src/client-runtime.ts +24 -1
- package/packages/sdk/src/client-ui/AddServiceDialog.vue +43 -0
- package/packages/sdk/src/client-ui/InstanceNameField.vue +29 -0
- package/packages/sdk/src/client-ui/PairRowsEditor.vue +74 -0
- package/packages/sdk/src/client-ui/RemoteAuthFields.vue +95 -0
- package/packages/sdk/src/client-ui/ServiceRows.vue +57 -0
- package/packages/sdk/src/client-ui/draft.ts +10 -0
- package/packages/sdk/src/client-ui/host.ts +37 -0
- package/packages/sdk/src/client-ui/index.ts +19 -0
- package/packages/sdk/src/client-ui/loaded.ts +69 -0
- package/packages/sdk/src/client-ui/problems.ts +98 -0
- package/packages/sdk/src/client-ui/remote-config.ts +199 -0
- package/packages/sdk/src/client-ui/service-rows.ts +25 -0
- package/packages/sdk/src/client-ui/state.ts +14 -0
- package/packages/sdk/src/client-ui/testing.ts +147 -0
- package/packages/sdk/src/client-ui/vue-shim.d.ts +13 -0
- package/packages/sdk/src/client.ts +82 -11
- package/packages/sdk/src/hub.ts +4 -4
- package/packages/sdk/src/index.ts +13 -9
- package/packages/sdk/src/page-parts.ts +4 -0
- package/packages/sdk/src/program/env.ts +7 -7
- package/packages/sdk/src/program/runtime.ts +5 -5
- package/packages/sdk/src/program/tools.ts +3 -3
- package/packages/sdk/src/remote-auth.ts +128 -7
- package/packages/sdk/src/server/context-files.ts +1 -1
- package/packages/sdk/src/server/env.ts +36 -36
- package/packages/sdk/src/server/fake-hub-widgets.ts +7 -6
- package/packages/sdk/src/server/host.ts +28 -28
- package/packages/sdk/src/server/index.ts +2 -2
- package/packages/sdk/src/server/live.ts +4 -4
- package/packages/sdk/src/server/llm-wire.ts +4 -4
- package/packages/sdk/src/server/pairing.ts +1 -1
- package/packages/sdk/src/server/results.ts +4 -4
- package/packages/sdk/src/server/socket-guard.ts +1 -1
- package/packages/sdk/src/server/start-gate.ts +2 -2
- package/packages/sdk/src/server/store/engines.ts +2 -2
- package/packages/sdk/src/server/store/keeper.ts +2 -2
- package/packages/sdk/src/server/supervise.ts +4 -4
- package/packages/sdk/src/testing/env.ts +6 -6
- package/packages/sdk/src/testing/hub.ts +3 -1
- package/packages/sdk/src/testing/models.ts +3 -3
- package/packages/sdk/src/testing/openrouter.ts +3 -2
- package/packages/sdk/src/testing/preview.ts +7 -7
- package/packages/sdk/src/widgets.ts +21 -136
- package/packages/sdk/tsconfig.json +2 -2
- package/packages/web/dist/assets/{ActorSettingsView-v2k7v454.js → ActorSettingsView-CDszUbHz.js} +2 -2
- package/packages/web/dist/assets/AdminLayout-CFIz4GsQ.js +2 -0
- package/packages/web/dist/assets/{AdminLayout-1hbRPV3d.css → AdminLayout-ggcdQGlQ.css} +1 -1
- package/packages/web/dist/assets/{AppPage-CFmKZS8G.js → AppPage-BvoVTk6h.js} +2 -2
- package/packages/web/dist/assets/{AutoPairPicker-C61gihmh.js → AutoPairPicker-CLjD-muP.js} +2 -2
- package/packages/web/dist/assets/{BrowserFrame-Sq9EmQRT.js → BrowserFrame-BcN-A76X.js} +2 -2
- package/packages/web/dist/assets/ChatPage-DhTpAyM2.js +4 -0
- package/packages/web/dist/assets/{ChatPage-CbsRmktV.css → ChatPage-DjPv238m.css} +1 -1
- package/packages/web/dist/assets/{CodeViewer-tUNXZB77.js → CodeViewer-K9jrTmFO.js} +2 -2
- package/packages/web/dist/assets/ConfigWithCustom-BvrvSVIp.js +3 -0
- package/packages/web/dist/assets/{ConfirmDialog-Dd3E4sJt.js → ConfirmDialog-BDvLleYf.js} +2 -2
- package/packages/web/dist/assets/{ConnectPage-CX9acyQH.js → ConnectPage-Dg6IPNNh.js} +2 -2
- package/packages/web/dist/assets/ContextItemPage-qisBQetR.js +2 -0
- package/packages/web/dist/assets/ContextPage-DXa6Yqk-.js +3 -0
- package/packages/web/dist/assets/{ContextRow-DrtPumZ5.js → ContextRow-DDYnYRaL.js} +2 -2
- package/packages/web/dist/assets/{DataPage-DDSsxHro.js → DataPage-DOE_pKAY.js} +2 -2
- package/packages/web/dist/assets/DataTypePage-BnP_JELT.js +2 -0
- package/packages/web/dist/assets/{DataTypePage-Cr238Hx_.css → DataTypePage-CWrWvUPs.css} +1 -1
- package/packages/web/dist/assets/{DesignPage-6e0XbOFC.js → DesignPage-B9MJbF10.js} +3 -3
- package/packages/web/dist/assets/{ExplorePage-B7ND0W0l.js → ExplorePage-cRDQZRea.js} +2 -2
- package/packages/web/dist/assets/{FnPill-Cp3KuLmP.js → FnPill-CbLZCXYM.js} +2 -2
- package/packages/web/dist/assets/{FnView-C0XZdnsS.js → FnView-CG_wBKTP.js} +2 -2
- package/packages/web/dist/assets/{FnsView-GTH3p7a0.js → FnsView-BybyK12w.js} +2 -2
- package/packages/web/dist/assets/{GinExprView-DGxns6lH.js → GinExprView-BYCKSD_n.js} +2 -2
- package/packages/web/dist/assets/{GinForm-BDBUzuDP.js → GinForm-CXjYVf2_.js} +2 -2
- package/packages/web/dist/assets/{GinTypeView-CUsymbVf.js → GinTypeView-Bmbmx9e_.js} +2 -2
- package/packages/web/dist/assets/{GinValueView-jsKIfiEA.js → GinValueView-CWUzS7ti.js} +2 -2
- package/packages/web/dist/assets/{GraphPage-BCcPPsHu.js → GraphPage-D6OhckfJ.js} +2 -2
- package/packages/web/dist/assets/GraphPanel-BTitgA-K.js +2 -0
- package/packages/web/dist/assets/{HubPicker-EoOErgmk.js → HubPicker-DVly8dLD.js} +2 -2
- package/packages/web/dist/assets/{InboxApprovals-Dkq7DFp_.js → InboxApprovals-BF84edZU.js} +2 -2
- package/packages/web/dist/assets/{InboxPage-CHhslePq.js → InboxPage-DohZ9EDP.js} +2 -2
- package/packages/web/dist/assets/InjectedList-e6qr1kdU.js +2 -0
- package/packages/web/dist/assets/{InstallDialog-D-VwfZYF.js → InstallDialog-JJCKYs2s.js} +2 -2
- package/packages/web/dist/assets/InstanceTypes-BqUzx87o.js +2 -0
- package/packages/web/dist/assets/InstanceView-C73pev7A.js +2 -0
- package/packages/web/dist/assets/{ItemHistory-NQAP69ma.js → ItemHistory-dbGgOZsw.js} +2 -2
- package/packages/web/dist/assets/LimitsView-Ddp5WakY.js +2 -0
- package/packages/web/dist/assets/{ListSearch-BunVrDO0.js → ListSearch-CYNNAuMB.js} +2 -2
- package/packages/web/dist/assets/{LlmCallDetails-BoVNDTVs.js → LlmCallDetails-C9H5Hc2J.js} +2 -2
- package/packages/web/dist/assets/{LlmCallsView-BGpV92RC.js → LlmCallsView-CBqyZ8Cj.js} +2 -2
- package/packages/web/dist/assets/{LoadState-h-K9bTYc.js → LoadState-B2YhZlyC.js} +2 -2
- package/packages/web/dist/assets/McpDialog-DhlLklIq.js +2 -0
- package/packages/web/dist/assets/{McpView-GPXdCMne.js → McpView-D_ZmNO56.js} +2 -2
- package/packages/web/dist/assets/{McpsView-DJIR2JX5.js → McpsView-9_gwBuzw.js} +2 -2
- package/packages/web/dist/assets/{MemoryDialog-BTeIHQyA.js → MemoryDialog-pTHIxKEX.js} +2 -2
- package/packages/web/dist/assets/{ModelCallsView-DMcnwF2S.js → ModelCallsView-FHv2XWRX.js} +2 -2
- package/packages/web/dist/assets/{ModelPicker-CgkMFxSO.js → ModelPicker-EqOuvVnE.js} +2 -2
- package/packages/web/dist/assets/ModelsView-D9UaL4PX.js +2 -0
- package/packages/web/dist/assets/{NotFoundPage-Tk92K7HN.js → NotFoundPage-BsuJysan.js} +2 -2
- package/packages/web/dist/assets/{PairPage-D0BK8CCw.js → PairPage-B_ZXsbL4.js} +2 -2
- package/packages/web/dist/assets/{PanelHost-C-gKrxAk.js → PanelHost-Dx-vNNl5.js} +2 -2
- package/packages/web/dist/assets/PeopleView-D6dmEgMs.js +2 -0
- package/packages/web/dist/assets/{PeopleView-CJ8yArTh.css → PeopleView-DBxdbT1C.css} +1 -1
- package/packages/web/dist/assets/{PoliciesView-BRi-QAuo.js → PoliciesView-Bn4rm-ao.js} +2 -2
- package/packages/web/dist/assets/{RefusalList-DVO0bmeB.js → RefusalList-aosRD1ie.js} +2 -2
- package/packages/web/dist/assets/RendererHost-Ym_SMkhp.css +1 -0
- package/packages/web/dist/assets/RendererHost-rjnpSgyQ.js +2 -0
- package/packages/web/dist/assets/{ResourceViewer-Do0chYxU.js → ResourceViewer-C4tRColf.js} +2 -2
- package/packages/web/dist/assets/ResourcesPage-7mCLBORZ.js +2 -0
- package/packages/web/dist/assets/ResultGrid-CL2WSYQH.css +1 -0
- package/packages/web/dist/assets/ResultGrid-GIMoQUAr.js +2 -0
- package/packages/web/dist/assets/{ReviewSummaryStrip-DO3p64Qj.js → ReviewSummaryStrip-Bvjn3Iq8.js} +2 -2
- package/packages/web/dist/assets/ReviewView-DIqsUedT.js +3 -0
- package/packages/web/dist/assets/{RuleRow-DX9v4iGP.js → RuleRow-zRg-e8Vj.js} +2 -2
- package/packages/web/dist/assets/RunCard-C7wOGaw8.js +2 -0
- package/packages/web/dist/assets/RunCard-CSDiz-Nt.css +1 -0
- package/packages/web/dist/assets/{RunDetails-DjR206q6.js → RunDetails-W4GbE6AE.js} +2 -2
- package/packages/web/dist/assets/{RunDot-lHRICdM5.js → RunDot-C46uzzNM.js} +2 -2
- package/packages/web/dist/assets/{RunPage-CbAQ_WPR.js → RunPage-DPLtZpeB.js} +2 -2
- package/packages/web/dist/assets/{RunProgress-C3-B4tQf.js → RunProgress-Cr_6TBaF.js} +2 -2
- package/packages/web/dist/assets/{RunsView-DMkPmkqX.js → RunsView-tU350TPK.js} +2 -2
- package/packages/web/dist/assets/SettingsPage-B8QmmMN3.js +3 -0
- package/packages/web/dist/assets/{SettingsPage-t03BqXw8.css → SettingsPage-BTl3Ie4F.css} +1 -1
- package/packages/web/dist/assets/SignInPage-CXxLf7Rp.css +1 -0
- package/packages/web/dist/assets/{SignInPage-ByqGEZfj.js → SignInPage-DTwdqlnB.js} +2 -2
- package/packages/web/dist/assets/{StatusBadge-CXne0sRZ.js → StatusBadge-D7wKMAcD.js} +2 -2
- package/packages/web/dist/assets/{StorePlacementStep-B6SwTmdM.js → StorePlacementStep-C04nRU-u.js} +2 -2
- package/packages/web/dist/assets/{SystemConfig-vQDL_eUl.js → SystemConfig-CE3keXWq.js} +2 -2
- package/packages/web/dist/assets/SystemPageHost-CEhz4li8.js +2 -0
- package/packages/web/dist/assets/SystemPageHost-DX7LrFoN.css +1 -0
- package/packages/web/dist/assets/SystemView-CBFzEGfm.js +2 -0
- package/packages/web/dist/assets/SystemsView-0G8JntMV.js +2 -0
- package/packages/web/dist/assets/TableView-BK0uwLHl.js +3 -0
- package/packages/web/dist/assets/TableView-B_4MViVb.css +1 -0
- package/packages/web/dist/assets/{TableViewer-Boxx86f5.js → TableViewer-nbMInGJJ.js} +3 -3
- package/packages/web/dist/assets/{ThemePicker-CIg_oRQX.js → ThemePicker-fZpVSYqG.js} +2 -2
- package/packages/web/dist/assets/{TurnTree-Ecm0yA5g.js → TurnTree-Co-iBqhT.js} +2 -2
- package/packages/web/dist/assets/{UserMessage-BtECa8ka.css → UserMessage-B63G9sxC.css} +1 -1
- package/packages/web/dist/assets/{UserMessage-BlnqZDVU.js → UserMessage-CDjUxKY0.js} +6 -6
- package/packages/web/dist/assets/{ValueVisual-C-MWpp7c.js → ValueVisual-EJnCKgSy.js} +2 -2
- package/packages/web/dist/assets/{fn-modal-B98MR7JN.js → fn-modal-DtE65mFt.js} +2 -2
- package/packages/web/dist/assets/{fn-notices-CfTa1E8y.js → fn-notices-CCZ-DFbi.js} +2 -2
- package/packages/web/dist/assets/{formats-JwoKfXIq.js → formats-CyHV2siv.js} +2 -2
- package/packages/web/dist/assets/index-BY7M8QUk.css +1 -0
- package/packages/web/dist/assets/index-OZS2EluT.js +4 -0
- package/packages/web/dist/assets/{labels-BFbk11BE.js → labels-CT7_K0Pt.js} +2 -2
- package/packages/web/dist/assets/{layout-D1gf481r.js → layout-B6fBDg80.js} +2 -2
- package/packages/web/dist/assets/loaded-LaPjk6mK.js +2 -0
- package/packages/web/dist/assets/{metrics-CBPX3W5Y.js → metrics-9n8bKI7u.js} +2 -2
- package/packages/web/dist/assets/problems--AW4igVY.js +2 -0
- package/packages/web/dist/assets/{push-payload-BeU1ADYt.js → push-payload-B3EcrsVz.js} +64 -64
- package/packages/web/dist/assets/record-edits-B-FWAbxR.js +2 -0
- package/packages/web/dist/assets/{review-fP-l9D6H.js → review-uLESCEz1.js} +3 -3
- package/packages/web/dist/assets/routes-B7Zmt8wh.js +4 -0
- package/packages/web/dist/assets/{runs-CveC2kKo.js → runs-CUb2PTFg.js} +2 -2
- package/packages/web/dist/assets/{shared-LbaIHjbV.js → shared-Bxhw_9et.js} +2 -2
- package/packages/web/dist/assets/{sources-VPrtgLIi.js → sources-YgkjgFLe.js} +2 -2
- package/packages/web/dist/assets/src-DY1fSFJS.js +43 -0
- package/packages/web/dist/assets/state-ChQDWWj-.js +2 -0
- package/packages/web/dist/assets/{systems-BqE3WTSF.js → systems-CjwjRySu.js} +2 -2
- package/packages/web/dist/assets/table-host-B_D9dmCz.js +2 -0
- package/packages/web/dist/assets/tables-CaxIuHdw.js +2 -0
- package/packages/web/dist/assets/{ui-BzgWquIU.js → ui-DWjytmDS.js} +5 -5
- package/packages/web/dist/assets/{url-DKGcECT1.js → url-DbGOI14W.js} +2 -2
- package/packages/web/dist/index.html +49 -47
- package/packages/web/dist/sw.js +1 -1
- package/packages/web/package.json +2 -4
- package/premade/claude.zip +0 -0
- package/premade/database.zip +0 -0
- package/premade/web.zip +0 -0
- package/scripts/dev-env.ts +9 -9
- package/scripts/run-stack.ts +15 -15
- package/scripts/stack.ts +3 -3
- package/scripts/start.ts +18 -18
- package/systems/api/client/ApiServiceForm.vue +55 -0
- package/systems/api/client/ServiceList.vue +90 -0
- package/systems/api/client/ServicePage.vue +142 -0
- package/systems/api/client/ServicesPage.vue +32 -0
- package/systems/api/client/index.ts +15 -0
- package/systems/api/client/logic.ts +140 -0
- package/systems/api/client/state.ts +92 -0
- package/systems/api/package.json +9 -6
- package/systems/api/server/authoring.ts +2 -1
- package/systems/api/server/env.ts +1 -1
- package/systems/api/server/guard.ts +1 -1
- package/systems/api/server/http.ts +3 -2
- package/systems/api/server/impl.ts +3 -2
- package/systems/api/server/main.ts +11 -7
- package/systems/api/server/openapi.ts +1 -1
- package/systems/api/server/program.ts +2 -1
- package/systems/api/server/services.ts +2 -1
- package/systems/api/shared/http.ts +2 -1
- package/systems/api/shared/index.ts +15 -5
- package/{packages/core/src/programs.ts → systems/api/shared/services.ts} +7 -51
- package/systems/api/system.json +2 -1
- package/systems/api/tsconfig.json +2 -2
- package/systems/code/package.json +4 -3
- package/systems/code/server/authoring.ts +2 -1
- package/systems/code/server/impl.ts +2 -1
- package/systems/code/server/main.ts +5 -5
- package/systems/code/shared/index.ts +2 -3
- package/systems/code/shared/program.ts +23 -0
- package/systems/embedder/package.json +1 -1
- package/systems/embedder/server/env.ts +1 -1
- package/systems/embedder/server/main.ts +5 -5
- package/systems/embedder/shared/index.ts +1 -1
- package/systems/fs/client/machines/fakes.ts +1 -1
- package/systems/fs/client/machines/files/fakes.ts +1 -1
- package/systems/fs/client/machines/palette.ts +3 -2
- package/systems/fs/context/authoring/parts/client.md +23 -5
- package/systems/fs/context/authoring/parts/client.reference/client.md +7 -16
- package/systems/fs/context/authoring/parts/client.reference/pageinbox.md +524 -0
- package/systems/fs/context/authoring/parts/client.reference/{resultview.md → visuals.md} +85 -116
- package/systems/fs/context/authoring/parts/client.reference.md +8 -8
- package/systems/fs/context/authoring/parts/context.md +1 -1
- package/systems/fs/context/authoring/parts/contract.md +1 -1
- package/systems/fs/context/authoring/parts/core-types/admin-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/connections-ts.md +12 -1
- package/systems/fs/context/authoring/parts/core-types/context-files-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/context-graph-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/contextdecl.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/lifecycle-ts.md +27 -2
- package/systems/fs/context/authoring/parts/core-types/manifest.md +27 -2
- package/systems/fs/context/authoring/parts/core-types/manifestpatch.md +26 -2
- package/systems/fs/context/authoring/parts/core-types/modes-ts.md +3 -3
- package/systems/fs/context/authoring/parts/core-types/records-systems-ts.md +145 -1
- package/systems/fs/context/authoring/parts/core-types/registries-ts.md +98 -2
- package/systems/fs/context/authoring/parts/core-types/run-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/system-pages-ts.md +4 -2
- package/systems/fs/context/authoring/parts/core-types/system-providers-ts.md +2 -2
- package/systems/fs/context/authoring/parts/core-types/tables-ts.md +91 -0
- package/systems/fs/context/authoring/parts/core-types/web-ts.md +1 -2
- package/systems/fs/context/authoring/parts/core-types.md +5 -8
- package/systems/fs/context/authoring/parts/examples/server-main-ts.md +4 -4
- package/systems/fs/context/authoring/parts/examples/systems-fs-shared-index-ts-lines-568-660.md +1 -1
- package/systems/fs/context/authoring/parts/fns.md +1 -1
- package/systems/fs/context/authoring/parts/folder.md +6 -6
- package/systems/fs/context/authoring/parts/hub/hub-ctx-from-resource.md +2 -2
- package/systems/fs/context/authoring/parts/hub/hub-install-package.md +2 -2
- package/systems/fs/context/authoring/parts/hub.reference.md +3 -3
- package/systems/fs/context/authoring/parts/internals/manifestof.md +2 -2
- package/systems/fs/context/authoring/parts/internals/permissionargs.md +4 -4
- package/systems/fs/context/authoring/parts/kinds-agents.md +1 -1
- package/systems/fs/context/authoring/parts/kinds-agents.reference/authoringsession.md +7 -5
- package/systems/fs/context/authoring/parts/kinds-agents.reference/kind.md +4 -4
- package/systems/fs/context/authoring/parts/outcomes.md +2 -2
- package/systems/fs/context/authoring/parts/outcomes.reference.md +2 -2
- package/systems/fs/context/authoring/parts/packaging.md +4 -4
- package/systems/fs/context/authoring/parts/remote.md +5 -5
- package/systems/fs/context/authoring/parts/remote.reference.md +201 -17
- package/systems/fs/context/authoring/parts/server.md +7 -7
- package/systems/fs/context/authoring/parts/server.reference.md +15 -15
- package/systems/fs/context/authoring/parts/testing.reference/equal.md +3 -3
- package/systems/fs/context/authoring/parts/testing.reference/fakehub.md +1 -1
- package/systems/fs/context/authoring/parts/testing.reference/kindprops.md +22 -10
- package/systems/fs/context/authoring/parts/testing.reference/{openmemorystore.md → storeconnection.md} +7 -19
- package/systems/fs/context/authoring/parts/testing.reference.md +5 -5
- package/systems/fs/context/authoring/parts/widgets.md +32 -22
- package/systems/fs/context/authoring/parts/widgets.reference.md +503 -9
- package/systems/fs/package.json +3 -3
- package/systems/fs/server/hosting.ts +10 -10
- package/systems/fs/server/main.ts +8 -8
- package/systems/fs/server/shell.ts +1 -1
- package/systems/fs/shared/index.ts +1 -1
- package/systems/google-calendar/package.json +1 -1
- package/systems/google-calendar/server/main.ts +4 -4
- package/systems/input/package.json +3 -3
- package/systems/input/server/main.ts +6 -6
- package/systems/mcp/client/McpServerForm.vue +99 -0
- package/systems/mcp/client/ServerList.vue +78 -0
- package/systems/mcp/client/ServerPage.vue +194 -0
- package/systems/mcp/client/ServersPage.vue +32 -0
- package/systems/mcp/client/index.ts +15 -0
- package/systems/mcp/client/logic.ts +224 -0
- package/systems/mcp/client/state.ts +128 -0
- package/systems/mcp/package.json +9 -6
- package/systems/mcp/server/dial.ts +1 -1
- package/systems/mcp/server/impl.ts +2 -1
- package/systems/mcp/server/instance.ts +3 -5
- package/systems/mcp/server/main.ts +10 -6
- package/systems/mcp/server/mirror.ts +2 -3
- package/systems/mcp/server/oauth.ts +2 -1
- package/systems/mcp/server/server-link.ts +2 -1
- package/systems/mcp/shared/index.ts +15 -2
- package/{packages/core/src/mcp-servers.ts → systems/mcp/shared/servers.ts} +6 -5
- package/systems/mcp/system.json +2 -1
- package/systems/mcp/tsconfig.json +2 -2
- package/systems/ollama/package.json +3 -3
- package/systems/ollama/server/main.ts +5 -5
- package/systems/schedule/package.json +3 -3
- package/systems/schedule/server/main.ts +6 -6
- package/systems/template/README.md +2 -2
- package/systems/template/package.json +1 -1
- package/systems/template/server/main.ts +4 -4
- package/systems/widgets/client/ChipRow.vue +22 -0
- package/systems/widgets/client/ProposalCard.vue +6 -5
- package/systems/widgets/client/SavedWidget.vue +11 -8
- package/systems/widgets/client/WidgetChips.vue +137 -0
- package/systems/widgets/client/WidgetView.vue +32 -0
- package/systems/widgets/client/charts/ChartVisual.vue +157 -0
- package/systems/widgets/client/charts/chart-data.ts +230 -0
- package/systems/widgets/client/charts/echarts-setup.ts +69 -0
- package/systems/widgets/client/charts/export.ts +36 -0
- package/systems/widgets/client/charts/families/calendar.ts +105 -0
- package/systems/widgets/client/charts/families/category.ts +186 -0
- package/systems/widgets/client/charts/families/crosstab.ts +113 -0
- package/systems/widgets/client/charts/families/distribution.ts +160 -0
- package/systems/widgets/client/charts/families/finance.ts +96 -0
- package/systems/widgets/client/charts/families/gauge.ts +75 -0
- package/systems/widgets/client/charts/families/hierarchy.ts +166 -0
- package/systems/widgets/client/charts/families/index.ts +21 -0
- package/systems/widgets/client/charts/families/network.ts +140 -0
- package/systems/widgets/client/charts/families/part.ts +61 -0
- package/systems/widgets/client/charts/families/profile.ts +30 -0
- package/systems/widgets/client/charts/families/progress.ts +76 -0
- package/systems/widgets/client/charts/families/range.ts +107 -0
- package/systems/widgets/client/charts/families/time.ts +177 -0
- package/systems/widgets/client/charts/families/timeline.ts +114 -0
- package/systems/widgets/client/charts/families/wide.ts +41 -0
- package/systems/widgets/client/charts/index.ts +37 -0
- package/systems/widgets/client/charts/maths.ts +139 -0
- package/systems/widgets/client/charts/size.ts +39 -0
- package/systems/widgets/client/chips.ts +150 -0
- package/systems/widgets/client/index.ts +18 -5
- package/systems/widgets/client/proposal.ts +2 -1
- package/systems/widgets/package.json +7 -4
- package/systems/widgets/server/authoring.ts +13 -7
- package/systems/widgets/server/env.ts +1 -1
- package/systems/widgets/server/impl.ts +10 -6
- package/systems/widgets/server/main.ts +6 -6
- package/systems/widgets/server/run.ts +16 -9
- package/systems/widgets/server/upgrade.ts +34 -0
- package/systems/widgets/shared/args.ts +137 -0
- package/systems/widgets/shared/charts.ts +243 -0
- package/systems/widgets/shared/index.ts +12 -3
- package/{packages/sdk/src → systems/widgets/shared}/relative-dates.ts +2 -1
- package/systems/widgets/shared/spec.ts +208 -0
- package/{packages/sdk/src → systems/widgets/shared}/widget-check.ts +7 -9
- package/{packages/sdk/src → systems/widgets/shared}/widget-schema.ts +4 -4
- package/packages/core/src/remote-auth.ts +0 -111
- package/packages/core/src/widgets.ts +0 -427
- package/packages/web/dist/assets/AdminLayout-B6Jrc_4W.js +0 -2
- package/packages/web/dist/assets/ApiServiceForm-BxprSaAq.css +0 -1
- package/packages/web/dist/assets/ApiServiceForm-CuuQgOJc.js +0 -2
- package/packages/web/dist/assets/ApiServiceView-7bTHSO_Z.js +0 -2
- package/packages/web/dist/assets/ApiServiceView-BVmdRCjR.css +0 -1
- package/packages/web/dist/assets/ApiServicesView-BTLV6c8n.css +0 -1
- package/packages/web/dist/assets/ApiServicesView-BXi24n49.js +0 -2
- package/packages/web/dist/assets/ChartVisual-BnFG9aFi.css +0 -1
- package/packages/web/dist/assets/ChartVisual-C4mgw4wh.js +0 -11
- package/packages/web/dist/assets/ChatPage-CAhHE03Z.js +0 -4
- package/packages/web/dist/assets/ConfigWithCustom-D_-rY66L.js +0 -3
- package/packages/web/dist/assets/ContextItemPage-rUI3-T_L.js +0 -2
- package/packages/web/dist/assets/ContextPage-CtefzyKg.js +0 -3
- package/packages/web/dist/assets/DataTypePage-BW9fWaz8.js +0 -2
- package/packages/web/dist/assets/FnList-BCnb4kOB.css +0 -1
- package/packages/web/dist/assets/FnList-Bx6H-kux.js +0 -2
- package/packages/web/dist/assets/GraphPanel-9tztGHmu.js +0 -2
- package/packages/web/dist/assets/InjectedList-CSWqRiON.js +0 -2
- package/packages/web/dist/assets/InstanceTypes-D3rAEiE7.js +0 -2
- package/packages/web/dist/assets/InstanceView-DoH8C-1j.js +0 -2
- package/packages/web/dist/assets/LimitsView-DY2C9nYS.js +0 -2
- package/packages/web/dist/assets/McpDialog-DhOCk6_E.js +0 -2
- package/packages/web/dist/assets/McpServerForm-Cor3fI7s.js +0 -2
- package/packages/web/dist/assets/McpServerForm-DsHaf5Um.css +0 -1
- package/packages/web/dist/assets/McpServerView-7I76EznB.css +0 -1
- package/packages/web/dist/assets/McpServerView-ewXRPEmZ.js +0 -2
- package/packages/web/dist/assets/McpServersView-Dd0xmfws.js +0 -2
- package/packages/web/dist/assets/ModelsView-cMHygeiK.js +0 -2
- package/packages/web/dist/assets/PeopleView-DRfeNWK5.js +0 -2
- package/packages/web/dist/assets/RemoteAuthFields-CgiufuqQ.js +0 -2
- package/packages/web/dist/assets/RemoteAuthFields-Dm44vz2t.css +0 -1
- package/packages/web/dist/assets/ResourcesPage-BBx2u2mw.js +0 -2
- package/packages/web/dist/assets/ResultGrid-Bj-0I5HY.js +0 -2
- package/packages/web/dist/assets/ResultGrid-CuUQyTjW.css +0 -1
- package/packages/web/dist/assets/ReviewView-DZF9E1hb.js +0 -3
- package/packages/web/dist/assets/RunCard-BnrtK2Yp.js +0 -2
- package/packages/web/dist/assets/RunCard-CfyRaDLS.css +0 -1
- package/packages/web/dist/assets/ServiceRows-4WythFpF.js +0 -2
- package/packages/web/dist/assets/ServiceRows-HPQ0pN6b.css +0 -1
- package/packages/web/dist/assets/SettingsPage-BN4oSzoL.js +0 -3
- package/packages/web/dist/assets/SignInPage-Djx-M-0U.css +0 -1
- package/packages/web/dist/assets/SystemPageHost-BeZ-6N0-.css +0 -1
- package/packages/web/dist/assets/SystemPageHost-DrMrEPyh.js +0 -2
- package/packages/web/dist/assets/SystemView-Be6TBM4j.js +0 -2
- package/packages/web/dist/assets/SystemsView-DZtT3laz.js +0 -2
- package/packages/web/dist/assets/WidgetView-DQUDeFkB.css +0 -1
- package/packages/web/dist/assets/WidgetView-DX4ejNb6.js +0 -3
- package/packages/web/dist/assets/export-BwFkEtcm.js +0 -15
- package/packages/web/dist/assets/index-6ScWTFy2.js +0 -4
- package/packages/web/dist/assets/index-CEslGcrX.css +0 -1
- package/packages/web/dist/assets/problems-t1E_ovSz.js +0 -2
- package/packages/web/dist/assets/record-edits-Bfsi4lU3.js +0 -2
- package/packages/web/dist/assets/remote-config-BNQhSDzB.js +0 -2
- package/packages/web/dist/assets/routes-DV4IJpwe.js +0 -4
- package/packages/web/dist/assets/size-Bh__w5aI.js +0 -2
- package/packages/web/dist/assets/src-CT3TeFaM.js +0 -43
- package/packages/web/dist/assets/state-xfQqaQPX.js +0 -2
- package/packages/web/dist/assets/widget-host-B87MTaTn.js +0 -2
- package/packages/web/dist/assets/widgets-BBCuSS6E.js +0 -2
- package/systems/fs/context/authoring/parts/client.reference/textareaprops.md +0 -195
- package/systems/fs/context/authoring/parts/core-types/remote-auth-ts.md +0 -64
- package/systems/fs/context/authoring/parts/core-types/widgets-ts.md +0 -303
- package/systems/fs/context/authoring/parts/widgets.reference/hub-visuals.md +0 -627
- package/systems/fs/context/authoring/parts/widgets.reference/sourcecompatible.md +0 -154
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
* - **Ranking:** `rankVisuals` binds each visual's channels to columns, checks its rules, and orders the fits by
|
|
12
12
|
* coverage (distinct columns bound to a channel; a tooltip does not count), then priority (band plus terms), then
|
|
13
13
|
* registry order. Visuals that can't draw the data are left out (hidden, not greyed).
|
|
14
|
-
* - **
|
|
15
|
-
*
|
|
14
|
+
* - **Built-in visuals:** `BUILT_IN_VISUALS` is only what every result needs, widgets or not: the table and the value
|
|
15
|
+
* cards, which the web app draws. Every chart belongs to the widgets system (`systems/widgets/shared/charts.ts`),
|
|
16
|
+
* which contributes them with the same `VisualShape` and bundles ECharts; any other system may add its own.
|
|
16
17
|
*
|
|
17
18
|
* Browser maths over rows (a histogram's bins, a boxplot's quartiles, a pie's "Other") runs only when the result is
|
|
18
19
|
* whole (`ResultFacts.whole`); otherwise the visual is not offered and the agent writes an aggregate query.
|
|
@@ -21,7 +22,7 @@ import { z } from 'zod';
|
|
|
21
22
|
import { LocalName, type Json } from './primitives.ts';
|
|
22
23
|
import {
|
|
23
24
|
COLUMN_KINDS, ColumnKind, ColumnRole, VisualShape, type PriorityBand, type PriorityTerm, type ResultColumn, type ResultTable, type VisualChannel,
|
|
24
|
-
type VisualRule,
|
|
25
|
+
type VisualRule, type VisualStyle,
|
|
25
26
|
} from './registries.ts';
|
|
26
27
|
|
|
27
28
|
/** The hub's visual registry: every visual any system draws a `ResultTable` with. */
|
|
@@ -214,8 +215,11 @@ function bound(bind: VisualBinding, channel: string, facts: ResultFacts): Column
|
|
|
214
215
|
/** Why a rule fails for a binding, or `undefined` when it holds. */
|
|
215
216
|
function ruleProblem(rule: VisualRule, bind: VisualBinding, facts: ResultFacts, rows: readonly (readonly Json[])[] | undefined, columns: readonly ResultColumn[] | undefined): string | undefined {
|
|
216
217
|
switch (rule.rule) {
|
|
217
|
-
case 'distinct':
|
|
218
|
-
|
|
218
|
+
case 'distinct': {
|
|
219
|
+
const columns = bound(bind, rule.channel, facts);
|
|
220
|
+
if (columns.some((column) => column.distinct > rule.max)) { return `${rule.channel} has more than ${String(rule.max)} values.`; }
|
|
221
|
+
return rule.min !== undefined && columns.some((column) => column.distinct < (rule.min ?? 0)) ? `${rule.channel} has fewer than ${String(rule.min)} values.` : undefined;
|
|
222
|
+
}
|
|
219
223
|
case 'non-negative':
|
|
220
224
|
return bound(bind, rule.channel, facts).every((column) => column.nonNegative) ? undefined : `${rule.channel} has values below 0.`;
|
|
221
225
|
case 'bounded':
|
|
@@ -253,9 +257,32 @@ function priorityOf(shape: VisualShape, bind: VisualBinding, facts: ResultFacts)
|
|
|
253
257
|
};
|
|
254
258
|
}
|
|
255
259
|
|
|
256
|
-
/**
|
|
257
|
-
|
|
258
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Why one style can't draw a binding, or `[]` when it can: a `whole` style over one page, a channel it `needs` left
|
|
262
|
+
* unbound, a channel binding fewer or more columns than its `columns` allow, or one of its own `rules` failing. The
|
|
263
|
+
* widgets system's checks and ranking use this one judgement, so a style picker never offers one that can't draw.
|
|
264
|
+
*/
|
|
265
|
+
export function styleProblems(style: VisualStyle, bind: VisualBinding, facts: ResultFacts, table?: Pick<ResultTable, 'rows' | 'columns'>): string[] {
|
|
266
|
+
const problems: string[] = [];
|
|
267
|
+
if (style.whole === true && !facts.whole) { problems.push(`style ${style.name} only draws a whole result.`); }
|
|
268
|
+
for (const channel of style.needs ?? []) {
|
|
269
|
+
if (bind[channel] === undefined) { problems.push(`style ${style.name} needs ${channel} bound.`); }
|
|
270
|
+
}
|
|
271
|
+
for (const [channel, count] of Object.entries(style.columns ?? {})) {
|
|
272
|
+
const bound = bind[channel]?.length ?? 0;
|
|
273
|
+
if (count.min !== undefined && bound < count.min) { problems.push(`style ${style.name} needs at least ${String(count.min)} ${channel} columns.`); }
|
|
274
|
+
if (count.max !== undefined && bound > count.max) { problems.push(count.max === 0 ? `style ${style.name} draws no ${channel}.` : `style ${style.name} draws at most ${String(count.max)} ${channel} columns.`); }
|
|
275
|
+
}
|
|
276
|
+
for (const rule of style.rules ?? []) {
|
|
277
|
+
const problem = ruleProblem(rule, bind, facts, table?.rows, table?.columns);
|
|
278
|
+
if (problem !== undefined) { problems.push(`style ${style.name}: ${problem}`); }
|
|
279
|
+
}
|
|
280
|
+
return problems;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** The styles of a shape that fit a binding and a result, the default first. */
|
|
284
|
+
function fittingStyles(shape: VisualShape, bind: VisualBinding, facts: ResultFacts, table?: Pick<ResultTable, 'rows' | 'columns'>): string[] {
|
|
285
|
+
return shape.styles.filter((style) => styleProblems(style, bind, facts, table).length === 0).map((style) => style.name);
|
|
259
286
|
}
|
|
260
287
|
|
|
261
288
|
/**
|
|
@@ -298,7 +325,7 @@ export function rankVisuals(entries: readonly RankedEntry[], facts: ResultFacts,
|
|
|
298
325
|
const ranked = entries.flatMap((entry, index) => {
|
|
299
326
|
const bind = defaultBinding(entry.shape, readable.length > 0 ? readable : facts.columns, facts.rows);
|
|
300
327
|
if (typeof bind === 'string' || bindingProblems(entry.shape, bind, facts, table).length > 0) { return []; }
|
|
301
|
-
const styles = fittingStyles(entry.shape, bind, facts
|
|
328
|
+
const styles = fittingStyles(entry.shape, bind, facts, table);
|
|
302
329
|
const [first, ...rest] = styles;
|
|
303
330
|
if (first === undefined) { return []; }
|
|
304
331
|
const { priority, because } = priorityOf(entry.shape, bind, facts);
|
|
@@ -308,26 +335,22 @@ export function rankVisuals(entries: readonly RankedEntry[], facts: ResultFacts,
|
|
|
308
335
|
return ranked.sort((a, b) => b.rank.coverage - a.rank.coverage || b.rank.priority - a.rank.priority || a.index - b.index).map((entry) => entry.rank);
|
|
309
336
|
}
|
|
310
337
|
|
|
311
|
-
// ─── The built-in
|
|
338
|
+
// ─── The built-in visuals ─────────────────────────────────────────────────────
|
|
312
339
|
|
|
313
340
|
const NUM: ColumnKind[] = ['integer', 'number'];
|
|
314
|
-
const TIME: ColumnKind[] = ['date', 'datetime'];
|
|
315
|
-
const CAT: ColumnKind[] = ['text', 'boolean'];
|
|
316
|
-
const KEY: ColumnKind[] = ['text', 'boolean', 'date', 'datetime'];
|
|
317
|
-
/** The most slices a part-to-whole visual draws before folding the rest into "Other". */
|
|
318
|
-
export const PART_TO_WHOLE_MAX_SLICES = 20;
|
|
319
|
-
/** The most categories on one axis before a category visual draws the first ones and says so. */
|
|
320
|
-
export const CATEGORY_COMFORT = 50;
|
|
321
341
|
|
|
322
342
|
/** One channel, required and single unless said. */
|
|
323
343
|
function ch(name: string, label: string, accepts: readonly ColumnKind[], options: Partial<Pick<VisualChannel, 'required' | 'many' | 'min' | 'role'>> = {}): VisualChannel {
|
|
324
344
|
return { name, label, accepts: [...accepts], required: options.required ?? true, many: options.many ?? false, ...(options.min === undefined ? {} : { min: options.min }), ...(options.role === undefined ? {} : { role: options.role }) };
|
|
325
345
|
}
|
|
326
346
|
|
|
327
|
-
/**
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
347
|
+
/**
|
|
348
|
+
* The visuals every result has, widgets or not: the table and the value cards, in registry order. Every chart is the
|
|
349
|
+
* widgets system's (`systems/widgets/shared/charts.ts`), contributed to `HUB_VISUALS` while it is connected.
|
|
350
|
+
*/
|
|
351
|
+
export const BUILT_IN_VISUAL_NAMES = ['table', 'value'] as const;
|
|
352
|
+
export const BuiltInVisualName = z.enum(BUILT_IN_VISUAL_NAMES);
|
|
353
|
+
export type BuiltInVisualName = z.infer<typeof BuiltInVisualName>;
|
|
331
354
|
|
|
332
355
|
/** A built-in visual: its switcher label and icon, one line about it, and its declared shape. */
|
|
333
356
|
export interface BuiltInVisual {
|
|
@@ -337,12 +360,8 @@ export interface BuiltInVisual {
|
|
|
337
360
|
readonly shape: VisualShape;
|
|
338
361
|
}
|
|
339
362
|
|
|
340
|
-
/**
|
|
341
|
-
|
|
342
|
-
* with ECharts): every ECharts series that draws from rows and columns, grouped into families with a style picker.
|
|
343
|
-
* Map and lines need geography and are not here; pictorial bars and rippling points are styles.
|
|
344
|
-
*/
|
|
345
|
-
export const BUILT_IN_VISUALS: Readonly<Record<VisualFamily, BuiltInVisual>> = {
|
|
363
|
+
/** The app's own visuals: the hub contributes them to `HUB_VISUALS`, and the web app draws them (DOM, not ECharts). */
|
|
364
|
+
export const BUILT_IN_VISUALS: Readonly<Record<BuiltInVisualName, BuiltInVisual>> = {
|
|
346
365
|
table: {
|
|
347
366
|
label: 'Table', icon: 'table', description: 'Every readable column and row, sortable and paged; cards on a phone.',
|
|
348
367
|
shape: VisualShape.parse({
|
|
@@ -358,121 +377,10 @@ export const BUILT_IN_VISUALS: Readonly<Record<VisualFamily, BuiltInVisual>> = {
|
|
|
358
377
|
styles: [{ name: 'cards', label: 'Cards' }, { name: 'single', label: 'Single' }], priority: { band: 'encoded', terms: [] },
|
|
359
378
|
}),
|
|
360
379
|
},
|
|
361
|
-
part: {
|
|
362
|
-
label: 'Part of a whole', icon: 'chart', description: 'Slices of a whole: one per category, sized by a measure.',
|
|
363
|
-
shape: VisualShape.parse({
|
|
364
|
-
channels: [ch('itemName', 'Slice', KEY, { role: 'group' }), ch('value', 'Size', NUM, { role: 'measure' })], rows: { min: 1, max: 100 }, whole: true, size: 'partition',
|
|
365
|
-
rules: [{ rule: 'non-negative', channel: 'value' }],
|
|
366
|
-
styles: [{ name: 'pie', label: 'Pie' }, { name: 'doughnut', label: 'Doughnut' }, { name: 'rose', label: 'Rose' }, { name: 'half', label: 'Half doughnut' }, { name: 'funnel', label: 'Funnel' }],
|
|
367
|
-
priority: { band: 'encoded', terms: ['low-cardinality', 'enum-key', 'many-categories'] },
|
|
368
|
-
}),
|
|
369
|
-
},
|
|
370
|
-
category: {
|
|
371
|
-
label: 'Bars', icon: 'chart', description: 'Measures per category, with an optional second key as series.',
|
|
372
|
-
shape: VisualShape.parse({
|
|
373
|
-
channels: [ch('x', 'Category', KEY, { role: 'group' }), ch('y', 'Values', NUM, { many: true, role: 'measure' }), ch('series', 'Series', CAT, { required: false, role: 'group' })],
|
|
374
|
-
rows: { min: 1, max: CATEGORY_COMFORT }, whole: false, size: 'top-n',
|
|
375
|
-
styles: [
|
|
376
|
-
{ name: 'bar', label: 'Bars' }, { name: 'stacked', label: 'Stacked' }, { name: 'percent', label: '100%', whole: true }, { name: 'horizontal', label: 'Horizontal' },
|
|
377
|
-
{ name: 'line', label: 'Line' }, { name: 'area', label: 'Area' }, { name: 'radar', label: 'Radar' }, { name: 'polar', label: 'Polar bars' }, { name: 'pictorial', label: 'Pictorial' },
|
|
378
|
-
],
|
|
379
|
-
priority: { band: 'encoded', terms: ['low-cardinality', 'enum-key', 'high-null'] },
|
|
380
|
-
}),
|
|
381
|
-
},
|
|
382
|
-
time: {
|
|
383
|
-
label: 'Over time', icon: 'chart', description: 'Measures along a date axis, zoomable; zooming can set the from/to args.',
|
|
384
|
-
shape: VisualShape.parse({
|
|
385
|
-
channels: [ch('x', 'Date', TIME, { role: 'group' }), ch('y', 'Values', NUM, { many: true, role: 'measure' }), ch('series', 'Series', CAT, { required: false, role: 'group' })],
|
|
386
|
-
rows: { min: 2 }, whole: false, size: 'window', claims: [{ claim: 'range', channel: 'x' }],
|
|
387
|
-
styles: [
|
|
388
|
-
{ name: 'line', label: 'Line' }, { name: 'smooth', label: 'Smooth' }, { name: 'area', label: 'Area' }, { name: 'stacked', label: 'Stacked area' },
|
|
389
|
-
{ name: 'step', label: 'Step' }, { name: 'bar', label: 'Bars' }, { name: 'river', label: 'Stream', needs: ['series'] },
|
|
390
|
-
],
|
|
391
|
-
priority: { band: 'time-encoded', terms: ['temporal-key', 'high-null'] },
|
|
392
|
-
}),
|
|
393
|
-
},
|
|
394
|
-
distribution: {
|
|
395
|
-
label: 'Distribution', icon: 'chart', description: 'How numbers spread: points, bubbles, bins, boxes or parallel axes.',
|
|
396
|
-
shape: VisualShape.parse({
|
|
397
|
-
channels: [
|
|
398
|
-
ch('x', 'X', NUM), ch('y', 'Y', NUM, { required: false }), ch('size', 'Size', NUM, { required: false }),
|
|
399
|
-
ch('group', 'Group', CAT, { required: false }), ch('dims', 'More axes', NUM, { required: false, many: true, min: 1 }),
|
|
400
|
-
],
|
|
401
|
-
rows: { min: 2, max: 5000 }, whole: false,
|
|
402
|
-
styles: [
|
|
403
|
-
{ name: 'scatter', label: 'Points', needs: ['y'] }, { name: 'bubble', label: 'Bubbles', needs: ['y', 'size'] }, { name: 'pulse', label: 'Rippling points', needs: ['y'] },
|
|
404
|
-
{ name: 'histogram', label: 'Histogram', whole: true }, { name: 'boxplot', label: 'Box plot', whole: true }, { name: 'parallel', label: 'Parallel axes', needs: ['y', 'dims'] },
|
|
405
|
-
],
|
|
406
|
-
priority: { band: 'structural', terms: ['high-null'] },
|
|
407
|
-
}),
|
|
408
|
-
},
|
|
409
|
-
crosstab: {
|
|
410
|
-
label: 'Cross-tab', icon: 'grid', description: 'A measure for each pair of two keys: a heatmap, value cells or small charts.',
|
|
411
|
-
shape: VisualShape.parse({
|
|
412
|
-
channels: [ch('x', 'Columns', KEY, { role: 'group' }), ch('y', 'Rows', KEY, { role: 'group' }), ch('value', 'Value', NUM, { role: 'measure' })],
|
|
413
|
-
rows: { min: 2 }, whole: false, size: 'top-n',
|
|
414
|
-
rules: [{ rule: 'distinct-columns', channels: ['x', 'y'] }, { rule: 'distinct', channel: 'x', max: CATEGORY_COMFORT }, { rule: 'distinct', channel: 'y', max: CATEGORY_COMFORT }],
|
|
415
|
-
styles: [{ name: 'heatmap', label: 'Heatmap' }, { name: 'cells', label: 'Value cells' }, { name: 'multiples', label: 'Small charts' }],
|
|
416
|
-
priority: { band: 'encoded', terms: ['low-cardinality'] },
|
|
417
|
-
}),
|
|
418
|
-
},
|
|
419
|
-
calendar: {
|
|
420
|
-
label: 'Calendar', icon: 'calendar', description: 'Days on a calendar, shaded by a measure; the month shown can set the from/to args.',
|
|
421
|
-
shape: VisualShape.parse({
|
|
422
|
-
channels: [ch('time', 'Date', TIME, { role: 'group' }), ch('value', 'Intensity', NUM, { required: false, role: 'measure' }), ch('label', 'Label', CAT, { required: false })],
|
|
423
|
-
rows: { min: 1 }, whole: false, claims: [{ claim: 'range', channel: 'time' }],
|
|
424
|
-
styles: [{ name: 'month', label: 'Month' }, { name: 'year', label: 'Year' }],
|
|
425
|
-
priority: { band: 'structural', terms: ['temporal-key'] },
|
|
426
|
-
}),
|
|
427
|
-
},
|
|
428
|
-
timeline: {
|
|
429
|
-
label: 'Timeline', icon: 'calendar', description: 'Bars from a start to an end date, one row each: a gantt chart.',
|
|
430
|
-
shape: VisualShape.parse({
|
|
431
|
-
channels: [ch('start', 'Start', TIME), ch('end', 'End', TIME), ch('label', 'Label', CAT), ch('series', 'Lane', CAT, { required: false })],
|
|
432
|
-
rows: { min: 1, max: 500 }, whole: false, size: 'window', rules: [{ rule: 'distinct-columns', channels: ['start', 'end'] }], claims: [{ claim: 'range', channel: 'start' }],
|
|
433
|
-
styles: [{ name: 'gantt', label: 'Gantt' }, { name: 'timeline', label: 'Timeline' }],
|
|
434
|
-
priority: { band: 'time-encoded', terms: [] },
|
|
435
|
-
}),
|
|
436
|
-
},
|
|
437
|
-
network: {
|
|
438
|
-
label: 'Network', icon: 'graph', description: 'Links between things: each row is an edge from a source to a target.',
|
|
439
|
-
shape: VisualShape.parse({
|
|
440
|
-
channels: [ch('source', 'From', CAT), ch('target', 'To', CAT), ch('value', 'Weight', NUM, { required: false, role: 'measure' })],
|
|
441
|
-
rows: { min: 1, max: 2000 }, whole: true, rules: [{ rule: 'distinct-columns', channels: ['source', 'target'] }],
|
|
442
|
-
styles: [{ name: 'force', label: 'Graph' }, { name: 'circular', label: 'Circle' }, { name: 'sankey', label: 'Flow' }, { name: 'chord', label: 'Chord' }],
|
|
443
|
-
priority: { band: 'structural', terms: [] },
|
|
444
|
-
}),
|
|
445
|
-
},
|
|
446
|
-
hierarchy: {
|
|
447
|
-
label: 'Hierarchy', icon: 'tree', description: 'A tree from a name and its parent column, sized by a measure.',
|
|
448
|
-
shape: VisualShape.parse({
|
|
449
|
-
channels: [ch('name', 'Name', CAT), ch('parent', 'Parent', CAT), ch('value', 'Size', NUM, { required: false, role: 'measure' })],
|
|
450
|
-
rows: { min: 2, max: 5000 }, whole: true, rules: [{ rule: 'distinct-columns', channels: ['name', 'parent'] }, { rule: 'links', from: 'name', to: 'parent' }],
|
|
451
|
-
styles: [{ name: 'tree', label: 'Tree' }, { name: 'radial', label: 'Radial tree' }, { name: 'treemap', label: 'Treemap' }, { name: 'sunburst', label: 'Sunburst' }],
|
|
452
|
-
priority: { band: 'structural', terms: [] },
|
|
453
|
-
}),
|
|
454
|
-
},
|
|
455
|
-
gauge: {
|
|
456
|
-
label: 'Gauge', icon: 'gauge', description: 'One value against its known range.',
|
|
457
|
-
shape: VisualShape.parse({
|
|
458
|
-
channels: [ch('value', 'Value', NUM, { role: 'measure' }), ch('max', 'Maximum', NUM, { required: false })], rows: { min: 1, max: 1 }, whole: true,
|
|
459
|
-
rules: [{ rule: 'bounded', channel: 'value' }], styles: [{ name: 'gauge', label: 'Gauge' }, { name: 'progress', label: 'Progress ring' }],
|
|
460
|
-
priority: { band: 'encoded', terms: [] },
|
|
461
|
-
}),
|
|
462
|
-
},
|
|
463
|
-
finance: {
|
|
464
|
-
label: 'Candlestick', icon: 'chart', description: 'Open, high, low and close per period, with optional volume.',
|
|
465
|
-
shape: VisualShape.parse({
|
|
466
|
-
channels: [ch('x', 'Period', KEY, { role: 'group' }), ch('open', 'Open', NUM), ch('close', 'Close', NUM), ch('low', 'Low', NUM), ch('high', 'High', NUM), ch('volume', 'Volume', NUM, { required: false })],
|
|
467
|
-
rows: { min: 2 }, whole: false, size: 'window', claims: [{ claim: 'range', channel: 'x' }],
|
|
468
|
-
styles: [{ name: 'candlestick', label: 'Candles' }, { name: 'volume', label: 'Candles and volume', needs: ['volume'] }],
|
|
469
|
-
priority: { band: 'time-encoded', terms: ['temporal-key'] },
|
|
470
|
-
}),
|
|
471
|
-
},
|
|
472
380
|
};
|
|
473
381
|
|
|
474
382
|
/** The built-in visuals as ranking takes them, in registry order. */
|
|
475
|
-
export const BUILT_IN_ENTRIES: readonly RankedEntry[] =
|
|
383
|
+
export const BUILT_IN_ENTRIES: readonly RankedEntry[] = BUILT_IN_VISUAL_NAMES.map((name) => ({ name, shape: BUILT_IN_VISUALS[name].shape }));
|
|
476
384
|
|
|
477
385
|
/** How many colours the categorical chart palette has (`--chart-1` … `--chart-8` in the web app's tokens). */
|
|
478
386
|
export const CHART_PALETTE_SIZE = 8;
|
package/packages/core/src/web.ts
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
} from './sso.ts';
|
|
63
63
|
import { ItemVersionsPage, ItemVersionsQuery } from './versions.ts';
|
|
64
64
|
import { DataRecord, DataSetPage, DataSetQuery, RecordGet, RecordPage, RecordQuery, RecordRemove, RecordSave, RecordTableQuery, RecordUpdate, RecordVersionsPage, RecordVersionsQuery } from './data.ts';
|
|
65
|
-
import { ExportQuery, ReadFnArgs, RowActionsQuery,
|
|
65
|
+
import { ExportQuery, ReadFnArgs, RowActionsQuery, RowActionOption } from './tables.ts';
|
|
66
66
|
import { ResultTable } from './registries.ts';
|
|
67
67
|
import { StoreBackup, StoreBackupId, StoreDecl, StoreMove, StoreMoveAnswer, StoreMoveRuns, StorePlacementInput, StoreView } from './stores.ts';
|
|
68
68
|
|
|
@@ -1041,7 +1041,7 @@ export const dataSlice = spec({
|
|
|
1041
1041
|
*/
|
|
1042
1042
|
export const rowActionsSlice = spec({
|
|
1043
1043
|
endpoints: use(tel, hubAuth).group({
|
|
1044
|
-
rowActions: { body: RowActionsQuery, response: z.array(
|
|
1044
|
+
rowActions: { body: RowActionsQuery, response: z.array(RowActionOption), ws: 'rowActions' },
|
|
1045
1045
|
readFn: { body: ReadFnArgs, response: Json, ws: 'readFn' },
|
|
1046
1046
|
}),
|
|
1047
1047
|
});
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
* Build 8's saved widget payload, from the hub kind `hub/widget` before the widget pass (build-8-widgets-design.md).
|
|
3
3
|
*
|
|
4
4
|
* It stays for good: the hub's start-up migration reads old `hub/widget` payloads with `WidgetSpecV1` and moves them
|
|
5
|
-
* to the `widgets` system (`upgradeWidgetSpec`
|
|
5
|
+
* to the `widgets` system (`upgradeWidgetSpec` below, with the kind and system it moves them to). Build 8's other
|
|
6
|
+
* widget contracts are gone; the widget pass's own contract is the widgets system's (`systems/widgets/shared/spec.ts`).
|
|
6
7
|
*/
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
import { Json, LocalName, QualifiedName } from './primitives.ts';
|
|
10
|
+
import type { ActionThen, OfferedVisual, PagingArgs, RowAction } from './tables.ts';
|
|
11
|
+
import type { VisualBinding } from './visuals.ts';
|
|
9
12
|
|
|
10
13
|
/** Build 8's hub widget kind, whose fns the migration moves to `WIDGET_KIND`. */
|
|
11
14
|
export const WIDGET_KIND_V1 = 'hub/widget';
|
|
@@ -71,3 +74,77 @@ export const WidgetSpecV1 = z.object({
|
|
|
71
74
|
actions: z.array(WidgetActionV1).optional(),
|
|
72
75
|
});
|
|
73
76
|
export type WidgetSpecV1 = z.infer<typeof WidgetSpecV1>;
|
|
77
|
+
|
|
78
|
+
// ─── The migration's target ───────────────────────────────────────────────────
|
|
79
|
+
|
|
80
|
+
/** The bundled system that owns widgets (the migration moves `hub/widget` fns to it). */
|
|
81
|
+
export const WIDGETS_SYSTEM = 'widgets';
|
|
82
|
+
|
|
83
|
+
/** The widget kind the migration moves build 8's widgets to (the widgets system declares it). */
|
|
84
|
+
export const WIDGET_KIND = 'widgets/widget';
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* What the migration writes for a build 8 payload: a widget spec as the widgets system reads it (`WidgetSpec` in
|
|
88
|
+
* `systems/widgets/shared/spec.ts`, whose tests check that every upgraded payload parses). Only the parts build 8 had.
|
|
89
|
+
*/
|
|
90
|
+
export interface UpgradedWidgetSpec {
|
|
91
|
+
readonly title: string;
|
|
92
|
+
readonly source: QualifiedName;
|
|
93
|
+
readonly visuals: readonly [OfferedVisual, ...OfferedVisual[]];
|
|
94
|
+
readonly args: Readonly<Record<string, UpgradedArgPlan>>;
|
|
95
|
+
readonly presets: readonly [];
|
|
96
|
+
readonly paging?: PagingArgs;
|
|
97
|
+
readonly actions?: readonly RowAction[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** How an upgraded widget shows one argument: a chip (with its words and choices), pinned to a value, or hidden. */
|
|
101
|
+
export type UpgradedArgPlan =
|
|
102
|
+
| { readonly show: 'control'; readonly label?: string; readonly choices?: readonly { readonly label: string; readonly value: { readonly literal: Json } }[]; readonly custom?: boolean }
|
|
103
|
+
| { readonly show: 'pinned'; readonly value: { readonly literal: Json } }
|
|
104
|
+
| { readonly show: 'hidden' };
|
|
105
|
+
|
|
106
|
+
/** Build 8's visuals as the widget pass names them: the family and its style, and how the old channels map. */
|
|
107
|
+
const V1_VISUALS: Readonly<Record<string, { readonly visual: string; readonly style: string; readonly channels: Readonly<Record<string, string>> }>> = {
|
|
108
|
+
table: { visual: 'table', style: 'table', channels: { columns: 'columns' } },
|
|
109
|
+
bar: { visual: 'category', style: 'bar', channels: { label: 'x', value: 'y' } },
|
|
110
|
+
value: { visual: 'value', style: 'cards', channels: { value: 'value' } },
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** A build 8 action's `then` in the widget pass's words. */
|
|
114
|
+
const V1_THEN: Readonly<Record<ActionThenV1, ActionThen>> = { refresh: 'refresh', show: 'open', none: 'status' };
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* A build 8 `hub/widget` payload as a widget-pass spec, for the hub's start-up migration: visuals renamed to their
|
|
118
|
+
* family and style (another system's visual keeps its name with the `default` style), controls as arg plans, paging
|
|
119
|
+
* kept only when both paging args were named, actions with their `then` renamed.
|
|
120
|
+
*/
|
|
121
|
+
export function upgradeWidgetSpec(old: WidgetSpecV1): UpgradedWidgetSpec {
|
|
122
|
+
const visuals = old.visuals.map((entry): OfferedVisual => {
|
|
123
|
+
const known = V1_VISUALS[entry.visual];
|
|
124
|
+
const bind: VisualBinding = {};
|
|
125
|
+
for (const [channel, columns] of Object.entries(entry.bind)) { bind[known?.channels[channel] ?? channel] = columns; }
|
|
126
|
+
return { visual: known?.visual ?? entry.visual, style: known?.style ?? 'default', ...(entry.label === undefined ? {} : { label: entry.label }), bind };
|
|
127
|
+
});
|
|
128
|
+
const [first, ...rest] = visuals;
|
|
129
|
+
const args: Record<string, UpgradedArgPlan> = {};
|
|
130
|
+
for (const control of old.controls) {
|
|
131
|
+
if (control.pinned !== undefined) { args[control.arg] = { show: 'pinned', value: { literal: control.pinned } }; continue; }
|
|
132
|
+
if (control.hidden === true) { args[control.arg] = { show: 'hidden' }; continue; }
|
|
133
|
+
const choices = control.choices?.map((value) => ({ label: typeof value === 'string' ? value : JSON.stringify(value), value: { literal: value } }));
|
|
134
|
+
args[control.arg] = {
|
|
135
|
+
show: 'control', ...(control.label === undefined ? {} : { label: control.label }),
|
|
136
|
+
...(choices === undefined ? {} : { choices }), ...(control.custom === undefined ? {} : { custom: control.custom }),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
const { offset, limit } = old.paging ?? {};
|
|
140
|
+
return {
|
|
141
|
+
title: old.title, source: old.source, visuals: first === undefined ? [{ visual: 'table', style: 'table', bind: {} }] : [first, ...rest], args, presets: [],
|
|
142
|
+
...(offset !== undefined && limit !== undefined ? { paging: { offset, limit } } : {}),
|
|
143
|
+
...(old.actions === undefined ? {} : {
|
|
144
|
+
actions: old.actions.map((action): RowAction => ({
|
|
145
|
+
fn: action.fn, bind: action.bind, then: V1_THEN[action.then],
|
|
146
|
+
...(action.label === undefined ? {} : { label: action.label }), ...(action.confirm === undefined ? {} : { confirm: action.confirm }),
|
|
147
|
+
})),
|
|
148
|
+
}),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@aeye/ai": "^0.
|
|
4
|
-
"@aeye/
|
|
5
|
-
"@aeye/
|
|
6
|
-
"@aeye/
|
|
7
|
-
"@aeye/
|
|
8
|
-
"@aeye/
|
|
9
|
-
"@aeye/
|
|
10
|
-
"@aeye/
|
|
11
|
-
"@aeye/
|
|
12
|
-
"@aeye/
|
|
3
|
+
"@aeye/ai": "^0.11.1",
|
|
4
|
+
"@aeye/anthropic": "^0.11.1",
|
|
5
|
+
"@aeye/aws": "^0.11.1",
|
|
6
|
+
"@aeye/core": "^0.11.1",
|
|
7
|
+
"@aeye/gin": "^0.11.1",
|
|
8
|
+
"@aeye/google": "^0.11.1",
|
|
9
|
+
"@aeye/schema": "^0.11.1",
|
|
10
|
+
"@aeye/models": "^0.11.1",
|
|
11
|
+
"@aeye/ollama": "^0.11.1",
|
|
12
|
+
"@aeye/openai": "^0.11.1",
|
|
13
|
+
"@aeye/openrouter": "^0.11.1",
|
|
14
|
+
"@aeye/resources": "^0.11.1",
|
|
13
15
|
"@ayepi/auth": "^0.6.0",
|
|
14
16
|
"@ayepi/cache": "^0.6.0",
|
|
15
17
|
"@ayepi/codec": "^0.6.0",
|
|
@@ -41,7 +43,7 @@
|
|
|
41
43
|
},
|
|
42
44
|
"name": "@harness/hub",
|
|
43
45
|
"private": true,
|
|
44
|
-
"version": "0.
|
|
46
|
+
"version": "0.4.0",
|
|
45
47
|
"license": "Apache-2.0",
|
|
46
48
|
"type": "module",
|
|
47
49
|
"description": "The hub: store, catalog, system links, execution, chat, index and the web API.",
|
|
@@ -44,7 +44,7 @@ export type AdminOperations = { readonly [N in AdminFnName]: AdminOp<(typeof ADM
|
|
|
44
44
|
/** The secrets a provider config holds. */
|
|
45
45
|
export function secretsOf(config: ProviderConfig): SecretId[] {
|
|
46
46
|
switch (config.provider) {
|
|
47
|
-
case 'openai': case 'openrouter': return [config.apiKey];
|
|
47
|
+
case 'openai': case 'anthropic': case 'google': case 'openrouter': return [config.apiKey];
|
|
48
48
|
case 'ollama': return [];
|
|
49
49
|
case 'aws': return config.auth.kind === 'apiKey' ? [config.auth.apiKey] : [config.auth.secretAccessKey, ...(config.auth.sessionToken === undefined ? [] : [config.auth.sessionToken])];
|
|
50
50
|
}
|
|
@@ -65,7 +65,7 @@ async function sealProvider(hub: Pick<HubServices, 'api'>, input: ProviderInput,
|
|
|
65
65
|
const seal = (value: string): Promise<SecretId> => hub.api.secrets.store({ name: `provider:${input.provider}`, owner, value });
|
|
66
66
|
switch (input.provider) {
|
|
67
67
|
case 'openai': return { provider: 'openai', apiKey: await seal(input.apiKey), ...(input.baseURL === undefined ? {} : { baseURL: input.baseURL }) };
|
|
68
|
-
case 'openrouter': return { provider:
|
|
68
|
+
case 'anthropic': case 'google': case 'openrouter': return { provider: input.provider, apiKey: await seal(input.apiKey) };
|
|
69
69
|
case 'ollama': return input;
|
|
70
70
|
case 'aws': {
|
|
71
71
|
const { auth } = input;
|
|
@@ -154,15 +154,15 @@ export async function viaHost(
|
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* Build 9: where a new instance of a fleet system comes from: the source an installed instance of it was installed
|
|
157
|
-
* from (so the fleet runs one version), else its folder among the bundled systems (`
|
|
157
|
+
* from (so the fleet runs one version), else its folder among the bundled systems (`FNLOOM_BUNDLED_SYSTEMS`).
|
|
158
158
|
*/
|
|
159
159
|
export async function addSource(
|
|
160
|
-
hub: { readonly settings: { readonly packagingEnv: Pick<PackagingEnv, '
|
|
160
|
+
hub: { readonly settings: { readonly packagingEnv: Pick<PackagingEnv, 'FNLOOM_BUNDLED_SYSTEMS'> }; readonly link: { readonly supervisor: Pick<Supervisor, 'list'> } },
|
|
161
161
|
system: SystemName,
|
|
162
162
|
): Promise<InstallSource> {
|
|
163
163
|
const sibling = (await hub.link.supervisor.list()).find((installed) => installed.name === system);
|
|
164
164
|
if (sibling !== undefined) return sibling.source;
|
|
165
|
-
const folder = join(bundledSystemsDir(hub.settings.packagingEnv.
|
|
165
|
+
const folder = join(bundledSystemsDir(hub.settings.packagingEnv.FNLOOM_BUNDLED_SYSTEMS), system);
|
|
166
166
|
const found = await stat(join(folder, 'system.json')).then(() => true, () => false);
|
|
167
167
|
if (!found) throw reject(404, 'NOT_BUNDLED', `${system} is not a bundled system, and no instance of it is installed here`);
|
|
168
168
|
return { path: folder };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sign-in: a password, or an SSO provider (OpenID Connect, `api/sso.ts`). The first start makes one admin account
|
|
3
|
-
* (from the setup page, or from `
|
|
3
|
+
* (from the setup page, or from `FNLOOM_ADMIN_EMAIL` / `FNLOOM_ADMIN_PASSWORD`). The setup page needs the one-time
|
|
4
4
|
* setup code the hub makes when it starts with no one in it (`announceSetup`: printed to its log as a link and
|
|
5
5
|
* written to the data folder), so nobody else who can reach the hub's port can make themselves its admin first. Once
|
|
6
6
|
* SSO providers are configured, that bootstrap admin is the only one who signs in with a password (break-glass);
|
|
@@ -39,7 +39,7 @@ export interface AuthOptions {
|
|
|
39
39
|
readonly identity: Pick<HubIdentityService, 'identity'>;
|
|
40
40
|
readonly clock: () => number;
|
|
41
41
|
readonly random?: IdRandom;
|
|
42
|
-
/** The SSO providers (`
|
|
42
|
+
/** The SSO providers (`FNLOOM_SSO_PROVIDERS`); with any, only the break-glass admin signs in with a password. */
|
|
43
43
|
readonly providers?: readonly IdentityProviderConfig[];
|
|
44
44
|
/** Told when a sign-in ends (`access.ended`: signed out, revoked, or its refresh token stolen), so its live events stop. */
|
|
45
45
|
readonly bus?: Pick<EventBus, 'publish'>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTPS on the hub's port: the switch, the certificate, and what Settings shows about them. The switch starts as
|
|
3
|
-
* `
|
|
3
|
+
* `FNLOOM_HTTPS` (on) and an admin's choice in Settings › Hub wins (the hub option `https`); either way it applies
|
|
4
4
|
* to the next connection, with no restart. The certificate is the hub's own (`TlsFolder`: an authority made once,
|
|
5
|
-
* and a certificate for this computer's addresses from it), unless `
|
|
5
|
+
* and a certificate for this computer's addresses from it), unless `FNLOOM_TLS_CERT` and `FNLOOM_TLS_KEY` name
|
|
6
6
|
* files to use instead (a `tailscale cert`, mkcert, a real authority); those are read again when they change.
|
|
7
7
|
*/
|
|
8
8
|
import { X509Certificate } from 'node:crypto';
|
|
@@ -17,11 +17,11 @@ export interface HubHttpsOptions {
|
|
|
17
17
|
readonly store: HubStore;
|
|
18
18
|
/** The hub's own authority and certificate. */
|
|
19
19
|
readonly folder: TlsFolder;
|
|
20
|
-
/** `
|
|
20
|
+
/** `FNLOOM_HTTPS`: on until an admin says otherwise. */
|
|
21
21
|
readonly on: boolean;
|
|
22
|
-
/** `
|
|
22
|
+
/** `FNLOOM_TLS_CERT` / `FNLOOM_TLS_KEY`, when both are set. */
|
|
23
23
|
readonly files?: { readonly cert: string; readonly key: string };
|
|
24
|
-
/** `
|
|
24
|
+
/** `FNLOOM_URL`, listed first when it is an https address. */
|
|
25
25
|
readonly hubUrl: string;
|
|
26
26
|
readonly clock: () => number;
|
|
27
27
|
/** A certificate that couldn't be made or read (the old one, if any, stays in use). */
|
|
@@ -98,7 +98,7 @@ export class HubHttps implements TlsSource {
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/** The https address of the hub on each network: `
|
|
101
|
+
/** The https address of the hub on each network: `FNLOOM_URL` first when it is https, then the certificate's names or this computer's addresses. */
|
|
102
102
|
#links(): string[] {
|
|
103
103
|
const port = this.#port;
|
|
104
104
|
const first = this.#o.hubUrl.startsWith('https://') ? [new URL('/', this.#o.hubUrl).toString()] : [];
|
|
@@ -71,7 +71,7 @@ export async function signInLimits(store: HubStore): Promise<SignInLimits> {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* The bootstrap admin: the first account made with a password (the setup page or `
|
|
74
|
+
* The bootstrap admin: the first account made with a password (the setup page or `FNLOOM_ADMIN_*`). Once SSO is
|
|
75
75
|
* configured it is the only one that signs in with a password, as a break-glass login.
|
|
76
76
|
*/
|
|
77
77
|
export async function breakGlassAdmin(store: HubStore): Promise<UserActor | undefined> {
|
|
@@ -69,7 +69,7 @@ async function seesItem(hub: HubServices, access: AccessScope, section: ItemSect
|
|
|
69
69
|
export function hubReads(hub: HubServices): HubReads {
|
|
70
70
|
const { store, catalog, chat } = hub;
|
|
71
71
|
const lists = new HubQuery(listSources(hub, hub.settings.queryEnv));
|
|
72
|
-
const graph = new HubGraph({ store, catalog, limit: hub.settings.queryEnv.
|
|
72
|
+
const graph = new HubGraph({ store, catalog, limit: hub.settings.queryEnv.FNLOOM_GRAPH_LIMIT });
|
|
73
73
|
return {
|
|
74
74
|
lists,
|
|
75
75
|
graph: async (data, who) => graph.query(data, await hub.access.scope(who.id)),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Secrets at rest: AES-256-GCM with a key derived from the hub's secret key (`
|
|
2
|
+
* Secrets at rest: AES-256-GCM with a key derived from the hub's secret key (`FNLOOM_SECRET_KEY`, or the generated
|
|
3
3
|
* one in the keys file). A stored value is `v1.<iv>.<tag>.<ciphertext>` in base64url; the tag makes tampering fail.
|
|
4
4
|
*/
|
|
5
5
|
import { createCipheriv, createDecipheriv, createHash, randomBytes } from 'node:crypto';
|
|
@@ -63,7 +63,7 @@ const PLAIN_HOST = /^[A-Za-z0-9.-]+(?::\d{1,5})?$|^\[[0-9A-Fa-f:.]+\](?::\d{1,5}
|
|
|
63
63
|
* framed. Styles allow inline ones: Vue writes static parts of templates as HTML with `style` attributes, and
|
|
64
64
|
* mermaid measures its diagrams with a `<style>` in the page. Images may be anywhere on https (the UI asks before
|
|
65
65
|
* loading outside ones), `data:` and `blob:` (mermaid diagrams, pasted pictures). Requests and sockets go to the
|
|
66
|
-
* hub only: the page's own origin, the host it was reached at over ws/wss, and `
|
|
66
|
+
* hub only: the page's own origin, the host it was reached at over ws/wss, and `FNLOOM_URL` (the hub MCPs' URLs).
|
|
67
67
|
*/
|
|
68
68
|
export function appCsp(hubUrl: string, host: string | undefined): string {
|
|
69
69
|
const hub = new URL(hubUrl);
|
|
@@ -190,7 +190,7 @@ export class WebAppRoute implements FileRoute {
|
|
|
190
190
|
readonly #identity: Pick<HubIdentityService, 'identity'>;
|
|
191
191
|
readonly #hubUrl: string;
|
|
192
192
|
|
|
193
|
-
/** `hubUrl` is `
|
|
193
|
+
/** `hubUrl` is `FNLOOM_URL`, which the page's policy lets it reach. */
|
|
194
194
|
constructor(root: string, identity: Pick<HubIdentityService, 'identity'>, hubUrl: string) {
|
|
195
195
|
this.#root = resolve(root);
|
|
196
196
|
this.#identity = identity;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* - `/auth/sso/<provider>/start?next=<path>`: the sign-in page's provider button is a link here. It sets the binding
|
|
5
5
|
* cookie (httpOnly, on the callback path, `SameSite=Lax` so the provider's redirect back carries it) and redirects to
|
|
6
|
-
* the provider. Reached at a host other than `
|
|
7
|
-
* `X-Forwarded-Host` counts), it first redirects to the same start on `
|
|
6
|
+
* the provider. Reached at a host other than `FNLOOM_URL`'s (the LAN IP, the web dev port; a proxy's
|
|
7
|
+
* `X-Forwarded-Host` counts), it first redirects to the same start on `FNLOOM_URL`, `next` kept, since the provider
|
|
8
8
|
* comes back there and the cookie must be set there too.
|
|
9
9
|
* - `/auth/sso/callback`: where the provider sends the person back (the same redirect the connections use for their
|
|
10
10
|
* providers, `/connect/callback`, has its own route). It clears the cookie and redirects to the sign-in page, with
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SSO sign-in through OpenID Connect providers (`
|
|
2
|
+
* SSO sign-in through OpenID Connect providers (`FNLOOM_SSO_PROVIDERS`), with `@ayepi/auth/oauth`'s `OidcClient`
|
|
3
3
|
* doing all of OpenID Connect: discovery, PKCE, `state` and `nonce`, the code exchange, ID token verification on the
|
|
4
4
|
* provider's key set, and userinfo. The hub keeps nothing between the start and the callback: what finishing needs
|
|
5
5
|
* (the `state`, `nonce` and PKCE verifier, where to go after) is a signed, expiring payload (`SignedPayloads`, the
|
|
6
6
|
* same helper as the connections' `state`) in an httpOnly cookie on the callback path, so the sign-in finishes only in
|
|
7
7
|
* the browser that started it, and the verifier never travels through the provider. Because that cookie lives on the
|
|
8
|
-
* origin the start ran on, and the provider always comes back to `
|
|
9
|
-
* LAN IP, the web dev port) first bounces to the same start on `
|
|
8
|
+
* origin the start ran on, and the provider always comes back to `FNLOOM_URL`, a start reached at any other host (the
|
|
9
|
+
* LAN IP, the web dev port) first bounces to the same start on `FNLOOM_URL` (`relocate`), keeping where to go after.
|
|
10
10
|
*
|
|
11
11
|
* A finished sign-in goes to `HubAuthenticator.signInExternal` (linking, the first-sign-in policy, roles and groups),
|
|
12
12
|
* and the callback hands the sign-in page a one-time code in the URL fragment, which never reaches a server, with a
|
|
@@ -88,7 +88,7 @@ export interface SsoService {
|
|
|
88
88
|
readonly providers: readonly IdentityProviderConfig[];
|
|
89
89
|
/**
|
|
90
90
|
* Where a start at `start` should go first when the browser reached the hub at host `reached` (`host:port`) rather
|
|
91
|
-
* than `
|
|
91
|
+
* than `FNLOOM_URL`'s: the same path and query on `FNLOOM_URL`, so the binding cookie is set on the origin the
|
|
92
92
|
* provider sends the person back to. Undefined to start here: the host matches, or the start was already bounced.
|
|
93
93
|
*/
|
|
94
94
|
relocate(reached: string | undefined, start: URL): string | undefined;
|
|
@@ -116,9 +116,9 @@ export interface SsoDeps {
|
|
|
116
116
|
readonly store: HubStore;
|
|
117
117
|
readonly log: Logger;
|
|
118
118
|
readonly clock: () => number;
|
|
119
|
-
/** The hub's public URL (`
|
|
119
|
+
/** The hub's public URL (`FNLOOM_URL`): the redirect URI is under it. */
|
|
120
120
|
readonly hubUrl: string;
|
|
121
|
-
/** How long a person has to come back from the provider (`
|
|
121
|
+
/** How long a person has to come back from the provider (`FNLOOM_SSO_WINDOW`). */
|
|
122
122
|
readonly window: number;
|
|
123
123
|
/** Signs the cookie; a new key each start. */
|
|
124
124
|
readonly key?: Buffer;
|
|
@@ -135,7 +135,7 @@ export function recordingPush(status: (endpoint: string) => number = () => 201):
|
|
|
135
135
|
export function testSettings(): HubSettings {
|
|
136
136
|
const settings = parseHubSettings();
|
|
137
137
|
// systems in tests go live as they pair, and what they do past their grants is only logged, unless a test says so
|
|
138
|
-
return { ...settings, authEnv: { ...settings.authEnv,
|
|
138
|
+
return { ...settings, authEnv: { ...settings.authEnv, FNLOOM_PASSWORD_COST: 10 }, reviewEnv: { ...settings.reviewEnv, FNLOOM_REVIEW_SYSTEMS: false, FNLOOM_GRANTS: 'log' } };
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
/** Every hub service: real base and api services, fakes for the other modules. */
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* address changes or it nears its end. A phone or computer that installs the authority trusts the hub, so the page is
|
|
5
5
|
* a secure context: the app installs and web push works there.
|
|
6
6
|
*
|
|
7
|
-
* <
|
|
8
|
-
* <
|
|
7
|
+
* <FNLOOM_DATA>/tls/ca.key, ca.crt the authority (ten years; the key never leaves this computer)
|
|
8
|
+
* <FNLOOM_DATA>/tls/hub.key, hub.crt the hub's certificate (397 days, the most a phone accepts)
|
|
9
9
|
*
|
|
10
10
|
* The authority is limited by name constraints to private addresses, localhost and this computer's name: even with
|
|
11
11
|
* its key, nobody could use it to pass as another website.
|