@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.
@@ -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});
@@ -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
- return { allowedDomains: strArray(o, "allowedDomains") };
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
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "0.1.0-rc.57";
1
+ export declare const SDK_VERSION = "0.1.0-rc.58";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./avatar-presets.js";
4
4
  export * from "./bootstrap.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = "0.1.0-rc.57";
1
+ export const SDK_VERSION = "0.1.0-rc.58";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./avatar-presets.js";
4
4
  export * from "./bootstrap.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.57",
3
+ "version": "0.1.0-rc.58",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {