@x1a0f3n9/dsh-timeout 0.1.2-alpha.6 → 0.1.5-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -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 packages/util/timeout/README.md
5
- README.md: d7428abe89cb2a134a216049f1df85aebeaa9ed4
6
- README.zh.md: 3d4fc39e2d05f86b82c4c3916cf21a3bff2ab35d
5
+ README.md: 80f8dc7c427ba045e36343d009a93828a45b1a69
6
+ README.zh.md: 9d711ecfd24857e5bb83ea102dd6c3a5c86254d3
package/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
11
 
12
- `dsh-timeout` lets a capability run one unit of work under a caller-visible timeout and later tell a timeout apart from a cancellation. A caller's optional hint is clamped against a backend default and cap, and upstream cancellation fuses with the deadline into one `AbortSignal`. The deadline signal only notifies — each capability owns the mechanism that stops its work, so no shared layer needs to know how to stop anything. For streamed transports an idle watchdog arms a timeout only while a provider read is outstanding, so consumer think time never counts as idle. A `timeoutMs` of zero is the internal no-timeout sentinel for backend-owned background work, never a public disable switch; the zero-dependency library is shared by the bash, web, subprocess, and tool-timeout-policy consumers.
12
+ `dsh-timeout` lets callers apply bounded deadlines to work, distinguish local timeout from upstream cancellation, and monitor streamed reads for inactivity. `clampTimeout` fills a missing hint from a backend default, caps it at the allowed maximum, and rejects invalid values before work starts. `deadline` combines the chosen timeout with upstream cancellation in one signal, while the caller remains responsible for actually stopping its process, socket, or task. `idleWatchdog` counts only time spent waiting for provider reads, and zero remains reserved for backend-owned untimed work rather than public configuration.
13
13
 
14
14
  ## Table of Contents
15
15
 
package/README.zh.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "共享超时运算、截止时间融合与超时/取消分类,供需要限制调用方提示、启动 deadline 并在之后区分二者的能力使用。"
2
+ description: "共享超时运算、截止时间融合与超时和取消分类,供需要限制调用方超时提示、启动 deadline 并在之后区分二者的能力使用。"
3
3
  kind: "package-library"
4
4
  ---
5
5
 
@@ -9,7 +9,7 @@ kind: "package-library"
9
9
 
10
10
  ## 概述
11
11
 
12
- `dsh-timeout` 让能力在调用方可见的超时下运行一个工作单元,之后能把超时与取消区分开。调用方的可选提示会按后端默认值补齐、并按后端上限封顶,上游取消与截止时间融合为一个 `AbortSignal`。deadline 信号只负责通知——停止工作的机制由各能力自己拥有,因此没有任何共享层需要知道如何停止任何东西。对于流式传输,空闲 watchdog 只在提供方读取尚未完成时启动超时,因此消费方的思考时间绝不计入空闲。`timeoutMs` 为 0 是后端自有后台工作使用的内部「无超时」哨兵值,绝不是公开的禁用开关;这个零依赖库由 bash、web、subprocess 与 tool-timeout-policy 消费方共享。
12
+ `dsh-timeout` 让调用方为工作设置有上限的截止时间、区分本地超时与上游取消,并监测流式读取是否空闲。`clampTimeout` 在提示缺失时填入后端默认值,把结果限制在允许的最大值以内,并在工作开始前拒绝无效值。`deadline` 将选定的超时与上游取消合并到一个信号中,而调用方仍负责真正停止自己的进程、套接字或任务。`idleWatchdog` 只计算等待提供方读取所花的时间;零仍保留给后端自有的不计时工作,而不是公开配置。
13
13
 
14
14
  ## 目录
15
15
 
@@ -71,7 +71,7 @@ using watchdog = idleWatchdog(upstream, idleMs, 'LLM_STREAM_IDLE_TIMEOUT')
71
71
  const next = await watchdog.next(providerIterator) // timer runs only while this read is outstanding
72
72
  ```
73
73
 
74
- timer 只在某个迭代器 `next()` 尚未完成时启动,并会因不产生值的传输活动通过 `pulse()` 重新启动,因此读取之间的消费方思考时间绝不计入空闲。间隔必须为正有限数,且不得大于 `MAX_TIMER_DELAY_MS`。
74
+ timer 只在某个迭代器 `next()` 尚未完成时启动,并会因不产生值的传输活动通过 `pulse()` 重新启动,因此读取之间的消费方处理时间绝不计入空闲。间隔必须为正有限数,且不得大于 `MAX_TIMER_DELAY_MS`。
75
75
 
76
76
  ### 哪些操作不设置超时
77
77
 
@@ -92,7 +92,7 @@ timer 只在某个迭代器 `next()` 尚未完成时启动,并会因不产生
92
92
  | 文件 | 职责 |
93
93
  |---|---|
94
94
  | [`src/index.ts`](src/index.ts) | `clampTimeout`、`deadline`、`idleWatchdog`、`timeoutOf`、`TimeoutReason`、`MAX_TIMER_DELAY_MS` |
95
- | — | 不发布运行时不变式伴生入口;时序运算由单元测试覆盖。 |
95
+ | — | 不发布运行时不变式伴生入口;这个纯工具不拥有事件流或可变运行时数据;其值代数约束由单元测试保障。 |
96
96
 
97
97
  ### deadline 如何融合来源
98
98
 
@@ -141,7 +141,7 @@ timer 只在某个迭代器 `next()` 尚未完成时启动,并会因不产生
141
141
  - **只发出通知**——deadline 无法停止忽略其信号的工作;每项能力仍需要自己的 socket、进程或任务终止路径。
142
142
  - **`timeoutMs <= 0` 是内部词汇**——只有在所属后端已解析策略后,它才会禁用本地 timer;绝不会作为面向模型或插件的公开开关。
143
143
  - **第一个中止原因决定分类**——当上游取消早于本地 timer 发生时,即使自己的超时之后也会到期,该层也无法再报告。
144
- - **空闲 watchdog 不是总 deadline**——它针对每个尚未完成的迭代器需求重新启动,并刻意排除消费方的思考时间。
144
+ - **空闲 watchdog 不是总 deadline**——它针对每个尚未完成的迭代器需求重新启动,并刻意排除消费方的处理时间。
145
145
 
146
146
  <a id="dev-note"></a>
147
147
  ### 开发备注
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@x1a0f3n9/dsh-timeout",
3
3
  "description": "Zero-dependency timeout/deadline primitive: clampTimeout, deadline, timeoutOf, TimeoutReason (timing + classification only, no termination)",
4
- "version": "0.1.2-alpha.6",
4
+ "version": "0.1.5-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },