refactor(core): add location session runtime
This commit is contained in:
parent
70cecc6ba1
commit
89ef53537e
12 changed files with 356 additions and 46 deletions
|
|
@ -6,6 +6,7 @@ import type { CommandHooks } from "./command.js"
|
|||
import type { IntegrationHooks } from "./integration.js"
|
||||
import type { PluginDomain } from "./plugin.js"
|
||||
import type { ReferenceHooks } from "./reference.js"
|
||||
import type { SessionDomain } from "./session.js"
|
||||
import type { SkillHooks } from "./skill.js"
|
||||
import type { Reload } from "./registration.js"
|
||||
|
||||
|
|
@ -18,5 +19,6 @@ export interface PluginContext {
|
|||
readonly integration: IntegrationHooks & Reload
|
||||
readonly plugin: PluginDomain
|
||||
readonly reference: ReferenceHooks & Reload
|
||||
readonly session: SessionDomain
|
||||
readonly skill: SkillHooks & Reload
|
||||
}
|
||||
|
|
|
|||
30
packages/plugin/src/v2/effect/session.ts
Normal file
30
packages/plugin/src/v2/effect/session.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import type { Effect } from "effect"
|
||||
import type { PromptInput, SessionInputAdmitted, SessionMessage, SessionV2Info } from "@opencode-ai/sdk/v2/types"
|
||||
|
||||
export interface SessionDomain {
|
||||
readonly create: (input: {
|
||||
readonly id?: string
|
||||
readonly parentID?: string
|
||||
readonly title?: string
|
||||
readonly agent?: string
|
||||
readonly model?: SessionV2Info["model"]
|
||||
}) => Effect.Effect<SessionV2Info>
|
||||
readonly get: (sessionID: string) => Effect.Effect<SessionV2Info>
|
||||
readonly messages: (input: {
|
||||
readonly sessionID: string
|
||||
readonly limit?: number
|
||||
readonly order?: "asc" | "desc"
|
||||
readonly cursor?: { readonly id: string; readonly direction: "previous" | "next" }
|
||||
}) => Effect.Effect<ReadonlyArray<SessionMessage>>
|
||||
readonly context: (sessionID: string) => Effect.Effect<ReadonlyArray<SessionMessage>>
|
||||
readonly prompt: (input: {
|
||||
readonly id?: string
|
||||
readonly sessionID: string
|
||||
readonly prompt: PromptInput
|
||||
readonly delivery?: "steer" | "queue"
|
||||
readonly resume?: boolean
|
||||
}) => Effect.Effect<SessionInputAdmitted>
|
||||
readonly resume: (sessionID: string) => Effect.Effect<void>
|
||||
readonly wait: (sessionID: string) => Effect.Effect<void>
|
||||
readonly interrupt: (sessionID: string) => Effect.Effect<void>
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import type { CommandHooks } from "./command.js"
|
|||
import type { IntegrationHooks } from "./integration.js"
|
||||
import type { PluginDomain } from "./plugin.js"
|
||||
import type { ReferenceHooks } from "./reference.js"
|
||||
import type { SessionDomain } from "./session.js"
|
||||
import type { SkillHooks } from "./skill.js"
|
||||
import type { Reload } from "./registration.js"
|
||||
|
||||
|
|
@ -18,5 +19,6 @@ export interface PluginContext {
|
|||
readonly integration: IntegrationHooks & Reload
|
||||
readonly plugin: PluginDomain
|
||||
readonly reference: ReferenceHooks & Reload
|
||||
readonly session: SessionDomain
|
||||
readonly skill: SkillHooks & Reload
|
||||
}
|
||||
|
|
|
|||
29
packages/plugin/src/v2/promise/session.ts
Normal file
29
packages/plugin/src/v2/promise/session.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import type { PromptInput, SessionInputAdmitted, SessionMessage, SessionV2Info } from "@opencode-ai/sdk/v2/types"
|
||||
|
||||
export interface SessionDomain {
|
||||
readonly create: (input: {
|
||||
readonly id?: string
|
||||
readonly parentID?: string
|
||||
readonly title?: string
|
||||
readonly agent?: string
|
||||
readonly model?: SessionV2Info["model"]
|
||||
}) => Promise<SessionV2Info>
|
||||
readonly get: (sessionID: string) => Promise<SessionV2Info>
|
||||
readonly messages: (input: {
|
||||
readonly sessionID: string
|
||||
readonly limit?: number
|
||||
readonly order?: "asc" | "desc"
|
||||
readonly cursor?: { readonly id: string; readonly direction: "previous" | "next" }
|
||||
}) => Promise<ReadonlyArray<SessionMessage>>
|
||||
readonly context: (sessionID: string) => Promise<ReadonlyArray<SessionMessage>>
|
||||
readonly prompt: (input: {
|
||||
readonly id?: string
|
||||
readonly sessionID: string
|
||||
readonly prompt: PromptInput
|
||||
readonly delivery?: "steer" | "queue"
|
||||
readonly resume?: boolean
|
||||
}) => Promise<SessionInputAdmitted>
|
||||
readonly resume: (sessionID: string) => Promise<void>
|
||||
readonly wait: (sessionID: string) => Promise<void>
|
||||
readonly interrupt: (sessionID: string) => Promise<void>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue