Files
deepseek-harness/packages/support/subagent-mock
Tianyi Cui 15f4d1cd03 feat(subagent): persona + toolFilter become real; structured runtime collapses to scoped registrations
SubagentStartRequest gains persona (capability-gated like toolFilter); the
in-process driver composes the child's scoped world in the factory's setup
window — persona as a scoped shadowing deployment:persona section,
toolFilter as a scoped tools.restrict() (loud unknown-name validation),
outputSchema as the scoped structured runtime. spawn/fork now advertise
every start-time capability; ACP stays all-false. A parent-scope teardown
effect links each child to its parent through the memoized handle, so a
disposed parent reaches its whole subtree even if the delegating tool's
finally never runs; subagent/start|end dispatch in the delegating parent's
scope.

structured.ts loses the placeholder schema, the final-assembly swap/strip,
the refcounted root runtime, and the WeakMap state: each child registers
its OWN capture tool (real schema), instruction section, and enforcement
listeners on child.ctx, riding the child's fiber. The commit listener is
call-keyed (a stale stage from a short-circuited post-execute chain is
dropped, never promoted on a later call), and one scoped prepend re-assert
listener preserves the final-assembly guarantee against a stripping global
listener.

tool-subagent gains persona/toolFilter/maxDepth passthrough config —
deny-listing the delegation tool (or maxDepth) is how a deployment bounds
recursion; the omitted-toolFilter schema key is forced absent (a
materialized {} would mean an empty allow-list, i.e. deny-everything).
2026-07-09 02:10:06 +08:00
..

@deepseek-ai/dsh-subagent-mock

A scripted SubagentProvider for testing the subagent seam without a model or a real child agent — the subagent analog of dsh-llm-replay.

It lets a test drive ctx.subagents and the model-facing dsh-tool-subagent through the real cordis Loader / export path, exercising provider registration, start-time capability validation, the run lifecycle (result / cancel / dispose), and the structured-output branch — all deterministically and keylessly.

Usage

Load it as a plugin (functional shape: name/inject/Config/apply, no default). Config (all optional):

Key Default Meaning
name mock Registry name to register the provider under.
reply mock subagent reply The scripted child's final answer text.
stopReason completed The stop reason result settles with.
capabilities all true Which start-time capabilities (outputSchema/depthLimit/toolFilter) the provider advertises.
inheritsParentContext false The context contract to declare; true exercises the fork-shaped tool wording in consumer tests.
structured { reply } Structured value surfaced when a request carries an outputSchema and the capability is on.

A cancel() issued before result settles flips the stop reason to aborted, so the cancellation path is observable.