@linxin666/dsh-win-bash 0.4.15 → 0.4.16
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 -0
- package/README.zh.md +1 -0
- package/lib/index.js +2 -1
- package/lib/types/shell.d.ts +1 -1
- package/package.json +1 -1
- package/src/shell.ts +5 -2
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: 0ecbceaea0a26781ee3b0340d8c55ee0aec4b61e
|
|
6
|
+
README.zh.md: b0124801c815f6ca3520bba370cf8a63e0621801
|
package/README.md
CHANGED
|
@@ -47,6 +47,7 @@ session is what makes that true.
|
|
|
47
47
|
job settles. Directories a killed host never got to delete are reclaimed on the
|
|
48
48
|
next start, by the pid in their name, so the temp root does not grow one
|
|
49
49
|
directory per shell.
|
|
50
|
+
- Supplies every shell with an explicit `HOME`: an existing host value is preserved, otherwise Node's Unicode user-home path is used so a non-ASCII Windows profile does not pass through MSYS's ANSI inference.
|
|
50
51
|
- Verifies the vendored payload against its SHA256 manifest and publishes a
|
|
51
52
|
verified copy under the DSH home before the tool is registered at all; a
|
|
52
53
|
mismatch refuses the mount, and every shell runs from that copy rather than
|
package/README.zh.md
CHANGED
|
@@ -35,6 +35,7 @@ shell 必须持久,因为 shell 是有状态的:一条命令 `cd` 过、expo
|
|
|
35
35
|
shell 结束时删除它——正常 `exit`、超时或中止、会话销毁、插件卸载,以及后台任务
|
|
36
36
|
结算时都在内。宿主被强杀、来不及删除的目录,会在下次启动时按目录名里的 pid 回收,
|
|
37
37
|
因此 temp 根不会每个 shell 攒一个目录。
|
|
38
|
+
- 为每个 shell 显式提供 `HOME`:保留宿主已有值,缺失时使用 Node 返回的 Unicode 用户目录,避免非 ASCII Windows 用户目录经过 MSYS 的 ANSI 推导而损坏。
|
|
38
39
|
- 工具注册之前先按 SHA256 清单校验随包载荷,并把校验过的副本发布到 DSH home
|
|
39
40
|
下;摘要不匹配即拒绝挂载,且每个 shell 都从该副本启动,而不是从包目录启动。
|
|
40
41
|
- `win_bash` 注册期间,把宿主自带的 `pwsh` 工具从会话的模型可见面上替换掉,
|
package/lib/index.js
CHANGED
|
@@ -1056,11 +1056,12 @@ function shellArgv(runtime) {
|
|
|
1056
1056
|
* The environment contract every pinned shell starts with.
|
|
1057
1057
|
* @param runtime - the verified payload paths.
|
|
1058
1058
|
* @param temp - the private temp directory that shell owns.
|
|
1059
|
-
* @param base - the ambient environment
|
|
1059
|
+
* @param base - the ambient environment whose PATH and HOME are inherited.
|
|
1060
1060
|
* @returns the entries this tool sets explicitly.
|
|
1061
1061
|
*/
|
|
1062
1062
|
function shellEnvironment(runtime, temp, base = process.env) {
|
|
1063
1063
|
return {
|
|
1064
|
+
HOME: base.HOME ?? homedir(),
|
|
1064
1065
|
PATH: runtime.bin + (process.platform === "win32" ? ";" : ":") + (base.PATH ?? ""),
|
|
1065
1066
|
TMPDIR: temp,
|
|
1066
1067
|
TMP: temp,
|
package/lib/types/shell.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export declare function shellArgv(runtime: {
|
|
|
55
55
|
* The environment contract every pinned shell starts with.
|
|
56
56
|
* @param runtime - the verified payload paths.
|
|
57
57
|
* @param temp - the private temp directory that shell owns.
|
|
58
|
-
* @param base - the ambient environment
|
|
58
|
+
* @param base - the ambient environment whose PATH and HOME are inherited.
|
|
59
59
|
* @returns the entries this tool sets explicitly.
|
|
60
60
|
*/
|
|
61
61
|
export declare function shellEnvironment(runtime: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-win-bash",
|
|
3
3
|
"description": "Pinned private bash for Windows x64 DSH sessions: one persistent bash process per session behind the win_bash tool, carrying a digested Git for Windows MinGit payload and no PATH fallback.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.16",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|
package/src/shell.ts
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import { randomUUID } from 'node:crypto'
|
|
21
21
|
import { mkdirSync, readdirSync, type Dirent } from 'node:fs'
|
|
22
22
|
import { rm } from 'node:fs/promises'
|
|
23
|
-
import { tmpdir } from 'node:os'
|
|
23
|
+
import { homedir, tmpdir } from 'node:os'
|
|
24
24
|
import { join } from 'node:path'
|
|
25
25
|
import type { SubprocessHandle, SubprocessRuntime } from '@deepseek-ai/dsh-subprocess'
|
|
26
26
|
import { buildFrame, markerFor, parseFrame, type FrameMarker, type FrameOutcome } from './protocol.ts'
|
|
@@ -85,7 +85,7 @@ export function shellArgv(runtime: { bash: string }): string[] {
|
|
|
85
85
|
* The environment contract every pinned shell starts with.
|
|
86
86
|
* @param runtime - the verified payload paths.
|
|
87
87
|
* @param temp - the private temp directory that shell owns.
|
|
88
|
-
* @param base - the ambient environment
|
|
88
|
+
* @param base - the ambient environment whose PATH and HOME are inherited.
|
|
89
89
|
* @returns the entries this tool sets explicitly.
|
|
90
90
|
*/
|
|
91
91
|
export function shellEnvironment(
|
|
@@ -94,6 +94,9 @@ export function shellEnvironment(
|
|
|
94
94
|
base: NodeJS.ProcessEnv = process.env,
|
|
95
95
|
): NodeJS.ProcessEnv {
|
|
96
96
|
return {
|
|
97
|
+
// MSYS derives a missing HOME from USERPROFILE through the active ANSI
|
|
98
|
+
// code page, which corrupts non-ASCII profiles. Supply Node's Unicode path.
|
|
99
|
+
HOME: base.HOME ?? homedir(),
|
|
97
100
|
// The vendored usr/bin goes FIRST on PATH: the payload's own userland
|
|
98
101
|
// is what commands resolve to, and no host Git for Windows, WSL or
|
|
99
102
|
// per-user shim later in the inherited PATH can shadow it.
|