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
@@ -113,7 +113,7 @@ export interface Config {
113
113
 
114
114
  依赖:[`AgentOptions`](subsystems/core.zh.md) · [`SessionId`](subsystems/core.zh.md)
115
115
 
116
- 来源:[`packages/core/agent-loop/src/index.ts:311`](../packages/core/agent-loop/src/index.ts)
116
+ 来源:[`packages/core/agent-loop/src/index.ts:318`](../packages/core/agent-loop/src/index.ts)
117
117
 
118
118
  <a id="deepseek-aidsh-agent-presets"></a>
119
119
 
@@ -205,19 +205,17 @@ export interface Config {
205
205
 
206
206
  ## `@deepseek-ai/dsh-api-session-controller`
207
207
 
208
- 需要:`agentDefaultModel` · `agents` · `attachments` · `llm` · `sessions` · `sessionProjections` · `sessionQuery` · `typert` · `workspaceRegistry`
208
+ 需要:`agentDefaultModel` · `agents` · `attachments` · `fileUploads` · `llm` · `sessions` · `sessionProjections` · `sessionQuery` · `typert` · `workspaceRegistry`
209
209
 
210
210
  ```ts config-catalog
211
211
  /** Session Controller deployment policy. */
212
212
  export interface Config {
213
- /** Maximum cold Session artifact size eligible for one full projection observation. */
214
- readonly coldBlankProbeMaxBytes?: number
215
213
  /** Override platform desktop-opener detection. */
216
214
  readonly nativeOpen?: boolean
217
215
  }
218
216
  ```
219
217
 
220
- 来源:[`packages/api/session-controller/src/index.ts:67`](../packages/api/session-controller/src/index.ts)
218
+ 来源:[`packages/api/session-controller/src/index.ts:69`](../packages/api/session-controller/src/index.ts)
221
219
 
222
220
  <a id="deepseek-aidsh-api-settings-controller"></a>
223
221
 
@@ -266,7 +264,7 @@ export interface Config {
266
264
  }
267
265
  ```
268
266
 
269
- 来源:[`packages/attachment/attachment-local/src/index.ts:55`](../packages/attachment/attachment-local/src/index.ts)
267
+ 来源:[`packages/attachment/attachment-local/src/index.ts:61`](../packages/attachment/attachment-local/src/index.ts)
270
268
 
271
269
  <a id="deepseek-aidsh-bash-local"></a>
272
270
 
@@ -340,7 +338,7 @@ export interface ConnectionConfig {
340
338
  }
341
339
  ```
342
340
 
343
- 来源:[`packages/client/connection/src/index.ts:55`](../packages/client/connection/src/index.ts)
341
+ 来源:[`packages/client/connection/src/index.ts:71`](../packages/client/connection/src/index.ts)
344
342
 
345
343
  <a id="deepseek-aidsh-client-hmr"></a>
346
344
 
@@ -459,7 +457,7 @@ export interface ToolResultPruneConfig {
459
457
  }
460
458
  ```
461
459
 
462
- 来源:[`packages/compaction/compaction-tool-result-pruner/src/types.ts:4`](../packages/compaction/compaction-tool-result-pruner/src/types.ts)
460
+ 来源:[`packages/compaction/compaction-tool-result-pruner/src/types.ts:5`](../packages/compaction/compaction-tool-result-pruner/src/types.ts)
463
461
 
464
462
  <a id="deepseek-aidsh-cordis-host-runner"></a>
465
463
 
@@ -513,7 +511,7 @@ export interface Config {
513
511
  }
514
512
  ```
515
513
 
516
- 来源:[`packages/e2b/e2b/src/index.ts:43`](../packages/e2b/e2b/src/index.ts)
514
+ 来源:[`packages/e2b/e2b/src/index.ts:45`](../packages/e2b/e2b/src/index.ts)
517
515
 
518
516
  <a id="deepseek-aidsh-experimental-agent-team"></a>
519
517
 
@@ -537,7 +535,74 @@ export interface Config {
537
535
  }
538
536
  ```
539
537
 
540
- 来源:[`packages/experimental/agent-team/src/types.ts:125`](../packages/experimental/agent-team/src/types.ts)
538
+ 来源:[`packages/experimental/agent-team/src/types.ts:124`](../packages/experimental/agent-team/src/types.ts)
539
+
540
+ <a id="deepseek-aidsh-experimental-code-runtime-python"></a>
541
+
542
+ ## `@deepseek-ai/dsh-experimental-code-runtime-python`
543
+
544
+ ```ts config-catalog
545
+ /** Plugin config: every cap, changeable from `cordis.yml` (no hardcoded tunables). */
546
+ export interface Config {
547
+ /**
548
+ * RLIMIT_CPU in whole seconds (a positive integer — `setrlimit` in the child
549
+ * rejects a float). The child sets the soft limit to `cpuSeconds` and the
550
+ * hard limit to `cpuSeconds + 1`: the kernel delivers SIGXCPU at the soft
551
+ * limit, which the host classifies as a `timeout`; the +1s hard limit is a
552
+ * SIGKILL backstop for a program that traps SIGXCPU. Granularity is seconds —
553
+ * a coarser counterpart to the worker backend's millisecond `computeMs`.
554
+ */
555
+ cpuSeconds?: number
556
+ /** Wall-clock ceiling in milliseconds; backstops CPU time for programs awaiting a promise nobody resolves. */
557
+ maxWallMs?: number
558
+ /**
559
+ * RLIMIT_AS in mebibytes; caps address space so a runaway allocation fails
560
+ * cleanly. Not applied on Darwin, where the dyld shared cache mapped into
561
+ * every process at exec exceeds any practical cap and the kernel rejects
562
+ * the call; `cpuSeconds` and `maxWallMs` still bound the run there. Bounds
563
+ * `maxLogBytes`/`maxValueBytes` at load on EVERY platform (this static check
564
+ * runs on Darwin too, where only the runtime `setrlimit` is skipped): each
565
+ * budget times a worst-case Unicode expansion must fit this byte count minus a
566
+ * fixed interpreter baseline, so a near-budget output cannot breach the address
567
+ * space during the child's build-and-encode.
568
+ */
569
+ addressSpaceMb?: number
570
+ /**
571
+ * Shared byte budget for captured log text (host-side ledger). Bounded at load
572
+ * against `addressSpaceMb`: the child builds and encodes a near-budget entry
573
+ * under RLIMIT_AS with several copies live at once, so this cap times the
574
+ * worst-case Unicode expansion must fit the address space left after the
575
+ * interpreter baseline (see `addressSpaceMb`) — a load-time rejection, not a
576
+ * runtime clamp. Also bounded at load by the host's configured heap like
577
+ * `maxValueBytes` (see its JSDoc): the effective frame cap minus the frame
578
+ * envelope.
579
+ */
580
+ maxLogBytes?: number
581
+ /**
582
+ * Byte cap for the completion value. Bounded at load against `addressSpaceMb`
583
+ * the same way `maxLogBytes` is: the child builds and encodes a near-budget
584
+ * value under RLIMIT_AS with several copies live at once, so this cap times the
585
+ * worst-case Unicode expansion must fit the address space left after the
586
+ * interpreter baseline. Both budgets are ALSO bounded at load by the host's
587
+ * configured heap: the effective frame cap (the protocol cap, or a lower
588
+ * heap-derived ceiling when the host heap cannot safely parse a near-cap
589
+ * frame — see `hostFrameParseCeiling`) minus the frame envelope, so a budget
590
+ * whose honest frame could OOM the host's own JSON.parse is rejected up
591
+ * front.
592
+ */
593
+ maxValueBytes?: number
594
+ /** SIGTERM→SIGKILL grace period on kill, matching bash-local's default. */
595
+ graceMs?: number
596
+ /**
597
+ * Absolute path, relative path, or basename of a CPython 3.10+ interpreter.
598
+ * Resolved and validated once at plugin load under a five-second force-kill
599
+ * deadline; a basename searches `PATH`.
600
+ */
601
+ pythonBin?: string
602
+ }
603
+ ```
604
+
605
+ 来源:[`packages/experimental/code-runtime-python/src/index.ts:42`](../packages/experimental/code-runtime-python/src/index.ts)
541
606
 
542
607
  <a id="deepseek-aidsh-experimental-inspector"></a>
543
608
 
@@ -698,7 +763,7 @@ export interface Config {
698
763
  }
699
764
  ```
700
765
 
701
- 来源:[`packages/goal/goal/src/index.ts:171`](../packages/goal/goal/src/index.ts)
766
+ 来源:[`packages/goal/goal/src/index.ts:172`](../packages/goal/goal/src/index.ts)
702
767
 
703
768
  <a id="deepseek-aidsh-headless"></a>
704
769
 
@@ -752,7 +817,7 @@ export interface Config {
752
817
  }
753
818
  ```
754
819
 
755
- 来源:[`packages/hooks/hooks-claude-code/src/index.ts:46`](../packages/hooks/hooks-claude-code/src/index.ts)
820
+ 来源:[`packages/hooks/hooks-claude-code/src/index.ts:45`](../packages/hooks/hooks-claude-code/src/index.ts)
756
821
 
757
822
  <a id="deepseek-aidsh-hooks-codex"></a>
758
823
 
@@ -779,7 +844,7 @@ export interface Config {
779
844
  }
780
845
  ```
781
846
 
782
- 来源:[`packages/hooks/hooks-codex/src/index.ts:45`](../packages/hooks/hooks-codex/src/index.ts)
847
+ 来源:[`packages/hooks/hooks-codex/src/index.ts:44`](../packages/hooks/hooks-codex/src/index.ts)
783
848
 
784
849
  <a id="deepseek-aidsh-host-directory-picker-browse"></a>
785
850
 
@@ -1026,7 +1091,7 @@ export interface PiAiProviderProfile {
1026
1091
  * to answer instead.
1027
1092
  */
1028
1093
  defaultInput?: PiAiModality[]
1029
- /** Provider request headers; Harness attribution wins reserved names. */
1094
+ /** Provider request headers, validated against Fetch when the profile resolves; Harness attribution wins reserved names. */
1030
1095
  headers?: Record<string, string>
1031
1096
  /** Provider-neutral pi-ai reasoning level. */
1032
1097
  reasoning?: ModelThinkingLevel
@@ -1290,7 +1355,7 @@ export interface ReplayModelConfig {
1290
1355
 
1291
1356
  依赖:[`ModelModality`](../packages/llm/llm/src/index.ts) · [`RetryPolicyConfig`](../packages/llm/llm/src/index.ts)
1292
1357
 
1293
- 来源:[`packages/test-support/llm-replay/src/index.ts:919`](../packages/test-support/llm-replay/src/index.ts)
1358
+ 来源:[`packages/test-support/llm-replay/src/index.ts:1294`](../packages/test-support/llm-replay/src/index.ts)
1294
1359
 
1295
1360
  <a id="deepseek-aidsh-llm-retry"></a>
1296
1361
 
@@ -1434,7 +1499,7 @@ export interface Config {
1434
1499
  }
1435
1500
  ```
1436
1501
 
1437
- 来源:[`packages/feedback/message-feedback/src/index.ts:49`](../packages/feedback/message-feedback/src/index.ts)
1502
+ 来源:[`packages/feedback/message-feedback/src/index.ts:50`](../packages/feedback/message-feedback/src/index.ts)
1438
1503
 
1439
1504
  <a id="deepseek-aidsh-permission-presets"></a>
1440
1505
 
@@ -1735,7 +1800,7 @@ export interface Config {
1735
1800
  }
1736
1801
  ```
1737
1802
 
1738
- 来源:[`packages/session/session-log-deepseek/src/index.ts:23`](../packages/session/session-log-deepseek/src/index.ts)
1803
+ 来源:[`packages/session/session-log-deepseek/src/index.ts:36`](../packages/session/session-log-deepseek/src/index.ts)
1739
1804
 
1740
1805
  <a id="deepseek-aidsh-session-log-export"></a>
1741
1806
 
@@ -1754,16 +1819,14 @@ export interface Config {
1754
1819
  export type SessionLogCompressionLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
1755
1820
  ```
1756
1821
 
1757
- 来源:[`packages/session-query/session-log-export/src/index.ts:42`](../packages/session-query/session-log-export/src/index.ts)
1822
+ 来源:[`packages/session-query/session-log-export/src/index.ts:45`](../packages/session-query/session-log-export/src/index.ts)
1758
1823
 
1759
1824
  <a id="deepseek-aidsh-session-persistence-jsonl"></a>
1760
1825
 
1761
1826
  ## `@deepseek-ai/dsh-session-persistence-jsonl`
1762
1827
 
1763
- 需要:`sessions` · `sessionProjections`
1764
-
1765
1828
  ```ts config-catalog
1766
- /** Plugin config: where the JSONL backend keeps its session logs, and the packed-row write switch. */
1829
+ /** Plugin config for the JSONL backend's root and physical encoding. */
1767
1830
  export interface Config {
1768
1831
  /**
1769
1832
  * Root directory for all session files. Required (no default): a default of
@@ -1773,27 +1836,15 @@ export interface Config {
1773
1836
  * readable directory; an absent root is created on first materialization.
1774
1837
  */
1775
1838
  root: string
1776
- /**
1777
- * Write runs of consecutive `assistant/chunk` delta events as packed
1778
- * `text-chunks`/`reasoning-chunks`/`tool-call-chunks` rows (lossless,
1779
- * ~60% smaller logs measured on a real session). Defaults to true; false
1780
- * keeps one `SessionEvent` per line for diagnostics. Reading packed rows is
1781
- * unconditional: a log's layout never depends on this switch.
1782
- */
1783
- packChunks?: boolean
1784
1839
  /** Physical encoding; defaults to checksummed Zstandard frames. */
1785
1840
  compression?: JsonlCompression
1786
- /** Maximum cold Session preparations retained for history-to-resume reuse. */
1787
- preparedSessionCacheSize?: number
1788
- /** Fixed live-event coalescing window; not a backend completion deadline. */
1789
- writeBatchMaxDelayMs?: number
1790
1841
  }
1791
1842
 
1792
1843
  /** Physical encoding selected for JSONL session artifacts. */
1793
1844
  export type JsonlCompression = 'zstd' | 'none'
1794
1845
  ```
1795
1846
 
1796
- 来源:[`packages/session/session-persistence-jsonl/src/index.ts:62`](../packages/session/session-persistence-jsonl/src/index.ts)
1847
+ 来源:[`packages/session/session-persistence-jsonl/src/index.ts:85`](../packages/session/session-persistence-jsonl/src/index.ts)
1797
1848
 
1798
1849
  <a id="deepseek-aidsh-session-projection-cache"></a>
1799
1850
 
@@ -1817,7 +1868,7 @@ export interface Config {
1817
1868
  }
1818
1869
  ```
1819
1870
 
1820
- 来源:[`packages/session/session-projection-cache/src/index.ts:48`](../packages/session/session-projection-cache/src/index.ts)
1871
+ 来源:[`packages/session/session-projection-cache/src/index.ts:63`](../packages/session/session-projection-cache/src/index.ts)
1821
1872
 
1822
1873
  <a id="deepseek-aidsh-session-query-sqlite"></a>
1823
1874
 
@@ -1850,8 +1901,10 @@ export interface Config extends SessionQueryConfig {
1850
1901
  maxLimit?: number
1851
1902
  /** Maximum snippet length in Unicode code points. Defaults to 240. */
1852
1903
  snippetChars?: number
1853
- /** Maximum concurrent persisted-log inspections in one inherited batch read. Defaults to 4. */
1854
- persistedInspectConcurrency?: number
1904
+ /** Maximum concurrent persisted-log reads in one inherited batch read. Defaults to 4. */
1905
+ persistedReadConcurrency?: number
1906
+ /** Maximum cold prepared-Session observations the inherited reader retains for reuse. Defaults to 5. */
1907
+ preparedSessionCacheSize?: number
1855
1908
  }
1856
1909
 
1857
1910
  /** SQLite module/handle opening phase; `never` disables full-text search entirely. */
@@ -1863,7 +1916,7 @@ export type JournalMode = 'wal' | 'delete' | 'truncate' | 'persist'
1863
1916
 
1864
1917
  依赖:[`SessionQueryConfig`](../packages/session-query/session-query/src/index.ts)
1865
1918
 
1866
- 来源:[`packages/session-query/session-query-sqlite/src/index.ts:89`](../packages/session-query/session-query-sqlite/src/index.ts)
1919
+ 来源:[`packages/session-query/session-query-sqlite/src/index.ts:92`](../packages/session-query/session-query-sqlite/src/index.ts)
1867
1920
 
1868
1921
  <a id="deepseek-aidsh-session-reference"></a>
1869
1922
 
@@ -1949,7 +2002,7 @@ export interface Config {
1949
2002
  }
1950
2003
  ```
1951
2004
 
1952
- 来源:[`packages/session/session-title/src/index.ts:55`](../packages/session/session-title/src/index.ts)
2005
+ 来源:[`packages/session/session-title/src/index.ts:56`](../packages/session/session-title/src/index.ts)
1953
2006
 
1954
2007
  <a id="deepseek-aidsh-session-title-all-prompts-llm"></a>
1955
2008
 
@@ -2013,7 +2066,7 @@ export interface Config {
2013
2066
  }
2014
2067
  ```
2015
2068
 
2016
- 来源:[`packages/shell/shell-env/src/index.ts:29`](../packages/shell/shell-env/src/index.ts)
2069
+ 来源:[`packages/shell/shell-env/src/index.ts:28`](../packages/shell/shell-env/src/index.ts)
2017
2070
 
2018
2071
  <a id="deepseek-aidsh-skill"></a>
2019
2072
 
@@ -2547,7 +2600,7 @@ export interface Config {
2547
2600
  export type TokenMeterConfig = Record<string, never>
2548
2601
  ```
2549
2602
 
2550
- 来源:[`packages/llm/token-meter/src/types.ts:12`](../packages/llm/token-meter/src/types.ts)
2603
+ 来源:[`packages/llm/token-meter/src/types.ts:13`](../packages/llm/token-meter/src/types.ts)
2551
2604
 
2552
2605
  <a id="deepseek-aidsh-tool-bash"></a>
2553
2606
 
@@ -2896,28 +2949,6 @@ export interface Config {
2896
2949
 
2897
2950
  来源:[`packages/subagent/tool-subagent/src/index.ts:48`](../packages/subagent/tool-subagent/src/index.ts)
2898
2951
 
2899
- <a id="deepseek-aidsh-tool-subagent-report"></a>
2900
-
2901
- ## `@deepseek-ai/dsh-tool-subagent-report`
2902
-
2903
- 需要:`subagents` · `tools` · `systemPrompt`
2904
-
2905
- ```ts config-catalog
2906
- /** Config: how accepted reports are scheduled on the parent. */
2907
- export interface Config {
2908
- /**
2909
- * Parent scheduling (default `next-step`). `next-step` wakes the parent and
2910
- * enters at its nearest step boundary; `quiet` adds the same context without
2911
- * waking, so a parked parent waits for another waking input.
2912
- */
2913
- reportDelivery?: SubagentReportDelivery
2914
- }
2915
- ```
2916
-
2917
- 依赖:[`SubagentReportDelivery`](subsystems/subagent.zh.md)
2918
-
2919
- 来源:[`packages/subagent/tool-subagent-report/src/index.ts:25`](../packages/subagent/tool-subagent-report/src/index.ts)
2920
-
2921
2952
  <a id="deepseek-aidsh-tool-terminal"></a>
2922
2953
 
2923
2954
  ## `@deepseek-ai/dsh-tool-terminal`
@@ -3085,7 +3116,7 @@ export interface Config {
3085
3116
  export type ApprovalPolicy = 'ask' | 'never'
3086
3117
  ```
3087
3118
 
3088
- 来源:[`packages/interaction/user-approval/src/index.ts:142`](../packages/interaction/user-approval/src/index.ts)
3119
+ 来源:[`packages/interaction/user-approval/src/index.ts:126`](../packages/interaction/user-approval/src/index.ts)
3089
3120
 
3090
3121
  <a id="deepseek-aidsh-web"></a>
3091
3122
 
@@ -3296,6 +3327,7 @@ export interface Config {
3296
3327
  - `@deepseek-ai/dsh-api-remotes` — 需要 `typertGateway`([`packages/api/remotes/src/index.ts`](../packages/api/remotes/src/index.ts))
3297
3328
  - `@deepseek-ai/dsh-api-workspace-controller` — 需要 `typert` · `workspaceRegistry`([`packages/api/workspace-controller/src/index.ts`](../packages/api/workspace-controller/src/index.ts))
3298
3329
  - `@deepseek-ai/dsh-authorization` — 需要 `credentials`([`packages/credentials/authorization/src/index.ts`](../packages/credentials/authorization/src/index.ts))
3330
+ - `@deepseek-ai/dsh-client-file-upload` — 需要 `agents` · `attachments` · `commands` · `connection`([`packages/client/file-upload/src/index.ts`](../packages/client/file-upload/src/index.ts))
3299
3331
  - `@deepseek-ai/dsh-client-locale`([`packages/client/locale/src/index.ts`](../packages/client/locale/src/index.ts))
3300
3332
  - `@deepseek-ai/dsh-client-modules` — 需要 `webServer` · `loader`([`packages/client/modules/src/index.ts`](../packages/client/modules/src/index.ts))
3301
3333
  - `@deepseek-ai/dsh-client-ui-agent-preset`([`packages/client/ui-agent-preset/src/index.ts`](../packages/client/ui-agent-preset/src/index.ts))
@@ -3405,7 +3437,6 @@ export interface Config {
3405
3437
  - `@deepseek-ai/dsh-client-ui-slots`([`packages/client/ui-slots/src/index.ts`](../packages/client/ui-slots/src/index.ts))
3406
3438
  - `@deepseek-ai/dsh-client-web`([`packages/client/web/src/index.ts`](../packages/client/web/src/index.ts))
3407
3439
  - `@deepseek-ai/dsh-cmdline`([`packages/boot/cmdline/src/index.ts`](../packages/boot/cmdline/src/index.ts))
3408
- - `@deepseek-ai/dsh-code-runtime-python`([`packages/code-runtime/code-runtime-python/src/index.ts`](../packages/code-runtime/code-runtime-python/src/index.ts))
3409
3440
  - `@deepseek-ai/dsh-deque`([`packages/util/deque/src/index.ts`](../packages/util/deque/src/index.ts))
3410
3441
  - `@deepseek-ai/dsh-experimental-agent-team-profile`([`packages/experimental/agent-team-profile/src/index.ts`](../packages/experimental/agent-team-profile/src/index.ts))
3411
3442
  - `@deepseek-ai/dsh-experimental-agent-team-web-profile`([`packages/experimental/agent-team-web-profile/src/index.ts`](../packages/experimental/agent-team-web-profile/src/index.ts))
@@ -3413,6 +3444,7 @@ export interface Config {
3413
3444
  - `@deepseek-ai/dsh-experimental-webworker-runtime`([`packages/experimental/webworker-runtime/src/index.ts`](../packages/experimental/webworker-runtime/src/index.ts))
3414
3445
  - `@deepseek-ai/dsh-home-paths`([`packages/util/home-paths/src/index.ts`](../packages/util/home-paths/src/index.ts))
3415
3446
  - `@deepseek-ai/dsh-hook-protocol`([`packages/hooks/hook-protocol/src/index.ts`](../packages/hooks/hook-protocol/src/index.ts))
3447
+ - `@deepseek-ai/dsh-http-proxy`([`packages/util/http-proxy/src/index.ts`](../packages/util/http-proxy/src/index.ts))
3416
3448
  - `@deepseek-ai/dsh-launch-environment`([`packages/util/launch-environment/src/index.ts`](../packages/util/launch-environment/src/index.ts))
3417
3449
  - `@deepseek-ai/dsh-llm-mock-server`([`packages/test-support/llm-mock-server/src/index.ts`](../packages/test-support/llm-mock-server/src/index.ts))
3418
3450
  - `@deepseek-ai/dsh-loader-smoke`([`packages/test-support/loader-smoke/src/index.ts`](../packages/test-support/loader-smoke/src/index.ts))
@@ -3423,6 +3455,10 @@ export interface Config {
3423
3455
  - `@deepseek-ai/dsh-sdk-client`([`packages/sdk/client/src/index.ts`](../packages/sdk/client/src/index.ts))
3424
3456
  - `@deepseek-ai/dsh-sdk-minimal`([`packages/bundle/sdk-minimal/src/index.ts`](../packages/bundle/sdk-minimal/src/index.ts))
3425
3457
  - `@deepseek-ai/dsh-sdk-protocol`([`packages/sdk/protocol/src/index.ts`](../packages/sdk/protocol/src/index.ts))
3458
+ - `@deepseek-ai/dsh-session-format`([`packages/session/session-format/src/index.ts`](../packages/session/session-format/src/index.ts))
3459
+ - `@deepseek-ai/dsh-session-format-catalog`([`packages/session/session-format-catalog/src/index.ts`](../packages/session/session-format-catalog/src/index.ts))
3460
+ - `@deepseek-ai/dsh-session-format-v0-to-v1`([`packages/session/session-format-v0-to-v1/src/index.ts`](../packages/session/session-format-v0-to-v1/src/index.ts))
3461
+ - `@deepseek-ai/dsh-session-format-v1-to-v2`([`packages/session/session-format-v1-to-v2/src/index.ts`](../packages/session/session-format-v1-to-v2/src/index.ts))
3426
3462
  - `@deepseek-ai/dsh-session-snapshot`([`packages/test-support/session-snapshot/src/index.ts`](../packages/test-support/session-snapshot/src/index.ts))
3427
3463
  - `@deepseek-ai/dsh-session-telemetry`([`packages/session/session-telemetry/src/index.ts`](../packages/session/session-telemetry/src/index.ts))
3428
3464
  - `@deepseek-ai/dsh-session-title-llm`([`packages/session/session-title-llm/src/index.ts`](../packages/session/session-title-llm/src/index.ts))
@@ -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/cookbook/adding-a-package.md
5
- adding-a-package.md: f38c0d3f3bdfe126ca1de4801548c546fc5994cc
6
- adding-a-package.zh.md: 11f6faa75e757b769ef84a039cef05afd1324a95
5
+ adding-a-package.md: 771bc2b63dba0234252a6925c0aaa4b4f3a16142
6
+ adding-a-package.zh.md: 8be5e47a206983bef3f86d4210f59159f87a9fae
@@ -22,7 +22,7 @@ packages/<group>/<pkg>/
22
22
 
23
23
  Choose an existing group when one matches the package's role (`core`, `llm`, `shell`, `compaction`, `subagent`, `todo`, `session`, `client`/`host`, `util`, or `test-support`). A new group is allowed, but it is a pure container: no `package.json`, no source files, and packages still sit exactly one level below it.
24
24
 
25
- package.json invariants (enforced by `pnpm run constraints` / `scripts/check-workspace-constraints.ts`): `private: true`, a `version` matching the root `package.json`, `type: module`, `main: "lib/index.js"`, `types: "lib/types/index.d.ts"`, `exports["."].types: "./lib/types/index.d.ts"`, `exports["."].default: "./lib/index.js"`, `@deepseek-ai/cordis` in BOTH peerDependencies and devDependencies (same range). Mirror every dsh peer dependency in devDependencies. `@deepseek-ai/schemastery` goes in `dependencies` (it is a runtime validator), matching agent-loop. The `files` list contains exactly `lib/index.js`, `lib/invariant.js`, `lib/types/**/*.d.ts`, and package-specific runtime artifacts recognized by the gate; a package whose runtime export points into the emitted tree also includes `lib/types/**/*.js`. Do not publish `src`, declaration maps, JS maps, or stale root declaration files. CLI app packages with a package `bin` include `lib/bin.js` immediately after `lib/index.js` in `files`.
25
+ package.json invariants (enforced by `pnpm run constraints` / `scripts/check-workspace-constraints.ts`): `private: true`, a `version` matching the root `package.json`, `type: module`, `main: "lib/index.js"`, `types: "lib/types/index.d.ts"`, `exports["."].types: "./lib/types/index.d.ts"`, `exports["."].default: "./lib/index.js"`, `@deepseek-ai/cordis` in BOTH peerDependencies and devDependencies (same range). Mirror every dsh peer dependency in devDependencies. `@deepseek-ai/schemastery` goes in `dependencies` (it is a runtime validator), matching agent-loop. The `files` list contains exactly `lib/index.js`, `lib/types/**/*.d.ts`, and package-specific runtime artifacts recognized by the gate; a package that publishes `./invariant` also includes `lib/invariant.js`. A package whose runtime export points into the emitted tree also includes `lib/types/**/*.js`. Do not publish `src`, declaration maps, JS maps, or stale root declaration files. CLI app packages with a package `bin` include `lib/bin.js` immediately after `lib/index.js` in `files`.
26
26
 
27
27
  In-package relative imports use explicit `.ts` specifiers in source (for example, `export * from './types.ts'`). The compiler rewrites those to `.js` in emitted JS and leaves explicit `.ts` specifiers in declarations, which standard NodeNext/Node16 TypeScript consumers resolve to the sibling `.d.ts` files.
28
28
 
@@ -22,7 +22,7 @@ packages/<group>/<pkg>/
22
22
 
23
23
  当已有分组与包的角色匹配时,选择该分组(`core`、`llm`、`shell`、`compaction`、`subagent`、`todo`、`session`、`client`/`host`、`util` 或 `test-support`)。允许新建分组,但分组只是纯容器:没有 `package.json`,没有源文件,包仍然恰好位于其下一层。
24
24
 
25
- package.json 不变式(由 `pnpm run constraints` / `scripts/check-workspace-constraints.ts` 强制执行):`private: true`,`version` 与根 `package.json` 一致,`type: module`,`main: "lib/index.js"`,`types: "lib/types/index.d.ts"`,`exports["."].types: "./lib/types/index.d.ts"`,`exports["."].default: "./lib/index.js"`,`@deepseek-ai/cordis` 同时出现在 peerDependencies 和 devDependencies 中(相同范围)。每个 dsh 对等依赖(peer dependency)都要在 devDependencies 中镜像。`@deepseek-ai/schemastery` 放在 `dependencies` 中(它是运行时校验器),与 agent-loop 保持一致。`files` 列表精确包含 `lib/index.js`、`lib/invariant.js`、`lib/types/**/*.d.ts` 以及门禁认可的包专用运行时产物;如果包的运行时 export 指向输出树,还要包含 `lib/types/**/*.js`。不要发布 `src`、声明映射、JS map 或陈旧的根声明文件。带有 `bin` 的 CLI 应用包在 `files` 中将 `lib/bin.js` 紧跟在 `lib/index.js` 之后。
25
+ package.json 不变式(由 `pnpm run constraints` / `scripts/check-workspace-constraints.ts` 强制执行):`private: true`,`version` 与根 `package.json` 一致,`type: module`,`main: "lib/index.js"`,`types: "lib/types/index.d.ts"`,`exports["."].types: "./lib/types/index.d.ts"`,`exports["."].default: "./lib/index.js"`,`@deepseek-ai/cordis` 同时出现在 peerDependencies 和 devDependencies 中(相同范围)。每个 dsh 对等依赖(peer dependency)都要在 devDependencies 中镜像。`@deepseek-ai/schemastery` 放在 `dependencies` 中(它是运行时校验器),与 agent-loop 保持一致。`files` 列表精确包含 `lib/index.js`、`lib/types/**/*.d.ts` 以及门禁认可的包专用运行时产物;发布 `./invariant` 的包还要包含 `lib/invariant.js`。如果包的运行时 export 指向输出树,还要包含 `lib/types/**/*.js`。不要发布 `src`、声明映射、JS map 或陈旧的根声明文件。带有 `bin` 的 CLI 应用包在 `files` 中将 `lib/bin.js` 紧跟在 `lib/index.js` 之后。
26
26
 
27
27
  包内的相对导入在源码中使用显式 `.ts` 后缀(例如 `export * from './types.ts'`)。编译器在输出的 JS 中将其重写为 `.js`,在声明文件中保留显式 `.ts` 后缀;标准的 NodeNext/Node16 TypeScript 消费方会将其解析到同目录的 `.d.ts` 文件。
28
28
 
@@ -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/cookbook/extension-cookbook.md
5
- extension-cookbook.md: 0bbd1d0d531de755708da6c7a68b312675ba4b52
6
- extension-cookbook.zh.md: 5067c57bef08af65102e011f6d4c4394e03a3f5f
5
+ extension-cookbook.md: b7f0f7939797d7c9929a87427eb624b7cfcc7a87
6
+ extension-cookbook.zh.md: 6813a41baad4488123a2ad92672fdc275016d98b
@@ -34,7 +34,7 @@ This waterfall is the reorderable policy layer. Use `ctx.tools.guard()` when an
34
34
 
35
35
  ## A UI plugin
36
36
 
37
- A UI plugin renders from the `session/event` feed (the assistant token stream as `assistant/chunk`, plus turn/step boundaries and tool activity), and drives input back in via `agent.followup()` / `agent.steer()`. A browser plugin contributing a business row to the built-in Web Client instead registers a `ConversationNodeDefinition` and keyed Chat renderer; follow the [Conversation subsystem reference](../subsystems/conversation.md).
37
+ A UI plugin combines durable `session/event` records (Assistant settlements, turn/step boundaries, and tool activity) with transient `agent/assistant-stream` frames for live token presentation, and drives input back in via `agent.followup()` / `agent.steer()`. A browser plugin contributing a business row to the built-in Web Client instead registers a `ConversationNodeDefinition` and keyed Chat renderer; follow the [Conversation subsystem reference](../subsystems/conversation.md).
38
38
 
39
39
  ```ts
40
40
  import type { Context } from '@deepseek-ai/cordis'
@@ -49,9 +49,9 @@ export const name = 'my-ui'
49
49
  export const inject = ['agents']
50
50
 
51
51
  export function apply(ctx: Context) {
52
- ctx.on('session/event', (_session, event) => {
53
- if (event.type === 'assistant/chunk' && event.data.chunk.type === 'text-delta') {
54
- render(event.data.chunk.text)
52
+ ctx.on('agent/assistant-stream', ({ frame }) => {
53
+ if (frame.type === 'chunk' && frame.chunk.type === 'text-delta') {
54
+ render(frame.chunk.text)
55
55
  }
56
56
  })
57
57
  onUserInput(text => ctx.agents.get(brandString<SessionId>('client-session'))?.followup(createUserMessage({
@@ -69,17 +69,19 @@ A *protocol driver* adapts a wire peer to `ctx.agents`; it may serve a UI or an
69
69
 
70
70
  ```ts
71
71
  import type { Context } from '@deepseek-ai/cordis'
72
+ import { expandAssistantStream } from '@deepseek-ai/dsh-llm'
72
73
 
73
74
  export const name = 'my-protocol-bridge'
74
75
  export const inject = ['agents', 'sessions', 'sessionPersistence']
75
76
 
76
77
  export function apply(ctx: Context) {
77
- // Stream every logged assistant text/reasoning delta out to the client.
78
+ // Publish every committed Assistant text delta to the client.
78
79
  ctx.on('session/event', (_session, event) => {
79
- if (event.type === 'assistant/chunk') {
80
- const chunk = event.data.chunk
81
- if (chunk.type === 'text-delta') {
82
- // sendToClient({ kind: 'message_chunk', text: chunk.text })
80
+ if (event.type === 'assistant/message' || event.type === 'assistant/attempt') {
81
+ for (const { chunk } of expandAssistantStream(event.data.stream)) {
82
+ if (chunk.type === 'text-delta') {
83
+ // sendToClient({ kind: 'message_chunk', text: chunk.text })
84
+ }
83
85
  }
84
86
  }
85
87
  })
@@ -123,7 +125,7 @@ Every product feature maps to a listener on a documented extension point — the
123
125
  | Skills | section + tool registration; `inject()` skill content on invocation |
124
126
  | Memory | section provider + tool |
125
127
  | Scheduled tasks (cron) | a plugin registers model-callable scheduling tools; timer fires → `followup(…, {source: {kind: 'plugin', plugin: 'schedule'}})` when idle / `inject()` notification when busy |
126
- | UI (GUI; CLI emits JSONL) | listen `session/event` (assistant chunks, boundaries, tool activity); input → `followup()` |
128
+ | UI (GUI; CLI emits JSONL) | listen to `agent/assistant-stream` for live chunks and `session/event` for durable settlements, boundaries, and tool activity; input → `followup()` |
127
129
  | Web Client Chat business node | register a `ConversationNodeDefinition` and `conversation.chat.node` keyed renderer |
128
130
  | SessionTelemetryBackend / replayable trace | `session/event` → JSONL; replay = `sessions.create(id, { seed })` |
129
131
  | Model adapters | `LlmAdapter` subclass via `registerAdapter` (`dsh-llm-deepseek`, `dsh-llm-pi-ai`) |
@@ -36,7 +36,7 @@ export function apply(ctx: Context) {
36
36
 
37
37
  ## UI 插件
38
38
 
39
- UI 插件从 `session/event` 事件流渲染(助手 token 流以 `assistant/chunk` 形式到达,加上轮次/步骤边界与工具活动),并通过 `agent.followup()` / `agent.steer()` 将输入驱动回去。如果浏览器插件要向内建 Web Client 贡献业务行,则应注册 `ConversationNodeDefinition` 与 keyed Chat renderer;具体约定见 [Conversation 子系统参考](../subsystems/conversation.zh.md)。
39
+ UI 插件把持久 `session/event` record(Assistant settlement、轮次/步骤边界与工具活动)和用于实时 token 呈现的瞬态 `agent/assistant-stream` frame 组合起来,并通过 `agent.followup()` / `agent.steer()` 将输入驱动回去。如果浏览器插件要向内建 Web Client 贡献业务行,则应注册 `ConversationNodeDefinition` 与 keyed Chat renderer;具体约定见 [Conversation 子系统参考](../subsystems/conversation.zh.md)。
40
40
 
41
41
  ```ts
42
42
  import type { Context } from '@deepseek-ai/cordis'
@@ -51,9 +51,9 @@ export const name = 'my-ui'
51
51
  export const inject = ['agents']
52
52
 
53
53
  export function apply(ctx: Context) {
54
- ctx.on('session/event', (_session, event) => {
55
- if (event.type === 'assistant/chunk' && event.data.chunk.type === 'text-delta') {
56
- render(event.data.chunk.text)
54
+ ctx.on('agent/assistant-stream', ({ frame }) => {
55
+ if (frame.type === 'chunk' && frame.chunk.type === 'text-delta') {
56
+ render(frame.chunk.text)
57
57
  }
58
58
  })
59
59
  onUserInput(text => ctx.agents.get(brandString<SessionId>('client-session'))?.followup(createUserMessage({
@@ -71,17 +71,19 @@ export function apply(ctx: Context) {
71
71
 
72
72
  ```ts
73
73
  import type { Context } from '@deepseek-ai/cordis'
74
+ import { expandAssistantStream } from '@deepseek-ai/dsh-llm'
74
75
 
75
76
  export const name = 'my-protocol-bridge'
76
77
  export const inject = ['agents', 'sessions', 'sessionPersistence']
77
78
 
78
79
  export function apply(ctx: Context) {
79
- // Stream every logged assistant text/reasoning delta out to the client.
80
+ // Publish every committed Assistant text delta to the client.
80
81
  ctx.on('session/event', (_session, event) => {
81
- if (event.type === 'assistant/chunk') {
82
- const chunk = event.data.chunk
83
- if (chunk.type === 'text-delta') {
84
- // sendToClient({ kind: 'message_chunk', text: chunk.text })
82
+ if (event.type === 'assistant/message' || event.type === 'assistant/attempt') {
83
+ for (const { chunk } of expandAssistantStream(event.data.stream)) {
84
+ if (chunk.type === 'text-delta') {
85
+ // sendToClient({ kind: 'message_chunk', text: chunk.text })
86
+ }
85
87
  }
86
88
  }
87
89
  })
@@ -127,7 +129,7 @@ export function apply(ctx: Context) {
127
129
  | skill(技能) | section + 工具注册;调用时通过 `inject()` 注入 skill 内容 |
128
130
  | 记忆 | section 提供方 + 工具 |
129
131
  | 定时任务(cron) | 插件注册面向模型的调度工具;定时器触发 → 空闲时 `followup(…, {source: {kind: 'plugin', plugin: 'schedule'}})`/忙碌时 `inject()` 通知 |
130
- | UI(GUI;CLI(命令行界面)输出 JSONL) | 监听 `session/event`(助手分片、边界、工具活动);输入 → `followup()` |
132
+ | UI(GUI;CLI(命令行界面)输出 JSONL) | 监听 `agent/assistant-stream` 的实时 chunk,并监听 `session/event` 的持久 settlement、边界与工具活动;输入 → `followup()` |
131
133
  | Web Client Chat 业务节点 | 注册 `ConversationNodeDefinition` 与 `conversation.chat.node` keyed renderer |
132
134
  | 遥测 / 可回放 trace | `session/event` → JSONL;回放 = `sessions.create(id, { seed })` |
133
135
  | 模型适配器 | 通过 `registerAdapter` 注册 `LlmAdapter` 子类(`dsh-llm-deepseek`、`dsh-llm-pi-ai`) |
@@ -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/deepseek-llm-api-wire-extensions.md
5
- deepseek-llm-api-wire-extensions.md: fd42609693ac6fbf91dd82b6e73b2d1d06e65a54
6
- deepseek-llm-api-wire-extensions.zh.md: 61af718841c8778e8943a1a1c16621a9a6618add
5
+ deepseek-llm-api-wire-extensions.md: 5b1c4de68949d56f99cbfa70ba4af7ca0b71715d
6
+ deepseek-llm-api-wire-extensions.zh.md: a78baace34dcb3e24667295cf06e111ce355aa72
@@ -78,11 +78,13 @@ An enabled inventory with no qualifying entries sends `packages: []`; disabling
78
78
  ```json
79
79
  {
80
80
  "dsh_session_log": {
81
- "version": 1,
81
+ "version": 2,
82
+ "sessionFormatVersion": 2,
82
83
  "session": {
83
- "version": 0,
84
+ "version": 2,
84
85
  "id": "session-id",
85
- "createdAt": 1780000000000
86
+ "createdAt": 1780000000000,
87
+ "isSeeded": false
86
88
  },
87
89
  "afterSeq": -1,
88
90
  "throughSeq": 0,
@@ -102,26 +104,27 @@ An enabled inventory with no qualifying entries sends `packages: []`; disabling
102
104
 
103
105
  | Member | Type | Meaning |
104
106
  |---|---|---|
105
- | `version` | `1` | Schema version for `dsh_session_log` |
106
- | `session` | object | Immutable canonical `SessionHeader` |
107
+ | `version` | `2` | Schema version for `dsh_session_log` |
108
+ | `sessionFormatVersion` | non-negative integer | Session format generation represented by this suffix |
109
+ | `session` | object | Immutable wire projection of the current Session header |
107
110
  | `afterSeq` | integer | Greatest sequence recorded as accepted before this request, or `-1` |
108
111
  | `throughSeq` | non-negative integer | Greatest sequence represented by this request |
109
112
  | `events` | array | Contiguous events from `afterSeq + 1` through `throughSeq` |
110
113
 
111
114
  The first upload uses `afterSeq: -1` and carries the complete current log. Each later upload starts after the greatest accepted watermark for the same Session id. The sender snapshots the event array once per request; appends after that snapshot belong to a later request.
112
115
 
113
- ### Session header
116
+ ### Wire Session header
114
117
 
115
- The `session` member is the exact `Session.header`, not a complete runtime Session. The outer `dsh_session_log.version` selects this extension schema, while `session.version` selects the canonical on-disk Session format; the two version values evolve independently.
118
+ The `session` member projects `Session.header`, not a complete runtime Session or the header object itself. It copies the current header facts, including the required `isSeeded` lineage bit; the exact `Session.inheritedEventCount` is not part of this request field. The outer `dsh_session_log.version` selects this extension schema, while `session.version` selects the logical Session format. Changing the Session header projection requires an extension-schema bump even when the embedded logical format also changes.
116
119
 
117
120
  | Member | Presence | Meaning |
118
121
  |---|---|---|
119
- | `version` | required | Canonical Session format version; currently `0` |
122
+ | `version` | required | Logical Session format version; currently `2` |
120
123
  | `id` | required | Exact Session id |
121
124
  | `createdAt` | required | Non-negative safe-integer Unix epoch milliseconds |
122
125
  | `cwd` | optional | Absolute working directory recorded at Session creation |
123
126
  | `parentSession` | optional | Parent Session id for a fork |
124
- | `seedLength` | optional | Number of leading events inherited through the seed |
127
+ | `isSeeded` | required | Whether the Session contains a fork-inherited event prefix |
125
128
  | `origin` | optional | Literal `subagent` for a subagent child |
126
129
  | `delegationDepth` | optional | Non-negative persisted subagent delegation depth |
127
130
  | `agentPreset` | optional | Agent preset id used to compose this Session |
@@ -141,19 +144,20 @@ After the endpoint returns HTTP 2xx, the contribution appends this canonical eve
141
144
  "time": 1780000000002,
142
145
  "data": {
143
146
  "sessionId": "session-id",
147
+ "sessionFormatVersion": 2,
144
148
  "throughSeq": 7
145
149
  }
146
150
  }
147
151
  ```
148
152
 
149
- `delivery-accepted` means that the configured endpoint returned HTTP 2xx for the containing LLM request. It does not assert SSE completion or remote persistence. The event's `throughSeq` must identify an earlier event, and its `sessionId` identifies the Session whose suffix was sent.
153
+ `delivery-accepted` means that the configured endpoint returned HTTP 2xx for the containing LLM request. It does not assert SSE completion or remote persistence. The event's `throughSeq` must identify an earlier event, its `sessionId` identifies the Session whose suffix was sent, and `sessionFormatVersion` binds the watermark to that exact logical generation. Absence means historical format v0.
150
154
 
151
- The sender folds the greatest matching `throughSeq`, so concurrent accepted requests cannot move the cursor backward. A resumed process rebuilds the cursor from the durable log. A fork ignores inherited watermarks that name its parent, and therefore sends its own complete inherited prefix before advancing under the child id. The watermark event itself belongs to the next unsent suffix.
155
+ The sender folds the greatest matching `throughSeq` for the current Session id and format generation, so concurrent accepted requests cannot move the cursor backward and a watermark from another generation cannot authorize the current suffix. A resumed process rebuilds the cursor from the durable log. A fork ignores inherited watermarks that name another Session, and therefore sends its own complete inherited prefix before advancing under the child id. The watermark event itself belongs to the next unsent suffix.
152
156
 
153
157
  Transport and non-2xx failures append no watermark. A crash after endpoint acceptance but before local persistence may resend an already accepted range; uncertainty produces duplicates, never a sequence gap. There is no independent upload store, size cap, or truncation path.
154
158
 
155
159
  ## Exposure and receiver requirements
156
160
 
157
- The request headers expose the Harness application version, one anonymous Harness-home identity, and an optional Session identity. `dsh_plugin_packages` exposes active npm package names and versions. When enabled, `dsh_session_log` may expose the Session working directory, system-prompt snapshots, user and assistant content, raw assistant chunks, tool arguments and results, compaction summaries, feedback, and plugin-owned events. Adapter API keys are not Session events and therefore do not enter the field. A gateway selected through `baseURL` receives the same values as the official endpoint.
161
+ The request headers expose the Harness application version, one anonymous Harness-home identity, and an optional Session identity. `dsh_plugin_packages` exposes active npm package names and versions. When enabled, `dsh_session_log` may expose the Session working directory, system-prompt snapshots, user and Assistant content, embedded Assistant streams, failed-attempt output, tool arguments and results, compaction summaries, feedback, and plugin-owned events. Adapter API keys are not Session events and therefore do not enter the field. A gateway selected through `baseURL` receives the same values as the official endpoint.
158
162
 
159
163
  Receivers address extension fields by name, dispatch each field by its own `version`, preserve distinct package versions, and ignore JSON member ordering. A session-log receiver validates the contiguous sequence range before interpreting event types. An unrecognized canonical event without `ignorable: true` prevents lossless reconstruction. The base request remains usable without either the registry or a particular contribution; field absence means that contribution did not apply to that request.