happy-imou-cloud 2.1.4 → 2.1.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 (30) hide show
  1. package/bin/happy-cloud.mjs +38 -38
  2. package/dist/{BaseReasoningProcessor-lTsZVuAU.mjs → BaseReasoningProcessor-CTWoJTb8.mjs} +3 -3
  3. package/dist/{BaseReasoningProcessor-DgdsExMH.cjs → BaseReasoningProcessor-DsunYoSL.cjs} +3 -3
  4. package/dist/{ProviderSelectionHandler-Bavm9TDG.cjs → ProviderSelectionHandler-BxcgZ5df.cjs} +2 -2
  5. package/dist/{ProviderSelectionHandler-CGTnB7ba.mjs → ProviderSelectionHandler-LiWZjziD.mjs} +2 -2
  6. package/dist/{api-B6ESNpGB.cjs → api-DOn5w7Lv.cjs} +2 -2
  7. package/dist/{api-l8X03rs-.mjs → api-RxQ4bfJm.mjs} +2 -2
  8. package/dist/{command-BVCkEMtp.mjs → command-BZ8G4IiN.mjs} +3 -3
  9. package/dist/{command-DPLKOzMr.cjs → command-C3XGNSfh.cjs} +3 -3
  10. package/dist/{index-D1BP-fEm.cjs → index-C06zeR85.cjs} +11 -11
  11. package/dist/{index-D72RMo5Z.mjs → index-CQEVJsPp.mjs} +8 -8
  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-CyFjFOlN.mjs → persistence-Bf5FdmEK.mjs} +1 -1
  17. package/dist/{persistence-EDmI-c8T.cjs → persistence-DuakVvfB.cjs} +1 -1
  18. package/dist/{registerKillSessionHandler-71xCO8e_.cjs → registerKillSessionHandler-BRC1HO05.cjs} +72 -8
  19. package/dist/{registerKillSessionHandler-DAVhkb-l.mjs → registerKillSessionHandler-BuzsaxI2.mjs} +72 -8
  20. package/dist/{runClaude-DjnTGJGC.cjs → runClaude-C8Lx-Xij.cjs} +5 -5
  21. package/dist/{runClaude-BRhQLKjh.mjs → runClaude-Cg8x5JOI.mjs} +5 -5
  22. package/dist/{runCodex-DUs_jBE-.mjs → runCodex-e4wK1OuI.mjs} +6 -6
  23. package/dist/{runCodex-BHq7Rnq7.cjs → runCodex-rYroXLgt.cjs} +6 -6
  24. package/dist/{runGemini-hkZeOnA_.cjs → runGemini-Bjw2PSMh.cjs} +5 -5
  25. package/dist/{runGemini-pmvBZ6qU.mjs → runGemini-Cd1FWJJ_.mjs} +5 -5
  26. package/package.json +2 -2
  27. package/scripts/devtools/README.md +9 -9
  28. package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
  29. package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
  30. package/scripts/ensureAcpSdkCompat.mjs +1 -1
@@ -1,8 +1,8 @@
1
- import { i as initialMachineMetadata, e as projectPath, R as RuntimeShell, h as resolveCanonicalToolNameV2, f as formatDisplayMessage } from './index-D72RMo5Z.mjs';
2
- import { readSettings } from './persistence-CyFjFOlN.mjs';
1
+ import { i as initialMachineMetadata, e as projectPath, R as RuntimeShell, h as resolveCanonicalToolNameV2, f as formatDisplayMessage } from './index-CQEVJsPp.mjs';
2
+ import { readSettings } from './persistence-Bf5FdmEK.mjs';
3
3
  import os from 'node:os';
4
4
  import { resolve } from 'node:path';
5
- import { c as configuration, p as packageJson, H as HAPPY_ORG_TURN_REPORT_TAG, d as HAPPY_ORG_SUMMARY_MAX_LENGTH, f as HAPPY_ORG_REPEAT_THRESHOLD, l as logger } from './api-l8X03rs-.mjs';
5
+ import { c as configuration, p as packageJson, H as HAPPY_ORG_TURN_REPORT_TAG, d as HAPPY_ORG_SUMMARY_MAX_LENGTH, f as HAPPY_ORG_REPEAT_THRESHOLD, l as logger } from './api-RxQ4bfJm.mjs';
6
6
  import { randomUUID } from 'node:crypto';
