@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
|
@@ -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.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ export { normalizeMeshNodeId, meshNodeIdMatches } from '@adhdev/mesh-shared';
|
|
|
37
37
|
export { CANONICAL_MESH_TOOL_NAMES, CANONICAL_MESH_TOOL_COUNT } from '@adhdev/mesh-shared';
|
|
38
38
|
export type { CanonicalMeshToolName } from '@adhdev/mesh-shared';
|
|
39
39
|
export { buildCoordinatorSystemPrompt } from './mesh/coordinator-prompt.js';
|
|
40
|
-
export { upsertMeshMission, getMeshMissions, getMeshMission, summarizeMissionTasks, summarizeMeshMission, getActiveMeshMissionSummaries, getMeshStatusMissionSummaries, getMeshStatusMissionsCompact, listMeshMissionSummaries, buildMissionPromptSection, GOAL_PREVIEW_MAX, COMPACT_STATUS_GOAL_PREVIEW_MAX, MESH_MISSION_STATUSES } from './mesh/mesh-missions.js';
|
|
41
|
-
export type { MeshMissionRecord, MeshMissionStatus, MeshMissionSummary, MeshMissionSlimSummary, MeshMissionTaskAggregate, MeshStatusMissionsCompact, MeshStatusMissionsHistoryFold } from './mesh/mesh-missions.js';
|
|
40
|
+
export { upsertMeshMission, getMeshMissions, getMeshMission, summarizeMissionTasks, summarizeMeshMission, getActiveMeshMissionSummaries, getMeshStatusMissionSummaries, getMeshStatusMissionsCompact, listMeshMissionSummaries, listMeshMissionsForTool, buildMissionPromptSection, GOAL_PREVIEW_MAX, COMPACT_STATUS_GOAL_PREVIEW_MAX, MESH_MISSION_LIST_HISTORY_ID_LIMIT, MESH_MISSION_LIST_STATUS_LIMIT, MESH_MISSION_STATUSES } from './mesh/mesh-missions.js';
|
|
41
|
+
export type { MeshMissionRecord, MeshMissionStatus, MeshMissionSummary, MeshMissionSlimSummary, MeshMissionTaskAggregate, MeshStatusMissionsCompact, MeshStatusMissionsHistoryFold, MeshMissionListResult } from './mesh/mesh-missions.js';
|
|
42
42
|
export { computeMeshTaskStats, computeMeshMissionStats } from './mesh/mesh-task-stats.js';
|
|
43
43
|
export type { MeshTaskStats, MeshMissionStats } from './mesh/mesh-task-stats.js';
|
|
44
44
|
export { deriveMeshReviewInboxItems } from './mesh/mesh-review-inbox.js';
|
|
@@ -71,6 +71,8 @@ export type { MeshSchedulingRuntime, MeshNodeSchedulingRuntime, MeshNodeProvider
|
|
|
71
71
|
export { buildMeshHostRequiredFailure, createDefaultMeshHostMetadata, isMeshHostOwner, normalizeMeshDaemonRole, requireMeshHostQueueOwner, resolveMeshHostStatus } from './mesh/mesh-host-ownership.js';
|
|
72
72
|
export { triggerMeshQueue, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, queuePendingMeshCoordinatorEvent, requeueHeldMeshCoordinatorEvents, serializeV2EnvelopeToWire, readV2EnvelopeFromWire, reconcileDirectDispatchCompletionFromTranscript } from './mesh/mesh-events.js';
|
|
73
73
|
export type { PendingMeshCoordinatorEvent, MeshHeldEventRequeueFilter, MeshHeldEventRequeueResult } from './mesh/mesh-events.js';
|
|
74
|
+
export { coordinatorIdentityFromEmitFields } from './mesh/contracts.js';
|
|
75
|
+
export type { CoordinatorIdentity } from './mesh/contracts.js';
|
|
74
76
|
export { resolveMeshSurfacedSessionPreview, readMeshCompletionSummary, isWeakCompletionEvidence } from './mesh/mesh-events-utils.js';
|
|
75
77
|
export { resolveDeliveryDecision, createSessionDelivery, updateSessionDeliveryStatus, getActiveSessionDeliveries, markSessionDeliveriesTerminal } from './mesh/mesh-delivery-policy.js';
|
|
76
78
|
export type { MeshSessionDeliveryStatus, MeshSessionDeliveryKind, MeshDeliveryDecision, MeshDeliveryPolicyResult, SessionDeliveryRecord } from './mesh/mesh-delivery-policy.js';
|
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 ? "
|
|
413
|
-
const commitShort = readInjected(true ? "
|
|
414
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
415
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
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
|
}
|
|
@@ -9129,6 +9129,8 @@ var mesh_missions_exports = {};
|
|
|
9129
9129
|
__export(mesh_missions_exports, {
|
|
9130
9130
|
COMPACT_STATUS_GOAL_PREVIEW_MAX: () => COMPACT_STATUS_GOAL_PREVIEW_MAX,
|
|
9131
9131
|
GOAL_PREVIEW_MAX: () => GOAL_PREVIEW_MAX,
|
|
9132
|
+
MESH_MISSION_LIST_HISTORY_ID_LIMIT: () => MESH_MISSION_LIST_HISTORY_ID_LIMIT,
|
|
9133
|
+
MESH_MISSION_LIST_STATUS_LIMIT: () => MESH_MISSION_LIST_STATUS_LIMIT,
|
|
9132
9134
|
MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
|
|
9133
9135
|
buildMissionPromptSection: () => buildMissionPromptSection,
|
|
9134
9136
|
getActiveMeshMissionSummaries: () => getActiveMeshMissionSummaries,
|
|
@@ -9138,6 +9140,7 @@ __export(mesh_missions_exports, {
|
|
|
9138
9140
|
getMeshStatusMissionsCompact: () => getMeshStatusMissionsCompact,
|
|
9139
9141
|
isMissionAllTasksTerminal: () => isMissionAllTasksTerminal,
|
|
9140
9142
|
listMeshMissionSummaries: () => listMeshMissionSummaries,
|
|
9143
|
+
listMeshMissionsForTool: () => listMeshMissionsForTool,
|
|
9141
9144
|
maybeEmitMissionCloseCandidate: () => maybeEmitMissionCloseCandidate,
|
|
9142
9145
|
summarizeMeshMission: () => summarizeMeshMission,
|
|
9143
9146
|
summarizeMissionTasks: () => summarizeMissionTasks,
|
|
@@ -9370,6 +9373,61 @@ function listMeshMissionSummaries(meshId, options) {
|
|
|
9370
9373
|
const full = missions.map((mission) => summarizeMeshMission(meshId, mission));
|
|
9371
9374
|
return options?.verbose ? full : full.map((summary) => slimMissionSummary(summary));
|
|
9372
9375
|
}
|
|
9376
|
+
function listMeshMissionsForTool(meshId, options) {
|
|
9377
|
+
const explicitStatuses = options?.statuses && options.statuses.length > 0 ? options.statuses : void 0;
|
|
9378
|
+
const includeMagi = options?.includeMagi === true;
|
|
9379
|
+
const verbose = options?.verbose === true;
|
|
9380
|
+
const withStats = options?.withStats === true;
|
|
9381
|
+
const limit = Math.max(1, options?.limit ?? MESH_MISSION_LIST_STATUS_LIMIT);
|
|
9382
|
+
const historyIdLimit = Math.max(0, options?.historyIdLimit ?? MESH_MISSION_LIST_HISTORY_ID_LIMIT);
|
|
9383
|
+
const passesMagi = (m) => includeMagi || !(m.source === "magi" && m.status === "completed");
|
|
9384
|
+
const byUpdatedDesc = (a, b) => (b.updatedAt || "").localeCompare(a.updatedAt || "");
|
|
9385
|
+
const project = (mission) => {
|
|
9386
|
+
let summary = summarizeMeshMission(meshId, mission);
|
|
9387
|
+
if (withStats) {
|
|
9388
|
+
try {
|
|
9389
|
+
summary = { ...summary, stats: computeMeshMissionStats(meshId, mission.id) };
|
|
9390
|
+
} catch {
|
|
9391
|
+
}
|
|
9392
|
+
}
|
|
9393
|
+
return verbose ? summary : slimMissionSummary(summary);
|
|
9394
|
+
};
|
|
9395
|
+
const foldHistory = (history2) => {
|
|
9396
|
+
if (history2.length === 0) return null;
|
|
9397
|
+
const byStatus = {};
|
|
9398
|
+
for (const m of history2) byStatus[m.status] = (byStatus[m.status] ?? 0) + 1;
|
|
9399
|
+
return {
|
|
9400
|
+
count: history2.length,
|
|
9401
|
+
byStatus,
|
|
9402
|
+
missionIds: history2.slice(0, historyIdLimit).map((m) => m.id),
|
|
9403
|
+
note: 'Completed/abandoned missions are folded to counts + ids. Pass status (e.g. status:["completed"]) to list them in detail.'
|
|
9404
|
+
};
|
|
9405
|
+
};
|
|
9406
|
+
if (explicitStatuses) {
|
|
9407
|
+
const matched = getMeshMissions(meshId, explicitStatuses).filter(passesMagi).sort(byUpdatedDesc);
|
|
9408
|
+
const shown2 = matched.slice(0, limit);
|
|
9409
|
+
const overflow2 = matched.slice(limit);
|
|
9410
|
+
return {
|
|
9411
|
+
missions: shown2.map(project),
|
|
9412
|
+
historyFold: null,
|
|
9413
|
+
truncated: overflow2.length > 0,
|
|
9414
|
+
matched: matched.length,
|
|
9415
|
+
...overflow2.length > 0 ? { overflowIds: overflow2.map((m) => m.id) } : {}
|
|
9416
|
+
};
|
|
9417
|
+
}
|
|
9418
|
+
const all = getMeshMissions(meshId).filter(passesMagi);
|
|
9419
|
+
const live = all.filter((m) => m.status === "active" || m.status === "paused").sort(byUpdatedDesc);
|
|
9420
|
+
const history = all.filter((m) => m.status === "completed" || m.status === "abandoned").sort(byUpdatedDesc);
|
|
9421
|
+
const shown = live.slice(0, limit);
|
|
9422
|
+
const overflow = live.slice(limit);
|
|
9423
|
+
return {
|
|
9424
|
+
missions: shown.map(project),
|
|
9425
|
+
historyFold: foldHistory(history),
|
|
9426
|
+
truncated: overflow.length > 0,
|
|
9427
|
+
matched: live.length,
|
|
9428
|
+
...overflow.length > 0 ? { overflowIds: overflow.map((m) => m.id) } : {}
|
|
9429
|
+
};
|
|
9430
|
+
}
|
|
9373
9431
|
function buildMissionPromptSection(meshId) {
|
|
9374
9432
|
const summaries = getActiveMeshMissionSummaries(meshId);
|
|
9375
9433
|
if (summaries.length === 0) return "";
|
|
@@ -9388,7 +9446,7 @@ function buildMissionPromptSection(meshId) {
|
|
|
9388
9446
|
);
|
|
9389
9447
|
return lines.join("\n");
|
|
9390
9448
|
}
|
|
9391
|
-
var import_crypto8, LEDGER_GOAL_SUMMARY_MAX, MESH_MISSION_STATUSES, GOAL_PREVIEW_MAX, COMPACT_STATUS_GOAL_PREVIEW_MAX;
|
|
9449
|
+
var import_crypto8, 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;
|
|
9392
9450
|
var init_mesh_missions = __esm({
|
|
9393
9451
|
"src/mesh/mesh-missions.ts"() {
|
|
9394
9452
|
"use strict";
|
|
@@ -9403,6 +9461,8 @@ var init_mesh_missions = __esm({
|
|
|
9403
9461
|
MESH_MISSION_STATUSES = ["active", "paused", "completed", "abandoned"];
|
|
9404
9462
|
GOAL_PREVIEW_MAX = 120;
|
|
9405
9463
|
COMPACT_STATUS_GOAL_PREVIEW_MAX = 80;
|
|
9464
|
+
MESH_MISSION_LIST_HISTORY_ID_LIMIT = 30;
|
|
9465
|
+
MESH_MISSION_LIST_STATUS_LIMIT = 50;
|
|
9406
9466
|
}
|
|
9407
9467
|
});
|
|
9408
9468
|
|
|
@@ -12885,6 +12945,7 @@ function reconcileDirectDispatchCompletionFromTranscript(args) {
|
|
|
12885
12945
|
}
|
|
12886
12946
|
};
|
|
12887
12947
|
const targetCoordinatorSessionId = readNonEmptyString2(args.targetCoordinatorSessionId) || readNonEmptyString2(dispatch?.payload?.coordinatorSessionId);
|
|
12948
|
+
const targetCoordinatorDaemonId = readNonEmptyString2(dispatch?.payload?.coordinatorDaemonId) || readNonEmptyString2(args.targetCoordinatorDaemonId);
|
|
12888
12949
|
queuePendingMeshCoordinatorEvent({
|
|
12889
12950
|
event: eventName,
|
|
12890
12951
|
meshId: args.meshId,
|
|
@@ -12893,7 +12954,7 @@ function reconcileDirectDispatchCompletionFromTranscript(args) {
|
|
|
12893
12954
|
metadataEvent,
|
|
12894
12955
|
coordinatorMessage: buildMeshSystemMessage({ event: eventName, nodeLabel, metadataEvent }),
|
|
12895
12956
|
queuedAt: Date.now(),
|
|
12896
|
-
...
|
|
12957
|
+
...targetCoordinatorDaemonId ? { targetCoordinatorDaemonId } : {},
|
|
12897
12958
|
...targetCoordinatorSessionId ? { targetCoordinatorSessionId } : {}
|
|
12898
12959
|
});
|
|
12899
12960
|
recordSynthCompletionGateTrace("synth-fire", {
|
|
@@ -20615,7 +20676,11 @@ async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds,
|
|
|
20615
20676
|
continue;
|
|
20616
20677
|
}
|
|
20617
20678
|
const providerSessionId = readNonEmptyString2(payload.providerSessionId);
|
|
20618
|
-
const
|
|
20679
|
+
const workerSession = components.instanceManager.getInstance(sessionId);
|
|
20680
|
+
const workerCoordinatorDaemonId = readNonEmptyString2(
|
|
20681
|
+
workerSession?.getState()?.settings?.meshCoordinatorDaemonId
|
|
20682
|
+
);
|
|
20683
|
+
const coordinatorDaemonId = workerCoordinatorDaemonId || selfIds.find((id) => !!id);
|
|
20619
20684
|
try {
|
|
20620
20685
|
const result = reconcileDirectDispatchCompletionFromTranscript({
|
|
20621
20686
|
meshId: mesh.id,
|
|
@@ -20626,6 +20691,8 @@ async function reconcileUnterminatedDirectDispatches(components, mesh, selfIds,
|
|
|
20626
20691
|
taskId,
|
|
20627
20692
|
finalSummary: evidence.finalSummary,
|
|
20628
20693
|
...evidence.transcriptMessageAt ? { transcriptMessageAt: evidence.transcriptMessageAt } : {},
|
|
20694
|
+
// The ledger-recovered dispatching-coordinator daemon (inside the reconcile fn)
|
|
20695
|
+
// takes PRIORITY over this arg; this remains the best-available fallback.
|
|
20629
20696
|
...coordinatorDaemonId ? { targetCoordinatorDaemonId: coordinatorDaemonId } : {},
|
|
20630
20697
|
source: "daemon_reconcile_transcript_completion"
|
|
20631
20698
|
});
|
|
@@ -27107,6 +27174,8 @@ __export(index_exports, {
|
|
|
27107
27174
|
MESH_CONVERGE_REFINE_TAG: () => MESH_CONVERGE_REFINE_TAG,
|
|
27108
27175
|
MESH_MAX_PARALLEL_TASKS_MAX: () => MESH_MAX_PARALLEL_TASKS_MAX,
|
|
27109
27176
|
MESH_MAX_PARALLEL_TASKS_MIN: () => MESH_MAX_PARALLEL_TASKS_MIN,
|
|
27177
|
+
MESH_MISSION_LIST_HISTORY_ID_LIMIT: () => MESH_MISSION_LIST_HISTORY_ID_LIMIT,
|
|
27178
|
+
MESH_MISSION_LIST_STATUS_LIMIT: () => MESH_MISSION_LIST_STATUS_LIMIT,
|
|
27110
27179
|
MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
|
|
27111
27180
|
MESH_NODE_LIVE_TRUTH_MARKER: () => MESH_NODE_LIVE_TRUTH_MARKER,
|
|
27112
27181
|
MESH_REFINE_CONFIG_LOCATIONS: () => MESH_REFINE_CONFIG_LOCATIONS,
|
|
@@ -27196,6 +27265,7 @@ __export(index_exports, {
|
|
|
27196
27265
|
computeMeshTaskStats: () => computeMeshTaskStats,
|
|
27197
27266
|
configureDebugTraceStore: () => configureDebugTraceStore,
|
|
27198
27267
|
connectCdpManager: () => connectCdpManager,
|
|
27268
|
+
coordinatorIdentityFromEmitFields: () => coordinatorIdentityFromEmitFields,
|
|
27199
27269
|
createDebugTraceStore: () => createDebugTraceStore,
|
|
27200
27270
|
createDefaultGitCommandServices: () => createDefaultGitCommandServices,
|
|
27201
27271
|
createDefaultMeshHostMetadata: () => createDefaultMeshHostMetadata,
|
|
@@ -27312,6 +27382,7 @@ __export(index_exports, {
|
|
|
27312
27382
|
listMagiKindPanels: () => listMagiKindPanels,
|
|
27313
27383
|
listMagiPanels: () => listMagiPanels,
|
|
27314
27384
|
listMeshMissionSummaries: () => listMeshMissionSummaries,
|
|
27385
|
+
listMeshMissionsForTool: () => listMeshMissionsForTool,
|
|
27315
27386
|
listMeshes: () => listMeshes,
|
|
27316
27387
|
listWorktrees: () => listWorktrees,
|
|
27317
27388
|
loadChangeImpactConfig: () => loadChangeImpactConfig,
|
|
@@ -28835,6 +28906,7 @@ init_mesh_magi_status();
|
|
|
28835
28906
|
init_mesh_scheduling_runtime();
|
|
28836
28907
|
init_mesh_host_ownership();
|
|
28837
28908
|
init_mesh_events();
|
|
28909
|
+
init_contracts();
|
|
28838
28910
|
init_mesh_events_utils();
|
|
28839
28911
|
init_mesh_delivery_policy();
|
|
28840
28912
|
|
|
@@ -31962,10 +32034,11 @@ function normalizeProviderNativeHistoryRecords(agentType, historySessionId, reco
|
|
|
31962
32034
|
return sanitizeHistoryMessage(agentType, base);
|
|
31963
32035
|
}).filter(Boolean);
|
|
31964
32036
|
}
|
|
31965
|
-
function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
|
|
32037
|
+
function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
|
|
31966
32038
|
const fn = getProviderNativeHistoryScript(scripts, canonicalHistory, "readSession");
|
|
31967
32039
|
if (!fn) return null;
|
|
31968
32040
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
|
|
32041
|
+
const normalizedInstanceId = typeof instanceId === "string" ? instanceId.trim() : "";
|
|
31969
32042
|
const result = fn({
|
|
31970
32043
|
agentType,
|
|
31971
32044
|
sessionId: normalizedSessionId,
|
|
@@ -31980,6 +32053,12 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
|
|
|
31980
32053
|
// which leaves the guard disarmed so discovery still works.
|
|
31981
32054
|
providerSessionId: normalizedSessionId,
|
|
31982
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,
|
|
31983
32062
|
workspace,
|
|
31984
32063
|
format: canonicalHistory?.format,
|
|
31985
32064
|
watchPath: canonicalHistory?.watchPath,
|
|
@@ -31987,7 +32066,7 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
|
|
|
31987
32066
|
sessionStartedAtMs,
|
|
31988
32067
|
envOverrides,
|
|
31989
32068
|
forceRefresh: forceRefresh === true,
|
|
31990
|
-
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 }
|
|
31991
32070
|
});
|
|
31992
32071
|
if (!result || typeof result !== "object") return null;
|
|
31993
32072
|
const records = normalizeProviderNativeHistoryRecords(agentType, normalizedSessionId, result.messages || result.records);
|
|
@@ -32003,11 +32082,11 @@ function callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, his
|
|
|
32003
32082
|
unavailableReason: typeof result.unavailableReason === "string" ? result.unavailableReason.trim() : void 0
|
|
32004
32083
|
};
|
|
32005
32084
|
}
|
|
32006
|
-
function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh) {
|
|
32085
|
+
function buildNativeHistoryReadResult(agentType, canonicalHistory, scripts, historySessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId) {
|
|
32007
32086
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
|
|
32008
32087
|
const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
|
|
32009
32088
|
if (!canonicalHistory || !normalizedSessionId && !normalizedWorkspace || !isNativeSourceCanonicalHistory(canonicalHistory)) return null;
|
|
32010
|
-
return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh);
|
|
32089
|
+
return callProviderNativeHistoryRead(agentType, canonicalHistory, scripts, normalizedSessionId, workspace, excludeInProgressTurn, sessionStartedAtMs, envOverrides, forceRefresh, instanceId);
|
|
32011
32090
|
}
|
|
32012
32091
|
function materializeNativeHistoryToMirror(agentType, canonicalHistory, historySessionId, workspace, scripts) {
|
|
32013
32092
|
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
@@ -32036,7 +32115,7 @@ function isNativeSourceCanonicalHistory(canonicalHistory) {
|
|
|
32036
32115
|
}
|
|
32037
32116
|
function readProviderChatHistory(agentType, options = {}) {
|
|
32038
32117
|
if (isNativeSourceCanonicalHistory(options.canonicalHistory) && (options.historySessionId || options.workspace)) {
|
|
32039
|
-
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);
|
|
32040
32119
|
if (!nativeResult) return { messages: [], hasMore: false, source: "native-unavailable" };
|
|
32041
32120
|
return {
|
|
32042
32121
|
...pageHistoryRecords(agentType, nativeResult.records, options.offset || 0, options.limit || 30, options.excludeRecentCount || 0, options.historyBehavior),
|
|
@@ -34971,7 +35050,8 @@ function readCliProviderNativeHistory(agentStr, args) {
|
|
|
34971
35050
|
scripts: args.scripts,
|
|
34972
35051
|
excludeInProgressTurn: args.excludeInProgressTurn,
|
|
34973
35052
|
sessionStartedAtMs: args.sessionStartedAtMs,
|
|
34974
|
-
envOverrides: args.envOverrides
|
|
35053
|
+
envOverrides: args.envOverrides,
|
|
35054
|
+
instanceId: args.instanceId
|
|
34975
35055
|
});
|
|
34976
35056
|
const boundProviderSessionId = typeof sessionHistory?.providerSessionId === "string" ? sessionHistory.providerSessionId.trim() : "";
|
|
34977
35057
|
return {
|
|
@@ -35230,6 +35310,7 @@ async function handleChatHistory(h, args) {
|
|
|
35230
35310
|
scripts: provider?.scripts,
|
|
35231
35311
|
sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
|
|
35232
35312
|
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
|
|
35313
|
+
instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
|
|
35233
35314
|
pinnedProviderSessionId: getBoundProviderSessionIdPin(args?.targetSessionId)
|
|
35234
35315
|
}) : readProviderChatHistory(agentStr, {
|
|
35235
35316
|
canonicalHistory: provider?.nativeHistory,
|
|
@@ -35383,6 +35464,9 @@ async function handleReadChat(h, args) {
|
|
|
35383
35464
|
excludeInProgressTurn: returnedStatus === "waiting_approval",
|
|
35384
35465
|
sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
|
|
35385
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,
|
|
35386
35470
|
pinnedProviderSessionId: getBoundProviderSessionIdPin(targetSessionId),
|
|
35387
35471
|
// Last-resort only when no pin was ever recorded for this
|
|
35388
35472
|
// session; the downstream workspace-overlap safety gate
|
|
@@ -35432,7 +35516,8 @@ async function handleReadChat(h, args) {
|
|
|
35432
35516
|
scripts: provider?.scripts,
|
|
35433
35517
|
excludeInProgressTurn: returnedStatus === "waiting_approval",
|
|
35434
35518
|
sessionStartedAtMs,
|
|
35435
|
-
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId)
|
|
35519
|
+
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
|
|
35520
|
+
instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0
|
|
35436
35521
|
});
|
|
35437
35522
|
nativeHistoryError = void 0;
|
|
35438
35523
|
nativeMessages = nativeHistory && Array.isArray(nativeHistory.messages) ? normalizeAndFilterNativeHistory(h, agentStr, args, nativeHistory.messages, nativeHistory.providerSessionId) : [];
|
|
@@ -35654,6 +35739,7 @@ async function handleReadChat(h, args) {
|
|
|
35654
35739
|
scripts: provider?.scripts,
|
|
35655
35740
|
sessionStartedAtMs: sessionStartedAtMsFromRegistry(h, args?.targetSessionId),
|
|
35656
35741
|
envOverrides: sessionSpawnEnvFromAdapter(h, args?.targetSessionId),
|
|
35742
|
+
instanceId: typeof args?.targetSessionId === "string" ? args.targetSessionId : void 0,
|
|
35657
35743
|
pinnedProviderSessionId: pinnedProviderSessionIdForHistory,
|
|
35658
35744
|
// Last-resort only when no pin was ever recorded AND the
|
|
35659
35745
|
// runtime fallback did not resolve a real provider session.
|
|
@@ -45324,12 +45410,24 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
45324
45410
|
}
|
|
45325
45411
|
/**
|
|
45326
45412
|
* Owner token for this session in the antigravity conversation-claim
|
|
45327
|
-
* registry.
|
|
45328
|
-
*
|
|
45329
|
-
*
|
|
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).
|
|
45330
45428
|
*/
|
|
45331
45429
|
antigravityClaimOwner() {
|
|
45332
|
-
return antigravityOwnerToken(this.workingDir, this.startedAt);
|
|
45430
|
+
return antigravityOwnerToken(this.workingDir, this.startedAt, this.instanceId);
|
|
45333
45431
|
}
|
|
45334
45432
|
dispose() {
|
|
45335
45433
|
if (this.type === "antigravity-cli") {
|
|
@@ -50448,6 +50546,35 @@ function historyJsonlPath() {
|
|
|
50448
50546
|
function brainRoot() {
|
|
50449
50547
|
return path32.join(antigravityRoot(), "brain");
|
|
50450
50548
|
}
|
|
50549
|
+
function conversationsRoot() {
|
|
50550
|
+
return path32.join(antigravityRoot(), "conversations");
|
|
50551
|
+
}
|
|
50552
|
+
function resolvePathInside(root, ...segments) {
|
|
50553
|
+
const rootPath = path32.resolve(root);
|
|
50554
|
+
const targetPath = path32.resolve(rootPath, ...segments);
|
|
50555
|
+
if (targetPath !== rootPath && !targetPath.startsWith(rootPath + path32.sep)) return null;
|
|
50556
|
+
return targetPath;
|
|
50557
|
+
}
|
|
50558
|
+
function findBrainTranscriptPath(sessionId) {
|
|
50559
|
+
if (!isUuidLike(sessionId)) return null;
|
|
50560
|
+
const logsRoot = resolvePathInside(brainRoot(), sessionId, ".system_generated", "logs");
|
|
50561
|
+
if (!logsRoot || !fs24.existsSync(logsRoot)) return null;
|
|
50562
|
+
const candidates = ["transcript_full.jsonl", "transcript.jsonl"].map((file) => resolvePathInside(logsRoot, file)).filter((p) => p !== null && fs24.existsSync(p));
|
|
50563
|
+
if (candidates.length === 0) {
|
|
50564
|
+
let entries = [];
|
|
50565
|
+
try {
|
|
50566
|
+
entries = fs24.readdirSync(logsRoot, { withFileTypes: true });
|
|
50567
|
+
} catch {
|
|
50568
|
+
return null;
|
|
50569
|
+
}
|
|
50570
|
+
const transcriptFiles = entries.filter((e) => e.isFile() && /^transcript.*\.jsonl$/.test(e.name)).map((e) => path32.join(logsRoot, e.name));
|
|
50571
|
+
if (transcriptFiles.length === 0) return null;
|
|
50572
|
+
transcriptFiles.sort((a, b) => statMtimeMs3(b) - statMtimeMs3(a));
|
|
50573
|
+
return transcriptFiles[0];
|
|
50574
|
+
}
|
|
50575
|
+
candidates.sort((a, b) => statMtimeMs3(b) - statMtimeMs3(a));
|
|
50576
|
+
return candidates[0];
|
|
50577
|
+
}
|
|
50451
50578
|
function extractUserRequestContent(content) {
|
|
50452
50579
|
const raw = content.trim();
|
|
50453
50580
|
const match = raw.match(/<USER_REQUEST>\s*([\s\S]*?)\s*<\/USER_REQUEST>/i);
|
|
@@ -50858,6 +50985,83 @@ function parseConversationDb(filePath, sessionId, workspace) {
|
|
|
50858
50985
|
}
|
|
50859
50986
|
return messages.length > 0 ? messages : null;
|
|
50860
50987
|
}
|
|
50988
|
+
function readHistoryJsonlSession(resolvedSessionId, workspace) {
|
|
50989
|
+
if (!isUuidLike(resolvedSessionId)) return null;
|
|
50990
|
+
const rows = readHistoryRows().filter((r) => r.conversationId === resolvedSessionId);
|
|
50991
|
+
if (rows.length === 0) return null;
|
|
50992
|
+
rows.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
50993
|
+
const firstWorkspace = workspace || rows.find((r) => r.workspace)?.workspace || "";
|
|
50994
|
+
const messages = [];
|
|
50995
|
+
if (firstWorkspace) {
|
|
50996
|
+
messages.push({
|
|
50997
|
+
ts: new Date(rows[0].receivedAt).toISOString(),
|
|
50998
|
+
receivedAt: rows[0].receivedAt,
|
|
50999
|
+
role: "system",
|
|
51000
|
+
content: firstWorkspace,
|
|
51001
|
+
kind: "session_start",
|
|
51002
|
+
agent: "antigravity-cli",
|
|
51003
|
+
historySessionId: resolvedSessionId,
|
|
51004
|
+
workspace: firstWorkspace
|
|
51005
|
+
});
|
|
51006
|
+
}
|
|
51007
|
+
for (const row of rows) {
|
|
51008
|
+
const msg = {
|
|
51009
|
+
ts: new Date(row.receivedAt).toISOString(),
|
|
51010
|
+
receivedAt: row.receivedAt,
|
|
51011
|
+
role: "user",
|
|
51012
|
+
content: row.display,
|
|
51013
|
+
kind: "standard",
|
|
51014
|
+
agent: "antigravity-cli",
|
|
51015
|
+
historySessionId: resolvedSessionId
|
|
51016
|
+
};
|
|
51017
|
+
if (row.workspace) msg.workspace = row.workspace;
|
|
51018
|
+
messages.push(msg);
|
|
51019
|
+
}
|
|
51020
|
+
return {
|
|
51021
|
+
messages,
|
|
51022
|
+
providerSessionId: resolvedSessionId,
|
|
51023
|
+
source: "provider-native",
|
|
51024
|
+
sourcePath: historyJsonlPath(),
|
|
51025
|
+
sourceMtimeMs: statMtimeMs3(historyJsonlPath()),
|
|
51026
|
+
nativeHistoryCoverage: "partial",
|
|
51027
|
+
partialReason: "antigravity_cli_history_jsonl_contains_user_prompts_only"
|
|
51028
|
+
};
|
|
51029
|
+
}
|
|
51030
|
+
function readAntigravitySiblingFallback(sessionId, workspace) {
|
|
51031
|
+
if (!isUuidLike(sessionId)) return null;
|
|
51032
|
+
const brainPath = findBrainTranscriptPath(sessionId);
|
|
51033
|
+
if (brainPath && statMtimeMs3(brainPath) > 0) {
|
|
51034
|
+
const brainMessages = parseBrainTranscript(brainPath, sessionId, workspace);
|
|
51035
|
+
if (brainMessages && brainMessages.length > 0) {
|
|
51036
|
+
return {
|
|
51037
|
+
messages: brainMessages,
|
|
51038
|
+
providerSessionId: sessionId,
|
|
51039
|
+
source: "provider-native",
|
|
51040
|
+
sourcePath: brainPath,
|
|
51041
|
+
sourceMtimeMs: statMtimeMs3(brainPath),
|
|
51042
|
+
nativeHistoryCoverage: "full",
|
|
51043
|
+
workspace
|
|
51044
|
+
};
|
|
51045
|
+
}
|
|
51046
|
+
}
|
|
51047
|
+
const pbPath = resolvePathInside(conversationsRoot(), `${sessionId}.pb`);
|
|
51048
|
+
if (pbPath && fs24.existsSync(pbPath)) {
|
|
51049
|
+
const pbMessages = parsePbFile(pbPath, sessionId);
|
|
51050
|
+
if (pbMessages && pbMessages.length > 0) {
|
|
51051
|
+
return {
|
|
51052
|
+
messages: pbMessages,
|
|
51053
|
+
providerSessionId: sessionId,
|
|
51054
|
+
source: "provider-native",
|
|
51055
|
+
sourcePath: pbPath,
|
|
51056
|
+
sourceMtimeMs: statMtimeMs3(pbPath),
|
|
51057
|
+
nativeHistoryCoverage: "best-effort",
|
|
51058
|
+
partialReason: "antigravity_cli_pb_raw_text_extraction",
|
|
51059
|
+
workspace
|
|
51060
|
+
};
|
|
51061
|
+
}
|
|
51062
|
+
}
|
|
51063
|
+
return readHistoryJsonlSession(sessionId, workspace);
|
|
51064
|
+
}
|
|
50861
51065
|
function readSession3(sessionPath, sessionId, workspace) {
|
|
50862
51066
|
if (!sessionPath || !path32.isAbsolute(sessionPath)) return null;
|
|
50863
51067
|
if (!fs24.existsSync(sessionPath)) return null;
|
|
@@ -50884,16 +51088,20 @@ function readSession3(sessionPath, sessionId, workspace) {
|
|
|
50884
51088
|
const dbSessionId = sessionId || path32.basename(sessionPath, ".db");
|
|
50885
51089
|
if (!isUuidLike(dbSessionId)) return null;
|
|
50886
51090
|
const messages = parseConversationDb(sessionPath, dbSessionId, workspace);
|
|
50887
|
-
if (
|
|
50888
|
-
|
|
50889
|
-
|
|
50890
|
-
|
|
50891
|
-
|
|
50892
|
-
|
|
50893
|
-
|
|
50894
|
-
|
|
50895
|
-
|
|
50896
|
-
|
|
51091
|
+
if (messages && messages.length > 0) {
|
|
51092
|
+
return {
|
|
51093
|
+
messages,
|
|
51094
|
+
providerSessionId: dbSessionId,
|
|
51095
|
+
source: "provider-native",
|
|
51096
|
+
sourcePath: sessionPath,
|
|
51097
|
+
sourceMtimeMs,
|
|
51098
|
+
nativeHistoryCoverage: "full",
|
|
51099
|
+
workspace
|
|
51100
|
+
};
|
|
51101
|
+
}
|
|
51102
|
+
const siblingFallback = readAntigravitySiblingFallback(dbSessionId, workspace);
|
|
51103
|
+
if (siblingFallback) return siblingFallback;
|
|
51104
|
+
return null;
|
|
50897
51105
|
}
|
|
50898
51106
|
if (sessionPath.endsWith(".pb")) {
|
|
50899
51107
|
const pbSessionId = sessionId || path32.basename(sessionPath, ".pb");
|
|
@@ -50911,47 +51119,7 @@ function readSession3(sessionPath, sessionId, workspace) {
|
|
|
50911
51119
|
};
|
|
50912
51120
|
}
|
|
50913
51121
|
if (path32.basename(sessionPath) === "history.jsonl") {
|
|
50914
|
-
|
|
50915
|
-
if (!resolvedSessionId || !isUuidLike(resolvedSessionId)) return null;
|
|
50916
|
-
const rows = readHistoryRows().filter((r) => r.conversationId === resolvedSessionId);
|
|
50917
|
-
if (rows.length === 0) return null;
|
|
50918
|
-
rows.sort((a, b) => a.receivedAt - b.receivedAt);
|
|
50919
|
-
const firstWorkspace = workspace || rows.find((r) => r.workspace)?.workspace || "";
|
|
50920
|
-
const messages = [];
|
|
50921
|
-
if (firstWorkspace) {
|
|
50922
|
-
messages.push({
|
|
50923
|
-
ts: new Date(rows[0].receivedAt).toISOString(),
|
|
50924
|
-
receivedAt: rows[0].receivedAt,
|
|
50925
|
-
role: "system",
|
|
50926
|
-
content: firstWorkspace,
|
|
50927
|
-
kind: "session_start",
|
|
50928
|
-
agent: "antigravity-cli",
|
|
50929
|
-
historySessionId: resolvedSessionId,
|
|
50930
|
-
workspace: firstWorkspace
|
|
50931
|
-
});
|
|
50932
|
-
}
|
|
50933
|
-
for (const row of rows) {
|
|
50934
|
-
const msg = {
|
|
50935
|
-
ts: new Date(row.receivedAt).toISOString(),
|
|
50936
|
-
receivedAt: row.receivedAt,
|
|
50937
|
-
role: "user",
|
|
50938
|
-
content: row.display,
|
|
50939
|
-
kind: "standard",
|
|
50940
|
-
agent: "antigravity-cli",
|
|
50941
|
-
historySessionId: resolvedSessionId
|
|
50942
|
-
};
|
|
50943
|
-
if (row.workspace) msg.workspace = row.workspace;
|
|
50944
|
-
messages.push(msg);
|
|
50945
|
-
}
|
|
50946
|
-
return {
|
|
50947
|
-
messages,
|
|
50948
|
-
providerSessionId: resolvedSessionId,
|
|
50949
|
-
source: "provider-native",
|
|
50950
|
-
sourcePath: sessionPath,
|
|
50951
|
-
sourceMtimeMs,
|
|
50952
|
-
nativeHistoryCoverage: "partial",
|
|
50953
|
-
partialReason: "antigravity_cli_history_jsonl_contains_user_prompts_only"
|
|
50954
|
-
};
|
|
51122
|
+
return readHistoryJsonlSession(sessionId || "", workspace);
|
|
50955
51123
|
}
|
|
50956
51124
|
return null;
|
|
50957
51125
|
}
|
|
@@ -69219,6 +69387,8 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69219
69387
|
MESH_CONVERGE_REFINE_TAG,
|
|
69220
69388
|
MESH_MAX_PARALLEL_TASKS_MAX,
|
|
69221
69389
|
MESH_MAX_PARALLEL_TASKS_MIN,
|
|
69390
|
+
MESH_MISSION_LIST_HISTORY_ID_LIMIT,
|
|
69391
|
+
MESH_MISSION_LIST_STATUS_LIMIT,
|
|
69222
69392
|
MESH_MISSION_STATUSES,
|
|
69223
69393
|
MESH_NODE_LIVE_TRUTH_MARKER,
|
|
69224
69394
|
MESH_REFINE_CONFIG_LOCATIONS,
|
|
@@ -69308,6 +69478,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69308
69478
|
computeMeshTaskStats,
|
|
69309
69479
|
configureDebugTraceStore,
|
|
69310
69480
|
connectCdpManager,
|
|
69481
|
+
coordinatorIdentityFromEmitFields,
|
|
69311
69482
|
createDebugTraceStore,
|
|
69312
69483
|
createDefaultGitCommandServices,
|
|
69313
69484
|
createDefaultMeshHostMetadata,
|
|
@@ -69424,6 +69595,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
69424
69595
|
listMagiKindPanels,
|
|
69425
69596
|
listMagiPanels,
|
|
69426
69597
|
listMeshMissionSummaries,
|
|
69598
|
+
listMeshMissionsForTool,
|
|
69427
69599
|
listMeshes,
|
|
69428
69600
|
listWorktrees,
|
|
69429
69601
|
loadChangeImpactConfig,
|