DeepSeek Harness

DeepSeek Harness: How Session Events Become Views

· 7 min read · 中文版

DeepSeek Harness projections turn an ordered session event log into current, domain-specific values. The host folds events and sends whole views to clients; a cached listing can lag the log, while a live snapshot has a shared sequence watermark.

DeepSeek Harness: what is being projected?

The projection reference describes an optional capability. A registry subscribes once to session/event and drives every registered unit over committed events. Each domain owns its calculation; the framework owns the drive. Clients receive finished values rather than independently folding domain events. Rendering belongs to the client slot system, not the projection layer.

The persistence reference describes a separate contract for stored sessions and their event logs. A projection is derived state, not a replacement for that log. A stored event may represent an operation or a whole value; the domain's fold determines its effect on the current view. To investigate what was persisted, read the log and its durability state, rather than inferring all past events from one displayed value.

A session log is folded into consistent views and optional cached checkpoints

ArtifactPurposeImportant qualification
Session event logOrdered interaction factsStored durability depends on persistence and flush
Unit stateHost-side accumulated domain statePlain JSON; not necessarily client-visible
Wire viewWhole current value for one keyMust pass its view schema
Live snapshotA consistent cut across visible valuesCarries asOfSeq
Cached listingFast previously checkpointed valuesMay lag and is labelled cached

DeepSeek Harness: how does a unit fold events?

A ProjectionDefinition declares a key, stateSchema, init, apply, optional wire and stateVersion. init receives immutable session header information and the inherited event count. apply takes the previous state and one committed event and returns the next state. Functions are synchronous and the state is plain JSON, enabling a consistent cut and persisted cache. For an event that does not concern the unit, returning the same reference avoids downstream work.

A wire-enabled unit defines a view and viewSchema. The view is the complete current value for its key, not an incremental patch. A host-only unit has no wire block and is absent from client snapshots. The registry compares raw view results with Object.is when deciding whether to emit a change. An object-valued view must reuse its reference when internal state changes do not alter that view; creating a fresh object each time can cause unnecessary publication.

The registry drives new events eagerly, while its per-session cells are created lazily. If a session predates the registry, or a unit is registered after events have already flowed, first access folds the in-memory log. Unloading a domain registration removes its key and cells after its last registration is disposed; a missing key can therefore mean the capability is absent, not that the domain's state is an empty value.

DeepSeek Harness: what does a client receive?

snapshot(session) synchronously reads visible unit values at one shared asOfSeq, the sequence of the last event reflected by all of them; an empty log uses -1. Each value is validated through its view schema. The session controller can take this snapshot in the same tick as a history page slice, keeping the page and values at one consistency cut. Subsequent session/projection frames carry changed whole values. They are not a request for the client to replay every event.

A change feed reports the session, key, validated value and the event sequence that produced the change. A state change does not automatically imply a view change: a unit may update internal bookkeeping while producing the same client-visible value. This distinction helps when debugging a UI that did not receive a new frame. Check the unit's state transition and view identity before assuming an event was lost.

DeepSeek Harness: how does a cache affect replay?

A persisted projection cache records versioned per-unit state and a sequence watermark. A unit must increment stateVersion when serialized fields or fold semantics change, so incompatible older rows are discarded rather than applied as if they were current. Valid rows can seed a fold, after which the remaining event tail advances the state. A missing or incompatible row requires rebuilding that unit from the relevant log.

For a cold snapshot, the caller supplies the complete log in sequence order; the cache service does not read persistence itself. The service can skip applying already covered events for valid rows and writes an updated checkpoint on a fail-soft path. A prepared-session hydration can use supplied events without another persistence read and does not write a checkpoint, because its observation may contain recovery events that are not yet durable.

A listing can instead use a header-matched cached snapshot without reading the log. It is only as recent as its durable checkpoint, and its asOfSeq is the lowest watermark among the served rows. The client treats it as cached and allows connected session values to supersede it. A cached title is useful for a list; it is not proof that the underlying session's current projection is identical.

DeepSeek Harness: how can I trace a surprising view?

  1. Identify the session and whether the value came from a listing cache, a live snapshot or a change frame. Record the associated sequence watermark where available.
  2. Check that the projection registry and the domain unit are present in the current composition. Confirm whether the unit has a wire view or is host-only.
  3. Compare the relevant committed events with init and apply for the deployed version. Check inherited history as well as events after the starting state.
  4. For a stale listing, compare the cache identity, stateVersion and checkpoint position with the connected view. Do not assume a cached watermark can be compared to a separately opened log in isolation.
  5. For missing updates, inspect whether the state and raw view references actually changed and whether schema validation succeeded. Then check the carrier and client rendering separately.

The persistence handle reads a valid contiguous prefix, and a resolved flush is the contract's durability barrier for acknowledged appends. A live event, a stored prefix and a cache checkpoint answer different questions. Record which evidence you observed before diagnosing a missing or outdated value.

For a concrete comparison, imagine a unit whose internal state tracks several facts while its wire view exposes only one status. An event can update a fact without changing that status. The fold has progressed to a new event, yet the view reference can stay the same and no change notification is needed for that key. A later full snapshot still reports a shared cut across its selected visible values. This example illustrates the contract; it does not prescribe a particular built-in projection schema.

A cache is an optimization with an identity boundary. Listing reads match the session header to the cached lifecycle and return compatible rows, rather than treating a matching display name as identity. When the session connects, its live values supersede the cached hint. When investigating a mismatch, capture the source and cut of each value before comparing them; two observations at different times need not match even when both are valid.

DeepSeek Harness: what are the limits and safety boundaries?

Projection is optional and a particular plugin may not register a key in every deployment. A client-visible value is derived, so it cannot reconstruct every event, and a cached value can lag. Cache-write failures are logged and handled fail-soft on documented automatic paths; the explicit cache write API has its own failure behavior. Do not treat the existence of a checkpoint as proof that every later event was persisted.

Session events and projections may include private conversation or tool data. Limit access to diagnostic exports and remove sensitive content before sharing. Read-only inspection does not anonymize it, and manually changing an actively owned log is not a repair procedure.

A checkpoint is not a second authoritative conversation. Its versioned rows are useful only when they match the unit and session identity, and replay is still defined by the event sequence. If a plugin is unloaded, the corresponding key can disappear from later snapshots without deleting historical events. These distinctions help operators decide whether to inspect registration, the cache, or the underlying log first.

DeepSeek Harness: what do these terms mean?

  • Fold: a deterministic transition from prior state and one event to next state.
  • Wire view: the whole client-visible value produced by a unit.
  • Watermark: the event sequence through which a state or snapshot is current.
  • Checkpoint: stored versioned state used to avoid refolding a covered prefix.
  • Cold session: a persisted session being examined without a live session owner.

Frequently asked questions

Do clients fold every event themselves?

No. The host drives units and sends complete client-visible values.

Can a cached listing be stale?

Yes. It reflects the last usable durable checkpoint and is labelled cached.

Does a projection replace the event log?

No. It is derived state and does not reconstruct every original event.

Sources

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

  1. Session projections
  2. Session persistence

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: How Session Events Become Views