@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,72 +0,0 @@
1
- /**
2
- * Antigravity — list_modes
3
- * Current mode + use Mode list extract
4
- *
5
- * Version compatibility:
6
- * v0 (old): span-based mode button (plain text, no opacity class)
7
- * v1 (new): BUTTON element with py-1 pl-1 pr-2 opacity-70 classes
8
- * Both: "Conversation mode" panel with .font-medium items (when dropdown open)
9
- *
10
- * → { modes: string[], current: string }
11
- */
12
- (() => {
13
- try {
14
- const modes = [];
15
- let current = '';
16
-
17
- // ── Helper: find mode trigger button (v0 + v1 compat) ────────────────
18
- function findModeTrigger() {
19
- // v1: BUTTON with opacity-70 + py-1 pl-1 pr-2
20
- const v1 = [...document.querySelectorAll('button')].find(b => {
21
- const cls = b.className || '';
22
- return cls.includes('py-1') &&
23
- cls.includes('pl-1') &&
24
- cls.includes('pr-2') &&
25
- cls.includes('opacity-70') &&
26
- b.offsetWidth > 0;
27
- });
28
- if (v1) return v1;
29
-
30
- // v0: span/button with py-1 pl-1 pr-2 (without opacity-70)
31
- return [...document.querySelectorAll('button, span')].find(b => {
32
- const cls = b.className || '';
33
- return cls.includes('py-1') &&
34
- cls.includes('pl-1') &&
35
- cls.includes('pr-2') &&
36
- b.offsetWidth > 0 &&
37
- // ensure it's in the model/mode area (not some other button)
38
- (b.textContent?.trim() === 'Fast' || b.textContent?.trim() === 'Planning' || b.textContent?.trim() === 'Normal');
39
- }) || null;
40
- }
41
-
42
- // ── Step 1: "Conversation mode" panel open — extract items ───────────
43
- const headers = document.querySelectorAll('.text-xs.px-2.pb-1.opacity-80');
44
- for (const header of headers) {
45
- if (header.textContent?.trim() === 'Conversation mode') {
46
- const parent = header.parentElement;
47
- if (!parent) continue;
48
- const items = parent.querySelectorAll('.font-medium');
49
- for (const item of items) {
50
- const text = item.textContent?.trim();
51
- if (text && text.length < 20) modes.push(text);
52
- }
53
- break;
54
- }
55
- }
56
-
57
- // ── Step 2: Read current mode from trigger button ─────────────────────
58
- const modeBtn = findModeTrigger();
59
- if (modeBtn) {
60
- current = modeBtn.textContent?.trim() || '';
61
- }
62
-
63
- // ── Fallback: default modes ───────────────────────────────────────────
64
- if (modes.length === 0) {
65
- modes.push('Planning', 'Fast');
66
- }
67
-
68
- return JSON.stringify({ modes, current });
69
- } catch (e) {
70
- return JSON.stringify({ modes: [], current: '', error: e.message });
71
- }
72
- })()
@@ -1,75 +0,0 @@
1
- /**
2
- * Antigravity v1 — new_session
3
- *
4
- * Antigravity Agent panel + icon by clicking new conversation start.
5
- *
6
- * DOM structure:
7
- * .antigravity-agent-side-panel top icon bar
8
- * [0] <a> + (Plus) → new conversation ← click
9
- * [1] <a> history (data-past-conversations-toggle)
10
- * [2] <div> more (⋯)
11
- * [3] <a> close (✕)
12
- *
13
- * strategy:
14
- * 1. Previous sibling of history toggle <a> click (Plus icon)
15
- * 2. Find SVG path "M12 4.5v15m7.5-7.5h-15" (+ shape)
16
- * 3. panel <a> click fallback
17
- *
18
- * final Check: 2026-03-11
19
- */
20
- (() => {
21
- try {
22
- // ─── 1. Previous sibling of history toggle (Plus icon) ───
23
- const toggle = document.querySelector('[data-past-conversations-toggle="true"]');
24
- if (toggle) {
25
- const parent = toggle.parentElement;
26
- if (parent) {
27
- const children = Array.from(parent.children).filter(c => c.offsetWidth > 0);
28
- const toggleIdx = children.indexOf(toggle);
29
- // Plus icon is right before history
30
- if (toggleIdx > 0) {
31
- const plusBtn = children[toggleIdx - 1];
32
- plusBtn.click();
33
- return 'clicked (sibling of toggle)';
34
- }
35
- }
36
- }
37
-
38
- // ─── 2. SVG path based: Plus(+) shape SVG ───
39
- const panel = document.querySelector('.antigravity-agent-side-panel') || document.querySelector('#conversation');
40
- if (panel) {
41
- const svgs = panel.querySelectorAll('svg');
42
- for (const svg of svgs) {
43
- const path = svg.querySelector('path');
44
- if (path) {
45
- const d = path.getAttribute('d') || '';
46
- // Plus icon SVG: +
47
- if (d.includes('v15') && d.includes('h-15')) {
48
- const clickable = svg.closest('a') || svg.closest('button') || svg.parentElement;
49
- if (clickable) {
50
- clickable.click();
51
- return 'clicked (svg plus)';
52
- }
53
- }
54
- }
55
- }
56
- }
57
-
58
- // ─── 3. fallback: panel area <a> ───
59
- if (panel) {
60
- const topLinks = Array.from(panel.querySelectorAll('a')).filter(a => {
61
- const r = a.getBoundingClientRect();
62
- const pr = panel.getBoundingClientRect();
63
- return r.y < pr.y + 30 && a.offsetWidth > 0 && a.offsetWidth < 30;
64
- });
65
- if (topLinks.length > 0) {
66
- topLinks[0].click();
67
- return 'clicked (first top link)';
68
- }
69
- }
70
-
71
- return 'no new session button found';
72
- } catch (e) {
73
- return 'error: ' + e.message;
74
- }
75
- })()
@@ -1,352 +0,0 @@
1
- /**
2
- * Antigravity v1 — read_chat (v4 — scroll , area )
3
- *
4
- * :
5
- * - scrollis ( )
6
- * - use ignore
7
- * - current (latest )
8
- *
9
- * DOM structure:
10
- * User: bg-gray-500/15 + select-text + p-2, inside whitespace-pre-wrap
11
- * : .leading-relaxed.select-text
12
- */
13
- (() => {
14
- try {
15
- const conv = document.querySelector('#conversation') || document.querySelector('.antigravity-agent-side-panel') || document.body;
16
- const scroll = conv.querySelector('.overflow-y-auto') || conv;
17
-
18
- // 1. status detection — Based on Send/Stop button at bottom of sidebar (prevent false positives)
19
- let status = 'idle';
20
-
21
- // A (1st priority): Red Stop square (.bg-red-500) — generating displayed when generating
22
- const stopSquare = conv.querySelector('[class*="bg-red-500"]') || conv.querySelector('button[class*="rounded"] [class*="bg-red"]');
23
- if (stopSquare && stopSquare.offsetWidth > 0) {
24
- status = 'generating';
25
- }
26
-
27
- // Signal B: conv inside animate-markdown (create markdown rendering during creation)
28
- if (status === 'idle') {
29
- const animMarkdown = scroll.querySelector('.leading-relaxed [class*="animate-markdown"]');
30
- if (animMarkdown && animMarkdown.offsetWidth > 0) status = 'generating';
31
- }
32
-
33
- const titleParts = document.title.split(' \u2014 ');
34
- const title = (titleParts.length >= 2 ? titleParts[titleParts.length - 1] : titleParts[0] || '').trim() || 'Active Session';
35
-
36
- // ─── HTML → Markdown converter (Dashboard uses ReactMarkdown+remarkGfm) ───
37
- // extractCodeText: layout-independent code text extraction
38
- // Works on cloneNode'd (detached) elements where innerText == textContent
39
- // Walks child nodes and inserts \n between block-level elements (DIV, P, etc.)
40
- const BLOCK_TAGS = new Set(['DIV', 'P', 'BR', 'LI', 'TR', 'SECTION', 'ARTICLE', 'HEADER', 'FOOTER']);
41
- function extractCodeText(node) {
42
- if (node.nodeType === 3) return node.textContent || '';
43
- if (node.nodeType !== 1) return '';
44
- if (node.tagName === 'BR') return '\n';
45
- const parts = [];
46
- for (const child of node.childNodes) {
47
- const isBlock = child.nodeType === 1 && BLOCK_TAGS.has(child.tagName);
48
- const text = extractCodeText(child);
49
- if (text) {
50
- if (isBlock && parts.length > 0) parts.push('\n');
51
- parts.push(text);
52
- if (isBlock) parts.push('\n');
53
- }
54
- }
55
- // Collapse multiple consecutive newlines into single \n
56
- return parts.join('').replace(/\n{2,}/g, '\n');
57
- }
58
- function htmlToMd(node) {
59
- if (node.nodeType === 3) return node.textContent || '';
60
- if (node.nodeType !== 1) return '';
61
- const tag = node.tagName;
62
-
63
- // Remove styles/scripts
64
- if (tag === 'STYLE' || tag === 'SCRIPT' || tag === 'SVG') return '';
65
-
66
- // Table → GFM
67
- if (tag === 'TABLE') {
68
- const rows = Array.from(node.querySelectorAll('tr'));
69
- if (rows.length === 0) return '';
70
- const table = rows.map(tr =>
71
- Array.from(tr.querySelectorAll('th, td')).map(cell => (cell.textContent || '').trim().replace(/\|/g, '\\|'))
72
- );
73
- if (table.length === 0) return '';
74
- const colCount = Math.max(...table.map(r => r.length));
75
- const header = table[0];
76
- const sep = Array(colCount).fill('---');
77
- const body = table.slice(1);
78
- let md = '| ' + header.join(' | ') + ' |\n';
79
- md += '| ' + sep.join(' | ') + ' |\n';
80
- for (const row of body) {
81
- while (row.length < colCount) row.push('');
82
- md += '| ' + row.join(' | ') + ' |\n';
83
- }
84
- return '\n' + md + '\n';
85
- }
86
-
87
- if (tag === 'UL') return '\n' + Array.from(node.children).map(li => '- ' + childrenToMd(li).trim()).join('\n') + '\n';
88
- if (tag === 'OL') return '\n' + Array.from(node.children).map((li, i) => (i + 1) + '. ' + childrenToMd(li).trim()).join('\n') + '\n';
89
- if (tag === 'LI') return childrenToMd(node);
90
-
91
- if (tag === 'H1') return '\n# ' + childrenToMd(node).trim() + '\n';
92
- if (tag === 'H2') return '\n## ' + childrenToMd(node).trim() + '\n';
93
- if (tag === 'H3') return '\n### ' + childrenToMd(node).trim() + '\n';
94
- if (tag === 'H4') return '\n#### ' + childrenToMd(node).trim() + '\n';
95
-
96
- if (tag === 'STRONG' || tag === 'B') return '**' + childrenToMd(node).trim() + '**';
97
- if (tag === 'EM' || tag === 'I') return '*' + childrenToMd(node).trim() + '*';
98
-
99
- if (tag === 'PRE') {
100
- const codeEl = node.querySelector('code');
101
- const lang = codeEl ? (codeEl.className.match(/language-(\w+)/)?.[1] || '') : '';
102
- // Custom extraction: walk child nodes and insert \n between block elements
103
- // This works on cloneNode'd elements (no layout → innerText == textContent)
104
- const code = extractCodeText(codeEl || node);
105
- return '\n```' + lang + '\n' + code.trim() + '\n```\n';
106
- }
107
- if (tag === 'CODE') {
108
- if (node.parentElement && node.parentElement.tagName === 'PRE') return node.textContent || '';
109
- return '`' + (node.textContent || '').trim() + '`';
110
- }
111
-
112
- if (tag === 'BLOCKQUOTE') return '\n> ' + childrenToMd(node).trim().replace(/\n/g, '\n> ') + '\n';
113
- if (tag === 'A') return '[' + childrenToMd(node).trim() + '](' + (node.getAttribute('href') || '') + ')';
114
- if (tag === 'BR') return '\n';
115
- if (tag === 'P') return '\n' + childrenToMd(node).trim() + '\n';
116
-
117
- return childrenToMd(node);
118
- }
119
- function childrenToMd(node) {
120
- return Array.from(node.childNodes).map(htmlToMd).join('');
121
- }
122
-
123
- function getCleanMd(el) {
124
- const clone = el.cloneNode(true);
125
- // Remove noise
126
- clone.querySelectorAll('button, [role="button"], style, script, svg, .codicon, [class*="feedback"], [aria-label*="Good"], [aria-label*="Bad"]').forEach(n => n.remove());
127
- // Remove status text (leaf only, 60 chars or less)
128
- clone.querySelectorAll('*').forEach(child => {
129
- if (!child.parentNode) return;
130
- const t = (child.textContent || '').trim();
131
- if (t.length > 60) return;
132
- const low = t.toLowerCase();
133
- if (/^(analyzed\s+\d|edited\s+\d|ran\s+\S|terminal\s|reading|searching)/i.test(low)) child.remove();
134
- if (/^(mcp|customizationmcp|serversexport)/i.test(low)) child.remove();
135
- });
136
- let md = htmlToMd(clone);
137
- // Remove "Thought for X seconds"
138
- md = md.replace(/^Thought for\s+[\d.]+\s*(seconds?|s)\s*/i, '');
139
- md = md.replace(/\n{3,}/g, '\n\n').trim();
140
- return md;
141
- }
142
-
143
- // 2. Collect messages (scroll No manipulation — current DOMonly those in)
144
- const collected = [];
145
- const seenHashes = new Set();
146
-
147
- // use (bg-gray-500/15 + select-text + p-2)
148
- const allDivs = scroll.querySelectorAll('div');
149
- for (const el of allDivs) {
150
- const cls = (el.className || '');
151
- if (typeof cls !== 'string') continue;
152
- if (cls.includes('bg-gray-500/15') && cls.includes('select-text') && cls.includes('p-2')) {
153
- const textEl = el.querySelector('[class*="whitespace-pre-wrap"]') || el;
154
- const text = (textEl.innerText || '').trim();
155
- if (!text || text.length < 1) continue;
156
- const hash = 'user:' + text.slice(0, 200);
157
- if (seenHashes.has(hash)) continue;
158
- seenHashes.add(hash);
159
- collected.push({ role: 'user', text, el, kind: 'standard' });
160
- }
161
- }
162
-
163
- // (leading-relaxed.select-text) — HTML→Markdown conversion
164
- const assistantBlocks = scroll.querySelectorAll('.leading-relaxed.select-text');
165
- for (const ab of assistantBlocks) {
166
- if (ab.offsetHeight < 10) continue;
167
- if (ab.closest('[class*="max-h-"][class*="overflow-y-auto"]')) continue;
168
- // Exclude blocks inside Thought (collected separately as thinking)
169
- if (ab.closest('.isolate')?.querySelector('button')?.textContent?.startsWith('Thought for')) continue;
170
-
171
- let text = getCleanMd(ab);
172
- if (!text || text.length < 2) continue;
173
- if (/^(Running command|Checked command|collectStatus)/i.test(text)) continue;
174
-
175
- const hash = 'assistant:' + text.slice(0, 200);
176
- if (seenHashes.has(hash)) continue;
177
- seenHashes.add(hash);
178
- collected.push({ role: 'assistant', text, el: ab, kind: 'standard' });
179
- }
180
-
181
- // ─── Thought collection (AI thought process) ───
182
- const thoughtBtns = scroll.querySelectorAll('button');
183
- for (const btn of thoughtBtns) {
184
- const label = (btn.textContent || '').trim();
185
- if (!label.startsWith('Thought for')) continue;
186
- const sibling = btn.nextElementSibling;
187
- if (!sibling) continue;
188
- // Actual thinking text is in .leading-relaxed.select-text inside sibling
189
- const contentEl = sibling.querySelector('.leading-relaxed.select-text');
190
- if (!contentEl) continue;
191
- const clone = contentEl.cloneNode(true);
192
- clone.querySelectorAll('button, svg, style, script, [role="button"]').forEach(n => n.remove());
193
- const thinkText = (clone.innerText || clone.textContent || '').trim();
194
- if (!thinkText || thinkText.length < 5) continue;
195
- const hash = 'think:' + thinkText.slice(0, 200);
196
- if (seenHashes.has(hash)) continue;
197
- seenHashes.add(hash);
198
- // Pass plain text only (markdown format handled by frontend)
199
- collected.push({ role: 'assistant', text: thinkText.slice(0, 3000), el: btn, kind: 'thought', meta: { label } });
200
- }
201
-
202
- // ─── Terminal/Tool Call collection (command execute result) ───
203
- const termHeaders = scroll.querySelectorAll('div.mb-1.px-2.py-1');
204
- for (const h of termHeaders) {
205
- const spanEl = h.querySelector('span');
206
- const label = (spanEl?.textContent || '').trim();
207
- if (!label.match(/^(Ran|Running) command/i)) continue;
208
- const parent = h.parentElement;
209
- if (!parent) continue;
210
- const pre = parent.querySelector('pre');
211
- const cmdText = (pre?.textContent || '').trim();
212
- if (!cmdText || cmdText.length < 2) continue;
213
- const hash = 'term:' + cmdText.slice(0, 200);
214
- if (seenHashes.has(hash)) continue;
215
- seenHashes.add(hash);
216
- // Pass plain text only (labels/icons handled by frontend)
217
- const isRunning = label.startsWith('Running');
218
- collected.push({ role: 'assistant', text: cmdText.slice(0, 3000), el: h, kind: 'terminal', meta: { label, isRunning } });
219
- }
220
-
221
- // ─── Tool Call summary collection (Searched, Analyzed, Edited ) ───
222
- const toolDivs = scroll.querySelectorAll('div[data-tooltip-id]');
223
- for (const td of toolDivs) {
224
- const cls = (td.className || '').toString();
225
- if (!cls.includes('cursor-pointer') || !cls.includes('text-sm')) continue;
226
- // Read per-span and join with spaces (textContent "SearchedDevServer"attached like)
227
- const spans = td.querySelectorAll('span');
228
- const text = spans.length > 0
229
- ? Array.from(spans).map(s => (s.textContent || '').trim()).filter(Boolean).join(' ')
230
- : (td.textContent || '').trim();
231
- if (!text.match(/^(Searched|Analyzed|Edited|Read|Viewed|Created|Listed|Checked)/)) continue;
232
- if (text.length > 120) continue;
233
- const hash = 'tool:' + text;
234
- if (seenHashes.has(hash)) continue;
235
- seenHashes.add(hash);
236
- // Concise one-line summary
237
- collected.push({ role: 'assistant', text: text, el: td, kind: 'tool' });
238
- }
239
-
240
- // 3. DOM Order sorting
241
- collected.sort((a, b) => {
242
- const pos = a.el.compareDocumentPosition(b.el);
243
- if (pos & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
244
- if (pos & Node.DOCUMENT_POSITION_PRECEDING) return 1;
245
- return 0;
246
- });
247
-
248
- // latest 50only keep (thinking/tool_use increased to include)
249
- const trimmed = collected.length > 50 ? collected.slice(-50) : collected;
250
-
251
- const final = trimmed.map((m, i) => ({
252
- id: 'msg_' + i,
253
- role: m.role,
254
- content: m.text.length > 6000 ? m.text.slice(0, 6000) + '\n[... truncated]' : m.text,
255
- index: i,
256
- kind: m.kind || 'standard',
257
- meta: m.meta || undefined,
258
- vsc_history: true
259
- }));
260
-
261
- // 4. input field
262
- const editor = conv.querySelector('[contenteditable="true"][role="textbox"]') ||
263
- conv.querySelector('[data-lexical-editor="true"]') ||
264
- conv.querySelector('textarea');
265
- const inputContent = editor ? (editor.innerText || editor.value || '').trim() : '';
266
-
267
- // 5. modal/approval detect — Run⌥⏎/Reject + Deny/Allow browser approval
268
- let activeModal = null;
269
- try {
270
- // Strip Mac symbols and Windows shortcut labels (e.g. "RunAlt+⏎" → "Run")
271
- const stripShortcut = (s) => s
272
- .replace(/[⌥⏎⇧⌫⌘⌃↵]/g, '')
273
- .replace(/\s*(Alt|Ctrl|Shift|Cmd|Enter|Return|Esc|Tab|Backspace)(\+\s*\w+)*/gi, '')
274
- .trim();
275
- const isApprovalLike = (el) => {
276
- const raw = (el.textContent || '').trim();
277
- const t = stripShortcut(raw).toLowerCase();
278
- // Exclude dropdown options
279
- if (t === 'ask every time') return false;
280
- return /^(run|reject|skip|approve|allow|deny|cancel|accept|yes|no)\b/i.test(t)
281
- || t === 'always allow' || t === 'always deny'
282
- || t.includes('run ') || t.includes('approve') || t.includes('reject')
283
- || t.includes('skip');
284
- };
285
- // A: modal
286
- const dialog = document.querySelector('.monaco-dialog-box, [role="dialog"], .monaco-modal-block');
287
- if (dialog && dialog.offsetWidth > 80 && dialog.offsetHeight > 40) {
288
- const msg = (dialog.querySelector('.dialog-message, .dialog-message-text') || dialog).innerText?.trim() || '';
289
- const buttons = Array.from(dialog.querySelectorAll('.monaco-button, button'))
290
- .map(b => (b.innerText || '').trim())
291
- .filter(t => t.length > 0 && t.length < 30);
292
- if (msg || buttons.length > 0) {
293
- activeModal = { message: msg.slice(0, 300), buttons, width: dialog.offsetWidth, height: dialog.offsetHeight };
294
- }
295
- }
296
- // B: approval button (Run⌥⏎, Reject, Deny, Allow )
297
- // ⚠ Only check buttons inside sidebar (conv) — exclude editor Accept/Reject Changes
298
- if (!activeModal) {
299
- const panelBtns = Array.from(conv.querySelectorAll('button')).filter(b => b.offsetWidth > 0 && b.offsetHeight > 0);
300
- const approvalBtns = panelBtns.filter(isApprovalLike);
301
- if (approvalBtns.length > 0) {
302
- const hasActionBtn = approvalBtns.some(b => {
303
- const t = stripShortcut((b.textContent || '').trim()).toLowerCase();
304
- return /^(run|reject|skip|deny|allow|accept|approve|yes|no)\b/.test(t)
305
- || t === 'always allow' || t === 'always deny';
306
- });
307
- if (hasActionBtn) {
308
- const btnTexts = [...new Set(
309
- approvalBtns.map(b => (b.textContent || '').trim())
310
- .filter(t => t.length > 0 && t.length < 40)
311
- )];
312
- const firstApproval = approvalBtns[0];
313
- let wrapper = firstApproval.parentElement;
314
- for (let up = 0; up < 5 && wrapper; up++, wrapper = wrapper.parentElement) {
315
- if (wrapper.offsetHeight > 40) break;
316
- }
317
- const msg = wrapper ? (wrapper.textContent || '').trim().slice(0, 300) : '';
318
- activeModal = { message: msg, buttons: btnTexts, width: 400, height: 100 };
319
- }
320
- }
321
- }
322
- // C: footer based usage/quota (Dismiss / See Plans / Enable Overages )
323
- // <footer> element conv exists 2 button considered a card requiring user action
324
- if (!activeModal) {
325
- const footers = Array.from(conv.querySelectorAll('footer')).filter(f => f.offsetWidth > 0 && f.offsetHeight > 0);
326
- for (const footer of footers) {
327
- const footerBtns = Array.from(footer.querySelectorAll('button, a')).filter(b => b.offsetWidth > 0);
328
- if (footerBtns.length >= 2) {
329
- // Card Container: First element with sufficient height above footer
330
- let card = footer.parentElement;
331
- for (let up = 0; up < 4 && card; up++) {
332
- if (card.offsetHeight > 60) break;
333
- card = card.parentElement;
334
- }
335
- const msg = card ? (card.innerText || '').trim().slice(0, 300) : '';
336
- const btnTexts = footerBtns.map(b => (b.innerText || '').trim()).filter(t => t.length > 0 && t.length < 40);
337
- if (btnTexts.length >= 2) {
338
- activeModal = { message: msg, buttons: btnTexts, width: card ? card.offsetWidth : 300, height: card ? card.offsetHeight : 100 };
339
- break;
340
- }
341
- }
342
- }
343
- }
344
- // If modal detected, change status to waiting_approval
345
- if (activeModal) status = 'waiting_approval';
346
- } catch (e) { activeModal = null; }
347
-
348
- return { id: 'active_session', status, title, messages: final, inputContent, activeModal };
349
- } catch (e) {
350
- return { id: 'error', status: 'error', error: e.message, messages: [] };
351
- }
352
- })()
@@ -1,63 +0,0 @@
1
- /**
2
- * Antigravity v1 — resolve_action
3
- *
4
- * scroll bottom → scrollIntoView → .click()
5
- * Parameter: ${BUTTON_TEXT}
6
- */
7
- (() => {
8
- const want = ${ BUTTON_TEXT };
9
- const wantNorm = (want || '').replace(/\s+/g, ' ').trim().toLowerCase();
10
-
11
- function norm(t) { return (t || '').replace(/\s+/g, ' ').trim().toLowerCase(); }
12
-
13
- function matches(el) {
14
- const raw = (el.textContent || '').trim();
15
- const t = norm(raw);
16
- if (!t || t.length > 80) return false;
17
- if (t === wantNorm) return true;
18
- if (t.indexOf(wantNorm) === 0) return true;
19
- if (wantNorm.indexOf(t) >= 0 && t.length > 2) return true;
20
- if (t.indexOf(wantNorm) >= 0) return true;
21
- if (/^(run|approve|allow|accept|always|yes)\b/.test(wantNorm)) {
22
- if (/^run\b/.test(t)) return true;
23
- if (/^allow\b/.test(t)) return true;
24
- if (/^accept\b/.test(t) && !t.includes('changes')) return true;
25
- if (/^always\b/.test(t)) return true;
26
- }
27
- if (/^(reject|deny|no|abort)\b/.test(wantNorm)) {
28
- if (/^reject\b/.test(t) && !t.includes('changes')) return true;
29
- if (/^deny\b/.test(t)) return true;
30
- }
31
- if (/^(skip|cancel)\b/.test(wantNorm)) {
32
- if (/^skip\b/.test(t) || /^cancel\b/.test(t)) return true;
33
- }
34
- return false;
35
- }
36
-
37
- // 1. chat panel scroll bottom
38
- const conv = document.querySelector('.antigravity-agent-side-panel') || document.querySelector('#conversation');
39
- const scrollEl = conv ? (conv.querySelector('.overflow-y-auto') || conv) : null;
40
- if (scrollEl) scrollEl.scrollTop = scrollEl.scrollHeight;
41
-
42
- // 2. viewport all visible in DOM without filter button
43
- const sel = 'button, [role="button"]';
44
- const allBtns = [...document.querySelectorAll(sel)].filter(b => b.offsetWidth > 0 && b.offsetHeight > 0);
45
-
46
- // last(latest) matching first —
47
- let found = null;
48
- for (let i = allBtns.length - 1; i >= 0; i--) {
49
- if (matches(allBtns[i])) {
50
- found = allBtns[i];
51
- break;
52
- }
53
- }
54
-
55
- if (found) {
56
- const text = found.textContent?.trim()?.substring(0, 40);
57
- // buttonscroll to make visible then click
58
- try { found.scrollIntoView({ block: 'nearest' }); } catch (_) {}
59
- try { found.click(); } catch (_) {}
60
- return JSON.stringify({ resolved: true, clicked: text });
61
- }
62
- return JSON.stringify({ found: false, want: wantNorm });
63
- })()
@@ -1,67 +0,0 @@
1
- /**
2
- * Antigravity CDP Scripts
3
- *
4
- * Version routing is handled by ProviderLoader:
5
- * - provider.json "versions" field declares script directory overrides
6
- * - VersionArchive detects installed Antigravity version at daemon startup
7
- * - resolve() picks scripts/legacy/ for < 1.107.0, scripts/ for >= 1.107.0
8
- *
9
- * To add support for a new breaking version:
10
- * 1. Create scripts/v<next>/ with updated scripts
11
- * 2. Add entry to provider.json "versions" field:
12
- * "< X.Y.Z": { "__dir": "scripts/v<next>" }
13
- * 3. Update "testedVersions" in provider.json
14
- */
15
-
16
- 'use strict';
17
-
18
- const fs = require('fs');
19
- const path = require('path');
20
- const DIR = __dirname; // scripts/1.107/
21
-
22
- function load(name) {
23
- try { return fs.readFileSync(path.join(DIR, name), 'utf-8'); }
24
- catch { return null; }
25
- }
26
-
27
- module.exports.readChat = () => load('read_chat.js');
28
- module.exports.focusEditor = () => load('focus_editor.js');
29
- module.exports.listSessions = () => load('list_chats.js');
30
- module.exports.newSession = () => load('new_session.js');
31
- module.exports.listModels = () => load('list_models.js');
32
- module.exports.listModes = () => load('list_modes.js');
33
-
34
- module.exports.sendMessage = (text) => {
35
- const script = load('send_message.js');
36
- if (!script) return null;
37
- return script.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text));
38
- };
39
-
40
- module.exports.switchSession = (sessionId) => {
41
- const script = load('switch_session.js');
42
- if (!script) return null;
43
- return script.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId));
44
- };
45
-
46
- module.exports.resolveAction = (params) => {
47
- const action = typeof params === 'string' ? params : params?.action || 'approve';
48
- const buttonText = params?.button || params?.buttonText
49
- || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
50
- const script = load('resolve_action.js');
51
- if (!script) return null;
52
- return script.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText));
53
- };
54
-
55
- module.exports.setModel = (params) => {
56
- const model = typeof params === 'string' ? params : params?.model;
57
- const script = load('set_model.js');
58
- if (!script) return null;
59
- return script.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model));
60
- };
61
-
62
- module.exports.setMode = (params) => {
63
- const mode = typeof params === 'string' ? params : params?.mode;
64
- const script = load('set_mode.js');
65
- if (!script) return null;
66
- return script.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode));
67
- };