Files
deepseek-harness/packages/core/agent-tool-presentation
Turtle d1e22a7e24 feat(preset): declare Agent compositions in profile YAML (#4569)
* feat(preset): declare Agent compositions in profile YAML

* fix(preset): share scope binding cleanup and refresh module graph

* fix(preset): use host syntax colors in the YAML editor

* fix(preset): write new profile declarations as block YAML

* fix(preset): align eager activation with browser and worker surfaces

* fix(ui-agent-preset): retain the existing preset card layout

* fix(preset): keep rows waiting for a Host service mounted and re-audit after settlement

A preset row whose Host provider was still activating at declaration time
was reported as waiting for a missing service, and the registry recorded the
definition as broken for the rest of the process. Split the mount audit into
failed and pending rows: failures and root-realm leaks still reject the
mount, while pending rows stay mounted and every read and binding re-audits
them after the Host Loader tree settles.

Remove the accidental self-dependency of @deepseek-ai/dsh-web-app and its
lockfile self-link. Archive the copy-only preset authoring note, which the
declarative-preset note fully supersedes, and update the ralph note's
restore recipe to the profile-patch mechanism.

* chore(lint): re-key and prune the unknown-cast baseline after the master merge

* refactor(web-app): ship each Agent preset as its own bundle patch file

`dsh.bundle.patch` accepts an ordered file list, so the four shipped preset
declarations move out of the 1000-line web patch into
`presets/<id>.patch.yml`, one insert per file, applied after the host patch.
The host patch keeps the preset registry row. Gates and test scaffolds that
read the web layer resolve every patch file through `bundlePatchPaths`
instead of one hardcoded path.

* refactor(preset): drop the save notice injected into live Agents

The notice duplicated the save result the Web editor already shows, and
after the producer-owned message sources it would have needed its own
persisted source kind. Saving now only persists and reports the activation
diagnostic; the persistence catalog is unchanged from master.

* docs: regenerate the module graph after dropping the registry's llm dependency

* test(ui-agent-preset): cover the guide dialog's keyboard handling on the declarative section

* fix(preset): address the remaining review comments

Apply the lowercase id rule only when creating a declaration, so presets
declared with other ids stay editable. Export `isBuiltInPreset` from the
display fold and key the client card groups on it. Remove the dead `error`
and `retry` locale keys, the JSDoc orphaned by the `trust` removal, the
`trust` fields in the plugin-inventory test fixtures, and the stale
`dsh-agent-presets` package name in comments and READMEs.

* refactor(preset): make the Web preset page view-and-select only

Remove the child-plugin YAML editor, the `agent_preset` tool and the
registry's read/save Remote methods. Presets are declared and changed only by
bundle patches; the settings page keeps the roster, the new-task default and
the mode help, and its question icon explains that and offers to start a
Creator-mode task. The `editing-cordis-compositions` skill and the Creator
persona describe the bundle-based path, and the authored skill-load Session
and Web snapshots are refreshed for it.

* docs(skill): make the composition skill self-sufficient for preset authoring

State where the shipped declarations live, list every declaration field,
inline a complete minimal bundle and an override example, and name the
verification calls, so Creator mode no longer reads DSH package sources to
infer the format. Refresh the authored skill-load Session for the new text.

* test(tools): drop the removed agent_preset tool from the catalog expectation
2026-09-21 08:24:18 +00:00
..
2026-09-17 21:11:19 +08:00

description, kind
description kind
The agent-plane presentation selector for users and maintainers choosing, configuring, or debugging which form of its tools an agent preset's models see. package-reference

@deepseek-ai/dsh-agent-tool-presentation

English | 中文

Summary

Use dsh-agent-tool-presentation in an agent preset to fix whether models see every native tool schema, only run_code with a generated SDK, or both forms. Each preset can choose independently, so native and PTC agents can share one process without sharing tool catalogs. Selecting ptc or both requires a compatible PTC runtime; a deployment without one rejects the preset at mount time before its first prompt. The mode field is required when this package is present, while omitting the package keeps the deployment default.

Table of Contents


Use this package

Add this row to an agent preset to fix how every agent joined to that preset sees its tools. native presents each visible tool schema as a function definition; ptc presents only the run_code transport plus a generated SDK and the rule that only run_code may be called directly; both presents both forms. Agents that declare nothing get the deployment-wide mode on the dsh-tools row.

Add the row to a preset

- name: '@deepseek-ai/dsh-agent-tool-presentation'
  config:
    mode: ptc
Field Default Meaning
mode required native — every schema; ptc — run_code plus generated SDK; both — both forms

The generated configuration catalog is the exhaustive source for every accepted field. mode is required rather than defaulted because a preset without this row inherits the deployment default.

What PTC mode requires

Selecting ptc or both needs a composed PTC runtime (ctx.ptcRuntime) whose language has a registered SDK renderer — the TypeScript runtime ships via dsh-ptc-runtime-node, and both the TypeScript and Python SDK renderers are built into dsh-tools. A preset that selects a PTC mode against a deployment composing no such runtime refuses to mount, naming this row, so the failure lands where the operator can act instead of at the session's first request.

One presentation per agent

One agent declares one presentation. A second declaration in the same composition is refused rather than merged: two answers to "which form does the model see" is a contradiction, not an override.


Understand the implementation

Implementation internals — click to expand

This section explains how the package realizes the behavior above; the observable contract is covered in Use this package.

Design concept

The tool registry cannot move into a preset: its consumers are all host-plane — the agent loop reads its scheduler, the API proxy reads its presenters, and every tool plugin registers into it — and a service only moves down when all of its consumers move with it. What a preset can own is the presentation of that registry. ctx.tools.presentAs() declares it for the mounting scope, which is the preset's standing mount, so the declaration covers every agent joined to that preset and a PTC mode preset runs beside native ones in one process. One row per composition, not one per session.

Source map

File Role
src/index.ts Plugin entry: mode config, apply wiring ctx.tools.presentAs for the mounting scope
— No runtime invariant companion is published; this package makes exactly one scoped call into ctx.tools and owns no event or snapshot of its own; the relation it establishes — which presentation one agent's assembly uses — is the tool registry's to hold, and dsh-tools observes it there.

Behavior notes

native applies immediately. A PTC mode instead waits for ctx.ptcRuntime, a host-plane service: a preset selecting PTC mode against a deployment composing no runtime holds this row pending, and dsh-agent-preset-registry refuses the mount naming this id. presentAs is itself the effect, so the declaration unwinds with this row without a second wrapper owning it.


Further Exploration

The package-level contract is enough for most consumers; read these when you need the surrounding domain.


Model Experience

Indirectly, through the tool presentation it selects in dsh-tools — the row only chooses between the two projections dsh-tools owns and registers no prompt, schema, or result of its own.

KV Cache effect

No direct invalidation; the presentation is fixed when the agent is composed, so its request prefix is stable for the session's life.

Known Limitations and Deferred Work

These limits define when this row needs special care. They are current package constraints, not a task backlog.

  • The runtime stays host-plane — a preset can select PTC mode but cannot supply the TypeScript runtime it needs; a deployment that composes none can compose no PTC preset.

Dev Note

Working context for maintainers — click to expand

None.