happy-imou-cloud 2.1.43 → 2.1.44

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 (32) hide show
  1. package/compat/acp-sdk-schema/index.d.ts +16 -3
  2. package/compat/acp-sdk-schema/index.js +15 -2
  3. package/compat/acp-sdk-schema/types.gen.d.ts +1801 -313
  4. package/compat/acp-sdk-schema/zod.gen.d.ts +3267 -1775
  5. package/compat/acp-sdk-schema/zod.gen.js +1007 -316
  6. package/dist/{BaseReasoningProcessor-D6itItnT.cjs → BaseReasoningProcessor-CMyFNQ1O.cjs} +2 -2
  7. package/dist/{BaseReasoningProcessor-CWCPAVJ3.mjs → BaseReasoningProcessor-DVSN7PCw.mjs} +2 -2
  8. package/dist/{ProviderSelectionHandler-CYUH1U8F.mjs → ProviderSelectionHandler-2IaDlDBx.mjs} +2 -2
  9. package/dist/{ProviderSelectionHandler-CXwqOJpC.cjs → ProviderSelectionHandler-Dqa4j1pD.cjs} +2 -2
  10. package/dist/{api-B89O-SC-.mjs → api-BhMVpzwg.mjs} +12 -8
  11. package/dist/{api-zMic8QXq.cjs → api-BoWVQeVe.cjs} +12 -8
  12. package/dist/{command-_qNFoJ-l.cjs → command-DoF8oaxg.cjs} +2 -2
  13. package/dist/{command-W01qXC9C.mjs → command-h3Rr4Abu.mjs} +2 -2
  14. package/dist/{index-CiHiCC31.mjs → index-DxF1W0nt.mjs} +57 -14
  15. package/dist/{index-DVVbyQGZ.cjs → index-kIN8gN9G.cjs} +60 -17
  16. package/dist/index.cjs +2 -2
  17. package/dist/index.mjs +2 -2
  18. package/dist/lib.cjs +1 -1
  19. package/dist/lib.d.cts +335 -336
  20. package/dist/lib.d.mts +335 -336
  21. package/dist/lib.mjs +1 -1
  22. package/dist/{registerKillSessionHandler-CDYAY5Ev.cjs → registerKillSessionHandler-CBm2WFM0.cjs} +2 -2
  23. package/dist/{registerKillSessionHandler-BnS3ozFX.mjs → registerKillSessionHandler-Dsg63Cx6.mjs} +2 -2
  24. package/dist/{runClaude-0U7kV07_.mjs → runClaude-BpwlCyVT.mjs} +4 -4
  25. package/dist/{runClaude-C1xfptKt.cjs → runClaude-Dq9OISKt.cjs} +4 -4
  26. package/dist/{runCodex-DnDmHm7E.mjs → runCodex-BMNR2hNp.mjs} +5 -5
  27. package/dist/{runCodex-BBgKpYLO.cjs → runCodex-BnzErOK_.cjs} +5 -5
  28. package/dist/{runGemini-CUwQHJ9y.cjs → runGemini-CYc9Ufxo.cjs} +4 -4
  29. package/dist/{runGemini-DcsIBQSc.mjs → runGemini-D4Af8oH1.mjs} +4 -4
  30. package/package.json +2 -2
  31. package/scripts/ensureAcpSdkCompat.mjs +37 -11
  32. package/scripts/release-smoke.mjs +1 -0
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DVVbyQGZ.cjs');
4
- var persistence = require('./api-zMic8QXq.cjs');
3
+ var index = require('./index-kIN8gN9G.cjs');
4
+ var persistence = require('./api-BoWVQeVe.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 { a as createSessionMetadata, p as publishSessionRegistration } from './index-CiHiCC31.mjs';
2
- import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-B89O-SC-.mjs';
1
+ import { a as createSessionMetadata, p as publishSessionRegistration } from './index-DxF1W0nt.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-BhMVpzwg.mjs';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import { randomUUID } from 'node:crypto';
5
5
 
@@ -1,5 +1,5 @@
1
- import { l as logger } from './api-B89O-SC-.mjs';
2
- import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BnS3ozFX.mjs';
1
+ import { l as logger } from './api-BhMVpzwg.mjs';
2
+ import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-Dsg63Cx6.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-zMic8QXq.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-CDYAY5Ev.cjs');
3
+ var persistence = require('./api-BoWVQeVe.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-CBm2WFM0.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.43";
21
+ var version = "2.1.44";
22
22
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
23
23
  var author = "long.zhu";
24
24
  var license = "MIT";
@@ -105,7 +105,7 @@ var scripts = {
105
105
  "test:happy-org-1.2-quality": "node ../../node_modules/vitest/vitest.mjs run --config vitest.happy-org-1.2.config.mjs"
106
106
  };
107
107
  var dependencies = {
108
- "@agentclientprotocol/sdk": "0.17.1",
108
+ "@agentclientprotocol/sdk": "0.21.0",
109
109
  "@stablelib/base64": "^2.0.1",
110
110
  "@stablelib/hex": "^2.0.1",
111
111
  "@types/cross-spawn": "^6.0.6",
@@ -2466,12 +2466,16 @@ async function readHappyOrgRepoTaskBoard(rootPath) {
2466
2466
  const bundle = await loadTaskEnvelope(rootPath, taskId);
2467
2467
  return bundle ? mergeTaskEnvelope(bundle) : null;
2468
2468
  }));
2469
- return buildHappyOrgTaskBoardView(tasks.filter((task) => task !== null).map((task) => ({
2470
- ...task,
2471
- organizationManifestId,
2472
- positionId: (task.responsibilityId ? responsibilityPositionIdById.get(task.responsibilityId) ?? null : null) ?? positionIdByAgentId.get(task.activeOwnerAgentId ?? "") ?? positionIdByAgentId.get(task.ownerAgentId) ?? null,
2473
- responsibilityLabel: task.responsibilityLabel ?? (task.responsibilityId ? responsibilityLabelById.get(task.responsibilityId) ?? null : null)
2474
- })));
2469
+ return buildHappyOrgTaskBoardView(tasks.filter((task) => task !== null).map((task) => {
2470
+ const responsibilityPositionId = task.responsibilityId ? responsibilityPositionIdById.get(task.responsibilityId) : void 0;
2471
+ const activeOwnerPositionId = task.activeOwnerAgentId ? positionIdByAgentId.get(task.activeOwnerAgentId) : void 0;
2472
+ return {
2473
+ ...task,
2474
+ organizationManifestId,
2475
+ positionId: responsibilityPositionId ?? activeOwnerPositionId ?? positionIdByAgentId.get(task.ownerAgentId) ?? null,
2476
+ responsibilityLabel: task.responsibilityLabel ?? (task.responsibilityId ? responsibilityLabelById.get(task.responsibilityId) ?? null : null)
2477
+ };
2478
+ }));
2475
2479
  }
