@adhdev/daemon-core 0.5.24 → 0.5.26

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 (106) hide show
  1. package/dist/index.js +122 -105
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/providers/_builtin/COMPATIBILITY.md +1 -1
  5. package/providers/_builtin/README.md +1 -1
  6. package/providers/_builtin/cli/claude-cli/provider.json +2 -1
  7. package/providers/_builtin/docs/PROVIDER_GUIDE.md +3 -3
  8. package/providers/_builtin/extension/cline/provider.json +4 -2
  9. package/providers/_builtin/extension/codex/provider.json +4 -2
  10. package/providers/_builtin/extension/codex/scripts/{list_models.js → 1.0/list_models.js} +1 -0
  11. package/providers/_builtin/extension/codex/scripts/{read_chat.js → 1.0/read_chat.js} +36 -11
  12. package/providers/_builtin/extension/codex/scripts/list_modes.js +138 -0
  13. package/providers/_builtin/extension/codex/scripts/set_mode.js +165 -0
  14. package/providers/_builtin/extension/roo-code/provider.json +4 -2
  15. package/providers/_builtin/ide/cursor/provider.json +1 -70
  16. package/providers/_builtin/ide/cursor/provider.json.bak +70 -0
  17. package/providers/_builtin/ide/kiro/provider.json +4 -2
  18. package/providers/_builtin/ide/pearai/provider.json +4 -2
  19. package/providers/_builtin/ide/trae/provider.json +4 -2
  20. package/providers/_builtin/ide/windsurf/provider.json +4 -2
  21. package/providers/_builtin/registry.json +1 -1
  22. package/src/agent-stream/poller.ts +15 -0
  23. package/src/cli-adapters/provider-cli-adapter.ts +45 -36
  24. package/providers/_builtin/extension/cline/scripts.js +0 -73
  25. package/providers/_builtin/extension/codex/scripts.js +0 -94
  26. package/providers/_builtin/ide/kiro/scripts.js +0 -62
  27. package/providers/_builtin/ide/pearai/scripts.js +0 -74
  28. package/providers/_builtin/ide/trae/scripts.js +0 -57
  29. package/providers/_builtin/ide/windsurf/scripts.js +0 -57
  30. /package/providers/_builtin/extension/cline/scripts/{focus_editor.js → 1.0/focus_editor.js} +0 -0
  31. /package/providers/_builtin/extension/cline/scripts/{list_chats.js → 1.0/list_chats.js} +0 -0
  32. /package/providers/_builtin/extension/cline/scripts/{list_models.js → 1.0/list_models.js} +0 -0
  33. /package/providers/_builtin/extension/cline/scripts/{list_modes.js → 1.0/list_modes.js} +0 -0
  34. /package/providers/_builtin/extension/cline/scripts/{new_session.js → 1.0/new_session.js} +0 -0
  35. /package/providers/_builtin/extension/cline/scripts/{open_panel.js → 1.0/open_panel.js} +0 -0
  36. /package/providers/_builtin/extension/cline/scripts/{read_chat.js → 1.0/read_chat.js} +0 -0
  37. /package/providers/_builtin/extension/cline/scripts/{resolve_action.js → 1.0/resolve_action.js} +0 -0
  38. /package/providers/_builtin/extension/cline/scripts/{send_message.js → 1.0/send_message.js} +0 -0
  39. /package/providers/_builtin/extension/cline/scripts/{set_mode.js → 1.0/set_mode.js} +0 -0
  40. /package/providers/_builtin/extension/cline/scripts/{set_model.js → 1.0/set_model.js} +0 -0
  41. /package/providers/_builtin/extension/cline/scripts/{switch_session.js → 1.0/switch_session.js} +0 -0
  42. /package/providers/_builtin/extension/codex/scripts/{click_conversation_webview.js → 1.0/click_conversation_webview.js} +0 -0
  43. /package/providers/_builtin/extension/codex/scripts/{explore_chat_webview.js → 1.0/explore_chat_webview.js} +0 -0
  44. /package/providers/_builtin/extension/codex/scripts/{explore_controls_webview.js → 1.0/explore_controls_webview.js} +0 -0
  45. /package/providers/_builtin/extension/codex/scripts/{explore_dom.js → 1.0/explore_dom.js} +0 -0
  46. /package/providers/_builtin/extension/codex/scripts/{explore_dropdown_webview.js → 1.0/explore_dropdown_webview.js} +0 -0
  47. /package/providers/_builtin/extension/codex/scripts/{inspect_code_webview.js → 1.0/inspect_code_webview.js} +0 -0
  48. /package/providers/_builtin/extension/codex/scripts/{message_structure_webview.js → 1.0/message_structure_webview.js} +0 -0
  49. /package/providers/_builtin/extension/codex/scripts/{new_session.js → 1.0/new_session.js} +0 -0
  50. /package/providers/_builtin/extension/codex/scripts/{resolve_action.js → 1.0/resolve_action.js} +0 -0
  51. /package/providers/_builtin/extension/codex/scripts/{send_message.js → 1.0/send_message.js} +0 -0
  52. /package/providers/_builtin/extension/codex/scripts/{set_model.js → 1.0/set_model.js} +0 -0
  53. /package/providers/_builtin/extension/roo-code/{scripts.js → scripts/1.0/scripts.js} +0 -0
  54. /package/providers/_builtin/ide/kiro/scripts/{focus_editor.js → 1.0/focus_editor.js} +0 -0
  55. /package/providers/_builtin/ide/kiro/scripts/{open_panel.js → 1.0/open_panel.js} +0 -0
  56. /package/providers/_builtin/ide/kiro/scripts/{resolve_action.js → 1.0/resolve_action.js} +0 -0
  57. /package/providers/_builtin/ide/kiro/scripts/{send_message.js → 1.0/send_message.js} +0 -0
  58. /package/providers/_builtin/ide/kiro/scripts/{webview_list_models.js → 1.0/webview_list_models.js} +0 -0
  59. /package/providers/_builtin/ide/kiro/scripts/{webview_list_modes.js → 1.0/webview_list_modes.js} +0 -0
  60. /package/providers/_builtin/ide/kiro/scripts/{webview_list_sessions.js → 1.0/webview_list_sessions.js} +0 -0
  61. /package/providers/_builtin/ide/kiro/scripts/{webview_new_session.js → 1.0/webview_new_session.js} +0 -0
  62. /package/providers/_builtin/ide/kiro/scripts/{webview_read_chat.js → 1.0/webview_read_chat.js} +0 -0
  63. /package/providers/_builtin/ide/kiro/scripts/{webview_send_message.js → 1.0/webview_send_message.js} +0 -0
  64. /package/providers/_builtin/ide/kiro/scripts/{webview_set_mode.js → 1.0/webview_set_mode.js} +0 -0
  65. /package/providers/_builtin/ide/kiro/scripts/{webview_set_model.js → 1.0/webview_set_model.js} +0 -0
  66. /package/providers/_builtin/ide/kiro/scripts/{webview_switch_session.js → 1.0/webview_switch_session.js} +0 -0
  67. /package/providers/_builtin/ide/pearai/scripts/{focus_editor.js → 1.0/focus_editor.js} +0 -0
  68. /package/providers/_builtin/ide/pearai/scripts/{list_sessions.js → 1.0/list_sessions.js} +0 -0
  69. /package/providers/_builtin/ide/pearai/scripts/{new_session.js → 1.0/new_session.js} +0 -0
  70. /package/providers/_builtin/ide/pearai/scripts/{open_panel.js → 1.0/open_panel.js} +0 -0
  71. /package/providers/_builtin/ide/pearai/scripts/{resolve_action.js → 1.0/resolve_action.js} +0 -0
  72. /package/providers/_builtin/ide/pearai/scripts/{send_message.js → 1.0/send_message.js} +0 -0
  73. /package/providers/_builtin/ide/pearai/scripts/{webview_list_models.js → 1.0/webview_list_models.js} +0 -0
  74. /package/providers/_builtin/ide/pearai/scripts/{webview_list_modes.js → 1.0/webview_list_modes.js} +0 -0
  75. /package/providers/_builtin/ide/pearai/scripts/{webview_list_sessions.js → 1.0/webview_list_sessions.js} +0 -0
  76. /package/providers/_builtin/ide/pearai/scripts/{webview_new_session.js → 1.0/webview_new_session.js} +0 -0
  77. /package/providers/_builtin/ide/pearai/scripts/{webview_read_chat.js → 1.0/webview_read_chat.js} +0 -0
  78. /package/providers/_builtin/ide/pearai/scripts/{webview_resolve_action.js → 1.0/webview_resolve_action.js} +0 -0
  79. /package/providers/_builtin/ide/pearai/scripts/{webview_send_message.js → 1.0/webview_send_message.js} +0 -0
  80. /package/providers/_builtin/ide/pearai/scripts/{webview_set_mode.js → 1.0/webview_set_mode.js} +0 -0
  81. /package/providers/_builtin/ide/pearai/scripts/{webview_set_model.js → 1.0/webview_set_model.js} +0 -0
  82. /package/providers/_builtin/ide/pearai/scripts/{webview_switch_session.js → 1.0/webview_switch_session.js} +0 -0
  83. /package/providers/_builtin/ide/trae/scripts/{focus_editor.js → 1.0/focus_editor.js} +0 -0
  84. /package/providers/_builtin/ide/trae/scripts/{list_chats.js → 1.0/list_chats.js} +0 -0
  85. /package/providers/_builtin/ide/trae/scripts/{list_models.js → 1.0/list_models.js} +0 -0
  86. /package/providers/_builtin/ide/trae/scripts/{list_modes.js → 1.0/list_modes.js} +0 -0
  87. /package/providers/_builtin/ide/trae/scripts/{new_session.js → 1.0/new_session.js} +0 -0
  88. /package/providers/_builtin/ide/trae/scripts/{open_panel.js → 1.0/open_panel.js} +0 -0
  89. /package/providers/_builtin/ide/trae/scripts/{read_chat.js → 1.0/read_chat.js} +0 -0
  90. /package/providers/_builtin/ide/trae/scripts/{resolve_action.js → 1.0/resolve_action.js} +0 -0
  91. /package/providers/_builtin/ide/trae/scripts/{send_message.js → 1.0/send_message.js} +0 -0
  92. /package/providers/_builtin/ide/trae/scripts/{set_mode.js → 1.0/set_mode.js} +0 -0
  93. /package/providers/_builtin/ide/trae/scripts/{set_model.js → 1.0/set_model.js} +0 -0
  94. /package/providers/_builtin/ide/trae/scripts/{switch_session.js → 1.0/switch_session.js} +0 -0
  95. /package/providers/_builtin/ide/windsurf/scripts/{focus_editor.js → 1.0/focus_editor.js} +0 -0
  96. /package/providers/_builtin/ide/windsurf/scripts/{list_chats.js → 1.0/list_chats.js} +0 -0
  97. /package/providers/_builtin/ide/windsurf/scripts/{list_models.js → 1.0/list_models.js} +0 -0
  98. /package/providers/_builtin/ide/windsurf/scripts/{list_modes.js → 1.0/list_modes.js} +0 -0
  99. /package/providers/_builtin/ide/windsurf/scripts/{new_session.js → 1.0/new_session.js} +0 -0
  100. /package/providers/_builtin/ide/windsurf/scripts/{open_panel.js → 1.0/open_panel.js} +0 -0
  101. /package/providers/_builtin/ide/windsurf/scripts/{read_chat.js → 1.0/read_chat.js} +0 -0
  102. /package/providers/_builtin/ide/windsurf/scripts/{resolve_action.js → 1.0/resolve_action.js} +0 -0
  103. /package/providers/_builtin/ide/windsurf/scripts/{send_message.js → 1.0/send_message.js} +0 -0
  104. /package/providers/_builtin/ide/windsurf/scripts/{set_mode.js → 1.0/set_mode.js} +0 -0
  105. /package/providers/_builtin/ide/windsurf/scripts/{set_model.js → 1.0/set_model.js} +0 -0
  106. /package/providers/_builtin/ide/windsurf/scripts/{switch_session.js → 1.0/switch_session.js} +0 -0
