|
|
@@ -202,12 +202,43 @@ type ContextForm =
|
|
|
```
|
|
|
|
|
|
```ts type-equiv
|
|
|
-/** Optional producer-declared {@link ContextForm}, mixed into the source shapes that carry one. */
|
|
|
-interface ContextFormed {
|
|
|
- readonly form?: ContextForm
|
|
|
+/** One named contribution to a `snapshot`-form context, in assembly order. */
|
|
|
+interface ContextSnapshotSection {
|
|
|
+ /** The contributing subsystem's name. */
|
|
|
+ readonly name: string
|
|
|
+ /** That contribution's model-facing text, exactly as assembled. */
|
|
|
+ readonly text: string
|
|
|
}
|
|
|
```
|
|
|
|
|
|
+```ts type-equiv
|
|
|
+/**
|
|
|
+ * Producer-declared {@link ContextForm} and the fields that form requires,
|
|
|
+ * mixed into the source shapes that carry one.
|
|
|
+ *
|
|
|
+ * Discriminated by `form` so a producer cannot declare a shape without the
|
|
|
+ * facts that shape is presented from: a `notice` must record its one-line
|
|
|
+ * account, a `snapshot` its sections. Omitting `form` stays valid — an
|
|
|
+ * undeclared context is the documented default.
|
|
|
+ */
|
|
|
+type ContextFormed =
|
|
|
+ | { readonly form?: never }
|
|
|
+ | { readonly form: 'instructions' }
|
|
|
+ | { readonly form: 'catalog' }
|
|
|
+ | {
|
|
|
+ readonly form: 'snapshot'
|
|
|
+ /** The named contributions this snapshot assembled, in order. */
|
|
|
+ readonly sections: readonly ContextSnapshotSection[]
|
|
|
+ }
|
|
|
+ | {
|
|
|
+ readonly form: 'notice'
|
|
|
+ /** One-line account of what happened, shown without expanding the row. */
|
|
|
+ readonly summary: string
|
|
|
+ }
|
|
|
+ | { readonly form: 'relay' }
|
|
|
+ | { readonly form: 'recall' }
|
|
|
+```
|
|
|
+
|
|
|
## Streaming
|
|
|
|
|
|
Adapters emit a raw **chunk** protocol; the loop logs the chunks (replay fidelity) while feeding the same chunks through a `BlockAssembler` to rebuild blocks and messages. `StreamChunk` is a closed discriminated union over `type` — `block-start`, `text-delta`, `reasoning-delta`, `tool-call-delta`, `block-end`, `usage`, `finish`.
|