@adhdev/daemon-standalone 0.9.82-rc.301 → 0.9.82-rc.303
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 +579 -514
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29784,6 +29784,7 @@ var require_dist3 = __commonJS({
|
|
|
29784
29784
|
});
|
|
29785
29785
|
var git_executor_exports = {};
|
|
29786
29786
|
__export2(git_executor_exports, {
|
|
29787
|
+
GIT_STATUS_TIMEOUT_MS: () => GIT_STATUS_TIMEOUT_MS,
|
|
29787
29788
|
GitCommandError: () => GitCommandError,
|
|
29788
29789
|
isPathInside: () => isPathInside,
|
|
29789
29790
|
normalizeGitOutput: () => normalizeGitOutput,
|
|
@@ -29956,6 +29957,7 @@ var require_dist3 = __commonJS({
|
|
|
29956
29957
|
var execFileAsync;
|
|
29957
29958
|
var DEFAULT_TIMEOUT_MS;
|
|
29958
29959
|
var DEFAULT_MAX_BUFFER;
|
|
29960
|
+
var GIT_STATUS_TIMEOUT_MS;
|
|
29959
29961
|
var GitCommandError;
|
|
29960
29962
|
var init_git_executor = __esm2({
|
|
29961
29963
|
"src/git/git-executor.ts"() {
|
|
@@ -29968,6 +29970,7 @@ var require_dist3 = __commonJS({
|
|
|
29968
29970
|
execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
29969
29971
|
DEFAULT_TIMEOUT_MS = 5e3;
|
|
29970
29972
|
DEFAULT_MAX_BUFFER = 1024 * 1024;
|
|
29973
|
+
GIT_STATUS_TIMEOUT_MS = process.platform === "win32" ? 3e4 : 2e4;
|
|
29971
29974
|
GitCommandError = class extends Error {
|
|
29972
29975
|
reason;
|
|
29973
29976
|
stdout;
|
|
@@ -30001,10 +30004,10 @@ var require_dist3 = __commonJS({
|
|
|
30001
30004
|
}
|
|
30002
30005
|
function getDaemonBuildInfo() {
|
|
30003
30006
|
if (cached2) return cached2;
|
|
30004
|
-
const commit = readInjected(true ? "
|
|
30005
|
-
const commitShort = readInjected(true ? "
|
|
30006
|
-
const version2 = readInjected(true ? "0.9.82-rc.
|
|
30007
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
30007
|
+
const commit = readInjected(true ? "21741b4b2d3c1f2ed8a280045e6158b2730391ed" : void 0) ?? "unknown";
|
|
30008
|
+
const commitShort = readInjected(true ? "21741b4b" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
30009
|
+
const version2 = readInjected(true ? "0.9.82-rc.303" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
30010
|
+
const builtAt = readInjected(true ? "2026-06-17T04:16:33.179Z" : void 0);
|
|
30008
30011
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
30009
30012
|
return cached2;
|
|
30010
30013
|
}
|
|
@@ -30014,65 +30017,80 @@ var require_dist3 = __commonJS({
|
|
|
30014
30017
|
"use strict";
|
|
30015
30018
|
}
|
|
30016
30019
|
});
|
|
30020
|
+
function isTransientGitFailure(error48) {
|
|
30021
|
+
return error48.reason === "timeout" || error48.reason === "git_command_failed";
|
|
30022
|
+
}
|
|
30017
30023
|
async function getGitRepoStatus(workspace, options = {}) {
|
|
30018
30024
|
const lastCheckedAt = Date.now();
|
|
30019
30025
|
const includeSubmodules = options.includeSubmodules !== false;
|
|
30026
|
+
const effectiveOptions = options.timeoutMs === void 0 ? { ...options, timeoutMs: GIT_STATUS_TIMEOUT_MS } : options;
|
|
30020
30027
|
try {
|
|
30021
|
-
const repo = await resolveGitRepository(workspace,
|
|
30022
|
-
|
|
30023
|
-
|
|
30024
|
-
|
|
30025
|
-
upstreamProbe = await refreshTrackedUpstream(repo, parsed, options);
|
|
30026
|
-
if (upstreamProbe.upstreamStatus === "fresh") {
|
|
30027
|
-
parsed = await readPorcelainStatus(repo, options);
|
|
30028
|
-
}
|
|
30029
|
-
}
|
|
30030
|
-
const head = await readHead(repo, options);
|
|
30031
|
-
const stashCount = await readStashCount(repo, options);
|
|
30032
|
-
let submodules;
|
|
30033
|
-
if (includeSubmodules) {
|
|
30034
|
-
submodules = await getSubmoduleStatuses(repo, options);
|
|
30035
|
-
}
|
|
30036
|
-
const submoduleDirty = (submodules || []).some((submodule) => submodule.dirty || submodule.outOfSync || !!submodule.error);
|
|
30037
|
-
const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0 || parsed.conflictFiles.length > 0 || stashCount > 0 || submoduleDirty;
|
|
30038
|
-
const daemonBuildBehind = await detectDaemonBuildBehind(repo, submodules, options);
|
|
30039
|
-
return {
|
|
30040
|
-
workspace: repo.workspace,
|
|
30041
|
-
repoRoot: repo.repoRoot,
|
|
30042
|
-
isGitRepo: true,
|
|
30043
|
-
branch: parsed.branch,
|
|
30044
|
-
headCommit: head.commit,
|
|
30045
|
-
headMessage: head.message,
|
|
30046
|
-
upstream: parsed.upstream,
|
|
30047
|
-
upstreamStatus: parsed.upstream ? upstreamProbe.upstreamStatus : "no_upstream",
|
|
30048
|
-
upstreamFetchedAt: upstreamProbe.upstreamFetchedAt,
|
|
30049
|
-
upstreamFetchError: upstreamProbe.upstreamFetchError,
|
|
30050
|
-
ahead: parsed.ahead,
|
|
30051
|
-
behind: parsed.behind,
|
|
30052
|
-
staged: parsed.staged,
|
|
30053
|
-
modified: parsed.modified,
|
|
30054
|
-
untracked: parsed.untracked,
|
|
30055
|
-
deleted: parsed.deleted,
|
|
30056
|
-
renamed: parsed.renamed,
|
|
30057
|
-
dirty,
|
|
30058
|
-
hasConflicts: parsed.conflictFiles.length > 0,
|
|
30059
|
-
conflictFiles: parsed.conflictFiles,
|
|
30060
|
-
stashCount,
|
|
30061
|
-
lastCheckedAt,
|
|
30062
|
-
submodules,
|
|
30063
|
-
...daemonBuildBehind ? { daemonBuildBehind } : {}
|
|
30064
|
-
};
|
|
30028
|
+
const repo = await resolveGitRepository(workspace, effectiveOptions);
|
|
30029
|
+
const status = await collectGitRepoStatus(repo, includeSubmodules, lastCheckedAt, effectiveOptions);
|
|
30030
|
+
lastKnownGoodStatus.set(workspace, status);
|
|
30031
|
+
return status;
|
|
30065
30032
|
} catch (error48) {
|
|
30066
|
-
|
|
30067
|
-
|
|
30033
|
+
const gitError = error48 instanceof GitCommandError ? error48 : new GitCommandError("git_command_failed", "Failed to read Git status", { cause: error48 });
|
|
30034
|
+
if (isTransientGitFailure(gitError)) {
|
|
30035
|
+
const cached22 = lastKnownGoodStatus.get(workspace);
|
|
30036
|
+
if (cached22) {
|
|
30037
|
+
return {
|
|
30038
|
+
...cached22,
|
|
30039
|
+
lastCheckedAt,
|
|
30040
|
+
upstreamStatus: "unavailable",
|
|
30041
|
+
error: gitError.stderr || gitError.message,
|
|
30042
|
+
reason: gitError.reason
|
|
30043
|
+
};
|
|
30044
|
+
}
|
|
30068
30045
|
}
|
|
30069
|
-
return emptyStatus(
|
|
30070
|
-
workspace,
|
|
30071
|
-
lastCheckedAt,
|
|
30072
|
-
new GitCommandError("git_command_failed", "Failed to read Git status", { cause: error48 })
|
|
30073
|
-
);
|
|
30046
|
+
return emptyStatus(workspace, lastCheckedAt, gitError);
|
|
30074
30047
|
}
|
|
30075
30048
|
}
|
|
30049
|
+
async function collectGitRepoStatus(repo, includeSubmodules, lastCheckedAt, options) {
|
|
30050
|
+
let parsed = await readPorcelainStatus(repo, options);
|
|
30051
|
+
let upstreamProbe = getInitialUpstreamProbe(parsed);
|
|
30052
|
+
if (options.refreshUpstream) {
|
|
30053
|
+
upstreamProbe = await refreshTrackedUpstream(repo, parsed, options);
|
|
30054
|
+
if (upstreamProbe.upstreamStatus === "fresh") {
|
|
30055
|
+
parsed = await readPorcelainStatus(repo, options);
|
|
30056
|
+
}
|
|
30057
|
+
}
|
|
30058
|
+
const head = await readHead(repo, options);
|
|
30059
|
+
const stashCount = await readStashCount(repo, options);
|
|
30060
|
+
let submodules;
|
|
30061
|
+
if (includeSubmodules) {
|
|
30062
|
+
submodules = await getSubmoduleStatuses(repo, options);
|
|
30063
|
+
}
|
|
30064
|
+
const submoduleDirty = (submodules || []).some((submodule) => submodule.dirty || submodule.outOfSync || !!submodule.error);
|
|
30065
|
+
const dirty = parsed.staged + parsed.modified + parsed.untracked + parsed.deleted + parsed.renamed > 0 || parsed.conflictFiles.length > 0 || stashCount > 0 || submoduleDirty;
|
|
30066
|
+
const daemonBuildBehind = await detectDaemonBuildBehind(repo, submodules, options);
|
|
30067
|
+
return {
|
|
30068
|
+
workspace: repo.workspace,
|
|
30069
|
+
repoRoot: repo.repoRoot,
|
|
30070
|
+
isGitRepo: true,
|
|
30071
|
+
branch: parsed.branch,
|
|
30072
|
+
headCommit: head.commit,
|
|
30073
|
+
headMessage: head.message,
|
|
30074
|
+
upstream: parsed.upstream,
|
|
30075
|
+
upstreamStatus: parsed.upstream ? upstreamProbe.upstreamStatus : "no_upstream",
|
|
30076
|
+
upstreamFetchedAt: upstreamProbe.upstreamFetchedAt,
|
|
30077
|
+
upstreamFetchError: upstreamProbe.upstreamFetchError,
|
|
30078
|
+
ahead: parsed.ahead,
|
|
30079
|
+
behind: parsed.behind,
|
|
30080
|
+
staged: parsed.staged,
|
|
30081
|
+
modified: parsed.modified,
|
|
30082
|
+
untracked: parsed.untracked,
|
|
30083
|
+
deleted: parsed.deleted,
|
|
30084
|
+
renamed: parsed.renamed,
|
|
30085
|
+
dirty,
|
|
30086
|
+
hasConflicts: parsed.conflictFiles.length > 0,
|
|
30087
|
+
conflictFiles: parsed.conflictFiles,
|
|
30088
|
+
stashCount,
|
|
30089
|
+
lastCheckedAt,
|
|
30090
|
+
submodules,
|
|
30091
|
+
...daemonBuildBehind ? { daemonBuildBehind } : {}
|
|
30092
|
+
};
|
|
30093
|
+
}
|
|
30076
30094
|
function isNonRuntimeRootFile(file2) {
|
|
30077
30095
|
const base = file2.slice(file2.lastIndexOf("/") + 1);
|
|
30078
30096
|
if (/^\.(?:verify|marker|converge|ff-verify|patch-equiv|live-verify)\b/i.test(base)) return true;
|
|
@@ -30313,7 +30331,7 @@ var require_dist3 = __commonJS({
|
|
|
30313
30331
|
async function getSubmoduleStatuses(repo, options) {
|
|
30314
30332
|
if (!repo.repoRoot) return [];
|
|
30315
30333
|
try {
|
|
30316
|
-
const result = await runGit(repo, ["submodule", "status"
|
|
30334
|
+
const result = await runGit(repo, ["submodule", "status"], options);
|
|
30317
30335
|
const submodules = parseSubmoduleStatusOutput(result.stdout, repo.repoRoot, options.submoduleIgnorePaths);
|
|
30318
30336
|
await Promise.all(submodules.map((submodule) => enrichSubmoduleWorktreeStatus(repo, submodule, options)));
|
|
30319
30337
|
return submodules;
|
|
@@ -30344,12 +30362,12 @@ var require_dist3 = __commonJS({
|
|
|
30344
30362
|
if (!match) continue;
|
|
30345
30363
|
const prefix = match[1];
|
|
30346
30364
|
const commit = match[2];
|
|
30347
|
-
const
|
|
30348
|
-
if (ignoreSet.has(
|
|
30365
|
+
const path41 = match[3];
|
|
30366
|
+
if (ignoreSet.has(path41)) continue;
|
|
30349
30367
|
submodules.push({
|
|
30350
|
-
path:
|
|
30368
|
+
path: path41,
|
|
30351
30369
|
commit,
|
|
30352
|
-
repoPath: repoRoot + "/" +
|
|
30370
|
+
repoPath: repoRoot + "/" + path41,
|
|
30353
30371
|
dirty: prefix === "U",
|
|
30354
30372
|
outOfSync: prefix === "-" || prefix === "+",
|
|
30355
30373
|
lastCheckedAt: Date.now()
|
|
@@ -30357,6 +30375,7 @@ var require_dist3 = __commonJS({
|
|
|
30357
30375
|
}
|
|
30358
30376
|
return submodules;
|
|
30359
30377
|
}
|
|
30378
|
+
var lastKnownGoodStatus;
|
|
30360
30379
|
var DAEMON_RUNTIME_PACKAGES;
|
|
30361
30380
|
var WEB_ONLY_PACKAGES;
|
|
30362
30381
|
var init_git_status = __esm2({
|
|
@@ -30364,6 +30383,7 @@ var require_dist3 = __commonJS({
|
|
|
30364
30383
|
"use strict";
|
|
30365
30384
|
init_git_executor();
|
|
30366
30385
|
init_build_info();
|
|
30386
|
+
lastKnownGoodStatus = /* @__PURE__ */ new Map();
|
|
30367
30387
|
DAEMON_RUNTIME_PACKAGES = /* @__PURE__ */ new Set([
|
|
30368
30388
|
"daemon-core",
|
|
30369
30389
|
"daemon-standalone",
|
|
@@ -31179,10 +31199,10 @@ ${error48.message || ""}`;
|
|
|
31179
31199
|
return (0, import_path22.join)(getConfigDir(), "meshes.json");
|
|
31180
31200
|
}
|
|
31181
31201
|
function loadMeshConfig() {
|
|
31182
|
-
const
|
|
31183
|
-
if (!(0, import_fs2.existsSync)(
|
|
31202
|
+
const path41 = getMeshConfigPath();
|
|
31203
|
+
if (!(0, import_fs2.existsSync)(path41)) return { meshes: [] };
|
|
31184
31204
|
try {
|
|
31185
|
-
const raw = JSON.parse((0, import_fs2.readFileSync)(
|
|
31205
|
+
const raw = JSON.parse((0, import_fs2.readFileSync)(path41, "utf-8"));
|
|
31186
31206
|
if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
|
|
31187
31207
|
return raw;
|
|
31188
31208
|
} catch {
|
|
@@ -31200,16 +31220,16 @@ ${error48.message || ""}`;
|
|
|
31200
31220
|
return tags.length ? tags : void 0;
|
|
31201
31221
|
}
|
|
31202
31222
|
function saveMeshConfig(config2) {
|
|
31203
|
-
const
|
|
31204
|
-
(0, import_fs2.writeFileSync)(
|
|
31223
|
+
const path41 = getMeshConfigPath();
|
|
31224
|
+
(0, import_fs2.writeFileSync)(path41, JSON.stringify(config2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
31205
31225
|
}
|
|
31206
31226
|
function normalizeRepoIdentity(remoteUrl) {
|
|
31207
31227
|
let identity = remoteUrl.trim();
|
|
31208
31228
|
if (identity.startsWith("http://") || identity.startsWith("https://")) {
|
|
31209
31229
|
try {
|
|
31210
31230
|
const url2 = new URL(identity);
|
|
31211
|
-
const
|
|
31212
|
-
return `${url2.hostname}/${
|
|
31231
|
+
const path41 = url2.pathname.replace(/^\//, "").replace(/\.git$/, "");
|
|
31232
|
+
return `${url2.hostname}/${path41}`;
|
|
31213
31233
|
} catch {
|
|
31214
31234
|
}
|
|
31215
31235
|
}
|
|
@@ -31896,10 +31916,10 @@ Follow these recovery rules:
|
|
|
31896
31916
|
}
|
|
31897
31917
|
}
|
|
31898
31918
|
function readArchivedCounts(meshId) {
|
|
31899
|
-
const
|
|
31900
|
-
if (!(0, import_fs3.existsSync)(
|
|
31919
|
+
const path41 = getArchivedCountsPath(meshId);
|
|
31920
|
+
if (!(0, import_fs3.existsSync)(path41)) return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
|
|
31901
31921
|
try {
|
|
31902
|
-
return JSON.parse((0, import_fs3.readFileSync)(
|
|
31922
|
+
return JSON.parse((0, import_fs3.readFileSync)(path41, "utf-8"));
|
|
31903
31923
|
} catch {
|
|
31904
31924
|
return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
|
|
31905
31925
|
}
|
|
@@ -33328,10 +33348,10 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
33328
33348
|
this.migratedMeshIds.add(meshId);
|
|
33329
33349
|
const count = this.db.prepare("SELECT COUNT(*) AS count FROM mesh_queue WHERE mesh_id = ?").get(meshId);
|
|
33330
33350
|
if (count.count > 0) return;
|
|
33331
|
-
const
|
|
33332
|
-
if (!(0, import_fs4.existsSync)(
|
|
33351
|
+
const path41 = legacyQueuePath(meshId);
|
|
33352
|
+
if (!(0, import_fs4.existsSync)(path41)) return;
|
|
33333
33353
|
try {
|
|
33334
|
-
const entries = JSON.parse((0, import_fs4.readFileSync)(
|
|
33354
|
+
const entries = JSON.parse((0, import_fs4.readFileSync)(path41, "utf-8"));
|
|
33335
33355
|
if (!Array.isArray(entries)) return;
|
|
33336
33356
|
const insert = this.db.prepare(`
|
|
33337
33357
|
INSERT OR REPLACE INTO mesh_queue (
|
|
@@ -35097,8 +35117,8 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35097
35117
|
}
|
|
35098
35118
|
const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
|
|
35099
35119
|
if (mcpConfig.mode === "auto_import") {
|
|
35100
|
-
const
|
|
35101
|
-
if (!
|
|
35120
|
+
const path41 = mcpConfig.path?.trim();
|
|
35121
|
+
if (!path41) {
|
|
35102
35122
|
return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
|
|
35103
35123
|
}
|
|
35104
35124
|
const mcpServer = resolveAdhdevMcpServerLaunch({
|
|
@@ -35118,7 +35138,7 @@ Valid status values: \`completed\` | \`failed\` | \`blocked\` | \`partial\`.`;
|
|
|
35118
35138
|
return {
|
|
35119
35139
|
kind: "auto_import",
|
|
35120
35140
|
serverName,
|
|
35121
|
-
configPath: resolveMcpConfigPath(
|
|
35141
|
+
configPath: resolveMcpConfigPath(path41, workspace),
|
|
35122
35142
|
configFormat: mcpConfig.format,
|
|
35123
35143
|
mcpServer
|
|
35124
35144
|
};
|
|
@@ -36135,12 +36155,12 @@ ${rendered}`, "utf-8");
|
|
|
36135
36155
|
if (!Array.isArray(value)) return void 0;
|
|
36136
36156
|
const submodules = value.map((entry) => {
|
|
36137
36157
|
const submodule = readRecord3(entry);
|
|
36138
|
-
const
|
|
36158
|
+
const path41 = readString5(submodule.path);
|
|
36139
36159
|
const commit = readString5(submodule.commit);
|
|
36140
|
-
const repoPath = readString5(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot,
|
|
36141
|
-
if (!
|
|
36160
|
+
const repoPath = readString5(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path41);
|
|
36161
|
+
if (!path41 || !commit) return null;
|
|
36142
36162
|
const result = {
|
|
36143
|
-
path:
|
|
36163
|
+
path: path41,
|
|
36144
36164
|
commit,
|
|
36145
36165
|
dirty: readBoolean(submodule.dirty) ?? false,
|
|
36146
36166
|
outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
|
|
@@ -36535,10 +36555,10 @@ Next step: ${nextStep}`;
|
|
|
36535
36555
|
const primaryDaemonId = daemonIds[0];
|
|
36536
36556
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
36537
36557
|
const events = [];
|
|
36538
|
-
for (const
|
|
36539
|
-
if (!(0, import_fs8.existsSync)(
|
|
36558
|
+
for (const path41 of paths) {
|
|
36559
|
+
if (!(0, import_fs8.existsSync)(path41)) continue;
|
|
36540
36560
|
try {
|
|
36541
|
-
const raw = (0, import_fs8.readFileSync)(
|
|
36561
|
+
const raw = (0, import_fs8.readFileSync)(path41, "utf-8");
|
|
36542
36562
|
const parsed = raw.split("\n").filter(Boolean).flatMap((line) => {
|
|
36543
36563
|
try {
|
|
36544
36564
|
return [JSON.parse(line)];
|
|
@@ -36546,7 +36566,7 @@ Next step: ${nextStep}`;
|
|
|
36546
36566
|
return [];
|
|
36547
36567
|
}
|
|
36548
36568
|
});
|
|
36549
|
-
const filtered = primaryDaemonId &&
|
|
36569
|
+
const filtered = primaryDaemonId && path41 === getPendingEventsPath(meshId) ? parsed.filter((e) => !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId)) : parsed;
|
|
36550
36570
|
events.push(...filtered);
|
|
36551
36571
|
} catch {
|
|
36552
36572
|
}
|
|
@@ -36611,13 +36631,13 @@ Next step: ${nextStep}`;
|
|
|
36611
36631
|
const reconciled = terminalJobIds.size === 0 ? events : events.filter((event) => !(event.event === "refine:accepted" && terminalJobIds.has(readRefineJobId2(event))));
|
|
36612
36632
|
return backfilled.length === 0 ? reconciled : [...reconciled, ...backfilled];
|
|
36613
36633
|
}
|
|
36614
|
-
function trimPendingEventsIfNeeded(
|
|
36634
|
+
function trimPendingEventsIfNeeded(path41) {
|
|
36615
36635
|
try {
|
|
36616
|
-
if (!(0, import_fs8.existsSync)(
|
|
36617
|
-
if ((0, import_fs8.statSync)(
|
|
36618
|
-
const lines = (0, import_fs8.readFileSync)(
|
|
36636
|
+
if (!(0, import_fs8.existsSync)(path41)) return;
|
|
36637
|
+
if ((0, import_fs8.statSync)(path41).size <= MAX_PENDING_EVENTS_BYTES) return;
|
|
36638
|
+
const lines = (0, import_fs8.readFileSync)(path41, "utf-8").split("\n").filter(Boolean);
|
|
36619
36639
|
if (lines.length <= MAX_PENDING_EVENTS_KEEP) return;
|
|
36620
|
-
(0, import_fs8.writeFileSync)(
|
|
36640
|
+
(0, import_fs8.writeFileSync)(path41, lines.slice(-MAX_PENDING_EVENTS_KEEP).join("\n") + "\n", "utf-8");
|
|
36621
36641
|
} catch {
|
|
36622
36642
|
}
|
|
36623
36643
|
}
|
|
@@ -36644,19 +36664,19 @@ Next step: ${nextStep}`;
|
|
|
36644
36664
|
});
|
|
36645
36665
|
} catch {
|
|
36646
36666
|
}
|
|
36647
|
-
const
|
|
36648
|
-
trimPendingEventsIfNeeded(
|
|
36649
|
-
(0, import_fs8.appendFileSync)(
|
|
36667
|
+
const path41 = getPendingEventsPath(event.meshId, event.targetCoordinatorDaemonId);
|
|
36668
|
+
trimPendingEventsIfNeeded(path41);
|
|
36669
|
+
(0, import_fs8.appendFileSync)(path41, JSON.stringify(event) + "\n", "utf-8");
|
|
36650
36670
|
return true;
|
|
36651
36671
|
} catch (e) {
|
|
36652
36672
|
LOG2.warn("MeshEvents", `Failed to persist pending coordinator event: ${e?.message || e}`);
|
|
36653
36673
|
return false;
|
|
36654
36674
|
}
|
|
36655
36675
|
}
|
|
36656
|
-
function atomicDrainFile(
|
|
36657
|
-
const tmpPath = `${
|
|
36676
|
+
function atomicDrainFile(path41) {
|
|
36677
|
+
const tmpPath = `${path41}.draining`;
|
|
36658
36678
|
try {
|
|
36659
|
-
(0, import_fs8.renameSync)(
|
|
36679
|
+
(0, import_fs8.renameSync)(path41, tmpPath);
|
|
36660
36680
|
} catch {
|
|
36661
36681
|
return null;
|
|
36662
36682
|
}
|
|
@@ -36675,10 +36695,10 @@ Next step: ${nextStep}`;
|
|
|
36675
36695
|
return null;
|
|
36676
36696
|
}
|
|
36677
36697
|
}
|
|
36678
|
-
function selectiveDrainFile(
|
|
36679
|
-
const tmpPath = `${
|
|
36698
|
+
function selectiveDrainFile(path41, predicate) {
|
|
36699
|
+
const tmpPath = `${path41}.draining`;
|
|
36680
36700
|
try {
|
|
36681
|
-
(0, import_fs8.renameSync)(
|
|
36701
|
+
(0, import_fs8.renameSync)(path41, tmpPath);
|
|
36682
36702
|
} catch {
|
|
36683
36703
|
return [];
|
|
36684
36704
|
}
|
|
@@ -36710,12 +36730,12 @@ Next step: ${nextStep}`;
|
|
|
36710
36730
|
}
|
|
36711
36731
|
try {
|
|
36712
36732
|
if (keptLines.length > 0) {
|
|
36713
|
-
(0, import_fs8.writeFileSync)(
|
|
36733
|
+
(0, import_fs8.writeFileSync)(path41, keptLines.join("\n") + "\n", "utf-8");
|
|
36714
36734
|
}
|
|
36715
36735
|
(0, import_fs8.unlinkSync)(tmpPath);
|
|
36716
36736
|
} catch {
|
|
36717
36737
|
try {
|
|
36718
|
-
if ((0, import_fs8.existsSync)(tmpPath) && !(0, import_fs8.existsSync)(
|
|
36738
|
+
if ((0, import_fs8.existsSync)(tmpPath) && !(0, import_fs8.existsSync)(path41)) (0, import_fs8.renameSync)(tmpPath, path41);
|
|
36719
36739
|
} catch {
|
|
36720
36740
|
}
|
|
36721
36741
|
return [];
|
|
@@ -36749,16 +36769,16 @@ Next step: ${nextStep}`;
|
|
|
36749
36769
|
} catch {
|
|
36750
36770
|
}
|
|
36751
36771
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
36752
|
-
for (const
|
|
36753
|
-
const isSharedFile = !!primaryDaemonId &&
|
|
36772
|
+
for (const path41 of paths) {
|
|
36773
|
+
const isSharedFile = !!primaryDaemonId && path41 === getPendingEventsPath(meshId);
|
|
36754
36774
|
const targets = (e) => !isSharedFile || !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId);
|
|
36755
36775
|
if (onlyEvents) {
|
|
36756
|
-
for (const event of selectiveDrainFile(
|
|
36776
|
+
for (const event of selectiveDrainFile(path41, (e) => targets(e) && matchesFilter(e.event))) {
|
|
36757
36777
|
pushUnique(event);
|
|
36758
36778
|
}
|
|
36759
36779
|
continue;
|
|
36760
36780
|
}
|
|
36761
|
-
const content = atomicDrainFile(
|
|
36781
|
+
const content = atomicDrainFile(path41);
|
|
36762
36782
|
if (!content) continue;
|
|
36763
36783
|
const parsed = content.split("\n").filter(Boolean).flatMap((line) => {
|
|
36764
36784
|
try {
|
|
@@ -36808,9 +36828,9 @@ Next step: ${nextStep}`;
|
|
|
36808
36828
|
} catch {
|
|
36809
36829
|
}
|
|
36810
36830
|
const paths = coordinatorDaemonId ? [getPendingEventsPath(meshId, coordinatorDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
36811
|
-
for (const
|
|
36812
|
-
if ((0, import_fs8.existsSync)(
|
|
36813
|
-
(0, import_fs8.unlinkSync)(
|
|
36831
|
+
for (const path41 of paths) {
|
|
36832
|
+
if ((0, import_fs8.existsSync)(path41)) try {
|
|
36833
|
+
(0, import_fs8.unlinkSync)(path41);
|
|
36814
36834
|
} catch {
|
|
36815
36835
|
}
|
|
36816
36836
|
}
|
|
@@ -39828,7 +39848,7 @@ Next step: ${nextStep}`;
|
|
|
39828
39848
|
return _cliValidator;
|
|
39829
39849
|
}
|
|
39830
39850
|
function formatIssue(err) {
|
|
39831
|
-
const
|
|
39851
|
+
const path41 = err.instancePath || "";
|
|
39832
39852
|
const params = err.params;
|
|
39833
39853
|
let message = err.message || "validation failed";
|
|
39834
39854
|
let allowed;
|
|
@@ -39846,7 +39866,7 @@ Next step: ${nextStep}`;
|
|
|
39846
39866
|
} else if (err.keyword === "type") {
|
|
39847
39867
|
message = `must be ${params.type}`;
|
|
39848
39868
|
}
|
|
39849
|
-
return { path:
|
|
39869
|
+
return { path: path41, keyword: err.keyword, message, ...allowed !== void 0 ? { allowed } : {} };
|
|
39850
39870
|
}
|
|
39851
39871
|
function validateCliProviderManifest(manifest) {
|
|
39852
39872
|
const validator = getCliValidator();
|
|
@@ -40207,6 +40227,38 @@ Next step: ${nextStep}`;
|
|
|
40207
40227
|
import_session_host_core32 = require_dist();
|
|
40208
40228
|
}
|
|
40209
40229
|
});
|
|
40230
|
+
function resolveWin32Executable(command) {
|
|
40231
|
+
if (process.platform !== "win32") return command;
|
|
40232
|
+
const trimmed = (command || "").trim();
|
|
40233
|
+
if (!trimmed) return command;
|
|
40234
|
+
if (path16.isAbsolute(trimmed) && (0, import_fs13.existsSync)(trimmed)) return trimmed;
|
|
40235
|
+
try {
|
|
40236
|
+
const out = (0, import_child_process4.execFileSync)("where", [trimmed], {
|
|
40237
|
+
encoding: "utf8",
|
|
40238
|
+
windowsHide: true
|
|
40239
|
+
}).trim();
|
|
40240
|
+
if (out) {
|
|
40241
|
+
const matches = out.split(/\r?\n/).map((s) => s.trim()).filter(Boolean);
|
|
40242
|
+
const direct = matches.find((m) => DIRECT_EXEC_EXT.has(path16.extname(m).toLowerCase()));
|
|
40243
|
+
return direct || matches[0] || command;
|
|
40244
|
+
}
|
|
40245
|
+
} catch {
|
|
40246
|
+
}
|
|
40247
|
+
return command;
|
|
40248
|
+
}
|
|
40249
|
+
var import_child_process4;
|
|
40250
|
+
var import_fs13;
|
|
40251
|
+
var path16;
|
|
40252
|
+
var DIRECT_EXEC_EXT;
|
|
40253
|
+
var init_resolve_executable = __esm2({
|
|
40254
|
+
"src/cli-adapters/resolve-executable.ts"() {
|
|
40255
|
+
"use strict";
|
|
40256
|
+
import_child_process4 = require("child_process");
|
|
40257
|
+
import_fs13 = require("fs");
|
|
40258
|
+
path16 = __toESM2(require("path"));
|
|
40259
|
+
DIRECT_EXEC_EXT = /* @__PURE__ */ new Set([".exe", ".com"]);
|
|
40260
|
+
}
|
|
40261
|
+
});
|
|
40210
40262
|
var pty_transport_exports = {};
|
|
40211
40263
|
__export2(pty_transport_exports, {
|
|
40212
40264
|
NodePtyTransportFactory: () => NodePtyTransportFactory
|
|
@@ -40230,6 +40282,7 @@ Next step: ${nextStep}`;
|
|
|
40230
40282
|
"use strict";
|
|
40231
40283
|
os11 = __toESM2(require("os"));
|
|
40232
40284
|
init_spawn_env();
|
|
40285
|
+
init_resolve_executable();
|
|
40233
40286
|
NodePtyRuntimeTransport = class {
|
|
40234
40287
|
constructor(handle) {
|
|
40235
40288
|
this.handle = handle;
|
|
@@ -40272,7 +40325,7 @@ Next step: ${nextStep}`;
|
|
|
40272
40325
|
cwd = os11.homedir();
|
|
40273
40326
|
}
|
|
40274
40327
|
}
|
|
40275
|
-
const handle = pty.spawn(command, args, {
|
|
40328
|
+
const handle = pty.spawn(resolveWin32Executable(command), args, {
|
|
40276
40329
|
name: "xterm-256color",
|
|
40277
40330
|
cols: options.cols,
|
|
40278
40331
|
rows: options.rows,
|
|
@@ -40359,17 +40412,17 @@ Next step: ${nextStep}`;
|
|
|
40359
40412
|
function findBinary(name) {
|
|
40360
40413
|
const trimmed = String(name || "").trim();
|
|
40361
40414
|
if (!trimmed) return trimmed;
|
|
40362
|
-
const expanded = trimmed.startsWith("~") ?
|
|
40363
|
-
if (
|
|
40364
|
-
return
|
|
40415
|
+
const expanded = trimmed.startsWith("~") ? path17.join(os12.homedir(), trimmed.slice(1)) : trimmed;
|
|
40416
|
+
if (path17.isAbsolute(expanded) || expanded.includes("/") || expanded.includes("\\")) {
|
|
40417
|
+
return path17.isAbsolute(expanded) ? expanded : path17.resolve(expanded);
|
|
40365
40418
|
}
|
|
40366
40419
|
const isWin = os12.platform() === "win32";
|
|
40367
|
-
const paths = (process.env.PATH || "").split(
|
|
40420
|
+
const paths = (process.env.PATH || "").split(path17.delimiter);
|
|
40368
40421
|
const exes = isWin ? [".exe", ".cmd", ".bat", ""] : [""];
|
|
40369
40422
|
for (const p of paths) {
|
|
40370
40423
|
if (!p) continue;
|
|
40371
40424
|
for (const ext of exes) {
|
|
40372
|
-
const fullPath =
|
|
40425
|
+
const fullPath = path17.join(p, trimmed + ext);
|
|
40373
40426
|
try {
|
|
40374
40427
|
const fs30 = require("fs");
|
|
40375
40428
|
if (fs30.existsSync(fullPath)) {
|
|
@@ -40385,7 +40438,7 @@ Next step: ${nextStep}`;
|
|
|
40385
40438
|
return isWin ? `${trimmed}.cmd` : trimmed;
|
|
40386
40439
|
}
|
|
40387
40440
|
function isScriptBinary(binaryPath) {
|
|
40388
|
-
if (!
|
|
40441
|
+
if (!path17.isAbsolute(binaryPath)) return false;
|
|
40389
40442
|
try {
|
|
40390
40443
|
const fs30 = require("fs");
|
|
40391
40444
|
const resolved = fs30.realpathSync(binaryPath);
|
|
@@ -40401,7 +40454,7 @@ Next step: ${nextStep}`;
|
|
|
40401
40454
|
}
|
|
40402
40455
|
}
|
|
40403
40456
|
function looksLikeMachOOrElf(filePath) {
|
|
40404
|
-
if (!
|
|
40457
|
+
if (!path17.isAbsolute(filePath)) return false;
|
|
40405
40458
|
try {
|
|
40406
40459
|
const fs30 = require("fs");
|
|
40407
40460
|
const resolved = fs30.realpathSync(filePath);
|
|
@@ -40491,14 +40544,14 @@ Next step: ${nextStep}`;
|
|
|
40491
40544
|
};
|
|
40492
40545
|
}
|
|
40493
40546
|
var os12;
|
|
40494
|
-
var
|
|
40547
|
+
var path17;
|
|
40495
40548
|
var TerminalTranscriptAccumulator;
|
|
40496
40549
|
var buildCliSpawnEnv;
|
|
40497
40550
|
var init_provider_cli_shared = __esm2({
|
|
40498
40551
|
"src/cli-adapters/provider-cli-shared.ts"() {
|
|
40499
40552
|
"use strict";
|
|
40500
40553
|
os12 = __toESM2(require("os"));
|
|
40501
|
-
|
|
40554
|
+
path17 = __toESM2(require("path"));
|
|
40502
40555
|
init_spawn_env();
|
|
40503
40556
|
TerminalTranscriptAccumulator = class {
|
|
40504
40557
|
lines = [[]];
|
|
@@ -42449,9 +42502,9 @@ ${cont}` : cont;
|
|
|
42449
42502
|
);
|
|
42450
42503
|
let shellCmd;
|
|
42451
42504
|
let shellArgs;
|
|
42452
|
-
const useShellUnix = !isWin && (!!spawnConfig.shell || !
|
|
42505
|
+
const useShellUnix = !isWin && (!!spawnConfig.shell || !path18.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
|
|
42453
42506
|
const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
|
|
42454
|
-
const useShellWin = !!spawnConfig.shell || isCmdShim || !
|
|
42507
|
+
const useShellWin = !!spawnConfig.shell || isCmdShim || !path18.isAbsolute(binaryPath) || isScriptBinary(binaryPath);
|
|
42455
42508
|
const useShell = isWin ? useShellWin : useShellUnix;
|
|
42456
42509
|
if (useShell) {
|
|
42457
42510
|
shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
|
|
@@ -42528,13 +42581,13 @@ ${cont}` : cont;
|
|
|
42528
42581
|
return "";
|
|
42529
42582
|
}
|
|
42530
42583
|
var os13;
|
|
42531
|
-
var
|
|
42584
|
+
var path18;
|
|
42532
42585
|
var import_session_host_core42;
|
|
42533
42586
|
var init_provider_cli_runtime = __esm2({
|
|
42534
42587
|
"src/cli-adapters/provider-cli-runtime.ts"() {
|
|
42535
42588
|
"use strict";
|
|
42536
42589
|
os13 = __toESM2(require("os"));
|
|
42537
|
-
|
|
42590
|
+
path18 = __toESM2(require("path"));
|
|
42538
42591
|
import_session_host_core42 = require_dist();
|
|
42539
42592
|
init_provider_cli_shared();
|
|
42540
42593
|
}
|
|
@@ -44711,40 +44764,40 @@ ${lastSnapshot}`;
|
|
|
44711
44764
|
}
|
|
44712
44765
|
return errs;
|
|
44713
44766
|
}
|
|
44714
|
-
function validateCondition(c, sectionIds,
|
|
44767
|
+
function validateCondition(c, sectionIds, path41) {
|
|
44715
44768
|
const errs = [];
|
|
44716
44769
|
const w = c;
|
|
44717
44770
|
if ("all" in w) {
|
|
44718
|
-
w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${
|
|
44771
|
+
w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path41}.all[${i}]`)));
|
|
44719
44772
|
return errs;
|
|
44720
44773
|
}
|
|
44721
44774
|
if ("any" in w) {
|
|
44722
|
-
w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${
|
|
44775
|
+
w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path41}.any[${i}]`)));
|
|
44723
44776
|
return errs;
|
|
44724
44777
|
}
|
|
44725
44778
|
if ("not" in w) {
|
|
44726
|
-
errs.push(...validateCondition(w.not, sectionIds, `${
|
|
44779
|
+
errs.push(...validateCondition(w.not, sectionIds, `${path41}.not`));
|
|
44727
44780
|
return errs;
|
|
44728
44781
|
}
|
|
44729
44782
|
if ("matches" in w) {
|
|
44730
|
-
if (w.section && !sectionIds.has(w.section)) errs.push(`${
|
|
44783
|
+
if (w.section && !sectionIds.has(w.section)) errs.push(`${path41}.section "${w.section}" unknown`);
|
|
44731
44784
|
try {
|
|
44732
44785
|
new RegExp(w.matches, w.flags ?? "i");
|
|
44733
44786
|
} catch (e) {
|
|
44734
|
-
errs.push(`${
|
|
44787
|
+
errs.push(`${path41}.matches invalid regex: ${e.message}`);
|
|
44735
44788
|
}
|
|
44736
44789
|
return errs;
|
|
44737
44790
|
}
|
|
44738
44791
|
if ("cursor_above" in w && "changed" in w) return errs;
|
|
44739
44792
|
if ("elapsed_ms" in w) {
|
|
44740
|
-
if (typeof w.elapsed_ms !== "number") errs.push(`${
|
|
44793
|
+
if (typeof w.elapsed_ms !== "number") errs.push(`${path41}.elapsed_ms must be a number`);
|
|
44741
44794
|
return errs;
|
|
44742
44795
|
}
|
|
44743
44796
|
if ("stable_ms" in w) {
|
|
44744
|
-
if (typeof w.stable_ms !== "number") errs.push(`${
|
|
44797
|
+
if (typeof w.stable_ms !== "number") errs.push(`${path41}.stable_ms must be a number`);
|
|
44745
44798
|
return errs;
|
|
44746
44799
|
}
|
|
44747
|
-
errs.push(`${
|
|
44800
|
+
errs.push(`${path41} is not a recognized condition`);
|
|
44748
44801
|
return errs;
|
|
44749
44802
|
}
|
|
44750
44803
|
var fs9;
|
|
@@ -44902,7 +44955,7 @@ ${lastSnapshot}`;
|
|
|
44902
44955
|
}
|
|
44903
44956
|
function canonicalize(p) {
|
|
44904
44957
|
try {
|
|
44905
|
-
const resolved =
|
|
44958
|
+
const resolved = path31.resolve(p);
|
|
44906
44959
|
try {
|
|
44907
44960
|
return nodeFs.realpathSync.native ? nodeFs.realpathSync.native(resolved) : nodeFs.realpathSync(resolved);
|
|
44908
44961
|
} catch {
|
|
@@ -44922,7 +44975,7 @@ ${lastSnapshot}`;
|
|
|
44922
44975
|
}
|
|
44923
44976
|
for (const root of _gatedRoots) {
|
|
44924
44977
|
if (normalized === root.rootPath) return root;
|
|
44925
|
-
if (normalized.startsWith(root.rootPath +
|
|
44978
|
+
if (normalized.startsWith(root.rootPath + path31.sep)) return root;
|
|
44926
44979
|
}
|
|
44927
44980
|
return null;
|
|
44928
44981
|
}
|
|
@@ -44941,16 +44994,16 @@ ${lastSnapshot}`;
|
|
|
44941
44994
|
};
|
|
44942
44995
|
}
|
|
44943
44996
|
function gatedRequire(request, parent, isMain, gated, originalLoad) {
|
|
44944
|
-
if (request.startsWith("./") || request.startsWith("../") ||
|
|
44997
|
+
if (request.startsWith("./") || request.startsWith("../") || path31.isAbsolute(request)) {
|
|
44945
44998
|
let resolved;
|
|
44946
44999
|
try {
|
|
44947
|
-
const callerRequire = parent?.filename ? (0, import_node_module2.createRequire)(parent.filename) : (0, import_node_module2.createRequire)(
|
|
45000
|
+
const callerRequire = parent?.filename ? (0, import_node_module2.createRequire)(parent.filename) : (0, import_node_module2.createRequire)(path31.join(gated.rootPath, "__entry__.js"));
|
|
44948
45001
|
resolved = callerRequire.resolve(request);
|
|
44949
45002
|
} catch {
|
|
44950
45003
|
return originalLoad.call(this, request, parent, isMain);
|
|
44951
45004
|
}
|
|
44952
45005
|
const resolvedCanon = canonicalize(resolved) || resolved;
|
|
44953
|
-
if (!(resolvedCanon === gated.rootPath || resolvedCanon.startsWith(gated.rootPath +
|
|
45006
|
+
if (!(resolvedCanon === gated.rootPath || resolvedCanon.startsWith(gated.rootPath + path31.sep))) {
|
|
44954
45007
|
denyRequire(request, parent, `relative path escapes provider root (resolved to ${resolvedCanon})`);
|
|
44955
45008
|
}
|
|
44956
45009
|
return originalLoad.call(this, request, parent, isMain);
|
|
@@ -44974,7 +45027,7 @@ ${lastSnapshot}`;
|
|
|
44974
45027
|
err.callerFilename = caller;
|
|
44975
45028
|
throw err;
|
|
44976
45029
|
}
|
|
44977
|
-
var
|
|
45030
|
+
var path31;
|
|
44978
45031
|
var import_node_module2;
|
|
44979
45032
|
var nodeFs;
|
|
44980
45033
|
var nodeChildProcess;
|
|
@@ -44995,7 +45048,7 @@ ${lastSnapshot}`;
|
|
|
44995
45048
|
var init_require_whitelist = __esm2({
|
|
44996
45049
|
"src/providers/sdk/v1/sandbox/require-whitelist.ts"() {
|
|
44997
45050
|
"use strict";
|
|
44998
|
-
|
|
45051
|
+
path31 = __toESM2(require("path"));
|
|
44999
45052
|
import_node_module2 = require("module");
|
|
45000
45053
|
nodeFs = __toESM2(require("fs"));
|
|
45001
45054
|
nodeChildProcess = __toESM2(require("child_process"));
|
|
@@ -47140,10 +47193,10 @@ ${lastSnapshot}`;
|
|
|
47140
47193
|
return (0, import_path5.join)(getDaemonDataDir(), "mesh-coordinators.json");
|
|
47141
47194
|
}
|
|
47142
47195
|
function loadMeshCoordinatorRegistry() {
|
|
47143
|
-
const
|
|
47144
|
-
if (!(0, import_fs5.existsSync)(
|
|
47196
|
+
const path41 = getRegistryPath();
|
|
47197
|
+
if (!(0, import_fs5.existsSync)(path41)) return;
|
|
47145
47198
|
try {
|
|
47146
|
-
const raw = JSON.parse((0, import_fs5.readFileSync)(
|
|
47199
|
+
const raw = JSON.parse((0, import_fs5.readFileSync)(path41, "utf-8"));
|
|
47147
47200
|
if (!Array.isArray(raw)) return;
|
|
47148
47201
|
_registry.clear();
|
|
47149
47202
|
for (const entry of raw) {
|
|
@@ -47379,8 +47432,8 @@ ${lastSnapshot}`;
|
|
|
47379
47432
|
if (rejectedCommands.length) errors.push("one or more validation commands are invalid");
|
|
47380
47433
|
return { valid: errors.length === 0, errors, bootstrapCommands, commands, rejectedCommands, bootstrapMode, deprecationWarnings };
|
|
47381
47434
|
}
|
|
47382
|
-
function parseConfigText(
|
|
47383
|
-
if (/\.json$/i.test(
|
|
47435
|
+
function parseConfigText(path41, text) {
|
|
47436
|
+
if (/\.json$/i.test(path41)) return JSON.parse(text);
|
|
47384
47437
|
return yaml.load(text);
|
|
47385
47438
|
}
|
|
47386
47439
|
function loadMeshRefineConfig(mesh, workspace) {
|
|
@@ -47536,8 +47589,8 @@ ${lastSnapshot}`;
|
|
|
47536
47589
|
var DEFAULT_TIMEOUT_MS2 = 12e4;
|
|
47537
47590
|
var DEFAULT_OUTPUT_LIMIT_BYTES = 128 * 1024;
|
|
47538
47591
|
var OUTPUT_SUMMARY_CHARS = 2e3;
|
|
47539
|
-
function parseConfigText2(
|
|
47540
|
-
if (/\.json$/i.test(
|
|
47592
|
+
function parseConfigText2(path41, text) {
|
|
47593
|
+
if (/\.json$/i.test(path41)) return JSON.parse(text);
|
|
47541
47594
|
return yaml2.load(text);
|
|
47542
47595
|
}
|
|
47543
47596
|
function truncateOutput(value) {
|
|
@@ -59157,8 +59210,8 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59157
59210
|
*/
|
|
59158
59211
|
getUpstreamInstallRoot() {
|
|
59159
59212
|
const os30 = require("os");
|
|
59160
|
-
const
|
|
59161
|
-
return
|
|
59213
|
+
const path41 = require("path");
|
|
59214
|
+
return path41.join(os30.homedir(), ".adhdev", "providers", ".upstream");
|
|
59162
59215
|
}
|
|
59163
59216
|
/**
|
|
59164
59217
|
* Download a single provider manifest from the registry and write it to
|
|
@@ -59183,7 +59236,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59183
59236
|
}
|
|
59184
59237
|
const https = require("https");
|
|
59185
59238
|
const fs30 = require("fs");
|
|
59186
|
-
const
|
|
59239
|
+
const path41 = require("path");
|
|
59187
59240
|
const crypto6 = require("crypto");
|
|
59188
59241
|
const REGISTRY = "https://api.adhf.dev/api/v1/registry";
|
|
59189
59242
|
function fetchText(url2, timeoutMs) {
|
|
@@ -59221,9 +59274,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
59221
59274
|
return { success: false, error: `checksum mismatch: expected ${meta3.checksum}, got ${actualChecksum}` };
|
|
59222
59275
|
}
|
|
59223
59276
|
const installRoot = this.getUpstreamInstallRoot();
|
|
59224
|
-
const installRootResolved =
|
|
59225
|
-
const targetDir =
|
|
59226
|
-
if (!targetDir.startsWith(installRootResolved +
|
|
59277
|
+
const installRootResolved = path41.resolve(installRoot);
|
|
59278
|
+
const targetDir = path41.resolve(path41.join(installRoot, category, type));
|
|
59279
|
+
if (!targetDir.startsWith(installRootResolved + path41.sep)) {
|
|
59227
59280
|
return { success: false, error: "install path escaped upstream root" };
|
|
59228
59281
|
}
|
|
59229
59282
|
fs30.mkdirSync(targetDir, { recursive: true });
|
|
@@ -59250,7 +59303,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59250
59303
|
}
|
|
59251
59304
|
}
|
|
59252
59305
|
const targetFile = isV1 ? "provider.v1.json" : "provider.json";
|
|
59253
|
-
const targetPath =
|
|
59306
|
+
const targetPath = path41.join(targetDir, targetFile);
|
|
59254
59307
|
fs30.writeFileSync(targetPath, manifestBody, "utf-8");
|
|
59255
59308
|
const manifestJson = JSON.parse(manifestBody);
|
|
59256
59309
|
const scriptFetch = await this.fetchProviderSources(
|
|
@@ -59322,7 +59375,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59322
59375
|
const ref = source.ref;
|
|
59323
59376
|
const https = require("https");
|
|
59324
59377
|
const fs30 = require("fs");
|
|
59325
|
-
const
|
|
59378
|
+
const path41 = require("path");
|
|
59326
59379
|
function fetchJson(url2, timeoutMs) {
|
|
59327
59380
|
return new Promise((resolve24, reject) => {
|
|
59328
59381
|
const req = https.get(url2, {
|
|
@@ -59378,9 +59431,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59378
59431
|
}
|
|
59379
59432
|
let fetchedCount = 0;
|
|
59380
59433
|
const sharedDirRel = `${category}/_shared`;
|
|
59381
|
-
const sharedTargetDir =
|
|
59382
|
-
const installRootResolved =
|
|
59383
|
-
if (sharedTargetDir.startsWith(installRootResolved +
|
|
59434
|
+
const sharedTargetDir = path41.resolve(path41.join(targetDir, "../_shared"));
|
|
59435
|
+
const installRootResolved = path41.resolve(path41.join(targetDir, "../.."));
|
|
59436
|
+
if (sharedTargetDir.startsWith(installRootResolved + path41.sep)) {
|
|
59384
59437
|
const sharedStack = [sharedDirRel];
|
|
59385
59438
|
while (sharedStack.length) {
|
|
59386
59439
|
const relDir = sharedStack.pop();
|
|
@@ -59403,9 +59456,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59403
59456
|
try {
|
|
59404
59457
|
const body = await fetchBinary(entry.download_url, 3e4);
|
|
59405
59458
|
const relInside = entry.path.startsWith(sharedDirRel + "/") ? entry.path.slice(sharedDirRel.length + 1) : entry.path;
|
|
59406
|
-
const outPath =
|
|
59407
|
-
if (!outPath.startsWith(
|
|
59408
|
-
fs30.mkdirSync(
|
|
59459
|
+
const outPath = path41.resolve(path41.join(sharedTargetDir, relInside));
|
|
59460
|
+
if (!outPath.startsWith(path41.resolve(sharedTargetDir) + path41.sep)) continue;
|
|
59461
|
+
fs30.mkdirSync(path41.dirname(outPath), { recursive: true });
|
|
59409
59462
|
fs30.writeFileSync(outPath, body);
|
|
59410
59463
|
fetchedCount++;
|
|
59411
59464
|
} catch (e) {
|
|
@@ -59439,12 +59492,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59439
59492
|
try {
|
|
59440
59493
|
const body = await fetchBinary(entry.download_url, 3e4);
|
|
59441
59494
|
const relInsideProvider = entry.path.startsWith(subdir + "/") ? entry.path.slice(subdir.length + 1) : entry.path;
|
|
59442
|
-
const outPath =
|
|
59443
|
-
if (!outPath.startsWith(
|
|
59495
|
+
const outPath = path41.resolve(path41.join(targetDir, relInsideProvider));
|
|
59496
|
+
if (!outPath.startsWith(path41.resolve(targetDir) + path41.sep)) {
|
|
59444
59497
|
errors.push(`refusing to write outside targetDir: ${entry.path}`);
|
|
59445
59498
|
continue;
|
|
59446
59499
|
}
|
|
59447
|
-
fs30.mkdirSync(
|
|
59500
|
+
fs30.mkdirSync(path41.dirname(outPath), { recursive: true });
|
|
59448
59501
|
fs30.writeFileSync(outPath, body);
|
|
59449
59502
|
fetchedCount++;
|
|
59450
59503
|
} catch (e) {
|
|
@@ -59474,12 +59527,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59474
59527
|
return { success: false, error: `unknown category: ${category}` };
|
|
59475
59528
|
}
|
|
59476
59529
|
const fs30 = require("fs");
|
|
59477
|
-
const
|
|
59530
|
+
const path41 = require("path");
|
|
59478
59531
|
try {
|
|
59479
59532
|
const installRoot = this.getUpstreamInstallRoot();
|
|
59480
|
-
const installRootResolved =
|
|
59481
|
-
const targetDir =
|
|
59482
|
-
if (!targetDir.startsWith(installRootResolved +
|
|
59533
|
+
const installRootResolved = path41.resolve(installRoot);
|
|
59534
|
+
const targetDir = path41.resolve(path41.join(installRoot, category, type));
|
|
59535
|
+
if (!targetDir.startsWith(installRootResolved + path41.sep)) {
|
|
59483
59536
|
return { success: false, error: "refusing to delete outside upstream root" };
|
|
59484
59537
|
}
|
|
59485
59538
|
if (!fs30.existsSync(targetDir)) {
|
|
@@ -59502,13 +59555,13 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59502
59555
|
*/
|
|
59503
59556
|
handleListInstalledProviders(_args) {
|
|
59504
59557
|
const fs30 = require("fs");
|
|
59505
|
-
const
|
|
59558
|
+
const path41 = require("path");
|
|
59506
59559
|
const installRoot = this.getUpstreamInstallRoot();
|
|
59507
59560
|
if (!fs30.existsSync(installRoot)) return { success: true, providers: [] };
|
|
59508
59561
|
const CATEGORIES = ["cli", "ide", "extension", "acp"];
|
|
59509
59562
|
const items = [];
|
|
59510
59563
|
for (const category of CATEGORIES) {
|
|
59511
|
-
const categoryDir =
|
|
59564
|
+
const categoryDir = path41.join(installRoot, category);
|
|
59512
59565
|
if (!fs30.existsSync(categoryDir)) continue;
|
|
59513
59566
|
let entries;
|
|
59514
59567
|
try {
|
|
@@ -59517,8 +59570,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59517
59570
|
continue;
|
|
59518
59571
|
}
|
|
59519
59572
|
for (const type of entries) {
|
|
59520
|
-
const v1Path =
|
|
59521
|
-
const v0Path =
|
|
59573
|
+
const v1Path = path41.join(categoryDir, type, "provider.v1.json");
|
|
59574
|
+
const v0Path = path41.join(categoryDir, type, "provider.json");
|
|
59522
59575
|
const manifestPath = fs30.existsSync(v1Path) ? v1Path : fs30.existsSync(v0Path) ? v0Path : null;
|
|
59523
59576
|
if (!manifestPath) continue;
|
|
59524
59577
|
try {
|
|
@@ -59634,7 +59687,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59634
59687
|
return { success: false, error: "name must match @[a-z0-9_-]+" };
|
|
59635
59688
|
}
|
|
59636
59689
|
const fs30 = require("fs");
|
|
59637
|
-
const
|
|
59690
|
+
const path41 = require("path");
|
|
59638
59691
|
const { spawnSync: spawnSync2 } = require("child_process");
|
|
59639
59692
|
const file2 = ext.loadExternalSources();
|
|
59640
59693
|
if (file2.sources.some((s) => s.name === requestedName)) {
|
|
@@ -59643,7 +59696,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59643
59696
|
if (file2.sources.some((s) => s.url === url2 && s.ref === ref)) {
|
|
59644
59697
|
return { success: false, error: `source url+ref already registered (use a different name to track another ref)` };
|
|
59645
59698
|
}
|
|
59646
|
-
const sourceDir =
|
|
59699
|
+
const sourceDir = path41.join(ext.externalRoot(), requestedName);
|
|
59647
59700
|
if (!fs30.existsSync(ext.externalRoot())) fs30.mkdirSync(ext.externalRoot(), { recursive: true });
|
|
59648
59701
|
if (fs30.existsSync(sourceDir)) {
|
|
59649
59702
|
return { success: false, error: `directory already exists: ${sourceDir} (rename or remove first)` };
|
|
@@ -59700,11 +59753,11 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59700
59753
|
if (!name) return { success: false, error: "name is required" };
|
|
59701
59754
|
const ext = (init_external_sources(), __toCommonJS2(external_sources_exports));
|
|
59702
59755
|
const fs30 = require("fs");
|
|
59703
|
-
const
|
|
59756
|
+
const path41 = require("path");
|
|
59704
59757
|
const file2 = ext.loadExternalSources();
|
|
59705
59758
|
const match = file2.sources.find((s) => s.name === name);
|
|
59706
59759
|
if (!match) return { success: false, error: `source "${name}" not registered` };
|
|
59707
|
-
const sourceDir =
|
|
59760
|
+
const sourceDir = path41.join(ext.externalRoot(), name);
|
|
59708
59761
|
if (fs30.existsSync(sourceDir)) {
|
|
59709
59762
|
try {
|
|
59710
59763
|
fs30.rmSync(sourceDir, { recursive: true, force: true });
|
|
@@ -59880,25 +59933,25 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
59880
59933
|
}
|
|
59881
59934
|
};
|
|
59882
59935
|
var os19 = __toESM2(require("os"));
|
|
59883
|
-
var
|
|
59936
|
+
var path25 = __toESM2(require("path"));
|
|
59884
59937
|
var crypto5 = __toESM2(require("crypto"));
|
|
59885
|
-
var
|
|
59886
|
-
var
|
|
59938
|
+
var import_fs14 = require("fs");
|
|
59939
|
+
var import_child_process6 = require("child_process");
|
|
59887
59940
|
var import_chalk = __toESM2((init_source(), __toCommonJS(source_exports)));
|
|
59888
59941
|
init_provider_cli_adapter();
|
|
59889
59942
|
init_cli_detector();
|
|
59890
59943
|
init_config();
|
|
59891
59944
|
var os18 = __toESM2(require("os"));
|
|
59892
|
-
var
|
|
59945
|
+
var path23 = __toESM2(require("path"));
|
|
59893
59946
|
var crypto4 = __toESM2(require("crypto"));
|
|
59894
59947
|
var fs15 = __toESM2(require("fs"));
|
|
59895
59948
|
var import_node_module = require("module");
|
|
59896
59949
|
var fs14 = __toESM2(require("fs"));
|
|
59897
|
-
var
|
|
59950
|
+
var path222 = __toESM2(require("path"));
|
|
59898
59951
|
init_provider_cli_adapter();
|
|
59899
59952
|
var fs11 = __toESM2(require("fs"));
|
|
59900
59953
|
var os16 = __toESM2(require("os"));
|
|
59901
|
-
var
|
|
59954
|
+
var path20 = __toESM2(require("path"));
|
|
59902
59955
|
init_terminal_screen();
|
|
59903
59956
|
var import_session_host_core6 = require_dist();
|
|
59904
59957
|
var TerminalAdapter = class {
|
|
@@ -60018,18 +60071,18 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60018
60071
|
init_fsm_loader();
|
|
60019
60072
|
var fs10 = __toESM2(require("fs"));
|
|
60020
60073
|
var os15 = __toESM2(require("os"));
|
|
60021
|
-
var
|
|
60074
|
+
var path19 = __toESM2(require("path"));
|
|
60022
60075
|
init_logger();
|
|
60023
60076
|
function expandHome2(p) {
|
|
60024
60077
|
if (p === "~") return os15.homedir();
|
|
60025
|
-
if (p.startsWith("~/")) return
|
|
60078
|
+
if (p.startsWith("~/")) return path19.join(os15.homedir(), p.slice(2));
|
|
60026
60079
|
return p;
|
|
60027
60080
|
}
|
|
60028
60081
|
function realWorkspacePath(workingDir) {
|
|
60029
60082
|
try {
|
|
60030
60083
|
return fs10.realpathSync(workingDir);
|
|
60031
60084
|
} catch {
|
|
60032
|
-
return
|
|
60085
|
+
return path19.resolve(workingDir);
|
|
60033
60086
|
}
|
|
60034
60087
|
}
|
|
60035
60088
|
function applyPreLaunchTrust(trust, workingDir) {
|
|
@@ -60055,7 +60108,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60055
60108
|
}
|
|
60056
60109
|
list.push(real);
|
|
60057
60110
|
parsed[key] = list;
|
|
60058
|
-
fs10.mkdirSync(
|
|
60111
|
+
fs10.mkdirSync(path19.dirname(settingsPath), { recursive: true });
|
|
60059
60112
|
fs10.writeFileSync(settingsPath, `${JSON.stringify(parsed, null, 2)}
|
|
60060
60113
|
`, "utf8");
|
|
60061
60114
|
LOG2.info("pre-launch-trust", `pre-trusted workspace in ${trust.settings_path} (key="${key}")`);
|
|
@@ -60302,8 +60355,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60302
60355
|
}
|
|
60303
60356
|
armSpecWatcher() {
|
|
60304
60357
|
try {
|
|
60305
|
-
const dir =
|
|
60306
|
-
const base =
|
|
60358
|
+
const dir = path20.dirname(this.opts.specPath);
|
|
60359
|
+
const base = path20.basename(this.opts.specPath);
|
|
60307
60360
|
this.specWatcher = fs11.watch(dir, { persistent: false }, (_event, filename) => {
|
|
60308
60361
|
if (filename && filename !== base) return;
|
|
60309
60362
|
const res = loadFsmSpec(this.opts.specPath);
|
|
@@ -60604,7 +60657,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60604
60657
|
const ctl = (this.spec.control_bar ?? []).find((c) => c.action.type === "attach_image");
|
|
60605
60658
|
if (!ctl || ctl.action.type !== "attach_image") return;
|
|
60606
60659
|
const ext = guessExt(mime);
|
|
60607
|
-
const tmp =
|
|
60660
|
+
const tmp = path20.join(os16.tmpdir(), `adhdev-attach-${Date.now()}${ext}`);
|
|
60608
60661
|
try {
|
|
60609
60662
|
fs11.writeFileSync(tmp, Buffer.from(blob, "base64"));
|
|
60610
60663
|
} catch {
|
|
@@ -60712,7 +60765,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60712
60765
|
}
|
|
60713
60766
|
var fs12 = __toESM2(require("fs"));
|
|
60714
60767
|
var os17 = __toESM2(require("os"));
|
|
60715
|
-
var
|
|
60768
|
+
var path21 = __toESM2(require("path"));
|
|
60716
60769
|
var UUID_RE = /([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i;
|
|
60717
60770
|
function executeNativeHistory(cfg, input) {
|
|
60718
60771
|
if (!cfg?.source) return null;
|
|
@@ -60756,7 +60809,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60756
60809
|
const v = jsonPathGet(lines[0], src.session_id_path);
|
|
60757
60810
|
if (typeof v === "string" && v) providerSessionId = v;
|
|
60758
60811
|
} else if (src.session_id_from === "filename_uuid" || !src.session_id_from) {
|
|
60759
|
-
const m =
|
|
60812
|
+
const m = path21.basename(sourcePath).match(UUID_RE);
|
|
60760
60813
|
if (m) providerSessionId = m[1];
|
|
60761
60814
|
}
|
|
60762
60815
|
const requested = requestedSessionId || "";
|
|
@@ -60869,13 +60922,13 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60869
60922
|
if (!template) return null;
|
|
60870
60923
|
let out = template;
|
|
60871
60924
|
if (out.startsWith("~/") || out === "~") {
|
|
60872
|
-
out =
|
|
60925
|
+
out = path21.join(os17.homedir(), out.slice(2));
|
|
60873
60926
|
}
|
|
60874
60927
|
out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
|
|
60875
60928
|
const v = input.envOverrides?.[name] ?? process.env[name];
|
|
60876
60929
|
return v != null && v !== "" ? v : fallback ?? "";
|
|
60877
60930
|
});
|
|
60878
|
-
if (out.startsWith("~/")) out =
|
|
60931
|
+
if (out.startsWith("~/")) out = path21.join(os17.homedir(), out.slice(2));
|
|
60879
60932
|
const now = /* @__PURE__ */ new Date();
|
|
60880
60933
|
const workspaceRaw = input.workspace ?? "";
|
|
60881
60934
|
let workspaceResolved = workspaceRaw;
|
|
@@ -60932,12 +60985,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60932
60985
|
continue;
|
|
60933
60986
|
}
|
|
60934
60987
|
for (const e of entries) {
|
|
60935
|
-
if (e.isDirectory() && re.test(e.name)) next.push(
|
|
60988
|
+
if (e.isDirectory() && re.test(e.name)) next.push(path21.join(d, e.name));
|
|
60936
60989
|
}
|
|
60937
60990
|
}
|
|
60938
60991
|
} else {
|
|
60939
60992
|
for (const d of dirs) {
|
|
60940
|
-
const candidate =
|
|
60993
|
+
const candidate = path21.join(d, seg);
|
|
60941
60994
|
let stat2 = null;
|
|
60942
60995
|
try {
|
|
60943
60996
|
stat2 = fs12.statSync(candidate);
|
|
@@ -60960,7 +61013,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60960
61013
|
}
|
|
60961
61014
|
out.push(root);
|
|
60962
61015
|
for (const e of entries) {
|
|
60963
|
-
if (e.isDirectory()) walkAllDirs(
|
|
61016
|
+
if (e.isDirectory()) walkAllDirs(path21.join(root, e.name), out);
|
|
60964
61017
|
}
|
|
60965
61018
|
}
|
|
60966
61019
|
function newestRecentFileAcrossGlob(template, pattern, windowMs, sessionFloorMs = 0) {
|
|
@@ -60976,7 +61029,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
60976
61029
|
}
|
|
60977
61030
|
for (const e of entries) {
|
|
60978
61031
|
if (!e.isFile() || !pattern.test(e.name)) continue;
|
|
60979
|
-
const p =
|
|
61032
|
+
const p = path21.join(d, e.name);
|
|
60980
61033
|
const mtime = safeMtimeMs(p);
|
|
60981
61034
|
if (mtime < cutoff) continue;
|
|
60982
61035
|
if (!best || mtime > best.mtime) best = { p, mtime };
|
|
@@ -61003,7 +61056,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61003
61056
|
}
|
|
61004
61057
|
for (const e of entries) {
|
|
61005
61058
|
if (!e.isFile() || !pattern.test(e.name)) continue;
|
|
61006
|
-
const p =
|
|
61059
|
+
const p = path21.join(resolved, e.name);
|
|
61007
61060
|
const mtime = safeMtimeMs(p);
|
|
61008
61061
|
if (mtime < cutoff) continue;
|
|
61009
61062
|
if (!best || mtime > best.mtime) best = { p, mtime };
|
|
@@ -61015,13 +61068,13 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61015
61068
|
if (!template) return null;
|
|
61016
61069
|
let out = template;
|
|
61017
61070
|
if (out.startsWith("~/") || out === "~") {
|
|
61018
|
-
out =
|
|
61071
|
+
out = path21.join(os17.homedir(), out.slice(2));
|
|
61019
61072
|
}
|
|
61020
61073
|
out = out.replace(/\$\{([A-Z_][A-Z0-9_]*)(?::-(.*?))?\}/g, (_m, name, fallback) => {
|
|
61021
61074
|
const v = input.envOverrides?.[name] ?? process.env[name];
|
|
61022
61075
|
return v != null && v !== "" ? v : fallback ?? "";
|
|
61023
61076
|
});
|
|
61024
|
-
if (out.startsWith("~/")) out =
|
|
61077
|
+
if (out.startsWith("~/")) out = path21.join(os17.homedir(), out.slice(2));
|
|
61025
61078
|
const workspaceRaw = input.workspace ?? "";
|
|
61026
61079
|
let workspaceResolved = workspaceRaw;
|
|
61027
61080
|
if (workspaceRaw) {
|
|
@@ -61059,7 +61112,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61059
61112
|
let best = null;
|
|
61060
61113
|
for (const e of entries) {
|
|
61061
61114
|
if (!e.isFile() || !pattern.test(e.name)) continue;
|
|
61062
|
-
const p =
|
|
61115
|
+
const p = path21.join(dir, e.name);
|
|
61063
61116
|
const mtime = safeMtimeMs(p);
|
|
61064
61117
|
if (mtime < cutoff) continue;
|
|
61065
61118
|
if (!best || mtime > best.mtime) best = { p, mtime };
|
|
@@ -61079,7 +61132,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61079
61132
|
return UUID_RE.test(value) ? value : "";
|
|
61080
61133
|
}
|
|
61081
61134
|
function filenameUuid(filePath) {
|
|
61082
|
-
const match =
|
|
61135
|
+
const match = path21.basename(filePath).match(UUID_RE);
|
|
61083
61136
|
return match?.[1] || "";
|
|
61084
61137
|
}
|
|
61085
61138
|
function pickExactSessionFile(dir, pattern, requestedSessionId) {
|
|
@@ -61174,7 +61227,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
61174
61227
|
const out = [];
|
|
61175
61228
|
for (const e of entries) {
|
|
61176
61229
|
if (!e.isFile() || !pattern.test(e.name)) continue;
|
|
61177
|
-
out.push(
|
|
61230
|
+
out.push(path21.join(dir, e.name));
|
|
61178
61231
|
}
|
|
61179
61232
|
return out;
|
|
61180
61233
|
}
|
|
@@ -62112,12 +62165,12 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62112
62165
|
const dir = provider._resolvedProviderDir;
|
|
62113
62166
|
let specPath = resolvedSpecPath && fs14.existsSync(resolvedSpecPath) ? resolvedSpecPath : void 0;
|
|
62114
62167
|
if (!specPath && dir) {
|
|
62115
|
-
const legacy =
|
|
62168
|
+
const legacy = path222.join(dir, "spec.json");
|
|
62116
62169
|
if (fs14.existsSync(legacy)) specPath = legacy;
|
|
62117
62170
|
}
|
|
62118
62171
|
if (specPath) {
|
|
62119
62172
|
try {
|
|
62120
|
-
LOG2.info("spec-route", `[${provider.type}] routing through SpecCliAdapter (${
|
|
62173
|
+
LOG2.info("spec-route", `[${provider.type}] routing through SpecCliAdapter (${path222.relative(dir || "", specPath) || specPath})`);
|
|
62121
62174
|
return new SpecCliAdapter(specPath, workingDir, cliArgs, extraEnv, transportFactory);
|
|
62122
62175
|
} catch (err) {
|
|
62123
62176
|
LOG2.warn("spec-route", `[${provider.type}] spec invalid, falling back to ProviderCliAdapter: ${err.message}`);
|
|
@@ -62178,7 +62231,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62178
62231
|
return uri.slice("file://".length);
|
|
62179
62232
|
}
|
|
62180
62233
|
}
|
|
62181
|
-
if (
|
|
62234
|
+
if (path23.isAbsolute(uri)) return uri;
|
|
62182
62235
|
return null;
|
|
62183
62236
|
}
|
|
62184
62237
|
function extensionForImageMime(mimeType) {
|
|
@@ -62194,7 +62247,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62194
62247
|
const rawData = part.data.includes(",") ? part.data.split(",").pop() || "" : part.data;
|
|
62195
62248
|
if (!rawData) return null;
|
|
62196
62249
|
fs15.mkdirSync(dir, { recursive: true });
|
|
62197
|
-
const filePath =
|
|
62250
|
+
const filePath = path23.join(dir, safeInputImageBasename(index, part.mimeType));
|
|
62198
62251
|
fs15.writeFileSync(filePath, Buffer.from(rawData, "base64"));
|
|
62199
62252
|
cleanupStaleMaterializedImages(dir);
|
|
62200
62253
|
return filePath;
|
|
@@ -62210,7 +62263,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62210
62263
|
const entries = fs15.readdirSync(dir);
|
|
62211
62264
|
for (const entry of entries) {
|
|
62212
62265
|
if (!entry.startsWith("adhdev-input-image-")) continue;
|
|
62213
|
-
const fullPath =
|
|
62266
|
+
const fullPath = path23.join(dir, entry);
|
|
62214
62267
|
try {
|
|
62215
62268
|
const stat2 = fs15.statSync(fullPath);
|
|
62216
62269
|
if (now - stat2.mtimeMs > MATERIALIZED_IMAGE_MAX_AGE_MS) {
|
|
@@ -62233,7 +62286,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62233
62286
|
const promptParts = [];
|
|
62234
62287
|
const imageRefs = [];
|
|
62235
62288
|
const resourceRefs = [];
|
|
62236
|
-
const materializeDir = options.materializeDir ||
|
|
62289
|
+
const materializeDir = options.materializeDir || path23.join(os18.tmpdir(), "adhdev-input-media");
|
|
62237
62290
|
input.parts.forEach((part, index) => {
|
|
62238
62291
|
if (part.type === "text" && part.text.trim()) {
|
|
62239
62292
|
promptParts.push(part.text.trim());
|
|
@@ -62300,7 +62353,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
62300
62353
|
var CachedDatabaseSync = null;
|
|
62301
62354
|
function getDatabaseSync() {
|
|
62302
62355
|
if (CachedDatabaseSync) return CachedDatabaseSync;
|
|
62303
|
-
const requireFn = typeof require === "function" ? require : (0, import_node_module.createRequire)(
|
|
62356
|
+
const requireFn = typeof require === "function" ? require : (0, import_node_module.createRequire)(path23.join(process.cwd(), "__adhdev_sqlite_loader__.js"));
|
|
62304
62357
|
const sqliteModule = requireFn(`node:${"sqlite"}`);
|
|
62305
62358
|
CachedDatabaseSync = sqliteModule.DatabaseSync;
|
|
62306
62359
|
if (!CachedDatabaseSync) {
|
|
@@ -63935,9 +63988,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
63935
63988
|
}
|
|
63936
63989
|
}
|
|
63937
63990
|
};
|
|
63938
|
-
var
|
|
63991
|
+
var path24 = __toESM2(require("path"));
|
|
63939
63992
|
var import_stream = require("stream");
|
|
63940
|
-
var
|
|
63993
|
+
var import_child_process5 = require("child_process");
|
|
63941
63994
|
var import_sdk = (init_acp(), __toCommonJS(acp_exports));
|
|
63942
63995
|
init_logger();
|
|
63943
63996
|
function getPromptCapabilityFlags(agentCapabilities) {
|
|
@@ -64456,7 +64509,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
64456
64509
|
this.errorMessage = null;
|
|
64457
64510
|
this.errorReason = null;
|
|
64458
64511
|
this.stderrBuffer = [];
|
|
64459
|
-
this.process = (0,
|
|
64512
|
+
this.process = (0, import_child_process5.spawn)(command, args, {
|
|
64460
64513
|
cwd: this.workingDir,
|
|
64461
64514
|
env: env2,
|
|
64462
64515
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -64721,7 +64774,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
64721
64774
|
return b.uri ? {
|
|
64722
64775
|
type: "resource_link",
|
|
64723
64776
|
uri: b.uri,
|
|
64724
|
-
name:
|
|
64777
|
+
name: path24.basename(b.uri),
|
|
64725
64778
|
mimeType: b.mimeType,
|
|
64726
64779
|
...b.transcript ? { description: b.transcript } : {}
|
|
64727
64780
|
} : { type: "text", text: b.transcript || `[Video attachment: ${b.mimeType}]` };
|
|
@@ -65175,20 +65228,20 @@ ${rawInput}` : rawInput;
|
|
|
65175
65228
|
}
|
|
65176
65229
|
function isExplicitCommand(command) {
|
|
65177
65230
|
const trimmed = command.trim();
|
|
65178
|
-
return
|
|
65231
|
+
return path25.isAbsolute(trimmed) || trimmed.includes("/") || trimmed.includes("\\") || trimmed.startsWith("~");
|
|
65179
65232
|
}
|
|
65180
65233
|
function expandExecutable(command) {
|
|
65181
65234
|
const trimmed = command.trim();
|
|
65182
|
-
return trimmed.startsWith("~") ?
|
|
65235
|
+
return trimmed.startsWith("~") ? path25.join(os19.homedir(), trimmed.slice(1)) : trimmed;
|
|
65183
65236
|
}
|
|
65184
65237
|
function commandExists(command) {
|
|
65185
65238
|
const trimmed = command.trim();
|
|
65186
65239
|
if (!trimmed) return false;
|
|
65187
65240
|
if (isExplicitCommand(trimmed)) {
|
|
65188
|
-
return (0,
|
|
65241
|
+
return (0, import_fs14.existsSync)(expandExecutable(trimmed));
|
|
65189
65242
|
}
|
|
65190
65243
|
try {
|
|
65191
|
-
(0,
|
|
65244
|
+
(0, import_child_process6.execFileSync)(process.platform === "win32" ? "where" : "which", [trimmed], {
|
|
65192
65245
|
stdio: "ignore",
|
|
65193
65246
|
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
65194
65247
|
});
|
|
@@ -65320,11 +65373,11 @@ ${rawInput}` : rawInput;
|
|
|
65320
65373
|
return false;
|
|
65321
65374
|
}
|
|
65322
65375
|
function ensureEmptyDelegatedMcpConfig(workspace) {
|
|
65323
|
-
const baseDir =
|
|
65324
|
-
(0,
|
|
65325
|
-
const workspaceHash = crypto5.createHash("sha256").update(
|
|
65326
|
-
const filePath =
|
|
65327
|
-
(0,
|
|
65376
|
+
const baseDir = path25.join(os19.tmpdir(), "adhdev-delegated-agent-empty-mcp");
|
|
65377
|
+
(0, import_fs14.mkdirSync)(baseDir, { recursive: true });
|
|
65378
|
+
const workspaceHash = crypto5.createHash("sha256").update(path25.resolve(workspace || os19.tmpdir())).digest("hex").slice(0, 16);
|
|
65379
|
+
const filePath = path25.join(baseDir, `${workspaceHash}.json`);
|
|
65380
|
+
(0, import_fs14.writeFileSync)(filePath, JSON.stringify({ mcpServers: {} }, null, 2), "utf-8");
|
|
65328
65381
|
return filePath;
|
|
65329
65382
|
}
|
|
65330
65383
|
function buildCoordinatorDelegatedCliLaunchOptions(input) {
|
|
@@ -65637,7 +65690,7 @@ ${rawInput}` : rawInput;
|
|
|
65637
65690
|
async startSession(cliType, workingDir, cliArgs, initialModel, options) {
|
|
65638
65691
|
const trimmed = (workingDir || "").trim();
|
|
65639
65692
|
if (!trimmed) throw new Error("working directory required");
|
|
65640
|
-
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os19.homedir()) :
|
|
65693
|
+
const resolvedDir = trimmed.startsWith("~") ? trimmed.replace(/^~/, os19.homedir()) : path25.resolve(trimmed);
|
|
65641
65694
|
const normalizedType = this.providerLoader.resolveAlias(cliType);
|
|
65642
65695
|
const rawProvider = this.providerLoader.getByAlias(cliType);
|
|
65643
65696
|
const provider = rawProvider ? this.providerLoader.resolve(normalizedType) || rawProvider : void 0;
|
|
@@ -66237,12 +66290,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
66237
66290
|
return null;
|
|
66238
66291
|
}
|
|
66239
66292
|
};
|
|
66240
|
-
var
|
|
66293
|
+
var import_child_process7 = require("child_process");
|
|
66241
66294
|
var net3 = __toESM2(require("net"));
|
|
66242
66295
|
var os24 = __toESM2(require("os"));
|
|
66243
|
-
var
|
|
66296
|
+
var path33 = __toESM2(require("path"));
|
|
66244
66297
|
var fs21 = __toESM2(require("fs"));
|
|
66245
|
-
var
|
|
66298
|
+
var path322 = __toESM2(require("path"));
|
|
66246
66299
|
var os23 = __toESM2(require("os"));
|
|
66247
66300
|
var chokidar = __toESM2(require_chokidar());
|
|
66248
66301
|
init_logger();
|
|
@@ -66629,9 +66682,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
66629
66682
|
init_external_sources();
|
|
66630
66683
|
var fs20 = __toESM2(require("fs"));
|
|
66631
66684
|
var os222 = __toESM2(require("os"));
|
|
66632
|
-
var
|
|
66685
|
+
var path30 = __toESM2(require("path"));
|
|
66633
66686
|
var fs16 = __toESM2(require("fs"));
|
|
66634
|
-
var
|
|
66687
|
+
var path26 = __toESM2(require("path"));
|
|
66635
66688
|
function extractTimestampValue(value) {
|
|
66636
66689
|
if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
|
|
66637
66690
|
if (typeof value === "string") {
|
|
@@ -66787,8 +66840,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
66787
66840
|
return records;
|
|
66788
66841
|
}
|
|
66789
66842
|
function readSession(sessionPath) {
|
|
66790
|
-
if (!sessionPath || !
|
|
66791
|
-
const basename14 =
|
|
66843
|
+
if (!sessionPath || !path26.isAbsolute(sessionPath)) return null;
|
|
66844
|
+
const basename14 = path26.basename(sessionPath, ".jsonl");
|
|
66792
66845
|
if (!isSafeSessionId(basename14)) return null;
|
|
66793
66846
|
if (!fs16.existsSync(sessionPath)) return null;
|
|
66794
66847
|
const sourceMtimeMs = statMtimeMs(sessionPath);
|
|
@@ -66807,7 +66860,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
66807
66860
|
};
|
|
66808
66861
|
}
|
|
66809
66862
|
var fs17 = __toESM2(require("fs"));
|
|
66810
|
-
var
|
|
66863
|
+
var path27 = __toESM2(require("path"));
|
|
66811
66864
|
function extractTimestampValue2(value) {
|
|
66812
66865
|
if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
|
|
66813
66866
|
if (typeof value === "string") {
|
|
@@ -67044,11 +67097,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67044
67097
|
return records;
|
|
67045
67098
|
}
|
|
67046
67099
|
function readSession2(sessionPath) {
|
|
67047
|
-
if (!sessionPath || !
|
|
67100
|
+
if (!sessionPath || !path27.isAbsolute(sessionPath)) return null;
|
|
67048
67101
|
if (!fs17.existsSync(sessionPath)) return null;
|
|
67049
67102
|
const meta3 = readSessionMeta(sessionPath);
|
|
67050
67103
|
const metaId = String(meta3?.id ?? "").trim();
|
|
67051
|
-
const basename14 =
|
|
67104
|
+
const basename14 = path27.basename(sessionPath, ".jsonl");
|
|
67052
67105
|
const uuidMatch = basename14.match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/i);
|
|
67053
67106
|
const filenameUuid2 = uuidMatch ? uuidMatch[1] : "";
|
|
67054
67107
|
if (metaId && filenameUuid2 && metaId !== filenameUuid2) return null;
|
|
@@ -67071,7 +67124,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67071
67124
|
};
|
|
67072
67125
|
}
|
|
67073
67126
|
var fs18 = __toESM2(require("fs"));
|
|
67074
|
-
var
|
|
67127
|
+
var path28 = __toESM2(require("path"));
|
|
67075
67128
|
var os20 = __toESM2(require("os"));
|
|
67076
67129
|
function extractTimestampValue3(value) {
|
|
67077
67130
|
if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
|
|
@@ -67094,13 +67147,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67094
67147
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
67095
67148
|
}
|
|
67096
67149
|
function antigravityRoot() {
|
|
67097
|
-
return
|
|
67150
|
+
return path28.join(os20.homedir(), ".gemini", "antigravity-cli");
|
|
67098
67151
|
}
|
|
67099
67152
|
function historyJsonlPath() {
|
|
67100
|
-
return
|
|
67153
|
+
return path28.join(antigravityRoot(), "history.jsonl");
|
|
67101
67154
|
}
|
|
67102
67155
|
function brainRoot() {
|
|
67103
|
-
return
|
|
67156
|
+
return path28.join(antigravityRoot(), "brain");
|
|
67104
67157
|
}
|
|
67105
67158
|
function extractUserRequestContent(content) {
|
|
67106
67159
|
const raw = content.trim();
|
|
@@ -67247,13 +67300,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67247
67300
|
];
|
|
67248
67301
|
}
|
|
67249
67302
|
function readSession3(sessionPath, sessionId, workspace) {
|
|
67250
|
-
if (!sessionPath || !
|
|
67303
|
+
if (!sessionPath || !path28.isAbsolute(sessionPath)) return null;
|
|
67251
67304
|
if (!fs18.existsSync(sessionPath)) return null;
|
|
67252
67305
|
const sourceMtimeMs = statMtimeMs3(sessionPath);
|
|
67253
67306
|
const brainRootPath = brainRoot();
|
|
67254
|
-
if (sessionPath.startsWith(brainRootPath +
|
|
67307
|
+
if (sessionPath.startsWith(brainRootPath + path28.sep) && sessionPath.endsWith(".jsonl")) {
|
|
67255
67308
|
const relative5 = sessionPath.slice(brainRootPath.length + 1);
|
|
67256
|
-
const uuidFromPath = relative5.split(
|
|
67309
|
+
const uuidFromPath = relative5.split(path28.sep)[0];
|
|
67257
67310
|
const resolvedSessionId = sessionId || (isUuidLike(uuidFromPath) ? uuidFromPath : "");
|
|
67258
67311
|
if (!resolvedSessionId) return null;
|
|
67259
67312
|
const messages = parseBrainTranscript(sessionPath, resolvedSessionId, workspace);
|
|
@@ -67269,7 +67322,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67269
67322
|
};
|
|
67270
67323
|
}
|
|
67271
67324
|
if (sessionPath.endsWith(".pb")) {
|
|
67272
|
-
const pbSessionId = sessionId ||
|
|
67325
|
+
const pbSessionId = sessionId || path28.basename(sessionPath, ".pb");
|
|
67273
67326
|
if (!isUuidLike(pbSessionId)) return null;
|
|
67274
67327
|
const messages = parsePbFile(sessionPath, pbSessionId);
|
|
67275
67328
|
if (!messages || messages.length === 0) return null;
|
|
@@ -67283,7 +67336,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67283
67336
|
partialReason: "antigravity_cli_pb_raw_text_extraction"
|
|
67284
67337
|
};
|
|
67285
67338
|
}
|
|
67286
|
-
if (
|
|
67339
|
+
if (path28.basename(sessionPath) === "history.jsonl") {
|
|
67287
67340
|
const resolvedSessionId = sessionId || "";
|
|
67288
67341
|
if (!resolvedSessionId || !isUuidLike(resolvedSessionId)) return null;
|
|
67289
67342
|
const rows = readHistoryRows().filter((r) => r.conversationId === resolvedSessionId);
|
|
@@ -67329,10 +67382,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67329
67382
|
return null;
|
|
67330
67383
|
}
|
|
67331
67384
|
var fs19 = __toESM2(require("fs"));
|
|
67332
|
-
var
|
|
67385
|
+
var path29 = __toESM2(require("path"));
|
|
67333
67386
|
var os21 = __toESM2(require("os"));
|
|
67334
|
-
var HERMES_STATE_DB =
|
|
67335
|
-
var HERMES_LEGACY_SESSIONS_DIR =
|
|
67387
|
+
var HERMES_STATE_DB = path29.join(os21.homedir(), ".hermes", "state.db");
|
|
67388
|
+
var HERMES_LEGACY_SESSIONS_DIR = path29.join(os21.homedir(), ".hermes", "sessions");
|
|
67336
67389
|
function statMtimeMs4(p) {
|
|
67337
67390
|
try {
|
|
67338
67391
|
return Math.floor(fs19.statSync(p).mtimeMs);
|
|
@@ -67398,7 +67451,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67398
67451
|
}
|
|
67399
67452
|
}
|
|
67400
67453
|
}
|
|
67401
|
-
if (!
|
|
67454
|
+
if (!path29.isAbsolute(sessionPath) || !fs19.existsSync(sessionPath)) return null;
|
|
67402
67455
|
let raw;
|
|
67403
67456
|
try {
|
|
67404
67457
|
raw = JSON.parse(fs19.readFileSync(sessionPath, "utf8"));
|
|
@@ -67424,7 +67477,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67424
67477
|
});
|
|
67425
67478
|
}
|
|
67426
67479
|
if (messages.length === 0) return null;
|
|
67427
|
-
const sessionId = typeof raw.session_id === "string" && raw.session_id ? raw.session_id :
|
|
67480
|
+
const sessionId = typeof raw.session_id === "string" && raw.session_id ? raw.session_id : path29.basename(sessionPath, ".json").replace(/^session_/, "");
|
|
67428
67481
|
return {
|
|
67429
67482
|
messages,
|
|
67430
67483
|
providerSessionId: sessionId,
|
|
@@ -67488,10 +67541,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67488
67541
|
}
|
|
67489
67542
|
}
|
|
67490
67543
|
function resolveClaudePath(workspace, sessionId) {
|
|
67491
|
-
const dir =
|
|
67544
|
+
const dir = path30.join(os222.homedir(), ".claude", "projects", cwdAsDashes(workspace));
|
|
67492
67545
|
if (!fs20.existsSync(dir)) return null;
|
|
67493
67546
|
if (sessionId) {
|
|
67494
|
-
const candidate =
|
|
67547
|
+
const candidate = path30.join(dir, `${sessionId}.jsonl`);
|
|
67495
67548
|
if (fs20.existsSync(candidate)) return candidate;
|
|
67496
67549
|
}
|
|
67497
67550
|
return null;
|
|
@@ -67517,7 +67570,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67517
67570
|
continue;
|
|
67518
67571
|
}
|
|
67519
67572
|
for (const entry of entries) {
|
|
67520
|
-
const entryPath =
|
|
67573
|
+
const entryPath = path30.join(current, entry.name);
|
|
67521
67574
|
if (entry.isDirectory()) {
|
|
67522
67575
|
stack.push(entryPath);
|
|
67523
67576
|
continue;
|
|
@@ -67547,7 +67600,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67547
67600
|
continue;
|
|
67548
67601
|
}
|
|
67549
67602
|
for (const entry of entries) {
|
|
67550
|
-
const entryPath =
|
|
67603
|
+
const entryPath = path30.join(current, entry.name);
|
|
67551
67604
|
if (entry.isDirectory()) {
|
|
67552
67605
|
stack.push(entryPath);
|
|
67553
67606
|
continue;
|
|
@@ -67600,12 +67653,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67600
67653
|
}
|
|
67601
67654
|
function resolveAntigravityPath(workspace) {
|
|
67602
67655
|
void workspace;
|
|
67603
|
-
const brainRoot2 =
|
|
67656
|
+
const brainRoot2 = path30.join(os222.homedir(), ".gemini", "antigravity-cli", "brain");
|
|
67604
67657
|
if (!fs20.existsSync(brainRoot2)) return null;
|
|
67605
67658
|
const cutoff = Date.now() - RECENT_WINDOW_MS;
|
|
67606
|
-
const entries = fs20.readdirSync(brainRoot2, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => ({ p:
|
|
67659
|
+
const entries = fs20.readdirSync(brainRoot2, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => ({ p: path30.join(brainRoot2, e.name), mtime: safeMtime(path30.join(brainRoot2, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
67607
67660
|
for (const e of entries) {
|
|
67608
|
-
const t =
|
|
67661
|
+
const t = path30.join(e.p, ".system_generated", "logs", "transcript.jsonl");
|
|
67609
67662
|
if (fs20.existsSync(t)) return t;
|
|
67610
67663
|
}
|
|
67611
67664
|
return null;
|
|
@@ -67613,9 +67666,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67613
67666
|
function resolveHermesPath(workspace, sessionId) {
|
|
67614
67667
|
void workspace;
|
|
67615
67668
|
void sessionId;
|
|
67616
|
-
const dbPath =
|
|
67669
|
+
const dbPath = path30.join(os222.homedir(), ".hermes", "state.db");
|
|
67617
67670
|
if (fs20.existsSync(dbPath)) return dbPath;
|
|
67618
|
-
const dir =
|
|
67671
|
+
const dir = path30.join(os222.homedir(), ".hermes", "sessions");
|
|
67619
67672
|
if (!fs20.existsSync(dir)) return null;
|
|
67620
67673
|
return newestRecentFile2(dir, /^session_.*\.json$/);
|
|
67621
67674
|
}
|
|
@@ -67636,7 +67689,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67636
67689
|
return cwd.replace(/\//g, "-");
|
|
67637
67690
|
}
|
|
67638
67691
|
function codexSessionsRoot() {
|
|
67639
|
-
return
|
|
67692
|
+
return path30.join(os222.homedir(), ".codex", "sessions");
|
|
67640
67693
|
}
|
|
67641
67694
|
function isUuidLikeSessionId2(sessionId) {
|
|
67642
67695
|
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(sessionId);
|
|
@@ -67648,7 +67701,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67648
67701
|
function newestRecentFile2(dir, pattern) {
|
|
67649
67702
|
try {
|
|
67650
67703
|
const cutoff = Date.now() - RECENT_WINDOW_MS;
|
|
67651
|
-
const entries = fs20.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && pattern.test(e.name)).map((e) => ({ p:
|
|
67704
|
+
const entries = fs20.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && pattern.test(e.name)).map((e) => ({ p: path30.join(dir, e.name), mtime: safeMtime(path30.join(dir, e.name)) })).filter((e) => e.mtime >= cutoff).sort((a, b) => b.mtime - a.mtime);
|
|
67652
67705
|
return entries[0]?.p ?? null;
|
|
67653
67706
|
} catch {
|
|
67654
67707
|
return null;
|
|
@@ -67709,7 +67762,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67709
67762
|
try {
|
|
67710
67763
|
if (!fs21.existsSync(candidate) || !fs21.statSync(candidate).isDirectory()) return false;
|
|
67711
67764
|
return ["ide", "extension", "cli", "acp"].some(
|
|
67712
|
-
(category) => fs21.existsSync(
|
|
67765
|
+
(category) => fs21.existsSync(path322.join(candidate, category))
|
|
67713
67766
|
);
|
|
67714
67767
|
} catch {
|
|
67715
67768
|
return false;
|
|
@@ -67717,20 +67770,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67717
67770
|
}
|
|
67718
67771
|
static hasProviderRootMarker(candidate) {
|
|
67719
67772
|
try {
|
|
67720
|
-
return fs21.existsSync(
|
|
67773
|
+
return fs21.existsSync(path322.join(candidate, _ProviderLoader.SIBLING_MARKER_FILE));
|
|
67721
67774
|
} catch {
|
|
67722
67775
|
return false;
|
|
67723
67776
|
}
|
|
67724
67777
|
}
|
|
67725
67778
|
detectDefaultUserDir() {
|
|
67726
|
-
const fallback =
|
|
67779
|
+
const fallback = path322.join(os23.homedir(), ".adhdev", "providers");
|
|
67727
67780
|
const envOptIn = process.env[_ProviderLoader.SIBLING_ENV_VAR] === "1";
|
|
67728
67781
|
const visited = /* @__PURE__ */ new Set();
|
|
67729
67782
|
for (const start of this.probeStarts) {
|
|
67730
|
-
let current =
|
|
67783
|
+
let current = path322.resolve(start);
|
|
67731
67784
|
while (!visited.has(current)) {
|
|
67732
67785
|
visited.add(current);
|
|
67733
|
-
const siblingCandidate =
|
|
67786
|
+
const siblingCandidate = path322.join(path322.dirname(current), _ProviderLoader.REPO_PROVIDER_DIRNAME);
|
|
67734
67787
|
if (_ProviderLoader.looksLikeProviderRoot(siblingCandidate)) {
|
|
67735
67788
|
const hasMarker = _ProviderLoader.hasProviderRootMarker(siblingCandidate);
|
|
67736
67789
|
if (envOptIn || hasMarker) {
|
|
@@ -67752,7 +67805,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67752
67805
|
return { path: siblingCandidate, source };
|
|
67753
67806
|
}
|
|
67754
67807
|
}
|
|
67755
|
-
const parent =
|
|
67808
|
+
const parent = path322.dirname(current);
|
|
67756
67809
|
if (parent === current) break;
|
|
67757
67810
|
current = parent;
|
|
67758
67811
|
}
|
|
@@ -67762,11 +67815,11 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67762
67815
|
constructor(options) {
|
|
67763
67816
|
this.logFn = options?.logFn || LOG2.forComponent("Provider").asLogFn();
|
|
67764
67817
|
this.probeStarts = options?.probeStarts ?? [process.cwd(), __dirname];
|
|
67765
|
-
this.defaultProvidersDir =
|
|
67818
|
+
this.defaultProvidersDir = path322.join(os23.homedir(), ".adhdev", "providers");
|
|
67766
67819
|
const detected = this.detectDefaultUserDir();
|
|
67767
67820
|
this.userDir = detected.path;
|
|
67768
67821
|
this.userDirSource = detected.source;
|
|
67769
|
-
this.upstreamDir =
|
|
67822
|
+
this.upstreamDir = path322.join(this.defaultProvidersDir, ".upstream");
|
|
67770
67823
|
this.disableUpstream = false;
|
|
67771
67824
|
this.applySourceConfig({
|
|
67772
67825
|
userDir: options?.userDir,
|
|
@@ -67778,8 +67831,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67778
67831
|
migrateMarketplaceDirToExternal() {
|
|
67779
67832
|
try {
|
|
67780
67833
|
const home = os23.homedir();
|
|
67781
|
-
const oldDir =
|
|
67782
|
-
const newDir =
|
|
67834
|
+
const oldDir = path322.join(home, ".adhdev", "marketplace");
|
|
67835
|
+
const newDir = path322.join(home, ".adhdev", "external");
|
|
67783
67836
|
if (!fs21.existsSync(oldDir)) return;
|
|
67784
67837
|
if (fs21.existsSync(newDir)) {
|
|
67785
67838
|
this.log(`Migration skipped: both ~/.adhdev/marketplace and ~/.adhdev/external exist (marketplace dir is now inert and can be removed manually).`);
|
|
@@ -67815,7 +67868,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67815
67868
|
* Highest-priority editable overrides come first.
|
|
67816
67869
|
*/
|
|
67817
67870
|
getProviderRoots() {
|
|
67818
|
-
const externalDir =
|
|
67871
|
+
const externalDir = path322.join(os23.homedir(), ".adhdev", "external");
|
|
67819
67872
|
return [this.userDir, externalDir, this.upstreamDir];
|
|
67820
67873
|
}
|
|
67821
67874
|
getSourceConfig() {
|
|
@@ -67843,7 +67896,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67843
67896
|
this.userDir = detected.path;
|
|
67844
67897
|
this.userDirSource = detected.source;
|
|
67845
67898
|
}
|
|
67846
|
-
this.upstreamDir =
|
|
67899
|
+
this.upstreamDir = path322.join(this.defaultProvidersDir, ".upstream");
|
|
67847
67900
|
this.disableUpstream = this.sourceMode === "no-upstream";
|
|
67848
67901
|
if (this.explicitProviderDir) {
|
|
67849
67902
|
this.log(`Config 'providerDir' applied: ${this.userDir}`);
|
|
@@ -67857,7 +67910,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67857
67910
|
* Canonical provider directory shape for a given root.
|
|
67858
67911
|
*/
|
|
67859
67912
|
getProviderDir(root, category, type) {
|
|
67860
|
-
return
|
|
67913
|
+
return path322.join(root, category, type);
|
|
67861
67914
|
}
|
|
67862
67915
|
/**
|
|
67863
67916
|
* Canonical user override directory for a provider.
|
|
@@ -67884,7 +67937,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67884
67937
|
resolveProviderFile(type, ...segments) {
|
|
67885
67938
|
const dir = this.findProviderDirInternal(type);
|
|
67886
67939
|
if (!dir) return null;
|
|
67887
|
-
return
|
|
67940
|
+
return path322.join(dir, ...segments);
|
|
67888
67941
|
}
|
|
67889
67942
|
/**
|
|
67890
67943
|
* Load all providers (3-tier priority)
|
|
@@ -67908,7 +67961,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67908
67961
|
} else if (this.disableUpstream) {
|
|
67909
67962
|
this.log("Upstream loading disabled (sourceMode=no-upstream)");
|
|
67910
67963
|
}
|
|
67911
|
-
const externalDir =
|
|
67964
|
+
const externalDir = path322.join(os23.homedir(), ".adhdev", "external");
|
|
67912
67965
|
if (fs21.existsSync(externalDir)) {
|
|
67913
67966
|
const rootEntries = (() => {
|
|
67914
67967
|
try {
|
|
@@ -67930,7 +67983,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67930
67983
|
const ambiguousTypes = [];
|
|
67931
67984
|
for (const sourceEntry of rootEntries) {
|
|
67932
67985
|
if (!sourceEntry.isDirectory()) continue;
|
|
67933
|
-
const sourceDir =
|
|
67986
|
+
const sourceDir = path322.join(externalDir, sourceEntry.name);
|
|
67934
67987
|
const sourceLoaded = this.loadDir(sourceDir);
|
|
67935
67988
|
if (sourceLoaded > 0) {
|
|
67936
67989
|
totalLoaded += sourceLoaded;
|
|
@@ -67946,7 +67999,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67946
67999
|
ambiguousTypes.push({ type, chosen: resolved.source ?? "?", candidates: resolved.candidates });
|
|
67947
68000
|
}
|
|
67948
68001
|
if (resolved.source && resolved.source !== "?") {
|
|
67949
|
-
const sourceDir =
|
|
68002
|
+
const sourceDir = path322.join(externalDir, resolved.source);
|
|
67950
68003
|
const reloadCount = this.loadDir(sourceDir);
|
|
67951
68004
|
if (reloadCount === 0) {
|
|
67952
68005
|
this.log(`Active source "${resolved.source}" no longer provides ${type}`);
|
|
@@ -67979,7 +68032,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
67979
68032
|
if (!fs21.existsSync(this.upstreamDir)) return false;
|
|
67980
68033
|
try {
|
|
67981
68034
|
return fs21.readdirSync(this.upstreamDir).some(
|
|
67982
|
-
(d) => fs21.statSync(
|
|
68035
|
+
(d) => fs21.statSync(path322.join(this.upstreamDir, d)).isDirectory()
|
|
67983
68036
|
);
|
|
67984
68037
|
} catch {
|
|
67985
68038
|
return false;
|
|
@@ -68477,8 +68530,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68477
68530
|
resolved._resolvedScriptDir = entry.scriptDir;
|
|
68478
68531
|
resolved._resolvedScriptsSource = `compatibility:${entry.ideVersion}`;
|
|
68479
68532
|
if (providerDir) {
|
|
68480
|
-
const fullDir =
|
|
68481
|
-
resolved._resolvedScriptsPath = fs21.existsSync(
|
|
68533
|
+
const fullDir = path322.join(providerDir, entry.scriptDir);
|
|
68534
|
+
resolved._resolvedScriptsPath = fs21.existsSync(path322.join(fullDir, "scripts.js")) ? path322.join(fullDir, "scripts.js") : fullDir;
|
|
68482
68535
|
}
|
|
68483
68536
|
matched = true;
|
|
68484
68537
|
}
|
|
@@ -68496,8 +68549,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68496
68549
|
resolved._resolvedScriptDir = base.defaultScriptDir;
|
|
68497
68550
|
resolved._resolvedScriptsSource = "defaultScriptDir:version_miss";
|
|
68498
68551
|
if (providerDir) {
|
|
68499
|
-
const fullDir =
|
|
68500
|
-
resolved._resolvedScriptsPath = fs21.existsSync(
|
|
68552
|
+
const fullDir = path322.join(providerDir, base.defaultScriptDir);
|
|
68553
|
+
resolved._resolvedScriptsPath = fs21.existsSync(path322.join(fullDir, "scripts.js")) ? path322.join(fullDir, "scripts.js") : fullDir;
|
|
68501
68554
|
}
|
|
68502
68555
|
}
|
|
68503
68556
|
resolved._versionWarning = `Version ${currentVersion} not in compatibility matrix. Using default scripts.`;
|
|
@@ -68514,8 +68567,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68514
68567
|
resolved._resolvedScriptDir = dirOverride;
|
|
68515
68568
|
resolved._resolvedScriptsSource = `versions:${range}`;
|
|
68516
68569
|
if (providerDir) {
|
|
68517
|
-
const fullDir =
|
|
68518
|
-
resolved._resolvedScriptsPath = fs21.existsSync(
|
|
68570
|
+
const fullDir = path322.join(providerDir, dirOverride);
|
|
68571
|
+
resolved._resolvedScriptsPath = fs21.existsSync(path322.join(fullDir, "scripts.js")) ? path322.join(fullDir, "scripts.js") : fullDir;
|
|
68519
68572
|
}
|
|
68520
68573
|
}
|
|
68521
68574
|
} else if (override.scripts) {
|
|
@@ -68531,8 +68584,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68531
68584
|
resolved._resolvedScriptDir = base.defaultScriptDir;
|
|
68532
68585
|
resolved._resolvedScriptsSource = "defaultScriptDir:no_version";
|
|
68533
68586
|
if (providerDir) {
|
|
68534
|
-
const fullDir =
|
|
68535
|
-
resolved._resolvedScriptsPath = fs21.existsSync(
|
|
68587
|
+
const fullDir = path322.join(providerDir, base.defaultScriptDir);
|
|
68588
|
+
resolved._resolvedScriptsPath = fs21.existsSync(path322.join(fullDir, "scripts.js")) ? path322.join(fullDir, "scripts.js") : fullDir;
|
|
68536
68589
|
}
|
|
68537
68590
|
}
|
|
68538
68591
|
}
|
|
@@ -68549,13 +68602,13 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68549
68602
|
if (providerDir2) {
|
|
68550
68603
|
for (const [scriptName, override] of Object.entries(base.overrides)) {
|
|
68551
68604
|
if (!override || typeof override.path !== "string") continue;
|
|
68552
|
-
const fullPath =
|
|
68605
|
+
const fullPath = path322.join(providerDir2, override.path);
|
|
68553
68606
|
if (!fs21.existsSync(fullPath)) {
|
|
68554
68607
|
this.log(` [overrides] ${base.type}: ${scriptName} path not found: ${fullPath}`);
|
|
68555
68608
|
continue;
|
|
68556
68609
|
}
|
|
68557
68610
|
try {
|
|
68558
|
-
registerProviderScriptRootSafely(
|
|
68611
|
+
registerProviderScriptRootSafely(path322.dirname(path322.dirname(providerDir2)));
|
|
68559
68612
|
delete require.cache[require.resolve(fullPath)];
|
|
68560
68613
|
const fn = require(fullPath);
|
|
68561
68614
|
const target = typeof fn === "function" ? fn : fn && fn[scriptName];
|
|
@@ -68581,17 +68634,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68581
68634
|
if (providerDir) {
|
|
68582
68635
|
try {
|
|
68583
68636
|
const fs30 = require("fs");
|
|
68584
|
-
const
|
|
68637
|
+
const path41 = require("path");
|
|
68585
68638
|
const candidates = [];
|
|
68586
68639
|
if (Array.isArray(base.compatibility)) {
|
|
68587
68640
|
for (const entry of base.compatibility) {
|
|
68588
68641
|
if (typeof entry?.spec !== "string") continue;
|
|
68589
68642
|
const matches = !entry.ideVersion || currentVersion && this.matchesVersion(currentVersion, entry.ideVersion) || !currentVersion;
|
|
68590
|
-
if (matches) candidates.push(
|
|
68643
|
+
if (matches) candidates.push(path41.join(providerDir, entry.spec));
|
|
68591
68644
|
}
|
|
68592
68645
|
}
|
|
68593
|
-
candidates.push(
|
|
68594
|
-
candidates.push(
|
|
68646
|
+
candidates.push(path41.join(providerDir, "specs", "default.json"));
|
|
68647
|
+
candidates.push(path41.join(providerDir, "spec.json"));
|
|
68595
68648
|
const specPath = candidates.find((p) => fs30.existsSync(p));
|
|
68596
68649
|
if (specPath) {
|
|
68597
68650
|
resolved._resolvedSpecPath = specPath;
|
|
@@ -68622,10 +68675,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68622
68675
|
format = `spec-${nh.source.kind}`;
|
|
68623
68676
|
reader = (input) => executeNativeHistory(nh, input);
|
|
68624
68677
|
} else if (nh.override_path) {
|
|
68625
|
-
const overrideFile =
|
|
68678
|
+
const overrideFile = path41.resolve(providerDir, nh.override_path);
|
|
68626
68679
|
if (fs30.existsSync(overrideFile)) {
|
|
68627
68680
|
try {
|
|
68628
|
-
registerProviderScriptRootSafely(
|
|
68681
|
+
registerProviderScriptRootSafely(path41.dirname(path41.dirname(providerDir)));
|
|
68629
68682
|
delete require.cache[require.resolve(overrideFile)];
|
|
68630
68683
|
const mod = require(overrideFile);
|
|
68631
68684
|
const fn = typeof mod === "function" ? mod : mod && typeof mod.default === "function" ? mod.default : null;
|
|
@@ -68668,15 +68721,15 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68668
68721
|
this.debugLog(`[loadScriptsFromDir] ${type}: providerDir not found`);
|
|
68669
68722
|
return null;
|
|
68670
68723
|
}
|
|
68671
|
-
const dir =
|
|
68724
|
+
const dir = path322.join(providerDir, scriptDir);
|
|
68672
68725
|
if (!fs21.existsSync(dir)) {
|
|
68673
68726
|
this.debugLog(`[loadScriptsFromDir] ${type}: dir not found: ${dir}`);
|
|
68674
68727
|
return null;
|
|
68675
68728
|
}
|
|
68676
|
-
registerProviderScriptRootSafely(
|
|
68729
|
+
registerProviderScriptRootSafely(path322.dirname(path322.dirname(providerDir)));
|
|
68677
68730
|
const cached22 = this.scriptsCache.get(dir);
|
|
68678
68731
|
if (cached22) return cached22;
|
|
68679
|
-
const scriptsJs =
|
|
68732
|
+
const scriptsJs = path322.join(dir, "scripts.js");
|
|
68680
68733
|
if (fs21.existsSync(scriptsJs)) {
|
|
68681
68734
|
try {
|
|
68682
68735
|
delete require.cache[require.resolve(scriptsJs)];
|
|
@@ -68721,7 +68774,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68721
68774
|
if (filePath.endsWith(".js") || filePath.endsWith(".json")) {
|
|
68722
68775
|
if (reloadTimer) clearTimeout(reloadTimer);
|
|
68723
68776
|
reloadTimer = setTimeout(() => {
|
|
68724
|
-
this.log(`File changed: ${
|
|
68777
|
+
this.log(`File changed: ${path322.basename(filePath)}, reloading...`);
|
|
68725
68778
|
this.reload();
|
|
68726
68779
|
}, 300);
|
|
68727
68780
|
}
|
|
@@ -68789,7 +68842,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68789
68842
|
}
|
|
68790
68843
|
this.log(`Registry sync starting (${_ProviderLoader.REGISTRY_BASE_URL})...`);
|
|
68791
68844
|
const https = require("https");
|
|
68792
|
-
const regMetaPath =
|
|
68845
|
+
const regMetaPath = path322.join(this.upstreamDir, _ProviderLoader.REGISTRY_META_FILE);
|
|
68793
68846
|
let cachedChecksums = {};
|
|
68794
68847
|
try {
|
|
68795
68848
|
if (fs21.existsSync(regMetaPath)) {
|
|
@@ -68847,9 +68900,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68847
68900
|
this.log(`\u26A0 Registry checksum mismatch for ${type}@${version2} \u2014 skipping`);
|
|
68848
68901
|
continue;
|
|
68849
68902
|
}
|
|
68850
|
-
const providerDir =
|
|
68903
|
+
const providerDir = path322.join(this.upstreamDir, category, type);
|
|
68851
68904
|
fs21.mkdirSync(providerDir, { recursive: true });
|
|
68852
|
-
fs21.writeFileSync(
|
|
68905
|
+
fs21.writeFileSync(path322.join(providerDir, "provider.json"), manifestBody, "utf-8");
|
|
68853
68906
|
cachedChecksums[cacheKey] = checksum;
|
|
68854
68907
|
updatedCount++;
|
|
68855
68908
|
this.log(`\u2713 Registry updated: ${category}/${type}@${version2}`);
|
|
@@ -68876,7 +68929,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68876
68929
|
const { exec: exec7 } = require("child_process");
|
|
68877
68930
|
const { promisify: promisify8 } = require("util");
|
|
68878
68931
|
const execAsync5 = promisify8(exec7);
|
|
68879
|
-
const metaPath =
|
|
68932
|
+
const metaPath = path322.join(this.upstreamDir, _ProviderLoader.META_FILE);
|
|
68880
68933
|
let prevEtag = "";
|
|
68881
68934
|
let prevTimestamp = 0;
|
|
68882
68935
|
try {
|
|
@@ -68936,17 +68989,17 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
68936
68989
|
return { updated: false };
|
|
68937
68990
|
}
|
|
68938
68991
|
this.log("Downloading latest providers from GitHub...");
|
|
68939
|
-
const tmpTar =
|
|
68940
|
-
const tmpExtract =
|
|
68992
|
+
const tmpTar = path322.join(os23.tmpdir(), `adhdev-providers-${Date.now()}.tar.gz`);
|
|
68993
|
+
const tmpExtract = path322.join(os23.tmpdir(), `adhdev-providers-extract-${Date.now()}`);
|
|
68941
68994
|
await this.downloadFile(_ProviderLoader.GITHUB_TARBALL_URL, tmpTar);
|
|
68942
68995
|
fs21.mkdirSync(tmpExtract, { recursive: true });
|
|
68943
68996
|
await execAsync5(`tar -xzf "${tmpTar}" -C "${tmpExtract}"`, { timeout: 3e4 });
|
|
68944
68997
|
const extracted = fs21.readdirSync(tmpExtract);
|
|
68945
68998
|
const rootDir = extracted.find(
|
|
68946
|
-
(d) => fs21.statSync(
|
|
68999
|
+
(d) => fs21.statSync(path322.join(tmpExtract, d)).isDirectory() && d.startsWith("adhdev-providers")
|
|
68947
69000
|
);
|
|
68948
69001
|
if (!rootDir) throw new Error("Unexpected tarball structure");
|
|
68949
|
-
const sourceDir =
|
|
69002
|
+
const sourceDir = path322.join(tmpExtract, rootDir);
|
|
68950
69003
|
const backupDir = this.upstreamDir + ".bak";
|
|
68951
69004
|
if (fs21.existsSync(this.upstreamDir)) {
|
|
68952
69005
|
if (fs21.existsSync(backupDir)) fs21.rmSync(backupDir, { recursive: true, force: true });
|
|
@@ -69021,8 +69074,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69021
69074
|
copyDirRecursive(src, dest) {
|
|
69022
69075
|
fs21.mkdirSync(dest, { recursive: true });
|
|
69023
69076
|
for (const entry of fs21.readdirSync(src, { withFileTypes: true })) {
|
|
69024
|
-
const srcPath =
|
|
69025
|
-
const destPath =
|
|
69077
|
+
const srcPath = path322.join(src, entry.name);
|
|
69078
|
+
const destPath = path322.join(dest, entry.name);
|
|
69026
69079
|
if (entry.isDirectory()) {
|
|
69027
69080
|
this.copyDirRecursive(srcPath, destPath);
|
|
69028
69081
|
} else {
|
|
@@ -69033,7 +69086,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69033
69086
|
/** .meta.json save */
|
|
69034
69087
|
writeMeta(metaPath, etag, timestamp) {
|
|
69035
69088
|
try {
|
|
69036
|
-
fs21.mkdirSync(
|
|
69089
|
+
fs21.mkdirSync(path322.dirname(metaPath), { recursive: true });
|
|
69037
69090
|
fs21.writeFileSync(metaPath, JSON.stringify({
|
|
69038
69091
|
etag,
|
|
69039
69092
|
timestamp,
|
|
@@ -69053,7 +69106,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69053
69106
|
const hasManifest = entries.some((e) => e.name === "provider.v1.json" || e.name === "provider.json");
|
|
69054
69107
|
if (hasManifest) count++;
|
|
69055
69108
|
for (const entry of entries) {
|
|
69056
|
-
if (entry.isDirectory()) scan(
|
|
69109
|
+
if (entry.isDirectory()) scan(path322.join(d, entry.name));
|
|
69057
69110
|
}
|
|
69058
69111
|
} catch {
|
|
69059
69112
|
}
|
|
@@ -69279,10 +69332,10 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69279
69332
|
if (!provider) return null;
|
|
69280
69333
|
const cat = provider.category;
|
|
69281
69334
|
const searchRoots = this.getProviderRoots();
|
|
69282
|
-
const hasManifest = (dir) => fs21.existsSync(
|
|
69335
|
+
const hasManifest = (dir) => fs21.existsSync(path322.join(dir, "provider.v1.json")) || fs21.existsSync(path322.join(dir, "provider.json"));
|
|
69283
69336
|
const readManifestType = (dir) => {
|
|
69284
69337
|
for (const file2 of ["provider.v1.json", "provider.json"]) {
|
|
69285
|
-
const p =
|
|
69338
|
+
const p = path322.join(dir, file2);
|
|
69286
69339
|
if (!fs21.existsSync(p)) continue;
|
|
69287
69340
|
try {
|
|
69288
69341
|
const data = JSON.parse(fs21.readFileSync(p, "utf-8"));
|
|
@@ -69296,12 +69349,12 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69296
69349
|
if (!fs21.existsSync(root)) continue;
|
|
69297
69350
|
const candidate = this.getProviderDir(root, cat, type);
|
|
69298
69351
|
if (hasManifest(candidate)) return candidate;
|
|
69299
|
-
const catDir =
|
|
69352
|
+
const catDir = path322.join(root, cat);
|
|
69300
69353
|
if (fs21.existsSync(catDir)) {
|
|
69301
69354
|
try {
|
|
69302
69355
|
for (const entry of fs21.readdirSync(catDir, { withFileTypes: true })) {
|
|
69303
69356
|
if (!entry.isDirectory()) continue;
|
|
69304
|
-
const entryDir =
|
|
69357
|
+
const entryDir = path322.join(catDir, entry.name);
|
|
69305
69358
|
const manifestType = readManifestType(entryDir);
|
|
69306
69359
|
if (manifestType === type) return entryDir;
|
|
69307
69360
|
}
|
|
@@ -69317,7 +69370,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69317
69370
|
* (template substitution is NOT applied here — scripts.js handles that)
|
|
69318
69371
|
*/
|
|
69319
69372
|
buildScriptWrappersFromDir(dir) {
|
|
69320
|
-
const scriptsJs =
|
|
69373
|
+
const scriptsJs = path322.join(dir, "scripts.js");
|
|
69321
69374
|
if (fs21.existsSync(scriptsJs)) {
|
|
69322
69375
|
try {
|
|
69323
69376
|
delete require.cache[require.resolve(scriptsJs)];
|
|
@@ -69331,7 +69384,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69331
69384
|
for (const file2 of fs21.readdirSync(dir)) {
|
|
69332
69385
|
if (!file2.endsWith(".js")) continue;
|
|
69333
69386
|
const scriptName = toCamel(file2.replace(".js", ""));
|
|
69334
|
-
const filePath =
|
|
69387
|
+
const filePath = path322.join(dir, file2);
|
|
69335
69388
|
result[scriptName] = (...args) => {
|
|
69336
69389
|
try {
|
|
69337
69390
|
let content = fs21.readFileSync(filePath, "utf-8");
|
|
@@ -69393,7 +69446,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
69393
69446
|
const hasJson = entries.some((e) => e.name === "provider.json");
|
|
69394
69447
|
if (hasV1 || hasJson) {
|
|
69395
69448
|
const manifestFile = hasV1 ? "provider.v1.json" : "provider.json";
|
|
69396
|
-
const jsonPath =
|
|
69449
|
+
const jsonPath = path322.join(d, manifestFile);
|
|
69397
69450
|
try {
|
|
69398
69451
|
const raw = fs21.readFileSync(jsonPath, "utf-8");
|
|
69399
69452
|
const mod = JSON.parse(raw);
|
|
@@ -69433,10 +69486,10 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69433
69486
|
this.log(`\u26A0 Invalid provider at ${jsonPath}: ${validation.errors.join("; ")}`);
|
|
69434
69487
|
} else {
|
|
69435
69488
|
const hasCompatibility = Array.isArray(normalizedProvider.compatibility);
|
|
69436
|
-
const scriptsPath =
|
|
69489
|
+
const scriptsPath = path322.join(d, "scripts.js");
|
|
69437
69490
|
if (!hasCompatibility && fs21.existsSync(scriptsPath)) {
|
|
69438
69491
|
try {
|
|
69439
|
-
registerProviderScriptRootSafely(
|
|
69492
|
+
registerProviderScriptRootSafely(path322.dirname(path322.dirname(d)));
|
|
69440
69493
|
delete require.cache[require.resolve(scriptsPath)];
|
|
69441
69494
|
const scripts = require(scriptsPath);
|
|
69442
69495
|
normalizedProvider.scripts = scripts;
|
|
@@ -69444,7 +69497,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69444
69497
|
this.log(`\u26A0 Failed to load scripts: ${scriptsPath}: ${e.message}`);
|
|
69445
69498
|
}
|
|
69446
69499
|
}
|
|
69447
|
-
const externalDirAbs =
|
|
69500
|
+
const externalDirAbs = path322.join(os23.homedir(), ".adhdev", "external");
|
|
69448
69501
|
const layer = d.startsWith(externalDirAbs) ? "external" : d.startsWith(this.userDir) && !d.includes(".upstream") ? "user" : "upstream";
|
|
69449
69502
|
try {
|
|
69450
69503
|
const { inspectManifestShape: inspectManifestShape2, classifyTrust: classifyTrust2 } = (init_provider_trust(), __toCommonJS2(provider_trust_exports));
|
|
@@ -69454,8 +69507,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69454
69507
|
normalizedProvider._sourceTrust = trust;
|
|
69455
69508
|
normalizedProvider._manifestShape = shape;
|
|
69456
69509
|
if (layer === "external") {
|
|
69457
|
-
const rel =
|
|
69458
|
-
const firstSeg = rel.split(
|
|
69510
|
+
const rel = path322.relative(externalDirAbs, d);
|
|
69511
|
+
const firstSeg = rel.split(path322.sep)[0];
|
|
69459
69512
|
if (firstSeg && firstSeg !== "..") normalizedProvider._sourceName = firstSeg;
|
|
69460
69513
|
}
|
|
69461
69514
|
} catch {
|
|
@@ -69479,7 +69532,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69479
69532
|
if (entry.name.startsWith("_") || entry.name.startsWith(".")) continue;
|
|
69480
69533
|
if (d === dir && entry.name === "examples") continue;
|
|
69481
69534
|
if (excludeDirs && d === dir && excludeDirs.includes(entry.name)) continue;
|
|
69482
|
-
scan(
|
|
69535
|
+
scan(path322.join(d, entry.name));
|
|
69483
69536
|
}
|
|
69484
69537
|
}
|
|
69485
69538
|
};
|
|
@@ -69557,7 +69610,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69557
69610
|
}
|
|
69558
69611
|
async function execQuiet(command, options = {}) {
|
|
69559
69612
|
return new Promise((resolve24) => {
|
|
69560
|
-
(0,
|
|
69613
|
+
(0, import_child_process7.exec)(command, options, (error48, stdout) => {
|
|
69561
69614
|
if (error48) return resolve24("");
|
|
69562
69615
|
resolve24(stdout.toString());
|
|
69563
69616
|
});
|
|
@@ -69808,8 +69861,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69808
69861
|
const appNameMap = getMacAppIdentifiers();
|
|
69809
69862
|
const appName = appNameMap[ideId];
|
|
69810
69863
|
if (appName) {
|
|
69811
|
-
const storagePath =
|
|
69812
|
-
process.env.APPDATA ||
|
|
69864
|
+
const storagePath = path33.join(
|
|
69865
|
+
process.env.APPDATA || path33.join(os24.homedir(), "AppData", "Roaming"),
|
|
69813
69866
|
appName,
|
|
69814
69867
|
"storage.json"
|
|
69815
69868
|
);
|
|
@@ -69957,10 +70010,10 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69957
70010
|
const canUseAppLauncher = !!appName;
|
|
69958
70011
|
const useAppLauncher = preferredMethod === "app" ? canUseAppLauncher : preferredMethod === "cli" ? false : !canUseCli && canUseAppLauncher;
|
|
69959
70012
|
if (!useAppLauncher && ide.cliCommand) {
|
|
69960
|
-
(0,
|
|
70013
|
+
(0, import_child_process7.spawn)(ide.cliCommand, args, { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
69961
70014
|
} else if (appName) {
|
|
69962
70015
|
const openArgs = ["-a", appName, "--args", ...args];
|
|
69963
|
-
(0,
|
|
70016
|
+
(0, import_child_process7.spawn)("open", openArgs, { detached: true, stdio: "ignore" }).unref();
|
|
69964
70017
|
} else {
|
|
69965
70018
|
throw new Error(`No app identifier or CLI for ${ide.displayName}`);
|
|
69966
70019
|
}
|
|
@@ -69986,7 +70039,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69986
70039
|
const args = ["--remote-debugging-port=" + port];
|
|
69987
70040
|
if (newWindow) args.push("--new-window");
|
|
69988
70041
|
if (workspace) args.push(workspace);
|
|
69989
|
-
(0,
|
|
70042
|
+
(0, import_child_process7.spawn)(cli, args, { detached: true, stdio: "ignore", windowsHide: true }).unref();
|
|
69990
70043
|
}
|
|
69991
70044
|
function getAvailableIdeIds() {
|
|
69992
70045
|
return getProviderLoader().getAvailableIdeTypes();
|
|
@@ -69997,9 +70050,9 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
69997
70050
|
init_dist();
|
|
69998
70051
|
init_logger();
|
|
69999
70052
|
var fs222 = __toESM2(require("fs"));
|
|
70000
|
-
var
|
|
70053
|
+
var path34 = __toESM2(require("path"));
|
|
70001
70054
|
var os25 = __toESM2(require("os"));
|
|
70002
|
-
var LOG_DIR2 = process.platform === "win32" ?
|
|
70055
|
+
var LOG_DIR2 = process.platform === "win32" ? path34.join(process.env.LOCALAPPDATA || process.env.APPDATA || path34.join(os25.homedir(), "AppData", "Local"), "adhdev", "logs") : process.platform === "darwin" ? path34.join(os25.homedir(), "Library", "Logs", "adhdev") : path34.join(os25.homedir(), ".local", "share", "adhdev", "logs");
|
|
70003
70056
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
70004
70057
|
var MAX_DAYS = 7;
|
|
70005
70058
|
try {
|
|
@@ -70037,13 +70090,13 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70037
70090
|
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
70038
70091
|
}
|
|
70039
70092
|
var currentDate2 = getDateStr2();
|
|
70040
|
-
var currentFile =
|
|
70093
|
+
var currentFile = path34.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
|
|
70041
70094
|
var writeCount2 = 0;
|
|
70042
70095
|
function checkRotation() {
|
|
70043
70096
|
const today = getDateStr2();
|
|
70044
70097
|
if (today !== currentDate2) {
|
|
70045
70098
|
currentDate2 = today;
|
|
70046
|
-
currentFile =
|
|
70099
|
+
currentFile = path34.join(LOG_DIR2, `commands-${currentDate2}.jsonl`);
|
|
70047
70100
|
cleanOldFiles();
|
|
70048
70101
|
}
|
|
70049
70102
|
}
|
|
@@ -70057,7 +70110,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70057
70110
|
const dateMatch = file2.match(/commands-(\d{4}-\d{2}-\d{2})/);
|
|
70058
70111
|
if (dateMatch && dateMatch[1] < cutoffStr) {
|
|
70059
70112
|
try {
|
|
70060
|
-
fs222.unlinkSync(
|
|
70113
|
+
fs222.unlinkSync(path34.join(LOG_DIR2, file2));
|
|
70061
70114
|
} catch {
|
|
70062
70115
|
}
|
|
70063
70116
|
}
|
|
@@ -70150,9 +70203,9 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70150
70203
|
var import_node_util4 = require("util");
|
|
70151
70204
|
var execFileAsync3 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
|
|
70152
70205
|
var MAX_CHANGED_FILES2 = 500;
|
|
70153
|
-
function topLevel(
|
|
70154
|
-
const slash =
|
|
70155
|
-
return slash === -1 ?
|
|
70206
|
+
function topLevel(path41) {
|
|
70207
|
+
const slash = path41.indexOf("/");
|
|
70208
|
+
return slash === -1 ? path41 : path41.slice(0, slash);
|
|
70156
70209
|
}
|
|
70157
70210
|
async function analyzeMeshRefineNodeChangeArea(args) {
|
|
70158
70211
|
const { nodeId, workspace, branch, baseRef, branchRef, diffCwd, submodulePaths } = args;
|
|
@@ -70248,10 +70301,10 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70248
70301
|
}
|
|
70249
70302
|
}
|
|
70250
70303
|
function readRecord6(repoRoot) {
|
|
70251
|
-
const
|
|
70252
|
-
if (!(0, import_node_fs4.existsSync)(
|
|
70304
|
+
const path41 = (0, import_node_path2.resolve)(repoRoot, PREVIEW_DEPLOY_RECORD);
|
|
70305
|
+
if (!(0, import_node_fs4.existsSync)(path41)) return null;
|
|
70253
70306
|
try {
|
|
70254
|
-
const parsed = JSON.parse((0, import_node_fs4.readFileSync)(
|
|
70307
|
+
const parsed = JSON.parse((0, import_node_fs4.readFileSync)(path41, "utf8"));
|
|
70255
70308
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
70256
70309
|
} catch {
|
|
70257
70310
|
return null;
|
|
@@ -70312,7 +70365,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70312
70365
|
};
|
|
70313
70366
|
}
|
|
70314
70367
|
init_mesh_refine_status();
|
|
70315
|
-
var
|
|
70368
|
+
var import_fs15 = require("fs");
|
|
70316
70369
|
var import_path10 = require("path");
|
|
70317
70370
|
var MESH_INIT_REFINE_CONFIG_PATH = MESH_REFINE_CONFIG_LOCATIONS[0];
|
|
70318
70371
|
var MESH_INIT_WORKTREE_BOOTSTRAP_CONFIG_PATH = MESH_WORKTREE_BOOTSTRAP_CONFIG_LOCATIONS[0];
|
|
@@ -70328,21 +70381,21 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70328
70381
|
];
|
|
70329
70382
|
function writeConfigFile(workspace, relativePath, config2) {
|
|
70330
70383
|
const target = (0, import_path10.join)(workspace, relativePath);
|
|
70331
|
-
(0,
|
|
70332
|
-
(0,
|
|
70384
|
+
(0, import_fs15.mkdirSync)((0, import_path10.dirname)(target), { recursive: true });
|
|
70385
|
+
(0, import_fs15.writeFileSync)(target, `${JSON.stringify(config2, null, 2)}
|
|
70333
70386
|
`, "utf-8");
|
|
70334
70387
|
return target;
|
|
70335
70388
|
}
|
|
70336
70389
|
function suggestMeshWorktreeBootstrapConfig(workspace) {
|
|
70337
70390
|
const commands = [];
|
|
70338
|
-
const hasPackageJson = (0,
|
|
70339
|
-
const hasNpmLock = (0,
|
|
70391
|
+
const hasPackageJson = (0, import_fs15.existsSync)((0, import_path10.join)(workspace, "package.json"));
|
|
70392
|
+
const hasNpmLock = (0, import_fs15.existsSync)((0, import_path10.join)(workspace, "package-lock.json"));
|
|
70340
70393
|
if (hasPackageJson) {
|
|
70341
70394
|
commands.push(
|
|
70342
70395
|
hasNpmLock ? { command: "npm", args: ["ci"] } : { command: "npm", args: ["install"] }
|
|
70343
70396
|
);
|
|
70344
70397
|
}
|
|
70345
|
-
const staleInputs = CANDIDATE_STALE_INPUTS.filter((relative5) => (0,
|
|
70398
|
+
const staleInputs = CANDIDATE_STALE_INPUTS.filter((relative5) => (0, import_fs15.existsSync)((0, import_path10.join)(workspace, relative5)));
|
|
70346
70399
|
if (!commands.length) {
|
|
70347
70400
|
return { commands, staleInputs };
|
|
70348
70401
|
}
|
|
@@ -70768,17 +70821,17 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70768
70821
|
};
|
|
70769
70822
|
}
|
|
70770
70823
|
init_build_info();
|
|
70771
|
-
var import_child_process7 = require("child_process");
|
|
70772
70824
|
var import_child_process8 = require("child_process");
|
|
70825
|
+
var import_child_process9 = require("child_process");
|
|
70773
70826
|
var fs23 = __toESM2(require("fs"));
|
|
70774
70827
|
var os27 = __toESM2(require("os"));
|
|
70775
|
-
var
|
|
70828
|
+
var path35 = __toESM2(require("path"));
|
|
70776
70829
|
var UPGRADE_HELPER_ENV = "ADHDEV_DAEMON_UPGRADE_HELPER";
|
|
70777
70830
|
function getUpgradeLogPath() {
|
|
70778
70831
|
const home = os27.homedir();
|
|
70779
|
-
const dir =
|
|
70832
|
+
const dir = path35.join(home, ".adhdev");
|
|
70780
70833
|
fs23.mkdirSync(dir, { recursive: true });
|
|
70781
|
-
return
|
|
70834
|
+
return path35.join(dir, "daemon-upgrade.log");
|
|
70782
70835
|
}
|
|
70783
70836
|
function appendUpgradeLog(message) {
|
|
70784
70837
|
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
|
|
@@ -70789,14 +70842,14 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70789
70842
|
}
|
|
70790
70843
|
}
|
|
70791
70844
|
function resolveSiblingNpmInvocation(nodeExecutable, platform10 = process.platform) {
|
|
70792
|
-
const binDir =
|
|
70845
|
+
const binDir = path35.dirname(nodeExecutable);
|
|
70793
70846
|
if (platform10 === "win32") {
|
|
70794
|
-
const npmCliPath =
|
|
70847
|
+
const npmCliPath = path35.join(binDir, "node_modules", "npm", "bin", "npm-cli.js");
|
|
70795
70848
|
if (fs23.existsSync(npmCliPath)) {
|
|
70796
70849
|
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
|
|
70797
70850
|
}
|
|
70798
70851
|
for (const candidate of ["npm.exe", "npm"]) {
|
|
70799
|
-
const candidatePath =
|
|
70852
|
+
const candidatePath = path35.join(binDir, candidate);
|
|
70800
70853
|
if (fs23.existsSync(candidatePath)) {
|
|
70801
70854
|
return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
|
|
70802
70855
|
}
|
|
@@ -70804,7 +70857,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70804
70857
|
return { executable: nodeExecutable, argsPrefix: [npmCliPath], execOptions: getNpmExecOptions(platform10) };
|
|
70805
70858
|
}
|
|
70806
70859
|
for (const candidate of ["npm"]) {
|
|
70807
|
-
const candidatePath =
|
|
70860
|
+
const candidatePath = path35.join(binDir, candidate);
|
|
70808
70861
|
if (fs23.existsSync(candidatePath)) {
|
|
70809
70862
|
return { executable: candidatePath, argsPrefix: [], execOptions: getNpmExecOptions(platform10) };
|
|
70810
70863
|
}
|
|
@@ -70821,13 +70874,13 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70821
70874
|
let currentDir = resolvedPath;
|
|
70822
70875
|
try {
|
|
70823
70876
|
if (fs23.statSync(resolvedPath).isFile()) {
|
|
70824
|
-
currentDir =
|
|
70877
|
+
currentDir = path35.dirname(resolvedPath);
|
|
70825
70878
|
}
|
|
70826
70879
|
} catch {
|
|
70827
|
-
currentDir =
|
|
70880
|
+
currentDir = path35.dirname(resolvedPath);
|
|
70828
70881
|
}
|
|
70829
70882
|
while (true) {
|
|
70830
|
-
const packageJsonPath =
|
|
70883
|
+
const packageJsonPath = path35.join(currentDir, "package.json");
|
|
70831
70884
|
try {
|
|
70832
70885
|
if (fs23.existsSync(packageJsonPath)) {
|
|
70833
70886
|
const parsed = JSON.parse(fs23.readFileSync(packageJsonPath, "utf8"));
|
|
@@ -70838,7 +70891,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70838
70891
|
}
|
|
70839
70892
|
} catch {
|
|
70840
70893
|
}
|
|
70841
|
-
const parentDir =
|
|
70894
|
+
const parentDir = path35.dirname(currentDir);
|
|
70842
70895
|
if (parentDir === currentDir) {
|
|
70843
70896
|
return null;
|
|
70844
70897
|
}
|
|
@@ -70846,13 +70899,13 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70846
70899
|
}
|
|
70847
70900
|
}
|
|
70848
70901
|
function resolveInstallPrefixFromPackageRoot(packageRoot, packageName) {
|
|
70849
|
-
const nodeModulesDir = packageName.startsWith("@") ?
|
|
70850
|
-
if (
|
|
70902
|
+
const nodeModulesDir = packageName.startsWith("@") ? path35.dirname(path35.dirname(packageRoot)) : path35.dirname(packageRoot);
|
|
70903
|
+
if (path35.basename(nodeModulesDir) !== "node_modules") {
|
|
70851
70904
|
return null;
|
|
70852
70905
|
}
|
|
70853
|
-
const maybeLibDir =
|
|
70854
|
-
if (
|
|
70855
|
-
return
|
|
70906
|
+
const maybeLibDir = path35.dirname(nodeModulesDir);
|
|
70907
|
+
if (path35.basename(maybeLibDir) === "lib") {
|
|
70908
|
+
return path35.dirname(maybeLibDir);
|
|
70856
70909
|
}
|
|
70857
70910
|
return maybeLibDir;
|
|
70858
70911
|
}
|
|
@@ -70880,6 +70933,16 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70880
70933
|
execOptions: surface.execOptions || getNpmExecOptions(options.platform)
|
|
70881
70934
|
};
|
|
70882
70935
|
}
|
|
70936
|
+
function buildInstallEnvWithNodeOnPath(baseEnv = process.env) {
|
|
70937
|
+
if (process.platform !== "win32") return { ...baseEnv };
|
|
70938
|
+
const nodeBinDir = path35.dirname(process.execPath);
|
|
70939
|
+
if (!nodeBinDir) return { ...baseEnv };
|
|
70940
|
+
const env2 = { ...baseEnv };
|
|
70941
|
+
const pathKey = Object.keys(env2).find((k) => k.toLowerCase() === "path") || "PATH";
|
|
70942
|
+
const current = env2[pathKey] || "";
|
|
70943
|
+
env2[pathKey] = current ? `${nodeBinDir};${current}` : nodeBinDir;
|
|
70944
|
+
return env2;
|
|
70945
|
+
}
|
|
70883
70946
|
function getNpmExecOptions(platform10 = process.platform) {
|
|
70884
70947
|
if (platform10 === "win32") {
|
|
70885
70948
|
return { shell: false, windowsHide: true };
|
|
@@ -70888,7 +70951,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70888
70951
|
}
|
|
70889
70952
|
function execNpmCommandSync(args, options = {}, surface) {
|
|
70890
70953
|
const execOptions = surface?.execOptions || getNpmExecOptions();
|
|
70891
|
-
return (0,
|
|
70954
|
+
return (0, import_child_process8.execFileSync)(
|
|
70892
70955
|
surface?.npmExecutable || "npm",
|
|
70893
70956
|
[...surface?.npmArgsPrefix || [], ...args],
|
|
70894
70957
|
{
|
|
@@ -70901,7 +70964,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70901
70964
|
function killPid2(pid) {
|
|
70902
70965
|
try {
|
|
70903
70966
|
if (process.platform === "win32") {
|
|
70904
|
-
(0,
|
|
70967
|
+
(0, import_child_process8.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
|
|
70905
70968
|
} else {
|
|
70906
70969
|
process.kill(pid, "SIGTERM");
|
|
70907
70970
|
}
|
|
@@ -70913,7 +70976,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70913
70976
|
function getWindowsProcessCommandLine(pid) {
|
|
70914
70977
|
const pidFilter = `ProcessId=${pid}`;
|
|
70915
70978
|
try {
|
|
70916
|
-
const psOut = (0,
|
|
70979
|
+
const psOut = (0, import_child_process8.execFileSync)("powershell.exe", [
|
|
70917
70980
|
"-NoProfile",
|
|
70918
70981
|
"-NonInteractive",
|
|
70919
70982
|
"-ExecutionPolicy",
|
|
@@ -70925,7 +70988,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70925
70988
|
} catch {
|
|
70926
70989
|
}
|
|
70927
70990
|
try {
|
|
70928
|
-
const wmicOut = (0,
|
|
70991
|
+
const wmicOut = (0, import_child_process8.execFileSync)("wmic", [
|
|
70929
70992
|
"process",
|
|
70930
70993
|
"where",
|
|
70931
70994
|
pidFilter,
|
|
@@ -70941,7 +71004,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70941
71004
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
70942
71005
|
if (process.platform === "win32") return getWindowsProcessCommandLine(pid);
|
|
70943
71006
|
try {
|
|
70944
|
-
const text = (0,
|
|
71007
|
+
const text = (0, import_child_process8.execFileSync)("ps", ["-o", "command=", "-p", String(pid)], {
|
|
70945
71008
|
encoding: "utf8",
|
|
70946
71009
|
timeout: 3e3,
|
|
70947
71010
|
stdio: ["ignore", "pipe", "ignore"]
|
|
@@ -70967,7 +71030,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70967
71030
|
}
|
|
70968
71031
|
}
|
|
70969
71032
|
function stopSessionHostProcesses(appName) {
|
|
70970
|
-
const pidFile =
|
|
71033
|
+
const pidFile = path35.join(os27.homedir(), ".adhdev", `${appName}-session-host.pid`);
|
|
70971
71034
|
try {
|
|
70972
71035
|
if (fs23.existsSync(pidFile)) {
|
|
70973
71036
|
const pid = Number.parseInt(fs23.readFileSync(pidFile, "utf8").trim(), 10);
|
|
@@ -70984,7 +71047,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70984
71047
|
}
|
|
70985
71048
|
}
|
|
70986
71049
|
function removeDaemonPidFile() {
|
|
70987
|
-
const pidFile =
|
|
71050
|
+
const pidFile = path35.join(os27.homedir(), ".adhdev", "daemon.pid");
|
|
70988
71051
|
try {
|
|
70989
71052
|
fs23.unlinkSync(pidFile);
|
|
70990
71053
|
} catch {
|
|
@@ -70995,7 +71058,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
70995
71058
|
const npmRoot = String(execNpmCommandSync(["root", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
|
|
70996
71059
|
if (!npmRoot) return;
|
|
70997
71060
|
const npmPrefix = surface.installPrefix || String(execNpmCommandSync(["prefix", "-g", ...prefixArgs], { encoding: "utf8" }, surface)).trim();
|
|
70998
|
-
const binDir = process.platform === "win32" ? npmPrefix :
|
|
71061
|
+
const binDir = process.platform === "win32" ? npmPrefix : path35.join(npmPrefix, "bin");
|
|
70999
71062
|
const packageBaseName = pkgName.startsWith("@") ? pkgName.split("/")[1] : pkgName;
|
|
71000
71063
|
const binNames = /* @__PURE__ */ new Set([packageBaseName]);
|
|
71001
71064
|
if (pkgName === "@adhdev/daemon-standalone") {
|
|
@@ -71003,31 +71066,31 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71003
71066
|
}
|
|
71004
71067
|
if (pkgName.startsWith("@")) {
|
|
71005
71068
|
const [scope, name] = pkgName.split("/");
|
|
71006
|
-
const scopeDir =
|
|
71069
|
+
const scopeDir = path35.join(npmRoot, scope);
|
|
71007
71070
|
if (!fs23.existsSync(scopeDir)) return;
|
|
71008
71071
|
for (const entry of fs23.readdirSync(scopeDir)) {
|
|
71009
71072
|
if (!entry.startsWith(`.${name}-`)) continue;
|
|
71010
|
-
fs23.rmSync(
|
|
71011
|
-
appendUpgradeLog(`Removed stale scoped staging dir: ${
|
|
71073
|
+
fs23.rmSync(path35.join(scopeDir, entry), { recursive: true, force: true });
|
|
71074
|
+
appendUpgradeLog(`Removed stale scoped staging dir: ${path35.join(scopeDir, entry)}`);
|
|
71012
71075
|
}
|
|
71013
71076
|
} else {
|
|
71014
71077
|
for (const entry of fs23.readdirSync(npmRoot)) {
|
|
71015
71078
|
if (!entry.startsWith(`.${pkgName}-`)) continue;
|
|
71016
|
-
fs23.rmSync(
|
|
71017
|
-
appendUpgradeLog(`Removed stale staging dir: ${
|
|
71079
|
+
fs23.rmSync(path35.join(npmRoot, entry), { recursive: true, force: true });
|
|
71080
|
+
appendUpgradeLog(`Removed stale staging dir: ${path35.join(npmRoot, entry)}`);
|
|
71018
71081
|
}
|
|
71019
71082
|
}
|
|
71020
71083
|
if (fs23.existsSync(binDir)) {
|
|
71021
71084
|
for (const entry of fs23.readdirSync(binDir)) {
|
|
71022
71085
|
if (!Array.from(binNames).some((name) => entry.startsWith(`.${name}-`))) continue;
|
|
71023
|
-
fs23.rmSync(
|
|
71024
|
-
appendUpgradeLog(`Removed stale bin staging entry: ${
|
|
71086
|
+
fs23.rmSync(path35.join(binDir, entry), { recursive: true, force: true });
|
|
71087
|
+
appendUpgradeLog(`Removed stale bin staging entry: ${path35.join(binDir, entry)}`);
|
|
71025
71088
|
}
|
|
71026
71089
|
}
|
|
71027
71090
|
}
|
|
71028
71091
|
function spawnDetachedDaemonUpgradeHelper(payload) {
|
|
71029
71092
|
const env2 = { ...process.env, [UPGRADE_HELPER_ENV]: JSON.stringify(payload) };
|
|
71030
|
-
const child = (0,
|
|
71093
|
+
const child = (0, import_child_process9.spawn)(process.execPath, process.argv.slice(1), {
|
|
71031
71094
|
detached: true,
|
|
71032
71095
|
stdio: "ignore",
|
|
71033
71096
|
windowsHide: true,
|
|
@@ -71057,13 +71120,14 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71057
71120
|
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
71058
71121
|
const spec = `${payload.packageName}@${payload.targetVersion || "latest"}`;
|
|
71059
71122
|
appendUpgradeLog(`Installing ${spec}`);
|
|
71060
|
-
const installOutput = (0,
|
|
71123
|
+
const installOutput = (0, import_child_process8.execFileSync)(
|
|
71061
71124
|
installCommand.command,
|
|
71062
71125
|
installCommand.args,
|
|
71063
71126
|
{
|
|
71064
71127
|
encoding: "utf8",
|
|
71065
71128
|
stdio: "pipe",
|
|
71066
71129
|
maxBuffer: 20 * 1024 * 1024,
|
|
71130
|
+
env: buildInstallEnvWithNodeOnPath(),
|
|
71067
71131
|
...installCommand.execOptions
|
|
71068
71132
|
}
|
|
71069
71133
|
);
|
|
@@ -71079,7 +71143,7 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
71079
71143
|
const env2 = { ...process.env };
|
|
71080
71144
|
delete env2[UPGRADE_HELPER_ENV];
|
|
71081
71145
|
appendUpgradeLog(`Restarting daemon with args: ${restartArgv.join(" ")}`);
|
|
71082
|
-
const child = (0,
|
|
71146
|
+
const child = (0, import_child_process9.spawn)(process.execPath, restartArgv, {
|
|
71083
71147
|
detached: true,
|
|
71084
71148
|
stdio: "ignore",
|
|
71085
71149
|
windowsHide: true,
|
|
@@ -72086,18 +72150,18 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
72086
72150
|
return { enabled: false };
|
|
72087
72151
|
}
|
|
72088
72152
|
async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
|
|
72089
|
-
const { execFileSync:
|
|
72153
|
+
const { execFileSync: execFileSync7 } = await import("child_process");
|
|
72090
72154
|
const diffArgs = ["diff", "--patch", "--full-index", fromRef, toRef];
|
|
72091
72155
|
if (excludePaths.length > 0) {
|
|
72092
|
-
diffArgs.push("--", ".", ...excludePaths.map((
|
|
72156
|
+
diffArgs.push("--", ".", ...excludePaths.map((path41) => `:(exclude)${path41}`));
|
|
72093
72157
|
}
|
|
72094
|
-
const diff =
|
|
72158
|
+
const diff = execFileSync7("git", diffArgs, {
|
|
72095
72159
|
cwd,
|
|
72096
72160
|
encoding: "utf8",
|
|
72097
72161
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
72098
72162
|
});
|
|
72099
72163
|
if (!diff.trim()) return "";
|
|
72100
|
-
const patchId =
|
|
72164
|
+
const patchId = execFileSync7("git", ["patch-id", "--stable"], {
|
|
72101
72165
|
cwd,
|
|
72102
72166
|
input: diff,
|
|
72103
72167
|
encoding: "utf8",
|
|
@@ -72108,8 +72172,8 @@ ${formatManifestValidationIssues2(validation2.issues)}`);
|
|
|
72108
72172
|
async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead) {
|
|
72109
72173
|
const startedAt = Date.now();
|
|
72110
72174
|
try {
|
|
72111
|
-
const { execFileSync:
|
|
72112
|
-
const git = (args) =>
|
|
72175
|
+
const { execFileSync: execFileSync7 } = await import("child_process");
|
|
72176
|
+
const git = (args) => execFileSync7("git", args, {
|
|
72113
72177
|
cwd: repoRoot,
|
|
72114
72178
|
encoding: "utf8",
|
|
72115
72179
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -72200,8 +72264,8 @@ ${e?.stderr || ""}`
|
|
|
72200
72264
|
async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
72201
72265
|
const startedAt = Date.now();
|
|
72202
72266
|
try {
|
|
72203
|
-
const { execFileSync:
|
|
72204
|
-
const git = (args, opts) =>
|
|
72267
|
+
const { execFileSync: execFileSync7 } = await import("child_process");
|
|
72268
|
+
const git = (args, opts) => execFileSync7("git", args, {
|
|
72205
72269
|
cwd: opts?.cwd || repoRoot,
|
|
72206
72270
|
encoding: "utf8",
|
|
72207
72271
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -72226,9 +72290,9 @@ ${e?.stderr || ""}`
|
|
|
72226
72290
|
if (!trimmed) continue;
|
|
72227
72291
|
if (trimmed.startsWith("+")) {
|
|
72228
72292
|
const parts = trimmed.slice(1).trim().split(/\s+/);
|
|
72229
|
-
const
|
|
72293
|
+
const path41 = parts[1] || parts[0] || "(unknown)";
|
|
72230
72294
|
submoduleHints.push({
|
|
72231
|
-
path:
|
|
72295
|
+
path: path41,
|
|
72232
72296
|
reason: "submodule checked-out commit differs from the committed gitlink (pointer bump not committed on the root branch)"
|
|
72233
72297
|
});
|
|
72234
72298
|
}
|
|
@@ -72258,10 +72322,10 @@ ${e?.stderr || ""}`
|
|
|
72258
72322
|
}
|
|
72259
72323
|
function buildPatchEquivalenceSubmoduleConflictHint(repoRoot, baseHead, branchHead, output) {
|
|
72260
72324
|
if (!/(submodule|160000)/i.test(output) || !/(conflict|failed to merge)/i.test(output)) return void 0;
|
|
72261
|
-
const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((
|
|
72262
|
-
path:
|
|
72263
|
-
baseCommit: readTreeObject(repoRoot, baseHead,
|
|
72264
|
-
branchCommit: readTreeObject(repoRoot, branchHead,
|
|
72325
|
+
const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path41) => ({
|
|
72326
|
+
path: path41,
|
|
72327
|
+
baseCommit: readTreeObject(repoRoot, baseHead, path41),
|
|
72328
|
+
branchCommit: readTreeObject(repoRoot, branchHead, path41)
|
|
72265
72329
|
}));
|
|
72266
72330
|
if (conflicts.length === 0) return void 0;
|
|
72267
72331
|
return {
|
|
@@ -72287,11 +72351,11 @@ ${e?.stderr || ""}`
|
|
|
72287
72351
|
if (!line.trim()) continue;
|
|
72288
72352
|
const metaAndPath = line.split(" ");
|
|
72289
72353
|
const meta3 = metaAndPath[0] || "";
|
|
72290
|
-
const
|
|
72291
|
-
if (!
|
|
72354
|
+
const path41 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
72355
|
+
if (!path41) continue;
|
|
72292
72356
|
const parts = meta3.split(/\s+/);
|
|
72293
72357
|
if (parts[0]?.includes("160000") || parts[1]?.includes("160000")) {
|
|
72294
|
-
paths.add(
|
|
72358
|
+
paths.add(path41);
|
|
72295
72359
|
}
|
|
72296
72360
|
}
|
|
72297
72361
|
return [...paths].sort();
|
|
@@ -72299,9 +72363,9 @@ ${e?.stderr || ""}`
|
|
|
72299
72363
|
return [];
|
|
72300
72364
|
}
|
|
72301
72365
|
}
|
|
72302
|
-
function readTreeObject(repoRoot, ref,
|
|
72366
|
+
function readTreeObject(repoRoot, ref, path41) {
|
|
72303
72367
|
try {
|
|
72304
|
-
const output = (0, import_node_child_process6.execFileSync)("git", ["ls-tree", ref, "--",
|
|
72368
|
+
const output = (0, import_node_child_process6.execFileSync)("git", ["ls-tree", ref, "--", path41], {
|
|
72305
72369
|
cwd: repoRoot,
|
|
72306
72370
|
encoding: "utf8",
|
|
72307
72371
|
maxBuffer: 1024 * 1024
|
|
@@ -72346,12 +72410,12 @@ ${e?.stderr || ""}`
|
|
|
72346
72410
|
if (!line.trim()) continue;
|
|
72347
72411
|
const metaAndPath = line.split(" ");
|
|
72348
72412
|
const meta3 = metaAndPath[0] || "";
|
|
72349
|
-
const
|
|
72350
|
-
if (!
|
|
72351
|
-
seen.add(
|
|
72413
|
+
const path41 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
72414
|
+
if (!path41 || seen.has(path41)) continue;
|
|
72415
|
+
seen.add(path41);
|
|
72352
72416
|
const parts = meta3.split(/\s+/);
|
|
72353
72417
|
const isGitlink = !!(parts[0]?.includes("160000") || parts[1]?.includes("160000"));
|
|
72354
|
-
result.push({ path:
|
|
72418
|
+
result.push({ path: path41, isGitlink });
|
|
72355
72419
|
}
|
|
72356
72420
|
return result;
|
|
72357
72421
|
} catch {
|
|
@@ -72359,20 +72423,20 @@ ${e?.stderr || ""}`
|
|
|
72359
72423
|
}
|
|
72360
72424
|
}
|
|
72361
72425
|
function collectFastForwardGitlinkPaths(repoRoot, baseHead, branchHead) {
|
|
72362
|
-
return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((
|
|
72363
|
-
const baseCommit = readTreeObject(repoRoot, baseHead,
|
|
72364
|
-
const branchCommit = readTreeObject(repoRoot, branchHead,
|
|
72426
|
+
return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((path41) => {
|
|
72427
|
+
const baseCommit = readTreeObject(repoRoot, baseHead, path41);
|
|
72428
|
+
const branchCommit = readTreeObject(repoRoot, branchHead, path41);
|
|
72365
72429
|
if (!baseCommit || !branchCommit) return false;
|
|
72366
|
-
return isSubmoduleFastForward((0, import_path11.resolve)(repoRoot,
|
|
72430
|
+
return isSubmoduleFastForward((0, import_path11.resolve)(repoRoot, path41), baseCommit, branchCommit);
|
|
72367
72431
|
});
|
|
72368
72432
|
}
|
|
72369
72433
|
function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
|
|
72370
|
-
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((
|
|
72371
|
-
const baseCommit = readTreeObject(repoRoot, baseHead,
|
|
72372
|
-
const branchCommit = readTreeObject(repoRoot, branchHead,
|
|
72373
|
-
const submoduleRepoPath = (0, import_path11.resolve)(repoRoot,
|
|
72434
|
+
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path41) => {
|
|
72435
|
+
const baseCommit = readTreeObject(repoRoot, baseHead, path41);
|
|
72436
|
+
const branchCommit = readTreeObject(repoRoot, branchHead, path41);
|
|
72437
|
+
const submoduleRepoPath = (0, import_path11.resolve)(repoRoot, path41);
|
|
72374
72438
|
const fastForward = !!baseCommit && !!branchCommit && isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit);
|
|
72375
|
-
return { path:
|
|
72439
|
+
return { path: path41, baseCommit, branchCommit, fastForward };
|
|
72376
72440
|
});
|
|
72377
72441
|
if (changedGitlinks.length === 0) {
|
|
72378
72442
|
return { trivial: false, reason: "no_changed_gitlinks", gitlinks: changedGitlinks };
|
|
@@ -72423,7 +72487,7 @@ ${e?.stderr || ""}`
|
|
|
72423
72487
|
maxBuffer: 1024 * 1024
|
|
72424
72488
|
}).trim();
|
|
72425
72489
|
if (!tree) return void 0;
|
|
72426
|
-
const updates = paths.map((
|
|
72490
|
+
const updates = paths.map((path41) => `160000 commit ${placeholderCommit} ${path41}`).join("\n");
|
|
72427
72491
|
if (!updates) return tree;
|
|
72428
72492
|
const tmpIndex = (0, import_path11.join)(resolveGitDir(repoRoot), `adhdev-refine-eq-${commitish.slice(0, 12)}.index`);
|
|
72429
72493
|
const env2 = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
@@ -72526,7 +72590,7 @@ ${e?.stderr || ""}`
|
|
|
72526
72590
|
}
|
|
72527
72591
|
async function alignRefinerySubmodulesAfterMerge(repoRoot, previousBaseHead, currentHead, options = {}) {
|
|
72528
72592
|
const startedAt = Date.now();
|
|
72529
|
-
const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((
|
|
72593
|
+
const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((path41) => !(options.submoduleIgnorePaths || []).includes(path41));
|
|
72530
72594
|
const preStatus = await getGitRepoStatus(repoRoot, {
|
|
72531
72595
|
includeSubmodules: true,
|
|
72532
72596
|
submoduleIgnorePaths: options.submoduleIgnorePaths,
|
|
@@ -72567,7 +72631,7 @@ ${e?.stderr || ""}`
|
|
|
72567
72631
|
changedGitlinkPaths,
|
|
72568
72632
|
outOfSyncPaths,
|
|
72569
72633
|
updatedPaths: updatePaths,
|
|
72570
|
-
verifiedPaths: updatePaths.filter((
|
|
72634
|
+
verifiedPaths: updatePaths.filter((path41) => !remaining.some((submodule) => submodule.path === path41)),
|
|
72571
72635
|
durationMs: Date.now() - startedAt,
|
|
72572
72636
|
command: `git ${commandArgs.join(" ")}`,
|
|
72573
72637
|
stdout: truncateValidationOutput(result.stdout),
|
|
@@ -75865,9 +75929,9 @@ ${hintLines.join("\n")}` : "",
|
|
|
75865
75929
|
// commands instead of going through fs from the browser.
|
|
75866
75930
|
case "list_coordinator_prompts": {
|
|
75867
75931
|
const fs30 = await import("fs");
|
|
75868
|
-
const
|
|
75932
|
+
const path41 = await import("path");
|
|
75869
75933
|
const os30 = await import("os");
|
|
75870
|
-
const dir =
|
|
75934
|
+
const dir = path41.join(os30.homedir(), ".adhdev", "coordinator-prompts");
|
|
75871
75935
|
const entries = {};
|
|
75872
75936
|
try {
|
|
75873
75937
|
if (fs30.existsSync(dir)) {
|
|
@@ -75878,7 +75942,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
75878
75942
|
if (!m) continue;
|
|
75879
75943
|
const isAppend = !!matchAppend;
|
|
75880
75944
|
const key = m[1];
|
|
75881
|
-
const full =
|
|
75945
|
+
const full = path41.join(dir, name);
|
|
75882
75946
|
let content = "";
|
|
75883
75947
|
try {
|
|
75884
75948
|
content = fs30.readFileSync(full, "utf8");
|
|
@@ -75896,7 +75960,7 @@ ${hintLines.join("\n")}` : "",
|
|
|
75896
75960
|
}
|
|
75897
75961
|
case "write_coordinator_prompt": {
|
|
75898
75962
|
const fs30 = await import("fs");
|
|
75899
|
-
const
|
|
75963
|
+
const path41 = await import("path");
|
|
75900
75964
|
const os30 = await import("os");
|
|
75901
75965
|
const key = typeof args?.key === "string" ? args.key.trim() : "";
|
|
75902
75966
|
const kind = args?.kind === "append" ? "append" : "override";
|
|
@@ -75904,9 +75968,9 @@ ${hintLines.join("\n")}` : "",
|
|
|
75904
75968
|
if (!key || !/^[a-zA-Z0-9_.-]+$/.test(key)) {
|
|
75905
75969
|
return { success: false, error: "key must match [a-zA-Z0-9_.-]+" };
|
|
75906
75970
|
}
|
|
75907
|
-
const dir =
|
|
75971
|
+
const dir = path41.join(os30.homedir(), ".adhdev", "coordinator-prompts");
|
|
75908
75972
|
const filename = kind === "append" ? `${key}.append.md` : `${key}.md`;
|
|
75909
|
-
const full =
|
|
75973
|
+
const full = path41.join(dir, filename);
|
|
75910
75974
|
try {
|
|
75911
75975
|
fs30.mkdirSync(dir, { recursive: true });
|
|
75912
75976
|
if (content.trim()) {
|
|
@@ -77461,7 +77525,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
77461
77525
|
workspace
|
|
77462
77526
|
};
|
|
77463
77527
|
}
|
|
77464
|
-
const { existsSync:
|
|
77528
|
+
const { existsSync: existsSync43, readFileSync: readFileSync35, writeFileSync: writeFileSync23, copyFileSync: copyFileSync4, mkdirSync: mkdirSync21 } = await import("fs");
|
|
77465
77529
|
const { dirname: dirname14 } = await import("path");
|
|
77466
77530
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
77467
77531
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -77504,7 +77568,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
77504
77568
|
if (hermesManualFallback) return returnManualFallback(message);
|
|
77505
77569
|
return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
|
|
77506
77570
|
}
|
|
77507
|
-
const hadExistingMcpConfig =
|
|
77571
|
+
const hadExistingMcpConfig = existsSync43(mcpConfigPath);
|
|
77508
77572
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
77509
77573
|
if (hermesBaseConfig) {
|
|
77510
77574
|
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname14(mcpConfigPath));
|
|
@@ -78022,7 +78086,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78022
78086
|
const { deriveMeshReviewInboxItems: deriveMeshReviewInboxItems2 } = await Promise.resolve().then(() => (init_mesh_review_inbox(), mesh_review_inbox_exports));
|
|
78023
78087
|
const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
78024
78088
|
const { getGitDiffSummary: getGitDiffSummary2 } = await Promise.resolve().then(() => (init_git_diff(), git_diff_exports));
|
|
78025
|
-
const { existsSync:
|
|
78089
|
+
const { existsSync: existsSync43 } = await import("fs");
|
|
78026
78090
|
const meshRecord = await this.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
78027
78091
|
const mesh = meshRecord?.mesh;
|
|
78028
78092
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
@@ -78041,7 +78105,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
78041
78105
|
const derivation = deriveMeshReviewInboxItems2({ nodes: nodeStatuses, ledgerEntries });
|
|
78042
78106
|
for (const item of derivation.items) {
|
|
78043
78107
|
const workspace = item.workspace;
|
|
78044
|
-
if (!workspace || !
|
|
78108
|
+
if (!workspace || !existsSync43(workspace)) continue;
|
|
78045
78109
|
const baseRef = item.defaultBranch ? `origin/${item.defaultBranch}` : "origin/main";
|
|
78046
78110
|
try {
|
|
78047
78111
|
const diffResult = await getGitDiffSummary2(workspace, { baseRef, maxFiles: 100 });
|
|
@@ -79766,11 +79830,11 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79766
79830
|
}
|
|
79767
79831
|
};
|
|
79768
79832
|
var fs25 = __toESM2(require("fs"));
|
|
79769
|
-
var
|
|
79833
|
+
var path36 = __toESM2(require("path"));
|
|
79770
79834
|
var os28 = __toESM2(require("os"));
|
|
79771
79835
|
var import_os4 = require("os");
|
|
79772
|
-
var
|
|
79773
|
-
var ARCHIVE_PATH =
|
|
79836
|
+
var import_child_process10 = require("child_process");
|
|
79837
|
+
var ARCHIVE_PATH = path36.join(os28.homedir(), ".adhdev", "version-history.json");
|
|
79774
79838
|
var MAX_ENTRIES_PER_PROVIDER = 20;
|
|
79775
79839
|
var VersionArchive = class {
|
|
79776
79840
|
history = {};
|
|
@@ -79817,7 +79881,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79817
79881
|
}
|
|
79818
79882
|
save() {
|
|
79819
79883
|
try {
|
|
79820
|
-
fs25.mkdirSync(
|
|
79884
|
+
fs25.mkdirSync(path36.dirname(ARCHIVE_PATH), { recursive: true });
|
|
79821
79885
|
fs25.writeFileSync(ARCHIVE_PATH, JSON.stringify(this.history, null, 2));
|
|
79822
79886
|
} catch {
|
|
79823
79887
|
}
|
|
@@ -79825,7 +79889,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79825
79889
|
};
|
|
79826
79890
|
async function runCommand(cmd, timeout = 1e4) {
|
|
79827
79891
|
return new Promise((resolve24) => {
|
|
79828
|
-
(0,
|
|
79892
|
+
(0, import_child_process10.exec)(cmd, {
|
|
79829
79893
|
encoding: "utf-8",
|
|
79830
79894
|
timeout
|
|
79831
79895
|
}, (error48, stdout) => {
|
|
@@ -79841,7 +79905,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79841
79905
|
for (const p of paths) {
|
|
79842
79906
|
if (!p) continue;
|
|
79843
79907
|
for (const ext of exes) {
|
|
79844
|
-
const fullPath =
|
|
79908
|
+
const fullPath = path36.join(p, name + ext);
|
|
79845
79909
|
try {
|
|
79846
79910
|
if (fs25.existsSync(fullPath)) {
|
|
79847
79911
|
const stat2 = fs25.statSync(fullPath);
|
|
@@ -79890,7 +79954,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79890
79954
|
for (const p of paths) {
|
|
79891
79955
|
if (p.includes("*")) {
|
|
79892
79956
|
const home = os28.homedir();
|
|
79893
|
-
const resolved = p.replace(/\*/g, home.split(
|
|
79957
|
+
const resolved = p.replace(/\*/g, home.split(path36.sep).pop() || "");
|
|
79894
79958
|
if (fs25.existsSync(resolved)) return resolved;
|
|
79895
79959
|
} else {
|
|
79896
79960
|
if (fs25.existsSync(p)) return p;
|
|
@@ -79900,7 +79964,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79900
79964
|
}
|
|
79901
79965
|
async function getMacAppVersion(appPath) {
|
|
79902
79966
|
if ((0, import_os4.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
|
|
79903
|
-
const plistPath =
|
|
79967
|
+
const plistPath = path36.join(appPath, "Contents", "Info.plist");
|
|
79904
79968
|
if (!fs25.existsSync(plistPath)) return null;
|
|
79905
79969
|
const raw = await runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
|
|
79906
79970
|
return raw || null;
|
|
@@ -79926,7 +79990,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79926
79990
|
const cliBin = provider.cli ? findBinary2(provider.cli) : null;
|
|
79927
79991
|
let resolvedBin = cliBin;
|
|
79928
79992
|
if (!resolvedBin && appPath && currentOs === "darwin") {
|
|
79929
|
-
const bundled =
|
|
79993
|
+
const bundled = path36.join(appPath, "Contents", "Resources", "app", "bin", provider.cli || "");
|
|
79930
79994
|
if (provider.cli && fs25.existsSync(bundled)) resolvedBin = bundled;
|
|
79931
79995
|
}
|
|
79932
79996
|
info.installed = !!(appPath || resolvedBin);
|
|
@@ -79965,7 +80029,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
79965
80029
|
}
|
|
79966
80030
|
var http2 = __toESM2(require("http"));
|
|
79967
80031
|
var fs29 = __toESM2(require("fs"));
|
|
79968
|
-
var
|
|
80032
|
+
var path40 = __toESM2(require("path"));
|
|
79969
80033
|
init_config();
|
|
79970
80034
|
function generateFiles(type, name, category, opts = {}) {
|
|
79971
80035
|
const { cdpPorts, cli, processName, installPath, binary, extensionId, version: version2 = "0.1" } = opts;
|
|
@@ -80310,7 +80374,7 @@ async (params) => {
|
|
|
80310
80374
|
}
|
|
80311
80375
|
init_logger();
|
|
80312
80376
|
var fs26 = __toESM2(require("fs"));
|
|
80313
|
-
var
|
|
80377
|
+
var path37 = __toESM2(require("path"));
|
|
80314
80378
|
init_logger();
|
|
80315
80379
|
async function handleCdpEvaluate(ctx, req, res) {
|
|
80316
80380
|
const body = await ctx.readBody(req);
|
|
@@ -80489,17 +80553,17 @@ async (params) => {
|
|
|
80489
80553
|
return;
|
|
80490
80554
|
}
|
|
80491
80555
|
let scriptsPath = "";
|
|
80492
|
-
const directScripts =
|
|
80556
|
+
const directScripts = path37.join(dir, "scripts.js");
|
|
80493
80557
|
if (fs26.existsSync(directScripts)) {
|
|
80494
80558
|
scriptsPath = directScripts;
|
|
80495
80559
|
} else {
|
|
80496
|
-
const scriptsDir =
|
|
80560
|
+
const scriptsDir = path37.join(dir, "scripts");
|
|
80497
80561
|
if (fs26.existsSync(scriptsDir)) {
|
|
80498
80562
|
const versions = fs26.readdirSync(scriptsDir).filter((d) => {
|
|
80499
|
-
return fs26.statSync(
|
|
80563
|
+
return fs26.statSync(path37.join(scriptsDir, d)).isDirectory();
|
|
80500
80564
|
}).sort().reverse();
|
|
80501
80565
|
for (const ver of versions) {
|
|
80502
|
-
const p =
|
|
80566
|
+
const p = path37.join(scriptsDir, ver, "scripts.js");
|
|
80503
80567
|
if (fs26.existsSync(p)) {
|
|
80504
80568
|
scriptsPath = p;
|
|
80505
80569
|
break;
|
|
@@ -81326,7 +81390,7 @@ async (params) => {
|
|
|
81326
81390
|
}
|
|
81327
81391
|
}
|
|
81328
81392
|
var fs27 = __toESM2(require("fs"));
|
|
81329
|
-
var
|
|
81393
|
+
var path38 = __toESM2(require("path"));
|
|
81330
81394
|
function slugifyFixtureName(value) {
|
|
81331
81395
|
const normalized = String(value || "").trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
81332
81396
|
return normalized || `fixture-${Date.now()}`;
|
|
@@ -81336,11 +81400,11 @@ async (params) => {
|
|
|
81336
81400
|
if (!providerDir) {
|
|
81337
81401
|
throw new Error(`Provider directory not found for '${type}'`);
|
|
81338
81402
|
}
|
|
81339
|
-
return
|
|
81403
|
+
return path38.join(providerDir, "fixtures");
|
|
81340
81404
|
}
|
|
81341
81405
|
function readCliFixture(ctx, type, name) {
|
|
81342
81406
|
const fixtureDir = getCliFixtureDir(ctx, type);
|
|
81343
|
-
const filePath =
|
|
81407
|
+
const filePath = path38.join(fixtureDir, `${name}.json`);
|
|
81344
81408
|
if (!fs27.existsSync(filePath)) {
|
|
81345
81409
|
throw new Error(`Fixture not found: ${filePath}`);
|
|
81346
81410
|
}
|
|
@@ -82116,7 +82180,7 @@ async (params) => {
|
|
|
82116
82180
|
},
|
|
82117
82181
|
notes: typeof body?.notes === "string" ? body.notes : void 0
|
|
82118
82182
|
};
|
|
82119
|
-
const filePath =
|
|
82183
|
+
const filePath = path38.join(fixtureDir, `${name}.json`);
|
|
82120
82184
|
fs27.writeFileSync(filePath, JSON.stringify(fixture, null, 2));
|
|
82121
82185
|
ctx.json(res, 200, {
|
|
82122
82186
|
saved: true,
|
|
@@ -82140,7 +82204,7 @@ async (params) => {
|
|
|
82140
82204
|
return;
|
|
82141
82205
|
}
|
|
82142
82206
|
const fixtures = fs27.readdirSync(fixtureDir).filter((file2) => file2.endsWith(".json")).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" })).map((file2) => {
|
|
82143
|
-
const fullPath =
|
|
82207
|
+
const fullPath = path38.join(fixtureDir, file2);
|
|
82144
82208
|
try {
|
|
82145
82209
|
const raw = JSON.parse(fs27.readFileSync(fullPath, "utf-8"));
|
|
82146
82210
|
return {
|
|
@@ -82274,7 +82338,7 @@ async (params) => {
|
|
|
82274
82338
|
}
|
|
82275
82339
|
}
|
|
82276
82340
|
var fs28 = __toESM2(require("fs"));
|
|
82277
|
-
var
|
|
82341
|
+
var path39 = __toESM2(require("path"));
|
|
82278
82342
|
var os29 = __toESM2(require("os"));
|
|
82279
82343
|
var import_session_host_core8 = require_dist();
|
|
82280
82344
|
function getAutoImplPid(ctx) {
|
|
@@ -82325,22 +82389,22 @@ async (params) => {
|
|
|
82325
82389
|
if (!fs28.existsSync(scriptsDir)) return null;
|
|
82326
82390
|
const versions = fs28.readdirSync(scriptsDir).filter((d) => {
|
|
82327
82391
|
try {
|
|
82328
|
-
return fs28.statSync(
|
|
82392
|
+
return fs28.statSync(path39.join(scriptsDir, d)).isDirectory();
|
|
82329
82393
|
} catch {
|
|
82330
82394
|
return false;
|
|
82331
82395
|
}
|
|
82332
82396
|
}).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
|
|
82333
82397
|
if (versions.length === 0) return null;
|
|
82334
|
-
return
|
|
82398
|
+
return path39.join(scriptsDir, versions[0]);
|
|
82335
82399
|
}
|
|
82336
82400
|
function resolveAutoImplWritableProviderDir(ctx, category, type, requestedDir) {
|
|
82337
|
-
const canonicalUserDir =
|
|
82338
|
-
const desiredDir = requestedDir ?
|
|
82339
|
-
const upstreamRoot =
|
|
82340
|
-
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${
|
|
82401
|
+
const canonicalUserDir = path39.resolve(ctx.providerLoader.getUserProviderDir(category, type));
|
|
82402
|
+
const desiredDir = requestedDir ? path39.resolve(requestedDir) : canonicalUserDir;
|
|
82403
|
+
const upstreamRoot = path39.resolve(ctx.providerLoader.getUpstreamDir());
|
|
82404
|
+
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path39.sep}`)) {
|
|
82341
82405
|
return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
|
|
82342
82406
|
}
|
|
82343
|
-
if (
|
|
82407
|
+
if (path39.basename(desiredDir) !== type) {
|
|
82344
82408
|
return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
|
|
82345
82409
|
}
|
|
82346
82410
|
const sourceDir = ctx.findProviderDir(type);
|
|
@@ -82348,11 +82412,11 @@ async (params) => {
|
|
|
82348
82412
|
return { dir: null, reason: `Provider source directory not found for '${type}'` };
|
|
82349
82413
|
}
|
|
82350
82414
|
if (!fs28.existsSync(desiredDir)) {
|
|
82351
|
-
fs28.mkdirSync(
|
|
82415
|
+
fs28.mkdirSync(path39.dirname(desiredDir), { recursive: true });
|
|
82352
82416
|
fs28.cpSync(sourceDir, desiredDir, { recursive: true });
|
|
82353
82417
|
ctx.log(`Auto-implement writable copy created: ${desiredDir}`);
|
|
82354
82418
|
}
|
|
82355
|
-
const providerJson =
|
|
82419
|
+
const providerJson = path39.join(desiredDir, "provider.json");
|
|
82356
82420
|
if (!fs28.existsSync(providerJson)) {
|
|
82357
82421
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
82358
82422
|
}
|
|
@@ -82363,13 +82427,13 @@ async (params) => {
|
|
|
82363
82427
|
const refDir = ctx.findProviderDir(referenceType);
|
|
82364
82428
|
if (!refDir || !fs28.existsSync(refDir)) return {};
|
|
82365
82429
|
const referenceScripts = {};
|
|
82366
|
-
const scriptsDir =
|
|
82430
|
+
const scriptsDir = path39.join(refDir, "scripts");
|
|
82367
82431
|
const latestDir = getLatestScriptVersionDir(scriptsDir);
|
|
82368
82432
|
if (!latestDir) return referenceScripts;
|
|
82369
82433
|
for (const file2 of fs28.readdirSync(latestDir)) {
|
|
82370
82434
|
if (!file2.endsWith(".js")) continue;
|
|
82371
82435
|
try {
|
|
82372
|
-
referenceScripts[file2] = fs28.readFileSync(
|
|
82436
|
+
referenceScripts[file2] = fs28.readFileSync(path39.join(latestDir, file2), "utf-8");
|
|
82373
82437
|
} catch {
|
|
82374
82438
|
}
|
|
82375
82439
|
}
|
|
@@ -82477,9 +82541,9 @@ async (params) => {
|
|
|
82477
82541
|
});
|
|
82478
82542
|
const referenceScripts = loadAutoImplReferenceScripts(ctx, resolvedReference);
|
|
82479
82543
|
const prompt = buildAutoImplPrompt(ctx, type, provider, providerDir, functions, domContext, referenceScripts, comment, resolvedReference, verification);
|
|
82480
|
-
const tmpDir =
|
|
82544
|
+
const tmpDir = path39.join(os29.tmpdir(), "adhdev-autoimpl");
|
|
82481
82545
|
if (!fs28.existsSync(tmpDir)) fs28.mkdirSync(tmpDir, { recursive: true });
|
|
82482
|
-
const promptFile =
|
|
82546
|
+
const promptFile = path39.join(tmpDir, `prompt-${type}-${Date.now()}.md`);
|
|
82483
82547
|
fs28.writeFileSync(promptFile, prompt, "utf-8");
|
|
82484
82548
|
ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
|
|
82485
82549
|
const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
|
|
@@ -82911,7 +82975,7 @@ async (params) => {
|
|
|
82911
82975
|
setMode: "set_mode.js"
|
|
82912
82976
|
};
|
|
82913
82977
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
82914
|
-
const scriptsDir =
|
|
82978
|
+
const scriptsDir = path39.join(providerDir, "scripts");
|
|
82915
82979
|
const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
|
|
82916
82980
|
if (latestScriptsDir) {
|
|
82917
82981
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -82922,7 +82986,7 @@ async (params) => {
|
|
|
82922
82986
|
for (const file2 of fs28.readdirSync(latestScriptsDir)) {
|
|
82923
82987
|
if (file2.endsWith(".js") && targetFileNames.has(file2)) {
|
|
82924
82988
|
try {
|
|
82925
|
-
const content = fs28.readFileSync(
|
|
82989
|
+
const content = fs28.readFileSync(path39.join(latestScriptsDir, file2), "utf-8");
|
|
82926
82990
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
82927
82991
|
lines.push("```javascript");
|
|
82928
82992
|
lines.push(content);
|
|
@@ -82939,7 +83003,7 @@ async (params) => {
|
|
|
82939
83003
|
lines.push("");
|
|
82940
83004
|
for (const file2 of refFiles) {
|
|
82941
83005
|
try {
|
|
82942
|
-
const content = fs28.readFileSync(
|
|
83006
|
+
const content = fs28.readFileSync(path39.join(latestScriptsDir, file2), "utf-8");
|
|
82943
83007
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
82944
83008
|
lines.push("```javascript");
|
|
82945
83009
|
lines.push(content);
|
|
@@ -82980,10 +83044,10 @@ async (params) => {
|
|
|
82980
83044
|
lines.push("");
|
|
82981
83045
|
}
|
|
82982
83046
|
}
|
|
82983
|
-
const docsDir =
|
|
83047
|
+
const docsDir = path39.join(providerDir, "../../docs");
|
|
82984
83048
|
const loadGuide = (name) => {
|
|
82985
83049
|
try {
|
|
82986
|
-
const p =
|
|
83050
|
+
const p = path39.join(docsDir, name);
|
|
82987
83051
|
if (fs28.existsSync(p)) return fs28.readFileSync(p, "utf-8");
|
|
82988
83052
|
} catch {
|
|
82989
83053
|
}
|
|
@@ -83220,7 +83284,7 @@ async (params) => {
|
|
|
83220
83284
|
parseApproval: "parse_approval.js"
|
|
83221
83285
|
};
|
|
83222
83286
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
83223
|
-
const scriptsDir =
|
|
83287
|
+
const scriptsDir = path39.join(providerDir, "scripts");
|
|
83224
83288
|
const latestScriptsDir = getLatestScriptVersionDir(scriptsDir);
|
|
83225
83289
|
if (latestScriptsDir) {
|
|
83226
83290
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -83232,7 +83296,7 @@ async (params) => {
|
|
|
83232
83296
|
if (!file2.endsWith(".js")) continue;
|
|
83233
83297
|
if (!targetFileNames.has(file2)) continue;
|
|
83234
83298
|
try {
|
|
83235
|
-
const content = fs28.readFileSync(
|
|
83299
|
+
const content = fs28.readFileSync(path39.join(latestScriptsDir, file2), "utf-8");
|
|
83236
83300
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
83237
83301
|
lines.push("```javascript");
|
|
83238
83302
|
lines.push(content);
|
|
@@ -83248,7 +83312,7 @@ async (params) => {
|
|
|
83248
83312
|
lines.push("");
|
|
83249
83313
|
for (const file2 of refFiles) {
|
|
83250
83314
|
try {
|
|
83251
|
-
const content = fs28.readFileSync(
|
|
83315
|
+
const content = fs28.readFileSync(path39.join(latestScriptsDir, file2), "utf-8");
|
|
83252
83316
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
83253
83317
|
lines.push("```javascript");
|
|
83254
83318
|
lines.push(content);
|
|
@@ -83281,10 +83345,10 @@ async (params) => {
|
|
|
83281
83345
|
lines.push("");
|
|
83282
83346
|
}
|
|
83283
83347
|
}
|
|
83284
|
-
const docsDir =
|
|
83348
|
+
const docsDir = path39.join(providerDir, "../../docs");
|
|
83285
83349
|
const loadGuide = (name) => {
|
|
83286
83350
|
try {
|
|
83287
|
-
const p =
|
|
83351
|
+
const p = path39.join(docsDir, name);
|
|
83288
83352
|
if (fs28.existsSync(p)) return fs28.readFileSync(p, "utf-8");
|
|
83289
83353
|
} catch {
|
|
83290
83354
|
}
|
|
@@ -83729,8 +83793,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
83729
83793
|
}
|
|
83730
83794
|
getEndpointList() {
|
|
83731
83795
|
return this.routes.map((r) => {
|
|
83732
|
-
const
|
|
83733
|
-
return `${r.method.padEnd(5)} ${
|
|
83796
|
+
const path41 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
|
|
83797
|
+
return `${r.method.padEnd(5)} ${path41}`;
|
|
83734
83798
|
});
|
|
83735
83799
|
}
|
|
83736
83800
|
async start(port = DEV_SERVER_PORT) {
|
|
@@ -84018,12 +84082,12 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84018
84082
|
// ─── DevConsole SPA ───
|
|
84019
84083
|
getConsoleDistDir() {
|
|
84020
84084
|
const candidates = [
|
|
84021
|
-
|
|
84022
|
-
|
|
84023
|
-
|
|
84085
|
+
path40.resolve(__dirname, "../../web-devconsole/dist"),
|
|
84086
|
+
path40.resolve(__dirname, "../../../web-devconsole/dist"),
|
|
84087
|
+
path40.join(process.cwd(), "packages/web-devconsole/dist")
|
|
84024
84088
|
];
|
|
84025
84089
|
for (const dir of candidates) {
|
|
84026
|
-
if (fs29.existsSync(
|
|
84090
|
+
if (fs29.existsSync(path40.join(dir, "index.html"))) return dir;
|
|
84027
84091
|
}
|
|
84028
84092
|
return null;
|
|
84029
84093
|
}
|
|
@@ -84033,7 +84097,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84033
84097
|
this.json(res, 500, { error: "DevConsole not found. Run: npm run build -w packages/web-devconsole" });
|
|
84034
84098
|
return;
|
|
84035
84099
|
}
|
|
84036
|
-
const htmlPath =
|
|
84100
|
+
const htmlPath = path40.join(distDir, "index.html");
|
|
84037
84101
|
try {
|
|
84038
84102
|
const html = fs29.readFileSync(htmlPath, "utf-8");
|
|
84039
84103
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
@@ -84058,15 +84122,15 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84058
84122
|
this.json(res, 404, { error: "Not found" });
|
|
84059
84123
|
return;
|
|
84060
84124
|
}
|
|
84061
|
-
const safePath =
|
|
84062
|
-
const filePath =
|
|
84125
|
+
const safePath = path40.normalize(pathname).replace(/^\.\.\//, "");
|
|
84126
|
+
const filePath = path40.join(distDir, safePath);
|
|
84063
84127
|
if (!filePath.startsWith(distDir)) {
|
|
84064
84128
|
this.json(res, 403, { error: "Forbidden" });
|
|
84065
84129
|
return;
|
|
84066
84130
|
}
|
|
84067
84131
|
try {
|
|
84068
84132
|
const content = fs29.readFileSync(filePath);
|
|
84069
|
-
const ext =
|
|
84133
|
+
const ext = path40.extname(filePath);
|
|
84070
84134
|
const contentType = _DevServer.MIME_MAP[ext] || "application/octet-stream";
|
|
84071
84135
|
res.writeHead(200, { "Content-Type": contentType, "Cache-Control": "public, max-age=31536000, immutable" });
|
|
84072
84136
|
res.end(content);
|
|
@@ -84179,9 +84243,9 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84179
84243
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
84180
84244
|
if (entry.isDirectory()) {
|
|
84181
84245
|
files.push({ path: rel, size: 0, type: "dir" });
|
|
84182
|
-
scan(
|
|
84246
|
+
scan(path40.join(d, entry.name), rel);
|
|
84183
84247
|
} else {
|
|
84184
|
-
const stat2 = fs29.statSync(
|
|
84248
|
+
const stat2 = fs29.statSync(path40.join(d, entry.name));
|
|
84185
84249
|
files.push({ path: rel, size: stat2.size, type: "file" });
|
|
84186
84250
|
}
|
|
84187
84251
|
}
|
|
@@ -84204,7 +84268,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84204
84268
|
this.json(res, 404, { error: `Provider directory not found: ${type}` });
|
|
84205
84269
|
return;
|
|
84206
84270
|
}
|
|
84207
|
-
const fullPath =
|
|
84271
|
+
const fullPath = path40.resolve(dir, path40.normalize(filePath));
|
|
84208
84272
|
if (!fullPath.startsWith(dir)) {
|
|
84209
84273
|
this.json(res, 403, { error: "Forbidden" });
|
|
84210
84274
|
return;
|
|
@@ -84229,14 +84293,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84229
84293
|
this.json(res, 404, { error: `Provider directory not found: ${type}` });
|
|
84230
84294
|
return;
|
|
84231
84295
|
}
|
|
84232
|
-
const fullPath =
|
|
84296
|
+
const fullPath = path40.resolve(dir, path40.normalize(filePath));
|
|
84233
84297
|
if (!fullPath.startsWith(dir)) {
|
|
84234
84298
|
this.json(res, 403, { error: "Forbidden" });
|
|
84235
84299
|
return;
|
|
84236
84300
|
}
|
|
84237
84301
|
try {
|
|
84238
84302
|
if (fs29.existsSync(fullPath)) fs29.copyFileSync(fullPath, fullPath + ".bak");
|
|
84239
|
-
fs29.mkdirSync(
|
|
84303
|
+
fs29.mkdirSync(path40.dirname(fullPath), { recursive: true });
|
|
84240
84304
|
fs29.writeFileSync(fullPath, content, "utf-8");
|
|
84241
84305
|
this.log(`File saved: ${fullPath} (${content.length} chars)`);
|
|
84242
84306
|
this.providerLoader.reload();
|
|
@@ -84253,7 +84317,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84253
84317
|
return;
|
|
84254
84318
|
}
|
|
84255
84319
|
for (const name of ["scripts.js", "provider.json"]) {
|
|
84256
|
-
const p =
|
|
84320
|
+
const p = path40.join(dir, name);
|
|
84257
84321
|
if (fs29.existsSync(p)) {
|
|
84258
84322
|
const source = fs29.readFileSync(p, "utf-8");
|
|
84259
84323
|
this.json(res, 200, { type, path: p, source, lines: source.split("\n").length });
|
|
@@ -84274,8 +84338,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84274
84338
|
this.json(res, 404, { error: `Provider not found: ${type}` });
|
|
84275
84339
|
return;
|
|
84276
84340
|
}
|
|
84277
|
-
const target = fs29.existsSync(
|
|
84278
|
-
const targetPath =
|
|
84341
|
+
const target = fs29.existsSync(path40.join(dir, "scripts.js")) ? "scripts.js" : "provider.json";
|
|
84342
|
+
const targetPath = path40.join(dir, target);
|
|
84279
84343
|
try {
|
|
84280
84344
|
if (fs29.existsSync(targetPath)) fs29.copyFileSync(targetPath, targetPath + ".bak");
|
|
84281
84345
|
fs29.writeFileSync(targetPath, source, "utf-8");
|
|
@@ -84422,7 +84486,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84422
84486
|
}
|
|
84423
84487
|
let targetDir;
|
|
84424
84488
|
targetDir = this.providerLoader.getUserProviderDir(category, type);
|
|
84425
|
-
const jsonPath =
|
|
84489
|
+
const jsonPath = path40.join(targetDir, "provider.json");
|
|
84426
84490
|
if (fs29.existsSync(jsonPath)) {
|
|
84427
84491
|
this.json(res, 409, { error: `Provider already exists at ${targetDir}`, path: targetDir });
|
|
84428
84492
|
return;
|
|
@@ -84434,8 +84498,8 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84434
84498
|
const createdFiles = ["provider.json"];
|
|
84435
84499
|
if (result.files) {
|
|
84436
84500
|
for (const [relPath, content] of Object.entries(result.files)) {
|
|
84437
|
-
const fullPath =
|
|
84438
|
-
fs29.mkdirSync(
|
|
84501
|
+
const fullPath = path40.join(targetDir, relPath);
|
|
84502
|
+
fs29.mkdirSync(path40.dirname(fullPath), { recursive: true });
|
|
84439
84503
|
fs29.writeFileSync(fullPath, content, "utf-8");
|
|
84440
84504
|
createdFiles.push(relPath);
|
|
84441
84505
|
}
|
|
@@ -84488,22 +84552,22 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84488
84552
|
if (!fs29.existsSync(scriptsDir)) return null;
|
|
84489
84553
|
const versions = fs29.readdirSync(scriptsDir).filter((d) => {
|
|
84490
84554
|
try {
|
|
84491
|
-
return fs29.statSync(
|
|
84555
|
+
return fs29.statSync(path40.join(scriptsDir, d)).isDirectory();
|
|
84492
84556
|
} catch {
|
|
84493
84557
|
return false;
|
|
84494
84558
|
}
|
|
84495
84559
|
}).sort((a, b) => b.localeCompare(a, void 0, { numeric: true, sensitivity: "base" }));
|
|
84496
84560
|
if (versions.length === 0) return null;
|
|
84497
|
-
return
|
|
84561
|
+
return path40.join(scriptsDir, versions[0]);
|
|
84498
84562
|
}
|
|
84499
84563
|
resolveAutoImplWritableProviderDir(category, type, requestedDir) {
|
|
84500
|
-
const canonicalUserDir =
|
|
84501
|
-
const desiredDir = requestedDir ?
|
|
84502
|
-
const upstreamRoot =
|
|
84503
|
-
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${
|
|
84564
|
+
const canonicalUserDir = path40.resolve(this.providerLoader.getUserProviderDir(category, type));
|
|
84565
|
+
const desiredDir = requestedDir ? path40.resolve(requestedDir) : canonicalUserDir;
|
|
84566
|
+
const upstreamRoot = path40.resolve(this.providerLoader.getUpstreamDir());
|
|
84567
|
+
if (desiredDir === upstreamRoot || desiredDir.startsWith(`${upstreamRoot}${path40.sep}`)) {
|
|
84504
84568
|
return { dir: null, reason: `Refusing to write into upstream provider directory: ${desiredDir}` };
|
|
84505
84569
|
}
|
|
84506
|
-
if (
|
|
84570
|
+
if (path40.basename(desiredDir) !== type) {
|
|
84507
84571
|
return { dir: null, reason: `Requested writable provider directory must end with '${type}': ${desiredDir}` };
|
|
84508
84572
|
}
|
|
84509
84573
|
const sourceDir = this.findProviderDir(type);
|
|
@@ -84511,11 +84575,11 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84511
84575
|
return { dir: null, reason: `Provider source directory not found for '${type}'` };
|
|
84512
84576
|
}
|
|
84513
84577
|
if (!fs29.existsSync(desiredDir)) {
|
|
84514
|
-
fs29.mkdirSync(
|
|
84578
|
+
fs29.mkdirSync(path40.dirname(desiredDir), { recursive: true });
|
|
84515
84579
|
fs29.cpSync(sourceDir, desiredDir, { recursive: true });
|
|
84516
84580
|
this.log(`Auto-implement writable copy created: ${desiredDir}`);
|
|
84517
84581
|
}
|
|
84518
|
-
const providerJson =
|
|
84582
|
+
const providerJson = path40.join(desiredDir, "provider.json");
|
|
84519
84583
|
if (!fs29.existsSync(providerJson)) {
|
|
84520
84584
|
return { dir: null, reason: `provider.json not found in writable provider directory: ${desiredDir}` };
|
|
84521
84585
|
}
|
|
@@ -84551,7 +84615,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84551
84615
|
setMode: "set_mode.js"
|
|
84552
84616
|
};
|
|
84553
84617
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
84554
|
-
const scriptsDir =
|
|
84618
|
+
const scriptsDir = path40.join(providerDir, "scripts");
|
|
84555
84619
|
const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
|
|
84556
84620
|
if (latestScriptsDir) {
|
|
84557
84621
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -84562,7 +84626,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84562
84626
|
for (const file2 of fs29.readdirSync(latestScriptsDir)) {
|
|
84563
84627
|
if (file2.endsWith(".js") && targetFileNames.has(file2)) {
|
|
84564
84628
|
try {
|
|
84565
|
-
const content = fs29.readFileSync(
|
|
84629
|
+
const content = fs29.readFileSync(path40.join(latestScriptsDir, file2), "utf-8");
|
|
84566
84630
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
84567
84631
|
lines.push("```javascript");
|
|
84568
84632
|
lines.push(content);
|
|
@@ -84579,7 +84643,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84579
84643
|
lines.push("");
|
|
84580
84644
|
for (const file2 of refFiles) {
|
|
84581
84645
|
try {
|
|
84582
|
-
const content = fs29.readFileSync(
|
|
84646
|
+
const content = fs29.readFileSync(path40.join(latestScriptsDir, file2), "utf-8");
|
|
84583
84647
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
84584
84648
|
lines.push("```javascript");
|
|
84585
84649
|
lines.push(content);
|
|
@@ -84620,10 +84684,10 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84620
84684
|
lines.push("");
|
|
84621
84685
|
}
|
|
84622
84686
|
}
|
|
84623
|
-
const docsDir =
|
|
84687
|
+
const docsDir = path40.join(providerDir, "../../docs");
|
|
84624
84688
|
const loadGuide = (name) => {
|
|
84625
84689
|
try {
|
|
84626
|
-
const p =
|
|
84690
|
+
const p = path40.join(docsDir, name);
|
|
84627
84691
|
if (fs29.existsSync(p)) return fs29.readFileSync(p, "utf-8");
|
|
84628
84692
|
} catch {
|
|
84629
84693
|
}
|
|
@@ -84797,7 +84861,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84797
84861
|
parseApproval: "parse_approval.js"
|
|
84798
84862
|
};
|
|
84799
84863
|
const targetFileNames = new Set(functions.map((fn) => funcToFile[fn]).filter(Boolean));
|
|
84800
|
-
const scriptsDir =
|
|
84864
|
+
const scriptsDir = path40.join(providerDir, "scripts");
|
|
84801
84865
|
const latestScriptsDir = this.getLatestScriptVersionDir(scriptsDir);
|
|
84802
84866
|
if (latestScriptsDir) {
|
|
84803
84867
|
lines.push(`Scripts version directory: \`${latestScriptsDir}\``);
|
|
@@ -84809,7 +84873,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84809
84873
|
if (!file2.endsWith(".js")) continue;
|
|
84810
84874
|
if (!targetFileNames.has(file2)) continue;
|
|
84811
84875
|
try {
|
|
84812
|
-
const content = fs29.readFileSync(
|
|
84876
|
+
const content = fs29.readFileSync(path40.join(latestScriptsDir, file2), "utf-8");
|
|
84813
84877
|
lines.push(`### \`${file2}\` \u270F\uFE0F EDIT`);
|
|
84814
84878
|
lines.push("```javascript");
|
|
84815
84879
|
lines.push(content);
|
|
@@ -84825,7 +84889,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84825
84889
|
lines.push("");
|
|
84826
84890
|
for (const file2 of refFiles) {
|
|
84827
84891
|
try {
|
|
84828
|
-
const content = fs29.readFileSync(
|
|
84892
|
+
const content = fs29.readFileSync(path40.join(latestScriptsDir, file2), "utf-8");
|
|
84829
84893
|
lines.push(`### \`${file2}\` \u{1F512}`);
|
|
84830
84894
|
lines.push("```javascript");
|
|
84831
84895
|
lines.push(content);
|
|
@@ -84858,10 +84922,10 @@ data: ${JSON.stringify(msg.data)}
|
|
|
84858
84922
|
lines.push("");
|
|
84859
84923
|
}
|
|
84860
84924
|
}
|
|
84861
|
-
const docsDir =
|
|
84925
|
+
const docsDir = path40.join(providerDir, "../../docs");
|
|
84862
84926
|
const loadGuide = (name) => {
|
|
84863
84927
|
try {
|
|
84864
|
-
const p =
|
|
84928
|
+
const p = path40.join(docsDir, name);
|
|
84865
84929
|
if (fs29.existsSync(p)) return fs29.readFileSync(p, "utf-8");
|
|
84866
84930
|
} catch {
|
|
84867
84931
|
}
|
|
@@ -85122,6 +85186,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
85122
85186
|
init_pty_transport();
|
|
85123
85187
|
var import_session_host_core9 = require_dist();
|
|
85124
85188
|
init_logger();
|
|
85189
|
+
init_resolve_executable();
|
|
85125
85190
|
function shouldResumeAttachedSession(record2) {
|
|
85126
85191
|
if (!record2) return false;
|
|
85127
85192
|
if (record2.lifecycle === "interrupted") return true;
|
|
@@ -85501,7 +85566,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
85501
85566
|
spawn(command, args, spawnOptions) {
|
|
85502
85567
|
return new SessionHostRuntimeTransport({
|
|
85503
85568
|
...this.options,
|
|
85504
|
-
command,
|
|
85569
|
+
command: resolveWin32Executable(command),
|
|
85505
85570
|
args,
|
|
85506
85571
|
spawnOptions
|
|
85507
85572
|
});
|
|
@@ -85820,7 +85885,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
85820
85885
|
if (raw === "0" || raw === "false" || raw === "no") return false;
|
|
85821
85886
|
return raw === "1" || raw === "true" || raw === "yes";
|
|
85822
85887
|
}
|
|
85823
|
-
var
|
|
85888
|
+
var import_child_process11 = require("child_process");
|
|
85824
85889
|
var import_util32 = require("util");
|
|
85825
85890
|
var EXTENSION_CATALOG = [
|
|
85826
85891
|
// AI Agent extensions
|
|
@@ -85908,7 +85973,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
85908
85973
|
apiKeyName: "OpenAI/Anthropic API key"
|
|
85909
85974
|
}
|
|
85910
85975
|
];
|
|
85911
|
-
var execAsync4 = (0, import_util32.promisify)(
|
|
85976
|
+
var execAsync4 = (0, import_util32.promisify)(import_child_process11.exec);
|
|
85912
85977
|
async function isExtensionInstalled(ide, marketplaceId) {
|
|
85913
85978
|
if (!ide.cliCommand) return false;
|
|
85914
85979
|
try {
|
|
@@ -85952,7 +86017,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
85952
86017
|
fs30.writeFileSync(vsixPath, buffer);
|
|
85953
86018
|
return new Promise((resolve24) => {
|
|
85954
86019
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
85955
|
-
(0,
|
|
86020
|
+
(0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
85956
86021
|
resolve24({
|
|
85957
86022
|
extensionId: extension.id,
|
|
85958
86023
|
marketplaceId: extension.marketplaceId,
|
|
@@ -85968,7 +86033,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
85968
86033
|
}
|
|
85969
86034
|
return new Promise((resolve24) => {
|
|
85970
86035
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
85971
|
-
(0,
|
|
86036
|
+
(0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
|
|
85972
86037
|
if (error48) {
|
|
85973
86038
|
resolve24({
|
|
85974
86039
|
extensionId: extension.id,
|
|
@@ -86005,7 +86070,7 @@ data: ${JSON.stringify(msg.data)}
|
|
|
86005
86070
|
if (!ide.cliCommand) return false;
|
|
86006
86071
|
try {
|
|
86007
86072
|
const args = workspacePath ? `"${workspacePath}"` : "";
|
|
86008
|
-
(0,
|
|
86073
|
+
(0, import_child_process11.exec)(`"${ide.cliCommand}" ${args}`, { timeout: 1e4 });
|
|
86009
86074
|
return true;
|
|
86010
86075
|
} catch {
|
|
86011
86076
|
return false;
|