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
@@ -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-CIHTNilH.mjs';
5
- import { readSettings } from './persistence-sLEqV8vk.mjs';
6
- import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-Di1yEMMv.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-vNYxNqVZ.mjs';
8
- import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-uVHqIC4h.mjs';
4
+ import { l as logger, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-Emo3rSZH.mjs';
5
+ import { readSettings } from './persistence-Blm1hTQA.mjs';
6
+ import { B as BasePermissionHandler, a as BaseReasoningProcessor, c as createSessionMetadata, s as setupOfflineReconnection } from './BaseReasoningProcessor-1EzrE03x.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-Dh8UTgm4.mjs';
8
+ import { M as MessageQueue2, h as hashObject, a as MessageBuffer, r as registerKillSessionHandler } from './registerKillSessionHandler-Bm7E-03E.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: msg.toolName,
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 = Boolean(msg.result && typeof msg.result === "object" && "error" in msg.result);
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 || randomUUID()
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: "GeminiBash",
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: "GeminiPatch",
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.0.4",
3
+ "version": "2.0.6",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",
@@ -59,7 +59,7 @@
59
59
  "dev:local-server": "yarn build && tsx --env-file .env.dev-local-server src/index.ts",
60
60
  "dev:integration-test-env": "yarn build && tsx --env-file .env.integration-test src/index.ts",
61
61
  "// ==== Release ====": "",
62
- "prepublishOnly": "npm run build",
62
+ "prepublishOnly": "yarn release:smoke",
63
63
  "release": "yarn install && release-it",
64
64
  "release:smoke": "node ./scripts/release-smoke.mjs",
65
65
  "// ==== Dev/Stable Variant Management ====": "",
@@ -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",
@@ -33,6 +33,10 @@ function main() {
33
33
  runStep('unit runtime suite', 'yarn', [
34
34
  'vitest',
35
35
  'run',
36
+ 'src/agent/acp/AcpBackend.startup.test.ts',
37
+ 'src/agent/acp/acpSpawn.test.ts',
38
+ 'src/agent/acp/createAcpFilteredStdoutReadable.multiline.test.ts',
39
+ 'src/agent/acp/killProcessTree.test.ts',
36
40
  'src/runtime/executeProvider.test.ts',
37
41
  'src/runtime/command.test.ts',
38
42
  'src/runtime/launch.test.ts',