shadow-claw 1.51.0 → 1.52.1
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/.well-known/mcp/server-card.json +1 -1
- package/.well-known/mcp.json +1 -1
- package/README.md +10 -10
- package/dist/cli/build/build.js +1 -1
- package/dist/cli/{chunk-Dtse8rAn.js → chunk-5ryVpyup.js} +1 -1
- package/dist/cli/chunk-Aq3057Xo.js +1 -0
- package/dist/cli/{chunk-4CZJpLqA.js → chunk-BV9JBYpl.js} +2 -2
- package/dist/cli/{chunk-mbFAP9Ev.js → chunk-BZI3bWDA.js} +1 -1
- package/dist/cli/chunk-BaUCHRPD.js +1 -0
- package/dist/cli/{chunk-vzUrhBN5.js → chunk-BdbEt6gM.js} +1 -1
- package/dist/cli/{chunk-DYq-orHK.js → chunk-BgTv9w0K.js} +1 -1
- package/dist/cli/{chunk-BU8UG4L_.js → chunk-BiWLawPV.js} +1 -1
- package/dist/cli/chunk-BkLnHJeo.js +1 -0
- package/dist/cli/{chunk-BqfPWIBf.js → chunk-BzWY1sKE.js} +1 -1
- package/dist/cli/{chunk-DajM7Kro.js → chunk-C79eIU-4.js} +1 -1
- package/dist/cli/{chunk-CI9r1AM5.js → chunk-CDw214Zi.js} +1 -1
- package/dist/cli/chunk-CNqc7LLn.js +1 -0
- package/dist/cli/{chunk-CEhU-Ah-.js → chunk-CWW7dqIv.js} +1 -1
- package/dist/cli/{chunk-BT_C3OlA.js → chunk-CcSTYHtR.js} +1 -1
- package/dist/cli/chunk-ClOfk6Ga.js +1 -0
- package/dist/cli/chunk-ComXUwW0.js +1 -0
- package/dist/cli/{chunk-lL1BhHVe.js → chunk-CooeO4UQ.js} +1 -1
- package/dist/cli/{chunk-khr7--yI.js → chunk-CtfWY4G6.js} +1 -1
- package/dist/cli/{chunk-C4iW1XuQ.js → chunk-DFgSiYMW.js} +1 -1
- package/dist/cli/chunk-DGBnjngK.js +1 -0
- package/dist/cli/{chunk-D7bFIUK3.js → chunk-DGu1OhJs.js} +1 -1
- package/dist/cli/{chunk-CzfOerQR.js → chunk-DIjCY0Wf.js} +1 -1
- package/dist/cli/{chunk-D-iqEY5G.js → chunk-DJ_LeQtz.js} +1 -1
- package/dist/cli/{chunk-BmEsDkRK.js → chunk-DQRu-9wO.js} +1 -1
- package/dist/cli/{chunk-DojiYody.js → chunk-DToVgO9a.js} +1 -1
- package/dist/cli/{chunk-De5a_Rlp.js → chunk-DVbNkQRL.js} +1 -1
- package/dist/cli/{chunk-c8MIYB2y.js → chunk-Ddtzaj43.js} +1 -1
- package/dist/cli/{chunk-aJ6fufe-.js → chunk-DiqS56rD.js} +1 -1
- package/dist/cli/{chunk-CeUEmZNt.js → chunk-DnRcu9b4.js} +1 -1
- package/dist/cli/chunk-DtgZDsJA.js +1 -0
- package/dist/cli/{chunk-DVMcK7g6.js → chunk-Du4qvxo_.js} +2 -2
- package/dist/cli/{chunk-CegcvNc9.js → chunk-Dz5_hgvL.js} +8 -8
- package/dist/cli/{chunk-Cd4Dv5Eq.js → chunk-I3mxEelq.js} +1 -1
- package/dist/cli/{chunk-Do3VICh1.js → chunk-IU2SH_ti.js} +1 -1
- package/dist/cli/{chunk-BQveaAaD.js → chunk-NC8XsSSA.js} +1 -1
- package/dist/cli/{chunk-D702W_Ry.js → chunk-Q4BZ9QN9.js} +1 -1
- package/dist/cli/chunk-WTlDd4Ou.js +1 -0
- package/dist/cli/chunk-XGzq5joC.js +1 -0
- package/dist/cli/{chunk-ar7eAlxK.js → chunk-aJfaGe2s.js} +8 -8
- package/dist/cli/chunk-bPVrFlmk.js +1 -0
- package/dist/cli/{chunk-C6jii2Fl.js → chunk-d5hIhj8t.js} +1 -1
- package/dist/cli/chunk-jXJHKxdR.js +1 -0
- package/dist/cli/{chunk-C3dTAmV_.js → chunk-rstVU7U0.js} +1 -1
- package/dist/cli/{chunk-DGfTzQui.js → chunk-t72uObQ7.js} +1 -1
- package/dist/cli/{chunk-DDgfljzN.js → chunk-vq8xlroY.js} +1 -1
- package/dist/cli/cli.js +1 -1
- package/dist/headless-agent.js +1 -1
- package/dist/lib/components/common/shadow-claw-provider-model-picker.js +1 -1
- package/dist/lib/components/index.js +27 -27
- 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/model-ranking.d.ts +12 -0
- 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-notifications.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/shadow-claw-chat.d.ts +1 -0
- 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-notifications.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-provider-model-picker.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/config/config.d.ts +2 -1
- package/dist/lib/{config-DxDaVDTn.js → config-DFLs7eoC.js} +3 -2
- package/dist/lib/config-DFLs7eoC.js.map +1 -0
- package/dist/lib/{configurePeerJs-ScwZiGbF.js → configurePeerJs-DJ0H6e6s.js} +3 -3
- package/dist/lib/{configurePeerJs-ScwZiGbF.js.map → configurePeerJs-DJ0H6e6s.js.map} +1 -1
- package/dist/lib/{connections-D82zele0.js → connections-DT3nPylw.js} +2 -2
- package/dist/lib/{connections-D82zele0.js.map → connections-DT3nPylw.js.map} +1 -1
- package/dist/lib/{downloadGroupFile-D7-5y6NI.js → downloadGroupFile-DMnAiPj4.js} +2 -2
- package/dist/lib/{downloadGroupFile-D7-5y6NI.js.map → downloadGroupFile-DMnAiPj4.js.map} +1 -1
- package/dist/lib/{file-viewer-BMvvndPQ.js → file-viewer-OHmGC_l7.js} +5 -5
- package/dist/lib/{file-viewer-BMvvndPQ.js.map → file-viewer-OHmGC_l7.js.map} +1 -1
- package/dist/lib/{getGroupDir-BidwYPfP.js → getGroupDir-mTV2Iz2b.js} +3 -3
- package/dist/lib/{getGroupDir-BidwYPfP.js.map → getGroupDir-mTV2Iz2b.js.map} +1 -1
- package/dist/lib/{git-CXmWufWS.js → git-CGdKghMC.js} +3 -3
- package/dist/lib/{git-CXmWufWS.js.map → git-CGdKghMC.js.map} +1 -1
- package/dist/lib/index.js +28 -28
- package/dist/lib/{initChatSplitResize-tvUZ-wsp.js → initChatSplitResize-B8zHHQdm.js} +2 -2
- package/dist/lib/{initChatSplitResize-tvUZ-wsp.js.map → initChatSplitResize-B8zHHQdm.js.map} +1 -1
- package/dist/lib/{initControlPlane-Dnjkb-6J.js → initControlPlane-BczrlTf3.js} +14 -14
- package/dist/lib/{initControlPlane-Dnjkb-6J.js.map → initControlPlane-BczrlTf3.js.map} +1 -1
- package/dist/lib/{markdown-WCXar9C8.js → markdown-D-7Cjyye.js} +3 -3
- package/dist/lib/{markdown-WCXar9C8.js.map → markdown-D-7Cjyye.js.map} +1 -1
- package/dist/lib/{mcp-reconnect-WTOQONHZ.js → mcp-reconnect-Czf7QCCv.js} +2 -2
- package/dist/lib/{mcp-reconnect-WTOQONHZ.js.map → mcp-reconnect-Czf7QCCv.js.map} +1 -1
- package/dist/lib/{memoryStorage-Bo2Wpfmg.js → memoryStorage-CXyKsKMo.js} +2 -2
- package/dist/lib/{memoryStorage-Bo2Wpfmg.js.map → memoryStorage-CXyKsKMo.js.map} +1 -1
- package/dist/lib/model-ranking-Bo8CpGH1.js +116 -0
- package/dist/lib/model-ranking-Bo8CpGH1.js.map +1 -0
- package/dist/lib/{orchestrator-Crw4btGn.js → orchestrator-BK138MkV.js} +10 -10
- package/dist/lib/{orchestrator-Crw4btGn.js.map → orchestrator-BK138MkV.js.map} +1 -1
- package/dist/lib/{orchestrator-Dro541iH.js → orchestrator-BtbxiPQB.js} +17 -16
- package/dist/lib/{orchestrator-Dro541iH.js.map → orchestrator-BtbxiPQB.js.map} +1 -1
- package/dist/lib/{peerjs-D741bHrf.js → peerjs-QJr03K9F.js} +7 -7
- package/dist/lib/{peerjs-D741bHrf.js.map → peerjs-QJr03K9F.js.map} +1 -1
- package/dist/lib/{prompt-api-D9XdrCep.js → prompt-api-vf351sf2.js} +2 -19
- package/dist/lib/{prompt-api-D9XdrCep.js.map → prompt-api-vf351sf2.js.map} +1 -1
- package/dist/lib/{push-client-DKFUY_Ti.js → push-client-BOHgqHbk.js} +4 -4
- package/dist/lib/{push-client-DKFUY_Ti.js.map → push-client-BOHgqHbk.js.map} +1 -1
- package/dist/lib/{readGroupFileBytes-C8Xqlb8l.js → readGroupFileBytes-CRA6dmgT.js} +2 -2
- package/dist/lib/{readGroupFileBytes-C8Xqlb8l.js.map → readGroupFileBytes-CRA6dmgT.js.map} +1 -1
- package/dist/lib/{shadow-claw-a2ui-CPydWVdW.js → shadow-claw-a2ui-DbZa4Gxp.js} +2 -2
- package/dist/lib/{shadow-claw-a2ui-CPydWVdW.js.map → shadow-claw-a2ui-DbZa4Gxp.js.map} +1 -1
- package/dist/lib/{shadow-claw-accounts-CUypXc3I.js → shadow-claw-accounts-B6OW2NVD.js} +3 -3
- package/dist/lib/{shadow-claw-accounts-CUypXc3I.js.map → shadow-claw-accounts-B6OW2NVD.js.map} +1 -1
- package/dist/lib/{shadow-claw-channel-config-D_Vb2ous.js → shadow-claw-channel-config-F_EJ-uK2.js} +3 -3
- package/dist/lib/{shadow-claw-channel-config-D_Vb2ous.js.map → shadow-claw-channel-config-F_EJ-uK2.js.map} +1 -1
- package/dist/lib/{shadow-claw-channels-hgjjzvRr.js → shadow-claw-channels-XYylMpjg.js} +3 -3
- package/dist/lib/{shadow-claw-channels-hgjjzvRr.js.map → shadow-claw-channels-XYylMpjg.js.map} +1 -1
- package/dist/lib/{shadow-claw-chat-D69IiLXd.js → shadow-claw-chat-dbK_DGO_.js} +124 -38
- package/dist/lib/shadow-claw-chat-dbK_DGO_.js.map +1 -0
- package/dist/lib/{shadow-claw-control-plane-zBYlFvzQ.js → shadow-claw-control-plane-BJKkmahQ.js} +7 -7
- package/dist/lib/{shadow-claw-control-plane-zBYlFvzQ.js.map → shadow-claw-control-plane-BJKkmahQ.js.map} +1 -1
- package/dist/lib/{shadow-claw-conversations-1GW8_e8o.js → shadow-claw-conversations-BKSsMYTc.js} +6 -6
- package/dist/lib/{shadow-claw-conversations-1GW8_e8o.js.map → shadow-claw-conversations-BKSsMYTc.js.map} +1 -1
- package/dist/lib/{shadow-claw-D3z3tFyE.js → shadow-claw-eBB2dbpd.js} +11 -11
- package/dist/lib/{shadow-claw-D3z3tFyE.js.map → shadow-claw-eBB2dbpd.js.map} +1 -1
- package/dist/lib/{shadow-claw-file-viewer-DI4r7Th9.js → shadow-claw-file-viewer-BqChtTvM.js} +8 -8
- package/dist/lib/{shadow-claw-file-viewer-DI4r7Th9.js.map → shadow-claw-file-viewer-BqChtTvM.js.map} +1 -1
- package/dist/lib/{shadow-claw-files-BM7qW3TW.js → shadow-claw-files-Bu7VCQw6.js} +9 -9
- package/dist/lib/{shadow-claw-files-BM7qW3TW.js.map → shadow-claw-files-Bu7VCQw6.js.map} +1 -1
- package/dist/lib/{shadow-claw-git-BBTiTYIn.js → shadow-claw-git-CdPPN6Qb.js} +6 -6
- package/dist/lib/{shadow-claw-git-BBTiTYIn.js.map → shadow-claw-git-CdPPN6Qb.js.map} +1 -1
- package/dist/lib/{shadow-claw-integrations-DTY3E545.js → shadow-claw-integrations-DehqBSRe.js} +4 -4
- package/dist/lib/{shadow-claw-integrations-DTY3E545.js.map → shadow-claw-integrations-DehqBSRe.js.map} +1 -1
- package/dist/lib/{shadow-claw-llm-AJwzkOGo.js → shadow-claw-llm-COZkufA8.js} +13 -11
- package/dist/lib/shadow-claw-llm-COZkufA8.js.map +1 -0
- package/dist/lib/{shadow-claw-mcp-remote-n7YXKxmv.js → shadow-claw-mcp-remote-axF50-le.js} +4 -4
- package/dist/lib/{shadow-claw-mcp-remote-n7YXKxmv.js.map → shadow-claw-mcp-remote-axF50-le.js.map} +1 -1
- package/dist/lib/{shadow-claw-networking-B3leDgZ4.js → shadow-claw-networking-BT_Rxj36.js} +2 -2
- package/dist/lib/{shadow-claw-networking-B3leDgZ4.js.map → shadow-claw-networking-BT_Rxj36.js.map} +1 -1
- package/dist/lib/{shadow-claw-notifications-Bm2aHQ0U.js → shadow-claw-notifications-ClqAXDDN.js} +3 -3
- package/dist/lib/{shadow-claw-notifications-Bm2aHQ0U.js.map → shadow-claw-notifications-ClqAXDDN.js.map} +1 -1
- package/dist/lib/{shadow-claw-page-header-BBqSWlhP.js → shadow-claw-page-header-bigC_h6U.js} +2 -2
- package/dist/lib/{shadow-claw-page-header-BBqSWlhP.js.map → shadow-claw-page-header-bigC_h6U.js.map} +1 -1
- package/dist/lib/{shadow-claw-pages-BFOcluFY.js → shadow-claw-pages-CjHS50HN.js} +10 -10
- package/dist/lib/{shadow-claw-pages-BFOcluFY.js.map → shadow-claw-pages-CjHS50HN.js.map} +1 -1
- package/dist/lib/{shadow-claw-peerjs-BvD_MH_l.js → shadow-claw-peerjs-CvcH2DkA.js} +3 -3
- package/dist/lib/{shadow-claw-peerjs-BvD_MH_l.js.map → shadow-claw-peerjs-CvcH2DkA.js.map} +1 -1
- package/dist/lib/{shadow-claw-provider-model-picker-CsA-507a.js → shadow-claw-provider-model-picker-fcVQdDtQ.js} +2 -2
- package/dist/lib/{shadow-claw-provider-model-picker-CsA-507a.js.map → shadow-claw-provider-model-picker-fcVQdDtQ.js.map} +1 -1
- package/dist/lib/{shadow-claw-settings-CZgGMz0a.js → shadow-claw-settings-CkO6JjA4.js} +6 -6
- package/dist/lib/{shadow-claw-settings-CZgGMz0a.js.map → shadow-claw-settings-CkO6JjA4.js.map} +1 -1
- package/dist/lib/{shadow-claw-storage-BTUpEKO0.js → shadow-claw-storage-10w-y8vL.js} +5 -5
- package/dist/lib/{shadow-claw-storage-BTUpEKO0.js.map → shadow-claw-storage-10w-y8vL.js.map} +1 -1
- package/dist/lib/{shadow-claw-task-server-B1X2AYyZ.js → shadow-claw-task-server-U98sZxPu.js} +2 -2
- package/dist/lib/{shadow-claw-task-server-B1X2AYyZ.js.map → shadow-claw-task-server-U98sZxPu.js.map} +1 -1
- package/dist/lib/{shadow-claw-tasks-BYtaRUAd.js → shadow-claw-tasks-DrSVUOsP.js} +8 -8
- package/dist/lib/{shadow-claw-tasks-BYtaRUAd.js.map → shadow-claw-tasks-DrSVUOsP.js.map} +1 -1
- package/dist/lib/{shadow-claw-terminal-LGuXKu77.js → shadow-claw-terminal-B7HYLuce.js} +2 -2
- package/dist/lib/{shadow-claw-terminal-LGuXKu77.js.map → shadow-claw-terminal-B7HYLuce.js.map} +1 -1
- package/dist/lib/{shadow-claw-tools-C_S-xXVG.js → shadow-claw-tools-BKrXzZfF.js} +7 -7
- package/dist/lib/{shadow-claw-tools-C_S-xXVG.js.map → shadow-claw-tools-BKrXzZfF.js.map} +1 -1
- package/dist/lib/{shadow-claw-webvm-Cab1n1bu.js → shadow-claw-webvm-Duwa5oiW.js} +3 -3
- package/dist/lib/{shadow-claw-webvm-Cab1n1bu.js.map → shadow-claw-webvm-Duwa5oiW.js.map} +1 -1
- package/dist/lib/{syncWebMcpRegistration-Dy5NS_4G.js → syncWebMcpRegistration-BOx-0F6_.js} +5 -5
- package/dist/lib/{syncWebMcpRegistration-Dy5NS_4G.js.map → syncWebMcpRegistration-BOx-0F6_.js.map} +1 -1
- package/dist/lib/{tools-B7gC1eb_.js → tools-BEuBatUs.js} +4 -4
- package/dist/lib/{tools-B7gC1eb_.js.map → tools-BEuBatUs.js.map} +1 -1
- package/dist/lib/utils/index.js +1 -1
- package/dist/lib/utils/utils.js +1 -1
- package/dist/lib/{utils-D_ylqOY-.js → utils-D8AxCH6m.js} +2 -2
- package/dist/lib/{utils-D_ylqOY-.js.map → utils-D8AxCH6m.js.map} +1 -1
- package/dist/lib/{webmcp-CkYINKJj.js → webmcp-BjfVWX1K.js} +2 -2
- package/dist/lib/{webmcp-CkYINKJj.js.map → webmcp-BjfVWX1K.js.map} +1 -1
- package/dist/public/.well-known/mcp/server-card.json +1 -1
- package/dist/public/.well-known/mcp.json +1 -1
- package/dist/public/AGENTS.md +1 -1
- package/dist/public/README.md +10 -10
- package/dist/public/agent.worker.js +1 -1
- package/dist/public/components/shadow-claw-chat/shadow-claw-chat.html +1 -1
- package/dist/public/config-071HSho8.js +1 -0
- package/dist/public/{configurePeerJs-DQQ6YL-5.js → configurePeerJs-DL-LurJY.js} +1 -1
- package/dist/public/{connections-CRNk2FxF.js → connections-Bb0rBpV-.js} +1 -1
- package/dist/public/{custom-element-security-3_FKCXcg.js → custom-element-security-Td4vrRc_.js} +1 -1
- package/dist/public/docs/README.md +1 -1
- package/dist/public/docs/architecture/orchestrator.md +2 -2
- package/dist/public/docs/architecture/overview.md +3 -3
- package/dist/public/docs/architecture/worker-protocol.md +29 -29
- package/dist/public/docs/example/article/index.html +1 -1
- package/dist/public/docs/example/article.html +1 -1
- package/dist/public/docs/publishing/index.html +1 -1
- package/dist/public/docs/publishing.html +1 -1
- package/dist/public/docs/skill-creator/index.html +1 -1
- package/dist/public/docs/skill-creator.html +1 -1
- package/dist/public/docs/subsystems/local-models.md +1 -1
- package/dist/public/docs/subsystems/providers.md +12 -5
- package/dist/public/{downloadGroupFile-wkdhVgrZ.js → downloadGroupFile-Unq8_7D9.js} +1 -1
- package/dist/public/e2e/README.md +2 -2
- package/dist/public/{e2e-bridge-DnFHPuwg.js → e2e-bridge-Dbc9fCDq.js} +1 -1
- package/dist/public/{file-viewer-C92v4Ggd.js → file-viewer-QkCuknFn.js} +1 -1
- package/dist/public/{getGroupDir-BGGIJL4Y.js → getGroupDir-Bj5XCflQ.js} +1 -1
- package/dist/public/{git-BH6qyToB.js → git-Bhz4YHc8.js} +2 -2
- package/dist/public/index.html +1 -1
- package/dist/public/index.js +1 -1
- package/dist/public/{initChatSplitResize--RH5kzVF.js → initChatSplitResize-KNL9Oh7s.js} +1 -1
- package/dist/public/{initControlPlane-yPJ3ajkj.js → initControlPlane-D2fVhRFC.js} +1 -1
- package/dist/public/llms.txt +1 -1
- package/dist/public/main/index.html +1 -1
- package/dist/public/main/memory/index.html +1 -1
- package/dist/public/main/memory.html +1 -1
- package/dist/public/main.html +1 -1
- package/dist/public/{markdown-CA0v11cd.js → markdown-By6gdUvF.js} +1 -1
- package/dist/public/{mcp-reconnect-uyNSigzu.js → mcp-reconnect-CDRJPuoN.js} +1 -1
- package/dist/public/{memoryStorage-DjPNAT5t.js → memoryStorage-C-ao9y-j.js} +1 -1
- package/dist/public/model-ranking-DUdrFOcC.js +1 -0
- package/dist/public/{orchestrator-DTzgyL23.js → orchestrator-B7MpomoG.js} +2 -2
- package/dist/public/{orchestrator-Cmr69pMC.js → orchestrator-C8aIHbDy.js} +2 -2
- package/dist/public/{peerjs-Br38mUFC.js → peerjs-DwGjY5VX.js} +1 -1
- package/dist/public/prompt-api-BWe_j3Wg.js +1 -0
- package/dist/public/{push-client-CB8haOGC.js → push-client-o8g5_EOe.js} +1 -1
- package/dist/public/service-worker.js +1 -1
- package/dist/public/{shadow-claw-RuFQ2Ej5.js → shadow-claw-T9oPpqxT.js} +2 -2
- package/dist/public/{shadow-claw-accounts-BMsEItB6.js → shadow-claw-accounts-BbNPiiaV.js} +1 -1
- package/dist/public/{shadow-claw-channels-Q_AXuEaI.js → shadow-claw-channels-CHGtPkfY.js} +1 -1
- package/dist/public/{shadow-claw-chat-DZQ3OaH7.js → shadow-claw-chat-3TmjJA6-.js} +90 -23
- package/dist/public/{shadow-claw-control-plane-CyXA8tB8.js → shadow-claw-control-plane-BAFT06LL.js} +2 -2
- package/dist/public/{shadow-claw-conversations-BLKtlvHe.js → shadow-claw-conversations-DsQ_kxWm.js} +1 -1
- package/dist/public/{shadow-claw-file-viewer-CVLDfpZe.js → shadow-claw-file-viewer-hBxTknL2.js} +1 -1
- package/dist/public/{shadow-claw-files-DB6VVjir.js → shadow-claw-files-Daw6IIrJ.js} +1 -1
- package/dist/public/{shadow-claw-git-D57bTSMF.js → shadow-claw-git-CxGwyxim.js} +2 -2
- package/dist/public/{shadow-claw-integrations-BOwhUY-4.js → shadow-claw-integrations-DnIr6xp-.js} +1 -1
- package/dist/public/{shadow-claw-llm-CYenm-mm.js → shadow-claw-llm-Bc6tZ8kk.js} +3 -3
- package/dist/public/{shadow-claw-mcp-remote-CJ-Ckl0j.js → shadow-claw-mcp-remote-nGPpFpI-.js} +1 -1
- package/dist/public/{shadow-claw-networking-Cut76YQL.js → shadow-claw-networking-B6YgtiA7.js} +1 -1
- package/dist/public/{shadow-claw-notifications-C3kYCrIa.js → shadow-claw-notifications-BSxifptS.js} +1 -1
- package/dist/public/{shadow-claw-page-header-Dd7QafUk.js → shadow-claw-page-header-LzVgEn46.js} +1 -1
- package/dist/public/{shadow-claw-pages-BWtVtwTG.js → shadow-claw-pages-IW_LNEL_.js} +2 -2
- package/dist/public/{shadow-claw-settings-Bj7jnngO.js → shadow-claw-settings-DGkwt1ge.js} +2 -2
- package/dist/public/{shadow-claw-storage-CMSzQs1-.js → shadow-claw-storage-DX_4T7KR.js} +1 -1
- package/dist/public/{shadow-claw-task-server-CFclo7UX.js → shadow-claw-task-server-DTsbEs5z.js} +1 -1
- package/dist/public/{shadow-claw-tasks-ClDdeB6Z.js → shadow-claw-tasks-rr6fMxAM.js} +1 -1
- package/dist/public/{shadow-claw-terminal-3ysWZJix.js → shadow-claw-terminal-C7DhrrX6.js} +1 -1
- package/dist/public/{shadow-claw-tools-DQVwpTcZ.js → shadow-claw-tools-DcQroojH.js} +1 -1
- package/dist/public/{shadow-claw-webvm-Cnxz04Fk.js → shadow-claw-webvm-bZj44Did.js} +1 -1
- package/dist/public/{syncWebMcpRegistration-QwnLMAK3.js → syncWebMcpRegistration-XJjIlDNO.js} +1 -1
- package/dist/public/{tools-DvQ_ngXn.js → tools-BpZh7hgB.js} +1 -1
- package/dist/public/{webmcp-CJymew4t.js → webmcp-CkfDZfZ0.js} +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/src/cli/build/build.test.ts +95 -0
- package/src/cli/build/build.ts +5 -1
- package/src/cli/commands/agent.test.ts +134 -0
- package/src/cli/commands/backup.test.ts +85 -0
- package/src/cli/commands/clients.test.ts +32 -0
- package/src/cli/commands/mcp.test.ts +260 -1
- package/src/cli/commands/send-file.test.ts +73 -0
- package/src/cli/commands/send.test.ts +58 -0
- package/src/cli/commands/tasks.test.ts +78 -0
- package/src/cli/commands/webrtc-listen.test.ts +74 -0
- package/src/cli/tools/assert-version-bump.test.ts +30 -1
- package/src/cli/tools/file-search-replace.test.ts +33 -1
- package/src/cli/tools/patch-service-worker-trusted-types.test.ts +24 -1
- package/src/cli/tools/touch-nojekyll.test.ts +12 -0
- package/src/cli/tools/version.test.ts +109 -5
- package/src/cli/utils/agent-core.test.ts +40 -0
- package/src/cli/utils/control-client.test.ts +239 -2
- package/src/cli/utils/load-workspace-config.test.ts +63 -0
- package/src/cli/utils/local-models.test.ts +98 -0
- package/src/cli/utils/progress-bar.test.ts +41 -2
- package/src/cli/utils/resolve-cache-dir.test.ts +61 -0
- package/src/cli/utils/resolve-project-root.test.ts +17 -0
- package/src/cli/utils/stdin.test.ts +38 -0
- package/src/cli/utils/stdio.test.ts +51 -1
- package/src/cli/utils/suppress-warnings.test.ts +9 -0
- package/src/cli/utils/webrtc-control-client.test.ts +569 -0
- package/src/common/utils/frontmatter.test.ts +117 -0
- package/src/components/common/help/providers.test.ts +67 -0
- package/src/components/common/shadow-claw-provider-model-picker/shadow-claw-provider-model-picker.test.ts +121 -0
- package/src/components/settings/shadow-claw-accounts/shadow-claw-accounts.test.ts +131 -0
- package/src/components/settings/shadow-claw-git/shadow-claw-git.test.ts +130 -0
- package/src/components/settings/shadow-claw-integrations/connection-test-auth.test.ts +12 -0
- package/src/components/settings/shadow-claw-integrations/shadow-claw-integrations.test.ts +328 -0
- package/src/components/settings/shadow-claw-llm/model-ranking.test.ts +121 -7
- package/src/components/settings/shadow-claw-llm/model-ranking.ts +97 -0
- package/src/components/settings/shadow-claw-llm/shadow-claw-llm.test.ts +565 -8
- package/src/components/settings/shadow-claw-llm/shadow-claw-llm.ts +15 -5
- package/src/components/settings/shadow-claw-mcp-remote/shadow-claw-mcp-remote.test.ts +459 -0
- package/src/components/settings/shadow-claw-networking/shadow-claw-networking.test.ts +88 -0
- package/src/components/settings/shadow-claw-notifications/shadow-claw-notifications.test.ts +92 -0
- package/src/components/settings/shadow-claw-peerjs/shadow-claw-peerjs.test.ts +127 -0
- package/src/components/settings/shadow-claw-storage/shadow-claw-storage.test.ts +173 -0
- package/src/components/settings/shadow-claw-task-server/shadow-claw-task-server.test.ts +62 -0
- package/src/components/settings/shadow-claw-webvm/shadow-claw-webvm.test.ts +104 -0
- package/src/components/shadow-claw/shadow-claw.test.ts +112 -0
- package/src/components/shadow-claw-a2ui/shadow-claw-a2ui.test.ts +109 -0
- package/src/components/shadow-claw-chat/shadow-claw-chat.html +81 -14
- package/src/components/shadow-claw-chat/shadow-claw-chat.test.ts +73 -0
- package/src/components/shadow-claw-chat/shadow-claw-chat.trusted-types.test.ts +3 -0
- package/src/components/shadow-claw-chat/shadow-claw-chat.ts +79 -32
- package/src/components/shadow-claw-conversations/shadow-claw-conversations.test.ts +361 -0
- package/src/components/shadow-claw-dialog/shadow-claw-dialog.test.ts +76 -0
- package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.test.ts +307 -0
- package/src/components/shadow-claw-files/shadow-claw-files.test.ts +398 -1
- package/src/components/shadow-claw-pages/shadow-claw-pages.test.ts +85 -0
- package/src/components/shadow-claw-pages/shadow-claw-pages.ts +2 -1
- package/src/components/shadow-claw-pdf-viewer/shadow-claw-pdf-viewer.test.ts +229 -0
- package/src/components/shadow-claw-settings/shadow-claw-settings.test.ts +233 -0
- package/src/components/shadow-claw-tasks/shadow-claw-tasks.test.ts +223 -1
- package/src/components/shadow-claw-toast/shadow-claw-toast.test.ts +79 -0
- package/src/components/shadow-claw-tools/shadow-claw-tools.test.ts +229 -1
- package/src/config/config.test.ts +4 -4
- package/src/config/config.ts +2 -1
- package/src/core/orchestrator/orchestrator.test.ts +2 -1
- package/src/core/orchestrator/utils/initTasks.ts +5 -4
- package/src/server/logger.test.ts +57 -0
- package/src/server/peer.test.ts +47 -0
- package/src/server/routes/gemini.test.ts +244 -0
- package/src/server/server-peer.test.ts +245 -11
- package/src/server/services/llamafile-manager.test.ts +668 -0
- package/src/share-target/pending-shares.test.ts +90 -0
- package/src/shell/fs.test.ts +125 -0
- package/src/shell/shell.test.ts +8 -0
- package/src/subsystems/git/credentials.test.ts +260 -0
- package/src/subsystems/git/git.test.ts +64 -0
- package/src/subsystems/providers/executeNativeAiTask.test.ts +78 -0
- package/src/subsystems/providers/utils/parseLocalModelToolCall.test.ts +57 -0
- package/src/worker/tools/builtin-ai/builtin-ai.test.ts +88 -0
- package/src/worker/tools/email/email.test.ts +358 -0
- package/src/worker/tools/email/utils/resolveIntegrationEmailAuth.test.ts +120 -0
- package/src/worker/tools/email/utils/resolveUniqueAttachmentPath.test.ts +80 -0
- package/src/worker/tools/fetch-file/fetch-file.test.ts +111 -0
- package/src/worker/tools/fetch-url/fetch-url.test.ts +295 -0
- package/dist/cli/chunk-B3S061IE.js +0 -1
- package/dist/cli/chunk-BUJdF9o3.js +0 -1
- package/dist/cli/chunk-BX0R2gIY.js +0 -1
- package/dist/cli/chunk-BoiPfhwJ.js +0 -1
- package/dist/cli/chunk-BtJYj7vB.js +0 -1
- package/dist/cli/chunk-BwXrZVeU.js +0 -1
- package/dist/cli/chunk-CaWh9Pru.js +0 -1
- package/dist/cli/chunk-Ck4ePI8z.js +0 -1
- package/dist/cli/chunk-Ctg-SXcP.js +0 -1
- package/dist/cli/chunk-DTKv1-tk.js +0 -1
- package/dist/cli/chunk-DdYpd9Nu.js +0 -1
- package/dist/cli/chunk-DflhmBY2.js +0 -1
- package/dist/lib/config-DxDaVDTn.js.map +0 -1
- package/dist/lib/model-ranking-CDXs7hkK.js +0 -57
- package/dist/lib/model-ranking-CDXs7hkK.js.map +0 -1
- package/dist/lib/shadow-claw-chat-D69IiLXd.js.map +0 -1
- package/dist/lib/shadow-claw-llm-AJwzkOGo.js.map +0 -1
- package/dist/public/config-Dqn5OMfC.js +0 -1
- package/dist/public/model-ranking-DLIC9IDU.js +0 -1
- package/dist/public/prompt-api-B-8N-MRY.js +0 -11
|
@@ -21,6 +21,9 @@ import {
|
|
|
21
21
|
writeIpcFile,
|
|
22
22
|
clearIpcFile,
|
|
23
23
|
CliWebRtcListener,
|
|
24
|
+
resolveListenerIpc,
|
|
25
|
+
sendCommandViaIpc,
|
|
26
|
+
getIpcSocketPath,
|
|
24
27
|
} from "./webrtc-control-client.js";
|
|
25
28
|
|
|
26
29
|
describe("src/cli/utils/webrtc-control-client.ts", () => {
|
|
@@ -423,4 +426,570 @@ describe("CliWebRtcListener", () => {
|
|
|
423
426
|
120000,
|
|
424
427
|
);
|
|
425
428
|
});
|
|
429
|
+
|
|
430
|
+
it("CliWebRtcControlClient.listClients returns empty array when no IPC or IPC error", async () => {
|
|
431
|
+
const client = new CliWebRtcControlClient({ cacheDir: tempDir });
|
|
432
|
+
const empty = await client.listClients();
|
|
433
|
+
expect(empty).toEqual([]);
|
|
434
|
+
|
|
435
|
+
// With invalid IPC socket
|
|
436
|
+
writeIpcFile("/tmp/non-existent-sock-" + Date.now(), tempDir);
|
|
437
|
+
const emptyWithIpc = await client.listClients();
|
|
438
|
+
expect(emptyWithIpc).toEqual([]);
|
|
439
|
+
clearIpcFile(tempDir);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
it("CliWebRtcControlClient.sendFile throws when file does not exist or is directory", async () => {
|
|
443
|
+
const client = new CliWebRtcControlClient({ cacheDir: tempDir });
|
|
444
|
+
await expect(client.sendFile("peer-1", "/not/found.txt")).rejects.toThrow(
|
|
445
|
+
"File not found",
|
|
446
|
+
);
|
|
447
|
+
await expect(client.sendFile("peer-1", tempDir)).rejects.toThrow(
|
|
448
|
+
"Cannot send directory",
|
|
449
|
+
);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it("CliWebRtcListener._setupConnection handles open, agent cards, invalid JSON, close, and error", async () => {
|
|
453
|
+
const listener = new CliWebRtcListener({
|
|
454
|
+
cacheDir: tempDir,
|
|
455
|
+
trustedPeerIds: ["trusted-peer", "prefix-*"],
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
expect(listener._isTrusted("trusted-peer")).toBe(true);
|
|
459
|
+
expect(listener._isTrusted("prefix-abc")).toBe(true);
|
|
460
|
+
expect(listener._isTrusted("untrusted-peer")).toBe(false);
|
|
461
|
+
|
|
462
|
+
const handlers: Record<string, Function> = {};
|
|
463
|
+
const mockConn = {
|
|
464
|
+
on: jest.fn((event: string, handler: Function) => {
|
|
465
|
+
handlers[event] = handler;
|
|
466
|
+
}),
|
|
467
|
+
send: jest.fn(),
|
|
468
|
+
close: jest.fn(),
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
listener._setupConnection(mockConn, "trusted-peer");
|
|
472
|
+
|
|
473
|
+
// open event
|
|
474
|
+
handlers["open"]();
|
|
475
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
476
|
+
expect.objectContaining({ method: "GetAgentCard" }),
|
|
477
|
+
);
|
|
478
|
+
|
|
479
|
+
// data: invalid string
|
|
480
|
+
await handlers["data"]("invalid-json");
|
|
481
|
+
|
|
482
|
+
// data: card result
|
|
483
|
+
await handlers["data"]({ result: { name: "Remote Agent" } });
|
|
484
|
+
|
|
485
|
+
// data: GetAgentCard request
|
|
486
|
+
await handlers["data"]({ method: "GetAgentCard", id: "card-req-1" });
|
|
487
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
488
|
+
expect.objectContaining({
|
|
489
|
+
id: "card-req-1",
|
|
490
|
+
result: expect.objectContaining({ name: "ShadowClaw CLI" }),
|
|
491
|
+
}),
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
// error event
|
|
495
|
+
handlers["error"](new Error("conn err"));
|
|
496
|
+
|
|
497
|
+
// close event
|
|
498
|
+
handlers["close"]();
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
it("CliWebRtcListener._handleCommand handles errors and unknown actions", async () => {
|
|
502
|
+
const listener = new CliWebRtcListener({
|
|
503
|
+
cacheDir: tempDir,
|
|
504
|
+
handlers: {
|
|
505
|
+
"failing-action": async () => {
|
|
506
|
+
throw new Error("Action failure");
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
const mockConn = { send: jest.fn() };
|
|
512
|
+
|
|
513
|
+
// Failing action
|
|
514
|
+
await listener._handleCommand(mockConn, "peer-1", {
|
|
515
|
+
payload: { commandId: "cmd-err", action: "failing-action", args: {} },
|
|
516
|
+
});
|
|
517
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
518
|
+
expect.objectContaining({
|
|
519
|
+
type: "command:result",
|
|
520
|
+
payload: expect.objectContaining({
|
|
521
|
+
commandId: "cmd-err",
|
|
522
|
+
success: false,
|
|
523
|
+
error: "Action failure",
|
|
524
|
+
}),
|
|
525
|
+
}),
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
// Unknown action
|
|
529
|
+
await listener._handleCommand(mockConn, "peer-1", {
|
|
530
|
+
payload: { commandId: "cmd-unk", action: "unknown-action", args: {} },
|
|
531
|
+
});
|
|
532
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
533
|
+
expect.objectContaining({
|
|
534
|
+
type: "command:result",
|
|
535
|
+
payload: expect.objectContaining({
|
|
536
|
+
commandId: "cmd-unk",
|
|
537
|
+
success: false,
|
|
538
|
+
error: "Unknown action: unknown-action",
|
|
539
|
+
}),
|
|
540
|
+
}),
|
|
541
|
+
);
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
describe("resolveListenerIpc and sendCommandViaIpc", () => {
|
|
546
|
+
let tempDir: string;
|
|
547
|
+
let http: typeof import("node:http");
|
|
548
|
+
|
|
549
|
+
beforeEach(async () => {
|
|
550
|
+
http = await import("node:http");
|
|
551
|
+
tempDir = path.join(
|
|
552
|
+
os.tmpdir(),
|
|
553
|
+
"test-webrtc-ipc-func-" +
|
|
554
|
+
Date.now() +
|
|
555
|
+
"-" +
|
|
556
|
+
Math.random().toString(36).slice(2),
|
|
557
|
+
);
|
|
558
|
+
fs.mkdirSync(tempDir, { recursive: true });
|
|
559
|
+
});
|
|
560
|
+
|
|
561
|
+
afterEach(() => {
|
|
562
|
+
try {
|
|
563
|
+
if (fs.existsSync(tempDir)) {
|
|
564
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
565
|
+
}
|
|
566
|
+
} catch (_) {}
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
it("resolveListenerIpc returns null when socket does not exist", async () => {
|
|
570
|
+
const res = await resolveListenerIpc(tempDir);
|
|
571
|
+
expect(res).toBeNull();
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
it("resolveListenerIpc returns socketPath when /ping returns 200, and null when /ping errors", async () => {
|
|
575
|
+
const socketPath = getIpcSocketPath(tempDir);
|
|
576
|
+
let pingStatus = 200;
|
|
577
|
+
const server = http.createServer((req, res) => {
|
|
578
|
+
if (req.url === "/ping") {
|
|
579
|
+
res.writeHead(pingStatus);
|
|
580
|
+
res.end(JSON.stringify({ ok: true }));
|
|
581
|
+
} else {
|
|
582
|
+
res.writeHead(404);
|
|
583
|
+
res.end();
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
await new Promise((resolve) => server.listen(socketPath, resolve as any));
|
|
588
|
+
try {
|
|
589
|
+
const resOk = await resolveListenerIpc(tempDir);
|
|
590
|
+
expect(resOk).toEqual({ socketPath });
|
|
591
|
+
|
|
592
|
+
pingStatus = 500;
|
|
593
|
+
const resFail = await resolveListenerIpc(tempDir);
|
|
594
|
+
expect(resFail).toBeNull();
|
|
595
|
+
} finally {
|
|
596
|
+
await new Promise((resolve) => server.close(resolve as any));
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
it("sendCommandViaIpc sends command to IPC socket and handles success, failure, and bad JSON", async () => {
|
|
601
|
+
const socketPath = getIpcSocketPath(tempDir);
|
|
602
|
+
let responseStatus = 200;
|
|
603
|
+
let responseBody: string = JSON.stringify({ ok: true, data: "pong" });
|
|
604
|
+
|
|
605
|
+
const server = http.createServer((req, res) => {
|
|
606
|
+
if (req.method === "POST" && req.url === "/command") {
|
|
607
|
+
let body = "";
|
|
608
|
+
req.on("data", (c) => (body += c));
|
|
609
|
+
req.on("end", () => {
|
|
610
|
+
res.writeHead(responseStatus, { "Content-Type": "application/json" });
|
|
611
|
+
res.end(responseBody);
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
await new Promise((resolve) => server.listen(socketPath, resolve as any));
|
|
617
|
+
try {
|
|
618
|
+
// 1. Success
|
|
619
|
+
const res = await sendCommandViaIpc(
|
|
620
|
+
{ socketPath },
|
|
621
|
+
"target-peer-1",
|
|
622
|
+
"ping",
|
|
623
|
+
{ val: 1 },
|
|
624
|
+
5000,
|
|
625
|
+
);
|
|
626
|
+
expect(res).toEqual({ ok: true, data: "pong" });
|
|
627
|
+
|
|
628
|
+
// 2. HTTP error with error message
|
|
629
|
+
responseStatus = 400;
|
|
630
|
+
responseBody = JSON.stringify({ error: "Invalid target peer" });
|
|
631
|
+
await expect(
|
|
632
|
+
sendCommandViaIpc(
|
|
633
|
+
{ socketPath },
|
|
634
|
+
"target-peer-1",
|
|
635
|
+
"bad-action",
|
|
636
|
+
{},
|
|
637
|
+
5000,
|
|
638
|
+
),
|
|
639
|
+
).rejects.toThrow("Invalid target peer");
|
|
640
|
+
|
|
641
|
+
// 3. Bad JSON
|
|
642
|
+
responseStatus = 200;
|
|
643
|
+
responseBody = "not valid json";
|
|
644
|
+
await expect(
|
|
645
|
+
sendCommandViaIpc({ socketPath }, "target-peer-1", "ping", {}, 5000),
|
|
646
|
+
).rejects.toThrow("Bad IPC response");
|
|
647
|
+
} finally {
|
|
648
|
+
await new Promise((resolve) => server.close(resolve as any));
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
describe("CliWebRtcControlClient sendCommand and sendFile", () => {
|
|
654
|
+
let tempDir: string;
|
|
655
|
+
|
|
656
|
+
beforeEach(() => {
|
|
657
|
+
tempDir = path.join(
|
|
658
|
+
os.tmpdir(),
|
|
659
|
+
"test-webrtc-client-cmd-" +
|
|
660
|
+
Date.now() +
|
|
661
|
+
"-" +
|
|
662
|
+
Math.random().toString(36).slice(2),
|
|
663
|
+
);
|
|
664
|
+
fs.mkdirSync(tempDir, { recursive: true });
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
afterEach(() => {
|
|
668
|
+
try {
|
|
669
|
+
if (fs.existsSync(tempDir)) {
|
|
670
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
671
|
+
}
|
|
672
|
+
} catch (_) {}
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
it("sendCommand uses IPC when listener socket is active", async () => {
|
|
676
|
+
const http = await import("node:http");
|
|
677
|
+
const socketPath = getIpcSocketPath(tempDir);
|
|
678
|
+
const server = http.createServer((req, res) => {
|
|
679
|
+
if (req.url === "/ping") {
|
|
680
|
+
res.writeHead(200);
|
|
681
|
+
res.end("ok");
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
if (req.method === "POST" && req.url === "/command") {
|
|
685
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
686
|
+
res.end(JSON.stringify({ success: true, result: "ipc-done" }));
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
await new Promise((resolve) => server.listen(socketPath, resolve as any));
|
|
692
|
+
try {
|
|
693
|
+
const client = new CliWebRtcControlClient({ cacheDir: tempDir });
|
|
694
|
+
const res = await client.sendCommand("target-1", "action-1", { a: 1 });
|
|
695
|
+
expect(res).toEqual({ success: true, result: "ipc-done" });
|
|
696
|
+
} finally {
|
|
697
|
+
await new Promise((resolve) => server.close(resolve as any));
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
it("sendCommand connects via WebRTC peer when IPC is inactive", async () => {
|
|
702
|
+
const client = new CliWebRtcControlClient({ cacheDir: tempDir });
|
|
703
|
+
const handlers: Record<string, Function> = {};
|
|
704
|
+
const mockConn = {
|
|
705
|
+
on: jest.fn((evt: string, fn: Function) => {
|
|
706
|
+
handlers[evt] = fn;
|
|
707
|
+
}),
|
|
708
|
+
send: jest.fn(),
|
|
709
|
+
close: jest.fn(),
|
|
710
|
+
};
|
|
711
|
+
const mockPeer = {
|
|
712
|
+
connect: jest.fn().mockReturnValue(mockConn),
|
|
713
|
+
destroy: jest.fn(),
|
|
714
|
+
};
|
|
715
|
+
(client as any)._getPeer = jest.fn().mockResolvedValue(mockPeer);
|
|
716
|
+
|
|
717
|
+
const promise = client.sendCommand("peer-x", "run", { arg: 123 });
|
|
718
|
+
for (let i = 0; i < 20 && !handlers["open"]; i++) {
|
|
719
|
+
await new Promise((r) => setTimeout(r, 10));
|
|
720
|
+
}
|
|
721
|
+
// Simulate open
|
|
722
|
+
handlers["open"]();
|
|
723
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
724
|
+
expect.objectContaining({
|
|
725
|
+
type: "command:execute",
|
|
726
|
+
payload: expect.objectContaining({ action: "run" }),
|
|
727
|
+
}),
|
|
728
|
+
);
|
|
729
|
+
|
|
730
|
+
// Simulate GetAgentCard message received
|
|
731
|
+
handlers["data"]({ method: "GetAgentCard", id: "card-msg-1" });
|
|
732
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
733
|
+
expect.objectContaining({
|
|
734
|
+
id: "card-msg-1",
|
|
735
|
+
result: expect.objectContaining({ name: "ShadowClaw CLI" }),
|
|
736
|
+
}),
|
|
737
|
+
);
|
|
738
|
+
|
|
739
|
+
// Simulate result data
|
|
740
|
+
handlers["data"]({
|
|
741
|
+
type: "command:result",
|
|
742
|
+
payload: { success: true, output: "finished" },
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
const res = await promise;
|
|
746
|
+
expect(res).toEqual({ success: true, output: "finished" });
|
|
747
|
+
expect(mockConn.close).toHaveBeenCalled();
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
it("sendCommand rejects when connection receives error or error payload", async () => {
|
|
751
|
+
const client = new CliWebRtcControlClient({ cacheDir: tempDir });
|
|
752
|
+
let handlers: Record<string, Function> = {};
|
|
753
|
+
const mockConn = {
|
|
754
|
+
on: jest.fn((evt: string, fn: Function) => {
|
|
755
|
+
handlers[evt] = fn;
|
|
756
|
+
}),
|
|
757
|
+
send: jest.fn(),
|
|
758
|
+
close: jest.fn(),
|
|
759
|
+
};
|
|
760
|
+
const mockPeer = {
|
|
761
|
+
connect: jest.fn().mockReturnValue(mockConn),
|
|
762
|
+
destroy: jest.fn(),
|
|
763
|
+
};
|
|
764
|
+
(client as any)._getPeer = jest.fn().mockResolvedValue(mockPeer);
|
|
765
|
+
|
|
766
|
+
// 1. Error payload
|
|
767
|
+
const p1 = client.sendCommand("peer-x", "fail-action", {});
|
|
768
|
+
for (let i = 0; i < 20 && !handlers["open"]; i++) {
|
|
769
|
+
await new Promise((r) => setTimeout(r, 10));
|
|
770
|
+
}
|
|
771
|
+
handlers["open"]();
|
|
772
|
+
handlers["data"]({
|
|
773
|
+
type: "command:result",
|
|
774
|
+
payload: { error: "Remote execution failed" },
|
|
775
|
+
});
|
|
776
|
+
await expect(p1).rejects.toThrow("Remote execution failed");
|
|
777
|
+
|
|
778
|
+
// 2. Connection error
|
|
779
|
+
handlers = {};
|
|
780
|
+
const p2 = client.sendCommand("peer-x", "err-action", {});
|
|
781
|
+
for (let i = 0; i < 20 && !handlers["error"]; i++) {
|
|
782
|
+
await new Promise((r) => setTimeout(r, 10));
|
|
783
|
+
}
|
|
784
|
+
handlers["error"](new Error("Peer disconnected abruptly"));
|
|
785
|
+
await expect(p2).rejects.toThrow(
|
|
786
|
+
"WebRTC connection error to peer 'peer-x': Peer disconnected abruptly",
|
|
787
|
+
);
|
|
788
|
+
});
|
|
789
|
+
|
|
790
|
+
it("sendFile validates file existence and directory before sending", async () => {
|
|
791
|
+
const client = new CliWebRtcControlClient({ cacheDir: tempDir });
|
|
792
|
+
|
|
793
|
+
// Non-existent file
|
|
794
|
+
await expect(
|
|
795
|
+
client.sendFile("peer-x", "/non/existent/file.bin"),
|
|
796
|
+
).rejects.toThrow("File not found");
|
|
797
|
+
|
|
798
|
+
// Directory
|
|
799
|
+
await expect(client.sendFile("peer-x", tempDir)).rejects.toThrow(
|
|
800
|
+
"Cannot send directory",
|
|
801
|
+
);
|
|
802
|
+
|
|
803
|
+
// Valid file
|
|
804
|
+
const filePath = path.join(tempDir, "sample.txt");
|
|
805
|
+
fs.writeFileSync(filePath, "test content", "utf8");
|
|
806
|
+
client.sendCommand = jest.fn().mockResolvedValue({ success: true });
|
|
807
|
+
|
|
808
|
+
const res = await client.sendFile("peer-x", filePath, {
|
|
809
|
+
prompt: "Analyze this",
|
|
810
|
+
});
|
|
811
|
+
expect(res).toEqual({ success: true });
|
|
812
|
+
expect(client.sendCommand).toHaveBeenCalledWith(
|
|
813
|
+
"peer-x",
|
|
814
|
+
"send-file",
|
|
815
|
+
expect.objectContaining({
|
|
816
|
+
fileName: "sample.txt",
|
|
817
|
+
prompt: "Analyze this",
|
|
818
|
+
}),
|
|
819
|
+
120000,
|
|
820
|
+
);
|
|
821
|
+
|
|
822
|
+
// client.close destroys peer if present
|
|
823
|
+
client.peer = { destroy: jest.fn() } as any;
|
|
824
|
+
client.close();
|
|
825
|
+
expect(client.peer).toBeNull();
|
|
826
|
+
});
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
describe("CliWebRtcListener lifecycle and RPC handling", () => {
|
|
830
|
+
let tempDir: string;
|
|
831
|
+
|
|
832
|
+
beforeEach(() => {
|
|
833
|
+
tempDir = path.join(
|
|
834
|
+
os.tmpdir(),
|
|
835
|
+
"test-webrtc-listener-adv-" +
|
|
836
|
+
Date.now() +
|
|
837
|
+
"-" +
|
|
838
|
+
Math.random().toString(36).slice(2),
|
|
839
|
+
);
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
afterEach(() => {
|
|
843
|
+
try {
|
|
844
|
+
if (fs.existsSync(tempDir)) {
|
|
845
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
846
|
+
}
|
|
847
|
+
} catch (_) {}
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
it("_scheduleReconnect handles running and non-running states", () => {
|
|
851
|
+
const listener = new CliWebRtcListener({ cacheDir: tempDir });
|
|
852
|
+
(listener as any)._running = false;
|
|
853
|
+
(listener as any)._scheduleReconnect();
|
|
854
|
+
expect((listener as any)._reconnectTimer).toBeNull();
|
|
855
|
+
|
|
856
|
+
(listener as any)._running = true;
|
|
857
|
+
(listener as any)._scheduleReconnect();
|
|
858
|
+
expect((listener as any)._reconnectTimer).not.toBeNull();
|
|
859
|
+
expect((listener as any)._reconnectAttempts).toBe(1);
|
|
860
|
+
|
|
861
|
+
// Calling again while timer exists does not reschedule
|
|
862
|
+
(listener as any)._scheduleReconnect();
|
|
863
|
+
expect((listener as any)._reconnectAttempts).toBe(1);
|
|
864
|
+
|
|
865
|
+
// cleanup
|
|
866
|
+
listener.close();
|
|
867
|
+
expect((listener as any)._reconnectTimer).toBeNull();
|
|
868
|
+
expect((listener as any)._running).toBe(false);
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
it("_setupConnection handles SendMessage A2A RPC with send-message and prompt handlers", async () => {
|
|
872
|
+
const listener = new CliWebRtcListener({
|
|
873
|
+
cacheDir: tempDir,
|
|
874
|
+
handlers: {
|
|
875
|
+
"send-message": async (args: any) => {
|
|
876
|
+
return { reply: `Echo: ${args.text}` };
|
|
877
|
+
},
|
|
878
|
+
},
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
const handlers: Record<string, Function> = {};
|
|
882
|
+
const mockConn = {
|
|
883
|
+
on: jest.fn((evt: string, fn: Function) => {
|
|
884
|
+
handlers[evt] = fn;
|
|
885
|
+
}),
|
|
886
|
+
send: jest.fn(),
|
|
887
|
+
close: jest.fn(),
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
listener._setupConnection(mockConn, "remote-a2a-peer");
|
|
891
|
+
|
|
892
|
+
// SendMessage request
|
|
893
|
+
await handlers["data"]({
|
|
894
|
+
jsonrpc: "2.0",
|
|
895
|
+
id: "a2a-msg-1",
|
|
896
|
+
method: "SendMessage",
|
|
897
|
+
params: {
|
|
898
|
+
message: {
|
|
899
|
+
parts: [{ text: "Hello A2A" }],
|
|
900
|
+
},
|
|
901
|
+
contextId: "ctx-1",
|
|
902
|
+
},
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
906
|
+
expect.objectContaining({
|
|
907
|
+
id: "a2a-msg-1",
|
|
908
|
+
result: expect.objectContaining({
|
|
909
|
+
role: "ROLE_AGENT",
|
|
910
|
+
parts: [{ text: "Echo: Hello A2A" }],
|
|
911
|
+
}),
|
|
912
|
+
}),
|
|
913
|
+
);
|
|
914
|
+
|
|
915
|
+
// SendMessage failure handling
|
|
916
|
+
listener.handlers["send-message"] = async () => {
|
|
917
|
+
throw new Error("RPC handling crashed");
|
|
918
|
+
};
|
|
919
|
+
|
|
920
|
+
await handlers["data"]({
|
|
921
|
+
jsonrpc: "2.0",
|
|
922
|
+
id: "a2a-msg-2",
|
|
923
|
+
method: "SendMessage",
|
|
924
|
+
params: {
|
|
925
|
+
message: {
|
|
926
|
+
parts: [{ text: "Break it" }],
|
|
927
|
+
},
|
|
928
|
+
},
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
932
|
+
expect.objectContaining({
|
|
933
|
+
id: "a2a-msg-2",
|
|
934
|
+
error: expect.objectContaining({
|
|
935
|
+
code: -32603,
|
|
936
|
+
message: "RPC handling crashed",
|
|
937
|
+
}),
|
|
938
|
+
}),
|
|
939
|
+
);
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
it("_setupConnection handles command:execute messages", async () => {
|
|
943
|
+
const listener = new CliWebRtcListener({
|
|
944
|
+
cacheDir: tempDir,
|
|
945
|
+
handlers: {
|
|
946
|
+
hello: async () => ({ msg: "world" }),
|
|
947
|
+
},
|
|
948
|
+
});
|
|
949
|
+
const handlers: Record<string, Function> = {};
|
|
950
|
+
const mockConn = {
|
|
951
|
+
on: jest.fn((evt: string, fn: Function) => {
|
|
952
|
+
handlers[evt] = fn;
|
|
953
|
+
}),
|
|
954
|
+
send: jest.fn(),
|
|
955
|
+
close: jest.fn(),
|
|
956
|
+
};
|
|
957
|
+
listener._setupConnection(mockConn, "remote-cmd-peer");
|
|
958
|
+
await handlers["data"]({
|
|
959
|
+
type: "command:execute",
|
|
960
|
+
payload: { commandId: "cmd-1", action: "hello", args: {} },
|
|
961
|
+
});
|
|
962
|
+
expect(mockConn.send).toHaveBeenCalledWith(
|
|
963
|
+
expect.objectContaining({
|
|
964
|
+
type: "command:result",
|
|
965
|
+
payload: expect.objectContaining({
|
|
966
|
+
success: true,
|
|
967
|
+
data: { msg: "world" },
|
|
968
|
+
}),
|
|
969
|
+
}),
|
|
970
|
+
);
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
it("close() closes active connections, clears state and destroys peer", () => {
|
|
974
|
+
const listener = new CliWebRtcListener({ cacheDir: tempDir });
|
|
975
|
+
const mockConn1 = { close: jest.fn() };
|
|
976
|
+
const mockConn2 = { close: jest.fn() };
|
|
977
|
+
const mockPeer = { destroy: jest.fn() };
|
|
978
|
+
|
|
979
|
+
(listener as any)._connections.set("p1", mockConn1);
|
|
980
|
+
(listener as any)._connections.set("p2", mockConn2);
|
|
981
|
+
(listener as any)._peerCards.set("p1", { name: "Card 1" });
|
|
982
|
+
(listener as any)._peer = mockPeer;
|
|
983
|
+
(listener as any)._running = true;
|
|
984
|
+
|
|
985
|
+
listener.close();
|
|
986
|
+
|
|
987
|
+
expect(mockConn1.close).toHaveBeenCalled();
|
|
988
|
+
expect(mockConn2.close).toHaveBeenCalled();
|
|
989
|
+
expect(mockPeer.destroy).toHaveBeenCalled();
|
|
990
|
+
expect((listener as any)._connections.size).toBe(0);
|
|
991
|
+
expect((listener as any)._peerCards.size).toBe(0);
|
|
992
|
+
expect((listener as any)._peer).toBeNull();
|
|
993
|
+
expect((listener as any)._running).toBe(false);
|
|
994
|
+
});
|
|
426
995
|
});
|