refactor(plugin): use direct runtime registry
This commit is contained in:
parent
cd97de7391
commit
975b1132f1
14 changed files with 129 additions and 167 deletions
|
|
@ -4,7 +4,7 @@ import type { AISDKHooks } from "./aisdk.js"
|
|||
import type { CatalogHooks } from "./catalog.js"
|
||||
import type { CommandHooks } from "./command.js"
|
||||
import type { IntegrationHooks } from "./integration.js"
|
||||
import type { PluginHooks } from "./plugin.js"
|
||||
import type { PluginDomain } from "./plugin.js"
|
||||
import type { ReferenceHooks } from "./reference.js"
|
||||
import type { SkillHooks } from "./skill.js"
|
||||
import type { Reload } from "./registration.js"
|
||||
|
|
@ -16,7 +16,7 @@ export interface PluginContext {
|
|||
readonly catalog: CatalogHooks & Reload
|
||||
readonly command: CommandHooks & Reload
|
||||
readonly integration: IntegrationHooks & Reload
|
||||
readonly plugin: PluginHooks & Reload
|
||||
readonly plugin: PluginDomain
|
||||
readonly reference: ReferenceHooks & Reload
|
||||
readonly skill: SkillHooks & Reload
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
export type { PluginContext } from "./context.js"
|
||||
export { define } from "./plugin.js"
|
||||
export type { Plugin, PluginDraft } from "./plugin.js"
|
||||
export type { Plugin } from "./plugin.js"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import type { Effect, Scope } from "effect"
|
||||
import type { PluginContext } from "./context.js"
|
||||
import type { PluginOptions } from "../options.js"
|
||||
import type { Hooks } from "./registration.js"
|
||||
|
||||
export interface Plugin {
|
||||
readonly id: string
|
||||
|
|
@ -12,17 +10,7 @@ export function define(plugin: Plugin) {
|
|||
return plugin
|
||||
}
|
||||
|
||||
export interface PluginRef {
|
||||
readonly package: string
|
||||
readonly options?: PluginOptions
|
||||
export interface PluginDomain {
|
||||
readonly add: (plugin: Plugin) => Effect.Effect<void>
|
||||
readonly remove: (id: string) => Effect.Effect<void>
|
||||
}
|
||||
|
||||
export interface PluginDraft {
|
||||
list(): readonly Plugin[]
|
||||
add(plugin: Plugin): void
|
||||
remove(id: string): void
|
||||
}
|
||||
|
||||
export type PluginHooks = Hooks<{
|
||||
transform: PluginDraft
|
||||
}>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { AISDKHooks } from "./aisdk.js"
|
|||
import type { CatalogHooks } from "./catalog.js"
|
||||
import type { CommandHooks } from "./command.js"
|
||||
import type { IntegrationHooks } from "./integration.js"
|
||||
import type { PluginHooks } from "./plugin.js"
|
||||
import type { PluginDomain } from "./plugin.js"
|
||||
import type { ReferenceHooks } from "./reference.js"
|
||||
import type { SkillHooks } from "./skill.js"
|
||||
import type { Reload } from "./registration.js"
|
||||
|
|
@ -16,7 +16,7 @@ export interface PluginContext {
|
|||
readonly catalog: CatalogHooks & Reload
|
||||
readonly command: CommandHooks & Reload
|
||||
readonly integration: IntegrationHooks & Reload
|
||||
readonly plugin: PluginHooks & Reload
|
||||
readonly plugin: PluginDomain
|
||||
readonly reference: ReferenceHooks & Reload
|
||||
readonly skill: SkillHooks & Reload
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export type { PluginContext } from "./context.js"
|
||||
export type { PluginOptions } from "../options.js"
|
||||
export { define } from "./plugin.js"
|
||||
export type { Plugin, PluginDraft, PluginHooks, PluginRef } from "./plugin.js"
|
||||
export type { Plugin, PluginDomain } from "./plugin.js"
|
||||
export type { Registration, Reload } from "./registration.js"
|
||||
export type { AgentDraft, AgentHooks } from "./agent.js"
|
||||
export type { AISDKHooks } from "./aisdk.js"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import type { PluginContext } from "./context.js"
|
||||
import type { PluginDraft, PluginRef } from "../effect/plugin.js"
|
||||
import type { Hooks } from "./registration.js"
|
||||
|
||||
export interface Plugin {
|
||||
readonly id: string
|
||||
|
|
@ -11,8 +9,7 @@ export function define(plugin: Plugin) {
|
|||
return plugin
|
||||
}
|
||||
|
||||
export type { PluginDraft, PluginRef }
|
||||
|
||||
export type PluginHooks = Hooks<{
|
||||
transform: PluginDraft
|
||||
}>
|
||||
export interface PluginDomain {
|
||||
readonly add: (plugin: Plugin) => Promise<void>
|
||||
readonly remove: (id: string) => Promise<void>
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue