refactor(subagent): merge continuation control service

This commit is contained in:
Dudu
2026-07-27 00:00:14 +08:00
committed by imccyu
parent 0a95ad8cc0
commit 88f913a9ae
71 changed files with 543 additions and 673 deletions

View File

@@ -424,19 +424,11 @@ const SERVICE_ROLES: ServiceRole[] = [
{
key: 'subagents',
pkg: 'subagent',
title: 'Subagent provider registry',
title: 'Subagent provider and continuation service',
mode: 'seam',
implementations: ['subagent-spawn', 'subagent-fork', 'subagent-acp'],
consumers: ['tool-subagent', 'tool-ralph'],
note: 'Providers implement transports; tool-subagent exposes configured delegation while tool-ralph requires one fresh structured-output route.',
},
{
key: 'subagentControl',
pkg: 'subagent',
title: 'Continuable-subagent control service',
mode: 'core',
consumers: ['tool-subagent', 'tool-subagent-control'],
note: 'Binds one durable child session to Task-backed activations over ctx.subagents; tool-subagent starts continuable background children and tool-subagent-control delivers follow-up messages.',
consumers: ['tool-subagent', 'tool-subagent-control', 'tool-ralph'],
note: 'Providers implement transports; the service also owns optional Task-backed continuation orchestration, tool-subagent selects one-shot or continuable delegation, tool-subagent-control delivers follow-ups, and tool-ralph requires one fresh structured-output route.',
},
{
key: 'tasks',

View File

@@ -28,7 +28,6 @@ import * as WebSearchExa from '@deepseek-ai/dsh-web-search-exa'
import * as WebFetchLocal from '@deepseek-ai/dsh-web-fetch-local'
import SubagentService from '@deepseek-ai/dsh-subagent'
import type { SubagentProvider } from '@deepseek-ai/dsh-subagent'
import SubagentControlService from '@deepseek-ai/dsh-subagent-control'
import * as ToolSubagentControl from '@deepseek-ai/dsh-tool-subagent-control'
import SkillService from '@deepseek-ai/dsh-skill'
import * as SkillLocal from '@deepseek-ai/dsh-skill-local'
@@ -108,8 +107,6 @@ function registerCatalogSubagentProvider(ctx: Context, name: string): void {
capabilities: { outputSchema: true, depthLimit: true, toolFilter: true, persona: true },
inheritsParentContext: false,
start: () => Promise.reject(new Error('tool-catalog provider cannot start a child')),
// Presence marks the continuation capability, so tool-subagent harvests
// its shipped continuable background wording (spawn/fork are resumable).
resume: () => Promise.reject(new Error('tool-catalog provider cannot resume a child')),
}
ctx.subagents.registerProvider(provider)
@@ -388,13 +385,12 @@ const TOOL_PACKAGES: ToolPackage[] = [
pkg: '@deepseek-ai/dsh-tool-subagent-control',
dir: 'tool-subagent-control',
source: 'packages/subagent/tool-subagent-control/src/index.ts',
requires: ['ctx.tools', 'ctx.subagentControl'],
writes: ['tool/call', 'tool/result', 'child session events through the control service'],
requires: ['ctx.tools', 'ctx.subagents'],
writes: ['tool/call', 'tool/result', 'child session events through ctx.subagents'],
async mount(ctx) {
await ctx.plugin(SubagentService)
await ctx.plugin(LocalTaskService)
await ctx.plugin(AgentRegistry)
await ctx.plugin(SubagentControlService)
await ctx.plugin(ToolSubagentControl)
},
note:

View File

@@ -1102,7 +1102,7 @@
{
"doc": "docs/core-data-structures/subagent.md",
"symbol": "CoordinatorMessageSource",
"source": "packages/subagent/subagent-control/src/index.ts"
"source": "packages/subagent/subagent/src/continuation.ts"
},
{
"doc": "docs/core-data-structures/subagent.md",