@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.js
CHANGED
|
@@ -409,10 +409,10 @@ function readInjected(value) {
|
|
|
409
409
|
}
|
|
410
410
|
function getDaemonBuildInfo() {
|
|
411
411
|
if (cached) return cached;
|
|
412
|
-
const commit = readInjected(true ? "
|
|
413
|
-
const commitShort = readInjected(true ? "
|
|
414
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
415
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
412
|
+
const commit = readInjected(true ? "7636b9d4fc6c456ebfe178b9b0a7b81664b02257" : void 0) ?? "unknown";
|
|
413
|
+
const commitShort = readInjected(true ? "7636b9d4" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
414
|
+
const version = readInjected(true ? "0.9.82-rc.448" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
415
|
+
const builtAt = readInjected(true ? "2026-07-02T00:30:54.215Z" : void 0);
|
|
416
416
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
417
417
|
return cached;
|
|
418
418
|
}
|
|
@@ -486,8 +486,8 @@ function validateChangeImpactConfig(raw, source = "inline") {
|
|
|
486
486
|
}
|
|
487
487
|
return { valid: errors.length === 0, errors, config: errors.length === 0 ? config : void 0 };
|
|
488
488
|
}
|
|
489
|
-
function parseConfigText(
|
|
490
|
-
if (/\.json$/i.test(
|
|
489
|
+
function parseConfigText(path44, text) {
|
|
490
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
491
491
|
return yaml.load(text);
|
|
492
492
|
}
|
|
493
493
|
function loadChangeImpactConfig(repoRoot) {
|
|
@@ -1104,14 +1104,14 @@ async function deriveSubmoduleGitlinkStatuses(repo, options) {
|
|
|
1104
1104
|
const lastCheckedAt = Date.now();
|
|
1105
1105
|
const headOidByPath = /* @__PURE__ */ new Map();
|
|
1106
1106
|
const entries = await Promise.all(
|
|
1107
|
-
paths.filter((
|
|
1108
|
-
const repoPath = repo.repoRoot + "/" +
|
|
1109
|
-
const expected = await readGitlinkExpectedSha(repo,
|
|
1107
|
+
paths.filter((path44) => !ignoreSet.has(path44)).map(async (path44) => {
|
|
1108
|
+
const repoPath = repo.repoRoot + "/" + path44;
|
|
1109
|
+
const expected = await readGitlinkExpectedSha(repo, path44, options);
|
|
1110
1110
|
const actual = await readSubmoduleHeadSha(repo, repoPath, options);
|
|
1111
|
-
if (actual) headOidByPath.set(
|
|
1111
|
+
if (actual) headOidByPath.set(path44, actual);
|
|
1112
1112
|
const outOfSync = actual === null ? true : expected !== null && expected !== actual;
|
|
1113
1113
|
return {
|
|
1114
|
-
path:
|
|
1114
|
+
path: path44,
|
|
1115
1115
|
// Prefer the recorded gitlink SHA (matches the legacy column); fall back
|
|
1116
1116
|
// to the checked-out SHA so the field is never empty when both are known.
|
|
1117
1117
|
commit: expected ?? actual ?? "",
|
|
@@ -2557,12 +2557,12 @@ function readGitSubmodules(value, parentRepoRoot) {
|
|
|
2557
2557
|
if (!Array.isArray(value)) return void 0;
|
|
2558
2558
|
const submodules = value.map((entry) => {
|
|
2559
2559
|
const submodule = readRecord(entry);
|
|
2560
|
-
const
|
|
2560
|
+
const path44 = readString2(submodule.path);
|
|
2561
2561
|
const commit = readString2(submodule.commit);
|
|
2562
|
-
const repoPath = readString2(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot,
|
|
2563
|
-
if (!
|
|
2562
|
+
const repoPath = readString2(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path44);
|
|
2563
|
+
if (!path44 || !commit) return null;
|
|
2564
2564
|
const result = {
|
|
2565
|
-
path:
|
|
2565
|
+
path: path44,
|
|
2566
2566
|
commit,
|
|
2567
2567
|
dirty: readBoolean(submodule.dirty) ?? false,
|
|
2568
2568
|
outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
|
|
@@ -2887,10 +2887,10 @@ function getMeshConfigPath() {
|
|
|
2887
2887
|
return (0, import_path3.join)(getConfigDir(), "meshes.json");
|
|
2888
2888
|
}
|
|
2889
2889
|
function loadMeshConfig() {
|
|
2890
|
-
const
|
|
2891
|
-
if (!(0, import_fs3.existsSync)(
|
|
2890
|
+
const path44 = getMeshConfigPath();
|
|
2891
|
+
if (!(0, import_fs3.existsSync)(path44)) return { meshes: [] };
|
|
2892
2892
|
try {
|
|
2893
|
-
const raw = JSON.parse((0, import_fs3.readFileSync)(
|
|
2893
|
+
const raw = JSON.parse((0, import_fs3.readFileSync)(path44, "utf-8"));
|
|
2894
2894
|
if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
|
|
2895
2895
|
const config = raw;
|
|
2896
2896
|
const migrated = migrateLoadedMeshConfig(config);
|
|
@@ -2939,16 +2939,16 @@ function normalizeCapabilityTags(value) {
|
|
|
2939
2939
|
return tags.length ? tags : void 0;
|
|
2940
2940
|
}
|
|
2941
2941
|
function saveMeshConfig(config) {
|
|
2942
|
-
const
|
|
2943
|
-
(0, import_fs3.writeFileSync)(
|
|
2942
|
+
const path44 = getMeshConfigPath();
|
|
2943
|
+
(0, import_fs3.writeFileSync)(path44, JSON.stringify(config, null, 2), { encoding: "utf-8", mode: 384 });
|
|
2944
2944
|
}
|
|
2945
2945
|
function normalizeRepoIdentity(remoteUrl) {
|
|
2946
2946
|
let identity = remoteUrl.trim();
|
|
2947
2947
|
if (identity.startsWith("http://") || identity.startsWith("https://")) {
|
|
2948
2948
|
try {
|
|
2949
2949
|
const url = new URL(identity);
|
|
2950
|
-
const
|
|
2951
|
-
return `${url.hostname}/${
|
|
2950
|
+
const path44 = url.pathname.replace(/^\//, "").replace(/\.git$/, "");
|
|
2951
|
+
return `${url.hostname}/${path44}`;
|
|
2952
2952
|
} catch {
|
|
2953
2953
|
}
|
|
2954
2954
|
}
|
|
@@ -4187,10 +4187,10 @@ function rotateArchiveFile(meshId, archivePath) {
|
|
|
4187
4187
|
}
|
|
4188
4188
|
}
|
|
4189
4189
|
function readArchivedCounts(meshId) {
|
|
4190
|
-
const
|
|
4191
|
-
if (!(0, import_fs4.existsSync)(
|
|
4190
|
+
const path44 = getArchivedCountsPath(meshId);
|
|
4191
|
+
if (!(0, import_fs4.existsSync)(path44)) return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
|
|
4192
4192
|
try {
|
|
4193
|
-
return JSON.parse((0, import_fs4.readFileSync)(
|
|
4193
|
+
return JSON.parse((0, import_fs4.readFileSync)(path44, "utf-8"));
|
|
4194
4194
|
} catch {
|
|
4195
4195
|
return { taskCompleted: 0, taskFailed: 0, taskStalled: 0, recoveryAttempted: 0, totalArchived: 0, lastArchivedAt: "" };
|
|
4196
4196
|
}
|
|
@@ -5400,11 +5400,11 @@ function readNodeReporter(node, key2) {
|
|
|
5400
5400
|
function buildMeshNodeCapabilityTags(node, providerType) {
|
|
5401
5401
|
const provider = typeof providerType === "string" && providerType.trim() ? providerType.trim() : firstProviderPriority(node?.policy);
|
|
5402
5402
|
const worktreeBranch = typeof node?.worktreeBranch === "string" && node.worktreeBranch.trim() ? node.worktreeBranch.trim() : null;
|
|
5403
|
-
const
|
|
5403
|
+
const os31 = readNodeOverride(node, "platform") ?? readNodeReporter(node, "platform") ?? process.platform;
|
|
5404
5404
|
const arch2 = readNodeOverride(node, "arch") ?? readNodeReporter(node, "arch") ?? process.arch;
|
|
5405
5405
|
return normalizeMeshCapabilityTags([
|
|
5406
5406
|
...Array.isArray(node?.capabilities) ? node.capabilities : [],
|
|
5407
|
-
`os=${
|
|
5407
|
+
`os=${os31}`,
|
|
5408
5408
|
`arch=${arch2}`,
|
|
5409
5409
|
...provider ? [`provider=${provider}`] : [],
|
|
5410
5410
|
// Worktree nodes automatically expose a "worktree=<branch>" tag so that
|
|
@@ -6298,10 +6298,10 @@ var init_mesh_runtime_store = __esm({
|
|
|
6298
6298
|
this.migratedMeshIds.add(meshId);
|
|
6299
6299
|
const count = this.db.prepare("SELECT COUNT(*) AS count FROM mesh_queue WHERE mesh_id = ?").get(meshId);
|
|
6300
6300
|
if (count.count > 0) return;
|
|
6301
|
-
const
|
|
6302
|
-
if (!(0, import_fs5.existsSync)(
|
|
6301
|
+
const path44 = legacyQueuePath(meshId);
|
|
6302
|
+
if (!(0, import_fs5.existsSync)(path44)) return;
|
|
6303
6303
|
try {
|
|
6304
|
-
const entries = JSON.parse((0, import_fs5.readFileSync)(
|
|
6304
|
+
const entries = JSON.parse((0, import_fs5.readFileSync)(path44, "utf-8"));
|
|
6305
6305
|
if (!Array.isArray(entries)) return;
|
|
6306
6306
|
const insert = this.db.prepare(`
|
|
6307
6307
|
INSERT OR REPLACE INTO mesh_queue (
|
|
@@ -8125,8 +8125,8 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
8125
8125
|
}
|
|
8126
8126
|
const serverName = mcpConfig.serverName?.trim() || DEFAULT_SERVER_NAME;
|
|
8127
8127
|
if (mcpConfig.mode === "auto_import") {
|
|
8128
|
-
const
|
|
8129
|
-
if (!
|
|
8128
|
+
const path44 = mcpConfig.path?.trim();
|
|
8129
|
+
if (!path44) {
|
|
8130
8130
|
return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
|
|
8131
8131
|
}
|
|
8132
8132
|
const mcpServer = resolveAdhdevMcpServerLaunch({
|
|
@@ -8146,7 +8146,7 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
8146
8146
|
return {
|
|
8147
8147
|
kind: "auto_import",
|
|
8148
8148
|
serverName,
|
|
8149
|
-
configPath: resolveMcpConfigPath(
|
|
8149
|
+
configPath: resolveMcpConfigPath(path44, workspace),
|
|
8150
8150
|
configFormat: mcpConfig.format,
|
|
8151
8151
|
mcpServer
|
|
8152
8152
|
};
|
|
@@ -8347,8 +8347,8 @@ function stripCoordinatorWrapperFile(filePath) {
|
|
|
8347
8347
|
const remaining = (existing.slice(0, openIdx) + existing.slice(closeIdx + CLOSE.length)).replace(/^\s*\n+/, "").replace(/\n+\s*$/, "");
|
|
8348
8348
|
if (!remaining.trim()) {
|
|
8349
8349
|
try {
|
|
8350
|
-
const
|
|
8351
|
-
|
|
8350
|
+
const fs39 = require("fs");
|
|
8351
|
+
fs39.unlinkSync(filePath);
|
|
8352
8352
|
} catch {
|
|
8353
8353
|
}
|
|
8354
8354
|
} else {
|
|
@@ -8450,10 +8450,10 @@ function getRegistryPath() {
|
|
|
8450
8450
|
return (0, import_path6.join)(getDaemonDataDir(), "mesh-coordinators.json");
|
|
8451
8451
|
}
|
|
8452
8452
|
function loadMeshCoordinatorRegistry() {
|
|
8453
|
-
const
|
|
8454
|
-
if (!(0, import_fs6.existsSync)(
|
|
8453
|
+
const path44 = getRegistryPath();
|
|
8454
|
+
if (!(0, import_fs6.existsSync)(path44)) return;
|
|
8455
8455
|
try {
|
|
8456
|
-
const raw = JSON.parse((0, import_fs6.readFileSync)(
|
|
8456
|
+
const raw = JSON.parse((0, import_fs6.readFileSync)(path44, "utf-8"));
|
|
8457
8457
|
if (!Array.isArray(raw)) return;
|
|
8458
8458
|
_registry.clear();
|
|
8459
8459
|
for (const entry of raw) {
|
|
@@ -8624,8 +8624,8 @@ function validateMeshRefineConfig(config, source = "inline") {
|
|
|
8624
8624
|
if (rejectedCommands.length) errors.push("one or more validation commands are invalid");
|
|
8625
8625
|
return { valid: errors.length === 0, errors, bootstrapCommands, commands, rejectedCommands, bootstrapMode, deprecationWarnings };
|
|
8626
8626
|
}
|
|
8627
|
-
function parseConfigText2(
|
|
8628
|
-
if (/\.json$/i.test(
|
|
8627
|
+
function parseConfigText2(path44, text) {
|
|
8628
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
8629
8629
|
return yaml2.load(text);
|
|
8630
8630
|
}
|
|
8631
8631
|
function loadMeshRefineConfig(mesh, workspace) {
|
|
@@ -8952,8 +8952,8 @@ function isCleanIgnoringSubmoduleGitlinks(porcelain, submodulePaths) {
|
|
|
8952
8952
|
const lines = porcelain.split(/\r?\n/).filter((line) => line.length > 0);
|
|
8953
8953
|
for (const line of lines) {
|
|
8954
8954
|
const status = line.slice(0, 2);
|
|
8955
|
-
const
|
|
8956
|
-
const isGitlinkPointerMove = (status === " M" || status === "M ") && submodulePaths.has(
|
|
8955
|
+
const path44 = line.slice(3).trim().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
8956
|
+
const isGitlinkPointerMove = (status === " M" || status === "M ") && submodulePaths.has(path44);
|
|
8957
8957
|
if (!isGitlinkPointerMove) return false;
|
|
8958
8958
|
}
|
|
8959
8959
|
return true;
|
|
@@ -8984,8 +8984,8 @@ function isWorktreeBootstrapStaleRunning(node, nowMs = Date.now()) {
|
|
|
8984
8984
|
return false;
|
|
8985
8985
|
}
|
|
8986
8986
|
}
|
|
8987
|
-
function parseConfigText3(
|
|
8988
|
-
if (/\.json$/i.test(
|
|
8987
|
+
function parseConfigText3(path44, text) {
|
|
8988
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
8989
8989
|
return yaml3.load(text);
|
|
8990
8990
|
}
|
|
8991
8991
|
function truncateOutput(value) {
|
|
@@ -9130,16 +9130,16 @@ async function runMeshWorktreeBootstrap(mesh, workspace) {
|
|
|
9130
9130
|
const startedAt = Date.now();
|
|
9131
9131
|
state.lastCommand = command.displayCommand;
|
|
9132
9132
|
const resolvedCommand = resolveWin32Executable(command.command);
|
|
9133
|
-
const
|
|
9133
|
+
const spawn5 = buildWin32ExecFileSpawn(resolvedCommand, command.args);
|
|
9134
9134
|
try {
|
|
9135
|
-
const result = await execFileAsync4(
|
|
9135
|
+
const result = await execFileAsync4(spawn5.file, spawn5.args, {
|
|
9136
9136
|
cwd,
|
|
9137
9137
|
encoding: "utf8",
|
|
9138
9138
|
timeout: command.timeoutMs || DEFAULT_TIMEOUT_MS2,
|
|
9139
9139
|
maxBuffer: command.outputLimitBytes || DEFAULT_OUTPUT_LIMIT_BYTES,
|
|
9140
9140
|
env: { ...process.env, CI: process.env.CI || "1", ...command.env || {} },
|
|
9141
9141
|
windowsHide: true,
|
|
9142
|
-
...
|
|
9142
|
+
...spawn5.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
9143
9143
|
});
|
|
9144
9144
|
state.commandsRun?.push({
|
|
9145
9145
|
command: command.command,
|
|
@@ -9262,8 +9262,8 @@ __export(mesh_json_config_exports, {
|
|
|
9262
9262
|
function isRecord3(value) {
|
|
9263
9263
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
9264
9264
|
}
|
|
9265
|
-
function parseConfigText4(
|
|
9266
|
-
if (/\.json$/i.test(
|
|
9265
|
+
function parseConfigText4(path44, text) {
|
|
9266
|
+
if (/\.json$/i.test(path44)) return JSON.parse(text);
|
|
9267
9267
|
return yaml4.load(text);
|
|
9268
9268
|
}
|
|
9269
9269
|
function normalizeOperatingNote(value) {
|
|
@@ -11069,10 +11069,10 @@ function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
|
11069
11069
|
const primaryDaemonId = daemonIds[0];
|
|
11070
11070
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11071
11071
|
const events = [];
|
|
11072
|
-
for (const
|
|
11073
|
-
if (!(0, import_fs11.existsSync)(
|
|
11072
|
+
for (const path44 of paths) {
|
|
11073
|
+
if (!(0, import_fs11.existsSync)(path44)) continue;
|
|
11074
11074
|
try {
|
|
11075
|
-
const raw = (0, import_fs11.readFileSync)(
|
|
11075
|
+
const raw = (0, import_fs11.readFileSync)(path44, "utf-8");
|
|
11076
11076
|
const parsed = raw.split("\n").filter(Boolean).flatMap((line) => {
|
|
11077
11077
|
try {
|
|
11078
11078
|
return [JSON.parse(line)];
|
|
@@ -11080,7 +11080,7 @@ function readPendingMeshCoordinatorEventsFromDisk(meshId, coordinatorDaemonId) {
|
|
|
11080
11080
|
return [];
|
|
11081
11081
|
}
|
|
11082
11082
|
});
|
|
11083
|
-
const filtered = primaryDaemonId &&
|
|
11083
|
+
const filtered = primaryDaemonId && path44 === getPendingEventsPath(meshId) ? parsed.filter((e) => !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId)) : parsed;
|
|
11084
11084
|
events.push(...filtered);
|
|
11085
11085
|
} catch {
|
|
11086
11086
|
}
|
|
@@ -11145,11 +11145,11 @@ function reconcilePendingMeshCoordinatorEvents(meshId, events) {
|
|
|
11145
11145
|
const reconciled = terminalJobIds.size === 0 ? events : events.filter((event) => !(event.event === "refine:accepted" && terminalJobIds.has(readRefineJobId2(event))));
|
|
11146
11146
|
return backfilled.length === 0 ? reconciled : [...reconciled, ...backfilled];
|
|
11147
11147
|
}
|
|
11148
|
-
function trimPendingEventsIfNeeded(
|
|
11148
|
+
function trimPendingEventsIfNeeded(path44) {
|
|
11149
11149
|
try {
|
|
11150
|
-
if (!(0, import_fs11.existsSync)(
|
|
11151
|
-
if ((0, import_fs11.statSync)(
|
|
11152
|
-
const lines = (0, import_fs11.readFileSync)(
|
|
11150
|
+
if (!(0, import_fs11.existsSync)(path44)) return;
|
|
11151
|
+
if ((0, import_fs11.statSync)(path44).size <= MAX_PENDING_EVENTS_BYTES) return;
|
|
11152
|
+
const lines = (0, import_fs11.readFileSync)(path44, "utf-8").split("\n").filter(Boolean);
|
|
11153
11153
|
if (lines.length <= MAX_PENDING_EVENTS_KEEP) return;
|
|
11154
11154
|
const dropped = lines.slice(0, lines.length - MAX_PENDING_EVENTS_KEEP);
|
|
11155
11155
|
for (const line of dropped) {
|
|
@@ -11182,7 +11182,7 @@ function trimPendingEventsIfNeeded(path43) {
|
|
|
11182
11182
|
LOG.warn("MeshEvents", `Failed to ledger-record trim-dropped ${event.event} for mesh ${event.meshId}: ${e?.message || e}`);
|
|
11183
11183
|
}
|
|
11184
11184
|
}
|
|
11185
|
-
(0, import_fs11.writeFileSync)(
|
|
11185
|
+
(0, import_fs11.writeFileSync)(path44, lines.slice(-MAX_PENDING_EVENTS_KEEP).join("\n") + "\n", "utf-8");
|
|
11186
11186
|
} catch {
|
|
11187
11187
|
}
|
|
11188
11188
|
}
|
|
@@ -11212,9 +11212,9 @@ function queuePendingMeshCoordinatorEvent(event) {
|
|
|
11212
11212
|
} catch {
|
|
11213
11213
|
}
|
|
11214
11214
|
try {
|
|
11215
|
-
const
|
|
11216
|
-
trimPendingEventsIfNeeded(
|
|
11217
|
-
(0, import_fs11.appendFileSync)(
|
|
11215
|
+
const path44 = getPendingEventsPath(event.meshId, event.targetCoordinatorDaemonId);
|
|
11216
|
+
trimPendingEventsIfNeeded(path44);
|
|
11217
|
+
(0, import_fs11.appendFileSync)(path44, JSON.stringify(event) + "\n", "utf-8");
|
|
11218
11218
|
} catch (e) {
|
|
11219
11219
|
if (!sqliteOk) throw e;
|
|
11220
11220
|
LOG.warn("MeshEvents", `JSONL append failed for mesh ${event.meshId}; SQLite holds the event: ${e?.message || e}`);
|
|
@@ -11225,10 +11225,10 @@ function queuePendingMeshCoordinatorEvent(event) {
|
|
|
11225
11225
|
return false;
|
|
11226
11226
|
}
|
|
11227
11227
|
}
|
|
11228
|
-
function atomicDrainFile(
|
|
11229
|
-
const tmpPath = `${
|
|
11228
|
+
function atomicDrainFile(path44) {
|
|
11229
|
+
const tmpPath = `${path44}.draining`;
|
|
11230
11230
|
try {
|
|
11231
|
-
(0, import_fs11.renameSync)(
|
|
11231
|
+
(0, import_fs11.renameSync)(path44, tmpPath);
|
|
11232
11232
|
} catch {
|
|
11233
11233
|
return null;
|
|
11234
11234
|
}
|
|
@@ -11247,10 +11247,10 @@ function atomicDrainFile(path43) {
|
|
|
11247
11247
|
return null;
|
|
11248
11248
|
}
|
|
11249
11249
|
}
|
|
11250
|
-
function selectiveDrainFile(
|
|
11251
|
-
const tmpPath = `${
|
|
11250
|
+
function selectiveDrainFile(path44, predicate) {
|
|
11251
|
+
const tmpPath = `${path44}.draining`;
|
|
11252
11252
|
try {
|
|
11253
|
-
(0, import_fs11.renameSync)(
|
|
11253
|
+
(0, import_fs11.renameSync)(path44, tmpPath);
|
|
11254
11254
|
} catch {
|
|
11255
11255
|
return [];
|
|
11256
11256
|
}
|
|
@@ -11282,12 +11282,12 @@ function selectiveDrainFile(path43, predicate) {
|
|
|
11282
11282
|
}
|
|
11283
11283
|
try {
|
|
11284
11284
|
if (keptLines.length > 0) {
|
|
11285
|
-
(0, import_fs11.writeFileSync)(
|
|
11285
|
+
(0, import_fs11.writeFileSync)(path44, keptLines.join("\n") + "\n", "utf-8");
|
|
11286
11286
|
}
|
|
11287
11287
|
(0, import_fs11.unlinkSync)(tmpPath);
|
|
11288
11288
|
} catch {
|
|
11289
11289
|
try {
|
|
11290
|
-
if ((0, import_fs11.existsSync)(tmpPath) && !(0, import_fs11.existsSync)(
|
|
11290
|
+
if ((0, import_fs11.existsSync)(tmpPath) && !(0, import_fs11.existsSync)(path44)) (0, import_fs11.renameSync)(tmpPath, path44);
|
|
11291
11291
|
} catch {
|
|
11292
11292
|
}
|
|
11293
11293
|
return [];
|
|
@@ -11322,16 +11322,16 @@ function drainPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId, opts) {
|
|
|
11322
11322
|
LOG.warn("MeshEvents", `SQLite pending-event drain failed for mesh ${meshId}; JSONL fallback only: ${e?.message || e}`);
|
|
11323
11323
|
}
|
|
11324
11324
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11325
|
-
for (const
|
|
11326
|
-
const isSharedFile = !!primaryDaemonId &&
|
|
11325
|
+
for (const path44 of paths) {
|
|
11326
|
+
const isSharedFile = !!primaryDaemonId && path44 === getPendingEventsPath(meshId);
|
|
11327
11327
|
const targets = (e) => !isSharedFile || !e.targetCoordinatorDaemonId || daemonIds.includes(e.targetCoordinatorDaemonId);
|
|
11328
11328
|
if (onlyEvents) {
|
|
11329
|
-
for (const event of selectiveDrainFile(
|
|
11329
|
+
for (const event of selectiveDrainFile(path44, (e) => targets(e) && matchesFilter(e.event))) {
|
|
11330
11330
|
pushUnique(event);
|
|
11331
11331
|
}
|
|
11332
11332
|
continue;
|
|
11333
11333
|
}
|
|
11334
|
-
const content = atomicDrainFile(
|
|
11334
|
+
const content = atomicDrainFile(path44);
|
|
11335
11335
|
if (!content) continue;
|
|
11336
11336
|
const parsed = content.split("\n").filter(Boolean).flatMap((line) => {
|
|
11337
11337
|
try {
|
|
@@ -11367,9 +11367,9 @@ function retractPendingDispatchBlockedEvent(meshId, taskId, coordinatorDaemonId)
|
|
|
11367
11367
|
const daemonIds = normalizeCoordinatorDaemonIds(coordinatorDaemonId);
|
|
11368
11368
|
const primaryDaemonId = daemonIds[0];
|
|
11369
11369
|
const paths = primaryDaemonId ? [getPendingEventsPath(meshId, primaryDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11370
|
-
for (const
|
|
11370
|
+
for (const path44 of paths) {
|
|
11371
11371
|
try {
|
|
11372
|
-
removed += selectiveDrainFile(
|
|
11372
|
+
removed += selectiveDrainFile(path44, matchesTask).length;
|
|
11373
11373
|
} catch {
|
|
11374
11374
|
}
|
|
11375
11375
|
}
|
|
@@ -11410,9 +11410,9 @@ function clearPendingMeshCoordinatorEvents(meshId, coordinatorDaemonId) {
|
|
|
11410
11410
|
} catch {
|
|
11411
11411
|
}
|
|
11412
11412
|
const paths = coordinatorDaemonId ? [getPendingEventsPath(meshId, coordinatorDaemonId), getPendingEventsPath(meshId)] : [getPendingEventsPath(meshId)];
|
|
11413
|
-
for (const
|
|
11414
|
-
if ((0, import_fs11.existsSync)(
|
|
11415
|
-
(0, import_fs11.unlinkSync)(
|
|
11413
|
+
for (const path44 of paths) {
|
|
11414
|
+
if ((0, import_fs11.existsSync)(path44)) try {
|
|
11415
|
+
(0, import_fs11.unlinkSync)(path44);
|
|
11416
11416
|
} catch {
|
|
11417
11417
|
}
|
|
11418
11418
|
}
|
|
@@ -11884,9 +11884,9 @@ function findBinary(name) {
|
|
|
11884
11884
|
for (const ext of exes) {
|
|
11885
11885
|
const fullPath = path11.join(p, trimmed + ext);
|
|
11886
11886
|
try {
|
|
11887
|
-
const
|
|
11888
|
-
if (
|
|
11889
|
-
const stat2 =
|
|
11887
|
+
const fs39 = require("fs");
|
|
11888
|
+
if (fs39.existsSync(fullPath)) {
|
|
11889
|
+
const stat2 = fs39.statSync(fullPath);
|
|
11890
11890
|
if (stat2.isFile() && (isWin || stat2.mode & 73)) {
|
|
11891
11891
|
return fullPath;
|
|
11892
11892
|
}
|
|
@@ -11900,12 +11900,12 @@ function findBinary(name) {
|
|
|
11900
11900
|
function isScriptBinary(binaryPath) {
|
|
11901
11901
|
if (!path11.isAbsolute(binaryPath)) return false;
|
|
11902
11902
|
try {
|
|
11903
|
-
const
|
|
11904
|
-
const resolved =
|
|
11903
|
+
const fs39 = require("fs");
|
|
11904
|
+
const resolved = fs39.realpathSync(binaryPath);
|
|
11905
11905
|
const head = Buffer.alloc(8);
|
|
11906
|
-
const fd =
|
|
11907
|
-
|
|
11908
|
-
|
|
11906
|
+
const fd = fs39.openSync(resolved, "r");
|
|
11907
|
+
fs39.readSync(fd, head, 0, 8, 0);
|
|
11908
|
+
fs39.closeSync(fd);
|
|
11909
11909
|
let i = 0;
|
|
11910
11910
|
if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
|
|
11911
11911
|
return head[i] === 35 && head[i + 1] === 33;
|
|
@@ -11916,12 +11916,12 @@ function isScriptBinary(binaryPath) {
|
|
|
11916
11916
|
function looksLikeMachOOrElf(filePath) {
|
|
11917
11917
|
if (!path11.isAbsolute(filePath)) return false;
|
|
11918
11918
|
try {
|
|
11919
|
-
const
|
|
11920
|
-
const resolved =
|
|
11919
|
+
const fs39 = require("fs");
|
|
11920
|
+
const resolved = fs39.realpathSync(filePath);
|
|
11921
11921
|
const buf = Buffer.alloc(8);
|
|
11922
|
-
const fd =
|
|
11923
|
-
|
|
11924
|
-
|
|
11922
|
+
const fd = fs39.openSync(resolved, "r");
|
|
11923
|
+
fs39.readSync(fd, buf, 0, 8, 0);
|
|
11924
|
+
fs39.closeSync(fd);
|
|
11925
11925
|
let i = 0;
|
|
11926
11926
|
if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
|
|
11927
11927
|
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 = (0, import_child_process2.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) {
|
|
@@ -12346,7 +12346,7 @@ var init_mesh_event_trace = __esm({
|
|
|
12346
12346
|
// src/mesh/mesh-warmup-deadline.ts
|
|
12347
12347
|
function awaitWithWarmupDeadline(work, opts) {
|
|
12348
12348
|
const pollMs = Math.max(1, Math.min(opts.pollIntervalMs ?? 200, opts.connectTimeoutMs));
|
|
12349
|
-
return new Promise((
|
|
12349
|
+
return new Promise((resolve25, reject) => {
|
|
12350
12350
|
let done = false;
|
|
12351
12351
|
let poll;
|
|
12352
12352
|
let responseTimer;
|
|
@@ -12396,7 +12396,7 @@ function awaitWithWarmupDeadline(work, opts) {
|
|
|
12396
12396
|
if (typeof poll.unref === "function") poll.unref();
|
|
12397
12397
|
}
|
|
12398
12398
|
work.then(
|
|
12399
|
-
(val) => settle(() =>
|
|
12399
|
+
(val) => settle(() => resolve25(val)),
|
|
12400
12400
|
(err) => settle(() => reject(err))
|
|
12401
12401
|
);
|
|
12402
12402
|
});
|
|
@@ -12499,7 +12499,7 @@ async function waitForLocalSessionReady(components, sessionId) {
|
|
|
12499
12499
|
const deadline = Date.now() + LOCAL_LAUNCH_READY_TIMEOUT_MS;
|
|
12500
12500
|
while (Date.now() < deadline) {
|
|
12501
12501
|
if (adapter.isReady() || adapter.currentStatus === "idle") return;
|
|
12502
|
-
await new Promise((
|
|
12502
|
+
await new Promise((resolve25) => setTimeout(resolve25, LOCAL_LAUNCH_READY_POLL_MS));
|
|
12503
12503
|
}
|
|
12504
12504
|
LOG.warn("MeshQueue", `Auto-launched session ${sessionId} not interactive after ${LOCAL_LAUNCH_READY_TIMEOUT_MS}ms; dispatching anyway (adapter queue-until-ready will buffer)`);
|
|
12505
12505
|
}
|
|
@@ -18930,7 +18930,7 @@ function getCliValidator() {
|
|
|
18930
18930
|
return _cliValidator;
|
|
18931
18931
|
}
|
|
18932
18932
|
function formatIssue(err) {
|
|
18933
|
-
const
|
|
18933
|
+
const path44 = err.instancePath || "";
|
|
18934
18934
|
const params = err.params;
|
|
18935
18935
|
let message = err.message || "validation failed";
|
|
18936
18936
|
let allowed;
|
|
@@ -18948,7 +18948,7 @@ function formatIssue(err) {
|
|
|
18948
18948
|
} else if (err.keyword === "type") {
|
|
18949
18949
|
message = `must be ${params.type}`;
|
|
18950
18950
|
}
|
|
18951
|
-
return { path:
|
|
18951
|
+
return { path: path44, keyword: err.keyword, message, ...allowed !== void 0 ? { allowed } : {} };
|
|
18952
18952
|
}
|
|
18953
18953
|
function validateCliProviderManifest(manifest) {
|
|
18954
18954
|
const validator = getCliValidator();
|
|
@@ -19244,40 +19244,40 @@ function validateFsmSpec(raw) {
|
|
|
19244
19244
|
}
|
|
19245
19245
|
return errs;
|
|
19246
19246
|
}
|
|
19247
|
-
function validateCondition(c, sectionIds,
|
|
19247
|
+
function validateCondition(c, sectionIds, path44) {
|
|
19248
19248
|
const errs = [];
|
|
19249
19249
|
const w = c;
|
|
19250
19250
|
if ("all" in w) {
|
|
19251
|
-
w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${
|
|
19251
|
+
w.all.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path44}.all[${i}]`)));
|
|
19252
19252
|
return errs;
|
|
19253
19253
|
}
|
|
19254
19254
|
if ("any" in w) {
|
|
19255
|
-
w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${
|
|
19255
|
+
w.any.forEach((x, i) => errs.push(...validateCondition(x, sectionIds, `${path44}.any[${i}]`)));
|
|
19256
19256
|
return errs;
|
|
19257
19257
|
}
|
|
19258
19258
|
if ("not" in w) {
|
|
19259
|
-
errs.push(...validateCondition(w.not, sectionIds, `${
|
|
19259
|
+
errs.push(...validateCondition(w.not, sectionIds, `${path44}.not`));
|
|
19260
19260
|
return errs;
|
|
19261
19261
|
}
|
|
19262
19262
|
if ("matches" in w) {
|
|
19263
|
-
if (w.section && !sectionIds.has(w.section)) errs.push(`${
|
|
19263
|
+
if (w.section && !sectionIds.has(w.section)) errs.push(`${path44}.section "${w.section}" unknown`);
|
|
19264
19264
|
try {
|
|
19265
19265
|
new RegExp(w.matches, w.flags ?? "i");
|
|
19266
19266
|
} catch (e) {
|
|
19267
|
-
errs.push(`${
|
|
19267
|
+
errs.push(`${path44}.matches invalid regex: ${e.message}`);
|
|
19268
19268
|
}
|
|
19269
19269
|
return errs;
|
|
19270
19270
|
}
|
|
19271
19271
|
if ("cursor_above" in w && "changed" in w) return errs;
|
|
19272
19272
|
if ("elapsed_ms" in w) {
|
|
19273
|
-
if (typeof w.elapsed_ms !== "number") errs.push(`${
|
|
19273
|
+
if (typeof w.elapsed_ms !== "number") errs.push(`${path44}.elapsed_ms must be a number`);
|
|
19274
19274
|
return errs;
|
|
19275
19275
|
}
|
|
19276
19276
|
if ("stable_ms" in w) {
|
|
19277
|
-
if (typeof w.stable_ms !== "number") errs.push(`${
|
|
19277
|
+
if (typeof w.stable_ms !== "number") errs.push(`${path44}.stable_ms must be a number`);
|
|
19278
19278
|
return errs;
|
|
19279
19279
|
}
|
|
19280
|
-
errs.push(`${
|
|
19280
|
+
errs.push(`${path44} is not a recognized condition`);
|
|
19281
19281
|
return errs;
|
|
19282
19282
|
}
|
|
19283
19283
|
var fs10;
|
|
@@ -19772,8 +19772,8 @@ var init_pty_transport = __esm({
|
|
|
19772
19772
|
let cwd = options.cwd;
|
|
19773
19773
|
if (cwd) {
|
|
19774
19774
|
try {
|
|
19775
|
-
const
|
|
19776
|
-
const stat2 =
|
|
19775
|
+
const fs39 = require("fs");
|
|
19776
|
+
const stat2 = fs39.statSync(cwd);
|
|
19777
19777
|
if (!stat2.isDirectory()) cwd = os14.homedir();
|
|
19778
19778
|
} catch {
|
|
19779
19779
|
cwd = os14.homedir();
|
|
@@ -22321,7 +22321,7 @@ ${lastSnapshot}`;
|
|
|
22321
22321
|
`[${this.cliType}] Waiting for interactive prompt: status=${status} stableMs=${stableMs} recentOutputMs=${recentlyOutput} screen=${JSON.stringify(summarizeCliTraceText(screenText, 220)).slice(0, 260)}`
|
|
22322
22322
|
);
|
|
22323
22323
|
}
|
|
22324
|
-
await new Promise((
|
|
22324
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
22325
22325
|
}
|
|
22326
22326
|
const finalScreenText = this.terminalScreen.getText() || "";
|
|
22327
22327
|
LOG.warn(
|
|
@@ -22616,7 +22616,7 @@ ${lastSnapshot}`;
|
|
|
22616
22616
|
if (!this.ptyProcess) throw new Error(`${this.cliName} is not running`);
|
|
22617
22617
|
await this.ptyProcess.write(chunks[i]);
|
|
22618
22618
|
if (i + 1 < chunks.length) {
|
|
22619
|
-
await new Promise((
|
|
22619
|
+
await new Promise((resolve25) => setTimeout(resolve25, WIN32_PTY_WRITE_CHUNK_GAP_MS));
|
|
22620
22620
|
}
|
|
22621
22621
|
}
|
|
22622
22622
|
}
|
|
@@ -22784,7 +22784,7 @@ ${lastSnapshot}`;
|
|
|
22784
22784
|
this.onStatusChange?.();
|
|
22785
22785
|
}
|
|
22786
22786
|
async waitForForceSubmitSettle() {
|
|
22787
|
-
await new Promise((
|
|
22787
|
+
await new Promise((resolve25) => setTimeout(resolve25, FORCE_SUBMIT_SETTLE_MS));
|
|
22788
22788
|
}
|
|
22789
22789
|
enqueuePendingOutboundMessage(text, reason, meshTaskId) {
|
|
22790
22790
|
const content = String(text || "");
|
|
@@ -22863,7 +22863,7 @@ ${lastSnapshot}`;
|
|
|
22863
22863
|
const deadline = Date.now() + 1e4;
|
|
22864
22864
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
22865
22865
|
this.resolveStartupState("send_wait");
|
|
22866
|
-
await new Promise((
|
|
22866
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
22867
22867
|
}
|
|
22868
22868
|
}
|
|
22869
22869
|
const parsedStatusBeforeSend = !allowInputDuringGeneration ? (() => {
|
|
@@ -22956,13 +22956,13 @@ ${lastSnapshot}`;
|
|
|
22956
22956
|
isFirstTurn: !this.firstTurnSent
|
|
22957
22957
|
};
|
|
22958
22958
|
this.engine.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
|
|
22959
|
-
await new Promise((
|
|
22959
|
+
await new Promise((resolve25, reject) => {
|
|
22960
22960
|
let resolved = false;
|
|
22961
22961
|
const completion = {
|
|
22962
22962
|
resolveOnce: () => {
|
|
22963
22963
|
if (resolved) return;
|
|
22964
22964
|
resolved = true;
|
|
22965
|
-
|
|
22965
|
+
resolve25();
|
|
22966
22966
|
},
|
|
22967
22967
|
rejectOnce: (error) => {
|
|
22968
22968
|
if (resolved) return;
|
|
@@ -23150,17 +23150,17 @@ ${lastSnapshot}`;
|
|
|
23150
23150
|
}
|
|
23151
23151
|
}
|
|
23152
23152
|
waitForStopped(timeoutMs) {
|
|
23153
|
-
return new Promise((
|
|
23153
|
+
return new Promise((resolve25) => {
|
|
23154
23154
|
const startedAt = Date.now();
|
|
23155
23155
|
const timer = setInterval(() => {
|
|
23156
23156
|
if (!this.ptyProcess || this.engine.currentStatus === "stopped") {
|
|
23157
23157
|
clearInterval(timer);
|
|
23158
|
-
|
|
23158
|
+
resolve25(true);
|
|
23159
23159
|
return;
|
|
23160
23160
|
}
|
|
23161
23161
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
23162
23162
|
clearInterval(timer);
|
|
23163
|
-
|
|
23163
|
+
resolve25(false);
|
|
23164
23164
|
}
|
|
23165
23165
|
}, 100);
|
|
23166
23166
|
});
|
|
@@ -24020,6 +24020,7 @@ __export(index_exports, {
|
|
|
24020
24020
|
createGitSnapshotStore: () => createGitSnapshotStore,
|
|
24021
24021
|
createGitWorkspaceMonitor: () => createGitWorkspaceMonitor,
|
|
24022
24022
|
createInteractionId: () => createInteractionId,
|
|
24023
|
+
createManagedSessionHost: () => createManagedSessionHost,
|
|
24023
24024
|
createMesh: () => createMesh,
|
|
24024
24025
|
createNativeHistoryDispatcher: () => createNativeHistoryDispatcher,
|
|
24025
24026
|
createSessionDelivery: () => createSessionDelivery,
|
|
@@ -25868,17 +25869,17 @@ function checkPathExists(paths) {
|
|
|
25868
25869
|
return null;
|
|
25869
25870
|
}
|
|
25870
25871
|
async function detectIDEs(providerLoader) {
|
|
25871
|
-
const
|
|
25872
|
+
const os31 = (0, import_os2.platform)();
|
|
25872
25873
|
const results = [];
|
|
25873
25874
|
for (const def of getMergedDefinitions()) {
|
|
25874
25875
|
const cliPath = findCliCommand(providerLoader?.getIdeCliCommand(def.id, def.cli) || def.cli);
|
|
25875
|
-
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[
|
|
25876
|
+
const appPath = checkPathExists(providerLoader?.getIdePathCandidates(def.id, def.paths[os31] || []) || []);
|
|
25876
25877
|
let resolvedCli = cliPath;
|
|
25877
|
-
if (!resolvedCli && appPath &&
|
|
25878
|
+
if (!resolvedCli && appPath && os31 === "darwin") {
|
|
25878
25879
|
const bundledCli = `${appPath}/Contents/Resources/app/bin/${def.cli}`;
|
|
25879
25880
|
if ((0, import_fs15.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
25880
25881
|
}
|
|
25881
|
-
if (!resolvedCli && appPath &&
|
|
25882
|
+
if (!resolvedCli && appPath && os31 === "win32") {
|
|
25882
25883
|
const { dirname: dirname17 } = await import("path");
|
|
25883
25884
|
const appDir = dirname17(appPath);
|
|
25884
25885
|
const candidates = [
|
|
@@ -25895,7 +25896,7 @@ async function detectIDEs(providerLoader) {
|
|
|
25895
25896
|
}
|
|
25896
25897
|
}
|
|
25897
25898
|
}
|
|
25898
|
-
const installed =
|
|
25899
|
+
const installed = os31 === "darwin" ? !!(resolvedCli || appPath) : !!resolvedCli;
|
|
25899
25900
|
const version = null;
|
|
25900
25901
|
results.push({
|
|
25901
25902
|
id: def.id,
|
|
@@ -26154,7 +26155,7 @@ var DaemonCdpManager = class {
|
|
|
26154
26155
|
* Returns multiple entries if multiple IDE windows are open on same port
|
|
26155
26156
|
*/
|
|
26156
26157
|
static listAllTargets(port) {
|
|
26157
|
-
return new Promise((
|
|
26158
|
+
return new Promise((resolve25) => {
|
|
26158
26159
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
26159
26160
|
let data = "";
|
|
26160
26161
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -26170,16 +26171,16 @@ var DaemonCdpManager = class {
|
|
|
26170
26171
|
(t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
|
|
26171
26172
|
);
|
|
26172
26173
|
const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
|
|
26173
|
-
|
|
26174
|
+
resolve25(mainPages.length > 0 ? mainPages : fallbackPages);
|
|
26174
26175
|
} catch {
|
|
26175
|
-
|
|
26176
|
+
resolve25([]);
|
|
26176
26177
|
}
|
|
26177
26178
|
});
|
|
26178
26179
|
});
|
|
26179
|
-
req.on("error", () =>
|
|
26180
|
+
req.on("error", () => resolve25([]));
|
|
26180
26181
|
req.setTimeout(2e3, () => {
|
|
26181
26182
|
req.destroy();
|
|
26182
|
-
|
|
26183
|
+
resolve25([]);
|
|
26183
26184
|
});
|
|
26184
26185
|
});
|
|
26185
26186
|
}
|
|
@@ -26219,7 +26220,7 @@ var DaemonCdpManager = class {
|
|
|
26219
26220
|
}
|
|
26220
26221
|
}
|
|
26221
26222
|
findTargetOnPort(port) {
|
|
26222
|
-
return new Promise((
|
|
26223
|
+
return new Promise((resolve25) => {
|
|
26223
26224
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
26224
26225
|
let data = "";
|
|
26225
26226
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -26230,7 +26231,7 @@ var DaemonCdpManager = class {
|
|
|
26230
26231
|
(t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
|
|
26231
26232
|
);
|
|
26232
26233
|
if (pages.length === 0) {
|
|
26233
|
-
|
|
26234
|
+
resolve25(targets.find((t) => t.webSocketDebuggerUrl) || null);
|
|
26234
26235
|
return;
|
|
26235
26236
|
}
|
|
26236
26237
|
const titleFilteredPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
|
|
@@ -26249,25 +26250,25 @@ var DaemonCdpManager = class {
|
|
|
26249
26250
|
this._targetId = selected.target.id;
|
|
26250
26251
|
}
|
|
26251
26252
|
this._pageTitle = selected.target.title || "";
|
|
26252
|
-
|
|
26253
|
+
resolve25(selected.target);
|
|
26253
26254
|
return;
|
|
26254
26255
|
}
|
|
26255
26256
|
if (previousTargetId) {
|
|
26256
26257
|
this.log(`[CDP] Target ${previousTargetId} not found in page list`);
|
|
26257
|
-
|
|
26258
|
+
resolve25(null);
|
|
26258
26259
|
return;
|
|
26259
26260
|
}
|
|
26260
26261
|
this._pageTitle = list[0]?.title || "";
|
|
26261
|
-
|
|
26262
|
+
resolve25(list[0]);
|
|
26262
26263
|
} catch {
|
|
26263
|
-
|
|
26264
|
+
resolve25(null);
|
|
26264
26265
|
}
|
|
26265
26266
|
});
|
|
26266
26267
|
});
|
|
26267
|
-
req.on("error", () =>
|
|
26268
|
+
req.on("error", () => resolve25(null));
|
|
26268
26269
|
req.setTimeout(2e3, () => {
|
|
26269
26270
|
req.destroy();
|
|
26270
|
-
|
|
26271
|
+
resolve25(null);
|
|
26271
26272
|
});
|
|
26272
26273
|
});
|
|
26273
26274
|
}
|
|
@@ -26278,7 +26279,7 @@ var DaemonCdpManager = class {
|
|
|
26278
26279
|
this.extensionProviders = providers;
|
|
26279
26280
|
}
|
|
26280
26281
|
connectToTarget(wsUrl) {
|
|
26281
|
-
return new Promise((
|
|
26282
|
+
return new Promise((resolve25) => {
|
|
26282
26283
|
this.ws = new import_ws.default(wsUrl);
|
|
26283
26284
|
this.ws.on("open", async () => {
|
|
26284
26285
|
this._connected = true;
|
|
@@ -26288,17 +26289,17 @@ var DaemonCdpManager = class {
|
|
|
26288
26289
|
}
|
|
26289
26290
|
this.connectBrowserWs().catch(() => {
|
|
26290
26291
|
});
|
|
26291
|
-
|
|
26292
|
+
resolve25(true);
|
|
26292
26293
|
});
|
|
26293
26294
|
this.ws.on("message", (data) => {
|
|
26294
26295
|
try {
|
|
26295
26296
|
const msg = JSON.parse(data.toString());
|
|
26296
26297
|
if (msg.id && this.pending.has(msg.id)) {
|
|
26297
|
-
const { resolve:
|
|
26298
|
+
const { resolve: resolve26, reject } = this.pending.get(msg.id);
|
|
26298
26299
|
this.pending.delete(msg.id);
|
|
26299
26300
|
this.failureCount = 0;
|
|
26300
26301
|
if (msg.error) reject(new Error(msg.error.message));
|
|
26301
|
-
else
|
|
26302
|
+
else resolve26(msg.result);
|
|
26302
26303
|
} else if (msg.method === "Runtime.executionContextCreated") {
|
|
26303
26304
|
this.contexts.add(msg.params.context.id);
|
|
26304
26305
|
} else if (msg.method === "Runtime.executionContextDestroyed") {
|
|
@@ -26321,7 +26322,7 @@ var DaemonCdpManager = class {
|
|
|
26321
26322
|
this.ws.on("error", (err) => {
|
|
26322
26323
|
this.log(`[CDP] WebSocket error: ${err.message}`);
|
|
26323
26324
|
this._connected = false;
|
|
26324
|
-
|
|
26325
|
+
resolve25(false);
|
|
26325
26326
|
});
|
|
26326
26327
|
});
|
|
26327
26328
|
}
|
|
@@ -26335,7 +26336,7 @@ var DaemonCdpManager = class {
|
|
|
26335
26336
|
return;
|
|
26336
26337
|
}
|
|
26337
26338
|
this.log(`[CDP] Connecting browser WS for target discovery...`);
|
|
26338
|
-
await new Promise((
|
|
26339
|
+
await new Promise((resolve25, reject) => {
|
|
26339
26340
|
this.browserWs = new import_ws.default(browserWsUrl);
|
|
26340
26341
|
this.browserWs.on("open", async () => {
|
|
26341
26342
|
this._browserConnected = true;
|
|
@@ -26345,16 +26346,16 @@ var DaemonCdpManager = class {
|
|
|
26345
26346
|
} catch (e) {
|
|
26346
26347
|
this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
|
|
26347
26348
|
}
|
|
26348
|
-
|
|
26349
|
+
resolve25();
|
|
26349
26350
|
});
|
|
26350
26351
|
this.browserWs.on("message", (data) => {
|
|
26351
26352
|
try {
|
|
26352
26353
|
const msg = JSON.parse(data.toString());
|
|
26353
26354
|
if (msg.id && this.browserPending.has(msg.id)) {
|
|
26354
|
-
const { resolve:
|
|
26355
|
+
const { resolve: resolve26, reject: reject2 } = this.browserPending.get(msg.id);
|
|
26355
26356
|
this.browserPending.delete(msg.id);
|
|
26356
26357
|
if (msg.error) reject2(new Error(msg.error.message));
|
|
26357
|
-
else
|
|
26358
|
+
else resolve26(msg.result);
|
|
26358
26359
|
}
|
|
26359
26360
|
} catch {
|
|
26360
26361
|
}
|
|
@@ -26374,31 +26375,31 @@ var DaemonCdpManager = class {
|
|
|
26374
26375
|
}
|
|
26375
26376
|
}
|
|
26376
26377
|
getBrowserWsUrl() {
|
|
26377
|
-
return new Promise((
|
|
26378
|
+
return new Promise((resolve25) => {
|
|
26378
26379
|
const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
|
|
26379
26380
|
let data = "";
|
|
26380
26381
|
res.on("data", (chunk) => data += chunk.toString());
|
|
26381
26382
|
res.on("end", () => {
|
|
26382
26383
|
try {
|
|
26383
26384
|
const info = JSON.parse(data);
|
|
26384
|
-
|
|
26385
|
+
resolve25(info.webSocketDebuggerUrl || null);
|
|
26385
26386
|
} catch {
|
|
26386
|
-
|
|
26387
|
+
resolve25(null);
|
|
26387
26388
|
}
|
|
26388
26389
|
});
|
|
26389
26390
|
});
|
|
26390
|
-
req.on("error", () =>
|
|
26391
|
+
req.on("error", () => resolve25(null));
|
|
26391
26392
|
req.setTimeout(3e3, () => {
|
|
26392
26393
|
req.destroy();
|
|
26393
|
-
|
|
26394
|
+
resolve25(null);
|
|
26394
26395
|
});
|
|
26395
26396
|
});
|
|
26396
26397
|
}
|
|
26397
26398
|
sendBrowser(method, params = {}, timeoutMs = 15e3) {
|
|
26398
|
-
return new Promise((
|
|
26399
|
+
return new Promise((resolve25, reject) => {
|
|
26399
26400
|
if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
|
|
26400
26401
|
const id = this.browserMsgId++;
|
|
26401
|
-
this.browserPending.set(id, { resolve:
|
|
26402
|
+
this.browserPending.set(id, { resolve: resolve25, reject });
|
|
26402
26403
|
this.browserWs.send(JSON.stringify({ id, method, params }));
|
|
26403
26404
|
setTimeout(() => {
|
|
26404
26405
|
if (this.browserPending.has(id)) {
|
|
@@ -26438,11 +26439,11 @@ var DaemonCdpManager = class {
|
|
|
26438
26439
|
}
|
|
26439
26440
|
// ─── CDP Protocol ────────────────────────────────────────
|
|
26440
26441
|
sendInternal(method, params = {}, timeoutMs = 15e3) {
|
|
26441
|
-
return new Promise((
|
|
26442
|
+
return new Promise((resolve25, reject) => {
|
|
26442
26443
|
if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
|
|
26443
26444
|
if (this.ws.readyState !== import_ws.default.OPEN) return reject(new Error("WebSocket not open"));
|
|
26444
26445
|
const id = this.msgId++;
|
|
26445
|
-
this.pending.set(id, { resolve:
|
|
26446
|
+
this.pending.set(id, { resolve: resolve25, reject });
|
|
26446
26447
|
this.ws.send(JSON.stringify({ id, method, params }));
|
|
26447
26448
|
setTimeout(() => {
|
|
26448
26449
|
if (this.pending.has(id)) {
|
|
@@ -26691,7 +26692,7 @@ var DaemonCdpManager = class {
|
|
|
26691
26692
|
const browserWs = this.browserWs;
|
|
26692
26693
|
let msgId = this.browserMsgId;
|
|
26693
26694
|
const sendWs = (method, params = {}, sessionId) => {
|
|
26694
|
-
return new Promise((
|
|
26695
|
+
return new Promise((resolve25, reject) => {
|
|
26695
26696
|
const mid = msgId++;
|
|
26696
26697
|
this.browserMsgId = msgId;
|
|
26697
26698
|
const handler = (raw) => {
|
|
@@ -26700,7 +26701,7 @@ var DaemonCdpManager = class {
|
|
|
26700
26701
|
if (msg.id === mid) {
|
|
26701
26702
|
browserWs.removeListener("message", handler);
|
|
26702
26703
|
if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
|
|
26703
|
-
else
|
|
26704
|
+
else resolve25(msg.result);
|
|
26704
26705
|
}
|
|
26705
26706
|
} catch {
|
|
26706
26707
|
}
|
|
@@ -26901,14 +26902,14 @@ var DaemonCdpManager = class {
|
|
|
26901
26902
|
if (!ws || ws.readyState !== import_ws.default.OPEN) {
|
|
26902
26903
|
throw new Error("CDP not connected");
|
|
26903
26904
|
}
|
|
26904
|
-
return new Promise((
|
|
26905
|
+
return new Promise((resolve25, reject) => {
|
|
26905
26906
|
const id = getNextId();
|
|
26906
26907
|
pendingMap.set(id, {
|
|
26907
26908
|
resolve: (result) => {
|
|
26908
26909
|
if (result?.result?.subtype === "error") {
|
|
26909
26910
|
reject(new Error(result.result.description));
|
|
26910
26911
|
} else {
|
|
26911
|
-
|
|
26912
|
+
resolve25(result?.result?.value);
|
|
26912
26913
|
}
|
|
26913
26914
|
},
|
|
26914
26915
|
reject
|
|
@@ -26940,10 +26941,10 @@ var DaemonCdpManager = class {
|
|
|
26940
26941
|
throw new Error("CDP not connected");
|
|
26941
26942
|
}
|
|
26942
26943
|
const sendViaSession = (method, params = {}) => {
|
|
26943
|
-
return new Promise((
|
|
26944
|
+
return new Promise((resolve25, reject) => {
|
|
26944
26945
|
const pendingMap = this._browserConnected ? this.browserPending : this.pending;
|
|
26945
26946
|
const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
|
|
26946
|
-
pendingMap.set(id, { resolve:
|
|
26947
|
+
pendingMap.set(id, { resolve: resolve25, reject });
|
|
26947
26948
|
ws.send(JSON.stringify({ id, sessionId, method, params }));
|
|
26948
26949
|
setTimeout(() => {
|
|
26949
26950
|
if (pendingMap.has(id)) {
|
|
@@ -33173,7 +33174,7 @@ function getSendChatInputEnvelope(args) {
|
|
|
33173
33174
|
return normalizeInputEnvelope(args?.input ? { input: args.input } : args);
|
|
33174
33175
|
}
|
|
33175
33176
|
function sleep(ms) {
|
|
33176
|
-
return new Promise((
|
|
33177
|
+
return new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
33177
33178
|
}
|
|
33178
33179
|
async function waitOnceForFreshHermesCliStart(adapter, log) {
|
|
33179
33180
|
if (adapter.cliType !== "hermes-cli") return;
|
|
@@ -33228,7 +33229,7 @@ function getStateLastSignature(state) {
|
|
|
33228
33229
|
async function getStableExtensionBaseline(h) {
|
|
33229
33230
|
const first = await readExtensionChatState(h);
|
|
33230
33231
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
33231
|
-
await new Promise((
|
|
33232
|
+
await new Promise((resolve25) => setTimeout(resolve25, 150));
|
|
33232
33233
|
const second = await readExtensionChatState(h);
|
|
33233
33234
|
return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
|
|
33234
33235
|
}
|
|
@@ -33236,7 +33237,7 @@ async function verifyExtensionSendObserved(h, before) {
|
|
|
33236
33237
|
const beforeCount = getStateMessageCount(before);
|
|
33237
33238
|
const beforeSignature = getStateLastSignature(before);
|
|
33238
33239
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
33239
|
-
await new Promise((
|
|
33240
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
33240
33241
|
const state = await readExtensionChatState(h);
|
|
33241
33242
|
if (state?.status === "waiting_approval") return true;
|
|
33242
33243
|
const afterCount = getStateMessageCount(state);
|
|
@@ -34638,7 +34639,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
34638
34639
|
const enterCount = cliCommand.enterCount || 1;
|
|
34639
34640
|
await adapter.writeRaw(cliCommand.text + "\r");
|
|
34640
34641
|
for (let i = 1; i < enterCount; i += 1) {
|
|
34641
|
-
await new Promise((
|
|
34642
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
34642
34643
|
await adapter.writeRaw("\r");
|
|
34643
34644
|
}
|
|
34644
34645
|
}
|
|
@@ -35415,9 +35416,9 @@ var DaemonCommandHandler = class {
|
|
|
35415
35416
|
* point at a sibling git checkout.
|
|
35416
35417
|
*/
|
|
35417
35418
|
getUpstreamInstallRoot() {
|
|
35418
|
-
const
|
|
35419
|
-
const
|
|
35420
|
-
return
|
|
35419
|
+
const os31 = require("os");
|
|
35420
|
+
const path44 = require("path");
|
|
35421
|
+
return path44.join(os31.homedir(), ".adhdev", "providers", ".upstream");
|
|
35421
35422
|
}
|
|
35422
35423
|
/**
|
|
35423
35424
|
* Download a single provider manifest from the registry and write it to
|
|
@@ -35441,11 +35442,11 @@ var DaemonCommandHandler = class {
|
|
|
35441
35442
|
return { success: false, error: "invalid type" };
|
|
35442
35443
|
}
|
|
35443
35444
|
const https = require("https");
|
|
35444
|
-
const
|
|
35445
|
-
const
|
|
35445
|
+
const fs39 = require("fs");
|
|
35446
|
+
const path44 = require("path");
|
|
35446
35447
|
const REGISTRY = "https://api.adhf.dev/api/v1/registry";
|
|
35447
35448
|
function fetchText(url, timeoutMs) {
|
|
35448
|
-
return new Promise((
|
|
35449
|
+
return new Promise((resolve25, reject) => {
|
|
35449
35450
|
const req = https.get(url, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: timeoutMs }, (res) => {
|
|
35450
35451
|
if (res.statusCode !== 200) {
|
|
35451
35452
|
reject(new Error(`HTTP ${res.statusCode}`));
|
|
@@ -35453,7 +35454,7 @@ var DaemonCommandHandler = class {
|
|
|
35453
35454
|
}
|
|
35454
35455
|
const chunks = [];
|
|
35455
35456
|
res.on("data", (c) => chunks.push(c));
|
|
35456
|
-
res.on("end", () =>
|
|
35457
|
+
res.on("end", () => resolve25(Buffer.concat(chunks).toString("utf-8")));
|
|
35457
35458
|
});
|
|
35458
35459
|
req.on("error", reject);
|
|
35459
35460
|
req.on("timeout", () => {
|
|
@@ -35479,12 +35480,12 @@ var DaemonCommandHandler = class {
|
|
|
35479
35480
|
return { success: false, error: `checksum mismatch: expected ${meta.checksum}, got ${actualChecksum}` };
|
|
35480
35481
|
}
|
|
35481
35482
|
const installRoot = this.getUpstreamInstallRoot();
|
|
35482
|
-
const installRootResolved =
|
|
35483
|
-
const targetDir =
|
|
35484
|
-
if (!targetDir.startsWith(installRootResolved +
|
|
35483
|
+
const installRootResolved = path44.resolve(installRoot);
|
|
35484
|
+
const targetDir = path44.resolve(path44.join(installRoot, category, type));
|
|
35485
|
+
if (!targetDir.startsWith(installRootResolved + path44.sep)) {
|
|
35485
35486
|
return { success: false, error: "install path escaped upstream root" };
|
|
35486
35487
|
}
|
|
35487
|
-
|
|
35488
|
+
fs39.mkdirSync(targetDir, { recursive: true });
|
|
35488
35489
|
let manifestProbe = {};
|
|
35489
35490
|
try {
|
|
35490
35491
|
manifestProbe = JSON.parse(manifestBody);
|
|
@@ -35508,8 +35509,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35508
35509
|
}
|
|
35509
35510
|
}
|
|
35510
35511
|
const targetFile = isV1 ? "provider.v1.json" : "provider.json";
|
|
35511
|
-
const targetPath =
|
|
35512
|
-
|
|
35512
|
+
const targetPath = path44.join(targetDir, targetFile);
|
|
35513
|
+
fs39.writeFileSync(targetPath, manifestBody, "utf-8");
|
|
35513
35514
|
const manifestJson = JSON.parse(manifestBody);
|
|
35514
35515
|
const scriptFetch = await this.fetchProviderSources(
|
|
35515
35516
|
manifestJson,
|
|
@@ -35579,10 +35580,10 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35579
35580
|
const repo = source.repo;
|
|
35580
35581
|
const ref = source.ref;
|
|
35581
35582
|
const https = require("https");
|
|
35582
|
-
const
|
|
35583
|
-
const
|
|
35583
|
+
const fs39 = require("fs");
|
|
35584
|
+
const path44 = require("path");
|
|
35584
35585
|
function fetchJson(url, timeoutMs) {
|
|
35585
|
-
return new Promise((
|
|
35586
|
+
return new Promise((resolve25, reject) => {
|
|
35586
35587
|
const req = https.get(url, {
|
|
35587
35588
|
headers: { "User-Agent": "adhdev-daemon", "Accept": "application/vnd.github+json" },
|
|
35588
35589
|
timeout: timeoutMs
|
|
@@ -35595,7 +35596,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35595
35596
|
res.on("data", (c) => chunks.push(c));
|
|
35596
35597
|
res.on("end", () => {
|
|
35597
35598
|
try {
|
|
35598
|
-
|
|
35599
|
+
resolve25(JSON.parse(Buffer.concat(chunks).toString("utf-8")));
|
|
35599
35600
|
} catch (e) {
|
|
35600
35601
|
reject(e);
|
|
35601
35602
|
}
|
|
@@ -35609,14 +35610,14 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35609
35610
|
});
|
|
35610
35611
|
}
|
|
35611
35612
|
function fetchBinary(url, timeoutMs) {
|
|
35612
|
-
return new Promise((
|
|
35613
|
+
return new Promise((resolve25, reject) => {
|
|
35613
35614
|
const req = https.get(url, {
|
|
35614
35615
|
headers: { "User-Agent": "adhdev-daemon" },
|
|
35615
35616
|
timeout: timeoutMs
|
|
35616
35617
|
}, (res) => {
|
|
35617
35618
|
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
35618
35619
|
if (res.headers.location) {
|
|
35619
|
-
return fetchBinary(res.headers.location, timeoutMs).then(
|
|
35620
|
+
return fetchBinary(res.headers.location, timeoutMs).then(resolve25, reject);
|
|
35620
35621
|
}
|
|
35621
35622
|
}
|
|
35622
35623
|
if (res.statusCode !== 200) {
|
|
@@ -35625,7 +35626,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35625
35626
|
}
|
|
35626
35627
|
const chunks = [];
|
|
35627
35628
|
res.on("data", (c) => chunks.push(c));
|
|
35628
|
-
res.on("end", () =>
|
|
35629
|
+
res.on("end", () => resolve25(Buffer.concat(chunks)));
|
|
35629
35630
|
});
|
|
35630
35631
|
req.on("error", reject);
|
|
35631
35632
|
req.on("timeout", () => {
|
|
@@ -35636,9 +35637,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35636
35637
|
}
|
|
35637
35638
|
let fetchedCount = 0;
|
|
35638
35639
|
const sharedDirRel = `${category}/_shared`;
|
|
35639
|
-
const sharedTargetDir =
|
|
35640
|
-
const installRootResolved =
|
|
35641
|
-
if (sharedTargetDir.startsWith(installRootResolved +
|
|
35640
|
+
const sharedTargetDir = path44.resolve(path44.join(targetDir, "../_shared"));
|
|
35641
|
+
const installRootResolved = path44.resolve(path44.join(targetDir, "../.."));
|
|
35642
|
+
if (sharedTargetDir.startsWith(installRootResolved + path44.sep)) {
|
|
35642
35643
|
const sharedStack = [sharedDirRel];
|
|
35643
35644
|
while (sharedStack.length) {
|
|
35644
35645
|
const relDir = sharedStack.pop();
|
|
@@ -35661,10 +35662,10 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35661
35662
|
try {
|
|
35662
35663
|
const body = await fetchBinary(entry.download_url, 3e4);
|
|
35663
35664
|
const relInside = entry.path.startsWith(sharedDirRel + "/") ? entry.path.slice(sharedDirRel.length + 1) : entry.path;
|
|
35664
|
-
const outPath =
|
|
35665
|
-
if (!outPath.startsWith(
|
|
35666
|
-
|
|
35667
|
-
|
|
35665
|
+
const outPath = path44.resolve(path44.join(sharedTargetDir, relInside));
|
|
35666
|
+
if (!outPath.startsWith(path44.resolve(sharedTargetDir) + path44.sep)) continue;
|
|
35667
|
+
fs39.mkdirSync(path44.dirname(outPath), { recursive: true });
|
|
35668
|
+
fs39.writeFileSync(outPath, body);
|
|
35668
35669
|
fetchedCount++;
|
|
35669
35670
|
} catch (e) {
|
|
35670
35671
|
errors.push(`fetch shared ${entry.path}: ${e?.message ?? e}`);
|
|
@@ -35697,13 +35698,13 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35697
35698
|
try {
|
|
35698
35699
|
const body = await fetchBinary(entry.download_url, 3e4);
|
|
35699
35700
|
const relInsideProvider = entry.path.startsWith(subdir + "/") ? entry.path.slice(subdir.length + 1) : entry.path;
|
|
35700
|
-
const outPath =
|
|
35701
|
-
if (!outPath.startsWith(
|
|
35701
|
+
const outPath = path44.resolve(path44.join(targetDir, relInsideProvider));
|
|
35702
|
+
if (!outPath.startsWith(path44.resolve(targetDir) + path44.sep)) {
|
|
35702
35703
|
errors.push(`refusing to write outside targetDir: ${entry.path}`);
|
|
35703
35704
|
continue;
|
|
35704
35705
|
}
|
|
35705
|
-
|
|
35706
|
-
|
|
35706
|
+
fs39.mkdirSync(path44.dirname(outPath), { recursive: true });
|
|
35707
|
+
fs39.writeFileSync(outPath, body);
|
|
35707
35708
|
fetchedCount++;
|
|
35708
35709
|
} catch (e) {
|
|
35709
35710
|
errors.push(`fetch ${entry.path}: ${e?.message ?? e}`);
|
|
@@ -35731,19 +35732,19 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35731
35732
|
if (!["cli", "ide", "extension", "acp"].includes(category)) {
|
|
35732
35733
|
return { success: false, error: `unknown category: ${category}` };
|
|
35733
35734
|
}
|
|
35734
|
-
const
|
|
35735
|
-
const
|
|
35735
|
+
const fs39 = require("fs");
|
|
35736
|
+
const path44 = require("path");
|
|
35736
35737
|
try {
|
|
35737
35738
|
const installRoot = this.getUpstreamInstallRoot();
|
|
35738
|
-
const installRootResolved =
|
|
35739
|
-
const targetDir =
|
|
35740
|
-
if (!targetDir.startsWith(installRootResolved +
|
|
35739
|
+
const installRootResolved = path44.resolve(installRoot);
|
|
35740
|
+
const targetDir = path44.resolve(path44.join(installRoot, category, type));
|
|
35741
|
+
if (!targetDir.startsWith(installRootResolved + path44.sep)) {
|
|
35741
35742
|
return { success: false, error: "refusing to delete outside upstream root" };
|
|
35742
35743
|
}
|
|
35743
|
-
if (!
|
|
35744
|
+
if (!fs39.existsSync(targetDir)) {
|
|
35744
35745
|
return { success: false, error: "not installed" };
|
|
35745
35746
|
}
|
|
35746
|
-
|
|
35747
|
+
fs39.rmSync(targetDir, { recursive: true, force: true });
|
|
35747
35748
|
if (this._ctx.providerLoader) {
|
|
35748
35749
|
this._ctx.providerLoader.reload();
|
|
35749
35750
|
this._ctx.providerLoader.registerToDetector();
|
|
@@ -35759,28 +35760,28 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35759
35760
|
* the UI and by the update checker.
|
|
35760
35761
|
*/
|
|
35761
35762
|
handleListInstalledProviders(_args) {
|
|
35762
|
-
const
|
|
35763
|
-
const
|
|
35763
|
+
const fs39 = require("fs");
|
|
35764
|
+
const path44 = require("path");
|
|
35764
35765
|
const installRoot = this.getUpstreamInstallRoot();
|
|
35765
|
-
if (!
|
|
35766
|
+
if (!fs39.existsSync(installRoot)) return { success: true, providers: [] };
|
|
35766
35767
|
const CATEGORIES = ["cli", "ide", "extension", "acp"];
|
|
35767
35768
|
const items = [];
|
|
35768
35769
|
for (const category of CATEGORIES) {
|
|
35769
|
-
const categoryDir =
|
|
35770
|
-
if (!
|
|
35770
|
+
const categoryDir = path44.join(installRoot, category);
|
|
35771
|
+
if (!fs39.existsSync(categoryDir)) continue;
|
|
35771
35772
|
let entries;
|
|
35772
35773
|
try {
|
|
35773
|
-
entries =
|
|
35774
|
+
entries = fs39.readdirSync(categoryDir);
|
|
35774
35775
|
} catch {
|
|
35775
35776
|
continue;
|
|
35776
35777
|
}
|
|
35777
35778
|
for (const type of entries) {
|
|
35778
|
-
const v1Path =
|
|
35779
|
-
const v0Path =
|
|
35780
|
-
const manifestPath =
|
|
35779
|
+
const v1Path = path44.join(categoryDir, type, "provider.v1.json");
|
|
35780
|
+
const v0Path = path44.join(categoryDir, type, "provider.json");
|
|
35781
|
+
const manifestPath = fs39.existsSync(v1Path) ? v1Path : fs39.existsSync(v0Path) ? v0Path : null;
|
|
35781
35782
|
if (!manifestPath) continue;
|
|
35782
35783
|
try {
|
|
35783
|
-
const m = JSON.parse(
|
|
35784
|
+
const m = JSON.parse(fs39.readFileSync(manifestPath, "utf-8"));
|
|
35784
35785
|
items.push({
|
|
35785
35786
|
type,
|
|
35786
35787
|
category,
|
|
@@ -35807,7 +35808,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35807
35808
|
const https = require("https");
|
|
35808
35809
|
const REGISTRY = "https://api.adhf.dev/api/v1/registry";
|
|
35809
35810
|
function fetchJson(url) {
|
|
35810
|
-
return new Promise((
|
|
35811
|
+
return new Promise((resolve25, reject) => {
|
|
35811
35812
|
const req = https.get(url, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: 1e4 }, (res) => {
|
|
35812
35813
|
if (res.statusCode !== 200) {
|
|
35813
35814
|
reject(new Error(`HTTP ${res.statusCode}`));
|
|
@@ -35817,7 +35818,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35817
35818
|
res.on("data", (c) => chunks.push(c));
|
|
35818
35819
|
res.on("end", () => {
|
|
35819
35820
|
try {
|
|
35820
|
-
|
|
35821
|
+
resolve25(JSON.parse(Buffer.concat(chunks).toString("utf-8")));
|
|
35821
35822
|
} catch (e) {
|
|
35822
35823
|
reject(e);
|
|
35823
35824
|
}
|
|
@@ -35891,8 +35892,8 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35891
35892
|
if (!/^@[a-z0-9_-]+$/i.test(requestedName)) {
|
|
35892
35893
|
return { success: false, error: "name must match @[a-z0-9_-]+" };
|
|
35893
35894
|
}
|
|
35894
|
-
const
|
|
35895
|
-
const
|
|
35895
|
+
const fs39 = require("fs");
|
|
35896
|
+
const path44 = require("path");
|
|
35896
35897
|
const { spawnSync: spawnSync2 } = require("child_process");
|
|
35897
35898
|
const file = ext.loadExternalSources();
|
|
35898
35899
|
if (file.sources.some((s2) => s2.name === requestedName)) {
|
|
@@ -35901,9 +35902,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35901
35902
|
if (file.sources.some((s2) => s2.url === url && s2.ref === ref)) {
|
|
35902
35903
|
return { success: false, error: `source url+ref already registered (use a different name to track another ref)` };
|
|
35903
35904
|
}
|
|
35904
|
-
const sourceDir =
|
|
35905
|
-
if (!
|
|
35906
|
-
if (
|
|
35905
|
+
const sourceDir = path44.join(ext.externalRoot(), requestedName);
|
|
35906
|
+
if (!fs39.existsSync(ext.externalRoot())) fs39.mkdirSync(ext.externalRoot(), { recursive: true });
|
|
35907
|
+
if (fs39.existsSync(sourceDir)) {
|
|
35907
35908
|
return { success: false, error: `directory already exists: ${sourceDir} (rename or remove first)` };
|
|
35908
35909
|
}
|
|
35909
35910
|
const clone = spawnSync2("git", ["clone", "--depth=1", "--branch", ref, "--", url, sourceDir], {
|
|
@@ -35913,7 +35914,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35913
35914
|
});
|
|
35914
35915
|
if (clone.status !== 0) {
|
|
35915
35916
|
try {
|
|
35916
|
-
|
|
35917
|
+
fs39.rmSync(sourceDir, { recursive: true, force: true });
|
|
35917
35918
|
} catch {
|
|
35918
35919
|
}
|
|
35919
35920
|
return { success: false, error: `git clone failed: ${(clone.stderr || clone.stdout || "").trim() || "unknown error"}` };
|
|
@@ -35957,15 +35958,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
35957
35958
|
const name = typeof args?.name === "string" ? args.name.trim() : "";
|
|
35958
35959
|
if (!name) return { success: false, error: "name is required" };
|
|
35959
35960
|
const ext = (init_external_sources(), __toCommonJS(external_sources_exports));
|
|
35960
|
-
const
|
|
35961
|
-
const
|
|
35961
|
+
const fs39 = require("fs");
|
|
35962
|
+
const path44 = require("path");
|
|
35962
35963
|
const file = ext.loadExternalSources();
|
|
35963
35964
|
const match = file.sources.find((s2) => s2.name === name);
|
|
35964
35965
|
if (!match) return { success: false, error: `source "${name}" not registered` };
|
|
35965
|
-
const sourceDir =
|
|
35966
|
-
if (
|
|
35966
|
+
const sourceDir = path44.join(ext.externalRoot(), name);
|
|
35967
|
+
if (fs39.existsSync(sourceDir)) {
|
|
35967
35968
|
try {
|
|
35968
|
-
|
|
35969
|
+
fs39.rmSync(sourceDir, { recursive: true, force: true });
|
|
35969
35970
|
} catch (e) {
|
|
35970
35971
|
return { success: false, error: `failed to delete ${sourceDir}: ${e?.message || e}` };
|
|
35971
35972
|
}
|
|
@@ -36055,7 +36056,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
36055
36056
|
try {
|
|
36056
36057
|
const http3 = await import("http");
|
|
36057
36058
|
const postData = JSON.stringify(body);
|
|
36058
|
-
const result = await new Promise((
|
|
36059
|
+
const result = await new Promise((resolve25, reject) => {
|
|
36059
36060
|
const req = http3.request({
|
|
36060
36061
|
hostname: "127.0.0.1",
|
|
36061
36062
|
port: 19280,
|
|
@@ -36067,9 +36068,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
36067
36068
|
res.on("data", (chunk) => data += chunk);
|
|
36068
36069
|
res.on("end", () => {
|
|
36069
36070
|
try {
|
|
36070
|
-
|
|
36071
|
+
resolve25(JSON.parse(data));
|
|
36071
36072
|
} catch {
|
|
36072
|
-
|
|
36073
|
+
resolve25({ raw: data });
|
|
36073
36074
|
}
|
|
36074
36075
|
});
|
|
36075
36076
|
});
|
|
@@ -36087,15 +36088,15 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
36087
36088
|
if (!providerType) return { success: false, error: "providerType required" };
|
|
36088
36089
|
try {
|
|
36089
36090
|
const http3 = await import("http");
|
|
36090
|
-
const result = await new Promise((
|
|
36091
|
+
const result = await new Promise((resolve25, reject) => {
|
|
36091
36092
|
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
36092
36093
|
let data = "";
|
|
36093
36094
|
res.on("data", (chunk) => data += chunk);
|
|
36094
36095
|
res.on("end", () => {
|
|
36095
36096
|
try {
|
|
36096
|
-
|
|
36097
|
+
resolve25(JSON.parse(data));
|
|
36097
36098
|
} catch {
|
|
36098
|
-
|
|
36099
|
+
resolve25({ raw: data });
|
|
36099
36100
|
}
|
|
36100
36101
|
});
|
|
36101
36102
|
}).on("error", reject);
|
|
@@ -36109,7 +36110,7 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
36109
36110
|
try {
|
|
36110
36111
|
const http3 = await import("http");
|
|
36111
36112
|
const postData = JSON.stringify(args || {});
|
|
36112
|
-
const result = await new Promise((
|
|
36113
|
+
const result = await new Promise((resolve25, reject) => {
|
|
36113
36114
|
const req = http3.request({
|
|
36114
36115
|
hostname: "127.0.0.1",
|
|
36115
36116
|
port: 19280,
|
|
@@ -36121,9 +36122,9 @@ ${formatManifestValidationIssues2(validation.issues)}`,
|
|
|
36121
36122
|
res.on("data", (chunk) => data += chunk);
|
|
36122
36123
|
res.on("end", () => {
|
|
36123
36124
|
try {
|
|
36124
|
-
|
|
36125
|
+
resolve25(JSON.parse(data));
|
|
36125
36126
|
} catch {
|
|
36126
|
-
|
|
36127
|
+
resolve25({ raw: data });
|
|
36127
36128
|
}
|
|
36128
36129
|
});
|
|
36129
36130
|
});
|
|
@@ -36748,24 +36749,24 @@ var statusMetaHandlers = {
|
|
|
36748
36749
|
// src/commands/low-family/coordinator-prompt.ts
|
|
36749
36750
|
var coordinatorPromptHandlers = {
|
|
36750
36751
|
list_coordinator_prompts: async (_ctx, _args) => {
|
|
36751
|
-
const
|
|
36752
|
-
const
|
|
36753
|
-
const
|
|
36754
|
-
const dir =
|
|
36752
|
+
const fs39 = await import("fs");
|
|
36753
|
+
const path44 = await import("path");
|
|
36754
|
+
const os31 = await import("os");
|
|
36755
|
+
const dir = path44.join(os31.homedir(), ".adhdev", "coordinator-prompts");
|
|
36755
36756
|
const entries = {};
|
|
36756
36757
|
try {
|
|
36757
|
-
if (
|
|
36758
|
-
for (const name of
|
|
36758
|
+
if (fs39.existsSync(dir)) {
|
|
36759
|
+
for (const name of fs39.readdirSync(dir)) {
|
|
36759
36760
|
const matchOverride = name.match(/^([a-zA-Z0-9_.-]+)\.md$/);
|
|
36760
36761
|
const matchAppend = name.match(/^([a-zA-Z0-9_.-]+)\.append\.md$/);
|
|
36761
36762
|
const m = matchAppend || matchOverride;
|
|
36762
36763
|
if (!m) continue;
|
|
36763
36764
|
const isAppend = !!matchAppend;
|
|
36764
36765
|
const key2 = m[1];
|
|
36765
|
-
const full =
|
|
36766
|
+
const full = path44.join(dir, name);
|
|
36766
36767
|
let content = "";
|
|
36767
36768
|
try {
|
|
36768
|
-
content =
|
|
36769
|
+
content = fs39.readFileSync(full, "utf8");
|
|
36769
36770
|
} catch {
|
|
36770
36771
|
}
|
|
36771
36772
|
if (!entries[key2]) entries[key2] = { override: "", append: "" };
|
|
@@ -36779,24 +36780,24 @@ var coordinatorPromptHandlers = {
|
|
|
36779
36780
|
return { success: true, dir, entries };
|
|
36780
36781
|
},
|
|
36781
36782
|
write_coordinator_prompt: async (_ctx, args) => {
|
|
36782
|
-
const
|
|
36783
|
-
const
|
|
36784
|
-
const
|
|
36783
|
+
const fs39 = await import("fs");
|
|
36784
|
+
const path44 = await import("path");
|
|
36785
|
+
const os31 = await import("os");
|
|
36785
36786
|
const key2 = typeof args?.key === "string" ? args.key.trim() : "";
|
|
36786
36787
|
const kind = args?.kind === "append" ? "append" : "override";
|
|
36787
36788
|
const content = typeof args?.content === "string" ? args.content : "";
|
|
36788
36789
|
if (!key2 || !/^[a-zA-Z0-9_.-]+$/.test(key2)) {
|
|
36789
36790
|
return { success: false, error: "key must match [a-zA-Z0-9_.-]+" };
|
|
36790
36791
|
}
|
|
36791
|
-
const dir =
|
|
36792
|
+
const dir = path44.join(os31.homedir(), ".adhdev", "coordinator-prompts");
|
|
36792
36793
|
const filename = kind === "append" ? `${key2}.append.md` : `${key2}.md`;
|
|
36793
|
-
const full =
|
|
36794
|
+
const full = path44.join(dir, filename);
|
|
36794
36795
|
try {
|
|
36795
|
-
|
|
36796
|
+
fs39.mkdirSync(dir, { recursive: true });
|
|
36796
36797
|
if (content.trim()) {
|
|
36797
|
-
|
|
36798
|
-
} else if (
|
|
36799
|
-
|
|
36798
|
+
fs39.writeFileSync(full, content, { encoding: "utf8", mode: 384 });
|
|
36799
|
+
} else if (fs39.existsSync(full)) {
|
|
36800
|
+
fs39.unlinkSync(full);
|
|
36800
36801
|
}
|
|
36801
36802
|
return { success: true, path: full, kind, key: key2 };
|
|
36802
36803
|
} catch (error) {
|
|
@@ -37113,7 +37114,7 @@ async function waitForPidExit(pid, timeoutMs) {
|
|
|
37113
37114
|
while (Date.now() - start < timeoutMs) {
|
|
37114
37115
|
try {
|
|
37115
37116
|
process.kill(pid, 0);
|
|
37116
|
-
await new Promise((
|
|
37117
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
37117
37118
|
} catch {
|
|
37118
37119
|
return;
|
|
37119
37120
|
}
|
|
@@ -37339,7 +37340,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
37339
37340
|
appendUpgradeLog(`Install attempt ${attempt} hit a file lock (${error?.code || "lock"}); clearing holders + staging and retrying after backoff`);
|
|
37340
37341
|
await stopForeignNativeAddonHolders(installCommand.surface.packageRoot, { parentPid: payload.parentPid });
|
|
37341
37342
|
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
37342
|
-
await new Promise((
|
|
37343
|
+
await new Promise((resolve25) => setTimeout(resolve25, attempt * 1500));
|
|
37343
37344
|
continue;
|
|
37344
37345
|
}
|
|
37345
37346
|
if (isRetriableInstallLockError(error)) {
|
|
@@ -37367,7 +37368,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
37367
37368
|
appendUpgradeLog(installOutput.trim());
|
|
37368
37369
|
}
|
|
37369
37370
|
if (process.platform === "win32") {
|
|
37370
|
-
await new Promise((
|
|
37371
|
+
await new Promise((resolve25) => setTimeout(resolve25, 500));
|
|
37371
37372
|
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
37372
37373
|
appendUpgradeLog("Post-install staging cleanup complete");
|
|
37373
37374
|
}
|
|
@@ -40015,7 +40016,7 @@ function stripAnsi3(text) {
|
|
|
40015
40016
|
return String(text || "").replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, "").replace(/\x1B[P^_X][\s\S]*?(?:\x07|\x1B\\)/g, "").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "");
|
|
40016
40017
|
}
|
|
40017
40018
|
function delay(ms) {
|
|
40018
|
-
return new Promise((
|
|
40019
|
+
return new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
40019
40020
|
}
|
|
40020
40021
|
var SpecCliAdapter = class _SpecCliAdapter {
|
|
40021
40022
|
cliType;
|
|
@@ -40214,7 +40215,7 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
40214
40215
|
const steps = buildClaudeInteractiveTuiAnswerSteps(prompt, response);
|
|
40215
40216
|
for (const step of steps) {
|
|
40216
40217
|
this.driver.dispatch({ kind: "pty_write", data: step });
|
|
40217
|
-
await new Promise((
|
|
40218
|
+
await new Promise((resolve25) => setTimeout(resolve25, 180));
|
|
40218
40219
|
}
|
|
40219
40220
|
} else {
|
|
40220
40221
|
this.driver.dispatch({ kind: "pty_write", data: `${buildClaudeInteractiveToolResult(response)}
|
|
@@ -40765,7 +40766,7 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
40765
40766
|
let screenText = this.driver.snapshot();
|
|
40766
40767
|
const deadline = Date.now() + _SpecCliAdapter.CLAUDE_TUI_PAGE_SETTLE_TIMEOUT_MS;
|
|
40767
40768
|
while (!detectClaudeTuiMultiSelect(screenText) && Date.now() < deadline) {
|
|
40768
|
-
await new Promise((
|
|
40769
|
+
await new Promise((resolve25) => setTimeout(resolve25, _SpecCliAdapter.CLAUDE_TUI_PAGE_POLL_INTERVAL_MS));
|
|
40769
40770
|
screenText = this.driver.snapshot();
|
|
40770
40771
|
}
|
|
40771
40772
|
return screenText;
|
|
@@ -40774,12 +40775,12 @@ var SpecCliAdapter = class _SpecCliAdapter {
|
|
|
40774
40775
|
const pages = [{ screenText: firstScreen, header: headers[0] }];
|
|
40775
40776
|
for (let index = 1; index < headers.length; index += 1) {
|
|
40776
40777
|
this.driver.dispatch({ kind: "pty_write", data: " " });
|
|
40777
|
-
await new Promise((
|
|
40778
|
+
await new Promise((resolve25) => setTimeout(resolve25, _SpecCliAdapter.CLAUDE_TUI_PAGE_POLL_INTERVAL_MS));
|
|
40778
40779
|
pages.push({ screenText: await this.snapshotSettledClaudeTuiPage(), header: headers[index] });
|
|
40779
40780
|
}
|
|
40780
40781
|
for (let index = headers.length - 1; index > 0; index -= 1) {
|
|
40781
40782
|
this.driver.dispatch({ kind: "pty_write", data: "\x1B[Z" });
|
|
40782
|
-
await new Promise((
|
|
40783
|
+
await new Promise((resolve25) => setTimeout(resolve25, _SpecCliAdapter.CLAUDE_TUI_PAGE_POLL_INTERVAL_MS));
|
|
40783
40784
|
const reread = await this.snapshotSettledClaudeTuiPage();
|
|
40784
40785
|
const landed = pages[index - 1];
|
|
40785
40786
|
if (landed && !detectClaudeTuiMultiSelect(landed.screenText) && detectClaudeTuiMultiSelect(reread)) {
|
|
@@ -41134,7 +41135,7 @@ async function waitForCliAdapterReady(adapter, options) {
|
|
|
41134
41135
|
if (status === "stopped") {
|
|
41135
41136
|
throw new Error("CLI runtime stopped before it became ready");
|
|
41136
41137
|
}
|
|
41137
|
-
await new Promise((
|
|
41138
|
+
await new Promise((resolve25) => setTimeout(resolve25, pollMs));
|
|
41138
41139
|
}
|
|
41139
41140
|
throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
|
|
41140
41141
|
}
|
|
@@ -41883,7 +41884,7 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
41883
41884
|
const enterCount = cliCommand.enterCount || 1;
|
|
41884
41885
|
await this.adapter.writeRaw(cliCommand.text + "\r");
|
|
41885
41886
|
for (let i = 1; i < enterCount; i += 1) {
|
|
41886
|
-
await new Promise((
|
|
41887
|
+
await new Promise((resolve25) => setTimeout(resolve25, 50));
|
|
41887
41888
|
await this.adapter.writeRaw("\r");
|
|
41888
41889
|
}
|
|
41889
41890
|
}
|
|
@@ -43957,13 +43958,13 @@ var AcpProviderInstance = class {
|
|
|
43957
43958
|
}
|
|
43958
43959
|
this.currentStatus = "waiting_approval";
|
|
43959
43960
|
this.detectStatusTransition();
|
|
43960
|
-
const approved = await new Promise((
|
|
43961
|
-
this.permissionResolvers.push(
|
|
43961
|
+
const approved = await new Promise((resolve25) => {
|
|
43962
|
+
this.permissionResolvers.push(resolve25);
|
|
43962
43963
|
setTimeout(() => {
|
|
43963
|
-
const idx = this.permissionResolvers.indexOf(
|
|
43964
|
+
const idx = this.permissionResolvers.indexOf(resolve25);
|
|
43964
43965
|
if (idx >= 0) {
|
|
43965
43966
|
this.permissionResolvers.splice(idx, 1);
|
|
43966
|
-
|
|
43967
|
+
resolve25(false);
|
|
43967
43968
|
}
|
|
43968
43969
|
}, 3e5);
|
|
43969
43970
|
});
|
|
@@ -44699,7 +44700,7 @@ async function waitForZeroMessageStartingLaunch(adapter) {
|
|
|
44699
44700
|
} catch {
|
|
44700
44701
|
return false;
|
|
44701
44702
|
}
|
|
44702
|
-
await new Promise((
|
|
44703
|
+
await new Promise((resolve25) => setTimeout(resolve25, ZERO_MESSAGE_STARTING_SEND_WAIT_MS));
|
|
44703
44704
|
try {
|
|
44704
44705
|
return hasZeroMessageStartingLaunch(adapter);
|
|
44705
44706
|
} catch {
|
|
@@ -46040,9 +46041,9 @@ function validateProviderDefinition(raw) {
|
|
|
46040
46041
|
const typedProvider = provider;
|
|
46041
46042
|
const controls = Array.isArray(provider.controls) ? provider.controls : [];
|
|
46042
46043
|
if (category === "cli" || category === "acp") {
|
|
46043
|
-
const
|
|
46044
|
-
const command =
|
|
46045
|
-
if (!
|
|
46044
|
+
const spawn5 = provider.spawn;
|
|
46045
|
+
const command = spawn5 && typeof spawn5 === "object" ? spawn5.command : void 0;
|
|
46046
|
+
if (!spawn5 || typeof spawn5 !== "object") {
|
|
46046
46047
|
errors.push(`${String(category).toUpperCase()}/CLI providers must have spawn config`);
|
|
46047
46048
|
} else if (typeof command !== "string" || !command.trim()) {
|
|
46048
46049
|
errors.push("spawn.command is required");
|
|
@@ -48563,25 +48564,25 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48563
48564
|
}
|
|
48564
48565
|
if (providerDir) {
|
|
48565
48566
|
try {
|
|
48566
|
-
const
|
|
48567
|
-
const
|
|
48567
|
+
const fs39 = require("fs");
|
|
48568
|
+
const path44 = require("path");
|
|
48568
48569
|
const candidates = [];
|
|
48569
48570
|
if (Array.isArray(base.compatibility)) {
|
|
48570
48571
|
for (const entry of base.compatibility) {
|
|
48571
48572
|
if (typeof entry?.spec !== "string") continue;
|
|
48572
48573
|
const matches = !entry.ideVersion || currentVersion && this.matchesVersion(currentVersion, entry.ideVersion) || !currentVersion;
|
|
48573
|
-
if (matches) candidates.push(
|
|
48574
|
+
if (matches) candidates.push(path44.join(providerDir, entry.spec));
|
|
48574
48575
|
}
|
|
48575
48576
|
}
|
|
48576
|
-
candidates.push(
|
|
48577
|
-
candidates.push(
|
|
48578
|
-
const specPath = candidates.find((p) =>
|
|
48577
|
+
candidates.push(path44.join(providerDir, "specs", "default.json"));
|
|
48578
|
+
candidates.push(path44.join(providerDir, "spec.json"));
|
|
48579
|
+
const specPath = candidates.find((p) => fs39.existsSync(p));
|
|
48579
48580
|
if (specPath) {
|
|
48580
48581
|
resolved._resolvedSpecPath = specPath;
|
|
48581
48582
|
let specControls;
|
|
48582
48583
|
let nh;
|
|
48583
48584
|
try {
|
|
48584
|
-
const rawSpec = JSON.parse(
|
|
48585
|
+
const rawSpec = JSON.parse(fs39.readFileSync(specPath, "utf8"));
|
|
48585
48586
|
specControls = rawSpec.control_bar;
|
|
48586
48587
|
nh = rawSpec.native_history;
|
|
48587
48588
|
} catch {
|
|
@@ -48612,10 +48613,10 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48612
48613
|
format = `spec-${nh.source.kind}`;
|
|
48613
48614
|
reader = (input) => executeNativeHistory(nh, input);
|
|
48614
48615
|
} else if (nh.override_path) {
|
|
48615
|
-
const overrideFile =
|
|
48616
|
-
if (
|
|
48616
|
+
const overrideFile = path44.resolve(providerDir, nh.override_path);
|
|
48617
|
+
if (fs39.existsSync(overrideFile)) {
|
|
48617
48618
|
try {
|
|
48618
|
-
registerProviderScriptRootSafely(
|
|
48619
|
+
registerProviderScriptRootSafely(path44.dirname(path44.dirname(providerDir)));
|
|
48619
48620
|
delete require.cache[require.resolve(overrideFile)];
|
|
48620
48621
|
const mod = require(overrideFile);
|
|
48621
48622
|
const fn = typeof mod === "function" ? mod : mod && typeof mod.default === "function" ? mod.default : null;
|
|
@@ -48789,7 +48790,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48789
48790
|
}
|
|
48790
48791
|
try {
|
|
48791
48792
|
const listUrl = `${_ProviderLoader.REGISTRY_BASE_URL}/providers`;
|
|
48792
|
-
const listBody = await new Promise((
|
|
48793
|
+
const listBody = await new Promise((resolve25, reject) => {
|
|
48793
48794
|
const req = https.get(listUrl, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: 1e4 }, (res) => {
|
|
48794
48795
|
if (res.statusCode !== 200) {
|
|
48795
48796
|
reject(new Error(`registry list HTTP ${res.statusCode}`));
|
|
@@ -48797,7 +48798,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48797
48798
|
}
|
|
48798
48799
|
const chunks = [];
|
|
48799
48800
|
res.on("data", (c) => chunks.push(c));
|
|
48800
|
-
res.on("end", () =>
|
|
48801
|
+
res.on("end", () => resolve25(Buffer.concat(chunks).toString("utf-8")));
|
|
48801
48802
|
});
|
|
48802
48803
|
req.on("error", reject);
|
|
48803
48804
|
req.on("timeout", () => {
|
|
@@ -48813,7 +48814,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48813
48814
|
const cacheKey = `${category}/${type}`;
|
|
48814
48815
|
if (cachedChecksums[cacheKey] === checksum) continue;
|
|
48815
48816
|
const dlUrl = `${_ProviderLoader.REGISTRY_BASE_URL}/providers/${type}/${version}/download`;
|
|
48816
|
-
const manifestBody = await new Promise((
|
|
48817
|
+
const manifestBody = await new Promise((resolve25, reject) => {
|
|
48817
48818
|
const req = https.get(dlUrl, { headers: { "User-Agent": "adhdev-daemon", "Accept": "application/json" }, timeout: 3e4 }, (res) => {
|
|
48818
48819
|
if (res.statusCode !== 200) {
|
|
48819
48820
|
reject(new Error(`registry download HTTP ${res.statusCode} for ${type}@${version}`));
|
|
@@ -48821,7 +48822,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48821
48822
|
}
|
|
48822
48823
|
const chunks = [];
|
|
48823
48824
|
res.on("data", (c) => chunks.push(c));
|
|
48824
|
-
res.on("end", () =>
|
|
48825
|
+
res.on("end", () => resolve25(Buffer.concat(chunks).toString("utf-8")));
|
|
48825
48826
|
});
|
|
48826
48827
|
req.on("error", reject);
|
|
48827
48828
|
req.on("timeout", () => {
|
|
@@ -48880,7 +48881,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48880
48881
|
return { updated: false };
|
|
48881
48882
|
}
|
|
48882
48883
|
try {
|
|
48883
|
-
const etag = await new Promise((
|
|
48884
|
+
const etag = await new Promise((resolve25, reject) => {
|
|
48884
48885
|
const options = {
|
|
48885
48886
|
method: "HEAD",
|
|
48886
48887
|
hostname: "github.com",
|
|
@@ -48898,7 +48899,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48898
48899
|
headers: { "User-Agent": "adhdev-launcher" },
|
|
48899
48900
|
timeout: 1e4
|
|
48900
48901
|
}, (res2) => {
|
|
48901
|
-
|
|
48902
|
+
resolve25(res2.headers.etag || res2.headers["last-modified"] || "");
|
|
48902
48903
|
});
|
|
48903
48904
|
req2.on("error", reject);
|
|
48904
48905
|
req2.on("timeout", () => {
|
|
@@ -48907,7 +48908,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48907
48908
|
});
|
|
48908
48909
|
req2.end();
|
|
48909
48910
|
} else {
|
|
48910
|
-
|
|
48911
|
+
resolve25(res.headers.etag || res.headers["last-modified"] || "");
|
|
48911
48912
|
}
|
|
48912
48913
|
});
|
|
48913
48914
|
req.on("error", reject);
|
|
@@ -48971,7 +48972,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48971
48972
|
downloadFile(url, destPath) {
|
|
48972
48973
|
const https = require("https");
|
|
48973
48974
|
const http3 = require("http");
|
|
48974
|
-
return new Promise((
|
|
48975
|
+
return new Promise((resolve25, reject) => {
|
|
48975
48976
|
const doRequest = (reqUrl, redirectCount = 0) => {
|
|
48976
48977
|
if (redirectCount > 5) {
|
|
48977
48978
|
reject(new Error("Too many redirects"));
|
|
@@ -48991,7 +48992,7 @@ var ProviderLoader = class _ProviderLoader {
|
|
|
48991
48992
|
res.pipe(ws);
|
|
48992
48993
|
ws.on("finish", () => {
|
|
48993
48994
|
ws.close();
|
|
48994
|
-
|
|
48995
|
+
resolve25();
|
|
48995
48996
|
});
|
|
48996
48997
|
ws.on("error", reject);
|
|
48997
48998
|
});
|
|
@@ -49547,10 +49548,10 @@ function findMacAppProcessPids(psOutput, appPaths) {
|
|
|
49547
49548
|
|
|
49548
49549
|
// src/launch.ts
|
|
49549
49550
|
async function execQuiet(command, options = {}) {
|
|
49550
|
-
return new Promise((
|
|
49551
|
+
return new Promise((resolve25) => {
|
|
49551
49552
|
(0, import_child_process9.exec)(command, options, (error, stdout) => {
|
|
49552
|
-
if (error) return
|
|
49553
|
-
|
|
49553
|
+
if (error) return resolve25("");
|
|
49554
|
+
resolve25(stdout.toString());
|
|
49554
49555
|
});
|
|
49555
49556
|
});
|
|
49556
49557
|
}
|
|
@@ -49631,17 +49632,17 @@ async function findFreePort(ports) {
|
|
|
49631
49632
|
throw new Error("No free port found");
|
|
49632
49633
|
}
|
|
49633
49634
|
function checkPortFree(port) {
|
|
49634
|
-
return new Promise((
|
|
49635
|
+
return new Promise((resolve25) => {
|
|
49635
49636
|
const server = net.createServer();
|
|
49636
49637
|
server.unref();
|
|
49637
|
-
server.on("error", () =>
|
|
49638
|
+
server.on("error", () => resolve25(false));
|
|
49638
49639
|
server.listen(port, "127.0.0.1", () => {
|
|
49639
|
-
server.close(() =>
|
|
49640
|
+
server.close(() => resolve25(true));
|
|
49640
49641
|
});
|
|
49641
49642
|
});
|
|
49642
49643
|
}
|
|
49643
49644
|
async function isCdpActive(port) {
|
|
49644
|
-
return new Promise((
|
|
49645
|
+
return new Promise((resolve25) => {
|
|
49645
49646
|
const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
49646
49647
|
timeout: 2e3
|
|
49647
49648
|
}, (res) => {
|
|
@@ -49650,16 +49651,16 @@ async function isCdpActive(port) {
|
|
|
49650
49651
|
res.on("end", () => {
|
|
49651
49652
|
try {
|
|
49652
49653
|
const info = JSON.parse(data);
|
|
49653
|
-
|
|
49654
|
+
resolve25(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
49654
49655
|
} catch {
|
|
49655
|
-
|
|
49656
|
+
resolve25(false);
|
|
49656
49657
|
}
|
|
49657
49658
|
});
|
|
49658
49659
|
});
|
|
49659
|
-
req.on("error", () =>
|
|
49660
|
+
req.on("error", () => resolve25(false));
|
|
49660
49661
|
req.on("timeout", () => {
|
|
49661
49662
|
req.destroy();
|
|
49662
|
-
|
|
49663
|
+
resolve25(false);
|
|
49663
49664
|
});
|
|
49664
49665
|
});
|
|
49665
49666
|
}
|
|
@@ -49795,7 +49796,7 @@ async function detectCurrentWorkspace(ideId) {
|
|
|
49795
49796
|
}
|
|
49796
49797
|
} else if (plat === "win32") {
|
|
49797
49798
|
try {
|
|
49798
|
-
const
|
|
49799
|
+
const fs39 = require("fs");
|
|
49799
49800
|
const appNameMap = getMacAppIdentifiers();
|
|
49800
49801
|
const appName = appNameMap[ideId];
|
|
49801
49802
|
if (appName) {
|
|
@@ -49804,8 +49805,8 @@ async function detectCurrentWorkspace(ideId) {
|
|
|
49804
49805
|
appName,
|
|
49805
49806
|
"storage.json"
|
|
49806
49807
|
);
|
|
49807
|
-
if (
|
|
49808
|
-
const data = JSON.parse(
|
|
49808
|
+
if (fs39.existsSync(storagePath)) {
|
|
49809
|
+
const data = JSON.parse(fs39.readFileSync(storagePath, "utf-8"));
|
|
49809
49810
|
const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
|
|
49810
49811
|
if (workspaces.length > 0) {
|
|
49811
49812
|
const recent = workspaces[0];
|
|
@@ -50283,12 +50284,12 @@ var meshCrudHandlers = {
|
|
|
50283
50284
|
normalizeRepoMeshDeclarativeConfig: normalizeRepoMeshDeclarativeConfig2,
|
|
50284
50285
|
MESH_JSON_CONFIG_LOCATIONS: MESH_JSON_CONFIG_LOCATIONS2
|
|
50285
50286
|
} = await Promise.resolve().then(() => (init_mesh_json_config(), mesh_json_config_exports));
|
|
50286
|
-
const { mkdirSync:
|
|
50287
|
-
const { dirname: dirname17, join:
|
|
50287
|
+
const { mkdirSync: mkdirSync22, writeFileSync: writeFileSync24 } = await import("fs");
|
|
50288
|
+
const { dirname: dirname17, join: join50 } = await import("path");
|
|
50288
50289
|
const scaffold = buildMeshJsonConfigScaffold2(mesh);
|
|
50289
50290
|
const scaffoldJson = serializeMeshJsonConfigScaffold2(scaffold);
|
|
50290
50291
|
const relativePath = MESH_JSON_CONFIG_LOCATIONS2[0];
|
|
50291
|
-
const absolutePath =
|
|
50292
|
+
const absolutePath = join50(workspace, relativePath);
|
|
50292
50293
|
const validation = normalizeRepoMeshDeclarativeConfig2(scaffold);
|
|
50293
50294
|
if (!validation.valid) {
|
|
50294
50295
|
return { success: false, meshId, error: `invalid mesh.json scaffold: ${validation.errors.join("; ")}` };
|
|
@@ -50324,7 +50325,7 @@ var meshCrudHandlers = {
|
|
|
50324
50325
|
note: "Dry-run: nothing written. Re-run with write=true to persist to the repo (commit target). meshes.json is untouched."
|
|
50325
50326
|
};
|
|
50326
50327
|
}
|
|
50327
|
-
|
|
50328
|
+
mkdirSync22(dirname17(absolutePath), { recursive: true });
|
|
50328
50329
|
writeFileSync24(absolutePath, `${scaffoldJson}
|
|
50329
50330
|
`, "utf-8");
|
|
50330
50331
|
return {
|
|
@@ -50888,7 +50889,7 @@ var meshCrudHandlers = {
|
|
|
50888
50889
|
const setupPromise = finishWorktreeSetup();
|
|
50889
50890
|
const setupResult = await Promise.race([
|
|
50890
50891
|
setupPromise.then((value) => ({ completed: true, value })),
|
|
50891
|
-
new Promise((
|
|
50892
|
+
new Promise((resolve25) => setTimeout(() => resolve25({ completed: false }), setupWaitMs))
|
|
50892
50893
|
]);
|
|
50893
50894
|
const emitBootstrapEvent = (eventStatus2, bootstrapState2, startedAtMs, extraPayload) => {
|
|
50894
50895
|
try {
|
|
@@ -52125,7 +52126,7 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
52125
52126
|
workspace
|
|
52126
52127
|
};
|
|
52127
52128
|
}
|
|
52128
|
-
const { existsSync:
|
|
52129
|
+
const { existsSync: existsSync54, readFileSync: readFileSync42, writeFileSync: writeFileSync24, copyFileSync: copyFileSync4, mkdirSync: mkdirSync22 } = await import("fs");
|
|
52129
52130
|
const { dirname: dirname17 } = await import("path");
|
|
52130
52131
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
52131
52132
|
const hermesManualFallback = cliType === "hermes-cli" && configFormat === "hermes_config_yaml" ? createHermesManualMeshCoordinatorSetup(meshId, workspace) : null;
|
|
@@ -52161,21 +52162,21 @@ ${ptyResult.output.slice(-2e3)}`);
|
|
|
52161
52162
|
};
|
|
52162
52163
|
}
|
|
52163
52164
|
try {
|
|
52164
|
-
|
|
52165
|
+
mkdirSync22(dirname17(mcpConfigPath), { recursive: true });
|
|
52165
52166
|
} catch (error) {
|
|
52166
52167
|
const message = `Could not prepare MCP config path for automatic setup: ${error?.message || error}`;
|
|
52167
52168
|
LOG.error("MeshCoordinator", message);
|
|
52168
52169
|
if (hermesManualFallback) return returnManualFallback(message);
|
|
52169
52170
|
return { success: false, code: "mesh_coordinator_config_write_failed", error: message, meshId, cliType, workspace };
|
|
52170
52171
|
}
|
|
52171
|
-
const hadExistingMcpConfig =
|
|
52172
|
+
const hadExistingMcpConfig = existsSync54(mcpConfigPath);
|
|
52172
52173
|
let existingMcpConfig = hermesBaseConfig?.config || {};
|
|
52173
52174
|
if (hermesBaseConfig) {
|
|
52174
52175
|
copyHermesCoordinatorCredentialFiles(hermesBaseConfig.sourceHome, dirname17(mcpConfigPath));
|
|
52175
52176
|
}
|
|
52176
52177
|
if (hadExistingMcpConfig) {
|
|
52177
52178
|
try {
|
|
52178
|
-
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(
|
|
52179
|
+
const parsedExistingMcpConfig = parseMeshCoordinatorMcpConfig(readFileSync42(mcpConfigPath, "utf-8"), configFormat);
|
|
52179
52180
|
const existingCoordinatorConfig = hermesManualFallback ? stripHermesCoordinatorTempModelProviderOverrides(parsedExistingMcpConfig) : parsedExistingMcpConfig;
|
|
52180
52181
|
existingMcpConfig = { ...existingMcpConfig, ...existingCoordinatorConfig };
|
|
52181
52182
|
copyFileSync4(mcpConfigPath, mcpConfigPath + ".backup");
|
|
@@ -52319,10 +52320,10 @@ function runGit2(repoRoot, args) {
|
|
|
52319
52320
|
}
|
|
52320
52321
|
}
|
|
52321
52322
|
function readRecord6(repoRoot) {
|
|
52322
|
-
const
|
|
52323
|
-
if (!(0, import_node_fs4.existsSync)(
|
|
52323
|
+
const path44 = (0, import_node_path2.resolve)(repoRoot, PREVIEW_DEPLOY_RECORD);
|
|
52324
|
+
if (!(0, import_node_fs4.existsSync)(path44)) return null;
|
|
52324
52325
|
try {
|
|
52325
|
-
const parsed = JSON.parse((0, import_node_fs4.readFileSync)(
|
|
52326
|
+
const parsed = JSON.parse((0, import_node_fs4.readFileSync)(path44, "utf8"));
|
|
52326
52327
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
52327
52328
|
} catch {
|
|
52328
52329
|
return null;
|
|
@@ -52877,7 +52878,7 @@ var meshStatusHandlers = {
|
|
|
52877
52878
|
const { deriveMeshReviewInboxItems: deriveMeshReviewInboxItems2 } = await Promise.resolve().then(() => (init_mesh_review_inbox(), mesh_review_inbox_exports));
|
|
52878
52879
|
const { readLedgerEntries: readLedgerEntries2 } = await Promise.resolve().then(() => (init_mesh_ledger(), mesh_ledger_exports));
|
|
52879
52880
|
const { getGitDiffSummary: getGitDiffSummary2 } = await Promise.resolve().then(() => (init_git_diff(), git_diff_exports));
|
|
52880
|
-
const { existsSync:
|
|
52881
|
+
const { existsSync: existsSync54 } = await import("fs");
|
|
52881
52882
|
const meshRecord = await ctx.getMeshForCommand(meshId, args?.inlineMesh, { preferInline: true });
|
|
52882
52883
|
const mesh = meshRecord?.mesh;
|
|
52883
52884
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
@@ -52896,7 +52897,7 @@ var meshStatusHandlers = {
|
|
|
52896
52897
|
const derivation = deriveMeshReviewInboxItems2({ nodes: nodeStatuses, ledgerEntries });
|
|
52897
52898
|
for (const item of derivation.items) {
|
|
52898
52899
|
const workspace = item.workspace;
|
|
52899
|
-
if (!workspace || !
|
|
52900
|
+
if (!workspace || !existsSync54(workspace)) continue;
|
|
52900
52901
|
const baseRef = item.defaultBranch ? `origin/${item.defaultBranch}` : "origin/main";
|
|
52901
52902
|
try {
|
|
52902
52903
|
const diffResult = await getGitDiffSummary2(workspace, { baseRef, maxFiles: 100 });
|
|
@@ -53104,9 +53105,9 @@ init_resolve_executable();
|
|
|
53104
53105
|
var execFileAsync3 = (0, import_node_util4.promisify)(import_node_child_process5.execFile);
|
|
53105
53106
|
var GIT = process.platform === "win32" ? resolveWin32Executable("git") : "git";
|
|
53106
53107
|
var MAX_CHANGED_FILES2 = 500;
|
|
53107
|
-
function topLevel(
|
|
53108
|
-
const slash =
|
|
53109
|
-
return slash === -1 ?
|
|
53108
|
+
function topLevel(path44) {
|
|
53109
|
+
const slash = path44.indexOf("/");
|
|
53110
|
+
return slash === -1 ? path44 : path44.slice(0, slash);
|
|
53110
53111
|
}
|
|
53111
53112
|
async function analyzeMeshRefineNodeChangeArea(args) {
|
|
53112
53113
|
const { nodeId, workspace, branch, baseRef, branchRef, diffCwd, submodulePaths } = args;
|
|
@@ -54164,7 +54165,7 @@ async function probeRemoteMeshGitStatusWithRetry(args) {
|
|
|
54164
54165
|
const connection = args.getConnection?.(args.daemonId);
|
|
54165
54166
|
if (args.getConnection && readMeshConnectionState(connection) !== "connected") break;
|
|
54166
54167
|
if (connection) args.onConnection?.(connection);
|
|
54167
|
-
await new Promise((
|
|
54168
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250 * 2 ** (attempt - 1)));
|
|
54168
54169
|
}
|
|
54169
54170
|
try {
|
|
54170
54171
|
const remoteGit = await probeRemoteMeshGitStatus({
|
|
@@ -54541,18 +54542,18 @@ function resolveRefineryAutoPublishSubmoduleMainCommits(mesh, workspace) {
|
|
|
54541
54542
|
return { enabled: false };
|
|
54542
54543
|
}
|
|
54543
54544
|
async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
|
|
54544
|
-
const { execFileSync:
|
|
54545
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54545
54546
|
const diffArgs = ["diff", "--patch", "--full-index", fromRef, toRef];
|
|
54546
54547
|
if (excludePaths.length > 0) {
|
|
54547
|
-
diffArgs.push("--", ".", ...excludePaths.map((
|
|
54548
|
+
diffArgs.push("--", ".", ...excludePaths.map((path44) => `:(exclude)${path44}`));
|
|
54548
54549
|
}
|
|
54549
|
-
const diff =
|
|
54550
|
+
const diff = execFileSync10(GIT2, diffArgs, {
|
|
54550
54551
|
cwd,
|
|
54551
54552
|
encoding: "utf8",
|
|
54552
54553
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
54553
54554
|
});
|
|
54554
54555
|
if (!diff.trim()) return "";
|
|
54555
|
-
const patchId =
|
|
54556
|
+
const patchId = execFileSync10(GIT2, ["patch-id", "--stable"], {
|
|
54556
54557
|
cwd,
|
|
54557
54558
|
input: diff,
|
|
54558
54559
|
encoding: "utf8",
|
|
@@ -54563,8 +54564,8 @@ async function computeGitPatchId(cwd, fromRef, toRef, excludePaths = []) {
|
|
|
54563
54564
|
async function runMeshRefinePatchEquivalenceGate(repoRoot, baseHead, branchHead) {
|
|
54564
54565
|
const startedAt = Date.now();
|
|
54565
54566
|
try {
|
|
54566
|
-
const { execFileSync:
|
|
54567
|
-
const git = (args) =>
|
|
54567
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54568
|
+
const git = (args) => execFileSync10(GIT2, args, {
|
|
54568
54569
|
cwd: repoRoot,
|
|
54569
54570
|
encoding: "utf8",
|
|
54570
54571
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -54655,8 +54656,8 @@ ${e?.stderr || ""}`
|
|
|
54655
54656
|
async function checkWorktreeChangesPatchEquivalentInRef(repoRoot, ref, worktreeHead) {
|
|
54656
54657
|
const startedAt = Date.now();
|
|
54657
54658
|
try {
|
|
54658
|
-
const { execFileSync:
|
|
54659
|
-
const git = (gitArgs) =>
|
|
54659
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54660
|
+
const git = (gitArgs) => execFileSync10(GIT2, gitArgs, {
|
|
54660
54661
|
cwd: repoRoot,
|
|
54661
54662
|
encoding: "utf8",
|
|
54662
54663
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -54719,8 +54720,8 @@ ${mergeTreeErr?.stderr || ""}`;
|
|
|
54719
54720
|
async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
54720
54721
|
const startedAt = Date.now();
|
|
54721
54722
|
try {
|
|
54722
|
-
const { execFileSync:
|
|
54723
|
-
const git = (args, opts) =>
|
|
54723
|
+
const { execFileSync: execFileSync10 } = await import("child_process");
|
|
54724
|
+
const git = (args, opts) => execFileSync10(GIT2, args, {
|
|
54724
54725
|
cwd: opts?.cwd || repoRoot,
|
|
54725
54726
|
encoding: "utf8",
|
|
54726
54727
|
maxBuffer: REFINE_PATCH_EQUIVALENCE_OUTPUT_LIMIT_BYTES
|
|
@@ -54745,9 +54746,9 @@ async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
|
54745
54746
|
if (!trimmed) continue;
|
|
54746
54747
|
if (trimmed.startsWith("+")) {
|
|
54747
54748
|
const parts = trimmed.slice(1).trim().split(/\s+/);
|
|
54748
|
-
const
|
|
54749
|
+
const path44 = parts[1] || parts[0] || "(unknown)";
|
|
54749
54750
|
submoduleHints.push({
|
|
54750
|
-
path:
|
|
54751
|
+
path: path44,
|
|
54751
54752
|
reason: "submodule checked-out commit differs from the committed gitlink (pointer bump not committed on the root branch)"
|
|
54752
54753
|
});
|
|
54753
54754
|
}
|
|
@@ -54777,10 +54778,10 @@ async function runMeshRefineEffectiveDiffGate(repoRoot, baseHead, branchHead) {
|
|
|
54777
54778
|
}
|
|
54778
54779
|
function buildPatchEquivalenceSubmoduleConflictHint(repoRoot, baseHead, branchHead, output) {
|
|
54779
54780
|
if (!/(submodule|160000)/i.test(output) || !/(conflict|failed to merge)/i.test(output)) return void 0;
|
|
54780
|
-
const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((
|
|
54781
|
-
path:
|
|
54782
|
-
baseCommit: readTreeObject(repoRoot, baseHead,
|
|
54783
|
-
branchCommit: readTreeObject(repoRoot, branchHead,
|
|
54781
|
+
const conflicts = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path44) => ({
|
|
54782
|
+
path: path44,
|
|
54783
|
+
baseCommit: readTreeObject(repoRoot, baseHead, path44),
|
|
54784
|
+
branchCommit: readTreeObject(repoRoot, branchHead, path44)
|
|
54784
54785
|
}));
|
|
54785
54786
|
if (conflicts.length === 0) return void 0;
|
|
54786
54787
|
return {
|
|
@@ -54806,11 +54807,11 @@ function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
|
|
|
54806
54807
|
if (!line.trim()) continue;
|
|
54807
54808
|
const metaAndPath = line.split(" ");
|
|
54808
54809
|
const meta = metaAndPath[0] || "";
|
|
54809
|
-
const
|
|
54810
|
-
if (!
|
|
54810
|
+
const path44 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
54811
|
+
if (!path44) continue;
|
|
54811
54812
|
const parts = meta.split(/\s+/);
|
|
54812
54813
|
if (parts[0]?.includes("160000") || parts[1]?.includes("160000")) {
|
|
54813
|
-
paths.add(
|
|
54814
|
+
paths.add(path44);
|
|
54814
54815
|
}
|
|
54815
54816
|
}
|
|
54816
54817
|
return [...paths].sort();
|
|
@@ -54818,9 +54819,9 @@ function readChangedGitlinkPaths(repoRoot, fromRef, toRef) {
|
|
|
54818
54819
|
return [];
|
|
54819
54820
|
}
|
|
54820
54821
|
}
|
|
54821
|
-
function readTreeObject(repoRoot, ref,
|
|
54822
|
+
function readTreeObject(repoRoot, ref, path44) {
|
|
54822
54823
|
try {
|
|
54823
|
-
const output = (0, import_node_child_process6.execFileSync)(GIT2, ["ls-tree", ref, "--",
|
|
54824
|
+
const output = (0, import_node_child_process6.execFileSync)(GIT2, ["ls-tree", ref, "--", path44], {
|
|
54824
54825
|
cwd: repoRoot,
|
|
54825
54826
|
encoding: "utf8",
|
|
54826
54827
|
maxBuffer: 1024 * 1024
|
|
@@ -54865,12 +54866,12 @@ function readChangedPathKinds(repoRoot, fromRef, toRef) {
|
|
|
54865
54866
|
if (!line.trim()) continue;
|
|
54866
54867
|
const metaAndPath = line.split(" ");
|
|
54867
54868
|
const meta = metaAndPath[0] || "";
|
|
54868
|
-
const
|
|
54869
|
-
if (!
|
|
54870
|
-
seen.add(
|
|
54869
|
+
const path44 = metaAndPath[metaAndPath.length - 1]?.trim();
|
|
54870
|
+
if (!path44 || seen.has(path44)) continue;
|
|
54871
|
+
seen.add(path44);
|
|
54871
54872
|
const parts = meta.split(/\s+/);
|
|
54872
54873
|
const isGitlink = !!(parts[0]?.includes("160000") || parts[1]?.includes("160000"));
|
|
54873
|
-
result.push({ path:
|
|
54874
|
+
result.push({ path: path44, isGitlink });
|
|
54874
54875
|
}
|
|
54875
54876
|
return result;
|
|
54876
54877
|
} catch {
|
|
@@ -54878,20 +54879,20 @@ function readChangedPathKinds(repoRoot, fromRef, toRef) {
|
|
|
54878
54879
|
}
|
|
54879
54880
|
}
|
|
54880
54881
|
function collectFastForwardGitlinkPaths(repoRoot, baseHead, branchHead) {
|
|
54881
|
-
return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((
|
|
54882
|
-
const baseCommit = readTreeObject(repoRoot, baseHead,
|
|
54883
|
-
const branchCommit = readTreeObject(repoRoot, branchHead,
|
|
54882
|
+
return readChangedGitlinkPaths(repoRoot, baseHead, branchHead).filter((path44) => {
|
|
54883
|
+
const baseCommit = readTreeObject(repoRoot, baseHead, path44);
|
|
54884
|
+
const branchCommit = readTreeObject(repoRoot, branchHead, path44);
|
|
54884
54885
|
if (!baseCommit || !branchCommit) return false;
|
|
54885
|
-
return isSubmoduleFastForward((0, import_path14.resolve)(repoRoot,
|
|
54886
|
+
return isSubmoduleFastForward((0, import_path14.resolve)(repoRoot, path44), baseCommit, branchCommit);
|
|
54886
54887
|
});
|
|
54887
54888
|
}
|
|
54888
54889
|
function evaluateGitlinkTrivialFastForward(repoRoot, baseHead, branchHead) {
|
|
54889
|
-
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((
|
|
54890
|
-
const baseCommit = readTreeObject(repoRoot, baseHead,
|
|
54891
|
-
const branchCommit = readTreeObject(repoRoot, branchHead,
|
|
54892
|
-
const submoduleRepoPath = (0, import_path14.resolve)(repoRoot,
|
|
54890
|
+
const changedGitlinks = readChangedGitlinkPaths(repoRoot, baseHead, branchHead).map((path44) => {
|
|
54891
|
+
const baseCommit = readTreeObject(repoRoot, baseHead, path44);
|
|
54892
|
+
const branchCommit = readTreeObject(repoRoot, branchHead, path44);
|
|
54893
|
+
const submoduleRepoPath = (0, import_path14.resolve)(repoRoot, path44);
|
|
54893
54894
|
const fastForward = !!baseCommit && !!branchCommit && isSubmoduleFastForward(submoduleRepoPath, baseCommit, branchCommit);
|
|
54894
|
-
return { path:
|
|
54895
|
+
return { path: path44, baseCommit, branchCommit, fastForward };
|
|
54895
54896
|
});
|
|
54896
54897
|
if (changedGitlinks.length === 0) {
|
|
54897
54898
|
return { trivial: false, reason: "no_changed_gitlinks", gitlinks: changedGitlinks };
|
|
@@ -54942,7 +54943,7 @@ function buildTreeWithGitlinksEqualized(repoRoot, commitish, paths, placeholderC
|
|
|
54942
54943
|
maxBuffer: 1024 * 1024
|
|
54943
54944
|
}).trim();
|
|
54944
54945
|
if (!tree) return void 0;
|
|
54945
|
-
const updates = paths.map((
|
|
54946
|
+
const updates = paths.map((path44) => `160000 commit ${placeholderCommit} ${path44}`).join("\n");
|
|
54946
54947
|
if (!updates) return tree;
|
|
54947
54948
|
const tmpIndex = (0, import_path14.join)(resolveGitDir(repoRoot), `adhdev-refine-eq-${commitish.slice(0, 12)}.index`);
|
|
54948
54949
|
const env = { ...process.env, GIT_INDEX_FILE: tmpIndex };
|
|
@@ -55045,7 +55046,7 @@ function synthesizeTrivialFastForwardMergeTree(repoRoot, baseHead, branchHead, g
|
|
|
55045
55046
|
}
|
|
55046
55047
|
async function alignRefinerySubmodulesAfterMerge(repoRoot, previousBaseHead, currentHead, options = {}) {
|
|
55047
55048
|
const startedAt = Date.now();
|
|
55048
|
-
const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((
|
|
55049
|
+
const changedGitlinkPaths = readChangedGitlinkPaths(repoRoot, previousBaseHead, currentHead).filter((path44) => !(options.submoduleIgnorePaths || []).includes(path44));
|
|
55049
55050
|
const preStatus = await getGitRepoStatus(repoRoot, {
|
|
55050
55051
|
includeSubmodules: true,
|
|
55051
55052
|
submoduleIgnorePaths: options.submoduleIgnorePaths,
|
|
@@ -55092,7 +55093,7 @@ async function alignRefinerySubmodulesAfterMerge(repoRoot, previousBaseHead, cur
|
|
|
55092
55093
|
changedGitlinkPaths,
|
|
55093
55094
|
outOfSyncPaths,
|
|
55094
55095
|
updatedPaths: updatePaths,
|
|
55095
|
-
verifiedPaths: updatePaths.filter((
|
|
55096
|
+
verifiedPaths: updatePaths.filter((path44) => !remaining.some((submodule) => submodule.path === path44)),
|
|
55096
55097
|
durationMs: Date.now() - startedAt,
|
|
55097
55098
|
command: `git ${commandArgs.join(" ")}`,
|
|
55098
55099
|
stdout: truncateValidationOutput(result.stdout),
|
|
@@ -55418,15 +55419,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
55418
55419
|
const cwd = candidate.cwd ? (0, import_path14.resolve)(workspace, candidate.cwd) : workspace;
|
|
55419
55420
|
const timeout = candidate.timeoutMs || REFINE_VALIDATION_TIMEOUT_MS;
|
|
55420
55421
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
55421
|
-
const
|
|
55422
|
+
const spawn5 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
55422
55423
|
try {
|
|
55423
|
-
const result = await execFileAsync4(
|
|
55424
|
+
const result = await execFileAsync4(spawn5.file, spawn5.args, {
|
|
55424
55425
|
cwd,
|
|
55425
55426
|
encoding: "utf8",
|
|
55426
55427
|
timeout,
|
|
55427
55428
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
55428
55429
|
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
|
|
55429
|
-
...
|
|
55430
|
+
...spawn5.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
55430
55431
|
});
|
|
55431
55432
|
summary.bootstrapCommandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
55432
55433
|
} catch (error) {
|
|
@@ -55464,15 +55465,15 @@ async function runMeshRefineValidationGate(mesh, workspace, opts) {
|
|
|
55464
55465
|
return summary;
|
|
55465
55466
|
}
|
|
55466
55467
|
const resolvedCommand = resolveWin32Executable(candidate.command);
|
|
55467
|
-
const
|
|
55468
|
+
const spawn5 = buildWin32ExecFileSpawn(resolvedCommand, candidate.args);
|
|
55468
55469
|
try {
|
|
55469
|
-
const result = await execFileAsync4(
|
|
55470
|
+
const result = await execFileAsync4(spawn5.file, spawn5.args, {
|
|
55470
55471
|
cwd,
|
|
55471
55472
|
encoding: "utf8",
|
|
55472
55473
|
timeout,
|
|
55473
55474
|
maxBuffer: candidate.outputLimitBytes || REFINE_VALIDATION_OUTPUT_LIMIT_BYTES,
|
|
55474
55475
|
env: { ...process.env, CI: process.env.CI || "1", ...candidate.env || {} },
|
|
55475
|
-
...
|
|
55476
|
+
...spawn5.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}
|
|
55476
55477
|
});
|
|
55477
55478
|
summary.commandsRun.push(commandRecord(candidate, cwd, startedAt, result, true, { exitCode: 0 }));
|
|
55478
55479
|
} catch (error) {
|
|
@@ -56181,7 +56182,7 @@ var DaemonCommandRouter = class {
|
|
|
56181
56182
|
*/
|
|
56182
56183
|
async bestEffortRemoveWorktreeDir(dir) {
|
|
56183
56184
|
if (!dir || !fs32.existsSync(dir)) return { removed: true, residue: false };
|
|
56184
|
-
const sleep3 = (ms) => new Promise((
|
|
56185
|
+
const sleep3 = (ms) => new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
56185
56186
|
const ABSORB = /* @__PURE__ */ new Set(["EINVAL", "EPERM", "EBUSY", "ENOTEMPTY", "EACCES", "EMFILE", "ENFILE"]);
|
|
56186
56187
|
let lastErr;
|
|
56187
56188
|
for (let attempt = 0; attempt < 4; attempt++) {
|
|
@@ -58939,7 +58940,7 @@ var ProviderStreamAdapter = class {
|
|
|
58939
58940
|
const beforeCount = this.messageCount(before);
|
|
58940
58941
|
const beforeSignature = this.lastMessageSignature(before);
|
|
58941
58942
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
58942
|
-
await new Promise((
|
|
58943
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
58943
58944
|
let state;
|
|
58944
58945
|
try {
|
|
58945
58946
|
state = await this.readChat(evaluate);
|
|
@@ -58961,7 +58962,7 @@ var ProviderStreamAdapter = class {
|
|
|
58961
58962
|
if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
|
|
58962
58963
|
return first;
|
|
58963
58964
|
}
|
|
58964
|
-
await new Promise((
|
|
58965
|
+
await new Promise((resolve25) => setTimeout(resolve25, 150));
|
|
58965
58966
|
const second = await this.readChat(evaluate);
|
|
58966
58967
|
return this.messageCount(second) >= this.messageCount(first) ? second : first;
|
|
58967
58968
|
}
|
|
@@ -59112,7 +59113,7 @@ var ProviderStreamAdapter = class {
|
|
|
59112
59113
|
if (typeof data.error === "string" && data.error.trim()) return false;
|
|
59113
59114
|
}
|
|
59114
59115
|
for (let attempt = 0; attempt < 6; attempt += 1) {
|
|
59115
|
-
await new Promise((
|
|
59116
|
+
await new Promise((resolve25) => setTimeout(resolve25, 250));
|
|
59116
59117
|
const state = await this.readChat(evaluate);
|
|
59117
59118
|
const title = this.getStateTitle(state);
|
|
59118
59119
|
if (this.titlesMatch(title, sessionId)) return true;
|
|
@@ -60104,13 +60105,13 @@ var VersionArchive = class {
|
|
|
60104
60105
|
}
|
|
60105
60106
|
};
|
|
60106
60107
|
async function runCommand(cmd, timeout = 1e4) {
|
|
60107
|
-
return new Promise((
|
|
60108
|
+
return new Promise((resolve25) => {
|
|
60108
60109
|
(0, import_child_process10.exec)(cmd, {
|
|
60109
60110
|
encoding: "utf-8",
|
|
60110
60111
|
timeout
|
|
60111
60112
|
}, (error, stdout) => {
|
|
60112
|
-
if (error) return
|
|
60113
|
-
|
|
60113
|
+
if (error) return resolve25(null);
|
|
60114
|
+
resolve25(stdout.trim());
|
|
60114
60115
|
});
|
|
60115
60116
|
});
|
|
60116
60117
|
}
|
|
@@ -61810,7 +61811,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
|
|
|
61810
61811
|
return { target, instance, adapter };
|
|
61811
61812
|
}
|
|
61812
61813
|
function sleep2(ms) {
|
|
61813
|
-
return new Promise((
|
|
61814
|
+
return new Promise((resolve25) => setTimeout(resolve25, ms));
|
|
61814
61815
|
}
|
|
61815
61816
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
61816
61817
|
const startedAt = Date.now();
|
|
@@ -62786,8 +62787,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62786
62787
|
fs36.writeFileSync(promptFile, prompt, "utf-8");
|
|
62787
62788
|
ctx.log(`Auto-implement prompt written to ${promptFile} (${prompt.length} chars)`);
|
|
62788
62789
|
const agentProvider = ctx.providerLoader.resolve(agent) || ctx.providerLoader.getMeta(agent);
|
|
62789
|
-
const
|
|
62790
|
-
if (!
|
|
62790
|
+
const spawn5 = agentProvider?.spawn;
|
|
62791
|
+
if (!spawn5?.command) {
|
|
62791
62792
|
try {
|
|
62792
62793
|
fs36.unlinkSync(promptFile);
|
|
62793
62794
|
} catch {
|
|
@@ -62797,22 +62798,22 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62797
62798
|
}
|
|
62798
62799
|
const agentCategory = agentProvider?.category;
|
|
62799
62800
|
if (agentCategory === "acp") {
|
|
62800
|
-
sendAutoImplSSE(ctx, { event: "progress", data: { function: "_init", status: "spawning", message: `Spawning ACP agent: ${
|
|
62801
|
+
sendAutoImplSSE(ctx, { event: "progress", data: { function: "_init", status: "spawning", message: `Spawning ACP agent: ${spawn5.command} ${(spawn5.args || []).join(" ")}` } });
|
|
62801
62802
|
ctx.autoImplStatus.running = true;
|
|
62802
62803
|
ctx.autoImplStatus.type = type;
|
|
62803
62804
|
const { ClientSideConnection: ClientSideConnection2, ndJsonStream: ndJsonStream2, PROTOCOL_VERSION: PROTOCOL_VERSION2 } = await import("@agentclientprotocol/sdk");
|
|
62804
62805
|
const { Readable: Readable2, Writable: Writable2 } = await import("stream");
|
|
62805
62806
|
const { spawn: spawnFn2 } = await import("child_process");
|
|
62806
|
-
const acpArgs = [...
|
|
62807
|
+
const acpArgs = [...spawn5.args || []];
|
|
62807
62808
|
if (model) {
|
|
62808
62809
|
acpArgs.push("--model", model);
|
|
62809
62810
|
ctx.log(`Auto-implement ACP using model: ${model}`);
|
|
62810
62811
|
}
|
|
62811
|
-
const child2 = spawnFn2(
|
|
62812
|
+
const child2 = spawnFn2(spawn5.command, acpArgs, {
|
|
62812
62813
|
cwd: providerDir,
|
|
62813
62814
|
stdio: ["pipe", "pipe", "pipe"],
|
|
62814
|
-
shell:
|
|
62815
|
-
env: { ...process.env, ...
|
|
62815
|
+
shell: spawn5.shell ?? false,
|
|
62816
|
+
env: { ...process.env, ...spawn5.env || {} }
|
|
62816
62817
|
});
|
|
62817
62818
|
ctx.autoImplProcess = child2;
|
|
62818
62819
|
child2.stderr?.on("data", (d) => {
|
|
@@ -62922,7 +62923,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62922
62923
|
ctx.json(res, 202, {
|
|
62923
62924
|
started: true,
|
|
62924
62925
|
type,
|
|
62925
|
-
agent:
|
|
62926
|
+
agent: spawn5.command,
|
|
62926
62927
|
functions,
|
|
62927
62928
|
providerDir,
|
|
62928
62929
|
message: "ACP Auto-implement started. Connect to SSE for progress.",
|
|
@@ -62930,10 +62931,10 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62930
62931
|
});
|
|
62931
62932
|
return;
|
|
62932
62933
|
}
|
|
62933
|
-
const command =
|
|
62934
|
-
const autoImpl =
|
|
62934
|
+
const command = spawn5.command;
|
|
62935
|
+
const autoImpl = spawn5.autoImpl;
|
|
62935
62936
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
62936
|
-
const baseArgs = [...
|
|
62937
|
+
const baseArgs = [...spawn5.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
62937
62938
|
let shellCmd;
|
|
62938
62939
|
const isWin = os29.platform() === "win32";
|
|
62939
62940
|
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
@@ -62980,7 +62981,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62980
62981
|
cols: import_session_host_core8.DEFAULT_SESSION_HOST_COLS,
|
|
62981
62982
|
rows: import_session_host_core8.DEFAULT_SESSION_HOST_ROWS,
|
|
62982
62983
|
cwd: providerDir,
|
|
62983
|
-
env: { ...process.env, ...
|
|
62984
|
+
env: { ...process.env, ...spawn5.env || {} }
|
|
62984
62985
|
});
|
|
62985
62986
|
isPty = true;
|
|
62986
62987
|
} catch (err) {
|
|
@@ -62992,7 +62993,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
62992
62993
|
stdio: ["pipe", "pipe", "pipe"],
|
|
62993
62994
|
env: {
|
|
62994
62995
|
...process.env,
|
|
62995
|
-
...
|
|
62996
|
+
...spawn5.env || {}
|
|
62996
62997
|
}
|
|
62997
62998
|
});
|
|
62998
62999
|
child.on("error", (err2) => {
|
|
@@ -64034,8 +64035,8 @@ var DevServer = class _DevServer {
|
|
|
64034
64035
|
}
|
|
64035
64036
|
getEndpointList() {
|
|
64036
64037
|
return this.routes.map((r) => {
|
|
64037
|
-
const
|
|
64038
|
-
return `${r.method.padEnd(5)} ${
|
|
64038
|
+
const path44 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
|
|
64039
|
+
return `${r.method.padEnd(5)} ${path44}`;
|
|
64039
64040
|
});
|
|
64040
64041
|
}
|
|
64041
64042
|
async start(port = DEV_SERVER_PORT) {
|
|
@@ -64066,15 +64067,15 @@ var DevServer = class _DevServer {
|
|
|
64066
64067
|
this.json(res, 500, { error: e.message });
|
|
64067
64068
|
}
|
|
64068
64069
|
});
|
|
64069
|
-
return new Promise((
|
|
64070
|
+
return new Promise((resolve25, reject) => {
|
|
64070
64071
|
this.server.listen(port, "127.0.0.1", () => {
|
|
64071
64072
|
this.log(`Dev server listening on http://127.0.0.1:${port}`);
|
|
64072
|
-
|
|
64073
|
+
resolve25();
|
|
64073
64074
|
});
|
|
64074
64075
|
this.server.on("error", (e) => {
|
|
64075
64076
|
if (e.code === "EADDRINUSE") {
|
|
64076
64077
|
this.log(`Port ${port} in use, skipping dev server`);
|
|
64077
|
-
|
|
64078
|
+
resolve25();
|
|
64078
64079
|
} else {
|
|
64079
64080
|
reject(e);
|
|
64080
64081
|
}
|
|
@@ -64135,16 +64136,16 @@ var DevServer = class _DevServer {
|
|
|
64135
64136
|
this.json(res, 404, { error: `Provider not found: ${type}` });
|
|
64136
64137
|
return;
|
|
64137
64138
|
}
|
|
64138
|
-
const
|
|
64139
|
-
if (!
|
|
64139
|
+
const spawn5 = provider.spawn;
|
|
64140
|
+
if (!spawn5) {
|
|
64140
64141
|
this.json(res, 400, { error: `Provider ${type} has no spawn config` });
|
|
64141
64142
|
return;
|
|
64142
64143
|
}
|
|
64143
64144
|
const { spawn: spawnFn } = await import("child_process");
|
|
64144
64145
|
const start = Date.now();
|
|
64145
64146
|
try {
|
|
64146
|
-
const child = spawnFn(
|
|
64147
|
-
shell:
|
|
64147
|
+
const child = spawnFn(spawn5.command, [...spawn5.args || []], {
|
|
64148
|
+
shell: spawn5.shell ?? false,
|
|
64148
64149
|
timeout: 5e3,
|
|
64149
64150
|
stdio: ["pipe", "pipe", "pipe"]
|
|
64150
64151
|
});
|
|
@@ -64156,27 +64157,27 @@ var DevServer = class _DevServer {
|
|
|
64156
64157
|
child.stderr?.on("data", (d) => {
|
|
64157
64158
|
stderr += d.toString().slice(0, 2e3);
|
|
64158
64159
|
});
|
|
64159
|
-
await new Promise((
|
|
64160
|
+
await new Promise((resolve25) => {
|
|
64160
64161
|
const timer = setTimeout(() => {
|
|
64161
64162
|
child.kill();
|
|
64162
|
-
|
|
64163
|
+
resolve25();
|
|
64163
64164
|
}, 3e3);
|
|
64164
64165
|
child.on("exit", () => {
|
|
64165
64166
|
clearTimeout(timer);
|
|
64166
|
-
|
|
64167
|
+
resolve25();
|
|
64167
64168
|
});
|
|
64168
64169
|
child.stdout?.once("data", () => {
|
|
64169
64170
|
setTimeout(() => {
|
|
64170
64171
|
child.kill();
|
|
64171
64172
|
clearTimeout(timer);
|
|
64172
|
-
|
|
64173
|
+
resolve25();
|
|
64173
64174
|
}, 500);
|
|
64174
64175
|
});
|
|
64175
64176
|
});
|
|
64176
64177
|
const elapsed = Date.now() - start;
|
|
64177
64178
|
this.json(res, 200, {
|
|
64178
64179
|
success: true,
|
|
64179
|
-
command: `${
|
|
64180
|
+
command: `${spawn5.command} ${(spawn5.args || []).join(" ")}`,
|
|
64180
64181
|
elapsed,
|
|
64181
64182
|
stdout: stdout.trim(),
|
|
64182
64183
|
stderr: stderr.trim(),
|
|
@@ -64186,7 +64187,7 @@ var DevServer = class _DevServer {
|
|
|
64186
64187
|
const elapsed = Date.now() - start;
|
|
64187
64188
|
this.json(res, 200, {
|
|
64188
64189
|
success: false,
|
|
64189
|
-
command: `${
|
|
64190
|
+
command: `${spawn5.command} ${(spawn5.args || []).join(" ")}`,
|
|
64190
64191
|
elapsed,
|
|
64191
64192
|
error: e.message
|
|
64192
64193
|
});
|
|
@@ -64649,20 +64650,20 @@ var DevServer = class _DevServer {
|
|
|
64649
64650
|
this.json(res, 404, { error: `Provider not found: ${type}` });
|
|
64650
64651
|
return;
|
|
64651
64652
|
}
|
|
64652
|
-
const
|
|
64653
|
-
if (!
|
|
64653
|
+
const spawn5 = provider.spawn;
|
|
64654
|
+
if (!spawn5) {
|
|
64654
64655
|
this.json(res, 400, { error: `Provider ${type} has no spawn config` });
|
|
64655
64656
|
return;
|
|
64656
64657
|
}
|
|
64657
64658
|
const { spawn: spawnFn } = await import("child_process");
|
|
64658
64659
|
const start = Date.now();
|
|
64659
64660
|
try {
|
|
64660
|
-
const args = [...
|
|
64661
|
-
const child = spawnFn(
|
|
64662
|
-
shell:
|
|
64661
|
+
const args = [...spawn5.args || [], message];
|
|
64662
|
+
const child = spawnFn(spawn5.command, args, {
|
|
64663
|
+
shell: spawn5.shell ?? false,
|
|
64663
64664
|
timeout,
|
|
64664
64665
|
stdio: ["pipe", "pipe", "pipe"],
|
|
64665
|
-
env: { ...process.env, ...
|
|
64666
|
+
env: { ...process.env, ...spawn5.env || {} }
|
|
64666
64667
|
});
|
|
64667
64668
|
let stdout = "";
|
|
64668
64669
|
let stderr = "";
|
|
@@ -64672,14 +64673,14 @@ var DevServer = class _DevServer {
|
|
|
64672
64673
|
child.stderr?.on("data", (d) => {
|
|
64673
64674
|
stderr += d.toString();
|
|
64674
64675
|
});
|
|
64675
|
-
await new Promise((
|
|
64676
|
+
await new Promise((resolve25) => {
|
|
64676
64677
|
const timer = setTimeout(() => {
|
|
64677
64678
|
child.kill();
|
|
64678
|
-
|
|
64679
|
+
resolve25();
|
|
64679
64680
|
}, timeout);
|
|
64680
64681
|
child.on("exit", () => {
|
|
64681
64682
|
clearTimeout(timer);
|
|
64682
|
-
|
|
64683
|
+
resolve25();
|
|
64683
64684
|
});
|
|
64684
64685
|
});
|
|
64685
64686
|
const elapsed = Date.now() - start;
|
|
@@ -64878,14 +64879,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
64878
64879
|
res.end(JSON.stringify(data, null, 2));
|
|
64879
64880
|
}
|
|
64880
64881
|
async readBody(req) {
|
|
64881
|
-
return new Promise((
|
|
64882
|
+
return new Promise((resolve25) => {
|
|
64882
64883
|
let body = "";
|
|
64883
64884
|
req.on("data", (chunk) => body += chunk);
|
|
64884
64885
|
req.on("end", () => {
|
|
64885
64886
|
try {
|
|
64886
|
-
|
|
64887
|
+
resolve25(JSON.parse(body));
|
|
64887
64888
|
} catch {
|
|
64888
|
-
|
|
64889
|
+
resolve25({});
|
|
64889
64890
|
}
|
|
64890
64891
|
});
|
|
64891
64892
|
});
|
|
@@ -65620,7 +65621,7 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS, requiredRe
|
|
|
65620
65621
|
const deadline = Date.now() + timeoutMs;
|
|
65621
65622
|
while (Date.now() < deadline) {
|
|
65622
65623
|
if (await canConnect(endpoint, requiredRequestTypes)) return;
|
|
65623
|
-
await new Promise((
|
|
65624
|
+
await new Promise((resolve25) => setTimeout(resolve25, STARTUP_POLL_MS));
|
|
65624
65625
|
}
|
|
65625
65626
|
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
65626
65627
|
}
|
|
@@ -65661,6 +65662,148 @@ async function listHostedCliRuntimes(endpoint) {
|
|
|
65661
65662
|
}
|
|
65662
65663
|
}
|
|
65663
65664
|
|
|
65665
|
+
// src/session-host/managed-host.ts
|
|
65666
|
+
var import_child_process11 = require("child_process");
|
|
65667
|
+
var fs38 = __toESM(require("fs"));
|
|
65668
|
+
var os30 = __toESM(require("os"));
|
|
65669
|
+
var path43 = __toESM(require("path"));
|
|
65670
|
+
var import_session_host_core12 = require("@adhdev/session-host-core");
|
|
65671
|
+
init_runtime_defaults();
|
|
65672
|
+
function createManagedSessionHost(options) {
|
|
65673
|
+
const appName = options.appName;
|
|
65674
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_SESSION_HOST_READY_TIMEOUT_MS;
|
|
65675
|
+
const endpoint = (0, import_session_host_core12.getDefaultSessionHostEndpoint)(appName);
|
|
65676
|
+
const isManagedPid = options.isManagedPid ?? (() => true);
|
|
65677
|
+
function buildEnv(baseEnv) {
|
|
65678
|
+
const env = (0, import_session_host_core12.sanitizeSpawnEnv)(baseEnv);
|
|
65679
|
+
env.ADHDEV_SESSION_HOST_NAME = appName;
|
|
65680
|
+
return env;
|
|
65681
|
+
}
|
|
65682
|
+
function resolveEntry() {
|
|
65683
|
+
const packagedCandidates = [
|
|
65684
|
+
path43.resolve(__dirname, "../vendor/session-host-daemon/index.js"),
|
|
65685
|
+
path43.resolve(__dirname, "../../vendor/session-host-daemon/index.js")
|
|
65686
|
+
];
|
|
65687
|
+
for (const candidate of packagedCandidates) {
|
|
65688
|
+
if (fs38.existsSync(candidate)) {
|
|
65689
|
+
return candidate;
|
|
65690
|
+
}
|
|
65691
|
+
}
|
|
65692
|
+
return require.resolve("@adhdev/session-host-daemon");
|
|
65693
|
+
}
|
|
65694
|
+
function getPidFile() {
|
|
65695
|
+
return path43.join(os30.homedir(), ".adhdev", `${appName}-session-host.pid`);
|
|
65696
|
+
}
|
|
65697
|
+
function getPid() {
|
|
65698
|
+
try {
|
|
65699
|
+
const pidFile = getPidFile();
|
|
65700
|
+
if (!fs38.existsSync(pidFile)) return null;
|
|
65701
|
+
const pid = Number.parseInt(fs38.readFileSync(pidFile, "utf8").trim(), 10);
|
|
65702
|
+
return Number.isFinite(pid) ? pid : null;
|
|
65703
|
+
} catch {
|
|
65704
|
+
return null;
|
|
65705
|
+
}
|
|
65706
|
+
}
|
|
65707
|
+
function killPid2(pid) {
|
|
65708
|
+
try {
|
|
65709
|
+
if (process.platform === "win32") {
|
|
65710
|
+
const spawnOpts = { stdio: "ignore" };
|
|
65711
|
+
if (options.killWindowsHide) spawnOpts.windowsHide = true;
|
|
65712
|
+
(0, import_child_process11.execFileSync)("taskkill", ["/PID", String(pid), "/T", "/F"], spawnOpts);
|
|
65713
|
+
} else {
|
|
65714
|
+
process.kill(pid, "SIGTERM");
|
|
65715
|
+
}
|
|
65716
|
+
return true;
|
|
65717
|
+
} catch {
|
|
65718
|
+
return false;
|
|
65719
|
+
}
|
|
65720
|
+
}
|
|
65721
|
+
function spawnHost() {
|
|
65722
|
+
const entry = resolveEntry();
|
|
65723
|
+
let stdio = "ignore";
|
|
65724
|
+
let logFd = null;
|
|
65725
|
+
if (options.spawnStdio === "logfile") {
|
|
65726
|
+
const logDir = path43.join(os30.homedir(), ".adhdev", "logs");
|
|
65727
|
+
fs38.mkdirSync(logDir, { recursive: true });
|
|
65728
|
+
logFd = fs38.openSync(path43.join(logDir, "session-host.log"), "a");
|
|
65729
|
+
stdio = ["ignore", logFd, logFd];
|
|
65730
|
+
}
|
|
65731
|
+
const child = (0, import_child_process11.spawn)(process.execPath, [entry], {
|
|
65732
|
+
detached: true,
|
|
65733
|
+
stdio,
|
|
65734
|
+
windowsHide: true,
|
|
65735
|
+
env: buildEnv(process.env)
|
|
65736
|
+
});
|
|
65737
|
+
child.unref();
|
|
65738
|
+
if (logFd !== null) {
|
|
65739
|
+
try {
|
|
65740
|
+
fs38.closeSync(logFd);
|
|
65741
|
+
} catch {
|
|
65742
|
+
}
|
|
65743
|
+
}
|
|
65744
|
+
}
|
|
65745
|
+
function stopManagedSessionHostProcess() {
|
|
65746
|
+
let stopped = false;
|
|
65747
|
+
const pidFile = getPidFile();
|
|
65748
|
+
try {
|
|
65749
|
+
if (fs38.existsSync(pidFile)) {
|
|
65750
|
+
const pid = Number.parseInt(fs38.readFileSync(pidFile, "utf8").trim(), 10);
|
|
65751
|
+
if (Number.isFinite(pid) && pid !== process.pid && isManagedPid(pid)) {
|
|
65752
|
+
stopped = killPid2(pid) || stopped;
|
|
65753
|
+
}
|
|
65754
|
+
}
|
|
65755
|
+
} catch {
|
|
65756
|
+
} finally {
|
|
65757
|
+
try {
|
|
65758
|
+
fs38.unlinkSync(pidFile);
|
|
65759
|
+
} catch {
|
|
65760
|
+
}
|
|
65761
|
+
}
|
|
65762
|
+
if (options.extraStop) {
|
|
65763
|
+
stopped = options.extraStop(endpoint) || stopped;
|
|
65764
|
+
}
|
|
65765
|
+
return stopped;
|
|
65766
|
+
}
|
|
65767
|
+
async function ensureReady() {
|
|
65768
|
+
options.beforeEnsureReady?.();
|
|
65769
|
+
try {
|
|
65770
|
+
return await ensureSessionHostReady({
|
|
65771
|
+
appName,
|
|
65772
|
+
spawnHost,
|
|
65773
|
+
timeoutMs,
|
|
65774
|
+
requiredRequestTypes: options.requiredRequestTypes
|
|
65775
|
+
});
|
|
65776
|
+
} catch (error) {
|
|
65777
|
+
stopManagedSessionHostProcess();
|
|
65778
|
+
return ensureSessionHostReady({
|
|
65779
|
+
appName,
|
|
65780
|
+
spawnHost,
|
|
65781
|
+
timeoutMs,
|
|
65782
|
+
requiredRequestTypes: options.requiredRequestTypes
|
|
65783
|
+
}).catch((retryError) => {
|
|
65784
|
+
const initialMessage = error instanceof Error ? error.message : String(error);
|
|
65785
|
+
const retryMessage = retryError instanceof Error ? retryError.message : String(retryError);
|
|
65786
|
+
throw new Error(`Session host failed to start after retry (${initialMessage}; retry: ${retryMessage})`);
|
|
65787
|
+
});
|
|
65788
|
+
}
|
|
65789
|
+
}
|
|
65790
|
+
return {
|
|
65791
|
+
appName,
|
|
65792
|
+
endpoint,
|
|
65793
|
+
getPidFile,
|
|
65794
|
+
getPid,
|
|
65795
|
+
buildEnv,
|
|
65796
|
+
resolveEntry,
|
|
65797
|
+
killPid: killPid2,
|
|
65798
|
+
spawnHost,
|
|
65799
|
+
stopManagedSessionHostProcess,
|
|
65800
|
+
ensureReady,
|
|
65801
|
+
getStatusPaths() {
|
|
65802
|
+
return { pidFile: getPidFile(), endpoint };
|
|
65803
|
+
}
|
|
65804
|
+
};
|
|
65805
|
+
}
|
|
65806
|
+
|
|
65664
65807
|
// src/session-host/startup-restore-policy.js
|
|
65665
65808
|
function shouldAutoRestoreHostedSessionsOnStartup(env = process.env) {
|
|
65666
65809
|
const raw = typeof env.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP === "string" ? env.ADHDEV_RESTORE_HOSTED_SESSIONS_ON_STARTUP.trim().toLowerCase() : "";
|
|
@@ -65670,7 +65813,7 @@ function shouldAutoRestoreHostedSessionsOnStartup(env = process.env) {
|
|
|
65670
65813
|
}
|
|
65671
65814
|
|
|
65672
65815
|
// src/installer.ts
|
|
65673
|
-
var
|
|
65816
|
+
var import_child_process12 = require("child_process");
|
|
65674
65817
|
var import_util3 = require("util");
|
|
65675
65818
|
var EXTENSION_CATALOG = [
|
|
65676
65819
|
// AI Agent extensions
|
|
@@ -65758,7 +65901,7 @@ var EXTENSION_CATALOG = [
|
|
|
65758
65901
|
apiKeyName: "OpenAI/Anthropic API key"
|
|
65759
65902
|
}
|
|
65760
65903
|
];
|
|
65761
|
-
var execAsync4 = (0, import_util3.promisify)(
|
|
65904
|
+
var execAsync4 = (0, import_util3.promisify)(import_child_process12.exec);
|
|
65762
65905
|
async function isExtensionInstalled(ide, marketplaceId) {
|
|
65763
65906
|
if (!ide.cliCommand) return false;
|
|
65764
65907
|
try {
|
|
@@ -65798,12 +65941,12 @@ async function installExtension(ide, extension) {
|
|
|
65798
65941
|
const res = await fetch(extension.vsixUrl);
|
|
65799
65942
|
if (res.ok) {
|
|
65800
65943
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
65801
|
-
const
|
|
65802
|
-
|
|
65803
|
-
return new Promise((
|
|
65944
|
+
const fs39 = await import("fs");
|
|
65945
|
+
fs39.writeFileSync(vsixPath, buffer);
|
|
65946
|
+
return new Promise((resolve25) => {
|
|
65804
65947
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
65805
|
-
(0,
|
|
65806
|
-
|
|
65948
|
+
(0, import_child_process12.exec)(cmd, { timeout: 6e4 }, (error, _stdout, stderr) => {
|
|
65949
|
+
resolve25({
|
|
65807
65950
|
extensionId: extension.id,
|
|
65808
65951
|
marketplaceId: extension.marketplaceId,
|
|
65809
65952
|
success: !error,
|
|
@@ -65816,11 +65959,11 @@ async function installExtension(ide, extension) {
|
|
|
65816
65959
|
} catch (e) {
|
|
65817
65960
|
}
|
|
65818
65961
|
}
|
|
65819
|
-
return new Promise((
|
|
65962
|
+
return new Promise((resolve25) => {
|
|
65820
65963
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
65821
|
-
(0,
|
|
65964
|
+
(0, import_child_process12.exec)(cmd, { timeout: 6e4 }, (error, stdout, stderr) => {
|
|
65822
65965
|
if (error) {
|
|
65823
|
-
|
|
65966
|
+
resolve25({
|
|
65824
65967
|
extensionId: extension.id,
|
|
65825
65968
|
marketplaceId: extension.marketplaceId,
|
|
65826
65969
|
success: false,
|
|
@@ -65828,7 +65971,7 @@ async function installExtension(ide, extension) {
|
|
|
65828
65971
|
error: stderr || error.message
|
|
65829
65972
|
});
|
|
65830
65973
|
} else {
|
|
65831
|
-
|
|
65974
|
+
resolve25({
|
|
65832
65975
|
extensionId: extension.id,
|
|
65833
65976
|
marketplaceId: extension.marketplaceId,
|
|
65834
65977
|
success: true,
|
|
@@ -65855,7 +65998,7 @@ function launchIDE(ide, workspacePath) {
|
|
|
65855
65998
|
if (!ide.cliCommand) return false;
|
|
65856
65999
|
try {
|
|
65857
66000
|
const args = workspacePath ? `"${workspacePath}"` : "";
|
|
65858
|
-
(0,
|
|
66001
|
+
(0, import_child_process12.exec)(`"${ide.cliCommand}" ${args}`, { timeout: 1e4 });
|
|
65859
66002
|
return true;
|
|
65860
66003
|
} catch {
|
|
65861
66004
|
return false;
|
|
@@ -66317,7 +66460,7 @@ async function startLocalIpcServer(opts) {
|
|
|
66317
66460
|
}));
|
|
66318
66461
|
}
|
|
66319
66462
|
}
|
|
66320
|
-
await new Promise((
|
|
66463
|
+
await new Promise((resolve25, reject) => {
|
|
66321
66464
|
const onError = (error) => {
|
|
66322
66465
|
httpServer?.off("listening", onListening);
|
|
66323
66466
|
reject(error);
|
|
@@ -66325,7 +66468,7 @@ async function startLocalIpcServer(opts) {
|
|
|
66325
66468
|
const onListening = () => {
|
|
66326
66469
|
httpServer?.off("error", onError);
|
|
66327
66470
|
listening = true;
|
|
66328
|
-
|
|
66471
|
+
resolve25();
|
|
66329
66472
|
};
|
|
66330
66473
|
httpServer.once("error", onError);
|
|
66331
66474
|
httpServer.once("listening", onListening);
|
|
@@ -66352,12 +66495,12 @@ async function startLocalIpcServer(opts) {
|
|
|
66352
66495
|
}
|
|
66353
66496
|
}
|
|
66354
66497
|
clients.clear();
|
|
66355
|
-
await new Promise((
|
|
66498
|
+
await new Promise((resolve25) => {
|
|
66356
66499
|
if (!httpServer) {
|
|
66357
|
-
|
|
66500
|
+
resolve25();
|
|
66358
66501
|
return;
|
|
66359
66502
|
}
|
|
66360
|
-
httpServer.close(() =>
|
|
66503
|
+
httpServer.close(() => resolve25());
|
|
66361
66504
|
});
|
|
66362
66505
|
httpServer = null;
|
|
66363
66506
|
wss = null;
|
|
@@ -66609,6 +66752,7 @@ var V1_CONTRACT_VERSION = "1.0.0";
|
|
|
66609
66752
|
createGitSnapshotStore,
|
|
66610
66753
|
createGitWorkspaceMonitor,
|
|
66611
66754
|
createInteractionId,
|
|
66755
|
+
createManagedSessionHost,
|
|
66612
66756
|
createMesh,
|
|
66613
66757
|
createNativeHistoryDispatcher,
|
|
66614
66758
|
createSessionDelivery,
|