@@ -63,5 +63,7 @@
63
63
  "min": 30,
64
64
  "max": 600
65
65
  }
66
- }
67
- }
66
+ },
67
+ "defaultScriptDir": "scripts/1.0",
68
+ "compatibility": []
69
+ }
@@ -62,5 +62,7 @@
62
62
  "min": 30,
63
63
  "max": 600
64
64
  }
65
- }
66
- }
65
+ },
66
+ "defaultScriptDir": "scripts/1.0",
67
+ "compatibility": []
68
+ }
@@ -49,5 +49,7 @@
49
49
  "min": 30,
50
50
  "max": 600
51
51
  }
52
- }
53
- }
52
+ },
53
+ "defaultScriptDir": "scripts/1.0",
54
+ "compatibility": []
55
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2026.03.22",
2
+ "version": "2026.03.23",
3
3
  "providers": {
4
4
  "agentpool-acp": {
5
5
  "providerVersion": "0.0.0",
@@ -112,6 +112,21 @@ export class AgentStreamPoller {
112
112
  }
113
113
  }
114
114
  }
115
+
116
+ // 1c. If the active agent stream belongs to a now-disabled extension, detach it
117
+ if (this._activeIdeType === ideType && agentStreamManager.activeAgentType) {
118
+ const activeType = agentStreamManager.activeAgentType;
119
+ const enabledExtTypes = new Set(
120
+ providerLoader.getEnabledExtensionProviders(ideType).map((p: any) => p.type)
121
+ );
122
+ if (!enabledExtTypes.has(activeType)) {
123
+ LOG.info('AgentStream', `Active agent ${activeType} was disabled for ${ideType} — detaching`);
124
+ await agentStreamManager.switchActiveAgent(cdp, null);
125
+ this._activeIdeType = null;
126
+ // Report empty streams so dashboard removes the tab
127
+ this.deps.onStreamsUpdated?.(ideType, []);
128
+ }
129
+ }
115
130
  }
