Files
deepseek-harness/packages/extensions/tool-cordis
imccyuandimccyu e25df02c51 refactor(session): prepare Session validation and header building for SessionData (#8676)
* refactor(session): move Session log validation into a module

Move header, seed-event envelope, and inherited-cut validation out of the
Session constructor into validation.ts without changing check order or error
text. Export needsInheritedSeedMarker for the fork marker rule the
constructor applies.

* feat(session): validate a Session log without constructing a Session

validateSessionLog composes the header, seed-event, surface, and
inherited-cut checks of Session construction in the same order. Omitting
eventState matches Session.create; an event state matches
Session.fromRestore.

* refactor: validate stored Session logs with validateSessionLog

The chat importer, session-query readSession, the format catalog, and JSONL
generation verification constructed a discarded Session only to validate a
log. They now call validateSessionLog with the same mode, inherited count,
and message interpreters.

* refactor(session): extract buildSessionHeader

Move new-Session header construction out of SessionStore.prepare into the
exported buildSessionHeader and name its input SessionHeaderMeta.
Automatic ids and duplicate checks stay in prepare.

* refactor(session): move header and fork error helpers out of the session index

Move buildSessionHeader into validation.ts and SessionForkError with
SessionForkErrorCode into fork.ts so later modules can import them without
importing index.ts. index.ts re-exports both under the same names. Complete
the JSDoc of the exported validation helpers.

* refactor(session): extract checkSessionLog from the Session constructor

Move header validation, seed acceptance with surface admission, and the inherited-cut check into checkSessionLog in validation.ts, keeping the constructor's order and errors. The Session constructor and validateSessionLog call it.

* test(session): cover Session log validation and construction helpers

Cover validateSessionLog against Session.create and Session.fromRestore in
every event state, buildSessionHeader, needsInheritedSeedMarker,
Session.readEvents range semantics, and the fork subpath export of
SessionForkError.

* docs(session): document Session log validation

Document validateSessionLog, buildSessionHeader, needsInheritedSeedMarker,
Session.readEvents, and the SessionForkError subpath export in the package
README. Align the Session and CreateSessionOptions type blocks, add
SessionHeaderMeta, regenerate the Cordis, event graph, and persistence
catalogs, and update the plugin entry, unknown-cast, and package dependency
registries.

---------

Co-authored-by: imccyu <[email protected]>
2026-11-20 00:11:27 +08:00
..

description, kind
description kind
Read-only runtime API discovery for agents developing and configuring installed Harness plugins. package-reference

@deepseek-ai/dsh-tool-cordis

English | 中文

Summary

Inspect Host and Client runtime APIs before writing plugin code. Standard and Creator modes provide this read-only tool alongside Plugin Manager, which owns persistent profile changes. The inspection registry is supplied by the Cordis host runner; browser queries need a connected page.

Table of Contents


Use this package

Standard and Creator modes include this tool. Other compositions mount @deepseek-ai/dsh-tool-cordis/host once in the host composition beside the host runner that provides cordisInspect, and @deepseek-ai/dsh-tool-cordis in each agent preset that exposes the tool; a preset row alone registers no Host providers. Call cordis_inspect without query to discover providers, then pass a query object with platform, provider, method, and optional input to read a provider's exact methods and types. The Host Config provider lists live Loader entries in pages (offset, limit up to 100, optional exact plugin name; total and nextOffset bound the walk) with each entry's Loader id, the tree-local id patches address, and its Config status (schema, absent, unsupported, tree for group and include carriers, inactive for disabled, never imported, or disposed entries), and projects one entry's native Config into a self-contained JSON Schema document beside the entry's packageDir, the resolved directory holding the package README and built lib/, when the profile package lookup resolves it. The Host Runtime provider's getVersion returns { version }, the exact running DSH version that plugin engines.dsh ranges and DSH peer dependencies are checked against. A call without an Agent, or a Config query on a Host without a Loader, fails with ToolContextUnavailableError; a malformed Config paging field fails with ToolArgsError; and an unknown entry id fails with InspectError INSPECT_TARGET_NOT_FOUND. Use Plugin Manager to install bundles containing plugin code or MCP configuration.


Understand the implementation

Implementation internals — click to expand

Host providers combine generated Service/Event catalogs, the live Loader tree projected through the app-boot Config projector, the requesting agent's tool registry, and the app-boot runtime version. Client providers synchronize their manifests through the existing inspection registry and answer queries from a connected page. The host entry owns the Host provider registrations and the preset row owns the tool, each through Cordis effects; the registry rejects a duplicate provider id, which is why the providers register once per process rather than per preset.


Further Exploration

Model Experience

Runtime inspection

What the model sees

The tool catalog describes one read-only inspection tool whose description explains directory discovery and queries without adding a system prompt section. In the standard and cordis presets, the first-turn skill catalog carries the description of the shipped dsh-doc skill, which covers questions about DSH and requests to build or change DSH plugins, MCP connections, and agent presets; its references cover Plugin Manager, MCP setup, Client packaging, and slot registration. Query results contain the requested API declarations, live tool schemas, the live entry directory with Config status, one entry's projected Config JSON Schema, or the running DSH version.

Token effect

In the shipped Standard and Creator modes, this plugin contributes one tool schema to each model request. Query results append to the transcript; exact queries avoid loading unrelated declarations.

KV Cache effect

Unchanged tool schemas remain prefix-stable. Query results append to history; enabling other plugins can change subsequent tool schemas.

Known Limitations and Deferred Work

  • Client queries need a responding page and use the Host runner's bounded wait and retry policy. Inspection cannot invoke service methods, configure plugins, or execute generated code.
  • Config.listConfigs walks the profile Loader tree only. Agent preset plugins lists mount in detached preset trees, so a plugin present only inside a preset declaration is not listed unless the profile tree also mounts it.

Dev Note

None.