happy-imou-cloud 2.1.0 → 2.1.2

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 (45) hide show
  1. package/bin/happy-cloud.mjs +4 -0
  2. package/compat/acp-sdk-schema/index.js +28 -0
  3. package/compat/acp-sdk-schema/types.gen.js +3 -0
  4. package/compat/acp-sdk-schema/zod.gen.js +1554 -0
  5. package/compat/ink-build/components/Cursor.d.ts +83 -0
  6. package/compat/ink-build/components/Cursor.js +53 -0
  7. package/compat/ink-build/components/CursorContext.d.ts +11 -0
  8. package/compat/ink-build/components/CursorContext.js +8 -0
  9. package/compat/ink-build/components/ErrorBoundary.d.ts +18 -0
  10. package/compat/ink-build/components/ErrorBoundary.js +23 -0
  11. package/compat/ink-build/hooks/use-cursor.d.ts +12 -0
  12. package/compat/ink-build/hooks/use-cursor.js +29 -0
  13. package/dist/{BaseReasoningProcessor-DQkzwRuf.mjs → BaseReasoningProcessor-BaOWkVcu.mjs} +3 -3
  14. package/dist/{BaseReasoningProcessor-C9mH8EVn.cjs → BaseReasoningProcessor-CzvqwxuY.cjs} +3 -3
  15. package/dist/{ProviderSelectionHandler-BlrrLPlo.mjs → ProviderSelectionHandler-Q8pl7e-d.mjs} +2 -2
  16. package/dist/{ProviderSelectionHandler-5Dedbm8j.cjs → ProviderSelectionHandler-wwbfeK_s.cjs} +2 -2
  17. package/dist/{api-w_CUxb9Q.mjs → api-Cxifhw5r.mjs} +4 -3
  18. package/dist/{api-Bd-MnOS4.cjs → api-DZimmN4C.cjs} +4 -3
  19. package/dist/{command-mTWwCqTY.mjs → command-B6LM3Nml.mjs} +3 -3
  20. package/dist/{command-DoDmHNxR.cjs → command-RcCJI1jl.cjs} +3 -3
  21. package/dist/{index-BQmJ4NAa.cjs → index-Cuvs0lFS.cjs} +11 -11
  22. package/dist/{index-GuXV-pxB.mjs → index-Des7I5WX.mjs} +8 -8
  23. package/dist/index.cjs +3 -3
  24. package/dist/index.mjs +3 -3
  25. package/dist/lib.cjs +1 -1
  26. package/dist/lib.d.cts +82 -81
  27. package/dist/lib.d.mts +82 -81
  28. package/dist/lib.mjs +1 -1
  29. package/dist/{persistence-MSy70is3.mjs → persistence-6d4U4Sh8.mjs} +1 -1
  30. package/dist/{persistence-BL06LLVz.cjs → persistence-C8-MtdQK.cjs} +1 -1
  31. package/dist/{registerKillSessionHandler-CjWfUfc3.mjs → registerKillSessionHandler-BFBkz_XT.mjs} +3 -3
  32. package/dist/{registerKillSessionHandler-D9kwxy6B.cjs → registerKillSessionHandler-BapPCRmp.cjs} +3 -3
  33. package/dist/{runClaude-DpZ95Twb.mjs → runClaude-CPV5Uap2.mjs} +34 -5
  34. package/dist/{runClaude-D2ZEXue8.cjs → runClaude-DVnqKa1q.cjs} +34 -5
  35. package/dist/{runCodex-Dz_1ho8d.cjs → runCodex-Bzsp8gFO.cjs} +26 -18
  36. package/dist/{runCodex-CJwaep2R.mjs → runCodex-CwtLSTMJ.mjs} +26 -18
  37. package/dist/{runGemini-Dfu6LltX.cjs → runGemini-6Dwyk_Km.cjs} +83 -17
  38. package/dist/{runGemini-BehqjM73.mjs → runGemini-Bmoxehlh.mjs} +83 -17
  39. package/package.json +3 -2
  40. package/scripts/build.mjs +2 -0
  41. package/scripts/devtools/README.md +9 -9
  42. package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
  43. package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
  44. package/scripts/ensureAcpSdkCompat.mjs +171 -0
  45. package/scripts/release-smoke.mjs +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happy-imou-cloud",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "hicloud - Imou 企业定制版。关键是 happy!移动端远程 AI 编程工具,支持 Claude Code、Codex 和 Gemini CLI",
5
5
  "author": "long.zhu",
6
6
  "license": "MIT",
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "files": [
37
37
  "dist",
38
+ "compat",
38
39
  "bin",
39
40
  "scripts",
40
41
  "package.json"
@@ -84,7 +85,7 @@
84
85
  "unlink:dev": "node scripts/link-dev.cjs unlink"
85
86
  },
86
87
  "dependencies": {
87
- "@agentclientprotocol/sdk": "^0.14.1",
88
+ "@agentclientprotocol/sdk": "0.14.1",
88
89
  "@stablelib/base64": "^2.0.1",
89
90
  "@stablelib/hex": "^2.0.1",
90
91
  "@types/cross-spawn": "^6.0.6",
package/scripts/build.mjs CHANGED
@@ -4,6 +4,7 @@ import { spawnSync } from 'node:child_process';
4
4
  import { existsSync, readFileSync, rmSync } from 'node:fs';
5
5
  import { dirname, resolve } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
+ import { ensureAcpSdkCompat } from './ensureAcpSdkCompat.mjs';
7
8
 
8
9
  const here = dirname(fileURLToPath(import.meta.url));
9
10
  const packageRoot = resolve(here, '..');
@@ -61,6 +62,7 @@ const pkgroll = resolveTool('pkgroll', [
61
62
  `typescript@${packageJson.devDependencies.typescript}`,
62
63
  ]);
63
64
 
65
+ ensureAcpSdkCompat();
64
66
  rmSync(resolve(packageRoot, 'dist'), { recursive: true, force: true });
65
67
  runTool('typecheck', tsc, ['--noEmit']);
66
68
  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
+ });