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.
Files changed (142) hide show
  1. package/README.es.md +5 -1
  2. package/README.hi.md +5 -1
  3. package/README.md +5 -1
  4. package/README.pt.md +5 -1
  5. package/README.zh.md +5 -1
  6. package/dist/dsh-plugin-dev.js +3 -3
  7. package/guide/plugin-dev-guide.md +2 -2
  8. package/guide/quick-reference.es.md +2 -2
  9. package/guide/quick-reference.hi.md +1 -1
  10. package/guide/quick-reference.md +2 -2
  11. package/guide/quick-reference.pt.md +2 -2
  12. package/guide/quick-reference.zh-CN.md +2 -2
  13. package/package.json +3 -3
  14. package/references/official-docs/AGENTS.md +3 -3
  15. package/references/official-docs/SNAPSHOT.md +4 -4
  16. package/references/official-docs/THIRD_PARTY_NOTICES.md +4 -6
  17. package/references/official-docs/docs/agent-lifecycle.i18n.yaml +2 -2
  18. package/references/official-docs/docs/agent-lifecycle.md +5 -3
  19. package/references/official-docs/docs/agent-lifecycle.zh.md +5 -3
  20. package/references/official-docs/docs/architecture.i18n.yaml +2 -2
  21. package/references/official-docs/docs/architecture.md +9 -4
  22. package/references/official-docs/docs/architecture.zh.md +9 -4
  23. package/references/official-docs/docs/capability-seams.i18n.yaml +2 -2
  24. package/references/official-docs/docs/capability-seams.md +8 -1
  25. package/references/official-docs/docs/capability-seams.zh.md +8 -1
  26. package/references/official-docs/docs/config-catalog.i18n.yaml +2 -2
  27. package/references/official-docs/docs/config-catalog.md +104 -68
  28. package/references/official-docs/docs/config-catalog.zh.md +101 -65
  29. package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +2 -2
  30. package/references/official-docs/docs/cookbook/adding-a-package.md +1 -1
  31. package/references/official-docs/docs/cookbook/adding-a-package.zh.md +1 -1
  32. package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +2 -2
  33. package/references/official-docs/docs/cookbook/extension-cookbook.md +12 -10
  34. package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +12 -10
  35. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.i18n.yaml +2 -2
  36. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.md +16 -12
  37. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.zh.md +16 -12
  38. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +2 -2
  39. package/references/official-docs/docs/event-producer-consumer.md +30 -29
  40. package/references/official-docs/docs/event-producer-consumer.zh.md +35 -34
  41. package/references/official-docs/docs/module-graph.i18n.yaml +2 -2
  42. package/references/official-docs/docs/module-graph.md +214 -360
  43. package/references/official-docs/docs/module-graph.zh.md +214 -360
  44. package/references/official-docs/docs/persistence-catalog.i18n.yaml +2 -2
  45. package/references/official-docs/docs/persistence-catalog.md +74 -64
  46. package/references/official-docs/docs/persistence-catalog.zh.md +72 -62
  47. package/references/official-docs/docs/subsystems/agent-team.i18n.yaml +2 -2
  48. package/references/official-docs/docs/subsystems/agent-team.md +4 -3
  49. package/references/official-docs/docs/subsystems/agent-team.zh.md +4 -3
  50. package/references/official-docs/docs/subsystems/attachment.i18n.yaml +2 -2
  51. package/references/official-docs/docs/subsystems/attachment.md +157 -4
  52. package/references/official-docs/docs/subsystems/attachment.zh.md +157 -4
  53. package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +2 -2
  54. package/references/official-docs/docs/subsystems/code-runtime.md +7 -3
  55. package/references/official-docs/docs/subsystems/code-runtime.zh.md +7 -3
  56. package/references/official-docs/docs/subsystems/commands.i18n.yaml +2 -2
  57. package/references/official-docs/docs/subsystems/commands.md +25 -16
  58. package/references/official-docs/docs/subsystems/commands.zh.md +25 -16
  59. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +2 -2
  60. package/references/official-docs/docs/subsystems/compaction.md +9 -9
  61. package/references/official-docs/docs/subsystems/compaction.zh.md +9 -9
  62. package/references/official-docs/docs/subsystems/conversation.i18n.yaml +2 -2
  63. package/references/official-docs/docs/subsystems/conversation.md +4 -4
  64. package/references/official-docs/docs/subsystems/conversation.zh.md +4 -4
  65. package/references/official-docs/docs/subsystems/core.i18n.yaml +2 -2
  66. package/references/official-docs/docs/subsystems/core.md +66 -4
  67. package/references/official-docs/docs/subsystems/core.zh.md +66 -4
  68. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +2 -2
  69. package/references/official-docs/docs/subsystems/feedback.md +2 -2
  70. package/references/official-docs/docs/subsystems/feedback.zh.md +2 -2
  71. package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +2 -2
  72. package/references/official-docs/docs/subsystems/llm-streaming.md +23 -2
  73. package/references/official-docs/docs/subsystems/llm-streaming.zh.md +23 -2
  74. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +2 -2
  75. package/references/official-docs/docs/subsystems/persistence.md +183 -191
  76. package/references/official-docs/docs/subsystems/persistence.zh.md +183 -191
  77. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +2 -2
  78. package/references/official-docs/docs/subsystems/schedule.md +1 -1
  79. package/references/official-docs/docs/subsystems/schedule.zh.md +1 -1
  80. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +2 -2
  81. package/references/official-docs/docs/subsystems/session-projection.md +40 -17
  82. package/references/official-docs/docs/subsystems/session-projection.zh.md +40 -17
  83. package/references/official-docs/docs/subsystems/session-query.i18n.yaml +2 -2
  84. package/references/official-docs/docs/subsystems/session-query.md +19 -13
  85. package/references/official-docs/docs/subsystems/session-query.zh.md +19 -13
  86. package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +2 -2
  87. package/references/official-docs/docs/subsystems/session-reference.md +25 -1
  88. package/references/official-docs/docs/subsystems/session-reference.zh.md +25 -1
  89. package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +2 -2
  90. package/references/official-docs/docs/subsystems/session-telemetry.md +6 -5
  91. package/references/official-docs/docs/subsystems/session-telemetry.zh.md +6 -5
  92. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +2 -2
  93. package/references/official-docs/docs/subsystems/session-title.md +5 -5
  94. package/references/official-docs/docs/subsystems/session-title.zh.md +5 -5
  95. package/references/official-docs/docs/subsystems/session.i18n.yaml +2 -2
  96. package/references/official-docs/docs/subsystems/session.md +143 -71
  97. package/references/official-docs/docs/subsystems/session.zh.md +143 -71
  98. package/references/official-docs/docs/subsystems/slots.i18n.yaml +2 -2
  99. package/references/official-docs/docs/subsystems/slots.md +1 -0
  100. package/references/official-docs/docs/subsystems/slots.zh.md +1 -0
  101. package/references/official-docs/docs/subsystems/storage.i18n.yaml +2 -2
  102. package/references/official-docs/docs/subsystems/storage.md +28 -5
  103. package/references/official-docs/docs/subsystems/storage.zh.md +28 -5
  104. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +2 -2
  105. package/references/official-docs/docs/subsystems/subagent.md +32 -88
  106. package/references/official-docs/docs/subsystems/subagent.zh.md +31 -87
  107. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +2 -2
  108. package/references/official-docs/docs/subsystems/token-meter.md +2 -2
  109. package/references/official-docs/docs/subsystems/token-meter.zh.md +2 -2
  110. package/references/official-docs/docs/subsystems/web-client.i18n.yaml +2 -2
  111. package/references/official-docs/docs/subsystems/web-client.md +1 -1
  112. package/references/official-docs/docs/subsystems/web-client.zh.md +1 -1
  113. package/references/official-docs/docs/subsystems/workspace.i18n.yaml +2 -2
  114. package/references/official-docs/docs/subsystems/workspace.md +8 -8
  115. package/references/official-docs/docs/subsystems/workspace.zh.md +8 -8
  116. package/references/official-docs/docs/testing.i18n.yaml +2 -2
  117. package/references/official-docs/docs/testing.md +2 -2
  118. package/references/official-docs/docs/testing.zh.md +2 -2
  119. package/references/official-docs/docs/tool-catalog.i18n.yaml +2 -2
  120. package/references/official-docs/docs/tool-catalog.md +9 -63
  121. package/references/official-docs/docs/tool-catalog.zh.md +8 -62
  122. package/references/official-docs/docs/user/guide/network-proxy.i18n.yaml +6 -0
  123. package/references/official-docs/docs/user/guide/network-proxy.md +85 -0
  124. package/references/official-docs/docs/user/guide/network-proxy.zh.md +85 -0
  125. package/references/official-docs/docs/user/guide/providers.i18n.yaml +2 -2
  126. package/references/official-docs/docs/user/guide/providers.md +70 -17
  127. package/references/official-docs/docs/user/guide/providers.zh.md +70 -17
  128. package/references/official-docs/docs/web-styling.i18n.yaml +2 -2
  129. package/references/official-docs/docs/web-styling.md +4 -0
  130. package/references/official-docs/docs/web-styling.zh.md +4 -0
  131. package/references/official-docs/packages/AGENTS.md +2 -2
  132. package/references/official-docs/website-docs.ts +8 -0
  133. package/templates/js/README.es.md +1 -1
  134. package/templates/js/README.hi.md +1 -1
  135. package/templates/js/README.md +1 -1
  136. package/templates/js/README.pt.md +1 -1
  137. package/templates/js/README.zh.md +1 -1
  138. package/templates/ts/README.es.md +1 -1
  139. package/templates/ts/README.hi.md +1 -1
  140. package/templates/ts/README.md +1 -1
  141. package/templates/ts/README.pt.md +1 -1
  142. package/templates/ts/README.zh.md +1 -1
