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

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 ? "cfb46b13fb8f556e4cb7179c4503ac3c86923d92" : void 0) ?? "unknown";
408
- const commitShort = readInjected(true ? "cfb46b13" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
409
- const version = readInjected(true ? "0.9.82-rc.474" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
410
- const builtAt = readInjected(true ? "2026-07-06T03:34:46.223Z" : void 0);
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);
411
411
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
412
412
  return cached;
413
413
  }
@@ -31611,10 +31611,11 @@ function normalizeProviderNativeHistoryRecords(agentType, historySessionId, reco
31611
31611
  return sanitizeHistoryMessage(agentType, base);
31612
31612
  }).filter(Boolean);
31613
31613
  }
31614
- function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
31614
+ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
31615
31615
  const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "readSession");
31616
31616
  if (!fn) return null;
31617
31617
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
31618
+ const normalizedInstanceId = typeof instanceId === "string" ? instanceId.trim() : "";
31618
31619
  const result = fn({
31619
31620
  agentType,
31620
31621
  sessionId: normalizedSessionId,
@@ -31629,6 +31630,12 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
31629
31630
  // which leaves the guard disarmed so discovery still works.
31630
31631
  providerSessionId: normalizedSessionId,
31631
31632
  historySessionId: normalizedSessionId,
31633
+ // Stable per-session owner key for the antigravity conversation-claim
31634
+ // registry (see dispatcher.resolveAntigravityPath / antigravityOwnerToken).
31635
+ // Equals the session registry's sessionId and the provider instance's
31636
+ // instanceId, so read side and instance side derive the identical claim
31637
+ // owner token and two concurrent antigravity sessions never cross-bind.
31638
+ instanceId: normalizedInstanceId || void 0,
31632
31639
  workspace,
31633
31640
  format: canonicalHistory?.format,
31634
31641
  watchPath: canonicalHistory?.watchPath,
@@ -31636,7 +31643,7 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
31636
31643
  sessionStartedAtMs,
31637
31644
  envOverrides,
31638
31645
  forceRefresh: forceRefresh === true,
31639
- args: { sessionId: normalizedSessionId, historySessionId: normalizedSessionId, workspace, excludeInProgressTurn: excludeInProgressTurn === true, sessionStartedAtMs, envOverrides, forceRefresh: forceRefresh === true }
31646
+ args: { sessionId: normalizedSessionId, historySessionId: normalizedSessionId, instanceId: normalizedInstanceId || void 0, workspace, excludeInProgressTurn: excludeInProgressTurn === true, sessionStartedAtMs, envOverrides, forceRefresh: forceRefresh === true }
31640
31647
  });
31641
31648
  if (!result || typeof result !== "object") return null;
31642
31649
  const records = normalizeProviderNativeHistoryRecords(agentType, normalizedSessionId, result.messages || result.records);
@@ -31652,11 +31659,11 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
31652
31659
  unavailableReason: typeof result.unavailableReason === "string" ? result.unavailableReason.trim() : void 0
31653
31660
  };
31654
31661
  }
31655
- function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
31662
+ function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
31656
31663
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
31657
31664
  const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
31658
31665
  if (!canonicalHistory || !normalizedSessionId && !normalizedWorkspace || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
31659
- return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh);
31666
+ return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId);
31660
31667
  }
