docs(sdk): add ask-human tool example
Draft
MA
2mo ago+64+64+01234567890123456789-0-0-0123456789
What changed
Adds a host-supplied callback recipe for an ask_human tool requested by an integration partner. The example wraps the host callback in a typed SDK tool and shows scoped registration through opencode.tools.register.
Verification
bun test test/ask-human-example.test.ts: 1 passed, 0 failedbun run typecheck: passedgit diff --check: passed
The public example does not name or quote the private partner conversation.
Summary by cubic
Documents how to register a host callback as an agent tool in @opencode-ai/sdk-next with a new ask_human example. Previously the README described tool registration but gave no concrete callback-based tool; now it shows a complete pattern hosts can copy.
- Adds
makeAskHumaninpackages/sdk-next/examples/ask-human.ts, which wraps a(question: string) => Promise<string>callback in a typedTooland maps failures to aTool.Failure. - Adds
packages/sdk-next/test/ask-human-example.test.ts, which settles the tool with a host answer and asserts the callback receives the question. - Links the example from the README directly after the
tools.register(...)snippet.