@adhdev/daemon-standalone 0.9.77-rc.59 → 0.9.77-rc.60

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/public/index.html CHANGED
@@ -7,8 +7,8 @@
7
7
  <meta name="description" content="ADHDev self-hosted dashboard for controlling AI agents" />
8
8
  <link rel="icon" href="/otter-logo.png" />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
10
- <script type="module" crossorigin src="/assets/index-DrOZKxcS.js"></script>
11
- <link rel="modulepreload" crossorigin href="/assets/vendor-BoAU5RMW.js">
10
+ <script type="module" crossorigin src="/assets/index-1dR7GlCc.js"></script>
11
+ <link rel="modulepreload" crossorigin href="/assets/vendor-CLec0455.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-01wE493H.css">
13
13
  </head>
14
14
  <body>
@@ -25122,7 +25122,6 @@ __export(dist_exports, {
25122
25122
  buildChatTailDeliverySignature: () => buildChatTailDeliverySignature,
25123
25123
  buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt,
25124
25124
  buildMachineInfo: () => buildMachineInfo,
25125
- buildMeshGraph: () => buildMeshGraph,
25126
25125
  buildMeshLedgerReconciliationEvidence: () => buildMeshLedgerReconciliationEvidence,
25127
25126
  buildMeshLedgerReplicaEvidence: () => buildMeshLedgerReplicaEvidence,
25128
25127
  buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
@@ -29434,227 +29433,6 @@ function buildMeshLedgerReconciliationEvidence(meshId, replicas) {
29434
29433
  }
29435
29434
  };
29436
29435
  }
