happy-imou-cloud 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/{BaseReasoningProcessor-DEEfNi5Y.cjs → BaseReasoningProcessor-DPVZIJ4n.cjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-Di1yEMMv.mjs → BaseReasoningProcessor-bFVTvf3Q.mjs} +2 -2
  3. package/dist/{api-CyJG1mr6.cjs → api-DaqnNHfl.cjs} +4 -2
  4. package/dist/{api-CIHTNilH.mjs → api-DoHt-HyL.mjs} +4 -2
  5. package/dist/{command-CPlJKXDn.cjs → command-D9-hmqVq.cjs} +3 -3
  6. package/dist/{command-BERqmFB0.mjs → command-Dl9SrMnv.mjs} +3 -3
  7. package/dist/{index-vNYxNqVZ.mjs → index-C5wR2qKT.mjs} +141 -47
  8. package/dist/{index-1zlH6s7a.cjs → index-Dc92gnxM.cjs} +143 -49
  9. package/dist/index.cjs +3 -3
  10. package/dist/index.mjs +3 -3
  11. package/dist/lib.cjs +1 -1
  12. package/dist/lib.mjs +1 -1
  13. package/dist/{persistence-BeFVx6kI.cjs → persistence-D6Y0604_.cjs} +1 -1
  14. package/dist/{persistence-sLEqV8vk.mjs → persistence-QqeBvUxX.mjs} +1 -1
  15. package/dist/{registerKillSessionHandler-CCxqGFjZ.cjs → registerKillSessionHandler-C6yXr8ky.cjs} +2 -2
  16. package/dist/{registerKillSessionHandler-uVHqIC4h.mjs → registerKillSessionHandler-CC9zGBPE.mjs} +2 -2
  17. package/dist/{runClaude-Dl9nIRIg.mjs → runClaude-CZ8gxaJL.mjs} +4 -4
  18. package/dist/{runClaude-Dz-PCSvb.cjs → runClaude-gHKFB1UG.cjs} +5 -5
  19. package/dist/{runCodex-BtZplK1R.cjs → runCodex-CdjzG1N7.cjs} +53 -17
  20. package/dist/{runCodex-DgKKw3IU.mjs → runCodex-DT7g4MPm.mjs} +53 -17
  21. package/dist/{runGemini-CM1v3I24.mjs → runGemini-CmY5386l.mjs} +51 -19
  22. package/dist/{runGemini-DUyH311Z.cjs → runGemini-DxjvRmOc.cjs} +51 -19
  23. package/package.json +2 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
- var api = require('./api-CyJG1mr6.cjs');
5
- var persistence = require('./persistence-BeFVx6kI.cjs');
4
+ var api = require('./api-DaqnNHfl.cjs');
5
+ var persistence = require('./persistence-D6Y0604_.cjs');
6
6
  var z = require('zod');
7
7
  var fs$1 = require('fs/promises');
8
8
  var os$1 = require('os');
@@ -70,7 +70,7 @@ async function openBrowser(url) {
70
70
  }
71
71
  }
72
72
 
73
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-1zlH6s7a.cjs', document.baseURI).href)));
73
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Dc92gnxM.cjs', document.baseURI).href)));
74
74
  const QRCode = require$1("qrcode-terminal/vendor/QRCode");
75
75
  const QRErrorCorrectLevel = require$1("qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel");
76
76
  const pendingTempFiles = /* @__PURE__ */ new Set();
@@ -693,7 +693,7 @@ function setupCleanupHandlers() {
693
693
  });
694
694
  }
695
695
 
