happy-imou-cloud 2.0.12 → 2.0.13

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 (35) hide show
  1. package/bin/happy-cloud.mjs +1 -1
  2. package/dist/ConversationHistory-V3VLmjJf.cjs +868 -0
  3. package/dist/ConversationHistory-_ciJNIgH.mjs +856 -0
  4. package/dist/{api-BxXBKBUy.mjs → api-D1meoL-9.mjs} +2 -2
  5. package/dist/{api-B4g8VLUn.cjs → api-DH5-IqeM.cjs} +2 -2
  6. package/dist/{command-CHiLfBa4.mjs → command-CMvWClny.mjs} +3 -3
  7. package/dist/{command-DVt_YmE6.cjs → command-Ch8Dgidj.cjs} +3 -3
  8. package/dist/createKeepAliveController-C5cQlDRr.mjs +51 -0
  9. package/dist/createKeepAliveController-DO8H6d5E.cjs +54 -0
  10. package/dist/{index-CWom7mSf.cjs → index-CryJfCh5.cjs} +10 -11
  11. package/dist/{index-DaAkW0VN.mjs → index-Cxrx9m5D.mjs} +9 -9
  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-8pNEvzaq.mjs → persistence-9Iu0wGNM.mjs} +1 -1
  17. package/dist/{persistence-DScOANDE.cjs → persistence-Bl3FYvwd.cjs} +1 -1
  18. package/dist/{registerKillSessionHandler-CNNguWyD.mjs → registerKillSessionHandler-BElGmD1E.mjs} +5 -541
  19. package/dist/{registerKillSessionHandler-Dr1inhTc.cjs → registerKillSessionHandler-BjkY-oUn.cjs} +4 -549
  20. package/dist/{runClaude-h-8llTrI.cjs → runClaude-CDZxAF3l.cjs} +129 -630
  21. package/dist/{runClaude-BcvOkIwh.mjs → runClaude-D7dF4RDM.mjs} +126 -627
  22. package/dist/{runCodex-CA58KUHf.cjs → runCodex-Cik8VzFs.cjs} +224 -17
  23. package/dist/{runCodex-ClJUgipy.mjs → runCodex-DnGz1XES.mjs} +213 -6
  24. package/dist/{runGemini-dAr7Gcn8.mjs → runGemini-B8tXMHeL.mjs} +5 -5
  25. package/dist/{runGemini-IFHhFMSU.cjs → runGemini-BM2BQ4I7.cjs} +13 -13
  26. package/package.json +9 -9
  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 +202 -202
  32. package/dist/BaseReasoningProcessor-BrKUKAOr.cjs +0 -323
  33. package/dist/BaseReasoningProcessor-DrHf5B98.mjs +0 -320
  34. package/dist/ProviderSelectionHandler-BCDvmifJ.cjs +0 -265
  35. package/dist/ProviderSelectionHandler-BuZarTDc.mjs +0 -261
