@adhdev/daemon-core 0.7.9 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.7.9",
3
+ "version": "0.7.11",
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",
@@ -12,7 +12,11 @@ import { DaemonCdpInitializer, type CdpInitializerConfig } from '../cdp/initiali
12
12
  import { setupIdeInstance, type CdpSetupContext } from '../cdp/setup.js';
13
13
  import { DaemonCommandHandler } from '../commands/handler.js';
14
14
  import { DaemonCommandRouter, type CommandRouterDeps } from '../commands/router.js';
15
- import { DaemonCliManager } from '../commands/cli-manager.js';
15
+ import {
16
+ DaemonCliManager,
17
+ type CliTransportFactoryParams,
18
+ type HostedCliRuntimeDescriptor,
19
+ } from '../commands/cli-manager.js';
16
20
  import { DaemonAgentStreamManager } from '../agent-stream/manager.js';
17
21
  import { AgentStreamPoller } from '../agent-stream/poller.js';
18
22
  import { ProviderLoader } from '../providers/provider-loader.js';
@@ -23,6 +27,7 @@ import { detectIDEs } from '../detection/ide-detector.js';
23
27
  import { SessionRegistry } from '../sessions/registry.js';
24
28
  import { installGlobalInterceptor, LOG } from '../logging/logger.js';
25
29
  import { loadConfig } from '../config/config.js';
30
+ import type { PtyTransportFactory } from '../cli-adapters/pty-transport.js';
26
31
 
27
32
  // ─── Init Config ───
28
33
 
@@ -36,6 +41,8 @@ export interface DaemonInitConfig {
36
41
  getP2p: () => any;
37
42
  onStatusChange: () => void;
38
43
  removeAgentTracking: (key: string) => void;
44
+ createPtyTransportFactory?: (params: CliTransportFactoryParams) => PtyTransportFactory | null;
45
+ listHostedCliRuntimes?: () => Promise<HostedCliRuntimeDescriptor[]>;
39
46
  };
40
47
 
41
48
  /** CDP config */
@@ -100,6 +100,9 @@ export class GhosttyVtTerminalBackend implements TerminalViewportBackend {
100
100
 
101
101
  constructor(options: TerminalViewportBackendOptions) {
102
102
  const binding = loadGhosttyVtBinding(true);
103
+ if (!binding) {
104
+ throw new Error('ghostty-vt backend requested but no binding is available');
105
+ }
103
106
  this.terminal = binding.createTerminal({
104
107
  cols: Math.max(1, options.cols | 0),
105
108
  rows: Math.max(1, options.rows | 0),
@@ -151,7 +151,7 @@ export async function handleScriptsRun(ctx: DevServerContext, req: http.Incoming
151
151
  return;
152
152
  }
153
153
  // Delegate to handleRunScript
154
- await this.handleRunScript(type, req, res, body);
154
+ await ctx.handleRunScript(type, req, res, body);
155
155
  }
156
156
 
157
157
  export async function handleTypeAndSend(ctx: DevServerContext, type: string, req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
@@ -191,7 +191,7 @@ export async function handleTypeAndSendAt(ctx: DevServerContext, type: string, r
191
191
  }
192
192
 
193
193
  export async function handleScriptHints(ctx: DevServerContext, type: string, _req: http.IncomingMessage, res: http.ServerResponse): Promise<void> {
194
- const dir = this.findProviderDir(type);
194
+ const dir = ctx.findProviderDir(type);
195
195
  if (!dir) { ctx.json(res, 404, { error: `Provider not found: ${type}` }); return; }
196
196
 
197
197
  // Find scripts.js in the provider dir (may be versioned)
@@ -1000,4 +1000,3 @@ export async function handleDomContext(ctx: DevServerContext, type: string, req:
1000
1000
  ctx.json(res, 500, { error: `DOM context collection failed: ${e.message}` });
1001
1001
  }
1002
1002
  }
1003
-
@@ -37,6 +37,7 @@ export interface DevServerContext {
37
37
  sendCliSSE(data: any): void;
38
38
 
39
39
  // Provider directory resolution
40
+ handleRunScript(type: string, req: http.IncomingMessage, res: http.ServerResponse, parsedBody?: any): Promise<void>;
40
41
  findProviderDir(type: string): string | null;
41
42
  getLatestScriptVersionDir(scriptsDir: string): string | null;
42
43
  }
@@ -315,7 +315,7 @@ export class DevServer implements DevServerContext {
315
315
  }
316
316
  }
317
317
 
318
- private async handleRunScript(type: string, req: http.IncomingMessage, res: http.ServerResponse, parsedBody?: any): Promise<void> {
318
+ public async handleRunScript(type: string, req: http.IncomingMessage, res: http.ServerResponse, parsedBody?: any): Promise<void> {
319
319
  const body = parsedBody || await this.readBody(req);
320
320
  const { script: scriptName, params, ideType: scriptIdeType } = body;
321
321