@adhdev/daemon-core 0.9.82-rc.447 → 0.9.82-rc.448
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.d.ts +2 -0
- package/dist/index.js +575 -431
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +576 -430
- package/dist/index.mjs.map +1 -1
- package/dist/session-host/managed-host.d.ts +64 -0
- package/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/session-host/managed-host.ts +218 -0
package/dist/index.mjs
CHANGED
|
@@ -404,10 +404,10 @@ function readInjected(value) {
|
|
|
404
404
|
}
|
|
405
405
|
function getDaemonBuildInfo() {
|
|
406
406
|
if (cached) return cached;
|
|
407
|
-
const commit = readInjected(true ? "
|
|
408
|
-
const commitShort = readInjected(true ? "
|
|
409
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
410
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
407
|
+
const commit = readInjected(true ? "7636b9d4fc6c456ebfe178b9b0a7b81664b02257" : void 0) ?? "unknown";
|
|
408
|
+
const commitShort = readInjected(true ? "7636b9d4" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
409
|
+
const version = readInjected(true ? "0.9.82-rc.448" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
410
|
+
const builtAt = readInjected(true ? "2026-07-02T00:30:54.215Z" : void 0);
|
|
411
411
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
412
412
|
return cached;
|
|
413
413
|
}
|
|
@@ -484,8 +484,8 @@ function validateChangeImpactConfig(raw, source = "inline") {
|
|
|
484
484
|
}
|
|
485
485
|
return { valid: errors.length === 0, errors, config: errors.length === 0 ? config : void 0 };
|
|
486
486
|
}
|
|
487
|
-
function parseConfigText(
|
|
488
|
-
if (/\.json$/i.test(
|
|
487
|
+
function parseConfigText(path44, text) {
|
|
488
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
489
489
|
return yaml.load(text);
|
|
490
490
|
}
|
|
491
491
|
function loadChangeImpactConfig(repoRoot) {
|
|
@@ -1099,14 +1099,14 @@ async function deriveSubmoduleGitlinkStatuses(repo, options) {
|
|
|
1099
1099
|
const lastCheckedAt = Date.now();
|
|
1100
1100
|
const headOidByPath = /* @__PURE__ */ new Map();
|
|
1101
1101
|
const entries = await Promise.all(
|
|
1102
|
-
paths.filter((
|
|
1103
|
-
const repoPath = repo.repoRoot + "/" +
|
|
1104
|
-
const expected = await readGitlinkExpectedSha(repo,
|
|
1102
|
+
paths.filter((path44) => !ignoreSet.has(path44)).map(async (path44) => {
|
|
1103
|
+
const repoPath = repo.repoRoot + "/" + path44;
|
|
1104
|
+
const expected = await readGitlinkExpectedSha(repo, path44, options);
|
|
1105
1105
|
const actual = await readSubmoduleHeadSha(repo, repoPath, options);
|
|
1106
|
-
if (actual) headOidByPath.set(
|
|
1106
|
+
if (actual) headOidByPath.set(path44, actual);
|
|
1107
1107
|
const outOfSync = actual === null ? true : expected !== null && expected !== actual;
|
|
1108
1108
|
return {
|
|
1109
|
-
path:
|
|
1109
|
+
path: path44,
|
|
1110
1110
|
// Prefer the recorded gitlink SHA (matches the legacy column); fall back
|
|
1111
1111
|
// to the checked-out SHA so the field is never empty when both are known.
|
|
1112
1112
|
commit: expected ?? actual ?? "",
|
|
@@ -2551,12 +2551,12 @@ function readGitSubmodules(value, parentRepoRoot) {
|
|
|
2551
2551
|
if (!Array.isArray(value)) return void 0;
|
|
2552
2552
|
const submodules = value.map((entry) => {
|
|
2553
2553
|
const submodule = readRecord(entry);
|
|
2554
|
-
const
|
|
2554
|
+
const path44 = readString2(submodule.path);
|
|
2555
2555
|
const commit = readString2(submodule.commit);
|
|
2556
|
-
const repoPath = readString2(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot,
|
|
2557
|
-
if (!
|
|
2556
|
+
const repoPath = readString2(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path44);
|
|
2557
|
+
if (!path44 || !commit) return null;
|
|
2558
2558
|
const result = {
|
|
2559
|
-
path:
|
|
2559
|
+
path: path44,
|
|
2560
2560
|
commit,
|
|
2561
2561
|
dirty: readBoolean(submodule.dirty) ?? false,
|
|
2562
2562
|
outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
|
|
@@ -2884,10 +2884,10 @@ function getMeshConfigPath() {
|
|
|
2884
2884
|
return join5(getConfigDir(), "meshes.json");
|
|
2885
2885
|
}
|
|
2886
2886
|
function loadMeshConfig() {
|
|
2887
|
-
const
|
|
2888
|
-
if (!existsSync5(
|
|
2887
|
+
const path44 = getMeshConfigPath();
|
|
2888
|
+
if (!existsSync5(path44)) return { meshes: [] };
|
|
2889
2889
|
try {
|
|
2890
|
-
const raw = JSON.parse(readFileSync3(
|
|
2890
|
+
const raw = JSON.parse(readFileSync3(path44, "utf-8"));
|
|
2891
2891
|
if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
|
|
2892
2892
|
const config = raw;
|
|
2893
2893
|
const migrated = migrateLoadedMeshConfig(config);
|
|
@@ -2936,16 +2936,16 @@ function normalizeCapabilityTags(value) {
|
|
|
2936
2936
|
return tags.length ? tags : void 0;
|
|
2937
2937
|
}
|
|
2938
2938
|
function saveMeshConfig(config) {
|
|
2939
|
-
const
|
|
2940
|
-
writeFileSync2(
|
|
2939
|
+
const path44 = getMeshConfigPath();
|
|
2940
|
+
writeFileSync2(path44, JSON.stringify(config, null, 2), { encoding: "utf-8", mode: 384 });
|
|
2941
2941
|
}
|
|
2942
2942
|
function normalizeRepoIdentity(remoteUrl) {
|
|
2943
2943
|
let identity = remoteUrl.trim();
|
|
2944
2944
|
if (identity.startsWith("http://") || identity.startsWith("https://")) {
|
|
2945
2945
|
try {
|
|
2946
2946
|
const url = new URL(identity);
|
|
2947
|
-
const
|
|
2948
|
-
return `${url.hostname}/${
|
|
2947
|
+
const path44 = url.pathname.replace(/^\//, "").replace(/\.git$/, "");
|
|
2948
|
+
return `${url.hostname}/${path44}`;
|
|
2949
2949
|
} catch {
|
|
2950
2950
|
}
|
|
2951
2951
|
}
|
|
@@ -4184,10 +4184,10 @@ function rotateArchiveFile(meshId, archivePath) {
|
|
|
4184
4184
|
}
|
|
4185
4185
|
}
|
|
4186
4186
|
function readArchivedCounts(meshId) {
|
|
4187
|
-
const
|
|
4188
|
-
if (!existsSync7(
|
|
4187
|
+
const path44 = getArchivedCountsPath(meshId);
|
|
4188
|
+
if (!existsSync7(path44)) return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
|
|
4189
4189
|
try {
|
|
4190
|
-
return JSON.parse(readFileSync5(
|
|
4190
|
+
return JSON.parse(readFileSync5(path44, "utf-8"));
|
|
4191
4191
|
} catch {
|
|
4192
4192
|
return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
|
|
4193
4193
|
}
|
|
@@ -5394,11 +5394,11 @@ function readNodeReporter(node, key2) {
|
|
|
5394
5394
|
function buildMeshNodeCapabilityTags(node, providerType) {
|
|
5395
5395
|
const provider = typeof providerType === "string" && providerType.trim() ? providerType.trim() : firstProviderPriority(node?.policy);
|
|
5396
5396
|
const worktreeBranch = typeof node?.worktreeBranch === "string" && node.worktreeBranch.trim() ? node.worktreeBranch.trim() : null;
|
|
5397
|
-
const
|
|
5397
|
+
const os31 = readNodeOverride(node, "platform") ?? readNodeReporter(node, "platform") ?? process.platform;
|
|
5398
5398
|
const arch2 = readNodeOverride(node, "arch") ?? readNodeReporter(node, "arch") ?? process.arch;
|
|
5399
5399
|
return normalizeMeshCapabilityTags([
|
|
5400
5400
|
...Array.isArray(node?.capabilities) ? node.capabilities : [],
|
|
5401
|
-
`os=${
|
|
5401
|
+
`os=${os31}`,
|
|
5402
5402
|
`arch=${arch2}`,
|
|
5403
5403
|
...provider ? [`provider=${provider}`] : [],
|
|
5404
5404
|
// Worktree nodes automatically expose a "worktree=<branch>" tag so that
|
|
@@ -6291,10 +6291,10 @@ var init_mesh_runtime_store = __esm({
|
|
|
6291
6291
|
this.migratedMeshIds.add(meshId);
|
|
6292
6292
|
const count = this.db.prepare("SELECT COUNT(*) AS count FROM mesh_queue WHERE mesh_id = ?").get(meshId);
|
|
6293
6293
|
if (count.count > 0) return;
|
|
6294
|
-
const
|
|
6295
|
-
if (!existsSync8(
|
|
6294
|
+
const path44 = legacyQueuePath(meshId);
|
|
6295
|
+
if (!existsSync8(path44)) return;
|
|
6296
6296
|
try {
|
|
6297
|
-
const entries = JSON.parse(readFileSync6(
|
|
6297
|
+
const entries = JSON.parse(readFileSync6(path44, "utf-8"));
|
|
6298
6298
|
if (!Array.isArray(entries)) return;
|
|
6299
6299
|
const insert = this.db.prepare(`
|
|
6300
6300
|
INSERT OR REPLACE INTO mesh_queue (
|
|
@@ -8122,8 +8122,8 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
8122
8122
|
}
|
|
8123
8123
|
const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
|
|
8124
8124
|
if (mcpConfig.mode === "auto_import") {
|
|
8125
|
-
const
|
|
8126
|
-
if (!
|
|
8125
|
+
const path44 = mcpConfig.path?.trim();
|
|
8126
|
+
if (!path44) {
|
|
8127
8127
|
return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
|
|
8128
8128
|
}
|
|
8129
8129
|
const mcpServer = resolveAdhdevMcpServerLaunch({
|
|
@@ -8143,7 +8143,7 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
8143
8143
|
return {
|
|
8144
8144
|
kind: "auto_import",
|
|
8145
8145
|
serverName,
|
|
8146
|
-
configPath: resolveMcpConfigPath(
|
|
8146
|
+
configPath: resolveMcpConfigPath(path44, workspace),
|
|
8147
8147
|
configFormat: mcpConfig.format,
|
|
8148
8148
|
mcpServer
|
|
8149
8149
|
};
|
|
@@ -8344,8 +8344,8 @@ function stripCoordinatorWrapperFile(filePath) {
|
|
|
8344
8344
|
const remaining = (existing.slice(0, openIdx) + existing.slice(closeIdx + CLOSE.length)).replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
|
|
8345
8345
|
if (!remaining.trim()) {
|
|
8346
8346
|
try {
|
|
8347
|
-
const
|
|
8348
|
-
|
|
8347
|
+
const fs39 = __require("fs");
|
|
8348
|
+
fs39.unlinkSync(filePath);
|
|
8349
8349
|
} catch {
|
|
8350
8350
|
}
|
|
8351
8351
|
} else {
|
|
@@ -8445,10 +8445,10 @@ function getRegistryPath() {
|
|
|
8445
8445
|
return join11(getDaemonDataDir(), "mesh-coordinators.json");
|
|
8446
8446
|
}
|
|
8447
8447
|
function loadMeshCoordinatorRegistry() {
|
|
8448
|
-
const
|
|
8449
|
-
if (!existsSync10(
|
|
8448
|
+
const path44 = getRegistryPath();
|
|
8449
|
+
if (!existsSync10(path44)) return;
|
|
8450
8450
|
try {
|
|
8451
|
-
const raw = JSON.parse(readFileSync8(
|
|
8451
|
+
const raw = JSON.parse(readFileSync8(path44, "utf-8"));
|
|
8452
8452
|
if (!Array.isArray(raw)) return;
|
|
8453
8453
|
_registry.clear();
|
|
8454
8454
|
for (const entry of raw) {
|
|
@@ -8620,8 +8620,8 @@ function validateMeshRefineConfig(config, source = "inline") {
|
|
|
8620
8620
|
if (rejectedCommands.length) errors.push("one or more validation commands are invalid");
|
|
8621
8621
|
return { valid: errors.length === 0, errors, bootstrapCommands, commands, rejectedCommands, bootstrapMode, deprecationWarnings };
|
|
8622
8622
|
}
|
|
8623
|
-
function parseConfigText2(
|
|
8624
|
-
if (/\.json$/i.test(
|
|
8623
|
+
function parseConfigText2(path44, text) {
|
|
8624
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
8625
8625
|
return yaml2.load(text);
|
|
8626
8626
|
}
|
|
8627
8627
|
function loadMeshRefineConfig(mesh, workspace) {
|
|
@@ -8951,8 +8951,8 @@ function isCleanIgnoringSubmoduleGitlinks(porcelain, submodulePaths) {
|
|
|
8951
8951
|
const lines = porcelain.split(/\r?\n/).filter((line) => line.length > 0);
|
|
8952
8952
|
for (const line of lines) {
|
|
8953
8953
|
const status = line.slice(0, 2);
|
|
8954
|
-
const
|
|
8955
|
-
const isGitlinkPointerMove = (status === " M" || status === "M ") && submodulePaths.has(
|
|
8954
|
+
const path44 = line.slice(3).trim().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
8955
|
+
const isGitlinkPointerMove = (status === " M" || status === "M ") && submodulePaths.has(path44);
|
|
8956
8956
|
if (!isGitlinkPointerMove) return false;
|
|
8957
8957
|
}
|
|
8958
8958
|
return true;
|
|
@@ -8983,8 +8983,8 @@ function isWorktreeBootstrapStaleRunning(node, nowMs = Date.now()) {
|
|
|
8983
8983
|
return false;
|
|
8984
8984
|
}
|
|
8985
8985
|
}
|
|
8986
|
-
function parseConfigText3(
|
|
8987
|
-
if (/\.json$/i.test(
|
|
8986
|
+
function parseConfigText3(path44, text) {
|
|
8987
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
8988
8988
|
return yaml3.load(text);
|
|
8989
8989
|
}
|
|
8990
8990
|
function truncateOutput(value) {
|
|
@@ -9129,16 +9129,16 @@ async function runMeshWorktreeBootstrap(mesh, workspace) {
|
|
|
9129
9129
|
const startedAt = Date.now();
|
|
9130
9130
|
state.lastCommand = command.displayCommand;
|
|
9131
9131
|
const resolvedCommand = resolveWin32Executable(command.command);
|
|
9132
|
-
const
|
|
9132
|
+
const spawn5 = buildWin32ExecFileSpawn(resolvedCommand, command.args);
|
|
9133
9133
|
try {
|
|
9134
|
-
const result = await execFileAsync4(
|
|
9134
|
+
const result = await execFileAsync4(spawn5.file, spawn5.args, {
|
|
9135
9135
|
cwd,
|
|
9136
9136
|
encoding: "utf8",
|
|
9137
9137
|
timeout: command.timeoutMs || DEFAULT_TIMEOUT_MS2,
|
|
9138
9138
|
maxBuffer: command.outputLimitBytes || DEFAULT_OUTPUT_LIMIT_BYTES,
|
|
9139
9139
|
env: { ...process.env, CI: process.env.CI || "1", ...command.env || {} },
|
|
9140
9140
|
windowsHide: true,
|
|
9141
|
-
...
|
|
9141
|
+
...spawn5.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
9142
9142
|
});
|
|
9143
9143
|
state.commandsRun?.push({
|
|
9144
9144
|
command: command.command,
|
|
@@ -9258,8 +9258,8 @@ import * as yaml4 from "js-yaml";
|
|
|
9258
9258
|
function isRecord3(value) {
|
|
9259
9259
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
9260
9260
|
}
|
|
9261
|
-
function parseConfigText4(
|
|
9262
|
-
if (/\.json$/i.test(
|
|
9261
|
+
function parseConfigText4(path44, text) {
|
|
9262
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
9263
9263
|
return yaml4.load(text);
|
|
9264
9264
|
}
|
|
9265
9265
|
function normalizeOperatingNote(value) {
|
|
@@ -11065,10 +11065,10 @@ function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
|
11065
11065
|
const primaryDaemonId = daemonIds[0];
|
|
11066
11066
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11067
11067
|
const events = [];
|
|
11068
|
-
for (const
|
|
11069
|
-
if (!existsSync15(
|
|
11068
|
+
for (const path44 of paths) {
|
|
11069
|
+
if (!existsSync15(path44)) continue;
|
|
11070
11070
|
try {
|
|
11071
|
-
const raw = readFileSync12(
|
|
11071
|
+
const raw = readFileSync12(path44, "utf-8");
|
|
11072
11072
|
const parsed = raw.split("\n").filter(Boolean).flatMap((line) => {
|
|
11073
11073
|
try {
|
|
11074
11074
|
return [JSON.parse(line)];
|
|
@@ -11076,7 +11076,7 @@ function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
|
11076
11076
|
return [];
|
|
11077
11077
|
}
|
|
11078
11078
|
});
|
|
11079
|
-
const filtered = primaryDaemonId &&
|
|
11079
|
+
const filtered = primaryDaemonId && path44 === getPendingEventsPath(meshId) ? parsed.filter((e) => !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId)) : parsed;
|
|
11080
11080
|
events.push(...filtered);
|
|
11081
11081
|
} catch {
|
|
11082
11082
|
}
|
|
@@ -11141,11 +11141,11 @@ function reconcilePendingMeshCoordinatorEvents(meshId, events) {
|
|
|
11141
11141
|
const reconciled = terminalJobIds.size === 0 ? events : events.filter((event) => !(event.event === "refine:accepted" && terminalJobIds.has(readRefineJobId2(event))));
|
|
11142
11142
|
return backfilled.length === 0 ? reconciled : [...reconciled, ...backfilled];
|
|
11143
11143
|
}
|
|
11144
|
-
function trimPendingEventsIfNeeded(
|
|
11144
|
+
function trimPendingEventsIfNeeded(path44) {
|
|
11145
11145
|
try {
|
|
11146
|
-
if (!existsSync15(
|
|
11147
|
-
if (statSync6(
|
|
11148
|
-
const lines = readFileSync12(
|
|
11146
|
+
if (!existsSync15(path44)) return;
|
|
11147
|
+
if (statSync6(path44).size <= MAX_PENDING_EVENTS_BYTES) return;
|
|
11148
|
+
const lines = readFileSync12(path44, "utf-8").split("\n").filter(Boolean);
|
|
11149
11149
|
if (lines.length <= MAX_PENDING_EVENTS_KEEP) return;
|
|
11150
11150
|
const dropped = lines.slice(0, lines.length - MAX_PENDING_EVENTS_KEEP);
|
|
11151
11151
|
for (const line of dropped) {
|
|
@@ -11178,7 +11178,7 @@ function trimPendingEventsIfNeeded(path43) {
|
|
|
11178
11178
|
LOG.warn("MeshEvents", `Failed to ledger-record trim-dropped ${event.event} for mesh ${event.meshId}: ${e?.message || e}`);
|
|
11179
11179
|
}
|
|
11180
11180
|
}
|
|
11181
|
-
writeFileSync6(
|
|
11181
|
+
writeFileSync6(path44, lines.slice(-MAX_PENDING_EVENTS_KEEP).join("\n") + "\n", "utf-8");
|
|
11182
11182
|
} catch {
|
|
11183
11183
|
}
|
|
11184
11184
|
}
|
|
@@ -11208,9 +11208,9 @@ function queuePendingMeshCoordinatorEvent(event) {
|
|
|
11208
11208
|
} catch {
|
|
11209
11209
|
}
|
|
11210
11210
|
try {
|
|
11211
|
-
const
|
|
11212
|
-
trimPendingEventsIfNeeded(
|
|
11213
|
-
appendFileSync2(
|
|
11211
|
+
const path44 = getPendingEventsPath(event.meshId, event.targetCoordinatorDaemonId);
|
|
11212
|
+
trimPendingEventsIfNeeded(path44);
|
|
11213
|
+
appendFileSync2(path44, JSON.stringify(event) + "\n", "utf-8");
|
|
11214
11214
|
} catch (e) {
|
|
11215
11215
|
if (!sqliteOk) throw e;
|
|
11216
11216
|
LOG.warn("MeshEvents", `JSONL append failed for mesh ${event.meshId}; SQLite holds the event: ${e?.message || e}`);
|
|
@@ -11221,10 +11221,10 @@ function queuePendingMeshCoordinatorEvent(event) {
|
|
|
11221
11221
|
return false;
|
|
11222
11222
|
}
|
|
11223
11223
|
}
|
|
11224
|
-
function atomicDrainFile(
|
|
11225
|
-
const tmpPath = `${
|
|
11224
|
+
function atomicDrainFile(path44) {
|
|
11225
|
+
const tmpPath = `${path44}.draining`;
|
|
11226
11226
|
try {
|
|
11227
|
-
renameSync4(
|
|
11227
|
+
renameSync4(path44, tmpPath);
|
|
11228
11228
|
} catch {
|
|
11229
11229
|
return null;
|
|
11230
11230
|
}
|
|
@@ -11243,10 +11243,10 @@ function atomicDrainFile(path43) {
|
|
|
11243
11243
|
return null;
|
|
11244
11244
|
}
|
|
11245
11245
|
}
|
|
11246
|
-
function selectiveDrainFile(
|
|
11247
|
-
const tmpPath = `${
|
|
11246
|
+
function selectiveDrainFile(path44, predicate) {
|
|
11247
|
+
const tmpPath = `${path44}.draining`;
|
|
11248
11248
|
try {
|
|
11249
|
-
renameSync4(
|
|
11249
|
+
renameSync4(path44, tmpPath);
|
|
11250
11250
|
} catch {
|
|
11251
11251
|
return [];
|
|
11252
11252
|
}
|
|
@@ -11278,12 +11278,12 @@ function selectiveDrainFile(path43, predicate) {
|
|
|
11278
11278
|
}
|
|
11279
11279
|
try {
|
|
11280
11280
|
if (keptLines.length > 0) {
|
|
11281
|
-
writeFileSync6(
|
|
11281
|
+
writeFileSync6(path44, keptLines.join("\n") + "\n", "utf-8");
|
|
11282
11282
|
}
|
|
11283
11283
|
unlinkSync2(tmpPath);
|
|
11284
11284
|
} catch {
|
|
11285
11285
|
try {
|
|
11286
|
-
if (existsSync15(tmpPath) && !existsSync15(
|
|
11286
|
+
if (existsSync15(tmpPath) && !existsSync15(path44)) renameSync4(tmpPath, path44);
|
|
11287
11287
|
} catch {
|
|
11288
11288
|
}
|
|
11289
11289
|
return [];
|
|
@@ -11318,16 +11318,16 @@ function drainPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId, opts) {
|
|
|
11318
11318
|
LOG.warn("MeshEvents", `SQLite pending-event drain failed for mesh ${meshId}; JSONL fallback only: ${e?.message || e}`);
|
|
11319
11319
|
}
|
|
11320
11320
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11321
|
-
for (const
|
|
11322
|
-
const isSharedFile = !!primaryDaemonId &&
|
|
11321
|
+
for (const path44 of paths) {
|
|
11322
|
+
const isSharedFile = !!primaryDaemonId && path44 === getPendingEventsPath(meshId);
|
|
11323
11323
|
const targets = (e) => !isSharedFile || !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId);
|
|
11324
11324
|
if (onlyEvents) {
|
|
11325
|
-
for (const event of selectiveDrainFile(
|
|
11325
|
+
for (const event of selectiveDrainFile(path44, (e) => targets(e) && matchesFilter(e.event))) {
|
|
11326
11326
|
pushUnique(event);
|
|
11327
11327
|
}
|
|
11328
11328
|
continue;
|
|
11329
11329
|
}
|
|
11330
|
-
const content = atomicDrainFile(
|
|
11330
|
+
const content = atomicDrainFile(path44);
|
|
11331
11331
|
if (!content) continue;
|
|
11332
11332
|
const parsed = content.split("\n").filter(Boolean).flatMap((line) => {
|
|
11333
11333
|
try {
|
|
@@ -11363,9 +11363,9 @@ function retractPendingDispatchBlockedEvent(meshId, taskId, coordinatorDaemonId)
|
|
|
11363
11363
|
const daemonIds = normalizeCoordinatorDaemonIds(coordinatorDaemonId);
|
|
11364
11364
|
const primaryDaemonId = daemonIds[0];
|
|
11365
11365
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11366
|
-
for (const
|
|
11366
|
+
for (const path44 of paths) {
|
|
11367
11367
|
try {
|
|
11368
|
-
removed += selectiveDrainFile(
|
|
11368
|
+
removed += selectiveDrainFile(path44, matchesTask).length;
|
|
11369
11369
|
} catch {
|
|
11370
11370
|
}
|
|
11371
11371
|
}
|
|
@@ -11406,9 +11406,9 @@ function clearPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId) {
|
|
|
11406
11406
|
} catch {
|
|
11407
11407
|
}
|
|
11408
11408
|
const paths = coordinatorDaemonId ? [getPendingEventsPath(meshId, coordinatorDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11409
|
-
for (const
|
|
11410
|
-
if (existsSync15(
|
|
11411
|
-
unlinkSync2(
|
|
11409
|
+
for (const path44 of paths) {
|
|
11410
|
+
if (existsSync15(path44)) try {
|
|
11411
|
+
unlinkSync2(path44);
|
|
11412
11412
|
} catch {
|
|
11413
11413
|
}
|
|
11414
11414
|
}
|
|
@@ -11882,9 +11882,9 @@ function findBinary(name) {
|
|
|
11882
11882
|
for (const ext of exes) {
|
|
11883
11883
|
const fullPath = path11.join(p, trimmed + ext);
|
|
11884
11884
|
try {
|
|
11885
|
-
const
|
|
11886
|
-
if (
|
|
11887
|
-
const stat2 =
|
|
11885
|
+
const fs39 = __require("fs");
|
|
11886
|
+
if (fs39.existsSync(fullPath)) {
|
|
11887
|
+
const stat2 = fs39.statSync(fullPath);
|
|
11888
11888
|
if (stat2.isFile() && (isWin || stat2.mode & 73)) {
|
|
11889
11889
|
return fullPath;
|
|
11890
11890
|
}
|
|
@@ -11898,12 +11898,12 @@ function findBinary(name) {
|
|
|
11898
11898
|
function isScriptBinary(binaryPath) {
|
|
11899
11899
|
if (!path11.isAbsolute(binaryPath)) return false;
|
|
11900
11900
|
try {
|
|
11901
|
-
const
|
|
11902
|
-
const resolved =
|
|
11901
|
+
const fs39 = __require("fs");
|
|
11902
|
+
const resolved = fs39.realpathSync(binaryPath);
|
|
11903
11903
|
const head = Buffer.alloc(8);
|
|
11904
|
-
const fd =
|
|
11905
|
-
|
|
11906
|
-
|
|
11904
|
+
const fd = fs39.openSync(resolved, "r");
|
|
11905
|
+
fs39.readSync(fd, head, 0, 8, 0);
|
|
11906
|
+
fs39.closeSync(fd);
|
|
11907
11907
|
let i = 0;
|
|
11908
11908
|
if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
|
|
11909
11909
|
return head[i] === 35 && head[i + 1] === 33;
|
|
@@ -11914,12 +11914,12 @@ function isScriptBinary(binaryPath) {
|
|
|
11914
11914
|
function looksLikeMachOOrElf(filePath) {
|
|
11915
11915
|
if (!path11.isAbsolute(filePath)) return false;
|
|
11916
11916
|
try {
|
|
11917
|
-
const
|
|
11918
|
-
const resolved =
|
|
11917
|
+
const fs39 = __require("fs");
|
|
11918
|
+
const resolved = fs39.realpathSync(filePath);
|
|
11919
11919
|
const buf = Buffer.alloc(8);
|
|
11920
|
-
const fd =
|
|
11921
|
-
|
|
11922
|
-
|
|
11920
|
+
const fd = fs39.openSync(resolved, "r");
|
|
11921
|
+
fs39.readSync(fd, buf, 0, 8, 0);
|
|
11922
|
+
fs39.closeSync(fd);
|
|
11923
11923
|
let i = 0;
|
|
11924
11924
|
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
|
|
11925
11925
|
const b = buf.subarray(i);
|
|
@@ -12208,19 +12208,19 @@ async function resolveDetectionPath(command, whichCmd) {
|
|
|
12208
12208
|
return null;
|
|
12209
12209
|
}
|
|
12210
12210
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
12211
|
-
return new Promise((
|
|
12211
|
+
return new Promise((resolve25) => {
|
|
12212
12212
|
const child = exec(cmd, {
|
|
12213
12213
|
encoding: "utf-8",
|
|
12214
12214
|
timeout: timeoutMs,
|
|
12215
12215
|
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
12216
12216
|
}, (err, stdout) => {
|
|
12217
12217
|
if (err || !stdout?.trim()) {
|
|
12218
|
-
|
|
12218
|
+
resolve25(null);
|
|
12219
12219
|
} else {
|
|
12220
|
-
|
|
12220
|
+
resolve25(stdout.trim());
|
|
12221
12221
|
}
|
|
12222
12222
|
});
|
|
12223
|
-
child.on("error", () =>
|
|
12223
|
+
child.on("error", () => resolve25(null));
|
|
12224
12224
|
});
|
|
12225
12225
|
}
|
|
12226
12226
|
async function detectCLIs(providerLoader, options) {
|
|
@@ -12341,7 +12341,7 @@ var init_mesh_event_trace = __esm({
|
|
|
12341
12341
|
// src/mesh/mesh-warmup-deadline.ts
|
|
12342
12342
|
function awaitWithWarmupDeadline(work, opts) {
|
|
12343
12343
|
const pollMs = Math.max(1, Math.min(opts.pollIntervalMs ?? 200, opts.connectTimeoutMs));
|
|
12344
|
-
return new Promise((
|
|
12344
|
+
return new Promise((resolve25, reject) => {
|
|
12345
12345
|
let done = false;
|
|
12346
12346
|
let poll;
|
|
12347
12347
|
let responseTimer;
|
|
@@ -12391,7 +12391,7 @@ function awaitWithWarmupDeadline(work, opts) {
|
|
|
12391
12391
|
if (typeof poll.unref === "function") poll.unref();
|
|
12392
12392
|
}
|
|
12393
12393
|
work.then(
|
|
12394
|
-
(val) => settle(() =>
|
|
12394
|
+
(val) => settle(() => resolve25(val)),
|
|
12395
12395
|
(err) => settle(() => reject(err))
|
|
12396
12396
|
);
|
|
12397
12397
|
});
|
|
@@ -12495,7 +12495,7 @@ async function waitForLocalSessionReady(components, sessionId) {
|
|
|
12495
12495
|
const deadline = Date.now() + LOCAL_LAUNCH_READY_TIMEOUT_MS;
|
|
12496
12496
|
while (Date.now() < deadline) {
|
|
12497
12497
|
if (adapter.isReady() || adapter.currentStatus === "idle") return;
|
|
12498
|
-
await new Promise((
|
|
12498
|
+
await new Promise((resolve25) => setTimeout(resolve25, LOCAL_LAUNCH_READY_POLL_MS));
|
|
12499
12499
|
}
|
|
12500
12500
|
LOG.warn("MeshQueue", `Auto-launched session ${sessionId} not interactive after ${LOCAL_LAUNCH_READY_TIMEOUT_MS}ms; dispatching anyway (adapter queue-until-ready will buffer)`);
|
|
12501
12501
|
}
|
|
@@ -18927,7 +18927,7 @@ function getCliValidator() {
|
|
|
18927
18927
|
return _cliValidator;
|
|
18928
18928
|
}
|
|
18929
18929
|
function formatIssue(err) {
|
|
18930
|
-
const
|
|
18930
|
+
const path44 = err.instancePath || "";
|
|
18931
18931
|
const params = err.params;
|
|
18932
18932
|
let message = err.message || "validation failed";
|
|
18933
18933
|
let allowed;
|
|
@@ -18945,7 +18945,7 @@ function formatIssue(err) {
|
|
|
18945
18945
|
} else if (err.keyword === "type") {
|
|
18946
18946
|
message = `must be ${params.type}`;
|
|
18947
18947
|
}
|
|
18948
|
-
return { path:
|
|
18948
|
+
return { path: path44, keyword: err.keyword, message, ...allowed !== void 0 ? { allowed } : {} };
|
|
18949
18949
|
}
|
|
18950
18950
|
function validateCliProviderManifest(manifest) {
|
|
18951
18951
|
const validator = getCliValidator();
|
|
@@ -19240,40 +19240,40 @@ function validateFsmSpec(raw) {
|
|
|
19240
19240
|
}
|
|
19241
19241
|
return errs;
|
|
19242
19242
|
}
|
|
19243
|
-
function validateCondition(c, sectionIds,
|
|
19243
|
+
function validateCondition(c, sectionIds, path44) {
|
|
19244
19244
|
const errs = [];
|
|
19245
19245
|
const w = c;
|
|
19246
19246
|
if ("all" in w) {
|
|
19247
|
-
w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${
|
|
19247
|
+
w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path44}.all[${i}]`)));
|
|
19248
19248
|
return errs;
|
|
19249
19249
|
}
|
|
19250
19250
|
if ("any" in w) {
|
|
19251
|
-
w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${
|
|
19251
|
+
w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path44}.any[${i}]`)));
|
|
19252
19252
|
return errs;
|
|
19253
19253
|
}
|
|
19254
19254
|
if ("not" in w) {
|
|
19255
|
-
errs.push(...validateCondition(w.not, sectionIds, `${
|
|
19255
|
+
errs.push(...validateCondition(w.not, sectionIds, `${path44}.not`));
|
|
19256
19256
|
return errs;
|
|
19257
19257
|
}
|
|
19258
19258
|
if ("matches" in w) {
|
|
19259
|
-
if (w.section && !sectionIds.has(w.section)) errs.push(`${
|
|
19259
|
+
if (w.section && !sectionIds.has(w.section)) errs.push(`${path44}.section "${w.section}" unknown`);
|
|
19260
19260
|
try {
|
|
19261
19261
|
new RegExp(w.matches, w.flags ?? "i");
|
|
19262
19262
|
} catch (e) {
|
|
19263
|
-
errs.push(`${
|
|
19263
|
+
errs.push(`${path44}.matches invalid regex: ${e.message}`);
|
|
19264
19264
|
}
|
|
19265
19265
|
return errs;
|
|
19266
19266
|
}
|
|
19267
19267
|
if ("cursor_above" in w && "changed" in w) return errs;
|
|
19268
19268
|
if ("elapsed_ms" in w) {
|
|
19269
|
-
if (typeof w.elapsed_ms !== "number") errs.push(`${
|
|
19269
|
+
if (typeof w.elapsed_ms !== "number") errs.push(`${path44}.elapsed_ms must be a number`);
|
|
19270
19270
|
return errs;
|
|
19271
19271
|
}
|
|
19272
19272
|
if ("stable_ms" in w) {
|
|
19273
|
-
if (typeof w.stable_ms !== "number") errs.push(`${
|
|
19273
|
+
if (typeof w.stable_ms !== "number") errs.push(`${path44}.stable_ms must be a number`);
|
|
19274
19274
|
return errs;
|
|
19275
19275
|
}
|
|
19276
|
-
errs.push(`${
|
|
19276
|
+
errs.push(`${path44} is not a recognized condition`);
|
|
19277
19277
|
return errs;
|
|
19278
19278
|
}
|
|
19279
19279
|
var init_fsm_loader = __esm({
|
|
@@ -19766,8 +19766,8 @@ var init_pty_transport = __esm({
|
|
|
19766
19766
|
let cwd = options.cwd;
|
|
19767
19767
|
if (cwd) {
|
|
19768
19768
|
try {
|
|
19769
|
-
const
|
|
19770
|
-
const stat2 =
|
|
19769
|
+
const fs39 = __require("fs");
|
|
19770
|
+
const stat2 = fs39.statSync(cwd);
|
|
19771
19771
|
if (!stat2.isDirectory()) cwd = os14.homedir();
|
|
19772
19772
|
} catch {
|
|
19773
19773
|
cwd = os14.homedir();
|
|
@@ -22314,7 +22314,7 @@ ${lastSnapshot}`;
|
|
|
22314
22314
|
`[${this.cliType}] Waiting for interactive prompt: status=${status} stableMs=${stableMs} recentOutputMs=${recentlyOutput} screen=${JSON.stringify(summarizeCliTraceText(screenText, 220)).slice(0, 260)}`
|
|
22315
22315
|
);
|
|
22316
22316
|
}
|
|
22317
|
-
await new Promise((
|
|
22317
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
22318
22318
|
}
|
|
22319
22319
|
const finalScreenText = this.terminalScreen.getText() || "";
|
|
22320
22320
|
LOG.warn(
|
|
@@ -22609,7 +22609,7 @@ ${lastSnapshot}`;
|
|
|
22609
22609
|
if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
|
|
22610
22610
|
await this.ptyProcess.write(chunks[i]);
|
|
22611
22611
|
if (i + 1 < chunks.length) {
|
|
22612
|
-
await new Promise((
|
|
22612
|
+
await new Promise((resolve25) => setTimeout(resolve25, WIN32_PTY_WRITE_CHUNK_GAP_MS));
|
|
22613
22613
|
}
|
|
22614
22614
|
}
|
|
22615
22615
|
}
|
|
@@ -22777,7 +22777,7 @@ ${lastSnapshot}`;
|
|
|
22777
22777
|
this.onStatusChange?.();
|
|
22778
22778
|
}
|
|
22779
22779
|
async waitForForceSubmitSettle() {
|
|
22780
|
-
await new Promise((
|
|
22780
|
+
await new Promise((resolve25) => setTimeout(resolve25, FORCE_SUBMIT_SETTLE_MS));
|
|
22781
22781
|
}
|
|
22782
22782
|
enqueuePendingOutboundMessage(text, reason, meshTaskId) {
|
|
22783
22783
|
const content = String(text || "");
|
|
@@ -22856,7 +22856,7 @@ ${lastSnapshot}`;
|
|
|
22856
22856
|
const deadline = Date.now() + 1e4;
|
|
22857
22857
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
22858
22858
|
this.resolveStartupState("send_wait");
|
|
22859
|
-
await new Promise((
|
|
22859
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
22860
22860
|
}
|
|
22861
22861
|
}
|
|
22862
22862
|
const parsedStatusBeforeSend = !allowInputDuringGeneration ? (() => {
|
|
@@ -22949,13 +22949,13 @@ ${lastSnapshot}`;
|
|
|
22949
22949
|
isFirstTurn: !this.firstTurnSent
|
|
22950
22950
|
};
|
|
22951
22951
|
this.engine.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
|
|
22952
|
-
await new Promise((
|
|
22952
|
+
await new Promise((resolve25, reject) => {
|
|
22953
22953
|
let resolved = false;
|
|
22954
22954
|
const completion = {
|
|
22955
22955
|
resolveOnce: () => {
|
|
22956
22956
|
if (resolved) return;
|
|
22957
22957
|
resolved = true;
|
|
22958
|
-
|
|
22958
|
+
resolve25();
|
|
22959
22959
|
},
|
|
22960
22960
|
rejectOnce: (error) => {
|
|
22961
22961
|
if (resolved) return;
|
|
@@ -23143,17 +23143,17 @@ ${lastSnapshot}`;
|
|
|
23143
23143
|
}
|
|
23144
23144
|
}
|
|
23145
23145
|
waitForStopped(timeoutMs) {
|
|
23146
|
-
return new Promise((
|
|
23146
|
+
return new Promise((resolve25) => {
|
|
23147
23147
|
const startedAt = Date.now();
|
|
23148
23148
|
const timer = setInterval(() => {
|
|
23149
23149
|
if (!this.ptyProcess || this.engine.currentStatus === "stopped") {
|
|
23150
23150
|
clearInterval(timer);
|
|
23151
|
-
|
|
23151
|
+
resolve25(true);
|
|
23152
23152
|
return;
|
|
23153
23153
|
}
|
|
23154
23154
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
23155
23155
|
clearInterval(timer);
|
|
23156
|
-
|
|
23156
|
+
resolve25(false);
|
|
23157
23157
|
}
|
|
23158
23158
|
}, 100);
|
|
23159
23159
|
});
|
|
@@ -25456,17 +25456,17 @@ function checkPathExists(paths) {
|
|
|
25456
25456
|
return null;
|
|
25457
25457
|
}
|
|
25458
25458
|
async function detectIDEs(providerLoader) {
|
|
25459
|
-
const
|
|
25459
|
+
const os31 = platform5();
|
|
25460
25460
|
const results = [];
|
|
25461
25461
|
for (const def of getMergedDefinitions()) {
|
|
25462
25462
|
const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
|
|
25463
|
-
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[
|
|
25463
|
+
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os31] || []) || []);
|
|
25464
25464
|
let resolvedCli = cliPath;
|
|
25465
|
-
if (!resolvedCli && appPath &&
|
|
25465
|
+
if (!resolvedCli && appPath && os31 === "darwin") {
|
|
25466
25466
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
25467
25467
|
if (existsSync20(bundledCli)) resolvedCli = bundledCli;
|
|
25468
25468
|
}
|
|
25469
|
-
if (!resolvedCli && appPath &&
|
|
25469
|
+
if (!resolvedCli && appPath && os31 === "win32") {
|
|
25470
25470
|
const { dirname: dirname17 } = await import("path");
|
|
25471
25471
|
const appDir = dirname17(appPath);
|
|
25472
25472
|
const candidates = [
|
|
@@ -25483,7 +25483,7 @@ async function detectIDEs(providerLoader) {
|
|
|
25483
25483
|
}
|
|
25484
25484
|
}
|
|
25485
25485
|
}
|
|
25486
|
-
const installed =
|
|
25486
|
+
const installed = os31 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
|
|
25487
25487
|
const version = null;
|
|
25488
25488
|
results.push({
|
|
25489
25489
|
id: def.id,
|
|
@@ -25742,7 +25742,7 @@ var DaemonCdpManager = class {
|
|
|
25742
25742
|
* Returns multiple entries if multiple IDE windows are open on same port
|
|
25743
25743
|
*/
|
|
25744
25744
|
static listAllTargets(port) {
|
|
25745
|
-
return new Promise((
|
|
25745
|
+
return new Promise((resolve25) => {
|
|
25746
25746
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
25747
25747
|
let data = "";
|
|
25748
25748
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -25758,16 +25758,16 @@ var DaemonCdpManager = class {
|
|
|
25758
25758
|
(t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
|
|
25759
25759
|
);
|
|
25760
25760
|
const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
|
|
25761
|
-
|
|
25761
|
+
resolve25(mainPages.length > 0 ? mainPages : fallbackPages);
|
|
25762
25762
|
} catch {
|
|
25763
|
-
|
|
25763
|
+
resolve25([]);
|
|
25764
25764
|
}
|
|
25765
25765
|
});
|
|
25766
25766
|
});
|
|
25767
|
-
req.on("error", () =>
|
|
25767
|
+
req.on("error", () => resolve25([]));
|
|
25768
25768
|
req.setTimeout(2e3, () => {
|
|
25769
25769
|
req.destroy();
|
|
25770
|
-
|
|
25770
|
+
resolve25([]);
|
|
25771
25771
|
});
|
|
25772
25772
|
});
|
|
25773
25773
|
}
|
|
@@ -25807,7 +25807,7 @@ var DaemonCdpManager = class {
|
|
|
25807
25807
|
}
|
|
25808
25808
|
}
|
|
25809
25809
|
findTargetOnPort(port) {
|
|
25810
|
-
return new Promise((
|
|
25810
|
+
return new Promise((resolve25) => {
|
|
25811
25811
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
25812
25812
|
let data = "";
|
|
25813
25813
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -25818,7 +25818,7 @@ var DaemonCdpManager = class {
|
|
|
25818
25818
|
(t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
|
|
25819
25819
|
);
|
|
25820
25820
|
if (pages.length === 0) {
|
|
25821
|
-
|
|
25821
|
+
resolve25(targets.find((t) => t.webSocketDebuggerUrl) || null);
|
|
25822
25822
|
return;
|
|
25823
25823
|
}
|
|
25824
25824
|
const titleFilteredPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
|
|
@@ -25837,25 +25837,25 @@ var DaemonCdpManager = class {
|
|
|
25837
25837
|
this._targetId = selected.target.id;
|
|
25838
25838
|
}
|
|
25839
25839
|
this._pageTitle = selected.target.title || "";
|
|
25840
|
-
|
|
25840
|
+
resolve25(selected.target);
|
|
25841
25841
|
return;
|
|
25842
25842
|
}
|
|
25843
25843
|
if (previousTargetId) {
|
|
25844
25844
|
this.log(`[CDP] Target ${previousTargetId} not found in page list`);
|
|
25845
|
-
|
|
25845
|
+
resolve25(null);
|
|
25846
25846
|
return;
|
|
25847
25847
|
}
|
|
25848
25848
|
this._pageTitle = list[0]?.title || "";
|
|
25849
|
-
|
|
25849
|
+
resolve25(list[0]);
|
|
25850
25850
|
} catch {
|
|
25851
|
-
|
|
25851
|
+
resolve25(null);
|
|
25852
25852
|
}
|
|
25853
25853
|
});
|
|
25854
25854
|
});
|
|
25855
|
-
req.on("error", () =>
|
|
25855
|
+
req.on("error", () => resolve25(null));
|
|
25856
25856
|
req.setTimeout(2e3, () => {
|
|
25857
25857
|
req.destroy();
|
|
25858
|
-
|
|
25858
|
+
resolve25(null);
|
|
25859
25859
|
});
|
|
25860
25860
|
});
|
|
25861
25861
|
}
|
|
@@ -25866,7 +25866,7 @@ var DaemonCdpManager = class {
|
|
|
25866
25866
|
this.extensionProviders = providers;
|
|
25867
25867
|
}
|
|
25868
25868
|
connectToTarget(wsUrl) {
|
|
25869
|
-
return new Promise((
|
|
25869
|
+
return new Promise((resolve25) => {
|
|
25870
25870
|
this.ws = new WebSocket(wsUrl);
|
|
25871
25871
|
this.ws.on("open", async () => {
|
|
25872
25872
|
this._connected = true;
|
|
@@ -25876,17 +25876,17 @@ var DaemonCdpManager = class {
|
|
|
25876
25876
|
}
|
|
25877
25877
|
this.connectBrowserWs().catch(() => {
|
|
25878
25878
|
});
|
|
25879
|
-
|
|
25879
|
+
resolve25(true);
|
|
25880
25880
|
});
|
|
25881
25881
|
this.ws.on("message", (data) => {
|
|
25882
25882
|
try {
|
|
25883
25883
|
const msg = JSON.parse(data.toString());
|
|
25884
25884
|
if (msg.id && this.pending.has(msg.id)) {
|
|
25885
|
-
const { resolve:
|
|
25885
|
+
const { resolve: resolve26, reject } = this.pending.get(msg.id);
|
|
25886
25886
|
this.pending.delete(msg.id);
|
|
25887
25887
|
this.failureCount = 0;
|
|
25888
25888
|
if (msg.error) reject(new Error(msg.error.message));
|
|
25889
|
-
else
|
|
25889
|
+
else resolve26(msg.result);
|
|
25890
25890
|
} else if (msg.method === "Runtime.executionContextCreated") {
|
|
25891
25891
|
this.contexts.add(msg.params.context.id);
|
|
25892
25892
|
} else if (msg.method === "Runtime.executionContextDestroyed") {
|
|
@@ -25909,7 +25909,7 @@ var DaemonCdpManager = class {
|
|
|
25909
25909
|
this.ws.on("error", (err) => {
|
|
25910
25910
|
this.log(`[CDP] WebSocket error: ${err.message}`);
|
|
25911
25911
|
this._connected = false;
|
|
25912
|
-
|
|
25912
|
+
resolve25(false);
|
|
25913
25913
|
});
|
|
25914
25914
|
});
|
|
25915
25915
|
}
|
|
@@ -25923,7 +25923,7 @@ var DaemonCdpManager = class {
|
|
|
25923
25923
|
return;
|
|
25924
25924
|
}
|
|
25925
25925
|
this.log(`[CDP] Connecting browser WS for target discovery...`);
|
|
25926
|
-
await new Promise((
|
|
25926
|
+
await new Promise((resolve25, reject) => {
|
|
25927
25927
|
this.browserWs = new WebSocket(browserWsUrl);
|
|
25928
25928
|
this.browserWs.on("open", async () => {
|
|
25929
25929
|
this._browserConnected = true;
|
|
@@ -25933,16 +25933,16 @@ var DaemonCdpManager = class {
|
|
|
25933
25933
|
} catch (e) {
|
|
25934
25934
|
this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
|
|
25935
25935
|
}
|
|
25936
|
-
|
|
25936
|
+
resolve25();
|
|
25937
25937
|
});
|
|
25938
25938
|
this.browserWs.on("message", (data) => {
|
|
25939
25939
|
try {
|
|
25940
25940
|
const msg = JSON.parse(data.toString());
|
|
25941
25941
|
if (msg.id && this.browserPending.has(msg.id)) {
|
|
25942
|
-
const { resolve:
|
|
25942
|
+
const { resolve: resolve26, reject: reject2 } = this.browserPending.get(msg.id);
|
|
25943
25943
|
this.browserPending.delete(msg.id);
|
|
25944
25944
|
if (msg.error) reject2(new Error(msg.error.message));
|
|
25945
|
-
else
|
|
25945
|
+
else resolve26(msg.result);
|
|
25946
25946
|
}
|
|
25947
25947
|
} catch {
|
|
25948
25948
|
}
|
|
@@ -25962,31 +25962,31 @@ var DaemonCdpManager = class {
|
|
|
25962
25962
|
}
|
|
25963
25963
|
}
|
|
25964
25964
|
getBrowserWsUrl() {
|
|
25965
|
-
return new Promise((
|
|
25965
|
+
return new Promise((resolve25) => {
|
|
25966
25966
|
const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
|
|
25967
25967
|
let data = "";
|
|
25968
25968
|
res.on("data", (chunk) => data += chunk.toString());
|
|
25969
25969
|
res.on("end", () => {
|
|
25970
25970
|
try {
|
|
25971
25971
|
const info = JSON.parse(data);
|
|
25972
|
-
|
|
25972
|
+
resolve25(info.webSocketDebuggerUrl || null);
|
|
25973
25973
|
} catch {
|
|
25974
|
-
|
|
25974
|
+
resolve25(null);
|
|
25975
25975
|
}
|
|
25976
25976
|
});
|
|
25977
25977
|
});
|
|
25978
|
-
req.on("error", () =>
|
|
25978
|
+
req.on("error", () => resolve25(null));
|
|
25979
25979
|
req.setTimeout(3e3, () => {
|
|
25980
25980
|
req.destroy();
|
|
25981
|
-
|
|
25981
|
+
resolve25(null);
|
|
25982
25982
|
});
|
|
25983
25983
|
});
|
|
25984
25984
|
}
|
|
25985
25985
|
sendBrowser(method, params = {}, timeoutMs = 15e3) {
|
|
25986
|
-
return new Promise((
|
|
25986
|
+
return new Promise((resolve25, reject) => {
|
|
25987
25987
|
if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
|
|
25988
25988
|
const id = this.browserMsgId++;
|
|
25989
|
-
this.browserPending.set(id, { resolve:
|
|
25989
|
+
this.browserPending.set(id, { resolve: resolve25, reject });
|
|
25990
25990
|
this.browserWs.send(JSON.stringify({ id, method, params }));
|
|
25991
25991
|
setTimeout(() => {
|
|
25992
25992
|
if (this.browserPending.has(id)) {
|
|
@@ -26026,11 +26026,11 @@ var DaemonCdpManager = class {
|
|
|
26026
26026
|
}
|
|
26027
26027
|
// ─── CDP Protocol ────────────────────────────────────────
|
|
26028
26028
|
sendInternal(method, params = {}, timeoutMs = 15e3) {
|
|
26029
|
-
return new Promise((
|
|
26029
|
+
return new Promise((resolve25, reject) => {
|
|
26030
26030
|
if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
|
|
26031
26031
|
if (this.ws.readyState !== WebSocket.OPEN) return reject(new Error("WebSocket not open"));
|
|
26032
26032
|
const id = this.msgId++;
|
|
26033
|
-
this.pending.set(id, { resolve:
|
|
26033
|
+
this.pending.set(id, { resolve: resolve25, reject });
|
|
26034
26034
|
this.ws.send(JSON.stringify({ id, method, params }));
|
|
26035
26035
|
setTimeout(() => {
|
|
26036
26036
|
if (this.pending.has(id)) {
|
|
@@ -26279,7 +26279,7 @@ var DaemonCdpManager = class {
|
|
|
26279
26279
|
const browserWs = this.browserWs;
|
|
26280
26280
|
let msgId = this.browserMsgId;
|
|
26281
26281
|
const sendWs = (method, params = {}, sessionId) => {
|
|
26282
|
-
return new Promise((
|
|
26282
|
+
return new Promise((resolve25, reject) => {
|
|
26283
26283
|
const mid = msgId++;
|
|
26284
26284
|
this.browserMsgId = msgId;
|
|
26285
26285
|
const handler = (raw) => {
|
|
@@ -26288,7 +26288,7 @@ var DaemonCdpManager = class {
|
|
|
26288
26288
|
if (msg.id === mid) {
|
|
26289
26289
|
browserWs.removeListener("message", handler);
|
|
26290
26290
|
if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
|
|
26291
|
-
else
|
|
26291
|
+
else resolve25(msg.result);
|
|
26292
26292
|
}
|
|
26293
26293
|
} catch {
|
|
26294
26294
|
}
|
|
@@ -26489,14 +26489,14 @@ var DaemonCdpManager = class {
|
|
|
26489
26489
|
if (!ws || ws.readyState !== WebSocket.OPEN) {
|
|
26490
26490
|
throw new Error("CDP not connected");
|
|
26491
26491
|
}
|
|
26492
|
-
return new Promise((
|
|
26492
|
+
return new Promise((resolve25, reject) => {
|
|
26493
26493
|
const id = getNextId();
|
|
26494
26494
|
pendingMap.set(id, {
|
|
26495
26495
|
resolve: (result) => {
|
|
26496
26496
|
if (result?.result?.subtype === "error") {
|
|
26497
26497
|
reject(new Error(result.result.description));
|
|
26498
26498
|
} else {
|
|
26499
|
-
|
|
26499
|
+
resolve25(result?.result?.value);
|
|
26500
26500
|
}
|
|
26501
26501
|
},
|
|
26502
26502
|
reject
|
|
@@ -26528,10 +26528,10 @@ var DaemonCdpManager = class {
|
|
|
26528
26528
|
throw new Error("CDP not connected");
|
|
26529
26529
|
}
|
|
26530
26530
|
const sendViaSession = (method, params = {}) => {
|
|
26531
|
-
return new Promise((
|
|
26531
|
+
return new Promise((resolve25, reject) => {
|
|
26532
26532
|
const pendingMap = this._browserConnected ? this.browserPending : this.pending;
|
|
26533
26533
|
const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
|
|
26534
|
-
pendingMap.set(id, { resolve:
|
|
26534
|
+
pendingMap.set(id, { resolve: resolve25, reject });
|
|
26535
26535
|
ws.send(JSON.stringify({ id, sessionId, method, params }));
|
|
26536
26536
|
setTimeout(() => {
|
|
26537
26537
|
if (pendingMap.has(id)) {
|
|
@@ -32761,7 +32761,7 @@ function getSendChatInputEnvelope(args) {
|
|
|
32761
32761
|
return normalizeInputEnvelope(args?.input ? { input: args.input } : args);
|
|
32762
32762
|
}
|
|
32763
32763
|
function sleep(ms) {
|
|
32764
|
-
return new Promise((
|
|
32764
|
+
return new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
32765
32765
|
}
|
|
32766
32766
|
async function waitOnceForFreshHermesCliStart(adapter, log) {
|
|
32767
32767
|
if (adapter.cliType !== "hermes-cli") return;
|
|
@@ -32816,7 +32816,7 @@ function getStateLastSignature(state) {
|
|
|
32816
32816
|
async function getStableExtensionBaseline(h) {
|
|
32817
32817
|
const first = await readExtensionChatState(h);
|
|
32818
32818
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
32819
|
-
await new Promise((
|
|
32819
|
+
await new Promise((resolve25) => setTimeout(resolve25, 150));
|
|
32820
32820
|
const second = await readExtensionChatState(h);
|
|
32821
32821
|
return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
|
|
32822
32822
|
}
|
|
@@ -32824,7 +32824,7 @@ async function verifyExtensionSendObserved(h, before) {
|
|
|
32824
32824
|
const beforeCount = getStateMessageCount(before);
|
|
32825
32825
|
const beforeSignature = getStateLastSignature(before);
|
|
32826
32826
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
32827
|
-
await new Promise((
|
|
32827
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
32828
32828
|
const state = await readExtensionChatState(h);
|
|
32829
32829
|
if (state?.status === "waiting_approval") return true;
|
|
32830
32830
|
const afterCount = getStateMessageCount(state);
|
|
@@ -34226,7 +34226,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
34226
34226
|
const enterCount = cliCommand.enterCount || 1;
|
|
34227
34227
|
await adapter.writeRaw(cliCommand.text + "\r");
|
|
34228
34228
|
for (let i = 1; i < enterCount; i += 1) {
|
|
34229
|
-
await new Promise((
|
|
34229
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
34230
34230
|
await adapter.writeRaw("\r");
|
|
34231
34231
|
}
|
|
34232
34232
|
}
|
|
@@ -35003,9 +35003,9 @@ var DaemonCommandHandler = class {
|
|
|
35003
35003
|
* point at a sibling git checkout.
|
|
35004
35004
|
*/
|
|
35005
35005
|
getUpstreamInstallRoot() {
|
|
35006
|
-
const
|
|
35007
|
-
const
|
|
35008
|
-
return
|
|
35006
|
+
const os31 = __require("os");
|
|
35007
|
+
const path44 = __require("path");
|
|
35008
|
+
return path44.join(os31.homedir(), ".adhdev", "providers", ".upstream");
|
|
35009
35009
|
}
|
|
35010
35010
|
/**
|
|
35011
35011
|
* Download a single provider manifest from the registry and write it to
|
|
@@ -35029,11 +35029,11 @@ var DaemonCommandHandler = class {
|
|
|
35029
35029
|
return { success: false, error: "invalid type" };
|
|
35030
35030
|
}
|
|
35031
35031
|
const https = __require("https");
|
|
35032
|
-
const
|
|
35033
|
-
const
|
|
35032
|
+
const fs39 = __require("fs");
|
|
35033
|
+
const path44 = __require("path");
|
|
35034
35034
|
const REGISTRY = "https://api.adhf.dev/api/v1/registry";
|
|
35035
35035
|
function fetchText(url, timeoutMs) {
|
|
35036
|
-
return new Promise((
|
|
35036
|
+
return new Promise((resolve25, reject) => {
|
|
35037
35037
|
const req = https.get(url, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: timeoutMs }, (res) => {
|
|
35038
35038
|
if (res.statusCode !== 200) {
|
|
35039
35039
|
reject(new Error(`HTTP ${res.statusCode}`));
|
|
@@ -35041,7 +35041,7 @@ var DaemonCommandHandler = class {
|
|
|
35041
35041
|
}
|
|
35042
35042
|
const chunks = [];
|
|
35043
35043
|
res.on("data", (c) => chunks.push(c));
|
|
35044
|
-
res.on("end", () =>
|
|
35044
|
+
res.on("end", () => resolve25(Buffer.concat(chunks).toString("utf-8")));
|
|
35045
35045
|
});
|
|
35046
35046
|
req.on("error", reject);
|
|
35047
35047
|
req.on("timeout", () => {
|
|
@@ -35067,12 +35067,12 @@ var DaemonCommandHandler = class {
|
|
|
35067
35067
|
return { success: false, error: `checksum mismatch: expected ${meta.checksum}, got ${actualChecksum}` };
|
|
35068
35068
|
}
|
|
35069
35069
|
const installRoot = this.getUpstreamInstallRoot();
|
|
35070
|
-
const installRootResolved =
|
|
35071
|
-
const targetDir =
|
|
35072
|
-
if (!targetDir.startsWith(installRootResolved +
|
|
35070
|
+
const installRootResolved = path44.resolve(installRoot);
|
|
35071
|
+
const targetDir = path44.resolve(path44.join(installRoot, category, type));
|
|
35072
|
+
if (!targetDir.startsWith(installRootResolved + path44.sep)) {
|
|
35073
35073
|
return { success: false, error: "install path escaped upstream root" };
|
|
35074
35074
|
}
|
|
35075
|
-
|
|
35075
|
+
fs39.mkdirSync(targetDir, { recursive: true });
|
|
35076
35076
|
let manifestProbe = {};
|
|
35077
35077
|
try {
|
|
35078
35078
|
manifestProbe = JSON.parse(manifestBody);
|
|
@@ -35096,8 +35096,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35096
35096
|
}
|
|
35097
35097
|
}
|
|
35098
35098
|
const targetFile = isV1 ? "provider.v1.json" : "provider.json";
|
|
35099
|
-
const targetPath =
|
|
35100
|
-
|
|
35099
|
+
const targetPath = path44.join(targetDir, targetFile);
|
|
35100
|
+
fs39.writeFileSync(targetPath, manifestBody, "utf-8");
|
|
35101
35101
|
const manifestJson = JSON.parse(manifestBody);
|
|
35102
35102
|
const scriptFetch = await this.fetchProviderSources(
|
|
35103
35103
|
manifestJson,
|
|
@@ -35167,10 +35167,10 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35167
35167
|
const repo = source.repo;
|
|
35168
35168
|
const ref = source.ref;
|
|
35169
35169
|
const https = __require("https");
|
|
35170
|
-
const
|
|
35171
|
-
const
|
|
35170
|
+
const fs39 = __require("fs");
|
|
35171
|
+
const path44 = __require("path");
|
|
35172
35172
|
function fetchJson(url, timeoutMs) {
|
|
35173
|
-
return new Promise((
|
|
35173
|
+
return new Promise((resolve25, reject) => {
|
|
35174
35174
|
const req = https.get(url, {
|
|
35175
35175
|
headers: { "User-Agent": "adhdev-daemon", "Accept": "application/vnd.github+json" },
|
|
35176
35176
|
timeout: timeoutMs
|
|
@@ -35183,7 +35183,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35183
35183
|
res.on("data", (c) => chunks.push(c));
|
|
35184
35184
|
res.on("end", () => {
|
|
35185
35185
|
try {
|
|
35186
|
-
|
|
35186
|
+
resolve25(JSON.parse(Buffer.concat(chunks).toString("utf-8")));
|
|
35187
35187
|
} catch (e) {
|
|
35188
35188
|
reject(e);
|
|
35189
35189
|
}
|
|
@@ -35197,14 +35197,14 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35197
35197
|
});
|
|
35198
35198
|
}
|
|
35199
35199
|
function fetchBinary(url, timeoutMs) {
|
|
35200
|
-
return new Promise((
|
|
35200
|
+
return new Promise((resolve25, reject) => {
|
|
35201
35201
|
const req = https.get(url, {
|
|
35202
35202
|
headers: { "User-Agent": "adhdev-daemon" },
|
|
35203
35203
|
timeout: timeoutMs
|
|
35204
35204
|
}, (res) => {
|
|
35205
35205
|
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
35206
35206
|
if (res.headers.location) {
|
|
35207
|
-
return fetchBinary(res.headers.location, timeoutMs).then(
|
|
35207
|
+
return fetchBinary(res.headers.location, timeoutMs).then(resolve25, reject);
|
|
35208
35208
|
}
|
|
35209
35209
|
}
|
|
35210
35210
|
if (res.statusCode !== 200) {
|
|
@@ -35213,7 +35213,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35213
35213
|
}
|
|
35214
35214
|
const chunks = [];
|
|
35215
35215
|
res.on("data", (c) => chunks.push(c));
|
|
35216
|
-
res.on("end", () =>
|
|
35216
|
+
res.on("end", () => resolve25(Buffer.concat(chunks)));
|
|
35217
35217
|
});
|
|
35218
35218
|
req.on("error", reject);
|
|
35219
35219
|
req.on("timeout", () => {
|
|
@@ -35224,9 +35224,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35224
35224
|
}
|
|
35225
35225
|
let fetchedCount = 0;
|
|
35226
35226
|
const sharedDirRel = `${category}/_shared`;
|
|
35227
|
-
const sharedTargetDir =
|
|
35228
|
-
const installRootResolved =
|
|
35229
|
-
if (sharedTargetDir.startsWith(installRootResolved +
|
|
35227
|
+
const sharedTargetDir = path44.resolve(path44.join(targetDir, "../_shared"));
|
|
35228
|
+
const installRootResolved = path44.resolve(path44.join(targetDir, "../.."));
|
|
35229
|
+
if (sharedTargetDir.startsWith(installRootResolved + path44.sep)) {
|
|
35230
35230
|
const sharedStack = [sharedDirRel];
|
|
35231
35231
|
while (sharedStack.length) {
|
|
35232
35232
|
const relDir = sharedStack.pop();
|
|
@@ -35249,10 +35249,10 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35249
35249
|
try {
|
|
35250
35250
|
const body = await fetchBinary(entry.download_url, 3e4);
|
|
35251
35251
|
const relInside = entry.path.startsWith(sharedDirRel + "/") ? entry.path.slice(sharedDirRel.length + 1) : entry.path;
|
|
35252
|
-
const outPath =
|
|
35253
|
-
if (!outPath.startsWith(
|
|
35254
|
-
|
|
35255
|
-
|
|
35252
|
+
const outPath = path44.resolve(path44.join(sharedTargetDir, relInside));
|
|
35253
|
+
if (!outPath.startsWith(path44.resolve(sharedTargetDir) + path44.sep)) continue;
|
|
35254
|
+
fs39.mkdirSync(path44.dirname(outPath), { recursive: true });
|
|
35255
|
+
fs39.writeFileSync(outPath, body);
|
|
35256
35256
|
fetchedCount++;
|
|
35257
35257
|
} catch (e) {
|
|
35258
35258
|
errors.push(`fetch shared ${entry.path}: ${e?.message ?? e}`);
|
|
@@ -35285,13 +35285,13 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35285
35285
|
try {
|
|
35286
35286
|
const body = await fetchBinary(entry.download_url, 3e4);
|
|
35287
35287
|
const relInsideProvider = entry.path.startsWith(subdir + "/") ? entry.path.slice(subdir.length + 1) : entry.path;
|
|
35288
|
-
const outPath =
|
|
35289
|
-
if (!outPath.startsWith(
|
|
35288
|
+
const outPath = path44.resolve(path44.join(targetDir, relInsideProvider));
|
|
35289
|
+
if (!outPath.startsWith(path44.resolve(targetDir) + path44.sep)) {
|
|
35290
35290
|
errors.push(`refusing to write outside targetDir: ${entry.path}`);
|
|
35291
35291
|
continue;
|
|
35292
35292
|
}
|
|
35293
|
-
|
|
35294
|
-
|
|
35293
|
+
fs39.mkdirSync(path44.dirname(outPath), { recursive: true });
|
|
35294
|
+
fs39.writeFileSync(outPath, body);
|
|
35295
35295
|
fetchedCount++;
|
|
35296
35296
|
} catch (e) {
|
|
35297
35297
|
errors.push(`fetch ${entry.path}: ${e?.message ?? e}`);
|
|
@@ -35319,19 +35319,19 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35319
35319
|
if (!["cli", "ide", "extension", "acp"].includes(category)) {
|
|
35320
35320
|
return { success: false, error: `unknown category: ${category}` };
|
|
35321
35321
|
}
|
|
35322
|
-
const
|
|
35323
|
-
const
|
|
35322
|
+
const fs39 = __require("fs");
|
|
35323
|
+
const path44 = __require("path");
|
|
35324
35324
|
try {
|
|
35325
35325
|
const installRoot = this.getUpstreamInstallRoot();
|
|
35326
|
-
const installRootResolved =
|
|
35327
|
-
const targetDir =
|
|
35328
|
-
if (!targetDir.startsWith(installRootResolved +
|
|
35326
|
+
const installRootResolved = path44.resolve(installRoot);
|
|
35327
|
+
const targetDir = path44.resolve(path44.join(installRoot, category, type));
|
|
35328
|
+
if (!targetDir.startsWith(installRootResolved + path44.sep)) {
|
|
35329
35329
|
return { success: false, error: "refusing to delete outside upstream root" };
|
|
35330
35330
|
}
|
|
35331
|
-
if (!
|
|
35331
|
+
if (!fs39.existsSync(targetDir)) {
|
|
35332
35332
|
return { success: false, error: "not installed" };
|
|
35333
35333
|
}
|
|
35334
|
-
|
|
35334
|
+
fs39.rmSync(targetDir, { recursive: true, force: true });
|
|
35335
35335
|
if (this._ctx.providerLoader) {
|
|
35336
35336
|
this._ctx.providerLoader.reload();
|
|
35337
35337
|
this._ctx.providerLoader.registerToDetector();
|
|
@@ -35347,28 +35347,28 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35347
35347
|
* the UI and by the update checker.
|
|
35348
35348
|
*/
|
|
35349
35349
|
handleListInstalledProviders(_args) {
|
|
35350
|
-
const
|
|
35351
|
-
const
|
|
35350
|
+
const fs39 = __require("fs");
|
|
35351
|
+
const path44 = __require("path");
|
|
35352
35352
|
const installRoot = this.getUpstreamInstallRoot();
|
|
35353
|
-
if (!
|
|
35353
|
+
if (!fs39.existsSync(installRoot)) return { success: true, providers: [] };
|
|
35354
35354
|
const CATEGORIES = ["cli", "ide", "extension", "acp"];
|
|
35355
35355
|
const items = [];
|
|
35356
35356
|
for (const category of CATEGORIES) {
|
|
35357
|
-
const categoryDir =
|
|
35358
|
-
if (!
|
|
35357
|
+
const categoryDir = path44.join(installRoot, category);
|
|
35358
|
+
if (!fs39.existsSync(categoryDir)) continue;
|
|
35359
35359
|
let entries;
|
|
35360
35360
|
try {
|
|
35361
|
-
entries =
|
|
35361
|
+
entries = fs39.readdirSync(categoryDir);
|
|
35362
35362
|
} catch {
|
|
35363
35363
|
continue;
|
|
35364
35364
|
}
|
|
35365
35365
|
for (const type of entries) {
|
|
35366
|
-
const v1Path =
|
|
35367
|
-
const v0Path =
|
|
35368
|
-
const manifestPath =
|
|
35366
|
+
const v1Path = path44.join(categoryDir, type, "provider.v1.json");
|
|
35367
|
+
const v0Path = path44.join(categoryDir, type, "provider.json");
|
|
35368
|
+
const manifestPath = fs39.existsSync(v1Path) ? v1Path : fs39.existsSync(v0Path) ? v0Path : null;
|
|
35369
35369
|
if (!manifestPath) continue;
|
|
35370
35370
|
try {
|
|
35371
|
-
const m = JSON.parse(
|
|
35371
|
+
const m = JSON.parse(fs39.readFileSync(manifestPath, "utf-8"));
|
|
35372
35372
|
items.push({
|
|
35373
35373
|
type,
|
|
35374
35374
|
category,
|
|
@@ -35395,7 +35395,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35395
35395
|
const https = __require("https");
|
|
35396
35396
|
const REGISTRY = "https://api.adhf.dev/api/v1/registry";
|
|
35397
35397
|
function fetchJson(url) {
|
|
35398
|
-
return new Promise((
|
|
35398
|
+
return new Promise((resolve25, reject) => {
|
|
35399
35399
|
const req = https.get(url, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: 1e4 }, (res) => {
|
|
35400
35400
|
if (res.statusCode !== 200) {
|
|
35401
35401
|
reject(new Error(`HTTP ${res.statusCode}`));
|
|
@@ -35405,7 +35405,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35405
35405
|
res.on("data", (c) => chunks.push(c));
|
|
35406
35406
|
res.on("end", () => {
|
|
35407
35407
|
try {
|
|
35408
|
-
|
|
35408
|
+
resolve25(JSON.parse(Buffer.concat(chunks).toString("utf-8")));
|
|
35409
35409
|
} catch (e) {
|
|
35410
35410
|
reject(e);
|
|
35411
35411
|
}
|
|
@@ -35479,8 +35479,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35479
35479
|
if (!/^@[a-z0-9_-]+$/i.test(requestedName)) {
|
|
35480
35480
|
return { success: false, error: "name must match @[a-z0-9_-]+" };
|
|
35481
35481
|
}
|
|
35482
|
-
const
|
|
35483
|
-
const
|
|
35482
|
+
const fs39 = __require("fs");
|
|
35483
|
+
const path44 = __require("path");
|
|
35484
35484
|
const { spawnSync: spawnSync2 } = __require("child_process");
|
|
35485
35485
|
const file = ext.loadExternalSources();
|
|
35486
35486
|
if (file.sources.some((s2) => s2.name === requestedName)) {
|
|
@@ -35489,9 +35489,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35489
35489
|
if (file.sources.some((s2) => s2.url === url && s2.ref === ref)) {
|
|
35490
35490
|
return { success: false, error: `source url+ref already registered (use a different name to track another ref)` };
|
|
35491
35491
|
}
|
|
35492
|
-
const sourceDir =
|
|
35493
|
-
if (!
|
|
35494
|
-
if (
|
|
35492
|
+
const sourceDir = path44.join(ext.externalRoot(), requestedName);
|
|
35493
|
+
if (!fs39.existsSync(ext.externalRoot())) fs39.mkdirSync(ext.externalRoot(), { recursive: true });
|
|
35494
|
+
if (fs39.existsSync(sourceDir)) {
|
|
35495
35495
|
return { success: false, error: `directory already exists: ${sourceDir} (rename or remove first)` };
|
|
35496
35496
|
}
|
|
35497
35497
|
const clone = spawnSync2("git", ["clone", "--depth=1", "--branch", ref, "--", url, sourceDir], {
|
|
@@ -35501,7 +35501,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35501
35501
|
});
|
|
35502
35502
|
if (clone.status !== 0) {
|
|
35503
35503
|
try {
|
|
35504
|
-
|
|
35504
|
+
fs39.rmSync(sourceDir, { recursive: true, force: true });
|
|
35505
35505
|
} catch {
|
|
35506
35506
|
}
|
|
35507
35507
|
return { success: false, error: `git clone failed: ${(clone.stderr || clone.stdout || "").trim() || "unknown error"}` };
|
|
@@ -35545,15 +35545,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35545
35545
|
const name = typeof args?.name === "string" ? args.name.trim() : "";
|
|
35546
35546
|
if (!name) return { success: false, error: "name is required" };
|
|
35547
35547
|
const ext = (init_external_sources(), __toCommonJS(external_sources_exports));
|
|
35548
|
-
const
|
|
35549
|
-
const
|
|
35548
|
+
const fs39 = __require("fs");
|
|
35549
|
+
const path44 = __require("path");
|
|
35550
35550
|
const file = ext.loadExternalSources();
|
|
35551
35551
|
const match = file.sources.find((s2) => s2.name === name);
|
|
35552
35552
|
if (!match) return { success: false, error: `source "${name}" not registered` };
|
|
35553
|
-
const sourceDir =
|
|
35554
|
-
if (
|
|
35553
|
+
const sourceDir = path44.join(ext.externalRoot(), name);
|
|
35554
|
+
if (fs39.existsSync(sourceDir)) {
|
|
35555
35555
|
try {
|
|
35556
|
-
|
|
35556
|
+
fs39.rmSync(sourceDir, { recursive: true, force: true });
|
|
35557
35557
|
} catch (e) {
|
|
35558
35558
|
return { success: false, error: `failed to delete ${sourceDir}: ${e?.message || e}` };
|
|
35559
35559
|
}
|
|
@@ -35643,7 +35643,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35643
35643
|
try {
|
|
35644
35644
|
const http3 = await import("http");
|
|
35645
35645
|
const postData = JSON.stringify(body);
|
|
35646
|
-
const result = await new Promise((
|
|
35646
|
+
const result = await new Promise((resolve25, reject) => {
|
|
35647
35647
|
const req = http3.request({
|
|
35648
35648
|
hostname: "127.0.0.1",
|
|
35649
35649
|
port: 19280,
|
|
@@ -35655,9 +35655,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35655
35655
|
res.on("data", (chunk) => data += chunk);
|
|
35656
35656
|
res.on("end", () => {
|
|
35657
35657
|
try {
|
|
35658
|
-
|
|
35658
|
+
resolve25(JSON.parse(data));
|
|
35659
35659
|
} catch {
|
|
35660
|
-
|
|
35660
|
+
resolve25({ raw: data });
|
|
35661
35661
|
}
|
|
35662
35662
|
});
|
|
35663
35663
|
});
|
|
@@ -35675,15 +35675,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35675
35675
|
if (!providerType) return { success: false, error: "providerType required" };
|
|
35676
35676
|
try {
|
|
35677
35677
|
const http3 = await import("http");
|
|
35678
|
-
const result = await new Promise((
|
|
35678
|
+
const result = await new Promise((resolve25, reject) => {
|
|
35679
35679
|
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
35680
35680
|
let data = "";
|
|
35681
35681
|
res.on("data", (chunk) => data += chunk);
|
|
35682
35682
|
res.on("end", () => {
|
|
35683
35683
|
try {
|
|
35684
|
-
|
|
35684
|
+
resolve25(JSON.parse(data));
|
|
35685
35685
|
} catch {
|
|
35686
|
-
|
|
35686
|
+
resolve25({ raw: data });
|
|
35687
35687
|
}
|
|
35688
35688
|
});
|
|
35689
35689
|
}).on("error", reject);
|
|
@@ -35697,7 +35697,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35697
35697
|
try {
|
|
35698
35698
|
const http3 = await import("http");
|
|
35699
35699
|
const postData = JSON.stringify(args || {});
|
|
35700
|
-
const result = await new Promise((
|
|
35700
|
+
const result = await new Promise((resolve25, reject) => {
|
|
35701
35701
|
const req = http3.request({
|
|
35702
35702
|
hostname: "127.0.0.1",
|
|
35703
35703
|
port: 19280,
|
|
@@ -35709,9 +35709,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35709
35709
|
res.on("data", (chunk) => data += chunk);
|
|
35710
35710
|
res.on("end", () => {
|
|
35711
35711
|
try {
|
|
35712
|
-
|
|
35712
|
+
resolve25(JSON.parse(data));
|
|
35713
35713
|
} catch {
|
|
35714
|
-
|
|
35714
|
+
resolve25({ raw: data });
|
|
35715
35715
|
}
|
|
35716
35716
|
});
|
|
35717
35717
|
});
|
|
@@ -36336,24 +36336,24 @@ var statusMetaHandlers = {
|
|
|
36336
36336
|
// src/commands/low-family/coordinator-prompt.ts
|
|
36337
36337
|
var coordinatorPromptHandlers = {
|
|
36338
36338
|
list_coordinator_prompts: async (_ctx, _args) => {
|
|
36339
|
-
const
|
|
36340
|
-
const
|
|
36341
|
-
const
|
|
36342
|
-
const dir =
|
|
36339
|
+
const fs39 = await import("fs");
|
|
36340
|
+
const path44 = await import("path");
|
|
36341
|
+
const os31 = await import("os");
|
|
36342
|
+
const dir = path44.join(os31.homedir(), ".adhdev", "coordinator-prompts");
|
|
36343
36343
|
const entries = {};
|
|
36344
36344
|
try {
|
|
36345
|
-
if (
|
|
36346
|
-
for (const name of
|
|
36345
|
+
if (fs39.existsSync(dir)) {
|
|
36346
|
+
for (const name of fs39.readdirSync(dir)) {
|
|
36347
36347
|
const matchOverride = name.match(/^([a-zA-Z0-9_.-]+)\.md$/);
|
|
36348
36348
|
const matchAppend = name.match(/^([a-zA-Z0-9_.-]+)\.append\.md$/);
|
|
36349
36349
|
const m = matchAppend || matchOverride;
|
|
36350
36350
|
if (!m) continue;
|
|
36351
36351
|
const isAppend = !!matchAppend;
|
|
36352
36352
|
const key2 = m[1];
|
|
36353
|
-
const full =
|
|
36353
|
+
const full = path44.join(dir, name);
|
|
36354
36354
|
let content = "";
|
|
36355
36355
|
try {
|
|
36356
|
-
content =
|
|
36356
|
+
content = fs39.readFileSync(full, "utf8");
|
|
36357
36357
|
} catch {
|
|
36358
36358
|
}
|
|
36359
36359
|
if (!entries[key2]) entries[key2] = { override: "", append: "" };
|
|
@@ -36367,24 +36367,24 @@ var coordinatorPromptHandlers = {
|
|
|
36367
36367
|
return { success: true, dir, entries };
|
|
36368
36368
|
},
|
|
36369
36369
|
write_coordinator_prompt: async (_ctx, args) => {
|
|
36370
|
-
const
|
|
36371
|
-
const
|
|
36372
|
-
const
|
|
36370
|
+
const fs39 = await import("fs");
|
|
36371
|
+
const path44 = await import("path");
|
|
36372
|
+
const os31 = await import("os");
|
|
36373
36373
|
const key2 = typeof args?.key === "string" ? args.key.trim() : "";
|
|
36374
36374
|
const kind = args?.kind === "append" ? "append" : "override";
|
|
36375
36375
|
const content = typeof args?.content === "string" ? args.content : "";
|
|
36376
36376
|
if (!key2 || !/^[a-zA-Z0-9_.-]+$/.test(key2)) {
|
|
36377
36377
|
return { success: false, error: "key must match [a-zA-Z0-9_.-]+" };
|
|
36378
36378
|
}
|
|
36379
|
-
const dir =
|
|
36379
|
+
const dir = path44.join(os31.homedir(), ".adhdev", "coordinator-prompts");
|
|
36380
36380
|
const filename = kind === "append" ? `${key2}.append.md` : `${key2}.md`;
|
|
36381
|
-
const full =
|
|
36381
|
+
const full = path44.join(dir, filename);
|
|
36382
36382
|
try {
|
|
36383
|
-
|
|
36383
|
+
fs39.mkdirSync(dir, { recursive: true });
|
|
36384
36384
|
if (content.trim()) {
|
|
36385
|
-
|
|
36386
|
-
} else if (
|
|
36387
|
-
|
|
36385
|
+
fs39.writeFileSync(full, content, { encoding: "utf8", mode: 384 });
|
|
36386
|
+
} else if (fs39.existsSync(full)) {
|
|
36387
|
+
fs39.unlinkSync(full);
|
|
36388
36388
|
}
|
|
36389
36389
|
return { success: true, path: full, kind, key: key2 };
|
|
36390
36390
|
} catch (error) {
|
|
@@ -36701,7 +36701,7 @@ async function waitForPidExit(pid, timeoutMs) {
|
|
|
36701
36701
|
while (Date.now() - start < timeoutMs) {
|
|
36702
36702
|
try {
|
|
36703
36703
|
process.kill(pid, 0);
|
|
36704
|
-
await new Promise((
|
|
36704
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
36705
36705
|
} catch {
|
|
36706
36706
|
return;
|
|
36707
36707
|
}
|
|
@@ -36927,7 +36927,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
36927
36927
|
appendUpgradeLog(`Install attempt ${attempt} hit a file lock (${error?.code || "lock"}); clearing holders + staging and retrying after backoff`);
|
|
36928
36928
|
await stopForeignNativeAddonHolders(installCommand.surface.packageRoot, { parentPid: payload.parentPid });
|
|
36929
36929
|
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
36930
|
-
await new Promise((
|
|
36930
|
+
await new Promise((resolve25) => setTimeout(resolve25, attempt * 1500));
|
|
36931
36931
|
continue;
|
|
36932
36932
|
}
|
|
36933
36933
|
if (isRetriableInstallLockError(error)) {
|
|
@@ -36955,7 +36955,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
36955
36955
|
appendUpgradeLog(installOutput.trim());
|
|
36956
36956
|
}
|
|
36957
36957
|
if (process.platform === "win32") {
|
|
36958
|
-
await new Promise((
|
|
36958
|
+
await new Promise((resolve25) => setTimeout(resolve25, 500));
|
|
36959
36959
|
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
36960
36960
|
appendUpgradeLog("Post-install staging cleanup complete");
|
|
36961
36961
|
}
|
|
@@ -39603,7 +39603,7 @@ function stripAnsi3(text) {
|
|
|
39603
39603
|
return String(text || "").replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
39604
39604
|
}
|
|
39605
39605
|
function delay(ms) {
|
|
39606
|
-
return new Promise((
|
|
39606
|
+
return new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
39607
39607
|
}
|
|
39608
39608
|
var SpecCliAdapter = class _SpecCliAdapter {
|
|
39609
39609
|
cliType;
|
|
@@ -39802,7 +39802,7 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
39802
39802
|
const steps = buildClaudeInteractiveTuiAnswerSteps(prompt, response);
|
|
39803
39803
|
for (const step of steps) {
|
|
39804
39804
|
this.driver.dispatch({ kind: "pty_write", data: step });
|
|
39805
|
-
await new Promise((
|
|
39805
|
+
await new Promise((resolve25) => setTimeout(resolve25, 180));
|
|
39806
39806
|
}
|
|
39807
39807
|
} else {
|
|
39808
39808
|
this.driver.dispatch({ kind: "pty_write", data: `${buildClaudeInteractiveToolResult(response)}
|
|
@@ -40353,7 +40353,7 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
40353
40353
|
let screenText = this.driver.snapshot();
|
|
40354
40354
|
const deadline = Date.now() + _SpecCliAdapter.CLAUDE_TUI_PAGE_SETTLE_TIMEOUT_MS;
|
|
40355
40355
|
while (!detectClaudeTuiMultiSelect(screenText) && Date.now() < deadline) {
|
|
40356
|
-
await new Promise((
|
|
40356
|
+
await new Promise((resolve25) => setTimeout(resolve25, _SpecCliAdapter.CLAUDE_TUI_PAGE_POLL_INTERVAL_MS));
|
|
40357
40357
|
screenText = this.driver.snapshot();
|
|
40358
40358
|
}
|
|
40359
40359
|
return screenText;
|
|
@@ -40362,12 +40362,12 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
40362
40362
|
const pages = [{ screenText: firstScreen, header: headers[0] }];
|
|
40363
40363
|
for (let index = 1; index < headers.length; index += 1) {
|
|
40364
40364
|
this.driver.dispatch({ kind: "pty_write", data: " " });
|
|
40365
|
-
await new Promise((
|
|
40365
|
+
await new Promise((resolve25) => setTimeout(resolve25, _SpecCliAdapter.CLAUDE_TUI_PAGE_POLL_INTERVAL_MS));
|
|
40366
40366
|
pages.push({ screenText: await this.snapshotSettledClaudeTuiPage(), header: headers[index] });
|
|
40367
40367
|
}
|
|
40368
40368
|
for (let index = headers.length - 1; index > 0; index -= 1) {
|
|
40369
40369
|
this.driver.dispatch({ kind: "pty_write", data: "\x1B[Z" });
|
|
40370
|
-
await new Promise((
|
|
40370
|
+
await new Promise((resolve25) => setTimeout(resolve25, _SpecCliAdapter.CLAUDE_TUI_PAGE_POLL_INTERVAL_MS));
|
|
40371
40371
|
const reread = await this.snapshotSettledClaudeTuiPage();
|
|
40372
40372
|
const landed = pages[index - 1];
|
|
40373
40373
|
if (landed && !detectClaudeTuiMultiSelect(landed.screenText) && detectClaudeTuiMultiSelect(reread)) {
|
|
@@ -40722,7 +40722,7 @@ async function waitForCliAdapterReady(adapter, options) {
|
|
|
40722
40722
|
if (status === "stopped") {
|
|
40723
40723
|
throw new Error("CLI runtime stopped before it became ready");
|
|
40724
40724
|
}
|
|
40725
|
-
await new Promise((
|
|
40725
|
+
await new Promise((resolve25) => setTimeout(resolve25, pollMs));
|
|
40726
40726
|
}
|
|
40727
40727
|
throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
|
|
40728
40728
|
}
|
|
@@ -41471,7 +41471,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41471
41471
|
const enterCount = cliCommand.enterCount || 1;
|
|
41472
41472
|
await this.adapter.writeRaw(cliCommand.text + "\r");
|
|
41473
41473
|
for (let i = 1; i < enterCount; i += 1) {
|
|
41474
|
-
await new Promise((
|
|
41474
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
41475
41475
|
await this.adapter.writeRaw("\r");
|
|
41476
41476
|
}
|
|
41477
41477
|
}
|
|
@@ -43550,13 +43550,13 @@ var AcpProviderInstance = class {
|
|
|
43550
43550
|
}
|
|
43551
43551
|
this.currentStatus = "waiting_approval";
|
|
43552
43552
|
this.detectStatusTransition();
|
|
43553
|
-
const approved = await new Promise((
|
|
43554
|
-
this.permissionResolvers.push(
|
|
43553
|
+
const approved = await new Promise((resolve25) => {
|
|
43554
|
+
this.permissionResolvers.push(resolve25);
|
|
43555
43555
|
setTimeout(() => {
|
|
43556
|
-
const idx = this.permissionResolvers.indexOf(
|
|
43556
|
+
const idx = this.permissionResolvers.indexOf(resolve25);
|
|
43557
43557
|
if (idx >= 0) {
|
|
43558
43558
|
this.permissionResolvers.splice(idx, 1);
|
|
43559
|
-
|
|
43559
|
+
resolve25(false);
|
|
43560
43560
|
}
|
|
43561
43561
|
}, 3e5);
|
|
43562
43562
|
});
|
|
@@ -44292,7 +44292,7 @@ async function waitForZeroMessageStartingLaunch(adapter) {
|
|
|
44292
44292
|
} catch {
|
|
44293
44293
|
return false;
|
|
44294
44294
|
}
|
|
44295
|
-
await new Promise((
|
|
44295
|
+
await new Promise((resolve25) => setTimeout(resolve25, ZERO_MESSAGE_STARTING_SEND_WAIT_MS));
|
|
44296
44296
|
try {
|
|
44297
44297
|
return hasZeroMessageStartingLaunch(adapter);
|
|
44298
44298
|
} catch {
|
|
@@ -45633,9 +45633,9 @@ function validateProviderDefinition(raw) {
|
|
|
45633
45633
|
const typedProvider = provider;
|
|
45634
45634
|
const controls = Array.isArray(provider.controls) ? provider.controls : [];
|
|
45635
45635
|
if (category === "cli" || category === "acp") {
|
|
45636
|
-
const
|
|
45637
|
-
const command =
|
|
45638
|
-
if (!
|
|
45636
|
+
const spawn5 = provider.spawn;
|
|
45637
|
+
const command = spawn5 && typeof spawn5 === "object" ? spawn5.command : void 0;
|
|
45638
|
+
if (!spawn5 || typeof spawn5 !== "object") {
|
|
45639
45639
|
errors.push(`${String(category).toUpperCase()}/CLI providers must have spawn config`);
|
|
45640
45640
|
} else if (typeof command !== "string" || !command.trim()) {
|
|
45641
45641
|
errors.push("spawn.command is required");
|
|
@@ -48156,25 +48156,25 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48156
48156
|
}
|
|
48157
48157
|
if (providerDir) {
|
|
48158
48158
|
try {
|
|
48159
|
-
const
|
|
48160
|
-
const
|
|
48159
|
+
const fs39 = __require("fs");
|
|
48160
|
+
const path44 = __require("path");
|
|
48161
48161
|
const candidates = [];
|
|
48162
48162
|
if (Array.isArray(base.compatibility)) {
|
|
48163
48163
|
for (const entry of base.compatibility) {
|
|
48164
48164
|
if (typeof entry?.spec !== "string") continue;
|
|
48165
48165
|
const matches = !entry.ideVersion || currentVersion && this.matchesVersion(currentVersion, entry.ideVersion) || !currentVersion;
|
|
48166
|
-
if (matches) candidates.push(
|
|
48166
|
+
if (matches) candidates.push(path44.join(providerDir, entry.spec));
|
|
48167
48167
|
}
|
|
48168
48168
|
}
|
|
48169
|
-
candidates.push(
|
|
48170
|
-
candidates.push(
|
|
48171
|
-
const specPath = candidates.find((p) =>
|
|
48169
|
+
candidates.push(path44.join(providerDir, "specs", "default.json"));
|
|
48170
|
+
candidates.push(path44.join(providerDir, "spec.json"));
|
|
48171
|
+
const specPath = candidates.find((p) => fs39.existsSync(p));
|
|
48172
48172
|
if (specPath) {
|
|
48173
48173
|
resolved._resolvedSpecPath = specPath;
|
|
48174
48174
|
let specControls;
|
|
48175
48175
|
let nh;
|
|
48176
48176
|
try {
|
|
48177
|
-
const rawSpec = JSON.parse(
|
|
48177
|
+
const rawSpec = JSON.parse(fs39.readFileSync(specPath, "utf8"));
|
|
48178
48178
|
specControls = rawSpec.control_bar;
|
|
48179
48179
|
nh = rawSpec.native_history;
|
|
48180
48180
|
} catch {
|
|
@@ -48205,10 +48205,10 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48205
48205
|
format = `spec-${nh.source.kind}`;
|
|
48206
48206
|
reader = (input) => executeNativeHistory(nh, input);
|
|
48207
48207
|
} else if (nh.override_path) {
|
|
48208
|
-
const overrideFile =
|
|
48209
|
-
if (
|
|
48208
|
+
const overrideFile = path44.resolve(providerDir, nh.override_path);
|
|
48209
|
+
if (fs39.existsSync(overrideFile)) {
|
|
48210
48210
|
try {
|
|
48211
|
-
registerProviderScriptRootSafely(
|
|
48211
|
+
registerProviderScriptRootSafely(path44.dirname(path44.dirname(providerDir)));
|
|
48212
48212
|
delete __require.cache[__require.resolve(overrideFile)];
|
|
48213
48213
|
const mod = __require(overrideFile);
|
|
48214
48214
|
const fn = typeof mod === "function" ? mod : mod && typeof mod.default === "function" ? mod.default : null;
|
|
@@ -48382,7 +48382,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48382
48382
|
}
|
|
48383
48383
|
try {
|
|
48384
48384
|
const listUrl = `${_ProviderLoader.REGISTRY_BASE_URL}/providers`;
|
|
48385
|
-
const listBody = await new Promise((
|
|
48385
|
+
const listBody = await new Promise((resolve25, reject) => {
|
|
48386
48386
|
const req = https.get(listUrl, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: 1e4 }, (res) => {
|
|
48387
48387
|
if (res.statusCode !== 200) {
|
|
48388
48388
|
reject(new Error(`registry list HTTP ${res.statusCode}`));
|
|
@@ -48390,7 +48390,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48390
48390
|
}
|
|
48391
48391
|
const chunks = [];
|
|
48392
48392
|
res.on("data", (c) => chunks.push(c));
|
|
48393
|
-
res.on("end", () =>
|
|
48393
|
+
res.on("end", () => resolve25(Buffer.concat(chunks).toString("utf-8")));
|
|
48394
48394
|
});
|
|
48395
48395
|
req.on("error", reject);
|
|
48396
48396
|
req.on("timeout", () => {
|
|
@@ -48406,7 +48406,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48406
48406
|
const cacheKey = `${category}/${type}`;
|
|
48407
48407
|
if (cachedChecksums[cacheKey] === checksum) continue;
|
|
48408
48408
|
const dlUrl = `${_ProviderLoader.REGISTRY_BASE_URL}/providers/${type}/${version}/download`;
|
|
48409
|
-
const manifestBody = await new Promise((
|
|
48409
|
+
const manifestBody = await new Promise((resolve25, reject) => {
|
|
48410
48410
|
const req = https.get(dlUrl, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: 3e4 }, (res) => {
|
|
48411
48411
|
if (res.statusCode !== 200) {
|
|
48412
48412
|
reject(new Error(`registry download HTTP ${res.statusCode} for ${type}@${version}`));
|
|
@@ -48414,7 +48414,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48414
48414
|
}
|
|
48415
48415
|
const chunks = [];
|
|
48416
48416
|
res.on("data", (c) => chunks.push(c));
|
|
48417
|
-
res.on("end", () =>
|
|
48417
|
+
res.on("end", () => resolve25(Buffer.concat(chunks).toString("utf-8")));
|
|
48418
48418
|
});
|
|
48419
48419
|
req.on("error", reject);
|
|
48420
48420
|
req.on("timeout", () => {
|
|
@@ -48473,7 +48473,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48473
48473
|
return { updated: false };
|
|
48474
48474
|
}
|
|
48475
48475
|
try {
|
|
48476
|
-
const etag = await new Promise((
|
|
48476
|
+
const etag = await new Promise((resolve25, reject) => {
|
|
48477
48477
|
const options = {
|
|
48478
48478
|
method: "HEAD",
|
|
48479
48479
|
hostname: "github.com",
|
|
@@ -48491,7 +48491,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48491
48491
|
headers: { "User-Agent": "adhdev-launcher" },
|
|
48492
48492
|
timeout: 1e4
|
|
48493
48493
|
}, (res2) => {
|
|
48494
|
-
|
|
48494
|
+
resolve25(res2.headers.etag || res2.headers["last-modified"] || "");
|
|
48495
48495
|
});
|
|
48496
48496
|
req2.on("error", reject);
|
|
48497
48497
|
req2.on("timeout", () => {
|
|
@@ -48500,7 +48500,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48500
48500
|
});
|
|
48501
48501
|
req2.end();
|
|
48502
48502
|
} else {
|
|
48503
|
-
|
|
48503
|
+
resolve25(res.headers.etag || res.headers["last-modified"] || "");
|
|
48504
48504
|
}
|
|
48505
48505
|
});
|
|
48506
48506
|
req.on("error", reject);
|
|
@@ -48564,7 +48564,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48564
48564
|
downloadFile(url, destPath) {
|
|
48565
48565
|
const https = __require("https");
|
|
48566
48566
|
const http3 = __require("http");
|
|
48567
|
-
return new Promise((
|
|
48567
|
+
return new Promise((resolve25, reject) => {
|
|
48568
48568
|
const doRequest = (reqUrl, redirectCount = 0) => {
|
|
48569
48569
|
if (redirectCount > 5) {
|
|
48570
48570
|
reject(new Error("Too many redirects"));
|
|
@@ -48584,7 +48584,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48584
48584
|
res.pipe(ws);
|
|
48585
48585
|
ws.on("finish", () => {
|
|
48586
48586
|
ws.close();
|
|
48587
|
-
|
|
48587
|
+
resolve25();
|
|
48588
48588
|
});
|
|
48589
48589
|
ws.on("error", reject);
|
|
48590
48590
|
});
|
|
@@ -49140,10 +49140,10 @@ function findMacAppProcessPids(psOutput, appPaths) {
|
|
|
49140
49140
|
|
|
49141
49141
|
// src/launch.ts
|
|
49142
49142
|
async function execQuiet(command, options = {}) {
|
|
49143
|
-
return new Promise((
|
|
49143
|
+
return new Promise((resolve25) => {
|
|
49144
49144
|
exec4(command, options, (error, stdout) => {
|
|
49145
|
-
if (error) return
|
|
49146
|
-
|
|
49145
|
+
if (error) return resolve25("");
|
|
49146
|
+
resolve25(stdout.toString());
|
|
49147
49147
|
});
|
|
49148
49148
|
});
|
|
49149
49149
|
}
|
|
@@ -49224,17 +49224,17 @@ async function findFreePort(ports) {
|
|
|
49224
49224
|
throw new Error("No free port found");
|
|
49225
49225
|
}
|
|
49226
49226
|
function checkPortFree(port) {
|
|
49227
|
-
return new Promise((
|
|
49227
|
+
return new Promise((resolve25) => {
|
|
49228
49228
|
const server = net.createServer();
|
|
49229
49229
|
server.unref();
|
|
49230
|
-
server.on("error", () =>
|
|
49230
|
+
server.on("error", () => resolve25(false));
|
|
49231
49231
|
server.listen(port, "127.0.0.1", () => {
|
|
49232
|
-
server.close(() =>
|
|
49232
|
+
server.close(() => resolve25(true));
|
|
49233
49233
|
});
|
|
49234
49234
|
});
|
|
49235
49235
|
}
|
|
49236
49236
|
async function isCdpActive(port) {
|
|
49237
|
-
return new Promise((
|
|
49237
|
+
return new Promise((resolve25) => {
|
|
49238
49238
|
const req = __require("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
49239
49239
|
timeout: 2e3
|
|
49240
49240
|
}, (res) => {
|
|
@@ -49243,16 +49243,16 @@ async function isCdpActive(port) {
|
|
|
49243
49243
|
res.on("end", () => {
|
|
49244
49244
|
try {
|
|
49245
49245
|
const info = JSON.parse(data);
|
|
49246
|
-
|
|
49246
|
+
resolve25(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
49247
49247
|
} catch {
|
|
49248
|
-
|
|
49248
|
+
resolve25(false);
|
|
49249
49249
|
}
|
|
49250
49250
|
});
|
|
49251
49251
|
});
|
|
49252
|
-
req.on("error", () =>
|
|
49252
|
+
req.on("error", () => resolve25(false));
|
|
49253
49253
|
req.on("timeout", () => {
|
|
49254
49254
|
req.destroy();
|
|
49255
|
-
|
|
49255
|
+
resolve25(false);
|
|
49256
49256
|
});
|
|
49257
49257
|
});
|
|
49258
49258
|
}
|
|
@@ -49388,7 +49388,7 @@ async function detectCurrentWorkspace(ideId) {
|
|
|
49388
49388
|
}
|
|
49389
49389
|
} else if (plat === "win32") {
|
|
49390
49390
|
try {
|
|
49391
|
-
const
|
|
49391
|
+
const fs39 = __require("fs");
|
|
49392
49392
|
const appNameMap = getMacAppIdentifiers();
|
|
49393
49393
|
const appName = appNameMap[ideId];
|
|
49394
49394
|
if (appName) {
|
|
@@ -49397,8 +49397,8 @@ async function detectCurrentWorkspace(ideId) {
|
|
|
49397
49397
|
appName,
|
|
49398
49398
|
"storage.json"
|
|
49399
49399
|
);
|
|
49400
|
-
if (
|
|
49401
|
-
const data = JSON.parse(
|
|
49400
|
+
if (fs39.existsSync(storagePath)) {
|
|
49401
|
+
const data = JSON.parse(fs39.readFileSync(storagePath, "utf-8"));
|
|
49402
49402
|
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
49403
49403
|
if (workspaces.length > 0) {
|
|
49404
49404
|
const recent = workspaces[0];
|
|
@@ -49876,12 +49876,12 @@ var meshCrudHandlers = {
|
|
|
49876
49876
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
49877
49877
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
49878
49878
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
49879
|
-
const { mkdirSync:
|
|
49880
|
-
const { dirname: dirname17, join:
|
|
49879
|
+
const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync24 } = await import("fs");
|
|
49880
|
+
const { dirname: dirname17, join: join50 } = await import("path");
|
|
49881
49881
|
const scaffold = buildMeshJsonConfigScaffold2(mesh);
|
|
49882
49882
|
const scaffoldJson = serializeMeshJsonConfigScaffold2(scaffold);
|
|
49883
49883
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
49884
|
-
const absolutePath =
|
|
49884
|
+
const absolutePath = join50(workspace, relativePath);
|
|
49885
49885
|
const validation = normalizeRepoMeshDeclarativeConfig2(scaffold);
|
|
49886
49886
|
if (!validation.valid) {
|
|
49887
49887
|
return { success: false, meshId, error: `invalid mesh.json scaffold: ${validation.errors.join("; ")}` };
|
|
@@ -49917,7 +49917,7 @@ var meshCrudHandlers = {
|
|
|
49917
49917
|
note: "Dry-run: nothing written. Re-run with write=true to persist to the repo (commit target). meshes.json is untouched."
|
|
49918
49918
|
};
|
|
49919
49919
|
}
|
|
49920
|
-
|
|
49920
|
+
mkdirSync22(dirname17(absolutePath), { recursive: true });
|
|
49921
49921
|
writeFileSync24(absolutePath, `${scaffoldJson}
|
|
49922
49922
|
`, "utf-8");
|
|
49923
49923
|
return {
|
|
@@ -50481,7 +50481,7 @@ var meshCrudHandlers = {
|
|
|
50481
50481
|
const setupPromise = finishWorktreeSetup();
|
|
50482
50482
|
const setupResult = await Promise.race([
|
|
50483
50483
|
setupPromise.then((value) => ({ completed: true, value })),
|
|
50484
|
-
new Promise((
|
|
50484
|
+
new Promise((resolve25) => setTimeout(() => resolve25({ completed: false }), setupWaitMs))
|
|
50485
50485
|
]);
|
|
50486
50486
|
const emitBootstrapEvent = (eventStatus2, bootstrapState2, startedAtMs, extraPayload) => {
|
|
50487
50487
|
try {
|
|
@@ -51718,7 +51718,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
51718
51718
|
workspace
|
|
51719
51719
|
};
|
|
51720
51720
|
}
|
|
51721
|
-
const { existsSync:
|
|
51721
|
+
const { existsSync: existsSync54, readFileSync: readFileSync42, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync22 } = await import("fs");
|
|
51722
51722
|
const { dirname: dirname17 } = await import("path");
|
|
51723
51723
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
51724
51724
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -51754,21 +51754,21 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
51754
51754
|
};
|
|
51755
51755
|
}
|
|
51756
51756
|
try {
|
|
51757
|
-
|
|
51757
|
+
mkdirSync22(dirname17(mcpConfigPath), { recursive: true });
|
|
51758
51758
|
} catch (error) {
|
|
51759
51759
|
const message = `Could not prepare MCP config path for automatic setup: ${error?.message || error}`;
|
|
51760
51760
|
LOG.error("MeshCoordinator", message);
|
|
51761
51761
|
if (hermesManualFallback) return returnManualFallback(message);
|
|
51762
51762
|
return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
|
|
51763
51763
|
}
|
|
51764
|
-
const hadExistingMcpConfig =
|
|
51764
|
+
const hadExistingMcpConfig = existsSync54(mcpConfigPath);
|
|
51765
51765
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
51766
51766
|
if (hermesBaseConfig) {
|
|
51767
51767
|
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname17(mcpConfigPath));
|
|
51768
51768
|
}
|
|
51769
51769
|
if (hadExistingMcpConfig) {
|
|
51770
51770
|
try {
|
|
51771
|
-
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(
|
|
51771
|
+
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync42(mcpConfigPath, "utf-8"), configFormat);
|
|
51772
51772
|
const existingCoordinatorConfig = hermesManualFallback ? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig) : parsedExistingMcpConfig;
|
|
51773
51773
|
existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
|
|
51774
51774
|
copyFileSync4(mcpConfigPath, mcpConfigPath + ".backup");
|
|
@@ -51912,10 +51912,10 @@ function runGit2(repoRoot, args) {
|
|
|
51912
51912
|
}
|
|
51913
51913
|
}
|
|
51914
51914
|
function readRecord6(repoRoot) {
|
|
51915
|
-
const
|
|
51916
|
-
if (!existsSync40(
|
|
51915
|
+
const path44 = resolve19(repoRoot, PREVIEW_DEPLOY_RECORD);
|
|
51916
|
+
if (!existsSync40(path44)) return null;
|
|
51917
51917
|
try {
|
|
51918
|
-
const parsed = JSON.parse(readFileSync31(
|
|
51918
|
+
const parsed = JSON.parse(readFileSync31(path44, "utf8"));
|
|
51919
51919
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
51920
51920
|
} catch {
|
|
51921
51921
|
return null;
|
|
@@ -52470,7 +52470,7 @@ var meshStatusHandlers = {
|
|
|
52470
52470
|
const { deriveMeshReviewInboxItems: deriveMeshReviewInboxItems2 } = await Promise.resolve().then(() => (init_mesh_review_inbox(), mesh_review_inbox_exports));
|
|
52471
52471
|
const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
52472
52472
|
const { getGitDiffSummary: getGitDiffSummary2 } = await Promise.resolve().then(() => (init_git_diff(), git_diff_exports));
|
|
52473
|
-
const { existsSync:
|
|
52473
|
+
const { existsSync: existsSync54 } = await import("fs");
|
|
52474
52474
|
const meshRecord = await ctx.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
52475
52475
|
const mesh = meshRecord?.mesh;
|
|
52476
52476
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
@@ -52489,7 +52489,7 @@ var meshStatusHandlers = {
|
|
|
52489
52489
|
const derivation = deriveMeshReviewInboxItems2({ nodes: nodeStatuses, ledgerEntries });
|
|
52490
52490
|
for (const item of derivation.items) {
|
|
52491
52491
|
const workspace = item.workspace;
|
|
52492
|
-
if (!workspace || !
|
|
52492
|
+
if (!workspace || !existsSync54(workspace)) continue;
|
|
52493
52493
|
const baseRef = item.defaultBranch ? `origin/${item.defaultBranch}` : "origin/main";
|
|
52494
52494
|
try {
|
|
52495
52495
|
const diffResult = await getGitDiffSummary2(workspace, { baseRef, maxFiles: 100 });
|
|
@@ -52697,9 +52697,9 @@ import { promisify as promisify6 } from "util";
|
|
|
52697
52697
|
var execFileAsync3 = promisify6(execFile4);
|
|
52698
52698
|
var GIT = process.platform === "win32" ? resolveWin32Executable("git") : "git";
|
|
52699
52699
|
var MAX_CHANGED_FILES2 = 500;
|
|
52700
|
-
function topLevel(
|
|
52701
|
-
const slash =
|
|
52702
|
-
return slash === -1 ?
|
|
52700
|
+
function topLevel(path44) {
|
|
52701
|
+
const slash = path44.indexOf("/");
|
|
52702
|
+
return slash === -1 ? path44 : path44.slice(0, slash);
|
|
52703
52703
|
}
|
|
52704
52704
|
async function analyzeMeshRefineNodeChangeArea(args) {
|
|
52705
52705
|
const { nodeId, workspace, branch, baseRef, branchRef, diffCwd, submodulePaths } = args;
|
|
@@ -53757,7 +53757,7 @@ async function probeRemoteMeshGitStatusWithRetry(args) {
|
|
|
53757
53757
|
const connection = args.getConnection?.(args.daemonId);
|
|
53758
53758
|
if (args.getConnection && readMeshConnectionState(connection) !== "connected") break;
|
|
53759
53759
|
if (connection) args.onConnection?.(connection);
|
|
53760
|
-
await new Promise((
|
|
53760
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250 * 2 ** (attempt - 1)));
|
|
53761
53761
|
}
|
|
53762
53762
|
try {
|
|
53763
53763
|
const remoteGit = await probeRemoteMeshGitStatus({
|
|
@@ -54134,18 +54134,18 @@ function resolveRefineryAutoPublishSubmoduleMainCommits(mesh, workspace) {
|
|
|
54134
54134
|
return { enabled: false };
|
|
54135
54135
|
}
|
|
54136
54136
|
async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
|
|
54137
|
-
const { execFileSync:
|
|
54137
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54138
54138
|
const diffArgs = ["diff", "--patch", "--full-index", fromRef, toRef];
|
|
54139
54139
|
if (excludePaths.length > 0) {
|
|
54140
|
-
diffArgs.push("--", ".", ...excludePaths.map((
|
|
54140
|
+
diffArgs.push("--", ".", ...excludePaths.map((path44) => `:(exclude)${path44}`));
|
|
54141
54141
|
}
|
|
54142
|
-
const diff =
|
|
54142
|
+
const diff = execFileSync10(GIT2, diffArgs, {
|
|
54143
54143
|
cwd,
|
|
54144
54144
|
encoding: "utf8",
|
|
54145
54145
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
54146
54146
|
});
|
|
54147
54147
|
if (!diff.trim()) return "";
|
|
54148
|
-
const patchId =
|
|
54148
|
+
const patchId = execFileSync10(GIT2, ["patch-id", "--stable"], {
|
|
54149
54149
|
cwd,
|
|
54150
54150
|
input: diff,
|
|
54151
54151
|
encoding: "utf8",
|
|
@@ -54156,8 +54156,8 @@ async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
|
|
|
54156
54156
|
async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead) {
|
|
54157
54157
|
const startedAt = Date.now();
|
|
54158
54158
|
try {
|
|
54159
|
-
const { execFileSync:
|
|
54160
|
-
const git = (args) =>
|
|
54159
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54160
|
+
const git = (args) => execFileSync10(GIT2, args, {
|
|
54161
54161
|
cwd: repoRoot,
|
|
54162
54162
|
encoding: "utf8",
|
|
54163
54163
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -54248,8 +54248,8 @@ ${e?.stderr || ""}`
|
|
|
54248
54248
|
async function checkWorktreeChangesPatchEquivalentInRef(repoRoot, ref, worktreeHead) {
|
|
54249
54249
|
const startedAt = Date.now();
|
|
54250
54250
|
try {
|
|
54251
|
-
const { execFileSync:
|
|
54252
|
-
const git = (gitArgs) =>
|
|
54251
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54252
|
+
const git = (gitArgs) => execFileSync10(GIT2, gitArgs, {
|
|
54253
54253
|
cwd: repoRoot,
|
|
54254
54254
|
encoding: "utf8",
|
|
54255
54255
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -54312,8 +54312,8 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
54312
54312
|
async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
54313
54313
|
const startedAt = Date.now();
|
|
54314
54314
|
try {
|
|
54315
|
-
const { execFileSync:
|
|
54316
|
-
const git = (args, opts) =>
|
|
54315
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54316
|
+
const git = (args, opts) => execFileSync10(GIT2, args, {
|
|
54317
54317
|
cwd: opts?.cwd || repoRoot,
|
|
54318
54318
|
encoding: "utf8",
|
|
54319
54319
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -54338,9 +54338,9 @@ async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
|
54338
54338
|
if (!trimmed) continue;
|
|
54339
54339
|
if (trimmed.startsWith("+")) {
|
|
54340
54340
|
const parts = trimmed.slice(1).trim().split(/\s+/);
|
|
54341
|
-
const
|
|
54341
|
+
const path44 = parts[1] || parts[0] || "(unknown)";
|
|
54342
54342
|
submoduleHints.push({
|
|
54343
|
-
path:
|
|
54343
|
+
path: path44,
|
|
54344
54344
|
reason: "submodule checked-out commit differs from the committed gitlink (pointer bump not committed on the root branch)"
|
|
54345
54345
|
});
|
|
54346
54346
|
}
|
|
@@ -54370,10 +54370,10 @@ async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
|
54370
54370
|
}
|
|
54371
54371
|
function buildPatchEquivalenceSubmoduleConflictHint(repoRoot, baseHead, branchHead, output) {
|
|
54372
54372
|
if (!/(submodule|160000)/i.test(output) || !/(conflict|failed to merge)/i.test(output)) return void 0;
|
|
54373
|
-
const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((
|
|
54374
|
-
path:
|
|
54375
|
-
baseCommit: readTreeObject(repoRoot, baseHead,
|
|
54376
|
-
branchCommit: readTreeObject(repoRoot, branchHead,
|
|
54373
|
+
const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path44) => ({
|
|
54374
|
+
path: path44,
|
|
54375
|
+
baseCommit: readTreeObject(repoRoot, baseHead, path44),
|
|
54376
|
+
branchCommit: readTreeObject(repoRoot, branchHead, path44)
|
|
54377
54377
|
}));
|
|
54378
54378
|
if (conflicts.length === 0) return void 0;
|
|
54379
54379
|
return {
|
|
@@ -54399,11 +54399,11 @@ function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
|
|
|
54399
54399
|
if (!line.trim()) continue;
|
|
54400
54400
|
const metaAndPath = line.split(" ");
|
|
54401
54401
|
const meta = metaAndPath[0] || "";
|
|
54402
|
-
const
|
|
54403
|
-
if (!
|
|
54402
|
+
const path44 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
54403
|
+
if (!path44) continue;
|
|
54404
54404
|
const parts = meta.split(/\s+/);
|
|
54405
54405
|
if (parts[0]?.includes("160000") || parts[1]?.includes("160000")) {
|
|
54406
|
-
paths.add(
|
|
54406
|
+
paths.add(path44);
|
|
54407
54407
|
}
|
|
54408
54408
|
}
|
|
54409
54409
|
return [...paths].sort();
|
|
@@ -54411,9 +54411,9 @@ function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
|
|
|
54411
54411
|
return [];
|
|
54412
54412
|
}
|
|
54413
54413
|
}
|
|
54414
|
-
function readTreeObject(repoRoot, ref,
|
|
54414
|
+
function readTreeObject(repoRoot, ref, path44) {
|
|
54415
54415
|
try {
|
|
54416
|
-
const output = execFileSync7(GIT2, ["ls-tree", ref, "--",
|
|
54416
|
+
const output = execFileSync7(GIT2, ["ls-tree", ref, "--", path44], {
|
|
54417
54417
|
cwd: repoRoot,
|
|
54418
54418
|
encoding: "utf8",
|
|
54419
54419
|
maxBuffer: 1024 * 1024
|
|
@@ -54458,12 +54458,12 @@ function readChangedPathKinds(repoRoot, fromRef, toRef) {
|
|
|
54458
54458
|
if (!line.trim()) continue;
|
|
54459
54459
|
const metaAndPath = line.split(" ");
|
|
54460
54460
|
const meta = metaAndPath[0] || "";
|
|
54461
|
-
const
|
|
54462
|
-
if (!
|
|
54463
|
-
seen.add(
|
|
54461
|
+
const path44 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
54462
|
+
if (!path44 || seen.has(path44)) continue;
|
|
54463
|
+
seen.add(path44);
|
|
54464
54464
|
const parts = meta.split(/\s+/);
|
|
54465
54465
|
const isGitlink = !!(parts[0]?.includes("160000") || parts[1]?.includes("160000"));
|
|
54466
|
-
result.push({ path:
|
|
54466
|
+
result.push({ path: path44, isGitlink });
|
|
54467
54467
|
}
|
|
54468
54468
|
return result;
|
|
54469
54469
|
} catch {
|
|
@@ -54471,20 +54471,20 @@ function readChangedPathKinds(repoRoot, fromRef, toRef) {
|
|
|
54471
54471
|
}
|
|
54472
54472
|
}
|
|
54473
54473
|
function collectFastForwardGitlinkPaths(repoRoot, baseHead, branchHead) {
|
|
54474
|
-
return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((
|
|
54475
|
-
const baseCommit = readTreeObject(repoRoot, baseHead,
|
|
54476
|
-
const branchCommit = readTreeObject(repoRoot, branchHead,
|
|
54474
|
+
return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((path44) => {
|
|
54475
|
+
const baseCommit = readTreeObject(repoRoot, baseHead, path44);
|
|
54476
|
+
const branchCommit = readTreeObject(repoRoot, branchHead, path44);
|
|
54477
54477
|
if (!baseCommit || !branchCommit) return false;
|
|
54478
|
-
return isSubmoduleFastForward(pathResolve2(repoRoot,
|
|
54478
|
+
return isSubmoduleFastForward(pathResolve2(repoRoot, path44), baseCommit, branchCommit);
|
|
54479
54479
|
});
|
|
54480
54480
|
}
|
|
54481
54481
|
function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
|
|
54482
|
-
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((
|
|
54483
|
-
const baseCommit = readTreeObject(repoRoot, baseHead,
|
|
54484
|
-
const branchCommit = readTreeObject(repoRoot, branchHead,
|
|
54485
|
-
const submoduleRepoPath = pathResolve2(repoRoot,
|
|
54482
|
+
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path44) => {
|
|
54483
|
+
const baseCommit = readTreeObject(repoRoot, baseHead, path44);
|
|
54484
|
+
const branchCommit = readTreeObject(repoRoot, branchHead, path44);
|
|
54485
|
+
const submoduleRepoPath = pathResolve2(repoRoot, path44);
|
|
54486
54486
|
const fastForward = !!baseCommit && !!branchCommit && isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit);
|
|
54487
|
-
return { path:
|
|
54487
|
+
return { path: path44, baseCommit, branchCommit, fastForward };
|
|
54488
54488
|
});
|
|
54489
54489
|
if (changedGitlinks.length === 0) {
|
|
54490
54490
|
return { trivial: false, reason: "no_changed_gitlinks", gitlinks: changedGitlinks };
|
|
@@ -54535,7 +54535,7 @@ function buildTreeWithGitlinksEqualized(repoRoot, commitish, paths, placeholderC
|
|
|
54535
54535
|
maxBuffer: 1024 * 1024
|
|
54536
54536
|
}).trim();
|
|
54537
54537
|
if (!tree) return void 0;
|
|
54538
|
-
const updates = paths.map((
|
|
54538
|
+
const updates = paths.map((path44) => `160000 commit ${placeholderCommit} ${path44}`).join("\n");
|
|
54539
54539
|
if (!updates) return tree;
|
|
54540
54540
|
const tmpIndex = pathJoin2(resolveGitDir(repoRoot), `adhdev-refine-eq-${commitish.slice(0, 12)}.index`);
|
|
54541
54541
|
const env = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
@@ -54638,7 +54638,7 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
|
|
|
54638
54638
|
}
|
|
54639
54639
|
async function alignRefinerySubmodulesAfterMerge(repoRoot, previousBaseHead, currentHead, options = {}) {
|
|
54640
54640
|
const startedAt = Date.now();
|
|
54641
|
-
const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((
|
|
54641
|
+
const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((path44) => !(options.submoduleIgnorePaths || []).includes(path44));
|
|
54642
54642
|
const preStatus = await getGitRepoStatus(repoRoot, {
|
|
54643
54643
|
includeSubmodules: true,
|
|
54644
54644
|
submoduleIgnorePaths: options.submoduleIgnorePaths,
|
|
@@ -54685,7 +54685,7 @@ async function alignRefinerySubmodulesAfterMerge(repoRoot, previousBaseHead, cur
|
|
|
54685
54685
|
changedGitlinkPaths,
|
|
54686
54686
|
outOfSyncPaths,
|
|
54687
54687
|
updatedPaths: updatePaths,
|
|
54688
|
-
verifiedPaths: updatePaths.filter((
|
|
54688
|
+
verifiedPaths: updatePaths.filter((path44) => !remaining.some((submodule) => submodule.path === path44)),
|
|
54689
54689
|
durationMs: Date.now() - startedAt,
|
|
54690
54690
|
command: `git ${commandArgs.join(" ")}`,
|
|
54691
54691
|
stdout: truncateValidationOutput(result.stdout),
|
|
@@ -55011,15 +55011,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
55011
55011
|
const cwd = candidate.cwd ? pathResolve2(workspace, candidate.cwd) : workspace;
|
|
55012
55012
|
const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
|
|
55013
55013
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
55014
|
-
const
|
|
55014
|
+
const spawn5 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
55015
55015
|
try {
|
|
55016
|
-
const result = await execFileAsync4(
|
|
55016
|
+
const result = await execFileAsync4(spawn5.file, spawn5.args, {
|
|
55017
55017
|
cwd,
|
|
55018
55018
|
encoding: "utf8",
|
|
55019
55019
|
timeout,
|
|
55020
55020
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
55021
55021
|
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
|
|
55022
|
-
...
|
|
55022
|
+
...spawn5.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
55023
55023
|
});
|
|
55024
55024
|
summary.bootstrapCommandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
55025
55025
|
} catch (error) {
|
|
@@ -55057,15 +55057,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
55057
55057
|
return summary;
|
|
55058
55058
|
}
|
|
55059
55059
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
55060
|
-
const
|
|
55060
|
+
const spawn5 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
55061
55061
|
try {
|
|
55062
|
-
const result = await execFileAsync4(
|
|
55062
|
+
const result = await execFileAsync4(spawn5.file, spawn5.args, {
|
|
55063
55063
|
cwd,
|
|
55064
55064
|
encoding: "utf8",
|
|
55065
55065
|
timeout,
|
|
55066
55066
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
55067
55067
|
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
|
|
55068
|
-
...
|
|
55068
|
+
...spawn5.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
55069
55069
|
});
|
|
55070
55070
|
summary.commandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
55071
55071
|
} catch (error) {
|
|
@@ -55774,7 +55774,7 @@ var DaemonCommandRouter = class {
|
|
|
55774
55774
|
*/
|
|
55775
55775
|
async bestEffortRemoveWorktreeDir(dir) {
|
|
55776
55776
|
if (!dir || !fs32.existsSync(dir)) return { removed: true, residue: false };
|
|
55777
|
-
const sleep3 = (ms) => new Promise((
|
|
55777
|
+
const sleep3 = (ms) => new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
55778
55778
|
const ABSORB = /* @__PURE__ */ new Set(["EINVAL", "EPERM", "EBUSY", "ENOTEMPTY", "EACCES", "EMFILE", "ENFILE"]);
|
|
55779
55779
|
let lastErr;
|
|
55780
55780
|
for (let attempt = 0; attempt < 4; attempt++) {
|
|
@@ -58532,7 +58532,7 @@ var ProviderStreamAdapter = class {
|
|
|
58532
58532
|
const beforeCount = this.messageCount(before);
|
|
58533
58533
|
const beforeSignature = this.lastMessageSignature(before);
|
|
58534
58534
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
58535
|
-
await new Promise((
|
|
58535
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
58536
58536
|
let state;
|
|
58537
58537
|
try {
|
|
58538
58538
|
state = await this.readChat(evaluate);
|
|
@@ -58554,7 +58554,7 @@ var ProviderStreamAdapter = class {
|
|
|
58554
58554
|
if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
|
|
58555
58555
|
return first;
|
|
58556
58556
|
}
|
|
58557
|
-
await new Promise((
|
|
58557
|
+
await new Promise((resolve25) => setTimeout(resolve25, 150));
|
|
58558
58558
|
const second = await this.readChat(evaluate);
|
|
58559
58559
|
return this.messageCount(second) >= this.messageCount(first) ? second : first;
|
|
58560
58560
|
}
|
|
@@ -58705,7 +58705,7 @@ var ProviderStreamAdapter = class {
|
|
|
58705
58705
|
if (typeof data.error === "string" && data.error.trim()) return false;
|
|
58706
58706
|
}
|
|
58707
58707
|
for (let attempt = 0; attempt < 6; attempt += 1) {
|
|
58708
|
-
await new Promise((
|
|
58708
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
58709
58709
|
const state = await this.readChat(evaluate);
|
|
58710
58710
|
const title = this.getStateTitle(state);
|
|
58711
58711
|
if (this.titlesMatch(title, sessionId)) return true;
|
|
@@ -59697,13 +59697,13 @@ var VersionArchive = class {
|
|
|
59697
59697
|
}
|
|
59698
59698
|
};
|
|
59699
59699
|
async function runCommand(cmd, timeout = 1e4) {
|
|
59700
|
-
return new Promise((
|
|
59700
|
+
return new Promise((resolve25) => {
|
|
59701
59701
|
exec5(cmd, {
|
|
59702
59702
|
encoding: "utf-8",
|
|
59703
59703
|
timeout
|
|
59704
59704
|
}, (error, stdout) => {
|
|
59705
|
-
if (error) return
|
|
59706
|
-
|
|
59705
|
+
if (error) return resolve25(null);
|
|
59706
|
+
resolve25(stdout.trim());
|
|
59707
59707
|
});
|
|
59708
59708
|
});
|
|
59709
59709
|
}
|
|
@@ -61403,7 +61403,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
|
|
|
61403
61403
|
return { target, instance, adapter };
|
|
61404
61404
|
}
|
|
61405
61405
|
function sleep2(ms) {
|
|
61406
|
-
return new Promise((
|
|
61406
|
+
return new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
61407
61407
|
}
|
|
61408
61408
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
61409
61409
|
const startedAt = Date.now();
|
|
@@ -62379,8 +62379,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62379
62379
|
fs36.writeFileSync(promptFile, prompt, "utf-8");
|
|
62380
62380
|
ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
|
|
62381
62381
|
const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
|
|
62382
|
-
const
|
|
62383
|
-
if (!
|
|
62382
|
+
const spawn5 = agentProvider?.spawn;
|
|
62383
|
+
if (!spawn5?.command) {
|
|
62384
62384
|
try {
|
|
62385
62385
|
fs36.unlinkSync(promptFile);
|
|
62386
62386
|
} catch {
|
|
@@ -62390,22 +62390,22 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62390
62390
|
}
|
|
62391
62391
|
const agentCategory = agentProvider?.category;
|
|
62392
62392
|
if (agentCategory === "acp") {
|
|
62393
|
-
sendAutoImplSSE(ctx, { event: "progress", data: { function: "_init", status: "spawning", message: `Spawning ACP agent: ${
|
|
62393
|
+
sendAutoImplSSE(ctx, { event: "progress", data: { function: "_init", status: "spawning", message: `Spawning ACP agent: ${spawn5.command} ${(spawn5.args || []).join(" ")}` } });
|
|
62394
62394
|
ctx.autoImplStatus.running = true;
|
|
62395
62395
|
ctx.autoImplStatus.type = type;
|
|
62396
62396
|
const { ClientSideConnection: ClientSideConnection2, ndJsonStream: ndJsonStream2, PROTOCOL_VERSION: PROTOCOL_VERSION2 } = await import("@agentclientprotocol/sdk");
|
|
62397
62397
|
const { Readable: Readable2, Writable: Writable2 } = await import("stream");
|
|
62398
62398
|
const { spawn: spawnFn2 } = await import("child_process");
|
|
62399
|
-
const acpArgs = [...
|
|
62399
|
+
const acpArgs = [...spawn5.args || []];
|
|
62400
62400
|
if (model) {
|
|
62401
62401
|
acpArgs.push("--model", model);
|
|
62402
62402
|
ctx.log(`Auto-implement ACP using model: ${model}`);
|
|
62403
62403
|
}
|
|
62404
|
-
const child2 = spawnFn2(
|
|
62404
|
+
const child2 = spawnFn2(spawn5.command, acpArgs, {
|
|
62405
62405
|
cwd: providerDir,
|
|
62406
62406
|
stdio: ["pipe", "pipe", "pipe"],
|
|
62407
|
-
shell:
|
|
62408
|
-
env: { ...process.env, ...
|
|
62407
|
+
shell: spawn5.shell ?? false,
|
|
62408
|
+
env: { ...process.env, ...spawn5.env || {} }
|
|
62409
62409
|
});
|
|
62410
62410
|
ctx.autoImplProcess = child2;
|
|
62411
62411
|
child2.stderr?.on("data", (d) => {
|
|
@@ -62515,7 +62515,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62515
62515
|
ctx.json(res, 202, {
|
|
62516
62516
|
started: true,
|
|
62517
62517
|
type,
|
|
62518
|
-
agent:
|
|
62518
|
+
agent: spawn5.command,
|
|
62519
62519
|
functions,
|
|
62520
62520
|
providerDir,
|
|
62521
62521
|
message: "ACP Auto-implement started. Connect to SSE for progress.",
|
|
@@ -62523,10 +62523,10 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62523
62523
|
});
|
|
62524
62524
|
return;
|
|
62525
62525
|
}
|
|
62526
|
-
const command =
|
|
62527
|
-
const autoImpl =
|
|
62526
|
+
const command = spawn5.command;
|
|
62527
|
+
const autoImpl = spawn5.autoImpl;
|
|
62528
62528
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
62529
|
-
const baseArgs = [...
|
|
62529
|
+
const baseArgs = [...spawn5.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
62530
62530
|
let shellCmd;
|
|
62531
62531
|
const isWin = os29.platform() === "win32";
|
|
62532
62532
|
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
@@ -62573,7 +62573,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62573
62573
|
cols: DEFAULT_SESSION_HOST_COLS7,
|
|
62574
62574
|
rows: DEFAULT_SESSION_HOST_ROWS7,
|
|
62575
62575
|
cwd: providerDir,
|
|
62576
|
-
env: { ...process.env, ...
|
|
62576
|
+
env: { ...process.env, ...spawn5.env || {} }
|
|
62577
62577
|
});
|
|
62578
62578
|
isPty = true;
|
|
62579
62579
|
} catch (err) {
|
|
@@ -62585,7 +62585,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62585
62585
|
stdio: ["pipe", "pipe", "pipe"],
|
|
62586
62586
|
env: {
|
|
62587
62587
|
...process.env,
|
|
62588
|
-
...
|
|
62588
|
+
...spawn5.env || {}
|
|
62589
62589
|
}
|
|
62590
62590
|
});
|
|
62591
62591
|
child.on("error", (err2) => {
|
|
@@ -63627,8 +63627,8 @@ var DevServer = class _DevServer {
|
|
|
63627
63627
|
}
|
|
63628
63628
|
getEndpointList() {
|
|
63629
63629
|
return this.routes.map((r) => {
|
|
63630
|
-
const
|
|
63631
|
-
return `${r.method.padEnd(5)} ${
|
|
63630
|
+
const path44 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
|
|
63631
|
+
return `${r.method.padEnd(5)} ${path44}`;
|
|
63632
63632
|
});
|
|
63633
63633
|
}
|
|
63634
63634
|
async start(port = DEV_SERVER_PORT) {
|
|
@@ -63659,15 +63659,15 @@ var DevServer = class _DevServer {
|
|
|
63659
63659
|
this.json(res, 500, { error: e.message });
|
|
63660
63660
|
}
|
|
63661
63661
|
});
|
|
63662
|
-
return new Promise((
|
|
63662
|
+
return new Promise((resolve25, reject) => {
|
|
63663
63663
|
this.server.listen(port, "127.0.0.1", () => {
|
|
63664
63664
|
this.log(`Dev server listening on http://127.0.0.1:${port}`);
|
|
63665
|
-
|
|
63665
|
+
resolve25();
|
|
63666
63666
|
});
|
|
63667
63667
|
this.server.on("error", (e) => {
|
|
63668
63668
|
if (e.code === "EADDRINUSE") {
|
|
63669
63669
|
this.log(`Port ${port} in use, skipping dev server`);
|
|
63670
|
-
|
|
63670
|
+
resolve25();
|
|
63671
63671
|
} else {
|
|
63672
63672
|
reject(e);
|
|
63673
63673
|
}
|
|
@@ -63728,16 +63728,16 @@ var DevServer = class _DevServer {
|
|
|
63728
63728
|
this.json(res, 404, { error: `Provider not found: ${type}` });
|
|
63729
63729
|
return;
|
|
63730
63730
|
}
|
|
63731
|
-
const
|
|
63732
|
-
if (!
|
|
63731
|
+
const spawn5 = provider.spawn;
|
|
63732
|
+
if (!spawn5) {
|
|
63733
63733
|
this.json(res, 400, { error: `Provider ${type} has no spawn config` });
|
|
63734
63734
|
return;
|
|
63735
63735
|
}
|
|
63736
63736
|
const { spawn: spawnFn } = await import("child_process");
|
|
63737
63737
|
const start = Date.now();
|
|
63738
63738
|
try {
|
|
63739
|
-
const child = spawnFn(
|
|
63740
|
-
shell:
|
|
63739
|
+
const child = spawnFn(spawn5.command, [...spawn5.args || []], {
|
|
63740
|
+
shell: spawn5.shell ?? false,
|
|
63741
63741
|
timeout: 5e3,
|
|
63742
63742
|
stdio: ["pipe", "pipe", "pipe"]
|
|
63743
63743
|
});
|
|
@@ -63749,27 +63749,27 @@ var DevServer = class _DevServer {
|
|
|
63749
63749
|
child.stderr?.on("data", (d) => {
|
|
63750
63750
|
stderr += d.toString().slice(0, 2e3);
|
|
63751
63751
|
});
|
|
63752
|
-
await new Promise((
|
|
63752
|
+
await new Promise((resolve25) => {
|
|
63753
63753
|
const timer = setTimeout(() => {
|
|
63754
63754
|
child.kill();
|
|
63755
|
-
|
|
63755
|
+
resolve25();
|
|
63756
63756
|
}, 3e3);
|
|
63757
63757
|
child.on("exit", () => {
|
|
63758
63758
|
clearTimeout(timer);
|
|
63759
|
-
|
|
63759
|
+
resolve25();
|
|
63760
63760
|
});
|
|
63761
63761
|
child.stdout?.once("data", () => {
|
|
63762
63762
|
setTimeout(() => {
|
|
63763
63763
|
child.kill();
|
|
63764
63764
|
clearTimeout(timer);
|
|
63765
|
-
|
|
63765
|
+
resolve25();
|
|
63766
63766
|
}, 500);
|
|
63767
63767
|
});
|
|
63768
63768
|
});
|
|
63769
63769
|
const elapsed = Date.now() - start;
|
|
63770
63770
|
this.json(res, 200, {
|
|
63771
63771
|
success: true,
|
|
63772
|
-
command: `${
|
|
63772
|
+
command: `${spawn5.command} ${(spawn5.args || []).join(" ")}`,
|
|
63773
63773
|
elapsed,
|
|
63774
63774
|
stdout: stdout.trim(),
|
|
63775
63775
|
stderr: stderr.trim(),
|
|
@@ -63779,7 +63779,7 @@ var DevServer = class _DevServer {
|
|
|
63779
63779
|
const elapsed = Date.now() - start;
|
|
63780
63780
|
this.json(res, 200, {
|
|
63781
63781
|
success: false,
|
|
63782
|
-
command: `${
|
|
63782
|
+
command: `${spawn5.command} ${(spawn5.args || []).join(" ")}`,
|
|
63783
63783
|
elapsed,
|
|
63784
63784
|
error: e.message
|
|
63785
63785
|
});
|
|
@@ -64242,20 +64242,20 @@ var DevServer = class _DevServer {
|
|
|
64242
64242
|
this.json(res, 404, { error: `Provider not found: ${type}` });
|
|
64243
64243
|
return;
|
|
64244
64244
|
}
|
|
64245
|
-
const
|
|
64246
|
-
if (!
|
|
64245
|
+
const spawn5 = provider.spawn;
|
|
64246
|
+
if (!spawn5) {
|
|
64247
64247
|
this.json(res, 400, { error: `Provider ${type} has no spawn config` });
|
|
64248
64248
|
return;
|
|
64249
64249
|
}
|
|
64250
64250
|
const { spawn: spawnFn } = await import("child_process");
|
|
64251
64251
|
const start = Date.now();
|
|
64252
64252
|
try {
|
|
64253
|
-
const args = [...
|
|
64254
|
-
const child = spawnFn(
|
|
64255
|
-
shell:
|
|
64253
|
+
const args = [...spawn5.args || [], message];
|
|
64254
|
+
const child = spawnFn(spawn5.command, args, {
|
|
64255
|
+
shell: spawn5.shell ?? false,
|
|
64256
64256
|
timeout,
|
|
64257
64257
|
stdio: ["pipe", "pipe", "pipe"],
|
|
64258
|
-
env: { ...process.env, ...
|
|
64258
|
+
env: { ...process.env, ...spawn5.env || {} }
|
|
64259
64259
|
});
|
|
64260
64260
|
let stdout = "";
|
|
64261
64261
|
let stderr = "";
|
|
@@ -64265,14 +64265,14 @@ var DevServer = class _DevServer {
|
|
|
64265
64265
|
child.stderr?.on("data", (d) => {
|
|
64266
64266
|
stderr += d.toString();
|
|
64267
64267
|
});
|
|
64268
|
-
await new Promise((
|
|
64268
|
+
await new Promise((resolve25) => {
|
|
64269
64269
|
const timer = setTimeout(() => {
|
|
64270
64270
|
child.kill();
|
|
64271
|
-
|
|
64271
|
+
resolve25();
|
|
64272
64272
|
}, timeout);
|
|
64273
64273
|
child.on("exit", () => {
|
|
64274
64274
|
clearTimeout(timer);
|
|
64275
|
-
|
|
64275
|
+
resolve25();
|
|
64276
64276
|
});
|
|
64277
64277
|
});
|
|
64278
64278
|
const elapsed = Date.now() - start;
|
|
@@ -64471,14 +64471,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
64471
64471
|
res.end(JSON.stringify(data, null, 2));
|
|
64472
64472
|
}
|
|
64473
64473
|
async readBody(req) {
|
|
64474
|
-
return new Promise((
|
|
64474
|
+
return new Promise((resolve25) => {
|
|
64475
64475
|
let body = "";
|
|
64476
64476
|
req.on("data", (chunk) => body += chunk);
|
|
64477
64477
|
req.on("end", () => {
|
|
64478
64478
|
try {
|
|
64479
|
-
|
|
64479
|
+
resolve25(JSON.parse(body));
|
|
64480
64480
|
} catch {
|
|
64481
|
-
|
|
64481
|
+
resolve25({});
|
|
64482
64482
|
}
|
|
64483
64483
|
});
|
|
64484
64484
|
});
|
|
@@ -65220,7 +65220,7 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS, requiredRe
|
|
|
65220
65220
|
const deadline = Date.now() + timeoutMs;
|
|
65221
65221
|
while (Date.now() < deadline) {
|
|
65222
65222
|
if (await canConnect(endpoint, requiredRequestTypes)) return;
|
|
65223
|
-
await new Promise((
|
|
65223
|
+
await new Promise((resolve25) => setTimeout(resolve25, STARTUP_POLL_MS));
|
|
65224
65224
|
}
|
|
65225
65225
|
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
65226
65226
|
}
|
|
@@ -65261,6 +65261,151 @@ async function listHostedCliRuntimes(endpoint) {
|
|
|
65261
65261
|
}
|
|
65262
65262
|
}
|
|
65263
65263
|
|
|
65264
|
+
// src/session-host/managed-host.ts
|
|
65265
|
+
import { execFileSync as execFileSync9, spawn as spawn4 } from "child_process";
|
|
65266
|
+
import * as fs38 from "fs";
|
|
65267
|
+
import * as os30 from "os";
|
|
65268
|
+
import * as path43 from "path";
|
|
65269
|
+
import {
|
|
65270
|
+
getDefaultSessionHostEndpoint as getDefaultSessionHostEndpoint2,
|
|
65271
|
+
sanitizeSpawnEnv as sanitizeSpawnEnv2
|
|
65272
|
+
} from "@adhdev/session-host-core";
|
|
65273
|
+
init_runtime_defaults();
|
|
65274
|
+
function createManagedSessionHost(options) {
|
|
65275
|
+
const appName = options.appName;
|
|
65276
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
|
|
65277
|
+
const endpoint = getDefaultSessionHostEndpoint2(appName);
|
|
65278
|
+
const isManagedPid = options.isManagedPid ?? (() => true);
|
|
65279
|
+
function buildEnv(baseEnv) {
|
|
65280
|
+
const env = sanitizeSpawnEnv2(baseEnv);
|
|
65281
|
+
env.ADHDEV_SESSION_HOST_NAME = appName;
|
|
65282
|
+
return env;
|
|
65283
|
+
}
|
|
65284
|
+
function resolveEntry() {
|
|
65285
|
+
const packagedCandidates = [
|
|
65286
|
+
path43.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
|
|
65287
|
+
path43.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
|
|
65288
|
+
];
|
|
65289
|
+
for (const candidate of packagedCandidates) {
|
|
65290
|
+
if (fs38.existsSync(candidate)) {
|
|
65291
|
+
return candidate;
|
|
65292
|
+
}
|
|
65293
|
+
}
|
|
65294
|
+
return __require.resolve("@adhdev/session-host-daemon");
|
|
65295
|
+
}
|
|
65296
|
+
function getPidFile() {
|
|
65297
|
+
return path43.join(os30.homedir(), ".adhdev", `${appName}-session-host.pid`);
|
|
65298
|
+
}
|
|
65299
|
+
function getPid() {
|
|
65300
|
+
try {
|
|
65301
|
+
const pidFile = getPidFile();
|
|
65302
|
+
if (!fs38.existsSync(pidFile)) return null;
|
|
65303
|
+
const pid = Number.parseInt(fs38.readFileSync(pidFile, "utf8").trim(), 10);
|
|
65304
|
+
return Number.isFinite(pid) ? pid : null;
|
|
65305
|
+
} catch {
|
|
65306
|
+
return null;
|
|
65307
|
+
}
|
|
65308
|
+
}
|
|
65309
|
+
function killPid2(pid) {
|
|
65310
|
+
try {
|
|
65311
|
+
if (process.platform === "win32") {
|
|
65312
|
+
const spawnOpts = { stdio: "ignore" };
|
|
65313
|
+
if (options.killWindowsHide) spawnOpts.windowsHide = true;
|
|
65314
|
+
execFileSync9("taskkill", ["/PID", String(pid), "/T", "/F"], spawnOpts);
|
|
65315
|
+
} else {
|
|
65316
|
+
process.kill(pid, "SIGTERM");
|
|
65317
|
+
}
|
|
65318
|
+
return true;
|
|
65319
|
+
} catch {
|
|
65320
|
+
return false;
|
|
65321
|
+
}
|
|
65322
|
+
}
|
|
65323
|
+
function spawnHost() {
|
|
65324
|
+
const entry = resolveEntry();
|
|
65325
|
+
let stdio = "ignore";
|
|
65326
|
+
let logFd = null;
|
|
65327
|
+
if (options.spawnStdio === "logfile") {
|
|
65328
|
+
const logDir = path43.join(os30.homedir(), ".adhdev", "logs");
|
|
65329
|
+
fs38.mkdirSync(logDir, { recursive: true });
|
|
65330
|
+
logFd = fs38.openSync(path43.join(logDir, "session-host.log"), "a");
|
|
65331
|
+
stdio = ["ignore", logFd, logFd];
|
|
65332
|
+
}
|
|
65333
|
+
const child = spawn4(process.execPath, [entry], {
|
|
65334
|
+
detached: true,
|
|
65335
|
+
stdio,
|
|
65336
|
+
windowsHide: true,
|
|
65337
|
+
env: buildEnv(process.env)
|
|
65338
|
+
});
|
|
65339
|
+
child.unref();
|
|
65340
|
+
if (logFd !== null) {
|
|
65341
|
+
try {
|
|
65342
|
+
fs38.closeSync(logFd);
|
|
65343
|
+
} catch {
|
|
65344
|
+
}
|
|
65345
|
+
}
|
|
65346
|
+
}
|
|
65347
|
+
function stopManagedSessionHostProcess() {
|
|
65348
|
+
let stopped = false;
|
|
65349
|
+
const pidFile = getPidFile();
|
|
65350
|
+
try {
|
|
65351
|
+
if (fs38.existsSync(pidFile)) {
|
|
65352
|
+
const pid = Number.parseInt(fs38.readFileSync(pidFile, "utf8").trim(), 10);
|
|
65353
|
+
if (Number.isFinite(pid) && pid !== process.pid && isManagedPid(pid)) {
|
|
65354
|
+
stopped = killPid2(pid) || stopped;
|
|
65355
|
+
}
|
|
65356
|
+
}
|
|
65357
|
+
} catch {
|
|
65358
|
+
} finally {
|
|
65359
|
+
try {
|
|
65360
|
+
fs38.unlinkSync(pidFile);
|
|
65361
|
+
} catch {
|
|
65362
|
+
}
|
|
65363
|
+
}
|
|
65364
|
+
if (options.extraStop) {
|
|
65365
|
+
stopped = options.extraStop(endpoint) || stopped;
|
|
65366
|
+
}
|
|
65367
|
+
return stopped;
|
|
65368
|
+
}
|
|
65369
|
+
async function ensureReady() {
|
|
65370
|
+
options.beforeEnsureReady?.();
|
|
65371
|
+
try {
|
|
65372
|
+
return await ensureSessionHostReady({
|
|
65373
|
+
appName,
|
|
65374
|
+
spawnHost,
|
|
65375
|
+
timeoutMs,
|
|
65376
|
+
requiredRequestTypes: options.requiredRequestTypes
|
|
65377
|
+
});
|
|
65378
|
+
} catch (error) {
|
|
65379
|
+
stopManagedSessionHostProcess();
|
|
65380
|
+
return ensureSessionHostReady({
|
|
65381
|
+
appName,
|
|
65382
|
+
spawnHost,
|
|
65383
|
+
timeoutMs,
|
|
65384
|
+
requiredRequestTypes: options.requiredRequestTypes
|
|
65385
|
+
}).catch((retryError) => {
|
|
65386
|
+
const initialMessage = error instanceof Error ? error.message : String(error);
|
|
65387
|
+
const retryMessage = retryError instanceof Error ? retryError.message : String(retryError);
|
|
65388
|
+
throw new Error(`Session host failed to start after retry (${initialMessage}; retry: ${retryMessage})`);
|
|
65389
|
+
});
|
|
65390
|
+
}
|
|
65391
|
+
}
|
|
65392
|
+
return {
|
|
65393
|
+
appName,
|
|
65394
|
+
endpoint,
|
|
65395
|
+
getPidFile,
|
|
65396
|
+
getPid,
|
|
65397
|
+
buildEnv,
|
|
65398
|
+
resolveEntry,
|
|
65399
|
+
killPid: killPid2,
|
|
65400
|
+
spawnHost,
|
|
65401
|
+
stopManagedSessionHostProcess,
|
|
65402
|
+
ensureReady,
|
|
65403
|
+
getStatusPaths() {
|
|
65404
|
+
return { pidFile: getPidFile(), endpoint };
|
|
65405
|
+
}
|
|
65406
|
+
};
|
|
65407
|
+
}
|
|
65408
|
+
|
|
65264
65409
|
// src/session-host/startup-restore-policy.js
|
|
65265
65410
|
function shouldAutoRestoreHostedSessionsOnStartup(env = process.env) {
|
|
65266
65411
|
const raw = typeof env.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP === "string" ? env.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP.trim().toLowerCase() : "";
|
|
@@ -65398,12 +65543,12 @@ async function installExtension(ide, extension) {
|
|
|
65398
65543
|
const res = await fetch(extension.vsixUrl);
|
|
65399
65544
|
if (res.ok) {
|
|
65400
65545
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
65401
|
-
const
|
|
65402
|
-
|
|
65403
|
-
return new Promise((
|
|
65546
|
+
const fs39 = await import("fs");
|
|
65547
|
+
fs39.writeFileSync(vsixPath, buffer);
|
|
65548
|
+
return new Promise((resolve25) => {
|
|
65404
65549
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
65405
65550
|
exec6(cmd, { timeout: 6e4 }, (error, _stdout, stderr) => {
|
|
65406
|
-
|
|
65551
|
+
resolve25({
|
|
65407
65552
|
extensionId: extension.id,
|
|
65408
65553
|
marketplaceId: extension.marketplaceId,
|
|
65409
65554
|
success: !error,
|
|
@@ -65416,11 +65561,11 @@ async function installExtension(ide, extension) {
|
|
|
65416
65561
|
} catch (e) {
|
|
65417
65562
|
}
|
|
65418
65563
|
}
|
|
65419
|
-
return new Promise((
|
|
65564
|
+
return new Promise((resolve25) => {
|
|
65420
65565
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
65421
65566
|
exec6(cmd, { timeout: 6e4 }, (error, stdout, stderr) => {
|
|
65422
65567
|
if (error) {
|
|
65423
|
-
|
|
65568
|
+
resolve25({
|
|
65424
65569
|
extensionId: extension.id,
|
|
65425
65570
|
marketplaceId: extension.marketplaceId,
|
|
65426
65571
|
success: false,
|
|
@@ -65428,7 +65573,7 @@ async function installExtension(ide, extension) {
|
|
|
65428
65573
|
error: stderr || error.message
|
|
65429
65574
|
});
|
|
65430
65575
|
} else {
|
|
65431
|
-
|
|
65576
|
+
resolve25({
|
|
65432
65577
|
extensionId: extension.id,
|
|
65433
65578
|
marketplaceId: extension.marketplaceId,
|
|
65434
65579
|
success: true,
|
|
@@ -65917,7 +66062,7 @@ async function startLocalIpcServer(opts) {
|
|
|
65917
66062
|
}));
|
|
65918
66063
|
}
|
|
65919
66064
|
}
|
|
65920
|
-
await new Promise((
|
|
66065
|
+
await new Promise((resolve25, reject) => {
|
|
65921
66066
|
const onError = (error) => {
|
|
65922
66067
|
httpServer?.off("listening", onListening);
|
|
65923
66068
|
reject(error);
|
|
@@ -65925,7 +66070,7 @@ async function startLocalIpcServer(opts) {
|
|
|
65925
66070
|
const onListening = () => {
|
|
65926
66071
|
httpServer?.off("error", onError);
|
|
65927
66072
|
listening = true;
|
|
65928
|
-
|
|
66073
|
+
resolve25();
|
|
65929
66074
|
};
|
|
65930
66075
|
httpServer.once("error", onError);
|
|
65931
66076
|
httpServer.once("listening", onListening);
|
|
@@ -65952,12 +66097,12 @@ async function startLocalIpcServer(opts) {
|
|
|
65952
66097
|
}
|
|
65953
66098
|
}
|
|
65954
66099
|
clients.clear();
|
|
65955
|
-
await new Promise((
|
|
66100
|
+
await new Promise((resolve25) => {
|
|
65956
66101
|
if (!httpServer) {
|
|
65957
|
-
|
|
66102
|
+
resolve25();
|
|
65958
66103
|
return;
|
|
65959
66104
|
}
|
|
65960
|
-
httpServer.close(() =>
|
|
66105
|
+
httpServer.close(() => resolve25());
|
|
65961
66106
|
});
|
|
65962
66107
|
httpServer = null;
|
|
65963
66108
|
wss = null;
|
|
@@ -65978,12 +66123,12 @@ init_parse_session();
|
|
|
65978
66123
|
|
|
65979
66124
|
// src/providers/sdk/v1/fixture-tooling/replay.ts
|
|
65980
66125
|
init_provider_cli_shared();
|
|
65981
|
-
import { readFileSync as
|
|
65982
|
-
import { dirname as dirname15, resolve as
|
|
66126
|
+
import { readFileSync as readFileSync40 } from "fs";
|
|
66127
|
+
import { dirname as dirname15, resolve as resolve23 } from "path";
|
|
65983
66128
|
|
|
65984
66129
|
// src/providers/sdk/v1/validators/taint.ts
|
|
65985
|
-
import { readFileSync as
|
|
65986
|
-
import { resolve as
|
|
66130
|
+
import { readFileSync as readFileSync41, existsSync as existsSync53 } from "fs";
|
|
66131
|
+
import { resolve as resolve24, dirname as dirname16, join as join49 } from "path";
|
|
65987
66132
|
|
|
65988
66133
|
// src/providers/sdk/v1/validators/index.ts
|
|
65989
66134
|
init_manifest();
|
|
@@ -66208,6 +66353,7 @@ export {
|
|
|
66208
66353
|
createGitSnapshotStore,
|
|
66209
66354
|
createGitWorkspaceMonitor,
|
|
66210
66355
|
createInteractionId,
|
|
66356
|
+
createManagedSessionHost,
|
|
66211
66357
|
createMesh,
|
|
66212
66358
|
createNativeHistoryDispatcher,
|
|
66213
66359
|
createSessionDelivery,
|