@schlenkr/ragents 0.1.10 → 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 +4 -4
- 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 +29 -29
- package/apps/server/src/api/core-methods.ts +17 -17
- 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 +6 -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 +39 -39
- 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 +61 -56
- 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 +23 -23
- package/apps/server/src/ragents/global-chat.ts +8 -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 +48 -48
- 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-BO4wLQtE.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 +53 -54
- package/apps/web/dist/help/guide-clients.md +50 -51
- 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 +196 -144
- package/apps/web/dist/help/mini-app.css +6 -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 +23 -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 +26 -26
- package/apps/web/src/panel/connection-state.ts +9 -9
- package/apps/web/src/panel/contract.ts +28 -28
- 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 +225 -225
- package/bundles/ragents.actor-programs/server/index.js.map +2 -2
- 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 -2
- 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-MBRPS477.js → chunk-IQBHK7MV.js} +2 -2
- package/bundles/ragents.ask/web/chunks/{chunk-MBRPS477.js.map → chunk-IQBHK7MV.js.map} +3 -3
- 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 +2 -2
- 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 +2 -2
- package/bundles/ragents.overseer/ragents-bundle.json +2 -2
- package/bundles/ragents.overseer/server/index.js +98 -98
- 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 +81 -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/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/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/plugin-host.ts +119 -119
- package/packages/ragents/src/plugin-types.ts +16 -16
- 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 +12 -12
- 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 +28 -28
- 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 +1 -1
- 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/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 -2
- 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/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 +22 -22
- 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 +9 -9
- 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 +6 -6
- 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 +54 -54
- 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 +7 -7
- package/plugins/ragents.workspace/server/index.ts +3 -3
- 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-DnnqWHkH.js +0 -11
- package/apps/web/dist/assets/mermaid-HWGCJPDP-BLLeth5_.js +0 -568
- package/apps/web/dist/assets/runPanel-DPm7s3KM.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/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
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{a as gt,b as Ua}from"/plugins/ragents.orchestration/web/chunks/chunk-OSKPH6SZ.js";import{b as da}from"/plugins/ragents.orchestration/web/chunks/chunk-ODMMQGX2.js";import{a as p,b as Lo,c as Ge,d as Ha,e as Io,f as q,g as Co,h as O,i as pe,j as We,k as B,l as U,m as w}from"/plugins/ragents.orchestration/web/chunks/chunk-OQYCNYXN.js";import{a as Ae,e as ua,f as So,g as ft,h as ct,i as pt,j as mt}from"/plugins/ragents.orchestration/web/chunks/chunk-XGPPQCZR.js";var W=p("@ragents/web/AccessContext","useAccess");var na=p("react-dom","createPortal");var xt=p("@ragents/engine/src/http/contracts","handleKey");var me=p("@ragents/engine/src/http/contracts","runContracts");var wo="ragents.orchestration",ys=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),bo=e=>{let a=e.trim();if(a.startsWith("@")){let s=xt(a);if(!s||/\s/.test(s))throw new Error(`Entit\xE4t ${JSON.stringify(e)}: nach dem @ fehlt ein Handle`);return{kind:"actor",handle:s}}let o=/^app:(.+)$/s.exec(a);if(!o)throw new Error(`Entit\xE4t ${JSON.stringify(e)}: erwartet @handle oder app:<id>`);let r=o[1].trim();if(!r)throw new Error(`Entit\xE4t ${JSON.stringify(e)}: die ID nach dem Doppelpunkt ist leer`);return{kind:"app",id:r}},yo=e=>e.kind==="actor"?`@${e.handle}`:`app:${e.id}`,ks=["nodes","shapes","lines","mode"],ko=e=>{if(!ys(e))throw new Error("Die Anordnung muss ein Objekt mit root sein");let a=ks.filter(o=>o in e);if(a.length>0)throw new Error(`Die Programmanordnung stammt aus der entfernten freien Fl\xE4che (${a.join(", ")}); canvas_layout_replace mit root setzt sie als Kachelaufteilung neu`);if(!("root"in e))throw new Error("root fehlt; erwartet wird eine Kachel, eine Teilung oder null");return{root:e.root===null?null:_e(e.root)}};var Ao=16,vo=64,_e=e=>{let a=new Set,o=(r,s,d)=>{if(d>Ao)throw new Error(`${s}: h\xF6chstens ${Ao} verschachtelte Teilungen sind erlaubt`);if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`${s} muss eine Kachel oder Teilung sein`);let l=r;if(Object.hasOwn(l,"entity")){if(Object.keys(l).some(f=>f!=="entity"&&f!=="chatInput"))throw new Error(`${s}: eine Kachel tr\xE4gt nur entity und chatInput; eine Teilung direction, weights und children`);if(typeof l.entity!="string")throw new Error(`${s}.entity muss @handle oder app:<name>/<view> sein`);let n=bo(l.entity),i=yo(n);if(l.chatInput!==void 0&&(n.kind!=="actor"||typeof l.chatInput!="boolean"))throw new Error(`${s}.chatInput ist nur f\xFCr Actors als Wahrheitswert erlaubt`);if(a.has(i))throw new Error(`${s}: ${i} ist mehr als einmal als Kachel platziert`);if(a.add(i),a.size>vo)throw new Error(`H\xF6chstens ${vo} Kacheln sind erlaubt`);return l.chatInput===void 0?{entity:i}:{entity:i,chatInput:l.chatInput}}if(Object.keys(l).some(n=>!["direction","weights","children"].includes(n)))throw new Error(`${s}: eine Teilung tr\xE4gt nur direction, weights und children`);if(l.direction!=="horizontal"&&l.direction!=="vertical")throw new Error(`${s}.direction muss horizontal oder vertical sein`);if(!Array.isArray(l.weights)||l.weights.length!==2||l.weights.some(n=>typeof n!="number"||!Number.isFinite(n)||n<=0))throw new Error(`${s}.weights muss genau zwei endliche positive Zahlen enthalten`);if(!Array.isArray(l.children)||l.children.length!==2)throw new Error(`${s}.children muss genau zwei Kacheln oder Teilungen enthalten`);return{direction:l.direction,weights:[l.weights[0],l.weights[1]],children:[o(l.children[0],`${s}.children[0]`,d+1),o(l.children[1],`${s}.children[1]`,d+1)]}};return o(e,"root",0)},Va=(e,a)=>e?"entity"in e?e.entity!==a||e.chatInput!==!1:Va(e.children[0],a)&&Va(e.children[1],a):!0,za=e=>e?"entity"in e?[e.entity]:e.children.flatMap(za):[];var ht=p("@ragents/web/ui","Alert");var Lt=p("@ragents/web/ui","AlertDescription");var se=p("@ragents/web/ui","Badge");var z=p("@ragents/web/ui","Button");var Xe=p("@ragents/web/ui","Empty");var ia=p("@ragents/web/ui","EmptyDescription");var Ke=p("@ragents/web/ui","EmptyHeader");var $e=p("@ragents/web/ui","EmptyTitle");var te=p("@ragents/web/ui","Input");var fa=p("@ragents/web/ui","Popover");var ca=p("@ragents/web/ui","PopoverContent");var It=p("@ragents/web/ui","SectionLabel");var Ct=p("@ragents/web/ui","Select");var St=p("@ragents/web/ui","SelectContent");var wt=p("@ragents/web/ui","SelectItem");var bt=p("@ragents/web/ui","SelectTrigger");var yt=p("@ragents/web/ui","SelectValue");var ve=p("@ragents/web/ui","Spinner");var pa=p("@ragents/web/ui","StartupNotice");var kt=p("@ragents/web/ui","StopGlyph");var At=p("@ragents/web/ui","Tabs");var Ga=p("@ragents/web/ui","TabsContent");var vt=p("@ragents/web/ui","TabsList");var Wa=p("@ragents/web/ui","TabsTrigger");var Y=p("@ragents/web/ui","cn");var Pt=p("quassel","ChatInputToolbar");var Rt=p("quassel","ChatMessages");var ma=p("quassel","ChatPanel");var Mt=p("@ragents/web/PluginRegistry","SurfaceControllerProvider");var Tt=p("@ragents/web/PluginRegistry","useActionRenderer");var ga=p("@ragents/web/PluginRegistry","useSurfaceController");var Dt=p("@ragents/web/PluginRegistry","useToolRenderer");var Bt=p("@ragents/web/chat-view-settings","ChatViewSwitches");var xa=p("@ragents/web/chat-view-settings","useChatViewSettings");var Ft=p("@ragents/web/actor-conversation","actorChatMessages");var Nt=p("@ragents/web/actor-conversation","actorInputLabel");var X=p("react/jsx-runtime","Fragment");var t=p("react/jsx-runtime","jsx");var u=p("react/jsx-runtime","jsxs");var As=[];function Ze({actor:e,view:a,presentation:o,display:r=o,primaryMessages:s=As,conversation:d,historyError:l,running:n=!1,className:i,onNavigate:f,scrollerRef:c}){let m=W().can("runs.inspect"),h=xa(a.id,e.id,"agents",r),C=Dt(),x=Tt(),L=h.detailMode,b=m||L==="off"?L:"current",P=B(()=>Ft(a,e,s,d),[a,e,s,d]),y=q(D=>{let R=/^ablauf:(actor|input|turn|subscription|action|artifact)\/(.+)$/.exec(D);return R?(m&&f({type:R[1],id:R[2]}),!0):!1},[m,f]);return u(X,{children:[l&&t("p",{className:"my-1.5 text-[0.72rem] text-destructive",role:"alert",children:l}),t(Rt,{className:i,detailMode:b,emptyState:t(Xe,{children:u(Ke,{children:[t($e,{children:e.kind==="script"?"Noch kein Verlauf":"Noch kein Gespr\xE4ch"}),t(ia,{children:e.kind==="script"?"Hier erscheinen Programmeingaben und ihre Verarbeitung.":"Schreibe eine Nachricht, um das Gespr\xE4ch zu beginnen."})]})}),messages:P,renderAction:x,renderTool:C,owner:e.id,onLinkClick:y,running:n,showTimestamps:h.showTimestamps,stepsExpandable:m&&h.stepsExpandable,scrollerRef:c})]})}var Et=p("@ragents/web/api","interruptActorTurn");var qt=p("@ragents/web/api","sendActorMessage");var Ot=p("@ragents/web/chat/StoppedActorNotice","StoppedActorNotice");var Ht=p("@ragents/web/chat/useAttachmentCapabilities","useAttachmentCapabilities");var Ut=p("@ragents/web/chat/chat-target","programChatNotice");var Vt=p("@ragents/web/chat/chat-target","runIsWorking");var Po="flex flex-shrink-0 items-center gap-2 border-t border-border-soft px-workspace-inset pt-2 pb-2.5",zt="mt-1.5 text-[0.7rem] text-muted-foreground";function Je({actor:e,view:a,composerVisible:o=!0,presentation:r="inspector",display:s=r,running:d=!1,toolbarLeft:l,toolbarRight:n}){let i=W().can("runs.write"),[f,c]=w(),m=xa(a.id,e.id,"agents",s),h=Ht(a.id,e.id,JSON.stringify(e.execution?.driver.config)),C=i?void 0:"Du hast Lesezugriff auf diesen Run.",x=t(Bt,{collapsible:r==="surface",settings:m});return!o||e.kind==="human"?u("div",{className:Po,children:[l,x]}):e.kind==="script"?u("div",{className:Po,children:[t("p",{className:zt,children:Ut}),l,x]}):e.lifecycle?.kind==="stopped"?t("div",{className:r==="inspector"?"flex-shrink-0 px-5 pt-2.5 pb-3.5":void 0,children:t(Ot,{actor:e,runId:a.id,toolbar:u(X,{children:[l,x]})})}):u("div",{className:r==="inspector"?"flex-shrink-0 px-5 pt-2.5 pb-3.5":void 0,children:[t(Pt,{...h,disabled:C!==void 0,layout:r==="surface"?"inline":"card",maxRows:4,onSend:(L,b)=>qt(a.id,e.id,L,b),onStop:i&&e.lifecycle?.kind==="running"?()=>{c(void 0),Et(a.id,e.id).catch(L=>c(L instanceof Error?L.message:String(L)))}:void 0,rows:1,running:d,texts:{placeholder:C??`Nachricht an @${e.handle} ...`},toolbarLeft:u(X,{children:[l,x,r==="inspector"&&u("span",{className:"truncate text-[0.7rem] text-muted-foreground",children:["an @",e.handle]})]}),toolbarRight:n}),f&&t("p",{className:zt,role:"alert",children:f}),C&&r==="inspector"&&t("p",{className:zt,children:C})]})}var Ro=Io(function({actor:a,view:o,primaryMessages:r,conversation:s,historyError:d,chatInput:l=!0,running:n=!1,onNavigate:i}){let f=q(c=>{c&&(c.tabIndex=0,c.setAttribute("role","region"),c.setAttribute("aria-label",`Chatverlauf von @${a.handle}`))},[a.handle]);return t("div",{className:"flex min-h-[106px] w-full min-w-0 flex-1 flex-col overflow-hidden rounded-b-[16px] text-left","data-surface-scroll":"true",children:t(ma,{className:"flex-1",composer:t(Je,{actor:a,view:o,composerVisible:l,presentation:"surface",running:n}),children:t(Ze,{actor:a,view:o,presentation:"surface",primaryMessages:r,conversation:s,historyError:d,running:n,onNavigate:i,scrollerRef:f})})})});var Gt="ragents.orchestration",_a="flex h-full min-w-statusbar items-center justify-center self-stretch whitespace-nowrap px-2.5 text-[0.7rem] text-foreground hover:bg-primary/12 aria-expanded:bg-primary/12 focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",Xa="grid gap-2.5 border-t border-border-soft px-3 pt-2.5 pb-2.5 empty:hidden";function Mo({actor:e,view:a,cardSections:o,chatInput:r,session:s,navigation:d,onSelect:l}){return u("div",{className:"flex flex-col overflow-hidden has-[>[data-slot=card-sections]:not(:empty)]:min-h-[260px] has-[[data-chat=actions]:not(:empty)]:min-h-[260px]",children:[t(Ro,{actor:e,view:a,chatInput:r,running:e.lifecycle?.kind==="running",conversation:s.actorConversations?.[e.id],historyError:s.conversationError,onNavigate:l,primaryMessages:e.id===a.primaryActorId?s.messages:void 0}),t("div",{className:`${Xa} max-h-[45%] flex-[0_1_auto] overflow-auto overscroll-contain`,"data-slot":"card-sections",children:o.map(({id:n,Section:i})=>t(i,{actor:e,navigation:d,session:s},n))})]})}var To=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Do(e,a,o=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:To(e),size:24,node:a,...o.length>0?{aliases:o}:{}}}var Bo=e=>{let a="",o=!1;for(let r of e){if(r==="-"||r==="_"||r<=" "){o=a.length>0;continue}a.length===0?a+=r.toLowerCase():a+=o?r.toUpperCase():r,o=!1}return a};var Fo=e=>{let a=Bo(e);return a.charAt(0).toUpperCase()+a.slice(1)};var ha=(...e)=>e.filter((a,o,r)=>!!a&&a.trim()!==""&&r.indexOf(a)===o).join(" ").trim();var Pe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function Wt(e){return e!=null}function No(e,a={}){let o=a.attributeNames??{},r=h=>o[h]??h,s=e.size??e.width??Pe.width,d=e.size??e.height??Pe.height,l=e.aliases?.filter(h=>typeof h=="string"&&h.trim()!=="").map(h=>`lucide-${h}`)??[],n=[...e.name?[`lucide-${e.name}`]:[],...l],i=a.className?.split(" ").filter(Boolean)??[],f=a.includeDefaultClasses===!1?ha(...i):ha("lucide",...n,...i),c=a.absoluteStrokeWidth?Number(a.strokeWidth??Pe["stroke-width"])*Number(e.size??e.width??Pe.width)/Number(a.size??a.width??Pe.width):a.strokeWidth??Pe["stroke-width"];return["svg",{...Object.entries(Pe).reduce((h,[C,x])=>(h[r(C)]=x,h),{}),..."color"in a&&a.color&&{[r("stroke")]:a.color},..."size"in a&&Wt(a.size)&&{[r("width")]:a.size,[r("height")]:a.size},..."width"in a&&Wt(a.width)&&{[r("width")]:a.width},..."height"in a&&Wt(a.height)&&{[r("height")]:a.height},[r("stroke-width")]:c,...f&&{[r("class")]:f},[r("viewBox")]:`0 0 ${s} ${d}`,...a.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(h=>{let[C,x,L]=h,b=a.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...x}:x;return L?[C,b,L]:[C,b]})]}function Eo(e,a={}){return No(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var qo=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};var vs=Lo({});var Oo=()=>Co(vs);var Ho=Ha(({color:e,size:a,width:o,height:r,strokeWidth:s,absoluteStrokeWidth:d,nonScalingStroke:l,className:n="",children:i,iconNode:f=[],icon:c={node:f,aliases:[],size:24},...m},h)=>{let{size:C=24,strokeWidth:x=2,absoluteStrokeWidth:L=!1,nonScalingStroke:b=!1,color:P="currentColor",className:y=""}=Oo()??{},D=!!i||qo(m),[R,K,V=[]]=Eo(c,{color:e??P,width:o??a??C,height:r??a??C,strokeWidth:s??x,absoluteStrokeWidth:d??L,nonScalingStroke:l??b,className:ha(y,n),hasA11yProp:D,attributes:m});return Ge(R,{ref:h,...K},[...V.map(([k,M])=>Ge(k,M)),...Array.isArray(i)?i:[i]])});function E(e,a=[],o=[]){let r=typeof e=="string"?Do(e,a,o):e,s=Ha(({className:d,...l},n)=>Ge(Ho,{ref:n,icon:r,className:d,...l}));return r.name&&(s.displayName=Fo(r.name)),s}var Uo={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};Uo.node;var La=E(Uo);var Vo={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};Vo.node;var Ee=E(Vo);var zo={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};zo.node;var Ia=E(zo);var Go={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};Go.node;var je=E(Go);var Wo={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};Wo.node;var Ca=E(Wo);var _o={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};_o.node;var Qe=E(_o);var Xo={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Xo.node;var Sa=E(Xo);var Ko={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};Ko.node;var Re=E(Ko);var $o={name:"code",size:24,node:[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]};$o.node;var qe=E($o);var Zo={name:"grip-vertical",size:24,node:[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]};Zo.node;var wa=E(Zo);var Jo={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};Jo.node;var Oe=E(Jo);var jo={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};jo.node;var ba=E(jo);var Qo={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};Qo.node;var ya=E(Qo);var Yo={name:"panel-bottom",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]};Yo.node;var ka=E(Yo);var er={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};er.node;var Aa=E(er);var ar={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};ar.node;var ge=E(ar);var tr={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};tr.node;var Se=E(tr);var or={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};or.node;var va=E(or);var rr={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};rr.node;var xe=E(rr);var He=p("@ragents/web/run-view","actorTone");var we=p("@ragents/web/run-view","chatPrimaryId");var Pa=p("@ragents/web/run-view","isPendingRunActorInput");var _t=p("@ragents/web/run-view","runActorFrom");var Ra=p("@ragents/web/run-view","runArtifactContentUrl");var J=p("@ragents/web/run-view","runViewFrom");var he=p("@ragents/web/rpc","rpc");var sr=async(e,a,o,r)=>{await he.call(me.resolveAction,{runId:e,commandId:crypto.randomUUID(),actionId:a,decision:o,result:r})},lr=async(e,a,o)=>{await he.call(me.stopActor,{runId:e,commandId:crypto.randomUUID(),actorId:a,reason:o})},dr=async(e,a)=>{await he.call(me.restartActor,{runId:e,commandId:crypto.randomUUID(),actorId:a})},ur=async(e,a)=>{await he.call(me.stopAll,{runId:e,commandId:crypto.randomUUID(),reason:a})};var Ue=p("@ragents/web/lib/format","formatBytes");var Me=p("@ragents/web/SourceCode","SourceCode");var Xt=p("@ragents/web/lib/labels","thinkingLabel");var oe=e=>{let a=new Date(e);return Number.isNaN(a.getTime())?e:a.toLocaleString("de-DE")};var Ye="flex h-full min-h-0 flex-col bg-card",Jt="flex flex-shrink-0 items-start gap-2.5 border-b border-border-soft px-workspace-inset pt-3 pb-2 [&_h2]:text-[0.95rem] [&_h2]:leading-[1.3]",jt="block truncate text-[0.72rem] text-muted-foreground",Ka="flex flex-shrink-0 flex-wrap items-center gap-x-2.5 gap-y-0.5 border-b border-border-soft px-workspace-inset py-1.5 text-[0.72rem] text-muted-foreground",Da="min-h-0 flex-1 overflow-y-auto px-workspace-inset py-2.5",ee="mb-4 [&>h3]:mb-1.5 [&>h3]:text-[0.72rem] [&>h3]:font-semibold [&>h3]:tracking-[0.05em] [&>h3]:uppercase [&>h3]:text-muted-foreground",Te="flex flex-col gap-1 py-1.5",De="flex cursor-pointer items-center gap-2 rounded-lg border border-border-soft px-2 py-1.5 text-left hover:border-[color-mix(in_srgb,var(--primary)_45%,var(--border))] hover:bg-primary/6 [&_strong]:truncate [&_strong]:text-[0.76rem] [&_small]:text-[0.66rem] [&_small]:text-muted-foreground",Be="flex min-w-0 flex-1 flex-col",be="text-[0.74rem] text-muted-foreground",Qt="my-1.5 text-[0.72rem] text-destructive",Ve="my-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[0.74rem] [&_dt]:text-muted-foreground [&_dd]:[overflow-wrap:anywhere]",Ma="my-1.5 rounded-lg bg-foreground/4 p-2 text-[0.72rem] whitespace-pre-wrap [overflow-wrap:anywhere]",ir="cursor-pointer text-[0.74rem] text-primary underline",Yt="h-auto rounded-full bg-foreground/8 px-2 py-0.5 text-[0.66rem] font-semibold text-muted-foreground",Ps={running:"bg-accent text-primary",active:"bg-success-soft text-success",approved:"bg-success-soft text-success",completed:"bg-success-soft text-success",idle:"bg-success-soft text-success",pending:"bg-success-soft text-success",waiting:"bg-success-soft text-success",queued:"bg-success-soft text-success",failed:"bg-destructive-soft text-destructive",interrupted:"bg-destructive-soft text-destructive"},nr="grid size-[30px] flex-[0_0_30px] place-items-center p-0",Rs={active:"Aktiv",approved:"Best\xE4tigt",completed:"Abgeschlossen",dismissed:"Verworfen",failed:"Fehlgeschlagen",idle:"Bereit",interrupted:"Unterbrochen",pending:"Offen",removed:"Entfernt",running:"L\xE4uft",stopped:"Gestoppt"},fr={human:"Person",agent:"Agent",script:"Logik-Actor"},Ms="Vom Bediener gestoppt",de=e=>e.length>12?`${e.slice(0,12)}...`:e,cr=e=>e.usage,Ts=e=>{let a=e.turns.map(o=>cr(o)?.costUsd).filter(o=>typeof o=="number"&&Number.isFinite(o));return a.length>0?a.reduce((o,r)=>o+r,0):void 0},Ds=e=>`${e.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:e>0&&e<.005?4:2})} USD`,Bs=e=>({view:e,actorById:new Map(e.actors.map(a=>[a.id,a])),inputById:new Map(e.inputs.map(a=>[a.id,a])),turnById:new Map(e.turns.map(a=>[a.id,a])),subscriptionById:new Map(e.subscriptions.map(a=>[a.id,a])),actionById:new Map(e.actions.map(a=>[a.id,a])),artifactById:new Map(e.artifacts.map(a=>[a.id,a]))}),ea=(e,a)=>`@${e.actorById.get(a)?.handle??de(a)}`,pr=(e,a)=>Nt(e.view,a);function $a(e){let a=W().can("runs.inspect"),o=e.view,r=B(()=>o?Bs(o):void 0,[o]);if(!o||!r)return t(Xe,{children:u(Ke,{children:[t($e,{children:"Noch kein Ablauf"}),t(ia,{children:"Sobald Actors gestartet werden, erscheint hier die Detailansicht."})]})});let s=e.selection,d=s?.type==="actor"?r.actorById.get(s.id):void 0,l=s?.type==="input"?r.inputById.get(s.id):void 0,n=s?.type==="turn"?r.turnById.get(s.id):void 0,i=s?.type==="subscription"?r.subscriptionById.get(s.id):void 0,f=s?.type==="action"?r.actionById.get(s.id):void 0,c=s?.type==="artifact"?r.artifactById.get(s.id):void 0,m=r.actorById.get(o.primaryActorId??o.ownerId)??o.actors[0];if(!a){let h=d??m;return h?.kind==="agent"?t(Kt,{actor:h,index:r,...e},h.id):null}return l?t(Us,{index:r,input:l,...e},l.id):n?t(Vs,{index:r,turn:n,...e},n.id):i?t(zs,{index:r,subscription:i,...e},i.id):f?t(Gs,{action:f,index:r,...e},f.id):c?t(Zs,{artifact:c,index:r,...e},c.id):d?t(Kt,{actor:d,index:r,...e},d.id):m?t(Kt,{actor:m,index:r,...e},m.id):t(Xe,{children:t(Ke,{children:t($e,{children:"Keine Actors"})})})}function eo({canGoBack:e,onBack:a}){return e?t(z,{"aria-label":"Zur\xFCck",className:"rounded-full",onClick:a,size:"icon",variant:"outline",children:t(Ee,{})}):null}function Fe({status:e}){return t(se,{className:`${Yt} ${Ps[e]??""}`,children:Rs[e]??e})}var Fs={chat:"M21 11a8 8 0 0 1-8 8H7l-5 3V11a8 8 0 0 1 8-8h3a8 8 0 0 1 8 8ZM7 9h9M7 13h6",info:"M12 11v6M12 7h.01M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0",prompt:"M6 3h12v18H6zM9 7h6M9 11h6M9 15h4",source:"m8 5-6 7 6 7m8-14 6 7-6 7m-3-15-2 16",settings:"M4 6h16M4 12h16M4 18h16M8 3v6M16 9v6M10 15v6",inputs:"M12 3v12m-4-4 4 4 4-4M4 14v7h16v-7",turns:"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-2l2 3M4 16l2 3a7 7 0 0 0 12-2",subscriptions:"M12 3v6M4 15v-3h16v3M12 12v3M2 15h4v6H2zM10 15h4v6h-4zM18 15h4v6h-4z",actions:"m13 2-9 12h7l-1 8 10-13h-7z",artifacts:"M3 6h7l2 3h9v12H3zM3 6V3h7l2 3h7v3",capabilities:"m12 2 9 4v6c0 5-9 10-9 10S3 17 3 12V6zM8 12l3 3 5-6"};function le({kind:e}){return t("svg",{"aria-hidden":"true",fill:"none",height:"15",width:"15",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:t("path",{d:Fs[e]})})}function Ns({sections:e,children:a}){let o=pe(),[r,s]=w(null),d=e.find(l=>l.id===r);return e.length===0?t("div",{className:"flex min-h-0 flex-1 flex-col",children:a}):u(At,{className:"contents",onValueChange:l=>s(l==="chat"?null:String(l)),value:d?.id??"chat",children:[u(vt,{"aria-label":"Actor-Ansichten",className:"flex h-auto w-auto max-w-full flex-shrink-0 flex-nowrap justify-start gap-1 overflow-x-auto rounded-none border-b border-border-soft px-workspace-inset py-1.5",variant:"line",children:[t(Wa,{"aria-label":"Chat anzeigen",className:nr,id:`${o}-chat-tab`,title:"Chat anzeigen",value:"chat",children:t(le,{kind:"chat"})}),e.map(l=>t(Wa,{"aria-label":l.count===void 0?l.label:`${l.label} (${l.count})`,className:nr,id:`${o}-${l.id}-tab`,title:l.count===void 0?l.label:`${l.label} (${l.count})`,value:l.id,children:l.icon},l.id))]}),d&&t(Ga,{className:"min-h-0 flex-1 overflow-y-auto border-b border-border-soft px-workspace-inset py-1.5 text-[0.76rem]",id:`${o}-details`,tabIndex:0,value:d.id,children:d.content}),t(Ga,{className:"flex min-h-0 flex-1 flex-col",id:`${o}-chat`,keepMounted:!0,value:"chat",children:a})]})}function Es({grants:e}){return e.length===0?t(se,{className:Yt,children:"Keine Capabilities"}):t("div",{className:"flex flex-wrap gap-1 py-1.5",children:e.map((a,o)=>{let r=a.scope.kind==="workspace"?a.scope.path:"Run",s=[a.delegable?"delegierbar":void 0,a.usable===!1?"nur weitergeben":void 0].filter(Boolean).join(", ");return u("span",{className:"rounded-full border border-border-soft px-2 py-0.5 text-[0.68rem] [&>small]:text-muted-foreground",title:r,children:[a.capability,s&&u("small",{children:[" ",s]})]},`${a.capability}-${o}`)})})}var qs="my-1.5 rounded-lg border border-[color-mix(in_srgb,var(--primary)_35%,var(--border))] bg-primary/5 px-2.5 py-2 [&>p]:my-1 [&>p]:text-[0.72rem] [&>p]:text-muted-foreground";function Os({action:e,runId:a,onError:o}){let r=W().can("runs.write"),[s,d]=w(""),[l,n]=w(!1),i=async(f,c)=>{if(!l){n(!0);try{await sr(a,e.id,f,c)}catch(m){o(m instanceof Error?m.message:String(m))}finally{n(!1)}}};return u("div",{className:qs,children:[t("strong",{children:e.title}),e.description&&t("p",{children:e.description}),e.owner&&u("p",{children:["wartet auf Eingabe - ",e.owner]}),e.input&&t(te,{className:"my-1.5 text-[0.76rem]",disabled:!r,onChange:f=>d(f.target.value),placeholder:e.input.placeholder??e.input.label,type:"text",value:s}),u("div",{className:"mt-1 flex justify-end gap-1.5",children:[t(z,{disabled:!r||l,onClick:()=>{i("dismissed",void 0)},size:"sm",variant:"outline",children:"Verwerfen"}),t(z,{disabled:!r||l||e.input?.required===!0&&s.trim()==="",onClick:()=>{i("approved",s.trim()||void 0)},size:"sm",children:"Quittieren"})]})]})}function Hs({handle:e,source:a}){return t("div",{className:"overflow-x-auto rounded-lg border border-border-soft bg-border-soft/22",children:t(Me,{content:a,language:"typescript",lineNumbers:!0,path:`${e}.ts`})})}function Kt({actor:e,index:a,...o}){let r=W(),s=da(),d=r.can("runs.write"),l=r.can("runs.inspect"),n=a.view,i=l&&s?.runId===n.id?s.source(n,e.id):void 0,[f,c]=w(),m=n.inputs.filter(S=>S.actorId===e.id).sort((S,j)=>S.sequence-j.sequence),h=n.turns.filter(S=>S.actorId===e.id).sort((S,j)=>S.startedAt.localeCompare(j.startedAt)),C=n.subscriptions.filter(S=>S.subscriberId===e.id),x=n.actions.filter(S=>S.askedBy===e.id),L=n.artifacts.filter(S=>S.createdBy===e.id),b=m.filter(Pa).length,P=e.id===n.primaryActorId,y=P?Ts(n):void 0,D=e.kind!=="human"&&e.lifecycle?.kind!=="stopped",R=e.kind==="human"?void 0:e.lifecycle?.kind??"idle",K=Object.entries(e.inputs??{}),V=e.execution?.driver,k=e.kind==="script"?"TypeScript":!V||V.kind==="manual"?"Manuell":[V.kind,V.config.provider].filter(Boolean).join(" - "),M=V&&V.kind!=="manual"?V.config:void 0,G=[{id:"info",label:"Info: Modell und Run-Details",icon:t(le,{kind:"info"}),content:u("div",{className:Ka,children:[R&&t(Fe,{status:R}),t("span",{children:P?"Prim\xE4rer Actor":fr[e.kind]}),t("span",{children:k}),M?.model&&t("span",{className:"max-w-[220px] truncate",title:M.model,children:M.model}),M?.thinking&&u("span",{children:["Denktiefe ",Xt(M.thinking)]}),u("span",{children:[b," offen"]}),u("span",{children:[h.length," Turns"]}),P&&y!==void 0&&t("span",{title:"Gesamtkosten des Runs \xFCber alle Turns",children:Ds(y)})]})},...e.prompt?[{id:"auftrag",label:"Auftrag",icon:t(le,{kind:"prompt"}),content:t("pre",{className:Ma,children:e.prompt})}]:[],...i?[{id:"source",label:"Quelltext",icon:t(le,{kind:"source"}),content:i}]:e.source?[{id:"source",label:"Quelltext",icon:t(le,{kind:"source"}),count:e.source.replace(/\n$/,"").split(`
|
|
2
|
-
`).length,content:t(Hs,{handle:e.handle,source:e.source})}]:[],...K.length>0?[{id:"vorgaben",label:"Vorgaben",icon:t(le,{kind:"settings"}),count:K.length,content:t("dl",{className:Ve,children:K.map(([S,j])=>u("span",{children:[t("dt",{children:S}),t("dd",{children:j})]},S))})}]:[],{id:"eingaben",label:"Eingaben",icon:t(le,{kind:"inputs"}),count:m.length,content:t("div",{className:Te,children:m.map(S=>u("button",{className:De,onClick:()=>o.onNavigate({type:"input",id:S.id}),type:"button",children:[u("span",{className:Be,children:[t("strong",{children:S.content}),u("small",{children:[pr(a,S)," - ",oe(S.enqueuedAt)]})]}),t(Fe,{status:S.lifecycle.kind==="discarded"?"dismissed":S.lifecycle.kind==="claimed"?a.turnById.get(S.lifecycle.turnId)?.status??"completed":"pending"})]},S.id))})},{id:"turns",label:"Turns",icon:t(le,{kind:"turns"}),count:h.length,content:t("div",{className:Te,children:h.map(S=>u("button",{className:De,onClick:()=>o.onNavigate({type:"turn",id:S.id}),type:"button",children:[u("span",{className:Be,children:[t("strong",{children:de(S.id)}),t("small",{children:oe(S.startedAt)})]}),t(Fe,{status:S.status})]},S.id))})},{id:"subscriptions",label:"Subscriptions",icon:t(le,{kind:"subscriptions"}),count:C.length,content:t("div",{className:Te,children:C.map(S=>u("button",{className:De,onClick:()=>o.onNavigate({type:"subscription",id:S.id}),type:"button",children:[u("span",{className:Be,children:[t("strong",{children:S.eventTypes.join(", ")}),t("small",{children:de(S.id)})]}),t(Fe,{status:S.status})]},S.id))})},...x.length>0?[{id:"aktionen",label:"Aktionen",icon:t(le,{kind:"actions"}),count:x.length,content:t("div",{className:Te,children:x.map(S=>u("button",{className:De,onClick:()=>o.onNavigate({type:"action",id:S.id}),type:"button",children:[u("span",{className:Be,children:[t("strong",{children:S.title}),t("small",{children:oe(S.proposedAt)})]}),t(Fe,{status:S.status})]},S.id))})}]:[],...L.length>0?[{id:"artefakte",label:"Artefakte",icon:t(le,{kind:"artifacts"}),count:L.length,content:t("div",{className:Te,children:L.map(S=>t("button",{className:De,onClick:()=>o.onNavigate({type:"artifact",id:S.id}),type:"button",children:u("span",{className:Be,children:[t("strong",{children:S.title}),u("small",{children:[Ue(S.size)," - ",S.mediaType]})]})},S.id))})}]:[],{id:"capabilities",label:"Capabilities",icon:t(le,{kind:"capabilities"}),count:e.grants.length,content:t(Es,{grants:e.grants})},{id:"werkzeuge",label:"Werkzeuge",icon:t(va,{size:15}),...e.toolNames?{count:e.toolNames.length}:{},content:t("p",{className:be,children:e.toolNames===null?"Alle verf\xFCgbaren Werkzeuge":e.toolNames?.join(", ")||"Keine Werkzeuge"})}];return u("div",{className:Ye,children:[u("header",{className:Jt,children:[t(eo,{canGoBack:o.canGoBack,onBack:o.onBack}),u("div",{className:"flex min-w-0 flex-1 items-baseline gap-2 [&>span]:flex-1",children:[t("h2",{children:e.displayName}),u("span",{className:jt,children:["@",e.handle,l&&e.createdBy?` - erzeugt von ${ea(a,e.createdBy)}`:""]})]}),D&&d&&t(z,{className:"flex-shrink-0",onClick:()=>{lr(n.id,e.id,Ms).catch(S=>c(S.message))},size:"sm",title:`@${e.handle} samt beauftragten Kindern dauerhaft stoppen; die Chat-Eingabe unterbricht dagegen nur den laufenden Turn`,variant:"destructive",children:"Stop"}),l&&d&&e.lifecycle?.kind==="stopped"&&e.kind!=="human"&&t(z,{onClick:()=>{dr(n.id,e.id).catch(S=>c(S.message))},size:"sm",variant:"outline",children:"Neu starten"})]}),f&&t("p",{className:Qt,children:f}),u(Ns,{sections:l?G:[],children:[t(Ze,{actor:e,view:n,presentation:"inspector",display:o.chatDisplay,className:"min-h-0 flex-1",primaryMessages:o.primaryMessages,conversation:o.actorConversations?.[e.id],historyError:o.conversationError,onNavigate:o.onNavigate,running:P?o.primaryRunning:R==="running"}),t(Je,{actor:e,view:n,composerVisible:o.composerVisible,display:o.chatDisplay,running:P?o.primaryRunning:R==="running"})]})]})}function Za({eyebrow:e,title:a,subtitle:o,...r}){return u("header",{className:Jt,children:[t(eo,{canGoBack:r.canGoBack,onBack:r.onBack}),u("div",{className:"min-w-0 flex-1",children:[t("p",{className:"mb-0.5 text-[0.66rem] font-semibold tracking-[0.08em] uppercase text-muted-foreground",children:e}),t("h2",{children:a}),t("span",{className:jt,children:o})]})]})}function Us({index:e,input:a,...o}){let r=a.artifactIds.flatMap(s=>{let d=e.artifactById.get(s);return d?[d]:[]});return u("div",{className:Ye,children:[t(Za,{canGoBack:o.canGoBack,eyebrow:"ActorInput",onBack:o.onBack,subtitle:oe(a.enqueuedAt),title:de(a.id)}),u("div",{className:Da,children:[u("section",{className:ee,children:[t("h3",{children:"Inhalt"}),t("pre",{className:Ma,children:a.content})]}),u("section",{className:ee,children:[t("h3",{children:"Routing"}),u("dl",{className:Ve,children:[t("dt",{children:"Actor"}),t("dd",{children:t(ze,{id:a.actorId,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Eingereiht von"}),t("dd",{children:t(ze,{id:a.enqueuedBy,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Turn"}),t("dd",{children:a.lifecycle.kind==="claimed"?t(Ta,{label:de(a.lifecycle.turnId),onNavigate:o.onNavigate,selection:{type:"turn",id:a.lifecycle.turnId}}):a.lifecycle.kind==="discarded"?"verworfen":"wartet"}),t("dt",{children:"Subscription"}),t("dd",{children:a.subscriptionId?t(Ta,{label:de(a.subscriptionId),onNavigate:o.onNavigate,selection:{type:"subscription",id:a.subscriptionId}}):"keine"}),a.lifecycle.kind==="discarded"&&u(X,{children:[t("dt",{children:"Verworfen"}),t("dd",{children:oe(a.lifecycle.at)}),t("dt",{children:"Grund"}),t("dd",{children:a.lifecycle.reason})]})]})]}),a.sourceEventIds.length>0&&u("section",{className:ee,children:[t("h3",{children:"Quell-Events"}),t("p",{className:be,children:a.sourceEventIds.join(", ")})]}),r.length>0&&t(_s,{artifacts:r,onNavigate:o.onNavigate})]})]})}function Vs({index:e,turn:a,...o}){let r=cr(a);return u("div",{className:Ye,children:[t(Za,{canGoBack:o.canGoBack,eyebrow:"Turn",onBack:o.onBack,subtitle:oe(a.startedAt),title:de(a.id)}),t("div",{className:Ka,children:t(Fe,{status:a.status})}),u("div",{className:Da,children:[u("section",{className:ee,children:[t("h3",{children:"Details"}),u("dl",{className:Ve,children:[t("dt",{children:"Actor"}),t("dd",{children:t(ze,{id:a.actorId,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Eingabe"}),t("dd",{children:t(Ta,{label:de(a.inputId),onNavigate:o.onNavigate,selection:{type:"input",id:a.inputId}})}),t("dt",{children:"Beendet"}),t("dd",{children:a.finishedAt?oe(a.finishedAt):"l\xE4uft"}),a.reason&&u(X,{children:[t("dt",{children:"Grund"}),t("dd",{children:a.reason})]})]})]}),r&&u("section",{className:ee,children:[t("h3",{children:"Nutzung"}),u("dl",{className:Ve,children:[t("dt",{children:"Input-Tokens"}),t("dd",{children:r.inputTokens??0}),t("dt",{children:"Output-Tokens"}),t("dd",{children:r.outputTokens??0}),t("dt",{children:"Cache gelesen"}),t("dd",{children:r.cacheReadTokens??0}),t("dt",{children:"Cache geschrieben"}),t("dd",{children:r.cacheWriteTokens??0}),t("dt",{children:"Kosten"}),u("dd",{children:[(r.costUsd??0).toFixed(6)," USD"]})]})]})]})]})}function zs({index:e,subscription:a,...o}){return u("div",{className:Ye,children:[t(Za,{canGoBack:o.canGoBack,eyebrow:"Subscription",onBack:o.onBack,subtitle:oe(a.createdAt),title:de(a.id)}),t("div",{className:Ka,children:t(Fe,{status:a.status})}),u("div",{className:Da,children:[u("section",{className:ee,children:[t("h3",{children:"Filter"}),u("dl",{className:Ve,children:[t("dt",{children:"Subscriber"}),t("dd",{children:t(ze,{id:a.subscriberId,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Quell-Actors"}),t("dd",{children:a.sourceActorIds?.map(r=>ea(e,r)).join(", ")??"alle"}),t("dt",{children:"Actor-Arten"}),t("dd",{children:a.sourceActorKinds?.join(", ")??"alle"}),t("dt",{children:"Event-Typen"}),t("dd",{children:a.eventTypes.join(", ")}),t("dt",{children:"Eigene Events"}),t("dd",{children:a.includeSelf?"ja":"nein"}),t("dt",{children:"Angelegt von"}),t("dd",{children:t(ze,{id:a.createdBy,index:e,onNavigate:o.onNavigate})}),a.status!=="active"&&u(X,{children:[t("dt",{children:"Grund"}),t("dd",{children:a.reason})]}),a.status==="failed"&&u(X,{children:[t("dt",{children:"Fehler-Event"}),t("dd",{children:a.sourceEventId})]})]})]}),a.sourceActorIds&&u("section",{className:ee,children:[t("h3",{children:"Quell-Actors"}),t(Ws,{actorIds:a.sourceActorIds,index:e,onNavigate:o.onNavigate})]})]})]})}function Gs({action:e,index:a,...o}){let[r,s]=w();return u("div",{className:Ye,children:[t(Za,{canGoBack:o.canGoBack,eyebrow:"Aktion",onBack:o.onBack,subtitle:ea(a,e.askedBy),title:e.title}),t("div",{className:Ka,children:t(Fe,{status:e.status})}),u("div",{className:Da,children:[e.status==="pending"&&t(Os,{action:e,onError:s,runId:a.view.id}),e.description&&u("section",{className:ee,children:[t("h3",{children:"Beschreibung"}),t("p",{children:e.description})]}),u("section",{className:ee,children:[t("h3",{children:"Details"}),u("dl",{className:Ve,children:[t("dt",{children:"Gefragt von"}),t("dd",{children:t(ze,{id:e.askedBy,index:a,onNavigate:o.onNavigate})}),t("dt",{children:"Vorgeschlagen"}),t("dd",{children:oe(e.proposedAt)}),e.resolvedAt&&u(X,{children:[t("dt",{children:"Aufgel\xF6st"}),t("dd",{children:oe(e.resolvedAt)})]}),e.owner&&u(X,{children:[t("dt",{children:"Eigent\xFCmer"}),t("dd",{children:e.owner})]}),e.result!==null&&e.result!==void 0&&u(X,{children:[t("dt",{children:"Ergebnis"}),t("dd",{children:typeof e.result=="string"?e.result:JSON.stringify(e.result)})]})]})]}),Object.keys(e.parameters).length>0&&u("section",{className:ee,children:[t("h3",{children:"Parameter"}),t("pre",{className:Ma,children:JSON.stringify(e.parameters,null,2)})]}),e.payload!==null&&e.payload!==void 0&&u("section",{className:ee,children:[t("h3",{children:"Nutzdaten"}),t("pre",{className:Ma,children:JSON.stringify(e.payload,null,2)})]}),r&&t("p",{className:Qt,children:r})]})]})}function Ta({label:e,onNavigate:a,selection:o}){return t("button",{className:ir,onClick:()=>a(o),type:"button",children:e})}function ze({id:e,index:a,onNavigate:o}){return t(Ta,{label:ea(a,e),onNavigate:o,selection:{type:"actor",id:e}})}function Ws({actorIds:e,index:a,onNavigate:o}){return t("div",{className:Te,children:e.map(r=>{let s=a.actorById.get(r);return u("button",{className:De,onClick:()=>o({type:"actor",id:r}),type:"button",children:[u("span",{className:Be,children:[t("strong",{children:s?.displayName??de(r)}),t("small",{children:ea(a,r)})]}),s&&t(se,{className:Yt,children:fr[s.kind]})]},r)})})}function _s({artifacts:e,onNavigate:a}){return u("section",{className:ee,children:[t("h3",{children:"Artefakte"}),t("div",{className:Te,children:e.map(o=>t("button",{className:De,onClick:()=>a({type:"artifact",id:o.id}),type:"button",children:u("span",{className:Be,children:[t("strong",{children:o.title}),u("small",{children:[Ue(o.size)," - ",o.mediaType]})]})},o.id))})]})}var Xs=e=>{let a=e.toLowerCase();return a.startsWith("text/")||a.includes("json")||a.includes("xml")||a.includes("yaml")};function Zt(e,a){let o=U(new Map),[r,s]=w(0),d=a?.id,l=()=>{d&&o.current.delete(d),s(n=>n+1)};return O(()=>{if(!(!a||o.current.has(a.id))){if(a.mediaType.toLowerCase().startsWith("image/")){o.current.set(a.id,{kind:"image"}),s(n=>n+1);return}if(!Xs(a.mediaType)){o.current.set(a.id,{kind:"download"}),s(n=>n+1);return}o.current.set(a.id,{kind:"loading"}),s(n=>n+1),(async()=>{try{let n=await fetch(Ra(e,a.id),{headers:{Accept:a.mediaType}});if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);let i=await n.text();if(a.mediaType.toLowerCase().includes("json"))try{i=JSON.stringify(JSON.parse(i),null,2)}catch{}o.current.set(a.id,{kind:"text",text:i})}catch(n){o.current.set(a.id,{kind:"error",message:n instanceof Error?n.message:String(n)})}s(n=>n+1)})()}},[a,e,r]),{content:a?o.current.get(a.id):void 0,retry:l}}var $t=5e3,Ks=(e,a)=>{let o=Array.from({length:e.length+1},()=>new Uint32Array(a.length+1));for(let l=e.length-1;l>=0;l-=1)for(let n=a.length-1;n>=0;n-=1)o[l][n]=e[l]===a[n]?o[l+1][n+1]+1:Math.max(o[l+1][n],o[l][n+1]);let r=[],s=0,d=0;for(;s<e.length&&d<a.length;)e[s]===a[d]?(r.push({kind:"same",text:e[s]}),s+=1,d+=1):o[s+1][d]>=o[s][d+1]?(r.push({kind:"removed",text:e[s]}),s+=1):(r.push({kind:"added",text:a[d]}),d+=1);for(;s<e.length;)r.push({kind:"removed",text:e[s++]});for(;d<a.length;)r.push({kind:"added",text:a[d++]});return r};function $s({artifact:e,index:a}){let o=e.previousVersionId?a.artifactById.get(e.previousVersionId):void 0,r=Zt(a.view.id,o).content,s=Zt(a.view.id,e).content,d=r?.kind==="text"?r.text:void 0,l=s?.kind==="text"?s.text:void 0,n=B(()=>{if(d===void 0||l===void 0)return;let f=d.split(`
|
|
1
|
+
import{a as xt,b as Ua}from"/plugins/ragents.orchestration/web/chunks/chunk-CFMJD5ZI.js";import{b as da}from"/plugins/ragents.orchestration/web/chunks/chunk-UCIMT2R4.js";import{a as p,b as Lo,c as Ge,d as Ha,e as Io,f as q,g as Co,h as O,i as pe,j as We,k as D,l as U,m as w}from"/plugins/ragents.orchestration/web/chunks/chunk-HOBLI364.js";import{a as ve,e as ua,f as So,g as ft,h as ct,i as pt,j as mt}from"/plugins/ragents.orchestration/web/chunks/chunk-XGPPQCZR.js";var W=p("@ragents/web/AccessContext","useAccess");var na=p("react-dom","createPortal");var gt=p("@ragents/engine/src/http/contracts","handleKey");var me=p("@ragents/engine/src/http/contracts","runContracts");var wo="ragents.orchestration",bs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yo=e=>{let a=e.trim();if(a.startsWith("@")){let s=gt(a);if(!s||/\s/.test(s))throw new Error(`Entity ${JSON.stringify(e)}: a handle is missing after the @`);return{kind:"actor",handle:s}}let o=/^app:(.+)$/s.exec(a);if(!o)throw new Error(`Entity ${JSON.stringify(e)}: expected @handle or app:<id>`);let r=o[1].trim();if(!r)throw new Error(`Entity ${JSON.stringify(e)}: the ID after the colon is empty`);return{kind:"app",id:r}},bo=e=>e.kind==="actor"?`@${e.handle}`:`app:${e.id}`,ks=["nodes","shapes","lines","mode"],ko=e=>{if(!bs(e))throw new Error("The arrangement must be an object with root");let a=ks.filter(o=>o in e);if(a.length>0)throw new Error(`The program arrangement comes from the removed free surface (${a.join(", ")}); canvas_layout_replace with root sets it anew as a tile layout`);if(!("root"in e))throw new Error("root is missing; expected a tile, a split or null");return{root:e.root===null?null:_e(e.root)}};var vo=16,Ao=64,_e=e=>{let a=new Set,o=(r,s,d)=>{if(d>vo)throw new Error(`${s}: at most ${vo} nested splits are allowed`);if(typeof r!="object"||r===null||Array.isArray(r))throw new Error(`${s} must be a tile or a split`);let l=r;if(Object.hasOwn(l,"entity")){if(Object.keys(l).some(f=>f!=="entity"&&f!=="chatInput"))throw new Error(`${s}: a tile carries only entity and chatInput; a split direction, weights and children`);if(typeof l.entity!="string")throw new Error(`${s}.entity must be @handle or app:<name>/<view>`);let n=yo(l.entity),i=bo(n);if(l.chatInput!==void 0&&(n.kind!=="actor"||typeof l.chatInput!="boolean"))throw new Error(`${s}.chatInput is only allowed for actors, as a boolean`);if(a.has(i))throw new Error(`${s}: ${i} is placed as a tile more than once`);if(a.add(i),a.size>Ao)throw new Error(`At most ${Ao} tiles are allowed`);return l.chatInput===void 0?{entity:i}:{entity:i,chatInput:l.chatInput}}if(Object.keys(l).some(n=>!["direction","weights","children"].includes(n)))throw new Error(`${s}: a split carries only direction, weights and children`);if(l.direction!=="horizontal"&&l.direction!=="vertical")throw new Error(`${s}.direction must be horizontal or vertical`);if(!Array.isArray(l.weights)||l.weights.length!==2||l.weights.some(n=>typeof n!="number"||!Number.isFinite(n)||n<=0))throw new Error(`${s}.weights must contain exactly two finite positive numbers`);if(!Array.isArray(l.children)||l.children.length!==2)throw new Error(`${s}.children must contain exactly two tiles or splits`);return{direction:l.direction,weights:[l.weights[0],l.weights[1]],children:[o(l.children[0],`${s}.children[0]`,d+1),o(l.children[1],`${s}.children[1]`,d+1)]}};return o(e,"root",0)},Va=(e,a)=>e?"entity"in e?e.entity!==a||e.chatInput!==!1:Va(e.children[0],a)&&Va(e.children[1],a):!0,za=e=>e?"entity"in e?[e.entity]:e.children.flatMap(za):[];var ht=p("@ragents/web/ui","Alert");var Lt=p("@ragents/web/ui","AlertDescription");var se=p("@ragents/web/ui","Badge");var z=p("@ragents/web/ui","Button");var Xe=p("@ragents/web/ui","Empty");var ia=p("@ragents/web/ui","EmptyDescription");var $e=p("@ragents/web/ui","EmptyHeader");var Ke=p("@ragents/web/ui","EmptyTitle");var te=p("@ragents/web/ui","Input");var fa=p("@ragents/web/ui","Popover");var ca=p("@ragents/web/ui","PopoverContent");var It=p("@ragents/web/ui","SectionLabel");var Ct=p("@ragents/web/ui","Select");var St=p("@ragents/web/ui","SelectContent");var wt=p("@ragents/web/ui","SelectItem");var yt=p("@ragents/web/ui","SelectTrigger");var bt=p("@ragents/web/ui","SelectValue");var Ae=p("@ragents/web/ui","Spinner");var pa=p("@ragents/web/ui","StartupNotice");var kt=p("@ragents/web/ui","StopGlyph");var vt=p("@ragents/web/ui","Tabs");var Ga=p("@ragents/web/ui","TabsContent");var At=p("@ragents/web/ui","TabsList");var Wa=p("@ragents/web/ui","TabsTrigger");var Y=p("@ragents/web/ui","cn");var Pt=p("quassel","ChatInputToolbar");var Rt=p("quassel","ChatMessages");var ma=p("quassel","ChatPanel");var Mt=p("@ragents/web/PluginRegistry","SurfaceControllerProvider");var Tt=p("@ragents/web/PluginRegistry","useActionRenderer");var xa=p("@ragents/web/PluginRegistry","useSurfaceController");var Bt=p("@ragents/web/PluginRegistry","useToolRenderer");var Dt=p("@ragents/web/chat-view-settings","ChatViewSwitches");var ga=p("@ragents/web/chat-view-settings","useChatViewSettings");var Ft=p("@ragents/web/actor-conversation","actorChatMessages");var Nt=p("@ragents/web/actor-conversation","actorInputLabel");var X=p("react/jsx-runtime","Fragment");var t=p("react/jsx-runtime","jsx");var u=p("react/jsx-runtime","jsxs");var vs=[];function Je({actor:e,view:a,presentation:o,display:r=o,primaryMessages:s=vs,conversation:d,historyError:l,running:n=!1,className:i,onNavigate:f,scrollerRef:c}){let m=W().can("runs.inspect"),h=ga(a.id,e.id,"agents",r),C=Bt(),g=Tt(),L=h.detailMode,y=m||L==="off"?L:"current",P=D(()=>Ft(a,e,s,d),[a,e,s,d]),b=q(B=>{let R=/^ablauf:(actor|input|turn|subscription|action|artifact)\/(.+)$/.exec(B);return R?(m&&f({type:R[1],id:R[2]}),!0):!1},[m,f]);return u(X,{children:[l&&t("p",{className:"my-1.5 text-[0.72rem] text-destructive",role:"alert",children:l}),t(Rt,{className:i,detailMode:y,emptyState:t(Xe,{children:u($e,{children:[t(Ke,{children:e.kind==="script"?"No history yet":"No conversation yet"}),t(ia,{children:e.kind==="script"?"Program inputs and their processing appear here.":"Write a message to start the conversation."})]})}),messages:P,renderAction:g,renderTool:C,owner:e.id,onLinkClick:b,running:n,showTimestamps:h.showTimestamps,stepsExpandable:m&&h.stepsExpandable,scrollerRef:c})]})}var Et=p("@ragents/web/api","interruptActorTurn");var qt=p("@ragents/web/api","sendActorMessage");var Ot=p("@ragents/web/chat/StoppedActorNotice","StoppedActorNotice");var Ht=p("@ragents/web/chat/useAttachmentCapabilities","useAttachmentCapabilities");var Ut=p("@ragents/web/chat/chat-target","programChatNotice");var Vt=p("@ragents/web/chat/chat-target","runIsWorking");var Po="flex flex-shrink-0 items-center gap-2 border-t border-border-soft px-workspace-inset pt-2 pb-2.5",zt="mt-1.5 text-[0.7rem] text-muted-foreground";function je({actor:e,view:a,composerVisible:o=!0,presentation:r="inspector",display:s=r,running:d=!1,toolbarLeft:l,toolbarRight:n}){let i=W().can("runs.write"),[f,c]=w(),m=ga(a.id,e.id,"agents",s),h=Ht(a.id,e.id,JSON.stringify(e.execution?.driver.config)),C=i?void 0:"You have read access to this run.",g=t(Dt,{settings:m});return!o||e.kind==="human"?u("div",{className:Po,children:[l,g]}):e.kind==="script"?u("div",{className:Po,children:[t("p",{className:zt,children:Ut}),l,g]}):e.lifecycle?.kind==="stopped"?t("div",{className:r==="inspector"?"flex-shrink-0 px-5 pt-2.5 pb-3.5":void 0,children:t(Ot,{actor:e,runId:a.id,toolbar:u(X,{children:[l,g]})})}):u("div",{className:r==="inspector"?"flex-shrink-0 px-5 pt-2.5 pb-3.5":void 0,children:[t(Pt,{...h,disabled:C!==void 0,layout:r==="surface"?"inline":"card",maxRows:4,onSend:(L,y)=>qt(a.id,e.id,L,y),onStop:i&&e.lifecycle?.kind==="running"?()=>{c(void 0),Et(a.id,e.id).catch(L=>c(L instanceof Error?L.message:String(L)))}:void 0,rows:1,running:d,texts:{placeholder:C??`Message to @${e.handle} ...`},toolbarLeft:u(X,{children:[l,g,r==="inspector"&&u("span",{className:"truncate text-[0.7rem] text-muted-foreground",children:["to @",e.handle]})]}),toolbarRight:n}),f&&t("p",{className:zt,role:"alert",children:f}),C&&r==="inspector"&&t("p",{className:zt,children:C})]})}var Ro=Io(function({actor:a,view:o,primaryMessages:r,conversation:s,historyError:d,chatInput:l=!0,running:n=!1,onNavigate:i}){let f=q(c=>{c&&(c.tabIndex=0,c.setAttribute("role","region"),c.setAttribute("aria-label",`Chat history of @${a.handle}`))},[a.handle]);return t("div",{className:"flex min-h-[106px] w-full min-w-0 flex-1 flex-col overflow-hidden rounded-b-[16px] text-left","data-surface-scroll":"true",children:t(ma,{className:"flex-1",composer:t(je,{actor:a,view:o,composerVisible:l,presentation:"surface",running:n}),children:t(Je,{actor:a,view:o,presentation:"surface",primaryMessages:r,conversation:s,historyError:d,running:n,onNavigate:i,scrollerRef:f})})})});var Gt="ragents.orchestration",_a="flex h-full min-w-statusbar items-center justify-center self-stretch whitespace-nowrap px-2.5 text-[0.7rem] text-foreground hover:bg-primary/12 aria-expanded:bg-primary/12 focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",Xa="grid gap-2.5 border-t border-border-soft px-3 pt-2.5 pb-2.5 empty:hidden";function Mo({actor:e,view:a,cardSections:o,chatInput:r,session:s,navigation:d,onSelect:l}){return u("div",{className:"flex flex-col overflow-hidden has-[>[data-slot=card-sections]:not(:empty)]:min-h-[260px] has-[[data-chat=actions]:not(:empty)]:min-h-[260px]",children:[t(Ro,{actor:e,view:a,chatInput:r,running:e.lifecycle?.kind==="running",conversation:s.actorConversations?.[e.id],historyError:s.conversationError,onNavigate:l,primaryMessages:e.id===a.primaryActorId?s.messages:void 0}),t("div",{className:`${Xa} max-h-[45%] flex-[0_1_auto] overflow-auto overscroll-contain`,"data-slot":"card-sections",children:o.map(({id:n,Section:i})=>t(i,{actor:e,navigation:d,session:s},n))})]})}var To=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Bo(e,a,o=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:To(e),size:24,node:a,...o.length>0?{aliases:o}:{}}}var Do=e=>{let a="",o=!1;for(let r of e){if(r==="-"||r==="_"||r<=" "){o=a.length>0;continue}a.length===0?a+=r.toLowerCase():a+=o?r.toUpperCase():r,o=!1}return a};var Fo=e=>{let a=Do(e);return a.charAt(0).toUpperCase()+a.slice(1)};var ha=(...e)=>e.filter((a,o,r)=>!!a&&a.trim()!==""&&r.indexOf(a)===o).join(" ").trim();var Pe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function Wt(e){return e!=null}function No(e,a={}){let o=a.attributeNames??{},r=h=>o[h]??h,s=e.size??e.width??Pe.width,d=e.size??e.height??Pe.height,l=e.aliases?.filter(h=>typeof h=="string"&&h.trim()!=="").map(h=>`lucide-${h}`)??[],n=[...e.name?[`lucide-${e.name}`]:[],...l],i=a.className?.split(" ").filter(Boolean)??[],f=a.includeDefaultClasses===!1?ha(...i):ha("lucide",...n,...i),c=a.absoluteStrokeWidth?Number(a.strokeWidth??Pe["stroke-width"])*Number(e.size??e.width??Pe.width)/Number(a.size??a.width??Pe.width):a.strokeWidth??Pe["stroke-width"];return["svg",{...Object.entries(Pe).reduce((h,[C,g])=>(h[r(C)]=g,h),{}),..."color"in a&&a.color&&{[r("stroke")]:a.color},..."size"in a&&Wt(a.size)&&{[r("width")]:a.size,[r("height")]:a.size},..."width"in a&&Wt(a.width)&&{[r("width")]:a.width},..."height"in a&&Wt(a.height)&&{[r("height")]:a.height},[r("stroke-width")]:c,...f&&{[r("class")]:f},[r("viewBox")]:`0 0 ${s} ${d}`,...a.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(h=>{let[C,g,L]=h,y=a.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...g}:g;return L?[C,y,L]:[C,y]})]}function Eo(e,a={}){return No(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var qo=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};var As=Lo({});var Oo=()=>Co(As);var Ho=Ha(({color:e,size:a,width:o,height:r,strokeWidth:s,absoluteStrokeWidth:d,nonScalingStroke:l,className:n="",children:i,iconNode:f=[],icon:c={node:f,aliases:[],size:24},...m},h)=>{let{size:C=24,strokeWidth:g=2,absoluteStrokeWidth:L=!1,nonScalingStroke:y=!1,color:P="currentColor",className:b=""}=Oo()??{},B=!!i||qo(m),[R,$,V=[]]=Eo(c,{color:e??P,width:o??a??C,height:r??a??C,strokeWidth:s??g,absoluteStrokeWidth:d??L,nonScalingStroke:l??y,className:ha(b,n),hasA11yProp:B,attributes:m});return Ge(R,{ref:h,...$},[...V.map(([k,M])=>Ge(k,M)),...Array.isArray(i)?i:[i]])});function E(e,a=[],o=[]){let r=typeof e=="string"?Bo(e,a,o):e,s=Ha(({className:d,...l},n)=>Ge(Ho,{ref:n,icon:r,className:d,...l}));return r.name&&(s.displayName=Fo(r.name)),s}var Uo={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};Uo.node;var La=E(Uo);var Vo={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};Vo.node;var Ee=E(Vo);var zo={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};zo.node;var Ia=E(zo);var Go={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};Go.node;var Ze=E(Go);var Wo={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};Wo.node;var Ca=E(Wo);var _o={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};_o.node;var Qe=E(_o);var Xo={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Xo.node;var Sa=E(Xo);var $o={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};$o.node;var Re=E($o);var Ko={name:"code",size:24,node:[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]]};Ko.node;var qe=E(Ko);var Jo={name:"grip-vertical",size:24,node:[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]};Jo.node;var wa=E(Jo);var jo={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};jo.node;var Oe=E(jo);var Zo={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};Zo.node;var ya=E(Zo);var Qo={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};Qo.node;var ba=E(Qo);var Yo={name:"panel-bottom",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]};Yo.node;var ka=E(Yo);var er={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};er.node;var va=E(er);var ar={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};ar.node;var xe=E(ar);var tr={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};tr.node;var Se=E(tr);var or={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};or.node;var Aa=E(or);var rr={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};rr.node;var ge=E(rr);var He=p("@ragents/web/run-view","actorTone");var we=p("@ragents/web/run-view","chatPrimaryId");var Pa=p("@ragents/web/run-view","isPendingRunActorInput");var _t=p("@ragents/web/run-view","runActorFrom");var Ra=p("@ragents/web/run-view","runArtifactContentUrl");var j=p("@ragents/web/run-view","runViewFrom");var he=p("@ragents/web/rpc","rpc");var sr=async(e,a,o,r)=>{await he.call(me.resolveAction,{runId:e,commandId:crypto.randomUUID(),actionId:a,decision:o,result:r})},lr=async(e,a,o)=>{await he.call(me.stopActor,{runId:e,commandId:crypto.randomUUID(),actorId:a,reason:o})},dr=async(e,a)=>{await he.call(me.restartActor,{runId:e,commandId:crypto.randomUUID(),actorId:a})},ur=async(e,a)=>{await he.call(me.stopAll,{runId:e,commandId:crypto.randomUUID(),reason:a})};var Ue=p("@ragents/web/lib/format","formatBytes");var Me=p("@ragents/web/SourceCode","SourceCode");var Xt=p("@ragents/web/lib/labels","thinkingLabel");var oe=e=>{let a=new Date(e);return Number.isNaN(a.getTime())?e:a.toLocaleString("en-US")};var Ye="flex h-full min-h-0 flex-col bg-card",jt="flex flex-shrink-0 items-start gap-2.5 border-b border-border-soft px-workspace-inset pt-3 pb-2 [&_h2]:text-[0.95rem] [&_h2]:leading-[1.3]",Zt="block truncate text-[0.72rem] text-muted-foreground",$a="flex flex-shrink-0 flex-wrap items-center gap-x-2.5 gap-y-0.5 border-b border-border-soft px-workspace-inset py-1.5 text-[0.72rem] text-muted-foreground",Ba="min-h-0 flex-1 overflow-y-auto px-workspace-inset py-2.5",ee="mb-4 [&>h3]:mb-1.5 [&>h3]:text-[0.72rem] [&>h3]:font-semibold [&>h3]:tracking-[0.05em] [&>h3]:uppercase [&>h3]:text-muted-foreground",Te="flex flex-col gap-1 py-1.5",Be="flex cursor-pointer items-center gap-2 rounded-lg border border-border-soft px-2 py-1.5 text-left hover:border-[color-mix(in_srgb,var(--primary)_45%,var(--border))] hover:bg-primary/6 [&_strong]:truncate [&_strong]:text-[0.76rem] [&_small]:text-[0.66rem] [&_small]:text-muted-foreground",De="flex min-w-0 flex-1 flex-col",ye="text-[0.74rem] text-muted-foreground",Qt="my-1.5 text-[0.72rem] text-destructive",Ve="my-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-[0.74rem] [&_dt]:text-muted-foreground [&_dd]:[overflow-wrap:anywhere]",Ma="my-1.5 rounded-lg bg-foreground/4 p-2 text-[0.72rem] whitespace-pre-wrap [overflow-wrap:anywhere]",ir="cursor-pointer text-[0.74rem] text-primary underline",Yt="h-auto rounded-full bg-foreground/8 px-2 py-0.5 text-[0.66rem] font-semibold text-muted-foreground",Ps={running:"bg-accent text-primary",active:"bg-success-soft text-success",approved:"bg-success-soft text-success",completed:"bg-success-soft text-success",idle:"bg-success-soft text-success",pending:"bg-success-soft text-success",waiting:"bg-success-soft text-success",queued:"bg-success-soft text-success",failed:"bg-destructive-soft text-destructive",interrupted:"bg-destructive-soft text-destructive"},nr="grid size-[30px] flex-[0_0_30px] place-items-center p-0",Rs={active:"Active",approved:"Approved",completed:"Completed",dismissed:"Dismissed",failed:"Failed",idle:"Ready",interrupted:"Interrupted",pending:"Open",removed:"Removed",running:"Running",stopped:"Stopped"},fr={human:"Person",agent:"Agent",script:"Logic actor"},Ms="Stopped by the operator",de=e=>e.length>12?`${e.slice(0,12)}...`:e,cr=e=>e.usage,Ts=e=>{let a=e.turns.map(o=>cr(o)?.costUsd).filter(o=>typeof o=="number"&&Number.isFinite(o));return a.length>0?a.reduce((o,r)=>o+r,0):void 0},Bs=e=>`${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:e>0&&e<.005?4:2})} USD`,Ds=e=>({view:e,actorById:new Map(e.actors.map(a=>[a.id,a])),inputById:new Map(e.inputs.map(a=>[a.id,a])),turnById:new Map(e.turns.map(a=>[a.id,a])),subscriptionById:new Map(e.subscriptions.map(a=>[a.id,a])),actionById:new Map(e.actions.map(a=>[a.id,a])),artifactById:new Map(e.artifacts.map(a=>[a.id,a]))}),ea=(e,a)=>`@${e.actorById.get(a)?.handle??de(a)}`,pr=(e,a)=>Nt(e.view,a);function Ka(e){let a=W().can("runs.inspect"),o=e.view,r=D(()=>o?Ds(o):void 0,[o]);if(!o||!r)return t(Xe,{children:u($e,{children:[t(Ke,{children:"No flow yet"}),t(ia,{children:"As soon as actors are started, the detail view appears here."})]})});let s=e.selection,d=s?.type==="actor"?r.actorById.get(s.id):void 0,l=s?.type==="input"?r.inputById.get(s.id):void 0,n=s?.type==="turn"?r.turnById.get(s.id):void 0,i=s?.type==="subscription"?r.subscriptionById.get(s.id):void 0,f=s?.type==="action"?r.actionById.get(s.id):void 0,c=s?.type==="artifact"?r.artifactById.get(s.id):void 0,m=r.actorById.get(o.primaryActorId??o.ownerId)??o.actors[0];if(!a){let h=d??m;return h?.kind==="agent"?t($t,{actor:h,index:r,...e},h.id):null}return l?t(Us,{index:r,input:l,...e},l.id):n?t(Vs,{index:r,turn:n,...e},n.id):i?t(zs,{index:r,subscription:i,...e},i.id):f?t(Gs,{action:f,index:r,...e},f.id):c?t(Js,{artifact:c,index:r,...e},c.id):d?t($t,{actor:d,index:r,...e},d.id):m?t($t,{actor:m,index:r,...e},m.id):t(Xe,{children:t($e,{children:t(Ke,{children:"No actors"})})})}function eo({canGoBack:e,onBack:a}){return e?t(z,{"aria-label":"Back",className:"rounded-full",onClick:a,size:"icon",variant:"outline",children:t(Ee,{})}):null}function Fe({status:e}){return t(se,{className:`${Yt} ${Ps[e]??""}`,children:Rs[e]??e})}var Fs={chat:"M21 11a8 8 0 0 1-8 8H7l-5 3V11a8 8 0 0 1 8-8h3a8 8 0 0 1 8 8ZM7 9h9M7 13h6",info:"M12 11v6M12 7h.01M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0",prompt:"M6 3h12v18H6zM9 7h6M9 11h6M9 15h4",source:"m8 5-6 7 6 7m8-14 6 7-6 7m-3-15-2 16",settings:"M4 6h16M4 12h16M4 18h16M8 3v6M16 9v6M10 15v6",inputs:"M12 3v12m-4-4 4 4 4-4M4 14v7h16v-7",turns:"M20 7v5h-5M4 17v-5h5M6 7a7 7 0 0 1 12-2l2 3M4 16l2 3a7 7 0 0 0 12-2",subscriptions:"M12 3v6M4 15v-3h16v3M12 12v3M2 15h4v6H2zM10 15h4v6h-4zM18 15h4v6h-4z",actions:"m13 2-9 12h7l-1 8 10-13h-7z",artifacts:"M3 6h7l2 3h9v12H3zM3 6V3h7l2 3h7v3",capabilities:"m12 2 9 4v6c0 5-9 10-9 10S3 17 3 12V6zM8 12l3 3 5-6"};function le({kind:e}){return t("svg",{"aria-hidden":"true",fill:"none",height:"15",width:"15",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:t("path",{d:Fs[e]})})}function Ns({sections:e,children:a}){let o=pe(),[r,s]=w(null),d=e.find(l=>l.id===r);return e.length===0?t("div",{className:"flex min-h-0 flex-1 flex-col",children:a}):u(vt,{className:"contents",onValueChange:l=>s(l==="chat"?null:String(l)),value:d?.id??"chat",children:[u(At,{"aria-label":"Actor views",className:"flex h-auto w-auto max-w-full flex-shrink-0 flex-nowrap justify-start gap-1 overflow-x-auto rounded-none border-b border-border-soft px-workspace-inset py-1.5",variant:"line",children:[t(Wa,{"aria-label":"Show chat",className:nr,id:`${o}-chat-tab`,title:"Show chat",value:"chat",children:t(le,{kind:"chat"})}),e.map(l=>t(Wa,{"aria-label":l.count===void 0?l.label:`${l.label} (${l.count})`,className:nr,id:`${o}-${l.id}-tab`,title:l.count===void 0?l.label:`${l.label} (${l.count})`,value:l.id,children:l.icon},l.id))]}),d&&t(Ga,{className:"min-h-0 flex-1 overflow-y-auto border-b border-border-soft px-workspace-inset py-1.5 text-[0.76rem]",id:`${o}-details`,tabIndex:0,value:d.id,children:d.content}),t(Ga,{className:"flex min-h-0 flex-1 flex-col",id:`${o}-chat`,keepMounted:!0,value:"chat",children:a})]})}function Es({grants:e}){return e.length===0?t(se,{className:Yt,children:"No capabilities"}):t("div",{className:"flex flex-wrap gap-1 py-1.5",children:e.map((a,o)=>{let r=a.scope.kind==="workspace"?a.scope.path:"Run",s=[a.delegable?"delegable":void 0,a.usable===!1?"pass on only":void 0].filter(Boolean).join(", ");return u("span",{className:"rounded-full border border-border-soft px-2 py-0.5 text-[0.68rem] [&>small]:text-muted-foreground",title:r,children:[a.capability,s&&u("small",{children:[" ",s]})]},`${a.capability}-${o}`)})})}var qs="my-1.5 rounded-lg border border-[color-mix(in_srgb,var(--primary)_35%,var(--border))] bg-primary/5 px-2.5 py-2 [&>p]:my-1 [&>p]:text-[0.72rem] [&>p]:text-muted-foreground";function Os({action:e,runId:a,onError:o}){let r=W().can("runs.write"),[s,d]=w(""),[l,n]=w(!1),i=async(f,c)=>{if(!l){n(!0);try{await sr(a,e.id,f,c)}catch(m){o(m instanceof Error?m.message:String(m))}finally{n(!1)}}};return u("div",{className:qs,children:[t("strong",{children:e.title}),e.description&&t("p",{children:e.description}),e.owner&&u("p",{children:["waiting for input - ",e.owner]}),e.input&&t(te,{className:"my-1.5 text-[0.76rem]",disabled:!r,onChange:f=>d(f.target.value),placeholder:e.input.placeholder??e.input.label,type:"text",value:s}),u("div",{className:"mt-1 flex justify-end gap-1.5",children:[t(z,{disabled:!r||l,onClick:()=>{i("dismissed",void 0)},size:"sm",variant:"outline",children:"Dismiss"}),t(z,{disabled:!r||l||e.input?.required===!0&&s.trim()==="",onClick:()=>{i("approved",s.trim()||void 0)},size:"sm",children:"Acknowledge"})]})]})}function Hs({handle:e,source:a}){return t("div",{className:"overflow-x-auto rounded-lg border border-border-soft bg-border-soft/22",children:t(Me,{content:a,language:"typescript",lineNumbers:!0,path:`${e}.ts`})})}function $t({actor:e,index:a,...o}){let r=W(),s=da(),d=r.can("runs.write"),l=r.can("runs.inspect"),n=a.view,i=l&&s?.runId===n.id?s.source(n,e.id):void 0,[f,c]=w(),m=n.inputs.filter(S=>S.actorId===e.id).sort((S,Z)=>S.sequence-Z.sequence),h=n.turns.filter(S=>S.actorId===e.id).sort((S,Z)=>S.startedAt.localeCompare(Z.startedAt)),C=n.subscriptions.filter(S=>S.subscriberId===e.id),g=n.actions.filter(S=>S.askedBy===e.id),L=n.artifacts.filter(S=>S.createdBy===e.id),y=m.filter(Pa).length,P=e.id===n.primaryActorId,b=P?Ts(n):void 0,B=e.kind!=="human"&&e.lifecycle?.kind!=="stopped",R=e.kind==="human"?void 0:e.lifecycle?.kind??"idle",$=Object.entries(e.inputs??{}),V=e.execution?.driver,k=e.kind==="script"?"TypeScript":!V||V.kind==="manual"?"Manual":[V.kind,V.config.provider].filter(Boolean).join(" - "),M=V&&V.kind!=="manual"?V.config:void 0,G=[{id:"info",label:"Info: model and run details",icon:t(le,{kind:"info"}),content:u("div",{className:$a,children:[R&&t(Fe,{status:R}),t("span",{children:P?"Primary actor":fr[e.kind]}),t("span",{children:k}),M?.model&&t("span",{className:"max-w-[220px] truncate",title:M.model,children:M.model}),M?.thinking&&u("span",{children:["Thinking level ",Xt(M.thinking)]}),u("span",{children:[y," open"]}),u("span",{children:[h.length," Turns"]}),P&&b!==void 0&&t("span",{title:"Total cost of the run across all turns",children:Bs(b)})]})},...e.prompt?[{id:"prompt",label:"Task",icon:t(le,{kind:"prompt"}),content:t("pre",{className:Ma,children:e.prompt})}]:[],...i?[{id:"source",label:"Source code",icon:t(le,{kind:"source"}),content:i}]:e.source?[{id:"source",label:"Source code",icon:t(le,{kind:"source"}),count:e.source.replace(/\n$/,"").split(`
|
|
2
|
+
`).length,content:t(Hs,{handle:e.handle,source:e.source})}]:[],...$.length>0?[{id:"settings",label:"Settings",icon:t(le,{kind:"settings"}),count:$.length,content:t("dl",{className:Ve,children:$.map(([S,Z])=>u("span",{children:[t("dt",{children:S}),t("dd",{children:Z})]},S))})}]:[],{id:"inputs",label:"Inputs",icon:t(le,{kind:"inputs"}),count:m.length,content:t("div",{className:Te,children:m.map(S=>u("button",{className:Be,onClick:()=>o.onNavigate({type:"input",id:S.id}),type:"button",children:[u("span",{className:De,children:[t("strong",{children:S.content}),u("small",{children:[pr(a,S)," - ",oe(S.enqueuedAt)]})]}),t(Fe,{status:S.lifecycle.kind==="discarded"?"dismissed":S.lifecycle.kind==="claimed"?a.turnById.get(S.lifecycle.turnId)?.status??"completed":"pending"})]},S.id))})},{id:"turns",label:"Turns",icon:t(le,{kind:"turns"}),count:h.length,content:t("div",{className:Te,children:h.map(S=>u("button",{className:Be,onClick:()=>o.onNavigate({type:"turn",id:S.id}),type:"button",children:[u("span",{className:De,children:[t("strong",{children:de(S.id)}),t("small",{children:oe(S.startedAt)})]}),t(Fe,{status:S.status})]},S.id))})},{id:"subscriptions",label:"Subscriptions",icon:t(le,{kind:"subscriptions"}),count:C.length,content:t("div",{className:Te,children:C.map(S=>u("button",{className:Be,onClick:()=>o.onNavigate({type:"subscription",id:S.id}),type:"button",children:[u("span",{className:De,children:[t("strong",{children:S.eventTypes.join(", ")}),t("small",{children:de(S.id)})]}),t(Fe,{status:S.status})]},S.id))})},...g.length>0?[{id:"actions",label:"Actions",icon:t(le,{kind:"actions"}),count:g.length,content:t("div",{className:Te,children:g.map(S=>u("button",{className:Be,onClick:()=>o.onNavigate({type:"action",id:S.id}),type:"button",children:[u("span",{className:De,children:[t("strong",{children:S.title}),t("small",{children:oe(S.proposedAt)})]}),t(Fe,{status:S.status})]},S.id))})}]:[],...L.length>0?[{id:"artifacts",label:"Artifacts",icon:t(le,{kind:"artifacts"}),count:L.length,content:t("div",{className:Te,children:L.map(S=>t("button",{className:Be,onClick:()=>o.onNavigate({type:"artifact",id:S.id}),type:"button",children:u("span",{className:De,children:[t("strong",{children:S.title}),u("small",{children:[Ue(S.size)," - ",S.mediaType]})]})},S.id))})}]:[],{id:"capabilities",label:"Capabilities",icon:t(le,{kind:"capabilities"}),count:e.grants.length,content:t(Es,{grants:e.grants})},{id:"tools",label:"Tools",icon:t(Aa,{size:15}),...e.toolNames?{count:e.toolNames.length}:{},content:t("p",{className:ye,children:e.toolNames===null?"All available tools":e.toolNames?.join(", ")||"No tools"})}];return u("div",{className:Ye,children:[u("header",{className:jt,children:[t(eo,{canGoBack:o.canGoBack,onBack:o.onBack}),u("div",{className:"flex min-w-0 flex-1 items-baseline gap-2 [&>span]:flex-1",children:[t("h2",{children:e.displayName}),u("span",{className:Zt,children:["@",e.handle,l&&e.createdBy?` - created by ${ea(a,e.createdBy)}`:""]})]}),B&&d&&t(z,{className:"flex-shrink-0",onClick:()=>{lr(n.id,e.id,Ms).catch(S=>c(S.message))},size:"sm",title:`Stop @${e.handle} and its assigned children permanently; the chat input, in contrast, only interrupts the running turn`,variant:"destructive",children:"Stop"}),l&&d&&e.lifecycle?.kind==="stopped"&&e.kind!=="human"&&t(z,{onClick:()=>{dr(n.id,e.id).catch(S=>c(S.message))},size:"sm",variant:"outline",children:"Restart"})]}),f&&t("p",{className:Qt,children:f}),u(Ns,{sections:l?G:[],children:[t(Je,{actor:e,view:n,presentation:"inspector",display:o.chatDisplay,className:"min-h-0 flex-1",primaryMessages:o.primaryMessages,conversation:o.actorConversations?.[e.id],historyError:o.conversationError,onNavigate:o.onNavigate,running:P?o.primaryRunning:R==="running"}),t(je,{actor:e,view:n,composerVisible:o.composerVisible,display:o.chatDisplay,running:P?o.primaryRunning:R==="running"})]})]})}function Ja({eyebrow:e,title:a,subtitle:o,...r}){return u("header",{className:jt,children:[t(eo,{canGoBack:r.canGoBack,onBack:r.onBack}),u("div",{className:"min-w-0 flex-1",children:[t("p",{className:"mb-0.5 text-[0.66rem] font-semibold tracking-[0.08em] uppercase text-muted-foreground",children:e}),t("h2",{children:a}),t("span",{className:Zt,children:o})]})]})}function Us({index:e,input:a,...o}){let r=a.artifactIds.flatMap(s=>{let d=e.artifactById.get(s);return d?[d]:[]});return u("div",{className:Ye,children:[t(Ja,{canGoBack:o.canGoBack,eyebrow:"ActorInput",onBack:o.onBack,subtitle:oe(a.enqueuedAt),title:de(a.id)}),u("div",{className:Ba,children:[u("section",{className:ee,children:[t("h3",{children:"Content"}),t("pre",{className:Ma,children:a.content})]}),u("section",{className:ee,children:[t("h3",{children:"Routing"}),u("dl",{className:Ve,children:[t("dt",{children:"Actor"}),t("dd",{children:t(ze,{id:a.actorId,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Enqueued by"}),t("dd",{children:t(ze,{id:a.enqueuedBy,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Turn"}),t("dd",{children:a.lifecycle.kind==="claimed"?t(Ta,{label:de(a.lifecycle.turnId),onNavigate:o.onNavigate,selection:{type:"turn",id:a.lifecycle.turnId}}):a.lifecycle.kind==="discarded"?"dismissed":"waiting"}),t("dt",{children:"Subscription"}),t("dd",{children:a.subscriptionId?t(Ta,{label:de(a.subscriptionId),onNavigate:o.onNavigate,selection:{type:"subscription",id:a.subscriptionId}}):"none"}),a.lifecycle.kind==="discarded"&&u(X,{children:[t("dt",{children:"Dismissed"}),t("dd",{children:oe(a.lifecycle.at)}),t("dt",{children:"Reason"}),t("dd",{children:a.lifecycle.reason})]})]})]}),a.sourceEventIds.length>0&&u("section",{className:ee,children:[t("h3",{children:"Source events"}),t("p",{className:ye,children:a.sourceEventIds.join(", ")})]}),r.length>0&&t(_s,{artifacts:r,onNavigate:o.onNavigate})]})]})}function Vs({index:e,turn:a,...o}){let r=cr(a);return u("div",{className:Ye,children:[t(Ja,{canGoBack:o.canGoBack,eyebrow:"Turn",onBack:o.onBack,subtitle:oe(a.startedAt),title:de(a.id)}),t("div",{className:$a,children:t(Fe,{status:a.status})}),u("div",{className:Ba,children:[u("section",{className:ee,children:[t("h3",{children:"Details"}),u("dl",{className:Ve,children:[t("dt",{children:"Actor"}),t("dd",{children:t(ze,{id:a.actorId,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Input"}),t("dd",{children:t(Ta,{label:de(a.inputId),onNavigate:o.onNavigate,selection:{type:"input",id:a.inputId}})}),t("dt",{children:"Ended"}),t("dd",{children:a.finishedAt?oe(a.finishedAt):"running"}),a.reason&&u(X,{children:[t("dt",{children:"Reason"}),t("dd",{children:a.reason})]})]})]}),r&&u("section",{className:ee,children:[t("h3",{children:"Usage"}),u("dl",{className:Ve,children:[t("dt",{children:"Input tokens"}),t("dd",{children:r.inputTokens??0}),t("dt",{children:"Output tokens"}),t("dd",{children:r.outputTokens??0}),t("dt",{children:"Cache read"}),t("dd",{children:r.cacheReadTokens??0}),t("dt",{children:"Cache written"}),t("dd",{children:r.cacheWriteTokens??0}),t("dt",{children:"Cost"}),u("dd",{children:[(r.costUsd??0).toFixed(6)," USD"]})]})]})]})]})}function zs({index:e,subscription:a,...o}){return u("div",{className:Ye,children:[t(Ja,{canGoBack:o.canGoBack,eyebrow:"Subscription",onBack:o.onBack,subtitle:oe(a.createdAt),title:de(a.id)}),t("div",{className:$a,children:t(Fe,{status:a.status})}),u("div",{className:Ba,children:[u("section",{className:ee,children:[t("h3",{children:"Filter"}),u("dl",{className:Ve,children:[t("dt",{children:"Subscriber"}),t("dd",{children:t(ze,{id:a.subscriberId,index:e,onNavigate:o.onNavigate})}),t("dt",{children:"Source actors"}),t("dd",{children:a.sourceActorIds?.map(r=>ea(e,r)).join(", ")??"all"}),t("dt",{children:"Actor kinds"}),t("dd",{children:a.sourceActorKinds?.join(", ")??"all"}),t("dt",{children:"Event types"}),t("dd",{children:a.eventTypes.join(", ")}),t("dt",{children:"Own events"}),t("dd",{children:a.includeSelf?"yes":"no"}),t("dt",{children:"Created by"}),t("dd",{children:t(ze,{id:a.createdBy,index:e,onNavigate:o.onNavigate})}),a.status!=="active"&&u(X,{children:[t("dt",{children:"Reason"}),t("dd",{children:a.reason})]}),a.status==="failed"&&u(X,{children:[t("dt",{children:"Error event"}),t("dd",{children:a.sourceEventId})]})]})]}),a.sourceActorIds&&u("section",{className:ee,children:[t("h3",{children:"Source actors"}),t(Ws,{actorIds:a.sourceActorIds,index:e,onNavigate:o.onNavigate})]})]})]})}function Gs({action:e,index:a,...o}){let[r,s]=w();return u("div",{className:Ye,children:[t(Ja,{canGoBack:o.canGoBack,eyebrow:"Action",onBack:o.onBack,subtitle:ea(a,e.askedBy),title:e.title}),t("div",{className:$a,children:t(Fe,{status:e.status})}),u("div",{className:Ba,children:[e.status==="pending"&&t(Os,{action:e,onError:s,runId:a.view.id}),e.description&&u("section",{className:ee,children:[t("h3",{children:"Description"}),t("p",{children:e.description})]}),u("section",{className:ee,children:[t("h3",{children:"Details"}),u("dl",{className:Ve,children:[t("dt",{children:"Asked by"}),t("dd",{children:t(ze,{id:e.askedBy,index:a,onNavigate:o.onNavigate})}),t("dt",{children:"Proposed"}),t("dd",{children:oe(e.proposedAt)}),e.resolvedAt&&u(X,{children:[t("dt",{children:"Resolved"}),t("dd",{children:oe(e.resolvedAt)})]}),e.owner&&u(X,{children:[t("dt",{children:"Owner"}),t("dd",{children:e.owner})]}),e.result!==null&&e.result!==void 0&&u(X,{children:[t("dt",{children:"Result"}),t("dd",{children:typeof e.result=="string"?e.result:JSON.stringify(e.result)})]})]})]}),Object.keys(e.parameters).length>0&&u("section",{className:ee,children:[t("h3",{children:"Parameters"}),t("pre",{className:Ma,children:JSON.stringify(e.parameters,null,2)})]}),e.payload!==null&&e.payload!==void 0&&u("section",{className:ee,children:[t("h3",{children:"Payload"}),t("pre",{className:Ma,children:JSON.stringify(e.payload,null,2)})]}),r&&t("p",{className:Qt,children:r})]})]})}function Ta({label:e,onNavigate:a,selection:o}){return t("button",{className:ir,onClick:()=>a(o),type:"button",children:e})}function ze({id:e,index:a,onNavigate:o}){return t(Ta,{label:ea(a,e),onNavigate:o,selection:{type:"actor",id:e}})}function Ws({actorIds:e,index:a,onNavigate:o}){return t("div",{className:Te,children:e.map(r=>{let s=a.actorById.get(r);return u("button",{className:Be,onClick:()=>o({type:"actor",id:r}),type:"button",children:[u("span",{className:De,children:[t("strong",{children:s?.displayName??de(r)}),t("small",{children:ea(a,r)})]}),s&&t(se,{className:Yt,children:fr[s.kind]})]},r)})})}function _s({artifacts:e,onNavigate:a}){return u("section",{className:ee,children:[t("h3",{children:"Artifacts"}),t("div",{className:Te,children:e.map(o=>t("button",{className:Be,onClick:()=>a({type:"artifact",id:o.id}),type:"button",children:u("span",{className:De,children:[t("strong",{children:o.title}),u("small",{children:[Ue(o.size)," - ",o.mediaType]})]})},o.id))})]})}var Xs=e=>{let a=e.toLowerCase();return a.startsWith("text/")||a.includes("json")||a.includes("xml")||a.includes("yaml")};function Jt(e,a){let o=U(new Map),[r,s]=w(0),d=a?.id,l=()=>{d&&o.current.delete(d),s(n=>n+1)};return O(()=>{if(!(!a||o.current.has(a.id))){if(a.mediaType.toLowerCase().startsWith("image/")){o.current.set(a.id,{kind:"image"}),s(n=>n+1);return}if(!Xs(a.mediaType)){o.current.set(a.id,{kind:"download"}),s(n=>n+1);return}o.current.set(a.id,{kind:"loading"}),s(n=>n+1),(async()=>{try{let n=await fetch(Ra(e,a.id),{headers:{Accept:a.mediaType}});if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);let i=await n.text();if(a.mediaType.toLowerCase().includes("json"))try{i=JSON.stringify(JSON.parse(i),null,2)}catch{}o.current.set(a.id,{kind:"text",text:i})}catch(n){o.current.set(a.id,{kind:"error",message:n instanceof Error?n.message:String(n)})}s(n=>n+1)})()}},[a,e,r]),{content:a?o.current.get(a.id):void 0,retry:l}}var Kt=5e3,$s=(e,a)=>{let o=Array.from({length:e.length+1},()=>new Uint32Array(a.length+1));for(let l=e.length-1;l>=0;l-=1)for(let n=a.length-1;n>=0;n-=1)o[l][n]=e[l]===a[n]?o[l+1][n+1]+1:Math.max(o[l+1][n],o[l][n+1]);let r=[],s=0,d=0;for(;s<e.length&&d<a.length;)e[s]===a[d]?(r.push({kind:"same",text:e[s]}),s+=1,d+=1):o[s+1][d]>=o[s][d+1]?(r.push({kind:"removed",text:e[s]}),s+=1):(r.push({kind:"added",text:a[d]}),d+=1);for(;s<e.length;)r.push({kind:"removed",text:e[s++]});for(;d<a.length;)r.push({kind:"added",text:a[d++]});return r};function Ks({artifact:e,index:a}){let o=e.previousVersionId?a.artifactById.get(e.previousVersionId):void 0,r=Jt(a.view.id,o).content,s=Jt(a.view.id,e).content,d=r?.kind==="text"?r.text:void 0,l=s?.kind==="text"?s.text:void 0,n=D(()=>{if(d===void 0||l===void 0)return;let f=d.split(`
|
|
3
3
|
`),c=l.split(`
|
|
4
|
-
`);return f.length
|
|
5
|
-
`]},c))})}function Zs({artifact:e,index:a,...o}){let r=a.view,{content:s,retry:d}=Zt(r.id,e),l=r.inputs.filter(n=>n.artifactIds.includes(e.id));return u("div",{className:Ye,children:[u("header",{className:Jt,children:[t(eo,{canGoBack:o.canGoBack,onBack:o.onBack}),u("div",{className:"min-w-0 flex-1",children:[t("p",{className:"mb-0.5 text-[0.66rem] font-semibold tracking-[0.08em] uppercase text-muted-foreground",children:"Artefakt"}),t("h2",{children:e.title}),u("span",{className:jt,children:["von ",ea(a,e.createdBy)," - ",Ue(e.size)," - ",e.mediaType]})]}),t(z,{render:t("a",{href:Ra(r.id,e.id)}),size:"sm",variant:"outline",children:"Herunterladen"})]}),u("div",{className:Da,children:[u("section",{className:ee,children:[t("h3",{children:"Inhalt"}),(!s||s.kind==="loading")&&t("p",{className:be,children:"Artefakt wird geladen ..."}),s?.kind==="error"&&u("p",{className:Qt,children:[s.message," ",t("button",{className:ir,onClick:d,type:"button",children:"Erneut laden"})]}),s?.kind==="download"&&u("p",{className:be,children:["Keine Vorschau f\xFCr ",e.mediaType,"."]}),s?.kind==="image"&&t("img",{alt:e.title,className:"max-w-full rounded-lg",src:Ra(r.id,e.id)}),s?.kind==="text"&&t("pre",{className:Ma,children:s.text})]}),e.previousVersionId&&u("section",{className:ee,children:[t("h3",{children:"\xC4nderung zur Vorversion"}),t($s,{artifact:e,index:a})]}),l.length>0&&u("section",{className:ee,children:[t("h3",{children:"Verwendet in Eingaben"}),t("div",{className:Te,children:l.map(n=>t("button",{className:De,onClick:()=>o.onNavigate({type:"input",id:n.id}),type:"button",children:u("span",{className:Be,children:[t("strong",{children:n.content}),u("small",{children:[pr(a,n)," - ",oe(n.enqueuedAt)]})]})},n.id))})]}),u("section",{className:ee,children:[t("h3",{children:"Details"}),u("dl",{className:Ve,children:[t("dt",{children:"Erstellt von"}),t("dd",{children:t(ze,{id:e.createdBy,index:a,onNavigate:o.onNavigate})}),t("dt",{children:"Hash"}),t("dd",{children:de(e.hash)}),t("dt",{children:"Erstellt"}),t("dd",{children:oe(e.createdAt)}),e.previousVersionId&&u(X,{children:[t("dt",{children:"Vorversion"}),t("dd",{children:t(Ta,{label:de(e.previousVersionId),onNavigate:o.onNavigate,selection:{type:"artifact",id:e.previousVersionId}})})]})]})]})]})]})}var Js="relative isolate rounded-panel border-[1.5px] border-(--material-edge) bg-(--material-face) [--material-edge:#514657] dark:[--material-edge:#b7a8bd]",js={agent:"[--material-face:var(--color-glass-agent)]",primary:"[--material-face:var(--color-glass-primary)]",script:"[--material-face:var(--color-glass-script)]",app:"[--material-face:var(--color-glass-app)]"},ao=(e,a)=>Y(Js,js[e],a),mr="relative flex items-center gap-2 rounded-t-[15.5px] bg-[color-mix(in_srgb,var(--material-face)_96%,black)] px-3 py-2",gr="min-w-0 truncate p-0 text-[17px] font-[730] leading-[1.3] tracking-[-.5px]",xr="grid size-8 flex-none place-items-center rounded-[11px] border border-[#5146578a] bg-white/9 text-foreground shadow-glass-icon";var Qs=["left","right","top","bottom"],Ys={left:"Links andocken",right:"Rechts andocken",top:"Oben andocken",bottom:"Unten andocken"},el={left:Ee,right:Ia,top:Ca,bottom:La},hr=e=>({left:e.left+2,top:e.top+2,width:Math.max(0,e.width-4),height:Math.max(0,e.height-4)}),to=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),al={left:{inner:"left-0 top-[40px]",outer:"left-0 top-[calc(50%_-_18px)]"},right:{inner:"right-0 top-[40px]",outer:"right-0 top-[calc(50%_-_18px)]"},top:{inner:"top-0 left-[40px]",outer:"top-0 left-[calc(50%_-_18px)]"},bottom:{inner:"bottom-0 left-[40px]",outer:"bottom-0 left-[calc(50%_-_18px)]"}},tl="absolute grid size-[36px] place-items-center rounded-[5px] border border-primary bg-surface text-primary shadow-[0_2px_8px_#0002] pointer-events-auto data-[active]:bg-primary data-[active]:text-surface [&>svg]:pointer-events-none",ol="absolute z-3 grid touch-none place-items-center rounded-[4px] focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2 data-[direction=horizontal]:cursor-col-resize data-[direction=vertical]:cursor-row-resize [&>span]:pointer-events-none [&>span]:rounded-[4px] [&>span]:bg-border-strong data-[direction=horizontal]:[&>span]:h-8 data-[direction=horizontal]:[&>span]:w-[3px] data-[direction=vertical]:[&>span]:h-[3px] data-[direction=vertical]:[&>span]:w-8 hover:[&>span]:bg-primary focus-visible:[&>span]:bg-primary";function Lr({root:e,onChange:a,items:o,canArrange:r,selectedEntity:s,onSelect:d}){let l=U(null),[n,i]=w({width:0,height:0}),[f,c]=w({width:0,height:0}),[m,h]=w(null),[C,x]=w(null),[L,b]=w(!1),[P,y]=w(null),[D,R]=w(),[K,V]=w(null),k=U(null),M=U(null),G=K??e,S=B(()=>ua(e),[e]),j=B(()=>[...S].sort(),[S]),$=B(()=>new Map(o.map(I=>[I.entity,I])),[o]),ie=e?ct(e):{width:0,height:0},Q=f.width<ie.width||f.height<ie.height,fe=D&&S.includes(D)?D:S[0],v={left:0,top:0,...n},F=B(()=>G?mt(G,{left:0,top:0,...n}):{leaves:new Map,dividers:[]},[G,n]);We(()=>{let I=l.current;if(!I)return;let g=I.parentElement,T=()=>{let ue=I.clientWidth,Z=I.clientHeight;i(Ie=>Ie.width===ue&&Ie.height===Z?Ie:{width:ue,height:Z});let ce=getComputedStyle(g),ke=g.clientWidth-parseFloat(ce.paddingLeft)-parseFloat(ce.paddingRight),la=g.clientHeight-parseFloat(ce.paddingTop)-parseFloat(ce.paddingBottom);c(Ie=>Ie.width===ke&&Ie.height===la?Ie:{width:ke,height:la})},N=new ResizeObserver(T);return N.observe(I),N.observe(g),T(),()=>N.disconnect()},[]),O(()=>{s&&R(s)},[s]),We(()=>{if(!r){h(null),x(null);return}let I=null,g=()=>{I!==null&&cancelAnimationFrame(I),I=null},T=Z=>{if(!Z.dataTransfer?.types.includes(Ae))return;let ce=Z.dataTransfer.getData(Ae);ce&&(g(),I=requestAnimationFrame(()=>{I=null,Z.defaultPrevented||h(ce)}))},N=()=>{g(),h(null),x(null)},ue=Z=>{Z.key==="Escape"&&N()};return window.addEventListener("dragstart",T),window.addEventListener("dragend",N),window.addEventListener("drop",N),window.addEventListener("keydown",ue),()=>{g(),window.removeEventListener("dragstart",T),window.removeEventListener("dragend",N),window.removeEventListener("drop",N),window.removeEventListener("keydown",ue)}},[r]);let _=q(()=>{k.current!==null&&cancelAnimationFrame(k.current),k.current=null;let I=M.current;M.current=null,I?.handle.hasPointerCapture(I.pointerId)&&I.handle.releasePointerCapture(I.pointerId),V(null),b(!1)},[]);We(()=>(_(),_),[e,n,Q,_]),O(()=>{if(!L)return;let I=g=>{g.key==="Escape"&&_()};return window.addEventListener("keydown",I),window.addEventListener("blur",_),()=>{window.removeEventListener("keydown",I),window.removeEventListener("blur",_)}},[L,_]);let H=I=>{let g=M.current;if(!g||g.pointerId!==I.pointerId)return;let T=g.divider.direction==="horizontal"?I.clientX:I.clientY,N=Math.max(g.divider.minimum,Math.min(g.divider.maximum,g.divider.ratio+(T-g.start)/g.divider.span));g.next=T===g.start?g.root:pt(g.root,g.divider.path,N)},Le=I=>{R(I),d?.(I)},ae=r&&C&&m?ft(e,m,C.entity,C.side):null,sa=ae?ct(ae):null,Oa=ae&&ae!==e&&sa&&m?f.width<sa.width||f.height<sa.height?v:mt(ae,v).leaves.get(m):null,ye=I=>Qs.map(g=>{let T=el[g];return t("div",{className:`${tl} ${al[g][I===null?"outer":"inner"]}`,"data-dock-side":g,"data-dock-entity":I??"",title:Ys[g],"data-active":C?.entity===I&&C.side===g||void 0,children:t(T,{size:18,"aria-hidden":"true"})},g)});return u("div",{className:"flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden p-2 data-[dragging]:[&_iframe]:pointer-events-none data-[resizing]:[&_iframe]:pointer-events-none","data-dragging":r&&m!==null||void 0,"data-resizing":L||void 0,children:[Q&&S.length>1&&u("label",{className:"flex items-center gap-2 pb-2 text-[0.8rem]",children:["Kachel",t("select",{className:"max-w-[60%] min-w-0","aria-label":"Sichtbare Kachel",value:fe,onChange:I=>Le(I.target.value),children:S.map(I=>t("option",{value:I,children:$.get(I)?.title??I},I))}),t("span",{className:"truncate text-muted-foreground",children:"Mehr Platz f\xFCr die geteilte Ansicht ben\xF6tigt"})]}),u("div",{ref:l,className:"relative min-h-0 min-w-0 flex-1 overflow-hidden",onDragOver:I=>{if(!r||m===null||!I.dataTransfer.types.includes(Ae))return;I.preventDefault(),I.dataTransfer.dropEffect="move";let g=I.target instanceof Element?I.target.closest("[data-dock-side]"):null,T=g&&l.current?.contains(g)?{entity:g.dataset.dockEntity||null,side:g.dataset.dockSide}:null;x(N=>N?.entity===T?.entity&&N?.side===T?.side?N:T)},onDragLeave:I=>{I.currentTarget.contains(I.relatedTarget)||x(null)},onDrop:I=>{if(!r||m===null)return;let g=I.dataTransfer.getData(Ae);if(!g||g!==m||(I.preventDefault(),!$.has(g)&&!S.includes(g)))return;let T=I.target instanceof Element?I.target.closest("[data-dock-side]"):null;try{if(!e||T){let N=ft(e,g,T?.dataset.dockEntity||null,T?.dataset.dockSide??"right");N!==e&&a(N===null?null:_e(N)),Le(g),y(null)}}catch(N){y(N instanceof Error?N.message:String(N))}finally{h(null),x(null)}},children:[P&&u("div",{className:"absolute inset-x-2 bottom-2 z-7 flex items-center gap-2 rounded-lg border border-primary bg-surface p-3 text-foreground shadow-[0_2px_8px_#0002]",role:"alert",children:[t("span",{className:"flex-1",children:P}),t("button",{className:"grid cursor-pointer place-items-center bg-transparent p-1",type:"button","aria-label":"Meldung schlie\xDFen",onClick:()=>y(null),children:t(xe,{size:16})})]}),!e&&t("div",{className:"grid h-full place-items-center rounded-lg border border-dashed border-border-strong p-6 text-center text-muted-foreground",children:r?"Ziehe einen Actor oder eine Mini-App aus der Kopfzeile hierher.":"F\xFCr diese Kachelansicht sind noch keine Inhalte angeordnet."}),j.map(I=>{let g=$.get(I),T=hr(Q?v:F.leaves.get(I));return u("section",{className:ao(g?.tone??(I.startsWith("app:")?"app":"agent"),"absolute z-0 flex min-h-0 min-w-0 flex-col overflow-visible"),"data-tile-entity":I,"data-tone":"material",style:{...to(T),display:Q&&I!==fe?"none":void 0},onFocusCapture:()=>{fe!==I&&R(I)},children:[u("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[15.5px]",children:[u("header",{className:`${mr} flex-[0_0_49px] min-w-0 select-none border-b border-[#51465738] text-foreground [&[draggable=true]]:cursor-grab`,draggable:r,onDragStart:N=>{if(!r){N.preventDefault();return}N.dataTransfer.setData(Ae,I),N.dataTransfer.effectAllowed="move"},children:[r&&t(wa,{size:16,"aria-hidden":"true"}),t("span",{className:xr,children:g?.tone==="app"||I.startsWith("app:")?t(Oe,{size:20,"aria-hidden":"true"}):g?.tone==="script"?t(Re,{size:20,"aria-hidden":"true"}):t(ge,{size:20,"aria-hidden":"true"})}),t("span",{className:`${gr} flex-1`,title:g?.title??I,children:g?.title??I}),r&&t("button",{className:"grid size-[26px] cursor-pointer place-items-center rounded-[4px] bg-transparent p-0 text-muted-foreground hover:bg-glass-group hover:text-foreground",type:"button",draggable:!1,"aria-label":`Kachel ${g?.title??I} entfernen`,onClick:()=>a(So(e,I)),children:t(xe,{size:16})})]}),t("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-auto [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:flex-1",children:g?.content??t("div",{className:"p-4.5 text-muted-foreground",children:r?"Dieser Inhalt ist nicht mehr verf\xFCgbar. Du kannst die Kachel entfernen oder einen anderen Inhalt hier andocken.":"Dieser Inhalt ist nicht mehr verf\xFCgbar."})})]}),r&&m!==null&&m!==I&&t("div",{className:"absolute inset-0 z-4",children:t("div",{className:"pointer-events-none absolute top-1/2 left-1/2 size-[116px] -translate-x-1/2 -translate-y-1/2",children:ye(I)})})]},I)}),!Q&&F.dividers.map(I=>t("div",{className:ol,role:"separator",tabIndex:0,"aria-label":"Kachelgr\xF6\xDFe \xE4ndern","aria-orientation":I.direction==="horizontal"?"vertical":"horizontal","aria-valuemin":Math.round(I.minimum*100),"aria-valuemax":Math.round(I.maximum*100),"aria-valuenow":Math.round(I.ratio*100),"data-direction":I.direction,style:to(I),onPointerDown:g=>{g.button!==0||!g.isPrimary||!e||M.current||(g.preventDefault(),g.currentTarget.setPointerCapture(g.pointerId),M.current={divider:I,start:I.direction==="horizontal"?g.clientX:g.clientY,root:e,next:e,pointerId:g.pointerId,handle:g.currentTarget},b(!0))},onPointerMove:g=>{M.current?.pointerId===g.pointerId&&(H(g),k.current===null&&(k.current=requestAnimationFrame(()=>{k.current=null,M.current&&V(M.current.next)})))},onPointerUp:g=>{let T=M.current;!T||T.pointerId!==g.pointerId||(H(g),_(),T.next!==T.root&&a(T.next))},onLostPointerCapture:g=>{M.current?.pointerId===g.pointerId&&_()},onPointerCancel:g=>{M.current?.pointerId===g.pointerId&&_()},onKeyDown:g=>{if(g.key==="Escape"&&M.current){g.preventDefault(),_();return}if(!e||M.current)return;let T=I.direction==="horizontal"?"ArrowLeft":"ArrowUp",N=I.direction==="horizontal"?"ArrowRight":"ArrowDown";if(g.key!==T&&g.key!==N&&g.key!=="Home"&&g.key!=="End")return;g.preventDefault();let ue=g.key==="Home"?I.minimum:g.key==="End"?I.maximum:I.ratio+(g.key===N?.02:-.02);a(pt(e,I.path,Math.max(I.minimum,Math.min(I.maximum,ue))))},children:t("span",{})},I.path.join("."))),L&&t("div",{className:"absolute inset-0 z-2"}),r&&m!==null&&e&&t("div",{className:"pointer-events-none absolute inset-2 z-6",children:ye(null)}),r&&m!==null&&Oa&&t("div",{className:ao($.get(m)?.tone??(m.startsWith("app:")?"app":"agent"),"pointer-events-none absolute z-5 opacity-80"),style:to(hr(Oa)),children:t("div",{className:"absolute inset-0 rounded-[15.5px] border-2 border-primary bg-primary/22"})})]})]})}function Ir({root:e,onChange:a,surfaceElements:o,cardSections:r,session:s,view:d,navigation:l,onSelect:n,selected:i}){let f=W().can("runs.inspect"),c=d.actors.filter(C=>C.kind!=="human"&&C.lifecycle?.kind!=="stopped"&&(f||C.kind==="agent")),m=[...c.map(C=>({entity:`@${C.handle}`,title:`${C.displayName||C.handle} (@${C.handle})`,tone:He(d,C),content:C.kind==="agent"?t(Mo,{actor:C,view:d,cardSections:r,chatInput:Va(e,`@${C.handle}`),session:s,navigation:l,onSelect:n}):t($a,{view:d,selection:{type:"actor",id:C.id},canGoBack:!1,chatDisplay:"surface",composerVisible:!1,onNavigate:n,onBack:()=>{},primaryMessages:s.messages,actorConversations:s.actorConversations,conversationError:s.conversationError,primaryRunning:s.running})})),...o.flatMap(({Element:C,select:x})=>x(s).filter(L=>L.visible!==!1).map(L=>({entity:`app:${L.id}`,title:L.title??L.id,tone:"app",content:t(C,{definition:L,navigation:l,session:s})})))],h=i?.type==="run-app"?`app:${i.id}`:i?.type==="actor"?c.find(C=>C.id===i.id)?.handle:void 0;return t(Lr,{root:e,onChange:a,items:m,canArrange:f,selectedEntity:i?.type==="actor"&&h?`@${h}`:h})}function Cr({state:e}){return t("div",{className:"pointer-events-none absolute inset-y-0 left-0 grid w-[var(--surface-visible-width,100%)] place-items-center p-6",children:t(pa,{state:e})})}function Ja({view:e,startup:a,connected:o,running:r,error:s}){if(a?.status==="failed")return{kind:"error",title:"Der Run konnte nicht vorbereitet werden",detail:a.message};if(s)return{kind:"error",title:"Der Run-Status ist nicht erreichbar",detail:s};if(a?.status==="preparing")return{kind:"working",title:"Run wird vorbereitet",detail:a.message};let d=e?.actors.filter(c=>c.kind!=="human")??[],l=d.filter(c=>c.lifecycle?.kind!=="stopped");if(d.length&&!l.length)return{kind:"stopped",title:"Der Run wurde gestoppt",detail:"Es wird keine weitere Arbeit ausgef\xFChrt."};if(e?.actions.some(c=>c.status==="pending"))return{kind:"waiting",title:"Deine Eingabe wird ben\xF6tigt",detail:"Im Chat wartet eine Aktion auf Deine Eingabe."};let n=new Set(l.map(c=>c.id));if(r||l.some(c=>c.lifecycle?.kind==="running")||e?.turns.some(c=>n.has(c.actorId)&&c.status==="running")||e?.inputs.some(c=>n.has(c.actorId)&&Pa(c)))return{kind:"working",title:"Der Run wird eingerichtet",detail:"Die Oberfl\xE4che wird aufgebaut. Die Elemente erscheinen automatisch."};let f=l.map(c=>e?.turns.filter(m=>m.actorId===c.id).at(-1)).find(c=>c?.status==="failed"||c?.status==="interrupted");if(f)return{kind:"error",title:"Der Aufbau wurde angehalten",detail:f.reason||"Der letzte Arbeitsschritt konnte nicht abgeschlossen werden."};if(!o)return{kind:"working",title:"Run wird geladen",detail:"Die Verbindung zum Run wird hergestellt."}}var ne=p("@ragents/web/lib/local-storage-setting","createLocalStorageSetting");var Sr=e=>`ragents.orchestration.tile-presentation:${e}`;function rl(e){if(e===null||e==="null")return null;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||!("root"in a)||Object.keys(a).some(o=>!["root","programBasis"].includes(o))||"programBasis"in a&&typeof a.programBasis!="string")throw new Error("Die gespeicherte Kachelansicht ist ung\xFCltig.");return{root:a.root===null?null:_e(a.root),..."programBasis"in a?{programBasis:a.programBasis}:{}}}var wr=ne({changeEvent:"ragents-tile-presentation-change",matchesKey:e=>e.startsWith("ragents.orchestration.tile-presentation:"),parse:rl,serialize:JSON.stringify}),sl=e=>wr.useValue(Sr(e)),Qa=(e,a)=>wr.save(Sr(e),a),br=e=>JSON.stringify({root:e.root});function ll(e,a){if(!e)return null;if(e.programBasis!==void 0)return e.programBasis===br(a)?e:null;let o=new Set(za(e.root));return za(a.root).some(r=>!o.has(r))?null:e}function yr(e,a){let o=a?.pluginStates.find(f=>f.pluginId===wo&&f.scope.kind==="run")?.state,r=B(()=>o===void 0?void 0:JSON.stringify(o),[o]),s=B(()=>{try{return{layout:r===void 0?void 0:ko(JSON.parse(r))}}catch(f){return{error:f instanceof Error?f.message:String(f)}}},[r]),d=B(()=>({root:s.layout?.root??null}),[s]),l=B(()=>br(d),[d]),n=sl(e),i=a&&!s.error?ll(n,d):n;return O(()=>{n&&!i&&Qa(e,null)},[e,n,i]),{programLayout:s,personalLayout:i,presentation:i??d,programBasis:l}}function ja(e,a="horizontal"){if(e.length===0)return null;if(e.length===1)return{entity:e[0]};let o=Math.ceil(e.length/2),r=a==="horizontal"?"vertical":"horizontal";return{direction:a,weights:[o,e.length-o],children:[ja(e.slice(0,o),r),ja(e.slice(o),r)]}}var oo=p("@ragents/web/StatusGroup","StatusGroup");var Ba=p("@ragents/web/Toolbar","ToolbarCopy");var Ne=p("@ragents/web/Toolbar","ToolbarItem");var Fa=p("@ragents/web/Toolbar","ToolbarLabel");var aa=p("@ragents/web/Toolbar","ToolbarText");var dl=Object.freeze({actorVisibility:Object.freeze({})}),kr=e=>`ragents.orchestration.actor-visibility:${e}`;function ul(e){if(e===null)return dl;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||Object.keys(a).some(o=>o!=="actorVisibility")||!("actorVisibility"in a)||!a.actorVisibility||typeof a.actorVisibility!="object"||Array.isArray(a.actorVisibility)||Object.values(a.actorVisibility).some(o=>typeof o!="boolean"))throw new Error("Die gespeicherte Actor-Sichtbarkeit ist ung\xFCltig.");return a}var ta=(e,a,o,r)=>e.kind==="human"?!1:(Object.hasOwn(o.actorVisibility,e.id)?o.actorVisibility[e.id]:void 0)??(e.id!==r&&!a.has(e.id)),Ar=ne({changeEvent:"ragents-actor-visibility-change",matchesKey:e=>e.startsWith("ragents.orchestration.actor-visibility:"),parse:ul,serialize:JSON.stringify});function Ya(e){return Ar.useValue(kr(e))}function et(e,a){Ar.save(kr(e),a)}function oa({open:e,id:a,label:o,closeLabel:r,buttonRef:s,onClose:d,width:l,height:n,placement:i="bottom",focusInput:f=!1,keepMounted:c=!1,role:m,headerContent:h,children:C}){let x=U(null),L=b=>b.reason==="outside-press"&&b.event.target instanceof Node&&s.current?.contains(b.event.target)===!0;return t(fa,{open:e,onOpenChange:(b,P)=>{!b&&!L(P)&&d()},children:u(ca,{align:"start",anchor:s,"aria-label":o,className:"flex min-h-0 min-w-0 flex-col gap-0 overflow-hidden rounded-b-sm p-0 text-[0.76rem] focus:outline-none data-[placement=top]:rounded-t-sm data-[placement=top]:rounded-b-none [&_input[type=checkbox]]:m-0 [&_input[type=checkbox]]:flex-none [&_input[type=checkbox]]:accent-primary",collisionPadding:8,"data-surface-scroll":"true",dim:!0,"data-placement":i,id:a,initialFocus:f?()=>x.current?.querySelector("input")??!0:!0,keepMounted:c,ref:x,role:m,side:i,style:{width:l==="available"?"var(--available-width)":l,height:n,maxWidth:"var(--available-width)",maxHeight:"var(--available-height)"},children:[u("header",{className:"flex flex-none items-center justify-between gap-2 border-b border-border-soft px-2.5 py-2",children:[t("strong",{className:"shrink-0",children:o}),h,t(z,{"aria-label":r,onClick:()=>d(!0),size:"icon-sm",title:r,variant:"ghost",children:t(xe,{})})]}),C]})})}var nl="grid size-[30px] flex-none place-items-center rounded-lg border border-foreground/15 text-foreground",il={agent:"bg-glass-agent",primary:"bg-glass-primary",script:"bg-glass-script",app:"bg-glass-app"};function vr({actor:e,view:a,session:o,open:r,onToggle:s,onClose:d,visible:l}){let n=Ua(o.session.id).has(`@${e.handle}`),i=W().can("runs.inspect"),[f,c]=w(!1),m=U(null),h=pe(),C=ga(),x=q((D=!1)=>{d(),D&&m.current?.focus({preventScroll:!0})},[d]),L=D=>{if(!C)throw new Error("Der Actor-Zugang ben\xF6tigt den Fl\xE4chen-Controller.");C.acceptSelection(D),x()},b=He(a,e),P=e.kind==="agent"?`Chat mit @${e.handle}`:`Actor-Ansicht von @${e.handle}`,y=i?e.kind==="agent"?"LLM-Agent":"TypeScript-Actor":"Agent";return u("div",{className:"flex items-stretch [&[hidden]]:hidden",hidden:!l,children:[u(Ne,{as:"button","aria-controls":f?h:void 0,"aria-expanded":r,"aria-haspopup":"dialog","aria-label":`${e.displayName||e.handle}. ${y}: ${P} \xF6ffnen`,className:"font-bold","data-tone":b,"data-staged":n||void 0,onClick:()=>{c(!0),s()},draggable:i,onDragStart:D=>{if(!i){D.preventDefault();return}D.dataTransfer.setData(Ae,`@${e.handle}`),D.dataTransfer.effectAllowed="move",x()},ref:m,title:`${y}: ${P} \xF6ffnen${i?". Zum Andocken auf eine Kachel ziehen.":""}`,type:"button",children:[t("span",{className:Y(nl,n&&il[b]),children:e.kind==="agent"?t(Se,{size:20}):t(qe,{size:20})}),u(Ba,{children:[u(Fa,{children:["@",e.handle]}),t(aa,{children:e.displayName&&e.displayName!==e.handle?e.displayName:y})]})]}),f&&t(oa,{open:r,id:h,label:P,closeLabel:`${P} schlie\xDFen`,buttonRef:m,keepMounted:!0,onClose:x,width:e.kind==="agent"?784:560,height:640,role:"dialog",children:t("div",{className:"min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain",children:t($a,{actorConversations:o.actorConversations,canGoBack:!1,chatDisplay:"popout",composerVisible:!0,conversationError:o.conversationError,onBack:()=>{},onNavigate:L,primaryMessages:o.messages,primaryRunning:o.running,selection:{type:"actor",id:e.id},view:a})})})]})}var ro=["all","active","visible","agent","script"],at={all:"Alle",active:"Aktive",visible:"Sichtbare",agent:"LLM-Agenten",script:"TypeScript"},Pr=e=>`ragents.orchestration.actor-header:v2:${e}`;function fl(e){if(e===null)return"visible";if(ro.some(a=>a===e))return e;throw new Error("Die gespeicherte Actor-Anzeige ist ung\xFCltig. Erlaubt sind all, active, visible, agent und script.")}var Rr=(e,a,o)=>e.id===a||o.has(`@${e.handle}`),tt=(e,a,o)=>e.kind!=="human"&&(a==="all"||(a==="active"?e.lifecycle?.kind!=="stopped":a==="visible"?o:e.kind===a)),Mr=ne({changeEvent:"ragents-actor-header-change",matchesKey:e=>e.startsWith("ragents.orchestration.actor-header:"),parse:fl,serialize:e=>e});function Na(e){return Mr.useValue(Pr(e))}function Tr(e,a){Mr.save(Pr(e),a)}var cl="min-w-0 max-w-full text-left font-semibold [overflow-wrap:anywhere]",Dr=e=>e.kind==="human"?"Benutzer":e.kind==="agent"?"LLM-Agent":"TypeScript-Actor",so=e=>e.lifecycle?.kind==="running"?"Arbeitet":e.lifecycle?.kind==="stopped"?"Gestoppt":e.lifecycle?.kind==="idle"?"Bereit":"";function pl(e,a,o){let r=o.trim().toLocaleLowerCase("de-DE").split(/\s+/).filter(Boolean);return e.filter(s=>{let d=[`@${s.handle}`,s.displayName,s.kind,Dr(s),s.lifecycle?.kind,so(s),a.has(s.id)?"Mini-App":""].join(" ").toLocaleLowerCase("de-DE");return r.every(l=>d.includes(l))})}function Br({session:e}){let a=W().can("runs.inspect"),[o,r]=w(),s=q(()=>r(void 0),[]),d=Na(e.session.id),l=Ua(e.session.id),n=J(e.runView),i=B(()=>n?.actors.filter(m=>m.kind!=="human"&&(a||m.kind==="agent"))??[],[a,n]),f=n?we(n):void 0,c=q(m=>tt(m,d,Rr(m,f,l)),[d,l,f]);return O(()=>{o&&!i.some(m=>`${e.session.id}:${m.id}`===o&&c(m))&&s()},[i,s,o,e.session.id,c]),!n||i.length===0?null:t("nav",{"aria-label":"Actors des Runs",className:"flex min-w-0 flex-none items-stretch",children:i.map(m=>{let h=`${e.session.id}:${m.id}`;return t(vr,{actor:m,onClose:s,onToggle:()=>r(C=>C===h?void 0:h),open:o===h,session:e,view:n,visible:c(m)},h)})})}var ml=["active","visible","all"];function ot({runId:e}){let a=W().can("runs.inspect"),o=Na(e),r=a?ro:ml,s=r[(r.indexOf(o)+1)%r.length],d=`Actor-Anzeige: ${at[o]}. Wechseln zu ${at[s]}`;return t(Ne,{as:"button","aria-label":d,className:"w-[120px] max-w-[120px] min-w-[120px] flex-[0_0_120px]",onClick:()=>Tr(e,s),title:d,type:"button",children:u(Ba,{children:[t(Fa,{children:"Anzeige"}),t(aa,{children:at[o]})]})})}function Fr({session:e,appActorIds:a,preferences:o,onPreferencesChange:r}){let[s,d]=w(!1),[l,n]=w(""),i=U(null),f=pe(),c=J(e.runView),m=c?.actors,h=B(()=>pl(m??[],a,l),[m,a,l]),C=q((L=!1)=>{d(!1),L&&i.current?.focus({preventScroll:!0})},[]);O(()=>{C(),n("")},[e.session.id,C]);let x=`Actors \xB7 ${m?.length??0}`;return u("div",{className:"flex h-full min-w-0 flex-none items-stretch",children:[u(Ne,{as:"button",ref:i,"aria-controls":s?f:void 0,"aria-expanded":s,"aria-label":x,title:x,onClick:()=>d(L=>!L),type:"button",children:[t(Se,{size:20}),t(aa,{children:"Actors"})]}),s&&u(oa,{open:!0,id:f,label:"Actors des Runs",closeLabel:"Actorliste schlie\xDFen",buttonRef:i,onClose:C,width:460,height:460,placement:"bottom",focusInput:!0,role:"region",children:[u("div",{className:"flex flex-none items-center gap-2.5 p-2.5",children:[t(te,{className:"flex-1","aria-label":"Actors durchsuchen",onChange:L=>n(L.target.value),placeholder:"Handle, Typ oder Status suchen ...",type:"search",value:l}),u("span",{className:"flex-none whitespace-nowrap text-[0.68rem] text-muted-foreground",role:"status",children:[h.length," von ",m?.length??0]})]}),t(gl,{actors:h,appActorIds:a,primaryActorId:c?.primaryActorId,onPreferencesChange:r,preferences:o}),t("p",{className:"flex-none border-t border-border-soft px-2.5 py-2.5 text-[0.68rem] text-muted-foreground",children:"Pers\xF6nliche Ansicht dieses Runs"})]})]})}function gl({actors:e,appActorIds:a,primaryActorId:o,onPreferencesChange:r,preferences:s}){return t("div",{className:"min-h-0 flex-1 overflow-auto overscroll-contain px-2.5",children:e.length===0?t("p",{className:"text-muted-foreground",children:"Keine passenden Actors."}):t("ul",{className:"list-none",children:e.map(d=>u("li",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border-soft py-1.5",children:[u("div",{className:"grid min-w-0 gap-0.5 leading-[1.3]",children:[u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:cl,children:["@",d.handle]}),d.displayName!==d.handle&&t("span",{className:"min-w-0 max-w-full text-[0.7rem] [overflow-wrap:anywhere]",children:d.displayName})]}),u("span",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[0.66rem] text-muted-foreground",children:[t("span",{children:Dr(d)}),so(d)&&t("span",{children:so(d)}),a.has(d.id)&&t("span",{className:"text-primary",children:"Mini-App"})]})]}),d.kind!=="human"&&u("label",{className:"flex cursor-pointer items-center gap-[5px] whitespace-nowrap text-[0.68rem]",children:[t("input",{"aria-label":`@${d.handle} auf der Fl\xE4che anzeigen`,checked:ta(d,a,s,o),onChange:l=>r({...s,actorVisibility:{...s.actorVisibility,[d.id]:l.target.checked}}),type:"checkbox"}),t("span",{children:"Fl\xE4che"})]})]},d.id))})})}function Nr(e){return t(xl,{...e},e.session.session.id)}function xl({cardSections:e,surfaceElements:a,navigation:o,session:r,statusContainer:s,runToolbarContainer:d}){let l=W().can("runs.inspect"),n=ga();if(!n)throw new Error("Die Fl\xE4che braucht den Fl\xE4chen-Controller des Orchestrierungs-Plugins.");let i=U(void 0),f=J(r.runView);f!==void 0&&(i.current=f);let c=f??i.current,{programLayout:m,personalLayout:h,presentation:C,programBasis:x}=yr(r.session.id,c),[L,b]=w(),P=Ya(r.session.id),y=B(()=>new Set(a.flatMap(v=>v.select(r).flatMap(F=>F.anchorActorId?[F.anchorActorId]:[]))),[a,r]),D=B(()=>c?.actors.filter(v=>v.kind!=="human"&&(l?!ta(v,y,P,c.primaryActorId):v.kind==="script")).map(v=>v.id)??[],[l,c,y,P]),R=B(()=>a.flatMap(v=>v.select(r).filter(F=>F.visible!==!1).map(F=>`app:${F.id}`)),[a,r]),K=new Set([...R,...c?.actors.filter(v=>v.kind!=="human"&&v.lifecycle?.kind!=="stopped"&&(l||v.kind==="agent")).map(v=>`@${v.handle}`)??[]]),V=B(()=>h===null&&m.layout?.root===void 0?ja([...R,...c?.actors.filter(v=>v.kind!=="human"&&v.lifecycle?.kind!=="stopped"&&!D.includes(v.id)).map(v=>`@${v.handle}`)??[]]):null,[h,m,R,c,D]),k=C.root??V,M=ua(k).some(v=>K.has(v)),G=B(()=>new Set(ua(k)),[k]);O(()=>gt(r.session.id,G),[r.session.id,G]),O(()=>()=>gt(r.session.id,void 0),[r.session.id]);let S=Ja({view:c,startup:r.startup,connected:r.connected,running:r.running,error:r.conversationError}),j=U(null),$=!M&&S!==void 0,ie=q(()=>{let v=j.current;if(!v)return;let F=v.getBoundingClientRect(),_=document.getElementById("workspace-panel")?.getBoundingClientRect(),H=_?Math.min(F.right,_.right)-Math.max(F.left,_.left):0;return{width:F.width-Math.max(0,H),height:F.height}},[]);O(()=>{let v=j.current;if(!v)return;let F=new ResizeObserver(()=>{let H=ie();H&&v.style.setProperty("--surface-visible-width",`${H.width}px`)});F.observe(v);let _=document.getElementById("workspace-panel");return _&&F.observe(_),()=>F.disconnect()},[ie]);let Q=q(v=>{n.acceptSelection(v)},[n]),fe=v=>{try{Qa(r.session.id,{root:v,programBasis:x}),b(void 0)}catch(F){b(F instanceof Error?F.message:String(F))}};return u("div",{className:"relative flex h-full min-h-0 min-w-0 flex-1 overflow-clip","data-view":"tiled",children:[h&&t(oo,{container:s,label:"Fl\xE4che",order:20,children:t("button",{className:_a,onClick:()=>Qa(r.session.id,null),title:"Eigene Anordnung zur\xFCcksetzen und der Programmanordnung folgen",type:"button",children:"Programmvorgabe \xFCbernehmen"})}),d&&na(u(X,{children:[t(ot,{runId:r.session.id}),l&&t(Fr,{session:r,appActorIds:y,preferences:P,onPreferencesChange:v=>et(r.session.id,v)})]}),d),u("div",{"aria-label":"Fl\xE4che",className:"relative min-h-0 min-w-0 flex-[1_1_360px] overflow-clip bg-[image:var(--surface-backdrop)]",ref:j,children:[t(hl,{}),(m.error||L)&&t("p",{className:"absolute inset-x-2 top-2 z-10 bg-secondary p-3 text-destructive",role:"alert",children:m.error||L}),c&&!$&&t("div",{className:"absolute inset-y-0 left-0 w-[var(--surface-visible-width,100%)] overflow-hidden",children:t(Ir,{root:k,onChange:fe,surfaceElements:a,cardSections:e,session:r,view:c,navigation:o,onSelect:Q,selected:n.selection})}),$&&t(Cr,{state:S})]})]})}function hl(){return u("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-full opacity-10",preserveAspectRatio:"none",viewBox:"0 0 180 180",children:[t("filter",{id:"surface-grain",children:t("feTurbulence",{baseFrequency:".76",numOctaves:"3",stitchTiles:"stitch",type:"fractalNoise"})}),t("path",{d:"M0 0h180v180H0z",fill:"#887890",filter:"url(#surface-grain)",opacity:".32"})]})}var lo=p("@ragents/web/run-panel/host","useCenterElements");var rt=p("@ragents/web/run-panel/host","useRunPanelHost");var Er=(e,a)=>{let o=e.actors.filter(d=>d.kind!=="human"&&(a||d.kind==="agent")),r=we(e);return[...o.filter(d=>d.id===r),...o.filter(d=>d.id!==r)]},qr=(e,a)=>{let o=[],r=[];for(let s of e)(s.id===a.primaryId||s.id===a.selectedId||tt(s,a.mode,a.onStage(s))?o:r).push(s);return{shown:o,hidden:r}},Ea=(e,a)=>e.inputs.filter(o=>o.actorId===a&&o.lifecycle.kind==="pending").length,Ll=(e,a)=>e.actions.filter(o=>o.status==="pending"&&o.askedBy===a).length,Or=(e,a,o)=>o||e!==void 0&&a.anchorActorId!==void 0&&Ll(e,a.anchorActorId)>0;var Il=4,Hr=12,uo=90,Cl={running:["arbeitet","arbeiten"],input:["wartet auf Eingabe","warten auf Eingabe"],waiting:["wartet","warten"],stopped:["gestoppt","gestoppt"]},Sl=["running","input","waiting","stopped"],qa=e=>e.toLocaleLowerCase("de-DE"),wl=e=>{let a=e.split(`
|
|
6
|
-
`).map(s=>s.replace(/\s+/g," ").trim()).find(s=>s!=="")??"";if(a.length<=uo)return a;let o=a.slice(0,uo-3),r=o.lastIndexOf(" ");return`${(r>uo/2?o.slice(0,r):o).trimEnd()}...`},no=(e,a)=>a.lifecycle?.kind==="stopped"?"stopped":e.actions.some(o=>o.status==="pending"&&o.askedBy===a.id)?"input":a.lifecycle?.kind==="running"?"running":"waiting",lt=(e,a=1)=>Cl[e][a===1?0:1],Ur=(e,a)=>{let o=new Map;for(let r of a.map(s=>no(e,s)))o.set(r,(o.get(r)??0)+1);return Sl.flatMap(r=>{let s=o.get(r)??0;return s>0?[`${s} ${lt(r,s)}`]:[]}).join(", ")},Vr=e=>{let a=new Map;for(let o of e.inputs){if(o.subscriptionId!==null||o.presentation==="background"||o.content.trim()==="")continue;let r=a.get(o.actorId);(!r||o.sequence<r.sequence)&&a.set(o.actorId,{sequence:o.sequence,content:o.content})}return o=>{let r=o.description?.trim();if(r)return r;let s=a.get(o.id);if(s)return wl(s.content);let d=o.displayName.trim();return d!==""&&qa(d)!==qa(o.handle)?d:void 0}},zr=(e,a,o)=>{let r=new Set([o.id]),s=o.createdBy;for(;s!==void 0&&!r.has(s);){if(a.has(s))return s;let d=e.get(s);if(!d||d.kind==="human")return null;r.add(s),s=d.createdBy}return null},bl=e=>qa(e).replace(/-\d+$/,"").split(/[-_.]/)[0]??"",yl=e=>{let a=e[0]??"",o=e.reduce((l,n)=>{let i=0;for(;i<l&&n[i]===a[i];)i+=1;return i},a.length),r=a.slice(0,o),s=r.search(/[-_.][^-_.]*$/);return`@${/[-_.]$/.test(r)||e.includes(r)||s<0?r:r.slice(0,s+1)}*`},io=(e,a)=>{let o=new Map(e.actors.map(i=>[i.id,i])),r=new Set(a.map(i=>i.id)),s=we(e),d=new Map;for(let i of a){let f=zr(o,r,i);d.set(f,[...d.get(f)??[],i])}let l=i=>({kind:"actor",actor:i,children:n(i.id)}),n=i=>{let f=d.get(i)??[],c=i===null?[...f.filter(x=>x.id===s),...f.filter(x=>x.id!==s)]:f,m=x=>x.id===s?null:`${i??""}/${x.kind}/${bl(x.handle)}`,h=new Map;for(let x of c){let L=m(x);L!==null&&h.set(L,[...h.get(L)??[],x])}let C=new Set;return c.flatMap(x=>{let L=m(x),b=L===null?void 0:h.get(L);return L===null||!b||b.length<Il?[l(x)]:C.has(L)?[]:(C.add(L),[{kind:"group",key:L,label:yl(b.map(P=>P.handle)),members:b.map(l)}])})};return n(null)},fo=(e,a,o,r)=>{let s=qa(o).trim().split(/\s+/).filter(Boolean);if(s.length===0)return[...a];let d=new Map(e.actors.map(i=>[i.id,i])),l=new Set(a.map(i=>i.id)),n=new Set;for(let i of a){let f=qa(`@${i.handle} ${i.displayName} ${r(i)??""}`);if(!s.every(m=>f.includes(m)))continue;let c=i;for(;c&&!n.has(c.id);){n.add(c.id);let m=zr(d,l,c);c=m===null?void 0:d.get(m)}}return a.filter(i=>n.has(i.id))},st=(e,a)=>e.kind==="actor"?e.actor.id===a||e.children.some(o=>st(o,a)):e.members.some(o=>st(o,a));var Gr="flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent aria-current:bg-primary/10 focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-2",Wr="ml-[18px] list-none border-l border-border-soft pl-1",kl={agent:"bg-glass-agent",primary:"bg-glass-primary",script:"bg-glass-script",app:"bg-glass-app"},Al={running:"text-primary",input:"text-warning",waiting:"text-muted-foreground",stopped:"text-muted-foreground/70"},vl=(e,a)=>a?e.kind==="agent"?"LLM-Agent":"TypeScript-Actor":"Agent";function co({actor:e,className:a,view:o}){let r=He(o,e);return t("span",{className:Y("grid flex-none place-items-center rounded-full text-foreground [&>svg]:size-3",kl[r],a),children:e.lifecycle?.kind==="running"?t(ve,{"aria-hidden":!0,className:"size-3"}):r==="primary"?t(ge,{}):e.kind==="agent"?t(Se,{}):t(qe,{})})}function dt({className:e,nodes:a,...o}){return t("ul",{className:Y("list-none",e),children:a.map(r=>r.kind==="actor"?t(_r,{node:r,...o},r.actor.id):t(Rl,{node:r,...o},r.key))})}function _r({node:e,...a}){return u("li",{children:[t(Pl,{actor:e.actor,...a}),e.children.length>0&&t(dt,{className:Wr,nodes:e.children,...a})]})}function Pl({actor:e,onPick:a,selectedId:o,summary:r,technical:s,view:d}){let l=Ea(d,e.id),n=no(d,e),i=r(e),f=e.displayName.trim(),c=f!==""&&f.toLocaleLowerCase("de-DE")!==e.handle.toLocaleLowerCase("de-DE")&&f!==i,m=e.id===o;return u("button",{"aria-current":m||void 0,className:Gr,"data-actor-handle":e.handle,onClick:()=>a(e),title:`@${e.handle}, ${vl(e,s)}, ${lt(n)}. Nachrichten an @${e.handle} richten`,type:"button",children:[t(co,{actor:e,className:"size-5",view:d}),u("span",{className:"grid min-w-0 flex-1",children:[u("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[u("span",{className:"truncate font-semibold",children:["@",e.handle]}),c&&t("span",{className:"min-w-0 truncate text-[0.66rem] text-muted-foreground",children:f})]}),i&&t("span",{className:"truncate text-[0.66rem] text-muted-foreground",children:i})]}),l>0&&t(se,{className:"h-4 min-w-4 px-1 text-[0.6rem]",variant:"secondary",children:l}),t("span",{className:Y("flex-none text-[0.66rem]",Al[n]),"data-addressee-status":n,children:lt(n)})]})}function Rl({node:e,...a}){let{onToggle:o,openByDefault:r,selectedId:s,toggled:d,view:l}=a,n=e.members.map(h=>h.actor),i=(r||st(e,s))!==d.has(e.key),f=Ur(l,n),c=n.some(h=>h.lifecycle?.kind==="running"),m=n.reduce((h,C)=>h+Ea(l,C.id),0);return u("li",{children:[u("button",{"aria-expanded":i,className:Gr,"data-addressee-group":e.label,onClick:()=>o(e.key),title:`${e.label}: ${n.length} gleichartige Actors, ${f}. Klick ${i?"klappt die Gruppe zu":"zeigt alle"}`,type:"button",children:[t("span",{className:"grid size-5 flex-none place-items-center text-muted-foreground",children:t(Sa,{"aria-hidden":!0,className:Y("size-3.5 transition-transform",i&&"rotate-90")})}),u("span",{className:"grid min-w-0 flex-1",children:[u("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[t("span",{className:"truncate font-semibold",children:e.label}),u("span",{className:"flex-none text-[0.66rem] text-muted-foreground",children:[n.length," Actors"]})]}),t("span",{className:"truncate text-[0.66rem] text-muted-foreground",children:f})]}),c&&t(ve,{"aria-hidden":!0,className:"size-3 flex-none text-primary"}),m>0&&t(se,{className:"h-4 min-w-4 px-1 text-[0.6rem]",variant:"secondary",children:m})]}),i&&t("ul",{className:Wr,children:e.members.map(h=>t(_r,{node:h,...a},h.actor.id))})]})}var Ml="flex h-7 min-w-[70px] max-w-[220px] flex-[0_1_auto] cursor-pointer items-center gap-1.5 rounded-full border border-border bg-background pr-2 pl-1 text-[0.72rem] font-semibold text-foreground hover:bg-accent aria-expanded:border-primary focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:outline-offset-1",Tl="flex h-7 min-w-0 flex-[0_1_auto] cursor-pointer items-center gap-1.5 rounded-md px-1.5 text-[0.7rem] text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:outline-offset-1";function Xr({hidden:e,onOpenChange:a,onReveal:o,onSelect:r,runId:s,selected:d,shown:l,technical:n,view:i}){let[f,c]=w(!1),[m,h]=w(""),[C,x]=w(!1),[L,b]=w(()=>new Set),P=U(null),y=pe(),D=q(H=>{c(H),a(H)},[a]),R=q((H=!1)=>{D(!1),h(""),H&&P.current?.focus({preventScroll:!0})},[D]),K=q(H=>{H?.querySelector("[aria-current=true]")?.scrollIntoView({block:"nearest"})},[]),V=B(()=>[...l,...e].filter(H=>H.lifecycle?.kind==="running"&&H.id!==d.id),[e,d.id,l]),k=B(()=>Vr(i),[i]),M=m.trim()!=="",G=B(()=>io(i,fo(i,l,m,k)),[m,l,k,i]),S=B(()=>fo(i,e,m,k),[e,m,k,i]),j=B(()=>io(i,S),[S,i]),$=C||M&&S.length>0,ie=q(H=>b(Le=>{let ae=new Set(Le);return ae.delete(H)||ae.add(H),ae}),[]),Q=(H,Le)=>{(Le?o:r)(H),R(!0)},fe=V.map(H=>`@${H.handle} arbeitet`).join(", "),v=V.length>0?Ea(i,V[0].id):0,F={onToggle:ie,openByDefault:M,selectedId:d.id,summary:k,technical:n,toggled:L,view:i},_="px-1.5 py-1";return u(X,{children:[u("button",{"aria-controls":f?y:void 0,"aria-expanded":f,"aria-haspopup":"dialog",className:Ml,onClick:()=>D(!f),ref:P,title:`Adressat: @${d.handle}. Klick w\xE4hlt einen anderen Actor`,type:"button",children:[t(co,{actor:d,className:"size-5",view:i}),u("span",{className:"truncate",children:["@",d.handle]}),t(Qe,{"aria-hidden":!0,className:"size-3 flex-none text-muted-foreground"})]}),V.length>0&&u("button",{className:Tl,onClick:()=>D(!f),title:fe,type:"button",children:[t(ve,{"aria-hidden":!0,className:"size-3 flex-none"}),u("span",{className:"truncate in-data-[compact=true]:hidden",children:["@",V[0].handle]}),v>0&&t(se,{className:"h-4 min-w-4 px-1 text-[0.6rem]",variant:"secondary",children:v}),V.length>1&&u("span",{className:"flex-none",children:["+",V.length-1]})]}),f&&u(oa,{buttonRef:P,closeLabel:"Adressat schlie\xDFen",height:460,id:y,label:"Adressat",onClose:R,open:!0,placement:"top",role:"dialog",width:"available",children:[l.length+e.length>Hr&&t("div",{className:"flex-none border-b border-border-soft px-2.5 py-1.5",children:t(te,{"aria-label":"Actors durchsuchen",className:"h-7",onChange:H=>h(H.target.value),placeholder:"Handle oder Aufgabe suchen ...",type:"search",value:m})}),u("div",{className:"min-h-0 flex-1 overflow-auto overscroll-contain",ref:K,children:[t(dt,{className:_,nodes:G,onPick:H=>Q(H,!1),...F}),M&&G.length===0&&S.length===0&&t("p",{className:"px-3.5 py-2 text-muted-foreground",children:"Kein Actor passt zur Suche."}),e.length>0&&(!M||S.length>0)&&u("div",{className:"border-t border-border-soft",children:[u("button",{"aria-expanded":$,className:"flex w-full cursor-pointer items-center justify-between gap-2 px-3.5 py-2 text-left text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-2",onClick:()=>x(!$),type:"button",children:[u("span",{children:[e.length," ausgeblendete Actors"]}),t(Qe,{"aria-hidden":!0,className:Y("size-3.5 flex-none transition-transform",$&&"rotate-180")})]}),$&&t(dt,{className:_,nodes:j,onPick:H=>Q(H,!0),...F})]})]}),t("div",{className:"flex flex-none items-stretch border-t border-border-soft",children:t(ot,{runId:s})})]})]})}var mo=Object.freeze({sideWidth:900,openDelay:160,closeDelay:150}),go="ragents.orchestration.run-panel-settings",ra=Object.freeze({sideWidth:{min:400,max:4e3},openDelay:{min:0,max:5e3},closeDelay:{min:0,max:1e4}}),po=(e,a)=>typeof e=="number"&&Number.isInteger(e)&&e>=a.min&&e<=a.max;function Dl(e){if(e===null)return mo;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||Object.keys(a).some(o=>!["sideWidth","openDelay","closeDelay"].includes(o))||!("sideWidth"in a)||!po(a.sideWidth,ra.sideWidth)||!("openDelay"in a)||!po(a.openDelay,ra.openDelay)||!("closeDelay"in a)||!po(a.closeDelay,ra.closeDelay))throw new Error("Die Einstellungen des Run-Panels sind ung\xFCltig: Breite 400 bis 4000 Pixel, Verz\xF6gerungen 0 bis 5000 beziehungsweise 10000 Millisekunden, ganze Zahlen.");return a}var Kr=ne({changeEvent:"ragents-run-panel-settings-change",matchesKey:e=>e===go,parse:Dl,serialize:JSON.stringify});function ut(){return Kr.useValue(go)}function $r(e){Kr.save(go,e)}var Bl=1500,Zr=e=>e.some(a=>a.role==="user"||a.role==="action"||a.role==="assistant"&&(a.text.trim()!==""||(a.attachments?.length??0)>0));function Jr(e,a,o){let[r,s]=w(o),[d,l]=w(),n=a&&e?.kind==="working"?e:void 0,i=n?.title,f=n?.detail;return O(()=>{o&&s(!0)},[o]),O(()=>{if(i!==void 0&&f!==void 0){l({kind:"working",title:i,detail:f});return}let c=window.setTimeout(()=>l(void 0),Bl);return()=>window.clearTimeout(c)},[f,i]),o||r?void 0:e??d}var xo=280,Yr=380,Fl=300,Nl=Object.freeze({element:null,actor:null,chat:"side",chatWidth:Yr,sheetExpandedHeight:null}),es=e=>`ragents.orchestration.run-panel:${e}`,jr=e=>e===null||typeof e=="string",Qr=e=>e===void 0||e==="side"||e==="auto"?"side":e==="chat"?"chat":e==="bottom"||e==="floating"||e==="docked"?"bottom":void 0;function El(e){if(e===null)return Nl;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||Object.keys(a).some(r=>!["element","stageHeight","actor","chat","chatWidth","sheetExpandedHeight","sheetPeekExtra"].includes(r))||!("element"in a)||!jr(a.element)||!("actor"in a)||!jr(a.actor)||Qr("chat"in a?a.chat:void 0)===void 0||"chatWidth"in a&&(typeof a.chatWidth!="number"||!Number.isFinite(a.chatWidth)||a.chatWidth<xo)||"sheetExpandedHeight"in a&&a.sheetExpandedHeight!==null&&(typeof a.sheetExpandedHeight!="number"||!Number.isFinite(a.sheetExpandedHeight)||a.sheetExpandedHeight<=0)||"sheetPeekExtra"in a&&(typeof a.sheetPeekExtra!="number"||!Number.isFinite(a.sheetPeekExtra)||a.sheetPeekExtra<0))throw new Error("Der gespeicherte Panelzustand ist ung\xFCltig.");let o=a;return{element:o.element,actor:o.actor,chat:Qr(o.chat)??"side",chatWidth:o.chatWidth??Yr,sheetExpandedHeight:o.sheetExpandedHeight??null}}var as=({chat:e,hasElement:a,narrow:o})=>!a||e==="chat"?"full":!o&&e==="side"?"side":"floating",ho=(e,a)=>Math.max(xo,Math.min(Math.round(e),Math.max(xo,a-Fl))),ts=ne({changeEvent:"ragents-run-panel-change",matchesKey:e=>e.startsWith("ragents.orchestration.run-panel:"),parse:El,serialize:JSON.stringify});function os(e){return ts.useValue(es(e))}function rs(e,a){ts.save(es(e),a)}var ss=(e,a=160)=>{let o=e.trim().split(/\r?\n/).find(r=>r.trim()!=="")??"";return o.length>a?`${o.slice(0,a-1)}\u2026`:o},ls=(e,a)=>e.role==="user"?"Du":e.sender??`@${a}`;function ds(e,a,o){let r=e[e.length-1],s=e.filter(l=>l.role==="action"&&l.action?.status===void 0).length;if(s>0)return{kind:"waiting",text:s===1?"Wartet auf Eingabe":`Wartet auf ${s} Eingaben`};if(a)return r?.role==="thinking"&&!r.closed?{kind:"working",text:`@${o} denkt ...`}:r?.role==="tool"&&r.tool&&r.tool.result===void 0?{kind:"working",text:`@${o} nutzt ${r.tool.name} ...`}:r?.role==="assistant"&&!r.closed&&r.text.trim()!==""?{kind:"working",text:`${ls(r,o)} antwortet: ${ss(r.text)}`}:{kind:"working",text:`@${o} arbeitet ...`};let d=[...e].reverse().find(l=>(l.role==="user"||l.role==="assistant")&&l.text.trim()!=="");return d?{kind:"idle",text:`${ls(d,o)}: ${ss(d.text)}`}:{kind:"idle",text:"Noch keine Nachrichten."}}var ql=220,Ol="flex flex-none flex-wrap items-center gap-1.5 border-b border-border bg-shell px-2 py-1.5",Hl="flex h-7 max-w-[200px] flex-none cursor-pointer items-center gap-1.5 rounded-full border border-border bg-card pr-2 pl-1 text-[0.72rem] font-semibold text-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:outline-offset-1 aria-pressed:border-primary aria-pressed:bg-primary/10",Ul={full:"relative flex min-h-0 min-w-0 flex-1 flex-col",side:"relative flex min-h-0 min-w-0 flex-col",floating:"absolute inset-x-2.5 bottom-0 z-20 flex flex-col overflow-hidden rounded-t-2xl border border-b-0 border-border bg-card shadow-[0_-16px_60px_#00000080] transition-[height] duration-300 ease-[cubic-bezier(.32,.72,0,1)] motion-reduce:transition-none"},Vl="rounded-none border-0 bg-transparent",zl="aria-pressed:bg-accent aria-pressed:text-primary",Gl=[{Icon:ya,label:"Nur Chat",mode:"chat",title:"Nur Chat: der Chat f\xFCllt das Run-Panel, die Mini-App tritt zur\xFCck"},{Icon:ka,label:"Chat unten",mode:"bottom",title:"Chat unten: das Sheet \xFCber der Mini-App"},{Icon:Aa,label:"Chat rechts",mode:"side",title:"Chat rechts: neben der Mini-App"}];function us(e){return t(Wl,{...e},e.session.session.id)}function Wl({surfaceElements:e,cardSections:a,navigation:o,renderChat:r,session:s,toolbarContainer:d}){let l=s.session.id,n=W().can("runs.inspect"),i=rt(),f=J(s.runView),c=os(l),m=lo(l),h=U(null),C=U(null),x=U(null),L=U(null),[b,P]=w(c.chatWidth),[y,D]=w(0),[R,K]=w(!1),V=ut();O(()=>P(c.chatWidth),[c.chatWidth]),O(()=>{let A=h.current;if(!A)return;let re=new ResizeObserver(([Ce])=>D(Ce.contentRect.width));return re.observe(A),()=>re.disconnect()},[]);let k=q(A=>rs(l,{...c,...A}),[l,c]),M=B(()=>e.flatMap(({Element:A,select:re})=>re(s).filter(Ce=>Ce.visible!==!1).map(Ce=>({Element:A,definition:Ce}))),[e,s]),G=M.find(A=>A.definition.id===c.element)??M[0],S=Jr(Ja({view:f,startup:s.startup,connected:s.connected,running:s.running,error:s.conversationError}),s.connected,M.length>0||Zr(s.messages)),j=S?t(Yl,{state:S}):void 0,$=B(()=>f?Er(f,n):[],[n,f]),ie=Na(l),Q=Ya(l),fe=B(()=>new Set(M.flatMap(({definition:A})=>A.anchorActorId?[A.anchorActorId]:[])),[M]),v=f?we(f):void 0,F=$.find(A=>A.id===c.actor)??$.find(A=>A.id===v)??$[0],{shown:_,hidden:H}=B(()=>qr($,{mode:ie,primaryId:v,selectedId:F?.id,onStage:A=>A.id===v||ta(A,fe,Q,v)}),[$,fe,ie,Q,v,F?.id]),Le=()=>h.current?.clientWidth??Number.POSITIVE_INFINITY,ae=q(A=>k({actor:A.id}),[k]),sa=q(A=>{et(l,{...Q,actorVisibility:{...Q.actorVisibility,[A.id]:!0}}),k({actor:A.id})},[Q,l,k]),Oa=q(A=>{let re=A.type==="actor"?$.find(Ce=>Ce.id===A.id):void 0;re&&ae(re)},[$,ae]),ye=F===void 0||F.id===v,I=y<V.sideWidth,g=as({chat:c.chat,hasElement:G!==void 0,narrow:I}),T=Xl(g==="floating",C,x,R,V.openDelay),N=Kl(g==="floating",C,x,L,F?.id),ue=Math.max(N.minimum,Math.min(c.sheetExpandedHeight??N.maximum,N.maximum)),Z=$l(g==="floating",C,x,T,N,ue,A=>k({sheetExpandedHeight:Math.round(A)})),ce=U(null);O(()=>{if(g!=="floating"||!T.expanded)return;let A=ce.current;if(!A)return;let re=()=>{A.scrollTop=A.scrollHeight};re();let Ce=window.setTimeout(re,320);return()=>window.clearTimeout(Ce)},[g,T.expanded]);let ke=B(()=>{if(g!=="floating"||!F)return;let A=ye?s.messages:s.actorConversations?.[F.id]??[],re=ye?s.connected&&(s.running||Vt(s.runView,l)):F.lifecycle?.kind==="running";return ds(A,re,F.handle)},[g,ye,l,F,s.actorConversations,s.connected,s.messages,s.runView,s.running]),la=f&&F&&t(Xr,{hidden:H,onOpenChange:K,onReveal:sa,onSelect:ae,runId:l,selected:F,shown:_,technical:n,view:f}),Ie=G&&d&&na(t(_l,{narrow:I,onChange:A=>k({chat:A}),selected:c.chat,sideWidth:V.sideWidth}),d),bs=ye||!f||!F?r({chatElementClassName:Vl,chatScrollerRef:A=>{ce.current=A},notice:j,toolbarLeft:la}):t(Ql,{actor:F,cardSections:a,navigation:o,notice:j,onNavigate:Oa,session:s,toolbarLeft:la,view:f});return u("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-app","data-run-panel":"run",ref:h,children:[Ie,g!=="full"&&M.length>1&&t("nav",{"aria-label":"Mini-Apps des Runs",className:Ol,children:M.map(({definition:A})=>t(Zl,{centered:m.has(A.id),definition:A,onSelect:()=>m.has(A.id)?i.openInCenter(l,A.id,A.title??A.id):k({element:A.id}),selected:A.id===G?.definition.id,session:s,view:f},A.id))}),u("div",{className:Y("relative min-h-0 min-w-0 flex-1",g==="side"?"grid":"flex flex-col"),"data-chat-layout":g,style:g==="side"?{gridTemplateColumns:`minmax(0,1fr) auto ${b}px`}:void 0,children:[g!=="full"&&G&&t(Jl,{centered:m.has(G.definition.id),element:G,navigation:o,peek:g==="floating"?N.minimum:0,runId:l,session:s}),g==="side"&&t(jl,{onChange:A=>P(ho(A,Le())),onCommit:A=>k({chatWidth:ho(A,Le())}),value:b}),g==="floating"&&t("div",{"aria-hidden":!0,className:"absolute inset-0 z-[15] bg-backdrop opacity-0 transition-opacity duration-300 pointer-events-none data-expanded:pointer-events-auto data-expanded:opacity-100 motion-reduce:transition-none","data-expanded":T.expanded||void 0,onClick:T.close}),u("section",{"aria-label":"Chat",className:Y(Ul[g],g==="floating"&&"[&_[data-chat=composer]]:[--qsl-panel-height:var(--sheet-available-height)] [&:not([data-expanded])_[data-slot=card-sections]]:hidden [&[data-sheet-resizing]_[data-slot=card-sections]]:hidden"),"data-expanded":g==="floating"&&T.expanded?!0:void 0,"data-sheet-resizing":Z.height!==void 0||void 0,"data-view":ye?"chat":"actor-chat",onBlurCapture:g==="floating"?()=>T.closeLater(ql):void 0,onFocusCapture:g==="floating"?A=>{A.target!==x.current&&T.open()}:void 0,onPointerEnter:g==="floating"?A=>{A.pointerType==="mouse"&&T.openLater()}:void 0,onPointerLeave:g==="floating"?()=>T.closeLater(V.closeDelay):void 0,ref:C,style:g==="floating"?{height:Z.height??(T.expanded?ue:N.minimum),transition:Z.height!==void 0?"none":void 0,"--sheet-available-height":`${N.available}px`}:void 0,children:[g==="floating"&&t("button",{"aria-expanded":T.expanded,"aria-label":"H\xF6he des ausgeklappten Chats","aria-orientation":"horizontal","aria-valuemin":N.minimum,"aria-valuemax":N.maximum,"aria-valuenow":Math.round(Z.height??ue),className:"flex h-3 w-full flex-none cursor-row-resize touch-none items-center justify-center outline-none select-none [&:hover>span]:bg-foreground [&:focus-visible>span]:bg-foreground [&:focus-visible>span]:ring-2 [&:focus-visible>span]:ring-ring/60","data-run-panel":"sheet-grip",onClick:Z.onClick,onKeyDown:Z.onKeyDown,onPointerDown:Z.onPointerDown,onPointerMove:Z.onPointerMove,onPointerUp:Z.onPointerUp,onPointerCancel:Z.onPointerCancel,onLostPointerCapture:Z.onPointerCancel,ref:x,role:"separator",title:`Ziehen: ausgeklappte H\xF6he einstellen. Klicken: ${T.expanded?"Chat absenken":"Chat hochschieben"}.`,type:"button",children:t("span",{"aria-hidden":!0,className:"h-1 w-9 rounded-full bg-border-strong transition-colors"})}),ke&&u("button",{className:Y("flex h-6 w-full flex-none cursor-pointer items-center gap-2 px-[var(--qsl-chat-horizontal-padding,24px)] text-left text-[0.7rem] transition-opacity duration-200 in-data-expanded:pointer-events-none in-data-expanded:opacity-0 motion-reduce:transition-none",ke.kind==="waiting"?"text-warning":"text-muted-foreground"),onClick:T.toggle,ref:L,title:ke.text,type:"button",children:[ke.kind==="working"&&t(ve,{"aria-hidden":!0,className:"size-3 flex-none"}),t("span",{className:"truncate",children:ke.text})]}),bs]})]})]})}function _l({narrow:e,onChange:a,selected:o,sideWidth:r}){return t("div",{"aria-label":"Ansicht des Run-Panels",className:"flex flex-none items-center gap-0.5 self-center rounded-lg border border-border bg-card p-0.5",role:"group",children:Gl.map(({Icon:s,label:d,mode:l,title:n})=>{let i=l==="side"&&e;return t(z,{"aria-label":d,"aria-pressed":o===l,className:zl,disabled:i,onClick:()=>a(l),size:"icon-sm",title:i?`Chat bleibt unten, solange das Panel schmaler als ${r} Pixel ist`:n,variant:"ghost",children:t(s,{})},l)})})}function Xl(e,a,o,r,s){let[d,l]=w(!1),[n,i]=w(!1),f=U({held:n,blocked:r}),c=U(!1),m=U(void 0);O(()=>{f.current={held:n,blocked:r}},[r,n]);let h=q(()=>window.clearTimeout(m.current),[]),C=q(()=>{c.current||(h(),l(!0))},[h]),x=q(()=>{c.current||(h(),m.current=window.setTimeout(()=>{c.current||l(!0)},s))},[h,s]),L=q(R=>{c.current||(h(),m.current=window.setTimeout(()=>{c.current||f.current.held||f.current.blocked||document.activeElement!==o.current&&a.current?.contains(document.activeElement)||l(!1)},R))},[h,o,a]),b=q(()=>{h(),i(!1),l(!1),document.activeElement instanceof HTMLElement&&a.current?.contains(document.activeElement)&&document.activeElement.blur()},[h,a]),P=q(()=>{if(d){b();return}i(!0),C()},[b,d,C]),y=q(()=>{h(),c.current=!0},[h]),D=q(R=>{h(),c.current=!1,l(R?.expanded??!1),i(R?.held??!1)},[h]);return O(()=>{e||b()},[e,b]),O(()=>h,[h]),O(()=>{if(!e||!d)return;let R=K=>{K.key==="Escape"&&!c.current&&!f.current.blocked&&b()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e,b,d]),{expanded:d,held:n,open:C,openLater:x,closeLater:L,close:b,toggle:P,pauseResize:y,finishResize:D}}function Kl(e,a,o,r,s){let[d,l]=w({minimum:0,maximum:0,available:0,scale:1});return We(()=>{if(!e)return;let n=a.current,i=o.current,f=r.current,c=n?.querySelector('[data-chat="composer"]'),m=n?.parentElement;if(!n||!i||!c||!m)throw new Error("Das Sheet des Panels findet Griff, Eingabe oder Rahmen nicht.");let h=()=>{let x=getComputedStyle(n),L=n.getBoundingClientRect().width;if(L===0)return;let b=L/Number.parseFloat(x.width),P=Math.ceil((i.getBoundingClientRect().height+(f?.getBoundingClientRect().height??0)+c.getBoundingClientRect().height)/b+Number.parseFloat(x.borderTopWidth)+Number.parseFloat(x.borderBottomWidth)),y=Math.floor(m.getBoundingClientRect().height/b*.9),D=Math.max(P,y);l(R=>R.minimum===P&&R.maximum===D&&R.available===y&&R.scale===b?R:{minimum:P,maximum:D,available:y,scale:b})},C=new ResizeObserver(h);return C.observe(c),C.observe(i),C.observe(m),f&&C.observe(f),h(),()=>C.disconnect()},[e,s,o,a,r]),d}function $l(e,a,o,r,s,d,l){let[n,i]=w(),f=U(void 0),c=U(!1),m=x=>{let L=f.current;if(!L)return;f.current=void 0,c.current=L.moved||!x;let b=o.current;b?.hasPointerCapture(L.pointerId)&&b.releasePointerCapture(L.pointerId),x&&L.moved&&l(L.height),r.finishResize(x&&L.moved?{expanded:!0,held:L.held}:L),i(void 0)},h=r.finishResize;O(()=>{e||(f.current=void 0,i(void 0),h())},[e,h]);let C=x=>Math.max(s.minimum,Math.min(x,s.maximum));return{height:n,onClick:x=>{let L=c.current&&x.detail>0;c.current=!1,!L&&r.toggle()},onPointerDown:x=>{if(x.button!==0||f.current||!a.current)return;x.preventDefault();let L=a.current.getBoundingClientRect().height/s.scale;f.current={pointerId:x.pointerId,startY:x.clientY,startHeight:L,height:L,moved:!1,expanded:r.expanded,held:r.held},c.current=!1,r.pauseResize(),i(L),x.currentTarget.setPointerCapture(x.pointerId),x.currentTarget.focus({preventScroll:!0})},onPointerMove:x=>{let L=f.current;if(!L||L.pointerId!==x.pointerId)return;let b=(L.startY-x.clientY)/s.scale;!L.moved&&Math.abs(b)<3||(L.moved=!0,L.height=C(L.startHeight+b),i(L.height))},onPointerUp:x=>{f.current?.pointerId===x.pointerId&&m(!0)},onPointerCancel:x=>{f.current?.pointerId===x.pointerId&&m(!1)},onKeyDown:x=>{if(x.key==="Escape"&&f.current){x.preventDefault(),x.stopPropagation(),m(!1);return}let L=x.key==="ArrowUp"?d+24:x.key==="ArrowDown"?d-24:x.key==="Home"?s.minimum:x.key==="End"?s.maximum:void 0;L===void 0||f.current||(x.preventDefault(),r.finishResize({expanded:!0,held:r.held}),l(C(L)))}}}function Zl({centered:e,definition:a,onSelect:o,selected:r,session:s,view:d}){let l=da(),n=a.title??a.id,i=Or(d,a,l?.needsAnswer(s,a.id)??!1);return u("button",{"aria-pressed":r&&!e,className:Hl,"data-tone":"app",onClick:o,title:e?`${n} liegt in der Mitte. Klick holt das Fenster nach vorn.`:`Mini-App ${n} anzeigen`,type:"button",children:[t("span",{className:"grid size-5 flex-none place-items-center rounded-full bg-glass-app text-foreground [&>svg]:size-3",children:t(Oe,{})}),t("span",{className:"truncate",children:n}),i&&t("span",{"aria-label":"Antwort erwartet",className:"grid size-4 flex-none place-items-center rounded-full bg-warning text-[0.62rem] font-bold text-background",role:"img",children:"!"}),e&&t(je,{"aria-hidden":!0,className:"size-3 flex-none text-muted-foreground"})]})}function Jl({centered:e,element:a,navigation:o,peek:r,runId:s,session:d}){let l=rt(),n=da(),{Element:i,definition:f}=a,c=f.title??f.id;return u("section",{"aria-label":`Mini-App ${c}`,className:"group/stage relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-app",style:r>0?{paddingBottom:r}:void 0,children:[t("div",{className:"absolute top-1.5 right-2 z-[5] flex gap-0.5 rounded-lg border border-border bg-card p-0.5 opacity-0 transition-opacity group-hover/stage:opacity-100 group-focus-within/stage:opacity-100 motion-reduce:transition-none",children:l.kind==="vscode"?t(z,{"aria-label":`${c} in die Mitte legen`,onClick:()=>l.openInCenter(s,f.id,c),size:"icon-sm",title:"In die Mitte legen",variant:"ghost",children:t(je,{})}):n&&t(z,{"aria-label":`${c} in Vollansicht \xF6ffnen`,onClick:()=>n.openFullscreen(f.id),size:"icon-sm",title:"Vollansicht",variant:"ghost",children:t(ba,{})})}),t("div",{className:"relative flex min-h-0 flex-1 flex-col","data-run-panel":"stage",children:e?u("div",{className:"m-auto grid gap-3 p-4 text-center text-[0.76rem] text-muted-foreground",role:"status",children:[u("span",{children:[c," liegt in der Mitte."]}),t(z,{onClick:()=>l.returnToRunPanel(s,f.id),size:"sm",variant:"outline",children:"Zur\xFCck ins Panel"})]}):t(i,{definition:f,navigation:o,session:d})})]})}function jl({onChange:e,onCommit:a,value:o}){let r=U(void 0),s=d=>{r.current&&(r.current=void 0,d.currentTarget.releasePointerCapture(d.pointerId),a(o))};return t("div",{"aria-label":"Breite des Chats","aria-orientation":"vertical","aria-valuenow":o,className:"flex w-2.5 flex-none cursor-col-resize touch-none items-center justify-center border-r border-l border-border bg-shell select-none hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-2",onKeyDown:d=>{let l=d.key==="ArrowRight"?-24:d.key==="ArrowLeft"?24:0;l!==0&&(d.preventDefault(),e(o+l),a(o+l))},onPointerCancel:s,onPointerDown:d=>{r.current={startX:d.clientX,startWidth:o},d.currentTarget.setPointerCapture(d.pointerId)},onPointerMove:d=>{r.current&&e(r.current.startWidth+r.current.startX-d.clientX)},onPointerUp:s,role:"separator",tabIndex:0,children:t("span",{"aria-hidden":!0,className:"h-10 w-1 rounded-full bg-border-strong"})})}function Ql({actor:e,cardSections:a,navigation:o,notice:r,onNavigate:s,session:d,toolbarLeft:l,view:n}){let i=e.lifecycle?.kind==="running";return u("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[t("div",{className:`${Xa} max-h-[40%] flex-none overflow-auto overscroll-contain border-t-0 border-b`,"data-slot":"card-sections",children:a.map(({id:f,Section:c})=>t(c,{actor:e,navigation:o,session:d},f))}),t(ma,{className:"flex-1",composer:t(Je,{actor:e,presentation:"panel",running:i,display:"panel",toolbarLeft:l,view:n}),children:r??t(Ze,{actor:e,conversation:d.actorConversations?.[e.id],historyError:d.conversationError,onNavigate:s,presentation:"inspector",primaryMessages:d.messages,running:i,display:"panel",view:n})})]})}function Yl({state:e}){return t("div",{className:"grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)_auto_minmax(var(--qsl-composer-height,0px),1fr)] justify-items-center overflow-hidden p-6",children:t(pa,{className:"row-start-2",state:e})})}var ed=(e,a)=>{if(!e.revealEntity({type:"artifact",id:a.id}))throw new Error(`Kein Plugin kann das Dokument ${a.title} anzeigen`)};function ns({actor:e,navigation:a,session:o}){let r=J(o.runView);if(!r)return null;let s=_t(e).id,d=r.artifacts.filter(l=>l.createdBy===s);return d.length===0?null:u("section",{className:"grid gap-1.5",children:[u(It,{children:[t("span",{children:"Dokumente"}),t("small",{children:d.length})]}),t("ul",{className:"grid list-none gap-1",children:d.map(l=>t("li",{children:u("button",{className:"grid w-full cursor-pointer rounded-lg border border-border-soft px-2 py-1.5 text-left hover:border-[color-mix(in_srgb,var(--primary)_45%,var(--border))] hover:bg-primary/6",onClick:()=>ed(a,l),type:"button",children:[t("strong",{className:"truncate text-[0.74rem]",title:l.title,children:l.title}),u("small",{className:"text-[0.64rem] text-muted-foreground",children:[Ue(l.size)," - ",l.mediaType]})]})},l.id))})]})}var is=e=>({sideWidth:String(e.sideWidth),openDelay:String(e.openDelay),closeDelay:String(e.closeDelay)}),ad=[{key:"sideWidth",label:"Chat neben der Mini-App ab",unit:"px"},{key:"openDelay",label:"Hochschieben nach",unit:"ms"},{key:"closeDelay",label:"Zur\xFCck nach Verlassen nach",unit:"ms"}];function fs(){let e=W(),a=ut(),[o,r]=w(()=>is(a)),[s,d]=w(),[l,n]=w();O(()=>{r(is(a))},[a]);let i=e.can("settings.write"),f=c=>{if(i){n(void 0),d(void 0);try{$r(c),d("Einstellungen des Run-Panels gespeichert.")}catch(m){n(m instanceof Error?m.message:String(m))}}};return u("form",{className:"grid gap-3",onSubmit:c=>{c.preventDefault(),f({sideWidth:Number(o.sideWidth),openDelay:Number(o.openDelay),closeDelay:Number(o.closeDelay)})},children:[t("p",{className:"text-muted-foreground",children:"Ab dieser Breite des Panels liegt der Chat rechts neben der Mini-App statt als Sheet darunter. Die Verz\xF6gerungen bestimmen, wie lange die Maus \xFCber dem Sheet liegen muss, bis es hochgleitet, und wie lange es nach dem Verlassen oben bleibt. Gilt sofort f\xFCr alle Runs in diesem Browser."}),u("div",{className:"flex flex-wrap items-end gap-3",children:[ad.map(({key:c,label:m,unit:h})=>u("label",{className:"grid gap-1.5",children:[u("span",{children:[m," (",h,")"]}),t(te,{className:"w-[130px]",disabled:!i,max:ra[c].max,min:ra[c].min,onChange:C=>{r({...o,[c]:C.target.value}),d(void 0)},required:!0,step:"1",type:"number",value:o[c]})]},c)),t(z,{disabled:!i,type:"submit",children:"Speichern"}),t(z,{disabled:!i,onClick:()=>f(mo),variant:"outline",children:"Zur\xFCcksetzen"})]}),l?t("p",{className:"text-muted-foreground",role:"alert",children:l}):s&&t("p",{className:"text-muted-foreground",role:"status",children:s})]})}function cs({session:e}){let[a,o]=w(!1),[r,s]=w([]),[d,l]=w(),[n,i]=w(!1),[f,c]=w(0),[m,h]=w(""),[C,x]=w(100),L=U(null),b=U(null),P=pe(),y=J(e.runView),D=y?.revision,R=q((k=!1)=>{o(!1),k&&L.current?.focus({preventScroll:!0})},[]);O(()=>{if(!a)return;let k=new AbortController;return i(!0),l(void 0),he.call(me.events,{runId:e.session.id},{signal:k.signal}).then(M=>{k.signal.aborted||s(M)}).catch(M=>{k.signal.aborted||l(M instanceof Error?M.message:String(M))}).finally(()=>{k.signal.aborted||i(!1)}),()=>k.abort()},[a,e.session.id,D,f]);let K=B(()=>{let k=m.trim().toLocaleLowerCase("de-DE"),M=new Map(y?.actors.map(G=>[G.id,G.handle]));return[...r].reverse().filter(G=>!k||`${M.get(G.actorId)??""} ${JSON.stringify(G)}`.toLocaleLowerCase("de-DE").includes(k))},[r,m,y?.actors]),V=new Map(y?.actors.map(k=>[k.id,k.handle]));return u("div",{className:"flex h-full min-w-0 items-stretch",children:[t("button",{"aria-controls":P,"aria-expanded":a,className:_a,onClick:()=>o(k=>!k),ref:L,type:"button",children:"Journal"}),t(fa,{open:a,onOpenChange:k=>{k||R()},children:u(ca,{align:"start",anchor:L,"aria-label":"Journal des Runs",className:"flex min-h-0 min-w-0 flex-col gap-0 overflow-hidden rounded-t-sm rounded-b-none p-0 text-[0.76rem]",collisionPadding:8,id:P,initialFocus:b,role:"region",side:"top",style:{width:"min(900px, var(--available-width))",height:"min(480px, var(--available-height))"},children:[u("header",{className:"flex flex-none items-center gap-2 border-b border-border-soft px-2.5 py-2",children:[u("div",{className:"flex min-w-0 flex-1 items-baseline gap-2.5 [&>span]:truncate",children:[t("strong",{children:"Journal"}),t("span",{className:"text-muted-foreground",children:e.session.title||"Run"})]}),t(z,{onClick:()=>c(k=>k+1),size:"sm",variant:"ghost",children:"Aktualisieren"}),t(z,{"aria-label":"Journal schlie\xDFen",onClick:()=>R(!0),size:"icon-sm",title:"Journal schlie\xDFen",variant:"ghost",children:t(xe,{})})]}),u("div",{className:"flex flex-none items-center gap-3 px-2.5 py-2",children:[t(te,{className:"flex-1","aria-label":"Journal durchsuchen",onChange:k=>{h(k.target.value),x(100)},placeholder:"Ereignistyp, Actor oder Inhalt suchen ...",ref:b,type:"search",value:m}),t("span",{className:"flex-none whitespace-nowrap text-[0.68rem] text-muted-foreground",role:"status",children:n?"L\xE4dt ...":`${K.length} Ereignisse`})]}),d&&t("p",{className:"flex-none px-2.5 pb-2 text-destructive",role:"alert",children:d}),u("div",{"aria-label":"Journalereignisse, neueste zuerst",className:"min-h-0 flex-1 overflow-auto overscroll-contain px-2.5 pb-2.5",children:[!n&&!d&&K.length===0&&t("p",{className:"text-muted-foreground",children:m?"Keine passenden Ereignisse.":"Das Journal enth\xE4lt noch keine Ereignisse."}),K.slice(0,C).map(k=>t(td,{actor:V.get(k.actorId),event:k},k.eventId)),K.length>C&&t(z,{onClick:()=>x(k=>k+100),size:"sm",variant:"outline",children:"Weitere Ereignisse anzeigen"})]})]})})]})}function td({actor:e,event:a}){let[o,r]=w(!1);return u("details",{className:"border-b border-border-soft open:[&>summary]:text-primary",onToggle:s=>r(s.currentTarget.open),children:[u("summary",{className:"grid cursor-pointer grid-cols-[32px_minmax(130px,1fr)_minmax(70px,140px)_auto] items-baseline gap-2 px-0.5 py-2 text-[0.68rem] focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2 max-[550px]:grid-cols-[24px_minmax(0,1fr)_auto] max-[550px]:gap-x-2 max-[550px]:gap-y-1",children:[t("span",{className:"text-muted-foreground tabular-nums",children:a.sequence}),t("span",{className:"font-mono [overflow-wrap:anywhere]",children:a.type}),t("span",{className:"truncate max-[550px]:col-start-2 max-[550px]:row-start-2",title:a.actorId,children:e?`@${e}`:a.actorId}),t("time",{className:"text-muted-foreground tabular-nums max-[550px]:col-start-3 max-[550px]:row-start-1",dateTime:a.occurredAt,children:new Date(a.occurredAt).toLocaleTimeString("de-DE")})]}),o&&t(Me,{className:"m-0 mb-2 text-[0.68rem]",content:JSON.stringify(a,null,2),language:"json",path:"event.json"})]})}var od="Not-Aus durch den Bediener";function ps({session:e}){return t(Ne,{className:"max-w-none",children:t(rd,{runId:e.session.id},e.session.id)})}function rd({runId:e}){let a=W().can("runs.write"),[o,r]=w(!1),[s,d]=w(!1),[l,n]=w(),i=async()=>{d(!0),n(void 0);try{await ur(e,od),r(!1)}catch(f){n(f instanceof Error?f.message:String(f))}finally{d(!1)}};return a?o?u("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[t("span",{className:"text-[0.72rem] font-semibold text-destructive",children:"Wirklich alles stoppen?"}),t(z,{disabled:s,onClick:()=>{i()},size:"sm",variant:"destructive",children:"Ja"}),t(z,{disabled:s,onClick:()=>r(!1),size:"sm",variant:"outline",children:"Abbrechen"}),l&&t("span",{className:"max-w-[260px] truncate text-[0.7rem] text-destructive",title:l,children:l})]}):u(z,{onClick:()=>r(!0),size:"sm",title:"Beendet den ganzen Run: Turns, Agenten und Abl\xE4ufe",variant:"destructive",children:[t(kt,{"data-icon":"inline-start"}),"Run stoppen"]}):null}var nt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),sd=(e,a,o)=>JSON.stringify([e,a,o]),ms=(e,a)=>{if(!Array.isArray(e)||e.some(o=>{if(!nt(o)||o.runId!==a||typeof o.eventId!="string"||typeof o.actorId!="string"||!Number.isSafeInteger(o.sequence)||typeof o.occurredAt!="string"||!Number.isFinite(Date.parse(o.occurredAt))||typeof o.type!="string"||!nt(o.payload))return!0;let r=o.payload;return o.type.startsWith("tool.call.")&&(typeof r.turnId!="string"||typeof r.toolCallId!="string")?!0:o.type==="tool.call.source"?typeof r.code!="string"||r.path!==null&&typeof r.path!="string":o.type==="tool.call.started"?typeof r.name!="string"||!("input"in r):o.type==="tool.call.completed"?typeof r.name!="string"||!("output"in r):o.type==="tool.call.failed"?typeof r.name!="string"||typeof r.error!="string":o.type==="turn.finished"?typeof r.turnId!="string"||!["completed","failed"].includes(String(r.outcome)):o.type==="turn.interrupted"?typeof r.turnId!="string"||typeof r.reason!="string":!1}))throw new Error("Der Server hat kein g\xFCltiges Journal f\xFCr diesen Run geliefert.");return e},gs=(e,a)=>{let o=new Map,r=new Map(a?.actors.map(l=>[l.id,l])),s=new Map;for(let l of[...e].sort((n,i)=>n.sequence-i.sequence)){if(a&&l.runId!==a.id)continue;if(l.type==="turn.finished"||l.type==="turn.interrupted"){s.set(JSON.stringify([l.actorId,l.payload.turnId]),{at:l.occurredAt,reason:"reason"in l.payload?l.payload.reason:null});continue}if(l.type!=="tool.call.started"&&l.type!=="tool.call.completed"&&l.type!=="tool.call.failed"&&l.type!=="tool.call.source")continue;let n=sd(l.actorId,l.payload.turnId,l.payload.toolCallId);if(l.type==="tool.call.started"){if(l.payload.name!=="typescript_eval"||o.has(n))continue;let f=r.get(l.actorId),c=nt(l.payload.input)?l.payload.input:{};o.set(n,{key:n,actorId:l.actorId,actorHandle:f?.handle??l.actorId,actorName:f?.displayName??l.actorId,turnId:l.payload.turnId,toolCallId:l.payload.toolCallId,sequence:l.sequence,startedAt:l.occurredAt,finishedAt:null,status:"running",code:typeof c.code=="string"?c.code:null,path:typeof c.path=="string"?c.path:null,result:void 0,logs:[],error:null});continue}let i=o.get(n);if(i)if(l.type==="tool.call.source")i.code=l.payload.code,i.path=l.payload.path;else if(l.type==="tool.call.completed"){i.status="completed",i.finishedAt=l.occurredAt;let f=l.payload.output,c=nt(f)&&"result"in f&&Array.isArray(f.logs)&&f.logs.every(m=>typeof m=="string");i.result=c?f.result:f,i.logs=c?f.logs:[]}else i.status="failed",i.finishedAt=l.occurredAt,i.error=l.payload.error}let d=new Map(a?.turns.map(l=>[JSON.stringify([l.actorId,l.id]),l]));for(let l of o.values()){if(l.status!=="running")continue;let n=JSON.stringify([l.actorId,l.turnId]),i=d.get(n),f=i?.toolCalls?.find(m=>m.id===l.toolCallId&&m.name==="typescript_eval"),c=s.get(n);f&&f.status!=="running"?(l.status=f.status,l.finishedAt=f.finishedAt??i?.finishedAt??c?.at??null):(c||i&&i.status!=="running")&&(l.status="interrupted",l.finishedAt=c?.at??i?.finishedAt??null),l.status==="interrupted"&&(l.error=c?.reason??i?.reason??"Der Aufruf wurde unterbrochen.")}return[...o.values()].sort((l,n)=>n.sequence-l.sequence)},it=e=>({running:"L\xE4uft",completed:"Fertig",failed:"Fehlgeschlagen",interrupted:"Unterbrochen"})[e],xs=(e,a,o)=>{let r=a.trim().toLocaleLowerCase("de-DE");return e.filter(s=>(o==="all"||s.status===o)&&(!r||[s.actorId,s.actorHandle,s.actorName,s.code,s.path,JSON.stringify(s.result),...s.logs,s.error,it(s.status)].join(`
|
|
7
|
-
`).toLocaleLowerCase("
|
|
8
|
-
`).find(d=>d.trim())??e.path??"TypeScript
|
|
9
|
-
`)})]}),e.result!==void 0&&u(X,{children:[t("h3",{children:"
|
|
4
|
+
`);return f.length>Kt||c.length>Kt?"too large":$s(f,c)},[d,l]);if(!e.previousVersionId)return null;if(!o)return t("p",{className:ye,children:"Previous version not in this projection."});if(!r||!s||r.kind==="loading"||s.kind==="loading")return t("p",{className:ye,children:"Loading comparison ..."});if(n===void 0)return u("p",{className:ye,children:[e.mediaType," is not compared line by line."]});if(n==="too large")return u("p",{className:ye,children:["Too large for the line comparison (more than ",Kt," lines)."]});if(n.every(f=>f.kind==="same"))return t("p",{className:ye,children:"Both versions have the same text."});let i={same:" ",added:"+",removed:"-"};return t("pre",{className:"my-1.5 overflow-x-auto rounded-lg bg-foreground/4 p-2 text-[0.7rem] [&>span]:block [&>span]:whitespace-pre [&>span[data-diff=added]]:bg-success-soft [&>span[data-diff=removed]]:bg-destructive-soft",children:n.map((f,c)=>u("span",{"data-diff":f.kind,children:[i[f.kind]," ",f.text,`
|
|
5
|
+
`]},c))})}function Js({artifact:e,index:a,...o}){let r=a.view,{content:s,retry:d}=Jt(r.id,e),l=r.inputs.filter(n=>n.artifactIds.includes(e.id));return u("div",{className:Ye,children:[u("header",{className:jt,children:[t(eo,{canGoBack:o.canGoBack,onBack:o.onBack}),u("div",{className:"min-w-0 flex-1",children:[t("p",{className:"mb-0.5 text-[0.66rem] font-semibold tracking-[0.08em] uppercase text-muted-foreground",children:"Artifact"}),t("h2",{children:e.title}),u("span",{className:Zt,children:["by ",ea(a,e.createdBy)," - ",Ue(e.size)," - ",e.mediaType]})]}),t(z,{render:t("a",{href:Ra(r.id,e.id)}),size:"sm",variant:"outline",children:"Download"})]}),u("div",{className:Ba,children:[u("section",{className:ee,children:[t("h3",{children:"Content"}),(!s||s.kind==="loading")&&t("p",{className:ye,children:"Loading artifact ..."}),s?.kind==="error"&&u("p",{className:Qt,children:[s.message," ",t("button",{className:ir,onClick:d,type:"button",children:"Reload"})]}),s?.kind==="download"&&u("p",{className:ye,children:["No preview for ",e.mediaType,"."]}),s?.kind==="image"&&t("img",{alt:e.title,className:"max-w-full rounded-lg",src:Ra(r.id,e.id)}),s?.kind==="text"&&t("pre",{className:Ma,children:s.text})]}),e.previousVersionId&&u("section",{className:ee,children:[t("h3",{children:"Change from previous version"}),t(Ks,{artifact:e,index:a})]}),l.length>0&&u("section",{className:ee,children:[t("h3",{children:"Used in inputs"}),t("div",{className:Te,children:l.map(n=>t("button",{className:Be,onClick:()=>o.onNavigate({type:"input",id:n.id}),type:"button",children:u("span",{className:De,children:[t("strong",{children:n.content}),u("small",{children:[pr(a,n)," - ",oe(n.enqueuedAt)]})]})},n.id))})]}),u("section",{className:ee,children:[t("h3",{children:"Details"}),u("dl",{className:Ve,children:[t("dt",{children:"Created by"}),t("dd",{children:t(ze,{id:e.createdBy,index:a,onNavigate:o.onNavigate})}),t("dt",{children:"Hash"}),t("dd",{children:de(e.hash)}),t("dt",{children:"Created"}),t("dd",{children:oe(e.createdAt)}),e.previousVersionId&&u(X,{children:[t("dt",{children:"Previous version"}),t("dd",{children:t(Ta,{label:de(e.previousVersionId),onNavigate:o.onNavigate,selection:{type:"artifact",id:e.previousVersionId}})})]})]})]})]})]})}var js="relative isolate rounded-panel border-[1.5px] border-(--material-edge) bg-(--material-face) [--material-edge:#514657] dark:[--material-edge:#b7a8bd]",Zs={agent:"[--material-face:var(--color-glass-agent)]",primary:"[--material-face:var(--color-glass-primary)]",script:"[--material-face:var(--color-glass-script)]",app:"[--material-face:var(--color-glass-app)]"},ao=(e,a)=>Y(js,Zs[e],a),mr="relative flex items-center gap-2 rounded-t-[15.5px] bg-[color-mix(in_srgb,var(--material-face)_96%,black)] px-3 py-2",xr="min-w-0 truncate p-0 text-[17px] font-[730] leading-[1.3] tracking-[-.5px]",gr="grid size-8 flex-none place-items-center rounded-[11px] border border-[#5146578a] bg-white/9 text-foreground shadow-glass-icon";var Qs=["left","right","top","bottom"],Ys={left:"Dock left",right:"Dock right",top:"Dock top",bottom:"Dock bottom"},el={left:Ee,right:Ia,top:Ca,bottom:La},hr=e=>({left:e.left+2,top:e.top+2,width:Math.max(0,e.width-4),height:Math.max(0,e.height-4)}),to=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),al={left:{inner:"left-0 top-[40px]",outer:"left-0 top-[calc(50%_-_18px)]"},right:{inner:"right-0 top-[40px]",outer:"right-0 top-[calc(50%_-_18px)]"},top:{inner:"top-0 left-[40px]",outer:"top-0 left-[calc(50%_-_18px)]"},bottom:{inner:"bottom-0 left-[40px]",outer:"bottom-0 left-[calc(50%_-_18px)]"}},tl="absolute grid size-[36px] place-items-center rounded-[5px] border border-primary bg-surface text-primary shadow-[0_2px_8px_#0002] pointer-events-auto data-[active]:bg-primary data-[active]:text-surface [&>svg]:pointer-events-none",ol="absolute z-3 grid touch-none place-items-center rounded-[4px] focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2 data-[direction=horizontal]:cursor-col-resize data-[direction=vertical]:cursor-row-resize [&>span]:pointer-events-none [&>span]:rounded-[4px] [&>span]:bg-border-strong data-[direction=horizontal]:[&>span]:h-8 data-[direction=horizontal]:[&>span]:w-[3px] data-[direction=vertical]:[&>span]:h-[3px] data-[direction=vertical]:[&>span]:w-8 hover:[&>span]:bg-primary focus-visible:[&>span]:bg-primary";function Lr({root:e,onChange:a,items:o,canArrange:r,selectedEntity:s,onSelect:d}){let l=U(null),[n,i]=w({width:0,height:0}),[f,c]=w({width:0,height:0}),[m,h]=w(null),[C,g]=w(null),[L,y]=w(!1),[P,b]=w(null),[B,R]=w(),[$,V]=w(null),k=U(null),M=U(null),G=$??e,S=D(()=>ua(e),[e]),Z=D(()=>[...S].sort(),[S]),K=D(()=>new Map(o.map(I=>[I.entity,I])),[o]),ie=e?ct(e):{width:0,height:0},Q=f.width<ie.width||f.height<ie.height,fe=B&&S.includes(B)?B:S[0],A={left:0,top:0,...n},F=D(()=>G?mt(G,{left:0,top:0,...n}):{leaves:new Map,dividers:[]},[G,n]);We(()=>{let I=l.current;if(!I)return;let x=I.parentElement,T=()=>{let ue=I.clientWidth,J=I.clientHeight;i(Ie=>Ie.width===ue&&Ie.height===J?Ie:{width:ue,height:J});let ce=getComputedStyle(x),ke=x.clientWidth-parseFloat(ce.paddingLeft)-parseFloat(ce.paddingRight),la=x.clientHeight-parseFloat(ce.paddingTop)-parseFloat(ce.paddingBottom);c(Ie=>Ie.width===ke&&Ie.height===la?Ie:{width:ke,height:la})},N=new ResizeObserver(T);return N.observe(I),N.observe(x),T(),()=>N.disconnect()},[]),O(()=>{s&&R(s)},[s]),We(()=>{if(!r){h(null),g(null);return}let I=null,x=()=>{I!==null&&cancelAnimationFrame(I),I=null},T=J=>{if(!J.dataTransfer?.types.includes(ve))return;let ce=J.dataTransfer.getData(ve);ce&&(x(),I=requestAnimationFrame(()=>{I=null,J.defaultPrevented||h(ce)}))},N=()=>{x(),h(null),g(null)},ue=J=>{J.key==="Escape"&&N()};return window.addEventListener("dragstart",T),window.addEventListener("dragend",N),window.addEventListener("drop",N),window.addEventListener("keydown",ue),()=>{x(),window.removeEventListener("dragstart",T),window.removeEventListener("dragend",N),window.removeEventListener("drop",N),window.removeEventListener("keydown",ue)}},[r]);let _=q(()=>{k.current!==null&&cancelAnimationFrame(k.current),k.current=null;let I=M.current;M.current=null,I?.handle.hasPointerCapture(I.pointerId)&&I.handle.releasePointerCapture(I.pointerId),V(null),y(!1)},[]);We(()=>(_(),_),[e,n,Q,_]),O(()=>{if(!L)return;let I=x=>{x.key==="Escape"&&_()};return window.addEventListener("keydown",I),window.addEventListener("blur",_),()=>{window.removeEventListener("keydown",I),window.removeEventListener("blur",_)}},[L,_]);let H=I=>{let x=M.current;if(!x||x.pointerId!==I.pointerId)return;let T=x.divider.direction==="horizontal"?I.clientX:I.clientY,N=Math.max(x.divider.minimum,Math.min(x.divider.maximum,x.divider.ratio+(T-x.start)/x.divider.span));x.next=T===x.start?x.root:pt(x.root,x.divider.path,N)},Le=I=>{R(I),d?.(I)},ae=r&&C&&m?ft(e,m,C.entity,C.side):null,sa=ae?ct(ae):null,Oa=ae&&ae!==e&&sa&&m?f.width<sa.width||f.height<sa.height?A:mt(ae,A).leaves.get(m):null,be=I=>Qs.map(x=>{let T=el[x];return t("div",{className:`${tl} ${al[x][I===null?"outer":"inner"]}`,"data-dock-side":x,"data-dock-entity":I??"",title:Ys[x],"data-active":C?.entity===I&&C.side===x||void 0,children:t(T,{size:18,"aria-hidden":"true"})},x)});return u("div",{className:"flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden p-2 data-[dragging]:[&_iframe]:pointer-events-none data-[resizing]:[&_iframe]:pointer-events-none","data-dragging":r&&m!==null||void 0,"data-resizing":L||void 0,children:[Q&&S.length>1&&u("label",{className:"flex items-center gap-2 pb-2 text-[0.8rem]",children:["Tile",t("select",{className:"max-w-[60%] min-w-0","aria-label":"Visible tile",value:fe,onChange:I=>Le(I.target.value),children:S.map(I=>t("option",{value:I,children:K.get(I)?.title??I},I))}),t("span",{className:"truncate text-muted-foreground",children:"More space needed for the split view"})]}),u("div",{ref:l,className:"relative min-h-0 min-w-0 flex-1 overflow-hidden",onDragOver:I=>{if(!r||m===null||!I.dataTransfer.types.includes(ve))return;I.preventDefault(),I.dataTransfer.dropEffect="move";let x=I.target instanceof Element?I.target.closest("[data-dock-side]"):null,T=x&&l.current?.contains(x)?{entity:x.dataset.dockEntity||null,side:x.dataset.dockSide}:null;g(N=>N?.entity===T?.entity&&N?.side===T?.side?N:T)},onDragLeave:I=>{I.currentTarget.contains(I.relatedTarget)||g(null)},onDrop:I=>{if(!r||m===null)return;let x=I.dataTransfer.getData(ve);if(!x||x!==m||(I.preventDefault(),!K.has(x)&&!S.includes(x)))return;let T=I.target instanceof Element?I.target.closest("[data-dock-side]"):null;try{if(!e||T){let N=ft(e,x,T?.dataset.dockEntity||null,T?.dataset.dockSide??"right");N!==e&&a(N===null?null:_e(N)),Le(x),b(null)}}catch(N){b(N instanceof Error?N.message:String(N))}finally{h(null),g(null)}},children:[P&&u("div",{className:"absolute inset-x-2 bottom-2 z-7 flex items-center gap-2 rounded-lg border border-primary bg-surface p-3 text-foreground shadow-[0_2px_8px_#0002]",role:"alert",children:[t("span",{className:"flex-1",children:P}),t("button",{className:"grid cursor-pointer place-items-center bg-transparent p-1",type:"button","aria-label":"Close message",onClick:()=>b(null),children:t(ge,{size:16})})]}),!e&&t("div",{className:"grid h-full place-items-center rounded-lg border border-dashed border-border-strong p-6 text-center text-muted-foreground",children:r?"Drag an actor or a mini-app from the header here.":"No content has been arranged for this tile view yet."}),Z.map(I=>{let x=K.get(I),T=hr(Q?A:F.leaves.get(I));return u("section",{className:ao(x?.tone??(I.startsWith("app:")?"app":"agent"),"absolute z-0 flex min-h-0 min-w-0 flex-col overflow-visible"),"data-tile-entity":I,"data-tone":"material",style:{...to(T),display:Q&&I!==fe?"none":void 0},onFocusCapture:()=>{fe!==I&&R(I)},children:[u("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[15.5px]",children:[u("header",{className:`${mr} flex-[0_0_49px] min-w-0 select-none border-b border-[#51465738] text-foreground [&[draggable=true]]:cursor-grab`,draggable:r,onDragStart:N=>{if(!r){N.preventDefault();return}N.dataTransfer.setData(ve,I),N.dataTransfer.effectAllowed="move"},children:[r&&t(wa,{size:16,"aria-hidden":"true"}),t("span",{className:gr,children:x?.tone==="app"||I.startsWith("app:")?t(Oe,{size:20,"aria-hidden":"true"}):x?.tone==="script"?t(Re,{size:20,"aria-hidden":"true"}):t(xe,{size:20,"aria-hidden":"true"})}),t("span",{className:`${xr} flex-1`,title:x?.title??I,children:x?.title??I}),r&&t("button",{className:"grid size-[26px] cursor-pointer place-items-center rounded-[4px] bg-transparent p-0 text-muted-foreground hover:bg-glass-group hover:text-foreground",type:"button",draggable:!1,"aria-label":`Remove tile ${x?.title??I}`,onClick:()=>a(So(e,I)),children:t(ge,{size:16})})]}),t("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-auto [&>*]:min-h-0 [&>*]:min-w-0 [&>*]:flex-1",children:x?.content??t("div",{className:"p-4.5 text-muted-foreground",children:r?"This content is no longer available. You can remove the tile or dock other content here.":"This content is no longer available."})})]}),r&&m!==null&&m!==I&&t("div",{className:"absolute inset-0 z-4",children:t("div",{className:"pointer-events-none absolute top-1/2 left-1/2 size-[116px] -translate-x-1/2 -translate-y-1/2",children:be(I)})})]},I)}),!Q&&F.dividers.map(I=>t("div",{className:ol,role:"separator",tabIndex:0,"aria-label":"Resize tile","aria-orientation":I.direction==="horizontal"?"vertical":"horizontal","aria-valuemin":Math.round(I.minimum*100),"aria-valuemax":Math.round(I.maximum*100),"aria-valuenow":Math.round(I.ratio*100),"data-direction":I.direction,style:to(I),onPointerDown:x=>{x.button!==0||!x.isPrimary||!e||M.current||(x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),M.current={divider:I,start:I.direction==="horizontal"?x.clientX:x.clientY,root:e,next:e,pointerId:x.pointerId,handle:x.currentTarget},y(!0))},onPointerMove:x=>{M.current?.pointerId===x.pointerId&&(H(x),k.current===null&&(k.current=requestAnimationFrame(()=>{k.current=null,M.current&&V(M.current.next)})))},onPointerUp:x=>{let T=M.current;!T||T.pointerId!==x.pointerId||(H(x),_(),T.next!==T.root&&a(T.next))},onLostPointerCapture:x=>{M.current?.pointerId===x.pointerId&&_()},onPointerCancel:x=>{M.current?.pointerId===x.pointerId&&_()},onKeyDown:x=>{if(x.key==="Escape"&&M.current){x.preventDefault(),_();return}if(!e||M.current)return;let T=I.direction==="horizontal"?"ArrowLeft":"ArrowUp",N=I.direction==="horizontal"?"ArrowRight":"ArrowDown";if(x.key!==T&&x.key!==N&&x.key!=="Home"&&x.key!=="End")return;x.preventDefault();let ue=x.key==="Home"?I.minimum:x.key==="End"?I.maximum:I.ratio+(x.key===N?.02:-.02);a(pt(e,I.path,Math.max(I.minimum,Math.min(I.maximum,ue))))},children:t("span",{})},I.path.join("."))),L&&t("div",{className:"absolute inset-0 z-2"}),r&&m!==null&&e&&t("div",{className:"pointer-events-none absolute inset-2 z-6",children:be(null)}),r&&m!==null&&Oa&&t("div",{className:ao(K.get(m)?.tone??(m.startsWith("app:")?"app":"agent"),"pointer-events-none absolute z-5 opacity-80"),style:to(hr(Oa)),children:t("div",{className:"absolute inset-0 rounded-[15.5px] border-2 border-primary bg-primary/22"})})]})]})}function Ir({root:e,onChange:a,surfaceElements:o,cardSections:r,session:s,view:d,navigation:l,onSelect:n,selected:i}){let f=W().can("runs.inspect"),c=d.actors.filter(C=>C.kind!=="human"&&C.lifecycle?.kind!=="stopped"&&(f||C.kind==="agent")),m=[...c.map(C=>({entity:`@${C.handle}`,title:`${C.displayName||C.handle} (@${C.handle})`,tone:He(d,C),content:C.kind==="agent"?t(Mo,{actor:C,view:d,cardSections:r,chatInput:Va(e,`@${C.handle}`),session:s,navigation:l,onSelect:n}):t(Ka,{view:d,selection:{type:"actor",id:C.id},canGoBack:!1,chatDisplay:"surface",composerVisible:!1,onNavigate:n,onBack:()=>{},primaryMessages:s.messages,actorConversations:s.actorConversations,conversationError:s.conversationError,primaryRunning:s.running})})),...o.flatMap(({Element:C,select:g})=>g(s).filter(L=>L.visible!==!1).map(L=>({entity:`app:${L.id}`,title:L.title??L.id,tone:"app",content:t(C,{definition:L,navigation:l,session:s})})))],h=i?.type==="run-app"?`app:${i.id}`:i?.type==="actor"?c.find(C=>C.id===i.id)?.handle:void 0;return t(Lr,{root:e,onChange:a,items:m,canArrange:f,selectedEntity:i?.type==="actor"&&h?`@${h}`:h})}function Cr({state:e}){return t("div",{className:"pointer-events-none absolute inset-y-0 left-0 grid w-[var(--surface-visible-width,100%)] place-items-center p-6",children:t(pa,{state:e})})}function ja({view:e,startup:a,connected:o,running:r,error:s}){if(a?.status==="failed")return{kind:"error",title:"The run could not be prepared",detail:a.message};if(s)return{kind:"error",title:"The run status is unreachable",detail:s};if(a?.status==="preparing")return{kind:"working",title:"Preparing run",detail:a.message};let d=e?.actors.filter(c=>c.kind!=="human")??[],l=d.filter(c=>c.lifecycle?.kind!=="stopped");if(d.length&&!l.length)return{kind:"stopped",title:"The run was stopped",detail:"No further work is performed."};if(e?.actions.some(c=>c.status==="pending"))return{kind:"waiting",title:"Your input is needed",detail:"An action in the chat is waiting for your input."};let n=new Set(l.map(c=>c.id));if(r||l.some(c=>c.lifecycle?.kind==="running")||e?.turns.some(c=>n.has(c.actorId)&&c.status==="running")||e?.inputs.some(c=>n.has(c.actorId)&&Pa(c)))return{kind:"working",title:"Setting up the run",detail:"The interface is being built. The elements appear automatically."};let f=l.map(c=>e?.turns.filter(m=>m.actorId===c.id).at(-1)).find(c=>c?.status==="failed"||c?.status==="interrupted");if(f)return{kind:"error",title:"The setup was halted",detail:f.reason||"The last work step could not be completed."};if(!o)return{kind:"working",title:"Loading run",detail:"Connecting to the run."}}var ne=p("@ragents/web/lib/local-storage-setting","createLocalStorageSetting");var Sr=e=>`ragents.orchestration.tile-presentation:${e}`;function rl(e){if(e===null||e==="null")return null;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||!("root"in a)||Object.keys(a).some(o=>!["root","programBasis"].includes(o))||"programBasis"in a&&typeof a.programBasis!="string")throw new Error("The stored tile view is invalid.");return{root:a.root===null?null:_e(a.root),..."programBasis"in a?{programBasis:a.programBasis}:{}}}var wr=ne({changeEvent:"ragents-tile-presentation-change",matchesKey:e=>e.startsWith("ragents.orchestration.tile-presentation:"),parse:rl,serialize:JSON.stringify}),sl=e=>wr.useValue(Sr(e)),Qa=(e,a)=>wr.save(Sr(e),a),yr=e=>JSON.stringify({root:e.root});function ll(e,a){if(!e)return null;if(e.programBasis!==void 0)return e.programBasis===yr(a)?e:null;let o=new Set(za(e.root));return za(a.root).some(r=>!o.has(r))?null:e}function br(e,a){let o=a?.pluginStates.find(f=>f.pluginId===wo&&f.scope.kind==="run")?.state,r=D(()=>o===void 0?void 0:JSON.stringify(o),[o]),s=D(()=>{try{return{layout:r===void 0?void 0:ko(JSON.parse(r))}}catch(f){return{error:f instanceof Error?f.message:String(f)}}},[r]),d=D(()=>({root:s.layout?.root??null}),[s]),l=D(()=>yr(d),[d]),n=sl(e),i=a&&!s.error?ll(n,d):n;return O(()=>{n&&!i&&Qa(e,null)},[e,n,i]),{programLayout:s,personalLayout:i,presentation:i??d,programBasis:l}}function Za(e,a="horizontal"){if(e.length===0)return null;if(e.length===1)return{entity:e[0]};let o=Math.ceil(e.length/2),r=a==="horizontal"?"vertical":"horizontal";return{direction:a,weights:[o,e.length-o],children:[Za(e.slice(0,o),r),Za(e.slice(o),r)]}}var oo=p("@ragents/web/StatusGroup","StatusGroup");var Da=p("@ragents/web/Toolbar","ToolbarCopy");var Ne=p("@ragents/web/Toolbar","ToolbarItem");var Fa=p("@ragents/web/Toolbar","ToolbarLabel");var aa=p("@ragents/web/Toolbar","ToolbarText");var dl=Object.freeze({actorVisibility:Object.freeze({})}),kr=e=>`ragents.orchestration.actor-visibility:${e}`;function ul(e){if(e===null)return dl;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||Object.keys(a).some(o=>o!=="actorVisibility")||!("actorVisibility"in a)||!a.actorVisibility||typeof a.actorVisibility!="object"||Array.isArray(a.actorVisibility)||Object.values(a.actorVisibility).some(o=>typeof o!="boolean"))throw new Error("The stored actor visibility is invalid.");return a}var ta=(e,a,o,r)=>e.kind==="human"?!1:(Object.hasOwn(o.actorVisibility,e.id)?o.actorVisibility[e.id]:void 0)??(e.id!==r&&!a.has(e.id)),vr=ne({changeEvent:"ragents-actor-visibility-change",matchesKey:e=>e.startsWith("ragents.orchestration.actor-visibility:"),parse:ul,serialize:JSON.stringify});function Ya(e){return vr.useValue(kr(e))}function et(e,a){vr.save(kr(e),a)}function oa({open:e,id:a,label:o,closeLabel:r,buttonRef:s,onClose:d,width:l,height:n,placement:i="bottom",focusInput:f=!1,keepMounted:c=!1,role:m,headerContent:h,children:C}){let g=U(null),L=y=>y.reason==="outside-press"&&y.event.target instanceof Node&&s.current?.contains(y.event.target)===!0;return t(fa,{open:e,onOpenChange:(y,P)=>{!y&&!L(P)&&d()},children:u(ca,{align:"start",anchor:s,"aria-label":o,className:"flex min-h-0 min-w-0 flex-col gap-0 overflow-hidden rounded-b-sm p-0 text-[0.76rem] focus:outline-none data-[placement=top]:rounded-t-sm data-[placement=top]:rounded-b-none [&_input[type=checkbox]]:m-0 [&_input[type=checkbox]]:flex-none [&_input[type=checkbox]]:accent-primary",collisionPadding:8,"data-surface-scroll":"true",dim:!0,"data-placement":i,id:a,initialFocus:f?()=>g.current?.querySelector("input")??!0:!0,keepMounted:c,ref:g,role:m,side:i,style:{width:l==="available"?"var(--available-width)":l,height:n,maxWidth:"var(--available-width)",maxHeight:"var(--available-height)"},children:[u("header",{className:"flex flex-none items-center justify-between gap-2 border-b border-border-soft px-2.5 py-2",children:[t("strong",{className:"shrink-0",children:o}),h,t(z,{"aria-label":r,onClick:()=>d(!0),size:"icon-sm",title:r,variant:"ghost",children:t(ge,{})})]}),C]})})}var nl="grid size-[30px] flex-none place-items-center rounded-lg border border-foreground/15 text-foreground",il={agent:"bg-glass-agent",primary:"bg-glass-primary",script:"bg-glass-script",app:"bg-glass-app"};function Ar({actor:e,view:a,session:o,open:r,onToggle:s,onClose:d,visible:l}){let n=Ua(o.session.id).has(`@${e.handle}`),i=W().can("runs.inspect"),[f,c]=w(!1),m=U(null),h=pe(),C=xa(),g=q((B=!1)=>{d(),B&&m.current?.focus({preventScroll:!0})},[d]),L=B=>{if(!C)throw new Error("The actor shortcut needs the surface controller.");C.acceptSelection(B),g()},y=He(a,e),P=e.kind==="agent"?`Chat with @${e.handle}`:`Actor view of @${e.handle}`,b=i?e.kind==="agent"?"LLM agent":"TypeScript actor":"Agent";return u("div",{className:"flex items-stretch [&[hidden]]:hidden",hidden:!l,children:[u(Ne,{as:"button","aria-controls":f?h:void 0,"aria-expanded":r,"aria-haspopup":"dialog","aria-label":`${e.displayName||e.handle}. ${b}: open ${P}`,className:"font-bold","data-tone":y,"data-staged":n||void 0,onClick:()=>{c(!0),s()},draggable:i,onDragStart:B=>{if(!i){B.preventDefault();return}B.dataTransfer.setData(ve,`@${e.handle}`),B.dataTransfer.effectAllowed="move",g()},ref:m,title:`${b}: open ${P}${i?". Drag onto a tile to dock.":""}`,type:"button",children:[t("span",{className:Y(nl,n&&il[y]),children:e.kind==="agent"?t(Se,{size:20}):t(qe,{size:20})}),u(Da,{children:[u(Fa,{children:["@",e.handle]}),t(aa,{children:e.displayName&&e.displayName!==e.handle?e.displayName:b})]})]}),f&&t(oa,{open:r,id:h,label:P,closeLabel:`Close ${P}`,buttonRef:m,keepMounted:!0,onClose:g,width:e.kind==="agent"?784:560,height:640,role:"dialog",children:t("div",{className:"min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain",children:t(Ka,{actorConversations:o.actorConversations,canGoBack:!1,chatDisplay:"popout",composerVisible:!0,conversationError:o.conversationError,onBack:()=>{},onNavigate:L,primaryMessages:o.messages,primaryRunning:o.running,selection:{type:"actor",id:e.id},view:a})})})]})}var ro=["all","active","visible","agent","script"],at={all:"All",active:"Active",visible:"Visible",agent:"LLM agents",script:"TypeScript"},Pr=e=>`ragents.orchestration.actor-header:v2:${e}`;function fl(e){if(e===null)return"visible";if(ro.some(a=>a===e))return e;throw new Error("The stored actor display is invalid. Allowed are all, active, visible, agent and script.")}var Rr=(e,a,o)=>e.id===a||o.has(`@${e.handle}`),tt=(e,a,o)=>e.kind!=="human"&&(a==="all"||(a==="active"?e.lifecycle?.kind!=="stopped":a==="visible"?o:e.kind===a)),Mr=ne({changeEvent:"ragents-actor-header-change",matchesKey:e=>e.startsWith("ragents.orchestration.actor-header:"),parse:fl,serialize:e=>e});function Na(e){return Mr.useValue(Pr(e))}function Tr(e,a){Mr.save(Pr(e),a)}var cl="min-w-0 max-w-full text-left font-semibold [overflow-wrap:anywhere]",Br=e=>e.kind==="human"?"User":e.kind==="agent"?"LLM agent":"TypeScript actor",so=e=>e.lifecycle?.kind==="running"?"Working":e.lifecycle?.kind==="stopped"?"Stopped":e.lifecycle?.kind==="idle"?"Ready":"";function pl(e,a,o){let r=o.trim().toLocaleLowerCase("en-US").split(/\s+/).filter(Boolean);return e.filter(s=>{let d=[`@${s.handle}`,s.displayName,s.kind,Br(s),s.lifecycle?.kind,so(s),a.has(s.id)?"Mini-app":""].join(" ").toLocaleLowerCase("en-US");return r.every(l=>d.includes(l))})}function Dr({session:e}){let a=W().can("runs.inspect"),[o,r]=w(),s=q(()=>r(void 0),[]),d=Na(e.session.id),l=Ua(e.session.id),n=j(e.runView),i=D(()=>n?.actors.filter(m=>m.kind!=="human"&&(a||m.kind==="agent"))??[],[a,n]),f=n?we(n):void 0,c=q(m=>tt(m,d,Rr(m,f,l)),[d,l,f]);return O(()=>{o&&!i.some(m=>`${e.session.id}:${m.id}`===o&&c(m))&&s()},[i,s,o,e.session.id,c]),!n||i.length===0?null:t("nav",{"aria-label":"Actors of the run",className:"flex min-w-0 flex-none items-stretch",children:i.map(m=>{let h=`${e.session.id}:${m.id}`;return t(Ar,{actor:m,onClose:s,onToggle:()=>r(C=>C===h?void 0:h),open:o===h,session:e,view:n,visible:c(m)},h)})})}var ml=["active","visible","all"];function ot({runId:e}){let a=W().can("runs.inspect"),o=Na(e),r=a?ro:ml,s=r[(r.indexOf(o)+1)%r.length],d=`Actor display: ${at[o]}. Switch to ${at[s]}`;return t(Ne,{as:"button","aria-label":d,className:"w-[120px] max-w-[120px] min-w-[120px] flex-[0_0_120px]",onClick:()=>Tr(e,s),title:d,type:"button",children:u(Da,{children:[t(Fa,{children:"Display"}),t(aa,{children:at[o]})]})})}function Fr({session:e,appActorIds:a,preferences:o,onPreferencesChange:r}){let[s,d]=w(!1),[l,n]=w(""),i=U(null),f=pe(),c=j(e.runView),m=c?.actors,h=D(()=>pl(m??[],a,l),[m,a,l]),C=q((L=!1)=>{d(!1),L&&i.current?.focus({preventScroll:!0})},[]);O(()=>{C(),n("")},[e.session.id,C]);let g=`Actors \xB7 ${m?.length??0}`;return u("div",{className:"flex h-full min-w-0 flex-none items-stretch",children:[u(Ne,{as:"button",ref:i,"aria-controls":s?f:void 0,"aria-expanded":s,"aria-label":g,title:g,onClick:()=>d(L=>!L),type:"button",children:[t(Se,{size:20}),t(aa,{children:"Actors"})]}),s&&u(oa,{open:!0,id:f,label:"Actors of the run",closeLabel:"Close actor list",buttonRef:i,onClose:C,width:460,height:460,placement:"bottom",focusInput:!0,role:"region",children:[u("div",{className:"flex flex-none items-center gap-2.5 p-2.5",children:[t(te,{className:"flex-1","aria-label":"Search actors",onChange:L=>n(L.target.value),placeholder:"Search handle, type or status ...",type:"search",value:l}),u("span",{className:"flex-none whitespace-nowrap text-[0.68rem] text-muted-foreground",role:"status",children:[h.length," of ",m?.length??0]})]}),t(xl,{actors:h,appActorIds:a,primaryActorId:c?.primaryActorId,onPreferencesChange:r,preferences:o}),t("p",{className:"flex-none border-t border-border-soft px-2.5 py-2.5 text-[0.68rem] text-muted-foreground",children:"Personal view of this run"})]})]})}function xl({actors:e,appActorIds:a,primaryActorId:o,onPreferencesChange:r,preferences:s}){return t("div",{className:"min-h-0 flex-1 overflow-auto overscroll-contain px-2.5",children:e.length===0?t("p",{className:"text-muted-foreground",children:"No matching actors."}):t("ul",{className:"list-none",children:e.map(d=>u("li",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border-soft py-1.5",children:[u("div",{className:"grid min-w-0 gap-0.5 leading-[1.3]",children:[u("div",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[u("span",{className:cl,children:["@",d.handle]}),d.displayName!==d.handle&&t("span",{className:"min-w-0 max-w-full text-[0.7rem] [overflow-wrap:anywhere]",children:d.displayName})]}),u("span",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[0.66rem] text-muted-foreground",children:[t("span",{children:Br(d)}),so(d)&&t("span",{children:so(d)}),a.has(d.id)&&t("span",{className:"text-primary",children:"Mini-app"})]})]}),d.kind!=="human"&&u("label",{className:"flex cursor-pointer items-center gap-[5px] whitespace-nowrap text-[0.68rem]",children:[t("input",{"aria-label":`Show @${d.handle} on the surface`,checked:ta(d,a,s,o),onChange:l=>r({...s,actorVisibility:{...s.actorVisibility,[d.id]:l.target.checked}}),type:"checkbox"}),t("span",{children:"Surface"})]})]},d.id))})})}function Nr(e){return t(gl,{...e},e.session.session.id)}function gl({cardSections:e,surfaceElements:a,navigation:o,session:r,statusContainer:s,runToolbarContainer:d}){let l=W().can("runs.inspect"),n=xa();if(!n)throw new Error("The surface needs the surface controller of the orchestration plugin.");let i=U(void 0),f=j(r.runView);f!==void 0&&(i.current=f);let c=f??i.current,{programLayout:m,personalLayout:h,presentation:C,programBasis:g}=br(r.session.id,c),[L,y]=w(),P=Ya(r.session.id),b=D(()=>new Set(a.flatMap(A=>A.select(r).flatMap(F=>F.anchorActorId?[F.anchorActorId]:[]))),[a,r]),B=D(()=>c?.actors.filter(A=>A.kind!=="human"&&(l?!ta(A,b,P,c.primaryActorId):A.kind==="script")).map(A=>A.id)??[],[l,c,b,P]),R=D(()=>a.flatMap(A=>A.select(r).filter(F=>F.visible!==!1).map(F=>`app:${F.id}`)),[a,r]),$=new Set([...R,...c?.actors.filter(A=>A.kind!=="human"&&A.lifecycle?.kind!=="stopped"&&(l||A.kind==="agent")).map(A=>`@${A.handle}`)??[]]),V=D(()=>h===null&&m.layout?.root===void 0?Za([...R,...c?.actors.filter(A=>A.kind!=="human"&&A.lifecycle?.kind!=="stopped"&&!B.includes(A.id)).map(A=>`@${A.handle}`)??[]]):null,[h,m,R,c,B]),k=C.root??V,M=ua(k).some(A=>$.has(A)),G=D(()=>new Set(ua(k)),[k]);O(()=>xt(r.session.id,G),[r.session.id,G]),O(()=>()=>xt(r.session.id,void 0),[r.session.id]);let S=ja({view:c,startup:r.startup,connected:r.connected,running:r.running,error:r.conversationError}),Z=U(null),K=!M&&S!==void 0,ie=q(()=>{let A=Z.current;if(!A)return;let F=A.getBoundingClientRect(),_=document.getElementById("workspace-panel")?.getBoundingClientRect(),H=_?Math.min(F.right,_.right)-Math.max(F.left,_.left):0;return{width:F.width-Math.max(0,H),height:F.height}},[]);O(()=>{let A=Z.current;if(!A)return;let F=new ResizeObserver(()=>{let H=ie();H&&A.style.setProperty("--surface-visible-width",`${H.width}px`)});F.observe(A);let _=document.getElementById("workspace-panel");return _&&F.observe(_),()=>F.disconnect()},[ie]);let Q=q(A=>{n.acceptSelection(A)},[n]),fe=A=>{try{Qa(r.session.id,{root:A,programBasis:g}),y(void 0)}catch(F){y(F instanceof Error?F.message:String(F))}};return u("div",{className:"relative flex h-full min-h-0 min-w-0 flex-1 overflow-clip","data-view":"tiled",children:[h&&t(oo,{container:s,label:"Surface",order:20,children:t("button",{className:_a,onClick:()=>Qa(r.session.id,null),title:"Reset your own arrangement and follow the program arrangement",type:"button",children:"Apply program default"})}),d&&na(u(X,{children:[t(ot,{runId:r.session.id}),l&&t(Fr,{session:r,appActorIds:b,preferences:P,onPreferencesChange:A=>et(r.session.id,A)})]}),d),u("div",{"aria-label":"Surface",className:"relative min-h-0 min-w-0 flex-[1_1_360px] overflow-clip bg-[image:var(--surface-backdrop)]",ref:Z,children:[t(hl,{}),(m.error||L)&&t("p",{className:"absolute inset-x-2 top-2 z-10 bg-secondary p-3 text-destructive",role:"alert",children:m.error||L}),c&&!K&&t("div",{className:"absolute inset-y-0 left-0 w-[var(--surface-visible-width,100%)] overflow-hidden",children:t(Ir,{root:k,onChange:fe,surfaceElements:a,cardSections:e,session:r,view:c,navigation:o,onSelect:Q,selected:n.selection})}),K&&t(Cr,{state:S})]})]})}function hl(){return u("svg",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 size-full opacity-10",preserveAspectRatio:"none",viewBox:"0 0 180 180",children:[t("filter",{id:"surface-grain",children:t("feTurbulence",{baseFrequency:".76",numOctaves:"3",stitchTiles:"stitch",type:"fractalNoise"})}),t("path",{d:"M0 0h180v180H0z",fill:"#887890",filter:"url(#surface-grain)",opacity:".32"})]})}var lo=p("@ragents/web/run-panel/host","useCenterElements");var rt=p("@ragents/web/run-panel/host","useRunPanelHost");var Er=(e,a)=>{let o=e.actors.filter(d=>d.kind!=="human"&&(a||d.kind==="agent")),r=we(e);return[...o.filter(d=>d.id===r),...o.filter(d=>d.id!==r)]},qr=(e,a)=>{let o=[],r=[];for(let s of e)(s.id===a.primaryId||s.id===a.selectedId||tt(s,a.mode,a.onStage(s))?o:r).push(s);return{shown:o,hidden:r}},Ea=(e,a)=>e.inputs.filter(o=>o.actorId===a&&o.lifecycle.kind==="pending").length,Ll=(e,a)=>e.actions.filter(o=>o.status==="pending"&&o.askedBy===a).length,Or=(e,a,o)=>o||e!==void 0&&a.anchorActorId!==void 0&&Ll(e,a.anchorActorId)>0;var Il=4,Hr=12,uo=90,Cl={running:["working","working"],input:["waiting for input","waiting for input"],waiting:["waiting","waiting"],stopped:["stopped","stopped"]},Sl=["running","input","waiting","stopped"],qa=e=>e.toLocaleLowerCase("en-US"),wl=e=>{let a=e.split(`
|
|
6
|
+
`).map(s=>s.replace(/\s+/g," ").trim()).find(s=>s!=="")??"";if(a.length<=uo)return a;let o=a.slice(0,uo-3),r=o.lastIndexOf(" ");return`${(r>uo/2?o.slice(0,r):o).trimEnd()}...`},no=(e,a)=>a.lifecycle?.kind==="stopped"?"stopped":e.actions.some(o=>o.status==="pending"&&o.askedBy===a.id)?"input":a.lifecycle?.kind==="running"?"running":"waiting",lt=(e,a=1)=>Cl[e][a===1?0:1],Ur=(e,a)=>{let o=new Map;for(let r of a.map(s=>no(e,s)))o.set(r,(o.get(r)??0)+1);return Sl.flatMap(r=>{let s=o.get(r)??0;return s>0?[`${s} ${lt(r,s)}`]:[]}).join(", ")},Vr=e=>{let a=new Map;for(let o of e.inputs){if(o.subscriptionId!==null||o.presentation==="background"||o.content.trim()==="")continue;let r=a.get(o.actorId);(!r||o.sequence<r.sequence)&&a.set(o.actorId,{sequence:o.sequence,content:o.content})}return o=>{let r=o.description?.trim();if(r)return r;let s=a.get(o.id);if(s)return wl(s.content);let d=o.displayName.trim();return d!==""&&qa(d)!==qa(o.handle)?d:void 0}},zr=(e,a,o)=>{let r=new Set([o.id]),s=o.createdBy;for(;s!==void 0&&!r.has(s);){if(a.has(s))return s;let d=e.get(s);if(!d||d.kind==="human")return null;r.add(s),s=d.createdBy}return null},yl=e=>qa(e).replace(/-\d+$/,"").split(/[-_.]/)[0]??"",bl=e=>{let a=e[0]??"",o=e.reduce((l,n)=>{let i=0;for(;i<l&&n[i]===a[i];)i+=1;return i},a.length),r=a.slice(0,o),s=r.search(/[-_.][^-_.]*$/);return`@${/[-_.]$/.test(r)||e.includes(r)||s<0?r:r.slice(0,s+1)}*`},io=(e,a)=>{let o=new Map(e.actors.map(i=>[i.id,i])),r=new Set(a.map(i=>i.id)),s=we(e),d=new Map;for(let i of a){let f=zr(o,r,i);d.set(f,[...d.get(f)??[],i])}let l=i=>({kind:"actor",actor:i,children:n(i.id)}),n=i=>{let f=d.get(i)??[],c=i===null?[...f.filter(g=>g.id===s),...f.filter(g=>g.id!==s)]:f,m=g=>g.id===s?null:`${i??""}/${g.kind}/${yl(g.handle)}`,h=new Map;for(let g of c){let L=m(g);L!==null&&h.set(L,[...h.get(L)??[],g])}let C=new Set;return c.flatMap(g=>{let L=m(g),y=L===null?void 0:h.get(L);return L===null||!y||y.length<Il?[l(g)]:C.has(L)?[]:(C.add(L),[{kind:"group",key:L,label:bl(y.map(P=>P.handle)),members:y.map(l)}])})};return n(null)},fo=(e,a,o,r)=>{let s=qa(o).trim().split(/\s+/).filter(Boolean);if(s.length===0)return[...a];let d=new Map(e.actors.map(i=>[i.id,i])),l=new Set(a.map(i=>i.id)),n=new Set;for(let i of a){let f=qa(`@${i.handle} ${i.displayName} ${r(i)??""}`);if(!s.every(m=>f.includes(m)))continue;let c=i;for(;c&&!n.has(c.id);){n.add(c.id);let m=zr(d,l,c);c=m===null?void 0:d.get(m)}}return a.filter(i=>n.has(i.id))},st=(e,a)=>e.kind==="actor"?e.actor.id===a||e.children.some(o=>st(o,a)):e.members.some(o=>st(o,a));var Gr="flex w-full min-w-0 cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent aria-current:bg-primary/10 focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-2",Wr="ml-[18px] list-none border-l border-border-soft pl-1",kl={agent:"bg-glass-agent",primary:"bg-glass-primary",script:"bg-glass-script",app:"bg-glass-app"},vl={running:"text-primary",input:"text-warning",waiting:"text-muted-foreground",stopped:"text-muted-foreground/70"},Al=(e,a)=>a?e.kind==="agent"?"LLM agent":"TypeScript actor":"Agent";function co({actor:e,className:a,view:o}){let r=He(o,e);return t("span",{className:Y("grid flex-none place-items-center rounded-full text-foreground [&>svg]:size-3",kl[r],a),children:e.lifecycle?.kind==="running"?t(Ae,{"aria-hidden":!0,className:"size-3"}):r==="primary"?t(xe,{}):e.kind==="agent"?t(Se,{}):t(qe,{})})}function dt({className:e,nodes:a,...o}){return t("ul",{className:Y("list-none",e),children:a.map(r=>r.kind==="actor"?t(_r,{node:r,...o},r.actor.id):t(Rl,{node:r,...o},r.key))})}function _r({node:e,...a}){return u("li",{children:[t(Pl,{actor:e.actor,...a}),e.children.length>0&&t(dt,{className:Wr,nodes:e.children,...a})]})}function Pl({actor:e,onPick:a,selectedId:o,summary:r,technical:s,view:d}){let l=Ea(d,e.id),n=no(d,e),i=r(e),f=e.displayName.trim(),c=f!==""&&f.toLocaleLowerCase("en-US")!==e.handle.toLocaleLowerCase("en-US")&&f!==i,m=e.id===o;return u("button",{"aria-current":m||void 0,className:Gr,"data-actor-handle":e.handle,onClick:()=>a(e),title:`@${e.handle}, ${Al(e,s)}, ${lt(n)}. Address messages to @${e.handle}`,type:"button",children:[t(co,{actor:e,className:"size-5",view:d}),u("span",{className:"grid min-w-0 flex-1",children:[u("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[u("span",{className:"truncate font-semibold",children:["@",e.handle]}),c&&t("span",{className:"min-w-0 truncate text-[0.66rem] text-muted-foreground",children:f})]}),i&&t("span",{className:"truncate text-[0.66rem] text-muted-foreground",children:i})]}),l>0&&t(se,{className:"h-4 min-w-4 px-1 text-[0.6rem]",variant:"secondary",children:l}),t("span",{className:Y("flex-none text-[0.66rem]",vl[n]),"data-addressee-status":n,children:lt(n)})]})}function Rl({node:e,...a}){let{onToggle:o,openByDefault:r,selectedId:s,toggled:d,view:l}=a,n=e.members.map(h=>h.actor),i=(r||st(e,s))!==d.has(e.key),f=Ur(l,n),c=n.some(h=>h.lifecycle?.kind==="running"),m=n.reduce((h,C)=>h+Ea(l,C.id),0);return u("li",{children:[u("button",{"aria-expanded":i,className:Gr,"data-addressee-group":e.label,onClick:()=>o(e.key),title:`${e.label}: ${n.length} similar actors, ${f}. Click ${i?"collapses the group":"shows all"}`,type:"button",children:[t("span",{className:"grid size-5 flex-none place-items-center text-muted-foreground",children:t(Sa,{"aria-hidden":!0,className:Y("size-3.5 transition-transform",i&&"rotate-90")})}),u("span",{className:"grid min-w-0 flex-1",children:[u("span",{className:"flex min-w-0 items-baseline gap-1.5",children:[t("span",{className:"truncate font-semibold",children:e.label}),u("span",{className:"flex-none text-[0.66rem] text-muted-foreground",children:[n.length," actors"]})]}),t("span",{className:"truncate text-[0.66rem] text-muted-foreground",children:f})]}),c&&t(Ae,{"aria-hidden":!0,className:"size-3 flex-none text-primary"}),m>0&&t(se,{className:"h-4 min-w-4 px-1 text-[0.6rem]",variant:"secondary",children:m})]}),i&&t("ul",{className:Wr,children:e.members.map(h=>t(_r,{node:h,...a},h.actor.id))})]})}var Ml="flex h-7 min-w-[70px] max-w-[220px] flex-[0_1_auto] cursor-pointer items-center gap-1.5 rounded-full border border-border bg-background pr-2 pl-1 text-[0.72rem] font-semibold text-foreground hover:bg-accent aria-expanded:border-primary focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:outline-offset-1",Tl="flex h-7 min-w-0 flex-[0_1_auto] cursor-pointer items-center gap-1.5 rounded-md px-1.5 text-[0.7rem] text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:outline-offset-1";function Xr({hidden:e,onOpenChange:a,onReveal:o,onSelect:r,runId:s,selected:d,shown:l,technical:n,view:i}){let[f,c]=w(!1),[m,h]=w(""),[C,g]=w(!1),[L,y]=w(()=>new Set),P=U(null),b=pe(),B=q(H=>{c(H),a(H)},[a]),R=q((H=!1)=>{B(!1),h(""),H&&P.current?.focus({preventScroll:!0})},[B]),$=q(H=>{H?.querySelector("[aria-current=true]")?.scrollIntoView({block:"nearest"})},[]),V=D(()=>[...l,...e].filter(H=>H.lifecycle?.kind==="running"&&H.id!==d.id),[e,d.id,l]),k=D(()=>Vr(i),[i]),M=m.trim()!=="",G=D(()=>io(i,fo(i,l,m,k)),[m,l,k,i]),S=D(()=>fo(i,e,m,k),[e,m,k,i]),Z=D(()=>io(i,S),[S,i]),K=C||M&&S.length>0,ie=q(H=>y(Le=>{let ae=new Set(Le);return ae.delete(H)||ae.add(H),ae}),[]),Q=(H,Le)=>{(Le?o:r)(H),R(!0)},fe=V.map(H=>`@${H.handle} is working`).join(", "),A=V.length>0?Ea(i,V[0].id):0,F={onToggle:ie,openByDefault:M,selectedId:d.id,summary:k,technical:n,toggled:L,view:i},_="px-1.5 py-1";return u(X,{children:[u("button",{"aria-controls":f?b:void 0,"aria-expanded":f,"aria-haspopup":"dialog",className:Ml,onClick:()=>B(!f),ref:P,title:`Addressee: @${d.handle}. Click to choose another actor`,type:"button",children:[t(co,{actor:d,className:"size-5",view:i}),u("span",{className:"truncate",children:["@",d.handle]}),t(Qe,{"aria-hidden":!0,className:"size-3 flex-none text-muted-foreground"})]}),V.length>0&&u("button",{className:Tl,onClick:()=>B(!f),title:fe,type:"button",children:[t(Ae,{"aria-hidden":!0,className:"size-3 flex-none"}),u("span",{className:"truncate in-data-[compact=true]:hidden",children:["@",V[0].handle]}),A>0&&t(se,{className:"h-4 min-w-4 px-1 text-[0.6rem]",variant:"secondary",children:A}),V.length>1&&u("span",{className:"flex-none",children:["+",V.length-1]})]}),f&&u(oa,{buttonRef:P,closeLabel:"Close addressee",height:460,id:b,label:"Addressee",onClose:R,open:!0,placement:"top",role:"dialog",width:"available",children:[l.length+e.length>Hr&&t("div",{className:"flex-none border-b border-border-soft px-2.5 py-1.5",children:t(te,{"aria-label":"Search actors",className:"h-7",onChange:H=>h(H.target.value),placeholder:"Search handle or task ...",type:"search",value:m})}),u("div",{className:"min-h-0 flex-1 overflow-auto overscroll-contain",ref:$,children:[t(dt,{className:_,nodes:G,onPick:H=>Q(H,!1),...F}),M&&G.length===0&&S.length===0&&t("p",{className:"px-3.5 py-2 text-muted-foreground",children:"No actor matches the search."}),e.length>0&&(!M||S.length>0)&&u("div",{className:"border-t border-border-soft",children:[u("button",{"aria-expanded":K,className:"flex w-full cursor-pointer items-center justify-between gap-2 px-3.5 py-2 text-left text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-2",onClick:()=>g(!K),type:"button",children:[u("span",{children:[e.length," hidden actors"]}),t(Qe,{"aria-hidden":!0,className:Y("size-3.5 flex-none transition-transform",K&&"rotate-180")})]}),K&&t(dt,{className:_,nodes:Z,onPick:H=>Q(H,!0),...F})]})]}),t("div",{className:"flex flex-none items-stretch border-t border-border-soft",children:t(ot,{runId:s})})]})]})}var mo=Object.freeze({sideWidth:900,openDelay:160,closeDelay:150}),xo="ragents.orchestration.run-panel-settings",ra=Object.freeze({sideWidth:{min:400,max:4e3},openDelay:{min:0,max:5e3},closeDelay:{min:0,max:1e4}}),po=(e,a)=>typeof e=="number"&&Number.isInteger(e)&&e>=a.min&&e<=a.max;function Bl(e){if(e===null)return mo;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||Object.keys(a).some(o=>!["sideWidth","openDelay","closeDelay"].includes(o))||!("sideWidth"in a)||!po(a.sideWidth,ra.sideWidth)||!("openDelay"in a)||!po(a.openDelay,ra.openDelay)||!("closeDelay"in a)||!po(a.closeDelay,ra.closeDelay))throw new Error("The run panel settings are invalid: width 400 to 4000 pixels, delays 0 to 5000 and 10000 milliseconds respectively, integers.");return a}var $r=ne({changeEvent:"ragents-run-panel-settings-change",matchesKey:e=>e===xo,parse:Bl,serialize:JSON.stringify});function ut(){return $r.useValue(xo)}function Kr(e){$r.save(xo,e)}var Dl=1500,Jr=e=>e.some(a=>a.role==="user"||a.role==="action"||a.role==="assistant"&&(a.text.trim()!==""||(a.attachments?.length??0)>0));function jr(e,a,o){let[r,s]=w(o),[d,l]=w(),n=a&&e?.kind==="working"?e:void 0,i=n?.title,f=n?.detail;return O(()=>{o&&s(!0)},[o]),O(()=>{if(i!==void 0&&f!==void 0){l({kind:"working",title:i,detail:f});return}let c=window.setTimeout(()=>l(void 0),Dl);return()=>window.clearTimeout(c)},[f,i]),o||r?void 0:e??d}var go=280,Yr=380,Fl=300,Nl=Object.freeze({element:null,actor:null,chat:"side",chatWidth:Yr,sheetExpandedHeight:null}),es=e=>`ragents.orchestration.run-panel:${e}`,Zr=e=>e===null||typeof e=="string",Qr=e=>e===void 0||e==="side"||e==="auto"?"side":e==="chat"?"chat":e==="bottom"||e==="floating"||e==="docked"?"bottom":void 0;function El(e){if(e===null)return Nl;let a=JSON.parse(e);if(!a||typeof a!="object"||Array.isArray(a)||Object.keys(a).some(r=>!["element","stageHeight","actor","chat","chatWidth","sheetExpandedHeight","sheetPeekExtra"].includes(r))||!("element"in a)||!Zr(a.element)||!("actor"in a)||!Zr(a.actor)||Qr("chat"in a?a.chat:void 0)===void 0||"chatWidth"in a&&(typeof a.chatWidth!="number"||!Number.isFinite(a.chatWidth)||a.chatWidth<go)||"sheetExpandedHeight"in a&&a.sheetExpandedHeight!==null&&(typeof a.sheetExpandedHeight!="number"||!Number.isFinite(a.sheetExpandedHeight)||a.sheetExpandedHeight<=0)||"sheetPeekExtra"in a&&(typeof a.sheetPeekExtra!="number"||!Number.isFinite(a.sheetPeekExtra)||a.sheetPeekExtra<0))throw new Error("The stored panel state is invalid.");let o=a;return{element:o.element,actor:o.actor,chat:Qr(o.chat)??"side",chatWidth:o.chatWidth??Yr,sheetExpandedHeight:o.sheetExpandedHeight??null}}var as=({chat:e,hasElement:a,narrow:o})=>!a||e==="chat"?"full":!o&&e==="side"?"side":"floating",ho=(e,a)=>Math.max(go,Math.min(Math.round(e),Math.max(go,a-Fl))),ts=ne({changeEvent:"ragents-run-panel-change",matchesKey:e=>e.startsWith("ragents.orchestration.run-panel:"),parse:El,serialize:JSON.stringify});function os(e){return ts.useValue(es(e))}function rs(e,a){ts.save(es(e),a)}var ss=(e,a=160)=>{let o=e.trim().split(/\r?\n/).find(r=>r.trim()!=="")??"";return o.length>a?`${o.slice(0,a-3)}...`:o},ls=(e,a)=>e.role==="user"?"You":e.sender??`@${a}`;function ds(e,a,o){let r=e[e.length-1],s=e.filter(l=>l.role==="action"&&l.action?.status===void 0).length;if(s>0)return{kind:"waiting",text:s===1?"Waiting for input":`Waiting for ${s} inputs`};if(a)return r?.role==="thinking"&&!r.closed?{kind:"working",text:`@${o} is thinking ...`}:r?.role==="tool"&&r.tool&&r.tool.result===void 0?{kind:"working",text:`@${o} is using ${r.tool.name} ...`}:r?.role==="assistant"&&!r.closed&&r.text.trim()!==""?{kind:"working",text:`${ls(r,o)} is answering: ${ss(r.text)}`}:{kind:"working",text:`@${o} is working ...`};let d=[...e].reverse().find(l=>(l.role==="user"||l.role==="assistant")&&l.text.trim()!=="");return d?{kind:"idle",text:`${ls(d,o)}: ${ss(d.text)}`}:{kind:"idle",text:"No messages yet."}}var ql=220,Ol="flex flex-none flex-wrap items-center gap-1.5 border-b border-border bg-shell px-2 py-1.5",Hl="flex h-7 max-w-[200px] flex-none cursor-pointer items-center gap-1.5 rounded-full border border-border bg-card pr-2 pl-1 text-[0.72rem] font-semibold text-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:outline-offset-1 aria-pressed:border-primary aria-pressed:bg-primary/10",Ul={full:"relative flex min-h-0 min-w-0 flex-1 flex-col",side:"relative flex min-h-0 min-w-0 flex-col",floating:"absolute inset-x-2.5 bottom-0 z-20 flex flex-col overflow-hidden rounded-t-2xl border border-b-0 border-border bg-card shadow-[0_-16px_60px_#00000080] transition-[height] duration-300 ease-[cubic-bezier(.32,.72,0,1)] motion-reduce:transition-none"},Vl="rounded-none border-0 bg-transparent",zl="aria-pressed:bg-accent aria-pressed:text-primary",Gl=[{Icon:ba,label:"Chat only",mode:"chat",title:"Chat only: the chat fills the run panel, the mini-app steps back"},{Icon:ka,label:"Chat at bottom",mode:"bottom",title:"Chat at bottom: the sheet over the mini-app"},{Icon:va,label:"Chat on right",mode:"side",title:"Chat on right: next to the mini-app"}];function us(e){return t(Wl,{...e},e.session.session.id)}function Wl({surfaceElements:e,cardSections:a,navigation:o,renderChat:r,session:s,toolbarContainer:d}){let l=s.session.id,n=W().can("runs.inspect"),i=rt(),f=j(s.runView),c=os(l),m=lo(l),h=U(null),C=U(null),g=U(null),L=U(null),[y,P]=w(c.chatWidth),[b,B]=w(0),[R,$]=w(!1),V=ut();O(()=>P(c.chatWidth),[c.chatWidth]),O(()=>{let v=h.current;if(!v)return;let re=new ResizeObserver(([Ce])=>B(Ce.contentRect.width));return re.observe(v),()=>re.disconnect()},[]);let k=q(v=>rs(l,{...c,...v}),[l,c]),M=D(()=>e.flatMap(({Element:v,select:re})=>re(s).filter(Ce=>Ce.visible!==!1).map(Ce=>({Element:v,definition:Ce}))),[e,s]),G=M.find(v=>v.definition.id===c.element)??M[0],S=jr(ja({view:f,startup:s.startup,connected:s.connected,running:s.running,error:s.conversationError}),s.connected,M.length>0||Jr(s.messages)),Z=S?t(Yl,{state:S}):void 0,K=D(()=>f?Er(f,n):[],[n,f]),ie=Na(l),Q=Ya(l),fe=D(()=>new Set(M.flatMap(({definition:v})=>v.anchorActorId?[v.anchorActorId]:[])),[M]),A=f?we(f):void 0,F=K.find(v=>v.id===c.actor)??K.find(v=>v.id===A)??K[0],{shown:_,hidden:H}=D(()=>qr(K,{mode:ie,primaryId:A,selectedId:F?.id,onStage:v=>v.id===A||ta(v,fe,Q,A)}),[K,fe,ie,Q,A,F?.id]),Le=()=>h.current?.clientWidth??Number.POSITIVE_INFINITY,ae=q(v=>k({actor:v.id}),[k]),sa=q(v=>{et(l,{...Q,actorVisibility:{...Q.actorVisibility,[v.id]:!0}}),k({actor:v.id})},[Q,l,k]),Oa=q(v=>{let re=v.type==="actor"?K.find(Ce=>Ce.id===v.id):void 0;re&&ae(re)},[K,ae]),be=F===void 0||F.id===A,I=b<V.sideWidth,x=as({chat:c.chat,hasElement:G!==void 0,narrow:I}),T=Xl(x==="floating",C,g,R,V.openDelay),N=$l(x==="floating",C,g,L,F?.id),ue=Math.max(N.minimum,Math.min(c.sheetExpandedHeight??N.maximum,N.maximum)),J=Kl(x==="floating",C,g,T,N,ue,v=>k({sheetExpandedHeight:Math.round(v)})),ce=U(null);O(()=>{if(x!=="floating"||!T.expanded)return;let v=ce.current;if(!v)return;let re=()=>{v.scrollTop=v.scrollHeight};re();let Ce=window.setTimeout(re,320);return()=>window.clearTimeout(Ce)},[x,T.expanded]);let ke=D(()=>{if(x!=="floating"||!F)return;let v=be?s.messages:s.actorConversations?.[F.id]??[],re=be?s.connected&&(s.running||Vt(s.runView,l)):F.lifecycle?.kind==="running";return ds(v,re,F.handle)},[x,be,l,F,s.actorConversations,s.connected,s.messages,s.runView,s.running]),la=f&&F&&t(Xr,{hidden:H,onOpenChange:$,onReveal:sa,onSelect:ae,runId:l,selected:F,shown:_,technical:n,view:f}),Ie=G&&d&&na(t(_l,{narrow:I,onChange:v=>k({chat:v}),selected:c.chat,sideWidth:V.sideWidth}),d),ys=be||!f||!F?r({chatElementClassName:Vl,chatScrollerRef:v=>{ce.current=v},notice:Z,toolbarLeft:la}):t(Ql,{actor:F,cardSections:a,navigation:o,notice:Z,onNavigate:Oa,session:s,toolbarLeft:la,view:f});return u("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-app","data-run-panel":"run",ref:h,children:[Ie,x!=="full"&&M.length>1&&t("nav",{"aria-label":"Mini-apps of the run",className:Ol,children:M.map(({definition:v})=>t(Jl,{centered:m.has(v.id),definition:v,onSelect:()=>m.has(v.id)?i.openInCenter(l,v.id,v.title??v.id):k({element:v.id}),selected:v.id===G?.definition.id,session:s,view:f},v.id))}),u("div",{className:Y("relative min-h-0 min-w-0 flex-1",x==="side"?"grid":"flex flex-col"),"data-chat-layout":x,style:x==="side"?{gridTemplateColumns:`minmax(0,1fr) auto ${y}px`}:void 0,children:[x!=="full"&&G&&t(jl,{centered:m.has(G.definition.id),element:G,navigation:o,peek:x==="floating"?N.minimum:0,runId:l,session:s}),x==="side"&&t(Zl,{onChange:v=>P(ho(v,Le())),onCommit:v=>k({chatWidth:ho(v,Le())}),value:y}),x==="floating"&&t("div",{"aria-hidden":!0,className:"absolute inset-0 z-[15] bg-backdrop opacity-0 transition-opacity duration-300 pointer-events-none data-expanded:pointer-events-auto data-expanded:opacity-100 motion-reduce:transition-none","data-expanded":T.expanded||void 0,onClick:T.close}),u("section",{"aria-label":"Chat",className:Y(Ul[x],x==="floating"&&"[&_[data-chat=composer]]:[--qsl-panel-height:var(--sheet-available-height)] [&:not([data-expanded])_[data-slot=card-sections]]:hidden [&[data-sheet-resizing]_[data-slot=card-sections]]:hidden"),"data-expanded":x==="floating"&&T.expanded?!0:void 0,"data-sheet-resizing":J.height!==void 0||void 0,"data-view":be?"chat":"actor-chat",onBlurCapture:x==="floating"?()=>T.closeLater(ql):void 0,onFocusCapture:x==="floating"?v=>{v.target!==g.current&&T.open()}:void 0,onPointerEnter:x==="floating"?v=>{v.pointerType==="mouse"&&T.openLater()}:void 0,onPointerLeave:x==="floating"?()=>T.closeLater(V.closeDelay):void 0,ref:C,style:x==="floating"?{height:J.height??(T.expanded?ue:N.minimum),transition:J.height!==void 0?"none":void 0,"--sheet-available-height":`${N.available}px`}:void 0,children:[x==="floating"&&t("button",{"aria-expanded":T.expanded,"aria-label":"Height of the expanded chat","aria-orientation":"horizontal","aria-valuemin":N.minimum,"aria-valuemax":N.maximum,"aria-valuenow":Math.round(J.height??ue),className:"flex h-3 w-full flex-none cursor-row-resize touch-none items-center justify-center outline-none select-none [&:hover>span]:bg-foreground [&:focus-visible>span]:bg-foreground [&:focus-visible>span]:ring-2 [&:focus-visible>span]:ring-ring/60","data-run-panel":"sheet-grip",onClick:J.onClick,onKeyDown:J.onKeyDown,onPointerDown:J.onPointerDown,onPointerMove:J.onPointerMove,onPointerUp:J.onPointerUp,onPointerCancel:J.onPointerCancel,onLostPointerCapture:J.onPointerCancel,ref:g,role:"separator",title:`Drag: set the expanded height. Click: ${T.expanded?"lower chat":"raise chat"}.`,type:"button",children:t("span",{"aria-hidden":!0,className:"h-1 w-9 rounded-full bg-border-strong transition-colors"})}),ke&&u("button",{className:Y("flex h-6 w-full flex-none cursor-pointer items-center gap-2 px-[var(--qsl-chat-horizontal-padding,24px)] text-left text-[0.7rem] transition-opacity duration-200 in-data-expanded:pointer-events-none in-data-expanded:opacity-0 motion-reduce:transition-none",ke.kind==="waiting"?"text-warning":"text-muted-foreground"),onClick:T.toggle,ref:L,title:ke.text,type:"button",children:[ke.kind==="working"&&t(Ae,{"aria-hidden":!0,className:"size-3 flex-none"}),t("span",{className:"truncate",children:ke.text})]}),ys]})]})]})}function _l({narrow:e,onChange:a,selected:o,sideWidth:r}){return t("div",{"aria-label":"Run panel view",className:"flex flex-none items-center gap-0.5 self-center rounded-lg border border-border bg-card p-0.5",role:"group",children:Gl.map(({Icon:s,label:d,mode:l,title:n})=>{let i=l==="side"&&e;return t(z,{"aria-label":d,"aria-pressed":o===l,className:zl,disabled:i,onClick:()=>a(l),size:"icon-sm",title:i?`Chat stays at the bottom while the panel is narrower than ${r} pixels`:n,variant:"ghost",children:t(s,{})},l)})})}function Xl(e,a,o,r,s){let[d,l]=w(!1),[n,i]=w(!1),f=U({held:n,blocked:r}),c=U(!1),m=U(void 0);O(()=>{f.current={held:n,blocked:r}},[r,n]);let h=q(()=>window.clearTimeout(m.current),[]),C=q(()=>{c.current||(h(),l(!0))},[h]),g=q(()=>{c.current||(h(),m.current=window.setTimeout(()=>{c.current||l(!0)},s))},[h,s]),L=q(R=>{c.current||(h(),m.current=window.setTimeout(()=>{c.current||f.current.held||f.current.blocked||document.activeElement!==o.current&&a.current?.contains(document.activeElement)||l(!1)},R))},[h,o,a]),y=q(()=>{h(),i(!1),l(!1),document.activeElement instanceof HTMLElement&&a.current?.contains(document.activeElement)&&document.activeElement.blur()},[h,a]),P=q(()=>{if(d){y();return}i(!0),C()},[y,d,C]),b=q(()=>{h(),c.current=!0},[h]),B=q(R=>{h(),c.current=!1,l(R?.expanded??!1),i(R?.held??!1)},[h]);return O(()=>{e||y()},[e,y]),O(()=>h,[h]),O(()=>{if(!e||!d)return;let R=$=>{$.key==="Escape"&&!c.current&&!f.current.blocked&&y()};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[e,y,d]),{expanded:d,held:n,open:C,openLater:g,closeLater:L,close:y,toggle:P,pauseResize:b,finishResize:B}}function $l(e,a,o,r,s){let[d,l]=w({minimum:0,maximum:0,available:0,scale:1});return We(()=>{if(!e)return;let n=a.current,i=o.current,f=r.current,c=n?.querySelector('[data-chat="composer"]'),m=n?.parentElement;if(!n||!i||!c||!m)throw new Error("The panel sheet cannot find the grip, input or frame.");let h=()=>{let g=getComputedStyle(n),L=n.getBoundingClientRect().width;if(L===0)return;let y=L/Number.parseFloat(g.width),P=Math.ceil((i.getBoundingClientRect().height+(f?.getBoundingClientRect().height??0)+c.getBoundingClientRect().height)/y+Number.parseFloat(g.borderTopWidth)+Number.parseFloat(g.borderBottomWidth)),b=Math.floor(m.getBoundingClientRect().height/y*.9),B=Math.max(P,b);l(R=>R.minimum===P&&R.maximum===B&&R.available===b&&R.scale===y?R:{minimum:P,maximum:B,available:b,scale:y})},C=new ResizeObserver(h);return C.observe(c),C.observe(i),C.observe(m),f&&C.observe(f),h(),()=>C.disconnect()},[e,s,o,a,r]),d}function Kl(e,a,o,r,s,d,l){let[n,i]=w(),f=U(void 0),c=U(!1),m=g=>{let L=f.current;if(!L)return;f.current=void 0,c.current=L.moved||!g;let y=o.current;y?.hasPointerCapture(L.pointerId)&&y.releasePointerCapture(L.pointerId),g&&L.moved&&l(L.height),r.finishResize(g&&L.moved?{expanded:!0,held:L.held}:L),i(void 0)},h=r.finishResize;O(()=>{e||(f.current=void 0,i(void 0),h())},[e,h]);let C=g=>Math.max(s.minimum,Math.min(g,s.maximum));return{height:n,onClick:g=>{let L=c.current&&g.detail>0;c.current=!1,!L&&r.toggle()},onPointerDown:g=>{if(g.button!==0||f.current||!a.current)return;g.preventDefault();let L=a.current.getBoundingClientRect().height/s.scale;f.current={pointerId:g.pointerId,startY:g.clientY,startHeight:L,height:L,moved:!1,expanded:r.expanded,held:r.held},c.current=!1,r.pauseResize(),i(L),g.currentTarget.setPointerCapture(g.pointerId),g.currentTarget.focus({preventScroll:!0})},onPointerMove:g=>{let L=f.current;if(!L||L.pointerId!==g.pointerId)return;let y=(L.startY-g.clientY)/s.scale;!L.moved&&Math.abs(y)<3||(L.moved=!0,L.height=C(L.startHeight+y),i(L.height))},onPointerUp:g=>{f.current?.pointerId===g.pointerId&&m(!0)},onPointerCancel:g=>{f.current?.pointerId===g.pointerId&&m(!1)},onKeyDown:g=>{if(g.key==="Escape"&&f.current){g.preventDefault(),g.stopPropagation(),m(!1);return}let L=g.key==="ArrowUp"?d+24:g.key==="ArrowDown"?d-24:g.key==="Home"?s.minimum:g.key==="End"?s.maximum:void 0;L===void 0||f.current||(g.preventDefault(),r.finishResize({expanded:!0,held:r.held}),l(C(L)))}}}function Jl({centered:e,definition:a,onSelect:o,selected:r,session:s,view:d}){let l=da(),n=a.title??a.id,i=Or(d,a,l?.needsAnswer(s,a.id)??!1);return u("button",{"aria-pressed":r&&!e,className:Hl,"data-tone":"app",onClick:o,title:e?`${n} is in the center. Click brings the window to the front.`:`Show mini-app ${n}`,type:"button",children:[t("span",{className:"grid size-5 flex-none place-items-center rounded-full bg-glass-app text-foreground [&>svg]:size-3",children:t(Oe,{})}),t("span",{className:"truncate",children:n}),i&&t("span",{"aria-label":"Answer expected",className:"grid size-4 flex-none place-items-center rounded-full bg-warning text-[0.62rem] font-bold text-background",role:"img",children:"!"}),e&&t(Ze,{"aria-hidden":!0,className:"size-3 flex-none text-muted-foreground"})]})}function jl({centered:e,element:a,navigation:o,peek:r,runId:s,session:d}){let l=rt(),n=da(),{Element:i,definition:f}=a,c=f.title??f.id;return u("section",{"aria-label":`Mini-app ${c}`,className:"group/stage relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-app",style:r>0?{paddingBottom:r}:void 0,children:[t("div",{className:"absolute top-1.5 right-2 z-[5] flex gap-0.5 rounded-lg border border-border bg-card p-0.5 opacity-0 transition-opacity group-hover/stage:opacity-100 group-focus-within/stage:opacity-100 motion-reduce:transition-none",children:l.kind==="vscode"?t(z,{"aria-label":`Move ${c} to the center`,onClick:()=>l.openInCenter(s,f.id,c),size:"icon-sm",title:"Move to the center",variant:"ghost",children:t(Ze,{})}):n&&t(z,{"aria-label":`Open ${c} in full view`,onClick:()=>n.openFullscreen(f.id),size:"icon-sm",title:"Full view",variant:"ghost",children:t(ya,{})})}),t("div",{className:"relative flex min-h-0 flex-1 flex-col","data-run-panel":"stage",children:e?u("div",{className:"m-auto grid gap-3 p-4 text-center text-[0.76rem] text-muted-foreground",role:"status",children:[u("span",{children:[c," is in the center."]}),t(z,{onClick:()=>l.returnToRunPanel(s,f.id),size:"sm",variant:"outline",children:"Back to panel"})]}):t(i,{definition:f,navigation:o,session:d})})]})}function Zl({onChange:e,onCommit:a,value:o}){let r=U(void 0),s=d=>{r.current&&(r.current=void 0,d.currentTarget.releasePointerCapture(d.pointerId),a(o))};return t("div",{"aria-label":"Chat width","aria-orientation":"vertical","aria-valuenow":o,className:"flex w-2.5 flex-none cursor-col-resize touch-none items-center justify-center border-r border-l border-border bg-shell select-none hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring/60 focus-visible:-outline-offset-2",onKeyDown:d=>{let l=d.key==="ArrowRight"?-24:d.key==="ArrowLeft"?24:0;l!==0&&(d.preventDefault(),e(o+l),a(o+l))},onPointerCancel:s,onPointerDown:d=>{r.current={startX:d.clientX,startWidth:o},d.currentTarget.setPointerCapture(d.pointerId)},onPointerMove:d=>{r.current&&e(r.current.startWidth+r.current.startX-d.clientX)},onPointerUp:s,role:"separator",tabIndex:0,children:t("span",{"aria-hidden":!0,className:"h-10 w-1 rounded-full bg-border-strong"})})}function Ql({actor:e,cardSections:a,navigation:o,notice:r,onNavigate:s,session:d,toolbarLeft:l,view:n}){let i=e.lifecycle?.kind==="running";return u("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[t("div",{className:`${Xa} max-h-[40%] flex-none overflow-auto overscroll-contain border-t-0 border-b`,"data-slot":"card-sections",children:a.map(({id:f,Section:c})=>t(c,{actor:e,navigation:o,session:d},f))}),t(ma,{className:"flex-1",composer:t(je,{actor:e,presentation:"panel",running:i,display:"panel",toolbarLeft:l,view:n}),children:r??t(Je,{actor:e,conversation:d.actorConversations?.[e.id],historyError:d.conversationError,onNavigate:s,presentation:"inspector",primaryMessages:d.messages,running:i,display:"panel",view:n})})]})}function Yl({state:e}){return t("div",{className:"grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)_auto_minmax(var(--qsl-composer-height,0px),1fr)] justify-items-center overflow-hidden p-6",children:t(pa,{className:"row-start-2",state:e})})}var ed=(e,a)=>{if(!e.revealEntity({type:"artifact",id:a.id}))throw new Error(`No plugin can show the document ${a.title}`)};function ns({actor:e,navigation:a,session:o}){let r=j(o.runView);if(!r)return null;let s=_t(e).id,d=r.artifacts.filter(l=>l.createdBy===s);return d.length===0?null:u("section",{className:"grid gap-1.5",children:[u(It,{children:[t("span",{children:"Documents"}),t("small",{children:d.length})]}),t("ul",{className:"grid list-none gap-1",children:d.map(l=>t("li",{children:u("button",{className:"grid w-full cursor-pointer rounded-lg border border-border-soft px-2 py-1.5 text-left hover:border-[color-mix(in_srgb,var(--primary)_45%,var(--border))] hover:bg-primary/6",onClick:()=>ed(a,l),type:"button",children:[t("strong",{className:"truncate text-[0.74rem]",title:l.title,children:l.title}),u("small",{className:"text-[0.64rem] text-muted-foreground",children:[Ue(l.size)," - ",l.mediaType]})]})},l.id))})]})}var is=e=>({sideWidth:String(e.sideWidth),openDelay:String(e.openDelay),closeDelay:String(e.closeDelay)}),ad=[{key:"sideWidth",label:"Chat next to the mini-app from",unit:"px"},{key:"openDelay",label:"Slide up after",unit:"ms"},{key:"closeDelay",label:"Slide back after leaving after",unit:"ms"}];function fs(){let e=W(),a=ut(),[o,r]=w(()=>is(a)),[s,d]=w(),[l,n]=w();O(()=>{r(is(a))},[a]);let i=e.can("settings.write"),f=c=>{if(i){n(void 0),d(void 0);try{Kr(c),d("Run panel settings saved.")}catch(m){n(m instanceof Error?m.message:String(m))}}};return u("form",{className:"grid gap-3",onSubmit:c=>{c.preventDefault(),f({sideWidth:Number(o.sideWidth),openDelay:Number(o.openDelay),closeDelay:Number(o.closeDelay)})},children:[t("p",{className:"text-muted-foreground",children:"From this panel width on, the chat sits to the right of the mini-app instead of as a sheet below it. The delays determine how long the mouse must rest over the sheet until it slides up, and how long it stays up after leaving. Applies immediately to all runs in this browser."}),u("div",{className:"flex flex-wrap items-end gap-3",children:[ad.map(({key:c,label:m,unit:h})=>u("label",{className:"grid gap-1.5",children:[u("span",{children:[m," (",h,")"]}),t(te,{className:"w-[130px]",disabled:!i,max:ra[c].max,min:ra[c].min,onChange:C=>{r({...o,[c]:C.target.value}),d(void 0)},required:!0,step:"1",type:"number",value:o[c]})]},c)),t(z,{disabled:!i,type:"submit",children:"Save"}),t(z,{disabled:!i,onClick:()=>f(mo),variant:"outline",children:"Reset"})]}),l?t("p",{className:"text-muted-foreground",role:"alert",children:l}):s&&t("p",{className:"text-muted-foreground",role:"status",children:s})]})}function cs({session:e}){let[a,o]=w(!1),[r,s]=w([]),[d,l]=w(),[n,i]=w(!1),[f,c]=w(0),[m,h]=w(""),[C,g]=w(100),L=U(null),y=U(null),P=pe(),b=j(e.runView),B=b?.revision,R=q((k=!1)=>{o(!1),k&&L.current?.focus({preventScroll:!0})},[]);O(()=>{if(!a)return;let k=new AbortController;return i(!0),l(void 0),he.call(me.events,{runId:e.session.id},{signal:k.signal}).then(M=>{k.signal.aborted||s(M)}).catch(M=>{k.signal.aborted||l(M instanceof Error?M.message:String(M))}).finally(()=>{k.signal.aborted||i(!1)}),()=>k.abort()},[a,e.session.id,B,f]);let $=D(()=>{let k=m.trim().toLocaleLowerCase("en-US"),M=new Map(b?.actors.map(G=>[G.id,G.handle]));return[...r].reverse().filter(G=>!k||`${M.get(G.actorId)??""} ${JSON.stringify(G)}`.toLocaleLowerCase("en-US").includes(k))},[r,m,b?.actors]),V=new Map(b?.actors.map(k=>[k.id,k.handle]));return u("div",{className:"flex h-full min-w-0 items-stretch",children:[t("button",{"aria-controls":P,"aria-expanded":a,className:_a,onClick:()=>o(k=>!k),ref:L,type:"button",children:"Journal"}),t(fa,{open:a,onOpenChange:k=>{k||R()},children:u(ca,{align:"start",anchor:L,"aria-label":"Journal of the run",className:"flex min-h-0 min-w-0 flex-col gap-0 overflow-hidden rounded-t-sm rounded-b-none p-0 text-[0.76rem]",collisionPadding:8,id:P,initialFocus:y,role:"region",side:"top",style:{width:"min(900px, var(--available-width))",height:"min(480px, var(--available-height))"},children:[u("header",{className:"flex flex-none items-center gap-2 border-b border-border-soft px-2.5 py-2",children:[u("div",{className:"flex min-w-0 flex-1 items-baseline gap-2.5 [&>span]:truncate",children:[t("strong",{children:"Journal"}),t("span",{className:"text-muted-foreground",children:e.session.title||"Run"})]}),t(z,{onClick:()=>c(k=>k+1),size:"sm",variant:"ghost",children:"Refresh"}),t(z,{"aria-label":"Close journal",onClick:()=>R(!0),size:"icon-sm",title:"Close journal",variant:"ghost",children:t(ge,{})})]}),u("div",{className:"flex flex-none items-center gap-3 px-2.5 py-2",children:[t(te,{className:"flex-1","aria-label":"Search journal",onChange:k=>{h(k.target.value),g(100)},placeholder:"Search event type, actor or content ...",ref:y,type:"search",value:m}),t("span",{className:"flex-none whitespace-nowrap text-[0.68rem] text-muted-foreground",role:"status",children:n?"Loading ...":`${$.length} events`})]}),d&&t("p",{className:"flex-none px-2.5 pb-2 text-destructive",role:"alert",children:d}),u("div",{"aria-label":"Journal events, newest first",className:"min-h-0 flex-1 overflow-auto overscroll-contain px-2.5 pb-2.5",children:[!n&&!d&&$.length===0&&t("p",{className:"text-muted-foreground",children:m?"No matching events.":"The journal contains no events yet."}),$.slice(0,C).map(k=>t(td,{actor:V.get(k.actorId),event:k},k.eventId)),$.length>C&&t(z,{onClick:()=>g(k=>k+100),size:"sm",variant:"outline",children:"Show more events"})]})]})})]})}function td({actor:e,event:a}){let[o,r]=w(!1);return u("details",{className:"border-b border-border-soft open:[&>summary]:text-primary",onToggle:s=>r(s.currentTarget.open),children:[u("summary",{className:"grid cursor-pointer grid-cols-[32px_minmax(130px,1fr)_minmax(70px,140px)_auto] items-baseline gap-2 px-0.5 py-2 text-[0.68rem] focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2 max-[550px]:grid-cols-[24px_minmax(0,1fr)_auto] max-[550px]:gap-x-2 max-[550px]:gap-y-1",children:[t("span",{className:"text-muted-foreground tabular-nums",children:a.sequence}),t("span",{className:"font-mono [overflow-wrap:anywhere]",children:a.type}),t("span",{className:"truncate max-[550px]:col-start-2 max-[550px]:row-start-2",title:a.actorId,children:e?`@${e}`:a.actorId}),t("time",{className:"text-muted-foreground tabular-nums max-[550px]:col-start-3 max-[550px]:row-start-1",dateTime:a.occurredAt,children:new Date(a.occurredAt).toLocaleTimeString("en-US")})]}),o&&t(Me,{className:"m-0 mb-2 text-[0.68rem]",content:JSON.stringify(a,null,2),language:"json",path:"event.json"})]})}var od="Emergency stop by the operator";function ps({session:e}){return t(Ne,{className:"max-w-none",children:t(rd,{runId:e.session.id},e.session.id)})}function rd({runId:e}){let a=W().can("runs.write"),[o,r]=w(!1),[s,d]=w(!1),[l,n]=w(),i=async()=>{d(!0),n(void 0);try{await ur(e,od),r(!1)}catch(f){n(f instanceof Error?f.message:String(f))}finally{d(!1)}};return a?o?u("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap",children:[t("span",{className:"text-[0.72rem] font-semibold text-destructive",children:"Really stop everything?"}),t(z,{disabled:s,onClick:()=>{i()},size:"sm",variant:"destructive",children:"Yes"}),t(z,{disabled:s,onClick:()=>r(!1),size:"sm",variant:"outline",children:"Cancel"}),l&&t("span",{className:"max-w-[260px] truncate text-[0.7rem] text-destructive",title:l,children:l})]}):u(z,{onClick:()=>r(!0),size:"sm",title:"Ends the whole run: turns, agents and flows",variant:"destructive",children:[t(kt,{"data-icon":"inline-start"}),"Stop run"]}):null}var nt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),sd=(e,a,o)=>JSON.stringify([e,a,o]),ms=(e,a)=>{if(!Array.isArray(e)||e.some(o=>{if(!nt(o)||o.runId!==a||typeof o.eventId!="string"||typeof o.actorId!="string"||!Number.isSafeInteger(o.sequence)||typeof o.occurredAt!="string"||!Number.isFinite(Date.parse(o.occurredAt))||typeof o.type!="string"||!nt(o.payload))return!0;let r=o.payload;return o.type.startsWith("tool.call.")&&(typeof r.turnId!="string"||typeof r.toolCallId!="string")?!0:o.type==="tool.call.source"?typeof r.code!="string"||r.path!==null&&typeof r.path!="string":o.type==="tool.call.started"?typeof r.name!="string"||!("input"in r):o.type==="tool.call.completed"?typeof r.name!="string"||!("output"in r):o.type==="tool.call.failed"?typeof r.name!="string"||typeof r.error!="string":o.type==="turn.finished"?typeof r.turnId!="string"||!["completed","failed"].includes(String(r.outcome)):o.type==="turn.interrupted"?typeof r.turnId!="string"||typeof r.reason!="string":!1}))throw new Error("The server did not deliver a valid journal for this run.");return e},xs=(e,a)=>{let o=new Map,r=new Map(a?.actors.map(l=>[l.id,l])),s=new Map;for(let l of[...e].sort((n,i)=>n.sequence-i.sequence)){if(a&&l.runId!==a.id)continue;if(l.type==="turn.finished"||l.type==="turn.interrupted"){s.set(JSON.stringify([l.actorId,l.payload.turnId]),{at:l.occurredAt,reason:"reason"in l.payload?l.payload.reason:null});continue}if(l.type!=="tool.call.started"&&l.type!=="tool.call.completed"&&l.type!=="tool.call.failed"&&l.type!=="tool.call.source")continue;let n=sd(l.actorId,l.payload.turnId,l.payload.toolCallId);if(l.type==="tool.call.started"){if(l.payload.name!=="typescript_eval"||o.has(n))continue;let f=r.get(l.actorId),c=nt(l.payload.input)?l.payload.input:{};o.set(n,{key:n,actorId:l.actorId,actorHandle:f?.handle??l.actorId,actorName:f?.displayName??l.actorId,turnId:l.payload.turnId,toolCallId:l.payload.toolCallId,sequence:l.sequence,startedAt:l.occurredAt,finishedAt:null,status:"running",code:typeof c.code=="string"?c.code:null,path:typeof c.path=="string"?c.path:null,result:void 0,logs:[],error:null});continue}let i=o.get(n);if(i)if(l.type==="tool.call.source")i.code=l.payload.code,i.path=l.payload.path;else if(l.type==="tool.call.completed"){i.status="completed",i.finishedAt=l.occurredAt;let f=l.payload.output,c=nt(f)&&"result"in f&&Array.isArray(f.logs)&&f.logs.every(m=>typeof m=="string");i.result=c?f.result:f,i.logs=c?f.logs:[]}else i.status="failed",i.finishedAt=l.occurredAt,i.error=l.payload.error}let d=new Map(a?.turns.map(l=>[JSON.stringify([l.actorId,l.id]),l]));for(let l of o.values()){if(l.status!=="running")continue;let n=JSON.stringify([l.actorId,l.turnId]),i=d.get(n),f=i?.toolCalls?.find(m=>m.id===l.toolCallId&&m.name==="typescript_eval"),c=s.get(n);f&&f.status!=="running"?(l.status=f.status,l.finishedAt=f.finishedAt??i?.finishedAt??c?.at??null):(c||i&&i.status!=="running")&&(l.status="interrupted",l.finishedAt=c?.at??i?.finishedAt??null),l.status==="interrupted"&&(l.error=c?.reason??i?.reason??"The call was interrupted.")}return[...o.values()].sort((l,n)=>n.sequence-l.sequence)},it=e=>({running:"Running",completed:"Completed",failed:"Failed",interrupted:"Interrupted"})[e],gs=(e,a,o)=>{let r=a.trim().toLocaleLowerCase("en-US");return e.filter(s=>(o==="all"||s.status===o)&&(!r||[s.actorId,s.actorHandle,s.actorName,s.code,s.path,JSON.stringify(s.result),...s.logs,s.error,it(s.status)].join(`
|
|
7
|
+
`).toLocaleLowerCase("en-US").includes(r)))},hs=(e,a)=>{let o=Math.max(0,(e.finishedAt?Date.parse(e.finishedAt):a)-Date.parse(e.startedAt));if(!Number.isFinite(o))return"Duration unknown";if(o<1e3)return`${o} ms`;let r=Math.floor(o/1e3);return r<60?`${r} s`:`${Math.floor(r/60)} min ${r%60} s`};var Cs="ragents.orchestration.executions";function Ss({active:e,session:a}){let o=j(a.runView),r=a.session.id;return t(ld,{active:e,runId:r,view:o?.id===r?o:void 0},r)}function ld({active:e,runId:a,view:o}){let[r,s]=w({events:[],loaded:!1,loading:!1,error:null}),[d,l]=w(""),[n,i]=w("all"),f=[{value:"all",label:"All statuses"},...["running","completed","failed","interrupted"].map(b=>({value:b,label:it(b)}))],[c,m]=w(Date.now),[h,C]=w(0),g=o?.revision;O(()=>{if(!e)return;let b=new AbortController;return s(B=>({...B,loading:!0,error:null})),he.call(me.events,{runId:a},{signal:b.signal}).then(B=>{let R=ms(B,a);b.signal.aborted||s({events:R,loaded:!0,loading:!1,error:null})}).catch(B=>{b.signal.aborted||s(R=>({...R,loading:!1,error:B instanceof Error?B.message:String(B)}))}),()=>b.abort()},[e,a,g,h]);let L=D(()=>xs(r.events,o),[r.events,o]),y=D(()=>gs(L,d,n),[L,d,n]),P=L.some(b=>b.status==="running");return O(()=>{if(!e||!P)return;m(Date.now());let b=window.setInterval(()=>m(Date.now()),1e3);return()=>window.clearInterval(b)},[e,P]),u("section",{"aria-label":"TypeScript executions",className:"flex h-full min-h-0 min-w-0 flex-col bg-background text-[0.78rem] text-foreground",children:[u("header",{className:"px-3.5 pt-3.5 pb-2.5",children:[t("h2",{className:"mb-1.5 text-[0.92rem]",children:"Executions"}),t("p",{className:"leading-[1.5] text-muted-foreground",children:"TypeScript snippets of all actors in this run."})]}),u("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2 border-b border-border-soft px-3.5 pb-3",children:[t(te,{className:"col-span-full","aria-label":"Search executions",onChange:b=>l(b.target.value),placeholder:"Search actor, code or result",type:"search",value:d}),u(Ct,{items:f,value:n,onValueChange:b=>{b!==null&&i(b)},children:[t(yt,{className:"min-w-0","aria-label":"Execution status",children:t(bt,{})}),t(St,{children:f.map(b=>t(wt,{value:b.value,children:b.label},b.value))})]}),t("span",{className:"self-center text-right text-[0.68rem] text-muted-foreground",role:"status",children:r.loading?r.loaded?"Refreshing ...":"Loading ...":r.loaded?`${y.length} of ${L.length} executions`:"Not loaded yet"})]}),r.error&&u(ht,{className:"mx-3.5 my-2 w-auto",variant:"destructive",children:[u(Lt,{className:"whitespace-pre-wrap text-destructive [overflow-wrap:anywhere]",children:[r.error,r.loaded?" The last loaded state stays visible.":""]}),t(z,{disabled:!e||r.loading,onClick:()=>C(b=>b+1),size:"sm",variant:"ghost",children:"Reload"})]}),u("div",{"aria-label":"Executions, newest first",className:"min-h-0 flex-1 overflow-auto overscroll-contain px-3 pb-3",children:[r.loaded&&!r.loading&&y.length===0&&t("p",{className:"mx-0.5 my-4.5 leading-[1.6] text-muted-foreground",children:L.length===0?"No TypeScript snippet has been executed in this run yet.":"No executions match this search."}),y.map(b=>t(id,{execution:b,now:c},b.key))]})]})}var dd={running:"bg-background text-info",completed:"bg-success-soft text-success",failed:"bg-destructive-soft text-destructive",interrupted:"bg-warning-soft text-warning"},ud="relative grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] gap-x-2 gap-y-[7px] pt-3 pr-2.5 pb-2.5 pl-[25px] focus-visible:outline-2 focus-visible:outline-primary focus-visible:-outline-offset-2 [&::-webkit-details-marker]:hidden before:absolute before:top-[15px] before:left-2.5 before:size-[5px] before:rotate-[-45deg] before:border-r-[1.5px] before:border-b-[1.5px] before:border-solid before:border-current before:content-['']",nd="min-w-0 border-t border-border-soft px-2.5 pb-2.5 [&>h3]:mt-3 [&>h3]:mb-1.5 [&>h3]:text-[0.72rem] [&>h3]:font-[650]",Ls="m-0 max-h-[28rem] overflow-auto text-[0.68rem]",Is="m-0 max-h-[24rem] overflow-auto rounded-sm bg-background p-2 font-mono text-[0.68rem] leading-[1.5] whitespace-pre-wrap [overflow-wrap:anywhere]";function id({execution:e,now:a}){let[o,r]=w(!1),s=e.code?.trim().split(`
|
|
8
|
+
`).find(d=>d.trim())??e.path??"TypeScript snippet";return u("details",{className:"mt-2.5 overflow-hidden rounded-sm border border-border-soft bg-card open:[&>summary]:before:rotate-45",onToggle:d=>r(d.currentTarget.open),children:[u("summary",{className:ud,children:[u("span",{className:"truncate font-[650]",title:`${e.actorName} (${e.actorId})`,children:["@",e.actorHandle]}),t(se,{className:`h-auto rounded-[5px] px-[5px] py-0.5 text-[0.64rem] ${dd[e.status]??"bg-secondary text-muted-foreground"}`,children:it(e.status)}),t("span",{className:"col-span-full truncate font-mono text-[0.68rem]",title:s,children:s}),u("span",{className:"col-span-full flex flex-wrap justify-between gap-x-3 gap-y-1.5 text-[0.65rem] tabular-nums text-muted-foreground",children:[t("time",{dateTime:e.startedAt,title:new Date(e.startedAt).toLocaleString("en-US"),children:new Date(e.startedAt).toLocaleString("en-US",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t("span",{children:hs(e,a)})]})]}),o&&u("div",{className:nd,children:[e.path&&u("p",{className:"mt-2.5 grid gap-1 text-[0.68rem] text-muted-foreground",children:[t("span",{children:"Path"}),t("code",{className:"[overflow-wrap:anywhere]",children:e.path})]}),t("h3",{children:"Code"}),e.code!==null?t(Me,{className:Ls,content:e.code,language:"typescript",path:e.path??"snippet.ts"}):t("p",{className:"text-[0.72rem] leading-[1.5] text-muted-foreground",children:e.path?"No historical code is stored for this path call.":"No historical code is stored for this call."}),e.logs.length>0&&u(X,{children:[t("h3",{children:"Logs"}),t("pre",{className:Is,children:e.logs.join(`
|
|
9
|
+
`)})]}),e.result!==void 0&&u(X,{children:[t("h3",{children:"Result"}),t(Me,{className:Ls,content:JSON.stringify(e.result,null,2),language:"json",path:"result.json"})]}),e.error&&u(X,{children:[t("h3",{children:e.status==="interrupted"?"Interruption":"Error"}),t("pre",{className:`${Is} text-destructive`,children:e.error})]})]})]})}function ws(){return t("svg",{"aria-hidden":!0,fill:"none",height:"15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7",viewBox:"0 0 24 24",width:"15",children:t("path",{d:"m7 7-4 5 4 5m10-10 4 5-4 5M14 4l-4 16"})})}function fd({children:e,navigation:a,session:o}){let r=j(o.runView),[s,d]=w();return O(()=>{r||d(void 0)},[r]),t(Mt,{value:{acceptSelection:n=>{n?.type==="artifact"&&a.revealEntity(n)||d(n)},selection:s},children:e})}var Ih={id:Gt,needsRunView:!0,sessionStatus:[{id:"ragents.orchestration.journal",readRight:"runs.inspect",order:20,Status:cs}],sessionHeaders:[{id:"ragents.orchestration.stop",readRight:"runs.write",order:100,Header:ps},{id:"ragents.orchestration.actors",order:300,placement:"surface",Header:Dr}],settings:[{id:"ragents.orchestration.runPanel",category:"appearance",label:"Run panel",Settings:fs}],surface:{Center:Nr,RunPanel:us},cardSections:[{id:"ragents.orchestration.documents",order:300,Section:ns}],SessionProvider:fd,workspaceTabs:[{id:Cs,readRight:"runs.inspect",label:"Executions",order:110,Icon:ws,Panel:Ss,keepMounted:!0,available:e=>j(e.runView)!==void 0}]};export{Gt as ORCHESTRATION_PLUGIN_ID,Ih as webPlugin};
|
|
10
10
|
/*! Bundled license information:
|
|
11
11
|
|
|
12
12
|
lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
|