31661
31668
  function materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts) {
31662
31669
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
@@ -31685,7 +31692,7 @@ function isNativeSourceCanonicalHistory(canonicalHistory) {
31685
31692
  }
31686
31693
  function readProviderChatHistory(agentType, options = {}) {
31687
31694
  if (isNativeSourceCanonicalHistory(options.canonicalHistory) && (options.historySessionId || options.workspace)) {
31688
- const nativeResult = buildNativeHistoryReadResult(agentType, options.canonicalHistory, options.scripts, options.historySessionId, options.workspace, options.excludeInProgressTurn, options.sessionStartedAtMs, options.envOverrides, options.forceRefresh);
31695
+ const nativeResult = buildNativeHistoryReadResult(agentType, options.canonicalHistory, options.scripts, options.historySessionId, options.workspace, options.excludeInProgressTurn, options.sessionStartedAtMs, options.envOverrides, options.forceRefresh, options.instanceId);
31689
31696
  if (!nativeResult) return { messages: [], hasMore: false, source: "native-unavailable" };
31690
31697
  return {
31691
31698
  ...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
@@ -34620,7 +34627,8 @@ function readCliProviderNativeHistory(agentStr, args) {
34620
34627
  scripts: args.scripts,
34621
34628
  excludeInProgressTurn: args.excludeInProgressTurn,
34622
34629
  sessionStartedAtMs: args.sessionStartedAtMs,
34623
- envOverrides: args.envOverrides
34630
+ envOverrides: args.envOverrides,
34631
+ instanceId: args.instanceId
34624
34632
  });
34625
34633
  const boundProviderSessionId = typeof sessionHistory?.providerSessionId === "string" ? sessionHistory.providerSessionId.trim() : "";
34626
34634
  return {
@@ -34879,6 +34887,7 @@ async function handleChatHistory(h, args) {
34879
34887
  scripts: provider?.scripts,
34880
34888
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
34881
34889
  envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
34890
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
34882
34891
  pinnedProviderSessionId: getBoundProviderSessionIdPin(args?.targetSessionId)
34883
34892
  }) : readProviderChatHistory(agentStr, {
34884
34893
  canonicalHistory: provider?.nativeHistory,
@@ -35032,6 +35041,9 @@ async function handleReadChat(h, args) {
35032
35041
  excludeInProgressTurn: returnedStatus === "waiting_approval",
35033
35042
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
35034
35043
  envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
35044
+ // Stable per-session identity for antigravity's conversation-claim
35045
+ // owner token (== session registry sessionId == instance instanceId).
35046
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
35035
35047
  pinnedProviderSessionId: getBoundProviderSessionIdPin(targetSessionId),
35036
35048
  // Last-resort only when no pin was ever recorded for this
35037
35049
  // session; the downstream workspace-overlap safety gate
@@ -35081,7 +35093,8 @@ async function handleReadChat(h, args) {
35081
35093
  scripts: provider?.scripts,
35082
35094
  excludeInProgressTurn: returnedStatus === "waiting_approval",
35083
35095
  sessionStartedAtMs,
35084
- envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId)
35096
+ envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
35097
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0
35085
35098
  });
35086
35099
  nativeHistoryError = void 0;
35087
35100
  nativeMessages = nativeHistory && Array.isArray(nativeHistory.messages) ? normalizeAndFilterNativeHistory(h, agentStr, args, nativeHistory.messages, nativeHistory.providerSessionId) : [];
@@ -35303,6 +35316,7 @@ async function handleReadChat(h, args) {
35303
35316
  scripts: provider?.scripts,
35304
35317
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
35305
35318
  envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
35319
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
35306
35320
  pinnedProviderSessionId: pinnedProviderSessionIdForHistory,
35307
35321
  // Last-resort only when no pin was ever recorded AND the
35308
35322
  // runtime fallback did not resolve a real provider session.
@@ -44973,12 +44987,24 @@ var CliProviderInstance = class _CliProviderInstance {
44973
44987
  }
44974
44988
  /**
44975
44989
  * Owner token for this session in the antigravity conversation-claim
44976
- * registry. Derived identically to the dispatcher's read-side token
44977
- * (workspace + spawn time) so the claims the dispatcher records under this
44978
- * session are the ones dispose() releases.
44990
+ * registry. Keyed on the daemon instance id — the SAME value the session
44991
+ * registry stores as this session's `sessionId` (see cli-manager
44992
+ * `sessionRegistry.register({ sessionId: cliInstance.instanceId })`) and the
44993
+ * read side hands the dispatcher as `instanceId`. Both sides therefore
44994
+ * derive the identical `iid:<instanceId>` token, so the claims the
44995
+ * dispatcher records under this session are exactly the ones dispose()
44996
+ * releases.
44997
+ *
44998
+ * This must NOT be derived from a spawn timestamp: the instance's
44999
+ * `startedAt`, the adapter's `spawnedAtMs`, and the session registry's
45000
+ * `spawnedAtMs` are three INDEPENDENT `Date.now()` samples for the one
45001
+ * session, so a workspace+spawn-time token computed here would never equal
45002
+ * the read side's — the claim isolation then silently collapses and two
45003
+ * concurrent antigravity sessions cross-bind each other's conversation .db
45004
+ * (coordinator+worker chat crosswire).
44979
45005
  */
44980
45006
  antigravityClaimOwner() {
44981
- return antigravityOwnerToken(this.workingDir, this.startedAt);
45007
+ return antigravityOwnerToken(this.workingDir, this.startedAt, this.instanceId);
44982
45008
  }
44983
45009
  dispose() {
44984
45010
  if (this.type === "antigravity-cli") {