@adhdev/daemon-standalone 0.8.49 → 0.8.51

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 CHANGED
@@ -30803,6 +30803,8 @@ ${data.message || ""}`.trim();
30803
30803
  CliProviderInstance: () => CliProviderInstance,
30804
30804
  DAEMON_WS_PATH: () => DAEMON_WS_PATH,
30805
30805
  DEFAULT_DAEMON_PORT: () => DEFAULT_DAEMON_PORT,
30806
+ DEFAULT_SESSION_HOST_APP_NAME: () => DEFAULT_SESSION_HOST_APP_NAME,
30807
+ DEFAULT_STANDALONE_SESSION_HOST_APP_NAME: () => DEFAULT_STANDALONE_SESSION_HOST_APP_NAME,
30806
30808
  DaemonAgentStreamManager: () => DaemonAgentStreamManager,
30807
30809
  DaemonCdpInitializer: () => DaemonCdpInitializer,
30808
30810
  DaemonCdpManager: () => DaemonCdpManager,
@@ -30824,7 +30826,11 @@ ${data.message || ""}`.trim();
30824
30826
  buildMachineInfo: () => buildMachineInfo2,
30825
30827
  buildSessionEntries: () => buildSessionEntries,
30826
30828
  buildStatusSnapshot: () => buildStatusSnapshot2,
30829
+ clearDebugTrace: () => clearDebugTrace,
30830
+ configureDebugTraceStore: () => configureDebugTraceStore,
30827
30831
  connectCdpManager: () => connectCdpManager,
30832
+ createDebugTraceStore: () => createDebugTraceStore,
30833
+ createInteractionId: () => createInteractionId,
30828
30834
  detectAllVersions: () => detectAllVersions,
30829
30835
  detectCLIs: () => detectCLIs,
30830
30836
  detectIDEs: () => detectIDEs,
@@ -30835,10 +30841,12 @@ ${data.message || ""}`.trim();
30835
30841
  getAvailableIdeIds: () => getAvailableIdeIds,
30836
30842
  getCurrentDaemonLogPath: () => getCurrentDaemonLogPath,
30837
30843
  getDaemonLogDir: () => getDaemonLogDir,
30844
+ getDebugRuntimeConfig: () => getDebugRuntimeConfig,
30838
30845
  getHostMemorySnapshot: () => getHostMemorySnapshot,
30839
30846
  getLogLevel: () => getLogLevel,
30840
30847
  getRecentActivity: () => getRecentActivity,
30841
30848
  getRecentCommands: () => getRecentCommands,
30849
+ getRecentDebugTrace: () => getRecentDebugTrace,
30842
30850
  getRecentLogs: () => getRecentLogs,
30843
30851
  getSavedProviderSessions: () => getSavedProviderSessions,
30844
30852
  getWorkspaceState: () => getWorkspaceState2,
@@ -30865,13 +30873,19 @@ ${data.message || ""}`.trim();
30865
30873
  normalizeManagedStatus: () => normalizeManagedStatus,
30866
30874
  probeCdpPort: () => probeCdpPort,
30867
30875
  readChatHistory: () => readChatHistory,
30876
+ recordDebugTrace: () => recordDebugTrace,
30868
30877
  registerExtensionProviders: () => registerExtensionProviders,
30869
30878
  resetConfig: () => resetConfig,
30879
+ resetDebugRuntimeConfig: () => resetDebugRuntimeConfig,
30870
30880
  resetState: () => resetState,
30881
+ resolveDebugRuntimeConfig: () => resolveDebugRuntimeConfig,
30882
+ resolveSessionHostAppName: () => resolveSessionHostAppName2,
30871
30883
  saveConfig: () => saveConfig,
30872
30884
  saveState: () => saveState,
30885
+ setDebugRuntimeConfig: () => setDebugRuntimeConfig,
30873
30886
  setLogLevel: () => setLogLevel,
30874
30887
  setupIdeInstance: () => setupIdeInstance,
30888
+ shouldCollectTraceCategory: () => shouldCollectTraceCategory,
30875
30889
  shutdownDaemonComponents: () => shutdownDaemonComponents2,
