DeepSeek Harness

DeepSeek Harness: Cordis Services and Injection

· 7 min read · 中文版

DeepSeek Harness uses Cordis plugins to provide and consume named services; declaring dependencies with inject lets the framework wait for required capabilities instead of relying on a hand-written startup order.

DeepSeek Harness: what are the three roles?

The Cordis primer describes a plugin as a function with optional inject and apply(ctx) fields, or a Service subclass mounted into a context. A service claims a stable key such as ctx.tools, ctx.llm or ctx.sessions. A consumer locates the capability through that key rather than importing a particular implementation. These roles are related, but a plugin and the service it provides are not interchangeable terms.

The architecture reference calls a swappable capability a seam with a service definition, a provider implementing it, and a consumer, often a model-facing tool. One package can combine roles. A definition alone does not supply a working implementation, and a consumer alone does not create the capability it uses.

A service definition, provider and consumer connected by a context

RoleResponsibilityExample of a question to ask
DefinitionEstablish the interfaceWhat contract must an implementation satisfy?
ProviderImplement the serviceWhich composition supplies it?
ConsumerUse the capabilityWhich service does it require?
ContextResolve scoped services and offer framework APIsWhich implementation is visible here?

DeepSeek Harness: how does injection coordinate startup?

A plugin declares required service names through inject. Cordis waits until those services exist before activating the plugin. This expresses a dependency without requiring authors to predict a global sequence of every plugin. It does not mean that installing a consumer automatically installs its provider, or that a service with the same name exists in every context.

The primer also describes configuration expressions: the Loader interpolates an entry's config after declared injections activate, against the plugin's context. Its disabled expression is evaluated at each mount decision against the loader context; other entry metadata stays literal. Include preserves nested row expressions until target activation. These timings matter when a configuration expression reads a service: the declared dependency and the context used for that expression are part of the design.

If activation fails, a waiting consumer may be downstream of a provider error. Inspect the original error and missing service before changing the consumer; startup diagnostics explains the evidence. A pending entry alone does not prove which provider is at fault.

DeepSeek Harness: how is a capability added or replaced?

  1. Identify the capability and its existing service definition. Read its methods and event contracts before choosing an extension point.
  2. Identify the provider in the selected composition and the consumers that use the key. Determine whether a package combines more than one role.
  3. Declare the services a consumer needs and use the context to obtain the capability. Keep the consumer's behavior tied to the documented interface, rather than assumptions about one implementation.
  4. Register the provider or consumer in the intended composition and scope. The architecture describes provider swaps through service seams; visibility still depends on context.
  5. Test both activation and a representative operation. On replacement or unload, check that registrations are withdrawn and that a new instance does not retain stale behavior.

For example, the architecture identifies ctx.llm as the model adapter seam and ctx.tools as the scoped tool registry. Registering an adapter on the former is a different extension from registering a model-facing capability on the latter. A service swap can change behavior across consumers that resolve that service; it should be evaluated against the shared contract, not only one caller's happy path.

DeepSeek Harness: where do events and cleanup fit?

Services expose direct capability calls; events are extension points for observation, interception and policy. The primer lists emit, waterfall, parallel, serial and bail dispatch modes. The mode is part of each event's contract. In particular, a waterfall listener receives next and delegates with next(); returning without it short-circuits downstream listeners. An observer that accidentally fails to delegate can change behavior rather than simply observe it.

Registrations such as listeners, tool schemas, adapters and prompt sections are reversible effects. Use ctx.effect() or a Cordis helper such as ctx.on() that manages disposal. If ordering during teardown matters, the primer recommends keeping related work in one effect so it unwinds in the intended order. Reload and teardown should remove the old registrations; a provider that starts successfully but leaves old listeners behind after replacement is not a complete integration.

The event mode and cleanup rule are independent of whether the service itself is present. A correctly injected service does not guarantee a listener delegates correctly. Likewise, correct disposal does not establish that a replacement provider implements the expected behavior. Test those properties separately.

DeepSeek Harness: what are the scope and safety limits?

A context is a scoped service container. The Context reference describes child contexts created by extend, isolate and intercept, without mutating the parent. In particular, isolate creates an independent scope for a named service. The presence of a service in one scope does not prove a consumer in another scope resolves the same implementation. See Context capabilities for the distinctions.

These mechanisms are composition tools, not an assurance that an installed provider or its data is trustworthy. Review the implementation and configuration appropriate to the deployment. The documentation does not promise that injection installs missing packages or validates external systems. An activated plugin can still fail when its actual operation runs.

How should a replacement be compared?

Run the same representative consumer operation before and after replacing the provider. Registration confirms that the provider appeared; the operation checks the interface behavior the consumer actually needs. Then reload or unload it and confirm its effects are withdrawn. These are separate observations, so preserve the result of each rather than declaring the entire integration correct from a single successful activation.

DeepSeek Harness: what do the terms mean?

  • Plugin: a unit mounted by Cordis, possibly acting in several roles.
  • Service definition: the interface for a capability.
  • Provider: an implementation made available under a context key.
  • Consumer: a plugin or component using the capability.
  • Injection: a declaration coordinating access to required services.
  • Effect: a registration with cleanup associated with its lifecycle.

Frequently asked questions

Does injection install a provider?

No. The provider must be present in the relevant composition and scope.

Why declare dependencies?

Cordis waits for required services before activating the consumer.

What happens on unload?

Lifecycle-managed registrations are disposed when their owning instance is torn down.

Sources

Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.

  1. Cordis primer
  2. Architecture
  3. Context reference

This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.

← Back to all articles

DeepSeek Harness: Cordis Services and Injection