@adhdev/daemon-core 0.6.8 → 0.6.11

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.
@@ -40,6 +40,12 @@
40
40
  "inputMethod": "cdp-type-and-send",
41
41
  "inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
42
42
  "webviewMatchText": "chat-text-area",
43
+ "versionCommand": "pearai --version",
44
+ "providerVersion": "0.0.0",
45
+ "compatibility": [
46
+ { "ideVersion": ">=1.0.0", "scriptDir": "scripts/1.0" }
47
+ ],
48
+ "defaultScriptDir": "scripts/1.0",
43
49
  "settings": {
44
50
  "approvalAlert": {
45
51
  "type": "boolean",
@@ -63,7 +69,5 @@
63
69
  "min": 30,
64
70
  "max": 600
65
71
  }
66
- },
67
- "defaultScriptDir": "scripts/1.0",
68
- "compatibility": []
72
+ }
69
73
  }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * CDP Scripts — Router
3
+ *
4
+ * Version routing is handled by ProviderLoader:
5
+ * Pattern:
6
+ * - Scripts WITHOUT params: loaded as-is (self-invoking IIFE)
7
+ * - Scripts WITH params: loaded as function expression, invoked with params JSON
8
+ * e.g. `(${script})(${JSON.stringify(params)})`
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ function load(name) {
17
+ try { return fs.readFileSync(path.join(__dirname, name), 'utf-8'); }
18
+ catch { return null; }
19
+ }
20
+
21
+ function withParams(name, params) {
22
+ let script = load(name);
23
+ if (!script) return null;
24
+
25
+ // For legacy scripts checking MESSAGE, interpolate them manually
26
+ if (script.includes('${ MESSAGE }')) {
27
+ const msg = params?.MESSAGE || params?.text || '';
28
+ return script.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
29
+ }
30
+ if (script.includes('${ BUTTON_TEXT }')) {
31
+ const btn = params?.BUTTON_TEXT || params?.buttonText || '';
32
+ return script.replace(/\$\{ BUTTON_TEXT \}/g, JSON.stringify(btn));
33
+ }
34
+
35
+ return `(${script})(${JSON.stringify(params)})`;
36
+ }
37
+
38
+ // ─── Core (no params — IIFE) ───
39
+
40
+ module.exports.readChat = () => load('read_chat.js') || load('webview_read_chat.js');
41
+ module.exports.sendMessage = (params) => {
42
+ let s = load('send_message.js');
43
+ if (!s) s = load('webview_send_message.js');
44
+ if (!s) return null;
45
+ // Legacy template substitution fallback
46
+ if (s.includes('${ MESSAGE }')) {
47
+ const msg = params?.MESSAGE || params?.text || params || '';
48
+ return s.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
49
+ }
50
+ return withParams('send_message.js', params) || withParams('webview_send_message.js', params);
51
+ };
52
+ module.exports.listSessions = () => load('list_sessions.js');
53
+ module.exports.newSession = () => load('new_session.js');
54
+ module.exports.focusEditor = () => load('focus_editor.js');
55
+ module.exports.openPanel = () => load('open_panel.js');
56
+ module.exports.listModels = () => load('list_models.js');
57
+ module.exports.listModes = () => load('list_modes.js');
58
+
59
+ // ─── With params (function expression) ───
60
+
61
+ module.exports.switchSession = (params) => {
62
+ const index = typeof params === 'number' ? params : params?.index ?? 0;
63
+ const title = typeof params === 'string' ? params : params?.title || null;
64
+ return withParams('switch_session.js', { index, title });
65
+ };
66
+
67
+ module.exports.resolveAction = (params) => {
68
+ const action = typeof params === 'string' ? params : params?.action || 'approve';
69
+ const buttonText = params?.button || params?.buttonText
70
+ || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
71
+ return withParams('resolve_action.js', { buttonText, BUTTON_TEXT: buttonText });
72
+ };
73
+
74
+ module.exports.setModel = (params) => {
75
+ const model = typeof params === 'string' ? params : params?.model;
76
+ return withParams('set_model.js', { model });
77
+ };
78
+
79
+ module.exports.setMode = (params) => {
80
+ const mode = typeof params === 'string' ? params : params?.mode;
81
+ return withParams('set_mode.js', { mode });
82
+ };
@@ -39,6 +39,12 @@
39
39
  },
