mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
docs: update tutorial for canonical tool output
This commit is contained in:
@@ -1635,7 +1635,7 @@ The concrete provider retains pi-tui, focus, and terminal lifecycle state. Plugi
|
|||||||
abstract openOverlay(request: TuiOverlayRequest): TuiOverlaySession
|
abstract openOverlay(request: TuiOverlayRequest): TuiOverlaySession
|
||||||
```
|
```
|
||||||
|
|
||||||
Source: [`packages/ui/tui/src/index.ts:131`](../../packages/ui/tui/src/index.ts)
|
Source: [`packages/ui/tui/src/index.ts:132`](../../packages/ui/tui/src/index.ts)
|
||||||
|
|
||||||
## `ctx.userInteraction` — `UserInteractionService`
|
## `ctx.userInteraction` — `UserInteractionService`
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,12 @@ export function apply(ctx: Context) {
|
|||||||
parameters: {
|
parameters: {
|
||||||
name: { type: 'string', required: true, description: 'Who to greet' },
|
name: { type: 'string', required: true, description: 'Who to greet' },
|
||||||
},
|
},
|
||||||
|
output: {
|
||||||
|
schema: { type: 'string' },
|
||||||
|
render: (_args, value) => [{ type: 'text', text: value }],
|
||||||
|
},
|
||||||
async execute(args) {
|
async execute(args) {
|
||||||
return [{ type: 'text', text: `Hello, ${args.name}!` }]
|
return `Hello, ${args.name}!`
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@@ -40,7 +44,7 @@ export function apply(ctx: Context) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Every pattern here is from the earlier chapters: `inject: ['tools']` ([chapter 3](03-services.md)) holds the plugin until the tool registry exists; `ctx.tools.register(...)` attaches the registration disposer to the plugin ([chapter 2](02-lifecycle-and-effects.md)), so unloading unregisters the tool. `defineTool` converts the `parameters` spec to the JSON Schema shown to the model, infers the type of `args`, and validates model-supplied arguments before `execute` runs.
|
Every pattern here is from the earlier chapters: `inject: ['tools']` ([chapter 3](03-services.md)) holds the plugin until the tool registry exists; `ctx.tools.register(...)` attaches the registration disposer to the plugin ([chapter 2](02-lifecycle-and-effects.md)), so unloading unregisters the tool. `defineTool` converts the `parameters` spec to the JSON Schema shown to the model, infers the type of `args`, and validates model-supplied arguments before `execute` runs. The tool returns the canonical value declared by `output.schema`; `output.render` separately produces the Native and durable result content.
|
||||||
|
|
||||||
## An observer plugin
|
## An observer plugin
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user