happy-imou-cloud 2.0.14 → 2.0.17

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 (31) hide show
  1. package/bin/happy-cloud.mjs +1 -1
  2. package/dist/{BaseReasoningProcessor-Cwhs4PwS.cjs → BaseReasoningProcessor-BdbyUAZR.cjs} +3 -3
  3. package/dist/{BaseReasoningProcessor-CB7luAdI.mjs → BaseReasoningProcessor-wqWUBiEJ.mjs} +3 -3
  4. package/dist/{ProviderSelectionHandler-CmDe9yDh.cjs → ProviderSelectionHandler-GuW6S0tQ.cjs} +2 -2
  5. package/dist/{ProviderSelectionHandler-DnnCwXqU.mjs → ProviderSelectionHandler-oz9NjR_r.mjs} +2 -2
  6. package/dist/{api-CaqY_2x_.cjs → api-BZ2U3k-r.cjs} +90 -37
  7. package/dist/{api-Bad69WzY.mjs → api-D7DleJYY.mjs} +90 -38
  8. package/dist/{command-DkVbAV9p.cjs → command-D-GEzmAl.cjs} +3 -3
  9. package/dist/{command-D9ZaQZQN.mjs → command-DsMlcxQd.mjs} +3 -3
  10. package/dist/{index-naa51zV7.mjs → index-Cdi5KxhK.mjs} +77 -25
  11. package/dist/{index-oxTpdQx2.cjs → index-sJfKgN1y.cjs} +80 -28
  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-4BmGePWc.mjs → persistence-C0nC4mEU.mjs} +1 -1
  17. package/dist/{persistence-Byr0hWCR.cjs → persistence-JEXs_kBA.cjs} +1 -1
  18. package/dist/{registerKillSessionHandler-HO4ql8g-.mjs → registerKillSessionHandler-BRfDcq3x.mjs} +3 -3
  19. package/dist/{registerKillSessionHandler-CodtiIoq.cjs → registerKillSessionHandler-Qw8jZB2x.cjs} +3 -3
  20. package/dist/{runClaude-Ev-A-kLN.mjs → runClaude-B6fsu9Sl.mjs} +21 -5
  21. package/dist/{runClaude-C3UNcGqk.cjs → runClaude-pSj5zGWV.cjs} +21 -5
  22. package/dist/{runCodex-CNM6wz69.cjs → runCodex-ClpKXo66.cjs} +27 -8
  23. package/dist/{runCodex-BwFOTxMW.mjs → runCodex-DJrzw9x8.mjs} +27 -8
  24. package/dist/{runGemini-CXctVflO.mjs → runGemini-C7xlDIfO.mjs} +5 -5
  25. package/dist/{runGemini-DqfqSBsP.cjs → runGemini-DA5v_0X_.cjs} +5 -5
  26. package/package.json +1 -1
  27. package/scripts/build.mjs +66 -66
  28. package/scripts/devtools/README.md +9 -9
  29. package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
  30. package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
  31. package/scripts/release-smoke.mjs +20 -17
@@ -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-CaqY_2x_.cjs');
7
- var registerKillSessionHandler = require('./registerKillSessionHandler-CodtiIoq.cjs');
8
- var index = require('./index-oxTpdQx2.cjs');
9
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-Cwhs4PwS.cjs');
6
+ var api = require('./api-BZ2U3k-r.cjs');
7
+ var registerKillSessionHandler = require('./registerKillSessionHandler-Qw8jZB2x.cjs');
8
+ var index = require('./index-sJfKgN1y.cjs');
9
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-BdbyUAZR.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-Byr0hWCR.cjs');
20
+ require('./persistence-JEXs_kBA.cjs');
21
21
  require('open');
22
22
  require('chalk');
