dsh-plugin-guide 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.es.md +5 -1
- package/README.hi.md +5 -1
- package/README.md +5 -1
- package/README.pt.md +5 -1
- package/README.zh.md +5 -1
- package/dist/dsh-plugin-dev.js +3 -3
- package/guide/plugin-dev-guide.md +2 -2
- package/guide/quick-reference.es.md +2 -2
- package/guide/quick-reference.hi.md +1 -1
- package/guide/quick-reference.md +2 -2
- package/guide/quick-reference.pt.md +2 -2
- package/guide/quick-reference.zh-CN.md +2 -2
- package/package.json +3 -3
- package/references/official-docs/AGENTS.md +3 -3
- package/references/official-docs/SNAPSHOT.md +4 -4
- package/references/official-docs/THIRD_PARTY_NOTICES.md +4 -6
- package/references/official-docs/docs/agent-lifecycle.i18n.yaml +2 -2
- package/references/official-docs/docs/agent-lifecycle.md +5 -3
- package/references/official-docs/docs/agent-lifecycle.zh.md +5 -3
- package/references/official-docs/docs/architecture.i18n.yaml +2 -2
- package/references/official-docs/docs/architecture.md +9 -4
- package/references/official-docs/docs/architecture.zh.md +9 -4
- package/references/official-docs/docs/capability-seams.i18n.yaml +2 -2
- package/references/official-docs/docs/capability-seams.md +8 -1
- package/references/official-docs/docs/capability-seams.zh.md +8 -1
- package/references/official-docs/docs/config-catalog.i18n.yaml +2 -2
- package/references/official-docs/docs/config-catalog.md +104 -68
- package/references/official-docs/docs/config-catalog.zh.md +101 -65
- package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +2 -2
- package/references/official-docs/docs/cookbook/adding-a-package.md +1 -1
- package/references/official-docs/docs/cookbook/adding-a-package.zh.md +1 -1
- package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +2 -2
- package/references/official-docs/docs/cookbook/extension-cookbook.md +12 -10
- package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +12 -10
- package/references/official-docs/docs/deepseek-llm-api-wire-extensions.i18n.yaml +2 -2
- package/references/official-docs/docs/deepseek-llm-api-wire-extensions.md +16 -12
- package/references/official-docs/docs/deepseek-llm-api-wire-extensions.zh.md +16 -12
- package/references/official-docs/docs/event-producer-consumer.i18n.yaml +2 -2
- package/references/official-docs/docs/event-producer-consumer.md +30 -29
- package/references/official-docs/docs/event-producer-consumer.zh.md +35 -34
- package/references/official-docs/docs/module-graph.i18n.yaml +2 -2
- package/references/official-docs/docs/module-graph.md +214 -360
- package/references/official-docs/docs/module-graph.zh.md +214 -360
- package/references/official-docs/docs/persistence-catalog.i18n.yaml +2 -2
- package/references/official-docs/docs/persistence-catalog.md +74 -64
- package/references/official-docs/docs/persistence-catalog.zh.md +72 -62
- package/references/official-docs/docs/subsystems/agent-team.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/agent-team.md +4 -3
- package/references/official-docs/docs/subsystems/agent-team.zh.md +4 -3
- package/references/official-docs/docs/subsystems/attachment.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/attachment.md +157 -4
- package/references/official-docs/docs/subsystems/attachment.zh.md +157 -4
- package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/code-runtime.md +7 -3
- package/references/official-docs/docs/subsystems/code-runtime.zh.md +7 -3
- package/references/official-docs/docs/subsystems/commands.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/commands.md +25 -16
- package/references/official-docs/docs/subsystems/commands.zh.md +25 -16
- package/references/official-docs/docs/subsystems/compaction.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/compaction.md +9 -9
- package/references/official-docs/docs/subsystems/compaction.zh.md +9 -9
- package/references/official-docs/docs/subsystems/conversation.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/conversation.md +4 -4
- package/references/official-docs/docs/subsystems/conversation.zh.md +4 -4
- package/references/official-docs/docs/subsystems/core.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/core.md +66 -4
- package/references/official-docs/docs/subsystems/core.zh.md +66 -4
- package/references/official-docs/docs/subsystems/feedback.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/feedback.md +2 -2
- package/references/official-docs/docs/subsystems/feedback.zh.md +2 -2
- package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/llm-streaming.md +23 -2
- package/references/official-docs/docs/subsystems/llm-streaming.zh.md +23 -2
- package/references/official-docs/docs/subsystems/persistence.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/persistence.md +183 -191
- package/references/official-docs/docs/subsystems/persistence.zh.md +183 -191
- package/references/official-docs/docs/subsystems/schedule.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/schedule.md +1 -1
- package/references/official-docs/docs/subsystems/schedule.zh.md +1 -1
- package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/session-projection.md +40 -17
- package/references/official-docs/docs/subsystems/session-projection.zh.md +40 -17
- package/references/official-docs/docs/subsystems/session-query.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/session-query.md +19 -13
- package/references/official-docs/docs/subsystems/session-query.zh.md +19 -13
- package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/session-reference.md +25 -1
- package/references/official-docs/docs/subsystems/session-reference.zh.md +25 -1
- package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/session-telemetry.md +6 -5
- package/references/official-docs/docs/subsystems/session-telemetry.zh.md +6 -5
- package/references/official-docs/docs/subsystems/session-title.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/session-title.md +5 -5
- package/references/official-docs/docs/subsystems/session-title.zh.md +5 -5
- package/references/official-docs/docs/subsystems/session.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/session.md +143 -71
- package/references/official-docs/docs/subsystems/session.zh.md +143 -71
- package/references/official-docs/docs/subsystems/slots.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/slots.md +1 -0
- package/references/official-docs/docs/subsystems/slots.zh.md +1 -0
- package/references/official-docs/docs/subsystems/storage.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/storage.md +28 -5
- package/references/official-docs/docs/subsystems/storage.zh.md +28 -5
- package/references/official-docs/docs/subsystems/subagent.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/subagent.md +32 -88
- package/references/official-docs/docs/subsystems/subagent.zh.md +31 -87
- package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/token-meter.md +2 -2
- package/references/official-docs/docs/subsystems/token-meter.zh.md +2 -2
- package/references/official-docs/docs/subsystems/web-client.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/web-client.md +1 -1
- package/references/official-docs/docs/subsystems/web-client.zh.md +1 -1
- package/references/official-docs/docs/subsystems/workspace.i18n.yaml +2 -2
- package/references/official-docs/docs/subsystems/workspace.md +8 -8
- package/references/official-docs/docs/subsystems/workspace.zh.md +8 -8
- package/references/official-docs/docs/testing.i18n.yaml +2 -2
- package/references/official-docs/docs/testing.md +2 -2
- package/references/official-docs/docs/testing.zh.md +2 -2
- package/references/official-docs/docs/tool-catalog.i18n.yaml +2 -2
- package/references/official-docs/docs/tool-catalog.md +9 -63
- package/references/official-docs/docs/tool-catalog.zh.md +8 -62
- package/references/official-docs/docs/user/guide/network-proxy.i18n.yaml +6 -0
- package/references/official-docs/docs/user/guide/network-proxy.md +85 -0
- package/references/official-docs/docs/user/guide/network-proxy.zh.md +85 -0
- package/references/official-docs/docs/user/guide/providers.i18n.yaml +2 -2
- package/references/official-docs/docs/user/guide/providers.md +70 -17
- package/references/official-docs/docs/user/guide/providers.zh.md +70 -17
- package/references/official-docs/docs/web-styling.i18n.yaml +2 -2
- package/references/official-docs/docs/web-styling.md +4 -0
- package/references/official-docs/docs/web-styling.zh.md +4 -0
- package/references/official-docs/packages/AGENTS.md +2 -2
- package/references/official-docs/website-docs.ts +8 -0
- package/templates/js/README.es.md +1 -1
- package/templates/js/README.hi.md +1 -1
- package/templates/js/README.md +1 -1
- package/templates/js/README.pt.md +1 -1
- package/templates/js/README.zh.md +1 -1
- package/templates/ts/README.es.md +1 -1
- package/templates/ts/README.hi.md +1 -1
- package/templates/ts/README.md +1 -1
- package/templates/ts/README.pt.md +1 -1
- package/templates/ts/README.zh.md +1 -1
|
@@ -30,9 +30,10 @@ interface ProjectionDefinition<
|
|
|
30
30
|
/**
|
|
31
31
|
* State for the empty log and its immutable Session metadata.
|
|
32
32
|
* @param header - immutable metadata for the Session being projected.
|
|
33
|
+
* @param inheritedEventCount - exact fork-inherited prefix length.
|
|
33
34
|
* @returns the initial state.
|
|
34
35
|
*/
|
|
35
|
-
init(header: SessionHeader): NoInfer<S>
|
|
36
|
+
init(header: SessionHeader, inheritedEventCount: SessionLogOffset): NoInfer<S>
|
|
36
37
|
/**
|
|
37
38
|
* Pure transition: previous state + one committed event → next state. A
|
|
38
39
|
* unit uninterested in an event MUST return the same state reference — an
|
|
@@ -78,7 +79,7 @@ The whole-value event rule is load-bearing: a state-carrying log event carries t
|
|
|
78
79
|
*/
|
|
79
80
|
interface ProjectionSnapshot {
|
|
80
81
|
/** Seq of the last event the values reflect; -1 for an empty log. */
|
|
81
|
-
asOfSeq:
|
|
82
|
+
asOfSeq: SessionSeqCursor
|
|
82
83
|
/** Whole current client value per registered key. */
|
|
83
84
|
values: Partial<SessionProjectionMap>
|
|
84
85
|
}
|
|
@@ -94,7 +95,7 @@ type ProjectionChangeListener = (
|
|
|
94
95
|
session: Session,
|
|
95
96
|
key: Extract<keyof SessionProjectionMap, string>,
|
|
96
97
|
value: unknown,
|
|
97
|
-
seq:
|
|
98
|
+
seq: SessionSeq,
|
|
98
99
|
) => void
|
|
99
100
|
```
|
|
100
101
|
|
|
@@ -128,11 +129,32 @@ The persisted projection cache service. Opens the `session_projcache` domain at
|
|
|
128
129
|
* paths (the history tail baseline) supersede these values whenever a
|
|
129
130
|
* session is actually opened.
|
|
130
131
|
* @param meta - the listed session's header (identity witness; no log read).
|
|
132
|
+
* @param inheritedEventCount - exact inherited prefix length that completes
|
|
133
|
+
* the checkpoint identity.
|
|
131
134
|
* @param keys - optional projection keys required by the caller's audience.
|
|
132
135
|
* @returns the cut (`asOfSeq` = lowest served-row watermark), or
|
|
133
136
|
* `undefined` when no usable row exists for this lifecycle.
|
|
134
137
|
*/
|
|
135
|
-
cachedSnapshot( meta: SessionHeader, keys?: readonly Extract<keyof SessionProjectionMap, string>[], ): ProjectionSnapshot | undefined
|
|
138
|
+
cachedSnapshot( meta: SessionHeader, inheritedEventCount: SessionLogOffset, keys?: readonly Extract<keyof SessionProjectionMap, string>[], ): ProjectionSnapshot | undefined
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Read only a predecessor checkpoint's title as a zero-I/O listing hint.
|
|
142
|
+
*
|
|
143
|
+
* The authoritative Session header supplies the lifecycle identity. A cache
|
|
144
|
+
* checkpoint can lag that log but cannot lead it because writes flush the
|
|
145
|
+
* log first, so a matching predecessor title is a genuine (possibly stale)
|
|
146
|
+
* fact from this Session. The registry still requires the current title
|
|
147
|
+
* projection's row version and schema. No other predecessor projection is
|
|
148
|
+
* exposed: format normalization can change their current meaning, and the
|
|
149
|
+
* strict {@link cachedSnapshot} / hydration paths continue to reject them.
|
|
150
|
+
* @param meta - authoritative listed Session header.
|
|
151
|
+
* @param inheritedEventCount - exact inherited cut completing the lifecycle identity.
|
|
152
|
+
* @returns a title-only checkpoint view with `asOfSeq: -1`, or `undefined`
|
|
153
|
+
* when the record is current, newer, unrelated, missing, or incompatible
|
|
154
|
+
* with the title unit. The sentinel avoids reusing a sequence that a
|
|
155
|
+
* cardinality-changing Session migration may have remapped.
|
|
156
|
+
*/
|
|
157
|
+
cachedPredecessorTitle( meta: SessionHeader, inheritedEventCount: SessionLogOffset, ): ProjectionSnapshot | undefined
|
|
136
158
|
|
|
137
159
|
/**
|
|
138
160
|
* Hydrate projection cells for an already-prepared Session without another
|
|
@@ -140,11 +162,10 @@ cachedSnapshot( meta: SessionHeader, keys?: readonly Extract<keyof SessionProjec
|
|
|
140
162
|
* advances every unit to the observation cut. No checkpoint is written
|
|
141
163
|
* because the logical observation may contain recovery events not yet durable.
|
|
142
164
|
* @param session - exact unpublished Session retained by persistence.
|
|
143
|
-
* @param meta - observed lifecycle header.
|
|
144
165
|
* @param events - exact logical event prefix represented by the observation.
|
|
145
166
|
* @returns all projection values at the event cut.
|
|
146
167
|
*/
|
|
147
|
-
hydratePrepared( session: Session,
|
|
168
|
+
hydratePrepared( session: Session, events: readonly SessionEvent[], ): ProjectionSnapshot
|
|
148
169
|
|
|
149
170
|
/**
|
|
150
171
|
* Durably checkpoint one live session NOW (all mandatory points call
|
|
@@ -166,13 +187,14 @@ async write(session: Session): Promise<void>
|
|
|
166
187
|
* The caller supplies the complete log in seq order: this service never
|
|
167
188
|
* consults the persistence layer.
|
|
168
189
|
* @param meta - the stored session header (identity witness).
|
|
190
|
+
* @param inheritedEventCount - exact inherited prefix length for projection initialization and identity.
|
|
169
191
|
* @param events - the session's complete log, in seq order.
|
|
170
192
|
* @returns the projection cut at the log end.
|
|
171
193
|
*/
|
|
172
|
-
coldSnapshot(meta: SessionHeader, events: readonly SessionEvent[]): ProjectionSnapshot
|
|
194
|
+
coldSnapshot( meta: SessionHeader, inheritedEventCount: SessionLogOffset, events: readonly SessionEvent[], ): ProjectionSnapshot
|
|
173
195
|
```
|
|
174
196
|
|
|
175
|
-
Types: [Session](session.md) · [SessionEvent](session.md) · [SessionHeader](persistence.md)
|
|
197
|
+
Types: [Session](session.md) · [SessionEvent](session.md) · [SessionHeader](persistence.md) · [SessionLogOffset](session.md)
|
|
176
198
|
|
|
177
199
|
Source: [`packages/session/session-projection-cache/src/index.ts`](../../packages/session/session-projection-cache/src/index.ts)
|
|
178
200
|
|
|
@@ -268,11 +290,11 @@ checkpoint(session: Session): ProjectionCheckpoint
|
|
|
268
290
|
* yields an end below every watermark and the restore rejects for a full
|
|
269
291
|
* re-read.
|
|
270
292
|
* @param checkpoint - persisted rows for one session (possibly stale or empty).
|
|
271
|
-
* @returns the
|
|
272
|
-
* when no unit is registered (no read needed —
|
|
273
|
-
* serve empty values regardless).
|
|
293
|
+
* @returns the offset for the stored-log suffix read (`SessionHandle.read`),
|
|
294
|
+
* or `undefined` when no unit is registered (no read needed —
|
|
295
|
+
* {@link restore} would serve empty values regardless).
|
|
274
296
|
*/
|
|
275
|
-
restoreFloor(checkpoint: ProjectionCheckpoint):
|
|
297
|
+
restoreFloor(checkpoint: ProjectionCheckpoint): SessionLogOffset | undefined
|
|
276
298
|
|
|
277
299
|
/**
|
|
278
300
|
* View a checkpoint's rows without any log read: for every registered
|
|
@@ -291,8 +313,8 @@ viewCheckpoint( checkpoint: ProjectionCheckpoint, keys?: readonly Extract<keyof
|
|
|
291
313
|
* Cold read: fold every persisted unit over a stored log suffix, seeding
|
|
292
314
|
* each from its checkpoint row when usable — the one read recipe (cached
|
|
293
315
|
* state + forward tail replay + `view`) applied without a live `Session`.
|
|
294
|
-
* Call with the events
|
|
295
|
-
* `
|
|
316
|
+
* Call with the stored events at or past `restoreFloor(checkpoint)` (a
|
|
317
|
+
* `SessionHandle.read` slice) and that same floor as
|
|
296
318
|
* `baseSeq`; the floor's one-below anchor makes the supplied end honest,
|
|
297
319
|
* so a shrunk log is detected here. A row is usable iff its
|
|
298
320
|
* `ver` matches the live unit's `stateVersion`, it does not predate `baseSeq`
|
|
@@ -306,11 +328,12 @@ viewCheckpoint( checkpoint: ProjectionCheckpoint, keys?: readonly Extract<keyof
|
|
|
306
328
|
* @param events - the stored events with `seq >= baseSeq`, in seq order.
|
|
307
329
|
* @param baseSeq - the seq `events` starts at (its first event's seq when non-empty).
|
|
308
330
|
* @param header - immutable metadata for the Session being restored.
|
|
331
|
+
* @param inheritedEventCount - exact fork-inherited prefix length supplied to unit initialization.
|
|
309
332
|
* @returns the snapshot cut at the supplied log end (`asOfSeq` is the last
|
|
310
333
|
* supplied event's seq, `baseSeq - 1` for an empty tail) plus the
|
|
311
334
|
* refreshed checkpoint rows at that cut, ready for a durable write-back.
|
|
312
335
|
*/
|
|
313
|
-
restore( checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq:
|
|
336
|
+
restore( checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq: SessionLogOffset, header: SessionHeader, inheritedEventCount: SessionLogOffset, ): { snapshot: ProjectionSnapshot; checkpoint: ProjectionCheckpoint }
|
|
314
337
|
|
|
315
338
|
/**
|
|
316
339
|
* Restore an exact cut and install its states on the supplied prepared Session.
|
|
@@ -322,10 +345,10 @@ restore( checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], base
|
|
|
322
345
|
* @param baseSeq - first supplied event sequence.
|
|
323
346
|
* @returns all projection values at the supplied cut.
|
|
324
347
|
*/
|
|
325
|
-
hydrate( session: Session, checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq:
|
|
348
|
+
hydrate( session: Session, checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq: SessionLogOffset, ): ProjectionSnapshot
|
|
326
349
|
```
|
|
327
350
|
|
|
328
|
-
Types: [Session](session.md) · [SessionEvent](session.md) · [SessionHeader](persistence.md)
|
|
351
|
+
Types: [Session](session.md) · [SessionEvent](session.md) · [SessionHeader](persistence.md) · [SessionLogOffset](session.md)
|
|
329
352
|
|
|
330
353
|
Source: [`packages/session/session-projection/src/index.ts`](../../packages/session/session-projection/src/index.ts)
|
|
331
354
|
<!-- END GENERATED cordis-surface -->
|
|
@@ -30,9 +30,10 @@ interface ProjectionDefinition<
|
|
|
30
30
|
/**
|
|
31
31
|
* State for the empty log and its immutable Session metadata.
|
|
32
32
|
* @param header - immutable metadata for the Session being projected.
|
|
33
|
+
* @param inheritedEventCount - exact fork-inherited prefix length.
|
|
33
34
|
* @returns the initial state.
|
|
34
35
|
*/
|
|
35
|
-
init(header: SessionHeader): NoInfer<S>
|
|
36
|
+
init(header: SessionHeader, inheritedEventCount: SessionLogOffset): NoInfer<S>
|
|
36
37
|
/**
|
|
37
38
|
* Pure transition: previous state + one committed event → next state. A
|
|
38
39
|
* unit uninterested in an event MUST return the same state reference — an
|
|
@@ -78,7 +79,7 @@ interface ProjectionDefinition<
|
|
|
78
79
|
*/
|
|
79
80
|
interface ProjectionSnapshot {
|
|
80
81
|
/** Seq of the last event the values reflect; -1 for an empty log. */
|
|
81
|
-
asOfSeq:
|
|
82
|
+
asOfSeq: SessionSeqCursor
|
|
82
83
|
/** Whole current client value per registered key. */
|
|
83
84
|
values: Partial<SessionProjectionMap>
|
|
84
85
|
}
|
|
@@ -94,7 +95,7 @@ type ProjectionChangeListener = (
|
|
|
94
95
|
session: Session,
|
|
95
96
|
key: Extract<keyof SessionProjectionMap, string>,
|
|
96
97
|
value: unknown,
|
|
97
|
-
seq:
|
|
98
|
+
seq: SessionSeq,
|
|
98
99
|
) => void
|
|
99
100
|
```
|
|
100
101
|
|
|
@@ -128,11 +129,32 @@ The persisted projection cache service. Opens the `session_projcache` domain at
|
|
|
128
129
|
* paths (the history tail baseline) supersede these values whenever a
|
|
129
130
|
* session is actually opened.
|
|
130
131
|
* @param meta - the listed session's header (identity witness; no log read).
|
|
132
|
+
* @param inheritedEventCount - exact inherited prefix length that completes
|
|
133
|
+
* the checkpoint identity.
|
|
131
134
|
* @param keys - optional projection keys required by the caller's audience.
|
|
132
135
|
* @returns the cut (`asOfSeq` = lowest served-row watermark), or
|
|
133
136
|
* `undefined` when no usable row exists for this lifecycle.
|
|
134
137
|
*/
|
|
135
|
-
cachedSnapshot( meta: SessionHeader, keys?: readonly Extract<keyof SessionProjectionMap, string>[], ): ProjectionSnapshot | undefined
|
|
138
|
+
cachedSnapshot( meta: SessionHeader, inheritedEventCount: SessionLogOffset, keys?: readonly Extract<keyof SessionProjectionMap, string>[], ): ProjectionSnapshot | undefined
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Read only a predecessor checkpoint's title as a zero-I/O listing hint.
|
|
142
|
+
*
|
|
143
|
+
* The authoritative Session header supplies the lifecycle identity. A cache
|
|
144
|
+
* checkpoint can lag that log but cannot lead it because writes flush the
|
|
145
|
+
* log first, so a matching predecessor title is a genuine (possibly stale)
|
|
146
|
+
* fact from this Session. The registry still requires the current title
|
|
147
|
+
* projection's row version and schema. No other predecessor projection is
|
|
148
|
+
* exposed: format normalization can change their current meaning, and the
|
|
149
|
+
* strict {@link cachedSnapshot} / hydration paths continue to reject them.
|
|
150
|
+
* @param meta - authoritative listed Session header.
|
|
151
|
+
* @param inheritedEventCount - exact inherited cut completing the lifecycle identity.
|
|
152
|
+
* @returns a title-only checkpoint view with `asOfSeq: -1`, or `undefined`
|
|
153
|
+
* when the record is current, newer, unrelated, missing, or incompatible
|
|
154
|
+
* with the title unit. The sentinel avoids reusing a sequence that a
|
|
155
|
+
* cardinality-changing Session migration may have remapped.
|
|
156
|
+
*/
|
|
157
|
+
cachedPredecessorTitle( meta: SessionHeader, inheritedEventCount: SessionLogOffset, ): ProjectionSnapshot | undefined
|
|
136
158
|
|
|
137
159
|
/**
|
|
138
160
|
* Hydrate projection cells for an already-prepared Session without another
|
|
@@ -140,11 +162,10 @@ cachedSnapshot( meta: SessionHeader, keys?: readonly Extract<keyof SessionProjec
|
|
|
140
162
|
* advances every unit to the observation cut. No checkpoint is written
|
|
141
163
|
* because the logical observation may contain recovery events not yet durable.
|
|
142
164
|
* @param session - exact unpublished Session retained by persistence.
|
|
143
|
-
* @param meta - observed lifecycle header.
|
|
144
165
|
* @param events - exact logical event prefix represented by the observation.
|
|
145
166
|
* @returns all projection values at the event cut.
|
|
146
167
|
*/
|
|
147
|
-
hydratePrepared( session: Session,
|
|
168
|
+
hydratePrepared( session: Session, events: readonly SessionEvent[], ): ProjectionSnapshot
|
|
148
169
|
|
|
149
170
|
/**
|
|
150
171
|
* Durably checkpoint one live session NOW (all mandatory points call
|
|
@@ -166,13 +187,14 @@ async write(session: Session): Promise<void>
|
|
|
166
187
|
* The caller supplies the complete log in seq order: this service never
|
|
167
188
|
* consults the persistence layer.
|
|
168
189
|
* @param meta - the stored session header (identity witness).
|
|
190
|
+
* @param inheritedEventCount - exact inherited prefix length for projection initialization and identity.
|
|
169
191
|
* @param events - the session's complete log, in seq order.
|
|
170
192
|
* @returns the projection cut at the log end.
|
|
171
193
|
*/
|
|
172
|
-
coldSnapshot(meta: SessionHeader, events: readonly SessionEvent[]): ProjectionSnapshot
|
|
194
|
+
coldSnapshot( meta: SessionHeader, inheritedEventCount: SessionLogOffset, events: readonly SessionEvent[], ): ProjectionSnapshot
|
|
173
195
|
```
|
|
174
196
|
|
|
175
|
-
Types: [Session](session.zh.md) · [SessionEvent](session.zh.md) · [SessionHeader](persistence.zh.md)
|
|
197
|
+
Types: [Session](session.zh.md) · [SessionEvent](session.zh.md) · [SessionHeader](persistence.zh.md) · [SessionLogOffset](session.zh.md)
|
|
176
198
|
|
|
177
199
|
Source: [`packages/session/session-projection-cache/src/index.ts`](../../packages/session/session-projection-cache/src/index.ts)
|
|
178
200
|
|
|
@@ -268,11 +290,11 @@ checkpoint(session: Session): ProjectionCheckpoint
|
|
|
268
290
|
* yields an end below every watermark and the restore rejects for a full
|
|
269
291
|
* re-read.
|
|
270
292
|
* @param checkpoint - persisted rows for one session (possibly stale or empty).
|
|
271
|
-
* @returns the
|
|
272
|
-
* when no unit is registered (no read needed —
|
|
273
|
-
* serve empty values regardless).
|
|
293
|
+
* @returns the offset for the stored-log suffix read (`SessionHandle.read`),
|
|
294
|
+
* or `undefined` when no unit is registered (no read needed —
|
|
295
|
+
* {@link restore} would serve empty values regardless).
|
|
274
296
|
*/
|
|
275
|
-
restoreFloor(checkpoint: ProjectionCheckpoint):
|
|
297
|
+
restoreFloor(checkpoint: ProjectionCheckpoint): SessionLogOffset | undefined
|
|
276
298
|
|
|
277
299
|
/**
|
|
278
300
|
* View a checkpoint's rows without any log read: for every registered
|
|
@@ -291,8 +313,8 @@ viewCheckpoint( checkpoint: ProjectionCheckpoint, keys?: readonly Extract<keyof
|
|
|
291
313
|
* Cold read: fold every persisted unit over a stored log suffix, seeding
|
|
292
314
|
* each from its checkpoint row when usable — the one read recipe (cached
|
|
293
315
|
* state + forward tail replay + `view`) applied without a live `Session`.
|
|
294
|
-
* Call with the events
|
|
295
|
-
* `
|
|
316
|
+
* Call with the stored events at or past `restoreFloor(checkpoint)` (a
|
|
317
|
+
* `SessionHandle.read` slice) and that same floor as
|
|
296
318
|
* `baseSeq`; the floor's one-below anchor makes the supplied end honest,
|
|
297
319
|
* so a shrunk log is detected here. A row is usable iff its
|
|
298
320
|
* `ver` matches the live unit's `stateVersion`, it does not predate `baseSeq`
|
|
@@ -306,11 +328,12 @@ viewCheckpoint( checkpoint: ProjectionCheckpoint, keys?: readonly Extract<keyof
|
|
|
306
328
|
* @param events - the stored events with `seq >= baseSeq`, in seq order.
|
|
307
329
|
* @param baseSeq - the seq `events` starts at (its first event's seq when non-empty).
|
|
308
330
|
* @param header - immutable metadata for the Session being restored.
|
|
331
|
+
* @param inheritedEventCount - exact fork-inherited prefix length supplied to unit initialization.
|
|
309
332
|
* @returns the snapshot cut at the supplied log end (`asOfSeq` is the last
|
|
310
333
|
* supplied event's seq, `baseSeq - 1` for an empty tail) plus the
|
|
311
334
|
* refreshed checkpoint rows at that cut, ready for a durable write-back.
|
|
312
335
|
*/
|
|
313
|
-
restore( checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq:
|
|
336
|
+
restore( checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq: SessionLogOffset, header: SessionHeader, inheritedEventCount: SessionLogOffset, ): { snapshot: ProjectionSnapshot; checkpoint: ProjectionCheckpoint }
|
|
314
337
|
|
|
315
338
|
/**
|
|
316
339
|
* Restore an exact cut and install its states on the supplied prepared Session.
|
|
@@ -322,10 +345,10 @@ restore( checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], base
|
|
|
322
345
|
* @param baseSeq - first supplied event sequence.
|
|
323
346
|
* @returns all projection values at the supplied cut.
|
|
324
347
|
*/
|
|
325
|
-
hydrate( session: Session, checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq:
|
|
348
|
+
hydrate( session: Session, checkpoint: ProjectionCheckpoint, events: readonly SessionEvent[], baseSeq: SessionLogOffset, ): ProjectionSnapshot
|
|
326
349
|
```
|
|
327
350
|
|
|
328
|
-
Types: [Session](session.zh.md) · [SessionEvent](session.zh.md) · [SessionHeader](persistence.zh.md)
|
|
351
|
+
Types: [Session](session.zh.md) · [SessionEvent](session.zh.md) · [SessionHeader](persistence.zh.md) · [SessionLogOffset](session.zh.md)
|
|
329
352
|
|
|
330
353
|
Source: [`packages/session/session-projection/src/index.ts`](../../packages/session/session-projection/src/index.ts)
|
|
331
354
|
<!-- END GENERATED cordis-surface -->
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write docs/subsystems/session-query.md
|
|
5
|
-
session-query.md:
|
|
6
|
-
session-query.zh.md:
|
|
5
|
+
session-query.md: 1cf3dff325db76485a0afca4ca1a882a4ff175b8
|
|
6
|
+
session-query.zh.md: 2b8504dfb9ec8ee25d925135dbc99fa7beaede98
|
|
@@ -22,7 +22,7 @@ interface SessionRecord {
|
|
|
22
22
|
header: SessionHeader
|
|
23
23
|
/** Whether the id currently exists in `ctx.sessions`. */
|
|
24
24
|
live: boolean
|
|
25
|
-
/** Whether the active persistence backend currently
|
|
25
|
+
/** Whether the active persistence backend currently lists the id, including a created-but-unmaterialized session it already observes. */
|
|
26
26
|
persisted: boolean
|
|
27
27
|
}
|
|
28
28
|
```
|
|
@@ -34,7 +34,9 @@ interface SessionRecord {
|
|
|
34
34
|
interface SessionLogSnapshot {
|
|
35
35
|
/** Cloned session header selected from the same observation as `events`. */
|
|
36
36
|
session: SessionHeader
|
|
37
|
-
/**
|
|
37
|
+
/** Exact number of fork-inherited events in the observed log. */
|
|
38
|
+
inheritedEventCount: SessionLogOffset
|
|
39
|
+
/** Cloned contiguous raw events after in-memory interrupted-turn balancing and replay validation. */
|
|
38
40
|
events: SessionEvent[]
|
|
39
41
|
}
|
|
40
42
|
```
|
|
@@ -44,8 +46,10 @@ interface SessionLogSnapshot {
|
|
|
44
46
|
interface SessionSurfaceSnapshot {
|
|
45
47
|
/** Cloned session header selected from the same corpus observation as `events`. */
|
|
46
48
|
session: SessionHeader
|
|
49
|
+
/** Exact number of fork-inherited events in the observed log. */
|
|
50
|
+
inheritedEventCount: SessionLogOffset
|
|
47
51
|
/** Highest raw-log seq included in the observation, or `null` for an empty log. */
|
|
48
|
-
capturedThroughSeq:
|
|
52
|
+
capturedThroughSeq: OptionalSessionSeq
|
|
49
53
|
/** Cloned current surface events in model-history order. */
|
|
50
54
|
events: SurfaceEvent[]
|
|
51
55
|
}
|
|
@@ -90,7 +94,7 @@ interface SessionEventRecord {
|
|
|
90
94
|
/** Session that owns the event. */
|
|
91
95
|
sessionId: SessionId
|
|
92
96
|
/** Monotonic event seq within the session. */
|
|
93
|
-
seq:
|
|
97
|
+
seq: SessionSeq
|
|
94
98
|
/** Discriminant of the session event. */
|
|
95
99
|
type: SessionEventType
|
|
96
100
|
/** Event timestamp in Unix epoch milliseconds. */
|
|
@@ -266,7 +270,7 @@ interface SessionEventReadRequest {
|
|
|
266
270
|
/** Session that owns the target event. */
|
|
267
271
|
sessionId: SessionId
|
|
268
272
|
/** Target event seq. */
|
|
269
|
-
seq:
|
|
273
|
+
seq: SessionSeq
|
|
270
274
|
/** Number of preceding raw events to include. */
|
|
271
275
|
before?: number
|
|
272
276
|
/** Number of following raw events to include. */
|
|
@@ -279,14 +283,16 @@ interface SessionEventReadRequest {
|
|
|
279
283
|
interface SessionEventWindow {
|
|
280
284
|
/** Cloned header for the live-preferred source read. */
|
|
281
285
|
session: SessionHeader
|
|
286
|
+
/** Exact number of fork-inherited events in the observed log. */
|
|
287
|
+
inheritedEventCount: SessionLogOffset
|
|
282
288
|
/** Full cloned target event. */
|
|
283
289
|
target: SessionEvent
|
|
284
290
|
/** Full cloned events from `startSeq` through `endSeq`. */
|
|
285
291
|
events: SessionEvent[]
|
|
286
292
|
/** First seq included in `events`. */
|
|
287
|
-
startSeq:
|
|
293
|
+
startSeq: SessionSeq
|
|
288
294
|
/** Last seq included in `events`. */
|
|
289
|
-
endSeq:
|
|
295
|
+
endSeq: SessionSeq
|
|
290
296
|
}
|
|
291
297
|
```
|
|
292
298
|
|
|
@@ -300,7 +306,7 @@ interface SessionEventTraceRequest {
|
|
|
300
306
|
/** Session that owns the target event. */
|
|
301
307
|
sessionId: SessionId
|
|
302
308
|
/** Target event seq. */
|
|
303
|
-
seq:
|
|
309
|
+
seq: SessionSeq
|
|
304
310
|
}
|
|
305
311
|
```
|
|
306
312
|
|
|
@@ -310,15 +316,15 @@ interface SessionEventTrace {
|
|
|
310
316
|
/** Lightweight target record. */
|
|
311
317
|
target: SessionEventRecord
|
|
312
318
|
/** Immediate positional replacement event, when the target was shadowed. */
|
|
313
|
-
replacedBy?:
|
|
319
|
+
replacedBy?: SessionSeq
|
|
314
320
|
/** Positional replacers from the immediate replacement to the final replacement. */
|
|
315
|
-
replacementChain:
|
|
321
|
+
replacementChain: SessionSeq[]
|
|
316
322
|
/** Surface nodes directly removed when the target itself performed a replacement. */
|
|
317
|
-
replacedEventSeqs:
|
|
323
|
+
replacedEventSeqs: SessionSeq[]
|
|
318
324
|
/** Earlier events cited directly as sources, in their recorded order. */
|
|
319
|
-
sourceEventSeqs:
|
|
325
|
+
sourceEventSeqs: SessionSeq[]
|
|
320
326
|
/** Later events that directly cite the target as a source, in log order. */
|
|
321
|
-
derivedEventSeqs:
|
|
327
|
+
derivedEventSeqs: SessionSeq[]
|
|
322
328
|
}
|
|
323
329
|
```
|
|
324
330
|
|
|
@@ -22,7 +22,7 @@ interface SessionRecord {
|
|
|
22
22
|
header: SessionHeader
|
|
23
23
|
/** Whether the id currently exists in `ctx.sessions`. */
|
|
24
24
|
live: boolean
|
|
25
|
-
/** Whether the active persistence backend currently
|
|
25
|
+
/** Whether the active persistence backend currently lists the id, including a created-but-unmaterialized session it already observes. */
|
|
26
26
|
persisted: boolean
|
|
27
27
|
}
|
|
28
28
|
```
|
|
@@ -34,7 +34,9 @@ interface SessionRecord {
|
|
|
34
34
|
interface SessionLogSnapshot {
|
|
35
35
|
/** Cloned session header selected from the same observation as `events`. */
|
|
36
36
|
session: SessionHeader
|
|
37
|
-
/**
|
|
37
|
+
/** Exact number of fork-inherited events in the observed log. */
|
|
38
|
+
inheritedEventCount: SessionLogOffset
|
|
39
|
+
/** Cloned contiguous raw events after in-memory interrupted-turn balancing and replay validation. */
|
|
38
40
|
events: SessionEvent[]
|
|
39
41
|
}
|
|
40
42
|
```
|
|
@@ -44,8 +46,10 @@ interface SessionLogSnapshot {
|
|
|
44
46
|
interface SessionSurfaceSnapshot {
|
|
45
47
|
/** Cloned session header selected from the same corpus observation as `events`. */
|
|
46
48
|
session: SessionHeader
|
|
49
|
+
/** Exact number of fork-inherited events in the observed log. */
|
|
50
|
+
inheritedEventCount: SessionLogOffset
|
|
47
51
|
/** Highest raw-log seq included in the observation, or `null` for an empty log. */
|
|
48
|
-
capturedThroughSeq:
|
|
52
|
+
capturedThroughSeq: OptionalSessionSeq
|
|
49
53
|
/** Cloned current surface events in model-history order. */
|
|
50
54
|
events: SurfaceEvent[]
|
|
51
55
|
}
|
|
@@ -90,7 +94,7 @@ interface SessionEventRecord {
|
|
|
90
94
|
/** Session that owns the event. */
|
|
91
95
|
sessionId: SessionId
|
|
92
96
|
/** Monotonic event seq within the session. */
|
|
93
|
-
seq:
|
|
97
|
+
seq: SessionSeq
|
|
94
98
|
/** Discriminant of the session event. */
|
|
95
99
|
type: SessionEventType
|
|
96
100
|
/** Event timestamp in Unix epoch milliseconds. */
|
|
@@ -266,7 +270,7 @@ interface SessionEventReadRequest {
|
|
|
266
270
|
/** Session that owns the target event. */
|
|
267
271
|
sessionId: SessionId
|
|
268
272
|
/** Target event seq. */
|
|
269
|
-
seq:
|
|
273
|
+
seq: SessionSeq
|
|
270
274
|
/** Number of preceding raw events to include. */
|
|
271
275
|
before?: number
|
|
272
276
|
/** Number of following raw events to include. */
|
|
@@ -279,14 +283,16 @@ interface SessionEventReadRequest {
|
|
|
279
283
|
interface SessionEventWindow {
|
|
280
284
|
/** Cloned header for the live-preferred source read. */
|
|
281
285
|
session: SessionHeader
|
|
286
|
+
/** Exact number of fork-inherited events in the observed log. */
|
|
287
|
+
inheritedEventCount: SessionLogOffset
|
|
282
288
|
/** Full cloned target event. */
|
|
283
289
|
target: SessionEvent
|
|
284
290
|
/** Full cloned events from `startSeq` through `endSeq`. */
|
|
285
291
|
events: SessionEvent[]
|
|
286
292
|
/** First seq included in `events`. */
|
|
287
|
-
startSeq:
|
|
293
|
+
startSeq: SessionSeq
|
|
288
294
|
/** Last seq included in `events`. */
|
|
289
|
-
endSeq:
|
|
295
|
+
endSeq: SessionSeq
|
|
290
296
|
}
|
|
291
297
|
```
|
|
292
298
|
|
|
@@ -300,7 +306,7 @@ interface SessionEventTraceRequest {
|
|
|
300
306
|
/** Session that owns the target event. */
|
|
301
307
|
sessionId: SessionId
|
|
302
308
|
/** Target event seq. */
|
|
303
|
-
seq:
|
|
309
|
+
seq: SessionSeq
|
|
304
310
|
}
|
|
305
311
|
```
|
|
306
312
|
|
|
@@ -310,15 +316,15 @@ interface SessionEventTrace {
|
|
|
310
316
|
/** Lightweight target record. */
|
|
311
317
|
target: SessionEventRecord
|
|
312
318
|
/** Immediate positional replacement event, when the target was shadowed. */
|
|
313
|
-
replacedBy?:
|
|
319
|
+
replacedBy?: SessionSeq
|
|
314
320
|
/** Positional replacers from the immediate replacement to the final replacement. */
|
|
315
|
-
replacementChain:
|
|
321
|
+
replacementChain: SessionSeq[]
|
|
316
322
|
/** Surface nodes directly removed when the target itself performed a replacement. */
|
|
317
|
-
replacedEventSeqs:
|
|
323
|
+
replacedEventSeqs: SessionSeq[]
|
|
318
324
|
/** Earlier events cited directly as sources, in their recorded order. */
|
|
319
|
-
sourceEventSeqs:
|
|
325
|
+
sourceEventSeqs: SessionSeq[]
|
|
320
326
|
/** Later events that directly cite the target as a source, in log order. */
|
|
321
|
-
derivedEventSeqs:
|
|
327
|
+
derivedEventSeqs: SessionSeq[]
|
|
322
328
|
}
|
|
323
329
|
```
|
|
324
330
|
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write docs/subsystems/session-reference.md
|
|
5
|
-
session-reference.md:
|
|
6
|
-
session-reference.zh.md:
|
|
5
|
+
session-reference.md: 4921c29d25083a75c7a4fed8dd14202a4da9b2d2
|
|
6
|
+
session-reference.zh.md: 7cd03ea31258eadd207a5dcbbcbf208f291021f8
|
|
@@ -68,7 +68,31 @@ interface SessionReferenceMentionCandidate extends SessionReferenceCandidate {
|
|
|
68
68
|
|
|
69
69
|
## Prepared messages
|
|
70
70
|
|
|
71
|
-
Preparation preserves readable current-message content and returns at most one aggregated context.
|
|
71
|
+
Preparation preserves readable current-message content and returns at most one aggregated context. Its durable source records keep `capturedThroughSeq` as a coordinate in the referenced Session's original generation; they never reinterpret it as a seq in the containing Session. `capturedFormatVersion` records that generation, with absence meaning released format v0.
|
|
72
|
+
|
|
73
|
+
```ts type-equiv
|
|
74
|
+
/** Durable source session, cited event seqs, and snapshot facts for prepared cross-session context. */
|
|
75
|
+
interface SessionReferenceSource {
|
|
76
|
+
kind: 'session-reference'
|
|
77
|
+
/** Material lifted out of another session's log (`recall` context form). */
|
|
78
|
+
form: 'recall'
|
|
79
|
+
version: 1
|
|
80
|
+
references: {
|
|
81
|
+
sessionId: string
|
|
82
|
+
label: string
|
|
83
|
+
/** Source Session format generation; absence identifies version 0. */
|
|
84
|
+
capturedFormatVersion?: number
|
|
85
|
+
capturedThroughSeq: OptionalSessionSeq
|
|
86
|
+
compacted: boolean
|
|
87
|
+
originalMessages: number
|
|
88
|
+
retainedMessages: number
|
|
89
|
+
omittedMessages: number
|
|
90
|
+
omittedBytes: number
|
|
91
|
+
truncated: boolean
|
|
92
|
+
inputIndex: number
|
|
93
|
+
}[]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
72
96
|
|
|
73
97
|
```ts type-equiv
|
|
74
98
|
/** Direct message content and optional referenced-session context. */
|
|
@@ -68,7 +68,31 @@ interface SessionReferenceMentionCandidate extends SessionReferenceCandidate {
|
|
|
68
68
|
|
|
69
69
|
## 准备后的消息
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
准备过程保留可读的当前消息内容,并最多返回一个聚合上下文。其持久 source 记录会把 `capturedThroughSeq` 保留为被引用 Session 原始 generation 中的坐标,绝不会把它重新解释为所在 Session 的 seq。`capturedFormatVersion` 记录该 generation;缺失表示已发布格式 v0。
|
|
72
|
+
|
|
73
|
+
```ts type-equiv
|
|
74
|
+
/** Durable source session, cited event seqs, and snapshot facts for prepared cross-session context. */
|
|
75
|
+
interface SessionReferenceSource {
|
|
76
|
+
kind: 'session-reference'
|
|
77
|
+
/** Material lifted out of another session's log (`recall` context form). */
|
|
78
|
+
form: 'recall'
|
|
79
|
+
version: 1
|
|
80
|
+
references: {
|
|
81
|
+
sessionId: string
|
|
82
|
+
label: string
|
|
83
|
+
/** Source Session format generation; absence identifies version 0. */
|
|
84
|
+
capturedFormatVersion?: number
|
|
85
|
+
capturedThroughSeq: OptionalSessionSeq
|
|
86
|
+
compacted: boolean
|
|
87
|
+
originalMessages: number
|
|
88
|
+
retainedMessages: number
|
|
89
|
+
omittedMessages: number
|
|
90
|
+
omittedBytes: number
|
|
91
|
+
truncated: boolean
|
|
92
|
+
inputIndex: number
|
|
93
|
+
}[]
|
|
94
|
+
}
|
|
95
|
+
```
|
|
72
96
|
|
|
73
97
|
```ts type-equiv
|
|
74
98
|
/** Direct message content and optional referenced-session context. */
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write docs/subsystems/session-telemetry.md
|
|
5
|
-
session-telemetry.md:
|
|
6
|
-
session-telemetry.zh.md:
|
|
5
|
+
session-telemetry.md: 83224cf03005909f9b3d600a950c2d6402ca3b2a
|
|
6
|
+
session-telemetry.zh.md: a093590819d62839fb69a0e50b2d11f495171ec8
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](session-telemetry.zh.md)
|
|
4
4
|
|
|
5
|
-
Outbound session reporting is split as a [capability seam](../capability-seams.md): the Service Definition and capture coordinator ([dsh-session-telemetry](../../packages/session/session-telemetry), `ctx.sessionTelemetry`) own
|
|
5
|
+
Outbound session reporting is split as a [capability seam](../capability-seams.md): the Service Definition and capture coordinator ([dsh-session-telemetry](../../packages/session/session-telemetry), `ctx.sessionTelemetry`) own complete canonical-event capture, the `session-telemetry/record` redaction waterfall, the handoff cursor, and the minimal backend contract; the Service Provider a deployment loads ([dsh-session-telemetry-otel](../../packages/session/session-telemetry-otel)) is the OpenTelemetry JS SDK's log pipeline configured verbatim. It is one optional capability, not part of the agent-loop spine, and nothing here reaches a model request. The boundary axiom — the harness's aspect ends at `emit()`; batching, retry, queueing, and loss policy belong to the reporting SDK — and the rejected alternatives are pinned in the [revival Agent Note](../../.agents/notes/implemented/feature/2026-07-23-session-telemetry-otel-revival.md); the capture and cursor contracts live in the [Service Definition README](../../packages/session/session-telemetry/README.md).
|
|
6
6
|
|
|
7
7
|
Source: [`packages/session/session-telemetry/src/index.ts`](../../packages/session/session-telemetry/src/index.ts)
|
|
8
8
|
|
|
@@ -37,8 +37,9 @@ interface SessionTelemetryRecord {
|
|
|
37
37
|
severity: SessionTelemetrySeverity
|
|
38
38
|
/**
|
|
39
39
|
* Identity attributes, deliberately minimal: ledger records carry
|
|
40
|
-
* `session.id`, `event.type`, `event.seq`, plus
|
|
41
|
-
* `session.
|
|
40
|
+
* `session.id`, `session.format_version`, `event.type`, `event.seq`, plus optional
|
|
41
|
+
* `session.cwd` / `session.parent_id`; a seeded Session also carries
|
|
42
|
+
* `session.seed_length` from its exact inherited event count;
|
|
42
43
|
* ops records carry `telemetry.op`, `session.id`, and (for `agent-error`)
|
|
43
44
|
* `agent.id`, `turn`, `step`, `error.name`. Anything recoverable from the
|
|
44
45
|
* body is intentionally NOT duplicated here.
|
|
@@ -54,7 +55,7 @@ interface SessionTelemetryRecord {
|
|
|
54
55
|
}
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
Every canonical [session event](session.md), including each `assistant/message` or `assistant/attempt` with its complete compact stream and every plugin-merged type the seam never heard of, passes through whole as one ordered ledger record. Process-local `agent/assistant-stream` frames do not enter this durable feed. A new Session object replays its complete log from seq 0, including constructor seed history; re-adopting the same object resumes after its handoff cursor. Delivery is best-effort: the cursor marks handed-off, not delivered, and records can be lost (crash, reload window) or duplicated (new-object replay, SDK retries), so receivers dedupe ledger records on `(session.id, session.format_version, event.seq)`; ops records deliberately omit that identity — they are signals to alert on, not entries to sum, and tolerate duplicates instead.
|
|
58
59
|
|
|
59
60
|
## The sharing disclosure
|
|
60
61
|
|
|
@@ -122,7 +123,7 @@ interface SessionTelemetrySink {
|
|
|
122
123
|
|
|
123
124
|
## The redact waterfall: `session-telemetry/record`
|
|
124
125
|
|
|
125
|
-
Every record passes the `session-telemetry/record` [waterfall](../cordis-primer.md#cordis-waterfall-semantics) between
|
|
126
|
+
Every record passes the `session-telemetry/record` [waterfall](../cordis-primer.md#cordis-waterfall-semantics) between the canonical-event copy and `emit()` ([event entry](#session-telemetryrecord--waterfall)). The seam ships NO rules of its own: with no listener mounted, records reach the backend exactly as captured, so exported data is precisely as clean as the rules a deployment mounts. Listeners stack by transforming `next()`'s return value; returning without `next()` replaces everything beneath; a throwing listener withholds that one record fail-closed inside the coordinator's containment. Redaction applies to the exported copy only — the canonical session log is never rewritten.
|
|
126
127
|
|
|
127
128
|
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
128
129
|
|