happy-imou-cloud 2.0.5 → 2.0.6

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 (24) hide show
  1. package/dist/{BaseReasoningProcessor-bFVTvf3Q.mjs → BaseReasoningProcessor-1EzrE03x.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-DPVZIJ4n.cjs → BaseReasoningProcessor-BMyfwx3p.cjs} +2 -2
  3. package/dist/{api-DaqnNHfl.cjs → api-DccDghmF.cjs} +3 -3
  4. package/dist/{api-DoHt-HyL.mjs → api-Emo3rSZH.mjs} +3 -3
  5. package/dist/{command-D9-hmqVq.cjs → command-C2v0VkPq.cjs} +3 -3
  6. package/dist/{command-Dl9SrMnv.mjs → command-D8Zz6B4t.mjs} +3 -3
  7. package/dist/{index-Dc92gnxM.cjs → index-Buq7nurH.cjs} +235 -92
  8. package/dist/{index-C5wR2qKT.mjs → index-Dh8UTgm4.mjs} +233 -90
  9. package/dist/index.cjs +5 -5
  10. package/dist/index.mjs +5 -5
  11. package/dist/lib.cjs +1 -1
  12. package/dist/lib.mjs +1 -1
  13. package/dist/{persistence-QqeBvUxX.mjs → persistence-Blm1hTQA.mjs} +1 -1
  14. package/dist/{persistence-D6Y0604_.cjs → persistence-BrTyBuT7.cjs} +1 -1
  15. package/dist/{registerKillSessionHandler-CC9zGBPE.mjs → registerKillSessionHandler-Bm7E-03E.mjs} +2 -2
  16. package/dist/{registerKillSessionHandler-C6yXr8ky.cjs → registerKillSessionHandler-EFAsOnR_.cjs} +2 -2
  17. package/dist/{runClaude-gHKFB1UG.cjs → runClaude-COy1pLhn.cjs} +5 -5
  18. package/dist/{runClaude-CZ8gxaJL.mjs → runClaude-CwA5UCO-.mjs} +4 -4
  19. package/dist/{runCodex-CdjzG1N7.cjs → runCodex-BRMOT2dJ.cjs} +5 -5
  20. package/dist/{runCodex-DT7g4MPm.mjs → runCodex-DTPmqCyS.mjs} +5 -5
  21. package/dist/{runGemini-DxjvRmOc.cjs → runGemini-BVPmTGxQ.cjs} +5 -5
  22. package/dist/{runGemini-CmY5386l.mjs → runGemini-DDSR8BtO.mjs} +5 -5
  23. package/package.json +2 -2
  24. package/scripts/release-smoke.mjs +4 -0
@@ -1,7 +1,7 @@
1
1
  import os from 'node:os';
2
2
  import { resolve } from 'node:path';
3
- import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-DoHt-HyL.mjs';
4
- import { p as projectPath } from './index-C5wR2qKT.mjs';
3
+ import { c as configuration, p as packageJson, s as startOfflineReconnection, l as logger } from './api-Emo3rSZH.mjs';
4
+ import { p as projectPath } from './index-Dh8UTgm4.mjs';
5
5
  import { EventEmitter } from 'node:events';
6
6
  import { randomUUID } from 'node:crypto';
7
7
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  var os = require('node:os');
4
4
  var node_path = require('node:path');
5
- var api = require('./api-DaqnNHfl.cjs');
6
- var index = require('./index-Dc92gnxM.cjs');
5
+ var api = require('./api-DccDghmF.cjs');
6
+ var index = require('./index-Buq7nurH.cjs');
7
7
  var node_events = require('node:events');
8
8
  var node_crypto = require('node:crypto');
9
9
 
@@ -19,7 +19,7 @@ var path = require('path');
19
19
  var expoServerSdk = require('expo-server-sdk');
20
20
 
21
21
  var name = "happy-imou-cloud";
22
- var version = "2.0.5";
22
+ var version = "2.0.6";
23
23
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
24
24
  var author = "long.zhu";
25
25
  var license = "MIT";
@@ -78,7 +78,7 @@ var scripts = {
78
78
  "dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
79
79
  "dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
80
80
  "// ==== Release ====": "",
81
- prepublishOnly: "npm run build",
81
+ prepublishOnly: "yarn release:smoke",
82
82
  release: "yarn install && release-it",
83
83
  "release:smoke": "node ./scripts/release-smoke.mjs",
84
84
  "// ==== Dev/Stable Variant Management ====": "",
@@ -433,7 +433,7 @@ async function listDaemonLogFiles(limit = 50) {
433
433
  return { file, path: fullPath, modified: stats.mtime };
434
434
  }).sort((a, b) => b.modified.getTime() - a.modified.getTime());
