@adhdev/daemon-core 0.6.57 → 0.6.59

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 (241) hide show
  1. package/dist/index.d.ts +18 -1
  2. package/dist/index.js +339 -167
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/cli-adapters/provider-cli-adapter.ts +223 -48
  6. package/src/commands/chat-commands.ts +7 -1
  7. package/src/config/chat-history.ts +53 -1
  8. package/src/daemon/dev-server.ts +7 -9
  9. package/src/detection/ide-detector.ts +1 -1
  10. package/src/providers/cli-provider-instance.ts +10 -23
  11. package/src/providers/provider-instance.ts +1 -0
  12. package/src/providers/provider-loader.ts +3 -6
  13. package/src/providers/version-archive.ts +4 -1
  14. package/providers/_builtin/.github/workflows/generate-registry.yml +0 -76
  15. package/providers/_builtin/COMPATIBILITY.md +0 -217
  16. package/providers/_builtin/CONTRIBUTING.md +0 -200
  17. package/providers/_builtin/README.md +0 -119
  18. package/providers/_builtin/_helpers/index.js +0 -188
  19. package/providers/_builtin/acp/agentpool/provider.json +0 -54
  20. package/providers/_builtin/acp/amp/provider.json +0 -52
  21. package/providers/_builtin/acp/auggie/provider.json +0 -57
  22. package/providers/_builtin/acp/autodev/provider.json +0 -54
  23. package/providers/_builtin/acp/autohand/provider.json +0 -52
  24. package/providers/_builtin/acp/blackbox-ai/provider.json +0 -54
  25. package/providers/_builtin/acp/claude-agent/provider.json +0 -57
  26. package/providers/_builtin/acp/cline-acp/provider.json +0 -54
  27. package/providers/_builtin/acp/codebuddy/provider.json +0 -54
  28. package/providers/_builtin/acp/codex-cli/provider.json +0 -57
  29. package/providers/_builtin/acp/corust-agent/provider.json +0 -52
  30. package/providers/_builtin/acp/crow-cli/provider.json +0 -54
  31. package/providers/_builtin/acp/cursor-acp/provider.json +0 -54
  32. package/providers/_builtin/acp/deepagents/provider.json +0 -52
  33. package/providers/_builtin/acp/dimcode/provider.json +0 -54
  34. package/providers/_builtin/acp/docker-cagent/provider.json +0 -57
  35. package/providers/_builtin/acp/factory-droid/provider.json +0 -60
  36. package/providers/_builtin/acp/fast-agent/provider.json +0 -52
  37. package/providers/_builtin/acp/gemini-cli/provider.json +0 -114
  38. package/providers/_builtin/acp/github-copilot/provider.json +0 -54
  39. package/providers/_builtin/acp/goose/provider.json +0 -57
  40. package/providers/_builtin/acp/junie/provider.json +0 -52
  41. package/providers/_builtin/acp/kilo/provider.json +0 -54
  42. package/providers/_builtin/acp/kimi-cli/provider.json +0 -57
  43. package/providers/_builtin/acp/minion-code/provider.json +0 -52
  44. package/providers/_builtin/acp/mistral-vibe/provider.json +0 -57
  45. package/providers/_builtin/acp/nova/provider.json +0 -54
  46. package/providers/_builtin/acp/openclaw/provider.json +0 -54
  47. package/providers/_builtin/acp/opencode/provider.json +0 -52
  48. package/providers/_builtin/acp/openhands/provider.json +0 -54
  49. package/providers/_builtin/acp/pi-acp/provider.json +0 -52
  50. package/providers/_builtin/acp/qoder/provider.json +0 -54
  51. package/providers/_builtin/acp/qwen-code/provider.json +0 -60
  52. package/providers/_builtin/acp/stakpak/provider.json +0 -54
  53. package/providers/_builtin/acp/vtcode/provider.json +0 -54
  54. package/providers/_builtin/cli/aider-cli/provider.json +0 -37
  55. package/providers/_builtin/cli/aider-cli/scripts/1.0/detect_status.js +0 -20
  56. package/providers/_builtin/cli/aider-cli/scripts/1.0/parse_approval.js +0 -10
  57. package/providers/_builtin/cli/aider-cli/scripts/1.0/parse_output.js +0 -49
  58. package/providers/_builtin/cli/aider-cli/scripts/1.0/scripts.js +0 -7
  59. package/providers/_builtin/cli/claude-cli/provider.json +0 -109
  60. package/providers/_builtin/cli/claude-cli/scripts/1.0/detect_status.js +0 -31
  61. package/providers/_builtin/cli/claude-cli/scripts/1.0/parse_approval.js +0 -38
  62. package/providers/_builtin/cli/claude-cli/scripts/1.0/parse_output.js +0 -164
  63. package/providers/_builtin/cli/claude-cli/scripts/1.0/scripts.js +0 -42
  64. package/providers/_builtin/cli/codex-cli/provider.json +0 -88
  65. package/providers/_builtin/cli/codex-cli/scripts/1.0/detect_status.js +0 -20
  66. package/providers/_builtin/cli/codex-cli/scripts/1.0/parse_approval.js +0 -15
  67. package/providers/_builtin/cli/codex-cli/scripts/1.0/parse_output.js +0 -68
  68. package/providers/_builtin/cli/codex-cli/scripts/1.0/scripts.js +0 -11
  69. package/providers/_builtin/cli/cursor-cli/provider.json +0 -37
  70. package/providers/_builtin/cli/cursor-cli/scripts/1.0/detect_status.js +0 -19
  71. package/providers/_builtin/cli/cursor-cli/scripts/1.0/parse_approval.js +0 -10
  72. package/providers/_builtin/cli/cursor-cli/scripts/1.0/parse_output.js +0 -48
  73. package/providers/_builtin/cli/cursor-cli/scripts/1.0/scripts.js +0 -7
  74. package/providers/_builtin/cli/gemini-cli/provider.json +0 -109
  75. package/providers/_builtin/cli/gemini-cli/scripts/1.0/detect_status.js +0 -26
  76. package/providers/_builtin/cli/gemini-cli/scripts/1.0/parse_approval.js +0 -22
  77. package/providers/_builtin/cli/gemini-cli/scripts/1.0/parse_output.js +0 -71
  78. package/providers/_builtin/cli/gemini-cli/scripts/1.0/scripts.js +0 -12
  79. package/providers/_builtin/cli/github-copilot-cli/provider.json +0 -37
  80. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/detect_status.js +0 -19
  81. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/parse_approval.js +0 -9
  82. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/parse_output.js +0 -48
  83. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/scripts.js +0 -7
  84. package/providers/_builtin/cli/goose-cli/provider.json +0 -37
  85. package/providers/_builtin/cli/goose-cli/scripts/1.0/detect_status.js +0 -20
  86. package/providers/_builtin/cli/goose-cli/scripts/1.0/parse_approval.js +0 -10
  87. package/providers/_builtin/cli/goose-cli/scripts/1.0/parse_output.js +0 -48
  88. package/providers/_builtin/cli/goose-cli/scripts/1.0/scripts.js +0 -7
  89. package/providers/_builtin/cli/opencode-cli/provider.json +0 -37
  90. package/providers/_builtin/cli/opencode-cli/scripts/1.0/detect_status.js +0 -15
  91. package/providers/_builtin/cli/opencode-cli/scripts/1.0/parse_approval.js +0 -9
  92. package/providers/_builtin/cli/opencode-cli/scripts/1.0/parse_output.js +0 -48
  93. package/providers/_builtin/cli/opencode-cli/scripts/1.0/scripts.js +0 -7
  94. package/providers/_builtin/docs/CDP_SELECTOR_GUIDE.md +0 -370
  95. package/providers/_builtin/docs/PROVIDER_GUIDE.md +0 -916
  96. package/providers/_builtin/extension/cline/provider.json +0 -37
  97. package/providers/_builtin/extension/cline/scripts/1.0/focus_editor.js +0 -48
  98. package/providers/_builtin/extension/cline/scripts/1.0/list_chats.js +0 -100
  99. package/providers/_builtin/extension/cline/scripts/1.0/list_models.js +0 -43
  100. package/providers/_builtin/extension/cline/scripts/1.0/list_modes.js +0 -35
  101. package/providers/_builtin/extension/cline/scripts/1.0/new_session.js +0 -85
  102. package/providers/_builtin/extension/cline/scripts/1.0/open_panel.js +0 -25
  103. package/providers/_builtin/extension/cline/scripts/1.0/read_chat.js +0 -270
  104. package/providers/_builtin/extension/cline/scripts/1.0/resolve_action.js +0 -83
  105. package/providers/_builtin/extension/cline/scripts/1.0/scripts.js +0 -82
  106. package/providers/_builtin/extension/cline/scripts/1.0/send_message.js +0 -95
  107. package/providers/_builtin/extension/cline/scripts/1.0/set_mode.js +0 -36
  108. package/providers/_builtin/extension/cline/scripts/1.0/set_model.js +0 -36
  109. package/providers/_builtin/extension/cline/scripts/1.0/switch_session.js +0 -206
  110. package/providers/_builtin/extension/codex/provider.json +0 -38
  111. package/providers/_builtin/extension/codex/scripts/1.0/click_conversation_webview.js +0 -24
  112. package/providers/_builtin/extension/codex/scripts/1.0/explore_chat_webview.js +0 -110
  113. package/providers/_builtin/extension/codex/scripts/1.0/explore_controls_webview.js +0 -75
  114. package/providers/_builtin/extension/codex/scripts/1.0/explore_dom.js +0 -58
  115. package/providers/_builtin/extension/codex/scripts/1.0/explore_dropdown_webview.js +0 -64
  116. package/providers/_builtin/extension/codex/scripts/1.0/inspect_code_webview.js +0 -55
  117. package/providers/_builtin/extension/codex/scripts/1.0/list_models.js +0 -63
  118. package/providers/_builtin/extension/codex/scripts/1.0/list_modes.js +0 -140
  119. package/providers/_builtin/extension/codex/scripts/1.0/message_structure_webview.js +0 -79
  120. package/providers/_builtin/extension/codex/scripts/1.0/new_session.js +0 -26
  121. package/providers/_builtin/extension/codex/scripts/1.0/read_chat.js +0 -516
  122. package/providers/_builtin/extension/codex/scripts/1.0/resolve_action.js +0 -82
  123. package/providers/_builtin/extension/codex/scripts/1.0/send_message.js +0 -42
  124. package/providers/_builtin/extension/codex/scripts/1.0/set_mode.js +0 -165
  125. package/providers/_builtin/extension/codex/scripts/1.0/set_model.js +0 -86
  126. package/providers/_builtin/extension/roo-code/provider.json +0 -37
  127. package/providers/_builtin/extension/roo-code/scripts/1.0/scripts.js +0 -82
  128. package/providers/_builtin/ide/antigravity/provider.json +0 -88
  129. package/providers/_builtin/ide/antigravity/scripts/1.0/focus_editor.js +0 -20
  130. package/providers/_builtin/ide/antigravity/scripts/1.0/list_chats.js +0 -137
  131. package/providers/_builtin/ide/antigravity/scripts/1.0/list_models.js +0 -61
  132. package/providers/_builtin/ide/antigravity/scripts/1.0/list_modes.js +0 -72
  133. package/providers/_builtin/ide/antigravity/scripts/1.0/new_session.js +0 -75
  134. package/providers/_builtin/ide/antigravity/scripts/1.0/read_chat.js +0 -352
  135. package/providers/_builtin/ide/antigravity/scripts/1.0/resolve_action.js +0 -63
  136. package/providers/_builtin/ide/antigravity/scripts/1.0/scripts.js +0 -67
  137. package/providers/_builtin/ide/antigravity/scripts/1.0/send_message.js +0 -56
  138. package/providers/_builtin/ide/antigravity/scripts/1.0/set_mode.js +0 -67
  139. package/providers/_builtin/ide/antigravity/scripts/1.0/set_model.js +0 -72
  140. package/providers/_builtin/ide/antigravity/scripts/1.0/switch_session.js +0 -114
  141. package/providers/_builtin/ide/cursor/provider.json +0 -70
  142. package/providers/_builtin/ide/cursor/scripts/1.0/dismiss_notification.js +0 -30
  143. package/providers/_builtin/ide/cursor/scripts/1.0/focus_editor.js +0 -13
  144. package/providers/_builtin/ide/cursor/scripts/1.0/list_models.js +0 -78
  145. package/providers/_builtin/ide/cursor/scripts/1.0/list_modes.js +0 -40
  146. package/providers/_builtin/ide/cursor/scripts/1.0/list_notifications.js +0 -23
  147. package/providers/_builtin/ide/cursor/scripts/1.0/list_sessions.js +0 -42
  148. package/providers/_builtin/ide/cursor/scripts/1.0/new_session.js +0 -20
  149. package/providers/_builtin/ide/cursor/scripts/1.0/open_panel.js +0 -23
  150. package/providers/_builtin/ide/cursor/scripts/1.0/read_chat.js +0 -318
  151. package/providers/_builtin/ide/cursor/scripts/1.0/resolve_action.js +0 -19
  152. package/providers/_builtin/ide/cursor/scripts/1.0/scripts.js +0 -78
  153. package/providers/_builtin/ide/cursor/scripts/1.0/send_message.js +0 -23
  154. package/providers/_builtin/ide/cursor/scripts/1.0/set_mode.js +0 -38
  155. package/providers/_builtin/ide/cursor/scripts/1.0/set_model.js +0 -81
  156. package/providers/_builtin/ide/cursor/scripts/1.0/switch_session.js +0 -28
  157. package/providers/_builtin/ide/kiro/provider.json +0 -68
  158. package/providers/_builtin/ide/kiro/scripts/1.0/focus_editor.js +0 -20
  159. package/providers/_builtin/ide/kiro/scripts/1.0/open_panel.js +0 -47
  160. package/providers/_builtin/ide/kiro/scripts/1.0/resolve_action.js +0 -54
  161. package/providers/_builtin/ide/kiro/scripts/1.0/send_message.js +0 -29
  162. package/providers/_builtin/ide/kiro/scripts/1.0/webview_dump_html.js +0 -1
  163. package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_models.js +0 -42
  164. package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_modes.js +0 -22
  165. package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_sessions.js +0 -21
  166. package/providers/_builtin/ide/kiro/scripts/1.0/webview_new_session.js +0 -34
  167. package/providers/_builtin/ide/kiro/scripts/1.0/webview_read_chat.js +0 -161
  168. package/providers/_builtin/ide/kiro/scripts/1.0/webview_resolve_action.js +0 -62
  169. package/providers/_builtin/ide/kiro/scripts/1.0/webview_send_message.js +0 -94
  170. package/providers/_builtin/ide/kiro/scripts/1.0/webview_set_mode.js +0 -34
  171. package/providers/_builtin/ide/kiro/scripts/1.0/webview_set_model.js +0 -47
  172. package/providers/_builtin/ide/kiro/scripts/1.0/webview_switch_session.js +0 -26
  173. package/providers/_builtin/ide/pearai/.tmp/after_rich.json +0 -157
  174. package/providers/_builtin/ide/pearai/.tmp/after_rich_raw.json +0 -161
  175. package/providers/_builtin/ide/pearai/.tmp/after_switch.json +0 -592
  176. package/providers/_builtin/ide/pearai/.tmp/after_switch_raw.json +0 -596
  177. package/providers/_builtin/ide/pearai/.tmp/home_dump_raw.json +0 -176
  178. package/providers/_builtin/ide/pearai/.tmp/items_raw.json +0 -778
  179. package/providers/_builtin/ide/pearai/.tmp/webview_dump.json +0 -157
  180. package/providers/_builtin/ide/pearai/.tmp/webview_dump_raw.json +0 -161
  181. package/providers/_builtin/ide/pearai/provider.json +0 -71
  182. package/providers/_builtin/ide/pearai/scripts/1.0/focus_editor.js +0 -16
  183. package/providers/_builtin/ide/pearai/scripts/1.0/list_models.js +0 -45
  184. package/providers/_builtin/ide/pearai/scripts/1.0/list_modes.js +0 -44
  185. package/providers/_builtin/ide/pearai/scripts/1.0/list_sessions.js +0 -93
  186. package/providers/_builtin/ide/pearai/scripts/1.0/new_session.js +0 -38
  187. package/providers/_builtin/ide/pearai/scripts/1.0/open_panel.js +0 -23
  188. package/providers/_builtin/ide/pearai/scripts/1.0/read_chat.js +0 -169
  189. package/providers/_builtin/ide/pearai/scripts/1.0/resolve_action.js +0 -60
  190. package/providers/_builtin/ide/pearai/scripts/1.0/scripts.js +0 -111
  191. package/providers/_builtin/ide/pearai/scripts/1.0/send_message.js +0 -104
  192. package/providers/_builtin/ide/pearai/scripts/1.0/set_mode.js +0 -51
  193. package/providers/_builtin/ide/pearai/scripts/1.0/set_model.js +0 -54
  194. package/providers/_builtin/ide/pearai/scripts/1.0/switch_session.js +0 -81
  195. package/providers/_builtin/ide/trae/provider.json +0 -72
  196. package/providers/_builtin/ide/trae/scripts/1.0/focus_editor.js +0 -20
  197. package/providers/_builtin/ide/trae/scripts/1.0/list_chats.js +0 -24
  198. package/providers/_builtin/ide/trae/scripts/1.0/list_models.js +0 -39
  199. package/providers/_builtin/ide/trae/scripts/1.0/list_modes.js +0 -39
  200. package/providers/_builtin/ide/trae/scripts/1.0/new_session.js +0 -30
  201. package/providers/_builtin/ide/trae/scripts/1.0/open_panel.js +0 -44
  202. package/providers/_builtin/ide/trae/scripts/1.0/read_chat.js +0 -113
  203. package/providers/_builtin/ide/trae/scripts/1.0/resolve_action.js +0 -54
  204. package/providers/_builtin/ide/trae/scripts/1.0/scripts.js +0 -82
  205. package/providers/_builtin/ide/trae/scripts/1.0/send_message.js +0 -69
  206. package/providers/_builtin/ide/trae/scripts/1.0/set_mode.js +0 -15
  207. package/providers/_builtin/ide/trae/scripts/1.0/set_model.js +0 -15
  208. package/providers/_builtin/ide/trae/scripts/1.0/switch_session.js +0 -23
  209. package/providers/_builtin/ide/vscode/provider.json +0 -70
  210. package/providers/_builtin/ide/vscode-insiders/provider.json +0 -68
  211. package/providers/_builtin/ide/vscodium/provider.json +0 -69
  212. package/providers/_builtin/ide/windsurf/provider.json +0 -57
  213. package/providers/_builtin/ide/windsurf/scripts/1.0/focus_editor.js +0 -36
  214. package/providers/_builtin/ide/windsurf/scripts/1.0/list_chats.js +0 -23
  215. package/providers/_builtin/ide/windsurf/scripts/1.0/list_models.js +0 -56
  216. package/providers/_builtin/ide/windsurf/scripts/1.0/list_modes.js +0 -63
  217. package/providers/_builtin/ide/windsurf/scripts/1.0/list_sessions.js +0 -79
  218. package/providers/_builtin/ide/windsurf/scripts/1.0/new_session.js +0 -58
  219. package/providers/_builtin/ide/windsurf/scripts/1.0/open_panel.js +0 -67
  220. package/providers/_builtin/ide/windsurf/scripts/1.0/read_chat.js +0 -253
  221. package/providers/_builtin/ide/windsurf/scripts/1.0/resolve_action.js +0 -82
  222. package/providers/_builtin/ide/windsurf/scripts/1.0/scripts.js +0 -82
  223. package/providers/_builtin/ide/windsurf/scripts/1.0/send_message.js +0 -20
  224. package/providers/_builtin/ide/windsurf/scripts/1.0/set_mode.js +0 -43
  225. package/providers/_builtin/ide/windsurf/scripts/1.0/set_model.js +0 -49
  226. package/providers/_builtin/ide/windsurf/scripts/1.0/switch_session.js +0 -82
  227. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/focus_editor.js +0 -30
  228. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_chats.js +0 -117
  229. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_models.js +0 -39
  230. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_modes.js +0 -39
  231. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/new_session.js +0 -69
  232. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/open_panel.js +0 -58
  233. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/read_chat.js +0 -315
  234. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/resolve_action.js +0 -68
  235. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/scripts.js +0 -82
  236. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/send_message.js +0 -87
  237. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/set_mode.js +0 -15
  238. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/set_model.js +0 -15
  239. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/switch_session.js +0 -58
  240. package/providers/_builtin/registry.json +0 -376
  241. package/providers/_builtin/validate.js +0 -156
