Files
deepseek-harness/website/zh-CN/api/harness/subagents.md
T

65 lines
2.2 KiB
Markdown
Raw Normal View History

<!-- 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`.
2026-07-16 21:36:43 +08:00
Named provider registry and capability-checked start surface.
2026-07-16 21:36:43 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L141)
### ctx.subagents.registerProvider(provider)
```ts website-api
registerProvider(provider: SubagentProvider): () => void
```
2026-07-16 21:36:43 +08:00
Register a provider under its name. Registration is effect-scoped and HMR safe; removing a provider blocks new starts but does not revoke runs that were already returned to their holders.
2026-07-16 21:36:43 +08:00
- `provider` — the trusted provider implementation.
2026-07-16 21:36:43 +08:00
**Returns** the exact Cordis effect disposer.
2026-07-16 21:36:43 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L155)
### ctx.subagents.getProvider(name)
```ts website-api
getProvider(name: string): SubagentProvider | undefined
```
2026-07-16 21:36:43 +08:00
Look up a provider by name.
2026-07-16 21:36:43 +08:00
- `name` — the provider name.
2026-07-16 21:36:43 +08:00
**Returns** the provider, or undefined when absent.
2026-07-16 21:36:43 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L178)
### ctx.subagents.list()
```ts website-api
list(): string[]
```
2026-07-16 21:36:43 +08:00
List registered provider names in insertion order.
2026-07-16 21:36:43 +08:00
**Returns** the registered names.
2026-07-16 21:36:43 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L186)
### ctx.subagents.start(name, request)
```ts website-api
2026-07-16 21:36:43 +08:00
async start(name: string, request: SubagentStartRequest): Promise<SubagentRun>
```
2026-07-16 21:36:43 +08:00
Establish a ready child on the named provider. Capability and semantic checks run before delegation. Provider ownership lasts until its promise fulfills; a rejection therefore has no run for the caller to dispose and emits no run lifecycle events.
2026-07-16 21:36:43 +08:00
- `name` — the provider to use.
- `request` — child prompt, parent, signal, and optional capabilities.
2026-07-16 21:36:43 +08:00
**Returns** the ready holder-owned run.
2026-07-16 21:36:43 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L199)