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.
- package/bin/happy-cloud.mjs +4 -0
- package/compat/acp-sdk-schema/index.js +28 -0
- package/compat/acp-sdk-schema/types.gen.js +3 -0
- package/compat/acp-sdk-schema/zod.gen.js +1554 -0
- package/compat/ink-build/components/Cursor.d.ts +83 -0
- package/compat/ink-build/components/Cursor.js +53 -0
- package/compat/ink-build/components/CursorContext.d.ts +11 -0
- package/compat/ink-build/components/CursorContext.js +8 -0
- package/compat/ink-build/components/ErrorBoundary.d.ts +18 -0
- package/compat/ink-build/components/ErrorBoundary.js +23 -0
- package/compat/ink-build/hooks/use-cursor.d.ts +12 -0
- package/compat/ink-build/hooks/use-cursor.js +29 -0
- package/dist/{BaseReasoningProcessor-DQkzwRuf.mjs → BaseReasoningProcessor-BaOWkVcu.mjs} +3 -3
- package/dist/{BaseReasoningProcessor-C9mH8EVn.cjs → BaseReasoningProcessor-CzvqwxuY.cjs} +3 -3
- package/dist/{ProviderSelectionHandler-BlrrLPlo.mjs → ProviderSelectionHandler-Q8pl7e-d.mjs} +2 -2
- package/dist/{ProviderSelectionHandler-5Dedbm8j.cjs → ProviderSelectionHandler-wwbfeK_s.cjs} +2 -2
- package/dist/{api-w_CUxb9Q.mjs → api-Cxifhw5r.mjs} +4 -3
- package/dist/{api-Bd-MnOS4.cjs → api-DZimmN4C.cjs} +4 -3
- package/dist/{command-mTWwCqTY.mjs → command-B6LM3Nml.mjs} +3 -3
- package/dist/{command-DoDmHNxR.cjs → command-RcCJI1jl.cjs} +3 -3
- package/dist/{index-BQmJ4NAa.cjs → index-Cuvs0lFS.cjs} +11 -11
- package/dist/{index-GuXV-pxB.mjs → index-Des7I5WX.mjs} +8 -8
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +82 -81
- package/dist/lib.d.mts +82 -81
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-MSy70is3.mjs → persistence-6d4U4Sh8.mjs} +1 -1
- package/dist/{persistence-BL06LLVz.cjs → persistence-C8-MtdQK.cjs} +1 -1
- package/dist/{registerKillSessionHandler-CjWfUfc3.mjs → registerKillSessionHandler-BFBkz_XT.mjs} +3 -3
- package/dist/{registerKillSessionHandler-D9kwxy6B.cjs → registerKillSessionHandler-BapPCRmp.cjs} +3 -3
- package/dist/{runClaude-DpZ95Twb.mjs → runClaude-CPV5Uap2.mjs} +34 -5
- package/dist/{runClaude-D2ZEXue8.cjs → runClaude-DVnqKa1q.cjs} +34 -5
- package/dist/{runCodex-Dz_1ho8d.cjs → runCodex-Bzsp8gFO.cjs} +26 -18
- package/dist/{runCodex-CJwaep2R.mjs → runCodex-CwtLSTMJ.mjs} +26 -18
- package/dist/{runGemini-Dfu6LltX.cjs → runGemini-6Dwyk_Km.cjs} +83 -17
- package/dist/{runGemini-BehqjM73.mjs → runGemini-Bmoxehlh.mjs} +83 -17
- package/package.json +3 -2
- package/scripts/build.mjs +2 -0
- 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 +171 -0
- package/scripts/release-smoke.mjs +14 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
2
|
+
import { dirname, resolve, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const defaultPackageRoot = resolve(here, '..');
|
|
7
|
+
const defaultWorkspaceRoot = resolve(defaultPackageRoot, '..', '..');
|
|
8
|
+
|
|
9
|
+
function getRepairTargets(packageRoot, workspaceRoot) {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
name: '@agentclientprotocol/sdk schema',
|
|
13
|
+
targetPackageDir: join(packageRoot, 'node_modules', '@agentclientprotocol', 'sdk'),
|
|
14
|
+
targetBaseDir: 'dist/schema',
|
|
15
|
+
sentinelFile: 'dist/acp.js',
|
|
16
|
+
requiredRuntimeFiles: [
|
|
17
|
+
'index.js',
|
|
18
|
+
'types.gen.js',
|
|
19
|
+
'zod.gen.js',
|
|
20
|
+
],
|
|
21
|
+
optionalTypeFiles: [
|
|
22
|
+
'index.d.ts',
|
|
23
|
+
'types.gen.d.ts',
|
|
24
|
+
'zod.gen.d.ts',
|
|
25
|
+
],
|
|
26
|
+
sourceBaseDirs: [
|
|
27
|
+
join(workspaceRoot, 'node_modules', '@agentclientprotocol', 'sdk', 'dist', 'schema'),
|
|
28
|
+
join(packageRoot, 'compat', 'acp-sdk-schema'),
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'ink cursor hooks',
|
|
33
|
+
targetPackageDir: join(packageRoot, 'node_modules', 'ink'),
|
|
34
|
+
targetBaseDir: 'build',
|
|
35
|
+
sentinelFile: 'build/index.js',
|
|
36
|
+
requiredRuntimeFiles: [
|
|
37
|
+
'components/Cursor.js',
|
|
38
|
+
'components/CursorContext.js',
|
|
39
|
+
'components/ErrorBoundary.js',
|
|
40
|
+
'hooks/use-cursor.js',
|
|
41
|
+
],
|
|
42
|
+
optionalTypeFiles: [
|
|
43
|
+
'components/Cursor.d.ts',
|
|
44
|
+
'components/CursorContext.d.ts',
|
|
45
|
+
'components/ErrorBoundary.d.ts',
|
|
46
|
+
'hooks/use-cursor.d.ts',
|
|
47
|
+
],
|
|
48
|
+
sourceBaseDirs: [
|
|
49
|
+
join(workspaceRoot, 'node_modules', 'ink', 'build'),
|
|
50
|
+
join(packageRoot, 'compat', 'ink-build'),
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function isDirectExecution() {
|
|
57
|
+
return process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function hasAllFiles(directory, files) {
|
|
61
|
+
return files.every((file) => existsSync(join(directory, file)));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function copyMissingFiles(sourceDir, targetDir, files) {
|
|
65
|
+
let copied = 0;
|
|
66
|
+
|
|
67
|
+
for (const file of files) {
|
|
68
|
+
const sourceFile = join(sourceDir, file);
|
|
69
|
+
const targetFile = join(targetDir, file);
|
|
70
|
+
|
|
71
|
+
if (!existsSync(sourceFile) || existsSync(targetFile)) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
mkdirSync(dirname(targetFile), { recursive: true });
|
|
76
|
+
copyFileSync(sourceFile, targetFile);
|
|
77
|
+
copied += 1;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return copied;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function ensureAcpSdkCompat(options = {}) {
|
|
84
|
+
const packageRoot = resolve(options.packageRoot ?? defaultPackageRoot);
|
|
85
|
+
const workspaceRoot = resolve(options.workspaceRoot ?? defaultWorkspaceRoot);
|
|
86
|
+
const targetOverrides = Array.isArray(options.targets) ? options.targets : null;
|
|
87
|
+
const repairTargets = targetOverrides ?? getRepairTargets(packageRoot, workspaceRoot);
|
|
88
|
+
const results = [];
|
|
89
|
+
|
|
90
|
+
for (const target of repairTargets) {
|
|
91
|
+
const targetPackageDir = resolve(target.targetPackageDir);
|
|
92
|
+
const targetBaseDir = join(targetPackageDir, target.targetBaseDir);
|
|
93
|
+
const sentinelFile = join(targetPackageDir, target.sentinelFile);
|
|
94
|
+
|
|
95
|
+
if (!existsSync(sentinelFile)) {
|
|
96
|
+
results.push({
|
|
97
|
+
name: target.name,
|
|
98
|
+
checked: false,
|
|
99
|
+
repaired: false,
|
|
100
|
+
reason: 'target-package-missing',
|
|
101
|
+
targetBaseDir,
|
|
102
|
+
});
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (hasAllFiles(targetBaseDir, target.requiredRuntimeFiles)) {
|
|
107
|
+
results.push({
|
|
108
|
+
name: target.name,
|
|
109
|
+
checked: true,
|
|
110
|
+
repaired: false,
|
|
111
|
+
reason: 'already-valid',
|
|
112
|
+
targetBaseDir,
|
|
113
|
+
});
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const sourceBaseDir = target.sourceBaseDirs.find((candidate) => hasAllFiles(candidate, target.requiredRuntimeFiles));
|
|
118
|
+
if (!sourceBaseDir) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
`[runtime-compat] Missing ${target.requiredRuntimeFiles.join(', ')} under ${targetBaseDir}, and no repair source is available for ${target.name}.`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
mkdirSync(targetBaseDir, { recursive: true });
|
|
125
|
+
|
|
126
|
+
const copiedRuntimeFiles = copyMissingFiles(sourceBaseDir, targetBaseDir, target.requiredRuntimeFiles);
|
|
127
|
+
const typeSourceBaseDir = target.sourceBaseDirs.find((candidate) => hasAllFiles(candidate, target.optionalTypeFiles));
|
|
128
|
+
const copiedTypeFiles = typeSourceBaseDir
|
|
129
|
+
? copyMissingFiles(typeSourceBaseDir, targetBaseDir, target.optionalTypeFiles)
|
|
130
|
+
: 0;
|
|
131
|
+
|
|
132
|
+
if (!hasAllFiles(targetBaseDir, target.requiredRuntimeFiles)) {
|
|
133
|
+
throw new Error(
|
|
134
|
+
`[runtime-compat] Repair source ${sourceBaseDir} did not restore ${target.requiredRuntimeFiles.join(', ')} into ${targetBaseDir}.`,
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
results.push({
|
|
139
|
+
name: target.name,
|
|
140
|
+
checked: true,
|
|
141
|
+
repaired: copiedRuntimeFiles > 0 || copiedTypeFiles > 0,
|
|
142
|
+
reason: 'repaired',
|
|
143
|
+
copiedRuntimeFiles,
|
|
144
|
+
copiedTypeFiles,
|
|
145
|
+
sourceBaseDir,
|
|
146
|
+
targetBaseDir,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const repairedTargets = results.filter((result) => result.repaired);
|
|
151
|
+
const checkedTargets = results.filter((result) => result.checked);
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
checked: checkedTargets.length > 0,
|
|
155
|
+
repaired: repairedTargets.length > 0,
|
|
156
|
+
reason: repairedTargets.length > 0 ? 'repaired' : 'already-valid',
|
|
157
|
+
results,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (isDirectExecution()) {
|
|
162
|
+
const result = ensureAcpSdkCompat();
|
|
163
|
+
|
|
164
|
+
if (result.repaired) {
|
|
165
|
+
for (const target of result.results.filter((entry) => entry.repaired)) {
|
|
166
|
+
console.log(`[runtime-compat] Restored ${target.name} from ${target.sourceBaseDir} -> ${target.targetBaseDir}`);
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
console.log(`[runtime-compat] ${result.reason}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -5,6 +5,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, unlinkSync, w
|
|
|
5
5
|
import { tmpdir } from 'node:os';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { dirname, join, resolve } from 'node:path';
|
|
8
|
+
import { ensureAcpSdkCompat } from './ensureAcpSdkCompat.mjs';
|
|
8
9
|
|
|
9
10
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
10
11
|
const packageRoot = resolve(here, '..');
|
|
@@ -149,6 +150,18 @@ function verifyPackedInstall() {
|
|
|
149
150
|
], {
|
|
150
151
|
cwd: tempRoot,
|
|
151
152
|
});
|
|
153
|
+
|
|
154
|
+
runStep('run packed cli auth status', 'node', [
|
|
155
|
+
join(tempRoot, 'node_modules', 'happy-imou-cloud', 'bin', 'happy-cloud.mjs'),
|
|
156
|
+
'auth',
|
|
157
|
+
'status',
|
|
158
|
+
], {
|
|
159
|
+
cwd: tempRoot,
|
|
160
|
+
env: {
|
|
161
|
+
...process.env,
|
|
162
|
+
HAPPY_CLOUD_HOME_DIR: join(tempRoot, '.happy-cloud'),
|
|
163
|
+
},
|
|
164
|
+
});
|
|
152
165
|
} finally {
|
|
153
166
|
if (tarballPath) {
|
|
154
167
|
try {
|
|
@@ -174,6 +187,7 @@ function main() {
|
|
|
174
187
|
const tsc = resolveTool('tsc', 'typescript');
|
|
175
188
|
const vitest = resolveTool('vitest', 'vitest');
|
|
176
189
|
|
|
190
|
+
ensureAcpSdkCompat();
|
|
177
191
|
runToolStep('typecheck', tsc, ['--noEmit']);
|
|
178
192
|
runToolStep('unit runtime suite', vitest, [
|
|
179
193
|
'run',
|