@@ -8,7 +8,7 @@
8
8
 
9
9
  ## 输入元数据
10
10
 
11
- 该服务公开一个可选的非结构化输入描述符:提示文本加图片接受标志。命令的可用性由插件组合决定:每个消费注册表的适配器都会看到全部生效定义。
11
+ 该服务公开一个可选的非结构化输入描述符:提示文本加附件接受标志。命令的可用性由插件组合决定:每个消费注册表的适配器都会看到全部生效定义。
12
12
 
13
13
  ```ts type-equiv
14
14
  /** Immutable metadata for a command's optional unstructured input. */
@@ -16,13 +16,13 @@ interface CommandInputDescriptor {
16
16
  /** Placeholder shown before the user supplies free-form input. */
17
17
  readonly hint: string
18
18
  /**
19
- * Whether composer image attachments may accompany an invocation. Absent or
20
- * false = the executor rejects an invocation carrying images and capable
19
+ * Whether composer attachments may accompany an invocation. Absent or
20
+ * false = the executor rejects an invocation carrying attachments and capable
21
21
  * composers refuse the submission before dispatch. A declaring command's
22
22
  * handler receives the admitted durable blocks and owns every further
23
23
  * grammar decision, including rejecting sub-commands that cannot use them.
24
24
  */
25
- readonly images?: boolean
25
+ readonly attachments?: boolean
26
26
  }
27
27
  ```
28
28
 
@@ -64,13 +64,13 @@ interface CommandInvocation {
64
64
  /** Exact text following the registered command name, including separator whitespace. */
65
65
  readonly rawInput: string
66
66
  /**
67
- * Durably admitted image blocks accompanying this invocation, in submission
68
- * order; empty unless the definition declares `input.images`. The handler
67
+ * Durably admitted image and file blocks accompanying this invocation, in submission
68
+ * order; empty unless the definition declares `input.attachments`. The handler
69
69
  * owns their model-visible use — the registry never schedules them itself —
70
70
  * and a handler whose grammar cannot use them in this invocation returns an
71
71
  * error so the dispatching composer retains the originals.
72
72
  */
73
- readonly attachments: readonly ImageBlock[]
73
+ readonly attachments: readonly (ImageBlock | FileBlock)[]
74
74
  /** Cancellation signal owned by the dispatching UI request. */
75
75
  readonly signal: AbortSignal
76
76
  }
@@ -83,7 +83,7 @@ type CommandResult =
83
83
  readonly kind: 'success'
84
84
  readonly text?: string
85
85
  /** Earlier authoritative domain event that owns a richer presentation. */
86
- readonly sourceEventSeq?: number
86
+ readonly sourceEventSeq?: SessionSeq
87
87
  }
88
88
  | { readonly kind: 'error'; readonly text: string }
89
89
  ```
@@ -138,6 +138,13 @@ Human-command registry. Plain-context definitions are global; definitions regist
138
138
  */
139
139
  register(definition: CommandDefinition): () => void
140
140
 
141
+ /**
142
+ * Register the sole authority that resolves staged file receipts for command submissions.
143
+ * @param resolver - Session-aware receipt resolver.
144
+ * @returns disposer that removes this exact resolver.
145
+ */
146
+ registerFileReceiptResolver(resolver: CommandFileReceiptResolver): () => void
147
+
141
148
  /**
142
149
  * List the effective immutable command descriptors for one agent.
143
150
  * @param agent - exact receiving agent and scoped-layer key.
@@ -166,23 +173,25 @@ find(agent: Agent, name: string): CommandDefinition | undefined
166
173
  * handler-failure path is contained so the handler's own error stays the
167
174
  * reported failure.
168
175
  *
169
- * Image admission is enforced here, not in the composer: images sent to a
170
- * command that does not declare `input.images`, an absent attachment store,
171
- * and an exceeded attachment limit each settle as an error result before
172
- * the handler runs, and a rejected batch publishes no durable object.
176
+ * Attachment admission is enforced here, not in the composer: attachments sent to a
177
+ * command that does not declare `input.attachments`, an absent attachment store,
178
+ * and an exceeded image limit each settle as an error result before
179
+ * the handler runs. Validation rejection starts no attachment writes;
180
+ * a storage failure can leave only unreachable content-addressed objects
181
+ * for deferred collection.
173
182
  *
174
183
  * @param agent - exact receiving agent.
175
184
  * @param line - complete slash-command line.
176
- * @param images - base64-encoded composer images accompanying the line, in
177
- * submission order; empty for a plain invocation.
185
+ * @param submittedAttachments - encoded images and staged file receipts accompanying the line,
186
+ * in submission order; empty for a plain invocation.
178
187
  * @param signal - cancellation signal owned by the UI request.
179
188
  * @returns the settled execution (result + lifecycle pairing id), or
180
189
  * `undefined` when syntax or name does not resolve.
181
190
  */
182
- @Remote async execute( agent: Agent, line: string, images: readonly EncodedImageAttachment[], signal: AbortSignal, ): Promise<CommandExecution | undefined>
191
+ @Remote async execute( agent: Agent, line: string, submittedAttachments: readonly CommandSubmitAttachment[], signal: AbortSignal, ): Promise<CommandExecution | undefined>
183
192
  ```
