feat(plugin): add session request hook (#35794)
This commit is contained in:
parent
e25a724bc2
commit
4f976bcf1a
124 changed files with 7743 additions and 5620 deletions
25
packages/plugin/src/v2/effect/session.ts
Normal file
25
packages/plugin/src/v2/effect/session.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import type { SessionApi } from "@opencode-ai/client/effect/api"
|
||||
import type { Message, SystemPart } from "@opencode-ai/llm"
|
||||
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 SessionRequestBeforeEvent {
|
||||
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 SessionHooks {
|
||||
readonly request: SessionRequestBeforeEvent
|
||||
}
|
||||
|
||||
export interface SessionDomain
|
||||
extends Pick<SessionApi<unknown>, "create" | "get" | "prompt" | "command" | "interrupt"> {
|
||||
readonly hook: Hooks<SessionHooks>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue