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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adhdev",
3
- "version": "0.1.50",
3
+ "version": "0.1.53",
4
4
  "description": "ADHDev CLI โ€” Detect, install and configure your IDE + AI agent extensions",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -12,11 +12,11 @@
12
12
  * @type {import('../../../../src/providers/contracts').ProviderModule}
13
13
  */
14
14
  module.exports = {
15
- type: 'codex-cli',
16
- name: 'Codex CLI',
15
+ type: 'codex-acp',
16
+ name: 'Codex (ACP)',
17
17
  category: 'acp',
18
18
 
19
- displayName: 'Codex',
19
+ displayName: 'Codex (ACP)',
20
20
  icon: '๐Ÿค–',
21
21
 
22
22
  // ACP spawn config โ€” uses codex-acp adapter
@@ -229,6 +229,28 @@
229
229
  }
230
230
  }
231
231
  }
232
+ // C: footer ๊ธฐ๋ฐ˜ ์‚ฌ์šฉ๋Ÿ‰/quota ๋‹ค์ด์–ผ๋กœ๊ทธ (Dismiss / See Plans / Enable Overages ๋“ฑ)
233
+ // <footer> ์š”์†Œ๊ฐ€ conv ์•ˆ์— ์กด์žฌํ•˜๊ณ  2๊ฐœ ์ด์ƒ ๋ฒ„ํŠผ์ด ์žˆ์œผ๋ฉด ์‚ฌ์šฉ์ž ์•ก์…˜์ด ํ•„์š”ํ•œ ์นด๋“œ๋กœ ํŒ๋‹จ
234
+ if (!activeModal) {
235
+ const footers = Array.from(conv.querySelectorAll('footer')).filter(f => f.offsetWidth > 0 && f.offsetHeight > 0);
236
+ for (const footer of footers) {
237
+ const footerBtns = Array.from(footer.querySelectorAll('button, a')).filter(b => b.offsetWidth > 0);
238
+ if (footerBtns.length >= 2) {
239
+ // ์นด๋“œ ์ปจํ…Œ์ด๋„ˆ: footer ์ƒ์œ„์—์„œ ์ถฉ๋ถ„ํ•œ ๋†’์ด๋ฅผ ๊ฐ€์ง„ ์ฒซ ๋ฒˆ์งธ ์š”์†Œ
240
+ let card = footer.parentElement;
241
+ for (let up = 0; up < 4 && card; up++) {
242
+ if (card.offsetHeight > 60) break;
243
+ card = card.parentElement;
244
+ }
245
+ const msg = card ? (card.innerText || '').trim().slice(0, 300) : '';
246
+ const btnTexts = footerBtns.map(b => (b.innerText || '').trim()).filter(t => t.length > 0 && t.length < 40);
247
+ if (btnTexts.length >= 2) {
248
+ activeModal = { message: msg, buttons: btnTexts, width: card ? card.offsetWidth : 300, height: card ? card.offsetHeight : 100 };
249
+ break;
250
+ }
251
+ }
252
+ }
253
+ }
232
254
  // ๋ชจ๋‹ฌ์ด ๊ฐ์ง€๋˜๋ฉด status๋ฅผ waiting_approval๋กœ ๋ณ€๊ฒฝ
233
255
  if (activeModal) status = 'waiting_approval';
234
256
  } catch (e) { activeModal = null; }
@@ -45,8 +45,11 @@ module.exports = {
45
45
  inputMethod: 'cdp-type-and-send',
46
46
  inputSelector: '[contenteditable="true"][role="textbox"]',
47
47
 
48
+ // Kiro์˜ ์ฑ„ํŒ… UI๋Š” webview iframe ๋‚ด๋ถ€
49
+ webviewMatchText: 'kiro-chat',
50
+
48
51
  scripts: {
49
- readChat() { return loadScript('read_chat.js'); },
52
+ webviewReadChat() { return loadScript('webview_read_chat.js'); },
50
53
  sendMessage(text) {
51
54
  const s = loadScript('send_message.js');
52
55
  return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
@@ -58,5 +61,26 @@ module.exports = {
58
61
  const s = loadScript('resolve_action.js');
59
62
  return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
60
63
  },
64
+ openPanel() { return loadScript('open_panel.js'); },
65
+ focusEditor() { return loadScript('focus_editor.js'); },
66
+ // ์„ธ์…˜ ๊ด€๋ฆฌ (webview)
67
+ webviewListSessions() { return loadScript('webview_list_sessions.js'); },
68
+ webviewNewSession() { return loadScript('webview_new_session.js'); },
69
+ webviewSwitchSession(sessionId) {
70
+ const s = loadScript('webview_switch_session.js');
71
+ return s ? s.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId)) : null;
72
+ },
73
+ webviewListModels() { return loadScript('webview_list_models.js'); },
74
+ webviewSetModel(params) {
75
+ const model = typeof params === 'string' ? params : params?.model;
76
+ const s = loadScript('webview_set_model.js');
77
+ return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
78
+ },
79
+ webviewListModes() { return loadScript('webview_list_modes.js'); },
80
+ webviewSetMode(params) {
81
+ const mode = typeof params === 'string' ? params : params?.mode;
82
+ const s = loadScript('webview_set_mode.js');
83
+ return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
84
+ },
61
85
  },