40
40
  "inputMethod": "cdp-type-and-send",
41
41
  "inputSelector": ".chat-input-v2-input-box-editable, [contenteditable=\"true\"][role=\"textbox\"]",
42
+ "versionCommand": "trae --version",
43
+ "providerVersion": "0.0.0",
44
+ "compatibility": [
45
+ { "ideVersion": ">=1.0.0", "scriptDir": "scripts/1.0" }
46
+ ],
47
+ "defaultScriptDir": "scripts/1.0",
42
48
  "settings": {
43
49
  "approvalAlert": {
44
50
  "type": "boolean",
@@ -62,7 +68,5 @@
62
68
  "min": 30,
63
69
  "max": 600
64
70
  }
65
- },
66
- "defaultScriptDir": "scripts/1.0",
67
- "compatibility": []
71
+ }
68
72
  }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * CDP Scripts — Router
3
+ *
4
+ * Version routing is handled by ProviderLoader:
5
+ * Pattern:
6
+ * - Scripts WITHOUT params: loaded as-is (self-invoking IIFE)
7
+ * - Scripts WITH params: loaded as function expression, invoked with params JSON
8
+ * e.g. `(${script})(${JSON.stringify(params)})`
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ function load(name) {
17
+ try { return fs.readFileSync(path.join(__dirname, name), 'utf-8'); }
18
+ catch { return null; }
19
+ }
20
+
21
+ function withParams(name, params) {
22
+ let script = load(name);
23
+ if (!script) return null;
24
+
25
+ // For legacy scripts checking MESSAGE, interpolate them manually
26
+ if (script.includes('${ MESSAGE }')) {
27
+ const msg = params?.MESSAGE || params?.text || '';
28
+ return script.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
29
+ }
30
+ if (script.includes('${ BUTTON_TEXT }')) {
31
+ const btn = params?.BUTTON_TEXT || params?.buttonText || '';
32
+ return script.replace(/\$\{ BUTTON_TEXT \}/g, JSON.stringify(btn));
33
+ }
34
+
35
+ return `(${script})(${JSON.stringify(params)})`;
36
+ }
37
+
38
+ // ─── Core (no params — IIFE) ───
39
+
40
+ module.exports.readChat = () => load('read_chat.js') || load('webview_read_chat.js');
41
+ module.exports.sendMessage = (params) => {
42
+ let s = load('send_message.js');
43
+ if (!s) s = load('webview_send_message.js');
44
+ if (!s) return null;
45
+ // Legacy template substitution fallback
46
+ if (s.includes('${ MESSAGE }')) {
47
+ const msg = params?.MESSAGE || params?.text || params || '';
48
+ return s.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
49
+ }
50
+ return withParams('send_message.js', params) || withParams('webview_send_message.js', params);
51
+ };
52
+ module.exports.listSessions = () => load('list_sessions.js');
53
+ module.exports.newSession = () => load('new_session.js');
54
+ module.exports.focusEditor = () => load('focus_editor.js');
55
+ module.exports.openPanel = () => load('open_panel.js');
56
+ module.exports.listModels = () => load('list_models.js');
57
+ module.exports.listModes = () => load('list_modes.js');
58
+
59
+ // ─── With params (function expression) ───
60
+
61
+ module.exports.switchSession = (params) => {
62
+ const index = typeof params === 'number' ? params : params?.index ?? 0;
63
+ const title = typeof params === 'string' ? params : params?.title || null;
64
+ return withParams('switch_session.js', { index, title });
65
+ };
66
+
67
+ module.exports.resolveAction = (params) => {
68
+ const action = typeof params === 'string' ? params : params?.action || 'approve';
69
+ const buttonText = params?.button || params?.buttonText
70
+ || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
71
+ return withParams('resolve_action.js', { buttonText, BUTTON_TEXT: buttonText });
72
+ };
73
+
74
+ module.exports.setModel = (params) => {
75
+ const model = typeof params === 'string' ? params : params?.model;
76
+ return withParams('set_model.js', { model });
77
+ };
78
+
79
+ module.exports.setMode = (params) => {
80
+ const mode = typeof params === 'string' ? params : params?.mode;
81
+ return withParams('set_mode.js', { mode });
82
+ };
@@ -37,6 +37,12 @@
37
37
  },