30876
30890
  spawnDetachedDaemonUpgradeHelper: () => spawnDetachedDaemonUpgradeHelper,
30877
30891
  startDaemonDevSupport: () => startDaemonDevSupport2,
@@ -35227,6 +35241,128 @@ ${effect.notification.body || ""}`.trim();
35227
35241
  return content.filter((b2) => b2.type === "text").map((b2) => b2.text).join("\n");
35228
35242
  }
35229
35243
  init_logger();
35244
+ var NORMAL_TRACE_BUFFER_SIZE = 200;
35245
+ var DEV_TRACE_BUFFER_SIZE = 1e3;
35246
+ var DEFAULT_CONFIG2 = {
35247
+ logLevel: "info",
35248
+ collectDebugTrace: false,
35249
+ traceContent: false,
35250
+ traceBufferSize: NORMAL_TRACE_BUFFER_SIZE,
35251
+ traceCategories: []
35252
+ };
35253
+ var currentConfig = { ...DEFAULT_CONFIG2 };
35254
+ function normalizeCategories(categories) {
35255
+ if (!Array.isArray(categories)) return [];
35256
+ return categories.map((category) => String(category || "").trim()).filter(Boolean);
35257
+ }
35258
+ function resolveDebugRuntimeConfig(options = {}) {
35259
+ const dev = options.dev === true;
35260
+ return {
35261
+ logLevel: options.logLevel || (dev ? "debug" : DEFAULT_CONFIG2.logLevel),
35262
+ collectDebugTrace: typeof options.trace === "boolean" ? options.trace : dev,
35263
+ traceContent: options.traceContent === true,
35264
+ traceBufferSize: Number.isFinite(options.traceBufferSize) ? Math.max(10, Math.floor(options.traceBufferSize)) : dev ? DEV_TRACE_BUFFER_SIZE : DEFAULT_CONFIG2.traceBufferSize,
35265
+ traceCategories: normalizeCategories(options.traceCategories)
35266
+ };
35267
+ }
35268
+ function setDebugRuntimeConfig(config2) {
35269
+ currentConfig = {
35270
+ ...config2,
35271
+ traceCategories: normalizeCategories(config2.traceCategories),
35272
+ traceBufferSize: Math.max(10, Math.floor(config2.traceBufferSize || DEFAULT_CONFIG2.traceBufferSize))
35273
+ };
35274
+ }
35275
+ function getDebugRuntimeConfig() {
35276
+ return { ...currentConfig, traceCategories: [...currentConfig.traceCategories] };
35277
+ }
35278
+ function resetDebugRuntimeConfig() {
35279
+ currentConfig = { ...DEFAULT_CONFIG2 };
35280
+ }
35281
+ function shouldCollectTraceCategory(category) {
35282
+ const config2 = currentConfig;
35283
+ if (!config2.collectDebugTrace) return false;
35284
+ if (!category) return true;
35285
+ if (config2.traceCategories.length === 0) return true;
35286
+ return config2.traceCategories.includes(category);
35287
+ }
35288
+ function summarizeString(value) {
35289
+ return `[${value.length} chars]`;
35290
+ }
35291
+ function sanitizeTraceValue(value, traceContent) {
35292
+ if (traceContent) {
35293
+ if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
35294
+ if (value && typeof value === "object") {
35295
+ return Object.fromEntries(
35296
+ Object.entries(value).map(([key, nested]) => [key, sanitizeTraceValue(nested, traceContent)])
35297
+ );
35298
+ }
35299
+ return value;
35300
+ }
35301
+ if (typeof value === "string") return summarizeString(value);
35302
+ if (Array.isArray(value)) return value.map((entry) => sanitizeTraceValue(entry, traceContent));
35303
+ if (value && typeof value === "object") {
35304
+ return Object.fromEntries(
35305
+ Object.entries(value).map(([key, nested]) => [key, sanitizeTraceValue(nested, traceContent)])
35306
+ );
35307
+ }
35308
+ return value;
35309
+ }
35310
+ function sanitizeTracePayload(payload) {
35311
+ if (!payload) return {};
35312
+ const { traceContent } = getDebugRuntimeConfig();
35313
+ return sanitizeTraceValue(payload, traceContent);
35314
+ }
35315
+ function createEntry(event) {
35316
+ return {
35317
+ id: `trace_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`,
35318
+ ts: Date.now(),
35319
+ ...event,
35320
+ payload: sanitizeTracePayload(event.payload)
35321
+ };
35322
+ }
35323
+ function createDebugTraceStore(options) {
35324
+ const entries = [];
35325
+ const capacity = Math.max(1, Math.floor(options.capacity || 100));
35326
+ return {
35327
+ record(event) {
35328
+ if (!options.enabled) return null;
35329
+ const entry = createEntry(event);
35330
+ entries.push(entry);
35331
+ if (entries.length > capacity) {
35332
+ entries.splice(0, entries.length - capacity);
35333
+ }
35334
+ return entry;
35335
+ },
35336
+ list(query = {}) {
35337
+ const limit = Math.max(1, Math.floor(query.limit || 100));
35338
+ return entries.filter((entry) => !query.interactionId || entry.interactionId === query.interactionId).filter((entry) => !query.category || entry.category === query.category).slice(-limit).map((entry) => ({ ...entry, payload: entry.payload ? { ...entry.payload } : {} }));
35339
+ },
35340
+ clear() {
35341
+ entries.splice(0, entries.length);
35342
+ }
35343
+ };
35344
+ }
35345
+ var globalStore = createDebugTraceStore({ enabled: false, capacity: getDebugRuntimeConfig().traceBufferSize });
35346
+ function configureDebugTraceStore() {
35347
+ const config2 = getDebugRuntimeConfig();
35348
+ globalStore = createDebugTraceStore({
35349
+ enabled: config2.collectDebugTrace,
35350
+ capacity: config2.traceBufferSize
35351
+ });
35352
+ }
35353
+ function recordDebugTrace(event) {
35354
+ if (!shouldCollectTraceCategory(event.category)) return null;
35355
+ return globalStore.record(event);
35356
+ }
35357
+ function getRecentDebugTrace(query = {}) {
35358
+ return globalStore.list(query);
35359
+ }
35360
+ function clearDebugTrace() {
35361
+ globalStore.clear();
35362
+ }
35363
+ function createInteractionId(prefix = "ix") {
35364
+ return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
35365
+ }
35230
35366
  var RECENT_SEND_WINDOW_MS = 1200;
35231
35367
  var recentSendByTarget = /* @__PURE__ */ new Map();
35232
35368
  function hashSignatureParts2(parts) {
@@ -35293,6 +35429,20 @@ ${effect.notification.body || ""}`.trim();
35293
35429
  const providerSessionId = typeof state?.providerSessionId === "string" ? state.providerSessionId.trim() : "";
