@capybara-hq/plugin-sdk 0.1.0-rc.56 → 0.1.0-rc.57
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/device-denied-paths.d.ts +3 -2
- package/dist/device-denied-paths.js +18 -2
- package/dist/device-protocol.d.ts +18 -28
- package/dist/device-protocol.js +17 -34
- package/dist/dial-in.d.ts +1 -1
- package/dist/dial-in.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/shell-capabilities.d.ts +48 -30
- package/dist/shell-capabilities.js +1 -1
- package/dist/shell-environment.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Paths a local device never opens to restricted work (Request approval, Approve for me), relative
|
|
3
3
|
* to `~` (spec §13.6, extended by ruling R19): SSH keys, cloud CLI credentials, container and
|
|
4
|
-
* Kubernetes credentials, netrc, GnuPG, git / npm / PyPI tokens, the macOS keychains,
|
|
5
|
-
* browser profile directories
|
|
4
|
+
* Kubernetes credentials, netrc, GnuPG, git / npm / PyPI tokens, the macOS keychains, the
|
|
5
|
+
* browser profile directories, other tool credential stores (cargo, 1Password, Vault, Terraform,
|
|
6
|
+
* Claude, Codex, keyrings, pass, rclone, s3cmd, mise) and shell histories. One source for the device, which denies them (and its own state
|
|
6
7
|
* directory), and the kernel, which never proposes an approval for a path under one. Full access
|
|
7
8
|
* and auto mode run as the owner and do not apply them: the command review does.
|
|
8
9
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Paths a local device never opens to restricted work (Request approval, Approve for me), relative
|
|
3
3
|
* to `~` (spec §13.6, extended by ruling R19): SSH keys, cloud CLI credentials, container and
|
|
4
|
-
* Kubernetes credentials, netrc, GnuPG, git / npm / PyPI tokens, the macOS keychains,
|
|
5
|
-
* browser profile directories
|
|
4
|
+
* Kubernetes credentials, netrc, GnuPG, git / npm / PyPI tokens, the macOS keychains, the
|
|
5
|
+
* browser profile directories, other tool credential stores (cargo, 1Password, Vault, Terraform,
|
|
6
|
+
* Claude, Codex, keyrings, pass, rclone, s3cmd, mise) and shell histories. One source for the device, which denies them (and its own state
|
|
6
7
|
* directory), and the kernel, which never proposes an approval for a path under one. Full access
|
|
7
8
|
* and auto mode run as the owner and do not apply them: the command review does.
|
|
8
9
|
*/
|
|
@@ -33,6 +34,21 @@ export const DEVICE_DENIED_SECRET_PATHS = Object.freeze([
|
|
|
33
34
|
"~/Library/Application Support/Arc",
|
|
34
35
|
"~/.config/BraveSoftware",
|
|
35
36
|
"~/.config/microsoft-edge",
|
|
37
|
+
// Machine reach reads the whole home, so more tool credential stores and shell histories.
|
|
38
|
+
"~/.cargo/credentials",
|
|
39
|
+
"~/.cargo/credentials.toml",
|
|
40
|
+
"~/.config/op",
|
|
41
|
+
"~/.vault-token",
|
|
42
|
+
"~/.terraform.d/credentials.tfrc.json",
|
|
43
|
+
"~/.claude/.credentials.json",
|
|
44
|
+
"~/.codex/auth.json",
|
|
45
|
+
"~/.local/share/keyrings",
|
|
46
|
+
"~/.password-store",
|
|
47
|
+
"~/.config/rclone",
|
|
48
|
+
"~/.s3cfg",
|
|
49
|
+
"~/.config/mise/config.toml",
|
|
50
|
+
"~/.bash_history",
|
|
51
|
+
"~/.zsh_history",
|
|
36
52
|
]);
|
|
37
53
|
/**
|
|
38
54
|
* The device program's default state directory (`$XDG_CONFIG_HOME/capybara-device` when that is
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { type SandboxPermissionSupport } from "./device-operation.js";
|
|
9
9
|
import { type ExecResult, type SandboxActor, type SandboxLimits, type SandboxRoots } from "./device-provider.js";
|
|
10
10
|
/** The major version of {@link DEVICE_DIAL_IN_PROTOCOL}. */
|
|
11
|
-
export declare const DEVICE_PROTOCOL_VERSION =
|
|
11
|
+
export declare const DEVICE_PROTOCOL_VERSION = 6;
|
|
12
12
|
/**
|
|
13
13
|
* The dial-in protocol `capybara-device` speaks (`<name>/<major>`, see `DIAL_IN_PROTOCOL_RE`): the
|
|
14
14
|
* value of the `X-Capybara-Device-Protocol` header, of the hello envelope's `protocol` and of the
|
|
@@ -16,7 +16,7 @@ export declare const DEVICE_PROTOCOL_VERSION = 5;
|
|
|
16
16
|
* The kernel checks only the envelope (`DialInMachineFrame`); the bodies the envelope carries are
|
|
17
17
|
* this module's ({@link parseDeviceFrame}).
|
|
18
18
|
*/
|
|
19
|
-
export declare const DEVICE_DIAL_IN_PROTOCOL: "capybara-device/
|
|
19
|
+
export declare const DEVICE_DIAL_IN_PROTOCOL: "capybara-device/6";
|
|
20
20
|
/** The operations the kernel asks a device to run. */
|
|
21
21
|
export type DeviceOp = "create" | "exec" | "readFile" | "writeFile" | "stat" | "killTagged" | "killAll" | "stop" | "list" | "scan";
|
|
22
22
|
/**
|
|
@@ -176,16 +176,23 @@ export interface DeviceOpResults {
|
|
|
176
176
|
/** Validates the `result` of a successful `res` for `op`; throws {@link DeviceProtocolError}. */
|
|
177
177
|
export declare function parseOpResult<Op extends DeviceOp>(op: Op, result: unknown): DeviceOpResults[Op];
|
|
178
178
|
/**
|
|
179
|
-
* The operations the kernel asks a protocol
|
|
179
|
+
* The operations the kernel asks a protocol 6 device to run: every user operation carries its
|
|
180
180
|
* admitted scope; there is no broad kill (`killTagged` / `killAll`) and no deployment-side change
|
|
181
181
|
* of the machine's policy: the owner changes it on the machine and the device reports the change
|
|
182
182
|
* ({@link DevicePolicyChanged}).
|
|
183
183
|
*/
|
|
184
184
|
export type DeviceOperation = Exclude<DeviceOp, "killTagged" | "killAll"> | "prepareReadFile" | "prepareWriteFile" | "prepareStat" | "browseStat" | "browseList" | "browseScan" | "backgroundStart" | "backgroundStatus" | "backgroundTail" | "backgroundReadOutput" | "backgroundStop" | "revokeOperation" | "bindInstance";
|
|
185
|
+
/**
|
|
186
|
+
* How far a connection's project paths reach: `machine` (any path the deny list leaves), `paths`
|
|
187
|
+
* (the listed project paths) or `workspace` (the connection's working directory only).
|
|
188
|
+
*/
|
|
189
|
+
export type DeviceProjectReach = "machine" | "paths" | "workspace";
|
|
190
|
+
/** Why a device refused a project path: the `refusal` of a `project_refused` outcome. */
|
|
191
|
+
export type DeviceProjectRefusal = "other-connection" | "outside-reach" | "denied";
|
|
185
192
|
/** The sandbox network of a device: the open public internet or an allowlist. */
|
|
186
193
|
export type DeviceNetworkMode = "open" | "allowlist";
|
|
187
194
|
/**
|
|
188
|
-
* The owner ceiling of protocol
|
|
195
|
+
* The owner ceiling of protocol 6 (approval-only profiles design, "Settings model"): the device
|
|
189
196
|
* sandbox for every profile. `outsideSandbox` is whether a call may be granted escalation outside
|
|
190
197
|
* the sandbox; `network` and `allowedDomains` are the sandbox network.
|
|
191
198
|
*/
|
|
@@ -196,19 +203,7 @@ export interface DeviceOwnerCeiling {
|
|
|
196
203
|
readonly outsideSandbox: boolean;
|
|
197
204
|
readonly network: DeviceNetworkMode;
|
|
198
205
|
readonly allowedDomains: readonly string[];
|
|
199
|
-
readonly
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* The narrowing of protocol 4: the kernel may switch the network to `allowlist`, remove hosts, turn
|
|
203
|
-
* `outsideSandbox` off or narrow the project reach. Never a widening: widening is decided on the
|
|
204
|
-
* machine by its owner (`capybara-device ceiling set`), never over the wire.
|
|
205
|
-
*/
|
|
206
|
-
export interface DeviceOwnerCeilingNarrowing {
|
|
207
|
-
readonly outsideSandbox?: false;
|
|
208
|
-
readonly network?: "allowlist";
|
|
209
|
-
/** Hosts to remove from `allowedDomains`; a host not on the list is ignored. */
|
|
210
|
-
readonly removeAllowedDomains?: readonly string[];
|
|
211
|
-
readonly restrictedProjectReach?: "workspace";
|
|
206
|
+
readonly projectReach: DeviceProjectReach;
|
|
212
207
|
}
|
|
213
208
|
/**
|
|
214
209
|
* An event body (the envelope's `event`): the owner changed the machine's policy or owner ceiling
|
|
@@ -304,8 +299,10 @@ export type DeviceResponseBody = {
|
|
|
304
299
|
* `invalid` never proves the operation had no effect (a skewed device may have parsed
|
|
305
300
|
* part of it): it must never join the not-run refusals (`isRefusal`, `failureKindOf`).
|
|
306
301
|
*/
|
|
307
|
-
kind: "gone" | "fs_gone" | "policy" | "error" | "denied" | "unsupported" | "unsettled" | "unknown" | "invalid";
|
|
302
|
+
kind: "gone" | "fs_gone" | "policy" | "error" | "denied" | "unsupported" | "unsettled" | "unknown" | "invalid" | "project_refused";
|
|
308
303
|
message: string;
|
|
304
|
+
/** Present on `project_refused` only: why the project path was refused. */
|
|
305
|
+
refusal?: DeviceProjectRefusal;
|
|
309
306
|
};
|
|
310
307
|
};
|
|
311
308
|
/** A response as the device produces it: its body with the envelope's `id`. */
|
|
@@ -313,7 +310,7 @@ export type DeviceResponse = {
|
|
|
313
310
|
type: "res";
|
|
314
311
|
id: string;
|
|
315
312
|
} & DeviceResponseBody;
|
|
316
|
-
/** The bodies of protocol
|
|
313
|
+
/** The bodies of protocol 6, by the envelope frame that carries them. */
|
|
317
314
|
export interface DeviceBodies {
|
|
318
315
|
hello: DeviceHello;
|
|
319
316
|
req: DeviceRequestBody;
|
|
@@ -330,20 +327,13 @@ export interface DeviceBodies {
|
|
|
330
327
|
*/
|
|
331
328
|
export declare function parseSandboxPermissionSupport(value: unknown): SandboxPermissionSupport;
|
|
332
329
|
/**
|
|
333
|
-
* Strictly parses one authenticated owner-ceiling report of protocol
|
|
330
|
+
* Strictly parses one authenticated owner-ceiling report of protocol 6 and returns a frozen copy;
|
|
334
331
|
* throws {@link DeviceProtocolError}. Unknown fields (the protocol 3 `fullAccess` and
|
|
335
332
|
* `restrictedAllowedDomains` among them) are refused.
|
|
336
333
|
*/
|
|
337
334
|
export declare function parseOwnerCeilingReport(value: unknown): DeviceOwnerCeiling;
|
|
338
335
|
/**
|
|
339
|
-
* Strictly parses
|
|
340
|
-
* {@link DeviceProtocolError}. Every field can only narrow: `outsideSandbox` only to `false`,
|
|
341
|
-
* `network` only to `allowlist`, the project reach only to `workspace`, and hosts only removed.
|
|
342
|
-
* There is no way to name a host to add or a list to replace.
|
|
343
|
-
*/
|
|
344
|
-
export declare function parseOwnerCeilingNarrowing(value: unknown): DeviceOwnerCeilingNarrowing;
|
|
345
|
-
/**
|
|
346
|
-
* Strictly parses one protocol 5 body, as carried by the dial-in envelope frame of type `kind`
|
|
336
|
+
* Strictly parses one protocol 6 body, as carried by the dial-in envelope frame of type `kind`
|
|
347
337
|
* (`hello`, `event` and `res` from the device, `req` from the kernel), and returns a frozen copy;
|
|
348
338
|
* throws {@link DeviceProtocolError}. The envelope (its ids, deadline and size bound) is checked
|
|
349
339
|
* before: `parseDialInMachineFrame` on the kernel, `parseDialInKernelFrame` on the machine.
|
package/dist/device-protocol.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { parseSandboxBrowseScope, parseSandboxExecutionRef, parseSandboxOperationRef, parseSandboxOperationScope, parseSandboxPreparationScope, } from "./device-operation.js";
|
|
9
9
|
import { isDeviceProjectName, MAX_DEVICE_LIST_ENTRIES, MAX_DEVICE_PROJECT_NAME_LENGTH, MAX_DEVICE_SCAN_DEPTH, MAX_DEVICE_SCAN_RESULTS, validateAllowHost, validateSandboxPathShape, } from "./device-provider.js";
|
|
10
10
|
/** The major version of {@link DEVICE_DIAL_IN_PROTOCOL}. */
|
|
11
|
-
export const DEVICE_PROTOCOL_VERSION =
|
|
11
|
+
export const DEVICE_PROTOCOL_VERSION = 6;
|
|
12
12
|
/**
|
|
13
13
|
* The dial-in protocol `capybara-device` speaks (`<name>/<major>`, see `DIAL_IN_PROTOCOL_RE`): the
|
|
14
14
|
* value of the `X-Capybara-Device-Protocol` header, of the hello envelope's `protocol` and of the
|
|
@@ -411,7 +411,7 @@ function freeze(value) {
|
|
|
411
411
|
return value;
|
|
412
412
|
}
|
|
413
413
|
/**
|
|
414
|
-
* A strict copy of a wire object for the protocol
|
|
414
|
+
* A strict copy of a wire object for the protocol shapes: a plain object of own data properties
|
|
415
415
|
* only (no accessor is ever invoked, so a value cannot change between check and use), each key in
|
|
416
416
|
* `allowed`. Nested values are copied by the caller's own checks.
|
|
417
417
|
*/
|
|
@@ -519,7 +519,7 @@ export function parseSandboxPermissionSupport(value) {
|
|
|
519
519
|
});
|
|
520
520
|
}
|
|
521
521
|
/**
|
|
522
|
-
* Strictly parses one authenticated owner-ceiling report of protocol
|
|
522
|
+
* Strictly parses one authenticated owner-ceiling report of protocol 6 and returns a frozen copy;
|
|
523
523
|
* throws {@link DeviceProtocolError}. Unknown fields (the protocol 3 `fullAccess` and
|
|
524
524
|
* `restrictedAllowedDomains` among them) are refused.
|
|
525
525
|
*/
|
|
@@ -532,14 +532,14 @@ export function parseOwnerCeilingReport(value) {
|
|
|
532
532
|
"outsideSandbox",
|
|
533
533
|
"network",
|
|
534
534
|
"allowedDomains",
|
|
535
|
-
"
|
|
535
|
+
"projectReach",
|
|
536
536
|
], what);
|
|
537
537
|
if (o.version !== 3)
|
|
538
538
|
throw new DeviceProtocolError(`Invalid ${what}: expected version 3`);
|
|
539
539
|
if (o.network !== "open" && o.network !== "allowlist")
|
|
540
540
|
throw new DeviceProtocolError(`Invalid ${what}: network must be open or allowlist`);
|
|
541
|
-
if (o.
|
|
542
|
-
throw new DeviceProtocolError(`Invalid ${what}: project reach must be
|
|
541
|
+
if (o.projectReach !== "machine" && o.projectReach !== "paths" && o.projectReach !== "workspace")
|
|
542
|
+
throw new DeviceProtocolError(`Invalid ${what}: project reach must be machine, paths or workspace`);
|
|
543
543
|
return freeze({
|
|
544
544
|
version: 3,
|
|
545
545
|
sequence: integer(o.sequence),
|
|
@@ -547,33 +547,7 @@ export function parseOwnerCeilingReport(value) {
|
|
|
547
547
|
outsideSandbox: strictBoolean(o, "outsideSandbox", what),
|
|
548
548
|
network: o.network,
|
|
549
549
|
allowedDomains: strictHosts(o.allowedDomains, `${what} allowedDomains`),
|
|
550
|
-
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Strictly parses an owner-ceiling narrowing of protocol 4 and returns a frozen copy; throws
|
|
555
|
-
* {@link DeviceProtocolError}. Every field can only narrow: `outsideSandbox` only to `false`,
|
|
556
|
-
* `network` only to `allowlist`, the project reach only to `workspace`, and hosts only removed.
|
|
557
|
-
* There is no way to name a host to add or a list to replace.
|
|
558
|
-
*/
|
|
559
|
-
export function parseOwnerCeilingNarrowing(value) {
|
|
560
|
-
const what = "owner ceiling narrowing";
|
|
561
|
-
const o = strictRecord(value, ["outsideSandbox", "network", "removeAllowedDomains", "restrictedProjectReach"], what);
|
|
562
|
-
if ((Object.hasOwn(o, "outsideSandbox") && o.outsideSandbox !== false) ||
|
|
563
|
-
(Object.hasOwn(o, "network") && o.network !== "allowlist") ||
|
|
564
|
-
(Object.hasOwn(o, "restrictedProjectReach") && o.restrictedProjectReach !== "workspace"))
|
|
565
|
-
throw new DeviceProtocolError("The deployment may only narrow the owner ceiling");
|
|
566
|
-
return freeze({
|
|
567
|
-
...(Object.hasOwn(o, "outsideSandbox") ? { outsideSandbox: false } : {}),
|
|
568
|
-
...(Object.hasOwn(o, "network") ? { network: "allowlist" } : {}),
|
|
569
|
-
...(Object.hasOwn(o, "removeAllowedDomains")
|
|
570
|
-
? {
|
|
571
|
-
removeAllowedDomains: strictHosts(o.removeAllowedDomains, `${what} removeAllowedDomains`),
|
|
572
|
-
}
|
|
573
|
-
: {}),
|
|
574
|
-
...(Object.hasOwn(o, "restrictedProjectReach")
|
|
575
|
-
? { restrictedProjectReach: "workspace" }
|
|
576
|
-
: {}),
|
|
550
|
+
projectReach: o.projectReach,
|
|
577
551
|
});
|
|
578
552
|
}
|
|
579
553
|
const GENERATION = /^[0-9]{1,16}$/;
|
|
@@ -716,7 +690,9 @@ const RESPONSE_KINDS = [
|
|
|
716
690
|
"unsettled",
|
|
717
691
|
"unknown",
|
|
718
692
|
"invalid",
|
|
693
|
+
"project_refused",
|
|
719
694
|
];
|
|
695
|
+
const PROJECT_REFUSALS = ["other-connection", "outside-reach", "denied"];
|
|
720
696
|
function helloBody(value) {
|
|
721
697
|
const o = object(value);
|
|
722
698
|
keys(o, [
|
|
@@ -777,14 +753,21 @@ function responseBody(value) {
|
|
|
777
753
|
throw new DeviceProtocolError('field "ok" must be a boolean');
|
|
778
754
|
keys(o, ["ok", "error"]);
|
|
779
755
|
const e = object(o.error);
|
|
780
|
-
keys(e, ["kind", "message"]);
|
|
756
|
+
keys(e, e.kind === "project_refused" ? ["kind", "message", "refusal"] : ["kind", "message"]);
|
|
781
757
|
if (!RESPONSE_KINDS.includes(String(e.kind)))
|
|
782
758
|
throw new DeviceProtocolError("Unknown outcome kind");
|
|
759
|
+
let refusal;
|
|
760
|
+
if (e.kind === "project_refused") {
|
|
761
|
+
if (!PROJECT_REFUSALS.includes(String(e.refusal)))
|
|
762
|
+
throw new DeviceProtocolError("A project_refused outcome needs a known refusal");
|
|
763
|
+
refusal = e.refusal;
|
|
764
|
+
}
|
|
783
765
|
return freeze({
|
|
784
766
|
ok: false,
|
|
785
767
|
error: {
|
|
786
768
|
kind: e.kind,
|
|
787
769
|
message: string(e.message, 8192),
|
|
770
|
+
...(refusal && { refusal }),
|
|
788
771
|
},
|
|
789
772
|
});
|
|
790
773
|
}
|
package/dist/dial-in.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* A dial-in protocol: `<name>/<major>`, a lower-case name of 1 to 41 characters and a major
|
|
11
|
-
* version from 1 to 9999 (for example `capybara-device/
|
|
11
|
+
* version from 1 to 9999 (for example `capybara-device/6`). A machine's hello must name exactly
|
|
12
12
|
* the protocol of the provider serving its device.
|
|
13
13
|
*/
|
|
14
14
|
export declare const DIAL_IN_PROTOCOL_RE: RegExp;
|
package/dist/dial-in.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
/**
|
|
11
11
|
* A dial-in protocol: `<name>/<major>`, a lower-case name of 1 to 41 characters and a major
|
|
12
|
-
* version from 1 to 9999 (for example `capybara-device/
|
|
12
|
+
* version from 1 to 9999 (for example `capybara-device/6`). A machine's hello must name exactly
|
|
13
13
|
* the protocol of the provider serving its device.
|
|
14
14
|
*/
|
|
15
15
|
export const DIAL_IN_PROTOCOL_RE = /^[a-z][a-z0-9-]{0,40}\/[1-9][0-9]{0,3}$/;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import type { PushPlatform } from "./push.js";
|
|
|
8
8
|
/** Capability keys, `name@major`; each value is a key of `SHELL_CAPABILITIES`. */
|
|
9
9
|
export declare const SHELL_CAPABILITY_KEYS: {
|
|
10
10
|
readonly chrome: "chrome@1";
|
|
11
|
-
readonly device: "device@
|
|
11
|
+
readonly device: "device@2";
|
|
12
12
|
readonly notify: "notify@1";
|
|
13
13
|
readonly openExternal: "openExternal@1";
|
|
14
14
|
readonly signIn: "signIn@1";
|
|
@@ -21,14 +21,11 @@ export declare const SHELL_CAPABILITY_KEYS: {
|
|
|
21
21
|
};
|
|
22
22
|
export type KeepAwakeMode = "off" | "while-busy" | "connected";
|
|
23
23
|
export type DeviceConnection = "starting" | "online" | "offline" | "draining" | "stopped";
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
origin: string;
|
|
30
|
-
} | {
|
|
31
|
-
state: "connected";
|
|
24
|
+
/**
|
|
25
|
+
* One connection of this machine into the deployment the shell shows (a machine may hold several,
|
|
26
|
+
* into one org or several).
|
|
27
|
+
*/
|
|
28
|
+
export interface ThisMachineConnection {
|
|
32
29
|
deviceId: string;
|
|
33
30
|
orgId: string;
|
|
34
31
|
mode: "os" | "docker";
|
|
@@ -41,9 +38,9 @@ export type ThisMachineStatus = {
|
|
|
41
38
|
unavailable?: string;
|
|
42
39
|
};
|
|
43
40
|
lastWakeAt?: string;
|
|
44
|
-
}
|
|
45
|
-
/** One operation running on this machine for
|
|
46
|
-
export interface
|
|
41
|
+
}
|
|
42
|
+
/** One operation running on this machine for one of its devices. */
|
|
43
|
+
export interface DeviceRunningOp {
|
|
47
44
|
tag: string;
|
|
48
45
|
conversationId: string | null;
|
|
49
46
|
accountId: string | null;
|
|
@@ -53,30 +50,51 @@ export interface RunningOperationView {
|
|
|
53
50
|
/** The `code` of a rejected shell call. */
|
|
54
51
|
export type ShellCallError = "busy" | "no_activation" | "cancelled" | "failed";
|
|
55
52
|
/**
|
|
56
|
-
* A change to
|
|
57
|
-
* (`--outside-sandbox on|off`, `--network open|allowlist`,
|
|
58
|
-
* only the fields to change. A field left out is never
|
|
59
|
-
* never narrow it. A widening needs the shell's native
|
|
53
|
+
* A change to a connection's owner ceiling, as `capybara-device ceiling set` takes it
|
|
54
|
+
* (`--outside-sandbox on|off`, `--network open|allowlist`,
|
|
55
|
+
* `--project-reach machine|paths|workspace`): only the fields to change. A field left out is never
|
|
56
|
+
* touched, so a stale value on the page can never narrow it. A widening needs the shell's native
|
|
57
|
+
* confirmation; a narrowing applies at once.
|
|
60
58
|
*/
|
|
61
59
|
export interface DeviceCeilingRequest {
|
|
62
60
|
outsideSandbox?: boolean;
|
|
63
61
|
network?: "open" | "allowlist";
|
|
64
|
-
projectReach?: "
|
|
62
|
+
projectReach?: "machine" | "paths" | "workspace";
|
|
65
63
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
/**
|
|
65
|
+
* `device@2`: this machine's connections into the deployment the shell shows. Every action names
|
|
66
|
+
* the connection by its device id; `connect` adds a connection into an org.
|
|
67
|
+
*/
|
|
68
|
+
export interface DeviceCapabilityV2 {
|
|
69
|
+
status(): Promise<{
|
|
70
|
+
connections: ThisMachineConnection[];
|
|
71
|
+
}>;
|
|
72
|
+
/** Called when any connection's status changes; read `status()` again. */
|
|
73
|
+
onStatus(cb: () => void): () => void;
|
|
74
|
+
running(a: {
|
|
75
|
+
deviceId: string;
|
|
76
|
+
}): Promise<DeviceRunningOp[]>;
|
|
77
|
+
connect(a: {
|
|
72
78
|
orgId: string;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
}): Promise<"connected" | "cancelled" | {
|
|
80
|
+
error: string;
|
|
81
|
+
}>;
|
|
82
|
+
pause(a: {
|
|
83
|
+
deviceId: string;
|
|
84
|
+
}): Promise<void>;
|
|
85
|
+
resume(a: {
|
|
86
|
+
deviceId: string;
|
|
87
|
+
}): Promise<"resumed" | "cancelled">;
|
|
88
|
+
disconnect(a: {
|
|
89
|
+
deviceId: string;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
requestCeiling(a: {
|
|
92
|
+
deviceId: string;
|
|
93
|
+
} & DeviceCeilingRequest): Promise<"applied" | "cancelled">;
|
|
94
|
+
setKeepAwake(a: {
|
|
95
|
+
deviceId: string;
|
|
96
|
+
mode: KeepAwakeMode;
|
|
97
|
+
}): Promise<"applied" | "cancelled">;
|
|
80
98
|
}
|
|
81
99
|
/** `notify@1`: a native notification; `path` is the in-app path opened on click. */
|
|
82
100
|
export interface NotifyCapabilityV1 {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
/** Capability keys, `name@major`; each value is a key of `SHELL_CAPABILITIES`. */
|
|
8
8
|
export const SHELL_CAPABILITY_KEYS = {
|
|
9
9
|
chrome: "chrome@1",
|
|
10
|
-
device: "device@
|
|
10
|
+
device: "device@2",
|
|
11
11
|
notify: "notify@1",
|
|
12
12
|
openExternal: "openExternal@1",
|
|
13
13
|
signIn: "signIn@1",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* (key, owner) by the spec that defines it; the owner names the spec holding its functions.
|
|
9
9
|
*/
|
|
10
10
|
export const SHELL_CAPABILITIES = [
|
|
11
|
-
{ key: "device@
|
|
11
|
+
{ key: "device@2", owner: "device provider spec (2026-11-21-device-provider-design.md), §9" },
|
|
12
12
|
{ key: "notify@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
|
|
13
13
|
{ key: "openExternal@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
|
|
14
14
|
{ key: "signIn@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md), §6.5" },
|