@exagone313/dsh-podman 1.0.2 → 1.0.4
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/dist/generated/version.d.ts +2 -2
- package/dist/generated/version.js +2 -2
- package/docs/architecture.md +13 -4
- package/docs/architecture.zh.md +7 -2
- package/docs/development.md +8 -4
- package/docs/development.zh.md +7 -4
- package/package.json +3 -1
- package/dist/approval-reasons.test.d.ts +0 -1
- package/dist/approval-reasons.test.js +0 -143
- package/dist/approval.test.d.ts +0 -1
- package/dist/approval.test.js +0 -593
- package/dist/card-route.test.d.ts +0 -1
- package/dist/card-route.test.js +0 -223
- package/dist/card-test-support.d.ts +0 -15
- package/dist/card-test-support.js +0 -133
- package/dist/container-env.test.d.ts +0 -1
- package/dist/container-env.test.js +0 -93
- package/dist/containers.test.d.ts +0 -1
- package/dist/containers.test.js +0 -621
- package/dist/daemons.test.d.ts +0 -1
- package/dist/daemons.test.js +0 -167
- package/dist/dsh-version.test.d.ts +0 -1
- package/dist/dsh-version.test.js +0 -25
- package/dist/env-rows.test.d.ts +0 -1
- package/dist/env-rows.test.js +0 -43
- package/dist/fs-provider.test.d.ts +0 -1
- package/dist/fs-provider.test.js +0 -301
- package/dist/guest-rpc.test.d.ts +0 -1
- package/dist/guest-rpc.test.js +0 -241
- package/dist/images.test.d.ts +0 -1
- package/dist/images.test.js +0 -86
- package/dist/locales.test.d.ts +0 -1
- package/dist/locales.test.js +0 -34
- package/dist/misc.test.d.ts +0 -1
- package/dist/misc.test.js +0 -169
- package/dist/mounts.test.d.ts +0 -1
- package/dist/mounts.test.js +0 -478
- package/dist/naming.test.d.ts +0 -1
- package/dist/naming.test.js +0 -28
- package/dist/package-deps.test.d.ts +0 -1
- package/dist/package-deps.test.js +0 -49
- package/dist/paths.test.d.ts +0 -1
- package/dist/paths.test.js +0 -76
- package/dist/plugin-meta.test.d.ts +0 -1
- package/dist/plugin-meta.test.js +0 -29
- package/dist/project-path.test.d.ts +0 -1
- package/dist/project-path.test.js +0 -66
- package/dist/read-only-shell.test.d.ts +0 -1
- package/dist/read-only-shell.test.js +0 -182
- package/dist/runtime-client.test.d.ts +0 -1
- package/dist/runtime-client.test.js +0 -53
- package/dist/secrets.test.d.ts +0 -1
- package/dist/secrets.test.js +0 -196
- package/dist/settings-commands.test.d.ts +0 -1
- package/dist/settings-commands.test.js +0 -596
- package/dist/settings-create.test.d.ts +0 -1
- package/dist/settings-create.test.js +0 -416
- package/dist/settings-default-env.test.d.ts +0 -1
- package/dist/settings-default-env.test.js +0 -175
- package/dist/settings-mounts.test.d.ts +0 -1
- package/dist/settings-mounts.test.js +0 -506
- package/dist/settings-paths.test.d.ts +0 -1
- package/dist/settings-paths.test.js +0 -65
- package/dist/settings-schema.test.d.ts +0 -1
- package/dist/settings-schema.test.js +0 -35
- package/dist/settings-workspaces.test.d.ts +0 -1
- package/dist/settings-workspaces.test.js +0 -240
- package/dist/spill-store.test.d.ts +0 -1
- package/dist/spill-store.test.js +0 -82
- package/dist/subprocess.test.d.ts +0 -1
- package/dist/subprocess.test.js +0 -344
- package/dist/terminal-preference.test.d.ts +0 -1
- package/dist/terminal-preference.test.js +0 -62
- package/dist/terminal-route.test.d.ts +0 -1
- package/dist/terminal-route.test.js +0 -265
- package/dist/terminal-tab.test.d.ts +0 -1
- package/dist/terminal-tab.test.js +0 -58
- package/dist/terminal-targets.test.d.ts +0 -1
- package/dist/terminal-targets.test.js +0 -43
- package/dist/terminal-titles.test.d.ts +0 -1
- package/dist/terminal-titles.test.js +0 -36
- package/dist/test-support.d.ts +0 -358
- package/dist/test-support.js +0 -499
- package/dist/version-compat.test.d.ts +0 -1
- package/dist/version-compat.test.js +0 -27
- package/dist/views.test.d.ts +0 -1
- package/dist/views.test.js +0 -23
- package/dist/volumes.test.d.ts +0 -1
- package/dist/volumes.test.js +0 -40
- package/dist/workspace-binding.test.d.ts +0 -1
- package/dist/workspace-binding.test.js +0 -523
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0.
|
|
2
|
-
export declare const GIT_COMMIT = "
|
|
1
|
+
export declare const VERSION = "1.0.4";
|
|
2
|
+
export declare const GIT_COMMIT = "b454b64";
|
package/docs/architecture.md
CHANGED
|
@@ -106,10 +106,12 @@ absolute search root runs from that root: `glob`'s `pattern` then anchors to its
|
|
|
106
106
|
Project mounts must contain no symlink component and are confined to the
|
|
107
107
|
projects root, so a symlink inside a writable project can neither redirect the
|
|
108
108
|
bind mount to a path outside it nor make the path the orchestrator validates
|
|
109
|
-
differ from the path podman mounts.
|
|
110
|
-
|
|
111
|
-
container's agent could otherwise rename a component of the
|
|
112
|
-
symlink before podman resolves it.
|
|
109
|
+
differ from the path podman mounts. Two containers may also not hold nested
|
|
110
|
+
project mounts when the outer one is read-write, whichever was created first:
|
|
111
|
+
the outer container's agent could otherwise rename a component of the inner path
|
|
112
|
+
to a symlink before podman resolves it, on a create or on any later restart. A
|
|
113
|
+
container being replaced is stopped before its mounts are resolved again, so its
|
|
114
|
+
own processes cannot race the create either.
|
|
113
115
|
|
|
114
116
|
## Guest agent and daemons
|
|
115
117
|
|
|
@@ -151,6 +153,13 @@ the read-write mounts forced read-only before running the tool. The harness's
|
|
|
151
153
|
`sandbox_permissions` escalation is granted without prompting for the same
|
|
152
154
|
reason: the widening it asks for has no effect here.
|
|
153
155
|
|
|
156
|
+
Read-only is enforced on the container a tool targets, not on the whole
|
|
157
|
+
workspace. Other containers in the same workspace may still hold read-write
|
|
158
|
+
mounts and run daemons, and a workspace's containers share a pod network
|
|
159
|
+
namespace, so a command that is allowed under read-only can reach a sibling
|
|
160
|
+
container over localhost and have it write. Read-only confines the session's own
|
|
161
|
+
container; it is not a guarantee that nothing in the workspace can be written.
|
|
162
|
+
|
|
154
163
|
Recreating a container or shutting down the orchestrator first asks the
|
|
155
164
|
container's guest agent to gracefully stop its daemons (SIGTERM, ~10s grace)
|
|
156
165
|
before podman tears the container down.
|
package/docs/architecture.zh.md
CHANGED
|
@@ -85,8 +85,9 @@ UUID),因此其容器共享一个网络命名空间。每个工作区都有
|
|
|
85
85
|
项目挂载不得包含任何符号链接组件,并被限制在 projects root
|
|
86
86
|
内,因此可写项目中的符号链接既不能将绑定挂载重定向到其外部的路径,也不能让
|
|
87
87
|
orchestrator 校验的路径与 podman
|
|
88
|
-
|
|
89
|
-
agent 就能在 podman
|
|
88
|
+
实际挂载的路径不一致。两个容器也不能持有嵌套的项目挂载(只要外层挂载是读写的),无论哪个先创建:否则外层容器的
|
|
89
|
+
agent 就能在 podman
|
|
90
|
+
解析之前(创建时或之后任何一次重启时)把内层路径的某个组件改名为符号链接。被替换的容器会先停止,再重新解析其挂载,因此它自己的进程也无法与创建过程竞争。
|
|
90
91
|
|
|
91
92
|
## Guest agent 与守护进程
|
|
92
93
|
|
|
@@ -123,6 +124,10 @@ PATH。
|
|
|
123
124
|
按钮渲染该提示——并在获准后以强制只读的挂载重建容器,再运行该工具。出于同样的原因,harness
|
|
124
125
|
的 `sandbox_permissions` 升权会被直接授予而不询问:它请求的放宽在此处没有效果。
|
|
125
126
|
|
|
127
|
+
只读模式是针对工具所作用的那个容器执行的,而非整个工作区。同一工作区中的其他容器仍可持有读写挂载并运行守护进程,而且工作区内的容器共享一个
|
|
128
|
+
pod 网络命名空间,因此在只读模式下被允许的命令可以通过 localhost
|
|
129
|
+
访问同级容器并让其写入。只读模式只约束会话自身的容器,并不保证工作区内没有任何东西可被写入。
|
|
130
|
+
|
|
126
131
|
重新创建容器或关闭 orchestrator 时,会先要求容器的 guest agent
|
|
127
132
|
优雅地停止其守护进程(SIGTERM,约 10 秒宽限期),然后 podman 才会拆除该容器。
|
|
128
133
|
|
package/docs/development.md
CHANGED
|
@@ -41,6 +41,8 @@ make test-go # go test with the build tags
|
|
|
41
41
|
make test # test-go + pnpm test (JS tests, which run against dist/)
|
|
42
42
|
make fmt # gofmt -s + deno fmt (TypeScript and Markdown)
|
|
43
43
|
make fmt-check # verify the formatting without rewriting anything
|
|
44
|
+
make proto # regenerate the protobuf Go bindings with buf
|
|
45
|
+
make proto-check # buf lint + buf breaking + check the committed bindings are current
|
|
44
46
|
make download-licenses # generate third-party-licenses.pkg from the project and third-party Go licenses
|
|
45
47
|
make image # build the orchestrator, guest-agent and dsh container images
|
|
46
48
|
```
|
|
@@ -60,13 +62,15 @@ have run first (the `test` target handles this).
|
|
|
60
62
|
|
|
61
63
|
The `.proto` sources live in `proto/`; the generated Go bindings in
|
|
62
64
|
`internal/genproto/` are committed. After changing a `.proto`, regenerate them
|
|
63
|
-
with
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
with `make proto`, which runs `buf generate`; Buf must be installed separately —
|
|
66
|
+
pin it with `go install github.com/bufbuild/buf/cmd/buf@v1.73.0`. Commit the
|
|
67
|
+
`.proto` change together with the regenerated Go bindings.
|
|
66
68
|
|
|
67
69
|
The JS side loads the raw `.proto` files at runtime via `@grpc/proto-loader`
|
|
68
70
|
(copied to `dist/grpc/proto/` at build time); no TypeScript bindings are
|
|
69
|
-
generated.
|
|
71
|
+
generated. `make proto-check`, which CI runs, lints the schema, runs
|
|
72
|
+
`buf breaking` against the latest release tag, and fails when the committed
|
|
73
|
+
bindings differ from the regenerated ones.
|
|
70
74
|
|
|
71
75
|
## Naming
|
|
72
76
|
|
package/docs/development.zh.md
CHANGED
|
@@ -41,6 +41,8 @@ make test-go # go test with the build tags
|
|
|
41
41
|
make test # test-go + pnpm test (JS tests, which run against dist/)
|
|
42
42
|
make fmt # gofmt -s + deno fmt (TypeScript and Markdown)
|
|
43
43
|
make fmt-check # verify the formatting without rewriting anything
|
|
44
|
+
make proto # regenerate the protobuf Go bindings with buf
|
|
45
|
+
make proto-check # buf lint + buf breaking + check the committed bindings are current
|
|
44
46
|
make download-licenses # generate third-party-licenses.pkg from the project and third-party Go licenses
|
|
45
47
|
make image # build the orchestrator, guest-agent and dsh container images
|
|
46
48
|
```
|
|
@@ -59,14 +61,15 @@ orchestrator 和 guest-agent 镜像,位于
|
|
|
59
61
|
## Protobuf
|
|
60
62
|
|
|
61
63
|
`.proto` 源文件位于 `proto/`;生成的 Go 绑定位于
|
|
62
|
-
`internal/genproto/`,会被提交。修改 `.proto`
|
|
63
|
-
|
|
64
|
+
`internal/genproto/`,会被提交。修改 `.proto` 后,请用 `make proto`(即运行
|
|
65
|
+
`buf generate`)重新生成。Buf 需单独安装——请用
|
|
64
66
|
`go install github.com/bufbuild/buf/cmd/buf@v1.73.0` 固定版本。请将 `.proto`
|
|
65
67
|
改动与重新生成的 Go 绑定一起提交。
|
|
66
68
|
|
|
67
69
|
JS 端在运行时通过 `@grpc/proto-loader` 加载原始 `.proto` 文件(构建时复制到
|
|
68
|
-
`dist/grpc/proto/`);不生成 TypeScript
|
|
69
|
-
|
|
70
|
+
`dist/grpc/proto/`);不生成 TypeScript 绑定。CI 运行的 `make proto-check`
|
|
71
|
+
会校验 schema、针对最新发布标签运行
|
|
72
|
+
`buf breaking`,若已提交的绑定与重新生成的结果不一致则失败。
|
|
70
73
|
|
|
71
74
|
## 命名
|
|
72
75
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exagone313/dsh-podman",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Podman-backed execution for DeepSeek Harness (dsh).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
40
|
+
"!dist/**/*.test.*",
|
|
41
|
+
"!dist/**/*test-support.*",
|
|
40
42
|
"docs",
|
|
41
43
|
"locale/*.json",
|
|
42
44
|
"quadlet",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
// SPDX-FileCopyrightText: 2026 Elouan Martinet <exa@elou.world>
|
|
2
|
-
//
|
|
3
|
-
// SPDX-License-Identifier: MIT
|
|
4
|
-
import test from "node:test";
|
|
5
|
-
import assert from "node:assert/strict";
|
|
6
|
-
import { reasonLocale, renderCacheCleanNotice, renderDefaultEnvSyncNotice, renderDenial, renderReason, resolveReasonLocale, } from "./approval-reasons.js";
|
|
7
|
-
import { preExecutePolicy, summarizeArgs } from "./index.js";
|
|
8
|
-
import { testReadSession } from "./test-support.js";
|
|
9
|
-
test("reasonLocale normalizes a locale id to a shipped language", () => {
|
|
10
|
-
assert.equal(reasonLocale("zh"), "zh");
|
|
11
|
-
assert.equal(reasonLocale("zh-Hans"), "zh");
|
|
12
|
-
assert.equal(reasonLocale("zh_CN"), "zh");
|
|
13
|
-
assert.equal(reasonLocale("ZH"), "zh");
|
|
14
|
-
assert.equal(reasonLocale("en-US"), "en");
|
|
15
|
-
assert.equal(reasonLocale("fr"), "en");
|
|
16
|
-
assert.equal(reasonLocale(undefined), "en");
|
|
17
|
-
assert.equal(reasonLocale(42), "en");
|
|
18
|
-
});
|
|
19
|
-
test("resolveReasonLocale reads the plugin's recorded locale", () => {
|
|
20
|
-
assert.equal(resolveReasonLocale(undefined), "en");
|
|
21
|
-
assert.equal(resolveReasonLocale(""), "en");
|
|
22
|
-
assert.equal(resolveReasonLocale("zh"), "zh");
|
|
23
|
-
assert.equal(resolveReasonLocale("zh-Hans"), "zh");
|
|
24
|
-
assert.equal(resolveReasonLocale("en"), "en");
|
|
25
|
-
assert.equal(resolveReasonLocale(42), "en");
|
|
26
|
-
});
|
|
27
|
-
test("summarizeArgs renders reasons in Chinese when asked", () => {
|
|
28
|
-
assert.equal(summarizeArgs("container_mount_add", {
|
|
29
|
-
container: "web",
|
|
30
|
-
kind: "volume",
|
|
31
|
-
volume: "valkey-data",
|
|
32
|
-
destination: "/data",
|
|
33
|
-
mode: "read_only",
|
|
34
|
-
}, undefined, "zh"), "在容器 “web” 中添加挂载:卷 “valkey-data” 挂载到 “/data”(只读)。");
|
|
35
|
-
assert.equal(summarizeArgs("container_start", {
|
|
36
|
-
container: "web",
|
|
37
|
-
image: "img",
|
|
38
|
-
mounts: [{ project: "team", mode: "read_only" }],
|
|
39
|
-
env: { A: "1" },
|
|
40
|
-
}, undefined, "zh"), "启动容器 “web”(镜像 “img”),挂载:项目 “team”(只读),环境变量:A。");
|
|
41
|
-
});
|
|
42
|
-
test("renderDenial renders both languages", () => {
|
|
43
|
-
assert.equal(renderDenial("en", { kind: "read_only", tool: "container_start" }), 'Denied: the session is read-only, but "container_start" needs write access.');
|
|
44
|
-
assert.equal(renderDenial("zh", { kind: "read_only", tool: "container_start" }), "已拒绝:当前会话为只读,而 “container_start” 需要写入权限。");
|
|
45
|
-
assert.equal(renderDenial("zh", {
|
|
46
|
-
kind: "project_destination",
|
|
47
|
-
source: "team/src",
|
|
48
|
-
mirror: "/projects/team/src",
|
|
49
|
-
}), "项目挂载不能指定目标路径;“team/src” 始终挂载到 “/projects/team/src”。");
|
|
50
|
-
assert.equal(renderDenial("zh", { kind: "project_destination" }), "项目挂载不能指定目标路径。");
|
|
51
|
-
assert.equal(renderDenial("en", { kind: "project_destination", mirror: "/projects" }), 'Project mounts cannot set a destination; the project always mounts at "/projects".');
|
|
52
|
-
assert.equal(renderDenial("zh", { kind: "project_destination", mirror: "/projects" }), "项目挂载不能指定目标路径;该项目 始终挂载到 “/projects”。");
|
|
53
|
-
});
|
|
54
|
-
test("renderReason covers the remaining reason kinds in both languages", () => {
|
|
55
|
-
assert.equal(renderReason("en", { kind: "image_rebuild_all" }), "Rebuild all images.");
|
|
56
|
-
assert.equal(renderReason("zh", { kind: "image_rebuild_all" }), "重建全部镜像。");
|
|
57
|
-
assert.equal(renderReason("zh", {
|
|
58
|
-
kind: "daemon_start",
|
|
59
|
-
container: "c",
|
|
60
|
-
argv: ["x"],
|
|
61
|
-
uid: 1,
|
|
62
|
-
}), "在容器 “c” 中启动守护进程:x(uid 1)");
|
|
63
|
-
assert.equal(renderReason("zh", {
|
|
64
|
-
kind: "container_bash",
|
|
65
|
-
container: "c",
|
|
66
|
-
command: "id",
|
|
67
|
-
uid: 1,
|
|
68
|
-
groups: [3, 4],
|
|
69
|
-
}), "在容器 “c” 中运行 shell 命令:id(uid 1、groups 3、4)");
|
|
70
|
-
assert.equal(renderReason("zh", {
|
|
71
|
-
kind: "container_secret_add",
|
|
72
|
-
container: "c",
|
|
73
|
-
secret: "s",
|
|
74
|
-
env: "E",
|
|
75
|
-
}), "将机密 “s” 作为 “E” 注入容器 “c”。");
|
|
76
|
-
assert.equal(renderReason("zh", {
|
|
77
|
-
kind: "container_mount_update",
|
|
78
|
-
container: "valkey-ctr",
|
|
79
|
-
mount: {
|
|
80
|
-
kind: "volume",
|
|
81
|
-
source: "valkey-data",
|
|
82
|
-
destination: "/data",
|
|
83
|
-
readOnly: false,
|
|
84
|
-
},
|
|
85
|
-
}), "更新容器 “valkey-ctr” 中的挂载:将卷 “valkey-data”(挂载到 “/data”)重新挂载为读写。");
|
|
86
|
-
assert.equal(renderReason("zh", {
|
|
87
|
-
kind: "container_mount_update",
|
|
88
|
-
container: "web",
|
|
89
|
-
mount: { kind: "project", source: "team", readOnly: true },
|
|
90
|
-
}), "更新容器 “web” 中的挂载:将项目 “team” 重新挂载为只读。");
|
|
91
|
-
});
|
|
92
|
-
test("renderCacheCleanNotice reports the removed file count", () => {
|
|
93
|
-
assert.equal(renderCacheCleanNotice("en", 1), "removed 1 cached file");
|
|
94
|
-
assert.equal(renderCacheCleanNotice("en", 3), "removed 3 cached files");
|
|
95
|
-
assert.equal(renderCacheCleanNotice("zh", 3), "已移除 3 个缓存文件");
|
|
96
|
-
});
|
|
97
|
-
test("renderReason renders the read-only remount plan", () => {
|
|
98
|
-
assert.equal(renderReason("en", {
|
|
99
|
-
kind: "read_only_remount",
|
|
100
|
-
tool: "bash",
|
|
101
|
-
remount: [
|
|
102
|
-
{ kind: "project", source: "team", readOnly: false },
|
|
103
|
-
{
|
|
104
|
-
kind: "volume",
|
|
105
|
-
source: "data",
|
|
106
|
-
destination: "/data",
|
|
107
|
-
readOnly: false,
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
keep: [{ kind: "tmpfs", source: "", destination: "/scratch" }],
|
|
111
|
-
}), 'Read-only mode blocks "bash" while a mount is read-write. Remount these mounts read-only to run it:\n\n- project "team" (read-write)\n- volume "data" at "/data" (read-write)\n\nKept as-is: tmpfs at "/scratch".');
|
|
112
|
-
assert.equal(renderReason("zh", {
|
|
113
|
-
kind: "read_only_remount",
|
|
114
|
-
tool: "bash",
|
|
115
|
-
remount: [{ kind: "project", source: "team", readOnly: false }],
|
|
116
|
-
keep: [],
|
|
117
|
-
}), "只读模式在存在读写挂载时会阻止 “bash”。将这些挂载重新挂载为只读即可运行:\n\n- 项目 “team”(读写)");
|
|
118
|
-
});
|
|
119
|
-
test("renderDenial renders the declined remount", () => {
|
|
120
|
-
assert.equal(renderDenial("en", { kind: "read_only_remount_declined", tool: "bash" }), 'Denied: read-only mode blocks "bash" and the mounts were not remounted.');
|
|
121
|
-
assert.equal(renderDenial("zh", { kind: "read_only_remount_declined", tool: "bash" }), "已拒绝:只读模式阻止 “bash”,且挂载未被重新挂载。");
|
|
122
|
-
});
|
|
123
|
-
test("renderDefaultEnvSyncNotice renders both languages", () => {
|
|
124
|
-
assert.equal(renderDefaultEnvSyncNotice("en", 2, 0), "applied the default environment to 2 containers");
|
|
125
|
-
assert.equal(renderDefaultEnvSyncNotice("en", 1, 2), "applied the default environment to 1 container; 2 containers stopped, to pick up on their next start");
|
|
126
|
-
assert.equal(renderDefaultEnvSyncNotice("en", 0, 1), "no running container needed the default environment; 1 container stopped");
|
|
127
|
-
assert.equal(renderDefaultEnvSyncNotice("en", 0, 0), "the default environment is already applied to every running container");
|
|
128
|
-
assert.equal(renderDefaultEnvSyncNotice("zh", 2, 0), "已将默认环境应用于 2 个容器");
|
|
129
|
-
assert.equal(renderDefaultEnvSyncNotice("zh", 0, 1), "没有运行中的容器需要默认环境;已跳过 1 个容器");
|
|
130
|
-
});
|
|
131
|
-
test("preExecutePolicy renders a localized deny reason", async () => {
|
|
132
|
-
const denied = (await preExecutePolicy({
|
|
133
|
-
name: "container_start",
|
|
134
|
-
agent: { session: { facts: { mode: "read-only" } } },
|
|
135
|
-
}, () => Promise.resolve({ kind: "allow" }), undefined, () => "zh", testReadSession));
|
|
136
|
-
assert.equal(denied.kind, "deny");
|
|
137
|
-
assert.equal(denied.reason, "已拒绝:当前会话为只读,而 “container_start” 需要写入权限。");
|
|
138
|
-
});
|
|
139
|
-
test("preExecutePolicy renders a localized deny reason for a built-in tool", async () => {
|
|
140
|
-
const denied = (await preExecutePolicy({ name: "bash", agent: { session: { facts: { mode: "read-only" } } } }, () => Promise.resolve({ kind: "allow" }), undefined, () => "zh", testReadSession));
|
|
141
|
-
assert.equal(denied.kind, "deny");
|
|
142
|
-
assert.equal(denied.reason, "已拒绝:当前会话为只读,而 “bash” 可能修改文件。");
|
|
143
|
-
});
|
package/dist/approval.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|