Files
deepseek-harness/packages/api/remotes
a39d44b5dc feat(session): add host reading status to SessionStatus (#6858)
* ✨ feat(session): persist and synchronize read state

* 🌐 fix(client): complete Japanese labels after base update

* 📝 docs: refresh session read-state dependency graph

* 🧪 test(web): align session menu and read-state snapshots

* 🌐 fix(session): complete Japanese plugin metadata

* 🧪 test(web): distinguish unread from pending user input

* 🐛 修复会话阅读状态的故障隔离与生命周期

* 🐛 修复阅读状态依赖检查并补齐自动已读覆盖

* 🐛 恢复会话绿点并移除未读标题加粗

* ♻️ Keep shared session reading state in Host memory

* 🌐 Complete reading-state metadata for supported locales

* 📝 Refresh module graph after removing storage dependency

* 🧹 Move storage dependency policy out of memory-only reading

* 🐛 Wait for sidebar catalog before replay navigation

* 🔧 Give Host TypeScript checks 8 GiB of heap

* ✅ Align Host heap checks and Windows diagnostics

* ♻️ Keep CI repairs outside the session reading PR

* 🐛 Show failed unread turns with an error indicator

* 🔧 Adjust npm layout budget for the reading package

* 🧪 Scope projection stream assertions to observed units

* 🧪 Scope permission and title assertions to their projections

* ♻️ Simplify session reading updates to explicit positions

* 🐛 Align session reading package with release version

* 🧪 Load reading state in LiveShare viewer fixtures

* 🧹 Remove persistence-only type link from memory PR

* 🧪 Align context menu expectations with reading actions

* 🐛 Sync reading package with the release version

* 🧪 Include turn boundaries in session summary expectations

* ♻️ Derive reading failure facts from Host events instead of a projection

The reading service took each completion from the Agent turn-boundary
projection, which forced a stateVersion bump and put that projection's whole
internal state on the wire for every Session list row. The service now records
`turn/end` itself, so `core/agent` and the persisted projection schema are
untouched.

History that ended before the service started raises no reminder, which keeps
"existing history reads as read" without a startup scan. The failure flag
therefore describes only turns this Host observed: marking a Session whose last
turn failed before a restart shows the ordinary unread reminder.

* 🐛 Preserve manual unread until explicit Session interaction

* 🧪 Align cold Session reading snapshot with unloaded title

* 🔖 chore(session): align session-read-state with 0.2.2-rc.2

Master moved the root and every released manifest to 0.2.2-rc.2, but the
new dsh-session-read-state package still declared 0.2.2-rc.1, failing
constraints, verify-version-sync, verify-npm-install-layout, and
release:verify after the master merge.

* ♻️ refactor(gateway): recognize Remote stream carrier loss by error code

RemoteStream now decides whether a generation end or failure is a
retryable carrier loss by the stable code 'gateway/carrier-lost' instead
of `instanceof RemoteStreamCarrierError`. RemoteStreamCarrierError keeps
working and carries that code, so existing callers are unchanged, while a
Client feature package can return a coded Error from `ended` without
importing the class. The new RemoteStreamCarrierFailure type describes
such errors; terminal-controller classifies disconnects the same way.

* ♻️ refactor(session): move Session reading into ui-session-status

Fold the reading feature into the single package
packages/client/ui-session-status and delete session-read-state.

- Host face: SessionStatusService keeps in-memory reading records and
  serves the sessionStatus Remote namespace (mark, follow) with
  session-status/* error codes; its service key is registered only for
  Gateway discovery and is not declared on Context.
- Client face: a package-internal reading model follows the Host stream
  through RemoteSnapshotStream; ctx.uiSession.sessionStatus folds the
  records into completionUnread and completionFailed and exposes mark and
  readingReady; main-view acknowledgement and the
  session-status/read-intent event live here. No reading service or type
  is exported.
- verify-client-packages lets a packages/client feature package request
  packages/api rows through dsh.client.external; feature-to-feature
  requests stay rejected.
- ui-workspace, ui-conversation, bundles, remotes, LiveShare, the client
  test runtime, docs, Agent Notes, and the upgrade guide follow.

* ♻️ refactor(session): clear manual unread only when the main view switches to the Session

Remove the session-status/read-intent event. ui-session-status now clears an
existing manual unread mark when the main view switches to a different
Session, including the first selection after a page load, once the reading
baseline is ready and the body arrives. Window focus, visibility changes,
a replaced binding for the same Session, and activity in the open Session
preserve manual unread.

ui-conversation returns to master (only the ui-session-status client
tsconfig reference remains), and ui-workspace navigation no longer emits
the event. Tests, the session-reading Web e2e case, READMEs, and the
reading Agent Note follow the new rule.

* 🐛 fix(session): address the Session status review findings

- Open the reading stream only while ctx.remoteAccess allows
  sessionStatus/follow, so a LiveShare viewer opens no owner-only stream,
  keeps readingReady false, and logs no synchronization failure; access
  changes start or stop the stream.
- Hide the unacknowledged completion of the Session the visible, focused
  main view retains; manual marks stay visible, completionFailed follows
  completionUnread, and the reminder returns on blur, hiding, or a switch.
- Declare ctx.sessionStatus on Context and restore its SERVICE_PAGE and
  SERVICE_ROLES entries; the service and SessionRead* types document on
  docs/subsystems/web-client.md, which now owns the reading section with
  the failed field.
- Document that a Host plugin reload can leave the Client with a terminal
  error until a page reload; drop the redundant types import and the
  unused publish() result.
- Archived Sessions read as read and offer no reading mark in the row
  menu or the toggle-read shortcut.
- session.toggleRead names the open dialog, open panel, or archived
  Session that blocks it instead of asking to select a Session.
- isRemoteStreamCarrierFailure rejects a RemoteError from the Host even
  when it carries gateway/carrier-lost; the code is Client-local.
- ./types is types-only like ui-trajectory, and files no longer ship
  lib/types JavaScript.

* 🐛 fix(session): close the remaining Session status review gaps

- The Gateway Client exports isRemoteStreamCarrierFailure, and the
  terminal view uses it, so a Host RemoteError carrying the carrier code
  shows as failed rather than disconnected.
- Each access grant's reading stream carries a token: frames a revoked
  or superseded stream still delivers are discarded, and cleanup waits
  for disposal before leaving reading unavailable unless a newer grant
  is active.
- The status table hides the viewed Session's natural reminder only
  while that Session is open; the panel case is a documented limitation.
- The README limitation and the upgrade guide state that only the
  main-view switch rule, including a reload restore, clears manual
  unread automatically.
- Add the missing blank line before the next heading in the web-client
  reading section.

* ♻️ refactor(session): install reading under the Session status table

- apply returns to master's form plus one line: UiSessionStatus is the
  root, published as the useSessionStatus source, and installReading()
  from the new src/client/read.ts follows Host reading records into it.
  UiSessionStatus takes master's three constructor parameters and
  creates its own SessionReadModel as the package-internal `reading`
  member; installSessionStatus is removed and acknowledge.ts stays a
  separate file.
- The viewed Session's snapshot subscription republishes the table only
  when its openState changes, so streamed events do not rebuild it.
- Remove the obsolete Dev Note sentence about failure outcomes.
- session.toggleRead passes when the Peer may not mark reading, matching
  the row menu, and reports readingUnavailable only while unsynchronized.

---------

Co-authored-by: imccyu <[email protected]>
Co-authored-by: imccyu <[email protected]>
2026-11-12 05:35:57 +00:00
..

description, kind
description kind
Application Remote assembly: selects typed Host capabilities and forwarded events for Client consumers. package-reference

@deepseek-ai/dsh-api-remotes

English | 中文

Desktop analytics follows the product collection policy, including its live application setting. Web usage is excluded.

Summary

Two-sided BFF for Host Remote capabilities selected by this application. The Host entry owns the forwarded-event selection and registers its application event source with API Gateway; the Client entry imports generated /remote artifacts as runtime values, mounts each contribution through ctx.remote.$mount(), and re-exports their declaration merges. Client business packages depend on this facade rather than the Gateway implementation or individual Remote runtime entries.

Table of Contents


Use this package

@deepseek-ai/dsh-api-session-controller owns Agent and Session identity policy, including the Typert lookup resolvers used by other namespaces. This package selects and mounts that generated Session contribution without a direct runtime dependency on @deepseek-ai/dsh-session; activation policy stays with Session Controller.

The Client assembly mounts Office conversion, Commands, Agent Teams, credentials, settings, Goal, Schedule, dynamic Cordis, file and Session references, read-only Host plugin inventory, plugin-installation registry response comparison, message feedback, permission presets, Session Controller, subagents, web provider list, and Workspace Controller contributions. The permissionPresets namespace returns the complete process-level catalog used by current-session controls. Cordis effect ownership withdraws every contribution when this assembly unloads, while @deepseek-ai/dsh-api-gateway/client owns descriptor validation, traced namespace Services, direct and scoped methods, invocation, streams, and cancellation. The Client entry consumes the shared TypertClientRemote interface through Cordis and does not import the concrete Gateway. It re-exports the Gateway Client face's declaration merges type-only, so a consumer reaching the forwarded-event vocabulary through this facade gains no runtime edge to the Gateway implementation.

This facade is also the front door for the wire type vocabulary a Client package names. It re-exports, type-only, the Remote failure vocabulary (RemoteResult, RemoteFailure, RemoteErrorCode, RemoteErrorDetailsMap), the Host facts (RemoteHostFacts), and each selected domain's client-safe payload types, so a Client feature package imports one specifier instead of reaching into dsh-typert-protocol, the Gateway, or an owner's Host entry. Two kinds of package deliberately skip this door: the API-layer packages this assembly itself selects — importing it back would close a dependency cycle — and their tests, which take the failure vocabulary from dsh-typert-protocol directly. A UI package's tests instead take the RemoteError constructor from dsh-client-test-runtime.

This package owns no physical transport or Host service discovery. It projects the application selection into generated Remote contributions and an independent Host event source per Client; API Gateway owns endpoints, carriers, cancellation, and reconnection. Its Client face can be reused by Web or a future TUI that provides the same React-free ctx.remote contract.


Forwarded Host events

src/remote-events.ts holds API_REMOTE_FORWARDED_EVENTS, the allowlist of Host Cordis events this application forwards without renaming, and therefore the legal key set of ctx.remote.$on; each entry also selects ordinary emission or Agent-scoped waterfall delivery. The type-only src/types.ts derives its selection face. Forwarding one more event requires one entry in that array: the type projection, consumer key face, and Host forwarding loop all derive from it.

The listener signature is not restated here. Each allowlisted event's Cordis Events declaration lives in its owner package's client-safe ./types export, and both faces of this package pull those declarations in. The Host face additionally asserts every entry against TypertForwardableEventEntry: an emit entry must be a declared one-way event, while a waterfall entry must be a declared Agent-scoped waterfall whose final parameter is its same-result next() callback.

An emit entry may declare resources, readers keyed by TypertResourceMap kind and typed by the event's own parameters, such as resources: { session: summary => summary.sessionId } on api-session/added. The Host entry attaches them to each forwarded frame unchanged, and the Gateway forwards a notification to a non-owner Peer only when access control allows the event on the resources they name; a notification without resources touches the built-in global resource. api-session/activity, api-session/added, api-session/error, api-session/removed, and api-session/status declare their Session. A notification names one resource identity or none; collection changes travel on follow streams instead.

The Host entry registers an independent allowlist listener set and queue for each Client stream. It rejects non-JSON ordinary-event arguments before enqueueing. For a waterfall, it projects only the top-level Agent identity and JSON request fields; a Client result must also be lossless JSON, while next() delegates to the following Host listener. Each scoped waterfall request must carry its routed Agent directly as request.agent; the Host rejects a missing or mismatched identity before forwarding. The source attaches all listeners synchronously before ctx.typertGateway.registerRemoteEvents() exposes Gateway's internal $events logical stream, so its first ready item proves that incremental delivery is active and carries the Host home for Client path display. Withdrawing the registration aborts active streams.

The payload-free schedule/changed event invalidates Schedule task queries; Clients re-read after a notification and reconnect. The payload-free permission-presets/catalog-changed event invalidates the process catalog. A Client subscribes before its first permissionPresets.catalog() read and re-reads the complete snapshot after a notification; the event carries no catalog state and changes no Session sequence. The payload-free web/providers-changed event invalidates the web.listProviders() provider lists; Clients re-read after a notification and reconnect.

Build boundary

Most repository packages belong to one TypeScript face: Host packages are registered in the root tsconfig.host.json, and Client packages in the root tsconfig.client.json. This package splits because its Host entry must participate in the Host Typert graph, while src/client/index.ts cannot compile until the source-only generation step has written the business packages' /remote declarations.

This package's root tsconfig.json is only a solution that references tsconfig.host.json and tsconfig.client.json. The Host aggregate and direct Host consumers reference the former, while the Client aggregate and direct Client consumers reference the latter; the package-root solution must not enter either aggregate's dependency graph. The two projects own disjoint source files and .tsbuildinfo files but share the lib/types output directory, with one deliberate exception: src/remote-events.ts and src/types.ts are listed in BOTH faces' files, because the forwarded-event allowlist is the single control point over what a consumer can receive, and the Host forwarding loop and the Client ctx.remote.$on key face must read one declaration rather than two that could drift.

That exception is not just a files entry. The root tsconfig.base.json maps @deepseek-ai/dsh-api-remotes/types to src/types.ts — the source plane, like every other workspace subpath and unlike the generated /remote artifacts, which have no paths entry and resolve through exports to built output. Both faces therefore admit the same allowlist and type projection into their own programs and emit byte-identical remote-events and types outputs into lib/types; the .tsbuildinfo files stay independent. No gate enforces the faces' source-file disjointness — scripts/project-reference-faces.ts only checks that a reference into a split project names the matching face — so this paragraph records why the double listing is intentional.

The package-local clientBundle(..., { hostPhase: true }) makes Host tsdown bundle the Host entry and the later Client tsdown bundle only the browser entry. Ordinary Client plugins remain single Client projects and produce both their Node loader entry and browser bundle during Client tsdown; split only when the two source sets require different compiler faces.

Model Experience

None, as this BFF selects Remote application methods and forwarded events but registers nothing model-facing.

KV Cache effect

No direct effect; mounted Host capabilities own any model-visible behavior they trigger.

Known Limitations and Deferred Work

  • The capability set is fixed by explicit build-time value imports; the Client does not discover the Host's active Services or Remote definitions at runtime.
  • Additional capabilities require an explicit /remote value import and mount in this assembly.
  • Only scoped waterfalls that are still pending are replayed after reconnection; ordinary one-way notifications remain isolated best-effort deliveries and are not replayed. State that requires reliable recovery needs an owner-provided query, cursor, or opening baseline.

Dev Note

Working context for maintainers — click to expand

None.

The Client assembly includes the account namespace for login commands and reconnectable account snapshots.