29437
- function isDirty(git) {
29438
- if (!git) return false;
29439
- return git.staged + git.modified + git.untracked + git.deleted + git.renamed > 0;
29440
- }
29441
- function dirtyFileCount(git) {
29442
- if (!git) return 0;
29443
- return git.staged + git.modified + git.untracked + git.deleted + git.renamed;
29444
- }
29445
- function detectOrphanReasons(node, defaultBranch) {
29446
- const reasons = [];
29447
- const git = node.git;
29448
- if (!git) {
29449
- reasons.push("No git status available");
29450
- return reasons;
29451
- }
29452
- if (!git.isGitRepo) {
29453
- reasons.push("Not a git repository");
29454
- return reasons;
29455
- }
29456
- if (git.branch === null && git.headCommit) {
29457
- reasons.push("Detached HEAD");
29458
- }
29459
- if (git.branch && !git.upstream) {
29460
- if (defaultBranch && git.branch !== defaultBranch) {
29461
- reasons.push(`No upstream: ${git.branch}`);
29462
- }
29463
- }
29464
- if (git.branch && git.upstream === null && defaultBranch && git.branch !== defaultBranch) {
29465
- if (!reasons.includes(`No upstream: ${git.branch}`)) {
29466
- reasons.push(`No upstream: ${git.branch}`);
29467
- }
29468
- }
29469
- if (node.error) {
29470
- reasons.push(`Error: ${node.error}`);
29471
- }
29472
- return reasons;
29473
- }
29474
- function nodeHealthPriority(health) {
29475
- switch (health) {
29476
- case "online":
29477
- return 0;
29478
- case "dirty":
29479
- return 1;
29480
- case "degraded":
29481
- return 2;
29482
- case "wrong_branch":
29483
- return 3;
29484
- case "offline":
29485
- return 4;
29486
- case "unknown":
29487
- return 5;
29488
- default:
29489
- return 5;
29490
- }
29491
- }
29492
- function pickDominantHealth(healths) {
29493
- if (healths.length === 0) return "unknown";
29494
- return healths.reduce(
29495
- (best, h) => nodeHealthPriority(h) > nodeHealthPriority(best) ? h : best
29496
- );
29497
- }
29498
- function buildMeshGraph(status) {
29499
- const nodes = [];
29500
- const edges = [];
29501
- const warnings = [];
29502
- const branchToNodeIds = /* @__PURE__ */ new Map();
29503
- for (const nodeStatus of status.nodes) {
29504
- const git = nodeStatus.git;
29505
- const branch = git?.branch || null;
29506
- const orphanReasons = detectOrphanReasons(nodeStatus, null);
29507
- const dirty = isDirty(git);
29508
- const dfc = dirtyFileCount(git);
29509
- let type2 = "worktreeNode";
29510
- if (orphanReasons.length > 0) {
29511
- type2 = "orphanNode";
29512
- }
29513
- const graphNode = {
29514
- id: nodeStatus.nodeId,
29515
- type: type2,
29516
- label: nodeStatus.machineLabel || nodeStatus.nodeId.slice(0, 8),
29517
- workspace: nodeStatus.workspace,
29518
- branch,
29519
- health: nodeStatus.health,
29520
- ahead: git?.ahead ?? 0,
29521
- behind: git?.behind ?? 0,
29522
- dirty,
29523
- dirtyFiles: dfc,
29524
- hasConflicts: git?.hasConflicts ?? false,
29525
- activeSessionCount: nodeStatus.activeSessions?.length ?? 0,
29526
- activeSessions: nodeStatus.activeSessions ?? [],
29527
- providers: nodeStatus.providers ?? [],
29528
- isOrphan: orphanReasons.length > 0,
29529
- orphanReasons,
29530
- source: nodeStatus
29531
- };
29532
- nodes.push(graphNode);
29533
- if (branch) {
29534
- const list = branchToNodeIds.get(branch) ?? [];
29535
- list.push(graphNode.id);
29536
- branchToNodeIds.set(branch, list);
29537
- }
29538
- }
29539
- const branchUpstreamCounts = /* @__PURE__ */ new Map();
29540
- for (const n of status.nodes) {
29541
- const b = n.git?.branch;
29542
- const upstream = n.git?.upstream;
29543
- if (b && upstream) {
29544
- branchUpstreamCounts.set(b, (branchUpstreamCounts.get(b) ?? 0) + 1);
29545
- }
29546
- }
29547
- let inferredDefaultBranch = null;
29548
- let bestCount = 0;
29549
- for (const [b, count] of branchUpstreamCounts) {
29550
- if (count > bestCount) {
29551
- bestCount = count;
29552
- inferredDefaultBranch = b;
29553
- }
29554
- }
29555
- const defaultBranchNodeId = inferredDefaultBranch ? `__branch_${inferredDefaultBranch}` : null;
29556
- if (defaultBranchNodeId && inferredDefaultBranch) {
29557
- const branchNodes = branchToNodeIds.get(inferredDefaultBranch) ?? [];
29558
- const branchHealths = branchNodes.map(
29559
- (id) => nodes.find((n) => n.id === id).health
29560
- );
29561
- const defaultNode = {
29562
- id: defaultBranchNodeId,
29563
- type: "defaultBranchNode",
29564
- label: inferredDefaultBranch,
29565
- workspace: "",
29566
- branch: inferredDefaultBranch,
29567
- health: pickDominantHealth(branchHealths),
29568
- ahead: 0,
29569
- behind: 0,
29570
- dirty: false,
29571
- dirtyFiles: 0,
29572
- hasConflicts: false,
29573
- activeSessionCount: 0,
29574
- activeSessions: [],
29575
- providers: [],
29576
- isOrphan: false,
29577
- orphanReasons: [],
29578
- nextStepHint: branchNodes.length > 0 ? `${branchNodes.length} node(s) on default branch` : void 0,
29579
- source: {
29580
- nodeId: defaultBranchNodeId,
29581
- machineLabel: inferredDefaultBranch,
29582
- workspace: "",
29583
- health: "online",
29584
- providers: [],
29585
- activeSessions: []
29586
- }
29587
- };
29588
- nodes.push(defaultNode);
29589
- const seenBranches = /* @__PURE__ */ new Set();
29590
- for (const n of nodes) {
29591
- if (n.type === "defaultBranchNode") continue;
29592
- if (!n.branch) continue;
29593
- if (n.branch === inferredDefaultBranch) {
29594
- edges.push({
29595
- id: `${defaultBranchNodeId}--${n.id}`,
29596
- source: defaultBranchNodeId,
29597
- target: n.id,
29598
- type: "parentBranch",
29599
- label: "default"
29600
- });
29601
- continue;
29602
- }
29603
- if (seenBranches.has(n.branch)) continue;
29604
- seenBranches.add(n.branch);
29605
- edges.push({
29606
- id: `${defaultBranchNodeId}--branch_${n.branch}`,
29607
- source: defaultBranchNodeId,
29608
- target: n.branch,
29609
- type: "parentBranch",
29610
- label: n.branch
29611
- });
29612
- }
29613
- }
29614
- for (const [branch, ids] of branchToNodeIds) {
29615
- if (ids.length < 2) continue;
29616
- for (let i = 1; i < ids.length; i++) {
29617
- edges.push({
29618
- id: `wt_${ids[0]}--${ids[i]}`,
29619
- source: ids[0],
29620
- target: ids[i],
29621
- type: "worktreeLink",
29622
- label: branch
29623
- });
29624
- }
29625
- }
29626
- const orphanCount = nodes.filter((n) => n.isOrphan).length;
29627
- if (orphanCount > 0) {
29628
- warnings.push(`${orphanCount} orphan node(s) detected`);
29629
- }
29630
- const conflictCount = nodes.filter((n) => n.hasConflicts).length;
29631
- if (conflictCount > 0) {
29632
- warnings.push(`${conflictCount} node(s) with merge conflicts`);
29633
- }
29634
- const offlineCount = nodes.filter((n) => n.health === "offline").length;
29635
- if (offlineCount > 0) {
29636
- warnings.push(`${offlineCount} node(s) offline`);
29637
- }
29638
- const stats = {
29639
- totalNodes: status.nodes.length,
29640
- onlineNodes: status.nodes.filter((n) => n.health === "online").length,
29641
- dirtyNodes: nodes.filter((n) => n.dirty).length,
29642
- orphanNodes: orphanCount,
29643
- errorNodes: status.nodes.filter((n) => !!n.error).length,
29644
- offlineNodes: offlineCount,
29645
- totalActiveSessions: status.nodes.reduce((sum, n) => sum + (n.activeSessions?.length ?? 0), 0)
29646
- };
29647
- return {
29648
- meshId: status.meshId,
29649
- meshName: status.meshName,
29650
- repoIdentity: status.repoIdentity,
29651
- refreshedAt: status.refreshedAt,
29652
- nodes,
29653
- edges,
29654
- stats,
29655
- warnings
29656
- };
29657
- }
29658
29436
  function messageFromError(error48) {
29659
29437
  if (error48 instanceof Error) return error48.message;
29660
29438
  if (typeof error48 === "string") return error48;
@@ -55416,6 +55194,69 @@ ${block}`);
55416
55194
  return { success: false, error: e.message };
55417
55195
  }
55418
55196
  }
55197
+ case "mesh_status": {
55198
+ const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
55199
+ if (!meshId) return { success: false, error: "meshId required" };
55200
+ try {
55201
+ const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
55202
+ const mesh = meshRecord?.mesh;
55203
+ if (!mesh) return { success: false, error: "Mesh not found" };
55204
+ const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
55205
+ const queue = getQueue2(meshId);
55206
+ const queueSummary = getMeshQueueStats2(meshId);
55207
+ const { readLedgerEntries: readLedgerEntries2, getLedgerSummary: getLedgerSummary2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
55208
+ const ledgerEntries = readLedgerEntries2(meshId, { tail: 20 });
55209
+ const ledgerSummary = getLedgerSummary2(meshId);
55210
+ const nodeStatuses = [];
55211
+ for (const node of mesh.nodes || []) {
55212
+ const status = {
55213
+ nodeId: node.id || node.nodeId,
55214
+ workspace: node.workspace,
55215
+ repoRoot: node.repoRoot,
55216
+ isLocalWorktree: node.isLocalWorktree,
55217
+ worktreeBranch: node.worktreeBranch,
55218
+ daemonId: node.daemonId,
55219
+ machineId: node.machineId,
55220
+ health: "unknown"
55221
+ };
55222
+ if (node.workspace && typeof node.workspace === "string") {
55223
+ try {
55224
+ const { execFile: execFile3 } = await import("child_process");
55225
+ const { promisify: promisify3 } = await import("util");
55226
+ const execFileAsync3 = promisify3(execFile3);
55227
+ const branch = await execFileAsync3("git", ["-C", node.workspace, "branch", "--show-current"], {
55228
+ encoding: "utf8",
55229
+ timeout: 1e4
55230
+ }).then((r) => r.stdout.trim()).catch(() => "");
55231
+ const porc = await execFileAsync3("git", ["-C", node.workspace, "status", "--porcelain"], {
55232
+ encoding: "utf8",
55233
+ timeout: 1e4
55234
+ }).then((r) => r.stdout.trim()).catch(() => "");
55235
+ const dirty = porc.length > 0;
55236
+ status.branch = branch;
55237
+ status.isDirty = dirty;
55238
+ status.uncommittedChanges = porc ? porc.split("\n").filter(Boolean).length : 0;
55239
+ status.health = branch ? dirty ? "dirty" : "online" : "degraded";
55240
+ } catch {
55241
+ status.health = "degraded";
55242
+ }
55243
+ }
55244
+ nodeStatuses.push(status);
55245
+ }
55246
+ return {
55247
+ success: true,
55248
+ meshId: mesh.id,
55249
+ meshName: mesh.name,
55250
+ repoIdentity: mesh.repoIdentity,
55251
+ defaultBranch: mesh.defaultBranch,
55252
+ nodes: nodeStatuses,
55253
+ queue: { tasks: queue, summary: queueSummary },
55254
+ ledger: { entries: ledgerEntries, summary: ledgerSummary }
55255
+ };
55256
+ } catch (e) {
55257
+ return { success: false, error: e.message };
55258
+ }
55259
+ }
55419
55260
  default:
55420
55261
  break;
55421
55262
  }