184
193
 
185
- Types: [Agent](core.zh.md) · [EncodedImageAttachment](attachment.zh.md)
194
+ Types: [Agent](core.zh.md)
186
195
 
187
196
  Source: [`packages/interaction/commands/src/index.ts`](../../packages/interaction/commands/src/index.ts)
188
197
 
@@ -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/compaction.md
5
- compaction.md: 03642b32cc3cb3caf743d908e9c988c1a3c8fa1e
6
- compaction.zh.md: af37c4824cc4b01515400049525fbd7b91d018f3
5
+ compaction.md: b49957a5f476a02ccd12b791f287a9675073c0ae
6
+ compaction.zh.md: 4b4c6845b8ff48bce019b352a811f968628cbdbf
@@ -34,11 +34,11 @@ interface CompactionResult {
34
34
  /** Human command that initiated this compaction, when it was manual. */
35
35
  sourceCommandId?: CommandId
36
36
  /** The seq of the appended `compaction/start` event. */
37
- startSeq: number
37
+ startSeq: SessionSeq
38
38
  /** The seq of the appended `compaction/summary` event. */
39
- summarySeq: number
39
+ summarySeq: SessionSeq
40
40
  /** The seq of the appended `compaction/end` event. */
41
- endSeq: number
41
+ endSeq: SessionSeq
42
42
  /** The summary content blocks produced by the backend. */
43
43
  summary: ContentBlock[]
44
44
  /**
@@ -49,9 +49,9 @@ interface CompactionResult {
49
49
  * can be GREATER than `end`. {@link CompactionResult.shadowedSeqs} is the
50
50
  * authoritative set of shadowed nodes, in surface order.
51
51
  */
52
- shadowedRange: { start: number; end: number }
52
+ shadowedRange: { start: SessionSeq; end: SessionSeq }
53
53
  /** The seqs of all shadowed surface nodes, in surface order. */
54
- shadowedSeqs: number[]
54
+ shadowedSeqs: SessionSeq[]
55
55
  /** Estimated token count of the shadowed content. */
56
56
  shadowedTokenCount: number
57
57
  }
@@ -95,9 +95,9 @@ The optional tool-result pruning service reports each durable content replacemen
95
95
  /** Cited source event and size accounting for one landed surface replacement. */
