@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 +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/session-host/runtime-support.ts +71 -0
package/dist/index.mjs
CHANGED
|
@@ -15762,6 +15762,65 @@ var SessionHostPtyTransportFactory = class {
|
|
|
15762
15762
|
}
|
|
15763
15763
|
};
|
|
15764
15764
|
|
|
15765
|
+
// src/session-host/runtime-support.ts
|
|
15766
|
+
import {
|
|
15767
|
+
SessionHostClient as SessionHostClient2,
|
|
15768
|
+
getDefaultSessionHostEndpoint
|
|
15769
|
+
} from "@adhdev/session-host-core";
|
|
15770
|
+
var STARTUP_TIMEOUT_MS = 8e3;
|
|
15771
|
+
var STARTUP_POLL_MS = 200;
|
|
15772
|
+
async function canConnect(endpoint) {
|
|
15773
|
+
const client = new SessionHostClient2({ endpoint });
|
|
15774
|
+
try {
|
|
15775
|
+
await client.connect();
|
|
15776
|
+
await client.close();
|
|
15777
|
+
return true;
|
|
15778
|
+
} catch {
|
|
15779
|
+
return false;
|
|
15780
|
+
}
|
|
15781
|
+
}
|
|
15782
|
+
async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS) {
|
|
15783
|
+
const deadline = Date.now() + timeoutMs;
|
|
15784
|
+
while (Date.now() < deadline) {
|
|
15785
|
+
if (await canConnect(endpoint)) return;
|
|
15786
|
+
await new Promise((resolve9) => setTimeout(resolve9, STARTUP_POLL_MS));
|
|
15787
|
+
}
|
|
15788
|
+
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
15789
|
+
}
|
|
15790
|
+
async function ensureSessionHostReady(options) {
|
|
15791
|
+
const endpoint = getDefaultSessionHostEndpoint(options.appName || "adhdev");
|
|
15792
|
+
if (await canConnect(endpoint)) return endpoint;
|
|
15793
|
+
options.spawnHost();
|
|
15794
|
+
await waitForReady(endpoint, options.timeoutMs);
|
|
15795
|
+
return endpoint;
|
|
15796
|
+
}
|
|
15797
|
+
async function listHostedCliRuntimes(endpoint) {
|
|
15798
|
+
const client = new SessionHostClient2({ endpoint });
|
|
15799
|
+
try {
|
|
15800
|
+
const response = await client.request({
|
|
15801
|
+
type: "list_sessions",
|
|
15802
|
+
payload: {}
|
|
15803
|
+
});
|
|
15804
|
+
if (!response.success || !response.result) {
|
|
15805
|
+
return [];
|
|
15806
|
+
}
|
|
15807
|
+
return response.result.filter((record) => record.category === "cli" && ["running", "interrupted"].includes(record.lifecycle)).sort((a, b) => b.lastActivityAt - a.lastActivityAt).map((record) => ({
|
|
15808
|
+
runtimeId: record.sessionId,
|
|
15809
|
+
runtimeKey: record.runtimeKey,
|
|
15810
|
+
displayName: record.displayName,
|
|
15811
|
+
workspaceLabel: record.workspaceLabel,
|
|
15812
|
+
lifecycle: record.lifecycle,
|
|
15813
|
+
recoveryState: typeof record.meta?.runtimeRecoveryState === "string" ? String(record.meta.runtimeRecoveryState) : null,
|
|
15814
|
+
cliType: record.providerType,
|
|
15815
|
+
workspace: record.workspace,
|
|
15816
|
+
cliArgs: Array.isArray(record.meta?.cliArgs) ? record.meta.cliArgs : []
|
|
15817
|
+
}));
|
|
15818
|
+
} finally {
|
|
15819
|
+
await client.close().catch(() => {
|
|
15820
|
+
});
|
|
15821
|
+
}
|
|
15822
|
+
}
|
|
15823
|
+
|
|
15765
15824
|
// src/installer.ts
|
|
15766
15825
|
import { execSync as execSync6, exec as exec2 } from "child_process";
|
|
15767
15826
|
var EXTENSION_CATALOG = [
|
|
@@ -16217,6 +16276,7 @@ export {
|
|
|
16217
16276
|
detectAllVersions,
|
|
16218
16277
|
detectCLIs,
|
|
16219
16278
|
detectIDEs,
|
|
16279
|
+
ensureSessionHostReady,
|
|
16220
16280
|
findCdpManager,
|
|
16221
16281
|
forwardAgentStreamsToIdeInstance,
|
|
16222
16282
|
getAIExtensions,
|
|
@@ -16240,6 +16300,7 @@ export {
|
|
|
16240
16300
|
killIdeProcess,
|
|
16241
16301
|
launchIDE,
|
|
16242
16302
|
launchWithCdp,
|
|
16303
|
+
listHostedCliRuntimes,
|
|
16243
16304
|
loadConfig,
|
|
16244
16305
|
logCommand,
|
|
16245
16306
|
markSetupComplete,
|