@schlenkr/ragents 0.1.9 → 0.1.11
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/apps/server/package.json +1 -1
- package/apps/server/src/access-projection.ts +9 -39
- package/apps/server/src/access-service.ts +3 -3
- package/apps/server/src/access-session.ts +19 -19
- package/apps/server/src/api/contracts.ts +32 -29
- package/apps/server/src/api/core-methods.ts +21 -19
- package/apps/server/src/api/delivery.ts +2 -2
- package/apps/server/src/api/reference.ts +27 -27
- package/apps/server/src/api/rights.ts +18 -18
- package/apps/server/src/chat-handler.ts +5 -5
- package/apps/server/src/config-definition.ts +37 -10
- package/apps/server/src/config-file.ts +49 -49
- package/apps/server/src/config.ts +2 -0
- package/apps/server/src/data-directory.ts +2 -2
- package/apps/server/src/external-access.ts +1 -1
- package/apps/server/src/folder-install.ts +1 -1
- package/apps/server/src/help-files.ts +1 -1
- package/apps/server/src/host-api.json +8 -1
- package/apps/server/src/host-api.ts +3 -2
- package/apps/server/src/host-record.ts +3 -3
- package/apps/server/src/host-resolution-hooks.mjs +4 -4
- package/apps/server/src/host-version.ts +17 -17
- package/apps/server/src/host-web.ts +5 -5
- package/apps/server/src/main.ts +6 -6
- package/apps/server/src/missing-environment.ts +6 -6
- package/apps/server/src/parent-watch.ts +4 -4
- package/apps/server/src/plugin-build/build.ts +31 -31
- package/apps/server/src/plugin-build/host-api-names.ts +7 -7
- package/apps/server/src/plugin-build/plugin-description.ts +15 -15
- package/apps/server/src/plugin-build/typecheck.ts +1 -1
- package/apps/server/src/plugin-support/actor-programs/app-project.ts +19 -19
- package/apps/server/src/plugin-support/actor-programs/client-compiler.ts +4 -4
- package/apps/server/src/plugin-support/actor-programs/client-contracts.ts +11 -11
- package/apps/server/src/plugin-support/actor-programs/contract.ts +17 -17
- package/apps/server/src/plugin-support/actor-programs/runtime-libraries.ts +1 -1
- package/apps/server/src/plugin-support/actor-programs/workflow/index.ts +5 -5
- package/apps/server/src/plugin-support/actor-programs/workflow/prompt-reader.ts +2 -2
- package/apps/server/src/plugin-support/chat-display-policy.ts +2 -2
- package/apps/server/src/plugin-support/front-matter.ts +6 -6
- package/apps/server/src/plugin-support/http.ts +2 -2
- package/apps/server/src/plugin-support/language-server/contract.ts +8 -8
- package/apps/server/src/plugin-support/language-server/plugin.ts +2 -2
- package/apps/server/src/plugin-support/language-server/snapshot-method.ts +1 -1
- package/apps/server/src/plugin-support/language-server/tools.ts +11 -11
- package/apps/server/src/plugin-support/model-aliases.ts +30 -20
- package/apps/server/src/plugin-support/model-choice.ts +15 -15
- package/apps/server/src/plugin-support/model-completion.ts +44 -23
- package/apps/server/src/plugin-support/model-providers.ts +170 -0
- package/apps/server/src/plugin-support/model-upstreams.ts +1 -1
- package/apps/server/src/plugin-support/native-typescript-child.ts +4 -4
- package/apps/server/src/plugin-support/native-typescript-executor.ts +12 -12
- package/apps/server/src/plugin-support/plugin-config.ts +3 -3
- package/apps/server/src/plugin-support/plugin-folder.ts +2 -2
- package/apps/server/src/plugin-support/plugins-root.ts +2 -2
- package/apps/server/src/plugin-support/process-sandbox.ts +48 -47
- package/apps/server/src/plugin-support/product-model-settings-contract.ts +3 -3
- package/apps/server/src/plugin-support/product-model-settings.ts +10 -10
- package/apps/server/src/plugin-support/product-relay.ts +9 -9
- package/apps/server/src/plugin-support/product-start-options.ts +4 -4
- package/apps/server/src/plugin-support/prompt.ts +1 -1
- package/apps/server/src/plugin-support/provision.ts +8 -8
- package/apps/server/src/plugin-support/run-scripts.ts +17 -17
- package/apps/server/src/plugin-support/skills.ts +18 -18
- package/apps/server/src/plugin-support/start-entries-contract.ts +17 -17
- package/apps/server/src/plugin-support/start-options-contract.ts +5 -5
- package/apps/server/src/plugin-support/system-prompts.ts +11 -11
- package/apps/server/src/plugin-support/thinking-level.ts +2 -2
- package/apps/server/src/plugin-support/tool-availability.ts +2 -2
- package/apps/server/src/plugin-support/workspace-ownership.ts +5 -5
- package/apps/server/src/plugin-support/workspace-sandbox-host.ts +37 -37
- package/apps/server/src/plugin-support/zip.ts +7 -7
- package/apps/server/src/profile/bundle-manifest.ts +17 -17
- package/apps/server/src/profile/compose.ts +12 -7
- package/apps/server/src/profile/plugin-discovery.ts +12 -12
- package/apps/server/src/profile/provisioning.ts +5 -5
- package/apps/server/src/profile-target.ts +10 -10
- package/apps/server/src/protocol.ts +2 -2
- package/apps/server/src/provider.ts +63 -58
- package/apps/server/src/ragents/actor-chat-history.ts +8 -8
- package/apps/server/src/ragents/chat-text-positions.ts +2 -2
- package/apps/server/src/ragents/coordinator.ts +2 -2
- package/apps/server/src/ragents/engine.ts +25 -24
- package/apps/server/src/ragents/global-chat.ts +14 -8
- package/apps/server/src/ragents/host-services.ts +6 -3
- package/apps/server/src/ragents/journal-chat-events.ts +1 -1
- package/apps/server/src/ragents/run-owner.ts +2 -2
- package/apps/server/src/ragents/session.ts +49 -49
- package/apps/server/src/ragents/typescript-tools.ts +12 -12
- package/apps/server/src/ragents/workspace-runtime.ts +28 -28
- package/apps/server/src/rpc/dispatcher.ts +19 -19
- package/apps/server/src/rpc/http-transport.ts +11 -11
- package/apps/server/src/rpc/stdio-transport.ts +3 -3
- package/apps/server/src/run-preparation-input.ts +5 -5
- package/apps/server/src/run-preparation.ts +24 -24
- package/apps/server/src/run-transfer.ts +39 -39
- package/apps/server/src/server.ts +51 -49
- package/apps/server/src/settings.ts +1 -1
- package/apps/server/src/startup.ts +3 -3
- package/apps/server/src/title-compactor.ts +9 -9
- package/apps/server/src/title-settings.ts +3 -3
- package/apps/server/src/web-bundles.ts +2 -2
- package/apps/server/src/web-stylesheet.ts +2 -2
- package/apps/web/dist/assets/{highlighted-body-KPVGNVTW-xXXhTDbh.js → highlighted-body-KPVGNVTW-BfNSGxjB.js} +1 -1
- package/apps/web/dist/assets/main-D6bsKcIK.js +11 -0
- package/apps/web/dist/assets/mermaid-HWGCJPDP-DROEqEeg.js +608 -0
- package/apps/web/dist/assets/runPanel-Dumuuqry.js +21 -0
- package/apps/web/dist/help/guide-access.html +5 -5
- package/apps/web/dist/help/guide-access.md +2 -2
- package/apps/web/dist/help/guide-clients.html +64 -55
- package/apps/web/dist/help/guide-clients.md +62 -52
- package/apps/web/dist/help/guide-distributed.html +12 -7
- package/apps/web/dist/help/guide-distributed.md +9 -4
- package/apps/web/dist/help/guide-functions.html +3 -3
- package/apps/web/dist/help/guide-getting-started.html +24 -15
- package/apps/web/dist/help/guide-getting-started.md +22 -12
- package/apps/web/dist/help/guide-ideas.html +3 -3
- package/apps/web/dist/help/guide-plugins.html +5 -4
- package/apps/web/dist/help/guide-plugins.md +2 -1
- package/apps/web/dist/help/guide-programs.html +3 -3
- package/apps/web/dist/help/guide-runtime.html +6 -6
- package/apps/web/dist/help/guide-runtime.md +3 -3
- package/apps/web/dist/help/guide.html +3 -3
- package/apps/web/dist/help/index.html +1997 -942
- package/apps/web/dist/help/mini-app.css +30 -0
- package/apps/web/dist/help/mini-app.js +14 -14
- package/apps/web/dist/host-web.json +90 -90
- package/apps/web/dist/index.html +3 -3
- package/apps/web/dist/run-panel.html +3 -3
- package/apps/web/package.json +1 -1
- package/apps/web/src/AccessContext.tsx +15 -15
- package/apps/web/src/App.tsx +13 -13
- package/apps/web/src/DiffCode.tsx +2 -2
- package/apps/web/src/HelpDialog.tsx +3 -3
- package/apps/web/src/Overview.tsx +13 -13
- package/apps/web/src/PluginActivation.ts +1 -1
- package/apps/web/src/PluginChat.tsx +15 -15
- package/apps/web/src/PluginFailureNotice.tsx +1 -1
- package/apps/web/src/PluginRegistry.tsx +44 -44
- package/apps/web/src/RunPreparationChat.tsx +11 -11
- package/apps/web/src/RunStore.ts +1 -1
- package/apps/web/src/SessionList.tsx +14 -14
- package/apps/web/src/SettingsModal.tsx +112 -112
- package/apps/web/src/StartOptions.tsx +11 -11
- package/apps/web/src/StartSelection.tsx +11 -11
- package/apps/web/src/StartTiles.tsx +8 -8
- package/apps/web/src/SurfaceShortcuts.tsx +3 -3
- package/apps/web/src/ThemeSettings.tsx +8 -8
- package/apps/web/src/TitleModelSettings.tsx +13 -13
- package/apps/web/src/WorkspacePanel.tsx +9 -9
- package/apps/web/src/access-session.ts +4 -4
- package/apps/web/src/access-token.ts +5 -5
- package/apps/web/src/actor-conversation.ts +3 -3
- package/apps/web/src/actor-programs/client-ui/DataTable.tsx +8 -8
- package/apps/web/src/actor-programs/client-ui/FilePicker.tsx +4 -4
- package/apps/web/src/actor-programs/client-ui/FlowDiagram.tsx +13 -13
- package/apps/web/src/actor-programs/client-ui/Viewers.tsx +4 -4
- package/apps/web/src/actor-programs/client-ui/WorkflowDiagram.tsx +1 -1
- package/apps/web/src/actor-programs/client-ui/file-contracts.d.ts +4 -4
- package/apps/web/src/actor-programs/client-ui/file-selection.ts +1 -1
- package/apps/web/src/actor-programs/client-ui/viewer-contracts.d.ts +3 -3
- package/apps/web/src/api.ts +7 -7
- package/apps/web/src/chat/StoppedActorNotice.tsx +5 -5
- package/apps/web/src/chat/chat-target.ts +3 -3
- package/apps/web/src/chat/requests.ts +2 -2
- package/apps/web/src/chat/useAttachmentCapabilities.ts +2 -2
- package/apps/web/src/chat-view-settings.tsx +5 -6
- package/apps/web/src/diff-view.css +1 -1
- package/apps/web/src/highlighting.css +1 -1
- package/apps/web/src/language-server/language-server-plugin.tsx +30 -30
- package/apps/web/src/lib/labels.ts +6 -6
- package/apps/web/src/main.tsx +4 -4
- package/apps/web/src/offered-machines.ts +2 -2
- package/apps/web/src/page-opener.tsx +1 -1
- package/apps/web/src/panel/ConnectionsPage.tsx +26 -23
- package/apps/web/src/panel/LoginForm.tsx +6 -6
- package/apps/web/src/panel/PanelDialogs.tsx +22 -22
- package/apps/web/src/panel/PanelHeader.tsx +2 -2
- package/apps/web/src/panel/PanelPage.tsx +1 -1
- package/apps/web/src/panel/RunLine.tsx +4 -4
- package/apps/web/src/panel/RunsPage.tsx +15 -15
- package/apps/web/src/panel/StartPage.tsx +29 -26
- package/apps/web/src/panel/connection-state.ts +9 -9
- package/apps/web/src/panel/contract.ts +34 -27
- package/apps/web/src/panel.tsx +1 -1
- package/apps/web/src/plugin-bootstrap.ts +5 -5
- package/apps/web/src/product/ModelControl.tsx +3 -3
- package/apps/web/src/product/ProductModelSettings.tsx +16 -16
- package/apps/web/src/product/SystemPromptControl.tsx +11 -11
- package/apps/web/src/product/model-settings.ts +2 -2
- package/apps/web/src/rpc/client.ts +16 -16
- package/apps/web/src/rpc.ts +1 -1
- package/apps/web/src/run-overview.ts +1 -1
- package/apps/web/src/run-panel/RunPanelApp.tsx +39 -39
- package/apps/web/src/run-panel/RunPanelHeader.tsx +6 -6
- package/apps/web/src/run-panel/RunPanelMenu.tsx +6 -6
- package/apps/web/src/run-panel/RunPanelRail.tsx +4 -4
- package/apps/web/src/run-panel/RunPanelWorkspace.tsx +3 -3
- package/apps/web/src/run-panel/clipboard.ts +3 -3
- package/apps/web/src/run-panel/host-contract.ts +5 -5
- package/apps/web/src/run-panel/host.ts +15 -15
- package/apps/web/src/run-panel/input-bridge.ts +1 -1
- package/apps/web/src/run-panel/run-panel-location.ts +5 -5
- package/apps/web/src/run-panel/use-session-list.ts +1 -1
- package/apps/web/src/run-panel/workspace-state.ts +3 -3
- package/apps/web/src/run-panel.tsx +4 -4
- package/apps/web/src/run-preparation.ts +2 -2
- package/apps/web/src/run-view.ts +3 -3
- package/apps/web/src/settings-contributions.ts +32 -32
- package/apps/web/src/theme.ts +9 -9
- package/apps/web/src/title-model-settings.ts +6 -6
- package/apps/web/src/ui/ListDetail.tsx +9 -9
- package/apps/web/src/ui/dialog.tsx +2 -2
- package/apps/web/src/ui/modal-controller.ts +3 -3
- package/apps/web/src/ui/modal.tsx +2 -2
- package/apps/web/src/ui/popover.tsx +1 -1
- package/apps/web/src/ui/relative-time.ts +8 -8
- package/apps/web/src/ui/startup-notice.tsx +2 -2
- package/apps/web/src/ui/state-icon.tsx +1 -1
- package/apps/web/src/ui/state-vocabulary.ts +16 -16
- package/apps/web/src/ui/stop-button.tsx +2 -2
- package/bundles/ragents.activity/ragents-bundle.json +2 -2
- package/bundles/ragents.activity/web/classes.json +1 -1
- package/bundles/ragents.activity/web/index.js +1 -1
- package/bundles/ragents.activity/web/index.js.map +2 -2
- package/bundles/ragents.actor-programs/ragents-bundle.json +2 -2
- package/bundles/ragents.actor-programs/server/index.js +256 -228
- package/bundles/ragents.actor-programs/server/index.js.map +4 -4
- package/bundles/ragents.actor-programs/web/classes.json +1 -1
- package/bundles/ragents.actor-programs/web/index.js +1 -1
- package/bundles/ragents.actor-programs/web/index.js.map +3 -3
- package/bundles/ragents.ask/ragents-bundle.json +2 -4
- package/bundles/ragents.ask/server/chunks/{chunk-PDJO75SQ.js → chunk-YOV27MAR.js} +2 -2
- package/bundles/ragents.ask/server/chunks/chunk-YOV27MAR.js.map +7 -0
- package/bundles/ragents.ask/server/exports/server/contract.js +1 -1
- package/bundles/ragents.ask/server/index.js +23 -23
- package/bundles/ragents.ask/server/index.js.map +2 -2
- package/bundles/ragents.ask/web/chunks/{chunk-WFN4374U.js → chunk-D6NNB5DS.js} +1 -1
- package/bundles/ragents.ask/web/chunks/chunk-D6NNB5DS.js.map +7 -0
- package/bundles/ragents.ask/web/chunks/{chunk-V7W3QDVS.js → chunk-IQBHK7MV.js} +2 -2
- package/bundles/ragents.ask/web/chunks/{chunk-V7W3QDVS.js.map → chunk-IQBHK7MV.js.map} +4 -4
- package/bundles/ragents.ask/web/chunks/chunk-PWFIAMX4.js +2 -0
- package/bundles/ragents.ask/web/chunks/chunk-PWFIAMX4.js.map +7 -0
- package/bundles/ragents.ask/web/chunks/chunk-QHGKEESD.js +2 -0
- package/bundles/ragents.ask/web/chunks/chunk-QHGKEESD.js.map +7 -0
- package/bundles/ragents.ask/web/classes.json +1 -1
- package/bundles/ragents.ask/web/exports/ask-payload.js +1 -1
- package/bundles/ragents.ask/web/exports/web/QuestionCard.js +1 -1
- package/bundles/ragents.ask/web/exports/web/api.js +1 -1
- package/bundles/ragents.ask/web/index.js +1 -1
- package/bundles/ragents.ask/web/index.js.map +4 -4
- package/bundles/ragents.browser/executor/index.mjs +35 -35
- package/bundles/ragents.browser/executor/index.mjs.map +2 -2
- package/bundles/ragents.browser/ragents-bundle.json +2 -2
- package/bundles/ragents.browser/server/chunks/{chunk-CWLX4VA5.js → chunk-PYEISBNE.js} +1 -1
- package/bundles/ragents.browser/server/chunks/{chunk-CWLX4VA5.js.map → chunk-PYEISBNE.js.map} +1 -1
- package/bundles/ragents.browser/server/exports/server/contract.js +1 -1
- package/bundles/ragents.browser/server/index.js +31 -31
- package/bundles/ragents.browser/server/index.js.map +2 -2
- package/bundles/ragents.browser/skills/browser-testing/SKILL.md +30 -30
- package/bundles/ragents.documents/prompt.hbs +1 -1
- package/bundles/ragents.documents/ragents-bundle.json +2 -2
- package/bundles/ragents.documents/server/chunks/{chunk-QIECRZ7C.js → chunk-KMZWOVTI.js} +3 -3
- package/bundles/ragents.documents/server/chunks/{chunk-QIECRZ7C.js.map → chunk-KMZWOVTI.js.map} +2 -2
- package/bundles/ragents.documents/server/exports/contract.js +1 -1
- package/bundles/ragents.documents/server/index.js +26 -26
- package/bundles/ragents.documents/server/index.js.map +2 -2
- package/bundles/ragents.documents/web/classes.json +1 -1
- package/bundles/ragents.documents/web/index.js +1 -1
- package/bundles/ragents.documents/web/index.js.map +3 -3
- package/bundles/ragents.lsp-fsharp/executor/index.mjs +4 -4
- package/bundles/ragents.lsp-fsharp/executor/index.mjs.map +2 -2
- package/bundles/ragents.lsp-fsharp/ragents-bundle.json +2 -2
- package/bundles/ragents.lsp-fsharp/server/index.js +5 -5
- package/bundles/ragents.lsp-fsharp/server/index.js.map +2 -2
- package/bundles/ragents.lsp-fsharp/web/index.js +1 -1
- package/bundles/ragents.lsp-fsharp/web/index.js.map +2 -2
- package/bundles/ragents.lsp-roslyn/executor/index.mjs +3 -3
- package/bundles/ragents.lsp-roslyn/executor/index.mjs.map +2 -2
- package/bundles/ragents.lsp-roslyn/ragents-bundle.json +2 -2
- package/bundles/ragents.lsp-roslyn/server/index.js +17 -17
- package/bundles/ragents.lsp-roslyn/server/index.js.map +2 -2
- package/bundles/ragents.lsp-roslyn/web/index.js +1 -1
- package/bundles/ragents.lsp-roslyn/web/index.js.map +2 -2
- package/bundles/ragents.lsp-typescript/executor/index.mjs +2 -2
- package/bundles/ragents.lsp-typescript/executor/index.mjs.map +2 -2
- package/bundles/ragents.lsp-typescript/ragents-bundle.json +2 -2
- package/bundles/ragents.lsp-typescript/server/index.js.map +1 -1
- package/bundles/ragents.lsp-typescript/web/index.js +1 -1
- package/bundles/ragents.lsp-typescript/web/index.js.map +2 -2
- package/bundles/ragents.model-relay/ragents-bundle.json +7 -3
- package/bundles/ragents.model-relay/server/index.js +25 -21
- package/bundles/ragents.model-relay/server/index.js.map +2 -2
- package/bundles/ragents.orchestration/ragents-bundle.json +2 -2
- package/bundles/ragents.orchestration/server/index.js +28 -28
- package/bundles/ragents.orchestration/server/index.js.map +2 -2
- package/bundles/ragents.orchestration/web/chunks/{chunk-OSKPH6SZ.js → chunk-CFMJD5ZI.js} +2 -2
- package/bundles/ragents.orchestration/web/chunks/chunk-HOBLI364.js +2 -0
- package/bundles/ragents.orchestration/web/chunks/{chunk-OQYCNYXN.js.map → chunk-HOBLI364.js.map} +2 -2
- package/bundles/ragents.orchestration/web/chunks/{chunk-ODMMQGX2.js → chunk-UCIMT2R4.js} +2 -2
- package/bundles/ragents.orchestration/web/classes.json +1 -1
- package/bundles/ragents.orchestration/web/exports/web/program-slot.js +1 -1
- package/bundles/ragents.orchestration/web/exports/web/surface-entities.js +1 -1
- package/bundles/ragents.orchestration/web/index.js +8 -8
- package/bundles/ragents.orchestration/web/index.js.map +3 -3
- package/bundles/ragents.overseer/ragents-bundle.json +2 -2
- package/bundles/ragents.overseer/server/index.js +99 -99
- package/bundles/ragents.overseer/server/index.js.map +2 -2
- package/bundles/ragents.overseer/web/classes.json +1 -1
- package/bundles/ragents.overseer/web/index.js +1 -1
- package/bundles/ragents.overseer/web/index.js.map +2 -2
- package/bundles/ragents.processes/ragents-bundle.json +2 -2
- package/bundles/ragents.processes/server/index.js +11 -11
- package/bundles/ragents.processes/server/index.js.map +2 -2
- package/bundles/ragents.processes/web/classes.json +1 -1
- package/bundles/ragents.processes/web/index.js +3 -3
- package/bundles/ragents.processes/web/index.js.map +2 -2
- package/bundles/ragents.product/ragents-bundle.json +2 -2
- package/bundles/ragents.product/server/index.js +12 -13
- package/bundles/ragents.product/server/index.js.map +2 -2
- package/bundles/ragents.product/web/classes.json +1 -1
- package/bundles/ragents.product/web/index.js +1 -1
- package/bundles/ragents.product/web/index.js.map +2 -2
- package/bundles/ragents.profile-distribution/ragents-bundle.json +2 -2
- package/bundles/ragents.profile-distribution/server/index.js +31 -31
- package/bundles/ragents.profile-distribution/server/index.js.map +2 -2
- package/bundles/ragents.reference/ragents-bundle.json +2 -2
- package/bundles/ragents.reference/run-scripts/balcony-wizard/RUN.md +19 -19
- package/bundles/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/package.json +2 -2
- package/bundles/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/src/client.tsx +14 -14
- package/bundles/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/src/conversation.ts +2 -2
- package/bundles/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/tests/conversation.test.ts +49 -49
- package/bundles/ragents.reference/run-scripts/balcony-wizard/package.json +1 -1
- package/bundles/ragents.reference/run-scripts/balcony-wizard/src/server.ts +9 -9
- package/bundles/ragents.reference/run-scripts/balcony-wizard/tests/program.test.ts +9 -9
- package/bundles/ragents.reference/run-scripts/conversation-circle/RUN.md +7 -7
- package/bundles/ragents.reference/run-scripts/conversation-circle/package.json +1 -1
- package/bundles/ragents.reference/run-scripts/conversation-circle/src/server.ts +13 -13
- package/bundles/ragents.reference/run-scripts/conversation-circle/tests/helpers.ts +1 -1
- package/bundles/ragents.reference/run-scripts/conversation-circle/tests/program.test.ts +8 -8
- package/bundles/ragents.reference/run-scripts/learning-afternoon/RUN.md +16 -16
- package/bundles/ragents.reference/run-scripts/learning-afternoon/package.json +1 -1
- package/bundles/ragents.reference/run-scripts/learning-afternoon/prompts/experiment.md +1 -1
- package/bundles/ragents.reference/run-scripts/learning-afternoon/prompts/helper.md +3 -3
- package/bundles/ragents.reference/run-scripts/learning-afternoon/prompts/quiz.md +1 -1
- package/bundles/ragents.reference/run-scripts/learning-afternoon/src/server.ts +9 -9
- package/bundles/ragents.reference/run-scripts/learning-afternoon/tests/program.test.ts +39 -39
- package/bundles/ragents.reference/run-scripts/moderated-round/RUN.md +7 -7
- package/bundles/ragents.reference/run-scripts/moderated-round/package.json +1 -1
- package/bundles/ragents.reference/run-scripts/moderated-round/src/server.ts +9 -9
- package/bundles/ragents.reference/run-scripts/moderated-round/tests/helpers.ts +1 -1
- package/bundles/ragents.reference/run-scripts/moderated-round/tests/program.test.ts +6 -6
- package/bundles/ragents.reference/run-scripts/shared-actor-list/RUN.md +12 -12
- package/bundles/ragents.reference/run-scripts/shared-actor-list/actors/shared-list/package.json +2 -2
- package/bundles/ragents.reference/run-scripts/shared-actor-list/actors/shared-list/src/contract.ts +3 -3
- package/bundles/ragents.reference/run-scripts/shared-actor-list/actors/shared-list/tests/program.test.ts +4 -4
- package/bundles/ragents.reference/run-scripts/shared-actor-list/package.json +1 -1
- package/bundles/ragents.reference/run-scripts/shared-actor-list/src/server.ts +11 -11
- package/bundles/ragents.reference/run-scripts/shared-actor-list/tests/helpers.ts +1 -1
- package/bundles/ragents.reference/run-scripts/shared-actor-list/tests/program.test.ts +13 -13
- package/bundles/ragents.reference/run-scripts/word-game/RUN.md +18 -18
- package/bundles/ragents.reference/run-scripts/word-game/package.json +2 -2
- package/bundles/ragents.reference/run-scripts/word-game/src/client.tsx +1 -1
- package/bundles/ragents.reference/run-scripts/word-game/src/contract.ts +2 -2
- package/bundles/ragents.reference/run-scripts/word-game/src/server.ts +16 -16
- package/bundles/ragents.reference/run-scripts/word-game/tests/program.test.ts +39 -39
- package/bundles/ragents.reference/skills/100-shared-actor-list/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/110-all-card-slots/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/150-editorial-workbench/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/160-learning-companion/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/170-photo-collection/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/180-decision-workbench/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/190-review-queue/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/20-circle-of-four/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/200-typescript-diagnostics/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/210-moderator-handover/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/220-actor-approval-list/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/230-shared-state-views/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/240-live-result-list/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/250-balcony-wizard/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/30-llm-without-runtime-knowledge/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/35-actor-input-fifo/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/40-subscription-matrix/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/50-subscription-removal/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/60-stop-in-the-circle/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/65-artifact-least-privilege/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/70-headless-counter/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/75-lsp-demo/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/80-actor-text-analysis/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/90-actor-notes/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/95-hello-world/SKILL.md +5 -5
- package/bundles/ragents.reference/skills/decision-brief/SKILL.md +24 -24
- package/bundles/ragents.reference/skills/learning-sprint/SKILL.md +24 -24
- package/bundles/ragents.reference/web/classes.json +1 -1
- package/bundles/ragents.reference/web/index.js +1 -1
- package/bundles/ragents.reference/web/index.js.map +2 -2
- package/bundles/ragents.todo/ragents-bundle.json +2 -2
- package/bundles/ragents.todo/server/index.js +5 -5
- package/bundles/ragents.todo/server/index.js.map +2 -2
- package/bundles/ragents.todo/web/classes.json +1 -1
- package/bundles/ragents.todo/web/index.js +1 -1
- package/bundles/ragents.todo/web/index.js.map +2 -2
- package/bundles/ragents.transcript/ragents-bundle.json +2 -2
- package/bundles/ragents.transcript/server/index.js +11 -11
- package/bundles/ragents.transcript/server/index.js.map +2 -2
- package/bundles/ragents.watch/ragents-bundle.json +2 -2
- package/bundles/ragents.watch/server/index.js +48 -48
- package/bundles/ragents.watch/server/index.js.map +2 -2
- package/bundles/ragents.workspace/ragents-bundle.json +2 -2
- package/bundles/ragents.workspace/server/index.js +83 -81
- package/bundles/ragents.workspace/server/index.js.map +2 -2
- package/bundles/ragents.workspace/web/classes.json +1 -1
- package/bundles/ragents.workspace/web/index.js +1 -1
- package/bundles/ragents.workspace/web/index.js.map +2 -2
- package/package.json +4 -4
- package/packages/agent/dist/core/model-runtime.d.ts +7 -2
- package/packages/agent/dist/core/tools/bash.d.ts +1 -1
- package/packages/agent/dist/index.d.ts +1 -1
- package/packages/agent/dist/loop/agent-loop.d.ts +2 -2
- package/packages/agent/src/core/compaction/utils.ts +1 -1
- package/packages/agent/src/core/model-runtime.ts +45 -5
- package/packages/agent/src/core/tools/bash.ts +1 -1
- package/packages/agent/src/index.ts +1 -1
- package/packages/agent/src/loop/agent-loop.ts +2 -2
- package/packages/ai/dist/models.d.ts +1 -0
- package/packages/ai/dist/models.generated.d.ts +4544 -983
- package/packages/ai/dist/providers/openrouter.models.d.ts +4544 -983
- package/packages/ai/src/api/ai-sdk.ts +33 -7
- package/packages/ai/src/api-registry.ts +1 -1
- package/packages/ai/src/index.ts +2 -2
- package/packages/ai/src/models.generated.ts +1 -1
- package/packages/ai/src/models.ts +1 -1
- package/packages/ai/src/providers/openrouter.models.ts +3723 -550
- package/packages/ragents/src/access.ts +12 -12
- package/packages/ragents/src/agents/actor-input.ts +33 -33
- package/packages/ragents/src/agents/catalog.ts +1 -1
- package/packages/ragents/src/agents/delivery.ts +17 -17
- package/packages/ragents/src/agents/plugins.ts +1 -1
- package/packages/ragents/src/agents/scheduler.ts +7 -7
- package/packages/ragents/src/agents/schemas.ts +1 -1
- package/packages/ragents/src/agents/tool-orientation.ts +4 -4
- package/packages/ragents/src/agents/tools.ts +20 -20
- package/packages/ragents/src/agents/toolset.ts +5 -5
- package/packages/ragents/src/agents/workspaces.ts +1 -1
- package/packages/ragents/src/domain/events.ts +1 -1
- package/packages/ragents/src/domain/model.ts +5 -5
- package/packages/ragents/src/drivers/agent-runtime.ts +1 -1
- package/packages/ragents/src/drivers/agent-turn.ts +4 -4
- package/packages/ragents/src/drivers/agent.ts +2 -2
- package/packages/ragents/src/drivers/attachments.ts +4 -4
- package/packages/ragents/src/http/contracts.ts +14 -14
- package/packages/ragents/src/http/methods.ts +6 -6
- package/packages/ragents/src/index.ts +1 -0
- package/packages/ragents/src/plugin-host.ts +162 -116
- package/packages/ragents/src/plugin-types.ts +29 -10
- package/packages/ragents/src/rpc/contract.ts +5 -5
- package/packages/ragents/src/rpc/contribution.ts +2 -2
- package/packages/ragents/src/rpc/peer.ts +11 -11
- package/packages/ragents/src/rpc/protocol.ts +2 -2
- package/packages/ragents/src/runtime/decisions/turns.ts +1 -1
- package/packages/ragents/src/runtime/journal.ts +10 -10
- package/packages/ragents/src/runtime/orchestration.ts +8 -8
- package/packages/ragents/src/runtime/stop.ts +2 -2
- package/packages/ragents/src/script/mediators.ts +35 -35
- package/packages/ragents/src/typescript/async-compiler.ts +14 -14
- package/packages/ragents/src/typescript/compiler-worker.ts +2 -2
- package/packages/ragents/src/typescript/compiler.ts +7 -7
- package/packages/ragents/src/typescript/snippet.ts +5 -5
- package/packages/workspace-executor/src/bash-launch.ts +13 -13
- package/packages/workspace-executor/src/commands.ts +18 -18
- package/packages/workspace-executor/src/context.ts +15 -15
- package/packages/workspace-executor/src/contributions.ts +35 -35
- package/packages/workspace-executor/src/errors.ts +1 -1
- package/packages/workspace-executor/src/executor.ts +15 -15
- package/packages/workspace-executor/src/files.ts +30 -30
- package/packages/workspace-executor/src/language-server/contract.ts +2 -2
- package/packages/workspace-executor/src/language-server/diagnostics.ts +4 -4
- package/packages/workspace-executor/src/language-server/host.ts +35 -35
- package/packages/workspace-executor/src/language-server/json-rpc.ts +4 -4
- package/packages/workspace-executor/src/language-server/module.ts +11 -11
- package/packages/workspace-executor/src/language-server/roots.ts +3 -3
- package/packages/workspace-executor/src/language-server/session.ts +15 -15
- package/packages/workspace-executor/src/language-server/workspace-solutions.ts +2 -2
- package/packages/workspace-executor/src/managed-process.ts +35 -7
- package/packages/workspace-executor/src/module.ts +8 -8
- package/packages/workspace-executor/src/modules.ts +3 -3
- package/packages/workspace-executor/src/paths.ts +11 -11
- package/packages/workspace-executor/src/process-sandbox.ts +3 -3
- package/packages/workspace-executor/src/processes/module.ts +3 -3
- package/packages/workspace-executor/src/processes/process-table.ts +20 -20
- package/packages/workspace-executor/src/processes/scanner.ts +3 -3
- package/packages/workspace-executor/src/processes/snapshot.ts +2 -2
- package/packages/workspace-executor/src/processes/terminator.ts +13 -13
- package/packages/workspace-executor/src/run-folders.ts +3 -3
- package/packages/workspace-executor/src/safe-environment.ts +4 -4
- package/packages/workspace-executor/src/sandbox-tools.ts +37 -31
- package/packages/workspace-executor/src/session-ident.ts +2 -2
- package/packages/workspace-executor/src/shell-platform.ts +2 -2
- package/packages/workspace-executor/src/tools.ts +5 -5
- package/plugins/ragents.activity/web/ActivityHeader.tsx +3 -3
- package/plugins/ragents.activity/web/activity.ts +2 -2
- package/plugins/ragents.actor-programs/server/access-projections.ts +31 -0
- package/plugins/ragents.actor-programs/server/agent-tools.ts +2 -2
- package/plugins/ragents.actor-programs/server/capability-resolver.ts +3 -3
- package/plugins/ragents.actor-programs/server/controls-template.ts +46 -46
- package/plugins/ragents.actor-programs/server/controls-tool.ts +4 -4
- package/plugins/ragents.actor-programs/server/index.ts +2 -0
- package/plugins/ragents.actor-programs/server/limits.ts +3 -3
- package/plugins/ragents.actor-programs/server/methods.ts +1 -1
- package/plugins/ragents.actor-programs/server/project-diagnostics.ts +8 -8
- package/plugins/ragents.actor-programs/server/routes.ts +8 -8
- package/plugins/ragents.actor-programs/server/runtime.ts +90 -90
- package/plugins/ragents.actor-programs/server/templates.ts +59 -59
- package/plugins/ragents.actor-programs/server/test-report.ts +5 -5
- package/plugins/ragents.actor-programs/server/tool-contributor.ts +1 -1
- package/plugins/ragents.actor-programs/web/ActorViewFrame.tsx +17 -17
- package/plugins/ragents.actor-programs/web/AppsPanel.tsx +26 -26
- package/plugins/ragents.actor-programs/web/EmbeddedApps.tsx +3 -3
- package/plugins/ragents.actor-programs/web/FullscreenHost.tsx +2 -2
- package/plugins/ragents.actor-programs/web/FunctionForm.tsx +16 -16
- package/plugins/ragents.actor-programs/web/ProgramSource.tsx +5 -5
- package/plugins/ragents.actor-programs/web/api.ts +36 -36
- package/plugins/ragents.actor-programs/web/bridge.ts +8 -8
- package/plugins/ragents.actor-programs/web/chat-state.ts +4 -4
- package/plugins/ragents.actor-programs/web/context.ts +1 -1
- package/plugins/ragents.actor-programs/web/function-input.ts +6 -6
- package/plugins/ragents.actor-programs/web/index.tsx +1 -1
- package/plugins/ragents.actor-programs/web/program-state.ts +4 -4
- package/plugins/ragents.ask/ask-payload.ts +1 -1
- package/plugins/ragents.ask/contract.ts +5 -5
- package/plugins/ragents.ask/server/answer-method.ts +1 -1
- package/plugins/ragents.ask/server/ask-service.ts +9 -9
- package/plugins/ragents.ask/server/ask-tool.ts +10 -10
- package/plugins/ragents.ask/server/contract.ts +5 -5
- package/plugins/ragents.ask/web/AskActionView.tsx +1 -1
- package/plugins/ragents.ask/web/QuestionCard.tsx +22 -22
- package/plugins/ragents.ask/web/index.tsx +2 -8
- package/plugins/ragents.browser/executor/contract.ts +6 -6
- package/plugins/ragents.browser/executor/index.ts +1 -1
- package/plugins/ragents.browser/executor/module.ts +6 -6
- package/plugins/ragents.browser/executor/pages.ts +32 -32
- package/plugins/ragents.browser/executor/playwright.ts +8 -8
- package/plugins/ragents.browser/provision.ts +7 -7
- package/plugins/ragents.browser/server/browser.ts +14 -14
- package/plugins/ragents.browser/server/contract.ts +1 -1
- package/plugins/ragents.browser/server/index.ts +1 -1
- package/plugins/ragents.browser/server/tools.ts +14 -14
- package/plugins/ragents.browser/skills/browser-testing/SKILL.md +30 -30
- package/plugins/ragents.documents/contract.ts +2 -2
- package/plugins/ragents.documents/prompt.hbs +1 -1
- package/plugins/ragents.documents/server/document-write-tool.ts +12 -12
- package/plugins/ragents.documents/server/files-route.ts +6 -6
- package/plugins/ragents.documents/server/show-document-tool.ts +26 -26
- package/plugins/ragents.documents/server/store.ts +1 -1
- package/plugins/ragents.documents/web/DocumentViewer.tsx +37 -37
- package/plugins/ragents.documents/web/index.tsx +11 -11
- package/plugins/ragents.lsp-fsharp/executor.ts +7 -7
- package/plugins/ragents.lsp-fsharp/provision.ts +7 -7
- package/plugins/ragents.lsp-roslyn/executor.ts +5 -5
- package/plugins/ragents.lsp-roslyn/provision.ts +4 -4
- package/plugins/ragents.lsp-roslyn/server/index.ts +5 -5
- package/plugins/ragents.lsp-roslyn/server/solution-on-start.ts +13 -13
- package/plugins/ragents.lsp-typescript/executor.ts +3 -3
- package/plugins/ragents.model-relay/server/config.ts +6 -2
- package/plugins/ragents.model-relay/server/index.ts +2 -2
- package/plugins/ragents.model-relay/server/relay.ts +23 -22
- package/plugins/ragents.orchestration/contract.ts +8 -8
- package/plugins/ragents.orchestration/server/index.ts +4 -4
- package/plugins/ragents.orchestration/server/run-stop-tool.ts +3 -3
- package/plugins/ragents.orchestration/server/surface-tool.ts +5 -5
- package/plugins/ragents.orchestration/tiled-layout.ts +11 -11
- package/plugins/ragents.orchestration/web/ActorChat.tsx +2 -2
- package/plugins/ragents.orchestration/web/ActorChatControls.tsx +4 -4
- package/plugins/ragents.orchestration/web/ActorChatPreview.tsx +1 -1
- package/plugins/ragents.orchestration/web/ActorPopout.tsx +1 -1
- package/plugins/ragents.orchestration/web/ActorShortcut.tsx +6 -6
- package/plugins/ragents.orchestration/web/ActorSurfaceControls.tsx +15 -15
- package/plugins/ragents.orchestration/web/ActorTile.tsx +1 -1
- package/plugins/ragents.orchestration/web/Center.tsx +5 -5
- package/plugins/ragents.orchestration/web/DocumentsSection.tsx +2 -2
- package/plugins/ragents.orchestration/web/ExecutionsPanel.tsx +15 -15
- package/plugins/ragents.orchestration/web/FlowInspector.tsx +103 -103
- package/plugins/ragents.orchestration/web/JournalStatus.tsx +11 -11
- package/plugins/ragents.orchestration/web/MaterialBody.tsx +2 -2
- package/plugins/ragents.orchestration/web/StopRunButton.tsx +6 -6
- package/plugins/ragents.orchestration/web/TiledSurface.tsx +9 -9
- package/plugins/ragents.orchestration/web/actor-header-settings.ts +5 -5
- package/plugins/ragents.orchestration/web/constants.ts +2 -2
- package/plugins/ragents.orchestration/web/executions.ts +6 -6
- package/plugins/ragents.orchestration/web/format.ts +1 -1
- package/plugins/ragents.orchestration/web/index.tsx +2 -2
- package/plugins/ragents.orchestration/web/run-panel/AddresseeControl.tsx +7 -7
- package/plugins/ragents.orchestration/web/run-panel/AddresseeTree.tsx +8 -8
- package/plugins/ragents.orchestration/web/run-panel/RunPanel.tsx +29 -28
- package/plugins/ragents.orchestration/web/run-panel/RunPanelSettings.tsx +7 -7
- package/plugins/ragents.orchestration/web/run-panel/addressee-tree.ts +13 -13
- package/plugins/ragents.orchestration/web/run-panel/run-panel-actors.ts +3 -3
- package/plugins/ragents.orchestration/web/run-panel/run-panel-settings.ts +2 -2
- package/plugins/ragents.orchestration/web/run-panel/run-panel-startup.ts +3 -3
- package/plugins/ragents.orchestration/web/run-panel/run-panel-state.ts +7 -7
- package/plugins/ragents.orchestration/web/run-panel/sheet-status.ts +10 -10
- package/plugins/ragents.orchestration/web/surface-startup.ts +8 -8
- package/plugins/ragents.orchestration/web/surface-view-settings.ts +1 -1
- package/plugins/ragents.orchestration/web/tiled-view-settings.ts +1 -1
- package/plugins/ragents.overseer/contract.ts +20 -20
- package/plugins/ragents.overseer/server/api.ts +8 -8
- package/plugins/ragents.overseer/server/coordinator-prompt.ts +10 -10
- package/plugins/ragents.overseer/server/coordinator.ts +4 -4
- package/plugins/ragents.overseer/server/index.ts +24 -24
- package/plugins/ragents.overseer/server/orientation.ts +8 -8
- package/plugins/ragents.overseer/server/quick-answer.ts +9 -9
- package/plugins/ragents.overseer/server/run-directory.ts +5 -5
- package/plugins/ragents.overseer/server/settings.ts +6 -6
- package/plugins/ragents.overseer/server/user-location.ts +16 -16
- package/plugins/ragents.overseer/web/ModelSettings.tsx +9 -9
- package/plugins/ragents.overseer/web/index.tsx +20 -20
- package/plugins/ragents.overseer/web/model-settings.ts +1 -1
- package/plugins/ragents.overseer/web/quick-answers.ts +2 -2
- package/plugins/ragents.processes/contract.ts +5 -5
- package/plugins/ragents.processes/server/methods.ts +4 -4
- package/plugins/ragents.processes/server/observer.ts +8 -8
- package/plugins/ragents.processes/server/run-processes.ts +2 -2
- package/plugins/ragents.processes/web/ProcessHeader.tsx +10 -10
- package/plugins/ragents.processes/web/processes.ts +10 -10
- package/plugins/ragents.product/server/config.ts +1 -1
- package/plugins/ragents.product/server/index.ts +4 -4
- package/plugins/ragents.product/server/runtime.ts +9 -10
- package/plugins/ragents.product/web/index.tsx +1 -1
- package/plugins/ragents.profile-distribution/contract.ts +10 -10
- package/plugins/ragents.profile-distribution/server/archive.ts +20 -20
- package/plugins/ragents.profile-distribution/server/config.ts +2 -2
- package/plugins/ragents.profile-distribution/server/index.ts +4 -4
- package/plugins/ragents.reference/examples.ts +27 -27
- package/plugins/ragents.reference/run-scripts/balcony-wizard/RUN.md +19 -19
- package/plugins/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/package.json +2 -2
- package/plugins/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/src/client.tsx +14 -14
- package/plugins/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/src/conversation.ts +2 -2
- package/plugins/ragents.reference/run-scripts/balcony-wizard/actors/balcony-app/tests/conversation.test.ts +49 -49
- package/plugins/ragents.reference/run-scripts/balcony-wizard/package.json +1 -1
- package/plugins/ragents.reference/run-scripts/balcony-wizard/src/server.ts +9 -9
- package/plugins/ragents.reference/run-scripts/balcony-wizard/tests/program.test.ts +9 -9
- package/plugins/ragents.reference/run-scripts/conversation-circle/RUN.md +7 -7
- package/plugins/ragents.reference/run-scripts/conversation-circle/package.json +1 -1
- package/plugins/ragents.reference/run-scripts/conversation-circle/src/server.ts +13 -13
- package/plugins/ragents.reference/run-scripts/conversation-circle/tests/helpers.ts +1 -1
- package/plugins/ragents.reference/run-scripts/conversation-circle/tests/program.test.ts +8 -8
- package/plugins/ragents.reference/run-scripts/learning-afternoon/RUN.md +16 -16
- package/plugins/ragents.reference/run-scripts/learning-afternoon/package.json +1 -1
- package/plugins/ragents.reference/run-scripts/learning-afternoon/prompts/experiment.md +1 -1
- package/plugins/ragents.reference/run-scripts/learning-afternoon/prompts/helper.md +3 -3
- package/plugins/ragents.reference/run-scripts/learning-afternoon/prompts/quiz.md +1 -1
- package/plugins/ragents.reference/run-scripts/learning-afternoon/src/server.ts +9 -9
- package/plugins/ragents.reference/run-scripts/learning-afternoon/tests/program.test.ts +39 -39
- package/plugins/ragents.reference/run-scripts/moderated-round/RUN.md +7 -7
- package/plugins/ragents.reference/run-scripts/moderated-round/package.json +1 -1
- package/plugins/ragents.reference/run-scripts/moderated-round/src/server.ts +9 -9
- package/plugins/ragents.reference/run-scripts/moderated-round/tests/helpers.ts +1 -1
- package/plugins/ragents.reference/run-scripts/moderated-round/tests/program.test.ts +6 -6
- package/plugins/ragents.reference/run-scripts/shared-actor-list/RUN.md +12 -12
- package/plugins/ragents.reference/run-scripts/shared-actor-list/actors/shared-list/package.json +2 -2
- package/plugins/ragents.reference/run-scripts/shared-actor-list/actors/shared-list/src/contract.ts +3 -3
- package/plugins/ragents.reference/run-scripts/shared-actor-list/actors/shared-list/tests/program.test.ts +4 -4
- package/plugins/ragents.reference/run-scripts/shared-actor-list/package.json +1 -1
- package/plugins/ragents.reference/run-scripts/shared-actor-list/src/server.ts +11 -11
- package/plugins/ragents.reference/run-scripts/shared-actor-list/tests/helpers.ts +1 -1
- package/plugins/ragents.reference/run-scripts/shared-actor-list/tests/program.test.ts +13 -13
- package/plugins/ragents.reference/run-scripts/word-game/RUN.md +18 -18
- package/plugins/ragents.reference/run-scripts/word-game/package.json +2 -2
- package/plugins/ragents.reference/run-scripts/word-game/src/client.tsx +1 -1
- package/plugins/ragents.reference/run-scripts/word-game/src/contract.ts +2 -2
- package/plugins/ragents.reference/run-scripts/word-game/src/server.ts +16 -16
- package/plugins/ragents.reference/run-scripts/word-game/tests/program.test.ts +39 -39
- package/plugins/ragents.reference/skills/100-shared-actor-list/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/110-all-card-slots/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/150-editorial-workbench/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/160-learning-companion/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/170-photo-collection/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/180-decision-workbench/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/190-review-queue/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/20-circle-of-four/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/200-typescript-diagnostics/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/210-moderator-handover/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/220-actor-approval-list/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/230-shared-state-views/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/240-live-result-list/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/250-balcony-wizard/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/30-llm-without-runtime-knowledge/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/35-actor-input-fifo/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/40-subscription-matrix/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/50-subscription-removal/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/60-stop-in-the-circle/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/65-artifact-least-privilege/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/70-headless-counter/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/75-lsp-demo/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/80-actor-text-analysis/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/90-actor-notes/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/95-hello-world/SKILL.md +5 -5
- package/plugins/ragents.reference/skills/decision-brief/SKILL.md +24 -24
- package/plugins/ragents.reference/skills/learning-sprint/SKILL.md +24 -24
- package/plugins/ragents.reference/walkthroughs.ts +128 -128
- package/plugins/ragents.reference/web/StartGuides.tsx +23 -23
- package/plugins/ragents.todo/server/todo-tool.ts +6 -6
- package/plugins/ragents.todo/web/TodoSection.tsx +1 -1
- package/plugins/ragents.transcript/server/transcript.ts +11 -11
- package/plugins/ragents.watch/server/condition.ts +4 -4
- package/plugins/ragents.watch/server/functions.ts +27 -27
- package/plugins/ragents.watch/server/observation.ts +2 -2
- package/plugins/ragents.watch/server/service.ts +14 -14
- package/plugins/ragents.workspace/client/transport.ts +1 -1
- package/plugins/ragents.workspace/client/workspace-client.ts +62 -49
- package/plugins/ragents.workspace/contract.ts +46 -46
- package/plugins/ragents.workspace/server/binding.ts +20 -20
- package/plugins/ragents.workspace/server/browse-route.ts +8 -8
- package/plugins/ragents.workspace/server/clients.ts +42 -42
- package/plugins/ragents.workspace/server/config.ts +8 -5
- package/plugins/ragents.workspace/server/index.ts +5 -4
- package/plugins/ragents.workspace/server/runtime.ts +26 -26
- package/plugins/ragents.workspace/server/shell-platform.ts +1 -1
- package/plugins/ragents.workspace/web/FileBrowser.tsx +10 -10
- package/plugins/ragents.workspace/web/WorkspaceBinding.tsx +24 -24
- package/plugins/ragents.workspace/web/index.tsx +1 -1
- package/ragents.config.core.ts +1 -1
- package/ragents.config.developer.ts +3 -3
- package/ragents.config.showcase.ts +2 -2
- package/scripts/agent/agent-cli.ts +96 -96
- package/scripts/agent/journal.ts +5 -5
- package/scripts/agent/turn-control.ts +4 -4
- package/scripts/package/build-package.ts +29 -29
- package/scripts/package/host-links.mjs +3 -3
- package/scripts/package/publish-package.ts +29 -29
- package/scripts/package/ragents.mjs +19 -19
- package/scripts/plugin/build-builtin-plugins.ts +5 -5
- package/scripts/plugin/plugin-cli.ts +14 -14
- package/scripts/provision/run-provision.ts +14 -15
- package/scripts/remote/connect.ts +46 -46
- package/scripts/remote/start.ts +18 -18
- package/scripts/workspace-client/run-workspace-client.ts +23 -23
- package/apps/web/dist/assets/main-C7JeZFjs.js +0 -6
- package/apps/web/dist/assets/mermaid-HWGCJPDP-DfsU5ofC.js +0 -478
- package/apps/web/dist/assets/runPanel-ZT6TPDLM.js +0 -21
- package/bundles/ragents.ask/server/chunks/chunk-PDJO75SQ.js.map +0 -7
- package/bundles/ragents.ask/web/chunks/chunk-4VXWWEG7.js +0 -2
- package/bundles/ragents.ask/web/chunks/chunk-4VXWWEG7.js.map +0 -7
- package/bundles/ragents.ask/web/chunks/chunk-VUBJDIKQ.js +0 -2
- package/bundles/ragents.ask/web/chunks/chunk-VUBJDIKQ.js.map +0 -7
- package/bundles/ragents.ask/web/chunks/chunk-WFN4374U.js.map +0 -7
- package/bundles/ragents.orchestration/web/chunks/chunk-OQYCNYXN.js +0 -2
- package/plugins/ragents.ask/web/QuestionSection.tsx +0 -48
- /package/bundles/ragents.orchestration/web/chunks/{chunk-OSKPH6SZ.js.map → chunk-CFMJD5ZI.js.map} +0 -0
- /package/bundles/ragents.orchestration/web/chunks/{chunk-ODMMQGX2.js.map → chunk-UCIMT2R4.js.map} +0 -0
|
@@ -11,7 +11,9 @@ import type { AgentProfile, CatalogModel } from "./agents/catalog.ts";
|
|
|
11
11
|
import type { ToolContributor } from "./agents/plugins.ts";
|
|
12
12
|
import { describeToolAvailability, type RunFunction } from "./agents/tools.ts";
|
|
13
13
|
import type { ChannelContribution, ChannelDescriptor, MethodContribution, MethodDescriptor } from "./rpc/contribution.ts";
|
|
14
|
+
import type { PluginState } from "./domain/model.ts";
|
|
14
15
|
import type {
|
|
16
|
+
AccessProjectionContribution,
|
|
15
17
|
AgentAudience,
|
|
16
18
|
HttpRouteContribution,
|
|
17
19
|
OperationContext,
|
|
@@ -19,6 +21,7 @@ import type {
|
|
|
19
21
|
RegisteredOperationDescriptor,
|
|
20
22
|
AgentContribution,
|
|
21
23
|
AgentContributionContext,
|
|
24
|
+
PluginChatEvent,
|
|
22
25
|
PluginConfigDescriptor,
|
|
23
26
|
PluginManifest,
|
|
24
27
|
PluginRegistration,
|
|
@@ -76,7 +79,7 @@ class ContributionRegistry<T extends { id: string }> {
|
|
|
76
79
|
for (const value of values) {
|
|
77
80
|
const existing = this.#entries.find((entry) => entry.value.id === value.id);
|
|
78
81
|
if (existing) {
|
|
79
|
-
throw new Error(`${this.#kind} ${value.id}
|
|
82
|
+
throw new Error(`${this.#kind} ${value.id} is already provided by ${existing.owner}`);
|
|
80
83
|
}
|
|
81
84
|
this.#entries.push({ owner, value });
|
|
82
85
|
}
|
|
@@ -87,12 +90,12 @@ class ContributionRegistry<T extends { id: string }> {
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
/**
|
|
93
|
+
/** The run condition per plugin; a plugin without one applies in every run. */
|
|
91
94
|
export class RunConditionRegistry {
|
|
92
95
|
readonly #conditions = new Map<string, RunCondition>();
|
|
93
96
|
|
|
94
97
|
register(owner: string, condition: RunCondition): void {
|
|
95
|
-
if (this.#conditions.has(owner)) throw new Error(`Plugin ${owner}
|
|
98
|
+
if (this.#conditions.has(owner)) throw new Error(`Plugin ${owner} already has a run condition`);
|
|
96
99
|
this.#conditions.set(owner, condition);
|
|
97
100
|
}
|
|
98
101
|
|
|
@@ -106,7 +109,7 @@ export class RunConditionRegistry {
|
|
|
106
109
|
}
|
|
107
110
|
|
|
108
111
|
export class MethodContributionRegistry {
|
|
109
|
-
readonly #methods = new ContributionRegistry<{ id: string; contribution: MethodContribution }>("
|
|
112
|
+
readonly #methods = new ContributionRegistry<{ id: string; contribution: MethodContribution }>("Method");
|
|
110
113
|
|
|
111
114
|
register(owner: string, contributions: readonly MethodContribution[]): void {
|
|
112
115
|
this.#methods.register(owner, contributions.map((contribution) => ({ id: contribution.contract.id, contribution })));
|
|
@@ -126,7 +129,7 @@ export class MethodContributionRegistry {
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
export class ChannelContributionRegistry {
|
|
129
|
-
readonly #channels = new ContributionRegistry<{ id: string; contribution: ChannelContribution }>("
|
|
132
|
+
readonly #channels = new ContributionRegistry<{ id: string; contribution: ChannelContribution }>("Channel");
|
|
130
133
|
|
|
131
134
|
register(owner: string, contributions: readonly ChannelContribution[]): void {
|
|
132
135
|
this.#channels.register(owner, contributions.map((contribution) => ({ id: contribution.contract.id, contribution })));
|
|
@@ -164,7 +167,7 @@ export class HttpContributionRegistry {
|
|
|
164
167
|
const missing = rights.find((right) => !access.can(right));
|
|
165
168
|
if (missing) {
|
|
166
169
|
response.writeHead(403, { "Content-Type": "application/json", "Cache-Control": "no-store" });
|
|
167
|
-
response.end(JSON.stringify({ error: `
|
|
170
|
+
response.end(JSON.stringify({ error: `The right ${missing} is missing.`, code: "access-denied", right: missing }));
|
|
168
171
|
return true;
|
|
169
172
|
}
|
|
170
173
|
await route.value.handle({ request, response, url, access });
|
|
@@ -177,13 +180,13 @@ export class OperationContributionRegistry {
|
|
|
177
180
|
|
|
178
181
|
register(owner: string, operations: readonly OperationContribution[]): void {
|
|
179
182
|
for (const operation of operations) {
|
|
180
|
-
if (!OPERATION_ID.test(operation.id)) throw new Error(`
|
|
181
|
-
if (!operation.label.trim()) throw new Error(`Operation ${operation.id}
|
|
182
|
-
if (!operation.description.trim()) throw new Error(`Operation ${operation.id}
|
|
183
|
+
if (!OPERATION_ID.test(operation.id)) throw new Error(`Invalid operation id: ${operation.id}`);
|
|
184
|
+
if (!operation.label.trim()) throw new Error(`Operation ${operation.id} has no label`);
|
|
185
|
+
if (!operation.description.trim()) throw new Error(`Operation ${operation.id} has no description`);
|
|
183
186
|
if (operation.operator !== "direct" && operation.operator !== "confirm" && operation.operator !== "unavailable") {
|
|
184
|
-
throw new Error(`Operation ${operation.id}
|
|
187
|
+
throw new Error(`Operation ${operation.id} has an invalid operator policy`);
|
|
185
188
|
}
|
|
186
|
-
if (typeof operation.execute !== "function") throw new Error(`Operation ${operation.id}
|
|
189
|
+
if (typeof operation.execute !== "function") throw new Error(`Operation ${operation.id} has no execute function`);
|
|
187
190
|
}
|
|
188
191
|
this.#operations.register(owner, operations);
|
|
189
192
|
}
|
|
@@ -204,16 +207,16 @@ export class OperationContributionRegistry {
|
|
|
204
207
|
|
|
205
208
|
async invoke(id: string, context: OperationContext, input: unknown): Promise<JsonValue> {
|
|
206
209
|
const operation = this.#operations.entries().find(({ value }) => value.id === id)?.value;
|
|
207
|
-
if (!operation) throw new Error(`Operation ${id}
|
|
210
|
+
if (!operation) throw new Error(`Operation ${id} is not registered`);
|
|
208
211
|
assertJsonValue(input, `Operation ${id} input`);
|
|
209
212
|
|
|
210
213
|
if (!Value.Check(operation.schema, input)) {
|
|
211
|
-
throw new Error(`
|
|
214
|
+
throw new Error(`Invalid input for operation ${id}: ${schemaComplaints(operation.schema, input)}`);
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
if (context.principal.kind === "operator") {
|
|
215
218
|
if (operation.operator === "unavailable") {
|
|
216
|
-
throw new Error(`Operation ${id}
|
|
219
|
+
throw new Error(`Operation ${id} is not available to the operator`);
|
|
217
220
|
}
|
|
218
221
|
if (operation.operator === "confirm") {
|
|
219
222
|
const confirmation = "operatorConfirmation" in context ? context.operatorConfirmation : undefined;
|
|
@@ -221,7 +224,7 @@ export class OperationContributionRegistry {
|
|
|
221
224
|
|| confirmation.operationId !== id
|
|
222
225
|
|| confirmation.invocationId !== context.invocationId
|
|
223
226
|
|| confirmation.inputHash !== canonicalHash(input)) {
|
|
224
|
-
throw new Error(`Operation ${id}
|
|
227
|
+
throw new Error(`Operation ${id} requires a confirmation bound to this call`);
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
}
|
|
@@ -229,7 +232,7 @@ export class OperationContributionRegistry {
|
|
|
229
232
|
context.signal.throwIfAborted();
|
|
230
233
|
const result = await operation.execute(context, input);
|
|
231
234
|
if (!Value.Check(operation.resultSchema, result)) {
|
|
232
|
-
throw new Error(`
|
|
235
|
+
throw new Error(`Invalid result of operation ${id}: ${schemaComplaints(operation.resultSchema, result, "result")}`);
|
|
233
236
|
}
|
|
234
237
|
assertJsonValue(result, `Operation ${id} output`);
|
|
235
238
|
return result;
|
|
@@ -237,7 +240,7 @@ export class OperationContributionRegistry {
|
|
|
237
240
|
}
|
|
238
241
|
|
|
239
242
|
export class AgentContributionRegistry {
|
|
240
|
-
readonly #contributions = new ContributionRegistry<AgentContribution>("Agent
|
|
243
|
+
readonly #contributions = new ContributionRegistry<AgentContribution>("Agent contribution");
|
|
241
244
|
readonly #conditions: RunConditionRegistry;
|
|
242
245
|
|
|
243
246
|
constructor(conditions = new RunConditionRegistry()) {
|
|
@@ -247,7 +250,7 @@ export class AgentContributionRegistry {
|
|
|
247
250
|
register(owner: string, contributions: readonly AgentContribution[]): void {
|
|
248
251
|
for (const contribution of contributions) {
|
|
249
252
|
if (!contribution.beforeModelCall && !contribution.afterToolCall) {
|
|
250
|
-
throw new Error(`Agent
|
|
253
|
+
throw new Error(`Agent contribution ${contribution.id} has no hook`);
|
|
251
254
|
}
|
|
252
255
|
}
|
|
253
256
|
this.#contributions.register(owner, contributions);
|
|
@@ -282,7 +285,7 @@ export class ToolContributionRegistry {
|
|
|
282
285
|
for (const contributor of contributors) {
|
|
283
286
|
const existing = this.#contributors.find((entry) => entry.value.name === contributor.name);
|
|
284
287
|
if (existing) {
|
|
285
|
-
throw new Error(`
|
|
288
|
+
throw new Error(`Tool contribution ${contributor.name} is already provided by ${existing.owner}`);
|
|
286
289
|
}
|
|
287
290
|
this.#contributors.push({ owner, value: contributor });
|
|
288
291
|
}
|
|
@@ -327,7 +330,7 @@ export class ToolContributionRegistry {
|
|
|
327
330
|
}
|
|
328
331
|
|
|
329
332
|
export class PromptContributionRegistry {
|
|
330
|
-
readonly #prompts = new ContributionRegistry<PromptContribution>("Prompt
|
|
333
|
+
readonly #prompts = new ContributionRegistry<PromptContribution>("Prompt contribution");
|
|
331
334
|
readonly #conditions: RunConditionRegistry;
|
|
332
335
|
|
|
333
336
|
constructor(conditions = new RunConditionRegistry()) {
|
|
@@ -368,7 +371,7 @@ export class PromptContributionRegistry {
|
|
|
368
371
|
})));
|
|
369
372
|
}
|
|
370
373
|
|
|
371
|
-
/**
|
|
374
|
+
/** The contributions that read differently for this run than in the snapshot; an empty text is missing there, everything else stays the rendered text. */
|
|
372
375
|
runOverrides(runId: string): ReadonlyMap<string, string> {
|
|
373
376
|
return new Map([...this.#prompts.entries()].flatMap(({ owner, value }) => {
|
|
374
377
|
if (!this.#conditions.applies(owner, runId)) return [[value.id, ""] as const];
|
|
@@ -383,7 +386,7 @@ export class PromptContributionRegistry {
|
|
|
383
386
|
}
|
|
384
387
|
|
|
385
388
|
export class SkillContributionRegistry {
|
|
386
|
-
readonly #skills = new ContributionRegistry<SkillContribution>("Skill
|
|
389
|
+
readonly #skills = new ContributionRegistry<SkillContribution>("Skill contribution");
|
|
387
390
|
readonly #conditions: RunConditionRegistry;
|
|
388
391
|
|
|
389
392
|
constructor(conditions = new RunConditionRegistry()) {
|
|
@@ -394,10 +397,10 @@ export class SkillContributionRegistry {
|
|
|
394
397
|
for (const skill of skills) {
|
|
395
398
|
const audiences = skill.audiences ?? [];
|
|
396
399
|
if (new Set(audiences).size !== audiences.length) {
|
|
397
|
-
throw new Error(`Skill
|
|
400
|
+
throw new Error(`Skill contribution ${skill.id} contains an audience more than once`);
|
|
398
401
|
}
|
|
399
402
|
if (audiences.some((audience) => audience !== "coordinator" && audience !== "agent")) {
|
|
400
|
-
throw new Error(`Skill
|
|
403
|
+
throw new Error(`Skill contribution ${skill.id} contains an invalid audience`);
|
|
401
404
|
}
|
|
402
405
|
}
|
|
403
406
|
this.#skills.register(owner, skills);
|
|
@@ -407,19 +410,19 @@ export class SkillContributionRegistry {
|
|
|
407
410
|
return this.resolve(undefined);
|
|
408
411
|
}
|
|
409
412
|
|
|
410
|
-
/**
|
|
413
|
+
/** A skill name determines its skill across the whole profile, across audiences too; two folders with the same name fail at startup. */
|
|
411
414
|
async assertUniqueNames(): Promise<void> {
|
|
412
415
|
const paths = await this.global();
|
|
413
416
|
for (const name of new Set(paths.map(skillNameOf))) {
|
|
414
417
|
const named = paths.filter((entry) => skillNameOf(entry) === name);
|
|
415
|
-
if (named.length > 1) throw new Error(`
|
|
418
|
+
if (named.length > 1) throw new Error(`The skill name ${name} is used more than once in the profile: ${named.join(", ")}`);
|
|
416
419
|
}
|
|
417
420
|
}
|
|
418
421
|
|
|
419
422
|
async resolve(context: AgentContributionContext | undefined): Promise<readonly string[]> {
|
|
420
423
|
const paths = (await this.describe(context)).flatMap((entry) => entry.paths);
|
|
421
424
|
const unique = new Set(paths);
|
|
422
|
-
if (unique.size !== paths.length) throw new Error("
|
|
425
|
+
if (unique.size !== paths.length) throw new Error("An agent skill path is registered more than once");
|
|
423
426
|
return [...unique];
|
|
424
427
|
}
|
|
425
428
|
|
|
@@ -442,52 +445,52 @@ const SCRIPT_HANDLE = /^[a-z0-9][a-z0-9-]*$/;
|
|
|
442
445
|
|
|
443
446
|
const requireText = (entry: { id: unknown }, value: unknown, field: string): void => {
|
|
444
447
|
if (typeof value !== "string" || !value.trim()) {
|
|
445
|
-
throw new Error(`
|
|
448
|
+
throw new Error(`Template ${String(entry.id)} has no valid ${field}`);
|
|
446
449
|
}
|
|
447
450
|
};
|
|
448
451
|
|
|
449
452
|
const assertKnownFields = (entry: { id: unknown }, value: object, fields: readonly string[], label: string): void => {
|
|
450
453
|
const unknown = Object.keys(value).filter((field) => !fields.includes(field));
|
|
451
454
|
if (unknown.length > 0) {
|
|
452
|
-
throw new Error(`${label} ${String(entry.id)}
|
|
455
|
+
throw new Error(`${label} ${String(entry.id)} contains unknown fields: ${unknown.join(", ")}`);
|
|
453
456
|
}
|
|
454
457
|
};
|
|
455
458
|
|
|
456
459
|
const validateProgramFiles = (entry: StartEntryContribution, files: unknown): void => {
|
|
457
460
|
if (!Array.isArray(files) || files.length === 0)
|
|
458
|
-
throw new Error(`Run
|
|
461
|
+
throw new Error(`Run script ${entry.id}: files needs package files`);
|
|
459
462
|
const names = new Set<string>();
|
|
460
463
|
for (const file of files) {
|
|
461
464
|
if (typeof file !== "object" || file === null || typeof file.path !== "string" || typeof file.content !== "string")
|
|
462
|
-
throw new Error(`Run
|
|
463
|
-
assertKnownFields(entry, file, ["path", "content"], "
|
|
465
|
+
throw new Error(`Run script ${entry.id}: every file needs path and content`);
|
|
466
|
+
assertKnownFields(entry, file, ["path", "content"], "Package file");
|
|
464
467
|
if (!file.path || file.path.includes("\\") || file.path.includes("\0") || path.posix.isAbsolute(file.path)
|
|
465
468
|
|| file.path.split("/").some((part: string) => !part || part === "." || part === ".."))
|
|
466
|
-
throw new Error(`Run
|
|
467
|
-
if (names.has(file.path)) throw new Error(`Run
|
|
469
|
+
throw new Error(`Run script ${entry.id}: invalid package path ${file.path}`);
|
|
470
|
+
if (names.has(file.path)) throw new Error(`Run script ${entry.id}: file ${file.path} is duplicated`);
|
|
468
471
|
names.add(file.path);
|
|
469
472
|
}
|
|
470
|
-
if (!names.has("package.json")) throw new Error(`Run
|
|
473
|
+
if (!names.has("package.json")) throw new Error(`Run script ${entry.id}: package.json is missing`);
|
|
471
474
|
};
|
|
472
475
|
|
|
473
476
|
const validateScriptPackage = (entry: StartEntryContribution, script: unknown): void => {
|
|
474
477
|
if (typeof script !== "object" || script === null)
|
|
475
|
-
throw new Error(`
|
|
476
|
-
assertKnownFields(entry, script, ["handle", "coordinator", "files", "programs"], "Run
|
|
478
|
+
throw new Error(`Template ${entry.id} has no run script package`);
|
|
479
|
+
assertKnownFields(entry, script, ["handle", "coordinator", "files", "programs"], "Run script");
|
|
477
480
|
const value = script as Record<string, unknown>;
|
|
478
481
|
if (typeof value.handle !== "string" || !SCRIPT_HANDLE.test(value.handle))
|
|
479
|
-
throw new Error(`Run
|
|
482
|
+
throw new Error(`Run script ${entry.id}: handle must be a handle like roundtable (lowercase letters, digits, hyphen)`);
|
|
480
483
|
if (typeof value.coordinator !== "boolean")
|
|
481
|
-
throw new Error(`Run
|
|
484
|
+
throw new Error(`Run script ${entry.id}: coordinator must be true or false`);
|
|
482
485
|
validateProgramFiles(entry, value.files);
|
|
483
|
-
if (!Array.isArray(value.programs)) throw new Error(`Run
|
|
486
|
+
if (!Array.isArray(value.programs)) throw new Error(`Run script ${entry.id}: programs must be a list`);
|
|
484
487
|
const names = new Set<string>();
|
|
485
488
|
for (const program of value.programs) {
|
|
486
489
|
if (typeof program !== "object" || program === null || typeof program.name !== "string" || !SCRIPT_HANDLE.test(program.name))
|
|
487
|
-
throw new Error(`Run
|
|
488
|
-
assertKnownFields(entry, program, ["name", "files"], "Actor
|
|
490
|
+
throw new Error(`Run script ${entry.id}: invalid program name`);
|
|
491
|
+
assertKnownFields(entry, program, ["name", "files"], "Actor program");
|
|
489
492
|
if (program.name === value.handle || names.has(program.name))
|
|
490
|
-
throw new Error(`Run
|
|
493
|
+
throw new Error(`Run script ${entry.id}: program ${program.name} is duplicated`);
|
|
491
494
|
names.add(program.name);
|
|
492
495
|
validateProgramFiles(entry, program.files);
|
|
493
496
|
}
|
|
@@ -497,11 +500,11 @@ const validateFixedStartOptions = (entry: StartEntryContribution): void => {
|
|
|
497
500
|
const fixed: unknown = entry.fixedStartOptions;
|
|
498
501
|
if (fixed === undefined) return;
|
|
499
502
|
if (typeof fixed !== "object" || fixed === null || Array.isArray(fixed) || Object.keys(fixed).length === 0) {
|
|
500
|
-
throw new Error(`
|
|
503
|
+
throw new Error(`Template ${entry.id}: fixedStartOptions must fix at least one start option to a value`);
|
|
501
504
|
}
|
|
502
505
|
for (const [optionId, value] of Object.entries(fixed)) {
|
|
503
|
-
if (!START_OPTION_ID.test(optionId)) throw new Error(`
|
|
504
|
-
assertJsonValue(value, `
|
|
506
|
+
if (!START_OPTION_ID.test(optionId)) throw new Error(`Template ${entry.id} fixes the invalid start option id ${optionId}`);
|
|
507
|
+
assertJsonValue(value, `Template ${entry.id}: fixedStartOptions.${optionId}`);
|
|
505
508
|
}
|
|
506
509
|
};
|
|
507
510
|
|
|
@@ -509,44 +512,44 @@ const validateStartEntry = (entry: StartEntryContribution): void => {
|
|
|
509
512
|
const base = ["id", "title", "description", "order", "guide", "tags", "fixedStartOptions", "action"];
|
|
510
513
|
for (const field of ["id", "title", "description"] as const) requireText(entry, entry[field], field);
|
|
511
514
|
if (entry.order !== undefined && (typeof entry.order !== "number" || !Number.isFinite(entry.order))) {
|
|
512
|
-
throw new Error(`
|
|
515
|
+
throw new Error(`Template ${entry.id} has no valid order number`);
|
|
513
516
|
}
|
|
514
517
|
if (entry.guide !== undefined && (typeof entry.guide !== "string" || !GUIDE_ID.test(entry.guide))) {
|
|
515
|
-
throw new Error(`
|
|
518
|
+
throw new Error(`Template ${entry.id} names no valid guide id: ${String(entry.guide)}`);
|
|
516
519
|
}
|
|
517
520
|
if (entry.tags !== undefined && (!Array.isArray(entry.tags)
|
|
518
521
|
|| entry.tags.some((tag) => typeof tag !== "string" || !tag.trim() || tag !== tag.trim())
|
|
519
522
|
|| new Set(entry.tags).size !== entry.tags.length)) {
|
|
520
|
-
throw new Error(`
|
|
523
|
+
throw new Error(`Template ${entry.id}: tags must be unique, non-empty keywords`);
|
|
521
524
|
}
|
|
522
525
|
validateFixedStartOptions(entry);
|
|
523
526
|
switch (entry.action) {
|
|
524
527
|
case "skill":
|
|
525
|
-
assertKnownFields(entry, entry, [...base, "skill", "prompt", "category"], "
|
|
528
|
+
assertKnownFields(entry, entry, [...base, "skill", "prompt", "category"], "Template");
|
|
526
529
|
requireText(entry, entry.category, "category");
|
|
527
|
-
if (entry.category !== entry.category.trim()) throw new Error(`
|
|
530
|
+
if (entry.category !== entry.category.trim()) throw new Error(`Template ${entry.id}: category must be a single non-empty text`);
|
|
528
531
|
requireText(entry, entry.prompt, "prompt");
|
|
529
532
|
requireText(entry, entry.skill, "skill");
|
|
530
533
|
if (!SKILL_NAME.test(entry.skill)) {
|
|
531
|
-
throw new Error(`
|
|
534
|
+
throw new Error(`Template ${entry.id} names no valid skill name: ${entry.skill}`);
|
|
532
535
|
}
|
|
533
536
|
return;
|
|
534
537
|
case "script":
|
|
535
|
-
assertKnownFields(entry, entry, [...base, "script", "category"], "
|
|
538
|
+
assertKnownFields(entry, entry, [...base, "script", "category"], "Template");
|
|
536
539
|
if (entry.category !== undefined && (typeof entry.category !== "string" || !entry.category.trim() || entry.category !== entry.category.trim())) {
|
|
537
|
-
throw new Error(`
|
|
540
|
+
throw new Error(`Template ${entry.id}: category must be a single non-empty text`);
|
|
538
541
|
}
|
|
539
542
|
validateScriptPackage(entry, entry.script);
|
|
540
543
|
return;
|
|
541
544
|
default:
|
|
542
545
|
throw new Error(
|
|
543
|
-
`
|
|
544
|
-
+ "
|
|
546
|
+
`Template ${String((entry as { id: unknown }).id)} has the unknown action ${String((entry as { action: unknown }).action)}; `
|
|
547
|
+
+ "valid are skill and script",
|
|
545
548
|
);
|
|
546
549
|
}
|
|
547
550
|
};
|
|
548
551
|
|
|
549
|
-
/**
|
|
552
|
+
/** The name of a skill is the name of its folder. */
|
|
550
553
|
const skillNameOf = (directory: string): string => directory.split(/[\\/]/).filter(Boolean).at(-1) ?? "";
|
|
551
554
|
|
|
552
555
|
const byOrderThenId = (left: { order?: number; id: string }, right: { order?: number; id: string }): number =>
|
|
@@ -554,7 +557,7 @@ const byOrderThenId = (left: { order?: number; id: string }, right: { order?: nu
|
|
|
554
557
|
|
|
555
558
|
/** Skills with a start prompt and executable run scripts share one registry. */
|
|
556
559
|
export class StartEntryContributionRegistry {
|
|
557
|
-
readonly #entries = new ContributionRegistry<StartEntryContribution>("
|
|
560
|
+
readonly #entries = new ContributionRegistry<StartEntryContribution>("Template");
|
|
558
561
|
|
|
559
562
|
register(owner: string, entries: readonly StartEntryContribution[]): void {
|
|
560
563
|
for (const entry of entries) validateStartEntry(entry);
|
|
@@ -565,19 +568,19 @@ export class StartEntryContributionRegistry {
|
|
|
565
568
|
const names = new Set(skills.flatMap((skill) => skill.paths.map(skillNameOf)));
|
|
566
569
|
for (const { owner, value } of this.#entries.entries()) {
|
|
567
570
|
if (value.action === "skill" && !names.has(value.skill)) {
|
|
568
|
-
throw new Error(`
|
|
571
|
+
throw new Error(`Template ${value.id} of ${owner} refers to the unknown skill ${value.skill}`);
|
|
569
572
|
}
|
|
570
573
|
}
|
|
571
574
|
}
|
|
572
575
|
|
|
573
|
-
/**
|
|
576
|
+
/** Every fixed start option must be registered and its value must satisfy its schema; whether it is accepted is decided only at start. */
|
|
574
577
|
assertFixedStartOptionsKnown(startOptions: StartOptionContributionRegistry): void {
|
|
575
578
|
for (const { owner, value } of this.#entries.entries()) {
|
|
576
579
|
for (const [optionId, fixed] of Object.entries(value.fixedStartOptions ?? {})) {
|
|
577
580
|
if (!startOptions.entry(optionId)) {
|
|
578
|
-
throw new Error(`
|
|
581
|
+
throw new Error(`Template ${value.id} of ${owner} fixes the unregistered start option ${optionId}`);
|
|
579
582
|
}
|
|
580
|
-
startOptions.assertValue(optionId, fixed, `
|
|
583
|
+
startOptions.assertValue(optionId, fixed, `fixed value of template ${value.id}`);
|
|
581
584
|
}
|
|
582
585
|
}
|
|
583
586
|
}
|
|
@@ -606,7 +609,7 @@ export class StartEntryContributionRegistry {
|
|
|
606
609
|
.sort(byOrderThenId);
|
|
607
610
|
}
|
|
608
611
|
|
|
609
|
-
/**
|
|
612
|
+
/** A template as the web sees it; undefined for an unknown id. */
|
|
610
613
|
entry(entryId: string): PublicStartEntry | undefined {
|
|
611
614
|
return this.describe().find((candidate) => candidate.id === entryId);
|
|
612
615
|
}
|
|
@@ -622,7 +625,7 @@ export class StartEntryContributionRegistry {
|
|
|
622
625
|
}
|
|
623
626
|
|
|
624
627
|
export class ProfileContributionRegistry {
|
|
625
|
-
readonly #profiles = new ContributionRegistry<ProfileContribution>("
|
|
628
|
+
readonly #profiles = new ContributionRegistry<ProfileContribution>("Profile contribution");
|
|
626
629
|
|
|
627
630
|
register(owner: string, contributions: readonly ProfileContribution[]): void {
|
|
628
631
|
this.#profiles.register(owner, contributions);
|
|
@@ -631,27 +634,27 @@ export class ProfileContributionRegistry {
|
|
|
631
634
|
models(): readonly CatalogModel[] {
|
|
632
635
|
const models = this.#profiles.entries().flatMap(({ value }) => value.models());
|
|
633
636
|
const keys = models.map((model) => `${model.driver}:${model.provider}:${model.model}`);
|
|
634
|
-
if (new Set(keys).size !== keys.length) throw new Error("
|
|
637
|
+
if (new Set(keys).size !== keys.length) throw new Error("A model is registered more than once");
|
|
635
638
|
return models;
|
|
636
639
|
}
|
|
637
640
|
|
|
638
641
|
profiles(): readonly AgentProfile[] {
|
|
639
642
|
const profiles = this.#profiles.entries().flatMap(({ value }) => value.profiles());
|
|
640
643
|
const names = profiles.map((profile) => profile.name);
|
|
641
|
-
if (new Set(names).size !== names.length) throw new Error("
|
|
644
|
+
if (new Set(names).size !== names.length) throw new Error("An agent profile is registered more than once");
|
|
642
645
|
return profiles;
|
|
643
646
|
}
|
|
644
647
|
|
|
645
648
|
async providers(): Promise<readonly ModelProviderRegistration[]> {
|
|
646
649
|
const registrations = (await Promise.all(this.#profiles.entries().map(({ value }) => value.providers?.() ?? []))).flat();
|
|
647
650
|
const ids = registrations.map((registration) => registration.id);
|
|
648
|
-
if (new Set(ids).size !== ids.length) throw new Error("
|
|
651
|
+
if (new Set(ids).size !== ids.length) throw new Error("A model provider is registered more than once");
|
|
649
652
|
return registrations;
|
|
650
653
|
}
|
|
651
654
|
}
|
|
652
655
|
|
|
653
656
|
export class ScriptContributionRegistry {
|
|
654
|
-
readonly #script = new ContributionRegistry<ScriptContribution>("
|
|
657
|
+
readonly #script = new ContributionRegistry<ScriptContribution>("Logic contribution");
|
|
655
658
|
|
|
656
659
|
register(owner: string, contributions: readonly ScriptContribution[]): void {
|
|
657
660
|
this.#script.register(owner, contributions);
|
|
@@ -660,7 +663,7 @@ export class ScriptContributionRegistry {
|
|
|
660
663
|
create(context: ScriptFactoryContext): ScriptRuntime | undefined {
|
|
661
664
|
const entries = this.#script.entries();
|
|
662
665
|
if (entries.length > 1) {
|
|
663
|
-
throw new Error(`
|
|
666
|
+
throw new Error(`The engine supports at most one logic contribution, ${entries.length} are registered`);
|
|
664
667
|
}
|
|
665
668
|
return entries[0]?.value.create(context);
|
|
666
669
|
}
|
|
@@ -687,14 +690,14 @@ export interface PluginStopOperation {
|
|
|
687
690
|
}
|
|
688
691
|
|
|
689
692
|
export class LifecycleContributionRegistry {
|
|
690
|
-
readonly #lifecycle = new ContributionRegistry<SessionLifecycleContribution>("Lifecycle
|
|
693
|
+
readonly #lifecycle = new ContributionRegistry<SessionLifecycleContribution>("Lifecycle contribution");
|
|
691
694
|
readonly #stopTimeoutMs: number;
|
|
692
695
|
readonly #stopAttempts = new Map<string, SessionStopAttempt>();
|
|
693
696
|
|
|
694
697
|
constructor(options: { stopTimeoutMs?: number } = {}) {
|
|
695
698
|
const stopTimeoutMs = options.stopTimeoutMs ?? DEFAULT_PLUGIN_STOP_TIMEOUT_MS;
|
|
696
699
|
if (!Number.isSafeInteger(stopTimeoutMs) || stopTimeoutMs < 1) {
|
|
697
|
-
throw new Error("
|
|
700
|
+
throw new Error("The plugin stop timeout must be a positive integer");
|
|
698
701
|
}
|
|
699
702
|
this.#stopTimeoutMs = stopTimeoutMs;
|
|
700
703
|
}
|
|
@@ -726,15 +729,15 @@ export class LifecycleContributionRegistry {
|
|
|
726
729
|
#beginStopPhase(runId: string, phase: "stopSession" | "afterStopSession"): PluginStopOperation {
|
|
727
730
|
const contributions = [...this.#lifecycle.entries()].reverse()
|
|
728
731
|
.flatMap(({ value }) => value[phase] ? [this.#beginStopContribution(value, runId, phase)] : []);
|
|
729
|
-
const bounded = this.#settleParallel("Plugin
|
|
730
|
-
const settled = this.#settleParallel("Plugin-
|
|
732
|
+
const bounded = this.#settleParallel("Plugin stop", contributions.map(({ bounded: promise }) => promise));
|
|
733
|
+
const settled = this.#settleParallel("Plugin stop follow-up", contributions.map(({ settled: promise }) => promise));
|
|
731
734
|
|
|
732
735
|
return {
|
|
733
736
|
bounded,
|
|
734
737
|
settled,
|
|
735
738
|
release: () => {
|
|
736
739
|
if (contributions.some((contribution) => !contribution.isSettled())) {
|
|
737
|
-
throw new Error(`Plugin
|
|
740
|
+
throw new Error(`Plugin stop for ${runId} cannot be released before all contributions have ended`);
|
|
738
741
|
}
|
|
739
742
|
contributions.forEach((contribution) => contribution.release());
|
|
740
743
|
},
|
|
@@ -755,14 +758,14 @@ export class LifecycleContributionRegistry {
|
|
|
755
758
|
.filter(([key]) => key.startsWith(`${runId}\0`))
|
|
756
759
|
.map(([, attempt]) => attempt.settled);
|
|
757
760
|
await Promise.allSettled(pendingStops);
|
|
758
|
-
await this.#settle("Plugin
|
|
761
|
+
await this.#settle("Plugin deletion", [...this.#lifecycle.entries()].reverse()
|
|
759
762
|
.map(({ value }) => () => value.deleteSession?.({ runId })));
|
|
760
763
|
this.#releaseStopAttempts(runId);
|
|
761
764
|
}
|
|
762
765
|
|
|
763
766
|
shutdown(): Promise<void> {
|
|
764
767
|
const pendingStops = [...new Set([...this.#stopAttempts.values()].map((attempt) => attempt.settled))];
|
|
765
|
-
return this.#settle("Plugin
|
|
768
|
+
return this.#settle("Plugin shutdown", [
|
|
766
769
|
...[...this.#lifecycle.entries()].reverse().map(({ value }) => () => value.shutdown?.()),
|
|
767
770
|
...pendingStops.map((settled) => () => settled),
|
|
768
771
|
]);
|
|
@@ -773,7 +776,7 @@ export class LifecycleContributionRegistry {
|
|
|
773
776
|
const failures = results
|
|
774
777
|
.filter((result): result is PromiseRejectedResult => result.status === "rejected")
|
|
775
778
|
.map((result) => result.reason);
|
|
776
|
-
if (failures.length > 0) throw new AggregateError(failures, `${name}
|
|
779
|
+
if (failures.length > 0) throw new AggregateError(failures, `${name} failed in ${failures.length} plugin(s)`);
|
|
777
780
|
}
|
|
778
781
|
|
|
779
782
|
#beginStopContribution(
|
|
@@ -782,7 +785,7 @@ export class LifecycleContributionRegistry {
|
|
|
782
785
|
phase: "stopSession" | "afterStopSession",
|
|
783
786
|
): ContributionStopOperation {
|
|
784
787
|
const stopSession = contribution[phase];
|
|
785
|
-
if (!stopSession) throw new Error(`Lifecycle
|
|
788
|
+
if (!stopSession) throw new Error(`Lifecycle contribution ${contribution.id} has no stop hook`);
|
|
786
789
|
const key = `${runId}\0${phase}\0${contribution.id}`;
|
|
787
790
|
const existing = this.#stopAttempts.get(key);
|
|
788
791
|
if (existing) {
|
|
@@ -809,7 +812,7 @@ export class LifecycleContributionRegistry {
|
|
|
809
812
|
const deadline = new Promise<never>((_, reject) => {
|
|
810
813
|
timeout = setTimeout(() => {
|
|
811
814
|
const error = new Error(
|
|
812
|
-
`Plugin
|
|
815
|
+
`Plugin stop ${contribution.id} (${phase}) exceeded the timeout of ${this.#stopTimeoutMs} ms`,
|
|
813
816
|
);
|
|
814
817
|
attempt.timeoutError = error;
|
|
815
818
|
controller.abort(error);
|
|
@@ -859,27 +862,27 @@ export class LifecycleContributionRegistry {
|
|
|
859
862
|
failures.push(error);
|
|
860
863
|
}
|
|
861
864
|
}
|
|
862
|
-
if (failures.length > 0) throw new AggregateError(failures, `${name}
|
|
865
|
+
if (failures.length > 0) throw new AggregateError(failures, `${name} failed in ${failures.length} plugin(s)`);
|
|
863
866
|
}
|
|
864
867
|
}
|
|
865
868
|
|
|
866
|
-
const WORKSPACE_NOT_ACCESSIBLE = "
|
|
869
|
+
const WORKSPACE_NOT_ACCESSIBLE = "The workspace of this run is not reachable for this access.";
|
|
867
870
|
|
|
868
871
|
export class SessionMetadataContributionRegistry {
|
|
869
|
-
readonly #metadata = new ContributionRegistry<SessionMetadataContribution>("Run
|
|
872
|
+
readonly #metadata = new ContributionRegistry<SessionMetadataContribution>("Run metadata contribution");
|
|
870
873
|
|
|
871
874
|
register(owner: string, contributions: readonly SessionMetadataContribution[]): void {
|
|
872
875
|
this.#metadata.register(owner, contributions);
|
|
873
876
|
}
|
|
874
877
|
|
|
875
|
-
/**
|
|
878
|
+
/** All contributions at once; whoever does not answer within `timeoutMs` or fails loses only its value and states the reason. */
|
|
876
879
|
async describe(runId: string, workspaceAccessible: boolean, timeoutMs: number): Promise<SessionMetadata> {
|
|
877
880
|
type Outcome = { readonly id: string; readonly value: unknown } | { readonly id: string; readonly reason: string };
|
|
878
881
|
const outcomes = await Promise.all(this.#metadata.entries().map(async ({ value }): Promise<Outcome> => {
|
|
879
882
|
if (value.requiresWorkspace === true && !workspaceAccessible) return { id: value.id, reason: WORKSPACE_NOT_ACCESSIBLE };
|
|
880
883
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
881
884
|
const silent = new Promise<never>((_resolve, reject) => {
|
|
882
|
-
timer = setTimeout(() => reject(new Error(`
|
|
885
|
+
timer = setTimeout(() => reject(new Error(`no answer after ${timeoutMs} ms`)), timeoutMs);
|
|
883
886
|
});
|
|
884
887
|
try {
|
|
885
888
|
return { id: value.id, value: await Promise.race([Promise.resolve().then(() => value.describe({ runId })), silent]) };
|
|
@@ -897,25 +900,25 @@ export class SessionMetadataContributionRegistry {
|
|
|
897
900
|
}
|
|
898
901
|
|
|
899
902
|
export class StartOptionContributionRegistry {
|
|
900
|
-
readonly #options = new ContributionRegistry<StartOptionContribution>("
|
|
903
|
+
readonly #options = new ContributionRegistry<StartOptionContribution>("Start option");
|
|
901
904
|
|
|
902
905
|
register(owner: string, contributions: readonly StartOptionContribution[]): void {
|
|
903
906
|
for (const contribution of contributions) {
|
|
904
|
-
if (!START_OPTION_ID.test(contribution.id)) throw new Error(`
|
|
907
|
+
if (!START_OPTION_ID.test(contribution.id)) throw new Error(`Invalid start option id: ${contribution.id}`);
|
|
905
908
|
if (typeof contribution.schema !== "object" || contribution.schema === null) {
|
|
906
|
-
throw new Error(`
|
|
909
|
+
throw new Error(`Start option ${contribution.id} has no schema`);
|
|
907
910
|
}
|
|
908
911
|
for (const name of ["selectable", "defaultValue", "accept", "describe"] as const) {
|
|
909
|
-
if (typeof contribution[name] !== "function") throw new Error(`
|
|
912
|
+
if (typeof contribution[name] !== "function") throw new Error(`Start option ${contribution.id} has no ${name}`);
|
|
910
913
|
}
|
|
911
914
|
if (contribution.ownerOnly !== undefined && typeof contribution.ownerOnly !== "function") {
|
|
912
|
-
throw new Error(`
|
|
915
|
+
throw new Error(`Start option ${contribution.id} has an invalid ownerOnly`);
|
|
913
916
|
}
|
|
914
917
|
if (contribution.rights !== undefined && (!Array.isArray(contribution.rights) || !contribution.rights.every(isAccessRight))) {
|
|
915
|
-
throw new Error(`
|
|
918
|
+
throw new Error(`Start option ${contribution.id} has invalid rights`);
|
|
916
919
|
}
|
|
917
920
|
if (contribution.changeable !== undefined && typeof contribution.changeable !== "boolean") {
|
|
918
|
-
throw new Error(`
|
|
921
|
+
throw new Error(`Start option ${contribution.id} has an invalid changeable`);
|
|
919
922
|
}
|
|
920
923
|
}
|
|
921
924
|
this.#options.register(owner, contributions);
|
|
@@ -934,46 +937,87 @@ export class StartOptionContributionRegistry {
|
|
|
934
937
|
return this.#options.entries().map(({ owner, value }) => ({ id: value.id, owner }));
|
|
935
938
|
}
|
|
936
939
|
|
|
937
|
-
/**
|
|
940
|
+
/** The first right of the option that the access lacks; an unknown option requires none. */
|
|
938
941
|
missingRight(id: string, access: Pick<AccessContext, "can">): string | undefined {
|
|
939
942
|
return this.entry(id)?.option.rights?.find((right) => !access.can(right));
|
|
940
943
|
}
|
|
941
944
|
|
|
942
945
|
assertRights(id: string, access: Pick<AccessContext, "can">): void {
|
|
943
946
|
const missing = this.missingRight(id, access);
|
|
944
|
-
if (missing) throw new DomainError("access-denied", `
|
|
947
|
+
if (missing) throw new DomainError("access-denied", `The right ${missing} is missing for the start option ${id}.`, 403);
|
|
945
948
|
}
|
|
946
949
|
|
|
947
950
|
defaultValue(id: string, context: StartOptionContext): JsonValue {
|
|
948
951
|
const { option } = this.#require(id);
|
|
949
952
|
const value = option.defaultValue(context);
|
|
950
|
-
this.#check(option, value, "
|
|
953
|
+
this.#check(option, value, "default value");
|
|
951
954
|
return value;
|
|
952
955
|
}
|
|
953
956
|
|
|
954
957
|
accept(id: string, value: unknown, context: StartOptionContext): JsonValue {
|
|
955
958
|
const { option } = this.#require(id);
|
|
956
|
-
assertJsonValue(value, `
|
|
957
|
-
this.#check(option, value, "
|
|
959
|
+
assertJsonValue(value, `Start option ${id} value`);
|
|
960
|
+
this.#check(option, value, "value");
|
|
958
961
|
const accepted = option.accept(value, context);
|
|
959
|
-
this.#check(option, accepted, "
|
|
962
|
+
this.#check(option, accepted, "result of accept");
|
|
960
963
|
return accepted;
|
|
961
964
|
}
|
|
962
965
|
|
|
963
|
-
/**
|
|
966
|
+
/** Checks a value against the schema of the option without accepting it. */
|
|
964
967
|
assertValue(id: string, value: unknown, label: string): void {
|
|
965
968
|
this.#check(this.#require(id).option, value, label);
|
|
966
969
|
}
|
|
967
970
|
|
|
968
971
|
#require(id: string): RegisteredStartOption {
|
|
969
972
|
const entry = this.entry(id);
|
|
970
|
-
if (!entry) throw new Error(`
|
|
973
|
+
if (!entry) throw new Error(`Start option ${id} is not registered`);
|
|
971
974
|
return entry;
|
|
972
975
|
}
|
|
973
976
|
|
|
974
977
|
#check(option: StartOptionContribution, value: unknown, label: string): void {
|
|
975
978
|
if (Value.Check(option.schema, value)) return;
|
|
976
|
-
throw new Error(`
|
|
979
|
+
throw new Error(`Invalid ${label} for start option ${option.id}: ${schemaComplaints(option.schema, value, "value")}`);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/** What an access without runs.inspect sees of plugin states: a start option only with its rights, otherwise the projection of its plugin, without one everything. */
|
|
984
|
+
export class AccessProjectionRegistry {
|
|
985
|
+
readonly #projections = new ContributionRegistry<AccessProjectionContribution>("Access projection");
|
|
986
|
+
readonly #startOptions: StartOptionContributionRegistry;
|
|
987
|
+
|
|
988
|
+
constructor(startOptions = new StartOptionContributionRegistry()) {
|
|
989
|
+
this.#startOptions = startOptions;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
register(owner: string, contributions: readonly AccessProjectionContribution[]): void {
|
|
993
|
+
for (const contribution of contributions) {
|
|
994
|
+
for (const name of ["state", "chatEvent"] as const) {
|
|
995
|
+
if (typeof contribution[name] !== "function") throw new Error(`Access projection ${contribution.id} has no ${name}`);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
this.#projections.register(owner, contributions);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
state(entry: PluginState, access: Pick<AccessContext, "can">): PluginState | undefined {
|
|
1002
|
+
if (access.can("runs.inspect")) return entry;
|
|
1003
|
+
if (this.#startOptions.missingRight(entry.pluginId, access) !== undefined) return undefined;
|
|
1004
|
+
const projection = this.#find(entry.pluginId);
|
|
1005
|
+
if (!projection) return entry;
|
|
1006
|
+
const state = projection.state(entry);
|
|
1007
|
+
return state === undefined ? undefined : { ...entry, state };
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
chatEvent<T extends PluginChatEvent>(pluginId: string, event: T, access: Pick<AccessContext, "can">): T | undefined {
|
|
1011
|
+
if (access.can("runs.inspect")) return event;
|
|
1012
|
+
if (this.#startOptions.missingRight(pluginId, access) !== undefined) return undefined;
|
|
1013
|
+
const projection = this.#find(pluginId);
|
|
1014
|
+
if (!projection) return event;
|
|
1015
|
+
const projected = projection.chatEvent(event.payload === undefined ? { type: event.type } : { type: event.type, payload: event.payload });
|
|
1016
|
+
return projected === undefined ? undefined : { ...event, type: projected.type, payload: projected.payload };
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
#find(id: string): AccessProjectionContribution | undefined {
|
|
1020
|
+
return this.#projections.entries().find(({ value }) => value.id === id)?.value;
|
|
977
1021
|
}
|
|
978
1022
|
}
|
|
979
1023
|
|
|
@@ -988,10 +1032,10 @@ export class ConfigContributionRegistry {
|
|
|
988
1032
|
continue;
|
|
989
1033
|
}
|
|
990
1034
|
if (existing.value.source !== descriptor.source || Boolean(existing.value.secret) !== Boolean(descriptor.secret)) {
|
|
991
|
-
throw new Error(`
|
|
1035
|
+
throw new Error(`Configuration ${descriptor.key} is declared inconsistently`);
|
|
992
1036
|
}
|
|
993
1037
|
if (existing.owners.includes(owner)) {
|
|
994
|
-
throw new Error(`
|
|
1038
|
+
throw new Error(`Configuration ${descriptor.key} is declared more than once in ${owner}`);
|
|
995
1039
|
}
|
|
996
1040
|
existing.owners.push(owner);
|
|
997
1041
|
}
|
|
@@ -1022,7 +1066,7 @@ const joinSafe = (base: string, segments: readonly string[]): string => {
|
|
|
1022
1066
|
for (const segment of segments) {
|
|
1023
1067
|
if (!segment || segment === "." || segment === ".." || path.isAbsolute(segment)
|
|
1024
1068
|
|| segment.includes("/") || segment.includes("\\")) {
|
|
1025
|
-
throw new Error(`
|
|
1069
|
+
throw new Error(`Invalid plugin storage segment: ${segment}`);
|
|
1026
1070
|
}
|
|
1027
1071
|
}
|
|
1028
1072
|
return path.join(base, ...segments);
|
|
@@ -1039,14 +1083,14 @@ export class StorageRegistry {
|
|
|
1039
1083
|
}
|
|
1040
1084
|
|
|
1041
1085
|
register(manifest: PluginManifest): PluginStorage {
|
|
1042
|
-
if (this.#scopes.has(manifest.id)) throw new Error(`
|
|
1086
|
+
if (this.#scopes.has(manifest.id)) throw new Error(`Storage for ${manifest.id} is already registered`);
|
|
1043
1087
|
const pluginDirectory = path.join("plugins", manifest.id);
|
|
1044
1088
|
const scope: PluginStorage = Object.freeze({
|
|
1045
1089
|
sessionsRoot: path.join(this.#dataDirectory, "sessions"),
|
|
1046
1090
|
modes: this.#modes,
|
|
1047
1091
|
root: (...segments: string[]) => joinSafe(path.join(this.#dataDirectory, pluginDirectory), segments),
|
|
1048
1092
|
session: (runId: string, ...segments: string[]) => {
|
|
1049
|
-
if (!RUN_ID.test(runId)) throw new Error(`
|
|
1093
|
+
if (!RUN_ID.test(runId)) throw new Error(`Invalid run id: ${runId}`);
|
|
1050
1094
|
return joinSafe(path.join(this.#dataDirectory, "sessions", runId, pluginDirectory), segments);
|
|
1051
1095
|
},
|
|
1052
1096
|
});
|
|
@@ -1056,7 +1100,7 @@ export class StorageRegistry {
|
|
|
1056
1100
|
|
|
1057
1101
|
of(pluginId: string): PluginStorage {
|
|
1058
1102
|
const scope = this.#scopes.get(pluginId);
|
|
1059
|
-
if (!scope) throw new Error(`
|
|
1103
|
+
if (!scope) throw new Error(`Storage for ${pluginId} is not registered`);
|
|
1060
1104
|
return scope;
|
|
1061
1105
|
}
|
|
1062
1106
|
}
|
|
@@ -1068,7 +1112,7 @@ class ClientConfigRegistry {
|
|
|
1068
1112
|
const existing = this.#values.get(owner) ?? {};
|
|
1069
1113
|
for (const key of Object.keys(values)) {
|
|
1070
1114
|
if (Object.hasOwn(existing, key)) {
|
|
1071
|
-
throw new Error(`Client
|
|
1115
|
+
throw new Error(`Client configuration ${key} is set more than once in ${owner}`);
|
|
1072
1116
|
}
|
|
1073
1117
|
}
|
|
1074
1118
|
this.#values.set(owner, { ...existing, ...values });
|
|
@@ -1084,13 +1128,13 @@ class ServiceRegistry {
|
|
|
1084
1128
|
|
|
1085
1129
|
provide<T>(owner: string, token: ServiceToken<T>, service: T): void {
|
|
1086
1130
|
const existing = this.#services.get(token.id);
|
|
1087
|
-
if (existing) throw new Error(`Service ${token.id}
|
|
1131
|
+
if (existing) throw new Error(`Service ${token.id} is already provided by ${existing.owner}`);
|
|
1088
1132
|
this.#services.set(token.id, { owner, value: service });
|
|
1089
1133
|
}
|
|
1090
1134
|
|
|
1091
1135
|
require<T>(token: ServiceToken<T>): T {
|
|
1092
1136
|
const entry = this.#services.get(token.id);
|
|
1093
|
-
if (!entry) throw new Error(`
|
|
1137
|
+
if (!entry) throw new Error(`Required plugin service ${token.id} is not registered`);
|
|
1094
1138
|
return entry.value as T;
|
|
1095
1139
|
}
|
|
1096
1140
|
|
|
@@ -1125,6 +1169,7 @@ export class PluginHost {
|
|
|
1125
1169
|
readonly lifecycle = new LifecycleContributionRegistry();
|
|
1126
1170
|
readonly sessionMetadata = new SessionMetadataContributionRegistry();
|
|
1127
1171
|
readonly startOptions = new StartOptionContributionRegistry();
|
|
1172
|
+
readonly accessProjections = new AccessProjectionRegistry(this.startOptions);
|
|
1128
1173
|
readonly config = new ConfigContributionRegistry();
|
|
1129
1174
|
readonly storage: StorageRegistry;
|
|
1130
1175
|
readonly #product: ProductDescriptor;
|
|
@@ -1145,11 +1190,11 @@ export class PluginHost {
|
|
|
1145
1190
|
}
|
|
1146
1191
|
|
|
1147
1192
|
register(plugin: RAgentsPlugin): this {
|
|
1148
|
-
if (this.#sealed) throw new Error("
|
|
1193
|
+
if (this.#sealed) throw new Error("No more plugins can be registered after startup");
|
|
1149
1194
|
const { manifest } = plugin;
|
|
1150
|
-
if (!PLUGIN_ID.test(manifest.id)) throw new Error(`
|
|
1195
|
+
if (!PLUGIN_ID.test(manifest.id)) throw new Error(`Invalid plugin id: ${manifest.id}`);
|
|
1151
1196
|
if (this.#manifests.some((entry) => entry.id === manifest.id)) {
|
|
1152
|
-
throw new Error(`Plugin ${manifest.id}
|
|
1197
|
+
throw new Error(`Plugin ${manifest.id} is already registered`);
|
|
1153
1198
|
}
|
|
1154
1199
|
this.#manifests.push(manifest);
|
|
1155
1200
|
const storage = this.storage.register(manifest);
|
|
@@ -1176,6 +1221,7 @@ export class PluginHost {
|
|
|
1176
1221
|
skills: (...entries) => this.skills.register(manifest.id, entries),
|
|
1177
1222
|
startEntries: (...entries) => this.startEntries.register(manifest.id, entries),
|
|
1178
1223
|
startOptions: (...entries) => this.startOptions.register(manifest.id, entries),
|
|
1224
|
+
accessProjections: (...entries) => this.accessProjections.register(manifest.id, entries),
|
|
1179
1225
|
functions: (...entries) => this.tools.registerFunctions(manifest.id, entries),
|
|
1180
1226
|
script: (...entries) => this.script.register(manifest.id, entries),
|
|
1181
1227
|
};
|
|
@@ -1189,8 +1235,8 @@ export class PluginHost {
|
|
|
1189
1235
|
for (const [index, manifest] of this.#manifests.entries()) {
|
|
1190
1236
|
for (const dependency of manifest.requires ?? []) {
|
|
1191
1237
|
const position = positions.get(dependency);
|
|
1192
|
-
if (position === undefined) throw new Error(`Plugin ${manifest.id}
|
|
1193
|
-
if (position >= index) throw new Error(`Plugin ${dependency}
|
|
1238
|
+
if (position === undefined) throw new Error(`Plugin ${manifest.id} requires the missing plugin ${dependency}`);
|
|
1239
|
+
if (position >= index) throw new Error(`Plugin ${dependency} must be registered before ${manifest.id}`);
|
|
1194
1240
|
}
|
|
1195
1241
|
}
|
|
1196
1242
|
this.startEntries.assertFixedStartOptionsKnown(this.startOptions);
|
|
@@ -1198,8 +1244,8 @@ export class PluginHost {
|
|
|
1198
1244
|
if (defaultStartEntry !== undefined) {
|
|
1199
1245
|
const entries = this.startEntries.describe().map((entry) => entry.id);
|
|
1200
1246
|
if (!entries.includes(defaultStartEntry)) {
|
|
1201
|
-
throw new Error(`defaultStartEntry ${defaultStartEntry}
|
|
1202
|
-
+ (entries.length > 0 ? `
|
|
1247
|
+
throw new Error(`defaultStartEntry ${defaultStartEntry} is not a registered template; `
|
|
1248
|
+
+ (entries.length > 0 ? `registered are ${entries.join(", ")}` : "no plugin of this profile registers templates"));
|
|
1203
1249
|
}
|
|
1204
1250
|
}
|
|
1205
1251
|
this.#sealed = true;
|