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
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/shared-DTpYDMc_.js","assets/rolldown-runtime-COiEfhsA.js","assets/runtime-core.esm-bundler-wlpNGAAZ.js","assets/src-DLK1P7oz.js","assets/push-payload-D5efGCzd.js","assets/core-DdF778CY.js","assets/langs-CVIiVMBh.js","assets/preload-helper-7y9sWmk5.js","assets/mermaid.core-BNF3dRf5.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/chunk-DUW6YSOI-Dgx8z5s3.js","assets/chunk-M57EVK23-qYz6TUV4.js","assets/chunk-LEVMRMFU-paszafIt.js","assets/chunk-AXFCVDMN-CI0arS1F.js","assets/chunk-X4PVCEUW-YYhMSieL.js","assets/chunk-BG4553SI-DGn4S0JL.js","assets/d3-selection-COWvaQNI.js","assets/chunk-STOXU5M4-D5Gd-wq9.js","assets/chunk-R3KSYZAL-DW0WB_9q.js","assets/chunk-6MUBBAK2-BHXbrulB.js","assets/dist-DdXDFcej.js","assets/chunk-J5ZVWO5B-oDCd-gWO.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-DQASFODM-ClbbgMVy.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{E as e,c as t,r as n,s as r,w as i,x as a,y as o}from"./src-DLK1P7oz.js";import{Ar as s,Cr as c,Ct as l,Er as u,Mr as d,Nr as f,Or as ee,Ot as p,St as te,Tr as m,Vt as h,Wt as g,f as ne,i as _,it as re,jr as v,l as ie,o as y,ot as ae,pr as oe,s as se,sr as b,st as ce,u as le,wr as x,xt as ue,y as de,zt as fe}from"./routes-qP_j74V5.js";import{$ as pe,D as S,E as C,Ft as me,Ht as w,Lt as he,On as T,St as ge,T as _e,Zn as E,_ as D,an as ve,b as O,bt as k,ct as ye,er as be,et as xe,fn as A,g as j,gn as Se,gt as Ce,it as we,k as M,mt as N,o as P,pn as Te,qt as F,tr as I,v as L,vn as R,w as Ee,wt as De,xn as z,xt as B,y as V}from"./runtime-core.esm-bundler-wlpNGAAZ.js";import{r as Oe}from"./RunCard-CBSGdwdQ.js";import{t as ke}from"./LoadState-DeXfLvYv.js";import{t as Ae}from"./AppPage-DSzDKCFz.js";import{A as je,C as Me,D as Ne,S as Pe,_ as Fe,b as Ie,d as Le,f as Re,g as ze,h as Be,i as Ve,j as He,k as Ue,o as We,p as Ge,r as Ke,s as qe,t as Je,u as Ye,w as Xe,x as Ze,y as Qe}from"./UserMessage-qyc8dG5D.js";import{d as H,i as $e,r as et,u as tt}from"./labels-BhJpmLWA.js";import{t as nt}from"./FnPill-BshAvm2I.js";import{t as rt}from"./GinValueView-HfEPq9le.js";import{l as it,n as at,r as ot,t as st}from"./ResourceViewer-Po24y4pj.js";import{A as ct,C as lt,D as ut,G as dt,H as U,I as ft,M as pt,N as mt,O as ht,P as gt,R as _t,S as vt,U as yt,V as bt,W as xt,X as St,Y as Ct,_ as wt,a as Tt,b as Et,f as Dt,i as Ot,j as kt,l as At,n as jt,o as Mt,p as Nt,q as Pt,r as Ft,t as It,v as Lt,z as W}from"./ui-W12UYhVu.js";import{r as Rt,t as zt}from"./fn-notices-BYaH6IoA.js";import{G as Bt,H as Vt,V as Ht,z as Ut}from"./state-CjE-qA2w.js";import{t as Wt}from"./now-40JhSjx0.js";import{n as Gt,r as Kt,t as qt}from"./stores-BMEvTe-I.js";import{$i as Jt,Aa as Yt,Ar as Xt,Bt as Zt,Do as Qt,Eo as $t,Fa as en,Ga as tn,Gr as nn,Io as G,J as rn,Ja as an,Lo as on,Mn as sn,Mo as cn,Mr as ln,No as K,O as un,On as dn,Oo as fn,Pa as pn,Qa as mn,Qn as hn,Ro as gn,Ur as _n,Wr as vn,Xa as yn,Ya as bn,Za as xn,_ as Sn,_i as Cn,bi as wn,c as Tn,d as En,dt as Dn,en as On,eo as kn,f as An,g as jn,ii as Mn,jo as Nn,ko as Pn,l as Fn,m as In,nn as Ln,or as Rn,pn as zn,qa as Bn,qn as Vn,tn as Hn,to as Un,u as Wn,vt as Gn,xi as Kn,yr as qn,yt as Jn,za as Yn,zo as Xn}from"./push-payload-D5efGCzd.js";import{A as Zn,C as Qn,E as $n,a as er,f as tr,h as nr,r as rr,s as ir,x as ar}from"./runs-k76usGfd.js";import{t as q}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as or,t as sr}from"./ItemHistory-CUGa8b6s.js";import{n as cr,t as lr}from"./fn-modal-DqcxUhOQ.js";import{i as ur,n as dr,r as fr,t as pr}from"./InjectedList-CJsEFEbz.js";import{a as mr,r as hr,t as gr}from"./metrics-Cio5ykX6.js";import{a as J,i as _r,n as Y,r as vr,t as yr}from"./problems-BZY0Dwif.js";import{t as br}from"./sources-Bm-TrxhL.js";import{i as xr,t as Sr}from"./WidgetView-BZyDyYRI.js";import{t as Cr}from"./RunDot-Ch_45985.js";import{c as wr,l as Tr,n as Er,s as Dr,t as Or}from"./layout-DQKldU13.js";import{a as kr,b as Ar,v as jr}from"./systems-DIp94AET.js";import{c as Mr,d as Nr,f as Pr,i as Fr,l as Ir,o as Lr,p as Rr,r as zr,s as Br,u as Vr}from"./remote-config-BkaarDf3.js";import{C as Hr,T as Ur,d as Wr,j as Gr,u as Kr}from"./review-CGUGvRV9.js";import{S as qr}from"./widgets-CrbkovMT.js";import{a as Jr,o as Yr}from"./size-BwnshyOe.js";import{a as Xr,i as Zr,o as Qr}from"./formats-DI__ADVG.js";import{t as $r}from"./preload-helper-7y9sWmk5.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ei=M({__name:`PageApproval`,props:{approval:{},inChat:{type:Boolean,default:!1},description:{default:``}},emits:[`decide`],setup(e,{emit:t}){let n=t;return(t,r)=>(N(),L(Rt,{ident:e.approval.id,"data-approval":e.approval.id,fn:e.approval.fn,description:e.description,args:void 0,preview:e.approval.preview,rememberable:e.inChat&&T(Ue)(e.approval),ask:e.approval.ask,onDecide:r[0]||=(e,t,r,i)=>n(`decide`,e,t,r,i)},null,8,[`ident`,`data-approval`,`fn`,`description`,`preview`,`rememberable`,`ask`]))}}),ti=M({__name:`PageComposer`,props:{modelValue:{},placeholder:{default:`Message`},sending:{type:Boolean,default:!1},running:{type:Boolean,default:!1},stopping:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},note:{default:``}},emits:[`update:modelValue`,`send`,`stop`],setup(e,{emit:t}){let n=e,r=t,i=Bt(),a=Wt(),o={open:!1,kind:void 0,items:[],active:0,loading:!1},s={available:!1,state:`idle`,startedAt:0,problem:``},c={shown:!1,on:!1};function l(e){e===`cancel`&&r(`stop`)}return(t,u)=>(N(),L(Fe,{text:e.modelValue,placeholder:e.placeholder,tokens:[],"can-send":!n.disabled&&e.modelValue.trim()!==``,sending:e.sending,running:e.running,paused:!1,stopping:e.stopping,"immediate-stop":``,picker:o,files:[],"reply-all":c,answerers:``,"can-attach":!1,voice:s,now:T(a),touch:T(i),note:e.note,onInput:u[0]||=e=>r(`update:modelValue`,e),onSend:u[1]||=e=>r(`send`),onControl:u[2]||=e=>l(e)},null,8,[`text`,`placeholder`,`can-send`,`sending`,`running`,`stopping`,`now`,`touch`,`note`]))}}),ni=an.parse(`ses_page`),ri=Yt.parse(`act_page-agent`);function ii(e,t){let n=`${e}/${t.name}`,r={...ir(Bn.parse(`run_${t.key}`),n,t.status),args:t.args};switch(t.status){case`running`:return r;case`done`:return{...r,outcome:{status:`done`,result:t.output??``}};case`failed`:return{...r,outcome:{status:`failed`,error:{class:`fatal`,code:`failed`,message:t.output===void 0||t.output.trim()===``?`It failed.`:t.output}}}}}function ai(e,t,n,r,i,a,o){return{id:Yn.parse(`msg_${e}`),session:ni,turn:xn.parse(`trn_${e}`),author:t,role:n,parts:r===``?[]:[{type:`text`,text:r}],runs:[...a],status:o?`streaming`:`done`,replyAll:!1,answerers:[],createdAt:i??0}}function oi(e,t){let n=[];return{segments:t.reduce((t,r)=>{if(r.kind!==`call`)return r.text.trim()===``?t:We(t,{kind:r.kind,text:r.text});let i=ii(e,r.call);return n.push(i),We(t,{kind:`runs`,runs:[i.id]})},[]),runs:n}}function si(e,t){let n=e.findLastIndex(e=>e.kind===`answer`);return e.map((e,r)=>{switch(e.kind){case`user`:return{kind:`user`,key:e.key,message:ai(e.key,t.me,`user`,e.text,e.at,[],!1)};case`note`:return{kind:`note`,key:e.key,message:ai(e.key,ri,`note`,e.text,void 0,[],!1)};case`answer`:{let{segments:i,runs:a}=oi(t.system,e.pieces),o=e.pieces.flatMap(e=>e.kind===`text`?[e.text]:[]).join(``),s=t.streaming&&r===n;return{kind:`answer`,key:e.key,message:ai(e.key,ri,`assistant`,o,e.at,a.map(e=>e.id),s),segments:i,runs:a}}}})}var ci={class:`conversation`,"data-testid":`conversation`},li=q(M({__name:`PageConversation`,props:{entries:{},agent:{},system:{},streaming:{type:Boolean,default:!1}},setup(e){let t=e,{session:n}=Gt(),r=Wt(),i=j(()=>n.user.value?.id??ri),a=j(()=>si(t.entries,{system:t.system,me:i.value,streaming:t.streaming})),o={context:[],fns:[]},s=R(new Set),c=e=>!s.value.has(e.id);function l(e){u([e],!s.value.has(e))}function u(e,t){let n=new Set(s.value);for(let r of e)t?n.add(r):n.delete(r);s.value=n}return(t,i)=>(N(),O(`div`,ci,[(N(!0),O(P,null,k(a.value,t=>(N(),O(P,{key:t.key},[t.kind===`user`?(N(),L(Je,{key:0,message:t.message,mine:``,"author-name":T(n).user.value?.name??`You`,now:T(r),"command-name":e=>e,suggestions:o,actions:[]},null,8,[`message`,`author-name`,`now`,`command-name`])):t.kind===`note`?(N(),L(Ke,{key:1,message:t.message},null,8,[`message`])):(N(),L(Ve,{key:2,messages:[t.message],"author-name":e.agent,now:T(r),streaming:t.message.status===`streaming`,failed:!1,"runs-of":()=>t.runs,"live-of":()=>t.segments,collapsed:c,"view-of":()=>void 0,"attachment-view":()=>void 0,actions:[],onRunOpen:i[0]||=e=>l(e),onRunToggle:i[1]||=(e,t)=>u([e],!t),onCollapseAll:e=>u(t.runs.map(e=>e.id),!e)},null,8,[`messages`,`author-name`,`now`,`streaming`,`runs-of`,`live-of`,`onCollapseAll`]))],64))),128))]))}}),[[`__scopeId`,`data-v-aa0c3db3`]]),ui=Object.freeze({Frame:A(Ae),Input:A(Et),Markdown:A(It),Icon:A(Ct),Empty:A(vt),LoadState:A(ke),Reasoning:A(He),Typing:A(je),ResourceViewer:A(st),ValueEditor:A(rt),Button:A(W),Select:A(Dt),Textarea:A(Tt),Dialog:A(lt),Banner:A(bt),Badge:A(U),Skeleton:A(ht),FnPill:A(nt),Approval:A(ei),Conversation:A(li),Composer:A(ti)}),di=Object.freeze({cost:tt,relativeTime:(e,t)=>Pt(e,t),fullTime:e=>dt(e)}),fi=[7,30,90];function pi(e,t){let{system:n,local:r}=Un(e);return t===0?`${n} has no fns on this hub now (it may be uninstalled or not connected yet), so ${e} can't be shown.`:`${n} has no fn named ${r} now. It may have been removed or renamed since it ran.`}var mi=class{#e;#t;#n;name=R(void 0);days=R(7);record=new c;metrics=new c;daily=new c;recent=new c;switching=new m;constructor(e,t){this.#e=e,this.#t=t}async open(e,t){let n=this.name.value===e;n||this.close(),this.name.value=e,this.days.value=t,this.#n??=this.#t(e=>{this.#a(e)}),await Promise.all([this.#r(e,n),this.#i(e,t,n&&this.metrics.value.value!==void 0)])}async switchOn(e){let t=this.record.value.value;return t!==void 0&&(this.record.set({...t,disabled:!e}),(await this.switching.run(()=>this.#e.switchItem.call({section:`fns`,name:t.name,on:e}),`Couldn't switch that.`)).ok?!0:(this.record.set(t),!1))}close(){this.#n?.(),this.#n=void 0,this.name.value=void 0,this.record.reset(),this.metrics.reset(),this.daily.reset(),this.recent.reset()}async#r(e,t){let n=bn.parse(Un(e).system);await this.record.load(async()=>{let t=await this.#e.systemFns.call({system:n}),r=t.find(t=>t.name===e);if(r===void 0)throw new yr(pi(e,t.length));return r},`Couldn't load this fn.`,t)}async#i(e,t,n){await Promise.all([this.metrics.load(async()=>(await this.#e.fnMetrics.call({fn:e,days:t})).find(t=>t.fn===e),`Couldn't load this fn's metrics.`,n),this.daily.load(()=>this.#e.fnMetricsDays.call({fn:e,days:t}),`Couldn't load this fn's days.`,n),this.recent.load(async()=>(await this.#e.runs.call({query:{filters:[{field:`fn`,op:`is`,value:e}],limit:8}})).items,`Couldn't load this fn's runs.`,n)])}#a(e){let t=this.name.value;if(e.type!==`fn`||t===void 0||e.fn!==t)return;let n=this.record.value.value;n!==void 0&&this.record.set({...n,stats:e.stats}),this.#i(t,this.days.value,!0)}},hi=[`data-testid`],gi={class:`title`},_i=[`aria-label`],vi={class:`scale top`},yi={class:`columns`},bi=[`aria-label`,`data-day`,`onPointerenter`,`onFocus`],xi={class:`labels`,"aria-hidden":`true`},Si={class:`table`},Ci=q(M({__name:`DayBars`,props:{title:{},bars:{},format:{},testid:{default:`day-bars`}},setup(e){let t=e,n=j(()=>mr(Math.max(0,...t.bars.map(e=>e.value)))),r=R(void 0),i=j(()=>Math.max(1,Math.ceil(t.bars.length/7))),a=j(()=>r.value===void 0?void 0:t.bars[r.value]);return(t,o)=>(N(),O(`figure`,{class:`day-bars`,"data-testid":e.testid},[D(`figcaption`,gi,I(e.title),1),D(`div`,{class:`plot`,role:`img`,"aria-label":`${e.title}: ${e.bars.map(t=>`${t.label} ${e.format(t.value)}`).join(`, `)}`,onPointerleave:o[1]||=e=>r.value=void 0},[D(`span`,vi,I(e.format(n.value)),1),o[2]||=D(`span`,{class:`scale zero`},`0`,-1),o[3]||=D(`div`,{class:`grid`,"aria-hidden":`true`},null,-1),D(`div`,yi,[(N(!0),O(P,null,k(e.bars,(e,t)=>(N(),O(`button`,{key:e.day,type:`button`,class:E([`column`,{pointed:r.value===t}]),"aria-label":`${e.label}: ${e.lines.join(`, `)}`,"data-day":e.day,onPointerenter:e=>r.value=t,onFocus:e=>r.value=t,onBlur:o[0]||=e=>r.value=void 0},[D(`span`,{class:`bar`,style:be({height:`${e.value<=0?0:Math.max(2,e.value/n.value*100)}%`})},null,4)],42,bi))),128))]),a.value&&r.value!==void 0?(N(),O(`div`,{key:0,class:`tip`,role:`status`,style:be({left:`${Math.min(80,Math.max(20,(r.value+.5)/e.bars.length*100))}%`})},[D(`strong`,null,I(a.value.label),1),(N(!0),O(P,null,k(a.value.lines,e=>(N(),O(`span`,{key:e},I(e),1))),128))],4)):V(``,!0)],40,_i),D(`div`,xi,[(N(!0),O(P,null,k(e.bars,(e,t)=>(N(),O(`span`,{key:e.day,class:`label`},I(t%i.value===0?e.label:``),1))),128))]),D(`details`,Si,[o[5]||=D(`summary`,null,`As a table`,-1),D(`table`,null,[D(`thead`,null,[D(`tr`,null,[o[4]||=D(`th`,null,`Day`,-1),D(`th`,null,I(e.title),1)])]),D(`tbody`,null,[(N(!0),O(P,null,k(e.bars,e=>(N(),O(`tr`,{key:e.day},[D(`td`,null,I(e.label),1),D(`td`,null,I(e.lines.join(` · `)),1)]))),128))])])])],8,hi))}}),[[`__scopeId`,`data-v-94fb9c63`]]),wi={class:`stats`,"data-testid":`fn-stats`},Ti={class:`period`},Ei={class:`period-title`},Di={key:0,class:`strip`,"data-testid":`fn-metrics`},Oi=[`data-figure`],ki={class:`label`},Ai={class:`value`},ji={key:0,class:`detail`},Mi=q(M({__name:`FnStats`,props:pe({metrics:{},daily:{},loading:{type:Boolean},problem:{},now:{},compact:{type:Boolean}},{days:{required:!0},daysModifiers:{}}),emits:pe([`retry`],[`update:days`]),setup(e,{emit:t}){let n=e,r=me(e,`days`),i=t,a=fi.map(e=>({value:String(e),label:`${String(e)} days`})),o=j({get:()=>String(r.value),set:e=>{r.value=fi.find(t=>String(t)===e)??7}}),s=j(()=>n.metrics===void 0?[]:hr(n.metrics)),c=j(()=>({period:r.value,now:n.now})),l=j(()=>gr(n.daily,`runs`,c.value)),u=j(()=>gr(n.daily,`time`,c.value));return(t,n)=>(N(),O(`section`,wi,[D(`div`,Ti,[D(`h2`,Ei,`Over the last `+I(r.value)+` days`,1),S(T(Nt),{modelValue:o.value,"onUpdate:modelValue":n[0]||=e=>o.value=e,options:T(a),label:`Period`,"data-testid":`fn-period`},null,8,[`modelValue`,`options`])]),S(ke,{loading:e.loading,problem:e.problem,ready:e.metrics!==void 0||!e.loading,empty:!1,onRetry:n[1]||=e=>i(`retry`)},{default:F(()=>[e.metrics?(N(),O(`ul`,Di,[(N(!0),O(P,null,k(s.value,e=>(N(),O(`li`,{key:e.key,class:`figure`,"data-figure":e.key},[D(`span`,ki,I(e.label),1),D(`span`,Ai,I(e.value),1),e.detail?(N(),O(`span`,ji,I(e.detail),1)):V(``,!0)],8,Oi))),128))])):(N(),L(T(vt),{key:1,icon:`fn`,title:`No runs in this period`,body:`Its numbers show here once it runs.`})),l.value.length>0?(N(),O(`div`,{key:2,class:E([`charts`,{compact:e.compact}])},[S(T(_t),null,{default:F(()=>[S(Ci,{title:`Runs per day`,bars:l.value,format:e=>e.toLocaleString(),testid:`fn-runs-chart`},null,8,[`bars`,`format`])]),_:1}),S(T(_t),null,{default:F(()=>[S(Ci,{title:`Typical time per day`,bars:u.value,format:T(H),testid:`fn-time-chart`},null,8,[`bars`,`format`])]),_:1})],2)):V(``,!0)]),_:1},8,[`loading`,`problem`,`ready`])]))}}),[[`__scopeId`,`data-v-3e1752f2`]]),Ni={key:0,class:`problem`},Pi={key:2,class:`note`,"data-testid":`access-fixed`},Fi={key:3,class:`problem`,role:`alert`},Ii=q(M({__name:`AccessControl`,props:{target:{},label:{default:`Who can use it`},title:{default:`Sharing`},compact:{type:Boolean,default:!1},fixed:{default:void 0}},setup(e){let t=e,n=Kt(),r=n?.chat.access,i=br().people(),a=z(void 0),o=j(()=>r?.multiUser.value===!0);ye(()=>{r?.load()}),w([()=>hn(t.target),o],([,e])=>{a.value=e&&r!==void 0?r.view(t.target):void 0},{immediate:!0});let s=j(()=>a.value?.value.value?.sharing.owner),c=z(``);w(s,async e=>{if(c.value=``,e===void 0||e===n?.session.user.value?.id)return;let[t]=await i.label([e]).catch(()=>[]);s.value===e&&(c.value=t===void 0||t.missing===!0?`its owner`:t.label)},{immediate:!0});let l=j({get:()=>{if(t.fixed!==void 0)return{visibility:`private`,with:[]};let e=a.value?.value.value?.sharing;return e===void 0?void 0:{visibility:e.visibility,with:e.with}},set:e=>{e!==void 0&&u(e)}});async function u(e){if(r===void 0||a.value===void 0)return;let n=await r.set(t.target,e);n.ok&&a.value.set(n.value)}return(t,n)=>o.value&&a.value!==void 0?(N(),L(_t,{key:0,title:e.title,compact:e.compact,"data-testid":`access-control`},{default:F(()=>[a.value.problem.value===``?l.value===void 0?V(``,!0):(N(),L(Ft,{key:1,modelValue:l.value,"onUpdate:modelValue":n[0]||=e=>l.value=e,people:T(i),label:e.label,owner:c.value,readonly:e.fixed!==void 0||a.value.value.value?.editable===!1},null,8,[`modelValue`,`people`,`label`,`owner`,`readonly`])):(N(),O(`p`,Ni,I(a.value.problem.value),1)),e.fixed===void 0?V(``,!0):(N(),O(`p`,Pi,I(e.fixed),1)),T(r)?.saving.problem.value?(N(),O(`p`,Fi,I(T(r).saving.problem.value),1)):V(``,!0)]),_:1},8,[`title`,`compact`])):V(``,!0)}}),[[`__scopeId`,`data-v-9e92a917`]]);async function Li(e,t){let n=await e.chat.sessions.create({title:t.title});if(n===void 0)throw Error(e.chat.sessions.problem.value||`Couldn't start a chat.`);if(t.run!==void 0){let r=e.chat.thread(n);if(await r.invoke(t.run.fn,t.run.args)===void 0)throw Error(r.problem.value||`Couldn't run that.`)}return await e.push(y.session(n)),n}function Ri(){let{chat:e,toasts:t}=Gt(),n=f(),r=R(``);async function i(i){r.value=i;try{await Li({chat:e,push:e=>n.push(e)},{title:ln(i),run:{fn:i,args:{}}})}catch(e){t.error(`Couldn't open the widget`,e instanceof Error?e.message:String(e))}finally{r.value=``}}return{opening:r,open:i}}var zi={read:{label:`Reads`,about:`Only reads: nothing is changed.`},write:{label:`Writes`,about:`Adds or changes things.`},delete:{label:`Deletes`,about:`Can remove things.`}},Bi={read:`neutral`,write:`warn`,delete:`danger`},Vi={free:`Spends nothing`,history:`From its runs`,payload:`From the call and the model’s price`,unknown:`Spends, never run yet`};function Hi(e){return e.basis===`free`?`Free`:e.basis===`unknown`?`Unknown`:e.min===e.max?tt(e.typical):`${tt(e.typical)} (${tt(e.min)}–${tt(e.max)})`}function Ui(e){let t=[{key:`cost`,label:`Cost a call`,value:Hi(e.cost),detail:Vi[e.cost.basis]}],n=e.times;return n!==void 0&&n.runs>0&&t.push({key:`time`,label:`Typical time`,value:H(n.typical),detail:`The median run`},{key:`slow`,label:`Slow runs`,value:H(n.slow),detail:`Longest ${H(n.longest)}`}),t.push({key:`runs`,label:`Runs`,value:(n?.runs??e.cost.runs).toLocaleString(),detail:`Settled, all time`}),t}function Wi(e){let t=JSON.stringify(e);return t.length<=80?t:JSON.stringify(e,null,2)}function Gi(e,t){return`${e}(${Wi(t.args)})`}var Ki=$t([`readable`,`stored`]);function qi(e,t,n){return t!==void 0&&n===`readable`?t:e===void 0?void 0:{language:`json`,code:JSON.stringify(e,null,2)}}var Ji=[`data-fn`],Yi={class:`about`},Xi={key:0,class:`description`},Zi={class:`badges`},Qi={key:1,class:`signature`,"data-testid":`fn-signature`},$i={key:2,class:`dim`},ea={key:3,class:`strip`,"data-testid":`fn-facts`},ta=[`data-figure`],na={class:`label`},ra={class:`value`},ia={class:`detail`},aa={key:4,class:`uses`,"data-testid":`fn-uses`},oa={class:`examples`,"data-testid":`fn-examples`},sa={class:`heading`},ca={key:0,class:`dim`},la={key:0,class:`bad`,role:`alert`},ua={key:1,class:`dim`},da={key:3,class:`example-list`},fa={key:0,class:`note`},pa={class:`code`},ma={key:1,class:`code result`},ha=q(M({__name:`FnOverview`,props:{name:{},about:{},facts:{},loading:{type:Boolean},problem:{default:``},examples:{},examplesTotal:{},moreExamples:{type:Boolean},examplesLoading:{type:Boolean},examplesProblem:{default:``},describe:{type:Boolean,default:!0}},emits:[`more`,`retry`],setup(e,{emit:t}){let n=e,r=t,i=j(()=>$e(n.name)),a=j(()=>n.facts===void 0?[]:Ui(n.facts)),o=j(()=>n.facts?.mode??n.about?.mode),s=j(()=>(n.facts?.uses??[]).filter(e=>e!==n.name)),c=j(()=>{let e=n.facts?.kind;return e!==void 0&&!zn(e)?`its kind (${e}) works one out when the hub describes it.`:"its author adds them to its declaration (`examples`)."});return(t,n)=>(N(),O(`div`,{class:`fn-overview`,"data-testid":`fn-overview`,"data-fn":e.name},[e.problem===``?e.loading&&e.facts===void 0?(N(),L(T(ht),{key:1,lines:4})):V(``,!0):(N(),L(T(bt),{key:0,tone:`danger`},{actions:F(()=>[S(T(W),{size:`sm`,variant:`ghost`,onClick:n[0]||=e=>r(`retry`)},{default:F(()=>[...n[2]||=[C(`Retry`,-1)]]),_:1})]),default:F(()=>[C(I(e.problem)+` `,1)]),_:1})),D(`section`,Yi,[e.describe&&e.about?.description?(N(),O(`p`,Xi,I(e.about.description),1)):V(``,!0),D(`div`,Zi,[o.value?(N(),L(T(U),{key:0,tone:T(Bi)[o.value],title:T(zi)[o.value].about,"data-testid":`fn-mode`},{default:F(()=>[C(I(T(zi)[o.value].label),1)]),_:1},8,[`tone`,`title`])):V(``,!0),e.facts?.free?(N(),L(T(U),{key:1,tone:`ok`},{default:F(()=>[...n[3]||=[C(`Free`,-1)]]),_:1})):V(``,!0),e.facts?.kind&&e.facts.kind!==`native`?(N(),L(T(U),{key:2},{default:F(()=>[C(I(e.facts.kind),1)]),_:1})):V(``,!0),e.about?.instance?(N(),L(T(U),{key:3},{default:F(()=>[C(I(e.about.instance),1)]),_:1})):V(``,!0),e.about&&!e.about.available?(N(),L(T(U),{key:4,tone:`warn`,title:e.about.blocked?.reason},{default:F(()=>[...n[4]||=[C(`Not available now`,-1)]]),_:1},8,[`title`])):V(``,!0),B(t.$slots,`badges`,{},void 0,!0)]),e.about?.signature?(N(),O(`code`,Qi,I(e.about.signature),1)):V(``,!0),e.about&&!e.about.available&&e.about.blocked?(N(),O(`p`,$i,I(e.about.blocked.reason),1)):V(``,!0)]),e.facts?.notice?(N(),L(T(bt),{key:2,tone:`neutral`,"data-testid":`fn-notice`},{default:F(()=>[C(I(e.facts.notice),1)]),_:1})):V(``,!0),a.value.length>0?(N(),O(`ul`,ea,[(N(!0),O(P,null,k(a.value,e=>(N(),O(`li`,{key:e.key,class:`figure`,"data-figure":e.key},[D(`span`,na,I(e.label),1),D(`span`,ra,I(e.value),1),D(`span`,ia,I(e.detail),1)],8,ta))),128))])):V(``,!0),e.facts&&(e.facts.reads.length>0||e.facts.writes.length>0||s.value.length>0)?(N(),O(`dl`,aa,[e.facts.reads.length>0?(N(),O(P,{key:0},[n[5]||=D(`dt`,null,`Reads`,-1),D(`dd`,null,[(N(!0),O(P,null,k(e.facts.reads,e=>(N(),O(`code`,{key:e,class:`chip`},I(e),1))),128))])],64)):V(``,!0),e.facts.writes.length>0?(N(),O(P,{key:1},[n[6]||=D(`dt`,null,`Writes`,-1),D(`dd`,null,[(N(!0),O(P,null,k(e.facts.writes,e=>(N(),O(`code`,{key:e,class:`chip write`},I(e),1))),128))])],64)):V(``,!0),s.value.length>0?(N(),O(P,{key:2},[n[7]||=D(`dt`,null,`Uses`,-1),D(`dd`,null,[(N(!0),O(P,null,k(s.value,e=>(N(),L(nt,{key:e,name:e},null,8,[`name`]))),128))])],64)):V(``,!0)])):V(``,!0),D(`section`,oa,[D(`h3`,sa,[n[8]||=C(`Examples`,-1),e.examplesTotal>0?(N(),O(`span`,ca,` · `+I(e.examplesTotal),1)):V(``,!0)]),e.examplesProblem===``?e.examples.length===0&&e.examplesLoading?(N(),O(`p`,ua,`Loading…`)):e.examples.length===0?(N(),L(T(bt),{key:2,tone:`warn`,"data-testid":`fn-no-examples`},{default:F(()=>[C(` No examples. Every fn needs at least one: `+I(c.value),1)]),_:1})):(N(),O(`ol`,da,[(N(!0),O(P,null,k(e.examples,e=>(N(),O(`li`,{key:e.id,class:`example`},[e.note?(N(),O(`p`,fa,I(e.note),1)):V(``,!0),D(`pre`,pa,I(T(Gi)(i.value,e)),1),e.result===void 0?V(``,!0):(N(),O(`pre`,ma,[n[9]||=D(`span`,{class:`arrow`},`→ `,-1),C(I(T(Wi)(e.result)),1)]))]))),128))])):(N(),O(`p`,la,I(e.examplesProblem),1)),e.moreExamples?(N(),L(T(W),{key:4,size:`sm`,variant:`ghost`,loading:e.examplesLoading,"data-testid":`fn-more-examples`,onClick:n[1]||=e=>r(`more`)},{default:F(()=>[C(` More examples (`+I(e.examplesTotal-e.examples.length)+` left) `,1)]),_:1},8,[`loading`])):V(``,!0)]),B(t.$slots,`runs`,{},void 0,!0)],8,Ji))}}),[[`__scopeId`,`data-v-e343e112`]]),ga=M({__name:`FnPayload`,props:pe({payload:{},readable:{},maxHeight:{default:360}},{form:{default:`readable`},formModifiers:{}}),emits:[`update:form`],setup(e){let t=e,n=me(e,`form`),r=j(()=>[{value:`readable`,label:t.readable?.language.toUpperCase()??`Readable`},{value:`stored`,label:`Stored form`}]),i=j(()=>qi(t.payload,t.readable,n.value));return(t,a)=>i.value?(N(),L(T(_t),{key:0,title:`What it runs`,"data-testid":`fn-payload`},Ee({default:F(()=>[S(T(pt),{code:i.value.code,language:i.value.language,wrap:``,"max-height":e.maxHeight},null,8,[`code`,`language`,`max-height`])]),_:2},[e.readable?{name:`actions`,fn:F(()=>[S(T(Nt),{modelValue:n.value,"onUpdate:modelValue":a[0]||=e=>n.value=e,options:r.value,label:`Show it as`,"data-testid":`fn-payload-form`},null,8,[`modelValue`,`options`])]),key:`0`}:void 0]),1024)):V(``,!0)}}),_a=[`aria-current`,`data-testid`],va={key:0,class:`mark`},ya={class:`main`},ba={class:`top`},xa={class:`title`},Sa={key:0,class:`badges`},Ca={key:0,class:`detail`},wa={key:1,class:`figures`},Ta=[`datetime`,`title`],Ea=q(M({__name:`BrowserRow`,props:{title:{},detail:{default:``},at:{default:void 0},now:{},selected:{type:Boolean,default:!1},testid:{default:``}},emits:[`open`],setup(e,{emit:t}){let n=t,r=he();return(t,i)=>(N(),O(`li`,{class:E([`browser-row`,{selected:e.selected}])},[D(`button`,{type:`button`,class:`open`,"aria-current":e.selected?`true`:void 0,"data-testid":e.testid||void 0,onClick:i[0]||=e=>n(`open`)},[r.mark?(N(),O(`span`,va,[B(t.$slots,`mark`)])):V(``,!0),D(`span`,ya,[D(`span`,ba,[D(`span`,xa,I(e.title),1),r.badges?(N(),O(`span`,Sa,[B(t.$slots,`badges`)])):V(``,!0)]),e.detail===``?V(``,!0):(N(),O(`span`,Ca,I(e.detail),1))]),r.figures?(N(),O(`span`,wa,[B(t.$slots,`figures`)])):V(``,!0),e.at===void 0?V(``,!0):(N(),O(`time`,{key:2,class:`at`,datetime:new Date(e.at).toISOString(),title:T(dt)(e.at)},I(T(Pt)(e.at,e.now)),9,Ta))],8,_a)],2))}}),[[`__scopeId`,`data-v-1a21ed96`]]),Da={key:0,class:`none bad`,role:`alert`},Oa={key:1,class:`none`},ka={key:2,class:`list`},Aa={key:0},ja=q(M({__name:`FnRuns`,props:{runs:{},now:{},title:{},loading:{type:Boolean,default:!1},problem:{default:``},empty:{default:`No runs yet.`}},emits:[`open`],setup(e,{emit:t}){let n=t,r=he();return(t,i)=>(N(),L(T(_t),{class:`runs`,title:e.title,flush:``,compact:``,"data-testid":`fn-recent`},Ee({default:F(()=>[e.problem===``?e.runs.length===0?(N(),O(`p`,Oa,I(e.loading?`Loading…`:e.empty),1)):(N(),O(`ul`,ka,[(N(!0),O(P,null,k(e.runs,t=>(N(),L(Ea,{key:t.id,title:T(Xt)(t.args)||T(ln)(t.fn),at:t.createdAt,now:e.now,testid:`fn-run-${t.id}`,onOpen:e=>n(`open`,t.id)},{mark:F(()=>[S(Cr,{status:t.status,size:10},null,8,[`status`])]),badges:F(()=>[t.status===`failed`||t.status===`awaiting-approval`?(N(),L(T(U),{key:0,tone:T(rr)[t.status].tone},{default:F(()=>[C(I(T(rr)[t.status].word),1)]),_:2},1032,[`tone`])):V(``,!0),t.attempt>1?(N(),L(T(U),{key:1,tone:`warn`},{default:F(()=>[C(`Try `+I(t.attempt),1)]),_:2},1024)):V(``,!0)]),figures:F(()=>[D(`span`,null,I(T(tt)(t.totalCost)),1),T(ar)(t,e.now)===void 0?V(``,!0):(N(),O(`span`,Aa,I(T(H)(T(ar)(t,e.now)??0)),1))]),_:2},1032,[`title`,`at`,`now`,`testid`,`onOpen`]))),128))])):(N(),O(`p`,Da,I(e.problem),1))]),_:2},[r.actions?{name:`actions`,fn:F(()=>[B(t.$slots,`actions`,{},void 0,!0)]),key:`0`}:void 0]),1032,[`title`]))}}),[[`__scopeId`,`data-v-dc316a5b`]]),Ma=M({__name:`FnDetails`,props:pe({name:{},describe:{type:Boolean,default:!0},compact:{type:Boolean,default:!1}},{days:{required:!0},daysModifiers:{},form:{default:`readable`},formModifiers:{},tab:{default:`about`},tabModifiers:{}}),emits:pe([`run`,`runs`,`switched`],[`update:days`,`update:form`,`update:tab`]),setup(e,{emit:t}){let n=e,r=me(e,`days`),i=me(e,`form`),a=me(e,`tab`),o=t,s=he(),{admin:c,fns:l,toasts:u}=Gt(),d=c.fn,f=Wt(3e4),p=j(()=>{let e=d.record.value.value;return e?.name===n.name?e:void 0}),te=j(()=>d.recent.value.value??[]),m=j(()=>p.value?.decl.kind===rn),h=j(()=>m.value?te.value.find(e=>e.outcome?.status===`done`):void 0),g=j(()=>{let e=h.value;return e?.outcome?.status===`done`?ee(e.outcome.result,ln(n.name)):void 0}),{opening:ne,open:_}=Ri(),re=j(()=>p.value?.decl.kind===fr),v=c.injected,ie=j(()=>v.page.value.value?.injections??[]),y=j(()=>ur(re.value,v.page.value.value===void 0?void 0:ie.value.length)),ae=j(()=>re.value?a.value:`about`);async function oe(e,t){await v.switchOn(e,t)||u.error(v.saving.problem.value)}async function se(e,t){await v.reorder(e,t)||u.error(v.saving.problem.value)}async function b(e){let t=p.value?.name;t!==void 0&&(await d.switchOn(e)?o(`switched`,t,e):u.error(d.switching.problem.value))}return w(()=>[n.name,r.value],([e,t])=>{d.open(e,t)},{immediate:!0}),w(()=>n.name,e=>{l.open(e)},{immediate:!0}),w(()=>[n.name,re.value],([e,t])=>{t?v.open({agent:e}):v.close()},{immediate:!0}),we(()=>{d.close(),l.close(),v.close()}),(t,n)=>(N(),L(ke,{class:`fn-details`,loading:T(d).record.loading.value,problem:T(d).record.problem.value,ready:p.value!==void 0,empty:!1,lines:6,"data-testid":`fn-details`,onRetry:n[10]||=t=>T(d).open(e.name,r.value)},{default:F(()=>[p.value?(N(),O(P,{key:0},[re.value?(N(),L(T(Mt),{key:0,modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e,tabs:y.value,label:`Fn`,"data-testid":`fn-tabs`},null,8,[`modelValue`,`tabs`])):V(``,!0),ae.value===`injected`?(N(),L(pr,{key:1,per:`agent`,views:ie.value,loading:T(v).page.loading.value,problem:T(v).page.problem.value,busy:T(v).busyKey.value,now:T(f),"data-testid":`fn-injected`,onSwitch:oe,onReorder:se,onRetry:n[1]||=e=>T(v).refresh()},null,8,[`views`,`loading`,`problem`,`busy`,`now`])):(N(),O(P,{key:2},[m.value?(N(),L(T(_t),{key:0,title:`The widget`,"data-testid":`fn-widget`},{actions:F(()=>[S(T(W),{size:`sm`,icon:`play`,loading:T(ne)===e.name,"data-testid":`fn-widget-open`,onClick:n[2]||=t=>T(_)(e.name)},{default:F(()=>[...n[11]||=[C(`Open in chat`,-1)]]),_:1},8,[`loading`])]),default:F(()=>[g.value&&h.value?(N(),L(Sr,{key:h.value.id,frame:g.value,args:h.value.args,"view-key":`fn:${h.value.id}`,"show-title":!1},null,8,[`frame`,`args`,`view-key`])):(N(),L(T(vt),{key:1,icon:`grid`,title:`Not run yet`,body:`Open it in a chat to run it; its latest run shows here.`}))]),_:1})):V(``,!0),S(ha,{name:e.name,about:T(l).about.value.value,facts:T(l).facts.value.value,loading:T(l).facts.loading.value,problem:T(l).facts.problem.value,describe:e.describe,examples:T(l).examples.value,"examples-total":T(l).examplesTotal.value,"more-examples":T(l).examplesNext.value!==void 0,"examples-loading":T(l).examplesLoading.value,"examples-problem":T(l).examplesProblem.value,onMore:n[3]||=e=>T(l).moreExamples(),onRetry:n[4]||=t=>T(l).open(e.name)},Ee({badges:F(()=>[S(T(At),{"model-value":!p.value.disabled,label:`In use`,disabled:T(d).switching.busy.value,"data-testid":`fn-on`,"onUpdate:modelValue":b},null,8,[`model-value`,`disabled`]),p.value.paused?(N(),L(T(U),{key:0},{default:F(()=>[...n[12]||=[C(`Paused`,-1)]]),_:1})):V(``,!0),(N(!0),O(P,null,k(p.value.decl.tags,e=>(N(),L(T(U),{key:e},{default:F(()=>[C(I(e),1)]),_:2},1024))),128))]),_:2},[s.runs?{name:`runs`,fn:F(()=>[B(t.$slots,`runs`)]),key:`0`}:void 0]),1032,[`name`,`about`,`facts`,`loading`,`problem`,`describe`,`examples`,`examples-total`,`more-examples`,`examples-loading`,`examples-problem`]),S(Mi,{days:r.value,"onUpdate:days":n[5]||=e=>r.value=e,metrics:T(d).metrics.value.value,daily:T(d).daily.value.value??[],loading:T(d).metrics.loading.value,problem:T(d).metrics.problem.value||T(d).daily.problem.value,now:T(f),compact:e.compact,onRetry:n[6]||=t=>T(d).open(e.name,r.value)},null,8,[`days`,`metrics`,`daily`,`loading`,`problem`,`now`,`compact`]),S(ga,{form:i.value,"onUpdate:form":n[7]||=e=>i.value=e,payload:p.value.decl.payload,readable:p.value.decl.readable,"max-height":e.compact?240:360},null,8,[`form`,`payload`,`readable`,`max-height`]),S(Ii,{target:{kind:`fn`,fn:e.name}},null,8,[`target`]),S(sr,{item:{system:p.value.system,section:`fns`,name:e.name}},null,8,[`item`]),S(ja,{runs:te.value,now:T(f),title:`Latest runs`,loading:T(d).recent.loading.value,problem:T(d).recent.problem.value,onOpen:n[9]||=e=>o(`run`,e)},{actions:F(()=>[S(T(W),{size:`sm`,variant:`ghost`,icon:`arrow-right`,"data-testid":`fn-runs`,onClick:n[8]||=t=>o(`runs`,e.name)},{default:F(()=>[...n[13]||=[C(`All its runs`,-1)]]),_:1})]),_:1},8,[`runs`,`now`,`loading`,`problem`])],64))],64)):V(``,!0)]),_:3},8,[`loading`,`problem`,`ready`]))}}),Na=M({__name:`FnModal`,props:{modal:{},fn:{}},setup(e){let t=e,{fns:n,session:r}=Gt(),i=f(),a=d(),o=j({get:()=>{let e=oe.safeParse(a.query[lr]);return e.success?e.data:`about`},set:e=>{let t={...a.query};e===`about`?Reflect.deleteProperty(t,lr):t[lr]=e,i.replace({query:t,hash:a.hash})}}),s=j(()=>r.user.value?.role===`admin`),c=R(7),l=R(`readable`),u=Wt(3e4),ee=j({get:()=>!0,set:e=>{e||t.modal.close()}}),p=j(()=>[...(t.modal.scope.value.runs?.()??[]).filter(e=>e.fn===t.fn)].reverse());w([()=>t.fn,s],([e,t])=>{t||n.open(e)},{immediate:!0}),we(()=>{s.value||n.close()});function te(e){i.push(e)}return(t,r)=>(N(),L(T(lt),{open:ee.value,"onUpdate:open":r[12]||=e=>ee.value=e,title:T(ln)(e.fn),description:e.fn,width:`720px`},{footer:F(()=>[S(T(W),{variant:`ghost`,onClick:r[10]||=t=>e.modal.close()},{default:F(()=>[...r[13]||=[C(`Close`,-1)]]),_:1}),s.value?(N(),L(T(W),{key:0,variant:`secondary`,icon:`arrow-right`,"data-testid":`fn-open-page`,onClick:r[11]||=t=>te(T(y).fn(e.fn,o.value===`about`?{}:{tab:o.value}))},{default:F(()=>[...r[14]||=[C(`Open page`,-1)]]),_:1})):V(``,!0)]),default:F(()=>[s.value?(N(),L(Ma,{key:0,days:c.value,"onUpdate:days":r[1]||=e=>c.value=e,form:l.value,"onUpdate:form":r[2]||=e=>l.value=e,tab:o.value,"onUpdate:tab":r[3]||=e=>o.value=e,name:e.fn,compact:``,onRun:r[4]||=t=>e.modal.openRun(t),onRuns:r[5]||=e=>te(T(y).fnRuns(e)),onSwitched:r[6]||=(t,n)=>e.modal.scope.value.switched?.(t,n)},Ee({_:2},[p.value.length>0?{name:`runs`,fn:F(()=>[S(ja,{runs:p.value,now:T(u),title:`Its runs here`,onOpen:r[0]||=t=>e.modal.openRun(t)},null,8,[`runs`,`now`])]),key:`0`}:void 0]),1032,[`days`,`form`,`tab`,`name`])):(N(),L(ha,{key:1,name:e.fn,about:T(n).about.value.value,facts:T(n).facts.value.value,loading:T(n).facts.loading.value,problem:T(n).facts.problem.value,examples:T(n).examples.value,"examples-total":T(n).examplesTotal.value,"more-examples":T(n).examplesNext.value!==void 0,"examples-loading":T(n).examplesLoading.value,"examples-problem":T(n).examplesProblem.value,onMore:r[8]||=e=>T(n).moreExamples(),onRetry:r[9]||=t=>T(n).open(e.fn)},Ee({_:2},[p.value.length>0?{name:`runs`,fn:F(()=>[S(ja,{runs:p.value,now:T(u),title:`Its runs here`,onOpen:r[7]||=t=>e.modal.openRun(t)},null,8,[`runs`,`now`])]),key:`0`}:void 0]),1032,[`name`,`about`,`facts`,`loading`,`problem`,`examples`,`examples-total`,`more-examples`,`examples-loading`,`examples-problem`]))]),_:1},8,[`open`,`title`,`description`]))}}),Pa={"approval-needed":{icon:`shield`,tone:`warn`,label:`Approval needed`},"input-needed":{icon:`edit`,tone:`warn`,label:`Input needed`},"config-needed":{icon:`settings`,tone:`warn`,label:`Setup needed`},message:{icon:`chat`,tone:`accent`,label:`Message`},replied:{icon:`chat`,tone:`accent`,label:`Reply`},"turn-finished":{icon:`success`,tone:`ok`,label:`Finished`},"turn-failed":{icon:`error`,tone:`danger`,label:`Failed`},"pairing-requested":{icon:`key`,tone:`accent`,label:`Pairing`},"system-disconnected":{icon:`offline`,tone:`danger`,label:`Disconnected`},"spend-limit":{icon:`warning`,tone:`danger`,label:`Spend limit`},"system-paused":{icon:`pause`,tone:`danger`,label:`System paused`},"system-notice":{icon:`warning`,tone:`warn`,label:`System notice`},"system-message":{icon:`info`,tone:`neutral`,label:`Update`}},Fa={ok:{icon:`success`,tone:`ok`,label:`Went well`},failed:{icon:`error`,tone:`danger`,label:`Failed`}};function Ia(e){let t=Pa[e.reason],n=e.tone===void 0||e.tone===`info`?t:{...Fa[e.tone],label:t.label};return e.resolved===void 0?n:{icon:`check`,tone:`neutral`,label:`${n.label} · ${e.resolved}`}}var La=[`data-testid`],Ra={class:`text`},za={class:`top`},Ba={class:`title`},Va=[`datetime`,`title`],Ha={key:0,class:`body`},Ua={key:0,class:`dot`,"aria-hidden":`true`},Wa={key:1,class:`sr-only`},Ga={class:`side`},Ka=q(M({__name:`NotificationRow`,props:{notification:{},now:{},compact:{type:Boolean,default:!1}},emits:[`open`,`also`,`read`],setup(e){let t=e,n=j(()=>Ia(t.notification));return(t,r)=>(N(),O(`li`,{class:E([`row`,{unread:!e.notification.read,resolved:e.notification.resolved!==void 0,compact:e.compact}]),"data-testid":`notification-${e.notification.id}`},[D(`button`,{type:`button`,class:`open`,onClick:r[0]||=n=>t.$emit(`open`,e.notification)},[D(`span`,{class:E([`mark`,`tone-${n.value.tone}`])},[S(T(Ct),{name:n.value.icon,size:16},null,8,[`name`])],2),D(`span`,Ra,[D(`span`,za,[D(`span`,Ba,I(e.notification.title),1),D(`time`,{class:`time`,datetime:new Date(e.notification.createdAt).toISOString(),title:T(dt)(e.notification.createdAt)},I(T(Pt)(e.notification.createdAt,e.now)),9,Va)]),e.notification.body===``?V(``,!0):(N(),O(`span`,Ha,I(e.notification.body),1)),D(`span`,{class:E([`reason`,`tone-${n.value.tone}`]),"data-testid":`notification-reason`},[e.notification.read?V(``,!0):(N(),O(`span`,Ua)),C(` `+I(n.value.label),1),e.notification.read?V(``,!0):(N(),O(`span`,Wa,`, unread`))],2)])]),D(`div`,Ga,[e.notification.also?(N(),L(T(W),{key:0,class:`also`,size:`sm`,variant:`ghost`,"data-testid":`notification-also`,onClick:r[1]||=n=>t.$emit(`also`,e.notification)},{default:F(()=>[C(I(e.notification.also.label),1)]),_:1})):V(``,!0),e.notification.read?V(``,!0):(N(),L(T(ft),{key:1,class:`read`,icon:`check`,label:`Mark as read`,size:`sm`,onClick:r[2]||=n=>t.$emit(`read`,e.notification)}))])],10,La))}}),[[`__scopeId`,`data-v-3a6b7c55`]]),qa=[`aria-busy`],Ja={key:1,class:`skeletons`,"aria-label":`Loading notifications`},Ya={key:4,class:`more`},Xa=q(M({__name:`NotificationList`,props:{items:{},now:{},loading:{type:Boolean},loaded:{type:Boolean},problem:{default:``},hasMore:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},emptyTitle:{default:`All caught up`},emptyBody:{default:`Approvals, replies and finished work show up here.`}},emits:[`open`,`also`,`read`,`more`,`retry`],setup(e){return(t,n)=>(N(),O(`div`,{class:E([`list`,{compact:e.compact}]),"aria-busy":e.loading?`true`:`false`},[e.problem===``?V(``,!0):(N(),L(T(bt),{key:0,tone:`danger`,class:`problem`},{actions:F(()=>[S(T(W),{size:`sm`,variant:`ghost`,onClick:n[0]||=e=>t.$emit(`retry`)},{default:F(()=>[...n[5]||=[C(`Retry`,-1)]]),_:1})]),default:F(()=>[C(I(e.problem)+` `,1)]),_:1})),e.loading&&!e.loaded?(N(),O(`ul`,Ja,[(N(!0),O(P,null,k(e.compact?3:5,e=>(N(),O(`li`,{key:e,class:`skeleton`},[S(T(ht),{shape:`circle`,size:32}),S(T(ht),{shape:`lines`,lines:2,class:`lines`})]))),128))])):e.loaded&&e.items.length===0?(N(),L(T(vt),{key:2,icon:`inbox`,title:e.emptyTitle,body:e.emptyBody},null,8,[`title`,`body`])):(N(),L(i,{key:3,tag:`ul`,name:`row`,class:`rows`},{default:F(()=>[(N(!0),O(P,null,k(e.items,r=>(N(),L(Ka,{key:r.id,notification:r,now:e.now,compact:e.compact,onOpen:n[1]||=e=>t.$emit(`open`,e),onAlso:n[2]||=e=>t.$emit(`also`,e),onRead:n[3]||=e=>t.$emit(`read`,e)},null,8,[`notification`,`now`,`compact`]))),128))]),_:1})),e.hasMore&&e.items.length>0?(N(),O(`div`,Ya,[S(T(W),{variant:`ghost`,size:`sm`,loading:e.loadingMore,onClick:n[4]||=e=>t.$emit(`more`)},{default:F(()=>[...n[6]||=[C(`Load older`,-1)]]),_:1},8,[`loading`])])):V(``,!0)],10,qa))}}),[[`__scopeId`,`data-v-c9cb4a65`]]),Za={class:`panel`,"data-testid":`inbox-panel`},Qa={class:`head`},$a={class:`foot`},eo=q(M({__name:`InboxPanel`,props:{items:{},unread:{},now:{},loading:{type:Boolean},loaded:{type:Boolean},problem:{default:``},limit:{default:6}},emits:[`open`,`also`,`read`,`readAll`,`all`,`retry`],setup(e){let t=e,n=j(()=>t.items.slice(0,t.limit));return(t,r)=>(N(),O(`div`,Za,[D(`header`,Qa,[r[7]||=D(`h2`,{class:`title`},`Notifications`,-1),e.unread>0?(N(),L(T(W),{key:0,size:`sm`,variant:`ghost`,icon:`check`,onClick:r[0]||=e=>t.$emit(`readAll`)},{default:F(()=>[...r[6]||=[C(`Mark all read`,-1)]]),_:1})):V(``,!0)]),S(Xa,{items:n.value,now:e.now,loading:e.loading,loaded:e.loaded,problem:e.problem,compact:``,onOpen:r[1]||=e=>t.$emit(`open`,e),onAlso:r[2]||=e=>t.$emit(`also`,e),onRead:r[3]||=e=>t.$emit(`read`,e),onRetry:r[4]||=e=>t.$emit(`retry`)},null,8,[`items`,`now`,`loading`,`loaded`,`problem`]),D(`footer`,$a,[S(T(W),{size:`sm`,variant:`ghost`,"icon-right":`arrow-right`,block:``,onClick:r[5]||=e=>t.$emit(`all`)},{default:F(()=>[...r[8]||=[C(`Open inbox`,-1)]]),_:1})])]))}}),[[`__scopeId`,`data-v-d2b5d353`]]),to={class:`steps`,"data-testid":`install-sheet`},no=q(M({__name:`InstallSheet`,props:pe({name:{}},{open:{type:Boolean,required:!0},openModifiers:{}}),emits:[`update:open`],setup(e){let t=me(e,`open`);return(n,r)=>(N(),L(T(lt),{open:t.value,"onUpdate:open":r[1]||=e=>t.value=e,title:`Add to Home Screen`,description:`Put ${e.name} on your home screen, like any other app.`,width:`420px`},{footer:F(()=>[S(T(W),{variant:`primary`,onClick:r[0]||=e=>t.value=!1},{default:F(()=>[...r[6]||=[C(`Got it`,-1)]]),_:1})]),default:F(()=>[D(`ol`,to,[r[4]||=D(`li`,null,[D(`span`,null,[C(`Tap `),D(`strong`,null,`Share`)]),D(`svg`,{class:`glyph`,viewBox:`0 0 24 24`,"aria-label":`the Share button`,role:`img`},[D(`path`,{d:`M12 3v12M8 7l4-4 4 4`}),D(`path`,{d:`M7 10H5v11h14V10h-2`})]),D(`span`,{class:`dim`},`at the bottom of Safari (at the top on an iPad).`)],-1),r[5]||=D(`li`,null,[D(`span`,null,[C(`Scroll down and tap `),D(`strong`,null,`Add to Home Screen`),C(`.`)])],-1),D(`li`,null,[D(`span`,null,[r[2]||=C(`Tap `,-1),r[3]||=D(`strong`,null,`Add`,-1),C(`. Open `+I(e.name)+` from your home screen from now on.`,1)])])]),r[7]||=D(`p`,{class:`dim note`},`Only Safari can add it. In another browser, open this page in Safari first.`,-1)]),_:1},8,[`open`,`description`]))}}),[[`__scopeId`,`data-v-f47f52f1`]]),ro=[`title`],io=[`width`,`height`],ao={key:0,class:`name`,"data-testid":`brand-name`},oo=q(M({__name:`AppBrand`,props:{name:{},markOnly:{type:Boolean,default:!1},size:{default:28}},setup(e){return(t,n)=>(N(),O(`span`,{class:`brand`,title:e.markOnly?e.name:void 0},[(N(),O(`svg`,{class:`mark`,width:e.size,height:e.size,viewBox:`0 0 32 32`,"aria-hidden":`true`},[...n[0]||=[_e(`<rect width="32" height="32" rx="9" class="tile" data-v-c7bc8cf6></rect><g class="lines" stroke-width="2" stroke-linecap="round" data-v-c7bc8cf6><path d="M16 16 9 9M16 16l7-7M16 16v8" data-v-c7bc8cf6></path></g><circle cx="16" cy="16" r="3.5" class="hub" data-v-c7bc8cf6></circle><circle cx="9" cy="9" r="2.3" class="node" data-v-c7bc8cf6></circle><circle cx="23" cy="9" r="2.3" class="node" data-v-c7bc8cf6></circle><circle cx="16" cy="24" r="2.3" class="node" data-v-c7bc8cf6></circle>`,6)]],8,io)),e.markOnly?V(``,!0):(N(),O(`span`,ao,I(e.name),1))],8,ro))}}),[[`__scopeId`,`data-v-c7bc8cf6`]]),so={class:`head`},co={class:`head-tools`},lo={class:`entries`},uo={class:`label`},fo=[`aria-label`],po={class:`middle`},mo={key:0,class:`foot`},ho=[`title`,`onClick`],go={class:`who`},_o={class:`name`},vo={class:`email`},yo=q(M({__name:`AppSidebar`,props:{brand:{},entries:{},user:{},unread:{},collapsed:{type:Boolean,default:!1},collapsible:{type:Boolean,default:!0},installable:{type:Boolean,default:!1}},emits:[`toggle`,`inbox`,`settings`,`install`,`signOut`,`navigate`],setup(e,{emit:t}){let n=e,r=t,i=he(),a=j(()=>[{value:`settings`,label:`Settings`,icon:`settings`},...n.installable?[{value:`install`,label:`Install app`,icon:`download`}]:[],{kind:`separator`},{value:`sign-out`,label:`Sign out`,icon:`log-out`,danger:!0}]);function o(e){e.currentTarget instanceof HTMLElement&&r(`inbox`,e.currentTarget)}function s(e){switch(e){case`settings`:r(`settings`);break;case`install`:r(`install`);break;case`sign-out`:r(`signOut`)}}return(t,n)=>{let r=ge(`RouterLink`);return N(),O(`nav`,{class:E([`sidebar`,{collapsed:e.collapsed}]),"aria-label":`Main`},[D(`div`,so,[S(oo,{name:e.brand,"mark-only":e.collapsed},null,8,[`name`,`mark-only`]),D(`div`,co,[S(T(ft),{icon:`bell`,label:e.unread>0?`Notifications, ${T(xt)(e.unread)} unread`:`Notifications`,badge:e.unread,"data-testid":`open-inbox`,onClick:o},null,8,[`label`,`badge`]),e.collapsible?(N(),L(T(ft),{key:0,icon:`sidebar`,label:e.collapsed?`Expand sidebar`:`Collapse sidebar`,"data-testid":`toggle-sidebar`,onClick:n[0]||=e=>t.$emit(`toggle`)},null,8,[`label`])):V(``,!0)])]),D(`ul`,lo,[(N(!0),O(P,null,k(e.entries,i=>(N(),O(`li`,{key:i.id},[S(r,{to:i.to,class:E([`entry`,{active:i.active}]),"aria-current":i.active?`page`:void 0,title:e.collapsed?i.label:void 0,"data-testid":`nav-${i.id}`,onClick:n[1]||=e=>t.$emit(`navigate`)},{default:F(()=>[S(T(Ct),{name:i.icon,size:18},null,8,[`name`]),D(`span`,uo,I(i.label),1),i.count>0?(N(),O(`span`,{key:0,class:`count`,"aria-label":`${i.count} unread`},I(T(xt)(i.count)),9,fo)):V(``,!0)]),_:2},1032,[`to`,`class`,`aria-current`,`title`,`data-testid`])]))),128))]),D(`div`,po,[i.default&&!e.collapsed?B(t.$slots,`default`,{},void 0,!0,0):V(``,!0)]),e.user?(N(),O(`div`,mo,[S(T(wt),{items:a.value,label:`Account`,side:`top`,align:`start`,onSelect:s},{trigger:F(({toggle:t,attrs:n})=>[D(`button`,xe({type:`button`,class:`person`},n,{title:e.collapsed?e.user.name:void 0,"data-testid":`user-menu`,onClick:t}),[S(T(yt),{name:e.user.name,size:30},null,8,[`name`]),D(`span`,go,[D(`span`,_o,I(e.user.name),1),D(`span`,vo,I(e.user.email),1)]),S(T(Ct),{name:`chevron-up`,size:16,class:`chevron`})],16,ho)]),_:1},8,[`items`])])):V(``,!0)],2)}}}),[[`__scopeId`,`data-v-db84e1b2`]]),bo={class:`topbar`},xo={class:`title`},So=q(M({__name:`AppTopBar`,props:{title:{},unread:{}},emits:[`menu`,`inbox`],setup(e,{emit:t}){let n=t;function r(e){e.currentTarget instanceof HTMLElement&&n(`inbox`,e.currentTarget)}return(t,n)=>(N(),O(`header`,bo,[S(T(ft),{icon:`menu`,label:`Open navigation`,"data-testid":`open-nav`,onClick:n[0]||=e=>t.$emit(`menu`)}),D(`h1`,xo,I(e.title),1),S(T(ft),{icon:`bell`,label:e.unread>0?`Notifications, ${T(xt)(e.unread)} unread`:`Notifications`,badge:e.unread,"data-testid":`open-inbox`,onClick:r},null,8,[`label`,`badge`])]))}}),[[`__scopeId`,`data-v-58e88c22`]]),Co=[{id:`chat`,to:y.chat(),label:`Chat`,icon:`chat`,routes:[_.chat,_.session,_.turnTree],adminOnly:!1},{id:`inbox`,to:y.inbox(),label:`Inbox`,icon:`inbox`,routes:[_.inbox],adminOnly:!1},{id:`resources`,to:y.resources(),label:`Resources`,icon:`layers`,routes:[_.resources],adminOnly:!1},{id:`context`,to:y.context(),label:`Context`,icon:`book`,routes:[_.context,_.contextItem],adminOnly:!1},{id:`data`,to:y.data(),label:`Data`,icon:`database`,routes:[_.data,_.dataType],adminOnly:!1},{id:`admin`,to:y.systems(),label:`Admin`,icon:`shield`,adminOnly:!0,routes:[_.admin,_.systems,_.system,_.review,_.instance,_.fn,_.graph,_.models,_.limits,_.people,_.policies,_.actorSettings,_.runs,_.llmCalls,_.modelCalls,_.mcps,_.mcp,_.mcpServers,_.mcpServer,_.apiServices,_.apiService]},{id:`settings`,to:y.settings(),label:`Settings`,icon:`settings`,routes:[_.settings],adminOnly:!1}],wo=e=>typeof e==`string`&&Object.values(_).includes(e);function To(e,t,n){let r=e.filter(e=>e.system===t);return r.find(e=>e.segment===n)??r[0]}function Eo(e,t,n,r=[],i=[]){let a=wo(e.name)?e.name:void 0,o=Co.filter(e=>!e.adminOnly||t?.role===`admin`).map(e=>({id:e.id,to:e.to,label:e.label,icon:e.icon,active:a!==void 0&&e.routes.includes(a),count:e.id===`inbox`?n.inbox:e.id===`admin`?n.admin:0})),s=r.map(t=>({id:`connect-${t.system}`,to:y.connect(t.system),label:t.title,icon:t.icon,active:a===_.connect&&e.params?.system===t.system,count:0})),c=i.map(t=>({id:`page-${t.system}-${t.segment}`,to:y.systemPage(t.system,t.segment),label:t.title,icon:t.icon,active:a===_.systemPage&&t===To(i,e.params?.system,e.params?.page),count:0})),l=o.findIndex(e=>e.id===`context`)+1;return[...o.slice(0,l),...s,...c,...o.slice(l)]}function Do(){let{keeper:e}=Gt(),t=f();return async()=>{await e.signOut(),window.location.replace(t.resolve(y.signIn()).href)}}function Oo(){let{session:e}=Gt(),t=f();w(e.signedIn,e=>{let n=t.currentRoute.value;e||n.meta.public===!0||window.location.replace(t.resolve(y.signIn(n.fullPath)).href)})}function ko(e){return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">`,`<rect width="32" height="32" rx="9" fill="#5b5bd6"/>`,`<g stroke="#fff" stroke-width="2" stroke-linecap="round" opacity="0.7"><path d="M16 16 9 9M16 16l7-7M16 16v8"/></g>`,`<circle cx="16" cy="16" r="3.5" fill="#fff"/><circle cx="9" cy="9" r="2.3" fill="#fff"/><circle cx="23" cy="9" r="2.3" fill="#fff"/><circle cx="16" cy="24" r="2.3" fill="#fff"/>`,e?`<circle cx="26" cy="26" r="6" fill="#e5484d" stroke="#fff" stroke-width="2"/>`:``,`</svg>`].join(``)}function Ao(e){return`data:image/svg+xml,${encodeURIComponent(ko(e))}`}function jo(e,t){let n=e.querySelector(`link[rel="icon"]`);n===null&&(n=e.createElement(`link`),n.rel=`icon`,e.head.append(n)),n.type=`image/svg+xml`,n.href=Ao(t)}function Mo(e,t,n){let r=t>0?`(${t>99?`99+`:String(t)}) `:``;return e===n?`${r}${n}`:`${r}${e} · ${n}`}var No={class:`titlebar`,"aria-hidden":`true`,"data-testid":`titlebar`},Po={class:`titlebar-name`},Fo=[`aria-busy`],Io={key:0,class:`connection`,"data-testid":`connection-banner`},Lo=q(M({__name:`AppShell`,setup(e){let{session:t,identity:n,keeper:r,layout:i,toasts:a,inbox:o,connection:s,admin:c,chat:l,pages:u,outsideImages:ee,install:p}=Gt(),te=Do(),m=d(),h=f(),g=kt(Or),ne=Wt(),re=t.signedIn,v=j(()=>m.meta.bare===!0||!re.value),ie=j(()=>Eo(m,t.user.value,{inbox:o.unread.value,admin:c.systems.pending.value},l.connections.nav.value,u.nav.value)),ae=j(()=>i.pageTitle.value===void 0?(m.name===_.connect?l.connections.nav.value.find(e=>e.system===m.params.system):void 0)?.title??m.meta.title??n.name.value:i.pageTitle.value),oe=j(()=>g.value&&m.meta.ownHeader!==!0),b=z(!1),ce=z(null);w(re,(e,t)=>{n.load(),e?(r.start(),n.start(),o.start(),l.connections.load(!0),u.start(),u.load(!0),ee.load()):(u.clear(),ee.clear(),r.stop(),o.stop(),n.stop(),t===!0&&m.meta.public!==!0&&h.replace(y.signIn(m.fullPath)))},{immediate:!0}),w([ae,o.unread,n.name],([e,t,n])=>{document.title=Mo(e,t,n),jo(document,t>0)},{immediate:!0}),w(()=>m.fullPath,()=>{i.drawerOpen.value=!1,b.value=!1});function le(e){b.value&&ce.value===e?b.value=!1:(ce.value=e,i.drawerOpen.value=!1,b.value=!0,o.load(`all`))}async function x(e,t=`link`){b.value=!1,e.read||o.markRead([e.id]),await h.push(await se(e,e=>l.sessionOfRun(e),t))}async function ue(){i.drawerOpen.value=!1,await p.install()===`accepted`&&a.ok(`Installed`)}async function de(){await o.markAllRead()&&a.ok(`All caught up`)}return(e,r)=>{let c=ge(`RouterView`);return N(),O(`div`,{class:E([`shell`,{bare:v.value,compact:T(g),"no-bar":T(g)&&!oe.value,collapsed:!T(g)&&T(i).collapsed}])},[D(`div`,No,[D(`span`,Po,I(T(n).name.value),1)]),v.value?V(``,!0):(N(),O(P,{key:0},[T(g)?oe.value?(N(),L(So,{key:1,title:ae.value,unread:T(o).unread.value,onMenu:r[2]||=e=>T(i).drawerOpen.value=!0,onInbox:le},null,8,[`title`,`unread`])):V(``,!0):(N(),L(yo,{key:0,class:`side`,brand:T(n).name.value,entries:ie.value,user:T(t).user.value,unread:T(o).unread.value,collapsed:T(i).collapsed,installable:T(p).offered,onToggle:r[0]||=e=>T(i).toggleSidebar(),onInbox:le,onSettings:r[1]||=e=>T(h).push(T(y).settings()),onSignOut:T(te),onInstall:ue},null,8,[`brand`,`entries`,`user`,`unread`,`collapsed`,`installable`,`onSignOut`])),T(g)?(N(),L(T(ct),{key:2,open:T(i).drawerOpen.value,"onUpdate:open":r[5]||=e=>T(i).drawerOpen.value=e,placement:`left`,label:`Navigation`,width:`300px`},{default:F(()=>[S(yo,{brand:T(n).name.value,entries:ie.value,user:T(t).user.value,unread:T(o).unread.value,collapsible:!1,installable:T(p).offered,onInbox:le,onSettings:r[3]||=e=>T(h).push(T(y).settings()),onSignOut:T(te),onNavigate:r[4]||=e=>T(i).drawerOpen.value=!1,onInstall:ue},null,8,[`brand`,`entries`,`user`,`unread`,`installable`,`onSignOut`])]),_:1},8,[`open`])):V(``,!0)],64)),D(`main`,{class:`page`,"aria-busy":T(o).loading.value?`true`:void 0},[!v.value&&T(s).state.value!==`online`?(N(),O(`div`,Io,[S(T(bt),{tone:T(s).state.value===`offline`?`warn`:`ok`,icon:T(s).state.value===`offline`?`offline`:`success`},{default:F(()=>[C(I(T(s).state.value===`offline`?`Reconnecting to the hub…`:`Back online`),1)]),_:1},8,[`tone`,`icon`])])):V(``,!0),S(c,null,{default:F(({Component:e,route:t})=>[(N(),L(De(e),{key:t.meta.group??t.matched[0]?.path??t.path,class:`routed`}))]),_:1})],8,Fo),S(T(Lt),{open:b.value,"onUpdate:open":r[11]||=e=>b.value=e,anchor:ce.value,side:T(g)?`bottom`:`right`,align:`start`,label:`Notifications`},{default:F(()=>[S(eo,{items:T(o).items.value,unread:T(o).unread.value,now:T(ne),loading:T(o).loading.value,loaded:T(o).loaded.value,problem:T(o).problem.value,onOpen:r[6]||=e=>x(e),onAlso:r[7]||=e=>x(e,`also`),onRead:r[8]||=e=>T(o).markRead([e.id]),onReadAll:de,onAll:r[9]||=e=>T(h).push(T(y).inbox()),onRetry:r[10]||=e=>T(o).load(`all`)},null,8,[`items`,`unread`,`now`,`loading`,`loaded`,`problem`])]),_:1},8,[`open`,`anchor`,`side`]),S(no,{open:T(p).sheetOpen.value,"onUpdate:open":r[12]||=e=>T(p).sheetOpen.value=e,name:T(n).name.value},null,8,[`open`,`name`]),S(T(Ot),{toasts:T(a).items,onDismiss:r[13]||=e=>T(a).dismiss(e),onAction:r[14]||=e=>T(a).act(e),onHold:r[15]||=e=>T(a).hold(e),onRelease:r[16]||=e=>T(a).release(e)},null,8,[`toasts`])],2)}}}),[[`__scopeId`,`data-v-73b0dbae`]]),Ro=M({__name:`App`,setup(e){let{chat:i,itemVersions:a,session:o,outsideImages:s}=Gt();Ce(jt,()=>s.value.value),Ce(Ut,i.types),Ce(or,a),Ce(Vt,e=>i.renderers.inputView(e)),Ce(r,st),Ce(t,Oe),Ce(n,ui),Oo();let c=cr(f());return(e,t)=>(N(),O(P,null,[S(Lo),T(c).name.value&&T(o).signedIn.value?(N(),L(Na,{key:0,modal:T(c),fn:T(c).name.value},null,8,[`modal`,`fn`])):V(``,!0)],64))}});function zo(e,t){let n=s({history:t,routes:ie,scrollBehavior:(e,t,n)=>n??{top:0}});return n.beforeEach(t=>{let n=e.signedIn.value;return t.name===_.signIn&&n?le(t.query.next)??y.chat():t.meta.public===!0?!0:n?t.meta.admin===!0&&e.user.value?.role!==`admin`?y.chat():!0:y.signIn(t.fullPath)}),n}var Bo=K({server:K({name:G(),version:G()}),instructions:G().optional(),tools:fn(K({name:G(),description:G().optional()}))}),Vo=`2025-06-18`,Ho=gn([K({jsonrpc:Nn(`2.0`),id:gn([cn(),G()]),result:Xn()}),K({jsonrpc:Nn(`2.0`),id:gn([cn(),G(),Qt()]),error:K({code:cn(),message:G()})})]),Uo=K({serverInfo:K({name:G(),version:G()}),instructions:G().optional()}),Wo=K({tools:fn(K({name:G(),description:G().optional()}))});function Go(e,t){if(!e.includes(`text/event-stream`))return JSON.parse(t);let n=t.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim()).filter(e=>e!==``);for(let e of n.reverse())try{return JSON.parse(e)}catch{}throw Error(`The MCP sent no answer.`)}var Ko=class{#e;constructor(e){this.#e=e}async tools(e,t){let n,r=async(r,i,a)=>{let o=await this.#e(e,{method:`POST`,headers:{"content-type":`application/json`,accept:`application/json, text/event-stream`,authorization:`Bearer ${t}`,"mcp-protocol-version":Vo,...n===void 0?{}:{"mcp-session-id":n}},body:JSON.stringify({jsonrpc:`2.0`,method:i,params:a,...r===void 0?{}:{id:r}})});if(o.status===401||o.status===403)throw Error(`The MCP refused that secret.`);if(!o.ok&&o.status!==202)throw Error(`The MCP answered ${o.status}.`);if(n=o.headers.get(`mcp-session-id`)??n,r===void 0)return;let s=Ho.parse(Go(o.headers.get(`content-type`)??``,await o.text()));if(`error`in s)throw Error(s.error.message);return s.result},i=Uo.parse(await r(1,`initialize`,{protocolVersion:Vo,capabilities:{},clientInfo:{name:`harness-admin`,version:`1`}}));await r(void 0,`notifications/initialized`,{});let a=Wo.parse(await r(2,`tools/list`,{}));return Bo.parse({server:i.serverInfo,...i.instructions===void 0?{}:{instructions:i.instructions},tools:a.tools})}},qo=class{#e;#t;secrets=new c;revoking=new m;constructor(e){this.#e=e}async load(e,t=!1){this.#t=e,await this.secrets.load(()=>this.#e.autoPairs.call({system:e}),`Couldn't load the auto pair secrets.`,t)}async revoke(e){let t=await this.revoking.run(async()=>(await this.#e.revokeAutoPair.call({id:e})).ok,`Couldn't revoke that secret.`);return t.ok&&this.#t!==void 0&&await this.load(this.#t,!0),t}},Jo=class{#e;decision=new c;saving=new m;preview=new c;search=new c;searchSaving=new m;constructor(e){this.#e=e}async load(e=!1){await this.decision.load(()=>this.#e.suggestDecision.call({}),`Couldn't load the suggestions setting.`,e)}async save(e){let t=await this.saving.run(()=>this.#e.setSuggestDecision.call(e),`Couldn't save the suggestions setting.`);return t.ok&&this.decision.set(t.value),t}async loadSearch(e=!1){await this.search.load(()=>this.#e.searchDecisions.call({}),`Couldn't load the search settings.`,e)}async saveSearch(e,t){let n=await this.searchSaving.run(()=>this.#e.setSearchDecision.call({item:e,value:t}),`Couldn't save the search setting.`);return n.ok&&this.search.set(n.value),n}async try(e,t){await this.preview.load(()=>this.#e.previewSuggestions.call({session:e,text:t}),`Couldn't try the suggestions.`)}},Yo=class{#e;setting=new c;saving=new m;constructor(e){this.#e=e}async load(e=!1){await this.setting.load(()=>this.#e.autoClassifier.call({}),`Couldn't load the auto mode classifier.`,e)}async save(e){let t=await this.saving.run(()=>this.#e.setAutoClassifier.call(e),`Couldn't save the auto mode classifier.`);return t.ok&&this.setting.set(t.value),t}},Xo=class{#e;setting=new c;saving=new m;constructor(e){this.#e=e}async load(e=!1){await this.setting.load(()=>this.#e.imageEmbedding.call({}),`Couldn't load where pictures are embedded.`,e)}async save(e){let t=await this.saving.run(()=>this.#e.setImageEmbedding.call(e),`Couldn't save where pictures are embedded.`);return t.ok&&this.setting.set(t.value),t}},Zo=class{#e;list=new c;#t=j(()=>new Map((this.list.value.value??[]).map(e=>[e.id,e])));constructor(e){this.#e=e}async load(e=!1){(e||this.list.value.value===void 0&&!this.list.loading.value)&&await this.list.load(()=>this.#e.actors.call({}),`Couldn't load people and groups.`)}nameOf=e=>this.#t.value.get(e)?.name??e;options(e){return(this.list.value.value??[]).filter(t=>e.includes(t.kind)&&!t.disabled).map(e=>({id:e.id,name:e.name,kind:e.kind,detail:e.kind===`user`?e.email:e.about})).sort((e,t)=>e.name.localeCompare(t.name))}},Qo=class{#e;#t=new Set;byRun=z(new Map);problem=R(``);constructor(e){this.#e=e}async load(e){let t=[...new Set(e)].filter(e=>!this.#t.has(e)).slice(0,200);if(t.length!==0){for(let e of t)this.#t.add(e);try{let e=await this.#e.approvals.call({runs:t}),n=new Map(this.byRun.value);for(let t of e)t.status===`pending`&&n.set(t.run,t);this.byRun.value=n,this.problem.value=``}catch(e){for(let e of t)this.#t.delete(e);this.problem.value=J(e)}}}async decide(e,t,n,r){let i=this.byRun.value,a=new Map(i);a.delete(e.run),this.byRun.value=a;try{return await this.#e.approve.call({approval:e.id,approve:t,remember:`once`,...n===``?{}:{reason:n},...r===void 0?{}:{answer:r}}),!0}catch(e){return this.byRun.value=i,this.problem.value=J(e),!1}}};function $o(e){return e.run===void 0?{query:e.query}:{run:e.run}}var es=class{#e;list;opened=new c;openedId=z(void 0);constructor(e,t){this.#e=e,this.list=new x(e,t)}async open(e){let t=this.openedId.value===e;t||this.opened.reset(),this.openedId.value=e,await this.opened.load(()=>this.#e.one(e),this.#e.oneFailure,t)}close(){this.openedId.value=void 0,this.opened.reset()}},ts=class extends es{#e;control=new m;constructor(e,t){super(e,{}),this.#e=t}async background(e){let t=await this.control.run(()=>this.#e.background.call({run:e}),`Couldn't move it to the background.`);return t.ok&&this.open(e),t}async undoTurn(e){let t=await this.control.run(()=>this.#e.undoTurn.call({turn:e}),`Couldn't undo the turn.`);return t.ok&&this.list.refresh(),t}};function ns(e,t){return new ts({fetch:(t,n,r)=>e.runs.call(g({query:t},r,n)),key:e=>e.id,failure:`Couldn't load runs.`,limit:50,one:e=>t.run.call({run:e}),oneFailure:`Couldn't load this run.`},t)}function rs(e,t){return new es({fetch:(t,n,r)=>e.llmCalls.call(g({query:t},r,n)),key:e=>e.id,failure:`Couldn't load LLM calls.`,limit:50,one:e=>t.llmCall.call({id:e}),oneFailure:`Couldn't load this LLM call.`},{})}function is(e,t){return new es({fetch:(t,n,r)=>e.modelCalls.call(g($o(t),r,n)),key:e=>e.id,failure:`Couldn't load model calls.`,limit:50,one:async n=>{let r=await e.modelCall.call({id:n});return r.interaction===void 0?{call:r}:{call:r,interaction:await t.llmCall.call({id:r.interaction})}},oneFailure:`Couldn't load this model call.`},{query:{}})}function as(e,t){return new es({fetch:(t,n,r)=>e.resources.call(g({query:t},r,n)),key:e=>e.uri,failure:`Couldn't load resources.`,limit:50,one:e=>t.resource.call({uri:e,want:[`text`,`links`]}),oneFailure:`Couldn't open this resource.`},{})}var os=class{#e;#t;#n;key=z(void 0);instances=new c;configForm=new c;config=new m;exporting=new m;removing=new m;view=j(()=>this.instances.value.value?.find(e=>e.instance===this.key.value?.instance));constructor(e,t){this.#e=e,this.#t=t}async open(e){let t=this.key.value?.system===e.system&&this.key.value.instance===e.instance;t||this.close(),this.key.value=e,this.#n??=this.#t(e=>{this.#i(e)}),await Promise.all([this.#r(e.system,t),this.configForm.load(async()=>{let t=await this.#e.system.call({system:e.system});return{type:t.configType,secrets:t.configSecrets??[],instanceMode:t.instanceMode}},`Couldn't load this system.`,t)])}close(){this.#n?.(),this.#n=void 0,this.key.value=void 0,this.instances.reset(),this.configForm.reset()}async configure(e){let t=this.key.value;if(t===void 0)return{ok:!1,problems:[`No instance is open.`]};let n=await this.config.run(()=>this.#e.configureSystem.call({system:t.system,instance:t.instance,config:e}),`Couldn't save the config.`);return n.ok?`problems`in n.value?{ok:!1,problems:n.value.problems}:(this.#r(t.system,!0),{ok:!0,version:n.value.version}):{ok:!1,problems:[n.problem]}}async exportData(e,t=this.key.value){return t===void 0?{ok:!1,problem:`No instance is open.`}:this.exporting.run(async()=>{let n=await this.#e.exportSystemData.call({...t,...e?{withSecrets:e}:{}});return{url:n.url,size:n.size}},`Couldn't export this instance's data.`)}async remove(){let e=this.key.value;if(e===void 0)return!1;let t=await this.removing.run(()=>this.#e.removeInstance.call(e),`Couldn't remove ${e.system}@${e.instance}.`);return t.ok&&t.value.ok}async#r(e,t){await this.instances.load(()=>this.#e.instances.call({system:e}),`Couldn't load this system's instances.`,t)}#i(e){let t=this.key.value;e.type===`system`&&t!==void 0&&e.system===t.system&&this.#r(t.system,!0)}};function ss(e,t){return e.filter(e=>e.decl.routing?.to===`instance`&&e.decl.routing.instance===t)}function cs(e,t,n){return{list:`types`,query:{filters:[{field:`system`,op:`is`,value:e.system},...e.instance===void 0?[]:[{field:`instance`,op:`is`,value:e.instance}]],sort:[{field:`name`,dir:`asc`}],limit:n,...t===void 0?{}:{cursor:t}}}}function ls(e,t){let n=tn.safeParse(t.includes(`/`)?t:`${e}/${t}`);return n.success?n.data:void 0}function us(e,t){let n=new Set;for(let r of t)for(let t of r.preview?.parts??[]){if(t.type!==`type-diff`)continue;let r=ls(e,t.name);r!==void 0&&n.add(r)}return n}function ds(e,t){return e.filter(e=>e.status===`awaiting-approval`&&e.instance===t)}function fs(e){return e.filter(e=>e.proposed===!0&&e.status===`pending`)}function ps(e,t){return[...new Set([...e??[],...ms(t)])]}function ms(e,t=``){return e===`•••• kept`?t===``?[]:[t]:mn(e)?Object.entries(e).flatMap(([e,n])=>ms(n,t===``?e:`${t}.${e}`)):[]}function hs(e,t,n,r=!1){let i=[{label:`Version`,value:e.version}];return e.address!==void 0&&!r&&i.push({label:`Address`,value:e.address}),i.push({label:`Key`,value:e.keyFingerprint}),e.pairedAt!==void 0&&i.push({label:`Paired`,value:`${Pt(e.pairedAt,t)}${e.pairedBy===void 0?``:` by ${n(e.pairedBy)}`}`,title:dt(e.pairedAt)}),e.lastSeenAt!==void 0&&i.push({label:`Last seen`,value:e.status===`connected`?`Online now`:Pt(e.lastSeenAt,t),title:dt(e.lastSeenAt)}),e.config!==void 0&&i.push({label:`Config`,value:`Version ${e.config.version}, ${Pt(e.config.setAt,t)}`,title:dt(e.config.setAt)}),i.push({label:`Manifest`,value:e.manifestHash,code:!0}),i}var gs=class{#e;#t=z(void 0);fns=new c;types;typeCount=R(void 0);waitingRuns=new c;desk;proposals=j(()=>fs((this.waitingRuns.value.value??[]).flatMap(e=>{let t=this.desk.byRun.value.get(e.id);return t===void 0?[]:[t]})));changing=j(()=>{let e=this.#t.value;return e===void 0?new Set:us(e.system,this.proposals.value)});constructor(e,t){this.#e=e,this.desk=new Qo(t),this.types=new x({fetch:async(e,t,n)=>{if(e===void 0)return{items:[]};let r=await this.#e.query.call(cs(e,t,n));return t===void 0&&(this.typeCount.value=r.total),{items:Ln.array().parse(r.items),...r.cursor===void 0?{}:{cursor:r.cursor}}},key:e=>e.name,failure:`Couldn't load this instance's types.`,limit:100},void 0)}async open(e){let t=this.#t.value,n=t?.system===e.system&&t.instance===e.instance;n||this.close(),this.#t.value=e,await Promise.all([this.fns.load(async()=>ss(await this.#e.systemFns.call({system:e.system}),e.instance),`Couldn't load this instance's fns.`,n),this.waitingRuns.load(async()=>{let t=ds((await this.#e.runs.call({query:{filters:[{field:`system`,op:`is`,value:e.system},{field:`status`,op:`is`,value:`awaiting-approval`}],limit:100}})).items,e.instance);return await this.desk.load(t.map(e=>e.id)),t},`Couldn't load the changes waiting for approval.`,n),this.types.load(e)])}async decide(e,t,n){let r=await this.desk.decide(e,t,n),i=this.#t.value;return r&&i!==void 0&&this.open(i),r}close(){this.#t.value=void 0,this.fns.reset(),this.types.load(void 0),this.typeCount.value=void 0,this.waitingRuns.reset()}},_s=class{#e;list=new c;create=new m;constructor(e){this.#e=e}async load(e=!1){await this.list.load(()=>this.#e.mcps.call({}),`Couldn't load the MCPs.`,e)}async make(e){let t=await this.create.run(()=>this.#e.createMcp.call(e),`Couldn't make that MCP.`);return t.ok&&this.list.set([...this.list.value.value??[],t.value.mcp]),t}},vs=class{#e;#t;id=R(void 0);view=new c;sessions=new c;draft=z(void 0);preview=new c;save=new m;rotate=new m;remove=new m;secret=R(``);tried=new c;changed=j(()=>this.draft.value!==void 0&&JSON.stringify(this.draft.value)!==JSON.stringify(this.view.value.value?.rules));constructor(e,t){this.#e=e,this.#t=t}async open(e,t=``){this.id.value!==e&&this.close(),this.id.value=e,t!==``&&(this.secret.value=t),await this.view.load(()=>this.#e.mcp.call({mcp:e}),`Couldn't load this MCP.`,this.view.value.value?.id===e);let n=this.view.value.value;n!==void 0&&this.draft.value===void 0&&this.edit(n.rules)}close(){this.id.value=void 0,this.view.reset(),this.sessions.reset(),this.preview.reset(),this.tried.reset(),this.draft.value=void 0,this.secret.value=``}edit(e){this.draft.value=e,this.preview.load(()=>this.#e.previewMcp.call({rules:e}),`Couldn't preview these rules.`,this.preview.value.value!==void 0)}revert(){let e=this.view.value.value;e!==void 0&&this.edit(e.rules)}async update(e={}){let t=this.id.value;if(t===void 0)return{ok:!1,problem:`No MCP is open.`};let n=e.rules??this.draft.value,r=await this.save.run(()=>this.#e.updateMcp.call({mcp:t,...e,...n===void 0?{}:{rules:n}}),`Couldn't save the MCP.`);return r.ok&&(this.view.set(r.value),this.draft.value=r.value.rules),r}async rotateSecret(){let e=this.id.value;if(e===void 0)return{ok:!1,problem:`No MCP is open.`};let t=await this.rotate.run(()=>this.#e.rotateMcpSecret.call({mcp:e}),`Couldn't rotate the secret.`);return t.ok&&(this.secret.value=t.value.secret,this.sessions.set([])),t}async delete(){let e=this.id.value;if(e===void 0)return!1;let t=await this.remove.run(()=>this.#e.deleteMcp.call({mcp:e}),`Couldn't delete the MCP.`);return t.ok&&t.value.ok}async loadSessions(e=!1){let t=this.id.value;t!==void 0&&await this.sessions.load(()=>this.#e.mcpSessions.call({mcp:t}),`Couldn't load this MCP's sessions.`,e)}async tryIt(e){let t=this.view.value.value,n=e.trim()===``?this.secret.value:e.trim();t!==void 0&&n!==``&&await this.tried.load(()=>this.#t.tools(t.url,n),`Couldn't reach the MCP with that secret.`)}},ys=bn.parse(`mcp`),bs={http:{label:`HTTP`,about:`Streamable HTTP: a URL the server answers on (MCP 2025-03-26 and later).`},sse:{label:`SSE`,about:`The older HTTP + SSE transport (MCP 2024-11-05).`},stdio:{label:`Command`,about:`A program the hub starts on its own machine; credentials go in its environment.`}},xs={writes:{label:`Writes`,about:`Calls wait for approval unless a trusted server marks the tool read-only.`},always:{label:`Always`,about:`Every call waits for approval.`},never:{label:`Never`,about:`No call waits (policies still apply).`}},Ss={connecting:{tone:`accent`,word:`Connecting`,live:!0},connected:{tone:`ok`,word:`Connected`,live:!1},"needs-auth":{tone:`warn`,word:`Needs sign-in`,live:!1},unreachable:{tone:`danger`,word:`Unreachable`,live:!1},failed:{tone:`danger`,word:`Failed`,live:!1}},Cs=En.pick({trusted:!0,approval:!0,prompts:!0,resources:!0,maxTools:!0,timeout:!0}).parse({});function ws(e){let t=Mr(e,Wn),n=Os(e),r=n?.transport,i=n??Cs;return{label:n?.label??``,description:n?.description??``,transport:r?.type??`http`,command:r?.type===`stdio`?r.command:``,args:r?.type===`stdio`?r.args:[],env:r?.type===`stdio`?Nr(r.env):[],envKept:t.has(`transport.env`),cwd:r?.type===`stdio`?r.cwd??``:``,url:r!==void 0&&r.type!==`stdio`?r.url:``,auth:Fr(n?.auth,t),trusted:i.trusted,approval:i.approval,prompts:i.prompts,resources:i.resources,maxTools:String(i.maxTools),timeout:String(i.timeout/1e3)}}function Ts(e){if(e.transport!==`stdio`)return{type:e.transport,url:e.url.trim()};let t=e.envKept?void 0:Vr(e.env),n=Pr(e.cwd);return{type:`stdio`,command:e.command.trim(),args:[...e.args],...t===void 0?{}:{env:t},...n===void 0?{}:{cwd:n}}}function Es(e){let t=e.transport===`stdio`?{auth:{kind:`none`},kept:[]}:zr(e.auth),n=Pr(e.description),r=Ir(e.maxTools),i=Ir(e.timeout,1e3),a={label:e.label.trim(),...n===void 0?{}:{description:n},transport:Ts(e),auth:t.auth,trusted:e.trusted,approval:e.approval,prompts:e.prompts,resources:e.resources,...r===void 0?{}:{maxTools:r},...i===void 0?{}:{timeout:i}},o=[...t.kept,...e.transport===`stdio`&&e.envKept?[`transport.env`]:[]];return Lr(En,a,o)}function Ds(e){let t=e.transport;return t.type===`stdio`?[t.command,...t.args].join(` `):t.url}function Os(e){let t=En.safeParse(Rr(e,Wn));return t.success?t.data:void 0}function ks(e){let t=(e,t)=>`${e} ${e===1?t:`${t}s`}`;return[t(e.tools,`tool`),t(e.prompts,`prompt`),t(e.resources,`resource`)].join(` · `)}function As(e){return In(e,`x`).slice(0,-1)}function js(e,t,n){let r=`${t}/${As(n)}`;return e.filter(e=>e.name.startsWith(r))}function Ms(e){return e.decl.command===void 0?void 0:`/${e.decl.command.name}`}function Ns(e,t,n){return e?.degraded.some(e=>n.endsWith(`/${In(t,e)}`))===!0}function Ps(e,t){return e===`connected`?t===void 0?Ss.connecting:`status`in t?Ss[t.status.state]:{tone:`warn`,word:`Status unknown`,live:!1}:kr[e]}var Fs=class{#e;system;list=new c;adding=new m;saving=new m;removing=new m;constructor(e,t){this.#e=e,this.system=t}async load(e=!1){await this.list.load(()=>this.#e.instances.call({system:this.system}),`Couldn't load the list.`,e)}find(e){return this.list.value.value?.find(t=>t.instance===e)}async add(e,t,n){let r=await this.adding.run(()=>this.#e.addInstance.call({system:this.system,instance:e,config:t,...n===void 0?{}:{description:n}}),`Couldn't add ${e}.`);return r.ok&&this.load(!0),r}async configure(e,t){let n=await this.saving.run(()=>this.#e.configureSystem.call({system:this.system,instance:e,config:t}),`Couldn't save the settings.`);return n.ok?`problems`in n.value?{ok:!1,problems:n.value.problems}:(this.load(!0),{ok:!0,version:n.value.version}):{ok:!1,problems:[n.problem]}}async remove(e){let t=await this.removing.run(()=>this.#e.removeInstance.call({system:this.system,instance:e}),`Couldn't remove ${e}.`);return t.ok&&t.value.ok&&this.list.set((this.list.value.value??[]).filter(t=>t.instance!==e)),t.ok&&t.value.ok}},Is=tn.parse(`${ys}/server_status`);function Ls(e){return{list:`contexts`,query:{filters:[{field:`system`,op:`is`,value:ys},{field:`name`,op:`contains`,value:As(e)}],sort:[{field:`name`,dir:`asc`}],limit:200}}}var Rs=class{#e;fleet;statuses=z(new Map);open=z(void 0);tools=new c;prompts=new c;constructor(e){this.#e=e,this.fleet=new Fs(e,ys)}async load(e=!1){await this.fleet.load(e),await Promise.all((this.fleet.list.value.value??[]).map(e=>this.readStatus(e.instance)))}async readStatus(e){let t;try{let n=await this.#e.readFn.call({fn:Is,args:{instance:e}}),r=An.safeParse(n);t=r.success?{status:r.data}:{problem:`Its status came back in a shape this page does not know.`}}catch(e){t={problem:J(e,`Couldn't read its status.`)}}this.statuses.value=new Map([...this.statuses.value,[e,t]])}statusOf(e){let t=this.statuses.value.get(e);return t!==void 0&&`status`in t?t.status:void 0}async show(e){let t=this.open.value===e;t||this.close(),this.open.value=e,await Promise.all([this.fleet.load(this.fleet.list.value.value!==void 0),this.readStatus(e),this.tools.load(async()=>ss(await this.#e.systemFns.call({system:ys}),e),`Couldn't load its tools.`,t),this.prompts.load(async()=>{let t=await this.#e.query.call(Ls(e));return js(On.array().parse(t.items),ys,e)},`Couldn't load its prompts.`,t)])}close(){this.open.value=void 0,this.tools.reset(),this.prompts.reset()}},zs=bn.parse(`api`),Bs=tn.parse(Tn),Vs=[`none`,`bearer`,`headers`],Hs=Fn.pick({timeout:!0,maxBody:!0}).parse({});function Us(e){let t=Fn.safeParse(e);return t.success?t.data:void 0}function Ws(e){let t=e??Hs;return{name:e?.name??``,label:e?.label??``,description:e?.description??``,baseUrl:e?.baseUrl??``,auth:Fr(e?.auth),headers:Nr(e?.headers),openapi:e?.openapi??``,timeout:String(t.timeout/1e3),maxBody:String(Math.round(t.maxBody/1024)),allowPrivate:e?.allowPrivate??!1,shared:e?.privateTo===void 0,privateTo:e?.privateTo}}function Gs(e){return e.name.trim()===``?Br(e.label)??``:e.name.trim()}function Ks(e){let{auth:t}=zr(e.auth),n=Pr(e.description),r=Vr(e.headers),i=Pr(e.openapi),a=Ir(e.timeout,1e3),o=Ir(e.maxBody,1024),s=vr(Fn,{name:Gs(e),label:e.label.trim(),...n===void 0?{}:{description:n},baseUrl:e.baseUrl.trim(),auth:t,...r===void 0?{}:{headers:r},...i===void 0?{}:{openapi:i},...a===void 0?{}:{timeout:a},...o===void 0?{}:{maxBody:o},allowPrivate:e.allowPrivate,...e.shared||e.privateTo===void 0?{}:{privateTo:e.privateTo}});return s.ok?{ok:!0,service:s.value}:s}function qs(e,t=100){let n=e.trim();return{type:Bs,query:{limit:t,...n===``?{sort:[{field:`label`,dir:`asc`}]}:{}},...n===``?{}:{search:n}}}function Js(e){return{type:Bs,query:{filters:[{field:`name`,op:`is`,value:e}],limit:1}}}function Ys(e,t=100){return{filters:[{field:`system`,op:`is`,value:zs},{field:`name`,op:`contains`,value:`${zs}/${e}.`}],limit:t}}function Xs(e){let t=Vn.safeParse(e);return t.success?t.data:void 0}function Zs(e){let t=Us(e.value);return t===void 0?void 0:{id:e.id,version:e.version,service:t}}var Qs=class{#e;list=new c;#t=z(``);open=z(void 0);service=new c;fns=new c;saving=new m;removing=new m;constructor(e){this.#e=e}async load(e=this.#t.value,t=!1){this.#t.value=e,await this.list.load(async()=>(await this.#e.records.call(qs(e))).items.flatMap(e=>Zs(e)??[]),`Couldn’t load the API services.`,t)}async show(e){let t=this.open.value===e;t||this.close(),this.open.value=e,await Promise.all([this.service.load(async()=>{let[t]=(await this.#e.records.call(Js(e))).items;return t===void 0?void 0:Zs(t)},`Couldn’t load the service.`,t),this.fns.load(async()=>(await this.#e.fns.call(Ys(e))).items,`Couldn’t load its fns.`,t)])}close(){this.open.value=void 0,this.service.reset(),this.fns.reset()}async save(e,t){return this.saving.run(async()=>{if(t===void 0&&(await this.#e.records.call(Js(e.name))).items.length>0)throw new yr(`There is a service named ${e.name} already: give the new one another name.`);let n=Zs(await this.#e.saveRecord.call({type:Bs,value:en.parse(e),...t===void 0?{}:{id:t.id,expect:t.version}}));if(n===void 0)throw new yr(`The hub kept something that is not a service.`);return this.open.value===n.service.name&&this.service.set(n),this.load(this.#t.value,!0),n},`Couldn’t save the service.`)}async remove(e){let t=await this.removing.run(async()=>(await this.#e.removeRecord.call({type:Bs,id:e.id})).removed,`Couldn’t remove the service.`);return t.ok&&this.load(this.#t.value,!0),t.ok&&t.value}};async function $s(e,t,n,r,i,a){let o=n.type===``?`application/octet-stream`:n.type,{url:s,upload:c}=await e.upload.call({name:r,mime:o,size:n.size});return await t.put(s,n,i,a),e.uploaded.call({upload:c})}var ec={make:e=>e.type.startsWith(`image/`)?URL.createObjectURL(e):void 0,revoke:e=>{URL.revokeObjectURL(e)}},tc=class{#e;#t;#n;#r=new Map;#i=1;items=z([]);busy=j(()=>this.items.value.some(e=>e.status===`uploading`));parts=j(()=>this.items.value.flatMap(e=>e.ref===void 0?[]:[{type:`file`,ref:e.ref,name:e.name}]));constructor(e,t,n=ec){this.#e=e,this.#t=t,this.#n=n}add(e){for(let t of e){let e=this.#i++,n=this.#n.make(t);this.#r.set(e,{file:t,abort:new AbortController}),this.items.value=[...this.items.value,{id:e,name:t.name===``?`pasted file`:t.name,size:t.size,mime:t.type,status:`uploading`,progress:0,...n===void 0?{}:{preview:n}}],this.#a(e)}}remove(e){this.#r.get(e)?.abort.abort(),this.#r.delete(e);let t=this.items.value.find(t=>t.id===e);t?.preview!==void 0&&this.#n.revoke(t.preview),this.items.value=this.items.value.filter(t=>t.id!==e)}retry(e){let t=this.#r.get(e);t!==void 0&&(this.#r.set(e,{file:t.file,abort:new AbortController}),this.#o(e,{status:`uploading`,progress:0}),this.#a(e))}clear(){for(let e of[...this.#r.keys()])this.remove(e)}async#a(e){let t=this.#r.get(e);if(t!==void 0)try{let n=await $s(this.#e,this.#t,t.file,t.file.name===``?`pasted file`:t.file.name,t=>{this.#o(e,{progress:t})},t.abort.signal);this.#o(e,{status:`ready`,progress:1,ref:n})}catch(t){if(!this.#r.has(e))return;this.#o(e,{status:`failed`,problem:J(t,t instanceof Error?t.message:`Upload failed.`)})}}#o(e,t){this.items.value=this.items.value.map(n=>n.id===e?{...n,...t}:n)}};function nc(e){return/\.zip$/i.test(e.name)}var rc=class{#e;#t;install=new m;progress=R(0);#n;constructor(e,t){this.#e=e,this.#t=t}async installZip(e,t){if(!nc(e))return{ok:!1,problem:`A package is a .zip made by harness system pack.`};let n=t.instance.trim();if(n!==``&&!pn.safeParse(n).success)return{ok:!1,problem:`An instance name is lowercase letters, digits and dashes, starting with a letter.`};this.#n=new AbortController;let r=this.#n.signal;return this.progress.value=0,this.install.run(async()=>{let i=await $s(this.#e,this.#t,e,e.name,e=>{this.progress.value=e},r),a=t.data===void 0?void 0:await $s(this.#e,this.#t,t.data,t.data.name,()=>void 0,r);return this.#e.installPackage.call({zip:i,autoStart:t.autoStart,...n===``?{}:{instance:pn.parse(n)},...t.config===void 0?{}:{config:t.config},...a===void 0?{}:{data:a}})},`Couldn't install that package.`)}cancel(){this.#n?.abort()}},X={hub:`Hub`,group:`Group`,user:`Person`,session:`Chat`,turn:`Message`,system:`System`,fn:`Fn`,model:`Model`},ic=[`hub`,`group`,`user`,`session`,`system`,`fn`,`model`],ac=[`hub`,`group`,`user`,`session`,`turn`],oc={urgent:`Urgent`,interactive:`Interactive`,normal:`Normal`,background:`Background`};function sc(e,t){switch(e.scope){case`hub`:return`Whole hub`;case`group`:return`${X.group}: ${t(e.group)}`;case`user`:return`${X.user}: ${t(e.user)}`;case`session`:return`${X.session}: ${e.session}`;case`turn`:return`${X.turn}: ${e.turn}`;case`system`:return`${X.system}: ${e.system}`;case`fn`:return`${X.fn}: ${ln(e.fn)}`;case`model`:return`${X.model}: ${e.model}`}}var cc=[{label:`Hour`,ms:36e5},{label:`Day`,ms:864e5},{label:`Week`,ms:6048e5},{label:`30 days`,ms:2592e6}];function lc(e){if(e===`all-time`)return`all time`;if(e===`per-turn`)return`per message`;let t=cc.find(t=>t.ms===e.window);return t===void 0?`per ${H(e.window)}`:`per ${t.label.toLowerCase()}`}var uc={refuse:`Refuses`,wait:`Waits for room`,ask:`Asks to raise it`};function dc(e){let t=e.maxCost<=0?1:Math.min(1,Math.max(0,e.spent/e.maxCost));return{fraction:t,tone:t>=1?`danger`:t>=.8?`warn`:`ok`}}function fc(e){let t=[`${tt(e.maxCost)} ${lc(e.period)}`];return e.maxTokens!==void 0&&t.push(`${e.maxTokens.toLocaleString()} tokens`),e.maxCalls!==void 0&&t.push(`${e.maxCalls.toLocaleString()} calls`),e.maxTime!==void 0&&t.push(`${H(e.maxTime)} each`),t.join(` · `)}function pc(e){let t=`${X[e.priorityFrom.default].toLowerCase()} default`,n=e.priorityFrom.cappedBy===void 0?``:`, capped by the ${X[e.priorityFrom.cappedBy].toLowerCase()}`;return{priority:`${oc[e.priority]}, from the ${t}${n}.`,turn:`Each message may spend up to ${tt(e.turn.cost)} and run for ${H(e.turn.time)}.`,tightest:e.limitedBy===void 0?-1:e.budgets.findIndex(t=>t.rule===e.limitedBy)}}var mc={setBudget:un.endpoints.setBudget.cfg.body,setPriority:un.endpoints.setPriority.cfg.body,setPolicy:un.endpoints.setPolicy.cfg.body,setModelCategory:un.endpoints.setModelCategory.cfg.body,createPairingToken:un.endpoints.createPairingToken.cfg.body,upgradeSystem:un.endpoints.upgradeSystem.cfg.body},hc=e=>e.trim()===``?void 0:Number(e),gc=e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0&&e!==``)),_c=e=>e===void 0?``:String(e),vc={group:`group`,user:`user`};function yc(e){return e.level===`hub`?{scope:`hub`}:{scope:e.level,[e.level]:e.target.trim()}}function bc(e){let t=e[e.scope];return{level:e.scope,target:typeof t==`string`?t:``}}function xc(e){let t=e?.period;return{scope:e===void 0?{level:`hub`,target:``}:bc(e.target),period:t===void 0||typeof t==`object`?`window`:t,window:t!==void 0&&typeof t==`object`?t.window:cc[1].ms,maxCost:e===void 0?``:String(e.maxCost),maxTokens:_c(e?.maxTokens),maxCalls:_c(e?.maxCalls),maxTime:e?.maxTime===void 0?``:String(e.maxTime/1e3),share:e?.share??`pooled`,onLimit:e?.onLimit??`refuse`}}function Sc(e){let t=e.period===`window`?{window:e.window}:e.period,n=hc(e.maxTime);return Y(mc.setBudget,gc({target:yc(e.scope),period:t,maxCost:hc(e.maxCost)??NaN,maxTokens:hc(e.maxTokens),maxCalls:hc(e.maxCalls),maxTime:e.period===`per-turn`&&n!==void 0?Math.round(n*1e3):void 0,share:e.scope.level===`group`?e.share:void 0,onLimit:e.onLimit}))}function Cc(e){return{scope:e===void 0?{level:`hub`,target:``}:bc(e.target),default:e?.default??``,max:e?.max??``}}function wc(e){return e.default===``&&e.max===``?{ok:!1,problems:{default:`Set a default, a ceiling, or both.`}}:Y(mc.setPriority,gc({target:yc(e.scope),default:e.default,max:e.max}))}function Tc(e){let t=e?.subject,n=e?.decision,r=n?.effect===`ask`?n.approver:void 0;return{description:e?.description??``,subject:t===void 0||`everyone`in t?`everyone`:`actor`in t?`actor`:`group`in t?`group`:`kind`,subjectValue:t===void 0||`everyone`in t?``:`actor`in t?t.actor:`group`in t?t.group:t.kind,fn:e?.target.fn??``,system:e?.target.system??``,kind:e?.target.kind??``,tags:[...e?.target.tags??[]],effect:n?.effect??`ask`,reason:n?.effect===`deny`?n.reason:``,approver:r?.by??`turn-user`,approverValue:r===void 0?``:r.by===`actor`?r.actor:r.by===`group`?r.group:r.by===`judge`?r.fn:``,quorum:r?.by===`group`?_c(r.quorum):``,priority:String(e?.priority??0)}}function Ec(e){let t=e.subjectValue.trim(),n=e.subject===`everyone`?{everyone:!0}:{[e.subject]:t},r=e.tags.map(e=>e.trim()).filter(e=>e!==``),i=gc({fn:e.fn.trim(),system:e.system.trim(),kind:e.kind.trim(),tags:r.length===0?void 0:r}),a=e.approverValue.trim(),o=e.approver===`actor`?{by:`actor`,actor:a}:e.approver===`group`?gc({by:`group`,group:a,quorum:hc(e.quorum)}):e.approver===`judge`?{by:`judge`,fn:a}:{by:e.approver},s=e.effect===`allow`?{effect:`allow`}:e.effect===`deny`?{effect:`deny`,reason:e.reason.trim()}:{effect:`ask`,approver:o};return e.effect===`deny`&&e.reason.trim()===``?{ok:!1,problems:{decision:`Say why, for the people it stops.`}}:e.description.trim()===``?{ok:!1,problems:{description:`Required.`}}:Y(mc.setPolicy,{description:e.description.trim(),subject:n,target:i,decision:s,priority:hc(e.priority)??0})}function Dc(e){return{name:e?.name??``,description:e?.description??``,models:e?.models??[]}}function Oc(e){return e.name.trim()===``?{ok:!1,problems:{name:`Required.`}}:e.models.length===0?{ok:!1,problems:{models:`Add at least one model.`}}:Y(mc.setModelCategory,{name:e.name.trim(),description:e.description.trim(),models:[...e.models]})}var kc=[{value:`keys`,label:`Access keys`},{value:`apiKey`,label:`API key`}],Ac={apiKey:{label:`API key`,secret:!0},baseURL:{label:`Base URL`,secret:!1},contextWindow:{label:`Context window (tokens)`,secret:!1,kind:`number`},decisionModels:{label:`Decision models`,secret:!1,kind:`list`,placeholder:`qwen3-systemone`,hint:`System One models to treat as decision models, comma separated. Only needed when the server’s /api/show lists no capabilities; newer servers say so themselves.`},region:{label:`Region`,secret:!1,placeholder:`us-east-1`},accessKeyId:{label:`Access key ID`,secret:!1},secretAccessKey:{label:`Secret access key`,secret:!0},sessionToken:{label:`Session token`,secret:!0,hint:`Only for temporary credentials.`},profilePrefix:{label:`Inference profile prefix`,secret:!1,placeholder:`us.`,hint:`Left empty, one is picked for the region.`}},jc={openai:`OpenAI`,openrouter:`OpenRouter`,ollama:`Ollama`,aws:`Amazon Bedrock`};function Mc(e){let t=sn.safeParse(e);return t.success?jc[t.data]:e}var Nc=e=>e in Ac;function Pc(e){let t=jn.options.find(t=>t.shape.provider.value===e);if(t===void 0)throw Error(`No provider input schema for ${e}`);return t}function Fc(e){let t=Pc(`aws`).shape;if(!(`auth`in t))throw Error(`The AWS provider input has no sign-in`);let n=t.auth.options.find(t=>t.shape.kind.value===e);if(n===void 0)throw Error(`No AWS sign-in schema for ${e}`);return n}function Ic(e){return Object.entries(e).flatMap(([e,t])=>Nc(e)?[{name:e,...Ac[e],required:!t.safeParse(void 0).success}]:[])}function Lc(e,t=`keys`){let n=Pc(e).shape;if(e!==`aws`)return Ic(n);let r=Ic(n);return[...r.filter(e=>e.name===`region`),...Ic(Fc(t).shape),...r.filter(e=>e.name!==`region`)]}function Rc(e,t,n=`keys`){let r=e=>gc(Object.fromEntries(e.map(e=>[e.name,zc(e,t[e.name])]))),i=e===`aws`?Ic(Fc(n).shape):[],a=Lc(e,n).filter(e=>!i.includes(e)),o=e===`aws`?{provider:e,...r(a),auth:{kind:n,...r(i)}}:{provider:e,...r(a)},s=Y(Pc(e),o);if(s.ok)return{ok:!0,value:s.value};let c={},l=e===`aws`&&`auth`in s.problems?{...s.problems,...Bc(n,o)}:s.problems;for(let[e,t]of Object.entries(l))Nc(e)&&(c[e]=t);return{ok:!1,problems:c}}function zc(e,t){let n=t?.trim();if(n!==void 0&&n!==``){if(e.kind===`number`)return Number(n);if(e.kind===`list`){let e=n.split(/[,\n]/).map(e=>e.trim()).filter(e=>e!==``);return e.length===0?void 0:e}return n}}function Bc(e,t){let n=Y(Fc(e),t.auth);return n.ok?{}:n.problems}var Vc=[`package`,`path`,`git`];function Hc(e){let t=Hn.options.find(t=>e in t.shape);if(t===void 0)throw Error(`No install source schema for ${e}`);return t}function Uc(e){return Object.keys(Hc(e).shape).filter(Gc)}var Wc={package:!0,version:!0,path:!0,git:!0,ref:!0,zip:!0,file:!0},Gc=e=>Object.hasOwn(Wc,e);function Kc(e){let t=Uc(e.kind),n=Object.fromEntries(t.map(t=>[t,(e.fields[t]??``).trim()])),r=Y(Hc(e.kind),n),i=r.ok?{}:r.problems,a={};for(let e of t){let t=n[e]===``?`Required.`:i[e];t!==void 0&&(a[e]=t)}return r.ok&&Object.keys(a).length===0?{ok:!0,value:r.value}:{ok:!1,problems:a}}var qc=[{label:`15 minutes`,ms:9e5},{label:`1 hour`,ms:36e5},{label:`1 day`,ms:864e5}],Jc=[{label:`90 days`,ms:7776e6},{label:`30 days`,ms:2592e6},{label:`1 year`,ms:31536e6},{label:`Never ends`,ms:null}];function Yc(e){return e===void 0?{}:{autoPair:e}}function Xc(e,t){let n=e.trim(),r=Y(mc.createPairingToken,n===``?{expiresIn:t}:{name:n,expiresIn:t});return r.ok?r:{ok:!1,problems:{...r.problems,...r.problems.name===void 0?{}:{name:`Lowercase letters, digits and dashes, starting with a letter.`}}}}var Zc=class{#e;#t;#n;#r;request=new c;answer=new m;system=R(void 0);status=z(void 0);#i=R(void 0);phase=j(()=>{if(this.#i.value===`refused`)return`refused`;if(this.answer.busy.value)return`pairing`;if(this.#i.value===`approved`)return this.status.value===`connected`?`connected`:this.status.value===`needs-config`?`needs-config`:`joining`;let e=this.request.value.value;return e===void 0?`loading`:e.status===`expired`||e.expiresAt<=this.#n()?`expired`:e.status===`pending`?`waiting`:`elsewhere`});constructor(e,t,n=Date.now){this.#e=e,this.#t=t,this.#n=n}async open(e){this.request.value.value?.id!==e&&this.close(),this.#r??=this.#t(e=>{this.#a(e)}),await this.request.load(()=>this.#e.pairing.call({pairing:e}),`Couldn't load this pairing request. It may have expired or been answered.`)}close(){this.#r?.(),this.#r=void 0,this.request.reset(),this.system.value=void 0,this.status.value=void 0,this.#i.value=void 0}codeMatches(e){let t=this.request.value.value;return t===void 0?!1:t.code===void 0||t.code===e.trim()}async approve(e,t,n){let r=this.request.value.value;if(r===void 0)return{ok:!1,problem:`No pairing request is open.`};let i=await this.answer.run(()=>this.#e.approvePairing.call({pairing:r.id,approve:!0,...e===void 0?{}:{instance:e},...t===void 0?{}:{config:t},...Yc(n)}),`Couldn't pair it.`);return i.ok&&(this.#i.value=`approved`,this.system.value=i.value.system??r.name,this.status.value??=`pairing`),i}async refuse(){let e=this.request.value.value;if(e===void 0)return!1;let t=await this.answer.run(()=>this.#e.approvePairing.call({pairing:e.id,approve:!1}),`Couldn't refuse it.`);return t.ok&&(this.#i.value=`refused`),t.ok}#a(e){let t=this.request.value.value;if(e.type===`pairing`&&t!==void 0&&e.pairing.id===t.id){this.request.set(e.pairing);return}let n=this.system.value??t?.name;e.type===`system`&&e.system===n&&(this.status.value=e.status)}},Qc=class{#e;budgets=new c;priorities=new c;resolved=new c;save=new m;remove=new m;constructor(e){this.#e=e}async load(e=!1){await Promise.all([this.#t(e),this.#n(e)])}async saveBudget(e){let t=await this.save.run(()=>this.#e.setBudget.call(e),`Couldn't save the budget.`);return t.ok&&this.#t(!0),t}async savePriority(e){let t=await this.save.run(()=>this.#e.setPriority.call(e),`Couldn't save the priority rule.`);return t.ok&&this.#n(!0),t}async removeBudget(e){let t=await this.remove.run(()=>this.#e.removeRule.call({kind:`budget`,id:e}),`Couldn't remove the budget.`);return t.ok&&this.budgets.set((this.budgets.value.value??[]).filter(t=>t.id!==e)),t.ok}async removePriority(e){let t=await this.remove.run(()=>this.#e.removeRule.call({kind:`priority`,id:e}),`Couldn't remove the priority rule.`);return t.ok&&this.priorities.set((this.priorities.value.value??[]).filter(t=>t.id!==e)),t.ok}async resolve(e,t){await this.resolved.load(()=>this.#e.resolveLimits.call({user:e,...t===void 0?{}:{session:t}}),`Couldn't work out the limits.`)}#t(e){return this.budgets.load(()=>this.#e.budgets.call({}),`Couldn't load budgets.`,e)}#n(e){return this.priorities.load(()=>this.#e.priorityRules.call({}),`Couldn't load priority rules.`,e)}},$c=class{#e;providers=new c;models=new c;categories=new c;save=new m;remove=new m;modelIds=j(()=>(this.models.value.value??[]).map(e=>e.id).sort());constructor(e){this.#e=e}async load(e=!1){await Promise.all([this.providers.load(()=>this.#e.providers.call({}),`Couldn't load providers.`,e),this.models.load(()=>this.#e.models.call({}),`Couldn't load models.`,e),this.categories.load(()=>this.#e.modelCategories.call({}),`Couldn't load model categories.`,e)])}async saveProvider(e){let t=await this.save.run(()=>this.#e.configureProvider.call(e),`Couldn't save the provider.`);return t.ok&&this.load(!0),t}async saveCategory(e){let t=await this.save.run(()=>this.#e.setModelCategory.call(e),`Couldn't save the category.`);return t.ok&&this.categories.load(()=>this.#e.modelCategories.call({}),`Couldn't load model categories.`,!0),t}async removeCategory(e){let t=await this.remove.run(()=>this.#e.removeRule.call({kind:`category`,id:e}),`Couldn't remove the category.`);return t.ok&&this.categories.set((this.categories.value.value??[]).filter(t=>t.id!==e)),t.ok}async removeProvider(e){let t=await this.remove.run(()=>this.#e.removeRule.call({kind:`provider`,id:e}),`Couldn't remove the provider.`);return t.ok&&this.load(!0),t.ok}},el={user:{plural:`people`,label:`People`},group:{plural:`groups`,label:`Groups`},agent:{plural:`agents`,label:`Agents`},system:{plural:`systems`,label:`Systems`},mcp:{plural:`MCP clients`,label:`MCP clients`}};function tl(e,t){return`actor`in e?t(e.actor):`group`in e?`Group ${t(e.group)}`:`kind`in e?`All ${el[e.kind].plural}`:`Everyone`}function nl(e){let t=[];if(e.fn!==void 0){let n=tn.safeParse(e.fn);t.push(n.success&&!e.fn.includes(`*`)?ln(n.data):e.fn)}return e.system!==void 0&&t.push(`fns of ${e.system}`),e.kind!==void 0&&t.push(e.kind===`native`?`native fns`:`${e.kind} fns`),e.tags!==void 0&&e.tags.length>0&&t.push(`tagged ${e.tags.join(`, `)}`),e.when!==void 0&&t.push(`when its args match`),t.length===0?`any fn`:t.join(`, `)}function rl(e,t){switch(e.by){case`turn-user`:return`the message's sender`;case`actor`:return t(e.actor);case`group`:return`group ${t(e.group)}${e.quorum===void 0?``:` (${e.quorum} needed)`}`;case`judge`:return`the judge ${ln(e.fn)}`;case`hub`:return`the hub`;case`admins`:return`an admin`}}function il(e,t){switch(e.effect){case`allow`:return{word:`Allow`,detail:`runs without asking`,tone:`ok`};case`deny`:return{word:`Deny`,detail:e.reason,tone:`danger`};case`ask`:return{word:`Ask`,detail:`asks ${rl(e.approver,t)}`,tone:`warn`}}}function al(e){let t={deny:0,ask:1,allow:2};return[...e].sort((e,n)=>n.priority-e.priority||t[e.decision.effect]-t[n.decision.effect])}var ol=class{#e;list=new c;sorted=j(()=>al(this.list.value.value??[]));save=new m;remove=new m;constructor(e){this.#e=e}async load(e=!1){await this.list.load(()=>this.#e.policies.call({}),`Couldn't load policies.`,e)}async savePolicy(e){let t=await this.save.run(()=>this.#e.setPolicy.call(e),`Couldn't save the policy.`);return t.ok&&this.load(!0),t}async removePolicy(e){let t=await this.remove.run(()=>this.#e.removeRule.call({kind:`policy`,id:e}),`Couldn't remove the policy.`);return t.ok&&this.list.set((this.list.value.value??[]).filter(t=>t.id!==e)),t.ok}},sl=class{#e;users;groups;person=new c;members=new c;signIn=new c;checks=z(new Map);checking=z(void 0);test=new c;save=new m;constructor(e){this.#e=e,this.users=new x({fetch:(t,n,r)=>e.people.call(g(t,r,n)),key:e=>e.id,failure:`Couldn’t load the people.`,limit:50},{}),this.groups=new x({fetch:(t,n,r)=>e.groups.call(g(t,r,n)),key:e=>e.id,failure:`Couldn’t load the groups.`,limit:50},{})}openPerson(e,t=!1){return this.person.load(async()=>(await this.#e.people.call({filters:[{field:`email`,op:`is`,value:e}],limit:1})).items[0],`Couldn’t load them.`,t)}openGroup(e,t=!1){return this.members.load(()=>this.#e.groupMembers.call({group:e,limit:200}),`Couldn’t load the group.`,t)}loadSignIn(e=!1){return this.signIn.load(()=>this.#e.signInSettings.call({}),`Couldn’t load how people sign in.`,e)}loadTest(e){return this.test.load(()=>this.#e.ssoTestResult.call({test:e}),`Couldn’t read the test sign-in.`)}async check(e){this.checking.value=e;try{let t=await this.#e.checkSsoProvider.call({provider:e});this.checks.value=new Map([...this.checks.value,[e,t]])}catch(t){let n=t instanceof Error?t.message:String(t);this.checks.value=new Map([...this.checks.value,[e,{provider:e,ok:!1,discovery:{ok:!1,detail:n},keys:{ok:!1,detail:`Not checked.`},checkedAt:Date.now()}]])}finally{this.checking.value=void 0}}startTest(e){return this.save.run(()=>this.#e.testSsoSignIn.call({provider:e}),`Couldn’t start the test sign-in.`)}addPerson(e){let t={name:e.name,email:e.email,role:e.role,...e.groups===void 0?{}:{groups:[...e.groups]}};return this.#t(this.save.run(()=>this.#e.addUser.call(t),`Couldn’t add them.`))}addGroup(e){return this.#t(this.save.run(()=>this.#e.addGroup.call(e),`Couldn’t add the group.`))}update(e){return this.#t(this.save.run(()=>this.#e.updateUser.call(e),`Couldn’t change them.`))}membership(e){return this.#t(this.save.run(()=>this.#e.setMembership.call(e),`Couldn’t change the group.`))}async setPolicy(e){let t=await this.save.run(()=>this.#e.setSignInPolicy.call(e),`Couldn’t save who can join.`);return t.ok&&this.loadSignIn(!0),t}async setLimits(e){let t=await this.save.run(()=>this.#e.setSignInLimits.call(e),`Couldn’t save the sign-in limits.`);return t.ok&&this.loadSignIn(!0),t}async setProxy(e){let t=await this.save.run(()=>this.#e.setProxyTrust.call(e),`Couldn’t save the proxy setting.`);return t.ok&&this.loadSignIn(!0),t}async#t(e){let t=await e;if(!t.ok)return t;this.users.refresh(),this.groups.refresh();let n=this.person.value.value;n!==void 0&&this.openPerson(n.email,!0);let r=this.members.value.value?.group;return r!==void 0&&this.openGroup(r.id,!0),t}};function cl(e,t,n){let r=e??[];return r.some(e=>n(e,t))?r.map(e=>n(e,t)?t:e):[...r,t]}var ll=class{#e;roles=new c;limits=new c;save=new m;constructor(e){this.#e=e}async loadRoles(e=!1){await this.roles.load(()=>this.#e.modelRoles.call({}),`Couldn't load the model roles.`,e)}async loadLimits(e=!1){await this.limits.load(()=>this.#e.modelLimits.call({}),`Couldn't load the model limits.`,e)}role(e){return this.roles.value.value?.find(t=>t.role===e)}async setRole(e){let t=await this.save.run(()=>this.#e.setModelRole.call(e),`Couldn't save that role.`);return t.ok&&this.roles.set(cl(this.roles.value.value,t.value,(e,t)=>e.role===t.role)),t}async clearRole(e){let t=await this.save.run(()=>this.#e.clearModelRole.call({role:e}),`Couldn't clear that role.`);return t.ok&&this.roles.set(cl(this.roles.value.value,t.value,(e,t)=>e.role===t.role)),t}async setLimits(e,t){let n=await this.save.run(()=>this.#e.setModelLimits.call({model:e,limits:t}),`Couldn't save the limits of ${e}.`);return n.ok&&this.limits.set(cl(this.limits.value.value,n.value,(e,t)=>e.model===t.model)),n}},ul=class{#e;data=new c;save=new m;groups=j(()=>{let e=this.data.value.value;if(e===void 0)return[];let t=new Map;for(let n of[...e.declared].sort((e,t)=>e.setting.localeCompare(t.setting))){let r={view:n,values:e.values.filter(e=>e.setting===n.setting)};t.set(n.system,[...t.get(n.system)??[],r])}return[...t].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({system:e,settings:t}))});constructor(e){this.#e=e}async load(e=!1){await this.data.load(()=>this.#e.actorSettings.call({}),`Couldn't load actor settings.`,e)}async set(e,t,n,r,i){let a=await this.save.run(()=>this.#e.setActorSetting.call({setting:e,actor:t,value:n}),`Couldn't save the setting.`),o=this.data.value.value;if(!a.ok||!a.value.ok||o===void 0)return a.ok&&a.value.ok;let s={setting:e,actor:t,value:n,setBy:r,updatedAt:i};return this.data.set({...o,values:[...o.values.filter(n=>n.setting!==e||n.actor!==t),s]}),!0}},dl=class{#e;review=new c;refusals;switching=new m;deciding=new m;decidingChange=R(void 0);testing=new m;off=j(()=>Ur(this.review.value.value?.off??[]));constructor(e){this.#e=e,this.refusals=new x({fetch:async({system:e,rule:t},n,r)=>{if(e===void 0)return{items:[]};let i=await this.#e.refusals.call({system:e,limit:r,...t===void 0?{}:{rule:t},...n===void 0?{}:{cursor:n}});return{items:i.items,...i.next===void 0?{}:{cursor:i.next}}},key:e=>e.id,failure:`Couldn't load the refusals.`,limit:50},{system:void 0,rule:void 0})}async open(e){let t=this.review.value.value?.system===e;t||this.review.reset(),await this.review.load(()=>this.#e.systemReview.call({system:e}),`Couldn't load this system's review.`,t)}async loadRefusals(e,t){await this.refusals.load({system:e,rule:t})}isOn(e){return!this.off.value.has(Hr(e))}async switch(e,t){let n=this.review.value.value;if(n===void 0)return!1;let r=n.off;this.review.set({...n,off:Gr(r,e,t)});let i=await this.switching.run(()=>this.#t(n.system,e,t),`Couldn't switch that.`);if(!i.ok){let n=this.review.value.value;n!==void 0&&this.review.set({...n,off:Gr(n.off,e,!t)})}return i.ok}async#t(e,t,n){let{section:r,name:i}=t;r===`fns`||r===`context`?await this.#e.switchItem.call({section:r,name:tn.parse(i),on:n}):await this.#e.switchPart.call({system:e,section:r,name:i,on:n})}#n(e){let t=this.review.value.value;return t===void 0?void 0:{system:t.system,hash:e,off:t.off}}async goLive(){let e=this.review.value.value,t=e===void 0?void 0:this.#n(e.manifest.hash);if(e===void 0||t===void 0)return{ok:!1,problem:`No system is open.`};let n=await this.deciding.run(()=>this.#e.goLive.call(t),`Couldn't go live.`);return this.open(e.system),n.ok?{ok:!0,value:n.value.stage}:n}async approve(){let e=this.review.value.value,t=e?.pending,n=t===void 0?void 0:this.#n(t.hash);if(e===void 0||n===void 0)return{ok:!1,problem:`Nothing waits for review.`};let r=await this.deciding.run(()=>this.#e.approveReview.call(n),`Couldn't approve the changes.`);return this.open(e.system),r.ok?{ok:!0,value:r.value.hash}:r}async decide(e,t){let n=this.review.value.value,r=n?.pending;if(n===void 0||r===void 0)return{ok:!1,problem:`Nothing waits for review.`};this.decidingChange.value=Kr(e);let i=Wr(e),a={system:n.system,hash:r.hash,approve:t===`approve`?[i]:[],decline:t===`decline`?[i]:[],off:[]};try{let e=await this.deciding.run(()=>this.#e.decideReview.call(a),t===`approve`?`Couldn't approve that change.`:`Couldn't decline that change.`);return await this.open(n.system),e}finally{this.decidingChange.value=void 0}}async reject(){let e=this.review.value.value,t=e?.pending;if(e===void 0||t===void 0)return{ok:!1,problem:`Nothing waits for review.`};let n=await this.deciding.run(()=>this.#e.rejectReview.call({system:e.system,hash:t.hash}),`Couldn't reject the changes.`);return this.open(e.system),n.ok?{ok:!0,value:n.value.ok}:n}async testCall(e,t){let n=await this.testing.run(()=>this.#e.testCall.call({fn:e,args:t}),`Couldn't run that.`);return n.ok?{ok:!0,value:n.value.run}:n}close(){this.review.reset(),this.refusals.load({system:void 0,rule:void 0})}},fl=1e3,pl=`Restarted by an admin from its page`,ml=class{#e;#t;#n;#r;#i;name=R(void 0);view=new c;fns=new c;logs=new c;config=new m;enabling=new m;switching=new m;action=new m;acting=z(void 0);constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n}async open(e){this.name.value!==e&&(this.close(),this.name.value=e),this.#r??=this.#t(e=>{this.#o(e)}),await this.view.load(()=>this.#e.system.call({system:e}),`Couldn't load this system.`,this.view.value.value?.name===e)}close(){this.#r?.(),this.#r=void 0,this.unfollowLogs(),this.name.value=void 0,this.view.reset(),this.fns.reset(),this.logs.reset()}async loadFns(){let e=this.name.value;e!==void 0&&await this.fns.load(()=>this.#e.systemFns.call({system:e}),`Couldn't load this system's fns.`)}fnSwitched(e,t){let n=this.fns.value.value;n!==void 0&&this.fns.set(n.map(n=>n.name===e?{...n,disabled:!t}:n))}async switchFn(e,t){if(this.fnSwitched(e,t),!(await this.switching.run(()=>this.#e.switchItem.call({section:`fns`,name:e,on:t}),`Couldn't switch that.`)).ok)return this.fnSwitched(e,!t),!1;let n=this.name.value;return n!==void 0&&await this.fns.load(()=>this.#e.systemFns.call({system:n}),`Couldn't load this system's fns.`,!0),!0}async followLogs(){let e=this.name.value;e!==void 0&&(this.#i??=this.#n(e,e=>{let t=this.logs.value.value??[];this.logs.set([...t,e].slice(-1e3))}),await this.logs.load(()=>this.#e.systemLogs.call({system:e,limit:fl}),`Couldn't load this system's output.`))}unfollowLogs(){this.#i?.(),this.#i=void 0}async configure(e){let t=this.name.value;if(t===void 0)return{ok:!1,problems:[`No system is open.`]};let n=await this.config.run(()=>this.#e.configureSystem.call({system:t,config:e}),`Couldn't save the config.`);return n.ok?`problems`in n.value?{ok:!1,problems:n.value.problems}:(this.open(t),{ok:!0,version:n.value.version}):{ok:!1,problems:[n.problem]}}async enable(e,t){let n=this.name.value,r=this.view.value.value;if(n===void 0||r===void 0)return!1;this.view.set({...r,enabled:{...r.enabled,[e]:t}});let i=await this.enabling.run(()=>this.#e.enableSystem.call({system:n,[e]:t}),`Couldn't change that.`),a=this.view.value.value;return a===void 0||this.view.set({...a,enabled:i.ok?i.value.enabled:r.enabled}),i.ok}async act(e,t){let n=this.name.value;if(n===void 0)return{ok:!1,problem:`No system is open.`};this.acting.value=e;let r=await this.action.run(()=>this.#a(n,e,t),`Couldn't ${e} ${n}.`);return this.acting.value=void 0,r.ok&&e!==`remove`&&this.open(n),r}async#a(e,t,n){switch(t){case`start`:return await this.#e.startSystem.call({system:e}),{kind:`done`};case`stop`:return await this.#e.stopSystem.call({system:e}),{kind:`done`};case`restart`:return await this.#e.restartSystem.call({system:e,reason:pl}),{kind:`done`};case`upgrade`:return{kind:`upgrade`,...await this.#e.upgradeSystem.call({system:e,...n===void 0||n===``?{}:{version:n}})};case`reimport`:return{kind:`reimport`,report:await this.#e.reimport.call({system:e})};case`remove`:return await this.#e.removeSystem.call({system:e}),{kind:`done`}}}#o(e){let t=this.view.value.value;if(t===void 0||e.type!==`system`&&e.type!==`fn`||e.system!==t.name)return;if(e.type===`system`){this.view.set({...t,status:e.status});return}let n=this.fns.value.value;n?.some(t=>t.name===e.fn)===!0&&this.fns.set(n.map(t=>t.name===e.fn?{...t,stats:e.stats}:t))}},hl=class{#e;#t;context;types;contextCount=R(void 0);typeCount=R(void 0);others=new c;roots=new c;switching=new m;constructor(e){this.#e=e,this.context=new x({fetch:async(e,t,n)=>{if(e===void 0)return{items:[]};let r=await this.#e.query.call(Ar(e,t,n));return t===void 0&&(this.contextCount.value=r.total),{items:On.array().parse(r.items),...r.cursor===void 0?{}:{cursor:r.cursor}}},key:e=>e.name,failure:`Couldn't load this system's context.`,limit:50},void 0),this.types=new x({fetch:async(e,t,n)=>{if(e===void 0)return{items:[]};let r=await this.#e.query.call(cs({system:e},t,n));return t===void 0&&(this.typeCount.value=r.total),{items:Ln.array().parse(r.items),...r.cursor===void 0?{}:{cursor:r.cursor}}},key:e=>e.name,failure:`Couldn't load this system's types.`,limit:50},void 0)}async loadContext(e){this.context.filter.value===e&&this.context.loaded.value?await this.context.refresh():(this.contextCount.value=void 0,await this.context.load(e))}async loadTypes(e){this.types.filter.value===e&&this.types.loaded.value?await this.types.refresh():(this.typeCount.value=void 0,await this.types.load(e))}async loadOthers(e){let t=this.#t===e&&this.others.value.value!==void 0;t||(this.others.reset(),this.roots.reset()),this.#t=e,await Promise.all([this.others.load(()=>this.#e.systemParts.call({system:e}),`Couldn't load what this system added.`,t),this.roots.load(()=>this.#e.exploreRoots.call({system:e}),`Couldn't load this system's resource roots.`,t)])}async switchContext(e,t){this.context.update(e,e=>({...e,disabled:!t}));let n=await this.switching.run(()=>this.#e.switchItem.call({section:`context`,name:e,on:t}),`Couldn't switch that.`);return n.ok||this.context.update(e,e=>({...e,disabled:t})),n.ok}close(){this.others.reset(),this.roots.reset(),this.#t=void 0,this.context.load(void 0),this.types.load(void 0),this.contextCount.value=void 0,this.typeCount.value=void 0}},gl=class{#e;#t;#n;list=new c;pairings=new c;query=z({});sorted=j(()=>{let e=this.list.value.value??[];return this.query.value.sort===void 0?jr(e):e});pending=j(()=>(this.pairings.value.value??[]).filter(e=>e.status===`pending`).length);answering=z(new Set);answer=new m;token=new m;install=new m;constructor(e,t){this.#e=e,this.#t=t}start(){this.#n??=this.#t(e=>{this.#i(e)})}stop(){this.#n?.(),this.#n=void 0}async load(e=!1){await Promise.all([this.#r(e),this.pairings.load(()=>this.#e.pairings.call({status:`pending`}),`Couldn't load pairing requests.`,e)])}async search(e){JSON.stringify(e)!==JSON.stringify(this.query.value)&&(this.query.value=e,await this.#r(!1))}async#r(e){let t=this.query.value;await this.list.load(()=>this.#e.systems.call(Object.keys(t).length===0?{}:{query:t}),`Couldn't load systems.`,e)}async answerPairing(e,t,n){this.answering.value=new Set([...this.answering.value,e]);let r=await this.answer.run(()=>this.#e.approvePairing.call({pairing:e,approve:t,...t?Yc(n):{}}),t?`Couldn't approve the pairing.`:`Couldn't reject the pairing.`);return this.answering.value=new Set([...this.answering.value].filter(t=>t!==e)),r.ok&&(this.pairings.set((this.pairings.value.value??[]).filter(t=>t.id!==e)),t&&this.#r(!0)),r}async createToken(e,t,n){return this.token.run(()=>this.#e.createPairingToken.call({expiresIn:t,...e===void 0?{}:{name:e},...Yc(n)}),`Couldn't make a pairing token.`)}async installSystem(e,t,n){let r=await this.install.run(()=>this.#e.installSystem.call({source:e,autoStart:t,...n===void 0?{}:{config:n}}),`Couldn't install the system.`);return r.ok&&this.load(!0),r}#i(e){if(e.type===`system`){let t=this.list.value.value;if(t===void 0)return;if(!t.some(t=>t.name===e.system)){this.load(!0);return}this.list.set(t.map(t=>t.name===e.system?{...t,status:e.status}:t))}else if(e.type===`pairing`){let t=e.pairing,n=(this.pairings.value.value??[]).filter(e=>e.id!==t.id);this.pairings.set(t.status===`pending`?[t,...n]:n)}}},_l=class{actors;systems;system;systemParts;review;models;roles;limits;policies;settings;runs;runApprovals;llm;modelCalls;fn;injected;itemInjected;instance;instanceParts;packages;mcps;mcp;mcpServers;apiServices;pairing;resources;fns;suggestions;classifier;images;autoPairs;people;constructor(e){let{api:t}=e;this.actors=new Zo(t),this.systems=new gl(t,e.userEvents),this.system=new ml(t,e.userEvents,e.systemLogs),this.systemParts=new hl(t),this.review=new dl(t),this.models=new $c(t),this.roles=new ll(t),this.limits=new Qc(t),this.policies=new ol(t),this.settings=new ul(t),this.runs=ns(t,e.chat),this.runApprovals=new Qo(e.chat),this.llm=rs(t,e.chat),this.modelCalls=is(t,e.chat),this.fn=new mi(t,e.userEvents),this.injected=new dr(t),this.itemInjected=new dr(t),this.instance=new os(t,e.userEvents),this.instanceParts=new gs(t,e.chat),this.packages=new rc(t,e.sender),this.mcps=new _s(t),this.mcp=new vs(t,e.probe),this.mcpServers=new Rs(t),this.apiServices=new Qs({fns:t.fns,records:e.data.records,saveRecord:e.data.saveRecord,removeRecord:e.data.removeRecord}),this.pairing=new Zc(t,e.userEvents),this.resources=as(t,e.chat),this.suggestions=new Jo(t),this.classifier=new Yo(t),this.images=new Xo(t),this.autoPairs=new qo(t),this.people=new sl(t),this.fns=new x({fetch:(e,n,r)=>t.fns.call({...e,limit:r,...n===void 0?{}:{cursor:n}}),key:e=>e.name,failure:`Couldn't load the fns.`,limit:50},{})}start(){this.systems.start(),this.systems.pairings.value.value===void 0&&this.systems.load(!0)}stop(){this.systems.stop(),this.system.close()}};function vl(e){return{systems:e.caller(`systems`,{dedupe:!0}),system:e.caller(`system`,{dedupe:!0}),pairings:e.caller(`pairings`,{dedupe:!0}),approvePairing:e.caller(`approvePairing`),createPairingToken:e.caller(`createPairingToken`),configureSystem:e.caller(`configureSystem`),enableSystem:e.caller(`enableSystem`),switchItem:e.caller(`switchItem`),switchPart:e.caller(`switchPart`),systemReview:e.caller(`systemReview`,{dedupe:!0}),goLive:e.caller(`goLive`),approveReview:e.caller(`approveReview`),rejectReview:e.caller(`rejectReview`),decideReview:e.caller(`decideReview`),testCall:e.caller(`testCall`),refusals:e.caller(`refusals`,{lastOnly:!0}),removeSystem:e.caller(`removeSystem`),installSystem:e.caller(`installSystem`),startSystem:e.caller(`startSystem`),stopSystem:e.caller(`stopSystem`),restartSystem:e.caller(`restartSystem`),upgradeSystem:e.caller(`upgradeSystem`),reimport:e.caller(`reimport`),systemFns:e.caller(`systemFns`,{dedupe:!0}),systemLogs:e.caller(`systemLogs`,{dedupe:!0}),systemParts:e.caller(`systemParts`,{dedupe:!0}),exploreRoots:e.caller(`exploreRoots`,{dedupe:!0}),providers:e.caller(`providers`,{dedupe:!0}),configureProvider:e.caller(`configureProvider`),models:e.caller(`models`,{dedupe:!0}),modelCategories:e.caller(`modelCategories`,{dedupe:!0}),setModelCategory:e.caller(`setModelCategory`),budgets:e.caller(`budgets`,{dedupe:!0}),setBudget:e.caller(`setBudget`),priorityRules:e.caller(`priorityRules`,{dedupe:!0}),setPriority:e.caller(`setPriority`),resolveLimits:e.caller(`resolveLimits`,{lastOnly:!0}),policies:e.caller(`policies`,{dedupe:!0}),setPolicy:e.caller(`setPolicy`),removeRule:e.caller(`removeRule`),actors:e.caller(`actors`,{dedupe:!0}),actorSettings:e.caller(`actorSettings`,{dedupe:!0}),setActorSetting:e.caller(`setActorSetting`),runs:e.caller(`runs`,{lastOnly:!0}),fns:e.caller(`fns`,{lastOnly:!0}),llmCalls:e.caller(`llmCalls`,{lastOnly:!0}),query:e.caller(`query`),resources:e.caller(`resources`,{lastOnly:!0}),modelRoles:e.caller(`modelRoles`,{dedupe:!0}),setModelRole:e.caller(`setModelRole`),clearModelRole:e.caller(`clearModelRole`),modelLimits:e.caller(`modelLimits`,{dedupe:!0}),setModelLimits:e.caller(`setModelLimits`),modelCalls:e.caller(`modelCalls`,{lastOnly:!0}),modelCall:e.caller(`modelCall`,{dedupe:!0}),fnMetrics:e.caller(`fnMetrics`,{dedupe:!0}),fnMetricsDays:e.caller(`fnMetricsDays`,{dedupe:!0}),mcps:e.caller(`mcps`,{dedupe:!0}),mcp:e.caller(`mcp`,{dedupe:!0}),createMcp:e.caller(`createMcp`),updateMcp:e.caller(`updateMcp`),rotateMcpSecret:e.caller(`rotateMcpSecret`),deleteMcp:e.caller(`deleteMcp`),previewMcp:e.caller(`previewMcp`,{lastOnly:!0}),mcpSessions:e.caller(`mcpSessions`,{dedupe:!0}),pairing:e.caller(`pairing`,{dedupe:!0}),instances:e.caller(`instances`,{dedupe:!0}),installPackage:e.caller(`installPackage`),removeInstance:e.caller(`removeInstance`),addInstance:e.caller(`addInstance`),readFn:e.caller(`readFn`),exportSystemData:e.caller(`exportSystemData`),autoPairs:e.caller(`autoPairs`,{dedupe:!0}),revokeAutoPair:e.caller(`revokeAutoPair`),suggestDecision:e.caller(`suggestDecision`,{dedupe:!0}),setSuggestDecision:e.caller(`setSuggestDecision`),previewSuggestions:e.caller(`previewSuggestions`,{lastOnly:!0}),searchDecisions:e.caller(`searchDecisions`,{dedupe:!0}),setSearchDecision:e.caller(`setSearchDecision`),injections:e.caller(`injections`,{lastOnly:!0}),setInjection:e.caller(`setInjection`),autoClassifier:e.caller(`autoClassifier`,{dedupe:!0}),setAutoClassifier:e.caller(`setAutoClassifier`),imageEmbedding:e.caller(`imageEmbedding`,{dedupe:!0}),setImageEmbedding:e.caller(`setImageEmbedding`),upload:e.caller(`upload`),uploaded:e.caller(`uploaded`),people:e.caller(`people`,{lastOnly:!0}),groups:e.caller(`groups`,{lastOnly:!0}),groupMembers:e.caller(`groupMembers`,{lastOnly:!0}),addUser:e.caller(`addUser`),addGroup:e.caller(`addGroup`),updateUser:e.caller(`updateUser`),setMembership:e.caller(`setMembership`),signInSettings:e.caller(`signInSettings`,{dedupe:!0}),setSignInPolicy:e.caller(`setSignInPolicy`),setSignInLimits:e.caller(`setSignInLimits`),setProxyTrust:e.caller(`setProxyTrust`),checkSsoProvider:e.caller(`checkSsoProvider`),testSsoSignIn:e.caller(`testSsoSignIn`),ssoTestResult:e.caller(`ssoTestResult`,{lastOnly:!0})}}function yl(e){return(t,n)=>e.on(`systemLog`,{system:t},n)}var bl=`connections`;function xl(e){return{connectPages:e.caller(`connectPages`,{cache:{ttl:3e4,tags:[bl]},dedupe:!0}),connect:e.caller(`connect`,{invalidates:[bl]}),updateConnection:e.caller(`updateConnection`,{invalidates:[bl]}),disconnect:e.caller(`disconnect`,{invalidates:[bl]})}}var Sl=`access`;function Cl(e){return{pick:e.caller(`pick`,{cache:{ttl:15e3},dedupe:!0}),accessInfo:e.caller(`accessInfo`,{cache:{ttl:6e4},dedupe:!0}),access:e.caller(`access`,{cache:{ttl:3e4,tags:[Sl]},dedupe:!0}),setAccess:e.caller(`setAccess`,{invalidates:[Sl]})}}var wl=`sessions`,Tl=`capabilities`;function El(e){return{capabilities:e.caller(`capabilities`,{cache:{ttl:6e4,tags:[Tl]},dedupe:!0}),types:e.caller(`types`,{cache:{ttl:3e5,tags:[Tl]},dedupe:!0}),sessions:e.caller(`sessions`,{cache:{ttl:5e3,tags:[wl]},dedupe:!0,lastOnly:!0}),searchSessions:e.caller(`sessions`,{debounce:250,lastOnly:!0}),session:e.caller(`session`,{dedupe:!0}),listValues:e.caller(`listValues`,{cache:{ttl:1e4},dedupe:!0}),createSession:e.caller(`createSession`,{invalidates:[wl]}),updateSession:e.caller(`updateSession`,{invalidates:[wl]}),deleteSession:e.caller(`deleteSession`,{invalidates:[wl]}),limits:e.caller(`limits`,{dedupe:!0}),messages:e.caller(`messages`,{dedupe:!0}),send:e.caller(`send`,{invalidates:[wl]}),invoke:e.caller(`invoke`),compare:e.caller(`compare`,{invalidates:[wl]}),compareView:e.caller(`compareView`,{lastOnly:!0}),chooseVariant:e.caller(`chooseVariant`,{invalidates:[wl]}),control:e.caller(`control`),controls:e.caller(`controls`,{dedupe:!0}),background:e.caller(`background`),undoTurn:e.caller(`undoTurn`),continueTurn:e.caller(`continueTurn`),tree:e.caller(`tree`,{dedupe:!0}),treeRefresh:e.caller(`tree`,{debounce:400,lastOnly:!0}),run:e.caller(`run`,{dedupe:!0}),llmCall:e.caller(`llmCall`,{cache:{ttl:3e5},dedupe:!0}),suggest:e.caller(`suggest`,{debounce:700,lastOnly:!0}),mentions:e.caller(`mentions`),mentionHover:e.caller(`mentionHover`,{cache:{ttl:3e4},dedupe:!0}),waiting:e.caller(`waiting`),approve:e.caller(`approve`),approvals:e.caller(`approvals`,{dedupe:!0}),contributions:e.caller(`contributions`,{cache:{ttl:6e4,tags:[Tl]},dedupe:!0}),setBudget:e.caller(`setBudget`),answer:e.caller(`answer`),presence:e.caller(`presence`),resource:e.caller(`resource`,{cache:{ttl:3e4},dedupe:!0}),upload:e.caller(`upload`),uploaded:e.caller(`uploaded`),transcribe:e.caller(`transcribe`),act:e.caller(`act`),submit:e.caller(`submit`),state:e.caller(`state`,{dedupe:!0}),previewSelection:e.caller(`previewSelection`,{lastOnly:!0}),...Cl(e),...xl(e)}}function Dl(e){return(t,n)=>e.on(`session`,{session:t},n)}var Ol=class{put(e,t,n,r){return new Promise((i,a)=>{let o=new XMLHttpRequest;o.open(`PUT`,e),t.type!==``&&o.setRequestHeader(`content-type`,t.type),o.upload.onprogress=e=>{e.lengthComputable&&e.total>0&&n(e.loaded/e.total)},o.onload=()=>{o.status>=200&&o.status<300?(n(1),i()):a(Error(`Upload failed (${o.status}).`))},o.onerror=()=>{a(Error(`Upload failed.`))},o.onabort=()=>{a(new DOMException(`Upload cancelled.`,`AbortError`))},r.addEventListener(`abort`,()=>{o.abort()},{once:!0}),o.send(t)})}};function kl(e){return{setup:e.caller(`setup`,{cache:{ttl:5e3},dedupe:!0}),createAdmin:e.caller(`createAdmin`),signIn:e.caller(`signIn`),refresh:e.caller(`refresh`),redeemSso:e.caller(`redeemSso`),signOut:e.caller(`signOut`),me:e.caller(`me`,{dedupe:!0}),account:e.caller(`account`,{dedupe:!0})}}var Al={transport:`http`};function jl(e){return{identity:e.caller(`identity`,{dedupe:!0}),setHubName:e.caller(`setHubName`)}}function Ml(e){return{outsideImages:e.caller(`outsideImages`,{dedupe:!0}),setOutsideImages:e.caller(`setOutsideImages`)}}function Nl(e){return{https:e.caller(`https`,{dedupe:!0}),setHttps:e.caller(`setHttps`)}}var Pl=`inbox`;function Fl(e){return{list:e.caller(`notifications`,{cache:{ttl:1e4,tags:[Pl]},dedupe:!0}),markRead:e.caller(`readNotifications`,{invalidates:[Pl],retry:{attempts:3}}),pushKey:e.caller(`pushKey`,{cache:{ttl:36e5},dedupe:!0}),subscribePush:e.caller(`subscribePush`,{retry:{attempts:3}})}}function Il(e,t){return n=>{let r,i=w(t,t=>{r?.(),r=t===void 0?void 0:e.on(`user`,{user:t},n)},{immediate:!0});return()=>{i(),r?.()}}}function Ll(e){return{browse:e.caller(`browseResources`,{lastOnly:!0}),browseGroup:e.caller(`browseResources`),find:e.caller(`browseResources`,{lastOnly:!0}),forms:e.caller(`resourceForms`,{dedupe:!0}),read:e.caller(`readResource`,{dedupe:!0}),convert:e.caller(`convertResource`),download:e.caller(`downloadResource`,{dedupe:!0}),importResource:e.caller(`importResource`),rename:e.caller(`renameResource`),remove:e.caller(`deleteResource`),contextFrom:e.caller(`contextFromResource`),upload:e.caller(`upload`),uploaded:e.caller(`uploaded`),systemRead:e.caller(`resource`,{dedupe:!0}),exploreRoots:e.caller(`exploreRoots`,{lastOnly:!0}),exploreList:e.caller(`exploreList`),exploreRead:e.caller(`exploreRead`,{lastOnly:!0})}}function Rl(e){return t=>e(e=>{e.type===`resource`&&t({uri:e.uri,forms:e.forms})})}function zl(e){return{list:e.caller(`contexts`,{lastOnly:!0}),item:e.caller(`contextItem`,{dedupe:!0}),remember:e.caller(`remember`),updateMemory:e.caller(`updateMemory`),forget:e.caller(`forget`),link:e.caller(`linkContext`),unlink:e.caller(`unlinkContext`),fromResource:e.caller(`contextFromResource`)}}function Bl(e){return t=>e(e=>{e.type===`context`&&t(e.name)})}function Vl(e){return{searchFns:e.caller(`searchFns`,{cache:{ttl:3e4},dedupe:!0}),fnFacts:e.caller(`fnFacts`,{dedupe:!0}),fnExamples:e.caller(`fnExamples`,{dedupe:!0}),fnsOfModelNames:e.caller(`fnsOfModelNames`,{dedupe:!0})}}function Hl(e){return{graph:e.caller(`graph`,{lastOnly:!0})}}var Ul=`records`;function Wl(e){return{dataSets:e.caller(`dataSets`,{cache:{ttl:1e4,tags:[Ul]},dedupe:!0,lastOnly:!0}),records:e.caller(`records`,{dedupe:!0,lastOnly:!0}),recordTable:e.caller(`recordTable`,{lastOnly:!0}),record:e.caller(`record`,{dedupe:!0}),saveRecord:e.caller(`saveRecord`,{invalidates:[Ul]}),removeRecord:e.caller(`removeRecord`,{invalidates:[Ul]}),recordVersions:e.caller(`recordVersions`,{dedupe:!0}),rowActions:e.caller(`rowActions`,{cache:{ttl:3e4},dedupe:!0}),readFn:e.caller(`readFn`),exportCsv:e.caller(`export`),itemVersions:e.caller(`itemVersions`,{dedupe:!0})}}function Gl(e){return{systemPages:e.caller(`systemPages`,{dedupe:!0})}}function Kl(e,t){let n=Il(e,t);return{auth:kl(e),identity:jl(e),outsideImages:Ml(e),https:Nl(e),notifications:Fl(e),userEvents:n,chat:El(e),sessionEvents:Dl(e),admin:vl(e),systemLogs:yl(e),resources:Ll(e),resourceEvents:Rl(n),context:zl(e),fns:Vl(e),graph:Hl(e),data:Wl(e),pages:Gl(e),contextEvents:Bl(n),connection:e.connection}}var ql=class{#e;multiUser=R(!1);saving=new m;#t=!1;constructor(e){this.#e=e}async load(){if(!this.#t){this.#t=!0;try{this.multiUser.value=(await this.#e.accessInfo.call({})).multiUser}catch{this.#t=!1}}}view(e){let t=new c;return t.load(async()=>{let[t]=await this.#e.access.call({targets:[e]});if(t===void 0)throw Error(`The hub did not say who can use this.`);return t},`Couldn’t load who can use this.`),t}async set(e,t){return this.saving.run(()=>this.#e.setAccess.call({target:e,sharing:t}),`Couldn’t change who can use this.`)}};function Jl(e,t){let n=[...e.connections].sort((e,t)=>t.updatedAt-e.updatedAt);return{own:n.find(e=>e.owner===t),shared:n.filter(e=>e.owner!==t)}}function Yl(e,t){return Object.entries(e.decl.fns).map(([n,r])=>{let i=t?.fns[n],a=i??r;return{local:n,name:`${e.system}/${n}`,option:a,changed:i!==void 0&&(i.on!==r.on||i.ask!==r.ask)}})}function Xl(e,t,n){return Object.fromEntries(e.map(e=>[e.local,e.local===t?{...e.option,...n}:e.option]))}var Zl={pending:{label:`Waiting for sign-in`,tone:`warn`},connected:{label:`Connected`,tone:`ok`},expired:{label:`Expired`,tone:`warn`},failed:{label:`Failed`,tone:`danger`}},Ql=e=>e in St;function $l(e){let t=e.decl.icon;return t!==void 0&&Ql(t)?t:`link`}function eu(e){return e.map(e=>({system:e.system,title:e.decl.title,icon:$l(e)})).sort((e,t)=>e.title.localeCompare(t.title))}var tu=e=>e.name===`optional`?e.generic?.T??e:e,nu=e=>{let t=e.replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)};function ru(e,t){let n=e.name===`obj`?e.props:void 0;if(n===void 0||t===void 0)return;let r=Object.entries(n).map(([e,n])=>{let r=t[e];if(r!==void 0)return{key:e,label:nu(e),hint:n.docs??``,many:tu(n.type).name===`list`,options:r}});return r.every(e=>e!==void 0)&&r.length>0?r:void 0}function iu(e,t){let n=typeof e==`object`&&e&&!Array.isArray(e)?e[t]:void 0;return Array.isArray(n)?n.filter(e=>typeof e==`string`):typeof n==`string`?[n]:[]}function au(e,t){return Object.fromEntries(e.flatMap(e=>{let n=t[e.key]??[];return n.length===0?[]:[[e.key,e.many?[...n]:n[0]??``]]}))}function ou(e,t){return`key`in t?e.key===t.key:e.instance===t.instance}function su(e){return e.decl.scope===`instance`||e.decl.scope===`key`}function cu(e,t,n){let r=[...e.connections].sort((e,t)=>t.updatedAt-e.updatedAt);return[...(e.instances??[]).map(e=>({target:{instance:e.instance},id:e.instance,label:e.label,connect:e.connect})),...(e.keys??[]).map(e=>({target:{key:e.key},id:e.key,label:e.label,connect:e.connect,host:e.host}))].map(e=>{let i=r.filter(t=>ou(t,e.target)),a=e.connect.flow?.flow??`none`;return{...e,own:i.find(e=>e.owner===t),shared:i.filter(e=>e.owner!==t),flow:a,mayConnect:a!==`none`&&(!e.connect.share||n)}}).sort((e,t)=>e.label.localeCompare(t.label))}var lu=class{#e;pages=new c;saving=new m;nav=j(()=>eu(this.pages.value.value??[]));constructor(e){this.#e=e}async load(e=!1){await this.pages.load(()=>this.#e.connectPages.call({}),`Couldn’t load the connect pages.`,e)}page(e){return this.pages.value.value?.find(t=>t.system===e)}async connect(e,t,n){let r={system:e,...t===void 0?{}:{form:t},...n},i=await this.saving.run(()=>this.#e.connect.call(r),`Couldn’t start connecting.`);return i.ok&&`connection`in i.value&&this.#t(i.value.connection),i}async update(e){let t=await this.saving.run(()=>this.#e.updateConnection.call(e),`Couldn’t save the change.`);return t.ok&&this.#t(t.value),t}async disconnect(e){let t=await this.saving.run(async()=>(await this.#e.disconnect.call({connection:e})).ok,`Couldn’t disconnect.`);return t.ok&&this.#n(e),t}#t(e){this.#r(e.system,t=>[e,...t.filter(t=>t.id!==e.id)])}#n(e){let t=this.pages.value.value?.find(t=>t.connections.some(t=>t.id===e));t!==void 0&&this.#r(t.system,t=>t.filter(t=>t.id!==e))}#r(e,t){let n=this.pages.value.value;n!==void 0&&this.pages.set(n.map(n=>n.system===e?{...n,connections:t(n.connections)}:n))}},uu=class{#e;#t=new Map;#n;constructor(e){this.#e=e}source(e){let t=this.#t.get(e);if(t!==void 0)return t;let n={search:async t=>this.#e.pick.call({source:e,limit:12,...t===``?{}:{text:t}}),label:async t=>t.length===0?[]:this.#e.pick.call({source:e,values:[...t]})};return this.#t.set(e,n),n}people(){if(this.#n!==void 0)return this.#n;let e=this.source(`person`),t=this.source(`group`);return this.#n={search:async n=>(await Promise.all([e.search(n),t.search(n)])).flat(),label:async n=>du(n,await Promise.all([e.label(n),t.label(n)]))},this.#n}};function du(e,t){let n=t.flat();return e.map(e=>n.find(t=>t.value===e&&t.missing!==!0)??{value:e,label:e,missing:!0})}var fu=class{#e;#t;#n;#r=0;value=z(void 0);session=R(void 0);problem=R(``);can=j(()=>{let e=this.value.value;return{mention:(e?.mentions.length??0)>0,command:(e?.commands.length??0)>0,invoke:(e?.invocations.length??0)>0,upload:e?.uploads===!0,voice:e?.voiceInput===!0}});constructor(e,t){this.#e=e,this.#t=t}start(){this.#n===void 0&&(this.#n=this.#t(e=>{this.#i(e)}))}stop(){this.#n?.(),this.#n=void 0}async load(e=this.session.value){this.session.value=e;let t=++this.#r;try{let n=await this.#e.capabilities.call(e===void 0?{}:{session:e});if(t!==this.#r)return;this.value.value=n,this.problem.value=``}catch(e){t===this.#r&&(this.problem.value=J(e,`Couldn't load what this chat can do.`))}}online(e){return this.value.value?.systems.find(t=>t.name===e)?.status===`connected`}invocation(e){return this.value.value?.invocations.find(t=>t.fn===e)}commandFor(e){return this.value.value?.commands.find(t=>t.context===e)}#i(e){if(e.type===`capabilities`)this.#e.capabilities.invalidate(),this.load();else if(e.type===`system`){let t=this.value.value;if(t===void 0)return;this.value.value={...t,systems:t.systems.map(t=>t.name===e.system?{...t,status:e.status}:t)}}}},pu=`harness.runCards`,mu=on([Bn,Pn()]);function hu(e){return e.status===`done`&&e.outcome?.status===`done`&&qr(e.outcome.result)?!1:e.status===`done`||e.status===`undone`}var gu=class{#e;constructor(e){this.#e=Dr(e,pu,fn(mu),[])}choice(e){return this.#e.value.find(([t])=>t===e)?.[1]}isCollapsed(e){return this.choice(e.id)??hu(e)}set(e,t){this.setAll([e],t)}setAll(e,t){let n=new Set(e),r=this.#e.value.filter(([e])=>!n.has(e));this.#e.value=[...r,...e.map(e=>[e,t])].slice(-500)}};async function _u(e,t,n,r,i){let a=n.outgoing();if(a===void 0)return{ok:!1,problem:`Write the message to compare first.`};let o=n.snapshot();n.clear(`keep`);try{let o=await e.compare.call({session:t.id,parts:[...a.parts],variants:[...r],client:i});return t.messages.value=ze(t.messages.value,o.message),n.uploads.clear(),{ok:!0,value:o.turn}}catch(e){return n.restore(o),{ok:!1,problem:J(e,`Couldn’t start the compare. Your message is back in the box.`)}}}function vu(e,t){let n=setTimeout(e,t);return()=>{clearTimeout(n)}}var yu=class{view=new c;streamed=z(new Map);choosing=new m;deciding=new m;turn;#e;#t;#n=new Map;#r;constructor(e,t,n){this.#t=e,this.#e=t,this.turn=n}async open(){this.#i(this.#e),await this.view.load(()=>this.#t.api.compareView.call({turn:this.turn}),`Couldn’t load the compare.`);for(let e of this.view.value.value?.variants??[])this.#i(e.session)}close(){for(let e of this.#n.values())e();this.#n.clear(),this.#r?.(),this.#r=void 0}async choose(e,t){let n=await this.choosing.run(()=>this.#t.api.chooseVariant.call({turn:this.turn,variant:e,adopt:t}),`Couldn’t use that answer.`);return n.ok&&this.view.set(n.value),n}async decide(e,t,n,r,i){let a=await this.deciding.run(()=>this.#t.api.approve.call({approval:e,approve:t,remember:n,...r===``?{}:{reason:r},...i===void 0?{}:{answer:i}}),`Couldn’t answer that.`);return a.ok&&this.#o(),a.ok}#i(e){this.#n.has(e)||this.#n.set(e,this.#t.events(e,t=>{this.#a(e,t)}))}#a(e,t){switch(t.type){case`compare`:t.turn===this.turn&&this.#o();return;case`token`:case`reasoning`:{if(e===this.#e)return;let n=new Map(this.streamed.value),r=n.get(t.message)??{text:``,reasoning:``};n.set(t.message,t.type===`token`?{...r,text:r.text+t.text}:{...r,reasoning:r.reasoning+t.text}),this.streamed.value=n;return}case`message`:case`approval`:case`run`:e!==this.#e&&this.#o();return;case`controls`:case`state`:case`delivery`:case`handler`:case`budget`:case`presence`:case`session`:case`cite`:return}}#o(){this.#r?.(),this.#r=(this.#t.later??vu)(()=>{this.#r=void 0,this.view.load(()=>this.#t.api.compareView.call({turn:this.turn}),`Couldn’t load the compare.`,!0).then(()=>{this.streamed.value=new Map})},300)}},bu=e=>`harness.draft.${e}`,xu=K({text:G(),mentions:fn(Gn).transform(e=>e.filter(e=>e.type===`mention`)),replyTo:Yn.optional(),replyAll:Pn()}),Su={delay:120,perProvider:6,max:24},Cu=(e,t)=>e.provider===t.provider&&JSON.stringify(e.target)===JSON.stringify(t.target),wu=(e,...t)=>{let n=e.toLowerCase();return n===``||t.some(e=>e.toLowerCase().includes(n))},Tu=class{session;uploads;#e;#t;#n;#r;#i=0;#a;text=R(``);caret=R(0);mentions=z([]);replyTo=R(void 0);replyAll=R(!1);editing=R(void 0);invoking=z(void 0);caretRequest=R(void 0);pickerItems=z([]);pickerActive=R(0);pickerLoading=R(!1);#o=R(void 0);trigger=j(()=>{let e=Ie(this.text.value,this.caret.value),t=this.#e.capabilities();if(e!==void 0&&t!==void 0)return(e.kind===`mention`?t.mentions.length>0:e.kind===`command`?t.commands.length>0:t.invocations.length>0)?e:void 0});pickerOpen=j(()=>{let e=this.trigger.value;return e!==void 0&&this.#o.value!==`${e.kind}:${e.start}`});hint=j(()=>Qe(this.text.value,this.#e.capabilities()?.commands??[]));canSend=j(()=>!this.uploads.busy.value&&(this.text.value.trim()!==``||this.uploads.parts.value.length>0));constructor(e,t=Su){this.session=e.session,this.uploads=e.uploads,this.#e=e,this.#t=t,this.#n=Dr(e.store,bu(e.session),xu.optional(),void 0);let n=this.#n.value;n!==void 0&&(this.text.value=n.text,this.caret.value=n.text.length,this.mentions.value=n.mentions,this.replyTo.value=n.replyTo,this.replyAll.value=n.replyAll),w([this.text,this.mentions,this.replyTo,this.replyAll],()=>{this.#c()}),w(()=>[this.trigger.value?.kind,this.trigger.value?.query,this.trigger.value?.start],()=>{this.#l()})}input(e,t){this.text.value=e,this.caret.value=t,this.mentions.value=Ne(e,this.mentions.value)}moveCaret(e){this.caret.value=e}movePicker(e){let t=this.pickerItems.value.length;t!==0&&(this.pickerActive.value=(this.pickerActive.value+e+t)%t)}dismissPicker(){let e=this.trigger.value;e!==void 0&&(this.#o.value=`${e.kind}:${e.start}`)}pick(e=this.pickerItems.value[this.pickerActive.value]){let t=this.trigger.value;if(e!==void 0&&t!==void 0){if(e.kind===`mention`){let n={type:`mention`,provider:e.provider,label:e.option.label,target:e.option.target},r=this.mentions.value.find(e=>Cu(e,n)),i=r??n;this.#s(t,`${Me(i)} `),r===void 0&&(this.mentions.value=[...this.mentions.value,i])}else if(e.kind===`command`){if(e.command.unavailable!==void 0)return;this.#s(t,`/${e.command.name} `)}else this.#s(t,``),this.invoking.value=e.invocation}}openInvocation(e,t){this.invoking.value=e,this.#a=t}closeInvocation(){this.invoking.value=void 0,this.#a=void 0}invocationArgs(e){return this.#a===void 0?e:Xe(e,this.#a)}insert(e){let t=this.caret.value,n=this.text.value.slice(0,t),r=n===``||/\s$/.test(n)?e:` ${e}`,i=Pe(this.text.value,t,t,r);this.text.value=i.text,this.caret.value=i.caret,this.caretRequest.value=i.caret}replace(e){this.text.value=e,this.caret.value=e.length,this.caretRequest.value=e.length,this.mentions.value=Ne(e,this.mentions.value)}setReply(e){this.replyTo.value=e}outgoing(){if(!this.canSend.value)return;let e=[...Ze(this.text.value,this.mentions.value,this.#e.capabilities()?.commands??[]),...this.uploads.parts.value];if(e.length!==0)return{parts:e,replyTo:this.replyTo.value,replyAll:this.replyAll.value}}startEdit(e,t,n){this.editing.value=e,this.replyTo.value=void 0,this.mentions.value=n,this.replace(t)}cancelEdit(){this.editing.value=void 0,this.clear()}snapshot(){return{editing:this.editing.value,text:this.text.value,mentions:this.mentions.value,replyTo:this.replyTo.value,replyAll:this.replyAll.value}}restore(e){this.editing.value=e.editing,this.text.value=e.text,this.caret.value=e.text.length,this.mentions.value=e.mentions,this.replyTo.value=e.replyTo,this.replyAll.value=e.replyAll}clear(e=`clear`){this.text.value=``,this.caret.value=0,this.caretRequest.value=0,this.mentions.value=[],this.replyTo.value=void 0,this.editing.value=void 0,e===`clear`&&this.uploads.clear()}dispose(){clearTimeout(this.#r),this.uploads.clear()}#s(e,t){let n=Pe(this.text.value,e.start,e.end,t);this.text.value=n.text,this.caret.value=n.caret,this.caretRequest.value=n.caret}#c(){let e=this.text.value===``&&this.replyTo.value===void 0&&!this.replyAll.value;this.#n.value=e?void 0:{text:this.text.value,mentions:[...this.mentions.value],replyAll:this.replyAll.value,...this.replyTo.value===void 0?{}:{replyTo:this.replyTo.value}}}#l(){clearTimeout(this.#r);let e=++this.#i;this.pickerActive.value=0;let t=this.trigger.value,n=this.#e.capabilities();t===void 0||n===void 0?(this.pickerItems.value=[],this.pickerLoading.value=!1):t.kind===`command`?this.pickerItems.value=n.commands.filter(e=>wu(t.query,e.name,e.description)).slice(0,this.#t.max).map(e=>({kind:`command`,key:`c:${e.context}:${e.name}`,command:e})):t.kind===`invoke`?this.pickerItems.value=n.invocations.filter(e=>wu(t.query,e.fn,ln(e.fn),e.description)).slice(0,this.#t.max).map(e=>({kind:`invoke`,key:`i:${e.fn}`,invocation:e})):(this.pickerLoading.value=!0,this.#r=setTimeout(()=>{this.#u(t.query,n.mentions,e)},this.#t.delay))}async#u(e,t,n){let r=await Promise.all(t.map(async t=>{try{return(await this.#e.api.mentions.call({session:this.session,provider:t.provider,query:e})).slice(0,this.#t.perProvider).map((e,n)=>({kind:`mention`,key:`m:${t.provider}:${n}:${e.label}`,provider:t.provider,group:t.title,option:e}))}catch{return[]}}));n===this.#i&&(this.pickerItems.value=r.flat().slice(0,this.#t.max),this.pickerLoading.value=!1)}},Eu=class{#e;run=new c;tree=new c;treeTurn=R(void 0);resource=new c;calls=z(new Map);callProblems=z(new Map);constructor(e){this.#e=e}async openRun(e){this.run.value.value?.id!==e&&this.run.reset(),await this.run.load(()=>this.#e.run.call({run:e}),`Couldn't load this run.`,this.run.value.value?.id===e)}async openResource(e){this.resource.value.value?.stat.uri!==e&&this.resource.reset(),await this.resource.load(()=>this.#e.resource.call({uri:e,want:[`text`,`links`]}),`Couldn't open this.`)}async openTree(e){this.treeTurn.value!==e&&this.tree.reset(),this.treeTurn.value=e,await this.tree.load(()=>this.#e.tree.call({turn:e}),`Couldn't load this turn's tree.`)}refreshTree(){let e=this.treeTurn.value;e!==void 0&&this.tree.load(()=>this.#e.treeRefresh.call({turn:e}),`Couldn't refresh this turn's tree.`,!0)}closeTree(){this.#e.treeRefresh.cancel(),this.treeTurn.value=void 0,this.tree.reset()}async loadCalls(e){let t=[...new Set(e)].filter(e=>!this.calls.value.has(e));await Promise.all(t.map(async e=>{try{let t=await this.#e.llmCall.call({id:e}),n=new Map(this.calls.value);n.set(e,t),this.calls.value=n}catch(t){let n=new Map(this.callProblems.value);n.set(e,J(t,`Couldn't load this LLM call.`)),this.callProblems.value=n}}))}async loadTurn(e){await this.openTree(e);let t=this.tree.value.value;if(t===void 0)return[];let n=b(t);return await this.loadCalls(n),n.flatMap(e=>{let t=this.calls.value.get(e);return t===void 0?[]:[t]})}dispose(){this.#e.treeRefresh.cancel()}},Du=(e,t)=>`${e}:${JSON.stringify(t)}`,Ou=class{#e;cards=z(new Map);constructor(e){this.#e=e}card(e,t){return this.cards.value.get(Du(e,t))??{loading:!0,hover:void 0,problem:``}}async load(e,t,n){let r=Du(t,n),i=this.cards.value.get(r);if(i===void 0||!i.loading&&i.problem!==``){this.#t(r,{loading:!0,hover:void 0,problem:``});try{let{hover:i}=await this.#e.mentionHover.call({session:e,provider:t,target:n});this.#t(r,{loading:!1,hover:i,problem:``})}catch(e){this.#t(r,{loading:!1,hover:void 0,problem:J(e,`Not available right now.`)})}}}#t(e,t){let n=new Map(this.cards.value);n.set(e,t),this.cards.value=n}},ku=Symbol.for(`harness.shared`);function Au(e){Reflect.set(globalThis,ku,{vue:e.vue,"@harness/sdk":e.sdk})}function ju(e){return typeof e==`object`&&!!e&&`system`in e&&typeof e.system==`string`&&`renderers`in e&&typeof e.renderers==`object`&&e.renderers!==null&&`contract`in e&&typeof e.contract==`object`&&e.contract!==null}function Mu(e){return typeof e==`object`&&`component`in e&&`mode`in e}function Nu(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]))}function Z(e){let t=e.indexOf(`/`);return{system:e.slice(0,t),local:e.slice(t+1)}}function Pu(e,t){if(e===void 0)return{};if(!(e instanceof Jt)){let n=a(e,t);return typeof n==`object`&&n?{...n}:{}}let n=e.fields;return Object.fromEntries(Object.entries(t).flatMap(([e,t])=>{let r=n[e];return r===void 0?[]:[[e,a(r.type,t)]]}))}function Fu(e){let t=e.renderers;return{renderers:{fns:t.fns??{},kinds:t.kinds??{},attachments:t.attachments??{},inputs:t.inputs??{},mentions:t.mentions??{},resultFns:t.results?.fns??{},resultKinds:t.results?.kinds??{}},config:Iu(e),pages:Lu(e),actions:e.contract.defs.actions,fns:e.contract.defs.fns,forms:Object.fromEntries(Object.entries(e.contract.defs.fns).map(([e,t])=>[e,t.form])),attachments:Nu(e.contract.defs.attachments,e=>e.data),types:Nu(e.contract.defs.types,e=>e.shape),mentions:Nu(e.contract.defs.mentions,e=>e.target)}}function Iu(e){let t=e.contract.configComponent,n=t===void 0?void 0:e.renderers.configs?.[t.component];return t===void 0||n===void 0?void 0:{component:n,mode:t.mode,type:e.contract.defs.config}}function Lu(e){let t=e.renderers.pages??{};return new Map(e.contract.pages.flatMap(e=>{let n=t[e.component];return n===void 0?[]:[[e.segment,{decl:e,component:n}]]}))}var Ru=class{#e=new Map;#t;#n=new Map;#r=new Map;#i=new Map;constructor(e){this.#t=e}register(e){this.#n.set(e.system,Fu(e));for(let t of this.#i.keys())(t===e.system||t.startsWith(`${e.system} `))&&this.#i.delete(t);for(let[t,n]of this.#r)this.#r.set(t,n.filter(t=>t.system!==e.system));for(let[t,n]of this.#e)this.#e.set(t,n.filter(t=>t.system!==e.system));for(let[t,n]of Object.entries(e.renderers.visuals??{})){let r=tn.parse(t),i=Object.entries(n).flatMap(([t,n])=>{let i=e.contract.contributes.find(e=>e.registry===r&&e.name===t);return i?.shape===void 0?[]:[{system:e.system,name:t,label:i.label,icon:i.icon,shape:i.shape,veto:(e,t)=>n.veto?.(e,t),component:n.component}]});this.#e.set(r,[...this.#e.get(r)??[],...i])}let t=e.renderers.resources??{};for(let[n,r]of Object.entries(t)){let t=Mu(r)?{component:r.component,system:e.system,mode:r.mode,label:r.label??e.system}:{component:r,system:e.system,mode:`replace`,label:e.system};this.#r.set(n,[...this.#r.get(n)??[],t])}}async load(e){let t=await import(e),n=typeof t==`object`&&t&&`default`in t?t.default:void 0;if(!ju(n))throw Error(`${e} is not a system client module (its default export should be client(contract, renderers)).`);return this.register(n),n}visuals(e,t,n){return(this.#e.get(e)??[]).flatMap(r=>{let i;try{i=r.veto(t,n)}catch(t){return console.warn(`client.visual.veto-failed`,{registry:e,system:r.system,name:r.name,error:t}),[]}return i===void 0?[{system:r.system,name:r.name,label:r.label,...r.icon===void 0?{}:{icon:r.icon},shape:r.shape,component:r.component,client:this.systemClient(r.system)}]:[]})}systems(){return[...this.#n.keys()]}fnRenderer(e,t){return this.#s(e,`fns`)??(t===void 0?void 0:this.#s(t,`kinds`))}attachmentRenderer(e){return this.#s(e,`attachments`)}inputRenderer(e){return this.#s(e,`inputs`)}mentionRenderer(e){return this.#s(e,`mentions`)}resourceViewers(e){return this.#r.get(e)??[]}resourceViewer(e){return this.#a(e)?.component}viewerSystem(e){return this.#a(e)?.system}#a(e){return this.resourceViewers(e).find(e=>e.mode===`replace`)}systemClient(e,t){let n=t===void 0?e:`${e} ${t}`,r=this.#i.get(n);if(r!==void 0)return r;let i=this.#n.get(e),s=this.#t,c=t===void 0?{}:{run:t},l={get online(){return s.online(e)},send:Object.fromEntries(Object.entries(i?.actions??{}).map(([t,n])=>[t,r=>this.#c(e=>a(n.returns,e),()=>s.act({system:e,action:t,input:o(n.input,r),...c}))])),run:Object.fromEntries(Object.entries(i?.fns??{}).map(([t,n])=>[t,r=>Promise.resolve().then(()=>s.invoke({fn:kn(e,t),args:o(n.args,r)}))]))};return this.#i.set(n,l),l}submit(e,t,n){let r=o(t,n);return this.#c(()=>void 0,()=>this.#t.submit({run:e,value:r}))}formSubmit(e,t){let{system:n,local:r}=Z(e),i=this.#n.get(n)?.forms[r];return i===void 0?void 0:e=>this.submit(t,i,e)}fnView(e){let{fn:t,kind:n,args:r,result:i,state:o,...s}=e,c=this.#s(t,`fns`),l={...s,submit:this.formSubmit(t,e.run)};if(c!==void 0){let{system:n,local:s}=Z(t),u=this.#n.get(n)?.fns[s];if(u===void 0)return;let d=this.#o(t,()=>({args:a(u.args,r),state:Pu(u.state,o),...i===void 0?{}:{result:a(u.returns,i)}}));return d===void 0?void 0:{component:c,props:{...l,...d,system:this.systemClient(n,e.run)}}}let u=n===void 0?void 0:this.#s(n,`kinds`);if(n!==void 0&&u!==void 0)return{component:u,props:{...l,args:r,state:o,...i===void 0?{}:{result:i},system:this.systemClient(Z(n).system,e.run)}}}resultView(e){let{kind:t,args:n,result:r,...i}=e,o=this.#s(e.fn,`resultFns`);if(o!==void 0){let{system:t,local:s}=Z(e.fn),c=this.#n.get(t)?.fns[s];if(c===void 0)return;let l=this.#o(e.fn,()=>({args:a(c.args,n),result:a(c.returns,r)}));return l===void 0?void 0:{component:o,props:{...i,...l,system:this.systemClient(t,e.run)}}}let s=t===void 0?void 0:this.#s(t,`resultKinds`);if(t!==void 0&&s!==void 0)return{component:s,props:{...i,args:n,result:r,system:this.systemClient(Z(t).system,e.run)}}}attachmentView(e){let t=this.#s(e.attachment,`attachments`),{system:n,local:r}=Z(e.attachment),i=this.#n.get(n)?.attachments[r];if(t===void 0||i===void 0)return;let o=this.#o(e.attachment,()=>a(i,e.data));return o===void 0?void 0:{component:t,props:{data:o,title:e.title,system:this.systemClient(n)}}}mentionView(e){let t=this.#s(e.provider,`mentions`),{system:n,local:r}=Z(e.provider),i=this.#n.get(n)?.mentions[r];if(t===void 0||i===void 0)return;let o=this.#o(e.provider,()=>a(i,e.target));return o===void 0?void 0:{component:t,props:{label:e.label,target:o,hover:e.hover,system:this.systemClient(n)}}}inputView(e){let t=this.#s(e,`inputs`),{system:n,local:r}=Z(e),i=this.#n.get(n)?.types[r];if(t!==void 0&&i!==void 0)return{component:t,props:{system:this.systemClient(n)},decode:t=>t===void 0?void 0:this.#o(e,()=>a(i,t)),encode:t=>t===void 0?void 0:this.#o(e,()=>o(i,t))}}configView(e,t){let n=this.#n.get(e)?.config;if(n===void 0)return;let r=kn(e,`config`),i=n.type;return{component:n.component,mode:n.mode,props:{config:t.config===void 0?void 0:this.#o(r,()=>a(i,t.config)),type:i,validate:e=>Promise.resolve().then(()=>t.validate(o(i,e))),change:e=>{t.change(o(i,e))},system:this.systemClient(e)}}}pages(e){return[...this.#n.get(e)?.pages.values()??[]].map(e=>e.decl)}pageView(e,t,n){let r=this.#n.get(e)?.pages.get(t);return r===void 0?void 0:{component:r.component,props:{...n,page:t,system:this.systemClient(e)}}}#o(e,t){try{return t()}catch(t){console.warn(`client.view.unfit`,{name:e,error:t});return}}#s(e,t){let{system:n,local:r}=Z(e);return this.#n.get(n)?.renderers[t][r]}#c(e,t){let n=this.#t,r=Se({id:void 0,status:dn.enum.queued}),i=t().then(async t=>(r.id=t,e(await n.follow(t,e=>{r.status=e}))));return i.catch(()=>void 0),{get id(){return r.id},get status(){return r.status},result:i}}},zu=class{runtime;#e;#t=new Map;#n;status=z(new Map);version=z(0);constructor(e){this.#e=e;let t={online:t=>e.online(t),act:({system:e,action:t,input:n,run:r})=>Promise.resolve().then(()=>this.#i().act(bn.parse(e),t,n,r)),submit:async({run:e,value:t})=>{let n=await this.#i().submit(e,t);if(n===void 0)throw Error(`Couldn't submit that.`);return n},invoke:async({fn:e,args:t})=>{let n=await this.#i().invoke(e,t);if(n===void 0)throw Error(`Couldn't run that.`);return n},follow:(e,t)=>Promise.resolve().then(()=>this.#i().follow(e,t))};this.runtime=new Ru(t)}async sync(e){let t=e.filter(e=>this.#t.get(e.system)!==e.hash);t.length!==0&&(this.#n??=this.#e.share?.()??Promise.resolve(),await this.#n,await Promise.all(t.map(async e=>{this.#t.set(e.system,e.hash),this.#a(e.system,`loading`);try{await(this.#e.load??((e,t)=>e.load(t).then(()=>void 0)))(this.runtime,e.url),this.#a(e.system,`ready`),this.version.value++}catch(t){console.error(`chat.renderer.load-failed`,{system:e.system,url:e.url,error:t}),this.#a(e.system,`failed`)}})))}fnView(e,t){if(this.#r(),e.args===void 0)return;let n=$n(e),r=Qn(e);return this.runtime.fnView({fn:e.fn,kind:e.kind===void 0||e.kind===`native`?void 0:e.kind,run:e.id,status:Zn(e),args:e.args,state:t,...n===void 0?{}:{result:n},...r===void 0?{}:{error:r},...e.progress===void 0?{}:{progress:e.progress}})}resultView(e,t){this.#r();let n=$n(e);if(e.status===`done`&&e.args!==void 0&&n!==void 0)return this.runtime.resultView({fn:e.fn,kind:e.kind===void 0||e.kind===`native`?void 0:e.kind,run:e.id,args:e.args,result:n,title:t})}pageView(e,t,n){return this.#r(),this.runtime.pageView(e,t,n)}attachmentView(e){return this.#r(),this.runtime.attachmentView({attachment:e.attachment,data:e.data,title:e.title})}inputView(e){this.#r();let t=tn.safeParse(e);return t.success?this.runtime.inputView(t.data):void 0}mentionView(e,t){return this.#r(),this.runtime.mentionView({provider:e.provider,label:e.label,target:e.target,hover:t})}contributedVisuals(e,t,n){return this.#r(),this.runtime.visuals(e,t,n)}#r(){return this.version.value}#i(){let e=this.#e.thread();if(e===void 0)throw Error(`No chat is open.`);return e}#a(e,t){let n=new Map(this.status.value);n.set(e,t),this.status.value=n}},Bu=(e,t)=>t.updatedAt-e.updatedAt;function Vu(e){return e.updatedAt===e.createdAt}function Hu(e){return Jn.parse(e)}var Uu=class{#e;#t;#n;#r;items=z([]);search=R(``);archived=R(!1);loading=R(!1);loadingMore=R(!1);loaded=R(!1);problem=R(``);creating=R(!1);partial=R(!1);#i=R(!1);hasMore=j(()=>this.#i.value);constructor(e,t){this.#e=e,this.#t=t}start(){this.#n===void 0&&(this.#n=this.#t(e=>{this.#u(e)}))}stop(){this.#n?.(),this.#n=void 0,this.#e.searchSessions.cancel()}load(){return this.#e.searchSessions.cancel(),this.#a(e=>this.#e.sessions.call(e))}async#a(e){this.loading.value=!0,this.problem.value=``;try{let t=await e(this.#s());this.items.value=t.items,this.#r=t.cursor,this.#i.value=t.cursor!==void 0,this.partial.value=u(t),this.loaded.value=!0,this.loading.value=!1}catch(e){if(_r(e))return;this.problem.value=J(e,`Couldn't load your chats.`),this.loading.value=!1}}async loadMore(){let e=this.#r;if(!(e===void 0||this.loadingMore.value)){this.loadingMore.value=!0;try{let t=await this.#e.sessions.call(this.#s(e)),n=new Set(this.items.value.map(e=>e.id));this.items.value=[...this.items.value,...t.items.filter(e=>!n.has(e.id))],this.#r=t.cursor,this.#i.value=t.cursor!==void 0}catch(e){this.problem.value=J(e,`Couldn't load more chats.`)}finally{this.loadingMore.value=!1}}}setSearch(e){this.search.value=e,this.#e.sessions.cancel(),this.#a(e=>this.#e.searchSessions.call(e))}async showArchived(e){this.archived.value=e,await this.load()}listed(e){return this.items.value.filter(t=>!Vu(t)||t.id===e)}async create(e={}){if(this.creating.value)return;let t=e.agent===void 0&&e.title===void 0&&!this.archived.value?this.items.value.find(Vu):void 0;if(t!==void 0)return t.id;this.creating.value=!0;try{let t=await this.#e.createSession.call(e);return this.#c(Hu(t)),t.id}catch(e){this.problem.value=J(e,`Couldn't start a new chat.`);return}finally{this.creating.value=!1}}async rename(e,t){return this.#o(e,{title:t},e=>({...e,title:t}))}async archive(e,t){return this.#o(e,{archived:t},e=>({...e,archived:t}))}async remove(e){let t=this.items.value;this.items.value=t.filter(t=>t.id!==e);try{return await this.#e.deleteSession.call({session:e}),!0}catch(e){return this.items.value=t,this.problem.value=J(e,`Couldn't delete that chat.`),!1}}find(e){return this.items.value.find(t=>t.id===e)}remember(e){this.#c(e)}async#o(e,t,n){let r=this.items.value,i=r.find(t=>t.id===e);i!==void 0&&this.#c(n(i));try{let n=await this.#e.updateSession.call({session:e,...t});return this.#c(Hu(n)),!0}catch(e){return this.items.value=r,this.problem.value=J(e,`Couldn't change that chat.`),!1}}#s(e){let t=fe(h(`sessions`,this.search.value)),n=t.filters??[],r={field:`archived`,op:`is`,value:this.archived.value};return g({query:n.some(e=>e.field===`archived`)?t:{...t,filters:[...n,r]}},40,e)}#c(e){let t=this.items.value.filter(t=>t.id!==e.id);if(!(e.archived===this.archived.value&&this.#l(e))){this.items.value=t;return}if((h(`sessions`,this.search.value).sort??[]).length===0){this.items.value=[e,...t].sort(Bu);return}let n=this.items.value.findIndex(t=>t.id===e.id);this.items.value=n<0?[e,...t]:this.items.value.map(t=>t.id===e.id?e:t)}#l(e){let t=(h(`sessions`,this.search.value).text??``).toLowerCase();return t===``||e.title.toLowerCase().includes(t)}#u(e){e.type===`session-deleted`?this.items.value=this.items.value.filter(t=>t.id!==e.session):e.type===`session`&&(this.items.value.some(t=>t.id===e.session.id)||this.loaded.value)&&this.#c(e.session)}},Wu=class{#e;#t;report=new c;text=R(``);constructor(e,t){this.#e=e,this.#t=t}async preview(e){let t=e.trim();t!==``&&(this.text.value=t,await this.report.load(()=>this.#e.previewSelection.call({session:this.#t,text:t}),`Couldn't preview this message.`))}clear(){this.text.value=``,this.report.reset()}},Gu={minLength:12,limit:6},Ku=class{#e;#t;#n;#r=``;items=z([]);loading=R(!1);constructor(e,t,n=Gu){this.#e=e,this.#t=t,this.#n=n}update(e){let t=e.trim();t.length<this.#n.minLength||t.startsWith(`/`)||t.startsWith(`!`)?this.clear():t!==this.#r&&this.#i(t)}clear(){this.#e.suggest.cancel(),this.items.value=[],this.loading.value=!1,this.#r=``}async#i(e){this.#r=e,this.loading.value=!0;try{let t=await this.#e.suggest.call({session:this.#t,text:e,limit:this.#n.limit});this.items.value=[...t].sort((e,t)=>t.score-e.score),this.loading.value=!1}catch(e){if(_r(e))return;this.#r=``,this.items.value=[],this.loading.value=!1}}},qu={delays:[500,1e3,2e3,4e3,8e3,15e3],sleep:e=>new Promise(t=>{setTimeout(t,e)})};async function Ju(e,t,n,r=()=>void 0){for(let i=0;n();i++)try{return await e(),!0}catch(e){if(r(e),!n())return!1;await t.sleep(t.delays[Math.min(i,t.delays.length-1)]??1e3)}return!1}var Yu={now:()=>typeof document>`u`||document.visibilityState===`visible`,watch:e=>typeof document>`u`?()=>void 0:(document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)})},Xu={page:50,runsOnOpen:60,typingFor:6e3,presenceEvery:3e3};function Zu(e){return{reports:e,undone:e.reduce((e,t)=>e+t.undone.length,0),failed:e.reduce((e,t)=>e+t.failed.length,0),notUndoable:e.reduce((e,t)=>e+t.notUndoable.length,0),kept:e.reduce((e,t)=>e+Qu(t),0)}}function Qu(e){return(e.kept??[]).reduce((e,t)=>e+t.effects.length,0)}function $u(e,t){return Dn(e,t.name,t.type)}var ed=class{id;#e;#t;#n;#r;#i=new Set;#a=new Map;#o=new Map;#s=new Map;#c=new Set;#l=new Set;#u=0;#d=!1;#f=!1;#p;session=z(void 0);messages=z([]);live=z(new Map);liveCites=z(new Map);runs=z(new Map);approvals=z([]);handlers=z([]);budgets=z([]);deliveries=z(new Map);presence=z([]);controls=z(void 0);state=z(new Map);#m=z(new Map);limits=z(void 0);status=R(`loading`);problem=R(``);stale=R(!1);#h=0;loadingOlder=R(!1);sending=R(!1);pending=z(void 0);stopping=R(!1);awaiting=R(void 0);#g=R(!1);#_=R(0);hasOlder=j(()=>this.#g.value);beginning=j(()=>this.status.value===`ready`&&!this.#g.value);running=j(()=>this.session.value?.status===`running`||this.awaiting.value!==void 0);paused=j(()=>this.session.value?.status===`paused`);spent=j(()=>[...this.runs.value.values()].reduce((e,t)=>e+t.cost,0));spentSince=j(()=>Math.max(0,this.spent.value-this.#_.value));background=j(()=>[...this.runs.value.values()].filter(e=>e.background&&!qn(e.status)));failures=j(()=>{let e=0;for(let t of[...this.messages.value].reverse())if(!(t.role===`note`||this.undone.value.has(t.turn))){if(t.role===`assistant`&&t.status===`failed`)e++;else break}return e});typing=j(()=>this.presence.value.filter(e=>e.typing&&e.user!==this.#e.me()));notify=j(()=>this.session.value?.participants.find(e=>e.actor===this.#e.me())?.notify??`all`);undone=j(()=>Be(this.messages.value));lastTurn=j(()=>[...this.messages.value].reverse().find(e=>e.role!==`note`&&!this.undone.value.has(e.turn))?.turn);canUndo=j(()=>this.controls.value?.undoLastTurn??(this.lastTurn.value!==void 0&&!this.running.value));canContinue=j(()=>!this.running.value&&this.controls.value?.continueLastTurn===!0);constructor(e,t,n=Xu){this.id=e,this.#e=t,this.#t=n}async open(){this.#n??=this.#e.events(this.id,e=>{this.#D(e)});let e=this.#e.looking??Yu;this.#p??=e.watch(()=>{this.reportPresence({typing:this.#d&&e.now()})}),this.reportPresence({typing:this.#d}),this.status.value=this.messages.value.length>0?`ready`:`loading`,this.problem.value=``;try{let e=await this.#v();this.loadLimits(),this.loadWaiting(),this.loadControls(),this.#w(e.flatMap(e=>e.runs).slice(-this.#t.runsOnOpen))}catch(e){let t=this.session.value!==void 0;this.status.value=t?`ready`:`error`,this.problem.value=J(e,t?`Couldn't catch up with this chat.`:`Couldn't open this chat.`)}}async#v(){let[e,t]=await Promise.all([this.#e.api.session.call({session:this.id}),this.#e.api.messages.call({session:this.id,limit:this.#t.page})]);this.session.value=e,this.#e.changed(Hu(e));let n=[...t.items].reverse();for(let e of this.messages.value)n=ze(n,e);return this.messages.value=n,this.#r=t.cursor,this.#g.value=t.cursor!==void 0,this.status.value=`ready`,n}close(){this.#n?.(),this.#n=void 0;for(let e of this.#o.values())clearTimeout(e);this.#o.clear(),this.#p?.(),this.#p=void 0,(this.#d||this.#f)&&this.#S(!1,!1)}async refresh(){let e=++this.#h;this.stale.value=!0,this.#n??=this.#e.events(this.id,e=>{this.#D(e)}),await Ju(()=>this.#y(),this.#e.retry??qu,()=>e===this.#h&&this.#n!==void 0,e=>{this.problem.value=J(e,`Couldn't catch up with this chat.`),this.session.value===void 0&&(this.status.value=`error`)})&&e===this.#h&&(this.stale.value=!1,this.problem.value=``,this.status.value===`error`&&(this.status.value=`ready`),this.loadLimits())}async#y(){let e=await this.#v(),t=[...this.runs.value.values()].filter(e=>!qn(e.status)).map(e=>e.id);await Promise.all([this.#b(),this.#w(e.flatMap(e=>e.runs).slice(-this.#t.runsOnOpen),!1,!0),this.#w(t,!0,!0),...[...this.#m.value.keys()].map(e=>this.loadState(e))])}stateOf(e){let t=this.#m.value.get(e);if(t===void 0)return this.loadState(e),{};let n={};for(let e of t.fields){let r=this.state.value.get($u(t.system,e));r!==void 0&&(n[e.name]=r)}return n}async loadState(e){if(!this.#c.has(e)){this.#c.add(e);try{let{system:t,fields:n}=await this.#e.api.state.call({run:e});this.#O(t,n);let r=new Map(this.#m.value);r.set(e,{system:t,fields:n.map(({name:e,type:t})=>({name:e,type:t}))}),this.#m.value=r}catch{}finally{this.#c.delete(e)}}}async loadOlder(){let e=this.#r;if(!(e===void 0||this.loadingOlder.value)){this.loadingOlder.value=!0;try{let t=await this.#e.api.messages.call({session:this.id,limit:this.#t.page,cursor:e});this.messages.value=Ye(this.messages.value,t.items),this.#r=t.cursor,this.#g.value=t.cursor!==void 0,this.#w(t.items.flatMap(e=>e.runs))}catch(e){this.problem.value=J(e,`Couldn't load older messages.`)}finally{this.loadingOlder.value=!1}}}async loadWaiting(){try{await this.#b()}catch{}}async#b(){let e=await this.#e.api.waiting.call({session:this.id});this.approvals.value=[...e.approvals].sort((e,t)=>e.createdAt-t.createdAt);let t=this.#e.me();this.handlers.value=this.#x(e.handlers.filter(e=>`user`in e.answerer&&e.answerer.user===t)),this.#w([...e.approvals.map(e=>e.run),...e.handlers.map(e=>e.run)])}async loadLimits(){try{this.limits.value=await this.#e.api.limits.call({session:this.id}),this.#_.value=this.spent.value}catch{}}async send(e){if(this.sending.value||e.parts.length===0)return!1;this.sending.value=!0,this.pending.value={parts:e.parts,at:this.#e.clock()},this.problem.value=``;try{let t=await this.#e.api.send.call({session:this.id,parts:[...e.parts],client:this.#e.client(),...e.replyTo===void 0?{}:{replyTo:e.replyTo},...e.replyAll===!0?{replyAll:!0}:{}});return this.messages.value=ze(this.messages.value,t.message),this.awaiting.value=t.turn,this.#k(),this.reportPresence({typing:!1}),!0}catch(e){return this.problem.value=J(e,`Couldn't send that. Your message is back in the box.`),!1}finally{this.sending.value=!1,this.pending.value=void 0}}async invoke(e,t,n){try{let r=await this.#e.api.invoke.call({session:this.id,fn:e,args:t,...n===void 0?{}:{on:n},client:this.#e.client()});return this.#T(this.runs.value.get(r.run)??ir(r.run,e)),this.awaiting.value=r.turn,this.#k(),this.#w([r.run],!0),r.run}catch(e){this.problem.value=J(e,`Couldn't run that.`);return}}async control(e,t){this.stopping.value=e!==`resume`;try{return this.controls.value=await this.#e.api.control.call({session:this.id,action:e,...t===void 0||t.length===0?{}:{runs:[...t]}}),e===`cancel`&&(this.awaiting.value=void 0,this.loadWaiting()),!0}catch(e){return this.stopping.value=!1,this.problem.value=J(e,`Couldn't stop the turn.`),!1}}async toBackground(e){try{let{accepted:t}=await this.#e.api.background.call({run:e}),n=this.runs.value.get(e);return t&&n!==void 0&&this.#T({...n,background:!0}),t}catch(e){return this.problem.value=J(e,`Couldn't move that to the background.`),!1}}async undoTurn(e){try{let t=await this.#e.api.undoTurn.call({turn:e});for(let e of[...t.undone.map(e=>e.run)]){let t=this.runs.value.get(e);t!==void 0&&this.#T({...t,status:`undone`})}return t}catch(e){this.problem.value=J(e,`Couldn't undo that.`);return}}async loadControls(){try{this.controls.value=await this.#e.api.controls.call({session:this.id})}catch{}}async continueTurn(e){try{return await this.#e.api.continueTurn.call({turn:e}),!0}catch(e){return this.problem.value=J(e,`Couldn't continue that.`),!1}}async continueLast(){let e=this.lastTurn.value;return e!==void 0&&this.continueTurn(e)}async undoLast(){let e=this.lastTurn.value;return e===void 0?void 0:this.undoTurn(e)}turnMessage(e){return this.messages.value.find(t=>t.turn===e&&t.role===`user`)}async retry(e){let t=this.turnMessage(e);return t===void 0||await this.undoTurn(e)===void 0?!1:(await this.#C(),this.send({parts:Le(t.parts),replyTo:t.replyTo,replyAll:t.replyAll}))}turnsFrom(e){let t=this.messages.value.findIndex(t=>t.id===e);if(t===-1)return[];let n=[];for(let e of this.messages.value.slice(t))e.role!==`note`&&!this.undone.value.has(e.turn)&&!n.includes(e.turn)&&n.push(e.turn);return n.reverse()}async editResend(e,t){let n=this.messages.value.find(t=>t.id===e);if(n===void 0)return;let r=[];for(let t of this.turnsFrom(e)){let e=await this.undoTurn(t);if(e===void 0)return;r.push(e)}return await this.#C(),await this.send({parts:t,replyTo:n.replyTo,replyAll:n.replyAll})?Zu(r):void 0}async approve(e,t,n,r,i){let a=this.approvals.value,o=a.find(t=>t.id===e)?.run;this.approvals.value=a.filter(t=>t.id!==e);try{return t&&o!==void 0&&this.#l.add(o),await this.#e.api.approve.call({approval:e,approve:t,remember:n,...r===void 0||r===``?{}:{reason:r},...i===void 0?{}:{answer:i}}),!0}catch(e){return o!==void 0&&this.#l.delete(o),this.approvals.value=a,this.problem.value=J(e,`Couldn't send your answer.`),!1}}#x(e){let t=[];for(let n of e)this.#l.has(n.run)&&et(n)?this.answer(n.id,!0):t.push(n);return t}async approveAll(e,t,n){let r=this.approvals.value.filter(t=>e.includes(t.id));return(await Promise.all(r.map(e=>this.approve(e.id,t,Ue(e)?n:`once`)))).every(Boolean)}async raiseBudget(e,t){let{setBy:n,...r}=e.budget;try{return await this.#e.api.setBudget.call({...r,maxCost:r.maxCost+t}),this.leaveBudget(e),!0}catch(e){return this.problem.value=J(e,`Couldn't raise the budget.`),!1}}leaveBudget(e){this.budgets.value=this.budgets.value.filter(t=>t.budget.id!==e.budget.id)}async answer(e,t){let n=this.handlers.value;this.handlers.value=n.filter(t=>t.id!==e);try{return await this.#e.api.answer.call({call:e,value:t}),!0}catch(e){return this.handlers.value=n,this.problem.value=J(e,`Couldn't send your answer.`),!1}}async submit(e,t){try{return(await this.#e.api.submit.call({run:e,value:t})).delivery}catch(e){this.problem.value=J(e,`Couldn't submit that.`);return}}async act(e,t,n,r){let{delivery:i}=await this.#e.api.act.call({session:this.id,system:e,action:t,input:n,client:this.#e.client(),...r===void 0?{}:{run:r}});return i}follow(e,t){return new Promise((n,r)=>{let i={status:t,resolve:n,reject:r},a=this.deliveries.value.get(e);a!==void 0&&this.#E(a,i)||this.#s.set(e,[...this.#s.get(e)??[],i])})}async update(e){try{let t=await this.#e.api.updateSession.call({session:this.id,...e});return this.session.value=t,this.#e.changed(Hu(t)),e.priority!==void 0&&this.loadLimits(),!0}catch(e){return this.problem.value=J(e,`Couldn't change this chat.`),!1}}reportPresence(e){let t=(this.#e.looking??Yu).now();e.typing===this.#d&&t===this.#f&&(!e.typing||this.#e.clock()-this.#u<this.#t.presenceEvery)||this.#S(e.typing,t)}#S(e,t){this.#d=e,this.#f=t,this.#u=this.#e.clock(),this.#e.api.presence.call({session:this.id,typing:e,focused:t}).catch(()=>void 0)}citesOf(e){return e.citations??this.liveCites.value.get(e.id)??[]}liveOf(e){return this.live.value.get(e.id)}runsOf(e){let t=e.runs.filter(e=>!this.runs.value.has(e));return t.length>0&&this.#w(t),e.runs.flatMap(e=>{let t=this.runs.value.get(e);return t===void 0?[]:[this.shown(t)]})}shown(e){let t=this.handlers.value.some(t=>t.run===e.id);return t===(e.asking===!0)?e:{...e,asking:t}}async ensureRun(e,t=!1){await this.#w([e],t)}async#C(){try{let e=await this.#e.api.messages.call({session:this.id,limit:this.#t.page});this.messages.value=[...e.items].reverse(),this.#r=e.cursor,this.#g.value=e.cursor!==void 0}catch{}}async#w(e,t=!1,n=!1){let r=[...new Set(e)].filter(e=>!this.#i.has(e)&&(t||this.runs.value.get(e)?.createdAt===void 0)),i=[];if(await Promise.all(r.map(async e=>{this.#i.add(e);try{let t=await this.#e.api.run.call({run:e});this.#T(nr(this.runs.value.get(e),t))}catch(e){i.push(e)}finally{this.#i.delete(e)}})),n&&i.length>0)throw i[0]}#T(e){let t=new Map(this.runs.value);t.set(e.id,e),this.runs.value=t}#E(e,t){return t.status(e.status),e.status===`done`?(t.resolve(e.result??null),!0):e.status===`failed`||e.status===`expired`?(t.reject(Error(e.error?.message??(e.status===`expired`?`It expired before the system came online.`:`It failed.`))),!0):!1}#D(e){switch(e.type){case`message`:{let t=this.#a.get(e.message.id);this.#a.delete(e.message.id);let n=t!==void 0&&e.message.status===`streaming`?qe(e.message,t):e.message;this.#M(n),this.messages.value=ze(this.messages.value,n),n.role===`assistant`&&n.turn===this.awaiting.value&&(this.awaiting.value=void 0),this.#w(n.runs);return}case`token`:{let t=this.messages.value.findIndex(t=>t.id===e.message),n=this.messages.value[t];if(this.#j(e.message,{kind:`text`,text:e.text}),n===void 0){this.#a.set(e.message,(this.#a.get(e.message)??``)+e.text);return}let r=[...this.messages.value];r[t]=qe(n,e.text),this.messages.value=r,n.turn===this.awaiting.value&&(this.awaiting.value=void 0);return}case`reasoning`:this.#j(e.message,{kind:`reasoning`,text:e.text});return;case`cite`:{let t=new Map(this.liveCites.value);t.set(e.message,[...(t.get(e.message)??[]).filter(t=>t.index!==e.cite.index),e.cite]),this.liveCites.value=t;return}case`run`:{let t=this.runs.value.get(e.run)??ir(e.run,e.fn);this.#T(er(t,e.update,this.#e.clock()));let n=e.update.type===`status`&&qn(e.update.status);(t.createdAt===void 0||n)&&this.#w([e.run],n),(n||e.update.type===`cost`)&&this.#A(e.run),e.update.type===`status`&&tr(e.update.status)&&(this.awaiting.value=void 0);return}case`controls`:this.controls.value=e.controls,this.stopping.value=!1;return;case`approval`:{let t=this.approvals.value.filter(t=>t.id!==e.approval.id);this.approvals.value=e.approval.status===`pending`?[...t,e.approval].sort((e,t)=>e.createdAt-t.createdAt):t;return}case`handler`:{let t=this.handlers.value.filter(t=>t.id!==e.call.id),n=`user`in e.call.answerer&&e.call.answerer.user===this.#e.me();this.handlers.value=e.call.status===`pending`&&n?[...t,...this.#x([e.call])]:t;return}case`delivery`:{let t=new Map(this.deliveries.value);t.set(e.delivery.id,e.delivery),this.deliveries.value=t;let n=(this.#s.get(e.delivery.id)??[]).filter(t=>!this.#E(e.delivery,t));n.length===0?this.#s.delete(e.delivery.id):this.#s.set(e.delivery.id,n);return}case`budget`:{let{type:t,...n}=e;this.budgets.value=[...this.budgets.value.filter(e=>e.budget.id!==n.budget.id),n];return}case`presence`:this.#N(e.presence);return;case`compare`:return;case`state`:this.#O(e.system,e.fields);return;case`session`:{let t=this.session.value;t!==void 0&&(this.session.value={...t,...e.session}),e.session.status===`idle`&&(this.awaiting.value=void 0,this.stopping.value=!1,this.loadLimits()),this.#e.changed(e.session);return}}}#O(e,t){let n=new Map(this.state.value);for(let r of t){let t=$u(e,r);r.value===void 0?n.delete(t):n.set(t,r.value)}this.state.value=n}#k(){this.controls.value=void 0,this.stopping.value=!1}#A(e){this.approvals.value.some(t=>t.run===e)&&(this.approvals.value=this.approvals.value.filter(t=>t.run!==e)),this.handlers.value.some(t=>t.run===e)&&(this.handlers.value=this.handlers.value.filter(t=>t.run!==e)),this.budgets.value.some(t=>t.run===e)&&(this.budgets.value=this.budgets.value.filter(t=>t.run!==e))}#j(e,t){let n=this.messages.value.find(t=>t.id===e),r=this.live.value.get(e)??(n===void 0?[]:Ge(n)),i=new Map(this.live.value);i.set(e,We(r,t)),this.live.value=i}#M(e){let t=this.live.value.get(e.id);if(t===void 0||e.role!==`assistant`)return;if(e.status!==`streaming`){let n=new Map(this.live.value);n.set(e.id,Re(t,e)),this.live.value=n;return}let n=new Set(t.flatMap(e=>e.kind===`runs`?e.runs:[])),r=e.runs.filter(e=>!n.has(e));r.length>0&&this.#j(e.id,{kind:`runs`,runs:r})}#N(e){this.presence.value=[...this.presence.value.filter(t=>t.user!==e.user),e],clearTimeout(this.#o.get(e.user)),e.typing&&this.#o.set(e.user,setTimeout(()=>{this.presence.value=this.presence.value.map(t=>t.user===e.user?{...t,typing:!1}:t)},this.#t.typingFor))}},td=class{#e;#t=z(new Map);#n=new Map;source={visuals:(e,t,n)=>(this.prepare(e),this.#e.renderers.contributedVisuals(e,t,n))};constructor(e){this.#e=e}visuals(e,t,n){let r=this.#e.renderers.contributedVisuals(e,t,n).map(e=>({name:e.name,label:e.label,icon:Jr(e.icon)?e.icon:`layers`,system:e.system,shape:e.shape,component:A(e.component),props:{system:e.client}}));return Yr(xr,r,t,n)}prepare(e){let t=this.#n.get(e);if(t!==void 0)return t;let n=(async()=>{try{(await this.#e.api.contributions.call({registry:e})).length>0&&await this.#e.prepare()}catch(t){this.#n.delete(e),console.error(`chat.visuals.contributions-failed`,{registry:e,error:t})}})();return this.#n.set(e,n),n}choice(e){return this.#t.value.get(e)}choose(e,t){this.#t.value=new Map([...this.#t.value,[e,t]])}},nd=class{#e;#t=[];static available(){return typeof navigator<`u`&&`mediaDevices`in navigator&&typeof navigator.mediaDevices.getUserMedia==`function`&&typeof MediaRecorder<`u`}async start(){let e=await navigator.mediaDevices.getUserMedia({audio:!0});this.#t=[];let t=new MediaRecorder(e);t.ondataavailable=e=>{e.data.size>0&&this.#t.push(e.data)},t.start(),this.#e=t}stop(){let e=this.#e;return e===void 0?Promise.reject(Error(`Not recording.`)):new Promise(t=>{e.onstop=()=>{for(let t of e.stream.getTracks())t.stop();t(new Blob(this.#t,{type:e.mimeType===``?`audio/webm`:e.mimeType}))},e.stop(),this.#e=void 0})}cancel(){let e=this.#e;e!==void 0&&(e.onstop=()=>{for(let t of e.stream.getTracks())t.stop()},e.stop(),this.#e=void 0)}},rd=class{#e;#t;#n;constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n}start(){return this.#e.start()}async stop(){let e=await this.#e.stop(),t=await this.#t(e);return(await this.#n.transcribe.call({audio:t})).text}cancel(){this.#e.cancel()}};function id(e){let t=Reflect.get(e,`SpeechRecognition`)??Reflect.get(e,`webkitSpeechRecognition`);if(typeof t==`function`)return()=>{let e=Reflect.construct(t,[]);if(!ad(e))throw Error(`This browser’s speech recognition is not usable.`);return e}}function ad(e){return typeof e==`object`&&!!e&&typeof Reflect.get(e,`start`)==`function`&&typeof Reflect.get(e,`stop`)==`function`}var od=new Set([`not-allowed`,`service-not-allowed`]),sd=class{#e;#t;#n=[];#r;#i;constructor(e){this.#e=e}start(e){let t=this.#e();return this.#n=[],this.#r=void 0,t.lang=e??``,t.continuous=!0,t.interimResults=!1,t.onresult=e=>{this.#n=Array.from(e.results).filter(e=>e.isFinal).map(e=>e[0]?.transcript.trim()??``)},t.onend=()=>{this.#i?.()},new Promise((e,n)=>{t.onerror=e=>{this.#r=e.error,od.has(e.error)&&n(new DOMException(`The microphone is blocked.`,`NotAllowedError`))},t.start(),this.#t=t,e()})}stop(){let e=this.#t;return e===void 0?Promise.reject(Error(`Not listening.`)):(this.#t=void 0,new Promise((t,n)=>{this.#i=()=>{this.#i=void 0,this.#r!==void 0&&this.#r!==`no-speech`&&this.#n.length===0?n(Error(`Speech recognition failed (${this.#r}).`)):t(this.#n.filter(e=>e!==``).join(` `))},e.stop()}))}cancel(){this.#i=void 0,this.#t?.abort(),this.#t=void 0}},cd=class{#e;#t;#n;state=R(`idle`);startedAt=R(0);problem=R(``);constructor(e,t=Date.now){this.#e=e,this.#t=t}can(e){return this.#e[e]!==void 0}async start(e,t){if(this.state.value===`recording`||this.state.value===`transcribing`)return;this.problem.value=``;let n=this.#e[e];if(n===void 0)this.state.value=`failed`,this.problem.value=e===`browser`?`This browser can’t recognise speech. An admin can switch dictation to a model.`:`This browser can’t record audio.`;else try{await n.start(t),this.#n=n,this.startedAt.value=this.#t(),this.state.value=`recording`}catch(e){let t=e instanceof DOMException&&(e.name===`NotAllowedError`||e.name===`SecurityError`);this.state.value=t?`denied`:`failed`,this.problem.value=t?`The microphone is blocked. Allow it in your browser’s site settings to dictate.`:`Couldn't start the microphone.`}}async stop(){let e=this.#n;if(this.state.value===`recording`&&e!==void 0){this.#n=void 0,this.state.value=`transcribing`;try{let t=await e.stop();return this.state.value=`idle`,t}catch(e){this.state.value=`failed`,this.problem.value=J(e,`Couldn't transcribe that.`);return}}}cancel(){this.state.value===`recording`&&this.#n?.cancel(),this.#n=void 0,this.state.value=`idle`}dismiss(){this.problem.value=``,(this.state.value===`denied`||this.state.value===`failed`)&&(this.state.value=`idle`)}};function ld(e=Date.now){return{timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,locale:navigator.language,now:e()}}var ud=class{listValues;pickers;access;connections;sessions;capabilities;inspector;types;collapse;renderers;mentions;visuals;approvals;#e=z(new Map);#t=new Set;current=R(void 0);#n;#r=new Map;#i=new Map;#a=new Map;#o=new Map;#s;constructor(e){this.#n=e,this.listValues=e.api.listValues,this.pickers=new uu(e.api),this.access=new ql(e.api),this.connections=new lu(e.api),this.sessions=new Uu(e.api,e.userEvents),this.capabilities=new fu(e.api,e.userEvents),this.inspector=new Eu(e.api),this.types=new Ht(t=>e.api.types.call({names:[...t]})),this.collapse=new gu(e.store),this.mentions=new Ou(e.api),this.renderers=new zu({thread:()=>this.current.value===void 0?void 0:this.#r.get(this.current.value),online:e=>this.capabilities.online(e),...e.renderers}),this.visuals=new td({api:e.api,renderers:this.renderers,prepare:()=>this.prepareRenderers()}),this.approvals=new Qo(e.api)}start(){this.sessions.start(),this.capabilities.start()}stop(){this.sessions.stop(),this.capabilities.stop();for(let e of this.#r.values())e.close()}titleOf(e){let t=this.sessions.items.value.find(t=>t.id===e);if(t!==void 0)return t.title===``?void 0:t.title;let n=this.#e.value.get(e);if(n!==void 0)return n===``?void 0:n;let r=an.safeParse(e);r.success&&!this.#t.has(e)&&(this.#t.add(e),this.#n.api.session.call({session:r.data}).then(t=>{this.#e.value=new Map([...this.#e.value,[e,t.title]])},()=>void 0))}thread(e){let t=this.#r.get(e);if(t!==void 0)return this.#r.delete(e),this.#r.set(e,t),t;let n=new ed(e,{api:this.#n.api,events:this.#n.sessionEvents,clock:this.#n.clock,client:this.#n.client,me:this.#n.me,changed:e=>{this.sessions.remember(e)},...this.#n.retry===void 0?{}:{retry:this.#n.retry}},this.#n.thread??Xu);this.#r.set(e,n);for(let[t,n]of this.#r){if(this.#r.size<=5)break;t!==e&&t!==this.current.value&&(n.close(),this.#r.delete(t))}return n}async sessionOfRun(e){return(await this.#n.api.run.call({run:e})).session}composer(e){let t=this.#i.get(e);if(t!==void 0)return t;let n=new Tu({session:e,store:this.#n.store,api:this.#n.api,capabilities:()=>this.capabilities.value.value,uploads:new tc(this.#n.api,this.#n.sender,this.#n.previews)});return this.#i.set(e,n),n}suggestions(e){let t=this.#a.get(e);if(t!==void 0)return t;let n=new Ku(this.#n.api,e);return this.#a.set(e,n),n}preview(e){let t=this.#o.get(e);if(t!==void 0)return t;let n=new Wu(this.#n.api,e);return this.#o.set(e,n),n}startCompare(e,t){return _u(this.#n.api,this.thread(e),this.composer(e),t,this.#n.client())}compare(e,t){return new yu({api:this.#n.api,events:this.#n.sessionEvents},e,t)}voice(){if(this.#s===void 0){let e=this.#n.recorder(),t=this.#n.speech?.(),n={...e===void 0?{}:{model:new rd(e,e=>this.#l(e),this.#n.api)},...t===void 0?{}:{browser:new sd(t)}};this.#s=Object.keys(n).length===0?null:new cd(n,this.#n.clock)}return this.#s??void 0}async open(e){let t=this.current.value;t!==void 0&&t!==e&&this.#r.get(t)?.close(),this.current.value=e;let n=this.thread(e);return await Promise.all([n.open(),this.#c(e)]),n}leave(){let e=this.current.value;e!==void 0&&this.#r.get(e)?.close(),this.current.value=void 0}async refresh(){let e=this.current.value;await Promise.all([this.sessions.loaded.value?this.sessions.load():Promise.resolve(),this.#c(e),e===void 0?Promise.resolve():this.thread(e).refresh()])}async prepareRenderers(){this.capabilities.value.value===void 0&&await this.#c(this.current.value)}async#c(e){await this.capabilities.load(e);let t=this.capabilities.value.value;t!==void 0&&this.renderers.sync(t.clients)}#l(e){let t=e.type.includes(`ogg`)?`ogg`:e.type.includes(`mp4`)?`m4a`:`webm`;return $s(this.#n.api,this.#n.sender,e,`dictation.${t}`,()=>void 0,new AbortController().signal)}},dd={endpoints:{setup:{method:`GET`,path:`/setup`,ws:`setup`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:null,f:[],hasBody:!1,hasHeaders:!1,multi:!1,bodyEnc:null},createAdmin:{method:`POST`,path:`/createAdmin`,ws:`createAdmin`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`email`,`name`,`password`,`setup`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},signIn:{method:`POST`,path:`/signIn`,ws:`signIn`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`email`,`password`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},refresh:{method:`POST`,path:`/refresh`,ws:`refresh`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`refresh`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},redeemSso:{method:`POST`,path:`/redeemSso`,ws:`redeemSso`,httpOnly:!0,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`code`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},signOut:{method:`POST`,path:`/signOut`,ws:`signOut`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:null,f:[],hasBody:!1,hasHeaders:!1,multi:!1,bodyEnc:null},me:{method:`GET`,path:`/me`,ws:`me`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:null,f:[],hasBody:!1,hasHeaders:!1,multi:!1,bodyEnc:null},account:{method:`GET`,path:`/account`,ws:`account`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:null,f:[],hasBody:!1,hasHeaders:!1,multi:!1,bodyEnc:null},capabilities:{method:`POST`,path:`/capabilities`,ws:`capabilities`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},types:{method:`POST`,path:`/types`,ws:`types`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`names`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},sessions:{method:`POST`,path:`/sessions`,ws:`sessions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},session:{method:`POST`,path:`/session`,ws:`session`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},createSession:{method:`POST`,path:`/createSession`,ws:`createSession`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`agent`,`systems`,`title`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},updateSession:{method:`POST`,path:`/updateSession`,ws:`updateSession`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`title`,`systems`,`agent`,`archived`,`priority`,`notify`,`model`,`mode`,`contextor`,`fnMode`,`instructions`,`citations`,`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},deleteSession:{method:`POST`,path:`/deleteSession`,ws:`deleteSession`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},limits:{method:`POST`,path:`/limits`,ws:`limits`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},messages:{method:`POST`,path:`/messages`,ws:`messages`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},send:{method:`POST`,path:`/send`,ws:`send`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`parts`,`replyTo`,`replyAll`,`client`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},compare:{method:`POST`,path:`/compare`,ws:`compare`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`parts`,`variants`,`client`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},compareView:{method:`POST`,path:`/compareView`,ws:`compareView`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`turn`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},chooseVariant:{method:`POST`,path:`/chooseVariant`,ws:`chooseVariant`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`turn`,`variant`,`adopt`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},invoke:{method:`POST`,path:`/invoke`,ws:`invoke`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`fn`,`args`,`on`,`client`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},control:{method:`POST`,path:`/control`,ws:`control`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`action`,`runs`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},controls:{method:`POST`,path:`/controls`,ws:`controls`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},presence:{method:`POST`,path:`/presence`,ws:`presence`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`focused`,`typing`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},background:{method:`POST`,path:`/background`,ws:`background`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`run`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},undoTurn:{method:`POST`,path:`/undoTurn`,ws:`undoTurn`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`turn`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},continueTurn:{method:`POST`,path:`/continueTurn`,ws:`continueTurn`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`turn`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},tree:{method:`POST`,path:`/tree`,ws:`tree`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`turn`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},run:{method:`POST`,path:`/run`,ws:`run`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`run`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},llmCall:{method:`POST`,path:`/llmCall`,ws:`llmCall`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`id`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},waiting:{method:`POST`,path:`/waiting`,ws:`waiting`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},approve:{method:`POST`,path:`/approve`,ws:`approve`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`approval`,`approve`,`remember`,`reason`,`answer`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},answer:{method:`POST`,path:`/answer`,ws:`answer`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`call`,`value`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},act:{method:`POST`,path:`/act`,ws:`act`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`system`,`action`,`input`,`run`,`client`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},submit:{method:`POST`,path:`/submit`,ws:`submit`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`run`,`value`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},state:{method:`POST`,path:`/state`,ws:`state`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`run`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},suggest:{method:`POST`,path:`/suggest`,ws:`suggest`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`text`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},mentions:{method:`POST`,path:`/mentions`,ws:`mentions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`provider`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},mentionHover:{method:`POST`,path:`/mentionHover`,ws:`mentionHover`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`provider`,`target`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},resource:{method:`POST`,path:`/resource`,ws:`resource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`want`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},notifications:{method:`POST`,path:`/notifications`,ws:`notifications`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`unread`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},readNotifications:{method:`POST`,path:`/readNotifications`,ws:`readNotifications`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`ids`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},pushKey:{method:`GET`,path:`/pushKey`,ws:`pushKey`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:null,f:[],hasBody:!1,hasHeaders:!1,multi:!1,bodyEnc:null},subscribePush:{method:`POST`,path:`/subscribePush`,ws:`subscribePush`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`endpoint`,`keys`,`device`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},upload:{method:`POST`,path:`/upload`,ws:`upload`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`name`,`mime`,`size`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},uploaded:{method:`POST`,path:`/uploaded`,ws:`uploaded`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`upload`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},transcribe:{method:`POST`,path:`/transcribe`,ws:`transcribe`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`audio`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},systems:{method:`POST`,path:`/systems`,ws:`systems`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},system:{method:`POST`,path:`/system`,ws:`system`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},pairings:{method:`POST`,path:`/pairings`,ws:`pairings`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`status`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},approvePairing:{method:`POST`,path:`/approvePairing`,ws:`approvePairing`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`pairing`,`approve`,`instance`,`config`,`autoPair`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},createPairingToken:{method:`POST`,path:`/createPairingToken`,ws:`createPairingToken`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`name`,`expiresIn`,`autoPair`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},configureSystem:{method:`POST`,path:`/configureSystem`,ws:`configureSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`config`,`instance`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},enableSystem:{method:`POST`,path:`/enableSystem`,ws:`enableSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`functions`,`renderers`,`context`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},switchItem:{method:`POST`,path:`/switchItem`,ws:`switchItem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`section`,`name`,`on`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},switchPart:{method:`POST`,path:`/switchPart`,ws:`switchPart`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`section`,`name`,`on`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},removeSystem:{method:`POST`,path:`/removeSystem`,ws:`removeSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},installSystem:{method:`POST`,path:`/installSystem`,ws:`installSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`source`,`config`,`autoStart`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},startSystem:{method:`POST`,path:`/startSystem`,ws:`startSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},stopSystem:{method:`POST`,path:`/stopSystem`,ws:`stopSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},restartSystem:{method:`POST`,path:`/restartSystem`,ws:`restartSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`,`reason`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},upgradeSystem:{method:`POST`,path:`/upgradeSystem`,ws:`upgradeSystem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`version`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},reimport:{method:`POST`,path:`/reimport`,ws:`reimport`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},configureProvider:{method:`POST`,path:`/configureProvider`,ws:`configureProvider`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:`raw`,f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},providers:{method:`POST`,path:`/providers`,ws:`providers`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setModelCategory:{method:`POST`,path:`/setModelCategory`,ws:`setModelCategory`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`id`,`name`,`description`,`models`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setBudget:{method:`POST`,path:`/setBudget`,ws:`setBudget`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`id`,`target`,`period`,`maxCost`,`maxTokens`,`maxCalls`,`maxTime`,`share`,`onLimit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setPriority:{method:`POST`,path:`/setPriority`,ws:`setPriority`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`id`,`target`,`default`,`max`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setPolicy:{method:`POST`,path:`/setPolicy`,ws:`setPolicy`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`id`,`description`,`subject`,`target`,`decision`,`priority`,`expiresAt`,`yields`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setActorSetting:{method:`POST`,path:`/setActorSetting`,ws:`setActorSetting`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`setting`,`actor`,`value`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},addUser:{method:`POST`,path:`/addUser`,ws:`addUser`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`email`,`name`,`role`,`groups`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},addGroup:{method:`POST`,path:`/addGroup`,ws:`addGroup`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`name`,`about`,`members`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},updateUser:{method:`POST`,path:`/updateUser`,ws:`updateUser`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`user`,`name`,`role`,`disabled`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setMembership:{method:`POST`,path:`/setMembership`,ws:`setMembership`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`group`,`user`,`member`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setSignInPolicy:{method:`POST`,path:`/setSignInPolicy`,ws:`setSignInPolicy`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:`raw`,f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setSignInLimits:{method:`POST`,path:`/setSignInLimits`,ws:`setSignInLimits`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`account`,`address`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setProxyTrust:{method:`POST`,path:`/setProxyTrust`,ws:`setProxyTrust`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`proxies`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},systemFns:{method:`POST`,path:`/systemFns`,ws:`systemFns`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},systemParts:{method:`POST`,path:`/systemParts`,ws:`systemParts`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},systemLogs:{method:`POST`,path:`/systemLogs`,ws:`systemLogs`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},models:{method:`POST`,path:`/models`,ws:`models`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`provider`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},modelCategories:{method:`POST`,path:`/modelCategories`,ws:`modelCategories`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},budgets:{method:`POST`,path:`/budgets`,ws:`budgets`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},priorityRules:{method:`POST`,path:`/priorityRules`,ws:`priorityRules`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},resolveLimits:{method:`POST`,path:`/resolveLimits`,ws:`resolveLimits`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`user`,`session`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},policies:{method:`POST`,path:`/policies`,ws:`policies`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},actors:{method:`POST`,path:`/actors`,ws:`actors`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`kind`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},actorSettings:{method:`POST`,path:`/actorSettings`,ws:`actorSettings`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},runs:{method:`POST`,path:`/runs`,ws:`runs`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},llmCalls:{method:`POST`,path:`/llmCalls`,ws:`llmCalls`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},resources:{method:`POST`,path:`/resources`,ws:`resources`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},removeRule:{method:`POST`,path:`/removeRule`,ws:`removeRule`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:`raw`,f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},indexStatus:{method:`POST`,path:`/indexStatus`,ws:`indexStatus`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},browseResources:{method:`POST`,path:`/browseResources`,ws:`browseResources`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`search`,`system`,`family`,`source`,`under`,`form`,`missing`,`group`,`in`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},resourceForms:{method:`POST`,path:`/resourceForms`,ws:`resourceForms`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},readResource:{method:`POST`,path:`/readResource`,ws:`readResource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`form`,`section`,`offset`,`maxChars`,`rows`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},convertResource:{method:`POST`,path:`/convertResource`,ws:`convertResource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`kind`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},downloadResource:{method:`POST`,path:`/downloadResource`,ws:`downloadResource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`form`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},importResource:{method:`POST`,path:`/importResource`,ws:`importResource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:`raw`,f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},renameResource:{method:`POST`,path:`/renameResource`,ws:`renameResource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`name`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},deleteResource:{method:`POST`,path:`/deleteResource`,ws:`deleteResource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},contextFromResource:{method:`POST`,path:`/contextFromResource`,ws:`contextFromResource`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`sections`,`copy`,`weight`,`tags`,`fns`,`suggestFns`,`inject`,`command`,`visible`,`suggest`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},contexts:{method:`POST`,path:`/contexts`,ws:`contexts`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},contextItem:{method:`POST`,path:`/contextItem`,ws:`contextItem`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`name`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},remember:{method:`POST`,path:`/remember`,ws:`remember`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`text`,`title`,`scope`,`about`,`weight`,`summary`,`tags`,`fns`,`suggestFns`,`inject`,`command`,`visible`,`suggest`,`parent`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},updateMemory:{method:`POST`,path:`/updateMemory`,ws:`updateMemory`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`text`,`title`,`about`,`weight`,`summary`,`tags`,`fns`,`suggestFns`,`inject`,`command`,`visible`,`suggest`,`parent`,`name`,`clear`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},forget:{method:`POST`,path:`/forget`,ws:`forget`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`name`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},linkContext:{method:`POST`,path:`/linkContext`,ws:`linkContext`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`from`,`to`,`relation`,`weight`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},unlinkContext:{method:`POST`,path:`/unlinkContext`,ws:`unlinkContext`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`from`,`toKey`,`relation`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},modelLimits:{method:`POST`,path:`/modelLimits`,ws:`modelLimits`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`model`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},previewSelection:{method:`POST`,path:`/previewSelection`,ws:`previewSelection`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`text`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setModelLimits:{method:`POST`,path:`/setModelLimits`,ws:`setModelLimits`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`model`,`limits`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},previewPrompt:{method:`POST`,path:`/previewPrompt`,ws:`previewPrompt`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`text`,`model`,`count`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},modelRoles:{method:`POST`,path:`/modelRoles`,ws:`modelRoles`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setModelRole:{method:`POST`,path:`/setModelRole`,ws:`setModelRole`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:`raw`,f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},clearModelRole:{method:`POST`,path:`/clearModelRole`,ws:`clearModelRole`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`role`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},modelCalls:{method:`POST`,path:`/modelCalls`,ws:`modelCalls`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`run`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},modelCall:{method:`POST`,path:`/modelCall`,ws:`modelCall`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`id`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},fnMetrics:{method:`POST`,path:`/fnMetrics`,ws:`fnMetrics`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`fn`,`system`,`days`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},fnMetricsDays:{method:`POST`,path:`/fnMetricsDays`,ws:`fnMetricsDays`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`fn`,`days`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},mcps:{method:`POST`,path:`/mcps`,ws:`mcps`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},mcp:{method:`POST`,path:`/mcp`,ws:`mcp`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`mcp`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},createMcp:{method:`POST`,path:`/createMcp`,ws:`createMcp`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`slug`,`name`,`instructions`,`rules`,`toolMode`,`user`,`grantees`,`origins`,`enabled`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},updateMcp:{method:`POST`,path:`/updateMcp`,ws:`updateMcp`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`slug`,`name`,`instructions`,`rules`,`toolMode`,`user`,`grantees`,`origins`,`enabled`,`mcp`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},rotateMcpSecret:{method:`POST`,path:`/rotateMcpSecret`,ws:`rotateMcpSecret`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`mcp`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},deleteMcp:{method:`POST`,path:`/deleteMcp`,ws:`deleteMcp`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`mcp`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},previewMcp:{method:`POST`,path:`/previewMcp`,ws:`previewMcp`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`rules`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},mcpSessions:{method:`POST`,path:`/mcpSessions`,ws:`mcpSessions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`mcp`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},pairing:{method:`POST`,path:`/pairing`,ws:`pairing`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`pairing`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},instances:{method:`POST`,path:`/instances`,ws:`instances`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},installPackage:{method:`POST`,path:`/installPackage`,ws:`installPackage`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`zip`,`instance`,`config`,`data`,`autoStart`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},removeInstance:{method:`POST`,path:`/removeInstance`,ws:`removeInstance`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},addInstance:{method:`POST`,path:`/addInstance`,ws:`addInstance`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`,`description`,`config`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},exportSystemData:{method:`POST`,path:`/exportSystemData`,ws:`exportSystemData`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`,`withSecrets`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},query:{method:`POST`,path:`/query`,ws:`query`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`list`,`query`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},listValues:{method:`POST`,path:`/listValues`,ws:`listValues`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`list`,`field`,`prefix`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},fns:{method:`POST`,path:`/fns`,ws:`fns`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`text`,`filters`,`sort`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},suggestDecision:{method:`POST`,path:`/suggestDecision`,ws:`suggestDecision`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setSuggestDecision:{method:`POST`,path:`/setSuggestDecision`,ws:`setSuggestDecision`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:`raw`,f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},searchDecisions:{method:`POST`,path:`/searchDecisions`,ws:`searchDecisions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setSearchDecision:{method:`POST`,path:`/setSearchDecision`,ws:`setSearchDecision`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`item`,`value`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},previewSuggestions:{method:`POST`,path:`/previewSuggestions`,ws:`previewSuggestions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`session`,`text`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},autoPairs:{method:`POST`,path:`/autoPairs`,ws:`autoPairs`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},revokeAutoPair:{method:`POST`,path:`/revokeAutoPair`,ws:`revokeAutoPair`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`id`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},imageEmbedding:{method:`POST`,path:`/imageEmbedding`,ws:`imageEmbedding`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setImageEmbedding:{method:`POST`,path:`/setImageEmbedding`,ws:`setImageEmbedding`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:`raw`,f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},outsideImages:{method:`POST`,path:`/outsideImages`,ws:`outsideImages`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setOutsideImages:{method:`POST`,path:`/setOutsideImages`,ws:`setOutsideImages`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`value`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},https:{method:`POST`,path:`/https`,ws:`https`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setHttps:{method:`POST`,path:`/setHttps`,ws:`setHttps`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`on`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},accessInfo:{method:`POST`,path:`/accessInfo`,ws:`accessInfo`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},access:{method:`POST`,path:`/access`,ws:`access`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`targets`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setAccess:{method:`POST`,path:`/setAccess`,ws:`setAccess`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`target`,`sharing`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},connectPages:{method:`POST`,path:`/connectPages`,ws:`connectPages`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},connect:{method:`POST`,path:`/connect`,ws:`connect`,httpOnly:!0,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`,`key`,`form`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},updateConnection:{method:`POST`,path:`/updateConnection`,ws:`updateConnection`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`connection`,`settings`,`fns`,`share`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},disconnect:{method:`POST`,path:`/disconnect`,ws:`disconnect`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`connection`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},pick:{method:`POST`,path:`/pick`,ws:`pick`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`source`,`text`,`values`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},approvals:{method:`POST`,path:`/approvals`,ws:`approvals`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`runs`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},contributions:{method:`POST`,path:`/contributions`,ws:`contributions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`registry`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},systemPages:{method:`POST`,path:`/systemPages`,ws:`systemPages`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},searchFns:{method:`POST`,path:`/searchFns`,ws:`searchFns`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`text`,`match`,`items`,`kinds`,`systems`,`instance`,`visibility`,`types`,`modes`,`effects`,`names`,`filters`,`off`,`scopes`,`available`,`niches`,`order`,`offset`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},fnExamples:{method:`POST`,path:`/fnExamples`,ws:`fnExamples`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`fn`,`query`,`offset`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},fnFacts:{method:`POST`,path:`/fnFacts`,ws:`fnFacts`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`fn`,`args`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},fnsOfModelNames:{method:`POST`,path:`/fnsOfModelNames`,ws:`fnsOfModelNames`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`names`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},clientLogs:{method:`POST`,path:`/clientLogs`,ws:`clientLogs`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`entries`,`page`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},autoClassifier:{method:`POST`,path:`/autoClassifier`,ws:`autoClassifier`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setAutoClassifier:{method:`POST`,path:`/setAutoClassifier`,ws:`setAutoClassifier`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`model`,`messages`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},exploreRoots:{method:`POST`,path:`/exploreRoots`,ws:`exploreRoots`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`instance`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},exploreList:{method:`POST`,path:`/exploreList`,ws:`exploreList`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`cursor`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},exploreRead:{method:`POST`,path:`/exploreRead`,ws:`exploreRead`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`uri`,`want`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},systemReview:{method:`POST`,path:`/systemReview`,ws:`systemReview`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},goLive:{method:`POST`,path:`/goLive`,ws:`goLive`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`hash`,`off`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},approveReview:{method:`POST`,path:`/approveReview`,ws:`approveReview`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`hash`,`off`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},rejectReview:{method:`POST`,path:`/rejectReview`,ws:`rejectReview`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`hash`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},decideReview:{method:`POST`,path:`/decideReview`,ws:`decideReview`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`hash`,`approve`,`decline`,`off`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},testCall:{method:`POST`,path:`/testCall`,ws:`testCall`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`fn`,`args`,`instance`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},refusals:{method:`POST`,path:`/refusals`,ws:`refusals`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`system`,`rule`,`cursor`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},graph:{method:`POST`,path:`/graph`,ws:`graph`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`text`,`filters`,`systems`,`external`,`focus`,`collapse`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},injections:{method:`POST`,path:`/injections`,ws:`injections`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`agent`,`context`,`mode`,`fnMode`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},setInjection:{method:`POST`,path:`/setInjection`,ws:`setInjection`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`agent`,`context`,`on`,`order`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},identity:{method:`GET`,path:`/identity`,ws:`identity`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:null,f:[],hasBody:!1,hasHeaders:!1,multi:!1,bodyEnc:null},setHubName:{method:`POST`,path:`/setHubName`,ws:`setHubName`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`name`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},itemVersions:{method:`POST`,path:`/itemVersions`,ws:`itemVersions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`system`,`section`,`name`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},dataSets:{method:`POST`,path:`/dataSets`,ws:`dataSets`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`text`,`system`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},records:{method:`POST`,path:`/records`,ws:`records`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`type`,`query`,`search`,`run`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},record:{method:`POST`,path:`/record`,ws:`record`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`type`,`id`,`run`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},recordTable:{method:`POST`,path:`/recordTable`,ws:`recordTable`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`type`,`query`,`search`,`run`,`offset`,`limit`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},saveRecord:{method:`POST`,path:`/saveRecord`,ws:`saveRecord`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`type`,`id`,`value`,`expect`,`run`,`owner`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},updateRecord:{method:`POST`,path:`/updateRecord`,ws:`updateRecord`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`type`,`id`,`set`,`expect`,`run`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},removeRecord:{method:`POST`,path:`/removeRecord`,ws:`removeRecord`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`type`,`id`,`run`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},recordVersions:{method:`POST`,path:`/recordVersions`,ws:`recordVersions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`type`,`id`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},rowActions:{method:`POST`,path:`/rowActions`,ws:`rowActions`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`types`,`narrow`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},readFn:{method:`POST`,path:`/readFn`,ws:`readFn`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`fn`,`args`,`on`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},export:{method:`GET`,path:`/export`,ws:null,httpOnly:!0,streamIn:null,itemsIn:!1,streamOut:`text/csv`,items:!1,p:[],q:[`fn`,`args`,`offset`,`limit`,`format`],b:null,f:[],hasBody:!1,hasHeaders:!1,multi:!1,bodyEnc:null},people:{method:`POST`,path:`/people`,ws:`people`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`text`,`filters`,`sort`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},groups:{method:`POST`,path:`/groups`,ws:`groups`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`text`,`filters`,`sort`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},groupMembers:{method:`POST`,path:`/groupMembers`,ws:`groupMembers`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`cursor`,`limit`,`group`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},signInSettings:{method:`POST`,path:`/signInSettings`,ws:`signInSettings`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},checkSsoProvider:{method:`POST`,path:`/checkSsoProvider`,ws:`checkSsoProvider`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`provider`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},testSsoSignIn:{method:`POST`,path:`/testSsoSignIn`,ws:`testSsoSignIn`,httpOnly:!0,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`provider`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`},ssoTestResult:{method:`POST`,path:`/ssoTestResult`,ws:`ssoTestResult`,httpOnly:!1,streamIn:null,itemsIn:!1,streamOut:null,items:!1,p:[],q:[],b:[`test`],f:[],hasBody:!0,hasHeaders:!1,multi:!1,bodyEnc:`json`}},events:{systemLog:{ws:`on.systemLog`,hasParams:!0},session:{ws:`on.session`,hasParams:!0},user:{ws:`on.user`,hasParams:!0}}},fd={whileDisconnected:`queue`,heartbeat:{interval:3e4,timeout:1e4},backoff:{initial:500,max:15e3}};async function pd(e,t){let n=await e();return n&&t.reconnect(),n}function md(e){let t=nn(()=>{let t=e.token();return`${e.origin.replace(/^http/,`ws`)}/ws${t===``?``:`?access_token=${encodeURIComponent(t)}`}`},fd),n=e.unauthorized;return{hub:vn({baseUrl:`${e.origin}/api`,manifest:dd,headers:()=>{let t=e.token();return t===``?{}:{authorization:`Bearer ${t}`}},ws:t,prefer:`ws`,...n===void 0?{}:{unauthorized:()=>pd(n,t)}}),socket:t}}function hd(e){return e instanceof _n?e.status:0}function gd(e){let t=dd.endpoints[e];return{method:t.method,endpoint:t.path}}function _d(e,t,n=Date.now){let r=(r,i)=>{let a=gd(r),o=new WeakMap,s=(e,t)=>{let n=typeof e==`object`&&e?o.get(e):void 0;n!==void 0&&(n.status=t)};return e.caller(r,{...i,onStart:e=>{typeof e==`object`&&e&&o.set(e,{at:n(),status:0}),i?.onStart?.(e)},onSuccess:(e,t)=>{s(t,200),i?.onSuccess?.(e,t)},onError:(e,t)=>{s(t,hd(e)),i?.onError?.(e,t)},onSettled:e=>{let r=typeof e==`object`&&e?e:void 0,s=r===void 0?void 0:o.get(r);r!==void 0&&s!==void 0&&(o.delete(r),t({at:s.at,...a,status:s.status,duration:Math.max(0,Math.round(n()-s.at))})),i?.onSettled?.(e)}})};return{...e,caller:r}}var vd={wait:5e3,maxWait:3e4,max:500},yd=4e3,bd=3e3,xd=1e3,Sd=`[hidden]`,Cd=/token|password|passwd|secret|authorization|cookie|api[-_]?key|private[-_]?key|credential/i,wd=[/(bearer\s+)[\w.~+/=-]+/gi,/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g],Td={log:`info`,info:`info`,warn:`warn`,error:`error`};function Ed(e){return wd.reduce((e,t)=>e.replace(t,(e,t)=>typeof t==`string`?`${t}${Sd}`:Sd),e)}function Dd(e){if(typeof e==`string`)return Ed(e).slice(0,xd);if(e instanceof Error)return Ed(`${e.name}: ${e.message}`).slice(0,xd);if(e===void 0||typeof e==`function`||typeof e==`symbol`)return String(e);try{return Ed(JSON.stringify(e,(e,t)=>e!==``&&Cd.test(e)?Sd:t)).slice(0,xd)}catch{return Object.prototype.toString.call(e)}}function Od(e){return e.map(Dd).join(` `).slice(0,yd)}function kd(e){return e.caller(`clientLogs`,{debounce:{wait:vd.wait,maxWait:vd.maxWait,accumulate:e=>{let t=e.at(-1);return{entries:e.flatMap(e=>e.entries).slice(-vd.max),...t?.page===void 0?{}:{page:t.page}}}},retry:{attempts:3}})}function Ad(e){return e instanceof Error?{message:`${e.name}: ${e.message}`.slice(0,yd),fields:e.stack===void 0?{}:{stack:e.stack.slice(0,bd)}}:{message:String(e).slice(0,yd),fields:{}}}var jd=class{#e;#t;constructor(e){this.#e=e,this.#t=e.clock??Date.now}log(e,t,n={}){let r=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,Cd.test(e)?Sd:Ed(t)]));this.#r({type:`log`,at:this.#t(),level:e,message:Ed(t).slice(0,yd),...Object.keys(r).length===0?{}:{fields:r}})}error(e,t){let{message:n,fields:r}=Ad(e);this.log(`error`,n,{source:t,...r})}traffic(e){this.#r({type:`traffic`,at:e.at,method:e.method.slice(0,16),endpoint:e.endpoint.slice(0,300),status:e.status,duration:e.duration})}watch(e,t=console){let n=e=>{this.error(e.error??e.message,`window`)},r=e=>{this.error(e.reason,`promise`)};e.addEventListener(`error`,n),e.addEventListener(`unhandledrejection`,r);let i=this.#n(t);return()=>{e.removeEventListener(`error`,n),e.removeEventListener(`unhandledrejection`,r),i()}}#n(e){let t=Object.keys(Td).filter(e=>e in Td),n=t.map(t=>[t,Object.getOwnPropertyDescriptor(e,t)]),r=!1;for(let n of t){let t=e[n].bind(e);e[n]=(...e)=>{if(t(...e),!r){r=!0;try{this.log(Td[n],Od(e),{source:`console`})}finally{r=!1}}}}return()=>{for(let[t,r]of n)r===void 0?Reflect.deleteProperty(e,t):Object.defineProperty(e,t,r)}}#r(e){if(!this.#e.signedIn())return;let t={entries:[e],page:this.#e.page().slice(0,300)};this.#e.send.call(t).catch(()=>void 0)}},Md=un.endpoints.createAdmin.cfg.body,Nd=un.endpoints.signIn.cfg.body,Pd=`harness.sign-in`,Fd=K({remember:Pn(),email:G().optional()}),Id=class{#e;#t;#n;remembered;setup=z();loading=R(!0);busy=R(!1);problem=R(``);fields=z({});constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n,this.remembered=(n===void 0?void 0:wr(n,`harness.sign-in`,Fd))??{remember:!0}}get needsAdmin(){return this.setup.value?.needsAdmin===!0}get providers(){return this.setup.value?.sso??[]}async finishSso(e){this.busy.value=!0,this.problem.value=``;try{return this.#t.keep(await this.#e.redeemSso.call({code:e},Al),this.remembered.remember),!0}catch(e){return this.problem.value=J(e,`That sign-in didn’t finish. Sign in again.`),!1}finally{this.busy.value=!1}}async load(){this.loading.value=!0,this.problem.value=``;try{this.setup.value=await this.#e.setup.call(Al)}catch(e){this.problem.value=J(e)}finally{this.loading.value=!1}}async submit(e){let t=this.needsAdmin?Y(Md,e):Y(Nd,e);if(this.fields.value=t.ok?{}:t.problems,this.problem.value=``,!t.ok)return!1;this.busy.value=!0;try{let t=this.needsAdmin?await this.#e.createAdmin.call({email:e.email,name:e.name,password:e.password,setup:e.setup??``},Al):await this.#e.signIn.call({email:e.email,password:e.password},Al),n=e.remember??!0;return this.#t.keep(t,n),this.#n?.setItem(Pd,JSON.stringify(n?{remember:n,email:e.email}:{remember:n})),!0}catch(e){return this.problem.value=J(e,`Couldn't sign in. Try again.`),!1}finally{this.busy.value=!1}}},Ld=6e4,Rd=`harness.refresh`,zd=class{#e=new Map;run(e,t){let n=(this.#e.get(e)??Promise.resolve()).catch(()=>void 0).then(t);return this.#e.set(e,n),n}},Bd=class{#e;#t=new zd;constructor(e){this.#e=e?.locks}run(e,t){return this.#e===void 0?this.#t.run(e,t):this.#e.request(e,t).then(e=>e)}},Vd=class{#e;#t;#n;#r;#i;#a;#o;constructor(e,t,n=Date.now,r=new zd){this.#e=e,this.#t=t,this.#n=n,this.#r=r}start(){this.#a??=w(this.#t.expiresAt,e=>{this.#c(e)},{immediate:!0})}stop(){this.#a?.(),this.#a=void 0,clearTimeout(this.#i)}refresh(e=`due`){let t=this.#t.refreshToken.value;return this.#r.run(Rd,async()=>{this.#t.reload();let n=this.#t.refreshToken.value;if(n===``)return!1;if(n!==t||e===`due`&&!this.#s())return!0;try{return this.#t.keep(await this.#e.refresh.call({refresh:n},Al)),!0}catch{return this.#t.forget(),!1}})}recover(){return this.#o??=this.refresh(`refused`).finally(()=>{this.#o=void 0}),this.#o}async signOut(){try{await this.#e.signOut.call()}catch{}this.#t.forget()}#s(){let e=this.#t.expiresAt.value;return e!==void 0&&e-6e4<=this.#n()}#c(e){clearTimeout(this.#i),e!==void 0&&(this.#i=setTimeout(()=>{this.refresh()},Math.max(0,e-Ld-this.#n())))}},Hd=class{#e;view=new c;constructor(e){this.#e=e}load(){return this.view.load(()=>this.#e.account.call(),`Couldn’t load your account.`,this.view.value.value!==void 0)}},Ud=1500,Wd=2500,Gd=class{state=R(`online`);#e=new Set;#t;#n;#r=!1;constructor(e){this.#t=e.subscribe(e=>{this.#i(e)}),e.status===`offline`&&this.#i(`offline`)}onReconnect(e){return this.#e.add(e),()=>{this.#e.delete(e)}}dispose(){this.#t(),clearTimeout(this.#n)}#i(e){if(e===`offline`){if(this.#r)return;this.#r=!0,clearTimeout(this.#n),this.#n=setTimeout(()=>{this.state.value=`offline`},Ud)}else if(this.#r){this.#r=!1,clearTimeout(this.#n);for(let e of this.#e)e();this.state.value===`offline`&&(this.state.value=`back`,this.#n=setTimeout(()=>{this.state.value=`online`},Wd))}}},Kd=class{#e;#t;#n;state=R(`off`);busy=R(!1);problem=R(``);constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n}async check(){this.#t.supported()?this.#t.permission()===`denied`?this.state.value=`blocked`:this.state.value=await this.#t.current().catch(()=>void 0)===void 0?`off`:`on`:this.state.value=`unsupported`}async enable(){if(this.state.value===`unsupported`)return!1;this.busy.value=!0,this.problem.value=``;try{let{publicKey:e}=await this.#e.pushKey.call(),t=await this.#t.subscribe(e);return t===void 0?(this.state.value=this.#t.permission()===`denied`?`blocked`:`off`,!1):(await this.#e.subscribePush.call({endpoint:t.endpoint,keys:{p256dh:t.keys.p256dh,auth:t.keys.auth},device:this.#n()}),this.state.value=`on`,!0)}catch(e){return this.problem.value=J(e,`Couldn't turn on notifications.`),!1}finally{this.busy.value=!1}}async disable(){this.busy.value=!0;try{await this.#t.unsubscribe(),this.state.value=`off`}finally{this.busy.value=!1}}},qd={built:`/sw.js`,source:`/sw/sw.ts`};function Jd(e){let t=`${e}${`=`.repeat((4-e.length%4)%4)}`.replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t),r=new Uint8Array(new ArrayBuffer(n.length));for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}var Yd=K({endpoint:G(),keys:K({p256dh:G(),auth:G()})}),Xd=class{#e;#t;constructor(e,t){this.#t=t,this.#e=e}supported(){return this.#e.isSecureContext&&`serviceWorker`in this.#e.navigator&&`PushManager`in this.#e&&`Notification`in this.#e}permission(){return Notification.permission}async current(){let e=await(await this.#e.navigator.serviceWorker.getRegistration(this.#t))?.pushManager.getSubscription();return e==null?void 0:Yd.parse(e.toJSON())}async subscribe(e){if(await Notification.requestPermission()!==`granted`)return;let t=await this.#e.navigator.serviceWorker.register(this.#t,{type:`module`,scope:`/`});await this.#e.navigator.serviceWorker.ready;let n=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Jd(e)});return Yd.parse(n.toJSON())}async unsubscribe(){await(await(await this.#e.navigator.serviceWorker.getRegistration(this.#t))?.pushManager.getSubscription())?.unsubscribe()}},Zd=class{#e;view=z(void 0);loading=new m;saving=new m;authority=j(()=>this.view.value?.on===!0&&this.view.value.source===`own`?Cn.der:void 0);constructor(e){this.#e=e}async load(){let e=await this.loading.run(()=>this.#e.https.call({}),`Couldn't read the hub's secure connection.`);e.ok&&(this.view.value=e.value)}async set(e){let t=await this.saving.run(()=>this.#e.setHttps.call({on:e}),`Couldn't save the setting.`);return t.ok&&(this.view.value=t.value),t}};function Qd(e,t){let n=new URL(t,e);return n.protocol=`http:`,n.toString()}var $d=class{#e;#t;#n=[];state=R(`browser`);sheetOpen=R(!1);secure;constructor(e){this.#e=e,this.secure=e.secure(),this.#r(),this.#n.push(e.onPrompt(e=>{this.#t=e,this.#r()}),e.onChange(()=>{this.#t=void 0,this.#r()}))}get offered(){return this.state.value===`ready`||this.state.value===`ios`}#r(){let e=this.#e;this.state.value=e.standalone()?`installed`:e.secure()?this.#t===void 0?e.ios()?`ios`:`browser`:`ready`:`insecure`}async install(){if(this.state.value===`ios`)return this.sheetOpen.value=!0,`sheet`;let e=this.#t;if(this.state.value!==`ready`||e===void 0)return`unavailable`;this.#t=void 0,await e.prompt();let{outcome:t}=await e.userChoice;return this.#r(),t}stop(){for(let e of this.#n.splice(0))e()}},ef=[`standalone`,`window-controls-overlay`,`minimal-ui`,`fullscreen`],tf=class{#e;constructor(e){this.#e=e}standalone(){return this.#e.navigator.standalone===!0||ef.some(e=>this.#e.matchMedia(`(display-mode: ${e})`).matches)}secure(){return this.#e.isSecureContext}ios(){let e=this.#e.navigator;return/iPhone|iPad|iPod/.test(e.userAgent)||/Macintosh/.test(e.userAgent)&&e.maxTouchPoints>1}onPrompt(e){let t=t=>{nf(t)&&(t.preventDefault(),e(t))};return this.#e.addEventListener(`beforeinstallprompt`,t),()=>{this.#e.removeEventListener(`beforeinstallprompt`,t)}}onChange(e){let t=ef.map(e=>this.#e.matchMedia(`(display-mode: ${e})`));for(let n of t)n.addEventListener(`change`,e);return this.#e.addEventListener(`appinstalled`,e),()=>{for(let n of t)n.removeEventListener(`change`,e);this.#e.removeEventListener(`appinstalled`,e)}}};function nf(e){return`prompt`in e&&typeof e.prompt==`function`&&`userChoice`in e}async function rf(e,t){if(e.isSecureContext&&`serviceWorker`in e.navigator)try{await e.navigator.serviceWorker.register(t,{type:`module`,scope:`/`})}catch{}}var af=`harness.session`,of=Sn.pick({access:!0,refresh:!0,user:!0}).extend({expiresAt:yn,remember:Pn().optional()}),sf=`harness.alive`;function cf(e){return{alive:()=>e.cookie.split(`;`).some(e=>e.trim()===`${sf}=1`),set:()=>{e.cookie=`${sf}=1; Path=/; SameSite=Lax`},clear:()=>{e.cookie=`${sf}=; Path=/; Max-Age=0; SameSite=Lax`}}}var lf=class{#e;#t;#n;#r;constructor(e,t=Date.now,n,r){this.#e=e,this.#t=t,this.#r=r,this.#n=Dr(e,af,of.optional(),void 0),this.#n.value?.remember===!1&&r!==void 0&&!r.alive()&&(this.#n.value=void 0),n?.(e=>{(e===null||e===`harness.session`)&&this.reload()})}accessToken=j(()=>this.#n.value?.access??``);refreshToken=j(()=>this.#n.value?.refresh??``);user=j(()=>this.#n.value?.user);signedIn=j(()=>this.#n.value!==void 0);expiresAt=j(()=>this.#n.value?.expiresAt);remembered=j(()=>this.#n.value?.remember!==!1);keep(e,t){let n=t??this.#n.value?.remember??!0;t===!1&&this.#r?.set(),this.#n.value={access:e.access,refresh:e.refresh,user:e.user,expiresAt:this.#t()+e.expiresIn,...n?{}:{remember:!1}}}forget(){this.#n.value=void 0}reload(){let e=wr(this.#e,af,of);(e?.access!==this.#n.value?.access||e?.refresh!==this.#n.value?.refresh)&&(this.#n.value=e)}},uf=class{#e;query=z({});facets=z([]);list;groups=z(new Map);folders=z(new Map);selected=z(new Set);uploads=z([]);acting=new m;importing=new m;selectedCount=j(()=>this.selected.value.size);#t=0;#n;#r;#i=new Map;#a=new Map;#o=0;constructor(e){this.#e=e,this.list=new x({fetch:async(t,n,r)=>{let i=await e.api.browse.call(g(t,r,n));return this.facets.value=n===void 0?i.facets:p(this.facets.value,i.facets),i},key:e=>e.uri,failure:`Couldn't load resources.`,limit:60},{})}start(){return this.#n??=this.#e.events(()=>{clearTimeout(this.#r),this.#r=setTimeout(()=>{this.refresh()},500)}),()=>{this.stop()}}stop(){this.#n?.(),this.#n=void 0,clearTimeout(this.#r)}async show(e){this.query.value=e,this.#o++,this.selected.value=new Set,await this.list.load(l(e)),e.view===`groups`&&e.in===void 0&&await this.#s(e)}async refresh(){let e=this.query.value;await Promise.all([this.list.refresh(),...e.view===`groups`&&e.in===void 0?[this.#s(e,!0)]:[]])}async#s(e,t=!1){let n=this.#o,r=new Map;await Promise.all(this.facets.value.map(async n=>{let i=(t?this.groups.value.get(n.value):void 0)??new c;r.set(n.value,i),await i.load(()=>this.#e.api.browseGroup.call(te(e,n)),`Couldn't load this group.`,t)})),n===this.#o&&(this.groups.value=r)}async openFolder(e,t=!1){let n=this.folders.value.get(e);if(n!==void 0&&!t)return;let r=n??new c;n===void 0&&(this.folders.value=new Map([...this.folders.value,[e,r]])),await r.load(async()=>(await this.#e.api.browseGroup.call(ue(this.query.value,e))).facets,`Couldn't load the folders.`)}peek(e){let t=`${e.uri}@${e.stat.version}`,n=this.#a.get(t);if(n!==void 0)return n;let r=new c;return this.#a.set(t,r),r.load(()=>this.#c(e),``,!0),r}async#c(e){let t=Xr(e.stat);if(e.forms?.includes(`thumbnail`)===!0)return{kind:`image`,url:(await this.#e.api.download.call({uri:e.uri,form:`thumbnail`})).url};if(t===`image`)return{kind:`image`,url:(await this.#e.api.download.call({uri:e.uri})).url};if(t===`code`||t===`document`||t===`data`||t===`table`||t===`web`){let t=await this.#e.api.read.call({uri:e.uri,maxChars:400});return t.text.trim()===``?{kind:`none`}:{kind:`text`,text:t.text}}return{kind:`none`}}toggle(e){let t=new Set(this.selected.value);t.has(e)?t.delete(e):t.add(e),this.selected.value=t}toggleAll(){let e=this.list.items.value.map(e=>e.uri);this.selected.value=e.every(e=>this.selected.value.has(e))?new Set:new Set(e)}clearSelection(){this.selected.value=new Set}async importUrl(e){let t=await this.importing.run(()=>this.#e.api.importResource.call({url:e}),`Couldn't import that address.`);return t.ok&&this.list.refresh(),t}async refetch(e){let t=e.flatMap(e=>{let t=it(e);return t===void 0?[]:[{url:t,name:e.stat.name}]}),n=await this.acting.run(()=>Promise.all(t.map(e=>this.#e.api.importResource.call(e))),`Couldn't fetch that again.`);if(n.ok)return this.list.refresh(),n.value.length}async upload(e){await Promise.all(e.map(e=>this.#l(e))),this.list.refresh()}async#l(e){let t=++this.#t,n=new AbortController;this.#i.set(t,n),this.#u({id:t,name:e.name,size:e.size,status:`uploading`,progress:0});try{let r=e.type===``?`application/octet-stream`:e.type,{url:i,upload:a}=await this.#e.api.upload.call({name:e.name,mime:r,size:e.size});await this.#e.sender.put(i,e,e=>{this.#d(t,{progress:e})},n.signal),this.#d(t,{status:`importing`,progress:1});let o=await this.#e.api.uploaded.call({upload:a}),s=await this.#e.api.importResource.call({content:o,name:e.name});this.#d(t,{status:`done`,uri:s.uri})}catch(n){this.#d(t,{status:`failed`,problem:J(n,`Couldn't upload ${e.name}.`)})}finally{this.#i.delete(t)}}dismissUpload(e){this.#i.get(e)?.abort(),this.uploads.value=this.uploads.value.filter(t=>t.id!==e)}#u(e){this.uploads.value=[...this.uploads.value,e]}#d(e,t){this.uploads.value=this.uploads.value.map(n=>n.id===e?{...n,...t}:n)}async rename(e,t){let n=await this.acting.run(()=>this.#e.api.rename.call({uri:e,name:t}),`Couldn't rename it.`);return n.ok&&this.list.refresh(),n.ok}async remove(e){let t=await this.acting.run(async()=>{let t=await Promise.all(e.map(e=>this.#e.api.remove.call({uri:e})));return{deleted:t.filter(e=>e.deleted).length,kept:t.filter(e=>!e.deleted).length}},`Couldn't delete that.`);if(t.ok)return this.selected.value=new Set([...this.selected.value].filter(t=>!e.includes(t))),await this.list.load(),t.value}async makeContext(e){let t=await this.acting.run(async()=>(await Promise.all(e.map(e=>this.#e.api.contextFrom.call({uri:e,copy:`live`})))).flatMap(e=>[...e.created,...e.updated]),`Couldn't make context from that.`);return t.ok?t.value:void 0}async downloadUrl(e){let t=await this.acting.run(()=>this.#e.api.download.call({uri:e}),`Couldn't start the download.`);return t.ok?t.value.url:void 0}async make(e,t){let n=await this.acting.run(()=>Promise.all(e.map(e=>this.#e.api.convert.call({uri:e,kind:t}))),`Couldn't make that.`);return n.ok&&this.list.refresh(),n.ok}},df=class{#e;#t=new Map;at=z(``);roots=new c;file=new c;constructor(e){this.#e=e}async open(e,t){let n=`${e}/${t}`;(this.at.value!==n||this.roots.value.value===void 0)&&(this.at.value=n,this.#t.clear(),this.file.reset(),await this.roots.load(()=>this.#e.exploreRoots.call({system:e,instance:t}),`Couldn't list ${n}'s folders.`))}folder(e){let t=this.#t.get(e);if(t!==void 0)return t;let n=new x({fetch:(e,t)=>this.#e.exploreList.call({uri:e,...t===void 0?{}:{cursor:t}}),key:e=>e.uri,failure:`Couldn't list this folder.`,limit:200},e);return this.#t.set(e,n),n.load(),n}peek(e){let t=Mn.safeParse(e);return t.success?this.#t.get(t.data):void 0}async read(e){e===void 0?this.file.reset():this.file.value.value?.stat.uri!==e&&await this.file.load(()=>this.#e.exploreRead.call({uri:e,want:[`text`]}),`Couldn't read this file.`)}refresh(e){this.#t.get(e)?.load()}},ff=class{#e;found=new c;constructor(e){this.#e=e}async search(e){let t=e.trim();t===``?this.found.reset():await this.found.load(async()=>(await this.#e.find.call({search:t,limit:8})).items,`Couldn't search resources.`)}},Q={as:`text`,form:`raw`},pf={as:`url`},$={as:`none`},mf={svg:{preview:{draws:`svg`,reads:pf},source:`code`},mermaid:{preview:{draws:`diagram`,reads:Q},source:`code`},markdown:{preview:{draws:`markdown`,reads:Q},source:`code`},html:{preview:{draws:`html`,reads:Q},source:`code`},csv:{preview:{draws:`table`,reads:Q},source:`code`},tsv:{preview:{draws:`table`,reads:Q},source:`code`},excel:{preview:{draws:`table`,reads:{as:`version`,form:`table`}}},ods:{preview:{draws:`table`,reads:{as:`version`,form:`table`}}},pdf:{preview:{draws:`pdf`,reads:pf}},docx:{preview:{draws:`markdown`,reads:{as:`text`,form:`markdown`}}},pptx:{preview:{draws:`markdown`,reads:{as:`text`,form:`markdown`}}},odt:{preview:{draws:`markdown`,reads:{as:`text`,form:`markdown`}}},rtf:{preview:{draws:`markdown`,reads:{as:`text`,form:`markdown`}}},notebook:{preview:{draws:`markdown`,reads:{as:`text`,form:`markdown`}},source:`code`},json:{preview:{draws:`json`,reads:Q},source:`code`},jsonl:{preview:{draws:`json`,reads:Q},source:`code`},text:{source:`text`}},hf={document:{source:`text`},code:{source:`code`},image:{preview:{draws:`image`,reads:pf}},table:{preview:{draws:`table`,reads:{as:`version`,form:`table`}}},audio:{preview:{draws:`audio`,reads:pf}},video:{preview:{draws:`video`,reads:pf}},web:{preview:{draws:`html`,reads:Q},source:`code`},data:{source:`code`},archive:{preview:{draws:`folder`,reads:$}},folder:{preview:{draws:`folder`,reads:$}},other:{preview:{draws:`binary`,reads:$}}},gf=[`markdown`,`table`,`pages`,`code`,`text`,`description`,`ocr`,`transcript`],_f={markdown:{draws:`markdown`,reads:{as:`text`,form:`markdown`}},text:{draws:`text`,reads:{as:`text`,form:`text`}},code:{draws:`code`,reads:{as:`text`,form:`code`}},pages:{draws:`pages`,reads:{as:`version`,form:`pages`}},table:{draws:`table`,reads:{as:`version`,form:`table`}},description:{draws:`markdown`,reads:{as:`text`,form:`description`}},ocr:{draws:`text`,reads:{as:`text`,form:`ocr`}},transcript:{draws:`text`,reads:{as:`text`,form:`transcript`}},thumbnail:{draws:`image`,reads:{as:`url`}}};function vf(e){return e.as===`text`?e.form===`raw`?void 0:e.form:e.as===`version`?e.form:void 0}function yf(e,t){let n=t.preview;return e===`thumbnail`||n===void 0?e===`thumbnail`:vf(n.reads)===e||n.reads.as===`text`&&n.reads.form===`raw`&&_f[e].draws===n.draws}function bf(e,t,n=[],r=[]){let i=Xr(e),a=e.mime?.startsWith(`image/svg`)===!0?mf.svg:void 0,o=(e.format===void 0?void 0:mf[e.format])??a??hf[i],s=Qr(e.format)||`text`,c=new Set(t),l=[],u=r.find(e=>e.mode===`replace`);if(u!==void 0)l.push({id:`preview`,label:`Preview`,draws:`system`,reads:$,system:u.system});else if(o.preview!==void 0){let e=vf(o.preview.reads),t=e===void 0?void 0:n.find(t=>t.kind===e);e===void 0||c.has(e)?l.push({id:`preview`,label:`Preview`,...o.preview,...e===void 0?{}:{form:e}}):l.push(t===void 0?{id:`preview`,label:`Preview`,draws:`binary`,reads:$}:{id:`preview`,label:`Preview`,draws:`offer`,reads:$,form:t.kind,offer:t})}o.source!==void 0&&l.push({id:`source`,label:l.length===0?`Text`:`Source`,draws:o.source,reads:Q,...o.source===`code`?{language:s}:{}});for(let e of r.filter(e=>e.mode===`tab`))l.push({id:`system:${e.system}`,label:e.label,draws:`system`,reads:$,system:e.system});let d=[...gf,...t.filter(e=>!gf.includes(e))];for(let e of d){if(yf(e,o))continue;if(c.has(e)){l.push({id:e,label:Zr[e],..._f[e],form:e,...e===`code`?{language:s}:{}});continue}let t=n.find(t=>t.kind===e);t!==void 0&&l.push({id:e,label:Zr[e],draws:`offer`,reads:$,form:e,offer:t})}return l.push({id:`info`,label:`Info`,draws:`info`,reads:$}),{family:i,modes:l,initial:l[0]?.id??`info`}}function xf(e,t){let n={id:`info`,label:`Info`,draws:`info`,reads:$};return e.modes.find(e=>e.id===t)??e.modes.find(t=>t.id===e.initial)??n}function Sf(e){switch(e.as){case`text`:return`text:${e.form}`;case`url`:return`url`;case`version`:return`version:${e.form}`;case`none`:return`none`}}function Cf(e){return e.value}var wf=2e5;R(0);var Tf=class{#e;uri=z(void 0);section=z(void 0);opened=new c;asked=R(void 0);#t=new Map;#n=R(0);making=new m;contexting=new m;plan;mode;systemViewers;constructor(e){this.#e=e,this.systemViewers=j(()=>{Cf(e.systems.version);let t=this.opened.value.value?.stat.format;return t===void 0?[]:e.systems.viewers(t)}),this.plan=j(()=>{let e=this.opened.value.value;if(e===void 0)return;let t=this.systemViewers.value.map(e=>({system:e.system,mode:e.mode,label:e.label}));return bf(e.stat,e.forms.map(e=>e.kind),e.offers,t)}),this.mode=j(()=>this.plan.value===void 0?void 0:xf(this.plan.value,this.asked.value))}async open(e,t){let n=this.uri.value===e;n||(this.#t.clear(),this.#n.value++),this.uri.value=e,this.section.value=t,await this.opened.load(()=>this.#r(e),`Couldn't open this resource.`,n&&this.opened.value.value!==void 0)}close(){this.uri.value=void 0,this.opened.reset(),this.#t.clear(),this.#n.value++}async#r(e){try{let t=await this.#e.api.forms.call({uri:e});return{stat:t.record.stat,record:t.record,forms:t.forms,offers:t.offers,links:t.record.links,from:`library`,text:void 0}}catch(t){try{let t=await this.#e.api.systemRead.call({uri:e,want:[`text`,`links`]}),n=t.text!==void 0&&`inline`in t.text?t.text.inline:void 0;return{stat:t.stat,record:void 0,forms:[],offers:[],links:t.links??[],from:`system`,text:n}}catch{throw t}}}load(e){Cf(this.#n);let t=this.uri.value,n=this.opened.value.value;if(e.as===`none`||t===void 0||n===void 0)return;let r=Sf(e),i=this.#t.get(r);if(i!==void 0)return i;let a=new c;return this.#t.set(r,a),a.load(()=>this.#i(t,n,e),e.as===`url`?`Couldn't load this file.`:`Couldn't read this.`),a}async#i(e,t,n){switch(n.as){case`text`:if(t.from===`system`){let n=t.text??``;return{as:`text`,result:{uri:e,form:`raw`,text:n,offset:0,total:n.length,truncated:!1,forms:[],offers:[]}}}return{as:`text`,result:await this.#e.api.read.call({uri:e,form:n.form,maxChars:wf})};case`url`:if(t.from===`system`)throw Error(`This system resource has no download.`);return{as:`url`,download:await this.#e.api.download.call({uri:e})};case`version`:{let t=await this.#e.api.download.call({uri:e,form:n.form}),r=await this.#e.fetch(t.url);if(!r.ok)throw Error(`The download answered ${r.status}.`);return{as:`version`,version:Rn.parse(await r.json())}}}}retry(e){this.#t.delete(Sf(e)),this.#n.value++}text(e){let t=this.load(e)?.value.value;return t?.as===`text`?t.result:void 0}download(e){let t=this.load(e)?.value.value;return t?.as===`url`?t.download:void 0}version(e){let t=this.load(e)?.value.value;return t?.as===`version`?t.version:void 0}async downloadUrl(e){let t=this.uri.value;if(t===void 0)return;let n=await this.making.run(()=>this.#e.api.download.call({uri:t,...e===void 0?{}:{form:e}}),`Couldn't start the download.`);return n.ok?n.value:void 0}async make(e){let t=this.uri.value;if(t===void 0)return!1;let n=await this.making.run(()=>this.#e.api.convert.call({uri:t,kind:e}),`Couldn't make that.`);return n.ok&&await this.open(t,this.section.value),n.ok}async makeContext(){let e=this.uri.value;if(e===void 0)return;let t=await this.contexting.run(()=>this.#e.api.contextFrom.call({uri:e,copy:`live`}),`Couldn't make context from this.`);return t.ok?t.value:void 0}changed(e){e.uri===this.uri.value&&(this.#t.clear(),this.#n.value++,this.open(e.uri,this.section.value))}systemView(e){let t=this.opened.value.value,n=this.uri.value;if(t===void 0||n===void 0)return;let r=this.#e;return{stat:t.stat,...this.section.value===void 0?{}:{section:this.section.value},forms:t.forms.map(e=>e.kind),text:async e=>t.from===`system`?t.text??``:(await r.api.read.call({uri:n,form:e??`raw`,maxChars:wf})).text,bytes:async()=>{if(t.from===`system`)return new Uint8Array;let e=await r.api.download.call({uri:n});return new Uint8Array(await(await r.fetch(e.url)).arrayBuffer())},system:r.systems.client(e)}}},Ef=class{#e;browser;explorer;constructor(e){this.#e=e,this.browser=new uf({api:e.api,events:e.events,sender:e.sender}),this.explorer=new df(e.api)}search(){return new ff(this.#e.api)}viewer(){let e=new Tf({api:this.#e.api,fetch:this.#e.fetch,systems:this.#e.systems}),t=this.#e.events(t=>{e.changed(t)});return this.#e.prepare(),ve()!==void 0&&Te(t),{store:e,stop:t}}},Df=class{#e;name=R(void 0);view=new c;choiceTargets=R(new Map);linking=new m;unlinking=new m;forgetting=new m;saving=new m;constructor(e){this.#e=e}async open(e){let t=this.name.value===e&&this.view.value.value!==void 0;t||(this.view.reset(),this.choiceTargets.value=new Map),this.name.value=e,await this.view.load(()=>this.#e.item.call({name:e}),`Couldn't load this context item.`,t),await this.#t(e)}async#t(e){let t=[...new Set(this.view.value.value?.record.decl.choices?.map(e=>e.to)??[])];if(t.length===0)this.choiceTargets.value=new Map;else try{let n=await this.#e.list.call({query:{filters:[{field:`name`,op:`in`,values:t}]},limit:Math.min(t.length,200)});this.name.value===e&&(this.choiceTargets.value=new Map(n.items.map(e=>[e.name,e])))}catch{}}close(){this.name.value=void 0,this.view.reset(),this.choiceTargets.value=new Map}touches(e){let t=this.view.value.value;return this.name.value===void 0||t===void 0?!1:this.name.value===e||t.backlinks.some(t=>t.from===e)||t.links.some(t=>t.to.kind===`context`&&t.to.name===e)}async reload(){let e=this.name.value;e!==void 0&&await this.open(e)}async addLink(e){let t=this.name.value;if(t===void 0)return{ok:!1,problem:`No context item is open.`};let n=re(e,t);if(!n.ok)return this.linking.problem.value=n.problem,n;let r=await this.linking.run(()=>this.#e.link.call({from:t,to:n.value.to,relation:n.value.relation,weight:n.value.weight}),`Couldn't add that link.`);return r.ok&&await this.reload(),r}async removeLink(e){let t=await this.unlinking.run(async()=>(await this.#e.unlink.call({from:e.from,toKey:e.toKey,relation:e.relation})).ok,`Couldn't remove that link.`);return t.ok&&await this.reload(),t}async forget(){let e=this.name.value;if(e===void 0)return{ok:!1,problem:`No context item is open.`};let t=await this.forgetting.run(async()=>(await this.#e.forget.call({name:e})).ok,`Couldn't forget this memory.`);return t.ok&&await this.reload(),t}async edit(e){let t=this.view.value.value;if(t?.record.origin?.type!==`memory`)return{ok:!1,problem:`Only a memory can be edited.`};let n=ce(t.record.name,e);if(!n.ok)return this.saving.problem.value=n.problem,n;let r=await this.saving.run(async()=>(await this.#e.updateMemory.call(n.value)).name,`Couldn't save this memory.`);return r.ok&&await this.open(r.value),r}},Of=class{#e;list;item;remembering=new m;making=new m;#t=0;#n;constructor(e){this.#e=e,this.list=new x({fetch:(t,n,r)=>e.api.list.call({...t,limit:r,...n===void 0?{}:{cursor:n}}),key:e=>e.name,failure:`Couldn't load the context.`,limit:50},{}),this.item=new Df(e.api)}async show(e){this.list.loaded.value&&JSON.stringify(e)===JSON.stringify(this.list.filter.value)?await this.list.refresh():await this.list.load(e)}follow(){this.#t++,this.#n??=this.#e.events(e=>{this.changed(e)});let e=!1,t=()=>{e||(e=!0,this.#t--,this.#t===0&&(this.#n?.(),this.#n=void 0))};return ve()!==void 0&&Te(t),t}changed(e){this.list.refresh(),this.item.touches(e)&&this.item.reload()}async remember(e){let t=ae(e);if(!t.ok)return this.remembering.problem.value=t.problem,t;let n=await this.remembering.run(async()=>(await this.#e.api.remember.call(t.value)).name,`Couldn't remember that.`);return n.ok&&this.list.refresh(),n}async fromResource(e){let t=await this.making.run(()=>this.#e.api.fromResource.call(e),`Couldn't make context from that resource.`);return t.ok&&this.list.refresh(),t}},kf=class{#e;#t;#n;name=R(void 0);about=new c;facts=new c;examples=z([]);examplesTotal=R(0);examplesNext=R(void 0);examplesLoading=R(!1);examplesProblem=R(``);#r=0;constructor(e,t){this.#e=e,this.#t=t}async open(e){let t=this.name.value===e;t||this.close(),this.name.value=e,this.#n??=this.#t(e=>{this.#o(e)}),await Promise.all([this.#i(e,t),this.#a(e,t),t?Promise.resolve():this.moreExamples()])}close(){this.#n?.(),this.#n=void 0,this.name.value=void 0,this.about.reset(),this.facts.reset(),this.#r++,this.examples.value=[],this.examplesTotal.value=0,this.examplesNext.value=void 0,this.examplesLoading.value=!1,this.examplesProblem.value=``}async moreExamples(){let e=this.name.value,t=this.examples.value.length===0?0:this.examplesNext.value;if(e===void 0||t===void 0||this.examplesLoading.value)return;let n=++this.#r;this.examplesLoading.value=!0,this.examplesProblem.value=``;try{let r=await this.#e.fnExamples.call({fn:e,offset:t,limit:5});if(n!==this.#r)return;this.examples.value=[...this.examples.value,...r.items],this.examplesTotal.value=r.total,this.examplesNext.value=r.next}catch(e){n===this.#r&&(this.examplesProblem.value=J(e,`Couldn't load its examples.`))}finally{n===this.#r&&(this.examplesLoading.value=!1)}}async#i(e,t){await this.about.load(async()=>(await this.#e.searchFns.call({names:[e],items:[`fn`],available:!1,limit:1})).items.find(t=>t.name===e),`Couldn't load this fn.`,t)}async#a(e,t){await this.facts.load(()=>this.#e.fnFacts.call({fn:e}),`Couldn't load this fn's facts.`,t)}#o(e){let t=this.name.value;e.type===`fn`&&t!==void 0&&e.fn===t&&this.#a(t,!0)}},Af=class{#e;known=z(new Map);#t=new Set;constructor(e){this.#e=e}fnOf(e){return wn(e,e=>this.known.value.get(e))}async resolve(e){let t=[...new Set(e)].filter(e=>Kn(e)&&!this.#t.has(e));if(t.length!==0){for(let e of t)this.#t.add(e);try{let e=await this.#e.fnsOfModelNames.call({names:t});this.known.value=new Map([...this.known.value,...Object.entries(e)])}catch{for(let e of t)this.#t.delete(e)}}}},jf=`harness.hubName`,Mf=class{#e;#t;#n;#r;#i;identity=z(void 0);name=j(()=>this.identity.value?.name??this.#r??`Harness`);source=j(()=>this.identity.value?.source);version=j(()=>this.identity.value?.version??``);saving=new m;constructor(e,t,n){this.#e=e,this.#t=t,this.#n=n,this.#r=n===void 0?void 0:wr(n,jf,Zt)}async load(){try{this.#o(await this.#e.identity.call(Al))}catch{}}start(){this.#i??=this.#t(e=>{this.#a(e)})}stop(){this.#i?.(),this.#i=void 0}async rename(e){let t=await this.saving.run(()=>this.#e.setHubName.call({name:e}),`Couldn't save the name.`);return t.ok&&this.#o(t.value),t}#a(e){e.type===`identity`&&this.#o(e.identity)}#o(e){this.identity.value=e;try{this.#n?.setItem(jf,JSON.stringify(e.name))}catch{}}},Nf={setting:`Set here.`,env:`From the hub’s HARNESS_NAME setting.`,default:`The default name.`};function Pf(e){let t=Zt.safeParse(e);return t.success?{ok:!0,name:t.data}:{ok:!1,problem:e.trim()===``?`Give the hub a name.`:`Keep it to one line of at most 40 characters.`}}var Ff=class{#e;view=z(void 0);value=j(()=>this.view.value?.value??`ask`);saving=new m;constructor(e){this.#e=e}async load(){try{this.view.value=await this.#e.outsideImages.call({})}catch{}}async set(e){let t=await this.saving.run(()=>this.#e.setOutsideImages.call({value:e}),`Couldn't save the setting.`);return t.ok&&(this.view.value=t.value),t}clear(){this.view.value=void 0}},If=class{#e;page=new c;#t;constructor(e){this.#e=e}async show(e){let t=this.#t!==void 0&&JSON.stringify(e)===JSON.stringify(this.#t)&&this.page.value.value!==void 0;this.#t=e,await this.page.load(()=>this.#e.graph.call(e),`Couldn't load the graph.`,t)}async refresh(){this.#t!==void 0&&await this.show(this.#t)}},Lf=class{#e;run=new c;tree=new c;approval=z(void 0);acting=new m;id=z(void 0);branch=j(()=>this.id.value===void 0?void 0:ne(this.tree.value.value,this.id.value));constructor(e){this.#e=e}async open(e){this.id.value!==e&&(this.id.value=e,this.run.reset(),this.tree.reset(),this.approval.value=void 0),await this.#t(e,!1)}async refresh(){let e=this.id.value;e!==void 0&&await this.#t(e,!0)}async decide(e,t,n){let r=this.approval.value;if(r===void 0)return!1;let i=await this.acting.run(()=>this.#e.approve.call({approval:r.id,approve:e,remember:`once`,...t===``?{}:{reason:t},...n===void 0?{}:{answer:n}}),`Couldn't send your answer.`);return i.ok&&(this.approval.value=void 0,this.refresh()),i.ok}async undo(){let e=this.run.value.value;if(e===void 0)return{ok:!1,problem:`The run has not loaded yet.`};let t=await this.acting.run(()=>this.#e.undoTurn.call({turn:e.turn}),`Couldn't undo it.`);return t.ok&&await this.refresh(),t}async background(){let e=this.run.value.value;if(e===void 0)return{ok:!1,problem:`The run has not loaded yet.`};let t=await this.acting.run(async()=>(await this.#e.background.call({run:e.id})).accepted,`Couldn't move it to the background.`);return t.ok&&this.refresh(),t}async#t(e,t){await this.run.load(()=>this.#e.run.call({run:e}),`Couldn't load this run.`,t);let n=this.run.value.value;n!==void 0&&n.id===e&&this.id.value===e&&await Promise.all([this.tree.load(()=>this.#e.tree.call({turn:n.turn}),`Couldn't load what it called.`,t||this.tree.value.value!==void 0),this.#n(n)])}async#n(e){if(e.status!==`awaiting-approval`)this.approval.value=void 0;else try{let t=await this.#e.approvals.call({runs:[e.id]});this.id.value===e.id&&(this.approval.value=t.find(t=>t.run===e.id&&t.status===`pending`))}catch{this.id.value===e.id&&(this.approval.value=void 0)}}},Rf=class{#e;sets;constructor(e){this.#e=e,this.sets=new x({fetch:async(e,t,n)=>this.#e.dataSets.call({limit:n,...t===void 0?{}:{cursor:t},...e.text===``?{}:{text:e.text},...e.system===void 0?{}:{system:e.system}}),key:e=>e.type,failure:`Couldn't load the stored data.`,limit:50},{text:``,system:void 0})}async rowActions(e){return this.#e.rowActions.call(e)}async findRecords(e){return this.#e.records.call(e)}async readFn(e,t){return this.#e.readFn.call({fn:e,args:{...t}})}async exportCsv(e){let t=await this.#e.exportCsv.call(e);return new Response(t).blob()}records(){return new zf(this.#e)}},zf=class{#e;table=new c;shown=z(void 0);#t;record=new c;versions=z([]);versionsNext=R(void 0);versionsLoading=R(!1);versionsProblem=R(``);saving=new m;constructor(e){this.#e=e}async show(e){let t=this.#t!==void 0&&JSON.stringify(this.#t)===JSON.stringify(e)&&this.table.value.value!==void 0;this.#t!==void 0&&this.#t.type!==e.type&&(this.table.reset(),this.shown.value=void 0),this.#t=e,await this.table.load(()=>this.#e.recordTable.call(e),`Couldn't load these records.`,t),this.#t===e&&this.table.problem.value===``&&(this.shown.value=e)}async open(e,t){let n=this.record.value.value?.id===t;await Promise.all([this.record.load(async()=>(await this.#e.record.call({type:e,id:t})).record,`Couldn't load this record.`,n),this.#r(e,t,!0)])}close(){this.record.reset(),this.versions.value=[],this.versionsNext.value=void 0,this.versionsProblem.value=``}async moreVersions(){let e=this.record.value.value;e!==void 0&&this.versionsNext.value!==void 0&&await this.#r(e.type,e.id,!1)}async save(e,t,n,r){let i=await this.saving.run(()=>this.#e.saveRecord.call({type:e,value:t,...n===void 0?{}:{id:n},...r===void 0?{}:{expect:r}}),`Couldn't save this record.`);if(i.ok)return this.record.value.value?.id===i.value.id&&(this.record.set(i.value),this.#r(e,i.value.id,!0)),await this.#n(),i.value}async window(e){return this.#e.recordTable.call(e)}follow(e){this.record.value.value?.id===e.id&&(this.record.set(e),this.#r(e.type,e.id,!0))}async remove(e,t){let n=await this.saving.run(()=>this.#e.removeRecord.call({type:e,id:t}),`Couldn't remove this record.`);return!n.ok||!n.value.removed?!1:(this.close(),await this.#n(),!0)}async#n(){let e=this.#t;e!==void 0&&await this.table.load(()=>this.#e.recordTable.call(e),`Couldn't load these records.`,!0)}async#r(e,t,n){this.versionsLoading.value=!0,this.versionsProblem.value=``;try{let r=n?void 0:this.versionsNext.value,i=await this.#e.recordVersions.call({type:e,id:t,limit:20,...r===void 0?{}:{cursor:r}});this.versions.value=n?i.items:[...this.versions.value,...i.items],this.versionsNext.value=i.cursor}catch{this.versionsProblem.value=`Couldn't load this record's history.`}finally{this.versionsLoading.value=!1}}},Bf=e=>e in St;function Vf(e){return e!==void 0&&Bf(e)?e:`layers`}function Hf(e){return e.filter(e=>e.nav===`main`).map(e=>({system:e.system,segment:e.segment,title:e.title,icon:Vf(e.icon)}))}function Uf(e){let t=bn.safeParse(e.system),n=e.page;if(!t.success||typeof n!=`string`)return;let r=e.path,i=Array.isArray(r)?r:typeof r==`string`&&r!==``?[r]:[];return{system:t.data,page:n,path:i}}function Wf(e){return Object.fromEntries(Object.entries(e).flatMap(([e,t])=>{let n=Array.isArray(t)?t[0]:t;return typeof n==`string`?[[e,n]]:[]}))}function Gf(e){let t=t=>{let n=e.here(),r=t.page??n.page,i=t.path??(r===n.page?n.path:[]);return y.systemPage(n.system,r,i,t.query??{})},n=(t,n)=>{let r=e.here();e.navigate(y.systemPage(r.system,r.page,r.path,{...r.query,...t}),!n)};return{get user(){return e.user()},hub:e.hub,query:{get values(){return e.here().query},get:t=>e.here().query[t],set:(e,t)=>{n(e,t?.push===!0)},bind:(t,r=``)=>({get value(){return e.here().query[t]??r},set value(e){n({[t]:e===r?void 0:e},!1)}})},href:n=>e.resolve(t(n)),chatHref:t=>e.chatHref(t),goChat:t=>{e.goChat(t)},runHref:t=>e.runHref(t),goRun:t=>{e.goRun(t)},go:(n,r)=>{e.navigate(t(n),r?.replace===!0)},openChat:t=>e.openChat(t),components:e.components,runs:t=>e.runs(t),inbox:e.inbox,notify:e.notify,format:e.format,live:(t,n)=>{e.live(t,n)}}}function Kf(e,t){return t.some(t=>t.system===e.system)?{title:`No such page`,body:`${e.system} has no page called “${e.page}”. It may have been renamed in a newer version.`}:{title:`${e.system} isn’t installed`,body:`This page belongs to the ${e.system} system, which isn’t installed and live here, or you can’t use it. The link will work again once it is.`}}var qf=class{#e;#t;list=new c;nav=j(()=>Hf(this.list.value.value??[]));constructor(e){this.#e=e}get hub(){return this.#e.hub}async load(e=!1){await this.list.load(()=>this.#e.api.systemPages.call({}),`Couldn’t load the systems’ pages.`,e)}async refresh(){this.#e.api.systemPages.invalidate(),await this.load(!0)}start(){this.#t===void 0&&(this.#t=this.#e.events(e=>{this.#n(e)}))}stop(){this.#t?.(),this.#t=void 0}clear(){this.stop(),this.list.reset()}page(e,t){return this.list.value.value?.find(n=>n.system===e&&n.segment===t)}#n(e){e.type===`capabilities`&&this.refresh()}},Jf=`harness.theme`,Yf=$t([`system`,`light`,`dark`]),Xf=`(prefers-color-scheme: dark)`,Zf=class{choice;#e=R(!1);#t;constructor(e){this.choice=Dr(e.store,Jf,Yf,`system`);let t=e.media(Xf);this.#e.value=t.matches;let n=e=>{this.#e.value=e.matches};t.addEventListener(`change`,n);let r=w(this.theme,t=>{e.root.dataset.theme=t},{immediate:!0,flush:`sync`});this.#t=()=>{t.removeEventListener(`change`,n),r()}}theme=j(()=>this.choice.value===`system`?this.#e.value?`dark`:`light`:this.choice.value);dispose(){this.#t()}},Qf={duration:5e3,max:4},$f=class{#e;#t=new Map;#n=z([]);#r=1;constructor(e=Qf){this.#e=e}get items(){return this.#n.value}push(e){let t=this.#r++,n={view:{id:t,tone:e.tone??`neutral`,title:e.title,...e.body===void 0?{}:{body:e.body},...e.action===void 0?{}:{action:e.action.label}},run:e.action?.run,duration:e.duration??this.#e.duration,timer:void 0};for(this.#t.set(t,n),this.#i(n);this.#t.size>this.#e.max;){let e=this.#t.keys().next();if(e.done===!0)break;this.dismiss(e.value)}return this.#a(),t}ok(e,t){return this.push({tone:`ok`,title:e,...t===void 0?{}:{body:t}})}error(e,t){return this.push({tone:`danger`,title:e,...t===void 0?{}:{body:t}})}dismiss(e){let t=this.#t.get(e);t!==void 0&&(clearTimeout(t.timer),this.#t.delete(e),this.#a())}act(e){let t=this.#t.get(e);this.dismiss(e),t?.run?.()}hold(e){let t=this.#t.get(e);t!==void 0&&(clearTimeout(t.timer),t.timer=void 0)}release(e){let t=this.#t.get(e);t!==void 0&&t.timer===void 0&&this.#i(t)}#i(e){e.duration>0&&(e.timer=setTimeout(()=>{this.dismiss(e.view.id)},e.duration))}#a(){this.#n.value=Array.from(this.#t.values(),e=>e.view)}};function ep(e){return e.connection.onReconnect(()=>{e.session.signedIn.value&&(e.inbox.refresh(),e.chat.refresh(),e.pages.refresh(),e.admin.systems.list.value.value!==void 0&&e.admin.systems.load(!0))})}function tp(e){let t=new lf(e.localStorage,Date.now,Tr(e),cf(e.document)),{hub:n}=md({origin:e.location.origin,token:()=>t.accessToken.value,unauthorized:()=>o.recover()}),r=new jd({send:kd(n),signedIn:()=>t.signedIn.value,page:()=>e.location.pathname});r.watch(e);let i=_d(n,e=>{r.traffic(e)}),a=Kl(i,()=>t.user.value?.id),o=new Vd(a.auth,t,Date.now,new Bd(e.navigator)),s=new Gd(a.connection),c=new de(a.notifications,a.userEvents),l=new ud({api:a.chat,userEvents:a.userEvents,sessionEvents:a.sessionEvents,store:e.localStorage,sender:new Ol,clock:Date.now,client:()=>ld(),me:()=>t.user.value?.id,recorder:()=>nd.available()?new nd:void 0,speech:()=>id(e),renderers:{share:async()=>{(await $r(async()=>{let{shareChatModules:e}=await import(`./shared-DTpYDMc_.js`);return{shareChatModules:e}},__vite__mapDeps([0,1,2,3,4]))).shareChatModules()}}}),u=new _l({api:a.admin,chat:a.chat,userEvents:a.userEvents,systemLogs:a.systemLogs,sender:new Ol,probe:new Ko((t,n)=>e.fetch(t,n)),data:a.data}),d=l.renderers.runtime,f=new Ef({api:a.resources,events:a.resourceEvents,sender:new Ol,fetch:(t,n)=>e.fetch(t,n),systems:{viewers:e=>d.resourceViewers(e),client:e=>d.systemClient(e),version:l.renderers.version},prepare:()=>l.prepareRenderers()}),ee=new qf({api:a.pages,events:a.userEvents,hub:i});return ep({session:t,connection:s,inbox:c,chat:l,admin:u,pages:ee}),{session:t,identity:new Mf(a.identity,a.userEvents,e.localStorage),outsideImages:new Ff(a.outsideImages),keeper:o,theme:new Zf({store:e.localStorage,media:t=>e.matchMedia(t),root:e.document.documentElement}),layout:new Er(e.localStorage),toasts:new $f,inbox:c,connection:s,chat:l,admin:u,signInForm:()=>new Id(a.auth,t,e.localStorage),account:new Hd(a.auth),resources:f,context:new Of({api:a.context,events:a.contextEvents}),fns:new kf(a.fns,a.userEvents),fnNotices:new zt(a.fns),modelNames:new Af(a.fns),graph:()=>new If(a.graph),runPage:()=>new Lf(a.chat),data:new Rf(a.data),pages:ee,itemVersions:e=>a.data.itemVersions.call(e),logs:r,push:new Kd(a.notifications,new Xd(e,qd.built),()=>e.navigator.userAgent),install:new $d(new tf(e)),https:new Zd(a.https)}}var np={name:`harness-scopes`,type:`light`,fg:`#000000`,bg:`#ffffff`,settings:[]},rp=[[`comment`,`comment`],[`punctuation.definition.comment`,`comment`],[`string`,`string`],[`punctuation.definition.string`,`string`],[`constant.numeric`,`number`],[`constant.language`,`literal`],[`support.constant`,`literal`],[`constant.character`,`literal`],[`keyword.operator`,`plain`],[`keyword`,`keyword`],[`storage`,`keyword`]];function ip(e){for(let t of[...e].reverse()){let e=rp.find(([e])=>t===e||t.startsWith(`${e}.`));if(e!==void 0)return e[1]}return`plain`}function ap(e){let t=[],n=(e,n)=>{let r=t.at(-1);r?.kind===e?t[t.length-1]={kind:e,text:r.text+n}:n!==``&&t.push({kind:e,text:n})};return e.forEach((e,t)=>{t>0&&n(`plain`,`
|
|
3
|
-
`);for(let t of e)if(t.explanation===void 0)n(`plain`,t.content);else for(let e of t.explanation)n(ip(e.scopes.map(e=>e.scopeName)),e.content)}),t}var op={async core(){let[{createHighlighterCore:e},{createJavaScriptRegexEngine:t}]=await Promise.all([$r(()=>import(`./core-DdF778CY.js`),__vite__mapDeps([5,1])),$r(()=>import(`./engine-javascript-C30F4iNc.js`),[])]);return e({themes:[np],langs:[],engine:t({forgiving:!0})})},async languages(){let{bundledLanguages:e,bundledLanguagesAlias:t}=await $r(async()=>{let{bundledLanguages:e,bundledLanguagesAlias:t}=await import(`./langs-CVIiVMBh.js`);return{bundledLanguages:e,bundledLanguagesAlias:t}},__vite__mapDeps([6,7]));return new Map([...Object.entries(t),...Object.entries(e)])}},sp=class{#e;#t;#n;#r;#i=new Map;#a=new Set;constructor(e=op,t=mt){this.#e=e,this.#t=t}tokens(e,t){let n=this.#r;if(n===void 0||!this.#a.has(t))return this.#t.tokens(e,t);try{return ap(n.codeToTokensBase(e,{lang:t,theme:np.name??``,includeExplanation:`scopeName`}))}catch{return this.#t.tokens(e,t)}}prepare(e){if(this.#a.has(e))return Promise.resolve(!1);let t=this.#i.get(e);if(t!==void 0)return t;let n=this.#o(e).catch(()=>!1);return this.#i.set(e,n),n}knows(e){return this.#a.has(e)||this.#t.knows(e)}async#o(e){let t=(await this.#e.languages()).get(e);if(t===void 0)return!1;this.#n??=this.#e.core();let n=await this.#n;return await n.loadLanguage(t),this.#r=n,this.#a.add(e),!0}},cp=/<svg\b[^>]*>/,lp=/viewBox="\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)\s*"/,up=/\s(?:width|height)="[^"]*"/g;function dp(e){let t=cp.exec(e)?.[0],n=t===void 0?void 0:lp.exec(t);if(t===void 0||n==null)return e;let[,r=`0`,i=`0`]=n,a=t.replace(up,``).replace(/^<svg/,`<svg width="${r}" height="${i}"`);return e.replace(t,a)}function fp(e,t,n){t.style.color=`var(${n})`,e.clearRect(0,0,1,1),e.fillStyle=getComputedStyle(t).color,e.fillRect(0,0,1,1);let[r=0,i=0,a=0,o=0]=e.getImageData(0,0,1,1).data;return o===0?void 0:`#${[r,i,a].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}var pp=[`--bg`,`--surface-2`,`--border-strong`,`--text`,`--text-dim`,`--accent`],mp=()=>{if(typeof document>`u`)return;let e=document.createElement(`canvas`).getContext(`2d`,{willReadFrequently:!0});if(e===null)return;let t=document.createElement(`span`);document.body.append(t);try{let[n,r,i,a,o,s]=pp.map(n=>fp(e,t,n)),c=getComputedStyle(document.documentElement).getPropertyValue(`--font`).trim();return n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||s===void 0||c===``?void 0:{font:c,background:n,surface:r,border:i,text:a,muted:o,accent:s}}finally{t.remove()}};function hp(e,t){return{theme:`base`,fontFamily:e.font,themeVariables:{darkMode:t,fontFamily:e.font,fontSize:`14px`,background:e.background,primaryColor:e.surface,primaryBorderColor:e.border,primaryTextColor:e.text,secondaryColor:e.surface,secondaryBorderColor:e.border,secondaryTextColor:e.text,tertiaryColor:e.background,tertiaryBorderColor:e.border,tertiaryTextColor:e.text,mainBkg:e.surface,nodeBorder:e.border,nodeTextColor:e.text,lineColor:e.muted,textColor:e.text,clusterBkg:e.background,clusterBorder:e.border,edgeLabelBackground:e.background,titleColor:e.text,noteBkgColor:e.surface,noteBorderColor:e.accent,noteTextColor:e.text,actorBorder:e.border,actorBkg:e.surface}}}var gp=async()=>(await $r(async()=>{let{default:e}=await import(`./mermaid.core-BNF3dRf5.js`);return{default:e}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,1,7,17,18,19,20,21,22,23]))).default,_p=class{languages=[`mermaid`];#e;#t;#n;#r=Promise.resolve();#i=0;constructor(e=gp,t=mp){this.#e=e,this.#t=t}render(e,t,n){let r=this.#r.then(()=>this.#a(e,n));return this.#r=r.catch(()=>void 0),r}async#a(e,t){this.#n??=this.#e();let n=await this.#n,r=this.#t();n.initialize({startOnLoad:!1,securityLevel:`strict`,...r===void 0?{theme:t?`dark`:`default`}:hp(r,t)}),this.#i+=1;try{let{svg:t}=await n.render(`harness-diagram-${this.#i}`,e);return{ok:!0,value:dp(t)}}catch(e){return{ok:!1,problem:e instanceof Error?e.message:String(e)}}}},vp={light:`#f9fafb`,dark:`#0c0d10`};function yp(e,t){let n=e instanceof Element?e.closest(`a[href]`):null;if(!(n instanceof HTMLAnchorElement)||n.target!==``||n.hasAttribute(`download`))return;let r=new URL(n.href,t);return(r.protocol===`http:`||r.protocol===`https:`)&&r.origin!==t?r.toString():void 0}function bp(e,t){let n=n=>{if(n.defaultPrevented||n.button!==0||!t())return;let r=yp(n.target,e.location.origin);r!==void 0&&(n.preventDefault(),e.open(r,`_blank`,`noopener,noreferrer`))};return e.document.addEventListener(`click`,n),()=>{e.document.removeEventListener(`click`,n)}}function xp(e,t){return w(t,t=>{for(let t of e.querySelectorAll(`meta[name="theme-color"]`))t.remove();let n=e.createElement(`meta`);n.name=`theme-color`,n.content=vp[t],e.head.append(n)},{immediate:!0})}var Sp=tp(window),Cp=e(Ro);Cp.config.errorHandler=e=>{Sp.logs.error(e,`vue`),console.error(e)},Cp.provide(qt,Sp).provide(gt,new sp).provide(ut,new _p).provide(at,new ot).use(zo(Sp.session,v())).mount(`#app`),rf(window,qd.built),bp(window,()=>Sp.install.state.value===`installed`),xp(document,Sp.theme.theme);export{pc as $,qc as A,Li as At,wc as B,tl as C,Ma as Ct,kc as D,Ki as Dt,Jc as E,zi as Et,Uc as F,ic as G,Rc as H,Kc as I,ac as J,X as K,Mc as L,xc as M,fi as Mt,Oc as N,di as Nt,Vc as O,Hi as Ot,Dc as P,ui as Pt,dc as Q,Ec as R,il as S,Xa as St,vc as T,Bi as Tt,Lc as U,Cc as V,Xc as W,cc as X,oc as Y,fc as Z,iu as _,Ds as _t,Nf as a,Ks as at,Xl as b,Do as bt,Qu as c,ys as ct,Zl as d,ks as dt,sc as et,Yl as f,Ns as ft,au as g,Ps as gt,$l as h,Os as ht,Wf as i,Ws as it,Sc as j,Ii as jt,jc as k,Gi as kt,ju as l,bs as lt,Jl as m,ws as mt,Uf as n,zs as nt,Pf as o,Xs as ot,cu as p,Es as pt,uc as q,Gf as r,Vs as rt,Qd as s,xs as st,Kf as t,nc as tt,Au as u,Ms as ut,su as v,hs as vt,nl as w,Ea as wt,el as x,oo as xt,ru as y,ps as yt,Tc as z};
|
|
4
|
-
//# sourceMappingURL=index-Bv42jNvr.js.map
|