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.
Files changed (47) hide show
  1. package/bin/happy-cloud.mjs +21 -21
  2. package/compat/acp-sdk-schema/index.js +27 -27
  3. package/compat/acp-sdk-schema/types.gen.js +2 -2
  4. package/compat/acp-sdk-schema/zod.gen.js +1553 -1553
  5. package/compat/ink-build/components/Cursor.d.ts +83 -83
  6. package/compat/ink-build/components/Cursor.js +52 -52
  7. package/compat/ink-build/components/CursorContext.d.ts +11 -11
  8. package/compat/ink-build/components/CursorContext.js +7 -7
  9. package/compat/ink-build/components/ErrorBoundary.d.ts +18 -18
  10. package/compat/ink-build/components/ErrorBoundary.js +22 -22
  11. package/compat/ink-build/hooks/use-cursor.d.ts +12 -12
  12. package/compat/ink-build/hooks/use-cursor.js +28 -28
  13. package/dist/{BaseReasoningProcessor-CBMK-8Gi.cjs → BaseReasoningProcessor-BrcBFCoL.cjs} +3 -3
  14. package/dist/{BaseReasoningProcessor-Dn9FxfxU.mjs → BaseReasoningProcessor-CPLK0a8y.mjs} +3 -3
  15. package/dist/ProviderSelectionHandler-CrXfMTg1.mjs +261 -0
  16. package/dist/ProviderSelectionHandler-f7_I3vQa.cjs +265 -0
  17. package/dist/{api-DBy5lPZw.mjs → api-BGv79x9Q.mjs} +3 -3
  18. package/dist/{api-DId_j3C2.cjs → api-OoiG7XjD.cjs} +2 -2
  19. package/dist/{command-DwfUpmId.cjs → command-DAYJSP16.cjs} +3 -3
  20. package/dist/{command-CeaBwYCW.mjs → command-FbV44egL.mjs} +3 -3
  21. package/dist/{index-CuuYSKiv.cjs → index-D9lWHpn-.cjs} +199 -78
  22. package/dist/{index-66vjECEd.mjs → index-TRC83Ks9.mjs} +196 -75
  23. package/dist/index.cjs +3 -3
  24. package/dist/index.mjs +3 -3
  25. package/dist/lib.cjs +1 -1
  26. package/dist/lib.d.cts +51 -52
  27. package/dist/lib.d.mts +51 -52
  28. package/dist/lib.mjs +1 -1
  29. package/dist/{persistence-BOWh1NER.mjs → persistence-Cmgj3ubQ.mjs} +1 -1
  30. package/dist/{persistence-Dzr6sFwD.cjs → persistence-lN9HV4IZ.cjs} +1 -1
  31. package/dist/{registerKillSessionHandler-D4_wpN18.mjs → registerKillSessionHandler-NZd3xieQ.mjs} +417 -5
  32. package/dist/{registerKillSessionHandler-Dg_iRBPm.cjs → registerKillSessionHandler-pk4Ohq4Y.cjs} +419 -4
  33. package/dist/{runClaude-B74dHAnQ.mjs → runClaude-7St9-Jci.mjs} +34 -5
  34. package/dist/{runClaude-oIFzkfuU.cjs → runClaude-BP-O6ucu.cjs} +37 -8
  35. package/dist/{runCodex-D_9CuL6M.cjs → runCodex-BV6kKtTO.cjs} +29 -21
  36. package/dist/{runCodex-mLHjsgVj.mjs → runCodex-BaXi_9BC.mjs} +26 -18
  37. package/dist/{runGemini-CcWGezMt.cjs → runGemini-BiYKqJqO.cjs} +267 -82
  38. package/dist/{runGemini-BMiho2ab.mjs → runGemini-ClNqE9N3.mjs} +267 -82
  39. package/package.json +9 -9
  40. package/scripts/build.mjs +68 -68
  41. package/scripts/devtools/README.md +9 -9
  42. package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
  43. package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
  44. package/scripts/ensureAcpSdkCompat.mjs +171 -173
  45. package/scripts/release-smoke.mjs +38 -35
  46. package/dist/ProviderSelectionHandler-BuXk-8ji.cjs +0 -680
  47. package/dist/ProviderSelectionHandler-CMaQThYO.mjs +0 -673
@@ -1,6 +1,6 @@
1
1
  import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