2476
2480
  function mergeTaskEnvelope(taskBundle) {
2477
2481
  const { task, workflow, result } = taskBundle;
@@ -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.43";
41
+ var version = "2.1.44";
42
42
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
43
43
  var author = "long.zhu";
44
44
  var license = "MIT";
@@ -125,7 +125,7 @@ var scripts = {
125
125
  "test:happy-org-1.2-quality": "node ../../node_modules/vitest/vitest.mjs run --config vitest.happy-org-1.2.config.mjs"
126
126
  };
127
127
  var dependencies = {
128
- "@agentclientprotocol/sdk": "0.17.1",
128
+ "@agentclientprotocol/sdk": "0.21.0",
129
129
  "@stablelib/base64": "^2.0.1",
130
130
  "@stablelib/hex": "^2.0.1",
131
131
  "@types/cross-spawn": "^6.0.6",
@@ -2486,12 +2486,16 @@ async function readHappyOrgRepoTaskBoard(rootPath) {
2486
2486
  const bundle = await loadTaskEnvelope(rootPath, taskId);
2487
2487
  return bundle ? mergeTaskEnvelope(bundle) : null;
2488
2488
  }));
2489
- return buildHappyOrgTaskBoardView(tasks.filter((task) => task !== null).map((task) => ({
2490
- ...task,
2491
- organizationManifestId,
2492
- positionId: (task.responsibilityId ? responsibilityPositionIdById.get(task.responsibilityId) ?? null : null) ?? positionIdByAgentId.get(task.activeOwnerAgentId ?? "") ?? positionIdByAgentId.get(task.ownerAgentId) ?? null,
2493
- responsibilityLabel: task.responsibilityLabel ?? (task.responsibilityId ? responsibilityLabelById.get(task.responsibilityId) ?? null : null)
2494
- })));
2489
+ return buildHappyOrgTaskBoardView(tasks.filter((task) => task !== null).map((task) => {
2490
+ const responsibilityPositionId = task.responsibilityId ? responsibilityPositionIdById.get(task.responsibilityId) : void 0;
2491
+ const activeOwnerPositionId = task.activeOwnerAgentId ? positionIdByAgentId.get(task.activeOwnerAgentId) : void 0;
2492
+ return {
2493
+ ...task,
2494
+ organizationManifestId,
2495
+ positionId: responsibilityPositionId ?? activeOwnerPositionId ?? positionIdByAgentId.get(task.ownerAgentId) ?? null,
2496
+ responsibilityLabel: task.responsibilityLabel ?? (task.responsibilityId ? responsibilityLabelById.get(task.responsibilityId) ?? null : null)
2497
+ };
2498
+ }));
2495
2499
  }
