@adhdev/daemon-core 0.7.16 → 0.7.18

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/dist/index.d.mts CHANGED
@@ -4,6 +4,7 @@ import * as child_process from 'child_process';
4
4
  import { ChildProcess } from 'child_process';
5
5
  import * as http from 'http';
6
6
  import { SessionHostEndpoint, SessionHostCategory } from '@adhdev/session-host-core';
7
+ export { SessionHostEndpoint } from '@adhdev/session-host-core';
7
8
 
8
9
  /**
9
10
  * DaemonCore — Core daemon orchestrator interface
@@ -2338,6 +2339,13 @@ declare class SessionHostPtyTransportFactory implements PtyTransportFactory {
2338
2339
  spawn(command: string, args: string[], spawnOptions: PtySpawnOptions): PtyRuntimeTransport;
2339
2340
  }
2340
2341
 
2342
+ declare function ensureSessionHostReady(options: {
2343
+ appName?: string;
2344
+ spawnHost: () => void;
2345
+ timeoutMs?: number;
2346
+ }): Promise<SessionHostEndpoint>;
2347
+ declare function listHostedCliRuntimes(endpoint: SessionHostEndpoint): Promise<HostedCliRuntimeDescriptor[]>;
2348
+
2341
2349
  /**
2342
2350
  * ADHDev Launcher — Extension Installer
2343
2351
  *
@@ -2470,4 +2478,4 @@ declare function startDaemonDevSupport(options: DaemonDevSupportOptions): Promis
2470
2478
  */
2471
2479
  declare function shutdownDaemonComponents(components: DaemonComponents): Promise<void>;
2472
2480
 
2473
- export { AcpProviderInstance, AcpProviderState, AgentStreamPoller, type AgentStreamPollerDeps, AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, CdpTargetFilter, type CliAdapter, CliProviderInstance, type CliTransportFactoryParams, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonDevSupportOptions, DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, DevServer, type HostMemorySnapshot, type HostedCliRuntimeDescriptor, type IDEInfo, type IDaemonCore, IdeProviderInstance, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, NodePtyTransportFactory, ProviderCliAdapter, ProviderInstanceManager, ProviderLoader, ProviderModule, ProviderResumeCapability, type ProviderVersionInfo, type PtyRuntimeTransport, type PtySpawnOptions, type PtyTransportFactory, type ScopedLogger, SessionEntry, SessionHostPtyTransportFactory, SessionTransport, type SetupIdeInstanceOptions, StatusReportPayload, StatusResponse, type StatusSnapshot, type StatusSnapshotOptions, VersionArchive, type VersionHistory, buildSessionEntries, buildStatusSnapshot, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, findCdpManager, forwardAgentStreamsToIdeInstance, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, killIdeProcess, launchIDE, launchWithCdp, logCommand, probeCdpPort, readChatHistory, registerExtensionProviders, setLogLevel, setupIdeInstance, shutdownDaemonComponents, startDaemonDevSupport };
2481
+ export { AcpProviderInstance, AcpProviderState, AgentStreamPoller, type AgentStreamPollerDeps, AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, CdpTargetFilter, type CliAdapter, CliProviderInstance, type CliTransportFactoryParams, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonDevSupportOptions, DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, DevServer, type HostMemorySnapshot, type HostedCliRuntimeDescriptor, type IDEInfo, type IDaemonCore, IdeProviderInstance, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, NodePtyTransportFactory, ProviderCliAdapter, ProviderInstanceManager, ProviderLoader, ProviderModule, ProviderResumeCapability, type ProviderVersionInfo, type PtyRuntimeTransport, type PtySpawnOptions, type PtyTransportFactory, type ScopedLogger, SessionEntry, SessionHostPtyTransportFactory, SessionTransport, type SetupIdeInstanceOptions, StatusReportPayload, StatusResponse, type StatusSnapshot, type StatusSnapshotOptions, VersionArchive, type VersionHistory, buildSessionEntries, buildStatusSnapshot, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, ensureSessionHostReady, findCdpManager, forwardAgentStreamsToIdeInstance, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, killIdeProcess, launchIDE, launchWithCdp, listHostedCliRuntimes, logCommand, probeCdpPort, readChatHistory, registerExtensionProviders, setLogLevel, setupIdeInstance, shutdownDaemonComponents, startDaemonDevSupport };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import * as child_process from 'child_process';
4
4
  import { ChildProcess } from 'child_process';
5
5
  import * as http from 'http';
6
6
  import { SessionHostEndpoint, SessionHostCategory } from '@adhdev/session-host-core';
7
+ export { SessionHostEndpoint } from '@adhdev/session-host-core';
7
8
 
