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.
- package/dist/{BaseReasoningProcessor-DEEfNi5Y.cjs → BaseReasoningProcessor-DPVZIJ4n.cjs} +2 -2
- package/dist/{BaseReasoningProcessor-Di1yEMMv.mjs → BaseReasoningProcessor-bFVTvf3Q.mjs} +2 -2
- package/dist/{api-CyJG1mr6.cjs → api-DaqnNHfl.cjs} +4 -2
- package/dist/{api-CIHTNilH.mjs → api-DoHt-HyL.mjs} +4 -2
- package/dist/{command-CPlJKXDn.cjs → command-D9-hmqVq.cjs} +3 -3
- package/dist/{command-BERqmFB0.mjs → command-Dl9SrMnv.mjs} +3 -3
- package/dist/{index-vNYxNqVZ.mjs → index-C5wR2qKT.mjs} +141 -47
- package/dist/{index-1zlH6s7a.cjs → index-Dc92gnxM.cjs} +143 -49
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-BeFVx6kI.cjs → persistence-D6Y0604_.cjs} +1 -1
- package/dist/{persistence-sLEqV8vk.mjs → persistence-QqeBvUxX.mjs} +1 -1
- package/dist/{registerKillSessionHandler-CCxqGFjZ.cjs → registerKillSessionHandler-C6yXr8ky.cjs} +2 -2
- package/dist/{registerKillSessionHandler-uVHqIC4h.mjs → registerKillSessionHandler-CC9zGBPE.mjs} +2 -2
- package/dist/{runClaude-Dl9nIRIg.mjs → runClaude-CZ8gxaJL.mjs} +4 -4
- package/dist/{runClaude-Dz-PCSvb.cjs → runClaude-gHKFB1UG.cjs} +5 -5
- package/dist/{runCodex-BtZplK1R.cjs → runCodex-CdjzG1N7.cjs} +53 -17
- package/dist/{runCodex-DgKKw3IU.mjs → runCodex-DT7g4MPm.mjs} +53 -17
- package/dist/{runGemini-CM1v3I24.mjs → runGemini-CmY5386l.mjs} +51 -19
- package/dist/{runGemini-DUyH311Z.cjs → runGemini-DxjvRmOc.cjs} +51 -19
- package/package.json +2 -1
|
@@ -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-
|
|
3
|
-
import { readSettings } from './persistence-
|
|
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-
|
|
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-
|
|
6
|
-
import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-
|
|
2
|
+
import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DoHt-HyL.mjs';
|
|
3
|
+
import { readSettings } from './persistence-QqeBvUxX.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-C5wR2qKT.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-bFVTvf3Q.mjs';
|
|
6
|
+
import { h as hashObject, a as MessageBuffer, r as registerKillSessionHandler, M as MessageQueue2 } from './registerKillSessionHandler-CC9zGBPE.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:
|
|
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
|
|
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:
|
|
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:
|
|
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
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
3
|
import { randomUUID } from 'node:crypto';
|
|
4
|
-
import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-
|
|
5
|
-
import { readSettings } from './persistence-
|
|
6
|
-
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-
|
|
7
|
-
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-
|
|
8
|
-
import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-
|
|
4
|
+
import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-DoHt-HyL.mjs';
|
|
5
|
+
import { readSettings } from './persistence-QqeBvUxX.mjs';
|
|
6
|
+
import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-bFVTvf3Q.mjs';
|
|
7
|
+
import { i as initialMachineMetadata, n as notifyDaemonSessionStarted, g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-C5wR2qKT.mjs';
|
|
8
|
+
import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-CC9zGBPE.mjs';
|
|
9
|
+
import { attachToolHappierMetaV2, resolveCanonicalToolNameV2, inferToolResultError } from 'happy-protocol';
|
|
9
10
|
import 'axios';
|
|
10
11
|
import 'chalk';
|
|
11
12
|
import 'fs';
|
|
@@ -948,17 +949,24 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
948
949
|
if (isInvestigationTool && msg.args && typeof msg.args === "object" && "objective" in msg.args) {
|
|
949
950
|
logger.debug(`[gemini] \u{1F50D} Investigation objective: ${String(msg.args.objective).substring(0, 150)}...`);
|
|
950
951
|
}
|
|
952
|
+
const canonicalToolName = resolveCanonicalToolNameV2(msg.toolName);
|
|
951
953
|
messageBuffer.addMessage(`Executing: ${msg.toolName}${toolArgs ? ` ${toolArgs}${toolArgs.length >= 100 ? "..." : ""}` : ""}`, "tool");
|
|
952
954
|
session.sendAgentMessage("gemini", {
|
|
953
955
|
type: "tool-call",
|
|
954
|
-
name:
|
|
956
|
+
name: canonicalToolName,
|
|
955
957
|
callId: msg.callId,
|
|
956
|
-
input: msg.args,
|
|
958
|
+
input: attachToolHappierMetaV2(msg.args, {
|
|
959
|
+
v: 2,
|
|
960
|
+
protocol: "acp",
|
|
961
|
+
provider: "gemini",
|
|
962
|
+
rawToolName: msg.toolName,
|
|
963
|
+
canonicalToolName
|
|
964
|
+
}),
|
|
957
965
|
id: randomUUID()
|
|
958
966
|
});
|
|
959
967
|
break;
|
|
960
968
|
case "tool-result":
|
|
961
|
-
const isError =
|
|
969
|
+
const isError = inferToolResultError(msg.result);
|
|
962
970
|
const resultText = typeof msg.result === "string" ? msg.result.substring(0, 200) : JSON.stringify(msg.result).substring(0, 200);
|
|
963
971
|
const truncatedResult = resultText + (typeof msg.result === "string" && msg.result.length > 200 ? "..." : "");
|
|
964
972
|
const resultSize = typeof msg.result === "string" ? msg.result.length : JSON.stringify(msg.result).length;
|
|
@@ -979,7 +987,13 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
979
987
|
session.sendAgentMessage("gemini", {
|
|
980
988
|
type: "tool-result",
|
|
981
989
|
callId: msg.callId,
|
|
982
|
-
output: msg.result,
|
|
990
|
+
output: attachToolHappierMetaV2(msg.result, {
|
|
991
|
+
v: 2,
|
|
992
|
+
protocol: "acp",
|
|
993
|
+
provider: "gemini",
|
|
994
|
+
rawToolName: msg.toolName,
|
|
995
|
+
canonicalToolName: resolveCanonicalToolNameV2(msg.toolName)
|
|
996
|
+
}),
|
|
983
997
|
id: randomUUID(),
|
|
984
998
|
isError
|
|
985
999
|
});
|
|
@@ -1009,7 +1023,7 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1009
1023
|
session.sendAgentMessage("gemini", {
|
|
1010
1024
|
type: "terminal-output",
|
|
1011
1025
|
data: msg.data,
|
|
1012
|
-
callId: msg.callId
|
|
1026
|
+
callId: msg.callId ?? randomUUID()
|
|
1013
1027
|
});
|
|
1014
1028
|
break;
|
|
1015
1029
|
case "permission-request":
|
|
@@ -1028,12 +1042,18 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1028
1042
|
const { call_id, type, ...inputs } = execApprovalMsg;
|
|
1029
1043
|
logger.debug(`[gemini] Exec approval request received: ${callId}`);
|
|
1030
1044
|
messageBuffer.addMessage(`Exec approval requested: ${callId}`, "tool");
|
|
1045
|
+
const execCanonicalToolName = resolveCanonicalToolNameV2("GeminiBash");
|
|
1031
1046
|
session.sendAgentMessage("gemini", {
|
|
1032
1047
|
type: "tool-call",
|
|
1033
|
-
name:
|
|
1034
|
-
// Similar to Codex's CodexBash
|
|
1048
|
+
name: execCanonicalToolName,
|
|
1035
1049
|
callId,
|
|
1036
|
-
input: inputs,
|
|
1050
|
+
input: attachToolHappierMetaV2(inputs, {
|
|
1051
|
+
v: 2,
|
|
1052
|
+
protocol: "acp",
|
|
1053
|
+
provider: "gemini",
|
|
1054
|
+
rawToolName: "GeminiBash",
|
|
1055
|
+
canonicalToolName: execCanonicalToolName
|
|
1056
|
+
}),
|
|
1037
1057
|
id: randomUUID()
|
|
1038
1058
|
});
|
|
1039
1059
|
break;
|
|
@@ -1045,15 +1065,21 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1045
1065
|
const filesMsg = changeCount === 1 ? "1 file" : `${changeCount} files`;
|
|
1046
1066
|
messageBuffer.addMessage(`Modifying ${filesMsg}...`, "tool");
|
|
1047
1067
|
logger.debug(`[gemini] Patch apply begin: ${patchCallId}, files: ${changeCount}`);
|
|
1068
|
+
const patchCanonicalToolName = resolveCanonicalToolNameV2("GeminiPatch");
|
|
1048
1069
|
session.sendAgentMessage("gemini", {
|
|
1049
1070
|
type: "tool-call",
|
|
1050
|
-
name:
|
|
1051
|
-
// Similar to Codex's CodexPatch
|
|
1071
|
+
name: patchCanonicalToolName,
|
|
1052
1072
|
callId: patchCallId,
|
|
1053
|
-
input: {
|
|
1073
|
+
input: attachToolHappierMetaV2({
|
|
1054
1074
|
auto_approved,
|
|
1055
1075
|
changes
|
|
1056
|
-
},
|
|
1076
|
+
}, {
|
|
1077
|
+
v: 2,
|
|
1078
|
+
protocol: "acp",
|
|
1079
|
+
provider: "gemini",
|
|
1080
|
+
rawToolName: "GeminiPatch",
|
|
1081
|
+
canonicalToolName: patchCanonicalToolName
|
|
1082
|
+
}),
|
|
1057
1083
|
id: randomUUID()
|
|
1058
1084
|
});
|
|
1059
1085
|
break;
|
|
@@ -1072,11 +1098,17 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
|
|
|
1072
1098
|
session.sendAgentMessage("gemini", {
|
|
1073
1099
|
type: "tool-result",
|
|
1074
1100
|
callId: patchEndCallId,
|
|
1075
|
-
output: {
|
|
1101
|
+
output: attachToolHappierMetaV2({
|
|
1076
1102
|
stdout,
|
|
1077
1103
|
stderr,
|
|
1078
1104
|
success
|
|
1079
|
-
},
|
|
1105
|
+
}, {
|
|
1106
|
+
v: 2,
|
|
1107
|
+
protocol: "acp",
|
|
1108
|
+
provider: "gemini",
|
|
1109
|
+
rawToolName: "GeminiPatch",
|
|
1110
|
+
canonicalToolName: resolveCanonicalToolNameV2("GeminiPatch")
|
|
1111
|
+
}),
|
|
1080
1112
|
id: randomUUID(),
|
|
1081
1113
|
isError: !success
|
|
1082
1114
|
});
|
|
@@ -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-
|
|
7
|
-
var persistence = require('./persistence-
|
|
8
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
9
|
-
var index = require('./index-
|
|
10
|
-
var registerKillSessionHandler = require('./registerKillSessionHandler-
|
|
6
|
+
var api = require('./api-DaqnNHfl.cjs');
|
|
7
|
+
var persistence = require('./persistence-D6Y0604_.cjs');
|
|
8
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-DPVZIJ4n.cjs');
|
|
9
|
+
var index = require('./index-Dc92gnxM.cjs');
|
|
10
|
+
var registerKillSessionHandler = require('./registerKillSessionHandler-C6yXr8ky.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:
|
|
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 =
|
|
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
|
|
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:
|
|
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:
|
|
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
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "happy-imou-cloud",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
|
|
5
5
|
"author": "long.zhu",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"expo-server-sdk": "^3.15.0",
|
|
100
100
|
"fastify": "^5.6.2",
|
|
101
101
|
"fastify-type-provider-zod": "4.0.2",
|
|
102
|
+
"happy-protocol": "0.1.0",
|
|
102
103
|
"http-proxy": "^1.18.1",
|
|
103
104
|
"http-proxy-middleware": "^3.0.5",
|
|
104
105
|
"ink": "^6.5.1",
|