happy-imou-cloud 2.1.7 → 2.1.9
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-C0A6Jr8V.mjs → BaseReasoningProcessor-CgEO6Vh-.mjs} +4 -3
- package/dist/{BaseReasoningProcessor-iSuaFeZH.cjs → BaseReasoningProcessor-DV6TAtd7.cjs} +4 -3
- package/dist/{ProviderSelectionHandler-DI9QK1iY.cjs → ProviderSelectionHandler-C6ILAmE3.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-WT-tvePy.mjs → ProviderSelectionHandler-dczuX21U.mjs} +2 -2
- package/dist/{api-BYKV7vX6.mjs → api-CfHYTLZX.mjs} +141 -35
- package/dist/{api-CdGT5hsH.cjs → api-CfmTDha2.cjs} +141 -35
- package/dist/{command-C1cKqmsa.mjs → command-B0HfYWYW.mjs} +3 -3
- package/dist/{command-uyA8cYmL.cjs → command-Bw2XKjA9.cjs} +3 -3
- package/dist/{index-BAhlFq45.mjs → index-BKjWLXkN.mjs} +146 -30
- package/dist/{index-D_S_7bqK.cjs → index-C3bSe5_d.cjs} +149 -33
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +8 -4
- package/dist/lib.d.mts +8 -4
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-CMvrZ4SA.cjs → persistence-Db4p7gsX.cjs} +1 -1
- package/dist/{persistence-B8Wgn6aN.mjs → persistence-Nun5c360.mjs} +1 -1
- package/dist/{registerKillSessionHandler-5DVlZaJx.mjs → registerKillSessionHandler-C1S9ytML.mjs} +3 -3
- package/dist/{registerKillSessionHandler-DjxtkGMv.cjs → registerKillSessionHandler-FIQEW2Rx.cjs} +3 -3
- package/dist/{runClaude-WB884iOO.mjs → runClaude-ClXU2LZA.mjs} +9 -5
- package/dist/{runClaude-DNZFsQY0.cjs → runClaude-Dxye_oZf.cjs} +9 -5
- package/dist/{runCodex-MJar-238.mjs → runCodex-CXu7_Wgk.mjs} +96 -21
- package/dist/{runCodex-WZ91ZLK7.cjs → runCodex-IaL6Vqwc.cjs} +96 -21
- package/dist/{runGemini-B_wCHgPU.cjs → runGemini-BgcZcZsv.cjs} +11 -5
- package/dist/{runGemini-BPGpwljp.mjs → runGemini-BlJjRWN1.mjs} +11 -5
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
|
-
var api = require('./api-
|
|
5
|
-
var persistence = require('./persistence-
|
|
4
|
+
var api = require('./api-CfmTDha2.cjs');
|
|
5
|
+
var persistence = require('./persistence-Db4p7gsX.cjs');
|
|
6
6
|
var z = require('zod');
|
|
7
7
|
var fs$2 = require('fs/promises');
|
|
8
8
|
var os$1 = require('os');
|
|
@@ -72,7 +72,7 @@ async function openBrowser(url) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
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-
|
|
75
|
+
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-C3bSe5_d.cjs', document.baseURI).href)));
|
|
76
76
|
const QRCode = require$1("qrcode-terminal/vendor/QRCode");
|
|
77
77
|
const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
|
|
78
78
|
const pendingTempFiles = /* @__PURE__ */ new Set();
|
|
@@ -695,7 +695,7 @@ function setupCleanupHandlers() {
|
|
|
695
695
|
});
|
|
696
696
|
}
|
|
697
697
|
|
|
698
|
-
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-
|
|
698
|
+
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-C3bSe5_d.cjs', document.baseURI).href))));
|
|
699
699
|
function projectPath() {
|
|
700
700
|
const path = path$1.resolve(__dirname$2, "..");
|
|
701
701
|
return path;
|
|
@@ -2469,6 +2469,20 @@ function buildDaemonChildEnv(baseEnv, extraEnv) {
|
|
|
2469
2469
|
}
|
|
2470
2470
|
|
|
2471
2471
|
const DIFFERENT_DAEMON_RUNNING_MESSAGE = "A different daemon was started without killing us. We should kill ourselves.";
|
|
2472
|
+
function pruneStaleTrackedSessions({
|
|
2473
|
+
trackedSessionPids,
|
|
2474
|
+
removeTrackedSession,
|
|
2475
|
+
kill = process.kill
|
|
2476
|
+
}) {
|
|
2477
|
+
for (const pid of trackedSessionPids) {
|
|
2478
|
+
try {
|
|
2479
|
+
kill(pid, 0);
|
|
2480
|
+
} catch {
|
|
2481
|
+
api.logger.debug(`[DAEMON RUN] Removing stale session with PID ${pid} (process no longer exists)`);
|
|
2482
|
+
removeTrackedSession(pid);
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2472
2486
|
function readProjectCliVersionFromDisk() {
|
|
2473
2487
|
const packageJsonPath = path.join(projectPath(), "package.json");
|
|
2474
2488
|
try {
|
|
@@ -2499,14 +2513,10 @@ async function runDaemonHealthCheck({
|
|
|
2499
2513
|
requestShutdown,
|
|
2500
2514
|
writeHeartbeat
|
|
2501
2515
|
}) {
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
api.logger.debug(`[DAEMON RUN] Removing stale session with PID ${pid} (process no longer exists)`);
|
|
2507
|
-
removeTrackedSession(pid);
|
|
2508
|
-
}
|
|
2509
|
-
}
|
|
2516
|
+
pruneStaleTrackedSessions({
|
|
2517
|
+
trackedSessionPids,
|
|
2518
|
+
removeTrackedSession
|
|
2519
|
+
});
|
|
2510
2520
|
const projectVersion = readProjectCliVersion();
|
|
2511
2521
|
if (projectVersion && projectVersion !== currentCliVersion) {
|
|
2512
2522
|
await onDaemonOutdated();
|
|
@@ -2616,7 +2626,8 @@ async function precreateDaemonManagedSession(opts) {
|
|
|
2616
2626
|
return await opts.api.getOrCreateSession({
|
|
2617
2627
|
tag: opts.sessionTag,
|
|
2618
2628
|
metadata,
|
|
2619
|
-
state
|
|
2629
|
+
state,
|
|
2630
|
+
stableDataKeyPath: ["managed-session-tag", opts.sessionTag]
|
|
2620
2631
|
});
|
|
2621
2632
|
} catch (error) {
|
|
2622
2633
|
api.logger.debug(`[DAEMON RUN] Failed to precreate ${opts.flavor} session for tag ${opts.sessionTag}`, error);
|
|
@@ -2978,7 +2989,42 @@ function resolveManagedSessionTag(env = process.env) {
|
|
|
2978
2989
|
return readManagedSessionTag(env) ?? node_crypto.randomUUID();
|
|
2979
2990
|
}
|
|
2980
2991
|
|
|
2992
|
+
const DEFAULT_MAX_LINES = 40;
|
|
2993
|
+
const DEFAULT_MAX_LINE_LENGTH = 300;
|
|
2994
|
+
function truncateLine(line, maxLineLength) {
|
|
2995
|
+
if (line.length <= maxLineLength) {
|
|
2996
|
+
return line;
|
|
2997
|
+
}
|
|
2998
|
+
return `${line.slice(0, Math.max(0, maxLineLength - 3))}...`;
|
|
2999
|
+
}
|
|
3000
|
+
function createChildProcessOutputBuffer(options) {
|
|
3001
|
+
const maxLines = Math.max(1, DEFAULT_MAX_LINES);
|
|
3002
|
+
const maxLineLength = Math.max(4, DEFAULT_MAX_LINE_LENGTH);
|
|
3003
|
+
const lines = [];
|
|
3004
|
+
return {
|
|
3005
|
+
push(text) {
|
|
3006
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
3007
|
+
const line = rawLine.trim();
|
|
3008
|
+
if (!line) {
|
|
3009
|
+
continue;
|
|
3010
|
+
}
|
|
3011
|
+
lines.push(truncateLine(line, maxLineLength));
|
|
3012
|
+
while (lines.length > maxLines) {
|
|
3013
|
+
lines.shift();
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
},
|
|
3017
|
+
snapshot() {
|
|
3018
|
+
return lines.join("\n");
|
|
3019
|
+
},
|
|
3020
|
+
hasContent() {
|
|
3021
|
+
return lines.length > 0;
|
|
3022
|
+
}
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
|
|
2981
3026
|
const DEFAULT_SESSION_WEBHOOK_TIMEOUT_MS = 45e3;
|
|
3027
|
+
const DEFAULT_TRACKED_SESSION_SWEEP_INTERVAL_MS = 5e3;
|
|
2982
3028
|
function resolveSessionWebhookTimeoutMs() {
|
|
2983
3029
|
const parsed = Number.parseInt(process.env.HAPPY_DAEMON_SESSION_WEBHOOK_TIMEOUT || "", 10);
|
|
2984
3030
|
if (Number.isFinite(parsed) && parsed > 0) {
|
|
@@ -2986,6 +3032,13 @@ function resolveSessionWebhookTimeoutMs() {
|
|
|
2986
3032
|
}
|
|
2987
3033
|
return DEFAULT_SESSION_WEBHOOK_TIMEOUT_MS;
|
|
2988
3034
|
}
|
|
3035
|
+
function resolveTrackedSessionSweepIntervalMs() {
|
|
3036
|
+
const parsed = Number.parseInt(process.env.HAPPY_DAEMON_TRACKED_SESSION_SWEEP_INTERVAL || "", 10);
|
|
3037
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
3038
|
+
return parsed;
|
|
3039
|
+
}
|
|
3040
|
+
return DEFAULT_TRACKED_SESSION_SWEEP_INTERVAL_MS;
|
|
3041
|
+
}
|
|
2989
3042
|
const initialMachineMetadata = {
|
|
2990
3043
|
host: os$1.hostname(),
|
|
2991
3044
|
platform: os$1.platform(),
|
|
@@ -3016,6 +3069,7 @@ async function getProfileEnvironmentVariablesForAgent(profileId, agentType) {
|
|
|
3016
3069
|
}
|
|
3017
3070
|
async function startDaemon() {
|
|
3018
3071
|
const sessionWebhookTimeoutMs = resolveSessionWebhookTimeoutMs();
|
|
3072
|
+
const trackedSessionSweepIntervalMs = resolveTrackedSessionSweepIntervalMs();
|
|
3019
3073
|
const shutdownCoordinator = createShutdownCoordinator(async () => {
|
|
3020
3074
|
api.logger.debug("[DAEMON RUN] Startup malfunctioned, forcing exit with code 1");
|
|
3021
3075
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
@@ -3350,14 +3404,39 @@ async function startDaemon() {
|
|
|
3350
3404
|
// Capture stdout/stderr for debugging
|
|
3351
3405
|
env: buildDaemonChildEnv(process.env, extraEnv)
|
|
3352
3406
|
});
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
}
|
|
3360
|
-
|
|
3407
|
+
const stdoutBuffer = createChildProcessOutputBuffer();
|
|
3408
|
+
const stderrBuffer = createChildProcessOutputBuffer();
|
|
3409
|
+
let childOutputSnapshotLogged = false;
|
|
3410
|
+
const logChildOutputSnapshot = (reason) => {
|
|
3411
|
+
if (childOutputSnapshotLogged) {
|
|
3412
|
+
return;
|
|
3413
|
+
}
|
|
3414
|
+
childOutputSnapshotLogged = true;
|
|
3415
|
+
const stdoutSnapshot = stdoutBuffer.snapshot();
|
|
3416
|
+
const stderrSnapshot = stderrBuffer.snapshot();
|
|
3417
|
+
if (stdoutSnapshot) {
|
|
3418
|
+
api.logger.debug(`[DAEMON RUN] Child PID ${happyProcess.pid} recent stdout before ${reason}:
|
|
3419
|
+
${stdoutSnapshot}`);
|
|
3420
|
+
}
|
|
3421
|
+
if (stderrSnapshot) {
|
|
3422
|
+
api.logger.debug(`[DAEMON RUN] Child PID ${happyProcess.pid} recent stderr before ${reason}:
|
|
3423
|
+
${stderrSnapshot}`);
|
|
3424
|
+
}
|
|
3425
|
+
};
|
|
3426
|
+
happyProcess.stdout?.on("data", (data) => {
|
|
3427
|
+
const text = data.toString();
|
|
3428
|
+
stdoutBuffer.push(text);
|
|
3429
|
+
if (process.env.DEBUG) {
|
|
3430
|
+
api.logger.debug(`[DAEMON RUN] Child stdout: ${text}`);
|
|
3431
|
+
}
|
|
3432
|
+
});
|
|
3433
|
+
happyProcess.stderr?.on("data", (data) => {
|
|
3434
|
+
const text = data.toString();
|
|
3435
|
+
stderrBuffer.push(text);
|
|
3436
|
+
if (process.env.DEBUG) {
|
|
3437
|
+
api.logger.debug(`[DAEMON RUN] Child stderr: ${text}`);
|
|
3438
|
+
}
|
|
3439
|
+
});
|
|
3361
3440
|
if (!happyProcess.pid) {
|
|
3362
3441
|
api.logger.debug("[DAEMON RUN] Failed to spawn process - no PID returned");
|
|
3363
3442
|
if (precreatedCodexSession && api$1) {
|
|
@@ -3388,12 +3467,14 @@ async function startDaemon() {
|
|
|
3388
3467
|
};
|
|
3389
3468
|
pidToTrackedSession.set(happyProcess.pid, trackedSession);
|
|
3390
3469
|
happyProcess.on("exit", (code, signal) => {
|
|
3470
|
+
logChildOutputSnapshot(`exit (code=${code}, signal=${signal})`);
|
|
3391
3471
|
api.logger.debug(`[DAEMON RUN] Child PID ${happyProcess.pid} exited with code ${code}, signal ${signal}`);
|
|
3392
3472
|
if (happyProcess.pid) {
|
|
3393
3473
|
onChildExited(happyProcess.pid);
|
|
3394
3474
|
}
|
|
3395
3475
|
});
|
|
3396
3476
|
happyProcess.on("error", (error) => {
|
|
3477
|
+
logChildOutputSnapshot("process error");
|
|
3397
3478
|
api.logger.debug(`[DAEMON RUN] Child process error:`, error);
|
|
3398
3479
|
if (happyProcess.pid) {
|
|
3399
3480
|
onChildExited(happyProcess.pid);
|
|
@@ -3410,6 +3491,7 @@ async function startDaemon() {
|
|
|
3410
3491
|
return new Promise((resolve) => {
|
|
3411
3492
|
const timeout = setTimeout(() => {
|
|
3412
3493
|
pidToAwaiter.delete(happyProcess.pid);
|
|
3494
|
+
logChildOutputSnapshot("session webhook timeout");
|
|
3413
3495
|
api.logger.debug(`[DAEMON RUN] Session webhook timeout for PID ${happyProcess.pid}`);
|
|
3414
3496
|
const spawnError = createSpawnSessionError(
|
|
3415
3497
|
SPAWN_SESSION_ERROR_CODES.SESSION_WEBHOOK_TIMEOUT,
|
|
@@ -3594,6 +3676,25 @@ async function startDaemon() {
|
|
|
3594
3676
|
api.logger.debug("[DAEMON RUN] Remote session index startup recovery failed", error);
|
|
3595
3677
|
});
|
|
3596
3678
|
const heartbeatIntervalMs = parseInt(process.env.HAPPY_DAEMON_HEARTBEAT_INTERVAL || "60000");
|
|
3679
|
+
let trackedSessionSweepRunning = false;
|
|
3680
|
+
const trackedSessionSweepInterval = setInterval(() => {
|
|
3681
|
+
if (trackedSessionSweepRunning) {
|
|
3682
|
+
return;
|
|
3683
|
+
}
|
|
3684
|
+
trackedSessionSweepRunning = true;
|
|
3685
|
+
try {
|
|
3686
|
+
pruneStaleTrackedSessions({
|
|
3687
|
+
trackedSessionPids: pidToTrackedSession.keys(),
|
|
3688
|
+
removeTrackedSession: (pid) => {
|
|
3689
|
+
removeTrackedSession(pid, `fast stale-session sweep removed tracked PID ${pid}`);
|
|
3690
|
+
}
|
|
3691
|
+
});
|
|
3692
|
+
} catch (error) {
|
|
3693
|
+
api.logger.debug("[DAEMON RUN] Fast tracked-session sweep failed", error);
|
|
3694
|
+
} finally {
|
|
3695
|
+
trackedSessionSweepRunning = false;
|
|
3696
|
+
}
|
|
3697
|
+
}, trackedSessionSweepIntervalMs);
|
|
3597
3698
|
let heartbeatRunning = false;
|
|
3598
3699
|
const restartOnStaleVersionAndHeartbeat = setInterval(async () => {
|
|
3599
3700
|
if (heartbeatRunning) {
|
|
@@ -3665,6 +3766,7 @@ async function startDaemon() {
|
|
|
3665
3766
|
clearInterval(restartOnStaleVersionAndHeartbeat);
|
|
3666
3767
|
api.logger.debug("[DAEMON RUN] Health check interval cleared");
|
|
3667
3768
|
}
|
|
3769
|
+
clearInterval(trackedSessionSweepInterval);
|
|
3668
3770
|
if (remoteSessionIndexRefreshTimer) {
|
|
3669
3771
|
clearTimeout(remoteSessionIndexRefreshTimer);
|
|
3670
3772
|
remoteSessionIndexRefreshTimer = null;
|
|
@@ -7589,7 +7691,14 @@ ${recentStderrExcerpt}`);
|
|
|
7589
7691
|
prompt: [contentBlock]
|
|
7590
7692
|
};
|
|
7591
7693
|
api.logger.debug(`[AcpBackend] Prompt request:`, JSON.stringify(promptRequest, null, 2));
|
|
7592
|
-
await
|
|
7694
|
+
await raceWithProcessExit(
|
|
7695
|
+
this.process,
|
|
7696
|
+
this.connection.prompt(promptRequest),
|
|
7697
|
+
{
|
|
7698
|
+
agentName: this.transport.agentName,
|
|
7699
|
+
operationName: "prompt"
|
|
7700
|
+
}
|
|
7701
|
+
);
|
|
7593
7702
|
api.logger.debug("[AcpBackend] Prompt request sent to ACP connection");
|
|
7594
7703
|
if (this.waitingForResponse && this.activeToolCalls.size === 0 && this.sawSessionUpdateSincePrompt === false) {
|
|
7595
7704
|
const noUpdatesTimeoutMs = this.getPostPromptNoUpdatesTimeoutMs();
|
|
@@ -8482,7 +8591,7 @@ class AbortError extends Error {
|
|
|
8482
8591
|
}
|
|
8483
8592
|
}
|
|
8484
8593
|
|
|
8485
|
-
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-
|
|
8594
|
+
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-C3bSe5_d.cjs', document.baseURI).href)));
|
|
8486
8595
|
const __dirname$1 = path.join(__filename$1, "..");
|
|
8487
8596
|
function getGlobalClaudeVersion() {
|
|
8488
8597
|
try {
|
|
@@ -9752,11 +9861,11 @@ var launch = /*#__PURE__*/Object.freeze({
|
|
|
9752
9861
|
|
|
9753
9862
|
const unifiedProviderExecutors = {
|
|
9754
9863
|
claude: async (opts) => {
|
|
9755
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
9864
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-Dxye_oZf.cjs'); });
|
|
9756
9865
|
await runClaude(opts.credentials, opts.claudeOptions ?? {});
|
|
9757
9866
|
},
|
|
9758
9867
|
codex: async (opts) => {
|
|
9759
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
9868
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-IaL6Vqwc.cjs'); });
|
|
9760
9869
|
await runCodex({
|
|
9761
9870
|
credentials: opts.credentials,
|
|
9762
9871
|
startedBy: opts.startedBy,
|
|
@@ -9765,7 +9874,7 @@ const unifiedProviderExecutors = {
|
|
|
9765
9874
|
});
|
|
9766
9875
|
},
|
|
9767
9876
|
gemini: async (opts) => {
|
|
9768
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
9877
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BgcZcZsv.cjs'); });
|
|
9769
9878
|
await runGemini({
|
|
9770
9879
|
credentials: opts.credentials,
|
|
9771
9880
|
startedBy: opts.startedBy
|
|
@@ -9778,13 +9887,17 @@ const unifiedProviderExecutors = {
|
|
|
9778
9887
|
});
|
|
9779
9888
|
}
|
|
9780
9889
|
};
|
|
9781
|
-
async function ensureUnifiedRuntimePrerequisites(credentials) {
|
|
9890
|
+
async function ensureUnifiedRuntimePrerequisites(credentials, opts) {
|
|
9782
9891
|
if (credentials) {
|
|
9783
|
-
|
|
9892
|
+
if (!opts?.skipDaemonBootstrap) {
|
|
9893
|
+
await ensureUnifiedDaemonStarted();
|
|
9894
|
+
}
|
|
9784
9895
|
return credentials;
|
|
9785
9896
|
}
|
|
9786
9897
|
const auth = await authAndSetupMachineIfNeeded();
|
|
9787
|
-
|
|
9898
|
+
if (!opts?.skipDaemonBootstrap) {
|
|
9899
|
+
await ensureUnifiedDaemonStarted();
|
|
9900
|
+
}
|
|
9788
9901
|
return auth.credentials;
|
|
9789
9902
|
}
|
|
9790
9903
|
async function ensureUnifiedDaemonStarted() {
|
|
@@ -9805,7 +9918,10 @@ async function ensureUnifiedDaemonStarted() {
|
|
|
9805
9918
|
throw new Error("Failed to start Happy background service.");
|
|
9806
9919
|
}
|
|
9807
9920
|
async function executeUnifiedProvider(opts) {
|
|
9808
|
-
const
|
|
9921
|
+
const skipDaemonBootstrap = "startedBy" in opts && opts.startedBy === "daemon" || opts.provider === "claude" && opts.claudeOptions?.startedBy === "daemon";
|
|
9922
|
+
const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials, {
|
|
9923
|
+
skipDaemonBootstrap
|
|
9924
|
+
});
|
|
9809
9925
|
await unifiedProviderExecutors[opts.provider]({
|
|
9810
9926
|
...opts,
|
|
9811
9927
|
credentials
|
|
@@ -9841,7 +9957,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
9841
9957
|
return;
|
|
9842
9958
|
} else if (subcommand === "runtime") {
|
|
9843
9959
|
if (args[1] === "providers") {
|
|
9844
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
9960
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-Bw2XKjA9.cjs'); });
|
|
9845
9961
|
console.log(renderRuntimeProviders());
|
|
9846
9962
|
return;
|
|
9847
9963
|
}
|
|
@@ -10019,8 +10135,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
10019
10135
|
const projectId = args[3];
|
|
10020
10136
|
try {
|
|
10021
10137
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
10022
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
10023
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
10138
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-Db4p7gsX.cjs'); });
|
|
10139
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-CfmTDha2.cjs'); }).then(function (n) { return n.api; });
|
|
10024
10140
|
let userEmail = void 0;
|
|
10025
10141
|
try {
|
|
10026
10142
|
const credentials = await readCredentials2();
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('chalk');
|
|
4
|
-
require('./api-
|
|
5
|
-
require('./persistence-
|
|
4
|
+
require('./api-CfmTDha2.cjs');
|
|
5
|
+
require('./persistence-Db4p7gsX.cjs');
|
|
6
6
|
require('zod');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-C3bSe5_d.cjs');
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('cross-spawn');
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'chalk';
|
|
2
|
-
import './api-
|
|
3
|
-
import './persistence-
|
|
2
|
+
import './api-CfHYTLZX.mjs';
|
|
3
|
+
import './persistence-Nun5c360.mjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-BKjWLXkN.mjs';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'cross-spawn';
|
package/dist/lib.cjs
CHANGED
package/dist/lib.d.cts
CHANGED
|
@@ -2036,8 +2036,8 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
2036
2036
|
private metadataLock;
|
|
2037
2037
|
private encryptionKey;
|
|
2038
2038
|
private encryptionVariant;
|
|
2039
|
-
private
|
|
2040
|
-
private
|
|
2039
|
+
private pendingReliableSessionMessages;
|
|
2040
|
+
private pendingReliableSessionMessageBytes;
|
|
2041
2041
|
private reconnectAfterServerDisconnectTimer;
|
|
2042
2042
|
private lastSocketServerError;
|
|
2043
2043
|
private protocolV3SessionSync;
|
|
@@ -2125,9 +2125,12 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
2125
2125
|
private bufferLiveSessionEvent;
|
|
2126
2126
|
private supportsKnownProtocolCapability;
|
|
2127
2127
|
private emitEncryptedSessionMessage;
|
|
2128
|
-
private
|
|
2128
|
+
private bufferReliableSessionMessage;
|
|
2129
|
+
private flushReliableSessionMessages;
|
|
2129
2130
|
private shouldBufferReliableCodexMessage;
|
|
2130
|
-
private
|
|
2131
|
+
private shouldBufferReliableAcpMessage;
|
|
2132
|
+
private shouldBufferReliableSessionEvent;
|
|
2133
|
+
private trimPendingReliableSessionMessages;
|
|
2131
2134
|
private retryAfterServerDisconnect;
|
|
2132
2135
|
private clearReconnectAfterServerDisconnectTimer;
|
|
2133
2136
|
private normalizeSocketError;
|
|
@@ -2276,6 +2279,7 @@ declare class ApiClient {
|
|
|
2276
2279
|
tag: string;
|
|
2277
2280
|
metadata: Metadata;
|
|
2278
2281
|
state: AgentState | null;
|
|
2282
|
+
stableDataKeyPath?: string[];
|
|
2279
2283
|
}): Promise<Session | null>;
|
|
2280
2284
|
/**
|
|
2281
2285
|
* Register or update machine with the server
|
package/dist/lib.d.mts
CHANGED
|
@@ -2036,8 +2036,8 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
2036
2036
|
private metadataLock;
|
|
2037
2037
|
private encryptionKey;
|
|
2038
2038
|
private encryptionVariant;
|
|
2039
|
-
private
|
|
2040
|
-
private
|
|
2039
|
+
private pendingReliableSessionMessages;
|
|
2040
|
+
private pendingReliableSessionMessageBytes;
|
|
2041
2041
|
private reconnectAfterServerDisconnectTimer;
|
|
2042
2042
|
private lastSocketServerError;
|
|
2043
2043
|
private protocolV3SessionSync;
|
|
@@ -2125,9 +2125,12 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
2125
2125
|
private bufferLiveSessionEvent;
|
|
2126
2126
|
private supportsKnownProtocolCapability;
|
|
2127
2127
|
private emitEncryptedSessionMessage;
|
|
2128
|
-
private
|
|
2128
|
+
private bufferReliableSessionMessage;
|
|
2129
|
+
private flushReliableSessionMessages;
|
|
2129
2130
|
private shouldBufferReliableCodexMessage;
|
|
2130
|
-
private
|
|
2131
|
+
private shouldBufferReliableAcpMessage;
|
|
2132
|
+
private shouldBufferReliableSessionEvent;
|
|
2133
|
+
private trimPendingReliableSessionMessages;
|
|
2131
2134
|
private retryAfterServerDisconnect;
|
|
2132
2135
|
private clearReconnectAfterServerDisconnectTimer;
|
|
2133
2136
|
private normalizeSocketError;
|
|
@@ -2276,6 +2279,7 @@ declare class ApiClient {
|
|
|
2276
2279
|
tag: string;
|
|
2277
2280
|
metadata: Metadata;
|
|
2278
2281
|
state: AgentState | null;
|
|
2282
|
+
stableDataKeyPath?: string[];
|
|
2279
2283
|
}): Promise<Session | null>;
|
|
2280
2284
|
/**
|
|
2281
2285
|
* Register or update machine with the server
|
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-CfHYTLZX.mjs';
|
|
2
2
|
export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'chalk';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unlink, readFile, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
|
|
2
2
|
import { existsSync, unlinkSync, readdirSync, constants, writeFileSync, readFileSync } from 'node:fs';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
|
-
import { c as configuration, l as logger, e as encodeBase64 } from './api-
|
|
4
|
+
import { c as configuration, l as logger, e as encodeBase64 } from './api-CfHYTLZX.mjs';
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import 'chalk';
|
package/dist/{registerKillSessionHandler-5DVlZaJx.mjs → registerKillSessionHandler-C1S9ytML.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { k as initialMachineMetadata, R as RuntimeShell, l as resolveCanonicalToolNameV2, f as formatDisplayMessage } from './index-
|
|
2
|
-
import { readSettings } from './persistence-
|
|
1
|
+
import { k as initialMachineMetadata, R as RuntimeShell, l as resolveCanonicalToolNameV2, f as formatDisplayMessage } from './index-BKjWLXkN.mjs';
|
|
2
|
+
import { readSettings } from './persistence-Nun5c360.mjs';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { H as HAPPY_ORG_TURN_REPORT_TAG, d as HAPPY_ORG_SUMMARY_MAX_LENGTH, f as HAPPY_ORG_REPEAT_THRESHOLD, l as logger } from './api-
|
|
4
|
+
import { H as HAPPY_ORG_TURN_REPORT_TAG, d as HAPPY_ORG_SUMMARY_MAX_LENGTH, f as HAPPY_ORG_REPEAT_THRESHOLD, l as logger } from './api-CfHYTLZX.mjs';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import 'node:events';
|
package/dist/{registerKillSessionHandler-DjxtkGMv.cjs → registerKillSessionHandler-FIQEW2Rx.cjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var persistence = require('./persistence-
|
|
3
|
+
var index = require('./index-C3bSe5_d.cjs');
|
|
4
|
+
var persistence = require('./persistence-Db4p7gsX.cjs');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var api = require('./api-
|
|
6
|
+
var api = require('./api-CfmTDha2.cjs');
|
|
7
7
|
var crypto = require('crypto');
|
|
8
8
|
require('axios');
|
|
9
9
|
require('node:events');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-
|
|
2
|
+
import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-CfHYTLZX.mjs';
|
|
3
3
|
import 'cross-spawn';
|
|
4
4
|
import '@agentclientprotocol/sdk';
|
|
5
|
-
import { m as getProjectPath, F as Future, n as claudeLocal, E as ExitCodeError, o as trimIdent, q as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, u as claudeCheckSession, w as projectPath, x as mapToClaudeMode, P as PushableAsyncIterable, y as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, z as getEnvironmentInfo, a as createSessionMetadata, B as startCaffeinate, b as closeProviderSession } from './index-
|
|
5
|
+
import { m as getProjectPath, F as Future, n as claudeLocal, E as ExitCodeError, o as trimIdent, q as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, u as claudeCheckSession, w as projectPath, x as mapToClaudeMode, P as PushableAsyncIterable, y as query, A as AbortError, e as stopCaffeinate, p as publishSessionRegistration, z as getEnvironmentInfo, a as createSessionMetadata, B as startCaffeinate, b as closeProviderSession } from './index-BKjWLXkN.mjs';
|
|
6
6
|
import 'ps-list';
|
|
7
7
|
import 'fs';
|
|
8
8
|
import 'path';
|
|
@@ -13,7 +13,7 @@ import { dirname, basename, join, resolve } from 'node:path';
|
|
|
13
13
|
import { homedir } from 'node:os';
|
|
14
14
|
import { execSync } from 'node:child_process';
|
|
15
15
|
import 'node:readline';
|
|
16
|
-
import './persistence-
|
|
16
|
+
import './persistence-Nun5c360.mjs';
|
|
17
17
|
import { readFile } from 'node:fs/promises';
|
|
18
18
|
import { stat, watch, access } from 'fs/promises';
|
|
19
19
|
import 'crypto';
|
|
@@ -24,9 +24,9 @@ import 'tweetnacl';
|
|
|
24
24
|
import 'open';
|
|
25
25
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
26
26
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
27
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-
|
|
27
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-dczuX21U.mjs';
|
|
28
28
|
import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
29
|
-
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurn, l as launchRuntimeHandleWithFactoryResult, k as forwardAgentMessageToProviderSession, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
29
|
+
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, i as finalizeHappyOrgTurn, l as launchRuntimeHandleWithFactoryResult, k as forwardAgentMessageToProviderSession, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, h as hashObject, c as registerKillSessionHandler } from './registerKillSessionHandler-C1S9ytML.mjs';
|
|
30
30
|
import 'socket.io-client';
|
|
31
31
|
import 'expo-server-sdk';
|
|
32
32
|
import { isDeepStrictEqual } from 'node:util';
|
|
@@ -1384,6 +1384,10 @@ ${systemPrompt}` : systemPrompt,
|
|
|
1384
1384
|
let message = pending;
|
|
1385
1385
|
pending = null;
|
|
1386
1386
|
if (!message) {
|
|
1387
|
+
if (!shouldExit && session.queue.size() === 0 && !readyAlreadySent) {
|
|
1388
|
+
sendReady();
|
|
1389
|
+
readyAlreadySent = true;
|
|
1390
|
+
}
|
|
1387
1391
|
const waitSignal = abortController.signal;
|
|
1388
1392
|
const batch = await session.queue.waitForMessagesAndGetAsString(waitSignal);
|
|
1389
1393
|
if (!batch) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_crypto = require('node:crypto');
|
|
4
|
-
var api = require('./api-
|
|
4
|
+
var api = require('./api-CfmTDha2.cjs');
|
|
5
5
|
require('cross-spawn');
|
|
6
6
|
require('@agentclientprotocol/sdk');
|
|
7
|
-
var index = require('./index-
|
|
7
|
+
var index = require('./index-C3bSe5_d.cjs');
|
|
8
8
|
require('ps-list');
|
|
9
9
|
require('fs');
|
|
10
10
|
require('path');
|
|
@@ -15,7 +15,7 @@ var path = require('node:path');
|
|
|
15
15
|
var os = require('node:os');
|
|
16
16
|
var node_child_process = require('node:child_process');
|
|
17
17
|
require('node:readline');
|
|
18
|
-
require('./persistence-
|
|
18
|
+
require('./persistence-Db4p7gsX.cjs');
|
|
19
19
|
var promises = require('node:fs/promises');
|
|
20
20
|
var fs = require('fs/promises');
|
|
21
21
|
require('crypto');
|
|
@@ -26,9 +26,9 @@ require('tweetnacl');
|
|
|
26
26
|
require('open');
|
|
27
27
|
var React = require('react');
|
|
28
28
|
var ink = require('ink');
|
|
29
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
29
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-C6ILAmE3.cjs');
|
|
30
30
|
var types = require('./types-DVk3crez.cjs');
|
|
31
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
31
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-FIQEW2Rx.cjs');
|
|
32
32
|
require('socket.io-client');
|
|
33
33
|
require('expo-server-sdk');
|
|
34
34
|
var node_util = require('node:util');
|
|
@@ -1386,6 +1386,10 @@ ${systemPrompt}` : systemPrompt,
|
|
|
1386
1386
|
let message = pending;
|
|
1387
1387
|
pending = null;
|
|
1388
1388
|
if (!message) {
|
|
1389
|
+
if (!shouldExit && session.queue.size() === 0 && !readyAlreadySent) {
|
|
1390
|
+
sendReady();
|
|
1391
|
+
readyAlreadySent = true;
|
|
1392
|
+
}
|
|
1389
1393
|
const waitSignal = abortController.signal;
|
|
1390
1394
|
const batch = await session.queue.waitForMessagesAndGetAsString(waitSignal);
|
|
1391
1395
|
if (!batch) {
|