7
7
  import { createHash } from 'crypto';
8
8
  import 'axios';
@@ -114,6 +114,62 @@ function attachToolHappierMetaV2(value, meta) {
114
114
  };
115
115
  }
116
116
 
117
+ const DISPLAY_FRIENDLY_TOOL_FIELDS = ["stdout", "stderr", "output", "text", "message", "detail", "reason", "data"];
118
+ function isRecord(value) {
119
+ return !!value && typeof value === "object" && !Array.isArray(value);
120
+ }
121
+ function stripInternalToolMeta(value) {
122
+ if (!isRecord(value)) {
123
+ return value;
124
+ }
125
+ const {
126
+ _happier: _ignoredHappier,
127
+ _happy: _ignoredHappy,
128
+ ...rest
129
+ } = value;
130
+ return rest;
131
+ }
132
+ function extractNestedTextContent(value) {
133
+ if (typeof value === "string") {
134
+ return value.trim().length > 0 ? value : null;
135
+ }
136
+ if (Array.isArray(value)) {
137
+ const parts = value.map((item) => extractNestedTextContent(item)).filter((item) => typeof item === "string" && item.length > 0);
138
+ return parts.length > 0 ? parts.join("\n") : null;
139
+ }
140
+ if (!isRecord(value)) {
141
+ return null;
142
+ }
143
+ if (typeof value.text === "string" && value.text.trim().length > 0) {
144
+ return value.text;
145
+ }
146
+ if ("content" in value) {
147
+ return extractNestedTextContent(value.content);
148
+ }
149
+ return null;
150
+ }
151
+ function normalizeCodexToolInput(value) {
152
+ return stripInternalToolMeta(value);
153
+ }
154
+ function normalizeCodexToolOutput(value) {
155
+ const sanitized = stripInternalToolMeta(value);
156
+ if (!isRecord(sanitized)) {
157
+ return sanitized;
158
+ }
159
+ const hasDisplayFriendlyField = DISPLAY_FRIENDLY_TOOL_FIELDS.some((field) => field in sanitized);
160
+ if (hasDisplayFriendlyField || !("content" in sanitized)) {
161
+ return sanitized;
162
+ }
163
+ const flattenedText = extractNestedTextContent(sanitized.content);
164
+ if (!flattenedText) {
165
+ return sanitized;
166
+ }
167
+ const { content: _content, ...rest } = sanitized;
168
+ return {
169
+ ...rest,
170
+ text: flattenedText
171
+ };
172
+ }
117
173
  function getDefaultExecToolName(provider) {
118
174
  switch (provider) {
119
175
  case "claude":
@@ -144,6 +200,14 @@ function attachToolMeta(provider, rawToolName, value) {
144
200
  canonicalToolName
145
201
  });
146
202
  }
203
+ function prepareToolInput(provider, rawToolName, value) {
204
+ const enriched = attachToolMeta(provider, rawToolName, value);
205
+ return provider === "codex" ? normalizeCodexToolInput(enriched) : enriched;
206
+ }
207
+ function prepareToolOutput(provider, rawToolName, value) {
208
+ const enriched = attachToolMeta(provider, rawToolName, value);
209
+ return provider === "codex" ? normalizeCodexToolOutput(enriched) : enriched;
210
+ }
147
211
  function forwardAgentMessageToProviderSession(msg, options) {
148
212
  const createId = options.createId ?? randomUUID;
149
213
  const toolResultType = options.toolResultType ?? "tool-result";
@@ -153,7 +217,7 @@ function forwardAgentMessageToProviderSession(msg, options) {
153
217
  type: "tool-call",
154
218
  name: resolveCanonicalToolNameV2(msg.toolName),
155
219
  callId: msg.callId,
156
- input: attachToolMeta(options.provider, msg.toolName, msg.args),
220
+ input: prepareToolInput(options.provider, msg.toolName, msg.args),
157
221
  id: createId()
158
222
  });
