@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 +2 -2
- package/README.md +1 -1
- package/README.zh.md +5 -5
- package/package.json +1 -1
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:
|
|
6
|
-
README.zh.md:
|
|
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
|
|
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: "
|
|
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`
|
|
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()`
|
|
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.
|
|
4
|
+
"version": "0.1.5-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|