2496
2500
  function mergeTaskEnvelope(taskBundle) {
2497
2501
  const { task, workflow, result } = taskBundle;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DVVbyQGZ.cjs');
3
+ var index = require('./index-kIN8gN9G.cjs');
4
4
  require('chalk');
5
- require('./api-zMic8QXq.cjs');
5
+ require('./api-BoWVQeVe.cjs');
6
6
  require('axios');
7
7
  require('fs');
8
8
  require('node:fs');
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-CiHiCC31.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-DxF1W0nt.mjs';
2
2
  import 'chalk';
3
- import './api-B89O-SC-.mjs';
3
+ import './api-BhMVpzwg.mjs';
4
4
  import 'axios';
5
5
  import 'fs';
6
6
  import 'node:fs';
@@ -1,5 +1,5 @@
1
1
  import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import chalk from 'chalk';
2
- import { l as logger, q as encodeBase64, c as configuration, t as readCredentials, u as ensureSigningCredentials, r as readSettings, v as updateSettings, w as encodeBase64Url, m as delay, x as buildClientHeaders, y as decodeBase64, z as writeCredentialsLegacy, B as writeCredentialsDataKey, C as readDaemonState, D as HAPPY_CLOUD_DAEMON_PORT, E as clearDaemonState, F as packageJson, i as isAuthenticationRequiredError, G as acquireDaemonLock, I as writeDaemonState, A as ApiClient, J as releaseDaemonLock, K as validateProfileForAgent, L as getProfileEnvironmentVariables, M as clearCredentials, N as clearMachineId, O as readHappyOrgDispatchTruthSnapshot, P as processHappyOrgRepoRequests, Q as readHappyOrgRepoTaskBoard, R as HappyOrgTurnReportSchema, S as recordHappyOrgTurnReport, T as MessageContentSchema, U as buildSocketAuth, V as encrypt, H as HeadTailPreviewBuffer, W as getLatestDaemonLog } from './api-B89O-SC-.mjs';
2
+ import { l as logger, q as encodeBase64, c as configuration, t as readCredentials, u as ensureSigningCredentials, r as readSettings, v as updateSettings, w as encodeBase64Url, m as delay, x as buildClientHeaders, y as decodeBase64, z as writeCredentialsLegacy, B as writeCredentialsDataKey, C as readDaemonState, D as HAPPY_CLOUD_DAEMON_PORT, E as clearDaemonState, F as packageJson, i as isAuthenticationRequiredError, G as acquireDaemonLock, I as writeDaemonState, A as ApiClient, J as releaseDaemonLock, K as validateProfileForAgent, L as getProfileEnvironmentVariables, M as clearCredentials, N as clearMachineId, O as readHappyOrgDispatchTruthSnapshot, P as processHappyOrgRepoRequests, Q as readHappyOrgRepoTaskBoard, R as HappyOrgTurnReportSchema, S as recordHappyOrgTurnReport, T as MessageContentSchema, U as buildSocketAuth, V as encrypt, H as HeadTailPreviewBuffer, W as getLatestDaemonLog } from './api-BhMVpzwg.mjs';
3
3
  import { z } from 'zod';
4
4
  import fs, { writeFile as writeFile$1, rename, unlink as unlink$1 } from 'fs/promises';
5
5
  import os$1, { homedir } from 'os';
@@ -8458,8 +8458,23 @@ function createProcessStartupError(agentName, operationName, code, signal, stder
8458
8458
  normalizedStderrExcerpt
8459
8459
  );
8460
8460
  }
