@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.
@@ -114,6 +114,7 @@ export declare function readProviderChatHistory(agentType: string, options?: {
114
114
  sessionStartedAtMs?: number;
115
115
  envOverrides?: Record<string, string>;
116
116
  forceRefresh?: boolean;
117
+ instanceId?: string;
117
118
  }): {
118
119
  messages: HistoryMessage[];
119
120
  hasMore: boolean;
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 ? "cfb46b13fb8f556e4cb7179c4503ac3c86923d92" : void 0) ?? "unknown";
413
- const commitShort = readInjected(true ? "cfb46b13" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
- const version = readInjected(true ? "0.9.82-rc.474" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
- const builtAt = readInjected(true ? "2026-07-06T03:34:46.223Z" : void 0);
412
+ const commit = readInjected(true ? "c7b88fafbc63d3fc0de4b93c74facdb5145b8be6" : void 0) ?? "unknown";
413
+ const commitShort = readInjected(true ? "c7b88faf" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
414
+ const version = readInjected(true ? "0.9.82-rc.475" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
415
+ const builtAt = readInjected(true ? "2026-07-06T06:24:24.877Z" : void 0);
416
416
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
417
417
  return cached;
418
418
  }
@@ -32034,10 +32034,11 @@ function normalizeProviderNativeHistoryRecords(agentType, historySessionId, reco
32034
32034
  return sanitizeHistoryMessage(agentType, base);
32035
32035
  }).filter(Boolean);
32036
32036
  }
32037
- function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
32037
+ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
32038
32038
  const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "readSession");
32039
32039
  if (!fn) return null;
32040
32040
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
32041
+ const normalizedInstanceId = typeof instanceId === "string" ? instanceId.trim() : "";
32041
32042
  const result = fn({
32042
32043
  agentType,
32043
32044
  sessionId: normalizedSessionId,
@@ -32052,6 +32053,12 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
32052
32053
  // which leaves the guard disarmed so discovery still works.
32053
32054
  providerSessionId: normalizedSessionId,
32054
32055
  historySessionId: normalizedSessionId,
32056
+ // Stable per-session owner key for the antigravity conversation-claim
32057
+ // registry (see dispatcher.resolveAntigravityPath / antigravityOwnerToken).
32058
+ // Equals the session registry's sessionId and the provider instance's
32059
+ // instanceId, so read side and instance side derive the identical claim
32060
+ // owner token and two concurrent antigravity sessions never cross-bind.
32061
+ instanceId: normalizedInstanceId || void 0,
32055
32062
  workspace,
32056
32063
  format: canonicalHistory?.format,
32057
32064
  watchPath: canonicalHistory?.watchPath,
@@ -32059,7 +32066,7 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
32059
32066
  sessionStartedAtMs,
32060
32067
  envOverrides,
32061
32068
  forceRefresh: forceRefresh === true,
32062
- args: { sessionId: normalizedSessionId, historySessionId: normalizedSessionId, workspace, excludeInProgressTurn: excludeInProgressTurn === true, sessionStartedAtMs, envOverrides, forceRefresh: forceRefresh === true }
32069
+ args: { sessionId: normalizedSessionId, historySessionId: normalizedSessionId, instanceId: normalizedInstanceId || void 0, workspace, excludeInProgressTurn: excludeInProgressTurn === true, sessionStartedAtMs, envOverrides, forceRefresh: forceRefresh === true }
32063
32070
  });
32064
32071
  if (!result || typeof result !== "object") return null;
32065
32072
  const records = normalizeProviderNativeHistoryRecords(agentType, normalizedSessionId, result.messages || result.records);
@@ -32075,11 +32082,11 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
32075
32082
  unavailableReason: typeof result.unavailableReason === "string" ? result.unavailableReason.trim() : void 0
32076
32083
  };
32077
32084
  }
32078
- function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
32085
+ function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
32079
32086
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
32080
32087
  const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
32081
32088
  if (!canonicalHistory || !normalizedSessionId && !normalizedWorkspace || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
32082
- return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh);
32089
+ return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId);
32083
32090
  }
