@adhdev/daemon-core 0.9.82-rc.473 → 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/config/chat-history.d.ts +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +241 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +237 -69
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-missions.d.ts +55 -0
- package/dist/providers/cli-provider-instance.d.ts +15 -3
- package/package.json +3 -3
- package/src/commands/chat-commands-read.ts +14 -0
- package/src/config/chat-history.ts +19 -3
- package/src/index.ts +7 -2
- package/src/mesh/mesh-completion-synthesis.ts +19 -1
- package/src/mesh/mesh-events-stale.ts +13 -1
- package/src/mesh/mesh-missions.ts +127 -0
- package/src/providers/cli-provider-instance.ts +16 -4
- package/src/providers/native-history/antigravity-cli-transcript.ts +138 -56
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 ? "
|
|
408
|
-
const commitShort = readInjected(true ? "
|
|
409
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
410
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
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
|
}
|
|
@@ -9122,6 +9122,8 @@ var mesh_missions_exports = {};
|
|
|
9122
9122
|
__export(mesh_missions_exports, {
|
|
9123
9123
|
COMPACT_STATUS_GOAL_PREVIEW_MAX: () => COMPACT_STATUS_GOAL_PREVIEW_MAX,
|
|
9124
9124
|
GOAL_PREVIEW_MAX: () => GOAL_PREVIEW_MAX,
|
|
9125
|
+
MESH_MISSION_LIST_HISTORY_ID_LIMIT: () => MESH_MISSION_LIST_HISTORY_ID_LIMIT,
|
|
9126
|
+
MESH_MISSION_LIST_STATUS_LIMIT: () => MESH_MISSION_LIST_STATUS_LIMIT,
|
|
9125
9127
|
MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
|
|
9126
9128
|
buildMissionPromptSection: () => buildMissionPromptSection,
|
|
9127
9129
|
getActiveMeshMissionSummaries: () => getActiveMeshMissionSummaries,
|
|
@@ -9131,6 +9133,7 @@ __export(mesh_missions_exports, {
|
|
|
9131
9133
|
getMeshStatusMissionsCompact: () => getMeshStatusMissionsCompact,
|
|
9132
9134
|
isMissionAllTasksTerminal: () => isMissionAllTasksTerminal,
|
|
9133
9135
|
listMeshMissionSummaries: () => listMeshMissionSummaries,
|
|
9136
|
+
listMeshMissionsForTool: () => listMeshMissionsForTool,
|
|
9134
9137
|
maybeEmitMissionCloseCandidate: () => maybeEmitMissionCloseCandidate,
|
|
9135
9138
|
summarizeMeshMission: () => summarizeMeshMission,
|
|
9136
9139
|
summarizeMissionTasks: () => summarizeMissionTasks,
|
|
@@ -9364,6 +9367,61 @@ function listMeshMissionSummaries(meshId, options) {
|
|
|
9364
9367
|
const full = missions.map((mission) => summarizeMeshMission(meshId, mission));
|
|
9365
9368
|
return options?.verbose ? full : full.map((summary) => slimMissionSummary(summary));
|
|
9366
9369
|
}
|
|
9370
|
+
function listMeshMissionsForTool(meshId, options) {
|
|
9371
|
+
const explicitStatuses = options?.statuses && options.statuses.length > 0 ? options.statuses : void 0;
|
|
9372
|
+
const includeMagi = options?.includeMagi === true;
|
|
9373
|
+
const verbose = options?.verbose === true;
|
|
9374
|
+
const withStats = options?.withStats === true;
|
|
9375
|
+
const limit = Math.max(1, options?.limit ?? MESH_MISSION_LIST_STATUS_LIMIT);
|
|
9376
|
+
const historyIdLimit = Math.max(0, options?.historyIdLimit ?? MESH_MISSION_LIST_HISTORY_ID_LIMIT);
|
|
9377
|
+
const passesMagi = (m) => includeMagi || !(m.source === "magi" && m.status === "completed");
|
|
9378
|
+
const byUpdatedDesc = (a, b) => (b.updatedAt || "").localeCompare(a.updatedAt || "");
|
|
9379
|
+
const project = (mission) => {
|
|
9380
|
+
let summary = summarizeMeshMission(meshId, mission);
|
|
9381
|
+
if (withStats) {
|
|
9382
|
+
try {
|
|
9383
|
+
summary = { ...summary, stats: computeMeshMissionStats(meshId, mission.id) };
|
|
9384
|
+
} catch {
|
|
9385
|
+
}
|
|
9386
|
+
}
|
|
9387
|
+
return verbose ? summary : slimMissionSummary(summary);
|
|
9388
|
+
};
|
|
9389
|
+
const foldHistory = (history2) => {
|
|
9390
|
+
if (history2.length === 0) return null;
|
|
9391
|
+
const byStatus = {};
|
|
9392
|
+
for (const m of history2) byStatus[m.status] = (byStatus[m.status] ?? 0) + 1;
|
|
9393
|
+
return {
|
|
9394
|
+
count: history2.length,
|
|
9395
|
+
byStatus,
|
|
9396
|
+
missionIds: history2.slice(0, historyIdLimit).map((m) => m.id),
|
|
9397
|
+
note: 'Completed/abandoned missions are folded to counts + ids. Pass status (e.g. status:["completed"]) to list them in detail.'
|
|
9398
|
+
};
|
|
9399
|
+
};
|
|
9400
|
+
if (explicitStatuses) {
|
|
9401
|
+
const matched = getMeshMissions(meshId, explicitStatuses).filter(passesMagi).sort(byUpdatedDesc);
|
|
9402
|
+
const shown2 = matched.slice(0, limit);
|
|
9403
|
+
const overflow2 = matched.slice(limit);
|
|
9404
|
+
return {
|
|
9405
|
+
missions: shown2.map(project),
|
|
9406
|
+
historyFold: null,
|
|
9407
|
+
truncated: overflow2.length > 0,
|
|
9408
|
+
matched: matched.length,
|
|
9409
|
+
...overflow2.length > 0 ? { overflowIds: overflow2.map((m) => m.id) } : {}
|
|
9410
|
+
};
|
|
9411
|
+
}
|
|
9412
|
+
const all = getMeshMissions(meshId).filter(passesMagi);
|
|
9413
|
+
const live = all.filter((m) => m.status === "active" || m.status === "paused").sort(byUpdatedDesc);
|
|
9414
|
+
const history = all.filter((m) => m.status === "completed" || m.status === "abandoned").sort(byUpdatedDesc);
|
|
9415
|
+
const shown = live.slice(0, limit);
|
|
9416
|
+
const overflow = live.slice(limit);
|
|
9417
|
+
return {
|
|
9418
|
+
missions: shown.map(project),
|
|
9419
|
+
historyFold: foldHistory(history),
|
|
9420
|
+
truncated: overflow.length > 0,
|
|
9421
|
+
matched: live.length,
|
|
9422
|
+
...overflow.length > 0 ? { overflowIds: overflow.map((m) => m.id) } : {}
|
|
9423
|
+
};
|
|
9424
|
+
}
|
|
9367
9425
|
function buildMissionPromptSection(meshId) {
|
|
9368
9426
|
const summaries = getActiveMeshMissionSummaries(meshId);
|
|
9369
9427
|
if (summaries.length === 0) return "";
|
|
@@ -9382,7 +9440,7 @@ function buildMissionPromptSection(meshId) {
|
|
|
9382
9440
|
);
|
|
9383
9441
|
return lines.join("\n");
|
|
9384
9442
|
}
|
|
9385
|
-
var LEDGER_GOAL_SUMMARY_MAX, MESH_MISSION_STATUSES, GOAL_PREVIEW_MAX, COMPACT_STATUS_GOAL_PREVIEW_MAX;
|
|
9443
|
+
var LEDGER_GOAL_SUMMARY_MAX, MESH_MISSION_STATUSES, GOAL_PREVIEW_MAX, COMPACT_STATUS_GOAL_PREVIEW_MAX, MESH_MISSION_LIST_HISTORY_ID_LIMIT, MESH_MISSION_LIST_STATUS_LIMIT;
|
|
9386
9444
|
var init_mesh_missions = __esm({
|
|
9387
9445
|
"src/mesh/mesh-missions.ts"() {
|
|
9388
9446
|
"use strict";
|
|
@@ -9396,6 +9454,8 @@ var init_mesh_missions = __esm({
|
|
|
9396
9454
|
MESH_MISSION_STATUSES = ["active", "paused", "completed", "abandoned"];
|
|
9397
9455
|
GOAL_PREVIEW_MAX = 120;
|
|
9398
9456
|
COMPACT_STATUS_GOAL_PREVIEW_MAX = 80;
|
|
9457
|
+
MESH_MISSION_LIST_HISTORY_ID_LIMIT = 30;
|
|
9458
|
+
MESH_MISSION_LIST_STATUS_LIMIT = 50;
|
|
9399
9459
|
}
|
|
9400
9460
|
});
|
|
9401
9461
|
|
|
@@ -12878,6 +12938,7 @@ function reconcileDirectDispatchCompletionFromTranscript(args) {
|
|
|
12878
12938
|
}
|
|
12879
12939
|
};
|
|
12880
12940
|
const targetCoordinatorSessionId = readNonEmptyString2(args.targetCoordinatorSessionId) || readNonEmptyString2(dispatch?.payload?.coordinatorSessionId);
|
|
12941
|
+
const targetCoordinatorDaemonId = readNonEmptyString2(dispatch?.payload?.coordinatorDaemonId) || readNonEmptyString2(args.targetCoordinatorDaemonId);
|
|
12881
12942
|
queuePendingMeshCoordinatorEvent({
|
|
12882
12943
|
event: eventName,
|
|
12883
12944
|
meshId: args.meshId,
|
|
@@ -12886,7 +12947,7 @@ function reconcileDirectDispatchCompletionFromTranscript(args) {
|
|
|
12886
12947
|
metadataEvent,
|
|
12887
12948
|
coordinatorMessage: buildMeshSystemMessage({ event: eventName, nodeLabel, metadataEvent }),
|
|
12888
12949
|
queuedAt: Date.now(),
|
|
12889
|
-
...
|
|
12950
|
+
...targetCoordinatorDaemonId ? { targetCoordinatorDaemonId } : {},
|
|
12890
12951
|
...targetCoordinatorSessionId ? { targetCoordinatorSessionId } : {}
|
|
12891
12952
|
});
|
|
12892
12953
|
recordSynthCompletionGateTrace("synth-fire", {
|
|
@@ -20617,7 +20678,11 @@ async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds,
|
|
|
20617
20678
|
continue;
|
|
20618
20679
|
}
|
|
20619
20680
|
const providerSessionId = readNonEmptyString2(payload.providerSessionId);
|
|
20620
|
-
const
|
|
20681
|
+
const workerSession = components.instanceManager.getInstance(sessionId);
|
|
20682
|
+
const workerCoordinatorDaemonId = readNonEmptyString2(
|
|
20683
|
+
workerSession?.getState()?.settings?.meshCoordinatorDaemonId
|
|
20684
|
+
);
|
|
20685
|
+
const coordinatorDaemonId = workerCoordinatorDaemonId || selfIds.find((id) => !!id);
|
|
20621
20686
|
try {
|
|
20622
20687
|
const result = reconcileDirectDispatchCompletionFromTranscript({
|
|
20623
20688
|
meshId: mesh.id,
|
|
@@ -20628,6 +20693,8 @@ async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds,
|
|
|
20628
20693
|
taskId,
|
|
20629
20694
|
finalSummary: evidence.finalSummary,
|
|
20630
20695
|
...evidence.transcriptMessageAt ? { transcriptMessageAt: evidence.transcriptMessageAt } : {},
|
|
20696
|
+
// The ledger-recovered dispatching-coordinator daemon (inside the reconcile fn)
|
|
20697
|
+
// takes PRIORITY over this arg; this remains the best-available fallback.
|
|
20631
20698
|
...coordinatorDaemonId ? { targetCoordinatorDaemonId: coordinatorDaemonId } : {},
|
|
20632
20699
|
source: "daemon_reconcile_transcript_completion"
|
|
20633
20700
|
});
|
|
@@ -28416,6 +28483,7 @@ init_mesh_magi_status();
|
|
|
28416
28483
|
init_mesh_scheduling_runtime();
|
|
28417
28484
|
init_mesh_host_ownership();
|
|
28418
28485
|
init_mesh_events();
|
|
28486
|
+
init_contracts();
|
|
28419
28487
|
init_mesh_events_utils();
|
|
28420
28488
|
init_mesh_delivery_policy();
|
|
28421
28489
|
|
|
@@ -31543,10 +31611,11 @@ function normalizeProviderNativeHistoryRecords(agentType, historySessionId, reco
|
|
|
31543
31611
|
return sanitizeHistoryMessage(agentType, base);
|
|
31544
31612
|
}).filter(Boolean);
|
|
31545
31613
|
}
|
|
31546
|
-
function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
|
|
31614
|
+
function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
|
|
31547
31615
|
const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "readSession");
|
|
31548
31616
|
if (!fn) return null;
|
|
31549
31617
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
|
|
31618
|
+
const normalizedInstanceId = typeof instanceId === "string" ? instanceId.trim() : "";
|
|
31550
31619
|
const result = fn({
|
|
31551
31620
|
agentType,
|
|
31552
31621
|
sessionId: normalizedSessionId,
|
|
@@ -31561,6 +31630,12 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
|
|
|
31561
31630
|
// which leaves the guard disarmed so discovery still works.
|
|
31562
31631
|
providerSessionId: normalizedSessionId,
|
|
31563
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,
|
|
31564
31639
|
workspace,
|
|
31565
31640
|
format: canonicalHistory?.format,
|
|
31566
31641
|
watchPath: canonicalHistory?.watchPath,
|
|
@@ -31568,7 +31643,7 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
|
|
|
31568
31643
|
sessionStartedAtMs,
|
|
31569
31644
|
envOverrides,
|
|
31570
31645
|
forceRefresh: forceRefresh === true,
|
|
31571
|
-
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 }
|
|
31572
31647
|
});
|
|
31573
31648
|
if (!result || typeof result !== "object") return null;
|
|
31574
31649
|
const records = normalizeProviderNativeHistoryRecords(agentType, normalizedSessionId, result.messages || result.records);
|
|
@@ -31584,11 +31659,11 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
|
|
|
31584
31659
|
unavailableReason: typeof result.unavailableReason === "string" ? result.unavailableReason.trim() : void 0
|
|
31585
31660
|
};
|
|
31586
31661
|
}
|
|
31587
|
-
function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
|
|
31662
|
+
function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
|
|
31588
31663
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
|
|
31589
31664
|
const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
|
|
31590
31665
|
if (!canonicalHistory || !normalizedSessionId && !normalizedWorkspace || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
|
|
31591
|
-
return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh);
|
|
31666
|
+
return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId);
|
|
31592
31667
|
}
|
|
31593
31668
|
function materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts) {
|
|
31594
31669
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
@@ -31617,7 +31692,7 @@ function isNativeSourceCanonicalHistory(canonicalHistory) {
|
|
|
31617
31692
|
}
|
|
31618
31693
|
function readProviderChatHistory(agentType, options = {}) {
|
|
31619
31694
|
if (isNativeSourceCanonicalHistory(options.canonicalHistory) && (options.historySessionId || options.workspace)) {
|
|
31620
|
-
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);
|
|
31621
31696
|
if (!nativeResult) return { messages: [], hasMore: false, source: "native-unavailable" };
|
|
31622
31697
|
return {
|
|
31623
31698
|
...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
|
|
@@ -34552,7 +34627,8 @@ function readCliProviderNativeHistory(agentStr, args) {
|
|
|
34552
34627
|
scripts: args.scripts,
|
|
34553
34628
|
excludeInProgressTurn: args.excludeInProgressTurn,
|
|
34554
34629
|
sessionStartedAtMs: args.sessionStartedAtMs,
|
|
34555
|
-
envOverrides: args.envOverrides
|
|
34630
|
+
envOverrides: args.envOverrides,
|
|
34631
|
+
instanceId: args.instanceId
|
|
34556
34632
|
});
|
|
34557
34633
|
const boundProviderSessionId = typeof sessionHistory?.providerSessionId === "string" ? sessionHistory.providerSessionId.trim() : "";
|
|
34558
34634
|
return {
|
|
@@ -34811,6 +34887,7 @@ async function handleChatHistory(h, args) {
|
|
|
34811
34887
|
scripts: provider?.scripts,
|
|
34812
34888
|
sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
|
|
34813
34889
|
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
|
|
34890
|
+
instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
|
|
34814
34891
|
pinnedProviderSessionId: getBoundProviderSessionIdPin(args?.targetSessionId)
|
|
34815
34892
|
}) : readProviderChatHistory(agentStr, {
|
|
34816
34893
|
canonicalHistory: provider?.nativeHistory,
|
|
@@ -34964,6 +35041,9 @@ async function handleReadChat(h, args) {
|
|
|
34964
35041
|
excludeInProgressTurn: returnedStatus === "waiting_approval",
|
|
34965
35042
|
sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
|
|
34966
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,
|
|
34967
35047
|
pinnedProviderSessionId: getBoundProviderSessionIdPin(targetSessionId),
|
|
34968
35048
|
// Last-resort only when no pin was ever recorded for this
|
|
34969
35049
|
// session; the downstream workspace-overlap safety gate
|
|
@@ -35013,7 +35093,8 @@ async function handleReadChat(h, args) {
|
|
|
35013
35093
|
scripts: provider?.scripts,
|
|
35014
35094
|
excludeInProgressTurn: returnedStatus === "waiting_approval",
|
|
35015
35095
|
sessionStartedAtMs,
|
|
35016
|
-
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId)
|
|
35096
|
+
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
|
|
35097
|
+
instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0
|
|
35017
35098
|
});
|
|
35018
35099
|
nativeHistoryError = void 0;
|
|
35019
35100
|
nativeMessages = nativeHistory && Array.isArray(nativeHistory.messages) ? normalizeAndFilterNativeHistory(h, agentStr, args, nativeHistory.messages, nativeHistory.providerSessionId) : [];
|
|
@@ -35235,6 +35316,7 @@ async function handleReadChat(h, args) {
|
|
|
35235
35316
|
scripts: provider?.scripts,
|
|
35236
35317
|
sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
|
|
35237
35318
|
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
|
|
35319
|
+
instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
|
|
35238
35320
|
pinnedProviderSessionId: pinnedProviderSessionIdForHistory,
|
|
35239
35321
|
// Last-resort only when no pin was ever recorded AND the
|
|
35240
35322
|
// runtime fallback did not resolve a real provider session.
|
|
@@ -44905,12 +44987,24 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
44905
44987
|
}
|
|
44906
44988
|
/**
|
|
44907
44989
|
* Owner token for this session in the antigravity conversation-claim
|
|
44908
|
-
* registry.
|
|
44909
|
-
*
|
|
44910
|
-
*
|
|
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).
|
|
44911
45005
|
*/
|
|
44912
45006
|
antigravityClaimOwner() {
|
|
44913
|
-
return antigravityOwnerToken(this.workingDir, this.startedAt);
|
|
45007
|
+
return antigravityOwnerToken(this.workingDir, this.startedAt, this.instanceId);
|
|
44914
45008
|
}
|
|
44915
45009
|
dispose() {
|
|
44916
45010
|
if (this.type === "antigravity-cli") {
|
|
@@ -50034,6 +50128,35 @@ function historyJsonlPath() {
|
|
|
50034
50128
|
function brainRoot() {
|
|
50035
50129
|
return path32.join(antigravityRoot(), "brain");
|
|
50036
50130
|
}
|
|
50131
|
+
function conversationsRoot() {
|
|
50132
|
+
return path32.join(antigravityRoot(), "conversations");
|
|
50133
|
+
}
|
|
50134
|
+
function resolvePathInside(root, ...segments) {
|
|
50135
|
+
const rootPath = path32.resolve(root);
|
|
50136
|
+
const targetPath = path32.resolve(rootPath, ...segments);
|
|
50137
|
+
if (targetPath !== rootPath && !targetPath.startsWith(rootPath + path32.sep)) return null;
|
|
50138
|
+
return targetPath;
|
|
50139
|
+
}
|
|
50140
|
+
function findBrainTranscriptPath(sessionId) {
|
|
50141
|
+
if (!isUuidLike(sessionId)) return null;
|
|
50142
|
+
const logsRoot = resolvePathInside(brainRoot(), sessionId, ".system_generated", "logs");
|
|
50143
|
+
if (!logsRoot || !fs24.existsSync(logsRoot)) return null;
|
|
50144
|
+
const candidates = ["transcript_full.jsonl", "transcript.jsonl"].map((file) => resolvePathInside(logsRoot, file)).filter((p) => p !== null && fs24.existsSync(p));
|
|
50145
|
+
if (candidates.length === 0) {
|
|
50146
|
+
let entries = [];
|
|
50147
|
+
try {
|
|
50148
|
+
entries = fs24.readdirSync(logsRoot, { withFileTypes: true });
|
|
50149
|
+
} catch {
|
|
50150
|
+
return null;
|
|
50151
|
+
}
|
|
50152
|
+
const transcriptFiles = entries.filter((e) => e.isFile() && /^transcript.*\.jsonl$/.test(e.name)).map((e) => path32.join(logsRoot, e.name));
|
|
50153
|
+
if (transcriptFiles.length === 0) return null;
|
|
50154
|
+
transcriptFiles.sort((a, b) => statMtimeMs3(b) - statMtimeMs3(a));
|
|
50155
|
+
return transcriptFiles[0];
|
|
50156
|
+
}
|
|
50157
|
+
candidates.sort((a, b) => statMtimeMs3(b) - statMtimeMs3(a));
|
|
50158
|
+
return candidates[0];
|
|
50159
|
+
}
|
|
50037
50160
|
function extractUserRequestContent(content) {
|
|
50038
50161
|
const raw = content.trim();
|
|
50039
50162
|
const match = raw.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/i);
|
|
@@ -50444,6 +50567,83 @@ function parseConversationDb(filePath, sessionId, workspace) {
|
|
|
50444
50567
|
}
|
|
50445
50568
|
return messages.length > 0 ? messages : null;
|
|
50446
50569
|
}
|
|
50570
|
+
function readHistoryJsonlSession(resolvedSessionId, workspace) {
|
|
50571
|
+
if (!isUuidLike(resolvedSessionId)) return null;
|
|
50572
|
+
const rows = readHistoryRows().filter((r) => r.conversationId === resolvedSessionId);
|
|
50573
|
+
if (rows.length === 0) return null;
|
|
50574
|
+
rows.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
50575
|
+
const firstWorkspace = workspace || rows.find((r) => r.workspace)?.workspace || "";
|
|
50576
|
+
const messages = [];
|
|
50577
|
+
if (firstWorkspace) {
|
|
50578
|
+
messages.push({
|
|
50579
|
+
ts: new Date(rows[0].receivedAt).toISOString(),
|
|
50580
|
+
receivedAt: rows[0].receivedAt,
|
|
50581
|
+
role: "system",
|
|
50582
|
+
content: firstWorkspace,
|
|
50583
|
+
kind: "session_start",
|
|
50584
|
+
agent: "antigravity-cli",
|
|
50585
|
+
historySessionId: resolvedSessionId,
|
|
50586
|
+
workspace: firstWorkspace
|
|
50587
|
+
});
|
|
50588
|
+
}
|
|
50589
|
+
for (const row of rows) {
|
|
50590
|
+
const msg = {
|
|
50591
|
+
ts: new Date(row.receivedAt).toISOString(),
|
|
50592
|
+
receivedAt: row.receivedAt,
|
|
50593
|
+
role: "user",
|
|
50594
|
+
content: row.display,
|
|
50595
|
+
kind: "standard",
|
|
50596
|
+
agent: "antigravity-cli",
|
|
50597
|
+
historySessionId: resolvedSessionId
|
|
50598
|
+
};
|
|
50599
|
+
if (row.workspace) msg.workspace = row.workspace;
|
|
50600
|
+
messages.push(msg);
|
|
50601
|
+
}
|
|
50602
|
+
return {
|
|
50603
|
+
messages,
|
|
50604
|
+
providerSessionId: resolvedSessionId,
|
|
50605
|
+
source: "provider-native",
|
|
50606
|
+
sourcePath: historyJsonlPath(),
|
|
50607
|
+
sourceMtimeMs: statMtimeMs3(historyJsonlPath()),
|
|
50608
|
+
nativeHistoryCoverage: "partial",
|
|
50609
|
+
partialReason: "antigravity_cli_history_jsonl_contains_user_prompts_only"
|
|
50610
|
+
};
|
|
50611
|
+
}
|
|
50612
|
+
function readAntigravitySiblingFallback(sessionId, workspace) {
|
|
50613
|
+
if (!isUuidLike(sessionId)) return null;
|
|
50614
|
+
const brainPath = findBrainTranscriptPath(sessionId);
|
|
50615
|
+
if (brainPath && statMtimeMs3(brainPath) > 0) {
|
|
50616
|
+
const brainMessages = parseBrainTranscript(brainPath, sessionId, workspace);
|
|
50617
|
+
if (brainMessages && brainMessages.length > 0) {
|
|
50618
|
+
return {
|
|
50619
|
+
messages: brainMessages,
|
|
50620
|
+
providerSessionId: sessionId,
|
|
50621
|
+
source: "provider-native",
|
|
50622
|
+
sourcePath: brainPath,
|
|
50623
|
+
sourceMtimeMs: statMtimeMs3(brainPath),
|
|
50624
|
+
nativeHistoryCoverage: "full",
|
|
50625
|
+
workspace
|
|
50626
|
+
};
|
|
50627
|
+
}
|
|
50628
|
+
}
|
|
50629
|
+
const pbPath = resolvePathInside(conversationsRoot(), `${sessionId}.pb`);
|
|
50630
|
+
if (pbPath && fs24.existsSync(pbPath)) {
|
|
50631
|
+
const pbMessages = parsePbFile(pbPath, sessionId);
|
|
50632
|
+
if (pbMessages && pbMessages.length > 0) {
|
|
50633
|
+
return {
|
|
50634
|
+
messages: pbMessages,
|
|
50635
|
+
providerSessionId: sessionId,
|
|
50636
|
+
source: "provider-native",
|
|
50637
|
+
sourcePath: pbPath,
|
|
50638
|
+
sourceMtimeMs: statMtimeMs3(pbPath),
|
|
50639
|
+
nativeHistoryCoverage: "best-effort",
|
|
50640
|
+
partialReason: "antigravity_cli_pb_raw_text_extraction",
|
|
50641
|
+
workspace
|
|
50642
|
+
};
|
|
50643
|
+
}
|
|
50644
|
+
}
|
|
50645
|
+
return readHistoryJsonlSession(sessionId, workspace);
|
|
50646
|
+
}
|
|
50447
50647
|
function readSession3(sessionPath, sessionId, workspace) {
|
|
50448
50648
|
if (!sessionPath || !path32.isAbsolute(sessionPath)) return null;
|
|
50449
50649
|
if (!fs24.existsSync(sessionPath)) return null;
|
|
@@ -50470,16 +50670,20 @@ function readSession3(sessionPath, sessionId, workspace) {
|
|
|
50470
50670
|
const dbSessionId = sessionId || path32.basename(sessionPath, ".db");
|
|
50471
50671
|
if (!isUuidLike(dbSessionId)) return null;
|
|
50472
50672
|
const messages = parseConversationDb(sessionPath, dbSessionId, workspace);
|
|
50473
|
-
if (
|
|
50474
|
-
|
|
50475
|
-
|
|
50476
|
-
|
|
50477
|
-
|
|
50478
|
-
|
|
50479
|
-
|
|
50480
|
-
|
|
50481
|
-
|
|
50482
|
-
|
|
50673
|
+
if (messages && messages.length > 0) {
|
|
50674
|
+
return {
|
|
50675
|
+
messages,
|
|
50676
|
+
providerSessionId: dbSessionId,
|
|
50677
|
+
source: "provider-native",
|
|
50678
|
+
sourcePath: sessionPath,
|
|
50679
|
+
sourceMtimeMs,
|
|
50680
|
+
nativeHistoryCoverage: "full",
|
|
50681
|
+
workspace
|
|
50682
|
+
};
|
|
50683
|
+
}
|
|
50684
|
+
const siblingFallback = readAntigravitySiblingFallback(dbSessionId, workspace);
|
|
50685
|
+
if (siblingFallback) return siblingFallback;
|
|
50686
|
+
return null;
|
|
50483
50687
|
}
|
|
50484
50688
|
if (sessionPath.endsWith(".pb")) {
|
|
50485
50689
|
const pbSessionId = sessionId || path32.basename(sessionPath, ".pb");
|
|
@@ -50497,47 +50701,7 @@ function readSession3(sessionPath, sessionId, workspace) {
|
|
|
50497
50701
|
};
|
|
50498
50702
|
}
|
|
50499
50703
|
if (path32.basename(sessionPath) === "history.jsonl") {
|
|
50500
|
-
|
|
50501
|
-
if (!resolvedSessionId || !isUuidLike(resolvedSessionId)) return null;
|
|
50502
|
-
const rows = readHistoryRows().filter((r) => r.conversationId === resolvedSessionId);
|
|
50503
|
-
if (rows.length === 0) return null;
|
|
50504
|
-
rows.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
50505
|
-
const firstWorkspace = workspace || rows.find((r) => r.workspace)?.workspace || "";
|
|
50506
|
-
const messages = [];
|
|
50507
|
-
if (firstWorkspace) {
|
|
50508
|
-
messages.push({
|
|
50509
|
-
ts: new Date(rows[0].receivedAt).toISOString(),
|
|
50510
|
-
receivedAt: rows[0].receivedAt,
|
|
50511
|
-
role: "system",
|
|
50512
|
-
content: firstWorkspace,
|
|
50513
|
-
kind: "session_start",
|
|
50514
|
-
agent: "antigravity-cli",
|
|
50515
|
-
historySessionId: resolvedSessionId,
|
|
50516
|
-
workspace: firstWorkspace
|
|
50517
|
-
});
|
|
50518
|
-
}
|
|
50519
|
-
for (const row of rows) {
|
|
50520
|
-
const msg = {
|
|
50521
|
-
ts: new Date(row.receivedAt).toISOString(),
|
|
50522
|
-
receivedAt: row.receivedAt,
|
|
50523
|
-
role: "user",
|
|
50524
|
-
content: row.display,
|
|
50525
|
-
kind: "standard",
|
|
50526
|
-
agent: "antigravity-cli",
|
|
50527
|
-
historySessionId: resolvedSessionId
|
|
50528
|
-
};
|
|
50529
|
-
if (row.workspace) msg.workspace = row.workspace;
|
|
50530
|
-
messages.push(msg);
|
|
50531
|
-
}
|
|
50532
|
-
return {
|
|
50533
|
-
messages,
|
|
50534
|
-
providerSessionId: resolvedSessionId,
|
|
50535
|
-
source: "provider-native",
|
|
50536
|
-
sourcePath: sessionPath,
|
|
50537
|
-
sourceMtimeMs,
|
|
50538
|
-
nativeHistoryCoverage: "partial",
|
|
50539
|
-
partialReason: "antigravity_cli_history_jsonl_contains_user_prompts_only"
|
|
50540
|
-
};
|
|
50704
|
+
return readHistoryJsonlSession(sessionId || "", workspace);
|
|
50541
50705
|
}
|
|
50542
50706
|
return null;
|
|
50543
50707
|
}
|
|
@@ -68814,6 +68978,8 @@ export {
|
|
|
68814
68978
|
MESH_CONVERGE_REFINE_TAG,
|
|
68815
68979
|
MESH_MAX_PARALLEL_TASKS_MAX,
|
|
68816
68980
|
MESH_MAX_PARALLEL_TASKS_MIN,
|
|
68981
|
+
MESH_MISSION_LIST_HISTORY_ID_LIMIT,
|
|
68982
|
+
MESH_MISSION_LIST_STATUS_LIMIT,
|
|
68817
68983
|
MESH_MISSION_STATUSES,
|
|
68818
68984
|
MESH_NODE_LIVE_TRUTH_MARKER,
|
|
68819
68985
|
MESH_REFINE_CONFIG_LOCATIONS,
|
|
@@ -68903,6 +69069,7 @@ export {
|
|
|
68903
69069
|
computeMeshTaskStats,
|
|
68904
69070
|
configureDebugTraceStore,
|
|
68905
69071
|
connectCdpManager,
|
|
69072
|
+
coordinatorIdentityFromEmitFields,
|
|
68906
69073
|
createDebugTraceStore,
|
|
68907
69074
|
createDefaultGitCommandServices,
|
|
68908
69075
|
createDefaultMeshHostMetadata,
|
|
@@ -69019,6 +69186,7 @@ export {
|
|
|
69019
69186
|
listMagiKindPanels,
|
|
69020
69187
|
listMagiPanels,
|
|
69021
69188
|
listMeshMissionSummaries,
|
|
69189
|
+
listMeshMissionsForTool,
|
|
69022
69190
|
listMeshes,
|
|
69023
69191
|
listWorktrees,
|
|
69024
69192
|
loadChangeImpactConfig,
|