@adhdev/daemon-core 0.9.82-rc.442 → 0.9.82-rc.444
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/commands/high-family/types.d.ts +4 -0
- package/dist/commands/router.d.ts +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +551 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +543 -63
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-ledger.d.ts +39 -1
- package/dist/mesh/mesh-node-identity.d.ts +15 -0
- package/dist/mesh/mesh-reconcile-loop.d.ts +15 -1
- package/dist/providers/chat-message-normalization.d.ts +1 -0
- package/dist/providers/cli-provider-instance.d.ts +2 -0
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +28 -2
- package/package.json +2 -2
- package/src/commands/chat-commands-read.ts +41 -0
- package/src/commands/high-family/mesh-coordinator-launch.ts +4 -2
- package/src/commands/high-family/mesh-events.ts +11 -2
- package/src/commands/high-family/mesh-status.ts +102 -9
- package/src/commands/high-family/types.ts +5 -1
- package/src/commands/router.ts +19 -2
- package/src/index.ts +1 -1
- package/src/mesh/coordinator-prompt.ts +1 -0
- package/src/mesh/mesh-ledger.ts +185 -0
- package/src/mesh/mesh-node-identity.ts +106 -18
- package/src/mesh/mesh-reconcile-loop.ts +22 -1
- package/src/providers/chat-message-normalization.ts +1 -1
- package/src/providers/cli-provider-instance.ts +130 -17
- package/src/providers/native-history/antigravity-cli-transcript.ts +348 -25
- package/src/providers/native-history/dispatcher.ts +33 -14
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 ? "fafdde138250b2edcbf2e42c643e3cabd1b8bda0" : void 0) ?? "unknown";
|
|
408
|
+
const commitShort = readInjected(true ? "fafdde13" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
409
|
+
const version = readInjected(true ? "0.9.82-rc.444" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
410
|
+
const builtAt = readInjected(true ? "2026-07-01T12:06:17.132Z" : void 0);
|
|
411
411
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
412
412
|
return cached;
|
|
413
413
|
}
|
|
@@ -3711,6 +3711,7 @@ var init_coordinator_prompt = __esm({
|
|
|
3711
3711
|
| \`mesh_read_debug\` | Collect a daemon-side chat/parser debug bundle for a session |
|
|
3712
3712
|
| \`mesh_task_history\` | Read the task ledger \u2014 dispatches, completions, failures. Use to understand what has been done before deciding next steps |
|
|
3713
3713
|
| \`mesh_record_note\` | Record a durable, provider-neutral operating note (provider quirk / pattern to avoid / recovery lesson). Future coordinators see it under "## Operating Notes" at launch |
|
|
3714
|
+
| \`mesh_forget_note\` | Retract a stale/wrong operating note by note_id or exact text so it stops riding into future coordinators' prompts (append-only tombstone; history preserved) |
|
|
3714
3715
|
| \`mesh_git_status\` | Check git status on a specific node |
|
|
3715
3716
|
| \`mesh_read_node_logs\` | Fetch a remote node's daemon log tail directly over P2P (grep/since/byte-bounded, secrets redacted) \u2014 no session/PowerShell needed to debug a node's daemon |
|
|
3716
3717
|
| \`mesh_fast_forward_node\` | Safely dry-run or explicitly execute an obvious clean fast-forward without launching an agent session |
|
|
@@ -4096,6 +4097,10 @@ var init_load_better_sqlite3 = __esm({
|
|
|
4096
4097
|
var mesh_ledger_exports = {};
|
|
4097
4098
|
__export(mesh_ledger_exports, {
|
|
4098
4099
|
MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
|
|
4100
|
+
OPERATING_NOTE_DEDUPE_WINDOW: () => OPERATING_NOTE_DEDUPE_WINDOW,
|
|
4101
|
+
OPERATING_NOTE_KEEP_LATEST: () => OPERATING_NOTE_KEEP_LATEST,
|
|
4102
|
+
OPERATING_NOTE_KIND: () => OPERATING_NOTE_KIND,
|
|
4103
|
+
OPERATING_NOTE_TOMBSTONE_KIND: () => OPERATING_NOTE_TOMBSTONE_KIND,
|
|
4099
4104
|
__clearMeshLedgerForTests: () => __clearMeshLedgerForTests,
|
|
4100
4105
|
appendLedgerEntry: () => appendLedgerEntry,
|
|
4101
4106
|
appendRemoteLedgerEntries: () => appendRemoteLedgerEntries,
|
|
@@ -4106,11 +4111,15 @@ __export(mesh_ledger_exports, {
|
|
|
4106
4111
|
getLedgerSummary: () => getLedgerSummary,
|
|
4107
4112
|
getSessionRecoveryContext: () => getSessionRecoveryContext,
|
|
4108
4113
|
isIntentionalCleanupStopEntry: () => isIntentionalCleanupStopEntry,
|
|
4114
|
+
isOperatingNoteTombstoned: () => isOperatingNoteTombstoned,
|
|
4109
4115
|
meshLedgerEvents: () => meshLedgerEvents,
|
|
4110
4116
|
normalizeMeshWorkerResult: () => normalizeMeshWorkerResult,
|
|
4117
|
+
pruneOperatingNotes: () => pruneOperatingNotes,
|
|
4111
4118
|
readLedgerEntries: () => readLedgerEntries,
|
|
4112
4119
|
readLedgerSlice: () => readLedgerSlice,
|
|
4113
|
-
readLedgerSliceFromStore: () => readLedgerSliceFromStore
|
|
4120
|
+
readLedgerSliceFromStore: () => readLedgerSliceFromStore,
|
|
4121
|
+
readOperatingNotes: () => readOperatingNotes,
|
|
4122
|
+
tombstoneOperatingNote: () => tombstoneOperatingNote
|
|
4114
4123
|
});
|
|
4115
4124
|
import { appendFileSync, existsSync as existsSync7, mkdirSync as mkdirSync4, readFileSync as readFileSync5, statSync as statSync4, renameSync as renameSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
4116
4125
|
import { join as join8 } from "path";
|
|
@@ -4384,6 +4393,17 @@ function buildTaskCompletionEvidence(opts) {
|
|
|
4384
4393
|
};
|
|
4385
4394
|
}
|
|
4386
4395
|
function appendLedgerEntry(meshId, partial) {
|
|
4396
|
+
if (partial.kind === OPERATING_NOTE_KIND) {
|
|
4397
|
+
const text = operatingNoteText(partial.payload);
|
|
4398
|
+
if (text) {
|
|
4399
|
+
const recentNotes = readLedgerEntries(meshId, {
|
|
4400
|
+
kind: [OPERATING_NOTE_KIND],
|
|
4401
|
+
tail: OPERATING_NOTE_DEDUPE_WINDOW
|
|
4402
|
+
});
|
|
4403
|
+
const existing = recentNotes.find((e) => operatingNoteText(e.payload) === text);
|
|
4404
|
+
if (existing) return existing;
|
|
4405
|
+
}
|
|
4406
|
+
}
|
|
4387
4407
|
const entry = {
|
|
4388
4408
|
id: randomUUID4(),
|
|
4389
4409
|
meshId,
|
|
@@ -4421,11 +4441,101 @@ function appendLedgerEntry(meshId, partial) {
|
|
|
4421
4441
|
appendFileSync(filePath, line, { encoding: "utf-8", mode: 384 });
|
|
4422
4442
|
invalidateLedgerCache(meshId);
|
|
4423
4443
|
meshLedgerEvents.emit("append", meshId, entry);
|
|
4444
|
+
if (entry.kind === OPERATING_NOTE_KIND || entry.kind === OPERATING_NOTE_TOMBSTONE_KIND) {
|
|
4445
|
+
try {
|
|
4446
|
+
pruneOperatingNotes(meshId);
|
|
4447
|
+
} catch {
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4424
4450
|
return entry;
|
|
4425
4451
|
} catch (e) {
|
|
4426
4452
|
throw new Error(`Failed to append to ledger for mesh ${meshId}: ${e.message}`);
|
|
4427
4453
|
}
|
|
4428
4454
|
}
|
|
4455
|
+
function operatingNoteText(payload) {
|
|
4456
|
+
const text = payload && typeof payload.text === "string" ? payload.text.trim() : "";
|
|
4457
|
+
return text || void 0;
|
|
4458
|
+
}
|
|
4459
|
+
function collectOperatingNoteTombstones(entries) {
|
|
4460
|
+
const ids = /* @__PURE__ */ new Set();
|
|
4461
|
+
const fingerprints = /* @__PURE__ */ new Set();
|
|
4462
|
+
for (const e of entries) {
|
|
4463
|
+
if (e.kind !== OPERATING_NOTE_TOMBSTONE_KIND) continue;
|
|
4464
|
+
const p = e.payload || {};
|
|
4465
|
+
const targetId = typeof p.targetNoteId === "string" ? p.targetNoteId.trim() : "";
|
|
4466
|
+
const targetFp = typeof p.targetFingerprint === "string" ? p.targetFingerprint.trim() : "";
|
|
4467
|
+
if (targetId) ids.add(targetId);
|
|
4468
|
+
if (targetFp) fingerprints.add(targetFp);
|
|
4469
|
+
}
|
|
4470
|
+
return { ids, fingerprints };
|
|
4471
|
+
}
|
|
4472
|
+
function isOperatingNoteTombstoned(entry, tombstones) {
|
|
4473
|
+
if (tombstones.ids.has(entry.id)) return true;
|
|
4474
|
+
const text = operatingNoteText(entry.payload);
|
|
4475
|
+
return text ? tombstones.fingerprints.has(text) : false;
|
|
4476
|
+
}
|
|
4477
|
+
function tombstoneOperatingNote(meshId, target) {
|
|
4478
|
+
const noteId = typeof target.noteId === "string" ? target.noteId.trim() : "";
|
|
4479
|
+
const fingerprint = typeof target.text === "string" ? target.text.trim() : "";
|
|
4480
|
+
if (!noteId && !fingerprint) {
|
|
4481
|
+
throw new Error("tombstoneOperatingNote requires a noteId or text target");
|
|
4482
|
+
}
|
|
4483
|
+
const notes = readOperatingNotes(meshId);
|
|
4484
|
+
const matched = notes.filter(
|
|
4485
|
+
(n) => noteId && n.id === noteId || fingerprint && operatingNoteText(n.payload) === fingerprint
|
|
4486
|
+
).length;
|
|
4487
|
+
const tombstone = appendLedgerEntry(meshId, {
|
|
4488
|
+
kind: OPERATING_NOTE_TOMBSTONE_KIND,
|
|
4489
|
+
payload: {
|
|
4490
|
+
...noteId ? { targetNoteId: noteId } : {},
|
|
4491
|
+
...fingerprint ? { targetFingerprint: fingerprint } : {},
|
|
4492
|
+
...target.reason && target.reason.trim() ? { reason: target.reason.trim() } : {},
|
|
4493
|
+
forgottenAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4494
|
+
}
|
|
4495
|
+
});
|
|
4496
|
+
return { tombstone, matched };
|
|
4497
|
+
}
|
|
4498
|
+
function readOperatingNotes(meshId, opts) {
|
|
4499
|
+
const raw = getCachedRawEntries(meshId);
|
|
4500
|
+
const tombstones = collectOperatingNoteTombstones(raw);
|
|
4501
|
+
let notes = raw.filter((e) => e.kind === OPERATING_NOTE_KIND && !isOperatingNoteTombstoned(e, tombstones));
|
|
4502
|
+
if (opts?.tail && opts.tail > 0 && notes.length > opts.tail) {
|
|
4503
|
+
notes = notes.slice(-opts.tail);
|
|
4504
|
+
}
|
|
4505
|
+
return notes;
|
|
4506
|
+
}
|
|
4507
|
+
function pruneOperatingNotes(meshId, keepLatest = OPERATING_NOTE_KEEP_LATEST) {
|
|
4508
|
+
const raw = getCachedRawEntries(meshId);
|
|
4509
|
+
const tombstones = collectOperatingNoteTombstones(raw);
|
|
4510
|
+
const removeIds = [];
|
|
4511
|
+
const liveNotes = [];
|
|
4512
|
+
for (const e of raw) {
|
|
4513
|
+
if (e.kind !== OPERATING_NOTE_KIND) continue;
|
|
4514
|
+
if (isOperatingNoteTombstoned(e, tombstones)) {
|
|
4515
|
+
removeIds.push(e.id);
|
|
4516
|
+
} else {
|
|
4517
|
+
liveNotes.push(e);
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
const bound = Math.max(0, Math.floor(keepLatest));
|
|
4521
|
+
if (liveNotes.length > bound) {
|
|
4522
|
+
for (const e of liveNotes.slice(0, liveNotes.length - bound)) removeIds.push(e.id);
|
|
4523
|
+
}
|
|
4524
|
+
if (removeIds.length === 0) return 0;
|
|
4525
|
+
try {
|
|
4526
|
+
MeshRuntimeStore.getInstance().deleteLedgerEntries(meshId, removeIds);
|
|
4527
|
+
} catch {
|
|
4528
|
+
}
|
|
4529
|
+
try {
|
|
4530
|
+
const remaining = readLedgerFile(meshId).filter((e) => !removeIds.includes(e.id));
|
|
4531
|
+
const filePath = getLedgerPath(meshId);
|
|
4532
|
+
const lines = remaining.length ? remaining.map((e) => JSON.stringify(e)).join("\n") + "\n" : "";
|
|
4533
|
+
writeFileSync3(filePath, lines, { encoding: "utf-8", mode: 384 });
|
|
4534
|
+
} catch {
|
|
4535
|
+
}
|
|
4536
|
+
invalidateLedgerCache(meshId);
|
|
4537
|
+
return removeIds.length;
|
|
4538
|
+
}
|
|
4429
4539
|
function clampLedgerSliceLimit(limit) {
|
|
4430
4540
|
if (typeof limit !== "number" || !Number.isFinite(limit)) return DEFAULT_LEDGER_SLICE_LIMIT;
|
|
4431
4541
|
return Math.max(1, Math.min(MAX_LEDGER_SLICE_LIMIT, Math.floor(limit)));
|
|
@@ -4765,7 +4875,7 @@ function rotateLedgerFile(meshId, currentPath) {
|
|
|
4765
4875
|
`);
|
|
4766
4876
|
}
|
|
4767
4877
|
}
|
|
4768
|
-
var LEDGER_DIR_NAME, MAX_FILE_SIZE_BYTES, COMPACT_THRESHOLD_BYTES, ARCHIVE_TERMINAL_OLDER_THAN_MS, RECENT_FAILURE_WINDOW_MS, ARCHIVABLE_KINDS, DEFAULT_LEDGER_SLICE_LIMIT, MAX_LEDGER_SLICE_LIMIT, meshLedgerEvents, ledgerReadCache, LEDGER_CACHE_TTL_MS, ledgerImportStoreRef, ledgerImportDone;
|
|
4878
|
+
var LEDGER_DIR_NAME, MAX_FILE_SIZE_BYTES, COMPACT_THRESHOLD_BYTES, ARCHIVE_TERMINAL_OLDER_THAN_MS, RECENT_FAILURE_WINDOW_MS, ARCHIVABLE_KINDS, DEFAULT_LEDGER_SLICE_LIMIT, MAX_LEDGER_SLICE_LIMIT, OPERATING_NOTE_KIND, OPERATING_NOTE_TOMBSTONE_KIND, OPERATING_NOTE_DEDUPE_WINDOW, OPERATING_NOTE_KEEP_LATEST, meshLedgerEvents, ledgerReadCache, LEDGER_CACHE_TTL_MS, ledgerImportStoreRef, ledgerImportDone;
|
|
4769
4879
|
var init_mesh_ledger = __esm({
|
|
4770
4880
|
"src/mesh/mesh-ledger.ts"() {
|
|
4771
4881
|
"use strict";
|
|
@@ -4784,6 +4894,10 @@ var init_mesh_ledger = __esm({
|
|
|
4784
4894
|
]);
|
|
4785
4895
|
DEFAULT_LEDGER_SLICE_LIMIT = 100;
|
|
4786
4896
|
MAX_LEDGER_SLICE_LIMIT = 500;
|
|
4897
|
+
OPERATING_NOTE_KIND = "coordinator_operating_note";
|
|
4898
|
+
OPERATING_NOTE_TOMBSTONE_KIND = "coordinator_operating_note_tombstone";
|
|
4899
|
+
OPERATING_NOTE_DEDUPE_WINDOW = 40;
|
|
4900
|
+
OPERATING_NOTE_KEEP_LATEST = 100;
|
|
4787
4901
|
meshLedgerEvents = new EventEmitter();
|
|
4788
4902
|
ledgerReadCache = /* @__PURE__ */ new Map();
|
|
4789
4903
|
LEDGER_CACHE_TTL_MS = 100;
|
|
@@ -17195,7 +17309,7 @@ function resolveCoordinatorDrainDeliverability(components, meshId) {
|
|
|
17195
17309
|
holdForReconcile: !hasIdle
|
|
17196
17310
|
};
|
|
17197
17311
|
}
|
|
17198
|
-
function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, requestedCoordinatorDaemonId) {
|
|
17312
|
+
function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, requestedCoordinatorDaemonId, callerIsSelfCoordinatorInboxRead) {
|
|
17199
17313
|
if (!meshId) return false;
|
|
17200
17314
|
const deliverability = resolveCoordinatorDrainDeliverability(components, meshId);
|
|
17201
17315
|
if (!deliverability.holdForReconcile) return false;
|
|
@@ -17205,7 +17319,10 @@ function shouldHoldPendingDrainForBusyLocalCoordinator(components, meshId, reque
|
|
|
17205
17319
|
readNonEmptyString2(components.statusInstanceId),
|
|
17206
17320
|
readNonEmptyString2(loadConfig().machineId)
|
|
17207
17321
|
]);
|
|
17208
|
-
|
|
17322
|
+
const targetsLocalCoordinator = localIds.some((id) => daemonIdsEquivalent(id, requested));
|
|
17323
|
+
if (!targetsLocalCoordinator) return false;
|
|
17324
|
+
if (callerIsSelfCoordinatorInboxRead) return false;
|
|
17325
|
+
return true;
|
|
17209
17326
|
}
|
|
17210
17327
|
function injectPendingIntoCoordinator(coordinator, pending) {
|
|
17211
17328
|
if (!coordinator) return;
|
|
@@ -32038,6 +32155,26 @@ async function handleReadChat(h, args) {
|
|
|
32038
32155
|
ptyStatusApprovalOnly: false
|
|
32039
32156
|
});
|
|
32040
32157
|
if (supportsNative && !decision.nativeSelected) {
|
|
32158
|
+
if (safeMapping && historyMessages.length > 0) {
|
|
32159
|
+
LOG.debug("Command", `[read_chat] native-only content preserved despite pty-parser selection target=${String(args?.targetSessionId || "")} provider=${agentStr} rows=${historyMessages.length} cause=${decision.decision.transition.cause}`);
|
|
32160
|
+
return buildReadChatCommandResult({
|
|
32161
|
+
messages: historyMessages,
|
|
32162
|
+
status: "idle",
|
|
32163
|
+
messageSource: {
|
|
32164
|
+
...decision.messageSource,
|
|
32165
|
+
nativeOnlyContentPreserved: true,
|
|
32166
|
+
returnedMessageCount: historyMessages.length
|
|
32167
|
+
},
|
|
32168
|
+
transcriptProvenance: {
|
|
32169
|
+
...decision.messageSource,
|
|
32170
|
+
nativeOnlyContentPreserved: true
|
|
32171
|
+
},
|
|
32172
|
+
...typeof history?.title === "string" ? { title: history.title } : {},
|
|
32173
|
+
...historyProviderSessionId ? { providerSessionId: historyProviderSessionId } : {},
|
|
32174
|
+
...provider?.historyBehavior?.transcriptAuthority === "provider" || provider?.historyBehavior?.transcriptAuthority === "daemon" ? { transcriptAuthority: (provider?.historyBehavior).transcriptAuthority } : {},
|
|
32175
|
+
coverage: "tail"
|
|
32176
|
+
}, args, h);
|
|
32177
|
+
}
|
|
32041
32178
|
LOG.debug("Command", `[read_chat] soft pending: no live adapter and native history not safely mappable target=${String(args?.targetSessionId || "")} provider=${agentStr} reason=native_history_not_safely_available`);
|
|
32042
32179
|
return {
|
|
32043
32180
|
success: true,
|
|
@@ -40639,6 +40776,15 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
40639
40776
|
// first sets it; the other becomes a no-op.
|
|
40640
40777
|
agentReadyEmitted = false;
|
|
40641
40778
|
generatingStartedAt = 0;
|
|
40779
|
+
// FALSE-IDLE continuity epoch: monotonically bumped on EVERY entry into a busy
|
|
40780
|
+
// phase (→generating or →waiting_approval). The completedDebouncePending snapshots
|
|
40781
|
+
// this value at arm time (busyEpochAtArm); the flush guard requires it UNCHANGED
|
|
40782
|
+
// — proving the session did not re-enter a busy phase (a momentary busy→idle blip
|
|
40783
|
+
// in an inter-approval valley) between arming the debounce and flushing it. A
|
|
40784
|
+
// single point-sample of status at flush time cannot see a generating phase that
|
|
40785
|
+
// opened AND closed within the settle window; the epoch can. See
|
|
40786
|
+
// flushCompletedDebounceIfFinalized.
|
|
40787
|
+
busyEpoch = 0;
|
|
40642
40788
|
// GENERATING-BOUNDARY (R4b): the per-turn taskId for which a startup-grace
|
|
40643
40789
|
// started+completed pair was already synthesized. Both fast-collapse callers
|
|
40644
40790
|
// (starting→idle transition AND the idle-stayed no-status-change poll) route
|
|
@@ -41122,8 +41268,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41122
41268
|
* to the genuine-modal classification.
|
|
41123
41269
|
*/
|
|
41124
41270
|
isTransientToolConsent(now = Date.now()) {
|
|
41125
|
-
|
|
41126
|
-
return isAutonomousMeshSession && this.hasAdapterPendingResponse() && !this.manualAttendance.isAttended(now);
|
|
41271
|
+
return this.isAutonomousMeshSession() && this.hasAdapterPendingResponse() && !this.manualAttendance.isAttended(now);
|
|
41127
41272
|
}
|
|
41128
41273
|
/** True when this session is parked on a modal awaiting a human answer. */
|
|
41129
41274
|
isModalParked() {
|
|
@@ -41305,13 +41450,17 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41305
41450
|
}
|
|
41306
41451
|
this.applyProviderResponse(parsed.payload, { phase: "immediate" });
|
|
41307
41452
|
}
|
|
41308
|
-
completionHasFinalAssistantMessage(messages) {
|
|
41453
|
+
completionHasFinalAssistantMessage(messages, turnStartedAt) {
|
|
41309
41454
|
const visibleMessages = (Array.isArray(messages) ? messages : []).filter((message) => isUserFacingChatMessage(message));
|
|
41310
41455
|
const lastVisible = visibleMessages[visibleMessages.length - 1];
|
|
41311
41456
|
const role = typeof lastVisible?.role === "string" ? lastVisible.role.trim().toLowerCase() : "";
|
|
41312
41457
|
const content = lastVisible ? flattenContent(lastVisible.content).trim() : "";
|
|
41313
41458
|
if (role !== "assistant" || !content) return false;
|
|
41314
41459
|
if (looksLikeActiveApprovalPromptText(content)) return false;
|
|
41460
|
+
if (typeof turnStartedAt === "number" && Number.isFinite(turnStartedAt) && turnStartedAt > 0) {
|
|
41461
|
+
const ts2 = readChatMessageTimestampMs(lastVisible);
|
|
41462
|
+
if (typeof ts2 === "number" && ts2 < turnStartedAt) return false;
|
|
41463
|
+
}
|
|
41315
41464
|
return true;
|
|
41316
41465
|
}
|
|
41317
41466
|
buildExternalTranscriptProbe(messages, sourcePath, sourceMtimeMs) {
|
|
@@ -41374,8 +41523,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41374
41523
|
);
|
|
41375
41524
|
return restoredHistory.messages;
|
|
41376
41525
|
}
|
|
41377
|
-
completionFinalAssistantEvidence(parsedMessages) {
|
|
41378
|
-
if (this.completionHasFinalAssistantMessage(parsedMessages)) {
|
|
41526
|
+
completionFinalAssistantEvidence(parsedMessages, turnStartedAt) {
|
|
41527
|
+
if (this.completionHasFinalAssistantMessage(parsedMessages, turnStartedAt)) {
|
|
41379
41528
|
return {
|
|
41380
41529
|
present: true,
|
|
41381
41530
|
messages: Array.isArray(parsedMessages) ? parsedMessages : [],
|
|
@@ -41385,7 +41534,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41385
41534
|
const externalMessages = this.readExternalCompletionMessages();
|
|
41386
41535
|
if (externalMessages) {
|
|
41387
41536
|
return {
|
|
41388
|
-
present: this.completionHasFinalAssistantMessage(externalMessages),
|
|
41537
|
+
present: this.completionHasFinalAssistantMessage(externalMessages, turnStartedAt),
|
|
41389
41538
|
messages: externalMessages,
|
|
41390
41539
|
source: "external-native"
|
|
41391
41540
|
};
|
|
@@ -41398,8 +41547,9 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41398
41547
|
}
|
|
41399
41548
|
completionFinalSummary(parsedMessages, turnStartedAt) {
|
|
41400
41549
|
const adapterOwnsMessagesElsewhere = this.adapter?.chatMessagesOwnedExternally === true;
|
|
41401
|
-
const parsedSummary =
|
|
41402
|
-
this.completionHasFinalAssistantMessage(parsedMessages) ? Array.isArray(parsedMessages) ? parsedMessages : [] : []
|
|
41550
|
+
const parsedSummary = extractFinalSummaryFromMessagesAfter(
|
|
41551
|
+
this.completionHasFinalAssistantMessage(parsedMessages, turnStartedAt) ? Array.isArray(parsedMessages) ? parsedMessages : [] : [],
|
|
41552
|
+
turnStartedAt
|
|
41403
41553
|
);
|
|
41404
41554
|
if (adapterOwnsMessagesElsewhere) {
|
|
41405
41555
|
const externalMessages = this.readExternalCompletionMessages();
|
|
@@ -41504,7 +41654,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41504
41654
|
}
|
|
41505
41655
|
if (parsed?.activeModal || parsed?.modal) return { reason: "parsed_modal_active", terminal: true };
|
|
41506
41656
|
const adapterOwnsMessagesElsewhere = this.adapter?.chatMessagesOwnedExternally === true;
|
|
41507
|
-
const finalAssistantEvidence = this.completionFinalAssistantEvidence(parsed?.messages);
|
|
41657
|
+
const finalAssistantEvidence = this.completionFinalAssistantEvidence(parsed?.messages, pending.turnStartedAt);
|
|
41508
41658
|
const allowMissingAssistantTimeout = !!(this.settings.meshNodeFor || this.settings.meshActiveTaskId || this.settings.launchedByCoordinator);
|
|
41509
41659
|
LOG.debug("CLI", `[${this.type}] finalAssistantEvidence: present=${finalAssistantEvidence.present} source=${finalAssistantEvidence.source} adapterOwnsMessagesElsewhere=${adapterOwnsMessagesElsewhere} parsedStatus=${parsedStatus}`);
|
|
41510
41660
|
if (!finalAssistantEvidence.present) {
|
|
@@ -41601,6 +41751,19 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41601
41751
|
isMeshWorkerSession() {
|
|
41602
41752
|
return !!(this.settings.meshNodeFor || this.settings.meshActiveTaskId || this.settings.meshNodeId || this.settings.launchedByCoordinator);
|
|
41603
41753
|
}
|
|
41754
|
+
// FALSE-IDLE (self-coordinator settle): an autonomously-progressing mesh session
|
|
41755
|
+
// is either a delegated worker (isMeshWorkerSession) OR the coordinator's OWN
|
|
41756
|
+
// claude-cli session (meshCoordinatorFor). Both run auto-approved tool turns whose
|
|
41757
|
+
// inter-approval valley (busy→idle blip→generating re-entry ~0.5s later) must be
|
|
41758
|
+
// absorbed by the completedDebounce settle window, not flushed on the first idle
|
|
41759
|
+
// sample. The worker branch already gets NATIVE_HISTORY_MESH_IDLE_SETTLE_MS; the
|
|
41760
|
+
// self-coordinator session (worker markers absent, meshCoordinatorFor present) was
|
|
41761
|
+
// taking flushDelay=0 — no settle window — so its busyEpoch/lastOutputAt continuity
|
|
41762
|
+
// guard had no window to observe the valley and fired mid-turn "next-step" previews
|
|
41763
|
+
// as a finalSummary. Mirrors the isAutonomousMeshSession notion in isTransientToolConsent.
|
|
41764
|
+
isAutonomousMeshSession() {
|
|
41765
|
+
return this.isMeshWorkerSession() || !!this.settings.meshCoordinatorFor;
|
|
41766
|
+
}
|
|
41604
41767
|
/**
|
|
41605
41768
|
* ARCH-REFACTOR R1: the taskId to attribute the CURRENTLY-completing turn to.
|
|
41606
41769
|
* Prefers the per-turn binding (engine.currentTurnTaskId, set when the turn was
|
|
@@ -41645,6 +41808,19 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41645
41808
|
this.completedDebounceTimer = null;
|
|
41646
41809
|
return;
|
|
41647
41810
|
}
|
|
41811
|
+
if (typeof pending.busyEpochAtArm === "number" && this.busyEpoch !== pending.busyEpochAtArm) {
|
|
41812
|
+
LOG.info("CLI", `[${this.type}] cancelled pending completed (busy re-entry during settle: epoch ${pending.busyEpochAtArm}\u2192${this.busyEpoch})`);
|
|
41813
|
+
this.completedDebouncePending = null;
|
|
41814
|
+
this.completedDebounceTimer = null;
|
|
41815
|
+
return;
|
|
41816
|
+
}
|
|
41817
|
+
const latestOutputAt = typeof latestStatus?.lastOutputAt === "number" ? latestStatus.lastOutputAt : void 0;
|
|
41818
|
+
if (typeof pending.lastOutputAtArm === "number" && typeof latestOutputAt === "number" && latestOutputAt > pending.lastOutputAtArm) {
|
|
41819
|
+
LOG.info("CLI", `[${this.type}] cancelled pending completed (new PTY output during settle: ${pending.lastOutputAtArm}\u2192${latestOutputAt})`);
|
|
41820
|
+
this.completedDebouncePending = null;
|
|
41821
|
+
this.completedDebounceTimer = null;
|
|
41822
|
+
return;
|
|
41823
|
+
}
|
|
41648
41824
|
const block2 = this.getCompletedFinalizationBlock(latestVisibleStatus, pending);
|
|
41649
41825
|
if (block2) {
|
|
41650
41826
|
const blockReason = block2.reason;
|
|
@@ -41947,6 +42123,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41947
42123
|
this.completedDebouncePending = null;
|
|
41948
42124
|
}
|
|
41949
42125
|
if (!this.generatingStartedAt) this.generatingStartedAt = now;
|
|
42126
|
+
this.busyEpoch++;
|
|
41950
42127
|
if (this.generatingDebounceTimer) clearTimeout(this.generatingDebounceTimer);
|
|
41951
42128
|
this.generatingDebouncePending = { chatTitle, timestamp: now };
|
|
41952
42129
|
this.generatingDebounceTimer = setTimeout(() => {
|
|
@@ -41972,6 +42149,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41972
42149
|
}
|
|
41973
42150
|
this.completedDebouncePending = null;
|
|
41974
42151
|
if (!this.generatingStartedAt) this.generatingStartedAt = now;
|
|
42152
|
+
this.busyEpoch++;
|
|
41975
42153
|
const modal = adapterStatus.activeModal;
|
|
41976
42154
|
LOG.info("CLI", `[${this.type}] approval modal: "${modal?.message?.slice(0, 80) ?? "none"}"`);
|
|
41977
42155
|
const approvalEntrySeq = typeof adapterStatus?.approvalEntrySeq === "number" ? adapterStatus.approvalEntrySeq : 0;
|
|
@@ -42070,12 +42248,18 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
42070
42248
|
const engineTurnStart = typeof this.adapter?.currentTurnStartedAt === "number" && Number.isFinite(this.adapter.currentTurnStartedAt) ? this.adapter.currentTurnStartedAt : 0;
|
|
42071
42249
|
const turnStartedAt = engineTurnStart || this.generatingStartedAt || 0;
|
|
42072
42250
|
return turnStartedAt ? { turnStartedAt } : {};
|
|
42073
|
-
})()
|
|
42251
|
+
})(),
|
|
42252
|
+
// FALSE-IDLE continuity: snapshot the busy epoch + raw PTY output
|
|
42253
|
+
// clock at arm time so the flush guard can prove the session stayed
|
|
42254
|
+
// continuously idle (no busy re-entry, no new PTY output) through the
|
|
42255
|
+
// settle window rather than merely reading 'idle' once at flush.
|
|
42256
|
+
busyEpochAtArm: this.busyEpoch,
|
|
42257
|
+
...typeof adapterStatus?.lastOutputAt === "number" && Number.isFinite(adapterStatus.lastOutputAt) ? { lastOutputAtArm: adapterStatus.lastOutputAt } : {}
|
|
42074
42258
|
};
|
|
42075
42259
|
const ownsExternalHistory = !!this.adapter?.chatMessagesOwnedExternally;
|
|
42076
|
-
const
|
|
42077
|
-
const flushDelay = ownsExternalHistory ?
|
|
42078
|
-
LOG.debug("CLI", `[${this.type}] set completedDebouncePending duration=${duration}s ownsExternalHistory=${ownsExternalHistory}
|
|
42260
|
+
const meshSettleSession = this.isAutonomousMeshSession();
|
|
42261
|
+
const flushDelay = ownsExternalHistory ? meshSettleSession ? NATIVE_HISTORY_MESH_IDLE_SETTLE_MS : 0 : 3e3;
|
|
42262
|
+
LOG.debug("CLI", `[${this.type}] set completedDebouncePending duration=${duration}s ownsExternalHistory=${ownsExternalHistory} meshSettle=${meshSettleSession} flushDelay=${flushDelay}ms generatingStartedAt=${this.generatingStartedAt}`);
|
|
42079
42263
|
this.scheduleCompletedDebounceFlush(flushDelay);
|
|
42080
42264
|
}
|
|
42081
42265
|
} else if (newStatus === "idle" && this.lastStatus === "starting") {
|
|
@@ -46135,6 +46319,7 @@ function readSession2(sessionPath) {
|
|
|
46135
46319
|
}
|
|
46136
46320
|
|
|
46137
46321
|
// src/providers/native-history/antigravity-cli-transcript.ts
|
|
46322
|
+
init_load_better_sqlite3();
|
|
46138
46323
|
import * as fs22 from "fs";
|
|
46139
46324
|
import * as path31 from "path";
|
|
46140
46325
|
import * as os22 from "os";
|
|
@@ -46311,6 +46496,151 @@ function parsePbFile(filePath, sessionId) {
|
|
|
46311
46496
|
}
|
|
46312
46497
|
];
|
|
46313
46498
|
}
|
|
46499
|
+
var AGY_STEP_TYPE_USER = 14;
|
|
46500
|
+
var AGY_STEP_TYPE_MODEL = 15;
|
|
46501
|
+
function readVarint(buf, offset) {
|
|
46502
|
+
let result = 0;
|
|
46503
|
+
let shift = 0;
|
|
46504
|
+
let i = offset;
|
|
46505
|
+
while (i < buf.length) {
|
|
46506
|
+
const byte = buf[i];
|
|
46507
|
+
i += 1;
|
|
46508
|
+
result += (byte & 127) * Math.pow(2, shift);
|
|
46509
|
+
if ((byte & 128) === 0) return [result, i];
|
|
46510
|
+
shift += 7;
|
|
46511
|
+
if (shift > 63) break;
|
|
46512
|
+
}
|
|
46513
|
+
return [result, i];
|
|
46514
|
+
}
|
|
46515
|
+
function decodeProtoFields(buf) {
|
|
46516
|
+
const fields = [];
|
|
46517
|
+
let i = 0;
|
|
46518
|
+
while (i < buf.length) {
|
|
46519
|
+
const [key2, afterKey] = readVarint(buf, i);
|
|
46520
|
+
if (afterKey === i) break;
|
|
46521
|
+
i = afterKey;
|
|
46522
|
+
const field = Math.floor(key2 / 8);
|
|
46523
|
+
const wireType = key2 & 7;
|
|
46524
|
+
if (field <= 0) break;
|
|
46525
|
+
if (wireType === 0) {
|
|
46526
|
+
const [value, next] = readVarint(buf, i);
|
|
46527
|
+
if (next === i) break;
|
|
46528
|
+
i = next;
|
|
46529
|
+
fields.push({ field, wireType, varint: value });
|
|
46530
|
+
} else if (wireType === 2) {
|
|
46531
|
+
const [len, afterLen] = readVarint(buf, i);
|
|
46532
|
+
i = afterLen;
|
|
46533
|
+
if (len < 0 || i + len > buf.length) break;
|
|
46534
|
+
fields.push({ field, wireType, bytes: buf.subarray(i, i + len) });
|
|
46535
|
+
i += len;
|
|
46536
|
+
} else if (wireType === 5) {
|
|
46537
|
+
i += 4;
|
|
46538
|
+
} else if (wireType === 1) {
|
|
46539
|
+
i += 8;
|
|
46540
|
+
} else {
|
|
46541
|
+
break;
|
|
46542
|
+
}
|
|
46543
|
+
}
|
|
46544
|
+
return fields;
|
|
46545
|
+
}
|
|
46546
|
+
function firstLenField(buf, field) {
|
|
46547
|
+
for (const f of decodeProtoFields(buf)) {
|
|
46548
|
+
if (f.field === field && f.wireType === 2 && f.bytes) return f.bytes;
|
|
46549
|
+
}
|
|
46550
|
+
return null;
|
|
46551
|
+
}
|
|
46552
|
+
function looksLikeText(buf) {
|
|
46553
|
+
if (buf.length === 0) return false;
|
|
46554
|
+
let printable = 0;
|
|
46555
|
+
for (let i = 0; i < buf.length; i++) {
|
|
46556
|
+
const b = buf[i];
|
|
46557
|
+
if (b >= 32 && b <= 126 || b === 9 || b === 10 || b === 13 || b >= 128) printable += 1;
|
|
46558
|
+
}
|
|
46559
|
+
return printable / buf.length >= 0.9;
|
|
46560
|
+
}
|
|
46561
|
+
function stripAnswerMarker(text) {
|
|
46562
|
+
return text.replace(/^\s*MARKER_V1\s*/, "");
|
|
46563
|
+
}
|
|
46564
|
+
function extractModelAnswer(payload) {
|
|
46565
|
+
const inner = firstLenField(payload, 20);
|
|
46566
|
+
if (!inner) return "";
|
|
46567
|
+
const answer = firstLenField(inner, 1) ?? firstLenField(inner, 8);
|
|
46568
|
+
if (!answer || !looksLikeText(answer)) return "";
|
|
46569
|
+
return stripAnswerMarker(answer.toString("utf-8")).trim();
|
|
46570
|
+
}
|
|
46571
|
+
function extractUserPrompt(payload) {
|
|
46572
|
+
const inner = firstLenField(payload, 19);
|
|
46573
|
+
if (!inner) return "";
|
|
46574
|
+
const raw = firstLenField(inner, 2) ?? firstLenField(inner, 3);
|
|
46575
|
+
if (!raw || !looksLikeText(raw)) return "";
|
|
46576
|
+
const text = raw.toString("utf-8").trim();
|
|
46577
|
+
if (!text) return "";
|
|
46578
|
+
return extractUserRequestContent(text);
|
|
46579
|
+
}
|
|
46580
|
+
function parseConversationDb(filePath, sessionId, workspace) {
|
|
46581
|
+
let db;
|
|
46582
|
+
try {
|
|
46583
|
+
const Database = loadBetterSqlite3();
|
|
46584
|
+
db = new Database(filePath, { readonly: true, fileMustExist: true });
|
|
46585
|
+
} catch {
|
|
46586
|
+
return null;
|
|
46587
|
+
}
|
|
46588
|
+
let rows;
|
|
46589
|
+
try {
|
|
46590
|
+
rows = db.prepare(
|
|
46591
|
+
`SELECT idx, step_type, step_payload
|
|
46592
|
+
FROM steps
|
|
46593
|
+
WHERE step_type IN (${AGY_STEP_TYPE_USER}, ${AGY_STEP_TYPE_MODEL})
|
|
46594
|
+
ORDER BY idx ASC`
|
|
46595
|
+
).all();
|
|
46596
|
+
} catch {
|
|
46597
|
+
return null;
|
|
46598
|
+
} finally {
|
|
46599
|
+
try {
|
|
46600
|
+
db.close();
|
|
46601
|
+
} catch {
|
|
46602
|
+
}
|
|
46603
|
+
}
|
|
46604
|
+
if (!Array.isArray(rows) || rows.length === 0) return null;
|
|
46605
|
+
const normalizedWorkspace = typeof workspace === "string" ? workspace.trim() : "";
|
|
46606
|
+
const baseTs = statMtimeMs3(filePath) || Date.now();
|
|
46607
|
+
const messages = [];
|
|
46608
|
+
for (const row of rows) {
|
|
46609
|
+
const payload = row.step_payload;
|
|
46610
|
+
if (!payload || !Buffer.isBuffer(payload) || payload.length === 0) continue;
|
|
46611
|
+
const receivedAt = baseTs + messages.length;
|
|
46612
|
+
if (row.step_type === AGY_STEP_TYPE_USER) {
|
|
46613
|
+
const content = extractUserPrompt(payload);
|
|
46614
|
+
if (!content) continue;
|
|
46615
|
+
const msg = {
|
|
46616
|
+
ts: new Date(receivedAt).toISOString(),
|
|
46617
|
+
receivedAt,
|
|
46618
|
+
role: "user",
|
|
46619
|
+
content,
|
|
46620
|
+
kind: "standard",
|
|
46621
|
+
agent: "antigravity-cli",
|
|
46622
|
+
historySessionId: sessionId
|
|
46623
|
+
};
|
|
46624
|
+
if (normalizedWorkspace) msg.workspace = normalizedWorkspace;
|
|
46625
|
+
messages.push(msg);
|
|
46626
|
+
} else if (row.step_type === AGY_STEP_TYPE_MODEL) {
|
|
46627
|
+
const content = extractModelAnswer(payload);
|
|
46628
|
+
if (!content) continue;
|
|
46629
|
+
const msg = {
|
|
46630
|
+
ts: new Date(receivedAt).toISOString(),
|
|
46631
|
+
receivedAt,
|
|
46632
|
+
role: "assistant",
|
|
46633
|
+
content,
|
|
46634
|
+
kind: "standard",
|
|
46635
|
+
agent: "antigravity-cli",
|
|
46636
|
+
historySessionId: sessionId
|
|
46637
|
+
};
|
|
46638
|
+
if (normalizedWorkspace) msg.workspace = normalizedWorkspace;
|
|
46639
|
+
messages.push(msg);
|
|
46640
|
+
}
|
|
46641
|
+
}
|
|
46642
|
+
return messages.length > 0 ? messages : null;
|
|
46643
|
+
}
|
|
46314
46644
|
function readSession3(sessionPath, sessionId, workspace) {
|
|
46315
46645
|
if (!sessionPath || !path31.isAbsolute(sessionPath)) return null;
|
|
46316
46646
|
if (!fs22.existsSync(sessionPath)) return null;
|
|
@@ -46333,6 +46663,21 @@ function readSession3(sessionPath, sessionId, workspace) {
|
|
|
46333
46663
|
workspace
|
|
46334
46664
|
};
|
|
46335
46665
|
}
|
|
46666
|
+
if (sessionPath.endsWith(".db")) {
|
|
46667
|
+
const dbSessionId = sessionId || path31.basename(sessionPath, ".db");
|
|
46668
|
+
if (!isUuidLike(dbSessionId)) return null;
|
|
46669
|
+
const messages = parseConversationDb(sessionPath, dbSessionId, workspace);
|
|
46670
|
+
if (!messages || messages.length === 0) return null;
|
|
46671
|
+
return {
|
|
46672
|
+
messages,
|
|
46673
|
+
providerSessionId: dbSessionId,
|
|
46674
|
+
source: "provider-native",
|
|
46675
|
+
sourcePath: sessionPath,
|
|
46676
|
+
sourceMtimeMs,
|
|
46677
|
+
nativeHistoryCoverage: "full",
|
|
46678
|
+
workspace
|
|
46679
|
+
};
|
|
46680
|
+
}
|
|
46336
46681
|
if (sessionPath.endsWith(".pb")) {
|
|
46337
46682
|
const pbSessionId = sessionId || path31.basename(sessionPath, ".pb");
|
|
46338
46683
|
if (!isUuidLike(pbSessionId)) return null;
|
|
@@ -46561,7 +46906,7 @@ function resolveSourcePath(reader, workspace, sessionId, sessionStartedAtMs) {
|
|
|
46561
46906
|
case "codex-cli":
|
|
46562
46907
|
return resolveCodexPath(workspace, sessionId, sessionStartedAtMs);
|
|
46563
46908
|
case "antigravity-cli":
|
|
46564
|
-
return resolveAntigravityPath(workspace);
|
|
46909
|
+
return resolveAntigravityPath(workspace, sessionId);
|
|
46565
46910
|
case "hermes-cli":
|
|
46566
46911
|
return resolveHermesPath(workspace, sessionId);
|
|
46567
46912
|
}
|
|
@@ -46676,16 +47021,25 @@ function resolveRealPath(value) {
|
|
|
46676
47021
|
return value;
|
|
46677
47022
|
}
|
|
46678
47023
|
}
|
|
46679
|
-
function resolveAntigravityPath(workspace) {
|
|
47024
|
+
function resolveAntigravityPath(workspace, sessionId) {
|
|
46680
47025
|
void workspace;
|
|
46681
|
-
const
|
|
46682
|
-
if (
|
|
46683
|
-
|
|
46684
|
-
|
|
46685
|
-
for (const e of entries) {
|
|
46686
|
-
const t = path33.join(e.p, ".system_generated", "logs", "transcript.jsonl");
|
|
46687
|
-
if (fs24.existsSync(t)) return t;
|
|
47026
|
+
const agyRoot = path33.join(os24.homedir(), ".gemini", "antigravity-cli");
|
|
47027
|
+
if (sessionId && isUuidLikeSessionId2(sessionId)) {
|
|
47028
|
+
const dbPath = path33.join(agyRoot, "conversations", `${sessionId}.db`);
|
|
47029
|
+
if (fs24.existsSync(dbPath)) return dbPath;
|
|
46688
47030
|
}
|
|
47031
|
+
const brainRoot2 = path33.join(agyRoot, "brain");
|
|
47032
|
+
if (fs24.existsSync(brainRoot2)) {
|
|
47033
|
+
const cutoff = Date.now() - RECENT_WINDOW_MS;
|
|
47034
|
+
const entries = fs24.readdirSync(brainRoot2, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => ({ p: path33.join(brainRoot2, e.name), mtime: safeMtime(path33.join(brainRoot2, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
47035
|
+
for (const e of entries) {
|
|
47036
|
+
const t = path33.join(e.p, ".system_generated", "logs", "transcript.jsonl");
|
|
47037
|
+
if (fs24.existsSync(t)) return t;
|
|
47038
|
+
}
|
|
47039
|
+
}
|
|
47040
|
+
const convRoot = path33.join(agyRoot, "conversations");
|
|
47041
|
+
const newestDb = newestRecentFile2(convRoot, /^[0-9a-f-]+\.db$/i);
|
|
47042
|
+
if (newestDb) return newestDb;
|
|
46689
47043
|
return null;
|
|
46690
47044
|
}
|
|
46691
47045
|
function resolveHermesPath(workspace, sessionId) {
|
|
@@ -50883,12 +51237,13 @@ var meshEventsHandlers = {
|
|
|
50883
51237
|
get_pending_mesh_events: async (ctx, args) => {
|
|
50884
51238
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
50885
51239
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : void 0;
|
|
51240
|
+
const selfCoordinatorInboxRead = args?.selfCoordinatorInboxRead === true;
|
|
50886
51241
|
const hasLiveCliCoordinator = meshId ? resolveCoordinatorDrainDeliverability(ctx.deps, meshId).hasLiveCliCoordinator : false;
|
|
50887
|
-
if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId)) {
|
|
51242
|
+
if (meshId && shouldHoldPendingDrainForBusyLocalCoordinator(ctx.deps, meshId, coordinatorDaemonId, selfCoordinatorInboxRead)) {
|
|
50888
51243
|
return { success: true, events: [], heldForBusyLocalCoordinator: true, hasLiveCliCoordinator };
|
|
50889
51244
|
}
|
|
50890
51245
|
const events = drainPendingMeshCoordinatorEvents(meshId || void 0, coordinatorDaemonId);
|
|
50891
|
-
return { success: true, events, hasLiveCliCoordinator };
|
|
51246
|
+
return { success: true, events, hasLiveCliCoordinator, ...selfCoordinatorInboxRead ? { surfacedForSelfCoordinator: true } : {} };
|
|
50892
51247
|
},
|
|
50893
51248
|
interactive_prompt_response: async (ctx, args) => {
|
|
50894
51249
|
const sessionId = typeof args?.targetSessionId === "string" && args.targetSessionId.trim() ? args.targetSessionId.trim() : typeof args?.sessionId === "string" && args.sessionId.trim() ? args.sessionId.trim() : "";
|
|
@@ -50956,8 +51311,8 @@ var meshCoordinatorLaunchHandlers = {
|
|
|
50956
51311
|
};
|
|
50957
51312
|
const buildOperatingNotesBestEffort = async (id) => {
|
|
50958
51313
|
try {
|
|
50959
|
-
const {
|
|
50960
|
-
const noteEntries =
|
|
51314
|
+
const { readOperatingNotes: readOperatingNotes2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
51315
|
+
const noteEntries = readOperatingNotes2(id, { tail: 20 });
|
|
50961
51316
|
const notes = noteEntries.map((e) => {
|
|
50962
51317
|
const p = e.payload || {};
|
|
50963
51318
|
const text = typeof p.text === "string" ? p.text.trim() : "";
|
|
@@ -51526,6 +51881,7 @@ var meshStatusHandlers = {
|
|
|
51526
51881
|
mesh_status: async (ctx, args) => {
|
|
51527
51882
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
51528
51883
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
51884
|
+
const startedAtMs = Date.now();
|
|
51529
51885
|
try {
|
|
51530
51886
|
const meshRecord = await ctx.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
51531
51887
|
const mesh = meshRecord?.mesh;
|
|
@@ -51543,10 +51899,38 @@ var meshStatusHandlers = {
|
|
|
51543
51899
|
meshId,
|
|
51544
51900
|
command: "mesh_status",
|
|
51545
51901
|
refreshRequested,
|
|
51902
|
+
durationMs: Date.now() - startedAtMs,
|
|
51546
51903
|
summary: summarizeRepoMeshStatusDebug(cachedStatus)
|
|
51547
51904
|
});
|
|
51548
51905
|
return cachedStatus;
|
|
51549
51906
|
}
|
|
51907
|
+
const staleStatus = ctx.getCachedAggregateMeshStatus(meshId, mesh, {
|
|
51908
|
+
requireDirectPeerTruth: args?.requireDirectPeerTruth === true,
|
|
51909
|
+
allowStalePending: true
|
|
51910
|
+
});
|
|
51911
|
+
if (staleStatus) {
|
|
51912
|
+
if (!ctx.swrRefreshInFlight.has(meshId)) {
|
|
51913
|
+
ctx.swrRefreshInFlight.add(meshId);
|
|
51914
|
+
void Promise.resolve().then(() => ctx.execute("mesh_status", {
|
|
51915
|
+
meshId,
|
|
51916
|
+
inlineMesh: args?.inlineMesh,
|
|
51917
|
+
coordinatorDaemonId: args?.coordinatorDaemonId,
|
|
51918
|
+
requireDirectPeerTruth: args?.requireDirectPeerTruth === true,
|
|
51919
|
+
refresh: true
|
|
51920
|
+
}, "mesh_status_swr_freshen")).catch(() => {
|
|
51921
|
+
}).finally(() => {
|
|
51922
|
+
ctx.swrRefreshInFlight.delete(meshId);
|
|
51923
|
+
});
|
|
51924
|
+
}
|
|
51925
|
+
logRepoMeshStatusDebug("return_stale_swr", {
|
|
51926
|
+
meshId,
|
|
51927
|
+
command: "mesh_status",
|
|
51928
|
+
refreshRequested,
|
|
51929
|
+
durationMs: Date.now() - startedAtMs,
|
|
51930
|
+
summary: summarizeRepoMeshStatusDebug(staleStatus)
|
|
51931
|
+
});
|
|
51932
|
+
return staleStatus;
|
|
51933
|
+
}
|
|
51550
51934
|
}
|
|
51551
51935
|
const refreshReason = refreshRequested ? "explicit_refresh" : pendingCoordinatorEventCount > 0 ? "pending_coordinator_events" : hadAggregateCache ? "stale_pending_cache_refresh" : "cold_cache_miss";
|
|
51552
51936
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
@@ -51627,8 +52011,7 @@ var meshStatusHandlers = {
|
|
|
51627
52011
|
);
|
|
51628
52012
|
const inlineCoordinatorNodeId = meshRecord?.inline && Array.isArray(mesh.nodes) ? selectedCoordinatorNodeId : void 0;
|
|
51629
52013
|
const refreshedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
51630
|
-
const
|
|
51631
|
-
for (const [nodeIndex, node] of (mesh.nodes || []).entries()) {
|
|
52014
|
+
const renderMeshNode = async (nodeIndex, node) => {
|
|
51632
52015
|
const nodeId = normalizeMeshNodeId(node) ?? "";
|
|
51633
52016
|
const daemonId = readStringValue(node.daemonId);
|
|
51634
52017
|
const nodeMachineId = readMeshNodeMachineId(node);
|
|
@@ -51783,19 +52166,19 @@ var meshStatusHandlers = {
|
|
|
51783
52166
|
)) {
|
|
51784
52167
|
applyInlineMeshBranchConvergence(mesh, node, status);
|
|
51785
52168
|
finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode, directTruthUnavailable: directTruthUnavailableNodeIds.has(nodeId) });
|
|
51786
|
-
|
|
51787
|
-
continue;
|
|
52169
|
+
return status;
|
|
51788
52170
|
}
|
|
51789
52171
|
if (meshRecord?.source === "inline_cache" && !isSelfNode) {
|
|
51790
52172
|
applyInlineMeshBranchConvergence(mesh, node, status);
|
|
51791
52173
|
finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode, directTruthUnavailable: directTruthUnavailableNodeIds.has(nodeId) });
|
|
51792
|
-
|
|
51793
|
-
continue;
|
|
52174
|
+
return status;
|
|
51794
52175
|
}
|
|
51795
52176
|
}
|
|
51796
52177
|
} else {
|
|
51797
52178
|
try {
|
|
51798
|
-
const
|
|
52179
|
+
const runLocalProbe = () => getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
|
|
52180
|
+
const gitStatus = await meshGitProbeCache.probeLocal(workspace, runLocalProbe);
|
|
52181
|
+
if (!gitStatus) throw new Error("local_git_probe_unavailable");
|
|
51799
52182
|
status.git = gitStatus;
|
|
51800
52183
|
status[MESH_NODE_LIVE_TRUTH_MARKER] = true;
|
|
51801
52184
|
const reporter = recordInlineMeshDirectGitTruth(node, gitStatus, "selected_coordinator_local_git");
|
|
@@ -51817,8 +52200,38 @@ var meshStatusHandlers = {
|
|
|
51817
52200
|
}
|
|
51818
52201
|
applyInlineMeshBranchConvergence(mesh, node, status);
|
|
51819
52202
|
finalizeMeshNodeStatus({ status, node, daemonId, isSelfNode, directTruthUnavailable: directTruthUnavailableNodeIds.has(nodeId) });
|
|
51820
|
-
|
|
51821
|
-
}
|
|
52203
|
+
return status;
|
|
52204
|
+
};
|
|
52205
|
+
const meshNodeEntries = [...(mesh.nodes || []).entries()];
|
|
52206
|
+
const settledNodeStatuses = await Promise.allSettled(
|
|
52207
|
+
meshNodeEntries.map(([nodeIndex, node]) => renderMeshNode(nodeIndex, node))
|
|
52208
|
+
);
|
|
52209
|
+
const nodeStatuses = settledNodeStatuses.map((settled, i) => {
|
|
52210
|
+
if (settled.status === "fulfilled") return settled.value;
|
|
52211
|
+
const [nodeIndex, node] = meshNodeEntries[i];
|
|
52212
|
+
const nodeId = normalizeMeshNodeId(node) ?? "";
|
|
52213
|
+
const daemonId = readStringValue(node.daemonId);
|
|
52214
|
+
const fallback = {
|
|
52215
|
+
nodeId,
|
|
52216
|
+
machineLabel: buildMeshNodeDisplayLabel(node, nodeId, readProviderPriorityFromPolicy(node.policy)),
|
|
52217
|
+
workspace: node.workspace,
|
|
52218
|
+
repoRoot: node.repoRoot,
|
|
52219
|
+
isLocalWorktree: node.isLocalWorktree,
|
|
52220
|
+
worktreeBranch: node.worktreeBranch,
|
|
52221
|
+
daemonId,
|
|
52222
|
+
machineId: readMeshNodeMachineId(node) || node.machineId,
|
|
52223
|
+
health: "unknown",
|
|
52224
|
+
providers: node.providers || [],
|
|
52225
|
+
activeSessions: [],
|
|
52226
|
+
activeSessionDetails: [],
|
|
52227
|
+
launchReady: false,
|
|
52228
|
+
error: settled.reason instanceof Error ? settled.reason.message : "node render failed"
|
|
52229
|
+
};
|
|
52230
|
+
applyCachedInlineMeshNodeStatus(fallback, node);
|
|
52231
|
+
applyInlineMeshBranchConvergence(mesh, node, fallback);
|
|
52232
|
+
finalizeMeshNodeStatus({ status: fallback, node, daemonId, isSelfNode: false, directTruthUnavailable: directTruthUnavailableNodeIds.has(nodeId) });
|
|
52233
|
+
return fallback;
|
|
52234
|
+
});
|
|
51822
52235
|
const callerCoordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : ctx.deps.statusInstanceId || void 0;
|
|
51823
52236
|
const pendingCoordinatorEvents = getPendingMeshCoordinatorEvents(meshId, callerCoordinatorDaemonId);
|
|
51824
52237
|
const unroutableDeliveries = getRecentUnroutableDeliveries();
|
|
@@ -51934,6 +52347,7 @@ var meshStatusHandlers = {
|
|
|
51934
52347
|
refreshReason,
|
|
51935
52348
|
meshSource: meshRecord.source,
|
|
51936
52349
|
directTruth,
|
|
52350
|
+
durationMs: Date.now() - startedAtMs,
|
|
51937
52351
|
summary: summarizeRepoMeshStatusDebug(returnedStatus)
|
|
51938
52352
|
});
|
|
51939
52353
|
return returnedStatus;
|
|
@@ -53134,7 +53548,7 @@ var MESH_DIRECT_PROBE_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_TIMEO
|
|
|
53134
53548
|
var MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS", 25e3);
|
|
53135
53549
|
var MESH_DIRECT_PROBE_CONNECT_TIMEOUT_MS = MESH_CONNECT_TIMEOUT_MS;
|
|
53136
53550
|
var MESH_DIRECT_PROBE_REUSE_MS = readMeshTimeoutEnvMs("MESH_DIRECT_PROBE_REUSE_MS", 12e3);
|
|
53137
|
-
var MeshGitProbeCache = class {
|
|
53551
|
+
var MeshGitProbeCache = class _MeshGitProbeCache {
|
|
53138
53552
|
constructor(reuseMs, now = Date.now) {
|
|
53139
53553
|
this.reuseMs = reuseMs;
|
|
53140
53554
|
this.now = now;
|
|
@@ -53144,6 +53558,23 @@ var MeshGitProbeCache = class {
|
|
|
53144
53558
|
key(daemonId, workspace) {
|
|
53145
53559
|
return `${daemonId}::${workspace}`;
|
|
53146
53560
|
}
|
|
53561
|
+
/**
|
|
53562
|
+
* Local (same-machine) git_status dedup. The bootstrap direct-truth hydrate
|
|
53563
|
+
* and the per-node render loop both call getGitRepoStatus(refreshUpstream:true)
|
|
53564
|
+
* for the same local workspace within one mesh_status call. Each such probe
|
|
53565
|
+
* fans out ~13-15 git subprocesses, and because the two passes are separated by
|
|
53566
|
+
* the render/hydrate work of every OTHER node they routinely straddle the
|
|
53567
|
+
* getGitRepoStatus 1.5s TTL, so the second pass re-shells the whole ~14-process
|
|
53568
|
+
* collection. Routing both through this cache (namespaced under a reserved
|
|
53569
|
+
* daemon id so it never collides with a remote-peer key) collapses them to one
|
|
53570
|
+
* collection per workspace per request, and reuses it across the reuse window
|
|
53571
|
+
* so the dashboard auto-retry loop can't restart a fresh local probe seconds
|
|
53572
|
+
* apart either.
|
|
53573
|
+
*/
|
|
53574
|
+
static LOCAL_PROBE_DAEMON_ID = "__local_git__";
|
|
53575
|
+
async probeLocal(workspace, probe) {
|
|
53576
|
+
return this.probe(_MeshGitProbeCache.LOCAL_PROBE_DAEMON_ID, workspace, probe);
|
|
53577
|
+
}
|
|
53147
53578
|
/**
|
|
53148
53579
|
* Run `probe` for this peer, but reuse a fresh recent result or an in-flight
|
|
53149
53580
|
* probe for the same key when one is available. `probe` is only invoked when
|
|
@@ -53254,7 +53685,7 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
53254
53685
|
let standingEvidenceCount = 0;
|
|
53255
53686
|
const unavailableNodeIds = [];
|
|
53256
53687
|
const deadNodeIds = [];
|
|
53257
|
-
|
|
53688
|
+
const classifyNode = async (nodeIndex, node) => {
|
|
53258
53689
|
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
53259
53690
|
const workspace = readStringValue(node?.workspace);
|
|
53260
53691
|
const daemonId = readStringValue(node?.daemonId);
|
|
@@ -53267,38 +53698,33 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
53267
53698
|
daemonId && (daemonIdsEquivalent(daemonId, args.localMachineId) || daemonIdsEquivalent(daemonId, args.statusInstanceId))
|
|
53268
53699
|
);
|
|
53269
53700
|
if ((isSelfNode || isSelfDaemonNode) && isDeadLocalWorktreeNode(node)) {
|
|
53270
|
-
|
|
53271
|
-
continue;
|
|
53701
|
+
return { kind: "dead", nodeId };
|
|
53272
53702
|
}
|
|
53273
53703
|
if (!workspace) {
|
|
53274
|
-
|
|
53275
|
-
continue;
|
|
53704
|
+
return !isSelfNode && daemonId ? { kind: "unavailable", nodeId } : { kind: "skip" };
|
|
53276
53705
|
}
|
|
53277
53706
|
if (fs29.existsSync(workspace)) {
|
|
53278
53707
|
try {
|
|
53279
|
-
const
|
|
53708
|
+
const runLocalProbe = () => getGitRepoStatus(workspace, { timeoutMs: 1e4, refreshUpstream: true });
|
|
53709
|
+
const localGit = args.probeCache ? await args.probeCache.probeLocal(workspace, runLocalProbe) : await runLocalProbe();
|
|
53280
53710
|
if (localGit?.isGitRepo) {
|
|
53281
53711
|
const reporter = recordInlineMeshDirectGitTruth(node, localGit, "selected_coordinator_local_git");
|
|
53282
53712
|
persistNodeReporterPlatform(args.meshSource, args.mesh, nodeId, reporter);
|
|
53283
|
-
|
|
53284
|
-
continue;
|
|
53713
|
+
return { kind: "local" };
|
|
53285
53714
|
}
|
|
53286
53715
|
} catch {
|
|
53287
53716
|
}
|
|
53288
53717
|
}
|
|
53289
53718
|
const standingGit = buildInlineMeshTransitGitStatus(node);
|
|
53290
53719
|
if (standingGit) {
|
|
53291
|
-
|
|
53292
|
-
continue;
|
|
53720
|
+
return { kind: "standing" };
|
|
53293
53721
|
}
|
|
53294
53722
|
if (!args.probeRemotePeers) {
|
|
53295
|
-
|
|
53723
|
+
return { kind: "skip" };
|
|
53296
53724
|
}
|
|
53297
53725
|
if (!daemonId || !args.dispatchMeshCommand) {
|
|
53298
|
-
|
|
53299
|
-
continue;
|
|
53726
|
+
return !isSelfNode ? { kind: "unavailable", nodeId } : { kind: "skip" };
|
|
53300
53727
|
}
|
|
53301
|
-
peerAttemptedCount += 1;
|
|
53302
53728
|
const runProbe = () => probeRemoteMeshGitStatusWithRetry({
|
|
53303
53729
|
dispatchMeshCommand: args.dispatchMeshCommand,
|
|
53304
53730
|
daemonId,
|
|
@@ -53312,11 +53738,52 @@ async function hydrateInlineMeshDirectTruth(args) {
|
|
|
53312
53738
|
if (remoteGit) {
|
|
53313
53739
|
const reporter = recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
53314
53740
|
persistNodeReporterPlatform(args.meshSource, args.mesh, nodeId, reporter);
|
|
53315
|
-
|
|
53316
|
-
continue;
|
|
53741
|
+
return { kind: "peerConfirmed" };
|
|
53317
53742
|
}
|
|
53318
|
-
|
|
53319
|
-
}
|
|
53743
|
+
return { kind: "peerUnavailable", nodeId };
|
|
53744
|
+
};
|
|
53745
|
+
const nodeEntries = [...nodes.entries()];
|
|
53746
|
+
const settledResults = await Promise.allSettled(
|
|
53747
|
+
nodeEntries.map(([nodeIndex, node]) => classifyNode(nodeIndex, node))
|
|
53748
|
+
);
|
|
53749
|
+
settledResults.forEach((settled, i) => {
|
|
53750
|
+
const [nodeIndex, node] = nodeEntries[i];
|
|
53751
|
+
const result = settled.status === "fulfilled" ? settled.value : (() => {
|
|
53752
|
+
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
53753
|
+
const daemonId = readStringValue(node?.daemonId);
|
|
53754
|
+
const isSelfNode = Boolean(
|
|
53755
|
+
nodeId && selectedCoordinatorNodeId && nodeId === selectedCoordinatorNodeId
|
|
53756
|
+
) || Boolean(
|
|
53757
|
+
daemonId && (daemonIdsEquivalent(daemonId, args.localMachineId) || daemonIdsEquivalent(daemonId, args.statusInstanceId))
|
|
53758
|
+
);
|
|
53759
|
+
return !isSelfNode && daemonId ? { kind: "unavailable", nodeId } : { kind: "skip" };
|
|
53760
|
+
})();
|
|
53761
|
+
switch (result.kind) {
|
|
53762
|
+
case "dead":
|
|
53763
|
+
deadNodeIds.push(result.nodeId);
|
|
53764
|
+
break;
|
|
53765
|
+
case "unavailable":
|
|
53766
|
+
unavailableNodeIds.push(result.nodeId);
|
|
53767
|
+
break;
|
|
53768
|
+
case "local":
|
|
53769
|
+
localConfirmedCount += 1;
|
|
53770
|
+
break;
|
|
53771
|
+
case "standing":
|
|
53772
|
+
standingEvidenceCount += 1;
|
|
53773
|
+
break;
|
|
53774
|
+
case "peerConfirmed":
|
|
53775
|
+
peerAttemptedCount += 1;
|
|
53776
|
+
peerConfirmedCount += 1;
|
|
53777
|
+
break;
|
|
53778
|
+
case "peerUnavailable":
|
|
53779
|
+
peerAttemptedCount += 1;
|
|
53780
|
+
unavailableNodeIds.push(result.nodeId);
|
|
53781
|
+
break;
|
|
53782
|
+
case "skip":
|
|
53783
|
+
default:
|
|
53784
|
+
break;
|
|
53785
|
+
}
|
|
53786
|
+
});
|
|
53320
53787
|
return {
|
|
53321
53788
|
directEvidenceCount: localConfirmedCount + peerConfirmedCount + standingEvidenceCount,
|
|
53322
53789
|
localConfirmedCount,
|
|
@@ -54687,6 +55154,10 @@ var DaemonCommandRouter = class {
|
|
|
54687
55154
|
* Spans separate mesh_status/get_mesh calls so the dashboard auto-retry
|
|
54688
55155
|
* loop cannot storm a slow peer with back-to-back refreshUpstream probes. */
|
|
54689
55156
|
meshGitProbeCache = new MeshGitProbeCache(MESH_DIRECT_PROBE_REUSE_MS);
|
|
55157
|
+
/** Meshes with a background SWR freshen (async mesh_status refresh) already in
|
|
55158
|
+
* flight — so a burst of interactive detail-opens serves the cached snapshot
|
|
55159
|
+
* and coalesces onto ONE background refresh instead of storming the peers. */
|
|
55160
|
+
swrRefreshInFlight = /* @__PURE__ */ new Set();
|
|
54690
55161
|
/** In-memory async Refinery jobs keyed by meshId:nodeId to reject/return duplicate in-flight requests. */
|
|
54691
55162
|
runningRefineJobs = /* @__PURE__ */ new Map();
|
|
54692
55163
|
/** Terminal async Refinery jobs preserve a clear answer after the worktree node has been removed. */
|
|
@@ -54790,7 +55261,7 @@ var DaemonCommandRouter = class {
|
|
|
54790
55261
|
if (cached3.queueRevision !== getMeshQueueRevision(meshId)) return null;
|
|
54791
55262
|
let snapshot = this.cloneJsonValue(cached3.snapshot);
|
|
54792
55263
|
snapshot = this.hydrateCachedAggregateMeshStatusFromInline(snapshot, mesh, options);
|
|
54793
|
-
if (shouldRefreshStalePendingAggregate(snapshot, options)) return null;
|
|
55264
|
+
if (!options?.allowStalePending && shouldRefreshStalePendingAggregate(snapshot, options)) return null;
|
|
54794
55265
|
const ageMs = Math.max(0, Date.now() - cached3.builtAt);
|
|
54795
55266
|
const sourceOfTruth = snapshot.sourceOfTruth && typeof snapshot.sourceOfTruth === "object" ? snapshot.sourceOfTruth : {};
|
|
54796
55267
|
snapshot.sourceOfTruth = {
|
|
@@ -55020,6 +55491,7 @@ var DaemonCommandRouter = class {
|
|
|
55020
55491
|
rememberAggregateMeshStatus: this.rememberAggregateMeshStatus.bind(this),
|
|
55021
55492
|
execute: this.execute.bind(this),
|
|
55022
55493
|
aggregateMeshStatusCache: this.aggregateMeshStatusCache,
|
|
55494
|
+
swrRefreshInFlight: this.swrRefreshInFlight,
|
|
55023
55495
|
runningRefineJobs: this.runningRefineJobs,
|
|
55024
55496
|
inlineMeshCache: this.inlineMeshCache,
|
|
55025
55497
|
meshGitProbeCache: this.meshGitProbeCache
|
|
@@ -65541,6 +66013,10 @@ export {
|
|
|
65541
66013
|
MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS,
|
|
65542
66014
|
MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS,
|
|
65543
66015
|
NodePtyTransportFactory,
|
|
66016
|
+
OPERATING_NOTE_DEDUPE_WINDOW,
|
|
66017
|
+
OPERATING_NOTE_KEEP_LATEST,
|
|
66018
|
+
OPERATING_NOTE_KIND,
|
|
66019
|
+
OPERATING_NOTE_TOMBSTONE_KIND,
|
|
65544
66020
|
P2pRelayFailureError,
|
|
65545
66021
|
PRUNABLE_ORPHAN_STALE_REASONS,
|
|
65546
66022
|
ProviderCliAdapter,
|
|
@@ -65710,6 +66186,7 @@ export {
|
|
|
65710
66186
|
isManagedStatusWaiting,
|
|
65711
66187
|
isManagedStatusWorking,
|
|
65712
66188
|
isMeshHostOwner,
|
|
66189
|
+
isOperatingNoteTombstoned,
|
|
65713
66190
|
isP2pRelayTransportFailure,
|
|
65714
66191
|
isPathInside,
|
|
65715
66192
|
isSessionHostLiveRuntime,
|
|
@@ -65778,6 +66255,7 @@ export {
|
|
|
65778
66255
|
prepareSessionChatTailUpdate,
|
|
65779
66256
|
prepareSessionModalUpdate,
|
|
65780
66257
|
probeCdpPort,
|
|
66258
|
+
pruneOperatingNotes,
|
|
65781
66259
|
pruneStaleDirectDispatches,
|
|
65782
66260
|
queuePendingMeshCoordinatorEvent,
|
|
65783
66261
|
readSession3 as readAntigravityCliSession,
|
|
@@ -65790,6 +66268,7 @@ export {
|
|
|
65790
66268
|
readLedgerSlice,
|
|
65791
66269
|
readLedgerSliceFromStore,
|
|
65792
66270
|
readMeshCompletionSummary,
|
|
66271
|
+
readOperatingNotes,
|
|
65793
66272
|
reconcileDirectDispatchCompletionFromTranscript,
|
|
65794
66273
|
recordCompletionConflict,
|
|
65795
66274
|
recordDebugTrace,
|
|
@@ -65847,6 +66326,7 @@ export {
|
|
|
65847
66326
|
summarizeMeshMagiActivity,
|
|
65848
66327
|
summarizeMeshMission,
|
|
65849
66328
|
summarizeMissionTasks,
|
|
66329
|
+
tombstoneOperatingNote,
|
|
65850
66330
|
triggerMeshQueue,
|
|
65851
66331
|
unregisterMeshCoordinator,
|
|
65852
66332
|
updateConfig,
|