116
131
 
117
132
  // ─── Phase 2: Agent session sync + collect ───
@@ -28,7 +28,9 @@ try {
28
28
  if (os.platform() !== 'win32') {
29
29
  try {
30
30
  const fs = require('fs');
31
- const ptyDir = path.dirname(require.resolve('node-pty'));
31
+ // require.resolve('node-pty') → .../node-pty/lib/index.js
32
+ // prebuilds/ is at .../node-pty/prebuilds/, not .../node-pty/lib/prebuilds/
33
+ const ptyDir = path.resolve(path.dirname(require.resolve('node-pty')), '..');
32
34
  const arch = os.arch() === 'arm64' ? 'darwin-arm64' : 'darwin-x64';
33
35
  const helper = path.join(ptyDir, 'prebuilds', arch, 'spawn-helper');
34
36
  if (fs.existsSync(helper)) {
@@ -299,7 +301,7 @@ export class ProviderCliAdapter implements CliAdapter {
299
301
  this.timeouts = {
300
302
  ptyFlush: t.ptyFlush ?? 50,
301
303
  dialogAccept: t.dialogAccept ?? 300,
302
- approvalCooldown: t.approvalCooldown ?? 2000,
304
+ approvalCooldown: t.approvalCooldown ?? 500,
303
305
  generatingIdle: t.generatingIdle ?? 6000,
304
306
  idleFinish: t.idleFinish ?? 5000,
305
307
  maxResponse: t.maxResponse ?? 300000,
@@ -471,39 +473,41 @@ export class ProviderCliAdapter implements CliAdapter {
471
473
  // ─── Phase 2: Approval detect
472
474
  const hasApproval = patterns.approval.some(p => p.test(this.recentOutputBuffer));
473
475
  if (hasApproval && this.currentStatus !== 'waiting_approval') {
474
- if (this.lastApprovalResolvedAt && (Date.now() - this.lastApprovalResolvedAt) < this.timeouts.approvalCooldown) return;
475
-
476
- // Capture context before clearing (recentOutputBuffer still has content here)
477
- const ctxLines = this.recentOutputBuffer.split('\n')
478
- .map(l => l.trim())
479
- .filter(l => l && !/^[─═╭╮╰╯│]+$/.test(l));
480
- this.isWaitingForResponse = true;
481
- this.setStatus('waiting_approval', 'approval_pattern');
482
- this.recentOutputBuffer = '';
483
- this.approvalTransitionBuffer = '';
484
- this.activeModal = {
485
- message: ctxLines.slice(-5).join(' ').slice(0, 200) || 'Approval required',
486
- buttons: this.cliType === 'claude-cli'
487
- ? ['Yes (y)', 'Always allow (a)', 'Deny (Esc)']
488
- : ['Allow once', 'Always allow', 'Deny'],
489
- };
490
- if (this.idleTimeout) clearTimeout(this.idleTimeout);
491
- // Safety timeout — if stuck in waiting_approval, auto-exit after 60s
492
- if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
493
- this.approvalExitTimeout = setTimeout(() => {
494
- if (this.currentStatus === 'waiting_approval') {
495
- LOG.warn('CLI', `[${this.cliType}] Approval timeout — auto-exiting waiting_approval`);
496
- this.activeModal = null;
497
- this.lastApprovalResolvedAt = Date.now();
498
- this.recentOutputBuffer = '';
499
- this.approvalTransitionBuffer = '';
500
- this.approvalExitTimeout = null;
501
- this.setStatus(this.isWaitingForResponse ? 'generating' : 'idle', 'approval_cleared');
502
- this.onStatusChange?.();
503
- }
504
- }, 60000);
505
- this.onStatusChange?.();
506
- return;
476
+ const inCooldown = this.lastApprovalResolvedAt && (Date.now() - this.lastApprovalResolvedAt) < this.timeouts.approvalCooldown;
477
+ if (!inCooldown) {
478
+ // Capture context before clearing (recentOutputBuffer still has content here)
479
+ const ctxLines = this.recentOutputBuffer.split('\n')
480
+ .map(l => l.trim())
481
+ .filter(l => l && !/^[─═╭╮╰╯│]+$/.test(l));
482
+ this.isWaitingForResponse = true;
483
+ this.setStatus('waiting_approval', 'approval_pattern');
484
+ this.recentOutputBuffer = '';
485
+ this.approvalTransitionBuffer = '';
486
+ this.activeModal = {
487
+ message: ctxLines.slice(-5).join(' ').slice(0, 200) || 'Approval required',
488
+ buttons: this.cliType === 'claude-cli'
489
+ ? ['Yes (y)', 'Always allow (a)', 'Deny (Esc)']
490
+ : ['Allow once', 'Always allow', 'Deny'],
491
+ };
492
+ if (this.idleTimeout) clearTimeout(this.idleTimeout);
493
+ // Safety timeout — if stuck in waiting_approval, auto-exit after 60s
494
+ if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
495
+ this.approvalExitTimeout = setTimeout(() => {
496
+ if (this.currentStatus === 'waiting_approval') {
497
+ LOG.warn('CLI', `[${this.cliType}] Approval timeout — auto-exiting waiting_approval`);
498
+ this.activeModal = null;
499
+ this.lastApprovalResolvedAt = Date.now();
500
+ this.recentOutputBuffer = '';
501
+ this.approvalTransitionBuffer = '';
502
+ this.approvalExitTimeout = null;
503
+ this.setStatus(this.isWaitingForResponse ? 'generating' : 'idle', 'approval_cleared');
504
+ this.onStatusChange?.();
505
+ }
506
+ }, 60000);
507
+ this.onStatusChange?.();
508
+ return;
509
+ }
510
+ // In cooldown — don't set approval, but DO continue to other phases
507
511
  }
508
512
 
509
513
  // ─── Phase 3: Approval release
@@ -563,7 +567,12 @@ export class ProviderCliAdapter implements CliAdapter {
563
567
  // has '>' in code blocks, shell examples, or mid-response lines.
564
568
  const trailingLines = cleanData.split('\n').slice(-2).join('\n');
565
569
  if (patterns.prompt.some(p => p.test(trailingLines))) {
566
- this.finishResponse();
570
+ // Guard: don't finishResponse if approval text is also present —
571
+ // Claude Code's approval UI can contain prompt-like characters
572
+ const hasApprovalHere = patterns.approval.some(p => p.test(this.recentOutputBuffer));
573
+ if (!hasApprovalHere) {
574
+ this.finishResponse();
575
+ }
567
576
  } else {
568
577
  this.idleTimeout = setTimeout(() => {
569
578
  if (this.isWaitingForResponse && this.responseBuffer.trim()) {
@@ -1,73 +0,0 @@
1
- /**
2
- * CDP Scripts for Cline
3
- */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const SCRIPTS_DIR = path.join(__dirname, 'scripts');
8
- function loadScript(name) {
9
- try { return fs.readFileSync(path.join(SCRIPTS_DIR, name), 'utf8'); }
10
- catch { return null; }
11
- }
12
-
13
-
14
- module.exports.readChat = function readChat() {
15
- return loadScript('read_chat.js');
16
- };
17
-
18
- module.exports.sendMessage = function sendMessage(text) {
19
- const script = loadScript('send_message.js');
20
- if (!script) return null;
21
- return script.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text));
22
- };
23
-
24
- module.exports.listSessions = function listSessions() {
25
- return loadScript('list_chats.js');
26
- };
27
-
28
- module.exports.switchSession = function switchSession(sessionId) {
29
- const script = loadScript('switch_session.js');
30
- if (!script) return null;
31
- return script.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId));
32
- };
33
-
34
- module.exports.newSession = function newSession() {
35
- return loadScript('new_session.js');
36
- };
37
-
38
- module.exports.resolveAction = function resolveAction(action) {
39
- const script = loadScript('resolve_action.js');
40
- if (!script) return null;
41
- return script.replace(/\$\{\s*ACTION\s*\}/g, JSON.stringify(action));
42
- };
43
-
44
- module.exports.focusEditor = function focusEditor() {
45
- return loadScript('focus_editor.js');
46
- };
47
-
48
- module.exports.openPanel = function openPanel() {
49
- return loadScript('open_panel.js');
50
- };
51
-
52
- module.exports.listModels = function listModels() {
53
- return loadScript('list_models.js');
54
- };
55
-
56
- module.exports.setModel = function setModel(params) {
57
- const model = params?.model || params;
58
- const script = loadScript('set_model.js');
59
- if (!script) return null;
60
- return script.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model));
61
- };
62
-
63
- module.exports.listModes = function listModes() {
64
- return loadScript('list_modes.js');
65
- };
66
-
67
- module.exports.setMode = function setMode(params) {
68
- const mode = params?.mode || params;
69
- const script = loadScript('set_mode.js');
70
- if (!script) return null;
71
- return script.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode));
72
- };
73
-
@@ -1,94 +0,0 @@
1
- /**
2
- * CDP Scripts for Codex (openai.chatgpt)
3
- *
4
- * All scripts run inside the Codex webview frame via evaluateInWebviewFrame.
5
- * Script names containing "Webview" are automatically routed through
6
- * evaluateInWebviewFrame by DevServer.
7
- *
8
- * For production (ProviderInstance), the AgentStreamAdapter calls
9
- * evaluateInWebviewFrame directly using the provider's webviewMatchText.
10
- */
11
-
12
- const fs = require('fs');
13
- const path = require('path');
14
- const SCRIPTS_DIR = path.join(__dirname, 'scripts');
15
- function loadScript(name) {
16
- try { return fs.readFileSync(path.join(SCRIPTS_DIR, name), 'utf8'); }
17
- catch { return null; }
18
- }
19
-
20
- // ─── Production scripts ───
21
-
22
- module.exports.readChat = function readChat() {
23
- return loadScript('read_chat.js');
24
- };
25
-
26
- module.exports.sendMessage = function sendMessage(text) {
27
- const script = loadScript('send_message.js');
28
- if (!script) return null;
29
- return script.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text));
30
- };
31
-
32
- module.exports.resolveAction = function resolveAction(action) {
33
- const script = loadScript('resolve_action.js');
34
- if (!script) return null;
35
- return script.replace(/\$\{\s*ACTION\s*\}/g, JSON.stringify(action));
36
- };
37
-
38
- module.exports.listModels = function listModels() {
39
- return loadScript('list_models.js');
40
- };
41
-
42
- module.exports.setModel = function setModel(params) {
43
- const model = params?.model || params;
44
- const script = loadScript('set_model.js');
45
- if (!script) return null;
46
- return script.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model));
47
- };
48
-
49
- module.exports.newSession = function newSession() {
50
- return loadScript('new_session.js');
51
- };
52
-
53
- // ─── DevConsole debug helpers (names contain "Webview" for auto-routing) ───
54
-
55
- module.exports.readChatWebview = function readChatWebview() {
56
- return loadScript('read_chat.js');
57
- };
58
-
59
- module.exports.sendMessageWebview = function sendMessageWebview(text) {
60
- const script = loadScript('send_message.js');
61
- if (!script) return null;
62
- return script.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text));
63
- };
64
-
65
- module.exports.listModelsWebview = function listModelsWebview() {
66
- return loadScript('list_models.js');
67
- };
68
-
69
- module.exports.setModelWebview = function setModelWebview(params) {
70
- const model = params?.model || params;
71
- const script = loadScript('set_model.js');
72
- if (!script) return null;
73
- return script.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model));
74
- };
75
-
76
- module.exports.newSessionWebview = function newSessionWebview() {
77
- return loadScript('new_session.js');
78
- };
79
-
80
- module.exports.exploreWebview = function exploreWebview() {
81
- return loadScript('explore_dom.js');
82
- };
83
-
84
- module.exports.exploreControlsWebview = function exploreControlsWebview() {
85
- return loadScript('explore_controls_webview.js');
86
- };
87
-
88
- module.exports.exploreDropdownWebview = function exploreDropdownWebview() {
89
- return loadScript('explore_dropdown_webview.js');
90
- };
91
-
92
- module.exports.inspectCodeWebview = function inspectCodeWebview() {
93
- return loadScript('inspect_code_webview.js');
94
- };
@@ -1,62 +0,0 @@
1
- /**
2
- * CDP Scripts for Kiro
3
- */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const SCRIPTS_DIR = path.join(__dirname, 'scripts');
8
- function loadScript(name) {
9
- try { return fs.readFileSync(path.join(SCRIPTS_DIR, name), 'utf8'); }
10
- catch { return null; }
11
- }
12
-
13
-
14
- module.exports.webviewReadChat = function webviewReadChat() { return loadScript('webview_read_chat.js'); };
15
-
16
- module.exports.webviewSendMessage = function webviewSendMessage(text) {
17
- const s = loadScript('webview_send_message.js');
18
- return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
19
- };
20
-
21
- module.exports.sendMessage = function sendMessage(text) {
22
- const s = loadScript('send_message.js');
23
- return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
24
- };
25
-
26
- module.exports.resolveAction = function resolveAction(params) {
27
- const action = typeof params === 'string' ? params : params?.action || 'approve';
28
- const buttonText = params?.button || params?.buttonText
29
- || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
30
- const s = loadScript('resolve_action.js');
31
- return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
32
- };
33
-
34
- module.exports.openPanel = function openPanel() { return loadScript('open_panel.js'); };
35
-
36
- module.exports.focusEditor = function focusEditor() { return loadScript('focus_editor.js'); };
37
-
38
- module.exports.webviewListSessions = function webviewListSessions() { return loadScript('webview_list_sessions.js'); };
39
-
40
- module.exports.webviewNewSession = function webviewNewSession() { return loadScript('webview_new_session.js'); };
41
-
42
- module.exports.webviewSwitchSession = function webviewSwitchSession(sessionId) {
43
- const s = loadScript('webview_switch_session.js');
44
- return s ? s.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId)) : null;
45
- };
46
-
47
- module.exports.webviewListModels = function webviewListModels() { return loadScript('webview_list_models.js'); };
48
-
49
- module.exports.webviewSetModel = function webviewSetModel(params) {
50
- const model = typeof params === 'string' ? params : params?.model;
51
- const s = loadScript('webview_set_model.js');
52
- return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
53
- };
54
-
55
- module.exports.webviewListModes = function webviewListModes() { return loadScript('webview_list_modes.js'); };
56
-
57
- module.exports.webviewSetMode = function webviewSetMode(params) {
58
- const mode = typeof params === 'string' ? params : params?.mode;
59
- const s = loadScript('webview_set_mode.js');
60
- return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
61
- };
62
-
@@ -1,74 +0,0 @@
1
- /**
2
- * CDP Scripts for PearAI
3
- */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const SCRIPTS_DIR = path.join(__dirname, 'scripts');
8
- function loadScript(name) {
9
- try { return fs.readFileSync(path.join(SCRIPTS_DIR, name), 'utf8'); }
10
- catch { return null; }
11
- }
12
-
13
-
14
- module.exports.webviewReadChat = function webviewReadChat() { return loadScript('webview_read_chat.js'); };
15
-
16
- module.exports.webviewSendMessage = function webviewSendMessage(text) {
17
- const s = loadScript('webview_send_message.js');
18
- return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
19
- };
20
-
21
- module.exports.sendMessage = function sendMessage(text) {
22
- const s = loadScript('send_message.js');
23
- return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
24
- };
25
-
26
- module.exports.resolveAction = function resolveAction(params) {
27
- const action = typeof params === 'string' ? params : params?.action || 'approve';
28
- const buttonText = params?.button || params?.buttonText
29
- || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
30
- const s = loadScript('resolve_action.js');
31
- return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
32
- };
33
-
34
- module.exports.webviewResolveAction = function webviewResolveAction(params) {
35
- const action = typeof params === 'string' ? params : params?.action || 'approve';
36
- const buttonText = params?.button || params?.buttonText
37
- || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
38
- const s = loadScript('webview_resolve_action.js');
39
- return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
40
- };
41
-
42
- module.exports.openPanel = function openPanel() { return loadScript('open_panel.js'); };
43
-
44
- module.exports.focusEditor = function focusEditor() { return loadScript('focus_editor.js'); };
45
-
46
- module.exports.newSession = function newSession() { return loadScript('new_session.js'); };
47
-
48
- module.exports.listSessions = function listSessions() { return loadScript('list_sessions.js'); };
49
-
50
- module.exports.webviewNewSession = function webviewNewSession() { return loadScript('webview_new_session.js'); };
51
-
52
- module.exports.webviewListSessions = function webviewListSessions() { return loadScript('webview_list_sessions.js'); };
53
-
54
- module.exports.webviewSwitchSession = function webviewSwitchSession(sessionId) {
55
- const s = loadScript('webview_switch_session.js');
56
- return s ? s.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId)) : null;
57
- };
58
-
59
- module.exports.webviewListModels = function webviewListModels() { return loadScript('webview_list_models.js'); };
60
-
61
- module.exports.webviewSetModel = function webviewSetModel(params) {
62
- const model = typeof params === 'string' ? params : params?.model;
63
- const s = loadScript('webview_set_model.js');
64
- return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
65
- };
66
-
67
- module.exports.webviewListModes = function webviewListModes() { return loadScript('webview_list_modes.js'); };
68
-
69
- module.exports.webviewSetMode = function webviewSetMode(params) {
70
- const mode = typeof params === 'string' ? params : params?.mode;
71
- const s = loadScript('webview_set_mode.js');
72
- return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
73
- };
74
-
@@ -1,57 +0,0 @@
1
- /**
2
- * CDP Scripts for Trae
3
- */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const SCRIPTS_DIR = path.join(__dirname, 'scripts');
8
- function loadScript(name) {
9
- try { return fs.readFileSync(path.join(SCRIPTS_DIR, name), 'utf8'); }
10
- catch { return null; }
11
- }
12
-
13
-
14
- module.exports.readChat = function readChat() { return loadScript('read_chat.js'); };
15
-
16
- module.exports.sendMessage = function sendMessage(text) {
17
- const s = loadScript('send_message.js');
18
- return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
19
- };
20
-
21
- module.exports.resolveAction = function resolveAction(params) {
22
- const action = typeof params === 'string' ? params : params?.action || 'approve';
23
- const buttonText = params?.button || params?.buttonText
24
- || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
25
- const s = loadScript('resolve_action.js');
26
- return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
27
- };
28
-
29
- module.exports.openPanel = function openPanel() { return loadScript('open_panel.js'); };
30
-
31
- module.exports.focusEditor = function focusEditor() { return loadScript('focus_editor.js'); };
32
-
33
- module.exports.newSession = function newSession() { return loadScript('new_session.js'); };
34
-
35
- module.exports.listSessions = function listSessions() { return loadScript('list_chats.js'); };
36
-
37
- module.exports.switchSession = function switchSession(sessionId) {
38
- const s = loadScript('switch_session.js');
39
- return s ? s.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId)) : null;
40
- };
41
-
42
- module.exports.listModels = function listModels() { return loadScript('list_models.js'); };
43
-
44
- module.exports.setModel = function setModel(params) {
45
- const model = typeof params === 'string' ? params : params?.model;
46
- const s = loadScript('set_model.js');
47
- return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
48
- };
49
-
50
- module.exports.listModes = function listModes() { return loadScript('list_modes.js'); };
51
-
52
- module.exports.setMode = function setMode(params) {
53
- const mode = typeof params === 'string' ? params : params?.mode;
54
- const s = loadScript('set_mode.js');
55
- return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
56
- };
57
-
@@ -1,57 +0,0 @@
1
- /**
2
- * CDP Scripts for Windsurf
3
- */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const SCRIPTS_DIR = path.join(__dirname, 'scripts');
8
- function loadScript(name) {
9
- try { return fs.readFileSync(path.join(SCRIPTS_DIR, name), 'utf8'); }
10
- catch { return null; }
11
- }
12
-
13
-
14
- module.exports.readChat = function readChat() { return loadScript('read_chat.js'); };
15
-
16
- module.exports.sendMessage = function sendMessage(text) {
17
- const s = loadScript('send_message.js');
18
- return s ? s.replace(/\$\{\s*MESSAGE\s*\}/g, JSON.stringify(text)) : null;
19
- };
20
-
21
- module.exports.listSessions = function listSessions() { return loadScript('list_chats.js'); };
22
-
23
- module.exports.switchSession = function switchSession(sessionId) {
24
- const s = loadScript('switch_session.js');
25
- return s ? s.replace(/\$\{\s*SESSION_ID\s*\}/g, JSON.stringify(sessionId)) : null;
26
- };
27
-
28
- module.exports.newSession = function newSession() { return loadScript('new_session.js'); };
29
-
30
- module.exports.resolveAction = function resolveAction(params) {
31
- const action = typeof params === 'string' ? params : params?.action || 'approve';
32
- const buttonText = params?.button || params?.buttonText
33
- || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
34
- const s = loadScript('resolve_action.js');
35
- return s ? s.replace(/\$\{\s*BUTTON_TEXT\s*\}/g, JSON.stringify(buttonText)) : null;
36
- };
37
-
38
- module.exports.focusEditor = function focusEditor() { return loadScript('focus_editor.js'); };
39
-
40
- module.exports.listModels = function listModels() { return loadScript('list_models.js'); };
41
-
42
- module.exports.setModel = function setModel(params) {
43
- const model = typeof params === 'string' ? params : params?.model;
44
- const s = loadScript('set_model.js');
45
- return s ? s.replace(/\$\{\s*MODEL\s*\}/g, JSON.stringify(model)) : null;
46
- };
47
-
48
- module.exports.listModes = function listModes() { return loadScript('list_modes.js'); };
49
-
50
- module.exports.setMode = function setMode(params) {
51
- const mode = typeof params === 'string' ? params : params?.mode;
52
- const s = loadScript('set_mode.js');
53
- return s ? s.replace(/\$\{\s*MODE\s*\}/g, JSON.stringify(mode)) : null;
54
- };
55
-
56
- module.exports.openPanel = function openPanel() { return loadScript('open_panel.js'); };
57
-