feat(plugin): add namespaced hook API (#33416)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { define } from "@opencode-ai/plugin/v2/effect"
|
||||
import { Effect } from "effect"
|
||||
|
||||
export default define({
|
||||
id: "config-effect-plugin",
|
||||
effect: (ctx) =>
|
||||
ctx.agent
|
||||
.transform((agents) => {
|
||||
agents.update("effect-configured", (agent) => {
|
||||
agent.description = ctx.options.description
|
||||
agent.mode = "subagent"
|
||||
})
|
||||
})
|
||||
.pipe(Effect.asVoid),
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
import { define } from "@opencode-ai/plugin/v2/promise"
|
||||
|
||||
export default define({
|
||||
id: "config-promise-plugin",
|
||||
setup: async (ctx) => {
|
||||
await ctx.agent.transform((agents) => {
|
||||
agents.update("configured", (agent) => {
|
||||
agent.description = ctx.options.description
|
||||
agent.mode = "subagent"
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
export default {}
|
||||
Reference in New Issue
Block a user