@@ -1,58 +0,0 @@
1
- /**
2
- * Windsurf v1 — new_session
3
- *
4
- * new Cascade session start.
5
- *
6
- * strategy:
7
- * 1. Search for "New" button based on aria-label
8
- * 2. text-based button search
9
- * 3. Codicon icon(+) based search
10
- * 4. Cmd+L shortcut fallback (Windsurffrom new Cascade open)
11
- *
12
- * Windsurffrom Cascadeis an AI chat panel,
13
- * "New Chat" or "+" starts New session via button.
14
- *
15
- * final Check: Windsurf 1.108.x (2026-03-10)
16
- */
17
- (async () => {
18
- try {
19
- const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
20
- const cascade = document.querySelector('#windsurf\\.cascadePanel') || document.querySelector('.chat-client-root');
21
- const beforeTabs = document.querySelectorAll('[id^="cascade-tab-"]').length;
22
- const headerButtons = Array.from((cascade || document).querySelectorAll('button')).filter(el => el.offsetWidth > 0 && el.offsetHeight > 0);
23
-
24
- const clickSequence = (el) => {
25
- const rect = el.getBoundingClientRect();
26
- const init = { bubbles: true, cancelable: true, clientX: rect.left + rect.width / 2, clientY: rect.top + rect.height / 2, pointerId: 1, pointerType: 'mouse' };
27
- el.focus?.();
28
- for (const type of ['pointerdown', 'mousedown', 'pointerup', 'mouseup', 'click']) {
29
- el.dispatchEvent(new PointerEvent(type, init));
30
- }
31
- };
32
-
33
- let button = headerButtons.find(el => /lucide-plus/.test(el.innerHTML));
34
-
35
- if (!button) {
36
- button = headerButtons.find(el => {
37
- const text = (el.innerText || el.textContent || '').trim().toLowerCase();
38
- const label = ((el.getAttribute('aria-label') || '') + ' ' + (el.getAttribute('title') || '')).toLowerCase();
39
- return text === '+' || label.includes('new chat') || label.includes('new cascade') || label.includes('new conversation') || label.includes('new session');
40
- });
41
- }
42
-
43
- if (button) {
44
- clickSequence(button);
45
- await wait(300);
46
- const afterTabs = document.querySelectorAll('[id^="cascade-tab-"]').length;
47
- return JSON.stringify({ created: afterTabs >= beforeTabs });
48
- }
49
-
50
- document.dispatchEvent(new KeyboardEvent('keydown', { key: 'l', code: 'KeyL', keyCode: 76, which: 76, metaKey: true, bubbles: true, cancelable: true }));
51
- document.dispatchEvent(new KeyboardEvent('keyup', { key: 'l', code: 'KeyL', keyCode: 76, which: 76, metaKey: true, bubbles: true, cancelable: true }));
52
- await wait(300);
53
-
54
- return JSON.stringify({ created: document.querySelectorAll('[id^="cascade-tab-"]').length >= beforeTabs });
55
- } catch (e) {
56
- return JSON.stringify({ created: false, error: e.message });
57
- }
58
- })()
@@ -1,67 +0,0 @@
1
- /**
2
- * Windsurf v1 — open_panel
3
- *
4
- * Cascade(AI chat) If panel is closed when present open.
5
- *
6
- * WindsurfCascade panel of is Secondary Side Bar (#workbench.parts.auxiliarybar)located at.
7
- * closed offsetWidth === 0.
8
- * Cmd+L via shortcut can be opened (WINDSURF.md §2.5).
9
- *
10
- * Return: 'visible' | 'opened' | 'error: ...'
11
- * final Check: Windsurf 1.108.x (2026-03-10)
12
- */
13
- (async () => {
14
- try {
15
- const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
16
- const isOpen = () => {
17
- const cascade = document.querySelector('#windsurf\\.cascadePanel') || document.querySelector('.chat-client-root');
18
- return !!(cascade && cascade.offsetWidth > 0 && cascade.offsetHeight > 0);
19
- };
20
-
21
- if (isOpen()) {
22
- return JSON.stringify({ opened: true });
23
- }
24
-
25
- const toggles = Array.from(document.querySelectorAll('a[role="checkbox"], a[role="button"], button, [role="button"]'))
26
- .filter(el => el.offsetWidth > 0 && el.offsetHeight > 0);
27
-
28
- const toggle = toggles.find(el => {
29
- const label = ((el.getAttribute('aria-label') || '') + ' ' + (el.getAttribute('title') || '')).toLowerCase();
30
- return label.includes('cascade') || label.includes('toggle cascade') || label.includes('toggle auxiliary') || label.includes('toggle secondary');
31
- });
32
-
33
- if (toggle) {
34
- toggle.click();
35
- await wait(250);
36
- if (isOpen()) {
37
- return JSON.stringify({ opened: true });
38
- }
39
- }
40
-
41
- const fireShortcut = (metaKey, ctrlKey) => {
42
- const down = new KeyboardEvent('keydown', {
43
- key: 'l', code: 'KeyL', keyCode: 76, which: 76,
44
- metaKey, ctrlKey,
45
- bubbles: true, cancelable: true,
46
- });
47
- const up = new KeyboardEvent('keyup', {
48
- key: 'l', code: 'KeyL', keyCode: 76, which: 76,
49
- metaKey, ctrlKey,
50
- bubbles: true, cancelable: true,
51
- });
52
- document.dispatchEvent(down);
53
- document.dispatchEvent(up);
54
- };
55
-
56
- fireShortcut(true, false);
57
- await wait(250);
58
- if (!isOpen()) {
59
- fireShortcut(false, true);
60
- await wait(250);
61
- }
62
-
63
- return JSON.stringify({ opened: isOpen() });
64
- } catch (e) {
65
- return JSON.stringify({ opened: false, error: e.message });
66
- }
67
- })()
@@ -1,253 +0,0 @@
1
- /**
2
- * Windsurf v1 — read_chat
3
- */
4
- (() => {
5
- try {
6
- const cascade = document.querySelector('#windsurf\\.cascadePanel') || document.querySelector('.chat-client-root');
7
- const normalize = (text) => (text || '').replace(/[\u200b\u00a0]+/g, ' ').replace(/\s+/g, ' ').trim();
8
- const cleanText = (text) => normalize((text || '').replace(/Run⌥⏎/g, 'Run').replace(/\b(Skip|Accept|Reject|Approve|Allow|Deny)\b/g, ' $1 ').replace(/\s+/g, ' '));
9
- const isVisible = (el) => !!(el && el.offsetWidth > 0 && el.offsetHeight > 0);
10
-
11
- if (!cascade) {
12
- return JSON.stringify({ id: 'no_cascade', status: 'idle', title: 'Cascade', messages: [], inputContent: '', activeModal: null });
13
- }
14
-
15
- const title = normalize(
16
- document.querySelector('[id^="cascade-tab-"] .truncate, [id^="cascade-tab-"] span')?.textContent
17
- || document.title.split(' — ').pop()
18
- || 'Cascade'
19
- );
20
-
21
- const activeTab = Array.from(document.querySelectorAll('[id^="cascade-tab-"]')).find(isVisible);
22
- let cascadeId = activeTab?.id?.replace(/^cascade-tab-/, '') || 'active';
23
- let fiberRunning = false;
24
- let fiberPendingCommand = false;
25
-
26
- const readFiberValue = (node) => {
27
- if (!node || typeof node !== 'object') return;
28
- const key = Object.keys(node).find(name => name.startsWith('__reactFiber'));
29
- if (!key) return;
30
- let fiber = node[key];
31
- for (let depth = 0; fiber && depth < 40; depth += 1, fiber = fiber.return) {
32
- const props = fiber.memoizedProps || fiber.pendingProps || {};
33
- if (!cascadeId && typeof props.cascadeId === 'string') cascadeId = props.cascadeId;
34
- if (props.cascadeId && typeof props.cascadeId === 'string') cascadeId = props.cascadeId;
35
- if (props.isRunning === true) fiberRunning = true;
36
- if (props.hasPendingTerminalCommand === true) fiberPendingCommand = true;
37
- }
38
- };
39
-
40
- readFiberValue(cascade);
41
-
42
- const BLOCK_TAGS = new Set(['DIV', 'P', 'BR', 'LI', 'TR', 'SECTION', 'ARTICLE', 'HEADER', 'FOOTER']);
43
- const extractCodeText = (node) => {
44
- if (!node) return '';
45
- if (node.nodeType === Node.TEXT_NODE) return node.textContent || '';
46
- if (node.nodeType !== Node.ELEMENT_NODE) return '';
47
- if (node.tagName === 'BR') return '\n';
48
- const parts = [];
49
- for (const child of node.childNodes) {
50
- const block = child.nodeType === Node.ELEMENT_NODE && BLOCK_TAGS.has(child.tagName);
51
- const text = extractCodeText(child);
52
- if (!text) continue;
53
- if (block && parts.length > 0) parts.push('\n');
54
- parts.push(text);
55
- if (block) parts.push('\n');
56
- }
57
- return parts.join('').replace(/\n{3,}/g, '\n\n');
58
- };
59
- const htmlToMd = (node) => {
60
- if (!node) return '';
61
- if (node.nodeType === Node.TEXT_NODE) return node.textContent || '';
62
- if (node.nodeType !== Node.ELEMENT_NODE) return '';
63
- const tag = node.tagName;
64
- if (tag === 'STYLE' || tag === 'SCRIPT' || tag === 'SVG') return '';
65
- if (tag === 'BR') return '\n';
66
- if (tag === 'CODE' && node.parentElement?.tagName !== 'PRE') {
67
- return '`' + extractCodeText(node).replace(/`/g, '\\`') + '`';
68
- }
69
- if (tag === 'PRE') {
70
- return `\n\n\0\u0006\n${extractCodeText(node).trim()}\n\0\u0006\n\n`;
71
- }
72
- if (tag === 'A') {
73
- const text = normalize(Array.from(node.childNodes).map(htmlToMd).join('')) || normalize(node.textContent);
74
- const href = node.getAttribute('href') || '';
75
- return href ? `[${text || href}](${href})` : text;
76
- }
77
- if (tag === 'TABLE') {
78
- const rows = Array.from(node.querySelectorAll('tr')).map(tr => Array.from(tr.querySelectorAll('th,td')).map(cell => normalize(cell.textContent).replace(/\|/g, '\\|')));
79
- if (!rows.length) return '';
80
- const colCount = Math.max(...rows.map(row => row.length));
81
- const header = rows[0].concat(Array(Math.max(0, colCount - rows[0].length)).fill(''));
82
- const body = rows.slice(1).map(row => row.concat(Array(Math.max(0, colCount - row.length)).fill('')));
83
- const divider = Array(colCount).fill('---');
84
- return '\n' + ['| ' + header.join(' | ') + ' |', '| ' + divider.join(' | ') + ' |', ...body.map(row => '| ' + row.join(' | ') + ' |')].join('\n') + '\n';
85
- }
86
- const children = Array.from(node.childNodes).map(htmlToMd).join('');
87
- if (tag === 'P') return children.trim() + '\n\n';
88
- if (tag === 'LI') return '- ' + children.trim() + '\n';
89
- if (tag === 'UL' || tag === 'OL') return '\n' + children + '\n';
90
- if (/H[1-6]/.test(tag)) return '\n' + '#'.repeat(Number(tag[1])) + ' ' + normalize(node.textContent) + '\n\n';
91
- return children;
92
- };
93
- const getCopyableText = (node) => {
94
- if (!node) return '';
95
- const nodes = [node, ...node.querySelectorAll('*')].slice(0, 80);
96
- for (const candidate of nodes) {
97
- const key = Object.keys(candidate).find(name => name.startsWith('__reactFiber'));
98
- if (!key) continue;
99
- let fiber = candidate[key];
100
- for (let depth = 0; fiber && depth < 15; depth += 1, fiber = fiber.return) {
101
- const props = fiber.memoizedProps || fiber.pendingProps || {};
102
- if (typeof props.copyableText === 'string' && props.copyableText.trim()) {
103
- return props.copyableText.trim();
104
- }
105
- }
106
- }
107
- return '';
108
- };
109
- const getCleanMd = (node) => htmlToMd(node)
110
- .replace(/\u00060\u0006/g, '```')
111
- .replace(/\n{3,}/g, '\n\n')
112
- .replace(/[ \t]+\n/g, '\n')
113
- .trim();
114
-
115
- const collectApprovalActions = () => {
116
- const dialogs = [document.querySelector('.monaco-dialog-box, [role="dialog"]'), cascade].filter(Boolean);
117
- const actionNames = [];
118
- for (const root of dialogs) {
119
- const buttons = Array.from(root.querySelectorAll('button, [role="button"], .monaco-button')).filter(isVisible);
120
- for (const button of buttons) {
121
- const label = normalize(button.innerText || button.textContent || button.getAttribute('aria-label'));
122
- if (!label || label.length > 40) continue;
123
- if (!/^(run|skip|accept|reject|approve|allow|deny)\b/i.test(label)) continue;
124
- if (!actionNames.some(existing => existing.toLowerCase() === label.toLowerCase())) {
125
- actionNames.push(label);
126
- }
127
- }
128
- }
129
- return actionNames;
130
- };
131
-
132
- const approvalActions = collectApprovalActions();
133
- let status = 'idle';
134
- let activeModal = null;
135
-
136
- if (approvalActions.length > 0) {
137
- status = 'waiting_approval';
138
- activeModal = {
139
- message: normalize(cascade.querySelector('button')?.closest('[class*="terminal"],[class*="shadow-step"],.monaco-dialog-box,[role="dialog"]')?.innerText || 'Approval required'),
140
- buttons: approvalActions,
141
- };
142
- } else {
143
- const stopButton = Array.from(cascade.querySelectorAll('button, [role="button"]')).find(el => {
144
- if (!isVisible(el)) return false;
145
- const text = normalize(el.innerText || el.textContent || el.getAttribute('aria-label'));
146
- return /^(stop|cancel generation|stop generating)\b/i.test(text);
147
- });
148
- const spinnerSignal = Array.from(cascade.querySelectorAll('*')).some(el => {
149
- if (!isVisible(el)) return false;
150
- const cls = String(el.className || '');
151
- return /animate-spin|animate-pulse|animate-bounce|loading-spinner|lucide-loader|stream/i.test(cls);
152
- });
153
- const stateLabelSignal = Array.from(cascade.querySelectorAll('*')).some(el => {
154
- if (!isVisible(el)) return false;
155
- if (el.children.length > 2) return false;
156
- if (el.closest('[class*="popover"], [class*="tooltip"], [data-radix-popper-content-wrapper]')) return false;
157
- const text = normalize(el.innerText || el.textContent || el.getAttribute('aria-label'));
158
- return text.length > 0 && text.length <= 30 && /^(thinking|generating|sailing|loading)\b/i.test(text);
159
- });
160
- if (fiberRunning || stopButton || spinnerSignal || stateLabelSignal) {
161
- status = 'generating';
162
- }
163
- }
164
-
165
- const scroll = cascade.querySelector('.cascade-scrollbar');
166
- const candidates = scroll
167
- ? Array.from(scroll.querySelectorAll('div')).filter(el => String(el.className || '').includes('flex flex-col gap-2.5') && el.children.length > 0)
168
- : [];
169
- const listRoot = candidates.sort((left, right) => right.children.length - left.children.length)[0] || null;
170
-
171
- const messages = [];
172
- const seen = new Set();
173
- if (listRoot) {
174
- for (const child of Array.from(listRoot.children)) {
175
- if (!isVisible(child)) continue;
176
- const rawText = normalize(child.innerText || child.textContent);
177
- if (!rawText) continue;
178
- if ((child.className || '').includes('mark-js-ignore') || /feedback submitted/i.test(rawText)) continue;
179
-
180
- readFiberValue(child);
181
-
182
- const isUser = !!child.querySelector('.justify-end');
183
- let kind = 'standard';
184
- if (/Command\b/i.test(rawText) || child.querySelector('.terminal-text, [class*="bg-ide-terminal-background"]')) {
185
- kind = 'terminal';
186
- } else if (/tasks done|Created Todo List|\bnew\b \+\d+|shadow-step/i.test(rawText + ' ' + (child.innerHTML || ''))) {
187
- kind = 'tool';
188
- } else if (!isUser && /step-by-step reasoning|reasoning process|thought process/i.test(rawText)) {
189
- kind = 'thought';
190
- }
191
-
192
- let content = '';
193
- if (isUser) {
194
- const bubble = child.querySelector('[class*="whitespace-pre-wrap"]') || child;
195
- content = normalize(bubble.innerText || bubble.textContent);
196
- } else if (kind === 'terminal') {
197
- const label = normalize(child.querySelector('.codeium-text-medium')?.textContent || 'Command');
198
- const command = normalize(child.querySelector('.terminal-text,.whitespace-pre-wrap,.monaco-tokenized-source')?.textContent || rawText)
199
- .replace(/\bRun\b.*$/i, '')
200
- .replace(/\bSkip\b.*$/i, '')
201
- .trim();
202
- content = `${label}\n\n\0\u0006sh\n${command}\n\0\u0006`.replace(/\u00060\u0006/g, '```');
203
- } else if (kind === 'tool') {
204
- content = cleanText(rawText);
205
- } else {
206
- const prose = child.querySelector('.prose');
207
- content = getCopyableText(child) || getCleanMd(prose || child) || cleanText(rawText);
208
- }
209
-
210
- content = content.replace(/\n{3,}/g, '\n\n').trim();
211
- if (!content) continue;
212
-
213
- const hash = `${isUser ? 'user' : 'assistant'}:${kind}:${content.slice(0, 240)}`;
214
- if (seen.has(hash)) continue;
215
- seen.add(hash);
216
-
217
- const message = {
218
- role: isUser ? 'user' : 'assistant',
219
- content: content.length > 12000 ? `${content.slice(0, 12000)}\n[... truncated]` : content,
220
- index: messages.length,
221
- };
222
- if (kind !== 'standard') message.kind = kind;
223
- if (kind === 'terminal') {
224
- message.meta = {
225
- label: normalize(child.querySelector('.codeium-text-medium')?.textContent || 'Command'),
226
- isRunning: status === 'generating' && /command/i.test(content),
227
- };
228
- }
229
- messages.push(message);
230
- }
231
- }
232
-
233
- const editor = cascade.querySelector('[data-lexical-editor="true"]')
234
- || cascade.querySelector('[contenteditable="true"][role="textbox"]')
235
- || cascade.querySelector('textarea:not(.xterm-helper-textarea)');
236
- const inputContent = normalize(editor?.innerText || editor?.value || '');
237
-
238
- if (status === 'idle' && fiberPendingCommand && approvalActions.length > 0) {
239
- status = 'waiting_approval';
240
- }
241
-
242
- return JSON.stringify({
243
- id: cascadeId,
244
- status,
245
- title,
246
- messages,
247
- inputContent,
248
- activeModal,
249
- });
250
- } catch (e) {
251
- return JSON.stringify({ id: 'error', status: 'idle', title: 'Cascade', messages: [], inputContent: '', activeModal: null, error: e.message });
252
- }
253
- })()
@@ -1,82 +0,0 @@
1
- /**
2
- * Windsurf v1 — resolve_action
3
- *
4
- * Cascade panel approval/ button Return.
5
- */
6
- (async (params) => {
7
- try {
8
- const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
9
- const normalize = (text) => (text || '').replace(/\s+/g, ' ').trim().toLowerCase();
10
-
11
- //
12
- const want = normalize(params?.buttonText || params?.button || params?.action || 'run');
13
-
14
- const isMatch = (text) => {
15
- const t = normalize(text);
16
- if (!t) return false;
17
- // Positive action (Run / Accept)
18
- if (want === 'run' || want === 'approve' || want === 'accept') {
19
- return /run|allow|approve|accept|apply|ok|yes|proceed|continue|keep/i.test(t);
20
- }
21
- // Negative action (Skip / Reject)
22
- if (want === 'skip' || want === 'reject' || want === 'deny') {
23
- return /skip|deny|reject|cancel|no|discard/i.test(t);
24
- }
25
- return t.includes(want);
26
- };
27
-
28
- const isVisible = (el) => {
29
- const rect = el.getBoundingClientRect();
30
- return rect.width > 0 && rect.height > 0 &&
31
- window.getComputedStyle(el).visibility !== 'hidden' &&
32
- window.getComputedStyle(el).display !== 'none';
33
- };
34
-
35
- const cascade = document.querySelector('#windsurf\\.cascadePanel') || document.querySelector('.chat-client-root') || document;
36
-
37
- // button
38
- const buttons = Array.from(cascade.querySelectorAll('button, [role="button"], .monaco-button'))
39
- .filter(el => isVisible(el) && !el.disabled && !el.classList.contains('disabled'));
40
-
41
- // (latest) with button first
42
- const target = buttons.reverse().find(el => {
43
- const label = el.innerText || el.textContent || el.getAttribute('aria-label') || '';
44
- return isMatch(label);
45
- });
46
-
47
- if (target) {
48
- target.focus?.();
49
- const rect = target.getBoundingClientRect();
50
-
51
- // Synthetic click (DOM level)
52
- try {
53
- const init = { bubbles: true, cancelable: true, view: window, buttons: 1 };
54
- target.dispatchEvent(new MouseEvent('mousedown', init));
55
- target.dispatchEvent(new MouseEvent('mouseup', init));
56
- target.click();
57
- } catch(e) {}
58
-
59
- return JSON.stringify({
60
- found: true,
61
- x: Math.round(rect.x + rect.width / 2),
62
- y: Math.round(rect.y + rect.height / 2),
63
- label: (target.innerText || target.textContent || '').trim()
64
- });
65
- }
66
-
67
- // button On failure Enter ( when)
68
- if (want === 'run' || want === 'approve' || want === 'accept') {
69
- const cmdEnter = (type) => document.dispatchEvent(new KeyboardEvent(type, { key: 'Enter', code: 'Enter', keyCode: 13, which: 13, metaKey: true, bubbles: true, cancelable: true }));
70
- cmdEnter('keydown');
71
- await wait(20);
72
- cmdEnter('keyup');
73
- return JSON.stringify({ resolved: true, method: 'cmd_enter_fallback' });
74
- }
75
-
76
- return JSON.stringify({ found: false });
77
- } catch (e) {
78
- return JSON.stringify({ found: false, error: e.message });
79
- }
80
- })
81
-
82
-
@@ -1,82 +0,0 @@
1
- /**
2
- * CDP Scripts — Router
3
- *
4
- * Version routing is handled by ProviderLoader:
5
- * Pattern:
6
- * - Scripts WITHOUT params: loaded as-is (self-invoking IIFE)
7
- * - Scripts WITH params: loaded as function expression, invoked with params JSON
8
- * e.g. `(${script})(${JSON.stringify(params)})`
9
- */
10
-
11
- 'use strict';
12
-
13
- const fs = require('fs');
14
- const path = require('path');
15
-
16
- function load(name) {
17
- try { return fs.readFileSync(path.join(__dirname, name), 'utf-8'); }
18
- catch { return null; }
19
- }
20
-
21
- function withParams(name, params) {
22
- let script = load(name);
23
- if (!script) return null;
24
-
25
- // For legacy scripts checking MESSAGE, interpolate them manually
26
- if (script.includes('${ MESSAGE }')) {
27
- const msg = params?.MESSAGE || params?.text || '';
28
- return script.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
29
- }
30
- if (script.includes('${ BUTTON_TEXT }')) {
31
- const btn = params?.BUTTON_TEXT || params?.buttonText || '';
32
- return script.replace(/\$\{ BUTTON_TEXT \}/g, JSON.stringify(btn));
33
- }
34
-
35
- return `(${script})(${JSON.stringify(params)})`;
36
- }
37
-
38
- // ─── Core (no params — IIFE) ───
39
-
40
- module.exports.readChat = () => load('read_chat.js') || load('webview_read_chat.js');
41
- module.exports.sendMessage = (params) => {
42
- let s = load('send_message.js');
43
- if (!s) s = load('webview_send_message.js');
44
- if (!s) return null;
45
- // Legacy template substitution fallback
46
- if (s.includes('${ MESSAGE }')) {
47
- const msg = params?.MESSAGE || params?.text || params || '';
48
- return s.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
49
- }
50
- return withParams('send_message.js', params) || withParams('webview_send_message.js', params);
51
- };
52
- module.exports.listSessions = () => load('list_sessions.js');
53
- module.exports.newSession = () => load('new_session.js');
54
- module.exports.focusEditor = () => load('focus_editor.js');
55
- module.exports.openPanel = () => load('open_panel.js');
56
- module.exports.listModels = () => load('list_models.js');
57
- module.exports.listModes = () => load('list_modes.js');
58
-
59
- // ─── With params (function expression) ───
60
-
61
- module.exports.switchSession = (params) => {
62
- const index = typeof params === 'number' ? params : params?.index ?? 0;
63
- const title = typeof params === 'string' ? params : params?.title || null;
64
- return withParams('switch_session.js', { index, title });
65
- };
66
-
67
- module.exports.resolveAction = (params) => {
68
- const action = typeof params === 'string' ? params : params?.action || 'approve';
69
- const buttonText = params?.button || params?.buttonText
70
- || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
71
- return withParams('resolve_action.js', { buttonText, BUTTON_TEXT: buttonText });
72
- };
73
-
74
- module.exports.setModel = (params) => {
75
- const model = typeof params === 'string' ? params : params?.model;
76
- return withParams('set_model.js', { model });
77
- };
78
-
79
- module.exports.setMode = (params) => {
80
- const mode = typeof params === 'string' ? params : params?.mode;
81
- return withParams('set_mode.js', { mode });
82
- };
@@ -1,20 +0,0 @@
1
- /**
2
- * Windsurf v1 — send_message
3
- */
4
- (async (params) => {
5
- try {
6
- const selector = '[id="windsurf.cascadePanel"] [contenteditable="true"]';
7
- const input = document.querySelector(selector) || document.querySelector('[contenteditable="true"]');
8
- if (!input) {
9
- return JSON.stringify({ sent: false, error: 'Input not found' });
10
- }
11
- input.focus();
12
- return JSON.stringify({
13
- sent: false,
14
- needsTypeAndSend: true,
15
- selector
16
- });
17
- } catch(e) {
18
- return JSON.stringify({ sent: false, error: e.message });
19
- }
20
- })
@@ -1,43 +0,0 @@
1
- /**
2
- * Generic fallback — set_model
3
- * ${ MODEL }
4
- */
5
- (async (params) => {
6
- try {
7
- const want = (params?.mode || '').trim();
8
- if (!want) {
9
- return JSON.stringify({ success: false, error: 'Missing mode' });
10
- }
11
-
12
- const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
13
- const cascade = document.querySelector('#windsurf\\.cascadePanel') || document.querySelector('.chat-client-root');
14
- const normalize = (text) => (text || '').replace(/\s+/g, ' ').trim().toLowerCase();
15
- const modeButton = Array.from((cascade || document).querySelectorAll('button')).find(el => {
16
- const rect = el.getBoundingClientRect();
17
- return rect.y > window.innerHeight - 90 && /lucide-code|lucide-message|lucide-search|lucide-wand|lucide-pencil/i.test(el.innerHTML || '');
18
- });
19
-
20
- if (modeButton) {
21
- modeButton.click();
22
- await wait(200);
23
- }
24
-
25
- const target = Array.from(document.querySelectorAll('button')).find(el => {
26
- if (!(el.offsetWidth > 0 && el.offsetHeight > 0)) return false;
27
- const rect = el.getBoundingClientRect();
28
- const text = normalize((el.innerText || el.textContent || '').split('\n')[0]);
29
- return rect.x > window.innerWidth - 320 && rect.width >= 180 && (text === normalize(want) || text.includes(normalize(want)) || normalize(want).includes(text));
30
- });
31
-
32
- if (!target) {
33
- document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', code: 'Escape', keyCode: 27, which: 27, bubbles: true, cancelable: true }));
34
- return JSON.stringify({ success: false, error: 'Mode not found' });
35
- }
36
-
37
- target.click();
38
- await wait(200);
39
- return JSON.stringify({ success: true });
40
- } catch (e) {
41
- return JSON.stringify({ success: false, error: e.message });
42
- }
43
- })
@@ -1,49 +0,0 @@
1
- /**
2
- * Generic fallback — set_model
3
- * ${ MODEL }
4
- */
5
- (async (params) => {
6
- try {
7
- const want = (params?.model || '').trim();
8
- if (!want) {
9
- return JSON.stringify({ success: false, error: 'Missing model' });
10
- }
11
-
12
- const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
13
- const cascade = document.querySelector('#windsurf\\.cascadePanel') || document.querySelector('.chat-client-root');
14
- const normalize = (text) => (text || '').replace(/\s+/g, ' ').trim().toLowerCase();
15
- const currentButton = Array.from((cascade || document).querySelectorAll('button')).find(el => {
16
- const rect = el.getBoundingClientRect();
17
- const text = (el.innerText || el.textContent || '').trim();
18
- return rect.y > window.innerHeight - 90 && rect.width < 140 && /(claude|gpt|gemini|sonnet|opus|swe|deepseek|qwen|grok|o1|o3|codex)/i.test(text);
19
- });
20
-
21
- if (currentButton) {
22
- currentButton.click();
23
- await wait(250);
24
- }
25
-
26
- const target = Array.from(document.querySelectorAll('button')).find(el => {
27
- if (!(el.offsetWidth > 0 && el.offsetHeight > 0)) return false;
28
- const rect = el.getBoundingClientRect();
29
- const text = normalize(el.innerText || el.textContent);
30
- return rect.x > window.innerWidth - 320 && rect.width >= 180 && (text === normalize(want) || text.includes(normalize(want)) || normalize(want).includes(text));
31
- });
32
-
33
- if (!target) {
34
- document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', code: 'Escape', keyCode: 27, which: 27, bubbles: true, cancelable: true }));
35
- return JSON.stringify({ success: false, error: 'Model not found' });
36
- }
37
-
38
- if ((target.className || '').includes('cursor-not-allowed') || target.disabled) {
39
- document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', code: 'Escape', keyCode: 27, which: 27, bubbles: true, cancelable: true }));
40
- return JSON.stringify({ success: false, error: 'Model is disabled' });
41
- }
42
-
43
- target.click();
44
- await wait(250);
45
- return JSON.stringify({ success: true });
46
- } catch (e) {
47
- return JSON.stringify({ success: false, error: e.message });
48
- }
49
- })