@capybara-hq/plugin-device-local 0.1.0-rc.10 → 0.1.0-rc.12
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/.capybara-plugin/plugin.json +2 -2
- package/dist/index.mjs +15 -4
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "device-local",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.12",
|
|
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.
|
|
26
|
+
"version": "0.1.0-rc.12",
|
|
27
27
|
"sdk": "^0.1.0-rc.56",
|
|
28
28
|
"provides": [
|
|
29
29
|
"device-provider@1"
|
package/dist/index.mjs
CHANGED
|
@@ -4594,6 +4594,7 @@ function filesDigestOf(files) {
|
|
|
4594
4594
|
}
|
|
4595
4595
|
return `sha256:${h.digest("hex")}`;
|
|
4596
4596
|
}
|
|
4597
|
+
var OLD_SERVICE_NAME_REFUSAL = /Invalid device service name\b/;
|
|
4597
4598
|
function serviceFailure(error, op) {
|
|
4598
4599
|
const message = typeof error.message === "string" ? error.message : "no message";
|
|
4599
4600
|
switch (error.kind) {
|
|
@@ -4609,6 +4610,10 @@ function serviceFailure(error, op) {
|
|
|
4609
4610
|
"files_needed"
|
|
4610
4611
|
);
|
|
4611
4612
|
case "invalid":
|
|
4613
|
+
if (OLD_SERVICE_NAME_REFUSAL.test(message))
|
|
4614
|
+
return new SandboxPermissionUnsupportedError(
|
|
4615
|
+
"The connected machine runs a capybara-device that predates device service ids; update capybara-device on that machine, then retry"
|
|
4616
|
+
);
|
|
4612
4617
|
return new ServiceOpRefusedError(
|
|
4613
4618
|
`The connected machine refused the ${op} request: ${message} (check the request and retry)`,
|
|
4614
4619
|
"invalid"
|
|
@@ -4831,14 +4836,17 @@ function statusOf(v) {
|
|
|
4831
4836
|
throw new ToolError2(
|
|
4832
4837
|
"The connected machine sent an invalid service status; update capybara-device on that machine and retry"
|
|
4833
4838
|
);
|
|
4839
|
+
const digest = s.filesDigest;
|
|
4834
4840
|
return {
|
|
4835
4841
|
name: s.name,
|
|
4836
4842
|
state: s.state,
|
|
4837
4843
|
startedAt: s.startedAt,
|
|
4838
4844
|
stateDir: s.stateDir,
|
|
4839
|
-
...s.codeDir !== void 0 && { codeDir: s.codeDir }
|
|
4845
|
+
...s.codeDir !== void 0 && { codeDir: s.codeDir },
|
|
4846
|
+
...s.state === "running" && typeof digest === "string" && FILES_DIGEST_RE.test(digest) ? { filesDigest: digest } : {}
|
|
4840
4847
|
};
|
|
4841
4848
|
}
|
|
4849
|
+
var FILES_DIGEST_RE = /^[A-Za-z0-9:_-]{1,128}$/;
|
|
4842
4850
|
function requireLocal(h) {
|
|
4843
4851
|
const l = localHandle(h);
|
|
4844
4852
|
if (!l) throw new SandboxGoneError2("The instance handle is not a connected machine's instance");
|
|
@@ -5070,8 +5078,10 @@ function createDeviceLocalProvider(ctx, store, opts = {}) {
|
|
|
5070
5078
|
/**
|
|
5071
5079
|
* Needs the machine online. Ends any background work a suspension could not reach (the machine
|
|
5072
5080
|
* was offline then), then re-verifies the generation's binding. `gone` (the kernel recreates the
|
|
5073
|
-
* instance) when the handle is not this provider's, the
|
|
5074
|
-
*
|
|
5081
|
+
* instance) when the handle is not this provider's, the machine's hello did not attest the
|
|
5082
|
+
* generation (unattested: answered at once, with no round trip), the device directory's roots
|
|
5083
|
+
* changed (a new login into another directory or mode), or the generation can never be bound
|
|
5084
|
+
* again.
|
|
5075
5085
|
*/
|
|
5076
5086
|
async resume(h, signal) {
|
|
5077
5087
|
signal.throwIfAborted();
|
|
@@ -5080,6 +5090,7 @@ function createDeviceLocalProvider(ctx, store, opts = {}) {
|
|
|
5080
5090
|
if (!await ctx.dialIn.online(l.id)) throw new DeviceOfflineError(l.id);
|
|
5081
5091
|
const current = await store.binding(l.id);
|
|
5082
5092
|
if (current?.generation !== l.generation) return "gone";
|
|
5093
|
+
if (current.unattested) return "gone";
|
|
5083
5094
|
const roots = await machineCreate(l.id, current.limits ?? l.limits, signal);
|
|
5084
5095
|
if (!sameRoots2(roots, l.roots)) return "gone";
|
|
5085
5096
|
return await bindings.rebind(l.id, l.generation, signal) === "bound" ? "resumed" : "gone";
|
|
@@ -5216,7 +5227,7 @@ function createDeviceLocalProvider(ctx, store, opts = {}) {
|
|
|
5216
5227
|
// src/index.ts
|
|
5217
5228
|
var plugin = defineExtension({
|
|
5218
5229
|
name: "device-local",
|
|
5219
|
-
version: "0.1.0-rc.
|
|
5230
|
+
version: "0.1.0-rc.12",
|
|
5220
5231
|
// ctx.dialIn.capacity and the handlers' connection argument are the rc.56 SDK's
|
|
5221
5232
|
sdk: "^0.1.0-rc.56",
|
|
5222
5233
|
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
|
+
"version": "0.1.0-rc.12",
|
|
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",
|