adhdev 0.1.51 → 0.1.53

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 (46) hide show
  1. package/dist/index.js +390 -40
  2. package/package.json +1 -1
  3. package/providers/_builtin/ide/antigravity/scripts/read_chat.js +22 -0
  4. package/providers/_builtin/ide/kiro/provider.js +25 -1
  5. package/providers/_builtin/ide/kiro/scripts/focus_editor.js +20 -0
  6. package/providers/_builtin/ide/kiro/scripts/open_panel.js +47 -0
  7. package/providers/_builtin/ide/kiro/scripts/resolve_action.js +54 -0
  8. package/providers/_builtin/ide/kiro/scripts/send_message.js +29 -0
  9. package/providers/_builtin/ide/kiro/scripts/webview_list_models.js +39 -0
  10. package/providers/_builtin/ide/kiro/scripts/webview_list_modes.js +39 -0
  11. package/providers/_builtin/ide/kiro/scripts/webview_list_sessions.js +21 -0
  12. package/providers/_builtin/ide/kiro/scripts/webview_new_session.js +34 -0
  13. package/providers/_builtin/ide/kiro/scripts/webview_read_chat.js +68 -0
  14. package/providers/_builtin/ide/kiro/scripts/webview_set_mode.js +15 -0
  15. package/providers/_builtin/ide/kiro/scripts/webview_set_model.js +15 -0
  16. package/providers/_builtin/ide/kiro/scripts/webview_switch_session.js +26 -0
  17. package/providers/_builtin/ide/pearai/provider.js +27 -1
  18. package/providers/_builtin/ide/pearai/scripts/focus_editor.js +20 -0
  19. package/providers/_builtin/ide/pearai/scripts/open_panel.js +46 -0
  20. package/providers/_builtin/ide/pearai/scripts/resolve_action.js +54 -0
  21. package/providers/_builtin/ide/pearai/scripts/send_message.js +29 -0
  22. package/providers/_builtin/ide/pearai/scripts/webview_list_models.js +43 -0
  23. package/providers/_builtin/ide/pearai/scripts/webview_list_modes.js +35 -0
  24. package/providers/_builtin/ide/pearai/scripts/webview_new_session.js +21 -0
  25. package/providers/_builtin/ide/pearai/scripts/webview_read_chat.js +92 -0
  26. package/providers/_builtin/ide/pearai/scripts/webview_resolve_action.js +59 -0
  27. package/providers/_builtin/ide/pearai/scripts/webview_set_mode.js +36 -0
  28. package/providers/_builtin/ide/pearai/scripts/webview_set_model.js +36 -0
  29. package/providers/_builtin/ide/trae/provider.js +22 -1
  30. package/providers/_builtin/ide/trae/scripts/focus_editor.js +20 -0
  31. package/providers/_builtin/ide/trae/scripts/list_chats.js +24 -0
  32. package/providers/_builtin/ide/trae/scripts/list_models.js +39 -0
  33. package/providers/_builtin/ide/trae/scripts/list_modes.js +39 -0
  34. package/providers/_builtin/ide/trae/scripts/new_session.js +30 -0
  35. package/providers/_builtin/ide/trae/scripts/open_panel.js +44 -0
  36. package/providers/_builtin/ide/trae/scripts/read_chat.js +113 -0
  37. package/providers/_builtin/ide/trae/scripts/resolve_action.js +54 -0
  38. package/providers/_builtin/ide/trae/scripts/send_message.js +19 -0
  39. package/providers/_builtin/ide/trae/scripts/set_mode.js +15 -0
  40. package/providers/_builtin/ide/trae/scripts/set_model.js +15 -0
  41. package/providers/_builtin/ide/trae/scripts/switch_session.js +23 -0
  42. package/providers/_builtin/ide/windsurf/provider.js +12 -0
  43. package/providers/_builtin/ide/windsurf/scripts/list_models.js +39 -0
  44. package/providers/_builtin/ide/windsurf/scripts/list_modes.js +39 -0
  45. package/providers/_builtin/ide/windsurf/scripts/set_mode.js +15 -0
  46. package/providers/_builtin/ide/windsurf/scripts/set_model.js +15 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Trae — resolve_action