62
86
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Cursor v1 โ€” focus_editor
3
+ *
4
+ * CURSOR.md 4-5: ์…€๋ ‰ํ„ฐ ์šฐ์„ ์ˆœ์œ„
5
+ * [contenteditable="true"][role="textbox"]
6
+ * โ†’ .chat-input textarea
7
+ * โ†’ .composer-input
8
+ * โ†’ textarea
9
+ *
10
+ * ์ตœ์ข… ํ™•์ธ: 2026-03-06
11
+ */
12
+ (() => {
13
+ const editor = document.querySelector('[contenteditable="true"][role="textbox"]')
14
+ || document.querySelector('.chat-input textarea')
15
+ || document.querySelector('.composer-input')
16
+ || document.querySelector('textarea.native-input')
17
+ || document.querySelector('textarea');
18
+ if (editor) { editor.focus(); return 'focused'; }
19
+ return 'no editor found';
20
+ })()
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Kiro โ€” open_panel
3
+ *
4
+ * Kiro AI ์ฑ„ํŒ… ํŒจ๋„ ์—ด๊ธฐ.
5
+ * Secondary Side Bar (#workbench.parts.auxiliarybar)์— ์œ„์น˜.
6
+ * "Toggle Secondary Side Bar (โŒฅโŒ˜B)" ๋˜๋Š” "Kiro" ๋ฒ„ํŠผ์œผ๋กœ ์—ด๊ธฐ.
7
+ *
8
+ * ๋ฐ˜ํ™˜: 'visible' | 'opened' | 'error: ...'
9
+ */
10
+ (() => {
11
+ try {
12
+ // 1. ์ด๋ฏธ ์—ด๋ ค ์žˆ๋Š”์ง€ ํ™•์ธ
13
+ const sidebar = document.getElementById('workbench.parts.auxiliarybar');
14
+ if (sidebar && sidebar.offsetWidth > 0 && sidebar.offsetHeight > 0) {
15
+ return 'visible';
16
+ }
17
+
18
+ // 2. Toggle ๋ฒ„ํŠผ ํด๋ฆญ ์‹œ๋„
19
+ const toggleBtns = Array.from(document.querySelectorAll('li.action-item a, button, [role="button"]'));
20
+ for (const btn of toggleBtns) {
21
+ const label = (btn.getAttribute('aria-label') || '').toLowerCase();
22
+ if (label.includes('toggle secondary') || label.includes('toggle auxiliary') ||
23
+ label === 'kiro' || label.includes('kiro')) {
24
+ if (btn.offsetWidth > 0 || btn.offsetHeight > 0) {
25
+ btn.click();
26
+ return 'opened (toggle)';
27
+ }
28
+ }
29
+ }
30
+
31
+ // 3. Cmd+Shift+I ๋‹จ์ถ•ํ‚ค ํด๋ฐฑ (Kiro ๊ธฐ๋ณธ ๋‹จ์ถ•ํ‚ค)
32
+ document.dispatchEvent(new KeyboardEvent('keydown', {
33
+ key: 'b', code: 'KeyB', keyCode: 66,
34
+ metaKey: true, altKey: true, ctrlKey: false,
35
+ bubbles: true, cancelable: true,
36
+ }));
37
+ document.dispatchEvent(new KeyboardEvent('keyup', {
38
+ key: 'b', code: 'KeyB', keyCode: 66,
39
+ metaKey: true, altKey: true, ctrlKey: false,
40
+ bubbles: true, cancelable: true,
41
+ }));
42
+
43
+ return 'opened (โŒฅโŒ˜B)';
44
+ } catch (e) {
45
+ return 'error: ' + e.message;
46
+ }
47
+ })()
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Kiro โ€” resolve_action
3
+ *
4
+ * ์Šน์ธ/๊ฑฐ๋ถ€ ๋ฒ„ํŠผ ์ฐพ๊ธฐ + ์ขŒํ‘œ ๋ฐ˜ํ™˜.
5
+ * Kiro์˜ 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,29 @@
1
+ /**
2
+ * Kiro โ€” send_message
3
+ *
4
+ * Kiro์˜ ์ฑ„ํŒ… ์ž…๋ ฅ์€ webview iframe ์•ˆ์— ์žˆ์–ด ๋ฉ”์ธ DOM์—์„œ ์ง์ ‘ ์ ‘๊ทผ ๋ถˆ๊ฐ€.
5
+ * auxbar ํ•˜๋‹จ์˜ ์ž…๋ ฅ ํ•„๋“œ ์ขŒํ‘œ๋ฅผ ๊ณ„์‚ฐํ•˜์—ฌ clickCoords๋กœ ๋ฐ˜ํ™˜.
6
+ * ๋ฐ๋ชฌ์ด CDP Input API๋กœ ํ•ด๋‹น ์ขŒํ‘œ์— ํด๋ฆญ+ํƒ€์ดํ•‘+Enter๋ฅผ ์ˆ˜ํ–‰.
7
+ *
8
+ * ํŒŒ๋ผ๋ฏธํ„ฐ: ${ MESSAGE }
9
+ */
10
+ (() => {
11
+ try {
12
+ const auxbar = document.getElementById('workbench.parts.auxiliarybar');
13
+ if (!auxbar || auxbar.offsetWidth === 0) {
14
+ return JSON.stringify({ sent: false, error: 'auxbar not found' });
15
+ }
16
+
17
+ const rect = auxbar.getBoundingClientRect();
18
+ const x = Math.round(rect.x + rect.width / 2);
19
+ const y = Math.round(rect.y + rect.height - 80);
20
+
21
+ return JSON.stringify({
22
+ sent: false,
23
+ needsTypeAndSend: true,
24
+ clickCoords: { x, y },
25
+ });
26
+ } catch (e) {
27
+ return JSON.stringify({ sent: false, error: e.message });
28
+ }
29
+ })()
@@ -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,21 @@
1
+ /**
2
+ * Kiro โ€” webview_list_sessions (webview iframe ๋‚ด๋ถ€์—์„œ ์‹คํ–‰)
3
+ *
4
+ * Kiro์˜ ์„ธ์…˜ ํƒญ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜.
5
+ * DOM: .kiro-tabs-item
6
+ */
7
+ (() => {
8
+ try {
9
+ const tabs = document.querySelectorAll('.kiro-tabs-item');
10
+ const sessions = Array.from(tabs).map((tab, i) => {
11
+ const label = tab.querySelector('.kiro-tabs-item-label');
12
+ const title = (label?.textContent || tab.textContent || '').trim();
13
+ const active = tab.classList.contains('active') ||
14
+ tab.getAttribute('aria-selected') === 'true';
15
+ return { id: String(i), title, active };
16
+ });
17
+ return JSON.stringify({ sessions });
18
+ } catch (e) {
19
+ return JSON.stringify({ sessions: [], error: e.message });
20
+ }
21
+ })()
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Kiro โ€” webview_new_session (webview iframe ๋‚ด๋ถ€์—์„œ ์‹คํ–‰)
3
+ *
4
+ * "New Session" ๋ฒ„ํŠผ/ํƒญ ํด๋ฆญ.
5
+ * Kiro๋Š” ํƒญ ๋ฐ”์— + ๋ฒ„ํŠผ ๋˜๋Š” "New Session" ์•ก์…˜์ด ์žˆ์Œ.
6
+ */
7
+ (() => {
8
+ try {
9
+ // kiro-icon-button (+ ๋ฒ„ํŠผ) ์ฐพ๊ธฐ
10
+ const addBtns = document.querySelectorAll('.kiro-icon-button, button, [role="button"]');
11
+ for (const btn of addBtns) {
12
+ const ariaLabel = (btn.getAttribute('aria-label') || '').toLowerCase();
13
+ const title = (btn.getAttribute('title') || '').toLowerCase();
14
+ if (ariaLabel.includes('new') || title.includes('new') ||
15
+ ariaLabel.includes('add') || title.includes('add')) {
16
+ btn.click();
17
+ return JSON.stringify({ created: true, method: 'button' });
18
+ }
19
+ }
20
+
21
+ // Checkpoint > New Session ์˜์—ญ ์ฐพ๊ธฐ
22
+ const allText = document.querySelectorAll('*');
23
+ for (const el of allText) {
24
+ if (el.children.length === 0 && (el.textContent || '').trim() === 'New Session') {
25
+ el.click();
26
+ return JSON.stringify({ created: true, method: 'text-click' });
27
+ }
28
+ }
29
+
30
+ return JSON.stringify({ created: false, error: 'New Session button not found' });
31
+ } catch (e) {
32
+ return JSON.stringify({ created: false, error: e.message });
33
+ }
34
+ })()
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Kiro โ€” webview_read_chat (webview iframe ๋‚ด๋ถ€์—์„œ ์‹คํ–‰)
3
+ *
4
+ * Kiro์˜ ์ฑ„ํŒ… UI๋Š” webview iframe ์•ˆ์— ์œ„์น˜ํ•˜๋ฉฐ,
5
+ * ๋ฐ๋ชฌ์˜ evaluateInWebviewFrame์„ ํ†ตํ•ด ์‹คํ–‰๋จ.
6
+ *
7
+ * DOM ๊ตฌ์กฐ:
8
+ * .kiro-chat-timeline
9
+ * .kiro-chat-message (์œ ์ €/์–ด์‹œ์Šคํ„ดํŠธ ๋ฉ”์‹œ์ง€)
10
+ * .kiro-chat-message-meta โ†’ .kiro-chat-message-role (๋ฐœ์‹ ์ž)
11
+ * .kiro-chat-message-body โ†’ .kiro-chat-message-markdown (๋‚ด์šฉ)
12
+ *
13
+ * ๋ฐ˜ํ™˜: ReadChatResult { id, status, messages, inputContent? }
14
+ */
15
+ (() => {
16
+ try {
17
+ const messages = [];
18
+ const msgElements = document.querySelectorAll('.kiro-chat-message');
19
+
20
+ msgElements.forEach((msg, idx) => {
21
+ const roleMeta = msg.querySelector('.kiro-chat-message-role');
22
+ const roleText = (roleMeta?.textContent || '').trim();
23
+ const isKiro = roleText.toLowerCase() === 'kiro';
24
+ const role = isKiro ? 'assistant' : 'user';
25
+
26
+ const body = msg.querySelector('.kiro-chat-message-body');
27
+ let content = '';
28
+ if (body) {
29
+ const markdown = body.querySelector('.kiro-chat-message-markdown');
30
+ content = (markdown || body).textContent?.trim() || '';
31
+ }
32
+
33
+ if (content) {
34
+ messages.push({ role, content, index: idx });
35
+ }
36
+ });
37
+
38
+ // ์ƒํƒœ ๊ฐ์ง€
39
+ let status = 'idle';
40
+
41
+ // "Working" / "Cancel" ๋ฒ„ํŠผ โ†’ generating
42
+ const workingBar = document.querySelector('.kiro-snackbar');
43
+ if (workingBar && workingBar.offsetWidth > 0) {
44
+ const barText = (workingBar.textContent || '').toLowerCase();
45
+ if (barText.includes('working') || barText.includes('cancel')) {
46
+ status = 'generating';
47
+ }
48
+ }
49
+
50
+ // ์ž…๋ ฅ ํ•„๋“œ ๋‚ด์šฉ
51
+ const input = document.querySelector('.tiptap.ProseMirror, [contenteditable="true"]');
52
+ const inputContent = input ? input.textContent?.trim() : '';
53
+
54
+ // ์„ธ์…˜ ํƒญ
55
+ const tab = document.querySelector('.kiro-tabs-item.active, .kiro-tabs-item[aria-selected="true"]');
56
+ const title = tab?.textContent?.trim() || '';
57
+
58
+ return JSON.stringify({
59
+ id: title || 'kiro-default',
60
+ status,
61
+ messages,
62
+ title: title || undefined,
63
+ inputContent: inputContent || undefined,
64
+ });
65
+ } catch (e) {
66
+ return JSON.stringify({ id: '', status: 'error', messages: [], error: e.message });
67
+ }
68
+ })()
@@ -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,26 @@
1
+ /**
2
+ * Kiro โ€” webview_switch_session (webview iframe ๋‚ด๋ถ€์—์„œ ์‹คํ–‰)
3
+ *
4
+ * ์„ธ์…˜ ํƒญ ํด๋ฆญ์œผ๋กœ ์ „ํ™˜.
5
+ * ํŒŒ๋ผ๋ฏธํ„ฐ: ${ SESSION_ID } (ํƒญ ์ธ๋ฑ์Šค)
6
+ */
7
+ (() => {
8
+ try {
9
+ const targetId = ${ SESSION_ID };
10
+ const tabs = document.querySelectorAll('.kiro-tabs-item');
11
+ const idx = parseInt(targetId, 10);
12
+
13
+ if (isNaN(idx) || idx < 0 || idx >= tabs.length) {
14
+ return JSON.stringify({ switched: false, error: `Invalid session index: ${targetId}, total: ${tabs.length}` });
15
+ }
16
+
17
+ tabs[idx].click();
18
+ const label = tabs[idx].querySelector('.kiro-tabs-item-label');
19
+ return JSON.stringify({
20
+ switched: true,
21
+ title: (label?.textContent || tabs[idx].textContent || '').trim(),
22
+ });
23
+ } catch (e) {
24
+ return JSON.stringify({ switched: false, error: e.message });
25
+ }
26
+ })()
@@ -45,8 +45,11 @@ module.exports = {
45
45
  inputMethod: 'cdp-type-and-send',
46
46
  inputSelector: '[contenteditable="true"][role="textbox"]',
47
47
 
48
+ // PearAI์˜ Agent ์ฑ„ํŒ… UI๋Š” webview iframe ๋‚ด๋ถ€ (Roo Code/Cline ๊ธฐ๋ฐ˜)
49
+ webviewMatchText: 'chat-text-area',
50
+
48
51
  scripts: {
49
- readChat() { return loadScript('read_chat.js'); },
52
+ webviewReadChat() { return loadScript('webview_read_chat.js'); },
50
53
  sendMessage(text) {
51
54
  const s = loadScript('send_message.js');
52
55
  return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
@@ -58,5 +61,28 @@ module.exports = {
58
61
  const s = loadScript('resolve_action.js');
59
62
  return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
60
63
  },
64
+ webviewResolveAction(params) {
65
+ const action = typeof params === 'string' ? params : params?.action || 'approve';
66
+ const buttonText = params?.button || params?.buttonText
67
+ || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
68
+ const s = loadScript('webview_resolve_action.js');
69
+ return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
70
+ },
71
+ openPanel() { return loadScript('open_panel.js'); },
72
+ focusEditor() { return loadScript('focus_editor.js'); },
73
+ // ์„ธ์…˜ ๊ด€๋ฆฌ (webview)
74
+ webviewNewSession() { return loadScript('webview_new_session.js'); },
75
+ webviewListModels() { return loadScript('webview_list_models.js'); },
76
+ webviewSetModel(params) {
77
+ const model = typeof params === 'string' ? params : params?.model;
78
+ const s = loadScript('webview_set_model.js');
79
+ return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
80
+ },
81
+ webviewListModes() { return loadScript('webview_list_modes.js'); },
82
+ webviewSetMode(params) {
83
+ const mode = typeof params === 'string' ? params : params?.mode;
84
+ const s = loadScript('webview_set_mode.js');
85
+ return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
86
+ },
61
87
  },
62
88
  };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Cursor v1 โ€” focus_editor
3
+ *
4
+ * CURSOR.md 4-5: ์…€๋ ‰ํ„ฐ ์šฐ์„ ์ˆœ์œ„
5
+ * [contenteditable="true"][role="textbox"]
6
+ * โ†’ .chat-input textarea
7
+ * โ†’ .composer-input
8
+ * โ†’ textarea
9
+ *
10
+ * ์ตœ์ข… ํ™•์ธ: 2026-03-06
11
+ */
12
+ (() => {
13
+ const editor = document.querySelector('[contenteditable="true"][role="textbox"]')
14
+ || document.querySelector('.chat-input textarea')
15
+ || document.querySelector('.composer-input')
16
+ || document.querySelector('textarea.native-input')
17
+ || document.querySelector('textarea');
18
+ if (editor) { editor.focus(); return 'focused'; }
19
+ return 'no editor found';
20
+ })()
@@ -0,0 +1,46 @@
1
+ /**
2
+ * PearAI โ€” open_panel
3
+ *
4
+ * PearAI ์ฑ„ํŒ… ํŒจ๋„ ์—ด๊ธฐ.
5
+ * "Toggle PearAI Side Bar (โŒ˜;)" ๋ฒ„ํŠผ์œผ๋กœ ์—ด๊ธฐ.
6
+ *
7
+ * ๋ฐ˜ํ™˜: 'visible' | 'opened' | 'error: ...'
8
+ */
9
+ (() => {
10
+ try {
11
+ // 1. ์ด๋ฏธ ์—ด๋ ค ์žˆ๋Š”์ง€ ํ™•์ธ
12
+ const sidebar = document.getElementById('workbench.parts.auxiliarybar');
13
+ if (sidebar && sidebar.offsetWidth > 0 && sidebar.offsetHeight > 0) {
14
+ return 'visible';
15
+ }
16
+
17
+ // 2. Toggle ๋ฒ„ํŠผ ํด๋ฆญ ์‹œ๋„
18
+ const toggleBtns = Array.from(document.querySelectorAll('li.action-item a, button, [role="button"]'));
19
+ for (const btn of toggleBtns) {
20
+ const label = (btn.getAttribute('aria-label') || '').toLowerCase();
21
+ if (label.includes('toggle pearai') || label.includes('toggle secondary') ||
22
+ label.includes('toggle auxiliary')) {
23
+ if (btn.offsetWidth > 0 || btn.offsetHeight > 0) {
24
+ btn.click();
25
+ return 'opened (toggle)';
26
+ }
27
+ }
28
+ }
29
+
30
+ // 3. Cmd+; ๋‹จ์ถ•ํ‚ค ํด๋ฐฑ (PearAI ๊ธฐ๋ณธ ๋‹จ์ถ•ํ‚ค)
31
+ document.dispatchEvent(new KeyboardEvent('keydown', {
32
+ key: ';', code: 'Semicolon', keyCode: 186,
33
+ metaKey: true, ctrlKey: false,
34
+ bubbles: true, cancelable: true,
35
+ }));
36
+ document.dispatchEvent(new KeyboardEvent('keyup', {
37
+ key: ';', code: 'Semicolon', keyCode: 186,
38
+ metaKey: true, ctrlKey: false,
39
+ bubbles: true, cancelable: true,
40
+ }));
41
+
42
+ return 'opened (โŒ˜;)';
43
+ } catch (e) {
44
+ return 'error: ' + e.message;
45
+ }
46
+ })()