happy-imou-cloud 2.1.1 → 2.1.3
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 +21 -21
- package/compat/acp-sdk-schema/index.js +27 -27
- package/compat/acp-sdk-schema/types.gen.js +2 -2
- package/compat/acp-sdk-schema/zod.gen.js +1553 -1553
- package/compat/ink-build/components/Cursor.d.ts +83 -83
- package/compat/ink-build/components/Cursor.js +52 -52
- package/compat/ink-build/components/CursorContext.d.ts +11 -11
- package/compat/ink-build/components/CursorContext.js +7 -7
- package/compat/ink-build/components/ErrorBoundary.d.ts +18 -18
- package/compat/ink-build/components/ErrorBoundary.js +22 -22
- package/compat/ink-build/hooks/use-cursor.d.ts +12 -12
- package/compat/ink-build/hooks/use-cursor.js +28 -28
- package/dist/{BaseReasoningProcessor-CBMK-8Gi.cjs → BaseReasoningProcessor-BrcBFCoL.cjs} +3 -3
- package/dist/{BaseReasoningProcessor-Dn9FxfxU.mjs → BaseReasoningProcessor-CPLK0a8y.mjs} +3 -3
- package/dist/ProviderSelectionHandler-CrXfMTg1.mjs +261 -0
- package/dist/ProviderSelectionHandler-f7_I3vQa.cjs +265 -0
- package/dist/{api-DBy5lPZw.mjs → api-BGv79x9Q.mjs} +3 -3
- package/dist/{api-DId_j3C2.cjs → api-OoiG7XjD.cjs} +2 -2
- package/dist/{command-DwfUpmId.cjs → command-DAYJSP16.cjs} +3 -3
- package/dist/{command-CeaBwYCW.mjs → command-FbV44egL.mjs} +3 -3
- package/dist/{index-CuuYSKiv.cjs → index-D9lWHpn-.cjs} +199 -78
- package/dist/{index-66vjECEd.mjs → index-TRC83Ks9.mjs} +196 -75
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +51 -52
- package/dist/lib.d.mts +51 -52
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-BOWh1NER.mjs → persistence-Cmgj3ubQ.mjs} +1 -1
- package/dist/{persistence-Dzr6sFwD.cjs → persistence-lN9HV4IZ.cjs} +1 -1
- package/dist/{registerKillSessionHandler-D4_wpN18.mjs → registerKillSessionHandler-NZd3xieQ.mjs} +417 -5
- package/dist/{registerKillSessionHandler-Dg_iRBPm.cjs → registerKillSessionHandler-pk4Ohq4Y.cjs} +419 -4
- package/dist/{runClaude-B74dHAnQ.mjs → runClaude-7St9-Jci.mjs} +34 -5
- package/dist/{runClaude-oIFzkfuU.cjs → runClaude-BP-O6ucu.cjs} +37 -8
- package/dist/{runCodex-D_9CuL6M.cjs → runCodex-BV6kKtTO.cjs} +29 -21
- package/dist/{runCodex-mLHjsgVj.mjs → runCodex-BaXi_9BC.mjs} +26 -18
- package/dist/{runGemini-CcWGezMt.cjs → runGemini-BiYKqJqO.cjs} +267 -82
- package/dist/{runGemini-BMiho2ab.mjs → runGemini-ClNqE9N3.mjs} +267 -82
- package/package.json +9 -9
- package/scripts/build.mjs +68 -68
- 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/ensureAcpSdkCompat.mjs +171 -173
- package/scripts/release-smoke.mjs +38 -35
- package/dist/ProviderSelectionHandler-BuXk-8ji.cjs +0 -680
- package/dist/ProviderSelectionHandler-CMaQThYO.mjs +0 -673
|
@@ -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-OoiG7XjD.cjs');
|
|
5
|
+
var persistence = require('./persistence-lN9HV4IZ.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-D9lWHpn-.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-D9lWHpn-.cjs', document.baseURI).href))));
|
|
699
699
|
function projectPath() {
|
|
700
700
|
const path = path$1.resolve(__dirname$2, "..");
|
|
701
701
|
return path;
|
|
@@ -4867,10 +4867,10 @@ function truncateDisplayMessage(value, maxLength) {
|
|
|
4867
4867
|
const DEFAULT_TIMEOUTS = {
|
|
4868
4868
|
/** Default initialization timeout: 60 seconds */
|
|
4869
4869
|
init: 6e4,
|
|
4870
|
-
/** Default tool call timeout:
|
|
4871
|
-
toolCall:
|
|
4872
|
-
/** Think tool timeout:
|
|
4873
|
-
think:
|
|
4870
|
+
/** Default tool call timeout: 10 minutes */
|
|
4871
|
+
toolCall: 10 * 6e4,
|
|
4872
|
+
/** Think tool timeout: 2 minutes */
|
|
4873
|
+
think: 2 * 6e4
|
|
4874
4874
|
};
|
|
4875
4875
|
class DefaultTransport {
|
|
4876
4876
|
agentName;
|
|
@@ -4947,7 +4947,7 @@ class DefaultTransport {
|
|
|
4947
4947
|
return toolName;
|
|
4948
4948
|
}
|
|
4949
4949
|
getPostPromptNoUpdatesTimeoutMs() {
|
|
4950
|
-
return
|
|
4950
|
+
return 2 * 6e4;
|
|
4951
4951
|
}
|
|
4952
4952
|
}
|
|
4953
4953
|
|
|
@@ -4957,11 +4957,11 @@ const GEMINI_TIMEOUTS = {
|
|
|
4957
4957
|
/** Gemini ACP can swallow an initialize request sent too early after spawn */
|
|
4958
4958
|
initDelay: 2500,
|
|
4959
4959
|
/** Standard tool call timeout */
|
|
4960
|
-
toolCall:
|
|
4960
|
+
toolCall: 10 * 6e4,
|
|
4961
4961
|
/** Investigation tools (codebase_investigator) can run for a long time */
|
|
4962
|
-
investigation:
|
|
4962
|
+
investigation: 30 * 6e4,
|
|
4963
4963
|
/** Think tools are usually quick */
|
|
4964
|
-
think:
|
|
4964
|
+
think: 2 * 6e4,
|
|
4965
4965
|
/** Idle detection after last message chunk */
|
|
4966
4966
|
idle: 500
|
|
4967
4967
|
};
|
|
@@ -5158,6 +5158,21 @@ class GeminiTransport {
|
|
|
5158
5158
|
}
|
|
5159
5159
|
const geminiTransport = new GeminiTransport();
|
|
5160
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
|
+
}
|
|
5161
5176
|
class CodexTransport extends DefaultTransport {
|
|
5162
5177
|
constructor() {
|
|
5163
5178
|
super("codex");
|
|
@@ -5168,6 +5183,12 @@ class CodexTransport extends DefaultTransport {
|
|
|
5168
5183
|
getIdleTimeout() {
|
|
5169
5184
|
return 800;
|
|
5170
5185
|
}
|
|
5186
|
+
getToolCallTimeout(toolCallId, toolKind) {
|
|
5187
|
+
if (toolKind === "execute") {
|
|
5188
|
+
return resolveCodexExecuteTimeoutMs();
|
|
5189
|
+
}
|
|
5190
|
+
return super.getToolCallTimeout(toolCallId, toolKind);
|
|
5191
|
+
}
|
|
5171
5192
|
}
|
|
5172
5193
|
new CodexTransport();
|
|
5173
5194
|
|
|
@@ -5198,7 +5219,7 @@ class CursorTransport extends DefaultTransport {
|
|
|
5198
5219
|
const cursorTransport = new CursorTransport();
|
|
5199
5220
|
|
|
5200
5221
|
const DEFAULT_IDLE_TIMEOUT_MS = 500;
|
|
5201
|
-
const DEFAULT_TOOL_CALL_TIMEOUT_MS =
|
|
5222
|
+
const DEFAULT_TOOL_CALL_TIMEOUT_MS = 10 * 6e4;
|
|
5202
5223
|
const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_HEAD_BYTES = 2e3;
|
|
5203
5224
|
const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_TAIL_BYTES = 4e3;
|
|
5204
5225
|
function parseArgsFromContent(content) {
|
|
@@ -5336,6 +5357,9 @@ function extractToolOutputChunk(content) {
|
|
|
5336
5357
|
const formatted = formatDisplayMessage(content);
|
|
5337
5358
|
return formatted.length > 0 ? formatted : null;
|
|
5338
5359
|
}
|
|
5360
|
+
function hasVisibleToolCallProgress(content) {
|
|
5361
|
+
return extractToolOutputChunk(content) !== null;
|
|
5362
|
+
}
|
|
5339
5363
|
function mergeStreamedOutputWithResult(content, streamedOutput) {
|
|
5340
5364
|
if (!streamedOutput || streamedOutput.length === 0) {
|
|
5341
5365
|
return content;
|
|
@@ -5458,41 +5482,14 @@ function startToolCall(toolCallId, toolKind, update, ctx, source) {
|
|
|
5458
5482
|
}
|
|
5459
5483
|
const timeoutMs = ctx.transport.getToolCallTimeout?.(toolCallId, toolKindStr) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
5460
5484
|
if (!ctx.toolCallTimeouts.has(toolCallId)) {
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
ctx.clearIdleTimeout();
|
|
5470
|
-
const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
|
|
5471
|
-
ctx.toolCallOutputs.delete(toolCallId);
|
|
5472
|
-
ctx.emit({
|
|
5473
|
-
type: "tool-result",
|
|
5474
|
-
toolName: realToolName,
|
|
5475
|
-
result: streamedOutput ? {
|
|
5476
|
-
stdout: streamedOutput,
|
|
5477
|
-
error: timeoutDetail,
|
|
5478
|
-
status: "failed",
|
|
5479
|
-
timedOut: true
|
|
5480
|
-
} : {
|
|
5481
|
-
error: timeoutDetail,
|
|
5482
|
-
status: "failed",
|
|
5483
|
-
timedOut: true
|
|
5484
|
-
},
|
|
5485
|
-
callId: toolCallId
|
|
5486
|
-
});
|
|
5487
|
-
ctx.emit({
|
|
5488
|
-
type: "status",
|
|
5489
|
-
status: "error",
|
|
5490
|
-
detail: timeoutDetail
|
|
5491
|
-
});
|
|
5492
|
-
ctx.failPendingResponseWait(new Error(timeoutDetail));
|
|
5493
|
-
}, timeoutMs);
|
|
5494
|
-
ctx.toolCallTimeouts.set(toolCallId, timeout);
|
|
5495
|
-
api.logger.debug(`[AcpBackend] \u23F1\uFE0F Set timeout for ${toolCallId}: ${(timeoutMs / 1e3).toFixed(0)}s${isInvestigation ? " (investigation tool)" : ""}`);
|
|
5485
|
+
ctx.armToolCallTimeout({
|
|
5486
|
+
toolCallId,
|
|
5487
|
+
toolKind,
|
|
5488
|
+
toolName: realToolName,
|
|
5489
|
+
timeoutMs,
|
|
5490
|
+
source
|
|
5491
|
+
});
|
|
5492
|
+
api.logger.debug(`[AcpBackend] \u23F1\uFE0F Set no-progress timeout for ${toolCallId}: ${(timeoutMs / 1e3).toFixed(0)}s${isInvestigation ? " (investigation tool)" : ""}`);
|
|
5496
5493
|
} else {
|
|
5497
5494
|
api.logger.debug(`[AcpBackend] Timeout already set for ${toolCallId}, skipping`);
|
|
5498
5495
|
}
|
|
@@ -5518,11 +5515,7 @@ function completeToolCall(toolCallId, toolKind, content, ctx) {
|
|
|
5518
5515
|
const toolKindStr = typeof toolKind === "string" ? toolKind : "unknown";
|
|
5519
5516
|
ctx.activeToolCalls.delete(toolCallId);
|
|
5520
5517
|
ctx.toolCallStartTimes.delete(toolCallId);
|
|
5521
|
-
|
|
5522
|
-
if (timeout) {
|
|
5523
|
-
clearTimeout(timeout);
|
|
5524
|
-
ctx.toolCallTimeouts.delete(toolCallId);
|
|
5525
|
-
}
|
|
5518
|
+
ctx.clearToolCallTimeout(toolCallId);
|
|
5526
5519
|
const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
|
|
5527
5520
|
ctx.toolCallOutputs.delete(toolCallId);
|
|
5528
5521
|
api.logger.debug(`[AcpBackend] \u2705 Tool call COMPLETED: ${toolCallId} (${toolKindStr}) - Duration: ${duration}. Active tool calls: ${ctx.activeToolCalls.size}`);
|
|
@@ -5561,10 +5554,8 @@ function failToolCall(toolCallId, status, toolKind, content, ctx) {
|
|
|
5561
5554
|
}
|
|
5562
5555
|
ctx.activeToolCalls.delete(toolCallId);
|
|
5563
5556
|
ctx.toolCallStartTimes.delete(toolCallId);
|
|
5564
|
-
const
|
|
5565
|
-
if (
|
|
5566
|
-
clearTimeout(timeout);
|
|
5567
|
-
ctx.toolCallTimeouts.delete(toolCallId);
|
|
5557
|
+
const clearedTimeout = ctx.clearToolCallTimeout(toolCallId);
|
|
5558
|
+
if (clearedTimeout) {
|
|
5568
5559
|
api.logger.debug(`[AcpBackend] Cleared timeout for ${toolCallId} (tool call ${status})`);
|
|
5569
5560
|
} else {
|
|
5570
5561
|
api.logger.debug(`[AcpBackend] No timeout found for ${toolCallId} (tool call ${status}) - timeout may not have been set`);
|
|
@@ -5887,7 +5878,7 @@ const RETRY_CONFIG = {
|
|
|
5887
5878
|
/** Maximum delay between retries in ms */
|
|
5888
5879
|
maxDelayMs: 5e3
|
|
5889
5880
|
};
|
|
5890
|
-
const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS =
|
|
5881
|
+
const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS = 2 * 6e4;
|
|
5891
5882
|
function readPositiveIntegerEnv(name) {
|
|
5892
5883
|
const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
|
|
5893
5884
|
if (!raw) {
|
|
@@ -5924,6 +5915,15 @@ function getSessionUpdates(params) {
|
|
|
5924
5915
|
function asNonNegativeFiniteNumber(value) {
|
|
5925
5916
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
5926
5917
|
}
|
|
5918
|
+
function shouldRefreshProgressForToolCallUpdate(update, wasToolCallActive, isToolCallActive) {
|
|
5919
|
+
if (!wasToolCallActive && isToolCallActive) {
|
|
5920
|
+
return true;
|
|
5921
|
+
}
|
|
5922
|
+
if (update.status === "completed" || update.status === "failed" || update.status === "cancelled") {
|
|
5923
|
+
return true;
|
|
5924
|
+
}
|
|
5925
|
+
return hasVisibleToolCallProgress(update.content);
|
|
5926
|
+
}
|
|
5927
5927
|
function extractUsageTokens(record) {
|
|
5928
5928
|
const used = asNonNegativeFiniteNumber(record.used);
|
|
5929
5929
|
const size = asNonNegativeFiniteNumber(record.size);
|
|
@@ -6196,6 +6196,7 @@ class AcpBackend {
|
|
|
6196
6196
|
/** Track active tool calls to prevent duplicate events */
|
|
6197
6197
|
activeToolCalls = /* @__PURE__ */ new Set();
|
|
6198
6198
|
toolCallTimeouts = /* @__PURE__ */ new Map();
|
|
6199
|
+
toolCallTimeoutSpecs = /* @__PURE__ */ new Map();
|
|
6199
6200
|
/** Track tool call start times for performance monitoring */
|
|
6200
6201
|
toolCallStartTimes = /* @__PURE__ */ new Map();
|
|
6201
6202
|
/** Track streamed tool output between ACP updates and final completion */
|
|
@@ -6220,6 +6221,12 @@ class AcpBackend {
|
|
|
6220
6221
|
waitingForResponse = false;
|
|
6221
6222
|
/** First fatal prompt-level error observed for the current turn */
|
|
6222
6223
|
responseCompletionError = null;
|
|
6224
|
+
/** Resettable no-progress timeout while waiting for a turn to finish */
|
|
6225
|
+
responseWaitTimeout = null;
|
|
6226
|
+
/** Current inactivity threshold used by waitForResponseComplete */
|
|
6227
|
+
responseWaitTimeoutMs = null;
|
|
6228
|
+
/** Timestamp of the last meaningful response progress for the current turn */
|
|
6229
|
+
responseLastProgressAt = null;
|
|
6223
6230
|
/** Fallback completion when prompt returns but the agent emits no session updates */
|
|
6224
6231
|
postPromptCompletionIdleTimeout = null;
|
|
6225
6232
|
/** Whether at least one session/update arrived after the current prompt */
|
|
@@ -6253,12 +6260,110 @@ class AcpBackend {
|
|
|
6253
6260
|
this.postPromptCompletionIdleTimeout = null;
|
|
6254
6261
|
}
|
|
6255
6262
|
}
|
|
6263
|
+
clearResponseWaitTimeout() {
|
|
6264
|
+
if (this.responseWaitTimeout) {
|
|
6265
|
+
clearTimeout(this.responseWaitTimeout);
|
|
6266
|
+
this.responseWaitTimeout = null;
|
|
6267
|
+
}
|
|
6268
|
+
}
|
|
6269
|
+
resetResponseWaitTracking() {
|
|
6270
|
+
this.clearResponseWaitTimeout();
|
|
6271
|
+
this.responseWaitTimeoutMs = null;
|
|
6272
|
+
this.responseLastProgressAt = null;
|
|
6273
|
+
}
|
|
6274
|
+
armResponseWaitTimeout(timeoutMs) {
|
|
6275
|
+
this.responseWaitTimeoutMs = timeoutMs;
|
|
6276
|
+
this.clearResponseWaitTimeout();
|
|
6277
|
+
const lastProgressAt = this.responseLastProgressAt ?? Date.now();
|
|
6278
|
+
const elapsedMs = Math.max(0, Date.now() - lastProgressAt);
|
|
6279
|
+
const remainingMs = Math.max(1, timeoutMs - elapsedMs);
|
|
6280
|
+
this.responseWaitTimeout = setTimeout(() => {
|
|
6281
|
+
this.responseWaitTimeout = null;
|
|
6282
|
+
this.responseWaitTimeoutMs = null;
|
|
6283
|
+
this.failPendingResponseWait(new Error("Timeout waiting for response to complete"));
|
|
6284
|
+
}, remainingMs);
|
|
6285
|
+
}
|
|
6286
|
+
scheduleToolCallTimeout(toolCallId) {
|
|
6287
|
+
const spec = this.toolCallTimeoutSpecs.get(toolCallId);
|
|
6288
|
+
if (!spec) {
|
|
6289
|
+
return;
|
|
6290
|
+
}
|
|
6291
|
+
const existing = this.toolCallTimeouts.get(toolCallId);
|
|
6292
|
+
if (existing) {
|
|
6293
|
+
clearTimeout(existing);
|
|
6294
|
+
}
|
|
6295
|
+
const timeout = setTimeout(() => {
|
|
6296
|
+
const duration = formatDuration(this.toolCallStartTimes.get(toolCallId));
|
|
6297
|
+
const timeoutLabel = formatToolCallTimeoutLimit(spec.timeoutMs);
|
|
6298
|
+
const timeoutDetail = `Tool call ${spec.toolName} timed out after ${timeoutLabel}`;
|
|
6299
|
+
api.logger.debug(`[AcpBackend] \u23F1\uFE0F Tool call TIMEOUT (from ${spec.source}): ${toolCallId} (${spec.toolKind}) after ${timeoutLabel} without progress - Duration: ${duration}, failing current turn`);
|
|
6300
|
+
this.activeToolCalls.delete(toolCallId);
|
|
6301
|
+
this.toolCallStartTimes.delete(toolCallId);
|
|
6302
|
+
this.clearToolCallTimeout(toolCallId);
|
|
6303
|
+
this.clearIdleTimeoutState();
|
|
6304
|
+
const streamedOutput = renderToolOutput(this.toolCallOutputs.get(toolCallId));
|
|
6305
|
+
this.toolCallOutputs.delete(toolCallId);
|
|
6306
|
+
this.emit({
|
|
6307
|
+
type: "tool-result",
|
|
6308
|
+
toolName: spec.toolName,
|
|
6309
|
+
result: streamedOutput ? {
|
|
6310
|
+
stdout: streamedOutput,
|
|
6311
|
+
error: timeoutDetail,
|
|
6312
|
+
status: "failed",
|
|
6313
|
+
timedOut: true
|
|
6314
|
+
} : {
|
|
6315
|
+
error: timeoutDetail,
|
|
6316
|
+
status: "failed",
|
|
6317
|
+
timedOut: true
|
|
6318
|
+
},
|
|
6319
|
+
callId: toolCallId
|
|
6320
|
+
});
|
|
6321
|
+
this.emit({
|
|
6322
|
+
type: "status",
|
|
6323
|
+
status: "error",
|
|
6324
|
+
detail: timeoutDetail
|
|
6325
|
+
});
|
|
6326
|
+
this.failPendingResponseWait(new Error(timeoutDetail));
|
|
6327
|
+
}, spec.timeoutMs);
|
|
6328
|
+
this.toolCallTimeouts.set(toolCallId, timeout);
|
|
6329
|
+
}
|
|
6330
|
+
armToolCallTimeout(spec) {
|
|
6331
|
+
this.toolCallTimeoutSpecs.set(spec.toolCallId, spec);
|
|
6332
|
+
this.scheduleToolCallTimeout(spec.toolCallId);
|
|
6333
|
+
}
|
|
6334
|
+
clearToolCallTimeout(toolCallId) {
|
|
6335
|
+
const timeout = this.toolCallTimeouts.get(toolCallId);
|
|
6336
|
+
const hadTimeout = Boolean(timeout);
|
|
6337
|
+
if (timeout) {
|
|
6338
|
+
clearTimeout(timeout);
|
|
6339
|
+
this.toolCallTimeouts.delete(toolCallId);
|
|
6340
|
+
}
|
|
6341
|
+
this.toolCallTimeoutSpecs.delete(toolCallId);
|
|
6342
|
+
return hadTimeout;
|
|
6343
|
+
}
|
|
6344
|
+
refreshActiveToolCallTimeouts() {
|
|
6345
|
+
for (const toolCallId of this.activeToolCalls) {
|
|
6346
|
+
if (this.toolCallTimeoutSpecs.has(toolCallId)) {
|
|
6347
|
+
this.scheduleToolCallTimeout(toolCallId);
|
|
6348
|
+
}
|
|
6349
|
+
}
|
|
6350
|
+
}
|
|
6351
|
+
markResponseProgress(opts = {}) {
|
|
6352
|
+
this.responseLastProgressAt = Date.now();
|
|
6353
|
+
if (opts.refreshToolTimeouts !== false) {
|
|
6354
|
+
this.refreshActiveToolCallTimeouts();
|
|
6355
|
+
}
|
|
6356
|
+
if (this.waitingForResponse && this.responseWaitTimeoutMs != null) {
|
|
6357
|
+
this.armResponseWaitTimeout(this.responseWaitTimeoutMs);
|
|
6358
|
+
}
|
|
6359
|
+
}
|
|
6256
6360
|
clearToolCallTracking() {
|
|
6257
6361
|
this.activeToolCalls.clear();
|
|
6258
6362
|
for (const timeout of this.toolCallTimeouts.values()) {
|
|
6259
6363
|
clearTimeout(timeout);
|
|
6260
6364
|
}
|
|
6261
6365
|
this.toolCallTimeouts.clear();
|
|
6366
|
+
this.toolCallTimeoutSpecs.clear();
|
|
6262
6367
|
this.toolCallStartTimes.clear();
|
|
6263
6368
|
this.toolCallIdToNameMap.clear();
|
|
6264
6369
|
this.toolCallOutputs.clear();
|
|
@@ -6268,6 +6373,7 @@ class AcpBackend {
|
|
|
6268
6373
|
this.responseCompletionOutcome = null;
|
|
6269
6374
|
this.responseCompletionError = null;
|
|
6270
6375
|
this.sawSessionUpdateSincePrompt = false;
|
|
6376
|
+
this.resetResponseWaitTracking();
|
|
6271
6377
|
this.clearIdleTimeoutState();
|
|
6272
6378
|
this.clearPostPromptCompletionIdleTimeout();
|
|
6273
6379
|
this.clearToolCallTracking();
|
|
@@ -6279,6 +6385,7 @@ class AcpBackend {
|
|
|
6279
6385
|
this.responseCompletionError = error;
|
|
6280
6386
|
this.responseCompletionOutcome = null;
|
|
6281
6387
|
this.waitingForResponse = false;
|
|
6388
|
+
this.resetResponseWaitTracking();
|
|
6282
6389
|
this.clearPostPromptCompletionIdleTimeout();
|
|
6283
6390
|
if (this.idleRejecter) {
|
|
6284
6391
|
this.idleRejecter(error);
|
|
@@ -6288,6 +6395,7 @@ class AcpBackend {
|
|
|
6288
6395
|
}
|
|
6289
6396
|
settleResponseWaiter(outcome) {
|
|
6290
6397
|
const hasActiveWaiter = Boolean(this.idleResolver || this.idleRejecter);
|
|
6398
|
+
this.resetResponseWaitTracking();
|
|
6291
6399
|
if (!this.waitingForResponse && !hasActiveWaiter) {
|
|
6292
6400
|
return;
|
|
6293
6401
|
}
|
|
@@ -6759,6 +6867,8 @@ ${recentStderrExcerpt}`);
|
|
|
6759
6867
|
emit: (msg) => this.emit(msg),
|
|
6760
6868
|
emitIdleStatus: () => this.emitIdleStatus(),
|
|
6761
6869
|
failPendingResponseWait: (error) => this.failPendingResponseWait(error),
|
|
6870
|
+
armToolCallTimeout: (spec) => this.armToolCallTimeout(spec),
|
|
6871
|
+
clearToolCallTimeout: (toolCallId) => this.clearToolCallTimeout(toolCallId),
|
|
6762
6872
|
clearIdleTimeout: () => {
|
|
6763
6873
|
if (this.idleTimeout) {
|
|
6764
6874
|
clearTimeout(this.idleTimeout);
|
|
@@ -6810,8 +6920,12 @@ ${recentStderrExcerpt}`);
|
|
|
6810
6920
|
}, null, 2));
|
|
6811
6921
|
}
|
|
6812
6922
|
const ctx = this.createHandlerContext();
|
|
6923
|
+
const toolCallId = update.toolCallId;
|
|
6924
|
+
const wasToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
|
|
6813
6925
|
if (sessionUpdateType === "agent_message_chunk") {
|
|
6814
|
-
handleAgentMessageChunk(update, ctx)
|
|
6926
|
+
if (handleAgentMessageChunk(update, ctx).handled) {
|
|
6927
|
+
this.markResponseProgress();
|
|
6928
|
+
}
|
|
6815
6929
|
continue;
|
|
6816
6930
|
}
|
|
6817
6931
|
if (sessionUpdateType === "tool_call_update") {
|
|
@@ -6819,14 +6933,24 @@ ${recentStderrExcerpt}`);
|
|
|
6819
6933
|
if (result.toolCallCountSincePrompt !== void 0) {
|
|
6820
6934
|
this.toolCallCountSincePrompt = result.toolCallCountSincePrompt;
|
|
6821
6935
|
}
|
|
6936
|
+
const isToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
|
|
6937
|
+
if (shouldRefreshProgressForToolCallUpdate(update, wasToolCallActive, isToolCallActive)) {
|
|
6938
|
+
this.markResponseProgress();
|
|
6939
|
+
}
|
|
6822
6940
|
continue;
|
|
6823
6941
|
}
|
|
6824
6942
|
if (sessionUpdateType === "agent_thought_chunk") {
|
|
6825
|
-
handleAgentThoughtChunk(update, ctx)
|
|
6943
|
+
if (handleAgentThoughtChunk(update, ctx).handled) {
|
|
6944
|
+
this.markResponseProgress();
|
|
6945
|
+
}
|
|
6826
6946
|
continue;
|
|
6827
6947
|
}
|
|
6828
6948
|
if (sessionUpdateType === "tool_call") {
|
|
6829
|
-
handleToolCall(update, ctx);
|
|
6949
|
+
const result = handleToolCall(update, ctx);
|
|
6950
|
+
const isToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
|
|
6951
|
+
if (result.handled && !wasToolCallActive && isToolCallActive) {
|
|
6952
|
+
this.markResponseProgress();
|
|
6953
|
+
}
|
|
6830
6954
|
continue;
|
|
6831
6955
|
}
|
|
6832
6956
|
if (sessionUpdateType === "usage_update") {
|
|
@@ -6844,6 +6968,9 @@ ${recentStderrExcerpt}`);
|
|
|
6844
6968
|
const handledPlan = handlePlanUpdate(update, ctx).handled;
|
|
6845
6969
|
const handledThinking = handleThinkingUpdate(update, ctx).handled;
|
|
6846
6970
|
const handledUsage = this.emitUsageTelemetry(update.usage, "acp-session-usage");
|
|
6971
|
+
if (handledLegacy || handledPlan || handledThinking) {
|
|
6972
|
+
this.markResponseProgress();
|
|
6973
|
+
}
|
|
6847
6974
|
const updateTypeStr = sessionUpdateType;
|
|
6848
6975
|
const handledTypes = ["agent_message_chunk", "tool_call_update", "agent_thought_chunk", "tool_call", "usage_update", "task_complete"];
|
|
6849
6976
|
if (updateTypeStr && !handledTypes.includes(updateTypeStr) && !handledLegacy && !handledPlan && !handledThinking && !handledUsage) {
|
|
@@ -6862,6 +6989,7 @@ ${recentStderrExcerpt}`);
|
|
|
6862
6989
|
this.resetResponseTrackingForNewPrompt();
|
|
6863
6990
|
this.emit({ type: "status", status: "running" });
|
|
6864
6991
|
this.waitingForResponse = true;
|
|
6992
|
+
this.markResponseProgress({ refreshToolTimeouts: false });
|
|
6865
6993
|
try {
|
|
6866
6994
|
api.logger.debug(`[AcpBackend] Sending prompt (length: ${prompt.length}): ${prompt.substring(0, 100)}...`);
|
|
6867
6995
|
api.logger.debug(`[AcpBackend] Full prompt: ${prompt}`);
|
|
@@ -6922,7 +7050,7 @@ ${recentStderrExcerpt}`);
|
|
|
6922
7050
|
* Wait for the response to complete (idle status after all chunks received)
|
|
6923
7051
|
* Call this after sendPrompt to wait for Gemini to finish responding
|
|
6924
7052
|
*/
|
|
6925
|
-
async waitForResponseComplete(timeoutMs =
|
|
7053
|
+
async waitForResponseComplete(timeoutMs = 10 * 6e4) {
|
|
6926
7054
|
if (this.responseCompletionError) {
|
|
6927
7055
|
throw this.responseCompletionError;
|
|
6928
7056
|
}
|
|
@@ -6938,26 +7066,19 @@ ${recentStderrExcerpt}`);
|
|
|
6938
7066
|
return;
|
|
6939
7067
|
}
|
|
6940
7068
|
return new Promise((resolve, reject) => {
|
|
6941
|
-
const timeout = setTimeout(() => {
|
|
6942
|
-
this.idleResolver = null;
|
|
6943
|
-
this.idleRejecter = null;
|
|
6944
|
-
this.waitingForResponse = false;
|
|
6945
|
-
reject(new Error("Timeout waiting for response to complete"));
|
|
6946
|
-
}, timeoutMs);
|
|
6947
7069
|
this.idleResolver = () => {
|
|
6948
|
-
clearTimeout(timeout);
|
|
6949
7070
|
this.idleResolver = null;
|
|
6950
7071
|
this.idleRejecter = null;
|
|
6951
7072
|
this.waitingForResponse = false;
|
|
6952
7073
|
resolve();
|
|
6953
7074
|
};
|
|
6954
7075
|
this.idleRejecter = (error) => {
|
|
6955
|
-
clearTimeout(timeout);
|
|
6956
7076
|
this.idleResolver = null;
|
|
6957
7077
|
this.idleRejecter = null;
|
|
6958
7078
|
this.waitingForResponse = false;
|
|
6959
7079
|
reject(error);
|
|
6960
7080
|
};
|
|
7081
|
+
this.armResponseWaitTimeout(timeoutMs);
|
|
6961
7082
|
});
|
|
6962
7083
|
}
|
|
6963
7084
|
/**
|
|
@@ -7772,7 +7893,7 @@ class AbortError extends Error {
|
|
|
7772
7893
|
}
|
|
7773
7894
|
}
|
|
7774
7895
|
|
|
7775
|
-
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-
|
|
7896
|
+
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-D9lWHpn-.cjs', document.baseURI).href)));
|
|
7776
7897
|
const __dirname$1 = path.join(__filename$1, "..");
|
|
7777
7898
|
function getGlobalClaudeVersion() {
|
|
7778
7899
|
try {
|
|
@@ -8443,7 +8564,7 @@ class ClaudeCodeBackend {
|
|
|
8443
8564
|
api.logger.debug("[ClaudeRuntimeBackend] Error interrupting Claude query:", error);
|
|
8444
8565
|
}
|
|
8445
8566
|
}
|
|
8446
|
-
async waitForResponseComplete(timeoutMs =
|
|
8567
|
+
async waitForResponseComplete(timeoutMs = 10 * 6e4) {
|
|
8447
8568
|
if (this.responseCompletionOutcome) {
|
|
8448
8569
|
const outcome = this.responseCompletionOutcome;
|
|
8449
8570
|
if (outcome.kind === "rejected") {
|
|
@@ -9023,11 +9144,11 @@ var launch = /*#__PURE__*/Object.freeze({
|
|
|
9023
9144
|
|
|
9024
9145
|
const unifiedProviderExecutors = {
|
|
9025
9146
|
claude: async (opts) => {
|
|
9026
|
-
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-
|
|
9147
|
+
const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-BP-O6ucu.cjs'); });
|
|
9027
9148
|
await runClaude(opts.credentials, opts.claudeOptions ?? {});
|
|
9028
9149
|
},
|
|
9029
9150
|
codex: async (opts) => {
|
|
9030
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
9151
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BV6kKtTO.cjs'); });
|
|
9031
9152
|
await runCodex({
|
|
9032
9153
|
credentials: opts.credentials,
|
|
9033
9154
|
startedBy: opts.startedBy,
|
|
@@ -9036,7 +9157,7 @@ const unifiedProviderExecutors = {
|
|
|
9036
9157
|
});
|
|
9037
9158
|
},
|
|
9038
9159
|
gemini: async (opts) => {
|
|
9039
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
9160
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BiYKqJqO.cjs'); });
|
|
9040
9161
|
await runGemini({
|
|
9041
9162
|
credentials: opts.credentials,
|
|
9042
9163
|
startedBy: opts.startedBy
|
|
@@ -9112,7 +9233,7 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
9112
9233
|
return;
|
|
9113
9234
|
} else if (subcommand === "runtime") {
|
|
9114
9235
|
if (args[1] === "providers") {
|
|
9115
|
-
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-
|
|
9236
|
+
const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DAYJSP16.cjs'); });
|
|
9116
9237
|
console.log(renderRuntimeProviders());
|
|
9117
9238
|
return;
|
|
9118
9239
|
}
|
|
@@ -9290,8 +9411,8 @@ function shouldRunMainClaudeFlow(opts) {
|
|
|
9290
9411
|
const projectId = args[3];
|
|
9291
9412
|
try {
|
|
9292
9413
|
const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
|
|
9293
|
-
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-
|
|
9294
|
-
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-
|
|
9414
|
+
const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-lN9HV4IZ.cjs'); });
|
|
9415
|
+
const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-OoiG7XjD.cjs'); }).then(function (n) { return n.api; });
|
|
9295
9416
|
let userEmail = void 0;
|
|
9296
9417
|
try {
|
|
9297
9418
|
const credentials = await readCredentials2();
|