opencode-fs-plugin 3.0.0 → 3.1.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 +3 -1
- package/SPEC.md +4 -2
- package/package.json +1 -1
- package/src/index.ts +1 -5
- package/src/tools/pipe.ts +1 -0
package/README.md
CHANGED
|
@@ -89,7 +89,9 @@ Prefer the canonical names.
|
|
|
89
89
|
## Pipe
|
|
90
90
|
|
|
91
91
|
`fs.pipe` joins registered tools through byte buffers. Stages run in order;
|
|
92
|
-
only pipeable tools can be used.
|
|
92
|
+
only pipeable tools can be used. Each stage asserts its own `fs_<tool>` action
|
|
93
|
+
before it runs, so a disabled stage cannot be hidden inside a pipe. `output` and
|
|
94
|
+
`append` behave like a final
|
|
93
95
|
`tee`.
|
|
94
96
|
|
|
95
97
|
```js
|
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
|
|
117
|
+
- Captured stdout/stderr are capped at 1 MiB; truncation is reported.
|
|
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.
|
|
@@ -169,7 +169,9 @@ These are not implemented:
|
|
|
169
169
|
- `sort -k` accepts field/character ranges with modifiers `bdfghiMnrV`.
|
|
170
170
|
- `tar`/`zip` extraction rejects path traversal and escaping links.
|
|
171
171
|
- `pipe` passes raw bytes and only accepts registered pipeable stages; `tar` and
|
|
172
|
-
`zip` are sink stages.
|
|
172
|
+
`zip` are sink stages. Each stage asserts its own `fs_<tool>` action before it
|
|
173
|
+
runs, so per-tool denial also applies inside a pipe. It is sequential and not a
|
|
174
|
+
batch primitive: independent
|
|
173
175
|
calls fan out with `Promise.all` in `execute`.
|
|
174
176
|
|
|
175
177
|
## Coverage policy
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -190,7 +190,6 @@ export default Plugin.define({
|
|
|
190
190
|
id: "opencode-fs-plugin",
|
|
191
191
|
async setup(ctx) {
|
|
192
192
|
const rawRoot =
|
|
193
|
-
(typeof ctx.options?.root === "string" && ctx.options.root) ||
|
|
194
193
|
ctx.location?.project?.canonical ||
|
|
195
194
|
ctx.location?.directory ||
|
|
196
195
|
"";
|
|
@@ -204,10 +203,7 @@ export default Plugin.define({
|
|
|
204
203
|
);
|
|
205
204
|
const execAllowlist = normalizeExecAllowlist(ctx.options?.execAllowlist);
|
|
206
205
|
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;
|
|
206
|
+
const maxOutputBytes = DEFAULT_MAX_OUTPUT;
|
|
211
207
|
const jobs = new JobManager(
|
|
212
208
|
typeof ctx.options?.jobDir === "string" ? { dir: ctx.options.jobDir } : {},
|
|
213
209
|
);
|
package/src/tools/pipe.ts
CHANGED
|
@@ -91,6 +91,7 @@ export const pipeTool: ToolSpec<Input> = {
|
|
|
91
91
|
}
|
|
92
92
|
const parsed = parseSchema(tool.schema, stage.args ?? {}, `${stage.tool} arguments`);
|
|
93
93
|
const gate = ctx.permissionFor(`fs_${tool.name}`);
|
|
94
|
+
await gate.assertTrusted([]);
|
|
94
95
|
const result = await tool.run(
|
|
95
96
|
{ ...ctx, permission: gate },
|
|
96
97
|
parsed,
|