@adhdev/daemon-core 0.6.58 → 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 (245) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +87 -89
  3. package/dist/index.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/detection/ide-detector.ts +1 -1
  6. package/src/providers/provider-loader.ts +3 -6
  7. package/providers/_builtin/.github/workflows/generate-registry.yml +0 -76
  8. package/providers/_builtin/COMPATIBILITY.md +0 -217
  9. package/providers/_builtin/CONTRIBUTING.md +0 -200
  10. package/providers/_builtin/README.md +0 -119
  11. package/providers/_builtin/_helpers/index.js +0 -188
  12. package/providers/_builtin/acp/agentpool/provider.json +0 -54
  13. package/providers/_builtin/acp/amp/provider.json +0 -52
  14. package/providers/_builtin/acp/auggie/provider.json +0 -57
  15. package/providers/_builtin/acp/autodev/provider.json +0 -54
  16. package/providers/_builtin/acp/autohand/provider.json +0 -52
  17. package/providers/_builtin/acp/blackbox-ai/provider.json +0 -54
  18. package/providers/_builtin/acp/claude-agent/provider.json +0 -57
  19. package/providers/_builtin/acp/cline-acp/provider.json +0 -54
  20. package/providers/_builtin/acp/codebuddy/provider.json +0 -54
  21. package/providers/_builtin/acp/codex-cli/provider.json +0 -57
  22. package/providers/_builtin/acp/corust-agent/provider.json +0 -52
  23. package/providers/_builtin/acp/crow-cli/provider.json +0 -54
  24. package/providers/_builtin/acp/cursor-acp/provider.json +0 -54
  25. package/providers/_builtin/acp/deepagents/provider.json +0 -52
  26. package/providers/_builtin/acp/dimcode/provider.json +0 -54
  27. package/providers/_builtin/acp/docker-cagent/provider.json +0 -57
  28. package/providers/_builtin/acp/factory-droid/provider.json +0 -60
  29. package/providers/_builtin/acp/fast-agent/provider.json +0 -52
  30. package/providers/_builtin/acp/gemini-cli/provider.json +0 -114
  31. package/providers/_builtin/acp/github-copilot/provider.json +0 -54
  32. package/providers/_builtin/acp/goose/provider.json +0 -57
  33. package/providers/_builtin/acp/junie/provider.json +0 -52
  34. package/providers/_builtin/acp/kilo/provider.json +0 -54
  35. package/providers/_builtin/acp/kimi-cli/provider.json +0 -57
  36. package/providers/_builtin/acp/minion-code/provider.json +0 -52
  37. package/providers/_builtin/acp/mistral-vibe/provider.json +0 -57
  38. package/providers/_builtin/acp/nova/provider.json +0 -54
  39. package/providers/_builtin/acp/openclaw/provider.json +0 -54
  40. package/providers/_builtin/acp/opencode/provider.json +0 -52
  41. package/providers/_builtin/acp/openhands/provider.json +0 -54
  42. package/providers/_builtin/acp/pi-acp/provider.json +0 -52
  43. package/providers/_builtin/acp/qoder/provider.json +0 -54
  44. package/providers/_builtin/acp/qwen-code/provider.json +0 -60
  45. package/providers/_builtin/acp/stakpak/provider.json +0 -54
  46. package/providers/_builtin/acp/vtcode/provider.json +0 -54
  47. package/providers/_builtin/cli/aider-cli/provider.json +0 -37
  48. package/providers/_builtin/cli/aider-cli/scripts/1.0/detect_status.js +0 -20
  49. package/providers/_builtin/cli/aider-cli/scripts/1.0/parse_approval.js +0 -10
  50. package/providers/_builtin/cli/aider-cli/scripts/1.0/parse_output.js +0 -97
  51. package/providers/_builtin/cli/aider-cli/scripts/1.0/scripts.js +0 -7
  52. package/providers/_builtin/cli/claude-cli/provider.json +0 -121
  53. package/providers/_builtin/cli/claude-cli/scripts/1.0/detect_status.js +0 -83
  54. package/providers/_builtin/cli/claude-cli/scripts/1.0/parse_approval.js +0 -97
  55. package/providers/_builtin/cli/claude-cli/scripts/1.0/parse_output.js +0 -417
  56. package/providers/_builtin/cli/claude-cli/scripts/1.0/scripts.js +0 -42
  57. package/providers/_builtin/cli/codex-cli/provider.json +0 -90
  58. package/providers/_builtin/cli/codex-cli/scripts/1.0/detect_status.js +0 -54
  59. package/providers/_builtin/cli/codex-cli/scripts/1.0/parse_approval.js +0 -91
  60. package/providers/_builtin/cli/codex-cli/scripts/1.0/parse_output.js +0 -522
  61. package/providers/_builtin/cli/codex-cli/scripts/1.0/scripts.js +0 -11
  62. package/providers/_builtin/cli/cursor-cli/provider.json +0 -37
  63. package/providers/_builtin/cli/cursor-cli/scripts/1.0/detect_status.js +0 -19
  64. package/providers/_builtin/cli/cursor-cli/scripts/1.0/parse_approval.js +0 -10
  65. package/providers/_builtin/cli/cursor-cli/scripts/1.0/parse_output.js +0 -48
  66. package/providers/_builtin/cli/cursor-cli/scripts/1.0/scripts.js +0 -7
  67. package/providers/_builtin/cli/gemini-cli/provider.json +0 -109
  68. package/providers/_builtin/cli/gemini-cli/scripts/1.0/detect_status.js +0 -26
  69. package/providers/_builtin/cli/gemini-cli/scripts/1.0/parse_approval.js +0 -22
  70. package/providers/_builtin/cli/gemini-cli/scripts/1.0/parse_output.js +0 -71
  71. package/providers/_builtin/cli/gemini-cli/scripts/1.0/scripts.js +0 -12
  72. package/providers/_builtin/cli/github-copilot-cli/provider.json +0 -37
  73. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/detect_status.js +0 -19
  74. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/parse_approval.js +0 -9
  75. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/parse_output.js +0 -48
  76. package/providers/_builtin/cli/github-copilot-cli/scripts/1.0/scripts.js +0 -7
  77. package/providers/_builtin/cli/goose-cli/provider.json +0 -37
  78. package/providers/_builtin/cli/goose-cli/scripts/1.0/detect_status.js +0 -20
  79. package/providers/_builtin/cli/goose-cli/scripts/1.0/parse_approval.js +0 -10
  80. package/providers/_builtin/cli/goose-cli/scripts/1.0/parse_output.js +0 -48
  81. package/providers/_builtin/cli/goose-cli/scripts/1.0/scripts.js +0 -7
  82. package/providers/_builtin/cli/opencode-cli/provider.json +0 -37
  83. package/providers/_builtin/cli/opencode-cli/scripts/1.0/detect_status.js +0 -15
  84. package/providers/_builtin/cli/opencode-cli/scripts/1.0/parse_approval.js +0 -9
  85. package/providers/_builtin/cli/opencode-cli/scripts/1.0/parse_output.js +0 -48
  86. package/providers/_builtin/cli/opencode-cli/scripts/1.0/scripts.js +0 -7
  87. package/providers/_builtin/docs/CDP_SELECTOR_GUIDE.md +0 -370
  88. package/providers/_builtin/docs/PROVIDER_GUIDE.md +0 -916
  89. package/providers/_builtin/extension/cline/provider.json +0 -37
  90. package/providers/_builtin/extension/cline/scripts/1.0/focus_editor.js +0 -48
  91. package/providers/_builtin/extension/cline/scripts/1.0/list_chats.js +0 -100
  92. package/providers/_builtin/extension/cline/scripts/1.0/list_models.js +0 -43
  93. package/providers/_builtin/extension/cline/scripts/1.0/list_modes.js +0 -35
  94. package/providers/_builtin/extension/cline/scripts/1.0/new_session.js +0 -85
  95. package/providers/_builtin/extension/cline/scripts/1.0/open_panel.js +0 -25
  96. package/providers/_builtin/extension/cline/scripts/1.0/read_chat.js +0 -270
  97. package/providers/_builtin/extension/cline/scripts/1.0/resolve_action.js +0 -83
  98. package/providers/_builtin/extension/cline/scripts/1.0/scripts.js +0 -82
  99. package/providers/_builtin/extension/cline/scripts/1.0/send_message.js +0 -95
  100. package/providers/_builtin/extension/cline/scripts/1.0/set_mode.js +0 -36
  101. package/providers/_builtin/extension/cline/scripts/1.0/set_model.js +0 -36
  102. package/providers/_builtin/extension/cline/scripts/1.0/switch_session.js +0 -206
  103. package/providers/_builtin/extension/codex/provider.json +0 -38
  104. package/providers/_builtin/extension/codex/scripts/1.0/click_conversation_webview.js +0 -24
  105. package/providers/_builtin/extension/codex/scripts/1.0/explore_chat_webview.js +0 -110
  106. package/providers/_builtin/extension/codex/scripts/1.0/explore_controls_webview.js +0 -75
  107. package/providers/_builtin/extension/codex/scripts/1.0/explore_dom.js +0 -58
  108. package/providers/_builtin/extension/codex/scripts/1.0/explore_dropdown_webview.js +0 -64
  109. package/providers/_builtin/extension/codex/scripts/1.0/inspect_code_webview.js +0 -55
  110. package/providers/_builtin/extension/codex/scripts/1.0/list_models.js +0 -63
  111. package/providers/_builtin/extension/codex/scripts/1.0/list_modes.js +0 -140
  112. package/providers/_builtin/extension/codex/scripts/1.0/message_structure_webview.js +0 -79
  113. package/providers/_builtin/extension/codex/scripts/1.0/new_session.js +0 -26
  114. package/providers/_builtin/extension/codex/scripts/1.0/read_chat.js +0 -516
  115. package/providers/_builtin/extension/codex/scripts/1.0/resolve_action.js +0 -82
  116. package/providers/_builtin/extension/codex/scripts/1.0/send_message.js +0 -42
  117. package/providers/_builtin/extension/codex/scripts/1.0/set_mode.js +0 -165
  118. package/providers/_builtin/extension/codex/scripts/1.0/set_model.js +0 -86
  119. package/providers/_builtin/extension/roo-code/provider.json +0 -37
  120. package/providers/_builtin/extension/roo-code/scripts/1.0/scripts.js +0 -82
  121. package/providers/_builtin/ide/antigravity/provider.json +0 -88
  122. package/providers/_builtin/ide/antigravity/scripts/1.0/focus_editor.js +0 -20
  123. package/providers/_builtin/ide/antigravity/scripts/1.0/list_chats.js +0 -137
  124. package/providers/_builtin/ide/antigravity/scripts/1.0/list_models.js +0 -61
  125. package/providers/_builtin/ide/antigravity/scripts/1.0/list_modes.js +0 -72
  126. package/providers/_builtin/ide/antigravity/scripts/1.0/new_session.js +0 -75
  127. package/providers/_builtin/ide/antigravity/scripts/1.0/read_chat.js +0 -352
  128. package/providers/_builtin/ide/antigravity/scripts/1.0/resolve_action.js +0 -63
  129. package/providers/_builtin/ide/antigravity/scripts/1.0/scripts.js +0 -67
  130. package/providers/_builtin/ide/antigravity/scripts/1.0/send_message.js +0 -56
  131. package/providers/_builtin/ide/antigravity/scripts/1.0/set_mode.js +0 -67
  132. package/providers/_builtin/ide/antigravity/scripts/1.0/set_model.js +0 -72
  133. package/providers/_builtin/ide/antigravity/scripts/1.0/switch_session.js +0 -114
  134. package/providers/_builtin/ide/cursor/provider.json +0 -70
  135. package/providers/_builtin/ide/cursor/scripts/1.0/dismiss_notification.js +0 -30
  136. package/providers/_builtin/ide/cursor/scripts/1.0/focus_editor.js +0 -13
  137. package/providers/_builtin/ide/cursor/scripts/1.0/list_models.js +0 -78
  138. package/providers/_builtin/ide/cursor/scripts/1.0/list_modes.js +0 -40
  139. package/providers/_builtin/ide/cursor/scripts/1.0/list_notifications.js +0 -23
  140. package/providers/_builtin/ide/cursor/scripts/1.0/list_sessions.js +0 -42
  141. package/providers/_builtin/ide/cursor/scripts/1.0/new_session.js +0 -20
  142. package/providers/_builtin/ide/cursor/scripts/1.0/open_panel.js +0 -23
  143. package/providers/_builtin/ide/cursor/scripts/1.0/read_chat.js +0 -318
  144. package/providers/_builtin/ide/cursor/scripts/1.0/resolve_action.js +0 -19
  145. package/providers/_builtin/ide/cursor/scripts/1.0/scripts.js +0 -78
  146. package/providers/_builtin/ide/cursor/scripts/1.0/send_message.js +0 -23
  147. package/providers/_builtin/ide/cursor/scripts/1.0/set_mode.js +0 -38
  148. package/providers/_builtin/ide/cursor/scripts/1.0/set_model.js +0 -81
  149. package/providers/_builtin/ide/cursor/scripts/1.0/switch_session.js +0 -28
  150. package/providers/_builtin/ide/kiro/provider.json +0 -68
  151. package/providers/_builtin/ide/kiro/scripts/1.0/focus_editor.js +0 -20
  152. package/providers/_builtin/ide/kiro/scripts/1.0/open_panel.js +0 -47
  153. package/providers/_builtin/ide/kiro/scripts/1.0/resolve_action.js +0 -54
  154. package/providers/_builtin/ide/kiro/scripts/1.0/send_message.js +0 -29
  155. package/providers/_builtin/ide/kiro/scripts/1.0/webview_dump_html.js +0 -1
  156. package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_models.js +0 -42
  157. package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_modes.js +0 -22
  158. package/providers/_builtin/ide/kiro/scripts/1.0/webview_list_sessions.js +0 -21
  159. package/providers/_builtin/ide/kiro/scripts/1.0/webview_new_session.js +0 -34
  160. package/providers/_builtin/ide/kiro/scripts/1.0/webview_read_chat.js +0 -161
  161. package/providers/_builtin/ide/kiro/scripts/1.0/webview_resolve_action.js +0 -62
  162. package/providers/_builtin/ide/kiro/scripts/1.0/webview_send_message.js +0 -94
  163. package/providers/_builtin/ide/kiro/scripts/1.0/webview_set_mode.js +0 -34
  164. package/providers/_builtin/ide/kiro/scripts/1.0/webview_set_model.js +0 -47
  165. package/providers/_builtin/ide/kiro/scripts/1.0/webview_switch_session.js +0 -26
  166. package/providers/_builtin/ide/pearai/.tmp/after_rich.json +0 -157
  167. package/providers/_builtin/ide/pearai/.tmp/after_rich_raw.json +0 -161
  168. package/providers/_builtin/ide/pearai/.tmp/after_switch.json +0 -592
  169. package/providers/_builtin/ide/pearai/.tmp/after_switch_raw.json +0 -596
  170. package/providers/_builtin/ide/pearai/.tmp/home_dump_raw.json +0 -176
  171. package/providers/_builtin/ide/pearai/.tmp/items_raw.json +0 -778
  172. package/providers/_builtin/ide/pearai/.tmp/webview_dump.json +0 -157
  173. package/providers/_builtin/ide/pearai/.tmp/webview_dump_raw.json +0 -161
  174. package/providers/_builtin/ide/pearai/provider.json +0 -71
  175. package/providers/_builtin/ide/pearai/scripts/1.0/focus_editor.js +0 -16
  176. package/providers/_builtin/ide/pearai/scripts/1.0/list_models.js +0 -45
  177. package/providers/_builtin/ide/pearai/scripts/1.0/list_modes.js +0 -44
  178. package/providers/_builtin/ide/pearai/scripts/1.0/list_sessions.js +0 -93
  179. package/providers/_builtin/ide/pearai/scripts/1.0/new_session.js +0 -38
  180. package/providers/_builtin/ide/pearai/scripts/1.0/open_panel.js +0 -23
  181. package/providers/_builtin/ide/pearai/scripts/1.0/read_chat.js +0 -169
  182. package/providers/_builtin/ide/pearai/scripts/1.0/resolve_action.js +0 -60
  183. package/providers/_builtin/ide/pearai/scripts/1.0/scripts.js +0 -111
  184. package/providers/_builtin/ide/pearai/scripts/1.0/send_message.js +0 -104
  185. package/providers/_builtin/ide/pearai/scripts/1.0/set_mode.js +0 -51
  186. package/providers/_builtin/ide/pearai/scripts/1.0/set_model.js +0 -54
  187. package/providers/_builtin/ide/pearai/scripts/1.0/switch_session.js +0 -81
  188. package/providers/_builtin/ide/trae/provider.json +0 -72
  189. package/providers/_builtin/ide/trae/scripts/1.0/focus_editor.js +0 -20
  190. package/providers/_builtin/ide/trae/scripts/1.0/list_chats.js +0 -24
  191. package/providers/_builtin/ide/trae/scripts/1.0/list_models.js +0 -39
  192. package/providers/_builtin/ide/trae/scripts/1.0/list_modes.js +0 -39
  193. package/providers/_builtin/ide/trae/scripts/1.0/new_session.js +0 -30
  194. package/providers/_builtin/ide/trae/scripts/1.0/open_panel.js +0 -44
  195. package/providers/_builtin/ide/trae/scripts/1.0/read_chat.js +0 -113
  196. package/providers/_builtin/ide/trae/scripts/1.0/resolve_action.js +0 -54
  197. package/providers/_builtin/ide/trae/scripts/1.0/scripts.js +0 -82
  198. package/providers/_builtin/ide/trae/scripts/1.0/send_message.js +0 -69
  199. package/providers/_builtin/ide/trae/scripts/1.0/set_mode.js +0 -15
  200. package/providers/_builtin/ide/trae/scripts/1.0/set_model.js +0 -15
  201. package/providers/_builtin/ide/trae/scripts/1.0/switch_session.js +0 -23
  202. package/providers/_builtin/ide/vscode/provider.json +0 -74
  203. package/providers/_builtin/ide/vscode/scripts/1.0/focus_editor.js +0 -1
  204. package/providers/_builtin/ide/vscode/scripts/1.0/list_models.js +0 -1
  205. package/providers/_builtin/ide/vscode/scripts/1.0/list_sessions.js +0 -1
  206. package/providers/_builtin/ide/vscode/scripts/1.0/new_session.js +0 -1
  207. package/providers/_builtin/ide/vscode/scripts/1.0/open_panel.js +0 -1
  208. package/providers/_builtin/ide/vscode/scripts/1.0/read_chat.js +0 -1
  209. package/providers/_builtin/ide/vscode/scripts/1.0/resolve_action.js +0 -1
  210. package/providers/_builtin/ide/vscode/scripts/1.0/scripts.js +0 -25
  211. package/providers/_builtin/ide/vscode/scripts/1.0/send_message.js +0 -1
  212. package/providers/_builtin/ide/vscode/scripts/1.0/set_model.js +0 -1
  213. package/providers/_builtin/ide/vscode/scripts/1.0/switch_session.js +0 -1
  214. package/providers/_builtin/ide/vscode-insiders/provider.json +0 -68
  215. package/providers/_builtin/ide/vscodium/provider.json +0 -69
  216. package/providers/_builtin/ide/windsurf/provider.json +0 -57
  217. package/providers/_builtin/ide/windsurf/scripts/1.0/focus_editor.js +0 -36
  218. package/providers/_builtin/ide/windsurf/scripts/1.0/list_chats.js +0 -23
  219. package/providers/_builtin/ide/windsurf/scripts/1.0/list_models.js +0 -56
  220. package/providers/_builtin/ide/windsurf/scripts/1.0/list_modes.js +0 -63
  221. package/providers/_builtin/ide/windsurf/scripts/1.0/list_sessions.js +0 -79
  222. package/providers/_builtin/ide/windsurf/scripts/1.0/new_session.js +0 -58
  223. package/providers/_builtin/ide/windsurf/scripts/1.0/open_panel.js +0 -67
  224. package/providers/_builtin/ide/windsurf/scripts/1.0/read_chat.js +0 -253
  225. package/providers/_builtin/ide/windsurf/scripts/1.0/resolve_action.js +0 -82
  226. package/providers/_builtin/ide/windsurf/scripts/1.0/scripts.js +0 -82
  227. package/providers/_builtin/ide/windsurf/scripts/1.0/send_message.js +0 -20
  228. package/providers/_builtin/ide/windsurf/scripts/1.0/set_mode.js +0 -43
  229. package/providers/_builtin/ide/windsurf/scripts/1.0/set_model.js +0 -49
  230. package/providers/_builtin/ide/windsurf/scripts/1.0/switch_session.js +0 -82
  231. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/focus_editor.js +0 -30
  232. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_chats.js +0 -117
  233. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_models.js +0 -39
  234. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/list_modes.js +0 -39
  235. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/new_session.js +0 -69
  236. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/open_panel.js +0 -58
  237. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/read_chat.js +0 -315
  238. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/resolve_action.js +0 -68
  239. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/scripts.js +0 -82
  240. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/send_message.js +0 -87
  241. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/set_mode.js +0 -15
  242. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/set_model.js +0 -15
  243. package/providers/_builtin/ide/windsurf/scripts/1.0.bak/switch_session.js +0 -58
  244. package/providers/_builtin/registry.json +0 -376
  245. package/providers/_builtin/validate.js +0 -156
