@capybara-hq/plugin-sdk 0.1.0-rc.16 → 0.1.0-rc.17
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/dev-hosts.js +4 -1
- package/dist/device-protocol.d.ts +13 -2
- package/dist/device-protocol.js +17 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/dev-hosts.js
CHANGED
|
@@ -39,7 +39,10 @@ export const DEV_HOSTS = Object.freeze([
|
|
|
39
39
|
"registry-1.docker.io",
|
|
40
40
|
"auth.docker.io",
|
|
41
41
|
"production.cloudflare.docker.com",
|
|
42
|
-
// Playwright browsers
|
|
42
|
+
// Playwright browsers (`npx playwright install`, checked against playwright-core 1.64): Firefox,
|
|
43
|
+
// WebKit and ffmpeg come from the Playwright CDN and its Microsoft mirror; Chromium is Chrome
|
|
44
|
+
// for Testing, which cdn.playwright.dev redirects to storage.googleapis.com
|
|
43
45
|
"cdn.playwright.dev",
|
|
44
46
|
"playwright.download.prss.microsoft.com",
|
|
47
|
+
"storage.googleapis.com",
|
|
45
48
|
]);
|
|
@@ -82,7 +82,17 @@ export interface KernelCancel {
|
|
|
82
82
|
type: "cancel";
|
|
83
83
|
id: string;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
/**
|
|
86
|
+
* The device's local policy changed while connected (its file was edited on the machine, the
|
|
87
|
+
* localhost proxy guard flipped, a new tier ceiling): the summary as it is now, sent only when it
|
|
88
|
+
* differs from the last one sent on this connection. `policy` is absent when the frame's summary
|
|
89
|
+
* was unreadable; the kernel then keeps only its isolation, from the raw frame, as for the hello.
|
|
90
|
+
*/
|
|
91
|
+
export interface DevicePolicyChanged {
|
|
92
|
+
type: "policy";
|
|
93
|
+
policy?: DeviceLocalPolicySummary;
|
|
94
|
+
}
|
|
95
|
+
export type DeviceFrame = DeviceHello | DeviceRes | DevicePolicyChanged | KernelReq | KernelCancel;
|
|
86
96
|
export interface DeviceExecArgs {
|
|
87
97
|
command: string;
|
|
88
98
|
cwd?: string;
|
|
@@ -187,7 +197,8 @@ export interface DeviceOpResults {
|
|
|
187
197
|
/** Validates the `result` of a successful `res` for `op`; throws {@link DeviceProtocolError}. */
|
|
188
198
|
export declare function parseOpResult<Op extends DeviceOp>(op: Op, result: unknown): DeviceOpResults[Op];
|
|
189
199
|
/**
|
|
190
|
-
* Parses one WebSocket text frame. `from` is the sender: a device may send `hello
|
|
200
|
+
* Parses one WebSocket text frame. `from` is the sender: a device may send `hello`, `res` and
|
|
201
|
+
* `policy`, the
|
|
191
202
|
* kernel `req` and `cancel`. Throws {@link DeviceProtocolError} on bad JSON, an unknown `type`,
|
|
192
203
|
* missing fields or a frame of the wrong direction.
|
|
193
204
|
*/
|
package/dist/device-protocol.js
CHANGED
|
@@ -168,15 +168,19 @@ function optionalHelloFields(o) {
|
|
|
168
168
|
if (Array.isArray(o.features)) {
|
|
169
169
|
out.features = DEVICE_FEATURES.filter((f) => o.features.includes(f));
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
171
|
+
return { ...out, ...optionalPolicy(o.policy) };
|
|
172
|
+
}
|
|
173
|
+
/** A summary field that is dropped when absent or unreadable. */
|
|
174
|
+
function optionalPolicy(v) {
|
|
175
|
+
if (v === undefined)
|
|
176
|
+
return {};
|
|
177
|
+
try {
|
|
178
|
+
return { policy: parsePolicySummary(v) };
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
// an unreadable summary is the same as none: the kernel learns the policy later
|
|
182
|
+
return {};
|
|
178
183
|
}
|
|
179
|
-
return out;
|
|
180
184
|
}
|
|
181
185
|
const BLOCK_LAYERS = ["device", "org", "address", "unknown"];
|
|
182
186
|
/**
|
|
@@ -387,7 +391,8 @@ export function parseOpResult(op, result) {
|
|
|
387
391
|
}
|
|
388
392
|
}
|
|
389
393
|
/**
|
|
390
|
-
* Parses one WebSocket text frame. `from` is the sender: a device may send `hello
|
|
394
|
+
* Parses one WebSocket text frame. `from` is the sender: a device may send `hello`, `res` and
|
|
395
|
+
* `policy`, the
|
|
391
396
|
* kernel `req` and `cancel`. Throws {@link DeviceProtocolError} on bad JSON, an unknown `type`,
|
|
392
397
|
* missing fields or a frame of the wrong direction.
|
|
393
398
|
*/
|
|
@@ -405,8 +410,11 @@ export function parseDeviceFrame(raw, from) {
|
|
|
405
410
|
switch (type) {
|
|
406
411
|
case "hello":
|
|
407
412
|
case "res":
|
|
413
|
+
case "policy":
|
|
408
414
|
if (from !== "device")
|
|
409
415
|
throw new DeviceProtocolError(`"${type}" must come from the device`);
|
|
416
|
+
if (type === "policy")
|
|
417
|
+
return { type, ...optionalPolicy(o.policy) };
|
|
410
418
|
return type === "hello" ? parseHello(o) : parseRes(o);
|
|
411
419
|
case "req":
|
|
412
420
|
case "cancel":
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED