@adhdev/daemon-standalone 1.0.56-rc.7 → 1.0.56-rc.8
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 +657 -548
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -36620,10 +36620,10 @@ var require_dist3 = __commonJS({
|
|
|
36620
36620
|
}
|
|
36621
36621
|
function getDaemonBuildInfo() {
|
|
36622
36622
|
if (cached2) return cached2;
|
|
36623
|
-
const commit = readInjected(true ? "
|
|
36624
|
-
const commitShort = readInjected(true ? "
|
|
36625
|
-
const version2 = readInjected(true ? "1.0.56-rc.
|
|
36626
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
36623
|
+
const commit = readInjected(true ? "f45b1ccbf70f856ec2232e2dc5a87acaf875243e" : void 0) ?? "unknown";
|
|
36624
|
+
const commitShort = readInjected(true ? "f45b1ccb" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
36625
|
+
const version2 = readInjected(true ? "1.0.56-rc.8" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
36626
|
+
const builtAt = readInjected(true ? "2026-08-19T16:04:19.674Z" : void 0);
|
|
36627
36627
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
36628
36628
|
return cached2;
|
|
36629
36629
|
}
|
|
@@ -40952,11 +40952,11 @@ child.on('exit', () => process.exit(0));
|
|
|
40952
40952
|
}
|
|
40953
40953
|
function windowsExtraBinDirs() {
|
|
40954
40954
|
const dirs = [];
|
|
40955
|
-
const
|
|
40955
|
+
const fs61 = require("fs");
|
|
40956
40956
|
const push = (dir) => {
|
|
40957
40957
|
if (!dir) return;
|
|
40958
40958
|
try {
|
|
40959
|
-
if (
|
|
40959
|
+
if (fs61.existsSync(dir)) dirs.push(dir);
|
|
40960
40960
|
} catch {
|
|
40961
40961
|
}
|
|
40962
40962
|
};
|
|
@@ -40972,12 +40972,12 @@ child.on('exit', () => process.exit(0));
|
|
|
40972
40972
|
}
|
|
40973
40973
|
function unixExtraBinDirs() {
|
|
40974
40974
|
const dirs = [];
|
|
40975
|
-
const
|
|
40975
|
+
const fs61 = require("fs");
|
|
40976
40976
|
const home = os52.homedir();
|
|
40977
40977
|
const push = (dir) => {
|
|
40978
40978
|
if (!dir) return;
|
|
40979
40979
|
try {
|
|
40980
|
-
if (
|
|
40980
|
+
if (fs61.existsSync(dir)) dirs.push(dir);
|
|
40981
40981
|
} catch {
|
|
40982
40982
|
}
|
|
40983
40983
|
};
|
|
@@ -41016,9 +41016,9 @@ child.on('exit', () => process.exit(0));
|
|
|
41016
41016
|
for (const ext of exes) {
|
|
41017
41017
|
const fullPath = path9.join(p, trimmed + ext);
|
|
41018
41018
|
try {
|
|
41019
|
-
const
|
|
41020
|
-
if (
|
|
41021
|
-
const stat2 =
|
|
41019
|
+
const fs61 = require("fs");
|
|
41020
|
+
if (fs61.existsSync(fullPath)) {
|
|
41021
|
+
const stat2 = fs61.statSync(fullPath);
|
|
41022
41022
|
if (stat2.isFile() && (isWin || stat2.mode & 73)) {
|
|
41023
41023
|
return fullPath;
|
|
41024
41024
|
}
|
|
@@ -41032,12 +41032,12 @@ child.on('exit', () => process.exit(0));
|
|
|
41032
41032
|
function isScriptBinary(binaryPath) {
|
|
41033
41033
|
if (!path9.isAbsolute(binaryPath)) return false;
|
|
41034
41034
|
try {
|
|
41035
|
-
const
|
|
41036
|
-
const resolved =
|
|
41035
|
+
const fs61 = require("fs");
|
|
41036
|
+
const resolved = fs61.realpathSync(binaryPath);
|
|
41037
41037
|
const head = Buffer.alloc(8);
|
|
41038
|
-
const fd =
|
|
41039
|
-
|
|
41040
|
-
|
|
41038
|
+
const fd = fs61.openSync(resolved, "r");
|
|
41039
|
+
fs61.readSync(fd, head, 0, 8, 0);
|
|
41040
|
+
fs61.closeSync(fd);
|
|
41041
41041
|
let i = 0;
|
|
41042
41042
|
if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
|
|
41043
41043
|
return head[i] === 35 && head[i + 1] === 33;
|
|
@@ -41048,12 +41048,12 @@ child.on('exit', () => process.exit(0));
|
|
|
41048
41048
|
function looksLikeMachOOrElf(filePath) {
|
|
41049
41049
|
if (!path9.isAbsolute(filePath)) return false;
|
|
41050
41050
|
try {
|
|
41051
|
-
const
|
|
41052
|
-
const resolved =
|
|
41051
|
+
const fs61 = require("fs");
|
|
41052
|
+
const resolved = fs61.realpathSync(filePath);
|
|
41053
41053
|
const buf = Buffer.alloc(8);
|
|
41054
|
-
const fd =
|
|
41055
|
-
|
|
41056
|
-
|
|
41054
|
+
const fd = fs61.openSync(resolved, "r");
|
|
41055
|
+
fs61.readSync(fd, buf, 0, 8, 0);
|
|
41056
|
+
fs61.closeSync(fd);
|
|
41057
41057
|
let i = 0;
|
|
41058
41058
|
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
|
|
41059
41059
|
const b = buf.subarray(i);
|
|
@@ -47896,11 +47896,31 @@ ${blocks.join("\n\n")}`;
|
|
|
47896
47896
|
...alertReason ? [alertReason] : []
|
|
47897
47897
|
].join("::");
|
|
47898
47898
|
}
|
|
47899
|
+
function isDurablyDedupedEvent(event) {
|
|
47900
|
+
if (!TERMINAL_COMPLETION_EVENTS.has(event.event)) return false;
|
|
47901
|
+
const metadata = readRecord2(event.metadataEvent) || {};
|
|
47902
|
+
const taskId = readNonEmptyString(metadata.taskId) || readNonEmptyString(readRecord2(metadata.payload)?.taskId);
|
|
47903
|
+
return !!taskId;
|
|
47904
|
+
}
|
|
47905
|
+
function recordDurableTerminalDedup(event, fingerprint) {
|
|
47906
|
+
if (!isDurablyDedupedEvent(event)) return;
|
|
47907
|
+
try {
|
|
47908
|
+
const store = MeshRuntimeStore.getInstance();
|
|
47909
|
+
store.recordCompletionFingerprint(event.meshId, `pending::${fingerprint}`, TERMINAL_COMPLETION_DEDUP_TTL_MS);
|
|
47910
|
+
store.sweepExpiredFingerprints();
|
|
47911
|
+
} catch {
|
|
47912
|
+
}
|
|
47913
|
+
}
|
|
47899
47914
|
function hasPendingCoordinatorEventDuplicate(event) {
|
|
47900
47915
|
const fingerprint = buildPendingEventFingerprint(event);
|
|
47901
47916
|
if (!fingerprint.trim()) return false;
|
|
47902
47917
|
try {
|
|
47903
|
-
|
|
47918
|
+
const store = MeshRuntimeStore.getInstance();
|
|
47919
|
+
if (store.hasPendingEventFingerprint(event.meshId, fingerprint)) return true;
|
|
47920
|
+
if (isDurablyDedupedEvent(event) && store.hasCompletionFingerprint(event.meshId, `pending::${fingerprint}`)) {
|
|
47921
|
+
return true;
|
|
47922
|
+
}
|
|
47923
|
+
return false;
|
|
47904
47924
|
} catch {
|
|
47905
47925
|
return false;
|
|
47906
47926
|
}
|
|
@@ -48123,6 +48143,7 @@ ${blocks.join("\n\n")}`;
|
|
|
48123
48143
|
dispatchedBy: event.dispatchedBy ? JSON.stringify(event.dispatchedBy) : null,
|
|
48124
48144
|
intendedFor: event.intendedFor ? JSON.stringify(event.intendedFor) : null
|
|
48125
48145
|
});
|
|
48146
|
+
recordDurableTerminalDedup(event, fingerprint);
|
|
48126
48147
|
return true;
|
|
48127
48148
|
} catch (e) {
|
|
48128
48149
|
LOG2.error(
|
|
@@ -48343,6 +48364,7 @@ ${blocks.join("\n\n")}`;
|
|
|
48343
48364
|
var loggedSqlitePendingDrainFailure;
|
|
48344
48365
|
var TERMINAL_COMPLETION_EVENTS;
|
|
48345
48366
|
var COORDINATOR_ALERT_EVENTS_WITH_REASON_FINGERPRINT;
|
|
48367
|
+
var TERMINAL_COMPLETION_DEDUP_TTL_MS;
|
|
48346
48368
|
var PENDING_EVENTS_DRAINED_RETENTION_MS;
|
|
48347
48369
|
var PENDING_EVENTS_UNDRAINED_RETENTION_MS;
|
|
48348
48370
|
var PENDING_RETENTION_EXPIRED_HOLD_REASON;
|
|
@@ -48396,6 +48418,7 @@ ${blocks.join("\n\n")}`;
|
|
|
48396
48418
|
COORDINATOR_ALERT_EVENTS_WITH_REASON_FINGERPRINT = /* @__PURE__ */ new Set([
|
|
48397
48419
|
"mesh:dispatch_blocked"
|
|
48398
48420
|
]);
|
|
48421
|
+
TERMINAL_COMPLETION_DEDUP_TTL_MS = 60 * 60 * 1e3;
|
|
48399
48422
|
PENDING_EVENTS_DRAINED_RETENTION_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
48400
48423
|
PENDING_EVENTS_UNDRAINED_RETENTION_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
48401
48424
|
PENDING_RETENTION_EXPIRED_HOLD_REASON = "pending_retention_expired";
|
|
@@ -54861,7 +54884,11 @@ The instruction it carried was never delivered to anyone. If it still matters, r
|
|
|
54861
54884
|
}
|
|
54862
54885
|
/** Remove all pending-event rows (drained included) for a mesh — mesh deletion / test cleanup. */
|
|
54863
54886
|
clearPendingEventsForMesh(meshId) {
|
|
54864
|
-
|
|
54887
|
+
const changes = this.db.prepare("DELETE FROM mesh_pending_events WHERE mesh_id = ?").run(meshId).changes;
|
|
54888
|
+
this.db.prepare(
|
|
54889
|
+
`DELETE FROM mesh_completion_fingerprints WHERE mesh_id = ? AND fingerprint LIKE 'pending::%'`
|
|
54890
|
+
).run(meshId);
|
|
54891
|
+
return changes;
|
|
54865
54892
|
}
|
|
54866
54893
|
pendingEventCount(meshId) {
|
|
54867
54894
|
const row = this.db.prepare(
|
|
@@ -58803,8 +58830,8 @@ ${rendered}`, "utf-8");
|
|
|
58803
58830
|
if (!(0, import_node_fs3.existsSync)(filePath)) return;
|
|
58804
58831
|
if (owned) {
|
|
58805
58832
|
try {
|
|
58806
|
-
const
|
|
58807
|
-
|
|
58833
|
+
const fs61 = require("fs");
|
|
58834
|
+
fs61.unlinkSync(filePath);
|
|
58808
58835
|
} catch {
|
|
58809
58836
|
}
|
|
58810
58837
|
return;
|
|
@@ -58817,8 +58844,8 @@ ${rendered}`, "utf-8");
|
|
|
58817
58844
|
const remaining = (existing.slice(0, openIdx) + existing.slice(closeIdx + CLOSE.length)).replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
|
|
58818
58845
|
if (!remaining.trim()) {
|
|
58819
58846
|
try {
|
|
58820
|
-
const
|
|
58821
|
-
|
|
58847
|
+
const fs61 = require("fs");
|
|
58848
|
+
fs61.unlinkSync(filePath);
|
|
58822
58849
|
} catch {
|
|
58823
58850
|
}
|
|
58824
58851
|
} else {
|
|
@@ -62648,6 +62675,13 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
62648
62675
|
}
|
|
62649
62676
|
return false;
|
|
62650
62677
|
}
|
|
62678
|
+
function isReplayOfRecordedSynthSummary(recorded, incoming) {
|
|
62679
|
+
if (recorded === incoming) return true;
|
|
62680
|
+
if (!recorded || !incoming) return false;
|
|
62681
|
+
const [shorter, longer] = recorded.length <= incoming.length ? [recorded, incoming] : [incoming, recorded];
|
|
62682
|
+
if (!longer.startsWith(shorter)) return false;
|
|
62683
|
+
return longer.length <= shorter.length + 32;
|
|
62684
|
+
}
|
|
62651
62685
|
function hasIdenticalSynthesizedTerminal(args) {
|
|
62652
62686
|
const entries = readLedgerEntriesByKind(args.meshId, ["task_dispatched", ...TERMINAL_LEDGER_KINDS2]);
|
|
62653
62687
|
let afterDispatch = !args.dispatchEntryId && !args.dispatchTimestamp;
|
|
@@ -62667,7 +62701,7 @@ The mesh has no work in flight. For each mission, decide its outcome: continue i
|
|
|
62667
62701
|
if (entry.kind !== "task_completed" && entry.kind !== "task_failed") continue;
|
|
62668
62702
|
const diagnostic = readRecord2(entry.payload?.completionDiagnostic);
|
|
62669
62703
|
if (readNonEmptyString(diagnostic?.reason) !== "direct_task_transcript_reconciliation") continue;
|
|
62670
|
-
if (readNonEmptyString(entry.payload?.finalSummary)
|
|
62704
|
+
if (!isReplayOfRecordedSynthSummary(readNonEmptyString(entry.payload?.finalSummary), args.finalSummary)) continue;
|
|
62671
62705
|
const terminalTaskId = readNonEmptyString(entry.payload?.taskId);
|
|
62672
62706
|
if (terminalTaskId && terminalTaskId !== args.taskId) continue;
|
|
62673
62707
|
if (terminalTaskId && terminalTaskId === args.taskId) return true;
|
|
@@ -77621,8 +77655,8 @@ ${cleanBody}`;
|
|
|
77621
77655
|
let cwd = options.cwd;
|
|
77622
77656
|
if (cwd) {
|
|
77623
77657
|
try {
|
|
77624
|
-
const
|
|
77625
|
-
const stat2 =
|
|
77658
|
+
const fs61 = require("fs");
|
|
77659
|
+
const stat2 = fs61.statSync(cwd);
|
|
77626
77660
|
if (!stat2.isDirectory()) cwd = os14.homedir();
|
|
77627
77661
|
} catch {
|
|
77628
77662
|
cwd = os14.homedir();
|
|
@@ -79019,6 +79053,360 @@ ${cleanBody}`;
|
|
|
79019
79053
|
DEFAULT_REFINE_VITEST_MAX_WORKERS = 2;
|
|
79020
79054
|
}
|
|
79021
79055
|
});
|
|
79056
|
+
function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
|
|
79057
|
+
try {
|
|
79058
|
+
const output = (0, import_node_child_process11.execFileSync)(GIT4, ["diff", "--raw", "--no-abbrev", fromRef, toRef], {
|
|
79059
|
+
cwd: repoRoot,
|
|
79060
|
+
encoding: "utf8",
|
|
79061
|
+
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
79062
|
+
});
|
|
79063
|
+
const paths = /* @__PURE__ */ new Set();
|
|
79064
|
+
for (const line of output.split("\n")) {
|
|
79065
|
+
if (!line.trim()) continue;
|
|
79066
|
+
const metaAndPath = line.split(" ");
|
|
79067
|
+
const meta3 = metaAndPath[0] || "";
|
|
79068
|
+
const path58 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
79069
|
+
if (!path58) continue;
|
|
79070
|
+
const parts = meta3.split(/\s+/);
|
|
79071
|
+
if (parts[0]?.includes("160000") || parts[1]?.includes("160000")) {
|
|
79072
|
+
paths.add(path58);
|
|
79073
|
+
}
|
|
79074
|
+
}
|
|
79075
|
+
return [...paths].sort();
|
|
79076
|
+
} catch {
|
|
79077
|
+
return [];
|
|
79078
|
+
}
|
|
79079
|
+
}
|
|
79080
|
+
function readTreeObject(repoRoot, ref, path58) {
|
|
79081
|
+
try {
|
|
79082
|
+
const output = (0, import_node_child_process11.execFileSync)(GIT4, ["ls-tree", ref, "--", path58], {
|
|
79083
|
+
cwd: repoRoot,
|
|
79084
|
+
encoding: "utf8",
|
|
79085
|
+
maxBuffer: 1024 * 1024
|
|
79086
|
+
}).trim();
|
|
79087
|
+
const match = output.match(/\bcommit\s+([0-9a-f]{40})\b/i);
|
|
79088
|
+
return match?.[1];
|
|
79089
|
+
} catch {
|
|
79090
|
+
return void 0;
|
|
79091
|
+
}
|
|
79092
|
+
}
|
|
79093
|
+
function submoduleCommitPresent(submoduleRepoPath, commit) {
|
|
79094
|
+
if (!commit) return false;
|
|
79095
|
+
try {
|
|
79096
|
+
(0, import_node_child_process11.execFileSync)(GIT4, ["cat-file", "-e", `${commit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79097
|
+
return true;
|
|
79098
|
+
} catch {
|
|
79099
|
+
return false;
|
|
79100
|
+
}
|
|
79101
|
+
}
|
|
79102
|
+
function ensureSubmoduleCommitLocal(submoduleRepoPath, baseSubmoduleRepoPath, commit) {
|
|
79103
|
+
if (!commit) return false;
|
|
79104
|
+
const present = () => {
|
|
79105
|
+
try {
|
|
79106
|
+
(0, import_node_child_process11.execFileSync)(GIT4, ["cat-file", "-e", `${commit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79107
|
+
return true;
|
|
79108
|
+
} catch {
|
|
79109
|
+
return false;
|
|
79110
|
+
}
|
|
79111
|
+
};
|
|
79112
|
+
if (present()) return true;
|
|
79113
|
+
try {
|
|
79114
|
+
if (!fs48.existsSync(submoduleRepoPath) || !fs48.existsSync(baseSubmoduleRepoPath)) return false;
|
|
79115
|
+
} catch {
|
|
79116
|
+
return false;
|
|
79117
|
+
}
|
|
79118
|
+
const strategies = [
|
|
79119
|
+
// 1. All local branches (historical behaviour).
|
|
79120
|
+
["fetch", "-q", baseSubmoduleRepoPath, "+refs/heads/*:refs/adhdev-refine-base/*"],
|
|
79121
|
+
// 2. The base checkout's detached HEAD plus every ref it has.
|
|
79122
|
+
["fetch", "-q", baseSubmoduleRepoPath, "HEAD", "+refs/*:refs/adhdev-refine-base-all/*"],
|
|
79123
|
+
// 3. The exact object, allowing a bare-sha want on the source side.
|
|
79124
|
+
["fetch", "-q", "--upload-pack", "git -c uploadpack.allowAnySHA1InWant=true upload-pack", baseSubmoduleRepoPath, commit]
|
|
79125
|
+
];
|
|
79126
|
+
for (const args of strategies) {
|
|
79127
|
+
try {
|
|
79128
|
+
(0, import_node_child_process11.execFileSync)(GIT4, ["-c", "protocol.file.allow=always", ...args], {
|
|
79129
|
+
cwd: submoduleRepoPath,
|
|
79130
|
+
stdio: ["ignore", "ignore", "pipe"]
|
|
79131
|
+
});
|
|
79132
|
+
} catch {
|
|
79133
|
+
}
|
|
79134
|
+
if (present()) return true;
|
|
79135
|
+
}
|
|
79136
|
+
return false;
|
|
79137
|
+
}
|
|
79138
|
+
var fs48;
|
|
79139
|
+
var import_node_child_process11;
|
|
79140
|
+
var GIT4;
|
|
79141
|
+
var REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES;
|
|
79142
|
+
var init_mesh_refine_gitlink_utils = __esm2({
|
|
79143
|
+
"src/mesh/mesh-refine-gitlink-utils.ts"() {
|
|
79144
|
+
"use strict";
|
|
79145
|
+
fs48 = __toESM2(require("fs"));
|
|
79146
|
+
import_node_child_process11 = require("child_process");
|
|
79147
|
+
init_resolve_executable();
|
|
79148
|
+
GIT4 = process.platform === "win32" ? resolveWin32Executable("git") : "git";
|
|
79149
|
+
REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES = 4 * 1024 * 1024;
|
|
79150
|
+
}
|
|
79151
|
+
});
|
|
79152
|
+
function classifySubmoduleDivergence(submoduleRepoPath, baseCommit, branchCommit) {
|
|
79153
|
+
if (!baseCommit || !branchCommit) return "undeterminable";
|
|
79154
|
+
if (baseCommit === branchCommit) return "not_diverged";
|
|
79155
|
+
try {
|
|
79156
|
+
if (!fs49.existsSync(submoduleRepoPath)) return "undeterminable";
|
|
79157
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["cat-file", "-e", `${baseCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79158
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["cat-file", "-e", `${branchCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79159
|
+
} catch {
|
|
79160
|
+
return "undeterminable";
|
|
79161
|
+
}
|
|
79162
|
+
try {
|
|
79163
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["merge-base", "--is-ancestor", baseCommit, branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79164
|
+
return "not_diverged";
|
|
79165
|
+
} catch {
|
|
79166
|
+
}
|
|
79167
|
+
try {
|
|
79168
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["merge-base", "--is-ancestor", branchCommit, baseCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79169
|
+
return "not_diverged";
|
|
79170
|
+
} catch {
|
|
79171
|
+
}
|
|
79172
|
+
try {
|
|
79173
|
+
const mb = (0, import_node_child_process12.execFileSync)(GIT4, ["merge-base", baseCommit, branchCommit], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79174
|
+
return mb ? "diverged" : "not_diverged";
|
|
79175
|
+
} catch {
|
|
79176
|
+
return "not_diverged";
|
|
79177
|
+
}
|
|
79178
|
+
}
|
|
79179
|
+
function resolveSubmoduleRemoteMainRef(submoduleRepoPath) {
|
|
79180
|
+
try {
|
|
79181
|
+
const sym = (0, import_node_child_process12.execFileSync)(GIT4, ["symbolic-ref", "-q", "refs/remotes/origin/HEAD"], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79182
|
+
if (sym) return sym;
|
|
79183
|
+
} catch {
|
|
79184
|
+
}
|
|
79185
|
+
for (const branch of ["main", "master"]) {
|
|
79186
|
+
try {
|
|
79187
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["rev-parse", "--verify", "-q", `refs/remotes/origin/${branch}`], { cwd: submoduleRepoPath, stdio: ["ignore", "pipe", "pipe"] });
|
|
79188
|
+
return `refs/remotes/origin/${branch}`;
|
|
79189
|
+
} catch {
|
|
79190
|
+
}
|
|
79191
|
+
}
|
|
79192
|
+
return void 0;
|
|
79193
|
+
}
|
|
79194
|
+
function findEquivalentPublishedSubmoduleCommit(submoduleRepoPath, baseCommit, branchCommit, remoteRef) {
|
|
79195
|
+
try {
|
|
79196
|
+
const mergeTreeOut = (0, import_node_child_process12.execFileSync)(GIT4, ["merge-tree", "--write-tree", baseCommit, branchCommit], {
|
|
79197
|
+
cwd: submoduleRepoPath,
|
|
79198
|
+
encoding: "utf8",
|
|
79199
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
79200
|
+
});
|
|
79201
|
+
const mergedTree = mergeTreeOut.trim().split(/\s+/)[0] || "";
|
|
79202
|
+
if (!mergedTree) return void 0;
|
|
79203
|
+
const candidates = (0, import_node_child_process12.execFileSync)(GIT4, ["rev-list", "--max-count=100", remoteRef, "--not", baseCommit], {
|
|
79204
|
+
cwd: submoduleRepoPath,
|
|
79205
|
+
encoding: "utf8"
|
|
79206
|
+
}).split("\n").map((s2) => s2.trim()).filter(Boolean);
|
|
79207
|
+
for (const candidate of candidates) {
|
|
79208
|
+
try {
|
|
79209
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["merge-base", "--is-ancestor", baseCommit, candidate], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79210
|
+
} catch {
|
|
79211
|
+
continue;
|
|
79212
|
+
}
|
|
79213
|
+
const tree = (0, import_node_child_process12.execFileSync)(GIT4, ["rev-parse", `${candidate}^{tree}`], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79214
|
+
if (tree === mergedTree) return candidate;
|
|
79215
|
+
}
|
|
79216
|
+
} catch {
|
|
79217
|
+
}
|
|
79218
|
+
return void 0;
|
|
79219
|
+
}
|
|
79220
|
+
function convergeDivergedSubmoduleGitlinks(worktreeRoot, baseRepoRoot, baseHead, branchHead) {
|
|
79221
|
+
const changed = readChangedGitlinkPaths(worktreeRoot, baseHead, branchHead);
|
|
79222
|
+
if (changed.length === 0) {
|
|
79223
|
+
return { converged: false, reason: "no_changed_gitlinks", resolutions: [], gitlinks: [] };
|
|
79224
|
+
}
|
|
79225
|
+
const gitlinks = [];
|
|
79226
|
+
const resolutions = [];
|
|
79227
|
+
let sawDiverged = false;
|
|
79228
|
+
let sawUndeterminable = false;
|
|
79229
|
+
for (const path58 of changed) {
|
|
79230
|
+
const baseCommit = readTreeObject(baseRepoRoot, baseHead, path58);
|
|
79231
|
+
const branchCommit = readTreeObject(worktreeRoot, branchHead, path58);
|
|
79232
|
+
const submoduleRepoPath = (0, import_path17.resolve)(worktreeRoot, path58);
|
|
79233
|
+
if (baseCommit) {
|
|
79234
|
+
ensureSubmoduleCommitLocal(submoduleRepoPath, (0, import_path17.resolve)(baseRepoRoot, path58), baseCommit);
|
|
79235
|
+
}
|
|
79236
|
+
const markUndeterminable = () => {
|
|
79237
|
+
const unavailable = [];
|
|
79238
|
+
if (!baseCommit || !submoduleCommitPresent(submoduleRepoPath, baseCommit)) unavailable.push("base");
|
|
79239
|
+
if (!branchCommit || !submoduleCommitPresent(submoduleRepoPath, branchCommit)) unavailable.push("branch");
|
|
79240
|
+
sawUndeterminable = true;
|
|
79241
|
+
gitlinks.push({ path: path58, baseCommit, branchCommit, action: "skipped_commit_unavailable", unavailable });
|
|
79242
|
+
};
|
|
79243
|
+
if (!baseCommit || !branchCommit) {
|
|
79244
|
+
markUndeterminable();
|
|
79245
|
+
continue;
|
|
79246
|
+
}
|
|
79247
|
+
const divergence = classifySubmoduleDivergence(submoduleRepoPath, baseCommit, branchCommit);
|
|
79248
|
+
if (divergence === "undeterminable") {
|
|
79249
|
+
markUndeterminable();
|
|
79250
|
+
continue;
|
|
79251
|
+
}
|
|
79252
|
+
if (divergence !== "diverged") {
|
|
79253
|
+
gitlinks.push({ path: path58, baseCommit, branchCommit, action: "skipped_not_diverged" });
|
|
79254
|
+
continue;
|
|
79255
|
+
}
|
|
79256
|
+
sawDiverged = true;
|
|
79257
|
+
try {
|
|
79258
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["-c", "protocol.file.allow=always", "fetch", "-q", "origin"], { cwd: submoduleRepoPath, stdio: ["ignore", "ignore", "pipe"] });
|
|
79259
|
+
} catch {
|
|
79260
|
+
}
|
|
79261
|
+
const remoteMainRef = resolveSubmoduleRemoteMainRef(submoduleRepoPath);
|
|
79262
|
+
const publishedEquivalent = remoteMainRef ? findEquivalentPublishedSubmoduleCommit(submoduleRepoPath, baseCommit, branchCommit, remoteMainRef) : void 0;
|
|
79263
|
+
if (publishedEquivalent) {
|
|
79264
|
+
try {
|
|
79265
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["checkout", "-q", "--detach", publishedEquivalent], { cwd: submoduleRepoPath, stdio: ["ignore", "ignore", "pipe"] });
|
|
79266
|
+
} catch {
|
|
79267
|
+
}
|
|
79268
|
+
gitlinks.push({ path: path58, baseCommit, branchCommit, rebasedCommit: publishedEquivalent, action: "converged_to_published" });
|
|
79269
|
+
resolutions.push({ path: path58, baseCommit, branchCommit, rebasedCommit: publishedEquivalent });
|
|
79270
|
+
continue;
|
|
79271
|
+
}
|
|
79272
|
+
let rebasedCommit;
|
|
79273
|
+
try {
|
|
79274
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["checkout", "-q", "--detach", branchCommit], { cwd: submoduleRepoPath, stdio: ["ignore", "ignore", "pipe"] });
|
|
79275
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["rebase", baseCommit], { cwd: submoduleRepoPath, stdio: ["ignore", "pipe", "pipe"] });
|
|
79276
|
+
rebasedCommit = (0, import_node_child_process12.execFileSync)(GIT4, ["rev-parse", "HEAD"], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79277
|
+
} catch {
|
|
79278
|
+
try {
|
|
79279
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["rebase", "--abort"], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79280
|
+
} catch {
|
|
79281
|
+
}
|
|
79282
|
+
try {
|
|
79283
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["checkout", "-q", "--detach", branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79284
|
+
} catch {
|
|
79285
|
+
}
|
|
79286
|
+
gitlinks.push({ path: path58, baseCommit, branchCommit, action: "rebase_conflict" });
|
|
79287
|
+
return { converged: false, reason: "rebase_conflict", resolutions: [], gitlinks };
|
|
79288
|
+
}
|
|
79289
|
+
const branchWorkSurvived = (() => {
|
|
79290
|
+
if (!rebasedCommit) return false;
|
|
79291
|
+
if (rebasedCommit === branchCommit) return true;
|
|
79292
|
+
if (rebasedCommit === baseCommit) return false;
|
|
79293
|
+
try {
|
|
79294
|
+
const replayed = (0, import_node_child_process12.execFileSync)(GIT4, ["rev-list", "--count", `${baseCommit}..${rebasedCommit}`], {
|
|
79295
|
+
cwd: submoduleRepoPath,
|
|
79296
|
+
encoding: "utf8"
|
|
79297
|
+
}).trim();
|
|
79298
|
+
return Number.parseInt(replayed, 10) > 0;
|
|
79299
|
+
} catch {
|
|
79300
|
+
return false;
|
|
79301
|
+
}
|
|
79302
|
+
})();
|
|
79303
|
+
if (!branchWorkSurvived) {
|
|
79304
|
+
try {
|
|
79305
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["checkout", "-q", "--detach", branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79306
|
+
} catch {
|
|
79307
|
+
}
|
|
79308
|
+
gitlinks.push({ path: path58, baseCommit, branchCommit, rebasedCommit, action: "rebase_dropped_branch_commits" });
|
|
79309
|
+
return { converged: false, reason: "rebase_dropped_branch_commits", resolutions: [], gitlinks };
|
|
79310
|
+
}
|
|
79311
|
+
gitlinks.push({ path: path58, baseCommit, branchCommit, rebasedCommit, action: "rebased" });
|
|
79312
|
+
resolutions.push({ path: path58, baseCommit, branchCommit, rebasedCommit });
|
|
79313
|
+
}
|
|
79314
|
+
if (!sawDiverged) {
|
|
79315
|
+
const reason = sawUndeterminable ? "submodule_commit_unavailable" : "not_diverged";
|
|
79316
|
+
return { converged: false, reason, resolutions: [], gitlinks };
|
|
79317
|
+
}
|
|
79318
|
+
return { converged: resolutions.length > 0, resolutions, gitlinks };
|
|
79319
|
+
}
|
|
79320
|
+
function rootRebaseResolvingGitlinks(worktreeRoot, baseHead, resolutions) {
|
|
79321
|
+
const resolveByPath = new Map(resolutions.map((r) => [r.path, r.rebasedCommit]));
|
|
79322
|
+
const runRebase = (args) => {
|
|
79323
|
+
try {
|
|
79324
|
+
(0, import_node_child_process12.execFileSync)(GIT4, args, {
|
|
79325
|
+
cwd: worktreeRoot,
|
|
79326
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
79327
|
+
// A rebase editor prompt would hang; keep it non-interactive.
|
|
79328
|
+
env: { ...process.env, GIT_EDITOR: "true", GIT_SEQUENCE_EDITOR: "true" }
|
|
79329
|
+
});
|
|
79330
|
+
return { ok: true };
|
|
79331
|
+
} catch {
|
|
79332
|
+
return { ok: false };
|
|
79333
|
+
}
|
|
79334
|
+
};
|
|
79335
|
+
const unmergedPaths = () => {
|
|
79336
|
+
try {
|
|
79337
|
+
return (0, import_node_child_process12.execFileSync)(GIT4, ["diff", "--name-only", "--diff-filter=U"], { cwd: worktreeRoot, encoding: "utf8" }).split("\n").map((s2) => s2.trim()).filter(Boolean);
|
|
79338
|
+
} catch {
|
|
79339
|
+
return [];
|
|
79340
|
+
}
|
|
79341
|
+
};
|
|
79342
|
+
const abort = (reason, conflictPaths) => {
|
|
79343
|
+
try {
|
|
79344
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["rebase", "--abort"], { cwd: worktreeRoot, stdio: "ignore" });
|
|
79345
|
+
} catch {
|
|
79346
|
+
}
|
|
79347
|
+
return { ok: false, reason, conflictPaths };
|
|
79348
|
+
};
|
|
79349
|
+
let progress = runRebase(["rebase", baseHead]);
|
|
79350
|
+
let guard = 0;
|
|
79351
|
+
while (!progress.ok) {
|
|
79352
|
+
if (guard++ > 100) return abort("rebase_error");
|
|
79353
|
+
const conflicts = unmergedPaths();
|
|
79354
|
+
if (conflicts.length === 0) {
|
|
79355
|
+
return abort("rebase_error");
|
|
79356
|
+
}
|
|
79357
|
+
const unresolvable = conflicts.filter((p) => !resolveByPath.has(p));
|
|
79358
|
+
if (unresolvable.length > 0) {
|
|
79359
|
+
const unresolvableGitlink = unresolvable.some((p) => {
|
|
79360
|
+
try {
|
|
79361
|
+
const staged = (0, import_node_child_process12.execFileSync)(GIT4, ["ls-files", "--stage", "--", p], { cwd: worktreeRoot, encoding: "utf8" });
|
|
79362
|
+
return /^160000\s/m.test(staged);
|
|
79363
|
+
} catch {
|
|
79364
|
+
return false;
|
|
79365
|
+
}
|
|
79366
|
+
});
|
|
79367
|
+
const allGitlink = unresolvable.every((p) => {
|
|
79368
|
+
try {
|
|
79369
|
+
const staged = (0, import_node_child_process12.execFileSync)(GIT4, ["ls-files", "--stage", "--", p], { cwd: worktreeRoot, encoding: "utf8" });
|
|
79370
|
+
return /^160000\s/m.test(staged);
|
|
79371
|
+
} catch {
|
|
79372
|
+
return false;
|
|
79373
|
+
}
|
|
79374
|
+
});
|
|
79375
|
+
return abort(allGitlink && unresolvableGitlink ? "unexpected_gitlink" : "non_gitlink_conflict", conflicts);
|
|
79376
|
+
}
|
|
79377
|
+
for (const p of conflicts) {
|
|
79378
|
+
const commit = resolveByPath.get(p);
|
|
79379
|
+
try {
|
|
79380
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["checkout", "-q", "--detach", commit], { cwd: (0, import_path17.resolve)(worktreeRoot, p), stdio: "ignore" });
|
|
79381
|
+
} catch {
|
|
79382
|
+
}
|
|
79383
|
+
try {
|
|
79384
|
+
(0, import_node_child_process12.execFileSync)(GIT4, ["add", p], { cwd: worktreeRoot, stdio: "ignore" });
|
|
79385
|
+
} catch {
|
|
79386
|
+
return abort("rebase_error", conflicts);
|
|
79387
|
+
}
|
|
79388
|
+
}
|
|
79389
|
+
progress = runRebase(["rebase", "--continue"]);
|
|
79390
|
+
}
|
|
79391
|
+
let branchHead;
|
|
79392
|
+
try {
|
|
79393
|
+
branchHead = (0, import_node_child_process12.execFileSync)(GIT4, ["rev-parse", "HEAD"], { cwd: worktreeRoot, encoding: "utf8" }).trim();
|
|
79394
|
+
} catch {
|
|
79395
|
+
}
|
|
79396
|
+
return { ok: true, branchHead };
|
|
79397
|
+
}
|
|
79398
|
+
var fs49;
|
|
79399
|
+
var import_path17;
|
|
79400
|
+
var import_node_child_process12;
|
|
79401
|
+
var init_mesh_refine_submodule_converge = __esm2({
|
|
79402
|
+
"src/mesh/mesh-refine-submodule-converge.ts"() {
|
|
79403
|
+
"use strict";
|
|
79404
|
+
fs49 = __toESM2(require("fs"));
|
|
79405
|
+
import_path17 = require("path");
|
|
79406
|
+
import_node_child_process12 = require("child_process");
|
|
79407
|
+
init_mesh_refine_gitlink_utils();
|
|
79408
|
+
}
|
|
79409
|
+
});
|
|
79022
79410
|
function truncateValidationOutput(value) {
|
|
79023
79411
|
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
79024
79412
|
if (text.length <= REFINE_VALIDATION_SUMMARY_CHARS) return text;
|
|
@@ -79036,13 +79424,13 @@ ${tail}`;
|
|
|
79036
79424
|
}
|
|
79037
79425
|
function writeValidationFailureLog(workspace, index, candidate, streams, now = () => /* @__PURE__ */ new Date()) {
|
|
79038
79426
|
try {
|
|
79039
|
-
const dir = (0,
|
|
79040
|
-
|
|
79427
|
+
const dir = (0, import_path18.join)(workspace, REFINE_VALIDATION_LOG_DIR);
|
|
79428
|
+
fs50.mkdirSync(dir, { recursive: true });
|
|
79041
79429
|
const stamp = now().toISOString().replace(/[:.]/g, "-");
|
|
79042
|
-
const file2 = (0,
|
|
79430
|
+
const file2 = (0, import_path18.join)(dir, `refine-${stamp}-${index}.log`);
|
|
79043
79431
|
const asText = (v) => typeof v === "string" ? v : v == null ? "" : String(v);
|
|
79044
79432
|
const shown = candidate.displayCommand || [candidate.command, ...candidate.args || []].join(" ");
|
|
79045
|
-
|
|
79433
|
+
fs50.writeFileSync(
|
|
79046
79434
|
file2,
|
|
79047
79435
|
`# refine validation failure
|
|
79048
79436
|
# command: ${shown}
|
|
@@ -79116,18 +79504,18 @@ ${asText(streams.stderr)}
|
|
|
79116
79504
|
return { enabled: false };
|
|
79117
79505
|
}
|
|
79118
79506
|
async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
|
|
79119
|
-
const { execFileSync:
|
|
79507
|
+
const { execFileSync: execFileSync15 } = await import("child_process");
|
|
79120
79508
|
const diffArgs = ["diff", "--patch", "--full-index", fromRef, toRef];
|
|
79121
79509
|
if (excludePaths.length > 0) {
|
|
79122
79510
|
diffArgs.push("--", ".", ...excludePaths.map((path58) => `:(exclude)${path58}`));
|
|
79123
79511
|
}
|
|
79124
|
-
const diff =
|
|
79512
|
+
const diff = execFileSync15(GIT4, diffArgs, {
|
|
79125
79513
|
cwd,
|
|
79126
79514
|
encoding: "utf8",
|
|
79127
79515
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
79128
79516
|
});
|
|
79129
79517
|
if (!diff.trim()) return "";
|
|
79130
|
-
const patchId =
|
|
79518
|
+
const patchId = execFileSync15(GIT4, ["patch-id", "--stable"], {
|
|
79131
79519
|
cwd,
|
|
79132
79520
|
input: diff,
|
|
79133
79521
|
encoding: "utf8",
|
|
@@ -79138,8 +79526,8 @@ ${asText(streams.stderr)}
|
|
|
79138
79526
|
async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead) {
|
|
79139
79527
|
const startedAt = Date.now();
|
|
79140
79528
|
try {
|
|
79141
|
-
const { execFileSync:
|
|
79142
|
-
const git3 = (args) =>
|
|
79529
|
+
const { execFileSync: execFileSync15 } = await import("child_process");
|
|
79530
|
+
const git3 = (args) => execFileSync15(GIT4, args, {
|
|
79143
79531
|
cwd: repoRoot,
|
|
79144
79532
|
encoding: "utf8",
|
|
79145
79533
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -79240,7 +79628,7 @@ ${e?.stderr || ""}`
|
|
|
79240
79628
|
...autoPublish !== void 0 ? { autoPublishSubmoduleMainCommits: autoPublish } : {}
|
|
79241
79629
|
};
|
|
79242
79630
|
try {
|
|
79243
|
-
const git3 = (args) => (0,
|
|
79631
|
+
const git3 = (args) => (0, import_node_child_process13.execFileSync)(GIT4, args, {
|
|
79244
79632
|
cwd: repoRoot,
|
|
79245
79633
|
encoding: "utf8",
|
|
79246
79634
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES,
|
|
@@ -79294,7 +79682,7 @@ ${e?.stderr || ""}`
|
|
|
79294
79682
|
} catch {
|
|
79295
79683
|
continue;
|
|
79296
79684
|
}
|
|
79297
|
-
const submoduleRepo = (0,
|
|
79685
|
+
const submoduleRepo = (0, import_path18.join)(repoRoot, p);
|
|
79298
79686
|
let fastForward;
|
|
79299
79687
|
let reachableFromOriginMain;
|
|
79300
79688
|
if (branchCommit) {
|
|
@@ -79365,7 +79753,7 @@ ${e?.stderr || ""}`
|
|
|
79365
79753
|
}
|
|
79366
79754
|
function execGitOk(cwd, args) {
|
|
79367
79755
|
try {
|
|
79368
|
-
(0,
|
|
79756
|
+
(0, import_node_child_process13.execFileSync)(GIT4, args, { cwd, encoding: "utf8", maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES, windowsHide: true });
|
|
79369
79757
|
return true;
|
|
79370
79758
|
} catch {
|
|
79371
79759
|
return false;
|
|
@@ -79374,8 +79762,8 @@ ${e?.stderr || ""}`
|
|
|
79374
79762
|
async function checkWorktreeChangesPatchEquivalentInRef(repoRoot, ref, worktreeHead) {
|
|
79375
79763
|
const startedAt = Date.now();
|
|
79376
79764
|
try {
|
|
79377
|
-
const { execFileSync:
|
|
79378
|
-
const git3 = (gitArgs) =>
|
|
79765
|
+
const { execFileSync: execFileSync15 } = await import("child_process");
|
|
79766
|
+
const git3 = (gitArgs) => execFileSync15(GIT4, gitArgs, {
|
|
79379
79767
|
cwd: repoRoot,
|
|
79380
79768
|
encoding: "utf8",
|
|
79381
79769
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -79438,8 +79826,8 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79438
79826
|
async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
79439
79827
|
const startedAt = Date.now();
|
|
79440
79828
|
try {
|
|
79441
|
-
const { execFileSync:
|
|
79442
|
-
const git3 = (args, opts) =>
|
|
79829
|
+
const { execFileSync: execFileSync15 } = await import("child_process");
|
|
79830
|
+
const git3 = (args, opts) => execFileSync15(GIT4, args, {
|
|
79443
79831
|
cwd: opts?.cwd || repoRoot,
|
|
79444
79832
|
encoding: "utf8",
|
|
79445
79833
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -79513,45 +79901,8 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79513
79901
|
]
|
|
79514
79902
|
};
|
|
79515
79903
|
}
|
|
79516
|
-
function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
|
|
79517
|
-
try {
|
|
79518
|
-
const output = (0, import_node_child_process11.execFileSync)(GIT4, ["diff", "--raw", "--no-abbrev", fromRef, toRef], {
|
|
79519
|
-
cwd: repoRoot,
|
|
79520
|
-
encoding: "utf8",
|
|
79521
|
-
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
79522
|
-
});
|
|
79523
|
-
const paths = /* @__PURE__ */ new Set();
|
|
79524
|
-
for (const line of output.split("\n")) {
|
|
79525
|
-
if (!line.trim()) continue;
|
|
79526
|
-
const metaAndPath = line.split(" ");
|
|
79527
|
-
const meta3 = metaAndPath[0] || "";
|
|
79528
|
-
const path58 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
79529
|
-
if (!path58) continue;
|
|
79530
|
-
const parts = meta3.split(/\s+/);
|
|
79531
|
-
if (parts[0]?.includes("160000") || parts[1]?.includes("160000")) {
|
|
79532
|
-
paths.add(path58);
|
|
79533
|
-
}
|
|
79534
|
-
}
|
|
79535
|
-
return [...paths].sort();
|
|
79536
|
-
} catch {
|
|
79537
|
-
return [];
|
|
79538
|
-
}
|
|
79539
|
-
}
|
|
79540
|
-
function readTreeObject(repoRoot, ref, path58) {
|
|
79541
|
-
try {
|
|
79542
|
-
const output = (0, import_node_child_process11.execFileSync)(GIT4, ["ls-tree", ref, "--", path58], {
|
|
79543
|
-
cwd: repoRoot,
|
|
79544
|
-
encoding: "utf8",
|
|
79545
|
-
maxBuffer: 1024 * 1024
|
|
79546
|
-
}).trim();
|
|
79547
|
-
const match = output.match(/\bcommit\s+([0-9a-f]{40})\b/i);
|
|
79548
|
-
return match?.[1];
|
|
79549
|
-
} catch {
|
|
79550
|
-
return void 0;
|
|
79551
|
-
}
|
|
79552
|
-
}
|
|
79553
79904
|
function resolveGitDir(repoRoot) {
|
|
79554
|
-
const out = (0,
|
|
79905
|
+
const out = (0, import_node_child_process13.execFileSync)(GIT4, ["rev-parse", "--absolute-git-dir"], {
|
|
79555
79906
|
cwd: repoRoot,
|
|
79556
79907
|
encoding: "utf8",
|
|
79557
79908
|
maxBuffer: 1024 * 1024
|
|
@@ -79562,10 +79913,10 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79562
79913
|
if (!baseCommit || !branchCommit) return false;
|
|
79563
79914
|
if (baseCommit === branchCommit) return true;
|
|
79564
79915
|
try {
|
|
79565
|
-
if (!
|
|
79566
|
-
(0,
|
|
79567
|
-
(0,
|
|
79568
|
-
(0,
|
|
79916
|
+
if (!fs50.existsSync(submoduleRepoPath)) return false;
|
|
79917
|
+
(0, import_node_child_process13.execFileSync)(GIT4, ["cat-file", "-e", `${baseCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79918
|
+
(0, import_node_child_process13.execFileSync)(GIT4, ["cat-file", "-e", `${branchCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79919
|
+
(0, import_node_child_process13.execFileSync)(GIT4, ["merge-base", "--is-ancestor", baseCommit, branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79569
79920
|
return true;
|
|
79570
79921
|
} catch {
|
|
79571
79922
|
return false;
|
|
@@ -79573,7 +79924,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79573
79924
|
}
|
|
79574
79925
|
function readChangedPathKinds(repoRoot, fromRef, toRef) {
|
|
79575
79926
|
try {
|
|
79576
|
-
const output = (0,
|
|
79927
|
+
const output = (0, import_node_child_process13.execFileSync)(GIT4, ["diff", "--raw", "--no-abbrev", fromRef, toRef], {
|
|
79577
79928
|
cwd: repoRoot,
|
|
79578
79929
|
encoding: "utf8",
|
|
79579
79930
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -79601,7 +79952,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79601
79952
|
const baseCommit = readTreeObject(repoRoot, baseHead, path58);
|
|
79602
79953
|
const branchCommit = readTreeObject(repoRoot, branchHead, path58);
|
|
79603
79954
|
if (!baseCommit || !branchCommit) return false;
|
|
79604
|
-
return isSubmoduleFastForward((0,
|
|
79955
|
+
return isSubmoduleFastForward((0, import_path18.resolve)(repoRoot, path58), baseCommit, branchCommit);
|
|
79605
79956
|
});
|
|
79606
79957
|
}
|
|
79607
79958
|
function collectTrivialFastForwardGitlinkResolutions(worktreeRoot, baseRepoRoot, baseHead, branchHead) {
|
|
@@ -79610,8 +79961,8 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79610
79961
|
const baseCommit = readTreeObject(baseRepoRoot, baseHead, path58);
|
|
79611
79962
|
const branchCommit = readTreeObject(worktreeRoot, branchHead, path58);
|
|
79612
79963
|
if (!baseCommit || !branchCommit) continue;
|
|
79613
|
-
const submoduleRepoPath = (0,
|
|
79614
|
-
ensureSubmoduleCommitLocal(submoduleRepoPath, (0,
|
|
79964
|
+
const submoduleRepoPath = (0, import_path18.resolve)(worktreeRoot, path58);
|
|
79965
|
+
ensureSubmoduleCommitLocal(submoduleRepoPath, (0, import_path18.resolve)(baseRepoRoot, path58), baseCommit);
|
|
79615
79966
|
if (baseCommit === branchCommit) {
|
|
79616
79967
|
continue;
|
|
79617
79968
|
}
|
|
@@ -79623,254 +79974,11 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79623
79974
|
}
|
|
79624
79975
|
return resolutions;
|
|
79625
79976
|
}
|
|
79626
|
-
function isSubmoduleDivergedSibling(submoduleRepoPath, baseCommit, branchCommit) {
|
|
79627
|
-
if (!baseCommit || !branchCommit || baseCommit === branchCommit) return false;
|
|
79628
|
-
try {
|
|
79629
|
-
if (!fs48.existsSync(submoduleRepoPath)) return false;
|
|
79630
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["cat-file", "-e", `${baseCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79631
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["cat-file", "-e", `${branchCommit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79632
|
-
} catch {
|
|
79633
|
-
return false;
|
|
79634
|
-
}
|
|
79635
|
-
try {
|
|
79636
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["merge-base", "--is-ancestor", baseCommit, branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79637
|
-
return false;
|
|
79638
|
-
} catch {
|
|
79639
|
-
}
|
|
79640
|
-
try {
|
|
79641
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["merge-base", "--is-ancestor", branchCommit, baseCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79642
|
-
return false;
|
|
79643
|
-
} catch {
|
|
79644
|
-
}
|
|
79645
|
-
try {
|
|
79646
|
-
const mb = (0, import_node_child_process11.execFileSync)(GIT4, ["merge-base", baseCommit, branchCommit], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79647
|
-
return !!mb;
|
|
79648
|
-
} catch {
|
|
79649
|
-
return false;
|
|
79650
|
-
}
|
|
79651
|
-
}
|
|
79652
|
-
function resolveSubmoduleRemoteMainRef(submoduleRepoPath) {
|
|
79653
|
-
try {
|
|
79654
|
-
const sym = (0, import_node_child_process11.execFileSync)(GIT4, ["symbolic-ref", "-q", "refs/remotes/origin/HEAD"], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79655
|
-
if (sym) return sym;
|
|
79656
|
-
} catch {
|
|
79657
|
-
}
|
|
79658
|
-
for (const branch of ["main", "master"]) {
|
|
79659
|
-
try {
|
|
79660
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["rev-parse", "--verify", "-q", `refs/remotes/origin/${branch}`], { cwd: submoduleRepoPath, stdio: ["ignore", "pipe", "pipe"] });
|
|
79661
|
-
return `refs/remotes/origin/${branch}`;
|
|
79662
|
-
} catch {
|
|
79663
|
-
}
|
|
79664
|
-
}
|
|
79665
|
-
return void 0;
|
|
79666
|
-
}
|
|
79667
|
-
function findEquivalentPublishedSubmoduleCommit(submoduleRepoPath, baseCommit, branchCommit, remoteRef) {
|
|
79668
|
-
try {
|
|
79669
|
-
const mergeTreeOut = (0, import_node_child_process11.execFileSync)(GIT4, ["merge-tree", "--write-tree", baseCommit, branchCommit], {
|
|
79670
|
-
cwd: submoduleRepoPath,
|
|
79671
|
-
encoding: "utf8",
|
|
79672
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
79673
|
-
});
|
|
79674
|
-
const mergedTree = mergeTreeOut.trim().split(/\s+/)[0] || "";
|
|
79675
|
-
if (!mergedTree) return void 0;
|
|
79676
|
-
const candidates = (0, import_node_child_process11.execFileSync)(GIT4, ["rev-list", "--max-count=100", remoteRef, "--not", baseCommit], {
|
|
79677
|
-
cwd: submoduleRepoPath,
|
|
79678
|
-
encoding: "utf8"
|
|
79679
|
-
}).split("\n").map((s2) => s2.trim()).filter(Boolean);
|
|
79680
|
-
for (const candidate of candidates) {
|
|
79681
|
-
try {
|
|
79682
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["merge-base", "--is-ancestor", baseCommit, candidate], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79683
|
-
} catch {
|
|
79684
|
-
continue;
|
|
79685
|
-
}
|
|
79686
|
-
const tree = (0, import_node_child_process11.execFileSync)(GIT4, ["rev-parse", `${candidate}^{tree}`], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79687
|
-
if (tree === mergedTree) return candidate;
|
|
79688
|
-
}
|
|
79689
|
-
} catch {
|
|
79690
|
-
}
|
|
79691
|
-
return void 0;
|
|
79692
|
-
}
|
|
79693
|
-
function ensureSubmoduleCommitLocal(submoduleRepoPath, baseSubmoduleRepoPath, commit) {
|
|
79694
|
-
if (!commit) return;
|
|
79695
|
-
try {
|
|
79696
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["cat-file", "-e", `${commit}^{commit}`], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79697
|
-
return;
|
|
79698
|
-
} catch {
|
|
79699
|
-
}
|
|
79700
|
-
try {
|
|
79701
|
-
if (!fs48.existsSync(submoduleRepoPath) || !fs48.existsSync(baseSubmoduleRepoPath)) return;
|
|
79702
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["-c", "protocol.file.allow=always", "fetch", "-q", baseSubmoduleRepoPath, "+refs/heads/*:refs/adhdev-refine-base/*"], {
|
|
79703
|
-
cwd: submoduleRepoPath,
|
|
79704
|
-
stdio: ["ignore", "ignore", "pipe"]
|
|
79705
|
-
});
|
|
79706
|
-
} catch {
|
|
79707
|
-
}
|
|
79708
|
-
}
|
|
79709
|
-
function convergeDivergedSubmoduleGitlinks(worktreeRoot, baseRepoRoot, baseHead, branchHead) {
|
|
79710
|
-
const changed = readChangedGitlinkPaths(worktreeRoot, baseHead, branchHead);
|
|
79711
|
-
if (changed.length === 0) {
|
|
79712
|
-
return { converged: false, reason: "no_changed_gitlinks", resolutions: [], gitlinks: [] };
|
|
79713
|
-
}
|
|
79714
|
-
const gitlinks = [];
|
|
79715
|
-
const resolutions = [];
|
|
79716
|
-
let sawDiverged = false;
|
|
79717
|
-
for (const path58 of changed) {
|
|
79718
|
-
const baseCommit = readTreeObject(baseRepoRoot, baseHead, path58);
|
|
79719
|
-
const branchCommit = readTreeObject(worktreeRoot, branchHead, path58);
|
|
79720
|
-
const submoduleRepoPath = (0, import_path17.resolve)(worktreeRoot, path58);
|
|
79721
|
-
if (baseCommit) {
|
|
79722
|
-
ensureSubmoduleCommitLocal(submoduleRepoPath, (0, import_path17.resolve)(baseRepoRoot, path58), baseCommit);
|
|
79723
|
-
}
|
|
79724
|
-
if (!baseCommit || !branchCommit || !isSubmoduleDivergedSibling(submoduleRepoPath, baseCommit, branchCommit)) {
|
|
79725
|
-
gitlinks.push({ path: path58, baseCommit, branchCommit, action: "skipped_not_diverged" });
|
|
79726
|
-
continue;
|
|
79727
|
-
}
|
|
79728
|
-
sawDiverged = true;
|
|
79729
|
-
try {
|
|
79730
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["-c", "protocol.file.allow=always", "fetch", "-q", "origin"], { cwd: submoduleRepoPath, stdio: ["ignore", "ignore", "pipe"] });
|
|
79731
|
-
} catch {
|
|
79732
|
-
}
|
|
79733
|
-
const remoteMainRef = resolveSubmoduleRemoteMainRef(submoduleRepoPath);
|
|
79734
|
-
const publishedEquivalent = remoteMainRef ? findEquivalentPublishedSubmoduleCommit(submoduleRepoPath, baseCommit, branchCommit, remoteMainRef) : void 0;
|
|
79735
|
-
if (publishedEquivalent) {
|
|
79736
|
-
try {
|
|
79737
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["checkout", "-q", "--detach", publishedEquivalent], { cwd: submoduleRepoPath, stdio: ["ignore", "ignore", "pipe"] });
|
|
79738
|
-
} catch {
|
|
79739
|
-
}
|
|
79740
|
-
gitlinks.push({ path: path58, baseCommit, branchCommit, rebasedCommit: publishedEquivalent, action: "converged_to_published" });
|
|
79741
|
-
resolutions.push({ path: path58, baseCommit, branchCommit, rebasedCommit: publishedEquivalent });
|
|
79742
|
-
continue;
|
|
79743
|
-
}
|
|
79744
|
-
let rebasedCommit;
|
|
79745
|
-
try {
|
|
79746
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["checkout", "-q", "--detach", branchCommit], { cwd: submoduleRepoPath, stdio: ["ignore", "ignore", "pipe"] });
|
|
79747
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["rebase", baseCommit], { cwd: submoduleRepoPath, stdio: ["ignore", "pipe", "pipe"] });
|
|
79748
|
-
rebasedCommit = (0, import_node_child_process11.execFileSync)(GIT4, ["rev-parse", "HEAD"], { cwd: submoduleRepoPath, encoding: "utf8" }).trim();
|
|
79749
|
-
} catch {
|
|
79750
|
-
try {
|
|
79751
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["rebase", "--abort"], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79752
|
-
} catch {
|
|
79753
|
-
}
|
|
79754
|
-
try {
|
|
79755
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["checkout", "-q", "--detach", branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79756
|
-
} catch {
|
|
79757
|
-
}
|
|
79758
|
-
gitlinks.push({ path: path58, baseCommit, branchCommit, action: "rebase_conflict" });
|
|
79759
|
-
return { converged: false, reason: "rebase_conflict", resolutions: [], gitlinks };
|
|
79760
|
-
}
|
|
79761
|
-
const branchWorkSurvived = (() => {
|
|
79762
|
-
if (!rebasedCommit) return false;
|
|
79763
|
-
if (rebasedCommit === branchCommit) return true;
|
|
79764
|
-
if (rebasedCommit === baseCommit) return false;
|
|
79765
|
-
try {
|
|
79766
|
-
const replayed = (0, import_node_child_process11.execFileSync)(GIT4, ["rev-list", "--count", `${baseCommit}..${rebasedCommit}`], {
|
|
79767
|
-
cwd: submoduleRepoPath,
|
|
79768
|
-
encoding: "utf8"
|
|
79769
|
-
}).trim();
|
|
79770
|
-
return Number.parseInt(replayed, 10) > 0;
|
|
79771
|
-
} catch {
|
|
79772
|
-
return false;
|
|
79773
|
-
}
|
|
79774
|
-
})();
|
|
79775
|
-
if (!branchWorkSurvived) {
|
|
79776
|
-
try {
|
|
79777
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["checkout", "-q", "--detach", branchCommit], { cwd: submoduleRepoPath, stdio: "ignore" });
|
|
79778
|
-
} catch {
|
|
79779
|
-
}
|
|
79780
|
-
gitlinks.push({ path: path58, baseCommit, branchCommit, rebasedCommit, action: "rebase_dropped_branch_commits" });
|
|
79781
|
-
return { converged: false, reason: "rebase_dropped_branch_commits", resolutions: [], gitlinks };
|
|
79782
|
-
}
|
|
79783
|
-
gitlinks.push({ path: path58, baseCommit, branchCommit, rebasedCommit, action: "rebased" });
|
|
79784
|
-
resolutions.push({ path: path58, baseCommit, branchCommit, rebasedCommit });
|
|
79785
|
-
}
|
|
79786
|
-
if (!sawDiverged) {
|
|
79787
|
-
return { converged: false, reason: "not_diverged", resolutions: [], gitlinks };
|
|
79788
|
-
}
|
|
79789
|
-
return { converged: resolutions.length > 0, resolutions, gitlinks };
|
|
79790
|
-
}
|
|
79791
|
-
function rootRebaseResolvingGitlinks(worktreeRoot, baseHead, resolutions) {
|
|
79792
|
-
const resolveByPath = new Map(resolutions.map((r) => [r.path, r.rebasedCommit]));
|
|
79793
|
-
const runRebase = (args) => {
|
|
79794
|
-
try {
|
|
79795
|
-
(0, import_node_child_process11.execFileSync)(GIT4, args, {
|
|
79796
|
-
cwd: worktreeRoot,
|
|
79797
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
79798
|
-
// A rebase editor prompt would hang; keep it non-interactive.
|
|
79799
|
-
env: { ...process.env, GIT_EDITOR: "true", GIT_SEQUENCE_EDITOR: "true" }
|
|
79800
|
-
});
|
|
79801
|
-
return { ok: true };
|
|
79802
|
-
} catch {
|
|
79803
|
-
return { ok: false };
|
|
79804
|
-
}
|
|
79805
|
-
};
|
|
79806
|
-
const unmergedPaths = () => {
|
|
79807
|
-
try {
|
|
79808
|
-
return (0, import_node_child_process11.execFileSync)(GIT4, ["diff", "--name-only", "--diff-filter=U"], { cwd: worktreeRoot, encoding: "utf8" }).split("\n").map((s2) => s2.trim()).filter(Boolean);
|
|
79809
|
-
} catch {
|
|
79810
|
-
return [];
|
|
79811
|
-
}
|
|
79812
|
-
};
|
|
79813
|
-
const abort = (reason, conflictPaths) => {
|
|
79814
|
-
try {
|
|
79815
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["rebase", "--abort"], { cwd: worktreeRoot, stdio: "ignore" });
|
|
79816
|
-
} catch {
|
|
79817
|
-
}
|
|
79818
|
-
return { ok: false, reason, conflictPaths };
|
|
79819
|
-
};
|
|
79820
|
-
let progress = runRebase(["rebase", baseHead]);
|
|
79821
|
-
let guard = 0;
|
|
79822
|
-
while (!progress.ok) {
|
|
79823
|
-
if (guard++ > 100) return abort("rebase_error");
|
|
79824
|
-
const conflicts = unmergedPaths();
|
|
79825
|
-
if (conflicts.length === 0) {
|
|
79826
|
-
return abort("rebase_error");
|
|
79827
|
-
}
|
|
79828
|
-
const unresolvable = conflicts.filter((p) => !resolveByPath.has(p));
|
|
79829
|
-
if (unresolvable.length > 0) {
|
|
79830
|
-
const unresolvableGitlink = unresolvable.some((p) => {
|
|
79831
|
-
try {
|
|
79832
|
-
const staged = (0, import_node_child_process11.execFileSync)(GIT4, ["ls-files", "--stage", "--", p], { cwd: worktreeRoot, encoding: "utf8" });
|
|
79833
|
-
return /^160000\s/m.test(staged);
|
|
79834
|
-
} catch {
|
|
79835
|
-
return false;
|
|
79836
|
-
}
|
|
79837
|
-
});
|
|
79838
|
-
const allGitlink = unresolvable.every((p) => {
|
|
79839
|
-
try {
|
|
79840
|
-
const staged = (0, import_node_child_process11.execFileSync)(GIT4, ["ls-files", "--stage", "--", p], { cwd: worktreeRoot, encoding: "utf8" });
|
|
79841
|
-
return /^160000\s/m.test(staged);
|
|
79842
|
-
} catch {
|
|
79843
|
-
return false;
|
|
79844
|
-
}
|
|
79845
|
-
});
|
|
79846
|
-
return abort(allGitlink && unresolvableGitlink ? "unexpected_gitlink" : "non_gitlink_conflict", conflicts);
|
|
79847
|
-
}
|
|
79848
|
-
for (const p of conflicts) {
|
|
79849
|
-
const commit = resolveByPath.get(p);
|
|
79850
|
-
try {
|
|
79851
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["checkout", "-q", "--detach", commit], { cwd: (0, import_path17.resolve)(worktreeRoot, p), stdio: "ignore" });
|
|
79852
|
-
} catch {
|
|
79853
|
-
}
|
|
79854
|
-
try {
|
|
79855
|
-
(0, import_node_child_process11.execFileSync)(GIT4, ["add", p], { cwd: worktreeRoot, stdio: "ignore" });
|
|
79856
|
-
} catch {
|
|
79857
|
-
return abort("rebase_error", conflicts);
|
|
79858
|
-
}
|
|
79859
|
-
}
|
|
79860
|
-
progress = runRebase(["rebase", "--continue"]);
|
|
79861
|
-
}
|
|
79862
|
-
let branchHead;
|
|
79863
|
-
try {
|
|
79864
|
-
branchHead = (0, import_node_child_process11.execFileSync)(GIT4, ["rev-parse", "HEAD"], { cwd: worktreeRoot, encoding: "utf8" }).trim();
|
|
79865
|
-
} catch {
|
|
79866
|
-
}
|
|
79867
|
-
return { ok: true, branchHead };
|
|
79868
|
-
}
|
|
79869
79977
|
function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
|
|
79870
79978
|
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path58) => {
|
|
79871
79979
|
const baseCommit = readTreeObject(repoRoot, baseHead, path58);
|
|
79872
79980
|
const branchCommit = readTreeObject(repoRoot, branchHead, path58);
|
|
79873
|
-
const submoduleRepoPath = (0,
|
|
79981
|
+
const submoduleRepoPath = (0, import_path18.resolve)(repoRoot, path58);
|
|
79874
79982
|
const fastForward = !!baseCommit && !!branchCommit && isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit);
|
|
79875
79983
|
return { path: path58, baseCommit, branchCommit, fastForward };
|
|
79876
79984
|
});
|
|
@@ -79887,7 +79995,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79887
79995
|
}
|
|
79888
79996
|
let mergeBase = "";
|
|
79889
79997
|
try {
|
|
79890
|
-
mergeBase = (0,
|
|
79998
|
+
mergeBase = (0, import_node_child_process13.execFileSync)(GIT4, ["merge-base", baseHead, branchHead], {
|
|
79891
79999
|
cwd: repoRoot,
|
|
79892
80000
|
encoding: "utf8",
|
|
79893
80001
|
maxBuffer: 1024 * 1024
|
|
@@ -79917,7 +80025,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79917
80025
|
}
|
|
79918
80026
|
function buildTreeWithGitlinksEqualized(repoRoot, commitish, paths, placeholderCommit) {
|
|
79919
80027
|
try {
|
|
79920
|
-
const tree = (0,
|
|
80028
|
+
const tree = (0, import_node_child_process13.execFileSync)(GIT4, ["rev-parse", `${commitish}^{tree}`], {
|
|
79921
80029
|
cwd: repoRoot,
|
|
79922
80030
|
encoding: "utf8",
|
|
79923
80031
|
maxBuffer: 1024 * 1024
|
|
@@ -79925,11 +80033,11 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79925
80033
|
if (!tree) return void 0;
|
|
79926
80034
|
const updates = paths.map((path58) => `160000 commit ${placeholderCommit} ${path58}`).join("\n");
|
|
79927
80035
|
if (!updates) return tree;
|
|
79928
|
-
const tmpIndex = (0,
|
|
80036
|
+
const tmpIndex = (0, import_path18.join)(resolveGitDir(repoRoot), `adhdev-refine-eq-${commitish.slice(0, 12)}.index`);
|
|
79929
80037
|
const env2 = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
79930
80038
|
try {
|
|
79931
|
-
(0,
|
|
79932
|
-
(0,
|
|
80039
|
+
(0, import_node_child_process13.execFileSync)(GIT4, ["read-tree", tree], { cwd: repoRoot, env: env2, stdio: "ignore" });
|
|
80040
|
+
(0, import_node_child_process13.execFileSync)(GIT4, ["update-index", "--index-info"], {
|
|
79933
80041
|
cwd: repoRoot,
|
|
79934
80042
|
env: env2,
|
|
79935
80043
|
input: `${updates}
|
|
@@ -79937,11 +80045,11 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79937
80045
|
encoding: "utf8",
|
|
79938
80046
|
stdio: ["pipe", "ignore", "ignore"]
|
|
79939
80047
|
});
|
|
79940
|
-
const newTree = (0,
|
|
80048
|
+
const newTree = (0, import_node_child_process13.execFileSync)(GIT4, ["write-tree"], { cwd: repoRoot, env: env2, encoding: "utf8" }).trim();
|
|
79941
80049
|
return newTree || void 0;
|
|
79942
80050
|
} finally {
|
|
79943
80051
|
try {
|
|
79944
|
-
|
|
80052
|
+
fs50.rmSync(tmpIndex, { force: true });
|
|
79945
80053
|
} catch {
|
|
79946
80054
|
}
|
|
79947
80055
|
}
|
|
@@ -79953,7 +80061,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79953
80061
|
try {
|
|
79954
80062
|
const branchGitlinks = gitlinks.filter((entry) => entry.branchCommit);
|
|
79955
80063
|
const gitlinkPaths = branchGitlinks.map((entry) => entry.path);
|
|
79956
|
-
const mergeBase = (0,
|
|
80064
|
+
const mergeBase = (0, import_node_child_process13.execFileSync)(GIT4, ["merge-base", baseHead, branchHead], {
|
|
79957
80065
|
cwd: repoRoot,
|
|
79958
80066
|
encoding: "utf8",
|
|
79959
80067
|
maxBuffer: 1024 * 1024
|
|
@@ -79966,22 +80074,22 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79966
80074
|
const theirsEqTree = buildTreeWithGitlinksEqualized(repoRoot, branchHead, gitlinkPaths, placeholder);
|
|
79967
80075
|
if (baseEqTree && oursEqTree && theirsEqTree) {
|
|
79968
80076
|
try {
|
|
79969
|
-
const baseEqCommit = (0,
|
|
80077
|
+
const baseEqCommit = (0, import_node_child_process13.execFileSync)(GIT4, ["commit-tree", baseEqTree, "-m", "refine-ff-base"], {
|
|
79970
80078
|
cwd: repoRoot,
|
|
79971
80079
|
encoding: "utf8",
|
|
79972
80080
|
maxBuffer: 1024 * 1024
|
|
79973
80081
|
}).trim();
|
|
79974
|
-
const oursEqCommit = (0,
|
|
80082
|
+
const oursEqCommit = (0, import_node_child_process13.execFileSync)(GIT4, ["commit-tree", oursEqTree, "-p", baseEqCommit, "-m", "refine-ff-ours"], {
|
|
79975
80083
|
cwd: repoRoot,
|
|
79976
80084
|
encoding: "utf8",
|
|
79977
80085
|
maxBuffer: 1024 * 1024
|
|
79978
80086
|
}).trim();
|
|
79979
|
-
const theirsEqCommit = (0,
|
|
80087
|
+
const theirsEqCommit = (0, import_node_child_process13.execFileSync)(GIT4, ["commit-tree", theirsEqTree, "-p", baseEqCommit, "-m", "refine-ff-theirs"], {
|
|
79980
80088
|
cwd: repoRoot,
|
|
79981
80089
|
encoding: "utf8",
|
|
79982
80090
|
maxBuffer: 1024 * 1024
|
|
79983
80091
|
}).trim();
|
|
79984
|
-
const mergeOut = (0,
|
|
80092
|
+
const mergeOut = (0, import_node_child_process13.execFileSync)(GIT4, ["merge-tree", "--write-tree", oursEqCommit, theirsEqCommit], {
|
|
79985
80093
|
cwd: repoRoot,
|
|
79986
80094
|
encoding: "utf8",
|
|
79987
80095
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -79992,7 +80100,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
79992
80100
|
}
|
|
79993
80101
|
}
|
|
79994
80102
|
}
|
|
79995
|
-
const contentTree = mergedContentTree || (0,
|
|
80103
|
+
const contentTree = mergedContentTree || (0, import_node_child_process13.execFileSync)(GIT4, ["rev-parse", `${baseHead}^{tree}`], {
|
|
79996
80104
|
cwd: repoRoot,
|
|
79997
80105
|
encoding: "utf8",
|
|
79998
80106
|
maxBuffer: 1024 * 1024
|
|
@@ -80000,11 +80108,11 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80000
80108
|
if (!contentTree) return void 0;
|
|
80001
80109
|
const updates = branchGitlinks.map((entry) => `160000 commit ${entry.branchCommit} ${entry.path}`).join("\n");
|
|
80002
80110
|
if (!updates) return contentTree;
|
|
80003
|
-
const tmpIndex = (0,
|
|
80111
|
+
const tmpIndex = (0, import_path18.join)(resolveGitDir(repoRoot), `adhdev-refine-ff-${baseHead.slice(0, 12)}-${branchHead.slice(0, 12)}.index`);
|
|
80004
80112
|
const env2 = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
80005
80113
|
try {
|
|
80006
|
-
(0,
|
|
80007
|
-
(0,
|
|
80114
|
+
(0, import_node_child_process13.execFileSync)(GIT4, ["read-tree", contentTree], { cwd: repoRoot, env: env2, stdio: "ignore" });
|
|
80115
|
+
(0, import_node_child_process13.execFileSync)(GIT4, ["update-index", "--index-info"], {
|
|
80008
80116
|
cwd: repoRoot,
|
|
80009
80117
|
env: env2,
|
|
80010
80118
|
input: `${updates}
|
|
@@ -80012,11 +80120,11 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80012
80120
|
encoding: "utf8",
|
|
80013
80121
|
stdio: ["pipe", "ignore", "ignore"]
|
|
80014
80122
|
});
|
|
80015
|
-
const newTree = (0,
|
|
80123
|
+
const newTree = (0, import_node_child_process13.execFileSync)(GIT4, ["write-tree"], { cwd: repoRoot, env: env2, encoding: "utf8" }).trim();
|
|
80016
80124
|
return newTree || void 0;
|
|
80017
80125
|
} finally {
|
|
80018
80126
|
try {
|
|
80019
|
-
|
|
80127
|
+
fs50.rmSync(tmpIndex, { force: true });
|
|
80020
80128
|
} catch {
|
|
80021
80129
|
}
|
|
80022
80130
|
}
|
|
@@ -80128,7 +80236,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80128
80236
|
return { stdout: String(stdout || ""), stderr: String(stderr || ""), refspec };
|
|
80129
80237
|
};
|
|
80130
80238
|
const importCommitFromWorktreeSubmodule = async (submodulePath, worktreeSubmodulePath, commit) => {
|
|
80131
|
-
if (!
|
|
80239
|
+
if (!fs50.existsSync(worktreeSubmodulePath)) return false;
|
|
80132
80240
|
try {
|
|
80133
80241
|
await runGit3(worktreeSubmodulePath, ["cat-file", "-e", `${commit}^{commit}`]);
|
|
80134
80242
|
} catch {
|
|
@@ -80157,7 +80265,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80157
80265
|
return match ? { commit: match[1], path: match[2] } : null;
|
|
80158
80266
|
}).filter((entry) => !!entry);
|
|
80159
80267
|
for (const gitlink of gitlinks) {
|
|
80160
|
-
const submodulePath = (0,
|
|
80268
|
+
const submodulePath = (0, import_path18.resolve)(repoRoot, gitlink.path);
|
|
80161
80269
|
const entry = {
|
|
80162
80270
|
path: gitlink.path,
|
|
80163
80271
|
commit: gitlink.commit,
|
|
@@ -80165,7 +80273,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80165
80273
|
};
|
|
80166
80274
|
let submoduleDefaultBranch = "main";
|
|
80167
80275
|
try {
|
|
80168
|
-
if (!
|
|
80276
|
+
if (!fs50.existsSync(submodulePath)) {
|
|
80169
80277
|
entry.error = `Submodule checkout missing at ${gitlink.path}`;
|
|
80170
80278
|
entry.publishRequired = true;
|
|
80171
80279
|
if (options.allowAutoPublishSubmoduleMainCommits === true) {
|
|
@@ -80184,7 +80292,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80184
80292
|
entry.localReachable = false;
|
|
80185
80293
|
if (options.allowAutoPublishSubmoduleMainCommits === true && options.worktreeRoot) {
|
|
80186
80294
|
try {
|
|
80187
|
-
const imported = await importCommitFromWorktreeSubmodule(submodulePath, (0,
|
|
80295
|
+
const imported = await importCommitFromWorktreeSubmodule(submodulePath, (0, import_path18.resolve)(options.worktreeRoot, gitlink.path), gitlink.commit);
|
|
80188
80296
|
if (imported) {
|
|
80189
80297
|
entry.localReachable = true;
|
|
80190
80298
|
entry.importedFromWorktree = true;
|
|
@@ -80414,13 +80522,13 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80414
80522
|
...extras
|
|
80415
80523
|
});
|
|
80416
80524
|
const isPackageManagerValidation = (candidate) => {
|
|
80417
|
-
const command = (0,
|
|
80525
|
+
const command = (0, import_path18.basename)(candidate.command).replace(/\.(?:cmd|exe)$/i, "");
|
|
80418
80526
|
return ["npm", "pnpm", "yarn", "bun"].includes(command) && candidate.args.some((arg) => arg === "run" || arg === "test" || arg === "exec");
|
|
80419
80527
|
};
|
|
80420
80528
|
const dependenciesLikelyMissing = (cwd) => {
|
|
80421
|
-
if (!
|
|
80422
|
-
if (
|
|
80423
|
-
return ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock"].some((lock) =>
|
|
80529
|
+
if (!fs50.existsSync((0, import_path18.join)(cwd, "package.json"))) return false;
|
|
80530
|
+
if (fs50.existsSync((0, import_path18.join)(cwd, "node_modules"))) return false;
|
|
80531
|
+
return ["package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock"].some((lock) => fs50.existsSync((0, import_path18.join)(cwd, lock)));
|
|
80424
80532
|
};
|
|
80425
80533
|
const needsNodeModules = (candidate, cwd) => isPackageManagerValidation(candidate) && dependenciesLikelyMissing(cwd);
|
|
80426
80534
|
const isDaemonScopedCommand = (candidate) => {
|
|
@@ -80487,7 +80595,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80487
80595
|
summary.bootstrap = { stage: "legacy" };
|
|
80488
80596
|
for (const candidate of selection.bootstrapCommands) {
|
|
80489
80597
|
const startedAt = Date.now();
|
|
80490
|
-
const cwd = candidate.cwd ? (0,
|
|
80598
|
+
const cwd = candidate.cwd ? (0, import_path18.resolve)(workspace, candidate.cwd) : workspace;
|
|
80491
80599
|
const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
|
|
80492
80600
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
80493
80601
|
const spawn7 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
@@ -80520,7 +80628,7 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80520
80628
|
let missingDepsBlocked = false;
|
|
80521
80629
|
for (const candidate of commandsToRun) {
|
|
80522
80630
|
const startedAt = Date.now();
|
|
80523
|
-
const cwd = candidate.cwd ? (0,
|
|
80631
|
+
const cwd = candidate.cwd ? (0, import_path18.resolve)(workspace, candidate.cwd) : workspace;
|
|
80524
80632
|
const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
|
|
80525
80633
|
const bootstrapProvidedDependencies = summary.bootstrap?.stage === "cached" || summary.bootstrap?.stage === "ran" || summary.bootstrap?.stage === "legacy";
|
|
80526
80634
|
if (!bootstrapProvidedDependencies && needsNodeModules(candidate, cwd)) {
|
|
@@ -80587,16 +80695,14 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80587
80695
|
summary.status = "passed";
|
|
80588
80696
|
return summary;
|
|
80589
80697
|
}
|
|
80590
|
-
var
|
|
80591
|
-
var
|
|
80592
|
-
var
|
|
80593
|
-
var GIT4;
|
|
80698
|
+
var import_path18;
|
|
80699
|
+
var fs50;
|
|
80700
|
+
var import_node_child_process13;
|
|
80594
80701
|
var REFINE_VALIDATION_TIMEOUT_MS;
|
|
80595
80702
|
var REFINE_VALIDATION_OUTPUT_LIMIT_BYTES;
|
|
80596
80703
|
var REFINE_VALIDATION_SUMMARY_HEAD_CHARS;
|
|
80597
80704
|
var REFINE_VALIDATION_SUMMARY_TAIL_CHARS;
|
|
80598
80705
|
var REFINE_VALIDATION_SUMMARY_CHARS;
|
|
80599
|
-
var REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES;
|
|
80600
80706
|
var REFINE_VALIDATION_LOG_DIR;
|
|
80601
80707
|
var init_mesh_refine_gates = __esm2({
|
|
80602
80708
|
"src/mesh/mesh-refine-gates.ts"() {
|
|
@@ -80604,19 +80710,19 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
80604
80710
|
init_git_status();
|
|
80605
80711
|
init_refine_config();
|
|
80606
80712
|
init_worktree_bootstrap_config();
|
|
80607
|
-
|
|
80608
|
-
|
|
80609
|
-
|
|
80713
|
+
import_path18 = require("path");
|
|
80714
|
+
fs50 = __toESM2(require("fs"));
|
|
80715
|
+
import_node_child_process13 = require("child_process");
|
|
80610
80716
|
init_resolve_executable();
|
|
80611
80717
|
init_mesh_refine_worker_cap();
|
|
80612
|
-
|
|
80718
|
+
init_mesh_refine_gitlink_utils();
|
|
80719
|
+
init_mesh_refine_submodule_converge();
|
|
80613
80720
|
REFINE_VALIDATION_TIMEOUT_MS = 12e4;
|
|
80614
80721
|
REFINE_VALIDATION_OUTPUT_LIMIT_BYTES = 128 * 1024;
|
|
80615
80722
|
REFINE_VALIDATION_SUMMARY_HEAD_CHARS = 2e3;
|
|
80616
80723
|
REFINE_VALIDATION_SUMMARY_TAIL_CHARS = 6e3;
|
|
80617
80724
|
REFINE_VALIDATION_SUMMARY_CHARS = REFINE_VALIDATION_SUMMARY_HEAD_CHARS + REFINE_VALIDATION_SUMMARY_TAIL_CHARS;
|
|
80618
|
-
|
|
80619
|
-
REFINE_VALIDATION_LOG_DIR = (0, import_path17.join)(".adhdev", "logs");
|
|
80725
|
+
REFINE_VALIDATION_LOG_DIR = (0, import_path18.join)(".adhdev", "logs");
|
|
80620
80726
|
}
|
|
80621
80727
|
});
|
|
80622
80728
|
function findOpenRefineDispatchForNode(args) {
|
|
@@ -81303,6 +81409,9 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
81303
81409
|
convergeReason: converge.reason,
|
|
81304
81410
|
gitlinks: converge.gitlinks
|
|
81305
81411
|
});
|
|
81412
|
+
if (converge.reason === "submodule_commit_unavailable") {
|
|
81413
|
+
LOG2.warn("Mesh", `[Refinery] Could NOT determine submodule gitlink divergence for node ${node.id} \u2014 a gitlink commit is missing from the local submodule object store (auto-converge could not run): ` + converge.gitlinks.filter((g) => g.action === "skipped_commit_unavailable").map((g) => `${g.path} (missing: ${(g.unavailable || []).join("+") || "unknown"}; base=${(g.baseCommit || "?").slice(0, 12)} branch=${(g.branchCommit || "?").slice(0, 12)})`).join(", "));
|
|
81414
|
+
}
|
|
81306
81415
|
recordMeshRefineStage(refineStages, "sync_base", "passed", syncStarted, {
|
|
81307
81416
|
ahead: divergence.ahead,
|
|
81308
81417
|
behind: divergence.behind,
|
|
@@ -81345,12 +81454,12 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
81345
81454
|
throw err;
|
|
81346
81455
|
}
|
|
81347
81456
|
} else {
|
|
81348
|
-
(0,
|
|
81457
|
+
(0, import_node_child_process14.execFileSync)("git", ["rebase", baseHead], { cwd: node.workspace, stdio: ["ignore", "pipe", "pipe"] });
|
|
81349
81458
|
}
|
|
81350
81459
|
} catch (rebaseErr) {
|
|
81351
81460
|
if (!rebaseErr?.alreadyAborted) {
|
|
81352
81461
|
try {
|
|
81353
|
-
(0,
|
|
81462
|
+
(0, import_node_child_process14.execFileSync)("git", ["rebase", "--abort"], { cwd: node.workspace, stdio: "ignore" });
|
|
81354
81463
|
} catch {
|
|
81355
81464
|
}
|
|
81356
81465
|
}
|
|
@@ -82804,7 +82913,7 @@ ${e?.stderr || ""}`;
|
|
|
82804
82913
|
if (!repoRoot || !workspace) return;
|
|
82805
82914
|
const branch = typeof node?.worktreeBranch === "string" && node.worktreeBranch.trim() ? node.worktreeBranch.trim() : (() => {
|
|
82806
82915
|
try {
|
|
82807
|
-
return (0,
|
|
82916
|
+
return (0, import_node_child_process14.execFileSync)("git", ["branch", "--show-current"], { cwd: workspace, encoding: "utf8" }).trim();
|
|
82808
82917
|
} catch {
|
|
82809
82918
|
return "";
|
|
82810
82919
|
}
|
|
@@ -82812,7 +82921,7 @@ ${e?.stderr || ""}`;
|
|
|
82812
82921
|
if (!branch) return;
|
|
82813
82922
|
const baseBranch = (() => {
|
|
82814
82923
|
try {
|
|
82815
|
-
return (0,
|
|
82924
|
+
return (0, import_node_child_process14.execFileSync)("git", ["branch", "--show-current"], { cwd: repoRoot, encoding: "utf8" }).trim() || "main";
|
|
82816
82925
|
} catch {
|
|
82817
82926
|
return "main";
|
|
82818
82927
|
}
|
|
@@ -82880,13 +82989,13 @@ ${e?.stderr || ""}`;
|
|
|
82880
82989
|
});
|
|
82881
82990
|
return handle;
|
|
82882
82991
|
}
|
|
82883
|
-
var
|
|
82992
|
+
var import_node_child_process14;
|
|
82884
82993
|
var import_node_fs9;
|
|
82885
82994
|
var RETRYABLE_BASE_MOVEMENT_CODES;
|
|
82886
82995
|
var init_router_refine = __esm2({
|
|
82887
82996
|
"src/commands/router-refine.ts"() {
|
|
82888
82997
|
"use strict";
|
|
82889
|
-
|
|
82998
|
+
import_node_child_process14 = require("child_process");
|
|
82890
82999
|
import_node_fs9 = require("fs");
|
|
82891
83000
|
init_logger();
|
|
82892
83001
|
init_debug_trace();
|
|
@@ -95210,7 +95319,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
95210
95319
|
if (!["cli", "ide", "extension", "acp"].includes(category)) {
|
|
95211
95320
|
return { success: false, error: `unknown category: ${category}` };
|
|
95212
95321
|
}
|
|
95213
|
-
const
|
|
95322
|
+
const fs61 = require("fs");
|
|
95214
95323
|
const path58 = require("path");
|
|
95215
95324
|
try {
|
|
95216
95325
|
const installRoot = this.getUpstreamInstallRoot();
|
|
@@ -95219,10 +95328,10 @@ ${effect.notification.body || ""}`.trim();
|
|
|
95219
95328
|
if (!targetDir.startsWith(installRootResolved + path58.sep)) {
|
|
95220
95329
|
return { success: false, error: "refusing to delete outside upstream root" };
|
|
95221
95330
|
}
|
|
95222
|
-
if (!
|
|
95331
|
+
if (!fs61.existsSync(targetDir)) {
|
|
95223
95332
|
return { success: false, error: "not installed" };
|
|
95224
95333
|
}
|
|
95225
|
-
|
|
95334
|
+
fs61.rmSync(targetDir, { recursive: true, force: true });
|
|
95226
95335
|
try {
|
|
95227
95336
|
this._ctx.providerLoader?.deactivateVerifiedChannel?.(type2);
|
|
95228
95337
|
} catch {
|
|
@@ -95242,28 +95351,28 @@ ${effect.notification.body || ""}`.trim();
|
|
|
95242
95351
|
* the UI and by the update checker.
|
|
95243
95352
|
*/
|
|
95244
95353
|
handleListInstalledProviders(_args) {
|
|
95245
|
-
const
|
|
95354
|
+
const fs61 = require("fs");
|
|
95246
95355
|
const path58 = require("path");
|
|
95247
95356
|
const installRoot = this.getUpstreamInstallRoot();
|
|
95248
|
-
if (!
|
|
95357
|
+
if (!fs61.existsSync(installRoot)) return { success: true, providers: [] };
|
|
95249
95358
|
const CATEGORIES = ["cli", "ide", "extension", "acp"];
|
|
95250
95359
|
const items = [];
|
|
95251
95360
|
for (const category of CATEGORIES) {
|
|
95252
95361
|
const categoryDir = path58.join(installRoot, category);
|
|
95253
|
-
if (!
|
|
95362
|
+
if (!fs61.existsSync(categoryDir)) continue;
|
|
95254
95363
|
let entries;
|
|
95255
95364
|
try {
|
|
95256
|
-
entries =
|
|
95365
|
+
entries = fs61.readdirSync(categoryDir);
|
|
95257
95366
|
} catch {
|
|
95258
95367
|
continue;
|
|
95259
95368
|
}
|
|
95260
95369
|
for (const type2 of entries) {
|
|
95261
95370
|
const v1Path = path58.join(categoryDir, type2, "provider.v1.json");
|
|
95262
95371
|
const v0Path = path58.join(categoryDir, type2, "provider.json");
|
|
95263
|
-
const manifestPath =
|
|
95372
|
+
const manifestPath = fs61.existsSync(v1Path) ? v1Path : fs61.existsSync(v0Path) ? v0Path : null;
|
|
95264
95373
|
if (!manifestPath) continue;
|
|
95265
95374
|
try {
|
|
95266
|
-
const m = JSON.parse(
|
|
95375
|
+
const m = JSON.parse(fs61.readFileSync(manifestPath, "utf-8"));
|
|
95267
95376
|
const modelOptions = Array.isArray(m.modelOptions) ? m.modelOptions.filter((x) => typeof x === "string" && !!x.trim()) : [];
|
|
95268
95377
|
const thinkingLevelOptions = Array.isArray(m.thinkingLevelOptions) ? m.thinkingLevelOptions.filter((x) => typeof x === "string" && !!x.trim()) : [];
|
|
95269
95378
|
items.push({
|
|
@@ -95484,7 +95593,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
95484
95593
|
if (!/^@[a-z0-9_-]+$/i.test(requestedName)) {
|
|
95485
95594
|
return { success: false, error: "name must match @[a-z0-9_-]+" };
|
|
95486
95595
|
}
|
|
95487
|
-
const
|
|
95596
|
+
const fs61 = require("fs");
|
|
95488
95597
|
const path58 = require("path");
|
|
95489
95598
|
const { spawnSync: spawnSync3 } = require("child_process");
|
|
95490
95599
|
const file2 = ext.loadExternalSources();
|
|
@@ -95495,8 +95604,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
95495
95604
|
return { success: false, error: `source url+ref already registered (use a different name to track another ref)` };
|
|
95496
95605
|
}
|
|
95497
95606
|
const sourceDir = path58.join(ext.externalRoot(), requestedName);
|
|
95498
|
-
if (!
|
|
95499
|
-
if (
|
|
95607
|
+
if (!fs61.existsSync(ext.externalRoot())) fs61.mkdirSync(ext.externalRoot(), { recursive: true });
|
|
95608
|
+
if (fs61.existsSync(sourceDir)) {
|
|
95500
95609
|
return { success: false, error: `directory already exists: ${sourceDir} (rename or remove first)` };
|
|
95501
95610
|
}
|
|
95502
95611
|
const clone2 = spawnSync3("git", ["clone", "--depth=1", "--branch", ref, "--", url2, sourceDir], {
|
|
@@ -95506,7 +95615,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
95506
95615
|
});
|
|
95507
95616
|
if (clone2.status !== 0) {
|
|
95508
95617
|
try {
|
|
95509
|
-
|
|
95618
|
+
fs61.rmSync(sourceDir, { recursive: true, force: true });
|
|
95510
95619
|
} catch {
|
|
95511
95620
|
}
|
|
95512
95621
|
return { success: false, error: `git clone failed: ${(clone2.stderr || clone2.stdout || "").trim() || "unknown error"}` };
|
|
@@ -95550,15 +95659,15 @@ ${effect.notification.body || ""}`.trim();
|
|
|
95550
95659
|
const name = typeof args?.name === "string" ? args.name.trim() : "";
|
|
95551
95660
|
if (!name) return { success: false, error: "name is required" };
|
|
95552
95661
|
const ext = (init_external_sources(), __toCommonJS2(external_sources_exports));
|
|
95553
|
-
const
|
|
95662
|
+
const fs61 = require("fs");
|
|
95554
95663
|
const path58 = require("path");
|
|
95555
95664
|
const file2 = ext.loadExternalSources();
|
|
95556
95665
|
const match = file2.sources.find((s2) => s2.name === name);
|
|
95557
95666
|
if (!match) return { success: false, error: `source "${name}" not registered` };
|
|
95558
95667
|
const sourceDir = path58.join(ext.externalRoot(), name);
|
|
95559
|
-
if (
|
|
95668
|
+
if (fs61.existsSync(sourceDir)) {
|
|
95560
95669
|
try {
|
|
95561
|
-
|
|
95670
|
+
fs61.rmSync(sourceDir, { recursive: true, force: true });
|
|
95562
95671
|
} catch (e) {
|
|
95563
95672
|
return { success: false, error: `failed to delete ${sourceDir}: ${e?.message || e}` };
|
|
95564
95673
|
}
|
|
@@ -97885,14 +97994,14 @@ ${marker}`,
|
|
|
97885
97994
|
}
|
|
97886
97995
|
},
|
|
97887
97996
|
list_coordinator_prompts: async (_ctx, _args) => {
|
|
97888
|
-
const
|
|
97997
|
+
const fs61 = await import("fs");
|
|
97889
97998
|
const path58 = await import("path");
|
|
97890
97999
|
const { getConfigDir: getConfigDir22 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
97891
98000
|
const dir = path58.join(getConfigDir22(), "coordinator-prompts");
|
|
97892
98001
|
const entries = {};
|
|
97893
98002
|
try {
|
|
97894
|
-
if (
|
|
97895
|
-
for (const name of
|
|
98003
|
+
if (fs61.existsSync(dir)) {
|
|
98004
|
+
for (const name of fs61.readdirSync(dir)) {
|
|
97896
98005
|
const matchOverride = name.match(/^([a-zA-Z0-9_.-]+)\.md$/);
|
|
97897
98006
|
const matchAppend = name.match(/^([a-zA-Z0-9_.-]+)\.append\.md$/);
|
|
97898
98007
|
const m = matchAppend || matchOverride;
|
|
@@ -97902,7 +98011,7 @@ ${marker}`,
|
|
|
97902
98011
|
const full = path58.join(dir, name);
|
|
97903
98012
|
let content = "";
|
|
97904
98013
|
try {
|
|
97905
|
-
content =
|
|
98014
|
+
content = fs61.readFileSync(full, "utf8");
|
|
97906
98015
|
} catch {
|
|
97907
98016
|
}
|
|
97908
98017
|
if (!entries[key2]) entries[key2] = { override: "", append: "" };
|
|
@@ -97916,7 +98025,7 @@ ${marker}`,
|
|
|
97916
98025
|
return { success: true, dir, entries };
|
|
97917
98026
|
},
|
|
97918
98027
|
write_coordinator_prompt: async (_ctx, args) => {
|
|
97919
|
-
const
|
|
98028
|
+
const fs61 = await import("fs");
|
|
97920
98029
|
const path58 = await import("path");
|
|
97921
98030
|
const { getConfigDir: getConfigDir22 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
97922
98031
|
const key2 = typeof args?.key === "string" ? args.key.trim() : "";
|
|
@@ -97929,11 +98038,11 @@ ${marker}`,
|
|
|
97929
98038
|
const filename = kind === "append" ? `${key2}.append.md` : `${key2}.md`;
|
|
97930
98039
|
const full = path58.join(dir, filename);
|
|
97931
98040
|
try {
|
|
97932
|
-
|
|
98041
|
+
fs61.mkdirSync(dir, { recursive: true });
|
|
97933
98042
|
if (content.trim()) {
|
|
97934
|
-
|
|
97935
|
-
} else if (
|
|
97936
|
-
|
|
98043
|
+
fs61.writeFileSync(full, content, { encoding: "utf8", mode: 384 });
|
|
98044
|
+
} else if (fs61.existsSync(full)) {
|
|
98045
|
+
fs61.unlinkSync(full);
|
|
97937
98046
|
}
|
|
97938
98047
|
return { success: true, path: full, kind, key: key2 };
|
|
97939
98048
|
} catch (error48) {
|
|
@@ -116161,7 +116270,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
116161
116270
|
}
|
|
116162
116271
|
if (providerDir) {
|
|
116163
116272
|
try {
|
|
116164
|
-
const
|
|
116273
|
+
const fs61 = require("fs");
|
|
116165
116274
|
const path58 = require("path");
|
|
116166
116275
|
const candidates = [];
|
|
116167
116276
|
if (Array.isArray(base.compatibility)) {
|
|
@@ -116173,13 +116282,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
116173
116282
|
}
|
|
116174
116283
|
candidates.push(path58.join(providerDir, "specs", "default.json"));
|
|
116175
116284
|
candidates.push(path58.join(providerDir, "spec.json"));
|
|
116176
|
-
const specPath = candidates.find((p) =>
|
|
116285
|
+
const specPath = candidates.find((p) => fs61.existsSync(p));
|
|
116177
116286
|
let nh;
|
|
116178
116287
|
if (specPath) {
|
|
116179
116288
|
resolved._resolvedSpecPath = specPath;
|
|
116180
116289
|
let specControls;
|
|
116181
116290
|
try {
|
|
116182
|
-
const rawSpec = JSON.parse(
|
|
116291
|
+
const rawSpec = JSON.parse(fs61.readFileSync(specPath, "utf8"));
|
|
116183
116292
|
specControls = rawSpec.control_bar;
|
|
116184
116293
|
nh = rawSpec.native_history;
|
|
116185
116294
|
} catch {
|
|
@@ -116222,7 +116331,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
116222
116331
|
}
|
|
116223
116332
|
} else if (nh.override_path) {
|
|
116224
116333
|
const overrideFile = path58.resolve(providerDir, nh.override_path);
|
|
116225
|
-
if (
|
|
116334
|
+
if (fs61.existsSync(overrideFile)) {
|
|
116226
116335
|
try {
|
|
116227
116336
|
registerProviderScriptRootSafely(path58.dirname(path58.dirname(providerDir)));
|
|
116228
116337
|
delete require.cache[require.resolve(overrideFile)];
|
|
@@ -117139,7 +117248,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
117139
117248
|
}
|
|
117140
117249
|
} else if (plat === "win32") {
|
|
117141
117250
|
try {
|
|
117142
|
-
const
|
|
117251
|
+
const fs61 = require("fs");
|
|
117143
117252
|
const appNameMap = getMacAppIdentifiers();
|
|
117144
117253
|
const appName = appNameMap[ideId];
|
|
117145
117254
|
if (appName) {
|
|
@@ -117148,8 +117257,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
117148
117257
|
appName,
|
|
117149
117258
|
"storage.json"
|
|
117150
117259
|
);
|
|
117151
|
-
if (
|
|
117152
|
-
const data = JSON.parse(
|
|
117260
|
+
if (fs61.existsSync(storagePath)) {
|
|
117261
|
+
const data = JSON.parse(fs61.readFileSync(storagePath, "utf-8"));
|
|
117153
117262
|
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
117154
117263
|
if (workspaces.length > 0) {
|
|
117155
117264
|
const recent = workspaces[0];
|
|
@@ -117839,7 +117948,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
117839
117948
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
117840
117949
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
117841
117950
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
117842
|
-
const { existsSync:
|
|
117951
|
+
const { existsSync: existsSync69, readFileSync: readFileSync55, mkdirSync: mkdirSync31, writeFileSync: writeFileSync31 } = await import("fs");
|
|
117843
117952
|
const { dirname: dirname24, join: join67 } = await import("path");
|
|
117844
117953
|
const yaml6 = await Promise.resolve().then(() => (init_js_yaml(), js_yaml_exports));
|
|
117845
117954
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
@@ -117848,7 +117957,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
117848
117957
|
let existedAsYaml = false;
|
|
117849
117958
|
for (const relative8 of MESH_JSON_CONFIG_LOCATIONS2) {
|
|
117850
117959
|
const candidate = join67(workspace, relative8);
|
|
117851
|
-
if (!
|
|
117960
|
+
if (!existsSync69(candidate)) continue;
|
|
117852
117961
|
try {
|
|
117853
117962
|
const text = readFileSync55(candidate, "utf-8");
|
|
117854
117963
|
const parsed = /\.json$/i.test(candidate) ? JSON.parse(text) : yaml6.load(text);
|
|
@@ -120162,7 +120271,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
120162
120271
|
workspace
|
|
120163
120272
|
};
|
|
120164
120273
|
}
|
|
120165
|
-
const { existsSync:
|
|
120274
|
+
const { existsSync: existsSync69, readFileSync: readFileSync55, writeFileSync: writeFileSync31, copyFileSync: copyFileSync3, mkdirSync: mkdirSync31 } = await import("fs");
|
|
120166
120275
|
const { dirname: dirname24 } = await import("path");
|
|
120167
120276
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
120168
120277
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -120207,7 +120316,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
120207
120316
|
if (hermesManualFallback) return returnManualFallback(message);
|
|
120208
120317
|
return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
|
|
120209
120318
|
}
|
|
120210
|
-
const hadExistingMcpConfig =
|
|
120319
|
+
const hadExistingMcpConfig = existsSync69(mcpConfigPath);
|
|
120211
120320
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
120212
120321
|
if (hermesBaseConfig) {
|
|
120213
120322
|
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname24(mcpConfigPath));
|
|
@@ -121008,7 +121117,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121008
121117
|
const { deriveMeshReviewInboxItems: deriveMeshReviewInboxItems2 } = await Promise.resolve().then(() => (init_mesh_review_inbox(), mesh_review_inbox_exports));
|
|
121009
121118
|
const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
121010
121119
|
const { getGitDiffSummary: getGitDiffSummary2 } = await Promise.resolve().then(() => (init_git_diff(), git_diff_exports));
|
|
121011
|
-
const { existsSync:
|
|
121120
|
+
const { existsSync: existsSync69 } = await import("fs");
|
|
121012
121121
|
const meshRecord = await ctx.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
121013
121122
|
const mesh = meshRecord?.mesh;
|
|
121014
121123
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
@@ -121027,7 +121136,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121027
121136
|
const derivation = deriveMeshReviewInboxItems2({ nodes: nodeStatuses, ledgerEntries });
|
|
121028
121137
|
for (const item of derivation.items) {
|
|
121029
121138
|
const workspace = item.workspace;
|
|
121030
|
-
if (!workspace || !
|
|
121139
|
+
if (!workspace || !existsSync69(workspace)) continue;
|
|
121031
121140
|
const baseRef = item.defaultBranch ? `origin/${item.defaultBranch}` : "origin/main";
|
|
121032
121141
|
try {
|
|
121033
121142
|
const diffResult = await getGitDiffSummary2(workspace, { baseRef, maxFiles: 100 });
|
|
@@ -121222,12 +121331,12 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121222
121331
|
}
|
|
121223
121332
|
init_debug_trace();
|
|
121224
121333
|
init_mesh_host_ownership();
|
|
121225
|
-
var
|
|
121334
|
+
var fs53 = __toESM2(require("fs"));
|
|
121226
121335
|
init_mesh_node_identity();
|
|
121227
121336
|
init_router_refine();
|
|
121228
|
-
var
|
|
121337
|
+
var fs51 = __toESM2(require("fs"));
|
|
121229
121338
|
var import_node_os2 = require("os");
|
|
121230
|
-
var
|
|
121339
|
+
var import_path19 = require("path");
|
|
121231
121340
|
init_logger();
|
|
121232
121341
|
init_git_locale();
|
|
121233
121342
|
init_dist();
|
|
@@ -121239,7 +121348,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121239
121348
|
function acceptableManagedWorktreePaths(resolveWorktreePath2, normalizePath2, repoRoot, meshName, branch, worktreeBaseDir) {
|
|
121240
121349
|
const safeBranch = branch.replace(/[/\\:*?"<>|]/g, "-").replace(/^\.+|\.+$/g, "");
|
|
121241
121350
|
const safeMeshName = meshName.replace(/[/\\:*?"<>|]/g, "-").replace(/^\.+|\.+$/g, "");
|
|
121242
|
-
const legacyPath = (0,
|
|
121351
|
+
const legacyPath = (0, import_path19.join)((0, import_path19.dirname)(repoRoot), LEGACY_WORKTREE_DIR_NAME, safeMeshName, safeBranch);
|
|
121243
121352
|
const candidates = [
|
|
121244
121353
|
resolveWorktreePath2(repoRoot, meshName, branch, worktreeBaseDir),
|
|
121245
121354
|
legacyPath
|
|
@@ -121263,8 +121372,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121263
121372
|
function looksLikeCrossTrackWorktreePath(actualPath, normalizePath2) {
|
|
121264
121373
|
const home = normalizePath2((0, import_node_os2.homedir)());
|
|
121265
121374
|
return TRACK_CONFIG_DIR_NAMES.some((trackDirName) => {
|
|
121266
|
-
const trackWorktreesDir = (0,
|
|
121267
|
-
return actualPath === normalizePath2(trackWorktreesDir) || actualPath.startsWith(normalizePath2(trackWorktreesDir) +
|
|
121375
|
+
const trackWorktreesDir = (0, import_path19.join)(home, trackDirName, "worktrees");
|
|
121376
|
+
return actualPath === normalizePath2(trackWorktreesDir) || actualPath.startsWith(normalizePath2(trackWorktreesDir) + import_path19.sep);
|
|
121268
121377
|
});
|
|
121269
121378
|
}
|
|
121270
121379
|
function unexpectedPathRecoveryHint(actualPath, normalizePath2, suffix) {
|
|
@@ -121322,14 +121431,14 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121322
121431
|
return false;
|
|
121323
121432
|
}
|
|
121324
121433
|
async function bestEffortRemoveWorktreeDir(self, dir) {
|
|
121325
|
-
if (!dir || !
|
|
121434
|
+
if (!dir || !fs51.existsSync(dir)) return { removed: true, residue: false };
|
|
121326
121435
|
const sleep3 = (ms) => new Promise((resolve30) => setTimeout(resolve30, ms));
|
|
121327
121436
|
const ABSORB = /* @__PURE__ */ new Set(["EINVAL", "EPERM", "EBUSY", "ENOTEMPTY", "EACCES", "EMFILE", "ENFILE"]);
|
|
121328
121437
|
let lastErr;
|
|
121329
121438
|
for (let attempt = 0; attempt < 4; attempt++) {
|
|
121330
121439
|
try {
|
|
121331
|
-
|
|
121332
|
-
if (!
|
|
121440
|
+
fs51.rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
121441
|
+
if (!fs51.existsSync(dir)) return { removed: true, residue: false };
|
|
121333
121442
|
lastErr = new Error("directory still present after rmSync");
|
|
121334
121443
|
} catch (e) {
|
|
121335
121444
|
lastErr = e;
|
|
@@ -121340,7 +121449,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121340
121449
|
}
|
|
121341
121450
|
await sleep3(150 * (attempt + 1));
|
|
121342
121451
|
}
|
|
121343
|
-
return
|
|
121452
|
+
return fs51.existsSync(dir) ? { removed: false, residue: true, error: String(lastErr?.message || lastErr || "unknown rm error") } : { removed: true, residue: false };
|
|
121344
121453
|
}
|
|
121345
121454
|
async function precheckLocalWorktreeRemovable(self, args) {
|
|
121346
121455
|
const sessionPreservedNote = " The delegated session was left running (not stopped) \u2014 resolve the issue and retry mesh_remove_node.";
|
|
@@ -121353,10 +121462,10 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121353
121462
|
recoveryHint: "Inspect the mesh node record before removing it, or remove stale metadata manually only after confirming no managed worktree remains." + sessionPreservedNote
|
|
121354
121463
|
};
|
|
121355
121464
|
}
|
|
121356
|
-
if (!
|
|
121465
|
+
if (!fs51.existsSync(workspace)) return { ok: true };
|
|
121357
121466
|
const sourceNode = args.node?.clonedFromNodeId ? args.mesh?.nodes?.find((n) => meshNodeIdMatches(n, args.node.clonedFromNodeId)) : args.mesh?.nodes?.find((n) => !n.isLocalWorktree);
|
|
121358
121467
|
const repoRoot = typeof sourceNode?.repoRoot === "string" && sourceNode.repoRoot.trim() ? sourceNode.repoRoot.trim() : typeof sourceNode?.workspace === "string" && sourceNode.workspace.trim() ? sourceNode.workspace.trim() : "";
|
|
121359
|
-
if (!repoRoot || !
|
|
121468
|
+
if (!repoRoot || !fs51.existsSync(repoRoot)) {
|
|
121360
121469
|
return {
|
|
121361
121470
|
ok: false,
|
|
121362
121471
|
code: "mesh_worktree_cleanup_missing_source_repo",
|
|
@@ -121374,9 +121483,9 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121374
121483
|
}
|
|
121375
121484
|
const { resolveWorktreePath: resolveWorktreePath2, listWorktrees: listWorktrees2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
|
|
121376
121485
|
const normalizePath2 = (value) => {
|
|
121377
|
-
const resolved = (0,
|
|
121486
|
+
const resolved = (0, import_path19.resolve)(value);
|
|
121378
121487
|
try {
|
|
121379
|
-
return
|
|
121488
|
+
return fs51.realpathSync(resolved);
|
|
121380
121489
|
} catch {
|
|
121381
121490
|
return resolved;
|
|
121382
121491
|
}
|
|
@@ -121477,13 +121586,13 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121477
121586
|
recoveryHint: "Inspect the mesh node record before removing it, or remove stale metadata manually only after confirming no managed worktree remains."
|
|
121478
121587
|
};
|
|
121479
121588
|
}
|
|
121480
|
-
const worktreeExists =
|
|
121589
|
+
const worktreeExists = fs51.existsSync(workspace);
|
|
121481
121590
|
const sourceNode = args.node?.clonedFromNodeId ? args.mesh?.nodes?.find((n) => meshNodeIdMatches(n, args.node.clonedFromNodeId)) : args.mesh?.nodes?.find((n) => !n.isLocalWorktree);
|
|
121482
121591
|
const repoRoot = typeof sourceNode?.repoRoot === "string" && sourceNode.repoRoot.trim() ? sourceNode.repoRoot.trim() : typeof sourceNode?.workspace === "string" && sourceNode.workspace.trim() ? sourceNode.workspace.trim() : "";
|
|
121483
121592
|
if (!worktreeExists) {
|
|
121484
121593
|
return { success: true, skipped: true, removedPath: workspace, repoRoot: repoRoot || void 0, reason: "worktree_path_missing" };
|
|
121485
121594
|
}
|
|
121486
|
-
if (!repoRoot || !
|
|
121595
|
+
if (!repoRoot || !fs51.existsSync(repoRoot)) {
|
|
121487
121596
|
return {
|
|
121488
121597
|
success: false,
|
|
121489
121598
|
code: "mesh_worktree_cleanup_missing_source_repo",
|
|
@@ -121501,9 +121610,9 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
121501
121610
|
}
|
|
121502
121611
|
const { resolveWorktreePath: resolveWorktreePath2, listWorktrees: listWorktrees2, removeWorktree: removeWorktree2 } = await Promise.resolve().then(() => (init_git_worktree(), git_worktree_exports));
|
|
121503
121612
|
const normalizePath2 = (value) => {
|
|
121504
|
-
const resolved = (0,
|
|
121613
|
+
const resolved = (0, import_path19.resolve)(value);
|
|
121505
121614
|
try {
|
|
121506
|
-
return
|
|
121615
|
+
return fs51.realpathSync(resolved);
|
|
121507
121616
|
} catch {
|
|
121508
121617
|
return resolved;
|
|
121509
121618
|
}
|
|
@@ -122150,8 +122259,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
122150
122259
|
init_logger();
|
|
122151
122260
|
var yaml5 = __toESM2(require_js_yaml());
|
|
122152
122261
|
var import_os5 = require("os");
|
|
122153
|
-
var
|
|
122154
|
-
var
|
|
122262
|
+
var import_path20 = require("path");
|
|
122263
|
+
var fs52 = __toESM2(require("fs"));
|
|
122155
122264
|
var MESH_COORDINATOR_AUTO_IMPORT_FORMATS = ["claude_mcp_json", "hermes_config_yaml", "opencode_json"];
|
|
122156
122265
|
function isSupportedMeshCoordinatorConfigFormat(format) {
|
|
122157
122266
|
return MESH_COORDINATOR_AUTO_IMPORT_FORMATS.includes(format);
|
|
@@ -122191,14 +122300,14 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
122191
122300
|
}
|
|
122192
122301
|
function resolveHermesUserHome() {
|
|
122193
122302
|
const explicitHome = process.env.HERMES_HOME?.trim();
|
|
122194
|
-
return explicitHome || (0,
|
|
122303
|
+
return explicitHome || (0, import_path20.join)((0, import_os5.homedir)(), ".hermes");
|
|
122195
122304
|
}
|
|
122196
122305
|
function loadHermesCoordinatorBaseConfig(targetConfigPath) {
|
|
122197
122306
|
const sourceHome = resolveHermesUserHome();
|
|
122198
|
-
const sourceConfigPath = (0,
|
|
122199
|
-
if (!
|
|
122200
|
-
if ((0,
|
|
122201
|
-
const parsed = parseMeshCoordinatorMcpConfig(
|
|
122307
|
+
const sourceConfigPath = (0, import_path20.join)(sourceHome, "config.yaml");
|
|
122308
|
+
if (!fs52.existsSync(sourceConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
|
|
122309
|
+
if ((0, import_path20.resolve)(sourceConfigPath) === (0, import_path20.resolve)(targetConfigPath)) return { config: {}, sourceHome, sourceConfigPath };
|
|
122310
|
+
const parsed = parseMeshCoordinatorMcpConfig(fs52.readFileSync(sourceConfigPath, "utf-8"), "hermes_config_yaml");
|
|
122202
122311
|
const { mcp_servers: _mcpServers, ...baseConfig } = parsed;
|
|
122203
122312
|
return { config: baseConfig, sourceHome, sourceConfigPath };
|
|
122204
122313
|
}
|
|
@@ -122231,13 +122340,13 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
122231
122340
|
return sanitized;
|
|
122232
122341
|
}
|
|
122233
122342
|
function copyHermesCoordinatorCredentialFiles(sourceHome, targetHome) {
|
|
122234
|
-
if ((0,
|
|
122343
|
+
if ((0, import_path20.resolve)(sourceHome) === (0, import_path20.resolve)(targetHome)) return;
|
|
122235
122344
|
for (const fileName of [".env", "auth.json"]) {
|
|
122236
|
-
const sourcePath = (0,
|
|
122237
|
-
const targetPath = (0,
|
|
122238
|
-
if (!
|
|
122345
|
+
const sourcePath = (0, import_path20.join)(sourceHome, fileName);
|
|
122346
|
+
const targetPath = (0, import_path20.join)(targetHome, fileName);
|
|
122347
|
+
if (!fs52.existsSync(sourcePath)) continue;
|
|
122239
122348
|
try {
|
|
122240
|
-
|
|
122349
|
+
fs52.copyFileSync(sourcePath, targetPath);
|
|
122241
122350
|
} catch (error48) {
|
|
122242
122351
|
LOG2.warn("MeshCoordinator", `Could not copy Hermes ${fileName} into isolated coordinator home: ${error48?.message || error48}`);
|
|
122243
122352
|
}
|
|
@@ -122752,7 +122861,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
122752
122861
|
const nodeId = readInlineMeshNodeId(node);
|
|
122753
122862
|
if (!nodeId || !tombstones.has(nodeId)) return true;
|
|
122754
122863
|
const workspace = readStringValue(node?.workspace);
|
|
122755
|
-
if (workspace &&
|
|
122864
|
+
if (workspace && fs53.existsSync(workspace)) {
|
|
122756
122865
|
tombstones.delete(nodeId);
|
|
122757
122866
|
return true;
|
|
122758
122867
|
}
|
|
@@ -124812,7 +124921,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
124812
124921
|
};
|
|
124813
124922
|
init_io_contracts();
|
|
124814
124923
|
init_chat_message_normalization();
|
|
124815
|
-
var
|
|
124924
|
+
var fs54 = __toESM2(require("fs"));
|
|
124816
124925
|
var path522 = __toESM2(require("path"));
|
|
124817
124926
|
var os28 = __toESM2(require("os"));
|
|
124818
124927
|
var import_os6 = require("os");
|
|
@@ -124829,8 +124938,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
124829
124938
|
}
|
|
124830
124939
|
load() {
|
|
124831
124940
|
try {
|
|
124832
|
-
if (
|
|
124833
|
-
this.history = JSON.parse(
|
|
124941
|
+
if (fs54.existsSync(getArchivePath2())) {
|
|
124942
|
+
this.history = JSON.parse(fs54.readFileSync(getArchivePath2(), "utf-8"));
|
|
124834
124943
|
}
|
|
124835
124944
|
} catch {
|
|
124836
124945
|
this.history = {};
|
|
@@ -124867,8 +124976,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
124867
124976
|
}
|
|
124868
124977
|
save() {
|
|
124869
124978
|
try {
|
|
124870
|
-
|
|
124871
|
-
|
|
124979
|
+
fs54.mkdirSync(path522.dirname(getArchivePath2()), { recursive: true });
|
|
124980
|
+
fs54.writeFileSync(getArchivePath2(), JSON.stringify(this.history, null, 2));
|
|
124872
124981
|
} catch {
|
|
124873
124982
|
}
|
|
124874
124983
|
}
|
|
@@ -124893,8 +125002,8 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
124893
125002
|
for (const ext of exes) {
|
|
124894
125003
|
const fullPath = path522.join(p, name + ext);
|
|
124895
125004
|
try {
|
|
124896
|
-
if (
|
|
124897
|
-
const stat2 =
|
|
125005
|
+
if (fs54.existsSync(fullPath)) {
|
|
125006
|
+
const stat2 = fs54.statSync(fullPath);
|
|
124898
125007
|
if (stat2.isFile() && (isWin || stat2.mode & 73)) {
|
|
124899
125008
|
return fullPath;
|
|
124900
125009
|
}
|
|
@@ -124941,9 +125050,9 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
124941
125050
|
if (p.includes("*")) {
|
|
124942
125051
|
const home = os28.homedir();
|
|
124943
125052
|
const resolved = p.replace(/\*/g, home.split(path522.sep).pop() || "");
|
|
124944
|
-
if (
|
|
125053
|
+
if (fs54.existsSync(resolved)) return resolved;
|
|
124945
125054
|
} else {
|
|
124946
|
-
if (
|
|
125055
|
+
if (fs54.existsSync(p)) return p;
|
|
124947
125056
|
}
|
|
124948
125057
|
}
|
|
124949
125058
|
return null;
|
|
@@ -124951,7 +125060,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
124951
125060
|
async function getMacAppVersion(appPath) {
|
|
124952
125061
|
if ((0, import_os6.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
|
|
124953
125062
|
const plistPath = path522.join(appPath, "Contents", "Info.plist");
|
|
124954
|
-
if (!
|
|
125063
|
+
if (!fs54.existsSync(plistPath)) return null;
|
|
124955
125064
|
const raw = await runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
|
|
124956
125065
|
return raw || null;
|
|
124957
125066
|
}
|
|
@@ -124978,7 +125087,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
124978
125087
|
let resolvedBin = cliBin;
|
|
124979
125088
|
if (!resolvedBin && appPath && currentOs === "darwin") {
|
|
124980
125089
|
const bundled = path522.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
|
|
124981
|
-
if (provider.cli &&
|
|
125090
|
+
if (provider.cli && fs54.existsSync(bundled)) resolvedBin = bundled;
|
|
124982
125091
|
}
|
|
124983
125092
|
info.installed = !!(appPath || resolvedBin);
|
|
124984
125093
|
info.path = appPath || null;
|
|
@@ -125024,7 +125133,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
125024
125133
|
return results;
|
|
125025
125134
|
}
|
|
125026
125135
|
var http3 = __toESM2(require("http"));
|
|
125027
|
-
var
|
|
125136
|
+
var fs58 = __toESM2(require("fs"));
|
|
125028
125137
|
var path56 = __toESM2(require("path"));
|
|
125029
125138
|
init_config();
|
|
125030
125139
|
function generateFiles(type2, name, category, opts = {}) {
|
|
@@ -125370,7 +125479,7 @@ async (params) => {
|
|
|
125370
125479
|
}
|
|
125371
125480
|
init_logger();
|
|
125372
125481
|
init_builders();
|
|
125373
|
-
var
|
|
125482
|
+
var fs55 = __toESM2(require("fs"));
|
|
125374
125483
|
var path53 = __toESM2(require("path"));
|
|
125375
125484
|
init_logger();
|
|
125376
125485
|
async function handleCdpEvaluate(ctx, req, res) {
|
|
@@ -125551,17 +125660,17 @@ async (params) => {
|
|
|
125551
125660
|
}
|
|
125552
125661
|
let scriptsPath = "";
|
|
125553
125662
|
const directScripts = path53.join(dir, "scripts.js");
|
|
125554
|
-
if (
|
|
125663
|
+
if (fs55.existsSync(directScripts)) {
|
|
125555
125664
|
scriptsPath = directScripts;
|
|
125556
125665
|
} else {
|
|
125557
125666
|
const scriptsDir = path53.join(dir, "scripts");
|
|
125558
|
-
if (
|
|
125559
|
-
const versions =
|
|
125560
|
-
return
|
|
125667
|
+
if (fs55.existsSync(scriptsDir)) {
|
|
125668
|
+
const versions = fs55.readdirSync(scriptsDir).filter((d) => {
|
|
125669
|
+
return fs55.statSync(path53.join(scriptsDir, d)).isDirectory();
|
|
125561
125670
|
}).sort().reverse();
|
|
125562
125671
|
for (const ver of versions) {
|
|
125563
125672
|
const p = path53.join(scriptsDir, ver, "scripts.js");
|
|
125564
|
-
if (
|
|
125673
|
+
if (fs55.existsSync(p)) {
|
|
125565
125674
|
scriptsPath = p;
|
|
125566
125675
|
break;
|
|
125567
125676
|
}
|
|
@@ -125573,7 +125682,7 @@ async (params) => {
|
|
|
125573
125682
|
return;
|
|
125574
125683
|
}
|
|
125575
125684
|
try {
|
|
125576
|
-
const source =
|
|
125685
|
+
const source = fs55.readFileSync(scriptsPath, "utf-8");
|
|
125577
125686
|
const hints = {};
|
|
125578
125687
|
const funcRegex = /module\.exports\.(\w+)\s*=\s*function\s+\w+\s*\(params\)/g;
|
|
125579
125688
|
let match;
|
|
@@ -126386,7 +126495,7 @@ async (params) => {
|
|
|
126386
126495
|
ctx.json(res, 500, { error: `DOM context collection failed: ${e.message}` });
|
|
126387
126496
|
}
|
|
126388
126497
|
}
|
|
126389
|
-
var
|
|
126498
|
+
var fs56 = __toESM2(require("fs"));
|
|
126390
126499
|
var path54 = __toESM2(require("path"));
|
|
126391
126500
|
function slugifyFixtureName(value) {
|
|
126392
126501
|
const normalized = String(value || "").trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
@@ -126402,10 +126511,10 @@ async (params) => {
|
|
|
126402
126511
|
function readCliFixture(ctx, type2, name) {
|
|
126403
126512
|
const fixtureDir = getCliFixtureDir(ctx, type2);
|
|
126404
126513
|
const filePath = path54.join(fixtureDir, `${name}.json`);
|
|
126405
|
-
if (!
|
|
126514
|
+
if (!fs56.existsSync(filePath)) {
|
|
126406
126515
|
throw new Error(`Fixture not found: ${filePath}`);
|
|
126407
126516
|
}
|
|
126408
|
-
return JSON.parse(
|
|
126517
|
+
return JSON.parse(fs56.readFileSync(filePath, "utf-8"));
|
|
126409
126518
|
}
|
|
126410
126519
|
function getExerciseTranscriptText(result) {
|
|
126411
126520
|
const parts = [];
|
|
@@ -127155,7 +127264,7 @@ async (params) => {
|
|
|
127155
127264
|
return;
|
|
127156
127265
|
}
|
|
127157
127266
|
const fixtureDir = getCliFixtureDir(ctx, type2);
|
|
127158
|
-
|
|
127267
|
+
fs56.mkdirSync(fixtureDir, { recursive: true });
|
|
127159
127268
|
const name = slugifyFixtureName(String(body?.name || `${type2}-${Date.now()}`));
|
|
127160
127269
|
const result = await runCliExerciseInternal(ctx, { ...request, type: type2 });
|
|
127161
127270
|
const fixture = {
|
|
@@ -127183,7 +127292,7 @@ async (params) => {
|
|
|
127183
127292
|
notes: typeof body?.notes === "string" ? body.notes : void 0
|
|
127184
127293
|
};
|
|
127185
127294
|
const filePath = path54.join(fixtureDir, `${name}.json`);
|
|
127186
|
-
|
|
127295
|
+
fs56.writeFileSync(filePath, JSON.stringify(fixture, null, 2));
|
|
127187
127296
|
ctx.json(res, 200, {
|
|
127188
127297
|
saved: true,
|
|
127189
127298
|
name,
|
|
@@ -127201,14 +127310,14 @@ async (params) => {
|
|
|
127201
127310
|
async function handleCliFixtureList(ctx, type2, _req, res) {
|
|
127202
127311
|
try {
|
|
127203
127312
|
const fixtureDir = getCliFixtureDir(ctx, type2);
|
|
127204
|
-
if (!
|
|
127313
|
+
if (!fs56.existsSync(fixtureDir)) {
|
|
127205
127314
|
ctx.json(res, 200, { fixtures: [], count: 0 });
|
|
127206
127315
|
return;
|
|
127207
127316
|
}
|
|
127208
|
-
const fixtures =
|
|
127317
|
+
const fixtures = fs56.readdirSync(fixtureDir).filter((file2) => file2.endsWith(".json")).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" })).map((file2) => {
|
|
127209
127318
|
const fullPath = path54.join(fixtureDir, file2);
|
|
127210
127319
|
try {
|
|
127211
|
-
const raw = JSON.parse(
|
|
127320
|
+
const raw = JSON.parse(fs56.readFileSync(fullPath, "utf-8"));
|
|
127212
127321
|
return {
|
|
127213
127322
|
name: raw.name || file2.replace(/\.json$/i, ""),
|
|
127214
127323
|
path: fullPath,
|
|
@@ -127339,7 +127448,7 @@ async (params) => {
|
|
|
127339
127448
|
ctx.json(res, 500, { error: `Raw send failed: ${e.message}` });
|
|
127340
127449
|
}
|
|
127341
127450
|
}
|
|
127342
|
-
var
|
|
127451
|
+
var fs57 = __toESM2(require("fs"));
|
|
127343
127452
|
var path55 = __toESM2(require("path"));
|
|
127344
127453
|
var os29 = __toESM2(require("os"));
|
|
127345
127454
|
var import_session_host_core10 = require_dist();
|
|
@@ -127388,10 +127497,10 @@ async (params) => {
|
|
|
127388
127497
|
return fallback?.type || null;
|
|
127389
127498
|
}
|
|
127390
127499
|
function getLatestScriptVersionDir(scriptsDir) {
|
|
127391
|
-
if (!
|
|
127392
|
-
const versions =
|
|
127500
|
+
if (!fs57.existsSync(scriptsDir)) return null;
|
|
127501
|
+
const versions = fs57.readdirSync(scriptsDir).filter((d) => {
|
|
127393
127502
|
try {
|
|
127394
|
-
return
|
|
127503
|
+
return fs57.statSync(path55.join(scriptsDir, d)).isDirectory();
|
|
127395
127504
|
} catch {
|
|
127396
127505
|
return false;
|
|
127397
127506
|
}
|
|
@@ -127413,13 +127522,13 @@ async (params) => {
|
|
|
127413
127522
|
if (!sourceDir) {
|
|
127414
127523
|
return { dir: null, reason: `Provider source directory not found for '${type2}'` };
|
|
127415
127524
|
}
|
|
127416
|
-
if (!
|
|
127417
|
-
|
|
127418
|
-
|
|
127525
|
+
if (!fs57.existsSync(desiredDir)) {
|
|
127526
|
+
fs57.mkdirSync(path55.dirname(desiredDir), { recursive: true });
|
|
127527
|
+
fs57.cpSync(sourceDir, desiredDir, { recursive: true });
|
|
127419
127528
|
ctx.log(`Auto-implement writable copy created: ${desiredDir}`);
|
|
127420
127529
|
}
|
|
127421
127530
|
const providerJson = path55.join(desiredDir, "provider.json");
|
|
127422
|
-
if (!
|
|
127531
|
+
if (!fs57.existsSync(providerJson)) {
|
|
127423
127532
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
127424
127533
|
}
|
|
127425
127534
|
return { dir: desiredDir };
|
|
@@ -127427,15 +127536,15 @@ async (params) => {
|
|
|
127427
127536
|
function loadAutoImplReferenceScripts(ctx, referenceType) {
|
|
127428
127537
|
if (!referenceType) return {};
|
|
127429
127538
|
const refDir = ctx.findProviderDir(referenceType);
|
|
127430
|
-
if (!refDir || !
|
|
127539
|
+
if (!refDir || !fs57.existsSync(refDir)) return {};
|
|
127431
127540
|
const referenceScripts = {};
|
|
127432
127541
|
const scriptsDir = path55.join(refDir, "scripts");
|
|
127433
127542
|
const latestDir = getLatestScriptVersionDir(scriptsDir);
|
|
127434
127543
|
if (!latestDir) return referenceScripts;
|
|
127435
|
-
for (const file2 of
|
|
127544
|
+
for (const file2 of fs57.readdirSync(latestDir)) {
|
|
127436
127545
|
if (!file2.endsWith(".js")) continue;
|
|
127437
127546
|
try {
|
|
127438
|
-
referenceScripts[file2] =
|
|
127547
|
+
referenceScripts[file2] = fs57.readFileSync(path55.join(latestDir, file2), "utf-8");
|
|
127439
127548
|
} catch {
|
|
127440
127549
|
}
|
|
127441
127550
|
}
|
|
@@ -127544,15 +127653,15 @@ async (params) => {
|
|
|
127544
127653
|
const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
|
|
127545
127654
|
const prompt = buildAutoImplPrompt(ctx, type2, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
|
|
127546
127655
|
const tmpDir = path55.join(os29.tmpdir(), "adhdev-autoimpl");
|
|
127547
|
-
if (!
|
|
127656
|
+
if (!fs57.existsSync(tmpDir)) fs57.mkdirSync(tmpDir, { recursive: true });
|
|
127548
127657
|
const promptFile = path55.join(tmpDir, `prompt-${type2}-${Date.now()}.md`);
|
|
127549
|
-
|
|
127658
|
+
fs57.writeFileSync(promptFile, prompt, "utf-8");
|
|
127550
127659
|
ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
|
|
127551
127660
|
const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
|
|
127552
127661
|
const spawn7 = agentProvider?.spawn;
|
|
127553
127662
|
if (!spawn7?.command) {
|
|
127554
127663
|
try {
|
|
127555
|
-
|
|
127664
|
+
fs57.unlinkSync(promptFile);
|
|
127556
127665
|
} catch {
|
|
127557
127666
|
}
|
|
127558
127667
|
ctx.json(res, 400, { error: `Agent '${agent}' has no spawn config. Select a CLI provider with a spawn configuration.` });
|
|
@@ -127654,7 +127763,7 @@ async (params) => {
|
|
|
127654
127763
|
} catch {
|
|
127655
127764
|
}
|
|
127656
127765
|
try {
|
|
127657
|
-
|
|
127766
|
+
fs57.unlinkSync(promptFile);
|
|
127658
127767
|
} catch {
|
|
127659
127768
|
}
|
|
127660
127769
|
ctx.log(`Auto-implement (ACP) ${success2 ? "completed" : "failed"}: ${type2} (exit: ${code})`);
|
|
@@ -127877,7 +127986,7 @@ async (params) => {
|
|
|
127877
127986
|
}
|
|
127878
127987
|
});
|
|
127879
127988
|
try {
|
|
127880
|
-
|
|
127989
|
+
fs57.unlinkSync(promptFile);
|
|
127881
127990
|
} catch {
|
|
127882
127991
|
}
|
|
127883
127992
|
ctx.log(`Auto-implement ${success2 ? "completed" : "failed"}: ${type2} (exit: ${code})${verificationSummary ? ` verify=${verificationSummary.pass ? "pass" : "fail"}` : ""}`);
|
|
@@ -127982,10 +128091,10 @@ async (params) => {
|
|
|
127982
128091
|
lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
|
|
127983
128092
|
lines.push("These are the ONLY files you are allowed to modify. Replace the TODO stubs with working implementations.");
|
|
127984
128093
|
lines.push("");
|
|
127985
|
-
for (const file2 of
|
|
128094
|
+
for (const file2 of fs57.readdirSync(latestScriptsDir)) {
|
|
127986
128095
|
if (file2.endsWith(".js") && targetFileNames.has(file2)) {
|
|
127987
128096
|
try {
|
|
127988
|
-
const content =
|
|
128097
|
+
const content = fs57.readFileSync(path55.join(latestScriptsDir, file2), "utf-8");
|
|
127989
128098
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
127990
128099
|
lines.push("```javascript");
|
|
127991
128100
|
lines.push(content);
|
|
@@ -127995,14 +128104,14 @@ async (params) => {
|
|
|
127995
128104
|
}
|
|
127996
128105
|
}
|
|
127997
128106
|
}
|
|
127998
|
-
const refFiles =
|
|
128107
|
+
const refFiles = fs57.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
|
|
127999
128108
|
if (refFiles.length > 0) {
|
|
128000
128109
|
lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
|
|
128001
128110
|
lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
|
|
128002
128111
|
lines.push("");
|
|
128003
128112
|
for (const file2 of refFiles) {
|
|
128004
128113
|
try {
|
|
128005
|
-
const content =
|
|
128114
|
+
const content = fs57.readFileSync(path55.join(latestScriptsDir, file2), "utf-8");
|
|
128006
128115
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
128007
128116
|
lines.push("```javascript");
|
|
128008
128117
|
lines.push(content);
|
|
@@ -128047,7 +128156,7 @@ async (params) => {
|
|
|
128047
128156
|
const loadGuide = (name) => {
|
|
128048
128157
|
try {
|
|
128049
128158
|
const p = path55.join(docsDir, name);
|
|
128050
|
-
if (
|
|
128159
|
+
if (fs57.existsSync(p)) return fs57.readFileSync(p, "utf-8");
|
|
128051
128160
|
} catch {
|
|
128052
128161
|
}
|
|
128053
128162
|
return null;
|
|
@@ -128291,11 +128400,11 @@ async (params) => {
|
|
|
128291
128400
|
lines.push("## \u270F\uFE0F Target Files (EDIT THESE)");
|
|
128292
128401
|
lines.push("These are the ONLY files you are allowed to modify. Replace TODO or heuristic-only logic with working PTY-aware implementations.");
|
|
128293
128402
|
lines.push("");
|
|
128294
|
-
for (const file2 of
|
|
128403
|
+
for (const file2 of fs57.readdirSync(latestScriptsDir)) {
|
|
128295
128404
|
if (!file2.endsWith(".js")) continue;
|
|
128296
128405
|
if (!targetFileNames.has(file2)) continue;
|
|
128297
128406
|
try {
|
|
128298
|
-
const content =
|
|
128407
|
+
const content = fs57.readFileSync(path55.join(latestScriptsDir, file2), "utf-8");
|
|
128299
128408
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
128300
128409
|
lines.push("```javascript");
|
|
128301
128410
|
lines.push(content);
|
|
@@ -128304,14 +128413,14 @@ async (params) => {
|
|
|
128304
128413
|
} catch {
|
|
128305
128414
|
}
|
|
128306
128415
|
}
|
|
128307
|
-
const refFiles =
|
|
128416
|
+
const refFiles = fs57.readdirSync(latestScriptsDir).filter((f) => f.endsWith(".js") && !targetFileNames.has(f));
|
|
128308
128417
|
if (refFiles.length > 0) {
|
|
128309
128418
|
lines.push("## \u{1F512} Other Scripts (REFERENCE ONLY \u2014 DO NOT EDIT)");
|
|
128310
128419
|
lines.push("These files are shown for context only. Do NOT modify them under any circumstances.");
|
|
128311
128420
|
lines.push("");
|
|
128312
128421
|
for (const file2 of refFiles) {
|
|
128313
128422
|
try {
|
|
128314
|
-
const content =
|
|
128423
|
+
const content = fs57.readFileSync(path55.join(latestScriptsDir, file2), "utf-8");
|
|
128315
128424
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
128316
128425
|
lines.push("```javascript");
|
|
128317
128426
|
lines.push(content);
|
|
@@ -128348,7 +128457,7 @@ async (params) => {
|
|
|
128348
128457
|
const loadGuide = (name) => {
|
|
128349
128458
|
try {
|
|
128350
128459
|
const p = path55.join(docsDir, name);
|
|
128351
|
-
if (
|
|
128460
|
+
if (fs57.existsSync(p)) return fs57.readFileSync(p, "utf-8");
|
|
128352
128461
|
} catch {
|
|
128353
128462
|
}
|
|
128354
128463
|
return null;
|
|
@@ -129086,7 +129195,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129086
129195
|
path56.join(process.cwd(), "packages/web-devconsole/dist")
|
|
129087
129196
|
];
|
|
129088
129197
|
for (const dir of candidates) {
|
|
129089
|
-
if (
|
|
129198
|
+
if (fs58.existsSync(path56.join(dir, "index.html"))) return dir;
|
|
129090
129199
|
}
|
|
129091
129200
|
return null;
|
|
129092
129201
|
}
|
|
@@ -129098,7 +129207,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129098
129207
|
}
|
|
129099
129208
|
const htmlPath = path56.join(distDir, "index.html");
|
|
129100
129209
|
try {
|
|
129101
|
-
const html =
|
|
129210
|
+
const html = fs58.readFileSync(htmlPath, "utf-8");
|
|
129102
129211
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
129103
129212
|
res.end(html);
|
|
129104
129213
|
} catch (e) {
|
|
@@ -129128,7 +129237,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129128
129237
|
return;
|
|
129129
129238
|
}
|
|
129130
129239
|
try {
|
|
129131
|
-
const content =
|
|
129240
|
+
const content = fs58.readFileSync(filePath);
|
|
129132
129241
|
const ext = path56.extname(filePath);
|
|
129133
129242
|
const contentType = _DevServer.MIME_MAP[ext] || "application/octet-stream";
|
|
129134
129243
|
res.writeHead(200, { "Content-Type": contentType, "Cache-Control": "public, max-age=31536000, immutable" });
|
|
@@ -129237,14 +129346,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129237
129346
|
const files = [];
|
|
129238
129347
|
const scan = (d, prefix) => {
|
|
129239
129348
|
try {
|
|
129240
|
-
for (const entry of
|
|
129349
|
+
for (const entry of fs58.readdirSync(d, { withFileTypes: true })) {
|
|
129241
129350
|
if (entry.name.startsWith(".") || entry.name.endsWith(".bak")) continue;
|
|
129242
129351
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
129243
129352
|
if (entry.isDirectory()) {
|
|
129244
129353
|
files.push({ path: rel, size: 0, type: "dir" });
|
|
129245
129354
|
scan(path56.join(d, entry.name), rel);
|
|
129246
129355
|
} else {
|
|
129247
|
-
const stat2 =
|
|
129356
|
+
const stat2 = fs58.statSync(path56.join(d, entry.name));
|
|
129248
129357
|
files.push({ path: rel, size: stat2.size, type: "file" });
|
|
129249
129358
|
}
|
|
129250
129359
|
}
|
|
@@ -129272,11 +129381,11 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129272
129381
|
this.json(res, 403, { error: "Forbidden" });
|
|
129273
129382
|
return;
|
|
129274
129383
|
}
|
|
129275
|
-
if (!
|
|
129384
|
+
if (!fs58.existsSync(fullPath) || fs58.statSync(fullPath).isDirectory()) {
|
|
129276
129385
|
this.json(res, 404, { error: `File not found: ${filePath}` });
|
|
129277
129386
|
return;
|
|
129278
129387
|
}
|
|
129279
|
-
const content =
|
|
129388
|
+
const content = fs58.readFileSync(fullPath, "utf-8");
|
|
129280
129389
|
this.json(res, 200, { type: type2, path: filePath, content, lines: content.split("\n").length });
|
|
129281
129390
|
}
|
|
129282
129391
|
/** POST /api/providers/:type/file — write a file { path, content } */
|
|
@@ -129298,9 +129407,9 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129298
129407
|
return;
|
|
129299
129408
|
}
|
|
129300
129409
|
try {
|
|
129301
|
-
if (
|
|
129302
|
-
|
|
129303
|
-
|
|
129410
|
+
if (fs58.existsSync(fullPath)) fs58.copyFileSync(fullPath, fullPath + ".bak");
|
|
129411
|
+
fs58.mkdirSync(path56.dirname(fullPath), { recursive: true });
|
|
129412
|
+
fs58.writeFileSync(fullPath, content, "utf-8");
|
|
129304
129413
|
this.log(`File saved: ${fullPath} (${content.length} chars)`);
|
|
129305
129414
|
this.providerLoader.reload();
|
|
129306
129415
|
this.json(res, 200, { saved: true, path: filePath, chars: content.length });
|
|
@@ -129317,8 +129426,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129317
129426
|
}
|
|
129318
129427
|
for (const name of ["scripts.js", "provider.json"]) {
|
|
129319
129428
|
const p = path56.join(dir, name);
|
|
129320
|
-
if (
|
|
129321
|
-
const source =
|
|
129429
|
+
if (fs58.existsSync(p)) {
|
|
129430
|
+
const source = fs58.readFileSync(p, "utf-8");
|
|
129322
129431
|
this.json(res, 200, { type: type2, path: p, source, lines: source.split("\n").length });
|
|
129323
129432
|
return;
|
|
129324
129433
|
}
|
|
@@ -129337,11 +129446,11 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129337
129446
|
this.json(res, 404, { error: `Provider not found: ${type2}` });
|
|
129338
129447
|
return;
|
|
129339
129448
|
}
|
|
129340
|
-
const target =
|
|
129449
|
+
const target = fs58.existsSync(path56.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
|
|
129341
129450
|
const targetPath = path56.join(dir, target);
|
|
129342
129451
|
try {
|
|
129343
|
-
if (
|
|
129344
|
-
|
|
129452
|
+
if (fs58.existsSync(targetPath)) fs58.copyFileSync(targetPath, targetPath + ".bak");
|
|
129453
|
+
fs58.writeFileSync(targetPath, source, "utf-8");
|
|
129345
129454
|
this.log(`Saved provider: ${targetPath} (${source.length} chars)`);
|
|
129346
129455
|
this.providerLoader.reload();
|
|
129347
129456
|
this.json(res, 200, { saved: true, path: targetPath, chars: source.length });
|
|
@@ -129486,20 +129595,20 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129486
129595
|
let targetDir;
|
|
129487
129596
|
targetDir = this.providerLoader.getUserProviderDir(category, type2);
|
|
129488
129597
|
const jsonPath = path56.join(targetDir, "provider.json");
|
|
129489
|
-
if (
|
|
129598
|
+
if (fs58.existsSync(jsonPath)) {
|
|
129490
129599
|
this.json(res, 409, { error: `Provider already exists at ${targetDir}`, path: targetDir });
|
|
129491
129600
|
return;
|
|
129492
129601
|
}
|
|
129493
129602
|
try {
|
|
129494
129603
|
const result = generateFiles(type2, name, category, { cdpPorts, cli, processName, installPath, binary: binary2, extensionId, version: version2, osPaths, processNames });
|
|
129495
|
-
|
|
129496
|
-
|
|
129604
|
+
fs58.mkdirSync(targetDir, { recursive: true });
|
|
129605
|
+
fs58.writeFileSync(jsonPath, result["provider.json"], "utf-8");
|
|
129497
129606
|
const createdFiles = ["provider.json"];
|
|
129498
129607
|
if (result.files) {
|
|
129499
129608
|
for (const [relPath, content] of Object.entries(result.files)) {
|
|
129500
129609
|
const fullPath = path56.join(targetDir, relPath);
|
|
129501
|
-
|
|
129502
|
-
|
|
129610
|
+
fs58.mkdirSync(path56.dirname(fullPath), { recursive: true });
|
|
129611
|
+
fs58.writeFileSync(fullPath, content, "utf-8");
|
|
129503
129612
|
createdFiles.push(relPath);
|
|
129504
129613
|
}
|
|
129505
129614
|
}
|
|
@@ -129548,10 +129657,10 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129548
129657
|
}
|
|
129549
129658
|
// ─── Phase 2: Auto-Implement Backend ───
|
|
129550
129659
|
getLatestScriptVersionDir(scriptsDir) {
|
|
129551
|
-
if (!
|
|
129552
|
-
const versions =
|
|
129660
|
+
if (!fs58.existsSync(scriptsDir)) return null;
|
|
129661
|
+
const versions = fs58.readdirSync(scriptsDir).filter((d) => {
|
|
129553
129662
|
try {
|
|
129554
|
-
return
|
|
129663
|
+
return fs58.statSync(path56.join(scriptsDir, d)).isDirectory();
|
|
129555
129664
|
} catch {
|
|
129556
129665
|
return false;
|
|
129557
129666
|
}
|
|
@@ -129573,13 +129682,13 @@ data: ${JSON.stringify(msg.data)}
|
|
|
129573
129682
|
if (!sourceDir) {
|
|
129574
129683
|
return { dir: null, reason: `Provider source directory not found for '${type2}'` };
|
|
129575
129684
|
}
|
|
129576
|
-
if (!
|
|
129577
|
-
|
|
129578
|
-
|
|
129685
|
+
if (!fs58.existsSync(desiredDir)) {
|
|
129686
|
+
fs58.mkdirSync(path56.dirname(desiredDir), { recursive: true });
|
|
129687
|
+
fs58.cpSync(sourceDir, desiredDir, { recursive: true });
|
|
129579
129688
|
this.log(`Auto-implement writable copy created: ${desiredDir}`);
|
|
129580
129689
|
}
|
|
129581
129690
|
const providerJson = path56.join(desiredDir, "provider.json");
|
|
129582
|
-
if (!
|
|
129691
|
+
if (!fs58.existsSync(providerJson)) {
|
|
129583
129692
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
129584
129693
|
}
|
|
129585
129694
|
return { dir: desiredDir };
|
|
@@ -130388,7 +130497,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130388
130497
|
}
|
|
130389
130498
|
}
|
|
130390
130499
|
var import_child_process14 = require("child_process");
|
|
130391
|
-
var
|
|
130500
|
+
var fs59 = __toESM2(require("fs"));
|
|
130392
130501
|
var os30 = __toESM2(require("os"));
|
|
130393
130502
|
var path57 = __toESM2(require("path"));
|
|
130394
130503
|
var import_session_host_core14 = require_dist();
|
|
@@ -130414,7 +130523,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130414
130523
|
path57.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
|
|
130415
130524
|
];
|
|
130416
130525
|
for (const candidate of packagedCandidates) {
|
|
130417
|
-
if (
|
|
130526
|
+
if (fs59.existsSync(candidate)) {
|
|
130418
130527
|
return candidate;
|
|
130419
130528
|
}
|
|
130420
130529
|
}
|
|
@@ -130434,8 +130543,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130434
130543
|
function getPid() {
|
|
130435
130544
|
try {
|
|
130436
130545
|
const pidFile = getPidFile();
|
|
130437
|
-
if (!
|
|
130438
|
-
const pid = Number.parseInt(
|
|
130546
|
+
if (!fs59.existsSync(pidFile)) return null;
|
|
130547
|
+
const pid = Number.parseInt(fs59.readFileSync(pidFile, "utf8").trim(), 10);
|
|
130439
130548
|
return Number.isFinite(pid) ? pid : null;
|
|
130440
130549
|
} catch {
|
|
130441
130550
|
return null;
|
|
@@ -130485,7 +130594,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130485
130594
|
if (markerIndex === -1) return;
|
|
130486
130595
|
const activePrefix = entry.slice(0, markerIndex);
|
|
130487
130596
|
const candidates = resolveConptyPrebuildCandidates(activePrefix);
|
|
130488
|
-
const found = candidates.find((candidate) =>
|
|
130597
|
+
const found = candidates.find((candidate) => fs59.existsSync(candidate));
|
|
130489
130598
|
if (!found) {
|
|
130490
130599
|
throw new Error(
|
|
130491
130600
|
`conpty.node missing at boot despite passing the install-time gate \u2014 likely deleted post-install (checked: ${candidates.join(", ")}). Every session-host spawn would crash requiring node-pty; refusing to spawn.`
|
|
@@ -130501,8 +130610,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130501
130610
|
let logFd = null;
|
|
130502
130611
|
if (options.spawnStdio === "logfile") {
|
|
130503
130612
|
const logDir = path57.join(instance().configDir, "logs");
|
|
130504
|
-
|
|
130505
|
-
logFd =
|
|
130613
|
+
fs59.mkdirSync(logDir, { recursive: true });
|
|
130614
|
+
logFd = fs59.openSync(path57.join(logDir, "session-host.log"), "a");
|
|
130506
130615
|
stdio = ["ignore", logFd, logFd];
|
|
130507
130616
|
}
|
|
130508
130617
|
const child = (0, import_child_process14.spawn)(nodeExecutable, [entry], {
|
|
@@ -130514,7 +130623,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130514
130623
|
child.unref();
|
|
130515
130624
|
if (logFd !== null) {
|
|
130516
130625
|
try {
|
|
130517
|
-
|
|
130626
|
+
fs59.closeSync(logFd);
|
|
130518
130627
|
} catch {
|
|
130519
130628
|
}
|
|
130520
130629
|
}
|
|
@@ -130532,8 +130641,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130532
130641
|
const pidFile = getPidFile();
|
|
130533
130642
|
let keepPidFile = false;
|
|
130534
130643
|
try {
|
|
130535
|
-
if (
|
|
130536
|
-
const pid = Number.parseInt(
|
|
130644
|
+
if (fs59.existsSync(pidFile)) {
|
|
130645
|
+
const pid = Number.parseInt(fs59.readFileSync(pidFile, "utf8").trim(), 10);
|
|
130537
130646
|
if (Number.isFinite(pid) && pid !== process.pid) {
|
|
130538
130647
|
const managed = isManagedPid(pid);
|
|
130539
130648
|
if (managed) {
|
|
@@ -130553,7 +130662,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130553
130662
|
} finally {
|
|
130554
130663
|
if (!keepPidFile) {
|
|
130555
130664
|
try {
|
|
130556
|
-
|
|
130665
|
+
fs59.unlinkSync(pidFile);
|
|
130557
130666
|
} catch {
|
|
130558
130667
|
}
|
|
130559
130668
|
}
|
|
@@ -130589,7 +130698,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130589
130698
|
}
|
|
130590
130699
|
if (!reported) return;
|
|
130591
130700
|
if (pathsEquivalent(reported, currentEntry)) return;
|
|
130592
|
-
const reportedExists =
|
|
130701
|
+
const reportedExists = fs59.existsSync(reported);
|
|
130593
130702
|
LOG2.warn(
|
|
130594
130703
|
"SessionHost",
|
|
130595
130704
|
`Reachable session-host reports it is running from ${reported}${reportedExists ? "" : " (which no longer exists)"}, but this install runs from ${currentEntry}. That host would fail every create_session loading node-pty from its own prefix; stopping it so a current one is spawned in its place.`
|
|
@@ -130816,8 +130925,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130816
130925
|
const res = await fetch(extension.vsixUrl);
|
|
130817
130926
|
if (res.ok) {
|
|
130818
130927
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
130819
|
-
const
|
|
130820
|
-
|
|
130928
|
+
const fs61 = await import("fs");
|
|
130929
|
+
fs61.writeFileSync(vsixPath, buffer);
|
|
130821
130930
|
return new Promise((resolve30) => {
|
|
130822
130931
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
130823
130932
|
(0, import_child_process15.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
@@ -130963,7 +131072,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
130963
131072
|
init_mesh_events();
|
|
130964
131073
|
init_mesh_reconcile_loop();
|
|
130965
131074
|
var import_fs19 = require("fs");
|
|
130966
|
-
var
|
|
131075
|
+
var import_path21 = require("path");
|
|
130967
131076
|
var import_crypto18 = require("crypto");
|
|
130968
131077
|
init_logger();
|
|
130969
131078
|
init_mesh_ledger();
|
|
@@ -131041,7 +131150,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
131041
131150
|
}
|
|
131042
131151
|
for (const name of names) {
|
|
131043
131152
|
if (!isPendingEventsFile(name)) continue;
|
|
131044
|
-
const path58 = (0,
|
|
131153
|
+
const path58 = (0, import_path21.join)(dir, name);
|
|
131045
131154
|
result.filesScanned++;
|
|
131046
131155
|
const claimed = `${path58}.migrating`;
|
|
131047
131156
|
try {
|
|
@@ -131820,7 +131929,7 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
|
|
|
131820
131929
|
Object.values(V1_PRIMITIVE_CATALOG).flat()
|
|
131821
131930
|
);
|
|
131822
131931
|
var V1_CONTRACT_VERSION = "1.0.0";
|
|
131823
|
-
var
|
|
131932
|
+
var fs60 = __toESM2(require("fs"));
|
|
131824
131933
|
var import_chalk2 = __toESM2((init_source(), __toCommonJS(source_exports)));
|
|
131825
131934
|
init_dist();
|
|
131826
131935
|
var CLAUDE_NO_API_LINE = "Claude has no quota API \u2014 adhdev borrows your statusLine to read it.";
|
|
@@ -131931,7 +132040,7 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
|
|
|
131931
132040
|
console.log(import_chalk2.default.gray(` Backup: ${status.paths.backupFile}`));
|
|
131932
132041
|
let snapshotMtimeMs = null;
|
|
131933
132042
|
try {
|
|
131934
|
-
snapshotMtimeMs =
|
|
132043
|
+
snapshotMtimeMs = fs60.statSync(status.paths.snapshotFile).mtimeMs;
|
|
131935
132044
|
} catch {
|
|
131936
132045
|
}
|
|
131937
132046
|
console.log(import_chalk2.default.gray(
|