@adhdev/daemon-standalone 0.9.82-rc.320 → 0.9.82-rc.321

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 CHANGED
@@ -29751,35 +29751,6 @@ var require_dist3 = __commonJS({
29751
29751
  const raw = Number(nodePolicy?.schedulingPriority);
29752
29752
  return Number.isFinite(raw) ? raw : 0;
29753
29753
  }
29754
- function resolveTaskAffinityRole(taskMode, policy) {
29755
- if (!taskMode) return null;
29756
- if (policy?.enabled === false) return null;
29757
- const override = policy?.byTaskMode && Object.prototype.hasOwnProperty.call(policy.byTaskMode, taskMode) ? policy.byTaskMode[taskMode] : void 0;
29758
- if (typeof override === "string") {
29759
- const trimmed = override.trim().toLowerCase();
29760
- return trimmed ? trimmed : null;
29761
- }
29762
- const fallback = DEFAULT_TASKMODE_ROLE_MAP[taskMode];
29763
- return fallback ?? null;
29764
- }
29765
- function resolveMeshRoleOptions(policy) {
29766
- const out = [...STANDARD_MESH_ROLES];
29767
- const seen = new Set(out);
29768
- const add = (raw) => {
29769
- if (typeof raw !== "string") return;
29770
- const role = raw.trim().toLowerCase();
29771
- if (!role || seen.has(role)) return;
29772
- seen.add(role);
29773
- out.push(role);
29774
- };
29775
- if (policy?.byTaskMode) {
29776
- for (const value of Object.values(policy.byTaskMode)) add(value);
29777
- }
29778
- if (Array.isArray(policy?.customRoles)) {
29779
- for (const value of policy.customRoles) add(value);
29780
- }
29781
- return out;
29782
- }
29783
29754
  function resolveAutoConvergeCodeChange(policy) {
29784
29755
  return policy?.autoConvergeCodeChange === true;
29785
29756
  }
@@ -29792,7 +29763,7 @@ var require_dist3 = __commonJS({
29792
29763
  }
29793
29764
  return true;
29794
29765
  }
29795
- function resolveProviderRole(nodePolicy, providerType) {
29766
+ function resolveProviderMaxParallel(nodePolicy, providerType) {
29796
29767
  const wanted = typeof providerType === "string" ? providerType.trim().toLowerCase() : "";
29797
29768
  if (!wanted) return void 0;
29798
29769
  const roles = nodePolicy?.providerRoles;
@@ -29800,22 +29771,17 @@ var require_dist3 = __commonJS({
29800
29771
  for (const entry of roles) {
29801
29772
  if (!entry || typeof entry !== "object") continue;
29802
29773
  const type = typeof entry.providerType === "string" ? entry.providerType.trim().toLowerCase() : "";
29803
- if (type && type === wanted) return entry;
29774
+ if (!type || type !== wanted) continue;
29775
+ const raw = Number(entry.maxParallel);
29776
+ if (!Number.isFinite(raw) || raw < 0) return void 0;
29777
+ return Math.floor(raw);
29804
29778
  }
29805
29779
  return void 0;
29806
29780
  }
29807
- function resolveProviderMaxParallel(nodePolicy, providerType) {
29808
- const role = resolveProviderRole(nodePolicy, providerType);
29809
- const raw = Number(role?.maxParallel);
29810
- if (!Number.isFinite(raw) || raw < 0) return void 0;
29811
- return Math.floor(raw);
29812
- }
29813
29781
  var MESH_SCHEDULING_STRATEGIES;
29814
29782
  var DEFAULT_MESH_SCHEDULING_STRATEGY;
29815
29783
  var MESH_CONVERGE_REFINE_TAG;
29816
29784
  var MESH_CONVERGE_FAST_FORWARD_TAG;
29817
- var STANDARD_MESH_ROLES;
29818
- var DEFAULT_TASKMODE_ROLE_MAP;
29819
29785
  var DEFAULT_MESH_POLICY;
29820
29786
  var init_repo_mesh_types = __esm2({
29821
29787
  "src/repo-mesh-types.ts"() {
@@ -29829,14 +29795,6 @@ var require_dist3 = __commonJS({
29829
29795
  DEFAULT_MESH_SCHEDULING_STRATEGY = "first_eligible";
29830
29796
  MESH_CONVERGE_REFINE_TAG = "converge=refine";
29831
29797
  MESH_CONVERGE_FAST_FORWARD_TAG = "converge=fast_forward";
29832
- STANDARD_MESH_ROLES = ["investigator", "coder", "validator", "converger"];
29833
- DEFAULT_TASKMODE_ROLE_MAP = {
29834
- live_debug_readonly: "investigator",
29835
- code_change: "coder",
29836
- launch_app: "coder",
29837
- validation: "validator",
29838
- convergence: "converger"
29839
- };
29840
29798
  DEFAULT_MESH_POLICY = {
29841
29799
  requirePreTaskCheckpoint: false,
29842
29800
  requirePostTaskCheckpoint: true,
@@ -30075,10 +30033,10 @@ var require_dist3 = __commonJS({
30075
30033
  }
30076
30034
  function getDaemonBuildInfo() {
30077
30035
  if (cached2) return cached2;
30078
- const commit = readInjected(true ? "bbaf30f95c09531cec77fb48a8cf6d38b3b6d7f9" : void 0) ?? "unknown";
30079
- const commitShort = readInjected(true ? "bbaf30f9" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30080
- const version2 = readInjected(true ? "0.9.82-rc.320" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30081
- const builtAt = readInjected(true ? "2026-06-19T01:17:04.320Z" : void 0);
30036
+ const commit = readInjected(true ? "d41c5687bc8d6f8a7c7f7ffeb3faac5801f146f1" : void 0) ?? "unknown";
30037
+ const commitShort = readInjected(true ? "d41c5687" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30038
+ const version2 = readInjected(true ? "0.9.82-rc.321" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30039
+ const builtAt = readInjected(true ? "2026-06-19T03:21:15.525Z" : void 0);
30082
30040
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30083
30041
  return cached2;
30084
30042
  }
@@ -31386,61 +31344,8 @@ ${error48.message || ""}`;
31386
31344
  } else {
31387
31345
  delete policy.autoConvergeCodeChange;
31388
31346
  }
31389
- const normalizedAffinity = normalizeTaskAffinityPolicy(policy.taskAffinity);
31390
- if (normalizedAffinity) {
31391
- policy.taskAffinity = normalizedAffinity;
31392
- } else {
31393
- delete policy.taskAffinity;
31394
- }
31395
31347
  return policy;
31396
31348
  }
31397
- function normalizeTaskAffinityPolicy(value) {
31398
- if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
31399
- const record2 = value;
31400
- const out = {};
31401
- let hasContent = false;
31402
- if (typeof record2.enabled === "boolean") {
31403
- out.enabled = record2.enabled;
31404
- if (record2.enabled === false) hasContent = true;
31405
- else delete out.enabled;
31406
- }
31407
- if (record2.byTaskMode && typeof record2.byTaskMode === "object" && !Array.isArray(record2.byTaskMode)) {
31408
- const byTaskMode = {};
31409
- for (const [mode, raw] of Object.entries(record2.byTaskMode)) {
31410
- const modeKey = mode.trim();
31411
- if (!modeKey) continue;
31412
- if (typeof raw !== "string") continue;
31413
- const role = raw.trim().toLowerCase();
31414
- byTaskMode[modeKey] = role;
31415
- if (role && !STANDARD_MESH_ROLES.includes(role)) {
31416
- try {
31417
- console.warn(`[mesh] task_affinity.byTaskMode.${modeKey}: custom role "${role}" is not a standard mesh role (${STANDARD_MESH_ROLES.join("/")}); routing still applies`);
31418
- } catch {
31419
- }
31420
- }
31421
- }
31422
- if (Object.keys(byTaskMode).length > 0) {
31423
- out.byTaskMode = byTaskMode;
31424
- hasContent = true;
31425
- }
31426
- }
31427
- if (Array.isArray(record2.customRoles)) {
31428
- const seen = /* @__PURE__ */ new Set();
31429
- const customRoles = [];
31430
- for (const raw of record2.customRoles) {
31431
- if (typeof raw !== "string") continue;
31432
- const role = raw.trim().toLowerCase();
31433
- if (!role || seen.has(role)) continue;
31434
- seen.add(role);
31435
- customRoles.push(role);
31436
- }
31437
- if (customRoles.length > 0) {
31438
- out.customRoles = customRoles;
31439
- hasContent = true;
31440
- }
31441
- }
31442
- return hasContent ? out : void 0;
31443
- }
31444
31349
  function normalizeAutoFastForwardPolicy(value) {
31445
31350
  const record2 = value && typeof value === "object" && !Array.isArray(value) ? value : {};
31446
31351
  const maxBehind = Number(record2.maxBehind);
@@ -31899,11 +31804,10 @@ Default branch: \`${mesh.defaultBranch}\`` : ""}`);
31899
31804
  const providerRoles = Array.isArray(n.policy?.providerRoles) ? n.policy.providerRoles.map((r) => {
31900
31805
  const type = typeof r?.providerType === "string" ? r.providerType.trim() : "";
31901
31806
  if (!type) return "";
31902
- const role = typeof r?.role === "string" && r.role.trim() ? `=${r.role.trim()}` : "";
31903
31807
  const cap = Number.isFinite(Number(r?.maxParallel)) ? ` (max ${Math.floor(Number(r.maxParallel))})` : "";
31904
- return `${type}${role}${cap}`;
31808
+ return `${type}${cap}`;
31905
31809
  }).filter(Boolean) : [];
31906
- const providerRolesSuffix = providerRoles.length ? ` | roles: ${providerRoles.join(", ")}` : "";
31810
+ const providerRolesSuffix = providerRoles.length ? ` | caps: ${providerRoles.join(", ")}` : "";
31907
31811
  lines.push(`- ${explicitLabel} nodeId: \`${n.id}\` | workspace: \`${n.workspace}\`${n.daemonId ? ` | daemon: \`${n.daemonId}\`` : ""}${providerPriority}${providerRolesSuffix}${suffix}`);
31908
31812
  const nodePrompt = typeof n.systemPrompt === "string" ? n.systemPrompt.trim() : "";
31909
31813
  if (nodePrompt) {
@@ -32753,7 +32657,6 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
32753
32657
  recordTaskAutoLaunch: () => recordTaskAutoLaunch,
32754
32658
  requeueTask: () => requeueTask,
32755
32659
  resolveConvergeRequiredTags: () => resolveConvergeRequiredTags,
32756
- resolveTaskAffinityRequiredTags: () => resolveTaskAffinityRequiredTags,
32757
32660
  updateDirectDispatchStatus: () => updateDirectDispatchStatus,
32758
32661
  updateSessionTaskStatus: () => updateSessionTaskStatus,
32759
32662
  updateTaskStatus: () => updateTaskStatus,
@@ -32827,21 +32730,6 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
32827
32730
  if (!Array.isArray(raw)) return void 0;
32828
32731
  return raw.find((type) => typeof type === "string" && type.trim())?.trim();
32829
32732
  }
32830
- function roleCapabilityTags(policy, providerType) {
32831
- const roles = policy && typeof policy === "object" && !Array.isArray(policy) ? policy.providerRoles : void 0;
32832
- if (!Array.isArray(roles)) return [];
32833
- const wantedProvider = typeof providerType === "string" && providerType.trim() ? providerType.trim().toLowerCase() : "";
32834
- const out = [];
32835
- for (const entry of roles) {
32836
- if (!entry || typeof entry !== "object") continue;
32837
- const type = typeof entry.providerType === "string" ? entry.providerType.trim().toLowerCase() : "";
32838
- const role = typeof entry.role === "string" ? entry.role.trim().toLowerCase() : "";
32839
- if (!role) continue;
32840
- if (wantedProvider && type && type !== wantedProvider) continue;
32841
- out.push(`role=${role}`);
32842
- }
32843
- return out;
32844
- }
32845
32733
  function buildMeshNodeCapabilityTags(node, providerType) {
32846
32734
  const provider = typeof providerType === "string" && providerType.trim() ? providerType.trim() : firstProviderPriority(node?.policy);
32847
32735
  const worktreeBranch = typeof node?.worktreeBranch === "string" && node.worktreeBranch.trim() ? node.worktreeBranch.trim() : null;
@@ -32864,14 +32752,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
32864
32752
  // receives the task instead). Reuses the ordinary required-tags filter —
32865
32753
  // the load-balancing scheduler auto-injects converge=refine for code_change
32866
32754
  // so such work is hard-filtered onto refine-capable nodes.
32867
- ...node?.isLocalWorktree === true ? ["converge=refine"] : ["converge=fast_forward"],
32868
- // Role-based routing: advertise role=<x> for each (node, provider) role
32869
- // declared in policy.providerRoles. Narrowed to the selected provider when
32870
- // one is given so the chosen provider must match a task's required role;
32871
- // when no provider is selected, all declared roles are advertised for the
32872
- // node-level eligibility scan. Reuses the ordinary required-tags filter —
32873
- // no separate role field/gate.
32874
- ...roleCapabilityTags(node?.policy, providerType)
32755
+ ...node?.isLocalWorktree === true ? ["converge=refine"] : ["converge=fast_forward"]
32875
32756
  ]);
32876
32757
  }
32877
32758
  function nodeSatisfiesRequiredTags(requiredTags, capabilityTags) {
@@ -32892,31 +32773,6 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
32892
32773
  if (!optedIn) return explicitRequiredTags;
32893
32774
  return normalizeMeshCapabilityTags([...explicitRequiredTags, MESH_CONVERGE_REFINE_TAG]);
32894
32775
  }
32895
- function meshHasNodeAdvertisingRole(nodes, role) {
32896
- if (!Array.isArray(nodes) || nodes.length === 0) return false;
32897
- const wanted = `role=${role}`;
32898
- return nodes.some((node) => buildMeshNodeCapabilityTags(node).includes(wanted));
32899
- }
32900
- function resolveTaskAffinityRequiredTags(meshId, taskMode, explicitRequiredTags, opts) {
32901
- if (typeof opts?.targetNodeId === "string" && opts.targetNodeId.trim()) return explicitRequiredTags;
32902
- if (opts?.callerSpecifiedRequiredTags === true) return explicitRequiredTags;
32903
- let mesh;
32904
- try {
32905
- mesh = getMesh(meshId);
32906
- } catch {
32907
- return explicitRequiredTags;
32908
- }
32909
- const role = resolveTaskAffinityRole(taskMode, mesh?.policy?.taskAffinity);
32910
- if (!role) return explicitRequiredTags;
32911
- if (!meshHasNodeAdvertisingRole(mesh?.nodes, role)) {
32912
- try {
32913
- console.warn(`[mesh] task_affinity: no node advertises role=${role} for taskMode=${taskMode} in mesh ${meshId}; skipping injection (least_loaded fallback)`);
32914
- } catch {
32915
- }
32916
- return explicitRequiredTags;
32917
- }
32918
- return normalizeMeshCapabilityTags([...explicitRequiredTags, `role=${role}`]);
32919
- }
32920
32776
  function withQueueLock(_meshId, fn) {
32921
32777
  return MeshRuntimeStore.getInstance().transaction(fn);
32922
32778
  }
@@ -32968,19 +32824,12 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
32968
32824
  }
32969
32825
  assertNoDependencyCycle(meshId, id, dependsOn);
32970
32826
  const callerTags = normalizeMeshCapabilityTags(opts?.requiredTags);
32971
- const callerSpecifiedRequiredTags = callerTags.length > 0;
32972
- let resolvedRequiredTags = resolveConvergeRequiredTags(
32827
+ const resolvedRequiredTags = resolveConvergeRequiredTags(
32973
32828
  meshId,
32974
32829
  modeValidation.taskMode,
32975
32830
  callerTags,
32976
32831
  { targetNodeId: opts?.targetNodeId }
32977
32832
  );
32978
- resolvedRequiredTags = resolveTaskAffinityRequiredTags(
32979
- meshId,
32980
- modeValidation.taskMode,
32981
- resolvedRequiredTags,
32982
- { targetNodeId: opts?.targetNodeId, callerSpecifiedRequiredTags }
32983
- );
32984
32833
  const entry = {
32985
32834
  id,
32986
32835
  meshId,
@@ -45846,7 +45695,6 @@ ${lastSnapshot}`;
45846
45695
  DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS: () => DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS,
45847
45696
  DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS,
45848
45697
  DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS: () => DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS,
45849
- DEFAULT_TASKMODE_ROLE_MAP: () => DEFAULT_TASKMODE_ROLE_MAP,
45850
45698
  DEV_SERVER_PORT: () => DEV_SERVER_PORT,
45851
45699
  DaemonAgentStreamManager: () => DaemonAgentStreamManager,
45852
45700
  DaemonCdpInitializer: () => DaemonCdpInitializer,
@@ -45886,7 +45734,6 @@ ${lastSnapshot}`;
45886
45734
  RawTerminalAttachment: () => RawTerminalAttachment,
45887
45735
  STALE_TERMINAL_REFINE_WINDOW_MS: () => STALE_TERMINAL_REFINE_WINDOW_MS,
45888
45736
  STANDALONE_CDP_SCAN_INTERVAL_MS: () => STANDALONE_CDP_SCAN_INTERVAL_MS2,
45889
- STANDARD_MESH_ROLES: () => STANDARD_MESH_ROLES,
45890
45737
  SessionHostPtyTransportFactory: () => SessionHostPtyTransportFactory2,
45891
45738
  TerminalAdapter: () => TerminalAdapter,
45892
45739
  TurnSnapshotTracker: () => TurnSnapshotTracker,
@@ -46120,12 +45967,9 @@ ${lastSnapshot}`;
46120
45967
  resolveGitRepository: () => resolveGitRepository,
46121
45968
  resolveMeshHostStatus: () => resolveMeshHostStatus,
46122
45969
  resolveMeshRefineValidationPlan: () => resolveMeshRefineValidationPlan,
46123
- resolveMeshRoleOptions: () => resolveMeshRoleOptions,
46124
45970
  resolveNodeSchedulingPriority: () => resolveNodeSchedulingPriority,
46125
45971
  resolveSessionHostAppName: () => resolveSessionHostAppName,
46126
45972
  resolveSessionHostAppNameResolution: () => resolveSessionHostAppNameResolution2,
46127
- resolveTaskAffinityRequiredTags: () => resolveTaskAffinityRequiredTags,
46128
- resolveTaskAffinityRole: () => resolveTaskAffinityRole,
46129
45973
  resolveWorktreePath: () => resolveWorktreePath,
46130
45974
  runAsyncBatch: () => runAsyncBatch2,
46131
45975
  runGit: () => runGit,
@@ -72373,8 +72217,6 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
72373
72217
  const providerType = typeof rec.providerType === "string" ? rec.providerType.trim() : "";
72374
72218
  if (!providerType) continue;
72375
72219
  const entry = { providerType };
72376
- const role = typeof rec.role === "string" ? rec.role.trim() : "";
72377
- if (role) entry.role = role;
72378
72220
  const maxParallel = Number(rec.maxParallel);
72379
72221
  if (Number.isFinite(maxParallel) && maxParallel >= 0) entry.maxParallel = Math.floor(maxParallel);
72380
72222
  byType.set(providerType.toLowerCase(), entry);