dsh-plugin-guide 0.3.2 → 0.3.3

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 (100) hide show
  1. package/README.es.md +1 -1
  2. package/README.hi.md +1 -1
  3. package/README.md +1 -1
  4. package/README.pt.md +1 -1
  5. package/README.zh.md +1 -1
  6. package/dist/dsh-plugin-dev.js +3 -3
  7. package/guide/plugin-dev-guide.md +1 -1
  8. package/guide/quick-reference.es.md +1 -1
  9. package/guide/quick-reference.md +1 -1
  10. package/guide/quick-reference.pt.md +1 -1
  11. package/guide/quick-reference.zh-CN.md +1 -1
  12. package/package.json +3 -3
  13. package/references/official-docs/AGENTS.md +1 -1
  14. package/references/official-docs/SNAPSHOT.md +3 -3
  15. package/references/official-docs/docs/architecture.i18n.yaml +2 -2
  16. package/references/official-docs/docs/architecture.md +2 -1
  17. package/references/official-docs/docs/architecture.zh.md +2 -1
  18. package/references/official-docs/docs/capability-seams.i18n.yaml +2 -2
  19. package/references/official-docs/docs/capability-seams.md +3 -1
  20. package/references/official-docs/docs/capability-seams.zh.md +3 -1
  21. package/references/official-docs/docs/config-catalog.i18n.yaml +2 -2
  22. package/references/official-docs/docs/config-catalog.md +96 -54
  23. package/references/official-docs/docs/config-catalog.zh.md +93 -51
  24. package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +2 -2
  25. package/references/official-docs/docs/cookbook/adding-a-package.md +1 -1
  26. package/references/official-docs/docs/cookbook/adding-a-package.zh.md +1 -1
  27. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +2 -2
  28. package/references/official-docs/docs/event-producer-consumer.md +17 -17
  29. package/references/official-docs/docs/event-producer-consumer.zh.md +17 -17
  30. package/references/official-docs/docs/module-graph.i18n.yaml +2 -2
  31. package/references/official-docs/docs/module-graph.md +193 -361
  32. package/references/official-docs/docs/module-graph.zh.md +193 -361
  33. package/references/official-docs/docs/persistence-catalog.i18n.yaml +2 -2
  34. package/references/official-docs/docs/persistence-catalog.md +41 -41
  35. package/references/official-docs/docs/persistence-catalog.zh.md +40 -40
  36. package/references/official-docs/docs/subsystems/agent-team.i18n.yaml +2 -2
  37. package/references/official-docs/docs/subsystems/agent-team.md +4 -3
  38. package/references/official-docs/docs/subsystems/agent-team.zh.md +4 -3
  39. package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +2 -2
  40. package/references/official-docs/docs/subsystems/code-runtime.md +7 -3
  41. package/references/official-docs/docs/subsystems/code-runtime.zh.md +7 -3
  42. package/references/official-docs/docs/subsystems/commands.i18n.yaml +2 -2
  43. package/references/official-docs/docs/subsystems/commands.md +1 -1
  44. package/references/official-docs/docs/subsystems/commands.zh.md +1 -1
  45. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +2 -2
  46. package/references/official-docs/docs/subsystems/compaction.md +9 -9
  47. package/references/official-docs/docs/subsystems/compaction.zh.md +9 -9
  48. package/references/official-docs/docs/subsystems/core.i18n.yaml +2 -2
  49. package/references/official-docs/docs/subsystems/core.md +4 -3
  50. package/references/official-docs/docs/subsystems/core.zh.md +4 -3
  51. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +2 -2
  52. package/references/official-docs/docs/subsystems/feedback.md +2 -2
  53. package/references/official-docs/docs/subsystems/feedback.zh.md +2 -2
  54. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +2 -2
  55. package/references/official-docs/docs/subsystems/persistence.md +179 -187
  56. package/references/official-docs/docs/subsystems/persistence.zh.md +179 -187
  57. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +2 -2
  58. package/references/official-docs/docs/subsystems/schedule.md +1 -1
  59. package/references/official-docs/docs/subsystems/schedule.zh.md +1 -1
  60. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +2 -2
  61. package/references/official-docs/docs/subsystems/session-projection.md +21 -17
  62. package/references/official-docs/docs/subsystems/session-projection.zh.md +21 -17
  63. package/references/official-docs/docs/subsystems/session-query.i18n.yaml +2 -2
  64. package/references/official-docs/docs/subsystems/session-query.md +19 -13
  65. package/references/official-docs/docs/subsystems/session-query.zh.md +19 -13
  66. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +2 -2
  67. package/references/official-docs/docs/subsystems/session-title.md +5 -5
  68. package/references/official-docs/docs/subsystems/session-title.zh.md +5 -5
  69. package/references/official-docs/docs/subsystems/session.i18n.yaml +2 -2
  70. package/references/official-docs/docs/subsystems/session.md +94 -34
  71. package/references/official-docs/docs/subsystems/session.zh.md +94 -34
  72. package/references/official-docs/docs/subsystems/slots.i18n.yaml +2 -2
  73. package/references/official-docs/docs/subsystems/slots.md +1 -0
  74. package/references/official-docs/docs/subsystems/slots.zh.md +1 -0
  75. package/references/official-docs/docs/subsystems/storage.i18n.yaml +2 -2
  76. package/references/official-docs/docs/subsystems/storage.md +28 -5
  77. package/references/official-docs/docs/subsystems/storage.zh.md +28 -5
  78. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +2 -2
  79. package/references/official-docs/docs/subsystems/subagent.md +32 -88
  80. package/references/official-docs/docs/subsystems/subagent.zh.md +31 -87
  81. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +2 -2
  82. package/references/official-docs/docs/subsystems/token-meter.md +2 -2
  83. package/references/official-docs/docs/subsystems/token-meter.zh.md +2 -2
  84. package/references/official-docs/docs/tool-catalog.i18n.yaml +2 -2
  85. package/references/official-docs/docs/tool-catalog.md +9 -63
  86. package/references/official-docs/docs/tool-catalog.zh.md +8 -62
  87. package/references/official-docs/docs/web-styling.i18n.yaml +2 -2
  88. package/references/official-docs/docs/web-styling.md +3 -0
  89. package/references/official-docs/docs/web-styling.zh.md +3 -0
  90. package/references/official-docs/packages/AGENTS.md +2 -2
  91. package/templates/js/README.es.md +1 -1
  92. package/templates/js/README.hi.md +1 -1
  93. package/templates/js/README.md +1 -1
  94. package/templates/js/README.pt.md +1 -1
  95. package/templates/js/README.zh.md +1 -1
  96. package/templates/ts/README.es.md +1 -1
  97. package/templates/ts/README.hi.md +1 -1
  98. package/templates/ts/README.md +1 -1
  99. package/templates/ts/README.pt.md +1 -1
  100. package/templates/ts/README.zh.md +1 -1