32084
32091
  function materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts) {
32085
32092
  const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
@@ -32108,7 +32115,7 @@ function isNativeSourceCanonicalHistory(canonicalHistory) {
32108
32115
  }
32109
32116
  function readProviderChatHistory(agentType, options = {}) {
32110
32117
  if (isNativeSourceCanonicalHistory(options.canonicalHistory) && (options.historySessionId || options.workspace)) {
32111
- const nativeResult = buildNativeHistoryReadResult(agentType, options.canonicalHistory, options.scripts, options.historySessionId, options.workspace, options.excludeInProgressTurn, options.sessionStartedAtMs, options.envOverrides, options.forceRefresh);
32118
+ const nativeResult = buildNativeHistoryReadResult(agentType, options.canonicalHistory, options.scripts, options.historySessionId, options.workspace, options.excludeInProgressTurn, options.sessionStartedAtMs, options.envOverrides, options.forceRefresh, options.instanceId);
32112
32119
  if (!nativeResult) return { messages: [], hasMore: false, source: "native-unavailable" };
32113
32120
  return {
32114
32121
  ...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
@@ -35043,7 +35050,8 @@ function readCliProviderNativeHistory(agentStr, args) {
35043
35050
  scripts: args.scripts,
35044
35051
  excludeInProgressTurn: args.excludeInProgressTurn,
35045
35052
  sessionStartedAtMs: args.sessionStartedAtMs,
35046
- envOverrides: args.envOverrides
35053
+ envOverrides: args.envOverrides,
35054
+ instanceId: args.instanceId
35047
35055
  });
35048
35056
  const boundProviderSessionId = typeof sessionHistory?.providerSessionId === "string" ? sessionHistory.providerSessionId.trim() : "";
35049
35057
  return {
@@ -35302,6 +35310,7 @@ async function handleChatHistory(h, args) {
35302
35310
  scripts: provider?.scripts,
35303
35311
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
35304
35312
  envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
35313
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
35305
35314
  pinnedProviderSessionId: getBoundProviderSessionIdPin(args?.targetSessionId)
35306
35315
  }) : readProviderChatHistory(agentStr, {
35307
35316
  canonicalHistory: provider?.nativeHistory,
@@ -35455,6 +35464,9 @@ async function handleReadChat(h, args) {
35455
35464
  excludeInProgressTurn: returnedStatus === "waiting_approval",
35456
35465
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
35457
35466
  envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
35467
+ // Stable per-session identity for antigravity's conversation-claim
35468
+ // owner token (== session registry sessionId == instance instanceId).
35469
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
35458
35470
  pinnedProviderSessionId: getBoundProviderSessionIdPin(targetSessionId),
35459
35471
  // Last-resort only when no pin was ever recorded for this
35460
35472
  // session; the downstream workspace-overlap safety gate
@@ -35504,7 +35516,8 @@ async function handleReadChat(h, args) {
35504
35516
  scripts: provider?.scripts,
35505
35517
  excludeInProgressTurn: returnedStatus === "waiting_approval",
35506
35518
  sessionStartedAtMs,
35507
- envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId)
35519
+ envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
35520
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0
35508
35521
  });
35509
35522
  nativeHistoryError = void 0;
35510
35523
  nativeMessages = nativeHistory && Array.isArray(nativeHistory.messages) ? normalizeAndFilterNativeHistory(h, agentStr, args, nativeHistory.messages, nativeHistory.providerSessionId) : [];
@@ -35726,6 +35739,7 @@ async function handleReadChat(h, args) {
35726
35739
  scripts: provider?.scripts,
35727
35740
  sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
35728
35741
  envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
35742
+ instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
35729
35743
  pinnedProviderSessionId: pinnedProviderSessionIdForHistory,
35730
35744
  // Last-resort only when no pin was ever recorded AND the
35731
35745
  // runtime fallback did not resolve a real provider session.
@@ -45396,12 +45410,24 @@ var CliProviderInstance = class _CliProviderInstance {
45396
45410
  }
45397
45411
  /**
45398
45412
  * Owner token for this session in the antigravity conversation-claim
45399
- * registry. Derived identically to the dispatcher's read-side token
45400
- * (workspace + spawn time) so the claims the dispatcher records under this
45401
- * session are the ones dispose() releases.
45413
+ * registry. Keyed on the daemon instance id — the SAME value the session
45414
+ * registry stores as this session's `sessionId` (see cli-manager
45415
+ * `sessionRegistry.register({ sessionId: cliInstance.instanceId })`) and the
45416
+ * read side hands the dispatcher as `instanceId`. Both sides therefore
45417
+ * derive the identical `iid:<instanceId>` token, so the claims the
45418
+ * dispatcher records under this session are exactly the ones dispose()
45419
+ * releases.
45420
+ *
45421
+ * This must NOT be derived from a spawn timestamp: the instance's
45422
+ * `startedAt`, the adapter's `spawnedAtMs`, and the session registry's
45423
+ * `spawnedAtMs` are three INDEPENDENT `Date.now()` samples for the one
45424
+ * session, so a workspace+spawn-time token computed here would never equal
45425
+ * the read side's — the claim isolation then silently collapses and two
45426
+ * concurrent antigravity sessions cross-bind each other's conversation .db
45427
+ * (coordinator+worker chat crosswire).
45402
45428
  */
45403
45429
  antigravityClaimOwner() {
45404
- return antigravityOwnerToken(this.workingDir, this.startedAt);
45430
+ return antigravityOwnerToken(this.workingDir, this.startedAt, this.instanceId);
45405
45431
  }
45406
45432
  dispose() {
45407
45433
  if (this.type === "antigravity-cli") {