opencode-sandbox 0.1.16 → 0.1.17

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
@@ -1,3 +1,7 @@
1
+ [![CI](https://github.com/isanchez31/opencode-sandbox-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/isanchez31/opencode-sandbox-plugin/actions/workflows/ci.yml)
2
+ [![npm version](https://img.shields.io/npm/v/opencode-sandbox)](https://www.npmjs.com/package/opencode-sandbox)
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
1
5
  # opencode-sandbox
2
6
 
3
7
  An [OpenCode](https://opencode.ai) plugin that sandboxes agent-executed commands using [`@anthropic-ai/sandbox-runtime`](https://github.com/anthropic-experimental/sandbox-runtime).
package/dist/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
  import { SandboxManager } from "@anthropic-ai/sandbox-runtime";
3
3
 
4
4
  // src/config.ts
5
- import path from "path";
6
- import os from "os";
7
- import fs from "fs/promises";
5
+ import fs from "node:fs/promises";
6
+ import os from "node:os";
7
+ import path from "node:path";
8
8
  var DEFAULT_DENY_READ_DIRS = [
9
9
  ".ssh",
10
10
  ".gnupg",
@@ -69,7 +69,7 @@ function resolveConfig(projectDir, worktree, user) {
69
69
  };
70
70
  }
71
71
  async function loadConfig(projectDir) {
72
- const envConfig = process.env["OPENCODE_SANDBOX_CONFIG"];
72
+ const envConfig = process.env.OPENCODE_SANDBOX_CONFIG;
73
73
  if (envConfig) {
74
74
  try {
75
75
  return JSON.parse(envConfig);
@@ -92,7 +92,7 @@ var SandboxPlugin = async ({ directory, worktree }) => {
92
92
  console.warn("[opencode-sandbox] Not supported on Windows — sandbox disabled");
93
93
  return {};
94
94
  }
95
- if (process.env["OPENCODE_DISABLE_SANDBOX"] === "1" || process.env["OPENCODE_DISABLE_SANDBOX"] === "true") {
95
+ if (process.env.OPENCODE_DISABLE_SANDBOX === "1" || process.env.OPENCODE_DISABLE_SANDBOX === "true") {
96
96
  return {};
97
97
  }
98
98
  const userConfig = await loadConfig(directory);
@@ -125,7 +125,7 @@ var SandboxPlugin = async ({ directory, worktree }) => {
125
125
  console.warn("[opencode-sandbox] Failed to wrap command, running unsandboxed:", err instanceof Error ? err.message : err);
126
126
  }
127
127
  },
128
- "tool.execute.after": async (input, output) => {
128
+ "tool.execute.after": async (input, _output) => {
129
129
  if (input.tool !== "bash")
130
130
  return;
131
131
  if (lastOriginalCommand && input.args && typeof input.args.command === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-sandbox",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "OpenCode plugin that sandboxes agent commands using @anthropic-ai/sandbox-runtime (seatbelt on macOS, bubblewrap on Linux)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,6 +20,12 @@
20
20
  "build": "bun build ./src/index.ts --outdir dist --target node --format esm --external @anthropic-ai/sandbox-runtime --external @opencode-ai/plugin && bun x tsc --emitDeclarationOnly --declaration --outDir dist",
21
21
  "dev": "bun run --watch src/index.ts",
22
22
  "test": "bun test",
23
+ "test:coverage": "bun test --coverage",
24
+ "lint": "biome lint .",
25
+ "format": "biome format .",
26
+ "format:fix": "biome format --write .",
27
+ "check": "biome check .",
28
+ "check:fix": "biome check --write .",
23
29
  "prepublishOnly": "bun run build"
24
30
  },
25
31
  "keywords": [
@@ -54,6 +60,7 @@
54
60
  "@opencode-ai/plugin": ">=1.0.0"
55
61
  },
56
62
  "devDependencies": {
63
+ "@biomejs/biome": "^2.0.0",
57
64
  "@opencode-ai/plugin": "^1.2.1",
58
65
  "@opencode-ai/sdk": "^1.2.1",
59
66
  "@types/bun": "^1.3.9",