mirror of
https://github.com/anomalyco/opencode.git
synced 2026-04-27 00:05:26 +00:00
All service facades now use @/effect/run (lazy runtime import) instead of directly importing @/effect/runtime. This breaks the circular dependency chain that caused "undefined is not an object" crashes in bun's bundled binary. - Add src/effect/run.ts with run() and runInstance() lazy wrappers - Strip all facades to runtime-only functions (no schema re-exports) - Consumers that need schemas import from service modules directly - Update specs/effect-migration.md with facade rules and full list
29 lines
914 B
TypeScript
29 lines
914 B
TypeScript
import { runInstance } from "@/effect/run"
|
|
import type { MessageID, SessionID } from "@/session/schema"
|
|
import type { QuestionID } from "./schema"
|
|
import type { Question as S } from "./service"
|
|
|
|
const svc = () => import("./service").then((m) => m.Question.Service)
|
|
|
|
export namespace Question {
|
|
export async function ask(input: {
|
|
sessionID: SessionID
|
|
questions: S.Info[]
|
|
tool?: { messageID: MessageID; callID: string }
|
|
}): Promise<S.Answer[]> {
|
|
return runInstance((await svc()).use((s) => s.ask(input)))
|
|
}
|
|
|
|
export async function reply(input: { requestID: QuestionID; answers: S.Answer[] }) {
|
|
return runInstance((await svc()).use((s) => s.reply(input)))
|
|
}
|
|
|
|
export async function reject(requestID: QuestionID) {
|
|
return runInstance((await svc()).use((s) => s.reject(requestID)))
|
|
}
|
|
|
|
export async function list() {
|
|
return runInstance((await svc()).use((s) => s.list()))
|
|
}
|
|
}
|