happy-imou-cloud 2.1.29 → 2.1.31

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 (26) hide show
  1. package/dist/{BaseReasoningProcessor-QT_dSuan.mjs → BaseReasoningProcessor-CaFHRe9H.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-DuLdp082.cjs → BaseReasoningProcessor-JFdT7HPG.cjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-DzXwbICR.mjs → ProviderSelectionHandler-Cjfd17Lp.mjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-xg79m85m.cjs → ProviderSelectionHandler-ql1Ikkru.cjs} +2 -2
  5. package/dist/{api-Bov4X0ck.mjs → api-Baxp1gAn.mjs} +21 -3
  6. package/dist/{api-Tu1SSw5U.cjs → api-Har_Kn3X.cjs} +21 -3
  7. package/dist/{command-Ci3-YGml.mjs → command-CyfoYUmk.mjs} +2 -2
  8. package/dist/{command-Bur6vo4u.cjs → command-vvaFH5Xx.cjs} +2 -2
  9. package/dist/{index-D0WtwNYf.cjs → index-B_8-tkL4.cjs} +167 -31
  10. package/dist/{index-2TS8A185.mjs → index-BmOq3bu1.mjs} +164 -28
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.d.cts +30 -0
  15. package/dist/lib.d.mts +30 -0
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-BqJ_ZVtP.cjs → registerKillSessionHandler-D1QR0rK1.cjs} +18 -5
  18. package/dist/{registerKillSessionHandler-CqmTW-qd.mjs → registerKillSessionHandler-WMXTq_kr.mjs} +18 -5
  19. package/dist/{runClaude-D91_IJn8.cjs → runClaude-DhfpW9XR.cjs} +4 -4
  20. package/dist/{runClaude-CTJaXrxd.mjs → runClaude-TrzlAhzh.mjs} +4 -4
  21. package/dist/{runCodex-KPzrHhto.cjs → runCodex-D4EIHtfX.cjs} +134 -9
  22. package/dist/{runCodex-BLj4bV7h.mjs → runCodex-GpBK90D2.mjs} +134 -9
  23. package/dist/{runGemini-BliApYMu.cjs → runGemini-CR5MW3P-.cjs} +4 -4
  24. package/dist/{runGemini-CkL2dzh7.mjs → runGemini-D15RH8Iq.mjs} +4 -4
  25. package/package.json +1 -1
  26. package/scripts/release-smoke.mjs +8 -8
@@ -1,5 +1,5 @@
1
- import { a as createSessionMetadata, p as publishSessionRegistration } from './index-2TS8A185.mjs';
2
- import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-Bov4X0ck.mjs';
1
+ import { a as createSessionMetadata, p as publishSessionRegistration } from './index-BmOq3bu1.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-Baxp1gAn.mjs';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import { randomUUID } from 'node:crypto';
5
5
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-D0WtwNYf.cjs');
4
- var persistence = require('./api-Tu1SSw5U.cjs');
3
+ var index = require('./index-B_8-tkL4.cjs');
4
+ var persistence = require('./api-Har_Kn3X.cjs');
5
5
  var node_events = require('node:events');
6
6
  var node_crypto = require('node:crypto');
7
7
 
@@ -1,5 +1,5 @@
1
- import { l as logger } from './api-Bov4X0ck.mjs';
2
- import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-CqmTW-qd.mjs';
1
+ import { l as logger } from './api-Baxp1gAn.mjs';
2
+ import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-WMXTq_kr.mjs';
3
3
 
