@adhdev/daemon-core 0.9.82-rc.321 → 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.
@@ -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
@@ -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
@@ -313,10 +313,10 @@ function readInjected(value) {
313
313
  }
314
314
  function getDaemonBuildInfo() {
315
315
  if (cached) return cached;
316
- const commit = readInjected(true ? "d41c5687bc8d6f8a7c7f7ffeb3faac5801f146f1" : void 0) ?? "unknown";
317
- const commitShort = readInjected(true ? "d41c5687" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
318
- const version = readInjected(true ? "0.9.82-rc.321" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
319
- const builtAt = readInjected(true ? "2026-06-19T03:20:44.153Z" : void 0);
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);
320
320
  cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
321
321
  return cached;
322
322
  }
@@ -1549,11 +1549,42 @@ function loadMeshConfig() {
1549
1549
  try {
1550
1550
  const raw = JSON.parse((0, import_fs2.readFileSync)(path42, "utf-8"));
1551
1551
  if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
1552
- return raw;
1552
+ const config = raw;
1553
+ const migrated = migrateLoadedMeshConfig(config);
1554
+ if (migrated) {
1555
+ try {
1556
+ saveMeshConfig(config);
1557
+ } catch {
1558
+ }
1559
+ }
1560
+ return config;
1553
1561
  } catch {
1554
1562
  return { meshes: [] };
1555
1563
  }
1556
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
+ }
1557
1588
  function normalizeCapabilityTags(value) {
1558
1589
  if (!Array.isArray(value)) return void 0;
1559
1590
  const seen = /* @__PURE__ */ new Set();
@@ -16181,6 +16212,7 @@ __export(index_exports, {
16181
16212
  resolveDeliveryDecision: () => resolveDeliveryDecision,
16182
16213
  resolveGitRepository: () => resolveGitRepository,
16183
16214
  resolveMeshHostStatus: () => resolveMeshHostStatus,
16215
+ resolveMeshNodeAttribution: () => resolveMeshNodeAttribution,
16184
16216
  resolveMeshRefineValidationPlan: () => resolveMeshRefineValidationPlan,
16185
16217
  resolveNodeSchedulingPriority: () => resolveNodeSchedulingPriority,
16186
16218
  resolveSessionHostAppName: () => resolveSessionHostAppName,
@@ -42743,7 +42775,7 @@ function buildMeshNodeDisplayLabel(node, nodeId, providerPriority) {
42743
42775
  const explicit = readStringValue(node.machineLabel, node.machine_label, node.machineNickname, node.machine_nickname, node.alias);
42744
42776
  if (explicit) return explicit;
42745
42777
  const workspace = readStringValue(node.workspace, node.repoRoot, node.repo_root);
42746
- const workspaceName = workspace ? (0, import_path11.basename)(workspace) : void 0;
42778
+ const workspaceName = workspace ? workingDirBasename(workspace) : void 0;
42747
42779
  const host = readStringValue(node.machineName, node.machine_name, node.hostname, node.host, node.daemonId, node.daemon_id, node.machineId, node.machine_id);
42748
42780
  const provider = providerPriority[0] || (Array.isArray(node.providers) ? readStringValue(...node.providers) : void 0);
42749
42781
  const parts = [workspaceName, host, provider].filter(Boolean);
@@ -43240,6 +43272,13 @@ function readCachedInlineMeshActiveSessions(node) {
43240
43272
  const sessionId = readStringValue(fallbackSession.id, fallbackSession.sessionId, fallbackSession.session_id, node?.activeSessionId, node?.active_session_id, node?.sessionId, node?.session_id);
43241
43273
  return sessionId ? [sessionId] : [];
43242
43274
  }
43275
+ function resolveMeshNodeAttribution(node) {
43276
+ const record = readObjectRecord(node);
43277
+ return {
43278
+ daemonId: readMeshNodeDaemonId(record),
43279
+ machineName: readMeshNodeDisplayMachineName(record)
43280
+ };
43281
+ }
43243
43282
  function readCachedInlineMeshActiveSessionDetails(node) {
43244
43283
  const cachedStatus = readObjectRecord(node?.cachedStatus);
43245
43284
  const activeSession = readObjectRecord(cachedStatus.activeSession);
@@ -58729,6 +58768,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
58729
58768
  resolveDeliveryDecision,
58730
58769
  resolveGitRepository,
58731
58770
  resolveMeshHostStatus,
58771
+ resolveMeshNodeAttribution,
58732
58772
  resolveMeshRefineValidationPlan,
58733
58773
  resolveNodeSchedulingPriority,
58734
58774
  resolveSessionHostAppName,