@koalaauto/agentchannel 3.36.5 → 3.36.7
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/sandboxcheck.d.ts +16 -2
- package/dist/src/sandboxcheck.js +37 -7
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -70,6 +70,11 @@ export type Run = (file: string, args: string[], opts: {
|
|
|
70
70
|
env: NodeJS.ProcessEnv;
|
|
71
71
|
cwd?: string;
|
|
72
72
|
}) => Promise<RunResult>;
|
|
73
|
+
/**
|
|
74
|
+
* A program's output as text: UTF-8, else (Windows programs write in the console code page) GBK, the code page of the Chinese
|
|
75
|
+
* Windows machines this runs on (echo-duck-pr's check showed cmd's GBK message as U+FFFD), else UTF-8 with replacements.
|
|
76
|
+
*/
|
|
77
|
+
export declare function decodeOutput(b: Buffer | string | undefined): string;
|
|
73
78
|
export declare const defaultRun: Run;
|
|
74
79
|
export declare function onPath(name: string, env: NodeJS.ProcessEnv): string | undefined;
|
|
75
80
|
export declare function pkgFor(distro: string[] | undefined): PkgManager | undefined;
|
|
@@ -87,6 +92,12 @@ export declare function sdkCodexBinary(platform?: NodeJS.Platform, arch?: string
|
|
|
87
92
|
export declare function codexOnPath(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string[] | undefined;
|
|
88
93
|
/** What a failed sandbox start said, as a problem. */
|
|
89
94
|
export declare function classify(stderr: string, host: Host): SandboxProblem;
|
|
95
|
+
/**
|
|
96
|
+
* The Windows probe as a node one-liner (exit codes as probeScript: 3 the work directory is not writable, 4 the outside write
|
|
97
|
+
* worked). Not `cmd /c` with a quoted path: Codex quotes each argument the MSVC way (\"), which cmd does not read, and the
|
|
98
|
+
* probe failed with cmd's "filename syntax is incorrect" (echo-duck-pr, 3.36.5). Paths go as plain arguments, no quotes inside.
|
|
99
|
+
*/
|
|
100
|
+
export declare const WIN_PROBE_SCRIPT: string;
|
|
90
101
|
export interface ProbeOptions {
|
|
91
102
|
env?: NodeJS.ProcessEnv;
|
|
92
103
|
platform?: NodeJS.Platform;
|
|
@@ -111,8 +122,11 @@ export declare function probeSandbox(tool: SandboxTool, o?: ProbeOptions): Promi
|
|
|
111
122
|
*/
|
|
112
123
|
export declare const NET_SCRIPT: string;
|
|
113
124
|
/**
|
|
114
|
-
*
|
|
115
|
-
* Exit 0
|
|
125
|
+
* How `ach` leaves a sandbox (netproxy.ts): through the proxy Codex starts there, CONNECT to `host:port`; with no proxy set, a
|
|
126
|
+
* direct connection (NET_SCRIPT). Exit 0 it got through, 5 the name does not resolve, 6 refused or failed, 7 a malformed proxy.
|
|
127
|
+
* No proxy is not itself a failure: on Windows `codex sandbox` starts none and runs the command as Codex's sandbox user with
|
|
128
|
+
* network (windows-check, 2026-11-13: no proxy variables, a direct connection worked), and `ach` then connects directly. On
|
|
129
|
+
* Linux a sandbox without the proxy has no network at all, so the direct connection fails and the verdict is the same as before.
|
|
116
130
|
*/
|
|
117
131
|
export declare const NET_PROXY_SCRIPT: string;
|
|
118
132
|
/** Lets the system bubblewrap (only that path) create user namespaces under Ubuntu's AppArmor rule; never machine-wide. */
|
package/dist/src/sandboxcheck.js
CHANGED
|
@@ -8,10 +8,29 @@ import { fileURLToPath } from 'node:url';
|
|
|
8
8
|
import { codexSandboxOverrides } from './adapters/codex.js';
|
|
9
9
|
import { linkWindowsSandbox, unlinkWindowsSandbox, WINDOWS_ELEVATED_CONFIG } from './codexhome.js';
|
|
10
10
|
import { toolchainReadRoots } from './adapters/paths.js';
|
|
11
|
+
/**
|
|
12
|
+
* A program's output as text: UTF-8, else (Windows programs write in the console code page) GBK, the code page of the Chinese
|
|
13
|
+
* Windows machines this runs on (echo-duck-pr's check showed cmd's GBK message as U+FFFD), else UTF-8 with replacements.
|
|
14
|
+
*/
|
|
15
|
+
export function decodeOutput(b) {
|
|
16
|
+
if (b == null)
|
|
17
|
+
return '';
|
|
18
|
+
if (typeof b === 'string')
|
|
19
|
+
return b;
|
|
20
|
+
try {
|
|
21
|
+
return new TextDecoder('utf-8', { fatal: true }).decode(b);
|
|
22
|
+
}
|
|
23
|
+
catch { }
|
|
24
|
+
try {
|
|
25
|
+
return new TextDecoder('gbk', { fatal: true }).decode(b);
|
|
26
|
+
}
|
|
27
|
+
catch { }
|
|
28
|
+
return b.toString('utf8');
|
|
29
|
+
}
|
|
11
30
|
export const defaultRun = (file, args, opts) => new Promise((res) => {
|
|
12
|
-
execFile(file, args, { env: opts.env, cwd: opts.cwd, timeout: 20_000, encoding: '
|
|
31
|
+
execFile(file, args, { env: opts.env, cwd: opts.cwd, timeout: 20_000, encoding: 'buffer', maxBuffer: 1 << 20 }, (err, stdout, stderr) => {
|
|
13
32
|
const code = err ? (typeof err.code === 'number' ? err.code : err.code === 'ENOENT' ? 127 : 1) : 0;
|
|
14
|
-
res({ code, stdout:
|
|
33
|
+
res({ code, stdout: decodeOutput(stdout), stderr: decodeOutput(stderr) || (err?.code === 'ENOENT' ? `${file}: not found` : '') });
|
|
15
34
|
});
|
|
16
35
|
});
|
|
17
36
|
export function onPath(name, env) {
|
|
@@ -156,6 +175,13 @@ function probeScript() {
|
|
|
156
175
|
return ('touch "$1/ok" || exit 3; w=0; if touch "$2" 2>/dev/null; then w=4; fi; if [ -n "$3" ] && cat "$3" >/dev/null 2>&1; then exit 7; fi; ' +
|
|
157
176
|
'if [ -n "$4" ] && ! "$4" -e 0 >/dev/null 2>&1; then exit 8; fi; if [ -n "$5" ] && ! "$5" --version >/dev/null 2>&1; then exit 9; fi; exit $w');
|
|
158
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* The Windows probe as a node one-liner (exit codes as probeScript: 3 the work directory is not writable, 4 the outside write
|
|
180
|
+
* worked). Not `cmd /c` with a quoted path: Codex quotes each argument the MSVC way (\"), which cmd does not read, and the
|
|
181
|
+
* probe failed with cmd's "filename syntax is incorrect" (echo-duck-pr, 3.36.5). Paths go as plain arguments, no quotes inside.
|
|
182
|
+
*/
|
|
183
|
+
export const WIN_PROBE_SCRIPT = "const[k,o]=process.argv.slice(1);const f=require('fs');try{f.writeFileSync(k,'')}catch{process.exit(3)}" +
|
|
184
|
+
"try{f.writeFileSync(o,'')}catch{process.exit(0)}process.exit(4)";
|
|
159
185
|
/** A Codex home like a worker run's (prepareCodexHome): the user's own config.toml is not read, so it cannot switch the profile off. */
|
|
160
186
|
function probeCodexHome(realCodexHome, platform) {
|
|
161
187
|
const d = mkdtempSync(join(tmpdir(), 'ach-sandbox-codex-'));
|
|
@@ -223,7 +249,7 @@ async function probe(tool, o) {
|
|
|
223
249
|
codex = o.codex ?? codexCommand(env);
|
|
224
250
|
if (!codex)
|
|
225
251
|
return { tool, ok: true, unverified: true, detail: 'Codex was not found' };
|
|
226
|
-
const cmd = platform === 'win32' ? [
|
|
252
|
+
const cmd = platform === 'win32' ? [process.execPath, '-e', WIN_PROBE_SCRIPT, join(dir, 'ok'), outside] : sh;
|
|
227
253
|
if (canary)
|
|
228
254
|
writeFileSync(canary, 'probe\n', { mode: 0o600 });
|
|
229
255
|
codexHome = probeCodexHome(o.codexHome, platform);
|
|
@@ -276,12 +302,16 @@ function codexProbeConfig(dir, home, hub, platform = process.platform) {
|
|
|
276
302
|
export const NET_SCRIPT = "const[h,p]=process.argv.slice(1);require('dns').lookup(h,(e)=>{if(e)process.exit(5);" +
|
|
277
303
|
"const s=require('net').connect(+p,h,()=>process.exit(0));s.on('error',()=>process.exit(6));setTimeout(()=>process.exit(6),8000)})";
|
|
278
304
|
/**
|
|
279
|
-
*
|
|
280
|
-
* Exit 0
|
|
305
|
+
* How `ach` leaves a sandbox (netproxy.ts): through the proxy Codex starts there, CONNECT to `host:port`; with no proxy set, a
|
|
306
|
+
* direct connection (NET_SCRIPT). Exit 0 it got through, 5 the name does not resolve, 6 refused or failed, 7 a malformed proxy.
|
|
307
|
+
* No proxy is not itself a failure: on Windows `codex sandbox` starts none and runs the command as Codex's sandbox user with
|
|
308
|
+
* network (windows-check, 2026-11-13: no proxy variables, a direct connection worked), and `ach` then connects directly. On
|
|
309
|
+
* Linux a sandbox without the proxy has no network at all, so the direct connection fails and the verdict is the same as before.
|
|
281
310
|
*/
|
|
282
|
-
export const NET_PROXY_SCRIPT = "const[h,p]=process.argv.slice(1);const e=process.env;const v=e.HTTPS_PROXY||e.https_proxy||e.ALL_PROXY||e.all_proxy;
|
|
311
|
+
export const NET_PROXY_SCRIPT = "const[h,p]=process.argv.slice(1);const e=process.env;const v=e.HTTPS_PROXY||e.https_proxy||e.ALL_PROXY||e.all_proxy;" +
|
|
312
|
+
"if(!v){require('dns').lookup(h,(x)=>{if(x)process.exit(5);const d=require('net').connect(+p,h,()=>process.exit(0));d.on('error',()=>process.exit(6));setTimeout(()=>process.exit(6),8000)})}else{" +
|
|
283
313
|
"let u;try{u=new URL(v)}catch{process.exit(7)}const s=require('net').connect(+u.port||80,u.hostname,()=>s.write('CONNECT '+h+':'+p+' HTTP/1.1\\r\\nHost: '+h+':'+p+'\\r\\n\\r\\n'));" +
|
|
284
|
-
"let b='';s.on('data',d=>{b+=d;if(b.includes('\\r\\n'))process.exit(/^HTTP\\/1\\.[01] 200/.test(b)?0:6)});s.on('error',()=>process.exit(6));setTimeout(()=>process.exit(6),8000)";
|
|
314
|
+
"let b='';s.on('data',d=>{b+=d;if(b.includes('\\r\\n'))process.exit(/^HTTP\\/1\\.[01] 200/.test(b)?0:6)});s.on('error',()=>process.exit(6));setTimeout(()=>process.exit(6),8000)}";
|
|
285
315
|
const PROXY_VARS = ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy', 'ALL_PROXY', 'all_proxy'];
|
|
286
316
|
/**
|
|
287
317
|
* Work runs reach the hub through Codex's network proxy (codexSandboxOverrides) because the agent reports through `ach`.
|
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.7",
|
|
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",
|