mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-05 13:29:54 +00:00
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import type { SessionApi } from "@opencode-ai/client/promise/api"
|
|
import type { Message, SystemPart } from "@opencode-ai/ai"
|
|
import type { HttpRequest } from "@opencode-ai/ai/route"
|
|
import type { Agent } from "@opencode-ai/schema/agent"
|
|
import type { Model } from "@opencode-ai/schema/model"
|
|
import type { Session } from "@opencode-ai/schema/session"
|
|
import type { JsonSchema } from "effect"
|
|
import type { Hooks } from "./registration.js"
|
|
|
|
export interface SessionContext {
|
|
readonly sessionID: Session.ID
|
|
readonly agent: Agent.ID
|
|
readonly model: Model.Ref
|
|
system: Array<SystemPart>
|
|
messages: Array<Message>
|
|
tools: Record<string, { description: string; input: JsonSchema.JsonSchema }>
|
|
}
|
|
|
|
export interface SessionRequest extends HttpRequest {
|
|
readonly sessionID: Session.ID
|
|
readonly agent: Agent.ID
|
|
readonly model: Model.Ref
|
|
}
|
|
|
|
export interface SessionHooks {
|
|
readonly context: SessionContext
|
|
readonly request: SessionRequest
|
|
}
|
|
|
|
export type SessionDomain = Pick<
|
|
SessionApi,
|
|
"create" | "get" | "prompt" | "generate" | "command" | "synthetic" | "interrupt"
|
|
> & {
|
|
readonly hook: Hooks<SessionHooks>
|
|
}
|