happy-imou-cloud 2.1.21 → 2.1.23

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 (26) hide show
  1. package/dist/{BaseReasoningProcessor-DdPnQSmQ.mjs → BaseReasoningProcessor-By0QiYEu.mjs} +2 -2
  2. package/dist/{BaseReasoningProcessor-DxFwO2z9.cjs → BaseReasoningProcessor-_EHQVXKN.cjs} +2 -2
  3. package/dist/{ProviderSelectionHandler-B5Aq5gA_.cjs → ProviderSelectionHandler-BSzm8oJH.cjs} +2 -2
  4. package/dist/{ProviderSelectionHandler-DQITIqZK.mjs → ProviderSelectionHandler-XwkBLKvY.mjs} +2 -2
  5. package/dist/{api-DB30ctmX.mjs → api-CDC4ZRT7.mjs} +73 -16
  6. package/dist/{api-8xtJZeXZ.cjs → api-CusZs0lm.cjs} +75 -15
  7. package/dist/{command-C6injNJE.mjs → command-B7O2Hn-D.mjs} +2 -2
  8. package/dist/{command-79M8Bz4I.cjs → command-Cp_bgCOD.cjs} +2 -2
  9. package/dist/{index-krVv4CWK.mjs → index-CFLvb1x1.mjs} +372 -55
  10. package/dist/{index-D4A092LJ.cjs → index-yX0QThPc.cjs} +374 -57
  11. package/dist/index.cjs +2 -2
  12. package/dist/index.mjs +2 -2
  13. package/dist/lib.cjs +1 -1
  14. package/dist/lib.d.cts +82 -22
  15. package/dist/lib.d.mts +82 -22
  16. package/dist/lib.mjs +1 -1
  17. package/dist/{registerKillSessionHandler-Cl_er9rg.cjs → registerKillSessionHandler-3f8MBSd6.cjs} +2 -2
  18. package/dist/{registerKillSessionHandler-beu2g-Qo.mjs → registerKillSessionHandler-aB2llDD3.mjs} +2 -2
  19. package/dist/{runClaude-DmXinUiz.cjs → runClaude-5moKE082.cjs} +4 -4
  20. package/dist/{runClaude-nzLh-orP.mjs → runClaude-BXO5ycyI.mjs} +4 -4
  21. package/dist/{runCodex-CoqsQ-cb.cjs → runCodex-BJn5KMLg.cjs} +9 -7
  22. package/dist/{runCodex-C-Pjpbxn.mjs → runCodex-DYEMgHdw.mjs} +9 -7
  23. package/dist/{runGemini-CIVm6NWC.mjs → runGemini-CHWnR9gf.mjs} +4 -4
  24. package/dist/{runGemini-BC_5rNMt.cjs → runGemini-CWG0QweX.cjs} +4 -4
  25. package/package.json +1 -1
  26. package/scripts/tooling-utils.mjs +167 -167
