happy-imou-cloud 2.1.48 → 2.1.50

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 (25) hide show
  1. package/dist/{BaseReasoningProcessor-CM3JbXUC.mjs → BaseReasoningProcessor-2qoX8OA1.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-CKtDfihV.cjs → BaseReasoningProcessor-D3q5lh9h.cjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-BHKIBw4t.cjs → ProviderSelectionHandler-CO5BYEgC.cjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-vgZ2egD_.mjs → ProviderSelectionHandler-CO6foZET.mjs} +2 -2
  5. package/dist/{api-CSjP-Z3Y.mjs → api-6B4EMs47.mjs} +1 -1
  6. package/dist/{api-eaGKJjMt.cjs → api-D4JOaMll.cjs} +1 -1
  7. package/dist/{command-BzPI4N1n.mjs → command-BbJCdR2t.mjs} +2 -2
  8. package/dist/{command-DDoz1Eky.cjs → command-DuKDmbdM.cjs} +2 -2
  9. package/dist/{index-C8X1VlHZ.cjs → index-CZJH0CUT.cjs} +109 -25
  10. package/dist/{index-BzsBo3_Z.mjs → index-CyGHrYHl.mjs} +106 -22
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.d.cts +2 -0
  15. package/dist/lib.d.mts +2 -0
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-CLCYBgZX.cjs → registerKillSessionHandler-Bo_MMbdY.cjs} +2 -2
  18. package/dist/{registerKillSessionHandler-BHu-3hZQ.mjs → registerKillSessionHandler-ggfGac_S.mjs} +2 -2
  19. package/dist/{runClaude-BkUbXE2F.cjs → runClaude-B4eoG3Pu.cjs} +4 -4
  20. package/dist/{runClaude-D3CBLW5o.mjs → runClaude-jDr3i0bO.mjs} +4 -4
  21. package/dist/{runCodex-DqzdgDwZ.mjs → runCodex-e_D1Jd_w.mjs} +267 -65
  22. package/dist/{runCodex-CdgrZK7P.cjs → runCodex-hDGeZAh5.cjs} +266 -64
  23. package/dist/{runGemini-BE05R24D.cjs → runGemini-CeA9aiD1.cjs} +4 -4
  24. package/dist/{runGemini-UZuiKe59.mjs → runGemini-Cur84FvO.mjs} +4 -4
  25. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { a as createSessionMetadata, p as publishSessionRegistration } from './index-BzsBo3_Z.mjs';
2
- import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-CSjP-Z3Y.mjs';
1
+ import { a as createSessionMetadata, p as publishSessionRegistration } from './index-CyGHrYHl.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './api-6B4EMs47.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-C8X1VlHZ.cjs');
4
- var persistence = require('./api-eaGKJjMt.cjs');
3
+ var index = require('./index-CZJH0CUT.cjs');
4
+ var persistence = require('./api-D4JOaMll.cjs');
5
5
  var node_events = require('node:events');
6
6
  var node_crypto = require('node:crypto');
7
7
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./api-eaGKJjMt.cjs');
4
- var registerKillSessionHandler = require('./registerKillSessionHandler-CLCYBgZX.cjs');
3
+ var persistence = require('./api-D4JOaMll.cjs');
4
+ var registerKillSessionHandler = require('./registerKillSessionHandler-Bo_MMbdY.cjs');
5
5
 
6
6
  async function runModeLoop(opts) {
7
7
  let currentMode = opts.startingMode;
@@ -1,5 +1,5 @@
1
- import { l as logger } from './api-CSjP-Z3Y.mjs';
2
- import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-BHu-3hZQ.mjs';
1
+ import { l as logger } from './api-6B4EMs47.mjs';
2
+ import { g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, a as INTERACTION_TIMED_OUT_ERROR } from './registerKillSessionHandler-ggfGac_S.mjs';
3
3
 
4
4
  async function runModeLoop(opts) {
5
5
  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.48";
21
+ var version = "2.1.50";
22
22
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
23
23
  var author = "long.zhu";
24
24
  var license = "MIT";
@@ -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.48";
41
+ var version = "2.1.50";
42
42
  var description = "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI";
43
43
  var author = "long.zhu";
44
44
  var license = "MIT";
@@ -1,6 +1,6 @@
1
- import { c as createDefaultRuntimeShell } from './index-BzsBo3_Z.mjs';
1
+ import { c as createDefaultRuntimeShell } from './index-CyGHrYHl.mjs';
2
2
  import 'chalk';
3
- import './api-CSjP-Z3Y.mjs';
3
+ import './api-6B4EMs47.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-C8X1VlHZ.cjs');
3
+ var index = require('./index-CZJH0CUT.cjs');
4
4
  require('chalk');
5
- require('./api-eaGKJjMt.cjs');
5
+ require('./api-D4JOaMll.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-eaGKJjMt.cjs');
4
+ var persistence = require('./api-D4JOaMll.cjs');
5
5
  var z = require('zod');
6
6
  var fs$2 = require('fs/promises');
7
7
  var os$1 = require('os');
@@ -52,7 +52,7 @@ async function openBrowser(url) {
52
52
  }
53
53
  }