@@ -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/agent-team.md
5
- agent-team.md: e3a746734b067bb7ef8f083c5c9af9cb3707dcf7
6
- agent-team.zh.md: 1f885a73861c091b50d27d15080ebc09f6d382ec
5
+ agent-team.md: 201123ea94499ff20cae25d68b1f7a826439d143
6
+ agent-team.zh.md: d6973ae6899c1d884dc51bd71afbd36a41895527
@@ -2,7 +2,7 @@
2
2
 
3
3
  English | [中文](agent-team.zh.md)
4
4
 
5
- Types shared by the experimental implicit-root Team domain, model tools, and host adapters. The [Agent Teams Agent Note](../../.agents/notes/implemented/feature/2026-08-05-agent-teams.md) owns identity, mailbox, task, and shared-checkout decisions; this page records the literal durable forms from [`packages/experimental/agent-team/src/types.ts`](../../packages/experimental/agent-team/src/types.ts).
5
+ Types shared by the experimental implicit-root Team domain, model tools, and host adapters. The [Agent Teams Agent Note](../../.agents/notes/implemented/feature/2026-08-05-agent-teams.md) owns identity, mailbox, task, and shared-checkout decisions; the [Team Steer messaging Agent Note](../../.agents/notes/implemented/simplification/2026-08-30-team-send-message-steer.md) owns message scheduling; this page records the literal durable forms from [`packages/experimental/agent-team/src/types.ts`](../../packages/experimental/agent-team/src/types.ts).
6
6
 
