happy-imou-cloud 2.1.26 → 2.1.27

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 (23) hide show
  1. package/dist/{BaseReasoningProcessor-KMtgV6ap.mjs → BaseReasoningProcessor-C5fKjdpv.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-0e-Wwv5i.cjs → BaseReasoningProcessor-Cc9g89Zo.cjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-CG8ktb5b.mjs → ProviderSelectionHandler-CqMvpE6K.mjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-CzRyfT1v.cjs → ProviderSelectionHandler-DANtoYaW.cjs} +2 -2
  5. package/dist/{api-hgzFUi7o.cjs → api-BVXbJ3M_.cjs} +46 -11
  6. package/dist/{api-DugHuNd4.mjs → api-CuWWLsDI.mjs} +47 -12
  7. package/dist/{command-DU0KWNsf.mjs → command-C7KnQtPU.mjs} +2 -2
  8. package/dist/{command-Dh8sawXu.cjs → command-CKw7FVJ3.cjs} +2 -2
  9. package/dist/{index-ythl_OD6.cjs → index-BBD69Ds-.cjs} +75 -26
  10. package/dist/{index-hj-qbq8Y.mjs → index-DPNRq_mT.mjs} +72 -23
  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.mjs +1 -1
  15. package/dist/{registerKillSessionHandler-BNzbdofF.mjs → registerKillSessionHandler-BVIaG4zk.mjs} +59 -7
  16. package/dist/{registerKillSessionHandler-Q_rOuCNA.cjs → registerKillSessionHandler-CeO8n78A.cjs} +59 -6
  17. package/dist/{runClaude-BUi2fgRI.cjs → runClaude-DU69fser.cjs} +7 -6
  18. package/dist/{runClaude-Y84RT6V0.mjs → runClaude-DWSBt6tE.mjs} +7 -6
  19. package/dist/{runCodex-D2xIzHke.mjs → runCodex-C3VoO79w.mjs} +15 -10
  20. package/dist/{runCodex-vO3-iZ8E.cjs → runCodex-DFH1tiGD.cjs} +15 -10
  21. package/dist/{runGemini-CAotw19V.mjs → runGemini-CCbOfI6U.mjs} +12 -7
  22. package/dist/{runGemini-DIKiIVdN.cjs → runGemini-QTOE7LXy.cjs} +12 -7
  23. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { a as createSessionMetadata, p as publishSessionRegistration } from './index-hj-qbq8Y.mjs';