54
54
 
55
- 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-C8X1VlHZ.cjs', document.baseURI).href)));
55
+ 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-CZJH0CUT.cjs', document.baseURI).href)));
56
56
  const QRCode = require$1("qrcode-terminal/vendor/QRCode");
57
57
  const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
58
58
  const pendingTempFiles = /* @__PURE__ */ new Set();
@@ -617,7 +617,7 @@ function setupCleanupHandlers() {
617
617
  });
618
618
  }
619
619
 
620
- 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-C8X1VlHZ.cjs', document.baseURI).href))));
620
+ 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-CZJH0CUT.cjs', document.baseURI).href))));
621
621
  function projectPath() {
622
622
  const path = path$1.resolve(__dirname$2, "..");
623
623
  return path;
@@ -2341,19 +2341,27 @@ function buildDaemonSpawnArgs(agent, optionsOrResume) {
2341
2341
  const options = isLegacyResumeOptions(optionsOrResume) ? { resume: optionsOrResume } : optionsOrResume ?? {};
2342
2342
  const startingMode = options.startingMode ?? "remote";
2343
2343
  const startedBy = options.startedBy ?? "daemon";
2344
+ const resolvedAgent = resolveDaemonSpawnAgent(agent);
2344
2345
  const args = [
2345
- resolveDaemonSpawnAgent(agent),
2346
+ resolvedAgent,
2346
2347
  "--happy-starting-mode",
2347
2348
  startingMode,
2348
2349
  "--started-by",
2349
2350
  startedBy
2350
2351
  ];
2351
2352
  const providerSessionId = typeof options.resume?.providerSessionId === "string" ? options.resume.providerSessionId.trim() : "";
2352
- if (providerSessionId.length > 0) {
2353
+ if (providerSessionId.length > 0 && supportsProviderResumeArg(resolvedAgent)) {
2353
2354
  args.push("--resume", providerSessionId);
2355
+ const providerSessionCwd = typeof options.resume?.providerSessionCwd === "string" ? options.resume.providerSessionCwd.trim() : "";
2356
+ if (providerSessionCwd.length > 0 && resolvedAgent === "codex") {
2357
+ args.push("--resume-cwd", providerSessionCwd);
2358
+ }
2354
2359
  }
2355
2360
  return args;
2356
2361
  }
2362
+ function supportsProviderResumeArg(agent) {
2363
+ return agent === "claude" || agent === "codex";
2364
+ }
2357
2365
  function buildTerminalWindowSpawnArgs(agent, resume) {
2358
2366
  return buildDaemonSpawnArgs(agent, {
2359
2367
  resume,
@@ -9064,6 +9072,69 @@ class AcpBackend {
9064
9072
  }
9065
9073
  return resolvePostPromptNoUpdatesTimeoutMs(this.transport);
9066
9074
  }
9075
+ getResponseWaitTimeoutMs(timeoutMs) {
9076
+ if (typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0) {
9077
+ return Math.trunc(timeoutMs);
9078
+ }
9079
+ return readPositiveIntegerEnv("HAPPY_ACP_RESPONSE_WAIT_TIMEOUT_MS") ?? readPositiveIntegerEnv("HAPPIER_ACP_RESPONSE_WAIT_TIMEOUT_MS") ?? resolveAcpResponseWaitTimeoutMs(this.sessionPreferences.timeoutProfile);
9080
+ }
9081
+ createPromptCompletionWatchdog(timeoutMs) {
9082
+ let timeoutHandle = null;
9083
+ let cancelled = false;
9084
+ const promise = new Promise((resolve, reject) => {
9085
+ const schedule = () => {
9086
+ if (cancelled) {
9087
+ return;
9088
+ }
9089
+ if (this.responseCompletionError) {
9090
+ reject(this.responseCompletionError);
9091
+ return;
9092
+ }
9093
+ if (!this.waitingForResponse) {
9094
+ resolve();
9095
+ return;
9096
+ }
9097
+ const lastProgressAt = this.responseLastProgressAt ?? Date.now();
9098
+ const elapsedMs = Math.max(0, Date.now() - lastProgressAt);
9099
+ const remainingMs = Math.max(1, timeoutMs - elapsedMs);
9100
+ timeoutHandle = setTimeout(() => {
9101
+ timeoutHandle = null;
9102
+ if (cancelled) {
9103
+ return;
9104
+ }
9105
+ if (this.responseCompletionError) {
9106
+ reject(this.responseCompletionError);
9107
+ return;
9108
+ }
9109
+ if (!this.waitingForResponse) {
9110
+ resolve();
9111
+ return;
9112
+ }
9113
+ const latestProgressAt = this.responseLastProgressAt ?? Date.now();
9114
+ const latestElapsedMs = Math.max(0, Date.now() - latestProgressAt);
9115
+ if (latestElapsedMs < timeoutMs) {
9116
+ schedule();
9117
+ return;
9118
+ }
9119
+ const timeoutLabel = formatToolCallTimeoutLimit(timeoutMs);
9120
+ const error = new Error(`Timeout waiting for Codex ACP prompt to complete after ${timeoutLabel} without response progress`);
9121
+ this.failPendingResponseWait(error);
9122
+ reject(error);
9123
+ }, remainingMs);
9124
+ };
9125
+ schedule();
9126
+ });
9127
+ return {
9128
+ promise,
9129
+ cancel: () => {
9130
+ cancelled = true;
9131
+ if (timeoutHandle) {
9132
+ clearTimeout(timeoutHandle);
9133
+ timeoutHandle = null;
9134
+ }
9135
+ }
9136
+ };
9137
+ }
9067
9138
  clearIdleTimeoutState() {
9068
9139
  if (this.idleTimeout) {
9069
9140
  clearTimeout(this.idleTimeout);
@@ -9915,15 +9986,23 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9915
9986
  prompt: [contentBlock]
9916
9987
  };
9917
9988
  persistence.logger.debug(`[AcpBackend] Prompt request:`, JSON.stringify(promptRequest, null, 2));
9918
- await raceWithProcessExit(
9919
- this.process,
9920
- () => this.connection.prompt(promptRequest),
9921
- {
9922
- agentName: this.transport.agentName,
9923
- operationName: "prompt",
9924
- getStderrExcerpt: () => this.getRecentStderrExcerpt()
9925
- }
9926
- );
9989
+ const promptWatchdog = this.createPromptCompletionWatchdog(this.getResponseWaitTimeoutMs());
9990
+ try {
9991
+ await raceWithProcessExit(
9992
+ this.process,
9993
+ () => Promise.race([
9994
+ this.connection.prompt(promptRequest),
9995
+ promptWatchdog.promise
9996
+ ]),
9997
+ {
9998
+ agentName: this.transport.agentName,
9999
+ operationName: "prompt",
10000
+ getStderrExcerpt: () => this.getRecentStderrExcerpt()
10001
+ }
10002
+ );
10003
+ } finally {
10004
+ promptWatchdog.cancel();
10005
+ }
9927
10006
  persistence.logger.debug("[AcpBackend] Prompt request sent to ACP connection");
9928
10007
  if (this.waitingForResponse && this.activeToolCalls.size === 0 && this.sawSessionUpdateSincePrompt === false) {
9929
10008
  const noUpdatesTimeoutMs = this.getPostPromptNoUpdatesTimeoutMs();
@@ -9986,7 +10065,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9986
10065
  if (!this.waitingForResponse) {
9987
10066
  return;
9988
10067
  }
9989
- const effectiveTimeoutMs = timeoutMs ?? resolveAcpResponseWaitTimeoutMs(this.sessionPreferences.timeoutProfile);
10068
+ const effectiveTimeoutMs = this.getResponseWaitTimeoutMs(timeoutMs);
9990
10069
  return new Promise((resolve, reject) => {
9991
10070
  this.idleResolver = () => {
9992
10071
  this.idleResolver = null;
@@ -10320,7 +10399,7 @@ function registerGeminiAgent() {
10320
10399
  persistence.logger.debug("[Gemini] Registered with agent registry");
10321
10400
  }
10322
10401
 
10323
- const DEFAULT_CODEX_ACP_NPX_PACKAGE = "@zed-industries/codex-acp@0.10.0";
10402
+ const DEFAULT_CODEX_ACP_NPX_PACKAGE = "@zed-industries/codex-acp@0.14.0";
10324
10403
  function readFirstEnv(...names) {
10325
10404
  for (const name of names) {
10326
10405
  const raw = process.env[name];
@@ -11169,7 +11248,7 @@ class AbortError extends Error {
11169
11248
  }
11170
11249
  }
11171
11250
 
11172
- 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-C8X1VlHZ.cjs', document.baseURI).href)));
11251
+ 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-CZJH0CUT.cjs', document.baseURI).href)));
11173
11252
  const __dirname$1 = path.join(__filename$1, "..");
11174
11253
  function getGlobalClaudeVersion() {
11175
11254
  try {
@@ -12494,23 +12573,24 @@ var launch = /*#__PURE__*/Object.freeze({
12494
12573
  const unifiedProviderExecutors = {
12495
12574
  claude: async (opts) => {
12496
12575
  const claudeOptions = opts.claudeOptions ?? {};
12497
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-BkUbXE2F.cjs'); });
12576
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-B4eoG3Pu.cjs'); });
12498
12577
  await runClaude(opts.credentials, {
12499
12578
  ...claudeOptions,
12500
12579
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
12501
12580
  });
12502
12581
  },
12503
12582
  codex: async (opts) => {
12504
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CdgrZK7P.cjs'); });
12583
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-hDGeZAh5.cjs'); });
12505
12584
  await runCodex({
12506
12585
  credentials: opts.credentials,
12507
12586
  startedBy: opts.startedBy,
12508
12587
  startingMode: opts.startingMode ?? (opts.startedBy === "daemon" ? "remote" : "local"),
12509
- codexArgs: opts.codexArgs ?? []
12588
+ codexArgs: opts.codexArgs ?? [],
12589
+ resumeSessionCwd: opts.resumeSessionCwd
12510
12590
  });
12511
12591
  },
12512
12592
  gemini: async (opts) => {
12513
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BE05R24D.cjs'); });
12593
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-CeA9aiD1.cjs'); });
12514
12594
  await runGemini({
12515
12595
  credentials: opts.credentials,
12516
12596
  startedBy: opts.startedBy
@@ -12593,7 +12673,7 @@ function shouldRunMainClaudeFlow(opts) {
12593
12673
  return;
12594
12674
  } else if (subcommand === "runtime") {
12595
12675
  if (args[1] === "providers") {
12596
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DDoz1Eky.cjs'); });
12676
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-DuKDmbdM.cjs'); });
12597
12677
  console.log(renderRuntimeProviders());
12598
12678
  return;
12599
12679
  }
@@ -12676,12 +12756,15 @@ function shouldRunMainClaudeFlow(opts) {
12676
12756
  try {
12677
12757
  let startedBy = void 0;
12678
12758
  let startingMode = void 0;
12759
+ let resumeSessionCwd = null;
12679
12760
  const codexArgs = [];
12680
12761
  for (let i = 1; i < args.length; i++) {
12681
12762
  if (args[i] === "--started-by") {
12682
12763
  startedBy = args[++i];
12683
12764
  } else if (args[i] === "--happy-starting-mode") {
12684
12765
  startingMode = z.z.enum(["local", "remote"]).parse(args[++i]);
12766
+ } else if (args[i] === "--resume-cwd") {
12767
+ resumeSessionCwd = args[++i] ?? null;
12685
12768
  } else {
12686
12769
  codexArgs.push(args[i]);
12687
12770
  }
@@ -12690,7 +12773,8 @@ function shouldRunMainClaudeFlow(opts) {
12690
12773
  provider: "codex",
12691
12774
  startedBy,
12692
12775
  startingMode,
12693
- codexArgs
12776
+ codexArgs,
12777
+ resumeSessionCwd
12694
12778
  });
12695
12779
  } catch (error) {
12696
12780
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -12799,8 +12883,8 @@ function shouldRunMainClaudeFlow(opts) {
12799
12883
  const projectId = args[3];
12800
12884
  try {
12801
12885
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
12802
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-eaGKJjMt.cjs'); }).then(function (n) { return n.persistence; });
12803
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-eaGKJjMt.cjs'); }).then(function (n) { return n.api; });
12886
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./api-D4JOaMll.cjs'); }).then(function (n) { return n.persistence; });
12887
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-D4JOaMll.cjs'); }).then(function (n) { return n.api; });
12804
12888
  let userEmail = void 0;
12805
12889
  try {
12806
12890
  const credentials = await readCredentials2();
@@ -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 buildSessionRuntimeIndex, I as acquireDaemonLock, J as writeDaemonState, A as ApiClient, K as releaseDaemonLock, L as validateProfileForAgent, M as getProfileEnvironmentVariables, N as clearCredentials, O as clearMachineId, P as readHappyOrgDispatchTruthSnapshot, Q as processHappyOrgRepoRequests, R as readHappyOrgRepoTaskBoard, S as HappyOrgTurnReportSchema, T as recordHappyOrgTurnReport, U as MessageContentSchema, V as buildSocketAuth, W as encrypt, H as HeadTailPreviewBuffer, X as getLatestDaemonLog } from './api-CSjP-Z3Y.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 buildSessionRuntimeIndex, I as acquireDaemonLock, J as writeDaemonState, A as ApiClient, K as releaseDaemonLock, L as validateProfileForAgent, M as getProfileEnvironmentVariables, N as clearCredentials, O as clearMachineId, P as readHappyOrgDispatchTruthSnapshot, Q as processHappyOrgRepoRequests, R as readHappyOrgRepoTaskBoard, S as HappyOrgTurnReportSchema, T as recordHappyOrgTurnReport, U as MessageContentSchema, V as buildSocketAuth, W as encrypt, H as HeadTailPreviewBuffer, X as getLatestDaemonLog } from './api-6B4EMs47.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 as homedir$1 } from 'os';
@@ -2338,19 +2338,27 @@ function buildDaemonSpawnArgs(agent, optionsOrResume) {
2338
2338
  const options = isLegacyResumeOptions(optionsOrResume) ? { resume: optionsOrResume } : optionsOrResume ?? {};
2339
2339
  const startingMode = options.startingMode ?? "remote";
2340
2340
  const startedBy = options.startedBy ?? "daemon";
2341
+ const resolvedAgent = resolveDaemonSpawnAgent(agent);
2341
2342
  const args = [
2342
- resolveDaemonSpawnAgent(agent),
2343
+ resolvedAgent,
2343
2344
  "--happy-starting-mode",
2344
2345
  startingMode,
2345
2346
  "--started-by",
2346
2347
  startedBy
2347
2348
  ];
2348
2349
  const providerSessionId = typeof options.resume?.providerSessionId === "string" ? options.resume.providerSessionId.trim() : "";
2349
- if (providerSessionId.length > 0) {
2350
+ if (providerSessionId.length > 0 && supportsProviderResumeArg(resolvedAgent)) {
2350
2351
  args.push("--resume", providerSessionId);
2352
+ const providerSessionCwd = typeof options.resume?.providerSessionCwd === "string" ? options.resume.providerSessionCwd.trim() : "";
2353
+ if (providerSessionCwd.length > 0 && resolvedAgent === "codex") {
2354
+ args.push("--resume-cwd", providerSessionCwd);
2355
+ }
2351
2356
  }
2352
2357
  return args;
2353
2358
  }
2359
+ function supportsProviderResumeArg(agent) {
2360
+ return agent === "claude" || agent === "codex";
2361
+ }
2354
2362
  function buildTerminalWindowSpawnArgs(agent, resume) {
2355
2363
  return buildDaemonSpawnArgs(agent, {
2356
2364
  resume,
@@ -9061,6 +9069,69 @@ class AcpBackend {
9061
9069
  }
9062
9070
  return resolvePostPromptNoUpdatesTimeoutMs(this.transport);
9063
9071
  }
9072
+ getResponseWaitTimeoutMs(timeoutMs) {
9073
+ if (typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0) {
9074
+ return Math.trunc(timeoutMs);
9075
+ }
9076
+ return readPositiveIntegerEnv("HAPPY_ACP_RESPONSE_WAIT_TIMEOUT_MS") ?? readPositiveIntegerEnv("HAPPIER_ACP_RESPONSE_WAIT_TIMEOUT_MS") ?? resolveAcpResponseWaitTimeoutMs(this.sessionPreferences.timeoutProfile);
9077
+ }
9078
+ createPromptCompletionWatchdog(timeoutMs) {
9079
+ let timeoutHandle = null;
9080
+ let cancelled = false;
9081
+ const promise = new Promise((resolve, reject) => {
9082
+ const schedule = () => {
9083
+ if (cancelled) {
9084
+ return;
9085
+ }
9086
+ if (this.responseCompletionError) {
9087
+ reject(this.responseCompletionError);
9088
+ return;
9089
+ }
9090
+ if (!this.waitingForResponse) {
9091
+ resolve();
9092
+ return;
9093
+ }
9094
+ const lastProgressAt = this.responseLastProgressAt ?? Date.now();
9095
+ const elapsedMs = Math.max(0, Date.now() - lastProgressAt);
9096
+ const remainingMs = Math.max(1, timeoutMs - elapsedMs);
9097
+ timeoutHandle = setTimeout(() => {
9098
+ timeoutHandle = null;
9099
+ if (cancelled) {
9100
+ return;
9101
+ }
9102
+ if (this.responseCompletionError) {
9103
+ reject(this.responseCompletionError);
9104
+ return;
9105
+ }
9106
+ if (!this.waitingForResponse) {
9107
+ resolve();
9108
+ return;
9109
+ }
9110
+ const latestProgressAt = this.responseLastProgressAt ?? Date.now();
9111
+ const latestElapsedMs = Math.max(0, Date.now() - latestProgressAt);
9112
+ if (latestElapsedMs < timeoutMs) {
9113
+ schedule();
9114
+ return;
9115
+ }
9116
+ const timeoutLabel = formatToolCallTimeoutLimit(timeoutMs);
9117
+ const error = new Error(`Timeout waiting for Codex ACP prompt to complete after ${timeoutLabel} without response progress`);
9118
+ this.failPendingResponseWait(error);
9119
+ reject(error);
9120
+ }, remainingMs);
9121
+ };
9122
+ schedule();
9123
+ });
9124
+ return {
9125
+ promise,
9126
+ cancel: () => {
9127
+ cancelled = true;
9128
+ if (timeoutHandle) {
9129
+ clearTimeout(timeoutHandle);
9130
+ timeoutHandle = null;
9131
+ }
9132
+ }
9133
+ };
9134
+ }
9064
9135
  clearIdleTimeoutState() {
9065
9136
  if (this.idleTimeout) {
9066
9137
  clearTimeout(this.idleTimeout);
@@ -9912,15 +9983,23 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9912
9983
  prompt: [contentBlock]
9913
9984
  };
9914
9985
  logger.debug(`[AcpBackend] Prompt request:`, JSON.stringify(promptRequest, null, 2));
9915
- await raceWithProcessExit(
9916
- this.process,
9917
- () => this.connection.prompt(promptRequest),
9918
- {
9919
- agentName: this.transport.agentName,
9920
- operationName: "prompt",
9921
- getStderrExcerpt: () => this.getRecentStderrExcerpt()
9922
- }
9923
- );
9986
+ const promptWatchdog = this.createPromptCompletionWatchdog(this.getResponseWaitTimeoutMs());
9987
+ try {
9988
+ await raceWithProcessExit(
9989
+ this.process,
9990
+ () => Promise.race([
9991
+ this.connection.prompt(promptRequest),
9992
+ promptWatchdog.promise
9993
+ ]),
9994
+ {
9995
+ agentName: this.transport.agentName,
9996
+ operationName: "prompt",
9997
+ getStderrExcerpt: () => this.getRecentStderrExcerpt()
9998
+ }
9999
+ );
10000
+ } finally {
10001
+ promptWatchdog.cancel();
10002
+ }
9924
10003
  logger.debug("[AcpBackend] Prompt request sent to ACP connection");
9925
10004
  if (this.waitingForResponse && this.activeToolCalls.size === 0 && this.sawSessionUpdateSincePrompt === false) {
9926
10005
  const noUpdatesTimeoutMs = this.getPostPromptNoUpdatesTimeoutMs();
@@ -9983,7 +10062,7 @@ Recent stderr: ${recentStderrSummaryLine}` : `Signal: ${signal}`;
9983
10062
  if (!this.waitingForResponse) {
9984
10063
  return;
9985
10064
  }
9986
- const effectiveTimeoutMs = timeoutMs ?? resolveAcpResponseWaitTimeoutMs(this.sessionPreferences.timeoutProfile);
10065
+ const effectiveTimeoutMs = this.getResponseWaitTimeoutMs(timeoutMs);
9987
10066
  return new Promise((resolve, reject) => {
9988
10067
  this.idleResolver = () => {
9989
10068
  this.idleResolver = null;
@@ -10317,7 +10396,7 @@ function registerGeminiAgent() {
10317
10396
  logger.debug("[Gemini] Registered with agent registry");
10318
10397
  }
10319
10398
 
10320
- const DEFAULT_CODEX_ACP_NPX_PACKAGE = "@zed-industries/codex-acp@0.10.0";
10399
+ const DEFAULT_CODEX_ACP_NPX_PACKAGE = "@zed-industries/codex-acp@0.14.0";
10321
10400
  function readFirstEnv(...names) {
10322
10401
  for (const name of names) {
10323
10402
  const raw = process.env[name];
@@ -12491,23 +12570,24 @@ var launch = /*#__PURE__*/Object.freeze({
12491
12570
  const unifiedProviderExecutors = {
12492
12571
  claude: async (opts) => {
12493
12572
  const claudeOptions = opts.claudeOptions ?? {};
12494
- const { runClaude } = await import('./runClaude-D3CBLW5o.mjs');
12573
+ const { runClaude } = await import('./runClaude-jDr3i0bO.mjs');
12495
12574
  await runClaude(opts.credentials, {
12496
12575
  ...claudeOptions,
12497
12576
  startingMode: claudeOptions.startingMode ?? (claudeOptions.startedBy === "daemon" ? "remote" : void 0)
12498
12577
  });
12499
12578
  },
12500
12579
  codex: async (opts) => {
12501
- const { runCodex } = await import('./runCodex-DqzdgDwZ.mjs');
12580
+ const { runCodex } = await import('./runCodex-e_D1Jd_w.mjs');
12502
12581
  await runCodex({
12503
12582
  credentials: opts.credentials,
12504
12583
  startedBy: opts.startedBy,
12505
12584
  startingMode: opts.startingMode ?? (opts.startedBy === "daemon" ? "remote" : "local"),
12506
- codexArgs: opts.codexArgs ?? []
12585
+ codexArgs: opts.codexArgs ?? [],
12586
+ resumeSessionCwd: opts.resumeSessionCwd
12507
12587
  });
12508
12588
  },
12509
12589
  gemini: async (opts) => {
12510
- const { runGemini } = await import('./runGemini-UZuiKe59.mjs');
12590
+ const { runGemini } = await import('./runGemini-Cur84FvO.mjs');
12511
12591
  await runGemini({
12512
12592
  credentials: opts.credentials,
12513
12593
  startedBy: opts.startedBy
@@ -12590,7 +12670,7 @@ function shouldRunMainClaudeFlow(opts) {
12590
12670
  return;
12591
12671
  } else if (subcommand === "runtime") {
12592
12672
  if (args[1] === "providers") {
12593
- const { renderRuntimeProviders } = await import('./command-BzPI4N1n.mjs');
12673
+ const { renderRuntimeProviders } = await import('./command-BbJCdR2t.mjs');
12594
12674
  console.log(renderRuntimeProviders());
12595
12675
  return;
12596
12676
  }
@@ -12673,12 +12753,15 @@ function shouldRunMainClaudeFlow(opts) {
12673
12753
  try {
12674
12754
  let startedBy = void 0;
12675
12755
  let startingMode = void 0;
12756
+ let resumeSessionCwd = null;
12676
12757
  const codexArgs = [];
12677
12758
  for (let i = 1; i < args.length; i++) {
12678
12759
  if (args[i] === "--started-by") {
12679
12760
  startedBy = args[++i];
12680
12761
  } else if (args[i] === "--happy-starting-mode") {
12681
12762
  startingMode = z.enum(["local", "remote"]).parse(args[++i]);
12763
+ } else if (args[i] === "--resume-cwd") {
12764
+ resumeSessionCwd = args[++i] ?? null;
12682
12765
  } else {
12683
12766
  codexArgs.push(args[i]);
12684
12767
  }
@@ -12687,7 +12770,8 @@ function shouldRunMainClaudeFlow(opts) {
12687
12770
  provider: "codex",
12688
12771
  startedBy,
12689
12772
  startingMode,
12690
- codexArgs
12773
+ codexArgs,
12774
+ resumeSessionCwd
12691
12775
  });
12692
12776
  } catch (error) {
12693
12777
  console.error(chalk.red("Error:"), error instanceof Error ? error.message : "Unknown error");
@@ -12796,8 +12880,8 @@ function shouldRunMainClaudeFlow(opts) {
12796
12880
  const projectId = args[3];
12797
12881
  try {
12798
12882
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
12799
- const { readCredentials: readCredentials2 } = await import('./api-CSjP-Z3Y.mjs').then(function (n) { return n.Y; });
12800
- const { ApiClient: ApiClient2 } = await import('./api-CSjP-Z3Y.mjs').then(function (n) { return n.Z; });
12883
+ const { readCredentials: readCredentials2 } = await import('./api-6B4EMs47.mjs').then(function (n) { return n.Y; });
12884
+ const { ApiClient: ApiClient2 } = await import('./api-6B4EMs47.mjs').then(function (n) { return n.Z; });
12801
12885
  let userEmail = void 0;
12802
12886
  try {
12803
12887
  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-eaGKJjMt.cjs');
4
+ require('./api-D4JOaMll.cjs');
5
5
  require('zod');
6
- require('./index-C8X1VlHZ.cjs');
6
+ require('./index-CZJH0CUT.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-CSjP-Z3Y.mjs';
2
+ import './api-6B4EMs47.mjs';
3
3
  import 'zod';
4
- import './index-BzsBo3_Z.mjs';
4
+ import './index-CyGHrYHl.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-eaGKJjMt.cjs');
3
+ var persistence = require('./api-D4JOaMll.cjs');
4
4
  var types = require('./types-DVk3crez.cjs');
5
5
  require('axios');
6
6
  require('chalk');
package/dist/lib.d.cts CHANGED
@@ -3614,6 +3614,7 @@ type Metadata = {
3614
3614
  claudeSessionId?: string;
3615
3615
  claudeTranscriptPath?: string;
3616
3616
  codexSessionId?: string;
3617
+ codexSessionCwd?: string;
3617
3618
  tools?: string[];
3618
3619
  slashCommands?: string[];
3619
3620
  homeDir: string;
@@ -4032,6 +4033,7 @@ interface SpawnSessionOptions {
4032
4033
  }
4033
4034
  interface SpawnSessionResumeOptions {
4034
4035
  providerSessionId: string;
4036
+ providerSessionCwd?: string;
4035
4037
  }
4036
4038
  type SpawnSessionResult = {
4037
4039
  type: 'success';
package/dist/lib.d.mts CHANGED
@@ -3614,6 +3614,7 @@ type Metadata = {
3614
3614
  claudeSessionId?: string;
3615
3615
  claudeTranscriptPath?: string;
3616
3616
  codexSessionId?: string;
3617
+ codexSessionCwd?: string;
3617
3618
  tools?: string[];
3618
3619
  slashCommands?: string[];
3619
3620
  homeDir: string;
@@ -4032,6 +4033,7 @@ interface SpawnSessionOptions {
4032
4033
  }
4033
4034
  interface SpawnSessionResumeOptions {
4034
4035
  providerSessionId: string;
4036
+ providerSessionCwd?: string;
4035
4037
  }
4036
4038
  type SpawnSessionResult = {
4037
4039
  type: 'success';
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-CSjP-Z3Y.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-6B4EMs47.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
  'use strict';
2
2
 
3
- var index = require('./index-C8X1VlHZ.cjs');
4
- var persistence = require('./api-eaGKJjMt.cjs');
3
+ var index = require('./index-CZJH0CUT.cjs');
4
+ var persistence = require('./api-D4JOaMll.cjs');
5
5
  var node_crypto = require('node:crypto');
6
6
  var path = require('node:path');
7
7
  require('axios');