@@ -1,213 +1,213 @@
1
- #!/usr/bin/env node
2
-
3
- import { spawnSync } from 'node:child_process';
4
- import { existsSync, mkdtempSync, readFileSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';
5
- import { tmpdir } from 'node:os';
6
- import { fileURLToPath } from 'node:url';
7
- import { dirname, join, resolve } from 'node:path';
8
-
9
- const here = dirname(fileURLToPath(import.meta.url));
10
- const packageRoot = resolve(here, '..');
11
- const workspaceRoot = resolve(packageRoot, '..', '..');
12
- const packageJson = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
13
-
14
- function resolveTool(binName, packageName) {
15
- const suffix = process.platform === 'win32' ? '.cmd' : '';
16
- const packageLocalBin = resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`);
17
- const workspaceLocalBin = resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`);
18
-
19
- if (existsSync(packageLocalBin)) {
20
- return {
21
- command: packageLocalBin,
22
- prefixArgs: [],
23
- };
24
- }
25
-
26
- if (existsSync(workspaceLocalBin)) {
27
- return {
28
- command: workspaceLocalBin,
29
- prefixArgs: [],
30
- };
31
- }
32
-
33
- const version =
34
- packageJson.devDependencies?.[packageName]
35
- ?? packageJson.dependencies?.[packageName];
36
-
37
- return {
38
- command: 'npx',
39
- prefixArgs: ['-y', '-p', `${packageName}@${version}`, binName],
40
- };
41
- }
42
-
43
- function shouldUseShell(command) {
44
- if (process.platform !== 'win32') {
45
- return false;
46
- }
47
-
48
- return !/\.exe$/i.test(command);
49
- }
50
-
51
- function runStep(name, command, args, options = {}) {
52
- console.log(`\n[release-smoke] ${name}`);
53
- console.log(`> ${command} ${args.join(' ')}`);
54
-
55
- const result = spawnSync(command, args, {
56
- cwd: packageRoot,
57
- stdio: 'inherit',
58
- shell: shouldUseShell(command),
59
- env: {
60
- ...process.env,
61
- NODE_ENV: 'development',
62
- YARN_PRODUCTION: 'false',
63
- npm_config_production: 'false',
64
- },
65
- ...options,
66
- });
67
-
68
- if (result.status !== 0) {
69
- throw new Error(`[release-smoke] Step failed: ${name}`);
70
- }
71
- }
72
-
73
- function runStepCapture(name, command, args, options = {}) {
74
- console.log(`\n[release-smoke] ${name}`);
75
- console.log(`> ${command} ${args.join(' ')}`);
76
-
77
- const result = spawnSync(command, args, {
78
- cwd: packageRoot,
79
- stdio: 'pipe',
80
- encoding: 'utf8',
81
- shell: shouldUseShell(command),
82
- env: {
83
- ...process.env,
84
- NODE_ENV: 'development',
85
- YARN_PRODUCTION: 'false',
86
- npm_config_production: 'false',
87
- },
88
- ...options,
89
- });
90
-
91
- if (result.status !== 0) {
92
- if (result.stdout) {
93
- process.stdout.write(result.stdout);
94
- }
95
- if (result.stderr) {
96
- process.stderr.write(result.stderr);
97
- }
98
- throw new Error(`[release-smoke] Step failed: ${name}`);
99
- }
100
-
101
- return result.stdout;
102
- }
103
-
104
- function runToolStep(name, tool, args, options = {}) {
105
- runStep(name, tool.command, [...tool.prefixArgs, ...args], options);
106
- }
107
-
108
- function verifyPackedInstall() {
109
- const tempRoot = mkdtempSync(join(tmpdir(), 'happy-cli-release-smoke-'));
110
- let tarballPath = null;
111
-
112
- try {
113
- const packOutput = runStepCapture('pack tarball', 'npm', ['pack', '--json', '--ignore-scripts']);
114
- const packResult = JSON.parse(packOutput);
115
- const tarballFile = Array.isArray(packResult) ? packResult[0]?.filename : null;
116
-
117
- if (typeof tarballFile !== 'string' || tarballFile.length === 0) {
118
- throw new Error('[release-smoke] npm pack did not return a tarball filename');
119
- }
120
-
121
- tarballPath = resolve(packageRoot, tarballFile);
122
-
123
- writeFileSync(
124
- join(tempRoot, 'package.json'),
125
- JSON.stringify({ private: true, name: 'happy-cli-release-smoke' }, null, 2)
126
- );
127
-
128
- runStep('install packed tarball', 'npm', [
129
- 'install',
130
- '--ignore-scripts',
131
- '--no-audit',
132
- '--fund=false',
133
- tarballPath,
134
- ], {
135
- cwd: tempRoot,
136
- });
137
-
138
- runStep('run packed cli help', 'node', [
139
- join(tempRoot, 'node_modules', 'happy-imou-cloud', 'bin', 'happy-cloud.mjs'),
140
- '--help',
141
- ], {
142
- cwd: tempRoot,
143
- });
144
- } finally {
145
- if (tarballPath) {
146
- try {
147
- unlinkSync(tarballPath);
148
- } catch {}
149
- }
150
-
151
- try {
152
- rmSync(tempRoot, { recursive: true, force: true });
153
- } catch {}
154
- }
155
- }
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from 'node:child_process';
4
+ import { existsSync, mkdtempSync, readFileSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';
5
+ import { tmpdir } from 'node:os';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { dirname, join, resolve } from 'node:path';
8
+
9
+ const here = dirname(fileURLToPath(import.meta.url));
10
+ const packageRoot = resolve(here, '..');
11
+ const workspaceRoot = resolve(packageRoot, '..', '..');
12
+ const packageJson = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
13
+
14
+ function resolveTool(binName, packageName) {
15
+ const suffix = process.platform === 'win32' ? '.cmd' : '';
16
+ const packageLocalBin = resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`);
17
+ const workspaceLocalBin = resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`);
18
+
19
+ if (existsSync(packageLocalBin)) {
20
+ return {
21
+ command: packageLocalBin,
22
+ prefixArgs: [],
23
+ };
24
+ }
25
+
26
+ if (existsSync(workspaceLocalBin)) {
27
+ return {
28
+ command: workspaceLocalBin,
29
+ prefixArgs: [],
30
+ };
31
+ }
32
+
33
+ const version =
34
+ packageJson.devDependencies?.[packageName]
35
+ ?? packageJson.dependencies?.[packageName];
36
+
37
+ return {
38
+ command: 'npx',
39
+ prefixArgs: ['-y', '-p', `${packageName}@${version}`, binName],
40
+ };
41
+ }
42
+
43
+ function shouldUseShell(command) {
44
+ if (process.platform !== 'win32') {
45
+ return false;
46
+ }
47
+
48
+ return !/\.exe$/i.test(command);
49
+ }
50
+
51
+ function runStep(name, command, args, options = {}) {
52
+ console.log(`\n[release-smoke] ${name}`);
53
+ console.log(`> ${command} ${args.join(' ')}`);
54
+
55
+ const result = spawnSync(command, args, {
56
+ cwd: packageRoot,
57
+ stdio: 'inherit',
58
+ shell: shouldUseShell(command),
59
+ env: {
60
+ ...process.env,
61
+ NODE_ENV: 'development',
62
+ YARN_PRODUCTION: 'false',
63
+ npm_config_production: 'false',
64
+ },
65
+ ...options,
66
+ });
67
+
68
+ if (result.status !== 0) {
69
+ throw new Error(`[release-smoke] Step failed: ${name}`);
70
+ }
71
+ }
72
+
73
+ function runStepCapture(name, command, args, options = {}) {
74
+ console.log(`\n[release-smoke] ${name}`);
75
+ console.log(`> ${command} ${args.join(' ')}`);
76
+
77
+ const result = spawnSync(command, args, {
78
+ cwd: packageRoot,
79
+ stdio: 'pipe',
80
+ encoding: 'utf8',
81
+ shell: shouldUseShell(command),
82
+ env: {
83
+ ...process.env,
84
+ NODE_ENV: 'development',
85
+ YARN_PRODUCTION: 'false',
86
+ npm_config_production: 'false',
87
+ },
88
+ ...options,
89
+ });
90
+
91
+ if (result.status !== 0) {
92
+ if (result.stdout) {
93
+ process.stdout.write(result.stdout);
94
+ }
95
+ if (result.stderr) {
96
+ process.stderr.write(result.stderr);
97
+ }
98
+ throw new Error(`[release-smoke] Step failed: ${name}`);
99
+ }
100
+
101
+ return result.stdout;
102
+ }
103
+
104
+ function runToolStep(name, tool, args, options = {}) {
105
+ runStep(name, tool.command, [...tool.prefixArgs, ...args], options);
106
+ }
107
+
108
+ function verifyPackedInstall() {
109
+ const tempRoot = mkdtempSync(join(tmpdir(), 'happy-cli-release-smoke-'));
110
+ let tarballPath = null;
111
+
112
+ try {
113
+ const packOutput = runStepCapture('pack tarball', 'npm', ['pack', '--json', '--ignore-scripts']);
114
+ const packResult = JSON.parse(packOutput);
115
+ const tarballFile = Array.isArray(packResult) ? packResult[0]?.filename : null;
116
+
117
+ if (typeof tarballFile !== 'string' || tarballFile.length === 0) {
118
+ throw new Error('[release-smoke] npm pack did not return a tarball filename');
119
+ }
120
+
121
+ tarballPath = resolve(packageRoot, tarballFile);
122
+
123
+ writeFileSync(
124
+ join(tempRoot, 'package.json'),
125
+ JSON.stringify({ private: true, name: 'happy-cli-release-smoke' }, null, 2)
126
+ );
127
+
128
+ runStep('install packed tarball', 'npm', [
129
+ 'install',
130
+ '--ignore-scripts',
131
+ '--no-audit',
132
+ '--fund=false',
133
+ tarballPath,
134
+ ], {
135
+ cwd: tempRoot,
136
+ });
137
+
138
+ runStep('run packed cli help', 'node', [
139
+ join(tempRoot, 'node_modules', 'happy-imou-cloud', 'bin', 'happy-cloud.mjs'),
140
+ '--help',
141
+ ], {
142
+ cwd: tempRoot,
143
+ });
144
+ } finally {
145
+ if (tarballPath) {
146
+ try {
147
+ unlinkSync(tarballPath);
148
+ } catch {}
149
+ }
150
+
151
+ try {
152
+ rmSync(tempRoot, { recursive: true, force: true });
153
+ } catch {}
154
+ }
155
+ }
156
156
 
