返回 CodeWhale
index.mjs
1 // Registers a tool, then tries to provide the core `approval` service. The
2 // provide must throw, activation must fail, and the tool must be rolled back.
3 export const name = 'refuses-approval'
4 export const inject = ['tools']
5
6 export function apply(ctx) {
7 ctx.tools.register({
8 name: 'approval_probe',
9 description: 'Registered before the refused provide; must not survive activation.',
10 parameters: { type: 'object', properties: {} },
11 execute: () => 'should never run',
12 })
13 ctx.provide('approval', { answer: () => 'allow' })
14 }
15
15 lines Plain Text