3
+ *
4
+ * 승인/거부 버튼 찾기 + 좌표 반환.
5
+ * Trae의 approval 다이얼로그는 메인 DOM에 표시됨.
6
+ *
7
+ * 파라미터: ${ BUTTON_TEXT }
8
+ */
9
+ (() => {
10
+ const want = ${ BUTTON_TEXT };
11
+ const wantNorm = (want || '').replace(/\s+/g, ' ').trim().toLowerCase();
12
+
13
+ function norm(t) { return (t || '').replace(/\s+/g, ' ').trim().toLowerCase(); }
14
+
15
+ function matches(el) {
16
+ const t = norm(el.textContent);
17
+ if (!t || t.length > 80) return false;
18
+ if (t === wantNorm) return true;
19
+ if (t.indexOf(wantNorm) === 0) return true;
20
+ if (wantNorm.indexOf(t) >= 0 && t.length > 2) return true;
21
+ if (/^(run|approve|allow|accept|yes)\b/.test(wantNorm)) {
22
+ if (/^(run|allow|accept|approve)\b/.test(t)) return true;
23
+ }
24
+ if (/^(reject|deny|no|abort)\b/.test(wantNorm)) {
25
+ if (/^(reject|deny)\b/.test(t)) return true;
26
+ }
27
+ return false;
28
+ }
29
+
30
+ const sel = 'button, [role="button"], .monaco-button';
31
+ const allBtns = [...document.querySelectorAll(sel)].filter(b => {
32
+ if (!b.offsetWidth || !b.getBoundingClientRect().height) return false;
33
+ const rect = b.getBoundingClientRect();
34
+ return rect.y > 0 && rect.y < window.innerHeight;
35
+ });
36
+
37
+ let found = null;
38
+ for (let i = allBtns.length - 1; i >= 0; i--) {
39
+ if (matches(allBtns[i])) { found = allBtns[i]; break; }
40
+ }
41
+
42
+ if (found) {
43
+ const rect = found.getBoundingClientRect();
44
+ return JSON.stringify({
45
+ found: true,
46
+ text: found.textContent?.trim()?.substring(0, 40),
47
+ x: Math.round(rect.x + rect.width / 2),
48
+ y: Math.round(rect.y + rect.height / 2),
49
+ w: Math.round(rect.width),
50
+ h: Math.round(rect.height)
51
+ });
52
+ }
53
+ return JSON.stringify({ found: false, want: wantNorm });
54
+ })()
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Trae — send_message
3
+ *
4
+ * Trae는 .chat-input-v2-input-box-editable (contenteditable) 사용.
5
+ * 메인 DOM에서 접근 가능 → selector를 반환하여 데몬의 typeAndSend가 처리.
6
+ *
7
+ * 파라미터: ${ MESSAGE }
8
+ */
9
+ (() => {
10
+ try {
11
+ return JSON.stringify({
12
+ sent: false,
13
+ needsTypeAndSend: true,
14
+ selector: '.chat-input-v2-input-box-editable',
15
+ });
16
+ } catch (e) {
17
+ return JSON.stringify({ sent: false, error: e.message });
18
+ }
19
+ })()
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generic fallback — set_model
3
+ * ${ MODEL }
4
+ */
5
+ (() => {
6
+ try {
7
+ const want = ${ MODEL } || '';
8
+ const norm = (t) => t.toLowerCase().trim();
9
+
10
+ // Very basic click attempt
11
+ return JSON.stringify({ success: false, error: 'Model selection requires UI interaction not supported by generic script' });
12
+ } catch (e) {
13
+ return JSON.stringify({ success: false, error: e.message });
14
+ }
15
+ })()
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generic fallback — set_model
3
+ * ${ MODEL }
4
+ */
5
+ (() => {
6
+ try {
7
+ const want = ${ MODEL } || '';
8
+ const norm = (t) => t.toLowerCase().trim();
9
+
10
+ // Very basic click attempt
11
+ return JSON.stringify({ success: false, error: 'Model selection requires UI interaction not supported by generic script' });
12
+ } catch (e) {
13
+ return JSON.stringify({ success: false, error: e.message });
14
+ }
15
+ })()
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Trae — switch_session
3
+ *
4
+ * Trae 세션 탭 전환.
5
+ * 파라미터: ${ SESSION_ID }
6
+ */
7
+ (() => {
8
+ try {
9
+ const targetId = ${ SESSION_ID };
10
+ const tabs = document.querySelectorAll('.chat-tab-header, [class*="tab-item"], [class*="TabItem"]');
11
+ const idx = parseInt(targetId, 10);
12
+
13
+ if (isNaN(idx) || idx < 0 || idx >= tabs.length) {
14
+ return JSON.stringify({ switched: false, error: `invalid index: ${targetId}` });
15
+ }
16
+
17
+ tabs[idx].click();
18
+ const title = (tabs[idx].textContent || '').replace('✕', '').trim();
19
+ return JSON.stringify({ switched: true, title });
20
+ } catch (e) {
21
+ return JSON.stringify({ switched: false, error: e.message });
22
+ }
23
+ })()
@@ -59,6 +59,18 @@ module.exports = {
59
59
  return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
60
60
  },
