opencode-fs-plugin 3.0.1 → 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 CHANGED
@@ -195,7 +195,7 @@ await tools.fs.pipe({
195
195
  })
196
196
  ```
197
197
 
198
- The command asserts `fs_exec`, caps stdout/stderr, and treats a non-zero exit as
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 capped at `maxOutputBytes`; truncation is reported.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-fs-plugin",
3
- "version": "3.0.1",
3
+ "version": "3.2.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.12"
@@ -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 caps captured stdout/stderr. It requires Linux
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
@@ -21,7 +21,7 @@ export function isBinary(buffer: Buffer): boolean {
21
21
  return false;
22
22
  }
23
23
 
24
- export function renderResult(result: ToolResult, maxOutputBytes: number): RenderedResult {
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(slice)) {
39
+ if (isBinary(result.stdout)) {
43
40
  metadata.encoding = "base64";
44
- return { content: slice.toString("base64"), metadata };
41
+ return { content: result.stdout.toString("base64"), metadata };
45
42
  }
46
43
 
47
- let content = slice.toString("utf8");
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
  [
@@ -190,7 +188,6 @@ export default Plugin.define({
190
188
  id: "opencode-fs-plugin",
191
189
  async setup(ctx) {
192
190
  const rawRoot =
193
- (typeof ctx.options?.root === "string" && ctx.options.root) ||
194
191
  ctx.location?.project?.canonical ||
195
192
  ctx.location?.directory ||
196
193
  "";
@@ -204,10 +201,6 @@ export default Plugin.define({
204
201
  );
205
202
  const execAllowlist = normalizeExecAllowlist(ctx.options?.execAllowlist);
206
203
  const execNetworkMode = normalizeExecNetworkMode(ctx.options?.execNetworkMode);
207
- const maxOutputBytes =
208
- typeof ctx.options?.maxOutputBytes === "number" && ctx.options.maxOutputBytes > 0
209
- ? Math.trunc(ctx.options.maxOutputBytes)
210
- : DEFAULT_MAX_OUTPUT;
211
204
  const jobs = new JobManager(
212
205
  typeof ctx.options?.jobDir === "string" ? { dir: ctx.options.jobDir } : {},
213
206
  );
@@ -255,14 +248,13 @@ export default Plugin.define({
255
248
  concurrency,
256
249
  signal,
257
250
  tmpdir: os.tmpdir(),
258
- maxOutputBytes,
259
251
  execAllowlist,
260
252
  execNetworkMode,
261
253
  },
262
254
  parsed,
263
255
  {},
264
256
  );
265
- return renderResult(result, maxOutputBytes);
257
+ return renderResult(result);
266
258
  };
267
259
 
268
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.data,
379
- stderr: stderr.data,
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
- }