happy-imou-cloud 2.0.16 → 2.0.18

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 (31) hide show
  1. package/bin/happy-cloud.mjs +1 -1
  2. package/dist/{BaseReasoningProcessor-C04_LHjN.mjs → BaseReasoningProcessor-DajL_jtA.mjs} +3 -3
  3. package/dist/{BaseReasoningProcessor-BqMAZlIw.cjs → BaseReasoningProcessor-DrAN-2bw.cjs} +3 -3
  4. package/dist/{ProviderSelectionHandler-CO9NkAt6.cjs → ProviderSelectionHandler-BOAcP_CE.cjs} +2 -2
  5. package/dist/{ProviderSelectionHandler-DDWyn9Lo.mjs → ProviderSelectionHandler-DiHuEbf_.mjs} +2 -2
  6. package/dist/{api-sRF6xXi-.mjs → api-DLI3Zloa.mjs} +90 -38
  7. package/dist/{api-Db1SQcP_.cjs → api-eDp10nsY.cjs} +90 -37
  8. package/dist/{command-eRjSBm2C.cjs → command-BJu-MaCp.cjs} +3 -3
  9. package/dist/{command-WcgGTRnG.mjs → command-BYxsn0_c.mjs} +3 -3
  10. package/dist/{index-DpWeKfvS.mjs → index-CjWtQyJu.mjs} +77 -25
  11. package/dist/{index-B6ID1zDR.cjs → index-bzGCZJLB.cjs} +80 -28
  12. package/dist/index.cjs +3 -3
  13. package/dist/index.mjs +3 -3
  14. package/dist/lib.cjs +1 -1
  15. package/dist/lib.mjs +1 -1
  16. package/dist/{persistence-Btu2VPXI.cjs → persistence-CSaoFYvt.cjs} +1 -1
  17. package/dist/{persistence-B89V4xY5.mjs → persistence-DicQpgl6.mjs} +1 -1
  18. package/dist/{registerKillSessionHandler-CwmYlUfS.mjs → registerKillSessionHandler-BWCjaf5S.mjs} +3 -3
  19. package/dist/{registerKillSessionHandler-eZ2TsHqx.cjs → registerKillSessionHandler-BeMsOt9D.cjs} +3 -3
  20. package/dist/{runClaude-kRPXCaBj.mjs → runClaude-BaDVGV4k.mjs} +5 -5
  21. package/dist/{runClaude-C9-ylbQh.cjs → runClaude-CERpGT0L.cjs} +5 -5
  22. package/dist/{runCodex-B1xN0wAU.mjs → runCodex-Bik9wE7F.mjs} +45 -11
  23. package/dist/{runCodex-CRNBxY5f.cjs → runCodex-Z12g3g5P.cjs} +45 -11
  24. package/dist/{runGemini-Xn2VwS88.mjs → runGemini-Bh59hP_q.mjs} +5 -5
  25. package/dist/{runGemini-BZ5hqJyl.cjs → runGemini-Chas-o_m.cjs} +5 -5
  26. package/package.json +1 -1
  27. package/scripts/build.mjs +66 -66
  28. package/scripts/devtools/README.md +9 -9
  29. package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
  30. package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
  31. package/scripts/release-smoke.mjs +15 -12
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var api = require('./api-Db1SQcP_.cjs');
5
- var persistence = require('./persistence-Btu2VPXI.cjs');
4
+ var api = require('./api-eDp10nsY.cjs');
5
+ var persistence = require('./persistence-CSaoFYvt.cjs');
6
6
  var z = require('zod');
7
7
  var fs$2 = require('fs/promises');
8
8
  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-B6ID1zDR.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-bzGCZJLB.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();
@@ -695,7 +695,7 @@ function setupCleanupHandlers() {
695
695
  });
696
696
  }
697
697
 
