@adhdev/daemon-core 0.9.82-rc.450 → 0.9.82-rc.451
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.js +47 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -57
- package/dist/index.mjs.map +1 -1
- package/dist/session-host/runtime-surface.d.ts +10 -16
- package/dist/shared-types.d.ts +27 -53
- package/package.json +2 -2
- package/src/session-host/runtime-surface.ts +20 -80
- package/src/shared-types.ts +60 -54
package/dist/index.js
CHANGED
|
@@ -409,10 +409,10 @@ function readInjected(value) {
|
|
|
409
409
|
}
|
|
410
410
|
function getDaemonBuildInfo() {
|
|
411
411
|
if (cached) return cached;
|
|
412
|
-
const commit = readInjected(true ? "
|
|
413
|
-
const commitShort = readInjected(true ? "
|
|
414
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
415
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
412
|
+
const commit = readInjected(true ? "9356f971ab5b65586b8e481022be6d34c17305e8" : void 0) ?? "unknown";
|
|
413
|
+
const commitShort = readInjected(true ? "9356f971" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
414
|
+
const version = readInjected(true ? "0.9.82-rc.451" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
415
|
+
const builtAt = readInjected(true ? "2026-07-03T16:43:36.013Z" : void 0);
|
|
416
416
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
417
417
|
return cached;
|
|
418
418
|
}
|
|
@@ -21714,8 +21714,8 @@ function resolveCliSpawnPlanFromParts(options) {
|
|
|
21714
21714
|
isWin,
|
|
21715
21715
|
useShell,
|
|
21716
21716
|
ptyOptions: {
|
|
21717
|
-
cols: geometry?.cols ??
|
|
21718
|
-
rows: geometry?.rows ??
|
|
21717
|
+
cols: geometry?.cols ?? import_session_host_core5.DEFAULT_SESSION_HOST_COLS,
|
|
21718
|
+
rows: geometry?.rows ?? import_session_host_core5.DEFAULT_SESSION_HOST_ROWS,
|
|
21719
21719
|
cwd: workingDir,
|
|
21720
21720
|
env
|
|
21721
21721
|
}
|
|
@@ -21766,13 +21766,13 @@ function respondToCliTerminalQueries(options) {
|
|
|
21766
21766
|
}
|
|
21767
21767
|
return "";
|
|
21768
21768
|
}
|
|
21769
|
-
var os15, path21,
|
|
21769
|
+
var os15, path21, import_session_host_core5;
|
|
21770
21770
|
var init_provider_cli_runtime = __esm({
|
|
21771
21771
|
"src/cli-adapters/provider-cli-runtime.ts"() {
|
|
21772
21772
|
"use strict";
|
|
21773
21773
|
os15 = __toESM(require("os"));
|
|
21774
21774
|
path21 = __toESM(require("path"));
|
|
21775
|
-
|
|
21775
|
+
import_session_host_core5 = require("@adhdev/session-host-core");
|
|
21776
21776
|
init_provider_cli_shared();
|
|
21777
21777
|
}
|
|
21778
21778
|
});
|
|
@@ -21792,7 +21792,7 @@ function appendBoundedText(current, chunk, maxChars) {
|
|
|
21792
21792
|
if (current.length <= keepFromCurrent) return current + chunk;
|
|
21793
21793
|
return current.slice(-keepFromCurrent) + chunk;
|
|
21794
21794
|
}
|
|
21795
|
-
var os16,
|
|
21795
|
+
var os16, import_session_host_core6, FORCE_SUBMIT_SETTLE_MS, ProviderCliAdapter;
|
|
21796
21796
|
var init_provider_cli_adapter = __esm({
|
|
21797
21797
|
"src/cli-adapters/provider-cli-adapter.ts"() {
|
|
21798
21798
|
"use strict";
|
|
@@ -21800,7 +21800,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
21800
21800
|
init_logger();
|
|
21801
21801
|
init_debug_config();
|
|
21802
21802
|
init_terminal_screen();
|
|
21803
|
-
|
|
21803
|
+
import_session_host_core6 = require("@adhdev/session-host-core");
|
|
21804
21804
|
init_pty_transport();
|
|
21805
21805
|
init_pty_write_chunking();
|
|
21806
21806
|
init_provider_cli_shared();
|
|
@@ -21964,7 +21964,7 @@ var init_provider_cli_adapter = __esm({
|
|
|
21964
21964
|
/** Full accumulated raw PTY output (with ANSI) */
|
|
21965
21965
|
accumulatedRawBuffer = "";
|
|
21966
21966
|
/** Current visible terminal screen snapshot */
|
|
21967
|
-
terminalScreen = new TerminalScreen(
|
|
21967
|
+
terminalScreen = new TerminalScreen(import_session_host_core6.DEFAULT_SESSION_HOST_ROWS, import_session_host_core6.DEFAULT_SESSION_HOST_COLS);
|
|
21968
21968
|
static MAX_RESPONSE_BUFFER = 8e3;
|
|
21969
21969
|
static MAX_RECENT_OUTPUT_BUFFER = 1e3;
|
|
21970
21970
|
responseBufferDroppedChars = 0;
|
|
@@ -22177,7 +22177,7 @@ ${lastSnapshot}`;
|
|
|
22177
22177
|
clearTimeout(this.startupSettleTimer);
|
|
22178
22178
|
this.startupSettleTimer = null;
|
|
22179
22179
|
}
|
|
22180
|
-
this.resetTerminalScreen(
|
|
22180
|
+
this.resetTerminalScreen(import_session_host_core6.DEFAULT_SESSION_HOST_ROWS, import_session_host_core6.DEFAULT_SESSION_HOST_COLS);
|
|
22181
22181
|
this.pendingTerminalQueryTail = "";
|
|
22182
22182
|
this.ready = false;
|
|
22183
22183
|
this.firstTurnSent = false;
|
|
@@ -24101,8 +24101,8 @@ __export(index_exports, {
|
|
|
24101
24101
|
getRecentDebugTrace: () => getRecentDebugTrace,
|
|
24102
24102
|
getRecentLogs: () => getRecentLogs,
|
|
24103
24103
|
getSavedProviderSessions: () => getSavedProviderSessions,
|
|
24104
|
-
getSessionHostRecoveryLabel: () => getSessionHostRecoveryLabel,
|
|
24105
|
-
getSessionHostSurfaceKind: () => getSessionHostSurfaceKind,
|
|
24104
|
+
getSessionHostRecoveryLabel: () => import_session_host_core4.getSessionHostRecoveryLabel,
|
|
24105
|
+
getSessionHostSurfaceKind: () => import_session_host_core4.getSessionHostSurfaceKind,
|
|
24106
24106
|
getSessionRecoveryContext: () => getSessionRecoveryContext,
|
|
24107
24107
|
getWorkspaceState: () => getWorkspaceState,
|
|
24108
24108
|
globToRegExp: () => globToRegExp,
|
|
@@ -24128,8 +24128,8 @@ __export(index_exports, {
|
|
|
24128
24128
|
isOperatingNoteTombstoned: () => isOperatingNoteTombstoned,
|
|
24129
24129
|
isP2pRelayTransportFailure: () => isP2pRelayTransportFailure,
|
|
24130
24130
|
isPathInside: () => isPathInside,
|
|
24131
|
-
isSessionHostLiveRuntime: () => isSessionHostLiveRuntime,
|
|
24132
|
-
isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot,
|
|
24131
|
+
isSessionHostLiveRuntime: () => import_session_host_core4.isSessionHostLiveRuntime,
|
|
24132
|
+
isSessionHostRecoverySnapshot: () => import_session_host_core4.isSessionHostRecoverySnapshot,
|
|
24133
24133
|
isSetupComplete: () => isSetupComplete,
|
|
24134
24134
|
isTaskReadonly: () => isTaskReadonly,
|
|
24135
24135
|
isUserFacingChatMessage: () => isUserFacingChatMessage,
|
|
@@ -24189,8 +24189,8 @@ __export(index_exports, {
|
|
|
24189
24189
|
parsePorcelainV2Status: () => parsePorcelainV2Status,
|
|
24190
24190
|
parseProviderSourceConfigUpdate: () => parseProviderSourceConfigUpdate,
|
|
24191
24191
|
parseWorktreeListOutput: () => parseWorktreeListOutput,
|
|
24192
|
-
partitionSessionHostDiagnosticsSessions: () => partitionSessionHostDiagnosticsSessions,
|
|
24193
|
-
partitionSessionHostRecords: () => partitionSessionHostRecords,
|
|
24192
|
+
partitionSessionHostDiagnosticsSessions: () => import_session_host_core4.partitionSessionHostDiagnosticsSessions,
|
|
24193
|
+
partitionSessionHostRecords: () => import_session_host_core4.partitionSessionHostRecords,
|
|
24194
24194
|
prepareSessionChatTailUpdate: () => prepareSessionChatTailUpdate,
|
|
24195
24195
|
prepareSessionModalUpdate: () => prepareSessionModalUpdate,
|
|
24196
24196
|
probeCdpPort: () => probeCdpPort,
|
|
@@ -25930,59 +25930,7 @@ init_cli_detector();
|
|
|
25930
25930
|
init_host_memory();
|
|
25931
25931
|
|
|
25932
25932
|
// src/session-host/runtime-surface.ts
|
|
25933
|
-
var
|
|
25934
|
-
function isSessionHostLiveRuntime(record) {
|
|
25935
|
-
const lifecycle = String(record?.lifecycle || "").trim();
|
|
25936
|
-
return LIVE_LIFECYCLES.has(lifecycle);
|
|
25937
|
-
}
|
|
25938
|
-
function getSessionHostRecoveryLabel(meta) {
|
|
25939
|
-
const recoveryState = typeof meta?.runtimeRecoveryState === "string" ? String(meta.runtimeRecoveryState).trim() : "";
|
|
25940
|
-
if (!recoveryState) return null;
|
|
25941
|
-
if (recoveryState === "auto_resumed") return "restored after restart";
|
|
25942
|
-
if (recoveryState === "resume_failed") return "restore failed";
|
|
25943
|
-
if (recoveryState === "host_restart_interrupted") return "host restart interrupted";
|
|
25944
|
-
if (recoveryState === "orphan_snapshot") return "snapshot recovered";
|
|
25945
|
-
return recoveryState.replace(/_/g, " ");
|
|
25946
|
-
}
|
|
25947
|
-
function isSessionHostRecoverySnapshot(record) {
|
|
25948
|
-
if (!record) return false;
|
|
25949
|
-
if (isSessionHostLiveRuntime(record)) return false;
|
|
25950
|
-
const lifecycle = String(record.lifecycle || "").trim();
|
|
25951
|
-
if (lifecycle && lifecycle !== "stopped" && lifecycle !== "failed") {
|
|
25952
|
-
return false;
|
|
25953
|
-
}
|
|
25954
|
-
const meta = record.meta || void 0;
|
|
25955
|
-
if (meta?.restoredFromStorage === true) return true;
|
|
25956
|
-
return getSessionHostRecoveryLabel(meta) !== null;
|
|
25957
|
-
}
|
|
25958
|
-
function getSessionHostSurfaceKind(record) {
|
|
25959
|
-
if (isSessionHostLiveRuntime(record)) return "live_runtime";
|
|
25960
|
-
if (isSessionHostRecoverySnapshot(record)) return "recovery_snapshot";
|
|
25961
|
-
return "inactive_record";
|
|
25962
|
-
}
|
|
25963
|
-
function partitionSessionHostRecords(records) {
|
|
25964
|
-
const liveRuntimes = [];
|
|
25965
|
-
const recoverySnapshots = [];
|
|
25966
|
-
const inactiveRecords = [];
|
|
25967
|
-
for (const record of records) {
|
|
25968
|
-
const kind = getSessionHostSurfaceKind(record);
|
|
25969
|
-
if (kind === "live_runtime") {
|
|
25970
|
-
liveRuntimes.push(record);
|
|
25971
|
-
} else if (kind === "recovery_snapshot") {
|
|
25972
|
-
recoverySnapshots.push(record);
|
|
25973
|
-
} else {
|
|
25974
|
-
inactiveRecords.push(record);
|
|
25975
|
-
}
|
|
25976
|
-
}
|
|
25977
|
-
return {
|
|
25978
|
-
liveRuntimes,
|
|
25979
|
-
recoverySnapshots,
|
|
25980
|
-
inactiveRecords
|
|
25981
|
-
};
|
|
25982
|
-
}
|
|
25983
|
-
function partitionSessionHostDiagnosticsSessions(records) {
|
|
25984
|
-
return partitionSessionHostRecords(records || []);
|
|
25985
|
-
}
|
|
25933
|
+
var import_session_host_core4 = require("@adhdev/session-host-core");
|
|
25986
25934
|
|
|
25987
25935
|
// src/status/chat-tail-hot-sessions.ts
|
|
25988
25936
|
var DEFAULT_ACTIVE_CHAT_POLL_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -26007,7 +25955,7 @@ function isDefinitelyNonLiveRuntimeSession(session) {
|
|
|
26007
25955
|
if (surfaceKind === "inactive_record") return false;
|
|
26008
25956
|
const lifecycle = String(session?.runtimeLifecycle || "").trim();
|
|
26009
25957
|
if (lifecycle && LIVE_RUNTIME_LIFECYCLES.has(lifecycle)) return false;
|
|
26010
|
-
const inferredSurfaceKind = getSessionHostSurfaceKind({
|
|
25958
|
+
const inferredSurfaceKind = (0, import_session_host_core4.getSessionHostSurfaceKind)({
|
|
26011
25959
|
lifecycle: lifecycle || null,
|
|
26012
25960
|
meta: {
|
|
26013
25961
|
restoredFromStorage: session?.runtimeRestoredFromStorage === true,
|
|
@@ -36183,7 +36131,7 @@ function summarizeSessionHostRecord(result) {
|
|
|
36183
36131
|
return {
|
|
36184
36132
|
runtimeKey: typeof record.runtimeKey === "string" ? record.runtimeKey : void 0,
|
|
36185
36133
|
lifecycle: typeof record.lifecycle === "string" ? record.lifecycle : void 0,
|
|
36186
|
-
surfaceKind: getSessionHostSurfaceKind(record),
|
|
36134
|
+
surfaceKind: (0, import_session_host_core4.getSessionHostSurfaceKind)(record),
|
|
36187
36135
|
attachedClientCount: Array.isArray(record.attachedClients) ? record.attachedClients.length : void 0,
|
|
36188
36136
|
hasWriteOwner: !!record.writeOwner,
|
|
36189
36137
|
writeOwnerClientId: typeof record.writeOwner?.clientId === "string" ? record.writeOwner.clientId : void 0
|
|
@@ -36191,7 +36139,7 @@ function summarizeSessionHostRecord(result) {
|
|
|
36191
36139
|
}
|
|
36192
36140
|
function summarizeSessionHostRecords(result) {
|
|
36193
36141
|
const records = Array.isArray(result) ? result : [];
|
|
36194
|
-
const groups = partitionSessionHostRecords(records);
|
|
36142
|
+
const groups = (0, import_session_host_core4.partitionSessionHostRecords)(records);
|
|
36195
36143
|
return {
|
|
36196
36144
|
sessionCount: records.length,
|
|
36197
36145
|
liveRuntimeCount: groups.liveRuntimes.length,
|
|
@@ -37926,7 +37874,7 @@ var path23 = __toESM(require("path"));
|
|
|
37926
37874
|
|
|
37927
37875
|
// src/providers/spec/adapter.ts
|
|
37928
37876
|
init_terminal_screen();
|
|
37929
|
-
var
|
|
37877
|
+
var import_session_host_core7 = require("@adhdev/session-host-core");
|
|
37930
37878
|
var MAX_PTY_EVENTS = 300;
|
|
37931
37879
|
var EVENT_CONTENT_CAP = 240;
|
|
37932
37880
|
function escapeControl(text) {
|
|
@@ -37946,8 +37894,8 @@ var TerminalAdapter = class {
|
|
|
37946
37894
|
constructor(opts, handlers) {
|
|
37947
37895
|
this.opts = opts;
|
|
37948
37896
|
this.handlers = handlers;
|
|
37949
|
-
this.cols = opts.cols ??
|
|
37950
|
-
this.rows = opts.rows ??
|
|
37897
|
+
this.cols = opts.cols ?? import_session_host_core7.DEFAULT_SESSION_HOST_COLS;
|
|
37898
|
+
this.rows = opts.rows ?? import_session_host_core7.DEFAULT_SESSION_HOST_ROWS;
|
|
37951
37899
|
this.screenDebounceMs = opts.screenChangeDebounceMs ?? 80;
|
|
37952
37900
|
this.tickIntervalMs = opts.tickIntervalMs ?? 0;
|
|
37953
37901
|
if (opts.transportFactory) {
|
|
@@ -38092,7 +38040,7 @@ var TerminalAdapter = class {
|
|
|
38092
38040
|
|
|
38093
38041
|
// src/providers/spec/fsm-driver.ts
|
|
38094
38042
|
init_provider_cli_runtime();
|
|
38095
|
-
var
|
|
38043
|
+
var import_session_host_core8 = require("@adhdev/session-host-core");
|
|
38096
38044
|
init_evaluator();
|
|
38097
38045
|
init_fsm_evaluator();
|
|
38098
38046
|
init_fsm_types();
|
|
@@ -38467,8 +38415,8 @@ var FsmDriver = class {
|
|
|
38467
38415
|
this.spec = res.spec;
|
|
38468
38416
|
}
|
|
38469
38417
|
buildAdapterOpts() {
|
|
38470
|
-
const cols = this.opts.cols ??
|
|
38471
|
-
const rows = this.opts.rows ??
|
|
38418
|
+
const cols = this.opts.cols ?? import_session_host_core8.DEFAULT_SESSION_HOST_COLS;
|
|
38419
|
+
const rows = this.opts.rows ?? import_session_host_core8.DEFAULT_SESSION_HOST_ROWS;
|
|
38472
38420
|
const plan = resolveCliSpawnPlanFromParts({
|
|
38473
38421
|
command: this.spec.binary,
|
|
38474
38422
|
baseArgs: this.spec.spawn_args ?? [],
|
|
@@ -51955,7 +51903,7 @@ var meshCoordinatorLaunchHandlers = {
|
|
|
51955
51903
|
};
|
|
51956
51904
|
}
|
|
51957
51905
|
const sessionHostRecords = ctx.deps.sessionHostControl?.listSessions ? await ctx.deps.sessionHostControl.listSessions().catch(() => []) : [];
|
|
51958
|
-
const liveMeshSessions = partitionSessionHostRecords(Array.isArray(sessionHostRecords) ? sessionHostRecords : []).liveRuntimes;
|
|
51906
|
+
const liveMeshSessions = (0, import_session_host_core4.partitionSessionHostRecords)(Array.isArray(sessionHostRecords) ? sessionHostRecords : []).liveRuntimes;
|
|
51959
51907
|
const workspace = readLiveMeshNodeWorkspace({
|
|
51960
51908
|
meshId,
|
|
51961
51909
|
nodeId: String(normalizeMeshNodeId(coordinatorNode) || preferredCoordinatorNodeId || ""),
|
|
@@ -52537,7 +52485,7 @@ var meshStatusHandlers = {
|
|
|
52537
52485
|
const asyncRefineLedgerEntries = readLedgerEntries2(meshId, { tail: 100 });
|
|
52538
52486
|
const ledgerSummary = getLedgerSummary2(meshId);
|
|
52539
52487
|
const sessionHostRecords = ctx.deps.sessionHostControl?.listSessions ? await ctx.deps.sessionHostControl.listSessions().catch(() => []) : [];
|
|
52540
|
-
const liveMeshSessions = partitionSessionHostRecords(Array.isArray(sessionHostRecords) ? sessionHostRecords : []).liveRuntimes;
|
|
52488
|
+
const liveMeshSessions = (0, import_session_host_core4.partitionSessionHostRecords)(Array.isArray(sessionHostRecords) ? sessionHostRecords : []).liveRuntimes;
|
|
52541
52489
|
const localMachineId = loadConfig().machineId || "";
|
|
52542
52490
|
const localMachineNickname = (() => {
|
|
52543
52491
|
const nick = loadConfig().machineNickname;
|
|
@@ -54411,7 +54359,7 @@ function summarizeMeshSessionRecord(record) {
|
|
|
54411
54359
|
state,
|
|
54412
54360
|
chatStatus,
|
|
54413
54361
|
lifecycle: readStringValue(record?.lifecycle),
|
|
54414
|
-
surfaceKind: getSessionHostSurfaceKind(record),
|
|
54362
|
+
surfaceKind: (0, import_session_host_core4.getSessionHostSurfaceKind)(record),
|
|
54415
54363
|
recoveryState: readStringValue(meta.runtimeRecoveryState) ?? null,
|
|
54416
54364
|
workspace: readStringValue(record?.workspace) ?? null,
|
|
54417
54365
|
title: readStringValue(record?.displayName, record?.workspaceLabel) ?? null,
|
|
@@ -56752,13 +56700,13 @@ var DaemonCommandRouter = class {
|
|
|
56752
56700
|
inactive_record: 0
|
|
56753
56701
|
};
|
|
56754
56702
|
for (const record of matched) {
|
|
56755
|
-
const surfaceKind = getSessionHostSurfaceKind(record);
|
|
56703
|
+
const surfaceKind = (0, import_session_host_core4.getSessionHostSurfaceKind)(record);
|
|
56756
56704
|
matchedBySurfaceKind[surfaceKind] += 1;
|
|
56757
56705
|
}
|
|
56758
56706
|
for (const record of matched) {
|
|
56759
56707
|
const sessionId = String(record.sessionId);
|
|
56760
56708
|
const completed = this.isCompletedHostedSession(record);
|
|
56761
|
-
const surfaceKind = getSessionHostSurfaceKind(record);
|
|
56709
|
+
const surfaceKind = (0, import_session_host_core4.getSessionHostSurfaceKind)(record);
|
|
56762
56710
|
const liveRuntime = surfaceKind === "live_runtime";
|
|
56763
56711
|
const coordinatorSession = readStringValue(record?.meta?.meshCoordinatorFor) === args.meshId;
|
|
56764
56712
|
const recordNodeId = readStringValue(record?.meta?.meshNodeId);
|
|
@@ -62677,7 +62625,7 @@ async function handleCliRaw(ctx, req, res) {
|
|
|
62677
62625
|
var fs36 = __toESM(require("fs"));
|
|
62678
62626
|
var path41 = __toESM(require("path"));
|
|
62679
62627
|
var os29 = __toESM(require("os"));
|
|
62680
|
-
var
|
|
62628
|
+
var import_session_host_core9 = require("@adhdev/session-host-core");
|
|
62681
62629
|
function getAutoImplPid(ctx) {
|
|
62682
62630
|
const pid = ctx.autoImplProcess?.pid;
|
|
62683
62631
|
return typeof pid === "number" && pid > 0 ? pid : null;
|
|
@@ -63075,8 +63023,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
63075
63023
|
const isWin2 = os29.platform() === "win32";
|
|
63076
63024
|
child = pty.spawn(isWin2 ? "cmd.exe" : process.env.SHELL || "/bin/zsh", [isWin2 ? "/c" : "-c", shellCmd], {
|
|
63077
63025
|
name: "xterm-256color",
|
|
63078
|
-
cols:
|
|
63079
|
-
rows:
|
|
63026
|
+
cols: import_session_host_core9.DEFAULT_SESSION_HOST_COLS,
|
|
63027
|
+
rows: import_session_host_core9.DEFAULT_SESSION_HOST_ROWS,
|
|
63080
63028
|
cwd: providerDir,
|
|
63081
63029
|
env: { ...process.env, ...spawn5.env || {} }
|
|
63082
63030
|
});
|
|
@@ -65056,7 +65004,7 @@ init_provider_cli_adapter();
|
|
|
65056
65004
|
init_pty_transport();
|
|
65057
65005
|
|
|
65058
65006
|
// src/cli-adapters/session-host-transport.ts
|
|
65059
|
-
var
|
|
65007
|
+
var import_session_host_core10 = require("@adhdev/session-host-core");
|
|
65060
65008
|
init_logger();
|
|
65061
65009
|
init_resolve_executable();
|
|
65062
65010
|
function shouldResumeAttachedSession(record) {
|
|
@@ -65069,7 +65017,7 @@ function shouldResumeAttachedSession(record) {
|
|
|
65069
65017
|
var SessionHostRuntimeTransport = class {
|
|
65070
65018
|
constructor(options) {
|
|
65071
65019
|
this.options = options;
|
|
65072
|
-
this.client = new
|
|
65020
|
+
this.client = new import_session_host_core10.SessionHostClient({
|
|
65073
65021
|
endpoint: options.endpoint,
|
|
65074
65022
|
appName: options.appName
|
|
65075
65023
|
});
|
|
@@ -65447,7 +65395,7 @@ var SessionHostPtyTransportFactory = class {
|
|
|
65447
65395
|
|
|
65448
65396
|
// src/cli-adapters/raw-terminal-io.ts
|
|
65449
65397
|
var import_crypto10 = require("crypto");
|
|
65450
|
-
var
|
|
65398
|
+
var import_session_host_core11 = require("@adhdev/session-host-core");
|
|
65451
65399
|
var BASE_KEY_SEQUENCES = {
|
|
65452
65400
|
enter: "\r",
|
|
65453
65401
|
escape: "\x1B",
|
|
@@ -65545,7 +65493,7 @@ var RawTerminalAttachment = class _RawTerminalAttachment {
|
|
|
65545
65493
|
if (!sessionId) throw new Error("sessionId is required");
|
|
65546
65494
|
const mode = options.mode || "read";
|
|
65547
65495
|
const clientId = options.clientId || `raw-terminal-${process.pid}-${(0, import_crypto10.randomUUID)().slice(0, 8)}`;
|
|
65548
|
-
const client = options.client || new
|
|
65496
|
+
const client = options.client || new import_session_host_core11.SessionHostClient({ endpoint: options.endpoint });
|
|
65549
65497
|
await client.connect();
|
|
65550
65498
|
const attachResponse = await client.request({
|
|
65551
65499
|
type: "attach_session",
|
|
@@ -65672,7 +65620,7 @@ function resolveSessionHostAppName(options = {}) {
|
|
|
65672
65620
|
}
|
|
65673
65621
|
|
|
65674
65622
|
// src/session-host/runtime-support.ts
|
|
65675
|
-
var
|
|
65623
|
+
var import_session_host_core12 = require("@adhdev/session-host-core");
|
|
65676
65624
|
init_runtime_defaults();
|
|
65677
65625
|
var STARTUP_TIMEOUT_MS = DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
|
|
65678
65626
|
var STARTUP_POLL_MS = 200;
|
|
@@ -65701,7 +65649,7 @@ async function assertRequiredRequestTypes(client, requiredRequestTypes) {
|
|
|
65701
65649
|
}
|
|
65702
65650
|
}
|
|
65703
65651
|
async function canConnect(endpoint, requiredRequestTypes = []) {
|
|
65704
|
-
const client = new
|
|
65652
|
+
const client = new import_session_host_core12.SessionHostClient({ endpoint });
|
|
65705
65653
|
try {
|
|
65706
65654
|
await client.connect();
|
|
65707
65655
|
await assertRequiredRequestTypes(client, requiredRequestTypes);
|
|
@@ -65723,7 +65671,7 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS, requiredRe
|
|
|
65723
65671
|
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
65724
65672
|
}
|
|
65725
65673
|
async function ensureSessionHostReady(options) {
|
|
65726
|
-
const endpoint = (0,
|
|
65674
|
+
const endpoint = (0, import_session_host_core12.getDefaultSessionHostEndpoint)(options.appName || "adhdev");
|
|
65727
65675
|
const requiredRequestTypes = options.requiredRequestTypes || [];
|
|
65728
65676
|
if (await canConnect(endpoint, requiredRequestTypes)) return endpoint;
|
|
65729
65677
|
options.spawnHost();
|
|
@@ -65731,7 +65679,7 @@ async function ensureSessionHostReady(options) {
|
|
|
65731
65679
|
return endpoint;
|
|
65732
65680
|
}
|
|
65733
65681
|
async function listHostedCliRuntimes(endpoint) {
|
|
65734
|
-
const client = new
|
|
65682
|
+
const client = new import_session_host_core12.SessionHostClient({ endpoint });
|
|
65735
65683
|
try {
|
|
65736
65684
|
const response = await client.request({
|
|
65737
65685
|
type: "list_sessions",
|
|
@@ -65764,15 +65712,15 @@ var import_child_process11 = require("child_process");
|
|
|
65764
65712
|
var fs38 = __toESM(require("fs"));
|
|
65765
65713
|
var os30 = __toESM(require("os"));
|
|
65766
65714
|
var path43 = __toESM(require("path"));
|
|
65767
|
-
var
|
|
65715
|
+
var import_session_host_core13 = require("@adhdev/session-host-core");
|
|
65768
65716
|
init_runtime_defaults();
|
|
65769
65717
|
function createManagedSessionHost(options) {
|
|
65770
65718
|
const appName = options.appName;
|
|
65771
65719
|
const timeoutMs = options.timeoutMs ?? DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
|
|
65772
|
-
const endpoint = (0,
|
|
65720
|
+
const endpoint = (0, import_session_host_core13.getDefaultSessionHostEndpoint)(appName);
|
|
65773
65721
|
const isManagedPid = options.isManagedPid ?? (() => true);
|
|
65774
65722
|
function buildEnv(baseEnv) {
|
|
65775
|
-
const env = (0,
|
|
65723
|
+
const env = (0, import_session_host_core13.sanitizeSpawnEnv)(baseEnv);
|
|
65776
65724
|
env.ADHDEV_SESSION_HOST_NAME = appName;
|
|
65777
65725
|
return env;
|
|
65778
65726
|
}
|