@adhdev/daemon-core 0.9.82-rc.440 → 0.9.82-rc.441

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
@@ -409,10 +409,10 @@ function readInjected(value) {
409
409
  }
410
410
  function getDaemonBuildInfo() {
411
411
  if (cached) return cached;
412
- const commit = readInjected(true ? "c3062ac83f65cfbd83e0bc4236972b64a80435cc" : void 0) ?? "unknown";
413
- const commitShort = readInjected(true ? "c3062ac8" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
- const version = readInjected(true ? "0.9.82-rc.440" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
- const builtAt = readInjected(true ? "2026-07-01T05:56:51.525Z" : void 0);
412
+ const commit = readInjected(true ? "88526551632362f9601e9ebc31340627700a82fd" : void 0) ?? "unknown";
413
+ const commitShort = readInjected(true ? "88526551" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
+ const version = readInjected(true ? "0.9.82-rc.441" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
+ const builtAt = readInjected(true ? "2026-07-01T06:40:04.206Z" : void 0);
416
416
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
417
417
  return cached;
418
418
  }
@@ -31105,6 +31105,19 @@ var CHAT_SOURCE_REGISTRY = new ChatSourceRegistry();
31105
31105
  init_chat_message_normalization();
31106
31106
  var HOT_TAIL_MIN_LIMIT = 60;
31107
31107
  var CLI_NATIVE_TRANSCRIPT_PROVIDERS = /* @__PURE__ */ new Set(["codex-cli", "claude-cli", "hermes-cli", "antigravity-cli"]);
31108
+ var lastBoundProviderSessionIdByMeshSession = /* @__PURE__ */ new Map();
31109
+ function recordBoundProviderSessionId(meshSessionId, providerSessionId) {
31110
+ const key2 = typeof meshSessionId === "string" ? meshSessionId.trim() : "";
31111
+ const value = typeof providerSessionId === "string" ? providerSessionId.trim() : "";
31112
+ if (!key2 || !value) return;
31113
+ lastBoundProviderSessionIdByMeshSession.set(key2, value);
31114
+ }
31115
+ function getBoundProviderSessionIdPin(meshSessionId) {
31116
+ const key2 = typeof meshSessionId === "string" ? meshSessionId.trim() : "";
31117
+ if (!key2) return void 0;
31118
+ const pinned = lastBoundProviderSessionIdByMeshSession.get(key2);
31119
+ return pinned && pinned.trim() ? pinned.trim() : void 0;
31120
+ }
31108
31121
  var warnedLegacyNativeAllowlistHits = /* @__PURE__ */ new Set();
31109
31122
  function warnLegacyNativeAllowlistHit(providerType) {
31110
31123
  if (warnedLegacyNativeAllowlistHits.has(providerType)) return;
@@ -31679,7 +31692,10 @@ function sessionSpawnEnvFromAdapter(h, targetSessionId) {
31679
31692
  }
31680
31693
  function readCliProviderNativeHistory(agentStr, args) {
31681
31694
  const canBindFromLiveSession = !args.historySessionId && typeof args.sessionStartedAtMs === "number" && args.sessionStartedAtMs > 0 && typeof args.workspace === "string" && args.workspace.trim().length > 0;
31682
- if (!args.historySessionId && !canBindFromLiveSession) {
31695
+ const pinnedProviderSessionId = typeof args.pinnedProviderSessionId === "string" ? args.pinnedProviderSessionId.trim() : "";
31696
+ const effectiveHistorySessionId = args.historySessionId || (!canBindFromLiveSession ? pinnedProviderSessionId : "");
31697
+ const workspaceLatestFallback = !effectiveHistorySessionId && !canBindFromLiveSession && !pinnedProviderSessionId && args.allowWorkspaceLatestFallback === true && typeof args.workspace === "string" && args.workspace.trim().length > 0;
31698
+ if (!effectiveHistorySessionId && !canBindFromLiveSession && !workspaceLatestFallback) {
31683
31699
  return {
31684
31700
  messages: [],
31685
31701
  hasMore: false,
@@ -31690,7 +31706,7 @@ function readCliProviderNativeHistory(agentStr, args) {
31690
31706
  }
31691
31707
  const sessionHistory = readProviderChatHistory(agentStr, {
31692
31708
  canonicalHistory: args.canonicalHistory,
31693
- historySessionId: args.historySessionId,
31709
+ historySessionId: effectiveHistorySessionId || void 0,
31694
31710
  workspace: args.workspace,
31695
31711
  offset: args.offset,
31696
31712
  limit: args.limit,
@@ -31704,7 +31720,7 @@ function readCliProviderNativeHistory(agentStr, args) {
31704
31720
  const boundProviderSessionId = typeof sessionHistory?.providerSessionId === "string" ? sessionHistory.providerSessionId.trim() : "";
31705
31721
  return {
31706
31722
  ...sessionHistory,
31707
- lookup: args.historySessionId || canBindFromLiveSession && boundProviderSessionId ? "session" : "workspace"
31723
+ lookup: effectiveHistorySessionId || canBindFromLiveSession && boundProviderSessionId ? "session" : "workspace"
31708
31724
  };
31709
31725
  }
31710
31726
  function readLiveCodexWorkspaceNativeHistory(agentStr, args) {
@@ -31957,7 +31973,8 @@ async function handleChatHistory(h, args) {
31957
31973
  historyBehavior: provider?.historyBehavior,
31958
31974
  scripts: provider?.scripts,
31959
31975
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
31960
- envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId)
31976
+ envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
31977
+ pinnedProviderSessionId: getBoundProviderSessionIdPin(args?.targetSessionId)
31961
31978
  }) : readProviderChatHistory(agentStr, {
31962
31979
  canonicalHistory: provider?.nativeHistory,
31963
31980
  historySessionId,
@@ -31972,6 +31989,9 @@ async function handleChatHistory(h, args) {
31972
31989
  const lookup = result.lookup === "workspace" ? "workspace" : "session";
31973
31990
  const messages = Array.isArray(result.messages) ? normalizeAndFilterNativeHistory(h, agentStr, args, result.messages, result?.providerSessionId) : [];
31974
31991
  const historyProviderSessionId = typeof result?.providerSessionId === "string" ? result.providerSessionId : readHistorySessionIdFromMessages(messages) || historySessionId;
31992
+ if (typeof result?.providerSessionId === "string" && result.providerSessionId.trim()) {
31993
+ recordBoundProviderSessionId(args?.targetSessionId, result.providerSessionId.trim());
31994
+ }
31975
31995
  const safeMapping = hasSafeNativeHistoryMapping({
31976
31996
  historySessionId: lookup === "workspace" ? void 0 : historySessionId,
31977
31997
  providerSessionId: lookup === "workspace" ? void 0 : historyProviderSessionId,
@@ -32106,8 +32126,17 @@ async function handleReadChat(h, args) {
32106
32126
  scripts: provider?.scripts,
32107
32127
  excludeInProgressTurn: returnedStatus === "waiting_approval",
32108
32128
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
32109
- envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId)
32129
+ envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
32130
+ pinnedProviderSessionId: getBoundProviderSessionIdPin(targetSessionId),
32131
+ // Last-resort only when no pin was ever recorded for this
32132
+ // session; the downstream workspace-overlap safety gate
32133
+ // still filters an aliased session out.
32134
+ allowWorkspaceLatestFallback: !getBoundProviderSessionIdPin(targetSessionId)
32110
32135
  });
32136
+ const resolvedProviderSessionId = typeof nativeHistory?.providerSessionId === "string" ? nativeHistory.providerSessionId.trim() : "";
32137
+ if (resolvedProviderSessionId) {
32138
+ recordBoundProviderSessionId(targetSessionId, resolvedProviderSessionId);
32139
+ }
32111
32140
  } catch (error) {
32112
32141
  nativeHistoryError = error;
32113
32142
  nativeHistory = null;
@@ -32353,9 +32382,14 @@ async function handleReadChat(h, args) {
32353
32382
  const workspace = targetSid ? typeof registrySessionWorkspace === "string" ? registrySessionWorkspace : argsWorkspace ?? currentSessionWorkspace : typeof currentSessionWorkspace === "string" ? currentSessionWorkspace : void 0;
32354
32383
  const intendedWorkspace = argsWorkspace;
32355
32384
  const supportsNative = supportsCliNativeTranscript(agentStr, provider) && isNativeSourceCanonicalHistory(provider?.nativeHistory);
32385
+ const pinnedProviderSessionIdForHistory = getBoundProviderSessionIdPin(targetSid);
32386
+ const historySessionIdIsRuntimeFallback = Boolean(
32387
+ targetSid && historySessionId === targetSid && !getExplicitHistorySessionId(args)
32388
+ );
32389
+ const effectiveHistorySessionIdForRead = historySessionIdIsRuntimeFallback ? pinnedProviderSessionIdForHistory || void 0 : historySessionId;
32356
32390
  const history = supportsNative ? readCliProviderNativeHistory(agentStr, {
32357
32391
  canonicalHistory: provider?.nativeHistory,
32358
- historySessionId,
32392
+ historySessionId: effectiveHistorySessionIdForRead,
32359
32393
  workspace,
32360
32394
  offset: 0,
32361
32395
  limit: historyLimit,
@@ -32363,7 +32397,11 @@ async function handleReadChat(h, args) {
32363
32397
  historyBehavior: provider?.historyBehavior,
32364
32398
  scripts: provider?.scripts,
32365
32399
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
32366
- envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId)
32400
+ envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
32401
+ pinnedProviderSessionId: pinnedProviderSessionIdForHistory,
32402
+ // Last-resort only when no pin was ever recorded AND the
32403
+ // runtime fallback did not resolve a real provider session.
32404
+ allowWorkspaceLatestFallback: !pinnedProviderSessionIdForHistory && historySessionIdIsRuntimeFallback
32367
32405
  }) : readProviderChatHistory(agentStr, {
32368
32406
  canonicalHistory: provider?.nativeHistory,
32369
32407
  historySessionId,
@@ -32376,14 +32414,18 @@ async function handleReadChat(h, args) {
32376
32414
  });
32377
32415
  const lookup = history?.lookup === "workspace" ? "workspace" : "session";
32378
32416
  const historyMessages = Array.isArray(history?.messages) ? normalizeAndFilterNativeHistory(h, agentStr, args, history.messages, history?.providerSessionId) : [];
32379
- const historyProviderSessionId = typeof history?.providerSessionId === "string" ? history.providerSessionId : readHistorySessionIdFromMessages(historyMessages) || historySessionId;
32417
+ const historyProviderSessionId = typeof history?.providerSessionId === "string" ? history.providerSessionId : readHistorySessionIdFromMessages(historyMessages) || effectiveHistorySessionIdForRead;
32418
+ if (typeof history?.providerSessionId === "string" && history.providerSessionId.trim()) {
32419
+ recordBoundProviderSessionId(targetSid, history.providerSessionId.trim());
32420
+ }
32421
+ const mappingSessionId = effectiveHistorySessionIdForRead;
32380
32422
  const safeMapping = supportsNative ? hasSafeNativeHistoryMapping({
32381
- historySessionId: lookup === "workspace" ? void 0 : historySessionId,
32423
+ historySessionId: lookup === "workspace" ? void 0 : mappingSessionId,
32382
32424
  providerSessionId: lookup === "workspace" ? void 0 : historyProviderSessionId,
32383
32425
  workspace,
32384
32426
  nativeMessages: historyMessages
32385
32427
  }) : false;
32386
- const trustedExactNativeIdentity = lookup !== "workspace" && Boolean(historySessionId) && Boolean(historyProviderSessionId) && historySessionId === historyProviderSessionId;
32428
+ const trustedExactNativeIdentity = lookup !== "workspace" && Boolean(mappingSessionId) && Boolean(historyProviderSessionId) && mappingSessionId === historyProviderSessionId;
32387
32429
  const machineSessionKey = String(
32388
32430
  args?.targetSessionId || historyProviderSessionId || historySessionId || h.currentSession?.sessionId || ""
32389
32431
  );