@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/dist/index.js +63 -222
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-1dR7GlCc.js +98 -0
- package/public/assets/{terminal-DeDH5nlv.js → terminal-Cz61jYPm.js} +1 -1
- package/public/assets/vendor-CLec0455.js +2723 -0
- package/public/index.html +2 -2
- package/vendor/mcp-server/index.js +63 -222
- package/vendor/mcp-server/index.js.map +1 -1
- package/public/assets/index-DrOZKxcS.js +0 -170
- package/public/assets/vendor-BoAU5RMW.js +0 -2769
package/dist/index.js
CHANGED
|
@@ -27677,7 +27677,6 @@ ${lastSnapshot}`;
|
|
|
27677
27677
|
buildChatTailDeliverySignature: () => buildChatTailDeliverySignature,
|
|
27678
27678
|
buildCoordinatorSystemPrompt: () => buildCoordinatorSystemPrompt,
|
|
27679
27679
|
buildMachineInfo: () => buildMachineInfo2,
|
|
27680
|
-
buildMeshGraph: () => buildMeshGraph,
|
|
27681
27680
|
buildMeshLedgerReconciliationEvidence: () => buildMeshLedgerReconciliationEvidence,
|
|
27682
27681
|
buildMeshLedgerReplicaEvidence: () => buildMeshLedgerReplicaEvidence,
|
|
27683
27682
|
buildP2pRelayFailurePayload: () => buildP2pRelayFailurePayload,
|
|
@@ -29733,227 +29732,6 @@ ${lastSnapshot}`;
|
|
|
29733
29732
|
};
|
|
29734
29733
|
}
|
|
29735
29734
|
init_mesh_work_queue();
|
|
29736
|
-
function isDirty(git) {
|
|
29737
|
-
if (!git) return false;
|
|
29738
|
-
return git.staged + git.modified + git.untracked + git.deleted + git.renamed > 0;
|
|
29739
|
-
}
|
|
29740
|
-
function dirtyFileCount(git) {
|
|
29741
|
-
if (!git) return 0;
|
|
29742
|
-
return git.staged + git.modified + git.untracked + git.deleted + git.renamed;
|
|
29743
|
-
}
|
|
29744
|
-
function detectOrphanReasons(node, defaultBranch) {
|
|
29745
|
-
const reasons = [];
|
|
29746
|
-
const git = node.git;
|
|
29747
|
-
if (!git) {
|
|
29748
|
-
reasons.push("No git status available");
|
|
29749
|
-
return reasons;
|
|
29750
|
-
}
|
|
29751
|
-
if (!git.isGitRepo) {
|
|
29752
|
-
reasons.push("Not a git repository");
|
|
29753
|
-
return reasons;
|
|
29754
|
-
}
|
|
29755
|
-
if (git.branch === null && git.headCommit) {
|
|
29756
|
-
reasons.push("Detached HEAD");
|
|
29757
|
-
}
|
|
29758
|
-
if (git.branch && !git.upstream) {
|
|
29759
|
-
if (defaultBranch && git.branch !== defaultBranch) {
|
|
29760
|
-
reasons.push(`No upstream: ${git.branch}`);
|
|
29761
|
-
}
|
|
29762
|
-
}
|
|
29763
|
-
if (git.branch && git.upstream === null && defaultBranch && git.branch !== defaultBranch) {
|
|
29764
|
-
if (!reasons.includes(`No upstream: ${git.branch}`)) {
|
|
29765
|
-
reasons.push(`No upstream: ${git.branch}`);
|
|
29766
|
-
}
|
|
29767
|
-
}
|
|
29768
|
-
if (node.error) {
|
|
29769
|
-
reasons.push(`Error: ${node.error}`);
|
|
29770
|
-
}
|
|
29771
|
-
return reasons;
|
|
29772
|
-
}
|
|
29773
|
-
function nodeHealthPriority(health) {
|
|
29774
|
-
switch (health) {
|
|
29775
|
-
case "online":
|
|
29776
|
-
return 0;
|
|
29777
|
-
case "dirty":
|
|
29778
|
-
return 1;
|
|
29779
|
-
case "degraded":
|
|
29780
|
-
return 2;
|
|
29781
|
-
case "wrong_branch":
|
|
29782
|
-
return 3;
|
|
29783
|
-
case "offline":
|
|
29784
|
-
return 4;
|
|
29785
|
-
case "unknown":
|
|
29786
|
-
return 5;
|
|
29787
|
-
default:
|
|
29788
|
-
return 5;
|
|
29789
|
-
}
|
|
29790
|
-
}
|
|
29791
|
-
function pickDominantHealth(healths) {
|
|
29792
|
-
if (healths.length === 0) return "unknown";
|
|
29793
|
-
return healths.reduce(
|
|
29794
|
-
(best, h) => nodeHealthPriority(h) > nodeHealthPriority(best) ? h : best
|
|
29795
|
-
);
|
|
29796
|
-
}
|
|
29797
|
-
function buildMeshGraph(status) {
|
|
29798
|
-
const nodes = [];
|
|
29799
|
-
const edges = [];
|
|
29800
|
-
const warnings = [];
|
|
29801
|
-
const branchToNodeIds = /* @__PURE__ */ new Map();
|
|
29802
|
-
for (const nodeStatus of status.nodes) {
|
|
29803
|
-
const git = nodeStatus.git;
|
|
29804
|
-
const branch = git?.branch || null;
|
|
29805
|
-
const orphanReasons = detectOrphanReasons(nodeStatus, null);
|
|
29806
|
-
const dirty = isDirty(git);
|
|
29807
|
-
const dfc = dirtyFileCount(git);
|
|
29808
|
-
let type = "worktreeNode";
|
|
29809
|
-
if (orphanReasons.length > 0) {
|
|
29810
|
-
type = "orphanNode";
|
|
29811
|
-
}
|
|
29812
|
-
const graphNode = {
|
|
29813
|
-
id: nodeStatus.nodeId,
|
|
29814
|
-
type,
|
|
29815
|
-
label: nodeStatus.machineLabel || nodeStatus.nodeId.slice(0, 8),
|
|
29816
|
-
workspace: nodeStatus.workspace,
|
|
29817
|
-
branch,
|
|
29818
|
-
health: nodeStatus.health,
|
|
29819
|
-
ahead: git?.ahead ?? 0,
|
|
29820
|
-
behind: git?.behind ?? 0,
|
|
29821
|
-
dirty,
|
|
29822
|
-
dirtyFiles: dfc,
|
|
29823
|
-
hasConflicts: git?.hasConflicts ?? false,
|
|
29824
|
-
activeSessionCount: nodeStatus.activeSessions?.length ?? 0,
|
|
29825
|
-
activeSessions: nodeStatus.activeSessions ?? [],
|
|
29826
|
-
providers: nodeStatus.providers ?? [],
|
|
29827
|
-
isOrphan: orphanReasons.length > 0,
|
|
29828
|
-
orphanReasons,
|
|
29829
|
-
source: nodeStatus
|
|
29830
|
-
};
|
|
29831
|
-
nodes.push(graphNode);
|
|
29832
|
-
if (branch) {
|
|
29833
|
-
const list = branchToNodeIds.get(branch) ?? [];
|
|
29834
|
-
list.push(graphNode.id);
|
|
29835
|
-
branchToNodeIds.set(branch, list);
|
|
29836
|
-
}
|
|
29837
|
-
}
|
|
29838
|
-
const branchUpstreamCounts = /* @__PURE__ */ new Map();
|
|
29839
|
-
for (const n of status.nodes) {
|
|
29840
|
-
const b = n.git?.branch;
|
|
29841
|
-
const upstream = n.git?.upstream;
|
|
29842
|
-
if (b && upstream) {
|
|
29843
|
-
branchUpstreamCounts.set(b, (branchUpstreamCounts.get(b) ?? 0) + 1);
|
|
29844
|
-
}
|
|
29845
|
-
}
|
|
29846
|
-
let inferredDefaultBranch = null;
|
|
29847
|
-
let bestCount = 0;
|
|
29848
|
-
for (const [b, count] of branchUpstreamCounts) {
|
|
29849
|
-
if (count > bestCount) {
|
|
29850
|
-
bestCount = count;
|
|
29851
|
-
inferredDefaultBranch = b;
|
|
29852
|
-
}
|
|
29853
|
-
}
|
|
29854
|
-
const defaultBranchNodeId = inferredDefaultBranch ? `__branch_${inferredDefaultBranch}` : null;
|
|
29855
|
-
if (defaultBranchNodeId && inferredDefaultBranch) {
|
|
29856
|
-
const branchNodes = branchToNodeIds.get(inferredDefaultBranch) ?? [];
|
|
29857
|
-
const branchHealths = branchNodes.map(
|
|
29858
|
-
(id) => nodes.find((n) => n.id === id).health
|
|
29859
|
-
);
|
|
29860
|
-
const defaultNode = {
|
|
29861
|
-
id: defaultBranchNodeId,
|
|
29862
|
-
type: "defaultBranchNode",
|
|
29863
|
-
label: inferredDefaultBranch,
|
|
29864
|
-
workspace: "",
|
|
29865
|
-
branch: inferredDefaultBranch,
|
|
29866
|
-
health: pickDominantHealth(branchHealths),
|
|
29867
|
-
ahead: 0,
|
|
29868
|
-
behind: 0,
|
|
29869
|
-
dirty: false,
|
|
29870
|
-
dirtyFiles: 0,
|
|
29871
|
-
hasConflicts: false,
|
|
29872
|
-
activeSessionCount: 0,
|
|
29873
|
-
activeSessions: [],
|
|
29874
|
-
providers: [],
|
|
29875
|
-
isOrphan: false,
|
|
29876
|
-
orphanReasons: [],
|
|
29877
|
-
nextStepHint: branchNodes.length > 0 ? `${branchNodes.length} node(s) on default branch` : void 0,
|
|
29878
|
-
source: {
|
|
29879
|
-
nodeId: defaultBranchNodeId,
|
|
29880
|
-
machineLabel: inferredDefaultBranch,
|
|
29881
|
-
workspace: "",
|
|
29882
|
-
health: "online",
|
|
29883
|
-
providers: [],
|
|
29884
|
-
activeSessions: []
|
|
29885
|
-
}
|
|
29886
|
-
};
|
|
29887
|
-
nodes.push(defaultNode);
|
|
29888
|
-
const seenBranches = /* @__PURE__ */ new Set();
|
|
29889
|
-
for (const n of nodes) {
|
|
29890
|
-
if (n.type === "defaultBranchNode") continue;
|
|
29891
|
-
if (!n.branch) continue;
|
|
29892
|
-
if (n.branch === inferredDefaultBranch) {
|
|
29893
|
-
edges.push({
|
|
29894
|
-
id: `${defaultBranchNodeId}--${n.id}`,
|
|
29895
|
-
source: defaultBranchNodeId,
|
|
29896
|
-
target: n.id,
|
|
29897
|
-
type: "parentBranch",
|
|
29898
|
-
label: "default"
|
|
29899
|
-
});
|
|
29900
|
-
continue;
|
|
29901
|
-
}
|
|
29902
|
-
if (seenBranches.has(n.branch)) continue;
|
|
29903
|
-
seenBranches.add(n.branch);
|
|
29904
|
-
edges.push({
|
|
29905
|
-
id: `${defaultBranchNodeId}--branch_${n.branch}`,
|
|
29906
|
-
source: defaultBranchNodeId,
|
|
29907
|
-
target: n.branch,
|
|
29908
|
-
type: "parentBranch",
|
|
29909
|
-
label: n.branch
|
|
29910
|
-
});
|
|
29911
|
-
}
|
|
29912
|
-
}
|
|
29913
|
-
for (const [branch, ids] of branchToNodeIds) {
|
|
29914
|
-
if (ids.length < 2) continue;
|
|
29915
|
-
for (let i = 1; i < ids.length; i++) {
|
|
29916
|
-
edges.push({
|
|
29917
|
-
id: `wt_${ids[0]}--${ids[i]}`,
|
|
29918
|
-
source: ids[0],
|
|
29919
|
-
target: ids[i],
|
|
29920
|
-
type: "worktreeLink",
|
|
29921
|
-
label: branch
|
|
29922
|
-
});
|
|
29923
|
-
}
|
|
29924
|
-
}
|
|
29925
|
-
const orphanCount = nodes.filter((n) => n.isOrphan).length;
|
|
29926
|
-
if (orphanCount > 0) {
|
|
29927
|
-
warnings.push(`${orphanCount} orphan node(s) detected`);
|
|
29928
|
-
}
|
|
29929
|
-
const conflictCount = nodes.filter((n) => n.hasConflicts).length;
|
|
29930
|
-
if (conflictCount > 0) {
|
|
29931
|
-
warnings.push(`${conflictCount} node(s) with merge conflicts`);
|
|
29932
|
-
}
|
|
29933
|
-
const offlineCount = nodes.filter((n) => n.health === "offline").length;
|
|
29934
|
-
if (offlineCount > 0) {
|
|
29935
|
-
warnings.push(`${offlineCount} node(s) offline`);
|
|
29936
|
-
}
|
|
29937
|
-
const stats = {
|
|
29938
|
-
totalNodes: status.nodes.length,
|
|
29939
|
-
onlineNodes: status.nodes.filter((n) => n.health === "online").length,
|
|
29940
|
-
dirtyNodes: nodes.filter((n) => n.dirty).length,
|
|
29941
|
-
orphanNodes: orphanCount,
|
|
29942
|
-
errorNodes: status.nodes.filter((n) => !!n.error).length,
|
|
29943
|
-
offlineNodes: offlineCount,
|
|
29944
|
-
totalActiveSessions: status.nodes.reduce((sum, n) => sum + (n.activeSessions?.length ?? 0), 0)
|
|
29945
|
-
};
|
|
29946
|
-
return {
|
|
29947
|
-
meshId: status.meshId,
|
|
29948
|
-
meshName: status.meshName,
|
|
29949
|
-
repoIdentity: status.repoIdentity,
|
|
29950
|
-
refreshedAt: status.refreshedAt,
|
|
29951
|
-
nodes,
|
|
29952
|
-
edges,
|
|
29953
|
-
stats,
|
|
29954
|
-
warnings
|
|
29955
|
-
};
|
|
29956
|
-
}
|
|
29957
29735
|
init_mesh_events();
|
|
29958
29736
|
var NO_FALLBACK_REASON = "Repo Mesh command/data-plane is P2P-only; WS/REST command fallback is intentionally disabled to preserve the transport boundary.";
|
|
29959
29737
|
var P2P_NEXT_ACTION = "Check daemon/P2P health, wait briefly for connection establishment, then do one bounded retry or requeue the mesh task after clearing stale target session metadata.";
|
|
@@ -48157,6 +47935,69 @@ ${block}`);
|
|
|
48157
47935
|
return { success: false, error: e.message };
|
|
48158
47936
|
}
|
|
48159
47937
|
}
|
|
47938
|
+
case "mesh_status": {
|
|
47939
|
+
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
47940
|
+
if (!meshId) return { success: false, error: "meshId required" };
|
|
47941
|
+
try {
|
|
47942
|
+
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh);
|
|
47943
|
+
const mesh = meshRecord?.mesh;
|
|
47944
|
+
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
47945
|
+
const { getMeshQueueStats: getMeshQueueStats2, getQueue: getQueue2 } = await Promise.resolve().then(() => (init_mesh_work_queue(), mesh_work_queue_exports));
|
|
47946
|
+
const queue = getQueue2(meshId);
|
|
47947
|
+
const queueSummary = getMeshQueueStats2(meshId);
|
|
47948
|
+
const { readLedgerEntries: readLedgerEntries2, getLedgerSummary: getLedgerSummary2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
47949
|
+
const ledgerEntries = readLedgerEntries2(meshId, { tail: 20 });
|
|
47950
|
+
const ledgerSummary = getLedgerSummary2(meshId);
|
|
47951
|
+
const nodeStatuses = [];
|
|
47952
|
+
for (const node of mesh.nodes || []) {
|
|
47953
|
+
const status = {
|
|
47954
|
+
nodeId: node.id || node.nodeId,
|
|
47955
|
+
workspace: node.workspace,
|
|
47956
|
+
repoRoot: node.repoRoot,
|
|
47957
|
+
isLocalWorktree: node.isLocalWorktree,
|
|
47958
|
+
worktreeBranch: node.worktreeBranch,
|
|
47959
|
+
daemonId: node.daemonId,
|
|
47960
|
+
machineId: node.machineId,
|
|
47961
|
+
health: "unknown"
|
|
47962
|
+
};
|
|
47963
|
+
if (node.workspace && typeof node.workspace === "string") {
|
|
47964
|
+
try {
|
|
47965
|
+
const { execFile: execFile3 } = await import("child_process");
|
|
47966
|
+
const { promisify: promisify3 } = await import("util");
|
|
47967
|
+
const execFileAsync3 = promisify3(execFile3);
|
|
47968
|
+
const branch = await execFileAsync3("git", ["-C", node.workspace, "branch", "--show-current"], {
|
|
47969
|
+
encoding: "utf8",
|
|
47970
|
+
timeout: 1e4
|
|
47971
|
+
}).then((r) => r.stdout.trim()).catch(() => "");
|
|
47972
|
+
const porc = await execFileAsync3("git", ["-C", node.workspace, "status", "--porcelain"], {
|
|
47973
|
+
encoding: "utf8",
|
|
47974
|
+
timeout: 1e4
|
|
47975
|
+
}).then((r) => r.stdout.trim()).catch(() => "");
|
|
47976
|
+
const dirty = porc.length > 0;
|
|
47977
|
+
status.branch = branch;
|
|
47978
|
+
status.isDirty = dirty;
|
|
47979
|
+
status.uncommittedChanges = porc ? porc.split("\n").filter(Boolean).length : 0;
|
|
47980
|
+
status.health = branch ? dirty ? "dirty" : "online" : "degraded";
|
|
47981
|
+
} catch {
|
|
47982
|
+
status.health = "degraded";
|
|
47983
|
+
}
|
|
47984
|
+
}
|
|
47985
|
+
nodeStatuses.push(status);
|
|
47986
|
+
}
|
|
47987
|
+
return {
|
|
47988
|
+
success: true,
|
|
47989
|
+
meshId: mesh.id,
|
|
47990
|
+
meshName: mesh.name,
|
|
47991
|
+
repoIdentity: mesh.repoIdentity,
|
|
47992
|
+
defaultBranch: mesh.defaultBranch,
|
|
47993
|
+
nodes: nodeStatuses,
|
|
47994
|
+
queue: { tasks: queue, summary: queueSummary },
|
|
47995
|
+
ledger: { entries: ledgerEntries, summary: ledgerSummary }
|
|
47996
|
+
};
|
|
47997
|
+
} catch (e) {
|
|
47998
|
+
return { success: false, error: e.message };
|
|
47999
|
+
}
|
|
48000
|
+
}
|
|
48160
48001
|
default:
|
|
48161
48002
|
break;
|
|
48162
48003
|
}
|