@capybara-hq/plugin-device-local 0.0.0-stage → 0.1.0-rc.0
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 +45 -0
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +104 -2
- package/THIRD-PARTY-NOTICES.txt +26 -0
- package/dist/index.mjs +4881 -0
- package/guides/connect.md +51 -0
- package/guides/connect.zh.md +38 -0
- package/icon.svg +1 -0
- package/migrations/0001_init.sql +40 -0
- package/package.json +19 -4
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Connect this machine
|
|
2
|
+
|
|
3
|
+
::shell-action connect-this-machine Connect this machine
|
|
4
|
+
|
|
5
|
+
A device on your own computer: the computer connects to the platform with the `capybara-device`
|
|
6
|
+
program and serves the device, and you limit what it may do there. In the desktop app, the button
|
|
7
|
+
above connects the computer it runs on. Anywhere else, run these steps in a terminal on the
|
|
8
|
+
computer you want to connect (macOS or Linux, Node 22.12 or newer; on Windows use WSL).
|
|
9
|
+
|
|
10
|
+
## 1. Install the program
|
|
11
|
+
|
|
12
|
+
```bash title="Install capybara-device"
|
|
13
|
+
npm install -g @capybara-hq/device@next
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 2. Sign in
|
|
17
|
+
|
|
18
|
+
```bash title="Sign in to this platform"
|
|
19
|
+
capybara-device login --url {{publicUrl}}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The command opens a page in your browser (with `--no-browser` it prints the address and a code to
|
|
23
|
+
enter on any signed-in browser). There, pick the organization, choose **This machine** and a new
|
|
24
|
+
device, or one of your connected devices to move it to this computer. Signing in again from
|
|
25
|
+
another computer into the same device replaces the first one.
|
|
26
|
+
|
|
27
|
+
## 3. Keep it online
|
|
28
|
+
|
|
29
|
+
```bash title="Connect at login (recommended)"
|
|
30
|
+
capybara-device service install
|
|
31
|
+
capybara-device service start
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or run `capybara-device start` to connect in the foreground until you stop it. The device shows as
|
|
35
|
+
online once the program is connected; while it is offline, agents cannot use it.
|
|
36
|
+
|
|
37
|
+
## What it may do
|
|
38
|
+
|
|
39
|
+
Commands run in a sandbox on your computer, inside the device's directory
|
|
40
|
+
(`~/capybara-device/<device id>`). You set the owner ceiling on the computer:
|
|
41
|
+
`capybara-device ceiling show` shows it, `capybara-device ceiling set` changes it (running outside
|
|
42
|
+
the sandbox, the network, project reach). The organization's and the platform's settings apply as
|
|
43
|
+
well; the narrowest wins. In OS mode commands run as your user with no CPU or memory limits.
|
|
44
|
+
|
|
45
|
+
Deleting the device revokes the computer's sign-in and stops the program; the files stay on your
|
|
46
|
+
computer.
|
|
47
|
+
|
|
48
|
+
## Devices from before this provider
|
|
49
|
+
|
|
50
|
+
Local devices created before this provider stay bound to the old built-in `@local` provider and are
|
|
51
|
+
unavailable. Delete such a device and connect the computer again with the steps above.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# 连接本机
|
|
2
|
+
|
|
3
|
+
::shell-action connect-this-machine 连接本机
|
|
4
|
+
|
|
5
|
+
在你自己的电脑上使用的设备:电脑用 `capybara-device` 程序连接到平台并为这台设备服务,由你在本机限制它能做什么。在桌面应用里,点上面的按钮即可连接正在运行它的这台电脑;在其他地方,请在要连接的电脑的终端里依次执行下面的步骤(macOS 或 Linux,Node 22.12 或更高版本;Windows 请使用 WSL)。
|
|
6
|
+
|
|
7
|
+
## 1. 安装连接程序
|
|
8
|
+
|
|
9
|
+
```bash title="安装 capybara-device"
|
|
10
|
+
npm install -g @capybara-hq/device@next
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 2. 登录
|
|
14
|
+
|
|
15
|
+
```bash title="登录到这个平台"
|
|
16
|
+
capybara-device login --url {{publicUrl}}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
命令会在浏览器里打开一个页面(加上 `--no-browser` 时,它会打印地址和一个验证码,可在任意已登录的浏览器里输入)。在页面上选择组织,选择 **本机**,再选择新建设备,或选择你已连接的某台设备把它移到这台电脑。用另一台电脑登录到同一台设备时,会替换掉原来的电脑。
|
|
20
|
+
|
|
21
|
+
## 3. 保持在线
|
|
22
|
+
|
|
23
|
+
```bash title="开机自动连接(推荐)"
|
|
24
|
+
capybara-device service install
|
|
25
|
+
capybara-device service start
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
也可以运行 `capybara-device start` 在前台连接,直到你停止它。程序连接后设备显示为在线;离线时智能体无法使用它。
|
|
29
|
+
|
|
30
|
+
## 它能做什么
|
|
31
|
+
|
|
32
|
+
命令在你电脑上的沙箱里运行,位于设备目录(`~/capybara-device/<设备 id>`)内。你在本机设置所有者上限:`capybara-device ceiling show` 查看,`capybara-device ceiling set` 修改(是否允许在沙箱外运行、网络、项目范围)。组织和平台的设置同样生效,以最严格的为准。OS 模式下命令以你的用户身份运行,没有 CPU 和内存限制。
|
|
33
|
+
|
|
34
|
+
删除设备会撤销这台电脑的登录并停止程序,文件仍保留在你的电脑上。
|
|
35
|
+
|
|
36
|
+
## 此前创建的设备
|
|
37
|
+
|
|
38
|
+
在这个提供方之前创建的本机设备仍绑定在旧的内置 `@local` 提供方上,已不可用。请删除这类设备,再按上面的步骤重新连接电脑。
|
package/icon.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" shape-rendering="crispEdges"><title>This machine</title><style>@media (prefers-color-scheme: dark){path{fill:#FF6A13}}</style><path fill="#CC4609" d="M14 1.4h1.35v1.35h-1.35zM12.65 2.75h4.05v1.35h-4.05zM4.55 4.1h14.85v1.35h-14.85zM3.2 5.45h12.15v1.35h-12.15zM16.7 5.45h2.7v1.35h-2.7zM1.85 6.8h17.55v1.35h-17.55zM1.85 8.15h17.55v1.35h-17.55zM1.85 9.5h17.55v1.35h-17.55zM3.2 10.85h13.5v1.35h-13.5zM3.2 12.2h2.7v1.35h-2.7zM8.6 12.2h1.35v1.35h-1.35zM12.65 12.2h2.7v1.35h-2.7zM3.2 13.55h2.7v1.35h-2.7zM8.6 13.55h1.35v1.35h-1.35zM12.65 13.55h2.7v1.35h-2.7z"/><path fill="#CC4609" d="M15.95 15.1h5.75v1.15h-5.75zM14.8 16.25h1.15v1.15h-1.15zM21.7 16.25h1.15v1.15h-1.15zM14.8 17.4h1.15v1.15h-1.15zM21.7 17.4h1.15v1.15h-1.15zM15.95 18.55h5.75v1.15h-5.75zM14.8 19.7h1.15v1.15h-1.15zM21.7 19.7h1.15v1.15h-1.15zM14.8 20.85h1.15v1.15h-1.15zM21.7 20.85h1.15v1.15h-1.15zM15.95 22h5.75v1.15h-5.75z"/></svg>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
-- Runs with search_path "plugin_device_local, public": table names carry no schema prefix.
|
|
2
|
+
-- Every row is keyed by the kernel's device id (one connection and one binding per device).
|
|
3
|
+
|
|
4
|
+
-- What the device's machine said in its last accepted hello, and the owner report every carrier
|
|
5
|
+
-- (hello, policy event, binding answer) keeps current. org_id is learned from the kernel's first
|
|
6
|
+
-- report call (a hello names no org) and never moves. machine_id is the kernel's id of the signed-in
|
|
7
|
+
-- machine (its credential) whose hello was accepted, connection_id that hello's connection.
|
|
8
|
+
CREATE TABLE IF NOT EXISTS connections (
|
|
9
|
+
device_id text PRIMARY KEY,
|
|
10
|
+
org_id text,
|
|
11
|
+
machine_id text NOT NULL,
|
|
12
|
+
connection_id text NOT NULL,
|
|
13
|
+
machine_epoch integer NOT NULL DEFAULT 0,
|
|
14
|
+
mode text NOT NULL CHECK (mode IN ('os', 'docker')),
|
|
15
|
+
roots jsonb NOT NULL,
|
|
16
|
+
home text,
|
|
17
|
+
session_isolation boolean NOT NULL,
|
|
18
|
+
features text[] NOT NULL,
|
|
19
|
+
permission_support jsonb NOT NULL,
|
|
20
|
+
owner_report jsonb,
|
|
21
|
+
instance_generation text,
|
|
22
|
+
runtime_identity jsonb,
|
|
23
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
-- The binding of the device's current instance generation (replaced by every create); the
|
|
27
|
+
-- installed facts are what the machine attested in its binding answer.
|
|
28
|
+
CREATE TABLE IF NOT EXISTS bindings (
|
|
29
|
+
device_id text PRIMARY KEY,
|
|
30
|
+
instance_id text NOT NULL,
|
|
31
|
+
generation text NOT NULL,
|
|
32
|
+
binding_id text NOT NULL,
|
|
33
|
+
previous_generation text,
|
|
34
|
+
status text NOT NULL CHECK (status IN ('awaiting-device', 'installed')),
|
|
35
|
+
runtime_identity jsonb,
|
|
36
|
+
permission_support jsonb,
|
|
37
|
+
owner_ceiling jsonb,
|
|
38
|
+
unattested boolean NOT NULL DEFAULT false,
|
|
39
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
40
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/plugin-device-local",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "Apache-2.0",
|
|
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",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/capybara-hq/plugins.git",
|
|
10
|
+
"directory": "plugins/device-local"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/capybara-hq/plugins/tree/main/plugins/device-local#readme",
|
|
13
|
+
"main": "./dist/index.mjs",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": "./dist/index.mjs"
|
|
16
|
+
},
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.56",
|
|
19
|
+
"zod": "^4.0.0"
|
|
20
|
+
}
|
|
21
|
+
}
|