35294
35430
  return providerSessionId || targetSessionId;
35295
35431
  }
35432
+ function getInteractionId(args) {
35433
+ return typeof args?._interactionId === "string" && args._interactionId.trim() ? args._interactionId.trim() : void 0;
35434
+ }
35435
+ function traceProviderEvent(args, category, stage, options) {
35436
+ recordDebugTrace({
35437
+ interactionId: getInteractionId(args),
35438
+ category,
35439
+ stage,
35440
+ level: options.level || "info",
35441
+ sessionId: typeof args?.targetSessionId === "string" ? args.targetSessionId : options.h.currentSession?.sessionId,
35442
+ providerType: options.provider?.type || options.h.currentProviderType || options.h.currentSession?.providerType,
35443
+ payload: options.payload
35444
+ });
35445
+ }
35296
35446
  function callLegacyTextScript(script, text) {
35297
35447
  if (typeof script !== "function") return null;
35298
35448
  return script(text);
@@ -35538,6 +35688,16 @@ ${effect.notification.body || ""}`.trim();
35538
35688
  }
35539
35689
  if (parsed && typeof parsed === "object") {
35540
35690
  _log(`Extension OK: ${parsed.messages?.length || 0} msgs`);
35691
+ traceProviderEvent(args, "provider", "extension.read_chat.success", {
35692
+ h,
35693
+ provider,
35694
+ payload: {
35695
+ method: "evaluateProviderScript",
35696
+ result: evalResult.result,
35697
+ parsed,
35698
+ messageCount: Array.isArray(parsed.messages) ? parsed.messages.length : 0
35699
+ }
35700
+ });
35541
35701
  h.historyWriter.appendNewMessages(
35542
35702
  provider?.type || "unknown_extension",
35543
35703
  toHistoryPersistedMessages(normalizeReadChatMessages(parsed)),
@@ -35550,6 +35710,12 @@ ${effect.notification.body || ""}`.trim();
35550
35710
  }
