@adhdev/daemon-standalone 0.9.82-rc.304 → 0.9.82-rc.306
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +196 -166
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-BvERTcmY.js +113 -0
- package/public/index.html +1 -1
package/dist/index.js
CHANGED
|
@@ -30004,10 +30004,10 @@ var require_dist3 = __commonJS({
|
|
|
30004
30004
|
}
|
|
30005
30005
|
function getDaemonBuildInfo() {
|
|
30006
30006
|
if (cached2) return cached2;
|
|
30007
|
-
const commit = readInjected(true ? "
|
|
30008
|
-
const commitShort = readInjected(true ? "
|
|
30009
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30010
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30007
|
+
const commit = readInjected(true ? "6ded896662908225a48ad662b6eec83267dbe9ba" : void 0) ?? "unknown";
|
|
30008
|
+
const commitShort = readInjected(true ? "6ded8966" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30009
|
+
const version2 = readInjected(true ? "0.9.82-rc.306" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30010
|
+
const builtAt = readInjected(true ? "2026-06-17T07:22:07.360Z" : void 0);
|
|
30011
30011
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30012
30012
|
return cached2;
|
|
30013
30013
|
}
|
|
@@ -34279,6 +34279,108 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34279
34279
|
};
|
|
34280
34280
|
}
|
|
34281
34281
|
});
|
|
34282
|
+
function readPayloadTaskId(entry) {
|
|
34283
|
+
const value = entry.payload?.taskId;
|
|
34284
|
+
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
34285
|
+
}
|
|
34286
|
+
function parseTime(value) {
|
|
34287
|
+
if (!value) return null;
|
|
34288
|
+
const parsed = new Date(value).getTime();
|
|
34289
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
34290
|
+
}
|
|
34291
|
+
function computeMeshTaskStats(meshId, opts) {
|
|
34292
|
+
const queue = getQueue(meshId);
|
|
34293
|
+
const queueById = new Map(queue.map((task) => [task.id, task]));
|
|
34294
|
+
let targetIds;
|
|
34295
|
+
if (opts?.taskIds?.length) {
|
|
34296
|
+
targetIds = [...new Set(opts.taskIds)];
|
|
34297
|
+
} else if (opts?.missionId) {
|
|
34298
|
+
targetIds = queue.filter((task) => task.missionId === opts.missionId).map((task) => task.id);
|
|
34299
|
+
} else {
|
|
34300
|
+
targetIds = queue.map((task) => task.id);
|
|
34301
|
+
}
|
|
34302
|
+
if (targetIds.length === 0) return [];
|
|
34303
|
+
const targetSet = new Set(targetIds);
|
|
34304
|
+
const entries = readLedgerEntries(meshId, { tail: opts?.tail ?? 1e3 });
|
|
34305
|
+
const dispatches = /* @__PURE__ */ new Map();
|
|
34306
|
+
const terminals = /* @__PURE__ */ new Map();
|
|
34307
|
+
for (const entry of entries) {
|
|
34308
|
+
const taskId = readPayloadTaskId(entry);
|
|
34309
|
+
if (!taskId || !targetSet.has(taskId)) continue;
|
|
34310
|
+
if (entry.kind === "task_dispatched") {
|
|
34311
|
+
const existing = dispatches.get(taskId);
|
|
34312
|
+
if (existing) existing.count += 1;
|
|
34313
|
+
else dispatches.set(taskId, { first: entry.timestamp, count: 1 });
|
|
34314
|
+
} else if (entry.kind === "task_completed" || entry.kind === "task_failed") {
|
|
34315
|
+
terminals.set(taskId, { at: entry.timestamp, kind: entry.kind });
|
|
34316
|
+
}
|
|
34317
|
+
}
|
|
34318
|
+
return targetIds.map((taskId) => {
|
|
34319
|
+
const queueEntry = queueById.get(taskId);
|
|
34320
|
+
const status = queueEntry?.status ?? "unknown";
|
|
34321
|
+
const dispatch = dispatches.get(taskId);
|
|
34322
|
+
const terminal = terminals.get(taskId);
|
|
34323
|
+
const isTerminalStatus = status === "completed" || status === "failed" || status === "cancelled";
|
|
34324
|
+
const dispatchTime = parseTime(dispatch?.first ?? queueEntry?.dispatchTimestamp);
|
|
34325
|
+
const terminalTime = parseTime(terminal?.at);
|
|
34326
|
+
const stats = {
|
|
34327
|
+
taskId,
|
|
34328
|
+
status,
|
|
34329
|
+
dispatchedAt: dispatch?.first ?? queueEntry?.dispatchTimestamp ?? null,
|
|
34330
|
+
terminalAt: terminal?.at ?? null,
|
|
34331
|
+
terminalKind: terminal?.kind ?? null,
|
|
34332
|
+
durationMs: null,
|
|
34333
|
+
dispatchCount: dispatch?.count ?? 0,
|
|
34334
|
+
requeueCount: queueEntry?.requeueCount ?? 0
|
|
34335
|
+
};
|
|
34336
|
+
if (dispatchTime !== null && terminalTime !== null && terminalTime >= dispatchTime) {
|
|
34337
|
+
stats.durationMs = terminalTime - dispatchTime;
|
|
34338
|
+
} else if (isTerminalStatus) {
|
|
34339
|
+
stats.incompleteEvidence = true;
|
|
34340
|
+
}
|
|
34341
|
+
return stats;
|
|
34342
|
+
});
|
|
34343
|
+
}
|
|
34344
|
+
function computeMeshMissionStats(meshId, missionId) {
|
|
34345
|
+
const tasks = computeMeshTaskStats(meshId, { missionId });
|
|
34346
|
+
const stats = {
|
|
34347
|
+
missionId,
|
|
34348
|
+
taskCount: tasks.length,
|
|
34349
|
+
completed: 0,
|
|
34350
|
+
failed: 0,
|
|
34351
|
+
totalDurationMs: 0,
|
|
34352
|
+
wallClockMs: null,
|
|
34353
|
+
retries: 0,
|
|
34354
|
+
incompleteTaskIds: []
|
|
34355
|
+
};
|
|
34356
|
+
let firstDispatch = null;
|
|
34357
|
+
let lastTerminal = null;
|
|
34358
|
+
for (const task of tasks) {
|
|
34359
|
+
if (task.status === "completed") stats.completed += 1;
|
|
34360
|
+
else if (task.status === "failed") stats.failed += 1;
|
|
34361
|
+
stats.retries += task.requeueCount;
|
|
34362
|
+
if (task.incompleteEvidence) {
|
|
34363
|
+
stats.incompleteTaskIds.push(task.taskId);
|
|
34364
|
+
continue;
|
|
34365
|
+
}
|
|
34366
|
+
if (task.durationMs !== null) stats.totalDurationMs += task.durationMs;
|
|
34367
|
+
const dispatchTime = parseTime(task.dispatchedAt);
|
|
34368
|
+
const terminalTime = parseTime(task.terminalAt);
|
|
34369
|
+
if (dispatchTime !== null && (firstDispatch === null || dispatchTime < firstDispatch)) firstDispatch = dispatchTime;
|
|
34370
|
+
if (terminalTime !== null && (lastTerminal === null || terminalTime > lastTerminal)) lastTerminal = terminalTime;
|
|
34371
|
+
}
|
|
34372
|
+
if (firstDispatch !== null && lastTerminal !== null && lastTerminal >= firstDispatch) {
|
|
34373
|
+
stats.wallClockMs = lastTerminal - firstDispatch;
|
|
34374
|
+
}
|
|
34375
|
+
return stats;
|
|
34376
|
+
}
|
|
34377
|
+
var init_mesh_task_stats = __esm2({
|
|
34378
|
+
"src/mesh/mesh-task-stats.ts"() {
|
|
34379
|
+
"use strict";
|
|
34380
|
+
init_mesh_ledger();
|
|
34381
|
+
init_mesh_work_queue();
|
|
34382
|
+
}
|
|
34383
|
+
});
|
|
34282
34384
|
var mesh_missions_exports = {};
|
|
34283
34385
|
__export2(mesh_missions_exports, {
|
|
34284
34386
|
GOAL_PREVIEW_MAX: () => GOAL_PREVIEW_MAX,
|
|
@@ -34369,7 +34471,10 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34369
34471
|
const all = getMeshMissions(meshId);
|
|
34370
34472
|
const live = all.filter((m) => m.status === "active" || m.status === "paused");
|
|
34371
34473
|
const history = all.filter((m) => m.status === "completed" || m.status === "abandoned").sort((a, b) => (b.updatedAt || "").localeCompare(a.updatedAt || "")).slice(0, historyLimit);
|
|
34372
|
-
|
|
34474
|
+
let full = [...live, ...history].map((mission) => summarizeMeshMission(meshId, mission));
|
|
34475
|
+
if (options?.withStats) {
|
|
34476
|
+
full = full.map((summary) => ({ ...summary, stats: computeMeshMissionStats(meshId, summary.id) }));
|
|
34477
|
+
}
|
|
34373
34478
|
return options?.verbose ? full : full.map(slimMissionSummary);
|
|
34374
34479
|
}
|
|
34375
34480
|
function listMeshMissionSummaries(meshId, options) {
|
|
@@ -34405,6 +34510,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
34405
34510
|
import_crypto6 = require("crypto");
|
|
34406
34511
|
init_mesh_runtime_store();
|
|
34407
34512
|
init_mesh_work_queue();
|
|
34513
|
+
init_mesh_task_stats();
|
|
34408
34514
|
MESH_MISSION_STATUSES = ["active", "paused", "completed", "abandoned"];
|
|
34409
34515
|
GOAL_PREVIEW_MAX = 120;
|
|
34410
34516
|
}
|
|
@@ -47087,103 +47193,7 @@ ${lastSnapshot}`;
|
|
|
47087
47193
|
init_mesh_config();
|
|
47088
47194
|
init_coordinator_prompt();
|
|
47089
47195
|
init_mesh_missions();
|
|
47090
|
-
|
|
47091
|
-
init_mesh_work_queue();
|
|
47092
|
-
function readPayloadTaskId(entry) {
|
|
47093
|
-
const value = entry.payload?.taskId;
|
|
47094
|
-
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
47095
|
-
}
|
|
47096
|
-
function parseTime(value) {
|
|
47097
|
-
if (!value) return null;
|
|
47098
|
-
const parsed = new Date(value).getTime();
|
|
47099
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
47100
|
-
}
|
|
47101
|
-
function computeMeshTaskStats(meshId, opts) {
|
|
47102
|
-
const queue = getQueue(meshId);
|
|
47103
|
-
const queueById = new Map(queue.map((task) => [task.id, task]));
|
|
47104
|
-
let targetIds;
|
|
47105
|
-
if (opts?.taskIds?.length) {
|
|
47106
|
-
targetIds = [...new Set(opts.taskIds)];
|
|
47107
|
-
} else if (opts?.missionId) {
|
|
47108
|
-
targetIds = queue.filter((task) => task.missionId === opts.missionId).map((task) => task.id);
|
|
47109
|
-
} else {
|
|
47110
|
-
targetIds = queue.map((task) => task.id);
|
|
47111
|
-
}
|
|
47112
|
-
if (targetIds.length === 0) return [];
|
|
47113
|
-
const targetSet = new Set(targetIds);
|
|
47114
|
-
const entries = readLedgerEntries(meshId, { tail: opts?.tail ?? 1e3 });
|
|
47115
|
-
const dispatches = /* @__PURE__ */ new Map();
|
|
47116
|
-
const terminals = /* @__PURE__ */ new Map();
|
|
47117
|
-
for (const entry of entries) {
|
|
47118
|
-
const taskId = readPayloadTaskId(entry);
|
|
47119
|
-
if (!taskId || !targetSet.has(taskId)) continue;
|
|
47120
|
-
if (entry.kind === "task_dispatched") {
|
|
47121
|
-
const existing = dispatches.get(taskId);
|
|
47122
|
-
if (existing) existing.count += 1;
|
|
47123
|
-
else dispatches.set(taskId, { first: entry.timestamp, count: 1 });
|
|
47124
|
-
} else if (entry.kind === "task_completed" || entry.kind === "task_failed") {
|
|
47125
|
-
terminals.set(taskId, { at: entry.timestamp, kind: entry.kind });
|
|
47126
|
-
}
|
|
47127
|
-
}
|
|
47128
|
-
return targetIds.map((taskId) => {
|
|
47129
|
-
const queueEntry = queueById.get(taskId);
|
|
47130
|
-
const status = queueEntry?.status ?? "unknown";
|
|
47131
|
-
const dispatch = dispatches.get(taskId);
|
|
47132
|
-
const terminal = terminals.get(taskId);
|
|
47133
|
-
const isTerminalStatus = status === "completed" || status === "failed" || status === "cancelled";
|
|
47134
|
-
const dispatchTime = parseTime(dispatch?.first ?? queueEntry?.dispatchTimestamp);
|
|
47135
|
-
const terminalTime = parseTime(terminal?.at);
|
|
47136
|
-
const stats = {
|
|
47137
|
-
taskId,
|
|
47138
|
-
status,
|
|
47139
|
-
dispatchedAt: dispatch?.first ?? queueEntry?.dispatchTimestamp ?? null,
|
|
47140
|
-
terminalAt: terminal?.at ?? null,
|
|
47141
|
-
terminalKind: terminal?.kind ?? null,
|
|
47142
|
-
durationMs: null,
|
|
47143
|
-
dispatchCount: dispatch?.count ?? 0,
|
|
47144
|
-
requeueCount: queueEntry?.requeueCount ?? 0
|
|
47145
|
-
};
|
|
47146
|
-
if (dispatchTime !== null && terminalTime !== null && terminalTime >= dispatchTime) {
|
|
47147
|
-
stats.durationMs = terminalTime - dispatchTime;
|
|
47148
|
-
} else if (isTerminalStatus) {
|
|
47149
|
-
stats.incompleteEvidence = true;
|
|
47150
|
-
}
|
|
47151
|
-
return stats;
|
|
47152
|
-
});
|
|
47153
|
-
}
|
|
47154
|
-
function computeMeshMissionStats(meshId, missionId) {
|
|
47155
|
-
const tasks = computeMeshTaskStats(meshId, { missionId });
|
|
47156
|
-
const stats = {
|
|
47157
|
-
missionId,
|
|
47158
|
-
taskCount: tasks.length,
|
|
47159
|
-
completed: 0,
|
|
47160
|
-
failed: 0,
|
|
47161
|
-
totalDurationMs: 0,
|
|
47162
|
-
wallClockMs: null,
|
|
47163
|
-
retries: 0,
|
|
47164
|
-
incompleteTaskIds: []
|
|
47165
|
-
};
|
|
47166
|
-
let firstDispatch = null;
|
|
47167
|
-
let lastTerminal = null;
|
|
47168
|
-
for (const task of tasks) {
|
|
47169
|
-
if (task.status === "completed") stats.completed += 1;
|
|
47170
|
-
else if (task.status === "failed") stats.failed += 1;
|
|
47171
|
-
stats.retries += task.requeueCount;
|
|
47172
|
-
if (task.incompleteEvidence) {
|
|
47173
|
-
stats.incompleteTaskIds.push(task.taskId);
|
|
47174
|
-
continue;
|
|
47175
|
-
}
|
|
47176
|
-
if (task.durationMs !== null) stats.totalDurationMs += task.durationMs;
|
|
47177
|
-
const dispatchTime = parseTime(task.dispatchedAt);
|
|
47178
|
-
const terminalTime = parseTime(task.terminalAt);
|
|
47179
|
-
if (dispatchTime !== null && (firstDispatch === null || dispatchTime < firstDispatch)) firstDispatch = dispatchTime;
|
|
47180
|
-
if (terminalTime !== null && (lastTerminal === null || terminalTime > lastTerminal)) lastTerminal = terminalTime;
|
|
47181
|
-
}
|
|
47182
|
-
if (firstDispatch !== null && lastTerminal !== null && lastTerminal >= firstDispatch) {
|
|
47183
|
-
stats.wallClockMs = lastTerminal - firstDispatch;
|
|
47184
|
-
}
|
|
47185
|
-
return stats;
|
|
47186
|
-
}
|
|
47196
|
+
init_mesh_task_stats();
|
|
47187
47197
|
init_mesh_review_inbox();
|
|
47188
47198
|
var import_path5 = require("path");
|
|
47189
47199
|
var import_fs5 = require("fs");
|
|
@@ -71881,6 +71891,31 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71881
71891
|
const remoteGit = remoteResult?.status ?? remoteResult?.git ?? remoteResult;
|
|
71882
71892
|
return remoteGit && typeof remoteGit === "object" && typeof remoteGit.isGitRepo === "boolean" ? remoteGit : null;
|
|
71883
71893
|
}
|
|
71894
|
+
var MESH_DIRECT_PROBE_MAX_RETRIES = 2;
|
|
71895
|
+
function readMeshConnectionState(connection) {
|
|
71896
|
+
return readStringValue(connection?.state);
|
|
71897
|
+
}
|
|
71898
|
+
async function probeRemoteMeshGitStatusWithRetry(args) {
|
|
71899
|
+
for (let attempt = 0; attempt <= MESH_DIRECT_PROBE_MAX_RETRIES; attempt += 1) {
|
|
71900
|
+
if (attempt > 0) {
|
|
71901
|
+
const connection = args.getConnection?.(args.daemonId);
|
|
71902
|
+
if (args.getConnection && readMeshConnectionState(connection) !== "connected") break;
|
|
71903
|
+
if (connection) args.onConnection?.(connection);
|
|
71904
|
+
await new Promise((resolve24) => setTimeout(resolve24, 250 * 2 ** (attempt - 1)));
|
|
71905
|
+
}
|
|
71906
|
+
try {
|
|
71907
|
+
const remoteGit = await probeRemoteMeshGitStatus({
|
|
71908
|
+
dispatchMeshCommand: args.dispatchMeshCommand,
|
|
71909
|
+
daemonId: args.daemonId,
|
|
71910
|
+
workspace: args.workspace,
|
|
71911
|
+
timeoutMs: attempt === 0 ? args.timeoutMs : args.retryTimeoutMs ?? args.timeoutMs
|
|
71912
|
+
});
|
|
71913
|
+
if (remoteGit) return remoteGit;
|
|
71914
|
+
} catch {
|
|
71915
|
+
}
|
|
71916
|
+
}
|
|
71917
|
+
return null;
|
|
71918
|
+
}
|
|
71884
71919
|
async function hydrateInlineMeshDirectTruth(args) {
|
|
71885
71920
|
const nodes = Array.isArray(args.mesh?.nodes) ? args.mesh.nodes : [];
|
|
71886
71921
|
if (!nodes.length) {
|
|
@@ -71889,6 +71924,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71889
71924
|
localConfirmedCount: 0,
|
|
71890
71925
|
peerAttemptedCount: 0,
|
|
71891
71926
|
peerConfirmedCount: 0,
|
|
71927
|
+
standingEvidenceCount: 0,
|
|
71892
71928
|
unavailableNodeIds: []
|
|
71893
71929
|
};
|
|
71894
71930
|
}
|
|
@@ -71900,6 +71936,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71900
71936
|
let localConfirmedCount = 0;
|
|
71901
71937
|
let peerAttemptedCount = 0;
|
|
71902
71938
|
let peerConfirmedCount = 0;
|
|
71939
|
+
let standingEvidenceCount = 0;
|
|
71903
71940
|
const unavailableNodeIds = [];
|
|
71904
71941
|
for (const [nodeIndex, node] of nodes.entries()) {
|
|
71905
71942
|
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
@@ -71925,32 +71962,40 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71925
71962
|
} catch {
|
|
71926
71963
|
}
|
|
71927
71964
|
}
|
|
71965
|
+
const standingGit = buildInlineMeshTransitGitStatus(node);
|
|
71966
|
+
if (standingGit) {
|
|
71967
|
+
standingEvidenceCount += 1;
|
|
71968
|
+
continue;
|
|
71969
|
+
}
|
|
71970
|
+
if (!args.probeRemotePeers) {
|
|
71971
|
+
continue;
|
|
71972
|
+
}
|
|
71928
71973
|
if (!daemonId || !args.dispatchMeshCommand) {
|
|
71929
71974
|
if (!isSelfNode) unavailableNodeIds.push(nodeId);
|
|
71930
71975
|
continue;
|
|
71931
71976
|
}
|
|
71932
71977
|
peerAttemptedCount += 1;
|
|
71933
|
-
|
|
71934
|
-
|
|
71935
|
-
|
|
71936
|
-
|
|
71937
|
-
|
|
71938
|
-
|
|
71939
|
-
|
|
71940
|
-
|
|
71941
|
-
|
|
71942
|
-
|
|
71943
|
-
|
|
71944
|
-
|
|
71945
|
-
} catch {
|
|
71978
|
+
const remoteGit = await probeRemoteMeshGitStatusWithRetry({
|
|
71979
|
+
dispatchMeshCommand: args.dispatchMeshCommand,
|
|
71980
|
+
daemonId,
|
|
71981
|
+
workspace,
|
|
71982
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS,
|
|
71983
|
+
retryTimeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS,
|
|
71984
|
+
getConnection: args.getMeshPeerConnectionStatus
|
|
71985
|
+
});
|
|
71986
|
+
if (remoteGit) {
|
|
71987
|
+
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
71988
|
+
peerConfirmedCount += 1;
|
|
71989
|
+
continue;
|
|
71946
71990
|
}
|
|
71947
71991
|
unavailableNodeIds.push(nodeId);
|
|
71948
71992
|
}
|
|
71949
71993
|
return {
|
|
71950
|
-
directEvidenceCount: localConfirmedCount + peerConfirmedCount,
|
|
71994
|
+
directEvidenceCount: localConfirmedCount + peerConfirmedCount + standingEvidenceCount,
|
|
71951
71995
|
localConfirmedCount,
|
|
71952
71996
|
peerAttemptedCount,
|
|
71953
71997
|
peerConfirmedCount,
|
|
71998
|
+
standingEvidenceCount,
|
|
71954
71999
|
unavailableNodeIds
|
|
71955
72000
|
};
|
|
71956
72001
|
}
|
|
@@ -76154,12 +76199,15 @@ ${hintLines.join("\n")}` : "",
|
|
|
76154
76199
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
76155
76200
|
if (!meshRecord?.mesh) return { success: false, error: "Mesh not found" };
|
|
76156
76201
|
const requireDirectPeerTruth = args?.requireDirectPeerTruth === true;
|
|
76202
|
+
const probeRemotePeers = args?.refresh === true || args?.forceRefresh === true;
|
|
76157
76203
|
const directTruth = await hydrateInlineMeshDirectTruth({
|
|
76158
76204
|
mesh: meshRecord.mesh,
|
|
76159
76205
|
meshSource: meshRecord.source,
|
|
76160
76206
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
76207
|
+
getMeshPeerConnectionStatus: this.deps.getMeshPeerConnectionStatus,
|
|
76161
76208
|
statusInstanceId: this.deps.statusInstanceId,
|
|
76162
|
-
localMachineId: loadConfig2().machineId || ""
|
|
76209
|
+
localMachineId: loadConfig2().machineId || "",
|
|
76210
|
+
probeRemotePeers
|
|
76163
76211
|
});
|
|
76164
76212
|
const directTruthSatisfied = meshRecord.source !== "inline_bootstrap" || directTruth.directEvidenceCount > 0;
|
|
76165
76213
|
const sourceOfTruth = {
|
|
@@ -77739,21 +77787,27 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
77739
77787
|
mesh,
|
|
77740
77788
|
meshSource: meshRecord.source,
|
|
77741
77789
|
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
77790
|
+
getMeshPeerConnectionStatus: this.deps.getMeshPeerConnectionStatus,
|
|
77742
77791
|
statusInstanceId: this.deps.statusInstanceId,
|
|
77743
|
-
localMachineId
|
|
77792
|
+
localMachineId,
|
|
77793
|
+
// Standing-state model: only an explicit refresh fans
|
|
77794
|
+
// out a blocking peer git probe. Default loads return
|
|
77795
|
+
// held truth so one slow peer can't block the graph.
|
|
77796
|
+
probeRemotePeers: refreshRequested
|
|
77744
77797
|
}) : {
|
|
77745
77798
|
directEvidenceCount: 0,
|
|
77746
77799
|
localConfirmedCount: 0,
|
|
77747
77800
|
peerAttemptedCount: 0,
|
|
77748
77801
|
peerConfirmedCount: 0,
|
|
77802
|
+
standingEvidenceCount: 0,
|
|
77749
77803
|
unavailableNodeIds: []
|
|
77750
77804
|
};
|
|
77751
77805
|
const passivePeerTruthNotAttempted = requireDirectPeerTruth && !refreshRequested && directTruth.directEvidenceCount > 0 && directTruth.peerAttemptedCount === 0;
|
|
77752
77806
|
const effectiveDirectTruth = passivePeerTruthNotAttempted ? { ...directTruth, unavailableNodeIds: [] } : directTruth;
|
|
77753
77807
|
const unavailableDirectTruthNodeIds = new Set(effectiveDirectTruth.unavailableNodeIds);
|
|
77754
77808
|
const unavailableNodesAreOnlyRemovedWorktrees = unavailableDirectTruthNodeIds.size > 0 && Array.isArray(mesh.nodes) && mesh.nodes.filter((node) => unavailableDirectTruthNodeIds.has(normalizeMeshNodeId(node) ?? "")).every((node) => node?.isLocalWorktree === true);
|
|
77755
|
-
const directTruthSatisfied = !requireDirectPeerTruth || effectiveDirectTruth.directEvidenceCount > 0 && (effectiveDirectTruth.unavailableNodeIds.length === 0 || unavailableNodesAreOnlyRemovedWorktrees);
|
|
77756
|
-
if (requireDirectPeerTruth && !directTruthSatisfied) {
|
|
77809
|
+
const directTruthSatisfied = !requireDirectPeerTruth || !refreshRequested || effectiveDirectTruth.directEvidenceCount > 0 && (effectiveDirectTruth.unavailableNodeIds.length === 0 || unavailableNodesAreOnlyRemovedWorktrees);
|
|
77810
|
+
if (requireDirectPeerTruth && refreshRequested && !directTruthSatisfied) {
|
|
77757
77811
|
const failureResult = {
|
|
77758
77812
|
success: false,
|
|
77759
77813
|
code: "mesh_direct_peer_truth_unavailable",
|
|
@@ -77899,53 +77953,29 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
77899
77953
|
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
77900
77954
|
}
|
|
77901
77955
|
remoteProbeApplied = true;
|
|
77902
|
-
} else if (!isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
77903
|
-
|
|
77904
|
-
|
|
77905
|
-
|
|
77906
|
-
|
|
77907
|
-
|
|
77908
|
-
|
|
77909
|
-
|
|
77910
|
-
|
|
77911
|
-
status.
|
|
77912
|
-
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
77913
|
-
const connection = readObjectRecord(status.connection);
|
|
77914
|
-
const connectionState = readStringValue(connection.state);
|
|
77915
|
-
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
77916
|
-
if (!connectionReported || connectionState === "unknown") {
|
|
77917
|
-
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
77918
|
-
}
|
|
77919
|
-
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
77920
|
-
remoteProbeApplied = true;
|
|
77956
|
+
} else if (refreshRequested && !isSelfNode && daemonId && this.deps.dispatchMeshCommand && !directTruthUnavailableNodeIds.has(nodeId)) {
|
|
77957
|
+
const remoteGit = await probeRemoteMeshGitStatusWithRetry({
|
|
77958
|
+
dispatchMeshCommand: this.deps.dispatchMeshCommand,
|
|
77959
|
+
daemonId,
|
|
77960
|
+
workspace,
|
|
77961
|
+
timeoutMs: MESH_DIRECT_PROBE_TIMEOUT_MS,
|
|
77962
|
+
retryTimeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS,
|
|
77963
|
+
getConnection: this.deps.getMeshPeerConnectionStatus,
|
|
77964
|
+
onConnection: (connection) => {
|
|
77965
|
+
status.connection = connection;
|
|
77921
77966
|
}
|
|
77922
|
-
}
|
|
77923
|
-
|
|
77924
|
-
|
|
77925
|
-
|
|
77926
|
-
|
|
77927
|
-
|
|
77928
|
-
|
|
77929
|
-
|
|
77930
|
-
|
|
77931
|
-
workspace,
|
|
77932
|
-
timeoutMs: MESH_DIRECT_PROBE_RETRY_TIMEOUT_MS
|
|
77933
|
-
});
|
|
77934
|
-
if (remoteGit) {
|
|
77935
|
-
status.git = remoteGit;
|
|
77936
|
-
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
77937
|
-
const connection = readObjectRecord(status.connection);
|
|
77938
|
-
const connectionState = readStringValue(connection.state);
|
|
77939
|
-
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
77940
|
-
if (!connectionReported || connectionState === "unknown") {
|
|
77941
|
-
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
77942
|
-
}
|
|
77943
|
-
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
77944
|
-
remoteProbeApplied = true;
|
|
77945
|
-
}
|
|
77946
|
-
} catch {
|
|
77947
|
-
}
|
|
77967
|
+
});
|
|
77968
|
+
if (remoteGit) {
|
|
77969
|
+
status.git = remoteGit;
|
|
77970
|
+
status.health = remoteGit.isGitRepo ? deriveMeshNodeHealthFromGit(remoteGit) : "degraded";
|
|
77971
|
+
const connection = readObjectRecord(status.connection);
|
|
77972
|
+
const connectionState = readStringValue(connection.state);
|
|
77973
|
+
const connectionReported = readBooleanValue(connection.reported) ?? false;
|
|
77974
|
+
if (!connectionReported || connectionState === "unknown") {
|
|
77975
|
+
status.connection = buildLivePeerGitConnection(connection, refreshedAt);
|
|
77948
77976
|
}
|
|
77977
|
+
recordInlineMeshDirectGitTruth(node, remoteGit, "selected_coordinator_mesh_p2p_git");
|
|
77978
|
+
remoteProbeApplied = true;
|
|
77949
77979
|
}
|
|
77950
77980
|
}
|
|
77951
77981
|
if (!remoteProbeApplied) {
|
|
@@ -78014,7 +78044,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78014
78044
|
liveSessionRecords: liveMeshSessions
|
|
78015
78045
|
});
|
|
78016
78046
|
const { getMeshStatusMissionSummaries: getMeshStatusMissionSummaries2 } = await Promise.resolve().then(() => (init_mesh_missions(), mesh_missions_exports));
|
|
78017
|
-
const missions = getMeshStatusMissionSummaries2(meshId, { verbose: verboseMissions });
|
|
78047
|
+
const missions = getMeshStatusMissionSummaries2(meshId, { verbose: verboseMissions, withStats: true });
|
|
78018
78048
|
const statusResult = {
|
|
78019
78049
|
success: true,
|
|
78020
78050
|
meshId: mesh.id,
|