Files
deepseek-harness/website/zh-CN/api/harness/subagents.md
lintianle efba9fab0a website: generate the API reference from source (cordis + all 15 harness services)
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.
2026-07-16 18:13:34 +08:00

2.6 KiB

ctx.subagents

SubagentService — provided by @deepseek-ai/dsh-subagent.

The subagents service: a registry of named SubagentProviders and a capability-checked start surface.

Source

ctx.subagents.registerProvider(provider)

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

ctx.subagents.getProvider(name)

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

ctx.subagents.list()

list(): string[]

The names of all registered providers (insertion order).

Returns the registered provider names.

Source

ctx.subagents.start(name, request)

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