dsh-tool-wait-until 1.0.1 → 1.0.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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/index.js +3 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -116,7 +116,7 @@ cordis.patch.yml 插入 Loader 条目
116
116
  package.json bundle 清单(dsh.bundle.patch 指向 patch)
117
117
  locale/ 中英文显示元数据(Plugin Manager / Settings 用)
118
118
  icon.svg 插件图标
119
- test/unit.mjs 本地单测(mock 服务,215 条断言,不依赖运行时)
119
+ test/unit.mjs 本地单测(mock 服务,250+ 条断言,不依赖运行时)
120
120
  docs/baseline.md 改造前基线实测报告
121
121
  ```
122
122
 
@@ -133,7 +133,7 @@ node test/unit.mjs
133
133
  ## 安装
134
134
 
135
135
  ```js
136
- plugin_manager({ action: 'install_bundle', target: '/Users/loong/dsh-plugins/dsh-tool-wait-until' })
136
+ plugin_manager({ action: 'install_bundle', target: '/Users/loong/workspace/code/github/dsh-tool-wait-until' })
137
137
  ```
138
138
 
139
139
  安装后由 Plugin Manager 写入 profile 的 `package.json` 与 bundle 列表,`cordis.patch.yml` 插入 `tool-wait-until` 条目。卸载用 `plugin_manager remove_bundle`。
@@ -160,4 +160,4 @@ plugin_manager({ action: 'install_bundle', target: '/Users/loong/dsh-plugins/dsh
160
160
  2. **等待中被事件唤醒**:后台启动 `sh -c 'sleep 20; echo "EXIT=3" >&2; exit 3'`,在运行中用 `poll_interval_sec:10` 调 `wait_until` → 期望在约 20 秒的失败瞬间返回,而不是等到 30 秒的轮询边界。
161
161
  3. **卡住检测**:后台启动 `sh -c 'sleep 300'`,`wait_until({conditions:[{kind:"job",id:"<id>"}], stall_after_sec:5, timeout_sec:60})` → 期望约 5 秒返回 `stalled`,测完 `job_kill`。
162
162
 
163
- `node test/unit.mjs` 覆盖上述语义(249 条断言)。
163
+ `node test/unit.mjs` 覆盖上述语义(250+ 条断言)。
package/index.js CHANGED
@@ -811,7 +811,9 @@ const WAIT_UNTIL_RESULT_SCHEMA = {
811
811
  }
812
812
 
813
813
  function renderWaitUntilResult(_args, value) {
814
- const lines = [`[wait_until ${value.status}] 耗时 ${value.elapsed}(${value.elapsed_ms}ms)`]
814
+ // elapsed 是 elapsed_ms 的可读形式;短耗时下两者同义,避免渲染成「1ms(1ms)」
815
+ const elapsedDetail = value.elapsed_ms >= 1000 ? `(${value.elapsed_ms}ms)` : ''
816
+ const lines = [`[wait_until ${value.status}] 耗时 ${value.elapsed}${elapsedDetail}`]
815
817
  if (value.failure_reason !== undefined) lines.push(`失败原因:${value.failure_reason}`)
816
818
  if (value.stalled_for_sec !== undefined) lines.push(`无进展持续 ${value.stalled_for_sec}s`)
817
819
  if (value.matched.length > 0) lines.push(`已满足:${value.matched.join(';')}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tool-wait-until",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Event-driven wait for DeepSeek Harness: returns the moment the target completes, fails early, or stalls — instead of burning a full timeout and querying again. Also blocks sleep-polling and over-long waits.",
5
5
  "keywords": [
6
6
  "dsh",