happy-imou-cloud 2.1.47 → 2.1.48
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/{BaseReasoningProcessor-CBbzF7oj.cjs → BaseReasoningProcessor-CKtDfihV.cjs} +2 -2
- package/dist/{BaseReasoningProcessor-KXIi0QF_.mjs → BaseReasoningProcessor-CM3JbXUC.mjs} +2 -2
- package/dist/{ProviderSelectionHandler-CJLlwlAu.cjs → ProviderSelectionHandler-BHKIBw4t.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-DzYObYrV.mjs → ProviderSelectionHandler-vgZ2egD_.mjs} +2 -2
- package/dist/{api-D3vYIva3.mjs → api-CSjP-Z3Y.mjs} +3 -3
- package/dist/{api-CVuTajTL.cjs → api-eaGKJjMt.cjs} +3 -3
- package/dist/{command-fcJ-4Yq3.mjs → command-BzPI4N1n.mjs} +2 -2
- package/dist/{command-BZRQuZsh.cjs → command-DDoz1Eky.cjs} +2 -2
- package/dist/{index-Cp1I5I3U.mjs → index-BzsBo3_Z.mjs} +290 -20
- package/dist/{index-CyW9A7hx.cjs → index-C8X1VlHZ.cjs} +289 -19
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +2 -0
- package/dist/lib.d.mts +2 -0
- package/dist/lib.mjs +1 -1
- package/dist/{registerKillSessionHandler-OhhMUuCQ.mjs → registerKillSessionHandler-BHu-3hZQ.mjs} +2 -2
- package/dist/{registerKillSessionHandler-8C_Wrgor.cjs → registerKillSessionHandler-CLCYBgZX.cjs} +2 -2
- package/dist/{runClaude-CfdT_ccS.cjs → runClaude-BkUbXE2F.cjs} +4 -4
- package/dist/{runClaude-BviM1Wl5.mjs → runClaude-D3CBLW5o.mjs} +4 -4
- package/dist/{runCodex-B-t0yy4k.cjs → runCodex-CdgrZK7P.cjs} +29 -8
- package/dist/{runCodex-Dx3osc7U.mjs → runCodex-DqzdgDwZ.mjs} +29 -8
- package/dist/{runGemini-DZ5-uzB9.cjs → runGemini-BE05R24D.cjs} +4 -4
- package/dist/{runGemini-CnJ75Q--.mjs → runGemini-UZuiKe59.mjs} +4 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var persistence = require('./api-
|
|
4
|
+
var persistence = require('./api-eaGKJjMt.cjs');
|
|
5
5
|
var z = require('zod');
|
|
6
6
|
var fs$2 = require('fs/promises');
|
|
7
7
|
var os$1 = require('os');
|
|
@@ -52,7 +52,7 @@ async function openBrowser(url) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
55
|
+
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-C8X1VlHZ.cjs', document.baseURI).href)));
|
|
56
56
|
const QRCode = require$1("qrcode-terminal/vendor/QRCode");
|
|
57
57
|
const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
|
|
58
58
|
const pendingTempFiles = /* @__PURE__ */ new Set();
|
|
@@ -617,7 +617,7 @@ function setupCleanupHandlers() {
|
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
619
|
|
|
620
|
-
const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
620
|
+
const __dirname$2 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-C8X1VlHZ.cjs', document.baseURI).href))));
|
|
621
621
|
function projectPath() {
|
|
622
622
|
const path = path$1.resolve(__dirname$2, "..");
|
|
623
623
|
return path;
|
|
@@ -1569,7 +1569,8 @@ function startDaemonControlServer({
|
|
|
1569
1569
|
body: z.z.object({
|
|
1570
1570
|
directory: z.z.string(),
|
|
1571
1571
|
sessionId: z.z.string().optional(),
|
|
1572
|
-
agent: z.z.enum(["claude", "codex", "gemini"]).optional()
|
|
1572
|
+
agent: z.z.enum(["claude", "codex", "gemini"]).optional(),
|
|
1573
|
+
launchMode: z.z.enum(["background", "terminalWindow", "localTerminal"]).optional()
|
|
1573
1574
|
}),
|
|
1574
1575
|
response: {
|
|
1575
1576
|
200: z.z.object({
|
|
@@ -1590,9 +1591,9 @@ function startDaemonControlServer({
|
|
|
1590
1591
|
}
|
|
1591
1592
|
}
|
|
1592
1593
|
}, async (request, reply) => {
|
|
1593
|
-
const { directory, sessionId, agent } = request.body;
|
|
1594
|
-
persistence.logger.debug(`[CONTROL SERVER] Spawn session request: dir=${directory}, sessionId=${sessionId || "new"}, agent=${agent || "claude"}`);
|
|
1595
|
-
const result = await spawnSession({ directory, sessionId, agent });
|
|
1594
|
+
const { directory, sessionId, agent, launchMode } = request.body;
|
|
1595
|
+
persistence.logger.debug(`[CONTROL SERVER] Spawn session request: dir=${directory}, sessionId=${sessionId || "new"}, agent=${agent || "claude"}, launchMode=${launchMode || "background"}`);
|
|
1596
|
+
const result = await spawnSession({ directory, sessionId, agent, launchMode });
|
|
1596
1597
|
switch (result.type) {
|
|
1597
1598
|
case "success":
|
|
1598
1599
|
if (!result.sessionId) {
|
|
@@ -2336,20 +2337,33 @@ function resolveDaemonSpawnAgent(agent) {
|
|
|
2336
2337
|
throw new Error(`Unsupported agent type: '${agent}'. Please update your CLI to the latest version.`);
|
|
2337
2338
|
}
|
|
2338
2339
|
}
|
|
2339
|
-
function buildDaemonSpawnArgs(agent,
|
|
2340
|
+
function buildDaemonSpawnArgs(agent, optionsOrResume) {
|
|
2341
|
+
const options = isLegacyResumeOptions(optionsOrResume) ? { resume: optionsOrResume } : optionsOrResume ?? {};
|
|
2342
|
+
const startingMode = options.startingMode ?? "remote";
|
|
2343
|
+
const startedBy = options.startedBy ?? "daemon";
|
|
2340
2344
|
const args = [
|
|
2341
2345
|
resolveDaemonSpawnAgent(agent),
|
|
2342
2346
|
"--happy-starting-mode",
|
|
2343
|
-
|
|
2347
|
+
startingMode,
|
|
2344
2348
|
"--started-by",
|
|
2345
|
-
|
|
2349
|
+
startedBy
|
|
2346
2350
|
];
|
|
2347
|
-
const providerSessionId = typeof resume?.providerSessionId === "string" ? resume.providerSessionId.trim() : "";
|
|
2351
|
+
const providerSessionId = typeof options.resume?.providerSessionId === "string" ? options.resume.providerSessionId.trim() : "";
|
|
2348
2352
|
if (providerSessionId.length > 0) {
|
|
2349
2353
|
args.push("--resume", providerSessionId);
|
|
2350
2354
|
}
|
|
2351
2355
|
return args;
|
|
2352
2356
|
}
|
|
2357
|
+
function buildTerminalWindowSpawnArgs(agent, resume) {
|
|
2358
|
+
return buildDaemonSpawnArgs(agent, {
|
|
2359
|
+
resume,
|
|
2360
|
+
startingMode: "local",
|
|
2361
|
+
startedBy: "terminal"
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
function isLegacyResumeOptions(value) {
|
|
2365
|
+
return Boolean(value && "providerSessionId" in value);
|
|
2366
|
+
}
|
|
2353
2367
|
|
|
2354
2368
|
const SPAWN_SESSION_ERROR_CODES = {
|
|
2355
2369
|
INVALID_REQUEST: "INVALID_REQUEST",
|
|
@@ -2412,6 +2426,157 @@ function buildDaemonChildEnv(baseEnv, extraEnv) {
|
|
|
2412
2426
|
return childEnv;
|
|
2413
2427
|
}
|
|
2414
2428
|
|
|
2429
|
+
function quotePosix(value) {
|
|
2430
|
+
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
2431
|
+
}
|
|
2432
|
+
function quoteAppleScriptString(value) {
|
|
2433
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
2434
|
+
}
|
|
2435
|
+
function quoteWindowsCmd(value) {
|
|
2436
|
+
return `"${value.replace(/(["^&|<>()%])/g, "^$1")}"`;
|
|
2437
|
+
}
|
|
2438
|
+
function buildRuntimeInvocation(args, platform, entrypointOverride) {
|
|
2439
|
+
const projectRoot = projectPath();
|
|
2440
|
+
const entrypoint = entrypointOverride || path.join(projectRoot, "dist", "index.mjs");
|
|
2441
|
+
const runtime = isBun() ? "bun" : "node";
|
|
2442
|
+
const runtimeArgs = ["--no-warnings", "--no-deprecation", entrypoint, ...args];
|
|
2443
|
+
const commandParts = [runtime, ...runtimeArgs];
|
|
2444
|
+
if (platform === "win32") {
|
|
2445
|
+
return commandParts.map(quoteWindowsCmd).join(" ");
|
|
2446
|
+
}
|
|
2447
|
+
return commandParts.map(quotePosix).join(" ");
|
|
2448
|
+
}
|
|
2449
|
+
function buildUserFacingPreview(args) {
|
|
2450
|
+
const agent = args[0];
|
|
2451
|
+
if (agent === "claude" || agent === "codex" || agent === "gemini") {
|
|
2452
|
+
return `hicloud ${agent}`;
|
|
2453
|
+
}
|
|
2454
|
+
return `hicloud ${args.join(" ")}`.trim();
|
|
2455
|
+
}
|
|
2456
|
+
function buildPathWithProjectBin(env, platform) {
|
|
2457
|
+
const binPath = path.join(projectPath(), "node_modules", ".bin");
|
|
2458
|
+
const pathDelimiter = platform === "win32" ? ";" : path.delimiter;
|
|
2459
|
+
const currentPath = env?.PATH || env?.Path || process.env.PATH || "";
|
|
2460
|
+
return currentPath ? `${binPath}${pathDelimiter}${currentPath}` : binPath;
|
|
2461
|
+
}
|
|
2462
|
+
function isValidEnvironmentVariableName(name) {
|
|
2463
|
+
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name);
|
|
2464
|
+
}
|
|
2465
|
+
function escapeWindowsBatchSetValue(value) {
|
|
2466
|
+
return value.replace(/\r?\n/g, "").replace(/%/g, "%%");
|
|
2467
|
+
}
|
|
2468
|
+
function collectLaunchEnv(env, platform) {
|
|
2469
|
+
const result = {};
|
|
2470
|
+
for (const [key, value] of Object.entries(env || {})) {
|
|
2471
|
+
if (typeof value === "string" && isValidEnvironmentVariableName(key)) {
|
|
2472
|
+
result[key] = value;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
result.PATH = buildPathWithProjectBin(env, platform);
|
|
2476
|
+
return result;
|
|
2477
|
+
}
|
|
2478
|
+
function buildTerminalLaunchScriptContent(options) {
|
|
2479
|
+
const platform = options.platform || process.platform;
|
|
2480
|
+
const launchEnv = collectLaunchEnv(options.env, platform);
|
|
2481
|
+
const preview = buildUserFacingPreview(options.args);
|
|
2482
|
+
const runtimeInvocation = buildRuntimeInvocation(options.args, platform, options.entrypoint);
|
|
2483
|
+
if (platform === "win32") {
|
|
2484
|
+
const envLines2 = Object.entries(launchEnv).map(([key, value]) => `set "${key}=${escapeWindowsBatchSetValue(value)}"`).join("\r\n");
|
|
2485
|
+
return [
|
|
2486
|
+
"@echo off",
|
|
2487
|
+
"setlocal",
|
|
2488
|
+
envLines2,
|
|
2489
|
+
`cd /d ${quoteWindowsCmd(options.cwd)}`,
|
|
2490
|
+
`echo $ ${preview}`,
|
|
2491
|
+
runtimeInvocation,
|
|
2492
|
+
"echo.",
|
|
2493
|
+
"echo Happy session command exited. You can close this window.",
|
|
2494
|
+
'del "%~f0" >nul 2>nul',
|
|
2495
|
+
"endlocal",
|
|
2496
|
+
""
|
|
2497
|
+
].join("\r\n");
|
|
2498
|
+
}
|
|
2499
|
+
const envLines = Object.entries(launchEnv).map(([key, value]) => `export ${key}=${quotePosix(value)}`).join("\n");
|
|
2500
|
+
return [
|
|
2501
|
+
"#!/usr/bin/env bash",
|
|
2502
|
+
"set +e",
|
|
2503
|
+
'rm -f "$0" >/dev/null 2>&1 || true',
|
|
2504
|
+
envLines,
|
|
2505
|
+
`cd ${quotePosix(options.cwd)} || exit $?`,
|
|
2506
|
+
`echo ${quotePosix(`$ ${preview}`)}`,
|
|
2507
|
+
runtimeInvocation,
|
|
2508
|
+
"status=$?",
|
|
2509
|
+
"echo",
|
|
2510
|
+
'echo "Happy session command exited with status ${status}. You can close this window."',
|
|
2511
|
+
'exec "${SHELL:-bash}" -l',
|
|
2512
|
+
""
|
|
2513
|
+
].join("\n");
|
|
2514
|
+
}
|
|
2515
|
+
function createTerminalLaunchScript(options) {
|
|
2516
|
+
if (options.scriptPath) {
|
|
2517
|
+
return options.scriptPath;
|
|
2518
|
+
}
|
|
2519
|
+
const platform = options.platform || process.platform;
|
|
2520
|
+
const scriptDirectory = fs.mkdtempSync(path.join(os.tmpdir(), "happy-terminal-launch-"));
|
|
2521
|
+
const scriptPath = path.join(scriptDirectory, platform === "win32" ? "launch.cmd" : "launch.sh");
|
|
2522
|
+
fs.writeFileSync(scriptPath, buildTerminalLaunchScriptContent({ ...options, platform }), { encoding: "utf8", mode: 448 });
|
|
2523
|
+
if (platform !== "win32") {
|
|
2524
|
+
fs.chmodSync(scriptPath, 448);
|
|
2525
|
+
}
|
|
2526
|
+
return scriptPath;
|
|
2527
|
+
}
|
|
2528
|
+
function buildTerminalWindowLaunchCommand(options) {
|
|
2529
|
+
const platform = options.platform || process.platform;
|
|
2530
|
+
const scriptPath = createTerminalLaunchScript({ ...options, platform });
|
|
2531
|
+
const preview = buildUserFacingPreview(options.args);
|
|
2532
|
+
if (platform === "win32") {
|
|
2533
|
+
return {
|
|
2534
|
+
command: "cmd.exe",
|
|
2535
|
+
args: ["/d", "/s", "/c", `start "" cmd.exe /d /s /k ${quoteWindowsCmd(scriptPath)}`],
|
|
2536
|
+
options: {
|
|
2537
|
+
cwd: options.cwd,
|
|
2538
|
+
detached: true,
|
|
2539
|
+
stdio: "ignore",
|
|
2540
|
+
env: options.env,
|
|
2541
|
+
windowsHide: false
|
|
2542
|
+
},
|
|
2543
|
+
preview,
|
|
2544
|
+
scriptPath
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2547
|
+
if (platform === "darwin") {
|
|
2548
|
+
const appleScript = `tell application "Terminal" to do script ${quoteAppleScriptString(`bash ${quotePosix(scriptPath)}`)}`;
|
|
2549
|
+
return {
|
|
2550
|
+
command: "osascript",
|
|
2551
|
+
args: ["-e", appleScript],
|
|
2552
|
+
options: {
|
|
2553
|
+
cwd: options.cwd,
|
|
2554
|
+
detached: true,
|
|
2555
|
+
stdio: "ignore",
|
|
2556
|
+
env: options.env
|
|
2557
|
+
},
|
|
2558
|
+
preview,
|
|
2559
|
+
scriptPath
|
|
2560
|
+
};
|
|
2561
|
+
}
|
|
2562
|
+
return {
|
|
2563
|
+
command: "x-terminal-emulator",
|
|
2564
|
+
args: ["-e", "bash", scriptPath],
|
|
2565
|
+
options: {
|
|
2566
|
+
cwd: options.cwd,
|
|
2567
|
+
detached: true,
|
|
2568
|
+
stdio: "ignore",
|
|
2569
|
+
env: options.env
|
|
2570
|
+
},
|
|
2571
|
+
preview,
|
|
2572
|
+
scriptPath
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
function spawnHappyCLIInTerminalWindow(options) {
|
|
2576
|
+
const launchCommand = buildTerminalWindowLaunchCommand(options);
|
|
2577
|
+
return node_child_process.spawn(launchCommand.command, launchCommand.args, launchCommand.options);
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2415
2580
|
const DIFFERENT_DAEMON_RUNNING_MESSAGE = "A different daemon was started without killing us. We should kill ourselves.";
|
|
2416
2581
|
function pruneStaleTrackedSessions({
|
|
2417
2582
|
trackedSessionPids,
|
|
@@ -3569,6 +3734,28 @@ async function startDaemon() {
|
|
|
3569
3734
|
let api = null;
|
|
3570
3735
|
const pidToTrackedSession = /* @__PURE__ */ new Map();
|
|
3571
3736
|
const pidToAwaiter = /* @__PURE__ */ new Map();
|
|
3737
|
+
const terminalLaunchAwaiters = /* @__PURE__ */ new Map();
|
|
3738
|
+
const normalizePathForSessionMatch = (value) => (value || "").trim().replace(/[\\/]+$/, "");
|
|
3739
|
+
const resolveTerminalLaunchAwaiter = (sessionId, sessionMetadata) => {
|
|
3740
|
+
const reportedDirectory = normalizePathForSessionMatch(sessionMetadata.path);
|
|
3741
|
+
const reportedFlavor = resolveRecoverySpawnAgent(sessionMetadata.flavor);
|
|
3742
|
+
const now = Date.now();
|
|
3743
|
+
for (const [awaiterId, awaiter] of terminalLaunchAwaiters.entries()) {
|
|
3744
|
+
if (awaiter.startedAt - 5e3 > now) {
|
|
3745
|
+
continue;
|
|
3746
|
+
}
|
|
3747
|
+
const directoryMatches = normalizePathForSessionMatch(awaiter.directory) === reportedDirectory;
|
|
3748
|
+
const agentMatches = !awaiter.agent || !reportedFlavor || awaiter.agent === reportedFlavor;
|
|
3749
|
+
if (!directoryMatches || !agentMatches) {
|
|
3750
|
+
continue;
|
|
3751
|
+
}
|
|
3752
|
+
terminalLaunchAwaiters.delete(awaiterId);
|
|
3753
|
+
awaiter.resolve({ type: "success", sessionId });
|
|
3754
|
+
persistence.logger.debug(`[DAEMON RUN] Resolved terminal window session awaiter ${awaiterId} for session ${sessionId}`);
|
|
3755
|
+
return true;
|
|
3756
|
+
}
|
|
3757
|
+
return false;
|
|
3758
|
+
};
|
|
3572
3759
|
const getCurrentChildren = () => Array.from(pidToTrackedSession.values());
|
|
3573
3760
|
let userScopedObserver = null;
|
|
3574
3761
|
const removeTrackedSession = (pid, archiveReason) => {
|
|
@@ -3617,6 +3804,7 @@ async function startDaemon() {
|
|
|
3617
3804
|
};
|
|
3618
3805
|
pidToTrackedSession.set(pid, trackedSession);
|
|
3619
3806
|
persistence.logger.debug(`[DAEMON RUN] Registered externally-started session ${sessionId}`);
|
|
3807
|
+
resolveTerminalLaunchAwaiter(sessionId, sessionMetadata);
|
|
3620
3808
|
}
|
|
3621
3809
|
};
|
|
3622
3810
|
const spawnSession = async (options) => {
|
|
@@ -3726,6 +3914,84 @@ async function startDaemon() {
|
|
|
3726
3914
|
errorMessage: spawnError.errorMessage
|
|
3727
3915
|
};
|
|
3728
3916
|
}
|
|
3917
|
+
if (options.launchMode === "terminalWindow" || options.launchMode === "localTerminal") {
|
|
3918
|
+
persistence.logger.debug(`[DAEMON RUN] Using visible terminal window spawning`);
|
|
3919
|
+
let args;
|
|
3920
|
+
try {
|
|
3921
|
+
args = buildTerminalWindowSpawnArgs(options.agent, options.resume);
|
|
3922
|
+
} catch (error) {
|
|
3923
|
+
const spawnError = createSpawnSessionError(
|
|
3924
|
+
SPAWN_SESSION_ERROR_CODES.INVALID_REQUEST,
|
|
3925
|
+
error instanceof Error ? error.message : String(error)
|
|
3926
|
+
);
|
|
3927
|
+
return {
|
|
3928
|
+
type: spawnError.type,
|
|
3929
|
+
errorMessage: spawnError.errorMessage
|
|
3930
|
+
};
|
|
3931
|
+
}
|
|
3932
|
+
const terminalEnv = buildDaemonChildEnv(process.env, extraEnv);
|
|
3933
|
+
const terminalProcess = spawnHappyCLIInTerminalWindow({
|
|
3934
|
+
cwd: directory,
|
|
3935
|
+
args,
|
|
3936
|
+
env: terminalEnv
|
|
3937
|
+
});
|
|
3938
|
+
if (!terminalProcess.pid) {
|
|
3939
|
+
persistence.logger.debug("[DAEMON RUN] Failed to spawn terminal window - no PID returned");
|
|
3940
|
+
const spawnError = createSpawnSessionError(
|
|
3941
|
+
SPAWN_SESSION_ERROR_CODES.SPAWN_NO_PID,
|
|
3942
|
+
"Failed to spawn terminal window - no PID returned"
|
|
3943
|
+
);
|
|
3944
|
+
return {
|
|
3945
|
+
type: spawnError.type,
|
|
3946
|
+
errorMessage: spawnError.errorMessage
|
|
3947
|
+
};
|
|
3948
|
+
}
|
|
3949
|
+
persistence.logger.debug(`[DAEMON RUN] Spawned terminal window process with PID ${terminalProcess.pid}`);
|
|
3950
|
+
const trackedSession = {
|
|
3951
|
+
startedBy: "daemon terminal window",
|
|
3952
|
+
happySessionId: options.sessionId,
|
|
3953
|
+
sessionIndex: null,
|
|
3954
|
+
skipDetachedManagedSessionArchive: true,
|
|
3955
|
+
pid: terminalProcess.pid,
|
|
3956
|
+
childProcess: terminalProcess,
|
|
3957
|
+
directoryCreated,
|
|
3958
|
+
message: directoryCreated ? `The path '${directory}' did not exist. We created a new folder and opened a terminal window there.` : `Opened a terminal window in '${directory}' to start the session.`
|
|
3959
|
+
};
|
|
3960
|
+
pidToTrackedSession.set(terminalProcess.pid, trackedSession);
|
|
3961
|
+
terminalProcess.on("exit", (code, signal) => {
|
|
3962
|
+
persistence.logger.debug(`[DAEMON RUN] Terminal launcher PID ${terminalProcess.pid} exited with code ${code}, signal ${signal}`);
|
|
3963
|
+
});
|
|
3964
|
+
terminalProcess.on("error", (error) => {
|
|
3965
|
+
persistence.logger.debug(`[DAEMON RUN] Terminal launcher process error:`, error);
|
|
3966
|
+
});
|
|
3967
|
+
terminalProcess.unref();
|
|
3968
|
+
const terminalAwaiterId = node_crypto.randomUUID();
|
|
3969
|
+
const launchStartedAt = Date.now();
|
|
3970
|
+
persistence.logger.debug(`[DAEMON RUN] Waiting for terminal window session webhook ${terminalAwaiterId}`);
|
|
3971
|
+
return new Promise((resolve) => {
|
|
3972
|
+
const timeout = setTimeout(() => {
|
|
3973
|
+
terminalLaunchAwaiters.delete(terminalAwaiterId);
|
|
3974
|
+
persistence.logger.debug(`[DAEMON RUN] Terminal window session webhook timeout for PID ${terminalProcess.pid}`);
|
|
3975
|
+
const spawnError = createSpawnSessionError(
|
|
3976
|
+
SPAWN_SESSION_ERROR_CODES.SESSION_WEBHOOK_TIMEOUT,
|
|
3977
|
+
`Terminal window session webhook timeout for PID ${terminalProcess.pid}`
|
|
3978
|
+
);
|
|
3979
|
+
resolve({
|
|
3980
|
+
type: spawnError.type,
|
|
3981
|
+
errorMessage: spawnError.errorMessage
|
|
3982
|
+
});
|
|
3983
|
+
}, sessionWebhookTimeoutMs);
|
|
3984
|
+
terminalLaunchAwaiters.set(terminalAwaiterId, {
|
|
3985
|
+
directory,
|
|
3986
|
+
agent: options.agent,
|
|
3987
|
+
startedAt: launchStartedAt,
|
|
3988
|
+
resolve: (result) => {
|
|
3989
|
+
clearTimeout(timeout);
|
|
3990
|
+
resolve(result);
|
|
3991
|
+
}
|
|
3992
|
+
});
|
|
3993
|
+
});
|
|
3994
|
+
}
|
|
3729
3995
|
let tmuxSessionName = extraEnv.TMUX_SESSION_NAME;
|
|
3730
3996
|
const tmuxRequested = tmuxSessionName !== void 0;
|
|
3731
3997
|
const tmuxAvailable = tmuxRequested ? await isTmuxAvailable() : false;
|
|
@@ -9400,10 +9666,14 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
|
|
|
9400
9666
|
async () => {
|
|
9401
9667
|
let timeoutHandle = null;
|
|
9402
9668
|
try {
|
|
9669
|
+
const resumeSession = this.connection.resumeSession ?? this.connection.unstable_resumeSession;
|
|
9403
9670
|
const result = await raceWithProcessExit(
|
|
9404
9671
|
this.process,
|
|
9405
9672
|
() => Promise.race([
|
|
9406
|
-
(sessionOperation === "resume" ?
|
|
9673
|
+
(sessionOperation === "resume" ? resumeSession ? resumeSession(sessionRequest).then((response) => ({
|
|
9674
|
+
...response,
|
|
9675
|
+
sessionId: requestedResumeSessionId
|
|
9676
|
+
})) : Promise.reject(new Error("ACP agent advertised session resume, but this SDK connection does not expose resumeSession.")) : sessionOperation === "load" ? this.connection.loadSession(sessionRequest) : this.connection.newSession(sessionRequest)).then((res) => {
|
|
9407
9677
|
if (timeoutHandle) {
|
|
9408
9678
|
clearTimeout(timeoutHandle);
|
|
9409
9679
|
timeoutHandle = null;
|
|
@@ -10899,7 +11169,7 @@ class AbortError extends Error {
|
|
|
10899
11169
|
}
|
|
10900
11170
|
}
|
|
10901
11171
|
|
|
10902
|
-
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
11172
|
+
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-C8X1VlHZ.cjs', document.baseURI).href)));
|
|
10903
11173
|
const __dirname$1 = path.join(__filename$1, "..");
|
|
10904
11174
|
function getGlobalClaudeVersion() {
|
|
10905
11175
|
try {
|
|
@@ -12224,14 +12494,14 @@ var launch = /*#__PURE__*/Object.freeze({
|
|
|
12224
12494
|
const unifiedProviderExecutors = {
|
|
12225
12495
|
claude: async (opts) => {
|
|
12226
12496
|
const claudeOptions = opts.claudeOptions ?? {};
|
|
12227
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
12497
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-BkUbXE2F.cjs'); });
|
|
12228
12498
|
await runClaude(opts.credentials, {
|
|
12229
12499
|
...claudeOptions,
|
|
12230
12500
|
startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
|
|
12231
12501
|
});
|
|
12232
12502
|
},
|
|
12233
12503
|
codex: async (opts) => {
|
|
12234
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
12504
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CdgrZK7P.cjs'); });
|
|
12235
12505
|
await runCodex({
|
|
12236
12506
|
credentials: opts.credentials,
|
|
12237
12507
|
startedBy: opts.startedBy,
|
|
@@ -12240,7 +12510,7 @@ const unifiedProviderExecutors = {
|
|
|
12240
12510
|
});
|
|
12241
12511
|
},
|
|
12242
12512
|
gemini: async (opts) => {
|
|
12243
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
12513
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BE05R24D.cjs'); });
|
|
12244
12514
|
await runGemini({
|
|
12245
12515
|
credentials: opts.credentials,
|
|
12246
12516
|
startedBy: opts.startedBy
|
|
@@ -12323,7 +12593,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
12323
12593
|
return;
|
|
12324
12594
|
} else if (subcommand === "runtime") {
|
|
12325
12595
|
if (args[1] === "providers") {
|
|
12326
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
12596
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DDoz1Eky.cjs'); });
|
|
12327
12597
|
console.log(renderRuntimeProviders());
|
|
12328
12598
|
return;
|
|
12329
12599
|
}
|
|
@@ -12529,8 +12799,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
12529
12799
|
const projectId = args[3];
|
|
12530
12800
|
try {
|
|
12531
12801
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
12532
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-
|
|
12533
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
12802
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-eaGKJjMt.cjs'); }).then(function (n) { return n.persistence; });
|
|
12803
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-eaGKJjMt.cjs'); }).then(function (n) { return n.api; });
|
|
12534
12804
|
let userEmail = void 0;
|
|
12535
12805
|
try {
|
|
12536
12806
|
const credentials = await readCredentials2();
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('chalk');
|
|
4
|
-
require('./api-
|
|
4
|
+
require('./api-eaGKJjMt.cjs');
|
|
5
5
|
require('zod');
|
|
6
|
-
require('./index-
|
|
6
|
+
require('./index-C8X1VlHZ.cjs');
|
|
7
7
|
require('node:child_process');
|
|
8
8
|
require('node:fs');
|
|
9
9
|
require('cross-spawn');
|
package/dist/index.mjs
CHANGED
package/dist/lib.cjs
CHANGED
package/dist/lib.d.cts
CHANGED
|
@@ -4011,6 +4011,7 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
4011
4011
|
private normalizeSocketError;
|
|
4012
4012
|
}
|
|
4013
4013
|
|
|
4014
|
+
type SessionLaunchMode = 'background' | 'terminalWindow' | 'localTerminal';
|
|
4014
4015
|
interface SpawnSessionOptions {
|
|
4015
4016
|
machineId?: string;
|
|
4016
4017
|
directory: string;
|
|
@@ -4019,6 +4020,7 @@ interface SpawnSessionOptions {
|
|
|
4019
4020
|
approvedNewDirectoryCreation?: boolean;
|
|
4020
4021
|
agent?: 'claude' | 'codex' | 'gemini';
|
|
4021
4022
|
token?: string;
|
|
4023
|
+
launchMode?: SessionLaunchMode;
|
|
4022
4024
|
environmentVariables?: {
|
|
4023
4025
|
ANTHROPIC_BASE_URL?: string;
|
|
4024
4026
|
ANTHROPIC_AUTH_TOKEN?: string;
|
package/dist/lib.d.mts
CHANGED
|
@@ -4011,6 +4011,7 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
4011
4011
|
private normalizeSocketError;
|
|
4012
4012
|
}
|
|
4013
4013
|
|
|
4014
|
+
type SessionLaunchMode = 'background' | 'terminalWindow' | 'localTerminal';
|
|
4014
4015
|
interface SpawnSessionOptions {
|
|
4015
4016
|
machineId?: string;
|
|
4016
4017
|
directory: string;
|
|
@@ -4019,6 +4020,7 @@ interface SpawnSessionOptions {
|
|
|
4019
4020
|
approvedNewDirectoryCreation?: boolean;
|
|
4020
4021
|
agent?: 'claude' | 'codex' | 'gemini';
|
|
4021
4022
|
token?: string;
|
|
4023
|
+
launchMode?: SessionLaunchMode;
|
|
4022
4024
|
environmentVariables?: {
|
|
4023
4025
|
ANTHROPIC_BASE_URL?: string;
|
|
4024
4026
|
ANTHROPIC_AUTH_TOKEN?: string;
|
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-CSjP-Z3Y.mjs';
|
|
2
2
|
export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'chalk';
|
package/dist/{registerKillSessionHandler-OhhMUuCQ.mjs → registerKillSessionHandler-BHu-3hZQ.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as initialMachineMetadata, R as RuntimeShell, f as formatDisplayMessage, n as resolveCanonicalToolNameV2, o as isTerminalReferenceOnlyPayload, t as truncateDisplayMessage } from './index-
|
|
2
|
-
import { r as readSettings, H as HeadTailPreviewBuffer, e as HAPPY_ORG_REPLY_ACK_VERSION, f as HAPPY_ORG_TURN_REPORT_TAG, g as HAPPY_ORG_SUMMARY_MAX_LENGTH, j as HAPPY_ORG_REPEAT_THRESHOLD, l as logger, n as normalizePreviewableArtifactTarget } from './api-
|
|
1
|
+
import { m as initialMachineMetadata, R as RuntimeShell, f as formatDisplayMessage, n as resolveCanonicalToolNameV2, o as isTerminalReferenceOnlyPayload, t as truncateDisplayMessage } from './index-BzsBo3_Z.mjs';
|
|
2
|
+
import { r as readSettings, H as HeadTailPreviewBuffer, e as HAPPY_ORG_REPLY_ACK_VERSION, f as HAPPY_ORG_TURN_REPORT_TAG, g as HAPPY_ORG_SUMMARY_MAX_LENGTH, j as HAPPY_ORG_REPEAT_THRESHOLD, l as logger, n as normalizePreviewableArtifactTarget } from './api-CSjP-Z3Y.mjs';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
4
|
import { basename } from 'node:path';
|
|
5
5
|
import 'axios';
|
package/dist/{registerKillSessionHandler-8C_Wrgor.cjs → registerKillSessionHandler-CLCYBgZX.cjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var persistence = require('./api-
|
|
3
|
+
var index = require('./index-C8X1VlHZ.cjs');
|
|
4
|
+
var persistence = require('./api-eaGKJjMt.cjs');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
require('axios');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var persistence = require('./api-
|
|
4
|
+
var persistence = require('./api-eaGKJjMt.cjs');
|
|
5
5
|
require('cross-spawn');
|
|
6
6
|
require('@agentclientprotocol/sdk');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-C8X1VlHZ.cjs');
|
|
8
8
|
require('ps-list');
|
|
9
9
|
require('fs');
|
|
10
10
|
require('path');
|
|
@@ -25,9 +25,9 @@ require('tweetnacl');
|
|
|
25
25
|
require('open');
|
|
26
26
|
var React = require('react');
|
|
27
27
|
var ink = require('ink');
|
|
28
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
28
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-BHKIBw4t.cjs');
|
|
29
29
|
var types = require('./types-DVk3crez.cjs');
|
|
30
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
30
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-CLCYBgZX.cjs');
|
|
31
31
|
require('socket.io-client');
|
|
32
32
|
require('expo-server-sdk');
|
|
33
33
|
var node_util = require('node:util');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { l as logger, k as backoff, m as delay, d as AssistantMessageStream, o as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError, h as hashObject } from './api-
|
|
2
|
+
import { l as logger, k as backoff, m as delay, d as AssistantMessageStream, o as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError, h as hashObject } from './api-CSjP-Z3Y.mjs';
|
|
3
3
|
import 'cross-spawn';
|
|
4
4
|
import '@agentclientprotocol/sdk';
|
|
5
|
-
import { q as getProjectPath, F as Future, u as claudeLocal, E as ExitCodeError, w as trimIdent, x as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, y as claudeCheckSession, z as projectPath, B as mapToClaudeMode, P as PushableAsyncIterable, C as query, D as AbortError, e as stopCaffeinate, p as publishSessionRegistration, H as getEnvironmentInfo, a as createSessionMetadata, I as startCaffeinate, b as closeProviderSession } from './index-
|
|
5
|
+
import { q as getProjectPath, F as Future, u as claudeLocal, E as ExitCodeError, w as trimIdent, x as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, y as claudeCheckSession, z as projectPath, B as mapToClaudeMode, P as PushableAsyncIterable, C as query, D as AbortError, e as stopCaffeinate, p as publishSessionRegistration, H as getEnvironmentInfo, a as createSessionMetadata, I as startCaffeinate, b as closeProviderSession } from './index-BzsBo3_Z.mjs';
|
|
6
6
|
import 'ps-list';
|
|
7
7
|
import 'fs';
|
|
8
8
|
import 'path';
|
|
@@ -23,9 +23,9 @@ import 'tweetnacl';
|
|
|
23
23
|
import 'open';
|
|
24
24
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
25
25
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
26
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-
|
|
26
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-vgZ2egD_.mjs';
|
|
27
27
|
import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
28
|
-
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, t as createSessionTranscriptInkRenderer, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, n as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, q as forwardAgentMessageToProviderSession, m as buildPermissionPushNotification, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, c as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
28
|
+
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, t as createSessionTranscriptInkRenderer, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, n as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, q as forwardAgentMessageToProviderSession, m as buildPermissionPushNotification, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, c as registerKillSessionHandler } from './registerKillSessionHandler-BHu-3hZQ.mjs';
|
|
29
29
|
import 'socket.io-client';
|
|
30
30
|
import 'expo-server-sdk';
|
|
31
31
|
import { isDeepStrictEqual } from 'node:util';
|