@capybara-hq/plugin-sandbox-docker 0.1.0-rc.0 → 0.1.0-rc.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.
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "sandbox-docker",
4
- "version": "0.1.0-rc.0",
4
+ "version": "0.1.0-rc.1",
5
5
  "publisher": "Capybara",
6
6
  "description": "Conversation sandboxes (sandbox@1) as Docker containers (runc or gVisor runsc) behind a Docker socket proxy, with an egress allowlist proxy",
7
+ "displayName": {
8
+ "zh": "Docker 沙箱",
9
+ "en": "Docker sandbox"
10
+ },
7
11
  "homepage": "https://github.com/capybara-hq/plugins/tree/main/plugins/sandbox-docker#readme",
8
12
  "extension": {
9
13
  "entry": "./dist/index.mjs",
10
14
  "manifest": {
11
15
  "name": "sandbox-docker",
12
- "version": "0.1.0-rc.0",
16
+ "version": "0.1.0-rc.1",
13
17
  "sdk": "^0.1.0-rc.0",
14
18
  "provides": [
15
19
  "sandbox@1"
@@ -52,6 +56,89 @@
52
56
  ],
53
57
  "org": []
54
58
  }
59
+ },
60
+ "configSchemas": {
61
+ "deployment": {
62
+ "type": "object",
63
+ "properties": {
64
+ "endpoint": {
65
+ "type": "string",
66
+ "pattern": "^(tcp:\\/\\/(\\[[^\\]]+\\]|[^:/]+):\\d{1,5}\\/?|unix:\\/\\/\\/.+)$",
67
+ "x-ui": {
68
+ "label": {
69
+ "zh": "Docker 代理地址",
70
+ "en": "Docker proxy endpoint"
71
+ }
72
+ },
73
+ "title": "Docker proxy endpoint"
74
+ },
75
+ "runtime": {
76
+ "default": "runc",
77
+ "type": "string",
78
+ "enum": [
79
+ "runc",
80
+ "runsc"
81
+ ],
82
+ "x-ui": {
83
+ "label": {
84
+ "zh": "容器运行时",
85
+ "en": "Container runtime"
86
+ }
87
+ },
88
+ "title": "Container runtime"
89
+ },
90
+ "network": {
91
+ "default": "capybara-sandbox",
92
+ "type": "string",
93
+ "pattern": "^cap[a-zA-Z0-9_.-]*$",
94
+ "x-ui": {
95
+ "label": {
96
+ "zh": "沙箱网络",
97
+ "en": "Sandbox network"
98
+ }
99
+ },
100
+ "title": "Sandbox network"
101
+ },
102
+ "egressProxyImage": {
103
+ "default": "capybara-sandbox-egress:latest",
104
+ "type": "string",
105
+ "minLength": 1,
106
+ "x-ui": {
107
+ "label": {
108
+ "zh": "出站代理镜像",
109
+ "en": "Egress proxy image"
110
+ }
111
+ },
112
+ "title": "Egress proxy image"
113
+ },
114
+ "volumeDriver": {
115
+ "type": "string",
116
+ "minLength": 1,
117
+ "x-ui": {
118
+ "label": {
119
+ "zh": "卷驱动",
120
+ "en": "Volume driver"
121
+ }
122
+ },
123
+ "title": "Volume driver"
124
+ },
125
+ "allowOpenEgress": {
126
+ "default": false,
127
+ "type": "boolean",
128
+ "x-ui": {
129
+ "label": {
130
+ "zh": "允许开放出站",
131
+ "en": "Allow open egress"
132
+ }
133
+ },
134
+ "title": "Allow open egress"
135
+ }
136
+ },
137
+ "required": [
138
+ "endpoint"
139
+ ],
140
+ "additionalProperties": false
141
+ }
55
142
  }
56
143
  }
57
144
  }
package/README.md CHANGED
@@ -24,7 +24,7 @@ The deployment config schema is strict: extra keys are errors.
24
24
 
25
25
  - The sandbox image `image/Dockerfile` (shared by the Docker plugin and the E2B template). The tag matches the default of the kernel config `sandbox.image`:
26
26
  `docker build -t capybara-sandbox:latest plugins/sandbox-docker/image`.