4
4
  async function runModeLoop(opts) {
5
5
  let currentMode = opts.startingMode;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-Tu1SSw5U.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-BqJ_ZVtP.cjs');
3
+ var persistence = require('./api-Har_Kn3X.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-D1QR0rK1.cjs');
5
5
 
6
6
  async function runModeLoop(opts) {
7
7
  let currentMode = opts.startingMode;
@@ -18,7 +18,7 @@ import { spawn } from 'node:child_process';
18
18
  import { Expo } from 'expo-server-sdk';
19
19
 
20
20
  var name = "happy-imou-cloud";
21
- var version = "2.1.29";
21
+ var version = "2.1.31";
22
22
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
23
23
  var author = "long.zhu";
24
24
  var license = "MIT";
@@ -1206,9 +1206,15 @@ const HappyOrgTurnStatusSchema = z$1.enum([
1206
1206
  "task_complete",
1207
1207
  "turn_aborted"
1208
1208
  ]);
1209
+ const HappyOrgAccessChannelStateSchema = z$1.enum([
1210
+ "ok",
1211
+ "reattach_required",
1212
+ "runtime_replaced"
1213
+ ]);
1209
1214
  const HappyOrgTaskContextSchema = z$1.object({
1210
1215
  taskId: z$1.string().min(1),
1211
1216
  organizationId: z$1.string().min(1),
1217
+ organizationRootPath: z$1.string().min(1).optional().nullable(),
1212
1218
  memberAgentId: z$1.string().min(1),
1213
1219
  supervisorAgentId: z$1.string().min(1),
1214
1220
  positionId: z$1.string().min(1).optional().nullable(),
@@ -1261,7 +1267,8 @@ z$1.object({
1261
1267
  interventionType: HappyOrgInterventionTypeSchema.optional().nullable(),
1262
1268
  blockerCode: z$1.string().optional().nullable(),
1263
1269
  decisionNeeded: z$1.string().optional().nullable(),
1264
- targetArtifact: z$1.string().optional().nullable()
1270
+ targetArtifact: z$1.string().optional().nullable(),
1271
+ accessChannelState: HappyOrgAccessChannelStateSchema.optional().nullable()
1265
1272
  });
1266
1273
  const HappyOrgTurnReportSchema = HappyOrgTaskContextSchema.extend({
1267
1274
  turnStatus: HappyOrgTurnStatusSchema,
@@ -1270,6 +1277,7 @@ const HappyOrgTurnReportSchema = HappyOrgTaskContextSchema.extend({
1270
1277
  blockerCode: z$1.string().nullable(),
1271
1278
  decisionNeeded: z$1.string().nullable(),
1272
1279
  targetArtifact: z$1.string().nullable(),
1280
+ accessChannelState: HappyOrgAccessChannelStateSchema.nullable(),
1273
1281
  repeatFingerprint: z$1.string().nullable(),
1274
1282
  replyContext: HappyOrgReplyContextSchema.nullish(),
1275
1283
  specialistHome: HappyOrgSpecialistHomeIdentitySchema.nullish()
@@ -2876,14 +2884,24 @@ function buildSessionRuntimeIndex(metadata) {
2876
2884
  };
2877
2885
  }
2878
2886
 
2887
+ function shouldPreserveCurrentHostPid(current, next) {
2888
+ if (typeof current?.hostPid !== "number") {
2889
+ return false;
2890
+ }
2891
+ if (current.hostPid !== process.pid) {
2892
+ return false;
2893
+ }
2894
+ return typeof next.hostPid !== "number" || next.hostPid !== current.hostPid;
2895
+ }
2879
2896
  function preserveSessionRuntimeMetadata(current, next) {
2880
2897
  if (!current) {
2881
2898
  return next;
2882
2899
  }
2900
+ const preserveCurrentHostPid = shouldPreserveCurrentHostPid(current, next);
2883
2901
  return {
2884
2902
  ...next,
2885
2903
  ...next.machineId ? {} : current.machineId ? { machineId: current.machineId } : {},
2886
- ...typeof next.hostPid === "number" ? {} : typeof current.hostPid === "number" ? { hostPid: current.hostPid } : {},
2904
+ ...typeof next.hostPid === "number" && !preserveCurrentHostPid ? {} : typeof current.hostPid === "number" ? { hostPid: current.hostPid } : {},
2887
2905
  ...typeof next.startedFromDaemon === "boolean" ? {} : typeof current.startedFromDaemon === "boolean" ? { startedFromDaemon: current.startedFromDaemon } : {},
2888
2906
  ...next.startedBy ? {} : current.startedBy ? { startedBy: current.startedBy } : {},
2889
2907
  ...next.lifecycleState ? {} : current.lifecycleState ? { lifecycleState: current.lifecycleState } : {},
@@ -38,7 +38,7 @@ function _interopNamespaceDefault(e) {
38
38
  var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
39
39
 
40
40
  var name = "happy-imou-cloud";
41
- var version = "2.1.29";
41
+ var version = "2.1.31";
42
42
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
43
43
  var author = "long.zhu";
44
44
  var license = "MIT";
@@ -1226,9 +1226,15 @@ const HappyOrgTurnStatusSchema = z.z.enum([
1226
1226
  "task_complete",
1227
1227
  "turn_aborted"
1228
1228
  ]);
1229
+ const HappyOrgAccessChannelStateSchema = z.z.enum([
1230
+ "ok",
1231
+ "reattach_required",
1232
+ "runtime_replaced"
1233
+ ]);
1229
1234
  const HappyOrgTaskContextSchema = z.z.object({
1230
1235
  taskId: z.z.string().min(1),
1231
1236
  organizationId: z.z.string().min(1),
1237
+ organizationRootPath: z.z.string().min(1).optional().nullable(),
1232
1238
  memberAgentId: z.z.string().min(1),
1233
1239
  supervisorAgentId: z.z.string().min(1),
1234
1240
  positionId: z.z.string().min(1).optional().nullable(),
@@ -1281,7 +1287,8 @@ z.z.object({
1281
1287
  interventionType: HappyOrgInterventionTypeSchema.optional().nullable(),
1282
1288
  blockerCode: z.z.string().optional().nullable(),
1283
1289
  decisionNeeded: z.z.string().optional().nullable(),
1284
- targetArtifact: z.z.string().optional().nullable()
1290
+ targetArtifact: z.z.string().optional().nullable(),
1291
+ accessChannelState: HappyOrgAccessChannelStateSchema.optional().nullable()
1285
1292
  });
1286
1293
  const HappyOrgTurnReportSchema = HappyOrgTaskContextSchema.extend({
1287
1294
  turnStatus: HappyOrgTurnStatusSchema,
@@ -1290,6 +1297,7 @@ const HappyOrgTurnReportSchema = HappyOrgTaskContextSchema.extend({
1290
1297
  blockerCode: z.z.string().nullable(),
1291
1298
  decisionNeeded: z.z.string().nullable(),
1292
1299
  targetArtifact: z.z.string().nullable(),
1300
+ accessChannelState: HappyOrgAccessChannelStateSchema.nullable(),
1293
1301
  repeatFingerprint: z.z.string().nullable(),
1294
1302
  replyContext: HappyOrgReplyContextSchema.nullish(),
1295
1303
  specialistHome: HappyOrgSpecialistHomeIdentitySchema.nullish()
@@ -2896,14 +2904,24 @@ function buildSessionRuntimeIndex(metadata) {
2896
2904
  };
2897
2905
  }
2898
2906
 
2907
+ function shouldPreserveCurrentHostPid(current, next) {
2908
+ if (typeof current?.hostPid !== "number") {
2909
+ return false;
2910
+ }
2911
+ if (current.hostPid !== process.pid) {
2912
+ return false;
2913
+ }
2914
+ return typeof next.hostPid !== "number" || next.hostPid !== current.hostPid;
2915
+ }
2899
2916
  function preserveSessionRuntimeMetadata(current, next) {
2900
2917
  if (!current) {
2901
2918
  return next;
2902
2919
  }
2920
+ const preserveCurrentHostPid = shouldPreserveCurrentHostPid(current, next);
2903
2921
  return {
2904
2922
  ...next,
2905
2923
  ...next.machineId ? {} : current.machineId ? { machineId: current.machineId } : {},
2906
- ...typeof next.hostPid === "number" ? {} : typeof current.hostPid === "number" ? { hostPid: current.hostPid } : {},
2924
+ ...typeof next.hostPid === "number" && !preserveCurrentHostPid ? {} : typeof current.hostPid === "number" ? { hostPid: current.hostPid } : {},
2907
2925
  ...typeof next.startedFromDaemon === "boolean" ? {} : typeof current.startedFromDaemon === "boolean" ? { startedFromDaemon: current.startedFromDaemon } : {},
2908
2926
  ...next.startedBy ? {} : current.startedBy ? { startedBy: current.startedBy } : {},
2909
2927
  ...next.lifecycleState ? {} : current.lifecycleState ? { lifecycleState: current.lifecycleState } : {},
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-2TS8A185.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-BmOq3bu1.mjs';
2
2
  import 'chalk';
3
- import './api-Bov4X0ck.mjs';
3
+ import './api-Baxp1gAn.mjs';
4
4
  import 'axios';
5
5
  import 'fs';
6
6
  import 'node:fs';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-D0WtwNYf.cjs');
3
+ var index = require('./index-B_8-tkL4.cjs');
4
4
  require('chalk');
5
- require('./api-Tu1SSw5U.cjs');
5
+ require('./api-Har_Kn3X.cjs');
6
6
  require('axios');
7
7
  require('fs');
8
8
  require('node:fs');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var persistence = require('./api-Tu1SSw5U.cjs');
4
+ var persistence = require('./api-Har_Kn3X.cjs');
5
5
  var z = require('zod');
6
6
  var fs$2 = require('fs/promises');
7
7
  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-D0WtwNYf.cjs', document.baseURI).href)));
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-B_8-tkL4.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();
@@ -637,7 +637,7 @@ function setupCleanupHandlers() {
637
637
  });
638
638
  }
639
639
 
640
- 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-D0WtwNYf.cjs', document.baseURI).href))));
640
+ 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-B_8-tkL4.cjs', document.baseURI).href))));
641
641
  function projectPath() {
642
642
  const path = path$1.resolve(__dirname$2, "..");
643
643
  return path;
@@ -6904,6 +6904,22 @@ function renderToolOutput(accumulator) {
6904
6904
  }
6905
6905
  return accumulator.preview.render("tool output");
6906
6906
  }
6907
+ function extractTerminalOutputMeta(update) {
6908
+ if (!isRecord$1(update._meta)) {
6909
+ return null;
6910
+ }
6911
+ const terminalOutput = update._meta.terminal_output;
6912
+ if (!isRecord$1(terminalOutput)) {
6913
+ return null;
6914
+ }
6915
+ const data = typeof terminalOutput.data === "string" && terminalOutput.data.length > 0 ? terminalOutput.data : null;
6916
+ if (!data) {
6917
+ return null;
6918
+ }
6919
+ const terminalId = typeof terminalOutput.terminal_id === "string" && terminalOutput.terminal_id.length > 0 ? terminalOutput.terminal_id : null;
6920
+ const toolCallId = typeof update.toolCallId === "string" && update.toolCallId.length > 0 ? update.toolCallId : terminalId;
6921
+ return toolCallId ? { toolCallId, data } : null;
6922
+ }
6907
6923
  function formatToolCallTimeoutLimit(timeoutMs) {
6908
6924
  if (timeoutMs < 1e3) {
6909
6925
  return `${timeoutMs}ms`;
@@ -7239,7 +7255,7 @@ function failToolCall(toolCallId, status, toolKind, content, ctx) {
7239
7255
  ctx.emitIdleStatus();
7240
7256
  }
7241
7257
  }
7242
- function handleToolCallUpdate(update, ctx) {
7258
+ function handleToolCallUpdate(update, ctx, options) {
7243
7259
  const status = update.status;
7244
7260
  const toolCallId = update.toolCallId;
7245
7261
  if (!toolCallId) {
@@ -7248,7 +7264,7 @@ function handleToolCallUpdate(update, ctx) {
7248
7264
  }
7249
7265
  const toolKind = update.kind || ctx.toolCallIdToNameMap.get(toolCallId) || "unknown";
7250
7266
  let toolCallCountSincePrompt = ctx.toolCallCountSincePrompt;
7251
- const outputChunk = extractToolOutputChunk(update.content);
7267
+ const outputChunk = extractToolOutputChunk(update.content) ?? options?.supplementalOutputChunk ?? null;
7252
7268
  if (outputChunk) {
7253
7269
  const nextOutput = appendToolOutput(ctx.toolCallOutputs.get(toolCallId), outputChunk);
7254
7270
  ctx.toolCallOutputs.set(toolCallId, nextOutput);
@@ -7265,7 +7281,21 @@ function handleToolCallUpdate(update, ctx) {
7265
7281
  } else if (status === "failed" || status === "cancelled") {
7266
7282
  failToolCall(toolCallId, status, toolKind, update.content, ctx);
7267
7283
  }
7268
- return { handled: true, toolCallCountSincePrompt };
7284
+ return {
7285
+ handled: true,
7286
+ toolCallCountSincePrompt,
7287
+ hadVisibleProgress: outputChunk !== null
7288
+ };
7289
+ }
7290
+ function extractSupplementalToolProgress(update) {
7291
+ const terminalOutput = extractTerminalOutputMeta(update);
7292
+ if (!terminalOutput) {
7293
+ return null;
7294
+ }
7295
+ return {
7296
+ toolCallId: terminalOutput.toolCallId,
7297
+ outputChunk: terminalOutput.data
7298
+ };
7269
7299
  }
7270
7300
  function handleToolCall(update, ctx) {
7271
7301
  const toolCallId = update.toolCallId;
@@ -7334,7 +7364,7 @@ function buildAcpSpawnSpec(params) {
7334
7364
  }
7335
7365
 
7336
7366
  const MAX_DROPPED_LINE_PREVIEW_CHARS = 4096;
7337
- const DEFAULT_ACP_MAX_MULTILINE_STDOUT_BYTES = 128 * 1024;
7367
+ const DEFAULT_ACP_MAX_MULTILINE_STDOUT_BYTES = 32 * 1024;
7338
7368
  function formatDroppedLinePreview(line) {
7339
7369
  if (line.length <= MAX_DROPPED_LINE_PREVIEW_CHARS) {
7340
7370
  return line;
@@ -7591,6 +7621,8 @@ const RETRY_CONFIG = {
7591
7621
  };
7592
7622
  const DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS = 2 * 6e4;
7593
7623
  const MAX_DROPPED_STDOUT_LINE_SAMPLES = 5;
7624
+ const HAPPY_ACP_MAX_MULTILINE_STDOUT_BYTES_ENV = "HAPPY_ACP_MAX_MULTILINE_STDOUT_BYTES";
7625
+ const HAPPIER_ACP_MAX_MULTILINE_STDOUT_BYTES_ENV = "HAPPIER_ACP_MAX_MULTILINE_STDOUT_BYTES";
7594
7626
  function readPositiveIntegerEnv(name) {
7595
7627
  const raw = typeof process.env[name] === "string" ? process.env[name].trim() : "";
7596
7628
  if (!raw) {
@@ -7613,6 +7645,25 @@ function resolvePostPromptNoUpdatesTimeoutMs(transport) {
7613
7645
  }
7614
7646
  return DEFAULT_POST_PROMPT_NO_UPDATES_TIMEOUT_MS;
7615
7647
  }
7648
+ function resolveAcpMaxMultilineStdoutBytes() {
7649
+ const envValue = readPositiveIntegerEnv(HAPPY_ACP_MAX_MULTILINE_STDOUT_BYTES_ENV) ?? readPositiveIntegerEnv(HAPPIER_ACP_MAX_MULTILINE_STDOUT_BYTES_ENV);
7650
+ return envValue ?? DEFAULT_ACP_MAX_MULTILINE_STDOUT_BYTES;
7651
+ }
7652
+ function formatAcpStdoutByteLimit(bytes) {
7653
+ if (bytes >= 1024 * 1024) {
7654
+ const value = bytes / (1024 * 1024);
7655
+ return `${Number.isInteger(value) ? value : value.toFixed(1)} MiB`;
7656
+ }
7657
+ if (bytes >= 1024) {
7658
+ const value = bytes / 1024;
7659
+ return `${Number.isInteger(value) ? value : value.toFixed(1)} KiB`;
7660
+ }
7661
+ return `${bytes} bytes`;
7662
+ }
7663
+ function buildMultilineOverflowStatusDetail(maxBytes) {
7664
+ const formattedLimit = formatAcpStdoutByteLimit(maxBytes);
7665
+ return `Suppressed oversized agent output (>${formattedLimit} / ${maxBytes} bytes per ACP stdout record). Full output stays hidden by default. If you need larger payloads, set ${HAPPY_ACP_MAX_MULTILINE_STDOUT_BYTES_ENV}.`;
7666
+ }
7616
7667
  function getSessionUpdates(params) {
7617
7668
  const notification = params;
7618
7669
  const updates = Array.isArray(notification.updates) ? notification.updates.filter((update) => Boolean(update && typeof update === "object")) : [];
@@ -7627,14 +7678,14 @@ function getSessionUpdates(params) {
7627
7678
  function asNonNegativeFiniteNumber(value) {
7628
7679
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
7629
7680
  }
7630
- function shouldRefreshProgressForToolCallUpdate(update, wasToolCallActive, isToolCallActive) {
7681
+ function shouldRefreshProgressForToolCallUpdate(update, wasToolCallActive, isToolCallActive, hadVisibleProgress = false) {
7631
7682
  if (!wasToolCallActive && isToolCallActive) {
7632
7683
  return true;
7633
7684
  }
7634
7685
  if (update.status === "completed" || update.status === "failed" || update.status === "cancelled") {
7635
7686
  return true;
7636
7687
  }
7637
- return hasVisibleToolCallProgress(update.content);
7688
+ return hadVisibleProgress || hasVisibleToolCallProgress(update.content);
7638
7689
  }
7639
7690
  function extractUsageTokens(record) {
7640
7691
  const used = asNonNegativeFiniteNumber(record.used);
@@ -7869,32 +7920,37 @@ function enrichAcpError(error, stderrExcerpt) {
7869
7920
  return normalized;
7870
7921
  }
7871
7922
  class AcpProcessStartupError extends Error {
7872
- constructor(message, exitCode, signal) {
7923
+ constructor(message, exitCode, signal, stderr) {
7873
7924
  super(message);
7874
7925
  this.exitCode = exitCode;
7875
7926
  this.signal = signal;
7927
+ this.stderr = stderr;
7876
7928
  this.name = "AcpProcessStartupError";
7877
7929
  }
7878
7930
  }
7879
- function createProcessStartupError(agentName, operationName, code, signal) {
7931
+ function createProcessStartupError(agentName, operationName, code, signal, stderrExcerpt) {
7932
+ const normalizedStderrExcerpt = stderrExcerpt?.trim() || void 0;
7880
7933
  if (code !== null) {
7881
7934
  return new AcpProcessStartupError(
7882
7935
  `${agentName} exited with code ${code} during ${operationName}`,
7883
7936
  code,
7884
- signal
7937
+ signal,
7938
+ normalizedStderrExcerpt
7885
7939
  );
7886
7940
  }
7887
7941
  if (signal) {
7888
7942
  return new AcpProcessStartupError(
7889
7943
  `${agentName} exited due to signal ${signal} during ${operationName}`,
7890
7944
  code,
7891
- signal
7945
+ signal,
7946
+ normalizedStderrExcerpt
7892
7947
  );
7893
7948
  }
7894
7949
  return new AcpProcessStartupError(
7895
7950
  `${agentName} exited unexpectedly during ${operationName}`,
7896
7951
  code,
7897
- signal
7952
+ signal,
7953
+ normalizedStderrExcerpt
7898
7954
  );
7899
7955
  }
7900
7956
  async function raceWithProcessExit(childProcess, operation, options) {
@@ -7903,7 +7959,8 @@ async function raceWithProcessExit(childProcess, operation, options) {
7903
7959
  options.agentName,
7904
7960
  options.operationName,
7905
7961
  childProcess.exitCode,
7906
- childProcess.signalCode ?? null
7962
+ childProcess.signalCode ?? null,
7963
+ options.getStderrExcerpt?.()
7907
7964
  );
7908
7965
  }
7909
7966
  return await new Promise((resolve, reject) => {
@@ -7932,7 +7989,15 @@ async function raceWithProcessExit(childProcess, operation, options) {
7932
7989
  settleReject(error);
7933
7990
  };
7934
7991
  const handleExit = (code, signal) => {
7935
- settleReject(createProcessStartupError(options.agentName, options.operationName, code, signal));
7992
+ settleReject(
7993
+ createProcessStartupError(
7994
+ options.agentName,
7995
+ options.operationName,
7996
+ code,
7997
+ signal,
7998
+ options.getStderrExcerpt?.()
7999
+ )
8000
+ );
7936
8001
  };
7937
8002
  childProcess.once("error", handleError);
7938
8003
  childProcess.once("exit", handleExit);
@@ -7947,6 +8012,7 @@ class AcpBackend {
7947
8012
  agentName: options.agentName,
7948
8013
  env: options.env
7949
8014
  });
8015
+ this.acpMaxMultilineStdoutBytes = resolveAcpMaxMultilineStdoutBytes();
7950
8016
  }
7951
8017
  listeners = [];
7952
8018
  process = null;
@@ -7997,6 +8063,8 @@ class AcpBackend {
7997
8063
  sessionConfigOptions = null;
7998
8064
  /** Keep a short rolling stderr buffer so startup failures can surface the real cause. */
7999
8065
  recentStderrLines = [];
8066
+ acpMaxMultilineStdoutBytes;
8067
+ oversizedStdoutNoticeEmittedForCurrentTurn = false;
8000
8068
  resourceCleanupDone = false;
8001
8069
  recordRecentStderr(text) {
8002
8070
  const normalized = text.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
@@ -8011,6 +8079,15 @@ class AcpBackend {
8011
8079
  getRecentStderrExcerpt() {
8012
8080
  return this.recentStderrLines.slice(-6).join("\n");
8013
8081
  }
8082
+ getRecentStderrSummaryLine() {
8083
+ for (const line of this.recentStderrLines.slice(-6).reverse()) {
8084
+ if (/^note:\s+run with\b/i.test(line)) {
8085
+ continue;
8086
+ }
8087
+ return line;
8088
+ }
8089
+ return this.recentStderrLines.at(-1);
8090
+ }
8014
8091
  async cleanupOwnedResources() {
8015
8092
  if (this.resourceCleanupDone) {
8016
8093
  return;
@@ -8169,6 +8246,31 @@ class AcpBackend {
8169
8246
  this.toolCallTimeoutSpecs.delete(toolCallId);
8170
8247
  return hadTimeout;
8171
8248
  }
8249
+ finalizeDanglingToolCallsAfterTaskComplete() {
8250
+ if (this.activeToolCalls.size === 0) {
8251
+ return;
8252
+ }
8253
+ const danglingToolCallIds = Array.from(this.activeToolCalls);
8254
+ persistence.logger.debug(
8255
+ `[AcpBackend] task_complete arrived with ${danglingToolCallIds.length} active tool call(s); synthesizing completion from buffered output`,
8256
+ danglingToolCallIds
8257
+ );
8258
+ for (const toolCallId of danglingToolCallIds) {
8259
+ const toolName = this.toolCallIdToNameMap.get(toolCallId) || "unknown";
8260
+ const streamedOutput = renderToolOutput(this.toolCallOutputs.get(toolCallId));
8261
+ this.activeToolCalls.delete(toolCallId);
8262
+ this.toolCallStartTimes.delete(toolCallId);
8263
+ this.toolCallIdToNameMap.delete(toolCallId);
8264
+ this.toolCallOutputs.delete(toolCallId);
8265
+ this.clearToolCallTimeout(toolCallId);
8266
+ this.emit({
8267
+ type: "tool-result",
8268
+ toolName,
8269
+ result: streamedOutput,
8270
+ callId: toolCallId
8271
+ });
8272
+ }
8273
+ }
8172
8274
  refreshActiveToolCallTimeouts() {
8173
8275
  for (const toolCallId of this.activeToolCalls) {
8174
8276
  if (this.toolCallTimeoutSpecs.has(toolCallId)) {
@@ -8201,6 +8303,7 @@ class AcpBackend {
8201
8303
  this.responseCompletionOutcome = null;
8202
8304
  this.responseCompletionError = null;
8203
8305
  this.sawSessionUpdateSincePrompt = false;
8306
+ this.oversizedStdoutNoticeEmittedForCurrentTurn = false;
8204
8307
  this.resetResponseWaitTracking();
8205
8308
  this.clearIdleTimeoutState();
8206
8309
  this.clearPostPromptCompletionIdleTimeout();
@@ -8258,6 +8361,18 @@ class AcpBackend {
8258
8361
  }
8259
8362
  }
8260
8363
  handleDroppedStdoutLine(entry) {
8364
+ if (entry.reason === "multiline_overflow") {
8365
+ if (!this.waitingForResponse || this.responseCompletionError || this.oversizedStdoutNoticeEmittedForCurrentTurn) {
8366
+ return;
8367
+ }
8368
+ this.oversizedStdoutNoticeEmittedForCurrentTurn = true;
8369
+ this.emit({
8370
+ type: "status",
8371
+ status: "running",
8372
+ detail: buildMultilineOverflowStatusDetail(this.acpMaxMultilineStdoutBytes)
8373
+ });
8374
+ return;
8375
+ }
8261
8376
  if (entry.reason !== "transport_filter_null" || !this.waitingForResponse || this.responseCompletionError) {
8262
8377
  return;
8263
8378
  }
@@ -8347,6 +8462,7 @@ class AcpBackend {
8347
8462
  `[AcpBackend] Process exited with code ${code}, signal ${signal}, disposed=${this.disposed}, waitingForResponse=${this.waitingForResponse}`
8348
8463
  );
8349
8464
  const recentStderrExcerpt = this.getRecentStderrExcerpt();
8465
+ const recentStderrSummaryLine = this.getRecentStderrSummaryLine();
8350
8466
  if (recentStderrExcerpt) {
8351
8467
  persistence.logger.debug(`[AcpBackend] Recent stderr before exit:
8352
8468
  ${recentStderrExcerpt}`);
@@ -8359,11 +8475,15 @@ ${recentStderrExcerpt}`);
8359
8475
  this.failPendingResponseWait(new Error(detail));
8360
8476
  }
8361
8477
  if (code !== 0 && code !== null) {
8362
- this.emit({ type: "status", status: "stopped", detail: `Exit code: ${code}` });
8478
+ const detail = recentStderrSummaryLine ? `Exit code: ${code}
8479
+ Recent stderr: ${recentStderrSummaryLine}` : `Exit code: ${code}`;
8480
+ this.emit({ type: "status", status: "stopped", detail });
8363
8481
  return;
8364
8482
  }
8365
8483
  if (signal) {
8366
- this.emit({ type: "status", status: "stopped", detail: `Signal: ${signal}` });
8484
+ const detail = recentStderrSummaryLine ? `Signal: ${signal}
8485
+ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
8486
+ this.emit({ type: "status", status: "stopped", detail });
8367
8487
  }
8368
8488
  });
8369
8489
  const streams = nodeToWebStreams(
@@ -8390,7 +8510,8 @@ ${recentStderrExcerpt}`);
8390
8510
  droppedStdoutSummary.samples
8391
8511
  );
8392
8512
  }
8393
- }
8513
+ },
8514
+ maxMultilineBytes: this.acpMaxMultilineStdoutBytes
8394
8515
  });
8395
8516
  const stream = sdk.ndJsonStream(writable, filteredReadable);
8396
8517
  const client = {
@@ -8542,6 +8663,9 @@ ${recentStderrExcerpt}`);
8542
8663
  const initRequest = {
8543
8664
  protocolVersion: 1,
8544
8665
  clientCapabilities: {
8666
+ _meta: {
8667
+ terminal_output: true
8668
+ },
8545
8669
  fs: {
8546
8670
  readTextFile: false,
8547
8671
  writeTextFile: false
@@ -8581,7 +8705,8 @@ ${recentStderrExcerpt}`);
8581
8705
  ]),
8582
8706
  {
8583
8707
  agentName: this.transport.agentName,
8584
- operationName: "initialize"
8708
+ operationName: "initialize",
8709
+ getStderrExcerpt: () => this.getRecentStderrExcerpt()
8585
8710
  }
8586
8711
  );
8587
8712
  return result;
@@ -8633,7 +8758,8 @@ ${recentStderrExcerpt}`);
8633
8758
  ]),
8634
8759
  {
8635
8760
  agentName: this.transport.agentName,
8636
- operationName: "new session"
8761
+ operationName: "new session",
8762
+ getStderrExcerpt: () => this.getRecentStderrExcerpt()
8637
8763
  }
8638
8764
  );
8639
8765
  return result;
@@ -8756,6 +8882,7 @@ ${recentStderrExcerpt}`);
8756
8882
  const ctx = this.createHandlerContext();
8757
8883
  const toolCallId = update.toolCallId;
8758
8884
  const wasToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
8885
+ const supplementalToolProgress = extractSupplementalToolProgress(update);
8759
8886
  if (sessionUpdateType === "agent_message_chunk") {
8760
8887
  if (handleAgentMessageChunk(update, ctx).handled) {
8761
8888
  this.markResponseProgress();
@@ -8763,12 +8890,19 @@ ${recentStderrExcerpt}`);
8763
8890
  continue;
8764
8891
  }
8765
8892
  if (sessionUpdateType === "tool_call_update") {
8766
- const result = handleToolCallUpdate(update, ctx);
8893
+ const result = handleToolCallUpdate(update, ctx, {
8894
+ supplementalOutputChunk: supplementalToolProgress && supplementalToolProgress.toolCallId === toolCallId ? supplementalToolProgress.outputChunk : null
8895
+ });
8767
8896
  if (result.toolCallCountSincePrompt !== void 0) {
8768
8897
  this.toolCallCountSincePrompt = result.toolCallCountSincePrompt;
8769
8898
  }
8770
8899
  const isToolCallActive = typeof toolCallId === "string" && this.activeToolCalls.has(toolCallId);
8771
- if (shouldRefreshProgressForToolCallUpdate(update, wasToolCallActive, isToolCallActive)) {
8900
+ if (shouldRefreshProgressForToolCallUpdate(
8901
+ update,
8902
+ wasToolCallActive,
8903
+ isToolCallActive,
8904
+ result.hadVisibleProgress
8905
+ )) {
8772
8906
  this.markResponseProgress();
8773
8907
  }
8774
8908
  continue;
@@ -8799,6 +8933,7 @@ ${recentStderrExcerpt}`);
8799
8933
  }
8800
8934
  if (sessionUpdateType === "task_complete") {
8801
8935
  this.emitUsageTelemetry(update.usage, "acp-session-usage");
8936
+ this.finalizeDanglingToolCallsAfterTaskComplete();
8802
8937
  ctx.clearIdleTimeout();
8803
8938
  persistence.logger.debug("[AcpBackend] task_complete received, emitting idle status");
8804
8939
  this.emitIdleStatus();
@@ -8855,7 +8990,8 @@ ${recentStderrExcerpt}`);
8855
8990
  this.connection.prompt(promptRequest),
8856
8991
  {
8857
8992
  agentName: this.transport.agentName,
8858
- operationName: "prompt"
8993
+ operationName: "prompt",
8994
+ getStderrExcerpt: () => this.getRecentStderrExcerpt()
8859
8995
  }
8860
8996
  );
8861
8997
  persistence.logger.debug("[AcpBackend] Prompt request sent to ACP connection");
@@ -9926,7 +10062,7 @@ class AbortError extends Error {
9926
10062
  }
9927
10063
  }
9928
10064
 
9929
- 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-D0WtwNYf.cjs', document.baseURI).href)));
10065
+ 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-B_8-tkL4.cjs', document.baseURI).href)));
9930
10066
  const __dirname$1 = path.join(__filename$1, "..");
9931
10067
  function getGlobalClaudeVersion() {
9932
10068
  try {
@@ -11249,14 +11385,14 @@ var launch = /*#__PURE__*/Object.freeze({
11249
11385
  const unifiedProviderExecutors = {
11250
11386
  claude: async (opts) => {
11251
11387
  const claudeOptions = opts.claudeOptions ?? {};
11252
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-D91_IJn8.cjs'); });
11388
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-DhfpW9XR.cjs'); });
11253
11389
  await runClaude(opts.credentials, {
11254
11390
  ...claudeOptions,
11255
11391
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
11256
11392
  });
11257
11393
  },
11258
11394
  codex: async (opts) => {
11259
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-KPzrHhto.cjs'); });
11395
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-D4EIHtfX.cjs'); });
11260
11396
  await runCodex({
11261
11397
  credentials: opts.credentials,
11262
11398
  startedBy: opts.startedBy,
@@ -11265,7 +11401,7 @@ const unifiedProviderExecutors = {
11265
11401
  });
11266
11402
  },
11267
11403
  gemini: async (opts) => {
11268
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BliApYMu.cjs'); });
11404
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CR5MW3P-.cjs'); });
11269
11405
  await runGemini({
11270
11406
  credentials: opts.credentials,
11271
11407
  startedBy: opts.startedBy
@@ -11348,7 +11484,7 @@ function shouldRunMainClaudeFlow(opts) {
11348
11484
  return;
11349
11485
  } else if (subcommand === "runtime") {
11350
11486
  if (args[1] === "providers") {
11351
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-Bur6vo4u.cjs'); });
11487
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-vvaFH5Xx.cjs'); });
11352
11488
  console.log(renderRuntimeProviders());
11353
11489
  return;
11354
11490
  }
@@ -11554,8 +11690,8 @@ function shouldRunMainClaudeFlow(opts) {
11554
11690
  const projectId = args[3];
11555
11691
  try {
11556
11692
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
11557
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-Tu1SSw5U.cjs'); }).then(function (n) { return n.persistence; });
11558
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-Tu1SSw5U.cjs'); }).then(function (n) { return n.api; });
11693
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-Har_Kn3X.cjs'); }).then(function (n) { return n.persistence; });
11694
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-Har_Kn3X.cjs'); }).then(function (n) { return n.api; });
11559
11695
  let userEmail = void 0;
11560
11696
  try {
11561
11697
  const credentials = await readCredentials2();