refactor(core): make Code Mode a service
This commit is contained in:
parent
81f6e06681
commit
70b493af15
17 changed files with 268 additions and 87 deletions
12
packages/plugin/src/v2/effect/code-mode.ts
Normal file
12
packages/plugin/src/v2/effect/code-mode.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import type { Effect, Scope } from "effect"
|
||||
import type { AnyTool, RegistrationError } from "./tool.js"
|
||||
|
||||
export type Path = readonly [string, ...string[]]
|
||||
|
||||
export interface Draft {
|
||||
add(path: Path, tool: AnyTool): void
|
||||
}
|
||||
|
||||
export interface Domain {
|
||||
readonly register: (source: (draft: Draft) => void) => Effect.Effect<void, RegistrationError, Scope.Scope>
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ import type { AgentHooks } from "./agent.js"
|
|||
import type { AISDKHooks } from "./aisdk.js"
|
||||
import type { CatalogHooks } from "./catalog.js"
|
||||
import type { CommandHooks } from "./command.js"
|
||||
import type { Domain } from "./code-mode.js"
|
||||
import type { EventHooks } from "./event.js"
|
||||
import type { IntegrationHooks } from "./integration.js"
|
||||
import type { PluginDomain } from "./plugin.js"
|
||||
|
|
@ -17,6 +18,7 @@ export interface PluginContext {
|
|||
readonly aisdk: AISDKHooks
|
||||
readonly catalog: CatalogHooks
|
||||
readonly command: CommandHooks
|
||||
readonly codemode: Domain
|
||||
readonly event: EventHooks
|
||||
readonly integration: IntegrationHooks
|
||||
readonly plugin: PluginDomain
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export type { AgentDraft, AgentHooks } from "./agent.js"
|
|||
export type { AISDKHooks } from "./aisdk.js"
|
||||
export type { CatalogDraft, CatalogHooks, CatalogProviderRecord } from "./catalog.js"
|
||||
export type { CommandDraft, CommandHooks } from "./command.js"
|
||||
export * as CodeMode from "./code-mode.js"
|
||||
export type { EventHooks } from "./event.js"
|
||||
export type { IntegrationDraft, IntegrationHooks, IntegrationMethodRegistration } from "./integration.js"
|
||||
export type { ReferenceDraft, ReferenceHooks } from "./reference.js"
|
||||
|
|
|
|||
|
|
@ -246,7 +246,6 @@ export interface ToolExecuteAfterEvent {
|
|||
|
||||
export interface RegisterOptions {
|
||||
readonly group?: string
|
||||
readonly deferred?: boolean
|
||||
}
|
||||
|
||||
export interface ToolDraft {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ test.each([
|
|||
expect(entrypoint.Skill).toBe(Skill)
|
||||
expect(Object.keys(entrypoint).sort()).toEqual([
|
||||
"Agent",
|
||||
...(name === "effect" ? ["CodeMode"] : []),
|
||||
"Command",
|
||||
"Connection",
|
||||
"Credential",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue