GeezerVison is showing github.com — refactor(core): finish moving shell permission checks off tree-sitter… · anomalyco/opencode@8609cc5
File treeExpand file treeCollapse file tree Open diff view settings services/www/src/docs/content
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bun.lock -13Lines changed: 0 additions & 13 deletions Collapse file Copy file name to clipboardExpand all lines: packages/cli/package.json -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 49 | 49 | "jsonc-parser": "3.3.1", | 50 | 50 | "picocolors": "1.1.1", | 51 | 51 | "solid-js": "catalog:", | 52 | | - "tree-sitter-bash": "0.25.0", | 53 | | - "tree-sitter-powershell": "0.25.10", | 54 | 52 | "web-tree-sitter": "0.25.10", | 55 | 53 | "ws": "8.21.0" | 56 | 54 | }, | |
Collapse file Copy file name to clipboardExpand all lines: packages/cli/script/node-assets.ts +1-5Lines changed: 1 addition & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ import { copyFile, mkdir, readFile, stat } from "node:fs/promises" | 3 | 3 | import path from "node:path" | 4 | 4 | import { fileURLToPath } from "node:url" | 5 | 5 | import { getNodeAssets } from "@opentui/core/node-assets" | 6 | | -import { attentionSoundAssets, type NodeTarget, photonWasmAsset, shellParserWasmAssets } from "../src/node/target" | | 6 | +import { attentionSoundAssets, type NodeTarget, photonWasmAsset } from "../src/node/target" | 7 | 7 | import { collectFiles } from "./files" | 8 | 8 | import { resolveOpencodePty } from "./opencode-pty" | 9 | 9 |
| @@ -39,10 +39,6 @@ export async function collectNodeAssets(target: NodeTarget) { | 39 | 39 | key: photonWasmAsset, | 40 | 40 | source: fileURLToPath(import.meta.resolve(photonWasmAsset)), | 41 | 41 | }, | 42 | | - ...Object.values(shellParserWasmAssets).map((key) => ({ | 43 | | - key, | 44 | | - source: fileURLToPath(import.meta.resolve(key)), | 45 | | - })), | 46 | 42 | ...attentionSoundAssets.map((key) => ({ | 47 | 43 | key, | 48 | 44 | source: path.resolve(dir, "../ui/src/assets/audio", path.basename(key)), | |
Collapse file Copy file name to clipboardExpand all lines: packages/cli/src/node/target.ts -5Lines changed: 0 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -31,11 +31,6 @@ export function nodeTarget(platform: string, arch: string) { | 31 | 31 | } | 32 | 32 |
| 33 | 33 | export const photonWasmAsset = "@silvia-odwyer/photon-node/photon_rs_bg.wasm" | 34 | | -export const shellParserWasmAssets = { | 35 | | - runtime: "web-tree-sitter/tree-sitter.wasm", | 36 | | - bash: "tree-sitter-bash/tree-sitter-bash.wasm", | 37 | | - powershell: "tree-sitter-powershell/tree-sitter-powershell.wasm", | 38 | | -} as const | 39 | 34 | export const nodeExecArgv = ["--experimental-ffi", "--use-system-ca", "--disable-warning=ExperimentalWarning"] as const | 40 | 35 |
| 41 | 36 | export const attentionSoundAssets = [ | |
Collapse file Copy file name to clipboard +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { expect, test } from "bun:test" | 2 | 2 | import { fileURLToPath } from "node:url" | 3 | 3 | import { collectNodeAssets } from "../script/node-assets" | 4 | | -import { nodeTarget, shellParserWasmAssets } from "../src/node/target" | | 4 | +import { nodeTarget, photonWasmAsset } from "../src/node/target" | 5 | 5 |
| 6 | 6 | test("collects each SEA asset key once", async () => { | 7 | 7 | const assets = await collectNodeAssets(nodeTarget(process.platform, process.arch)) | 8 | 8 | const keys = assets.map((asset) => asset.key) | 9 | 9 |
| 10 | 10 | expect(new Set(keys).size).toBe(keys.length) | 11 | 11 | expect(keys.filter((key) => key === nodeTarget(process.platform, process.arch).opencodePtyAsset)).toHaveLength(1) | 12 | | - expect(assets.filter((asset) => asset.key === shellParserWasmAssets.runtime)).toEqual([ | | 12 | + expect(assets.filter((asset) => asset.key === photonWasmAsset)).toEqual([ | 13 | 13 | { | 14 | | - key: shellParserWasmAssets.runtime, | 15 | | - source: fileURLToPath(import.meta.resolve(shellParserWasmAssets.runtime)), | | 14 | + key: photonWasmAsset, | | 15 | + source: fileURLToPath(import.meta.resolve(photonWasmAsset)), | 16 | 16 | }, | 17 | 17 | ]) | 18 | 18 | }) |
Collapse file Copy file name to clipboardExpand all lines: packages/cli/vite.node.config.ts +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ import { readFile } from "node:fs/promises" | 3 | 3 | import { createRequire } from "node:module" | 4 | 4 | import { defineConfig, type Plugin, type UserConfig } from "vite" | 5 | 5 | import solid from "vite-plugin-solid" | 6 | | -import { nodeExecArgv, nodeTarget, type NodeTarget, photonWasmAsset, shellParserWasmAssets } from "./src/node/target" | | 6 | +import { nodeExecArgv, nodeTarget, type NodeTarget, photonWasmAsset } from "./src/node/target" | 7 | 7 | import { verifySimulationGraph } from "./script/verify-artifact" | 8 | 8 |
| 9 | 9 | const dir = import.meta.dirname | @@ -237,9 +237,6 @@ process.env.OTUI_ASSET_ROOT = __ocAssetRoot | 237 | 237 | process.env.OPENCODE_NODE_PTY_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(input.target.nodePtyEntryAsset)}) | 238 | 238 | process.env.OPENCODE_PARCEL_WATCHER_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(input.target.parcelWatcherAsset)}) | 239 | 239 | process.env.OPENCODE_PHOTON_WASM_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(photonWasmAsset)}) | 240 | | -process.env.OPENCODE_TREE_SITTER_WASM_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(shellParserWasmAssets.runtime)}) | 241 | | -process.env.OPENCODE_TREE_SITTER_BASH_WASM_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(shellParserWasmAssets.bash)}) | 242 | | -process.env.OPENCODE_TREE_SITTER_POWERSHELL_WASM_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(shellParserWasmAssets.powershell)}) | 243 | 240 | process.env.FFF_BINARY_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(input.target.fffAsset)}) | 244 | 241 | process.env.OPENCODE_FFF_FFI_PATH = __ocPath.join(__ocAssetRoot, ${JSON.stringify(input.target.fffFfiAsset)}) | 245 | 242 | if (__ocPersistentPty && !process.env.OPENCODE_PTY_BIN) process.env.OPENCODE_PTY_BIN = __ocPath.join(__ocAssetRoot, __ocPersistentPty) | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/package.json -9Lines changed: 0 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 62 | 62 | "node": "./src/image/photon-wasm.node.ts", | 63 | 63 | "default": "./src/image/photon-wasm.bun.ts" | 64 | 64 | }, | 65 | | - "#shell-parser-wasm": { | 66 | | - "workerd": "./src/shell/parser-wasm.workerd.ts", | 67 | | - "bun": "./src/shell/parser-wasm.bun.ts", | 68 | | - "node": "./src/shell/parser-wasm.node.ts", | 69 | | - "default": "./src/shell/parser-wasm.bun.ts" | 70 | | - }, | 71 | 65 | "#v1-migration": { | 72 | 66 | "types": "./src/database/v1-migration.bun.ts", | 73 | 67 | "bun": "./src/database/v1-migration.bun.ts", | | 129 | 123 | "jose": "6.0.11", | 130 | 124 | "jsonc-parser": "3.3.1", | 131 | 125 | "mime-types": "3.0.2", | 132 | | - "tree-sitter-bash": "0.25.0", | 133 | | - "tree-sitter-powershell": "0.25.10", | 134 | | - "web-tree-sitter": "0.25.10", | 135 | 126 | "which": "6.0.1", | 136 | 127 | "zod": "catalog:" | 137 | 128 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/script/build.ts -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,7 +26,6 @@ const result = await Bun.build({ | 26 | 26 | "#persistent-pty-binary", | 27 | 27 | "#fff", | 28 | 28 | "#photon-wasm", | 29 | | - "#shell-parser-wasm", | 30 | 29 | "#v1-migration", | 31 | 30 | ], | 32 | 31 | splitting: true, | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/plugin/provider/local.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import { define } from "@opencode/plugin/effect/plugin" | 2 | 2 | import type { Entry } from "@opencode/schema/config" | 3 | 3 | import { Duration, Effect, Option, Schedule, type Schema, Semaphore, Stream } from "effect" | 4 | 4 | import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http" | 5 | | -import { shellParserWasm } from "#shell-parser-wasm" | | 5 | +import photonWasm from "#photon-wasm" | 6 | 6 | import { Config } from "../../config.js" | 7 | 7 | import { Environment } from "../../environment/index.js" | 8 | 8 | import { EnvironmentUnavailable } from "../../environment/unavailable.js" | @@ -45,7 +45,7 @@ export function createLocalProviderPlugin<Discovered>(input: { | 45 | 45 | const location = yield* Effect.serviceOption(Location.Service) | 46 | 46 | const defaultOrigin = | 47 | 47 | origin ?? | 48 | | - (shellParserWasm.bash === "" || | | 48 | + (photonWasm === "" || | 49 | 49 | (Option.isSome(location) && location.value.workspaceID !== undefined) || | 50 | 50 | (Option.isSome(environment) && environment.value.spawner === EnvironmentUnavailable.spawner) | 51 | 51 | ? undefined | |
|