35551
35711
  } catch (e) {
35552
35712
  _log(`Extension error: ${e.message}`);
35713
+ traceProviderEvent(args, "provider", "extension.read_chat.error", {
35714
+ h,
35715
+ provider,
35716
+ level: "warn",
35717
+ payload: { method: "evaluateProviderScript", error: e.message }
35718
+ });
35553
35719
  }
35554
35720
  if (h.agentStream) {
35555
35721
  const cdp2 = h.getCdp();
@@ -35613,27 +35779,45 @@ ${effect.notification.body || ""}`.trim();
35613
35779
  const script = h.getProviderScript("readChat") || h.getProviderScript("read_chat");
35614
35780
  if (script) {
35615
35781
  try {
35616
- const result = await cdp.evaluate(script, 5e4);
35617
- let parsed = result;
35618
- if (typeof parsed === "string") {
35619
- try {
35620
- parsed = JSON.parse(parsed);
35621
- } catch {
35782
+ const evalResult = await h.evaluateProviderScript("readChat", void 0, 5e4);
35783
+ if (evalResult?.result) {
35784
+ let parsed = evalResult.result;
35785
+ if (typeof parsed === "string") {
35786
+ try {
35787
+ parsed = JSON.parse(parsed);
35788
+ } catch {
35789
+ }
35790
+ }
35791
+ if (parsed && typeof parsed === "object" && parsed.messages?.length > 0) {
35792
+ _log(`OK: ${parsed.messages?.length} msgs`);
35793
+ traceProviderEvent(args, "provider", "ide.read_chat.success", {
35794
+ h,
35795
+ provider,
35796
+ payload: {
35797
+ method: "evaluate",
35798
+ result: evalResult.result,
35799
+ parsed,
35800
+ messageCount: Array.isArray(parsed.messages) ? parsed.messages.length : 0
35801
+ }
35802
+ });
35803
+ h.historyWriter.appendNewMessages(
35804
+ provider?.type || getCurrentProviderType(h, "unknown_ide"),
35805
+ toHistoryPersistedMessages(normalizeReadChatMessages(parsed)),
35806
+ parsed.title,
35807
+ args?.targetSessionId,
35808
+ historySessionId
35809
+ );
35810
+ return buildReadChatCommandResult(parsed, args);
35622
35811
  }
35623
- }
35624
- if (parsed && typeof parsed === "object" && parsed.messages?.length > 0) {
35625
- _log(`OK: ${parsed.messages?.length} msgs`);
35626
- h.historyWriter.appendNewMessages(
35627
- provider?.type || getCurrentProviderType(h, "unknown_ide"),
35628
- toHistoryPersistedMessages(normalizeReadChatMessages(parsed)),
35629
- parsed.title,
35630
- args?.targetSessionId,
35631
- historySessionId
35632
- );
35633
- return buildReadChatCommandResult(parsed, args);
35634
35812
  }
35635
35813
  } catch (e) {
35636
35814
  LOG2.info("Command", `[read_chat] Script error: ${e.message}`);
35815
+ traceProviderEvent(args, "provider", "ide.read_chat.error", {
35816
+ h,
35817
+ provider,
35818
+ level: "warn",
35819
+ payload: { method: "evaluate", error: e.message }
35820
+ });
35637
35821
  }
35638
35822
  }
35639
35823
  return buildReadChatCommandResult({ messages: [], status: "idle" }, args);
@@ -39114,6 +39298,12 @@ ${effect.notification.body || ""}`.trim();
39114
39298
  }