38
38
  "inputMethod": "cdp-type-and-send",
39
39
  "inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
40
+ "versionCommand": "code --version",
41
+ "providerVersion": "0.0.0",
42
+ "compatibility": [
43
+ { "ideVersion": ">=1.0.0", "scriptDir": "scripts/1.0" }
44
+ ],
45
+ "defaultScriptDir": "scripts/1.0",
40
46
  "settings": {
41
47
  "approvalAlert": {
42
48
  "type": "boolean",
@@ -35,6 +35,12 @@
35
35
  },
36
36
  "inputMethod": "cdp-type-and-send",
37
37
  "inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
38
+ "versionCommand": "code-insiders --version",
39
+ "providerVersion": "0.0.0",
40
+ "compatibility": [
41
+ { "ideVersion": ">=1.0.0", "scriptDir": "scripts/1.0" }
42
+ ],
43
+ "defaultScriptDir": "scripts/1.0",
38
44
  "settings": {
39
45
  "approvalAlert": {
40
46
  "type": "boolean",
@@ -36,6 +36,12 @@
36
36
  },
37
37
  "inputMethod": "cdp-type-and-send",
38
38
  "inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
39
+ "versionCommand": "codium --version",
40
+ "providerVersion": "0.0.0",
41
+ "compatibility": [
42
+ { "ideVersion": ">=1.0.0", "scriptDir": "scripts/1.0" }
43
+ ],
44
+ "defaultScriptDir": "scripts/1.0",
39
45
  "settings": {
40
46
  "approvalAlert": {
41
47
  "type": "boolean",
@@ -24,8 +24,12 @@
24
24
  "/Applications/Windsurf.app"
25
25
  ]
26
26
  },
27
- "inputMethod": "cdp-type-and-send",
28
- "inputSelector": "[contenteditable=\"true\"][role=\"textbox\"]",
27
+ "versionCommand": "windsurf --version",
28
+ "providerVersion": "1.0.0",
29
+ "compatibility": [
30
+ { "ideVersion": ">=1.0.0", "scriptDir": "scripts/1.0" }
31
+ ],
32
+ "defaultScriptDir": "scripts/1.0",
29
33
  "settings": {
30
34
  "approvalAlert": {
31
35
  "type": "boolean",
@@ -49,7 +53,5 @@
49
53
  "min": 30,
50
54
  "max": 600
51
55
  }
52
- },
53
- "defaultScriptDir": "scripts/1.0",
54
- "compatibility": []
56
+ }
55
57
  }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * CDP Scripts — Router
