happy-imou-cloud 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/{BaseReasoningProcessor-Di1yEMMv.mjs → BaseReasoningProcessor-1EzrE03x.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-DEEfNi5Y.cjs → BaseReasoningProcessor-BMyfwx3p.cjs} +2 -2
  3. package/dist/{api-CyJG1mr6.cjs → api-DccDghmF.cjs} +5 -3
  4. package/dist/{api-CIHTNilH.mjs → api-Emo3rSZH.mjs} +5 -3
  5. package/dist/{command-CPlJKXDn.cjs → command-C2v0VkPq.cjs} +3 -3
  6. package/dist/{command-BERqmFB0.mjs → command-D8Zz6B4t.mjs} +3 -3
  7. package/dist/{index-1zlH6s7a.cjs → index-Buq7nurH.cjs} +368 -131
  8. package/dist/{index-vNYxNqVZ.mjs → index-Dh8UTgm4.mjs} +366 -129
  9. package/dist/index.cjs +5 -5
  10. package/dist/index.mjs +5 -5
  11. package/dist/lib.cjs +1 -1
  12. package/dist/lib.mjs +1 -1
  13. package/dist/{persistence-sLEqV8vk.mjs → persistence-Blm1hTQA.mjs} +1 -1
  14. package/dist/{persistence-BeFVx6kI.cjs → persistence-BrTyBuT7.cjs} +1 -1
  15. package/dist/{registerKillSessionHandler-uVHqIC4h.mjs → registerKillSessionHandler-Bm7E-03E.mjs} +2 -2
  16. package/dist/{registerKillSessionHandler-CCxqGFjZ.cjs → registerKillSessionHandler-EFAsOnR_.cjs} +2 -2
  17. package/dist/{runClaude-Dz-PCSvb.cjs → runClaude-COy1pLhn.cjs} +5 -5
  18. package/dist/{runClaude-Dl9nIRIg.mjs → runClaude-CwA5UCO-.mjs} +4 -4
  19. package/dist/{runCodex-BtZplK1R.cjs → runCodex-BRMOT2dJ.cjs} +53 -17
  20. package/dist/{runCodex-DgKKw3IU.mjs → runCodex-DTPmqCyS.mjs} +53 -17
  21. package/dist/{runGemini-DUyH311Z.cjs → runGemini-BVPmTGxQ.cjs} +51 -19
  22. package/dist/{runGemini-CM1v3I24.mjs → runGemini-DDSR8BtO.mjs} +51 -19
  23. package/package.json +3 -2
  24. package/scripts/release-smoke.mjs +4 -0
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-Emo3rSZH.mjs';
2
2
  export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
3
3
  import 'axios';
4
4
  import 'chalk';
@@ -1,7 +1,7 @@
1
1
  import { readFile, unlink, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
2
2
  import { existsSync, unlinkSync, writeFileSync, readdirSync, readFileSync, constants } from 'node:fs';
3
3
  import { join, dirname } from 'node:path';
4
- import { c as configuration, l as logger, e as encodeBase64 } from './api-CIHTNilH.mjs';
4
+ import { c as configuration, l as logger, e as encodeBase64 } from './api-Emo3rSZH.mjs';
5
5
  import * as z from 'zod';
6
6
  import 'axios';
7
7
  import 'chalk';
@@ -3,7 +3,7 @@
3
3
  var promises = require('node:fs/promises');
4
4
  var node_fs = require('node:fs');
5
5
  var node_path = require('node:path');
6
- var api = require('./api-CyJG1mr6.cjs');
6
+ var api = require('./api-DccDghmF.cjs');
7
7
  var z = require('zod');
8
8
  require('axios');
9
9
  require('chalk');
@@ -1,5 +1,5 @@
1
- import { f as formatDisplayMessage } from './index-vNYxNqVZ.mjs';
2
- import { l as logger } from './api-CIHTNilH.mjs';
1
+ import { f as formatDisplayMessage } from './index-Dh8UTgm4.mjs';
2
+ import { l as logger } from './api-Emo3rSZH.mjs';
3
3
  import { createHash } from 'crypto';
4
4
  import 'axios';
5
5
  import 'node:events';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-1zlH6s7a.cjs');
4
- var api = require('./api-CyJG1mr6.cjs');
3
+ var index = require('./index-Buq7nurH.cjs');
4
+ var api = require('./api-DccDghmF.cjs');
5
5
  var crypto = require('crypto');
6
6
  require('axios');
7
7
  require('node:events');
@@ -2,14 +2,14 @@
2
2
 
3
3
  var os = require('node:os');
4
4
  var node_crypto = require('node:crypto');
5
- var api = require('./api-CyJG1mr6.cjs');
6
- var index = require('./index-1zlH6s7a.cjs');
5
+ var api = require('./api-DccDghmF.cjs');
6
+ var index = require('./index-Buq7nurH.cjs');
7
7
  var types = require('./types-DVk3crez.cjs');
8
8
  var node_path = require('node:path');
9
9
  var promises = require('node:fs/promises');
10
10
  var fs = require('fs/promises');
11
11
  var ink = require('ink');
12
- var registerKillSessionHandler = require('./registerKillSessionHandler-CCxqGFjZ.cjs');
12
+ var registerKillSessionHandler = require('./registerKillSessionHandler-EFAsOnR_.cjs');
13
13
  var React = require('react');
14
14
  var node_child_process = require('node:child_process');
15
15
  var node_readline = require('node:readline');
@@ -22,7 +22,7 @@ require('tweetnacl');
22
22
  require('expo-server-sdk');
23
23
  require('chalk');
24
24
  var node_util = require('node:util');
25
- var persistence = require('./persistence-BeFVx6kI.cjs');
25
+ var persistence = require('./persistence-BrTyBuT7.cjs');
26
26
  var node_http = require('node:http');
27
27
  require('fs');
28
28
  require('zod');
@@ -937,7 +937,7 @@ class AbortError extends Error {
937
937
  }
938
938
  }