39115
39299
  };
39116
39300
  init_logger();
39301
+ function shouldRestoreHostedRuntime(record2, managerTag) {
39302
+ if (!managerTag) return true;
39303
+ const managedBy = typeof record2.managedBy === "string" ? record2.managedBy.trim() : "";
39304
+ if (!managedBy) return true;
39305
+ return managedBy === managerTag;
39306
+ }
39117
39307
  var chalkModule = import_chalk.default;
39118
39308
  var chalkApi = typeof chalkModule.yellow === "function" ? chalkModule : chalkModule.default || null;
39119
39309
  function colorize(color, text) {
@@ -39609,8 +39799,16 @@ Run 'adhdev doctor' for detailed diagnostics.`
39609
39799
  const sessions = records || await this.deps.listHostedCliRuntimes?.() || [];
39610
39800
  let restored = 0;
39611
39801
  const restoredBindings = /* @__PURE__ */ new Set();
39802
+ const managerTag = this.deps.hostedRuntimeManagerTag;
39612
39803
  for (const record2 of sessions) {
39613
39804
  if (!record2?.runtimeId || !record2?.cliType || !record2?.workspace) continue;
39805
+ if (!shouldRestoreHostedRuntime(record2, managerTag)) {
39806
+ LOG2.info(
39807
+ "CLI",
39808
+ `\u21B7 Skipping hosted runtime restore owned by ${record2.managedBy}: ${record2.runtimeKey || record2.runtimeId}`
39809
+ );
39810
+ continue;
39811
+ }
39614
39812
  if (this.adapters.has(record2.runtimeId) || instanceManager.getInstance(record2.runtimeId)) continue;
39615
39813
  const normalizedType = this.providerLoader.resolveAlias(record2.cliType);
39616
39814
  const providerMeta = this.providerLoader.getMeta(normalizedType);
@@ -41495,6 +41693,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
41495
41693
  ts: entry.ts,
41496
41694
  cmd: entry.cmd,
41497
41695
  src: entry.source,
41696
+ ...entry.interactionId ? { interactionId: entry.interactionId } : {},
41498
41697
  ...entry.args ? { args: maskArgs(entry.args) } : {},
41499
41698
  ...entry.success !== void 0 ? { ok: entry.success } : {},
41500
41699
  ...entry.error ? { err: entry.error } : {},
@@ -41516,6 +41715,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
41516
41715
  ts: parsed.ts,
41517
41716
  cmd: parsed.cmd,
41518
41717
  source: parsed.src,
41718
+ interactionId: parsed.interactionId,
41519
41719
  args: parsed.args,
41520
41720
  success: parsed.ok,
41521
41721
  error: parsed.err,
@@ -41975,6 +42175,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
41975
42175
  return "unknown";
41976
42176
  }
41977
42177
  }
42178
+ function normalizeCommandArgsWithInteractionId(args) {
42179
+ const base = args && typeof args === "object" ? { ...args } : {};
42180
+ if (typeof base._interactionId !== "string" || !String(base._interactionId).trim()) {
42181
+ base._interactionId = createInteractionId();
42182
+ }
42183
+ return base;
42184
+ }
41978
42185
  function toHostedCliRuntimeDescriptor(record2) {
41979
42186
  if (!record2 || typeof record2 !== "object") return null;
41980
42187
  const runtimeId = typeof record2.sessionId === "string" ? record2.sessionId : "";
@@ -42013,20 +42220,50 @@ Run 'adhdev doctor' for detailed diagnostics.`
42013
42220
  async execute(cmd, args, source = "unknown") {
42014
42221
  const cmdStart = Date.now();
42015
42222
  const logSource = normalizeCommandSource(source);
42223
+ const normalizedArgs = normalizeCommandArgsWithInteractionId(args);
42224
+ const interactionId = typeof normalizedArgs._interactionId === "string" ? normalizedArgs._interactionId : void 0;
42225
+ recordDebugTrace({
42226
+ interactionId,
42227
+ category: "command",
42228
+ stage: "received",
42229
+ level: "info",
42230
+ payload: { cmd, source: logSource }
42231
+ });
42016
42232
  try {
42017
- const daemonResult = await this.executeDaemonCommand(cmd, args);
42233
+ const daemonResult = await this.executeDaemonCommand(cmd, normalizedArgs);
42018
42234
  if (daemonResult) {
42019
- logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, args, success: daemonResult.success, durationMs: Date.now() - cmdStart });
42235
+ logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, interactionId, args: normalizedArgs, success: daemonResult.success, durationMs: Date.now() - cmdStart });
42236
+ recordDebugTrace({
42237
+ interactionId,
42238
+ category: "command",
42239
+ stage: "completed",
42240
+ level: daemonResult.success ? "info" : "warn",
42241
+ payload: { cmd, source: logSource, success: daemonResult.success, durationMs: Date.now() - cmdStart }
42242
+ });
42020
42243
  return daemonResult;