157
157
  function shouldRunProviderSmoke(provider) {
158
158
  return process.env[`HAPPY_SMOKE_${provider.toUpperCase()}`] === '1';
159
159
  }
160
160
 
161
- function main() {
162
- const tsc = resolveTool('tsc', 'typescript');
163
- const vitest = resolveTool('vitest', 'vitest');
164
-
165
- runToolStep('typecheck', tsc, ['--noEmit']);
166
- runToolStep('unit runtime suite', vitest, [
167
- 'run',
168
- '--testTimeout',
169
- '20000',
170
- 'src/agent/acp/AcpBackend.test.ts',
171
- 'src/agent/acp/AcpBackend.startup.test.ts',
172
- 'src/agent/acp/AcpBackend.waitForResponseComplete.test.ts',
173
- 'src/agent/acp/AcpBackend.initDelay.test.ts',
174
- 'src/agent/acp/acpSpawn.test.ts',
175
- 'src/agent/acp/createAcpFilteredStdoutReadable.multiline.test.ts',
176
- 'src/agent/acp/killProcessTree.test.ts',
177
- 'src/runtime/executeProvider.test.ts',
178
- 'src/runtime/ensureManagedProviderMachine.test.ts',
179
- 'src/runtime/bootstrapManagedProviderSession.test.ts',
180
- 'src/runtime/command.test.ts',
181
- 'src/runtime/launch.test.ts',
182
- 'src/runtime/launchWithFactoryResult.test.ts',
183
- 'src/runtime/providerMessageBridge.test.ts',
184
- 'src/runtime/runModeLoop.test.ts',
185
- 'src/runtime/createKeepAliveController.test.ts',
186
- 'src/runtime/sessionControl.test.ts',
187
- 'src/runtime/closeProviderSession.test.ts',
188
- 'src/runtime/waitForResponseCompleteWithAbort.test.ts',
189
- 'src/utils/ConversationHistory.test.ts',
190
- 'src/runtime/RuntimeShell.test.ts',
191
- 'src/runtime/createDefaultRuntimeShell.test.ts',
192
- 'src/claude/loop.test.ts',
193
- 'src/claude/claudeAcpRemoteLauncher.test.ts',
194
- 'src/claude/utils/acpPermissionHandler.test.ts',
195
- 'src/codex/__tests__/runCodex.lifecycle.test.ts',
196
- 'src/codex/__tests__/selectionHandler.test.ts',
197
- 'src/security/signedTransport.test.ts',
161
+ function main() {
162
+ const tsc = resolveTool('tsc', 'typescript');
163
+ const vitest = resolveTool('vitest', 'vitest');
164
+
165
+ runToolStep('typecheck', tsc, ['--noEmit']);
166
+ runToolStep('unit runtime suite', vitest, [
167
+ 'run',
168
+ '--testTimeout',
169
+ '20000',
170
+ 'src/agent/acp/AcpBackend.test.ts',
171
+ 'src/agent/acp/AcpBackend.startup.test.ts',
172
+ 'src/agent/acp/AcpBackend.waitForResponseComplete.test.ts',
173
+ 'src/agent/acp/AcpBackend.initDelay.test.ts',
174
+ 'src/agent/acp/acpSpawn.test.ts',
175
+ 'src/agent/acp/createAcpFilteredStdoutReadable.multiline.test.ts',
176
+ 'src/agent/acp/killProcessTree.test.ts',
177
+ 'src/runtime/executeProvider.test.ts',
178
+ 'src/runtime/ensureManagedProviderMachine.test.ts',
179
+ 'src/runtime/bootstrapManagedProviderSession.test.ts',
180
+ 'src/runtime/command.test.ts',
181
+ 'src/runtime/launch.test.ts',
182
+ 'src/runtime/launchWithFactoryResult.test.ts',
183
+ 'src/runtime/providerMessageBridge.test.ts',
184
+ 'src/runtime/runModeLoop.test.ts',
185
+ 'src/runtime/createKeepAliveController.test.ts',
186
+ 'src/runtime/sessionControl.test.ts',
187
+ 'src/runtime/closeProviderSession.test.ts',
188
+ 'src/runtime/waitForResponseCompleteWithAbort.test.ts',
189
+ 'src/utils/ConversationHistory.test.ts',
190
+ 'src/runtime/RuntimeShell.test.ts',
191
+ 'src/runtime/createDefaultRuntimeShell.test.ts',
192
+ 'src/claude/loop.test.ts',
193
+ 'src/claude/claudeAcpRemoteLauncher.test.ts',
194
+ 'src/claude/utils/acpPermissionHandler.test.ts',
195
+ 'src/codex/__tests__/runCodex.lifecycle.test.ts',
196
+ 'src/codex/__tests__/selectionHandler.test.ts',
197
+ 'src/security/signedTransport.test.ts',
198
198
  'src/agent/initializeAgents.test.ts',
199
199
  'src/agent/factories/factories.test.ts',
200
200
  'src/packageContract.test.ts',
201
- ]);
202
- runStep('build', 'yarn', ['build']);
203
- runStep('runtime providers', 'node', ['./bin/happy-cloud.mjs', 'runtime', 'providers']);
204
- runStep('help', 'node', ['./bin/happy-cloud.mjs', '--help']);
205
- verifyPackedInstall();
206
-
207
- if (shouldRunProviderSmoke('cursor')) {
208
- runStep('cursor smoke', 'node', ['./bin/happy-cloud.mjs', 'cursor', 'release smoke']);
209
- }
210
- }
201
+ ]);
202
+ runStep('build', 'yarn', ['build']);
203
+ runStep('runtime providers', 'node', ['./bin/happy-cloud.mjs', 'runtime', 'providers']);
204
+ runStep('help', 'node', ['./bin/happy-cloud.mjs', '--help']);
205
+ verifyPackedInstall();
206
+
207
+ if (shouldRunProviderSmoke('cursor')) {
208
+ runStep('cursor smoke', 'node', ['./bin/happy-cloud.mjs', 'cursor', 'release smoke']);
209
+ }
210
+ }
211
211
 
212
212
  try {
213
213
  main();