939
939
 
940
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('runClaude-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-COy1pLhn.cjs', document.baseURI).href)));
941
941
  const __dirname$1 = node_path.join(__filename$1, "..");
942
942
  function getGlobalClaudeVersion() {
943
943
  try {
@@ -1,13 +1,13 @@
1
1
  import os, { homedir } from 'node:os';
2
2
  import { randomUUID } from 'node:crypto';
3
- import { l as logger, d as backoff, f as delay, g as AsyncLock, c as configuration, b as connectionState, A as ApiClient, p as packageJson, i as isAuthenticationRequiredError, s as startOfflineReconnection } from './api-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-Emo3rSZH.mjs';
4
+ import { e as getProjectPath, h as claudeLocal, E as ExitCodeError, j as isBun, k as trimIdent, l as claudeCheckSession, p as projectPath, m as getEnvironmentInfo, i as initialMachineMetadata, b as stopCaffeinate, n as notifyDaemonSessionStarted, o as startCaffeinate } from './index-Dh8UTgm4.mjs';
5
5
  import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
6
6
  import { dirname, basename, join, resolve } from 'node:path';
7
7
  import { readFile } from 'node:fs/promises';
8
8
  import { stat, watch, access } from 'fs/promises';
9
9
  import { useStdout, useInput, Box, Text, render } from 'ink';
10
- import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-uVHqIC4h.mjs';
10
+ import { a as MessageBuffer, M as MessageQueue2, h as hashObject, r as registerKillSessionHandler } from './registerKillSessionHandler-Bm7E-03E.mjs';
11
11
  import React, { useState, useRef, useEffect, useCallback } from 'react';
12
12
  import { execSync, spawn } from 'node:child_process';
13
13
  import { createInterface } from 'node:readline';
@@ -20,7 +20,7 @@ import 'tweetnacl';
20
20
  import 'expo-server-sdk';
21
21
  import 'chalk';
22
22
  import { isDeepStrictEqual } from 'node:util';
23
- import { readSettings } from './persistence-sLEqV8vk.mjs';
23
+ import { readSettings } from './persistence-Blm1hTQA.mjs';
24
24
  import { createServer } from 'node:http';
25
25
  import 'fs';
26
26
  import 'zod';
@@ -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-DccDghmF.cjs');
5
+ var persistence = require('./persistence-BrTyBuT7.cjs');
6
+ var index = require('./index-Buq7nurH.cjs');
7
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-BMyfwx3p.cjs');
8
+ var registerKillSessionHandler = require('./registerKillSessionHandler-EFAsOnR_.cjs');
9
9
  var React = require('react');
10
10
  var ink = require('ink');
11
+ 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
  });
