opencode-fs-plugin 3.1.0 → 3.2.0
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/README.md +1 -1
- package/SPEC.md +1 -1
- package/package.json +1 -1
- package/skills/filesystem/SKILL.md +1 -1
- package/src/core/format.ts +4 -7
- package/src/core/types.ts +0 -1
- package/src/index.ts +1 -5
- package/src/tools/exec.ts +2 -17
package/README.md
CHANGED
|
@@ -195,7 +195,7 @@ await tools.fs.pipe({
|
|
|
195
195
|
})
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
The command asserts `fs_exec`,
|
|
198
|
+
The command asserts `fs_exec`, returns stdout/stderr in full, and treats a non-zero exit as
|
|
199
199
|
a normal result. Procage requires Linux x64/arm64, glibc 2.28+, and Node 22.12+.
|
|
200
200
|
On kernels before Landlock ABI 6, signal isolation relaxes to same-user. The
|
|
201
201
|
trust-handoff class is waived so package tools can update workspace files such as
|
package/SPEC.md
CHANGED
|
@@ -114,7 +114,7 @@ Aliases are accepted only where noted: `path` for one `paths` element (`stat`,
|
|
|
114
114
|
- Timeout defaults to 120000 ms, capped at 600000. Procage ends the run and kills
|
|
115
115
|
every process it started, including detached descendants; `timedOut: true`
|
|
116
116
|
and exit code 124 are returned.
|
|
117
|
-
- Captured stdout/stderr are
|
|
117
|
+
- Captured stdout/stderr are returned in full; the host's `tool_output` setting bounds what the model sees.
|
|
118
118
|
- Direct calls return JSON with `exitCode`, `stdout`, `stderr`, `violations`, and
|
|
119
119
|
the sandbox decision. In `fs.pipe`, the stage returns raw stdout and composes as
|
|
120
120
|
a source or filter.
|
package/package.json
CHANGED
|
@@ -188,7 +188,7 @@ await tools.fs.pipe({
|
|
|
188
188
|
|
|
189
189
|
A non-zero exit is a normal result; allowlist rejection, timeout, and abort are
|
|
190
190
|
handled explicitly. Procage kills every process the run started, including
|
|
191
|
-
detached descendants, and
|
|
191
|
+
detached descendants, and returns captured stdout/stderr in full. It requires Linux
|
|
192
192
|
x64/arm64, glibc 2.28+, and Node 22.12+.
|
|
193
193
|
|
|
194
194
|
## Batch independent calls
|
package/src/core/format.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function isBinary(buffer: Buffer): boolean {
|
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function renderResult(result: ToolResult
|
|
24
|
+
export function renderResult(result: ToolResult): RenderedResult {
|
|
25
25
|
const exitCode = result.exitCode ?? 0;
|
|
26
26
|
const metadata: Record<string, unknown> = {
|
|
27
27
|
...result.metadata,
|
|
@@ -34,17 +34,14 @@ export function renderResult(result: ToolResult, maxOutputBytes: number): Render
|
|
|
34
34
|
return { content: "", metadata };
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const slice = result.stdout.subarray(0, maxOutputBytes);
|
|
38
|
-
const truncated = result.stdout.length > maxOutputBytes;
|
|
39
|
-
if (truncated) metadata.truncated = true;
|
|
40
37
|
metadata.bytes = result.stdout.length;
|
|
41
38
|
|
|
42
|
-
if (isBinary(
|
|
39
|
+
if (isBinary(result.stdout)) {
|
|
43
40
|
metadata.encoding = "base64";
|
|
44
|
-
return { content:
|
|
41
|
+
return { content: result.stdout.toString("base64"), metadata };
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
let content =
|
|
44
|
+
let content = result.stdout.toString("utf8");
|
|
48
45
|
if (result.stderr) content += `${content.endsWith("\n") ? "" : "\n"}[stderr]\n${result.stderr}`;
|
|
49
46
|
return { content, metadata };
|
|
50
47
|
}
|
package/src/core/types.ts
CHANGED
|
@@ -30,7 +30,6 @@ export interface RunContext {
|
|
|
30
30
|
readonly concurrency: number;
|
|
31
31
|
readonly signal: AbortSignal;
|
|
32
32
|
readonly tmpdir: string;
|
|
33
|
-
readonly maxOutputBytes: number;
|
|
34
33
|
readonly execAllowlist: readonly string[];
|
|
35
34
|
/** `proxy` forces egress through the run's allowlist proxy; `ip` is all-IP. */
|
|
36
35
|
readonly execNetworkMode: "proxy" | "ip";
|
package/src/index.ts
CHANGED
|
@@ -150,8 +150,6 @@ const TOOLS: readonly AnyTool[] = [
|
|
|
150
150
|
pipeTool,
|
|
151
151
|
];
|
|
152
152
|
|
|
153
|
-
const DEFAULT_MAX_OUTPUT = 1024 * 1024;
|
|
154
|
-
|
|
155
153
|
function withBackground(schema: TSchema): TSchema {
|
|
156
154
|
return Type.Composite(
|
|
157
155
|
[
|
|
@@ -203,7 +201,6 @@ export default Plugin.define({
|
|
|
203
201
|
);
|
|
204
202
|
const execAllowlist = normalizeExecAllowlist(ctx.options?.execAllowlist);
|
|
205
203
|
const execNetworkMode = normalizeExecNetworkMode(ctx.options?.execNetworkMode);
|
|
206
|
-
const maxOutputBytes = DEFAULT_MAX_OUTPUT;
|
|
207
204
|
const jobs = new JobManager(
|
|
208
205
|
typeof ctx.options?.jobDir === "string" ? { dir: ctx.options.jobDir } : {},
|
|
209
206
|
);
|
|
@@ -251,14 +248,13 @@ export default Plugin.define({
|
|
|
251
248
|
concurrency,
|
|
252
249
|
signal,
|
|
253
250
|
tmpdir: os.tmpdir(),
|
|
254
|
-
maxOutputBytes,
|
|
255
251
|
execAllowlist,
|
|
256
252
|
execNetworkMode,
|
|
257
253
|
},
|
|
258
254
|
parsed,
|
|
259
255
|
{},
|
|
260
256
|
);
|
|
261
|
-
return renderResult(result
|
|
257
|
+
return renderResult(result);
|
|
262
258
|
};
|
|
263
259
|
|
|
264
260
|
if ((parsed as { background?: unknown }).background === true) {
|
package/src/tools/exec.ts
CHANGED
|
@@ -136,8 +136,6 @@ export interface ExecOutcome {
|
|
|
136
136
|
signal: string | null;
|
|
137
137
|
timedOut: boolean;
|
|
138
138
|
aborted: boolean;
|
|
139
|
-
stdoutTruncated: boolean;
|
|
140
|
-
stderrTruncated: boolean;
|
|
141
139
|
/** The mode the sandbox actually ran: proxy may fall back to ip. */
|
|
142
140
|
networkMode: ExecNetworkMode;
|
|
143
141
|
violations: Violation[];
|
|
@@ -242,8 +240,6 @@ export const execTool: ToolSpec<Input> = {
|
|
|
242
240
|
signal: outcome.signal,
|
|
243
241
|
timedOut: outcome.timedOut,
|
|
244
242
|
aborted: outcome.aborted,
|
|
245
|
-
stdoutTruncated: outcome.stdoutTruncated,
|
|
246
|
-
stderrTruncated: outcome.stderrTruncated,
|
|
247
243
|
sandboxBlocked: isSandboxBlocked(outcome),
|
|
248
244
|
violations: outcome.violations.length,
|
|
249
245
|
network: networkMode === "proxy" || ipNetwork,
|
|
@@ -372,17 +368,13 @@ async function runCaged(ctx: RunContext, input: CagedInput): Promise<ExecOutcome
|
|
|
372
368
|
try {
|
|
373
369
|
const out = await child.output({ timeout: input.timeoutMs, ...(input.input === undefined ? {} : { input: input.input }) });
|
|
374
370
|
const violations = filterViolations(await child.violations());
|
|
375
|
-
const stdout = cap(out.stdout, ctx.maxOutputBytes);
|
|
376
|
-
const stderr = cap(out.stderr, ctx.maxOutputBytes);
|
|
377
371
|
return {
|
|
378
|
-
stdout: stdout
|
|
379
|
-
stderr: stderr
|
|
372
|
+
stdout: out.stdout,
|
|
373
|
+
stderr: out.stderr,
|
|
380
374
|
exitCode: out.timedOut ? 124 : aborted ? 130 : (out.exitCode ?? 1),
|
|
381
375
|
signal: out.signal,
|
|
382
376
|
timedOut: out.timedOut,
|
|
383
377
|
aborted,
|
|
384
|
-
stdoutTruncated: stdout.truncated,
|
|
385
|
-
stderrTruncated: stderr.truncated,
|
|
386
378
|
networkMode: input.networkMode,
|
|
387
379
|
violations,
|
|
388
380
|
};
|
|
@@ -396,8 +388,6 @@ async function runCaged(ctx: RunContext, input: CagedInput): Promise<ExecOutcome
|
|
|
396
388
|
signal: null,
|
|
397
389
|
timedOut: false,
|
|
398
390
|
aborted: true,
|
|
399
|
-
stdoutTruncated: false,
|
|
400
|
-
stderrTruncated: false,
|
|
401
391
|
networkMode: input.networkMode,
|
|
402
392
|
violations: [],
|
|
403
393
|
};
|
|
@@ -491,8 +481,3 @@ async function resolveExecutable(command: string): Promise<{ path: string; real:
|
|
|
491
481
|
}
|
|
492
482
|
throw new FsError(`exec command not found: "${command}"`, "not-found");
|
|
493
483
|
}
|
|
494
|
-
|
|
495
|
-
function cap(data: Buffer, limit: number): { data: Buffer; truncated: boolean } {
|
|
496
|
-
if (data.length <= limit) return { data, truncated: false };
|
|
497
|
-
return { data: data.subarray(0, limit), truncated: true };
|
|
498
|
-
}
|