@capybara-hq/plugin-sdk 0.1.0-rc.57 → 0.1.0-rc.58
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-protocol.d.ts +11 -0
- package/dist/device-protocol.js +18 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -32,7 +32,18 @@ export type DeviceFeature = "networkReport" | "projects";
|
|
|
32
32
|
export interface DeviceLocalPolicySummary {
|
|
33
33
|
/** The device's sandbox allowlist (the owner's `allowedDomains`). */
|
|
34
34
|
allowedDomains: string[];
|
|
35
|
+
/**
|
|
36
|
+
* This connection's project directories that another connection on the same machine also uses,
|
|
37
|
+
* only those the owner listed explicitly for this connection (its `projectPaths`): a directory
|
|
38
|
+
* the deployment picked itself is never reported, shared or not (absolute paths,
|
|
39
|
+
* {@link validateSandboxPathShape}; at most {@link MAX_DEVICE_SHARED_PROJECT_ROOTS}). Never names
|
|
40
|
+
* the other connection. Absent from an older device; a malformed value is dropped by the parser
|
|
41
|
+
* (the rest of the summary is kept).
|
|
42
|
+
*/
|
|
43
|
+
sharedProjectRoots?: string[];
|
|
35
44
|
}
|
|
45
|
+
/** The most project directories a policy summary's `sharedProjectRoots` lists. */
|
|
46
|
+
export declare const MAX_DEVICE_SHARED_PROJECT_ROOTS = 256;
|
|
36
47
|
/**
|
|
37
48
|
* A directory a `scan` found that looks like a project (it holds `.git` or `AGENTS.md`): a
|
|
38
49
|
* suggestion, not a project. `path` is absolute ({@link validateSandboxPathShape});
|
package/dist/device-protocol.js
CHANGED
|
@@ -18,6 +18,8 @@ export const DEVICE_PROTOCOL_VERSION = 6;
|
|
|
18
18
|
*/
|
|
19
19
|
export const DEVICE_DIAL_IN_PROTOCOL = `capybara-device/${DEVICE_PROTOCOL_VERSION}`;
|
|
20
20
|
const DEVICE_FEATURES = ["networkReport", "projects"];
|
|
21
|
+
/** The most project directories a policy summary's `sharedProjectRoots` lists. */
|
|
22
|
+
export const MAX_DEVICE_SHARED_PROJECT_ROOTS = 256;
|
|
21
23
|
/** The most blocked hosts an exec result reports; the parser cuts longer lists. */
|
|
22
24
|
export const MAX_NETWORK_BLOCKED_HOSTS = 20;
|
|
23
25
|
/** The most hosts an exec's `grants` may carry. */
|
|
@@ -204,7 +206,22 @@ function parseScanResult(v) {
|
|
|
204
206
|
}
|
|
205
207
|
function parsePolicySummary(v) {
|
|
206
208
|
const o = obj(v, 'field "policy"');
|
|
207
|
-
|
|
209
|
+
const shared = sharedProjectRoots(o.sharedProjectRoots);
|
|
210
|
+
return {
|
|
211
|
+
allowedDomains: strArray(o, "allowedDomains"),
|
|
212
|
+
...(shared !== undefined && { sharedProjectRoots: shared }),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* A summary's `sharedProjectRoots`: at most {@link MAX_DEVICE_SHARED_PROJECT_ROOTS} absolute paths.
|
|
217
|
+
* Undefined when absent or malformed (an optional field: only it is dropped).
|
|
218
|
+
*/
|
|
219
|
+
function sharedProjectRoots(v) {
|
|
220
|
+
if (!Array.isArray(v) || v.length > MAX_DEVICE_SHARED_PROJECT_ROOTS)
|
|
221
|
+
return undefined;
|
|
222
|
+
if (!v.every((p) => typeof p === "string" && validateSandboxPathShape(p).length === 0))
|
|
223
|
+
return undefined;
|
|
224
|
+
return [...v];
|
|
208
225
|
}
|
|
209
226
|
/** Optional hello fields: malformed values are ignored so old and new peers interoperate. */
|
|
210
227
|
function optionalHelloFields(o) {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED