Conflict resolution notes: - package.json/run-gates: both sides' new doc-sync gates kept (master's scoped-events/readme gates + this branch's website-api/website-yaml); js-yaml devDeps deduped (master added them independently). - pnpm-workspace/knip: website AND python/sdk-runtime entries kept. - doc-typecheck/verify-type-equiv: master's condensed headers kept, website glob retained in both scan scopes. - vendor/cordis/src/fiber.ts: master's lifecycle-hardening code taken; this branch's richer FiberState JSDoc reapplied on top. vendor/README.md logs both local modifications (hardening = 6, JSDoc enrichment = 7). - pnpm-lock: regenerated from master's side (pnpm install). Post-merge sync the gates forced (the system working as designed): - verify-website-yaml caught 4 stale plugin names from master's package reorg (dsh-stdio-agent -> dsh-stdio-demo, dsh-acp-agent -> dsh-acp-demo); 8 references fixed across guide/ and develop/. - gen-website-api picked up master's 6 new services automatically (ctx.approval/permission/sandbox/sessionQuery/skills/tasks -> 6 new pages + sidebar); api/index.md hub updated to list them. - AGENTS.md budget ceiling 1370 -> 1400: the website rows (layout line + two command lines) and master's own growth collided with the old ceiling; all three website rows are load-bearing (new top-level dir, new CI command).
1.8 KiB
1.8 KiB
ctx.llm
LlmService — provided by @deepseek-ai/dsh-llm.
The abstract llm service: an adapter registry plus a streaming model-call surface, interceptable via the llm/stream waterfall.
ctx.llm.registerAdapter(models, adapter)
registerAdapter(models: string[], adapter: LlmAdapter): () => void
Register an adapter for the given model names. Throws LlmError with code DUPLICATE_ADAPTER if any model already has an adapter (all-or-nothing). Disposed with the fiber.
models— every model name this adapter should serve.adapter— the adapter that streams calls for those models.
Returns the disposer that unregisters all of them.
ctx.llm.models()
models(): string[]
Model names with a registered adapter.
Returns the registered names, in registration order.
ctx.llm.stream(options)
stream(options: GenerateOptions): AsyncIterable<StreamChunk>
Stream one model call as raw chunks (token-level deltas). Throws LlmError with code NO_ADAPTER if no adapter is registered for options.model. Dispatches through the llm/stream waterfall.
options— the full request;options.modelselects the adapter.
Returns the chunk stream, possibly wrapped by llm/stream listeners.