mirror of
https://github.com/Heretek-AI/opencode.git
synced 2026-11-22 08:59:26 -10:00
27 lines
850 B
TypeScript
27 lines
850 B
TypeScript
import type { CommandApi } from "@opencode/client/promise/api"
|
|
import type { PromptInput } from "@opencode/schema/prompt-input"
|
|
import type { Session } from "@opencode/schema/session"
|
|
import type { SessionInbox } from "@opencode/schema/session-inbox"
|
|
import type { Transform } from "./registration.js"
|
|
|
|
export interface CommandInvocation {
|
|
readonly sessionID: Session.ID
|
|
readonly prompt: PromptInput.Prompt
|
|
readonly delivery: SessionInbox.Delivery
|
|
}
|
|
|
|
export interface CommandDefinition {
|
|
readonly name: string
|
|
readonly description?: string
|
|
readonly execute: (input: CommandInvocation) => Promise<void>
|
|
}
|
|
|
|
export interface CommandEditor {
|
|
add(definition: CommandDefinition): void
|
|
}
|
|
|
|
export interface CommandDomain extends Pick<CommandApi, "list"> {
|
|
readonly transform: Transform<CommandEditor>
|
|
readonly reload: () => Promise<void>
|
|
}
|