96
96
  interface PrunedEntry {
97
97
  /** Full-fidelity tool-result event shadowed by the replacement. */
98
- readonly originalSeq: number
98
+ readonly originalSeq: SessionSeq
99
99
  /** Newly appended pruned tool-result event. */
100
- readonly replacementSeq: number
100
+ readonly replacementSeq: SessionSeq
101
101
  /** Tool call shared by the original and replacement. */
102
102
  readonly callId: ToolCallId
103
103
  /** Original text size in Unicode code points. */
@@ -187,10 +187,10 @@ abstract compactNow( agent: ManualCompactAgentContext, signal: AbortSignal, sour
187
187
  * @throws when compaction is active or the range is missing, reversed, or unbalanced.
188
188
  * @returns the appended event seqs, summary, replaced range, and token accounting.
189
189
  */
190
- abstract compactRegion( start: number, end: number, agent: CompactionAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>
190
+ abstract compactRegion( start: SessionSeq, end: SessionSeq, agent: CompactionAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>
191
191
  ```
192
192
 
193
- Types: [CommandId](commands.md)
193
+ Types: [CommandId](commands.md) · [SessionSeq](session.md)
194
194
 
195
195
  Source: [`packages/compaction/compaction/src/index.ts`](../../packages/compaction/compaction/src/index.ts)
196
196
 
@@ -34,11 +34,11 @@ interface CompactionResult {
34
34
  /** Human command that initiated this compaction, when it was manual. */
35
35
  sourceCommandId?: CommandId
36
36
  /** The seq of the appended `compaction/start` event. */
37
- startSeq: number
37
+ startSeq: SessionSeq
38
38
  /** The seq of the appended `compaction/summary` event. */
39
- summarySeq: number
39
+ summarySeq: SessionSeq
40
40
  /** The seq of the appended `compaction/end` event. */
41
- endSeq: number
41
+ endSeq: SessionSeq
42
42
  /** The summary content blocks produced by the backend. */
43
43
  summary: ContentBlock[]
44
44
  /**
@@ -49,9 +49,9 @@ interface CompactionResult {
49
49
  * can be GREATER than `end`. {@link CompactionResult.shadowedSeqs} is the
50
50
  * authoritative set of shadowed nodes, in surface order.
51
51
  */
52
- shadowedRange: { start: number; end: number }
52
+ shadowedRange: { start: SessionSeq; end: SessionSeq }
53
53
  /** The seqs of all shadowed surface nodes, in surface order. */
54
- shadowedSeqs: number[]
54
+ shadowedSeqs: SessionSeq[]
55
55
  /** Estimated token count of the shadowed content. */
56
56
  shadowedTokenCount: number
57
57
  }
@@ -95,9 +95,9 @@ type ManualCompactionErrorCode =
95
95
  /** Cited source event and size accounting for one landed surface replacement. */
96
96
  interface PrunedEntry {
97
97
  /** Full-fidelity tool-result event shadowed by the replacement. */
98
- readonly originalSeq: number
98
+ readonly originalSeq: SessionSeq
99
99
  /** Newly appended pruned tool-result event. */
100
- readonly replacementSeq: number
100
+ readonly replacementSeq: SessionSeq
101
101
  /** Tool call shared by the original and replacement. */
102
102
  readonly callId: ToolCallId
103
103
  /** Original text size in Unicode code points. */
@@ -187,10 +187,10 @@ abstract compactNow( agent: ManualCompactAgentContext, signal: AbortSignal, sour
187
187
  * @throws when compaction is active or the range is missing, reversed, or unbalanced.
188
188
  * @returns the appended event seqs, summary, replaced range, and token accounting.
189
189
  */
190
- abstract compactRegion( start: number, end: number, agent: CompactionAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>
190
+ abstract compactRegion( start: SessionSeq, end: SessionSeq, agent: CompactionAgentContext, signal?: AbortSignal, ): Promise<CompactionResult>
191
191
  ```
192
192
 
193
- Types: [CommandId](commands.zh.md)
193
+ Types: [CommandId](commands.zh.md) · [SessionSeq](session.zh.md)
194
194
 
195
195
  Source: [`packages/compaction/compaction/src/index.ts`](../../packages/compaction/compaction/src/index.ts)
196
196
 
@@ -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/conversation.md
5
- conversation.md: df1476537b95690ae2055f367e8586653b99a9a9
6
- conversation.zh.md: 784f52975cbb829d8914ef630aa1041693e1de62
5
+ conversation.md: 61e76e1b057be7b47150bd623b3e04400b50e394
6
+ conversation.zh.md: 5b54625fcfe9ac451e79a42c387a5cf0836ee39a
@@ -8,12 +8,12 @@ This page defines the data model and the extension path for a business-owned Con
8
8
 
9
9
  ## Data model and ownership
10
10
 
11
- The Session Controller owns the contiguous loaded logical-event window. Each `SessionEventLikeEntry` is either `{ type: 'event', event: SessionEvent }` or `{ type: 'chunks', event: ChunkRowEvent }`; both inner events expose `type`, `seq`, `time`, and `data`. `ui-conversation` passes these entries to the assembler without opening a second history stream, converting records, or expanding packed members. One `ConversationNodeAssembler` per Session applies every registered Definition and publishes an independent source for each registered view target.
11
+ The Session Controller owns the contiguous loaded logical-event window. Each `SessionEventLikeEntry` is either `{ type: 'event', event: SessionEvent }` for one durable event or `{ type: 'transient', event: AssistantLiveChunkEvent }` for one Client-only `assistant/live-chunk` presentation. Both inner events expose `type`, `seq`, `time`, and `data`. `ui-conversation` passes these entries to the assembler without opening a second history stream. One `ConversationNodeAssembler` per Session applies every registered Definition and publishes an independent source for each registered view target.
12
12
 
13
13
  | Concept | Owner and purpose |
14
14
  |---|---|
15
- | Event Definition | A business package matches one standard event or packed Assistant run at a time, correlates it by stable `(kind, id)`, folds deterministic State, and optionally materializes one target node. |
16
- | Context | The engine-owned ordered Matches and current State for one `(kind, id)`. A packed run occupies one update Match; update-only evidence may remain pending until pagination supplies its unique scalar start. |
15
+ | Event Definition | A business package matches one durable or Client-only transient event at a time, correlates it by stable `(kind, id)`, folds deterministic State, and optionally materializes one target node. |
16
+ | Context | The engine-owned ordered Matches and current State for one `(kind, id)`. A transient event occupies one update Match; update-only evidence may remain pending until pagination supplies its unique durable start. |
17
17
  | Location | The engine-owned Session, Turn, or Step coordinates derived from durable boundary events. Definitions may publish typed data onto one Turn or Step. |
18
18
  | View Definition | A target package creates one incremental builder per Session and owns the final snapshot type for that target. |
19
19
  | View | A Slot entry such as Chat or Trajectory reads only its target snapshot and renders target-owned nodes. |
@@ -42,7 +42,7 @@ Use the producer-owned branded id type across the process boundary. Put the `Ses
42
42
 
43
43
  Incremental events are supported. Prefer whole-value checkpoints when the producer can emit them cheaply, because they remain useful when the start is outside the loaded window. Each delta must carry the stable id and produce deterministic State when replayed in ascending log `seq`; it must not depend on live-only memory. If the current history window contains only updates, the assembler keeps a pending Context and builds no State until an older page supplies the start. If the product must render before the start is loaded, a terminal or checkpoint event must carry enough whole fallback state for the Definition to build that result directly; do not recover it by scanning unrelated events.
44
44
 
45
- Historical runs of consecutive same-block `assistant/chunk` deltas arrive as `chunkrow/text-chunks`, `chunkrow/reasoning-chunks`, or `chunkrow/tool-call-chunks`. Their top-level `seq` and `time` identify the first logical member, and their `data` retains each fragment and timestamp gap. These Client-only events can only be updates; `start()` receives a standard `SessionEvent`. A Definition that consumes Assistant deltas handles the relevant packed tags in the same `match()` and `update()` methods, while other Definitions return `null` without expanding the run.
45
+ Live Assistant deltas arrive as Client-only `assistant/live-chunk` updates. Reconnect baselines expand the active process-local compact stream into the same transient events, while durable `assistant/message` and `assistant/attempt` events embed complete compact streams for history replay. Transient events can only be updates; `start()` receives a standard `SessionEvent`. A Definition that consumes Assistant output handles live chunks and durable settlements in the same `match()` and `update()` methods, while unrelated Definitions return `null` without expanding a stream.
46
46
 
47
47
  ## Definition and typed Chat payload
48
48
 
@@ -8,12 +8,12 @@ Conversation 是 Client `SessionEventLikeEntry` window 与浏览器 view 之间
8
8
 
9
9
  ## 数据模型与所有权
10
10
 
11
- Session Controller 拥有连续的已加载逻辑 event window。每个 `SessionEventLikeEntry` 都是 `{ type: 'event', event: SessionEvent }` `{ type: 'chunks', event: ChunkRowEvent }`;两种内部 event 都公开 `type`、`seq`、`time` 与 `data`。`ui-conversation` 把这些 entry 直接交给 assembler,不另开 history stream、不转换 record,也不展开 packed member。每个 Session 对应一个 `ConversationNodeAssembler`,它应用所有已注册 Definition,并为每个已注册 view target 发布独立 source。
11
+ Session Controller 拥有连续的已加载逻辑 event window。每个 `SessionEventLikeEntry` 要么是表示一个持久事件的 `{ type: 'event', event: SessionEvent }`,要么是表示一个 Client-only `assistant/live-chunk` 呈现的 `{ type: 'transient', event: AssistantLiveChunkEvent }`;两种内部 event 都公开 `type`、`seq`、`time` 与 `data`。`ui-conversation` 把这些 entry 直接交给 assembler,不另开 history stream。每个 Session 对应一个 `ConversationNodeAssembler`,它应用所有已注册 Definition,并为每个已注册 view target 发布独立 source。
12
12
 
13
13
  | 概念 | Owner 与用途 |
14
14
  |---|---|
15
- | Event Definition | 业务包一次匹配一条标准 event 或一个 packed Assistant run,以稳定 `(kind, id)` 关联输入、折叠确定性 State,并可选择 materialize 一个 target node。 |
16
- | Context | Engine 为一个 `(kind, id)` 拥有的有序 Match 与当前 State。一个 packed run 只占一个 update Match;只有 update 的证据可以保持 pending,直到分页补齐其唯一 scalar start。 |
15
+ | Event Definition | 业务包一次匹配一个持久 event Client-only 瞬态 event,以稳定 `(kind, id)` 关联输入、折叠确定性 State,并可选择 materialize 一个 target node。 |
16
+ | Context | Engine 为一个 `(kind, id)` 拥有的有序 Match 与当前 State。一个瞬态 event 只占一个 update Match;只有 update 的证据可以保持 pending,直到分页补齐其唯一持久 start。 |
17
17
  | Location | Engine 根据持久 boundary event 推导的 Session、Turn 或 Step 坐标。Definition 可以向一个 Turn 或 Step 发布类型化数据。 |
18
18
  | View Definition | Target 包为每个 Session 创建一个增量 builder,并拥有该 target 的最终 snapshot 类型。 |
19
19
  | View | Chat 或 Trajectory 等 Slot entry 只读取自身 target snapshot,并渲染 target 自有 node。 |
@@ -42,7 +42,7 @@ shell 拥有 View 选择,并在 binding 创建、被选为 current 或 View ro
42
42
 
43
43
  系统支持增量事件。如果生产方能以较低成本发出 whole-value checkpoint,应优先采用,因为 start 位于已加载窗口之外时它仍可直接使用。每条 delta 都必须携带稳定 id,并且按照日志 `seq` 升序回放时能够确定性地产生 State;它不能依赖只存在于实时内存中的状态。如果当前历史窗口只有 update,Assembler 会保留一个 pending Context,并在更早分页补齐 start 前不构造 State。如果产品必须在 start 尚未加载时渲染,terminal 或 checkpoint 事件就必须携带足够的完整 fallback 状态,让 Definition 能直接构造结果;不要通过扫描无关事件恢复它。
44
44
 
45
- 连续且属于同一 block 的历史 `assistant/chunk` delta 会以 `chunkrow/text-chunks`、`chunkrow/reasoning-chunks` `chunkrow/tool-call-chunks` 到达。顶层 `seq` 与 `time` 表示首个逻辑成员,`data` 保留每个 fragment timestamp gap。这些 Client-only event 只能充当 update;`start()` 只接收标准 `SessionEvent`。消费 Assistant delta Definition 在同一组 `match()` 与 `update()` 方法里处理相关 packed tag,其他 Definition 直接返回 `null`,无需展开该 run
45
+ 实时 Assistant delta 作为 Client-only `assistant/live-chunk` update 到达。重连 baseline 会把活跃的进程内紧凑 stream 展开为相同的瞬态 event,持久 `assistant/message` 与 `assistant/attempt` event 则嵌入完整紧凑 stream 供历史回放。瞬态 event 只能充当 update;`start()` 只接收标准 `SessionEvent`。消费 Assistant 输出的 Definition 在同一组 `match()` 与 `update()` 方法里处理 live chunk 与持久 settlement,其他 Definition 直接返回 `null`,无需展开 stream
46
46
 
47
47
  ## Definition 与类型化 Chat payload
48
48
 
@@ -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/core.md
5
- core.md: 124d30a5abeddd81edd2eb03a9bb213487b6a38e
6
- core.zh.md: c2d67eabb3b223d3f1d20c42f01280f16656ebef
5
+ core.md: 2f907062e89b9af12cd1b47d52d195866df62254
6
+ core.zh.md: a5649032b81cf4adf49253f74c46c46beb800969
@@ -46,7 +46,7 @@ interface AgentHandle {
46
46
  }
47
47
  ```
48
48
 
49
- `CreateAgentOptions` carries the shared identity and everything a fresh agent needs before publication: session metadata (`meta` — validated `cwd`, fork lineage, seed boundary, origin classification, delegation depth), an optional `seed` replay prefix for forks, per-agent `AgentOptions`, a creation-only cancellation `signal`, and `setup`. `ResumeAgentOptions` is the persisted-identity counterpart: `resumeSessionId`, `agentOptions`, `signal`, and `setup`. The `setup` callback (`AgentSetup`) composes the agent's scoped world while both ids are still unpublished — everything registered through `agentCtx` exists before `agent/created` and the first prompt assembly — and may return a synchronous commit invoked immediately before publication; a setup rejection, commit throw, or owner disposal rolls the transaction back without publishing either id.
49
+ `CreateAgentOptions` carries the shared identity and everything a fresh agent needs before publication: session metadata (`meta` — validated `cwd`, fork lineage, the `isSeeded` marker, origin classification, delegation depth, and `agentPreset`), the exact fork cut in sibling field `inheritedEventCount`, an optional `seed` replay prefix, per-agent `AgentOptions`, a creation-only cancellation `signal`, and `setup`. `ResumeAgentOptions` is the persisted-identity counterpart: `resumeSessionId`, `agentOptions`, `signal`, and `setup`. The `setup` callback (`AgentSetup`) composes the agent's scoped world while both ids are still unpublished — everything registered through `agentCtx` exists before `agent/created` and the first prompt assembly — and may return a synchronous commit invoked immediately before publication; a setup rejection, commit throw, or owner disposal rolls the transaction back without publishing either id.
50
50
 
51
51
  `AgentFactory` is the creation interface behind the registry: the loop registers its factory via `ctx.agents.setFactory()`, so consumers use `ctx.agents` without depending on the concrete loop package. The exact `create`/`resume` signatures and rollback contracts are in the [generated section](#ctxagents--agentregistry) below.
52
52
 
@@ -152,6 +152,44 @@ interface Agent {
152
152
  type AgentStatus = 'idle' | 'running'
153
153
  ```
154
154
 
155
+ ```ts type-equiv
156
+ /** One process-local live assistant streaming publication. */
157
+ type AssistantStreamFrame =
158
+ | {
159
+ readonly type: 'start'
160
+ readonly attemptId: LlmAttemptId
161
+ /** Monotone within one attached Agent lifecycle; replacement restarts at 1. */
162
+ readonly revision: number
163
+ readonly turn: number
164
+ readonly step: number
165
+ }
166
+ | {
167
+ readonly type: 'chunk'
168
+ readonly attemptId: LlmAttemptId
169
+ readonly revision: number
170
+ /** Dense zero-based position within the attempt. */
171
+ readonly index: number
172
+ /** Safe-integer timestamp reused by the durable embedded stream. */
173
+ readonly time: number
174
+ readonly chunk: StreamChunk
175
+ }
176
+ | {
177
+ readonly type: 'end'
178
+ readonly attemptId: LlmAttemptId
179
+ readonly revision: number
180
+ /** Number of chunk frames emitted by this attempt. */
181
+ readonly index: number
182
+ /** Durable settlement committed before this notification, or live abandonment without one. */
183
+ readonly outcome:
184
+ | {
185
+ readonly kind: 'committed'
186
+ readonly eventType: 'assistant/message' | 'assistant/attempt'
187
+ readonly seq: SessionSeq
188
+ }
189
+ | { readonly kind: 'abandoned' }
190
+ }
191
+ ```
192
+
155
193
  `running` describes the driver-wide drain interval and may span consecutive queued turns; it does not prove a turn is still open. Disposal removes the agent from the registry and emits `agent/disposed`; it is not a terminal status value. `followup()` returns no handle: its `MessageId` identifies durable inbox insertion, claim, and discard facts, not a later assistant output or turn ending. `whenIdle()` observes the whole agent, so callers may call a receipt-to-idle interval a run only when they explicitly own that interval ([decision](../../.agents/notes/implemented/architecture/2026-07-30-followup-enqueue-and-owned-runs.md)).
156
194
 
157
195
  ```ts type-equiv
@@ -252,7 +290,7 @@ type SessionStartSource = 'startup' | 'resume' | 'clear' | 'compact'
252
290
 
253
291
  A `Session` is an **append-only log** of typed `SessionEvent`s — the single source of truth. The LLM message history is *derived* from the log (`deriveMessages()`), not stored separately. Every entry carries a monotonic `seq`, a `time`, and a `type`-discriminated `data` payload; surface variants may also list cited earlier events in `sourceEventSeqs` and carry a `surfaceOp`.
254
292
 
255
- The `SessionEvent` envelope's exact conditional fields, the twelve core event variants (`turn/start`, `turn/end`, `step/start`, `step/end`, `user/message`, `assistant/chunk`, `assistant/message`, `tool/call`, `tool/result`, `request/header`, `request/context`, `session/end-seed`), the `deriveMessages()` projection rules, the `TurnEndReason` reasons, and the execution-enclosure and standalone-event rules are on **[session.md](session.md)**. How the log is made durable — the `SessionPersistence` interface, JSONL provider, `session/flush` checkpoint, crash recovery, and `SessionHeader` — is on **[persistence.md](persistence.md)**.
293
+ The `SessionEvent` envelope's exact conditional fields, the twelve core event variants (`turn/start`, `turn/end`, `step/start`, `step/end`, `user/message`, `assistant/message`, `assistant/attempt`, `tool/call`, `tool/result`, `request/header`, `request/context`, `session/end-seed`), the `deriveMessages()` projection rules, the `TurnEndReason` reasons, and the execution-enclosure and standalone-event rules are on **[session.md](session.md)**. How the log is made durable — the `SessionPersistence` interface, JSONL provider, `session/flush` checkpoint, crash recovery, and `SessionHeader` — is on **[persistence.md](persistence.md)**.
256
294
 
257
295
  ## `ToolDefinition`
258
296
 
@@ -356,13 +394,14 @@ Concrete agent factory and driver service.
356
394
  /**
357
395
  * Create an agent and session under one caller-supplied identity, owned by
358
396
  * the accessing fiber. Constructor-driven config calls mint a fresh combined
359
- * id before entering this boundary.
397
+ * id before entering this boundary. When a persistence backend is mounted,
398
+ * the session's durable identity and any seed are stored before publication.
360
399
  * @param id - shared agent/session identity.
361
400
  * @param options - concrete loop options.
362
401
  * @param meta - optional fresh-session workspace metadata.
363
402
  * @returns the published running agent.
364
403
  */
365
- create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent
404
+ async create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Promise<Agent>
366
405
 
367
406
  /**
368
407
  * Create an owned agent on a caller-supplied session id.
@@ -803,6 +842,29 @@ Source: [`packages/core/agent/src/index.ts`](../../packages/core/agent/src/index
803
842
 
804
843
  ### `agent/*` events
805
844
 
845
+ <a id="agentassistant-stream--emit"></a>
846
+
847
+ #### `agent/assistant-stream` — emit
848
+
849
+ Process-local assistant-stream publication. Chunk frames are transient; the loop appends one final v2 `assistant/message` or `assistant/attempt` with the same stream before a committed end frame.
850
+
851
+ ```ts cordis-catalog
852
+ /**
853
+ * Process-local assistant-stream publication. Chunk frames are transient;
854
+ * the loop appends one final v2 `assistant/message` or `assistant/attempt`
855
+ * with the same stream before a committed end frame.
856
+ * @param payload.agent - the agent whose attempt produced the frame.
857
+ * @param payload.frame - one ordered start, chunk, or end publication.
858
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent.
859
+ * @mode emit
860
+ */
861
+ 'agent/assistant-stream'(this: Scoped<Agent>, payload: { agent: Agent; frame: AssistantStreamFrame }): void
862
+ ```
863
+
864
+ Types: [Scoped](scope.md)
865
+
866
+ Source: [`packages/core/agent/src/runtime-types.ts`](../../packages/core/agent/src/runtime-types.ts)
867
+
806
868
  <a id="agentcreated--emit"></a>
807
869
 
808
870
  #### `agent/created` — emit
@@ -48,7 +48,7 @@ interface AgentHandle {
48
48
  }
49
49
  ```
50
50
 
51
- `CreateAgentOptions` 携带共享标识以及新 agent 发布前所需的一切:会话元数据(`meta`——已校验的 `cwd`、fork 谱系、seed 边界、来源分类、委派深度)、fork 用的可选 `seed` 回放前缀、按 agent 的 `AgentOptions`、仅创建期有效的取消 `signal`,以及 `setup`。`ResumeAgentOptions` 是持久标识的对应项:`resumeSessionId`、`agentOptions`、`signal` 与 `setup`。`setup` 回调(`AgentSetup`)在两个 id 都尚未发布时组装 agent 的作用域世界——凡经 `agentCtx` 注册的内容都先于 `agent/created` 与第一次提示词组装存在——并可返回一个在发布前一刻调用的同步 commit;setup 拒绝、commit 抛出或所有者 dispose(资源释放)都会回滚事务,两个 id 均不发布。
51
+ `CreateAgentOptions` 携带共享标识以及新 agent 发布前所需的一切:会话元数据(`meta`——已校验的 `cwd`、fork 谱系、`isSeeded` 标记、来源分类、委派深度与 `agentPreset`)、同级字段 `inheritedEventCount` 所表示的精确 fork cut、可选的 `seed` 回放前缀、按 agent 的 `AgentOptions`、仅创建期有效的取消 `signal`,以及 `setup`。`ResumeAgentOptions` 是持久标识的对应项:`resumeSessionId`、`agentOptions`、`signal` 与 `setup`。`setup` 回调(`AgentSetup`)在两个 id 都尚未发布时组装 agent 的作用域世界——凡经 `agentCtx` 注册的内容都先于 `agent/created` 与第一次提示词组装存在——并可返回一个在发布前一刻调用的同步 commit;setup 拒绝、commit 抛出或所有者 dispose(资源释放)都会回滚事务,两个 id 均不发布。
52
52
 
53
53
  `AgentFactory` 是注册表背后的创建接口:循环经 `ctx.agents.setFactory()` 注册其工厂,因此消费方使用 `ctx.agents` 时无需依赖具体循环包。确切的 `create`/`resume` 签名及回滚约定见下方[生成区块](#ctxagents--agentregistry)。
54
54
 
@@ -156,6 +156,44 @@ interface Agent {
156
156
  type AgentStatus = 'idle' | 'running'
157
157
  ```
158
158
 
159
+ ```ts type-equiv
160
+ /** One process-local live assistant streaming publication. */
161
+ type AssistantStreamFrame =
162
+ | {
163
+ readonly type: 'start'
164
+ readonly attemptId: LlmAttemptId
165
+ /** Monotone within one attached Agent lifecycle; replacement restarts at 1. */
166
+ readonly revision: number
167
+ readonly turn: number
168
+ readonly step: number
169
+ }
170
+ | {
171
+ readonly type: 'chunk'
172
+ readonly attemptId: LlmAttemptId
173
+ readonly revision: number
174
+ /** Dense zero-based position within the attempt. */
175
+ readonly index: number
176
+ /** Safe-integer timestamp reused by the durable embedded stream. */
177
+ readonly time: number
178
+ readonly chunk: StreamChunk
179
+ }
180
+ | {
181
+ readonly type: 'end'
182
+ readonly attemptId: LlmAttemptId
183
+ readonly revision: number
184
+ /** Number of chunk frames emitted by this attempt. */
185
+ readonly index: number
186
+ /** Durable settlement committed before this notification, or live abandonment without one. */
187
+ readonly outcome:
188
+ | {
189
+ readonly kind: 'committed'
190
+ readonly eventType: 'assistant/message' | 'assistant/attempt'
191
+ readonly seq: SessionSeq
192
+ }
193
+ | { readonly kind: 'abandoned' }
194
+ }
195
+ ```
196
+
159
197
  `running` 描述整个驱动器的排空区间,可能跨越连续的排队轮次;它不能证明某个轮次仍然打开。dispose 会把 agent 从注册表移除并发出 `agent/disposed`;它不是一个终态 status 值。`followup()` 不返回句柄:其 `MessageId` 标识的是持久的 inbox 插入、认领与丢弃事实,而非之后的助手输出或轮次结束。`whenIdle()` 观察的是整个 agent,因此只有当调用方明确拥有从回执到空闲的这段区间时,才能把它称为一次 run([决策](../../.agents/notes/implemented/architecture/2026-07-30-followup-enqueue-and-owned-runs.zh.md))。
160
198
 
161
199
  ```ts type-equiv
@@ -260,7 +298,7 @@ type SessionStartSource = 'startup' | 'resume' | 'clear' | 'compact'
260
298
 
261
299
  `Session` 是一份类型化 `SessionEvent` 的**仅追加日志**——唯一的真源。LLM 消息历史从日志*派生*(`deriveMessages()`),而非单独存储。每个条目携带单调的 `seq`、`time` 与按 `type` 判别的 `data` payload;surface 变体还可以在 `sourceEventSeqs` 中列出被引用的较早事件,并携带 `surfaceOp`。
262
300
 
263
- `SessionEvent` 信封的确切条件字段、十二种核心事件变体(`turn/start`、`turn/end`、`step/start`、`step/end`、`user/message`、`assistant/chunk`、`assistant/message`、`tool/call`、`tool/result`、`request/header`、`request/context`、`session/end-seed`)、`deriveMessages()` 投影规则、`TurnEndReason` 原因以及执行封闭和独立事件规则都在 **[session.md](session.zh.md)** 中。日志如何持久化——`SessionPersistence` 接口、JSONL provider、`session/flush` 检查点、崩溃恢复与 `SessionHeader`——则在 **[persistence.md](persistence.zh.md)** 中。
301
+ `SessionEvent` 信封的确切条件字段、十二种核心事件变体(`turn/start`、`turn/end`、`step/start`、`step/end`、`user/message`、`assistant/message`、`assistant/attempt`、`tool/call`、`tool/result`、`request/header`、`request/context`、`session/end-seed`)、`deriveMessages()` 投影规则、`TurnEndReason` 原因以及执行封闭和独立事件规则都在 **[session.md](session.zh.md)** 中。日志如何持久化——`SessionPersistence` 接口、JSONL provider、`session/flush` 检查点、崩溃恢复与 `SessionHeader`——则在 **[persistence.md](persistence.zh.md)** 中。
264
302
 
265
303
  ## `ToolDefinition`
266
304
 
@@ -366,13 +404,14 @@ Concrete agent factory and driver service.
366
404
  /**
367
405
  * Create an agent and session under one caller-supplied identity, owned by
368
406
  * the accessing fiber. Constructor-driven config calls mint a fresh combined
369
- * id before entering this boundary.
407
+ * id before entering this boundary. When a persistence backend is mounted,
408
+ * the session's durable identity and any seed are stored before publication.
370
409
  * @param id - shared agent/session identity.
371
410
  * @param options - concrete loop options.
372
411
  * @param meta - optional fresh-session workspace metadata.
373
412
  * @returns the published running agent.
374
413
  */
375
- create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent
414
+ async create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Promise<Agent>
376
415
 
377
416
  /**
378
417
  * Create an owned agent on a caller-supplied session id.
@@ -813,6 +852,29 @@ Source: [`packages/core/agent/src/index.ts`](../../packages/core/agent/src/index
813
852
 
814
853
  ### `agent/*` events
815
854
 
855
+ <a id="agentassistant-stream--emit"></a>
856
+
857
+ #### `agent/assistant-stream` — emit
858
+
859
+ Process-local assistant-stream publication. Chunk frames are transient; the loop appends one final v2 `assistant/message` or `assistant/attempt` with the same stream before a committed end frame.
860
+
861
+ ```ts cordis-catalog
862
+ /**
863
+ * Process-local assistant-stream publication. Chunk frames are transient;
864
+ * the loop appends one final v2 `assistant/message` or `assistant/attempt`
865
+ * with the same stream before a committed end frame.
866
+ * @param payload.agent - the agent whose attempt produced the frame.
867
+ * @param payload.frame - one ordered start, chunk, or end publication.
868
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent.
869
+ * @mode emit
870
+ */
871
+ 'agent/assistant-stream'(this: Scoped<Agent>, payload: { agent: Agent; frame: AssistantStreamFrame }): void
872
+ ```
873
+
874
+ Types: [Scoped](scope.zh.md)
875
+
876
+ Source: [`packages/core/agent/src/runtime-types.ts`](../../packages/core/agent/src/runtime-types.ts)
877
+
816
878
  <a id="agentcreated--emit"></a>
817
879
 
818
880
  #### `agent/created` — emit
@@ -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/feedback.md
5
- feedback.md: 046765b65773834b1804aa2a915625a3d6c9f099
6
- feedback.zh.md: 55b8e7d1b5b2c8ca5613d9888ef7f415b34ed5dc
5
+ feedback.md: 0bb01315d74cc41c1ab1008144dd8fca84efd76a
6
+ feedback.zh.md: 46f382edd270e5bb557f304a2f770b5fe7791dc5
@@ -191,13 +191,13 @@ One Session sidecar row contains its header identity `{createdAt, cwd}` and feed
191
191
 
192
192
  ## Target and lifecycle authority
193
193
 
194
- `SessionPersistence.inspect()` supplies the target Session observation without publishing or resuming an Agent and without committing cold repair. A cold `listSnapshots()` preflight classifies definite absence; inspection failure for a catalogued Session propagates as infrastructure failure. `put` accepts only a non-empty, append-origin `assistant/message` with the requested `MessageId`; replacement-origin, usage-only empty, and non-assistant records are not feedback targets.
194
+ A live owner's in-memory log supplies the target Session observation directly; a cold target is read through a `SessionPersistence.open(id, 'read')` handle without publishing or resuming an Agent and without writing recovery. A `stat(id)` preflight classifies definite absence; a read failure for a Session `stat` confirmed propagates as infrastructure failure. `put` accepts only a non-empty, append-origin `assistant/message` with the requested `MessageId`; replacement-origin, usage-only empty, and non-assistant records are not feedback targets.
195
195
 
196
196
  The stored `{createdAt, cwd}` identity must match the inspected header. A mismatch is treated as absence: `list` returns no items, while `put` may replace the stale row with one bound to the current header identity. Forks use a new Session identity and receive no sidecar copy even when their seed contains the same messages.
197
197
 
198
198
  ## Persistence and Remote contract
199
199
 
200
- The service stores whole Session rows in the `message_feedback` storage domain through `ctx.storageDomain`. Before `put` commits a row that references a target message, a matching live target passes through the canonical `ctx.sessions.flush` checkpoint; both live and cold paths are then physically read from sequence zero through `SessionPersistence.readFrom`. The resulting observation is revalidated before the sidecar write, so the durable target log always precedes its sidecar commit. `maxNoteBytes` is required and bounds note text by UTF-8 bytes; the Web Host composition sets `8192`. The package publishes the Host `messageFeedback.list`, `messageFeedback.put`, and `messageFeedback.delete` unary Remote contract through `TypertRemoteService` and `@Remote`; the generated Cordis API below is the method-level authority.
200
+ The service stores whole Session rows in the `message_feedback` storage domain through `ctx.storageDomain`. Before `put` commits a row that references a target message, a matching live target passes through the canonical `ctx.sessions.flush` checkpoint; both live and cold paths are then physically read from sequence zero through a fresh read handle, which observes at least the flushed prefix by the seam's freshness guarantee. The resulting observation is revalidated before the sidecar write, so the durable target log always precedes its sidecar commit. `maxNoteBytes` is required and bounds note text by UTF-8 bytes; the Web Host composition sets `8192`. The package publishes the Host `messageFeedback.list`, `messageFeedback.put`, and `messageFeedback.delete` unary Remote contract through `TypertRemoteService` and `@Remote`; the generated Cordis API below is the method-level authority.
201
201
 
202
202
  Plugin disposal closes mutation admission, drains accepted per-Session queue work, and then closes the storage domain.
203
203
 
@@ -191,13 +191,13 @@ type MessageFeedbackDeleteResult =
191
191
 
192
192
  ## 目标与生命周期权威
193
193
 
194
- `SessionPersistence.inspect()` 提供目标 Session 的观测,且不会发布或恢复 Agent,也不会提交 cold repair。cold 路径先由 `listSnapshots()` 预检明确不存在;已进入目录的 Session 若检查失败,会按基础设施故障原样传播。`put` 只接受具有指定 `MessageId` 的非空、append-origin `assistant/message`;replacement-origin、仅承载 usage 的空记录和非 assistant 记录都不是反馈目标。
194
+ live 持有者的内存日志直接提供目标 Session 的观测;cold 目标则通过 `SessionPersistence.open(id, 'read')` 句柄读取,既不会发布或恢复 Agent,也不会写入恢复内容。先由 `stat(id)` 预检明确不存在;`stat` 已确认存在的 Session 若读取失败,会按基础设施故障原样传播。`put` 只接受具有指定 `MessageId` 的非空、append-origin `assistant/message`;replacement-origin、仅承载 usage 的空记录和非 assistant 记录都不是反馈目标。
195
195
 
196
196
  存储的 `{createdAt, cwd}` 身份必须与检查所得 header 匹配。不匹配按不存在处理:`list` 返回空条目,`put` 则可用绑定当前 header 身份的新记录替换陈旧行。fork 使用新的 Session 身份,即使种子包含相同消息,也不获得伴随记录副本。
197
197
 
198
198
  ## 持久化与 Remote 约定
199
199
 
200
- 服务通过 `ctx.storageDomain` 在 `message_feedback` 存储域中保存完整 Session 行。`put` 提交引用目标消息的伴随记录前,身份匹配的 live 目标先经过权威 `ctx.sessions.flush` checkpoint;随后 live 与 cold 路径都会通过 `SessionPersistence.readFrom` 从序列零做物理复读。写入伴随记录前会再次校验所得观测,因此目标日志的持久提交始终先于其伴随记录。`maxNoteBytes` 为必填项,按 UTF-8 字节限制备注文本;Web Host 组合将其设为 `8192`。该包通过 `TypertRemoteService` 与 `@Remote` 发布 Host `messageFeedback.list`、`messageFeedback.put` 和 `messageFeedback.delete` 一元 Remote 约定;下方生成的 Cordis API 是方法级权威。
200
+ 服务通过 `ctx.storageDomain` 在 `message_feedback` 存储域中保存完整 Session 行。`put` 提交引用目标消息的伴随记录前,身份匹配的 live 目标先经过权威 `ctx.sessions.flush` checkpoint;随后 live 与 cold 路径都会通过一个新开的读句柄从序列零做物理复读,依据该 seam 的新鲜度保证,它至少能观察到已 flush 的前缀。写入伴随记录前会再次校验所得观测,因此目标日志的持久提交始终先于其伴随记录。`maxNoteBytes` 为必填项,按 UTF-8 字节限制备注文本;Web Host 组合将其设为 `8192`。该包通过 `TypertRemoteService` 与 `@Remote` 发布 Host `messageFeedback.list`、`messageFeedback.put` 和 `messageFeedback.delete` 一元 Remote 约定;下方生成的 Cordis API 是方法级权威。
201
201
 
202
202
  Plugin disposal 会先关闭变更接纳,排空已进入各 Session 队列的工作,然后才关闭 storage domain。
203
203
 
@@ -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/llm-streaming.md
5
- llm-streaming.md: 6867ae292d77474bcedc1466ae0ce6b1fc1c92d3
6
- llm-streaming.zh.md: b75e24f2e9010b4fb08c035f14bc4e91dc3971ef
5
+ llm-streaming.md: e88741c6bb63b819a314f74fc425c89b865b5906
6
+ llm-streaming.zh.md: 4bc7fc6124e77c7e3bbbc474bff9bc79fbd8eb27