@adhdev/daemon-standalone 0.9.82-rc.291 → 0.9.82-rc.292
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 +412 -286
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-2yXIHJt2.js +113 -0
- package/public/assets/index-BXhmv9C-.css +1 -0
- package/public/index.html +2 -2
package/dist/index.js
CHANGED
|
@@ -29983,10 +29983,10 @@ var require_dist3 = __commonJS({
|
|
|
29983
29983
|
}
|
|
29984
29984
|
function getDaemonBuildInfo() {
|
|
29985
29985
|
if (cached2) return cached2;
|
|
29986
|
-
const commit = readInjected(true ? "
|
|
29987
|
-
const commitShort = readInjected(true ? "
|
|
29988
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
29989
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
29986
|
+
const commit = readInjected(true ? "7b5b620e2df42c7c3beb8a2983e3cc076c25f832" : void 0) ?? "unknown";
|
|
29987
|
+
const commitShort = readInjected(true ? "7b5b620e" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
29988
|
+
const version2 = readInjected(true ? "0.9.82-rc.292" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
29989
|
+
const builtAt = readInjected(true ? "2026-06-16T09:16:52.266Z" : void 0);
|
|
29990
29990
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
29991
29991
|
return cached2;
|
|
29992
29992
|
}
|
|
@@ -35944,10 +35944,222 @@ ${rendered}`, "utf-8");
|
|
|
35944
35944
|
STATUS_OPTIONS = { refreshUpstream: true, includeSubmodules: true, timeoutMs: 15e3 };
|
|
35945
35945
|
}
|
|
35946
35946
|
});
|
|
35947
|
+
function readRecord3(value) {
|
|
35948
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
35949
|
+
}
|
|
35950
|
+
function readString5(...values) {
|
|
35951
|
+
for (const value of values) {
|
|
35952
|
+
if (typeof value !== "string") continue;
|
|
35953
|
+
const trimmed = value.trim();
|
|
35954
|
+
if (trimmed) return trimmed;
|
|
35955
|
+
}
|
|
35956
|
+
return void 0;
|
|
35957
|
+
}
|
|
35958
|
+
function readNumber(...values) {
|
|
35959
|
+
for (const value of values) {
|
|
35960
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
35961
|
+
}
|
|
35962
|
+
return void 0;
|
|
35963
|
+
}
|
|
35964
|
+
function readBoolean(...values) {
|
|
35965
|
+
for (const value of values) {
|
|
35966
|
+
if (typeof value === "boolean") return value;
|
|
35967
|
+
}
|
|
35968
|
+
return void 0;
|
|
35969
|
+
}
|
|
35970
|
+
function joinRepoPath(root, relativePath) {
|
|
35971
|
+
const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
|
|
35972
|
+
const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
|
|
35973
|
+
if (!normalizedPath) return void 0;
|
|
35974
|
+
if (/^(?:[A-Za-z]:[\\/]|\/)/.test(normalizedPath)) return normalizedPath;
|
|
35975
|
+
if (!normalizedRoot) return void 0;
|
|
35976
|
+
return `${normalizedRoot}/${normalizedPath.replace(/^[\\/]+/, "")}`;
|
|
35977
|
+
}
|
|
35978
|
+
function scoreGitUpstreamFreshness(status) {
|
|
35979
|
+
switch (status) {
|
|
35980
|
+
case "fresh":
|
|
35981
|
+
return 30;
|
|
35982
|
+
case "no_upstream":
|
|
35983
|
+
return 4;
|
|
35984
|
+
case "unchecked":
|
|
35985
|
+
case void 0:
|
|
35986
|
+
return 0;
|
|
35987
|
+
case "stale":
|
|
35988
|
+
return -10;
|
|
35989
|
+
case "unavailable":
|
|
35990
|
+
return -15;
|
|
35991
|
+
default:
|
|
35992
|
+
return 0;
|
|
35993
|
+
}
|
|
35994
|
+
}
|
|
35995
|
+
function readGitSubmodules(value, parentRepoRoot) {
|
|
35996
|
+
if (!Array.isArray(value)) return void 0;
|
|
35997
|
+
const submodules = value.map((entry) => {
|
|
35998
|
+
const submodule = readRecord3(entry);
|
|
35999
|
+
const path40 = readString5(submodule.path);
|
|
36000
|
+
const commit = readString5(submodule.commit);
|
|
36001
|
+
const repoPath = readString5(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path40);
|
|
36002
|
+
if (!path40 || !commit) return null;
|
|
36003
|
+
const result = {
|
|
36004
|
+
path: path40,
|
|
36005
|
+
commit,
|
|
36006
|
+
dirty: readBoolean(submodule.dirty) ?? false,
|
|
36007
|
+
outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
|
|
36008
|
+
lastCheckedAt: readNumber(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now()
|
|
36009
|
+
};
|
|
36010
|
+
if (repoPath) result.repoPath = repoPath;
|
|
36011
|
+
const error48 = readString5(submodule.error);
|
|
36012
|
+
if (error48) result.error = error48;
|
|
36013
|
+
return result;
|
|
36014
|
+
}).filter((entry) => entry !== null);
|
|
36015
|
+
return submodules.length > 0 ? submodules : void 0;
|
|
36016
|
+
}
|
|
36017
|
+
function hasGitStatusEvidence(status) {
|
|
36018
|
+
return readBoolean(status.isGitRepo) !== void 0 || Boolean(readString5(status.branch, status.upstream, status.upstreamStatus, status.upstream_status, status.headCommit)) || Boolean(readString5(status.repoRoot, status.repo_root, status.workspace)) || readNumber(
|
|
36019
|
+
status.ahead,
|
|
36020
|
+
status.behind,
|
|
36021
|
+
status.staged,
|
|
36022
|
+
status.modified,
|
|
36023
|
+
status.untracked,
|
|
36024
|
+
status.deleted,
|
|
36025
|
+
status.renamed,
|
|
36026
|
+
status.lastCheckedAt,
|
|
36027
|
+
status.last_checked_at
|
|
36028
|
+
) !== void 0 || Array.isArray(status.submodules) && status.submodules.length > 0;
|
|
36029
|
+
}
|
|
36030
|
+
function normalizeGitStatus(status, node, options) {
|
|
36031
|
+
const explicitIsGitRepo = readBoolean(status.isGitRepo);
|
|
36032
|
+
if (!Object.keys(status).length || !hasGitStatusEvidence(status)) return void 0;
|
|
36033
|
+
const isGitRepo = explicitIsGitRepo ?? true;
|
|
36034
|
+
const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((entry) => typeof entry === "string") : [];
|
|
36035
|
+
const conflictCount = readNumber(status.conflicts) ?? conflictFiles.length;
|
|
36036
|
+
const hasConflicts = readBoolean(status.hasConflicts) ?? conflictCount > 0;
|
|
36037
|
+
const repoRoot = readString5(status.repoRoot, status.repo_root, node.repoRoot, node.repo_root, status.workspace, node.workspace) || void 0;
|
|
36038
|
+
const submodules = readGitSubmodules(status.submodules, repoRoot);
|
|
36039
|
+
const upstreamStatus = readString5(status.upstreamStatus, status.upstream_status);
|
|
36040
|
+
const upstreamFetchedAt = readNumber(status.upstreamFetchedAt, status.upstream_fetched_at);
|
|
36041
|
+
const upstreamFetchError = readString5(status.upstreamFetchError, status.upstream_fetch_error);
|
|
36042
|
+
const error48 = readString5(status.error);
|
|
36043
|
+
const staged = readNumber(status.staged) ?? 0;
|
|
36044
|
+
const modified = readNumber(status.modified) ?? 0;
|
|
36045
|
+
const untracked = readNumber(status.untracked) ?? 0;
|
|
36046
|
+
const deleted = readNumber(status.deleted) ?? 0;
|
|
36047
|
+
const renamed = readNumber(status.renamed) ?? 0;
|
|
36048
|
+
return {
|
|
36049
|
+
workspace: readString5(status.workspace, node.workspace) || "",
|
|
36050
|
+
repoRoot: repoRoot ?? null,
|
|
36051
|
+
isGitRepo,
|
|
36052
|
+
branch: readString5(status.branch) ?? null,
|
|
36053
|
+
headCommit: readString5(status.headCommit) ?? null,
|
|
36054
|
+
headMessage: readString5(status.headMessage) ?? null,
|
|
36055
|
+
upstream: readString5(status.upstream) ?? null,
|
|
36056
|
+
upstreamStatus: upstreamStatus ?? "unchecked",
|
|
36057
|
+
...upstreamFetchedAt !== void 0 ? { upstreamFetchedAt } : {},
|
|
36058
|
+
...upstreamFetchError ? { upstreamFetchError } : {},
|
|
36059
|
+
ahead: readNumber(status.ahead) ?? 0,
|
|
36060
|
+
behind: readNumber(status.behind) ?? 0,
|
|
36061
|
+
staged,
|
|
36062
|
+
modified,
|
|
36063
|
+
untracked,
|
|
36064
|
+
deleted,
|
|
36065
|
+
renamed,
|
|
36066
|
+
dirty: readBoolean(status.dirty, status.isDirty, status.is_dirty) ?? (staged + modified + untracked + deleted + renamed > 0 || hasConflicts),
|
|
36067
|
+
hasConflicts,
|
|
36068
|
+
conflictFiles,
|
|
36069
|
+
stashCount: readNumber(status.stashCount, status.stash_count) ?? 0,
|
|
36070
|
+
lastCheckedAt: options?.lastCheckedAt ?? readNumber(status.lastCheckedAt, status.last_checked_at) ?? Date.now(),
|
|
36071
|
+
...submodules ? { submodules } : {},
|
|
36072
|
+
...error48 ? { error: error48 } : {}
|
|
36073
|
+
};
|
|
36074
|
+
}
|
|
36075
|
+
function scoreGitStatusCandidate(git) {
|
|
36076
|
+
if (!git) return Number.NEGATIVE_INFINITY;
|
|
36077
|
+
let score = 0;
|
|
36078
|
+
if (git.isGitRepo === true) score += 50;
|
|
36079
|
+
if (git.isGitRepo === false) score -= 10;
|
|
36080
|
+
if (git.branch) score += 20;
|
|
36081
|
+
if (git.headCommit) score += 20;
|
|
36082
|
+
if (git.upstream) score += 10;
|
|
36083
|
+
score += scoreGitUpstreamFreshness(git.upstreamStatus);
|
|
36084
|
+
if (typeof git.ahead === "number") score += 2;
|
|
36085
|
+
if (typeof git.behind === "number") score += 2;
|
|
36086
|
+
if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
|
|
36087
|
+
if (git.error) score -= 20;
|
|
36088
|
+
return score;
|
|
36089
|
+
}
|
|
36090
|
+
function pickBestTransitGitStatus(node, options) {
|
|
36091
|
+
const rawGit = readRecord3(node.lastGit ?? node.last_git);
|
|
36092
|
+
const gitResult = readRecord3(rawGit.result);
|
|
36093
|
+
const directStatus = readRecord3(rawGit.status);
|
|
36094
|
+
const nestedStatus = readRecord3(gitResult.status);
|
|
36095
|
+
const rawProbe = readRecord3(node.lastProbe ?? node.last_probe);
|
|
36096
|
+
const probeGit = readRecord3(rawProbe.git);
|
|
36097
|
+
const probeGitResult = readRecord3(probeGit.result);
|
|
36098
|
+
const probeDirectStatus = readRecord3(probeGit.status);
|
|
36099
|
+
const probeNestedStatus = readRecord3(probeGitResult.status);
|
|
36100
|
+
const lastCheckedAt = options?.lastCheckedAt;
|
|
36101
|
+
let best = null;
|
|
36102
|
+
for (const status of [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus]) {
|
|
36103
|
+
const normalized = normalizeGitStatus(status, node, { lastCheckedAt: lastCheckedAt ?? Date.now() });
|
|
36104
|
+
if (!normalized) continue;
|
|
36105
|
+
const score = scoreGitStatusCandidate(normalized);
|
|
36106
|
+
if (!best || score > best.score) best = { git: normalized, score };
|
|
36107
|
+
}
|
|
36108
|
+
return best?.git;
|
|
36109
|
+
}
|
|
36110
|
+
function normalizeMeshNodeId(node) {
|
|
36111
|
+
const record2 = node && typeof node === "object" ? node : {};
|
|
36112
|
+
return readString5(record2.id, record2.nodeId, record2.node_id);
|
|
36113
|
+
}
|
|
36114
|
+
function meshNodeIdMatches(node, candidateId) {
|
|
36115
|
+
if (!candidateId) return false;
|
|
36116
|
+
const trimmed = candidateId.trim();
|
|
36117
|
+
if (!trimmed) return false;
|
|
36118
|
+
return normalizeMeshNodeId(node) === trimmed;
|
|
36119
|
+
}
|
|
36120
|
+
function summarizeGitShape(status) {
|
|
36121
|
+
const record2 = readRecord3(status);
|
|
36122
|
+
if (!Object.keys(record2).length) return null;
|
|
36123
|
+
const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
|
|
36124
|
+
const sub = readRecord3(entry);
|
|
36125
|
+
return {
|
|
36126
|
+
path: readString5(sub.path) ?? null,
|
|
36127
|
+
commit: readString5(sub.commit)?.slice(0, 12) ?? null,
|
|
36128
|
+
dirty: readBoolean(sub.dirty) ?? false,
|
|
36129
|
+
outOfSync: readBoolean(sub.outOfSync, sub.out_of_sync) ?? false
|
|
36130
|
+
};
|
|
36131
|
+
}) : [];
|
|
36132
|
+
return {
|
|
36133
|
+
isGitRepo: readBoolean(record2.isGitRepo),
|
|
36134
|
+
workspace: readString5(record2.workspace) ?? null,
|
|
36135
|
+
repoRoot: readString5(record2.repoRoot, record2.repo_root) ?? null,
|
|
36136
|
+
branch: readString5(record2.branch) ?? null,
|
|
36137
|
+
upstream: readString5(record2.upstream) ?? null,
|
|
36138
|
+
upstreamStatus: readString5(record2.upstreamStatus, record2.upstream_status) ?? null,
|
|
36139
|
+
headCommit: readString5(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
|
|
36140
|
+
ahead: readNumber(record2.ahead) ?? null,
|
|
36141
|
+
behind: readNumber(record2.behind) ?? null,
|
|
36142
|
+
dirtyCounts: {
|
|
36143
|
+
staged: readNumber(record2.staged) ?? 0,
|
|
36144
|
+
modified: readNumber(record2.modified) ?? 0,
|
|
36145
|
+
untracked: readNumber(record2.untracked) ?? 0,
|
|
36146
|
+
deleted: readNumber(record2.deleted) ?? 0,
|
|
36147
|
+
renamed: readNumber(record2.renamed) ?? 0
|
|
36148
|
+
},
|
|
36149
|
+
lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
|
|
36150
|
+
submoduleCount: submodules.length,
|
|
36151
|
+
submodules
|
|
36152
|
+
};
|
|
36153
|
+
}
|
|
36154
|
+
var init_dist = __esm2({
|
|
36155
|
+
"../mesh-shared/dist/index.mjs"() {
|
|
36156
|
+
"use strict";
|
|
36157
|
+
}
|
|
36158
|
+
});
|
|
35947
36159
|
function readNonEmptyString2(value) {
|
|
35948
36160
|
return typeof value === "string" && value.trim() ? value.trim() : "";
|
|
35949
36161
|
}
|
|
35950
|
-
function
|
|
36162
|
+
function readRecord4(value) {
|
|
35951
36163
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
35952
36164
|
}
|
|
35953
36165
|
function buildMeshWorkerRelayStamp(currentSettings, meshContext) {
|
|
@@ -35971,13 +36183,13 @@ ${rendered}`, "utf-8");
|
|
|
35971
36183
|
return readNonEmptyString2(event.targetSessionId) || readNonEmptyString2(event.sessionId) || readNonEmptyString2(event.instanceId) || readNonEmptyString2(fallback);
|
|
35972
36184
|
}
|
|
35973
36185
|
function readRefineJobId(event) {
|
|
35974
|
-
const metadata =
|
|
35975
|
-
const result =
|
|
35976
|
-
const refineJob =
|
|
36186
|
+
const metadata = readRecord4(event.metadataEvent) || event;
|
|
36187
|
+
const result = readRecord4(metadata.result);
|
|
36188
|
+
const refineJob = readRecord4(result?.refineJob);
|
|
35977
36189
|
return readNonEmptyString2(metadata.jobId) || readNonEmptyString2(refineJob?.jobId);
|
|
35978
36190
|
}
|
|
35979
36191
|
function readWorkerResultMetadata(event) {
|
|
35980
|
-
return
|
|
36192
|
+
return readRecord4(event.workerResult) || readRecord4(event.meshWorkerResult) || readRecord4(event.structuredResult);
|
|
35981
36193
|
}
|
|
35982
36194
|
function formatCompletionMetadata(event) {
|
|
35983
36195
|
const completionDiagnostic = event.completionDiagnostic && typeof event.completionDiagnostic === "object" ? event.completionDiagnostic : null;
|
|
@@ -36055,10 +36267,10 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
36055
36267
|
}
|
|
36056
36268
|
if (args.event === "refine:completed") {
|
|
36057
36269
|
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
36058
|
-
const result =
|
|
36059
|
-
const validationSummary =
|
|
36060
|
-
const patchEquivalence =
|
|
36061
|
-
const finalConvergence =
|
|
36270
|
+
const result = readRecord4(args.metadataEvent.result);
|
|
36271
|
+
const validationSummary = readRecord4(result?.validationSummary);
|
|
36272
|
+
const patchEquivalence = readRecord4(result?.patchEquivalence);
|
|
36273
|
+
const finalConvergence = readRecord4(result?.finalBranchConvergenceState);
|
|
36062
36274
|
const validationStatus = readNonEmptyString2(validationSummary?.status);
|
|
36063
36275
|
const patchStatus = readNonEmptyString2(patchEquivalence?.status) || (patchEquivalence?.equivalent === true ? "passed" : "");
|
|
36064
36276
|
const into = readNonEmptyString2(result?.into);
|
|
@@ -36079,10 +36291,10 @@ Next step: ${nextStep}`;
|
|
|
36079
36291
|
}
|
|
36080
36292
|
if (args.event === "refine:failed") {
|
|
36081
36293
|
const jobId = readRefineJobId({ metadataEvent: args.metadataEvent });
|
|
36082
|
-
const result =
|
|
36083
|
-
const validationSummary =
|
|
36084
|
-
const patchEquivalence =
|
|
36085
|
-
const finalConvergence =
|
|
36294
|
+
const result = readRecord4(args.metadataEvent.result);
|
|
36295
|
+
const validationSummary = readRecord4(result?.validationSummary);
|
|
36296
|
+
const patchEquivalence = readRecord4(result?.patchEquivalence);
|
|
36297
|
+
const finalConvergence = readRecord4(result?.finalBranchConvergenceState);
|
|
36086
36298
|
const code = readNonEmptyString2(result?.code);
|
|
36087
36299
|
const error48 = readNonEmptyString2(result?.error);
|
|
36088
36300
|
const validationStatus = readNonEmptyString2(validationSummary?.status);
|
|
@@ -36127,9 +36339,9 @@ Next step: ${nextStep}`;
|
|
|
36127
36339
|
return out;
|
|
36128
36340
|
}
|
|
36129
36341
|
function readRefineJobId2(event) {
|
|
36130
|
-
const metadata =
|
|
36131
|
-
const result =
|
|
36132
|
-
const refineJob =
|
|
36342
|
+
const metadata = readRecord4(event.metadataEvent) || event;
|
|
36343
|
+
const result = readRecord4(metadata.result);
|
|
36344
|
+
const refineJob = readRecord4(result?.refineJob);
|
|
36133
36345
|
return readNonEmptyString2(metadata.jobId) || readNonEmptyString2(refineJob?.jobId);
|
|
36134
36346
|
}
|
|
36135
36347
|
function hasPendingRefineTerminalEventDuplicate(event) {
|
|
@@ -36141,13 +36353,13 @@ Next step: ${nextStep}`;
|
|
|
36141
36353
|
);
|
|
36142
36354
|
}
|
|
36143
36355
|
function buildPendingEventFingerprint(event) {
|
|
36144
|
-
const metadata =
|
|
36356
|
+
const metadata = readRecord4(event.metadataEvent) || {};
|
|
36145
36357
|
if (event.event === "worktree_bootstrap_complete" || event.event === "worktree_bootstrap_failed") {
|
|
36146
36358
|
return [event.meshId, event.event, event.nodeId || ""].join("::");
|
|
36147
36359
|
}
|
|
36148
36360
|
const sessionId = resolveEventSessionId(metadata);
|
|
36149
36361
|
const providerSessionId = readNonEmptyString2(metadata.providerSessionId);
|
|
36150
|
-
const taskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(
|
|
36362
|
+
const taskId = readNonEmptyString2(metadata.taskId) || readNonEmptyString2(readRecord4(metadata.payload)?.taskId);
|
|
36151
36363
|
const jobId = readRefineJobId2(event);
|
|
36152
36364
|
const timestamp = metadata.timestamp !== void 0 && metadata.timestamp !== null ? String(metadata.timestamp) : "";
|
|
36153
36365
|
return [
|
|
@@ -36215,15 +36427,15 @@ Next step: ${nextStep}`;
|
|
|
36215
36427
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
36216
36428
|
const entry = entries[i];
|
|
36217
36429
|
if (entry.kind !== "task_completed" && entry.kind !== "task_failed") continue;
|
|
36218
|
-
const payload =
|
|
36430
|
+
const payload = readRecord4(entry.payload);
|
|
36219
36431
|
if (payload?.source !== "refine_mesh_node_async_job") continue;
|
|
36220
|
-
const refineJob =
|
|
36432
|
+
const refineJob = readRecord4(payload.refineJob);
|
|
36221
36433
|
const jobId = readNonEmptyString2(refineJob?.jobId);
|
|
36222
36434
|
if (!jobId || !acceptedJobIds.has(jobId)) continue;
|
|
36223
36435
|
const eventName = entry.kind === "task_completed" ? "refine:completed" : "refine:failed";
|
|
36224
36436
|
if (existingTerminalJobIds.has(`${eventName}:${jobId}`)) continue;
|
|
36225
36437
|
existingTerminalJobIds.add(`${eventName}:${jobId}`);
|
|
36226
|
-
const result =
|
|
36438
|
+
const result = readRecord4(payload.result);
|
|
36227
36439
|
const metadataEvent = {
|
|
36228
36440
|
source: "refine_mesh_node_async_job",
|
|
36229
36441
|
jobId,
|
|
@@ -36835,7 +37047,7 @@ Next step: ${nextStep}`;
|
|
|
36835
37047
|
const providerType = readNonEmptyString2(args.metadataEvent.providerType);
|
|
36836
37048
|
const providerSessionId = readNonEmptyString2(args.metadataEvent.providerSessionId);
|
|
36837
37049
|
const workerResult = readWorkerResultMetadata(args.metadataEvent);
|
|
36838
|
-
const completionDiagnostic =
|
|
37050
|
+
const completionDiagnostic = readRecord4(args.metadataEvent.completionDiagnostic);
|
|
36839
37051
|
const finalSummary = readNonEmptyString2(args.metadataEvent.finalSummary);
|
|
36840
37052
|
const status = readNonEmptyString2(args.metadataEvent.status).toLowerCase();
|
|
36841
37053
|
const explicitCompletionEvidence = Boolean(
|
|
@@ -37554,7 +37766,7 @@ Next step: ${nextStep}`;
|
|
|
37554
37766
|
return { reason: `provider_priority_unusable: ${failed.join("; ") || nodeId}` };
|
|
37555
37767
|
}
|
|
37556
37768
|
function readMeshNodeId(node) {
|
|
37557
|
-
return
|
|
37769
|
+
return normalizeMeshNodeId(node) ?? "";
|
|
37558
37770
|
}
|
|
37559
37771
|
async function maybeAutoLaunchOneQueueSession(components, meshId, mesh) {
|
|
37560
37772
|
const queue = getQueue(meshId);
|
|
@@ -37783,7 +37995,7 @@ Next step: ${nextStep}`;
|
|
|
37783
37995
|
}
|
|
37784
37996
|
async function maybeAutoFastForwardIdleNode(components, args) {
|
|
37785
37997
|
const mesh = getMeshWithCache(components, args.meshId);
|
|
37786
|
-
const node = mesh?.nodes?.find((candidate) => candidate
|
|
37998
|
+
const node = mesh?.nodes?.find((candidate) => meshNodeIdMatches(candidate, args.nodeId));
|
|
37787
37999
|
const workspace = readNonEmptyString2(node?.workspace);
|
|
37788
38000
|
if (!workspace) return;
|
|
37789
38001
|
if (!(0, import_fs10.existsSync)(workspace)) return;
|
|
@@ -38385,6 +38597,7 @@ Next step: ${nextStep}`;
|
|
|
38385
38597
|
init_mesh_events_pending();
|
|
38386
38598
|
init_mesh_routing();
|
|
38387
38599
|
init_repo_mesh_types();
|
|
38600
|
+
init_dist();
|
|
38388
38601
|
init_mesh_events_stale();
|
|
38389
38602
|
init_mesh_events_utils();
|
|
38390
38603
|
REMOTE_IDLE_SESSION_TTL_MS = 5 * 60 * 1e3;
|
|
@@ -47252,9 +47465,10 @@ ${lastSnapshot}`;
|
|
|
47252
47465
|
};
|
|
47253
47466
|
}
|
|
47254
47467
|
init_mesh_work_queue();
|
|
47468
|
+
init_dist();
|
|
47255
47469
|
var DIRECT_DISPATCH_VIA = /* @__PURE__ */ new Set(["p2p_direct", "local_direct", "mesh_send_task"]);
|
|
47256
47470
|
var TERMINAL_LEDGER_KINDS = /* @__PURE__ */ new Set(["task_completed", "task_failed", "task_stalled"]);
|
|
47257
|
-
function
|
|
47471
|
+
function readString6(value) {
|
|
47258
47472
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
47259
47473
|
}
|
|
47260
47474
|
function summarizeMessage(message) {
|
|
@@ -47269,7 +47483,7 @@ ${lastSnapshot}`;
|
|
|
47269
47483
|
function sessionStatusFromNodes(nodes, nodeId, sessionId) {
|
|
47270
47484
|
if (!Array.isArray(nodes)) return {};
|
|
47271
47485
|
if (!nodeId) return { staleReason: "direct task has no node id" };
|
|
47272
|
-
const node = nodes.find((item) =>
|
|
47486
|
+
const node = nodes.find((item) => meshNodeIdMatches(item, nodeId));
|
|
47273
47487
|
if (!node) return { staleReason: "direct task node is no longer in the live mesh" };
|
|
47274
47488
|
if (!sessionId) return {};
|
|
47275
47489
|
const candidates = [];
|
|
@@ -47293,12 +47507,12 @@ ${lastSnapshot}`;
|
|
|
47293
47507
|
}
|
|
47294
47508
|
const session = candidates.find((item) => {
|
|
47295
47509
|
if (typeof item === "string") return item === sessionId;
|
|
47296
|
-
const id =
|
|
47510
|
+
const id = readString6(item?.id) || readString6(item?.sessionId) || readString6(item?.session_id) || readString6(item?.runtimeSessionId) || readString6(item?.instanceId);
|
|
47297
47511
|
return id === sessionId;
|
|
47298
47512
|
});
|
|
47299
47513
|
if (!session) return { staleReason: "direct task session is not present in live session records" };
|
|
47300
47514
|
if (typeof session === "string") return {};
|
|
47301
|
-
const raw = `${
|
|
47515
|
+
const raw = `${readString6(session.status) || ""} ${readString6(session.lifecycle) || ""} ${readString6(session.state) || ""} ${readString6(session.activeChat?.status) || ""}`.toLowerCase();
|
|
47302
47516
|
if (raw.includes("approval")) return { status: "awaiting_approval" };
|
|
47303
47517
|
if (raw.includes("generating") || raw.includes("running") || raw.includes("busy")) return { status: "generating" };
|
|
47304
47518
|
if (raw.includes("failed") || raw.includes("stopped") || raw.includes("terminated") || raw.includes("exited")) return { status: "failed" };
|
|
@@ -47309,14 +47523,14 @@ ${lastSnapshot}`;
|
|
|
47309
47523
|
if (entry.kind !== "task_dispatched") return false;
|
|
47310
47524
|
const payload = entry.payload || {};
|
|
47311
47525
|
if (payload.source === "direct") return true;
|
|
47312
|
-
const via =
|
|
47526
|
+
const via = readString6(payload.via);
|
|
47313
47527
|
return Boolean(via && DIRECT_DISPATCH_VIA.has(via) && payload.source !== "queue");
|
|
47314
47528
|
}
|
|
47315
47529
|
function directDispatchTaskId(entry) {
|
|
47316
|
-
return
|
|
47530
|
+
return readString6(entry.payload?.taskId) || entry.id;
|
|
47317
47531
|
}
|
|
47318
47532
|
function terminalMatchesDispatch(terminal, dispatch, taskId) {
|
|
47319
|
-
const terminalTaskId =
|
|
47533
|
+
const terminalTaskId = readString6(terminal.payload?.taskId);
|
|
47320
47534
|
if (terminalTaskId && terminalTaskId === taskId) return true;
|
|
47321
47535
|
if (terminalTaskId && terminalTaskId !== taskId) return false;
|
|
47322
47536
|
if (dispatch.sessionId && terminal.sessionId === dispatch.sessionId) return true;
|
|
@@ -47439,7 +47653,7 @@ ${lastSnapshot}`;
|
|
|
47439
47653
|
const isNoTransition = !terminalStatus && !live.status;
|
|
47440
47654
|
const isIdleUnacknowledged = status === "idle";
|
|
47441
47655
|
const ledgerOnlyStaleReason = !terminalRow && (isIdleUnacknowledged || isNoTransition || dispatchedToIdleSession && isIdleUnacknowledged) ? "direct task dispatch has no provider acknowledgement, transcript append, or active runtime transition" : void 0;
|
|
47442
|
-
const message =
|
|
47656
|
+
const message = readString6(dispatch.payload?.message) || readString6(dispatch.payload?.summary) || "";
|
|
47443
47657
|
const { title, summary: summary2 } = summarizeMessage(message);
|
|
47444
47658
|
const isFreshUnacknowledged = Boolean(ledgerOnlyStaleReason && !live.staleReason);
|
|
47445
47659
|
const record2 = {
|
|
@@ -47448,11 +47662,11 @@ ${lastSnapshot}`;
|
|
|
47448
47662
|
status,
|
|
47449
47663
|
nodeId: dispatch.nodeId,
|
|
47450
47664
|
sessionId: dispatch.sessionId,
|
|
47451
|
-
providerType: dispatch.providerType ||
|
|
47452
|
-
taskTitle:
|
|
47453
|
-
taskSummary:
|
|
47665
|
+
providerType: dispatch.providerType || readString6(dispatch.payload?.providerType),
|
|
47666
|
+
taskTitle: readString6(dispatch.payload?.taskTitle) || title,
|
|
47667
|
+
taskSummary: readString6(dispatch.payload?.taskSummary) || summary2,
|
|
47454
47668
|
message,
|
|
47455
|
-
taskMode:
|
|
47669
|
+
taskMode: readString6(dispatch.payload?.taskMode),
|
|
47456
47670
|
createdAt: dispatch.timestamp,
|
|
47457
47671
|
updatedAt: terminal?.timestamp || dispatch.timestamp,
|
|
47458
47672
|
dispatchedAt: dispatch.timestamp,
|
|
@@ -47487,7 +47701,7 @@ ${lastSnapshot}`;
|
|
|
47487
47701
|
const isNoTransition = !terminalStatus && !live.status;
|
|
47488
47702
|
const isIdleUnacknowledged = status === "idle";
|
|
47489
47703
|
const ledgerOnlyStaleReason = !terminalRow && (isIdleUnacknowledged || isNoTransition || dispatchedToIdleSession && isIdleUnacknowledged) ? "direct task dispatch has no provider acknowledgement, transcript append, or active runtime transition" : void 0;
|
|
47490
|
-
const message =
|
|
47704
|
+
const message = readString6(dispatch.payload?.message) || readString6(dispatch.payload?.summary) || "";
|
|
47491
47705
|
const { title, summary: summary2 } = summarizeMessage(message);
|
|
47492
47706
|
const isFreshUnacknowledged = Boolean(ledgerOnlyStaleReason && !live.staleReason);
|
|
47493
47707
|
const record2 = {
|
|
@@ -47496,11 +47710,11 @@ ${lastSnapshot}`;
|
|
|
47496
47710
|
status,
|
|
47497
47711
|
nodeId: dispatch.nodeId,
|
|
47498
47712
|
sessionId: dispatch.sessionId,
|
|
47499
|
-
providerType: dispatch.providerType ||
|
|
47500
|
-
taskTitle:
|
|
47501
|
-
taskSummary:
|
|
47713
|
+
providerType: dispatch.providerType || readString6(dispatch.payload?.providerType),
|
|
47714
|
+
taskTitle: readString6(dispatch.payload?.taskTitle) || title,
|
|
47715
|
+
taskSummary: readString6(dispatch.payload?.taskSummary) || summary2,
|
|
47502
47716
|
message,
|
|
47503
|
-
taskMode:
|
|
47717
|
+
taskMode: readString6(dispatch.payload?.taskMode),
|
|
47504
47718
|
createdAt: dispatch.timestamp,
|
|
47505
47719
|
updatedAt: terminal?.timestamp || dispatch.timestamp,
|
|
47506
47720
|
dispatchedAt: dispatch.timestamp,
|
|
@@ -69237,203 +69451,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69237
69451
|
init_config();
|
|
69238
69452
|
init_cli_detector();
|
|
69239
69453
|
init_git_status();
|
|
69240
|
-
|
|
69241
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
69242
|
-
}
|
|
69243
|
-
function readString6(...values) {
|
|
69244
|
-
for (const value of values) {
|
|
69245
|
-
if (typeof value !== "string") continue;
|
|
69246
|
-
const trimmed = value.trim();
|
|
69247
|
-
if (trimmed) return trimmed;
|
|
69248
|
-
}
|
|
69249
|
-
return void 0;
|
|
69250
|
-
}
|
|
69251
|
-
function readNumber(...values) {
|
|
69252
|
-
for (const value of values) {
|
|
69253
|
-
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
69254
|
-
}
|
|
69255
|
-
return void 0;
|
|
69256
|
-
}
|
|
69257
|
-
function readBoolean(...values) {
|
|
69258
|
-
for (const value of values) {
|
|
69259
|
-
if (typeof value === "boolean") return value;
|
|
69260
|
-
}
|
|
69261
|
-
return void 0;
|
|
69262
|
-
}
|
|
69263
|
-
function joinRepoPath(root, relativePath) {
|
|
69264
|
-
const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
|
|
69265
|
-
const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
|
|
69266
|
-
if (!normalizedPath) return void 0;
|
|
69267
|
-
if (/^(?:[A-Za-z]:[\\/]|\/)/.test(normalizedPath)) return normalizedPath;
|
|
69268
|
-
if (!normalizedRoot) return void 0;
|
|
69269
|
-
return `${normalizedRoot}/${normalizedPath.replace(/^[\\/]+/, "")}`;
|
|
69270
|
-
}
|
|
69271
|
-
function scoreGitUpstreamFreshness(status) {
|
|
69272
|
-
switch (status) {
|
|
69273
|
-
case "fresh":
|
|
69274
|
-
return 30;
|
|
69275
|
-
case "no_upstream":
|
|
69276
|
-
return 4;
|
|
69277
|
-
case "unchecked":
|
|
69278
|
-
case void 0:
|
|
69279
|
-
return 0;
|
|
69280
|
-
case "stale":
|
|
69281
|
-
return -10;
|
|
69282
|
-
case "unavailable":
|
|
69283
|
-
return -15;
|
|
69284
|
-
default:
|
|
69285
|
-
return 0;
|
|
69286
|
-
}
|
|
69287
|
-
}
|
|
69288
|
-
function readGitSubmodules(value, parentRepoRoot) {
|
|
69289
|
-
if (!Array.isArray(value)) return void 0;
|
|
69290
|
-
const submodules = value.map((entry) => {
|
|
69291
|
-
const submodule = readRecord5(entry);
|
|
69292
|
-
const path40 = readString6(submodule.path);
|
|
69293
|
-
const commit = readString6(submodule.commit);
|
|
69294
|
-
const repoPath = readString6(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path40);
|
|
69295
|
-
if (!path40 || !commit) return null;
|
|
69296
|
-
const result = {
|
|
69297
|
-
path: path40,
|
|
69298
|
-
commit,
|
|
69299
|
-
dirty: readBoolean(submodule.dirty) ?? false,
|
|
69300
|
-
outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
|
|
69301
|
-
lastCheckedAt: readNumber(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now()
|
|
69302
|
-
};
|
|
69303
|
-
if (repoPath) result.repoPath = repoPath;
|
|
69304
|
-
const error48 = readString6(submodule.error);
|
|
69305
|
-
if (error48) result.error = error48;
|
|
69306
|
-
return result;
|
|
69307
|
-
}).filter((entry) => entry !== null);
|
|
69308
|
-
return submodules.length > 0 ? submodules : void 0;
|
|
69309
|
-
}
|
|
69310
|
-
function hasGitStatusEvidence(status) {
|
|
69311
|
-
return readBoolean(status.isGitRepo) !== void 0 || Boolean(readString6(status.branch, status.upstream, status.upstreamStatus, status.upstream_status, status.headCommit)) || Boolean(readString6(status.repoRoot, status.repo_root, status.workspace)) || readNumber(
|
|
69312
|
-
status.ahead,
|
|
69313
|
-
status.behind,
|
|
69314
|
-
status.staged,
|
|
69315
|
-
status.modified,
|
|
69316
|
-
status.untracked,
|
|
69317
|
-
status.deleted,
|
|
69318
|
-
status.renamed,
|
|
69319
|
-
status.lastCheckedAt,
|
|
69320
|
-
status.last_checked_at
|
|
69321
|
-
) !== void 0 || Array.isArray(status.submodules) && status.submodules.length > 0;
|
|
69322
|
-
}
|
|
69323
|
-
function normalizeGitStatus(status, node, options) {
|
|
69324
|
-
const explicitIsGitRepo = readBoolean(status.isGitRepo);
|
|
69325
|
-
if (!Object.keys(status).length || !hasGitStatusEvidence(status)) return void 0;
|
|
69326
|
-
const isGitRepo = explicitIsGitRepo ?? true;
|
|
69327
|
-
const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((entry) => typeof entry === "string") : [];
|
|
69328
|
-
const conflictCount = readNumber(status.conflicts) ?? conflictFiles.length;
|
|
69329
|
-
const hasConflicts = readBoolean(status.hasConflicts) ?? conflictCount > 0;
|
|
69330
|
-
const repoRoot = readString6(status.repoRoot, status.repo_root, node.repoRoot, node.repo_root, status.workspace, node.workspace) || void 0;
|
|
69331
|
-
const submodules = readGitSubmodules(status.submodules, repoRoot);
|
|
69332
|
-
const upstreamStatus = readString6(status.upstreamStatus, status.upstream_status);
|
|
69333
|
-
const upstreamFetchedAt = readNumber(status.upstreamFetchedAt, status.upstream_fetched_at);
|
|
69334
|
-
const upstreamFetchError = readString6(status.upstreamFetchError, status.upstream_fetch_error);
|
|
69335
|
-
const error48 = readString6(status.error);
|
|
69336
|
-
const staged = readNumber(status.staged) ?? 0;
|
|
69337
|
-
const modified = readNumber(status.modified) ?? 0;
|
|
69338
|
-
const untracked = readNumber(status.untracked) ?? 0;
|
|
69339
|
-
const deleted = readNumber(status.deleted) ?? 0;
|
|
69340
|
-
const renamed = readNumber(status.renamed) ?? 0;
|
|
69341
|
-
return {
|
|
69342
|
-
workspace: readString6(status.workspace, node.workspace) || "",
|
|
69343
|
-
repoRoot: repoRoot ?? null,
|
|
69344
|
-
isGitRepo,
|
|
69345
|
-
branch: readString6(status.branch) ?? null,
|
|
69346
|
-
headCommit: readString6(status.headCommit) ?? null,
|
|
69347
|
-
headMessage: readString6(status.headMessage) ?? null,
|
|
69348
|
-
upstream: readString6(status.upstream) ?? null,
|
|
69349
|
-
upstreamStatus: upstreamStatus ?? "unchecked",
|
|
69350
|
-
...upstreamFetchedAt !== void 0 ? { upstreamFetchedAt } : {},
|
|
69351
|
-
...upstreamFetchError ? { upstreamFetchError } : {},
|
|
69352
|
-
ahead: readNumber(status.ahead) ?? 0,
|
|
69353
|
-
behind: readNumber(status.behind) ?? 0,
|
|
69354
|
-
staged,
|
|
69355
|
-
modified,
|
|
69356
|
-
untracked,
|
|
69357
|
-
deleted,
|
|
69358
|
-
renamed,
|
|
69359
|
-
dirty: readBoolean(status.dirty, status.isDirty, status.is_dirty) ?? (staged + modified + untracked + deleted + renamed > 0 || hasConflicts),
|
|
69360
|
-
hasConflicts,
|
|
69361
|
-
conflictFiles,
|
|
69362
|
-
stashCount: readNumber(status.stashCount, status.stash_count) ?? 0,
|
|
69363
|
-
lastCheckedAt: options?.lastCheckedAt ?? readNumber(status.lastCheckedAt, status.last_checked_at) ?? Date.now(),
|
|
69364
|
-
...submodules ? { submodules } : {},
|
|
69365
|
-
...error48 ? { error: error48 } : {}
|
|
69366
|
-
};
|
|
69367
|
-
}
|
|
69368
|
-
function scoreGitStatusCandidate(git) {
|
|
69369
|
-
if (!git) return Number.NEGATIVE_INFINITY;
|
|
69370
|
-
let score = 0;
|
|
69371
|
-
if (git.isGitRepo === true) score += 50;
|
|
69372
|
-
if (git.isGitRepo === false) score -= 10;
|
|
69373
|
-
if (git.branch) score += 20;
|
|
69374
|
-
if (git.headCommit) score += 20;
|
|
69375
|
-
if (git.upstream) score += 10;
|
|
69376
|
-
score += scoreGitUpstreamFreshness(git.upstreamStatus);
|
|
69377
|
-
if (typeof git.ahead === "number") score += 2;
|
|
69378
|
-
if (typeof git.behind === "number") score += 2;
|
|
69379
|
-
if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
|
|
69380
|
-
if (git.error) score -= 20;
|
|
69381
|
-
return score;
|
|
69382
|
-
}
|
|
69383
|
-
function pickBestTransitGitStatus(node, options) {
|
|
69384
|
-
const rawGit = readRecord5(node.lastGit ?? node.last_git);
|
|
69385
|
-
const gitResult = readRecord5(rawGit.result);
|
|
69386
|
-
const directStatus = readRecord5(rawGit.status);
|
|
69387
|
-
const nestedStatus = readRecord5(gitResult.status);
|
|
69388
|
-
const rawProbe = readRecord5(node.lastProbe ?? node.last_probe);
|
|
69389
|
-
const probeGit = readRecord5(rawProbe.git);
|
|
69390
|
-
const probeGitResult = readRecord5(probeGit.result);
|
|
69391
|
-
const probeDirectStatus = readRecord5(probeGit.status);
|
|
69392
|
-
const probeNestedStatus = readRecord5(probeGitResult.status);
|
|
69393
|
-
const lastCheckedAt = options?.lastCheckedAt;
|
|
69394
|
-
let best = null;
|
|
69395
|
-
for (const status of [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus]) {
|
|
69396
|
-
const normalized = normalizeGitStatus(status, node, { lastCheckedAt: lastCheckedAt ?? Date.now() });
|
|
69397
|
-
if (!normalized) continue;
|
|
69398
|
-
const score = scoreGitStatusCandidate(normalized);
|
|
69399
|
-
if (!best || score > best.score) best = { git: normalized, score };
|
|
69400
|
-
}
|
|
69401
|
-
return best?.git;
|
|
69402
|
-
}
|
|
69403
|
-
function summarizeGitShape(status) {
|
|
69404
|
-
const record2 = readRecord5(status);
|
|
69405
|
-
if (!Object.keys(record2).length) return null;
|
|
69406
|
-
const submodules = Array.isArray(record2.submodules) ? record2.submodules.map((entry) => {
|
|
69407
|
-
const sub = readRecord5(entry);
|
|
69408
|
-
return {
|
|
69409
|
-
path: readString6(sub.path) ?? null,
|
|
69410
|
-
commit: readString6(sub.commit)?.slice(0, 12) ?? null,
|
|
69411
|
-
dirty: readBoolean(sub.dirty) ?? false,
|
|
69412
|
-
outOfSync: readBoolean(sub.outOfSync, sub.out_of_sync) ?? false
|
|
69413
|
-
};
|
|
69414
|
-
}) : [];
|
|
69415
|
-
return {
|
|
69416
|
-
isGitRepo: readBoolean(record2.isGitRepo),
|
|
69417
|
-
workspace: readString6(record2.workspace) ?? null,
|
|
69418
|
-
repoRoot: readString6(record2.repoRoot, record2.repo_root) ?? null,
|
|
69419
|
-
branch: readString6(record2.branch) ?? null,
|
|
69420
|
-
upstream: readString6(record2.upstream) ?? null,
|
|
69421
|
-
upstreamStatus: readString6(record2.upstreamStatus, record2.upstream_status) ?? null,
|
|
69422
|
-
headCommit: readString6(record2.headCommit, record2.head_commit)?.slice(0, 12) ?? null,
|
|
69423
|
-
ahead: readNumber(record2.ahead) ?? null,
|
|
69424
|
-
behind: readNumber(record2.behind) ?? null,
|
|
69425
|
-
dirtyCounts: {
|
|
69426
|
-
staged: readNumber(record2.staged) ?? 0,
|
|
69427
|
-
modified: readNumber(record2.modified) ?? 0,
|
|
69428
|
-
untracked: readNumber(record2.untracked) ?? 0,
|
|
69429
|
-
deleted: readNumber(record2.deleted) ?? 0,
|
|
69430
|
-
renamed: readNumber(record2.renamed) ?? 0
|
|
69431
|
-
},
|
|
69432
|
-
lastCheckedAt: readNumber(record2.lastCheckedAt, record2.last_checked_at) ?? null,
|
|
69433
|
-
submoduleCount: submodules.length,
|
|
69434
|
-
submodules
|
|
69435
|
-
};
|
|
69436
|
-
}
|
|
69454
|
+
init_dist();
|
|
69437
69455
|
init_logger();
|
|
69438
69456
|
var fs222 = __toESM2(require("fs"));
|
|
69439
69457
|
var path33 = __toESM2(require("path"));
|
|
@@ -70495,7 +70513,10 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70495
70513
|
branchConvergenceSummary: status?.branchConvergenceSummary ?? status?.branch_convergence_summary ?? null,
|
|
70496
70514
|
nodeCount: nodes.length,
|
|
70497
70515
|
nodes: nodes.map((node) => ({
|
|
70498
|
-
nodeId
|
|
70516
|
+
// Status emits the id under `nodeId` (3-way input absorbed). The
|
|
70517
|
+
// inline cache keeps `id` and `nodeId` equal, so this serialized form
|
|
70518
|
+
// round-trips back through the cache without flipping shape.
|
|
70519
|
+
nodeId: normalizeMeshNodeId(node) ?? null,
|
|
70499
70520
|
daemonId: readStringValue(node?.daemonId, node?.daemon_id) ?? null,
|
|
70500
70521
|
workspace: readStringValue(node?.workspace, node?.git?.workspace) ?? null,
|
|
70501
70522
|
health: readStringValue(node?.health) ?? null,
|
|
@@ -70740,7 +70761,23 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70740
70761
|
return inlineMesh.nodes.some((node) => hasInlineMeshTransientNodeState(node));
|
|
70741
70762
|
}
|
|
70742
70763
|
function readInlineMeshNodeId(node) {
|
|
70743
|
-
return
|
|
70764
|
+
return normalizeMeshNodeId(node) ?? "";
|
|
70765
|
+
}
|
|
70766
|
+
function foldMeshNodeIdentityToCanonical(node) {
|
|
70767
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return node;
|
|
70768
|
+
const canonical = normalizeMeshNodeId(node);
|
|
70769
|
+
if (canonical === void 0) return node;
|
|
70770
|
+
if (node.id === canonical && node.nodeId === canonical && node.node_id === void 0) return node;
|
|
70771
|
+
node.id = canonical;
|
|
70772
|
+
node.nodeId = canonical;
|
|
70773
|
+
if ("node_id" in node) delete node.node_id;
|
|
70774
|
+
return node;
|
|
70775
|
+
}
|
|
70776
|
+
function normalizeInlineMeshNodeIdentity(inlineMesh) {
|
|
70777
|
+
if (!inlineMesh || typeof inlineMesh !== "object" || Array.isArray(inlineMesh)) return inlineMesh;
|
|
70778
|
+
if (!Array.isArray(inlineMesh.nodes) || inlineMesh.nodes.length === 0) return inlineMesh;
|
|
70779
|
+
for (const node of inlineMesh.nodes) foldMeshNodeIdentityToCanonical(node);
|
|
70780
|
+
return inlineMesh;
|
|
70744
70781
|
}
|
|
70745
70782
|
function sanitizeInlineMesh(inlineMesh) {
|
|
70746
70783
|
if (!inlineMesh || typeof inlineMesh !== "object" || Array.isArray(inlineMesh)) return inlineMesh;
|
|
@@ -70842,7 +70879,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70842
70879
|
return "online";
|
|
70843
70880
|
}
|
|
70844
70881
|
function readMeshNodeLabel(status, node) {
|
|
70845
|
-
return readStringValue(status.nodeId, node
|
|
70882
|
+
return readStringValue(status.nodeId, normalizeMeshNodeId(node)) ?? "unknown";
|
|
70846
70883
|
}
|
|
70847
70884
|
function buildInlineMeshBranchConvergence(args) {
|
|
70848
70885
|
const git = readObjectRecord(args.status.git);
|
|
@@ -71121,7 +71158,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71121
71158
|
let peerConfirmedCount = 0;
|
|
71122
71159
|
const unavailableNodeIds = [];
|
|
71123
71160
|
for (const [nodeIndex, node] of nodes.entries()) {
|
|
71124
|
-
const nodeId =
|
|
71161
|
+
const nodeId = normalizeMeshNodeId(node) || `node_${nodeIndex}`;
|
|
71125
71162
|
const workspace = readStringValue(node?.workspace);
|
|
71126
71163
|
const daemonId = readStringValue(node?.daemonId);
|
|
71127
71164
|
const isSelfNode = Boolean(
|
|
@@ -71252,7 +71289,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71252
71289
|
const liveWorkspaces = /* @__PURE__ */ new Set();
|
|
71253
71290
|
const missingLocalWorktreeNodeIds = /* @__PURE__ */ new Set();
|
|
71254
71291
|
for (const node of args.nodes || []) {
|
|
71255
|
-
const nodeId =
|
|
71292
|
+
const nodeId = normalizeMeshNodeId(node);
|
|
71256
71293
|
const workspace = readStringValue(node?.workspace);
|
|
71257
71294
|
if (nodeId) liveNodeIds.add(nodeId);
|
|
71258
71295
|
if (workspace) liveWorkspaces.add(workspace);
|
|
@@ -71377,9 +71414,13 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71377
71414
|
}
|
|
71378
71415
|
return { enabled: false };
|
|
71379
71416
|
}
|
|
71380
|
-
async function computeGitPatchId(cwd, fromRef, toRef) {
|
|
71417
|
+
async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
|
|
71381
71418
|
const { execFileSync: execFileSync6 } = await import("child_process");
|
|
71382
|
-
const
|
|
71419
|
+
const diffArgs = ["diff", "--patch", "--full-index", fromRef, toRef];
|
|
71420
|
+
if (excludePaths.length > 0) {
|
|
71421
|
+
diffArgs.push("--", ".", ...excludePaths.map((path40) => `:(exclude)${path40}`));
|
|
71422
|
+
}
|
|
71423
|
+
const diff = execFileSync6("git", diffArgs, {
|
|
71383
71424
|
cwd,
|
|
71384
71425
|
encoding: "utf8",
|
|
71385
71426
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -71448,8 +71489,9 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
71448
71489
|
gitlinkTrivialFastForward
|
|
71449
71490
|
};
|
|
71450
71491
|
}
|
|
71451
|
-
const
|
|
71452
|
-
const
|
|
71492
|
+
const ffGitlinkExcludePaths = collectFastForwardGitlinkPaths(repoRoot, baseHead, branchHead);
|
|
71493
|
+
const expectedPatchId = await computeGitPatchId(repoRoot, mergeBase, branchHead, ffGitlinkExcludePaths);
|
|
71494
|
+
const actualPatchId = await computeGitPatchId(repoRoot, baseHead, mergedTree, ffGitlinkExcludePaths);
|
|
71453
71495
|
const equivalent = expectedPatchId === actualPatchId;
|
|
71454
71496
|
return {
|
|
71455
71497
|
status: equivalent ? "passed" : "failed",
|
|
@@ -71645,6 +71687,14 @@ ${e?.stderr || ""}`
|
|
|
71645
71687
|
return [];
|
|
71646
71688
|
}
|
|
71647
71689
|
}
|
|
71690
|
+
function collectFastForwardGitlinkPaths(repoRoot, baseHead, branchHead) {
|
|
71691
|
+
return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((path40) => {
|
|
71692
|
+
const baseCommit = readTreeObject(repoRoot, baseHead, path40);
|
|
71693
|
+
const branchCommit = readTreeObject(repoRoot, branchHead, path40);
|
|
71694
|
+
if (!baseCommit || !branchCommit) return false;
|
|
71695
|
+
return isSubmoduleFastForward((0, import_path10.resolve)(repoRoot, path40), baseCommit, branchCommit);
|
|
71696
|
+
});
|
|
71697
|
+
}
|
|
71648
71698
|
function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
|
|
71649
71699
|
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path40) => {
|
|
71650
71700
|
const baseCommit = readTreeObject(repoRoot, baseHead, path40);
|
|
@@ -71694,20 +71744,95 @@ ${e?.stderr || ""}`
|
|
|
71694
71744
|
}
|
|
71695
71745
|
return { trivial: true, gitlinks: changedGitlinks };
|
|
71696
71746
|
}
|
|
71747
|
+
function buildTreeWithGitlinksEqualized(repoRoot, commitish, paths, placeholderCommit) {
|
|
71748
|
+
try {
|
|
71749
|
+
const tree = (0, import_node_child_process6.execFileSync)("git", ["rev-parse", `${commitish}^{tree}`], {
|
|
71750
|
+
cwd: repoRoot,
|
|
71751
|
+
encoding: "utf8",
|
|
71752
|
+
maxBuffer: 1024 * 1024
|
|
71753
|
+
}).trim();
|
|
71754
|
+
if (!tree) return void 0;
|
|
71755
|
+
const updates = paths.map((path40) => `160000 commit ${placeholderCommit} ${path40}`).join("\n");
|
|
71756
|
+
if (!updates) return tree;
|
|
71757
|
+
const tmpIndex = (0, import_path10.join)(resolveGitDir(repoRoot), `adhdev-refine-eq-${commitish.slice(0, 12)}.index`);
|
|
71758
|
+
const env2 = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
71759
|
+
try {
|
|
71760
|
+
(0, import_node_child_process6.execFileSync)("git", ["read-tree", tree], { cwd: repoRoot, env: env2, stdio: "ignore" });
|
|
71761
|
+
(0, import_node_child_process6.execFileSync)("git", ["update-index", "--index-info"], {
|
|
71762
|
+
cwd: repoRoot,
|
|
71763
|
+
env: env2,
|
|
71764
|
+
input: `${updates}
|
|
71765
|
+
`,
|
|
71766
|
+
encoding: "utf8",
|
|
71767
|
+
stdio: ["pipe", "ignore", "ignore"]
|
|
71768
|
+
});
|
|
71769
|
+
const newTree = (0, import_node_child_process6.execFileSync)("git", ["write-tree"], { cwd: repoRoot, env: env2, encoding: "utf8" }).trim();
|
|
71770
|
+
return newTree || void 0;
|
|
71771
|
+
} finally {
|
|
71772
|
+
try {
|
|
71773
|
+
fs24.rmSync(tmpIndex, { force: true });
|
|
71774
|
+
} catch {
|
|
71775
|
+
}
|
|
71776
|
+
}
|
|
71777
|
+
} catch {
|
|
71778
|
+
return void 0;
|
|
71779
|
+
}
|
|
71780
|
+
}
|
|
71697
71781
|
function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, gitlinks) {
|
|
71698
71782
|
try {
|
|
71699
|
-
const
|
|
71783
|
+
const branchGitlinks = gitlinks.filter((entry) => entry.branchCommit);
|
|
71784
|
+
const gitlinkPaths = branchGitlinks.map((entry) => entry.path);
|
|
71785
|
+
const mergeBase = (0, import_node_child_process6.execFileSync)("git", ["merge-base", baseHead, branchHead], {
|
|
71786
|
+
cwd: repoRoot,
|
|
71787
|
+
encoding: "utf8",
|
|
71788
|
+
maxBuffer: 1024 * 1024
|
|
71789
|
+
}).trim();
|
|
71790
|
+
let mergedContentTree;
|
|
71791
|
+
if (mergeBase && gitlinkPaths.length > 0) {
|
|
71792
|
+
const placeholder = readTreeObject(repoRoot, mergeBase, gitlinkPaths[0]) || branchGitlinks[0].branchCommit;
|
|
71793
|
+
const baseEqTree = buildTreeWithGitlinksEqualized(repoRoot, mergeBase, gitlinkPaths, placeholder);
|
|
71794
|
+
const oursEqTree = buildTreeWithGitlinksEqualized(repoRoot, baseHead, gitlinkPaths, placeholder);
|
|
71795
|
+
const theirsEqTree = buildTreeWithGitlinksEqualized(repoRoot, branchHead, gitlinkPaths, placeholder);
|
|
71796
|
+
if (baseEqTree && oursEqTree && theirsEqTree) {
|
|
71797
|
+
try {
|
|
71798
|
+
const baseEqCommit = (0, import_node_child_process6.execFileSync)("git", ["commit-tree", baseEqTree, "-m", "refine-ff-base"], {
|
|
71799
|
+
cwd: repoRoot,
|
|
71800
|
+
encoding: "utf8",
|
|
71801
|
+
maxBuffer: 1024 * 1024
|
|
71802
|
+
}).trim();
|
|
71803
|
+
const oursEqCommit = (0, import_node_child_process6.execFileSync)("git", ["commit-tree", oursEqTree, "-p", baseEqCommit, "-m", "refine-ff-ours"], {
|
|
71804
|
+
cwd: repoRoot,
|
|
71805
|
+
encoding: "utf8",
|
|
71806
|
+
maxBuffer: 1024 * 1024
|
|
71807
|
+
}).trim();
|
|
71808
|
+
const theirsEqCommit = (0, import_node_child_process6.execFileSync)("git", ["commit-tree", theirsEqTree, "-p", baseEqCommit, "-m", "refine-ff-theirs"], {
|
|
71809
|
+
cwd: repoRoot,
|
|
71810
|
+
encoding: "utf8",
|
|
71811
|
+
maxBuffer: 1024 * 1024
|
|
71812
|
+
}).trim();
|
|
71813
|
+
const mergeOut = (0, import_node_child_process6.execFileSync)("git", ["merge-tree", "--write-tree", oursEqCommit, theirsEqCommit], {
|
|
71814
|
+
cwd: repoRoot,
|
|
71815
|
+
encoding: "utf8",
|
|
71816
|
+
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
71817
|
+
}).trim();
|
|
71818
|
+
mergedContentTree = mergeOut.split(/\s+/)[0] || void 0;
|
|
71819
|
+
} catch {
|
|
71820
|
+
mergedContentTree = void 0;
|
|
71821
|
+
}
|
|
71822
|
+
}
|
|
71823
|
+
}
|
|
71824
|
+
const contentTree = mergedContentTree || (0, import_node_child_process6.execFileSync)("git", ["rev-parse", `${baseHead}^{tree}`], {
|
|
71700
71825
|
cwd: repoRoot,
|
|
71701
71826
|
encoding: "utf8",
|
|
71702
71827
|
maxBuffer: 1024 * 1024
|
|
71703
71828
|
}).trim();
|
|
71704
|
-
if (!
|
|
71705
|
-
const updates =
|
|
71706
|
-
if (!updates) return
|
|
71829
|
+
if (!contentTree) return void 0;
|
|
71830
|
+
const updates = branchGitlinks.map((entry) => `160000 commit ${entry.branchCommit} ${entry.path}`).join("\n");
|
|
71831
|
+
if (!updates) return contentTree;
|
|
71707
71832
|
const tmpIndex = (0, import_path10.join)(resolveGitDir(repoRoot), `adhdev-refine-ff-${baseHead.slice(0, 12)}-${branchHead.slice(0, 12)}.index`);
|
|
71708
71833
|
const env2 = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
71709
71834
|
try {
|
|
71710
|
-
(0, import_node_child_process6.execFileSync)("git", ["read-tree",
|
|
71835
|
+
(0, import_node_child_process6.execFileSync)("git", ["read-tree", contentTree], { cwd: repoRoot, env: env2, stdio: "ignore" });
|
|
71711
71836
|
(0, import_node_child_process6.execFileSync)("git", ["update-index", "--index-info"], {
|
|
71712
71837
|
cwd: repoRoot,
|
|
71713
71838
|
env: env2,
|
|
@@ -72367,7 +72492,7 @@ ${e?.stderr || ""}`
|
|
|
72367
72492
|
function buildMemberJoinNode(mesh, args, fallbackDaemonId) {
|
|
72368
72493
|
const requestedNodeId = typeof args?.memberNodeId === "string" ? args.memberNodeId.trim() : "";
|
|
72369
72494
|
const explicit = args?.memberNode && typeof args.memberNode === "object" && !Array.isArray(args.memberNode) ? args.memberNode : null;
|
|
72370
|
-
const configured = Array.isArray(mesh?.nodes) ? requestedNodeId ? mesh.nodes.find((node) => node
|
|
72495
|
+
const configured = Array.isArray(mesh?.nodes) ? requestedNodeId ? mesh.nodes.find((node) => meshNodeIdMatches(node, requestedNodeId)) : mesh.nodes[0] : null;
|
|
72371
72496
|
const source = explicit || configured;
|
|
72372
72497
|
const workspace = typeof source?.workspace === "string" && source.workspace.trim() ? source.workspace.trim() : typeof args?.workspace === "string" && args.workspace.trim() ? args.workspace.trim() : process.cwd();
|
|
72373
72498
|
if (!workspace) return null;
|
|
@@ -72423,7 +72548,7 @@ ${e?.stderr || ""}`
|
|
|
72423
72548
|
if (nodeId) unavailableNodeIds.add(nodeId);
|
|
72424
72549
|
}
|
|
72425
72550
|
const nodes = snapshot.nodes.map((statusNode) => {
|
|
72426
|
-
const nodeId =
|
|
72551
|
+
const nodeId = normalizeMeshNodeId(statusNode);
|
|
72427
72552
|
const inlineNode = nodeId ? inlineNodesById.get(nodeId) : void 0;
|
|
72428
72553
|
if (!inlineNode) return statusNode;
|
|
72429
72554
|
const liveGit = buildInlineMeshTransitGitStatus(inlineNode);
|
|
@@ -72536,7 +72661,7 @@ ${e?.stderr || ""}`
|
|
|
72536
72661
|
}
|
|
72537
72662
|
warmInlineMeshCache(meshId, inlineMesh) {
|
|
72538
72663
|
if (!inlineMesh || typeof inlineMesh !== "object") return void 0;
|
|
72539
|
-
const sanitizedInlineMesh = sanitizeInlineMesh(inlineMesh);
|
|
72664
|
+
const sanitizedInlineMesh = sanitizeInlineMesh(normalizeInlineMeshNodeIdentity(inlineMesh));
|
|
72540
72665
|
const cached22 = this.inlineMeshCache.get(meshId);
|
|
72541
72666
|
if (cached22) {
|
|
72542
72667
|
const merged = reconcileInlineMeshCache(cached22, sanitizedInlineMesh);
|
|
@@ -72553,7 +72678,7 @@ ${e?.stderr || ""}`
|
|
|
72553
72678
|
if (cached3) {
|
|
72554
72679
|
if (inlineMeshCarriesTransientNodeTruth(inlineMesh)) {
|
|
72555
72680
|
const merged = reconcileInlineMeshCache(cached3, inlineMesh);
|
|
72556
|
-
this.inlineMeshCache.set(meshId, sanitizeInlineMesh(merged));
|
|
72681
|
+
this.inlineMeshCache.set(meshId, sanitizeInlineMesh(normalizeInlineMeshNodeIdentity(merged)));
|
|
72557
72682
|
return { mesh: merged, inline: true, source: "inline_cache" };
|
|
72558
72683
|
}
|
|
72559
72684
|
return { mesh: cached3, inline: true, source: "inline_cache" };
|
|
@@ -72589,17 +72714,19 @@ ${e?.stderr || ""}`
|
|
|
72589
72714
|
return null;
|
|
72590
72715
|
}
|
|
72591
72716
|
updateInlineMeshNode(meshId, mesh, node) {
|
|
72592
|
-
|
|
72593
|
-
|
|
72717
|
+
const incomingId = normalizeMeshNodeId(node);
|
|
72718
|
+
if (!mesh || !Array.isArray(mesh.nodes) || !incomingId) return;
|
|
72719
|
+
const idx = mesh.nodes.findIndex((entry) => meshNodeIdMatches(entry, incomingId));
|
|
72594
72720
|
if (idx >= 0) mesh.nodes[idx] = node;
|
|
72595
72721
|
else mesh.nodes.push(node);
|
|
72596
72722
|
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
72723
|
+
for (const entry of mesh.nodes) foldMeshNodeIdentityToCanonical(entry);
|
|
72597
72724
|
this.inlineMeshCache.set(meshId, mesh);
|
|
72598
72725
|
this.invalidateAggregateMeshStatus(meshId);
|
|
72599
72726
|
}
|
|
72600
72727
|
removeInlineMeshNode(meshId, mesh, nodeId) {
|
|
72601
72728
|
if (!mesh || !Array.isArray(mesh.nodes)) return false;
|
|
72602
|
-
const idx = mesh.nodes.findIndex((entry) => entry
|
|
72729
|
+
const idx = mesh.nodes.findIndex((entry) => meshNodeIdMatches(entry, nodeId));
|
|
72603
72730
|
if (idx === -1) return false;
|
|
72604
72731
|
mesh.nodes.splice(idx, 1);
|
|
72605
72732
|
mesh.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -72630,7 +72757,7 @@ ${e?.stderr || ""}`
|
|
|
72630
72757
|
};
|
|
72631
72758
|
}
|
|
72632
72759
|
const worktreeExists = fs24.existsSync(workspace);
|
|
72633
|
-
const sourceNode = args.node?.clonedFromNodeId ? args.mesh?.nodes?.find((n) => n
|
|
72760
|
+
const sourceNode = args.node?.clonedFromNodeId ? args.mesh?.nodes?.find((n) => meshNodeIdMatches(n, args.node.clonedFromNodeId)) : args.mesh?.nodes?.find((n) => !n.isLocalWorktree);
|
|
72634
72761
|
const repoRoot = typeof sourceNode?.repoRoot === "string" && sourceNode.repoRoot.trim() ? sourceNode.repoRoot.trim() : typeof sourceNode?.workspace === "string" && sourceNode.workspace.trim() ? sourceNode.workspace.trim() : "";
|
|
72635
72762
|
if (!worktreeExists) {
|
|
72636
72763
|
return { success: true, skipped: true, removedPath: workspace, repoRoot: repoRoot || void 0, reason: "worktree_path_missing" };
|
|
@@ -73273,12 +73400,12 @@ ${e?.stderr || ""}`
|
|
|
73273
73400
|
try {
|
|
73274
73401
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
73275
73402
|
const mesh = meshRecord?.mesh;
|
|
73276
|
-
const node = mesh?.nodes?.find((n) => n
|
|
73403
|
+
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
73277
73404
|
if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh`, refineStages };
|
|
73278
73405
|
if (!node.isLocalWorktree || !node.workspace) {
|
|
73279
73406
|
return { success: false, error: `Refinery requires a local worktree node`, refineStages };
|
|
73280
73407
|
}
|
|
73281
|
-
const sourceNode = node.clonedFromNodeId ? mesh?.nodes.find((n) => n
|
|
73408
|
+
const sourceNode = node.clonedFromNodeId ? mesh?.nodes.find((n) => meshNodeIdMatches(n, node.clonedFromNodeId)) : mesh?.nodes.find((n) => !n.isLocalWorktree);
|
|
73282
73409
|
const repoRoot = sourceNode?.repoRoot || sourceNode?.workspace;
|
|
73283
73410
|
if (!repoRoot) return { success: false, error: "Source node repoRoot not found", refineStages };
|
|
73284
73411
|
const { execFile: execFile5 } = await import("child_process");
|
|
@@ -73913,7 +74040,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
73913
74040
|
const missing = [];
|
|
73914
74041
|
const nonWorktree = [];
|
|
73915
74042
|
for (const nodeId of requestedNodeIds) {
|
|
73916
|
-
const node = allNodes.find((n) => n
|
|
74043
|
+
const node = allNodes.find((n) => meshNodeIdMatches(n, nodeId));
|
|
73917
74044
|
if (!node) {
|
|
73918
74045
|
missing.push(nodeId);
|
|
73919
74046
|
continue;
|
|
@@ -73942,7 +74069,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
73942
74069
|
const { promisify: promisify8 } = await import("util");
|
|
73943
74070
|
const execFileAsync4 = promisify8(execFile5);
|
|
73944
74071
|
const resolveRepoRootFor = (node) => {
|
|
73945
|
-
const sourceNode = node.clonedFromNodeId ? allNodes.find((n) => n
|
|
74072
|
+
const sourceNode = node.clonedFromNodeId ? allNodes.find((n) => meshNodeIdMatches(n, node.clonedFromNodeId)) : allNodes.find((n) => !n.isLocalWorktree);
|
|
73946
74073
|
return sourceNode?.repoRoot || sourceNode?.workspace;
|
|
73947
74074
|
};
|
|
73948
74075
|
const repoRootBaseRef = /* @__PURE__ */ new Map();
|
|
@@ -74031,7 +74158,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
74031
74158
|
}));
|
|
74032
74159
|
}
|
|
74033
74160
|
const ordering = orderMeshRefineBatchNodes(changeAreas);
|
|
74034
|
-
const orderedNodes = ordering.order.map((nodeId) => targetNodes.find((n) => n
|
|
74161
|
+
const orderedNodes = ordering.order.map((nodeId) => targetNodes.find((n) => meshNodeIdMatches(n, nodeId))).filter((n) => !!n);
|
|
74035
74162
|
const dryRun = args?.dryRun !== false && args?.execute !== true;
|
|
74036
74163
|
if (dryRun) {
|
|
74037
74164
|
return {
|
|
@@ -74290,7 +74417,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
74290
74417
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
74291
74418
|
const mesh = meshRecord?.mesh;
|
|
74292
74419
|
const allNodes = Array.isArray(mesh?.nodes) ? mesh.nodes : [];
|
|
74293
|
-
const orderedNodes = nodeIds.map((id) => allNodes.find((n) => n
|
|
74420
|
+
const orderedNodes = nodeIds.map((id) => allNodes.find((n) => meshNodeIdMatches(n, id))).filter((n) => !!n);
|
|
74294
74421
|
if (orderedNodes.length === 0) {
|
|
74295
74422
|
return { success: false, error: "Batch nodes no longer resolvable in mesh", batch: true };
|
|
74296
74423
|
}
|
|
@@ -74396,7 +74523,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
74396
74523
|
const terminal = this.terminalRefineJobs.get(key);
|
|
74397
74524
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
74398
74525
|
const mesh = meshRecord?.mesh;
|
|
74399
|
-
const node = mesh?.nodes?.find((n) => n
|
|
74526
|
+
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
74400
74527
|
if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
|
|
74401
74528
|
if (!node.isLocalWorktree || !node.workspace) return { success: false, error: `Refinery requires a local worktree node` };
|
|
74402
74529
|
const coordinatorDaemonId = typeof args?.coordinatorDaemonId === "string" && args.coordinatorDaemonId.trim() ? args.coordinatorDaemonId.trim() : this.deps.statusInstanceId || void 0;
|
|
@@ -74443,7 +74570,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
74443
74570
|
try {
|
|
74444
74571
|
const { getMesh: getMesh2 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
74445
74572
|
const meshObj = getMesh2(meshId) ?? this.getCachedInlineMesh(meshId);
|
|
74446
|
-
const nodeObj = Array.isArray(meshObj?.nodes) ? meshObj.nodes.find((n) => n
|
|
74573
|
+
const nodeObj = Array.isArray(meshObj?.nodes) ? meshObj.nodes.find((n) => meshNodeIdMatches(n, meshNodeId)) : void 0;
|
|
74447
74574
|
const bootstrapStatus = readStringValue(nodeObj?.worktreeBootstrap?.status);
|
|
74448
74575
|
if (bootstrapStatus === "running") {
|
|
74449
74576
|
return { success: true, ...launchResult, bootstrapPending: true };
|
|
@@ -74488,7 +74615,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
74488
74615
|
try {
|
|
74489
74616
|
const { getMesh: getMesh2 } = await Promise.resolve().then(() => (init_mesh_config(), mesh_config_exports));
|
|
74490
74617
|
const meshObj = getMesh2(dispatchMeshId) ?? this.getCachedInlineMesh(dispatchMeshId);
|
|
74491
|
-
const nodeObj = Array.isArray(meshObj?.nodes) ? meshObj.nodes.find((n) => n
|
|
74618
|
+
const nodeObj = Array.isArray(meshObj?.nodes) ? meshObj.nodes.find((n) => meshNodeIdMatches(n, dispatchNodeId)) : void 0;
|
|
74492
74619
|
const bootstrapStatus = readStringValue(nodeObj?.worktreeBootstrap?.status);
|
|
74493
74620
|
if (bootstrapStatus === "running") {
|
|
74494
74621
|
return {
|
|
@@ -75753,7 +75880,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
75753
75880
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
75754
75881
|
const mesh = meshRecord?.mesh;
|
|
75755
75882
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
75756
|
-
const node = mesh?.nodes?.find((n) => n
|
|
75883
|
+
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
75757
75884
|
if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
|
|
75758
75885
|
const mode = this.normalizeMeshSessionCleanupMode(args?.mode ?? mesh?.policy?.sessionCleanupOnNodeRemove);
|
|
75759
75886
|
const sessionIds = Array.isArray(args?.sessionIds) ? args.sessionIds.map((id) => typeof id === "string" ? id.trim() : "").filter(Boolean) : void 0;
|
|
@@ -75808,7 +75935,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
75808
75935
|
if (!meshId || !nodeId) return { success: false, error: "meshId and nodeId required" };
|
|
75809
75936
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
75810
75937
|
const mesh = meshRecord?.mesh;
|
|
75811
|
-
const node = mesh?.nodes?.find((n) => n
|
|
75938
|
+
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
75812
75939
|
if (!node?.workspace) return { success: false, error: `Node '${nodeId}' workspace not found` };
|
|
75813
75940
|
return {
|
|
75814
75941
|
success: true,
|
|
@@ -75830,7 +75957,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
75830
75957
|
if (meshId && nodeId) {
|
|
75831
75958
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
75832
75959
|
const mesh = meshRecord?.mesh;
|
|
75833
|
-
const node = mesh?.nodes?.find((n) => n
|
|
75960
|
+
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
75834
75961
|
if (!workspace) {
|
|
75835
75962
|
workspace = typeof node?.workspace === "string" ? node.workspace.trim() : "";
|
|
75836
75963
|
}
|
|
@@ -75873,7 +76000,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
75873
76000
|
if (isDryRun) {
|
|
75874
76001
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
75875
76002
|
const mesh = meshRecord?.mesh;
|
|
75876
|
-
const node = mesh?.nodes?.find((n) => n
|
|
76003
|
+
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
75877
76004
|
if (!node?.workspace) return { success: false, error: `Node '${nodeId}' workspace not found` };
|
|
75878
76005
|
return {
|
|
75879
76006
|
success: true,
|
|
@@ -75903,7 +76030,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
75903
76030
|
try {
|
|
75904
76031
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
75905
76032
|
const mesh = meshRecord?.mesh;
|
|
75906
|
-
const node = mesh?.nodes?.find((n) => n
|
|
76033
|
+
const node = mesh?.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
75907
76034
|
if (node && !args?._meshDirectDispatch && node.isLocalWorktree !== true && args?.force !== true) {
|
|
75908
76035
|
const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : "";
|
|
75909
76036
|
const nodeMachineId = readMeshNodeMachineId(node) || "";
|
|
@@ -76017,7 +76144,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
76017
76144
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
76018
76145
|
const mesh = meshRecord?.mesh;
|
|
76019
76146
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
76020
|
-
const sourceNode = mesh.nodes?.find((n) => n
|
|
76147
|
+
const sourceNode = mesh.nodes?.find((n) => meshNodeIdMatches(n, sourceNodeId));
|
|
76021
76148
|
if (!sourceNode) return { success: false, error: `Source node '${sourceNodeId}' not found in mesh` };
|
|
76022
76149
|
const sourceDaemonId = typeof sourceNode.daemonId === "string" ? sourceNode.daemonId.trim() : void 0;
|
|
76023
76150
|
if (sourceDaemonId && sourceDaemonId !== this.deps.statusInstanceId && this.deps.dispatchMeshCommand && !args?._meshDirectDispatch) {
|
|
@@ -76258,7 +76385,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
76258
76385
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
76259
76386
|
const mesh = meshRecord?.mesh;
|
|
76260
76387
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
76261
|
-
const node = mesh.nodes?.find((n) => n
|
|
76388
|
+
const node = mesh.nodes?.find((n) => meshNodeIdMatches(n, nodeId));
|
|
76262
76389
|
if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
|
|
76263
76390
|
if (!node.isLocalWorktree) return { success: false, error: "Node is not a local worktree node" };
|
|
76264
76391
|
const nodeDaemonId = typeof node.daemonId === "string" ? node.daemonId.trim() : void 0;
|
|
@@ -76395,14 +76522,14 @@ ${hintLines.join("\n")}` : "",
|
|
|
76395
76522
|
const liveMeshSessions = partitionSessionHostRecords(Array.isArray(sessionHostRecords) ? sessionHostRecords : []).liveRuntimes;
|
|
76396
76523
|
const workspace = readLiveMeshNodeWorkspace({
|
|
76397
76524
|
meshId,
|
|
76398
|
-
nodeId: String(coordinatorNode
|
|
76525
|
+
nodeId: String(normalizeMeshNodeId(coordinatorNode) || preferredCoordinatorNodeId || ""),
|
|
76399
76526
|
liveSessionRecords: liveMeshSessions,
|
|
76400
76527
|
allowCoordinatorSession: true
|
|
76401
76528
|
}) || (typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "");
|
|
76402
76529
|
if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
|
|
76403
76530
|
if (!cliType) {
|
|
76404
76531
|
const resolved = await resolveProviderTypeFromPriority({
|
|
76405
|
-
nodeId: String(coordinatorNode
|
|
76532
|
+
nodeId: String(normalizeMeshNodeId(coordinatorNode) || preferredCoordinatorNodeId || "coordinator"),
|
|
76406
76533
|
providerPriority: readProviderPriorityFromPolicy(coordinatorNode.policy),
|
|
76407
76534
|
providerLoader: this.deps.providerLoader,
|
|
76408
76535
|
onStatusChange: this.deps.onStatusChange
|
|
@@ -76856,7 +76983,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
76856
76983
|
const passivePeerTruthNotAttempted = requireDirectPeerTruth && !refreshRequested && directTruth.directEvidenceCount > 0 && directTruth.peerAttemptedCount === 0;
|
|
76857
76984
|
const effectiveDirectTruth = passivePeerTruthNotAttempted ? { ...directTruth, unavailableNodeIds: [] } : directTruth;
|
|
76858
76985
|
const unavailableDirectTruthNodeIds = new Set(effectiveDirectTruth.unavailableNodeIds);
|
|
76859
|
-
const unavailableNodesAreOnlyRemovedWorktrees = unavailableDirectTruthNodeIds.size > 0 && Array.isArray(mesh.nodes) && mesh.nodes.filter((node) => unavailableDirectTruthNodeIds.has(
|
|
76986
|
+
const unavailableNodesAreOnlyRemovedWorktrees = unavailableDirectTruthNodeIds.size > 0 && Array.isArray(mesh.nodes) && mesh.nodes.filter((node) => unavailableDirectTruthNodeIds.has(normalizeMeshNodeId(node) ?? "")).every((node) => node?.isLocalWorktree === true);
|
|
76860
76987
|
const directTruthSatisfied = !requireDirectPeerTruth || effectiveDirectTruth.directEvidenceCount > 0 && (effectiveDirectTruth.unavailableNodeIds.length === 0 || unavailableNodesAreOnlyRemovedWorktrees);
|
|
76861
76988
|
if (requireDirectPeerTruth && !directTruthSatisfied) {
|
|
76862
76989
|
const failureResult = {
|
|
@@ -76891,14 +77018,13 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
76891
77018
|
const coordinatorHostname = (0, import_os3.hostname)();
|
|
76892
77019
|
const selectedCoordinatorNodeId = readStringValue(
|
|
76893
77020
|
mesh.coordinator?.preferredNodeId,
|
|
76894
|
-
mesh.nodes?.[0]
|
|
76895
|
-
mesh.nodes?.[0]?.nodeId
|
|
77021
|
+
normalizeMeshNodeId(mesh.nodes?.[0])
|
|
76896
77022
|
);
|
|
76897
77023
|
const inlineCoordinatorNodeId = meshRecord?.inline && Array.isArray(mesh.nodes) ? selectedCoordinatorNodeId : void 0;
|
|
76898
77024
|
const refreshedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
76899
77025
|
const nodeStatuses = [];
|
|
76900
77026
|
for (const [nodeIndex, node] of (mesh.nodes || []).entries()) {
|
|
76901
|
-
const nodeId =
|
|
77027
|
+
const nodeId = normalizeMeshNodeId(node) ?? "";
|
|
76902
77028
|
const daemonId = readStringValue(node.daemonId);
|
|
76903
77029
|
const nodeMachineId = readMeshNodeMachineId(node);
|
|
76904
77030
|
const nodeHostname = readMeshNodeHostname(node);
|