openclaw-multi-auto 1.3.6 → 1.3.8
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/dist/{audio-preflight-5FEeDooz.js → audio-preflight-DDBLZBdb.js} +4 -4
- package/dist/{audio-transcription-runner-B-UvoDjZ.js → audio-transcription-runner-DZbSWT9E.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/{chrome-D45SyhQL.js → chrome-CMU2WVFh.js} +8 -8
- package/dist/{deliver-B9cys0EZ.js → deliver-BXVcFIHL.js} +1 -1
- package/dist/{deliver-runtime-DhaQJ0pI.js → deliver-runtime-DTaIS-1i.js} +3 -3
- package/dist/{deps-send-whatsapp.runtime-DvTL2tzN.js → deps-send-whatsapp.runtime-CIZqFAqb.js} +7 -7
- package/dist/extensionAPI.js +6 -6
- package/dist/{image-DAOPwVXi.js → image-BCVLo0qw.js} +1 -1
- package/dist/{image-runtime-wlCLVvVv.js → image-runtime-DtCKpMPZ.js} +3 -3
- package/dist/{pi-embedded-DYU79yGe.js → pi-embedded-CgQ_W6Xs.js} +24 -24
- package/dist/{pi-embedded-helpers-uTRAmQ4n.js → pi-embedded-helpers-CwuBTKza.js} +3 -3
- package/dist/plugin-sdk/{accounts-DyFCXtHv.js → accounts-BslAlVYS.js} +2 -2
- package/dist/plugin-sdk/{accounts-BJAXxY46.js → accounts-C3m65--E.js} +2 -2
- package/dist/plugin-sdk/{accounts-C1j7HSL0.js → accounts-CNCCkdEF.js} +3 -3
- package/dist/plugin-sdk/{active-listener-CftX5jLD.js → active-listener-CkPnMUkB.js} +2 -2
- package/dist/plugin-sdk/{api-key-rotation-8nyyt1kx.js → api-key-rotation-BXnNsojA.js} +2 -2
- package/dist/plugin-sdk/{audio-preflight-C_aSAPR1.js → audio-preflight-CtO4fFvp.js} +26 -26
- package/dist/plugin-sdk/{audio-transcription-runner-CB53F7_7.js → audio-transcription-runner-DnxvOS1-.js} +11 -11
- package/dist/plugin-sdk/{audit-membership-runtime-BXndI4LG.js → audit-membership-runtime-BpfoSk8M.js} +2 -2
- package/dist/plugin-sdk/{channel-activity-C5y8AgAV.js → channel-activity-WJYxcJ3S.js} +3 -3
- package/dist/plugin-sdk/{channel-web-DBTRO03V.js → channel-web-dO5k3ubM.js} +18 -18
- package/dist/plugin-sdk/{chrome-f00sZkDX.js → chrome-CjNTuJML.js} +6 -6
- package/dist/plugin-sdk/{commands-registry-BJ_NxG2F.js → commands-registry-CdYjoI0i.js} +4 -4
- package/dist/plugin-sdk/{common-Cf27Jwxu.js → common-oYc5vPFl.js} +2 -2
- package/dist/plugin-sdk/{config-CHQrpx-Q.js → config-B1z-UxQ3.js} +7 -7
- package/dist/plugin-sdk/{deliver-DNEuetST.js → deliver-D5_6T567.js} +10 -10
- package/dist/plugin-sdk/deliver-runtime-C5dgvvga.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-Dg4N7PHJ.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-0OEwzMQm.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-BM1jRt3G.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-1E3BYRdF.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-DNCxIflA.js +24 -0
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-OLwr-9c8.js +57 -0
- package/dist/plugin-sdk/{diagnostic-LYUUmjJ5.js → diagnostic-Bxxu0ig-.js} +2 -2
- package/dist/plugin-sdk/{errors-CtMWwS2Z.js → errors-B3cHyZZA.js} +1 -1
- package/dist/plugin-sdk/{fetch-guard-CxYB5Kg6.js → fetch-guard-Dcgod0tg.js} +2 -2
- package/dist/plugin-sdk/{fs-safe-DtfhxbrI.js → fs-safe-BaKqI3G4.js} +3 -3
- package/dist/plugin-sdk/{image-BwjYjRHx.js → image-B2mQW9Rb.js} +6 -6
- package/dist/plugin-sdk/{image-ops-BnZKcbd6.js → image-ops-Cbzr4U9l.js} +2 -2
- package/dist/plugin-sdk/image-runtime-BFm45j49.js +25 -0
- package/dist/plugin-sdk/{ir-Z4hX67TJ.js → ir-ZEmrTr4J.js} +7 -7
- package/dist/plugin-sdk/{local-roots-KhjQw04O.js → local-roots-CIPRxA-4.js} +4 -4
- package/dist/plugin-sdk/{logger-DHIIvMxj.js → logger-CvPFVOgT.js} +2 -2
- package/dist/plugin-sdk/{login-C31642Ld.js → login-CCTew9bt.js} +4 -4
- package/dist/plugin-sdk/{login-qr--y2SG_Ue.js → login-qr-BI3Vi_wJ.js} +5 -5
- package/dist/plugin-sdk/{manager-2UZBMCc7.js → manager-BEoYPn7R.js} +8 -8
- package/dist/plugin-sdk/manager-runtime-DxclHQ4U.js +15 -0
- package/dist/plugin-sdk/{outbound-Ba0QUI5h.js → outbound-ByOw1K6W.js} +5 -5
- package/dist/plugin-sdk/{outbound-attachment-B1Laso-8.js → outbound-attachment-BzVhxRRw.js} +2 -2
- package/dist/plugin-sdk/{path-alias-guards-C7Vm5DZ1.js → path-alias-guards-sWayacde.js} +1 -1
- package/dist/plugin-sdk/{paths-DopV9PQG.js → paths-Dpg3qxcl.js} +1 -1
- package/dist/plugin-sdk/{pi-embedded-helpers-DnA_OCzP.js → pi-embedded-helpers-DIxXkGJf.js} +16 -16
- package/dist/plugin-sdk/{pi-model-discovery-DdPqXk8f.js → pi-model-discovery-DM_2uFtj.js} +1 -1
- package/dist/plugin-sdk/pi-model-discovery-runtime-BuzvkvNR.js +8 -0
- package/dist/plugin-sdk/{pi-tools.before-tool-call.runtime-DxFHiLUE.js → pi-tools.before-tool-call.runtime-w1dqL_ty.js} +4 -4
- package/dist/plugin-sdk/{plugins-CbCt4osF.js → plugins-C4USiH29.js} +4 -4
- package/dist/plugin-sdk/{proxy-env-C63mMdas.js → proxy-env-ET-rp8eg.js} +1 -1
- package/dist/plugin-sdk/{proxy-fetch-Ch95c_Y2.js → proxy-fetch-uDXGKG3Z.js} +1 -1
- package/dist/plugin-sdk/{pw-ai-DpJk62D4.js → pw-ai-CyOt3RDA.js} +9 -9
- package/dist/plugin-sdk/{qmd-manager-Ca-iSfEE.js → qmd-manager-BySdoVR7.js} +7 -7
- package/dist/plugin-sdk/{query-expansion-B_Xe41Ab.js → query-expansion-C6uS-7lj.js} +4 -4
- package/dist/plugin-sdk/{redact-hp9TOulW.js → redact-Bvxt1T_Q.js} +1 -1
- package/dist/plugin-sdk/{reply-CovBlFea.js → reply-CTCSeQqW.js} +73 -73
- package/dist/plugin-sdk/{resolve-outbound-target-BbrHgyUk.js → resolve-outbound-target-Bw8YNANu.js} +2 -2
- package/dist/plugin-sdk/{run-with-concurrency-BR1DXa8T.js → run-with-concurrency-C_KCHwvf.js} +1 -1
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-BxgRDkhc.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-elOqrkfg.js +19 -0
- package/dist/plugin-sdk/{send-BvAtLLPl.js → send-BZ6nYFZr.js} +5 -5
- package/dist/plugin-sdk/{send-BTztm3D2.js → send-C0w6xP2x.js} +6 -6
- package/dist/plugin-sdk/{send-CWJUuG0i.js → send-CFf-1V89.js} +8 -8
- package/dist/plugin-sdk/{send-EcglC4cG.js → send-CY-Qfwia.js} +7 -7
- package/dist/plugin-sdk/{send-BXpXBwM_.js → send-qPyNGSe4.js} +13 -13
- package/dist/plugin-sdk/{session-k256LJZT.js → session-COrvpvUQ.js} +3 -3
- package/dist/plugin-sdk/signal.js +2 -2
- package/dist/plugin-sdk/{skill-commands-DoRqLzxm.js → skill-commands-DZqhtmiv.js} +4 -4
- package/dist/plugin-sdk/{skills-QudILG6e.js → skills-Cw_vXEJb.js} +6 -6
- package/dist/plugin-sdk/slash-commands.runtime-D67JLweo.js +13 -0
- package/dist/plugin-sdk/slash-dispatch.runtime-DvcpvCJ0.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-BM1x3azR.js +16 -0
- package/dist/plugin-sdk/{store-BbDQw3g6.js → store-CMHj6IIw.js} +2 -2
- package/dist/plugin-sdk/subagent-registry-runtime-1lbDyRzz.js +52 -0
- package/dist/plugin-sdk/{tables-BhvloMKN.js → tables-CSqrHsKL.js} +1 -1
- package/dist/plugin-sdk/{thinking-URzkT-3p.js → thinking-DOnsR_A8.js} +7 -7
- package/dist/plugin-sdk/{tokens-B1PW5Ayy.js → tokens-BDr0Z9o3.js} +1 -1
- package/dist/plugin-sdk/{tool-images-xpqbP6RR.js → tool-images-eEfOVkzf.js} +2 -2
- package/dist/plugin-sdk/web-BLyT64pW.js +56 -0
- package/dist/plugin-sdk/{whatsapp-actions-RcZ6vp61.js → whatsapp-actions-xcleMoMv.js} +17 -17
- package/dist/plugin-sdk/whatsapp.js +50 -50
- package/dist/{pw-ai-GcYO6HPE.js → pw-ai-CmphSzHx.js} +1 -1
- package/dist/{slash-dispatch.runtime-Dh053pQK.js → slash-dispatch.runtime-131yup2e.js} +6 -6
- package/dist/{subagent-registry-runtime-DSi5mnCQ.js → subagent-registry-runtime-DbSf_Je6.js} +6 -6
- package/dist/{web-1hWJDzNA.js → web-MR9d7KyB.js} +6 -6
- package/package.json +5 -2
- package/scripts/create-instance.sh +44 -19
- package/scripts/install-maca.sh +39 -28
- package/scripts/npm_publish.sh +8 -6
- package/ui/index.html +16 -0
- package/ui/node_modules/.bin/jiti +21 -0
- package/ui/node_modules/.bin/lessc +21 -0
- package/ui/node_modules/.bin/marked +21 -0
- package/ui/node_modules/.bin/playwright +21 -0
- package/ui/node_modules/.bin/sass +21 -0
- package/ui/node_modules/.bin/tsx +21 -0
- package/ui/node_modules/.bin/vite +21 -0
- package/ui/node_modules/.bin/vitest +21 -0
- package/ui/node_modules/.bin/yaml +21 -0
- package/ui/package.json +27 -0
- package/ui/public/apple-touch-icon.png +0 -0
- package/ui/public/favicon-32.png +0 -0
- package/ui/public/favicon.ico +0 -0
- package/ui/public/favicon.svg +22 -0
- package/ui/src/css.d.ts +1 -0
- package/ui/src/i18n/index.ts +3 -0
- package/ui/src/i18n/lib/lit-controller.ts +22 -0
- package/ui/src/i18n/lib/registry.ts +64 -0
- package/ui/src/i18n/lib/translate.ts +123 -0
- package/ui/src/i18n/lib/types.ts +9 -0
- package/ui/src/i18n/locales/de.ts +129 -0
- package/ui/src/i18n/locales/en.ts +337 -0
- package/ui/src/i18n/locales/pt-BR.ts +128 -0
- package/ui/src/i18n/locales/zh-CN.ts +330 -0
- package/ui/src/i18n/locales/zh-TW.ts +125 -0
- package/ui/src/i18n/test/translate.test.ts +56 -0
- package/ui/src/main.ts +2 -0
- package/ui/src/styles/base.css +385 -0
- package/ui/src/styles/chat/grouped.css +300 -0
- package/ui/src/styles/chat/layout.css +481 -0
- package/ui/src/styles/chat/sidebar.css +117 -0
- package/ui/src/styles/chat/text.css +146 -0
- package/ui/src/styles/chat/tool-cards.css +202 -0
- package/ui/src/styles/chat.css +5 -0
- package/ui/src/styles/components.css +2612 -0
- package/ui/src/styles/config.css +1658 -0
- package/ui/src/styles/layout.css +621 -0
- package/ui/src/styles/layout.mobile.css +374 -0
- package/ui/src/styles.css +5 -0
- package/ui/src/ui/__screenshots__/config-form.browser.test.ts/config-form-renderer-flags-unsupported-unions-1.png +0 -0
- package/ui/src/ui/__screenshots__/config-form.browser.test.ts/config-form-renderer-renders-inputs-and-patches-values-1.png +0 -0
- package/ui/src/ui/__screenshots__/config-form.browser.test.ts/config-form-renderer-renders-union-literals-as-select-options-1.png +0 -0
- package/ui/src/ui/__screenshots__/navigation.browser.test.ts/control-UI-routing-auto-scrolls-chat-history-to-the-latest-message-1.png +0 -0
- package/ui/src/ui/app-channels.ts +279 -0
- package/ui/src/ui/app-chat.ts +266 -0
- package/ui/src/ui/app-defaults.ts +50 -0
- package/ui/src/ui/app-events.ts +5 -0
- package/ui/src/ui/app-gateway.node.test.ts +229 -0
- package/ui/src/ui/app-gateway.ts +349 -0
- package/ui/src/ui/app-lifecycle.node.test.ts +44 -0
- package/ui/src/ui/app-lifecycle.ts +109 -0
- package/ui/src/ui/app-polling.ts +69 -0
- package/ui/src/ui/app-render-usage-tab.ts +273 -0
- package/ui/src/ui/app-render.helpers.node.test.ts +286 -0
- package/ui/src/ui/app-render.helpers.ts +574 -0
- package/ui/src/ui/app-render.ts +1168 -0
- package/ui/src/ui/app-scroll.test.ts +275 -0
- package/ui/src/ui/app-scroll.ts +179 -0
- package/ui/src/ui/app-settings.test.ts +70 -0
- package/ui/src/ui/app-settings.ts +440 -0
- package/ui/src/ui/app-tool-stream.node.test.ts +139 -0
- package/ui/src/ui/app-tool-stream.ts +455 -0
- package/ui/src/ui/app-view-state.ts +321 -0
- package/ui/src/ui/app.ts +621 -0
- package/ui/src/ui/assistant-identity.ts +23 -0
- package/ui/src/ui/chat/constants.ts +12 -0
- package/ui/src/ui/chat/copy-as-markdown.ts +97 -0
- package/ui/src/ui/chat/grouped-render.ts +287 -0
- package/ui/src/ui/chat/message-extract.test.ts +64 -0
- package/ui/src/ui/chat/message-extract.ts +122 -0
- package/ui/src/ui/chat/message-normalizer.test.ts +179 -0
- package/ui/src/ui/chat/message-normalizer.ts +101 -0
- package/ui/src/ui/chat/tool-cards.ts +156 -0
- package/ui/src/ui/chat/tool-helpers.test.ts +141 -0
- package/ui/src/ui/chat/tool-helpers.ts +37 -0
- package/ui/src/ui/chat-event-reload.test.ts +47 -0
- package/ui/src/ui/chat-event-reload.ts +16 -0
- package/ui/src/ui/chat-markdown.browser.test.ts +37 -0
- package/ui/src/ui/components/resizable-divider.ts +110 -0
- package/ui/src/ui/config-form.browser.test.ts +443 -0
- package/ui/src/ui/controllers/agent-files.ts +126 -0
- package/ui/src/ui/controllers/agent-identity.ts +59 -0
- package/ui/src/ui/controllers/agent-skills.ts +33 -0
- package/ui/src/ui/controllers/agents.test.ts +61 -0
- package/ui/src/ui/controllers/agents.ts +64 -0
- package/ui/src/ui/controllers/assistant-identity.ts +34 -0
- package/ui/src/ui/controllers/channels.ts +94 -0
- package/ui/src/ui/controllers/channels.types.ts +15 -0
- package/ui/src/ui/controllers/chat.test.ts +568 -0
- package/ui/src/ui/controllers/chat.ts +318 -0
- package/ui/src/ui/controllers/config/form-coerce.ts +160 -0
- package/ui/src/ui/controllers/config/form-utils.node.test.ts +455 -0
- package/ui/src/ui/controllers/config/form-utils.ts +90 -0
- package/ui/src/ui/controllers/config.test.ts +289 -0
- package/ui/src/ui/controllers/config.ts +219 -0
- package/ui/src/ui/controllers/control-ui-bootstrap.test.ts +82 -0
- package/ui/src/ui/controllers/control-ui-bootstrap.ts +49 -0
- package/ui/src/ui/controllers/cron-filters.test.ts +81 -0
- package/ui/src/ui/controllers/cron.test.ts +1070 -0
- package/ui/src/ui/controllers/cron.ts +921 -0
- package/ui/src/ui/controllers/debug.ts +60 -0
- package/ui/src/ui/controllers/devices.ts +159 -0
- package/ui/src/ui/controllers/exec-approval.ts +100 -0
- package/ui/src/ui/controllers/exec-approvals.ts +170 -0
- package/ui/src/ui/controllers/logs.ts +147 -0
- package/ui/src/ui/controllers/nodes.ts +32 -0
- package/ui/src/ui/controllers/presence.ts +37 -0
- package/ui/src/ui/controllers/sessions.test.ts +104 -0
- package/ui/src/ui/controllers/sessions.ts +127 -0
- package/ui/src/ui/controllers/skills.ts +157 -0
- package/ui/src/ui/controllers/usage.node.test.ts +181 -0
- package/ui/src/ui/controllers/usage.ts +315 -0
- package/ui/src/ui/data/moonshot-kimi-k2.ts +45 -0
- package/ui/src/ui/device-auth.ts +73 -0
- package/ui/src/ui/device-identity.ts +112 -0
- package/ui/src/ui/external-link.test.ts +18 -0
- package/ui/src/ui/external-link.ts +19 -0
- package/ui/src/ui/focus-mode.browser.test.ts +39 -0
- package/ui/src/ui/format.test.ts +101 -0
- package/ui/src/ui/format.ts +60 -0
- package/ui/src/ui/gateway.ts +360 -0
- package/ui/src/ui/icons.ts +256 -0
- package/ui/src/ui/markdown.test.ts +85 -0
- package/ui/src/ui/markdown.ts +139 -0
- package/ui/src/ui/navigation.browser.test.ts +188 -0
- package/ui/src/ui/navigation.test.ts +189 -0
- package/ui/src/ui/navigation.ts +165 -0
- package/ui/src/ui/open-external-url.test.ts +108 -0
- package/ui/src/ui/open-external-url.ts +73 -0
- package/ui/src/ui/presenter.ts +85 -0
- package/ui/src/ui/storage.node.test.ts +63 -0
- package/ui/src/ui/storage.ts +99 -0
- package/ui/src/ui/test-helpers/app-mount.ts +27 -0
- package/ui/src/ui/text-direction.test.ts +24 -0
- package/ui/src/ui/text-direction.ts +30 -0
- package/ui/src/ui/theme-transition.ts +109 -0
- package/ui/src/ui/theme.ts +16 -0
- package/ui/src/ui/tool-display.ts +159 -0
- package/ui/src/ui/types/chat-types.ts +44 -0
- package/ui/src/ui/types.ts +627 -0
- package/ui/src/ui/ui-types.ts +54 -0
- package/ui/src/ui/usage-helpers.node.test.ts +43 -0
- package/ui/src/ui/usage-helpers.ts +321 -0
- package/ui/src/ui/usage-types.ts +22 -0
- package/ui/src/ui/uuid.test.ts +41 -0
- package/ui/src/ui/uuid.ts +57 -0
- package/ui/src/ui/views/agents-panels-status-files.ts +461 -0
- package/ui/src/ui/views/agents-panels-tools-skills.browser.test.ts +102 -0
- package/ui/src/ui/views/agents-panels-tools-skills.ts +537 -0
- package/ui/src/ui/views/agents-utils.test.ts +100 -0
- package/ui/src/ui/views/agents-utils.ts +502 -0
- package/ui/src/ui/views/agents.ts +499 -0
- package/ui/src/ui/views/channel-config-extras.ts +49 -0
- package/ui/src/ui/views/channels.config.ts +155 -0
- package/ui/src/ui/views/channels.discord.ts +65 -0
- package/ui/src/ui/views/channels.googlechat.ts +79 -0
- package/ui/src/ui/views/channels.imessage.ts +65 -0
- package/ui/src/ui/views/channels.nostr-profile-form.ts +321 -0
- package/ui/src/ui/views/channels.nostr.ts +237 -0
- package/ui/src/ui/views/channels.shared.ts +38 -0
- package/ui/src/ui/views/channels.signal.ts +69 -0
- package/ui/src/ui/views/channels.slack.ts +65 -0
- package/ui/src/ui/views/channels.telegram.ts +120 -0
- package/ui/src/ui/views/channels.ts +325 -0
- package/ui/src/ui/views/channels.types.ts +62 -0
- package/ui/src/ui/views/channels.whatsapp.ts +118 -0
- package/ui/src/ui/views/chat-image-open.browser.test.ts +70 -0
- package/ui/src/ui/views/chat.test.ts +227 -0
- package/ui/src/ui/views/chat.ts +616 -0
- package/ui/src/ui/views/config-form.analyze.ts +267 -0
- package/ui/src/ui/views/config-form.node.ts +1073 -0
- package/ui/src/ui/views/config-form.render.ts +478 -0
- package/ui/src/ui/views/config-form.search.node.test.ts +69 -0
- package/ui/src/ui/views/config-form.shared.ts +96 -0
- package/ui/src/ui/views/config-form.ts +4 -0
- package/ui/src/ui/views/config-search.node.test.ts +50 -0
- package/ui/src/ui/views/config-search.ts +92 -0
- package/ui/src/ui/views/config.browser.test.ts +233 -0
- package/ui/src/ui/views/config.ts +820 -0
- package/ui/src/ui/views/cron.test.ts +741 -0
- package/ui/src/ui/views/cron.ts +1758 -0
- package/ui/src/ui/views/debug.ts +151 -0
- package/ui/src/ui/views/exec-approval.ts +89 -0
- package/ui/src/ui/views/gateway-url-confirmation.ts +40 -0
- package/ui/src/ui/views/instances.ts +89 -0
- package/ui/src/ui/views/logs.ts +155 -0
- package/ui/src/ui/views/markdown-sidebar.ts +40 -0
- package/ui/src/ui/views/nodes-exec-approvals.ts +617 -0
- package/ui/src/ui/views/nodes-shared.ts +67 -0
- package/ui/src/ui/views/nodes.ts +485 -0
- package/ui/src/ui/views/overview-hints.ts +16 -0
- package/ui/src/ui/views/overview.node.test.ts +39 -0
- package/ui/src/ui/views/overview.ts +361 -0
- package/ui/src/ui/views/sessions.test.ts +81 -0
- package/ui/src/ui/views/sessions.ts +321 -0
- package/ui/src/ui/views/skills-grouping.ts +40 -0
- package/ui/src/ui/views/skills-shared.ts +52 -0
- package/ui/src/ui/views/skills.ts +192 -0
- package/ui/src/ui/views/usage-metrics.ts +578 -0
- package/ui/src/ui/views/usage-query.ts +277 -0
- package/ui/src/ui/views/usage-render-details.test.ts +136 -0
- package/ui/src/ui/views/usage-render-details.ts +1083 -0
- package/ui/src/ui/views/usage-render-overview.ts +796 -0
- package/ui/src/ui/views/usage-styles/usageStyles-part1.ts +701 -0
- package/ui/src/ui/views/usage-styles/usageStyles-part2.ts +702 -0
- package/ui/src/ui/views/usage-styles/usageStyles-part3.ts +551 -0
- package/ui/src/ui/views/usage.ts +836 -0
- package/ui/src/ui/views/usageStyles.ts +5 -0
- package/ui/src/ui/views/usageTypes.ts +105 -0
- package/ui/vite.config.ts +43 -0
- package/ui/vitest.config.ts +15 -0
- package/ui/vitest.node.config.ts +10 -0
- package/dist/plugin-sdk/deliver-runtime-BFdqklJM.js +0 -32
- package/dist/plugin-sdk/deps-send-discord.runtime-DuqpYwU0.js +0 -23
- package/dist/plugin-sdk/deps-send-imessage.runtime-CZ2rS8Lb.js +0 -22
- package/dist/plugin-sdk/deps-send-signal.runtime-BdqiWhIh.js +0 -21
- package/dist/plugin-sdk/deps-send-slack.runtime-04s36qiC.js +0 -19
- package/dist/plugin-sdk/deps-send-telegram.runtime-LE5tkPvr.js +0 -24
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-Bz57lobC.js +0 -57
- package/dist/plugin-sdk/image-runtime-B8twoubs.js +0 -25
- package/dist/plugin-sdk/manager-runtime-CMeLwose.js +0 -15
- package/dist/plugin-sdk/pi-model-discovery-runtime-D8CJhtJY.js +0 -8
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-SkO91TZH.js +0 -10
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-B0VWK5hm.js +0 -19
- package/dist/plugin-sdk/slash-commands.runtime-DS6vCNSL.js +0 -13
- package/dist/plugin-sdk/slash-dispatch.runtime-BXrxb2wd.js +0 -52
- package/dist/plugin-sdk/slash-skill-commands.runtime-Bd6qQ2oT.js +0 -16
- package/dist/plugin-sdk/subagent-registry-runtime-1uwQbuXj.js +0 -52
- package/dist/plugin-sdk/web-B74yhL2N.js +0 -56
|
@@ -0,0 +1,1168 @@
|
|
|
1
|
+
import { html, nothing } from "lit";
|
|
2
|
+
import { parseAgentSessionKey } from "../../../src/routing/session-key.js";
|
|
3
|
+
import { t } from "../i18n/index.ts";
|
|
4
|
+
import { refreshChatAvatar } from "./app-chat.ts";
|
|
5
|
+
import { renderUsageTab } from "./app-render-usage-tab.ts";
|
|
6
|
+
import { renderChatControls, renderTab, renderThemeToggle } from "./app-render.helpers.ts";
|
|
7
|
+
import type { AppViewState } from "./app-view-state.ts";
|
|
8
|
+
import { loadAgentFileContent, loadAgentFiles, saveAgentFile } from "./controllers/agent-files.ts";
|
|
9
|
+
import { loadAgentIdentities, loadAgentIdentity } from "./controllers/agent-identity.ts";
|
|
10
|
+
import { loadAgentSkills } from "./controllers/agent-skills.ts";
|
|
11
|
+
import { loadAgents, loadToolsCatalog } from "./controllers/agents.ts";
|
|
12
|
+
import { loadChannels } from "./controllers/channels.ts";
|
|
13
|
+
import { loadChatHistory } from "./controllers/chat.ts";
|
|
14
|
+
import {
|
|
15
|
+
applyConfig,
|
|
16
|
+
loadConfig,
|
|
17
|
+
runUpdate,
|
|
18
|
+
saveConfig,
|
|
19
|
+
updateConfigFormValue,
|
|
20
|
+
removeConfigFormValue,
|
|
21
|
+
} from "./controllers/config.ts";
|
|
22
|
+
import {
|
|
23
|
+
loadCronRuns,
|
|
24
|
+
loadMoreCronJobs,
|
|
25
|
+
loadMoreCronRuns,
|
|
26
|
+
reloadCronJobs,
|
|
27
|
+
toggleCronJob,
|
|
28
|
+
runCronJob,
|
|
29
|
+
removeCronJob,
|
|
30
|
+
addCronJob,
|
|
31
|
+
startCronEdit,
|
|
32
|
+
startCronClone,
|
|
33
|
+
cancelCronEdit,
|
|
34
|
+
validateCronForm,
|
|
35
|
+
hasCronFormErrors,
|
|
36
|
+
normalizeCronFormState,
|
|
37
|
+
getVisibleCronJobs,
|
|
38
|
+
updateCronJobsFilter,
|
|
39
|
+
updateCronRunsFilter,
|
|
40
|
+
} from "./controllers/cron.ts";
|
|
41
|
+
import { loadDebug, callDebugMethod } from "./controllers/debug.ts";
|
|
42
|
+
import {
|
|
43
|
+
approveDevicePairing,
|
|
44
|
+
loadDevices,
|
|
45
|
+
rejectDevicePairing,
|
|
46
|
+
revokeDeviceToken,
|
|
47
|
+
rotateDeviceToken,
|
|
48
|
+
} from "./controllers/devices.ts";
|
|
49
|
+
import {
|
|
50
|
+
loadExecApprovals,
|
|
51
|
+
removeExecApprovalsFormValue,
|
|
52
|
+
saveExecApprovals,
|
|
53
|
+
updateExecApprovalsFormValue,
|
|
54
|
+
} from "./controllers/exec-approvals.ts";
|
|
55
|
+
import { loadLogs } from "./controllers/logs.ts";
|
|
56
|
+
import { loadNodes } from "./controllers/nodes.ts";
|
|
57
|
+
import { loadPresence } from "./controllers/presence.ts";
|
|
58
|
+
import { deleteSessionAndRefresh, loadSessions, patchSession } from "./controllers/sessions.ts";
|
|
59
|
+
import {
|
|
60
|
+
installSkill,
|
|
61
|
+
loadSkills,
|
|
62
|
+
saveSkillApiKey,
|
|
63
|
+
updateSkillEdit,
|
|
64
|
+
updateSkillEnabled,
|
|
65
|
+
} from "./controllers/skills.ts";
|
|
66
|
+
import { buildExternalLinkRel, EXTERNAL_LINK_TARGET } from "./external-link.ts";
|
|
67
|
+
import { icons } from "./icons.ts";
|
|
68
|
+
import { normalizeBasePath, TAB_GROUPS, subtitleForTab, titleForTab } from "./navigation.ts";
|
|
69
|
+
import { resolveConfiguredCronModelSuggestions, sortLocaleStrings } from "./views/agents-utils.ts";
|
|
70
|
+
import { renderAgents } from "./views/agents.ts";
|
|
71
|
+
import { renderChannels } from "./views/channels.ts";
|
|
72
|
+
import { renderChat } from "./views/chat.ts";
|
|
73
|
+
import { renderConfig } from "./views/config.ts";
|
|
74
|
+
import { renderCron } from "./views/cron.ts";
|
|
75
|
+
import { renderDebug } from "./views/debug.ts";
|
|
76
|
+
import { renderExecApprovalPrompt } from "./views/exec-approval.ts";
|
|
77
|
+
import { renderGatewayUrlConfirmation } from "./views/gateway-url-confirmation.ts";
|
|
78
|
+
import { renderInstances } from "./views/instances.ts";
|
|
79
|
+
import { renderLogs } from "./views/logs.ts";
|
|
80
|
+
import { renderNodes } from "./views/nodes.ts";
|
|
81
|
+
import { renderOverview } from "./views/overview.ts";
|
|
82
|
+
import { renderSessions } from "./views/sessions.ts";
|
|
83
|
+
import { renderSkills } from "./views/skills.ts";
|
|
84
|
+
|
|
85
|
+
const AVATAR_DATA_RE = /^data:/i;
|
|
86
|
+
const AVATAR_HTTP_RE = /^https?:\/\//i;
|
|
87
|
+
const CRON_THINKING_SUGGESTIONS = ["off", "minimal", "low", "medium", "high"];
|
|
88
|
+
const CRON_TIMEZONE_SUGGESTIONS = [
|
|
89
|
+
"UTC",
|
|
90
|
+
"America/Los_Angeles",
|
|
91
|
+
"America/Denver",
|
|
92
|
+
"America/Chicago",
|
|
93
|
+
"America/New_York",
|
|
94
|
+
"Europe/London",
|
|
95
|
+
"Europe/Berlin",
|
|
96
|
+
"Asia/Tokyo",
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
function isHttpUrl(value: string): boolean {
|
|
100
|
+
return /^https?:\/\//i.test(value.trim());
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function normalizeSuggestionValue(value: unknown): string {
|
|
104
|
+
return typeof value === "string" ? value.trim() : "";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function uniquePreserveOrder(values: string[]): string[] {
|
|
108
|
+
const seen = new Set<string>();
|
|
109
|
+
const output: string[] = [];
|
|
110
|
+
for (const value of values) {
|
|
111
|
+
const normalized = value.trim();
|
|
112
|
+
if (!normalized) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const key = normalized.toLowerCase();
|
|
116
|
+
if (seen.has(key)) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
seen.add(key);
|
|
120
|
+
output.push(normalized);
|
|
121
|
+
}
|
|
122
|
+
return output;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function resolveAssistantAvatarUrl(state: AppViewState): string | undefined {
|
|
126
|
+
const list = state.agentsList?.agents ?? [];
|
|
127
|
+
const parsed = parseAgentSessionKey(state.sessionKey);
|
|
128
|
+
const agentId = parsed?.agentId ?? state.agentsList?.defaultId ?? "main";
|
|
129
|
+
const agent = list.find((entry) => entry.id === agentId);
|
|
130
|
+
const identity = agent?.identity;
|
|
131
|
+
const candidate = identity?.avatarUrl ?? identity?.avatar;
|
|
132
|
+
if (!candidate) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
if (AVATAR_DATA_RE.test(candidate) || AVATAR_HTTP_RE.test(candidate)) {
|
|
136
|
+
return candidate;
|
|
137
|
+
}
|
|
138
|
+
return identity?.avatarUrl;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function renderApp(state: AppViewState) {
|
|
142
|
+
const openClawVersion =
|
|
143
|
+
(typeof state.hello?.server?.version === "string" && state.hello.server.version.trim()) ||
|
|
144
|
+
state.updateAvailable?.currentVersion ||
|
|
145
|
+
t("common.na");
|
|
146
|
+
const availableUpdate =
|
|
147
|
+
state.updateAvailable &&
|
|
148
|
+
state.updateAvailable.latestVersion !== state.updateAvailable.currentVersion
|
|
149
|
+
? state.updateAvailable
|
|
150
|
+
: null;
|
|
151
|
+
const versionStatusClass = availableUpdate ? "warn" : "ok";
|
|
152
|
+
const presenceCount = state.presenceEntries.length;
|
|
153
|
+
const sessionsCount = state.sessionsResult?.count ?? null;
|
|
154
|
+
const cronNext = state.cronStatus?.nextWakeAtMs ?? null;
|
|
155
|
+
const chatDisabledReason = state.connected ? null : t("chat.disconnected");
|
|
156
|
+
const isChat = state.tab === "chat";
|
|
157
|
+
const chatFocus = isChat && (state.settings.chatFocusMode || state.onboarding);
|
|
158
|
+
const showThinking = state.onboarding ? false : state.settings.chatShowThinking;
|
|
159
|
+
const assistantAvatarUrl = resolveAssistantAvatarUrl(state);
|
|
160
|
+
const chatAvatarUrl = state.chatAvatarUrl ?? assistantAvatarUrl ?? null;
|
|
161
|
+
const configValue =
|
|
162
|
+
state.configForm ?? (state.configSnapshot?.config as Record<string, unknown> | null);
|
|
163
|
+
const basePath = normalizeBasePath(state.basePath ?? "");
|
|
164
|
+
const resolvedAgentId =
|
|
165
|
+
state.agentsSelectedId ??
|
|
166
|
+
state.agentsList?.defaultId ??
|
|
167
|
+
state.agentsList?.agents?.[0]?.id ??
|
|
168
|
+
null;
|
|
169
|
+
const cronAgentSuggestions = sortLocaleStrings(
|
|
170
|
+
new Set(
|
|
171
|
+
[
|
|
172
|
+
...(state.agentsList?.agents?.map((entry) => entry.id.trim()) ?? []),
|
|
173
|
+
...state.cronJobs
|
|
174
|
+
.map((job) => (typeof job.agentId === "string" ? job.agentId.trim() : ""))
|
|
175
|
+
.filter(Boolean),
|
|
176
|
+
].filter(Boolean),
|
|
177
|
+
),
|
|
178
|
+
);
|
|
179
|
+
const cronModelSuggestions = sortLocaleStrings(
|
|
180
|
+
new Set(
|
|
181
|
+
[
|
|
182
|
+
...state.cronModelSuggestions,
|
|
183
|
+
...resolveConfiguredCronModelSuggestions(configValue),
|
|
184
|
+
...state.cronJobs
|
|
185
|
+
.map((job) => {
|
|
186
|
+
if (job.payload.kind !== "agentTurn" || typeof job.payload.model !== "string") {
|
|
187
|
+
return "";
|
|
188
|
+
}
|
|
189
|
+
return job.payload.model.trim();
|
|
190
|
+
})
|
|
191
|
+
.filter(Boolean),
|
|
192
|
+
].filter(Boolean),
|
|
193
|
+
),
|
|
194
|
+
);
|
|
195
|
+
const visibleCronJobs = getVisibleCronJobs(state);
|
|
196
|
+
const selectedDeliveryChannel =
|
|
197
|
+
state.cronForm.deliveryChannel && state.cronForm.deliveryChannel.trim()
|
|
198
|
+
? state.cronForm.deliveryChannel.trim()
|
|
199
|
+
: "last";
|
|
200
|
+
const jobToSuggestions = state.cronJobs
|
|
201
|
+
.map((job) => normalizeSuggestionValue(job.delivery?.to))
|
|
202
|
+
.filter(Boolean);
|
|
203
|
+
const accountToSuggestions = (
|
|
204
|
+
selectedDeliveryChannel === "last"
|
|
205
|
+
? Object.values(state.channelsSnapshot?.channelAccounts ?? {}).flat()
|
|
206
|
+
: (state.channelsSnapshot?.channelAccounts?.[selectedDeliveryChannel] ?? [])
|
|
207
|
+
)
|
|
208
|
+
.flatMap((account) => [
|
|
209
|
+
normalizeSuggestionValue(account.accountId),
|
|
210
|
+
normalizeSuggestionValue(account.name),
|
|
211
|
+
])
|
|
212
|
+
.filter(Boolean);
|
|
213
|
+
const rawDeliveryToSuggestions = uniquePreserveOrder([
|
|
214
|
+
...jobToSuggestions,
|
|
215
|
+
...accountToSuggestions,
|
|
216
|
+
]);
|
|
217
|
+
const accountSuggestions = uniquePreserveOrder(accountToSuggestions);
|
|
218
|
+
const deliveryToSuggestions =
|
|
219
|
+
state.cronForm.deliveryMode === "webhook"
|
|
220
|
+
? rawDeliveryToSuggestions.filter((value) => isHttpUrl(value))
|
|
221
|
+
: rawDeliveryToSuggestions;
|
|
222
|
+
|
|
223
|
+
return html`
|
|
224
|
+
<div class="shell ${isChat ? "shell--chat" : ""} ${chatFocus ? "shell--chat-focus" : ""} ${state.settings.navCollapsed ? "shell--nav-collapsed" : ""} ${state.onboarding ? "shell--onboarding" : ""}">
|
|
225
|
+
<header class="topbar">
|
|
226
|
+
<div class="topbar-left">
|
|
227
|
+
<button
|
|
228
|
+
class="nav-collapse-toggle"
|
|
229
|
+
@click=${() =>
|
|
230
|
+
state.applySettings({
|
|
231
|
+
...state.settings,
|
|
232
|
+
navCollapsed: !state.settings.navCollapsed,
|
|
233
|
+
})}
|
|
234
|
+
title="${state.settings.navCollapsed ? t("nav.expand") : t("nav.collapse")}"
|
|
235
|
+
aria-label="${state.settings.navCollapsed ? t("nav.expand") : t("nav.collapse")}"
|
|
236
|
+
>
|
|
237
|
+
<span class="nav-collapse-toggle__icon">${icons.menu}</span>
|
|
238
|
+
</button>
|
|
239
|
+
<div class="brand">
|
|
240
|
+
<div class="brand-logo">
|
|
241
|
+
<img src=${basePath ? `${basePath}/favicon.svg` : "/favicon.svg"} alt="OpenClaw" />
|
|
242
|
+
</div>
|
|
243
|
+
<div class="brand-text">
|
|
244
|
+
<div class="brand-title">OPENCLAW</div>
|
|
245
|
+
<div class="brand-sub">Gateway Dashboard</div>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="topbar-status">
|
|
250
|
+
<div class="pill">
|
|
251
|
+
<span class="statusDot ${versionStatusClass}"></span>
|
|
252
|
+
<span>${t("common.version")}</span>
|
|
253
|
+
<span class="mono">${openClawVersion}</span>
|
|
254
|
+
</div>
|
|
255
|
+
<div class="pill">
|
|
256
|
+
<span class="statusDot ${state.connected ? "ok" : ""}"></span>
|
|
257
|
+
<span>${t("common.health")}</span>
|
|
258
|
+
<span class="mono">${state.connected ? t("common.ok") : t("common.offline")}</span>
|
|
259
|
+
</div>
|
|
260
|
+
${renderThemeToggle(state)}
|
|
261
|
+
</div>
|
|
262
|
+
</header>
|
|
263
|
+
<aside class="nav ${state.settings.navCollapsed ? "nav--collapsed" : ""}">
|
|
264
|
+
${TAB_GROUPS.map((group) => {
|
|
265
|
+
const isGroupCollapsed = state.settings.navGroupsCollapsed[group.label] ?? false;
|
|
266
|
+
const hasActiveTab = group.tabs.some((tab) => tab === state.tab);
|
|
267
|
+
return html`
|
|
268
|
+
<div class="nav-group ${isGroupCollapsed && !hasActiveTab ? "nav-group--collapsed" : ""}">
|
|
269
|
+
<button
|
|
270
|
+
class="nav-label"
|
|
271
|
+
@click=${() => {
|
|
272
|
+
const next = { ...state.settings.navGroupsCollapsed };
|
|
273
|
+
next[group.label] = !isGroupCollapsed;
|
|
274
|
+
state.applySettings({
|
|
275
|
+
...state.settings,
|
|
276
|
+
navGroupsCollapsed: next,
|
|
277
|
+
});
|
|
278
|
+
}}
|
|
279
|
+
aria-expanded=${!isGroupCollapsed}
|
|
280
|
+
>
|
|
281
|
+
<span class="nav-label__text">${t(`nav.${group.label}`)}</span>
|
|
282
|
+
<span class="nav-label__chevron">${isGroupCollapsed ? "+" : "−"}</span>
|
|
283
|
+
</button>
|
|
284
|
+
<div class="nav-group__items">
|
|
285
|
+
${group.tabs.map((tab) => renderTab(state, tab))}
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
`;
|
|
289
|
+
})}
|
|
290
|
+
<div class="nav-group nav-group--links">
|
|
291
|
+
<div class="nav-label nav-label--static">
|
|
292
|
+
<span class="nav-label__text">${t("common.resources")}</span>
|
|
293
|
+
</div>
|
|
294
|
+
<div class="nav-group__items">
|
|
295
|
+
<a
|
|
296
|
+
class="nav-item nav-item--external"
|
|
297
|
+
href="https://docs.openclaw.ai"
|
|
298
|
+
target=${EXTERNAL_LINK_TARGET}
|
|
299
|
+
rel=${buildExternalLinkRel()}
|
|
300
|
+
title="${t("common.docs")} (opens in new tab)"
|
|
301
|
+
>
|
|
302
|
+
<span class="nav-item__icon" aria-hidden="true">${icons.book}</span>
|
|
303
|
+
<span class="nav-item__text">${t("common.docs")}</span>
|
|
304
|
+
</a>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</aside>
|
|
308
|
+
<main class="content ${isChat ? "content--chat" : ""}">
|
|
309
|
+
${
|
|
310
|
+
availableUpdate
|
|
311
|
+
? html`<div class="update-banner callout danger" role="alert">
|
|
312
|
+
<strong>Update available:</strong> v${availableUpdate.latestVersion}
|
|
313
|
+
(running v${availableUpdate.currentVersion}).
|
|
314
|
+
<button
|
|
315
|
+
class="btn btn--sm update-banner__btn"
|
|
316
|
+
?disabled=${state.updateRunning || !state.connected}
|
|
317
|
+
@click=${() => runUpdate(state)}
|
|
318
|
+
>${state.updateRunning ? "Updating…" : "Update now"}</button>
|
|
319
|
+
</div>`
|
|
320
|
+
: nothing
|
|
321
|
+
}
|
|
322
|
+
<section class="content-header">
|
|
323
|
+
<div>
|
|
324
|
+
${state.tab === "usage" ? nothing : html`<div class="page-title">${titleForTab(state.tab)}</div>`}
|
|
325
|
+
${state.tab === "usage" ? nothing : html`<div class="page-sub">${subtitleForTab(state.tab)}</div>`}
|
|
326
|
+
</div>
|
|
327
|
+
<div class="page-meta">
|
|
328
|
+
${state.lastError ? html`<div class="pill danger">${state.lastError}</div>` : nothing}
|
|
329
|
+
${isChat ? renderChatControls(state) : nothing}
|
|
330
|
+
</div>
|
|
331
|
+
</section>
|
|
332
|
+
|
|
333
|
+
${
|
|
334
|
+
state.tab === "overview"
|
|
335
|
+
? renderOverview({
|
|
336
|
+
connected: state.connected,
|
|
337
|
+
hello: state.hello,
|
|
338
|
+
settings: state.settings,
|
|
339
|
+
password: state.password,
|
|
340
|
+
lastError: state.lastError,
|
|
341
|
+
lastErrorCode: state.lastErrorCode,
|
|
342
|
+
presenceCount,
|
|
343
|
+
sessionsCount,
|
|
344
|
+
cronEnabled: state.cronStatus?.enabled ?? null,
|
|
345
|
+
cronNext,
|
|
346
|
+
lastChannelsRefresh: state.channelsLastSuccess,
|
|
347
|
+
onSettingsChange: (next) => state.applySettings(next),
|
|
348
|
+
onPasswordChange: (next) => (state.password = next),
|
|
349
|
+
onSessionKeyChange: (next) => {
|
|
350
|
+
state.sessionKey = next;
|
|
351
|
+
state.chatMessage = "";
|
|
352
|
+
state.resetToolStream();
|
|
353
|
+
state.applySettings({
|
|
354
|
+
...state.settings,
|
|
355
|
+
sessionKey: next,
|
|
356
|
+
lastActiveSessionKey: next,
|
|
357
|
+
});
|
|
358
|
+
void state.loadAssistantIdentity();
|
|
359
|
+
},
|
|
360
|
+
onConnect: () => state.connect(),
|
|
361
|
+
onRefresh: () => state.loadOverview(),
|
|
362
|
+
})
|
|
363
|
+
: nothing
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
${
|
|
367
|
+
state.tab === "channels"
|
|
368
|
+
? renderChannels({
|
|
369
|
+
connected: state.connected,
|
|
370
|
+
loading: state.channelsLoading,
|
|
371
|
+
snapshot: state.channelsSnapshot,
|
|
372
|
+
lastError: state.channelsError,
|
|
373
|
+
lastSuccessAt: state.channelsLastSuccess,
|
|
374
|
+
whatsappMessage: state.whatsappLoginMessage,
|
|
375
|
+
whatsappQrDataUrl: state.whatsappLoginQrDataUrl,
|
|
376
|
+
whatsappConnected: state.whatsappLoginConnected,
|
|
377
|
+
whatsappBusy: state.whatsappBusy,
|
|
378
|
+
configSchema: state.configSchema,
|
|
379
|
+
configSchemaLoading: state.configSchemaLoading,
|
|
380
|
+
configForm: state.configForm,
|
|
381
|
+
configUiHints: state.configUiHints,
|
|
382
|
+
configSaving: state.configSaving,
|
|
383
|
+
configFormDirty: state.configFormDirty,
|
|
384
|
+
nostrProfileFormState: state.nostrProfileFormState,
|
|
385
|
+
nostrProfileAccountId: state.nostrProfileAccountId,
|
|
386
|
+
onRefresh: (probe) => loadChannels(state, probe),
|
|
387
|
+
onWhatsAppStart: (force) => state.handleWhatsAppStart(force),
|
|
388
|
+
onWhatsAppWait: () => state.handleWhatsAppWait(),
|
|
389
|
+
onWhatsAppLogout: () => state.handleWhatsAppLogout(),
|
|
390
|
+
onConfigPatch: (path, value) => updateConfigFormValue(state, path, value),
|
|
391
|
+
onConfigSave: () => state.handleChannelConfigSave(),
|
|
392
|
+
onConfigReload: () => state.handleChannelConfigReload(),
|
|
393
|
+
onNostrProfileEdit: (accountId, profile) =>
|
|
394
|
+
state.handleNostrProfileEdit(accountId, profile),
|
|
395
|
+
onNostrProfileCancel: () => state.handleNostrProfileCancel(),
|
|
396
|
+
onNostrProfileFieldChange: (field, value) =>
|
|
397
|
+
state.handleNostrProfileFieldChange(field, value),
|
|
398
|
+
onNostrProfileSave: () => state.handleNostrProfileSave(),
|
|
399
|
+
onNostrProfileImport: () => state.handleNostrProfileImport(),
|
|
400
|
+
onNostrProfileToggleAdvanced: () => state.handleNostrProfileToggleAdvanced(),
|
|
401
|
+
})
|
|
402
|
+
: nothing
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
${
|
|
406
|
+
state.tab === "instances"
|
|
407
|
+
? renderInstances({
|
|
408
|
+
loading: state.presenceLoading,
|
|
409
|
+
entries: state.presenceEntries,
|
|
410
|
+
lastError: state.presenceError,
|
|
411
|
+
statusMessage: state.presenceStatus,
|
|
412
|
+
onRefresh: () => loadPresence(state),
|
|
413
|
+
})
|
|
414
|
+
: nothing
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
${
|
|
418
|
+
state.tab === "sessions"
|
|
419
|
+
? renderSessions({
|
|
420
|
+
loading: state.sessionsLoading,
|
|
421
|
+
result: state.sessionsResult,
|
|
422
|
+
error: state.sessionsError,
|
|
423
|
+
activeMinutes: state.sessionsFilterActive,
|
|
424
|
+
limit: state.sessionsFilterLimit,
|
|
425
|
+
includeGlobal: state.sessionsIncludeGlobal,
|
|
426
|
+
includeUnknown: state.sessionsIncludeUnknown,
|
|
427
|
+
basePath: state.basePath,
|
|
428
|
+
onFiltersChange: (next) => {
|
|
429
|
+
state.sessionsFilterActive = next.activeMinutes;
|
|
430
|
+
state.sessionsFilterLimit = next.limit;
|
|
431
|
+
state.sessionsIncludeGlobal = next.includeGlobal;
|
|
432
|
+
state.sessionsIncludeUnknown = next.includeUnknown;
|
|
433
|
+
},
|
|
434
|
+
onRefresh: () => loadSessions(state),
|
|
435
|
+
onPatch: (key, patch) => patchSession(state, key, patch),
|
|
436
|
+
onDelete: (key) => deleteSessionAndRefresh(state, key),
|
|
437
|
+
})
|
|
438
|
+
: nothing
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
${renderUsageTab(state)}
|
|
442
|
+
|
|
443
|
+
${
|
|
444
|
+
state.tab === "cron"
|
|
445
|
+
? renderCron({
|
|
446
|
+
basePath: state.basePath,
|
|
447
|
+
loading: state.cronLoading,
|
|
448
|
+
jobsLoadingMore: state.cronJobsLoadingMore,
|
|
449
|
+
status: state.cronStatus,
|
|
450
|
+
jobs: visibleCronJobs,
|
|
451
|
+
jobsTotal: state.cronJobsTotal,
|
|
452
|
+
jobsHasMore: state.cronJobsHasMore,
|
|
453
|
+
jobsQuery: state.cronJobsQuery,
|
|
454
|
+
jobsEnabledFilter: state.cronJobsEnabledFilter,
|
|
455
|
+
jobsScheduleKindFilter: state.cronJobsScheduleKindFilter,
|
|
456
|
+
jobsLastStatusFilter: state.cronJobsLastStatusFilter,
|
|
457
|
+
jobsSortBy: state.cronJobsSortBy,
|
|
458
|
+
jobsSortDir: state.cronJobsSortDir,
|
|
459
|
+
error: state.cronError,
|
|
460
|
+
busy: state.cronBusy,
|
|
461
|
+
form: state.cronForm,
|
|
462
|
+
fieldErrors: state.cronFieldErrors,
|
|
463
|
+
canSubmit: !hasCronFormErrors(state.cronFieldErrors),
|
|
464
|
+
editingJobId: state.cronEditingJobId,
|
|
465
|
+
channels: state.channelsSnapshot?.channelMeta?.length
|
|
466
|
+
? state.channelsSnapshot.channelMeta.map((entry) => entry.id)
|
|
467
|
+
: (state.channelsSnapshot?.channelOrder ?? []),
|
|
468
|
+
channelLabels: state.channelsSnapshot?.channelLabels ?? {},
|
|
469
|
+
channelMeta: state.channelsSnapshot?.channelMeta ?? [],
|
|
470
|
+
runsJobId: state.cronRunsJobId,
|
|
471
|
+
runs: state.cronRuns,
|
|
472
|
+
runsTotal: state.cronRunsTotal,
|
|
473
|
+
runsHasMore: state.cronRunsHasMore,
|
|
474
|
+
runsLoadingMore: state.cronRunsLoadingMore,
|
|
475
|
+
runsScope: state.cronRunsScope,
|
|
476
|
+
runsStatuses: state.cronRunsStatuses,
|
|
477
|
+
runsDeliveryStatuses: state.cronRunsDeliveryStatuses,
|
|
478
|
+
runsStatusFilter: state.cronRunsStatusFilter,
|
|
479
|
+
runsQuery: state.cronRunsQuery,
|
|
480
|
+
runsSortDir: state.cronRunsSortDir,
|
|
481
|
+
agentSuggestions: cronAgentSuggestions,
|
|
482
|
+
modelSuggestions: cronModelSuggestions,
|
|
483
|
+
thinkingSuggestions: CRON_THINKING_SUGGESTIONS,
|
|
484
|
+
timezoneSuggestions: CRON_TIMEZONE_SUGGESTIONS,
|
|
485
|
+
deliveryToSuggestions,
|
|
486
|
+
accountSuggestions,
|
|
487
|
+
onFormChange: (patch) => {
|
|
488
|
+
state.cronForm = normalizeCronFormState({ ...state.cronForm, ...patch });
|
|
489
|
+
state.cronFieldErrors = validateCronForm(state.cronForm);
|
|
490
|
+
},
|
|
491
|
+
onRefresh: () => state.loadCron(),
|
|
492
|
+
onAdd: () => addCronJob(state),
|
|
493
|
+
onEdit: (job) => startCronEdit(state, job),
|
|
494
|
+
onClone: (job) => startCronClone(state, job),
|
|
495
|
+
onCancelEdit: () => cancelCronEdit(state),
|
|
496
|
+
onToggle: (job, enabled) => toggleCronJob(state, job, enabled),
|
|
497
|
+
onRun: (job, mode) => runCronJob(state, job, mode ?? "force"),
|
|
498
|
+
onRemove: (job) => removeCronJob(state, job),
|
|
499
|
+
onLoadRuns: async (jobId) => {
|
|
500
|
+
updateCronRunsFilter(state, { cronRunsScope: "job" });
|
|
501
|
+
await loadCronRuns(state, jobId);
|
|
502
|
+
},
|
|
503
|
+
onLoadMoreJobs: () => loadMoreCronJobs(state),
|
|
504
|
+
onJobsFiltersChange: async (patch) => {
|
|
505
|
+
updateCronJobsFilter(state, patch);
|
|
506
|
+
const shouldReload =
|
|
507
|
+
typeof patch.cronJobsQuery === "string" ||
|
|
508
|
+
Boolean(patch.cronJobsEnabledFilter) ||
|
|
509
|
+
Boolean(patch.cronJobsSortBy) ||
|
|
510
|
+
Boolean(patch.cronJobsSortDir);
|
|
511
|
+
if (shouldReload) {
|
|
512
|
+
await reloadCronJobs(state);
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
onJobsFiltersReset: async () => {
|
|
516
|
+
updateCronJobsFilter(state, {
|
|
517
|
+
cronJobsQuery: "",
|
|
518
|
+
cronJobsEnabledFilter: "all",
|
|
519
|
+
cronJobsScheduleKindFilter: "all",
|
|
520
|
+
cronJobsLastStatusFilter: "all",
|
|
521
|
+
cronJobsSortBy: "nextRunAtMs",
|
|
522
|
+
cronJobsSortDir: "asc",
|
|
523
|
+
});
|
|
524
|
+
await reloadCronJobs(state);
|
|
525
|
+
},
|
|
526
|
+
onLoadMoreRuns: () => loadMoreCronRuns(state),
|
|
527
|
+
onRunsFiltersChange: async (patch) => {
|
|
528
|
+
updateCronRunsFilter(state, patch);
|
|
529
|
+
if (state.cronRunsScope === "all") {
|
|
530
|
+
await loadCronRuns(state, null);
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
await loadCronRuns(state, state.cronRunsJobId);
|
|
534
|
+
},
|
|
535
|
+
})
|
|
536
|
+
: nothing
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
${
|
|
540
|
+
state.tab === "agents"
|
|
541
|
+
? renderAgents({
|
|
542
|
+
loading: state.agentsLoading,
|
|
543
|
+
error: state.agentsError,
|
|
544
|
+
agentsList: state.agentsList,
|
|
545
|
+
selectedAgentId: resolvedAgentId,
|
|
546
|
+
activePanel: state.agentsPanel,
|
|
547
|
+
configForm: configValue,
|
|
548
|
+
configLoading: state.configLoading,
|
|
549
|
+
configSaving: state.configSaving,
|
|
550
|
+
configDirty: state.configFormDirty,
|
|
551
|
+
channelsLoading: state.channelsLoading,
|
|
552
|
+
channelsError: state.channelsError,
|
|
553
|
+
channelsSnapshot: state.channelsSnapshot,
|
|
554
|
+
channelsLastSuccess: state.channelsLastSuccess,
|
|
555
|
+
cronLoading: state.cronLoading,
|
|
556
|
+
cronStatus: state.cronStatus,
|
|
557
|
+
cronJobs: state.cronJobs,
|
|
558
|
+
cronError: state.cronError,
|
|
559
|
+
agentFilesLoading: state.agentFilesLoading,
|
|
560
|
+
agentFilesError: state.agentFilesError,
|
|
561
|
+
agentFilesList: state.agentFilesList,
|
|
562
|
+
agentFileActive: state.agentFileActive,
|
|
563
|
+
agentFileContents: state.agentFileContents,
|
|
564
|
+
agentFileDrafts: state.agentFileDrafts,
|
|
565
|
+
agentFileSaving: state.agentFileSaving,
|
|
566
|
+
agentIdentityLoading: state.agentIdentityLoading,
|
|
567
|
+
agentIdentityError: state.agentIdentityError,
|
|
568
|
+
agentIdentityById: state.agentIdentityById,
|
|
569
|
+
agentSkillsLoading: state.agentSkillsLoading,
|
|
570
|
+
agentSkillsReport: state.agentSkillsReport,
|
|
571
|
+
agentSkillsError: state.agentSkillsError,
|
|
572
|
+
agentSkillsAgentId: state.agentSkillsAgentId,
|
|
573
|
+
toolsCatalogLoading: state.toolsCatalogLoading,
|
|
574
|
+
toolsCatalogError: state.toolsCatalogError,
|
|
575
|
+
toolsCatalogResult: state.toolsCatalogResult,
|
|
576
|
+
skillsFilter: state.skillsFilter,
|
|
577
|
+
onRefresh: async () => {
|
|
578
|
+
await loadAgents(state);
|
|
579
|
+
const nextSelected =
|
|
580
|
+
state.agentsSelectedId ??
|
|
581
|
+
state.agentsList?.defaultId ??
|
|
582
|
+
state.agentsList?.agents?.[0]?.id ??
|
|
583
|
+
null;
|
|
584
|
+
await loadToolsCatalog(state, nextSelected);
|
|
585
|
+
const agentIds = state.agentsList?.agents?.map((entry) => entry.id) ?? [];
|
|
586
|
+
if (agentIds.length > 0) {
|
|
587
|
+
void loadAgentIdentities(state, agentIds);
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
onSelectAgent: (agentId) => {
|
|
591
|
+
if (state.agentsSelectedId === agentId) {
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
state.agentsSelectedId = agentId;
|
|
595
|
+
state.agentFilesList = null;
|
|
596
|
+
state.agentFilesError = null;
|
|
597
|
+
state.agentFilesLoading = false;
|
|
598
|
+
state.agentFileActive = null;
|
|
599
|
+
state.agentFileContents = {};
|
|
600
|
+
state.agentFileDrafts = {};
|
|
601
|
+
state.agentSkillsReport = null;
|
|
602
|
+
state.agentSkillsError = null;
|
|
603
|
+
state.agentSkillsAgentId = null;
|
|
604
|
+
void loadAgentIdentity(state, agentId);
|
|
605
|
+
if (state.agentsPanel === "tools") {
|
|
606
|
+
void loadToolsCatalog(state, agentId);
|
|
607
|
+
}
|
|
608
|
+
if (state.agentsPanel === "files") {
|
|
609
|
+
void loadAgentFiles(state, agentId);
|
|
610
|
+
}
|
|
611
|
+
if (state.agentsPanel === "skills") {
|
|
612
|
+
void loadAgentSkills(state, agentId);
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
onSelectPanel: (panel) => {
|
|
616
|
+
state.agentsPanel = panel;
|
|
617
|
+
if (panel === "files" && resolvedAgentId) {
|
|
618
|
+
if (state.agentFilesList?.agentId !== resolvedAgentId) {
|
|
619
|
+
state.agentFilesList = null;
|
|
620
|
+
state.agentFilesError = null;
|
|
621
|
+
state.agentFileActive = null;
|
|
622
|
+
state.agentFileContents = {};
|
|
623
|
+
state.agentFileDrafts = {};
|
|
624
|
+
void loadAgentFiles(state, resolvedAgentId);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
if (panel === "tools") {
|
|
628
|
+
void loadToolsCatalog(state, resolvedAgentId);
|
|
629
|
+
}
|
|
630
|
+
if (panel === "skills") {
|
|
631
|
+
if (resolvedAgentId) {
|
|
632
|
+
void loadAgentSkills(state, resolvedAgentId);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
if (panel === "channels") {
|
|
636
|
+
void loadChannels(state, false);
|
|
637
|
+
}
|
|
638
|
+
if (panel === "cron") {
|
|
639
|
+
void state.loadCron();
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
onLoadFiles: (agentId) => loadAgentFiles(state, agentId),
|
|
643
|
+
onSelectFile: (name) => {
|
|
644
|
+
state.agentFileActive = name;
|
|
645
|
+
if (!resolvedAgentId) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
void loadAgentFileContent(state, resolvedAgentId, name);
|
|
649
|
+
},
|
|
650
|
+
onFileDraftChange: (name, content) => {
|
|
651
|
+
state.agentFileDrafts = { ...state.agentFileDrafts, [name]: content };
|
|
652
|
+
},
|
|
653
|
+
onFileReset: (name) => {
|
|
654
|
+
const base = state.agentFileContents[name] ?? "";
|
|
655
|
+
state.agentFileDrafts = { ...state.agentFileDrafts, [name]: base };
|
|
656
|
+
},
|
|
657
|
+
onFileSave: (name) => {
|
|
658
|
+
if (!resolvedAgentId) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
const content =
|
|
662
|
+
state.agentFileDrafts[name] ?? state.agentFileContents[name] ?? "";
|
|
663
|
+
void saveAgentFile(state, resolvedAgentId, name, content);
|
|
664
|
+
},
|
|
665
|
+
onToolsProfileChange: (agentId, profile, clearAllow) => {
|
|
666
|
+
if (!configValue) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list;
|
|
670
|
+
if (!Array.isArray(list)) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
const index = list.findIndex(
|
|
674
|
+
(entry) =>
|
|
675
|
+
entry &&
|
|
676
|
+
typeof entry === "object" &&
|
|
677
|
+
"id" in entry &&
|
|
678
|
+
(entry as { id?: string }).id === agentId,
|
|
679
|
+
);
|
|
680
|
+
if (index < 0) {
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const basePath = ["agents", "list", index, "tools"];
|
|
684
|
+
if (profile) {
|
|
685
|
+
updateConfigFormValue(state, [...basePath, "profile"], profile);
|
|
686
|
+
} else {
|
|
687
|
+
removeConfigFormValue(state, [...basePath, "profile"]);
|
|
688
|
+
}
|
|
689
|
+
if (clearAllow) {
|
|
690
|
+
removeConfigFormValue(state, [...basePath, "allow"]);
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
onToolsOverridesChange: (agentId, alsoAllow, deny) => {
|
|
694
|
+
if (!configValue) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list;
|
|
698
|
+
if (!Array.isArray(list)) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const index = list.findIndex(
|
|
702
|
+
(entry) =>
|
|
703
|
+
entry &&
|
|
704
|
+
typeof entry === "object" &&
|
|
705
|
+
"id" in entry &&
|
|
706
|
+
(entry as { id?: string }).id === agentId,
|
|
707
|
+
);
|
|
708
|
+
if (index < 0) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
const basePath = ["agents", "list", index, "tools"];
|
|
712
|
+
if (alsoAllow.length > 0) {
|
|
713
|
+
updateConfigFormValue(state, [...basePath, "alsoAllow"], alsoAllow);
|
|
714
|
+
} else {
|
|
715
|
+
removeConfigFormValue(state, [...basePath, "alsoAllow"]);
|
|
716
|
+
}
|
|
717
|
+
if (deny.length > 0) {
|
|
718
|
+
updateConfigFormValue(state, [...basePath, "deny"], deny);
|
|
719
|
+
} else {
|
|
720
|
+
removeConfigFormValue(state, [...basePath, "deny"]);
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
onConfigReload: () => loadConfig(state),
|
|
724
|
+
onConfigSave: () => saveConfig(state),
|
|
725
|
+
onChannelsRefresh: () => loadChannels(state, false),
|
|
726
|
+
onCronRefresh: () => state.loadCron(),
|
|
727
|
+
onSkillsFilterChange: (next) => (state.skillsFilter = next),
|
|
728
|
+
onSkillsRefresh: () => {
|
|
729
|
+
if (resolvedAgentId) {
|
|
730
|
+
void loadAgentSkills(state, resolvedAgentId);
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
onAgentSkillToggle: (agentId, skillName, enabled) => {
|
|
734
|
+
if (!configValue) {
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list;
|
|
738
|
+
if (!Array.isArray(list)) {
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
const index = list.findIndex(
|
|
742
|
+
(entry) =>
|
|
743
|
+
entry &&
|
|
744
|
+
typeof entry === "object" &&
|
|
745
|
+
"id" in entry &&
|
|
746
|
+
(entry as { id?: string }).id === agentId,
|
|
747
|
+
);
|
|
748
|
+
if (index < 0) {
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
const entry = list[index] as { skills?: unknown };
|
|
752
|
+
const normalizedSkill = skillName.trim();
|
|
753
|
+
if (!normalizedSkill) {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
const allSkills =
|
|
757
|
+
state.agentSkillsReport?.skills?.map((skill) => skill.name).filter(Boolean) ??
|
|
758
|
+
[];
|
|
759
|
+
const existing = Array.isArray(entry.skills)
|
|
760
|
+
? entry.skills.map((name) => String(name).trim()).filter(Boolean)
|
|
761
|
+
: undefined;
|
|
762
|
+
const base = existing ?? allSkills;
|
|
763
|
+
const next = new Set(base);
|
|
764
|
+
if (enabled) {
|
|
765
|
+
next.add(normalizedSkill);
|
|
766
|
+
} else {
|
|
767
|
+
next.delete(normalizedSkill);
|
|
768
|
+
}
|
|
769
|
+
updateConfigFormValue(state, ["agents", "list", index, "skills"], [...next]);
|
|
770
|
+
},
|
|
771
|
+
onAgentSkillsClear: (agentId) => {
|
|
772
|
+
if (!configValue) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list;
|
|
776
|
+
if (!Array.isArray(list)) {
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
const index = list.findIndex(
|
|
780
|
+
(entry) =>
|
|
781
|
+
entry &&
|
|
782
|
+
typeof entry === "object" &&
|
|
783
|
+
"id" in entry &&
|
|
784
|
+
(entry as { id?: string }).id === agentId,
|
|
785
|
+
);
|
|
786
|
+
if (index < 0) {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
removeConfigFormValue(state, ["agents", "list", index, "skills"]);
|
|
790
|
+
},
|
|
791
|
+
onAgentSkillsDisableAll: (agentId) => {
|
|
792
|
+
if (!configValue) {
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list;
|
|
796
|
+
if (!Array.isArray(list)) {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
const index = list.findIndex(
|
|
800
|
+
(entry) =>
|
|
801
|
+
entry &&
|
|
802
|
+
typeof entry === "object" &&
|
|
803
|
+
"id" in entry &&
|
|
804
|
+
(entry as { id?: string }).id === agentId,
|
|
805
|
+
);
|
|
806
|
+
if (index < 0) {
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
updateConfigFormValue(state, ["agents", "list", index, "skills"], []);
|
|
810
|
+
},
|
|
811
|
+
onModelChange: (agentId, modelId) => {
|
|
812
|
+
if (!configValue) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list;
|
|
816
|
+
if (!Array.isArray(list)) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
const index = list.findIndex(
|
|
820
|
+
(entry) =>
|
|
821
|
+
entry &&
|
|
822
|
+
typeof entry === "object" &&
|
|
823
|
+
"id" in entry &&
|
|
824
|
+
(entry as { id?: string }).id === agentId,
|
|
825
|
+
);
|
|
826
|
+
if (index < 0) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
const basePath = ["agents", "list", index, "model"];
|
|
830
|
+
if (!modelId) {
|
|
831
|
+
removeConfigFormValue(state, basePath);
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
const entry = list[index] as { model?: unknown };
|
|
835
|
+
const existing = entry?.model;
|
|
836
|
+
if (existing && typeof existing === "object" && !Array.isArray(existing)) {
|
|
837
|
+
const fallbacks = (existing as { fallbacks?: unknown }).fallbacks;
|
|
838
|
+
const next = {
|
|
839
|
+
primary: modelId,
|
|
840
|
+
...(Array.isArray(fallbacks) ? { fallbacks } : {}),
|
|
841
|
+
};
|
|
842
|
+
updateConfigFormValue(state, basePath, next);
|
|
843
|
+
} else {
|
|
844
|
+
updateConfigFormValue(state, basePath, modelId);
|
|
845
|
+
}
|
|
846
|
+
},
|
|
847
|
+
onModelFallbacksChange: (agentId, fallbacks) => {
|
|
848
|
+
if (!configValue) {
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
const list = (configValue as { agents?: { list?: unknown[] } }).agents?.list;
|
|
852
|
+
if (!Array.isArray(list)) {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
const index = list.findIndex(
|
|
856
|
+
(entry) =>
|
|
857
|
+
entry &&
|
|
858
|
+
typeof entry === "object" &&
|
|
859
|
+
"id" in entry &&
|
|
860
|
+
(entry as { id?: string }).id === agentId,
|
|
861
|
+
);
|
|
862
|
+
if (index < 0) {
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
865
|
+
const basePath = ["agents", "list", index, "model"];
|
|
866
|
+
const entry = list[index] as { model?: unknown };
|
|
867
|
+
const normalized = fallbacks.map((name) => name.trim()).filter(Boolean);
|
|
868
|
+
const existing = entry.model;
|
|
869
|
+
const resolvePrimary = () => {
|
|
870
|
+
if (typeof existing === "string") {
|
|
871
|
+
return existing.trim() || null;
|
|
872
|
+
}
|
|
873
|
+
if (existing && typeof existing === "object" && !Array.isArray(existing)) {
|
|
874
|
+
const primary = (existing as { primary?: unknown }).primary;
|
|
875
|
+
if (typeof primary === "string") {
|
|
876
|
+
const trimmed = primary.trim();
|
|
877
|
+
return trimmed || null;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
return null;
|
|
881
|
+
};
|
|
882
|
+
const primary = resolvePrimary();
|
|
883
|
+
if (normalized.length === 0) {
|
|
884
|
+
if (primary) {
|
|
885
|
+
updateConfigFormValue(state, basePath, primary);
|
|
886
|
+
} else {
|
|
887
|
+
removeConfigFormValue(state, basePath);
|
|
888
|
+
}
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
const next = primary
|
|
892
|
+
? { primary, fallbacks: normalized }
|
|
893
|
+
: { fallbacks: normalized };
|
|
894
|
+
updateConfigFormValue(state, basePath, next);
|
|
895
|
+
},
|
|
896
|
+
})
|
|
897
|
+
: nothing
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
${
|
|
901
|
+
state.tab === "skills"
|
|
902
|
+
? renderSkills({
|
|
903
|
+
loading: state.skillsLoading,
|
|
904
|
+
report: state.skillsReport,
|
|
905
|
+
error: state.skillsError,
|
|
906
|
+
filter: state.skillsFilter,
|
|
907
|
+
edits: state.skillEdits,
|
|
908
|
+
messages: state.skillMessages,
|
|
909
|
+
busyKey: state.skillsBusyKey,
|
|
910
|
+
onFilterChange: (next) => (state.skillsFilter = next),
|
|
911
|
+
onRefresh: () => loadSkills(state, { clearMessages: true }),
|
|
912
|
+
onToggle: (key, enabled) => updateSkillEnabled(state, key, enabled),
|
|
913
|
+
onEdit: (key, value) => updateSkillEdit(state, key, value),
|
|
914
|
+
onSaveKey: (key) => saveSkillApiKey(state, key),
|
|
915
|
+
onInstall: (skillKey, name, installId) =>
|
|
916
|
+
installSkill(state, skillKey, name, installId),
|
|
917
|
+
})
|
|
918
|
+
: nothing
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
${
|
|
922
|
+
state.tab === "nodes"
|
|
923
|
+
? renderNodes({
|
|
924
|
+
loading: state.nodesLoading,
|
|
925
|
+
nodes: state.nodes,
|
|
926
|
+
devicesLoading: state.devicesLoading,
|
|
927
|
+
devicesError: state.devicesError,
|
|
928
|
+
devicesList: state.devicesList,
|
|
929
|
+
configForm:
|
|
930
|
+
state.configForm ??
|
|
931
|
+
(state.configSnapshot?.config as Record<string, unknown> | null),
|
|
932
|
+
configLoading: state.configLoading,
|
|
933
|
+
configSaving: state.configSaving,
|
|
934
|
+
configDirty: state.configFormDirty,
|
|
935
|
+
configFormMode: state.configFormMode,
|
|
936
|
+
execApprovalsLoading: state.execApprovalsLoading,
|
|
937
|
+
execApprovalsSaving: state.execApprovalsSaving,
|
|
938
|
+
execApprovalsDirty: state.execApprovalsDirty,
|
|
939
|
+
execApprovalsSnapshot: state.execApprovalsSnapshot,
|
|
940
|
+
execApprovalsForm: state.execApprovalsForm,
|
|
941
|
+
execApprovalsSelectedAgent: state.execApprovalsSelectedAgent,
|
|
942
|
+
execApprovalsTarget: state.execApprovalsTarget,
|
|
943
|
+
execApprovalsTargetNodeId: state.execApprovalsTargetNodeId,
|
|
944
|
+
onRefresh: () => loadNodes(state),
|
|
945
|
+
onDevicesRefresh: () => loadDevices(state),
|
|
946
|
+
onDeviceApprove: (requestId) => approveDevicePairing(state, requestId),
|
|
947
|
+
onDeviceReject: (requestId) => rejectDevicePairing(state, requestId),
|
|
948
|
+
onDeviceRotate: (deviceId, role, scopes) =>
|
|
949
|
+
rotateDeviceToken(state, { deviceId, role, scopes }),
|
|
950
|
+
onDeviceRevoke: (deviceId, role) => revokeDeviceToken(state, { deviceId, role }),
|
|
951
|
+
onLoadConfig: () => loadConfig(state),
|
|
952
|
+
onLoadExecApprovals: () => {
|
|
953
|
+
const target =
|
|
954
|
+
state.execApprovalsTarget === "node" && state.execApprovalsTargetNodeId
|
|
955
|
+
? { kind: "node" as const, nodeId: state.execApprovalsTargetNodeId }
|
|
956
|
+
: { kind: "gateway" as const };
|
|
957
|
+
return loadExecApprovals(state, target);
|
|
958
|
+
},
|
|
959
|
+
onBindDefault: (nodeId) => {
|
|
960
|
+
if (nodeId) {
|
|
961
|
+
updateConfigFormValue(state, ["tools", "exec", "node"], nodeId);
|
|
962
|
+
} else {
|
|
963
|
+
removeConfigFormValue(state, ["tools", "exec", "node"]);
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
onBindAgent: (agentIndex, nodeId) => {
|
|
967
|
+
const basePath = ["agents", "list", agentIndex, "tools", "exec", "node"];
|
|
968
|
+
if (nodeId) {
|
|
969
|
+
updateConfigFormValue(state, basePath, nodeId);
|
|
970
|
+
} else {
|
|
971
|
+
removeConfigFormValue(state, basePath);
|
|
972
|
+
}
|
|
973
|
+
},
|
|
974
|
+
onSaveBindings: () => saveConfig(state),
|
|
975
|
+
onExecApprovalsTargetChange: (kind, nodeId) => {
|
|
976
|
+
state.execApprovalsTarget = kind;
|
|
977
|
+
state.execApprovalsTargetNodeId = nodeId;
|
|
978
|
+
state.execApprovalsSnapshot = null;
|
|
979
|
+
state.execApprovalsForm = null;
|
|
980
|
+
state.execApprovalsDirty = false;
|
|
981
|
+
state.execApprovalsSelectedAgent = null;
|
|
982
|
+
},
|
|
983
|
+
onExecApprovalsSelectAgent: (agentId) => {
|
|
984
|
+
state.execApprovalsSelectedAgent = agentId;
|
|
985
|
+
},
|
|
986
|
+
onExecApprovalsPatch: (path, value) =>
|
|
987
|
+
updateExecApprovalsFormValue(state, path, value),
|
|
988
|
+
onExecApprovalsRemove: (path) => removeExecApprovalsFormValue(state, path),
|
|
989
|
+
onSaveExecApprovals: () => {
|
|
990
|
+
const target =
|
|
991
|
+
state.execApprovalsTarget === "node" && state.execApprovalsTargetNodeId
|
|
992
|
+
? { kind: "node" as const, nodeId: state.execApprovalsTargetNodeId }
|
|
993
|
+
: { kind: "gateway" as const };
|
|
994
|
+
return saveExecApprovals(state, target);
|
|
995
|
+
},
|
|
996
|
+
})
|
|
997
|
+
: nothing
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
${
|
|
1001
|
+
state.tab === "chat"
|
|
1002
|
+
? renderChat({
|
|
1003
|
+
sessionKey: state.sessionKey,
|
|
1004
|
+
onSessionKeyChange: (next) => {
|
|
1005
|
+
state.sessionKey = next;
|
|
1006
|
+
state.chatMessage = "";
|
|
1007
|
+
state.chatAttachments = [];
|
|
1008
|
+
state.chatStream = null;
|
|
1009
|
+
state.chatStreamStartedAt = null;
|
|
1010
|
+
state.chatRunId = null;
|
|
1011
|
+
state.chatQueue = [];
|
|
1012
|
+
state.resetToolStream();
|
|
1013
|
+
state.resetChatScroll();
|
|
1014
|
+
state.applySettings({
|
|
1015
|
+
...state.settings,
|
|
1016
|
+
sessionKey: next,
|
|
1017
|
+
lastActiveSessionKey: next,
|
|
1018
|
+
});
|
|
1019
|
+
void state.loadAssistantIdentity();
|
|
1020
|
+
void loadChatHistory(state);
|
|
1021
|
+
void refreshChatAvatar(state);
|
|
1022
|
+
},
|
|
1023
|
+
thinkingLevel: state.chatThinkingLevel,
|
|
1024
|
+
showThinking,
|
|
1025
|
+
loading: state.chatLoading,
|
|
1026
|
+
sending: state.chatSending,
|
|
1027
|
+
compactionStatus: state.compactionStatus,
|
|
1028
|
+
fallbackStatus: state.fallbackStatus,
|
|
1029
|
+
assistantAvatarUrl: chatAvatarUrl,
|
|
1030
|
+
messages: state.chatMessages,
|
|
1031
|
+
toolMessages: state.chatToolMessages,
|
|
1032
|
+
stream: state.chatStream,
|
|
1033
|
+
streamStartedAt: state.chatStreamStartedAt,
|
|
1034
|
+
draft: state.chatMessage,
|
|
1035
|
+
queue: state.chatQueue,
|
|
1036
|
+
connected: state.connected,
|
|
1037
|
+
canSend: state.connected,
|
|
1038
|
+
disabledReason: chatDisabledReason,
|
|
1039
|
+
error: state.lastError,
|
|
1040
|
+
sessions: state.sessionsResult,
|
|
1041
|
+
focusMode: chatFocus,
|
|
1042
|
+
onRefresh: () => {
|
|
1043
|
+
state.resetToolStream();
|
|
1044
|
+
return Promise.all([loadChatHistory(state), refreshChatAvatar(state)]);
|
|
1045
|
+
},
|
|
1046
|
+
onToggleFocusMode: () => {
|
|
1047
|
+
if (state.onboarding) {
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
state.applySettings({
|
|
1051
|
+
...state.settings,
|
|
1052
|
+
chatFocusMode: !state.settings.chatFocusMode,
|
|
1053
|
+
});
|
|
1054
|
+
},
|
|
1055
|
+
onChatScroll: (event) => state.handleChatScroll(event),
|
|
1056
|
+
onDraftChange: (next) => (state.chatMessage = next),
|
|
1057
|
+
attachments: state.chatAttachments,
|
|
1058
|
+
onAttachmentsChange: (next) => (state.chatAttachments = next),
|
|
1059
|
+
onSend: () => state.handleSendChat(),
|
|
1060
|
+
canAbort: Boolean(state.chatRunId),
|
|
1061
|
+
onAbort: () => void state.handleAbortChat(),
|
|
1062
|
+
onQueueRemove: (id) => state.removeQueuedMessage(id),
|
|
1063
|
+
onNewSession: () => state.handleSendChat("/new", { restoreDraft: true }),
|
|
1064
|
+
showNewMessages: state.chatNewMessagesBelow && !state.chatManualRefreshInFlight,
|
|
1065
|
+
onScrollToBottom: () => state.scrollToBottom(),
|
|
1066
|
+
// Sidebar props for tool output viewing
|
|
1067
|
+
sidebarOpen: state.sidebarOpen,
|
|
1068
|
+
sidebarContent: state.sidebarContent,
|
|
1069
|
+
sidebarError: state.sidebarError,
|
|
1070
|
+
splitRatio: state.splitRatio,
|
|
1071
|
+
onOpenSidebar: (content: string) => state.handleOpenSidebar(content),
|
|
1072
|
+
onCloseSidebar: () => state.handleCloseSidebar(),
|
|
1073
|
+
onSplitRatioChange: (ratio: number) => state.handleSplitRatioChange(ratio),
|
|
1074
|
+
assistantName: state.assistantName,
|
|
1075
|
+
assistantAvatar: state.assistantAvatar,
|
|
1076
|
+
})
|
|
1077
|
+
: nothing
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
${
|
|
1081
|
+
state.tab === "config"
|
|
1082
|
+
? renderConfig({
|
|
1083
|
+
raw: state.configRaw,
|
|
1084
|
+
originalRaw: state.configRawOriginal,
|
|
1085
|
+
valid: state.configValid,
|
|
1086
|
+
issues: state.configIssues,
|
|
1087
|
+
loading: state.configLoading,
|
|
1088
|
+
saving: state.configSaving,
|
|
1089
|
+
applying: state.configApplying,
|
|
1090
|
+
updating: state.updateRunning,
|
|
1091
|
+
connected: state.connected,
|
|
1092
|
+
schema: state.configSchema,
|
|
1093
|
+
schemaLoading: state.configSchemaLoading,
|
|
1094
|
+
uiHints: state.configUiHints,
|
|
1095
|
+
formMode: state.configFormMode,
|
|
1096
|
+
formValue: state.configForm,
|
|
1097
|
+
originalValue: state.configFormOriginal,
|
|
1098
|
+
searchQuery: state.configSearchQuery,
|
|
1099
|
+
activeSection: state.configActiveSection,
|
|
1100
|
+
activeSubsection: state.configActiveSubsection,
|
|
1101
|
+
onRawChange: (next) => {
|
|
1102
|
+
state.configRaw = next;
|
|
1103
|
+
},
|
|
1104
|
+
onFormModeChange: (mode) => (state.configFormMode = mode),
|
|
1105
|
+
onFormPatch: (path, value) => updateConfigFormValue(state, path, value),
|
|
1106
|
+
onSearchChange: (query) => (state.configSearchQuery = query),
|
|
1107
|
+
onSectionChange: (section) => {
|
|
1108
|
+
state.configActiveSection = section;
|
|
1109
|
+
state.configActiveSubsection = null;
|
|
1110
|
+
},
|
|
1111
|
+
onSubsectionChange: (section) => (state.configActiveSubsection = section),
|
|
1112
|
+
onReload: () => loadConfig(state),
|
|
1113
|
+
onSave: () => saveConfig(state),
|
|
1114
|
+
onApply: () => applyConfig(state),
|
|
1115
|
+
onUpdate: () => runUpdate(state),
|
|
1116
|
+
})
|
|
1117
|
+
: nothing
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
${
|
|
1121
|
+
state.tab === "debug"
|
|
1122
|
+
? renderDebug({
|
|
1123
|
+
loading: state.debugLoading,
|
|
1124
|
+
status: state.debugStatus,
|
|
1125
|
+
health: state.debugHealth,
|
|
1126
|
+
models: state.debugModels,
|
|
1127
|
+
heartbeat: state.debugHeartbeat,
|
|
1128
|
+
eventLog: state.eventLog,
|
|
1129
|
+
callMethod: state.debugCallMethod,
|
|
1130
|
+
callParams: state.debugCallParams,
|
|
1131
|
+
callResult: state.debugCallResult,
|
|
1132
|
+
callError: state.debugCallError,
|
|
1133
|
+
onCallMethodChange: (next) => (state.debugCallMethod = next),
|
|
1134
|
+
onCallParamsChange: (next) => (state.debugCallParams = next),
|
|
1135
|
+
onRefresh: () => loadDebug(state),
|
|
1136
|
+
onCall: () => callDebugMethod(state),
|
|
1137
|
+
})
|
|
1138
|
+
: nothing
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
${
|
|
1142
|
+
state.tab === "logs"
|
|
1143
|
+
? renderLogs({
|
|
1144
|
+
loading: state.logsLoading,
|
|
1145
|
+
error: state.logsError,
|
|
1146
|
+
file: state.logsFile,
|
|
1147
|
+
entries: state.logsEntries,
|
|
1148
|
+
filterText: state.logsFilterText,
|
|
1149
|
+
levelFilters: state.logsLevelFilters,
|
|
1150
|
+
autoFollow: state.logsAutoFollow,
|
|
1151
|
+
truncated: state.logsTruncated,
|
|
1152
|
+
onFilterTextChange: (next) => (state.logsFilterText = next),
|
|
1153
|
+
onLevelToggle: (level, enabled) => {
|
|
1154
|
+
state.logsLevelFilters = { ...state.logsLevelFilters, [level]: enabled };
|
|
1155
|
+
},
|
|
1156
|
+
onToggleAutoFollow: (next) => (state.logsAutoFollow = next),
|
|
1157
|
+
onRefresh: () => loadLogs(state, { reset: true }),
|
|
1158
|
+
onExport: (lines, label) => state.exportLogs(lines, label),
|
|
1159
|
+
onScroll: (event) => state.handleLogsScroll(event),
|
|
1160
|
+
})
|
|
1161
|
+
: nothing
|
|
1162
|
+
}
|
|
1163
|
+
</main>
|
|
1164
|
+
${renderExecApprovalPrompt(state)}
|
|
1165
|
+
${renderGatewayUrlConfirmation(state)}
|
|
1166
|
+
</div>
|
|
1167
|
+
`;
|
|
1168
|
+
}
|