happy-imou-cloud 2.1.49 → 2.1.51
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/dist/AcpBackend-CqO3D07V.mjs +2619 -0
- package/dist/AcpBackend-XPiTd6ph.cjs +2621 -0
- package/dist/{BaseReasoningProcessor-Dn9NcoHz.cjs → BaseReasoningProcessor-BD9tiwep.cjs} +1 -144
- package/dist/{BaseReasoningProcessor-CAVeOdyo.mjs → BaseReasoningProcessor-CjlayL2f.mjs} +2 -144
- package/dist/ConversationHistory-Bl2doTA-.cjs +780 -0
- package/dist/ConversationHistory-CI5bBfuA.mjs +771 -0
- package/dist/{ProviderSelectionHandler-BJJc7qOR.cjs → ProviderSelectionHandler-C7GE5QjX.cjs} +6 -6
- package/dist/{ProviderSelectionHandler-DIYidT13.mjs → ProviderSelectionHandler-uQ8jzdzr.mjs} +2 -2
- package/dist/RuntimeShell-BDt42io_.mjs +252 -0
- package/dist/RuntimeShell-D_Te12wq.cjs +258 -0
- package/dist/bootstrapManagedProviderSession-Bln-TwyB.cjs +147 -0
- package/dist/bootstrapManagedProviderSession-D2Z6YU3n.mjs +145 -0
- package/dist/claude-BKNT-2fG.cjs +1080 -0
- package/dist/claude-CnN5WCWj.mjs +1073 -0
- package/dist/codex-DLGP8WF6.mjs +577 -0
- package/dist/codex-Fv2eali8.cjs +582 -0
- package/dist/{command-VcH4hbhi.cjs → command-BWPlJyCN.cjs} +16 -8
- package/dist/{command-CzfRRhVe.mjs → command-CELwsYoG.mjs} +15 -7
- package/dist/config-CFL0Gkqt.cjs +184 -0
- package/dist/config-ChSPe7p9.mjs +174 -0
- package/dist/createDefaultRuntimeShell-BXu3vCvT.cjs +33 -0
- package/dist/createDefaultRuntimeShell-DOg6g3-G.mjs +31 -0
- package/dist/cursor-Blq1cHdr.cjs +91 -0
- package/dist/cursor-CwPNSy_A.mjs +88 -0
- package/dist/future-Dq4Ha1Dn.cjs +24 -0
- package/dist/future-xRdLl3vf.mjs +22 -0
- package/dist/{index-xa1kwZoj.cjs → index-B_JYgMUS.cjs} +189 -5352
- package/dist/{index-7Z93BoVn.mjs → index-CX-F_fuk.mjs} +177 -5331
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/installFatalProcessHandlers-0vaw9MAz.mjs +55 -0
- package/dist/installFatalProcessHandlers-CyURn5Bp.cjs +57 -0
- package/dist/launch-BoCCEd5p.mjs +63 -0
- package/dist/launch-wZA5BcvS.cjs +66 -0
- package/dist/lib.cjs +2 -3
- package/dist/lib.d.cts +20 -17
- package/dist/lib.d.mts +20 -17
- package/dist/lib.mjs +1 -2
- package/dist/resolveCommand-B3BGyBE2.mjs +189 -0
- package/dist/resolveCommand-DYMd9PNC.cjs +193 -0
- package/dist/{runClaude-zCwRhpOw.mjs → runClaude-Be0myF9k.mjs} +8 -5
- package/dist/{runClaude-BBGNmGj6.cjs → runClaude-DZJt5er7.cjs} +46 -43
- package/dist/{runCodex-BbgLVjb9.mjs → runCodex-BSnyN4m7.mjs} +226 -117
- package/dist/{runCodex-jUU6U2tZ.cjs → runCodex-DTCcGRue.cjs} +269 -160
- package/dist/runCursor-Bn1PuwJy.cjs +506 -0
- package/dist/runCursor-M6dQ6bGF.mjs +504 -0
- package/dist/{runGemini-DcwNsudA.mjs → runGemini-BNm4vYKA.mjs} +279 -5
- package/dist/{runGemini-C0NT8MHK.cjs → runGemini-Bn3lFhz6.cjs} +309 -35
- package/dist/{registerKillSessionHandler-DLDg2EES.mjs → sessionControl-1bT_7OI6.mjs} +1643 -2405
- package/dist/{registerKillSessionHandler-CfCya6si.cjs → sessionControl-flKnQrx0.cjs} +1647 -2417
- package/dist/{api-DnqaNvyV.mjs → types-B5vtxa38.mjs} +55 -5
- package/dist/{api-D7nAeZi7.cjs → types-CttABk32.cjs} +55 -4
- package/package.json +2 -2
- package/dist/types-CiliQpqS.mjs +0 -52
- package/dist/types-DVk3crez.cjs +0 -54
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, resolve, delimiter, join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const DEFAULT_CODEX_ACP_NPX_PACKAGE = "@zed-industries/codex-acp@0.14.0";
|
|
5
|
+
function readFirstEnv(...names) {
|
|
6
|
+
for (const name of names) {
|
|
7
|
+
const raw = process.env[name];
|
|
8
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
9
|
+
return raw.trim();
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
function normalizeCommandPath(command) {
|
|
15
|
+
if (isAbsolute(command)) {
|
|
16
|
+
return command;
|
|
17
|
+
}
|
|
18
|
+
const resolved = resolve(process.cwd(), command);
|
|
19
|
+
return existsSync(resolved) ? resolved : command;
|
|
20
|
+
}
|
|
21
|
+
function resolveCommandOnPath(command) {
|
|
22
|
+
const pathValue = typeof process.env.PATH === "string" ? process.env.PATH : "";
|
|
23
|
+
if (!pathValue) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const extensions = process.platform === "win32" ? (process.env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((value) => value.trim().toLowerCase()).filter(Boolean) : [""];
|
|
27
|
+
for (const dir of pathValue.split(delimiter)) {
|
|
28
|
+
const trimmedDir = dir.trim();
|
|
29
|
+
if (!trimmedDir) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const directCandidate = join(trimmedDir, command);
|
|
33
|
+
if (existsSync(directCandidate)) {
|
|
34
|
+
return directCandidate;
|
|
35
|
+
}
|
|
36
|
+
if (process.platform !== "win32") {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const hasExtension = /\.[^\\/]+$/.test(command);
|
|
40
|
+
if (hasExtension) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
for (const extension of extensions) {
|
|
44
|
+
const candidate = join(trimmedDir, `${command}${extension.toLowerCase()}`);
|
|
45
|
+
if (existsSync(candidate)) {
|
|
46
|
+
return candidate;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function readCodexAcpNpxMode() {
|
|
53
|
+
const raw = readFirstEnv("HAPPY_CODEX_ACP_NPX_MODE", "HAPPIER_CODEX_ACP_NPX_MODE").toLowerCase();
|
|
54
|
+
if (raw === "auto" || raw === "never" || raw === "force") {
|
|
55
|
+
return raw;
|
|
56
|
+
}
|
|
57
|
+
return "auto";
|
|
58
|
+
}
|
|
59
|
+
function readCodexAcpNpxPackage() {
|
|
60
|
+
const configured = readFirstEnv("HAPPY_CODEX_ACP_PACKAGE", "HAPPIER_CODEX_ACP_PACKAGE");
|
|
61
|
+
return configured || DEFAULT_CODEX_ACP_NPX_PACKAGE;
|
|
62
|
+
}
|
|
63
|
+
function isBinOnPath(baseName) {
|
|
64
|
+
return resolveCommandOnPath(baseName) !== null;
|
|
65
|
+
}
|
|
66
|
+
function readCodexAcpConfigOverrides() {
|
|
67
|
+
const raw = readFirstEnv("HAPPY_CODEX_ACP_CONFIG_OVERRIDES", "HAPPIER_CODEX_ACP_CONFIG_OVERRIDES");
|
|
68
|
+
return raw.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
69
|
+
}
|
|
70
|
+
function sanitizeCodexAcpBaseArgs(baseArgs = []) {
|
|
71
|
+
const sanitized = [];
|
|
72
|
+
for (let index = 0; index < baseArgs.length; index += 1) {
|
|
73
|
+
const arg = baseArgs[index];
|
|
74
|
+
if (arg === "--dangerously-bypass-approvals-and-sandbox" || arg === "--yolo" || arg.startsWith("--ask-for-approval=") || arg.startsWith("--approval-policy=") || arg.startsWith("--sandbox=")) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (arg === "--ask-for-approval" || arg === "--approval-policy" || arg === "--sandbox") {
|
|
78
|
+
index += 1;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
sanitized.push(arg);
|
|
82
|
+
}
|
|
83
|
+
return sanitized;
|
|
84
|
+
}
|
|
85
|
+
function buildCodexAcpConfigArgs(options) {
|
|
86
|
+
const args = sanitizeCodexAcpBaseArgs(options.baseArgs);
|
|
87
|
+
const overrides = [...readCodexAcpConfigOverrides()];
|
|
88
|
+
if (options.model) {
|
|
89
|
+
overrides.push(`model=${JSON.stringify(options.model)}`);
|
|
90
|
+
}
|
|
91
|
+
if (options.approvalPolicy) {
|
|
92
|
+
overrides.push(`approval_policy=${JSON.stringify(options.approvalPolicy)}`);
|
|
93
|
+
}
|
|
94
|
+
if (options.sandbox) {
|
|
95
|
+
overrides.push(`sandbox_mode=${JSON.stringify(options.sandbox)}`);
|
|
96
|
+
}
|
|
97
|
+
for (const override of overrides) {
|
|
98
|
+
args.push("-c", override);
|
|
99
|
+
}
|
|
100
|
+
return args;
|
|
101
|
+
}
|
|
102
|
+
function resolveNpxCommand() {
|
|
103
|
+
return resolveCommandOnPath(process.platform === "win32" ? "npx.cmd" : "npx") ?? resolveCommandOnPath("npx") ?? (process.platform === "win32" ? "npx.cmd" : "npx");
|
|
104
|
+
}
|
|
105
|
+
function resolveCodexAcpSpawn(options = {}) {
|
|
106
|
+
if (options.args) {
|
|
107
|
+
const command = normalizeCommandPath(options.command || readFirstEnv("HAPPY_CODEX_ACP_BIN", "HAPPY_CODEX_ACP_COMMAND", "HAPPIER_CODEX_ACP_BIN") || "codex-acp");
|
|
108
|
+
return {
|
|
109
|
+
command,
|
|
110
|
+
args: [...options.args]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const directArgs = buildCodexAcpConfigArgs(options);
|
|
114
|
+
if (options.command) {
|
|
115
|
+
return {
|
|
116
|
+
command: normalizeCommandPath(options.command),
|
|
117
|
+
args: directArgs
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const envOverride = readFirstEnv("HAPPY_CODEX_ACP_BIN", "HAPPY_CODEX_ACP_COMMAND", "HAPPIER_CODEX_ACP_BIN");
|
|
121
|
+
if (envOverride) {
|
|
122
|
+
return {
|
|
123
|
+
command: normalizeCommandPath(envOverride),
|
|
124
|
+
args: directArgs
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const npxMode = readCodexAcpNpxMode();
|
|
128
|
+
const codexAcpOnPath = resolveCommandOnPath(process.platform === "win32" ? "codex-acp.cmd" : "codex-acp") ?? resolveCommandOnPath("codex-acp");
|
|
129
|
+
if (npxMode !== "force" && codexAcpOnPath) {
|
|
130
|
+
return {
|
|
131
|
+
command: codexAcpOnPath,
|
|
132
|
+
args: directArgs
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (npxMode === "never") {
|
|
136
|
+
return {
|
|
137
|
+
command: process.platform === "win32" ? "codex-acp.cmd" : "codex-acp",
|
|
138
|
+
args: directArgs
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
command: resolveNpxCommand(),
|
|
143
|
+
args: ["--prefer-offline", "-y", readCodexAcpNpxPackage(), ...directArgs]
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function validateCodexAcpSpawn(options = {}) {
|
|
147
|
+
let spawn;
|
|
148
|
+
try {
|
|
149
|
+
spawn = resolveCodexAcpSpawn(options);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return {
|
|
152
|
+
ok: false,
|
|
153
|
+
errorMessage: error instanceof Error ? error.message : "Codex ACP is enabled, but the command could not be resolved."
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const normalizedCommand = spawn.command.trim();
|
|
157
|
+
const commandLower = normalizedCommand.toLowerCase();
|
|
158
|
+
const npxMode = readCodexAcpNpxMode();
|
|
159
|
+
if (isAbsolute(normalizedCommand)) {
|
|
160
|
+
if (!existsSync(normalizedCommand)) {
|
|
161
|
+
return {
|
|
162
|
+
ok: false,
|
|
163
|
+
errorMessage: `Codex ACP is enabled, but the resolved command does not exist: ${normalizedCommand}`
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return { ok: true, spawn };
|
|
167
|
+
}
|
|
168
|
+
if (commandLower.endsWith("npx") || commandLower.endsWith("npx.cmd")) {
|
|
169
|
+
if (isBinOnPath("npx") || isBinOnPath("npx.cmd")) {
|
|
170
|
+
return { ok: true, spawn };
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
ok: false,
|
|
174
|
+
errorMessage: "Codex ACP is enabled, but codex-acp is not installed and npx is not available. Install codex-acp, install Node.js/npm so npx is available, or set HAPPY_CODEX_ACP_BIN to a working codex-acp executable."
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (commandLower === "codex-acp" || commandLower === "codex-acp.cmd") {
|
|
178
|
+
if (isBinOnPath("codex-acp") || isBinOnPath("codex-acp.cmd")) {
|
|
179
|
+
return { ok: true, spawn };
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
ok: false,
|
|
183
|
+
errorMessage: npxMode === "never" ? "Codex ACP is enabled, but codex-acp is not installed and npx fallback is disabled. Install codex-acp, add it to PATH, or set HAPPY_CODEX_ACP_BIN to the executable." : "Codex ACP is enabled, but codex-acp could not be resolved on PATH. Install codex-acp, add it to PATH, or set HAPPY_CODEX_ACP_BIN to the executable."
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
return { ok: true, spawn };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export { resolveCodexAcpSpawn as a, resolveCommandOnPath as r, validateCodexAcpSpawn as v };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('node:fs');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
|
|
6
|
+
const DEFAULT_CODEX_ACP_NPX_PACKAGE = "@zed-industries/codex-acp@0.14.0";
|
|
7
|
+
function readFirstEnv(...names) {
|
|
8
|
+
for (const name of names) {
|
|
9
|
+
const raw = process.env[name];
|
|
10
|
+
if (typeof raw === "string" && raw.trim()) {
|
|
11
|
+
return raw.trim();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return "";
|
|
15
|
+
}
|
|
16
|
+
function normalizeCommandPath(command) {
|
|
17
|
+
if (path.isAbsolute(command)) {
|
|
18
|
+
return command;
|
|
19
|
+
}
|
|
20
|
+
const resolved = path.resolve(process.cwd(), command);
|
|
21
|
+
return fs.existsSync(resolved) ? resolved : command;
|
|
22
|
+
}
|
|
23
|
+
function resolveCommandOnPath(command) {
|
|
24
|
+
const pathValue = typeof process.env.PATH === "string" ? process.env.PATH : "";
|
|
25
|
+
if (!pathValue) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const extensions = process.platform === "win32" ? (process.env.PATHEXT || ".COM;.EXE;.BAT;.CMD").split(";").map((value) => value.trim().toLowerCase()).filter(Boolean) : [""];
|
|
29
|
+
for (const dir of pathValue.split(path.delimiter)) {
|
|
30
|
+
const trimmedDir = dir.trim();
|
|
31
|
+
if (!trimmedDir) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const directCandidate = path.join(trimmedDir, command);
|
|
35
|
+
if (fs.existsSync(directCandidate)) {
|
|
36
|
+
return directCandidate;
|
|
37
|
+
}
|
|
38
|
+
if (process.platform !== "win32") {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const hasExtension = /\.[^\\/]+$/.test(command);
|
|
42
|
+
if (hasExtension) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
for (const extension of extensions) {
|
|
46
|
+
const candidate = path.join(trimmedDir, `${command}${extension.toLowerCase()}`);
|
|
47
|
+
if (fs.existsSync(candidate)) {
|
|
48
|
+
return candidate;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function readCodexAcpNpxMode() {
|
|
55
|
+
const raw = readFirstEnv("HAPPY_CODEX_ACP_NPX_MODE", "HAPPIER_CODEX_ACP_NPX_MODE").toLowerCase();
|
|
56
|
+
if (raw === "auto" || raw === "never" || raw === "force") {
|
|
57
|
+
return raw;
|
|
58
|
+
}
|
|
59
|
+
return "auto";
|
|
60
|
+
}
|
|
61
|
+
function readCodexAcpNpxPackage() {
|
|
62
|
+
const configured = readFirstEnv("HAPPY_CODEX_ACP_PACKAGE", "HAPPIER_CODEX_ACP_PACKAGE");
|
|
63
|
+
return configured || DEFAULT_CODEX_ACP_NPX_PACKAGE;
|
|
64
|
+
}
|
|
65
|
+
function isBinOnPath(baseName) {
|
|
66
|
+
return resolveCommandOnPath(baseName) !== null;
|
|
67
|
+
}
|
|
68
|
+
function readCodexAcpConfigOverrides() {
|
|
69
|
+
const raw = readFirstEnv("HAPPY_CODEX_ACP_CONFIG_OVERRIDES", "HAPPIER_CODEX_ACP_CONFIG_OVERRIDES");
|
|
70
|
+
return raw.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
71
|
+
}
|
|
72
|
+
function sanitizeCodexAcpBaseArgs(baseArgs = []) {
|
|
73
|
+
const sanitized = [];
|
|
74
|
+
for (let index = 0; index < baseArgs.length; index += 1) {
|
|
75
|
+
const arg = baseArgs[index];
|
|
76
|
+
if (arg === "--dangerously-bypass-approvals-and-sandbox" || arg === "--yolo" || arg.startsWith("--ask-for-approval=") || arg.startsWith("--approval-policy=") || arg.startsWith("--sandbox=")) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (arg === "--ask-for-approval" || arg === "--approval-policy" || arg === "--sandbox") {
|
|
80
|
+
index += 1;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
sanitized.push(arg);
|
|
84
|
+
}
|
|
85
|
+
return sanitized;
|
|
86
|
+
}
|
|
87
|
+
function buildCodexAcpConfigArgs(options) {
|
|
88
|
+
const args = sanitizeCodexAcpBaseArgs(options.baseArgs);
|
|
89
|
+
const overrides = [...readCodexAcpConfigOverrides()];
|
|
90
|
+
if (options.model) {
|
|
91
|
+
overrides.push(`model=${JSON.stringify(options.model)}`);
|
|
92
|
+
}
|
|
93
|
+
if (options.approvalPolicy) {
|
|
94
|
+
overrides.push(`approval_policy=${JSON.stringify(options.approvalPolicy)}`);
|
|
95
|
+
}
|
|
96
|
+
if (options.sandbox) {
|
|
97
|
+
overrides.push(`sandbox_mode=${JSON.stringify(options.sandbox)}`);
|
|
98
|
+
}
|
|
99
|
+
for (const override of overrides) {
|
|
100
|
+
args.push("-c", override);
|
|
101
|
+
}
|
|
102
|
+
return args;
|
|
103
|
+
}
|
|
104
|
+
function resolveNpxCommand() {
|
|
105
|
+
return resolveCommandOnPath(process.platform === "win32" ? "npx.cmd" : "npx") ?? resolveCommandOnPath("npx") ?? (process.platform === "win32" ? "npx.cmd" : "npx");
|
|
106
|
+
}
|
|
107
|
+
function resolveCodexAcpSpawn(options = {}) {
|
|
108
|
+
if (options.args) {
|
|
109
|
+
const command = normalizeCommandPath(options.command || readFirstEnv("HAPPY_CODEX_ACP_BIN", "HAPPY_CODEX_ACP_COMMAND", "HAPPIER_CODEX_ACP_BIN") || "codex-acp");
|
|
110
|
+
return {
|
|
111
|
+
command,
|
|
112
|
+
args: [...options.args]
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
const directArgs = buildCodexAcpConfigArgs(options);
|
|
116
|
+
if (options.command) {
|
|
117
|
+
return {
|
|
118
|
+
command: normalizeCommandPath(options.command),
|
|
119
|
+
args: directArgs
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const envOverride = readFirstEnv("HAPPY_CODEX_ACP_BIN", "HAPPY_CODEX_ACP_COMMAND", "HAPPIER_CODEX_ACP_BIN");
|
|
123
|
+
if (envOverride) {
|
|
124
|
+
return {
|
|
125
|
+
command: normalizeCommandPath(envOverride),
|
|
126
|
+
args: directArgs
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const npxMode = readCodexAcpNpxMode();
|
|
130
|
+
const codexAcpOnPath = resolveCommandOnPath(process.platform === "win32" ? "codex-acp.cmd" : "codex-acp") ?? resolveCommandOnPath("codex-acp");
|
|
131
|
+
if (npxMode !== "force" && codexAcpOnPath) {
|
|
132
|
+
return {
|
|
133
|
+
command: codexAcpOnPath,
|
|
134
|
+
args: directArgs
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (npxMode === "never") {
|
|
138
|
+
return {
|
|
139
|
+
command: process.platform === "win32" ? "codex-acp.cmd" : "codex-acp",
|
|
140
|
+
args: directArgs
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
command: resolveNpxCommand(),
|
|
145
|
+
args: ["--prefer-offline", "-y", readCodexAcpNpxPackage(), ...directArgs]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function validateCodexAcpSpawn(options = {}) {
|
|
149
|
+
let spawn;
|
|
150
|
+
try {
|
|
151
|
+
spawn = resolveCodexAcpSpawn(options);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
return {
|
|
154
|
+
ok: false,
|
|
155
|
+
errorMessage: error instanceof Error ? error.message : "Codex ACP is enabled, but the command could not be resolved."
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
const normalizedCommand = spawn.command.trim();
|
|
159
|
+
const commandLower = normalizedCommand.toLowerCase();
|
|
160
|
+
const npxMode = readCodexAcpNpxMode();
|
|
161
|
+
if (path.isAbsolute(normalizedCommand)) {
|
|
162
|
+
if (!fs.existsSync(normalizedCommand)) {
|
|
163
|
+
return {
|
|
164
|
+
ok: false,
|
|
165
|
+
errorMessage: `Codex ACP is enabled, but the resolved command does not exist: ${normalizedCommand}`
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return { ok: true, spawn };
|
|
169
|
+
}
|
|
170
|
+
if (commandLower.endsWith("npx") || commandLower.endsWith("npx.cmd")) {
|
|
171
|
+
if (isBinOnPath("npx") || isBinOnPath("npx.cmd")) {
|
|
172
|
+
return { ok: true, spawn };
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
ok: false,
|
|
176
|
+
errorMessage: "Codex ACP is enabled, but codex-acp is not installed and npx is not available. Install codex-acp, install Node.js/npm so npx is available, or set HAPPY_CODEX_ACP_BIN to a working codex-acp executable."
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (commandLower === "codex-acp" || commandLower === "codex-acp.cmd") {
|
|
180
|
+
if (isBinOnPath("codex-acp") || isBinOnPath("codex-acp.cmd")) {
|
|
181
|
+
return { ok: true, spawn };
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
ok: false,
|
|
185
|
+
errorMessage: npxMode === "never" ? "Codex ACP is enabled, but codex-acp is not installed and npx fallback is disabled. Install codex-acp, add it to PATH, or set HAPPY_CODEX_ACP_BIN to the executable." : "Codex ACP is enabled, but codex-acp could not be resolved on PATH. Install codex-acp, add it to PATH, or set HAPPY_CODEX_ACP_BIN to the executable."
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return { ok: true, spawn };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
exports.resolveCodexAcpSpawn = resolveCodexAcpSpawn;
|
|
192
|
+
exports.resolveCommandOnPath = resolveCommandOnPath;
|
|
193
|
+
exports.validateCodexAcpSpawn = validateCodexAcpSpawn;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { l as logger,
|
|
2
|
+
import { l as logger, o as backoff, e as delay, R as RawJSONLinesSchema, d as AssistantMessageStream, q as AsyncLock, c as configuration, s as startOfflineReconnection, b as connectionState, A as ApiClient, i as isAuthenticationRequiredError, h as hashObject } from './types-B5vtxa38.mjs';
|
|
3
3
|
import 'cross-spawn';
|
|
4
4
|
import '@agentclientprotocol/sdk';
|
|
5
|
-
import {
|
|
5
|
+
import { t as getProjectPath, u as claudeLocal, E as ExitCodeError, v as trimIdent, w as claudeCheckSession, p as projectPath, s as stopCaffeinate, e as publishSessionRegistration, x as getEnvironmentInfo, d as createSessionMetadata, y as startCaffeinate, b as closeProviderSession } from './index-CX-F_fuk.mjs';
|
|
6
6
|
import 'ps-list';
|
|
7
7
|
import 'fs';
|
|
8
8
|
import 'path';
|
|
@@ -23,11 +23,14 @@ import 'tweetnacl';
|
|
|
23
23
|
import 'open';
|
|
24
24
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
25
25
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
26
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-
|
|
27
|
-
import { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
28
|
-
import { B as BasePermissionHandler, d as MessageBuffer, C as ConversationHistory$1, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as buildTurnResultPushNotification, t as createSessionTranscriptInkRenderer, j as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, n as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, q as forwardAgentMessageToProviderSession, m as buildPermissionPushNotification, s as syncControlledByUserState, r as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, c as registerKillSessionHandler } from './registerKillSessionHandler-DLDg2EES.mjs';
|
|
26
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-uQ8jzdzr.mjs';
|
|
29
27
|
import 'socket.io-client';
|
|
30
28
|
import 'expo-server-sdk';
|
|
29
|
+
import { F as Future } from './future-xRdLl3vf.mjs';
|
|
30
|
+
import { M as MessageBuffer, C as ConversationHistory$1, b as buildTurnResultPushNotification, d as createSessionTranscriptInkRenderer, a as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, c as buildPermissionPushNotification } from './ConversationHistory-CI5bBfuA.mjs';
|
|
31
|
+
import { c as createClaudeBackend, m as mapToClaudeMode, P as PushableAsyncIterable, q as query, A as AbortError } from './claude-CnN5WCWj.mjs';
|
|
32
|
+
import { B as BasePermissionHandler, d as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, f as finalizeHappyOrgTurnWithBusinessAck, i as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, h as forwardAgentMessageToProviderSession, s as syncControlledByUserState, c as resolveHappyOrgQueuedTurn, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as registerKillSessionHandler } from './sessionControl-1bT_7OI6.mjs';
|
|
33
|
+
import { f as formatDisplayMessage, t as truncateDisplayMessage } from './RuntimeShell-BDt42io_.mjs';
|
|
31
34
|
import { isDeepStrictEqual } from 'node:util';
|
|
32
35
|
import { createServer } from 'node:http';
|
|
33
36
|
import 'zod';
|