27
- Debian trixie-slim (pinned by digest), with bash, coreutils, GNU find / grep (the kernel's `sandbox_glob` / `sandbox_grep`
27
+ Debian trixie-slim (pinned by digest), with bash, coreutils, GNU find / grep (the kernel's `Glob` / `Grep`
28
28
  depend on them), procps, util-linux (`setsid`), curl, git, jq, python3 (with pip / venv) and so on; it runs as the non-root user `sandbox`
29
29
  (uid 1000), with HOME and the working directory at `/workspace`.
30
30
  - The egress proxy image `egress-proxy/Dockerfile`: `docker build -t capybara-sandbox-egress:latest plugins/sandbox-docker/egress-proxy`.
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ const __capybara_filename = __capybaraFileURLToPath(import.meta.url);
6
6
  const __capybara_dirname = __capybaraPathDirname(__capybara_filename);
7
7
 
8
8
  // src/index.ts
9
- import { defineExtension, SANDBOX_EXTENSION_POINT } from "@capybara-hq/plugin-sdk";
9
+ import { defineExtension, SANDBOX_EXTENSION_POINT, ui } from "@capybara-hq/plugin-sdk";
10
10
  import { z } from "zod";
11
11
 
12
12
  // src/provider.ts
@@ -895,31 +895,45 @@ function checkLimits(l) {
895
895
  var NETWORK_NAME = /^cap[a-zA-Z0-9_.-]*$/;
896
896
  var DeploymentConfig = z.object({
897
897
  /** Docker socket 代理地址(docker/sandbox-proxy):`tcp://sandbox-proxy:2375` 或 `unix:///path`。 */
898
- endpoint: z.string().regex(/^(tcp:\/\/(\[[^\]]+\]|[^:/]+):\d{1,5}\/?|unix:\/\/\/.+)$/, {
899
- message: "endpoint must be tcp://host:port or unix:///path"
900
- }),
898
+ endpoint: ui(
899
+ z.string().regex(/^(tcp:\/\/(\[[^\]]+\]|[^:/]+):\d{1,5}\/?|unix:\/\/\/.+)$/, {
900
+ message: "endpoint must be tcp://host:port or unix:///path"
901
+ }),
902
+ { label: { zh: "Docker 代理地址", en: "Docker proxy endpoint" } }
903
+ ),
901
904
  /** 容器运行时:runc(默认)或 gVisor 的 runsc(需在 Docker 守护进程上登记)。 */
902
- runtime: z.enum(["runc", "runsc"]).default("runc"),
905
+ runtime: ui(z.enum(["runc", "runsc"]).default("runc"), {
906
+ label: { zh: "容器运行时", en: "Container runtime" }
907
+ }),
903
908
  /**
904
909
  * 共用的沙箱网络名:egress 为 open 的沙箱与出站代理接在上面;不存在时自动创建(bridge、禁止容器互访)。
905
910
  * 须以 `cap` 开头(socket 代理只放行这样的网络名)。
906
911
  */
907
- network: z.string().regex(NETWORK_NAME, {
908
- message: "network must start with 'cap' (the socket proxy only allows cap* networks)"
909
- }).default("capybara-sandbox"),
912
+ network: ui(
913
+ z.string().regex(NETWORK_NAME, {
914
+ message: "network must start with 'cap' (the socket proxy only allows cap* networks)"
915
+ }).default("capybara-sandbox"),
916
+ { label: { zh: "沙箱网络", en: "Sandbox network" } }
917
+ ),
910
918
  /** 出站代理镜像(plugins/sandbox-docker/egress-proxy/Dockerfile)。 */
911
- egressProxyImage: z.string().min(1).default("capybara-sandbox-egress:latest"),
919
+ egressProxyImage: ui(z.string().min(1).default("capybara-sandbox-egress:latest"), {
920
+ label: { zh: "出站代理镜像", en: "Egress proxy image" }
921
+ }),
912
922
  /** 工作区卷的驱动(支持 `size` 选项的驱动才能限制磁盘);不填用 local(不限大小)。 */
913
- volumeDriver: z.string().min(1).optional(),
923
+ volumeDriver: ui(z.string().min(1).optional(), {
924
+ label: { zh: "卷驱动", en: "Volume driver" }
925
+ }),
914
926
  /**
915
927
  * 允许 `sandbox.limits.egress = "open"`(默认 false)。open 的沙箱能访问宿主机网络能访问的一切
916
928
  * (宿主机上的服务、内网、云元数据地址),只在可信环境打开。
917
929
  */
918
- allowOpenEgress: z.boolean().default(false)
930
+ allowOpenEgress: ui(z.boolean().default(false), {
931
+ label: { zh: "允许开放出站", en: "Allow open egress" }
932
+ })
919
933
  }).strict();
920
934
  var index_default = defineExtension({
921
935
  name: "sandbox-docker",
922
- version: "0.1.0-rc.0",
936
+ version: "0.1.0-rc.1",
923
937
  sdk: "^0.1.0-rc.0",
924
938
  provides: [SANDBOX_EXTENSION_POINT],
925
939
  // 只用部署配置与 Docker endpoint,不用任何需要声明的平台能力
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sandbox-docker",
3
- "version": "0.1.0-rc.0",
3
+ "version": "0.1.0-rc.1",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "Conversation sandboxes (sandbox@1) as Docker containers (runc or gVisor runsc) behind a Docker socket proxy, with an egress allowlist proxy",