696
- const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-1zlH6s7a.cjs', document.baseURI).href))));
696
+ const __dirname$1 = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Dc92gnxM.cjs', document.baseURI).href))));
697
697
  function projectPath() {
698
698
  const path$1 = path.resolve(__dirname$1, "..");
699
699
  return path$1;
@@ -5064,15 +5064,17 @@ async function withRetry(operation, options) {
5064
5064
  return await operation();
5065
5065
  } catch (error) {
5066
5066
  lastError = normalizeAcpError(error);
5067
- if (attempt < options.maxAttempts) {
5068
- const delayMs = Math.min(
5069
- options.baseDelayMs * Math.pow(2, attempt - 1),
5070
- options.maxDelayMs
5071
- );
5072
- api.logger.debug(`[AcpBackend] ${options.operationName} failed (attempt ${attempt}/${options.maxAttempts}): ${lastError.message}. Retrying in ${delayMs}ms...`);
5073
- options.onRetry?.(attempt, lastError);
5074
- await api.delay(delayMs);
5067
+ const retryable = options.shouldRetry?.(lastError) ?? true;
5068
+ if (!retryable || attempt >= options.maxAttempts) {
5069
+ throw lastError;
5075
5070
  }
5071
+ const delayMs = Math.min(
5072
+ options.baseDelayMs * Math.pow(2, attempt - 1),
5073
+ options.maxDelayMs
5074
+ );
5075
+ api.logger.debug(`[AcpBackend] ${options.operationName} failed (attempt ${attempt}/${options.maxAttempts}): ${lastError.message}. Retrying in ${delayMs}ms...`);
5076
+ options.onRetry?.(attempt, lastError);
5077
+ await api.delay(delayMs);
5076
5078
  }
5077
5079
  }
5078
5080
  throw lastError;
@@ -5125,6 +5127,77 @@ function enrichAcpError(error, stderrExcerpt) {
5125
5127
  }
5126
5128
  return normalized;
5127
5129
  }
