Files
deepseek-harness/docs/subsystems
Yichen Jiang 43f3324a7b fix(tools): restrict what a scope inherits, not just the global layer
A restriction was compiled against the global tool layer alone: only
global-layer tools were tested against `admits()`, and every chain-layer
tool was overlaid unfiltered afterward. That read the exempt set as "the
global layer" when what it means is "what this scope registers itself" —
two descriptions of the same set only while every model-facing tool sat in
the host composition.

Moving those rows onto the agent plane separated them. A preset's tools are
an ANCESTOR contribution to a joined agent, so a subagent's `toolFilter`
stopped constraining anything it was given; and with the global layer empty
`restrict()` rejected every name it received as unknown, failing the child
outright. With the same tools in the global layer the filter still admits
and applies normally, which is what makes this a regression of the move
rather than a standing limitation.

`view()` now filters everything a scope inherits — the global layer and
every ancestor layer on its chain — and exempts only the layer the scope
owns. That exemption is load-bearing rather than incidental: the delegation
runtime registers a child's `report` and structured-output tools into the
child's own layer, and a filter naming the capabilities the child may use
must not strip the machinery it answers through. Tool order, and with it
prefix-cache reuse, is unchanged: inherited names keep their global-then-
ancestor position and own-layer names still come last.

The diagnostic said "unknown global tool" while listing what is really the
inherited surface; it now names the surface it checks and says why an
own-layer name is not restrictable.

Fixes #2185
2026-08-10 20:34:45 +08:00
..
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-09 19:00:22 +08:00
2026-08-09 19:00:22 +08:00
2026-08-09 19:00:22 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00
2026-08-10 16:34:20 +08:00

Subsystems

English | 中文

One page per subsystem of the DeepSeek Harness: what it is, the data structures it moves, and — where a ctx service or event scope backs it — a generated Cordis surface section carrying its service and event reference. The folder complements architecture.md, which describes behavior across subsystems (the service map, the session/turn/step lifecycle, the event taxonomy); each page here is the reference for one subsystem's vocabulary and wiring.

Page Owns
core.md how packages/core controls the agent loop: the package-by-package loop description, agent creation and ownership (AgentHandle), the Agent handle's delivery/cancellation/interception contracts, and the repo-wide type patterns (…Map → derived-union, branded ids)
llm-streaming.md the packages/llm conversation types — Message/ContentBlock, the assembled model request, the StreamChunk wire protocol and adapter contract, BlockAssembler, and the LlmAdapter provider contract
token-meter.md immutable scalar and positional replay measurements with consumed-log revisions
scope.md scoped registration identity, dispatch carriers, and the owned Scope context
typert.md Remote invocation descriptors, lookup/Context declarations, TypeRT registries, and the Host Gateway/Client API boundaries
goal.md persisted goal identity, lifecycle snapshots, activation, change records, and round attribution
commands.md the human-command registry service: definitions, adapter discovery, direct invocation, results, and parsing views
session.md the full SessionEventMap variant catalog, TurnTrigger/TurnEndReason, deriveMessages(), execution enclosure, and standalone events
persistence.md the durability seam: SessionPersistence, JSONL + SQLite backends, session/flush, crash recovery, SessionHeader
settings.md the user-settings seam: SettingsNamespace registration, layered resolution (defaults → composition base → user document), owner scopes, hot commits
credentials.md the credential seam: CredentialRef references (never values) in configuration, per-operation resolution, UI-safe CredentialInfo, provider source layers
session-query.md logical records, bounded exact-event reads, relationship traces, semantic filters/documents, and full-text result pages
session-title.md durable title snapshots, cited source-message seqs, and the asynchronous provider contract
session-reference.md structured cross-session references: SessionReferenceInput/Candidate, prepared message contexts, the stable error taxonomy
system-prompt.md per-assembly context, tool-provider results, prompt sections, and cooperative assembly
tools.md ToolDefinition full fields, the schema DSL, ToolExecution/ToolResult, tool-presentation UI types, and the guarded execution pipeline
user-interaction.md the UI-backed human question/answer seam: AskUserQuestionRequest, answer/options vocabulary, provider API, error taxonomy
approval.md the one-shot user-approval seam: ApprovalRequest, ApprovalOutcome, per-session policy, audit events, and answerer contracts
attachment.md durable image identity and metadata, validation inputs, verified reads, and the AttachmentStore seam
bash.md the bash executor seam: BashExecRequest/Spec, BashRunResult, background BashProcess handles
subprocess.md the subprocess seam: fully-explicit SubprocessSpawnSpec, offset-based output readers, unclassified SubprocessOutcome, and the managed DSH_* environment vocabulary
pty.md persistent terminal ids, backend/session contracts, send readiness, bounded reads, and owner-visible snapshots
sandbox.md per-session policy resolution and the process-confinement seam: file-effect modes, execution/provider policies, ConfinedArgv, enforcement and fail-closed errors
code-runtime.md the code-execution seam: CodeRunRequest/Result, binding namespaces, captured logs, the CodeRunFailure taxonomy
filesystem.md the filesystem seam: FsTarget, read/write/edit outcomes, observed-file state, FsErrorCode
lsp.md the LSP navigation seam: LspQueryRequest/Result, LspProvider/Service, four operations, LspError
skills.md the skill service: discovery priority, SkillSummary/SkillDefinition, session-prefix catalog, model-facing skill loading
compaction.md the compaction seam: the compact/* session events, CompactionResult, the CompactService interface
subagent.md the subagent seam: the named-provider registry, SubagentStartRequest/Result/Run, the start-time-vs-runtime capability split
web.md the web access seam: WebSearchRequest/Result, WebFetchRequest/Result, WebFetchBody, provider availability, WebError
spill.md the spill storage seam: SaveTextSpill, SpillOwner/SpillSource, SpillRef, the branded SpillLocator
workflow.md the workflow seam: WorkflowStartRequest, WorkflowMeta, WorkflowRun/Result, the workflow/* event payloads, WorkflowError fatality
tasks.md the background-task runtime: branded TaskIds, the producer contract, consumer views, and ctx.tasks service behavior
permission.md the permission-preset layer: PresetSpec/PresetOption, the derived custom state, the log-only permission/preset event
plan.md plan mode: the log-only plan/mode state, pending-selection flush, PlanModeConfig, the exit_plan_mode review arc
invariants.md the runtime-invariant registry: selection Config, InvariantInstaller/InvariantFailure, the empty-companion contract
http-server.md the HTTP carrier: WebRouteKind/WebRoute, match order, the claimable fallback seat, index taps
storage.md the storage subsystem: the backend contract (StorageBackend), StorageForms, DomainSpec/Domain, domain/changed
workspace.md the workspace registry: Workspace/WorkspaceId, registration and resolution, the session cwd relationship
client-modules.md the web plugin table: dshClient declarations, WebBootGraph wire composition, the bundle route and index tap
session-projection.md the projection seam: SessionProjectionMap, the pure ProjectionDefinition unit, ProjectionSnapshot's consistent cut, the change feed
telemetry.md the outbound session-reporting capability seam: TelemetryRecord/TelemetrySeverity, the TelemetryBackend contract, and the telemetry/record redact waterfall

Type declarations and their JSDoc on these pages are source-equivalent and drift-checked by pnpm run verify-type-equiv (see development.md). Ordinary blocks preserve complete declarations; public-api blocks preserve body-stripped public class declarations. Cordis services and events use each page's generated Cordis surface section.