@linxin666/dsh-win-bash 0.4.13 → 0.4.14
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 +26 -2
- package/README.zh.md +16 -1
- package/lib/index.js +438 -36
- package/lib/types/background.d.ts +7 -0
- package/lib/types/dsh-home.d.ts +16 -0
- package/lib/types/index.d.ts +11 -2
- package/lib/types/runtime.d.ts +118 -9
- package/lib/types/shell.d.ts +53 -1
- package/package.json +1 -1
- package/src/background.ts +19 -2
- package/src/dsh-home.ts +42 -0
- package/src/index.ts +56 -3
- package/src/runtime.ts +288 -26
- package/src/shell.ts +182 -6
- package/src/tool.ts +3 -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
|
# node scripts/verify-docs.mjs --write <dir>
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: c0a834ef30c039c5dc5b625b4d0fbacefc6bb35e
|
|
6
|
+
README.zh.md: 1b50b301e2fad0f541d5058b1ef3e0b733d96f8b
|
package/README.md
CHANGED
|
@@ -41,8 +41,16 @@ session is what makes that true.
|
|
|
41
41
|
- Optionally runs a command as a background job in its own pinned bash process
|
|
42
42
|
and returns a job id at once, so a long build or watch does not hold the call
|
|
43
43
|
open or die with the session's shell. See [Background commands](#background-commands).
|
|
44
|
-
-
|
|
45
|
-
|
|
44
|
+
- Gives every shell its own private directory under the machine's temp root for
|
|
45
|
+
`TMPDIR`/`TMP`/`TEMP`, and deletes it when that shell ends — on `exit`, on
|
|
46
|
+
timeout or abort, on session disposal, on plugin unload, and when a background
|
|
47
|
+
job settles. Directories a killed host never got to delete are reclaimed on the
|
|
48
|
+
next start, by the pid in their name, so the temp root does not grow one
|
|
49
|
+
directory per shell.
|
|
50
|
+
- Verifies the vendored payload against its SHA256 manifest and publishes a
|
|
51
|
+
verified copy under the DSH home before the tool is registered at all; a
|
|
52
|
+
mismatch refuses the mount, and every shell runs from that copy rather than
|
|
53
|
+
from the package directory.
|
|
46
54
|
- Replaces the host's own `pwsh` tool on the session's model-facing surface
|
|
47
55
|
while `win_bash` is registered, so command work goes to bash instead of to
|
|
48
56
|
the shell a model already knows. See [Which shell to use](#which-shell-to-use).
|
|
@@ -237,6 +245,18 @@ same release's full `Git-2.56.0.2-64-bit.tar.bz2`. Every file is registered in
|
|
|
237
245
|
text ships beside it. [PROVENANCE.md](PROVENANCE.md) records both source URLs and
|
|
238
246
|
digests, the curation rules, the payload inventory and the license mapping.
|
|
239
247
|
|
|
248
|
+
The tree that runs is a copy, not the packaged one. Windows refuses to rename a
|
|
249
|
+
directory that holds a running executable, and pnpm imports a package by
|
|
250
|
+
renaming a staging directory over it, so a shell started inside
|
|
251
|
+
`node_modules/@linxin666/dsh-win-bash` makes every later update or uninstall of
|
|
252
|
+
this package fail with `ERR_PNPM_EPERM` while it runs. The copy is published at
|
|
253
|
+
`<DSH_HOME>/win-bash/runtime/<payload key>`, where the key comes from the
|
|
254
|
+
checksums manifest: a release that changes only JavaScript reuses the copy
|
|
255
|
+
already there, a copy whose bytes disagree with the manifest is rebuilt before
|
|
256
|
+
anything runs, and an isolated `DSH_HOME` gets its own cache. When that copy
|
|
257
|
+
cannot be written, the verified packaged tree runs instead and one warning line
|
|
258
|
+
says so.
|
|
259
|
+
|
|
240
260
|
## Known limitations
|
|
241
261
|
|
|
242
262
|
- Windows x64 only. The payload is a Windows MSYS2 build and the tool refuses
|
|
@@ -251,6 +271,10 @@ digests, the curation rules, the payload inventory and the license mapping.
|
|
|
251
271
|
- A background job is one command in one process: it has no persistent state
|
|
252
272
|
across jobs, and it cannot be promoted from a running foreground call
|
|
253
273
|
(a foreground call that hits `timeoutMs` still stops its shell).
|
|
274
|
+
- The published payload lives under `<DSH_HOME>/win-bash/runtime/`. Each
|
|
275
|
+
distinct payload keeps one directory there, about 16 MiB, and such a
|
|
276
|
+
directory can be deleted while DSH is stopped: the next mount publishes it
|
|
277
|
+
again.
|
|
254
278
|
|
|
255
279
|
## Follow-up work
|
|
256
280
|
|
package/README.zh.md
CHANGED
|
@@ -31,7 +31,12 @@ shell 必须持久,因为 shell 是有状态的:一条命令 `cd` 过、expo
|
|
|
31
31
|
- 可选地把命令作为后台任务放进它自己的钉死 bash 进程,立即返回 job id,
|
|
32
32
|
于是长构建或 watch 既不占住这次调用,也不会随会话 shell 一起死。见
|
|
33
33
|
[后台命令](#后台命令)。
|
|
34
|
-
-
|
|
34
|
+
- 给每个 shell 一份机器 temp 根下的私有目录(`TMPDIR`/`TMP`/`TEMP`),并在该
|
|
35
|
+
shell 结束时删除它——正常 `exit`、超时或中止、会话销毁、插件卸载,以及后台任务
|
|
36
|
+
结算时都在内。宿主被强杀、来不及删除的目录,会在下次启动时按目录名里的 pid 回收,
|
|
37
|
+
因此 temp 根不会每个 shell 攒一个目录。
|
|
38
|
+
- 工具注册之前先按 SHA256 清单校验随包载荷,并把校验过的副本发布到 DSH home
|
|
39
|
+
下;摘要不匹配即拒绝挂载,且每个 shell 都从该副本启动,而不是从包目录启动。
|
|
35
40
|
- `win_bash` 注册期间,把宿主自带的 `pwsh` 工具从会话的模型可见面上替换掉,
|
|
36
41
|
使命令工作落到 bash,而不是落到模型本来就更熟的那个 shell。见
|
|
37
42
|
[该用哪个 shell](#该用哪个-shell)。
|
|
@@ -197,6 +202,14 @@ shell、其 userland 以及精确的 DLL 闭包。同一 release 的两份资产
|
|
|
197
202
|
[PROVENANCE.md](PROVENANCE.md) 记录两份来源资产的 URL 与摘要、裁剪规则、载荷清单与
|
|
198
203
|
许可证对照表。
|
|
199
204
|
|
|
205
|
+
真正运行的是副本,不是包内那棵树。Windows 不允许 rename 一个运行中的可执行文件
|
|
206
|
+
所在的目录,而 pnpm 导入包正是用 rename 把 staging 目录换成目标目录,所以从
|
|
207
|
+
`node_modules/@linxin666/dsh-win-bash` 里起的 shell,会让此后每次更新或卸载本包
|
|
208
|
+
都报 `ERR_PNPM_EPERM`,直到它停下。副本发布在
|
|
209
|
+
`<DSH_HOME>/win-bash/runtime/<载荷键>`,键由 checksums 清单导出:只改 JavaScript
|
|
210
|
+
的发布会复用已有副本,字节与清单不符的副本会在运行之前被重建,独立的 `DSH_HOME`
|
|
211
|
+
得到自己的缓存。副本写不出来时,改由校验过的包内树运行,并有一条警告说明这一点。
|
|
212
|
+
|
|
200
213
|
## 已知限制
|
|
201
214
|
|
|
202
215
|
- 仅支持 Windows x64。载荷是 Windows MSYS2 构建,工具在任何其它平台或架构上都拒绝
|
|
@@ -209,6 +222,8 @@ shell、其 userland 以及精确的 DLL 闭包。同一 release 的两份资产
|
|
|
209
222
|
字节,以及在 provider 留下 spill 文件时完整流在哪里。
|
|
210
223
|
- 后台任务是「一个进程执行一条命令」:任务之间没有持久状态,也不能由正在跑的前台调用
|
|
211
224
|
「升级」而来(前台调用到达 `timeoutMs` 时仍然会停掉它的 shell)。
|
|
225
|
+
- 发布的载荷位于 `<DSH_HOME>/win-bash/runtime/`。每一份不同的载荷在那里保留一个
|
|
226
|
+
目录(约 16 MiB),DSH 停止时可以安全删除它:下一次挂载会重新发布。
|
|
212
227
|
|
|
213
228
|
## 后续工作
|
|
214
229
|
|