happy-imou-cloud 2.1.7 → 2.1.8
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.
- package/bin/happy-cloud.mjs +1 -1
- package/dist/{BaseReasoningProcessor-iSuaFeZH.cjs → BaseReasoningProcessor-CbqNgi4p.cjs} +2 -2
- package/dist/{BaseReasoningProcessor-C0A6Jr8V.mjs → BaseReasoningProcessor-DJ9zxAdt.mjs} +2 -2
- package/dist/{ProviderSelectionHandler-DI9QK1iY.cjs → ProviderSelectionHandler-BZVtGMAn.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-WT-tvePy.mjs → ProviderSelectionHandler-BleheBks.mjs} +2 -2
- package/dist/{api-CdGT5hsH.cjs → api-CeIpGPqs.cjs} +86 -32
- package/dist/{api-BYKV7vX6.mjs → api-DRdn4-dL.mjs} +86 -32
- package/dist/{command-uyA8cYmL.cjs → command-CTad-7bA.cjs} +3 -3
- package/dist/{command-C1cKqmsa.mjs → command-mDMWVdh5.mjs} +3 -3
- package/dist/{index-BAhlFq45.mjs → index-C4S85XB7.mjs} +144 -29
- package/dist/{index-D_S_7bqK.cjs → index-D68EOBHW.cjs} +147 -32
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +7 -4
- package/dist/lib.d.mts +7 -4
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-CMvrZ4SA.cjs → persistence-Czyd-Uei.cjs} +1 -1
- package/dist/{persistence-B8Wgn6aN.mjs → persistence-DgpGouOO.mjs} +1 -1
- package/dist/{registerKillSessionHandler-DjxtkGMv.cjs → registerKillSessionHandler-DECzSYvQ.cjs} +3 -3
- package/dist/{registerKillSessionHandler-5DVlZaJx.mjs → registerKillSessionHandler-Dg0DFPae.mjs} +3 -3
- package/dist/{runClaude-DNZFsQY0.cjs → runClaude-DtCH-nx-.cjs} +9 -5
- package/dist/{runClaude-WB884iOO.mjs → runClaude-OWT6ZYiP.mjs} +9 -5
- package/dist/{runCodex-MJar-238.mjs → runCodex-BU3BA1l8.mjs} +96 -21
- package/dist/{runCodex-WZ91ZLK7.cjs → runCodex-reARLjN0.cjs} +96 -21
- package/dist/{runGemini-B_wCHgPU.cjs → runGemini-BvJUvOvj.cjs} +11 -5
- package/dist/{runGemini-BPGpwljp.mjs → runGemini-DeLxSapY.mjs} +11 -5
- package/package.json +1 -1
- package/scripts/devtools/README.md +9 -9
- package/scripts/e2e/fake-codex-acp-agent.mjs +139 -139
- package/scripts/e2e/local-server-session-roundtrip.mjs +1063 -1063
- package/scripts/ensureAcpSdkCompat.mjs +1 -1
|
@@ -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
|
+
});
|