@capybara-hq/plugin-device-local 0.1.0-rc.5 → 0.1.0-rc.6
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 +2 -2
- package/README.md +6 -3
- package/dist/index.mjs +22 -8
- package/guides/connect.md +4 -1
- package/guides/connect.zh.md +1 -1
- 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.6",
|
|
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.6",
|
|
27
27
|
"sdk": "^0.1.0-rc.56",
|
|
28
28
|
"provides": [
|
|
29
29
|
"device-provider@1"
|
package/README.md
CHANGED
|
@@ -58,7 +58,9 @@ generation under another runtime identity is refused (`local.invalid_hello`,
|
|
|
58
58
|
- **`report()`** answers from the rows only: a description of the owner's ceiling (project reach
|
|
59
59
|
`machine` / `paths` / `workspace`, always `workspace` in Docker mode; outside the sandbox;
|
|
60
60
|
network) in English and Chinese, the owner's home (OS mode), the machine's own
|
|
61
|
-
narrowing as read-only limits
|
|
61
|
+
narrowing as read-only limits, `reset: false` and `changeHint`: only the computer's owner changes
|
|
62
|
+
the limits, on that computer, with `capybara-device ceiling set -c <device id> …` (the
|
|
63
|
+
connection's real id). Its revision is a hash of everything it is made
|
|
62
64
|
of plus the machine epoch (moved when the machine is revoked or replaced), the instance
|
|
63
65
|
generation, its runtime identity and its stored support; times and connection ids are left out,
|
|
64
66
|
so a reconnect with the same facts keeps it. After a hello or event moved the revision the
|
|
@@ -81,8 +83,9 @@ generation under another runtime identity is refused (`local.invalid_hello`,
|
|
|
81
83
|
- **`permissionSupport()`** answers from the rows only, never a machine round trip: the support the
|
|
82
84
|
machine attested for the installed binding, with outside-the-sandbox and the open public
|
|
83
85
|
internet narrowed to what the owner allows now (no open public internet while the owner's
|
|
84
|
-
network is an allowlist or the owner facts are blocked or missing)
|
|
85
|
-
|
|
86
|
+
network is an allowlist or the owner facts are blocked or missing), and `limitedBy` naming the
|
|
87
|
+
owner for each crossing the machine attested but the owner keeps closed (so the kernel names the
|
|
88
|
+
owner's limit, not the provider's); closed when no binding is installed or no hello is stored.
|
|
86
89
|
|
|
87
90
|
A handle the machine will never serve again (the device's binding is a newer generation, or the
|
|
88
91
|
machine's last hello did not attest it) still reads its installed support, because the kernel
|
package/dist/index.mjs
CHANGED
|
@@ -226,7 +226,10 @@ function describeLocalDevice(c) {
|
|
|
226
226
|
const outside = c.outsideSandbox ? {
|
|
227
227
|
en: "runs outside the sandbox only per approved call",
|
|
228
228
|
zh: "仅在获批的单次调用中在沙箱外运行"
|
|
229
|
-
} : {
|
|
229
|
+
} : {
|
|
230
|
+
en: "the machine's owner keeps every call in the sandbox",
|
|
231
|
+
zh: "本机所有者让每个调用都留在沙箱内"
|
|
232
|
+
};
|
|
230
233
|
return { en: `${reads.en}; ${outside.en}`, zh: `${reads.zh};${outside.zh}` };
|
|
231
234
|
}
|
|
232
235
|
function describe(c, owner) {
|
|
@@ -274,6 +277,13 @@ function limitsOf(c, owner) {
|
|
|
274
277
|
lines.push({ label: SHARED_LABEL, value: sharedRootsValue(c.sharedProjectRoots) });
|
|
275
278
|
return lines;
|
|
276
279
|
}
|
|
280
|
+
function localChangeHint(deviceId) {
|
|
281
|
+
const command = `capybara-device ceiling set -c ${deviceId} --outside-sandbox on|off --network open|allowlist --project-reach machine|paths|workspace`;
|
|
282
|
+
return {
|
|
283
|
+
en: `Only the owner of the computer changes these limits, on that computer: ${command}`,
|
|
284
|
+
zh: `只有这台电脑的所有者能在电脑上更改这些限制:${command}`
|
|
285
|
+
};
|
|
286
|
+
}
|
|
277
287
|
function deviceReportOf(c, b) {
|
|
278
288
|
const revision = revisionOf(c, b);
|
|
279
289
|
if (!c)
|
|
@@ -295,7 +305,8 @@ function deviceReportOf(c, b) {
|
|
|
295
305
|
home: c.mode === "os" ? c.home : null,
|
|
296
306
|
limits: limitsOf(c, owner),
|
|
297
307
|
// the files are the machine owner's directory: the provider never resets them
|
|
298
|
-
reset: false
|
|
308
|
+
reset: false,
|
|
309
|
+
changeHint: localChangeHint(c.deviceId)
|
|
299
310
|
};
|
|
300
311
|
}
|
|
301
312
|
function supportOf(h, c, b) {
|
|
@@ -307,17 +318,20 @@ function supportOf(h, c, b) {
|
|
|
307
318
|
if (!c)
|
|
308
319
|
return closedSupport("The machine has not said hello yet; connect it with capybara-device");
|
|
309
320
|
const owner = ownerFactsOf(c.ownerReport);
|
|
310
|
-
const attested = b.installed.permissionSupport;
|
|
321
|
+
const { limitedBy: _attested, ...attested } = b.installed.permissionSupport;
|
|
322
|
+
const ownerOpen = owner.state === "report" && owner.network === "open";
|
|
323
|
+
const limitedBy = {
|
|
324
|
+
...attested.outsideSandbox && !owner.outsideSandbox && { outsideSandbox: "owner" },
|
|
325
|
+
...attested.network.openPublic && !ownerOpen && { openPublic: "owner" }
|
|
326
|
+
};
|
|
311
327
|
return parseSandboxPermissionSupport({
|
|
312
328
|
...attested,
|
|
313
329
|
// never wider than the owner allows now (a ceiling change since the binding narrows it)
|
|
314
330
|
outsideSandbox: attested.outsideSandbox && owner.outsideSandbox,
|
|
315
331
|
// the open public internet only while the owner's sandbox network is open (an allowlist, or
|
|
316
332
|
// blocked or missing facts, narrow every command's egress on the machine)
|
|
317
|
-
network: {
|
|
318
|
-
|
|
319
|
-
openPublic: attested.network.openPublic && owner.state === "report" && owner.network === "open"
|
|
320
|
-
}
|
|
333
|
+
network: { ...attested.network, openPublic: attested.network.openPublic && ownerOpen },
|
|
334
|
+
...Object.keys(limitedBy).length > 0 && { limitedBy }
|
|
321
335
|
});
|
|
322
336
|
}
|
|
323
337
|
async function reportFor(store, device) {
|
|
@@ -4921,7 +4935,7 @@ function createDeviceLocalProvider(ctx, store, opts = {}) {
|
|
|
4921
4935
|
// src/index.ts
|
|
4922
4936
|
var plugin = defineExtension({
|
|
4923
4937
|
name: "device-local",
|
|
4924
|
-
version: "0.1.0-rc.
|
|
4938
|
+
version: "0.1.0-rc.6",
|
|
4925
4939
|
// ctx.dialIn.capacity and the handlers' connection argument are the rc.56 SDK's
|
|
4926
4940
|
sdk: "^0.1.0-rc.56",
|
|
4927
4941
|
provides: [DEVICE_PROVIDER_EXTENSION_POINT],
|
package/guides/connect.md
CHANGED
|
@@ -46,7 +46,10 @@ and `login` prints the exact next command, id included, at its end.
|
|
|
46
46
|
Commands run in a sandbox on your computer, inside the device's directory
|
|
47
47
|
(`~/capybara-device/<device id>`). You set the owner ceiling on the computer:
|
|
48
48
|
`capybara-device ceiling show -c <device id>` shows it, `capybara-device ceiling set -c <device id>`
|
|
49
|
-
changes it (running outside the sandbox, the network, project reach); each connection has its own.
|
|
49
|
+
changes it (running outside the sandbox, the network, project reach); each connection has its own.
|
|
50
|
+
A new connection allows running outside the sandbox: a call that asks to is approved as the
|
|
51
|
+
conversation's permission profile decides; `--outside-sandbox off` keeps every call in the sandbox.
|
|
52
|
+
The organization's and the platform's settings apply as
|
|
50
53
|
well; the narrowest wins. In OS mode commands run as your user with no CPU or memory limits.
|
|
51
54
|
|
|
52
55
|
Deleting the device revokes the computer's sign-in and stops the program; the files stay on your
|
package/guides/connect.zh.md
CHANGED
|
@@ -28,7 +28,7 @@ capybara-device service install -c <device id>
|
|
|
28
28
|
|
|
29
29
|
## 它能做什么
|
|
30
30
|
|
|
31
|
-
命令在你电脑上的沙箱里运行,位于设备目录(`~/capybara-device/<设备 id>`)内。你在本机设置所有者上限:`capybara-device ceiling show -c <设备 id>` 查看,`capybara-device ceiling set -c <设备 id>`
|
|
31
|
+
命令在你电脑上的沙箱里运行,位于设备目录(`~/capybara-device/<设备 id>`)内。你在本机设置所有者上限:`capybara-device ceiling show -c <设备 id>` 查看,`capybara-device ceiling set -c <设备 id>` 修改(是否允许在沙箱外运行、网络、项目范围),每个连接各有一份。新连接默认允许在沙箱外运行:请求在沙箱外运行的调用按会话的权限模式审批;`--outside-sandbox off` 让每个调用都留在沙箱内。组织和平台的设置同样生效,以最严格的为准。OS 模式下命令以你的用户身份运行,没有 CPU 和内存限制。
|
|
32
32
|
|
|
33
33
|
删除设备会撤销这台电脑的登录并停止程序,文件仍保留在你的电脑上。
|
|
34
34
|
|
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.6",
|
|
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",
|