fixed issue in opencode run
This commit is contained in:
@@ -24,6 +24,7 @@ import { createOpencodeClient, type OpencodeClient, type ToolPart } from "@openc
|
|||||||
import { Agent } from "@/agent/agent"
|
import { Agent } from "@/agent/agent"
|
||||||
import { Permission } from "@/permission"
|
import { Permission } from "@/permission"
|
||||||
import { RuntimeFlags } from "@/effect/runtime-flags"
|
import { RuntimeFlags } from "@/effect/runtime-flags"
|
||||||
|
import { InstanceRef } from "@/effect/instance-ref"
|
||||||
import { FormatError, FormatUnknownError } from "../error"
|
import { FormatError, FormatUnknownError } from "../error"
|
||||||
import { INTERACTIVE_INPUT_ERROR, resolveInteractiveStdin } from "./run/runtime.stdin"
|
import { INTERACTIVE_INPUT_ERROR, resolveInteractiveStdin } from "./run/runtime.stdin"
|
||||||
|
|
||||||
@@ -236,6 +237,7 @@ export const RunCommand = effectCmd({
|
|||||||
handler: Effect.fn("Cli.run")(function* (args) {
|
handler: Effect.fn("Cli.run")(function* (args) {
|
||||||
const agentSvc = yield* Agent.Service
|
const agentSvc = yield* Agent.Service
|
||||||
const flags = yield* RuntimeFlags.Service
|
const flags = yield* RuntimeFlags.Service
|
||||||
|
const localInstance = yield* InstanceRef
|
||||||
yield* Effect.promise(async () => {
|
yield* Effect.promise(async () => {
|
||||||
const rawMessage = [...args.message, ...(args["--"] || [])].join(" ")
|
const rawMessage = [...args.message, ...(args["--"] || [])].join(" ")
|
||||||
const thinking = args.interactive ? (args.thinking ?? true) : (args.thinking ?? false)
|
const thinking = args.interactive ? (args.thinking ?? true) : (args.thinking ?? false)
|
||||||
@@ -508,7 +510,9 @@ export const RunCommand = effectCmd({
|
|||||||
if (!args.agent) return undefined
|
if (!args.agent) return undefined
|
||||||
const name = args.agent
|
const name = args.agent
|
||||||
|
|
||||||
const entry = await Effect.runPromise(agentSvc.get(name))
|
const entry = await Effect.runPromise(
|
||||||
|
agentSvc.get(name).pipe(Effect.provideService(InstanceRef, localInstance)),
|
||||||
|
)
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
UI.println(
|
UI.println(
|
||||||
UI.Style.TEXT_WARNING_BOLD + "!",
|
UI.Style.TEXT_WARNING_BOLD + "!",
|
||||||
|
|||||||
Reference in New Issue
Block a user