@adhdev/daemon-core 0.9.82-rc.475 → 0.9.82-rc.476

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.mjs CHANGED
@@ -404,10 +404,10 @@ function readInjected(value) {
404
404
  }
405
405
  function getDaemonBuildInfo() {
406
406
  if (cached) return cached;
407
- const commit = readInjected(true ? "c7b88fafbc63d3fc0de4b93c74facdb5145b8be6" : void 0) ?? "unknown";
408
- const commitShort = readInjected(true ? "c7b88faf" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
409
- const version = readInjected(true ? "0.9.82-rc.475" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
410
- const builtAt = readInjected(true ? "2026-07-06T06:24:24.877Z" : void 0);
407
+ const commit = readInjected(true ? "f3bc279bf108da3a23da4e0e33ebdc41d851930c" : void 0) ?? "unknown";
408
+ const commitShort = readInjected(true ? "f3bc279b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
409
+ const version = readInjected(true ? "0.9.82-rc.476" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
410
+ const builtAt = readInjected(true ? "2026-07-06T08:19:57.539Z" : void 0);
411
411
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
412
412
  return cached;
413
413
  }
@@ -16698,13 +16698,17 @@ function normalizeState(raw) {
16698
16698
  const sessionNotificationUnreadOverrides = Object.fromEntries(
16699
16699
  Object.entries(isPlainObject2(parsed.sessionNotificationUnreadOverrides) ? parsed.sessionNotificationUnreadOverrides : {}).filter(([, value]) => typeof value === "string" && value.length > 0)
16700
16700
  );
16701
+ const sessionProviderSessionPins = Object.fromEntries(
16702
+ Object.entries(isPlainObject2(parsed.sessionProviderSessionPins) ? parsed.sessionProviderSessionPins : {}).filter(([key2, value]) => typeof key2 === "string" && key2.length > 0 && typeof value === "string" && value.length > 0)
16703
+ );
16701
16704
  return {
16702
16705
  recentActivity,
16703
16706
  savedProviderSessions,
16704
16707
  sessionReads,
16705
16708
  sessionReadMarkers,
16706
16709
  sessionNotificationDismissals,
16707
- sessionNotificationUnreadOverrides
16710
+ sessionNotificationUnreadOverrides,
16711
+ sessionProviderSessionPins
16708
16712
  };
16709
16713
  }
16710
16714
  function loadState() {
@@ -16727,6 +16731,20 @@ function saveState(state) {
16727
16731
  function resetState() {
16728
16732
  saveState({ ...DEFAULT_STATE });
16729
16733
  }
16734
+ function loadPersistedProviderSessionPins() {
16735
+ return { ...loadState().sessionProviderSessionPins };
16736
+ }
16737
+ function recordPersistedProviderSessionPin(sessionId, providerSessionId) {
16738
+ const key2 = typeof sessionId === "string" ? sessionId.trim() : "";
16739
+ const value = typeof providerSessionId === "string" ? providerSessionId.trim() : "";
16740
+ if (!key2 || !value) return;
16741
+ const state = loadState();
16742
+ if (state.sessionProviderSessionPins[key2] === value) return;
16743
+ saveState({
16744
+ ...state,
16745
+ sessionProviderSessionPins: { ...state.sessionProviderSessionPins, [key2]: value }
16746
+ });
16747
+ }
16730
16748
  var DEFAULT_STATE;
16731
16749
  var init_state_store = __esm({
16732
16750
  "src/config/state-store.ts"() {
@@ -16738,7 +16756,8 @@ var init_state_store = __esm({
16738
16756
  sessionReads: {},
16739
16757
  sessionReadMarkers: {},
16740
16758
  sessionNotificationDismissals: {},
16741
- sessionNotificationUnreadOverrides: {}
16759
+ sessionNotificationUnreadOverrides: {},
16760
+ sessionProviderSessionPins: {}
16742
16761
  };
16743
16762
  }
16744
16763
  });
@@ -33663,6 +33682,7 @@ import { randomUUID as randomUUID11 } from "crypto";
33663
33682
  // src/commands/chat-commands-read.ts
33664
33683
  init_contracts2();
33665
33684
  import * as path16 from "path";
33685
+ init_state_store();
33666
33686
  init_coordinator_registry();
33667
33687
  init_logger();
33668
33688
  init_debug_trace();
@@ -34018,15 +34038,33 @@ init_chat_message_normalization();
34018
34038
  var HOT_TAIL_MIN_LIMIT = 60;
34019
34039
  var CLI_NATIVE_TRANSCRIPT_PROVIDERS = /* @__PURE__ */ new Set(["codex-cli", "claude-cli", "hermes-cli", "antigravity-cli"]);
34020
34040
  var lastBoundProviderSessionIdByMeshSession = /* @__PURE__ */ new Map();
34041
+ var persistedProviderSessionPinsHydrated = false;
34042
+ function hydratePersistedProviderSessionPinsOnce() {
34043
+ if (persistedProviderSessionPinsHydrated) return;
34044
+ persistedProviderSessionPinsHydrated = true;
34045
+ try {
34046
+ for (const [key2, value] of Object.entries(loadPersistedProviderSessionPins())) {
34047
+ if (!lastBoundProviderSessionIdByMeshSession.has(key2)) {
34048
+ lastBoundProviderSessionIdByMeshSession.set(key2, value);
34049
+ }
34050
+ }
34051
+ } catch {
34052
+ }
34053
+ }
34021
34054
  function recordBoundProviderSessionId(meshSessionId, providerSessionId) {
34022
34055
  const key2 = typeof meshSessionId === "string" ? meshSessionId.trim() : "";
34023
34056
  const value = typeof providerSessionId === "string" ? providerSessionId.trim() : "";
34024
34057
  if (!key2 || !value) return;
34025
34058
  lastBoundProviderSessionIdByMeshSession.set(key2, value);
34059
+ try {
34060
+ recordPersistedProviderSessionPin(key2, value);
34061
+ } catch {
34062
+ }
34026
34063
  }
34027
34064
  function getBoundProviderSessionIdPin(meshSessionId) {
34028
34065
  const key2 = typeof meshSessionId === "string" ? meshSessionId.trim() : "";
34029
34066
  if (!key2) return void 0;
34067
+ hydratePersistedProviderSessionPinsOnce();
34030
34068
  const pinned = lastBoundProviderSessionIdByMeshSession.get(key2);
34031
34069
  return pinned && pinned.trim() ? pinned.trim() : void 0;
34032
34070
  }
@@ -35028,10 +35066,15 @@ async function handleReadChat(h, args) {
35028
35066
  let nativeHistory = null;
35029
35067
  let nativeHistoryError;
35030
35068
  if (supportsNative) {
35069
+ const pinnedProviderSessionIdForRead = getBoundProviderSessionIdPin(targetSessionId);
35070
+ const nativeReadSessionIdIsRuntimeFallback = Boolean(
35071
+ targetSessionId && nativeHistoryReadSessionId === targetSessionId && !getExplicitHistorySessionId(args)
35072
+ );
35073
+ const effectiveNativeReadSessionId = nativeReadSessionIdIsRuntimeFallback ? pinnedProviderSessionIdForRead || void 0 : nativeHistoryReadSessionId;
35031
35074
  try {
35032
35075
  nativeHistory = readCliProviderNativeHistory(agentStr, {
35033
35076
  canonicalHistory: provider?.nativeHistory,
35034
- historySessionId: nativeHistoryReadSessionId,
35077
+ historySessionId: effectiveNativeReadSessionId,
35035
35078
  workspace,
35036
35079
  offset: 0,
35037
35080
  limit: nativeHistoryLimit,
@@ -35044,11 +35087,11 @@ async function handleReadChat(h, args) {
35044
35087
  // Stable per-session identity for antigravity's conversation-claim
35045
35088
  // owner token (== session registry sessionId == instance instanceId).
35046
35089
  instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
35047
- pinnedProviderSessionId: getBoundProviderSessionIdPin(targetSessionId),
35090
+ pinnedProviderSessionId: pinnedProviderSessionIdForRead,
35048
35091
  // Last-resort only when no pin was ever recorded for this
35049
35092
  // session; the downstream workspace-overlap safety gate
35050
35093
  // still filters an aliased session out.
35051
- allowWorkspaceLatestFallback: !getBoundProviderSessionIdPin(targetSessionId)
35094
+ allowWorkspaceLatestFallback: !pinnedProviderSessionIdForRead
35052
35095
  });
35053
35096
  const resolvedProviderSessionId = typeof nativeHistory?.providerSessionId === "string" ? nativeHistory.providerSessionId.trim() : "";
35054
35097
  if (resolvedProviderSessionId) {
@@ -50882,6 +50925,13 @@ function createNativeHistoryDispatcher(reader) {
50882
50925
  if (requestedProviderSid && session.providerSessionId && session.providerSessionId !== requestedProviderSid) {
50883
50926
  return null;
50884
50927
  }
50928
+ let resolvedProviderSessionId = session.providerSessionId;
50929
+ if (reader === "antigravity-cli") {
50930
+ const onDiskUuid = extractAntigravityConversationUuid(session.sourcePath || sourcePath);
50931
+ if (onDiskUuid && (!resolvedProviderSessionId || resolvedProviderSessionId === sessionId)) {
50932
+ resolvedProviderSessionId = onDiskUuid;
50933
+ }
50934
+ }
50885
50935
  return {
50886
50936
  messages: session.messages.map((m) => ({
50887
50937
  role: normalizeRole2(m.role),
@@ -50890,7 +50940,7 @@ function createNativeHistoryDispatcher(reader) {
50890
50940
  kind: typeof m.kind === "string" ? m.kind : "standard",
50891
50941
  workspace: typeof m.workspace === "string" ? m.workspace : workspace || void 0
50892
50942
  })),
50893
- providerSessionId: session.providerSessionId,
50943
+ providerSessionId: resolvedProviderSessionId,
50894
50944
  sourcePath: session.sourcePath,
50895
50945
  sourceMtimeMs: session.sourceMtimeMs,
50896
50946
  nativeHistoryCoverage: session.nativeHistoryCoverage || "full"
@@ -51019,6 +51069,17 @@ function resolveRealPath(value) {
51019
51069
  return value;
51020
51070
  }
51021
51071
  }
51072
+ function extractAntigravityConversationUuid(sourcePath) {
51073
+ if (!sourcePath) return "";
51074
+ const segments = sourcePath.split(/[\\/]/);
51075
+ const base = segments[segments.length - 1] || "";
51076
+ const baseMatch = /^([0-9a-f-]+)\.(?:db|pb)$/i.exec(base);
51077
+ if (baseMatch && isUuidLikeSessionId2(baseMatch[1])) return baseMatch[1];
51078
+ for (const seg of segments) {
51079
+ if (isUuidLikeSessionId2(seg)) return seg;
51080
+ }
51081
+ return "";
51082
+ }
51022
51083
  var AGY_SPAWN_CLAIM_GRACE_MS = 2e3;
51023
51084
  function resolveAntigravityPath(workspace, sessionId, sessionStartedAtMs, instanceId) {
51024
51085
  const agyRoot = path34.join(os25.homedir(), ".gemini", "antigravity-cli");
@@ -51057,6 +51118,7 @@ function pickUnboundConversationDb(convRoot, sessionFloorMs, owner) {
51057
51118
  } catch {
51058
51119
  return null;
51059
51120
  }
51121
+ const applyRecencyCutoff = !(sessionFloorMs > 0);
51060
51122
  const recencyCutoff = Date.now() - RECENT_WINDOW_MS;
51061
51123
  const candidates = [];
51062
51124
  for (const entry of entries) {
@@ -51067,7 +51129,7 @@ function pickUnboundConversationDb(convRoot, sessionFloorMs, owner) {
51067
51129
  if (isAntigravityConversationClaimedByOther(uuid, owner)) continue;
51068
51130
  const p = path34.join(convRoot, entry.name);
51069
51131
  const mtime = safeMtime(p);
51070
- if (mtime < recencyCutoff) continue;
51132
+ if (applyRecencyCutoff && mtime < recencyCutoff) continue;
51071
51133
  candidates.push({ path: p, uuid, mtime, birth: safeBirthtime(p) });
51072
51134
  }
51073
51135
  if (candidates.length === 0) return null;