5130
+ class AcpProcessStartupError extends Error {
5131
+ constructor(message, exitCode, signal) {
5132
+ super(message);
5133
+ this.exitCode = exitCode;
5134
+ this.signal = signal;
5135
+ this.name = "AcpProcessStartupError";
5136
+ }
5137
+ }
5138
+ function createProcessStartupError(agentName, operationName, code, signal) {
5139
+ if (code !== null) {
5140
+ return new AcpProcessStartupError(
5141
+ `${agentName} exited with code ${code} during ${operationName}`,
5142
+ code,
5143
+ signal
5144
+ );
5145
+ }
5146
+ if (signal) {
5147
+ return new AcpProcessStartupError(
5148
+ `${agentName} exited due to signal ${signal} during ${operationName}`,
5149
+ code,
5150
+ signal
5151
+ );
5152
+ }
5153
+ return new AcpProcessStartupError(
5154
+ `${agentName} exited unexpectedly during ${operationName}`,
5155
+ code,
5156
+ signal
5157
+ );
5158
+ }
5159
+ async function raceWithProcessExit(childProcess, operation, options) {
5160
+ if (childProcess.exitCode !== null) {
5161
+ throw createProcessStartupError(
5162
+ options.agentName,
5163
+ options.operationName,
5164
+ childProcess.exitCode,
5165
+ childProcess.signalCode ?? null
5166
+ );
5167
+ }
5168
+ return await new Promise((resolve, reject) => {
5169
+ let settled = false;
5170
+ const cleanup = () => {
5171
+ childProcess.off("error", handleError);
5172
+ childProcess.off("exit", handleExit);
5173
+ };
5174
+ const settleResolve = (value) => {
5175
+ if (settled) {
5176
+ return;
5177
+ }
5178
+ settled = true;
5179
+ cleanup();
5180
+ resolve(value);
5181
+ };
5182
+ const settleReject = (error) => {
5183
+ if (settled) {
5184
+ return;
5185
+ }
5186
+ settled = true;
5187
+ cleanup();
5188
+ reject(normalizeAcpError(error));
5189
+ };
5190
+ const handleError = (error) => {
5191
+ settleReject(error);
5192
+ };
5193
+ const handleExit = (code, signal) => {
5194
+ settleReject(createProcessStartupError(options.agentName, options.operationName, code, signal));
5195
+ };
5196
+ childProcess.once("error", handleError);
5197
+ childProcess.once("exit", handleExit);
5198
+ operation.then(settleResolve, settleReject);
5199
+ });
5200
+ }
5128
5201
  class AcpBackend {
5129
5202
  constructor(options) {
5130
5203
  this.options = options;
@@ -5525,20 +5598,27 @@ class AcpBackend {
5525
5598
  async () => {
5526
5599
  let timeoutHandle = null;
5527
5600
  try {
5528
- const result = await Promise.race([
5529
- this.connection.initialize(initRequest).then((res) => {
5530
- if (timeoutHandle) {
5531
- clearTimeout(timeoutHandle);
5532
- timeoutHandle = null;
5533
- }
5534
- return res;
5535
- }),
5536
- new Promise((_, reject) => {
5537
- timeoutHandle = setTimeout(() => {
5538
- reject(new Error(`Initialize timeout after ${initTimeout}ms - ${this.transport.agentName} did not respond`));
5539
- }, initTimeout);
5540
- })
5541
- ]);
5601
+ const result = await raceWithProcessExit(
5602
+ this.process,
5603
+ Promise.race([
5604
+ this.connection.initialize(initRequest).then((res) => {
5605
+ if (timeoutHandle) {
5606
+ clearTimeout(timeoutHandle);
5607
+ timeoutHandle = null;
5608
+ }
5609
+ return res;
5610
+ }),
5611
+ new Promise((_, reject) => {
5612
+ timeoutHandle = setTimeout(() => {
5613
+ reject(new Error(`Initialize timeout after ${initTimeout}ms - ${this.transport.agentName} did not respond`));
5614
+ }, initTimeout);
5615
+ })
5616
+ ]),
5617
+ {
5618
+ agentName: this.transport.agentName,
5619
+ operationName: "initialize"
5620
+ }
5621
+ );
5542
5622
  return result;
5543
5623
  } finally {
5544
5624
  if (timeoutHandle) {
@@ -5550,7 +5630,8 @@ class AcpBackend {
5550
5630
  operationName: "Initialize",
5551
5631
  maxAttempts: RETRY_CONFIG.maxAttempts,
5552
5632
  baseDelayMs: RETRY_CONFIG.baseDelayMs,
5553
- maxDelayMs: RETRY_CONFIG.maxDelayMs
5633
+ maxDelayMs: RETRY_CONFIG.maxDelayMs,
5634
+ shouldRetry: (error) => !(error instanceof AcpProcessStartupError)
5554
5635
  }
5555
5636
  );
5556
5637
  api.logger.debug(`[AcpBackend] Initialize completed`);
@@ -5569,20 +5650,27 @@ class AcpBackend {
5569
5650
  async () => {
5570
5651
  let timeoutHandle = null;
5571
5652
  try {
5572
- const result = await Promise.race([
5573
- this.connection.newSession(newSessionRequest).then((res) => {
5574
- if (timeoutHandle) {
5575
- clearTimeout(timeoutHandle);
5576
- timeoutHandle = null;
5577
- }
5578
- return res;
5579
- }),
5580
- new Promise((_, reject) => {
5581
- timeoutHandle = setTimeout(() => {
5582
- reject(new Error(`New session timeout after ${initTimeout}ms - ${this.transport.agentName} did not respond`));
5583
- }, initTimeout);
5584
- })
5585
- ]);
5653
+ const result = await raceWithProcessExit(
5654
+ this.process,
5655
+ Promise.race([
5656
+ this.connection.newSession(newSessionRequest).then((res) => {
5657
+ if (timeoutHandle) {
5658
+ clearTimeout(timeoutHandle);
5659
+ timeoutHandle = null;
5660
+ }
5661
+ return res;
5662
+ }),
5663
+ new Promise((_, reject) => {
5664
+ timeoutHandle = setTimeout(() => {
5665
+ reject(new Error(`New session timeout after ${initTimeout}ms - ${this.transport.agentName} did not respond`));
5666
+ }, initTimeout);
5667
+ })
5668
+ ]),
5669
+ {
5670
+ agentName: this.transport.agentName,
5671
+ operationName: "new session"
5672
+ }
5673
+ );
5586
5674
  return result;
5587
5675
  } finally {
5588
5676
  if (timeoutHandle) {
@@ -5594,7 +5682,8 @@ class AcpBackend {
5594
5682
  operationName: "NewSession",
5595
5683
  maxAttempts: RETRY_CONFIG.maxAttempts,
5596
5684
  baseDelayMs: RETRY_CONFIG.baseDelayMs,
5597
- maxDelayMs: RETRY_CONFIG.maxDelayMs
5685
+ maxDelayMs: RETRY_CONFIG.maxDelayMs,
5686
+ shouldRetry: (error) => !(error instanceof AcpProcessStartupError)
5598
5687
  }
5599
5688
  );
5600
5689
  this.acpSessionId = sessionResponse.sessionId;
@@ -6125,6 +6214,7 @@ function registerGeminiAgent() {
6125
6214
  api.logger.debug("[Gemini] Registered with agent registry");
6126
6215
  }
6127
6216
 
6217
+ const DEFAULT_CODEX_ACP_NPX_PACKAGE = "@zed-industries/codex-acp@0.9.5";
6128
6218
  function readFirstEnv(...names) {
6129
6219
  for (const name of names) {
6130
6220
  const raw = process.env[name];
@@ -6179,6 +6269,10 @@ function readCodexAcpNpxMode() {
6179
6269
  }
6180
6270
  return "auto";
6181
6271
  }
6272
+ function readCodexAcpNpxPackage() {
6273
+ const configured = readFirstEnv("HAPPY_CODEX_ACP_PACKAGE", "HAPPIER_CODEX_ACP_PACKAGE");
6274
+ return configured || DEFAULT_CODEX_ACP_NPX_PACKAGE;
6275
+ }
6182
6276
  function isBinOnPath(baseName) {
6183
6277
  return resolveCommandOnPath(baseName) !== null;
6184
6278
  }
@@ -6244,7 +6338,7 @@ function resolveCodexAcpSpawn(options = {}) {
6244
6338
  }
6245
6339
  return {
6246
6340
  command: resolveNpxCommand(),
6247
- args: ["--prefer-offline", "-y", "@zed-industries/codex-acp", ...directArgs]
6341
+ args: ["--prefer-offline", "-y", readCodexAcpNpxPackage(), ...directArgs]
6248
6342
  };
6249
6343
  }
6250
6344
  function validateCodexAcpSpawn(options = {}) {
@@ -6531,12 +6625,12 @@ async function ensureUnifiedDaemonStarted() {
6531
6625
  async function executeUnifiedProvider(opts) {
6532
6626
  const credentials = await ensureUnifiedRuntimePrerequisites(opts.credentials);
6533
6627
  if (opts.provider === "claude") {
6534
- const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-Dz-PCSvb.cjs'); });
6628
+ const { runClaude } = await Promise.resolve().then(function () { return require('./runClaude-gHKFB1UG.cjs'); });
6535
6629
  await runClaude(credentials, opts.claudeOptions ?? {});
6536
6630
  return;
6537
6631
  }
6538
6632
  if (opts.provider === "codex") {
6539
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-BtZplK1R.cjs'); });
6633
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CdjzG1N7.cjs'); });
6540
6634
  await runCodex({
6541
6635
  credentials,
6542
6636
  startedBy: opts.startedBy,
@@ -6546,7 +6640,7 @@ async function executeUnifiedProvider(opts) {
6546
6640
  return;
6547
6641
  }
6548
6642
  if (opts.provider === "gemini") {
6549
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-DUyH311Z.cjs'); });
6643
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-DxjvRmOc.cjs'); });
6550
6644
  await runGemini({
6551
6645
  credentials,
6552
6646
  startedBy: opts.startedBy
@@ -6588,7 +6682,7 @@ function shouldRunMainClaudeFlow(opts) {
6588
6682
  return;
6589
6683
  } else if (subcommand === "runtime") {
6590
6684
  if (args[1] === "providers") {
6591
- const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-CPlJKXDn.cjs'); });
6685
+ const { renderRuntimeProviders } = await Promise.resolve().then(function () { return require('./command-D9-hmqVq.cjs'); });
6592
6686
  console.log(renderRuntimeProviders());
6593
6687
  return;
6594
6688
  }
@@ -6766,8 +6860,8 @@ function shouldRunMainClaudeFlow(opts) {
6766
6860
  const projectId = args[3];
6767
6861
  try {
6768
6862
  const { saveGoogleCloudProjectToConfig } = await Promise.resolve().then(function () { return config; });
6769
- const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-BeFVx6kI.cjs'); });
6770
- const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-CyJG1mr6.cjs'); }).then(function (n) { return n.api; });
6863
+ const { readCredentials: readCredentials2 } = await Promise.resolve().then(function () { return require('./persistence-D6Y0604_.cjs'); });
6864
+ const { ApiClient: ApiClient2 } = await Promise.resolve().then(function () { return require('./api-DaqnNHfl.cjs'); }).then(function (n) { return n.api; });
6771
6865
  let userEmail = void 0;
6772
6866
  try {
6773
6867
  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-CyJG1mr6.cjs');
5
- require('./persistence-BeFVx6kI.cjs');
4
+ require('./api-DaqnNHfl.cjs');
5
+ require('./persistence-D6Y0604_.cjs');
6
6
  require('zod');
7
- require('./index-1zlH6s7a.cjs');
7
+ require('./index-Dc92gnxM.cjs');
8
8
  require('node:child_process');
9
9
  require('node:fs');
10
10
  require('@agentclientprotocol/sdk');
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import 'chalk';
2
- import './api-CIHTNilH.mjs';
3
- import './persistence-sLEqV8vk.mjs';
2
+ import './api-DoHt-HyL.mjs';
3
+ import './persistence-QqeBvUxX.mjs';
4
4
  import 'zod';
5
- import './index-vNYxNqVZ.mjs';
5
+ import './index-C5wR2qKT.mjs';
6
6
  import 'node:child_process';
7
7
  import 'node:fs';
8
8
  import '@agentclientprotocol/sdk';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var api = require('./api-CyJG1mr6.cjs');
3
+ var api = require('./api-DaqnNHfl.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-CIHTNilH.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-DoHt-HyL.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 node_fs = require('node:fs');
5
5
  var node_path = require('node:path');
6
- var api = require('./api-CyJG1mr6.cjs');
6
+ var api = require('./api-DaqnNHfl.cjs');
7
7
  var z = require('zod');
8
8
  require('axios');
9
9
  require('chalk');
@@ -1,7 +1,7 @@
1
1
  import { readFile, unlink, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
2
2
  import { existsSync, unlinkSync, writeFileSync, readdirSync, readFileSync, constants } from 'node:fs';
3
3
  import { join, dirname } from 'node:path';
4
- import { c as configuration, l as logger, e as encodeBase64 } from './api-CIHTNilH.mjs';
4
+ import { c as configuration, l as logger, e as encodeBase64 } from './api-DoHt-HyL.mjs';
5
5
  import * as z from 'zod';
6
6
  import 'axios';
7
7
  import 'chalk';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-1zlH6s7a.cjs');
4
- var api = require('./api-CyJG1mr6.cjs');
3
+ var index = require('./index-Dc92gnxM.cjs');
4
+ var api = require('./api-DaqnNHfl.cjs');
5
5
  var crypto = require('crypto');
6
6
  require('axios');
7
7
  require('node:events');
@@ -1,5 +1,5 @@
1
- import { f as formatDisplayMessage } from './index-vNYxNqVZ.mjs';
2
- import { l as logger } from './api-CIHTNilH.mjs';
1
+ import { f as formatDisplayMessage } from './index-C5wR2qKT.mjs';
2
+ import { l as logger } from './api-DoHt-HyL.mjs';
3
3
  import { createHash } from 'crypto';
4
4
  import 'axios';
5
5
  import 'node:events';
@@ -1,13 +1,13 @@
1
1
  import os, { homedir } from 'node:os';
2
2
  import { randomUUID } from 'node:crypto';
3
- import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, b as connectionState, A as ApiClient, p as packageJson, i as isAuthenticationRequiredError, s as startOfflineReconnection } from './api-CIHTNilH.mjs';
4
- import { e as getProjectPath, h as claudeLocal, E as ExitCodeError, j as isBun, k as trimIdent, l as claudeCheckSession, p as projectPath, m as getEnvironmentInfo, i as initialMachineMetadata, b as stopCaffeinate, n as notifyDaemonSessionStarted, o as startCaffeinate } from './index-vNYxNqVZ.mjs';
3
+ import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, b as connectionState, A as ApiClient, p as packageJson, i as isAuthenticationRequiredError, s as startOfflineReconnection } from './api-DoHt-HyL.mjs';
4
+ import { e as getProjectPath, h as claudeLocal, E as ExitCodeError, j as isBun, k as trimIdent, l as claudeCheckSession, p as projectPath, m as getEnvironmentInfo, i as initialMachineMetadata, b as stopCaffeinate, n as notifyDaemonSessionStarted, o as startCaffeinate } from './index-C5wR2qKT.mjs';
5
5
  import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
6
6
  import { dirname, basename, join, resolve } from 'node:path';
7
7
  import { readFile } from 'node:fs/promises';
8
8
  import { stat, watch, access } from 'fs/promises';
9
9
  import { useStdout, useInput, Box, Text, render } from 'ink';
10
- import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-uVHqIC4h.mjs';
10
+ import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-CC9zGBPE.mjs';
11
11
  import React, { useState, useRef, useEffect, useCallback } from 'react';
12
12
  import { execSync, spawn } from 'node:child_process';
13
13
  import { createInterface } from 'node:readline';
@@ -20,7 +20,7 @@ import 'tweetnacl';
20
20
  import 'expo-server-sdk';
21
21
  import 'chalk';
22
22
  import { isDeepStrictEqual } from 'node:util';
23
- import { readSettings } from './persistence-sLEqV8vk.mjs';
23
+ import { readSettings } from './persistence-QqeBvUxX.mjs';
24
24
  import { createServer } from 'node:http';
25
25
  import 'fs';
26
26
  import 'zod';
@@ -2,14 +2,14 @@
2
2
 
3
3
  var os = require('node:os');
4
4
  var node_crypto = require('node:crypto');
5
- var api = require('./api-CyJG1mr6.cjs');
6
- var index = require('./index-1zlH6s7a.cjs');
5
+ var api = require('./api-DaqnNHfl.cjs');
6
+ var index = require('./index-Dc92gnxM.cjs');
7
7
  var types = require('./types-DVk3crez.cjs');
8
8
  var node_path = require('node:path');
9
9
  var promises = require('node:fs/promises');
10
10
  var fs = require('fs/promises');
11
11
  var ink = require('ink');
12
- var registerKillSessionHandler = require('./registerKillSessionHandler-CCxqGFjZ.cjs');
12
+ var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.cjs');
13
13
  var React = require('react');
14
14
  var node_child_process = require('node:child_process');
15
15
  var node_readline = require('node:readline');
@@ -22,7 +22,7 @@ require('tweetnacl');
22
22
  require('expo-server-sdk');
23
23
  require('chalk');
24
24
  var node_util = require('node:util');
25
- var persistence = require('./persistence-BeFVx6kI.cjs');
25
+ var persistence = require('./persistence-D6Y0604_.cjs');
26
26
  var node_http = require('node:http');
27
27
  require('fs');
28
28
  require('zod');
@@ -937,7 +937,7 @@ class AbortError extends Error {
937
937
  }
938
938
  }
939
939
 
940
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('runClaude-Dz-PCSvb.cjs', document.baseURI).href)));
940
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('runClaude-gHKFB1UG.cjs', document.baseURI).href)));
941
941
  const __dirname$1 = node_path.join(__filename$1, "..");
942
942
  function getGlobalClaudeVersion() {
943
943
  try {
@@ -1,13 +1,14 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var api = require('./api-CyJG1mr6.cjs');
5
- var persistence = require('./persistence-BeFVx6kI.cjs');
6
- var index = require('./index-1zlH6s7a.cjs');
7
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DEEfNi5Y.cjs');
8
- var registerKillSessionHandler = require('./registerKillSessionHandler-CCxqGFjZ.cjs');
4
+ var api = require('./api-DaqnNHfl.cjs');
5
+ var persistence = require('./persistence-D6Y0604_.cjs');
6
+ var index = require('./index-Dc92gnxM.cjs');
7
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-DPVZIJ4n.cjs');
8
+ var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.cjs');
9
9
  var React = require('react');
10
10
  var ink = require('ink');
11
+ var happyProtocol = require('happy-protocol');
11
12
  require('axios');
12
13
  require('chalk');
13
14
  require('fs');
@@ -952,21 +953,28 @@ async function codexRemoteLauncher(session) {
952
953
  }
953
954
  case "tool-call": {
954
955
  const toolArgs = msg.args ? index.truncateDisplayMessage(msg.args, 100) : "";
956
+ const canonicalToolName = happyProtocol.resolveCanonicalToolNameV2(msg.toolName);
955
957
  messageBuffer.addMessage(
956
958
  `Executing: ${msg.toolName}${toolArgs ? ` ${toolArgs}` : ""}`,
957
959
  "tool"
958
960
  );
959
961
  session.runtimeSession.sendCodexMessage({
960
962
  type: "tool-call",
961
- name: msg.toolName,
963
+ name: canonicalToolName,
962
964
  callId: msg.callId,
963
- input: msg.args,
965
+ input: happyProtocol.attachToolHappierMetaV2(msg.args, {
966
+ v: 2,
967
+ protocol: "acp",
968
+ provider: "codex",
969
+ rawToolName: msg.toolName,
970
+ canonicalToolName
971
+ }),
964
972
  id: node_crypto.randomUUID()
965
973
  });
966
974
  return;
967
975
  }
968
976
  case "tool-result": {
969
- const isError = msg.result && typeof msg.result === "object" && "error" in msg.result;
977
+ const isError = happyProtocol.inferToolResultError(msg.result);
970
978
  const resultText = index.truncateDisplayMessage(msg.result, 200) || (isError ? "Unknown error" : "");
971
979
  messageBuffer.addMessage(
972
980
  `${isError ? "Error:" : "Result:"} ${resultText}`.trim(),
@@ -975,7 +983,13 @@ async function codexRemoteLauncher(session) {
975
983
  session.runtimeSession.sendCodexMessage({
976
984
  type: "tool-call-result",
977
985
  callId: msg.callId,
978
- output: msg.result,
986
+ output: happyProtocol.attachToolHappierMetaV2(msg.result, {
987
+ v: 2,
988
+ protocol: "acp",
989
+ provider: "codex",
990
+ rawToolName: msg.toolName,
991
+ canonicalToolName: happyProtocol.resolveCanonicalToolNameV2(msg.toolName)
992
+ }),
979
993
  id: node_crypto.randomUUID(),
980
994
  isError
981
995
  });
@@ -998,7 +1012,7 @@ async function codexRemoteLauncher(session) {
998
1012
  session.runtimeSession.sendCodexMessage({
999
1013
  type: "terminal-output",
1000
1014
  data: terminalOutput,
1001
- callId: node_crypto.randomUUID()
1015
+ callId: msg.callId ?? node_crypto.randomUUID()
1002
1016
  });
1003
1017
  return;
1004
1018
  }
@@ -1016,11 +1030,19 @@ async function codexRemoteLauncher(session) {
1016
1030
  case "exec-approval-request": {
1017
1031
  const { call_id, type, ...inputs } = msg;
1018
1032
  messageBuffer.addMessage(`Exec approval requested: ${call_id}`, "tool");
1033
+ const rawToolName = "CodexBash";
1034
+ const canonicalToolName = happyProtocol.resolveCanonicalToolNameV2(rawToolName);
1019
1035
  session.runtimeSession.sendCodexMessage({
1020
1036
  type: "tool-call",
1021
- name: "CodexBash",
1037
+ name: canonicalToolName,
1022
1038
  callId: call_id,
1023
- input: inputs,
1039
+ input: happyProtocol.attachToolHappierMetaV2(inputs, {
1040
+ v: 2,
1041
+ protocol: "acp",
1042
+ provider: "codex",
1043
+ rawToolName,
1044
+ canonicalToolName
1045
+ }),
1024
1046
  id: node_crypto.randomUUID()
1025
1047
  });
1026
1048
  return;
@@ -1029,14 +1051,22 @@ async function codexRemoteLauncher(session) {
1029
1051
  const changeCount = Object.keys(msg.changes || {}).length;
1030
1052
  const filesMsg = changeCount === 1 ? "1 file" : `${changeCount} files`;
1031
1053
  messageBuffer.addMessage(`Modifying ${filesMsg}...`, "tool");
1054
+ const rawToolName = "CodexPatch";
1055
+ const canonicalToolName = happyProtocol.resolveCanonicalToolNameV2(rawToolName);
1032
1056
  session.runtimeSession.sendCodexMessage({
1033
1057
  type: "tool-call",
1034
- name: "CodexPatch",
1058
+ name: canonicalToolName,
1035
1059
  callId: msg.call_id,
1036
- input: {
1060
+ input: happyProtocol.attachToolHappierMetaV2({
1037
1061
  auto_approved: msg.auto_approved,
1038
1062
  changes: msg.changes
1039
- },
1063
+ }, {
1064
+ v: 2,
1065
+ protocol: "acp",
1066
+ provider: "codex",
1067
+ rawToolName,
1068
+ canonicalToolName
1069
+ }),
1040
1070
  id: node_crypto.randomUUID()
1041
1071
  });
1042
1072
  return;
@@ -1050,11 +1080,17 @@ async function codexRemoteLauncher(session) {
1050
1080
  session.runtimeSession.sendCodexMessage({
1051
1081
  type: "tool-call-result",
1052
1082
  callId: msg.call_id,
1053
- output: {
1083
+ output: happyProtocol.attachToolHappierMetaV2({
1054
1084
  stdout: msg.stdout,
1055
1085
  stderr: msg.stderr,
1056
1086
  success: msg.success
1057
- },
1087
+ }, {
1088
+ v: 2,
1089
+ protocol: "acp",
1090
+ provider: "codex",
1091
+ rawToolName: "CodexPatch",
1092
+ canonicalToolName: happyProtocol.resolveCanonicalToolNameV2("CodexPatch")
1093
+ }),
1058
1094
  id: node_crypto.randomUUID(),
1059
1095
  isError: !msg.success
1060
1096
  });