scripts/gen-website-api.ts renders website/zh-CN/api/{cordis,harness}/* and the
api-sidebar.json fragment the VitePress config imports, so pages and navigation
can never drift from the code: signatures, @param/@returns prose, dispatch
modes, and GitHub source links are extracted, never transcribed, and the
generator hard-errors on any rendered member missing docs. verify-website-api
(doc-sync + run-gates) is the freshness gate.
Replaces the hand-written zh api pages (7 pages covering 7 of 15 services,
with phantom APIs: Context.current/Context.events, agent/post-step, tool/call,
compact/*, llm/pre-request none of which exist) with generated English
references: 5 cordis pages, 15 per-service pages, and a 35-event catalog
grouped by scope. The hand-written hub api/index.md stays and now indexes the
full surface; zh for these pages arrives with the unified translation flow.
65 lines
2.6 KiB
Markdown
65 lines
2.6 KiB
Markdown
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
|
|
|
|
# ctx.subagents
|
|
|
|
`SubagentService` — provided by `@deepseek-ai/dsh-subagent`.
|
|
|
|
The `subagents` service: a registry of named SubagentProviders and a capability-checked start surface.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L144)
|
|
|
|
### ctx.subagents.registerProvider(provider)
|
|
|
|
```ts website-api
|
|
registerProvider(provider: SubagentProvider): () => void
|
|
```
|
|
|
|
Register a provider under its `provider.name`. Throws SubagentError (`DUPLICATE_PROVIDER`) if the name is already taken. Effect-scoped: disposed with the calling fiber (HMR-safe). Emits `subagent/provider-added` after the registration and `subagent/provider-removed` on unregistration, so consumers can mirror provider lifecycle instead of assuming load order.
|
|
|
|
- `provider` — the provider; its `name` is the registry key.
|
|
|
|
**Returns** the disposer that unregisters the provider.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L160)
|
|
|
|
### ctx.subagents.getProvider(name)
|
|
|
|
```ts website-api
|
|
getProvider(name: string): SubagentProvider | undefined
|
|
```
|
|
|
|
Look up a registered provider by name (`undefined` if absent).
|
|
|
|
- `name` — the provider name as registered.
|
|
|
|
**Returns** the provider, or undefined when the name is unknown.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L188)
|
|
|
|
### ctx.subagents.list()
|
|
|
|
```ts website-api
|
|
list(): string[]
|
|
```
|
|
|
|
The names of all registered providers (insertion order).
|
|
|
|
**Returns** the registered provider names.
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L196)
|
|
|
|
### ctx.subagents.start(name, request)
|
|
|
|
```ts website-api
|
|
start(name: string, request: SubagentStartRequest): SubagentRun
|
|
```
|
|
|
|
Start a subagent run on the named provider. Resolves the provider (throws `NO_PROVIDER` if absent), validates every requested START-TIME capability against SubagentProvider.capabilities (throws `UNSUPPORTED_CAPABILITY` for the first unmet one — fail loud, before any child is created), then delegates to SubagentProvider.start and emits `subagent/start` / `subagent/end` around the run.
|
|
|
|
- `name` — the provider to run on.
|
|
- `request` — the child's prompt, capabilities, and options.
|
|
|
|
**Returns** the live run (its `result` resolves when the child settles).
|
|
|
|
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L211)
|