@adhdev/daemon-core 0.5.23 → 0.5.25

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.5.23",
3
+ "version": "0.5.25",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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)) {
@@ -188,6 +188,11 @@ export class DaemonCommandHandler implements CommandHelpers {
188
188
  private extractIdeType(args: any): string | undefined {
189
189
  // Also accept explicit ideType from args (P2P input, agentType for extensions)
190
190
  if (args?.ideType) {
191
+ // UUID → managerKey via instanceIdMap (P2P sends UUID instance IDs)
192
+ const mappedKey = this._ctx.instanceIdMap?.get(args.ideType);
193
+ if (mappedKey) {
194
+ return mappedKey;
195
+ }
191
196
  // Exact match first
192
197
  if (this._ctx.cdpManagers.has(args.ideType)) {
193
198
  return args.ideType;