@adhdev/daemon-core 0.9.82-rc.320 → 0.9.82-rc.322
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/commands/router.d.ts +13 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +56 -177
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -172
- package/dist/index.mjs.map +1 -1
- package/dist/mesh/mesh-work-queue.d.ts +0 -22
- package/dist/repo-mesh-types.d.ts +12 -100
- package/dist/shared-types.d.ts +9 -0
- package/package.json +2 -2
- package/src/commands/router.ts +30 -11
- package/src/config/mesh-config.ts +61 -73
- package/src/index.ts +2 -8
- package/src/mesh/coordinator-prompt.ts +5 -6
- package/src/mesh/mesh-work-queue.ts +5 -125
- package/src/repo-mesh-types.ts +21 -159
- package/src/shared-types.d.ts +8 -0
- package/src/shared-types.ts +9 -0
|
@@ -14,6 +14,19 @@ import { DaemonCliManager } from './cli-manager.js';
|
|
|
14
14
|
import type { ProviderLoader } from '../providers/provider-loader.js';
|
|
15
15
|
import type { ProviderInstanceManager } from '../providers/provider-instance-manager.js';
|
|
16
16
|
import { SessionRegistry } from '../sessions/registry.js';
|
|
17
|
+
export declare function buildMeshNodeDisplayLabel(node: Record<string, unknown>, nodeId: string, providerPriority: string[]): string;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the owning-node attribution for a mesh node record so a coordinator can
|
|
20
|
+
* stamp the TRUE owner onto a synthetic session entry instead of letting the
|
|
21
|
+
* dashboard fall back to the coordinator's own daemonId. Returns whichever of the
|
|
22
|
+
* owning node's `daemonId` / display machine name could be read from the node's
|
|
23
|
+
* (possibly multi-serialization-path) shape; both may be undefined for a node that
|
|
24
|
+
* never carried machine identity.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveMeshNodeAttribution(node: unknown): {
|
|
27
|
+
daemonId?: string;
|
|
28
|
+
machineName?: string;
|
|
29
|
+
};
|
|
17
30
|
export declare function readCachedInlineMeshActiveSessionDetails(node: any): Array<Record<string, unknown>>;
|
|
18
31
|
type MeshRefineStageStatus = 'passed' | 'failed' | 'skipped';
|
|
19
32
|
type MeshRefinePatchEquivalenceSummary = {
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export type { ChatBubbleState, ChatMessage, ExtensionInfo, CommandResult as Core
|
|
|
7
7
|
export type { SessionEntry, CompactSessionEntry, CompactDaemonEntry, CloudDaemonSummaryEntry, DashboardBootstrapDaemonEntry, VersionUpdateReason, CloudStatusReportPayload, DaemonStatusEventPayload, DashboardStatusEventPayload, SessionTransport, SessionKind, SessionCapability, AgentSessionStream, ReadChatCursor, ReadChatSyncResult, TransportTopic, SessionChatTailSubscriptionParams, SessionRuntimeOutputSubscriptionParams, MachineRuntimeSubscriptionParams, SessionHostDiagnosticsSubscriptionParams, SessionModalSubscriptionParams, DaemonMetadataSubscriptionParams, WorkspaceGitSubscriptionParams, SessionChatTailUpdate, MachineRuntimeUpdate, SessionHostDiagnosticsUpdate, SessionModalUpdate, DaemonMetadataUpdate, TopicUpdateEnvelope, SubscribeRequest, UnsubscribeRequest, StandaloneWsStatusPayload, AvailableProviderInfo, AcpConfigOption, AcpMode, ProviderControlSchema, StatusReportPayload, MachineInfo, SessionHostDiagnosticsSnapshot, SessionHostRecord, SessionHostWriteOwner, SessionHostAttachedClient, SessionHostLogEntry, SessionHostRequestTrace, SessionHostRuntimeTransition, DetectedIdeInfo, WorkspaceEntry, ProviderSummaryItem, ProviderSummaryMetadata, ProviderState, ProviderStatus, ProviderErrorReason, SessionActiveChatData, ActiveChatData, IdeProviderState, CliProviderState, AcpProviderState, ExtensionProviderState, MessageInputSupport, InputMediaStrategyDescriptor, InputAttachmentStrategy, InputMediaType, } from './shared-types.js';
|
|
8
8
|
export type { InteractivePrompt, InteractiveQuestion, InteractiveOption, InteractivePromptResponse, InteractiveAnswer, } from './providers/types/interactive-prompt.js';
|
|
9
9
|
export { normalizeInteractivePrompt, normalizeInteractivePromptResponse, buildClaudeInteractiveToolResult, interactivePromptFromClaudeAskUserQuestion, detectClaudeAskUserQuestionPromptFromJson, } from './providers/types/interactive-prompt.js';
|
|
10
|
-
export type { RepoMesh, RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostPairingMetadata, RepoMeshHostStatus, RepoMeshNode, RepoMeshNodeHealth, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshRelatedRepo, RepoMeshNodeCapabilities, DetectedCommand, ProjectContextSnapshot, ProjectContextSource, RepoMeshCoordinatorConfig, LocalMeshConfig, LocalMeshEntry, LocalMeshNodeEntry, RepoMeshStatus, RepoMeshNodeStatus, RepoMeshPeerConnectionStatus, RepoMeshPeerConnectionState, RepoMeshPeerConnectionTransport, RepoMeshSessionStatus, RepoMeshQueueTask, RepoMeshQueueTaskStatus, RepoMeshQueueSummary, RepoMeshQueueStatus, RepoMeshLedgerEntryStatus, RepoMeshLedgerSummaryStatus, RepoMeshLedgerStatus, MeshAsyncJobLifecycle, RepoMeshSchedulingStrategy,
|
|
11
|
-
export { DEFAULT_MESH_POLICY, resolveDelegatedWorkerAutoApprove, MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, normalizeMeshSchedulingStrategy, resolveNodeSchedulingPriority, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, resolveAutoConvergeCodeChange,
|
|
10
|
+
export type { RepoMesh, RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostPairingMetadata, RepoMeshHostStatus, RepoMeshNode, RepoMeshNodeHealth, RepoMeshPolicy, RepoMeshNodePolicy, RepoMeshRelatedRepo, RepoMeshNodeCapabilities, DetectedCommand, ProjectContextSnapshot, ProjectContextSource, RepoMeshCoordinatorConfig, LocalMeshConfig, LocalMeshEntry, LocalMeshNodeEntry, RepoMeshStatus, RepoMeshNodeStatus, RepoMeshPeerConnectionStatus, RepoMeshPeerConnectionState, RepoMeshPeerConnectionTransport, RepoMeshSessionStatus, RepoMeshQueueTask, RepoMeshQueueTaskStatus, RepoMeshQueueSummary, RepoMeshQueueStatus, RepoMeshLedgerEntryStatus, RepoMeshLedgerSummaryStatus, RepoMeshLedgerStatus, MeshAsyncJobLifecycle, RepoMeshSchedulingStrategy, } from './repo-mesh-types.js';
|
|
11
|
+
export { DEFAULT_MESH_POLICY, resolveDelegatedWorkerAutoApprove, MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, normalizeMeshSchedulingStrategy, resolveNodeSchedulingPriority, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, resolveAutoConvergeCodeChange, } from './repo-mesh-types.js';
|
|
12
12
|
export * from './git/index.js';
|
|
13
13
|
import type { RuntimeWriteOwner as _RuntimeWriteOwner } from './shared-types-extra.js';
|
|
14
14
|
import type { RuntimeAttachedClient as _RuntimeAttachedClient } from './shared-types-extra.js';
|
|
@@ -49,7 +49,7 @@ export { fastForwardMeshNode } from './mesh/mesh-fast-forward.js';
|
|
|
49
49
|
export type { MeshFastForwardNodeArgs, MeshFastForwardPlannedStep, MeshFastForwardResult } from './mesh/mesh-fast-forward.js';
|
|
50
50
|
export { buildMeshLedgerReconciliationEvidence, buildMeshLedgerReplicaEvidence } from './mesh/mesh-ledger-reconciliation.js';
|
|
51
51
|
export type { AnyLedgerSlice, MeshLedgerReconciliationEvidence, MeshLedgerReplicaEvidence, MeshLedgerReplicaStatus } from './mesh/mesh-ledger-reconciliation.js';
|
|
52
|
-
export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, resolveConvergeRequiredTags,
|
|
52
|
+
export { enqueueTask, recordDirectDispatchTask, getQueue, claimNextTask, updateTaskStatus, updateSessionTaskStatus, cancelTask, requeueTask, getMeshQueueStats, getMeshQueueRevision, normalizeMeshTaskMode, validateMeshTaskModeRequest, buildMeshNodeCapabilityTags, nodeSatisfiesRequiredTags, normalizeMeshCapabilityTags, resolveConvergeRequiredTags, insertDirectDispatch, getActiveDirectDispatches, updateDirectDispatchStatus, cleanupTerminalDirectDispatches, markStaleDirectDispatches, deleteDirectDispatchesByTaskId, recordMeshToolCall, assertNoDependencyCycle, hasPendingDependents, describeTaskDependencyState } from './mesh/mesh-work-queue.js';
|
|
53
53
|
export type { MeshWorkQueueEntry, MeshTaskStatus, MeshTaskMode, MeshWorkQueueStats, MeshQueueMutationOptions, MeshTaskModeValidationResult, DirectDispatchRecord, MeshToolCallRateResult } from './mesh/mesh-work-queue.js';
|
|
54
54
|
export { buildCompactStaleDirectWorkSummary, buildMeshActiveWork, buildMeshActiveWorkSummary, classifyStaleDirectForPrune, PRUNABLE_ORPHAN_STALE_REASONS } from './mesh/mesh-active-work.js';
|
|
55
55
|
export type { StaleDirectPruneClassification } from './mesh/mesh-active-work.js';
|
|
@@ -81,7 +81,7 @@ export { DaemonCdpInitializer } from './cdp/initializer.js';
|
|
|
81
81
|
export type { CdpInitializerConfig } from './cdp/initializer.js';
|
|
82
82
|
export { DaemonCommandHandler } from './commands/handler.js';
|
|
83
83
|
export type { CommandResult, CommandContext } from './commands/handler.js';
|
|
84
|
-
export { DaemonCommandRouter, readCachedInlineMeshActiveSessionDetails } from './commands/router.js';
|
|
84
|
+
export { DaemonCommandRouter, readCachedInlineMeshActiveSessionDetails, resolveMeshNodeAttribution } from './commands/router.js';
|
|
85
85
|
export type { CommandRouterDeps, CommandRouterResult } from './commands/router.js';
|
|
86
86
|
export { maybeRunDaemonUpgradeHelperFromEnv, spawnDetachedDaemonUpgradeHelper, resolveCurrentGlobalInstallSurface, buildPinnedGlobalInstallCommand, execNpmCommandSync, getNpmExecOptions, } from './commands/upgrade-helper.js';
|
|
87
87
|
export type { DaemonUpgradeHelperPayload, CurrentGlobalInstallSurface, PinnedGlobalInstallCommand, NpmExecOptions, } from './commands/upgrade-helper.js';
|
package/dist/index.js
CHANGED
|
@@ -40,35 +40,6 @@ function resolveNodeSchedulingPriority(nodePolicy) {
|
|
|
40
40
|
const raw = Number(nodePolicy?.schedulingPriority);
|
|
41
41
|
return Number.isFinite(raw) ? raw : 0;
|
|
42
42
|
}
|
|
43
|
-
function resolveTaskAffinityRole(taskMode, policy) {
|
|
44
|
-
if (!taskMode) return null;
|
|
45
|
-
if (policy?.enabled === false) return null;
|
|
46
|
-
const override = policy?.byTaskMode && Object.prototype.hasOwnProperty.call(policy.byTaskMode, taskMode) ? policy.byTaskMode[taskMode] : void 0;
|
|
47
|
-
if (typeof override === "string") {
|
|
48
|
-
const trimmed = override.trim().toLowerCase();
|
|
49
|
-
return trimmed ? trimmed : null;
|
|
50
|
-
}
|
|
51
|
-
const fallback = DEFAULT_TASKMODE_ROLE_MAP[taskMode];
|
|
52
|
-
return fallback ?? null;
|
|
53
|
-
}
|
|
54
|
-
function resolveMeshRoleOptions(policy) {
|
|
55
|
-
const out = [...STANDARD_MESH_ROLES];
|
|
56
|
-
const seen = new Set(out);
|
|
57
|
-
const add = (raw) => {
|
|
58
|
-
if (typeof raw !== "string") return;
|
|
59
|
-
const role = raw.trim().toLowerCase();
|
|
60
|
-
if (!role || seen.has(role)) return;
|
|
61
|
-
seen.add(role);
|
|
62
|
-
out.push(role);
|
|
63
|
-
};
|
|
64
|
-
if (policy?.byTaskMode) {
|
|
65
|
-
for (const value of Object.values(policy.byTaskMode)) add(value);
|
|
66
|
-
}
|
|
67
|
-
if (Array.isArray(policy?.customRoles)) {
|
|
68
|
-
for (const value of policy.customRoles) add(value);
|
|
69
|
-
}
|
|
70
|
-
return out;
|
|
71
|
-
}
|
|
72
43
|
function resolveAutoConvergeCodeChange(policy) {
|
|
73
44
|
return policy?.autoConvergeCodeChange === true;
|
|
74
45
|
}
|
|
@@ -81,7 +52,7 @@ function resolveDelegatedWorkerAutoApprove(meshPolicy, nodePolicy) {
|
|
|
81
52
|
}
|
|
82
53
|
return true;
|
|
83
54
|
}
|
|
84
|
-
function
|
|
55
|
+
function resolveProviderMaxParallel(nodePolicy, providerType) {
|
|
85
56
|
const wanted = typeof providerType === "string" ? providerType.trim().toLowerCase() : "";
|
|
86
57
|
if (!wanted) return void 0;
|
|
87
58
|
const roles = nodePolicy?.providerRoles;
|
|
@@ -89,17 +60,14 @@ function resolveProviderRole(nodePolicy, providerType) {
|
|
|
89
60
|
for (const entry of roles) {
|
|
90
61
|
if (!entry || typeof entry !== "object") continue;
|
|
91
62
|
const type = typeof entry.providerType === "string" ? entry.providerType.trim().toLowerCase() : "";
|
|
92
|
-
if (type
|
|
63
|
+
if (!type || type !== wanted) continue;
|
|
64
|
+
const raw = Number(entry.maxParallel);
|
|
65
|
+
if (!Number.isFinite(raw) || raw < 0) return void 0;
|
|
66
|
+
return Math.floor(raw);
|
|
93
67
|
}
|
|
94
68
|
return void 0;
|
|
95
69
|
}
|
|
96
|
-
|
|
97
|
-
const role = resolveProviderRole(nodePolicy, providerType);
|
|
98
|
-
const raw = Number(role?.maxParallel);
|
|
99
|
-
if (!Number.isFinite(raw) || raw < 0) return void 0;
|
|
100
|
-
return Math.floor(raw);
|
|
101
|
-
}
|
|
102
|
-
var MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, STANDARD_MESH_ROLES, DEFAULT_TASKMODE_ROLE_MAP, DEFAULT_MESH_POLICY;
|
|
70
|
+
var MESH_SCHEDULING_STRATEGIES, DEFAULT_MESH_SCHEDULING_STRATEGY, MESH_CONVERGE_REFINE_TAG, MESH_CONVERGE_FAST_FORWARD_TAG, DEFAULT_MESH_POLICY;
|
|
103
71
|
var init_repo_mesh_types = __esm({
|
|
104
72
|
"src/repo-mesh-types.ts"() {
|
|
105
73
|
"use strict";
|
|
@@ -112,14 +80,6 @@ var init_repo_mesh_types = __esm({
|
|
|
112
80
|
DEFAULT_MESH_SCHEDULING_STRATEGY = "first_eligible";
|
|
113
81
|
MESH_CONVERGE_REFINE_TAG = "converge=refine";
|
|
114
82
|
MESH_CONVERGE_FAST_FORWARD_TAG = "converge=fast_forward";
|
|
115
|
-
STANDARD_MESH_ROLES = ["investigator", "coder", "validator", "converger"];
|
|
116
|
-
DEFAULT_TASKMODE_ROLE_MAP = {
|
|
117
|
-
live_debug_readonly: "investigator",
|
|
118
|
-
code_change: "coder",
|
|
119
|
-
launch_app: "coder",
|
|
120
|
-
validation: "validator",
|
|
121
|
-
convergence: "converger"
|
|
122
|
-
};
|
|
123
83
|
DEFAULT_MESH_POLICY = {
|
|
124
84
|
requirePreTaskCheckpoint: false,
|
|
125
85
|
requirePostTaskCheckpoint: true,
|
|
@@ -353,10 +313,10 @@ function readInjected(value) {
|
|
|
353
313
|
}
|
|
354
314
|
function getDaemonBuildInfo() {
|
|
355
315
|
if (cached) return cached;
|
|
356
|
-
const commit = readInjected(true ? "
|
|
357
|
-
const commitShort = readInjected(true ? "
|
|
358
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
359
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
316
|
+
const commit = readInjected(true ? "c19690a16292dbcb1ed5ff5458b94596fce46e38" : void 0) ?? "unknown";
|
|
317
|
+
const commitShort = readInjected(true ? "c19690a1" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
318
|
+
const version = readInjected(true ? "0.9.82-rc.322" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
319
|
+
const builtAt = readInjected(true ? "2026-06-19T05:42:02.504Z" : void 0);
|
|
360
320
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
361
321
|
return cached;
|
|
362
322
|
}
|
|
@@ -1589,11 +1549,42 @@ function loadMeshConfig() {
|
|
|
1589
1549
|
try {
|
|
1590
1550
|
const raw = JSON.parse((0, import_fs2.readFileSync)(path42, "utf-8"));
|
|
1591
1551
|
if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
|
|
1592
|
-
|
|
1552
|
+
const config = raw;
|
|
1553
|
+
const migrated = migrateLoadedMeshConfig(config);
|
|
1554
|
+
if (migrated) {
|
|
1555
|
+
try {
|
|
1556
|
+
saveMeshConfig(config);
|
|
1557
|
+
} catch {
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
return config;
|
|
1593
1561
|
} catch {
|
|
1594
1562
|
return { meshes: [] };
|
|
1595
1563
|
}
|
|
1596
1564
|
}
|
|
1565
|
+
function migrateLoadedMeshConfig(config) {
|
|
1566
|
+
let changed = false;
|
|
1567
|
+
for (const mesh of config.meshes) {
|
|
1568
|
+
if (!mesh || !Array.isArray(mesh.nodes)) continue;
|
|
1569
|
+
for (const node of mesh.nodes) {
|
|
1570
|
+
if (stripDeadRoleFromProviderRoles(node?.policy)) changed = true;
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
return changed;
|
|
1574
|
+
}
|
|
1575
|
+
function stripDeadRoleFromProviderRoles(policy) {
|
|
1576
|
+
if (!policy || typeof policy !== "object") return false;
|
|
1577
|
+
const roles = policy.providerRoles;
|
|
1578
|
+
if (!Array.isArray(roles)) return false;
|
|
1579
|
+
let changed = false;
|
|
1580
|
+
for (const entry of roles) {
|
|
1581
|
+
if (entry && typeof entry === "object" && !Array.isArray(entry) && Object.prototype.hasOwnProperty.call(entry, "role")) {
|
|
1582
|
+
delete entry.role;
|
|
1583
|
+
changed = true;
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
return changed;
|
|
1587
|
+
}
|
|
1597
1588
|
function normalizeCapabilityTags(value) {
|
|
1598
1589
|
if (!Array.isArray(value)) return void 0;
|
|
1599
1590
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1657,61 +1648,8 @@ function mergeMeshPolicy(base, patch) {
|
|
|
1657
1648
|
} else {
|
|
1658
1649
|
delete policy.autoConvergeCodeChange;
|
|
1659
1650
|
}
|
|
1660
|
-
const normalizedAffinity = normalizeTaskAffinityPolicy(policy.taskAffinity);
|
|
1661
|
-
if (normalizedAffinity) {
|
|
1662
|
-
policy.taskAffinity = normalizedAffinity;
|
|
1663
|
-
} else {
|
|
1664
|
-
delete policy.taskAffinity;
|
|
1665
|
-
}
|
|
1666
1651
|
return policy;
|
|
1667
1652
|
}
|
|
1668
|
-
function normalizeTaskAffinityPolicy(value) {
|
|
1669
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
1670
|
-
const record = value;
|
|
1671
|
-
const out = {};
|
|
1672
|
-
let hasContent = false;
|
|
1673
|
-
if (typeof record.enabled === "boolean") {
|
|
1674
|
-
out.enabled = record.enabled;
|
|
1675
|
-
if (record.enabled === false) hasContent = true;
|
|
1676
|
-
else delete out.enabled;
|
|
1677
|
-
}
|
|
1678
|
-
if (record.byTaskMode && typeof record.byTaskMode === "object" && !Array.isArray(record.byTaskMode)) {
|
|
1679
|
-
const byTaskMode = {};
|
|
1680
|
-
for (const [mode, raw] of Object.entries(record.byTaskMode)) {
|
|
1681
|
-
const modeKey = mode.trim();
|
|
1682
|
-
if (!modeKey) continue;
|
|
1683
|
-
if (typeof raw !== "string") continue;
|
|
1684
|
-
const role = raw.trim().toLowerCase();
|
|
1685
|
-
byTaskMode[modeKey] = role;
|
|
1686
|
-
if (role && !STANDARD_MESH_ROLES.includes(role)) {
|
|
1687
|
-
try {
|
|
1688
|
-
console.warn(`[mesh] task_affinity.byTaskMode.${modeKey}: custom role "${role}" is not a standard mesh role (${STANDARD_MESH_ROLES.join("/")}); routing still applies`);
|
|
1689
|
-
} catch {
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
if (Object.keys(byTaskMode).length > 0) {
|
|
1694
|
-
out.byTaskMode = byTaskMode;
|
|
1695
|
-
hasContent = true;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
if (Array.isArray(record.customRoles)) {
|
|
1699
|
-
const seen = /* @__PURE__ */ new Set();
|
|
1700
|
-
const customRoles = [];
|
|
1701
|
-
for (const raw of record.customRoles) {
|
|
1702
|
-
if (typeof raw !== "string") continue;
|
|
1703
|
-
const role = raw.trim().toLowerCase();
|
|
1704
|
-
if (!role || seen.has(role)) continue;
|
|
1705
|
-
seen.add(role);
|
|
1706
|
-
customRoles.push(role);
|
|
1707
|
-
}
|
|
1708
|
-
if (customRoles.length > 0) {
|
|
1709
|
-
out.customRoles = customRoles;
|
|
1710
|
-
hasContent = true;
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
return hasContent ? out : void 0;
|
|
1714
|
-
}
|
|
1715
1653
|
function normalizeAutoFastForwardPolicy(value) {
|
|
1716
1654
|
const record = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
1717
1655
|
const maxBehind = Number(record.maxBehind);
|
|
@@ -2168,11 +2106,10 @@ function buildNodeConfigSection(mesh) {
|
|
|
2168
2106
|
const providerRoles = Array.isArray(n.policy?.providerRoles) ? n.policy.providerRoles.map((r) => {
|
|
2169
2107
|
const type = typeof r?.providerType === "string" ? r.providerType.trim() : "";
|
|
2170
2108
|
if (!type) return "";
|
|
2171
|
-
const role = typeof r?.role === "string" && r.role.trim() ? `=${r.role.trim()}` : "";
|
|
2172
2109
|
const cap = Number.isFinite(Number(r?.maxParallel)) ? ` (max ${Math.floor(Number(r.maxParallel))})` : "";
|
|
2173
|
-
return `${type}${
|
|
2110
|
+
return `${type}${cap}`;
|
|
2174
2111
|
}).filter(Boolean) : [];
|
|
2175
|
-
const providerRolesSuffix = providerRoles.length ? ` |
|
|
2112
|
+
const providerRolesSuffix = providerRoles.length ? ` | caps: ${providerRoles.join(", ")}` : "";
|
|
2176
2113
|
lines.push(`- ${explicitLabel} nodeId: \`${n.id}\` | workspace: \`${n.workspace}\`${n.daemonId ? ` | daemon: \`${n.daemonId}\`` : ""}${providerPriority}${providerRolesSuffix}${suffix}`);
|
|
2177
2114
|
const nodePrompt = typeof n.systemPrompt === "string" ? n.systemPrompt.trim() : "";
|
|
2178
2115
|
if (nodePrompt) {
|
|
@@ -3005,7 +2942,6 @@ __export(mesh_work_queue_exports, {
|
|
|
3005
2942
|
recordTaskAutoLaunch: () => recordTaskAutoLaunch,
|
|
3006
2943
|
requeueTask: () => requeueTask,
|
|
3007
2944
|
resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
|
|
3008
|
-
resolveTaskAffinityRequiredTags: () => resolveTaskAffinityRequiredTags,
|
|
3009
2945
|
updateDirectDispatchStatus: () => updateDirectDispatchStatus,
|
|
3010
2946
|
updateSessionTaskStatus: () => updateSessionTaskStatus,
|
|
3011
2947
|
updateTaskStatus: () => updateTaskStatus,
|
|
@@ -3079,21 +3015,6 @@ function firstProviderPriority(policy) {
|
|
|
3079
3015
|
if (!Array.isArray(raw)) return void 0;
|
|
3080
3016
|
return raw.find((type) => typeof type === "string" && type.trim())?.trim();
|
|
3081
3017
|
}
|
|
3082
|
-
function roleCapabilityTags(policy, providerType) {
|
|
3083
|
-
const roles = policy && typeof policy === "object" && !Array.isArray(policy) ? policy.providerRoles : void 0;
|
|
3084
|
-
if (!Array.isArray(roles)) return [];
|
|
3085
|
-
const wantedProvider = typeof providerType === "string" && providerType.trim() ? providerType.trim().toLowerCase() : "";
|
|
3086
|
-
const out = [];
|
|
3087
|
-
for (const entry of roles) {
|
|
3088
|
-
if (!entry || typeof entry !== "object") continue;
|
|
3089
|
-
const type = typeof entry.providerType === "string" ? entry.providerType.trim().toLowerCase() : "";
|
|
3090
|
-
const role = typeof entry.role === "string" ? entry.role.trim().toLowerCase() : "";
|
|
3091
|
-
if (!role) continue;
|
|
3092
|
-
if (wantedProvider && type && type !== wantedProvider) continue;
|
|
3093
|
-
out.push(`role=${role}`);
|
|
3094
|
-
}
|
|
3095
|
-
return out;
|
|
3096
|
-
}
|
|
3097
3018
|
function buildMeshNodeCapabilityTags(node, providerType) {
|
|
3098
3019
|
const provider = typeof providerType === "string" && providerType.trim() ? providerType.trim() : firstProviderPriority(node?.policy);
|
|
3099
3020
|
const worktreeBranch = typeof node?.worktreeBranch === "string" && node.worktreeBranch.trim() ? node.worktreeBranch.trim() : null;
|
|
@@ -3116,14 +3037,7 @@ function buildMeshNodeCapabilityTags(node, providerType) {
|
|
|
3116
3037
|
// receives the task instead). Reuses the ordinary required-tags filter —
|
|
3117
3038
|
// the load-balancing scheduler auto-injects converge=refine for code_change
|
|
3118
3039
|
// so such work is hard-filtered onto refine-capable nodes.
|
|
3119
|
-
...node?.isLocalWorktree === true ? ["converge=refine"] : ["converge=fast_forward"]
|
|
3120
|
-
// Role-based routing: advertise role=<x> for each (node, provider) role
|
|
3121
|
-
// declared in policy.providerRoles. Narrowed to the selected provider when
|
|
3122
|
-
// one is given so the chosen provider must match a task's required role;
|
|
3123
|
-
// when no provider is selected, all declared roles are advertised for the
|
|
3124
|
-
// node-level eligibility scan. Reuses the ordinary required-tags filter —
|
|
3125
|
-
// no separate role field/gate.
|
|
3126
|
-
...roleCapabilityTags(node?.policy, providerType)
|
|
3040
|
+
...node?.isLocalWorktree === true ? ["converge=refine"] : ["converge=fast_forward"]
|
|
3127
3041
|
]);
|
|
3128
3042
|
}
|
|
3129
3043
|
function nodeSatisfiesRequiredTags(requiredTags, capabilityTags) {
|
|
@@ -3144,31 +3058,6 @@ function resolveConvergeRequiredTags(meshId, taskMode, explicitRequiredTags, opt
|
|
|
3144
3058
|
if (!optedIn) return explicitRequiredTags;
|
|
3145
3059
|
return normalizeMeshCapabilityTags([...explicitRequiredTags, MESH_CONVERGE_REFINE_TAG]);
|
|
3146
3060
|
}
|
|
3147
|
-
function meshHasNodeAdvertisingRole(nodes, role) {
|
|
3148
|
-
if (!Array.isArray(nodes) || nodes.length === 0) return false;
|
|
3149
|
-
const wanted = `role=${role}`;
|
|
3150
|
-
return nodes.some((node) => buildMeshNodeCapabilityTags(node).includes(wanted));
|
|
3151
|
-
}
|
|
3152
|
-
function resolveTaskAffinityRequiredTags(meshId, taskMode, explicitRequiredTags, opts) {
|
|
3153
|
-
if (typeof opts?.targetNodeId === "string" && opts.targetNodeId.trim()) return explicitRequiredTags;
|
|
3154
|
-
if (opts?.callerSpecifiedRequiredTags === true) return explicitRequiredTags;
|
|
3155
|
-
let mesh;
|
|
3156
|
-
try {
|
|
3157
|
-
mesh = getMesh(meshId);
|
|
3158
|
-
} catch {
|
|
3159
|
-
return explicitRequiredTags;
|
|
3160
|
-
}
|
|
3161
|
-
const role = resolveTaskAffinityRole(taskMode, mesh?.policy?.taskAffinity);
|
|
3162
|
-
if (!role) return explicitRequiredTags;
|
|
3163
|
-
if (!meshHasNodeAdvertisingRole(mesh?.nodes, role)) {
|
|
3164
|
-
try {
|
|
3165
|
-
console.warn(`[mesh] task_affinity: no node advertises role=${role} for taskMode=${taskMode} in mesh ${meshId}; skipping injection (least_loaded fallback)`);
|
|
3166
|
-
} catch {
|
|
3167
|
-
}
|
|
3168
|
-
return explicitRequiredTags;
|
|
3169
|
-
}
|
|
3170
|
-
return normalizeMeshCapabilityTags([...explicitRequiredTags, `role=${role}`]);
|
|
3171
|
-
}
|
|
3172
3061
|
function withQueueLock(_meshId, fn) {
|
|
3173
3062
|
return MeshRuntimeStore.getInstance().transaction(fn);
|
|
3174
3063
|
}
|
|
@@ -3220,19 +3109,12 @@ function enqueueTask(meshId, message, opts) {
|
|
|
3220
3109
|
}
|
|
3221
3110
|
assertNoDependencyCycle(meshId, id, dependsOn);
|
|
3222
3111
|
const callerTags = normalizeMeshCapabilityTags(opts?.requiredTags);
|
|
3223
|
-
const
|
|
3224
|
-
let resolvedRequiredTags = resolveConvergeRequiredTags(
|
|
3112
|
+
const resolvedRequiredTags = resolveConvergeRequiredTags(
|
|
3225
3113
|
meshId,
|
|
3226
3114
|
modeValidation.taskMode,
|
|
3227
3115
|
callerTags,
|
|
3228
3116
|
{ targetNodeId: opts?.targetNodeId }
|
|
3229
3117
|
);
|
|
3230
|
-
resolvedRequiredTags = resolveTaskAffinityRequiredTags(
|
|
3231
|
-
meshId,
|
|
3232
|
-
modeValidation.taskMode,
|
|
3233
|
-
resolvedRequiredTags,
|
|
3234
|
-
{ targetNodeId: opts?.targetNodeId, callerSpecifiedRequiredTags }
|
|
3235
|
-
);
|
|
3236
3118
|
const entry = {
|
|
3237
3119
|
id,
|
|
3238
3120
|
meshId,
|
|
@@ -16059,7 +15941,6 @@ __export(index_exports, {
|
|
|
16059
15941
|
DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS: () => DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
|
|
16060
15942
|
DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
|
|
16061
15943
|
DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
|
|
16062
|
-
DEFAULT_TASKMODE_ROLE_MAP: () => DEFAULT_TASKMODE_ROLE_MAP,
|
|
16063
15944
|
DEV_SERVER_PORT: () => DEV_SERVER_PORT,
|
|
16064
15945
|
DaemonAgentStreamManager: () => DaemonAgentStreamManager,
|
|
16065
15946
|
DaemonCdpInitializer: () => DaemonCdpInitializer,
|
|
@@ -16099,7 +15980,6 @@ __export(index_exports, {
|
|
|
16099
15980
|
RawTerminalAttachment: () => RawTerminalAttachment,
|
|
16100
15981
|
STALE_TERMINAL_REFINE_WINDOW_MS: () => STALE_TERMINAL_REFINE_WINDOW_MS,
|
|
16101
15982
|
STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
16102
|
-
STANDARD_MESH_ROLES: () => STANDARD_MESH_ROLES,
|
|
16103
15983
|
SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory,
|
|
16104
15984
|
TerminalAdapter: () => TerminalAdapter,
|
|
16105
15985
|
TurnSnapshotTracker: () => TurnSnapshotTracker,
|
|
@@ -16332,13 +16212,11 @@ __export(index_exports, {
|
|
|
16332
16212
|
resolveDeliveryDecision: () => resolveDeliveryDecision,
|
|
16333
16213
|
resolveGitRepository: () => resolveGitRepository,
|
|
16334
16214
|
resolveMeshHostStatus: () => resolveMeshHostStatus,
|
|
16215
|
+
resolveMeshNodeAttribution: () => resolveMeshNodeAttribution,
|
|
16335
16216
|
resolveMeshRefineValidationPlan: () => resolveMeshRefineValidationPlan,
|
|
16336
|
-
resolveMeshRoleOptions: () => resolveMeshRoleOptions,
|
|
16337
16217
|
resolveNodeSchedulingPriority: () => resolveNodeSchedulingPriority,
|
|
16338
16218
|
resolveSessionHostAppName: () => resolveSessionHostAppName,
|
|
16339
16219
|
resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution,
|
|
16340
|
-
resolveTaskAffinityRequiredTags: () => resolveTaskAffinityRequiredTags,
|
|
16341
|
-
resolveTaskAffinityRole: () => resolveTaskAffinityRole,
|
|
16342
16220
|
resolveWorktreePath: () => resolveWorktreePath,
|
|
16343
16221
|
runAsyncBatch: () => runAsyncBatch,
|
|
16344
16222
|
runGit: () => runGit,
|
|
@@ -42828,8 +42706,6 @@ function normalizeProviderRoles(value) {
|
|
|
42828
42706
|
const providerType = typeof rec.providerType === "string" ? rec.providerType.trim() : "";
|
|
42829
42707
|
if (!providerType) continue;
|
|
42830
42708
|
const entry = { providerType };
|
|
42831
|
-
const role = typeof rec.role === "string" ? rec.role.trim() : "";
|
|
42832
|
-
if (role) entry.role = role;
|
|
42833
42709
|
const maxParallel = Number(rec.maxParallel);
|
|
42834
42710
|
if (Number.isFinite(maxParallel) && maxParallel >= 0) entry.maxParallel = Math.floor(maxParallel);
|
|
42835
42711
|
byType.set(providerType.toLowerCase(), entry);
|
|
@@ -42899,7 +42775,7 @@ function buildMeshNodeDisplayLabel(node, nodeId, providerPriority) {
|
|
|
42899
42775
|
const explicit = readStringValue(node.machineLabel, node.machine_label, node.machineNickname, node.machine_nickname, node.alias);
|
|
42900
42776
|
if (explicit) return explicit;
|
|
42901
42777
|
const workspace = readStringValue(node.workspace, node.repoRoot, node.repo_root);
|
|
42902
|
-
const workspaceName = workspace ? (
|
|
42778
|
+
const workspaceName = workspace ? workingDirBasename(workspace) : void 0;
|
|
42903
42779
|
const host = readStringValue(node.machineName, node.machine_name, node.hostname, node.host, node.daemonId, node.daemon_id, node.machineId, node.machine_id);
|
|
42904
42780
|
const provider = providerPriority[0] || (Array.isArray(node.providers) ? readStringValue(...node.providers) : void 0);
|
|
42905
42781
|
const parts = [workspaceName, host, provider].filter(Boolean);
|
|
@@ -43396,6 +43272,13 @@ function readCachedInlineMeshActiveSessions(node) {
|
|
|
43396
43272
|
const sessionId = readStringValue(fallbackSession.id, fallbackSession.sessionId, fallbackSession.session_id, node?.activeSessionId, node?.active_session_id, node?.sessionId, node?.session_id);
|
|
43397
43273
|
return sessionId ? [sessionId] : [];
|
|
43398
43274
|
}
|
|
43275
|
+
function resolveMeshNodeAttribution(node) {
|
|
43276
|
+
const record = readObjectRecord(node);
|
|
43277
|
+
return {
|
|
43278
|
+
daemonId: readMeshNodeDaemonId(record),
|
|
43279
|
+
machineName: readMeshNodeDisplayMachineName(record)
|
|
43280
|
+
};
|
|
43281
|
+
}
|
|
43399
43282
|
function readCachedInlineMeshActiveSessionDetails(node) {
|
|
43400
43283
|
const cachedStatus = readObjectRecord(node?.cachedStatus);
|
|
43401
43284
|
const activeSession = readObjectRecord(cachedStatus.activeSession);
|
|
@@ -58614,7 +58497,6 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
58614
58497
|
DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
|
|
58615
58498
|
DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
|
|
58616
58499
|
DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
|
|
58617
|
-
DEFAULT_TASKMODE_ROLE_MAP,
|
|
58618
58500
|
DEV_SERVER_PORT,
|
|
58619
58501
|
DaemonAgentStreamManager,
|
|
58620
58502
|
DaemonCdpInitializer,
|
|
@@ -58654,7 +58536,6 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
58654
58536
|
RawTerminalAttachment,
|
|
58655
58537
|
STALE_TERMINAL_REFINE_WINDOW_MS,
|
|
58656
58538
|
STANDALONE_CDP_SCAN_INTERVAL_MS,
|
|
58657
|
-
STANDARD_MESH_ROLES,
|
|
58658
58539
|
SessionHostPtyTransportFactory,
|
|
58659
58540
|
TerminalAdapter,
|
|
58660
58541
|
TurnSnapshotTracker,
|
|
@@ -58887,13 +58768,11 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
58887
58768
|
resolveDeliveryDecision,
|
|
58888
58769
|
resolveGitRepository,
|
|
58889
58770
|
resolveMeshHostStatus,
|
|
58771
|
+
resolveMeshNodeAttribution,
|
|
58890
58772
|
resolveMeshRefineValidationPlan,
|
|
58891
|
-
resolveMeshRoleOptions,
|
|
58892
58773
|
resolveNodeSchedulingPriority,
|
|
58893
58774
|
resolveSessionHostAppName,
|
|
58894
58775
|
resolveSessionHostAppNameResolution,
|
|
58895
|
-
resolveTaskAffinityRequiredTags,
|
|
58896
|
-
resolveTaskAffinityRole,
|
|
58897
58776
|
resolveWorktreePath,
|
|
58898
58777
|
runAsyncBatch,
|
|
58899
58778
|
runGit,
|