adhdev 0.1.50 → 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 (47) hide show
  1. package/dist/index.js +983 -72
  2. package/package.json +1 -1
  3. package/providers/_builtin/acp/codex-cli/provider.js +3 -3
  4. package/providers/_builtin/ide/antigravity/scripts/read_chat.js +22 -0
  5. package/providers/_builtin/ide/kiro/provider.js +25 -1
  6. package/providers/_builtin/ide/kiro/scripts/focus_editor.js +20 -0
  7. package/providers/_builtin/ide/kiro/scripts/open_panel.js +47 -0
  8. package/providers/_builtin/ide/kiro/scripts/resolve_action.js +54 -0
  9. package/providers/_builtin/ide/kiro/scripts/send_message.js +29 -0
  10. package/providers/_builtin/ide/kiro/scripts/webview_list_models.js +39 -0
  11. package/providers/_builtin/ide/kiro/scripts/webview_list_modes.js +39 -0
  12. package/providers/_builtin/ide/kiro/scripts/webview_list_sessions.js +21 -0
  13. package/providers/_builtin/ide/kiro/scripts/webview_new_session.js +34 -0
  14. package/providers/_builtin/ide/kiro/scripts/webview_read_chat.js +68 -0
  15. package/providers/_builtin/ide/kiro/scripts/webview_set_mode.js +15 -0
  16. package/providers/_builtin/ide/kiro/scripts/webview_set_model.js +15 -0
  17. package/providers/_builtin/ide/kiro/scripts/webview_switch_session.js +26 -0
  18. package/providers/_builtin/ide/pearai/provider.js +27 -1
  19. package/providers/_builtin/ide/pearai/scripts/focus_editor.js +20 -0
  20. package/providers/_builtin/ide/pearai/scripts/open_panel.js +46 -0
  21. package/providers/_builtin/ide/pearai/scripts/resolve_action.js +54 -0
  22. package/providers/_builtin/ide/pearai/scripts/send_message.js +29 -0
  23. package/providers/_builtin/ide/pearai/scripts/webview_list_models.js +43 -0
  24. package/providers/_builtin/ide/pearai/scripts/webview_list_modes.js +35 -0
  25. package/providers/_builtin/ide/pearai/scripts/webview_new_session.js +21 -0
  26. package/providers/_builtin/ide/pearai/scripts/webview_read_chat.js +92 -0
  27. package/providers/_builtin/ide/pearai/scripts/webview_resolve_action.js +59 -0
  28. package/providers/_builtin/ide/pearai/scripts/webview_set_mode.js +36 -0
  29. package/providers/_builtin/ide/pearai/scripts/webview_set_model.js +36 -0
  30. package/providers/_builtin/ide/trae/provider.js +22 -1
  31. package/providers/_builtin/ide/trae/scripts/focus_editor.js +20 -0
  32. package/providers/_builtin/ide/trae/scripts/list_chats.js +24 -0
  33. package/providers/_builtin/ide/trae/scripts/list_models.js +39 -0
  34. package/providers/_builtin/ide/trae/scripts/list_modes.js +39 -0
  35. package/providers/_builtin/ide/trae/scripts/new_session.js +30 -0
  36. package/providers/_builtin/ide/trae/scripts/open_panel.js +44 -0
  37. package/providers/_builtin/ide/trae/scripts/read_chat.js +113 -0
  38. package/providers/_builtin/ide/trae/scripts/resolve_action.js +54 -0
  39. package/providers/_builtin/ide/trae/scripts/send_message.js +19 -0
  40. package/providers/_builtin/ide/trae/scripts/set_mode.js +15 -0
  41. package/providers/_builtin/ide/trae/scripts/set_model.js +15 -0
  42. package/providers/_builtin/ide/trae/scripts/switch_session.js +23 -0
  43. package/providers/_builtin/ide/windsurf/provider.js +12 -0
  44. package/providers/_builtin/ide/windsurf/scripts/list_models.js +39 -0
  45. package/providers/_builtin/ide/windsurf/scripts/list_modes.js +39 -0
  46. package/providers/_builtin/ide/windsurf/scripts/set_mode.js +15 -0
  47. package/providers/_builtin/ide/windsurf/scripts/set_model.js +15 -0
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Trae — read_chat
3
+ *
4
+ * Trae는 메인 DOM에서 직접 채팅 내용에 접근 가능.
5
+ * 채팅 턴은 .chat-turn 요소로 구분.
6
+ * 유저: .user-chat-bubble-request__content-wrapper
7
+ * 어시스턴트: .assistant-chat-turn-content .chat-markdown
8
+ *
9
+ * 반환: ReadChatResult { id, status, messages, title?, inputContent?, activeModal? }
10
+ */
11
+ (() => {
12
+ try {
13
+ const auxbar = document.getElementById('workbench.parts.auxiliarybar');
14
+ if (!auxbar || auxbar.offsetWidth === 0) {
15
+ return JSON.stringify({ id: '', status: 'idle', messages: [] });
16
+ }
17
+
18
+ // ─── 1. 메시지 수집 ───
19
+ const messages = [];
20
+ const turns = auxbar.querySelectorAll('.chat-turn');
21
+
22
+ turns.forEach((turn, idx) => {
23
+ // User message
24
+ const userBubble = turn.querySelector('.user-chat-bubble-request__content-wrapper');
25
+ if (userBubble) {
26
+ messages.push({
27
+ role: 'user',
28
+ content: userBubble.textContent.trim(),
29
+ index: idx,
30
+ });
31
+ }
32
+
33
+ // Assistant message
34
+ const assistantEl = turn.querySelector('.assistant-chat-turn-content');
35
+ if (assistantEl) {
36
+ const mdBlocks = assistantEl.querySelectorAll('.chat-markdown-p, .chat-markdown pre');
37
+ let content = '';
38
+ if (mdBlocks.length > 0) {
39
+ content = Array.from(mdBlocks).map(b => b.textContent.trim()).join('\n');
40
+ } else {
41
+ content = assistantEl.textContent.trim();
42
+ }
43
+ if (content) {
44
+ messages.push({
45
+ role: 'assistant',
46
+ content: content,
47
+ index: idx,
48
+ });
49
+ }
50
+ }
51
+ });
52
+
53
+ // ─── 2. 상태 감지 ───
54
+ let status = 'idle';
55
+
56
+ // Stop 버튼 존재 → generating
57
+ const stopBtn = auxbar.querySelector('button[class*="stop"], [aria-label*="stop" i], [aria-label*="Stop"]');
58
+ if (stopBtn && stopBtn.offsetWidth > 0) {
59
+ status = 'generating';
60
+ }
61
+
62
+ // progress bar 활성 → generating
63
+ const progress = auxbar.querySelector('.monaco-progress-container:not(.done)');
64
+ if (progress && progress.offsetWidth > 0) {
65
+ status = 'generating';
66
+ }
67
+
68
+ // latest-assistant-bar가 가장 정확한 상태 표시 (최종 판정)
69
+ const latestBar = auxbar.querySelector('.latest-assistant-bar');
70
+ if (latestBar) {
71
+ const barText = latestBar.textContent.toLowerCase();
72
+ if (barText.includes('completed') || barText.includes('done')) {
73
+ status = 'idle';
74
+ } else if (barText.includes('thinking') || barText.includes('generating') || barText.includes('running') || barText.includes('searching')) {
75
+ status = 'generating';
76
+ }
77
+ }
78
+
79
+ // ─── 3. 승인 대기 모달 ───
80
+ let activeModal = null;
81
+ const dialogs = auxbar.querySelectorAll('[role="dialog"], .monaco-dialog-box, [class*="approval"], [class*="confirm"]');
82
+ if (dialogs.length > 0) {
83
+ const dialog = dialogs[0];
84
+ const buttons = Array.from(dialog.querySelectorAll('button')).map(b => b.textContent.trim()).filter(Boolean);
85
+ if (buttons.length > 0) {
86
+ activeModal = {
87
+ message: dialog.textContent.trim().substring(0, 200),
88
+ buttons: buttons,
89
+ };
90
+ status = 'waiting_approval';
91
+ }
92
+ }
93
+
94
+ // ─── 4. 입력 필드 내용 ───
95
+ const input = auxbar.querySelector('.chat-input-v2-input-box-editable, [contenteditable="true"]');
96
+ const inputContent = input ? input.textContent.trim() : '';
97
+
98
+ // ─── 5. 세션 ID / 타이틀 ───
99
+ const sessionTab = auxbar.querySelector('[class*="session-tab"], [class*="chat-title"]');
100
+ const title = sessionTab ? sessionTab.textContent.trim() : '';
101
+
102
+ return JSON.stringify({
103
+ id: title || 'trae-default',
104
+ status: status,
105
+ messages: messages,
106
+ title: title || undefined,
107
+ inputContent: inputContent || undefined,
108
+ activeModal: activeModal,
109
+ });
110
+ } catch (e) {
111
+ return JSON.stringify({ id: '', status: 'error', messages: [], error: e.message });
112
+ }
113
+ })()
@@ -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
+ })()