@adhdev/daemon-standalone 0.9.82-rc.24 → 0.9.82-rc.26
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 +92 -55
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-Ce58Aw2L.js +98 -0
- package/public/index.html +1 -1
- package/public/assets/index-Dt2Xvr87.js +0 -98
package/dist/index.js
CHANGED
|
@@ -23644,18 +23644,20 @@ Follow these recovery rules:
|
|
|
23644
23644
|
return entry;
|
|
23645
23645
|
});
|
|
23646
23646
|
}
|
|
23647
|
-
function updateSessionTaskStatus(meshId, sessionId, status) {
|
|
23647
|
+
function updateSessionTaskStatus(meshId, sessionId, status, opts) {
|
|
23648
23648
|
return withQueueLock(meshId, () => {
|
|
23649
23649
|
const queue = readQueue(meshId);
|
|
23650
|
+
const occurredAtTime = opts?.occurredAt ? new Date(opts.occurredAt).getTime() : Number.NaN;
|
|
23651
|
+
const hasOccurredAt = Number.isFinite(occurredAtTime);
|
|
23650
23652
|
let bestIdx = -1;
|
|
23651
23653
|
let bestTime = 0;
|
|
23652
23654
|
for (let i = queue.length - 1; i >= 0; i--) {
|
|
23653
|
-
if (queue[i].assignedSessionId
|
|
23654
|
-
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
|
|
23655
|
+
if (queue[i].assignedSessionId !== sessionId || queue[i].status !== "assigned") continue;
|
|
23656
|
+
const time3 = new Date(queue[i].dispatchTimestamp || queue[i].updatedAt).getTime();
|
|
23657
|
+
if (hasOccurredAt && Number.isFinite(time3) && time3 > occurredAtTime) continue;
|
|
23658
|
+
if (time3 > bestTime) {
|
|
23659
|
+
bestTime = time3;
|
|
23660
|
+
bestIdx = i;
|
|
23659
23661
|
}
|
|
23660
23662
|
}
|
|
23661
23663
|
if (bestIdx === -1) return null;
|
|
@@ -24201,6 +24203,38 @@ Follow these recovery rules:
|
|
|
24201
24203
|
if (isIntentionalCleanupStopMetadata(args.metadataEvent)) return true;
|
|
24202
24204
|
return hasRecentIntentionalCleanupStop(args.meshId, args.sessionId, args.nodeId);
|
|
24203
24205
|
}
|
|
24206
|
+
function readEventTimestamp(value) {
|
|
24207
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
24208
|
+
if (typeof value === "string" && value.trim()) {
|
|
24209
|
+
const numeric = Number(value);
|
|
24210
|
+
if (Number.isFinite(numeric)) return numeric;
|
|
24211
|
+
const parsed = Date.parse(value);
|
|
24212
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
24213
|
+
}
|
|
24214
|
+
return null;
|
|
24215
|
+
}
|
|
24216
|
+
function buildMeshCompletionFingerprint(args) {
|
|
24217
|
+
const timestampPart = Number.isFinite(args.timestamp) ? String(args.timestamp) : readNonEmptyString(args.finalSummary).slice(0, 200);
|
|
24218
|
+
return [
|
|
24219
|
+
args.meshId,
|
|
24220
|
+
args.event,
|
|
24221
|
+
args.sessionId,
|
|
24222
|
+
args.providerType || "",
|
|
24223
|
+
args.providerSessionId || "",
|
|
24224
|
+
timestampPart
|
|
24225
|
+
].join("::");
|
|
24226
|
+
}
|
|
24227
|
+
function isDuplicateMeshCompletionEvent(args) {
|
|
24228
|
+
const fingerprint = buildMeshCompletionFingerprint(args);
|
|
24229
|
+
if (!fingerprint) return false;
|
|
24230
|
+
const now = Date.now();
|
|
24231
|
+
for (const [key, seenAt] of recentCompletionFingerprints.entries()) {
|
|
24232
|
+
if (now - seenAt > RECENT_COMPLETION_FINGERPRINT_TTL_MS) recentCompletionFingerprints.delete(key);
|
|
24233
|
+
}
|
|
24234
|
+
if (recentCompletionFingerprints.has(fingerprint)) return true;
|
|
24235
|
+
recentCompletionFingerprints.set(fingerprint, now);
|
|
24236
|
+
return false;
|
|
24237
|
+
}
|
|
24204
24238
|
function tryAssignQueueTask(components, meshId, nodeId, sessionId, providerType) {
|
|
24205
24239
|
const task = claimNextTask(meshId, nodeId, sessionId);
|
|
24206
24240
|
if (!task) {
|
|
@@ -24562,13 +24596,31 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
24562
24596
|
LOG2.info("MeshEvents", `Suppressed ${args.event} for intentionally cleanup-stopped session ${eventSessionId || "(unknown session)"}`);
|
|
24563
24597
|
return { success: true, forwarded: 0, suppressed: true, intentionalCleanupStop: true };
|
|
24564
24598
|
}
|
|
24599
|
+
const eventTimestamp = readEventTimestamp(args.metadataEvent.timestamp);
|
|
24600
|
+
if (args.event === "agent:generating_completed" && eventSessionId) {
|
|
24601
|
+
const duplicateCompletion = isDuplicateMeshCompletionEvent({
|
|
24602
|
+
meshId: args.meshId,
|
|
24603
|
+
event: args.event,
|
|
24604
|
+
sessionId: eventSessionId,
|
|
24605
|
+
providerType: readNonEmptyString(args.metadataEvent.providerType) || void 0,
|
|
24606
|
+
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
24607
|
+
timestamp: eventTimestamp,
|
|
24608
|
+
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
|
|
24609
|
+
});
|
|
24610
|
+
if (duplicateCompletion) {
|
|
24611
|
+
LOG2.info("MeshEvents", `Suppressed duplicate completion for mesh ${args.meshId} session ${eventSessionId}`);
|
|
24612
|
+
return { success: true, forwarded: 0, suppressed: true, duplicateCompletion: true };
|
|
24613
|
+
}
|
|
24614
|
+
}
|
|
24565
24615
|
let completedTaskForLedger = null;
|
|
24566
24616
|
if (args.event === "agent:generating_completed") {
|
|
24567
24617
|
const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
|
|
24568
24618
|
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
24569
24619
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
24570
24620
|
if (sessionId) {
|
|
24571
|
-
const completedTask = updateSessionTaskStatus(args.meshId, sessionId, "completed"
|
|
24621
|
+
const completedTask = updateSessionTaskStatus(args.meshId, sessionId, "completed", {
|
|
24622
|
+
occurredAt: eventTimestamp !== null ? new Date(eventTimestamp).toISOString() : void 0
|
|
24623
|
+
});
|
|
24572
24624
|
completedTaskForLedger = completedTask ? { id: completedTask.id } : null;
|
|
24573
24625
|
if (nodeId && providerType) {
|
|
24574
24626
|
setImmediate(() => {
|
|
@@ -24782,6 +24834,7 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
24782
24834
|
providerType: readNonEmptyString(payload.providerType),
|
|
24783
24835
|
providerSessionId: readNonEmptyString(payload.providerSessionId),
|
|
24784
24836
|
finalSummary: readNonEmptyString(payload.finalSummary) || readNonEmptyString(payload.summary),
|
|
24837
|
+
...payload.timestamp !== void 0 ? { timestamp: payload.timestamp } : {},
|
|
24785
24838
|
intentional: payload.intentional === true,
|
|
24786
24839
|
intentionalStop: payload.intentionalStop === true,
|
|
24787
24840
|
operatorCleanup: payload.operatorCleanup === true,
|
|
@@ -24831,6 +24884,8 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
24831
24884
|
var MESH_COORDINATOR_EVENTS;
|
|
24832
24885
|
var EVENT_TO_LEDGER_KIND;
|
|
24833
24886
|
var INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS;
|
|
24887
|
+
var RECENT_COMPLETION_FINGERPRINT_TTL_MS;
|
|
24888
|
+
var recentCompletionFingerprints;
|
|
24834
24889
|
var autoLaunchInProgress;
|
|
24835
24890
|
var autoLaunchCooldownUntil;
|
|
24836
24891
|
var AUTO_LAUNCH_COOLDOWN_MS;
|
|
@@ -24862,6 +24917,8 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
24862
24917
|
"monitor:long_generating": "task_stalled"
|
|
24863
24918
|
};
|
|
24864
24919
|
INTENTIONAL_CLEANUP_STOP_SUPPRESSION_MS = 30 * 60 * 1e3;
|
|
24920
|
+
RECENT_COMPLETION_FINGERPRINT_TTL_MS = 10 * 60 * 1e3;
|
|
24921
|
+
recentCompletionFingerprints = /* @__PURE__ */ new Map();
|
|
24865
24922
|
autoLaunchInProgress = /* @__PURE__ */ new Set();
|
|
24866
24923
|
autoLaunchCooldownUntil = /* @__PURE__ */ new Map();
|
|
24867
24924
|
AUTO_LAUNCH_COOLDOWN_MS = 5e3;
|
|
@@ -46015,49 +46072,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46015
46072
|
}).filter((entry) => entry !== null);
|
|
46016
46073
|
return submodules.length > 0 ? submodules : void 0;
|
|
46017
46074
|
}
|
|
46018
|
-
function
|
|
46019
|
-
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
46020
|
-
const cachedGit = readObjectRecord(cachedStatus.git);
|
|
46021
|
-
if (Object.keys(cachedGit).length) {
|
|
46022
|
-
const conflictFiles2 = Array.isArray(cachedGit.conflictFiles) ? cachedGit.conflictFiles.filter((value) => typeof value === "string") : [];
|
|
46023
|
-
const conflictCount2 = readNumberValue(cachedGit.conflicts) ?? conflictFiles2.length;
|
|
46024
|
-
const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
|
|
46025
|
-
const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
|
|
46026
|
-
if (isGitRepo2 !== void 0) {
|
|
46027
|
-
const submodules2 = readGitSubmodules(cachedGit.submodules);
|
|
46028
|
-
return {
|
|
46029
|
-
workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
|
|
46030
|
-
repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
|
|
46031
|
-
isGitRepo: isGitRepo2,
|
|
46032
|
-
branch: readStringValue(cachedGit.branch) ?? null,
|
|
46033
|
-
headCommit: readStringValue(cachedGit.headCommit) ?? null,
|
|
46034
|
-
headMessage: readStringValue(cachedGit.headMessage) ?? null,
|
|
46035
|
-
upstream: readStringValue(cachedGit.upstream) ?? null,
|
|
46036
|
-
ahead: readNumberValue(cachedGit.ahead) ?? 0,
|
|
46037
|
-
behind: readNumberValue(cachedGit.behind) ?? 0,
|
|
46038
|
-
staged: readNumberValue(cachedGit.staged) ?? 0,
|
|
46039
|
-
modified: readNumberValue(cachedGit.modified) ?? 0,
|
|
46040
|
-
untracked: readNumberValue(cachedGit.untracked) ?? 0,
|
|
46041
|
-
deleted: readNumberValue(cachedGit.deleted) ?? 0,
|
|
46042
|
-
renamed: readNumberValue(cachedGit.renamed) ?? 0,
|
|
46043
|
-
hasConflicts: hasConflicts2,
|
|
46044
|
-
conflictFiles: conflictFiles2,
|
|
46045
|
-
stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
|
|
46046
|
-
lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now(),
|
|
46047
|
-
...submodules2 ? { submodules: submodules2 } : {}
|
|
46048
|
-
};
|
|
46049
|
-
}
|
|
46050
|
-
}
|
|
46051
|
-
const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
|
|
46052
|
-
const gitResult = readObjectRecord(rawGit.result);
|
|
46053
|
-
const directStatus = readObjectRecord(rawGit.status);
|
|
46054
|
-
const nestedStatus = readObjectRecord(gitResult.status);
|
|
46055
|
-
const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
|
|
46056
|
-
const probeGit = readObjectRecord(rawProbe.git);
|
|
46057
|
-
const probeGitResult = readObjectRecord(probeGit.result);
|
|
46058
|
-
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
46059
|
-
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
46060
|
-
const status = Object.keys(directStatus).length ? directStatus : Object.keys(nestedStatus).length ? nestedStatus : Object.keys(probeDirectStatus).length ? probeDirectStatus : Object.keys(probeNestedStatus).length ? probeNestedStatus : {};
|
|
46075
|
+
function normalizeInlineMeshGitStatus(status, node, options) {
|
|
46061
46076
|
const isGitRepo = readBooleanValue(status.isGitRepo);
|
|
46062
46077
|
if (!Object.keys(status).length || isGitRepo === void 0) return void 0;
|
|
46063
46078
|
const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
|
|
@@ -46082,10 +46097,31 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46082
46097
|
hasConflicts,
|
|
46083
46098
|
conflictFiles,
|
|
46084
46099
|
stashCount: readNumberValue(status.stashCount) ?? 0,
|
|
46085
|
-
lastCheckedAt: Date.now(),
|
|
46100
|
+
lastCheckedAt: options?.lastCheckedAt ?? readNumberValue(status.lastCheckedAt) ?? Date.now(),
|
|
46086
46101
|
...submodules ? { submodules } : {}
|
|
46087
46102
|
};
|
|
46088
46103
|
}
|
|
46104
|
+
function buildInlineMeshTransitGitStatus(node) {
|
|
46105
|
+
const rawGit = readObjectRecord(node?.lastGit ?? node?.last_git);
|
|
46106
|
+
const gitResult = readObjectRecord(rawGit.result);
|
|
46107
|
+
const directStatus = readObjectRecord(rawGit.status);
|
|
46108
|
+
const nestedStatus = readObjectRecord(gitResult.status);
|
|
46109
|
+
const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
|
|
46110
|
+
const probeGit = readObjectRecord(rawProbe.git);
|
|
46111
|
+
const probeGitResult = readObjectRecord(probeGit.result);
|
|
46112
|
+
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
46113
|
+
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
46114
|
+
const status = Object.keys(directStatus).length ? directStatus : Object.keys(nestedStatus).length ? nestedStatus : Object.keys(probeDirectStatus).length ? probeDirectStatus : Object.keys(probeNestedStatus).length ? probeNestedStatus : {};
|
|
46115
|
+
return normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
|
|
46116
|
+
}
|
|
46117
|
+
function buildCachedInlineMeshGitStatus(node) {
|
|
46118
|
+
const liveGit = buildInlineMeshTransitGitStatus(node);
|
|
46119
|
+
if (liveGit) return liveGit;
|
|
46120
|
+
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
46121
|
+
const cachedGit = readObjectRecord(cachedStatus.git);
|
|
46122
|
+
if (!Object.keys(cachedGit).length) return void 0;
|
|
46123
|
+
return normalizeInlineMeshGitStatus(cachedGit, node);
|
|
46124
|
+
}
|
|
46089
46125
|
function shouldDiscardCachedInlineMeshStatus(node) {
|
|
46090
46126
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
46091
46127
|
if (!Object.keys(cachedStatus).length) return false;
|
|
@@ -46314,9 +46350,10 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
|
|
|
46314
46350
|
}
|
|
46315
46351
|
function applyCachedInlineMeshNodeStatus(status, node) {
|
|
46316
46352
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
46317
|
-
const
|
|
46318
|
-
const
|
|
46319
|
-
const
|
|
46353
|
+
const liveGit = buildInlineMeshTransitGitStatus(node);
|
|
46354
|
+
const git = liveGit ?? buildCachedInlineMeshGitStatus(node);
|
|
46355
|
+
const error48 = liveGit ? void 0 : readStringValue(cachedStatus.error, node?.error);
|
|
46356
|
+
const health = liveGit ? void 0 : readStringValue(cachedStatus.health, node?.health);
|
|
46320
46357
|
const machineStatus = readStringValue(cachedStatus.machineStatus, node?.machineStatus);
|
|
46321
46358
|
const lastSeenAt = toIsoTimestamp(cachedStatus.lastSeenAt ?? cachedStatus.last_seen_at ?? node?.lastSeenAt ?? node?.last_seen_at);
|
|
46322
46359
|
const updatedAt = toIsoTimestamp(cachedStatus.updatedAt ?? cachedStatus.updated_at ?? node?.updatedAt ?? node?.updated_at);
|