@adhdev/daemon-standalone 0.9.71 → 0.9.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +188 -114
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/{index-DM3XHNI_.js → index-DehOXawT.js} +16 -16
- package/public/index.html +1 -1
- package/vendor/mcp-server/index.js +188 -114
- package/vendor/mcp-server/index.js.map +1 -1
- package/vendor/mcp-server/package.json +1 -1
|
@@ -25377,8 +25377,8 @@ async function detectIDEs(providerLoader) {
|
|
|
25377
25377
|
if ((0, import_fs5.existsSync)(bundledCli)) resolvedCli = bundledCli;
|
|
25378
25378
|
}
|
|
25379
25379
|
if (!resolvedCli && appPath && os21 === "win32") {
|
|
25380
|
-
const { dirname:
|
|
25381
|
-
const appDir =
|
|
25380
|
+
const { dirname: dirname82 } = await import("path");
|
|
25381
|
+
const appDir = dirname82(appPath);
|
|
25382
25382
|
const candidates = [
|
|
25383
25383
|
`${appDir}\\\\bin\\\\${def.cli}.cmd`,
|
|
25384
25384
|
`${appDir}\\\\bin\\\\${def.cli}`,
|
|
@@ -25436,19 +25436,19 @@ function resolveCommandPath(command) {
|
|
|
25436
25436
|
return null;
|
|
25437
25437
|
}
|
|
25438
25438
|
function execAsync(cmd, timeoutMs = 5e3) {
|
|
25439
|
-
return new Promise((
|
|
25439
|
+
return new Promise((resolve162) => {
|
|
25440
25440
|
const child = (0, import_child_process4.exec)(cmd, {
|
|
25441
25441
|
encoding: "utf-8",
|
|
25442
25442
|
timeout: timeoutMs,
|
|
25443
25443
|
...process.platform === "win32" ? { windowsHide: true } : {}
|
|
25444
25444
|
}, (err, stdout) => {
|
|
25445
25445
|
if (err || !stdout?.trim()) {
|
|
25446
|
-
|
|
25446
|
+
resolve162(null);
|
|
25447
25447
|
} else {
|
|
25448
|
-
|
|
25448
|
+
resolve162(stdout.trim());
|
|
25449
25449
|
}
|
|
25450
25450
|
});
|
|
25451
|
-
child.on("error", () =>
|
|
25451
|
+
child.on("error", () => resolve162(null));
|
|
25452
25452
|
});
|
|
25453
25453
|
}
|
|
25454
25454
|
async function detectCLIs(providerLoader, options) {
|
|
@@ -28512,7 +28512,7 @@ function getCliVisibleTranscriptCount(adapter) {
|
|
|
28512
28512
|
async function getStableExtensionBaseline(h) {
|
|
28513
28513
|
const first = await readExtensionChatState(h);
|
|
28514
28514
|
if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
|
|
28515
|
-
await new Promise((
|
|
28515
|
+
await new Promise((resolve162) => setTimeout(resolve162, 150));
|
|
28516
28516
|
const second = await readExtensionChatState(h);
|
|
28517
28517
|
return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
|
|
28518
28518
|
}
|
|
@@ -28520,7 +28520,7 @@ async function verifyExtensionSendObserved(h, before) {
|
|
|
28520
28520
|
const beforeCount = getStateMessageCount(before);
|
|
28521
28521
|
const beforeSignature = getStateLastSignature(before);
|
|
28522
28522
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
28523
|
-
await new Promise((
|
|
28523
|
+
await new Promise((resolve162) => setTimeout(resolve162, 250));
|
|
28524
28524
|
const state = await readExtensionChatState(h);
|
|
28525
28525
|
if (state?.status === "waiting_approval") return true;
|
|
28526
28526
|
const afterCount = getStateMessageCount(state);
|
|
@@ -30103,7 +30103,7 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
30103
30103
|
const enterCount = cliCommand.enterCount || 1;
|
|
30104
30104
|
await adapter.writeRaw(cliCommand.text + "\r");
|
|
30105
30105
|
for (let i = 1; i < enterCount; i += 1) {
|
|
30106
|
-
await new Promise((
|
|
30106
|
+
await new Promise((resolve162) => setTimeout(resolve162, 50));
|
|
30107
30107
|
await adapter.writeRaw("\r");
|
|
30108
30108
|
}
|
|
30109
30109
|
}
|
|
@@ -30483,7 +30483,7 @@ async function waitForCliAdapterReady(adapter, options) {
|
|
|
30483
30483
|
if (status === "stopped") {
|
|
30484
30484
|
throw new Error("CLI runtime stopped before it became ready");
|
|
30485
30485
|
}
|
|
30486
|
-
await new Promise((
|
|
30486
|
+
await new Promise((resolve162) => setTimeout(resolve162, pollMs));
|
|
30487
30487
|
}
|
|
30488
30488
|
throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
|
|
30489
30489
|
}
|
|
@@ -31043,17 +31043,17 @@ async function findFreePort(ports) {
|
|
|
31043
31043
|
throw new Error("No free port found");
|
|
31044
31044
|
}
|
|
31045
31045
|
function checkPortFree(port) {
|
|
31046
|
-
return new Promise((
|
|
31046
|
+
return new Promise((resolve162) => {
|
|
31047
31047
|
const server = net2.createServer();
|
|
31048
31048
|
server.unref();
|
|
31049
|
-
server.on("error", () =>
|
|
31049
|
+
server.on("error", () => resolve162(false));
|
|
31050
31050
|
server.listen(port, "127.0.0.1", () => {
|
|
31051
|
-
server.close(() =>
|
|
31051
|
+
server.close(() => resolve162(true));
|
|
31052
31052
|
});
|
|
31053
31053
|
});
|
|
31054
31054
|
}
|
|
31055
31055
|
async function isCdpActive(port) {
|
|
31056
|
-
return new Promise((
|
|
31056
|
+
return new Promise((resolve162) => {
|
|
31057
31057
|
const req = __require2("http").get(`http://127.0.0.1:${port}/json/version`, {
|
|
31058
31058
|
timeout: 2e3
|
|
31059
31059
|
}, (res) => {
|
|
@@ -31062,16 +31062,16 @@ async function isCdpActive(port) {
|
|
|
31062
31062
|
res.on("end", () => {
|
|
31063
31063
|
try {
|
|
31064
31064
|
const info = JSON.parse(data);
|
|
31065
|
-
|
|
31065
|
+
resolve162(!!info["WebKit-Version"] || !!info["Browser"]);
|
|
31066
31066
|
} catch {
|
|
31067
|
-
|
|
31067
|
+
resolve162(false);
|
|
31068
31068
|
}
|
|
31069
31069
|
});
|
|
31070
31070
|
});
|
|
31071
|
-
req.on("error", () =>
|
|
31071
|
+
req.on("error", () => resolve162(false));
|
|
31072
31072
|
req.on("timeout", () => {
|
|
31073
31073
|
req.destroy();
|
|
31074
|
-
|
|
31074
|
+
resolve162(false);
|
|
31075
31075
|
});
|
|
31076
31076
|
});
|
|
31077
31077
|
}
|
|
@@ -31525,11 +31525,23 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
31525
31525
|
if (!path26) {
|
|
31526
31526
|
return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
|
|
31527
31527
|
}
|
|
31528
|
+
const mcpServer = resolveAdhdevMcpServerLaunch({
|
|
31529
|
+
meshId,
|
|
31530
|
+
nodeExecutable: options.nodeExecutable,
|
|
31531
|
+
adhdevMcpEntryPath: options.adhdevMcpEntryPath
|
|
31532
|
+
});
|
|
31533
|
+
if (!mcpServer) {
|
|
31534
|
+
return {
|
|
31535
|
+
kind: "unsupported",
|
|
31536
|
+
reason: "Could not resolve the ADHDev MCP server entrypoint without relying on a PATH bin shim"
|
|
31537
|
+
};
|
|
31538
|
+
}
|
|
31528
31539
|
return {
|
|
31529
31540
|
kind: "auto_import",
|
|
31530
31541
|
serverName,
|
|
31531
31542
|
configPath: (0, import_path4.join)(workspace, path26),
|
|
31532
|
-
configFormat: mcpConfig.format
|
|
31543
|
+
configFormat: mcpConfig.format,
|
|
31544
|
+
mcpServer
|
|
31533
31545
|
};
|
|
31534
31546
|
}
|
|
31535
31547
|
if (mcpConfig.mode === "manual") {
|
|
@@ -31561,6 +31573,53 @@ function resolveMeshCoordinatorSetup(options) {
|
|
|
31561
31573
|
function renderMeshCoordinatorTemplate(template, values) {
|
|
31562
31574
|
return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_, key) => values[key] || "");
|
|
31563
31575
|
}
|
|
31576
|
+
function resolveAdhdevMcpServerLaunch(options) {
|
|
31577
|
+
const entryPath = resolveAdhdevMcpEntryPath(options.adhdevMcpEntryPath);
|
|
31578
|
+
if (!entryPath) return null;
|
|
31579
|
+
return {
|
|
31580
|
+
command: options.nodeExecutable?.trim() || process.execPath,
|
|
31581
|
+
args: [entryPath, "--repo-mesh", options.meshId]
|
|
31582
|
+
};
|
|
31583
|
+
}
|
|
31584
|
+
function resolveAdhdevMcpEntryPath(explicitPath) {
|
|
31585
|
+
const explicit = explicitPath?.trim();
|
|
31586
|
+
if (explicit) return normalizeExistingPath(explicit) || explicit;
|
|
31587
|
+
const envPath = process.env.ADHDEV_MCP_SERVER_PATH?.trim();
|
|
31588
|
+
if (envPath) return normalizeExistingPath(envPath) || envPath;
|
|
31589
|
+
const candidates = [];
|
|
31590
|
+
const addCandidate = (candidate) => {
|
|
31591
|
+
if (!candidates.includes(candidate)) candidates.push(candidate);
|
|
31592
|
+
};
|
|
31593
|
+
const addPackagedCandidates = (baseFile) => {
|
|
31594
|
+
if (!baseFile) return;
|
|
31595
|
+
const realBase = normalizeExistingPath(baseFile) || baseFile;
|
|
31596
|
+
const dir = (0, import_path4.dirname)(realBase);
|
|
31597
|
+
addCandidate((0, import_path4.resolve)(dir, "../vendor/mcp-server/index.js"));
|
|
31598
|
+
addCandidate((0, import_path4.resolve)(dir, "../../vendor/mcp-server/index.js"));
|
|
31599
|
+
addCandidate((0, import_path4.resolve)(dir, "../../../vendor/mcp-server/index.js"));
|
|
31600
|
+
};
|
|
31601
|
+
addPackagedCandidates(process.argv[1]);
|
|
31602
|
+
for (const candidate of candidates) {
|
|
31603
|
+
const normalized = normalizeExistingPath(candidate);
|
|
31604
|
+
if (normalized) return normalized;
|
|
31605
|
+
}
|
|
31606
|
+
try {
|
|
31607
|
+
const requireBase = process.argv[1] ? normalizeExistingPath(process.argv[1]) || process.argv[1] : (0, import_path4.join)(process.cwd(), "adhdev-daemon.js");
|
|
31608
|
+
const req = (0, import_module2.createRequire)(requireBase);
|
|
31609
|
+
const resolvedModule = req.resolve("@adhdev/mcp-server");
|
|
31610
|
+
return normalizeExistingPath(resolvedModule) || resolvedModule;
|
|
31611
|
+
} catch {
|
|
31612
|
+
return null;
|
|
31613
|
+
}
|
|
31614
|
+
}
|
|
31615
|
+
function normalizeExistingPath(filePath) {
|
|
31616
|
+
try {
|
|
31617
|
+
if (!(0, import_fs8.existsSync)(filePath)) return null;
|
|
31618
|
+
return import_fs8.realpathSync.native(filePath);
|
|
31619
|
+
} catch {
|
|
31620
|
+
return null;
|
|
31621
|
+
}
|
|
31622
|
+
}
|
|
31564
31623
|
function buildRecentReadDebugSignature(snapshot) {
|
|
31565
31624
|
return [
|
|
31566
31625
|
snapshot.providerType,
|
|
@@ -32052,7 +32111,7 @@ async function waitForPidExit(pid, timeoutMs) {
|
|
|
32052
32111
|
while (Date.now() - start < timeoutMs) {
|
|
32053
32112
|
try {
|
|
32054
32113
|
process.kill(pid, 0);
|
|
32055
|
-
await new Promise((
|
|
32114
|
+
await new Promise((resolve162) => setTimeout(resolve162, 250));
|
|
32056
32115
|
} catch {
|
|
32057
32116
|
return;
|
|
32058
32117
|
}
|
|
@@ -32163,7 +32222,7 @@ async function runDaemonUpgradeHelper(payload) {
|
|
|
32163
32222
|
appendUpgradeLog(installOutput.trim());
|
|
32164
32223
|
}
|
|
32165
32224
|
if (process.platform === "win32") {
|
|
32166
|
-
await new Promise((
|
|
32225
|
+
await new Promise((resolve162) => setTimeout(resolve162, 500));
|
|
32167
32226
|
cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
|
|
32168
32227
|
appendUpgradeLog("Post-install staging cleanup complete");
|
|
32169
32228
|
}
|
|
@@ -34119,7 +34178,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
|
|
|
34119
34178
|
return { target, instance, adapter };
|
|
34120
34179
|
}
|
|
34121
34180
|
function sleep(ms) {
|
|
34122
|
-
return new Promise((
|
|
34181
|
+
return new Promise((resolve162) => setTimeout(resolve162, ms));
|
|
34123
34182
|
}
|
|
34124
34183
|
async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
|
|
34125
34184
|
const startedAt = Date.now();
|
|
@@ -36273,7 +36332,7 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS) {
|
|
|
36273
36332
|
const deadline = Date.now() + timeoutMs;
|
|
36274
36333
|
while (Date.now() < deadline) {
|
|
36275
36334
|
if (await canConnect(endpoint)) return;
|
|
36276
|
-
await new Promise((
|
|
36335
|
+
await new Promise((resolve162) => setTimeout(resolve162, STARTUP_POLL_MS));
|
|
36277
36336
|
}
|
|
36278
36337
|
throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
|
|
36279
36338
|
}
|
|
@@ -36360,10 +36419,10 @@ async function installExtension(ide, extension) {
|
|
|
36360
36419
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
36361
36420
|
const fs16 = await import("fs");
|
|
36362
36421
|
fs16.writeFileSync(vsixPath, buffer);
|
|
36363
|
-
return new Promise((
|
|
36422
|
+
return new Promise((resolve162) => {
|
|
36364
36423
|
const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
|
|
36365
36424
|
(0, import_child_process12.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
|
|
36366
|
-
|
|
36425
|
+
resolve162({
|
|
36367
36426
|
extensionId: extension.id,
|
|
36368
36427
|
marketplaceId: extension.marketplaceId,
|
|
36369
36428
|
success: !error48,
|
|
@@ -36376,11 +36435,11 @@ async function installExtension(ide, extension) {
|
|
|
36376
36435
|
} catch (e) {
|
|
36377
36436
|
}
|
|
36378
36437
|
}
|
|
36379
|
-
return new Promise((
|
|
36438
|
+
return new Promise((resolve162) => {
|
|
36380
36439
|
const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
|
|
36381
36440
|
(0, import_child_process12.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
|
|
36382
36441
|
if (error48) {
|
|
36383
|
-
|
|
36442
|
+
resolve162({
|
|
36384
36443
|
extensionId: extension.id,
|
|
36385
36444
|
marketplaceId: extension.marketplaceId,
|
|
36386
36445
|
success: false,
|
|
@@ -36388,7 +36447,7 @@ async function installExtension(ide, extension) {
|
|
|
36388
36447
|
error: stderr || error48.message
|
|
36389
36448
|
});
|
|
36390
36449
|
} else {
|
|
36391
|
-
|
|
36450
|
+
resolve162({
|
|
36392
36451
|
extensionId: extension.id,
|
|
36393
36452
|
marketplaceId: extension.marketplaceId,
|
|
36394
36453
|
success: true,
|
|
@@ -36684,7 +36743,7 @@ async function shutdownDaemonComponents(components) {
|
|
|
36684
36743
|
}
|
|
36685
36744
|
cdpManagers.clear();
|
|
36686
36745
|
}
|
|
36687
|
-
var import_os, import_path, import_fs, import_crypto2, import_fs2, import_path2, import_crypto3, fs2, path9, os4, os8, os9, path13, import_child_process, os10, path14, os11, import_child_process2, import_fs3, import_promises4, path, import_util3, import_promises5, path22, path32, fs, os5, path4, import_crypto4, path5, path6, import_fs4, import_path3, import_child_process3, import_fs5, import_os2, path7, import_child_process4, os22, path8, import_fs6, os32, import_child_process5, http, crypto2, fs3, path10, os52, fs4, os6, path11, import_crypto5, fs5, path12, os7, os13, path16, crypto4, import_fs7, import_child_process6, os12, path15, crypto3, fs6, import_module, import_stream2, import_child_process7, import_child_process8, net2, os15, path18, fs7, path17, os14, fs8, path19, os16, import_path4, os17, import_child_process9, import_child_process10, fs9, os18, path20, fs10, fs11, path21, os19, import_child_process11, import_os3, http2, fs15, path25, fs12, path222, fs13, path23, fs14, path24, os20, import_child_process12, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __require2, __esm2, __export2, __copyProps2, __toCommonJS, DEFAULT_MESH_POLICY, init_repo_mesh_types, config_exports, DEFAULT_CONFIG, MACHINE_ID_PREFIX, init_config, mesh_config_exports, init_mesh_config, coordinator_prompt_exports, TOOLS_SECTION, WORKFLOW_SECTION, RULES_SECTION, init_coordinator_prompt, LEVEL_NUM, LEVEL_LABEL, currentLevel, LOG_DIR, MAX_LOG_SIZE, MAX_LOG_DAYS, currentDate, currentLogFile, writeCount, RING_BUFFER_SIZE, ringBuffer, origConsoleLog, origConsoleError, origConsoleWarn, LOG, interceptorInstalled, LOG_PATH, init_logger, NORMAL_TRACE_BUFFER_SIZE, DEV_TRACE_BUFFER_SIZE, DEFAULT_CONFIG2, currentConfig, init_debug_config, DEFAULT_BINDING_CANDIDATES, cachedBinding, cachedBindingError, GhosttyVtTerminalBackend, init_ghostty_vt_backend, TerminalCtor, XtermTerminalBackend, init_xterm_backend, DEFAULT_SCROLLBACK, loggedTerminalBackends, TerminalScreen, init_terminal_screen, init_spawn_env, cachedPty, NodePtyRuntimeTransport, NodePtyTransportFactory, init_pty_transport, buildCliSpawnEnv, init_provider_cli_shared, init_provider_cli_parse, init_provider_cli_config, init_provider_cli_runtime, provider_cli_adapter_exports, ProviderCliAdapter, init_provider_cli_adapter, execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GitCommandError, DEFAULT_MAX_FILES, DEFAULT_MAX_BYTES, summarizeGitStatus, InMemoryGitSnapshotStore, DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS, MIN_GIT_WORKSPACE_POLL_INTERVAL_MS, GitWorkspaceMonitor, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices, BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker, MAX_WORKSPACES, MAX_ACTIVITY, MAX_SAVED_SESSIONS, DEFAULT_STATE, BUILTIN_IDE_DEFINITIONS, registeredIDEs, LIVE_LIFECYCLES, DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS, LIVE_RUNTIME_LIFECYCLES, DaemonCdpManager, CdpDomHandlers, DEFAULT_MONITOR_CONFIG, StatusMonitor, BUILTIN_CHAT_MESSAGE_KINDS, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter, IDE_PROVIDER_SESSION_CAPABILITIES_BASE, EXTENSION_PROVIDER_SESSION_CAPABILITIES_BASE, ExtensionProviderInstance, VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES, DEFAULT_APPROVAL_POSITIVE_HINTS, IdeProviderInstance, DEFAULT_CDP_SCAN_INTERVAL_MS, DEFAULT_CDP_DISCOVERY_INTERVAL_MS, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS, MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_READY_TIMEOUT_MS, STANDALONE_CDP_SCAN_INTERVAL_MS, DaemonCdpScanner, DaemonCdpInitializer, WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT, IDE_SESSION_CAPABILITIES, EXTENSION_SESSION_CAPABILITIES, PTY_SESSION_CAPABILITIES, CLI_CHAT_SESSION_CAPABILITIES, ACP_SESSION_CAPABILITIES, VALID_INPUT_MEDIA_TYPES, globalStore, RECENT_SEND_WINDOW_MS, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, recentSendByTarget, DEFAULT_DEBUG_SANITIZE_OPTIONS, SECRET_KEY_PATTERN, KEY_TO_VK, COMMAND_DEBUG_LEVELS, DaemonCommandHandler, CachedDatabaseSync, CliProviderInstance, AcpProviderInstance, chalkModule, chalkApi, DaemonCliManager, VALID_CAPABILITY_MEDIA_TYPES, KNOWN_PROVIDER_FIELDS, VALUE_CONTROL_TYPES, ProviderLoader, _providerLoader, LOG_DIR2, MAX_FILE_SIZE, MAX_DAYS, SENSITIVE_KEYS, currentDate2, currentFile, writeCount2, SKIP_COMMANDS, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND, READ_DEBUG_ENABLED, recentReadDebugSignatureBySession, UPGRADE_HELPER_ENV, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter, DaemonStatusReporter, DEFAULT_DAEMON_PORT, DAEMON_WS_PATH, ProviderStreamAdapter, DaemonAgentStreamManager, AgentStreamPoller, ProviderInstanceManager, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive, DEV_SERVER_PORT, DevServer, SessionHostRuntimeTransport, SessionHostPtyTransportFactory, DEFAULT_SESSION_HOST_APP_NAME, DEFAULT_STANDALONE_SESSION_HOST_APP_NAME, STARTUP_TIMEOUT_MS, STARTUP_POLL_MS, EXTENSION_CATALOG, SessionRegistry;
|
|
36746
|
+
var import_os, import_path, import_fs, import_crypto2, import_fs2, import_path2, import_crypto3, fs2, path9, os4, os8, os9, path13, import_child_process, os10, path14, os11, import_child_process2, import_fs3, import_promises4, path, import_util3, import_promises5, path22, path32, fs, os5, path4, import_crypto4, path5, path6, import_fs4, import_path3, import_child_process3, import_fs5, import_os2, path7, import_child_process4, os22, path8, import_fs6, os32, import_child_process5, http, crypto2, fs3, path10, os52, fs4, os6, path11, import_crypto5, fs5, path12, os7, os13, path16, crypto4, import_fs7, import_child_process6, os12, path15, crypto3, fs6, import_module, import_stream2, import_child_process7, import_child_process8, net2, os15, path18, fs7, path17, os14, fs8, path19, os16, import_fs8, import_module2, import_path4, os17, import_child_process9, import_child_process10, fs9, os18, path20, fs10, fs11, path21, os19, import_child_process11, import_os3, http2, fs15, path25, fs12, path222, fs13, path23, fs14, path24, os20, import_child_process12, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __require2, __esm2, __export2, __copyProps2, __toCommonJS, DEFAULT_MESH_POLICY, init_repo_mesh_types, config_exports, DEFAULT_CONFIG, MACHINE_ID_PREFIX, init_config, mesh_config_exports, init_mesh_config, coordinator_prompt_exports, TOOLS_SECTION, WORKFLOW_SECTION, RULES_SECTION, init_coordinator_prompt, LEVEL_NUM, LEVEL_LABEL, currentLevel, LOG_DIR, MAX_LOG_SIZE, MAX_LOG_DAYS, currentDate, currentLogFile, writeCount, RING_BUFFER_SIZE, ringBuffer, origConsoleLog, origConsoleError, origConsoleWarn, LOG, interceptorInstalled, LOG_PATH, init_logger, NORMAL_TRACE_BUFFER_SIZE, DEV_TRACE_BUFFER_SIZE, DEFAULT_CONFIG2, currentConfig, init_debug_config, DEFAULT_BINDING_CANDIDATES, cachedBinding, cachedBindingError, GhosttyVtTerminalBackend, init_ghostty_vt_backend, TerminalCtor, XtermTerminalBackend, init_xterm_backend, DEFAULT_SCROLLBACK, loggedTerminalBackends, TerminalScreen, init_terminal_screen, init_spawn_env, cachedPty, NodePtyRuntimeTransport, NodePtyTransportFactory, init_pty_transport, buildCliSpawnEnv, init_provider_cli_shared, init_provider_cli_parse, init_provider_cli_config, init_provider_cli_runtime, provider_cli_adapter_exports, ProviderCliAdapter, init_provider_cli_adapter, execFileAsync, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_BUFFER, GitCommandError, DEFAULT_MAX_FILES, DEFAULT_MAX_BYTES, summarizeGitStatus, InMemoryGitSnapshotStore, DEFAULT_GIT_WORKSPACE_POLL_INTERVAL_MS, MIN_GIT_WORKSPACE_POLL_INTERVAL_MS, GitWorkspaceMonitor, GIT_COMMAND_NAMES, SNAPSHOT_REASONS, FAILURE_REASONS, defaultSnapshotStore, defaultGitCommandServices, BUSY_STATUSES, TERMINAL_STATUSES, TurnSnapshotTracker, MAX_WORKSPACES, MAX_ACTIVITY, MAX_SAVED_SESSIONS, DEFAULT_STATE, BUILTIN_IDE_DEFINITIONS, registeredIDEs, LIVE_LIFECYCLES, DEFAULT_ACTIVE_CHAT_POLL_STATUSES, DEFAULT_CHAT_TAIL_RECENT_MESSAGE_GRACE_MS, LIVE_RUNTIME_LIFECYCLES, DaemonCdpManager, CdpDomHandlers, DEFAULT_MONITOR_CONFIG, StatusMonitor, BUILTIN_CHAT_MESSAGE_KINDS, KNOWN_CHAT_MESSAGE_KINDS, CHAT_MESSAGE_KIND_ALIASES, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter, IDE_PROVIDER_SESSION_CAPABILITIES_BASE, EXTENSION_PROVIDER_SESSION_CAPABILITIES_BASE, ExtensionProviderInstance, VALID_STATUSES, VALID_ROLES, VALID_BUBBLE_STATES, VALID_TURN_STATUSES, DEFAULT_APPROVAL_POSITIVE_HINTS, IdeProviderInstance, DEFAULT_CDP_SCAN_INTERVAL_MS, DEFAULT_CDP_DISCOVERY_INTERVAL_MS, DEFAULT_STATUS_INITIAL_REPORT_DELAY_MS, DEFAULT_STATUS_SERVER_REPORT_INTERVAL_MS, DEFAULT_STATUS_P2P_REPORT_INTERVAL_MS, MIN_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, DEFAULT_MACHINE_RUNTIME_SUBSCRIPTION_INTERVAL_MS, MIN_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_DIAGNOSTICS_SUBSCRIPTION_INTERVAL_MS, DEFAULT_SESSION_HOST_READY_TIMEOUT_MS, STANDALONE_CDP_SCAN_INTERVAL_MS, DaemonCdpScanner, DaemonCdpInitializer, WORKING_STATUSES, FULL_STATUS_ACTIVE_CHAT_OPTIONS, LIVE_STATUS_ACTIVE_CHAT_OPTIONS, STATUS_MODAL_MESSAGE_LIMIT, STATUS_MODAL_BUTTON_LIMIT, IDE_SESSION_CAPABILITIES, EXTENSION_SESSION_CAPABILITIES, PTY_SESSION_CAPABILITIES, CLI_CHAT_SESSION_CAPABILITIES, ACP_SESSION_CAPABILITIES, VALID_INPUT_MEDIA_TYPES, globalStore, RECENT_SEND_WINDOW_MS, READ_CHAT_PROVIDER_EVAL_TIMEOUT_MS, recentSendByTarget, DEFAULT_DEBUG_SANITIZE_OPTIONS, SECRET_KEY_PATTERN, KEY_TO_VK, COMMAND_DEBUG_LEVELS, DaemonCommandHandler, CachedDatabaseSync, CliProviderInstance, AcpProviderInstance, chalkModule, chalkApi, DaemonCliManager, VALID_CAPABILITY_MEDIA_TYPES, KNOWN_PROVIDER_FIELDS, VALUE_CONTROL_TYPES, ProviderLoader, _providerLoader, LOG_DIR2, MAX_FILE_SIZE, MAX_DAYS, SENSITIVE_KEYS, currentDate2, currentFile, writeCount2, SKIP_COMMANDS, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND, READ_DEBUG_ENABLED, recentReadDebugSignatureBySession, UPGRADE_HELPER_ENV, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter, DaemonStatusReporter, DEFAULT_DAEMON_PORT, DAEMON_WS_PATH, ProviderStreamAdapter, DaemonAgentStreamManager, AgentStreamPoller, ProviderInstanceManager, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive, DEV_SERVER_PORT, DevServer, SessionHostRuntimeTransport, SessionHostPtyTransportFactory, DEFAULT_SESSION_HOST_APP_NAME, DEFAULT_STANDALONE_SESSION_HOST_APP_NAME, STARTUP_TIMEOUT_MS, STARTUP_POLL_MS, EXTENSION_CATALOG, SessionRegistry;
|
|
36688
36747
|
var init_dist2 = __esm({
|
|
36689
36748
|
"../daemon-core/dist/index.mjs"() {
|
|
36690
36749
|
"use strict";
|
|
@@ -36771,6 +36830,8 @@ var init_dist2 = __esm({
|
|
|
36771
36830
|
fs8 = __toESM(require("fs"), 1);
|
|
36772
36831
|
path19 = __toESM(require("path"), 1);
|
|
36773
36832
|
os16 = __toESM(require("os"), 1);
|
|
36833
|
+
import_fs8 = require("fs");
|
|
36834
|
+
import_module2 = require("module");
|
|
36774
36835
|
import_path4 = require("path");
|
|
36775
36836
|
os17 = __toESM(require("os"), 1);
|
|
36776
36837
|
import_child_process9 = require("child_process");
|
|
@@ -37888,7 +37949,7 @@ var init_dist2 = __esm({
|
|
|
37888
37949
|
`[${this.cliType}] Waiting for interactive prompt: status=${status} stableMs=${stableMs} recentOutputMs=${recentlyOutput} screen=${JSON.stringify(summarizeCliTraceText(screenText, 220)).slice(0, 260)}`
|
|
37889
37950
|
);
|
|
37890
37951
|
}
|
|
37891
|
-
await new Promise((
|
|
37952
|
+
await new Promise((resolve162) => setTimeout(resolve162, 50));
|
|
37892
37953
|
}
|
|
37893
37954
|
const finalScreenText = this.terminalScreen.getText() || "";
|
|
37894
37955
|
LOG.warn(
|
|
@@ -38798,7 +38859,7 @@ var init_dist2 = __esm({
|
|
|
38798
38859
|
const deadline = Date.now() + 1e4;
|
|
38799
38860
|
while (this.startupParseGate && Date.now() < deadline) {
|
|
38800
38861
|
this.resolveStartupState("send_wait");
|
|
38801
|
-
await new Promise((
|
|
38862
|
+
await new Promise((resolve162) => setTimeout(resolve162, 50));
|
|
38802
38863
|
}
|
|
38803
38864
|
}
|
|
38804
38865
|
if (!allowInterventionPrompt) {
|
|
@@ -38874,13 +38935,13 @@ var init_dist2 = __esm({
|
|
|
38874
38935
|
}
|
|
38875
38936
|
this.responseEpoch += 1;
|
|
38876
38937
|
this.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
|
|
38877
|
-
await new Promise((
|
|
38938
|
+
await new Promise((resolve162, reject) => {
|
|
38878
38939
|
let resolved = false;
|
|
38879
38940
|
const completion = {
|
|
38880
38941
|
resolveOnce: () => {
|
|
38881
38942
|
if (resolved) return;
|
|
38882
38943
|
resolved = true;
|
|
38883
|
-
|
|
38944
|
+
resolve162();
|
|
38884
38945
|
},
|
|
38885
38946
|
rejectOnce: (error48) => {
|
|
38886
38947
|
if (resolved) return;
|
|
@@ -39038,17 +39099,17 @@ var init_dist2 = __esm({
|
|
|
39038
39099
|
}
|
|
39039
39100
|
}
|
|
39040
39101
|
waitForStopped(timeoutMs) {
|
|
39041
|
-
return new Promise((
|
|
39102
|
+
return new Promise((resolve162) => {
|
|
39042
39103
|
const startedAt = Date.now();
|
|
39043
39104
|
const timer = setInterval(() => {
|
|
39044
39105
|
if (!this.ptyProcess || this.currentStatus === "stopped") {
|
|
39045
39106
|
clearInterval(timer);
|
|
39046
|
-
|
|
39107
|
+
resolve162(true);
|
|
39047
39108
|
return;
|
|
39048
39109
|
}
|
|
39049
39110
|
if (Date.now() - startedAt >= timeoutMs) {
|
|
39050
39111
|
clearInterval(timer);
|
|
39051
|
-
|
|
39112
|
+
resolve162(false);
|
|
39052
39113
|
}
|
|
39053
39114
|
}, 100);
|
|
39054
39115
|
});
|
|
@@ -39647,7 +39708,7 @@ var init_dist2 = __esm({
|
|
|
39647
39708
|
* Returns multiple entries if multiple IDE windows are open on same port
|
|
39648
39709
|
*/
|
|
39649
39710
|
static listAllTargets(port) {
|
|
39650
|
-
return new Promise((
|
|
39711
|
+
return new Promise((resolve162) => {
|
|
39651
39712
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
39652
39713
|
let data = "";
|
|
39653
39714
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -39663,16 +39724,16 @@ var init_dist2 = __esm({
|
|
|
39663
39724
|
(t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
|
|
39664
39725
|
);
|
|
39665
39726
|
const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
|
|
39666
|
-
|
|
39727
|
+
resolve162(mainPages.length > 0 ? mainPages : fallbackPages);
|
|
39667
39728
|
} catch {
|
|
39668
|
-
|
|
39729
|
+
resolve162([]);
|
|
39669
39730
|
}
|
|
39670
39731
|
});
|
|
39671
39732
|
});
|
|
39672
|
-
req.on("error", () =>
|
|
39733
|
+
req.on("error", () => resolve162([]));
|
|
39673
39734
|
req.setTimeout(2e3, () => {
|
|
39674
39735
|
req.destroy();
|
|
39675
|
-
|
|
39736
|
+
resolve162([]);
|
|
39676
39737
|
});
|
|
39677
39738
|
});
|
|
39678
39739
|
}
|
|
@@ -39712,7 +39773,7 @@ var init_dist2 = __esm({
|
|
|
39712
39773
|
}
|
|
39713
39774
|
}
|
|
39714
39775
|
findTargetOnPort(port) {
|
|
39715
|
-
return new Promise((
|
|
39776
|
+
return new Promise((resolve162) => {
|
|
39716
39777
|
const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
|
|
39717
39778
|
let data = "";
|
|
39718
39779
|
res.on("data", (chunk) => data += chunk.toString());
|
|
@@ -39723,7 +39784,7 @@ var init_dist2 = __esm({
|
|
|
39723
39784
|
(t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
|
|
39724
39785
|
);
|
|
39725
39786
|
if (pages.length === 0) {
|
|
39726
|
-
|
|
39787
|
+
resolve162(targets.find((t) => t.webSocketDebuggerUrl) || null);
|
|
39727
39788
|
return;
|
|
39728
39789
|
}
|
|
39729
39790
|
const titleFilteredPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
|
|
@@ -39742,25 +39803,25 @@ var init_dist2 = __esm({
|
|
|
39742
39803
|
this._targetId = selected.target.id;
|
|
39743
39804
|
}
|
|
39744
39805
|
this._pageTitle = selected.target.title || "";
|
|
39745
|
-
|
|
39806
|
+
resolve162(selected.target);
|
|
39746
39807
|
return;
|
|
39747
39808
|
}
|
|
39748
39809
|
if (previousTargetId) {
|
|
39749
39810
|
this.log(`[CDP] Target ${previousTargetId} not found in page list`);
|
|
39750
|
-
|
|
39811
|
+
resolve162(null);
|
|
39751
39812
|
return;
|
|
39752
39813
|
}
|
|
39753
39814
|
this._pageTitle = list[0]?.title || "";
|
|
39754
|
-
|
|
39815
|
+
resolve162(list[0]);
|
|
39755
39816
|
} catch {
|
|
39756
|
-
|
|
39817
|
+
resolve162(null);
|
|
39757
39818
|
}
|
|
39758
39819
|
});
|
|
39759
39820
|
});
|
|
39760
|
-
req.on("error", () =>
|
|
39821
|
+
req.on("error", () => resolve162(null));
|
|
39761
39822
|
req.setTimeout(2e3, () => {
|
|
39762
39823
|
req.destroy();
|
|
39763
|
-
|
|
39824
|
+
resolve162(null);
|
|
39764
39825
|
});
|
|
39765
39826
|
});
|
|
39766
39827
|
}
|
|
@@ -39771,7 +39832,7 @@ var init_dist2 = __esm({
|
|
|
39771
39832
|
this.extensionProviders = providers;
|
|
39772
39833
|
}
|
|
39773
39834
|
connectToTarget(wsUrl) {
|
|
39774
|
-
return new Promise((
|
|
39835
|
+
return new Promise((resolve162) => {
|
|
39775
39836
|
this.ws = new wrapper_default(wsUrl);
|
|
39776
39837
|
this.ws.on("open", async () => {
|
|
39777
39838
|
this._connected = true;
|
|
@@ -39781,17 +39842,17 @@ var init_dist2 = __esm({
|
|
|
39781
39842
|
}
|
|
39782
39843
|
this.connectBrowserWs().catch(() => {
|
|
39783
39844
|
});
|
|
39784
|
-
|
|
39845
|
+
resolve162(true);
|
|
39785
39846
|
});
|
|
39786
39847
|
this.ws.on("message", (data) => {
|
|
39787
39848
|
try {
|
|
39788
39849
|
const msg = JSON.parse(data.toString());
|
|
39789
39850
|
if (msg.id && this.pending.has(msg.id)) {
|
|
39790
|
-
const { resolve:
|
|
39851
|
+
const { resolve: resolve172, reject } = this.pending.get(msg.id);
|
|
39791
39852
|
this.pending.delete(msg.id);
|
|
39792
39853
|
this.failureCount = 0;
|
|
39793
39854
|
if (msg.error) reject(new Error(msg.error.message));
|
|
39794
|
-
else
|
|
39855
|
+
else resolve172(msg.result);
|
|
39795
39856
|
} else if (msg.method === "Runtime.executionContextCreated") {
|
|
39796
39857
|
this.contexts.add(msg.params.context.id);
|
|
39797
39858
|
} else if (msg.method === "Runtime.executionContextDestroyed") {
|
|
@@ -39814,7 +39875,7 @@ var init_dist2 = __esm({
|
|
|
39814
39875
|
this.ws.on("error", (err) => {
|
|
39815
39876
|
this.log(`[CDP] WebSocket error: ${err.message}`);
|
|
39816
39877
|
this._connected = false;
|
|
39817
|
-
|
|
39878
|
+
resolve162(false);
|
|
39818
39879
|
});
|
|
39819
39880
|
});
|
|
39820
39881
|
}
|
|
@@ -39828,7 +39889,7 @@ var init_dist2 = __esm({
|
|
|
39828
39889
|
return;
|
|
39829
39890
|
}
|
|
39830
39891
|
this.log(`[CDP] Connecting browser WS for target discovery...`);
|
|
39831
|
-
await new Promise((
|
|
39892
|
+
await new Promise((resolve162, reject) => {
|
|
39832
39893
|
this.browserWs = new wrapper_default(browserWsUrl);
|
|
39833
39894
|
this.browserWs.on("open", async () => {
|
|
39834
39895
|
this._browserConnected = true;
|
|
@@ -39838,16 +39899,16 @@ var init_dist2 = __esm({
|
|
|
39838
39899
|
} catch (e) {
|
|
39839
39900
|
this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
|
|
39840
39901
|
}
|
|
39841
|
-
|
|
39902
|
+
resolve162();
|
|
39842
39903
|
});
|
|
39843
39904
|
this.browserWs.on("message", (data) => {
|
|
39844
39905
|
try {
|
|
39845
39906
|
const msg = JSON.parse(data.toString());
|
|
39846
39907
|
if (msg.id && this.browserPending.has(msg.id)) {
|
|
39847
|
-
const { resolve:
|
|
39908
|
+
const { resolve: resolve172, reject: reject2 } = this.browserPending.get(msg.id);
|
|
39848
39909
|
this.browserPending.delete(msg.id);
|
|
39849
39910
|
if (msg.error) reject2(new Error(msg.error.message));
|
|
39850
|
-
else
|
|
39911
|
+
else resolve172(msg.result);
|
|
39851
39912
|
}
|
|
39852
39913
|
} catch {
|
|
39853
39914
|
}
|
|
@@ -39867,31 +39928,31 @@ var init_dist2 = __esm({
|
|
|
39867
39928
|
}
|
|
39868
39929
|
}
|
|
39869
39930
|
getBrowserWsUrl() {
|
|
39870
|
-
return new Promise((
|
|
39931
|
+
return new Promise((resolve162) => {
|
|
39871
39932
|
const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
|
|
39872
39933
|
let data = "";
|
|
39873
39934
|
res.on("data", (chunk) => data += chunk.toString());
|
|
39874
39935
|
res.on("end", () => {
|
|
39875
39936
|
try {
|
|
39876
39937
|
const info = JSON.parse(data);
|
|
39877
|
-
|
|
39938
|
+
resolve162(info.webSocketDebuggerUrl || null);
|
|
39878
39939
|
} catch {
|
|
39879
|
-
|
|
39940
|
+
resolve162(null);
|
|
39880
39941
|
}
|
|
39881
39942
|
});
|
|
39882
39943
|
});
|
|
39883
|
-
req.on("error", () =>
|
|
39944
|
+
req.on("error", () => resolve162(null));
|
|
39884
39945
|
req.setTimeout(3e3, () => {
|
|
39885
39946
|
req.destroy();
|
|
39886
|
-
|
|
39947
|
+
resolve162(null);
|
|
39887
39948
|
});
|
|
39888
39949
|
});
|
|
39889
39950
|
}
|
|
39890
39951
|
sendBrowser(method, params = {}, timeoutMs = 15e3) {
|
|
39891
|
-
return new Promise((
|
|
39952
|
+
return new Promise((resolve162, reject) => {
|
|
39892
39953
|
if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
|
|
39893
39954
|
const id = this.browserMsgId++;
|
|
39894
|
-
this.browserPending.set(id, { resolve:
|
|
39955
|
+
this.browserPending.set(id, { resolve: resolve162, reject });
|
|
39895
39956
|
this.browserWs.send(JSON.stringify({ id, method, params }));
|
|
39896
39957
|
setTimeout(() => {
|
|
39897
39958
|
if (this.browserPending.has(id)) {
|
|
@@ -39931,11 +39992,11 @@ var init_dist2 = __esm({
|
|
|
39931
39992
|
}
|
|
39932
39993
|
// ─── CDP Protocol ────────────────────────────────────────
|
|
39933
39994
|
sendInternal(method, params = {}, timeoutMs = 15e3) {
|
|
39934
|
-
return new Promise((
|
|
39995
|
+
return new Promise((resolve162, reject) => {
|
|
39935
39996
|
if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
|
|
39936
39997
|
if (this.ws.readyState !== wrapper_default.OPEN) return reject(new Error("WebSocket not open"));
|
|
39937
39998
|
const id = this.msgId++;
|
|
39938
|
-
this.pending.set(id, { resolve:
|
|
39999
|
+
this.pending.set(id, { resolve: resolve162, reject });
|
|
39939
40000
|
this.ws.send(JSON.stringify({ id, method, params }));
|
|
39940
40001
|
setTimeout(() => {
|
|
39941
40002
|
if (this.pending.has(id)) {
|
|
@@ -40184,7 +40245,7 @@ var init_dist2 = __esm({
|
|
|
40184
40245
|
const browserWs = this.browserWs;
|
|
40185
40246
|
let msgId = this.browserMsgId;
|
|
40186
40247
|
const sendWs = (method, params = {}, sessionId) => {
|
|
40187
|
-
return new Promise((
|
|
40248
|
+
return new Promise((resolve162, reject) => {
|
|
40188
40249
|
const mid = msgId++;
|
|
40189
40250
|
this.browserMsgId = msgId;
|
|
40190
40251
|
const handler = (raw) => {
|
|
@@ -40193,7 +40254,7 @@ var init_dist2 = __esm({
|
|
|
40193
40254
|
if (msg.id === mid) {
|
|
40194
40255
|
browserWs.removeListener("message", handler);
|
|
40195
40256
|
if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
|
|
40196
|
-
else
|
|
40257
|
+
else resolve162(msg.result);
|
|
40197
40258
|
}
|
|
40198
40259
|
} catch {
|
|
40199
40260
|
}
|
|
@@ -40394,14 +40455,14 @@ var init_dist2 = __esm({
|
|
|
40394
40455
|
if (!ws || ws.readyState !== wrapper_default.OPEN) {
|
|
40395
40456
|
throw new Error("CDP not connected");
|
|
40396
40457
|
}
|
|
40397
|
-
return new Promise((
|
|
40458
|
+
return new Promise((resolve162, reject) => {
|
|
40398
40459
|
const id = getNextId();
|
|
40399
40460
|
pendingMap.set(id, {
|
|
40400
40461
|
resolve: (result) => {
|
|
40401
40462
|
if (result?.result?.subtype === "error") {
|
|
40402
40463
|
reject(new Error(result.result.description));
|
|
40403
40464
|
} else {
|
|
40404
|
-
|
|
40465
|
+
resolve162(result?.result?.value);
|
|
40405
40466
|
}
|
|
40406
40467
|
},
|
|
40407
40468
|
reject
|
|
@@ -40433,10 +40494,10 @@ var init_dist2 = __esm({
|
|
|
40433
40494
|
throw new Error("CDP not connected");
|
|
40434
40495
|
}
|
|
40435
40496
|
const sendViaSession = (method, params = {}) => {
|
|
40436
|
-
return new Promise((
|
|
40497
|
+
return new Promise((resolve162, reject) => {
|
|
40437
40498
|
const pendingMap = this._browserConnected ? this.browserPending : this.pending;
|
|
40438
40499
|
const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
|
|
40439
|
-
pendingMap.set(id, { resolve:
|
|
40500
|
+
pendingMap.set(id, { resolve: resolve162, reject });
|
|
40440
40501
|
ws.send(JSON.stringify({ id, sessionId, method, params }));
|
|
40441
40502
|
setTimeout(() => {
|
|
40442
40503
|
if (pendingMap.has(id)) {
|
|
@@ -43174,7 +43235,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43174
43235
|
try {
|
|
43175
43236
|
const http3 = await import("http");
|
|
43176
43237
|
const postData = JSON.stringify(body);
|
|
43177
|
-
const result = await new Promise((
|
|
43238
|
+
const result = await new Promise((resolve162, reject) => {
|
|
43178
43239
|
const req = http3.request({
|
|
43179
43240
|
hostname: "127.0.0.1",
|
|
43180
43241
|
port: 19280,
|
|
@@ -43186,9 +43247,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43186
43247
|
res.on("data", (chunk) => data += chunk);
|
|
43187
43248
|
res.on("end", () => {
|
|
43188
43249
|
try {
|
|
43189
|
-
|
|
43250
|
+
resolve162(JSON.parse(data));
|
|
43190
43251
|
} catch {
|
|
43191
|
-
|
|
43252
|
+
resolve162({ raw: data });
|
|
43192
43253
|
}
|
|
43193
43254
|
});
|
|
43194
43255
|
});
|
|
@@ -43206,15 +43267,15 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43206
43267
|
if (!providerType) return { success: false, error: "providerType required" };
|
|
43207
43268
|
try {
|
|
43208
43269
|
const http3 = await import("http");
|
|
43209
|
-
const result = await new Promise((
|
|
43270
|
+
const result = await new Promise((resolve162, reject) => {
|
|
43210
43271
|
http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
|
|
43211
43272
|
let data = "";
|
|
43212
43273
|
res.on("data", (chunk) => data += chunk);
|
|
43213
43274
|
res.on("end", () => {
|
|
43214
43275
|
try {
|
|
43215
|
-
|
|
43276
|
+
resolve162(JSON.parse(data));
|
|
43216
43277
|
} catch {
|
|
43217
|
-
|
|
43278
|
+
resolve162({ raw: data });
|
|
43218
43279
|
}
|
|
43219
43280
|
});
|
|
43220
43281
|
}).on("error", reject);
|
|
@@ -43228,7 +43289,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43228
43289
|
try {
|
|
43229
43290
|
const http3 = await import("http");
|
|
43230
43291
|
const postData = JSON.stringify(args || {});
|
|
43231
|
-
const result = await new Promise((
|
|
43292
|
+
const result = await new Promise((resolve162, reject) => {
|
|
43232
43293
|
const req = http3.request({
|
|
43233
43294
|
hostname: "127.0.0.1",
|
|
43234
43295
|
port: 19280,
|
|
@@ -43240,9 +43301,9 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43240
43301
|
res.on("data", (chunk) => data += chunk);
|
|
43241
43302
|
res.on("end", () => {
|
|
43242
43303
|
try {
|
|
43243
|
-
|
|
43304
|
+
resolve162(JSON.parse(data));
|
|
43244
43305
|
} catch {
|
|
43245
|
-
|
|
43306
|
+
resolve162({ raw: data });
|
|
43246
43307
|
}
|
|
43247
43308
|
});
|
|
43248
43309
|
});
|
|
@@ -43600,7 +43661,7 @@ ${effect.notification.body || ""}`.trim();
|
|
|
43600
43661
|
const enterCount = cliCommand.enterCount || 1;
|
|
43601
43662
|
await this.adapter.writeRaw(cliCommand.text + "\r");
|
|
43602
43663
|
for (let i = 1; i < enterCount; i += 1) {
|
|
43603
|
-
await new Promise((
|
|
43664
|
+
await new Promise((resolve162) => setTimeout(resolve162, 50));
|
|
43604
43665
|
await this.adapter.writeRaw("\r");
|
|
43605
43666
|
}
|
|
43606
43667
|
}
|
|
@@ -44619,13 +44680,13 @@ ${effect.notification.body || ""}`.trim();
|
|
|
44619
44680
|
}
|
|
44620
44681
|
this.currentStatus = "waiting_approval";
|
|
44621
44682
|
this.detectStatusTransition();
|
|
44622
|
-
const approved = await new Promise((
|
|
44623
|
-
this.permissionResolvers.push(
|
|
44683
|
+
const approved = await new Promise((resolve162) => {
|
|
44684
|
+
this.permissionResolvers.push(resolve162);
|
|
44624
44685
|
setTimeout(() => {
|
|
44625
|
-
const idx = this.permissionResolvers.indexOf(
|
|
44686
|
+
const idx = this.permissionResolvers.indexOf(resolve162);
|
|
44626
44687
|
if (idx >= 0) {
|
|
44627
44688
|
this.permissionResolvers.splice(idx, 1);
|
|
44628
|
-
|
|
44689
|
+
resolve162(false);
|
|
44629
44690
|
}
|
|
44630
44691
|
}, 3e5);
|
|
44631
44692
|
});
|
|
@@ -46820,7 +46881,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46820
46881
|
return { updated: false };
|
|
46821
46882
|
}
|
|
46822
46883
|
try {
|
|
46823
|
-
const etag = await new Promise((
|
|
46884
|
+
const etag = await new Promise((resolve162, reject) => {
|
|
46824
46885
|
const options = {
|
|
46825
46886
|
method: "HEAD",
|
|
46826
46887
|
hostname: "github.com",
|
|
@@ -46838,7 +46899,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46838
46899
|
headers: { "User-Agent": "adhdev-launcher" },
|
|
46839
46900
|
timeout: 1e4
|
|
46840
46901
|
}, (res2) => {
|
|
46841
|
-
|
|
46902
|
+
resolve162(res2.headers.etag || res2.headers["last-modified"] || "");
|
|
46842
46903
|
});
|
|
46843
46904
|
req2.on("error", reject);
|
|
46844
46905
|
req2.on("timeout", () => {
|
|
@@ -46847,7 +46908,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46847
46908
|
});
|
|
46848
46909
|
req2.end();
|
|
46849
46910
|
} else {
|
|
46850
|
-
|
|
46911
|
+
resolve162(res.headers.etag || res.headers["last-modified"] || "");
|
|
46851
46912
|
}
|
|
46852
46913
|
});
|
|
46853
46914
|
req.on("error", reject);
|
|
@@ -46911,7 +46972,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46911
46972
|
downloadFile(url2, destPath) {
|
|
46912
46973
|
const https = __require2("https");
|
|
46913
46974
|
const http3 = __require2("http");
|
|
46914
|
-
return new Promise((
|
|
46975
|
+
return new Promise((resolve162, reject) => {
|
|
46915
46976
|
const doRequest = (reqUrl, redirectCount = 0) => {
|
|
46916
46977
|
if (redirectCount > 5) {
|
|
46917
46978
|
reject(new Error("Too many redirects"));
|
|
@@ -46931,7 +46992,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
46931
46992
|
res.pipe(ws);
|
|
46932
46993
|
ws.on("finish", () => {
|
|
46933
46994
|
ws.close();
|
|
46934
|
-
|
|
46995
|
+
resolve162();
|
|
46935
46996
|
});
|
|
46936
46997
|
ws.on("error", reject);
|
|
46937
46998
|
});
|
|
@@ -48172,7 +48233,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48172
48233
|
}
|
|
48173
48234
|
if (!mesh) return { success: false, error: "Mesh not found" };
|
|
48174
48235
|
if (!Array.isArray(mesh.nodes) || mesh.nodes.length === 0) return { success: false, error: "No nodes in mesh" };
|
|
48175
|
-
const
|
|
48236
|
+
const requestedCoordinatorNodeId = typeof args?.coordinatorNodeId === "string" ? args.coordinatorNodeId.trim() : "";
|
|
48237
|
+
const preferredCoordinatorNodeId = requestedCoordinatorNodeId || (typeof mesh.coordinator?.preferredNodeId === "string" ? mesh.coordinator.preferredNodeId.trim() : "");
|
|
48238
|
+
const coordinatorNode = preferredCoordinatorNodeId ? mesh.nodes.find((node) => node?.id === preferredCoordinatorNodeId || node?.nodeId === preferredCoordinatorNodeId) : mesh.nodes[0];
|
|
48239
|
+
if (!coordinatorNode) {
|
|
48240
|
+
return {
|
|
48241
|
+
success: false,
|
|
48242
|
+
code: "mesh_coordinator_node_not_found",
|
|
48243
|
+
error: `Coordinator node ${preferredCoordinatorNodeId} was not found in mesh`,
|
|
48244
|
+
meshId,
|
|
48245
|
+
cliType
|
|
48246
|
+
};
|
|
48247
|
+
}
|
|
48248
|
+
const workspace = typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "";
|
|
48249
|
+
if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
|
|
48176
48250
|
const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
|
|
48177
48251
|
const coordinatorSetup = resolveMeshCoordinatorSetup({
|
|
48178
48252
|
provider: providerMeta,
|
|
@@ -48210,9 +48284,9 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48210
48284
|
workspace
|
|
48211
48285
|
};
|
|
48212
48286
|
}
|
|
48213
|
-
const { existsSync:
|
|
48287
|
+
const { existsSync: existsSync22, readFileSync: readFileSync15, writeFileSync: writeFileSync12, copyFileSync: copyFileSync3 } = await import("fs");
|
|
48214
48288
|
const mcpConfigPath = coordinatorSetup.configPath;
|
|
48215
|
-
const hadExistingMcpConfig =
|
|
48289
|
+
const hadExistingMcpConfig = existsSync22(mcpConfigPath);
|
|
48216
48290
|
let existingMcpConfig = {};
|
|
48217
48291
|
if (hadExistingMcpConfig) {
|
|
48218
48292
|
try {
|
|
@@ -48226,8 +48300,8 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48226
48300
|
mcpServers: {
|
|
48227
48301
|
...existingMcpConfig.mcpServers || {},
|
|
48228
48302
|
[coordinatorSetup.serverName]: {
|
|
48229
|
-
command:
|
|
48230
|
-
args:
|
|
48303
|
+
command: coordinatorSetup.mcpServer.command,
|
|
48304
|
+
args: coordinatorSetup.mcpServer.args
|
|
48231
48305
|
}
|
|
48232
48306
|
}
|
|
48233
48307
|
};
|
|
@@ -48741,7 +48815,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48741
48815
|
const beforeCount = this.messageCount(before);
|
|
48742
48816
|
const beforeSignature = this.lastMessageSignature(before);
|
|
48743
48817
|
for (let attempt = 0; attempt < 12; attempt += 1) {
|
|
48744
|
-
await new Promise((
|
|
48818
|
+
await new Promise((resolve162) => setTimeout(resolve162, 250));
|
|
48745
48819
|
let state;
|
|
48746
48820
|
try {
|
|
48747
48821
|
state = await this.readChat(evaluate);
|
|
@@ -48763,7 +48837,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48763
48837
|
if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
|
|
48764
48838
|
return first;
|
|
48765
48839
|
}
|
|
48766
|
-
await new Promise((
|
|
48840
|
+
await new Promise((resolve162) => setTimeout(resolve162, 150));
|
|
48767
48841
|
const second = await this.readChat(evaluate);
|
|
48768
48842
|
return this.messageCount(second) >= this.messageCount(first) ? second : first;
|
|
48769
48843
|
}
|
|
@@ -48914,7 +48988,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
48914
48988
|
if (typeof data.error === "string" && data.error.trim()) return false;
|
|
48915
48989
|
}
|
|
48916
48990
|
for (let attempt = 0; attempt < 6; attempt += 1) {
|
|
48917
|
-
await new Promise((
|
|
48991
|
+
await new Promise((resolve162) => setTimeout(resolve162, 250));
|
|
48918
48992
|
const state = await this.readChat(evaluate);
|
|
48919
48993
|
const title = this.getStateTitle(state);
|
|
48920
48994
|
if (this.titlesMatch(title, sessionId)) return true;
|
|
@@ -49894,15 +49968,15 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
49894
49968
|
this.json(res, 500, { error: e.message });
|
|
49895
49969
|
}
|
|
49896
49970
|
});
|
|
49897
|
-
return new Promise((
|
|
49971
|
+
return new Promise((resolve162, reject) => {
|
|
49898
49972
|
this.server.listen(port, "127.0.0.1", () => {
|
|
49899
49973
|
this.log(`Dev server listening on http://127.0.0.1:${port}`);
|
|
49900
|
-
|
|
49974
|
+
resolve162();
|
|
49901
49975
|
});
|
|
49902
49976
|
this.server.on("error", (e) => {
|
|
49903
49977
|
if (e.code === "EADDRINUSE") {
|
|
49904
49978
|
this.log(`Port ${port} in use, skipping dev server`);
|
|
49905
|
-
|
|
49979
|
+
resolve162();
|
|
49906
49980
|
} else {
|
|
49907
49981
|
reject(e);
|
|
49908
49982
|
}
|
|
@@ -49984,20 +50058,20 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
49984
50058
|
child.stderr?.on("data", (d) => {
|
|
49985
50059
|
stderr += d.toString().slice(0, 2e3);
|
|
49986
50060
|
});
|
|
49987
|
-
await new Promise((
|
|
50061
|
+
await new Promise((resolve162) => {
|
|
49988
50062
|
const timer = setTimeout(() => {
|
|
49989
50063
|
child.kill();
|
|
49990
|
-
|
|
50064
|
+
resolve162();
|
|
49991
50065
|
}, 3e3);
|
|
49992
50066
|
child.on("exit", () => {
|
|
49993
50067
|
clearTimeout(timer);
|
|
49994
|
-
|
|
50068
|
+
resolve162();
|
|
49995
50069
|
});
|
|
49996
50070
|
child.stdout?.once("data", () => {
|
|
49997
50071
|
setTimeout(() => {
|
|
49998
50072
|
child.kill();
|
|
49999
50073
|
clearTimeout(timer);
|
|
50000
|
-
|
|
50074
|
+
resolve162();
|
|
50001
50075
|
}, 500);
|
|
50002
50076
|
});
|
|
50003
50077
|
});
|
|
@@ -50500,14 +50574,14 @@ Run 'adhdev doctor' for detailed diagnostics.`
|
|
|
50500
50574
|
child.stderr?.on("data", (d) => {
|
|
50501
50575
|
stderr += d.toString();
|
|
50502
50576
|
});
|
|
50503
|
-
await new Promise((
|
|
50577
|
+
await new Promise((resolve162) => {
|
|
50504
50578
|
const timer = setTimeout(() => {
|
|
50505
50579
|
child.kill();
|
|
50506
|
-
|
|
50580
|
+
resolve162();
|
|
50507
50581
|
}, timeout);
|
|
50508
50582
|
child.on("exit", () => {
|
|
50509
50583
|
clearTimeout(timer);
|
|
50510
|
-
|
|
50584
|
+
resolve162();
|
|
50511
50585
|
});
|
|
50512
50586
|
});
|
|
50513
50587
|
const elapsed = Date.now() - start;
|
|
@@ -51177,14 +51251,14 @@ data: ${JSON.stringify(msg.data)}
|
|
|
51177
51251
|
res.end(JSON.stringify(data, null, 2));
|
|
51178
51252
|
}
|
|
51179
51253
|
async readBody(req) {
|
|
51180
|
-
return new Promise((
|
|
51254
|
+
return new Promise((resolve162) => {
|
|
51181
51255
|
let body = "";
|
|
51182
51256
|
req.on("data", (chunk) => body += chunk);
|
|
51183
51257
|
req.on("end", () => {
|
|
51184
51258
|
try {
|
|
51185
|
-
|
|
51259
|
+
resolve162(JSON.parse(body));
|
|
51186
51260
|
} catch {
|
|
51187
|
-
|
|
51261
|
+
resolve162({});
|
|
51188
51262
|
}
|
|
51189
51263
|
});
|
|
51190
51264
|
});
|
|
@@ -53363,7 +53437,7 @@ async function startMcpServer(opts) {
|
|
|
53363
53437
|
coordinatorPrompt = `You are a Repo Mesh Coordinator for "${mesh.name}" (${mesh.repoIdentity}). Use mesh_* tools to orchestrate work.`;
|
|
53364
53438
|
}
|
|
53365
53439
|
const server2 = new import_server.Server(
|
|
53366
|
-
{ name: "adhdev-mcp-server", version: "0.9.
|
|
53440
|
+
{ name: "adhdev-mcp-server", version: "0.9.73" },
|
|
53367
53441
|
{ capabilities: { tools: {}, resources: {} } }
|
|
53368
53442
|
);
|
|
53369
53443
|
const { ListResourcesRequestSchema, ReadResourceRequestSchema } = await import("@modelcontextprotocol/sdk/types.js");
|