698
- 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-B6ID1zDR.cjs', document.baseURI).href))));
698
+ 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-bzGCZJLB.cjs', document.baseURI).href))));
699
699
  function projectPath() {
700
700
  const path = path$1.resolve(__dirname$2, "..");
701
701
  return path;
@@ -4986,6 +4986,8 @@ const cursorTransport = new CursorTransport();
4986
4986
 
4987
4987
  const DEFAULT_IDLE_TIMEOUT_MS = 500;
4988
4988
  const DEFAULT_TOOL_CALL_TIMEOUT_MS = 12e4;
4989
+ const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_HEAD_BYTES = 2e3;
4990
+ const DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_TAIL_BYTES = 4e3;
4989
4991
  function parseArgsFromContent(content) {
4990
4992
  if (Array.isArray(content)) {
4991
4993
  return { items: content };
@@ -4995,17 +4997,54 @@ function parseArgsFromContent(content) {
4995
4997
  }
4996
4998
  return {};
4997
4999
  }
4998
- function appendToolOutput(existing, next) {
4999
- if (!existing || existing.length === 0) {
5000
- return next;
5000
+ const MAX_TOOL_OUTPUT_OVERLAP_CHARS = 4096;
5001
+ function findToolOutputOverlap(previous, next) {
5002
+ const maxOverlap = Math.min(previous.length, next.length, MAX_TOOL_OUTPUT_OVERLAP_CHARS);
5003
+ if (maxOverlap === 0) {
5004
+ return 0;
5001
5005
  }
5002
- if (next === existing || existing.endsWith(next)) {
5003
- return existing;
5006
+ const previousSuffix = previous.slice(-maxOverlap);
5007
+ const nextPrefix = next.slice(0, maxOverlap);
5008
+ for (let overlap = maxOverlap; overlap > 0; overlap--) {
5009
+ if (previousSuffix.endsWith(nextPrefix.slice(0, overlap))) {
5010
+ return overlap;
5011
+ }
5004
5012
  }
5005
- if (next.startsWith(existing)) {
5013
+ return 0;
5014
+ }
5015
+ function getToolOutputDelta(previous, next) {
5016
+ if (!previous || previous.length === 0) {
5006
5017
  return next;
5007
5018
  }
5008
- return `${existing}${next}`;
5019
+ if (next === previous || previous.endsWith(next)) {
5020
+ return "";
5021
+ }
5022
+ if (next.startsWith(previous)) {
5023
+ return next.slice(previous.length);
5024
+ }
5025
+ const overlap = findToolOutputOverlap(previous, next);
5026
+ return overlap > 0 ? next.slice(overlap) : next;
5027
+ }
5028
+ function appendToolOutput(existing, next) {
5029
+ const preview = existing?.preview ?? new api.HeadTailPreviewBuffer(
5030
+ DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_HEAD_BYTES,
5031
+ DEFAULT_TOOL_CALL_OUTPUT_PREVIEW_TAIL_BYTES
5032
+ );
5033
+ const textToAppend = getToolOutputDelta(existing?.lastRawText, next);
5034
+ if (textToAppend.length > 0) {
5035
+ preview.append(textToAppend);
5036
+ }
5037
+ return {
5038
+ preview,
5039
+ lastRawText: next,
5040
+ updateCount: (existing?.updateCount ?? 0) + 1
5041
+ };
5042
+ }
5043
+ function renderToolOutput(accumulator) {
5044
+ if (!accumulator) {
5045
+ return void 0;
5046
+ }
5047
+ return accumulator.preview.render("tool output");
5009
5048
  }
5010
5049
  function isRecord$1(value) {
5011
5050
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -5243,7 +5282,7 @@ function completeToolCall(toolCallId, toolKind, content, ctx) {
5243
5282
  clearTimeout(timeout);
5244
5283
  ctx.toolCallTimeouts.delete(toolCallId);
5245
5284
  }
5246
- const streamedOutput = ctx.toolCallOutputs.get(toolCallId);
5285
+ const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
5247
5286
  ctx.toolCallOutputs.delete(toolCallId);
5248
5287
  api.logger.debug(`[AcpBackend] \u2705 Tool call COMPLETED: ${toolCallId} (${toolKindStr}) - Duration: ${duration}. Active tool calls: ${ctx.activeToolCalls.size}`);
5249
5288
  ctx.emit({
@@ -5291,7 +5330,7 @@ function failToolCall(toolCallId, status, toolKind, content, ctx) {
5291
5330
  }
5292
5331
  const durationStr = formatDuration(startTime);
5293
5332
  api.logger.debug(`[AcpBackend] \u274C Tool call ${status.toUpperCase()}: ${toolCallId} (${toolKindStr}) - Duration: ${durationStr}. Active tool calls: ${ctx.activeToolCalls.size}`);
5294
- const streamedOutput = ctx.toolCallOutputs.get(toolCallId);
5333
+ const streamedOutput = renderToolOutput(ctx.toolCallOutputs.get(toolCallId));
5295
5334
  ctx.toolCallOutputs.delete(toolCallId);
5296
5335
  const errorDetail = extractErrorDetail(content);
5297
5336
  if (errorDetail) {
@@ -6127,14 +6166,27 @@ class AcpBackend {
6127
6166
  this.emit({ type: "status", status: "error", detail: err.message });
6128
6167
  });
6129
6168
  this.process.on("exit", (code, signal) => {
6130
- if (!this.disposed && code !== 0 && code !== null) {
6131
- if (this.waitingForResponse) {
6132
- this.failPendingResponseWait(
6133
- new Error(`ACP process exited with code ${code}${signal ? ` (${signal})` : ""}`)
6134
- );
6135
- }
6136
- api.logger.debug(`[AcpBackend] Process exited with code ${code}, signal ${signal}`);
6169
+ api.logger.debug(
6170
+ `[AcpBackend] Process exited with code ${code}, signal ${signal}, disposed=${this.disposed}, waitingForResponse=${this.waitingForResponse}`
6171
+ );
6172
+ const recentStderrExcerpt = this.getRecentStderrExcerpt();
6173
+ if (recentStderrExcerpt) {
6174
+ api.logger.debug(`[AcpBackend] Recent stderr before exit:
6175
+ ${recentStderrExcerpt}`);
6176
+ }
6177
+ if (this.disposed) {
6178
+ return;
6179
+ }
6180
+ if (this.waitingForResponse) {
6181
+ const detail = code !== null ? `ACP process exited with code ${code}${signal ? ` (${signal})` : ""}` : signal ? `ACP process exited with signal ${signal}` : "ACP process exited unexpectedly";
6182
+ this.failPendingResponseWait(new Error(detail));
6183
+ }
6184
+ if (code !== 0 && code !== null) {
6137
6185
  this.emit({ type: "status", status: "stopped", detail: `Exit code: ${code}` });
6186
+ return;
6187
+ }
6188
+ if (signal) {
6189
+ this.emit({ type: "status", status: "stopped", detail: `Signal: ${signal}` });
6138
6190
  }
6139
6191
  });
6140
6192
  const streams = nodeToWebStreams(
@@ -6505,7 +6557,7 @@ class AcpBackend {
6505
6557
  this.clearPostPromptCompletionIdleTimeout();
6506
6558
  for (const update of updates) {
6507
6559
  const sessionUpdateType = update.sessionUpdate;
6508
- if (sessionUpdateType !== "agent_message_chunk") {
6560
+ if (sessionUpdateType !== "agent_message_chunk" && sessionUpdateType !== "tool_call_update") {
6509
6561
  api.logger.debug(`[AcpBackend] Received session update: ${sessionUpdateType}`, JSON.stringify({
6510
6562
  sessionUpdate: sessionUpdateType,
6511
6563
  toolCallId: update.toolCallId,
@@ -7474,7 +7526,7 @@ class AbortError extends Error {
7474
7526
  }
7475
7527
  }
7476
7528
 
7477
- 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-B6ID1zDR.cjs', document.baseURI).href)));
7529
+ 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-bzGCZJLB.cjs', document.baseURI).href)));
7478
7530
  const __dirname$1 = path.join(__filename$1, "..");
7479
7531
  function getGlobalClaudeVersion() {
7480
7532
  try {
@@ -8725,11 +8777,11 @@ var launch = /*#__PURE__*/Object.freeze({
8725
8777
 
8726
8778
  const unifiedProviderExecutors = {
8727
8779
  claude: async (opts) => {
8728
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-C9-ylbQh.cjs'); });
8780
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-CERpGT0L.cjs'); });
8729
8781
  await runClaude(opts.credentials, opts.claudeOptions ?? {});
8730
8782
  },
8731
8783
  codex: async (opts) => {
8732
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CRNBxY5f.cjs'); });
8784
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-Z12g3g5P.cjs'); });
8733
8785
  await runCodex({
8734
8786
  credentials: opts.credentials,
8735
8787
  startedBy: opts.startedBy,
@@ -8738,7 +8790,7 @@ const unifiedProviderExecutors = {
8738
8790
  });
8739
8791
  },
8740
8792
  gemini: async (opts) => {
8741
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-BZ5hqJyl.cjs'); });
8793
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-Chas-o_m.cjs'); });
8742
8794
  await runGemini({
8743
8795
  credentials: opts.credentials,
8744
8796
  startedBy: opts.startedBy
@@ -8814,7 +8866,7 @@ function shouldRunMainClaudeFlow(opts) {
8814
8866
  return;
8815
8867
  } else if (subcommand === "runtime") {
8816
8868
  if (args[1] === "providers") {
8817
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-eRjSBm2C.cjs'); });
8869
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-BJu-MaCp.cjs'); });
8818
8870
  console.log(renderRuntimeProviders());
8819
8871
  return;
8820
8872
  }
@@ -8992,8 +9044,8 @@ function shouldRunMainClaudeFlow(opts) {
8992
9044
  const projectId = args[3];
8993
9045
  try {
8994
9046
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
8995
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-Btu2VPXI.cjs'); });
8996
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-Db1SQcP_.cjs'); }).then(function (n) { return n.api; });
9047
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-CSaoFYvt.cjs'); });
9048
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-eDp10nsY.cjs'); }).then(function (n) { return n.api; });
8997
9049
  let userEmail = void 0;
8998
9050
  try {
8999
9051
  const credentials = await readCredentials2();
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./api-Db1SQcP_.cjs');
5
- require('./persistence-Btu2VPXI.cjs');
4
+ require('./api-eDp10nsY.cjs');
5
+ require('./persistence-CSaoFYvt.cjs');
6
6
  require('zod');
7
- require('./index-B6ID1zDR.cjs');
7
+ require('./index-bzGCZJLB.cjs');
8
8
  require('node:child_process');
9
9
  require('node:fs');
10
10
  require('cross-spawn');
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import 'chalk';
2
- import './api-sRF6xXi-.mjs';
3
- import './persistence-B89V4xY5.mjs';
2
+ import './api-DLI3Zloa.mjs';
3
+ import './persistence-DicQpgl6.mjs';
4
4
  import 'zod';
5
- import './index-DpWeKfvS.mjs';
5
+ import './index-CjWtQyJu.mjs';
6
6
  import 'node:child_process';
7
7
  import 'node:fs';
8
8
  import 'cross-spawn';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var api = require('./api-Db1SQcP_.cjs');
3
+ var api = require('./api-eDp10nsY.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-sRF6xXi-.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-DLI3Zloa.mjs';
2
2
  export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
3
3
  import 'axios';
4
4
  import 'chalk';
@@ -3,7 +3,7 @@
3
3
  var promises = require('node:fs/promises');
4
4
  var fs = require('node:fs');
5
5
  var path = require('node:path');
6
- var api = require('./api-Db1SQcP_.cjs');
6
+ var api = require('./api-eDp10nsY.cjs');
7
7
  var z = require('zod');
8
8
  require('axios');
9
9
  require('chalk');
@@ -1,7 +1,7 @@
1
1
  import { unlink, readFile, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
2
2
  import { existsSync, unlinkSync, readdirSync, constants, writeFileSync, readFileSync } from 'node:fs';
3
3
  import { join, dirname } from 'node:path';
4
- import { c as configuration, l as logger, e as encodeBase64 } from './api-sRF6xXi-.mjs';
4
+ import { c as configuration, l as logger, e as encodeBase64 } from './api-DLI3Zloa.mjs';
5
5
  import * as z from 'zod';
6
6
  import 'axios';
7
7
  import 'chalk';
@@ -1,8 +1,8 @@
1
- import { i as initialMachineMetadata, e as projectPath, R as RuntimeShell, h as resolveCanonicalToolNameV2, f as formatDisplayMessage } from './index-DpWeKfvS.mjs';
2
- import { readSettings } from './persistence-B89V4xY5.mjs';
1
+ import { i as initialMachineMetadata, e as projectPath, R as RuntimeShell, h as resolveCanonicalToolNameV2, f as formatDisplayMessage } from './index-CjWtQyJu.mjs';
2
+ import { readSettings } from './persistence-DicQpgl6.mjs';
3
3
  import os from 'node:os';
4
4
  import { resolve } from 'node:path';
5
- import { c as configuration, p as packageJson, l as logger } from './api-sRF6xXi-.mjs';
5
+ import { c as configuration, p as packageJson, l as logger } from './api-DLI3Zloa.mjs';
6
6
  import { randomUUID } from 'node:crypto';
7
7
  import { createHash } from 'crypto';
8
8
  import 'axios';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-B6ID1zDR.cjs');
4
- var persistence = require('./persistence-Btu2VPXI.cjs');
3
+ var index = require('./index-bzGCZJLB.cjs');
4
+ var persistence = require('./persistence-CSaoFYvt.cjs');
5
5
  var os = require('node:os');
6
6
  var path = require('node:path');
7
- var api = require('./api-Db1SQcP_.cjs');
7
+ var api = require('./api-eDp10nsY.cjs');
8
8
  var node_crypto = require('node:crypto');
9
9
  var crypto = require('crypto');
10
10
  require('axios');
@@ -1,8 +1,8 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-sRF6xXi-.mjs';
2
+ import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DLI3Zloa.mjs';
3
3
  import 'cross-spawn';
4
4
  import '@agentclientprotocol/sdk';
5
- import { j as getProjectPath, F as Future, k as claudeLocal, E as ExitCodeError, l as trimIdent, m as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, n as claudeCheckSession, e as projectPath, o as mapToClaudeMode, P as PushableAsyncIterable, q as query, A as AbortError, b as stopCaffeinate, p as publishSessionRegistration, u as getEnvironmentInfo, w as startCaffeinate } from './index-DpWeKfvS.mjs';
5
+ import { j as getProjectPath, F as Future, k as claudeLocal, E as ExitCodeError, l as trimIdent, m as createClaudeBackend, f as formatDisplayMessage, t as truncateDisplayMessage, n as claudeCheckSession, e as projectPath, o as mapToClaudeMode, P as PushableAsyncIterable, q as query, A as AbortError, b as stopCaffeinate, p as publishSessionRegistration, u as getEnvironmentInfo, w as startCaffeinate } from './index-CjWtQyJu.mjs';
6
6
  import 'ps-list';
7
7
  import 'fs';
8
8
  import 'path';
@@ -13,7 +13,7 @@ import { dirname, basename, join, resolve } from 'node:path';
13
13
  import { homedir } from 'node:os';
14
14
  import { execSync } from 'node:child_process';
15
15
  import 'node:readline';
16
- import './persistence-B89V4xY5.mjs';
16
+ import './persistence-DicQpgl6.mjs';
17
17
  import { readFile } from 'node:fs/promises';
18
18
  import { stat, watch, access } from 'fs/promises';
19
19
  import 'crypto';
@@ -24,9 +24,9 @@ import 'tweetnacl';
24
24
  import 'open';
25
25
  import React, { useState, useRef, useEffect, useCallback } from 'react';
26
26
  import { useStdout, useInput, Box, Text, render } from 'ink';
27
- import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DDWyn9Lo.mjs';
27
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DiHuEbf_.mjs';
28
28
  import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
29
- import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, l as launchRuntimeHandleWithFactoryResult, j as forwardAgentMessageToProviderSession, s as syncControlledByUserState, e as ensureManagedProviderMachine, M as MissingMachineIdError, c as createSessionMetadata, b as MessageQueue2, h as hashObject, r as registerKillSessionHandler, f as closeProviderSession } from './registerKillSessionHandler-CwmYlUfS.mjs';
29
+ import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, l as launchRuntimeHandleWithFactoryResult, j as forwardAgentMessageToProviderSession, s as syncControlledByUserState, e as ensureManagedProviderMachine, M as MissingMachineIdError, c as createSessionMetadata, b as MessageQueue2, h as hashObject, r as registerKillSessionHandler, f as closeProviderSession } from './registerKillSessionHandler-BWCjaf5S.mjs';
30
30
  import 'socket.io-client';
31
31
  import 'expo-server-sdk';
32
32
  import { isDeepStrictEqual } from 'node:util';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var api = require('./api-Db1SQcP_.cjs');
4
+ var api = require('./api-eDp10nsY.cjs');
5
5
  require('cross-spawn');
6
6
  require('@agentclientprotocol/sdk');
7
- var index = require('./index-B6ID1zDR.cjs');
7
+ var index = require('./index-bzGCZJLB.cjs');
8
8
  require('ps-list');
9
9
  require('fs');
10
10
  require('path');
@@ -15,7 +15,7 @@ var path = require('node:path');
15
15
  var os = require('node:os');
16
16
  var node_child_process = require('node:child_process');
17
17
  require('node:readline');
18
- require('./persistence-Btu2VPXI.cjs');
18
+ require('./persistence-CSaoFYvt.cjs');
19
19
  var promises = require('node:fs/promises');
20
20
  var fs = require('fs/promises');
21
21
  require('crypto');
@@ -26,9 +26,9 @@ require('tweetnacl');
26
26
  require('open');
27
27
  var React = require('react');
28
28
  var ink = require('ink');
29
- var ProviderSelectionHandler = require('./ProviderSelectionHandler-CO9NkAt6.cjs');
29
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-BOAcP_CE.cjs');
30
30
  var types = require('./types-DVk3crez.cjs');
31
- var registerKillSessionHandler = require('./registerKillSessionHandler-eZ2TsHqx.cjs');
31
+ var registerKillSessionHandler = require('./registerKillSessionHandler-BeMsOt9D.cjs');
32
32
  require('socket.io-client');
33
33
  require('expo-server-sdk');
34
34
  var node_util = require('node:util');
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, b as connectionState, A as ApiClient } from './api-sRF6xXi-.mjs';
3
- import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, r as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession, f as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, s as syncControlledByUserState } from './registerKillSessionHandler-CwmYlUfS.mjs';
4
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-DpWeKfvS.mjs';
2
+ import { l as logger, b as connectionState, A as ApiClient } from './api-DLI3Zloa.mjs';
3
+ import { B as BasePermissionHandler, h as hashObject, d as MessageBuffer, C as ConversationHistory$1, w as waitForResponseCompleteWithAbort, r as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, i as inferToolResultError, j as forwardAgentMessageToProviderSession, f as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, s as syncControlledByUserState } from './registerKillSessionHandler-BWCjaf5S.mjs';
4
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-CjWtQyJu.mjs';
5
5
  import 'cross-spawn';
6
6
  import '@agentclientprotocol/sdk';
7
7
  import 'ps-list';
@@ -14,7 +14,7 @@ import 'node:path';
14
14
  import 'node:os';
15
15
  import 'node:child_process';
16
16
  import 'node:readline';
17
- import './persistence-B89V4xY5.mjs';
17
+ import './persistence-DicQpgl6.mjs';
18
18
  import 'node:fs/promises';
19
19
  import 'fs/promises';
20
20
  import 'crypto';
@@ -25,8 +25,8 @@ import 'tweetnacl';
25
25
  import 'open';
26
26
  import React, { useState, useRef, useEffect, useCallback } from 'react';
27
27
  import { useStdout, useInput, Box, Text, render } from 'ink';
28
- import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DDWyn9Lo.mjs';
29
- import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-C04_LHjN.mjs';
28
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-DiHuEbf_.mjs';
29
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-DajL_jtA.mjs';
30
30
  import 'socket.io-client';
31
31
  import 'zod';
32
32
  import 'expo-server-sdk';
@@ -483,6 +483,7 @@ async function codexRemoteLauncher(session) {
483
483
  let pending = null;
484
484
  let readyAlreadySent = false;
485
485
  let accumulatedResponse = "";
486
+ let emittedResponseLength = 0;
486
487
  let isResponseInProgress = false;
487
488
  let taskStartedSent = false;
488
489
  let shouldInjectHistoryOnNextSession = false;
@@ -515,6 +516,7 @@ async function codexRemoteLauncher(session) {
515
516
  const resetTurnState = () => {
516
517
  reasoningProcessor.abort();
517
518
  accumulatedResponse = "";
519
+ emittedResponseLength = 0;
518
520
  isResponseInProgress = false;
519
521
  taskStartedSent = false;
520
522
  shouldCommitAccumulatedResponse = false;
@@ -575,13 +577,23 @@ async function codexRemoteLauncher(session) {
575
577
  return;
576
578
  }
577
579
  conversationHistory.addAssistantMessage(accumulatedResponse);
580
+ emitPendingAssistantMessageDelta();
581
+ accumulatedResponse = "";
582
+ emittedResponseLength = 0;
583
+ isResponseInProgress = false;
584
+ };
585
+ const emitPendingAssistantMessageDelta = () => {
586
+ const nextMessage = accumulatedResponse.slice(emittedResponseLength);
587
+ if (!nextMessage.trim()) {
588
+ return false;
589
+ }
578
590
  session.runtimeSession.sendCodexMessage({
579
591
  type: "message",
580
- message: accumulatedResponse,
592
+ message: nextMessage,
581
593
  id: randomUUID()
582
594
  });
583
- accumulatedResponse = "";
584
- isResponseInProgress = false;
595
+ emittedResponseLength = accumulatedResponse.length;
596
+ return true;
585
597
  };
586
598
  const setupRuntimeMessageHandler = (activeRuntimeHandle) => {
587
599
  const forwardAgentMessage = (agentMessage) => {
@@ -631,10 +643,12 @@ async function codexRemoteLauncher(session) {
631
643
  return;
632
644
  }
633
645
  if (msg.status === "idle" || msg.status === "stopped") {
646
+ emitPendingAssistantMessageDelta();
634
647
  reasoningProcessor.completeCurrent();
635
648
  return;
636
649
  }
637
650
  if (msg.status === "error") {
651
+ emitPendingAssistantMessageDelta();
638
652
  const errorMessage = normalizeCodexBackendError(msg.detail);
639
653
  messageBuffer.addMessage(`Error: ${errorMessage}`, "status");
640
654
  return;
@@ -642,6 +656,7 @@ async function codexRemoteLauncher(session) {
642
656
  return;
643
657
  }
644
658
  case "tool-call": {
659
+ emitPendingAssistantMessageDelta();
645
660
  const toolArgs = msg.args ? truncateDisplayMessage(msg.args, 100) : "";
646
661
  messageBuffer.addMessage(
647
662
  `Executing: ${msg.toolName}${toolArgs ? ` ${toolArgs}` : ""}`,
@@ -832,6 +847,13 @@ async function codexRemoteLauncher(session) {
832
847
  const waitSignal = abortController.signal;
833
848
  const batch = await session.queue.waitForMessagesAndGetAsString(waitSignal);
834
849
  if (!batch) {
850
+ logger.debug("[Codex] Message wait returned no batch", {
851
+ shouldExit,
852
+ waitSignalAborted: waitSignal.aborted,
853
+ queueClosed: session.queue.isClosed(),
854
+ queueSize: session.queue.size(),
855
+ pending: Boolean(pending)
856
+ });
835
857
  if (waitSignal.aborted && !shouldExit) {
836
858
  continue;
837
859
  }
@@ -947,7 +969,14 @@ async function codexRemoteLauncher(session) {
947
969
  }
948
970
  messageBuffer.clear();
949
971
  }
950
- logger.debug("[Codex] ACP remote launcher returning: exit");
972
+ logger.debug("[Codex] ACP remote launcher returning: exit", {
973
+ shouldExit,
974
+ queueClosed: session.queue.isClosed(),
975
+ queueSize: session.queue.size(),
976
+ pending: pending ? pending.hash : null,
977
+ turnInFlight,
978
+ runtimeHandleActive: Boolean(runtimeHandle)
979
+ });
951
980
  return "exit";
952
981
  }
953
982
 
@@ -1088,6 +1117,7 @@ async function runCodex(opts) {
1088
1117
  session: codexSession,
1089
1118
  startingMode: requestedStartingMode
1090
1119
  });
1120
+ logger.debug(`[codex] codexLoop resolved with exit code ${exitCode}`);
1091
1121
  } catch (error) {
1092
1122
  loopError = error;
1093
1123
  } finally {
@@ -1101,12 +1131,16 @@ async function runCodex(opts) {
1101
1131
  codexSession.cleanup();
1102
1132
  }
1103
1133
  if (loopError !== void 0) {
1134
+ logger.debug("[codex] runCodex exiting after loop error", loopError);
1104
1135
  throw loopError;
1105
1136
  }
1106
1137
  if (closeError !== void 0) {
1138
+ logger.debug("[codex] runCodex exiting after close error", closeError);
1107
1139
  throw closeError;
1108
1140
  }
1109
- process.exit(exitCode ?? 1);
1141
+ const resolvedExitCode = exitCode ?? 1;
1142
+ logger.debug(`[codex] Exiting process with code ${resolvedExitCode}`);
1143
+ process.exit(resolvedExitCode);
1110
1144
  }
1111
1145
 
1112
1146
  export { resolveIncomingCodexPermissionMode, resolveInitialCodexPermissionMode, resolveQueuedCodexPermissionMode, runCodex };