3
+ *
4
+ * Version routing is handled by ProviderLoader:
5
+ * Pattern:
6
+ * - Scripts WITHOUT params: loaded as-is (self-invoking IIFE)
7
+ * - Scripts WITH params: loaded as function expression, invoked with params JSON
8
+ * e.g. `(${script})(${JSON.stringify(params)})`
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ function load(name) {
17
+ try { return fs.readFileSync(path.join(__dirname, name), 'utf-8'); }
18
+ catch { return null; }
19
+ }
20
+
21
+ function withParams(name, params) {
22
+ let script = load(name);
23
+ if (!script) return null;
24
+
25
+ // For legacy scripts checking MESSAGE, interpolate them manually
26
+ if (script.includes('${ MESSAGE }')) {
27
+ const msg = params?.MESSAGE || params?.text || '';
28
+ return script.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
29
+ }
30
+ if (script.includes('${ BUTTON_TEXT }')) {
31
+ const btn = params?.BUTTON_TEXT || params?.buttonText || '';
32
+ return script.replace(/\$\{ BUTTON_TEXT \}/g, JSON.stringify(btn));
33
+ }
34
+
35
+ return `(${script})(${JSON.stringify(params)})`;
36
+ }
37
+
38
+ // ─── Core (no params — IIFE) ───
39
+
40
+ module.exports.readChat = () => load('read_chat.js') || load('webview_read_chat.js');
41
+ module.exports.sendMessage = (params) => {
42
+ let s = load('send_message.js');
43
+ if (!s) s = load('webview_send_message.js');
44
+ if (!s) return null;
45
+ // Legacy template substitution fallback
46
+ if (s.includes('${ MESSAGE }')) {
47
+ const msg = params?.MESSAGE || params?.text || params || '';
48
+ return s.replace(/\$\{ MESSAGE \}/g, JSON.stringify(msg));
49
+ }
50
+ return withParams('send_message.js', params) || withParams('webview_send_message.js', params);
51
+ };
52
+ module.exports.listSessions = () => load('list_sessions.js');
53
+ module.exports.newSession = () => load('new_session.js');
54
+ module.exports.focusEditor = () => load('focus_editor.js');
55
+ module.exports.openPanel = () => load('open_panel.js');
56
+ module.exports.listModels = () => load('list_models.js');
57
+ module.exports.listModes = () => load('list_modes.js');
58
+
59
+ // ─── With params (function expression) ───
60
+
61
+ module.exports.switchSession = (params) => {
62
+ const index = typeof params === 'number' ? params : params?.index ?? 0;
63
+ const title = typeof params === 'string' ? params : params?.title || null;
64
+ return withParams('switch_session.js', { index, title });
65
+ };
66
+
67
+ module.exports.resolveAction = (params) => {
68
+ const action = typeof params === 'string' ? params : params?.action || 'approve';
69
+ const buttonText = params?.button || params?.buttonText
70
+ || (action === 'approve' ? 'Accept' : action === 'reject' ? 'Reject' : action);
71
+ return withParams('resolve_action.js', { buttonText, BUTTON_TEXT: buttonText });
72
+ };
73
+
74
+ module.exports.setModel = (params) => {
75
+ const model = typeof params === 'string' ? params : params?.model;
76
+ return withParams('set_model.js', { model });
77
+ };
78
+
79
+ module.exports.setMode = (params) => {
80
+ const mode = typeof params === 'string' ? params : params?.mode;
81
+ return withParams('set_mode.js', { mode });
82
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2026.03.23",
2
+ "version": "2026.03.26",
3
3
  "providers": {
4
4
  "agentpool-acp": {
5
5
  "providerVersion": "0.0.0",
@@ -240,32 +240,68 @@
240
240
  "pearai": {
241
241
  "providerVersion": "0.0.0",
242
242
  "category": "ide",
243
- "name": "PearAI"
243
+ "name": "PearAI",
244
+ "compatibility": [
245
+ {
246
+ "ideVersion": ">=1.0.0",
247
+ "scriptDir": "scripts/1.0"
248
+ }
249
+ ]
244
250
  },
245
251
  "trae": {
246
252
  "providerVersion": "0.0.0",
247
253
  "category": "ide",
248
- "name": "Trae"
254
+ "name": "Trae",
255
+ "compatibility": [
256
+ {
257
+ "ideVersion": ">=1.0.0",
258
+ "scriptDir": "scripts/1.0"
259
+ }
260
+ ]
249
261
  },
250
262
  "vscode-insiders": {
251
263
  "providerVersion": "0.0.0",
252
264
  "category": "ide",
253
- "name": "Visual Studio Code - Insiders"
265
+ "name": "Visual Studio Code - Insiders",
266
+ "compatibility": [
267
+ {
268
+ "ideVersion": ">=1.0.0",
269
+ "scriptDir": "scripts/1.0"
270
+ }
271
+ ]
254
272
  },
255
273
  "vscode": {
256
274
  "providerVersion": "0.0.0",
257
275
  "category": "ide",
258
- "name": "Visual Studio Code"
276
+ "name": "Visual Studio Code",
277
+ "compatibility": [
278
+ {
279
+ "ideVersion": ">=1.0.0",
280
+ "scriptDir": "scripts/1.0"
281
+ }
282
+ ]
259
283
  },
260
284
  "vscodium": {
261
285
  "providerVersion": "0.0.0",
262
286
  "category": "ide",
263
- "name": "VSCodium"
287
+ "name": "VSCodium",
288
+ "compatibility": [
289
+ {
290
+ "ideVersion": ">=1.0.0",
291
+ "scriptDir": "scripts/1.0"
292
+ }
293
+ ]
264
294
  },
265
295
  "windsurf": {
266
- "providerVersion": "0.0.0",
296
+ "providerVersion": "1.0.0",
267
297
  "category": "ide",
268
- "name": "Windsurf"
298
+ "name": "Windsurf",
299
+ "compatibility": [
300
+ {
301
+ "ideVersion": ">=1.0.0",
302
+ "scriptDir": "scripts/1.0"
303
+ }
304
+ ]
269
305
  }
270
306
  }
271
307
  }
@@ -16,6 +16,7 @@ import { DaemonCliManager } from '../commands/cli-manager.js';
16
16
  import { DaemonAgentStreamManager } from '../agent-stream/manager.js';
17
17
  import { AgentStreamPoller } from '../agent-stream/poller.js';
18
18
  import { ProviderLoader } from '../providers/provider-loader.js';
19
+ import { VersionArchive, detectAllVersions } from '../providers/version-archive.js';
19
20
  import { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
20
21
  import { detectIDEs } from '../detection/ide-detector.js';
21
22
  import { installGlobalInterceptor, LOG } from '../logging/logger.js';
@@ -110,6 +111,22 @@ export async function initDaemonComponents(config: DaemonInitConfig): Promise<Da
110
111
  providerLoader.loadAll();
111
112
  providerLoader.registerToDetector();
112
113
 
114
+ // 2.5 Provider version detection & archive
115
+ LOG.info('Init', 'Detecting provider versions...');
116
+ const versionArchive = new VersionArchive();
117
+ providerLoader.setVersionArchive(versionArchive);
118
+ const versionResults = await detectAllVersions(providerLoader, versionArchive);
119
+ const installedProviders = versionResults.filter(v => v.installed);
120
+ const withVersion = installedProviders.filter(v => v.version);
121
+ LOG.info('Init', `Provider versions: ${installedProviders.length} installed, ${withVersion.length} versioned`);
122
+ for (const v of withVersion) {
123
+ LOG.info('Init', ` ${v.type} (${v.category}): v${v.version}${v.warning ? ' ⚠ ' + v.warning : ''}`);
124
+ }
125
+ const noVersion = installedProviders.filter(v => !v.version);
126
+ if (noVersion.length > 0) {
127
+ LOG.warn('Init', ` ${noVersion.length} installed but version unknown: ${noVersion.map(v => v.type).join(', ')}`);
128
+ }
129
+
113
130
  // 3. Shared state
114
131
  const instanceManager = new ProviderInstanceManager();
115
132
  const cdpManagers = new Map<string, DaemonCdpManager>();
@@ -83,6 +83,7 @@ export function generateFiles(type: string, name: string, category: string, opts
83
83
  } else {
84
84
  meta.inputMethod = 'cdp-type-and-send';
85
85
  meta.inputSelector = '[contenteditable="true"][role="textbox"]';
86
+ if (cli) meta.versionCommand = `${cli} --version`;
86
87
  meta.providerVersion = '1.0.0';
87
88
  meta.compatibility = [
88
89
  { ideVersion: `>=${version}.0`, scriptDir },