435
435
  try {
436
- const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-D6Y0604_.cjs'); });
436
+ const { readDaemonState } = await Promise.resolve().then(function () { return require('./persistence-BrTyBuT7.cjs'); });
437
437
  const state = await readDaemonState();
438
438
  if (!state) {
439
439
  return logs;
@@ -17,7 +17,7 @@ import { resolve, join as join$1 } from 'path';
17
17
  import { Expo } from 'expo-server-sdk';
18
18
 
19
19
  var name = "happy-imou-cloud";
20
- var version = "2.0.5";
20
+ var version = "2.0.6";
21
21
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
22
22
  var author = "long.zhu";
23
23
  var license = "MIT";
@@ -76,7 +76,7 @@ var scripts = {
76
76
  "dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
77
77
  "dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
78
78
  "// ==== Release ====": "",
79
- prepublishOnly: "npm run build",
79
+ prepublishOnly: "yarn release:smoke",
80
80
  release: "yarn install && release-it",
81
81
  "release:smoke": "node ./scripts/release-smoke.mjs",
82
82
  "// ==== Dev/Stable Variant Management ====": "",
@@ -431,7 +431,7 @@ async function listDaemonLogFiles(limit = 50) {
431
431
  return { file, path: fullPath, modified: stats.mtime };
432
432
  }).sort((a, b) => b.modified.getTime() - a.modified.getTime());
433
433
  try {
434
- const { readDaemonState } = await import('./persistence-QqeBvUxX.mjs');
434
+ const { readDaemonState } = await import('./persistence-Blm1hTQA.mjs');
435
435
  const state = await readDaemonState();
436
436
  if (!state) {
437
437
  return logs;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Dc92gnxM.cjs');
3
+ var index = require('./index-Buq7nurH.cjs');
4
4
  require('chalk');
5
- require('./api-DaqnNHfl.cjs');
5
+ require('./api-DccDghmF.cjs');
6
6
  require('axios');
7
7
  require('fs');
8
8
  require('node:fs');
@@ -19,7 +19,7 @@ require('fs/promises');
19
19
  require('crypto');
20
20
  require('path');
21
21
  require('expo-server-sdk');
22
- require('./persistence-D6Y0604_.cjs');
22
+ require('./persistence-BrTyBuT7.cjs');
23
23
  require('node:fs/promises');
24
24
  require('os');
25
25
  require('tmp');
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-C5wR2qKT.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-Dh8UTgm4.mjs';
2
2
  import 'chalk';
3
- import './api-DoHt-HyL.mjs';
3
+ import './api-Emo3rSZH.mjs';
4
4
  import 'axios';
5
5
  import 'fs';
6
6
  import 'node:fs';
@@ -17,7 +17,7 @@ import 'fs/promises';
17
17
  import 'crypto';
18
18
  import 'path';
19
19
  import 'expo-server-sdk';
20
- import './persistence-QqeBvUxX.mjs';
20
+ import './persistence-Blm1hTQA.mjs';
21
21
  import 'node:fs/promises';
22
22
  import 'os';
23
23
  import 'tmp';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var api = require('./api-DaqnNHfl.cjs');
5
- var persistence = require('./persistence-D6Y0604_.cjs');
4
+ var api = require('./api-DccDghmF.cjs');
5
+ var persistence = require('./persistence-BrTyBuT7.cjs');
6
6
  var z = require('zod');
7
7
  var fs$1 = require('fs/promises');
8
8
  var os$1 = require('os');
@@ -70,7 +70,7 @@ async function openBrowser(url) {
70
70
  }
71
71
  }
72
72
 
73
- 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-Dc92gnxM.cjs', document.baseURI).href)));
73
+ 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-Buq7nurH.cjs', document.baseURI).href)));
74
74
  const QRCode = require$1("qrcode-terminal/vendor/QRCode");
75
75
  const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
76
76
  const pendingTempFiles = /* @__PURE__ */ new Set();
@@ -693,7 +693,7 @@ function setupCleanupHandlers() {
693
693
  });
694
694
  }
695
695
 
696
- const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Dc92gnxM.cjs', document.baseURI).href))));
696
+ const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Buq7nurH.cjs', document.baseURI).href))));
697
697
  function projectPath() {
698
698
  const path$1 = path.resolve(__dirname$1, "..");
699
699
  return path$1;
@@ -4928,6 +4928,205 @@ function handleThinkingUpdate(update, ctx) {
4928
4928
  return { handled: true };
4929
4929
  }
4930
4930
 
4931
+ function buildAcpSpawnSpec(params) {
4932
+ return {
4933
+ command: params.command,
4934
+ args: (params.args ?? []).map((arg) => String(arg)),
4935
+ options: {
4936
+ cwd: params.cwd,
4937
+ env: params.env,
4938
+ stdio: ["pipe", "pipe", "pipe"],
4939
+ windowsHide: process.platform === "win32"
4940
+ }
4941
+ };
4942
+ }
4943
+
4944
+ function createAcpFilteredStdoutReadable(params) {
4945
+ const maxMultilineBytes = typeof params.maxMultilineBytes === "number" && Number.isFinite(params.maxMultilineBytes) && params.maxMultilineBytes > 0 ? Math.trunc(params.maxMultilineBytes) : 1e6;
4946
+ const decoder = new TextDecoder();
4947
+ const encoder = new TextEncoder();
4948
+ return new ReadableStream({
4949
+ async start(controller) {
4950
+ const reader = params.readable.getReader();
4951
+ let buffer = "";
4952
+ let multiline = null;
4953
+ let controllerErrored = false;
4954
+ const drop = (reason, line) => {
4955
+ params.onDroppedLine?.({ reason, line });
4956
+ };
4957
+ const enqueueLine = (line) => {
4958
+ if (!line.trim()) {
4959
+ return;
4960
+ }
4961
+ const filtered = params.transport.filterStdoutLine?.(line);
4962
+ if (filtered === void 0) {
4963
+ controller.enqueue(encoder.encode(line + "\n"));
4964
+ return;
4965
+ }
4966
+ if (filtered === null) {
4967
+ drop("transport_filter_null", line);
4968
+ return;
4969
+ }
4970
+ controller.enqueue(encoder.encode(filtered + "\n"));
4971
+ };
4972
+ const tryFlushMultiline = (candidate) => {
4973
+ const trimmed = candidate.trim();
4974
+ if (!trimmed) {
4975
+ return false;
4976
+ }
4977
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
4978
+ return false;
4979
+ }
4980
+ try {
4981
+ const parsed = JSON.parse(trimmed);
4982
+ if (typeof parsed !== "object" || parsed === null) {
4983
+ return false;
4984
+ }
4985
+ enqueueLine(JSON.stringify(parsed));
4986
+ return true;
4987
+ } catch {
4988
+ return false;
4989
+ }
4990
+ };
4991
+ try {
4992
+ while (true) {
4993
+ const { value, done } = await reader.read();
4994
+ if (done) {
4995
+ break;
4996
+ }
4997
+ if (!value) {
4998
+ continue;
4999
+ }
5000
+ buffer += decoder.decode(value, { stream: true });
5001
+ const lines = buffer.split("\n");
5002
+ buffer = lines.pop() || "";
5003
+ for (const line of lines) {
5004
+ if (multiline) {
5005
+ const nextBuf = multiline.buf.length > 0 ? `${multiline.buf}
5006
+ ${line}` : line;
5007
+ const nextBytes = multiline.bytes + line.length + 1;
5008
+ if (nextBytes > maxMultilineBytes) {
5009
+ drop("multiline_overflow", multiline.buf);
5010
+ multiline = null;
5011
+ enqueueLine(line);
5012
+ continue;
5013
+ }
5014
+ multiline = { buf: nextBuf, bytes: nextBytes };
5015
+ if (tryFlushMultiline(multiline.buf)) {
5016
+ multiline = null;
5017
+ }
5018
+ continue;
5019
+ }
5020
+ const trimmed = line.trim();
5021
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
5022
+ try {
5023
+ const parsed = JSON.parse(trimmed);
5024
+ if (typeof parsed === "object" && parsed !== null) {
5025
+ enqueueLine(line);
5026
+ continue;
5027
+ }
5028
+ } catch {
5029
+ multiline = { buf: line, bytes: line.length };
5030
+ continue;
5031
+ }
5032
+ }
5033
+ enqueueLine(line);
5034
+ }
5035
+ }
5036
+ if (multiline) {
5037
+ if (!tryFlushMultiline(multiline.buf)) {
5038
+ drop("multiline_incomplete", multiline.buf);
5039
+ }
5040
+ multiline = null;
5041
+ }
5042
+ const trailing = buffer.trim();
5043
+ if (trailing) {
5044
+ drop("multiline_incomplete", buffer);
5045
+ }
5046
+ } catch (error) {
5047
+ controllerErrored = true;
5048
+ controller.error(error);
5049
+ } finally {
5050
+ reader.releaseLock();
5051
+ if (!controllerErrored) {
5052
+ controller.close();
5053
+ }
5054
+ }
5055
+ }
5056
+ });
5057
+ }
5058
+
5059
+ function isAlive(pid) {
5060
+ try {
5061
+ process.kill(pid, 0);
5062
+ return true;
5063
+ } catch {
5064
+ return false;
5065
+ }
5066
+ }
5067
+ async function resolveDescendantPids(rootPid) {
5068
+ const processes = await psList();
5069
+ const childrenByParent = /* @__PURE__ */ new Map();
5070
+ for (const proc of processes) {
5071
+ if (typeof proc.pid !== "number" || typeof proc.ppid !== "number") {
5072
+ continue;
5073
+ }
5074
+ const children = childrenByParent.get(proc.ppid) ?? [];
5075
+ children.push(proc.pid);
5076
+ childrenByParent.set(proc.ppid, children);
5077
+ }
5078
+ const descendants = [];
5079
+ const seen = /* @__PURE__ */ new Set();
5080
+ const visit = (pid) => {
5081
+ for (const childPid of childrenByParent.get(pid) ?? []) {
5082
+ if (seen.has(childPid)) {
5083
+ continue;
5084
+ }
5085
+ seen.add(childPid);
5086
+ visit(childPid);
5087
+ descendants.push(childPid);
5088
+ }
5089
+ };
5090
+ visit(rootPid);
5091
+ return descendants;
5092
+ }
5093
+ function bestEffortKillPid(pid, signal) {
5094
+ try {
5095
+ process.kill(pid, signal);
5096
+ } catch {
5097
+ }
5098
+ }
5099
+ async function waitForAllGone(pids, timeoutMs) {
5100
+ const start = Date.now();
5101
+ while (Date.now() - start < timeoutMs) {
5102
+ if (pids.every((pid) => !isAlive(pid))) {
5103
+ return;
5104
+ }
5105
+ await new Promise((resolve) => setTimeout(resolve, 25));
5106
+ }
5107
+ }
5108
+ async function killProcessTree(proc, options) {
5109
+ const pid = proc.pid;
5110
+ if (!pid) {
5111
+ return;
5112
+ }
5113
+ const graceMs = Math.max(1, options?.graceMs);
5114
+ const descendants = await resolveDescendantPids(pid).catch(() => []);
5115
+ const allPids = [...descendants, pid];
5116
+ for (const targetPid of allPids) {
5117
+ bestEffortKillPid(targetPid, "SIGTERM");
5118
+ }
5119
+ await waitForAllGone(allPids, graceMs);
5120
+ const remaining = allPids.filter((targetPid) => isAlive(targetPid));
5121
+ if (remaining.length === 0) {
5122
+ return;
5123
+ }
5124
+ for (const targetPid of remaining) {
5125
+ bestEffortKillPid(targetPid, "SIGKILL");
5126
+ }
5127
+ await waitForAllGone(remaining, Math.min(250, graceMs));
5128
+ }
5129
+
4931
5130
  const RETRY_CONFIG = {
4932
5131
  /** Maximum number of retry attempts for init/newSession */
4933
5132
  maxAttempts: 3,
@@ -5316,24 +5515,13 @@ class AcpBackend {
5316
5515
  try {
5317
5516
  api.logger.debug(`[AcpBackend] Starting session: ${sessionId}`);
5318
5517
  this.recentStderrLines = [];
5319
- const args = this.options.args || [];
5320
- if (process.platform === "win32") {
5321
- const fullCommand = [this.options.command, ...args].join(" ");
5322
- this.process = node_child_process.spawn("cmd.exe", ["/c", fullCommand], {
5323
- cwd: this.options.cwd,
5324
- env: { ...process.env, ...this.options.env },
5325
- stdio: ["pipe", "pipe", "pipe"],
5326
- windowsHide: true
5327
- });
5328
- } else {
5329
- this.process = node_child_process.spawn(this.options.command, args, {
5330
- cwd: this.options.cwd,
5331
- env: { ...process.env, ...this.options.env },
5332
- // Use 'pipe' for all stdio to capture output without printing to console
5333
- // stdout and stderr will be handled by our event listeners
5334
- stdio: ["pipe", "pipe", "pipe"]
5335
- });
5336
- }
5518
+ const spawnSpec = buildAcpSpawnSpec({
5519
+ command: this.options.command,
5520
+ args: this.options.args ?? [],
5521
+ cwd: this.options.cwd,
5522
+ env: { ...process.env, ...this.options.env }
5523
+ });
5524
+ this.process = spawn(spawnSpec.command, spawnSpec.args, spawnSpec.options);
5337
5525
  if (this.process.stderr) {
5338
5526
  }
5339
5527
  if (!this.process.stdin || !this.process.stdout || !this.process.stderr) {
@@ -5381,57 +5569,20 @@ class AcpBackend {
5381
5569
  );
5382
5570
  const writable = streams.writable;
5383
5571
  const readable = streams.readable;
5384
- const transport = this.transport;
5385
- const filteredReadable = new ReadableStream({
5386
- async start(controller) {
5387
- const reader = readable.getReader();
5388
- const decoder = new TextDecoder();
5389
- const encoder = new TextEncoder();
5390
- let buffer = "";
5391
- let filteredCount = 0;
5392
- try {
5393
- while (true) {
5394
- const { done, value } = await reader.read();
5395
- if (done) {
5396
- if (buffer.trim()) {
5397
- const filtered = transport.filterStdoutLine?.(buffer);
5398
- if (filtered === void 0) {
5399
- controller.enqueue(encoder.encode(buffer));
5400
- } else if (filtered !== null) {
5401
- controller.enqueue(encoder.encode(filtered));
5402
- } else {
5403
- filteredCount++;
5404
- }
5405
- }
5406
- if (filteredCount > 0) {
5407
- api.logger.debug(`[AcpBackend] Filtered out ${filteredCount} non-JSON lines from ${transport.agentName} stdout`);
5408
- }
5409
- controller.close();
5410
- break;
5411
- }
5412
- buffer += decoder.decode(value, { stream: true });
5413
- const lines = buffer.split("\n");
5414
- buffer = lines.pop() || "";
5415
- for (const line of lines) {
5416
- if (!line.trim()) continue;
5417
- const filtered = transport.filterStdoutLine?.(line);
5418
- if (filtered === void 0) {
5419
- controller.enqueue(encoder.encode(line + "\n"));
5420
- } else if (filtered !== null) {
5421
- controller.enqueue(encoder.encode(filtered + "\n"));
5422
- } else {
5423
- filteredCount++;
5424
- }
5425
- }
5426
- }
5427
- } catch (error) {
5428
- api.logger.debug(`[AcpBackend] Error filtering stdout stream:`, error);
5429
- controller.error(error);
5430
- } finally {
5431
- reader.releaseLock();
5432
- }
5572
+ const droppedStdoutLines = [];
5573
+ const filteredReadable = createAcpFilteredStdoutReadable({
5574
+ readable,
5575
+ transport: this.transport,
5576
+ onDroppedLine: (entry) => {
5577
+ droppedStdoutLines.push(entry);
5433
5578
  }
5434
5579
  });
5580
+ if (droppedStdoutLines.length > 0) {
5581
+ api.logger.debug(
5582
+ `[AcpBackend] Filtered out ${droppedStdoutLines.length} stdout lines from ${this.transport.agentName}`,
5583
+ droppedStdoutLines.slice(0, 5)
5584
+ );
5585
+ }
5435
5586
  const stream = sdk.ndJsonStream(writable, filteredReadable);
5436
5587
  const client = {
5437
5588
  sessionUpdate: async (params) => {
@@ -5959,21 +6110,13 @@ class AcpBackend {
5959
6110
  }
5960
6111
  }
5961
6112
  if (this.process) {
5962
- this.process.kill("SIGTERM");
5963
- await new Promise((resolve) => {
5964
- const timeout = setTimeout(() => {
5965
- if (this.process) {
5966
- api.logger.debug("[AcpBackend] Force killing process");
5967
- this.process.kill("SIGKILL");
5968
- }
5969
- resolve();
5970
- }, 1e3);
5971
- this.process?.once("exit", () => {
5972
- clearTimeout(timeout);
5973
- resolve();
5974
- });
5975
- });
5976
- this.process = null;
6113
+ try {
6114
+ await killProcessTree(this.process, { graceMs: 1e3 });
6115
+ } catch (error) {
6116
+ api.logger.debug("[AcpBackend] Failed to kill ACP process tree:", error);
6117
+ } finally {
6118
+ this.process = null;
6119
+ }
5977
6120
  }
5978
6121
  this.clearIdleTimeoutState();
5979
6122
  this.listeners = [];
@@ -6625,12 +6768,12 @@ async function ensureUnifiedDaemonStarted() {
6625
6768
  async function executeUnifiedProvider(opts) {
6626
6769
  const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
6627
6770
  if (opts.provider === "claude") {
6628
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-gHKFB1UG.cjs'); });
6771
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-COy1pLhn.cjs'); });
6629
6772
  await runClaude(credentials, opts.claudeOptions ?? {});
6630
6773
  return;
6631
6774
  }
6632
6775
  if (opts.provider === "codex") {
6633
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CdjzG1N7.cjs'); });
6776
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BRMOT2dJ.cjs'); });
6634
6777
  await runCodex({
6635
6778
  credentials,
6636
6779
  startedBy: opts.startedBy,
@@ -6640,7 +6783,7 @@ async function executeUnifiedProvider(opts) {
6640
6783
  return;
6641
6784
  }
6642
6785
  if (opts.provider === "gemini") {
6643
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-DxjvRmOc.cjs'); });
6786
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BVPmTGxQ.cjs'); });
6644
6787
  await runGemini({
6645
6788
  credentials,
6646
6789
  startedBy: opts.startedBy
@@ -6682,7 +6825,7 @@ function shouldRunMainClaudeFlow(opts) {
6682
6825
  return;
6683
6826
  } else if (subcommand === "runtime") {
6684
6827
  if (args[1] === "providers") {
6685
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-D9-hmqVq.cjs'); });
6828
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-C2v0VkPq.cjs'); });
6686
6829
  console.log(renderRuntimeProviders());
6687
6830
  return;
6688
6831
  }
@@ -6860,8 +7003,8 @@ function shouldRunMainClaudeFlow(opts) {
6860
7003
  const projectId = args[3];
6861
7004
  try {
6862
7005
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
6863
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-D6Y0604_.cjs'); });
6864
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-DaqnNHfl.cjs'); }).then(function (n) { return n.api; });
7006
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-BrTyBuT7.cjs'); });
7007
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-DccDghmF.cjs'); }).then(function (n) { return n.api; });
6865
7008
  let userEmail = void 0;
6866
7009
  try {
6867
7010
  const credentials = await readCredentials2();
@@ -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, h as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, j as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, k as encodeBase64Url, f as delay, m as buildClientHeaders, n as decodeBase64, H as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, o as getLatestDaemonLog } from './api-DoHt-HyL.mjs';
3
- import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-QqeBvUxX.mjs';
2
+ import { l as logger, e as encodeBase64, c as configuration, h as buildAuthenticatedHeaders, S as SigningBootstrapRequiredError, j as SIGNING_BOOTSTRAP_REQUIRED_MESSAGE, k as encodeBase64Url, f as delay, m as buildClientHeaders, n as decodeBase64, H as HAPPY_CLOUD_DAEMON_PORT, p as packageJson, A as ApiClient, o as getLatestDaemonLog } from './api-Emo3rSZH.mjs';
3
+ import { writeCredentialsLegacy, writeCredentialsDataKey, readCredentials, readSettings, updateSettings, readDaemonState, clearDaemonState, acquireDaemonLock, writeDaemonState, releaseDaemonLock, validateProfileForAgent, getProfileEnvironmentVariables, clearCredentials, clearMachineId } from './persistence-Blm1hTQA.mjs';
4
4
  import { z } from 'zod';
5
5
  import fs from 'fs/promises';
6
6
  import os, { homedir } from 'os';
@@ -4906,6 +4906,205 @@ function handleThinkingUpdate(update, ctx) {
4906
4906
  return { handled: true };
4907
4907
  }
4908
4908
 
4909
+ function buildAcpSpawnSpec(params) {
4910
+ return {
4911
+ command: params.command,
4912
+ args: (params.args ?? []).map((arg) => String(arg)),
4913
+ options: {
4914
+ cwd: params.cwd,
4915
+ env: params.env,
4916
+ stdio: ["pipe", "pipe", "pipe"],
4917
+ windowsHide: process.platform === "win32"
4918
+ }
4919
+ };
4920
+ }
4921
+
4922
+ function createAcpFilteredStdoutReadable(params) {
4923
+ const maxMultilineBytes = typeof params.maxMultilineBytes === "number" && Number.isFinite(params.maxMultilineBytes) && params.maxMultilineBytes > 0 ? Math.trunc(params.maxMultilineBytes) : 1e6;
4924
+ const decoder = new TextDecoder();
4925
+ const encoder = new TextEncoder();
4926
+ return new ReadableStream({
4927
+ async start(controller) {
4928
+ const reader = params.readable.getReader();
4929
+ let buffer = "";
4930
+ let multiline = null;
4931
+ let controllerErrored = false;
4932
+ const drop = (reason, line) => {
4933
+ params.onDroppedLine?.({ reason, line });
4934
+ };
4935
+ const enqueueLine = (line) => {
4936
+ if (!line.trim()) {
4937
+ return;
4938
+ }
4939
+ const filtered = params.transport.filterStdoutLine?.(line);
4940
+ if (filtered === void 0) {
4941
+ controller.enqueue(encoder.encode(line + "\n"));
4942
+ return;
4943
+ }
4944
+ if (filtered === null) {
4945
+ drop("transport_filter_null", line);
4946
+ return;
4947
+ }
4948
+ controller.enqueue(encoder.encode(filtered + "\n"));
4949
+ };
4950
+ const tryFlushMultiline = (candidate) => {
4951
+ const trimmed = candidate.trim();
4952
+ if (!trimmed) {
4953
+ return false;
4954
+ }
4955
+ if (!trimmed.startsWith("{") && !trimmed.startsWith("[")) {
4956
+ return false;
4957
+ }
4958
+ try {
4959
+ const parsed = JSON.parse(trimmed);
4960
+ if (typeof parsed !== "object" || parsed === null) {
4961
+ return false;
4962
+ }
4963
+ enqueueLine(JSON.stringify(parsed));
4964
+ return true;
4965
+ } catch {
4966
+ return false;
4967
+ }
4968
+ };
4969
+ try {
4970
+ while (true) {
4971
+ const { value, done } = await reader.read();
4972
+ if (done) {
4973
+ break;
4974
+ }
4975
+ if (!value) {
4976
+ continue;
4977
+ }
4978
+ buffer += decoder.decode(value, { stream: true });
4979
+ const lines = buffer.split("\n");
4980
+ buffer = lines.pop() || "";
4981
+ for (const line of lines) {
4982
+ if (multiline) {
4983
+ const nextBuf = multiline.buf.length > 0 ? `${multiline.buf}
4984
+ ${line}` : line;
4985
+ const nextBytes = multiline.bytes + line.length + 1;
4986
+ if (nextBytes > maxMultilineBytes) {
4987
+ drop("multiline_overflow", multiline.buf);
4988
+ multiline = null;
4989
+ enqueueLine(line);
4990
+ continue;
4991
+ }
4992
+ multiline = { buf: nextBuf, bytes: nextBytes };
4993
+ if (tryFlushMultiline(multiline.buf)) {
4994
+ multiline = null;
4995
+ }
4996
+ continue;
4997
+ }
4998
+ const trimmed = line.trim();
4999
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
5000
+ try {
5001
+ const parsed = JSON.parse(trimmed);
5002
+ if (typeof parsed === "object" && parsed !== null) {
5003
+ enqueueLine(line);
5004
+ continue;
5005
+ }
5006
+ } catch {
5007
+ multiline = { buf: line, bytes: line.length };
5008
+ continue;
5009
+ }
5010
+ }
5011
+ enqueueLine(line);
5012
+ }
5013
+ }
5014
+ if (multiline) {
5015
+ if (!tryFlushMultiline(multiline.buf)) {
5016
+ drop("multiline_incomplete", multiline.buf);
5017
+ }
5018
+ multiline = null;
5019
+ }
5020
+ const trailing = buffer.trim();
5021
+ if (trailing) {
5022
+ drop("multiline_incomplete", buffer);
5023
+ }
5024
+ } catch (error) {
5025
+ controllerErrored = true;
5026
+ controller.error(error);
5027
+ } finally {
5028
+ reader.releaseLock();
5029
+ if (!controllerErrored) {
5030
+ controller.close();
5031
+ }
5032
+ }
5033
+ }
5034
+ });
5035
+ }
5036
+
5037
+ function isAlive(pid) {
5038
+ try {
5039
+ process.kill(pid, 0);
5040
+ return true;
5041
+ } catch {
5042
+ return false;
5043
+ }
5044
+ }
5045
+ async function resolveDescendantPids(rootPid) {
5046
+ const processes = await psList();
5047
+ const childrenByParent = /* @__PURE__ */ new Map();
5048
+ for (const proc of processes) {
5049
+ if (typeof proc.pid !== "number" || typeof proc.ppid !== "number") {
5050
+ continue;
5051
+ }
5052
+ const children = childrenByParent.get(proc.ppid) ?? [];
5053
+ children.push(proc.pid);
5054
+ childrenByParent.set(proc.ppid, children);
5055
+ }
5056
+ const descendants = [];
5057
+ const seen = /* @__PURE__ */ new Set();
5058
+ const visit = (pid) => {
5059
+ for (const childPid of childrenByParent.get(pid) ?? []) {
5060
+ if (seen.has(childPid)) {
5061
+ continue;
5062
+ }
5063
+ seen.add(childPid);
5064
+ visit(childPid);
5065
+ descendants.push(childPid);
5066
+ }
5067
+ };
5068
+ visit(rootPid);
5069
+ return descendants;
5070
+ }
5071
+ function bestEffortKillPid(pid, signal) {
5072
+ try {
5073
+ process.kill(pid, signal);
5074
+ } catch {
5075
+ }
5076
+ }
5077
+ async function waitForAllGone(pids, timeoutMs) {
5078
+ const start = Date.now();
5079
+ while (Date.now() - start < timeoutMs) {
5080
+ if (pids.every((pid) => !isAlive(pid))) {
5081
+ return;
5082
+ }
5083
+ await new Promise((resolve) => setTimeout(resolve, 25));
5084
+ }
5085
+ }
5086
+ async function killProcessTree(proc, options) {
5087
+ const pid = proc.pid;
5088
+ if (!pid) {
5089
+ return;
5090
+ }
5091
+ const graceMs = Math.max(1, options?.graceMs);
5092
+ const descendants = await resolveDescendantPids(pid).catch(() => []);
5093
+ const allPids = [...descendants, pid];
5094
+ for (const targetPid of allPids) {
5095
+ bestEffortKillPid(targetPid, "SIGTERM");
5096
+ }
5097
+ await waitForAllGone(allPids, graceMs);
5098
+ const remaining = allPids.filter((targetPid) => isAlive(targetPid));
5099
+ if (remaining.length === 0) {
5100
+ return;
5101
+ }
5102
+ for (const targetPid of remaining) {
5103
+ bestEffortKillPid(targetPid, "SIGKILL");
5104
+ }
5105
+ await waitForAllGone(remaining, Math.min(250, graceMs));
5106
+ }
5107
+
4909
5108
  const RETRY_CONFIG = {
4910
5109
  /** Maximum number of retry attempts for init/newSession */
4911
5110
  maxAttempts: 3,
@@ -5294,24 +5493,13 @@ class AcpBackend {
5294
5493
  try {
5295
5494
  logger.debug(`[AcpBackend] Starting session: ${sessionId}`);
5296
5495
  this.recentStderrLines = [];
5297
- const args = this.options.args || [];
5298
- if (process.platform === "win32") {
5299
- const fullCommand = [this.options.command, ...args].join(" ");
5300
- this.process = spawn$2("cmd.exe", ["/c", fullCommand], {
5301
- cwd: this.options.cwd,
5302
- env: { ...process.env, ...this.options.env },
5303
- stdio: ["pipe", "pipe", "pipe"],
5304
- windowsHide: true
5305
- });
5306
- } else {
5307
- this.process = spawn$2(this.options.command, args, {
5308
- cwd: this.options.cwd,
5309
- env: { ...process.env, ...this.options.env },
5310
- // Use 'pipe' for all stdio to capture output without printing to console
5311
- // stdout and stderr will be handled by our event listeners
5312
- stdio: ["pipe", "pipe", "pipe"]
5313
- });
5314
- }
5496
+ const spawnSpec = buildAcpSpawnSpec({
5497
+ command: this.options.command,
5498
+ args: this.options.args ?? [],
5499
+ cwd: this.options.cwd,
5500
+ env: { ...process.env, ...this.options.env }
5501
+ });
5502
+ this.process = spawn$1(spawnSpec.command, spawnSpec.args, spawnSpec.options);
5315
5503
  if (this.process.stderr) {
5316
5504
  }
5317
5505
  if (!this.process.stdin || !this.process.stdout || !this.process.stderr) {
@@ -5359,57 +5547,20 @@ class AcpBackend {
5359
5547
  );
5360
5548
  const writable = streams.writable;
5361
5549
  const readable = streams.readable;
5362
- const transport = this.transport;
5363
- const filteredReadable = new ReadableStream({
5364
- async start(controller) {
5365
- const reader = readable.getReader();
5366
- const decoder = new TextDecoder();
5367
- const encoder = new TextEncoder();
5368
- let buffer = "";
5369
- let filteredCount = 0;
5370
- try {
5371
- while (true) {
5372
- const { done, value } = await reader.read();
5373
- if (done) {
5374
- if (buffer.trim()) {
5375
- const filtered = transport.filterStdoutLine?.(buffer);
5376
- if (filtered === void 0) {
5377
- controller.enqueue(encoder.encode(buffer));
5378
- } else if (filtered !== null) {
5379
- controller.enqueue(encoder.encode(filtered));
5380
- } else {
5381
- filteredCount++;
5382
- }
5383
- }
5384
- if (filteredCount > 0) {
5385
- logger.debug(`[AcpBackend] Filtered out ${filteredCount} non-JSON lines from ${transport.agentName} stdout`);
5386
- }
5387
- controller.close();
5388
- break;
5389
- }
5390
- buffer += decoder.decode(value, { stream: true });
5391
- const lines = buffer.split("\n");
5392
- buffer = lines.pop() || "";
5393
- for (const line of lines) {
5394
- if (!line.trim()) continue;
5395
- const filtered = transport.filterStdoutLine?.(line);
5396
- if (filtered === void 0) {
5397
- controller.enqueue(encoder.encode(line + "\n"));
5398
- } else if (filtered !== null) {
5399
- controller.enqueue(encoder.encode(filtered + "\n"));
5400
- } else {
5401
- filteredCount++;
5402
- }
5403
- }
5404
- }
5405
- } catch (error) {
5406
- logger.debug(`[AcpBackend] Error filtering stdout stream:`, error);
5407
- controller.error(error);
5408
- } finally {
5409
- reader.releaseLock();
5410
- }
5550
+ const droppedStdoutLines = [];
5551
+ const filteredReadable = createAcpFilteredStdoutReadable({
5552
+ readable,
5553
+ transport: this.transport,
5554
+ onDroppedLine: (entry) => {
5555
+ droppedStdoutLines.push(entry);
5411
5556
  }
5412
5557
  });
5558
+ if (droppedStdoutLines.length > 0) {
5559
+ logger.debug(
5560
+ `[AcpBackend] Filtered out ${droppedStdoutLines.length} stdout lines from ${this.transport.agentName}`,
5561
+ droppedStdoutLines.slice(0, 5)
5562
+ );
5563
+ }
5413
5564
  const stream = ndJsonStream(writable, filteredReadable);
5414
5565
  const client = {
5415
5566
  sessionUpdate: async (params) => {
@@ -5937,21 +6088,13 @@ class AcpBackend {
5937
6088
  }
5938
6089
  }
5939
6090
  if (this.process) {
5940
- this.process.kill("SIGTERM");
5941
- await new Promise((resolve) => {
5942
- const timeout = setTimeout(() => {
5943
- if (this.process) {
5944
- logger.debug("[AcpBackend] Force killing process");
5945
- this.process.kill("SIGKILL");
5946
- }
5947
- resolve();
5948
- }, 1e3);
5949
- this.process?.once("exit", () => {
5950
- clearTimeout(timeout);
5951
- resolve();
5952
- });
5953
- });
5954
- this.process = null;
6091
+ try {
6092
+ await killProcessTree(this.process, { graceMs: 1e3 });
6093
+ } catch (error) {
6094
+ logger.debug("[AcpBackend] Failed to kill ACP process tree:", error);
6095
+ } finally {
6096
+ this.process = null;
6097
+ }
5955
6098
  }
5956
6099
  this.clearIdleTimeoutState();
5957
6100
  this.listeners = [];
@@ -6603,12 +6746,12 @@ async function ensureUnifiedDaemonStarted() {
6603
6746
  async function executeUnifiedProvider(opts) {
6604
6747
  const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
6605
6748
  if (opts.provider === "claude") {
6606
- const { runClaude } = await import('./runClaude-CZ8gxaJL.mjs');
6749
+ const { runClaude } = await import('./runClaude-CwA5UCO-.mjs');
6607
6750
  await runClaude(credentials, opts.claudeOptions ?? {});
6608
6751
  return;
6609
6752
  }
6610
6753
  if (opts.provider === "codex") {
6611
- const { runCodex } = await import('./runCodex-DT7g4MPm.mjs');
6754
+ const { runCodex } = await import('./runCodex-DTPmqCyS.mjs');
6612
6755
  await runCodex({
6613
6756
  credentials,
6614
6757
  startedBy: opts.startedBy,
@@ -6618,7 +6761,7 @@ async function executeUnifiedProvider(opts) {
6618
6761
  return;
6619
6762
  }
6620
6763
  if (opts.provider === "gemini") {
6621
- const { runGemini } = await import('./runGemini-CmY5386l.mjs');
6764
+ const { runGemini } = await import('./runGemini-DDSR8BtO.mjs');
6622
6765
  await runGemini({
6623
6766
  credentials,
6624
6767
  startedBy: opts.startedBy
@@ -6660,7 +6803,7 @@ function shouldRunMainClaudeFlow(opts) {
6660
6803
  return;
6661
6804
  } else if (subcommand === "runtime") {
6662
6805
  if (args[1] === "providers") {
6663
- const { renderRuntimeProviders } = await import('./command-Dl9SrMnv.mjs');
6806
+ const { renderRuntimeProviders } = await import('./command-D8Zz6B4t.mjs');
6664
6807
  console.log(renderRuntimeProviders());
6665
6808
  return;
6666
6809
  }
@@ -6838,8 +6981,8 @@ function shouldRunMainClaudeFlow(opts) {
6838
6981
  const projectId = args[3];
6839
6982
  try {
6840
6983
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
6841
- const { readCredentials: readCredentials2 } = await import('./persistence-QqeBvUxX.mjs');
6842
- const { ApiClient: ApiClient2 } = await import('./api-DoHt-HyL.mjs').then(function (n) { return n.q; });
6984
+ const { readCredentials: readCredentials2 } = await import('./persistence-Blm1hTQA.mjs');
6985
+ const { ApiClient: ApiClient2 } = await import('./api-Emo3rSZH.mjs').then(function (n) { return n.q; });
6843
6986
  let userEmail = void 0;
6844
6987
  try {
6845
6988
  const credentials = await readCredentials2();
package/dist/index.cjs CHANGED
@@ -1,14 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./api-DaqnNHfl.cjs');
5
- require('./persistence-D6Y0604_.cjs');
4
+ require('./api-DccDghmF.cjs');
5
+ require('./persistence-BrTyBuT7.cjs');
6
6
  require('zod');
7
- require('./index-Dc92gnxM.cjs');
7
+ require('./index-Buq7nurH.cjs');
8
8
  require('node:child_process');
9
9
  require('node:fs');
10
+ require('cross-spawn');
10
11
  require('@agentclientprotocol/sdk');
11
12
  require('node:crypto');
13
+ require('ps-list');
12
14
  require('fs');
13
15
  require('path');
14
16
  require('os');
@@ -31,8 +33,6 @@ require('open');
31
33
  require('react');
32
34
  require('ink');
33
35
  require('url');
34
- require('ps-list');
35
- require('cross-spawn');
36
36
  require('fastify');
37
37
  require('fastify-type-provider-zod');
38
38
  require('node:readline');
package/dist/index.mjs CHANGED
@@ -1,12 +1,14 @@
1
1
  import 'chalk';
2
- import './api-DoHt-HyL.mjs';
3
- import './persistence-QqeBvUxX.mjs';
2
+ import './api-Emo3rSZH.mjs';
3
+ import './persistence-Blm1hTQA.mjs';
4
4
  import 'zod';
5
- import './index-C5wR2qKT.mjs';
5
+ import './index-Dh8UTgm4.mjs';
6
6
  import 'node:child_process';
7
7
  import 'node:fs';
8
+ import 'cross-spawn';
8
9
  import '@agentclientprotocol/sdk';
9
10
  import 'node:crypto';
11
+ import 'ps-list';
10
12
  import 'fs';
11
13
  import 'path';
12
14
  import 'os';
@@ -29,8 +31,6 @@ import 'open';
29
31
  import 'react';
30
32
  import 'ink';
31
33
  import 'url';
32
- import 'ps-list';
33
- import 'cross-spawn';
34
34
  import 'fastify';
35
35
  import 'fastify-type-provider-zod';
36
36
  import 'node:readline';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var api = require('./api-DaqnNHfl.cjs');
3
+ var api = require('./api-DccDghmF.cjs');
4
4
  var types = require('./types-DVk3crez.cjs');
5
5
  require('axios');
6
6
  require('chalk');
package/dist/lib.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-DoHt-HyL.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-Emo3rSZH.mjs';
2
2
  export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
3
3
  import 'axios';
4
4
  import 'chalk';
@@ -1,7 +1,7 @@
1
1
  import { readFile, unlink, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
2
2
  import { existsSync, unlinkSync, writeFileSync, readdirSync, readFileSync, constants } from 'node:fs';
3
3
  import { join, dirname } from 'node:path';
4
- import { c as configuration, l as logger, e as encodeBase64 } from './api-DoHt-HyL.mjs';
4
+ import { c as configuration, l as logger, e as encodeBase64 } from './api-Emo3rSZH.mjs';
5
5
  import * as z from 'zod';
6
6
  import 'axios';
7
7
  import 'chalk';
@@ -3,7 +3,7 @@
3
3
  var promises = require('node:fs/promises');
4
4
  var node_fs = require('node:fs');
5
5
  var node_path = require('node:path');
6
- var api = require('./api-DaqnNHfl.cjs');
6
+ var api = require('./api-DccDghmF.cjs');
7
7
  var z = require('zod');
8
8
  require('axios');
9
9
  require('chalk');
@@ -1,5 +1,5 @@
1
- import { f as formatDisplayMessage } from './index-C5wR2qKT.mjs';
2
- import { l as logger } from './api-DoHt-HyL.mjs';
1
+ import { f as formatDisplayMessage } from './index-Dh8UTgm4.mjs';
2
+ import { l as logger } from './api-Emo3rSZH.mjs';
3
3
  import { createHash } from 'crypto';
4
4
  import 'axios';
5
5
  import 'node:events';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-Dc92gnxM.cjs');
4
- var api = require('./api-DaqnNHfl.cjs');
3
+ var index = require('./index-Buq7nurH.cjs');
4
+ var api = require('./api-DccDghmF.cjs');
5
5
  var crypto = require('crypto');
6
6
  require('axios');
7
7
  require('node:events');
@@ -2,14 +2,14 @@
2
2
 
3
3
  var os = require('node:os');
4
4
  var node_crypto = require('node:crypto');
5
- var api = require('./api-DaqnNHfl.cjs');
6
- var index = require('./index-Dc92gnxM.cjs');
5
+ var api = require('./api-DccDghmF.cjs');
6
+ var index = require('./index-Buq7nurH.cjs');
7
7
  var types = require('./types-DVk3crez.cjs');
8
8
  var node_path = require('node:path');
9
9
  var promises = require('node:fs/promises');
10
10
  var fs = require('fs/promises');
11
11
  var ink = require('ink');
12
- var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.cjs');
12
+ var registerKillSessionHandler = require('./registerKillSessionHandler-EFAsOnR_.cjs');
13
13
  var React = require('react');
14
14
  var node_child_process = require('node:child_process');
15
15
  var node_readline = require('node:readline');
@@ -22,7 +22,7 @@ require('tweetnacl');
22
22
  require('expo-server-sdk');
23
23
  require('chalk');
24
24
  var node_util = require('node:util');
25
- var persistence = require('./persistence-D6Y0604_.cjs');
25
+ var persistence = require('./persistence-BrTyBuT7.cjs');
26
26
  var node_http = require('node:http');
27
27
  require('fs');
28
28
  require('zod');
@@ -937,7 +937,7 @@ class AbortError extends Error {
937
937
  }
938
938
  }
939
939
 
940
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('runClaude-gHKFB1UG.cjs', document.baseURI).href)));
940
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('runClaude-COy1pLhn.cjs', document.baseURI).href)));
941
941
  const __dirname$1 = node_path.join(__filename$1, "..");
942
942
  function getGlobalClaudeVersion() {
943
943
  try {
@@ -1,13 +1,13 @@
1
1
  import os, { homedir } from 'node:os';
2
2
  import { randomUUID } from 'node:crypto';
3
- import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, b as connectionState, A as ApiClient, p as packageJson, i as isAuthenticationRequiredError, s as startOfflineReconnection } from './api-DoHt-HyL.mjs';
4
- import { e as getProjectPath, h as claudeLocal, E as ExitCodeError, j as isBun, k as trimIdent, l as claudeCheckSession, p as projectPath, m as getEnvironmentInfo, i as initialMachineMetadata, b as stopCaffeinate, n as notifyDaemonSessionStarted, o as startCaffeinate } from './index-C5wR2qKT.mjs';
3
+ import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, b as connectionState, A as ApiClient, p as packageJson, i as isAuthenticationRequiredError, s as startOfflineReconnection } from './api-Emo3rSZH.mjs';
4
+ import { e as getProjectPath, h as claudeLocal, E as ExitCodeError, j as isBun, k as trimIdent, l as claudeCheckSession, p as projectPath, m as getEnvironmentInfo, i as initialMachineMetadata, b as stopCaffeinate, n as notifyDaemonSessionStarted, o as startCaffeinate } from './index-Dh8UTgm4.mjs';
5
5
  import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
6
6
  import { dirname, basename, join, resolve } from 'node:path';
7
7
  import { readFile } from 'node:fs/promises';
8
8
  import { stat, watch, access } from 'fs/promises';
9
9
  import { useStdout, useInput, Box, Text, render } from 'ink';
10
- import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-CC9zGBPE.mjs';
10
+ import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-Bm7E-03E.mjs';
11
11
  import React, { useState, useRef, useEffect, useCallback } from 'react';
12
12
  import { execSync, spawn } from 'node:child_process';
13
13
  import { createInterface } from 'node:readline';
@@ -20,7 +20,7 @@ import 'tweetnacl';
20
20
  import 'expo-server-sdk';
21
21
  import 'chalk';
22
22
  import { isDeepStrictEqual } from 'node:util';
23
- import { readSettings } from './persistence-QqeBvUxX.mjs';
23
+ import { readSettings } from './persistence-Blm1hTQA.mjs';
24
24
  import { createServer } from 'node:http';
25
25
  import 'fs';
26
26
  import 'zod';
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var api = require('./api-DaqnNHfl.cjs');
5
- var persistence = require('./persistence-D6Y0604_.cjs');
6
- var index = require('./index-Dc92gnxM.cjs');
7
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DPVZIJ4n.cjs');
8
- var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.cjs');
4
+ var api = require('./api-DccDghmF.cjs');
5
+ var persistence = require('./persistence-BrTyBuT7.cjs');
6
+ var index = require('./index-Buq7nurH.cjs');
7
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-BMyfwx3p.cjs');
8
+ var registerKillSessionHandler = require('./registerKillSessionHandler-EFAsOnR_.cjs');
9
9
  var React = require('react');
10
10
  var ink = require('ink');
11
11
  var happyProtocol = require('happy-protocol');
@@ -1,9 +1,9 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DoHt-HyL.mjs';
3
- import { readSettings } from './persistence-QqeBvUxX.mjs';
4
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-C5wR2qKT.mjs';
5
- import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-bFVTvf3Q.mjs';
6
- import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-CC9zGBPE.mjs';
2
+ import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-Emo3rSZH.mjs';
3
+ import { readSettings } from './persistence-Blm1hTQA.mjs';
4
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-Dh8UTgm4.mjs';
5
+ import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-1EzrE03x.mjs';
6
+ import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-Bm7E-03E.mjs';
7
7
  import React, { useState, useRef, useEffect, useCallback } from 'react';
8
8
  import { useStdout, useInput, Box, Text, render } from 'ink';
9
9
  import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
@@ -3,11 +3,11 @@
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
5
  var node_crypto = require('node:crypto');
6
- var api = require('./api-DaqnNHfl.cjs');
7
- var persistence = require('./persistence-D6Y0604_.cjs');
8
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DPVZIJ4n.cjs');
9
- var index = require('./index-Dc92gnxM.cjs');
10
- var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.cjs');
6
+ var api = require('./api-DccDghmF.cjs');
7
+ var persistence = require('./persistence-BrTyBuT7.cjs');
8
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-BMyfwx3p.cjs');
9
+ var index = require('./index-Buq7nurH.cjs');
10
+ var registerKillSessionHandler = require('./registerKillSessionHandler-EFAsOnR_.cjs');
11
11
  var happyProtocol = require('happy-protocol');
12
12
  require('axios');
13
13
  require('chalk');
@@ -1,11 +1,11 @@
1
1
  import { useStdout, useInput, Box, Text, render } from 'ink';
2
2
  import React, { useState, useRef, useEffect, useCallback } from 'react';
3
3
  import { randomUUID } from 'node:crypto';
4
- import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DoHt-HyL.mjs';
5
- import { readSettings } from './persistence-QqeBvUxX.mjs';
6
- import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-bFVTvf3Q.mjs';
7
- import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-C5wR2qKT.mjs';
8
- import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-CC9zGBPE.mjs';
4
+ import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-Emo3rSZH.mjs';
5
+ import { readSettings } from './persistence-Blm1hTQA.mjs';
6
+ import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-1EzrE03x.mjs';
7
+ import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-Dh8UTgm4.mjs';
8
+ import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-Bm7E-03E.mjs';
9
9
  import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
10
10
  import 'axios';
11
11
  import 'chalk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",
@@ -59,7 +59,7 @@
59
59
  "dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
60
60
  "dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
61
61
  "// ==== Release ====": "",
62
- "prepublishOnly": "npm run build",
62
+ "prepublishOnly": "yarn release:smoke",
63
63
  "release": "yarn install && release-it",
64
64
  "release:smoke": "node ./scripts/release-smoke.mjs",
65
65
  "// ==== Dev/Stable Variant Management ====": "",
@@ -33,6 +33,10 @@ function main() {
33
33
  runStep('unit runtime suite', 'yarn', [
34
34
  'vitest',
35
35
  'run',
36
+ 'src/agent/acp/AcpBackend.startup.test.ts',
37
+ 'src/agent/acp/acpSpawn.test.ts',
38
+ 'src/agent/acp/createAcpFilteredStdoutReadable.multiline.test.ts',
39
+ 'src/agent/acp/killProcessTree.test.ts',
36
40
  'src/runtime/executeProvider.test.ts',
37
41
  'src/runtime/command.test.ts',
38
42
  'src/runtime/launch.test.ts',