mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-26 23:28:43 +00:00
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
export * as SessionCommand from "./command.js"
|
|
|
|
import type { PromptInput } from "@opencode/schema/prompt-input"
|
|
import type { Session } from "@opencode/schema/session"
|
|
import type { SessionInbox } from "@opencode/schema/session-inbox"
|
|
import { Effect } from "effect"
|
|
import { Command } from "../command.js"
|
|
import { Instance } from "../instance/service.js"
|
|
import { Plugin } from "../plugin/service.js"
|
|
|
|
export const execute = Effect.fn("SessionCommand.execute")(function* (input: {
|
|
session: Session.Info
|
|
command: string
|
|
text: string
|
|
files?: PromptInput.Prompt["files"]
|
|
agents?: PromptInput.Prompt["agents"]
|
|
skills?: PromptInput.Prompt["skills"]
|
|
delivery?: SessionInbox.Delivery
|
|
}) {
|
|
const instances = yield* Instance.Service
|
|
yield* Effect.gen(function* () {
|
|
yield* Plugin.awaitActivation
|
|
const commands = yield* Command.Service
|
|
yield* commands.execute({
|
|
name: input.command,
|
|
invocation: {
|
|
sessionID: input.session.id,
|
|
prompt: {
|
|
text: input.text,
|
|
files: input.files,
|
|
agents: input.agents,
|
|
skills: input.skills,
|
|
},
|
|
delivery: input.delivery ?? "steer",
|
|
},
|
|
})
|
|
}).pipe(instances.provide(input.session))
|
|
})
|