opencode-fs-plugin 2.0.0 → 3.0.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
@@ -284,18 +284,18 @@ Add the registry package directly to the plugin list:
284
284
 
285
285
  ```jsonc
286
286
  {
287
- "plugins": ["opencode-fs-plugin@2.0.0"]
287
+ "plugins": ["opencode-fs-plugin@3.0.0"]
288
288
  }
289
289
  ```
290
290
 
291
- `opencode plugin add opencode-fs-plugin@2.0.0` installs it and writes the config
291
+ `opencode plugin add opencode-fs-plugin@3.0.0` installs it and writes the config
292
292
  entry. A bare `opencode-fs-plugin` follows the `latest` tag.
293
293
 
294
294
  OpenCode manages the package under its cache, so the path is not stable. If you
295
295
  also want the packaged skill, install it into a project instead:
296
296
 
297
297
  ```bash
298
- npm install opencode-fs-plugin@2.0.0
298
+ npm install opencode-fs-plugin@3.0.0
299
299
  ```
300
300
 
301
301
  ```jsonc
@@ -310,7 +310,7 @@ npm install opencode-fs-plugin@2.0.0
310
310
  Download the release tarball, then install it as a normal npm package:
311
311
 
312
312
  ```bash
313
- VERSION=2.0.0
313
+ VERSION=3.0.0
314
314
  curl -L -o "opencode-fs-plugin-${VERSION}.tgz" \
315
315
  "https://github.com/masterjg/opencode-fs-plugin/releases/download/v${VERSION}/opencode-fs-plugin-${VERSION}.tgz"
316
316
  npm install "./opencode-fs-plugin-${VERSION}.tgz"
@@ -339,20 +339,20 @@ OpenCode installs it from Git:
339
339
 
340
340
  ```jsonc
341
341
  {
342
- "plugins": ["github:masterjg/opencode-fs-plugin#v2.0.0"]
342
+ "plugins": ["github:masterjg/opencode-fs-plugin#v3.0.0"]
343
343
  }
344
344
  ```
345
345
 
346
- `opencode plugin add 'github:masterjg/opencode-fs-plugin#v2.0.0'` installs the
346
+ `opencode plugin add 'github:masterjg/opencode-fs-plugin#v3.0.0'` installs the
347
347
  same spec and writes the config entry. The equivalent full URL is
348
- `git+https://github.com/masterjg/opencode-fs-plugin.git#v2.0.0`. A tag is
348
+ `git+https://github.com/masterjg/opencode-fs-plugin.git#v3.0.0`. A tag is
349
349
  checked for updates; use a full commit hash to pin it.
350
350
 
351
351
  Git plugins are installed under OpenCode's cache, so their package path is not
352
352
  stable. If you also want the packaged skill, install with npm instead:
353
353
 
354
354
  ```bash
355
- npm install "github:masterjg/opencode-fs-plugin#v2.0.0"
355
+ npm install "github:masterjg/opencode-fs-plugin#v3.0.0"
356
356
  ```
357
357
 
358
358
  Then use `./node_modules/opencode-fs-plugin` in `plugins` and
@@ -406,7 +406,8 @@ The skill ID is `filesystem`; `@filesystem` loads it explicitly.
406
406
  ## Permissions
407
407
 
408
408
  Every tool asserts an action named after the tool (`fs_cp`, `fs_rm`,
409
- `fs_pipe` stages, and so on). Internal paths use project-relative resources;
409
+ `fs_pipe` stages, and so on), except `fs.http_request`, which reuses the
410
+ built-in `webfetch` action. Internal paths use project-relative resources;
410
411
  external targets first require `external_directory` on the absolute boundary.
411
412
  `allow always` persists the same patterns as the built-in tools.
412
413
 
@@ -429,19 +430,19 @@ Keep both rules explicit. Plugin actions match OpenCode's base
429
430
  `fs_exec_network` or `external_directory` resource is allowed without a prompt,
430
431
  not asked.
431
432
 
432
- `fs.http_request` is allowed by default, like `fetch`. Its resource is the
433
- request host (`example.com:8443`), so requests can be restricted per host:
433
+ `fs.http_request` reuses the built-in `webfetch` permission, with the requested
434
+ URL as the resource, so one rule set covers both tools:
434
435
 
435
436
  ```jsonc
436
437
  {
437
438
  "permissions": [
438
- { "action": "fs_http_request", "resource": "api.github.com", "effect": "allow" },
439
- { "action": "fs_http_request", "resource": "*", "effect": "ask" }
439
+ { "action": "webfetch", "resource": "*", "effect": "deny" },
440
+ { "action": "webfetch", "resource": "https://api.github.com/*", "effect": "allow" }
440
441
  ]
441
442
  }
442
443
  ```
443
444
 
444
- Redirects re-assert the rule against each new host.
445
+ Redirects re-assert the rule against each new URL.
445
446
 
446
447
  Agent rules can use wildcards:
447
448
 
package/SPEC.md CHANGED
@@ -67,8 +67,9 @@ Aliases are accepted only where noted: `path` for one `paths` element (`stat`,
67
67
 
68
68
  - `fs.http_request` supports `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, and `HEAD`
69
69
  over `http:`/`https:` only; other schemes fail with `unsupported`.
70
- - Requests are allowed by default. The permission resource is the request host,
71
- and every redirect hop re-asserts `fs_http_request` for the new host.
70
+ - Requests are allowed by default. `fs.http_request` asserts the built-in
71
+ `webfetch` action with the requested URL as the resource; there is no separate
72
+ `fs_http_request` action. Every redirect hop re-asserts it for the new URL.
72
73
  - Redirects are followed manually: 301/302 rewrite `POST` to `GET`, 303 always
73
74
  does, and the hop count is bounded by `maxRedirects`.
74
75
  - `output` streams the response to a temporary file in the target directory and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-fs-plugin",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.12"
@@ -482,10 +482,9 @@ hidden inside a pipeline. Do not work around a denied tool with shell.
482
482
  `fs_exec_network` with the refused host (or `*` in `ip` mode), then retries.
483
483
  There are no per-call grants and no shell.
484
484
 
485
- `fs_http_request` is allowed by default, like `fetch`. Its resource is the
486
- request host; rules can allow one host and ask or deny the rest. Each redirect
487
- hop is checked against the new host. Nothing blocks localhost or private
488
- addresses by default.
485
+ `fs_http_request` reuses the built-in `webfetch` permission with the requested
486
+ URL as the resource, so one rule set covers both; each redirect hop is checked
487
+ against its URL. Nothing blocks localhost or private addresses by default.
489
488
 
490
489
  ## Errors and output
491
490
 
@@ -194,13 +194,13 @@ async function request(
194
194
  url: URL,
195
195
  options: RequestOptions,
196
196
  ): Promise<{ response: Response; finalUrl: string }> {
197
- const gate = ctx.permissionFor("fs_http_request");
197
+ const gate = ctx.permissionFor("webfetch");
198
198
  let current = url;
199
199
  let method = options.method;
200
200
  let body = options.body;
201
201
 
202
202
  for (let redirects = 0; ; redirects++) {
203
- await gate.assertTrusted([current.host]);
203
+ await gate.assertTrusted([current.toString()]);
204
204
  const response = await fetch(current, {
205
205
  method,
206
206
  headers: options.headers,