@@ -1,79 +0,0 @@
1
- /**
2
- * Windsurf v1 — list_sessions
3
- *
4
- * Cascade session get list.
5
- * 1. top tabs ([id^="cascade-tab-"])
6
- * 2. history panel ([data-kb-navigate="true"])
7
- */
8
- (async () => {
9
- try {
10
- const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
11
- const isVisible = (el) => !!(el && el.offsetWidth > 0 && el.offsetHeight > 0);
12
- const cascade = document.querySelector('#windsurf\\.cascadePanel') || document.querySelector('.chat-client-root');
13
- if (!cascade) return JSON.stringify({ sessions: [] });
14
-
15
- const normalize = (text) => (text || '').replace(/\s+/g, ' ').trim();
16
- const activeTabEl = document.querySelector('[id^="cascade-tab-"] .bg-ide-tab-active-background-color');
17
- const activeTabTitle = normalize(activeTabEl?.textContent || document.querySelector('.bg-ide-tab-active-background-color .truncate')?.textContent || '');
18
-
19
- const sessions = [];
20
- const seenIds = new Set();
21
- const seenTitles = new Set();
22
-
23
- // 1. top tabs
24
- const tabs = Array.from(document.querySelectorAll('[id^="cascade-tab-"]')).filter(isVisible);
25
- for (const tab of tabs) {
26
- const fullId = tab.id || '';
27
- const id = fullId.replace('cascade-tab-', '');
28
- const title = normalize(tab.textContent);
29
- if (!title || title === 'New Cascade') continue;
30
-
31
- // Check active status: specific class or internal element class or ARIA attribute
32
- const isActive = tab.classList.contains('bg-ide-tab-active-background-color') ||
33
- !!tab.querySelector('.bg-ide-tab-active-background-color') ||
34
- tab.getAttribute('aria-selected') === 'true';
35
-
36
- seenIds.add(id);
37
- seenTitles.add(title.toLowerCase());
38
- sessions.push({
39
- id,
40
- title,
41
- active: isActive,
42
- index: sessions.length
43
- });
44
- }
45
-
46
- // 2. history panel
47
- const historyButton = Array.from(cascade.querySelectorAll('button')).find(el => isVisible(el) && /lucide-history/.test(el.innerHTML || ''));
48
- const existingPanel = Array.from(cascade.querySelectorAll('div')).find(el => isVisible(el) && (String(el.className || '').includes('group/panel') || el.hasAttribute('data-kb-navigate')));
49
- const wasOpen = !!existingPanel;
50
-
51
- if (!wasOpen && historyButton) {
52
- historyButton.click();
53
- await wait(300);
54
- }
55
-
56
- const historyRows = Array.from(document.querySelectorAll('[data-kb-navigate="true"]')).filter(isVisible);
57
- for (const row of historyRows) {
58
- const title = normalize(row.querySelector('.truncate, span')?.textContent || row.textContent);
59
- if (!title || seenTitles.has(title.toLowerCase())) continue;
60
-
61
- seenTitles.add(title.toLowerCase());
62
- sessions.push({
63
- id: title.toLowerCase().replace(/[^a-z0-9]+/g, '-'),
64
- title,
65
- active: title === activeTabTitle,
66
- index: sessions.length
67
- });
68
- }
69
-
70
- if (!wasOpen && historyButton) {
71
- document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', code: 'Escape', keyCode: 27, which: 27, bubbles: true, cancelable: true }));
72
- }
73
-
74
- return JSON.stringify({ sessions });
75
- } catch (e) {
76
- return JSON.stringify({ sessions: [], error: e.message });
77
- }
78
- })()
79
-
@@ -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
- })