2
- import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-DugHuNd4.mjs';
1
+ import { a as createSessionMetadata, p as publishSessionRegistration } from './index-DPNRq_mT.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-CuWWLsDI.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-ythl_OD6.cjs');
4
- var persistence = require('./api-hgzFUi7o.cjs');
3
+ var index = require('./index-BBD69Ds-.cjs');
4
+ var persistence = require('./api-BVXbJ3M_.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-DugHuNd4.mjs';
2
- import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BNzbdofF.mjs';
1
+ import { l as logger } from './api-CuWWLsDI.mjs';
2
+ import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BVIaG4zk.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-hgzFUi7o.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-Q_rOuCNA.cjs');
3
+ var persistence = require('./api-BVXbJ3M_.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-CeO8n78A.cjs');
5
5
 
6
6
  async function runModeLoop(opts) {
7
7
  let currentMode = opts.startingMode;
@@ -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.26";
41
+ var version = "2.1.27";
42
42
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
43
43
  var author = "long.zhu";
44
44
  var license = "MIT";
@@ -310,6 +310,39 @@ function getSessionLogPath() {
310
310
  const filename = configuration.isDaemonProcess ? `${timestamp}-daemon.log` : `${timestamp}.log`;
311
311
  return path.join(configuration.logsDir, filename);
312
312
  }
313
+ function isErrorLike(value) {
314
+ return value !== null && typeof value === "object" && ("stack" in value || "message" in value);
315
+ }
316
+ function formatLogArgument(value, pretty = false) {
317
+ if (typeof value === "string") {
318
+ return value;
319
+ }
320
+ if (value instanceof Error) {
321
+ return value.stack || value.message;
322
+ }
323
+ if (isErrorLike(value)) {
324
+ if (typeof value.stack === "string" && value.stack.length > 0) {
325
+ return value.stack;
326
+ }
327
+ if (typeof value.message === "string" && value.message.length > 0) {
328
+ return value.message;
329
+ }
330
+ }
331
+ try {
332
+ const serialized = JSON.stringify(value, null, pretty ? 2 : void 0);
333
+ return serialized === void 0 ? String(value) : serialized;
334
+ } catch {
335
+ if (isErrorLike(value)) {
336
+ if (typeof value.stack === "string" && value.stack.length > 0) {
337
+ return value.stack;
338
+ }
339
+ if (typeof value.message === "string" && value.message.length > 0) {
340
+ return value.message;
341
+ }
342
+ }
343
+ return String(value);
344
+ }
345
+ }
313
346
  class Logger {
314
347
  constructor(logFilePath = getSessionLogPath()) {
315
348
  this.logFilePath = logFilePath;
@@ -331,12 +364,18 @@ class Logger {
331
364
  if (!process.env.DEBUG) {
332
365
  this.debug(`In production, skipping message inspection`);
333
366
  }
334
- const truncateStrings = (obj) => {
367
+ const truncateStrings = (obj, seen = /* @__PURE__ */ new WeakSet()) => {
335
368
  if (typeof obj === "string") {
336
369
  return obj.length > maxStringLength ? obj.substring(0, maxStringLength) + "... [truncated for logs]" : obj;
337
370
  }
371
+ if (obj && typeof obj === "object") {
372
+ if (seen.has(obj)) {
373
+ return "[Circular]";
374
+ }
375
+ seen.add(obj);
376
+ }
338
377
  if (Array.isArray(obj)) {
339
- const truncatedArray = obj.map((item) => truncateStrings(item)).slice(0, maxArrayLength);
378
+ const truncatedArray = obj.map((item) => truncateStrings(item, seen)).slice(0, maxArrayLength);
340
379
  if (obj.length > maxArrayLength) {
341
380
  truncatedArray.push(`... [truncated array for logs up to ${maxArrayLength} items]`);
342
381
  }
@@ -348,14 +387,14 @@ class Logger {
348
387
  if (key === "usage") {
349
388
  continue;
350
389
  }
351
- result[key] = truncateStrings(value);
390
+ result[key] = truncateStrings(value, seen);
352
391
  }
353
392
  return result;
354
393
  }
355
394
  return obj;
356
395
  };
357
396
  const truncatedObject = truncateStrings(object);
358
- const json = JSON.stringify(truncatedObject, null, 2);
397
+ const json = formatLogArgument(truncatedObject, true);
359
398
  this.logToFile(`[${this.localTimezoneTimestamp()}]`, message, "\n", json);
360
399
  }
361
400
  info(message, ...args) {
@@ -409,9 +448,7 @@ class Logger {
409
448
  body: JSON.stringify({
410
449
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
411
450
  level,
412
- message: `${message} ${args.map(
413
- (a) => typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)
414
- ).join(" ")}`,
451
+ message: `${message} ${args.map((arg) => formatLogArgument(arg, true)).join(" ")}`,
415
452
  source: "cli",
416
453
  platform: process.platform
417
454
  })
@@ -420,9 +457,7 @@ class Logger {
420
457
  }
421
458
  }
422
459
  logToFile(prefix, message, ...args) {
423
- const logLine = `${prefix} ${message} ${args.map(
424
- (arg) => typeof arg === "string" ? arg : JSON.stringify(arg)
425
- ).join(" ")}
460
+ const logLine = `${prefix} ${message} ${args.map((arg) => formatLogArgument(arg)).join(" ")}
426
461
  `;
427
462
  if (this.dangerouslyUnencryptedServerLoggingUrl) {
428
463
  let level = "info";
@@ -18,7 +18,7 @@ import { unlink, readFile, mkdir, open, stat, writeFile, rename } from 'node:fs/
18
18
  import { Expo } from 'expo-server-sdk';
19
19
 
20
20
  var name = "happy-imou-cloud";
21
- var version = "2.1.26";
21
+ var version = "2.1.27";
22
22
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
23
23
  var author = "long.zhu";
24
24
  var license = "MIT";
@@ -290,6 +290,39 @@ function getSessionLogPath() {
290
290
  const filename = configuration.isDaemonProcess ? `${timestamp}-daemon.log` : `${timestamp}.log`;
291
291
  return join(configuration.logsDir, filename);
292
292
  }
293
+ function isErrorLike(value) {
294
+ return value !== null && typeof value === "object" && ("stack" in value || "message" in value);
295
+ }
296
+ function formatLogArgument(value, pretty = false) {
297
+ if (typeof value === "string") {
298
+ return value;
299
+ }
300
+ if (value instanceof Error) {
301
+ return value.stack || value.message;
302
+ }
303
+ if (isErrorLike(value)) {
304
+ if (typeof value.stack === "string" && value.stack.length > 0) {
305
+ return value.stack;
306
+ }
307
+ if (typeof value.message === "string" && value.message.length > 0) {
308
+ return value.message;
309
+ }
310
+ }
311
+ try {
312
+ const serialized = JSON.stringify(value, null, pretty ? 2 : void 0);
313
+ return serialized === void 0 ? String(value) : serialized;
314
+ } catch {
315
+ if (isErrorLike(value)) {
316
+ if (typeof value.stack === "string" && value.stack.length > 0) {
317
+ return value.stack;
318
+ }
319
+ if (typeof value.message === "string" && value.message.length > 0) {
320
+ return value.message;
321
+ }
322
+ }
323
+ return String(value);
324
+ }
325
+ }
293
326
  class Logger {
294
327
  constructor(logFilePath = getSessionLogPath()) {
295
328
  this.logFilePath = logFilePath;
@@ -311,12 +344,18 @@ class Logger {
311
344
  if (!process.env.DEBUG) {
312
345
  this.debug(`In production, skipping message inspection`);
313
346
  }
314
- const truncateStrings = (obj) => {
347
+ const truncateStrings = (obj, seen = /* @__PURE__ */ new WeakSet()) => {
315
348
  if (typeof obj === "string") {
316
349
  return obj.length > maxStringLength ? obj.substring(0, maxStringLength) + "... [truncated for logs]" : obj;
317
350
  }
351
+ if (obj && typeof obj === "object") {
352
+ if (seen.has(obj)) {
353
+ return "[Circular]";
354
+ }
355
+ seen.add(obj);
356
+ }
318
357
  if (Array.isArray(obj)) {
319
- const truncatedArray = obj.map((item) => truncateStrings(item)).slice(0, maxArrayLength);
358
+ const truncatedArray = obj.map((item) => truncateStrings(item, seen)).slice(0, maxArrayLength);
320
359
  if (obj.length > maxArrayLength) {
321
360
  truncatedArray.push(`... [truncated array for logs up to ${maxArrayLength} items]`);
322
361
  }
@@ -328,14 +367,14 @@ class Logger {
328
367
  if (key === "usage") {
329
368
  continue;
330
369
  }
331
- result[key] = truncateStrings(value);
370
+ result[key] = truncateStrings(value, seen);
332
371
  }
333
372
  return result;
334
373
  }
335
374
  return obj;
336
375
  };
337
376
  const truncatedObject = truncateStrings(object);
338
- const json = JSON.stringify(truncatedObject, null, 2);
377
+ const json = formatLogArgument(truncatedObject, true);
339
378
  this.logToFile(`[${this.localTimezoneTimestamp()}]`, message, "\n", json);
340
379
  }
341
380
  info(message, ...args) {
@@ -389,9 +428,7 @@ class Logger {
389
428
  body: JSON.stringify({
390
429
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
391
430
  level,
392
- message: `${message} ${args.map(
393
- (a) => typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)
394
- ).join(" ")}`,
431
+ message: `${message} ${args.map((arg) => formatLogArgument(arg, true)).join(" ")}`,
395
432
  source: "cli",
396
433
  platform: process.platform
397
434
  })
@@ -400,9 +437,7 @@ class Logger {
400
437
  }
401
438
  }
402
439
  logToFile(prefix, message, ...args) {
403
- const logLine = `${prefix} ${message} ${args.map(
404
- (arg) => typeof arg === "string" ? arg : JSON.stringify(arg)
405
- ).join(" ")}
440
+ const logLine = `${prefix} ${message} ${args.map((arg) => formatLogArgument(arg)).join(" ")}
406
441
  `;
407
442
  if (this.dangerouslyUnencryptedServerLoggingUrl) {
408
443
  let level = "info";
@@ -5149,4 +5184,4 @@ var api = /*#__PURE__*/Object.freeze({
5149
5184
  ApiClient: ApiClient
5150
5185
  });
5151
5186
 
5152
- export { ApiClient as A, acquireDaemonLock as B, writeDaemonState as C, releaseDaemonLock as D, validateProfileForAgent as E, getProfileEnvironmentVariables as F, clearCredentials as G, HAPPY_ORG_TURN_REPORT_TAG as H, clearMachineId as I, buildSocketAuth as J, encrypt as K, HeadTailPreviewBuffer as L, MessageContentSchema as M, getLatestDaemonLog as N, persistence as O, api as P, ApiSessionClient as a, connectionState as b, configuration as c, HAPPY_ORG_SUMMARY_MAX_LENGTH as d, HAPPY_ORG_REPEAT_THRESHOLD as e, backoff as f, delay as g, AsyncLock as h, isAuthenticationRequiredError as i, encodeBase64 as j, readCredentials as k, logger as l, ensureSigningCredentials as m, encodeBase64Url as n, buildClientHeaders as o, preserveSessionRuntimeMetadata as p, decodeBase64 as q, readSettings as r, startOfflineReconnection as s, writeCredentialsDataKey as t, updateSettings as u, readDaemonState as v, writeCredentialsLegacy as w, HAPPY_CLOUD_DAEMON_PORT as x, clearDaemonState as y, packageJson as z };
5187
+ export { ApiClient as A, packageJson as B, acquireDaemonLock as C, writeDaemonState as D, releaseDaemonLock as E, validateProfileForAgent as F, getProfileEnvironmentVariables as G, HeadTailPreviewBuffer as H, clearCredentials as I, clearMachineId as J, buildSocketAuth as K, encrypt as L, MessageContentSchema as M, getLatestDaemonLog as N, persistence as O, api as P, ApiSessionClient as a, connectionState as b, configuration as c, HAPPY_ORG_TURN_REPORT_TAG as d, HAPPY_ORG_SUMMARY_MAX_LENGTH as e, HAPPY_ORG_REPEAT_THRESHOLD as f, backoff as g, delay as h, isAuthenticationRequiredError as i, AsyncLock as j, encodeBase64 as k, logger as l, readCredentials as m, ensureSigningCredentials as n, encodeBase64Url as o, preserveSessionRuntimeMetadata as p, buildClientHeaders as q, readSettings as r, startOfflineReconnection as s, decodeBase64 as t, updateSettings as u, writeCredentialsDataKey as v, writeCredentialsLegacy as w, readDaemonState as x, HAPPY_CLOUD_DAEMON_PORT as y, clearDaemonState as z };
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-hj-qbq8Y.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-DPNRq_mT.mjs';
2
2
  import 'chalk';
3
- import './api-DugHuNd4.mjs';
3
+ import './api-CuWWLsDI.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-ythl_OD6.cjs');
3
+ var index = require('./index-BBD69Ds-.cjs');
4
4
  require('chalk');
5
- require('./api-hgzFUi7o.cjs');
5
+ require('./api-BVXbJ3M_.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-hgzFUi7o.cjs');
4
+ var persistence = require('./api-BVXbJ3M_.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-ythl_OD6.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-BBD69Ds-.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-ythl_OD6.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-BBD69Ds-.cjs', document.baseURI).href))));
641
641
  function projectPath() {
642
642
  const path = path$1.resolve(__dirname$2, "..");
643
643
  return path;
@@ -727,7 +727,8 @@ function runWindowsProcessSnapshotQuery(command) {
727
727
  ],
728
728
  {
729
729
  stdio: "pipe",
730
- maxBuffer: WINDOWS_PROCESS_QUERY_MAX_BUFFER_BYTES
730
+ maxBuffer: WINDOWS_PROCESS_QUERY_MAX_BUFFER_BYTES,
731
+ windowsHide: true
731
732
  }
732
733
  );
733
734
  if (result.error || result.status !== 0) {
@@ -857,7 +858,7 @@ async function killRunawayHappyProcesses() {
857
858
  try {
858
859
  console.log(`Killing runaway process PID ${pid}: ${command}`);
859
860
  if (process.platform === "win32") {
860
- const result = spawn.sync("taskkill", ["/F", "/PID", pid.toString()], { stdio: "pipe" });
861
+ const result = spawn.sync("taskkill", ["/F", "/PID", pid.toString()], { stdio: "pipe", windowsHide: true });
861
862
  if (result.error) throw result.error;
862
863
  if (result.status !== 0) throw new Error(`taskkill exited with code ${result.status}`);
863
864
  } else {
@@ -1000,7 +1001,7 @@ async function killOrphanDaemonProcesses() {
1000
1001
  for (const proc of orphanDaemons) {
1001
1002
  try {
1002
1003
  if (process.platform === "win32") {
1003
- node_child_process.execFileSync("taskkill", ["/F", "/PID", proc.pid.toString()], { stdio: "ignore" });
1004
+ node_child_process.execFileSync("taskkill", ["/F", "/PID", proc.pid.toString()], { stdio: "ignore", windowsHide: true });
1004
1005
  } else {
1005
1006
  process.kill(proc.pid, "SIGKILL");
1006
1007
  }
@@ -5600,7 +5601,8 @@ async function claudeLocal(opts) {
5600
5601
  stdio: ["inherit", "inherit", "inherit", "pipe"],
5601
5602
  signal: opts.abort,
5602
5603
  cwd: opts.path,
5603
- env
5604
+ env,
5605
+ windowsHide: true
5604
5606
  });
5605
5607
  if (child.stdio[3]) {
5606
5608
  const rl = node_readline.createInterface({
@@ -6495,8 +6497,8 @@ const cursorTransport = new CursorTransport();
6495
6497
 
6496
6498
  const DEFAULT_IDLE_TIMEOUT_MS = 500;
6497
6499
  const DEFAULT_TOOL_CALL_TIMEOUT_MS = 10 * 6e4;
6498
- const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_HEAD_BYTES = 2e3;
6499
- const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_TAIL_BYTES = 4e3;
6500
+ const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_HEAD_BYTES = 4096;
6501
+ const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_TAIL_BYTES = 12288;
6500
6502
  function parseArgsFromContent(content) {
6501
6503
  if (Array.isArray(content)) {
6502
6504
  return { items: content };
@@ -7103,6 +7105,7 @@ function buildAcpSpawnSpec(params) {
7103
7105
  }
7104
7106
 
7105
7107
  const MAX_DROPPED_LINE_PREVIEW_CHARS = 4096;
7108
+ const DEFAULT_ACP_MAX_MULTILINE_STDOUT_BYTES = 128 * 1024;
7106
7109
  function formatDroppedLinePreview(line) {
7107
7110
  if (line.length <= MAX_DROPPED_LINE_PREVIEW_CHARS) {
7108
7111
  return line;
@@ -7115,7 +7118,7 @@ function formatDroppedLinePreview(line) {
7115
7118
  ${line.slice(-tailChars)}`;
7116
7119
  }
7117
7120
  function createAcpFilteredStdoutReadable(params) {
7118
- const maxMultilineBytes = typeof params.maxMultilineBytes === "number" && Number.isFinite(params.maxMultilineBytes) && params.maxMultilineBytes > 0 ? Math.trunc(params.maxMultilineBytes) : 1e6;
7121
+ const maxMultilineBytes = typeof params.maxMultilineBytes === "number" && Number.isFinite(params.maxMultilineBytes) && params.maxMultilineBytes > 0 ? Math.trunc(params.maxMultilineBytes) : DEFAULT_ACP_MAX_MULTILINE_STDOUT_BYTES;
7119
7122
  const encoder = new TextEncoder();
7120
7123
  return new ReadableStream({
7121
7124
  async start(controller) {
@@ -7461,6 +7464,17 @@ function appendDroppedStdoutLineSummary(summary, entry) {
7461
7464
  }
7462
7465
  }
7463
7466
  function nodeToWebStreams(stdin, stdout) {
7467
+ const isIgnorableStdinPipeError = (error) => {
7468
+ const code = typeof error === "object" && error !== null ? error.code : void 0;
7469
+ return code === "ERR_STREAM_DESTROYED" || code === "EPIPE";
7470
+ };
7471
+ stdin.on("error", (err) => {
7472
+ if (isIgnorableStdinPipeError(err)) {
7473
+ persistence.logger.debug("[AcpBackend] Ignoring stdin pipe error:", err);
7474
+ return;
7475
+ }
7476
+ persistence.logger.debug("[AcpBackend] Stdin error:", err);
7477
+ });
7464
7478
  const writable = new WritableStream({
7465
7479
  write(chunk) {
7466
7480
  return new Promise((resolve, reject) => {
@@ -7470,7 +7484,7 @@ function nodeToWebStreams(stdin, stdout) {
7470
7484
  }
7471
7485
  const ok = stdin.write(chunk, (err) => {
7472
7486
  if (err) {
7473
- if (err.code === "ERR_STREAM_DESTROYED") {
7487
+ if (isIgnorableStdinPipeError(err)) {
7474
7488
  resolve();
7475
7489
  return;
7476
7490
  }
@@ -7491,7 +7505,34 @@ function nodeToWebStreams(stdin, stdout) {
7491
7505
  resolve();
7492
7506
  return;
7493
7507
  }
7494
- stdin.end(resolve);
7508
+ let settled = false;
7509
+ const settle = () => {
7510
+ if (settled) {
7511
+ return;
7512
+ }
7513
+ settled = true;
7514
+ stdin.off("close", settle);
7515
+ stdin.off("finish", settle);
7516
+ stdin.off("error", handleError);
7517
+ resolve();
7518
+ };
7519
+ const handleError = (err) => {
7520
+ if (!isIgnorableStdinPipeError(err)) {
7521
+ persistence.logger.debug("[AcpBackend] Error ending stdin:", err);
7522
+ }
7523
+ settle();
7524
+ };
7525
+ stdin.once("close", settle);
7526
+ stdin.once("finish", settle);
7527
+ stdin.once("error", handleError);
7528
+ try {
7529
+ stdin.end(() => settle());
7530
+ } catch (error) {
7531
+ if (!isIgnorableStdinPipeError(error)) {
7532
+ persistence.logger.debug("[AcpBackend] Error closing stdin:", error);
7533
+ }
7534
+ settle();
7535
+ }
7495
7536
  });
7496
7537
  },
7497
7538
  abort(reason) {
@@ -8718,7 +8759,8 @@ ${recentStderrExcerpt}`);
8718
8759
  kind: "rejected",
8719
8760
  error: createAcpAbortError("ACP backend disposed")
8720
8761
  });
8721
- if (this.connection && this.acpSessionId) {
8762
+ const processStillRunning = this.process ? this.process.exitCode === null && this.process.signalCode === null : false;
8763
+ if (this.connection && this.acpSessionId && processStillRunning) {
8722
8764
  try {
8723
8765
  await Promise.race([
8724
8766
  this.connection.cancel({ sessionId: this.acpSessionId }),
@@ -8728,6 +8770,8 @@ ${recentStderrExcerpt}`);
8728
8770
  } catch (error) {
8729
8771
  persistence.logger.debug("[AcpBackend] Error during graceful shutdown:", error);
8730
8772
  }
8773
+ } else if (this.connection && this.acpSessionId && this.process && !processStillRunning) {
8774
+ persistence.logger.debug("[AcpBackend] Skipping graceful shutdown because ACP process already exited");
8731
8775
  }
8732
8776
  if (this.process) {
8733
8777
  try {
@@ -8806,7 +8850,8 @@ function readGeminiLocalConfig() {
8806
8850
  const gcloudToken = child_process.execSync("gcloud auth application-default print-access-token", {
8807
8851
  encoding: "utf8",
8808
8852
  stdio: ["ignore", "pipe", "ignore"],
8809
- timeout: 5e3
8853
+ timeout: 5e3,
8854
+ windowsHide: true
8810
8855
  }).trim();
8811
8856
  if (gcloudToken && gcloudToken.length > 0) {
8812
8857
  token = gcloudToken;
@@ -9652,7 +9697,7 @@ class AbortError extends Error {
9652
9697
  }
9653
9698
  }
9654
9699
 
9655
- 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-ythl_OD6.cjs', document.baseURI).href)));
9700
+ 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-BBD69Ds-.cjs', document.baseURI).href)));
9656
9701
  const __dirname$1 = path.join(__filename$1, "..");
9657
9702
  function getGlobalClaudeVersion() {
9658
9703
  try {
@@ -9661,7 +9706,8 @@ function getGlobalClaudeVersion() {
9661
9706
  encoding: "utf8",
9662
9707
  stdio: ["pipe", "pipe", "pipe"],
9663
9708
  cwd: os.homedir(),
9664
- env: cleanEnv
9709
+ env: cleanEnv,
9710
+ windowsHide: true
9665
9711
  }).trim();
9666
9712
  const match = output.match(/(\d+\.\d+\.\d+)/);
9667
9713
  persistence.logger.debug(`[Claude SDK] Global claude --version output: ${output}`);
@@ -9703,7 +9749,8 @@ function findGlobalClaudePath() {
9703
9749
  encoding: "utf8",
9704
9750
  stdio: ["pipe", "pipe", "pipe"],
9705
9751
  cwd: homeDir,
9706
- env: cleanEnv
9752
+ env: cleanEnv,
9753
+ windowsHide: true
9707
9754
  });
9708
9755
  persistence.logger.debug("[Claude SDK] Global claude command available (checked with clean PATH)");
9709
9756
  return "claude";
@@ -9715,7 +9762,8 @@ function findGlobalClaudePath() {
9715
9762
  encoding: "utf8",
9716
9763
  stdio: ["pipe", "pipe", "pipe"],
9717
9764
  cwd: homeDir,
9718
- env: cleanEnv
9765
+ env: cleanEnv,
9766
+ windowsHide: true
9719
9767
  }).trim();
9720
9768
  if (result && fs.existsSync(result)) {
9721
9769
  persistence.logger.debug(`[Claude SDK] Found global claude path via which: ${result}`);
@@ -10054,7 +10102,8 @@ function query(config) {
10054
10102
  signal: config.options?.abort,
10055
10103
  env: spawnEnv,
10056
10104
  // Use shell on Windows for global binaries and command-only mode
10057
- shell: !isJsFile && process.platform === "win32"
10105
+ shell: !isJsFile && process.platform === "win32",
10106
+ windowsHide: true
10058
10107
  });
10059
10108
  let childStdin = null;
10060
10109
  if (typeof prompt === "string") {
@@ -10971,14 +11020,14 @@ var launch = /*#__PURE__*/Object.freeze({
10971
11020
  const unifiedProviderExecutors = {
10972
11021
  claude: async (opts) => {
10973
11022
  const claudeOptions = opts.claudeOptions ?? {};
10974
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-BUi2fgRI.cjs'); });
11023
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-DU69fser.cjs'); });
10975
11024
  await runClaude(opts.credentials, {
10976
11025
  ...claudeOptions,
10977
11026
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
10978
11027
  });
10979
11028
  },
10980
11029
  codex: async (opts) => {
10981
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-vO3-iZ8E.cjs'); });
11030
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-DFH1tiGD.cjs'); });
10982
11031
  await runCodex({
10983
11032
  credentials: opts.credentials,
10984
11033
  startedBy: opts.startedBy,
@@ -10987,7 +11036,7 @@ const unifiedProviderExecutors = {
10987
11036
  });
10988
11037
  },
10989
11038
  gemini: async (opts) => {
10990
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-DIKiIVdN.cjs'); });
11039
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-QTOE7LXy.cjs'); });
10991
11040
  await runGemini({
10992
11041
  credentials: opts.credentials,
10993
11042
  startedBy: opts.startedBy
@@ -11070,7 +11119,7 @@ function shouldRunMainClaudeFlow(opts) {
11070
11119
  return;
11071
11120
  } else if (subcommand === "runtime") {
11072
11121
  if (args[1] === "providers") {
11073
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-Dh8sawXu.cjs'); });
11122
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-CKw7FVJ3.cjs'); });
11074
11123
  console.log(renderRuntimeProviders());
11075
11124
  return;
11076
11125
  }
@@ -11276,8 +11325,8 @@ function shouldRunMainClaudeFlow(opts) {
11276
11325
  const projectId = args[3];
11277
11326
  try {
11278
11327
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
11279
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-hgzFUi7o.cjs'); }).then(function (n) { return n.persistence; });
11280
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-hgzFUi7o.cjs'); }).then(function (n) { return n.api; });
11328
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-BVXbJ3M_.cjs'); }).then(function (n) { return n.persistence; });
11329
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-BVXbJ3M_.cjs'); }).then(function (n) { return n.api; });
11281
11330
  let userEmail = void 0;
11282
11331
  try {
11283
11332
  const credentials = await readCredentials2();
@@ -11598,7 +11647,7 @@ ${chalk.gray("\u2500".repeat(60))}
11598
11647
  ${chalk.bold.cyan("Claude Code Options (from `claude --help`):")}
11599
11648
  `);
11600
11649
  try {
11601
- const claudeHelp = node_child_process.execFileSync(claudeCliPath, ["--help"], { encoding: "utf8" });
11650
+ const claudeHelp = node_child_process.execFileSync(claudeCliPath, ["--help"], { encoding: "utf8", windowsHide: true });
11602
11651
  console.log(claudeHelp);
11603
11652
  } catch (e) {
11604
11653
  console.log(chalk.yellow("Could not retrieve claude help. Make sure claude is installed."));