61
61
  focusEditor() { return loadScript('focus_editor.js'); },
62
+ listModels() { return loadScript('list_models.js'); },
63
+ setModel(params) {
64
+ const model = typeof params === 'string' ? params : params?.model;
65
+ const s = loadScript('set_model.js');
66
+ return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
67
+ },
68
+ listModes() { return loadScript('list_modes.js'); },
69
+ setMode(params) {
70
+ const mode = typeof params === 'string' ? params : params?.mode;
71
+ const s = loadScript('set_mode.js');
72
+ return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
73
+ },
62
74
  openPanel() { return loadScript('open_panel.js'); },
63
75
  },
64
76
  };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Generic fallback — list_models
3
+ */
4
+ (() => {
5
+ try {
6
+ const models = [];
7
+ let current = '';
8
+
9
+ // Try generic Model string from select/button
10
+ const sel = document.querySelectorAll('select, [class*="model"], [id*="model"]');
11
+ for (const el of sel) {
12
+ const txt = (el.textContent || '').trim();
13
+ if (txt && /claude|gpt|gemini|sonnet|opus/i.test(txt)) {
14
+ if (txt.length < 50) {
15
+ models.push(txt);
16
+ if (!current) current = txt;
17
+ }
18
+ }
19
+ }
20
+
21
+ if (models.length === 0) {
22
+ const btns = document.querySelectorAll('button');
23
+ for (const b of btns) {
24
+ const txt = (b.textContent || '').trim();
25
+ if (txt && /claude|gpt|gemini|sonnet/i.test(txt) && txt.length < 30) {
26
+ models.push(txt);
27
+ current = txt;
28
+ }
29
+ }
30
+ }
31
+
32
+ return JSON.stringify({
33
+ models: [...new Set(models)],
34
+ current: current || 'Default'
35
+ });
36
+ } catch (e) {
37
+ return JSON.stringify({ models: [], current: '', error: e.message });
38
+ }
39
+ })()
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Generic fallback — list_models
3
+ */
4
+ (() => {
5
+ try {
6
+ const models = [];
7
+ let current = '';
8
+
9
+ // Try generic Model string from select/button
10
+ const sel = document.querySelectorAll('select, [class*="model"], [id*="model"]');
11
+ for (const el of sel) {
12
+ const txt = (el.textContent || '').trim();
13
+ if (txt && /claude|gpt|gemini|sonnet|opus/i.test(txt)) {
14
+ if (txt.length < 50) {
15
+ models.push(txt);
16
+ if (!current) current = txt;
17
+ }
18
+ }
19
+ }
20
+
21
+ if (models.length === 0) {
22
+ const btns = document.querySelectorAll('button');
23
+ for (const b of btns) {
24
+ const txt = (b.textContent || '').trim();
25
+ if (txt && /claude|gpt|gemini|sonnet/i.test(txt) && txt.length < 30) {
26
+ models.push(txt);
27
+ current = txt;
28
+ }
29
+ }
30
+ }
31
+
32
+ return JSON.stringify({
33
+ models: [...new Set(models)],
34
+ current: current || 'Default'
35
+ });
36
+ } catch (e) {
37
+ return JSON.stringify({ models: [], current: '', error: e.message });
38
+ }
39
+ })()
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generic fallback — set_model
3
+ * ${ MODEL }
4
+ */
5
+ (() => {
6
+ try {
7
+ const want = ${ MODEL } || '';
8
+ const norm = (t) => t.toLowerCase().trim();
9
+
10
+ // Very basic click attempt
11
+ return JSON.stringify({ success: false, error: 'Model selection requires UI interaction not supported by generic script' });
12
+ } catch (e) {
13
+ return JSON.stringify({ success: false, error: e.message });
14
+ }
15
+ })()
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Generic fallback — set_model
3
+ * ${ MODEL }
4
+ */
5
+ (() => {
6
+ try {
7
+ const want = ${ MODEL } || '';
8
+ const norm = (t) => t.toLowerCase().trim();
9
+
10
+ // Very basic click attempt
11
+ return JSON.stringify({ success: false, error: 'Model selection requires UI interaction not supported by generic script' });
12
+ } catch (e) {
13
+ return JSON.stringify({ success: false, error: e.message });
14
+ }
15
+ })()