@adhdev/daemon-standalone 0.9.82-rc.380 → 0.9.82-rc.382
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 +297 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-3wtc5vDj.js +113 -0
- package/public/assets/index-BirH1m9z.css +1 -0
- package/public/index.html +2 -2
- package/vendor/mcp-server/index.js +62 -6
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -29754,6 +29754,56 @@ var require_dist3 = __commonJS({
|
|
|
29754
29754
|
function resolveAutoConvergeCodeChange(policy) {
|
|
29755
29755
|
return policy?.autoConvergeCodeChange === true;
|
|
29756
29756
|
}
|
|
29757
|
+
function resolveMaxParallelTasks(value) {
|
|
29758
|
+
const n = Number(value);
|
|
29759
|
+
if (!Number.isFinite(n)) return DEFAULT_MESH_POLICY.maxParallelTasks;
|
|
29760
|
+
return Math.max(MESH_MAX_PARALLEL_TASKS_MIN, Math.min(MESH_MAX_PARALLEL_TASKS_MAX, Math.floor(n)));
|
|
29761
|
+
}
|
|
29762
|
+
function normalizeAutoFastForwardPolicy(value) {
|
|
29763
|
+
const record2 = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
29764
|
+
const maxBehind = Number(record2.maxBehind);
|
|
29765
|
+
return {
|
|
29766
|
+
enabled: record2.enabled !== false,
|
|
29767
|
+
...Number.isFinite(maxBehind) && maxBehind >= 0 ? { maxBehind: Math.floor(maxBehind) } : {},
|
|
29768
|
+
requireCleanSubmodules: record2.requireCleanSubmodules !== false
|
|
29769
|
+
};
|
|
29770
|
+
}
|
|
29771
|
+
function mergeAndNormalizePolicy(base, patch) {
|
|
29772
|
+
const autoFastForward = normalizeAutoFastForwardPolicy({
|
|
29773
|
+
...DEFAULT_MESH_POLICY.autoFastForward,
|
|
29774
|
+
...base?.autoFastForward && typeof base.autoFastForward === "object" ? base.autoFastForward : {},
|
|
29775
|
+
...patch?.autoFastForward && typeof patch.autoFastForward === "object" ? patch.autoFastForward : {}
|
|
29776
|
+
});
|
|
29777
|
+
const policy = {
|
|
29778
|
+
...DEFAULT_MESH_POLICY,
|
|
29779
|
+
...base || {},
|
|
29780
|
+
...patch || {},
|
|
29781
|
+
autoFastForward
|
|
29782
|
+
};
|
|
29783
|
+
if (!DIRTY_WORKSPACE_BEHAVIORS.has(policy.dirtyWorkspaceBehavior)) {
|
|
29784
|
+
policy.dirtyWorkspaceBehavior = "warn";
|
|
29785
|
+
}
|
|
29786
|
+
policy.maxParallelTasks = resolveMaxParallelTasks(policy.maxParallelTasks);
|
|
29787
|
+
policy.allowAutoPublishSubmoduleMainCommits = policy.allowAutoPublishSubmoduleMainCommits === true;
|
|
29788
|
+
if (!SESSION_CLEANUP_MODES.has(policy.sessionCleanupOnNodeRemove)) {
|
|
29789
|
+
policy.sessionCleanupOnNodeRemove = "preserve";
|
|
29790
|
+
}
|
|
29791
|
+
if (!SPAWNED_SESSION_VISIBILITY_MODES.has(policy.spawnedSessionVisibility)) {
|
|
29792
|
+
policy.spawnedSessionVisibility = DEFAULT_MESH_POLICY.spawnedSessionVisibility;
|
|
29793
|
+
}
|
|
29794
|
+
const normalizedStrategy = normalizeMeshSchedulingStrategy(policy.schedulingStrategy);
|
|
29795
|
+
if (normalizedStrategy === "first_eligible") {
|
|
29796
|
+
delete policy.schedulingStrategy;
|
|
29797
|
+
} else {
|
|
29798
|
+
policy.schedulingStrategy = normalizedStrategy;
|
|
29799
|
+
}
|
|
29800
|
+
if (policy.autoConvergeCodeChange === true) {
|
|
29801
|
+
policy.autoConvergeCodeChange = true;
|
|
29802
|
+
} else {
|
|
29803
|
+
delete policy.autoConvergeCodeChange;
|
|
29804
|
+
}
|
|
29805
|
+
return policy;
|
|
29806
|
+
}
|
|
29757
29807
|
function resolveDelegatedWorkerAutoApprove(meshPolicy, nodePolicy) {
|
|
29758
29808
|
if (typeof nodePolicy?.delegatedWorkerAutoApprove === "boolean") {
|
|
29759
29809
|
return nodePolicy.delegatedWorkerAutoApprove;
|
|
@@ -29783,6 +29833,11 @@ var require_dist3 = __commonJS({
|
|
|
29783
29833
|
var MESH_CONVERGE_REFINE_TAG;
|
|
29784
29834
|
var MESH_CONVERGE_FAST_FORWARD_TAG;
|
|
29785
29835
|
var DEFAULT_MESH_POLICY;
|
|
29836
|
+
var SESSION_CLEANUP_MODES;
|
|
29837
|
+
var SPAWNED_SESSION_VISIBILITY_MODES;
|
|
29838
|
+
var DIRTY_WORKSPACE_BEHAVIORS;
|
|
29839
|
+
var MESH_MAX_PARALLEL_TASKS_MIN;
|
|
29840
|
+
var MESH_MAX_PARALLEL_TASKS_MAX;
|
|
29786
29841
|
var init_repo_mesh_types = __esm2({
|
|
29787
29842
|
"src/repo-mesh-types.ts"() {
|
|
29788
29843
|
"use strict";
|
|
@@ -29812,6 +29867,23 @@ var require_dist3 = __commonJS({
|
|
|
29812
29867
|
autoFastForward: { enabled: true },
|
|
29813
29868
|
maxTaskRetries: 1
|
|
29814
29869
|
};
|
|
29870
|
+
SESSION_CLEANUP_MODES = /* @__PURE__ */ new Set([
|
|
29871
|
+
"preserve",
|
|
29872
|
+
"stop",
|
|
29873
|
+
"delete_stopped",
|
|
29874
|
+
"stop_and_delete"
|
|
29875
|
+
]);
|
|
29876
|
+
SPAWNED_SESSION_VISIBILITY_MODES = /* @__PURE__ */ new Set([
|
|
29877
|
+
"visible",
|
|
29878
|
+
"hidden"
|
|
29879
|
+
]);
|
|
29880
|
+
DIRTY_WORKSPACE_BEHAVIORS = /* @__PURE__ */ new Set([
|
|
29881
|
+
"block",
|
|
29882
|
+
"warn",
|
|
29883
|
+
"checkpoint_then_continue"
|
|
29884
|
+
]);
|
|
29885
|
+
MESH_MAX_PARALLEL_TASKS_MIN = 1;
|
|
29886
|
+
MESH_MAX_PARALLEL_TASKS_MAX = 8;
|
|
29815
29887
|
}
|
|
29816
29888
|
});
|
|
29817
29889
|
var git_executor_exports = {};
|
|
@@ -30036,10 +30108,10 @@ var require_dist3 = __commonJS({
|
|
|
30036
30108
|
}
|
|
30037
30109
|
function getDaemonBuildInfo() {
|
|
30038
30110
|
if (cached2) return cached2;
|
|
30039
|
-
const commit = readInjected(true ? "
|
|
30040
|
-
const commitShort = readInjected(true ? "
|
|
30041
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30042
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30111
|
+
const commit = readInjected(true ? "70741c4fe19c6f71bcef702e7e149d963d6fd916" : void 0) ?? "unknown";
|
|
30112
|
+
const commitShort = readInjected(true ? "70741c4f" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30113
|
+
const version2 = readInjected(true ? "0.9.82-rc.382" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30114
|
+
const builtAt = readInjected(true ? "2026-06-25T13:33:15.097Z" : void 0);
|
|
30043
30115
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30044
30116
|
return cached2;
|
|
30045
30117
|
}
|
|
@@ -32098,52 +32170,6 @@ ${error48.message || ""}`;
|
|
|
32098
32170
|
if (sshMatch) return `${sshMatch[1]}/${sshMatch[2]}`;
|
|
32099
32171
|
return identity;
|
|
32100
32172
|
}
|
|
32101
|
-
function mergeMeshPolicy(base, patch) {
|
|
32102
|
-
const autoFastForward = normalizeAutoFastForwardPolicy({
|
|
32103
|
-
...DEFAULT_MESH_POLICY.autoFastForward,
|
|
32104
|
-
...base?.autoFastForward && typeof base.autoFastForward === "object" ? base.autoFastForward : {},
|
|
32105
|
-
...patch?.autoFastForward && typeof patch.autoFastForward === "object" ? patch.autoFastForward : {}
|
|
32106
|
-
});
|
|
32107
|
-
const policy = {
|
|
32108
|
-
...DEFAULT_MESH_POLICY,
|
|
32109
|
-
...base || {},
|
|
32110
|
-
...patch || {},
|
|
32111
|
-
autoFastForward
|
|
32112
|
-
};
|
|
32113
|
-
if (!["block", "warn", "checkpoint_then_continue"].includes(policy.dirtyWorkspaceBehavior)) {
|
|
32114
|
-
policy.dirtyWorkspaceBehavior = "warn";
|
|
32115
|
-
}
|
|
32116
|
-
const maxParallelTasks = Number(policy.maxParallelTasks);
|
|
32117
|
-
policy.maxParallelTasks = Number.isFinite(maxParallelTasks) ? Math.max(1, Math.min(8, Math.floor(maxParallelTasks))) : 2;
|
|
32118
|
-
policy.allowAutoPublishSubmoduleMainCommits = policy.allowAutoPublishSubmoduleMainCommits === true;
|
|
32119
|
-
if (!SESSION_CLEANUP_MODES.has(String(policy.sessionCleanupOnNodeRemove))) {
|
|
32120
|
-
policy.sessionCleanupOnNodeRemove = "preserve";
|
|
32121
|
-
}
|
|
32122
|
-
if (!SPAWNED_SESSION_VISIBILITY_MODES.has(String(policy.spawnedSessionVisibility))) {
|
|
32123
|
-
policy.spawnedSessionVisibility = DEFAULT_MESH_POLICY.spawnedSessionVisibility;
|
|
32124
|
-
}
|
|
32125
|
-
const normalizedStrategy = normalizeMeshSchedulingStrategy(policy.schedulingStrategy);
|
|
32126
|
-
if (normalizedStrategy === "first_eligible") {
|
|
32127
|
-
delete policy.schedulingStrategy;
|
|
32128
|
-
} else {
|
|
32129
|
-
policy.schedulingStrategy = normalizedStrategy;
|
|
32130
|
-
}
|
|
32131
|
-
if (policy.autoConvergeCodeChange === true) {
|
|
32132
|
-
policy.autoConvergeCodeChange = true;
|
|
32133
|
-
} else {
|
|
32134
|
-
delete policy.autoConvergeCodeChange;
|
|
32135
|
-
}
|
|
32136
|
-
return policy;
|
|
32137
|
-
}
|
|
32138
|
-
function normalizeAutoFastForwardPolicy(value) {
|
|
32139
|
-
const record2 = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
32140
|
-
const maxBehind = Number(record2.maxBehind);
|
|
32141
|
-
return {
|
|
32142
|
-
enabled: record2.enabled !== false,
|
|
32143
|
-
...Number.isFinite(maxBehind) && maxBehind >= 0 ? { maxBehind: Math.floor(maxBehind) } : {},
|
|
32144
|
-
requireCleanSubmodules: record2.requireCleanSubmodules !== false
|
|
32145
|
-
};
|
|
32146
|
-
}
|
|
32147
32173
|
function listMeshes() {
|
|
32148
32174
|
return loadMeshConfig().meshes;
|
|
32149
32175
|
}
|
|
@@ -32445,8 +32471,7 @@ ${error48.message || ""}`;
|
|
|
32445
32471
|
var import_fs3;
|
|
32446
32472
|
var import_path3;
|
|
32447
32473
|
var import_crypto3;
|
|
32448
|
-
var
|
|
32449
|
-
var SPAWNED_SESSION_VISIBILITY_MODES;
|
|
32474
|
+
var mergeMeshPolicy;
|
|
32450
32475
|
var init_mesh_config = __esm2({
|
|
32451
32476
|
"src/config/mesh-config.ts"() {
|
|
32452
32477
|
"use strict";
|
|
@@ -32457,8 +32482,7 @@ ${error48.message || ""}`;
|
|
|
32457
32482
|
init_config();
|
|
32458
32483
|
init_repo_mesh_types();
|
|
32459
32484
|
init_mesh_host_ownership();
|
|
32460
|
-
|
|
32461
|
-
SPAWNED_SESSION_VISIBILITY_MODES = /* @__PURE__ */ new Set(["visible", "hidden"]);
|
|
32485
|
+
mergeMeshPolicy = mergeAndNormalizePolicy;
|
|
32462
32486
|
}
|
|
32463
32487
|
});
|
|
32464
32488
|
function readRecord(value) {
|
|
@@ -32775,7 +32799,7 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
|
|
|
32775
32799
|
if (recentActivity) sections.push(recentActivity);
|
|
32776
32800
|
const operatingNotes = buildOperatingNotesSection(ctx.operatingNotes);
|
|
32777
32801
|
if (operatingNotes) sections.push(operatingNotes);
|
|
32778
|
-
sections.push(buildPolicySection(
|
|
32802
|
+
sections.push(buildPolicySection(mergeAndNormalizePolicy(void 0, mesh.policy)));
|
|
32779
32803
|
sections.push(TOOLS_SECTION);
|
|
32780
32804
|
sections.push(TOOL_EXPOSURE_PREFLIGHT_SECTION);
|
|
32781
32805
|
sections.push(WORKFLOW_SECTION);
|
|
@@ -32808,7 +32832,7 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
|
|
|
32808
32832
|
mission: ctx.missionSection?.trim() || "",
|
|
32809
32833
|
recentActivity: buildRecentActivitySection(ctx.recentActivity) || "",
|
|
32810
32834
|
operatingNotes: buildOperatingNotesSection(ctx.operatingNotes) || "",
|
|
32811
|
-
policy: buildPolicySection(
|
|
32835
|
+
policy: buildPolicySection(mergeAndNormalizePolicy(void 0, mesh.policy)),
|
|
32812
32836
|
tools: TOOLS_SECTION,
|
|
32813
32837
|
workflow: WORKFLOW_SECTION,
|
|
32814
32838
|
rules: buildRulesSection(coordinatorCliType),
|
|
@@ -35524,6 +35548,28 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35524
35548
|
AND status NOT IN ('completed', 'failed')
|
|
35525
35549
|
`).run({ status, meshId, sessionId, updatedAt: now });
|
|
35526
35550
|
}
|
|
35551
|
+
/**
|
|
35552
|
+
* MESH-DISPATCH-MISROUTE (fix 3, consumer residual): resolve the task_id of the SINGLE
|
|
35553
|
+
* non-terminal direct dispatch a session owns. Returns the task_id only when the session
|
|
35554
|
+
* holds exactly ONE active ('dispatched'/'acked') row — the case where a taskId-less
|
|
35555
|
+
* lifecycle event (a legacy/relayed worker whose producer never stamped meshActiveTaskId)
|
|
35556
|
+
* unambiguously belongs to that one dispatch. With zero rows there is nothing to ack; with
|
|
35557
|
+
* two or more (a re-dispatch/nudge sibling) the firing event's owner is ambiguous, so we
|
|
35558
|
+
* return null and the caller MUST NOT fall back to the session_id sweep that would flip a
|
|
35559
|
+
* sibling row ("may flip a sibling dispatch row"). This narrows the legacy fallback to the
|
|
35560
|
+
* only safe case instead of removing the producer-side TASKIDLESS stamp's safety net.
|
|
35561
|
+
*/
|
|
35562
|
+
getSoleActiveDirectDispatchTaskId(meshId, sessionId) {
|
|
35563
|
+
if (!sessionId) return null;
|
|
35564
|
+
const rows = this.db.prepare(`
|
|
35565
|
+
SELECT task_id FROM mesh_direct_dispatches
|
|
35566
|
+
WHERE mesh_id = ? AND session_id = ?
|
|
35567
|
+
AND status NOT IN ('completed', 'failed', 'stale')
|
|
35568
|
+
`).all(meshId, sessionId);
|
|
35569
|
+
if (rows.length !== 1) return null;
|
|
35570
|
+
const taskId = typeof rows[0]?.task_id === "string" ? rows[0].task_id.trim() : "";
|
|
35571
|
+
return taskId || null;
|
|
35572
|
+
}
|
|
35527
35573
|
cleanupTerminalDirectDispatches(olderThanMs) {
|
|
35528
35574
|
const cutoff = new Date(Date.now() - olderThanMs).toISOString();
|
|
35529
35575
|
this.db.prepare(`
|
|
@@ -38317,6 +38363,107 @@ ${rendered}`, "utf-8");
|
|
|
38317
38363
|
]);
|
|
38318
38364
|
}
|
|
38319
38365
|
});
|
|
38366
|
+
var mesh_scheduling_runtime_exports = {};
|
|
38367
|
+
__export2(mesh_scheduling_runtime_exports, {
|
|
38368
|
+
buildMeshSchedulingRuntime: () => buildMeshSchedulingRuntime
|
|
38369
|
+
});
|
|
38370
|
+
function isReadonly(task) {
|
|
38371
|
+
return task.taskMode === "live_debug_readonly";
|
|
38372
|
+
}
|
|
38373
|
+
function isAssigned(task) {
|
|
38374
|
+
return task.status === "assigned";
|
|
38375
|
+
}
|
|
38376
|
+
function buildMeshSchedulingRuntime(mesh, queue) {
|
|
38377
|
+
const strategy = normalizeMeshSchedulingStrategy(mesh?.policy?.schedulingStrategy);
|
|
38378
|
+
const maxParallelTasks = resolveMaxParallelTasks(mesh?.policy?.maxParallelTasks);
|
|
38379
|
+
const maxReadonlyParallelTasks = Math.max(2, maxParallelTasks * 2);
|
|
38380
|
+
const assignedTasks = (Array.isArray(queue) ? queue : []).filter(isAssigned);
|
|
38381
|
+
const activeWriteAssigned = assignedTasks.filter((t) => !isReadonly(t)).length;
|
|
38382
|
+
const activeReadonlyAssigned = assignedTasks.filter(isReadonly).length;
|
|
38383
|
+
const globalWriteCapReached = activeWriteAssigned >= maxParallelTasks;
|
|
38384
|
+
const globalReadonlyCapReached = activeReadonlyAssigned >= maxReadonlyParallelTasks;
|
|
38385
|
+
const writeAssignedByNode = /* @__PURE__ */ new Map();
|
|
38386
|
+
const assignedByNode = /* @__PURE__ */ new Map();
|
|
38387
|
+
const providerCountByNode = /* @__PURE__ */ new Map();
|
|
38388
|
+
for (const task of assignedTasks) {
|
|
38389
|
+
const nodeId = typeof task.assignedNodeId === "string" ? task.assignedNodeId.trim() : "";
|
|
38390
|
+
if (!nodeId) continue;
|
|
38391
|
+
assignedByNode.set(nodeId, (assignedByNode.get(nodeId) ?? 0) + 1);
|
|
38392
|
+
if (!isReadonly(task)) {
|
|
38393
|
+
writeAssignedByNode.set(nodeId, (writeAssignedByNode.get(nodeId) ?? 0) + 1);
|
|
38394
|
+
}
|
|
38395
|
+
const provider = typeof task.assignedProviderType === "string" ? task.assignedProviderType : "";
|
|
38396
|
+
if (provider) {
|
|
38397
|
+
let byProvider = providerCountByNode.get(nodeId);
|
|
38398
|
+
if (!byProvider) {
|
|
38399
|
+
byProvider = /* @__PURE__ */ new Map();
|
|
38400
|
+
providerCountByNode.set(nodeId, byProvider);
|
|
38401
|
+
}
|
|
38402
|
+
byProvider.set(provider, (byProvider.get(provider) ?? 0) + 1);
|
|
38403
|
+
}
|
|
38404
|
+
}
|
|
38405
|
+
const nodes = [];
|
|
38406
|
+
for (const rawNode of Array.isArray(mesh?.nodes) ? mesh.nodes : []) {
|
|
38407
|
+
const nodeId = normalizeMeshNodeId(rawNode);
|
|
38408
|
+
if (!nodeId) continue;
|
|
38409
|
+
const policy = rawNode?.policy || void 0;
|
|
38410
|
+
const load4 = assignedByNode.get(nodeId) ?? 0;
|
|
38411
|
+
const schedulingPriority = resolveNodeSchedulingPriority(policy);
|
|
38412
|
+
const capReasons = [];
|
|
38413
|
+
if (globalWriteCapReached) capReasons.push("global_max_parallel_tasks_reached");
|
|
38414
|
+
if ((writeAssignedByNode.get(nodeId) ?? 0) > 0) capReasons.push("node_has_active_assignment");
|
|
38415
|
+
let providerRoles;
|
|
38416
|
+
const declaredRoles = Array.isArray(policy?.providerRoles) ? policy.providerRoles : [];
|
|
38417
|
+
if (declaredRoles.length) {
|
|
38418
|
+
const byProvider = providerCountByNode.get(nodeId);
|
|
38419
|
+
providerRoles = [];
|
|
38420
|
+
for (const role of declaredRoles) {
|
|
38421
|
+
if (!role || typeof role !== "object") continue;
|
|
38422
|
+
const providerType = typeof role.providerType === "string" ? role.providerType.trim() : "";
|
|
38423
|
+
if (!providerType) continue;
|
|
38424
|
+
const maxParallel = resolveProviderMaxParallel(policy, providerType);
|
|
38425
|
+
const activeAssigned = byProvider?.get(providerType) ?? 0;
|
|
38426
|
+
const capReached = maxParallel !== void 0 && activeAssigned >= maxParallel;
|
|
38427
|
+
providerRoles.push({
|
|
38428
|
+
providerType,
|
|
38429
|
+
...maxParallel !== void 0 ? { maxParallel } : {},
|
|
38430
|
+
activeAssigned,
|
|
38431
|
+
capReached
|
|
38432
|
+
});
|
|
38433
|
+
if (capReached) capReasons.push(`max_provider_parallel_reached:${providerType}`);
|
|
38434
|
+
}
|
|
38435
|
+
if (!providerRoles.length) providerRoles = void 0;
|
|
38436
|
+
}
|
|
38437
|
+
const maxConcurrentSessions = Number(policy?.maxConcurrentSessions);
|
|
38438
|
+
const hasSessionCap = Number.isFinite(maxConcurrentSessions) && maxConcurrentSessions >= 0;
|
|
38439
|
+
nodes.push({
|
|
38440
|
+
nodeId,
|
|
38441
|
+
load: load4,
|
|
38442
|
+
schedulingPriority,
|
|
38443
|
+
...hasSessionCap ? { maxConcurrentSessions: Math.floor(maxConcurrentSessions) } : {},
|
|
38444
|
+
...providerRoles ? { providerRoles } : {},
|
|
38445
|
+
capReached: capReasons.length > 0,
|
|
38446
|
+
capReasons
|
|
38447
|
+
});
|
|
38448
|
+
}
|
|
38449
|
+
return {
|
|
38450
|
+
strategy,
|
|
38451
|
+
maxParallelTasks,
|
|
38452
|
+
maxReadonlyParallelTasks,
|
|
38453
|
+
activeWriteAssigned,
|
|
38454
|
+
activeReadonlyAssigned,
|
|
38455
|
+
globalWriteCapReached,
|
|
38456
|
+
globalReadonlyCapReached,
|
|
38457
|
+
nodes
|
|
38458
|
+
};
|
|
38459
|
+
}
|
|
38460
|
+
var init_mesh_scheduling_runtime = __esm2({
|
|
38461
|
+
"src/mesh/mesh-scheduling-runtime.ts"() {
|
|
38462
|
+
"use strict";
|
|
38463
|
+
init_repo_mesh_types();
|
|
38464
|
+
init_dist();
|
|
38465
|
+
}
|
|
38466
|
+
});
|
|
38320
38467
|
function readNonEmptyString2(value) {
|
|
38321
38468
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
38322
38469
|
}
|
|
@@ -40604,8 +40751,8 @@ Next step: ${nextStep}`;
|
|
|
40604
40751
|
const maxParallelTasks = Math.max(1, Math.floor(Number(mesh?.policy?.maxParallelTasks) || 2));
|
|
40605
40752
|
const maxReadonlyParallelTasks = Math.max(2, maxParallelTasks * 2);
|
|
40606
40753
|
for (const task of pending) {
|
|
40607
|
-
const
|
|
40608
|
-
if (
|
|
40754
|
+
const isReadonly2 = task.taskMode === "live_debug_readonly";
|
|
40755
|
+
if (isReadonly2) {
|
|
40609
40756
|
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
40610
40757
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_readonly_parallel_tasks_reached" });
|
|
40611
40758
|
continue;
|
|
@@ -43573,6 +43720,20 @@ ${cleanBody}`;
|
|
|
43573
43720
|
}
|
|
43574
43721
|
return "";
|
|
43575
43722
|
}
|
|
43723
|
+
function recoverMeshIdByCoordinatorAndNode(coordinatorDaemonId, nodeId) {
|
|
43724
|
+
if (!coordinatorDaemonId) return "";
|
|
43725
|
+
const hosted = listMeshes().filter((mesh) => {
|
|
43726
|
+
const host = resolveMeshHostStatus(mesh);
|
|
43727
|
+
return host.role === "host" && (!host.hostDaemonId || daemonIdsEquivalent(host.hostDaemonId, coordinatorDaemonId));
|
|
43728
|
+
});
|
|
43729
|
+
if (hosted.length === 0) return "";
|
|
43730
|
+
if (nodeId) {
|
|
43731
|
+
const byNode = hosted.find((mesh) => Array.isArray(mesh.nodes) && mesh.nodes.some((n) => meshNodeIdMatches(n, nodeId)));
|
|
43732
|
+
if (byNode) return readNonEmptyString2(byNode.id);
|
|
43733
|
+
return "";
|
|
43734
|
+
}
|
|
43735
|
+
return hosted.length === 1 ? readNonEmptyString2(hosted[0].id) : "";
|
|
43736
|
+
}
|
|
43576
43737
|
function resolveForwardEventMeshId(components, payload) {
|
|
43577
43738
|
const direct = readNonEmptyString2(payload.meshId);
|
|
43578
43739
|
if (direct) return direct;
|
|
@@ -44054,8 +44215,19 @@ ${cleanBody}`;
|
|
|
44054
44215
|
}
|
|
44055
44216
|
if (sessionId) {
|
|
44056
44217
|
const startedTaskId = readNonEmptyString2(args.metadataEvent.taskId) || void 0;
|
|
44057
|
-
if (startedTaskId
|
|
44218
|
+
if (startedTaskId) {
|
|
44058
44219
|
updateDirectDispatchStatus(args.meshId, sessionId, "acked", startedTaskId);
|
|
44220
|
+
} else if (sessionHasActiveAssignment(args.meshId, sessionId)) {
|
|
44221
|
+
const soleTaskId = (() => {
|
|
44222
|
+
try {
|
|
44223
|
+
return MeshRuntimeStore.getInstance().getSoleActiveDirectDispatchTaskId(args.meshId, sessionId);
|
|
44224
|
+
} catch {
|
|
44225
|
+
return null;
|
|
44226
|
+
}
|
|
44227
|
+
})();
|
|
44228
|
+
if (soleTaskId) {
|
|
44229
|
+
updateDirectDispatchStatus(args.meshId, sessionId, "acked", soleTaskId);
|
|
44230
|
+
}
|
|
44059
44231
|
}
|
|
44060
44232
|
const activeDeliveries = (() => {
|
|
44061
44233
|
try {
|
|
@@ -44308,7 +44480,10 @@ ${cleanBody}`;
|
|
|
44308
44480
|
}
|
|
44309
44481
|
const nodeId = readNonEmptyString2(payload.nodeId);
|
|
44310
44482
|
const workspace = readNonEmptyString2(payload.workspace);
|
|
44311
|
-
const meshId = readNonEmptyString2(payload.meshId) || (workspace ? readNonEmptyString2(getCachedMeshByWorkspace(workspace)?.id) : "") || recoverMeshIdByNodeId(nodeId)
|
|
44483
|
+
const meshId = readNonEmptyString2(payload.meshId) || (workspace ? readNonEmptyString2(getCachedMeshByWorkspace(workspace)?.id) : "") || recoverMeshIdByNodeId(nodeId) || recoverMeshIdByCoordinatorAndNode(
|
|
44484
|
+
readNonEmptyString2(payload.meshCoordinatorDaemonId) || readNonEmptyString2(payload.coordinatorDaemonId),
|
|
44485
|
+
nodeId
|
|
44486
|
+
);
|
|
44312
44487
|
if (!meshId) {
|
|
44313
44488
|
traceMeshEventDrop("meshId_required", {
|
|
44314
44489
|
taskId: payload.taskId,
|
|
@@ -44363,7 +44538,12 @@ ${cleanBody}`;
|
|
|
44363
44538
|
...event,
|
|
44364
44539
|
event: eventName,
|
|
44365
44540
|
nodeId: readNonEmptyString2(routing.nodeId) || readNonEmptyString2(event.meshNodeId) || void 0,
|
|
44366
|
-
workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0
|
|
44541
|
+
workspace: readNonEmptyString2(routing.workspace) || readNonEmptyString2(event.workspace) || void 0,
|
|
44542
|
+
// Fix B: carry the resolved coordinator anchor so the coordinator's receive-side
|
|
44543
|
+
// recovery (recoverMeshIdByCoordinatorAndNode) can match this forward to one of the
|
|
44544
|
+
// meshes it hosts when workspace + nodeId both miss. routing.coordinatorDaemonId is
|
|
44545
|
+
// the same anchor this forward is addressed to (coordinatorDaemonId below).
|
|
44546
|
+
meshCoordinatorDaemonId: coordinatorDaemonId
|
|
44367
44547
|
};
|
|
44368
44548
|
const resolvedMeshId = resolveForwardEventMeshId(components, payload);
|
|
44369
44549
|
if (resolvedMeshId) payload.meshId = resolvedMeshId;
|
|
@@ -44498,6 +44678,7 @@ ${cleanBody}`;
|
|
|
44498
44678
|
init_mesh_runtime_store();
|
|
44499
44679
|
init_mesh_events_pending();
|
|
44500
44680
|
init_mesh_routing();
|
|
44681
|
+
init_mesh_host_ownership();
|
|
44501
44682
|
init_mesh_unresolved_forward_outbox();
|
|
44502
44683
|
init_mesh_event_trace();
|
|
44503
44684
|
init_snapshot();
|
|
@@ -50923,6 +51104,8 @@ ${lastSnapshot}`;
|
|
|
50923
51104
|
MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
|
|
50924
51105
|
MESH_CONVERGE_FAST_FORWARD_TAG: () => MESH_CONVERGE_FAST_FORWARD_TAG,
|
|
50925
51106
|
MESH_CONVERGE_REFINE_TAG: () => MESH_CONVERGE_REFINE_TAG,
|
|
51107
|
+
MESH_MAX_PARALLEL_TASKS_MAX: () => MESH_MAX_PARALLEL_TASKS_MAX,
|
|
51108
|
+
MESH_MAX_PARALLEL_TASKS_MIN: () => MESH_MAX_PARALLEL_TASKS_MIN,
|
|
50926
51109
|
MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
|
|
50927
51110
|
MESH_NODE_LIVE_TRUTH_MARKER: () => MESH_NODE_LIVE_TRUTH_MARKER,
|
|
50928
51111
|
MESH_REFINE_CONFIG_LOCATIONS: () => MESH_REFINE_CONFIG_LOCATIONS,
|
|
@@ -50973,6 +51156,7 @@ ${lastSnapshot}`;
|
|
|
50973
51156
|
buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
|
|
50974
51157
|
buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
|
|
50975
51158
|
buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
|
|
51159
|
+
buildMeshSchedulingRuntime: () => buildMeshSchedulingRuntime,
|
|
50976
51160
|
buildMissionPromptSection: () => buildMissionPromptSection,
|
|
50977
51161
|
buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
|
|
50978
51162
|
buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
|
|
@@ -51121,11 +51305,13 @@ ${lastSnapshot}`;
|
|
|
51121
51305
|
markSetupComplete: () => markSetupComplete,
|
|
51122
51306
|
markStaleDirectDispatches: () => markStaleDirectDispatches,
|
|
51123
51307
|
maybeRunDaemonUpgradeHelperFromEnv: () => maybeRunDaemonUpgradeHelperFromEnv2,
|
|
51308
|
+
mergeAndNormalizePolicy: () => mergeAndNormalizePolicy,
|
|
51124
51309
|
meshNodeIdMatches: () => meshNodeIdMatches,
|
|
51125
51310
|
namedKeyToAnsi: () => namedKeyToAnsi,
|
|
51126
51311
|
namedKeysToAnsi: () => namedKeysToAnsi,
|
|
51127
51312
|
nodeSatisfiesRequiredTags: () => nodeSatisfiesRequiredTags,
|
|
51128
51313
|
normalizeActiveChatData: () => normalizeActiveChatData,
|
|
51314
|
+
normalizeAutoFastForwardPolicy: () => normalizeAutoFastForwardPolicy,
|
|
51129
51315
|
normalizeChatMessage: () => normalizeChatMessage,
|
|
51130
51316
|
normalizeChatMessageKind: () => normalizeChatMessageKind,
|
|
51131
51317
|
normalizeChatMessages: () => normalizeChatMessages,
|
|
@@ -51187,11 +51373,13 @@ ${lastSnapshot}`;
|
|
|
51187
51373
|
resolveDelegatedWorkerAutoApprove: () => resolveDelegatedWorkerAutoApprove,
|
|
51188
51374
|
resolveDeliveryDecision: () => resolveDeliveryDecision,
|
|
51189
51375
|
resolveGitRepository: () => resolveGitRepository,
|
|
51376
|
+
resolveMaxParallelTasks: () => resolveMaxParallelTasks,
|
|
51190
51377
|
resolveMeshHostStatus: () => resolveMeshHostStatus,
|
|
51191
51378
|
resolveMeshNodeAttribution: () => resolveMeshNodeAttribution,
|
|
51192
51379
|
resolveMeshRefineValidationPlan: () => resolveMeshRefineValidationPlan,
|
|
51193
51380
|
resolveMeshSurfacedSessionPreview: () => resolveMeshSurfacedSessionPreview,
|
|
51194
51381
|
resolveNodeSchedulingPriority: () => resolveNodeSchedulingPriority,
|
|
51382
|
+
resolveProviderMaxParallel: () => resolveProviderMaxParallel,
|
|
51195
51383
|
resolveSessionHostAppName: () => resolveSessionHostAppName,
|
|
51196
51384
|
resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution2,
|
|
51197
51385
|
resolveWorktreePath: () => resolveWorktreePath,
|
|
@@ -53074,6 +53262,7 @@ ${lastSnapshot}`;
|
|
|
53074
53262
|
init_mesh_work_queue();
|
|
53075
53263
|
init_mesh_active_work();
|
|
53076
53264
|
init_mesh_refine_status();
|
|
53265
|
+
init_mesh_scheduling_runtime();
|
|
53077
53266
|
init_mesh_host_ownership();
|
|
53078
53267
|
init_mesh_events();
|
|
53079
53268
|
init_mesh_events_utils();
|
|
@@ -68688,9 +68877,35 @@ ${body}
|
|
|
68688
68877
|
* terminal state. Leaving meshNodeFor pinned would route this session's
|
|
68689
68878
|
* subsequent unrelated turns (e.g. ad-hoc dashboard chats) to the
|
|
68690
68879
|
* coordinator as if they were task completions.
|
|
68880
|
+
*
|
|
68881
|
+
* MESHID-DROP-ON-DETACH (Fix C): a coordinator-LAUNCHED worker session
|
|
68882
|
+
* (launchedByCoordinator) holds its mesh membership (meshNodeFor / meshNodeId /
|
|
68883
|
+
* meshCoordinatorDaemonId) at the SESSION level — set once at launch
|
|
68884
|
+
* (mesh_launch_session / queue auto-launch), independent of any single task.
|
|
68885
|
+
* The original detach wiped meshNodeFor + meshNodeId together with the
|
|
68886
|
+
* task-level meshActiveTaskId, so the FIRST task completion stripped the
|
|
68887
|
+
* membership and EVERY subsequent completion forwarded with meshId absent —
|
|
68888
|
+
* resolveWorkerDelegateRouting fell to mesh_unresolved and the coordinator
|
|
68889
|
+
* rejected the forward "meshId required". For a launched member we therefore
|
|
68890
|
+
* clear ONLY the task-level marker (meshActiveTaskId) and preserve the
|
|
68891
|
+
* session-level membership so its next task's completion still resolves.
|
|
68892
|
+
* A task-less ad-hoc turn on a preserved-membership session is NOT misrouted:
|
|
68893
|
+
* its completion carries no taskId and the session holds no active assignment,
|
|
68894
|
+
* so the forwarder's WARMUPGAP guard skips the dispatch-row flip (it only
|
|
68895
|
+
* injects a benign task-less notification). A NON-launched session (a plain CLI
|
|
68896
|
+
* session adopted by mesh_send_task --direct, launchedByCoordinator falsy)
|
|
68897
|
+
* keeps the original full clear so an ad-hoc session is never left pinned.
|
|
68691
68898
|
*/
|
|
68692
68899
|
detachMeshAssignment() {
|
|
68693
68900
|
if (!this.settings.meshNodeFor && !this.settings.meshActiveTaskId && !this.settings.meshNodeId) return;
|
|
68901
|
+
if (this.settings.launchedByCoordinator === true) {
|
|
68902
|
+
if (!this.settings.meshActiveTaskId) return;
|
|
68903
|
+
const { meshActiveTaskId: meshActiveTaskId2, ...rest2 } = this.settings;
|
|
68904
|
+
void meshActiveTaskId2;
|
|
68905
|
+
this.settings = rest2;
|
|
68906
|
+
this.adapter.updateRuntimeSettings?.(this.settings);
|
|
68907
|
+
return;
|
|
68908
|
+
}
|
|
68694
68909
|
const { meshNodeFor, meshNodeId, meshActiveTaskId, ...rest } = this.settings;
|
|
68695
68910
|
void meshNodeFor;
|
|
68696
68911
|
void meshActiveTaskId;
|
|
@@ -78495,6 +78710,9 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78495
78710
|
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
78496
78711
|
const queue = getQueue2(meshId);
|
|
78497
78712
|
const queueSummary = getMeshQueueStats2(meshId);
|
|
78713
|
+
const { buildMeshSchedulingRuntime: buildMeshSchedulingRuntime2 } = await Promise.resolve().then(() => (init_mesh_scheduling_runtime(), mesh_scheduling_runtime_exports));
|
|
78714
|
+
const schedulingRuntime = buildMeshSchedulingRuntime2(mesh, queue);
|
|
78715
|
+
const schedulingByNode = new Map(schedulingRuntime.nodes.map((n) => [n.nodeId, n]));
|
|
78498
78716
|
const { readLedgerEntries: readLedgerEntries2, getLedgerSummary: getLedgerSummary2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
78499
78717
|
const ledgerEntries = readLedgerEntries2(meshId, { tail: 20 });
|
|
78500
78718
|
const asyncRefineLedgerEntries = readLedgerEntries2(meshId, { tail: 100 });
|
|
@@ -78609,6 +78827,11 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78609
78827
|
activeSessionDetails: [],
|
|
78610
78828
|
launchReady: false
|
|
78611
78829
|
};
|
|
78830
|
+
const nodeScheduling = schedulingByNode.get(nodeId);
|
|
78831
|
+
if (nodeScheduling) {
|
|
78832
|
+
const { nodeId: _omitNodeId, ...nodeSchedulingRest } = nodeScheduling;
|
|
78833
|
+
status.scheduling = nodeSchedulingRest;
|
|
78834
|
+
}
|
|
78612
78835
|
if (isSelfNode) {
|
|
78613
78836
|
status.connection = {
|
|
78614
78837
|
perspective: "selected_coordinator",
|
|
@@ -78809,6 +79032,19 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78809
79032
|
branchConvergenceSummary: summarizeInlineMeshBranchConvergence(nodeStatuses),
|
|
78810
79033
|
...previewFreshness ? { previewFreshness, deployFreshness: previewFreshness } : {},
|
|
78811
79034
|
nodes: nodeStatuses,
|
|
79035
|
+
// Mesh-level scheduling rollup (strategy + global cap consumption). Mirrors
|
|
79036
|
+
// the MCP `mesh_status` tool's `scheduling` block field-for-field so both
|
|
79037
|
+
// surfaces read the same runtime; per-node detail lives on each
|
|
79038
|
+
// nodes[].scheduling above.
|
|
79039
|
+
scheduling: {
|
|
79040
|
+
strategy: schedulingRuntime.strategy,
|
|
79041
|
+
maxParallelTasks: schedulingRuntime.maxParallelTasks,
|
|
79042
|
+
maxReadonlyParallelTasks: schedulingRuntime.maxReadonlyParallelTasks,
|
|
79043
|
+
activeWriteAssigned: schedulingRuntime.activeWriteAssigned,
|
|
79044
|
+
activeReadonlyAssigned: schedulingRuntime.activeReadonlyAssigned,
|
|
79045
|
+
globalWriteCapReached: schedulingRuntime.globalWriteCapReached,
|
|
79046
|
+
globalReadonlyCapReached: schedulingRuntime.globalReadonlyCapReached
|
|
79047
|
+
},
|
|
78812
79048
|
queue: { tasks: queue, summary: queueSummary },
|
|
78813
79049
|
ledger: { entries: ledgerEntries, summary: ledgerSummary },
|
|
78814
79050
|
...missions.length > 0 ? { missions } : {},
|