docs: document controller Remote transport

This commit is contained in:
imccyu
2026-08-23 16:16:03 +08:00
parent 54d739cf53
commit 9b1069c234
41 changed files with 1275 additions and 178 deletions
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/capability-seams.md
capability-seams.md: 16185120530cc6fca607aed5c66502c1122e18fb
capability-seams.zh.md: d6c41023887c66c87cfd4fb65b007732b8b2e330
capability-seams.md: b1faa5d4dce37eb338921c7117d451aae9ad252e
capability-seams.zh.md: 52c63e1491f184e7578b2eb6647fa5ff63a9e60b
+6 -1
View File
@@ -35,6 +35,9 @@ flowchart LR
pkg_subagent_inprocess["subagent-inprocess"]
pkg_invariants["invariants"]
pkg_message_feedback["message-feedback"]
pkg_api_session_controller["api-session-controller"]
svc_sessionController["ctx.sessionController<br/>Host Session Remote controller"]
pkg_apiproxy["apiproxy"]
svc_invariants["ctx.invariants<br/>Package-owned invariant registry"]
pkg_scope["scope"]
pkg_typert_registry["typert-registry"]
@@ -51,7 +54,6 @@ flowchart LR
pkg_settings["settings"]
svc_settings["ctx.settings<br/>User-settings seam"]
pkg_settings_file["settings-file"]
pkg_apiproxy["apiproxy"]
pkg_credentials["credentials"]
svc_credentials["ctx.credentials<br/>Credential seam"]
pkg_credentials_local["credentials-local"]
@@ -215,6 +217,7 @@ flowchart LR
pkg_agent_presets --> svc_agentPresets
pkg_agent_team --> svc_agentTeams
pkg_api_gateway --> svc_typertGateway
pkg_api_session_controller --> svc_sessionController
pkg_apiproxy --> svc_apiProxy
pkg_approval --> svc_approval
pkg_attachment --> svc_attachments
@@ -359,6 +362,7 @@ flowchart LR
svc_sandboxPolicy --> pkg_bash_sandbox
svc_sandboxPolicy --> pkg_fs_sandbox
svc_sandboxPolicy --> pkg_terminal_bash
svc_sessionController --> pkg_apiproxy
svc_sessionPersistence --> pkg_agent_loop
svc_sessionPersistence --> pkg_hooks_claude_code
svc_sessionPersistence --> pkg_hooks_codex
@@ -444,6 +448,7 @@ flowchart LR
| `ctx.tokenMeter` | `core` | [`token-meter`](../packages/llm/token-meter) | - | [`compaction-basic`](../packages/compaction/compaction-basic) | - | Owns isolated per-session replay folds; pressure consumers share immutable revisioned measurements. |
| `ctx.toolResultPruner` | `core` | [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner) | - | [`compaction-basic`](../packages/compaction/compaction-basic) | - | Rewrites oversized current tool results through replayable single-node surface replacements before summary compaction. |
| `ctx.sessions` | `core` | [`session`](../packages/core/session) | - | [`agent-loop`](../packages/core/agent-loop), [`agent`](../packages/core/agent), [`session-persistence`](../packages/session/session-persistence), [`session-query`](../packages/session-query/session-query), [`session-query-sqlite`](../packages/session-query/session-query-sqlite), `subagent-inprocess`, [`invariants`](../packages/runtime-diagnostics/invariants), [`message-feedback`](../packages/feedback/message-feedback) | - | Owns append-only Session instances and emits the durable session event feed. |
| `ctx.sessionController` | `core` | [`api-session-controller`](../packages/api/session-controller) | - | `apiproxy` | - | Owns Session commands, cold reads, durable-event following, live control state, and Agent activation policy; apiProxy reuses its inspection and Agent-resolution operations for Session-aware domains. |
| `ctx.invariants` | `core` | [`invariants`](../packages/runtime-diagnostics/invariants) | - | [`session`](../packages/core/session), [`agent`](../packages/core/agent), [`scope`](../packages/core/scope), [`agent-loop`](../packages/core/agent-loop) | - | Companion subpaths register owner-local checks; the service owns selection, uniqueness, child fibers, and package-attributed failures. |
| `ctx.typert` | `core` | [`typert-registry`](../packages/typert/registry) | - | [`typert-loader`](../packages/typert/loader), [`api-gateway`](../packages/api/gateway) | - | Plugins register live zod contributions directly or through dsh-typert-loader; the API gateway consumes invocation descriptors and providers, while other runtime consumers query schemas and reflection metadata at their own edges. |
| `ctx.typertGateway` | `core` | [`api-gateway`](../packages/api/gateway) | - | - | - | Associates generated Remote descriptors with live Cordis services, resolves registered identities, and exposes unary calls through the shared Connection RPC carrier. |
+6 -1
View File
@@ -37,6 +37,9 @@ flowchart LR
pkg_subagent_inprocess["subagent-inprocess"]
pkg_invariants["invariants"]
pkg_message_feedback["message-feedback"]
pkg_api_session_controller["api-session-controller"]
svc_sessionController["ctx.sessionController<br/>Host Session Remote controller"]
pkg_apiproxy["apiproxy"]
svc_invariants["ctx.invariants<br/>Package-owned invariant registry"]
pkg_scope["scope"]
pkg_typert_registry["typert-registry"]
@@ -53,7 +56,6 @@ flowchart LR
pkg_settings["settings"]
svc_settings["ctx.settings<br/>User-settings seam"]
pkg_settings_file["settings-file"]
pkg_apiproxy["apiproxy"]
pkg_credentials["credentials"]
svc_credentials["ctx.credentials<br/>Credential seam"]
pkg_credentials_local["credentials-local"]
@@ -217,6 +219,7 @@ flowchart LR
pkg_agent_presets --> svc_agentPresets
pkg_agent_team --> svc_agentTeams
pkg_api_gateway --> svc_typertGateway
pkg_api_session_controller --> svc_sessionController
pkg_apiproxy --> svc_apiProxy
pkg_approval --> svc_approval
pkg_attachment --> svc_attachments
@@ -361,6 +364,7 @@ flowchart LR
svc_sandboxPolicy --> pkg_bash_sandbox
svc_sandboxPolicy --> pkg_fs_sandbox
svc_sandboxPolicy --> pkg_terminal_bash
svc_sessionController --> pkg_apiproxy
svc_sessionPersistence --> pkg_agent_loop
svc_sessionPersistence --> pkg_hooks_claude_code
svc_sessionPersistence --> pkg_hooks_codex
@@ -446,6 +450,7 @@ flowchart LR
| `ctx.tokenMeter` | `core` | [`token-meter`](../packages/llm/token-meter) | - | [`compaction-basic`](../packages/compaction/compaction-basic) | - | 拥有按会话隔离的回放折叠区;压力消费方共享不可变且带修订版本的测量结果。 |
| `ctx.toolResultPruner` | `core` | [`compaction-tool-result-pruner`](../packages/compaction/compaction-tool-result-pruner) | - | [`compaction-basic`](../packages/compaction/compaction-basic) | - | 在摘要压缩前,通过可回放的单节点表层替换来改写过大的当前工具结果。 |
| `ctx.sessions` | `core` | [`session`](../packages/core/session) | - | [`agent-loop`](../packages/core/agent-loop), [`agent`](../packages/core/agent), [`session-persistence`](../packages/session/session-persistence), [`session-query`](../packages/session-query/session-query), [`session-query-sqlite`](../packages/session-query/session-query-sqlite), `subagent-inprocess`, [`invariants`](../packages/runtime-diagnostics/invariants), [`message-feedback`](../packages/feedback/message-feedback) | - | 拥有仅追加的 Session 实例,并发出持久的会话事件流。 |
| `ctx.sessionController` | `core` | [`api-session-controller`](../packages/api/session-controller) | - | `apiproxy` | - | 负责 Session 命令、冷读取、持久事件跟随、实时控制状态与 Agent 激活策略;apiProxy 在需要 Session 上下文的领域中复用其检查和 Agent 解析操作。 |
| `ctx.invariants` | `core` | [`invariants`](../packages/runtime-diagnostics/invariants) | - | [`session`](../packages/core/session), [`agent`](../packages/core/agent), [`scope`](../packages/core/scope), [`agent-loop`](../packages/core/agent-loop) | - | 配套子路径注册所属包本地的检查;该服务负责选择、唯一性、子 fiber,以及标明所属包的失败。 |
| `ctx.typert` | `core` | [`typert-registry`](../packages/typert/registry) | - | [`typert-loader`](../packages/typert/loader), [`api-gateway`](../packages/api/gateway) | - | 插件直接或通过 dsh-typert-loader 注册实时 zod 贡献;API 网关消费调用描述符和提供方,其他运行时消费方则在各自边界查询 schema 与反射元数据。 |
| `ctx.typertGateway` | `core` | [`api-gateway`](../packages/api/gateway) | - | - | - | 将生成的 Remote 描述符与实时 Cordis 服务关联,解析已注册的身份,并通过共享的 Connection RPC 载体提供一元调用。 |
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/config-catalog.md
config-catalog.md: 9a1eda647e8643543d4ab23c877267ad06c445f5
config-catalog.zh.md: ac0b8255a71c62770441c77b890eade0e051d561
config-catalog.md: 31f73a905afb1fb94274b309f77b4ba41b697166
config-catalog.zh.md: f09888603a9e77db1ea6ebf2a73eb2918b5bc62f
+18 -8
View File
@@ -265,6 +265,22 @@ Depends on: [`ToolPresentationMode`](subsystems/tools.md)
Source: [`packages/core/agent-tool-presentation/src/index.ts:38`](../packages/core/agent-tool-presentation/src/index.ts)
<a id="deepseek-aidsh-api-session-controller"></a>
## `@deepseek-ai/dsh-api-session-controller`
Requires: `agentDefaultModel` · `agents` · `attachments` · `llm` · `sessions` · `sessionQuery` · `tools` · `typert` · `userQuestions` · `workspaceRegistry`
```ts config-catalog
/** Session Controller deployment policy. */
export interface Config {
/** Maximum cold Session artifact size read to determine blankness. */
readonly coldBlankProbeMaxBytes?: number
}
```
Source: [`packages/api/session-controller/src/index.ts:60`](../packages/api/session-controller/src/index.ts)
<a id="deepseek-aidsh-attachment-local"></a>
## `@deepseek-ai/dsh-attachment-local`
@@ -365,7 +381,7 @@ export interface ConnectionConfig {
}
```
Source: [`packages/client/connection/src/index.ts:50`](../packages/client/connection/src/index.ts)
Source: [`packages/client/connection/src/index.ts:53`](../packages/client/connection/src/index.ts)
<a id="deepseek-aidsh-client-hmr"></a>
@@ -742,7 +758,7 @@ Source: [`packages/hooks/hooks-codex/src/index.ts:44`](../packages/hooks/hooks-c
## `@deepseek-ai/dsh-host-apiproxy`
Requires: `agentDefaultModel` · `agents` · `attachments` · `directoryPicker` · `llm` · `sessions` · `subagents` · `sessionQuery` · `tools` · `userQuestions` · `workspaceRegistry`
Requires: `agentDefaultModel` · `agents` · `attachments` · `directoryPicker` · `llm` · `sessions` · `subagents` · `sessionQuery` · `sessionController` · `workspaceRegistry`
```ts config-catalog
/** Gateway plugin configuration. */
@@ -761,12 +777,6 @@ export interface Config {
* @default 6
*/
sessionExportCompressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
/**
* Maximum physical size of a cold Session artifact eligible for blankness
* verification. Zero disables probes.
* @default 1024
*/
coldBlankProbeMaxBytes?: number
}
```
+19 -9
View File
@@ -267,6 +267,22 @@ export interface Config {
来源:[`packages/core/agent-tool-presentation/src/index.ts:38`](../packages/core/agent-tool-presentation/src/index.ts)
<a id="deepseek-aidsh-api-session-controller"></a>
## `@deepseek-ai/dsh-api-session-controller`
需要:`agentDefaultModel` · `agents` · `attachments` · `llm` · `sessions` · `sessionQuery` · `tools` · `typert` · `userQuestions` · `workspaceRegistry`
```ts config-catalog
/** Session Controller deployment policy. */
export interface Config {
/** Maximum cold Session artifact size read to determine blankness. */
readonly coldBlankProbeMaxBytes?: number
}
```
来源:[`packages/api/session-controller/src/index.ts:60`](../packages/api/session-controller/src/index.ts)
<a id="deepseek-aidsh-attachment-local"></a>
## `@deepseek-ai/dsh-attachment-local`
@@ -367,7 +383,7 @@ export interface ConnectionConfig {
}
```
来源:[`packages/client/connection/src/index.ts:50`](../packages/client/connection/src/index.ts)
来源:[`packages/client/connection/src/index.ts:53`](../packages/client/connection/src/index.ts)
<a id="deepseek-aidsh-client-hmr"></a>
@@ -744,7 +760,7 @@ export interface Config {
## `@deepseek-ai/dsh-host-apiproxy`
需要:`agentDefaultModel` · `agents` · `attachments` · `directoryPicker` · `llm` · `sessions` · `subagents` · `sessionQuery` · `tools` · `userQuestions` · `workspaceRegistry`
需要:`agentDefaultModel` · `agents` · `attachments` · `directoryPicker` · `llm` · `sessions` · `subagents` · `sessionQuery` · `sessionController` · `workspaceRegistry`
```ts config-catalog
/** Gateway plugin configuration. */
@@ -763,16 +779,10 @@ export interface Config {
* @default 6
*/
sessionExportCompressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
/**
* Maximum physical size of a cold Session artifact eligible for blankness
* verification. Zero disables probes.
* @default 1024
*/
coldBlankProbeMaxBytes?: number
}
```
来源:[`packages/host/apiproxy/src/index.ts:41`](../packages/host/apiproxy/src/index.ts)
来源:[`packages/host/apiproxy/src/index.ts:42`](../packages/host/apiproxy/src/index.ts)
<a id="deepseek-aidsh-host-directory-picker-browse"></a>
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/session-projection.md
session-projection.md: ccd4b0305c6253f7a00930ca0f0f2e5ffd5195b9
session-projection.zh.md: 6b62f8898dfae7dc1d382e2c5466c5e8c3e725e9
session-projection.md: 8614cf3466eff8deb360a7667ff6b4e37da1bf6e
session-projection.zh.md: b9e213b60e0df9de54e4c4805d11e64ca866dad2
+1 -1
View File
@@ -70,7 +70,7 @@ The whole-value event rule is load-bearing: a state-carrying log event carries t
/**
* One consistent read cut over every registered client-visible unit for one session.
* `asOfSeq` is the shared watermark — the seq of the last event every value
* reflects (`-1` for an empty log, mirroring `session/subscribed.lastSeq`).
* reflects (`-1` for an empty log).
*/
interface ProjectionSnapshot {
/** Seq of the last event the values reflect; -1 for an empty log. */
+1 -1
View File
@@ -70,7 +70,7 @@ interface ProjectionDefinition<
/**
* One consistent read cut over every registered client-visible unit for one session.
* `asOfSeq` is the shared watermark — the seq of the last event every value
* reflects (`-1` for an empty log, mirroring `session/subscribed.lastSeq`).
* reflects (`-1` for an empty log).
*/
interface ProjectionSnapshot {
/** Seq of the last event the values reflect; -1 for an empty log. */
+237
View File
@@ -591,6 +591,143 @@ The backends that consume this contract are on [persistence.md](persistence.md).
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
<a id="ctxsessioncontroller--sessioncontroller"></a>
### `ctx.sessionController` — `SessionController`
Host service backing the generated `ctx.remote.session` namespace.
```ts cordis-catalog
/**
* Resolve or resume one ordinary Session for another Host API domain.
* @param sessionId - Session identity whose Agent owns the operation.
* @returns the live Agent or the stable Session-domain failure.
*/
resolveAgent(sessionId: SessionId): Promise<ApiSessionAgentResult>
/**
* Inspect one attached or persisted Session without activating its Agent.
* @param sessionId - durable Session identity.
* @param signal - optional caller cancellation for persistence reads.
* @returns the current attached state or persisted header and event prefix.
*/
inspect( sessionId: SessionId, signal?: AbortSignal, ): Promise<{ meta: SessionHeader; events: SessionEvent[] }>
/**
* Read all visible Session rows without resuming an Agent.
* @param _request - reserved empty list request.
* @param signal - cancellation for persistence reads.
* @returns visible Session summaries ordered by activity.
*/
@Remote('list') async list(_request: SessionListRequest, signal: AbortSignal): Promise<SessionListValue>
/**
* Search visible Session content without resuming an Agent.
* @param request - literal message-content query.
* @param signal - cancellation for list and search reads.
* @returns authorized bounded Session search results.
*/
@Remote('search') search(request: SessionSearchRequest, signal: AbortSignal): Promise<SessionSearchValue>
/**
* Create or idempotently adopt one ordinary Session.
* @param request - requested identity, location, and Agent preset.
* @returns the Session identity and resolved preset when configured.
*/
@Remote('create') create(request: SessionCreateRequest): Promise<SessionCreateValue>
/**
* Read model choices after explicitly resuming the addressed Session.
* @param request - Session whose model state is requested.
* @returns the current selection and available model groups.
*/
@Remote('models') models(request: SessionModelsRequest): Promise<SessionModels>
/**
* Select one Session-local model after explicitly resuming the Session.
* @param request - Session identity and requested model selection.
* @returns the normalized selection installed for the Session.
*/
@Remote('selectModel') selectModel(request: SessionSelectModelRequest): Promise<SessionSelectModelValue>
/**
* Rename one Session after explicitly resuming it.
* @param request - Session identity and proposed title.
* @returns the accepted title and durable event sequence.
*/
@Remote('rename') rename(request: SessionRenameRequest): Promise<SessionRenameValue>
/**
* Fork one cold-readable completed-turn prefix into a new Session.
* @param request - source Session and optional event anchor.
* @returns the new Session identity.
*/
@Remote('fork') fork(request: SessionForkRequest): Promise<SessionForkValue>
/**
* Admit one prompt after explicitly resuming its Session.
* @param request - Session identity, prompt content, source metadata, and delivery mode.
* @param signal - caller cancellation before prompt admission begins.
* @returns acknowledgement that the Agent accepted the prompt.
*/
@Remote('prompt') prompt(request: SessionPromptRequest, signal: AbortSignal): Promise<SessionPromptValue>
/**
* Read one image proven reachable from the addressed Session log.
* @param request - Session and attachment identities used for authorization.
* @returns the durable attachment reference and base64-encoded bytes.
*/
@Remote('attachment') attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>
/**
* Mutate one still-pending queue occurrence on a live Agent.
* @param request - Session, queue item, and requested mutation.
* @returns acknowledgement that the queue mutation was applied.
*/
@Remote('updateQueue') updateQueue(request: SessionUpdateQueueRequest): SessionUpdateQueueValue
/**
* Cancel one active Agent turn without dropping its pending inbox.
* @param request - Session whose active Agent turn is cancelled.
* @returns acknowledgement that cancellation was requested.
*/
@Remote('cancel') cancel(request: SessionCancelRequest): SessionCancelValue
/**
* Read one cold-safe, message-aligned Session history page.
* @param request - durable address, backward cursor, and page budget.
* @param signal - cancellation for persistence and presentation reads.
* @returns one chronological page and optional latest projections.
*/
@Remote('page') page(request: SessionPageRequest, signal: AbortSignal): Promise<SessionPage>
/**
* Follow one Session log from its opening or resume cursor.
* @param request - durable address and last committed sequence already held by the caller.
* @param signal - cancellation owned by the Remote stream carrier.
* @returns an opened cursor followed by gap-free event frames.
*/
@Remote({ mode: 'stream' }) follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>
/**
* Stream a complete live-control baseline followed by replacement frames.
* @param signal - cancellation owned by the Remote stream carrier.
* @returns one complete baseline followed by live replacement frames.
*/
@Remote({ mode: 'stream' }) control(signal: AbortSignal): AsyncIterable<SessionControlFrame>
/**
* Settle one still-pending approval or structured question.
* @param request - interaction identity and caller response.
* @returns whether a matching pending interaction accepted the response.
*/
@Remote('respond') respond(request: SessionRespondRequest): SessionRespondReceipt
```
Types: [SessionHeader](persistence.md) · [SessionId](core.md) · [SessionSearchRequest](session-query.md)
Source: [`packages/api/session-controller/src/index.ts:66`](../../packages/api/session-controller/src/index.ts)
<a id="ctxsessions--sessionstore"></a>
### `ctx.sessions` — `SessionStore`
@@ -727,6 +864,106 @@ Types: [CreateSessionOptions](persistence.md) · [PrepareSessionOptions](persist
Source: [`packages/core/session/src/index.ts`](../../packages/core/session/src/index.ts)
<a id="api-session-events"></a>
### `api-session/*` events
<a id="api-sessionactivity--emit"></a>
#### `api-session/activity` — emit
One user-authored durable message advanced Session list activity.
```ts cordis-catalog
/**
* One user-authored durable message advanced Session list activity.
* @mode emit
* @param sessionId - addressed Session identity.
* @param updatedAt - durable message time used for list ordering.
*/
'api-session/activity'(sessionId: SessionId, updatedAt: number): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:529`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionadded--emit"></a>
#### `api-session/added` — emit
A Session became visible to Session list consumers.
```ts cordis-catalog
/**
* A Session became visible to Session list consumers.
* @mode emit
* @param summary - initial list row for the Session.
*/
'api-session/added'(summary: SessionSummary): void
```
Source: [`packages/api/session-controller/src/types.ts:509`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionerror--emit"></a>
#### `api-session/error` — emit
One Agent failed outside a durable turn position.
```ts cordis-catalog
/**
* One Agent failed outside a durable turn position.
* @mode emit
* @param sessionId - Agent and Session identity.
* @param message - user-safe failure chain.
*/
'api-session/error'(sessionId: SessionId, message: string): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:536`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionremoved--emit"></a>
#### `api-session/removed` — emit
A Session left the live Host registry.
```ts cordis-catalog
/**
* A Session left the live Host registry.
* @mode emit
* @param sessionId - removed Session identity.
*/
'api-session/removed'(sessionId: SessionId): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:515`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionstatus--emit"></a>
#### `api-session/status` — emit
One Agent changed running state.
```ts cordis-catalog
/**
* One Agent changed running state.
* @mode emit
* @param sessionId - Agent and Session identity.
* @param running - whether the Agent is running.
*/
'api-session/status'(sessionId: SessionId, running: boolean): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:522`](../../packages/api/session-controller/src/types.ts)
<a id="session-events"></a>
### `session/*` events
+237
View File
@@ -595,6 +595,143 @@ interface TurnEndReasonMap {
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
<a id="ctxsessioncontroller--sessioncontroller"></a>
### `ctx.sessionController` — `SessionController`
Host service backing the generated `ctx.remote.session` namespace.
```ts cordis-catalog
/**
* Resolve or resume one ordinary Session for another Host API domain.
* @param sessionId - Session identity whose Agent owns the operation.
* @returns the live Agent or the stable Session-domain failure.
*/
resolveAgent(sessionId: SessionId): Promise<ApiSessionAgentResult>
/**
* Inspect one attached or persisted Session without activating its Agent.
* @param sessionId - durable Session identity.
* @param signal - optional caller cancellation for persistence reads.
* @returns the current attached state or persisted header and event prefix.
*/
inspect( sessionId: SessionId, signal?: AbortSignal, ): Promise<{ meta: SessionHeader; events: SessionEvent[] }>
/**
* Read all visible Session rows without resuming an Agent.
* @param _request - reserved empty list request.
* @param signal - cancellation for persistence reads.
* @returns visible Session summaries ordered by activity.
*/
@Remote('list') async list(_request: SessionListRequest, signal: AbortSignal): Promise<SessionListValue>
/**
* Search visible Session content without resuming an Agent.
* @param request - literal message-content query.
* @param signal - cancellation for list and search reads.
* @returns authorized bounded Session search results.
*/
@Remote('search') search(request: SessionSearchRequest, signal: AbortSignal): Promise<SessionSearchValue>
/**
* Create or idempotently adopt one ordinary Session.
* @param request - requested identity, location, and Agent preset.
* @returns the Session identity and resolved preset when configured.
*/
@Remote('create') create(request: SessionCreateRequest): Promise<SessionCreateValue>
/**
* Read model choices after explicitly resuming the addressed Session.
* @param request - Session whose model state is requested.
* @returns the current selection and available model groups.
*/
@Remote('models') models(request: SessionModelsRequest): Promise<SessionModels>
/**
* Select one Session-local model after explicitly resuming the Session.
* @param request - Session identity and requested model selection.
* @returns the normalized selection installed for the Session.
*/
@Remote('selectModel') selectModel(request: SessionSelectModelRequest): Promise<SessionSelectModelValue>
/**
* Rename one Session after explicitly resuming it.
* @param request - Session identity and proposed title.
* @returns the accepted title and durable event sequence.
*/
@Remote('rename') rename(request: SessionRenameRequest): Promise<SessionRenameValue>
/**
* Fork one cold-readable completed-turn prefix into a new Session.
* @param request - source Session and optional event anchor.
* @returns the new Session identity.
*/
@Remote('fork') fork(request: SessionForkRequest): Promise<SessionForkValue>
/**
* Admit one prompt after explicitly resuming its Session.
* @param request - Session identity, prompt content, source metadata, and delivery mode.
* @param signal - caller cancellation before prompt admission begins.
* @returns acknowledgement that the Agent accepted the prompt.
*/
@Remote('prompt') prompt(request: SessionPromptRequest, signal: AbortSignal): Promise<SessionPromptValue>
/**
* Read one image proven reachable from the addressed Session log.
* @param request - Session and attachment identities used for authorization.
* @returns the durable attachment reference and base64-encoded bytes.
*/
@Remote('attachment') attachment(request: SessionAttachmentRequest): Promise<SessionAttachmentValue>
/**
* Mutate one still-pending queue occurrence on a live Agent.
* @param request - Session, queue item, and requested mutation.
* @returns acknowledgement that the queue mutation was applied.
*/
@Remote('updateQueue') updateQueue(request: SessionUpdateQueueRequest): SessionUpdateQueueValue
/**
* Cancel one active Agent turn without dropping its pending inbox.
* @param request - Session whose active Agent turn is cancelled.
* @returns acknowledgement that cancellation was requested.
*/
@Remote('cancel') cancel(request: SessionCancelRequest): SessionCancelValue
/**
* Read one cold-safe, message-aligned Session history page.
* @param request - durable address, backward cursor, and page budget.
* @param signal - cancellation for persistence and presentation reads.
* @returns one chronological page and optional latest projections.
*/
@Remote('page') page(request: SessionPageRequest, signal: AbortSignal): Promise<SessionPage>
/**
* Follow one Session log from its opening or resume cursor.
* @param request - durable address and last committed sequence already held by the caller.
* @param signal - cancellation owned by the Remote stream carrier.
* @returns an opened cursor followed by gap-free event frames.
*/
@Remote({ mode: 'stream' }) follow(request: SessionFollowRequest, signal: AbortSignal): AsyncIterable<SessionFollowFrame>
/**
* Stream a complete live-control baseline followed by replacement frames.
* @param signal - cancellation owned by the Remote stream carrier.
* @returns one complete baseline followed by live replacement frames.
*/
@Remote({ mode: 'stream' }) control(signal: AbortSignal): AsyncIterable<SessionControlFrame>
/**
* Settle one still-pending approval or structured question.
* @param request - interaction identity and caller response.
* @returns whether a matching pending interaction accepted the response.
*/
@Remote('respond') respond(request: SessionRespondRequest): SessionRespondReceipt
```
Types: [SessionHeader](persistence.md) · [SessionId](core.md) · [SessionSearchRequest](session-query.md)
Source: [`packages/api/session-controller/src/index.ts:66`](../../packages/api/session-controller/src/index.ts)
<a id="ctxsessions--sessionstore"></a>
### `ctx.sessions` — `SessionStore`
@@ -731,6 +868,106 @@ Types: [CreateSessionOptions](persistence.zh.md) · [PrepareSessionOptions](pers
Source: [`packages/core/session/src/index.ts`](../../packages/core/session/src/index.ts)
<a id="api-session-events"></a>
### `api-session/*` events
<a id="api-sessionactivity--emit"></a>
#### `api-session/activity` — emit
One user-authored durable message advanced Session list activity.
```ts cordis-catalog
/**
* One user-authored durable message advanced Session list activity.
* @mode emit
* @param sessionId - addressed Session identity.
* @param updatedAt - durable message time used for list ordering.
*/
'api-session/activity'(sessionId: SessionId, updatedAt: number): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:529`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionadded--emit"></a>
#### `api-session/added` — emit
A Session became visible to Session list consumers.
```ts cordis-catalog
/**
* A Session became visible to Session list consumers.
* @mode emit
* @param summary - initial list row for the Session.
*/
'api-session/added'(summary: SessionSummary): void
```
Source: [`packages/api/session-controller/src/types.ts:509`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionerror--emit"></a>
#### `api-session/error` — emit
One Agent failed outside a durable turn position.
```ts cordis-catalog
/**
* One Agent failed outside a durable turn position.
* @mode emit
* @param sessionId - Agent and Session identity.
* @param message - user-safe failure chain.
*/
'api-session/error'(sessionId: SessionId, message: string): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:536`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionremoved--emit"></a>
#### `api-session/removed` — emit
A Session left the live Host registry.
```ts cordis-catalog
/**
* A Session left the live Host registry.
* @mode emit
* @param sessionId - removed Session identity.
*/
'api-session/removed'(sessionId: SessionId): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:515`](../../packages/api/session-controller/src/types.ts)
<a id="api-sessionstatus--emit"></a>
#### `api-session/status` — emit
One Agent changed running state.
```ts cordis-catalog
/**
* One Agent changed running state.
* @mode emit
* @param sessionId - Agent and Session identity.
* @param running - whether the Agent is running.
*/
'api-session/status'(sessionId: SessionId, running: boolean): void
```
Types: [SessionId](core.md)
Source: [`packages/api/session-controller/src/types.ts:522`](../../packages/api/session-controller/src/types.ts)
<a id="session-events"></a>
### `session/*` events
+2 -2
View File
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/subsystems/typert.md
typert.md: 46d9e7c7ef5e5366b165f4dc9217ca9fc02712ab
typert.zh.md: ff92d94f31c9fe1d2e5469cb237751c3f742598e
typert.md: 47c3f4bfcea566a4f2eff480f8b0c7e80ed5ae36
typert.zh.md: 3feaee7d132c5c7c8b9b602b002bcd82d68e84c6
+20 -14
View File
@@ -84,6 +84,8 @@ interface InvocationDescriptor {
readonly method: string
/** Service member invoked when the exported method name is an alias. */
readonly implementation?: string
/** Absent for unary calls; stream calls validate and deliver every yielded item. */
readonly mode?: 'stream'
/** Receiver selection mode. */
readonly invocation:
| { readonly kind: 'direct' }
@@ -107,7 +109,7 @@ interface InvocationDescriptor {
/** Reserved final Host method parameter. */
readonly parameter: 'signal'
}
/** Codec for the resolved method result. */
/** Codec for the unary result or each yielded stream item. */
readonly result: TypertCodec
/** Source declaration used only for diagnostics. */
readonly sourceLocation?: InvocationSourceLocation
@@ -185,6 +187,12 @@ interface TypertGateway {
* @throws {@link TypertGatewayError} for dispatch, provider, or boundary failures; lookup-policy and business errors retain identity.
*/
invoke(request: InvokeRemoteRequest): Promise<unknown>
/**
* Open one live stream Remote method without assuming a physical carrier.
* @param request - decoded endpoint and named wire arguments.
* @returns an iterable whose items have passed the generated result codec.
*/
stream(request: InvokeRemoteRequest): Promise<AsyncIterable<unknown>>
}
```
@@ -231,7 +239,7 @@ interface TypertClientRemote extends TypertRemoteNamespaceMap {
## Cordis API
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
<a id="ctxapiproxy--apiproxy"></a>
@@ -239,16 +247,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
Root interface of the unified API. New client-request domain = one new file pair + one field here + one map row.
```ts cordis-catalog
/**
* Response entry for server requests; not a domain method.
* @param message - Client response carrying the server request's rpcId.
* @returns Transport receipt for the response delivery.
*/
respond(message: ClientResponse): Promise<RpcReceipt>
```
Source: [`packages/host/apiproxy/src/api/index.ts`](../../packages/host/apiproxy/src/api/index.ts)
Source: [`packages/host/apiproxy/src/api/index.ts:20`](../../packages/host/apiproxy/src/api/index.ts)
<a id="ctxtypert--typertregistry"></a>
@@ -314,7 +313,7 @@ toJSONSchema(key: string, params?: z.core.ToJSONSchemaParams): z.core.JSONSchema
Types: [TypertContribution](invariants.md) · [TypertFace](invariants.md) · [TypertPackageFilter](invariants.md) · [TypertPackageRecord](invariants.md) · [TypertSchemaFilter](invariants.md) · [TypertSchemaRecord](invariants.md)
Source: [`packages/typert/registry/src/service.ts`](../../packages/typert/registry/src/service.ts)
Source: [`packages/typert/registry/src/service.ts:446`](../../packages/typert/registry/src/service.ts)
<a id="ctxtypertgateway--typertgatewayservice"></a>
@@ -330,7 +329,14 @@ Resolve strict generated definitions or conservative SRC markers against current
* @throws {@link TypertGatewayError} for dispatch, provider, or boundary failures; lookup-policy and business errors retain identity.
*/
async invoke(request: InvokeRemoteRequest): Promise<unknown>
/**
* Open one live stream Remote method without assuming a physical carrier.
* @param request - decoded endpoint and named wire arguments.
* @returns an iterable whose items have passed the generated result codec.
*/
async stream(request: InvokeRemoteRequest): Promise<AsyncIterable<unknown>>
```
Source: [`packages/api/gateway/src/index.ts`](../../packages/api/gateway/src/index.ts)
Source: [`packages/api/gateway/src/index.ts:109`](../../packages/api/gateway/src/index.ts)
<!-- END GENERATED cordis-surface -->
+21 -15
View File
@@ -84,6 +84,8 @@ interface InvocationDescriptor {
readonly method: string
/** Service member invoked when the exported method name is an alias. */
readonly implementation?: string
/** Absent for unary calls; stream calls validate and deliver every yielded item. */
readonly mode?: 'stream'
/** Receiver selection mode. */
readonly invocation:
| { readonly kind: 'direct' }
@@ -107,7 +109,7 @@ interface InvocationDescriptor {
/** Reserved final Host method parameter. */
readonly parameter: 'signal'
}
/** Codec for the resolved method result. */
/** Codec for the unary result or each yielded stream item. */
readonly result: TypertCodec
/** Source declaration used only for diagnostics. */
readonly sourceLocation?: InvocationSourceLocation
@@ -185,6 +187,12 @@ interface TypertGateway {
* @throws {@link TypertGatewayError} for dispatch, provider, or boundary failures; lookup-policy and business errors retain identity.
*/
invoke(request: InvokeRemoteRequest): Promise<unknown>
/**
* Open one live stream Remote method without assuming a physical carrier.
* @param request - decoded endpoint and named wire arguments.
* @returns an iterable whose items have passed the generated result codec.
*/
stream(request: InvokeRemoteRequest): Promise<AsyncIterable<unknown>>
}
```
@@ -231,7 +239,7 @@ interface TypertClientRemote extends TypertRemoteNamespaceMap {
## Cordis API
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
<a id="ctxapiproxy--apiproxy"></a>
@@ -239,16 +247,7 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
Root interface of the unified API. New client-request domain = one new file pair + one field here + one map row.
```ts cordis-catalog
/**
* Response entry for server requests; not a domain method.
* @param message - Client response carrying the server request's rpcId.
* @returns Transport receipt for the response delivery.
*/
respond(message: ClientResponse): Promise<RpcReceipt>
```
Source: [`packages/host/apiproxy/src/api/index.ts`](../../packages/host/apiproxy/src/api/index.ts)
Source: [`packages/host/apiproxy/src/api/index.ts:20`](../../packages/host/apiproxy/src/api/index.ts)
<a id="ctxtypert--typertregistry"></a>
@@ -312,9 +311,9 @@ listPackages(filter: TypertPackageFilter = {}): TypertPackageRecord[]
toJSONSchema(key: string, params?: z.core.ToJSONSchemaParams): z.core.JSONSchema.BaseSchema
```
Types: [TypertContribution](invariants.zh.md) · [TypertFace](invariants.zh.md) · [TypertPackageFilter](invariants.zh.md) · [TypertPackageRecord](invariants.zh.md) · [TypertSchemaFilter](invariants.zh.md) · [TypertSchemaRecord](invariants.zh.md)
Types: [TypertContribution](invariants.md) · [TypertFace](invariants.md) · [TypertPackageFilter](invariants.md) · [TypertPackageRecord](invariants.md) · [TypertSchemaFilter](invariants.md) · [TypertSchemaRecord](invariants.md)
Source: [`packages/typert/registry/src/service.ts`](../../packages/typert/registry/src/service.ts)
Source: [`packages/typert/registry/src/service.ts:446`](../../packages/typert/registry/src/service.ts)
<a id="ctxtypertgateway--typertgatewayservice"></a>
@@ -330,7 +329,14 @@ Resolve strict generated definitions or conservative SRC markers against current
* @throws {@link TypertGatewayError} for dispatch, provider, or boundary failures; lookup-policy and business errors retain identity.
*/
async invoke(request: InvokeRemoteRequest): Promise<unknown>
/**
* Open one live stream Remote method without assuming a physical carrier.
* @param request - decoded endpoint and named wire arguments.
* @returns an iterable whose items have passed the generated result codec.
*/
async stream(request: InvokeRemoteRequest): Promise<AsyncIterable<unknown>>
```
Source: [`packages/api/gateway/src/index.ts`](../../packages/api/gateway/src/index.ts)
Source: [`packages/api/gateway/src/index.ts:109`](../../packages/api/gateway/src/index.ts)
<!-- END GENERATED cordis-surface -->