shadow-claw 1.26.0 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/main/skill-creator/SKILL.md +39 -0
- package/.agents/skills/main/skill-creator/references/declarative-pipelines.md +44 -0
- package/.agents/skills/main/skill-creator/references/declarative-tools.md +35 -0
- package/.agents/skills/main/skill-creator/references/frontmatter-spec.md +50 -0
- package/.well-known/agent-skills/index.json +14 -0
- package/README.md +5 -3
- package/bin/build/build.mjs +146 -15
- package/bin/build/build.test.mjs +57 -0
- package/bin/cli.mjs +26 -0
- package/bin/commands/mcp.mjs +277 -55
- package/bin/commands/mcp.test.mjs +275 -1
- package/bin/commands/skills-index.mjs +328 -0
- package/bin/commands/skills-index.test.mjs +161 -0
- package/bin/site-config/utils/custom-elements/get-approved-custom-element-scripts.test.mjs +2 -0
- package/bin/site-config/utils/custom-elements/sanitize-embedded-custom-element-scripts.test.mjs +10 -1
- package/dist/lib/components/index.js +25 -25
- package/dist/lib/components/settings/shadow-claw-accounts.js +1 -1
- package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/settings/shadow-claw-git.js +1 -1
- package/dist/lib/components/settings/shadow-claw-integrations.js +1 -1
- package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
- package/dist/lib/components/settings/shadow-claw-mcp-remote.js +1 -1
- package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
- package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
- package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw-a2ui.js +1 -1
- package/dist/lib/components/shadow-claw-accounts.js +1 -1
- package/dist/lib/components/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/shadow-claw-channels.js +1 -1
- package/dist/lib/components/shadow-claw-chat.js +1 -1
- package/dist/lib/components/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/shadow-claw-conversations.js +1 -1
- package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
- package/dist/lib/components/shadow-claw-files.js +1 -1
- package/dist/lib/components/shadow-claw-git.js +1 -1
- package/dist/lib/components/shadow-claw-integrations.js +1 -1
- package/dist/lib/components/shadow-claw-llm.js +1 -1
- package/dist/lib/components/shadow-claw-mcp-remote.js +1 -1
- package/dist/lib/components/shadow-claw-networking.js +1 -1
- package/dist/lib/components/shadow-claw-page-header.js +1 -1
- package/dist/lib/components/shadow-claw-pages.js +1 -1
- package/dist/lib/components/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/shadow-claw-settings.js +1 -1
- package/dist/lib/components/shadow-claw-storage.js +1 -1
- package/dist/lib/components/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/shadow-claw-tasks.js +1 -1
- package/dist/lib/components/shadow-claw-terminal.js +1 -1
- package/dist/lib/components/shadow-claw-tools.js +1 -1
- package/dist/lib/components/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw.js +1 -1
- package/dist/lib/{configurePeerJs-CrlGan0m.js → configurePeerJs-oODzltaC.js} +2 -2
- package/dist/lib/{configurePeerJs-CrlGan0m.js.map → configurePeerJs-oODzltaC.js.map} +1 -1
- package/dist/lib/core/control-plane-client.d.ts +1 -0
- package/dist/lib/{downloadGroupFile-DboUjmp2.js → downloadGroupFile-DmcBQU1n.js} +2 -2
- package/dist/lib/{downloadGroupFile-DboUjmp2.js.map → downloadGroupFile-DmcBQU1n.js.map} +1 -1
- package/dist/lib/{file-viewer-BrK2Wxgh.js → file-viewer-C3YKnq_-.js} +4 -3
- package/dist/lib/{file-viewer-BrK2Wxgh.js.map → file-viewer-C3YKnq_-.js.map} +1 -1
- package/dist/lib/index.js +26 -26
- package/dist/lib/{initControlPlane-CsO4UR6_.js → initControlPlane-C2zURVIS.js} +86 -13
- package/dist/lib/initControlPlane-C2zURVIS.js.map +1 -0
- package/dist/lib/{markdown-eeSTFnMA.js → markdown-C6EHl9zs.js} +3 -3
- package/dist/lib/{markdown-eeSTFnMA.js.map → markdown-C6EHl9zs.js.map} +1 -1
- package/dist/lib/{orchestrator-CJvoC2Uu.js → orchestrator-CACLa_Ro.js} +7 -6
- package/dist/lib/{orchestrator-CJvoC2Uu.js.map → orchestrator-CACLa_Ro.js.map} +1 -1
- package/dist/lib/{orchestrator-DCfomsn9.js → orchestrator-KRjx0eba.js} +6 -534
- package/dist/lib/{orchestrator-DCfomsn9.js.map → orchestrator-KRjx0eba.js.map} +1 -1
- package/dist/lib/parsePath-DwC_YZjw.js +16 -0
- package/dist/lib/parsePath-DwC_YZjw.js.map +1 -0
- package/dist/lib/{peerjs-Dp02bXcG.js → peerjs-DFWOBcXf.js} +4 -4
- package/dist/lib/{peerjs-Dp02bXcG.js.map → peerjs-DFWOBcXf.js.map} +1 -1
- package/dist/lib/{readGroupFileBytes-Bve-e5e_.js → readGroupFileBytes-C8oOe8Iu.js} +3 -16
- package/dist/lib/readGroupFileBytes-C8oOe8Iu.js.map +1 -0
- package/dist/lib/security/custom-element-security.d.ts +8 -0
- package/dist/lib/server/control-plane-types.d.ts +1 -1
- package/dist/lib/{shadow-claw-D8xINM3c.js → shadow-claw-6UHdiy4a.js} +5 -5
- package/dist/lib/{shadow-claw-D8xINM3c.js.map → shadow-claw-6UHdiy4a.js.map} +1 -1
- package/dist/lib/{shadow-claw-a2ui-7rJqG4Ke.js → shadow-claw-a2ui-CpZUTzlh.js} +5 -4
- package/dist/lib/{shadow-claw-a2ui-7rJqG4Ke.js.map → shadow-claw-a2ui-CpZUTzlh.js.map} +1 -1
- package/dist/lib/{shadow-claw-accounts-CdruwN8A.js → shadow-claw-accounts-03oJ__XC.js} +2 -2
- package/dist/lib/{shadow-claw-accounts-CdruwN8A.js.map → shadow-claw-accounts-03oJ__XC.js.map} +1 -1
- package/dist/lib/{shadow-claw-channel-config-Bj0-Nk3t.js → shadow-claw-channel-config-DmfwJc6G.js} +3 -3
- package/dist/lib/{shadow-claw-channel-config-Bj0-Nk3t.js.map → shadow-claw-channel-config-DmfwJc6G.js.map} +1 -1
- package/dist/lib/{shadow-claw-channels-C_jI4KhP.js → shadow-claw-channels-1N6Jl-By.js} +3 -3
- package/dist/lib/{shadow-claw-channels-C_jI4KhP.js.map → shadow-claw-channels-1N6Jl-By.js.map} +1 -1
- package/dist/lib/{shadow-claw-chat-B16MspoP.js → shadow-claw-chat-BMoqQJRK.js} +10 -10
- package/dist/lib/{shadow-claw-chat-B16MspoP.js.map → shadow-claw-chat-BMoqQJRK.js.map} +1 -1
- package/dist/lib/{shadow-claw-control-plane-x8Ldid_h.js → shadow-claw-control-plane-UG0o7pCz.js} +6 -6
- package/dist/lib/{shadow-claw-control-plane-x8Ldid_h.js.map → shadow-claw-control-plane-UG0o7pCz.js.map} +1 -1
- package/dist/lib/{shadow-claw-conversations-Ct1kAYdB.js → shadow-claw-conversations-BwXep3iu.js} +4 -3
- package/dist/lib/{shadow-claw-conversations-Ct1kAYdB.js.map → shadow-claw-conversations-BwXep3iu.js.map} +1 -1
- package/dist/lib/{shadow-claw-file-viewer-BfDHHgpA.js → shadow-claw-file-viewer-DUxzVxDT.js} +14 -10
- package/dist/lib/shadow-claw-file-viewer-DUxzVxDT.js.map +1 -0
- package/dist/lib/{shadow-claw-files-EYhOPYIH.js → shadow-claw-files-DIREEnT2.js} +7 -7
- package/dist/lib/{shadow-claw-files-EYhOPYIH.js.map → shadow-claw-files-DIREEnT2.js.map} +1 -1
- package/dist/lib/{shadow-claw-git-tcSpT-P0.js → shadow-claw-git-Bg1SWgsF.js} +4 -4
- package/dist/lib/{shadow-claw-git-tcSpT-P0.js.map → shadow-claw-git-Bg1SWgsF.js.map} +1 -1
- package/dist/lib/{shadow-claw-integrations-NbcCx_ZI.js → shadow-claw-integrations-Ds-CLPhj.js} +2 -2
- package/dist/lib/{shadow-claw-integrations-NbcCx_ZI.js.map → shadow-claw-integrations-Ds-CLPhj.js.map} +1 -1
- package/dist/lib/{shadow-claw-llm-BazJdD5f.js → shadow-claw-llm-CazBrVpM.js} +3 -3
- package/dist/lib/{shadow-claw-llm-BazJdD5f.js.map → shadow-claw-llm-CazBrVpM.js.map} +1 -1
- package/dist/lib/{shadow-claw-mcp-remote-CYmhpg7a.js → shadow-claw-mcp-remote-CT5Q-54E.js} +2 -2
- package/dist/lib/{shadow-claw-mcp-remote-CYmhpg7a.js.map → shadow-claw-mcp-remote-CT5Q-54E.js.map} +1 -1
- package/dist/lib/{shadow-claw-networking-DImPxe0H.js → shadow-claw-networking-Df85tCbO.js} +2 -2
- package/dist/lib/{shadow-claw-networking-DImPxe0H.js.map → shadow-claw-networking-Df85tCbO.js.map} +1 -1
- package/dist/lib/{shadow-claw-page-header-CcHUfFUx.js → shadow-claw-page-header-Cti2fzf-.js} +2 -2
- package/dist/lib/{shadow-claw-page-header-CcHUfFUx.js.map → shadow-claw-page-header-Cti2fzf-.js.map} +1 -1
- package/dist/lib/{shadow-claw-pages-D54jF1Qq.js → shadow-claw-pages-BgPyIEZO.js} +15 -11
- package/dist/lib/shadow-claw-pages-BgPyIEZO.js.map +1 -0
- package/dist/lib/{shadow-claw-peerjs-B9-T8Nlx.js → shadow-claw-peerjs-xkBXILed.js} +3 -3
- package/dist/lib/{shadow-claw-peerjs-B9-T8Nlx.js.map → shadow-claw-peerjs-xkBXILed.js.map} +1 -1
- package/dist/lib/{shadow-claw-settings-Bt1VAe-1.js → shadow-claw-settings-CN89xRVU.js} +4 -4
- package/dist/lib/{shadow-claw-settings-Bt1VAe-1.js.map → shadow-claw-settings-CN89xRVU.js.map} +1 -1
- package/dist/lib/{shadow-claw-storage-CFOjGf1d.js → shadow-claw-storage-VnhcObCe.js} +3 -3
- package/dist/lib/{shadow-claw-storage-CFOjGf1d.js.map → shadow-claw-storage-VnhcObCe.js.map} +1 -1
- package/dist/lib/{shadow-claw-task-server-BiKa2GOm.js → shadow-claw-task-server-jgEC2hHB.js} +2 -2
- package/dist/lib/{shadow-claw-task-server-BiKa2GOm.js.map → shadow-claw-task-server-jgEC2hHB.js.map} +1 -1
- package/dist/lib/{shadow-claw-tasks-DDHd8W4d.js → shadow-claw-tasks-i_evIufy.js} +6 -6
- package/dist/lib/{shadow-claw-tasks-DDHd8W4d.js.map → shadow-claw-tasks-i_evIufy.js.map} +1 -1
- package/dist/lib/{shadow-claw-terminal-kB6_tWKz.js → shadow-claw-terminal-CwScROlu.js} +2 -2
- package/dist/lib/{shadow-claw-terminal-kB6_tWKz.js.map → shadow-claw-terminal-CwScROlu.js.map} +1 -1
- package/dist/lib/{shadow-claw-tools-DxXIm0ku.js → shadow-claw-tools-DD3fyXP4.js} +5 -4
- package/dist/lib/{shadow-claw-tools-DxXIm0ku.js.map → shadow-claw-tools-DD3fyXP4.js.map} +1 -1
- package/dist/lib/{shadow-claw-webvm-Dc8oo7ao.js → shadow-claw-webvm-DbJq4I3-.js} +2 -2
- package/dist/lib/{shadow-claw-webvm-Dc8oo7ao.js.map → shadow-claw-webvm-DbJq4I3-.js.map} +1 -1
- package/dist/lib/{syncWebMcpRegistration-jyRGbC9w.js → syncWebMcpRegistration-DNLnQ-jz.js} +3 -2
- package/dist/lib/{syncWebMcpRegistration-jyRGbC9w.js.map → syncWebMcpRegistration-DNLnQ-jz.js.map} +1 -1
- package/dist/lib/tools-DwwB9RBa.js +546 -0
- package/dist/lib/tools-DwwB9RBa.js.map +1 -0
- package/dist/lib/{trusted-types-CkLDpLiZ.js → trusted-types-Dx0RZlrd.js} +19 -8
- package/dist/lib/trusted-types-Dx0RZlrd.js.map +1 -0
- package/dist/lib/utils/index.js +1 -1
- package/dist/lib/utils/utils.js +1 -1
- package/dist/public/.well-known/agent-skills/index.json +14 -0
- package/dist/public/AGENTS.md +5 -3
- package/dist/public/README.md +5 -3
- package/dist/public/agent.worker.js +1 -1
- package/dist/public/{configurePeerJs-COcwE0E7.js → configurePeerJs-BqgeBjP7.js} +1 -1
- package/dist/public/custom-element-security-FU04Cq05.js +1 -0
- package/dist/public/dist-B9m1QM9v.js +58 -0
- package/dist/public/docs/README.md +31 -31
- package/dist/public/docs/example/article/index.html +1 -1
- package/dist/public/docs/publishing/index.html +1 -1
- package/dist/public/docs/skill-creator/index.html +1 -1
- package/dist/public/docs/subsystems/a2ui.md +11 -1
- package/dist/public/docs/subsystems/cli.md +29 -0
- package/dist/public/docs/subsystems/control-plane.md +8 -2
- package/dist/public/docs/subsystems/custom-element-security.md +19 -9
- package/dist/public/docs/subsystems/mcp-server.md +39 -15
- package/dist/public/docs/subsystems/skills.md +30 -0
- package/dist/public/docs/subsystems/webmcp.md +9 -0
- package/dist/public/downloadGroupFile-D8KRJGGL.js +1 -0
- package/dist/public/e2e/README.md +7 -4
- package/dist/public/{e2e-bridge-CHARpbpW.js → e2e-bridge-Ceqr5kGc.js} +1 -1
- package/dist/public/effect-BJCrpFdp.js +1 -0
- package/dist/public/file-viewer-C-6Jc_tb.js +1 -0
- package/dist/public/index.html +1 -1
- package/dist/public/index.js +1 -1
- package/dist/public/initControlPlane-BN9cWyO0.js +1 -0
- package/dist/public/main/index.html +1 -1
- package/dist/public/main/memory/index.html +1 -1
- package/dist/public/{markdown-1I3O6Mmd.js → markdown-C3M4OW_A.js} +1 -1
- package/dist/public/{orchestrator-Cl95w2vb.js → orchestrator-CMbCTjBf.js} +7 -7
- package/dist/public/{orchestrator-D-xlXG92.js → orchestrator-DHjdLtqa.js} +663 -663
- package/dist/public/peerjs-DUCKH-m9.js +1 -0
- package/dist/public/service-worker.js +1 -1
- package/dist/public/{shadow-claw-CaoKmIIB.js → shadow-claw-EAt2ml5Y.js} +3 -3
- package/dist/public/{shadow-claw-accounts-CJvYC4li.js → shadow-claw-accounts-xUOLBsQZ.js} +1 -1
- package/dist/public/{shadow-claw-channels-3K62sU5f.js → shadow-claw-channels-XsfuWFF8.js} +4 -4
- package/dist/public/{shadow-claw-chat-Cu2keU2I.js → shadow-claw-chat-CbSaOZ4q.js} +7 -7
- package/dist/public/{shadow-claw-control-plane-D1OwlQI_.js → shadow-claw-control-plane-DHvN3Ukg.js} +2 -2
- package/dist/public/{shadow-claw-conversations-DDtg3BEZ.js → shadow-claw-conversations-BWs5VVfs.js} +2 -2
- package/dist/public/{shadow-claw-file-viewer-BR__1z9S.js → shadow-claw-file-viewer-BWsoW5QS.js} +5 -4
- package/dist/public/{shadow-claw-files-BJSyZ-Bl.js → shadow-claw-files-CG7MqWiV.js} +8 -8
- package/dist/public/{shadow-claw-git-MAjhXRLc.js → shadow-claw-git-DBRPZNav.js} +6 -6
- package/dist/public/{shadow-claw-integrations-82UoFuDR.js → shadow-claw-integrations-BBVnO0Fc.js} +8 -8
- package/dist/public/{shadow-claw-llm-R8j0lwPP.js → shadow-claw-llm-DMvLgKXo.js} +2 -2
- package/dist/public/{shadow-claw-mcp-remote-BzZoz4LX.js → shadow-claw-mcp-remote-Bkx0gsmF.js} +2 -2
- package/dist/public/{shadow-claw-networking-DLEd9cNm.js → shadow-claw-networking-Dd8Rw31D.js} +2 -2
- package/dist/public/{shadow-claw-notifications-1vwR7TbT.js → shadow-claw-notifications-Dbevj-lq.js} +2 -2
- package/dist/public/{shadow-claw-page-header-DMKbkv3s.js → shadow-claw-page-header-BccSHItx.js} +1 -1
- package/dist/public/{shadow-claw-pages-CjyeIV__.js → shadow-claw-pages-3_lQAv0t.js} +4 -3
- package/dist/public/{shadow-claw-settings-BfbT4dBU.js → shadow-claw-settings-t8TIlgrM.js} +5 -5
- package/dist/public/{shadow-claw-storage-C-mWQQML.js → shadow-claw-storage-CfEXoSIE.js} +2 -2
- package/dist/public/{shadow-claw-task-server-D3lHp0Nc.js → shadow-claw-task-server-DxQSsgRZ.js} +2 -2
- package/dist/public/{shadow-claw-tasks-DVVWEm-c.js → shadow-claw-tasks-DNpicQwz.js} +14 -14
- package/dist/public/{shadow-claw-terminal-BwuTRp-O.js → shadow-claw-terminal-DpY6zU_r.js} +1 -1
- package/dist/public/{shadow-claw-toast-ClCwgzFG.js → shadow-claw-toast-BkrQIP-3.js} +1 -1
- package/dist/public/{shadow-claw-tools-zFLk2nbV.js → shadow-claw-tools-WSwWohnk.js} +2 -2
- package/dist/public/{shadow-claw-webvm-qR9X7fg7.js → shadow-claw-webvm-CP6oFjg5.js} +2 -2
- package/dist/public/syncWebMcpRegistration-DOn9gLnD.js +1 -0
- package/dist/public/toast-BXgUfbyh.js +1 -0
- package/dist/public/tools-DvckJZG2.js +1 -0
- package/dist/server.js +188 -188
- package/package.json +3 -1
- package/src/components/shadow-claw-a2ui/shadow-claw-a2ui.stories.ts +1380 -93
- package/src/components/shadow-claw-a2ui/shadow-claw-a2ui.ts +11 -6
- package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.test.ts +8 -1
- package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.ts +13 -5
- package/src/components/shadow-claw-pages/utils/buildHtmlPageSrcdoc.ts +13 -5
- package/src/core/control-plane-client.ts +15 -0
- package/src/core/utils/initControlPlane.test.ts +187 -0
- package/src/core/utils/initControlPlane.ts +194 -20
- package/src/security/custom-element-security.test.ts +51 -0
- package/src/security/custom-element-security.ts +33 -15
- package/src/server/control-plane-types.ts +1 -0
- package/src/server/control-plane.test.ts +69 -0
- package/src/server/control-plane.ts +45 -3
- package/src/server/mcp/tools/built-in-tools.ts +80 -5
- package/src/server/mcp/tools/client-tool-relay.ts +183 -26
- package/src/server/mcp/tools/mcp-tools.test.ts +140 -0
- package/src/server/middleware/static-files.test.ts +142 -0
- package/src/server/middleware/static-files.ts +66 -8
- package/src/testing/jest-setup.ts +1 -0
- package/src/worker/utils/handleMessage.ts +4 -1
- package/dist/lib/initControlPlane-CsO4UR6_.js.map +0 -1
- package/dist/lib/readGroupFileBytes-Bve-e5e_.js.map +0 -1
- package/dist/lib/shadow-claw-file-viewer-BfDHHgpA.js.map +0 -1
- package/dist/lib/shadow-claw-pages-D54jF1Qq.js.map +0 -1
- package/dist/lib/trusted-types-CkLDpLiZ.js.map +0 -1
- package/dist/public/custom-element-security-NCqQ5lmC.js +0 -1
- package/dist/public/downloadGroupFile-G0BZQgQg.js +0 -1
- package/dist/public/effect-rHYr4nfu.js +0 -1
- package/dist/public/file-viewer-8PdCURDD.js +0 -1
- package/dist/public/initControlPlane-CcGXax0A.js +0 -1
- package/dist/public/peerjs-BZdxWQFv.js +0 -1
- package/dist/public/syncWebMcpRegistration-DD42YsYV.js +0 -1
- package/dist/public/toast-HAq8XWFj.js +0 -58
|
@@ -5,12 +5,14 @@ import { a as getStorageStatus, i as getStorageRoot, o as invalidateStorageRoot,
|
|
|
5
5
|
import { C as PROVIDERS, F as getProvider, I as getProviderApiKeyConfigKey, O as buildTriggerPattern, P as getModelMaxTokens, R as modelRegistry, c as DEFAULT_PROMPT_API_FALLBACK_MODEL, d as DEFAULT_TASK_SERVER_URL, m as FETCH_MAX_RESPONSE, n as BASH_MAX_TIMEOUT_SEC, o as DEFAULT_GROUP_ID, p as DEFAULT_VM_NETWORK_RELAY_URL, r as CONFIG_KEYS, t as ASSISTANT_NAME, u as DEFAULT_SUBAGENT_WORKSPACE_MODE, y as LLAMAFILE_PROXY_URL } from "./config--CFrw3J3.js";
|
|
6
6
|
import { n as applyBasePath } from "./app-routes-CqBOeA5q.js";
|
|
7
7
|
import { t as getConfig } from "./getConfig-BxxXMyuM.js";
|
|
8
|
-
import {
|
|
8
|
+
import { t as parsePath } from "./parsePath-DwC_YZjw.js";
|
|
9
|
+
import { a as DEFAULT_BUILTIN_PROFILE, o as readGroupFile, r as findDeclarativeTool, t as toolsStore } from "./tools-DwwB9RBa.js";
|
|
10
|
+
import { t as readGroupFileBytes } from "./readGroupFileBytes-C8oOe8Iu.js";
|
|
9
11
|
import { t as setConfig } from "./setConfig-BFED5CXn.js";
|
|
10
12
|
import { ulid } from "./utils/ulid.js";
|
|
11
13
|
import { i as BASIC_CATALOG_REFERENCE, r as A2UI_BASIC_CATALOG_ID, t as TOOL_DEFINITIONS } from "./tools-DBaMRiEu.js";
|
|
12
14
|
import "./tools-D4Pp-nUw.js";
|
|
13
|
-
import { a as toTrustedScriptUrl, m as configureCustomElementSecurity, v as installCustomElementDomGuard, x as loadCustomElementSecurityFromDb, y as installCustomElementsRegistryGuard } from "./trusted-types-
|
|
15
|
+
import { a as toTrustedScriptUrl, m as configureCustomElementSecurity, v as installCustomElementDomGuard, x as loadCustomElementSecurityFromDb, y as installCustomElementsRegistryGuard } from "./trusted-types-Dx0RZlrd.js";
|
|
14
16
|
import { n as decryptValue, r as encryptValue } from "./crypto-BPECyFrG.js";
|
|
15
17
|
import { c as getRemoteMcpConnection, d as buildAuthHeaders, i as listRemoteMcpTools, l as listRemoteMcpConnections, m as resolveServiceCredentials, n as McpReauthRequiredError, p as resolveGitCredentials, r as callRemoteMcpTool, t as reconnectMcpOAuth } from "./mcp-reconnect-C86MR3z8.js";
|
|
16
18
|
import { t as require_browser } from "./browser-FvTfy_Ym.js";
|
|
@@ -23,29 +25,6 @@ import { o as showToast, r as showError } from "./toast-DZ6r7_YI.js";
|
|
|
23
25
|
import { getNamespacedItem, setNamespacedItem } from "./utils/namespacedStorage.js";
|
|
24
26
|
import { applyJsonPatch } from "./utils/jsonPatch.js";
|
|
25
27
|
|
|
26
|
-
//#region src/storage/readGroupFile.ts
|
|
27
|
-
/**
|
|
28
|
-
* Read a file from a group's workspace.
|
|
29
|
-
*/
|
|
30
|
-
async function readGroupFile(db, groupId, filePath) {
|
|
31
|
-
const groupDir = await getGroupDir(db, groupId);
|
|
32
|
-
const { dirs, filename } = parsePath(filePath);
|
|
33
|
-
let dir = groupDir;
|
|
34
|
-
for (const seg of dirs) dir = await dir.getDirectoryHandle(seg);
|
|
35
|
-
const fileHandle = await dir.getFileHandle(filename);
|
|
36
|
-
try {
|
|
37
|
-
const syncHandle = await fileHandle.createSyncAccessHandle();
|
|
38
|
-
const size = syncHandle.getSize();
|
|
39
|
-
const buf = new Uint8Array(size);
|
|
40
|
-
syncHandle.read(buf, { at: 0 });
|
|
41
|
-
syncHandle.close();
|
|
42
|
-
return new TextDecoder("utf-8").decode(buf);
|
|
43
|
-
} catch {
|
|
44
|
-
return (await fileHandle.getFile()).text();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
//#endregion
|
|
49
28
|
//#region src/components/common/help/providers.ts
|
|
50
29
|
const PROVIDER_HELP_LINKS = {
|
|
51
30
|
openrouter: {
|
|
@@ -683,513 +662,6 @@ async function updateGroupProviderRuntimeOverrides(db, groupId, overrides) {
|
|
|
683
662
|
await saveGroupMetadata(db, groups);
|
|
684
663
|
}
|
|
685
664
|
|
|
686
|
-
//#endregion
|
|
687
|
-
//#region src/subsystems/tools/builtin-profiles.ts
|
|
688
|
-
/**
|
|
689
|
-
* Built-in profile optimized for Gemini Nano (Prompt API).
|
|
690
|
-
* Minimizes context consumption so Nano has maximum tokens for generation.
|
|
691
|
-
*/
|
|
692
|
-
const DEFAULT_BUILTIN_PROFILE = {
|
|
693
|
-
id: "__builtin_default",
|
|
694
|
-
name: "Default",
|
|
695
|
-
providerId: "prompt_api",
|
|
696
|
-
enabledToolNames: [
|
|
697
|
-
"javascript",
|
|
698
|
-
"list_files",
|
|
699
|
-
"open_file",
|
|
700
|
-
"read_file",
|
|
701
|
-
"write_file"
|
|
702
|
-
],
|
|
703
|
-
customTools: [],
|
|
704
|
-
systemPromptOverride: "You are a helpful coding assistant.\nContent intended to be rendered as a `Page` (HTML or Markdown) SHOULD include frontmatter (title, created, updated, and slug).\nHTML content intended to be rendered as a `Page` SHOULD USE `<article><h2>${subTitle}</h2>...</article>` for its main body content."
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
//#endregion
|
|
708
|
-
//#region src/subsystems/tools/declarative.ts
|
|
709
|
-
const TOOL_NAME_PATTERN = /^[a-z][a-z0-9_]{0,63}$/;
|
|
710
|
-
function parseDeclarativeTool(path, value) {
|
|
711
|
-
if (!value || typeof value !== "object") throw new Error(`Tool at ${path} must be a JSON object`);
|
|
712
|
-
const candidate = value;
|
|
713
|
-
const name = typeof candidate.name === "string" ? candidate.name.trim() : "";
|
|
714
|
-
const description = typeof candidate.description === "string" ? candidate.description.trim() : "";
|
|
715
|
-
const inputSchema = candidate.input_schema ?? candidate.parameters;
|
|
716
|
-
const execution = candidate.execution ?? candidate.evaluation;
|
|
717
|
-
if (!TOOL_NAME_PATTERN.test(name)) throw new Error(`Tool name is invalid: ${name || "(missing)"}`);
|
|
718
|
-
if (!description) throw new Error(`Tool ${name} requires a description`);
|
|
719
|
-
if (!inputSchema || typeof inputSchema !== "object") throw new Error(`Tool ${name} requires input_schema`);
|
|
720
|
-
if (!execution || typeof execution !== "object") throw new Error(`Tool ${name} requires execution`);
|
|
721
|
-
const parsedExecution = execution;
|
|
722
|
-
const type = parsedExecution.type;
|
|
723
|
-
if (type !== "bash" && type !== "javascript" && type !== "tool") throw new Error(`Tool ${name} execution type must be bash, javascript, or tool`);
|
|
724
|
-
if (type === "tool") {
|
|
725
|
-
if (typeof parsedExecution.name !== "string" || !TOOL_NAME_PATTERN.test(parsedExecution.name)) throw new Error(`Tool ${name} execution requires a valid tool name`);
|
|
726
|
-
return {
|
|
727
|
-
name,
|
|
728
|
-
description,
|
|
729
|
-
input_schema: inputSchema,
|
|
730
|
-
execution: {
|
|
731
|
-
type,
|
|
732
|
-
name: parsedExecution.name,
|
|
733
|
-
...parsedExecution.input && typeof parsedExecution.input === "object" ? { input: parsedExecution.input } : {}
|
|
734
|
-
},
|
|
735
|
-
path
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
const sourceKey = type === "bash" ? "command" : "code";
|
|
739
|
-
const source = parsedExecution[sourceKey] ?? parsedExecution.expression;
|
|
740
|
-
if (typeof source !== "string" || source.trim() === "") throw new Error(`Tool ${name} execution requires ${sourceKey}`);
|
|
741
|
-
return {
|
|
742
|
-
name,
|
|
743
|
-
description,
|
|
744
|
-
input_schema: inputSchema,
|
|
745
|
-
execution: {
|
|
746
|
-
type,
|
|
747
|
-
[sourceKey]: source
|
|
748
|
-
},
|
|
749
|
-
path
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
async function loadDeclarativeTools(db, groupId = DEFAULT_GROUP_ID) {
|
|
753
|
-
const tools = [];
|
|
754
|
-
const diagnostics = [];
|
|
755
|
-
const groupIdsToScan = groupId === "br:main" ? [DEFAULT_GROUP_ID] : [groupId, DEFAULT_GROUP_ID];
|
|
756
|
-
for (const targetGroupId of groupIdsToScan) try {
|
|
757
|
-
const root = await getGroupDir(db, targetGroupId);
|
|
758
|
-
const paths = [];
|
|
759
|
-
async function visit(directory, relativePath) {
|
|
760
|
-
for await (const [name, handle] of directory.entries()) {
|
|
761
|
-
const childPath = `${relativePath}/${name}`;
|
|
762
|
-
if (handle.kind === "directory") await visit(handle, childPath);
|
|
763
|
-
else if (name.endsWith(".json") && childPath.startsWith(".agents/tools/")) paths.push(childPath);
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
try {
|
|
767
|
-
await visit(await (await root.getDirectoryHandle(".agents")).getDirectoryHandle("tools"), ".agents/tools");
|
|
768
|
-
} catch {
|
|
769
|
-
continue;
|
|
770
|
-
}
|
|
771
|
-
for (const path of paths.sort()) try {
|
|
772
|
-
const parsedTool = parseDeclarativeTool(path, JSON.parse(await readGroupFile(db, targetGroupId, path)));
|
|
773
|
-
if (!tools.some((t) => t.name === parsedTool.name)) tools.push(parsedTool);
|
|
774
|
-
} catch (error) {
|
|
775
|
-
diagnostics.push(error instanceof Error ? error.message : String(error));
|
|
776
|
-
}
|
|
777
|
-
} catch {}
|
|
778
|
-
return {
|
|
779
|
-
tools,
|
|
780
|
-
diagnostics
|
|
781
|
-
};
|
|
782
|
-
}
|
|
783
|
-
async function findDeclarativeTool(db, groupId = DEFAULT_GROUP_ID, name) {
|
|
784
|
-
try {
|
|
785
|
-
const { tools } = await loadDeclarativeTools(db, groupId);
|
|
786
|
-
const tool = tools.find((t) => t.name === name) || null;
|
|
787
|
-
if (!tool) return null;
|
|
788
|
-
const rawEnabled = await getConfig(db, CONFIG_KEYS.DECLARATIVE_TOOLS_ENABLED);
|
|
789
|
-
if (Array.isArray(rawEnabled) && !rawEnabled.includes(name)) return null;
|
|
790
|
-
return tool;
|
|
791
|
-
} catch {
|
|
792
|
-
return null;
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
//#endregion
|
|
797
|
-
//#region src/stores/tools.ts
|
|
798
|
-
var ToolsStore = class {
|
|
799
|
-
_activeProfile;
|
|
800
|
-
_activeProfileId;
|
|
801
|
-
_allTools;
|
|
802
|
-
_customTools;
|
|
803
|
-
_declarativeTools;
|
|
804
|
-
_declarativeToolNamesEnabled;
|
|
805
|
-
_enabledDeclarativeTools;
|
|
806
|
-
_enabledToolNames;
|
|
807
|
-
_enabledTools;
|
|
808
|
-
_profiles;
|
|
809
|
-
_systemPromptOverride;
|
|
810
|
-
_webSearchProxyUrl;
|
|
811
|
-
_webSearchUrl;
|
|
812
|
-
_webSearchUseProxy;
|
|
813
|
-
_searchFilesMaxFileBytes;
|
|
814
|
-
_searchFilesMaxFilesVisited;
|
|
815
|
-
_searchFilesSkipDirs;
|
|
816
|
-
constructor() {
|
|
817
|
-
this._enabledToolNames = new Signal.State(new Set(DEFAULT_BUILTIN_PROFILE.enabledToolNames));
|
|
818
|
-
this._customTools = new Signal.State([]);
|
|
819
|
-
this._declarativeTools = new Signal.State([]);
|
|
820
|
-
this._declarativeToolNamesEnabled = new Signal.State(null);
|
|
821
|
-
this._systemPromptOverride = new Signal.State("");
|
|
822
|
-
this._profiles = new Signal.State([]);
|
|
823
|
-
this._activeProfileId = new Signal.State(DEFAULT_BUILTIN_PROFILE.id);
|
|
824
|
-
this._webSearchUseProxy = new Signal.State(false);
|
|
825
|
-
this._webSearchProxyUrl = new Signal.State("/proxy");
|
|
826
|
-
this._webSearchUrl = new Signal.State("https://html.duckduckgo.com/html/?q={query}");
|
|
827
|
-
this._searchFilesMaxFileBytes = new Signal.State(512 * 1024);
|
|
828
|
-
this._searchFilesMaxFilesVisited = new Signal.State(1e3);
|
|
829
|
-
this._searchFilesSkipDirs = new Signal.State(".git,node_modules,dist,dist-electron,.cache,.nx,.turbo,__pycache__,.venv,venv");
|
|
830
|
-
this._allTools = new Signal.Computed(() => [...TOOL_DEFINITIONS, ...this._customTools.get()]);
|
|
831
|
-
this._enabledTools = new Signal.Computed(() => {
|
|
832
|
-
const enabled = this._enabledToolNames.get();
|
|
833
|
-
return this._allTools.get().filter((t) => enabled.has(t.name));
|
|
834
|
-
});
|
|
835
|
-
this._enabledDeclarativeTools = new Signal.Computed(() => {
|
|
836
|
-
const tools = this._declarativeTools.get();
|
|
837
|
-
const enabledSet = this._declarativeToolNamesEnabled.get();
|
|
838
|
-
if (enabledSet === null) return tools;
|
|
839
|
-
return tools.filter((t) => enabledSet.has(t.name));
|
|
840
|
-
});
|
|
841
|
-
this._activeProfile = new Signal.Computed(() => {
|
|
842
|
-
const id = this._activeProfileId.get();
|
|
843
|
-
if (!id) return null;
|
|
844
|
-
if (DEFAULT_BUILTIN_PROFILE.id === id) return DEFAULT_BUILTIN_PROFILE;
|
|
845
|
-
return this._profiles.get().find((p) => p.id === id) || null;
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
get activeProfile() {
|
|
849
|
-
return this._activeProfile.get();
|
|
850
|
-
}
|
|
851
|
-
get activeProfileId() {
|
|
852
|
-
return this._activeProfileId.get();
|
|
853
|
-
}
|
|
854
|
-
get allTools() {
|
|
855
|
-
return this._allTools.get();
|
|
856
|
-
}
|
|
857
|
-
get customTools() {
|
|
858
|
-
return this._customTools.get();
|
|
859
|
-
}
|
|
860
|
-
get declarativeTools() {
|
|
861
|
-
return this._declarativeTools.get();
|
|
862
|
-
}
|
|
863
|
-
get declarativeToolNamesEnabled() {
|
|
864
|
-
return this._declarativeToolNamesEnabled.get();
|
|
865
|
-
}
|
|
866
|
-
get enabledDeclarativeTools() {
|
|
867
|
-
return this._enabledDeclarativeTools.get();
|
|
868
|
-
}
|
|
869
|
-
get enabledToolNames() {
|
|
870
|
-
return this._enabledToolNames.get();
|
|
871
|
-
}
|
|
872
|
-
get enabledTools() {
|
|
873
|
-
return this._enabledTools.get();
|
|
874
|
-
}
|
|
875
|
-
isDeclarativeToolEnabled(name) {
|
|
876
|
-
const enabledSet = this._declarativeToolNamesEnabled.get();
|
|
877
|
-
if (enabledSet === null) return true;
|
|
878
|
-
return enabledSet.has(name);
|
|
879
|
-
}
|
|
880
|
-
async refreshDeclarativeTools(db, groupId) {
|
|
881
|
-
try {
|
|
882
|
-
const res = await loadDeclarativeTools(db, groupId || "br:main");
|
|
883
|
-
const allBuiltInAndCustom = this.allTools;
|
|
884
|
-
const declTools = (res?.tools || []).filter((dt) => !allBuiltInAndCustom.some((bt) => bt.name === dt.name));
|
|
885
|
-
const current = this._declarativeTools.get();
|
|
886
|
-
if (!(current.length === declTools.length && current.every((t, i) => t.name === declTools[i].name && t.description === declTools[i].description && JSON.stringify(t.execution) === JSON.stringify(declTools[i].execution)))) this._declarativeTools.set(declTools);
|
|
887
|
-
return declTools;
|
|
888
|
-
} catch {
|
|
889
|
-
if (this._declarativeTools.get().length > 0) this._declarativeTools.set([]);
|
|
890
|
-
return [];
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
async setDeclarativeToolEnabled(db, toolName, enabled) {
|
|
894
|
-
const currentEnabled = this._declarativeToolNamesEnabled.get();
|
|
895
|
-
const allDeclTools = this._declarativeTools.get();
|
|
896
|
-
const nextSet = new Set(currentEnabled === null ? allDeclTools.map((t) => t.name) : currentEnabled);
|
|
897
|
-
if (enabled) nextSet.add(toolName);
|
|
898
|
-
else nextSet.delete(toolName);
|
|
899
|
-
this._declarativeToolNamesEnabled.set(nextSet);
|
|
900
|
-
await setConfig(db, CONFIG_KEYS.DECLARATIVE_TOOLS_ENABLED, Array.from(nextSet));
|
|
901
|
-
}
|
|
902
|
-
async setAllDeclarativeEnabled(db, toolNames) {
|
|
903
|
-
const nextSet = new Set(toolNames);
|
|
904
|
-
this._declarativeToolNamesEnabled.set(nextSet);
|
|
905
|
-
await setConfig(db, CONFIG_KEYS.DECLARATIVE_TOOLS_ENABLED, toolNames);
|
|
906
|
-
}
|
|
907
|
-
/**
|
|
908
|
-
* Export tools config as JSON for backup.
|
|
909
|
-
*/
|
|
910
|
-
exportBackup() {
|
|
911
|
-
return JSON.stringify({
|
|
912
|
-
enabledTools: [...this._enabledToolNames.get()],
|
|
913
|
-
customTools: this._customTools.get(),
|
|
914
|
-
declarativeToolsEnabled: this._declarativeToolNamesEnabled.get() ? Array.from(this._declarativeToolNamesEnabled.get()) : null,
|
|
915
|
-
systemPromptOverride: this._systemPromptOverride.get(),
|
|
916
|
-
profiles: this._profiles.get(),
|
|
917
|
-
activeProfileId: this._activeProfileId.get(),
|
|
918
|
-
webSearchUseProxy: this._webSearchUseProxy.get(),
|
|
919
|
-
webSearchProxyUrl: this._webSearchProxyUrl.get(),
|
|
920
|
-
webSearchUrl: this._webSearchUrl.get(),
|
|
921
|
-
searchFilesMaxFileBytes: this._searchFilesMaxFileBytes.get(),
|
|
922
|
-
searchFilesMaxFilesVisited: this._searchFilesMaxFilesVisited.get(),
|
|
923
|
-
searchFilesSkipDirs: this._searchFilesSkipDirs.get()
|
|
924
|
-
}, null, 2);
|
|
925
|
-
}
|
|
926
|
-
findProfilesForProvider(providerId, model) {
|
|
927
|
-
return this.profiles.filter((p) => {
|
|
928
|
-
if (p.providerId && p.providerId !== providerId) return false;
|
|
929
|
-
if (p.model && p.model !== model) return false;
|
|
930
|
-
return true;
|
|
931
|
-
});
|
|
932
|
-
}
|
|
933
|
-
get profiles() {
|
|
934
|
-
return [DEFAULT_BUILTIN_PROFILE, ...this._profiles.get()];
|
|
935
|
-
}
|
|
936
|
-
get systemPromptOverride() {
|
|
937
|
-
return this._systemPromptOverride.get();
|
|
938
|
-
}
|
|
939
|
-
get webSearchProxyUrl() {
|
|
940
|
-
return this._webSearchProxyUrl.get();
|
|
941
|
-
}
|
|
942
|
-
get webSearchUrl() {
|
|
943
|
-
return this._webSearchUrl.get();
|
|
944
|
-
}
|
|
945
|
-
get webSearchUseProxy() {
|
|
946
|
-
return this._webSearchUseProxy.get();
|
|
947
|
-
}
|
|
948
|
-
get searchFilesMaxFileBytes() {
|
|
949
|
-
return this._searchFilesMaxFileBytes.get();
|
|
950
|
-
}
|
|
951
|
-
get searchFilesMaxFilesVisited() {
|
|
952
|
-
return this._searchFilesMaxFilesVisited.get();
|
|
953
|
-
}
|
|
954
|
-
/** Comma-separated list of directory names to skip when walking the workspace. */
|
|
955
|
-
get searchFilesSkipDirs() {
|
|
956
|
-
return this._searchFilesSkipDirs.get();
|
|
957
|
-
}
|
|
958
|
-
/** Parsed Set of directory names to skip — derived from the comma-separated string. */
|
|
959
|
-
get searchFilesSkipDirsSet() {
|
|
960
|
-
return new Set(this._searchFilesSkipDirs.get().split(",").map((s) => s.trim()).filter(Boolean));
|
|
961
|
-
}
|
|
962
|
-
async activateProfile(db, profileId) {
|
|
963
|
-
const profile = this.profiles.find((p) => p.id === profileId);
|
|
964
|
-
if (!profile) return;
|
|
965
|
-
this._activeProfileId.set(profileId);
|
|
966
|
-
this._enabledToolNames.set(new Set(profile.enabledToolNames));
|
|
967
|
-
this._customTools.set(profile.customTools);
|
|
968
|
-
this._systemPromptOverride.set(profile.systemPromptOverride || "");
|
|
969
|
-
await Promise.all([
|
|
970
|
-
setConfig(db, CONFIG_KEYS.ACTIVE_TOOL_PROFILE, profileId),
|
|
971
|
-
setConfig(db, CONFIG_KEYS.ENABLED_TOOLS, profile.enabledToolNames),
|
|
972
|
-
setConfig(db, CONFIG_KEYS.CUSTOM_TOOLS, profile.customTools),
|
|
973
|
-
setConfig(db, CONFIG_KEYS.SYSTEM_PROMPT_OVERRIDE, profile.systemPromptOverride || "")
|
|
974
|
-
]);
|
|
975
|
-
}
|
|
976
|
-
async addCustomTool(db, tool) {
|
|
977
|
-
const tools = [...this._customTools.get(), tool];
|
|
978
|
-
this._customTools.set(tools);
|
|
979
|
-
const enabled = new Set(this._enabledToolNames.get());
|
|
980
|
-
enabled.add(tool.name);
|
|
981
|
-
this._enabledToolNames.set(enabled);
|
|
982
|
-
await Promise.all([setConfig(db, CONFIG_KEYS.CUSTOM_TOOLS, tools), setConfig(db, CONFIG_KEYS.ENABLED_TOOLS, [...enabled])]);
|
|
983
|
-
}
|
|
984
|
-
async addProfile(db, profile) {
|
|
985
|
-
const profiles = [...this._profiles.get(), profile];
|
|
986
|
-
this._profiles.set(profiles);
|
|
987
|
-
await setConfig(db, CONFIG_KEYS.TOOL_PROFILES, profiles);
|
|
988
|
-
}
|
|
989
|
-
async cloneTool(db, sourceToolName, newToolName, newDescription) {
|
|
990
|
-
const source = this.allTools.find((t) => t.name === sourceToolName);
|
|
991
|
-
if (!source) return false;
|
|
992
|
-
if (this.allTools.some((t) => t.name === newToolName)) return false;
|
|
993
|
-
const cloned = {
|
|
994
|
-
name: newToolName,
|
|
995
|
-
description: newDescription || source.description,
|
|
996
|
-
input_schema: JSON.parse(JSON.stringify(source.input_schema))
|
|
997
|
-
};
|
|
998
|
-
await this.addCustomTool(db, cloned);
|
|
999
|
-
return true;
|
|
1000
|
-
}
|
|
1001
|
-
async deactivateProfile(db) {
|
|
1002
|
-
this._activeProfileId.set(null);
|
|
1003
|
-
await setConfig(db, CONFIG_KEYS.ACTIVE_TOOL_PROFILE, null);
|
|
1004
|
-
}
|
|
1005
|
-
async deleteProfile(db, profileId) {
|
|
1006
|
-
if (profileId === DEFAULT_BUILTIN_PROFILE.id) return;
|
|
1007
|
-
const profiles = this._profiles.get().filter((p) => p.id !== profileId);
|
|
1008
|
-
this._profiles.set(profiles);
|
|
1009
|
-
if (this._activeProfileId.get() === profileId) {
|
|
1010
|
-
this._activeProfileId.set(null);
|
|
1011
|
-
await setConfig(db, CONFIG_KEYS.ACTIVE_TOOL_PROFILE, null);
|
|
1012
|
-
}
|
|
1013
|
-
await setConfig(db, CONFIG_KEYS.TOOL_PROFILES, profiles);
|
|
1014
|
-
}
|
|
1015
|
-
async importBackup(db, json) {
|
|
1016
|
-
const data = JSON.parse(json);
|
|
1017
|
-
if (Array.isArray(data.enabledTools)) {
|
|
1018
|
-
this._enabledToolNames.set(new Set(data.enabledTools));
|
|
1019
|
-
await setConfig(db, CONFIG_KEYS.ENABLED_TOOLS, data.enabledTools);
|
|
1020
|
-
}
|
|
1021
|
-
if (Array.isArray(data.customTools)) {
|
|
1022
|
-
this._customTools.set(data.customTools);
|
|
1023
|
-
await setConfig(db, CONFIG_KEYS.CUSTOM_TOOLS, data.customTools);
|
|
1024
|
-
}
|
|
1025
|
-
if (typeof data.systemPromptOverride === "string") {
|
|
1026
|
-
this._systemPromptOverride.set(data.systemPromptOverride);
|
|
1027
|
-
await setConfig(db, CONFIG_KEYS.SYSTEM_PROMPT_OVERRIDE, data.systemPromptOverride);
|
|
1028
|
-
}
|
|
1029
|
-
if (Array.isArray(data.profiles)) {
|
|
1030
|
-
this._profiles.set(data.profiles);
|
|
1031
|
-
await setConfig(db, CONFIG_KEYS.TOOL_PROFILES, data.profiles);
|
|
1032
|
-
}
|
|
1033
|
-
if (typeof data.activeProfileId === "string" || data.activeProfileId === null) {
|
|
1034
|
-
this._activeProfileId.set(data.activeProfileId);
|
|
1035
|
-
await setConfig(db, CONFIG_KEYS.ACTIVE_TOOL_PROFILE, data.activeProfileId);
|
|
1036
|
-
}
|
|
1037
|
-
if (typeof data.webSearchUseProxy === "boolean") {
|
|
1038
|
-
this._webSearchUseProxy.set(data.webSearchUseProxy);
|
|
1039
|
-
await setConfig(db, CONFIG_KEYS.WEB_SEARCH_USE_PROXY, data.webSearchUseProxy ? "true" : "false");
|
|
1040
|
-
}
|
|
1041
|
-
if (typeof data.webSearchProxyUrl === "string") {
|
|
1042
|
-
this._webSearchProxyUrl.set(data.webSearchProxyUrl);
|
|
1043
|
-
await setConfig(db, CONFIG_KEYS.WEB_SEARCH_PROXY_URL, data.webSearchProxyUrl);
|
|
1044
|
-
}
|
|
1045
|
-
if (typeof data.webSearchUrl === "string") {
|
|
1046
|
-
this._webSearchUrl.set(data.webSearchUrl);
|
|
1047
|
-
await setConfig(db, CONFIG_KEYS.WEB_SEARCH_URL, data.webSearchUrl);
|
|
1048
|
-
}
|
|
1049
|
-
if (typeof data.searchFilesMaxFileBytes === "number" && data.searchFilesMaxFileBytes > 0) {
|
|
1050
|
-
this._searchFilesMaxFileBytes.set(data.searchFilesMaxFileBytes);
|
|
1051
|
-
await setConfig(db, CONFIG_KEYS.SEARCH_FILES_MAX_FILE_BYTES, String(data.searchFilesMaxFileBytes));
|
|
1052
|
-
}
|
|
1053
|
-
if (typeof data.searchFilesMaxFilesVisited === "number" && data.searchFilesMaxFilesVisited > 0) {
|
|
1054
|
-
this._searchFilesMaxFilesVisited.set(data.searchFilesMaxFilesVisited);
|
|
1055
|
-
await setConfig(db, CONFIG_KEYS.SEARCH_FILES_MAX_FILES_VISITED, String(data.searchFilesMaxFilesVisited));
|
|
1056
|
-
}
|
|
1057
|
-
if (typeof data.searchFilesSkipDirs === "string") {
|
|
1058
|
-
this._searchFilesSkipDirs.set(data.searchFilesSkipDirs);
|
|
1059
|
-
await setConfig(db, CONFIG_KEYS.SEARCH_FILES_SKIP_DIRS, data.searchFilesSkipDirs);
|
|
1060
|
-
}
|
|
1061
|
-
if (Array.isArray(data.declarativeToolsEnabled)) {
|
|
1062
|
-
this._declarativeToolNamesEnabled.set(new Set(data.declarativeToolsEnabled));
|
|
1063
|
-
await setConfig(db, CONFIG_KEYS.DECLARATIVE_TOOLS_ENABLED, data.declarativeToolsEnabled);
|
|
1064
|
-
} else if (data.declarativeToolsEnabled === null) {
|
|
1065
|
-
this._declarativeToolNamesEnabled.set(null);
|
|
1066
|
-
await setConfig(db, CONFIG_KEYS.DECLARATIVE_TOOLS_ENABLED, null);
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Load persisted tool config from IndexedDB.
|
|
1071
|
-
*/
|
|
1072
|
-
async load(db) {
|
|
1073
|
-
const [enabledRaw, customRaw, promptOverride, profilesRaw, activeProfileIdRaw, webSearchUseProxyRaw, webSearchProxyUrlRaw, webSearchUrlRaw, searchFilesMaxFileBytesRaw, searchFilesMaxFilesVisitedRaw, searchFilesSkipDirsRaw, declarativeEnabledRaw] = await Promise.all([
|
|
1074
|
-
getConfig(db, CONFIG_KEYS.ENABLED_TOOLS),
|
|
1075
|
-
getConfig(db, CONFIG_KEYS.CUSTOM_TOOLS),
|
|
1076
|
-
getConfig(db, CONFIG_KEYS.SYSTEM_PROMPT_OVERRIDE),
|
|
1077
|
-
getConfig(db, CONFIG_KEYS.TOOL_PROFILES),
|
|
1078
|
-
getConfig(db, CONFIG_KEYS.ACTIVE_TOOL_PROFILE),
|
|
1079
|
-
getConfig(db, CONFIG_KEYS.WEB_SEARCH_USE_PROXY),
|
|
1080
|
-
getConfig(db, CONFIG_KEYS.WEB_SEARCH_PROXY_URL),
|
|
1081
|
-
getConfig(db, CONFIG_KEYS.WEB_SEARCH_URL),
|
|
1082
|
-
getConfig(db, CONFIG_KEYS.SEARCH_FILES_MAX_FILE_BYTES),
|
|
1083
|
-
getConfig(db, CONFIG_KEYS.SEARCH_FILES_MAX_FILES_VISITED),
|
|
1084
|
-
getConfig(db, CONFIG_KEYS.SEARCH_FILES_SKIP_DIRS),
|
|
1085
|
-
getConfig(db, CONFIG_KEYS.DECLARATIVE_TOOLS_ENABLED)
|
|
1086
|
-
]);
|
|
1087
|
-
if (Array.isArray(enabledRaw)) this._enabledToolNames.set(new Set(enabledRaw));
|
|
1088
|
-
if (Array.isArray(customRaw)) this._customTools.set(customRaw);
|
|
1089
|
-
if (Array.isArray(declarativeEnabledRaw)) this._declarativeToolNamesEnabled.set(new Set(declarativeEnabledRaw));
|
|
1090
|
-
if (typeof promptOverride === "string") this._systemPromptOverride.set(promptOverride);
|
|
1091
|
-
if (Array.isArray(profilesRaw)) this._profiles.set(profilesRaw);
|
|
1092
|
-
if (typeof activeProfileIdRaw === "string") this._activeProfileId.set(activeProfileIdRaw);
|
|
1093
|
-
if (webSearchUseProxyRaw !== null && webSearchUseProxyRaw !== void 0) {
|
|
1094
|
-
const strVal = String(webSearchUseProxyRaw).toLowerCase();
|
|
1095
|
-
this._webSearchUseProxy.set(strVal === "true" || strVal === "1");
|
|
1096
|
-
}
|
|
1097
|
-
if (typeof webSearchProxyUrlRaw === "string" && webSearchProxyUrlRaw.trim().length > 0) this._webSearchProxyUrl.set(webSearchProxyUrlRaw.trim());
|
|
1098
|
-
if (typeof webSearchUrlRaw === "string" && webSearchUrlRaw.trim().length > 0) this._webSearchUrl.set(webSearchUrlRaw.trim());
|
|
1099
|
-
if (searchFilesMaxFileBytesRaw !== null && searchFilesMaxFileBytesRaw !== void 0) {
|
|
1100
|
-
const n = Number(searchFilesMaxFileBytesRaw);
|
|
1101
|
-
if (Number.isFinite(n) && n > 0) this._searchFilesMaxFileBytes.set(n);
|
|
1102
|
-
}
|
|
1103
|
-
if (searchFilesMaxFilesVisitedRaw !== null && searchFilesMaxFilesVisitedRaw !== void 0) {
|
|
1104
|
-
const n = Number(searchFilesMaxFilesVisitedRaw);
|
|
1105
|
-
if (Number.isFinite(n) && n > 0) this._searchFilesMaxFilesVisited.set(n);
|
|
1106
|
-
}
|
|
1107
|
-
if (typeof searchFilesSkipDirsRaw === "string" && searchFilesSkipDirsRaw.trim().length > 0) this._searchFilesSkipDirs.set(searchFilesSkipDirsRaw.trim());
|
|
1108
|
-
}
|
|
1109
|
-
async setWebSearchProxyUrl(db, proxyUrl) {
|
|
1110
|
-
const trimmed = proxyUrl.trim() || "/proxy";
|
|
1111
|
-
this._webSearchProxyUrl.set(trimmed);
|
|
1112
|
-
await setConfig(db, CONFIG_KEYS.WEB_SEARCH_PROXY_URL, trimmed);
|
|
1113
|
-
}
|
|
1114
|
-
async setWebSearchUrl(db, url) {
|
|
1115
|
-
const trimmed = url.trim() || "https://html.duckduckgo.com/html/?q={query}";
|
|
1116
|
-
this._webSearchUrl.set(trimmed);
|
|
1117
|
-
await setConfig(db, CONFIG_KEYS.WEB_SEARCH_URL, trimmed);
|
|
1118
|
-
}
|
|
1119
|
-
async setWebSearchUseProxy(db, useProxy) {
|
|
1120
|
-
const enabled = !!useProxy;
|
|
1121
|
-
this._webSearchUseProxy.set(enabled);
|
|
1122
|
-
await setConfig(db, CONFIG_KEYS.WEB_SEARCH_USE_PROXY, enabled ? "true" : "false");
|
|
1123
|
-
}
|
|
1124
|
-
async setSearchFilesMaxFileBytes(db, bytes) {
|
|
1125
|
-
const clamped = Math.max(1, Math.round(bytes));
|
|
1126
|
-
this._searchFilesMaxFileBytes.set(clamped);
|
|
1127
|
-
await setConfig(db, CONFIG_KEYS.SEARCH_FILES_MAX_FILE_BYTES, String(clamped));
|
|
1128
|
-
}
|
|
1129
|
-
async setSearchFilesMaxFilesVisited(db, count) {
|
|
1130
|
-
const clamped = Math.max(1, Math.round(count));
|
|
1131
|
-
this._searchFilesMaxFilesVisited.set(clamped);
|
|
1132
|
-
await setConfig(db, CONFIG_KEYS.SEARCH_FILES_MAX_FILES_VISITED, String(clamped));
|
|
1133
|
-
}
|
|
1134
|
-
async setSearchFilesSkipDirs(db, dirs) {
|
|
1135
|
-
const trimmed = dirs.trim();
|
|
1136
|
-
this._searchFilesSkipDirs.set(trimmed);
|
|
1137
|
-
await setConfig(db, CONFIG_KEYS.SEARCH_FILES_SKIP_DIRS, trimmed);
|
|
1138
|
-
}
|
|
1139
|
-
async removeCustomTool(db, toolName) {
|
|
1140
|
-
const tools = this._customTools.get().filter((t) => t.name !== toolName);
|
|
1141
|
-
this._customTools.set(tools);
|
|
1142
|
-
const enabled = new Set(this._enabledToolNames.get());
|
|
1143
|
-
enabled.delete(toolName);
|
|
1144
|
-
this._enabledToolNames.set(enabled);
|
|
1145
|
-
await Promise.all([setConfig(db, CONFIG_KEYS.CUSTOM_TOOLS, tools), setConfig(db, CONFIG_KEYS.ENABLED_TOOLS, [...enabled])]);
|
|
1146
|
-
}
|
|
1147
|
-
async saveToActiveProfile(db) {
|
|
1148
|
-
const id = this._activeProfileId.get();
|
|
1149
|
-
if (!id) return;
|
|
1150
|
-
const profile = this._profiles.get().find((p) => p.id === id);
|
|
1151
|
-
if (!profile) return;
|
|
1152
|
-
const updated = {
|
|
1153
|
-
...profile,
|
|
1154
|
-
enabledToolNames: [...this._enabledToolNames.get()],
|
|
1155
|
-
customTools: [...this._customTools.get()],
|
|
1156
|
-
systemPromptOverride: this._systemPromptOverride.get()
|
|
1157
|
-
};
|
|
1158
|
-
await this.updateProfile(db, updated);
|
|
1159
|
-
}
|
|
1160
|
-
async setAllEnabled(db, toolNames) {
|
|
1161
|
-
this._enabledToolNames.set(new Set(toolNames));
|
|
1162
|
-
const saves = [setConfig(db, CONFIG_KEYS.ENABLED_TOOLS, toolNames)];
|
|
1163
|
-
if (this._activeProfileId.get()) {
|
|
1164
|
-
this._activeProfileId.set(null);
|
|
1165
|
-
saves.push(setConfig(db, CONFIG_KEYS.ACTIVE_TOOL_PROFILE, null));
|
|
1166
|
-
}
|
|
1167
|
-
await Promise.all(saves);
|
|
1168
|
-
}
|
|
1169
|
-
async setSystemPromptOverride(db, override) {
|
|
1170
|
-
this._systemPromptOverride.set(override);
|
|
1171
|
-
await setConfig(db, CONFIG_KEYS.SYSTEM_PROMPT_OVERRIDE, override);
|
|
1172
|
-
}
|
|
1173
|
-
async setToolEnabled(db, toolName, enabled) {
|
|
1174
|
-
const current = new Set(this._enabledToolNames.get());
|
|
1175
|
-
if (enabled) current.add(toolName);
|
|
1176
|
-
else current.delete(toolName);
|
|
1177
|
-
this._enabledToolNames.set(current);
|
|
1178
|
-
const saves = [setConfig(db, CONFIG_KEYS.ENABLED_TOOLS, [...current])];
|
|
1179
|
-
if (this._activeProfileId.get()) {
|
|
1180
|
-
this._activeProfileId.set(null);
|
|
1181
|
-
saves.push(setConfig(db, CONFIG_KEYS.ACTIVE_TOOL_PROFILE, null));
|
|
1182
|
-
}
|
|
1183
|
-
await Promise.all(saves);
|
|
1184
|
-
}
|
|
1185
|
-
async updateProfile(db, profile) {
|
|
1186
|
-
const profiles = this._profiles.get().map((p) => p.id === profile.id ? profile : p);
|
|
1187
|
-
this._profiles.set(profiles);
|
|
1188
|
-
await setConfig(db, CONFIG_KEYS.TOOL_PROFILES, profiles);
|
|
1189
|
-
}
|
|
1190
|
-
};
|
|
1191
|
-
const toolsStore = new ToolsStore();
|
|
1192
|
-
|
|
1193
665
|
//#endregion
|
|
1194
666
|
//#region src/content/chat-template-sanitizer.ts
|
|
1195
667
|
const ALL_PATTERNS = [
|
|
@@ -94783,5 +94255,5 @@ var OrchestratorStore = class OrchestratorStore {
|
|
|
94783
94255
|
const orchestratorStore = new OrchestratorStore();
|
|
94784
94256
|
|
|
94785
94257
|
//#endregion
|
|
94786
|
-
export { setPeerjsPeerAliases as $, registerSubagentCollector as $t, shouldStartLocalScheduler as A, isRetryableHttpError as At, getApiKeyForHeaders as B, DEFAULT_CHUNK_SIZE as Bt, sendTerminalInput as C, formatRequest as Ct, compactContext as D, invokeWithPromptApi as Dt, setVMNetworkRelayURL as E, parseResponse as Et, leaveRoom as F, deleteGroupDirectory as Ft, getProviderRuntimeHeaders as G, upsertRoom as Gt, getAvailableProviders as H, getRoomMetadata as Ht, listRooms as I, copyGroupEntry as It, setBedrockSettings as J, deleteGroupFile as Jt, getReasoningConfig as K, writeGroupFileBytes as Kt, applyLlamafileHeaders as L, ensureBuiltinAiPolyfills as Lt, handleRoomInvite as M, discoverSkills as Mt, inviteToRoom as N, require_gray_matter as Nt, handleWorkerMessage as O, isPromptApiSupported as Ot, joinRoomViaLink as P, moveGroupEntry as Pt, setPeerjsMyAlias as Q, post as Qt, applyMeshLlmHeaders as R, fetchTokenizerConfig as Rt, openTerminalSession as S, buildHeaders as St, setVMBootMode as T, normalizeMeshLlmResult as Tt, getBedrockSettings as U, roomGroupId as Ut, getApiKeyForRequest as V, deleteRoom as Vt, getLlamafileSettings as W, roomIdFromGroupId as Wt, setMeshLlmSettings as X, ensureMainGroupMemory as Xt, setLlamafileSettings as Y, ensureMainGroupIndex as Yt, setModel as Z, groupFileExists as Zt, setUseProxy as _,
|
|
94787
|
-
//# sourceMappingURL=orchestrator-
|
|
94258
|
+
export { setPeerjsPeerAliases as $, registerSubagentCollector as $t, shouldStartLocalScheduler as A, isRetryableHttpError as At, getApiKeyForHeaders as B, DEFAULT_CHUNK_SIZE as Bt, sendTerminalInput as C, formatRequest as Ct, compactContext as D, invokeWithPromptApi as Dt, setVMNetworkRelayURL as E, parseResponse as Et, leaveRoom as F, deleteGroupDirectory as Ft, getProviderRuntimeHeaders as G, upsertRoom as Gt, getAvailableProviders as H, getRoomMetadata as Ht, listRooms as I, copyGroupEntry as It, setBedrockSettings as J, deleteGroupFile as Jt, getReasoningConfig as K, writeGroupFileBytes as Kt, applyLlamafileHeaders as L, ensureBuiltinAiPolyfills as Lt, handleRoomInvite as M, discoverSkills as Mt, inviteToRoom as N, require_gray_matter as Nt, handleWorkerMessage as O, isPromptApiSupported as Ot, joinRoomViaLink as P, moveGroupEntry as Pt, setPeerjsMyAlias as Q, post as Qt, applyMeshLlmHeaders as R, fetchTokenizerConfig as Rt, openTerminalSession as S, buildHeaders as St, setVMBootMode as T, normalizeMeshLlmResult as Tt, getBedrockSettings as U, roomGroupId as Ut, getApiKeyForRequest as V, deleteRoom as Vt, getLlamafileSettings as W, roomIdFromGroupId as Wt, setMeshLlmSettings as X, ensureMainGroupMemory as Xt, setLlamafileSettings as Y, ensureMainGroupIndex as Yt, setModel as Z, groupFileExists as Zt, setUseProxy as _, detectProviderHelpType as _n, setChannelEnabled as _t, updateTaskLastRun as a, writeOpfsPathViaWorker as an, buildLlamafileHelpDialogOptions as at, answerUserPrompt as b, saveMessage as bt, setMaxIterations as c, sanitizeModelOutput as cn, clearPeerJsTypingState as ct, setRateLimitAutoAdapt as d, formatModelAttachmentCapabilitySummary as dn, getChannelEnabled as dt, setPostHandler as en, setProvider as et, setRateLimitCallsPerMinute as f, getAttachmentCategory as fn, getChannelTypeForGroup as ft, setTaskServerUrl as g, buildProviderHelpDialogOptions as gn, loadChannelEnabled as gt, setTaskServerEnabled as h, estimateTokens as hn, getTelegramConfig as ht, deleteAllGroupFiles as i, writeFileHandle as in, LLAMAFILE_EXPECTED_DIR as it, createRoom as j, withRetry as jt, runTaskAsScheduled as k, executeTool as kt, setMaxTokens as l, listGroups as ln, configureIMessage as lt, setStreamingEnabled as m, buildDynamicContext as mn, getPeerJsConfig as mt, orchestrator_exports as n, writeGroupFile as nn, stopTransformersProgressPolling as nt, clearGroupMessages as o, createToolActivityMessage as on, deliverResponse as ot, setReasoningEffort as p, getModelAttachmentCapabilities as pn, getIMessageConfig as pt, setAssistantName as q, createGroupDirectory as qt, getStaticPageContent as r, uploadGroupFile as rn, buildTransformersJsHelpDialogOptions as rt, setContextCompressionEnabled as s, createLogMessage as sn, applyAllChannelRunningStates as st, orchestratorStore as t, unregisterSubagentCollector as tn, startTransformersProgressPolling as tt, setProxyUrl as u, buildConversationMessages as un, configureTelegram as ut, setVMBashTimeout as v, submitMessage as vt, setVMBootHost as w, getContextLimit as wt, closeTerminalSession as x, buildSystemPrompt as xt, syncProxyConfigToServiceWorker as y, normalizeStringList as yt, cancelLlamafileRequest as z, loadModelStream as zt };
|
|
94259
|
+
//# sourceMappingURL=orchestrator-KRjx0eba.js.map
|