8
9
  /**
9
10
  * DaemonCore — Core daemon orchestrator interface
@@ -2338,6 +2339,13 @@ declare class SessionHostPtyTransportFactory implements PtyTransportFactory {
2338
2339
  spawn(command: string, args: string[], spawnOptions: PtySpawnOptions): PtyRuntimeTransport;
2339
2340
  }
2340
2341
 
2342
+ declare function ensureSessionHostReady(options: {
2343
+ appName?: string;
2344
+ spawnHost: () => void;
2345
+ timeoutMs?: number;
2346
+ }): Promise<SessionHostEndpoint>;
2347
+ declare function listHostedCliRuntimes(endpoint: SessionHostEndpoint): Promise<HostedCliRuntimeDescriptor[]>;
2348
+
2341
2349
  /**
2342
2350
  * ADHDev Launcher — Extension Installer
2343
2351
  *
@@ -2470,4 +2478,4 @@ declare function startDaemonDevSupport(options: DaemonDevSupportOptions): Promis
2470
2478
  */
2471
2479
  declare function shutdownDaemonComponents(components: DaemonComponents): Promise<void>;
2472
2480
 
2473
- export { AcpProviderInstance, AcpProviderState, AgentStreamPoller, type AgentStreamPollerDeps, AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, CdpTargetFilter, type CliAdapter, CliProviderInstance, type CliTransportFactoryParams, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonDevSupportOptions, DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, DevServer, type HostMemorySnapshot, type HostedCliRuntimeDescriptor, type IDEInfo, type IDaemonCore, IdeProviderInstance, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, NodePtyTransportFactory, ProviderCliAdapter, ProviderInstanceManager, ProviderLoader, ProviderModule, ProviderResumeCapability, type ProviderVersionInfo, type PtyRuntimeTransport, type PtySpawnOptions, type PtyTransportFactory, type ScopedLogger, SessionEntry, SessionHostPtyTransportFactory, SessionTransport, type SetupIdeInstanceOptions, StatusReportPayload, StatusResponse, type StatusSnapshot, type StatusSnapshotOptions, VersionArchive, type VersionHistory, buildSessionEntries, buildStatusSnapshot, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, findCdpManager, forwardAgentStreamsToIdeInstance, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, killIdeProcess, launchIDE, launchWithCdp, logCommand, probeCdpPort, readChatHistory, registerExtensionProviders, setLogLevel, setupIdeInstance, shutdownDaemonComponents, startDaemonDevSupport };
2481
+ export { AcpProviderInstance, AcpProviderState, AgentStreamPoller, type AgentStreamPollerDeps, AvailableProviderInfo, CdpDomHandlers, type CdpInitializerConfig, type CdpScannerOptions, type CdpSetupContext, CdpTargetFilter, type CliAdapter, CliProviderInstance, type CliTransportFactoryParams, type CommandContext, type CommandResult$1 as CommandResult, type CommandRouterDeps, type CommandRouterResult, CommandResult$2 as CoreCommandResult, DAEMON_WS_PATH, DEFAULT_DAEMON_PORT, DaemonAgentStreamManager, DaemonCdpInitializer, DaemonCdpManager, DaemonCdpScanner, DaemonCliManager, DaemonCommandHandler, DaemonCommandRouter, type DaemonComponents, type DaemonCoreOptions, type DaemonDevSupportOptions, DaemonEvent, type DaemonInitConfig, DaemonStatusReporter, DevServer, type HostMemorySnapshot, type HostedCliRuntimeDescriptor, type IDEInfo, type IDaemonCore, IdeProviderInstance, type ExtensionInfo as InstallerExtensionInfo, LOG, type LogEntry, type LogLevel, NodePtyTransportFactory, ProviderCliAdapter, ProviderInstanceManager, ProviderLoader, ProviderModule, ProviderResumeCapability, type ProviderVersionInfo, type PtyRuntimeTransport, type PtySpawnOptions, type PtyTransportFactory, type ScopedLogger, SessionEntry, SessionHostPtyTransportFactory, SessionTransport, type SetupIdeInstanceOptions, StatusReportPayload, StatusResponse, type StatusSnapshot, type StatusSnapshotOptions, VersionArchive, type VersionHistory, buildSessionEntries, buildStatusSnapshot, connectCdpManager, detectAllVersions, detectCLIs, detectIDEs, ensureSessionHostReady, findCdpManager, forwardAgentStreamsToIdeInstance, getAIExtensions, getAvailableIdeIds, getHostMemorySnapshot, getLogLevel, getRecentCommands, getRecentLogs, hasCdpManager, initDaemonComponents, installExtensions, installGlobalInterceptor, isCdpConnected, isExtensionInstalled, isIdeRunning, killIdeProcess, launchIDE, launchWithCdp, listHostedCliRuntimes, logCommand, probeCdpPort, readChatHistory, registerExtensionProviders, setLogLevel, setupIdeInstance, shutdownDaemonComponents, startDaemonDevSupport };
package/dist/index.js CHANGED
@@ -2071,6 +2071,7 @@ __export(index_exports, {
2071
2071
  detectAllVersions: () => detectAllVersions,
2072
2072
  detectCLIs: () => detectCLIs,
2073
2073
  detectIDEs: () => detectIDEs,
2074
+ ensureSessionHostReady: () => ensureSessionHostReady,
2074
2075
  findCdpManager: () => findCdpManager,
2075
2076
  forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance,
2076
2077
  getAIExtensions: () => getAIExtensions,
@@ -2094,6 +2095,7 @@ __export(index_exports, {
2094
2095
  killIdeProcess: () => killIdeProcess,
2095
2096
  launchIDE: () => launchIDE,
2096
2097
  launchWithCdp: () => launchWithCdp,
2098
+ listHostedCliRuntimes: () => listHostedCliRuntimes,
2097
2099
  loadConfig: () => loadConfig,
2098
2100
  logCommand: () => logCommand,
2099
2101
  markSetupComplete: () => markSetupComplete,
@@ -15832,6 +15834,62 @@ var SessionHostPtyTransportFactory = class {
15832
15834
  }
15833
15835
  };
15834
15836
 
15837
+ // src/session-host/runtime-support.ts
15838
+ var import_session_host_core2 = require("@adhdev/session-host-core");
15839
+ var STARTUP_TIMEOUT_MS = 8e3;
15840
+ var STARTUP_POLL_MS = 200;
15841
+ async function canConnect(endpoint) {
15842
+ const client = new import_session_host_core2.SessionHostClient({ endpoint });
15843
+ try {
15844
+ await client.connect();
15845
+ await client.close();
15846
+ return true;
15847
+ } catch {
15848
+ return false;
15849
+ }
15850
+ }
15851
+ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS) {
15852
+ const deadline = Date.now() + timeoutMs;
15853
+ while (Date.now() < deadline) {
15854
+ if (await canConnect(endpoint)) return;
15855
+ await new Promise((resolve9) => setTimeout(resolve9, STARTUP_POLL_MS));
15856
+ }
15857
+ throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
15858
+ }
15859
+ async function ensureSessionHostReady(options) {
15860
+ const endpoint = (0, import_session_host_core2.getDefaultSessionHostEndpoint)(options.appName || "adhdev");
15861
+ if (await canConnect(endpoint)) return endpoint;
15862
+ options.spawnHost();
15863
+ await waitForReady(endpoint, options.timeoutMs);
15864
+ return endpoint;
15865
+ }
15866
+ async function listHostedCliRuntimes(endpoint) {
15867
+ const client = new import_session_host_core2.SessionHostClient({ endpoint });
15868
+ try {
15869
+ const response = await client.request({
15870
+ type: "list_sessions",
15871
+ payload: {}
15872
+ });
15873
+ if (!response.success || !response.result) {
15874
+ return [];
15875
+ }
15876
+ return response.result.filter((record) => record.category === "cli" && ["running", "interrupted"].includes(record.lifecycle)).sort((a, b) => b.lastActivityAt - a.lastActivityAt).map((record) => ({
15877
+ runtimeId: record.sessionId,
15878
+ runtimeKey: record.runtimeKey,
15879
+ displayName: record.displayName,
15880
+ workspaceLabel: record.workspaceLabel,
15881
+ lifecycle: record.lifecycle,
15882
+ recoveryState: typeof record.meta?.runtimeRecoveryState === "string" ? String(record.meta.runtimeRecoveryState) : null,
15883
+ cliType: record.providerType,
15884
+ workspace: record.workspace,
15885
+ cliArgs: Array.isArray(record.meta?.cliArgs) ? record.meta.cliArgs : []
15886
+ }));
15887
+ } finally {
15888
+ await client.close().catch(() => {
15889
+ });
15890
+ }
15891
+ }
15892
+
15835
15893
  // src/installer.ts
15836
15894
  var import_child_process8 = require("child_process");
15837
15895
  var EXTENSION_CATALOG = [
@@ -16288,6 +16346,7 @@ async function shutdownDaemonComponents(components) {
16288
16346
  detectAllVersions,
16289
16347
  detectCLIs,
16290
16348
  detectIDEs,
16349
+ ensureSessionHostReady,
16291
16350
  findCdpManager,
16292
16351
  forwardAgentStreamsToIdeInstance,
16293
16352
  getAIExtensions,
@@ -16311,6 +16370,7 @@ async function shutdownDaemonComponents(components) {
16311
16370
  killIdeProcess,
16312
16371
  launchIDE,
16313
16372
  launchWithCdp,
16373
+ listHostedCliRuntimes,
16314
16374
  loadConfig,
16315
16375
  logCommand,
16316
16376
  markSetupComplete,