7
7
  ## Identity and roster
8
8
 
@@ -34,11 +34,12 @@ interface TeamMessageSnapshot {
34
34
  readonly senderId: SessionId
35
35
  readonly senderName: string
36
36
  readonly targetId: SessionId
37
- readonly delivery: 'quiet' | 'wakeup'
38
37
  readonly content: ContentBlock[]
39
38
  }
40
39
  ```
41
40
 
41
+ Every message attempts Steer delivery. A running target receives it at the nearest step boundary, an idle target starts a turn, and an inactive teammate cold-resumes. Scheduling is not stored in the durable record because callers cannot select another mode.
42
+
42
43
  The target Session keeps message identity and sender attribution on both the pending inbox item and the eventual user message. Folding that source across inbox and history is the target-side de-duplication key; the model-visible framing repeats the id and sender.
43
44
 
44
45
  ```ts type-equiv
@@ -116,7 +117,7 @@ async spawnTeammate(caller: Agent, request: SpawnTeammateRequest): Promise<Spawn
116
117
  /**
117
118
  * Queue one durable peer message, then attempt immediate delivery.
118
119
  * @param caller - exact live sending Team member.
119
- * @param request - target name, content, scheduling mode, and pre-queue cancellation.
120
+ * @param request - target name, content, and pre-queue cancellation.
120
121
  * @returns durable message identity and immediate-delivery observation.
121
122
  */
122
123
  async sendMessage(caller: Agent, request: SendTeamMessageRequest): Promise<SendTeamMessageResult>
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](agent-team.md) | 中文
4
4
 
5
- 实验性隐式 Root Team 领域、模型工具与宿主适配器共享的类型。[Agent Teams Agent Note](../../.agents/notes/implemented/feature/2026-08-05-agent-teams.zh.md)负责身份、mailbox、task 与共享 checkout 决策;本页记录 [`packages/experimental/agent-team/src/types.ts`](../../packages/experimental/agent-team/src/types.ts) 中的字面持久形式。
5
+ 实验性隐式 Root Team 领域、模型工具与宿主适配器共享的类型。[Agent Teams Agent Note](../../.agents/notes/implemented/feature/2026-08-05-agent-teams.zh.md)负责身份、mailbox、task 与共享 checkout 决策;[Team Steer 消息 Agent Note](../../.agents/notes/implemented/simplification/2026-08-30-team-send-message-steer.zh.md)负责消息调度;本页记录 [`packages/experimental/agent-team/src/types.ts`](../../packages/experimental/agent-team/src/types.ts) 中的字面持久形式。
6
6
 
7
7
  ## 身份与 roster
8
8
 
@@ -34,11 +34,12 @@ interface TeamMessageSnapshot {
34
34
  readonly senderId: SessionId
35
35
  readonly senderName: string
36
36
  readonly targetId: SessionId
37
- readonly delivery: 'quiet' | 'wakeup'
38
37
  readonly content: ContentBlock[]
39
38
  }
40
39
  ```
41
40
 
41
+ 每条消息都会尝试 Steer 投递。running target 在最近的步骤边界收到消息,idle target 启动一个轮次,inactive teammate 则冷恢复。调用方不能选择其他模式,因此持久记录不存储调度方式。
42
+
42
43
  target Session 会在 pending inbox 条目和最终用户消息上保留消息身份与发送者归因。跨 inbox 与历史折叠该 source 构成 target 侧去重键;模型可见的 framing 会重复 id 和发送者。
43
44
 
44
45
  ```ts type-equiv
