happy-imou-cloud 2.0.21 → 2.0.22

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 (34) hide show
  1. package/bin/happy-cloud.mjs +1 -1
  2. package/dist/{BaseReasoningProcessor-0nj-PMFc.cjs → BaseReasoningProcessor-CJVv1aNR.cjs} +3 -3
  3. package/dist/{BaseReasoningProcessor-DnVC7liC.mjs → BaseReasoningProcessor-mIqqngd3.mjs} +3 -3
  4. package/dist/ProviderSelectionHandler-BjLyIfSR.mjs +673 -0
  5. package/dist/ProviderSelectionHandler-e4zL4Y5_.cjs +680 -0
  6. package/dist/{api-MGlKcEf3.cjs → api-DP-RQUao.cjs} +13 -3
  7. package/dist/{api-DJe9WP9M.mjs → api-DrijKeDb.mjs} +13 -4
  8. package/dist/{command-CfyFnMv2.mjs → command--vV6BSsL.mjs} +3 -3
  9. package/dist/{command-DAlFmWmr.cjs → command-BZphfJrt.cjs} +3 -3
  10. package/dist/{index-CHXCgpwi.mjs → index-BIki80pQ.mjs} +8 -8
  11. package/dist/{index-CgVjDJpt.cjs → index-CqCEZDFi.cjs} +11 -11
  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.d.cts +13 -13
  16. package/dist/lib.d.mts +13 -13
  17. package/dist/lib.mjs +1 -1
  18. package/dist/{persistence-CkP90vEt.mjs → persistence-C3NBdZdz.mjs} +1 -1
  19. package/dist/{persistence-DLFUNI9q.cjs → persistence-yVTbf_Ng.cjs} +1 -1
  20. package/dist/{registerKillSessionHandler-DsHTZDsU.mjs → registerKillSessionHandler-CHEj7UjN.mjs} +4 -354
  21. package/dist/{registerKillSessionHandler-Cs_INk4A.cjs → registerKillSessionHandler-QmBN446A.cjs} +3 -356
  22. package/dist/{runClaude-BGSgcyUp.cjs → runClaude-BuI6OOEv.cjs} +8 -8
  23. package/dist/{runClaude-DAQAEmHe.mjs → runClaude-D0DD_Ya5.mjs} +5 -5
  24. package/dist/{runCodex-earICaxw.cjs → runCodex-1jTTmCvq.cjs} +9 -9
  25. package/dist/{runCodex-B2UpSn82.mjs → runCodex-BzZ0jODI.mjs} +6 -6
  26. package/dist/{runGemini-D5RAIaR0.cjs → runGemini-1gJRE8oT.cjs} +9 -73
  27. package/dist/{runGemini-BBUmH1Qh.mjs → runGemini-Bx2SYAyG.mjs} +9 -73
  28. package/package.json +1 -1
  29. package/scripts/build.mjs +66 -66
  30. package/scripts/devtools/README.md +9 -9
  31. package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
  32. package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
  33. package/dist/ProviderSelectionHandler-Bafuy28L.cjs +0 -265
  34. package/dist/ProviderSelectionHandler-R-2r7ItM.mjs +0 -261
@@ -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
+ });