159
223
  return true;
@@ -162,7 +226,7 @@ function forwardAgentMessageToProviderSession(msg, options) {
162
226
  options.send({
163
227
  type: toolResultType,
164
228
  callId: msg.callId,
165
- output: attachToolMeta(options.provider, msg.toolName, msg.result),
229
+ output: prepareToolOutput(options.provider, msg.toolName, msg.result),
166
230
  id: createId(),
167
231
  isError: inferToolResultError(msg.result)
168
232
  });
@@ -204,7 +268,7 @@ function forwardAgentMessageToProviderSession(msg, options) {
204
268
  type: "tool-call",
205
269
  name: resolveCanonicalToolNameV2(rawToolName),
206
270
  callId: call_id,
207
- input: attachToolMeta(options.provider, rawToolName, inputs),
271
+ input: prepareToolInput(options.provider, rawToolName, inputs),
208
272
  id: createId()
209
273
  });
210
274
  return true;
@@ -215,7 +279,7 @@ function forwardAgentMessageToProviderSession(msg, options) {
215
279
  type: "tool-call",
216
280
  name: resolveCanonicalToolNameV2(rawToolName),
217
281
  callId: msg.call_id,
218
- input: attachToolMeta(options.provider, rawToolName, {
282
+ input: prepareToolInput(options.provider, rawToolName, {
219
283
  auto_approved: msg.auto_approved,
220
284
  changes: msg.changes
221
285
  }),
@@ -228,7 +292,7 @@ function forwardAgentMessageToProviderSession(msg, options) {
228
292
  options.send({
229
293
  type: toolResultType,
230
294
  callId: msg.call_id,
231
- output: attachToolMeta(options.provider, rawToolName, {
295
+ output: prepareToolOutput(options.provider, rawToolName, {
232
296
  stdout: msg.stdout,
233
297
  stderr: msg.stderr,
234
298
  success: msg.success
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var api = require('./api-B6ESNpGB.cjs');
4
+ var api = require('./api-DOn5w7Lv.cjs');
5
5
  require('cross-spawn');
6
6
  require('@agentclientprotocol/sdk');
7
- var index = require('./index-D1BP-fEm.cjs');
7
+ var index = require('./index-C06zeR85.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-EDmI-c8T.cjs');
18
+ require('./persistence-DuakVvfB.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-Bavm9TDG.cjs');
29
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-BxcgZ5df.cjs');
30
30
  var types = require('./types-DVk3crez.cjs');
31
- var registerKillSessionHandler = require('./registerKillSessionHandler-71xCO8e_.cjs');
31
+ var registerKillSessionHandler = require('./registerKillSessionHandler-BRC1HO05.cjs');
32
32
  require('socket.io-client');
33
33
  require('expo-server-sdk');
34
34
  var node_util = require('node:util');
@@ -1,8 +1,8 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-l8X03rs-.mjs';
2
+ import { l as logger, g as backoff, h as delay, j as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError } from './api-RxQ4bfJm.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-D72RMo5Z.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-CQEVJsPp.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-CyFjFOlN.mjs';
16
+ import './persistence-Bf5FdmEK.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-CGTnB7ba.mjs';
27
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-LiWZjziD.mjs';
28
28
  import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
29
- import { B as BasePermissionHandler, f as MessageBuffer, C as ConversationHistory$1, i as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, j as finalizeHappyOrgTurn, l as launchRuntimeHandleWithFactoryResult, n as forwardAgentMessageToProviderSession, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, c as createSessionMetadata, b as MessageQueue2, h as hashObject, d as registerKillSessionHandler, k as closeProviderSession } from './registerKillSessionHandler-DAVhkb-l.mjs';
29
+ import { B as BasePermissionHandler, f as MessageBuffer, C as ConversationHistory$1, i as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, j as finalizeHappyOrgTurn, l as launchRuntimeHandleWithFactoryResult, n as forwardAgentMessageToProviderSession, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, c as createSessionMetadata, b as MessageQueue2, h as hashObject, d as registerKillSessionHandler, k as closeProviderSession } from './registerKillSessionHandler-BuzsaxI2.mjs';
30
30
  import 'socket.io-client';
31
31
  import 'expo-server-sdk';
32
32
  import { isDeepStrictEqual } from '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-l8X03rs-.mjs';
3
- import { B as BasePermissionHandler, h as hashObject, f as MessageBuffer, C as ConversationHistory$1, i as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, j as finalizeHappyOrgTurn, d as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, m as inferToolResultError, n as forwardAgentMessageToProviderSession, k as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-DAVhkb-l.mjs';
4
- import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-D72RMo5Z.mjs';
2
+ import { l as logger, b as connectionState, A as ApiClient } from './api-RxQ4bfJm.mjs';
3
+ import { B as BasePermissionHandler, h as hashObject, f as MessageBuffer, C as ConversationHistory$1, i as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, j as finalizeHappyOrgTurn, d as registerKillSessionHandler, l as launchRuntimeHandleWithFactoryResult, m as inferToolResultError, n as forwardAgentMessageToProviderSession, k as closeProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './registerKillSessionHandler-BuzsaxI2.mjs';
4
+ import { f as formatDisplayMessage, v as validateCodexAcpSpawn, d as createCodexBackend, t as truncateDisplayMessage, b as stopCaffeinate } from './index-CQEVJsPp.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-CyFjFOlN.mjs';
17
+ import './persistence-Bf5FdmEK.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-CGTnB7ba.mjs';
29
- import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-lTsZVuAU.mjs';
28
+ import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-LiWZjziD.mjs';
29
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CTWoJTb8.mjs';
30
30
  import 'zod';
31
31
  import 'socket.io-client';
32
32
  import 'expo-server-sdk';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var api = require('./api-B6ESNpGB.cjs');
5
- var registerKillSessionHandler = require('./registerKillSessionHandler-71xCO8e_.cjs');
6
- var index = require('./index-D1BP-fEm.cjs');
4
+ var api = require('./api-DOn5w7Lv.cjs');
5
+ var registerKillSessionHandler = require('./registerKillSessionHandler-BRC1HO05.cjs');
6
+ var index = require('./index-C06zeR85.cjs');
7
7
  require('cross-spawn');
8
8
  require('@agentclientprotocol/sdk');
9
9
  require('ps-list');
@@ -16,7 +16,7 @@ require('node:path');
16
16
  require('node:os');
17
17
  require('node:child_process');
18
18
  require('node:readline');
19
- require('./persistence-EDmI-c8T.cjs');
19
+ require('./persistence-DuakVvfB.cjs');
20
20
  require('node:fs/promises');
21
21
  require('fs/promises');
22
22
  require('crypto');
@@ -27,8 +27,8 @@ require('tweetnacl');
27
27
  require('open');
28
28
  var React = require('react');
29
29
  var ink = require('ink');
30
- var ProviderSelectionHandler = require('./ProviderSelectionHandler-Bavm9TDG.cjs');
31
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DgdsExMH.cjs');
30
+ var ProviderSelectionHandler = require('./ProviderSelectionHandler-BxcgZ5df.cjs');
31
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-DsunYoSL.cjs');
32
32
  require('zod');
33
33
  require('socket.io-client');
34
34
  require('expo-server-sdk');
@@ -3,10 +3,10 @@
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-B6ESNpGB.cjs');
7
- var registerKillSessionHandler = require('./registerKillSessionHandler-71xCO8e_.cjs');
8
- var index = require('./index-D1BP-fEm.cjs');
9
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-DgdsExMH.cjs');
6
+ var api = require('./api-DOn5w7Lv.cjs');
7
+ var registerKillSessionHandler = require('./registerKillSessionHandler-BRC1HO05.cjs');
8
+ var index = require('./index-C06zeR85.cjs');
9
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-DsunYoSL.cjs');
10
10
  require('cross-spawn');
11
11
  require('@agentclientprotocol/sdk');
12
12
  require('ps-list');
@@ -17,7 +17,7 @@ require('node:child_process');
17
17
  require('node:readline');
18
18
  require('tweetnacl');
19
19
  require('axios');
20
- require('./persistence-EDmI-c8T.cjs');
20
+ require('./persistence-DuakVvfB.cjs');
21
21
  require('open');
22
22
  require('chalk');
23
23
  require('fs');
@@ -1,10 +1,10 @@
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 } from './api-l8X03rs-.mjs';
5
- import { B as BasePermissionHandler, C as ConversationHistory$1, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, h as hashObject, d as registerKillSessionHandler, f as MessageBuffer, i as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, j as finalizeHappyOrgTurn, k as closeProviderSession, l as launchRuntimeHandleWithFactoryResult, m as inferToolResultError, n as forwardAgentMessageToProviderSession } from './registerKillSessionHandler-DAVhkb-l.mjs';
6
- import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-D72RMo5Z.mjs';
7
- import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-lTsZVuAU.mjs';
4
+ import { l as logger, b as connectionState, A as ApiClient } from './api-RxQ4bfJm.mjs';
5
+ import { B as BasePermissionHandler, C as ConversationHistory$1, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, s as syncControlledByUserState, b as MessageQueue2, h as hashObject, d as registerKillSessionHandler, f as MessageBuffer, i as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, j as finalizeHappyOrgTurn, k as closeProviderSession, l as launchRuntimeHandleWithFactoryResult, m as inferToolResultError, n as forwardAgentMessageToProviderSession } from './registerKillSessionHandler-BuzsaxI2.mjs';
6
+ import { g as getInitialGeminiModel, r as readGeminiLocalConfig, G as GEMINI_MODEL_ENV, s as saveGeminiModelToConfig, a as createGeminiBackend, b as stopCaffeinate } from './index-CQEVJsPp.mjs';
7
+ import { B as BaseReasoningProcessor, b as bootstrapManagedProviderSession } from './BaseReasoningProcessor-CTWoJTb8.mjs';
8
8
  import 'cross-spawn';
9
9
  import '@agentclientprotocol/sdk';
10
10
  import 'ps-list';
@@ -15,7 +15,7 @@ import 'node:child_process';
15
15
  import 'node:readline';
16
16
  import 'tweetnacl';
17
17
  import 'axios';
18
- import './persistence-CyFjFOlN.mjs';
18
+ import './persistence-Bf5FdmEK.mjs';
19
19
  import 'open';
20
20
  import 'chalk';
21
21
  import 'fs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.1.4",
3
+ "version": "2.1.5",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",
@@ -125,7 +125,7 @@
125
125
  "shx": "^0.3.3",
126
126
  "ts-node": "^10",
127
127
  "tsx": "^4.20.6",
128
- "typescript": "5.9.3",
128
+ "typescript": "5.9.3",
129
129
  "vitest": "^3.2.4"
130
130
  },
131
131
  "resolutions": {
@@ -1,9 +1,9 @@
1
- # CLI Devtools
2
-
3
- 这组脚本用于 CLI 本地开发辅助。
4
-
5
- 当前包含:
6
-
7
- - mock credentials 生成器
8
-
9
- 新增 CLI 专属开发脚本应优先放在这里。
1
+ # CLI Devtools
2
+
3
+ 这组脚本用于 CLI 本地开发辅助。
4
+
5
+ 当前包含:
6
+
7
+ - mock credentials 生成器
8
+
9
+ 新增 CLI 专属开发脚本应优先放在这里。
@@ -1,139 +1,139 @@
1
- #!/usr/bin/env node
2
-
3
- import { appendFileSync } from 'node:fs';
4
-
5
- const decoder = new TextDecoder();
6
- let buffer = '';
7
- let sessionId = 'fake-codex-session';
8
- const logPath = process.env.HAPPY_E2E_FAKE_ACP_LOG || '';
9
-
10
- function send(payload) {
11
- process.stdout.write(`${JSON.stringify(payload)}\n`);
12
- }
13
-
14
- function trace(message) {
15
- if (!logPath) {
16
- return;
17
- }
18
-
19
- appendFileSync(logPath, `${message}\n`, 'utf8');
20
- }
21
-
22
- function ok(id, result) {
23
- send({
24
- jsonrpc: '2.0',
25
- id,
26
- result,
27
- });
28
- }
29
-
30
- function parsePromptText(params) {
31
- const blocks = Array.isArray(params?.prompt) ? params.prompt : [];
32
- return blocks
33
- .map((block) => (block && typeof block === 'object' && typeof block.text === 'string' ? block.text : ''))
34
- .filter(Boolean)
35
- .join('\n');
36
- }
37
-
38
- function emitPromptResponse(promptText) {
39
- const replyPrefix = process.env.HAPPY_E2E_FAKE_ACP_RESPONSE || 'LOCAL_E2E_ACK';
40
- const replyText = `${replyPrefix}: ${promptText}`.trim();
41
- trace(`prompt=${JSON.stringify(promptText)}`);
42
- trace(`reply=${JSON.stringify(replyText)}`);
43
-
44
- setTimeout(() => {
45
- send({
46
- jsonrpc: '2.0',
47
- method: 'session/update',
48
- params: {
49
- sessionId,
50
- update: {
51
- sessionUpdate: 'agent_message_chunk',
52
- content: {
53
- type: 'text',
54
- text: replyText,
55
- },
56
- },
57
- },
58
- });
59
-
60
- send({
61
- jsonrpc: '2.0',
62
- method: 'session/update',
63
- params: {
64
- sessionId,
65
- update: {
66
- sessionUpdate: 'task_complete',
67
- usage: {
68
- input_tokens: Math.max(1, promptText.length),
69
- output_tokens: Math.max(1, replyText.length),
70
- total_tokens: Math.max(2, promptText.length + replyText.length),
71
- },
72
- },
73
- },
74
- });
75
- }, 50);
76
- }
77
-
78
- process.stdin.on('data', (chunk) => {
79
- buffer += decoder.decode(chunk, { stream: true });
80
- const lines = buffer.split('\n');
81
- buffer = lines.pop() || '';
82
-
83
- for (const line of lines) {
84
- const trimmed = line.trim();
85
- if (!trimmed) {
86
- continue;
87
- }
88
-
89
- let request;
90
- try {
91
- request = JSON.parse(trimmed);
92
- } catch {
93
- continue;
94
- }
95
-
96
- const id = request?.id;
97
- const method = request?.method;
98
-
99
- if (typeof method !== 'string' || id === undefined || id === null) {
100
- continue;
101
- }
102
-
103
- trace(`method=${method}`);
104
-
105
- if (method === 'initialize') {
106
- ok(id, {
107
- protocolVersion: 1,
108
- authMethods: [],
109
- });
110
- continue;
111
- }
112
-
113
- if (method === 'session/new') {
114
- sessionId = request?.params?.cwd
115
- ? `fake-codex-session:${request.params.cwd}`
116
- : 'fake-codex-session';
117
- ok(id, { sessionId });
118
- continue;
119
- }
120
-
121
- if (method === 'session/prompt') {
122
- ok(id, {});
123
- emitPromptResponse(parsePromptText(request?.params));
124
- continue;
125
- }
126
-
127
- if (method === 'session/cancel') {
128
- ok(id, {});
129
- continue;
130
- }
131
-
132
- ok(id, {});
133
- }
134
- });
135
-
136
- process.stdin.on('end', () => {
137
- trace('stdin=end');
138
- process.exit(0);
139
- });
1
+ #!/usr/bin/env node
2
+
3
+ import { appendFileSync } from 'node:fs';
4
+
5
+ const decoder = new TextDecoder();
6
+ let buffer = '';
7
+ let sessionId = 'fake-codex-session';
8
+ const logPath = process.env.HAPPY_E2E_FAKE_ACP_LOG || '';
9
+
10
+ function send(payload) {
11
+ process.stdout.write(`${JSON.stringify(payload)}\n`);
12
+ }
13
+
14
+ function trace(message) {
15
+ if (!logPath) {
16
+ return;
17
+ }
18
+
19
+ appendFileSync(logPath, `${message}\n`, 'utf8');
20
+ }
21
+
22
+ function ok(id, result) {
23
+ send({
24
+ jsonrpc: '2.0',
25
+ id,
26
+ result,
27
+ });
28
+ }
29
+
30
+ function parsePromptText(params) {
31
+ const blocks = Array.isArray(params?.prompt) ? params.prompt : [];
32
+ return blocks
33
+ .map((block) => (block && typeof block === 'object' && typeof block.text === 'string' ? block.text : ''))
34
+ .filter(Boolean)
35
+ .join('\n');
36
+ }
37
+
38
+ function emitPromptResponse(promptText) {
39
+ const replyPrefix = process.env.HAPPY_E2E_FAKE_ACP_RESPONSE || 'LOCAL_E2E_ACK';
40
+ const replyText = `${replyPrefix}: ${promptText}`.trim();
41
+ trace(`prompt=${JSON.stringify(promptText)}`);
42
+ trace(`reply=${JSON.stringify(replyText)}`);
43
+
44
+ setTimeout(() => {
45
+ send({
46
+ jsonrpc: '2.0',
47
+ method: 'session/update',
48
+ params: {
49
+ sessionId,
50
+ update: {
51
+ sessionUpdate: 'agent_message_chunk',
52
+ content: {
53
+ type: 'text',
54
+ text: replyText,
55
+ },
56
+ },
57
+ },
58
+ });
59
+
60
+ send({
61
+ jsonrpc: '2.0',
62
+ method: 'session/update',
63
+ params: {
64
+ sessionId,
65
+ update: {
66
+ sessionUpdate: 'task_complete',
67
+ usage: {
68
+ input_tokens: Math.max(1, promptText.length),
69
+ output_tokens: Math.max(1, replyText.length),
70
+ total_tokens: Math.max(2, promptText.length + replyText.length),
71
+ },
72
+ },
73
+ },
74
+ });
75
+ }, 50);
76
+ }
77
+
78
+ process.stdin.on('data', (chunk) => {
79
+ buffer += decoder.decode(chunk, { stream: true });
80
+ const lines = buffer.split('\n');
81
+ buffer = lines.pop() || '';
82
+
83
+ for (const line of lines) {
84
+ const trimmed = line.trim();
85
+ if (!trimmed) {
86
+ continue;
87
+ }
88
+
89
+ let request;
90
+ try {
91
+ request = JSON.parse(trimmed);
92
+ } catch {
93
+ continue;
94
+ }
95
+
96
+ const id = request?.id;
97
+ const method = request?.method;
98
+
99
+ if (typeof method !== 'string' || id === undefined || id === null) {
100
+ continue;
101
+ }
102
+
103
+ trace(`method=${method}`);
104
+
105
+ if (method === 'initialize') {
106
+ ok(id, {
107
+ protocolVersion: 1,
108
+ authMethods: [],
109
+ });
110
+ continue;
111
+ }
112
+
113
+ if (method === 'session/new') {
114
+ sessionId = request?.params?.cwd
115
+ ? `fake-codex-session:${request.params.cwd}`
116
+ : 'fake-codex-session';
117
+ ok(id, { sessionId });
118
+ continue;
119
+ }
120
+
121
+ if (method === 'session/prompt') {
122
+ ok(id, {});
123
+ emitPromptResponse(parsePromptText(request?.params));
124
+ continue;
125
+ }
126
+
127
+ if (method === 'session/cancel') {
128
+ ok(id, {});
129
+ continue;
130
+ }
131
+
132
+ ok(id, {});
133
+ }
134
+ });
135
+
136
+ process.stdin.on('end', () => {
137
+ trace('stdin=end');
138
+ process.exit(0);
139
+ });