happy-imou-cloud 2.0.22 → 2.1.0
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/bin/happy-cloud.mjs +1 -1
- package/dist/{BaseReasoningProcessor-CJVv1aNR.cjs → BaseReasoningProcessor-C9mH8EVn.cjs} +3 -3
- package/dist/{BaseReasoningProcessor-mIqqngd3.mjs → BaseReasoningProcessor-DQkzwRuf.mjs} +3 -3
- package/dist/ProviderSelectionHandler-5Dedbm8j.cjs +265 -0
- package/dist/ProviderSelectionHandler-BlrrLPlo.mjs +261 -0
- package/dist/{api-DP-RQUao.cjs → api-Bd-MnOS4.cjs} +24 -2
- package/dist/{api-DrijKeDb.mjs → api-w_CUxb9Q.mjs} +25 -3
- package/dist/{command-BZphfJrt.cjs → command-DoDmHNxR.cjs} +3 -3
- package/dist/{command--vV6BSsL.mjs → command-mTWwCqTY.mjs} +3 -3
- package/dist/{index-CqCEZDFi.cjs → index-BQmJ4NAa.cjs} +199 -79
- package/dist/{index-BIki80pQ.mjs → index-GuXV-pxB.mjs} +196 -76
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +95 -92
- package/dist/lib.d.mts +95 -92
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-yVTbf_Ng.cjs → persistence-BL06LLVz.cjs} +1 -1
- package/dist/{persistence-C3NBdZdz.mjs → persistence-MSy70is3.mjs} +1 -1
- package/dist/{registerKillSessionHandler-CHEj7UjN.mjs → registerKillSessionHandler-CjWfUfc3.mjs} +428 -13
- package/dist/{registerKillSessionHandler-QmBN446A.cjs → registerKillSessionHandler-D9kwxy6B.cjs} +430 -12
- package/dist/{runClaude-BuI6OOEv.cjs → runClaude-D2ZEXue8.cjs} +11 -9
- package/dist/{runClaude-D0DD_Ya5.mjs → runClaude-DpZ95Twb.mjs} +8 -6
- package/dist/{runCodex-BzZ0jODI.mjs → runCodex-CJwaep2R.mjs} +9 -7
- package/dist/{runCodex-1jTTmCvq.cjs → runCodex-Dz_1ho8d.cjs} +12 -10
- package/dist/{runGemini-Bx2SYAyG.mjs → runGemini-BehqjM73.mjs} +192 -71
- package/dist/{runGemini-1gJRE8oT.cjs → runGemini-Dfu6LltX.cjs} +192 -71
- package/package.json +1 -1
- package/scripts/build.mjs +66 -66
- package/scripts/devtools/README.md +9 -9
- package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
- package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
- package/scripts/release-smoke.mjs +3 -0
- package/dist/ProviderSelectionHandler-BjLyIfSR.mjs +0 -673
- package/dist/ProviderSelectionHandler-e4zL4Y5_.cjs +0 -680
|
@@ -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-Bd-MnOS4.cjs');
|
|
5
|
+
var persistence = require('./persistence-BL06LLVz.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-BQmJ4NAa.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-BQmJ4NAa.cjs', document.baseURI).href))));
|
|
699
699
|
function projectPath() {
|
|
700
700
|
const path = path$1.resolve(__dirname$2, "..");
|
|
701
701
|
return path;
|
|
@@ -2541,16 +2541,36 @@ function createTrackedSessionFromRemoteIndexEntry(entry) {
|
|
|
2541
2541
|
pid: entry.sessionIndex?.hostPid ?? 0
|
|
2542
2542
|
};
|
|
2543
2543
|
}
|
|
2544
|
+
async function archiveStaleRemoteSession(userScopedObserver, session) {
|
|
2545
|
+
if (!userScopedObserver || !session.sessionIndex) {
|
|
2546
|
+
api.logger.debug(
|
|
2547
|
+
`[REMOTE SESSION INDEX] Stale remote session ${session.id} cannot be archived because user-scoped observer is unavailable`
|
|
2548
|
+
);
|
|
2549
|
+
return false;
|
|
2550
|
+
}
|
|
2551
|
+
const archived = userScopedObserver.syncSessionRuntimeIndex(session.id, {
|
|
2552
|
+
...session.sessionIndex,
|
|
2553
|
+
lifecycleState: "archived"
|
|
2554
|
+
}, {
|
|
2555
|
+
markInactive: true
|
|
2556
|
+
});
|
|
2557
|
+
if (archived) {
|
|
2558
|
+
api.logger.debug(`[REMOTE SESSION INDEX] Archived stale remote session ${session.id}`);
|
|
2559
|
+
}
|
|
2560
|
+
return archived;
|
|
2561
|
+
}
|
|
2544
2562
|
async function recoverTrackedSessionsFromRemoteIndex({
|
|
2545
2563
|
api: api$1,
|
|
2546
2564
|
machineId,
|
|
2547
2565
|
trackedSessionPids,
|
|
2548
2566
|
trackSession,
|
|
2567
|
+
userScopedObserver,
|
|
2549
2568
|
lookupHappyProcessByPid = findHappyProcessByPid
|
|
2550
2569
|
}) {
|
|
2551
2570
|
const sessions = await api$1.listSessionsIndex();
|
|
2552
2571
|
const alreadyTracked = new Set(trackedSessionPids);
|
|
2553
2572
|
let recoveredCount = 0;
|
|
2573
|
+
let archivedStaleCount = 0;
|
|
2554
2574
|
let skippedStaleCount = 0;
|
|
2555
2575
|
for (const session of sessions) {
|
|
2556
2576
|
const sessionIndex = session.sessionIndex;
|
|
@@ -2579,7 +2599,12 @@ async function recoverTrackedSessionsFromRemoteIndex({
|
|
|
2579
2599
|
}
|
|
2580
2600
|
const sessionPidIsAlive = lookupResult !== null && !NON_SESSION_PROCESS_TYPES$1.has(lookupResult.type);
|
|
2581
2601
|
if (!sessionPidIsAlive) {
|
|
2582
|
-
|
|
2602
|
+
const archived = await archiveStaleRemoteSession(userScopedObserver, session);
|
|
2603
|
+
if (archived) {
|
|
2604
|
+
archivedStaleCount++;
|
|
2605
|
+
} else {
|
|
2606
|
+
skippedStaleCount++;
|
|
2607
|
+
}
|
|
2583
2608
|
continue;
|
|
2584
2609
|
}
|
|
2585
2610
|
trackSession(pid, createTrackedSessionFromRemoteIndexEntry(session));
|
|
@@ -2589,6 +2614,7 @@ async function recoverTrackedSessionsFromRemoteIndex({
|
|
|
2589
2614
|
}
|
|
2590
2615
|
return {
|
|
2591
2616
|
recoveredCount,
|
|
2617
|
+
archivedStaleCount,
|
|
2592
2618
|
skippedStaleCount
|
|
2593
2619
|
};
|
|
2594
2620
|
}
|
|
@@ -3315,11 +3341,12 @@ async function startDaemon() {
|
|
|
3315
3341
|
trackedSessionPids: pidToTrackedSession.keys(),
|
|
3316
3342
|
trackSession: (pid, trackedSession) => {
|
|
3317
3343
|
pidToTrackedSession.set(pid, trackedSession);
|
|
3318
|
-
}
|
|
3344
|
+
},
|
|
3345
|
+
userScopedObserver
|
|
3319
3346
|
});
|
|
3320
|
-
if (recoveryResult.recoveredCount > 0 || recoveryResult.skippedStaleCount > 0) {
|
|
3347
|
+
if (recoveryResult.recoveredCount > 0 || recoveryResult.archivedStaleCount > 0 || recoveryResult.skippedStaleCount > 0) {
|
|
3321
3348
|
api.logger.debug(
|
|
3322
|
-
`[DAEMON RUN] Remote session index recovery ${label} completed: recovered=${recoveryResult.recoveredCount}, skippedStale=${recoveryResult.skippedStaleCount}`
|
|
3349
|
+
`[DAEMON RUN] Remote session index recovery ${label} completed: recovered=${recoveryResult.recoveredCount}, archivedStale=${recoveryResult.archivedStaleCount}, skippedStale=${recoveryResult.skippedStaleCount}`
|
|
3323
3350
|
);
|
|
3324
3351
|
}
|
|
3325
3352
|
};
|
|
@@ -4840,10 +4867,10 @@ function truncateDisplayMessage(value, maxLength) {
|
|
|
4840
4867
|
const DEFAULT_TIMEOUTS = {
|
|
4841
4868
|
/** Default initialization timeout: 60 seconds */
|
|
4842
4869
|
init: 6e4,
|
|
4843
|
-
/** Default tool call timeout:
|
|
4844
|
-
toolCall:
|
|
4845
|
-
/** Think tool timeout:
|
|
4846
|
-
think:
|
|
4870
|
+
/** Default tool call timeout: 10 minutes */
|
|
4871
|
+
toolCall: 10 * 6e4,
|
|
4872
|
+
/** Think tool timeout: 2 minutes */
|
|
4873
|
+
think: 2 * 6e4
|
|
4847
4874
|
};
|
|
4848
4875
|
class DefaultTransport {
|
|
4849
4876
|
agentName;
|
|
@@ -4920,7 +4947,7 @@ class DefaultTransport {
|
|
|
4920
4947
|
return toolName;
|
|
4921
4948
|
}
|
|
4922
4949
|
getPostPromptNoUpdatesTimeoutMs() {
|
|
4923
|
-
return
|
|
4950
|
+
return 2 * 6e4;
|
|
4924
4951
|
}
|
|
4925
4952
|
}
|
|
4926
4953
|
|
|
@@ -4930,11 +4957,11 @@ const GEMINI_TIMEOUTS = {
|
|
|
4930
4957
|
/** Gemini ACP can swallow an initialize request sent too early after spawn */
|
|
4931
4958
|
initDelay: 2500,
|
|
4932
4959
|
/** Standard tool call timeout */
|
|
4933
|
-
toolCall:
|
|
4960
|
+
toolCall: 10 * 6e4,
|
|
4934
4961
|
/** Investigation tools (codebase_investigator) can run for a long time */
|
|
4935
|
-
investigation:
|
|
4962
|
+
investigation: 30 * 6e4,
|
|
4936
4963
|
/** Think tools are usually quick */
|
|
4937
|
-
think:
|
|
4964
|
+
think: 2 * 6e4,
|
|
4938
4965
|
/** Idle detection after last message chunk */
|
|
4939
4966
|
idle: 500
|
|
4940
4967
|
};
|
|
@@ -5131,6 +5158,21 @@ class GeminiTransport {
|
|
|
5131
5158
|
}
|
|
5132
5159
|
const geminiTransport = new GeminiTransport();
|
|
5133
5160
|
|
|
5161
|
+
const DEFAULT_CODEX_EXECUTE_TIMEOUT_MS = 30 * 6e4;
|
|
5162
|
+
function readPositiveIntegerEnv$1(name) {
|
|
5163
|
+
const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
|
|
5164
|
+
if (!raw) {
|
|
5165
|
+
return null;
|
|
5166
|
+
}
|
|
5167
|
+
const value = Number(raw);
|
|
5168
|
+
if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) {
|
|
5169
|
+
return null;
|
|
5170
|
+
}
|
|
5171
|
+
return value;
|
|
5172
|
+
}
|
|
5173
|
+
function resolveCodexExecuteTimeoutMs() {
|
|
5174
|
+
return readPositiveIntegerEnv$1("HAPPY_CODEX_EXECUTE_TIMEOUT_MS") ?? readPositiveIntegerEnv$1("HAPPIER_CODEX_EXECUTE_TIMEOUT_MS") ?? DEFAULT_CODEX_EXECUTE_TIMEOUT_MS;
|
|
5175
|
+
}
|
|
5134
5176
|
class CodexTransport extends DefaultTransport {
|
|
5135
5177
|
constructor() {
|
|
5136
5178
|
super("codex");
|
|
@@ -5141,6 +5183,12 @@ class CodexTransport extends DefaultTransport {
|
|
|
5141
5183
|
getIdleTimeout() {
|
|
5142
5184
|
return 800;
|
|
5143
5185
|
}
|
|
5186
|
+
getToolCallTimeout(toolCallId, toolKind) {
|
|
5187
|
+
if (toolKind === "execute") {
|
|
5188
|
+
return resolveCodexExecuteTimeoutMs();
|
|
5189
|
+
}
|
|
5190
|
+
return super.getToolCallTimeout(toolCallId, toolKind);
|
|
5191
|
+
}
|
|
5144
5192
|
}
|
|
5145
5193
|
new CodexTransport();
|
|
5146
5194
|
|
|
@@ -5171,7 +5219,7 @@ class CursorTransport extends DefaultTransport {
|
|
|
5171
5219
|
const cursorTransport = new CursorTransport();
|
|
5172
5220
|
|
|
5173
5221
|
const DEFAULT_IDLE_TIMEOUT_MS = 500;
|
|
5174
|
-
const DEFAULT_TOOL_CALL_TIMEOUT_MS =
|
|
5222
|
+
const DEFAULT_TOOL_CALL_TIMEOUT_MS = 10 * 6e4;
|
|
5175
5223
|
const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_HEAD_BYTES = 2e3;
|
|
5176
5224
|
const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_TAIL_BYTES = 4e3;
|
|
5177
5225
|
function parseArgsFromContent(content) {
|
|
@@ -5431,41 +5479,14 @@ function startToolCall(toolCallId, toolKind, update, ctx, source) {
|
|
|
5431
5479
|
}
|
|
5432
5480
|
const timeoutMs = ctx.transport.getToolCallTimeout?.(toolCallId, toolKindStr) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
5433
5481
|
if (!ctx.toolCallTimeouts.has(toolCallId)) {
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
ctx.clearIdleTimeout();
|
|
5443
|
-
const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
|
|
5444
|
-
ctx.toolCallOutputs.delete(toolCallId);
|
|
5445
|
-
ctx.emit({
|
|
5446
|
-
type: "tool-result",
|
|
5447
|
-
toolName: realToolName,
|
|
5448
|
-
result: streamedOutput ? {
|
|
5449
|
-
stdout: streamedOutput,
|
|
5450
|
-
error: timeoutDetail,
|
|
5451
|
-
status: "failed",
|
|
5452
|
-
timedOut: true
|
|
5453
|
-
} : {
|
|
5454
|
-
error: timeoutDetail,
|
|
5455
|
-
status: "failed",
|
|
5456
|
-
timedOut: true
|
|
5457
|
-
},
|
|
5458
|
-
callId: toolCallId
|
|
5459
|
-
});
|
|
5460
|
-
ctx.emit({
|
|
5461
|
-
type: "status",
|
|
5462
|
-
status: "error",
|
|
5463
|
-
detail: timeoutDetail
|
|
5464
|
-
});
|
|
5465
|
-
ctx.failPendingResponseWait(new Error(timeoutDetail));
|
|
5466
|
-
}, timeoutMs);
|
|
5467
|
-
ctx.toolCallTimeouts.set(toolCallId, timeout);
|
|
5468
|
-
api.logger.debug(`[AcpBackend] \u23F1\uFE0F Set timeout for ${toolCallId}: ${(timeoutMs / 1e3).toFixed(0)}s${isInvestigation ? " (investigation tool)" : ""}`);
|
|
5482
|
+
ctx.armToolCallTimeout({
|
|
5483
|
+
toolCallId,
|
|
5484
|
+
toolKind,
|
|
5485
|
+
toolName: realToolName,
|
|
5486
|
+
timeoutMs,
|
|
5487
|
+
source
|
|
5488
|
+
});
|
|
5489
|
+
api.logger.debug(`[AcpBackend] \u23F1\uFE0F Set no-progress timeout for ${toolCallId}: ${(timeoutMs / 1e3).toFixed(0)}s${isInvestigation ? " (investigation tool)" : ""}`);
|
|
5469
5490
|
} else {
|
|
5470
5491
|
api.logger.debug(`[AcpBackend] Timeout already set for ${toolCallId}, skipping`);
|
|
5471
5492
|
}
|
|
@@ -5491,11 +5512,7 @@ function completeToolCall(toolCallId, toolKind, content, ctx) {
|
|
|
5491
5512
|
const toolKindStr = typeof toolKind === "string" ? toolKind : "unknown";
|
|
5492
5513
|
ctx.activeToolCalls.delete(toolCallId);
|
|
5493
5514
|
ctx.toolCallStartTimes.delete(toolCallId);
|
|
5494
|
-
|
|
5495
|
-
if (timeout) {
|
|
5496
|
-
clearTimeout(timeout);
|
|
5497
|
-
ctx.toolCallTimeouts.delete(toolCallId);
|
|
5498
|
-
}
|
|
5515
|
+
ctx.clearToolCallTimeout(toolCallId);
|
|
5499
5516
|
const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
|
|
5500
5517
|
ctx.toolCallOutputs.delete(toolCallId);
|
|
5501
5518
|
api.logger.debug(`[AcpBackend] \u2705 Tool call COMPLETED: ${toolCallId} (${toolKindStr}) - Duration: ${duration}. Active tool calls: ${ctx.activeToolCalls.size}`);
|
|
@@ -5534,10 +5551,8 @@ function failToolCall(toolCallId, status, toolKind, content, ctx) {
|
|
|
5534
5551
|
}
|
|
5535
5552
|
ctx.activeToolCalls.delete(toolCallId);
|
|
5536
5553
|
ctx.toolCallStartTimes.delete(toolCallId);
|
|
5537
|
-
const
|
|
5538
|
-
if (
|
|
5539
|
-
clearTimeout(timeout);
|
|
5540
|
-
ctx.toolCallTimeouts.delete(toolCallId);
|
|
5554
|
+
const clearedTimeout = ctx.clearToolCallTimeout(toolCallId);
|
|
5555
|
+
if (clearedTimeout) {
|
|
5541
5556
|
api.logger.debug(`[AcpBackend] Cleared timeout for ${toolCallId} (tool call ${status})`);
|
|
5542
5557
|
} else {
|
|
5543
5558
|
api.logger.debug(`[AcpBackend] No timeout found for ${toolCallId} (tool call ${status}) - timeout may not have been set`);
|
|
@@ -5860,7 +5875,7 @@ const RETRY_CONFIG = {
|
|
|
5860
5875
|
/** Maximum delay between retries in ms */
|
|
5861
5876
|
maxDelayMs: 5e3
|
|
5862
5877
|
};
|
|
5863
|
-
const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS =
|
|
5878
|
+
const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS = 2 * 6e4;
|
|
5864
5879
|
function readPositiveIntegerEnv(name) {
|
|
5865
5880
|
const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
|
|
5866
5881
|
if (!raw) {
|
|
@@ -6169,6 +6184,7 @@ class AcpBackend {
|
|
|
6169
6184
|
/** Track active tool calls to prevent duplicate events */
|
|
6170
6185
|
activeToolCalls = /* @__PURE__ */ new Set();
|
|
6171
6186
|
toolCallTimeouts = /* @__PURE__ */ new Map();
|
|
6187
|
+
toolCallTimeoutSpecs = /* @__PURE__ */ new Map();
|
|
6172
6188
|
/** Track tool call start times for performance monitoring */
|
|
6173
6189
|
toolCallStartTimes = /* @__PURE__ */ new Map();
|
|
6174
6190
|
/** Track streamed tool output between ACP updates and final completion */
|
|
@@ -6193,6 +6209,12 @@ class AcpBackend {
|
|
|
6193
6209
|
waitingForResponse = false;
|
|
6194
6210
|
/** First fatal prompt-level error observed for the current turn */
|
|
6195
6211
|
responseCompletionError = null;
|
|
6212
|
+
/** Resettable no-progress timeout while waiting for a turn to finish */
|
|
6213
|
+
responseWaitTimeout = null;
|
|
6214
|
+
/** Current inactivity threshold used by waitForResponseComplete */
|
|
6215
|
+
responseWaitTimeoutMs = null;
|
|
6216
|
+
/** Timestamp of the last meaningful response progress for the current turn */
|
|
6217
|
+
responseLastProgressAt = null;
|
|
6196
6218
|
/** Fallback completion when prompt returns but the agent emits no session updates */
|
|
6197
6219
|
postPromptCompletionIdleTimeout = null;
|
|
6198
6220
|
/** Whether at least one session/update arrived after the current prompt */
|
|
@@ -6226,12 +6248,110 @@ class AcpBackend {
|
|
|
6226
6248
|
this.postPromptCompletionIdleTimeout = null;
|
|
6227
6249
|
}
|
|
6228
6250
|
}
|
|
6251
|
+
clearResponseWaitTimeout() {
|
|
6252
|
+
if (this.responseWaitTimeout) {
|
|
6253
|
+
clearTimeout(this.responseWaitTimeout);
|
|
6254
|
+
this.responseWaitTimeout = null;
|
|
6255
|
+
}
|
|
6256
|
+
}
|
|
6257
|
+
resetResponseWaitTracking() {
|
|
6258
|
+
this.clearResponseWaitTimeout();
|
|
6259
|
+
this.responseWaitTimeoutMs = null;
|
|
6260
|
+
this.responseLastProgressAt = null;
|
|
6261
|
+
}
|
|
6262
|
+
armResponseWaitTimeout(timeoutMs) {
|
|
6263
|
+
this.responseWaitTimeoutMs = timeoutMs;
|
|
6264
|
+
this.clearResponseWaitTimeout();
|
|
6265
|
+
const lastProgressAt = this.responseLastProgressAt ?? Date.now();
|
|
6266
|
+
const elapsedMs = Math.max(0, Date.now() - lastProgressAt);
|
|
6267
|
+
const remainingMs = Math.max(1, timeoutMs - elapsedMs);
|
|
6268
|
+
this.responseWaitTimeout = setTimeout(() => {
|
|
6269
|
+
this.responseWaitTimeout = null;
|
|
6270
|
+
this.responseWaitTimeoutMs = null;
|
|
6271
|
+
this.failPendingResponseWait(new Error("Timeout waiting for response to complete"));
|
|
6272
|
+
}, remainingMs);
|
|
6273
|
+
}
|
|
6274
|
+
scheduleToolCallTimeout(toolCallId) {
|
|
6275
|
+
const spec = this.toolCallTimeoutSpecs.get(toolCallId);
|
|
6276
|
+
if (!spec) {
|
|
6277
|
+
return;
|
|
6278
|
+
}
|
|
6279
|
+
const existing = this.toolCallTimeouts.get(toolCallId);
|
|
6280
|
+
if (existing) {
|
|
6281
|
+
clearTimeout(existing);
|
|
6282
|
+
}
|
|
6283
|
+
const timeout = setTimeout(() => {
|
|
6284
|
+
const duration = formatDuration(this.toolCallStartTimes.get(toolCallId));
|
|
6285
|
+
const timeoutLabel = formatToolCallTimeoutLimit(spec.timeoutMs);
|
|
6286
|
+
const timeoutDetail = `Tool call ${spec.toolName} timed out after ${timeoutLabel}`;
|
|
6287
|
+
api.logger.debug(`[AcpBackend] \u23F1\uFE0F Tool call TIMEOUT (from ${spec.source}): ${toolCallId} (${spec.toolKind}) after ${timeoutLabel} without progress - Duration: ${duration}, failing current turn`);
|
|
6288
|
+
this.activeToolCalls.delete(toolCallId);
|
|
6289
|
+
this.toolCallStartTimes.delete(toolCallId);
|
|
6290
|
+
this.clearToolCallTimeout(toolCallId);
|
|
6291
|
+
this.clearIdleTimeoutState();
|
|
6292
|
+
const streamedOutput = renderToolOutput(this.toolCallOutputs.get(toolCallId));
|
|
6293
|
+
this.toolCallOutputs.delete(toolCallId);
|
|
6294
|
+
this.emit({
|
|
6295
|
+
type: "tool-result",
|
|
6296
|
+
toolName: spec.toolName,
|
|
6297
|
+
result: streamedOutput ? {
|
|
6298
|
+
stdout: streamedOutput,
|
|
6299
|
+
error: timeoutDetail,
|
|
6300
|
+
status: "failed",
|
|
6301
|
+
timedOut: true
|
|
6302
|
+
} : {
|
|
6303
|
+
error: timeoutDetail,
|
|
6304
|
+
status: "failed",
|
|
6305
|
+
timedOut: true
|
|
6306
|
+
},
|
|
6307
|
+
callId: toolCallId
|
|
6308
|
+
});
|
|
6309
|
+
this.emit({
|
|
6310
|
+
type: "status",
|
|
6311
|
+
status: "error",
|
|
6312
|
+
detail: timeoutDetail
|
|
6313
|
+
});
|
|
6314
|
+
this.failPendingResponseWait(new Error(timeoutDetail));
|
|
6315
|
+
}, spec.timeoutMs);
|
|
6316
|
+
this.toolCallTimeouts.set(toolCallId, timeout);
|
|
6317
|
+
}
|
|
6318
|
+
armToolCallTimeout(spec) {
|
|
6319
|
+
this.toolCallTimeoutSpecs.set(spec.toolCallId, spec);
|
|
6320
|
+
this.scheduleToolCallTimeout(spec.toolCallId);
|
|
6321
|
+
}
|
|
6322
|
+
clearToolCallTimeout(toolCallId) {
|
|
6323
|
+
const timeout = this.toolCallTimeouts.get(toolCallId);
|
|
6324
|
+
const hadTimeout = Boolean(timeout);
|
|
6325
|
+
if (timeout) {
|
|
6326
|
+
clearTimeout(timeout);
|
|
6327
|
+
this.toolCallTimeouts.delete(toolCallId);
|
|
6328
|
+
}
|
|
6329
|
+
this.toolCallTimeoutSpecs.delete(toolCallId);
|
|
6330
|
+
return hadTimeout;
|
|
6331
|
+
}
|
|
6332
|
+
refreshActiveToolCallTimeouts() {
|
|
6333
|
+
for (const toolCallId of this.activeToolCalls) {
|
|
6334
|
+
if (this.toolCallTimeoutSpecs.has(toolCallId)) {
|
|
6335
|
+
this.scheduleToolCallTimeout(toolCallId);
|
|
6336
|
+
}
|
|
6337
|
+
}
|
|
6338
|
+
}
|
|
6339
|
+
markResponseProgress(opts = {}) {
|
|
6340
|
+
this.responseLastProgressAt = Date.now();
|
|
6341
|
+
if (opts.refreshToolTimeouts !== false) {
|
|
6342
|
+
this.refreshActiveToolCallTimeouts();
|
|
6343
|
+
}
|
|
6344
|
+
if (this.waitingForResponse && this.responseWaitTimeoutMs != null) {
|
|
6345
|
+
this.armResponseWaitTimeout(this.responseWaitTimeoutMs);
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6229
6348
|
clearToolCallTracking() {
|
|
6230
6349
|
this.activeToolCalls.clear();
|
|
6231
6350
|
for (const timeout of this.toolCallTimeouts.values()) {
|
|
6232
6351
|
clearTimeout(timeout);
|
|
6233
6352
|
}
|
|
6234
6353
|
this.toolCallTimeouts.clear();
|
|
6354
|
+
this.toolCallTimeoutSpecs.clear();
|
|
6235
6355
|
this.toolCallStartTimes.clear();
|
|
6236
6356
|
this.toolCallIdToNameMap.clear();
|
|
6237
6357
|
this.toolCallOutputs.clear();
|
|
@@ -6241,6 +6361,7 @@ class AcpBackend {
|
|
|
6241
6361
|
this.responseCompletionOutcome = null;
|
|
6242
6362
|
this.responseCompletionError = null;
|
|
6243
6363
|
this.sawSessionUpdateSincePrompt = false;
|
|
6364
|
+
this.resetResponseWaitTracking();
|
|
6244
6365
|
this.clearIdleTimeoutState();
|
|
6245
6366
|
this.clearPostPromptCompletionIdleTimeout();
|
|
6246
6367
|
this.clearToolCallTracking();
|
|
@@ -6252,6 +6373,7 @@ class AcpBackend {
|
|
|
6252
6373
|
this.responseCompletionError = error;
|
|
6253
6374
|
this.responseCompletionOutcome = null;
|
|
6254
6375
|
this.waitingForResponse = false;
|
|
6376
|
+
this.resetResponseWaitTracking();
|
|
6255
6377
|
this.clearPostPromptCompletionIdleTimeout();
|
|
6256
6378
|
if (this.idleRejecter) {
|
|
6257
6379
|
this.idleRejecter(error);
|
|
@@ -6261,6 +6383,7 @@ class AcpBackend {
|
|
|
6261
6383
|
}
|
|
6262
6384
|
settleResponseWaiter(outcome) {
|
|
6263
6385
|
const hasActiveWaiter = Boolean(this.idleResolver || this.idleRejecter);
|
|
6386
|
+
this.resetResponseWaitTracking();
|
|
6264
6387
|
if (!this.waitingForResponse && !hasActiveWaiter) {
|
|
6265
6388
|
return;
|
|
6266
6389
|
}
|
|
@@ -6732,6 +6855,8 @@ ${recentStderrExcerpt}`);
|
|
|
6732
6855
|
emit: (msg) => this.emit(msg),
|
|
6733
6856
|
emitIdleStatus: () => this.emitIdleStatus(),
|
|
6734
6857
|
failPendingResponseWait: (error) => this.failPendingResponseWait(error),
|
|
6858
|
+
armToolCallTimeout: (spec) => this.armToolCallTimeout(spec),
|
|
6859
|
+
clearToolCallTimeout: (toolCallId) => this.clearToolCallTimeout(toolCallId),
|
|
6735
6860
|
clearIdleTimeout: () => {
|
|
6736
6861
|
if (this.idleTimeout) {
|
|
6737
6862
|
clearTimeout(this.idleTimeout);
|
|
@@ -6772,6 +6897,7 @@ ${recentStderrExcerpt}`);
|
|
|
6772
6897
|
this.clearPostPromptCompletionIdleTimeout();
|
|
6773
6898
|
for (const update of updates) {
|
|
6774
6899
|
const sessionUpdateType = update.sessionUpdate;
|
|
6900
|
+
this.markResponseProgress();
|
|
6775
6901
|
if (sessionUpdateType !== "agent_message_chunk" && sessionUpdateType !== "tool_call_update") {
|
|
6776
6902
|
api.logger.debug(`[AcpBackend] Received session update: ${sessionUpdateType}`, JSON.stringify({
|
|
6777
6903
|
sessionUpdate: sessionUpdateType,
|
|
@@ -6835,6 +6961,7 @@ ${recentStderrExcerpt}`);
|
|
|
6835
6961
|
this.resetResponseTrackingForNewPrompt();
|
|
6836
6962
|
this.emit({ type: "status", status: "running" });
|
|
6837
6963
|
this.waitingForResponse = true;
|
|
6964
|
+
this.markResponseProgress({ refreshToolTimeouts: false });
|
|
6838
6965
|
try {
|
|
6839
6966
|
api.logger.debug(`[AcpBackend] Sending prompt (length: ${prompt.length}): ${prompt.substring(0, 100)}...`);
|
|
6840
6967
|
api.logger.debug(`[AcpBackend] Full prompt: ${prompt}`);
|
|
@@ -6895,7 +7022,7 @@ ${recentStderrExcerpt}`);
|
|
|
6895
7022
|
* Wait for the response to complete (idle status after all chunks received)
|
|
6896
7023
|
* Call this after sendPrompt to wait for Gemini to finish responding
|
|
6897
7024
|
*/
|
|
6898
|
-
async waitForResponseComplete(timeoutMs =
|
|
7025
|
+
async waitForResponseComplete(timeoutMs = 10 * 6e4) {
|
|
6899
7026
|
if (this.responseCompletionError) {
|
|
6900
7027
|
throw this.responseCompletionError;
|
|
6901
7028
|
}
|
|
@@ -6911,26 +7038,19 @@ ${recentStderrExcerpt}`);
|
|
|
6911
7038
|
return;
|
|
6912
7039
|
}
|
|
6913
7040
|
return new Promise((resolve, reject) => {
|
|
6914
|
-
const timeout = setTimeout(() => {
|
|
6915
|
-
this.idleResolver = null;
|
|
6916
|
-
this.idleRejecter = null;
|
|
6917
|
-
this.waitingForResponse = false;
|
|
6918
|
-
reject(new Error("Timeout waiting for response to complete"));
|
|
6919
|
-
}, timeoutMs);
|
|
6920
7041
|
this.idleResolver = () => {
|
|
6921
|
-
clearTimeout(timeout);
|
|
6922
7042
|
this.idleResolver = null;
|
|
6923
7043
|
this.idleRejecter = null;
|
|
6924
7044
|
this.waitingForResponse = false;
|
|
6925
7045
|
resolve();
|
|
6926
7046
|
};
|
|
6927
7047
|
this.idleRejecter = (error) => {
|
|
6928
|
-
clearTimeout(timeout);
|
|
6929
7048
|
this.idleResolver = null;
|
|
6930
7049
|
this.idleRejecter = null;
|
|
6931
7050
|
this.waitingForResponse = false;
|
|
6932
7051
|
reject(error);
|
|
6933
7052
|
};
|
|
7053
|
+
this.armResponseWaitTimeout(timeoutMs);
|
|
6934
7054
|
});
|
|
6935
7055
|
}
|
|
6936
7056
|
/**
|
|
@@ -7745,7 +7865,7 @@ class AbortError extends Error {
|
|
|
7745
7865
|
}
|
|
7746
7866
|
}
|
|
7747
7867
|
|
|
7748
|
-
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-
|
|
7868
|
+
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-BQmJ4NAa.cjs', document.baseURI).href)));
|
|
7749
7869
|
const __dirname$1 = path.join(__filename$1, "..");
|
|
7750
7870
|
function getGlobalClaudeVersion() {
|
|
7751
7871
|
try {
|
|
@@ -8416,7 +8536,7 @@ class ClaudeCodeBackend {
|
|
|
8416
8536
|
api.logger.debug("[ClaudeRuntimeBackend] Error interrupting Claude query:", error);
|
|
8417
8537
|
}
|
|
8418
8538
|
}
|
|
8419
|
-
async waitForResponseComplete(timeoutMs =
|
|
8539
|
+
async waitForResponseComplete(timeoutMs = 10 * 6e4) {
|
|
8420
8540
|
if (this.responseCompletionOutcome) {
|
|
8421
8541
|
const outcome = this.responseCompletionOutcome;
|
|
8422
8542
|
if (outcome.kind === "rejected") {
|
|
@@ -8996,11 +9116,11 @@ var launch = /*#__PURE__*/Object.freeze({
|
|
|
8996
9116
|
|
|
8997
9117
|
const unifiedProviderExecutors = {
|
|
8998
9118
|
claude: async (opts) => {
|
|
8999
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
9119
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-D2ZEXue8.cjs'); });
|
|
9000
9120
|
await runClaude(opts.credentials, opts.claudeOptions ?? {});
|
|
9001
9121
|
},
|
|
9002
9122
|
codex: async (opts) => {
|
|
9003
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
9123
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-Dz_1ho8d.cjs'); });
|
|
9004
9124
|
await runCodex({
|
|
9005
9125
|
credentials: opts.credentials,
|
|
9006
9126
|
startedBy: opts.startedBy,
|
|
@@ -9009,7 +9129,7 @@ const unifiedProviderExecutors = {
|
|
|
9009
9129
|
});
|
|
9010
9130
|
},
|
|
9011
9131
|
gemini: async (opts) => {
|
|
9012
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
9132
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-Dfu6LltX.cjs'); });
|
|
9013
9133
|
await runGemini({
|
|
9014
9134
|
credentials: opts.credentials,
|
|
9015
9135
|
startedBy: opts.startedBy
|
|
@@ -9085,7 +9205,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
9085
9205
|
return;
|
|
9086
9206
|
} else if (subcommand === "runtime") {
|
|
9087
9207
|
if (args[1] === "providers") {
|
|
9088
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
9208
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DoDmHNxR.cjs'); });
|
|
9089
9209
|
console.log(renderRuntimeProviders());
|
|
9090
9210
|
return;
|
|
9091
9211
|
}
|
|
@@ -9263,8 +9383,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
9263
9383
|
const projectId = args[3];
|
|
9264
9384
|
try {
|
|
9265
9385
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
9266
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
9267
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
9386
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-BL06LLVz.cjs'); });
|
|
9387
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-Bd-MnOS4.cjs'); }).then(function (n) { return n.api; });
|
|
9268
9388
|
let userEmail = void 0;
|
|
9269
9389
|
try {
|
|
9270
9390
|
const credentials = await readCredentials2();
|