@linxin666/dsh-win-bash 0.4.16 → 0.4.18
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/lib/index.js +7 -7
- package/package.json +7 -7
- package/src/config.ts +1 -1
- package/src/pwsh-replacement.ts +2 -2
- package/src/tool.ts +2 -2
package/lib/index.js
CHANGED
|
@@ -1689,7 +1689,7 @@ const CONFIG_DEFAULTS = {
|
|
|
1689
1689
|
function resolveConfig(input) {
|
|
1690
1690
|
const resolved = {
|
|
1691
1691
|
...CONFIG_DEFAULTS,
|
|
1692
|
-
...input
|
|
1692
|
+
...input
|
|
1693
1693
|
};
|
|
1694
1694
|
const violations = validateConfig(resolved);
|
|
1695
1695
|
if (violations.length > 0) throw new Error("win_bash config rejected: " + violations.map((v) => v.field + ": " + v.message).join("; "));
|
|
@@ -1919,11 +1919,11 @@ const HOST_PWSH_TOOL = "pwsh";
|
|
|
1919
1919
|
/** The one session mode win_bash can actually serve; every other mode refuses. */
|
|
1920
1920
|
const SERVING_MODE = "danger-full-access";
|
|
1921
1921
|
/** Every mode the policy service may answer with. */
|
|
1922
|
-
const SANDBOX_MODES$1 = [
|
|
1922
|
+
const SANDBOX_MODES$1 = /* @__PURE__ */ new Set([
|
|
1923
1923
|
"read-only",
|
|
1924
1924
|
"workspace-write",
|
|
1925
1925
|
"danger-full-access"
|
|
1926
|
-
];
|
|
1926
|
+
]);
|
|
1927
1927
|
/** The message of a thrown value, whatever it is. */
|
|
1928
1928
|
function messageOf$1(error) {
|
|
1929
1929
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -1981,7 +1981,7 @@ function servingVerdict(read, session) {
|
|
|
1981
1981
|
if (typeof cwd !== "string" || cwd === "") return "refuses";
|
|
1982
1982
|
try {
|
|
1983
1983
|
const mode = read.resolve({ session })?.mode;
|
|
1984
|
-
if (!SANDBOX_MODES$1.
|
|
1984
|
+
if (!SANDBOX_MODES$1.has(mode)) return "unknown";
|
|
1985
1985
|
return mode === "danger-full-access" ? "serves" : "refuses";
|
|
1986
1986
|
} catch {
|
|
1987
1987
|
return "unknown";
|
|
@@ -2902,11 +2902,11 @@ const BACKGROUND_STDERR_BYTES = SHELL_STDERR_CAPTURE_BYTES;
|
|
|
2902
2902
|
/** The registered tool name. Deliberately not bash. */
|
|
2903
2903
|
const WIN_BASH_TOOL = "win_bash";
|
|
2904
2904
|
/** Every sandbox mode a session may run under. */
|
|
2905
|
-
const SANDBOX_MODES = [
|
|
2905
|
+
const SANDBOX_MODES = /* @__PURE__ */ new Set([
|
|
2906
2906
|
"read-only",
|
|
2907
2907
|
"workspace-write",
|
|
2908
2908
|
"danger-full-access"
|
|
2909
|
-
];
|
|
2909
|
+
]);
|
|
2910
2910
|
/** The only mode this tool runs under; every other mode is refused. */
|
|
2911
2911
|
const SUPPORTED_MODE = "danger-full-access";
|
|
2912
2912
|
/**
|
|
@@ -3114,7 +3114,7 @@ function resolvePolicy(ctx, agent) {
|
|
|
3114
3114
|
if (service === void 0 || typeof service.resolve !== "function") return void 0;
|
|
3115
3115
|
const session = agent?.session;
|
|
3116
3116
|
const policy = service.resolve(session === void 0 ? {} : { session });
|
|
3117
|
-
if (!SANDBOX_MODES.
|
|
3117
|
+
if (!SANDBOX_MODES.has(policy.mode) || typeof policy.workspaceRoot !== "string") throw new Error("win_bash: the sandbox policy service returned an invalid policy; no command was started.");
|
|
3118
3118
|
return policy;
|
|
3119
3119
|
}
|
|
3120
3120
|
/**
|
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.18",
|
|
5
5
|
"icon": "icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -18,21 +18,21 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dsh": {
|
|
20
20
|
"engines": {
|
|
21
|
-
"dsh": ">=0.2.2-rc.
|
|
21
|
+
"dsh": ">=0.2.2-rc.2"
|
|
22
22
|
},
|
|
23
23
|
"bundle": {
|
|
24
24
|
"patch": "./cordis.patch.yml"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@deepseek-ai/dsh": ">=0.2.2-rc.
|
|
28
|
+
"@deepseek-ai/dsh": ">=0.2.2-rc.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@deepseek-ai/cordis": "^4.1.0",
|
|
32
|
-
"@deepseek-ai/dsh-agent": "^0.2.2-rc.
|
|
33
|
-
"@deepseek-ai/dsh-sandbox": "^0.2.2-rc.
|
|
34
|
-
"@deepseek-ai/dsh-subprocess": "^0.2.2-rc.
|
|
35
|
-
"@deepseek-ai/dsh-tools": "^0.2.2-rc.
|
|
32
|
+
"@deepseek-ai/dsh-agent": "^0.2.2-rc.2",
|
|
33
|
+
"@deepseek-ai/dsh-sandbox": "^0.2.2-rc.2",
|
|
34
|
+
"@deepseek-ai/dsh-subprocess": "^0.2.2-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-tools": "^0.2.2-rc.2",
|
|
36
36
|
"@deepseek-ai/schemastery": "^3.19.0",
|
|
37
37
|
"@types/node": "^22.20.0",
|
|
38
38
|
"tsdown": "0.22.2",
|
package/src/config.ts
CHANGED
|
@@ -166,7 +166,7 @@ export interface ConfigViolation {
|
|
|
166
166
|
* @throws when a supplied value is outside its contract.
|
|
167
167
|
*/
|
|
168
168
|
export function resolveConfig(input: WinBashConfigInput | undefined): WinBashConfig {
|
|
169
|
-
const resolved: WinBashConfig = { ...CONFIG_DEFAULTS, ...
|
|
169
|
+
const resolved: WinBashConfig = { ...CONFIG_DEFAULTS, ...input }
|
|
170
170
|
const violations = validateConfig(resolved)
|
|
171
171
|
if (violations.length > 0) {
|
|
172
172
|
throw new Error(
|
package/src/pwsh-replacement.ts
CHANGED
|
@@ -82,7 +82,7 @@ export const HOST_PWSH_TOOL = 'pwsh'
|
|
|
82
82
|
export const SERVING_MODE: SandboxMode = 'danger-full-access'
|
|
83
83
|
|
|
84
84
|
/** Every mode the policy service may answer with. */
|
|
85
|
-
const SANDBOX_MODES:
|
|
85
|
+
const SANDBOX_MODES: ReadonlySet<SandboxMode> = new Set(['read-only', 'workspace-write', 'danger-full-access'])
|
|
86
86
|
|
|
87
87
|
/** The scoped restriction call this module consumes from an agent's tools view. */
|
|
88
88
|
export interface ScopedRestrictor {
|
|
@@ -216,7 +216,7 @@ function servingVerdict(read: SessionPolicyReader | undefined, session: unknown)
|
|
|
216
216
|
if (typeof cwd !== 'string' || cwd === '') return 'refuses'
|
|
217
217
|
try {
|
|
218
218
|
const mode = read.resolve({ session })?.mode
|
|
219
|
-
if (!SANDBOX_MODES.
|
|
219
|
+
if (!SANDBOX_MODES.has(mode)) return 'unknown'
|
|
220
220
|
return mode === SERVING_MODE ? 'serves' : 'refuses'
|
|
221
221
|
} catch {
|
|
222
222
|
return 'unknown'
|
package/src/tool.ts
CHANGED
|
@@ -26,7 +26,7 @@ import { shellArgv, shellEnvironment, shellTempDir, type ShellRegistry } from '.
|
|
|
26
26
|
export const WIN_BASH_TOOL = 'win_bash'
|
|
27
27
|
|
|
28
28
|
/** Every sandbox mode a session may run under. */
|
|
29
|
-
const SANDBOX_MODES:
|
|
29
|
+
const SANDBOX_MODES: ReadonlySet<SandboxMode> = new Set(['read-only', 'workspace-write', 'danger-full-access'])
|
|
30
30
|
|
|
31
31
|
/** The only mode this tool runs under; every other mode is refused. */
|
|
32
32
|
const SUPPORTED_MODE: SandboxMode = 'danger-full-access'
|
|
@@ -299,7 +299,7 @@ function resolvePolicy(ctx: Context, agent: unknown): SandboxExecutionPolicy | u
|
|
|
299
299
|
if (service === undefined || typeof service.resolve !== 'function') return undefined
|
|
300
300
|
const session = (agent as { session?: unknown } | undefined)?.session
|
|
301
301
|
const policy = service.resolve(session === undefined ? {} : { session })
|
|
302
|
-
if (!SANDBOX_MODES.
|
|
302
|
+
if (!SANDBOX_MODES.has(policy.mode) || typeof policy.workspaceRoot !== 'string') {
|
|
303
303
|
throw new Error('win_bash: the sandbox policy service returned an invalid policy; no command was started.')
|
|
304
304
|
}
|
|
305
305
|
return policy
|