8461
- async function raceWithProcessExit(childProcess, operation, options) {
8462
- if (childProcess.exitCode !== null) {
8461
+ function isAcpConnectionClosedError(error) {
8462
+ return error.message.trim() === "ACP connection closed";
8463
+ }
8464
+ function createCurrentProcessExitError(childProcess, options) {
8465
+ if (childProcess.exitCode !== null || childProcess.signalCode !== null) {
8466
+ return createProcessStartupError(
8467
+ options.agentName,
8468
+ options.operationName,
8469
+ childProcess.exitCode,
8470
+ childProcess.signalCode ?? null,
8471
+ options.getStderrExcerpt?.()
8472
+ );
8473
+ }
8474
+ return null;
8475
+ }
8476
+ async function raceWithProcessExit(childProcess, operationFactory, options) {
8477
+ if (childProcess.exitCode !== null || childProcess.signalCode !== null) {
8463
8478
  throw createProcessStartupError(
8464
8479
  options.agentName,
8465
8480
  options.operationName,
@@ -8470,7 +8485,12 @@ async function raceWithProcessExit(childProcess, operation, options) {
8470
8485
  }
8471
8486
  return await new Promise((resolve, reject) => {
8472
8487
  let settled = false;
8488
+ let closedConnectionFallbackTimeout = null;
8473
8489
  const cleanup = () => {
8490
+ if (closedConnectionFallbackTimeout) {
8491
+ clearTimeout(closedConnectionFallbackTimeout);
8492
+ closedConnectionFallbackTimeout = null;
8493
+ }
8474
8494
  childProcess.off("error", handleError);
8475
8495
  childProcess.off("exit", handleExit);
8476
8496
  };
@@ -8482,13 +8502,29 @@ async function raceWithProcessExit(childProcess, operation, options) {
8482
8502
  cleanup();
8483
8503
  resolve(value);
8484
8504
  };
8485
- const settleReject = (error) => {
8505
+ const rejectWithNormalizedError = (error) => {
8486
8506
  if (settled) {
8487
8507
  return;
8488
8508
  }
8489
8509
  settled = true;
8490
8510
  cleanup();
8491
- reject(normalizeAcpError(error));
8511
+ reject(error);
8512
+ };
8513
+ const settleReject = (error) => {
8514
+ const normalizedError = normalizeAcpError(error);
8515
+ const currentProcessExitError = createCurrentProcessExitError(childProcess, options);
8516
+ if (currentProcessExitError && isAcpConnectionClosedError(normalizedError)) {
8517
+ rejectWithNormalizedError(currentProcessExitError);
8518
+ return;
8519
+ }
8520
+ if (!settled && !currentProcessExitError && !closedConnectionFallbackTimeout && isAcpConnectionClosedError(normalizedError)) {
8521
+ closedConnectionFallbackTimeout = setTimeout(() => {
8522
+ closedConnectionFallbackTimeout = null;
8523
+ rejectWithNormalizedError(normalizedError);
8524
+ }, 50);
8525
+ return;
8526
+ }
8527
+ rejectWithNormalizedError(normalizedError);
8492
8528
  };
8493
8529
  const handleError = (error) => {
8494
8530
  settleReject(error);
@@ -8506,6 +8542,13 @@ async function raceWithProcessExit(childProcess, operation, options) {
8506
8542
  };
8507
8543
  childProcess.once("error", handleError);
8508
8544
  childProcess.once("exit", handleExit);
8545
+ let operation;
8546
+ try {
8547
+ operation = operationFactory();
8548
+ } catch (error) {
8549
+ settleReject(error);
8550
+ return;
8551
+ }
8509
8552
  operation.then(settleResolve, settleReject);
8510
8553
  });
8511
8554
  }
@@ -9194,7 +9237,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9194
9237
  try {
9195
9238
  const result = await raceWithProcessExit(
9196
9239
  this.process,
9197
- Promise.race([
9240
+ () => Promise.race([
9198
9241
  this.connection.initialize(initRequest).then((res) => {
9199
9242
  if (timeoutHandle) {
9200
9243
  clearTimeout(timeoutHandle);
@@ -9247,7 +9290,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9247
9290
  try {
9248
9291
  const result = await raceWithProcessExit(
9249
9292
  this.process,
9250
- Promise.race([
9293
+ () => Promise.race([
9251
9294
  this.connection.newSession(newSessionRequest).then((res) => {
9252
9295
  if (timeoutHandle) {
9253
9296
  clearTimeout(timeoutHandle);
@@ -9492,7 +9535,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9492
9535
  logger.debug(`[AcpBackend] Prompt request:`, JSON.stringify(promptRequest, null, 2));
9493
9536
  await raceWithProcessExit(
9494
9537
  this.process,
9495
- this.connection.prompt(promptRequest),
9538
+ () => this.connection.prompt(promptRequest),
9496
9539
  {
9497
9540
  agentName: this.transport.agentName,
9498
9541
  operationName: "prompt",
@@ -11892,14 +11935,14 @@ var launch = /*#__PURE__*/Object.freeze({
11892
11935
  const unifiedProviderExecutors = {
11893
11936
  claude: async (opts) => {
11894
11937
  const claudeOptions = opts.claudeOptions ?? {};
11895
- const { runClaude } = await import('./runClaude-0U7kV07_.mjs');
11938
+ const { runClaude } = await import('./runClaude-BpwlCyVT.mjs');
11896
11939
  await runClaude(opts.credentials, {
11897
11940
  ...claudeOptions,
11898
11941
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
11899
11942
  });
11900
11943
  },
11901
11944
  codex: async (opts) => {
11902
- const { runCodex } = await import('./runCodex-DnDmHm7E.mjs');
11945
+ const { runCodex } = await import('./runCodex-BMNR2hNp.mjs');
11903
11946
  await runCodex({
11904
11947
  credentials: opts.credentials,
11905
11948
  startedBy: opts.startedBy,
@@ -11908,7 +11951,7 @@ const unifiedProviderExecutors = {
11908
11951
  });
11909
11952
  },
11910
11953
  gemini: async (opts) => {
11911
- const { runGemini } = await import('./runGemini-DcsIBQSc.mjs');
11954
+ const { runGemini } = await import('./runGemini-D4Af8oH1.mjs');
11912
11955
  await runGemini({
11913
11956
  credentials: opts.credentials,
11914
11957
  startedBy: opts.startedBy
@@ -11991,7 +12034,7 @@ function shouldRunMainClaudeFlow(opts) {
11991
12034
  return;
11992
12035
  } else if (subcommand === "runtime") {
11993
12036
  if (args[1] === "providers") {
11994
- const { renderRuntimeProviders } = await import('./command-W01qXC9C.mjs');
12037
+ const { renderRuntimeProviders } = await import('./command-h3Rr4Abu.mjs');
11995
12038
  console.log(renderRuntimeProviders());
11996
12039
  return;
11997
12040
  }
@@ -12197,8 +12240,8 @@ function shouldRunMainClaudeFlow(opts) {
12197
12240
  const projectId = args[3];
12198
12241
  try {
12199
12242
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
12200
- const { readCredentials: readCredentials2 } = await import('./api-B89O-SC-.mjs').then(function (n) { return n.X; });
12201
- const { ApiClient: ApiClient2 } = await import('./api-B89O-SC-.mjs').then(function (n) { return n.Y; });
12243
+ const { readCredentials: readCredentials2 } = await import('./api-BhMVpzwg.mjs').then(function (n) { return n.X; });
12244
+ const { ApiClient: ApiClient2 } = await import('./api-BhMVpzwg.mjs').then(function (n) { return n.Y; });
12202
12245
  let userEmail = void 0;
12203
12246
  try {
12204
12247
  const credentials = await readCredentials2();
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var persistence = require('./api-zMic8QXq.cjs');
4
+ var persistence = require('./api-BoWVQeVe.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-DVVbyQGZ.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-kIN8gN9G.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-DVVbyQGZ.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-kIN8gN9G.cjs', document.baseURI).href))));
641
641
  function projectPath() {
642
642
  const path = path$1.resolve(__dirname$2, "..");
643
643
  return path;
@@ -8480,8 +8480,23 @@ function createProcessStartupError(agentName, operationName, code, signal, stder
8480
8480
  normalizedStderrExcerpt
8481
8481
  );
8482
8482
  }
8483
- async function raceWithProcessExit(childProcess, operation, options) {
8484
- if (childProcess.exitCode !== null) {
8483
+ function isAcpConnectionClosedError(error) {
8484
+ return error.message.trim() === "ACP connection closed";
8485
+ }
8486
+ function createCurrentProcessExitError(childProcess, options) {
8487
+ if (childProcess.exitCode !== null || childProcess.signalCode !== null) {
8488
+ return createProcessStartupError(
8489
+ options.agentName,
8490
+ options.operationName,
8491
+ childProcess.exitCode,
8492
+ childProcess.signalCode ?? null,
8493
+ options.getStderrExcerpt?.()
8494
+ );
8495
+ }
8496
+ return null;
8497
+ }
8498
+ async function raceWithProcessExit(childProcess, operationFactory, options) {
8499
+ if (childProcess.exitCode !== null || childProcess.signalCode !== null) {
8485
8500
  throw createProcessStartupError(
8486
8501
  options.agentName,
8487
8502
  options.operationName,
@@ -8492,7 +8507,12 @@ async function raceWithProcessExit(childProcess, operation, options) {
8492
8507
  }
8493
8508
  return await new Promise((resolve, reject) => {
8494
8509
  let settled = false;
8510
+ let closedConnectionFallbackTimeout = null;
8495
8511
  const cleanup = () => {
8512
+ if (closedConnectionFallbackTimeout) {
8513
+ clearTimeout(closedConnectionFallbackTimeout);
8514
+ closedConnectionFallbackTimeout = null;
8515
+ }
8496
8516
  childProcess.off("error", handleError);
8497
8517
  childProcess.off("exit", handleExit);
8498
8518
  };
@@ -8504,13 +8524,29 @@ async function raceWithProcessExit(childProcess, operation, options) {
8504
8524
  cleanup();
8505
8525
  resolve(value);
8506
8526
  };
8507
- const settleReject = (error) => {
8527
+ const rejectWithNormalizedError = (error) => {
8508
8528
  if (settled) {
8509
8529
  return;
8510
8530
  }
8511
8531
  settled = true;
8512
8532
  cleanup();
8513
- reject(normalizeAcpError(error));
8533
+ reject(error);
8534
+ };
8535
+ const settleReject = (error) => {
8536
+ const normalizedError = normalizeAcpError(error);
8537
+ const currentProcessExitError = createCurrentProcessExitError(childProcess, options);
8538
+ if (currentProcessExitError && isAcpConnectionClosedError(normalizedError)) {
8539
+ rejectWithNormalizedError(currentProcessExitError);
8540
+ return;
8541
+ }
8542
+ if (!settled && !currentProcessExitError && !closedConnectionFallbackTimeout && isAcpConnectionClosedError(normalizedError)) {
8543
+ closedConnectionFallbackTimeout = setTimeout(() => {
8544
+ closedConnectionFallbackTimeout = null;
8545
+ rejectWithNormalizedError(normalizedError);
8546
+ }, 50);
8547
+ return;
8548
+ }
8549
+ rejectWithNormalizedError(normalizedError);
8514
8550
  };
8515
8551
  const handleError = (error) => {
8516
8552
  settleReject(error);
@@ -8528,6 +8564,13 @@ async function raceWithProcessExit(childProcess, operation, options) {
8528
8564
  };
8529
8565
  childProcess.once("error", handleError);
8530
8566
  childProcess.once("exit", handleExit);
8567
+ let operation;
8568
+ try {
8569
+ operation = operationFactory();
8570
+ } catch (error) {
8571
+ settleReject(error);
8572
+ return;
8573
+ }
8531
8574
  operation.then(settleResolve, settleReject);
8532
8575
  });
8533
8576
  }
@@ -9216,7 +9259,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9216
9259
  try {
9217
9260
  const result = await raceWithProcessExit(
9218
9261
  this.process,
9219
- Promise.race([
9262
+ () => Promise.race([
9220
9263
  this.connection.initialize(initRequest).then((res) => {
9221
9264
  if (timeoutHandle) {
9222
9265
  clearTimeout(timeoutHandle);
@@ -9269,7 +9312,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9269
9312
  try {
9270
9313
  const result = await raceWithProcessExit(
9271
9314
  this.process,
9272
- Promise.race([
9315
+ () => Promise.race([
9273
9316
  this.connection.newSession(newSessionRequest).then((res) => {
9274
9317
  if (timeoutHandle) {
9275
9318
  clearTimeout(timeoutHandle);
@@ -9514,7 +9557,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9514
9557
  persistence.logger.debug(`[AcpBackend] Prompt request:`, JSON.stringify(promptRequest, null, 2));
9515
9558
  await raceWithProcessExit(
9516
9559
  this.process,
9517
- this.connection.prompt(promptRequest),
9560
+ () => this.connection.prompt(promptRequest),
9518
9561
  {
9519
9562
  agentName: this.transport.agentName,
9520
9563
  operationName: "prompt",
@@ -10589,7 +10632,7 @@ class AbortError extends Error {
10589
10632
  }
10590
10633
  }
10591
10634
 
10592
- 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-DVVbyQGZ.cjs', document.baseURI).href)));
10635
+ 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-kIN8gN9G.cjs', document.baseURI).href)));
10593
10636
  const __dirname$1 = path.join(__filename$1, "..");
10594
10637
  function getGlobalClaudeVersion() {
10595
10638
  try {
@@ -11914,14 +11957,14 @@ var launch = /*#__PURE__*/Object.freeze({
11914
11957
  const unifiedProviderExecutors = {
11915
11958
  claude: async (opts) => {
11916
11959
  const claudeOptions = opts.claudeOptions ?? {};
11917
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-C1xfptKt.cjs'); });
11960
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-Dq9OISKt.cjs'); });
11918
11961
  await runClaude(opts.credentials, {
11919
11962
  ...claudeOptions,
11920
11963
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
11921
11964
  });
11922
11965
  },
11923
11966
  codex: async (opts) => {
11924
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BBgKpYLO.cjs'); });
11967
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BnzErOK_.cjs'); });
11925
11968
  await runCodex({
11926
11969
  credentials: opts.credentials,
11927
11970
  startedBy: opts.startedBy,
@@ -11930,7 +11973,7 @@ const unifiedProviderExecutors = {
11930
11973
  });
11931
11974
  },
11932
11975
  gemini: async (opts) => {
11933
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CUwQHJ9y.cjs'); });
11976
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CYc9Ufxo.cjs'); });
11934
11977
  await runGemini({
11935
11978
  credentials: opts.credentials,
11936
11979
  startedBy: opts.startedBy
@@ -12013,7 +12056,7 @@ function shouldRunMainClaudeFlow(opts) {
12013
12056
  return;
12014
12057
  } else if (subcommand === "runtime") {
12015
12058
  if (args[1] === "providers") {
12016
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-_qNFoJ-l.cjs'); });
12059
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DoF8oaxg.cjs'); });
12017
12060
  console.log(renderRuntimeProviders());
12018
12061
  return;
12019
12062
  }
@@ -12219,8 +12262,8 @@ function shouldRunMainClaudeFlow(opts) {
12219
12262
  const projectId = args[3];
12220
12263
  try {
12221
12264
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
12222
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-zMic8QXq.cjs'); }).then(function (n) { return n.persistence; });
12223
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-zMic8QXq.cjs'); }).then(function (n) { return n.api; });
12265
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-BoWVQeVe.cjs'); }).then(function (n) { return n.persistence; });
12266
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-BoWVQeVe.cjs'); }).then(function (n) { return n.api; });
12224
12267
  let userEmail = void 0;
12225
12268
  try {
12226
12269
  const credentials = await readCredentials2();
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./api-zMic8QXq.cjs');
4
+ require('./api-BoWVQeVe.cjs');
5
5
  require('zod');
6
- require('./index-DVVbyQGZ.cjs');
6
+ require('./index-kIN8gN9G.cjs');
7
7
  require('node:child_process');
8
8
  require('node:fs');
9
9
  require('cross-spawn');
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'chalk';
2
- import './api-B89O-SC-.mjs';
2
+ import './api-BhMVpzwg.mjs';
3
3
  import 'zod';
4
- import './index-CiHiCC31.mjs';
4
+ import './index-DxF1W0nt.mjs';
5
5
  import 'node:child_process';
6
6
  import 'node:fs';
7
7
  import 'cross-spawn';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-zMic8QXq.cjs');
3
+ var persistence = require('./api-BoWVQeVe.cjs');
4
4
  var types = require('./types-DVk3crez.cjs');
5
5
  require('axios');
6
6
  require('chalk');