Skip to content

Commit 88363f1

Browse files
committed
fixed issue in opencode run
1 parent c5db39f commit 88363f1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • packages/opencode/src/cli/cmd

packages/opencode/src/cli/cmd/run.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { createOpencodeClient, type OpencodeClient, type ToolPart } from "@openc
2424
import { Agent } from "@/agent/agent"
2525
import { Permission } from "@/permission"
2626
import { RuntimeFlags } from "@/effect/runtime-flags"
27+
import { InstanceRef } from "@/effect/instance-ref"
2728
import { FormatError, FormatUnknownError } from "../error"
2829
import { INTERACTIVE_INPUT_ERROR, resolveInteractiveStdin } from "./run/runtime.stdin"
2930

@@ -236,6 +237,7 @@ export const RunCommand = effectCmd({
236237
handler: Effect.fn("Cli.run")(function* (args) {
237238
const agentSvc = yield* Agent.Service
238239
const flags = yield* RuntimeFlags.Service
240+
const localInstance = yield* InstanceRef
239241
yield* Effect.promise(async () => {
240242
const rawMessage = [...args.message, ...(args["--"] || [])].join(" ")
241243
const thinking = args.interactive ? (args.thinking ?? true) : (args.thinking ?? false)
@@ -508,7 +510,9 @@ export const RunCommand = effectCmd({
508510
if (!args.agent) return undefined
509511
const name = args.agent
510512

511-
const entry = await Effect.runPromise(agentSvc.get(name))
513+
const entry = await Effect.runPromise(
514+
agentSvc.get(name).pipe(Effect.provideService(InstanceRef, localInstance)),
515+
)
512516
if (!entry) {
513517
UI.println(
514518
UI.Style.TEXT_WARNING_BOLD + "!",

0 commit comments

Comments
 (0)