@koalaauto/agentchannel 3.36.0 → 3.36.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/dist/src/cli.js +7 -2
- package/dist/src/sandboxcheck.d.ts +8 -2
- package/dist/src/sandboxcheck.js +35 -12
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -2043,11 +2043,16 @@ async function codexSandboxSetup(env, out) {
|
|
|
2043
2043
|
const codexHome = env.CODEX_HOME || (home ? join(home, '.codex') : undefined);
|
|
2044
2044
|
const overrides = codexSandboxOverrides({ perm: 'workdir', mode: 'work', cwd: process.cwd(), hub }).flatMap((c) => ['-c', c]);
|
|
2045
2045
|
const args = [...codex.slice(1), ...overrides, 'sandbox', 'setup', '--elevated', '--current-user', ...(codexHome ? ['--codex-home', codexHome] : [])];
|
|
2046
|
+
let failed = '';
|
|
2046
2047
|
const code = await new Promise((res) => {
|
|
2047
2048
|
const p = spawn(codex[0], args, { env, stdio: 'inherit', windowsHide: false });
|
|
2048
|
-
p.on('error', () =>
|
|
2049
|
+
p.on('error', (e) => {
|
|
2050
|
+
failed = e.message; // Codex did not start at all (a codex.cmd from PATH cannot be started without a shell)
|
|
2051
|
+
res(1);
|
|
2052
|
+
});
|
|
2049
2053
|
p.on('exit', (c) => res(c ?? 1));
|
|
2050
2054
|
});
|
|
2051
|
-
|
|
2055
|
+
const why = failed ? `${codex[0]}: ${failed}` : zh ? `退出码 ${code}` : `exit ${code}`;
|
|
2056
|
+
out(code === 0 ? (zh ? '设置完成:重启 runner。' : 'Done: restart the runner.') : zh ? `设置没有完成(${why})。` : `The setup did not finish (${why}).`);
|
|
2052
2057
|
return code === 0 ? 0 : 1;
|
|
2053
2058
|
}
|
|
@@ -75,8 +75,14 @@ export declare function onPath(name: string, env: NodeJS.ProcessEnv): string | u
|
|
|
75
75
|
export declare function pkgFor(distro: string[] | undefined): PkgManager | undefined;
|
|
76
76
|
/** Read the machine (Linux files; elsewhere only the platform matters). */
|
|
77
77
|
export declare function detectHost(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): Host;
|
|
78
|
-
/**
|
|
79
|
-
|
|
78
|
+
/**
|
|
79
|
+
* The Codex CLI the runner's SDK uses: the @openai/codex package found from @openai/codex-sdk, as the SDK finds it (npm may not
|
|
80
|
+
* place it next to this CLI), else `codex` on PATH. On Windows a PATH `codex.cmd` (an npm shim) is run as node and its script:
|
|
81
|
+
* Node cannot start a .cmd without a shell (spawn EINVAL, echo-duck-pr's startup check).
|
|
82
|
+
*/
|
|
83
|
+
export declare function codexCommand(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string[] | undefined;
|
|
84
|
+
/** `codex` on PATH; on Windows codex.exe, else an npm `codex.cmd` shim as node and its script (see codexCommand). */
|
|
85
|
+
export declare function codexOnPath(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string[] | undefined;
|
|
80
86
|
/** What a failed sandbox start said, as a problem. */
|
|
81
87
|
export declare function classify(stderr: string, host: Host): SandboxProblem;
|
|
82
88
|
export interface ProbeOptions {
|
package/dist/src/sandboxcheck.js
CHANGED
|
@@ -4,6 +4,7 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'no
|
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
import { homedir, tmpdir } from 'node:os';
|
|
6
6
|
import { delimiter, dirname, join } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
7
8
|
import { codexSandboxOverrides } from './adapters/codex.js';
|
|
8
9
|
import { linkWindowsSandbox, unlinkWindowsSandbox, WINDOWS_ELEVATED_CONFIG } from './codexhome.js';
|
|
9
10
|
import { toolchainReadRoots } from './adapters/paths.js';
|
|
@@ -14,7 +15,9 @@ export const defaultRun = (file, args, opts) => new Promise((res) => {
|
|
|
14
15
|
});
|
|
15
16
|
});
|
|
16
17
|
export function onPath(name, env) {
|
|
17
|
-
|
|
18
|
+
// Windows spells it Path in a plain copy of the environment
|
|
19
|
+
const path = env.PATH ?? Object.entries(env).find(([k]) => k.toLowerCase() === 'path')?.[1] ?? '';
|
|
20
|
+
for (const d of path.split(delimiter)) {
|
|
18
21
|
if (!d)
|
|
19
22
|
continue;
|
|
20
23
|
const f = join(d, name);
|
|
@@ -61,19 +64,39 @@ export function detectHost(env = process.env, platform = process.platform) {
|
|
|
61
64
|
h.socat = onPath('socat', env);
|
|
62
65
|
return h;
|
|
63
66
|
}
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
/**
|
|
68
|
+
* The Codex CLI the runner's SDK uses: the @openai/codex package found from @openai/codex-sdk, as the SDK finds it (npm may not
|
|
69
|
+
* place it next to this CLI), else `codex` on PATH. On Windows a PATH `codex.cmd` (an npm shim) is run as node and its script:
|
|
70
|
+
* Node cannot start a .cmd without a shell (spawn EINVAL, echo-duck-pr's startup check).
|
|
71
|
+
*/
|
|
72
|
+
export function codexCommand(env = process.env, platform = process.platform) {
|
|
73
|
+
const from = [() => import.meta.url, () => fileURLToPath(import.meta.resolve('@openai/codex-sdk'))];
|
|
74
|
+
for (const base of from) {
|
|
75
|
+
try {
|
|
76
|
+
const f = join(dirname(createRequire(base()).resolve('@openai/codex/package.json')), 'bin', 'codex.js');
|
|
77
|
+
if (existsSync(f))
|
|
78
|
+
return [process.execPath, f];
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
/* not found from there */
|
|
82
|
+
}
|
|
71
83
|
}
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
return codexOnPath(env, platform);
|
|
85
|
+
}
|
|
86
|
+
/** `codex` on PATH; on Windows codex.exe, else an npm `codex.cmd` shim as node and its script (see codexCommand). */
|
|
87
|
+
export function codexOnPath(env, platform = process.platform) {
|
|
88
|
+
if (platform !== 'win32') {
|
|
89
|
+
const p = onPath('codex', env);
|
|
90
|
+
return p ? [p] : undefined;
|
|
74
91
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
92
|
+
const exe = onPath('codex.exe', env);
|
|
93
|
+
if (exe)
|
|
94
|
+
return [exe];
|
|
95
|
+
const shim = onPath('codex.cmd', env);
|
|
96
|
+
if (!shim)
|
|
97
|
+
return undefined;
|
|
98
|
+
const js = join(dirname(shim), 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
99
|
+
return existsSync(js) ? [process.execPath, js] : [shim];
|
|
77
100
|
}
|
|
78
101
|
/** What a failed sandbox start said, as a problem. */
|
|
79
102
|
export function classify(stderr, host) {
|
package/dist/src/version.d.ts
CHANGED
package/dist/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalaauto/agentchannel",
|
|
3
|
-
"version": "3.36.
|
|
3
|
+
"version": "3.36.2",
|
|
4
4
|
"description": "Hand work between your team's agents (Claude Code, Codex) and follow it in one panel: the ach CLI, MCP server and runner for AgentChannel v2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentchannel",
|