chore: generate

This commit is contained in:
opencode-agent[bot]
2026-04-10 17:27:31 +00:00
parent f7514d9eca
commit 59d08683ea
2 changed files with 36 additions and 35 deletions
+13 -10
View File
@@ -182,7 +182,6 @@ function prefix(text: string) {
return text.slice(0, match.index) return text.slice(0, match.index)
} }
function pathArgs(list: Part[], ps: boolean) { function pathArgs(list: Part[], ps: boolean) {
if (!ps) { if (!ps) {
return list return list
@@ -210,7 +209,6 @@ function pathArgs(list: Part[], ps: boolean) {
return out return out
} }
function preview(text: string) { function preview(text: string) {
if (text.length <= MAX_METADATA_LENGTH) return text if (text.length <= MAX_METADATA_LENGTH) return text
return text.slice(0, MAX_METADATA_LENGTH) + "\n\n..." return text.slice(0, MAX_METADATA_LENGTH) + "\n\n..."
@@ -249,7 +247,6 @@ const ask = Effect.fn("BashTool.ask")(function* (ctx: Tool.Context, scan: Scan)
) )
}) })
function cmd(shell: string, name: string, command: string, cwd: string, env: NodeJS.ProcessEnv) { function cmd(shell: string, name: string, command: string, cwd: string, env: NodeJS.ProcessEnv) {
if (process.platform === "win32" && PS.has(name)) { if (process.platform === "win32" && PS.has(name)) {
return ChildProcess.make(shell, ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", command], { return ChildProcess.make(shell, ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", command], {
@@ -269,7 +266,6 @@ function cmd(shell: string, name: string, command: string, cwd: string, env: Nod
}) })
} }
const parser = lazy(async () => { const parser = lazy(async () => {
const { Parser } = await import("web-tree-sitter") const { Parser } = await import("web-tree-sitter")
const { default: treeWasm } = await import("web-tree-sitter/tree-sitter.wasm" as string, { const { default: treeWasm } = await import("web-tree-sitter/tree-sitter.wasm" as string, {
@@ -306,9 +302,9 @@ export const BashTool = Tool.defineEffect(
const plugin = yield* Plugin.Service const plugin = yield* Plugin.Service
const cygpath = Effect.fn("BashTool.cygpath")(function* (shell: string, text: string) { const cygpath = Effect.fn("BashTool.cygpath")(function* (shell: string, text: string) {
const lines = yield* spawner.lines( const lines = yield* spawner
ChildProcess.make(shell, ["-lc", 'cygpath -w -- "$1"', "_", text]), .lines(ChildProcess.make(shell, ["-lc", 'cygpath -w -- "$1"', "_", text]))
).pipe(Effect.catch(() => Effect.succeed([] as string[]))) .pipe(Effect.catch(() => Effect.succeed([] as string[])))
const file = lines[0]?.trim() const file = lines[0]?.trim()
if (!file) return if (!file) return
return AppFileSystem.normalizePath(file) return AppFileSystem.normalizePath(file)
@@ -366,7 +362,11 @@ export const BashTool = Tool.defineEffect(
}) })
const shellEnv = Effect.fn("BashTool.shellEnv")(function* (ctx: Tool.Context, cwd: string) { const shellEnv = Effect.fn("BashTool.shellEnv")(function* (ctx: Tool.Context, cwd: string) {
const extra = yield* plugin.trigger("shell.env", { cwd, sessionID: ctx.sessionID, callID: ctx.callID }, { env: {} }) const extra = yield* plugin.trigger(
"shell.env",
{ cwd, sessionID: ctx.sessionID, callID: ctx.callID },
{ env: {} },
)
return { return {
...process.env, ...process.env,
...extra.env, ...extra.env,
@@ -492,7 +492,8 @@ export const BashTool = Tool.defineEffect(
if (!Instance.containsPath(cwd)) scan.dirs.add(cwd) if (!Instance.containsPath(cwd)) scan.dirs.add(cwd)
yield* ask(ctx, scan) yield* ask(ctx, scan)
return yield* run({ return yield* run(
{
shell, shell,
name, name,
command: params.command, command: params.command,
@@ -500,7 +501,9 @@ export const BashTool = Tool.defineEffect(
env: yield* shellEnv(ctx, cwd), env: yield* shellEnv(ctx, cwd),
timeout, timeout,
description: params.description, description: params.description,
}, ctx) },
ctx,
)
}).pipe(Effect.orDie, Effect.runPromise), }).pipe(Effect.orDie, Effect.runPromise),
} }
} }
+1 -3
View File
@@ -19,9 +19,7 @@ const runtime = ManagedRuntime.make(
) )
function initBash() { function initBash() {
return runtime.runPromise( return runtime.runPromise(BashTool.pipe(Effect.flatMap((info) => Effect.promise(() => info.init()))))
BashTool.pipe(Effect.flatMap((info) => Effect.promise(() => info.init()))),
)
} }
const ctx = { const ctx = {