@@ -116,7 +117,7 @@ async spawnTeammate(caller: Agent, request: SpawnTeammateRequest): Promise<Spawn
116
117
  /**
117
118
  * Queue one durable peer message, then attempt immediate delivery.
118
119
  * @param caller - exact live sending Team member.
119
- * @param request - target name, content, scheduling mode, and pre-queue cancellation.
120
+ * @param request - target name, content, and pre-queue cancellation.
120
121
  * @returns durable message identity and immediate-delivery observation.
121
122
  */
122
123
  async sendMessage(caller: Agent, request: SendTeamMessageRequest): Promise<SendTeamMessageResult>
@@ -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/code-runtime.md
5
- code-runtime.md: 0f633df9fc657d9d80fc04df3bc8ad6fafdddcb2
6
- code-runtime.zh.md: 43b78ce49575741f7ae6c4e2751b63b7562fc99a
5
+ code-runtime.md: 4c7fce42c363c7735d03fcb723bb5c5f1af12bb9
6
+ code-runtime.zh.md: f01e3bccef165a5aeb9130ac983b2e8ff63a81b0
@@ -52,7 +52,11 @@ interface CodeRunResult {
52
52
  * rendered string; a failed or value-less run leaves this absent.
53
53
  */
54
54
  value?: CodeJsonValue
55
- /** Text the program emitted, in order, bounded only as part of the outer result. */
55
+ /**
56
+ * Captured text. Each source channel preserves emission order; interleaving
57
+ * across independent channels is backend-dependent. Bounded only as part of
58
+ * the outer result.
59
+ */
56
60
  logs: string[]
57
61
  /** Present iff the run failed; see {@link CodeRunFailure} for the taxonomy. */
58
62
  error?: CodeRunFailure
@@ -131,7 +135,7 @@ type CodeBindingFunction = (args: unknown) => Promise<CodeJsonValue>
131
135
 
132
136
  ## Captured output and the failure taxonomy
133
137
 
134
- Logs are plain strings in emission order. The runtime captures the program's console and stream output, but channel and console-method metadata are not part of the seam because consumers render only the text. Implementations cap the serialized outer log-array plus completion-value or failure-message payload; fixed result-envelope syntax and consumer presentation whitespace are not part of that variable-payload ledger. Overflow is an explicit failure rather than in-band value substitution.
138
+ Logs are plain strings. Each source channel preserves emission order, while interleaving across independent channels is backend-dependent because channel metadata is not part of the seam. The runtime captures the program's console and stream output, and consumers render only the text. Implementations cap the serialized outer log-array plus completion-value or failure-message payload; fixed result-envelope syntax and consumer presentation whitespace are not part of that variable-payload ledger. Overflow is an explicit failure rather than in-band value substitution.
135
139
 
136
140
  Failure kinds are **orthogonal outcomes reported independently** (per [defensive-patterns](../defensive-patterns.md)): a budget expiry is not an exception, an abort is not a timeout, and a substrate death (e.g. OOM) is neither:
137
141
 
@@ -158,7 +162,7 @@ interface CodeRunFailure {
158
162
 
159
163
  ## The service
160
164
 
161
- `CodeRuntime` (`ctx.codeRuntime`, abstract — defined in [`packages/code-runtime/code-runtime/src/index.ts`](../../packages/code-runtime/code-runtime/src/index.ts)) is `run(request)` plus two readonly descriptors: `language` (what the program must be written in — `'typescript'` and `'python'` are the well-known values, those `dsh-tools` presents, and only `'typescript'` has a published backend; a consumer generating language-specific presentation switches on it and fails loud on one it cannot present) and `isolation` (the execution substrate — `'worker-thread'`, `'process'`, `'container'`; a diagnostic label, **not a security claim**). Implementations must keep runs isolated from each other (no cross-run state) and dispose to quiescence: in-flight runs are terminated and awaited before teardown completes.
165
+ `CodeRuntime` (`ctx.codeRuntime`, abstract — defined in [`packages/code-runtime/code-runtime/src/index.ts`](../../packages/code-runtime/code-runtime/src/index.ts)) is `run(request)` plus two readonly descriptors: `language` (what the program must be written in — `'typescript'` and `'python'` are the well-known values, those `dsh-tools` presents, the TypeScript backend released and the Python backend experimental and private (not published); a consumer generating language-specific presentation switches on it and fails loud on one it cannot present) and `isolation` (the execution substrate — `'worker-thread'`, `'process'`, `'container'`; a diagnostic label, **not a security claim**). Implementations must keep runs isolated from each other (no cross-run state) and dispose to quiescence: in-flight runs are terminated and awaited before teardown completes.
162
166
 
163
167
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
164
168
 
@@ -52,7 +52,11 @@ interface CodeRunResult {
52
52
  * rendered string; a failed or value-less run leaves this absent.
53
53
  */
54
54
  value?: CodeJsonValue
55
- /** Text the program emitted, in order, bounded only as part of the outer result. */
55
+ /**
56
+ * Captured text. Each source channel preserves emission order; interleaving
57
+ * across independent channels is backend-dependent. Bounded only as part of
58
+ * the outer result.
59
+ */
56
60
  logs: string[]
57
61
  /** Present iff the run failed; see {@link CodeRunFailure} for the taxonomy. */
58
62
  error?: CodeRunFailure
@@ -131,7 +135,7 @@ type CodeBindingFunction = (args: unknown) => Promise<CodeJsonValue>
131
135
 
132
136
  ## 捕获的输出与失败分类体系
133
137
 
134
- 日志是按发出顺序排列的纯字符串。运行时捕获程序的 console 与流输出,但通道和 console 方法的元数据不属于 seam,因为 Consumer 只渲染文本。实现会对序列化后的外层日志数组,以及完成值或失败消息的组合载荷设置上限;固定的结果封装语法与 Consumer 展示空白不计入这份可变载荷计量。超限会显式失败,而不会在值中插入替代内容。
138
+ 日志是纯字符串。每个来源通道保留自身的发出顺序;由于通道元数据不属于 seam,相互独立的通道如何交错由后端决定。运行时捕获程序的 console 与流输出,Consumer 只渲染文本。实现会对序列化后的外层日志数组,以及完成值或失败消息的组合载荷设置上限;固定的结果封装语法与 Consumer 展示空白不计入这份可变载荷计量。超限会显式失败,而不会在值中插入替代内容。
135
139
 
136
140
  失败类型是**正交的结果,独立报告**(见 [defensive-patterns](../defensive-patterns.zh.md)):预算耗尽不是异常,中止不是超时,基底崩溃(如 OOM)也不是二者中的任何一个:
137
141
 
@@ -158,7 +162,7 @@ interface CodeRunFailure {
158
162
 
159
163
  ## 服务
160
164
 
161
- `CodeRuntime`(`ctx.codeRuntime`,抽象服务,定义于 [`packages/code-runtime/code-runtime/src/index.ts`](../../packages/code-runtime/code-runtime/src/index.ts))由 `run(request)` 加两个只读描述符组成:`language`(程序必须使用的语言,已知值为 `'typescript'` 与 `'python'`,即 `dsh-tools` 能呈现的那些,其中只有 `'typescript'` 有已发布的后端;生成语言相关展示的 Consumer 据此切换,遇到无法展示的语言时应显式报错)和 `isolation`(执行基底,`'worker-thread'`、`'process'`、`'container'`;仅为诊断标签,**不构成安全承诺**)。实现必须保证各次运行彼此隔离(无跨运行状态),并在 dispose(资源释放)时等待系统完全停稳:teardown 要等到所有进行中的运行均已终止并结算后才完成。
165
+ `CodeRuntime`(`ctx.codeRuntime`,抽象服务,定义于 [`packages/code-runtime/code-runtime/src/index.ts`](../../packages/code-runtime/code-runtime/src/index.ts))由 `run(request)` 加两个只读描述符组成:`language`(程序必须使用的语言,已知值为 `'typescript'` 与 `'python'`,即 `dsh-tools` 能呈现的那些,TypeScript 后端已发布、Python 后端为实验性且私有(未发布);生成语言相关展示的 Consumer 据此切换,遇到无法展示的语言时应显式报错)和 `isolation`(执行基底,`'worker-thread'`、`'process'`、`'container'`;仅为诊断标签,**不构成安全承诺**)。实现必须保证各次运行彼此隔离(无跨运行状态),并在 dispose(资源释放)时等待系统完全停稳:teardown 要等到所有进行中的运行均已终止并结算后才完成。
162
166
 
163
167
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
164
168
 
@@ -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/commands.md
5
- commands.md: f3760558b04253701915a240375f13e096bc0c51
6
- commands.zh.md: 2b4377b76b55203d84a956f66879ab2c50a9fd23
5
+ commands.md: 46d3b736afd3a72d1119c9744cd592a86b9cbc29
6
+ commands.zh.md: db8d6e722e3a1742887aaa4023ab67b9ed914552
@@ -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
  ```
@@ -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
  ```
@@ -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/core.md
5
- core.md: 124d30a5abeddd81edd2eb03a9bb213487b6a38e
6
- core.zh.md: c2d67eabb3b223d3f1d20c42f01280f16656ebef
5
+ core.md: 170268351454643544d5ab20e3d4b6a8fd8c6c69
6
+ core.zh.md: 048f7ed5f2136bb583c0308635e5cddde2b96785
@@ -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
 
@@ -356,13 +356,14 @@ Concrete agent factory and driver service.
356
356
  /**
357
357
  * Create an agent and session under one caller-supplied identity, owned by
358
358
  * the accessing fiber. Constructor-driven config calls mint a fresh combined
359
- * id before entering this boundary.
359
+ * id before entering this boundary. When a persistence backend is mounted,
360
+ * the session's durable identity and any seed are stored before publication.
360
361
  * @param id - shared agent/session identity.
361
362
  * @param options - concrete loop options.
362
363
  * @param meta - optional fresh-session workspace metadata.
363
364
  * @returns the published running agent.
364
365
  */
365
- create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent
366
+ async create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Promise<Agent>
366
367
 
367
368
  /**
368
369
  * Create an owned agent on a caller-supplied session id.
@@ -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
 
@@ -366,13 +366,14 @@ Concrete agent factory and driver service.
366
366
  /**
367
367
  * Create an agent and session under one caller-supplied identity, owned by
368
368
  * the accessing fiber. Constructor-driven config calls mint a fresh combined
369
- * id before entering this boundary.
369
+ * id before entering this boundary. When a persistence backend is mounted,
370
+ * the session's durable identity and any seed are stored before publication.
370
371
  * @param id - shared agent/session identity.
371
372
  * @param options - concrete loop options.
372
373
  * @param meta - optional fresh-session workspace metadata.
373
374
  * @returns the published running agent.
374
375
  */
375
- create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent
376
+ async create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Promise<Agent>
376
377
 
377
378
  /**
378
379
  * Create an owned agent on a caller-supplied session id.
@@ -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/persistence.md
5
- persistence.md: cd7eaa126ea16b17526223498d1fa1591792747c
6
- persistence.zh.md: c96aa87f738e5607c699dfa97e6d2b237767b76d
5
+ persistence.md: 4f6069b8a926f8fe24d2271650d45dc8377fa355
6
+ persistence.zh.md: 6f8430868a001d0da4755579d2e667097d254ac6