42021
42244
  }
42022
- const handlerResult = await this.deps.commandHandler.handle(cmd, args);
42023
- logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, args, success: handlerResult.success, durationMs: Date.now() - cmdStart });
42245
+ const handlerResult = await this.deps.commandHandler.handle(cmd, normalizedArgs);
42246
+ logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, interactionId, args: normalizedArgs, success: handlerResult.success, durationMs: Date.now() - cmdStart });
42247
+ recordDebugTrace({
42248
+ interactionId,
42249
+ category: "command",
42250
+ stage: "completed",
42251
+ level: handlerResult.success ? "info" : "warn",
42252
+ payload: { cmd, source: logSource, success: handlerResult.success, durationMs: Date.now() - cmdStart }
42253
+ });
42024
42254
  if (CHAT_COMMANDS.includes(cmd) && this.deps.onPostChatCommand) {
42025
42255
  this.deps.onPostChatCommand();
42026
42256
  }
42027
42257
  return handlerResult;
42028
42258
  } catch (e) {
42029
- logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, args, success: false, error: e.message, durationMs: Date.now() - cmdStart });
42259
+ logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd, source: logSource, interactionId, args: normalizedArgs, success: false, error: e.message, durationMs: Date.now() - cmdStart });
42260
+ recordDebugTrace({
42261
+ interactionId,
42262
+ category: "command",
42263
+ stage: "failed",
42264
+ level: "error",
42265
+ payload: { cmd, source: logSource, error: e?.message || String(e), durationMs: Date.now() - cmdStart }
42266
+ });
42030
42267
  throw e;
42031
42268
  }
42032
42269
  }
@@ -42068,6 +42305,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
42068
42305
  return { success: false, error: e.message };
42069
42306
  }
42070
42307
  }
42308
+ case "get_debug_trace": {
42309
+ const count = parseInt(args?.count) || parseInt(args?.limit) || 100;
42310
+ const sinceTs = Number(args?.since) || 0;
42311
+ const interactionId = typeof args?.interactionId === "string" ? args.interactionId : void 0;
42312
+ const category = typeof args?.category === "string" ? args.category : void 0;
42313
+ const trace = getRecentDebugTrace({ interactionId, category, limit: count }).filter((entry) => !sinceTs || entry.ts > sinceTs);
42314
+ return { success: true, trace, count: trace.length };
42315
+ }
42071
42316
  case "session_host_get_diagnostics": {
42072
42317
  if (!this.deps.sessionHostControl) return { success: false, error: "Session host control unavailable" };
42073
42318
  const diagnostics = await this.deps.sessionHostControl.getDiagnostics({
@@ -49394,6 +49639,14 @@ data: ${JSON.stringify(msg.data)}
49394
49639
  });
49395
49640
  }
49396
49641
  };
49642
+ var DEFAULT_SESSION_HOST_APP_NAME = "adhdev";
49643
+ var DEFAULT_STANDALONE_SESSION_HOST_APP_NAME = "adhdev-standalone";
49644
+ function resolveSessionHostAppName2(options = {}) {
49645
+ const env = options.env || process.env;
49646
+ const explicit = typeof env.ADHDEV_SESSION_HOST_NAME === "string" ? env.ADHDEV_SESSION_HOST_NAME.trim() : "";
49647
+ if (explicit) return explicit;
49648
+ return options.standalone ? DEFAULT_STANDALONE_SESSION_HOST_APP_NAME : DEFAULT_SESSION_HOST_APP_NAME;
49649
+ }
49397
49650
  var import_session_host_core32 = require_dist();
