shadow-claw 1.29.0 → 1.30.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.
Files changed (277) hide show
  1. package/.agents/skills/main/skill-creator/SKILL.md +3 -2
  2. package/.agents/skills/main/skill-creator/references/frontmatter-spec.md +5 -3
  3. package/.well-known/agent-skills/index.json +1 -1
  4. package/.well-known/mcp/server-card.json +1 -1
  5. package/.well-known/mcp.json +1 -1
  6. package/dist/lib/{app-routes-CqBOeA5q.js → app-routes-BAEMLu9g.js} +3 -2
  7. package/dist/lib/app-routes-BAEMLu9g.js.map +1 -0
  8. package/dist/lib/{bundler-8JNIKwOs.js → bundler-CsL7hHMq.js} +4 -9
  9. package/dist/lib/{bundler-8JNIKwOs.js.map → bundler-CsL7hHMq.js.map} +1 -1
  10. package/dist/lib/components/index.js +26 -26
  11. package/dist/lib/components/settings/shadow-claw-accounts.js +1 -1
  12. package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
  13. package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
  14. package/dist/lib/components/settings/shadow-claw-git.js +1 -1
  15. package/dist/lib/components/settings/shadow-claw-integrations.js +1 -1
  16. package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
  17. package/dist/lib/components/settings/shadow-claw-mcp-remote.js +1 -1
  18. package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
  19. package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
  20. package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
  21. package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
  22. package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
  23. package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
  24. package/dist/lib/components/shadow-claw-a2ui.js +1 -1
  25. package/dist/lib/components/shadow-claw-accounts.js +1 -1
  26. package/dist/lib/components/shadow-claw-channel-config.js +1 -1
  27. package/dist/lib/components/shadow-claw-channels.js +1 -1
  28. package/dist/lib/components/shadow-claw-chat.js +1 -1
  29. package/dist/lib/components/shadow-claw-control-plane.js +1 -1
  30. package/dist/lib/components/shadow-claw-conversations.js +1 -1
  31. package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
  32. package/dist/lib/components/shadow-claw-files.js +1 -1
  33. package/dist/lib/components/shadow-claw-git.js +1 -1
  34. package/dist/lib/components/shadow-claw-integrations.js +1 -1
  35. package/dist/lib/components/shadow-claw-llm.js +1 -1
  36. package/dist/lib/components/shadow-claw-mcp-remote.js +1 -1
  37. package/dist/lib/components/shadow-claw-networking.js +1 -1
  38. package/dist/lib/components/shadow-claw-notifications.js +1 -1
  39. package/dist/lib/components/shadow-claw-page-header.js +1 -1
  40. package/dist/lib/components/shadow-claw-pages.js +1 -1
  41. package/dist/lib/components/shadow-claw-peerjs.js +1 -1
  42. package/dist/lib/components/shadow-claw-settings.js +1 -1
  43. package/dist/lib/components/shadow-claw-storage.js +1 -1
  44. package/dist/lib/components/shadow-claw-task-server.js +1 -1
  45. package/dist/lib/components/shadow-claw-tasks.js +1 -1
  46. package/dist/lib/components/shadow-claw-terminal.js +1 -1
  47. package/dist/lib/components/shadow-claw-tools.js +1 -1
  48. package/dist/lib/components/shadow-claw-webvm.js +1 -1
  49. package/dist/lib/components/shadow-claw.js +1 -1
  50. package/dist/lib/{config--CFrw3J3.js → config-DjZ9QWc4.js} +2 -2
  51. package/dist/lib/{config--CFrw3J3.js.map → config-DjZ9QWc4.js.map} +1 -1
  52. package/dist/lib/{configurePeerJs-DG4hliKp.js → configurePeerJs-H0WaoT0w.js} +3 -3
  53. package/dist/lib/{configurePeerJs-DG4hliKp.js.map → configurePeerJs-H0WaoT0w.js.map} +1 -1
  54. package/dist/lib/{connections-DwjzwVz0.js → connections-BURqMIUv.js} +2 -2
  55. package/dist/lib/{connections-DwjzwVz0.js.map → connections-BURqMIUv.js.map} +1 -1
  56. package/dist/lib/content/markdown-links.d.ts +19 -0
  57. package/dist/lib/core/app-routes.d.ts +1 -0
  58. package/dist/lib/{downloadGroupFile-DmcBQU1n.js → downloadGroupFile-B8J4up2a.js} +2 -2
  59. package/dist/lib/{downloadGroupFile-DmcBQU1n.js.map → downloadGroupFile-B8J4up2a.js.map} +1 -1
  60. package/dist/lib/{file-viewer-C3YKnq_-.js → file-viewer-CwvhxAAG.js} +5 -5
  61. package/dist/lib/{file-viewer-C3YKnq_-.js.map → file-viewer-CwvhxAAG.js.map} +1 -1
  62. package/dist/lib/{getGroupDir-m0f-ekgX.js → getGroupDir-QrN2aTo8.js} +4 -4
  63. package/dist/lib/{getGroupDir-m0f-ekgX.js.map → getGroupDir-QrN2aTo8.js.map} +1 -1
  64. package/dist/lib/{git-C-Q6-IVe.js → git-DhZoe1SE.js} +3 -3
  65. package/dist/lib/{git-C-Q6-IVe.js.map → git-DhZoe1SE.js.map} +1 -1
  66. package/dist/lib/{iframe-sanitizer-CUqHuWQ-.js → iframe-sanitizer-Bujgq14T.js} +2 -2
  67. package/dist/lib/{iframe-sanitizer-CUqHuWQ-.js.map → iframe-sanitizer-Bujgq14T.js.map} +1 -1
  68. package/dist/lib/index.js +27 -27
  69. package/dist/lib/{initChatSplitResize-yyBTU6h9.js → initChatSplitResize-BjiWoqC_.js} +2 -2
  70. package/dist/lib/{initChatSplitResize-yyBTU6h9.js.map → initChatSplitResize-BjiWoqC_.js.map} +1 -1
  71. package/dist/lib/{initControlPlane-DnpAzphg.js → initControlPlane-C9JxQCDh.js} +16 -16
  72. package/dist/lib/{initControlPlane-DnpAzphg.js.map → initControlPlane-C9JxQCDh.js.map} +1 -1
  73. package/dist/lib/{markdown-DgdSt2GD.js → markdown-DYHmNjC4.js} +126 -5
  74. package/dist/lib/markdown-DYHmNjC4.js.map +1 -0
  75. package/dist/lib/{mcp-reconnect-C86MR3z8.js → mcp-reconnect-BxJ77WSb.js} +2 -2
  76. package/dist/lib/{mcp-reconnect-C86MR3z8.js.map → mcp-reconnect-BxJ77WSb.js.map} +1 -1
  77. package/dist/lib/{memoryStorage-UR8E8K-H.js → memoryStorage-D3FBwO9T.js} +2 -2
  78. package/dist/lib/{memoryStorage-UR8E8K-H.js.map → memoryStorage-D3FBwO9T.js.map} +1 -1
  79. package/dist/lib/{orchestrator-ClXbJ4Mb.js → orchestrator-C6dc-2OQ.js} +130 -27
  80. package/dist/lib/{orchestrator-ClXbJ4Mb.js.map → orchestrator-C6dc-2OQ.js.map} +1 -1
  81. package/dist/lib/{orchestrator-CjEau_RG.js → orchestrator-DVkyd8K9.js} +27 -17
  82. package/dist/lib/orchestrator-DVkyd8K9.js.map +1 -0
  83. package/dist/lib/{peerjs-BdfpltIe.js → peerjs-BUS9O04I.js} +274 -60
  84. package/dist/lib/peerjs-BUS9O04I.js.map +1 -0
  85. package/dist/lib/{push-client-DjwKknNg.js → push-client-4JsQGmQa.js} +3 -3
  86. package/dist/lib/{push-client-DjwKknNg.js.map → push-client-4JsQGmQa.js.map} +1 -1
  87. package/dist/lib/{readGroupFileBytes-C8oOe8Iu.js → readGroupFileBytes-CSA7u-nJ.js} +2 -2
  88. package/dist/lib/{readGroupFileBytes-C8oOe8Iu.js.map → readGroupFileBytes-CSA7u-nJ.js.map} +1 -1
  89. package/dist/lib/{shadow-claw-DcPGKenn.js → shadow-claw-BMoF8Auf.js} +11 -11
  90. package/dist/lib/{shadow-claw-DcPGKenn.js.map → shadow-claw-BMoF8Auf.js.map} +1 -1
  91. package/dist/lib/{shadow-claw-a2ui-CpZUTzlh.js → shadow-claw-a2ui-2I5nffIn.js} +2 -2
  92. package/dist/lib/{shadow-claw-a2ui-CpZUTzlh.js.map → shadow-claw-a2ui-2I5nffIn.js.map} +1 -1
  93. package/dist/lib/{shadow-claw-accounts-03oJ__XC.js → shadow-claw-accounts-BCjlgvzy.js} +3 -3
  94. package/dist/lib/{shadow-claw-accounts-03oJ__XC.js.map → shadow-claw-accounts-BCjlgvzy.js.map} +1 -1
  95. package/dist/lib/{shadow-claw-channel-config-DEL-aZ7N.js → shadow-claw-channel-config-CxQAmlDE.js} +3 -3
  96. package/dist/lib/{shadow-claw-channel-config-DEL-aZ7N.js.map → shadow-claw-channel-config-CxQAmlDE.js.map} +1 -1
  97. package/dist/lib/{shadow-claw-channels-BgaJiPdE.js → shadow-claw-channels-CuYMUVAG.js} +3 -3
  98. package/dist/lib/{shadow-claw-channels-BgaJiPdE.js.map → shadow-claw-channels-CuYMUVAG.js.map} +1 -1
  99. package/dist/lib/{shadow-claw-chat-mXPQZbwT.js → shadow-claw-chat-RFtPmmyl.js} +13 -12
  100. package/dist/lib/shadow-claw-chat-RFtPmmyl.js.map +1 -0
  101. package/dist/lib/{shadow-claw-control-plane-DO6foOLV.js → shadow-claw-control-plane-siqmRzR1.js} +7 -7
  102. package/dist/lib/{shadow-claw-control-plane-DO6foOLV.js.map → shadow-claw-control-plane-siqmRzR1.js.map} +1 -1
  103. package/dist/lib/{shadow-claw-conversations-BLwHTwdW.js → shadow-claw-conversations-DygK5y1e.js} +7 -7
  104. package/dist/lib/{shadow-claw-conversations-BLwHTwdW.js.map → shadow-claw-conversations-DygK5y1e.js.map} +1 -1
  105. package/dist/lib/{shadow-claw-file-viewer-BSbZvSl-.js → shadow-claw-file-viewer-DGMA7d7H.js} +11 -11
  106. package/dist/lib/shadow-claw-file-viewer-DGMA7d7H.js.map +1 -0
  107. package/dist/lib/{shadow-claw-files-BLVr9Pua.js → shadow-claw-files-CgD1B9J7.js} +8 -8
  108. package/dist/lib/{shadow-claw-files-BLVr9Pua.js.map → shadow-claw-files-CgD1B9J7.js.map} +1 -1
  109. package/dist/lib/{shadow-claw-git-CHC1H86J.js → shadow-claw-git-Bw1jGRrf.js} +6 -6
  110. package/dist/lib/{shadow-claw-git-CHC1H86J.js.map → shadow-claw-git-Bw1jGRrf.js.map} +1 -1
  111. package/dist/lib/{shadow-claw-integrations-Ds-CLPhj.js → shadow-claw-integrations-ChaXtvsg.js} +4 -4
  112. package/dist/lib/{shadow-claw-integrations-Ds-CLPhj.js.map → shadow-claw-integrations-ChaXtvsg.js.map} +1 -1
  113. package/dist/lib/{shadow-claw-llm-CKXfxd3D.js → shadow-claw-llm-CDM4Akjc.js} +6 -6
  114. package/dist/lib/{shadow-claw-llm-CKXfxd3D.js.map → shadow-claw-llm-CDM4Akjc.js.map} +1 -1
  115. package/dist/lib/{shadow-claw-mcp-remote-CT5Q-54E.js → shadow-claw-mcp-remote-BLxs_Z4I.js} +4 -4
  116. package/dist/lib/{shadow-claw-mcp-remote-CT5Q-54E.js.map → shadow-claw-mcp-remote-BLxs_Z4I.js.map} +1 -1
  117. package/dist/lib/{shadow-claw-networking-dpYvfchh.js → shadow-claw-networking-BYt-kMSI.js} +2 -2
  118. package/dist/lib/{shadow-claw-networking-dpYvfchh.js.map → shadow-claw-networking-BYt-kMSI.js.map} +1 -1
  119. package/dist/lib/{shadow-claw-notifications-_YeAVPga.js → shadow-claw-notifications-Dpe4EtZI.js} +3 -3
  120. package/dist/lib/{shadow-claw-notifications-_YeAVPga.js.map → shadow-claw-notifications-Dpe4EtZI.js.map} +1 -1
  121. package/dist/lib/{shadow-claw-page-header-Cti2fzf-.js → shadow-claw-page-header-P4EvWyUr.js} +2 -2
  122. package/dist/lib/{shadow-claw-page-header-Cti2fzf-.js.map → shadow-claw-page-header-P4EvWyUr.js.map} +1 -1
  123. package/dist/lib/{shadow-claw-pages-DVzZriZ7.js → shadow-claw-pages-DWd_c4d6.js} +10 -10
  124. package/dist/lib/{shadow-claw-pages-DVzZriZ7.js.map → shadow-claw-pages-DWd_c4d6.js.map} +1 -1
  125. package/dist/lib/{shadow-claw-peerjs-BvixjeBz.js → shadow-claw-peerjs-D928817m.js} +3 -3
  126. package/dist/lib/{shadow-claw-peerjs-BvixjeBz.js.map → shadow-claw-peerjs-D928817m.js.map} +1 -1
  127. package/dist/lib/{shadow-claw-settings-DV9-gD4Q.js → shadow-claw-settings-C8OPrSqs.js} +8 -8
  128. package/dist/lib/{shadow-claw-settings-DV9-gD4Q.js.map → shadow-claw-settings-C8OPrSqs.js.map} +1 -1
  129. package/dist/lib/{shadow-claw-storage-Bv__kXG6.js → shadow-claw-storage-CZ2uZJNw.js} +5 -5
  130. package/dist/lib/{shadow-claw-storage-Bv__kXG6.js.map → shadow-claw-storage-CZ2uZJNw.js.map} +1 -1
  131. package/dist/lib/{shadow-claw-task-server-DNOe8PWK.js → shadow-claw-task-server-CLT018BX.js} +2 -2
  132. package/dist/lib/{shadow-claw-task-server-DNOe8PWK.js.map → shadow-claw-task-server-CLT018BX.js.map} +1 -1
  133. package/dist/lib/{shadow-claw-tasks-qmcDT4PU.js → shadow-claw-tasks-D5h-lGmq.js} +9 -8
  134. package/dist/lib/shadow-claw-tasks-D5h-lGmq.js.map +1 -0
  135. package/dist/lib/{shadow-claw-terminal-0QUWP8of.js → shadow-claw-terminal-Cy1O6KVM.js} +2 -2
  136. package/dist/lib/{shadow-claw-terminal-0QUWP8of.js.map → shadow-claw-terminal-Cy1O6KVM.js.map} +1 -1
  137. package/dist/lib/{shadow-claw-tools-Bs_bmI6-.js → shadow-claw-tools-CVD06bCR.js} +9 -9
  138. package/dist/lib/{shadow-claw-tools-Bs_bmI6-.js.map → shadow-claw-tools-CVD06bCR.js.map} +1 -1
  139. package/dist/lib/{shadow-claw-webvm-DYaoL7QY.js → shadow-claw-webvm-DoGl5ZSJ.js} +3 -3
  140. package/dist/lib/{shadow-claw-webvm-DYaoL7QY.js.map → shadow-claw-webvm-DoGl5ZSJ.js.map} +1 -1
  141. package/dist/lib/subsystems/channels/peerjs.d.ts +37 -4
  142. package/dist/lib/subsystems/channels/room.d.ts +4 -0
  143. package/dist/lib/{syncWebMcpRegistration-BhbqI6R2.js → syncWebMcpRegistration-BeYkQEvj.js} +5 -5
  144. package/dist/lib/{syncWebMcpRegistration-BhbqI6R2.js.map → syncWebMcpRegistration-BeYkQEvj.js.map} +1 -1
  145. package/dist/lib/tools-C3Kft940.js +1 -0
  146. package/dist/lib/{tools-DBaMRiEu.js → tools-DKzPWc0q.js} +2 -2
  147. package/dist/lib/{tools-DBaMRiEu.js.map → tools-DKzPWc0q.js.map} +1 -1
  148. package/dist/lib/{tools-DwwB9RBa.js → tools-DqcJe8LS.js} +5 -5
  149. package/dist/lib/{tools-DwwB9RBa.js.map → tools-DqcJe8LS.js.map} +1 -1
  150. package/dist/lib/{trusted-types-Dx0RZlrd.js → trusted-types-Oz7xXJAY.js} +4 -4
  151. package/dist/lib/{trusted-types-Dx0RZlrd.js.map → trusted-types-Oz7xXJAY.js.map} +1 -1
  152. package/dist/lib/utils/index.js +1 -1
  153. package/dist/lib/utils/namespacedStorage.js +1 -1
  154. package/dist/lib/utils/utils.js +1 -1
  155. package/dist/lib/{webmcp-j_1_T3wf.js → webmcp-BC8_WafM.js} +4 -4
  156. package/dist/lib/{webmcp-j_1_T3wf.js.map → webmcp-BC8_WafM.js.map} +1 -1
  157. package/dist/lib/worker/utils/system-prompt.d.ts +4 -1
  158. package/dist/public/.agents/skills/main/skill-creator/SKILL.md +3 -2
  159. package/dist/public/.agents/skills/main/skill-creator/references/frontmatter-spec.md +5 -3
  160. package/dist/public/.well-known/agent-skills/index.json +1 -1
  161. package/dist/public/.well-known/mcp/server-card.json +1 -1
  162. package/dist/public/.well-known/mcp.json +1 -1
  163. package/dist/public/agent.worker.js +18 -17
  164. package/dist/public/app-routes-BMQ4HFaM.js +1 -0
  165. package/dist/public/{bundler-Ca-Xwln8.js → bundler-0if-QelV.js} +4 -4
  166. package/dist/public/{config-CrHchneq.js → config-Bnwx4EfS.js} +1 -1
  167. package/dist/public/{configurePeerJs-B470pdeU.js → configurePeerJs-DkyGvwk_.js} +1 -1
  168. package/dist/public/{connections-DvbgdkaB.js → connections-6575KDGE.js} +1 -1
  169. package/dist/public/{custom-element-security-FU04Cq05.js → custom-element-security-BQJQ_oKz.js} +1 -1
  170. package/dist/public/docs/example/article/index.html +2 -2
  171. package/dist/public/docs/publishing/index.html +2 -2
  172. package/dist/public/docs/skill-creator/index.html +2 -2
  173. package/dist/public/docs/subsystems/skills.md +3 -1
  174. package/dist/public/{downloadGroupFile-D8KRJGGL.js → downloadGroupFile-Wo1Sxdhr.js} +1 -1
  175. package/dist/public/{e2e-bridge-CSW0S5Yz.js → e2e-bridge-CvLCUU2O.js} +1 -1
  176. package/dist/public/{file-viewer-Cs-riNvy.js → file-viewer-CIjqAvNF.js} +1 -1
  177. package/dist/public/{getGroupDir-P1h9wl6S.js → getGroupDir-BwprrdrQ.js} +1 -1
  178. package/dist/public/{git-7Vq_SJSp.js → git-BSnY2D-A.js} +2 -2
  179. package/dist/public/{iframe-sanitizer-y2Z1pPwY.js → iframe-sanitizer-viROQkRn.js} +1 -1
  180. package/dist/public/index.html +2 -2
  181. package/dist/public/index.js +1 -1
  182. package/dist/public/{initChatSplitResize-CzV2E7Ul.js → initChatSplitResize-BA18wLQQ.js} +1 -1
  183. package/dist/public/{initControlPlane-BqCY0NQy.js → initControlPlane-L96uJkRA.js} +1 -1
  184. package/dist/public/main/index.html +2 -2
  185. package/dist/public/main/memory/index.html +2 -2
  186. package/dist/public/{markdown-Cw7vCtTg.js → markdown-DGjZAm_w.js} +17 -14
  187. package/dist/public/{mcp-reconnect-9emsqGRe.js → mcp-reconnect-CBHuaYdF.js} +1 -1
  188. package/dist/public/{memoryStorage-C0KvLNUp.js → memoryStorage-C1llaYus.js} +1 -1
  189. package/dist/public/orchestrator-C0VOoTiK.js +15 -0
  190. package/dist/public/{orchestrator-DpkkeD6T.js → orchestrator-DMWi--Dc.js} +20 -19
  191. package/dist/public/peerjs-Bf6ZxfbA.js +1 -0
  192. package/dist/public/{push-client-CHjSbrWs.js → push-client-BD4YalBa.js} +1 -1
  193. package/dist/public/service-worker.js +1 -1
  194. package/dist/public/{shadow-claw-BBPV_9X8.js → shadow-claw-DRy-D4Qi.js} +2 -2
  195. package/dist/public/{shadow-claw-accounts-xUOLBsQZ.js → shadow-claw-accounts-DnfmA8cb.js} +1 -1
  196. package/dist/public/{shadow-claw-channels-BJvrKQjg.js → shadow-claw-channels-8UkycZAa.js} +1 -1
  197. package/dist/public/{shadow-claw-chat-BG2EaRaw.js → shadow-claw-chat-Cf5LUiul.js} +9 -9
  198. package/dist/public/{shadow-claw-control-plane-BBa7WbTg.js → shadow-claw-control-plane-UsBF-Nvd.js} +2 -2
  199. package/dist/public/{shadow-claw-conversations-CFaWFmkm.js → shadow-claw-conversations-Aoe61Y21.js} +1 -1
  200. package/dist/public/{shadow-claw-file-viewer-Z-GIKaE9.js → shadow-claw-file-viewer-D28dSSEn.js} +6 -6
  201. package/dist/public/{shadow-claw-files-BBx4iMsk.js → shadow-claw-files-CaDUlPEU.js} +1 -1
  202. package/dist/public/{shadow-claw-git-vTOKatwd.js → shadow-claw-git-DYNcZMWA.js} +2 -2
  203. package/dist/public/{shadow-claw-integrations-BBVnO0Fc.js → shadow-claw-integrations-BJf_hQVv.js} +1 -1
  204. package/dist/public/{shadow-claw-llm-Ce1Ax6-x.js → shadow-claw-llm-BqK2SIRf.js} +2 -2
  205. package/dist/public/{shadow-claw-mcp-remote-Bkx0gsmF.js → shadow-claw-mcp-remote-B_dDG990.js} +1 -1
  206. package/dist/public/{shadow-claw-networking-q4XIzdB5.js → shadow-claw-networking-D8LxOofv.js} +1 -1
  207. package/dist/public/{shadow-claw-notifications-D2cz0gmm.js → shadow-claw-notifications-DpVyiNG_.js} +1 -1
  208. package/dist/public/{shadow-claw-page-header-BccSHItx.js → shadow-claw-page-header-DdC7bJuW.js} +1 -1
  209. package/dist/public/{shadow-claw-pages-3335lmSC.js → shadow-claw-pages-CYMl4J-6.js} +3 -3
  210. package/dist/public/{shadow-claw-settings-4ptYuJwO.js → shadow-claw-settings-Da_8Oy3O.js} +3 -3
  211. package/dist/public/{shadow-claw-storage-bIrPKFhF.js → shadow-claw-storage-DXIm86_-.js} +1 -1
  212. package/dist/public/{shadow-claw-task-server-5yqVBxy1.js → shadow-claw-task-server-BCceBD0G.js} +1 -1
  213. package/dist/public/{shadow-claw-tasks-DcqYHPLZ.js → shadow-claw-tasks-BW1QZ5L3.js} +19 -19
  214. package/dist/public/{shadow-claw-terminal-fARaDONr.js → shadow-claw-terminal-vqfsxhcK.js} +1 -1
  215. package/dist/public/{shadow-claw-tools-paEAhcJr.js → shadow-claw-tools-l0Jsa7UJ.js} +1 -1
  216. package/dist/public/{shadow-claw-webvm-CbzH_vyX.js → shadow-claw-webvm-CDPOWZm7.js} +1 -1
  217. package/dist/public/skills/main/skill-creator/SKILL.md +3 -2
  218. package/dist/public/skills/main/skill-creator/references/frontmatter-spec.md +5 -3
  219. package/dist/public/static-main-manifest.json +2 -2
  220. package/dist/public/{syncWebMcpRegistration-CWSYaHex.js → syncWebMcpRegistration-5b5FkP9_.js} +1 -1
  221. package/dist/public/tools-B-PzsLc2.js +1 -0
  222. package/dist/public/{tools-C8x3nmo4.js → tools-CcgG5XuA.js} +1 -1
  223. package/dist/public/{tools-DvckJZG2.js → tools-VSOY66vs.js} +1 -1
  224. package/dist/public/{webmcp-DAjmliCx.js → webmcp-DBONjQWd.js} +1 -1
  225. package/dist/server.js +2 -2
  226. package/package.json +2 -2
  227. package/src/__mocks__/marked.cjs +14 -0
  228. package/src/components/shadow-claw-chat/shadow-claw-chat.test.ts +17 -0
  229. package/src/components/shadow-claw-chat/shadow-claw-chat.ts +5 -1
  230. package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.test.ts +78 -0
  231. package/src/components/shadow-claw-file-viewer/shadow-claw-file-viewer.ts +6 -2
  232. package/src/components/shadow-claw-pages/utils/resolveWorkspaceLinkPath.test.ts +56 -0
  233. package/src/components/shadow-claw-tasks/shadow-claw-tasks.test.ts +22 -0
  234. package/src/components/shadow-claw-tasks/shadow-claw-tasks.ts +5 -1
  235. package/src/content/markdown-links.test.ts +109 -0
  236. package/src/content/markdown-links.ts +187 -0
  237. package/src/content/markdown.test.ts +33 -0
  238. package/src/content/markdown.ts +6 -1
  239. package/src/core/app-routes.test.ts +65 -0
  240. package/src/core/app-routes.ts +1 -1
  241. package/src/core/orchestrator/orchestrator.ts +3 -0
  242. package/src/core/orchestrator/utils/compactContext.ts +2 -0
  243. package/src/core/orchestrator/utils/invokeAgent.ts +1 -0
  244. package/src/subsystems/accounts/service-accounts.test.ts +0 -1
  245. package/src/subsystems/channels/peerjs.test.ts +479 -1
  246. package/src/subsystems/channels/peerjs.ts +420 -75
  247. package/src/subsystems/channels/room.test.ts +35 -0
  248. package/src/subsystems/channels/room.ts +15 -0
  249. package/src/subsystems/skills/activateSkill.test.ts +38 -5
  250. package/src/subsystems/skills/activateSkill.ts +25 -3
  251. package/src/subsystems/skills/parseSkill.test.ts +71 -0
  252. package/src/subsystems/skills/parseSkill.ts +185 -25
  253. package/src/subsystems/tools/files.ts +4 -4
  254. package/src/worker/tools/spawn-subagent/spawn-subagent.test.ts +22 -23
  255. package/src/worker/tools/workspace/send-file.test.ts +24 -1
  256. package/src/worker/tools/workspace/send-file.ts +6 -3
  257. package/src/worker/utils/handleCompact.test.ts +3 -4
  258. package/src/worker/utils/handleInvoke.test.ts +13 -11
  259. package/src/worker/utils/handleInvoke.ts +3 -0
  260. package/src/worker/utils/handleMessage.test.ts +0 -1
  261. package/src/worker/utils/post.test.ts +3 -4
  262. package/src/worker/utils/sandboxedEval.test.ts +1 -2
  263. package/src/worker/utils/system-prompt.test.ts +59 -0
  264. package/src/worker/utils/system-prompt.ts +21 -1
  265. package/src/worker/utils/withRetry.test.ts +3 -16
  266. package/dist/lib/app-routes-CqBOeA5q.js.map +0 -1
  267. package/dist/lib/markdown-DgdSt2GD.js.map +0 -1
  268. package/dist/lib/orchestrator-CjEau_RG.js.map +0 -1
  269. package/dist/lib/peerjs-BdfpltIe.js.map +0 -1
  270. package/dist/lib/shadow-claw-chat-mXPQZbwT.js.map +0 -1
  271. package/dist/lib/shadow-claw-file-viewer-BSbZvSl-.js.map +0 -1
  272. package/dist/lib/shadow-claw-tasks-qmcDT4PU.js.map +0 -1
  273. package/dist/lib/tools-D4Pp-nUw.js +0 -1
  274. package/dist/public/app-routes-Bs-riIvr.js +0 -1
  275. package/dist/public/orchestrator-BWkHHO9Y.js +0 -15
  276. package/dist/public/peerjs-tf2EmWjB.js +0 -1
  277. package/dist/public/tools-COduyYJ0.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as e}from"./config-CrHchneq.js";import{n as t}from"./txPromise-EBECky1b.js";import{t as n}from"./getConfig-D89uJgo5.js";import{m as r,u as i}from"./custom-element-security-FU04Cq05.js";import{t as a}from"./orchestrator-DpkkeD6T.js";import{a as o,i as s,r as c}from"./toast-BXgUfbyh.js";import{t as l}from"./shadow-claw-element-DIrv3P6A.js";import"./shadow-claw-empty-state-Bl52dGQ0.js";import{t as u}from"./effect-BJCrpFdp.js";import{t as d}from"./config-value-oBfKgLT4.js";import"./shadow-claw-page-header-action-button-Bmua3mAb.js";import"./shadow-claw-page-header-BccSHItx.js";import{t as f}from"./markdown-Cw7vCtTg.js";import{t as p}from"./file-viewer-Cs-riNvy.js";import"./shadow-claw-dialog-BrOwAOdk.js";const m=new CSSStyleSheet;m.replaceSync(`*,
1
+ import{r as e}from"./config-Bnwx4EfS.js";import{i as t}from"./app-routes-BMQ4HFaM.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./getConfig-D89uJgo5.js";import{m as i,u as a}from"./custom-element-security-BQJQ_oKz.js";import{t as o}from"./orchestrator-DMWi--Dc.js";import{a as s,i as c,r as l}from"./toast-BXgUfbyh.js";import{t as u}from"./shadow-claw-element-DIrv3P6A.js";import"./shadow-claw-empty-state-Bl52dGQ0.js";import{t as d}from"./effect-BJCrpFdp.js";import{t as f}from"./config-value-oBfKgLT4.js";import"./shadow-claw-page-header-action-button-Bmua3mAb.js";import"./shadow-claw-page-header-DdC7bJuW.js";import{t as p}from"./markdown-DGjZAm_w.js";import{t as m}from"./file-viewer-CIjqAvNF.js";import"./shadow-claw-dialog-BrOwAOdk.js";const h=new CSSStyleSheet;h.replaceSync(`*,
2
2
  *::before,
3
3
  *::after {
4
4
  font-family: var(--shadow-claw-font-sans);
@@ -756,7 +756,7 @@ dialog::backdrop {
756
756
  white-space: nowrap;
757
757
  width: 0.0625rem;
758
758
  }
759
- `);const h=new DOMParser().parseFromString(`<template>
759
+ `);const g=new DOMParser().parseFromString(`<template>
760
760
  <section aria-label="Tasks" class="tasks">
761
761
  <shadow-claw-page-header icon="✓" title="Tasks">
762
762
  <shadow-claw-page-header-action-button
@@ -929,9 +929,9 @@ dialog::backdrop {
929
929
  </div>
930
930
  </section>
931
931
  </template>
932
- `,`text/html`),g=h.querySelector(`template`);let _=[];_=g?Array.from(g.content.children):Array.from(h.head.children).concat(Array.from(h.body.children));var v=_;const y=`shadow-claw-tasks`;async function b(e,t){if(!e||typeof e.transaction!=`function`)return!0;try{return d(await n(e,t),!0)}catch{return!0}}var x=class extends l{static styles=m;static template=v;editingTask=null;editingTools=[];renderFrontmatter=!0;tasks=[];_autoScrollActive=!1;_autoScrollSpeed=0;_draggedTaskId=null;_keyboardGrabbedId=null;_touchDraggedTaskId=null;_touchId=null;constructor(){super()}async connectedCallback(){let n=this.shadowRoot;if(!n)throw Error(`shadowRoot not found`);n.addEventListener(`click`,e=>{e instanceof MouseEvent&&t().then(t=>this.handlePreviewLinkClick(e,t)).catch(console.error)}),n.querySelector(`.tasks__backup-btn`)?.addEventListener(`click`,()=>this.handleBackup());let r=n.querySelector(`.tasks__restore-btn`),o=n.querySelector(`.tasks__hidden-restore`);r?.addEventListener(`click`,()=>{o instanceof HTMLInputElement&&o.click()}),o?.addEventListener(`change`,e=>{if(e.target instanceof HTMLInputElement){let n=e.target;t().then(e=>this.handleRestore(e,n)).catch(console.error)}}),n.querySelector(`.tasks__clear-btn`)?.addEventListener(`click`,()=>{t().then(e=>this.handleClearAll(e)).catch(console.error)}),n.querySelector(`.tasks__add-btn`)?.addEventListener(`click`,()=>this.handleAdd());let s=n.querySelector(`dialog`),c=n.querySelector(`.tasks__dialog-close`),l=n.querySelector(`.tasks__btn-cancel`),d=n.querySelector(`.tasks__dialog-form`);c?.addEventListener(`click`,()=>{s?.close()}),l?.addEventListener(`click`,()=>{s?.close()}),d?.addEventListener(`submit`,e=>{e.preventDefault(),d&&t().then(e=>this.handleEditSubmit(e,d)).catch(console.error)}),s?.addEventListener(`click`,e=>{e.target===s&&s.close()});let f=n.querySelector(`textarea[name='prompt']`),p=n.querySelector(`.tasks__preview`),m=n.querySelectorAll(`input[name='taskType']`),h=n.querySelector(`.tasks__prompt-group`),g=n.querySelector(`.tasks__tools-group`),_=n.querySelector(`.tasks__add-tool-btn`),v=async()=>{p instanceof HTMLElement&&((Array.from(m).find(e=>e.checked)?.getAttribute(`value`)||`prompt`)===`tools`?i(p,this.renderToolsPreview(this.editingTools)):f instanceof HTMLTextAreaElement&&i(p,await this.renderPreview(f.value)))};f?.addEventListener(`input`,v),m.forEach(e=>{e.addEventListener(`change`,e=>{e.target.value===`tools`?(h?.setAttribute(`style`,`display: none;`),g?.removeAttribute(`style`),f?.removeAttribute(`required`)):(g?.setAttribute(`style`,`display: none;`),h?.removeAttribute(`style`)),v()})}),_?.addEventListener(`click`,()=>{this.editingTools.push({name:``,input:{}}),this.renderToolsEditor(),v()});let y=await t();this.renderFrontmatter=await b(y,e.MARKDOWN_FRONTMATTER_TASKS);try{let e=await(await fetch(`https://cdn.jsdelivr.net/npm/highlight.js@11.9.0/styles/atom-one-dark.min.css`)).text(),t=new CSSStyleSheet;t.replaceSync(e),this.shadowRoot?.adoptedStyleSheets&&this.shadowRoot.adoptedStyleSheets.push(t)}catch(e){console.warn(`Failed to load highlight.js styles:`,e)}n.addEventListener(`dragover`,e=>{this._draggedTaskId!==null&&this._updateAutoScrollSpeed(e.clientY)}),n.addEventListener(`dragend`,()=>{this._stopAutoScroll()}),n.addEventListener(`drop`,()=>{this._stopAutoScroll()}),this.render(),this.dispatchTerminalSlotReady(),this.cleanup=u(()=>{a.tasks,this.updateTaskList(y)})}disconnectedCallback(){this.cleanup()}cleanup=()=>{};dispatchTerminalSlotReady(){this.dispatchEvent(new CustomEvent(`shadow-claw-terminal-slot-ready`,{bubbles:!0,composed:!0}))}escapeHtml(e){let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}handleAdd(){this.editingTask=null,this.editingTools=[];let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`dialog`),n=e.querySelector(`.tasks__dialog-form`),r=e.querySelector(`.tasks__dialog-title`),a=e.querySelector(`.tasks__dialog-submit`);if(!n||!(n instanceof HTMLFormElement))return;r&&(r.textContent=`Add Task`),a&&(a.textContent=`Add Task`),n.reset();let o=n.querySelector(`input[name='name']`);o instanceof HTMLInputElement&&(o.value=``);let s=n.querySelector(`input[name='taskType'][value='prompt']`);s&&(s.checked=!0,s.dispatchEvent(new Event(`change`))),this.renderToolsEditor();let c=e.querySelector(`.tasks__preview`);c instanceof HTMLElement&&this.renderPreview(``,!1).then(e=>{i(c,e)}),t?.showModal()}handleEdit(e){this.editingTask=e,this.editingTools=JSON.parse(JSON.stringify(e.tools||[]));let t=this.shadowRoot;if(!t)return;let n=t.querySelector(`dialog`),r=t.querySelector(`.tasks__dialog-form`),a=t.querySelector(`.tasks__dialog-title`),o=t.querySelector(`.tasks__dialog-submit`);if(!r||!(r instanceof HTMLFormElement))return;a&&(a.textContent=`Edit Task`),o&&(o.textContent=`Save Changes`);let s=r.querySelector(`input[name='name']`);s instanceof HTMLInputElement&&(s.value=e.name||``);let c=r.querySelector(`input[name='schedule']`),l=r.querySelector(`textarea[name='prompt']`);c instanceof HTMLInputElement&&(c.value=e.schedule||``),l instanceof HTMLTextAreaElement&&(l.value=e.prompt||``);let u=r.querySelector(`input[name='freshContext']`);u instanceof HTMLInputElement&&(u.checked=!!e.freshContext);let d=r.querySelector(`input[name='subagent']`);d instanceof HTMLInputElement&&(d.checked=!!e.subagent);let f=r.querySelector(`input[name='taskType'][value='${e.type||`prompt`}']`);f&&(f.checked=!0,f.dispatchEvent(new Event(`change`))),this.renderToolsEditor();let p=t.querySelector(`.tasks__preview`);p instanceof HTMLElement&&(e.type===`tools`?i(p,this.renderToolsPreview(this.editingTools)):this.renderPreview(e.prompt).then(e=>{i(p,e)})),n?.showModal()}handleRun(e){a.runTask(e,!0)}renderToolsEditor(){let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`.tasks__tools-list`);t&&(t.innerHTML=``,this.editingTools.forEach((n,r)=>{let a=document.createElement(`div`);a.className=`tasks__tool-item`;let o=document.createElement(`div`);o.className=`tasks__tool-header`;let s=document.createElement(`div`);s.className=`tasks__tool-title`,s.textContent=`Tool ${r+1}`;let c=document.createElement(`button`);c.type=`button`,c.className=`tasks__tool-remove-btn`,c.textContent=`Remove`,c.addEventListener(`click`,()=>{this.editingTools.splice(r,1),this.renderToolsEditor();let t=e.querySelector(`.tasks__preview`);t&&i(t,this.renderToolsPreview(this.editingTools))}),o.appendChild(s),o.appendChild(c);let l=document.createElement(`input`);l.type=`text`,l.className=`tasks__form-input`,l.placeholder=`Tool Name (e.g. show_toast)`,l.value=n.name||``,l.addEventListener(`input`,t=>{n.name=t.target.value;let r=e.querySelector(`.tasks__preview`);r&&i(r,this.renderToolsPreview(this.editingTools))});let u=document.createElement(`textarea`);u.className=`tasks__form-textarea`,u.placeholder=`{
932
+ `,`text/html`),_=g.querySelector(`template`);let v=[];v=_?Array.from(_.content.children):Array.from(g.head.children).concat(Array.from(g.body.children));var y=v;const b=`shadow-claw-tasks`;async function x(e,t){if(!e||typeof e.transaction!=`function`)return!0;try{return f(await r(e,t),!0)}catch{return!0}}var S=class extends u{static styles=h;static template=y;editingTask=null;editingTools=[];renderFrontmatter=!0;tasks=[];_autoScrollActive=!1;_autoScrollSpeed=0;_draggedTaskId=null;_keyboardGrabbedId=null;_touchDraggedTaskId=null;_touchId=null;constructor(){super()}async connectedCallback(){let t=this.shadowRoot;if(!t)throw Error(`shadowRoot not found`);t.addEventListener(`click`,e=>{e instanceof MouseEvent&&n().then(t=>this.handlePreviewLinkClick(e,t)).catch(console.error)}),t.querySelector(`.tasks__backup-btn`)?.addEventListener(`click`,()=>this.handleBackup());let r=t.querySelector(`.tasks__restore-btn`),i=t.querySelector(`.tasks__hidden-restore`);r?.addEventListener(`click`,()=>{i instanceof HTMLInputElement&&i.click()}),i?.addEventListener(`change`,e=>{if(e.target instanceof HTMLInputElement){let t=e.target;n().then(e=>this.handleRestore(e,t)).catch(console.error)}}),t.querySelector(`.tasks__clear-btn`)?.addEventListener(`click`,()=>{n().then(e=>this.handleClearAll(e)).catch(console.error)}),t.querySelector(`.tasks__add-btn`)?.addEventListener(`click`,()=>this.handleAdd());let s=t.querySelector(`dialog`),c=t.querySelector(`.tasks__dialog-close`),l=t.querySelector(`.tasks__btn-cancel`),u=t.querySelector(`.tasks__dialog-form`);c?.addEventListener(`click`,()=>{s?.close()}),l?.addEventListener(`click`,()=>{s?.close()}),u?.addEventListener(`submit`,e=>{e.preventDefault(),u&&n().then(e=>this.handleEditSubmit(e,u)).catch(console.error)}),s?.addEventListener(`click`,e=>{e.target===s&&s.close()});let f=t.querySelector(`textarea[name='prompt']`),p=t.querySelector(`.tasks__preview`),m=t.querySelectorAll(`input[name='taskType']`),h=t.querySelector(`.tasks__prompt-group`),g=t.querySelector(`.tasks__tools-group`),_=t.querySelector(`.tasks__add-tool-btn`),v=async()=>{p instanceof HTMLElement&&((Array.from(m).find(e=>e.checked)?.getAttribute(`value`)||`prompt`)===`tools`?a(p,this.renderToolsPreview(this.editingTools)):f instanceof HTMLTextAreaElement&&a(p,await this.renderPreview(f.value)))};f?.addEventListener(`input`,v),m.forEach(e=>{e.addEventListener(`change`,e=>{e.target.value===`tools`?(h?.setAttribute(`style`,`display: none;`),g?.removeAttribute(`style`),f?.removeAttribute(`required`)):(g?.setAttribute(`style`,`display: none;`),h?.removeAttribute(`style`)),v()})}),_?.addEventListener(`click`,()=>{this.editingTools.push({name:``,input:{}}),this.renderToolsEditor(),v()});let y=await n();this.renderFrontmatter=await x(y,e.MARKDOWN_FRONTMATTER_TASKS);try{let e=await(await fetch(`https://cdn.jsdelivr.net/npm/highlight.js@11.9.0/styles/atom-one-dark.min.css`)).text(),t=new CSSStyleSheet;t.replaceSync(e),this.shadowRoot?.adoptedStyleSheets&&this.shadowRoot.adoptedStyleSheets.push(t)}catch(e){console.warn(`Failed to load highlight.js styles:`,e)}t.addEventListener(`dragover`,e=>{this._draggedTaskId!==null&&this._updateAutoScrollSpeed(e.clientY)}),t.addEventListener(`dragend`,()=>{this._stopAutoScroll()}),t.addEventListener(`drop`,()=>{this._stopAutoScroll()}),this.render(),this.dispatchTerminalSlotReady(),this.cleanup=d(()=>{o.tasks,this.updateTaskList(y)})}disconnectedCallback(){this.cleanup()}cleanup=()=>{};dispatchTerminalSlotReady(){this.dispatchEvent(new CustomEvent(`shadow-claw-terminal-slot-ready`,{bubbles:!0,composed:!0}))}escapeHtml(e){let t=document.createElement(`div`);return t.textContent=e,t.innerHTML}handleAdd(){this.editingTask=null,this.editingTools=[];let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`dialog`),n=e.querySelector(`.tasks__dialog-form`),r=e.querySelector(`.tasks__dialog-title`),i=e.querySelector(`.tasks__dialog-submit`);if(!n||!(n instanceof HTMLFormElement))return;r&&(r.textContent=`Add Task`),i&&(i.textContent=`Add Task`),n.reset();let o=n.querySelector(`input[name='name']`);o instanceof HTMLInputElement&&(o.value=``);let s=n.querySelector(`input[name='taskType'][value='prompt']`);s&&(s.checked=!0,s.dispatchEvent(new Event(`change`))),this.renderToolsEditor();let c=e.querySelector(`.tasks__preview`);c instanceof HTMLElement&&this.renderPreview(``,!1).then(e=>{a(c,e)}),t?.showModal()}handleEdit(e){this.editingTask=e,this.editingTools=JSON.parse(JSON.stringify(e.tools||[]));let t=this.shadowRoot;if(!t)return;let n=t.querySelector(`dialog`),r=t.querySelector(`.tasks__dialog-form`),i=t.querySelector(`.tasks__dialog-title`),o=t.querySelector(`.tasks__dialog-submit`);if(!r||!(r instanceof HTMLFormElement))return;i&&(i.textContent=`Edit Task`),o&&(o.textContent=`Save Changes`);let s=r.querySelector(`input[name='name']`);s instanceof HTMLInputElement&&(s.value=e.name||``);let c=r.querySelector(`input[name='schedule']`),l=r.querySelector(`textarea[name='prompt']`);c instanceof HTMLInputElement&&(c.value=e.schedule||``),l instanceof HTMLTextAreaElement&&(l.value=e.prompt||``);let u=r.querySelector(`input[name='freshContext']`);u instanceof HTMLInputElement&&(u.checked=!!e.freshContext);let d=r.querySelector(`input[name='subagent']`);d instanceof HTMLInputElement&&(d.checked=!!e.subagent);let f=r.querySelector(`input[name='taskType'][value='${e.type||`prompt`}']`);f&&(f.checked=!0,f.dispatchEvent(new Event(`change`))),this.renderToolsEditor();let p=t.querySelector(`.tasks__preview`);p instanceof HTMLElement&&(e.type===`tools`?a(p,this.renderToolsPreview(this.editingTools)):this.renderPreview(e.prompt).then(e=>{a(p,e)})),n?.showModal()}handleRun(e){o.runTask(e,!0)}renderToolsEditor(){let e=this.shadowRoot;if(!e)return;let t=e.querySelector(`.tasks__tools-list`);t&&(t.innerHTML=``,this.editingTools.forEach((n,r)=>{let i=document.createElement(`div`);i.className=`tasks__tool-item`;let o=document.createElement(`div`);o.className=`tasks__tool-header`;let s=document.createElement(`div`);s.className=`tasks__tool-title`,s.textContent=`Tool ${r+1}`;let c=document.createElement(`button`);c.type=`button`,c.className=`tasks__tool-remove-btn`,c.textContent=`Remove`,c.addEventListener(`click`,()=>{this.editingTools.splice(r,1),this.renderToolsEditor();let t=e.querySelector(`.tasks__preview`);t&&a(t,this.renderToolsPreview(this.editingTools))}),o.appendChild(s),o.appendChild(c);let l=document.createElement(`input`);l.type=`text`,l.className=`tasks__form-input`,l.placeholder=`Tool Name (e.g. show_toast)`,l.value=n.name||``,l.addEventListener(`input`,t=>{n.name=t.target.value;let r=e.querySelector(`.tasks__preview`);r&&a(r,this.renderToolsPreview(this.editingTools))});let u=document.createElement(`textarea`);u.className=`tasks__form-textarea`,u.placeholder=`{
933
933
  "key": "value"
934
- }`;try{u.value=n.input&&Object.keys(n.input).length?JSON.stringify(n.input,null,2):``}catch{u.value=``}u.addEventListener(`change`,t=>{let r=t.target.value;if(!r.trim())n.input={};else try{n.input=JSON.parse(r),t.target.style.borderColor=``}catch{t.target.style.borderColor=`var(--shadow-claw-error-color)`}let a=e.querySelector(`.tasks__preview`);a&&i(a,this.renderToolsPreview(this.editingTools))});let d=document.createElement(`label`);d.className=`tasks__tool-suppress`;let f=document.createElement(`input`);f.type=`checkbox`,f.checked=!!n.suppressOutput,f.addEventListener(`change`,t=>{n.suppressOutput=t.target.checked;let r=e.querySelector(`.tasks__preview`);r&&i(r,this.renderToolsPreview(this.editingTools))}),d.appendChild(f),d.appendChild(document.createTextNode(` Suppress Output`));let p=document.createElement(`label`);p.className=`tasks__tool-suppress`;let m=document.createElement(`input`);m.type=`checkbox`,m.checked=!!n.suppressToast,m.addEventListener(`change`,t=>{n.suppressToast=t.target.checked;let r=e.querySelector(`.tasks__preview`);r&&i(r,this.renderToolsPreview(this.editingTools))}),p.appendChild(m),p.appendChild(document.createTextNode(` Suppress Toast`)),a.appendChild(o),a.appendChild(l),a.appendChild(u),a.appendChild(d),a.appendChild(p),t.appendChild(a)}))}renderToolsPreview(e,t=!1){if(!e||e.length===0)return`<span class="tasks__preview-empty">No tools configured</span>`;let n=e.map((e,t)=>{let n=`{}`;try{n=JSON.stringify(e.input,null,2)}catch{n=`Invalid JSON`}return`<div><strong>${t+1}. ${r(e.name||`Unnamed Tool`)}</strong><pre><code>${r(n)}</code></pre></div>`}).join(``);return t&&e.length>2?`
934
+ }`;try{u.value=n.input&&Object.keys(n.input).length?JSON.stringify(n.input,null,2):``}catch{u.value=``}u.addEventListener(`change`,t=>{let r=t.target.value;if(!r.trim())n.input={};else try{n.input=JSON.parse(r),t.target.style.borderColor=``}catch{t.target.style.borderColor=`var(--shadow-claw-error-color)`}let i=e.querySelector(`.tasks__preview`);i&&a(i,this.renderToolsPreview(this.editingTools))});let d=document.createElement(`label`);d.className=`tasks__tool-suppress`;let f=document.createElement(`input`);f.type=`checkbox`,f.checked=!!n.suppressOutput,f.addEventListener(`change`,t=>{n.suppressOutput=t.target.checked;let r=e.querySelector(`.tasks__preview`);r&&a(r,this.renderToolsPreview(this.editingTools))}),d.appendChild(f),d.appendChild(document.createTextNode(` Suppress Output`));let p=document.createElement(`label`);p.className=`tasks__tool-suppress`;let m=document.createElement(`input`);m.type=`checkbox`,m.checked=!!n.suppressToast,m.addEventListener(`change`,t=>{n.suppressToast=t.target.checked;let r=e.querySelector(`.tasks__preview`);r&&a(r,this.renderToolsPreview(this.editingTools))}),p.appendChild(m),p.appendChild(document.createTextNode(` Suppress Toast`)),i.appendChild(o),i.appendChild(l),i.appendChild(u),i.appendChild(d),i.appendChild(p),t.appendChild(i)}))}renderToolsPreview(e,t=!1){if(!e||e.length===0)return`<span class="tasks__preview-empty">No tools configured</span>`;let n=e.map((e,t)=>{let n=`{}`;try{n=JSON.stringify(e.input,null,2)}catch{n=`Invalid JSON`}return`<div><strong>${t+1}. ${i(e.name||`Unnamed Tool`)}</strong><pre><code>${i(n)}</code></pre></div>`}).join(``);return t&&e.length>2?`
935
935
  <details class="tasks__content-details">
936
936
  <summary class="tasks__content-summary">
937
937
  <span class="tasks__summary-text">${e.length} Tools configured</span>
@@ -939,44 +939,44 @@ dialog::backdrop {
939
939
  </summary>
940
940
  <div class="tasks__prompt">${n}</div>
941
941
  </details>
942
- `:`<div class="tasks__prompt">${n}</div>`}resolveWorkspaceLinkPath(e){let t=e.trim();if(!t||t.startsWith(`#`))return null;let n=t;if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(t)||t.startsWith(`//`)){let e;try{e=new URL(t,window.location.href)}catch{return null}if(!(e.protocol===`http:`||e.protocol===`https:`)||e.host!==window.location.host)return null;n=`${e.pathname}${e.search}${e.hash}`}let r=n.split(/[?#]/,1)[0].replace(/\\/g,`/`);if(r=r.replace(/^\/+/,``),r=r.replace(/^\.\//,``),!r)return null;let i=r.split(`/`).filter(Boolean);return i.some(e=>e===`..`)?null:i.join(`/`)}async handleBackup(){try{let e=this.shadowRoot?.querySelector(`.tasks__backup-btn`);e?.toggleAttribute(`disabled`,!0),e&&(e.textContent=`⏳`);let t=a.getTasksForBackup(),n=JSON.stringify(t,null,2),r=new Blob([n],{type:`application/json`}),i=URL.createObjectURL(r),o=document.createElement(`a`);o.href=i,o.download=`shadowclaw-tasks-backup-${Date.now()}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i)}catch(e){c(`Failed to create backup: ${e instanceof Error?e.message:String(e)}`),console.error(`Backup error:`,e)}finally{let e=this.shadowRoot?.querySelector(`.tasks__backup-btn`);e?.toggleAttribute(`disabled`,!1),e&&(e.textContent=`💾 Backup`)}}async handleClearAll(e){if(await this.requestConfirmation({title:`Clear All Tasks`,message:`Delete ALL tasks? This cannot be undone!`,confirmLabel:`Delete All`,cancelLabel:`Cancel`}))try{let t=this.shadowRoot?.querySelector(`.tasks__clear-btn`);t?.toggleAttribute(`disabled`,!0),t&&(t.textContent=`⏳`),await a.clearAllTasks(e)}catch(e){c(`Failed to clear tasks: ${e instanceof Error?e.message:String(e)}`),console.error(`Clear error:`,e)}finally{let e=this.shadowRoot?.querySelector(`.tasks__clear-btn`);e?.toggleAttribute(`disabled`,!1),e&&(e.textContent=`🗑️ Clear All`)}}async handleCopyId(e){try{await navigator.clipboard.writeText(e),o(`Task ID copied to clipboard!`)}catch{c(`Failed to copy task ID.`)}}async handleDelete(e,t){if(await this.requestConfirmation({title:`Delete Scheduled Task`,message:`Are you sure you want to delete this scheduled task?`,confirmLabel:`Delete`,cancelLabel:`Cancel`}))try{await a.deleteTask(e,t)}catch(e){console.error(`Failed to delete task:`,e)}}async handleEditSubmit(e,t){let n=new FormData(t),r=n.get(`name`),i=n.get(`schedule`),o=n.get(`prompt`),l=n.get(`taskType`)||`prompt`,u=r?String(r).trim():``,d=i?String(i).trim():``;if(l===`prompt`&&!o){s(`Please provide a task prompt.`);return}let f=!!n.get(`freshContext`),p=!!n.get(`subagent`);try{let t;if(this.editingTask)t={...this.editingTask,name:u||void 0,schedule:d,type:l,prompt:String(o||``),tools:JSON.parse(JSON.stringify(this.editingTools)),freshContext:f,subagent:p};else{let e=a.activeGroupId;t={id:crypto.randomUUID?crypto.randomUUID():`task-${Date.now()}-${Math.random()}`,groupId:e,name:u||void 0,schedule:d,type:l,prompt:String(o||``),tools:JSON.parse(JSON.stringify(this.editingTools)),enabled:!0,lastRun:null,createdAt:Date.now(),freshContext:f,subagent:p}}await a.upsertTask(e,t),(this.shadowRoot?.querySelector(`dialog`))?.close(),this.editingTask=null}catch(e){c(`Failed to save task: ${e instanceof Error?e.message:String(e)}`),console.error(`Save error:`,e)}}async handlePreviewLinkClick(e,t){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(`a`);if(!(r instanceof HTMLAnchorElement))return;let i=r.getAttribute(`href`)||``,o=this.resolveWorkspaceLinkPath(i);if(!o)return;e.preventDefault();let s=[o],l=o.split(`/`).filter(Boolean).pop()||``;/\.[^./]+$/u.test(l)||s.push(`${o}.md`,`${o}/index.md`);for(let e of s)try{await p.openFile(t,e,a.activeGroupId);return}catch{}c(`Failed to open linked file: ${o}`,5e3)}async handleReorder(e,n,r){let i=await t();if(!i)return;if(r){await a.reorderTasks(i,a.activeGroupId,r);return}let o=(a.tasks||[]).map(e=>e.id),s=o.indexOf(e),c=o.indexOf(n);s<0||c<0||(o.splice(s,1),o.splice(c,0,e),await a.reorderTasks(i,a.activeGroupId,o))}async handleRestore(e,t){let n=t.files;if(!n||n.length===0)return;let r=n[0];if(!r.name.endsWith(`.json`)){s(`Please select a .json file`);return}if(!await this.requestConfirmation({title:`Restore Tasks`,message:`Restore from backup will replace all current tasks. Continue?`,confirmLabel:`Restore`,cancelLabel:`Cancel`})){t.value=``;return}try{let n=this.shadowRoot?.querySelector(`.tasks__restore-btn`);n?.toggleAttribute(`disabled`,!0),n&&(n.textContent=`⏳`);let i=await r.text(),s=JSON.parse(i);if(!Array.isArray(s))throw Error(`Invalid backup file format`);await a.restoreTasksFromBackup(e,s),t.value=``,o(`Tasks restored successfully!`)}catch(e){c(`Failed to restore from backup: ${e instanceof Error?e.message:String(e)}`),console.error(`Restore error:`,e)}finally{let e=this.shadowRoot?.querySelector(`.tasks__restore-btn`);e?.toggleAttribute(`disabled`,!1),e&&(e.textContent=`♻️ Restore`)}}async renderPreview(e,t=!1){if(!e.trim())return`<span class="tasks__preview-empty">No content</span>`;let n=e.split(`
943
- `),i=e.length>120||n.length>1,a=await f(e,{breaks:!0,renderFrontmatter:this.renderFrontmatter});return t&&i?`
942
+ `:`<div class="tasks__prompt">${n}</div>`}resolveWorkspaceLinkPath(e){let n=e.trim();if(!n||n.startsWith(`#`))return null;let r=n;if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(n)||n.startsWith(`//`)){let e;try{e=new URL(n,window.location.href)}catch{return null}if(!(e.protocol===`http:`||e.protocol===`https:`)||e.host!==window.location.host)return null;r=`${e.pathname}${e.search}${e.hash}`}let i=r.split(/[?#]/,1)[0].replace(/\\/g,`/`);if(i=i.replace(/^\/+/,``),i=i.replace(/^\.\//,``),!i)return null;let a=i.split(`/`).filter(Boolean).map(e=>t(e));return a.some(e=>e===`..`)?null:a.join(`/`)}async handleBackup(){try{let e=this.shadowRoot?.querySelector(`.tasks__backup-btn`);e?.toggleAttribute(`disabled`,!0),e&&(e.textContent=`⏳`);let t=o.getTasksForBackup(),n=JSON.stringify(t,null,2),r=new Blob([n],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`shadowclaw-tasks-backup-${Date.now()}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}catch(e){l(`Failed to create backup: ${e instanceof Error?e.message:String(e)}`),console.error(`Backup error:`,e)}finally{let e=this.shadowRoot?.querySelector(`.tasks__backup-btn`);e?.toggleAttribute(`disabled`,!1),e&&(e.textContent=`💾 Backup`)}}async handleClearAll(e){if(await this.requestConfirmation({title:`Clear All Tasks`,message:`Delete ALL tasks? This cannot be undone!`,confirmLabel:`Delete All`,cancelLabel:`Cancel`}))try{let t=this.shadowRoot?.querySelector(`.tasks__clear-btn`);t?.toggleAttribute(`disabled`,!0),t&&(t.textContent=`⏳`),await o.clearAllTasks(e)}catch(e){l(`Failed to clear tasks: ${e instanceof Error?e.message:String(e)}`),console.error(`Clear error:`,e)}finally{let e=this.shadowRoot?.querySelector(`.tasks__clear-btn`);e?.toggleAttribute(`disabled`,!1),e&&(e.textContent=`🗑️ Clear All`)}}async handleCopyId(e){try{await navigator.clipboard.writeText(e),s(`Task ID copied to clipboard!`)}catch{l(`Failed to copy task ID.`)}}async handleDelete(e,t){if(await this.requestConfirmation({title:`Delete Scheduled Task`,message:`Are you sure you want to delete this scheduled task?`,confirmLabel:`Delete`,cancelLabel:`Cancel`}))try{await o.deleteTask(e,t)}catch(e){console.error(`Failed to delete task:`,e)}}async handleEditSubmit(e,t){let n=new FormData(t),r=n.get(`name`),i=n.get(`schedule`),a=n.get(`prompt`),s=n.get(`taskType`)||`prompt`,u=r?String(r).trim():``,d=i?String(i).trim():``;if(s===`prompt`&&!a){c(`Please provide a task prompt.`);return}let f=!!n.get(`freshContext`),p=!!n.get(`subagent`);try{let t;if(this.editingTask)t={...this.editingTask,name:u||void 0,schedule:d,type:s,prompt:String(a||``),tools:JSON.parse(JSON.stringify(this.editingTools)),freshContext:f,subagent:p};else{let e=o.activeGroupId;t={id:crypto.randomUUID?crypto.randomUUID():`task-${Date.now()}-${Math.random()}`,groupId:e,name:u||void 0,schedule:d,type:s,prompt:String(a||``),tools:JSON.parse(JSON.stringify(this.editingTools)),enabled:!0,lastRun:null,createdAt:Date.now(),freshContext:f,subagent:p}}await o.upsertTask(e,t),(this.shadowRoot?.querySelector(`dialog`))?.close(),this.editingTask=null}catch(e){l(`Failed to save task: ${e instanceof Error?e.message:String(e)}`),console.error(`Save error:`,e)}}async handlePreviewLinkClick(e,t){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(`a`);if(!(r instanceof HTMLAnchorElement))return;let i=r.getAttribute(`href`)||``,a=this.resolveWorkspaceLinkPath(i);if(!a)return;e.preventDefault();let s=[a],c=a.split(`/`).filter(Boolean).pop()||``;/\.[^./]+$/u.test(c)||s.push(`${a}.md`,`${a}/index.md`);for(let e of s)try{await m.openFile(t,e,o.activeGroupId);return}catch{}l(`Failed to open linked file: ${a}`,5e3)}async handleReorder(e,t,r){let i=await n();if(!i)return;if(r){await o.reorderTasks(i,o.activeGroupId,r);return}let a=(o.tasks||[]).map(e=>e.id),s=a.indexOf(e),c=a.indexOf(t);s<0||c<0||(a.splice(s,1),a.splice(c,0,e),await o.reorderTasks(i,o.activeGroupId,a))}async handleRestore(e,t){let n=t.files;if(!n||n.length===0)return;let r=n[0];if(!r.name.endsWith(`.json`)){c(`Please select a .json file`);return}if(!await this.requestConfirmation({title:`Restore Tasks`,message:`Restore from backup will replace all current tasks. Continue?`,confirmLabel:`Restore`,cancelLabel:`Cancel`})){t.value=``;return}try{let n=this.shadowRoot?.querySelector(`.tasks__restore-btn`);n?.toggleAttribute(`disabled`,!0),n&&(n.textContent=`⏳`);let i=await r.text(),a=JSON.parse(i);if(!Array.isArray(a))throw Error(`Invalid backup file format`);await o.restoreTasksFromBackup(e,a),t.value=``,s(`Tasks restored successfully!`)}catch(e){l(`Failed to restore from backup: ${e instanceof Error?e.message:String(e)}`),console.error(`Restore error:`,e)}finally{let e=this.shadowRoot?.querySelector(`.tasks__restore-btn`);e?.toggleAttribute(`disabled`,!1),e&&(e.textContent=`♻️ Restore`)}}async renderPreview(e,t=!1){if(!e.trim())return`<span class="tasks__preview-empty">No content</span>`;let n=e.split(`
943
+ `),r=e.length>120||n.length>1,a=await p(e,{breaks:!0,renderFrontmatter:this.renderFrontmatter});return t&&r?`
944
944
  <details class="tasks__content-details">
945
945
  <summary class="tasks__content-summary">
946
- <span class="tasks__summary-text">${r(e.trim())}</span>
946
+ <span class="tasks__summary-text">${i(e.trim())}</span>
947
947
  <span class="tasks__summary-label">(View more)</span>
948
948
  </summary>
949
949
  <div class="tasks__prompt">${a}</div>
950
950
  </details>
951
- `:`<div class="tasks__prompt">${a}</div>`}async requestConfirmation(e){let t=document.querySelector(`shadow-claw`);return t&&typeof t.requestDialog==`function`?await t.requestDialog({mode:`confirm`,...e}):(s(e.message,4e3),!1)}async updateTaskList(e){let t=this.shadowRoot;if(!t)return;let n=t.querySelector(`.tasks__list`);if(!n)return;let o=a.tasks;if(o.length===0){i(n,`<shadow-claw-empty-state
951
+ `:`<div class="tasks__prompt">${a}</div>`}async requestConfirmation(e){let t=document.querySelector(`shadow-claw`);return t&&typeof t.requestDialog==`function`?await t.requestDialog({mode:`confirm`,...e}):(c(e.message,4e3),!1)}async updateTaskList(e){let t=this.shadowRoot;if(!t)return;let n=t.querySelector(`.tasks__list`);if(!n)return;let r=o.tasks;if(r.length===0){a(n,`<shadow-claw-empty-state
952
952
  class="tasks__empty"
953
953
  message="No scheduled tasks for this group."
954
954
  hint="Ask the agent to create one using 'create_task'."
955
- ></shadow-claw-empty-state>`);return}let s=document.createDocumentFragment();for(let t=0;t<o.length;t++){let c=o[t],l=document.createElement(`div`);l.className=`tasks__item`,l.setAttribute(`role`,`listitem`),l.setAttribute(`tabindex`,`0`),l.setAttribute(`aria-describedby`,`reorder-instructions`),l.setAttribute(`aria-label`,`${c.name||`Task`}, position ${t+1} of ${o.length}`),l.setAttribute(`data-task-id`,c.id),this._keyboardGrabbedId===c.id&&(l.classList.add(`keyboard-grabbed`),l.setAttribute(`aria-grabbed`,`true`));let u=c.lastRun?new Date(c.lastRun).toLocaleString():`Never`,d=c.type===`tools`,f=d?this.renderToolsPreview(c.tools||[],!0):await this.renderPreview(c.prompt,!0),p=c.schedule?`⏰ ${r(c.schedule)}`:`⏸ Unscheduled`,m=c.schedule?`
955
+ ></shadow-claw-empty-state>`);return}let s=document.createDocumentFragment();for(let t=0;t<r.length;t++){let c=r[t],l=document.createElement(`div`);l.className=`tasks__item`,l.setAttribute(`role`,`listitem`),l.setAttribute(`tabindex`,`0`),l.setAttribute(`aria-describedby`,`reorder-instructions`),l.setAttribute(`aria-label`,`${c.name||`Task`}, position ${t+1} of ${r.length}`),l.setAttribute(`data-task-id`,c.id),this._keyboardGrabbedId===c.id&&(l.classList.add(`keyboard-grabbed`),l.setAttribute(`aria-grabbed`,`true`));let u=c.lastRun?new Date(c.lastRun).toLocaleString():`Never`,d=c.type===`tools`,f=d?this.renderToolsPreview(c.tools||[],!0):await this.renderPreview(c.prompt,!0),p=c.schedule?`⏰ ${i(c.schedule)}`:`⏸ Unscheduled`,m=c.schedule?`
956
956
  <label class="tasks__toggle">
957
- <input type="checkbox" ${c.enabled?`checked`:``} data-id="${r(c.id)}" class="tasks__toggle-input" aria-label="${c.enabled?`Disable`:`Enable`} task scheduled ${r(c.schedule)}">
957
+ <input type="checkbox" ${c.enabled?`checked`:``} data-id="${i(c.id)}" class="tasks__toggle-input" aria-label="${c.enabled?`Disable`:`Enable`} task scheduled ${i(c.schedule)}">
958
958
  ${c.enabled?`Enabled`:`Disabled`}
959
- </label>`:``,h=[d?`Tools`:`Prompt`];c.freshContext&&h.push(`Fresh Context`),c.subagent&&h.push(`Subagent`);let g=h.join(` · `);i(l,`<div class="tasks__item-header">
959
+ </label>`:``,h=[d?`Tools`:`Prompt`];c.freshContext&&h.push(`Fresh Context`),c.subagent&&h.push(`Subagent`);let g=h.join(` · `);a(l,`<div class="tasks__item-header">
960
960
  <div style="display: flex; align-items: flex-start; flex: 1; min-width: 0;">
961
961
  <span class="tasks__drag-handle" draggable="true" aria-hidden="true" title="Drag to reorder">⠿</span>
962
962
  <div class="tasks__item-info">
963
- ${c.name?`<div class="tasks__name" style="font-weight: 600; font-size: var(--shadow-claw-font-size-md); margin-bottom: 0.25rem;">${r(c.name)}</div>`:``}
963
+ ${c.name?`<div class="tasks__name" style="font-weight: 600; font-size: var(--shadow-claw-font-size-md); margin-bottom: 0.25rem;">${i(c.name)}</div>`:``}
964
964
  <div class="tasks__schedule-row">
965
- <div class="tasks__schedule">${p} <span class="tasks__type-badge">(${r(g)})</span></div>
965
+ <div class="tasks__schedule">${p} <span class="tasks__type-badge">(${i(g)})</span></div>
966
966
  </div>
967
967
  <div class="tasks__prompt-container">
968
968
  ${f}
969
969
  </div>
970
- <div class="tasks__last-run">Last run: ${r(u)}</div>
970
+ <div class="tasks__last-run">Last run: ${i(u)}</div>
971
971
  </div>
972
972
  </div>
973
973
  <div class="tasks__actions">
974
974
  ${m}
975
- <button type="button" class="tasks__copy-id-btn" data-id="${r(c.id)}" aria-label="Copy task ID" title="Copy task ID">
975
+ <button type="button" class="tasks__copy-id-btn" data-id="${i(c.id)}" aria-label="Copy task ID" title="Copy task ID">
976
976
  <svg xmlns="http://www.w3.org/2000/svg" height="1em" width="1em" viewBox="0 -960 960 960" fill="currentColor" aria-hidden="true" style="vertical-align: middle; margin-right: 0.125rem; margin-top: -0.125rem;"><path d="M360-240q-33 0-56.5-23.5T280-320v-480q0-33 23.5-56.5T360-880h360q33 0 56.5 23.5T800-800v480q0 33-23.5 56.5T720-240H360Zm0-80h360v-480H360v480ZM200-80q-33 0-56.5-23.5T120-160v-560h80v560h440v80H200Zm160-240v-480 480Z"/></svg> Copy ID
977
977
  </button>
978
- <button type="button" class="tasks__run-btn" data-id="${r(c.id)}" aria-label="Run task">Run</button>
979
- <button type="button" class="tasks__edit-btn" data-id="${r(c.id)}" aria-label="Edit task">✎ Edit</button>
980
- <button type="button" class="tasks__delete-btn" data-id="${r(c.id)}" aria-label="Delete task">Delete</button>
978
+ <button type="button" class="tasks__run-btn" data-id="${i(c.id)}" aria-label="Run task">Run</button>
979
+ <button type="button" class="tasks__edit-btn" data-id="${i(c.id)}" aria-label="Edit task">✎ Edit</button>
980
+ <button type="button" class="tasks__delete-btn" data-id="${i(c.id)}" aria-label="Delete task">Delete</button>
981
981
  </div>
982
- </div>`),l.querySelector(`.tasks__toggle-input`)?.addEventListener(`change`,t=>{let n=t.target;a.toggleTask(e,c,n.checked)}),l.querySelector(`.tasks__copy-id-btn`)?.addEventListener(`click`,()=>this.handleCopyId(c.id)),l.querySelector(`.tasks__run-btn`)?.addEventListener(`click`,()=>this.handleRun(c)),l.querySelector(`.tasks__edit-btn`)?.addEventListener(`click`,()=>this.handleEdit(c)),l.querySelector(`.tasks__delete-btn`)?.addEventListener(`click`,()=>this.handleDelete(e,c.id));let _=l.querySelector(`.tasks__drag-handle`);_?.addEventListener(`dragstart`,e=>{this._draggedTaskId=c.id,l.classList.add(`dragging`),e.dataTransfer?.setData(`text/plain`,c.id)}),_?.addEventListener(`dragend`,()=>{l.classList.remove(`dragging`),this._draggedTaskId=null,n.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`))}),_?.addEventListener(`touchstart`,e=>{let t=e.touches[0];t&&(this._touchId=t.identifier,this._touchDraggedTaskId=c.id,l.classList.add(`dragging`),e.preventDefault())},{passive:!1}),l.addEventListener(`dragover`,e=>{e.preventDefault(),this._draggedTaskId&&this._draggedTaskId!==c.id&&l.classList.add(`drag-over`)}),l.addEventListener(`dragleave`,()=>{l.classList.remove(`drag-over`)}),l.addEventListener(`drop`,e=>{e.preventDefault(),l.classList.remove(`drag-over`),this._draggedTaskId&&this._draggedTaskId!==c.id&&this.handleReorder(this._draggedTaskId,c.id)}),l.addEventListener(`keydown`,e=>{this._handleKeyboard(e,c.id,c.name||`Task`)}),s.appendChild(l)}n.replaceChildren(),n.appendChild(s),this._bindTouchListEvents(n)}_announce(e){let t=this.shadowRoot?.querySelector(`#live-region`);t&&(t.textContent=``,requestAnimationFrame(()=>{t.textContent=e}))}_bindTouchListEvents(e){e._touchBound||(e._touchBound=!0,e.addEventListener(`touchmove`,t=>{if(this._touchDraggedTaskId===null)return;let n=this._findTouch(t);if(!n)return;t.preventDefault();let r=this._itemAtPoint(n.clientX,n.clientY);e.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`)),r&&r.getAttribute(`data-task-id`)!==this._touchDraggedTaskId&&r.classList.add(`drag-over`),this._updateAutoScrollSpeed(n.clientY)},{passive:!1}),e.addEventListener(`touchend`,t=>{if(this._touchDraggedTaskId===null)return;let n=this._findChangedTouch(t);if(!n)return;let r=this._itemAtPoint(n.clientX,n.clientY)?.getAttribute(`data-task-id`);e.querySelectorAll(`.dragging`).forEach(e=>e.classList.remove(`dragging`)),e.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`)),r&&r!==this._touchDraggedTaskId&&this.handleReorder(this._touchDraggedTaskId,r),this._stopAutoScroll(),this._touchDraggedTaskId=null,this._touchId=null}),e.addEventListener(`touchcancel`,()=>{e.querySelectorAll(`.dragging`).forEach(e=>e.classList.remove(`dragging`)),e.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`)),this._stopAutoScroll(),this._touchDraggedTaskId=null,this._touchId=null}))}_findChangedTouch(e){for(let t=0;t<e.changedTouches.length;t++){let n=e.changedTouches[t];if(n.identifier===this._touchId)return n}}_findTouch(e){for(let t=0;t<e.touches.length;t++){let n=e.touches[t];if(n.identifier===this._touchId)return n}}_focusNext(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item[tabindex="0"], button:not([disabled]), input:not([type="hidden"]):not([disabled])`)),r=n.indexOf(e);r!==-1&&r<n.length-1&&n[r+1].focus()}_focusNextItem(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item`)),r=e.closest(`.tasks__item`),i=n.indexOf(r);i!==-1&&i<n.length-1&&n[i+1].focus()}_focusPrev(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item[tabindex="0"], button:not([disabled]), input:not([type="hidden"]):not([disabled])`)),r=n.indexOf(e);r>0&&n[r-1].focus()}_focusPrevItem(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item`)),r=e.closest(`.tasks__item`),i=n.indexOf(r);i>0&&n[i-1].focus()}_handleKeyboard(e,n,r){let i=a.tasks||[],o=i.map(e=>e.id),s=o.length;if(this._keyboardGrabbedId===null){if(e.key===`ArrowDown`){e.preventDefault(),this._focusNextItem(e.target);return}if(e.key===`ArrowUp`){e.preventDefault(),this._focusPrevItem(e.target);return}if(e.key===`ArrowRight`){e.preventDefault(),this._focusNext(e.target);return}if(e.key===`ArrowLeft`){e.preventDefault(),this._focusPrev(e.target);return}if(e.key===`m`||e.key===`M`){e.preventDefault(),this._keyboardGrabbedId=n;let i=o.indexOf(n)+1;this._announce(`${r} grabbed. Current position ${i} of ${s}. Use Arrow Up and Down to move, Space or Enter to drop.`),t().then(e=>this.updateTaskList(e)).catch(console.error)}return}if(e.key===`Escape`){e.preventDefault(),this._announce(`Reorder cancelled. ${r} returned to original position.`),this._keyboardGrabbedId=null,t().then(e=>this.updateTaskList(e)).catch(console.error);return}if(e.key===` `||e.key===`Spacebar`||e.key===`Enter`){e.preventDefault();let n=o.indexOf(this._keyboardGrabbedId)+1,r=i.find(e=>e.id===this._keyboardGrabbedId)?.name||`Task`;this._announce(`${r} dropped at position ${n} of ${s}. Reordering complete.`),this._keyboardGrabbedId=null,t().then(e=>this.updateTaskList(e)).catch(console.error);return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=o.indexOf(this._keyboardGrabbedId),n=e.key===`ArrowUp`?t-1:t+1;if(n<0||n>=s)return;o.splice(t,1),o.splice(n,0,this._keyboardGrabbedId),this._announce(`Moved to position ${n+1} of ${s}.`),this.handleReorder(this._keyboardGrabbedId,o[t],o)}}_itemAtPoint(e,t){let n=this.shadowRoot;return n&&n.elementFromPoint(e,t)?.closest?.(`.tasks__item`)||null}_startAutoScroll(){if(this._autoScrollActive)return;this._autoScrollActive=!0;let e=()=>{if(!this._autoScrollActive)return;let t=this.shadowRoot?.querySelector(`.tasks__content`);t&&this._autoScrollSpeed!==0&&(t.scrollTop+=this._autoScrollSpeed),requestAnimationFrame(e)};requestAnimationFrame(e)}_stopAutoScroll(){this._autoScrollActive=!1,this._autoScrollSpeed=0}_updateAutoScrollSpeed(e){let t=this.shadowRoot?.querySelector(`.tasks__content`);if(!t){this._autoScrollSpeed=0;return}let n=t.getBoundingClientRect(),r=e-n.top,i=n.bottom-e;r>=0&&r<50?(this._autoScrollSpeed=-((50-r)/50)*8,this._startAutoScroll()):i>=0&&i<50?(this._autoScrollSpeed=(50-i)/50*8,this._startAutoScroll()):this._autoScrollSpeed=0}};customElements.get(y)||customElements.define(y,x);export{x as ShadowClawTasks};
982
+ </div>`),l.querySelector(`.tasks__toggle-input`)?.addEventListener(`change`,t=>{let n=t.target;o.toggleTask(e,c,n.checked)}),l.querySelector(`.tasks__copy-id-btn`)?.addEventListener(`click`,()=>this.handleCopyId(c.id)),l.querySelector(`.tasks__run-btn`)?.addEventListener(`click`,()=>this.handleRun(c)),l.querySelector(`.tasks__edit-btn`)?.addEventListener(`click`,()=>this.handleEdit(c)),l.querySelector(`.tasks__delete-btn`)?.addEventListener(`click`,()=>this.handleDelete(e,c.id));let _=l.querySelector(`.tasks__drag-handle`);_?.addEventListener(`dragstart`,e=>{this._draggedTaskId=c.id,l.classList.add(`dragging`),e.dataTransfer?.setData(`text/plain`,c.id)}),_?.addEventListener(`dragend`,()=>{l.classList.remove(`dragging`),this._draggedTaskId=null,n.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`))}),_?.addEventListener(`touchstart`,e=>{let t=e.touches[0];t&&(this._touchId=t.identifier,this._touchDraggedTaskId=c.id,l.classList.add(`dragging`),e.preventDefault())},{passive:!1}),l.addEventListener(`dragover`,e=>{e.preventDefault(),this._draggedTaskId&&this._draggedTaskId!==c.id&&l.classList.add(`drag-over`)}),l.addEventListener(`dragleave`,()=>{l.classList.remove(`drag-over`)}),l.addEventListener(`drop`,e=>{e.preventDefault(),l.classList.remove(`drag-over`),this._draggedTaskId&&this._draggedTaskId!==c.id&&this.handleReorder(this._draggedTaskId,c.id)}),l.addEventListener(`keydown`,e=>{this._handleKeyboard(e,c.id,c.name||`Task`)}),s.appendChild(l)}n.replaceChildren(),n.appendChild(s),this._bindTouchListEvents(n)}_announce(e){let t=this.shadowRoot?.querySelector(`#live-region`);t&&(t.textContent=``,requestAnimationFrame(()=>{t.textContent=e}))}_bindTouchListEvents(e){e._touchBound||(e._touchBound=!0,e.addEventListener(`touchmove`,t=>{if(this._touchDraggedTaskId===null)return;let n=this._findTouch(t);if(!n)return;t.preventDefault();let r=this._itemAtPoint(n.clientX,n.clientY);e.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`)),r&&r.getAttribute(`data-task-id`)!==this._touchDraggedTaskId&&r.classList.add(`drag-over`),this._updateAutoScrollSpeed(n.clientY)},{passive:!1}),e.addEventListener(`touchend`,t=>{if(this._touchDraggedTaskId===null)return;let n=this._findChangedTouch(t);if(!n)return;let r=this._itemAtPoint(n.clientX,n.clientY)?.getAttribute(`data-task-id`);e.querySelectorAll(`.dragging`).forEach(e=>e.classList.remove(`dragging`)),e.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`)),r&&r!==this._touchDraggedTaskId&&this.handleReorder(this._touchDraggedTaskId,r),this._stopAutoScroll(),this._touchDraggedTaskId=null,this._touchId=null}),e.addEventListener(`touchcancel`,()=>{e.querySelectorAll(`.dragging`).forEach(e=>e.classList.remove(`dragging`)),e.querySelectorAll(`.drag-over`).forEach(e=>e.classList.remove(`drag-over`)),this._stopAutoScroll(),this._touchDraggedTaskId=null,this._touchId=null}))}_findChangedTouch(e){for(let t=0;t<e.changedTouches.length;t++){let n=e.changedTouches[t];if(n.identifier===this._touchId)return n}}_findTouch(e){for(let t=0;t<e.touches.length;t++){let n=e.touches[t];if(n.identifier===this._touchId)return n}}_focusNext(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item[tabindex="0"], button:not([disabled]), input:not([type="hidden"]):not([disabled])`)),r=n.indexOf(e);r!==-1&&r<n.length-1&&n[r+1].focus()}_focusNextItem(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item`)),r=e.closest(`.tasks__item`),i=n.indexOf(r);i!==-1&&i<n.length-1&&n[i+1].focus()}_focusPrev(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item[tabindex="0"], button:not([disabled]), input:not([type="hidden"]):not([disabled])`)),r=n.indexOf(e);r>0&&n[r-1].focus()}_focusPrevItem(e){let t=this.shadowRoot;if(!t)return;let n=Array.from(t.querySelectorAll(`.tasks__item`)),r=e.closest(`.tasks__item`),i=n.indexOf(r);i>0&&n[i-1].focus()}_handleKeyboard(e,t,r){let i=o.tasks||[],a=i.map(e=>e.id),s=a.length;if(this._keyboardGrabbedId===null){if(e.key===`ArrowDown`){e.preventDefault(),this._focusNextItem(e.target);return}if(e.key===`ArrowUp`){e.preventDefault(),this._focusPrevItem(e.target);return}if(e.key===`ArrowRight`){e.preventDefault(),this._focusNext(e.target);return}if(e.key===`ArrowLeft`){e.preventDefault(),this._focusPrev(e.target);return}if(e.key===`m`||e.key===`M`){e.preventDefault(),this._keyboardGrabbedId=t;let i=a.indexOf(t)+1;this._announce(`${r} grabbed. Current position ${i} of ${s}. Use Arrow Up and Down to move, Space or Enter to drop.`),n().then(e=>this.updateTaskList(e)).catch(console.error)}return}if(e.key===`Escape`){e.preventDefault(),this._announce(`Reorder cancelled. ${r} returned to original position.`),this._keyboardGrabbedId=null,n().then(e=>this.updateTaskList(e)).catch(console.error);return}if(e.key===` `||e.key===`Spacebar`||e.key===`Enter`){e.preventDefault();let t=a.indexOf(this._keyboardGrabbedId)+1,r=i.find(e=>e.id===this._keyboardGrabbedId)?.name||`Task`;this._announce(`${r} dropped at position ${t} of ${s}. Reordering complete.`),this._keyboardGrabbedId=null,n().then(e=>this.updateTaskList(e)).catch(console.error);return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){e.preventDefault();let t=a.indexOf(this._keyboardGrabbedId),n=e.key===`ArrowUp`?t-1:t+1;if(n<0||n>=s)return;a.splice(t,1),a.splice(n,0,this._keyboardGrabbedId),this._announce(`Moved to position ${n+1} of ${s}.`),this.handleReorder(this._keyboardGrabbedId,a[t],a)}}_itemAtPoint(e,t){let n=this.shadowRoot;return n&&n.elementFromPoint(e,t)?.closest?.(`.tasks__item`)||null}_startAutoScroll(){if(this._autoScrollActive)return;this._autoScrollActive=!0;let e=()=>{if(!this._autoScrollActive)return;let t=this.shadowRoot?.querySelector(`.tasks__content`);t&&this._autoScrollSpeed!==0&&(t.scrollTop+=this._autoScrollSpeed),requestAnimationFrame(e)};requestAnimationFrame(e)}_stopAutoScroll(){this._autoScrollActive=!1,this._autoScrollSpeed=0}_updateAutoScrollSpeed(e){let t=this.shadowRoot?.querySelector(`.tasks__content`);if(!t){this._autoScrollSpeed=0;return}let n=t.getBoundingClientRect(),r=e-n.top,i=n.bottom-e;r>=0&&r<50?(this._autoScrollSpeed=-((50-r)/50)*8,this._startAutoScroll()):i>=0&&i<50?(this._autoScrollSpeed=(50-i)/50*8,this._startAutoScroll()):this._autoScrollSpeed=0}};customElements.get(b)||customElements.define(b,S);export{S as ShadowClawTasks};
@@ -1,4 +1,4 @@
1
- import{D as e,E as t,T as n,t as r}from"./orchestrator-DpkkeD6T.js";import{t as i}from"./shadow-claw-element-DIrv3P6A.js";function a(e){if(!e)return``;let t=e.split(`
1
+ import{D as e,E as t,T as n,t as r}from"./orchestrator-DMWi--Dc.js";import{t as i}from"./shadow-claw-element-DIrv3P6A.js";function a(e){if(!e)return``;let t=e.split(`
2
2
  `);for(let e=t.length-1;e>=0;--e){let n=t[e]||``;if(/[#$](?:\s|$)/.test(n))return n}return``}function o(e){return e.scrollHeight-(e.scrollTop+e.clientHeight)<=12}function s(e,t){let n=e[t+1];if(n===void 0)return{action:`ignore`,nextIndex:t+1,incomplete:!0};if(n===`[`){let n=t+2;for(;n<e.length;){let t=e.charCodeAt(n);if(t>=64&&t<=126){let t=e[n];return t===`J`?{action:`clear-screen`,nextIndex:n+1}:t===`K`?{action:`clear-line`,nextIndex:n+1}:{action:`ignore`,nextIndex:n+1}}n+=1}return{action:`ignore`,nextIndex:e.length,incomplete:!0}}if(n===`]`){let n=t+2;for(;n<e.length;){let t=e[n];if(t===`\x07`)return{action:`ignore`,nextIndex:n+1};if(t===`\x1B`&&e[n+1]===`\\`)return{action:`ignore`,nextIndex:n+2};n+=1}return{action:`ignore`,nextIndex:e.length,incomplete:!0}}return{action:`ignore`,nextIndex:Math.min(t+2,e.length)}}function c(e){return e.replace(/(?:^|\n)[^\n]*mkdir -p \/home\/user 2>&1; echo "?__BCDONE_\d+__\$\?"?[^\n]*(?:\n|$)/g,`
3
3
  `).replace(/(?:^|\n)\s*__BCDONE_\d+__(?:\d+|\$\?)?\s*(?:\n|$)/g,`
4
4
  `).replace(/^\n+(?=\S)/,``)}function l(e,t,n=``,r){let i=r?.respectEraseSequences??!0,a=n+t,o=e;for(let e=0;e<a.length;e++){let t=a[e];if(t===`\x1B`){let t=s(a,e);if(t.incomplete)return{text:o,pending:a.slice(e)};if(t.action===`clear-screen`&&i&&(o=``),t.action===`clear-line`&&i){let e=o.lastIndexOf(`
@@ -1,4 +1,4 @@
1
- import{A as e,F as t}from"./config-CrHchneq.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./orchestrator-DpkkeD6T.js";import{t as i}from"./tools-DvckJZG2.js";import{t as a}from"./ulid-BY7rQVLN.js";import{t as o}from"./tools-C8x3nmo4.js";import{n as s,t as c}from"./syncWebMcpRegistration-CWSYaHex.js";import"./tools-COduyYJ0.js";import{a as l,i as u,r as d}from"./toast-BXgUfbyh.js";import{t as f}from"./shadow-claw-element-DIrv3P6A.js";import{t as p}from"./effect-BJCrpFdp.js";import"./shadow-claw-page-header-action-button-Bmua3mAb.js";import"./shadow-claw-page-header-BccSHItx.js";import"./shadow-claw-dialog-BrOwAOdk.js";import{t as m}from"./webmcp-DAjmliCx.js";const h=new CSSStyleSheet;h.replaceSync(`*,
1
+ import{A as e,F as t}from"./config-Bnwx4EfS.js";import{n}from"./txPromise-EBECky1b.js";import{t as r}from"./orchestrator-DMWi--Dc.js";import{t as i}from"./tools-VSOY66vs.js";import{t as a}from"./ulid-BY7rQVLN.js";import{t as o}from"./tools-CcgG5XuA.js";import{n as s,t as c}from"./syncWebMcpRegistration-5b5FkP9_.js";import"./tools-B-PzsLc2.js";import{a as l,i as u,r as d}from"./toast-BXgUfbyh.js";import{t as f}from"./shadow-claw-element-DIrv3P6A.js";import{t as p}from"./effect-BJCrpFdp.js";import"./shadow-claw-page-header-action-button-Bmua3mAb.js";import"./shadow-claw-page-header-DdC7bJuW.js";import"./shadow-claw-dialog-BrOwAOdk.js";import{t as m}from"./webmcp-DBONjQWd.js";const h=new CSSStyleSheet;h.replaceSync(`*,
2
2
  *::before,
3
3
  *::after {
4
4
  font-family: var(--shadow-claw-font-sans);
@@ -1,4 +1,4 @@
1
- import{f as e,n as t,r as n}from"./config-CrHchneq.js";import{n as r}from"./txPromise-EBECky1b.js";import{t as i}from"./getConfig-D89uJgo5.js";import{A as a,O as o,S as s,k as c,t as l}from"./orchestrator-DpkkeD6T.js";import{a as u,r as d,s as f}from"./toast-BXgUfbyh.js";import{t as p}from"./shadow-claw-element-DIrv3P6A.js";import{t as m}from"./effect-BJCrpFdp.js";const h=new CSSStyleSheet;h.replaceSync(`*,
1
+ import{f as e,n as t,r as n}from"./config-Bnwx4EfS.js";import{n as r}from"./txPromise-EBECky1b.js";import{t as i}from"./getConfig-D89uJgo5.js";import{A as a,O as o,S as s,k as c,t as l}from"./orchestrator-DMWi--Dc.js";import{a as u,r as d,s as f}from"./toast-BXgUfbyh.js";import{t as p}from"./shadow-claw-element-DIrv3P6A.js";import{t as m}from"./effect-BJCrpFdp.js";const h=new CSSStyleSheet;h.replaceSync(`*,
2
2
  *::before,
3
3
  *::after {
4
4
  font-family: var(--shadow-claw-font-sans);
@@ -23,9 +23,10 @@ Use this skill when creating, modifying, reviewing, or validating a ShadowClaw a
23
23
  - For new skills, define the trigger prompt, intended execution outcome, required tools, and output artifacts.
24
24
  2. **Configure Frontmatter**
25
25
  - Provide a clear, concise trigger description in `description` (1024 characters max).
26
+ - **Always enclose `description` in double quotes** (`description: "..."`) or use a YAML block scalar (`>`). Colons (`:`), URLs, and trigger phrases inside unquoted YAML break parsing.
26
27
  - Set `user-invocable: true` if the skill should be triggerable via slash command (e.g. `/skill-name`).
27
28
  - Use `disable-model-invocation: true` for skills intended strictly for slash-command execution.
28
- - Place non-standard configuration (such as `allowed-tools`) within the standard `metadata` block to maintain Agent Skills specification compliance.
29
+ - Place non-standard configuration (such as `allowed-tools`) within the standard `metadata` block to maintain Agent Skills specification compliance. Specify tools as a space-separated string or a list.
29
30
  3. **Structure & Draft Content**
30
31
  - Write instructions in `SKILL.md` using clear, modular procedures.
31
32
  - Place deterministic operations in `javascript` tool calls; use `read_file` and `write_file` for workspace persistence.
@@ -35,5 +36,5 @@ Use this skill when creating, modifying, reviewing, or validating a ShadowClaw a
35
36
  - Pass outputs between steps using `{ "$pipe": "prev" }` or step/tool identifiers.
36
37
  - Optionally apply `suppressToast: true` or `suppressOutput: true` at the execution root or per step to suppress notifications and output blocks.
37
38
  5. **Verify & Validate**
38
- - Re-read the saved `SKILL.md` and verify valid YAML frontmatter syntax.
39
+ - Re-read the saved `SKILL.md` and verify valid YAML frontmatter syntax (ensure `description` is enclosed in double quotes).
39
40
  - Ensure the skill name uses 1–64 lowercase alphanumeric characters or hyphens and all referenced resource paths exist.
@@ -7,7 +7,7 @@ Agent skills in ShadowClaw are configured via YAML frontmatter at the top of `SK
7
7
  ```yaml
8
8
  ---
9
9
  name: skill-name
10
- description: Clear, concise model-facing trigger description.
10
+ description: "Clear, concise model-facing trigger description."
11
11
  user-invocable: true
12
12
  disable-model-invocation: false
13
13
  argument-hint: "[arguments]"
@@ -18,16 +18,18 @@ license: MIT
18
18
  ---
19
19
  ```
20
20
 
21
+ > **Quoting Rule**: Always enclose `description` in double quotes (`"..."`) or use a YAML folded block scalar (`>`). Descriptions often contain URLs (`https://`), colons (`trigger:` or `en:`), quotes, or parentheses that break unquoted YAML frontmatter.
22
+
21
23
  ## Attribute Reference
22
24
 
23
25
  | Attribute | Type | Required | Description |
24
26
  | :------------------------- | :-------- | :------- | :-------------------------------------------------------------------------------------------------------- |
25
27
  | `name` | `string` | **Yes** | Skill identifier (1–64 lowercase alphanumeric characters and single hyphens). |
26
- | `description` | `string` | **Yes** | Model-facing description used for skill discovery and activation (max 1024 characters). |
28
+ | `description` | `string` | **Yes** | Model-facing description used for skill discovery and activation (max 1024 characters). **Always wrap in double quotes.** |
27
29
  | `user-invocable` | `boolean` | No | When `true` (default), allows users to invoke the skill directly via slash commands (e.g. `/skill-name`). |
28
30
  | `disable-model-invocation` | `boolean` | No | When `true`, hides the skill from model discovery so it is only triggered via slash command. |
29
31
  | `argument-hint` | `string` | No | Display placeholder in the UI search/autocomplete menu when typing slash commands. |
30
- | `metadata` | `object` | No | Key-value dictionary for custom metadata, tool permissions (`allowed-tools`), and `execution` pipelines. |
32
+ | `metadata` | `object` | No | Key-value dictionary for custom metadata, tool permissions (`allowed-tools` string or list), and `execution` pipelines. |
31
33
  | `compatibility` | `string` | No | Platform compatibility requirements or version strings. |
32
34
  | `license` | `string` | No | Open-source software license string (e.g. `MIT`, `AGPL-3.0`). |
33
35
 
@@ -32,11 +32,11 @@
32
32
  },
33
33
  {
34
34
  "displayPath": "skill-creator/references/frontmatter-spec.md",
35
- "content": "# Frontmatter Specification\n\nAgent skills in ShadowClaw are configured via YAML frontmatter at the top of `SKILL.md`. Frontmatter attributes adhere strictly to the standard Agent Skills specification.\n\n## Specification Schema\n\n```yaml\n---\nname: skill-name\ndescription: Clear, concise model-facing trigger description.\nuser-invocable: true\ndisable-model-invocation: false\nargument-hint: \"[arguments]\"\nmetadata:\n allowed-tools: read_file write_file javascript\ncompatibility: ShadowClaw\nlicense: MIT\n---\n```\n\n## Attribute Reference\n\n| Attribute | Type | Required | Description |\n| :------------------------- | :-------- | :------- | :-------------------------------------------------------------------------------------------------------- |\n| `name` | `string` | **Yes** | Skill identifier (1–64 lowercase alphanumeric characters and single hyphens). |\n| `description` | `string` | **Yes** | Model-facing description used for skill discovery and activation (max 1024 characters). |\n| `user-invocable` | `boolean` | No | When `true` (default), allows users to invoke the skill directly via slash commands (e.g. `/skill-name`). |\n| `disable-model-invocation` | `boolean` | No | When `true`, hides the skill from model discovery so it is only triggered via slash command. |\n| `argument-hint` | `string` | No | Display placeholder in the UI search/autocomplete menu when typing slash commands. |\n| `metadata` | `object` | No | Key-value dictionary for custom metadata, tool permissions (`allowed-tools`), and `execution` pipelines. |\n| `compatibility` | `string` | No | Platform compatibility requirements or version strings. |\n| `license` | `string` | No | Open-source software license string (e.g. `MIT`, `AGPL-3.0`). |\n\n## Metadata Attributes (`metadata`)\n\nCustom configuration properties and extension specifications (like declarative execution pipelines) that fall outside the standard Agent Skills frontmatter attributes should be placed inside `metadata`:\n\n```yaml\nmetadata:\n allowed-tools: javascript show_toast generate_random_number\n author: ShadowClaw Team\n version: 1.0.0\n execution:\n type: tools\n suppressToast: true\n tools:\n - name: javascript\n input:\n code: Math.floor(Math.random() * 100) + 1\n```\n"
35
+ "content": "# Frontmatter Specification\n\nAgent skills in ShadowClaw are configured via YAML frontmatter at the top of `SKILL.md`. Frontmatter attributes adhere strictly to the standard Agent Skills specification.\n\n## Specification Schema\n\n```yaml\n---\nname: skill-name\ndescription: \"Clear, concise model-facing trigger description.\"\nuser-invocable: true\ndisable-model-invocation: false\nargument-hint: \"[arguments]\"\nmetadata:\n allowed-tools: read_file write_file javascript\ncompatibility: ShadowClaw\nlicense: MIT\n---\n```\n\n> **Quoting Rule**: Always enclose `description` in double quotes (`\"...\"`) or use a YAML folded block scalar (`>`). Descriptions often contain URLs (`https://`), colons (`trigger:` or `en:`), quotes, or parentheses that break unquoted YAML frontmatter.\n\n## Attribute Reference\n\n| Attribute | Type | Required | Description |\n| :------------------------- | :-------- | :------- | :-------------------------------------------------------------------------------------------------------- |\n| `name` | `string` | **Yes** | Skill identifier (1–64 lowercase alphanumeric characters and single hyphens). |\n| `description` | `string` | **Yes** | Model-facing description used for skill discovery and activation (max 1024 characters). **Always wrap in double quotes.** |\n| `user-invocable` | `boolean` | No | When `true` (default), allows users to invoke the skill directly via slash commands (e.g. `/skill-name`). |\n| `disable-model-invocation` | `boolean` | No | When `true`, hides the skill from model discovery so it is only triggered via slash command. |\n| `argument-hint` | `string` | No | Display placeholder in the UI search/autocomplete menu when typing slash commands. |\n| `metadata` | `object` | No | Key-value dictionary for custom metadata, tool permissions (`allowed-tools` string or list), and `execution` pipelines. |\n| `compatibility` | `string` | No | Platform compatibility requirements or version strings. |\n| `license` | `string` | No | Open-source software license string (e.g. `MIT`, `AGPL-3.0`). |\n\n## Metadata Attributes (`metadata`)\n\nCustom configuration properties and extension specifications (like declarative execution pipelines) that fall outside the standard Agent Skills frontmatter attributes should be placed inside `metadata`:\n\n```yaml\nmetadata:\n allowed-tools: javascript show_toast generate_random_number\n author: ShadowClaw Team\n version: 1.0.0\n execution:\n type: tools\n suppressToast: true\n tools:\n - name: javascript\n input:\n code: Math.floor(Math.random() * 100) + 1\n```\n"
36
36
  },
37
37
  {
38
38
  "displayPath": "skill-creator/SKILL.md",
39
- "content": "---\nname: skill-creator\ndescription: Create, edit, review, and validate ShadowClaw declarative skills and their supporting resources.\nuser-invocable: true\nmetadata:\n allowed-tools: read_file write_file javascript create_directory\n---\n\n# ShadowClaw Skill Creator\n\nUse this skill when creating, modifying, reviewing, or validating a ShadowClaw agent skill or declarative tool pipeline.\n\n## Workspace Layout Standards\n\n- **Skills**: Create each skill in its dedicated directory under `.agents/skills/<group>/<skill-name>/SKILL.md` (default group: `main`).\n- **Declarative Tools**: Define supporting declarative tools under `.agents/tools/<group>/<tool-name>.json` (default group: `main`).\n- **Supporting Resources**: Co-locate skill-specific assets (reference documents, templates, helper scripts) inside the skill directory alongside `SKILL.md`.\n\n## Workflow\n\n1. **Establish Contract & Scope**\n - For existing skills, read `SKILL.md` and related resources before editing.\n - For new skills, define the trigger prompt, intended execution outcome, required tools, and output artifacts.\n2. **Configure Frontmatter**\n - Provide a clear, concise trigger description in `description` (1024 characters max).\n - Set `user-invocable: true` if the skill should be triggerable via slash command (e.g. `/skill-name`).\n - Use `disable-model-invocation: true` for skills intended strictly for slash-command execution.\n - Place non-standard configuration (such as `allowed-tools`) within the standard `metadata` block to maintain Agent Skills specification compliance.\n3. **Structure & Draft Content**\n - Write instructions in `SKILL.md` using clear, modular procedures.\n - Place deterministic operations in `javascript` tool calls; use `read_file` and `write_file` for workspace persistence.\n - Create required target directories via `create_directory` prior to writing files.\n4. **Declarative Pipelines (`execution.type: tools`)**\n - Define sequential tool pipelines in frontmatter via `execution: { type: \"tools\", tools: [...] }`.\n - Pass outputs between steps using `{ \"$pipe\": \"prev\" }` or step/tool identifiers.\n - Optionally apply `suppressToast: true` or `suppressOutput: true` at the execution root or per step to suppress notifications and output blocks.\n5. **Verify & Validate**\n - Re-read the saved `SKILL.md` and verify valid YAML frontmatter syntax.\n - Ensure the skill name uses 1–64 lowercase alphanumeric characters or hyphens and all referenced resource paths exist.\n"
39
+ "content": "---\nname: skill-creator\ndescription: Create, edit, review, and validate ShadowClaw declarative skills and their supporting resources.\nuser-invocable: true\nmetadata:\n allowed-tools: read_file write_file javascript create_directory\n---\n\n# ShadowClaw Skill Creator\n\nUse this skill when creating, modifying, reviewing, or validating a ShadowClaw agent skill or declarative tool pipeline.\n\n## Workspace Layout Standards\n\n- **Skills**: Create each skill in its dedicated directory under `.agents/skills/<group>/<skill-name>/SKILL.md` (default group: `main`).\n- **Declarative Tools**: Define supporting declarative tools under `.agents/tools/<group>/<tool-name>.json` (default group: `main`).\n- **Supporting Resources**: Co-locate skill-specific assets (reference documents, templates, helper scripts) inside the skill directory alongside `SKILL.md`.\n\n## Workflow\n\n1. **Establish Contract & Scope**\n - For existing skills, read `SKILL.md` and related resources before editing.\n - For new skills, define the trigger prompt, intended execution outcome, required tools, and output artifacts.\n2. **Configure Frontmatter**\n - Provide a clear, concise trigger description in `description` (1024 characters max).\n - **Always enclose `description` in double quotes** (`description: \"...\"`) or use a YAML block scalar (`>`). Colons (`:`), URLs, and trigger phrases inside unquoted YAML break parsing.\n - Set `user-invocable: true` if the skill should be triggerable via slash command (e.g. `/skill-name`).\n - Use `disable-model-invocation: true` for skills intended strictly for slash-command execution.\n - Place non-standard configuration (such as `allowed-tools`) within the standard `metadata` block to maintain Agent Skills specification compliance. Specify tools as a space-separated string or a list.\n3. **Structure & Draft Content**\n - Write instructions in `SKILL.md` using clear, modular procedures.\n - Place deterministic operations in `javascript` tool calls; use `read_file` and `write_file` for workspace persistence.\n - Create required target directories via `create_directory` prior to writing files.\n4. **Declarative Pipelines (`execution.type: tools`)**\n - Define sequential tool pipelines in frontmatter via `execution: { type: \"tools\", tools: [...] }`.\n - Pass outputs between steps using `{ \"$pipe\": \"prev\" }` or step/tool identifiers.\n - Optionally apply `suppressToast: true` or `suppressOutput: true` at the execution root or per step to suppress notifications and output blocks.\n5. **Verify & Validate**\n - Re-read the saved `SKILL.md` and verify valid YAML frontmatter syntax (ensure `description` is enclosed in double quotes).\n - Ensure the skill name uses 1–64 lowercase alphanumeric characters or hyphens and all referenced resource paths exist.\n"
40
40
  }
41
41
  ]
42
42
  }
@@ -1 +1 @@
1
- import{r as e}from"./config-CrHchneq.js";import{Lt as t,M as n,t as r}from"./orchestrator-DpkkeD6T.js";import{t as i}from"./tools-DvckJZG2.js";import{t as a}from"./setConfig-DFMYnYLE.js";import{t as o}from"./effect-BJCrpFdp.js";import{i as s,n as c,r as l}from"./webmcp-DAjmliCx.js";const u={name:`activate_skill`,description:`Load the full instructions for a workspace skill when its description matches the current task.`,input_schema:{type:`object`,properties:{name:{type:`string`,description:`The exact skill name from the available skills catalog.`}},required:[`name`]}};function d(e,a){if(typeof e.webMcpEffectCleanup==`function`&&(e.webMcpEffectCleanup(),e.webMcpEffectCleanup=null),!e.webMcpToolsEnabled){s();return}e.webMcpEffectCleanup=o(()=>{let o=r.activeGroupId,l=i.allTools,d=i.enabledTools;i.declarativeTools,i.declarativeToolNamesEnabled;let f=r.groups.find(e=>e.groupId===o);e.webMcpRegistrationLock=e.webMcpRegistrationLock.then(async()=>{s(),await new Promise(e=>setTimeout(e,0));let r=[];try{r=await i.refreshDeclarativeTools(a,o)}catch{}let p=r.filter(e=>i.isDeclarativeToolEnabled(e.name)),m=[...l,...r],h=f?.toolTags&&f.toolTags.length>0?m.filter(e=>f.toolTags.includes(e.name)):[...d,...p],g={skills:[]};try{g=await t(a,o)}catch{}g.skills.length>0&&!h.some(e=>e.name===u.name)&&(h=[...h,u]),await c(e.agentWorker,async t=>{await n(e,a,t)},o,h)}).catch(e=>{console.error(`WebMCP registration failed:`,e)})})}async function f(t,n,r,i){s(),l(r),await a(n,e.WEBMCP_MODE,r),d(i.orchestrator,n)}async function p(t,n,r,i){t.webMcpToolsEnabled=!!r,await a(n,e.WEBMCP_TOOLS_ENABLED,t.webMcpToolsEnabled?`true`:`false`),d(i.orchestrator,n)}export{u as i,p as n,d as r,f as t};
1
+ import{r as e}from"./config-Bnwx4EfS.js";import{Lt as t,M as n,t as r}from"./orchestrator-DMWi--Dc.js";import{t as i}from"./tools-VSOY66vs.js";import{t as a}from"./setConfig-DFMYnYLE.js";import{t as o}from"./effect-BJCrpFdp.js";import{i as s,n as c,r as l}from"./webmcp-DBONjQWd.js";const u={name:`activate_skill`,description:`Load the full instructions for a workspace skill when its description matches the current task.`,input_schema:{type:`object`,properties:{name:{type:`string`,description:`The exact skill name from the available skills catalog.`}},required:[`name`]}};function d(e,a){if(typeof e.webMcpEffectCleanup==`function`&&(e.webMcpEffectCleanup(),e.webMcpEffectCleanup=null),!e.webMcpToolsEnabled){s();return}e.webMcpEffectCleanup=o(()=>{let o=r.activeGroupId,l=i.allTools,d=i.enabledTools;i.declarativeTools,i.declarativeToolNamesEnabled;let f=r.groups.find(e=>e.groupId===o);e.webMcpRegistrationLock=e.webMcpRegistrationLock.then(async()=>{s(),await new Promise(e=>setTimeout(e,0));let r=[];try{r=await i.refreshDeclarativeTools(a,o)}catch{}let p=r.filter(e=>i.isDeclarativeToolEnabled(e.name)),m=[...l,...r],h=f?.toolTags&&f.toolTags.length>0?m.filter(e=>f.toolTags.includes(e.name)):[...d,...p],g={skills:[]};try{g=await t(a,o)}catch{}g.skills.length>0&&!h.some(e=>e.name===u.name)&&(h=[...h,u]),await c(e.agentWorker,async t=>{await n(e,a,t)},o,h)}).catch(e=>{console.error(`WebMCP registration failed:`,e)})})}async function f(t,n,r,i){s(),l(r),await a(n,e.WEBMCP_MODE,r),d(i.orchestrator,n)}async function p(t,n,r,i){t.webMcpToolsEnabled=!!r,await a(n,e.WEBMCP_TOOLS_ENABLED,t.webMcpToolsEnabled?`true`:`false`),d(i.orchestrator,n)}export{u as i,p as n,d as r,f as t};
@@ -0,0 +1 @@
1
+ import"./tools-CcgG5XuA.js";
@@ -105,4 +105,4 @@ actions:
105
105
  createSurface — render a new surface (requires components array with a root component)
106
106
  updateComponents — add or replace components on an existing surface
107
107
  updateDataModel — update a single path in the data model (re-renders bound components)
108
- deleteSurface — remove the surface from the chat`,input_schema:{type:`object`,properties:{action:{type:`string`,enum:[`createSurface`,`updateComponents`,`updateDataModel`,`deleteSurface`],description:`The A2UI operation to perform`},surfaceId:{type:`string`,description:`Unique identifier for this surface. Use a stable ID so you can update it later.`},components:{type:`array`,description:`Flat array of component objects (required for createSurface/updateComponents). Each object MUST have an 'id' field and a 'component' field. The component with id 'root' is the tree root (required for createSurface). Component field values: Text | Row | Column | Button | TextField | Image | Icon | Video | AudioPlayer | List | Card | Tabs | Modal | Divider | CheckBox | ChoicePicker | Slider | DateTimeInput. Put all properties at the TOP LEVEL alongside 'component' and 'id'. DO NOT nest properties under a 'properties' key. Children arrays contain other component ID strings, not nested objects.`,items:{type:`object`,additionalProperties:!0}},dataModel:{type:`object`,description:`Initial data model for the surface (used with createSurface). Components can reference values via { "path": "/key" }.`,additionalProperties:!0},path:{type:`string`,description:`JSON Pointer path to update (required for updateDataModel). Examples: "/result", "/user/name", "/count". Use "/" to replace the entire data model.`},value:{description:`New value to set at the specified path (used with updateDataModel). Omit to delete the key at the given path.`},surfaceProperties:{type:`object`,description:`Optional display/branding properties for this surface (e.g. agentDisplayName).`,additionalProperties:!0}},required:[`action`,`surfaceId`]}},x={name:`spawn_subagent`,description:`Spawn one or more independent agent loops to work on subtasks in parallel and collect their results. Each subagent has its own tool-use loop, inherits the current API key, and can optionally override provider/model. and runs concurrently with other subagents via Promise.all. Use spawn_subagent when a task has independent parallel workstreams — for example: researching multiple topics simultaneously, processing a list of items in parallel, or delegating isolated subtasks to specialized agents. Do NOT use spawn_subagent for sequential tasks where step 2 depends on step 1's output — just do those steps directly. Do NOT use spawn_subagent for simple single-step work that takes one tool call. Use the parallel_agents field to fan out multiple subagents in a single call.`,input_schema:{type:`object`,properties:{prompt:{type:`string`,description:`The task prompt for a single subagent. Required unless using parallel_agents for multi-agent fan-out.`},tools:{type:`array`,description:`Optional list of tool names to allow in the subagent. If omitted, the subagent inherits the current tool set (minus spawn_subagent to prevent recursion). If provided, only these tools are available to the subagent.`,items:{type:`string`}},profile:{type:`string`,enum:[`current`,`fast`,`smart`,`powerful`],description:`Optional model profile to run the subagent on. Use 'fast' for simple/cheap subtasks (e.g., text formatting, basic search), 'smart' for moderate reasoning, 'powerful' for deep thinking or complex coding, and 'current' to inherit the parent model. Defaults to 'current'.`},workspace_group_id:{type:`string`,description:`Optional workspace group id override for subagent file/tool scope. Use 'parent' to reuse the parent workspace in automatic mode. When omitted, subagents use an isolated workspace by default.`},system_prompt:{type:`string`,description:`Optional system prompt override for the subagent. Defaults to the current system prompt.`},parallel_agents:{type:`array`,description:`Optional list of subagent specifications to run in parallel. When provided, all agents are launched concurrently and their results are combined. Note: There is a configurable maximum limit on parallel subagents (default 5). Each entry can specify a prompt, optional tools list, optional profile, and optional system_prompt.`,items:{type:`object`,properties:{prompt:{type:`string`,description:`The task prompt for this subagent.`},tools:{type:`array`,description:`Optional tool names for this subagent.`,items:{type:`string`}},profile:{type:`string`,enum:[`current`,`fast`,`smart`,`powerful`],description:`Optional model profile for this subagent. Defaults to 'current'.`},workspace_group_id:{type:`string`,description:`Optional workspace group id for this subagent. Use 'parent' for parent workspace in automatic mode.`},system_prompt:{type:`string`,description:`Optional system prompt override for this subagent.`}},required:[`prompt`]}}},required:[`prompt`]}},S={name:`get_current_time`,description:`Get the current date and time. Returns an ISO 8601 string representing the current date and time. Use this tool whenever you need to know the current time, instead of relying on shell tools which may be unavailable.`,input_schema:{type:`object`,properties:{timezone:{type:`string`,description:`Optional timezone to format the time in (e.g. 'America/New_York'). If omitted, returns UTC.`}}}},C={name:`attach_file_to_chat`,description:`Prepare a workspace file for chat delivery by generating an exact markdown attachment snippet. Validates the file path and returns markdown that works for inline image rendering in ShadowClaw and attachment upload in external channels like Telegram/iMessage.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},alt:{type:`string`,description:`Optional alt/caption text to use in the generated markdown`}},required:[`path`]}},w={name:`copy_file`,description:`Copy a file or directory in the group workspace to a new destination path. Supports copying single files or nested directories. Optionally supports copying between different conversation workspaces via source_group_id or target_group_id.`,input_schema:{type:`object`,properties:{source_path:{type:`string`,description:`Source file or directory path relative to workspace root`},target_path:{type:`string`,description:`Destination file or directory path relative to workspace root`},source_group_id:{type:`string`,description:`Optional source conversation group ID (defaults to current workspace)`},target_group_id:{type:`string`,description:`Optional target conversation group ID (defaults to current workspace)`}},required:[`source_path`,`target_path`]}},T={name:`create_directory`,description:`Create a new directory (and any missing parent directories) in the group workspace.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Directory path relative to the group workspace root`}},required:[`path`]}},E={name:`delete_file`,description:`Delete a file or directory from the group workspace. If the target path is a directory, it will be recursively deleted.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File or directory path relative to the group workspace root`}},required:[`path`]}},D={name:`diff_files`,description:`Compare two files in the workspace and output the differences. Useful for comparing generated code, checking before patching, or finding changes outside of git repositories.`,input_schema:{type:`object`,properties:{path_a:{type:`string`,description:`Path to the first file relative to the group workspace root.`},path_b:{type:`string`,description:`Path to the second file relative to the group workspace root.`}},required:[`path_a`,`path_b`]}},O={name:`list_files`,description:`List files and directories in the group workspace. Directory names end with /. Returns sorted entries.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Directory path relative to workspace root (default: root)`}}}},k={name:`move_file`,description:`Move or rename a file or directory in the group workspace to a target path. Supports moving single files or nested directories. Optionally supports moving between different conversation workspaces via source_group_id or target_group_id.`,input_schema:{type:`object`,properties:{source_path:{type:`string`,description:`Source file or directory path relative to workspace root`},target_path:{type:`string`,description:`Destination file or directory path relative to workspace root`},source_group_id:{type:`string`,description:`Optional source conversation group ID (defaults to current workspace)`},target_group_id:{type:`string`,description:`Optional target conversation group ID (defaults to current workspace)`}},required:[`source_path`,`target_path`]}},A={name:`open_file`,description:`Open a file from the group workspace in the UI file viewer dialog. Use this only when the user explicitly asks to inspect a file visually with preview support. Do not use this tool to send or attach files in chat responses.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`}},required:[`path`]}},j={name:`patch_file`,description:`Make a targeted text replacement in a file. Finds the single occurrence of old_string and replaces it with new_string. Fails if old_string is not found or matches more than once. Use this instead of write_file when you only need to change part of a file — it is safer and works well with large files. Include enough surrounding context in old_string to make the match unique. IMPORTANT: You must provide 'path', 'old_string', and 'new_string' parameters.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},old_string:{type:`string`,description:`The exact text to find in the file. Must match exactly once. Include 2-3 lines of surrounding context to ensure a unique match.`},new_string:{type:`string`,description:`The replacement text. Can be empty to delete old_string.`}},required:[`path`,`old_string`,`new_string`]}},M={name:`read_file`,description:`Read the contents of one or more files from the group workspace. IMPORTANT: You must specify either the 'path' parameter (for a single file) or the 'paths' parameter (an array of file paths for multiple files). When paths is provided, returns all file contents concatenated with --- filename --- headers. Prefer paths to batch reads in a single call. Image files (png, jpg, gif, webp, etc.) are returned as native image content that the model can see directly. Other binary files will be detected and an error returned suggesting alternative tools.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Single file path relative to the group workspace root`},paths:{type:`array`,items:{type:`string`},description:`Array of file paths relative to the group workspace root. Use this to read multiple files in a single tool call.`}}}},N={name:`search_files`,description:`Search for a pattern (regex or exact text) in files across the workspace. Useful for finding code references, function definitions, or specific content without needing to rely on a shell environment.`,input_schema:{type:`object`,properties:{pattern:{type:`string`,description:`The text or regular expression to search for.`},path:{type:`string`,description:`Optional directory path to restrict the search to (e.g. 'src/'). Defaults to workspace root.`},file_glob:{type:`string`,description:`Optional simple glob to filter files (e.g. '*.ts'). Supports * as wildcard.`},is_regex:{type:`boolean`,description:`Set to true to parse the pattern as a regular expression.`}},required:[`pattern`]}},P={name:`send_file`,description:`Send a workspace file directly to the current peer over the P2P (PeerJS/WebRTC) data channel. Use this when the user is in a peer conversation and explicitly asks to send or transfer a file to their peer. Do NOT use this for local-browser or non-peer conversations — it only works when the active conversation is a peer: group. The file is read from the current group workspace and transferred in binary chunks so there is no size limit.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`}},required:[`path`]}},F={name:`write_file`,description:`Write content to a file in the group workspace. Creates the file and any intermediate directories if they don't exist. Overwrites the file if it already exists. IMPORTANT: You must provide both the 'path' and 'content' parameters when calling this tool.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},content:{type:`string`,description:`Content to write to the file`}},required:[`path`,`content`]}},I={name:`git_add`,description:`Stage files in a cloned repo. Accepts an array of filepaths. If omitted or empty, stages the repo root.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},filepaths:{type:`array`,items:{type:`string`},description:`Array of file paths to stage (relative to repo root). Pass a single item for one file.`}},required:[`repo`]}},L={name:`git_branch`,description:`Create a new branch in a cloned repo. Optionally switch to it immediately (like git checkout -b).`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (returned by git_clone)`},name:{type:`string`,description:`Name for the new branch`},checkout:{type:`boolean`,description:`Switch to the new branch after creating it (default: false)`},start_point:{type:`string`,description:`Branch, tag, or commit SHA to branch from (default: HEAD)`}},required:[`repo`,`name`]}},R={name:`git_branches`,description:`List branches in a cloned repo. Current branch is marked with *.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},remote:{type:`boolean`,description:`List remote-tracking branches instead (default: false)`}},required:[`repo`]}},z={name:`git_checkout`,description:`Checkout a branch, tag, or commit SHA in a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (returned by git_clone)`},ref:{type:`string`,description:`Branch name, tag, or commit SHA to checkout`}},required:[`repo`,`ref`]}},B={name:`git_clone`,description:`Clone a git repository into browser-persistent OPFS storage. Files are stored directly under repos/<repo-name>/ in the workspace and are immediately accessible to other git_* tools without any extra sync step. Works with public and private repos (GitHub, GitLab, GitHub Enterprise, etc.). If a Git PAT is configured in Settings, it is used automatically for authentication. Uses a CORS proxy. Returns the short repo name used for subsequent git_* operations.`,input_schema:{type:`object`,properties:{url:{type:`string`,description:`Full HTTPS repo URL (e.g. https://github.com/user/repo)`},name:{type:`string`,description:`Optional short repo name to use for the clone directory; defaults to the repository name parsed from the URL.`},branch:{type:`string`,description:`Branch to clone (default: default branch)`},depth:{type:`number`,description:`Shallow clone depth (default: 20)`}},required:[`url`]}},V={name:`git_commit`,description:`Stage all changes and create a commit in a cloned repo. Uses configured git author name/email or defaults.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},message:{type:`string`,description:`Commit message`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`,`message`]}},te={name:`git_config`,description:`Get or set a git config value for a repo (e.g. user.name, user.email). Persistent per-repo identity avoids specifying author on every commit.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},command:{type:`string`,enum:[`get`,`set`],description:`Operation: get or set a config value`},key:{type:`string`,description:`Config key path (e.g. user.name, user.email, core.autocrlf)`},value:{type:`string`,description:`Value to set — required when command is set`}},required:[`repo`,`command`,`key`]}},H={name:`git_delete_branch`,description:`Delete a local branch from a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},name:{type:`string`,description:`Name of the branch to delete`}},required:[`repo`,`name`]}},U={name:`git_delete_repo`,description:"Delete the git metadata for a cloned repository while leaving the working tree files in place. Use this to clean up corrupted or stale repos that fail to re-clone. The repo directory remains under repos/<repo>, but the `.git/` metadata is removed.",input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (as returned by git_clone or git_list_repos)`}},required:[`repo`]}},W={name:`git_diff`,description:`Show changed files between HEAD and working tree, or between two refs.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref1:{type:`string`,description:`First ref (default: HEAD)`},ref2:{type:`string`,description:`Second ref (if omitted, diffs HEAD vs workdir)`}},required:[`repo`]}},G={name:`git_fetch`,description:`Fetch commits from the remote without merging. Safe for inspecting remote state before deciding to merge or rebase.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Remote branch to fetch (default: default branch)`},remote:{type:`string`,description:`Remote name (default: origin)`}},required:[`repo`]}},K={name:`git_init`,description:`Initialize a new empty git repository in browser storage. Use this to create a new project from scratch before using git_push to push to a remote.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short name for the new repo (used for all subsequent git_ operations)`}},required:[`repo`]}},q={name:`git_list_repos`,description:`List all git repositories currently cloned in browser storage.`,input_schema:{type:`object`,properties:{}}},J={name:`git_log`,description:`Show the commit log for a cloned repo. Returns commit SHA, date, author, and message.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Ref to log from (default: HEAD)`},depth:{type:`number`,description:`Number of commits to show (default: 10)`}},required:[`repo`]}},Y={name:`git_merge`,description:`Merge a branch or ref into the current branch. Supports fast-forward and three-way merges. If the merge has conflicts, a detailed report is returned with the conflicted files and their conflict regions inline. To resolve: use read_file on each conflicted file, then write_file with the complete resolved content (no conflict markers). After all files are resolved, use git_add for each, then git_commit. Do NOT use bash/sed for conflict resolution.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},theirs:{type:`string`,description:`Branch name, tag, or commit SHA to merge into the current branch`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`,`theirs`]}},X={name:`git_pull`,description:`Fetch and merge commits from the remote repository. Uses configured git author name/email for merge commits if needed.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Branch to pull (default: current branch)`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`]}},Z={name:`git_push`,description:`Push commits to the remote repository. Requires a GitHub personal access token (PAT) to be configured. The token is loaded from the encrypted credential store.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Local branch to push (default: current branch)`},remote_ref:{type:`string`,description:`Remote branch name to push to, if different from local branch. Example: push local 'feature-rebased' to remote 'feature/original'.`},force:{type:`boolean`,description:`Force push (default: false)`},tags:{type:`boolean`,description:`Also push all local tags to the remote (default: false)`}},required:[`repo`]}},Q={name:`git_read_file_at_ref`,description:`Read a file's contents at a specific ref (branch, tag, or commit SHA) without checking it out. Useful for code review across branches.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Branch name, tag, or commit SHA`},filepath:{type:`string`,description:`File path relative to the repo root`}},required:[`repo`,`ref`,`filepath`]}},ne={name:`git_remote`,description:`Manage git remotes: list, add, or remove a remote in a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},command:{type:`string`,enum:[`list`,`add`,`remove`],description:`Operation to perform`},remote:{type:`string`,description:`Remote name (e.g. origin, upstream) — required for add/remove`},url:{type:`string`,description:`Remote URL — required for add`}},required:[`repo`,`command`]}},re={name:`git_reset`,description:`Reset the current branch HEAD to a specific ref or commit SHA. Updates the branch pointer and checks out the target, discarding local changes. Equivalent to 'git reset --hard <ref>'.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Branch name, tag, or commit SHA to reset to`}},required:[`repo`,`ref`]}},ie={name:`git_show`,description:`Show the metadata and diff of a specific commit. Returns author, date, message, and a unified diff against the parent commit.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Commit SHA, branch, or tag to inspect (default: HEAD)`}},required:[`repo`,`ref`]}},ae={name:`git_status`,description:`Show the working tree status of a cloned repo. Reports modified, added, deleted, and unstaged files.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`}},required:[`repo`]}},oe={name:`git_tag`,description:`Create a lightweight or annotated tag at HEAD. Use git_push with tags=true to push tags to the remote.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},tag:{type:`string`,description:`Tag name (e.g. v1.2.3)`},message:{type:`string`,description:`Annotation message — if provided, creates an annotated tag; otherwise lightweight`},author_name:{type:`string`,description:`Tagger name (optional, uses configured default)`},author_email:{type:`string`,description:`Tagger email (optional, uses configured default)`}},required:[`repo`,`tag`]}},se={name:`git_unstage`,description:`Remove one or more staged files from the index without touching the working tree. The inverse of git_add — use to undo accidental staging.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},filepath:{anyOf:[{type:`string`},{type:`array`,items:{type:`string`}}],description:`File path or array of file paths to unstage (relative to repo root)`}},required:[`repo`,`filepath`]}},ce={name:`create_task`,description:`Create a scheduled recurring task. The task will run automatically on the specified schedule and send the result back to this group. Uses cron expressions (minute hour day-of-month month day-of-week).`,input_schema:{type:`object`,properties:{schedule:{type:`string`,description:`Cron expression, e.g. "0 9 * * 1-5" for 9am weekdays`},prompt:{type:`string`,description:`The prompt/instruction to execute on each run (used if type is 'prompt')`},type:{type:`string`,enum:[`prompt`,`tools`],description:`The type of task to create. Defaults to 'prompt'.`},tools:{type:`array`,description:`A list of tools to execute sequentially (used if type is 'tools')`,items:{type:`object`,properties:{name:{type:`string`},input:{type:`object`}},required:[`name`,`input`]}},name:{type:`string`,description:`The optional title/name for the task, helping to identify its purpose.`}},required:[`prompt`,`type`]}},le={name:`list_tasks`,description:`List all scheduled recurring tasks for this group. Returns a list of tasks with their IDs, schedules, and prompts.`,input_schema:{type:`object`,properties:{}}},ue={name:`update_task`,description:`Update an existing scheduled task's schedule or prompt.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to update`},schedule:{type:`string`,description:`Standard cron expression (e.g. '0 9 * * *'). Leave empty for an unscheduled task.`},prompt:{type:`string`,description:`New prompt/instruction (optional)`},type:{type:`string`,enum:[`prompt`,`tools`],description:`New task type (optional)`},tools:{type:`array`,description:`New list of tools (optional)`,items:{type:`object`,properties:{name:{type:`string`},input:{type:`object`}},required:[`name`,`input`]}},enabled:{type:`boolean`,description:`Whether the task is enabled (optional)`},name:{type:`string`,description:`New name/title for the task (optional).`}},required:[`id`]}},de={name:`delete_task`,description:`Delete a scheduled task by its ID.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to delete`}},required:[`id`]}},fe={name:`enable_task`,description:`Enable a scheduled task so it runs on its schedule.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to enable`}},required:[`id`]}},pe={name:`disable_task`,description:`Disable a scheduled task so it stops running.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to disable`}},required:[`id`]}},me={name:`run_task`,description:`Immediately trigger a scheduled task by its ID, outside of its normal cron schedule. Use this to manually fire a task on demand. Use list_tasks to find the task ID first.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to run immediately`}},required:[`id`]}},he={name:`create_room`,description:`Create a new multi-party room (a shared PeerJS conversation) hosted by this device. Other agents or humans can then be invited to participate. Returns the room so you can share or invite peers into it.`,input_schema:{type:`object`,properties:{name:{type:`string`,description:`A human-readable name for the room.`}},required:[`name`]}},ge={name:`invite_to_room`,description:`Invite a peer (another agent or human, identified by their PeerJS peer ID) into a room so they can join the shared conversation. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{peer_id:{type:`string`,description:`The PeerJS peer ID of the participant to invite.`},room_id:{type:`string`,description:`The room id to invite into. Defaults to the current room conversation.`}},required:[`peer_id`]}},_e={name:`leave_room`,description:`Leave a room. If you are the host, the room is disbanded for all members. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{room_id:{type:`string`,description:`The room id to leave. Defaults to the current room conversation.`}}}},ve={name:`list_room_members`,description:`List the participants (humans and agents) currently in a room. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{room_id:{type:`string`,description:`The room id to inspect. Defaults to the current room conversation.`}}}},ye={name:`summarize_text`,description:`Summarize text using Web Platform's Summarizer API (or polyfill fallback). Produces key points, TLDR, teaser, or headline.`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text content to summarize.`},type:{type:`string`,enum:[`key-points`,`tldr`,`teaser`,`headline`],description:`The summary type (default: key-points).`},format:{type:`string`,enum:[`plain-text`,`markdown`],description:`Output format (default: markdown).`},length:{type:`string`,enum:[`short`,`medium`,`long`],description:`Summary length (default: short).`},preference:{type:`string`,enum:[`capability`,`speed`,`auto`],description:`Summarizer performance preference (default: auto).`},context:{type:`string`,description:`Optional background context for summarization.`}},required:[`text`]}},be={name:`write_text`,description:`Generate or draft text using Web Platform's Writer API (or polyfill fallback).`,input_schema:{type:`object`,properties:{prompt:{type:`string`,description:`The prompt or writing instructions.`},context:{type:`string`,description:`Optional background context for writing.`}},required:[`prompt`]}},xe={name:`rewrite_text`,description:`Rewrite or rephrase text using Web Platform's Rewriter API (or polyfill fallback). Can adjust tone or length.`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to rewrite.`},tone:{type:`string`,enum:[`as-is`,`more-formal`,`more-casual`],description:`Tone adjustment (default: as-is).`},length:{type:`string`,enum:[`as-is`,`shorter`,`longer`],description:`Length adjustment (default: as-is).`},context:{type:`string`,description:`Optional background context for rewriting.`}},required:[`text`]}},Se={name:`proofread_text`,description:`Proofread and correct grammar, spelling, and phrasing errors using Web Platform's Proofreader API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to proofread.`},context:{type:`string`,description:`Optional background context for proofreading.`}},required:[`text`]}},Ce={name:`detect_language`,description:`Detect the language of input text using Web Platform's Language Detector API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to analyze for language detection.`}},required:[`text`]}},we={name:`translate_text`,description:`Translate text using Web Platform's Translator API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to translate.`},sourceLanguage:{type:`string`,description:`Source language BCP 47 code (e.g. 'en', 'es', 'ja').`},targetLanguage:{type:`string`,description:`Target language BCP 47 code (e.g. 'en', 'es', 'ja').`}},required:[`text`,`sourceLanguage`,`targetLanguage`]}};var Te=e({TOOL_DEFINITIONS:()=>$});const $=[ee,C,t,n,w,T,he,ce,E,de,Ce,D,pe,i,a,fe,s,o,S,I,L,R,z,B,V,te,H,U,W,G,K,q,J,Y,X,Z,Q,ne,re,ie,ae,oe,se,ge,l,_e,y,O,ve,le,p,r,f,k,A,j,Se,M,d,u,b,xe,me,N,P,g,h,x,ye,we,m,ue,c,F,be];export{v as i,Te as n,_ as r,$ as t};
108
+ deleteSurface — remove the surface from the chat`,input_schema:{type:`object`,properties:{action:{type:`string`,enum:[`createSurface`,`updateComponents`,`updateDataModel`,`deleteSurface`],description:`The A2UI operation to perform`},surfaceId:{type:`string`,description:`Unique identifier for this surface. Use a stable ID so you can update it later.`},components:{type:`array`,description:`Flat array of component objects (required for createSurface/updateComponents). Each object MUST have an 'id' field and a 'component' field. The component with id 'root' is the tree root (required for createSurface). Component field values: Text | Row | Column | Button | TextField | Image | Icon | Video | AudioPlayer | List | Card | Tabs | Modal | Divider | CheckBox | ChoicePicker | Slider | DateTimeInput. Put all properties at the TOP LEVEL alongside 'component' and 'id'. DO NOT nest properties under a 'properties' key. Children arrays contain other component ID strings, not nested objects.`,items:{type:`object`,additionalProperties:!0}},dataModel:{type:`object`,description:`Initial data model for the surface (used with createSurface). Components can reference values via { "path": "/key" }.`,additionalProperties:!0},path:{type:`string`,description:`JSON Pointer path to update (required for updateDataModel). Examples: "/result", "/user/name", "/count". Use "/" to replace the entire data model.`},value:{description:`New value to set at the specified path (used with updateDataModel). Omit to delete the key at the given path.`},surfaceProperties:{type:`object`,description:`Optional display/branding properties for this surface (e.g. agentDisplayName).`,additionalProperties:!0}},required:[`action`,`surfaceId`]}},x={name:`spawn_subagent`,description:`Spawn one or more independent agent loops to work on subtasks in parallel and collect their results. Each subagent has its own tool-use loop, inherits the current API key, and can optionally override provider/model. and runs concurrently with other subagents via Promise.all. Use spawn_subagent when a task has independent parallel workstreams — for example: researching multiple topics simultaneously, processing a list of items in parallel, or delegating isolated subtasks to specialized agents. Do NOT use spawn_subagent for sequential tasks where step 2 depends on step 1's output — just do those steps directly. Do NOT use spawn_subagent for simple single-step work that takes one tool call. Use the parallel_agents field to fan out multiple subagents in a single call.`,input_schema:{type:`object`,properties:{prompt:{type:`string`,description:`The task prompt for a single subagent. Required unless using parallel_agents for multi-agent fan-out.`},tools:{type:`array`,description:`Optional list of tool names to allow in the subagent. If omitted, the subagent inherits the current tool set (minus spawn_subagent to prevent recursion). If provided, only these tools are available to the subagent.`,items:{type:`string`}},profile:{type:`string`,enum:[`current`,`fast`,`smart`,`powerful`],description:`Optional model profile to run the subagent on. Use 'fast' for simple/cheap subtasks (e.g., text formatting, basic search), 'smart' for moderate reasoning, 'powerful' for deep thinking or complex coding, and 'current' to inherit the parent model. Defaults to 'current'.`},workspace_group_id:{type:`string`,description:`Optional workspace group id override for subagent file/tool scope. Use 'parent' to reuse the parent workspace in automatic mode. When omitted, subagents use an isolated workspace by default.`},system_prompt:{type:`string`,description:`Optional system prompt override for the subagent. Defaults to the current system prompt.`},parallel_agents:{type:`array`,description:`Optional list of subagent specifications to run in parallel. When provided, all agents are launched concurrently and their results are combined. Note: There is a configurable maximum limit on parallel subagents (default 5). Each entry can specify a prompt, optional tools list, optional profile, and optional system_prompt.`,items:{type:`object`,properties:{prompt:{type:`string`,description:`The task prompt for this subagent.`},tools:{type:`array`,description:`Optional tool names for this subagent.`,items:{type:`string`}},profile:{type:`string`,enum:[`current`,`fast`,`smart`,`powerful`],description:`Optional model profile for this subagent. Defaults to 'current'.`},workspace_group_id:{type:`string`,description:`Optional workspace group id for this subagent. Use 'parent' for parent workspace in automatic mode.`},system_prompt:{type:`string`,description:`Optional system prompt override for this subagent.`}},required:[`prompt`]}}},required:[`prompt`]}},S={name:`get_current_time`,description:`Get the current date and time. Returns an ISO 8601 string representing the current date and time. Use this tool whenever you need to know the current time, instead of relying on shell tools which may be unavailable.`,input_schema:{type:`object`,properties:{timezone:{type:`string`,description:`Optional timezone to format the time in (e.g. 'America/New_York'). If omitted, returns UTC.`}}}},C={name:`attach_file_to_chat`,description:`Prepare a workspace file for chat delivery by generating an exact markdown attachment snippet. Validates the file path and returns markdown that works for inline image rendering in ShadowClaw and attachment upload in external channels like Telegram/iMessage.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},alt:{type:`string`,description:`Optional alt/caption text to use in the generated markdown`}},required:[`path`]}},w={name:`copy_file`,description:`Copy a file or directory in the group workspace to a new destination path. Supports copying single files or nested directories. Optionally supports copying between different conversation workspaces via source_group_id or target_group_id.`,input_schema:{type:`object`,properties:{source_path:{type:`string`,description:`Source file or directory path relative to workspace root`},target_path:{type:`string`,description:`Destination file or directory path relative to workspace root`},source_group_id:{type:`string`,description:`Optional source conversation group ID (defaults to current workspace)`},target_group_id:{type:`string`,description:`Optional target conversation group ID (defaults to current workspace)`}},required:[`source_path`,`target_path`]}},T={name:`create_directory`,description:`Create a new directory (and any missing parent directories) in the group workspace.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Directory path relative to the group workspace root`}},required:[`path`]}},E={name:`delete_file`,description:`Delete a file or directory from the group workspace. If the target path is a directory, it will be recursively deleted.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File or directory path relative to the group workspace root`}},required:[`path`]}},D={name:`diff_files`,description:`Compare two files in the workspace and output the differences. Useful for comparing generated code, checking before patching, or finding changes outside of git repositories.`,input_schema:{type:`object`,properties:{path_a:{type:`string`,description:`Path to the first file relative to the group workspace root.`},path_b:{type:`string`,description:`Path to the second file relative to the group workspace root.`}},required:[`path_a`,`path_b`]}},O={name:`list_files`,description:`List files and directories in the group workspace. Directory names end with /. Returns sorted entries.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Directory path relative to workspace root (default: root)`}}}},k={name:`move_file`,description:`Move or rename a file or directory in the group workspace to a target path. Supports moving single files or nested directories. Optionally supports moving between different conversation workspaces via source_group_id or target_group_id.`,input_schema:{type:`object`,properties:{source_path:{type:`string`,description:`Source file or directory path relative to workspace root`},target_path:{type:`string`,description:`Destination file or directory path relative to workspace root`},source_group_id:{type:`string`,description:`Optional source conversation group ID (defaults to current workspace)`},target_group_id:{type:`string`,description:`Optional target conversation group ID (defaults to current workspace)`}},required:[`source_path`,`target_path`]}},A={name:`open_file`,description:`Open a file from the group workspace in the UI file viewer dialog. Use this only when the user explicitly asks to inspect a file visually with preview support. Do not use this tool to send or attach files in chat responses.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`}},required:[`path`]}},j={name:`patch_file`,description:`Make a targeted text replacement in a file. Finds the single occurrence of old_string and replaces it with new_string. Fails if old_string is not found or matches more than once. Use this instead of write_file when you only need to change part of a file — it is safer and works well with large files. Include enough surrounding context in old_string to make the match unique. IMPORTANT: You must provide 'path', 'old_string', and 'new_string' parameters.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},old_string:{type:`string`,description:`The exact text to find in the file. Must match exactly once. Include 2-3 lines of surrounding context to ensure a unique match.`},new_string:{type:`string`,description:`The replacement text. Can be empty to delete old_string.`}},required:[`path`,`old_string`,`new_string`]}},M={name:`read_file`,description:`Read the contents of one or more files from the group workspace. IMPORTANT: You must specify either the 'path' parameter (for a single file) or the 'paths' parameter (an array of file paths for multiple files). When paths is provided, returns all file contents concatenated with --- filename --- headers. Prefer paths to batch reads in a single call. Image files (png, jpg, gif, webp, etc.) are returned as native image content that the model can see directly. Other binary files will be detected and an error returned suggesting alternative tools.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`Single file path relative to the group workspace root`},paths:{type:`array`,items:{type:`string`},description:`Array of file paths relative to the group workspace root. Use this to read multiple files in a single tool call.`}}}},N={name:`search_files`,description:`Search for a pattern (regex or exact text) in files across the workspace. Useful for finding code references, function definitions, or specific content without needing to rely on a shell environment.`,input_schema:{type:`object`,properties:{pattern:{type:`string`,description:`The text or regular expression to search for.`},path:{type:`string`,description:`Optional directory path to restrict the search to (e.g. 'src/'). Defaults to workspace root.`},file_glob:{type:`string`,description:`Optional simple glob to filter files (e.g. '*.ts'). Supports * as wildcard.`},is_regex:{type:`boolean`,description:`Set to true to parse the pattern as a regular expression.`}},required:[`pattern`]}},P={name:`send_file`,description:`Send a workspace file directly to connected peer(s) over the P2P (PeerJS/WebRTC) data channel. Use this when the user is in a peer conversation or room and asks to send or transfer a file. Do NOT use this for local-browser or other non-peer conversations — it only works when the active conversation is a peer or room session (peer: or room: group). The file is read from the current group workspace and transferred in binary chunks so there is no size limit.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`}},required:[`path`]}},F={name:`write_file`,description:`Write content to a file in the group workspace. Creates the file and any intermediate directories if they don't exist. Overwrites the file if it already exists. IMPORTANT: You must provide both the 'path' and 'content' parameters when calling this tool.`,input_schema:{type:`object`,properties:{path:{type:`string`,description:`File path relative to the group workspace root`},content:{type:`string`,description:`Content to write to the file`}},required:[`path`,`content`]}},I={name:`git_add`,description:`Stage files in a cloned repo. Accepts an array of filepaths. If omitted or empty, stages the repo root.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},filepaths:{type:`array`,items:{type:`string`},description:`Array of file paths to stage (relative to repo root). Pass a single item for one file.`}},required:[`repo`]}},L={name:`git_branch`,description:`Create a new branch in a cloned repo. Optionally switch to it immediately (like git checkout -b).`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (returned by git_clone)`},name:{type:`string`,description:`Name for the new branch`},checkout:{type:`boolean`,description:`Switch to the new branch after creating it (default: false)`},start_point:{type:`string`,description:`Branch, tag, or commit SHA to branch from (default: HEAD)`}},required:[`repo`,`name`]}},R={name:`git_branches`,description:`List branches in a cloned repo. Current branch is marked with *.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},remote:{type:`boolean`,description:`List remote-tracking branches instead (default: false)`}},required:[`repo`]}},z={name:`git_checkout`,description:`Checkout a branch, tag, or commit SHA in a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (returned by git_clone)`},ref:{type:`string`,description:`Branch name, tag, or commit SHA to checkout`}},required:[`repo`,`ref`]}},B={name:`git_clone`,description:`Clone a git repository into browser-persistent OPFS storage. Files are stored directly under repos/<repo-name>/ in the workspace and are immediately accessible to other git_* tools without any extra sync step. Works with public and private repos (GitHub, GitLab, GitHub Enterprise, etc.). If a Git PAT is configured in Settings, it is used automatically for authentication. Uses a CORS proxy. Returns the short repo name used for subsequent git_* operations.`,input_schema:{type:`object`,properties:{url:{type:`string`,description:`Full HTTPS repo URL (e.g. https://github.com/user/repo)`},name:{type:`string`,description:`Optional short repo name to use for the clone directory; defaults to the repository name parsed from the URL.`},branch:{type:`string`,description:`Branch to clone (default: default branch)`},depth:{type:`number`,description:`Shallow clone depth (default: 20)`}},required:[`url`]}},V={name:`git_commit`,description:`Stage all changes and create a commit in a cloned repo. Uses configured git author name/email or defaults.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},message:{type:`string`,description:`Commit message`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`,`message`]}},te={name:`git_config`,description:`Get or set a git config value for a repo (e.g. user.name, user.email). Persistent per-repo identity avoids specifying author on every commit.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},command:{type:`string`,enum:[`get`,`set`],description:`Operation: get or set a config value`},key:{type:`string`,description:`Config key path (e.g. user.name, user.email, core.autocrlf)`},value:{type:`string`,description:`Value to set — required when command is set`}},required:[`repo`,`command`,`key`]}},H={name:`git_delete_branch`,description:`Delete a local branch from a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},name:{type:`string`,description:`Name of the branch to delete`}},required:[`repo`,`name`]}},U={name:`git_delete_repo`,description:"Delete the git metadata for a cloned repository while leaving the working tree files in place. Use this to clean up corrupted or stale repos that fail to re-clone. The repo directory remains under repos/<repo>, but the `.git/` metadata is removed.",input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name (as returned by git_clone or git_list_repos)`}},required:[`repo`]}},W={name:`git_diff`,description:`Show changed files between HEAD and working tree, or between two refs.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref1:{type:`string`,description:`First ref (default: HEAD)`},ref2:{type:`string`,description:`Second ref (if omitted, diffs HEAD vs workdir)`}},required:[`repo`]}},G={name:`git_fetch`,description:`Fetch commits from the remote without merging. Safe for inspecting remote state before deciding to merge or rebase.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Remote branch to fetch (default: default branch)`},remote:{type:`string`,description:`Remote name (default: origin)`}},required:[`repo`]}},K={name:`git_init`,description:`Initialize a new empty git repository in browser storage. Use this to create a new project from scratch before using git_push to push to a remote.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short name for the new repo (used for all subsequent git_ operations)`}},required:[`repo`]}},q={name:`git_list_repos`,description:`List all git repositories currently cloned in browser storage.`,input_schema:{type:`object`,properties:{}}},J={name:`git_log`,description:`Show the commit log for a cloned repo. Returns commit SHA, date, author, and message.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Ref to log from (default: HEAD)`},depth:{type:`number`,description:`Number of commits to show (default: 10)`}},required:[`repo`]}},Y={name:`git_merge`,description:`Merge a branch or ref into the current branch. Supports fast-forward and three-way merges. If the merge has conflicts, a detailed report is returned with the conflicted files and their conflict regions inline. To resolve: use read_file on each conflicted file, then write_file with the complete resolved content (no conflict markers). After all files are resolved, use git_add for each, then git_commit. Do NOT use bash/sed for conflict resolution.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},theirs:{type:`string`,description:`Branch name, tag, or commit SHA to merge into the current branch`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`,`theirs`]}},X={name:`git_pull`,description:`Fetch and merge commits from the remote repository. Uses configured git author name/email for merge commits if needed.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Branch to pull (default: current branch)`},author_name:{type:`string`,description:`Author name (optional, uses configured default)`},author_email:{type:`string`,description:`Author email (optional, uses configured default)`}},required:[`repo`]}},Z={name:`git_push`,description:`Push commits to the remote repository. Requires a GitHub personal access token (PAT) to be configured. The token is loaded from the encrypted credential store.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},branch:{type:`string`,description:`Local branch to push (default: current branch)`},remote_ref:{type:`string`,description:`Remote branch name to push to, if different from local branch. Example: push local 'feature-rebased' to remote 'feature/original'.`},force:{type:`boolean`,description:`Force push (default: false)`},tags:{type:`boolean`,description:`Also push all local tags to the remote (default: false)`}},required:[`repo`]}},Q={name:`git_read_file_at_ref`,description:`Read a file's contents at a specific ref (branch, tag, or commit SHA) without checking it out. Useful for code review across branches.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Branch name, tag, or commit SHA`},filepath:{type:`string`,description:`File path relative to the repo root`}},required:[`repo`,`ref`,`filepath`]}},ne={name:`git_remote`,description:`Manage git remotes: list, add, or remove a remote in a cloned repo.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},command:{type:`string`,enum:[`list`,`add`,`remove`],description:`Operation to perform`},remote:{type:`string`,description:`Remote name (e.g. origin, upstream) — required for add/remove`},url:{type:`string`,description:`Remote URL — required for add`}},required:[`repo`,`command`]}},re={name:`git_reset`,description:`Reset the current branch HEAD to a specific ref or commit SHA. Updates the branch pointer and checks out the target, discarding local changes. Equivalent to 'git reset --hard <ref>'.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Branch name, tag, or commit SHA to reset to`}},required:[`repo`,`ref`]}},ie={name:`git_show`,description:`Show the metadata and diff of a specific commit. Returns author, date, message, and a unified diff against the parent commit.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},ref:{type:`string`,description:`Commit SHA, branch, or tag to inspect (default: HEAD)`}},required:[`repo`,`ref`]}},ae={name:`git_status`,description:`Show the working tree status of a cloned repo. Reports modified, added, deleted, and unstaged files.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`}},required:[`repo`]}},oe={name:`git_tag`,description:`Create a lightweight or annotated tag at HEAD. Use git_push with tags=true to push tags to the remote.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},tag:{type:`string`,description:`Tag name (e.g. v1.2.3)`},message:{type:`string`,description:`Annotation message — if provided, creates an annotated tag; otherwise lightweight`},author_name:{type:`string`,description:`Tagger name (optional, uses configured default)`},author_email:{type:`string`,description:`Tagger email (optional, uses configured default)`}},required:[`repo`,`tag`]}},se={name:`git_unstage`,description:`Remove one or more staged files from the index without touching the working tree. The inverse of git_add — use to undo accidental staging.`,input_schema:{type:`object`,properties:{repo:{type:`string`,description:`Short repo name`},filepath:{anyOf:[{type:`string`},{type:`array`,items:{type:`string`}}],description:`File path or array of file paths to unstage (relative to repo root)`}},required:[`repo`,`filepath`]}},ce={name:`create_task`,description:`Create a scheduled recurring task. The task will run automatically on the specified schedule and send the result back to this group. Uses cron expressions (minute hour day-of-month month day-of-week).`,input_schema:{type:`object`,properties:{schedule:{type:`string`,description:`Cron expression, e.g. "0 9 * * 1-5" for 9am weekdays`},prompt:{type:`string`,description:`The prompt/instruction to execute on each run (used if type is 'prompt')`},type:{type:`string`,enum:[`prompt`,`tools`],description:`The type of task to create. Defaults to 'prompt'.`},tools:{type:`array`,description:`A list of tools to execute sequentially (used if type is 'tools')`,items:{type:`object`,properties:{name:{type:`string`},input:{type:`object`}},required:[`name`,`input`]}},name:{type:`string`,description:`The optional title/name for the task, helping to identify its purpose.`}},required:[`prompt`,`type`]}},le={name:`list_tasks`,description:`List all scheduled recurring tasks for this group. Returns a list of tasks with their IDs, schedules, and prompts.`,input_schema:{type:`object`,properties:{}}},ue={name:`update_task`,description:`Update an existing scheduled task's schedule or prompt.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to update`},schedule:{type:`string`,description:`Standard cron expression (e.g. '0 9 * * *'). Leave empty for an unscheduled task.`},prompt:{type:`string`,description:`New prompt/instruction (optional)`},type:{type:`string`,enum:[`prompt`,`tools`],description:`New task type (optional)`},tools:{type:`array`,description:`New list of tools (optional)`,items:{type:`object`,properties:{name:{type:`string`},input:{type:`object`}},required:[`name`,`input`]}},enabled:{type:`boolean`,description:`Whether the task is enabled (optional)`},name:{type:`string`,description:`New name/title for the task (optional).`}},required:[`id`]}},de={name:`delete_task`,description:`Delete a scheduled task by its ID.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to delete`}},required:[`id`]}},fe={name:`enable_task`,description:`Enable a scheduled task so it runs on its schedule.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to enable`}},required:[`id`]}},pe={name:`disable_task`,description:`Disable a scheduled task so it stops running.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to disable`}},required:[`id`]}},me={name:`run_task`,description:`Immediately trigger a scheduled task by its ID, outside of its normal cron schedule. Use this to manually fire a task on demand. Use list_tasks to find the task ID first.`,input_schema:{type:`object`,properties:{id:{type:`string`,description:`The unique ID of the task to run immediately`}},required:[`id`]}},he={name:`create_room`,description:`Create a new multi-party room (a shared PeerJS conversation) hosted by this device. Other agents or humans can then be invited to participate. Returns the room so you can share or invite peers into it.`,input_schema:{type:`object`,properties:{name:{type:`string`,description:`A human-readable name for the room.`}},required:[`name`]}},ge={name:`invite_to_room`,description:`Invite a peer (another agent or human, identified by their PeerJS peer ID) into a room so they can join the shared conversation. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{peer_id:{type:`string`,description:`The PeerJS peer ID of the participant to invite.`},room_id:{type:`string`,description:`The room id to invite into. Defaults to the current room conversation.`}},required:[`peer_id`]}},_e={name:`leave_room`,description:`Leave a room. If you are the host, the room is disbanded for all members. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{room_id:{type:`string`,description:`The room id to leave. Defaults to the current room conversation.`}}}},ve={name:`list_room_members`,description:`List the participants (humans and agents) currently in a room. If room_id is omitted and the current conversation is a room, that room is used.`,input_schema:{type:`object`,properties:{room_id:{type:`string`,description:`The room id to inspect. Defaults to the current room conversation.`}}}},ye={name:`summarize_text`,description:`Summarize text using Web Platform's Summarizer API (or polyfill fallback). Produces key points, TLDR, teaser, or headline.`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text content to summarize.`},type:{type:`string`,enum:[`key-points`,`tldr`,`teaser`,`headline`],description:`The summary type (default: key-points).`},format:{type:`string`,enum:[`plain-text`,`markdown`],description:`Output format (default: markdown).`},length:{type:`string`,enum:[`short`,`medium`,`long`],description:`Summary length (default: short).`},preference:{type:`string`,enum:[`capability`,`speed`,`auto`],description:`Summarizer performance preference (default: auto).`},context:{type:`string`,description:`Optional background context for summarization.`}},required:[`text`]}},be={name:`write_text`,description:`Generate or draft text using Web Platform's Writer API (or polyfill fallback).`,input_schema:{type:`object`,properties:{prompt:{type:`string`,description:`The prompt or writing instructions.`},context:{type:`string`,description:`Optional background context for writing.`}},required:[`prompt`]}},xe={name:`rewrite_text`,description:`Rewrite or rephrase text using Web Platform's Rewriter API (or polyfill fallback). Can adjust tone or length.`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to rewrite.`},tone:{type:`string`,enum:[`as-is`,`more-formal`,`more-casual`],description:`Tone adjustment (default: as-is).`},length:{type:`string`,enum:[`as-is`,`shorter`,`longer`],description:`Length adjustment (default: as-is).`},context:{type:`string`,description:`Optional background context for rewriting.`}},required:[`text`]}},Se={name:`proofread_text`,description:`Proofread and correct grammar, spelling, and phrasing errors using Web Platform's Proofreader API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to proofread.`},context:{type:`string`,description:`Optional background context for proofreading.`}},required:[`text`]}},Ce={name:`detect_language`,description:`Detect the language of input text using Web Platform's Language Detector API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to analyze for language detection.`}},required:[`text`]}},we={name:`translate_text`,description:`Translate text using Web Platform's Translator API (or polyfill fallback).`,input_schema:{type:`object`,properties:{text:{type:`string`,description:`The text to translate.`},sourceLanguage:{type:`string`,description:`Source language BCP 47 code (e.g. 'en', 'es', 'ja').`},targetLanguage:{type:`string`,description:`Target language BCP 47 code (e.g. 'en', 'es', 'ja').`}},required:[`text`,`sourceLanguage`,`targetLanguage`]}};var Te=e({TOOL_DEFINITIONS:()=>$});const $=[ee,C,t,n,w,T,he,ce,E,de,Ce,D,pe,i,a,fe,s,o,S,I,L,R,z,B,V,te,H,U,W,G,K,q,J,Y,X,Z,Q,ne,re,ie,ae,oe,se,ge,l,_e,y,O,ve,le,p,r,f,k,A,j,Se,M,d,u,b,xe,me,N,P,g,h,x,ye,we,m,ue,c,F,be];export{v as i,Te as n,_ as r,$ as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./config-CrHchneq.js";import{t as r}from"./getConfig-D89uJgo5.js";import{t as i}from"./dist-B9m1QM9v.js";import{t as a}from"./getGroupDir-P1h9wl6S.js";import{t as o}from"./setConfig-DFMYnYLE.js";import{t as s}from"./tools-C8x3nmo4.js";import"./tools-COduyYJ0.js";function c(e){let t=e.replace(/\\/g,`/`).replace(/^\/home\/user\//,`/`).replace(/^\/+/,``).split(`/`).filter(Boolean);if(t.length===0)throw Error(`Empty file path`);return{dirs:t,filename:t.pop()||``}}async function l(e,t,n){let r=await a(e,t),{dirs:i,filename:o}=c(n),s=r;for(let e of i)s=await s.getDirectoryHandle(e);let l=await s.getFileHandle(o);try{let e=await l.createSyncAccessHandle(),t=e.getSize(),n=new Uint8Array(t);return e.read(n,{at:0}),e.close(),new TextDecoder(`utf-8`).decode(n)}catch{return(await l.getFile()).text()}}const u={id:`__builtin_default`,name:`Default`,providerId:`prompt_api`,enabledToolNames:[`javascript`,`list_files`,`open_file`,`read_file`,`write_file`],customTools:[],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."},d=/^[a-z][a-z0-9_]{0,63}$/;function f(e,t){if(!t||typeof t!=`object`)throw Error(`Tool at ${e} must be a JSON object`);let n=t,r=typeof n.name==`string`?n.name.trim():``,i=typeof n.description==`string`?n.description.trim():``,a=n.input_schema??n.parameters,o=n.execution??n.evaluation;if(!d.test(r))throw Error(`Tool name is invalid: ${r||`(missing)`}`);if(!i)throw Error(`Tool ${r} requires a description`);if(!a||typeof a!=`object`)throw Error(`Tool ${r} requires input_schema`);if(!o||typeof o!=`object`)throw Error(`Tool ${r} requires execution`);let s=o,c=s.type;if(c!==`bash`&&c!==`javascript`&&c!==`tool`)throw Error(`Tool ${r} execution type must be bash, javascript, or tool`);if(c===`tool`){if(typeof s.name!=`string`||!d.test(s.name))throw Error(`Tool ${r} execution requires a valid tool name`);return{name:r,description:i,input_schema:a,execution:{type:c,name:s.name,...s.input&&typeof s.input==`object`?{input:s.input}:{}},path:e}}let l=c===`bash`?`command`:`code`,u=s[l]??s.expression;if(typeof u!=`string`||u.trim()===``)throw Error(`Tool ${r} execution requires ${l}`);return{name:r,description:i,input_schema:a,execution:{type:c,[l]:u},path:e}}async function p(e,n=t){let r=[],i=[],o=n===`br:main`?[t]:[n,t];for(let t of o)try{let n=await a(e,t),o=[];async function s(e,t){for await(let[n,r]of e.entries()){let e=`${t}/${n}`;r.kind===`directory`?await s(r,e):n.endsWith(`.json`)&&e.startsWith(`.agents/tools/`)&&o.push(e)}}try{await s(await(await n.getDirectoryHandle(`.agents`)).getDirectoryHandle(`tools`),`.agents/tools`)}catch{continue}for(let n of o.sort())try{let i=f(n,JSON.parse(await l(e,t,n)));r.some(e=>e.name===i.name)||r.push(i)}catch(e){i.push(e instanceof Error?e.message:String(e))}}catch{}return{tools:r,diagnostics:i}}async function m(e,i=t,a){try{let{tools:t}=await p(e,i),o=t.find(e=>e.name===a)||null;if(!o)return null;let s=await r(e,n.DECLARATIVE_TOOLS_ENABLED);return Array.isArray(s)&&!s.includes(a)?null:o}catch{return null}}var h=e({ToolsStore:()=>g,toolsStore:()=>_}),g=class{_activeProfile;_activeProfileId;_allTools;_customTools;_declarativeTools;_declarativeToolNamesEnabled;_enabledDeclarativeTools;_enabledToolNames;_enabledTools;_profiles;_systemPromptOverride;_webSearchProxyUrl;_webSearchUrl;_webSearchUseProxy;_searchFilesMaxFileBytes;_searchFilesMaxFilesVisited;_searchFilesSkipDirs;constructor(){this._enabledToolNames=new i.State(new Set(u.enabledToolNames)),this._customTools=new i.State([]),this._declarativeTools=new i.State([]),this._declarativeToolNamesEnabled=new i.State(null),this._systemPromptOverride=new i.State(``),this._profiles=new i.State([]),this._activeProfileId=new i.State(u.id),this._webSearchUseProxy=new i.State(!1),this._webSearchProxyUrl=new i.State(`/proxy`),this._webSearchUrl=new i.State(`https://html.duckduckgo.com/html/?q={query}`),this._searchFilesMaxFileBytes=new i.State(512*1024),this._searchFilesMaxFilesVisited=new i.State(1e3),this._searchFilesSkipDirs=new i.State(`.git,node_modules,dist,dist-electron,.cache,.nx,.turbo,__pycache__,.venv,venv`),this._allTools=new i.Computed(()=>[...s,...this._customTools.get()]),this._enabledTools=new i.Computed(()=>{let e=this._enabledToolNames.get();return this._allTools.get().filter(t=>e.has(t.name))}),this._enabledDeclarativeTools=new i.Computed(()=>{let e=this._declarativeTools.get(),t=this._declarativeToolNamesEnabled.get();return t===null?e:e.filter(e=>t.has(e.name))}),this._activeProfile=new i.Computed(()=>{let e=this._activeProfileId.get();return e?u.id===e?u:this._profiles.get().find(t=>t.id===e)||null:null})}get activeProfile(){return this._activeProfile.get()}get activeProfileId(){return this._activeProfileId.get()}get allTools(){return this._allTools.get()}get customTools(){return this._customTools.get()}get declarativeTools(){return this._declarativeTools.get()}get declarativeToolNamesEnabled(){return this._declarativeToolNamesEnabled.get()}get enabledDeclarativeTools(){return this._enabledDeclarativeTools.get()}get enabledToolNames(){return this._enabledToolNames.get()}get enabledTools(){return this._enabledTools.get()}isDeclarativeToolEnabled(e){let t=this._declarativeToolNamesEnabled.get();return t===null||t.has(e)}async refreshDeclarativeTools(e,t){try{let n=await p(e,t||`br:main`),r=this.allTools,i=(n?.tools||[]).filter(e=>!r.some(t=>t.name===e.name)),a=this._declarativeTools.get();return a.length===i.length&&a.every((e,t)=>e.name===i[t].name&&e.description===i[t].description&&JSON.stringify(e.execution)===JSON.stringify(i[t].execution))||this._declarativeTools.set(i),i}catch{return this._declarativeTools.get().length>0&&this._declarativeTools.set([]),[]}}async setDeclarativeToolEnabled(e,t,r){let i=this._declarativeToolNamesEnabled.get(),a=this._declarativeTools.get(),s=new Set(i===null?a.map(e=>e.name):i);r?s.add(t):s.delete(t),this._declarativeToolNamesEnabled.set(s),await o(e,n.DECLARATIVE_TOOLS_ENABLED,Array.from(s))}async setAllDeclarativeEnabled(e,t){let r=new Set(t);this._declarativeToolNamesEnabled.set(r),await o(e,n.DECLARATIVE_TOOLS_ENABLED,t)}exportBackup(){return JSON.stringify({enabledTools:[...this._enabledToolNames.get()],customTools:this._customTools.get(),declarativeToolsEnabled:this._declarativeToolNamesEnabled.get()?Array.from(this._declarativeToolNamesEnabled.get()):null,systemPromptOverride:this._systemPromptOverride.get(),profiles:this._profiles.get(),activeProfileId:this._activeProfileId.get(),webSearchUseProxy:this._webSearchUseProxy.get(),webSearchProxyUrl:this._webSearchProxyUrl.get(),webSearchUrl:this._webSearchUrl.get(),searchFilesMaxFileBytes:this._searchFilesMaxFileBytes.get(),searchFilesMaxFilesVisited:this._searchFilesMaxFilesVisited.get(),searchFilesSkipDirs:this._searchFilesSkipDirs.get()},null,2)}findProfilesForProvider(e,t){return this.profiles.filter(n=>!(n.providerId&&n.providerId!==e||n.model&&n.model!==t))}get profiles(){return[u,...this._profiles.get()]}get systemPromptOverride(){return this._systemPromptOverride.get()}get webSearchProxyUrl(){return this._webSearchProxyUrl.get()}get webSearchUrl(){return this._webSearchUrl.get()}get webSearchUseProxy(){return this._webSearchUseProxy.get()}get searchFilesMaxFileBytes(){return this._searchFilesMaxFileBytes.get()}get searchFilesMaxFilesVisited(){return this._searchFilesMaxFilesVisited.get()}get searchFilesSkipDirs(){return this._searchFilesSkipDirs.get()}get searchFilesSkipDirsSet(){return new Set(this._searchFilesSkipDirs.get().split(`,`).map(e=>e.trim()).filter(Boolean))}async activateProfile(e,t){let r=this.profiles.find(e=>e.id===t);r&&(this._activeProfileId.set(t),this._enabledToolNames.set(new Set(r.enabledToolNames)),this._customTools.set(r.customTools),this._systemPromptOverride.set(r.systemPromptOverride||``),await Promise.all([o(e,n.ACTIVE_TOOL_PROFILE,t),o(e,n.ENABLED_TOOLS,r.enabledToolNames),o(e,n.CUSTOM_TOOLS,r.customTools),o(e,n.SYSTEM_PROMPT_OVERRIDE,r.systemPromptOverride||``)]))}async addCustomTool(e,t){let r=[...this._customTools.get(),t];this._customTools.set(r);let i=new Set(this._enabledToolNames.get());i.add(t.name),this._enabledToolNames.set(i),await Promise.all([o(e,n.CUSTOM_TOOLS,r),o(e,n.ENABLED_TOOLS,[...i])])}async addProfile(e,t){let r=[...this._profiles.get(),t];this._profiles.set(r),await o(e,n.TOOL_PROFILES,r)}async cloneTool(e,t,n,r){let i=this.allTools.find(e=>e.name===t);if(!i||this.allTools.some(e=>e.name===n))return!1;let a={name:n,description:r||i.description,input_schema:JSON.parse(JSON.stringify(i.input_schema))};return await this.addCustomTool(e,a),!0}async deactivateProfile(e){this._activeProfileId.set(null),await o(e,n.ACTIVE_TOOL_PROFILE,null)}async deleteProfile(e,t){if(t===u.id)return;let r=this._profiles.get().filter(e=>e.id!==t);this._profiles.set(r),this._activeProfileId.get()===t&&(this._activeProfileId.set(null),await o(e,n.ACTIVE_TOOL_PROFILE,null)),await o(e,n.TOOL_PROFILES,r)}async importBackup(e,t){let r=JSON.parse(t);Array.isArray(r.enabledTools)&&(this._enabledToolNames.set(new Set(r.enabledTools)),await o(e,n.ENABLED_TOOLS,r.enabledTools)),Array.isArray(r.customTools)&&(this._customTools.set(r.customTools),await o(e,n.CUSTOM_TOOLS,r.customTools)),typeof r.systemPromptOverride==`string`&&(this._systemPromptOverride.set(r.systemPromptOverride),await o(e,n.SYSTEM_PROMPT_OVERRIDE,r.systemPromptOverride)),Array.isArray(r.profiles)&&(this._profiles.set(r.profiles),await o(e,n.TOOL_PROFILES,r.profiles)),(typeof r.activeProfileId==`string`||r.activeProfileId===null)&&(this._activeProfileId.set(r.activeProfileId),await o(e,n.ACTIVE_TOOL_PROFILE,r.activeProfileId)),typeof r.webSearchUseProxy==`boolean`&&(this._webSearchUseProxy.set(r.webSearchUseProxy),await o(e,n.WEB_SEARCH_USE_PROXY,r.webSearchUseProxy?`true`:`false`)),typeof r.webSearchProxyUrl==`string`&&(this._webSearchProxyUrl.set(r.webSearchProxyUrl),await o(e,n.WEB_SEARCH_PROXY_URL,r.webSearchProxyUrl)),typeof r.webSearchUrl==`string`&&(this._webSearchUrl.set(r.webSearchUrl),await o(e,n.WEB_SEARCH_URL,r.webSearchUrl)),typeof r.searchFilesMaxFileBytes==`number`&&r.searchFilesMaxFileBytes>0&&(this._searchFilesMaxFileBytes.set(r.searchFilesMaxFileBytes),await o(e,n.SEARCH_FILES_MAX_FILE_BYTES,String(r.searchFilesMaxFileBytes))),typeof r.searchFilesMaxFilesVisited==`number`&&r.searchFilesMaxFilesVisited>0&&(this._searchFilesMaxFilesVisited.set(r.searchFilesMaxFilesVisited),await o(e,n.SEARCH_FILES_MAX_FILES_VISITED,String(r.searchFilesMaxFilesVisited))),typeof r.searchFilesSkipDirs==`string`&&(this._searchFilesSkipDirs.set(r.searchFilesSkipDirs),await o(e,n.SEARCH_FILES_SKIP_DIRS,r.searchFilesSkipDirs)),Array.isArray(r.declarativeToolsEnabled)?(this._declarativeToolNamesEnabled.set(new Set(r.declarativeToolsEnabled)),await o(e,n.DECLARATIVE_TOOLS_ENABLED,r.declarativeToolsEnabled)):r.declarativeToolsEnabled===null&&(this._declarativeToolNamesEnabled.set(null),await o(e,n.DECLARATIVE_TOOLS_ENABLED,null))}async load(e){let[t,i,a,o,s,c,l,u,d,f,p,m]=await Promise.all([r(e,n.ENABLED_TOOLS),r(e,n.CUSTOM_TOOLS),r(e,n.SYSTEM_PROMPT_OVERRIDE),r(e,n.TOOL_PROFILES),r(e,n.ACTIVE_TOOL_PROFILE),r(e,n.WEB_SEARCH_USE_PROXY),r(e,n.WEB_SEARCH_PROXY_URL),r(e,n.WEB_SEARCH_URL),r(e,n.SEARCH_FILES_MAX_FILE_BYTES),r(e,n.SEARCH_FILES_MAX_FILES_VISITED),r(e,n.SEARCH_FILES_SKIP_DIRS),r(e,n.DECLARATIVE_TOOLS_ENABLED)]);if(Array.isArray(t)&&this._enabledToolNames.set(new Set(t)),Array.isArray(i)&&this._customTools.set(i),Array.isArray(m)&&this._declarativeToolNamesEnabled.set(new Set(m)),typeof a==`string`&&this._systemPromptOverride.set(a),Array.isArray(o)&&this._profiles.set(o),typeof s==`string`&&this._activeProfileId.set(s),c!=null){let e=String(c).toLowerCase();this._webSearchUseProxy.set(e===`true`||e===`1`)}if(typeof l==`string`&&l.trim().length>0&&this._webSearchProxyUrl.set(l.trim()),typeof u==`string`&&u.trim().length>0&&this._webSearchUrl.set(u.trim()),d!=null){let e=Number(d);Number.isFinite(e)&&e>0&&this._searchFilesMaxFileBytes.set(e)}if(f!=null){let e=Number(f);Number.isFinite(e)&&e>0&&this._searchFilesMaxFilesVisited.set(e)}typeof p==`string`&&p.trim().length>0&&this._searchFilesSkipDirs.set(p.trim())}async setWebSearchProxyUrl(e,t){let r=t.trim()||`/proxy`;this._webSearchProxyUrl.set(r),await o(e,n.WEB_SEARCH_PROXY_URL,r)}async setWebSearchUrl(e,t){let r=t.trim()||`https://html.duckduckgo.com/html/?q={query}`;this._webSearchUrl.set(r),await o(e,n.WEB_SEARCH_URL,r)}async setWebSearchUseProxy(e,t){let r=!!t;this._webSearchUseProxy.set(r),await o(e,n.WEB_SEARCH_USE_PROXY,r?`true`:`false`)}async setSearchFilesMaxFileBytes(e,t){let r=Math.max(1,Math.round(t));this._searchFilesMaxFileBytes.set(r),await o(e,n.SEARCH_FILES_MAX_FILE_BYTES,String(r))}async setSearchFilesMaxFilesVisited(e,t){let r=Math.max(1,Math.round(t));this._searchFilesMaxFilesVisited.set(r),await o(e,n.SEARCH_FILES_MAX_FILES_VISITED,String(r))}async setSearchFilesSkipDirs(e,t){let r=t.trim();this._searchFilesSkipDirs.set(r),await o(e,n.SEARCH_FILES_SKIP_DIRS,r)}async removeCustomTool(e,t){let r=this._customTools.get().filter(e=>e.name!==t);this._customTools.set(r);let i=new Set(this._enabledToolNames.get());i.delete(t),this._enabledToolNames.set(i),await Promise.all([o(e,n.CUSTOM_TOOLS,r),o(e,n.ENABLED_TOOLS,[...i])])}async saveToActiveProfile(e){let t=this._activeProfileId.get();if(!t)return;let n=this._profiles.get().find(e=>e.id===t);if(!n)return;let r={...n,enabledToolNames:[...this._enabledToolNames.get()],customTools:[...this._customTools.get()],systemPromptOverride:this._systemPromptOverride.get()};await this.updateProfile(e,r)}async setAllEnabled(e,t){this._enabledToolNames.set(new Set(t));let r=[o(e,n.ENABLED_TOOLS,t)];this._activeProfileId.get()&&(this._activeProfileId.set(null),r.push(o(e,n.ACTIVE_TOOL_PROFILE,null))),await Promise.all(r)}async setSystemPromptOverride(e,t){this._systemPromptOverride.set(t),await o(e,n.SYSTEM_PROMPT_OVERRIDE,t)}async setToolEnabled(e,t,r){let i=new Set(this._enabledToolNames.get());r?i.add(t):i.delete(t),this._enabledToolNames.set(i);let a=[o(e,n.ENABLED_TOOLS,[...i])];this._activeProfileId.get()&&(this._activeProfileId.set(null),a.push(o(e,n.ACTIVE_TOOL_PROFILE,null))),await Promise.all(a)}async updateProfile(e,t){let r=this._profiles.get().map(e=>e.id===t.id?t:e);this._profiles.set(r),await o(e,n.TOOL_PROFILES,r)}};const _=new g;export{u as a,p as i,h as n,l as o,m as r,c as s,_ as t};
1
+ import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,r as n}from"./config-Bnwx4EfS.js";import{t as r}from"./getConfig-D89uJgo5.js";import{t as i}from"./dist-B9m1QM9v.js";import{t as a}from"./getGroupDir-BwprrdrQ.js";import{t as o}from"./setConfig-DFMYnYLE.js";import{t as s}from"./tools-CcgG5XuA.js";import"./tools-B-PzsLc2.js";function c(e){let t=e.replace(/\\/g,`/`).replace(/^\/home\/user\//,`/`).replace(/^\/+/,``).split(`/`).filter(Boolean);if(t.length===0)throw Error(`Empty file path`);return{dirs:t,filename:t.pop()||``}}async function l(e,t,n){let r=await a(e,t),{dirs:i,filename:o}=c(n),s=r;for(let e of i)s=await s.getDirectoryHandle(e);let l=await s.getFileHandle(o);try{let e=await l.createSyncAccessHandle(),t=e.getSize(),n=new Uint8Array(t);return e.read(n,{at:0}),e.close(),new TextDecoder(`utf-8`).decode(n)}catch{return(await l.getFile()).text()}}const u={id:`__builtin_default`,name:`Default`,providerId:`prompt_api`,enabledToolNames:[`javascript`,`list_files`,`open_file`,`read_file`,`write_file`],customTools:[],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."},d=/^[a-z][a-z0-9_]{0,63}$/;function f(e,t){if(!t||typeof t!=`object`)throw Error(`Tool at ${e} must be a JSON object`);let n=t,r=typeof n.name==`string`?n.name.trim():``,i=typeof n.description==`string`?n.description.trim():``,a=n.input_schema??n.parameters,o=n.execution??n.evaluation;if(!d.test(r))throw Error(`Tool name is invalid: ${r||`(missing)`}`);if(!i)throw Error(`Tool ${r} requires a description`);if(!a||typeof a!=`object`)throw Error(`Tool ${r} requires input_schema`);if(!o||typeof o!=`object`)throw Error(`Tool ${r} requires execution`);let s=o,c=s.type;if(c!==`bash`&&c!==`javascript`&&c!==`tool`)throw Error(`Tool ${r} execution type must be bash, javascript, or tool`);if(c===`tool`){if(typeof s.name!=`string`||!d.test(s.name))throw Error(`Tool ${r} execution requires a valid tool name`);return{name:r,description:i,input_schema:a,execution:{type:c,name:s.name,...s.input&&typeof s.input==`object`?{input:s.input}:{}},path:e}}let l=c===`bash`?`command`:`code`,u=s[l]??s.expression;if(typeof u!=`string`||u.trim()===``)throw Error(`Tool ${r} execution requires ${l}`);return{name:r,description:i,input_schema:a,execution:{type:c,[l]:u},path:e}}async function p(e,n=t){let r=[],i=[],o=n===`br:main`?[t]:[n,t];for(let t of o)try{let n=await a(e,t),o=[];async function s(e,t){for await(let[n,r]of e.entries()){let e=`${t}/${n}`;r.kind===`directory`?await s(r,e):n.endsWith(`.json`)&&e.startsWith(`.agents/tools/`)&&o.push(e)}}try{await s(await(await n.getDirectoryHandle(`.agents`)).getDirectoryHandle(`tools`),`.agents/tools`)}catch{continue}for(let n of o.sort())try{let i=f(n,JSON.parse(await l(e,t,n)));r.some(e=>e.name===i.name)||r.push(i)}catch(e){i.push(e instanceof Error?e.message:String(e))}}catch{}return{tools:r,diagnostics:i}}async function m(e,i=t,a){try{let{tools:t}=await p(e,i),o=t.find(e=>e.name===a)||null;if(!o)return null;let s=await r(e,n.DECLARATIVE_TOOLS_ENABLED);return Array.isArray(s)&&!s.includes(a)?null:o}catch{return null}}var h=e({ToolsStore:()=>g,toolsStore:()=>_}),g=class{_activeProfile;_activeProfileId;_allTools;_customTools;_declarativeTools;_declarativeToolNamesEnabled;_enabledDeclarativeTools;_enabledToolNames;_enabledTools;_profiles;_systemPromptOverride;_webSearchProxyUrl;_webSearchUrl;_webSearchUseProxy;_searchFilesMaxFileBytes;_searchFilesMaxFilesVisited;_searchFilesSkipDirs;constructor(){this._enabledToolNames=new i.State(new Set(u.enabledToolNames)),this._customTools=new i.State([]),this._declarativeTools=new i.State([]),this._declarativeToolNamesEnabled=new i.State(null),this._systemPromptOverride=new i.State(``),this._profiles=new i.State([]),this._activeProfileId=new i.State(u.id),this._webSearchUseProxy=new i.State(!1),this._webSearchProxyUrl=new i.State(`/proxy`),this._webSearchUrl=new i.State(`https://html.duckduckgo.com/html/?q={query}`),this._searchFilesMaxFileBytes=new i.State(512*1024),this._searchFilesMaxFilesVisited=new i.State(1e3),this._searchFilesSkipDirs=new i.State(`.git,node_modules,dist,dist-electron,.cache,.nx,.turbo,__pycache__,.venv,venv`),this._allTools=new i.Computed(()=>[...s,...this._customTools.get()]),this._enabledTools=new i.Computed(()=>{let e=this._enabledToolNames.get();return this._allTools.get().filter(t=>e.has(t.name))}),this._enabledDeclarativeTools=new i.Computed(()=>{let e=this._declarativeTools.get(),t=this._declarativeToolNamesEnabled.get();return t===null?e:e.filter(e=>t.has(e.name))}),this._activeProfile=new i.Computed(()=>{let e=this._activeProfileId.get();return e?u.id===e?u:this._profiles.get().find(t=>t.id===e)||null:null})}get activeProfile(){return this._activeProfile.get()}get activeProfileId(){return this._activeProfileId.get()}get allTools(){return this._allTools.get()}get customTools(){return this._customTools.get()}get declarativeTools(){return this._declarativeTools.get()}get declarativeToolNamesEnabled(){return this._declarativeToolNamesEnabled.get()}get enabledDeclarativeTools(){return this._enabledDeclarativeTools.get()}get enabledToolNames(){return this._enabledToolNames.get()}get enabledTools(){return this._enabledTools.get()}isDeclarativeToolEnabled(e){let t=this._declarativeToolNamesEnabled.get();return t===null||t.has(e)}async refreshDeclarativeTools(e,t){try{let n=await p(e,t||`br:main`),r=this.allTools,i=(n?.tools||[]).filter(e=>!r.some(t=>t.name===e.name)),a=this._declarativeTools.get();return a.length===i.length&&a.every((e,t)=>e.name===i[t].name&&e.description===i[t].description&&JSON.stringify(e.execution)===JSON.stringify(i[t].execution))||this._declarativeTools.set(i),i}catch{return this._declarativeTools.get().length>0&&this._declarativeTools.set([]),[]}}async setDeclarativeToolEnabled(e,t,r){let i=this._declarativeToolNamesEnabled.get(),a=this._declarativeTools.get(),s=new Set(i===null?a.map(e=>e.name):i);r?s.add(t):s.delete(t),this._declarativeToolNamesEnabled.set(s),await o(e,n.DECLARATIVE_TOOLS_ENABLED,Array.from(s))}async setAllDeclarativeEnabled(e,t){let r=new Set(t);this._declarativeToolNamesEnabled.set(r),await o(e,n.DECLARATIVE_TOOLS_ENABLED,t)}exportBackup(){return JSON.stringify({enabledTools:[...this._enabledToolNames.get()],customTools:this._customTools.get(),declarativeToolsEnabled:this._declarativeToolNamesEnabled.get()?Array.from(this._declarativeToolNamesEnabled.get()):null,systemPromptOverride:this._systemPromptOverride.get(),profiles:this._profiles.get(),activeProfileId:this._activeProfileId.get(),webSearchUseProxy:this._webSearchUseProxy.get(),webSearchProxyUrl:this._webSearchProxyUrl.get(),webSearchUrl:this._webSearchUrl.get(),searchFilesMaxFileBytes:this._searchFilesMaxFileBytes.get(),searchFilesMaxFilesVisited:this._searchFilesMaxFilesVisited.get(),searchFilesSkipDirs:this._searchFilesSkipDirs.get()},null,2)}findProfilesForProvider(e,t){return this.profiles.filter(n=>!(n.providerId&&n.providerId!==e||n.model&&n.model!==t))}get profiles(){return[u,...this._profiles.get()]}get systemPromptOverride(){return this._systemPromptOverride.get()}get webSearchProxyUrl(){return this._webSearchProxyUrl.get()}get webSearchUrl(){return this._webSearchUrl.get()}get webSearchUseProxy(){return this._webSearchUseProxy.get()}get searchFilesMaxFileBytes(){return this._searchFilesMaxFileBytes.get()}get searchFilesMaxFilesVisited(){return this._searchFilesMaxFilesVisited.get()}get searchFilesSkipDirs(){return this._searchFilesSkipDirs.get()}get searchFilesSkipDirsSet(){return new Set(this._searchFilesSkipDirs.get().split(`,`).map(e=>e.trim()).filter(Boolean))}async activateProfile(e,t){let r=this.profiles.find(e=>e.id===t);r&&(this._activeProfileId.set(t),this._enabledToolNames.set(new Set(r.enabledToolNames)),this._customTools.set(r.customTools),this._systemPromptOverride.set(r.systemPromptOverride||``),await Promise.all([o(e,n.ACTIVE_TOOL_PROFILE,t),o(e,n.ENABLED_TOOLS,r.enabledToolNames),o(e,n.CUSTOM_TOOLS,r.customTools),o(e,n.SYSTEM_PROMPT_OVERRIDE,r.systemPromptOverride||``)]))}async addCustomTool(e,t){let r=[...this._customTools.get(),t];this._customTools.set(r);let i=new Set(this._enabledToolNames.get());i.add(t.name),this._enabledToolNames.set(i),await Promise.all([o(e,n.CUSTOM_TOOLS,r),o(e,n.ENABLED_TOOLS,[...i])])}async addProfile(e,t){let r=[...this._profiles.get(),t];this._profiles.set(r),await o(e,n.TOOL_PROFILES,r)}async cloneTool(e,t,n,r){let i=this.allTools.find(e=>e.name===t);if(!i||this.allTools.some(e=>e.name===n))return!1;let a={name:n,description:r||i.description,input_schema:JSON.parse(JSON.stringify(i.input_schema))};return await this.addCustomTool(e,a),!0}async deactivateProfile(e){this._activeProfileId.set(null),await o(e,n.ACTIVE_TOOL_PROFILE,null)}async deleteProfile(e,t){if(t===u.id)return;let r=this._profiles.get().filter(e=>e.id!==t);this._profiles.set(r),this._activeProfileId.get()===t&&(this._activeProfileId.set(null),await o(e,n.ACTIVE_TOOL_PROFILE,null)),await o(e,n.TOOL_PROFILES,r)}async importBackup(e,t){let r=JSON.parse(t);Array.isArray(r.enabledTools)&&(this._enabledToolNames.set(new Set(r.enabledTools)),await o(e,n.ENABLED_TOOLS,r.enabledTools)),Array.isArray(r.customTools)&&(this._customTools.set(r.customTools),await o(e,n.CUSTOM_TOOLS,r.customTools)),typeof r.systemPromptOverride==`string`&&(this._systemPromptOverride.set(r.systemPromptOverride),await o(e,n.SYSTEM_PROMPT_OVERRIDE,r.systemPromptOverride)),Array.isArray(r.profiles)&&(this._profiles.set(r.profiles),await o(e,n.TOOL_PROFILES,r.profiles)),(typeof r.activeProfileId==`string`||r.activeProfileId===null)&&(this._activeProfileId.set(r.activeProfileId),await o(e,n.ACTIVE_TOOL_PROFILE,r.activeProfileId)),typeof r.webSearchUseProxy==`boolean`&&(this._webSearchUseProxy.set(r.webSearchUseProxy),await o(e,n.WEB_SEARCH_USE_PROXY,r.webSearchUseProxy?`true`:`false`)),typeof r.webSearchProxyUrl==`string`&&(this._webSearchProxyUrl.set(r.webSearchProxyUrl),await o(e,n.WEB_SEARCH_PROXY_URL,r.webSearchProxyUrl)),typeof r.webSearchUrl==`string`&&(this._webSearchUrl.set(r.webSearchUrl),await o(e,n.WEB_SEARCH_URL,r.webSearchUrl)),typeof r.searchFilesMaxFileBytes==`number`&&r.searchFilesMaxFileBytes>0&&(this._searchFilesMaxFileBytes.set(r.searchFilesMaxFileBytes),await o(e,n.SEARCH_FILES_MAX_FILE_BYTES,String(r.searchFilesMaxFileBytes))),typeof r.searchFilesMaxFilesVisited==`number`&&r.searchFilesMaxFilesVisited>0&&(this._searchFilesMaxFilesVisited.set(r.searchFilesMaxFilesVisited),await o(e,n.SEARCH_FILES_MAX_FILES_VISITED,String(r.searchFilesMaxFilesVisited))),typeof r.searchFilesSkipDirs==`string`&&(this._searchFilesSkipDirs.set(r.searchFilesSkipDirs),await o(e,n.SEARCH_FILES_SKIP_DIRS,r.searchFilesSkipDirs)),Array.isArray(r.declarativeToolsEnabled)?(this._declarativeToolNamesEnabled.set(new Set(r.declarativeToolsEnabled)),await o(e,n.DECLARATIVE_TOOLS_ENABLED,r.declarativeToolsEnabled)):r.declarativeToolsEnabled===null&&(this._declarativeToolNamesEnabled.set(null),await o(e,n.DECLARATIVE_TOOLS_ENABLED,null))}async load(e){let[t,i,a,o,s,c,l,u,d,f,p,m]=await Promise.all([r(e,n.ENABLED_TOOLS),r(e,n.CUSTOM_TOOLS),r(e,n.SYSTEM_PROMPT_OVERRIDE),r(e,n.TOOL_PROFILES),r(e,n.ACTIVE_TOOL_PROFILE),r(e,n.WEB_SEARCH_USE_PROXY),r(e,n.WEB_SEARCH_PROXY_URL),r(e,n.WEB_SEARCH_URL),r(e,n.SEARCH_FILES_MAX_FILE_BYTES),r(e,n.SEARCH_FILES_MAX_FILES_VISITED),r(e,n.SEARCH_FILES_SKIP_DIRS),r(e,n.DECLARATIVE_TOOLS_ENABLED)]);if(Array.isArray(t)&&this._enabledToolNames.set(new Set(t)),Array.isArray(i)&&this._customTools.set(i),Array.isArray(m)&&this._declarativeToolNamesEnabled.set(new Set(m)),typeof a==`string`&&this._systemPromptOverride.set(a),Array.isArray(o)&&this._profiles.set(o),typeof s==`string`&&this._activeProfileId.set(s),c!=null){let e=String(c).toLowerCase();this._webSearchUseProxy.set(e===`true`||e===`1`)}if(typeof l==`string`&&l.trim().length>0&&this._webSearchProxyUrl.set(l.trim()),typeof u==`string`&&u.trim().length>0&&this._webSearchUrl.set(u.trim()),d!=null){let e=Number(d);Number.isFinite(e)&&e>0&&this._searchFilesMaxFileBytes.set(e)}if(f!=null){let e=Number(f);Number.isFinite(e)&&e>0&&this._searchFilesMaxFilesVisited.set(e)}typeof p==`string`&&p.trim().length>0&&this._searchFilesSkipDirs.set(p.trim())}async setWebSearchProxyUrl(e,t){let r=t.trim()||`/proxy`;this._webSearchProxyUrl.set(r),await o(e,n.WEB_SEARCH_PROXY_URL,r)}async setWebSearchUrl(e,t){let r=t.trim()||`https://html.duckduckgo.com/html/?q={query}`;this._webSearchUrl.set(r),await o(e,n.WEB_SEARCH_URL,r)}async setWebSearchUseProxy(e,t){let r=!!t;this._webSearchUseProxy.set(r),await o(e,n.WEB_SEARCH_USE_PROXY,r?`true`:`false`)}async setSearchFilesMaxFileBytes(e,t){let r=Math.max(1,Math.round(t));this._searchFilesMaxFileBytes.set(r),await o(e,n.SEARCH_FILES_MAX_FILE_BYTES,String(r))}async setSearchFilesMaxFilesVisited(e,t){let r=Math.max(1,Math.round(t));this._searchFilesMaxFilesVisited.set(r),await o(e,n.SEARCH_FILES_MAX_FILES_VISITED,String(r))}async setSearchFilesSkipDirs(e,t){let r=t.trim();this._searchFilesSkipDirs.set(r),await o(e,n.SEARCH_FILES_SKIP_DIRS,r)}async removeCustomTool(e,t){let r=this._customTools.get().filter(e=>e.name!==t);this._customTools.set(r);let i=new Set(this._enabledToolNames.get());i.delete(t),this._enabledToolNames.set(i),await Promise.all([o(e,n.CUSTOM_TOOLS,r),o(e,n.ENABLED_TOOLS,[...i])])}async saveToActiveProfile(e){let t=this._activeProfileId.get();if(!t)return;let n=this._profiles.get().find(e=>e.id===t);if(!n)return;let r={...n,enabledToolNames:[...this._enabledToolNames.get()],customTools:[...this._customTools.get()],systemPromptOverride:this._systemPromptOverride.get()};await this.updateProfile(e,r)}async setAllEnabled(e,t){this._enabledToolNames.set(new Set(t));let r=[o(e,n.ENABLED_TOOLS,t)];this._activeProfileId.get()&&(this._activeProfileId.set(null),r.push(o(e,n.ACTIVE_TOOL_PROFILE,null))),await Promise.all(r)}async setSystemPromptOverride(e,t){this._systemPromptOverride.set(t),await o(e,n.SYSTEM_PROMPT_OVERRIDE,t)}async setToolEnabled(e,t,r){let i=new Set(this._enabledToolNames.get());r?i.add(t):i.delete(t),this._enabledToolNames.set(i);let a=[o(e,n.ENABLED_TOOLS,[...i])];this._activeProfileId.get()&&(this._activeProfileId.set(null),a.push(o(e,n.ACTIVE_TOOL_PROFILE,null))),await Promise.all(a)}async updateProfile(e,t){let r=this._profiles.get().map(e=>e.id===t.id?t:e);this._profiles.set(r),await o(e,n.TOOL_PROFILES,r)}};const _=new g;export{u as a,p as i,h as n,l as o,m as r,c as s,_ as t};