23
23
  require('fs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.0.14",
3
+ "version": "2.0.17",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",
package/scripts/build.mjs CHANGED
@@ -1,66 +1,66 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawnSync } from 'node:child_process';
4
- import { existsSync, readFileSync, rmSync } from 'node:fs';
5
- import { dirname, resolve } from 'node:path';
6
- import { fileURLToPath } from 'node:url';
7
-
8
- const here = dirname(fileURLToPath(import.meta.url));
9
- const packageRoot = resolve(here, '..');
10
- const workspaceRoot = resolve(packageRoot, '..', '..');
11
- const packageJson = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
12
-
13
- function resolveTool(binName, packageSpecs) {
14
- const suffix = process.platform === 'win32' ? '.cmd' : '';
15
- const packageLocalBin = resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`);
16
- const workspaceLocalBin = resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`);
17
-
18
- if (existsSync(packageLocalBin)) {
19
- return {
20
- command: packageLocalBin,
21
- prefixArgs: [],
22
- };
23
- }
24
-
25
- if (existsSync(workspaceLocalBin)) {
26
- return {
27
- command: workspaceLocalBin,
28
- prefixArgs: [],
29
- };
30
- }
31
-
32
- return {
33
- command: 'npx',
34
- prefixArgs: ['-y', ...packageSpecs.flatMap((packageSpec) => ['-p', packageSpec]), binName],
35
- };
36
- }
37
-
38
- function runStep(name, command, args) {
39
- console.log(`\n[build] ${name}`);
40
- console.log(`> ${command} ${args.join(' ')}`);
41
-
42
- const result = spawnSync(command, args, {
43
- cwd: packageRoot,
44
- stdio: 'inherit',
45
- shell: process.platform === 'win32',
46
- env: process.env,
47
- });
48
-
49
- if (result.status !== 0) {
50
- throw new Error(`[build] Step failed: ${name}`);
51
- }
52
- }
53
-
54
- function runTool(name, tool, args) {
55
- runStep(name, tool.command, [...tool.prefixArgs, ...args]);
56
- }
57
-
58
- const tsc = resolveTool('tsc', [`typescript@${packageJson.devDependencies.typescript}`]);
59
- const pkgroll = resolveTool('pkgroll', [
60
- `pkgroll@${packageJson.devDependencies.pkgroll}`,
61
- `typescript@${packageJson.devDependencies.typescript}`,
62
- ]);
63
-
64
- rmSync(resolve(packageRoot, 'dist'), { recursive: true, force: true });
65
- runTool('typecheck', tsc, ['--noEmit']);
66
- runTool('bundle', pkgroll, []);
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from 'node:child_process';
4
+ import { existsSync, readFileSync, rmSync } from 'node:fs';
5
+ import { dirname, resolve } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ const here = dirname(fileURLToPath(import.meta.url));
9
+ const packageRoot = resolve(here, '..');
10
+ const workspaceRoot = resolve(packageRoot, '..', '..');
11
+ const packageJson = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
12
+
13
+ function resolveTool(binName, packageSpecs) {
14
+ const suffix = process.platform === 'win32' ? '.cmd' : '';
15
+ const packageLocalBin = resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`);
16
+ const workspaceLocalBin = resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`);
17
+
18
+ if (existsSync(packageLocalBin)) {
19
+ return {
20
+ command: packageLocalBin,
21
+ prefixArgs: [],
22
+ };
23
+ }
24
+
25
+ if (existsSync(workspaceLocalBin)) {
26
+ return {
27
+ command: workspaceLocalBin,
28
+ prefixArgs: [],
29
+ };
30
+ }
31
+
32
+ return {
33
+ command: 'npx',
34
+ prefixArgs: ['-y', ...packageSpecs.flatMap((packageSpec) => ['-p', packageSpec]), binName],
35
+ };
36
+ }
37
+
38
+ function runStep(name, command, args) {
39
+ console.log(`\n[build] ${name}`);
40
+ console.log(`> ${command} ${args.join(' ')}`);
41
+
42
+ const result = spawnSync(command, args, {
43
+ cwd: packageRoot,
44
+ stdio: 'inherit',
45
+ shell: process.platform === 'win32',
46
+ env: process.env,
47
+ });
48
+
49
+ if (result.status !== 0) {
50
+ throw new Error(`[build] Step failed: ${name}`);
51
+ }
52
+ }
53
+
54
+ function runTool(name, tool, args) {
55
+ runStep(name, tool.command, [...tool.prefixArgs, ...args]);
56
+ }
57
+
58
+ const tsc = resolveTool('tsc', [`typescript@${packageJson.devDependencies.typescript}`]);
59
+ const pkgroll = resolveTool('pkgroll', [
60
+ `pkgroll@${packageJson.devDependencies.pkgroll}`,
61
+ `typescript@${packageJson.devDependencies.typescript}`,
62
+ ]);
63
+
64
+ rmSync(resolve(packageRoot, 'dist'), { recursive: true, force: true });
65
+ runTool('typecheck', tsc, ['--noEmit']);
66
+ runTool('bundle', pkgroll, []);
@@ -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
+ });