dsh-limit-break 1.2.0 → 1.2.1
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/CHANGELOG.md +13 -0
- package/MAINTAIN.md +12 -16
- package/lib/index.js +64 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to `dsh-limit-break`. Format follows
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
## 1.2.1 — 2026-10-21
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **The log could not tell you which copy was live.** `User-Agent` and every
|
|
12
|
+
`plugin-load.log` record now carry the version read from the installed `package.json`
|
|
13
|
+
instead of a hard-coded string, and mount records add `moduleDir`. A rolled-back or
|
|
14
|
+
hand-copied install is now visible in one line instead of a guess.
|
|
15
|
+
- **A doubly-activated plugin looked like a broken switch.** When a profile patch keeps a
|
|
16
|
+
second `insert` row for the same id, the loader mounts the plugin twice, the bundle switch
|
|
17
|
+
has nothing left to turn off, and the row switch is locked as *unaddressable*. Mounts are
|
|
18
|
+
now counted per store and a second live mount writes a `duplicate-apply` record with a
|
|
19
|
+
hint, so the misconfiguration is diagnosable from the log instead of from the symptom.
|
|
20
|
+
|
|
8
21
|
## 1.2.0 — 2026-10-20
|
|
9
22
|
|
|
10
23
|
### Fixed
|
package/MAINTAIN.md
CHANGED
|
@@ -108,25 +108,21 @@ git add -A && git commit -m "..." && git push
|
|
|
108
108
|
|
|
109
109
|
---
|
|
110
110
|
|
|
111
|
-
## Backlog(按 2026-10-20
|
|
112
|
-
|
|
113
|
-
- [
|
|
114
|
-
|
|
115
|
-
`
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- [ ] 旧定时任务 `schedule-803cdbdc`(会话 5133bee1)跨会话删不掉(`schedule_not_found`),
|
|
119
|
-
已从 `storages/schedule.json` 摘行;运行中的 hub 会从内存回写,**重启后才彻底消失**,
|
|
120
|
-
或由用户在 5133bee1 的定时任务面板手动删。INDEX.md 里留了自删提示。
|
|
111
|
+
## Backlog(按 2026-10-20 20:06 的真实状态)
|
|
112
|
+
|
|
113
|
+
- [x] **1.2.0 已上线**(2026-10-20T12:02:52Z):npm `latest` = `1.2.0`,GitHub `origin/main` =
|
|
114
|
+
`fd844a4`,`verify` PASS,`test_plugin.mjs` 6/6 PASS。用户 20:04 完成了 OTP 发布和推送。
|
|
115
|
+
`env.node_npm` 与 `release.dsh-limit-break` 两条事实已回写。
|
|
116
|
+
- [x] 旧定时任务 `schedule-803cdbdc`(会话 5133bee1)已由用户在面板删除;`storages/schedule.json`
|
|
117
|
+
里只剩 `schedule-0b6c60ea`(hello world)和新的 `schedule-b3675d28`。无需再处理。
|
|
121
118
|
- [ ] 市场条目 PR `awesome-dsh-plugin/awesome-dsh-plugin#8296` 仍是 open;合并前 `status` 会一直报
|
|
122
119
|
`market listing not live yet`。找合并节奏,不要重提。
|
|
123
|
-
- [ ] npm 上还挂着占位包 `0.0.0-stage`(`stub: true
|
|
124
|
-
|
|
120
|
+
- [ ] npm 上还挂着占位包 `0.0.0-stage`(`stub: true`)。`npm deprecate` 也要 OTP(本轮 EOTP 失败);
|
|
121
|
+
用户一条命令即可:`npm deprecate dsh-limit-break@0.0.0-stage "placeholder - use 1.2.0"`。
|
|
122
|
+
- [ ] `1.0.0` 是无元数据的旧包体(author/repository 都不在)。同样一条 `npm deprecate` 可清掉噪音(需 OTP)。
|
|
125
123
|
- [ ] `facts.json` 里 `env.gpu` 仍写着"no GPU compute benchmark was run"——已过时(GPU 实测 54.3×)。
|
|
126
|
-
- [
|
|
127
|
-
|
|
128
|
-
值得查清:是工具清单在会话创建时快照,还是 hub 与 agent 进程的工具注册面不同。
|
|
129
|
-
查清后要么修(如果能在插件侧解决),要么写进 README 作为已知限制。
|
|
124
|
+
- [x] 插件工具对**已经打开的会话**不可见:已在 README「Known limits」第 1 条写明
|
|
125
|
+
(tool list 是 per-session 快照,插件侧修不了)。事实 `harness.plugin-tool-visibility` 有实测。
|
|
130
126
|
- [ ] `resilient_fetch` 目前按"主机名别名"降级,可以继续加:`--resolve` 到已知 IP、
|
|
131
127
|
IPv6 优先、以及把成功路径写回记忆库(现在是只读阶梯)。
|
|
132
128
|
- [ ] 没有任何自动化测试覆盖 `memory_save` 的并发写。单进程够用,多进程未验证。
|
package/lib/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { appendFileSync, mkdirSync, readFileSync, statSync, writeFileSync } from
|
|
|
21
21
|
import { mkdir, readFile, rename, stat, writeFile } from 'node:fs/promises'
|
|
22
22
|
import { homedir } from 'node:os'
|
|
23
23
|
import { dirname, isAbsolute, join, resolve } from 'node:path'
|
|
24
|
+
import { fileURLToPath } from 'node:url'
|
|
24
25
|
import { promisify } from 'node:util'
|
|
25
26
|
|
|
26
27
|
const execFileAsync = promisify(execFile)
|
|
@@ -28,7 +29,26 @@ const execFileAsync = promisify(execFile)
|
|
|
28
29
|
export const name = 'limit-break'
|
|
29
30
|
export const inject = ['tools']
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Our own version, read from the package we were loaded out of.
|
|
34
|
+
*
|
|
35
|
+
* Hard-coding it means the value in `User-Agent` and in `plugin-load.log` can silently
|
|
36
|
+
* disagree with the tarball that is actually installed — which is exactly how a rolled-back
|
|
37
|
+
* 1.0.1 install kept looking like 1.2.0 during debugging.
|
|
38
|
+
*/
|
|
39
|
+
let cachedVersion
|
|
40
|
+
function version() {
|
|
41
|
+
if (cachedVersion) return cachedVersion
|
|
42
|
+
try {
|
|
43
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
|
|
44
|
+
cachedVersion = String(pkg.version || '0.0.0-unknown')
|
|
45
|
+
} catch {
|
|
46
|
+
cachedVersion = '0.0.0-unknown'
|
|
47
|
+
}
|
|
48
|
+
return cachedVersion
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const UA = `dsh-limit-break/${version()} (+local)`
|
|
32
52
|
const MAX_TEXT = 20000
|
|
33
53
|
const MAX_FACTS_RETURNED = 12
|
|
34
54
|
const MAX_BODY_BYTES = 2 * 1024 * 1024
|
|
@@ -55,6 +75,32 @@ function resolveStoreDir(config) {
|
|
|
55
75
|
return configured ? configured : join(resolveHome(), 'memory')
|
|
56
76
|
}
|
|
57
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Count live mounts of this plugin per store, in this process.
|
|
80
|
+
*
|
|
81
|
+
* The Plugins page can switch a plugin off, but a profile patch may still contain a second
|
|
82
|
+
* `insert` row for the same id — the loader happily mounts both, and then *neither* switch
|
|
83
|
+
* appears to work. That failure is invisible from the outside, so record it here: two live
|
|
84
|
+
* mounts pointing at one store is only ever a duplicate activation.
|
|
85
|
+
*/
|
|
86
|
+
const LIVE_MOUNTS = Symbol.for('dsh-limit-break.live-mounts')
|
|
87
|
+
|
|
88
|
+
function registerMount(storeDir) {
|
|
89
|
+
const box = globalThis
|
|
90
|
+
if (!(box[LIVE_MOUNTS] instanceof Map)) box[LIVE_MOUNTS] = new Map()
|
|
91
|
+
const map = box[LIVE_MOUNTS]
|
|
92
|
+
const count = (map.get(storeDir) || 0) + 1
|
|
93
|
+
map.set(storeDir, count)
|
|
94
|
+
return {
|
|
95
|
+
count,
|
|
96
|
+
release() {
|
|
97
|
+
const left = (map.get(storeDir) || 1) - 1
|
|
98
|
+
if (left <= 0) map.delete(storeDir)
|
|
99
|
+
else map.set(storeDir, left)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
58
104
|
/**
|
|
59
105
|
* Append one JSON line per load attempt to <store>/plugin-load.log.
|
|
60
106
|
*
|
|
@@ -79,7 +125,7 @@ function diag(config, stage, extra) {
|
|
|
79
125
|
} catch {
|
|
80
126
|
/* first write: no file yet */
|
|
81
127
|
}
|
|
82
|
-
const line = JSON.stringify({ at: new Date().toISOString(), pid: process.pid, stage, ...extra })
|
|
128
|
+
const line = JSON.stringify({ at: new Date().toISOString(), pid: process.pid, version: version(), stage, ...extra })
|
|
83
129
|
appendFileSync(logFile, `${line}\n`)
|
|
84
130
|
} catch {
|
|
85
131
|
/* diagnostics must never break the host */
|
|
@@ -299,9 +345,21 @@ export function apply(ctx, config) {
|
|
|
299
345
|
diag(config, 'no-tools-service', { ctxKeys: ctx ? Object.keys(ctx).slice(0, 24) : [] })
|
|
300
346
|
return
|
|
301
347
|
}
|
|
302
|
-
diag(config, 'mount', { storeDir: resolveStoreDir(config) })
|
|
303
|
-
|
|
304
348
|
const storeDir = resolveStoreDir(config)
|
|
349
|
+
const mount = registerMount(storeDir)
|
|
350
|
+
diag(config, 'mount', {
|
|
351
|
+
storeDir,
|
|
352
|
+
moduleDir: dirname(fileURLToPath(import.meta.url)),
|
|
353
|
+
liveMounts: mount.count
|
|
354
|
+
})
|
|
355
|
+
if (mount.count > 1) {
|
|
356
|
+
diag(config, 'duplicate-apply', {
|
|
357
|
+
storeDir,
|
|
358
|
+
liveMounts: mount.count,
|
|
359
|
+
hint: 'the same plugin is mounted more than once (e.g. a bundle plus a manual insert row); switches will look broken'
|
|
360
|
+
})
|
|
361
|
+
}
|
|
362
|
+
|
|
305
363
|
const timeoutMs = Number(config && config.requestTimeoutMs) || 12000
|
|
306
364
|
const shellFallback = !(config && config.shellFallback === false)
|
|
307
365
|
|
|
@@ -310,6 +368,8 @@ export function apply(ctx, config) {
|
|
|
310
368
|
return fn()
|
|
311
369
|
}
|
|
312
370
|
|
|
371
|
+
effect(() => () => mount.release(), 'limit-break:lifetime')
|
|
372
|
+
|
|
313
373
|
/* ---- memory_recall ------------------------------------------------ */
|
|
314
374
|
effect(
|
|
315
375
|
() =>
|
package/package.json
CHANGED