@capybara-hq/plugin-device-local 0.1.0-rc.6 → 0.1.0-rc.8
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/.capybara-plugin/plugin.json +3 -4
- package/README.md +4 -1
- package/dist/index.mjs +26 -12
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "device-local",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.8",
|
|
5
5
|
"publisher": "Capybara",
|
|
6
6
|
"description": {
|
|
7
7
|
"en": "Devices on people's own computers: a machine connected with capybara-device serves the device over the dial-in channel, and its owner limits it there",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"entry": "./dist/index.mjs",
|
|
24
24
|
"manifest": {
|
|
25
25
|
"name": "device-local",
|
|
26
|
-
"version": "0.1.0-rc.
|
|
26
|
+
"version": "0.1.0-rc.8",
|
|
27
27
|
"sdk": "^0.1.0-rc.56",
|
|
28
28
|
"provides": [
|
|
29
29
|
"device-provider@1"
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"config": {
|
|
39
|
-
"deployment": []
|
|
40
|
-
"org": []
|
|
39
|
+
"deployment": []
|
|
41
40
|
}
|
|
42
41
|
},
|
|
43
42
|
"migrations": "./migrations"
|
package/README.md
CHANGED
|
@@ -75,7 +75,10 @@ generation under another runtime identity is refused (`local.invalid_hello`,
|
|
|
75
75
|
may do, so a change calls `ctx.devices.reportChanged` once with the revision kept and the kernel
|
|
76
76
|
stores the new text without invalidating approvals. A stale or conflicting `policy` event never
|
|
77
77
|
changes them; an unreadable summary, or an unreadable list in a readable one, keeps them. The
|
|
78
|
-
line fits as many whole directories as it can, skipping one too long, then
|
|
78
|
+
line fits as many whole directories as it can, skipping one too long, then `+N more` (Chinese:
|
|
79
|
+
`;另有 N 个`) for the rest, within the 60-character limit in each language. Every limit value is
|
|
80
|
+
English and Chinese text (`DeviceReportLimit.value` is `DeviceText`); pure numbers carry English
|
|
81
|
+
only.
|
|
79
82
|
- **Refused project paths.** A machine's `project_refused` outcome becomes
|
|
80
83
|
`ProjectPathRefusedError` with the fixed English and Chinese text of its refusal code
|
|
81
84
|
(`other-connection`, `outside-reach`, `denied`; `PROJECT_REFUSAL_TEXT`): the machine is not
|
package/dist/index.mjs
CHANGED
|
@@ -186,8 +186,14 @@ var SHARED_LABEL = {
|
|
|
186
186
|
zh: "本机的另一个连接也在使用"
|
|
187
187
|
};
|
|
188
188
|
function sharedRootsValue(roots) {
|
|
189
|
+
return {
|
|
190
|
+
en: fitRoots(roots, (n) => ` +${n} more`),
|
|
191
|
+
zh: fitRoots(roots, (n) => `;另有 ${n} 个`)
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function fitRoots(roots, more) {
|
|
189
195
|
const max = DEVICE_REPORT_LIMITS.limitValueChars;
|
|
190
|
-
const rest = (n) => n > 0 ?
|
|
196
|
+
const rest = (n) => n > 0 ? more(n) : "";
|
|
191
197
|
const kept = [];
|
|
192
198
|
for (const root of roots) {
|
|
193
199
|
const value = `${[...kept, root].join(", ")}${rest(roots.length - kept.length - 1)}`;
|
|
@@ -198,15 +204,15 @@ function sharedRootsValue(roots) {
|
|
|
198
204
|
(best, r) => best === void 0 || r.length < best.length ? r : best,
|
|
199
205
|
void 0
|
|
200
206
|
);
|
|
201
|
-
const
|
|
207
|
+
const left = rest(roots.length - 1);
|
|
202
208
|
const chars = Array.from(shortest ?? "");
|
|
203
209
|
let tail = "";
|
|
204
210
|
for (let i = chars.length - 1; i >= 0; i--) {
|
|
205
211
|
const next = `${chars[i]}${tail}`;
|
|
206
|
-
if (`…${next}${
|
|
212
|
+
if (`…${next}${left}`.length > max) break;
|
|
207
213
|
tail = next;
|
|
208
214
|
}
|
|
209
|
-
return `…${tail}${
|
|
215
|
+
return `…${tail}${left}`;
|
|
210
216
|
}
|
|
211
217
|
var hosts = (n) => n === 1 ? { en: "1 allowed host", zh: "允许 1 个主机" } : { en: `${n} allowed hosts`, zh: `允许 ${n} 个主机` };
|
|
212
218
|
var effectiveReach = (mode, reach) => mode === "docker" ? "workspace" : reach;
|
|
@@ -251,27 +257,35 @@ function describe(c, owner) {
|
|
|
251
257
|
};
|
|
252
258
|
}
|
|
253
259
|
var REACH_VALUE = {
|
|
254
|
-
machine: "machine",
|
|
255
|
-
paths: "listed directories",
|
|
256
|
-
workspace: "workspace"
|
|
260
|
+
machine: { en: "machine", zh: "整台机器" },
|
|
261
|
+
paths: { en: "listed directories", zh: "列出的目录" },
|
|
262
|
+
workspace: { en: "workspace", zh: "工作区" }
|
|
263
|
+
};
|
|
264
|
+
var MODE_VALUE = {
|
|
265
|
+
os: { en: "os", zh: "本机系统" },
|
|
266
|
+
docker: { en: "docker", zh: "Docker 容器" }
|
|
267
|
+
};
|
|
268
|
+
var NETWORK_VALUE = {
|
|
269
|
+
open: { en: "open", zh: "开放互联网" },
|
|
270
|
+
allowlist: { en: "allowlist", zh: "白名单" }
|
|
257
271
|
};
|
|
258
272
|
function limitsOf(c, owner) {
|
|
259
273
|
const lines = [
|
|
260
|
-
{ label: { en: "Mode", zh: "模式" }, value: c.mode },
|
|
274
|
+
{ label: { en: "Mode", zh: "模式" }, value: MODE_VALUE[c.mode] },
|
|
261
275
|
{
|
|
262
276
|
label: { en: "Outside the sandbox", zh: "沙箱外运行" },
|
|
263
|
-
value: owner.outsideSandbox ? "per approved call" : "off"
|
|
277
|
+
value: owner.outsideSandbox ? { en: "per approved call", zh: "仅限获批的单次调用" } : { en: "off", zh: "关闭" }
|
|
264
278
|
},
|
|
265
279
|
{
|
|
266
280
|
label: { en: "Project reach", zh: "项目范围" },
|
|
267
281
|
value: REACH_VALUE[effectiveReach(c.mode, owner.projectReach)]
|
|
268
282
|
},
|
|
269
|
-
{ label: { en: "Network", zh: "网络" }, value: owner.network }
|
|
283
|
+
{ label: { en: "Network", zh: "网络" }, value: NETWORK_VALUE[owner.network] }
|
|
270
284
|
];
|
|
271
285
|
if (owner.network === "allowlist")
|
|
272
286
|
lines.push({
|
|
273
287
|
label: { en: "Allowed hosts", zh: "允许的主机" },
|
|
274
|
-
value: String(owner.allowedDomains.length)
|
|
288
|
+
value: { en: String(owner.allowedDomains.length) }
|
|
275
289
|
});
|
|
276
290
|
if (c.sharedProjectRoots.length > 0)
|
|
277
291
|
lines.push({ label: SHARED_LABEL, value: sharedRootsValue(c.sharedProjectRoots) });
|
|
@@ -4935,7 +4949,7 @@ function createDeviceLocalProvider(ctx, store, opts = {}) {
|
|
|
4935
4949
|
// src/index.ts
|
|
4936
4950
|
var plugin = defineExtension({
|
|
4937
4951
|
name: "device-local",
|
|
4938
|
-
version: "0.1.0-rc.
|
|
4952
|
+
version: "0.1.0-rc.8",
|
|
4939
4953
|
// ctx.dialIn.capacity and the handlers' connection argument are the rc.56 SDK's
|
|
4940
4954
|
sdk: "^0.1.0-rc.56",
|
|
4941
4955
|
provides: [DEVICE_PROVIDER_EXTENSION_POINT],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/plugin-device-local",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"description": "Devices on people's own computers: a machine connected with capybara-device serves the device over the dial-in channel, and its owner limits it there",
|