@capybara-hq/plugin-device-local 0.1.0-rc.3 → 0.1.0-rc.4

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "device-local",
4
- "version": "0.1.0-rc.3",
4
+ "version": "0.1.0-rc.4",
5
5
  "publisher": "Capybara",
6
6
  "description": {
7
7
  "en": "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",
@@ -23,7 +23,7 @@
23
23
  "entry": "./dist/index.mjs",
24
24
  "manifest": {
25
25
  "name": "device-local",
26
- "version": "0.1.0-rc.3",
26
+ "version": "0.1.0-rc.4",
27
27
  "sdk": "^0.1.0-rc.56",
28
28
  "provides": [
29
29
  "device-provider@1"
package/README.md CHANGED
@@ -72,7 +72,8 @@ generation under another runtime identity is refused (`local.invalid_hello`,
72
72
  kernel moves the device authority epoch on every new revision and they change nothing the device
73
73
  may do, so a change calls `ctx.devices.reportChanged` once with the revision kept and the kernel
74
74
  stores the new text without invalidating approvals. A stale or conflicting `policy` event never
75
- changes them; an unreadable summary keeps them.
75
+ changes them; an unreadable summary, or an unreadable list in a readable one, keeps them. The
76
+ line fits as many whole directories as it can, skipping one too long, then ` +N` for the rest.
76
77
  - **Refused project paths.** A machine's `project_refused` outcome becomes
77
78
  `ProjectPathRefusedError` with the fixed English and Chinese text of its refusal code
78
79
  (`other-connection`, `outside-reach`, `denied`; `PROJECT_REFUSAL_TEXT`): the machine is not
package/dist/index.mjs CHANGED
@@ -173,8 +173,8 @@ function revisionFacts(c, b) {
173
173
  }
174
174
  var revisionOf = (c, b) => createHash("sha256").update(JSON.stringify(revisionFacts(c, b))).digest("hex");
175
175
  function sharedRootsOf(policy, prev) {
176
- if (!policy) return [...prev];
177
- return [...new Set(policy.sharedProjectRoots ?? [])].sort();
176
+ if (policy?.sharedProjectRoots === void 0) return [...prev];
177
+ return [...new Set(policy.sharedProjectRoots)].sort();
178
178
  }
179
179
  var sameRoots = (a, b) => a.length === b.length && a.every((r, i) => r === b[i]);
180
180
  var reportMoved = (before, after) => revisionOf(before.connection, before.binding) !== revisionOf(after.connection, after.binding) || !sameRoots(
@@ -187,13 +187,19 @@ var SHARED_LABEL = {
187
187
  };
188
188
  function sharedRootsValue(roots) {
189
189
  const max = DEVICE_REPORT_LIMITS.limitValueChars;
190
- for (let k = roots.length; k >= 1; k--) {
191
- const more2 = k < roots.length ? ` +${roots.length - k} more` : "";
192
- const value = `${roots.slice(0, k).join(", ")}${more2}`;
193
- if (value.length <= max) return value;
194
- }
195
- const more = roots.length > 1 ? ` +${roots.length - 1} more` : "";
196
- const chars = Array.from(roots[0] ?? "");
190
+ const rest = (n) => n > 0 ? ` +${n}` : "";
191
+ const kept = [];
192
+ for (const root of roots) {
193
+ const value = `${[...kept, root].join(", ")}${rest(roots.length - kept.length - 1)}`;
194
+ if (value.length <= max) kept.push(root);
195
+ }
196
+ if (kept.length > 0) return `${kept.join(", ")}${rest(roots.length - kept.length)}`;
197
+ const shortest = roots.reduce(
198
+ (best, r) => best === void 0 || r.length < best.length ? r : best,
199
+ void 0
200
+ );
201
+ const more = rest(roots.length - 1);
202
+ const chars = Array.from(shortest ?? "");
197
203
  let tail = "";
198
204
  for (let i = chars.length - 1; i >= 0; i--) {
199
205
  const next = `${chars[i]}${tail}`;
@@ -4915,7 +4921,7 @@ function createDeviceLocalProvider(ctx, store, opts = {}) {
4915
4921
  // src/index.ts
4916
4922
  var plugin = defineExtension({
4917
4923
  name: "device-local",
4918
- version: "0.1.0-rc.3",
4924
+ version: "0.1.0-rc.4",
4919
4925
  // ctx.dialIn.capacity and the handlers' connection argument are the rc.56 SDK's
4920
4926
  sdk: "^0.1.0-rc.56",
4921
4927
  provides: [DEVICE_PROVIDER_EXTENSION_POINT],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-device-local",
3
- "version": "0.1.0-rc.3",
3
+ "version": "0.1.0-rc.4",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
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",