@@ -1,11 +1,12 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-CIHTNilH.mjs';
3
- import { readSettings } from './persistence-sLEqV8vk.mjs';
4
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-vNYxNqVZ.mjs';
5
- import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-Di1yEMMv.mjs';
6
- import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-uVHqIC4h.mjs';
2
+ import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-Emo3rSZH.mjs';
3
+ import { readSettings } from './persistence-Blm1hTQA.mjs';
4
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate, i as initialMachineMetadata, n as notifyDaemonSessionStarted } from './index-Dh8UTgm4.mjs';
5
+ import { B as BasePermissionHandler, g as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-1EzrE03x.mjs';
6
+ import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-Bm7E-03E.mjs';
7
7
  import React, { useState, useRef, useEffect, useCallback } from 'react';
8
8
  import { useStdout, useInput, Box, Text, render } from 'ink';
9
+ import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
9
10
  import 'axios';
10
11
  import 'chalk';
11
12
  import 'fs';
@@ -950,21 +951,28 @@ async function codexRemoteLauncher(session) {
950
951
  }
951
952
  case "tool-call": {
952
953
  const toolArgs = msg.args ? truncateDisplayMessage(msg.args, 100) : "";
954
+ const canonicalToolName = resolveCanonicalToolNameV2(msg.toolName);
953
955
  messageBuffer.addMessage(
954
956
  `Executing: ${msg.toolName}${toolArgs ? ` ${toolArgs}` : ""}`,
955
957
  "tool"
956
958
  );
957
959
  session.runtimeSession.sendCodexMessage({
958
960
  type: "tool-call",
959
- name: msg.toolName,
961
+ name: canonicalToolName,
960
962
  callId: msg.callId,
961
- input: msg.args,
963
+ input: attachToolHappierMetaV2(msg.args, {
964
+ v: 2,
965
+ protocol: "acp",
966
+ provider: "codex",
967
+ rawToolName: msg.toolName,
968
+ canonicalToolName
969
+ }),
962
970
  id: randomUUID()
963
971
  });
964
972
  return;
965
973
  }
966
974
  case "tool-result": {
967
- const isError = msg.result && typeof msg.result === "object" && "error" in msg.result;
975
+ const isError = inferToolResultError(msg.result);
968
976
  const resultText = truncateDisplayMessage(msg.result, 200) || (isError ? "Unknown error" : "");
969
977
  messageBuffer.addMessage(
970
978
  `${isError ? "Error:" : "Result:"} ${resultText}`.trim(),
@@ -973,7 +981,13 @@ async function codexRemoteLauncher(session) {
973
981
  session.runtimeSession.sendCodexMessage({
974
982
  type: "tool-call-result",
975
983
  callId: msg.callId,
976
- output: msg.result,
984
+ output: attachToolHappierMetaV2(msg.result, {
985
+ v: 2,
986
+ protocol: "acp",
987
+ provider: "codex",
988
+ rawToolName: msg.toolName,
989
+ canonicalToolName: resolveCanonicalToolNameV2(msg.toolName)
990
+ }),
977
991
  id: randomUUID(),
978
992
  isError
979
993
  });
@@ -996,7 +1010,7 @@ async function codexRemoteLauncher(session) {
996
1010
  session.runtimeSession.sendCodexMessage({
997
1011
  type: "terminal-output",
998
1012
  data: terminalOutput,
999
- callId: randomUUID()
1013
+ callId: msg.callId ?? randomUUID()
1000
1014
  });
1001
1015
  return;
1002
1016
  }
@@ -1014,11 +1028,19 @@ async function codexRemoteLauncher(session) {
1014
1028
  case "exec-approval-request": {
1015
1029
  const { call_id, type, ...inputs } = msg;
1016
1030
  messageBuffer.addMessage(`Exec approval requested: ${call_id}`, "tool");
1031
+ const rawToolName = "CodexBash";
1032
+ const canonicalToolName = resolveCanonicalToolNameV2(rawToolName);
1017
1033
  session.runtimeSession.sendCodexMessage({
1018
1034
  type: "tool-call",
1019
- name: "CodexBash",
1035
+ name: canonicalToolName,
1020
1036
  callId: call_id,
1021
- input: inputs,
1037
+ input: attachToolHappierMetaV2(inputs, {
1038
+ v: 2,
1039
+ protocol: "acp",
1040
+ provider: "codex",
1041
+ rawToolName,
1042
+ canonicalToolName
1043
+ }),
1022
1044
  id: randomUUID()
1023
1045
  });
1024
1046
  return;
@@ -1027,14 +1049,22 @@ async function codexRemoteLauncher(session) {
1027
1049
  const changeCount = Object.keys(msg.changes || {}).length;
1028
1050
  const filesMsg = changeCount === 1 ? "1 file" : `${changeCount} files`;
1029
1051
  messageBuffer.addMessage(`Modifying ${filesMsg}...`, "tool");
1052
+ const rawToolName = "CodexPatch";
1053
+ const canonicalToolName = resolveCanonicalToolNameV2(rawToolName);
1030
1054
  session.runtimeSession.sendCodexMessage({
1031
1055
  type: "tool-call",
1032
- name: "CodexPatch",
1056
+ name: canonicalToolName,
1033
1057
  callId: msg.call_id,
1034
- input: {
1058
+ input: attachToolHappierMetaV2({
1035
1059
  auto_approved: msg.auto_approved,
1036
1060
  changes: msg.changes
1037
- },
1061
+ }, {
1062
+ v: 2,
1063
+ protocol: "acp",
1064
+ provider: "codex",
1065
+ rawToolName,
1066
+ canonicalToolName
1067
+ }),
1038
1068
  id: randomUUID()
1039
1069
  });
1040
1070
  return;
@@ -1048,11 +1078,17 @@ async function codexRemoteLauncher(session) {
1048
1078
  session.runtimeSession.sendCodexMessage({
1049
1079
  type: "tool-call-result",
1050
1080
  callId: msg.call_id,
1051
- output: {
1081
+ output: attachToolHappierMetaV2({
1052
1082
  stdout: msg.stdout,
1053
1083
  stderr: msg.stderr,
1054
1084
  success: msg.success
1055
- },
1085
+ }, {
1086
+ v: 2,
1087
+ protocol: "acp",
1088
+ provider: "codex",
1089
+ rawToolName: "CodexPatch",
1090
+ canonicalToolName: resolveCanonicalToolNameV2("CodexPatch")
1091
+ }),
1056
1092
  id: randomUUID(),
1057
1093
  isError: !msg.success
1058
1094
  });
@@ -3,11 +3,12 @@
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
5
  var node_crypto = require('node:crypto');
6
- var api = require('./api-CyJG1mr6.cjs');
7
- var persistence = require('./persistence-BeFVx6kI.cjs');
8
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DEEfNi5Y.cjs');
9
- var index = require('./index-1zlH6s7a.cjs');
10
- var registerKillSessionHandler = require('./registerKillSessionHandler-CCxqGFjZ.cjs');
6
+ var api = require('./api-DccDghmF.cjs');
7
+ var persistence = require('./persistence-BrTyBuT7.cjs');
8
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-BMyfwx3p.cjs');
9
+ var index = require('./index-Buq7nurH.cjs');
10
+ var registerKillSessionHandler = require('./registerKillSessionHandler-EFAsOnR_.cjs');
11
+ var happyProtocol = require('happy-protocol');
11
12
  require('axios');
12
13
  require('chalk');
13
14
  require('fs');
@@ -950,17 +951,24 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
950
951
  if (isInvestigationTool && msg.args && typeof msg.args === "object" && "objective" in msg.args) {
951
952
  api.logger.debug(`[gemini] \u{1F50D} Investigation objective: ${String(msg.args.objective).substring(0, 150)}...`);
952
953
  }
954
+ const canonicalToolName = happyProtocol.resolveCanonicalToolNameV2(msg.toolName);
953
955
  messageBuffer.addMessage(`Executing: ${msg.toolName}${toolArgs ? ` ${toolArgs}${toolArgs.length >= 100 ? "..." : ""}` : ""}`, "tool");
954
956
  session.sendAgentMessage("gemini", {
955
957
  type: "tool-call",
956
- name: msg.toolName,
958
+ name: canonicalToolName,
957
959
  callId: msg.callId,
958
- input: msg.args,
960
+ input: happyProtocol.attachToolHappierMetaV2(msg.args, {
961
+ v: 2,
962
+ protocol: "acp",
963
+ provider: "gemini",
964
+ rawToolName: msg.toolName,
965
+ canonicalToolName
966
+ }),
959
967
  id: node_crypto.randomUUID()
960
968
  });
961
969
  break;
962
970
  case "tool-result":
963
- const isError = Boolean(msg.result && typeof msg.result === "object" && "error" in msg.result);
971
+ const isError = happyProtocol.inferToolResultError(msg.result);
964
972
  const resultText = typeof msg.result === "string" ? msg.result.substring(0, 200) : JSON.stringify(msg.result).substring(0, 200);
965
973
  const truncatedResult = resultText + (typeof msg.result === "string" && msg.result.length > 200 ? "..." : "");
966
974
  const resultSize = typeof msg.result === "string" ? msg.result.length : JSON.stringify(msg.result).length;
@@ -981,7 +989,13 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
981
989
  session.sendAgentMessage("gemini", {
982
990
  type: "tool-result",
983
991
  callId: msg.callId,
984
- output: msg.result,
992
+ output: happyProtocol.attachToolHappierMetaV2(msg.result, {
993
+ v: 2,
994
+ protocol: "acp",
995
+ provider: "gemini",
996
+ rawToolName: msg.toolName,
997
+ canonicalToolName: happyProtocol.resolveCanonicalToolNameV2(msg.toolName)
998
+ }),
985
999
  id: node_crypto.randomUUID(),
986
1000
  isError
987
1001
  });
@@ -1011,7 +1025,7 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1011
1025
  session.sendAgentMessage("gemini", {
1012
1026
  type: "terminal-output",
1013
1027
  data: msg.data,
1014
- callId: msg.callId || node_crypto.randomUUID()
1028
+ callId: msg.callId ?? node_crypto.randomUUID()
1015
1029
  });
1016
1030
  break;
1017
1031
  case "permission-request":
@@ -1030,12 +1044,18 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1030
1044
  const { call_id, type, ...inputs } = execApprovalMsg;
1031
1045
  api.logger.debug(`[gemini] Exec approval request received: ${callId}`);
1032
1046
  messageBuffer.addMessage(`Exec approval requested: ${callId}`, "tool");
1047
+ const execCanonicalToolName = happyProtocol.resolveCanonicalToolNameV2("GeminiBash");
1033
1048
  session.sendAgentMessage("gemini", {
1034
1049
  type: "tool-call",
1035
- name: "GeminiBash",
1036
- // Similar to Codex's CodexBash
1050
+ name: execCanonicalToolName,
1037
1051
  callId,
1038
- input: inputs,
1052
+ input: happyProtocol.attachToolHappierMetaV2(inputs, {
1053
+ v: 2,
1054
+ protocol: "acp",
1055
+ provider: "gemini",
1056
+ rawToolName: "GeminiBash",
1057
+ canonicalToolName: execCanonicalToolName
1058
+ }),
1039
1059
  id: node_crypto.randomUUID()
1040
1060
  });
1041
1061
  break;
@@ -1047,15 +1067,21 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1047
1067
  const filesMsg = changeCount === 1 ? "1 file" : `${changeCount} files`;
1048
1068
  messageBuffer.addMessage(`Modifying ${filesMsg}...`, "tool");
1049
1069
  api.logger.debug(`[gemini] Patch apply begin: ${patchCallId}, files: ${changeCount}`);
1070
+ const patchCanonicalToolName = happyProtocol.resolveCanonicalToolNameV2("GeminiPatch");
1050
1071
  session.sendAgentMessage("gemini", {
1051
1072
  type: "tool-call",
1052
- name: "GeminiPatch",
1053
- // Similar to Codex's CodexPatch
1073
+ name: patchCanonicalToolName,
1054
1074
  callId: patchCallId,
1055
- input: {
1075
+ input: happyProtocol.attachToolHappierMetaV2({
1056
1076
  auto_approved,
1057
1077
  changes
1058
- },
1078
+ }, {
1079
+ v: 2,
1080
+ protocol: "acp",
1081
+ provider: "gemini",
1082
+ rawToolName: "GeminiPatch",
1083
+ canonicalToolName: patchCanonicalToolName
1084
+ }),
1059
1085
  id: node_crypto.randomUUID()
1060
1086
  });
1061
1087
  break;
@@ -1074,11 +1100,17 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1074
1100
  session.sendAgentMessage("gemini", {
1075
1101
  type: "tool-result",
1076
1102
  callId: patchEndCallId,
1077
- output: {
1103
+ output: happyProtocol.attachToolHappierMetaV2({
1078
1104
  stdout,
1079
1105
  stderr,
1080
1106
  success
1081
- },
1107
+ }, {
1108
+ v: 2,
1109
+ protocol: "acp",
1110
+ provider: "gemini",
1111
+ rawToolName: "GeminiPatch",
1112
+ canonicalToolName: happyProtocol.resolveCanonicalToolNameV2("GeminiPatch")
1113
+ }),
1082
1114
  id: node_crypto.randomUUID(),
1083
1115
  isError: !success
1084
1116
  });