2
- import { l as logger, e as encodeBase64, c as configuration, k as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, m as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, n as encodeBase64Url, h as delay, o as buildClientHeaders, q as decodeBase64, r as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, t as HeadTailPreviewBuffer, u as getLatestDaemonLog } from './api-DBy5lPZw.mjs';
3
- import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-BOWh1NER.mjs';
2
+ import { l as logger, e as encodeBase64, c as configuration, k as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, m as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, n as encodeBase64Url, h as delay, o as buildClientHeaders, q as decodeBase64, r as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, t as HeadTailPreviewBuffer, u as getLatestDaemonLog } from './api-BGv79x9Q.mjs';
3
+ import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-Cmgj3ubQ.mjs';
4
4
  import { z } from 'zod';
5
5
  import fs, { writeFile as writeFile$1, rename, unlink as unlink$1 } from 'fs/promises';
6
6
  import os, { homedir } from 'os';
@@ -4845,10 +4845,10 @@ function truncateDisplayMessage(value, maxLength) {
4845
4845
  const DEFAULT_TIMEOUTS = {
4846
4846
  /** Default initialization timeout: 60 seconds */
4847
4847
  init: 6e4,
4848
- /** Default tool call timeout: 2 minutes */
4849
- toolCall: 12e4,
4850
- /** Think tool timeout: 30 seconds */
4851
- think: 3e4
4848
+ /** Default tool call timeout: 10 minutes */
4849
+ toolCall: 10 * 6e4,
4850
+ /** Think tool timeout: 2 minutes */
4851
+ think: 2 * 6e4
4852
4852
  };
4853
4853
  class DefaultTransport {
4854
4854
  agentName;
@@ -4925,7 +4925,7 @@ class DefaultTransport {
4925
4925
  return toolName;
4926
4926
  }
4927
4927
  getPostPromptNoUpdatesTimeoutMs() {
4928
- return 3e4;
4928
+ return 2 * 6e4;
4929
4929
  }
4930
4930
  }
4931
4931
 
@@ -4935,11 +4935,11 @@ const GEMINI_TIMEOUTS = {
4935
4935
  /** Gemini ACP can swallow an initialize request sent too early after spawn */
4936
4936
  initDelay: 2500,
4937
4937
  /** Standard tool call timeout */
4938
- toolCall: 12e4,
4938
+ toolCall: 10 * 6e4,
4939
4939
  /** Investigation tools (codebase_investigator) can run for a long time */
4940
- investigation: 6e5,
4940
+ investigation: 30 * 6e4,
4941
4941
  /** Think tools are usually quick */
4942
- think: 3e4,
4942
+ think: 2 * 6e4,
4943
4943
  /** Idle detection after last message chunk */
4944
4944
  idle: 500
4945
4945
  };
@@ -5136,6 +5136,21 @@ class GeminiTransport {
5136
5136
  }
5137
5137
  const geminiTransport = new GeminiTransport();
5138
5138
 
5139
+ const DEFAULT_CODEX_EXECUTE_TIMEOUT_MS = 30 * 6e4;
5140
+ function readPositiveIntegerEnv$1(name) {
5141
+ const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
5142
+ if (!raw) {
5143
+ return null;
5144
+ }
5145
+ const value = Number(raw);
5146
+ if (!Number.isFinite(value) || !Number.isInteger(value) || value <= 0) {
5147
+ return null;
5148
+ }
5149
+ return value;
5150
+ }
5151
+ function resolveCodexExecuteTimeoutMs() {
5152
+ return readPositiveIntegerEnv$1("HAPPY_CODEX_EXECUTE_TIMEOUT_MS") ?? readPositiveIntegerEnv$1("HAPPIER_CODEX_EXECUTE_TIMEOUT_MS") ?? DEFAULT_CODEX_EXECUTE_TIMEOUT_MS;
5153
+ }
5139
5154
  class CodexTransport extends DefaultTransport {
5140
5155
  constructor() {
5141
5156
  super("codex");
@@ -5146,6 +5161,12 @@ class CodexTransport extends DefaultTransport {
5146
5161
  getIdleTimeout() {
5147
5162
  return 800;
5148
5163
  }
5164
+ getToolCallTimeout(toolCallId, toolKind) {
5165
+ if (toolKind === "execute") {
5166
+ return resolveCodexExecuteTimeoutMs();
5167
+ }
5168
+ return super.getToolCallTimeout(toolCallId, toolKind);
5169
+ }
5149
5170
  }
5150
5171
  new CodexTransport();
5151
5172
 
@@ -5176,7 +5197,7 @@ class CursorTransport extends DefaultTransport {
5176
5197
  const cursorTransport = new CursorTransport();
5177
5198
 
5178
5199
  const DEFAULT_IDLE_TIMEOUT_MS = 500;
5179
- const DEFAULT_TOOL_CALL_TIMEOUT_MS = 12e4;
5200
+ const DEFAULT_TOOL_CALL_TIMEOUT_MS = 10 * 6e4;
5180
5201
  const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_HEAD_BYTES = 2e3;
5181
5202
  const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_TAIL_BYTES = 4e3;
5182
5203
  function parseArgsFromContent(content) {
@@ -5314,6 +5335,9 @@ function extractToolOutputChunk(content) {
5314
5335
  const formatted = formatDisplayMessage(content);
5315
5336
  return formatted.length > 0 ? formatted : null;
5316
5337
  }
5338
+ function hasVisibleToolCallProgress(content) {
5339
+ return extractToolOutputChunk(content) !== null;
5340
+ }
5317
5341
  function mergeStreamedOutputWithResult(content, streamedOutput) {
5318
5342
  if (!streamedOutput || streamedOutput.length === 0) {
5319
5343
  return content;
@@ -5436,41 +5460,14 @@ function startToolCall(toolCallId, toolKind, update, ctx, source) {
5436
5460
  }
5437
5461
  const timeoutMs = ctx.transport.getToolCallTimeout?.(toolCallId, toolKindStr) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
5438
5462
  if (!ctx.toolCallTimeouts.has(toolCallId)) {
5439
- const timeout = setTimeout(() => {
5440
- const duration = formatDuration(ctx.toolCallStartTimes.get(toolCallId));
5441
- const timeoutLabel = formatToolCallTimeoutLimit(timeoutMs);
5442
- const timeoutDetail = `Tool call ${realToolName} timed out after ${timeoutLabel}`;
5443
- logger.debug(`[AcpBackend] \u23F1\uFE0F Tool call TIMEOUT (from ${source}): ${toolCallId} (${toolKind}) after ${timeoutLabel} - Duration: ${duration}, failing current turn`);
5444
- ctx.activeToolCalls.delete(toolCallId);
5445
- ctx.toolCallStartTimes.delete(toolCallId);
5446
- ctx.toolCallTimeouts.delete(toolCallId);
5447
- ctx.clearIdleTimeout();
5448
- const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
5449
- ctx.toolCallOutputs.delete(toolCallId);
5450
- ctx.emit({
5451
- type: "tool-result",
5452
- toolName: realToolName,
5453
- result: streamedOutput ? {
5454
- stdout: streamedOutput,
5455
- error: timeoutDetail,
5456
- status: "failed",
5457
- timedOut: true
5458
- } : {
5459
- error: timeoutDetail,
5460
- status: "failed",
5461
- timedOut: true
5462
- },
5463
- callId: toolCallId
5464
- });
5465
- ctx.emit({
5466
- type: "status",
5467
- status: "error",
5468
- detail: timeoutDetail
5469
- });
5470
- ctx.failPendingResponseWait(new Error(timeoutDetail));
5471
- }, timeoutMs);
5472
- ctx.toolCallTimeouts.set(toolCallId, timeout);
5473
- logger.debug(`[AcpBackend] \u23F1\uFE0F Set timeout for ${toolCallId}: ${(timeoutMs / 1e3).toFixed(0)}s${isInvestigation ? " (investigation tool)" : ""}`);
5463
+ ctx.armToolCallTimeout({
5464
+ toolCallId,
5465
+ toolKind,
5466
+ toolName: realToolName,
5467
+ timeoutMs,
5468
+ source
5469
+ });
5470
+ logger.debug(`[AcpBackend] \u23F1\uFE0F Set no-progress timeout for ${toolCallId}: ${(timeoutMs / 1e3).toFixed(0)}s${isInvestigation ? " (investigation tool)" : ""}`);
5474
5471
  } else {
5475
5472
  logger.debug(`[AcpBackend] Timeout already set for ${toolCallId}, skipping`);
5476
5473
  }
@@ -5496,11 +5493,7 @@ function completeToolCall(toolCallId, toolKind, content, ctx) {
5496
5493
  const toolKindStr = typeof toolKind === "string" ? toolKind : "unknown";
5497
5494
  ctx.activeToolCalls.delete(toolCallId);
5498
5495
  ctx.toolCallStartTimes.delete(toolCallId);
5499
- const timeout = ctx.toolCallTimeouts.get(toolCallId);
5500
- if (timeout) {
5501
- clearTimeout(timeout);
5502
- ctx.toolCallTimeouts.delete(toolCallId);
5503
- }
5496
+ ctx.clearToolCallTimeout(toolCallId);
5504
5497
  const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
5505
5498
  ctx.toolCallOutputs.delete(toolCallId);
5506
5499
  logger.debug(`[AcpBackend] \u2705 Tool call COMPLETED: ${toolCallId} (${toolKindStr}) - Duration: ${duration}. Active tool calls: ${ctx.activeToolCalls.size}`);
@@ -5539,10 +5532,8 @@ function failToolCall(toolCallId, status, toolKind, content, ctx) {
5539
5532
  }
5540
5533
  ctx.activeToolCalls.delete(toolCallId);
5541
5534
  ctx.toolCallStartTimes.delete(toolCallId);
5542
- const timeout = ctx.toolCallTimeouts.get(toolCallId);
5543
- if (timeout) {
5544
- clearTimeout(timeout);
5545
- ctx.toolCallTimeouts.delete(toolCallId);
5535
+ const clearedTimeout = ctx.clearToolCallTimeout(toolCallId);
5536
+ if (clearedTimeout) {
5546
5537
  logger.debug(`[AcpBackend] Cleared timeout for ${toolCallId} (tool call ${status})`);
5547
5538
  } else {
5548
5539
  logger.debug(`[AcpBackend] No timeout found for ${toolCallId} (tool call ${status}) - timeout may not have been set`);
@@ -5865,7 +5856,7 @@ const RETRY_CONFIG = {
5865
5856
  /** Maximum delay between retries in ms */
5866
5857
  maxDelayMs: 5e3
5867
5858
  };
5868
- const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS = 3e4;
5859
+ const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS = 2 * 6e4;
5869
5860
  function readPositiveIntegerEnv(name) {
5870
5861
  const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
5871
5862
  if (!raw) {
@@ -5902,6 +5893,15 @@ function getSessionUpdates(params) {
5902
5893
  function asNonNegativeFiniteNumber(value) {
5903
5894
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
5904
5895
  }
5896
+ function shouldRefreshProgressForToolCallUpdate(update, wasToolCallActive, isToolCallActive) {
5897
+ if (!wasToolCallActive && isToolCallActive) {
5898
+ return true;
5899
+ }
5900
+ if (update.status === "completed" || update.status === "failed" || update.status === "cancelled") {
5901
+ return true;
5902
+ }
5903
+ return hasVisibleToolCallProgress(update.content);
5904
+ }
5905
5905
  function extractUsageTokens(record) {
5906
5906
  const used = asNonNegativeFiniteNumber(record.used);
5907
5907
  const size = asNonNegativeFiniteNumber(record.size);
@@ -6174,6 +6174,7 @@ class AcpBackend {
6174
6174
  /** Track active tool calls to prevent duplicate events */
6175
6175
  activeToolCalls = /* @__PURE__ */ new Set();
6176
6176
  toolCallTimeouts = /* @__PURE__ */ new Map();
6177
+ toolCallTimeoutSpecs = /* @__PURE__ */ new Map();
6177
6178
  /** Track tool call start times for performance monitoring */
6178
6179
  toolCallStartTimes = /* @__PURE__ */ new Map();
6179
6180
  /** Track streamed tool output between ACP updates and final completion */
@@ -6198,6 +6199,12 @@ class AcpBackend {
6198
6199
  waitingForResponse = false;
6199
6200
  /** First fatal prompt-level error observed for the current turn */
6200
6201
  responseCompletionError = null;
6202
+ /** Resettable no-progress timeout while waiting for a turn to finish */
6203
+ responseWaitTimeout = null;
6204
+ /** Current inactivity threshold used by waitForResponseComplete */
6205
+ responseWaitTimeoutMs = null;
6206
+ /** Timestamp of the last meaningful response progress for the current turn */
6207
+ responseLastProgressAt = null;
6201
6208
  /** Fallback completion when prompt returns but the agent emits no session updates */
6202
6209
  postPromptCompletionIdleTimeout = null;
6203
6210
  /** Whether at least one session/update arrived after the current prompt */
@@ -6231,12 +6238,110 @@ class AcpBackend {
6231
6238
  this.postPromptCompletionIdleTimeout = null;
6232
6239
  }
6233
6240
  }
6241
+ clearResponseWaitTimeout() {
6242
+ if (this.responseWaitTimeout) {
6243
+ clearTimeout(this.responseWaitTimeout);
6244
+ this.responseWaitTimeout = null;
6245
+ }
6246
+ }
6247
+ resetResponseWaitTracking() {
6248
+ this.clearResponseWaitTimeout();
6249
+ this.responseWaitTimeoutMs = null;
6250
+ this.responseLastProgressAt = null;
6251
+ }
6252
+ armResponseWaitTimeout(timeoutMs) {
6253
+ this.responseWaitTimeoutMs = timeoutMs;
6254
+ this.clearResponseWaitTimeout();
6255
+ const lastProgressAt = this.responseLastProgressAt ?? Date.now();
6256
+ const elapsedMs = Math.max(0, Date.now() - lastProgressAt);
6257
+ const remainingMs = Math.max(1, timeoutMs - elapsedMs);
6258
+ this.responseWaitTimeout = setTimeout(() => {
6259
+ this.responseWaitTimeout = null;
6260
+ this.responseWaitTimeoutMs = null;
6261
+ this.failPendingResponseWait(new Error("Timeout waiting for response to complete"));
6262
+ }, remainingMs);
6263
+ }
6264
+ scheduleToolCallTimeout(toolCallId) {
6265
+ const spec = this.toolCallTimeoutSpecs.get(toolCallId);
6266
+ if (!spec) {
6267
+ return;
6268
+ }
6269
+ const existing = this.toolCallTimeouts.get(toolCallId);
6270
+ if (existing) {
6271
+ clearTimeout(existing);
6272
+ }
6273
+ const timeout = setTimeout(() => {
6274
+ const duration = formatDuration(this.toolCallStartTimes.get(toolCallId));
6275
+ const timeoutLabel = formatToolCallTimeoutLimit(spec.timeoutMs);
6276
+ const timeoutDetail = `Tool call ${spec.toolName} timed out after ${timeoutLabel}`;
6277
+ logger.debug(`[AcpBackend] \u23F1\uFE0F Tool call TIMEOUT (from ${spec.source}): ${toolCallId} (${spec.toolKind}) after ${timeoutLabel} without progress - Duration: ${duration}, failing current turn`);
6278
+ this.activeToolCalls.delete(toolCallId);
6279
+ this.toolCallStartTimes.delete(toolCallId);
6280
+ this.clearToolCallTimeout(toolCallId);
6281
+ this.clearIdleTimeoutState();
6282
+ const streamedOutput = renderToolOutput(this.toolCallOutputs.get(toolCallId));
6283
+ this.toolCallOutputs.delete(toolCallId);
6284
+ this.emit({
6285
+ type: "tool-result",
6286
+ toolName: spec.toolName,
6287
+ result: streamedOutput ? {
6288
+ stdout: streamedOutput,
6289
+ error: timeoutDetail,
6290
+ status: "failed",
6291
+ timedOut: true
6292
+ } : {
6293
+ error: timeoutDetail,
6294
+ status: "failed",
6295
+ timedOut: true
6296
+ },
6297
+ callId: toolCallId
6298
+ });
6299
+ this.emit({
6300
+ type: "status",
6301
+ status: "error",
6302
+ detail: timeoutDetail
6303
+ });
6304
+ this.failPendingResponseWait(new Error(timeoutDetail));
6305
+ }, spec.timeoutMs);
6306
+ this.toolCallTimeouts.set(toolCallId, timeout);
6307
+ }
6308
+ armToolCallTimeout(spec) {
6309
+ this.toolCallTimeoutSpecs.set(spec.toolCallId, spec);
6310
+ this.scheduleToolCallTimeout(spec.toolCallId);
6311
+ }
6312
+ clearToolCallTimeout(toolCallId) {
6313
+ const timeout = this.toolCallTimeouts.get(toolCallId);
6314
+ const hadTimeout = Boolean(timeout);
6315
+ if (timeout) {
6316
+ clearTimeout(timeout);
6317
+ this.toolCallTimeouts.delete(toolCallId);
6318
+ }
6319
+ this.toolCallTimeoutSpecs.delete(toolCallId);
6320
+ return hadTimeout;
6321
+ }
6322
+ refreshActiveToolCallTimeouts() {
6323
+ for (const toolCallId of this.activeToolCalls) {
6324
+ if (this.toolCallTimeoutSpecs.has(toolCallId)) {
6325
+ this.scheduleToolCallTimeout(toolCallId);
6326
+ }
6327
+ }
6328
+ }
6329
+ markResponseProgress(opts = {}) {
6330
+ this.responseLastProgressAt = Date.now();
6331
+ if (opts.refreshToolTimeouts !== false) {
6332
+ this.refreshActiveToolCallTimeouts();
6333
+ }
6334
+ if (this.waitingForResponse && this.responseWaitTimeoutMs != null) {
6335
+ this.armResponseWaitTimeout(this.responseWaitTimeoutMs);
6336
+ }
6337
+ }
6234
6338
  clearToolCallTracking() {
6235
6339
  this.activeToolCalls.clear();
6236
6340
  for (const timeout of this.toolCallTimeouts.values()) {
6237
6341
  clearTimeout(timeout);
6238
6342
  }
6239
6343
  this.toolCallTimeouts.clear();
6344
+ this.toolCallTimeoutSpecs.clear();
6240
6345
  this.toolCallStartTimes.clear();
6241
6346
  this.toolCallIdToNameMap.clear();
6242
6347
  this.toolCallOutputs.clear();
@@ -6246,6 +6351,7 @@ class AcpBackend {
6246
6351
  this.responseCompletionOutcome = null;
6247
6352
  this.responseCompletionError = null;
6248
6353
  this.sawSessionUpdateSincePrompt = false;
6354
+ this.resetResponseWaitTracking();
6249
6355
  this.clearIdleTimeoutState();
6250
6356
  this.clearPostPromptCompletionIdleTimeout();
6251
6357
  this.clearToolCallTracking();
@@ -6257,6 +6363,7 @@ class AcpBackend {
6257
6363
  this.responseCompletionError = error;
6258
6364
  this.responseCompletionOutcome = null;
6259
6365
  this.waitingForResponse = false;
6366
+ this.resetResponseWaitTracking();
6260
6367
  this.clearPostPromptCompletionIdleTimeout();
6261
6368
  if (this.idleRejecter) {
6262
6369
  this.idleRejecter(error);
@@ -6266,6 +6373,7 @@ class AcpBackend {
6266
6373
  }
6267
6374
  settleResponseWaiter(outcome) {
6268
6375
  const hasActiveWaiter = Boolean(this.idleResolver || this.idleRejecter);
6376
+ this.resetResponseWaitTracking();
6269
6377
  if (!this.waitingForResponse && !hasActiveWaiter) {
6270
6378
  return;
6271
6379
  }
@@ -6737,6 +6845,8 @@ ${recentStderrExcerpt}`);
6737
6845
  emit: (msg) => this.emit(msg),
6738
6846
  emitIdleStatus: () => this.emitIdleStatus(),
6739
6847
  failPendingResponseWait: (error) => this.failPendingResponseWait(error),
6848
+ armToolCallTimeout: (spec) => this.armToolCallTimeout(spec),
6849
+ clearToolCallTimeout: (toolCallId) => this.clearToolCallTimeout(toolCallId),
6740
6850
  clearIdleTimeout: () => {
6741
6851
  if (this.idleTimeout) {
6742
6852
  clearTimeout(this.idleTimeout);
@@ -6788,8 +6898,12 @@ ${recentStderrExcerpt}`);
6788
6898
  }, null, 2));
6789
6899
  }
6790
6900
  const ctx = this.createHandlerContext();
6901
+ const toolCallId = update.toolCallId;
6902
+ const wasToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
6791
6903
  if (sessionUpdateType === "agent_message_chunk") {
6792
- handleAgentMessageChunk(update, ctx);
6904
+ if (handleAgentMessageChunk(update, ctx).handled) {
6905
+ this.markResponseProgress();
6906
+ }
6793
6907
  continue;
6794
6908
  }
6795
6909
  if (sessionUpdateType === "tool_call_update") {
@@ -6797,14 +6911,24 @@ ${recentStderrExcerpt}`);
6797
6911
  if (result.toolCallCountSincePrompt !== void 0) {
6798
6912
  this.toolCallCountSincePrompt = result.toolCallCountSincePrompt;
6799
6913
  }
6914
+ const isToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
6915
+ if (shouldRefreshProgressForToolCallUpdate(update, wasToolCallActive, isToolCallActive)) {
6916
+ this.markResponseProgress();
6917
+ }
6800
6918
  continue;
6801
6919
  }
6802
6920
  if (sessionUpdateType === "agent_thought_chunk") {
6803
- handleAgentThoughtChunk(update, ctx);
6921
+ if (handleAgentThoughtChunk(update, ctx).handled) {
6922
+ this.markResponseProgress();
6923
+ }
6804
6924
  continue;
6805
6925
  }
6806
6926
  if (sessionUpdateType === "tool_call") {
6807
- handleToolCall(update, ctx);
6927
+ const result = handleToolCall(update, ctx);
6928
+ const isToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
6929
+ if (result.handled && !wasToolCallActive && isToolCallActive) {
6930
+ this.markResponseProgress();
6931
+ }
6808
6932
  continue;
6809
6933
  }
6810
6934
  if (sessionUpdateType === "usage_update") {
@@ -6822,6 +6946,9 @@ ${recentStderrExcerpt}`);
6822
6946
  const handledPlan = handlePlanUpdate(update, ctx).handled;
6823
6947
  const handledThinking = handleThinkingUpdate(update, ctx).handled;
6824
6948
  const handledUsage = this.emitUsageTelemetry(update.usage, "acp-session-usage");
6949
+ if (handledLegacy || handledPlan || handledThinking) {
6950
+ this.markResponseProgress();
6951
+ }
6825
6952
  const updateTypeStr = sessionUpdateType;
6826
6953
  const handledTypes = ["agent_message_chunk", "tool_call_update", "agent_thought_chunk", "tool_call", "usage_update", "task_complete"];
6827
6954
  if (updateTypeStr && !handledTypes.includes(updateTypeStr) && !handledLegacy && !handledPlan && !handledThinking && !handledUsage) {
@@ -6840,6 +6967,7 @@ ${recentStderrExcerpt}`);
6840
6967
  this.resetResponseTrackingForNewPrompt();
6841
6968
  this.emit({ type: "status", status: "running" });
6842
6969
  this.waitingForResponse = true;
6970
+ this.markResponseProgress({ refreshToolTimeouts: false });
6843
6971
  try {
6844
6972
  logger.debug(`[AcpBackend] Sending prompt (length: ${prompt.length}): ${prompt.substring(0, 100)}...`);
6845
6973
  logger.debug(`[AcpBackend] Full prompt: ${prompt}`);
@@ -6900,7 +7028,7 @@ ${recentStderrExcerpt}`);
6900
7028
  * Wait for the response to complete (idle status after all chunks received)
6901
7029
  * Call this after sendPrompt to wait for Gemini to finish responding
6902
7030
  */
6903
- async waitForResponseComplete(timeoutMs = 12e4) {
7031
+ async waitForResponseComplete(timeoutMs = 10 * 6e4) {
6904
7032
  if (this.responseCompletionError) {
6905
7033
  throw this.responseCompletionError;
6906
7034
  }
@@ -6916,26 +7044,19 @@ ${recentStderrExcerpt}`);
6916
7044
  return;
6917
7045
  }
6918
7046
  return new Promise((resolve, reject) => {
6919
- const timeout = setTimeout(() => {
6920
- this.idleResolver = null;
6921
- this.idleRejecter = null;
6922
- this.waitingForResponse = false;
6923
- reject(new Error("Timeout waiting for response to complete"));
6924
- }, timeoutMs);
6925
7047
  this.idleResolver = () => {
6926
- clearTimeout(timeout);
6927
7048
  this.idleResolver = null;
6928
7049
  this.idleRejecter = null;
6929
7050
  this.waitingForResponse = false;
6930
7051
  resolve();
6931
7052
  };
6932
7053
  this.idleRejecter = (error) => {
6933
- clearTimeout(timeout);
6934
7054
  this.idleResolver = null;
6935
7055
  this.idleRejecter = null;
6936
7056
  this.waitingForResponse = false;
6937
7057
  reject(error);
6938
7058
  };
7059
+ this.armResponseWaitTimeout(timeoutMs);
6939
7060
  });
6940
7061
  }
6941
7062
  /**
@@ -8421,7 +8542,7 @@ class ClaudeCodeBackend {
8421
8542
  logger.debug("[ClaudeRuntimeBackend] Error interrupting Claude query:", error);
8422
8543
  }
8423
8544
  }
8424
- async waitForResponseComplete(timeoutMs = 12e4) {
8545
+ async waitForResponseComplete(timeoutMs = 10 * 6e4) {
8425
8546
  if (this.responseCompletionOutcome) {
8426
8547
  const outcome = this.responseCompletionOutcome;
8427
8548
  if (outcome.kind === "rejected") {
@@ -9001,11 +9122,11 @@ var launch = /*#__PURE__*/Object.freeze({
9001
9122
 
9002
9123
  const unifiedProviderExecutors = {
9003
9124
  claude: async (opts) => {
9004
- const { runClaude } = await import('./runClaude-B74dHAnQ.mjs');
9125
+ const { runClaude } = await import('./runClaude-7St9-Jci.mjs');
9005
9126
  await runClaude(opts.credentials, opts.claudeOptions ?? {});
9006
9127
  },
9007
9128
  codex: async (opts) => {
9008
- const { runCodex } = await import('./runCodex-mLHjsgVj.mjs');
9129
+ const { runCodex } = await import('./runCodex-BaXi_9BC.mjs');
9009
9130
  await runCodex({
9010
9131
  credentials: opts.credentials,
9011
9132
  startedBy: opts.startedBy,
@@ -9014,7 +9135,7 @@ const unifiedProviderExecutors = {
9014
9135
  });
9015
9136
  },
9016
9137
  gemini: async (opts) => {
9017
- const { runGemini } = await import('./runGemini-BMiho2ab.mjs');
9138
+ const { runGemini } = await import('./runGemini-ClNqE9N3.mjs');
9018
9139
  await runGemini({
9019
9140
  credentials: opts.credentials,
9020
9141
  startedBy: opts.startedBy
@@ -9090,7 +9211,7 @@ function shouldRunMainClaudeFlow(opts) {
9090
9211
  return;
9091
9212
  } else if (subcommand === "runtime") {
9092
9213
  if (args[1] === "providers") {
9093
- const { renderRuntimeProviders } = await import('./command-CeaBwYCW.mjs');
9214
+ const { renderRuntimeProviders } = await import('./command-FbV44egL.mjs');
9094
9215
  console.log(renderRuntimeProviders());
9095
9216
  return;
9096
9217
  }
@@ -9268,8 +9389,8 @@ function shouldRunMainClaudeFlow(opts) {
9268
9389
  const projectId = args[3];
9269
9390
  try {
9270
9391
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
9271
- const { readCredentials: readCredentials2 } = await import('./persistence-BOWh1NER.mjs');
9272
- const { ApiClient: ApiClient2 } = await import('./api-DBy5lPZw.mjs').then(function (n) { return n.v; });
9392
+ const { readCredentials: readCredentials2 } = await import('./persistence-Cmgj3ubQ.mjs');
9393
+ const { ApiClient: ApiClient2 } = await import('./api-BGv79x9Q.mjs').then(function (n) { return n.v; });
9273
9394
  let userEmail = void 0;
9274
9395
  try {
9275
9396
  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-DId_j3C2.cjs');
5
- require('./persistence-Dzr6sFwD.cjs');
4
+ require('./api-OoiG7XjD.cjs');
5
+ require('./persistence-lN9HV4IZ.cjs');
6
6
  require('zod');
7
- require('./index-CuuYSKiv.cjs');
7
+ require('./index-D9lWHpn-.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-DBy5lPZw.mjs';
3
- import './persistence-BOWh1NER.mjs';
2
+ import './api-BGv79x9Q.mjs';
3
+ import './persistence-Cmgj3ubQ.mjs';
4
4
  import 'zod';
5
- import './index-66vjECEd.mjs';
5
+ import './index-TRC83Ks9.mjs';
6
6
  import 'node:child_process';
7
7
  import 'node:fs';
8
8
  import 'cross-spawn';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var api = require('./api-DId_j3C2.cjs');
3
+ var api = require('./api-OoiG7XjD.cjs');
4
4
  var types = require('./types-DVk3crez.cjs');
5
5
  require('axios');
6
6
  require('chalk');