@adhdev/daemon-standalone 0.9.82-rc.380 → 0.9.82-rc.381
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 +215 -59
- 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 ? "18afac213951f79c502feb6b25b7399fe4d709b3" : void 0) ?? "unknown";
|
|
30112
|
+
const commitShort = readInjected(true ? "18afac21" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30113
|
+
const version2 = readInjected(true ? "0.9.82-rc.381" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30114
|
+
const builtAt = readInjected(true ? "2026-06-25T11:45:12.459Z" : 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(`
|
|
@@ -40604,8 +40650,8 @@ Next step: ${nextStep}`;
|
|
|
40604
40650
|
const maxParallelTasks = Math.max(1, Math.floor(Number(mesh?.policy?.maxParallelTasks) || 2));
|
|
40605
40651
|
const maxReadonlyParallelTasks = Math.max(2, maxParallelTasks * 2);
|
|
40606
40652
|
for (const task of pending) {
|
|
40607
|
-
const
|
|
40608
|
-
if (
|
|
40653
|
+
const isReadonly2 = task.taskMode === "live_debug_readonly";
|
|
40654
|
+
if (isReadonly2) {
|
|
40609
40655
|
if (activeReadonlyAssignedCount(meshId) >= maxReadonlyParallelTasks) {
|
|
40610
40656
|
markAutoLaunch(meshId, task.id, { status: "skipped", reason: "max_readonly_parallel_tasks_reached" });
|
|
40611
40657
|
continue;
|
|
@@ -44054,8 +44100,19 @@ ${cleanBody}`;
|
|
|
44054
44100
|
}
|
|
44055
44101
|
if (sessionId) {
|
|
44056
44102
|
const startedTaskId = readNonEmptyString2(args.metadataEvent.taskId) || void 0;
|
|
44057
|
-
if (startedTaskId
|
|
44103
|
+
if (startedTaskId) {
|
|
44058
44104
|
updateDirectDispatchStatus(args.meshId, sessionId, "acked", startedTaskId);
|
|
44105
|
+
} else if (sessionHasActiveAssignment(args.meshId, sessionId)) {
|
|
44106
|
+
const soleTaskId = (() => {
|
|
44107
|
+
try {
|
|
44108
|
+
return MeshRuntimeStore.getInstance().getSoleActiveDirectDispatchTaskId(args.meshId, sessionId);
|
|
44109
|
+
} catch {
|
|
44110
|
+
return null;
|
|
44111
|
+
}
|
|
44112
|
+
})();
|
|
44113
|
+
if (soleTaskId) {
|
|
44114
|
+
updateDirectDispatchStatus(args.meshId, sessionId, "acked", soleTaskId);
|
|
44115
|
+
}
|
|
44059
44116
|
}
|
|
44060
44117
|
const activeDeliveries = (() => {
|
|
44061
44118
|
try {
|
|
@@ -50923,6 +50980,8 @@ ${lastSnapshot}`;
|
|
|
50923
50980
|
MAX_LEDGER_SLICE_LIMIT: () => MAX_LEDGER_SLICE_LIMIT,
|
|
50924
50981
|
MESH_CONVERGE_FAST_FORWARD_TAG: () => MESH_CONVERGE_FAST_FORWARD_TAG,
|
|
50925
50982
|
MESH_CONVERGE_REFINE_TAG: () => MESH_CONVERGE_REFINE_TAG,
|
|
50983
|
+
MESH_MAX_PARALLEL_TASKS_MAX: () => MESH_MAX_PARALLEL_TASKS_MAX,
|
|
50984
|
+
MESH_MAX_PARALLEL_TASKS_MIN: () => MESH_MAX_PARALLEL_TASKS_MIN,
|
|
50926
50985
|
MESH_MISSION_STATUSES: () => MESH_MISSION_STATUSES,
|
|
50927
50986
|
MESH_NODE_LIVE_TRUTH_MARKER: () => MESH_NODE_LIVE_TRUTH_MARKER,
|
|
50928
50987
|
MESH_REFINE_CONFIG_LOCATIONS: () => MESH_REFINE_CONFIG_LOCATIONS,
|
|
@@ -50973,6 +51032,7 @@ ${lastSnapshot}`;
|
|
|
50973
51032
|
buildMeshNodeCapabilityTags: () => buildMeshNodeCapabilityTags,
|
|
50974
51033
|
buildMeshNodeDataFreshness: () => buildMeshNodeDataFreshness,
|
|
50975
51034
|
buildMeshNodeProbeFreshness: () => buildMeshNodeProbeFreshness,
|
|
51035
|
+
buildMeshSchedulingRuntime: () => buildMeshSchedulingRuntime,
|
|
50976
51036
|
buildMissionPromptSection: () => buildMissionPromptSection,
|
|
50977
51037
|
buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
|
|
50978
51038
|
buildPinnedGlobalInstallCommand: () => buildPinnedGlobalInstallCommand,
|
|
@@ -51121,11 +51181,13 @@ ${lastSnapshot}`;
|
|
|
51121
51181
|
markSetupComplete: () => markSetupComplete,
|
|
51122
51182
|
markStaleDirectDispatches: () => markStaleDirectDispatches,
|
|
51123
51183
|
maybeRunDaemonUpgradeHelperFromEnv: () => maybeRunDaemonUpgradeHelperFromEnv2,
|
|
51184
|
+
mergeAndNormalizePolicy: () => mergeAndNormalizePolicy,
|
|
51124
51185
|
meshNodeIdMatches: () => meshNodeIdMatches,
|
|
51125
51186
|
namedKeyToAnsi: () => namedKeyToAnsi,
|
|
51126
51187
|
namedKeysToAnsi: () => namedKeysToAnsi,
|
|
51127
51188
|
nodeSatisfiesRequiredTags: () => nodeSatisfiesRequiredTags,
|
|
51128
51189
|
normalizeActiveChatData: () => normalizeActiveChatData,
|
|
51190
|
+
normalizeAutoFastForwardPolicy: () => normalizeAutoFastForwardPolicy,
|
|
51129
51191
|
normalizeChatMessage: () => normalizeChatMessage,
|
|
51130
51192
|
normalizeChatMessageKind: () => normalizeChatMessageKind,
|
|
51131
51193
|
normalizeChatMessages: () => normalizeChatMessages,
|
|
@@ -51187,11 +51249,13 @@ ${lastSnapshot}`;
|
|
|
51187
51249
|
resolveDelegatedWorkerAutoApprove: () => resolveDelegatedWorkerAutoApprove,
|
|
51188
51250
|
resolveDeliveryDecision: () => resolveDeliveryDecision,
|
|
51189
51251
|
resolveGitRepository: () => resolveGitRepository,
|
|
51252
|
+
resolveMaxParallelTasks: () => resolveMaxParallelTasks,
|
|
51190
51253
|
resolveMeshHostStatus: () => resolveMeshHostStatus,
|
|
51191
51254
|
resolveMeshNodeAttribution: () => resolveMeshNodeAttribution,
|
|
51192
51255
|
resolveMeshRefineValidationPlan: () => resolveMeshRefineValidationPlan,
|
|
51193
51256
|
resolveMeshSurfacedSessionPreview: () => resolveMeshSurfacedSessionPreview,
|
|
51194
51257
|
resolveNodeSchedulingPriority: () => resolveNodeSchedulingPriority,
|
|
51258
|
+
resolveProviderMaxParallel: () => resolveProviderMaxParallel,
|
|
51195
51259
|
resolveSessionHostAppName: () => resolveSessionHostAppName,
|
|
51196
51260
|
resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution2,
|
|
51197
51261
|
resolveWorktreePath: () => resolveWorktreePath,
|
|
@@ -53074,6 +53138,98 @@ ${lastSnapshot}`;
|
|
|
53074
53138
|
init_mesh_work_queue();
|
|
53075
53139
|
init_mesh_active_work();
|
|
53076
53140
|
init_mesh_refine_status();
|
|
53141
|
+
init_repo_mesh_types();
|
|
53142
|
+
init_dist();
|
|
53143
|
+
function isReadonly(task) {
|
|
53144
|
+
return task.taskMode === "live_debug_readonly";
|
|
53145
|
+
}
|
|
53146
|
+
function isAssigned(task) {
|
|
53147
|
+
return task.status === "assigned";
|
|
53148
|
+
}
|
|
53149
|
+
function buildMeshSchedulingRuntime(mesh, queue) {
|
|
53150
|
+
const strategy = normalizeMeshSchedulingStrategy(mesh?.policy?.schedulingStrategy);
|
|
53151
|
+
const maxParallelTasks = resolveMaxParallelTasks(mesh?.policy?.maxParallelTasks);
|
|
53152
|
+
const maxReadonlyParallelTasks = Math.max(2, maxParallelTasks * 2);
|
|
53153
|
+
const assignedTasks = (Array.isArray(queue) ? queue : []).filter(isAssigned);
|
|
53154
|
+
const activeWriteAssigned = assignedTasks.filter((t) => !isReadonly(t)).length;
|
|
53155
|
+
const activeReadonlyAssigned = assignedTasks.filter(isReadonly).length;
|
|
53156
|
+
const globalWriteCapReached = activeWriteAssigned >= maxParallelTasks;
|
|
53157
|
+
const globalReadonlyCapReached = activeReadonlyAssigned >= maxReadonlyParallelTasks;
|
|
53158
|
+
const writeAssignedByNode = /* @__PURE__ */ new Map();
|
|
53159
|
+
const assignedByNode = /* @__PURE__ */ new Map();
|
|
53160
|
+
const providerCountByNode = /* @__PURE__ */ new Map();
|
|
53161
|
+
for (const task of assignedTasks) {
|
|
53162
|
+
const nodeId = typeof task.assignedNodeId === "string" ? task.assignedNodeId.trim() : "";
|
|
53163
|
+
if (!nodeId) continue;
|
|
53164
|
+
assignedByNode.set(nodeId, (assignedByNode.get(nodeId) ?? 0) + 1);
|
|
53165
|
+
if (!isReadonly(task)) {
|
|
53166
|
+
writeAssignedByNode.set(nodeId, (writeAssignedByNode.get(nodeId) ?? 0) + 1);
|
|
53167
|
+
}
|
|
53168
|
+
const provider = typeof task.assignedProviderType === "string" ? task.assignedProviderType : "";
|
|
53169
|
+
if (provider) {
|
|
53170
|
+
let byProvider = providerCountByNode.get(nodeId);
|
|
53171
|
+
if (!byProvider) {
|
|
53172
|
+
byProvider = /* @__PURE__ */ new Map();
|
|
53173
|
+
providerCountByNode.set(nodeId, byProvider);
|
|
53174
|
+
}
|
|
53175
|
+
byProvider.set(provider, (byProvider.get(provider) ?? 0) + 1);
|
|
53176
|
+
}
|
|
53177
|
+
}
|
|
53178
|
+
const nodes = [];
|
|
53179
|
+
for (const rawNode of Array.isArray(mesh?.nodes) ? mesh.nodes : []) {
|
|
53180
|
+
const nodeId = normalizeMeshNodeId(rawNode);
|
|
53181
|
+
if (!nodeId) continue;
|
|
53182
|
+
const policy = rawNode?.policy || void 0;
|
|
53183
|
+
const load4 = assignedByNode.get(nodeId) ?? 0;
|
|
53184
|
+
const schedulingPriority = resolveNodeSchedulingPriority(policy);
|
|
53185
|
+
const capReasons = [];
|
|
53186
|
+
if (globalWriteCapReached) capReasons.push("global_max_parallel_tasks_reached");
|
|
53187
|
+
if ((writeAssignedByNode.get(nodeId) ?? 0) > 0) capReasons.push("node_has_active_assignment");
|
|
53188
|
+
let providerRoles;
|
|
53189
|
+
const declaredRoles = Array.isArray(policy?.providerRoles) ? policy.providerRoles : [];
|
|
53190
|
+
if (declaredRoles.length) {
|
|
53191
|
+
const byProvider = providerCountByNode.get(nodeId);
|
|
53192
|
+
providerRoles = [];
|
|
53193
|
+
for (const role of declaredRoles) {
|
|
53194
|
+
if (!role || typeof role !== "object") continue;
|
|
53195
|
+
const providerType = typeof role.providerType === "string" ? role.providerType.trim() : "";
|
|
53196
|
+
if (!providerType) continue;
|
|
53197
|
+
const maxParallel = resolveProviderMaxParallel(policy, providerType);
|
|
53198
|
+
const activeAssigned = byProvider?.get(providerType) ?? 0;
|
|
53199
|
+
const capReached = maxParallel !== void 0 && activeAssigned >= maxParallel;
|
|
53200
|
+
providerRoles.push({
|
|
53201
|
+
providerType,
|
|
53202
|
+
...maxParallel !== void 0 ? { maxParallel } : {},
|
|
53203
|
+
activeAssigned,
|
|
53204
|
+
capReached
|
|
53205
|
+
});
|
|
53206
|
+
if (capReached) capReasons.push(`max_provider_parallel_reached:${providerType}`);
|
|
53207
|
+
}
|
|
53208
|
+
if (!providerRoles.length) providerRoles = void 0;
|
|
53209
|
+
}
|
|
53210
|
+
const maxConcurrentSessions = Number(policy?.maxConcurrentSessions);
|
|
53211
|
+
const hasSessionCap = Number.isFinite(maxConcurrentSessions) && maxConcurrentSessions >= 0;
|
|
53212
|
+
nodes.push({
|
|
53213
|
+
nodeId,
|
|
53214
|
+
load: load4,
|
|
53215
|
+
schedulingPriority,
|
|
53216
|
+
...hasSessionCap ? { maxConcurrentSessions: Math.floor(maxConcurrentSessions) } : {},
|
|
53217
|
+
...providerRoles ? { providerRoles } : {},
|
|
53218
|
+
capReached: capReasons.length > 0,
|
|
53219
|
+
capReasons
|
|
53220
|
+
});
|
|
53221
|
+
}
|
|
53222
|
+
return {
|
|
53223
|
+
strategy,
|
|
53224
|
+
maxParallelTasks,
|
|
53225
|
+
maxReadonlyParallelTasks,
|
|
53226
|
+
activeWriteAssigned,
|
|
53227
|
+
activeReadonlyAssigned,
|
|
53228
|
+
globalWriteCapReached,
|
|
53229
|
+
globalReadonlyCapReached,
|
|
53230
|
+
nodes
|
|
53231
|
+
};
|
|
53232
|
+
}
|
|
53077
53233
|
init_mesh_host_ownership();
|
|
53078
53234
|
init_mesh_events();
|
|
53079
53235
|
init_mesh_events_utils();
|