GeezerVison is showing github.com — feat(codemode): add confined execution package (#35079) · argszero/opencode@2409c7a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bun.lock +61-15Lines changed: 61 additions & 15 deletions Collapse file Copy file name to clipboardExpand all lines: package.json +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 99 | 99 | "@typescript/native-preview": "catalog:", | 100 | 100 | "glob": "13.0.5", | 101 | 101 | "husky": "9.1.7", | | 102 | + "node-gyp": "12.4.0", | 102 | 103 | "oxlint": "1.60.0", | 103 | 104 | "oxlint-tsgolint": "0.21.0", | 104 | 105 | "prettier": "3.6.2", | |
Collapse file Copy file name to clipboard +15Lines changed: 15 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# @opencode-ai/codemode | | 2 | + | | 3 | +- This local package owns confined execution over explicit schema-described tools. Applications own authorization, persistence, external authority, and tool-specific delivery semantics. | | 4 | +- Do not add a speculative generic permission or approval policy. A host omits tools it does not expose and enforces domain authorization inside each provided tool. | | 5 | +- Keep Code Mode unaware of host session, channel, and conversation models. The hosting application supplies trusted execution scope around it. | | 6 | +- Tool schemas are the model-facing Interface. Keep arguments minimal and natural to the operation; never add unrelated IDs as ambient capability tokens. | | 7 | + | | 8 | +## Future Design Notes | | 9 | + | | 10 | +- If a captured user-visible output channel returns (an earlier `output.text`/`output.file`/`output.image` API was removed from v1), keep `output` as its name, distinct from the program return value: `return` stays the structured result for the model, while `output.*` describes artifacts the host may render into a conversation or UI after execution. Keep this host-neutral and let applications decide how captured output is delivered. In v1, hosts collect media host-side (outside the sandbox) instead. | | 11 | +- Improve the sandbox failure taxonomy. Distinguish parse/compile mistakes, unsupported syntax, user-thrown errors, invalid returned data, tool refusal, tool internal failure, timeout, and genuine runtime defects so agents can recover accurately instead of treating everything as a generic execution failure. | | 12 | +- Preserve the public/private error split. Tool authors should be able to return a safe model-visible message while retaining a private cause for host diagnostics. Unknown host failures must remain sanitized by default. | | 13 | +- Think deliberately about richer binary boundaries before allowing `Blob`, `File`, `ArrayBuffer`, streams, or typed arrays beyond today's JSON-like values. If CodeMode supports binary tool args/results, use explicit tagged data shapes and clear size limits rather than relying on ambient runtime serialization. | | 14 | +- Keep host capabilities explicit. Globals such as `fetch`, `crypto`, filesystem handles, extra modules, or network clients should be opt-in runtime capabilities with obvious policy defaults, not ambient authority. Default to unavailable unless a host deliberately provides the capability. | | 15 | +- If `fetch` is added, model it as a host-provided outbound capability with policy controls: allowed origins, methods, headers, response size, timeout, and whether response bodies may be returned, emitted, or only summarized through a tool. |
Collapse file Copy file name to clipboardExpand all lines: packages/codemode/README.md +337Lines changed: 337 additions & 0 deletions - Display the source diff
- Display the rich diff
Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: packages/codemode/codemode.md +1,188Lines changed: 1188 additions & 0 deletions - Display the source diff
- Display the rich diff
Large diffs are not rendered by default. Collapse file Copy file name to clipboard +26Lines changed: 26 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "$schema": "https://json.schemastore.org/package.json", | | 3 | + "name": "@opencode-ai/codemode", | | 4 | + "version": "0.0.1", | | 5 | + "description": "Effect-native confined code execution over schema-described tools", | | 6 | + "private": true, | | 7 | + "type": "module", | | 8 | + "license": "MIT", | | 9 | + "exports": { | | 10 | + ".": "./src/index.ts" | | 11 | + }, | | 12 | + "scripts": { | | 13 | + "typecheck": "tsgo --noEmit", | | 14 | + "test": "bun test" | | 15 | + }, | | 16 | + "dependencies": { | | 17 | + "acorn": "8.15.0", | | 18 | + "effect": "catalog:", | | 19 | + "typescript": "catalog:" | | 20 | + }, | | 21 | + "devDependencies": { | | 22 | + "@tsconfig/bun": "catalog:", | | 23 | + "@types/bun": "catalog:", | | 24 | + "@typescript/native-preview": "catalog:" | | 25 | + } | | 26 | +} |
|