@adhdev/daemon-standalone 1.0.45-rc.11 → 1.0.45-rc.12
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 +110 -50
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/index-s_TifdFn.js +116 -0
- package/public/index.html +1 -1
- package/vendor/mcp-server/index.js +79 -9
- package/vendor/mcp-server/index.js.map +1 -1
- package/public/assets/index-digx-PVW.js +0 -116
package/dist/index.js
CHANGED
|
@@ -36243,13 +36243,15 @@ var require_dist3 = __commonJS({
|
|
|
36243
36243
|
const sessionResetImminentMs = Number(value?.sessionResetImminentMs);
|
|
36244
36244
|
const weeklyMin = Number(value?.weeklyMinRemainingPercent);
|
|
36245
36245
|
const spreadMax = Number(value?.spreadBonusMax);
|
|
36246
|
+
const sessionAxisHeadroom = Number(value?.sessionAxisWeeklyHeadroomPercent);
|
|
36246
36247
|
const clampPercentField = (n, fallback) => Number.isFinite(n) ? Math.min(100, Math.max(0, n)) : fallback;
|
|
36247
36248
|
return {
|
|
36248
36249
|
staleAfterMs: Number.isFinite(staleAfterMs) && staleAfterMs >= 0 ? Math.floor(staleAfterMs) : DEFAULT_QUOTA_ROUTING_POLICY.staleAfterMs,
|
|
36249
36250
|
sessionMinRemainingPercent: clampPercentField(sessionMin, DEFAULT_QUOTA_ROUTING_POLICY.sessionMinRemainingPercent),
|
|
36250
36251
|
sessionResetImminentMs: Number.isFinite(sessionResetImminentMs) && sessionResetImminentMs >= 0 ? Math.floor(sessionResetImminentMs) : DEFAULT_QUOTA_ROUTING_POLICY.sessionResetImminentMs,
|
|
36251
36252
|
weeklyMinRemainingPercent: clampPercentField(weeklyMin, DEFAULT_QUOTA_ROUTING_POLICY.weeklyMinRemainingPercent),
|
|
36252
|
-
spreadBonusMax: Number.isFinite(spreadMax) && spreadMax >= 0 ? spreadMax : DEFAULT_QUOTA_ROUTING_POLICY.spreadBonusMax
|
|
36253
|
+
spreadBonusMax: Number.isFinite(spreadMax) && spreadMax >= 0 ? spreadMax : DEFAULT_QUOTA_ROUTING_POLICY.spreadBonusMax,
|
|
36254
|
+
sessionAxisWeeklyHeadroomPercent: clampPercentField(sessionAxisHeadroom, DEFAULT_QUOTA_ROUTING_POLICY.sessionAxisWeeklyHeadroomPercent)
|
|
36253
36255
|
};
|
|
36254
36256
|
}
|
|
36255
36257
|
function normalizeQuotaRoutingPolicy(value) {
|
|
@@ -36272,6 +36274,9 @@ var require_dist3 = __commonJS({
|
|
|
36272
36274
|
if (record2.spreadBonusMax !== void 0 && resolved.spreadBonusMax !== DEFAULT_QUOTA_ROUTING_POLICY.spreadBonusMax) {
|
|
36273
36275
|
out.spreadBonusMax = resolved.spreadBonusMax;
|
|
36274
36276
|
}
|
|
36277
|
+
if (record2.sessionAxisWeeklyHeadroomPercent !== void 0 && resolved.sessionAxisWeeklyHeadroomPercent !== DEFAULT_QUOTA_ROUTING_POLICY.sessionAxisWeeklyHeadroomPercent) {
|
|
36278
|
+
out.sessionAxisWeeklyHeadroomPercent = resolved.sessionAxisWeeklyHeadroomPercent;
|
|
36279
|
+
}
|
|
36275
36280
|
return Object.keys(out).length ? out : void 0;
|
|
36276
36281
|
}
|
|
36277
36282
|
function resolveCoordinatorIdlePushPolicy(meshPolicy) {
|
|
@@ -36507,7 +36512,8 @@ var require_dist3 = __commonJS({
|
|
|
36507
36512
|
sessionMinRemainingPercent: 10,
|
|
36508
36513
|
sessionResetImminentMs: 5 * 60 * 1e3,
|
|
36509
36514
|
weeklyMinRemainingPercent: 15,
|
|
36510
|
-
spreadBonusMax: 30
|
|
36515
|
+
spreadBonusMax: 30,
|
|
36516
|
+
sessionAxisWeeklyHeadroomPercent: 40
|
|
36511
36517
|
};
|
|
36512
36518
|
SILENT_IDLE_PUSH_TTL_MS = 10 * 60 * 1e3;
|
|
36513
36519
|
SESSION_CLEANUP_MODES = /* @__PURE__ */ new Set([
|
|
@@ -37050,10 +37056,10 @@ var require_dist3 = __commonJS({
|
|
|
37050
37056
|
}
|
|
37051
37057
|
function getDaemonBuildInfo() {
|
|
37052
37058
|
if (cached2) return cached2;
|
|
37053
|
-
const commit = readInjected(true ? "
|
|
37054
|
-
const commitShort = readInjected(true ? "
|
|
37055
|
-
const version2 = readInjected(true ? "1.0.45-rc.
|
|
37056
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
37059
|
+
const commit = readInjected(true ? "53ce46737f62c60778e7be104c67d7f4387646aa" : void 0) ?? "unknown";
|
|
37060
|
+
const commitShort = readInjected(true ? "53ce4673" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
37061
|
+
const version2 = readInjected(true ? "1.0.45-rc.12" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
37062
|
+
const builtAt = readInjected(true ? "2026-08-13T17:03:06.466Z" : void 0);
|
|
37057
37063
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
37058
37064
|
return cached2;
|
|
37059
37065
|
}
|
|
@@ -40396,7 +40402,9 @@ child.on('exit', () => process.exit(0));
|
|
|
40396
40402
|
const kind = typeof fresh.metadata?.failureKind === "string" ? fresh.metadata.failureKind : "";
|
|
40397
40403
|
const transient = TRANSIENT_QUOTA_FAILURE_KINDS.has(kind);
|
|
40398
40404
|
if (!transient) return fresh;
|
|
40399
|
-
const
|
|
40405
|
+
const prevIsFreshOk = !!prev && prev.status === "ok";
|
|
40406
|
+
const prevIsCarriedForward = !!prev && prev.metadata?.lastGoodWindows === true;
|
|
40407
|
+
const prevHasWindows = (prevIsFreshOk || prevIsCarriedForward) && (prev.session !== null || prev.weekly !== null);
|
|
40400
40408
|
if (!prevHasWindows) return fresh;
|
|
40401
40409
|
return {
|
|
40402
40410
|
...fresh,
|
|
@@ -47619,6 +47627,19 @@ Next step: ${nextStep}`;
|
|
|
47619
47627
|
stack.push(...adjacency.get(current) ?? []);
|
|
47620
47628
|
}
|
|
47621
47629
|
}
|
|
47630
|
+
function assertMeshTaskDifficulty(value, callerLabel) {
|
|
47631
|
+
if (value === void 0 || value === null || typeof value === "string" && !value.trim()) {
|
|
47632
|
+
throw new Error(
|
|
47633
|
+
`missing_task_difficulty: ${callerLabel} requires a 'difficulty'. Allowed values: ${MESH_TASK_DIFFICULTIES.join(" | ")}. Classify the task by how hard the work actually is.`
|
|
47634
|
+
);
|
|
47635
|
+
}
|
|
47636
|
+
if (!isMeshTaskDifficulty(value)) {
|
|
47637
|
+
throw new Error(
|
|
47638
|
+
`invalid_task_difficulty: ${callerLabel} received an unrecognized 'difficulty' value ${JSON.stringify(value)}. Allowed values: ${MESH_TASK_DIFFICULTIES.join(" | ")}.`
|
|
47639
|
+
);
|
|
47640
|
+
}
|
|
47641
|
+
return value;
|
|
47642
|
+
}
|
|
47622
47643
|
function enqueueTask(meshId, message, opts) {
|
|
47623
47644
|
requireMeshHostQueueOwner(opts);
|
|
47624
47645
|
message = String(message ?? "").trim();
|
|
@@ -47639,22 +47660,20 @@ Next step: ${nextStep}`;
|
|
|
47639
47660
|
let effectiveThinkingLevel = typeof opts?.thinkingLevel === "string" && opts.thinkingLevel.trim() ? opts.thinkingLevel.trim() : void 0;
|
|
47640
47661
|
let modelSource = effectiveModel ? "explicit" : void 0;
|
|
47641
47662
|
let thinkingLevelSource = effectiveThinkingLevel ? "explicit" : void 0;
|
|
47642
|
-
const taskDifficulty =
|
|
47643
|
-
|
|
47644
|
-
|
|
47645
|
-
|
|
47646
|
-
if (preset) {
|
|
47647
|
-
|
|
47648
|
-
|
|
47649
|
-
|
|
47650
|
-
|
|
47651
|
-
|
|
47652
|
-
|
|
47653
|
-
thinkingLevelSource = "preset";
|
|
47654
|
-
}
|
|
47663
|
+
const taskDifficulty = assertMeshTaskDifficulty(opts?.difficulty, "enqueueTask");
|
|
47664
|
+
try {
|
|
47665
|
+
const preset = getDifficultyBrains(meshId)[taskDifficulty];
|
|
47666
|
+
if (preset) {
|
|
47667
|
+
if (!effectiveModel && preset.model) {
|
|
47668
|
+
effectiveModel = preset.model;
|
|
47669
|
+
modelSource = "preset";
|
|
47670
|
+
}
|
|
47671
|
+
if (!effectiveThinkingLevel && preset.thinkingLevel) {
|
|
47672
|
+
effectiveThinkingLevel = preset.thinkingLevel;
|
|
47673
|
+
thinkingLevelSource = "preset";
|
|
47655
47674
|
}
|
|
47656
|
-
} catch {
|
|
47657
47675
|
}
|
|
47676
|
+
} catch {
|
|
47658
47677
|
}
|
|
47659
47678
|
const result = withQueueLock(meshId, () => {
|
|
47660
47679
|
if (MeshRuntimeStore.getInstance().findQueueEntryById(meshId, id)) {
|
|
@@ -47689,7 +47708,7 @@ Next step: ${nextStep}`;
|
|
|
47689
47708
|
...typeof opts?.consensusGroupId === "string" && opts.consensusGroupId.trim() ? { consensusGroupId: opts.consensusGroupId.trim() } : {},
|
|
47690
47709
|
...effectiveModel && modelSource ? { model: effectiveModel, modelSource } : {},
|
|
47691
47710
|
...effectiveThinkingLevel && thinkingLevelSource ? { thinkingLevel: effectiveThinkingLevel, thinkingLevelSource } : {},
|
|
47692
|
-
|
|
47711
|
+
difficulty: taskDifficulty,
|
|
47693
47712
|
...typeof opts?.sourceCoordinatorSessionId === "string" && opts.sourceCoordinatorSessionId.trim() ? { sourceCoordinatorSessionId: opts.sourceCoordinatorSessionId.trim() } : {},
|
|
47694
47713
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
47695
47714
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -47708,6 +47727,7 @@ Next step: ${nextStep}`;
|
|
|
47708
47727
|
if (!message) {
|
|
47709
47728
|
throw new Error("mesh task message must be a non-empty string");
|
|
47710
47729
|
}
|
|
47730
|
+
const taskDifficulty = assertMeshTaskDifficulty(opts.difficulty, "recordDirectDispatchTask");
|
|
47711
47731
|
const readonly2 = opts.readonly === true;
|
|
47712
47732
|
const modeValidation = validateMeshTaskModeRequest(opts.taskMode, message, readonly2);
|
|
47713
47733
|
if (!modeValidation.valid) {
|
|
@@ -47726,6 +47746,7 @@ Next step: ${nextStep}`;
|
|
|
47726
47746
|
...modeValidation.taskMode ? { taskMode: modeValidation.taskMode } : {},
|
|
47727
47747
|
...readonly2 ? { readonly: true } : {},
|
|
47728
47748
|
...missionId ? { missionId } : {},
|
|
47749
|
+
difficulty: taskDifficulty,
|
|
47729
47750
|
...opts.assignedNodeId ? { targetNodeId: opts.assignedNodeId, assignedNodeId: opts.assignedNodeId } : {},
|
|
47730
47751
|
...opts.assignedSessionId ? { targetSessionId: opts.assignedSessionId, assignedSessionId: opts.assignedSessionId } : {},
|
|
47731
47752
|
dispatchTimestamp: now,
|
|
@@ -51823,6 +51844,12 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
51823
51844
|
if (lastDispatch !== null && failureCountDone) break;
|
|
51824
51845
|
}
|
|
51825
51846
|
const lastTaskMessage = typeof lastDispatch?.payload?.message === "string" ? lastDispatch.payload.message : null;
|
|
51847
|
+
let lastTaskDifficulty = null;
|
|
51848
|
+
const routingDecision = lastDispatch?.payload?.routingDecision;
|
|
51849
|
+
if (routingDecision && typeof routingDecision === "object") {
|
|
51850
|
+
const resolved = routingDecision.resolvedDifficulty;
|
|
51851
|
+
if (isMeshTaskDifficulty(resolved)) lastTaskDifficulty = resolved;
|
|
51852
|
+
}
|
|
51826
51853
|
let taskAttemptCount = 0;
|
|
51827
51854
|
if (lastDispatch) {
|
|
51828
51855
|
const taskId = typeof lastDispatch.payload?.taskId === "string" ? lastDispatch.payload.taskId : null;
|
|
@@ -51851,6 +51878,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
51851
51878
|
}
|
|
51852
51879
|
return {
|
|
51853
51880
|
lastTaskMessage,
|
|
51881
|
+
lastTaskDifficulty,
|
|
51854
51882
|
failedNodeId: opts.nodeId || null,
|
|
51855
51883
|
failedSessionId: opts.sessionId || null,
|
|
51856
51884
|
failedProviderType: null,
|
|
@@ -57748,21 +57776,23 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57748
57776
|
}
|
|
57749
57777
|
return null;
|
|
57750
57778
|
}
|
|
57751
|
-
function
|
|
57779
|
+
function expiryRiskForRanking(node, providerType, axis, policy, now = Date.now()) {
|
|
57752
57780
|
const entry = quotaEntryFor(node, providerType);
|
|
57753
57781
|
if (!entry) return void 0;
|
|
57754
57782
|
const { facts, quota } = entry;
|
|
57755
57783
|
if (quota.status !== "ok") return void 0;
|
|
57756
57784
|
if (!isQuotaSnapshotFresh(facts, quota, policy, now)) return void 0;
|
|
57757
|
-
const
|
|
57785
|
+
const window = axis === "session" ? quota.session : quota.weekly;
|
|
57786
|
+
const remaining = remainingPercent(window);
|
|
57758
57787
|
if (remaining === void 0) return void 0;
|
|
57759
|
-
const resetsAt = Number(
|
|
57788
|
+
const resetsAt = Number(window?.resetsAt);
|
|
57760
57789
|
if (!Number.isFinite(resetsAt) || resetsAt <= 0) return { remainingPercent: remaining, risk: 0 };
|
|
57761
57790
|
const ageMs2 = quotaSnapshotAgeMs(facts, quota, now);
|
|
57762
57791
|
if (!Number.isFinite(ageMs2)) return { remainingPercent: remaining, risk: 0 };
|
|
57763
57792
|
const reporterNowMs = Number(quota.updatedAt) + ageMs2;
|
|
57764
|
-
const windowMinutes2 = Number(
|
|
57765
|
-
const
|
|
57793
|
+
const windowMinutes2 = Number(window?.windowMinutes);
|
|
57794
|
+
const fallbackMinutes = axis === "session" ? DEFAULT_SESSION_WINDOW_MINUTES : DEFAULT_WEEKLY_WINDOW_MINUTES;
|
|
57795
|
+
const windowMs = (Number.isFinite(windowMinutes2) && windowMinutes2 > 0 ? windowMinutes2 : fallbackMinutes) * 60 * 1e3;
|
|
57766
57796
|
const elapsedFraction = Math.min(1, Math.max(0, 1 - (resetsAt - reporterNowMs) / windowMs));
|
|
57767
57797
|
return { remainingPercent: remaining, risk: remaining * elapsedFraction };
|
|
57768
57798
|
}
|
|
@@ -57774,13 +57804,28 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57774
57804
|
if (block2) gated.push({ providerType, block: block2 });
|
|
57775
57805
|
else clear.push(providerType);
|
|
57776
57806
|
}
|
|
57777
|
-
const weeklyByProvider = new Map(clear.map((p) => [p,
|
|
57807
|
+
const weeklyByProvider = new Map(clear.map((p) => [p, expiryRiskForRanking(node, p, "weekly", policy, now)]));
|
|
57808
|
+
const headroomPercent = resolveQuotaRoutingPolicy(policy).sessionAxisWeeklyHeadroomPercent;
|
|
57809
|
+
const weeklyMeasured = [...weeklyByProvider.values()].filter((w) => w !== void 0);
|
|
57810
|
+
const sessionAxisActive = weeklyMeasured.length > 0 && weeklyMeasured.every((w) => w.remainingPercent > headroomPercent);
|
|
57811
|
+
const sessionByProvider = sessionAxisActive ? new Map(clear.map((p) => [p, expiryRiskForRanking(node, p, "session", policy, now)])) : void 0;
|
|
57778
57812
|
clear.sort((a, b) => {
|
|
57779
57813
|
const wa = weeklyByProvider.get(a);
|
|
57780
57814
|
const wb = weeklyByProvider.get(b);
|
|
57781
57815
|
if (wa === void 0 && wb === void 0) return 0;
|
|
57782
57816
|
if (wa === void 0) return 1;
|
|
57783
57817
|
if (wb === void 0) return -1;
|
|
57818
|
+
if (sessionByProvider) {
|
|
57819
|
+
const sa = sessionByProvider.get(a);
|
|
57820
|
+
const sb = sessionByProvider.get(b);
|
|
57821
|
+
if (sa !== void 0 && sb !== void 0) {
|
|
57822
|
+
if (sb.risk !== sa.risk) return sb.risk - sa.risk;
|
|
57823
|
+
if (sb.remainingPercent !== sa.remainingPercent) {
|
|
57824
|
+
return sb.remainingPercent - sa.remainingPercent;
|
|
57825
|
+
}
|
|
57826
|
+
} else if (sa !== void 0) return -1;
|
|
57827
|
+
else if (sb !== void 0) return 1;
|
|
57828
|
+
}
|
|
57784
57829
|
if (wb.risk !== wa.risk) return wb.risk - wa.risk;
|
|
57785
57830
|
return wb.remainingPercent - wa.remainingPercent;
|
|
57786
57831
|
});
|
|
@@ -57809,7 +57854,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57809
57854
|
}
|
|
57810
57855
|
function quotaRiskSnapshotForCandidates(node, orderedProviderTypes, policy, now = Date.now()) {
|
|
57811
57856
|
return orderedProviderTypes.map((providerType) => {
|
|
57812
|
-
const w =
|
|
57857
|
+
const w = expiryRiskForRanking(node, providerType, "weekly", policy, now);
|
|
57813
57858
|
return {
|
|
57814
57859
|
providerType,
|
|
57815
57860
|
...w ? { remainingPercent: w.remainingPercent, risk: w.risk } : {}
|
|
@@ -57848,6 +57893,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57848
57893
|
var PROVIDER_QUOTA_EXHAUSTED_SKIP_REASON;
|
|
57849
57894
|
var ALL_PROVIDERS_QUOTA_GATED_SKIP_REASON;
|
|
57850
57895
|
var DEFAULT_WEEKLY_WINDOW_MINUTES;
|
|
57896
|
+
var DEFAULT_SESSION_WINDOW_MINUTES;
|
|
57851
57897
|
var lastQuotaRankingByNode;
|
|
57852
57898
|
var init_mesh_quota_routing = __esm2({
|
|
57853
57899
|
"src/mesh/mesh-quota-routing.ts"() {
|
|
@@ -57858,6 +57904,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
57858
57904
|
PROVIDER_QUOTA_EXHAUSTED_SKIP_REASON = "provider_quota_exhausted";
|
|
57859
57905
|
ALL_PROVIDERS_QUOTA_GATED_SKIP_REASON = "all_providers_quota_gated";
|
|
57860
57906
|
DEFAULT_WEEKLY_WINDOW_MINUTES = 7 * 24 * 60;
|
|
57907
|
+
DEFAULT_SESSION_WINDOW_MINUTES = 5 * 60;
|
|
57861
57908
|
lastQuotaRankingByNode = /* @__PURE__ */ new Map();
|
|
57862
57909
|
}
|
|
57863
57910
|
});
|
|
@@ -66257,8 +66304,13 @@ ${cleanBody}`;
|
|
|
66257
66304
|
if (recoveryContext.lastTaskMessage && recoveryContext.failedNodeId && recoveryContext.failedProviderType) {
|
|
66258
66305
|
const autoNodeId = recoveryContext.failedNodeId;
|
|
66259
66306
|
try {
|
|
66307
|
+
const inheritedDifficulty = recoveryContext.lastTaskDifficulty ?? "freeform";
|
|
66308
|
+
if (!recoveryContext.lastTaskDifficulty) {
|
|
66309
|
+
LOG2.info("MeshRecovery", `No inheritable difficulty on the failed task's dispatch entry; relaunching with 'freeform' (ordinary routing).`);
|
|
66310
|
+
}
|
|
66260
66311
|
const task = enqueueTask(args.meshId, recoveryContext.lastTaskMessage, {
|
|
66261
|
-
targetNodeId: autoNodeId
|
|
66312
|
+
targetNodeId: autoNodeId,
|
|
66313
|
+
difficulty: inheritedDifficulty
|
|
66262
66314
|
});
|
|
66263
66315
|
LOG2.info("MeshRecovery", `Auto-requeued failed task: ${task.id} for node ${autoNodeId}`);
|
|
66264
66316
|
const node = mesh?.nodes.find((n) => meshNodeIdMatches(n, autoNodeId));
|
|
@@ -79397,6 +79449,7 @@ ${lastSnapshot}`;
|
|
|
79397
79449
|
enqueueTask: () => enqueueTask,
|
|
79398
79450
|
ensureSessionHostReady: () => ensureSessionHostReady2,
|
|
79399
79451
|
evaluateFsm: () => evaluateFsm,
|
|
79452
|
+
evaluateProviderQuotaGate: () => evaluateProviderQuotaGate,
|
|
79400
79453
|
execNpmCommandSync: () => execNpmCommandSync,
|
|
79401
79454
|
expandDaemonIdForms: () => expandDaemonIdForms,
|
|
79402
79455
|
fastForwardMeshNode: () => fastForwardMeshNode,
|
|
@@ -79584,6 +79637,8 @@ ${lastSnapshot}`;
|
|
|
79584
79637
|
pruneOperatingNotes: () => pruneOperatingNotes,
|
|
79585
79638
|
pruneStaleDirectDispatches: () => pruneStaleDirectDispatches,
|
|
79586
79639
|
queuePendingMeshCoordinatorEvent: () => queuePendingMeshCoordinatorEvent,
|
|
79640
|
+
quotaRiskSnapshotForCandidates: () => quotaRiskSnapshotForCandidates,
|
|
79641
|
+
rankProvidersByQuotaGate: () => rankProvidersByQuotaGate,
|
|
79587
79642
|
readAntigravityCliSession: () => readSession3,
|
|
79588
79643
|
readCachedInlineMeshActiveSessionDetails: () => readCachedInlineMeshActiveSessionDetails2,
|
|
79589
79644
|
readChatHistory: () => readChatHistory,
|
|
@@ -81634,6 +81689,7 @@ ${lastSnapshot}`;
|
|
|
81634
81689
|
init_mesh_magi_status();
|
|
81635
81690
|
init_mesh_scheduling_runtime();
|
|
81636
81691
|
init_mesh_quota_routing();
|
|
81692
|
+
init_mesh_quota_routing();
|
|
81637
81693
|
init_mesh_host_ownership();
|
|
81638
81694
|
init_mesh_events();
|
|
81639
81695
|
init_mesh_turn_presentation();
|
|
@@ -116588,9 +116644,8 @@ ${e?.stderr || ""}`;
|
|
|
116588
116644
|
} };
|
|
116589
116645
|
}
|
|
116590
116646
|
const cleanupStarted = Date.now();
|
|
116591
|
-
const
|
|
116592
|
-
|
|
116593
|
-
);
|
|
116647
|
+
const explicitRefineSessionCleanupPolicy = mesh?.policy?.sessionCleanupOnNodeRemove;
|
|
116648
|
+
const refineSessionCleanupMode = explicitRefineSessionCleanupPolicy ? self.normalizeMeshSessionCleanupMode(explicitRefineSessionCleanupPolicy) : void 0;
|
|
116594
116649
|
let refineSessionIds;
|
|
116595
116650
|
if (refineSessionCleanupMode !== "preserve" && self.deps.sessionHostControl) {
|
|
116596
116651
|
try {
|
|
@@ -116611,7 +116666,7 @@ ${e?.stderr || ""}`;
|
|
|
116611
116666
|
const removeResult = await self.execute("remove_mesh_node", {
|
|
116612
116667
|
meshId,
|
|
116613
116668
|
nodeId,
|
|
116614
|
-
sessionCleanupMode: refineSessionCleanupMode,
|
|
116669
|
+
...refineSessionCleanupMode ? { sessionCleanupMode: refineSessionCleanupMode } : {},
|
|
116615
116670
|
...refineSessionIds && refineSessionIds.length > 0 ? { sessionIds: refineSessionIds } : {},
|
|
116616
116671
|
inlineMesh: args?.inlineMesh,
|
|
116617
116672
|
// REFINE-CLEANUP: refine reaches cleanup only AFTER a verified merge AND a
|
|
@@ -117641,20 +117696,23 @@ ${e?.stderr || ""}`;
|
|
|
117641
117696
|
const dirty = message.includes("dirty worktree") || message.includes("local changes");
|
|
117642
117697
|
const isSubmoduleGuard = /working trees containing submodules cannot be moved or removed/i.test(message);
|
|
117643
117698
|
const submoduleForceBlocked = isSubmoduleGuard && !forceFallbackConvergence.allow;
|
|
117644
|
-
if (
|
|
117699
|
+
if (forceFallbackConvergence.allow && !dirty) {
|
|
117645
117700
|
const { execFile: execFile7 } = await import("child_process");
|
|
117646
117701
|
const { promisify: promisify10 } = await import("util");
|
|
117647
117702
|
const execFileAsync6 = promisify10(execFile7);
|
|
117648
117703
|
const GIT_TIMEOUT_CLEANUP = 3e4;
|
|
117649
117704
|
const GIT_MAX_BUFFER_CLEANUP = 4 * 1024 * 1024;
|
|
117705
|
+
const fallbackReason = isSubmoduleGuard ? "working_trees_containing_submodules" : "worktree_remove_failed";
|
|
117650
117706
|
try {
|
|
117651
|
-
|
|
117652
|
-
|
|
117653
|
-
|
|
117654
|
-
|
|
117655
|
-
|
|
117656
|
-
|
|
117657
|
-
|
|
117707
|
+
if (isSubmoduleGuard) {
|
|
117708
|
+
await execFileAsync6("git", ["-C", workspace, "submodule", "deinit", "--all", "-f"], {
|
|
117709
|
+
encoding: "utf8",
|
|
117710
|
+
timeout: GIT_TIMEOUT_CLEANUP,
|
|
117711
|
+
maxBuffer: GIT_MAX_BUFFER_CLEANUP,
|
|
117712
|
+
windowsHide: true,
|
|
117713
|
+
env: gitChildEnv()
|
|
117714
|
+
});
|
|
117715
|
+
}
|
|
117658
117716
|
await execFileAsync6("git", ["worktree", "remove", "--force", workspace], {
|
|
117659
117717
|
cwd: repoRoot,
|
|
117660
117718
|
encoding: "utf8",
|
|
@@ -117669,9 +117727,9 @@ ${e?.stderr || ""}`;
|
|
|
117669
117727
|
removedPath: workspace,
|
|
117670
117728
|
repoRoot,
|
|
117671
117729
|
...branchOutcome,
|
|
117672
|
-
fallback: "git_worktree_remove_submodule_deinit",
|
|
117730
|
+
fallback: isSubmoduleGuard ? "git_worktree_remove_submodule_deinit" : "git_worktree_remove_force",
|
|
117673
117731
|
forced: true,
|
|
117674
|
-
reason:
|
|
117732
|
+
reason: fallbackReason,
|
|
117675
117733
|
convergence: forceFallbackConvergence
|
|
117676
117734
|
};
|
|
117677
117735
|
} catch (deinitError) {
|
|
@@ -117695,11 +117753,11 @@ ${e?.stderr || ""}`;
|
|
|
117695
117753
|
...branchOutcome,
|
|
117696
117754
|
fallback: "fs_rm_worktree_prune",
|
|
117697
117755
|
forced: true,
|
|
117698
|
-
reason:
|
|
117756
|
+
reason: fallbackReason,
|
|
117699
117757
|
convergence: forceFallbackConvergence,
|
|
117700
117758
|
...rm.residue ? {
|
|
117701
117759
|
residue: true,
|
|
117702
|
-
residueWarning: `Worktree was de-registered from git but the directory could not be fully removed (leftover residue at '${workspace}'): ${rm.error || "unknown error"};
|
|
117760
|
+
residueWarning: `Worktree was de-registered from git but the directory could not be fully removed (leftover residue at '${workspace}'): ${rm.error || "unknown error"}; the forced remove first failed with: ${deinitError?.message || deinitError}. The node will be dropped from the mesh; remove the directory manually if needed.`,
|
|
117703
117761
|
residueError: rm.error
|
|
117704
117762
|
} : {}
|
|
117705
117763
|
};
|
|
@@ -127722,14 +127780,15 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
|
|
|
127722
127780
|
init_dist();
|
|
127723
127781
|
var CLAUDE_NO_API_LINE = "Claude has no quota API \u2014 adhdev borrows your statusLine to read it.";
|
|
127724
127782
|
var CLAUDE_WRAP_NOT_REPLACE_LINE = "Install wraps (not replaces) your statusline, so nothing is lost.";
|
|
127725
|
-
function formatWindow(label, window) {
|
|
127783
|
+
function formatWindow(label, window, isLastGood = false) {
|
|
127726
127784
|
if (!window) {
|
|
127727
127785
|
return ` ${label.padEnd(8)} ${import_chalk2.default.gray("not reported")}`;
|
|
127728
127786
|
}
|
|
127729
127787
|
const percent = `${window.usedPercent.toFixed(1)}%`;
|
|
127730
127788
|
const bar = renderBar(window.usedPercent);
|
|
127731
127789
|
const reset = window.resetsAt === null ? "" : import_chalk2.default.gray(` resets ${formatRelative(window.resetsAt)}`);
|
|
127732
|
-
|
|
127790
|
+
const stale = isLastGood ? import_chalk2.default.gray(" (refreshing)") : "";
|
|
127791
|
+
return ` ${label.padEnd(8)} ${bar} ${percent.padStart(6)} used${reset}${stale}`;
|
|
127733
127792
|
}
|
|
127734
127793
|
function renderBar(usedPercent) {
|
|
127735
127794
|
const width = 20;
|
|
@@ -127768,8 +127827,9 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
|
|
|
127768
127827
|
const account = formatQuotaAccount(quota);
|
|
127769
127828
|
console.log(account ? `${import_chalk2.default.bold(name)} ${import_chalk2.default.gray(account)}` : import_chalk2.default.bold(name));
|
|
127770
127829
|
if (quota.status === "ok" || quota.session || quota.weekly) {
|
|
127771
|
-
|
|
127772
|
-
console.log(formatWindow("
|
|
127830
|
+
const isLastGood = quota.metadata?.lastGoodWindows === true;
|
|
127831
|
+
console.log(formatWindow("5 hour", quota.session, isLastGood));
|
|
127832
|
+
console.log(formatWindow("7 day", quota.weekly, isLastGood));
|
|
127773
127833
|
}
|
|
127774
127834
|
if (quota.error) {
|
|
127775
127835
|
const tone = quota.status === "unavailable" ? import_chalk2.default.gray : import_chalk2.default.yellow;
|