@@ -1,167 +1,167 @@
1
- import { spawnSync } from 'node:child_process';
2
- import { existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
3
- import { dirname, resolve } from 'node:path';
4
-
5
- function getLocalPackageDirs(packageName, packageRoot, workspaceRoot) {
6
- return [
7
- resolve(packageRoot, 'node_modules', packageName),
8
- resolve(workspaceRoot, 'node_modules', packageName),
9
- ];
10
- }
11
-
12
- function getLocalBinPaths(binName, packageRoot, workspaceRoot) {
13
- const suffix = process.platform === 'win32' ? '.cmd' : '';
14
-
15
- return [
16
- resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`),
17
- resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`),
18
- ];
19
- }
20
-
21
- function resolveInstalledPackageDir(packageName, packageRoot, workspaceRoot) {
22
- return getLocalPackageDirs(packageName, packageRoot, workspaceRoot)
23
- .find((candidatePath) => existsSync(candidatePath))
24
- ?? null;
25
- }
26
-
27
- export function shouldUseShell(command) {
28
- if (process.platform !== 'win32') {
29
- return false;
30
- }
31
-
32
- return !/\.exe$/i.test(command);
33
- }
34
-
35
- export function resolveTool({
36
- binName,
37
- packageName,
38
- packageRoot,
39
- workspaceRoot,
40
- packageSpecs,
41
- entryCandidates = [],
42
- }) {
43
- for (const packageDir of getLocalPackageDirs(packageName, packageRoot, workspaceRoot)) {
44
- for (const entryCandidate of entryCandidates) {
45
- const entryPath = resolve(packageDir, entryCandidate);
46
-
47
- if (existsSync(entryPath)) {
48
- return {
49
- command: process.execPath,
50
- prefixArgs: [entryPath],
51
- };
52
- }
53
- }
54
- }
55
-
56
- for (const localBinPath of getLocalBinPaths(binName, packageRoot, workspaceRoot)) {
57
- if (existsSync(localBinPath)) {
58
- return {
59
- command: localBinPath,
60
- prefixArgs: [],
61
- };
62
- }
63
- }
64
-
65
- return {
66
- command: 'npx',
67
- prefixArgs: ['-y', ...packageSpecs.flatMap((packageSpec) => ['-p', packageSpec]), binName],
68
- };
69
- }
70
-
71
- export function resolvePackageDirWithNpx({
72
- packageName,
73
- version,
74
- packageRoot,
75
- env = process.env,
76
- spawn = spawnSync,
77
- }) {
78
- const cacheKey = `${packageName.replace(/[@/]/g, '_')}-${version}`;
79
- const installRoot = resolve(packageRoot, 'node_modules', '.tool-cache', cacheKey);
80
- const installPackagePath = resolve(installRoot, 'node_modules', packageName);
81
-
82
- if (existsSync(installPackagePath)) {
83
- return installPackagePath;
84
- }
85
-
86
- mkdirSync(installRoot, { recursive: true });
87
- writeFileSync(
88
- resolve(installRoot, 'package.json'),
89
- JSON.stringify(
90
- {
91
- private: true,
92
- name: `happy-cli-tool-cache-${cacheKey}`,
93
- },
94
- null,
95
- 2
96
- )
97
- );
98
-
99
- const commandArgs = [
100
- 'install',
101
- '--no-save',
102
- '--ignore-scripts',
103
- '--no-package-lock',
104
- '--no-audit',
105
- '--fund=false',
106
- `${packageName}@${version}`,
107
- ];
108
- const result = spawn('npm', commandArgs, {
109
- cwd: installRoot,
110
- encoding: 'utf8',
111
- shell: shouldUseShell('npm'),
112
- env,
113
- });
114
-
115
- if (result.status !== 0) {
116
- const stderr = result.stderr?.trim();
117
- const stdout = result.stdout?.trim();
118
- throw new Error(
119
- stderr && stderr.length > 0
120
- ? stderr
121
- : stdout && stdout.length > 0
122
- ? stdout
123
- : `Failed to install ${packageName}@${version} for local resolution`
124
- );
125
- }
126
-
127
- if (!existsSync(installPackagePath)) {
128
- throw new Error(`Installed package path missing for ${packageName}@${version}`);
129
- }
130
-
131
- return installPackagePath;
132
- }
133
-
134
- export function ensurePackageResolvableFromPackageRoot({
135
- packageName,
136
- version,
137
- packageRoot,
138
- workspaceRoot,
139
- env = process.env,
140
- spawn = spawnSync,
141
- fallbackResolver = resolvePackageDirWithNpx,
142
- }) {
143
- const linkPath = resolve(packageRoot, 'node_modules', packageName);
144
-
145
- if (existsSync(linkPath)) {
146
- return () => {};
147
- }
148
-
149
- const localPackageDir = resolveInstalledPackageDir(packageName, packageRoot, workspaceRoot);
150
- const targetPath = localPackageDir ?? fallbackResolver({
151
- packageName,
152
- version,
153
- packageRoot,
154
- workspaceRoot,
155
- env,
156
- spawn,
157
- });
158
-
159
- mkdirSync(dirname(linkPath), { recursive: true });
160
- symlinkSync(targetPath, linkPath, process.platform === 'win32' ? 'junction' : 'dir');
161
-
162
- return () => {
163
- try {
164
- rmSync(linkPath, { recursive: true, force: true });
165
- } catch {}
166
- };
167
- }
1
+ import { spawnSync } from 'node:child_process';
2
+ import { existsSync, mkdirSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
3
+ import { dirname, resolve } from 'node:path';
4
+
5
+ function getLocalPackageDirs(packageName, packageRoot, workspaceRoot) {
6
+ return [
7
+ resolve(packageRoot, 'node_modules', packageName),
8
+ resolve(workspaceRoot, 'node_modules', packageName),
9
+ ];
10
+ }
11
+
12
+ function getLocalBinPaths(binName, packageRoot, workspaceRoot) {
13
+ const suffix = process.platform === 'win32' ? '.cmd' : '';
14
+
15
+ return [
16
+ resolve(packageRoot, 'node_modules', '.bin', `${binName}${suffix}`),
17
+ resolve(workspaceRoot, 'node_modules', '.bin', `${binName}${suffix}`),
18
+ ];
19
+ }
20
+
21
+ function resolveInstalledPackageDir(packageName, packageRoot, workspaceRoot) {
22
+ return getLocalPackageDirs(packageName, packageRoot, workspaceRoot)
23
+ .find((candidatePath) => existsSync(candidatePath))
24
+ ?? null;
25
+ }
26
+
27
+ export function shouldUseShell(command) {
28
+ if (process.platform !== 'win32') {
29
+ return false;
30
+ }
31
+
32
+ return !/\.exe$/i.test(command);
33
+ }
34
+
35
+ export function resolveTool({
36
+ binName,
37
+ packageName,
38
+ packageRoot,
39
+ workspaceRoot,
40
+ packageSpecs,
41
+ entryCandidates = [],
42
+ }) {
43
+ for (const packageDir of getLocalPackageDirs(packageName, packageRoot, workspaceRoot)) {
44
+ for (const entryCandidate of entryCandidates) {
45
+ const entryPath = resolve(packageDir, entryCandidate);
46
+
47
+ if (existsSync(entryPath)) {
48
+ return {
49
+ command: process.execPath,
50
+ prefixArgs: [entryPath],
51
+ };
52
+ }
53
+ }
54
+ }
55
+
56
+ for (const localBinPath of getLocalBinPaths(binName, packageRoot, workspaceRoot)) {
57
+ if (existsSync(localBinPath)) {
58
+ return {
59
+ command: localBinPath,
60
+ prefixArgs: [],
61
+ };
62
+ }
63
+ }
64
+
65
+ return {
66
+ command: 'npx',
67
+ prefixArgs: ['-y', ...packageSpecs.flatMap((packageSpec) => ['-p', packageSpec]), binName],
68
+ };
69
+ }
70
+
71
+ export function resolvePackageDirWithNpx({
72
+ packageName,
73
+ version,
74
+ packageRoot,
75
+ env = process.env,
76
+ spawn = spawnSync,
77
+ }) {
78
+ const cacheKey = `${packageName.replace(/[@/]/g, '_')}-${version}`;
79
+ const installRoot = resolve(packageRoot, 'node_modules', '.tool-cache', cacheKey);
80
+ const installPackagePath = resolve(installRoot, 'node_modules', packageName);
81
+
82
+ if (existsSync(installPackagePath)) {
83
+ return installPackagePath;
84
+ }
85
+
86
+ mkdirSync(installRoot, { recursive: true });
87
+ writeFileSync(
88
+ resolve(installRoot, 'package.json'),
89
+ JSON.stringify(
90
+ {
91
+ private: true,
92
+ name: `happy-cli-tool-cache-${cacheKey}`,
93
+ },
94
+ null,
95
+ 2
96
+ )
97
+ );
98
+
99
+ const commandArgs = [
100
+ 'install',
101
+ '--no-save',
102
+ '--ignore-scripts',
103
+ '--no-package-lock',
104
+ '--no-audit',
105
+ '--fund=false',
106
+ `${packageName}@${version}`,
107
+ ];
108
+ const result = spawn('npm', commandArgs, {
109
+ cwd: installRoot,
110
+ encoding: 'utf8',
111
+ shell: shouldUseShell('npm'),
112
+ env,
113
+ });
114
+
115
+ if (result.status !== 0) {
116
+ const stderr = result.stderr?.trim();
117
+ const stdout = result.stdout?.trim();
118
+ throw new Error(
119
+ stderr && stderr.length > 0
120
+ ? stderr
121
+ : stdout && stdout.length > 0
122
+ ? stdout
123
+ : `Failed to install ${packageName}@${version} for local resolution`
124
+ );
125
+ }
126
+
127
+ if (!existsSync(installPackagePath)) {
128
+ throw new Error(`Installed package path missing for ${packageName}@${version}`);
129
+ }
130
+
131
+ return installPackagePath;
132
+ }
133
+
134
+ export function ensurePackageResolvableFromPackageRoot({
135
+ packageName,
136
+ version,
137
+ packageRoot,
138
+ workspaceRoot,
139
+ env = process.env,
140
+ spawn = spawnSync,
141
+ fallbackResolver = resolvePackageDirWithNpx,
142
+ }) {
143
+ const linkPath = resolve(packageRoot, 'node_modules', packageName);
144
+
145
+ if (existsSync(linkPath)) {
146
+ return () => {};
147
+ }
148
+
149
+ const localPackageDir = resolveInstalledPackageDir(packageName, packageRoot, workspaceRoot);
150
+ const targetPath = localPackageDir ?? fallbackResolver({
151
+ packageName,
152
+ version,
153
+ packageRoot,
154
+ workspaceRoot,
155
+ env,
156
+ spawn,
157
+ });
158
+
159
+ mkdirSync(dirname(linkPath), { recursive: true });
160
+ symlinkSync(targetPath, linkPath, process.platform === 'win32' ? 'junction' : 'dir');
161
+
162
+ return () => {
163
+ try {
164
+ rmSync(linkPath, { recursive: true, force: true });
165
+ } catch {}
166
+ };
167
+ }