49398
49651
  var STARTUP_TIMEOUT_MS = 8e3;
49399
49652
  var STARTUP_POLL_MS = 200;
@@ -49442,7 +49695,8 @@ data: ${JSON.stringify(msg.data)}
49442
49695
  cliType: record2.providerType,
49443
49696
  workspace: record2.workspace,
49444
49697
  cliArgs: Array.isArray(record2.meta?.cliArgs) ? record2.meta.cliArgs : [],
49445
- providerSessionId: typeof record2.meta?.providerSessionId === "string" ? String(record2.meta.providerSessionId) : void 0
49698
+ providerSessionId: typeof record2.meta?.providerSessionId === "string" ? String(record2.meta.providerSessionId) : void 0,
49699
+ managedBy: typeof record2.meta?.managedBy === "string" ? String(record2.meta.managedBy) : void 0
49446
49700
  }));
49447
49701
  } finally {
49448
49702
  await client.close().catch(() => {
@@ -49926,8 +50180,11 @@ var fs2 = __toESM(require("fs"));
49926
50180
  var os2 = __toESM(require("os"));
49927
50181
  var path = __toESM(require("path"));
49928
50182
  var import_daemon_core = __toESM(require_dist2());
49929
- var SESSION_HOST_APP_NAME = process.env.ADHDEV_SESSION_HOST_NAME || "adhdev";
50183
+ var SESSION_HOST_APP_NAME = (0, import_daemon_core.resolveSessionHostAppName)({ standalone: true });
49930
50184
  var SESSION_HOST_START_TIMEOUT_MS = 15e3;
50185
+ function getStandaloneSessionHostAppName() {
50186
+ return SESSION_HOST_APP_NAME;
50187
+ }
49931
50188
  function buildSessionHostEnv(baseEnv) {
49932
50189
  const env = {};
49933
50190
  for (const [key, value] of Object.entries(baseEnv)) {
@@ -50602,6 +50859,7 @@ var StandaloneServer = class {
50602
50859
  onStatusChange: () => this.scheduleBroadcastStatus(),
50603
50860
  removeAgentTracking: () => {
50604
50861
  },
50862
+ hostedRuntimeManagerTag: "adhdev-standalone",
50605
50863
  createPtyTransportFactory: ({ runtimeId, providerType, workspace, cliArgs, providerSessionId, attachExisting }) => new import_daemon_core2.SessionHostPtyTransportFactory({
50606
50864
  endpoint: sessionHostEndpoint,
50607
50865
  ensureReady: async () => {
@@ -50693,6 +50951,7 @@ var StandaloneServer = class {
50693
50951
  const cdpCount = [...this.components.cdpManagers.values()].filter((m) => m.isConnected).length;
50694
50952
  console.log(` CDP: ${cdpCount > 0 ? `\u2705 ${cdpCount} connected` : "\u274C none"}`);
50695
50953
  console.log(` Providers: ${this.components.providerLoader.getAll().length} loaded`);
50954
+ console.log(` Session Host: ${getStandaloneSessionHostAppName()}`);
50696
50955
  if (options.dev) {
50697
50956
  console.log(` \u{1F6E0}\uFE0F DevConsole: http://127.0.0.1:19280`);
50698
50957
  }
@@ -51703,6 +51962,9 @@ Options:
51703
51962
  --dev Enable DevConsole to debug and test providers
51704
51963
  --public <path> Custom path to the web dashboard distribution
51705
51964
  --no-open Do not automatically open the browser on startup
51965
+
51966
+ Environment:
51967
+ ADHDEV_SESSION_HOST_NAME Override session host namespace (default: adhdev-standalone)
51706
51968
  --help, -h Show this help message
51707
51969
 
51708
51970
  Runtime commands: