@capybara-hq/kernel 0.1.0-rc.67 → 0.1.0-rc.69
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/bootstrap.json +9 -1
- package/dist/admin/admin.module.js +2 -0
- package/dist/admin/health.service.d.ts +11 -4
- package/dist/admin/health.service.js +33 -17
- package/dist/background/poll.job.js +2 -2
- package/dist/background/tasks.service.d.ts +5 -5
- package/dist/background/tasks.service.js +9 -8
- package/dist/catalog/credential-key.d.ts +10 -0
- package/dist/catalog/credential-key.js +28 -0
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/plugin-upgrade.js +1 -19
- package/dist/catalog/requests.service.js +1 -1
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +9 -9
- package/dist/conversations/conversations.controller.d.ts +8 -3
- package/dist/conversations/conversations.controller.js +8 -3
- package/dist/conversations/conversations.service.d.ts +33 -15
- package/dist/conversations/conversations.service.js +60 -10
- package/dist/conversations/events.d.ts +21 -41
- package/dist/conversations/events.js +57 -31
- package/dist/conversations/permission-profiles.controller.d.ts +6 -4
- package/dist/conversations/permission-profiles.service.d.ts +6 -4
- package/dist/ctx/create-ctx.d.ts +20 -1
- package/dist/ctx/create-ctx.js +77 -6
- package/dist/ctx/device-provider-check.d.ts +6 -2
- package/dist/ctx/device-provider-check.js +17 -2
- package/dist/db/kernel-schema.d.ts +10 -48
- package/dist/devices/access.d.ts +3 -4
- package/dist/devices/access.js +3 -4
- package/dist/devices/conversation-devices.d.ts +1 -3
- package/dist/devices/conversation-devices.js +2 -7
- package/dist/devices/device-projects.service.js +24 -29
- package/dist/devices/device-provider-selection.d.ts +5 -6
- package/dist/devices/device-provider-selection.js +8 -9
- package/dist/devices/devices.controller.d.ts +8 -21
- package/dist/devices/devices.controller.js +9 -34
- package/dist/devices/devices.module.js +6 -4
- package/dist/devices/devices.schemas.d.ts +1 -5
- package/dist/devices/devices.schemas.js +1 -5
- package/dist/devices/devices.service.d.ts +84 -147
- package/dist/devices/devices.service.js +134 -229
- package/dist/devices/dto.d.ts +5 -32
- package/dist/devices/dto.js +5 -37
- package/dist/devices/errors.d.ts +6 -5
- package/dist/devices/errors.js +7 -8
- package/dist/devices/project-rules.d.ts +9 -11
- package/dist/devices/project-rules.js +7 -7
- package/dist/devices/working-root.d.ts +3 -6
- package/dist/devices/working-root.js +3 -8
- package/dist/dial-in/access.d.ts +23 -0
- package/dist/dial-in/access.js +64 -0
- package/dist/{local-devices/device-auth.controller.d.ts → dial-in/auth.controller.d.ts} +12 -6
- package/dist/{local-devices/device-auth.controller.js → dial-in/auth.controller.js} +30 -15
- package/dist/dial-in/auth.module.d.ts +7 -0
- package/dist/dial-in/auth.module.js +27 -0
- package/dist/{local-devices/device-auth.d.ts → dial-in/auth.service.d.ts} +42 -13
- package/dist/{local-devices/device-auth.js → dial-in/auth.service.js} +83 -32
- package/dist/dial-in/dial-in.module.d.ts +9 -0
- package/dist/dial-in/dial-in.module.js +37 -0
- package/dist/{local-devices → dial-in}/dto.d.ts +17 -2
- package/dist/{local-devices → dial-in}/dto.js +14 -2
- package/dist/dial-in/envelope.d.ts +95 -0
- package/dist/dial-in/envelope.js +89 -0
- package/dist/dial-in/gateway.d.ts +214 -0
- package/dist/{local-devices/local-device-gateway.js → dial-in/gateway.js} +337 -181
- package/dist/dial-in/handlers.d.ts +47 -0
- package/dist/dial-in/handlers.js +84 -0
- package/dist/dial-in/machines.d.ts +155 -0
- package/dist/dial-in/machines.js +383 -0
- package/dist/dial-in/relay.d.ts +135 -0
- package/dist/dial-in/relay.js +444 -0
- package/dist/dial-in/relay.module.d.ts +7 -0
- package/dist/dial-in/relay.module.js +24 -0
- package/dist/{local-devices/device-routes.d.ts → dial-in/routes.d.ts} +19 -11
- package/dist/{local-devices/device-routes.js → dial-in/routes.js} +45 -25
- package/dist/{local-devices → dial-in}/targets.d.ts +3 -18
- package/dist/{local-devices → dial-in}/targets.js +3 -48
- package/dist/errors.d.ts +8 -27
- package/dist/errors.js +8 -27
- package/dist/extensions/bootstrap.d.ts +5 -0
- package/dist/extensions/bootstrap.js +10 -1
- package/dist/extensions/extensions.module.js +6 -0
- package/dist/extensions/host.d.ts +6 -0
- package/dist/extensions/host.js +12 -2
- package/dist/extensions/permission-set.d.ts +15 -1
- package/dist/extensions/permission-set.js +11 -1
- package/dist/extensions/permission-view.d.ts +1 -1
- package/dist/extensions/permission-view.js +4 -1
- package/dist/http/api.module.js +4 -4
- package/dist/http/gateway-routes.d.ts +1 -1
- package/dist/http/gateway-routes.js +1 -1
- package/dist/http/meta.controller.js +1 -1
- package/dist/identity/settings.d.ts +1 -1
- package/dist/identity/settings.js +6 -8
- package/dist/infra/config/kernel-config.service.js +2 -2
- package/dist/infra/outbox/registry.d.ts +0 -14
- package/dist/infra/outbox/registry.js +0 -15
- package/dist/infra/throttler/named-throttlers.d.ts +1 -1
- package/dist/infra/throttler/named-throttlers.js +1 -1
- package/dist/kernel.module.js +0 -3
- package/dist/orgs/settings.service.js +5 -10
- package/dist/overrides.d.ts +0 -4
- package/dist/overrides.js +0 -2
- package/dist/platform/exclusions.js +5 -5
- package/dist/platform/ops/admin.ops.js +1 -1
- package/dist/platform/ops/conversations.ops.js +5 -2
- package/dist/platform/ops/devices.ops.js +11 -24
- package/dist/platform/ops/inbox.ops.js +1 -1
- package/dist/roles/gateway-role.d.ts +3 -3
- package/dist/roles/gateway-role.js +4 -4
- package/dist/roles/gateway.module.d.ts +1 -1
- package/dist/roles/gateway.module.js +5 -5
- package/dist/runtime/context/device-paths.d.ts +4 -1
- package/dist/runtime/context/permission-profile.js +5 -5
- package/dist/runtime/maintenance.d.ts +2 -5
- package/dist/runtime/maintenance.js +9 -19
- package/dist/runtime/project/knowledge.js +4 -5
- package/dist/runtime/project/knowledge.service.js +2 -1
- package/dist/sandbox/cloud-permission-snapshot.d.ts +1 -1
- package/dist/sandbox/cloud-permission-snapshot.js +1 -3
- package/dist/sandbox/device-reports.d.ts +74 -14
- package/dist/sandbox/device-reports.js +190 -33
- package/dist/sandbox/device-reports.module.d.ts +7 -0
- package/dist/sandbox/device-reports.module.js +25 -0
- package/dist/sandbox/device-sandbox.d.ts +39 -41
- package/dist/sandbox/device-sandbox.js +44 -83
- package/dist/sandbox/kernel-read.d.ts +2 -2
- package/dist/sandbox/legacy-retirement.d.ts +11 -59
- package/dist/sandbox/legacy-retirement.js +34 -186
- package/dist/sandbox/legacy-retirement.module.d.ts +2 -2
- package/dist/sandbox/legacy-retirement.module.js +2 -2
- package/dist/sandbox/managed-device-context.d.ts +16 -4
- package/dist/sandbox/managed-device-context.js +25 -8
- package/dist/sandbox/managed-device-context.module.js +4 -0
- package/dist/sandbox/modes.d.ts +3 -12
- package/dist/sandbox/modes.js +2 -14
- package/dist/{local-devices → sandbox}/network-grants.d.ts +2 -21
- package/dist/{local-devices → sandbox}/network-grants.js +4 -49
- package/dist/sandbox/operation-authority-types.d.ts +2 -1
- package/dist/sandbox/operation-authority.d.ts +6 -20
- package/dist/sandbox/operation-authority.js +43 -104
- package/dist/sandbox/operation-authority.module.js +1 -1
- package/dist/sandbox/operation-intents.d.ts +4 -1
- package/dist/sandbox/operation-intents.js +11 -2
- package/dist/sandbox/operation-reconcile.job.js +2 -4
- package/dist/sandbox/permission-availability.d.ts +6 -7
- package/dist/sandbox/permission-availability.js +7 -10
- package/dist/sandbox/permission-call-grants.d.ts +2 -1
- package/dist/sandbox/permission-call-grants.js +1 -7
- package/dist/sandbox/permission-call-types.d.ts +4 -4
- package/dist/sandbox/permission-ceiling-writes.d.ts +7 -23
- package/dist/sandbox/permission-ceiling-writes.js +8 -35
- package/dist/sandbox/permission-config-publication.d.ts +9 -1
- package/dist/sandbox/permission-config-publication.js +29 -21
- package/dist/sandbox/permission-context-types.d.ts +17 -10
- package/dist/sandbox/permission-facts.d.ts +98 -95
- package/dist/sandbox/permission-facts.js +160 -314
- package/dist/sandbox/permission-instance-writes.d.ts +23 -37
- package/dist/sandbox/permission-instance-writes.js +44 -121
- package/dist/sandbox/permission-runtime-reports.d.ts +38 -30
- package/dist/sandbox/permission-runtime-reports.js +105 -122
- package/dist/sandbox/providers.d.ts +26 -38
- package/dist/sandbox/providers.js +36 -18
- package/dist/sandbox/request-not-sent.d.ts +2 -13
- package/dist/sandbox/request-not-sent.js +2 -13
- package/dist/sandbox/review/permission-candidate.d.ts +13 -8
- package/dist/sandbox/review/permission-candidate.js +38 -48
- package/dist/sandbox/sandbox.module.js +7 -3
- package/dist/sandbox/sandbox.service.d.ts +49 -59
- package/dist/sandbox/sandbox.service.js +139 -259
- package/dist/schedules/fire.d.ts +15 -6
- package/dist/schedules/fire.js +27 -13
- package/dist/schedules/grant-rules.js +1 -1
- package/dist/schedules/scheduled-tasks.service.d.ts +0 -7
- package/dist/schedules/scheduled-tasks.service.js +1 -4
- package/dist/schedules/schedules.module.js +5 -3
- package/dist/skills/invoke.d.ts +1 -1
- package/dist/skills/invoke.js +2 -3
- package/dist/tools/approvals.service.d.ts +8 -5
- package/dist/tools/approvals.service.js +5 -5
- package/dist/tools/builtins/sandbox/bash.js +1 -2
- package/dist/tools/builtins/sandbox/common.d.ts +15 -9
- package/dist/tools/builtins/sandbox/common.js +37 -38
- package/dist/tools/connectors.controller.d.ts +2 -0
- package/dist/tools/connectors.schemas.d.ts +2 -0
- package/dist/tools/credentials.d.ts +2 -0
- package/dist/tools/network-asks.d.ts +19 -22
- package/dist/tools/network-asks.js +15 -21
- package/dist/tools/oauth/authorization-params.d.ts +7 -0
- package/dist/tools/oauth/authorization-params.js +19 -0
- package/dist/tools/oauth/flow.js +7 -0
- package/dist/tools/oauth/tokens.js +2 -1
- package/dist/tools/pipeline.d.ts +6 -7
- package/dist/tools/pipeline.js +17 -21
- package/dist/tools/tools.module.js +3 -7
- package/package.json +3 -4
- package/src/migrations/0177_dial_in_contract.sql +32 -0
- package/dist/local-devices/device-auth.module.d.ts +0 -7
- package/dist/local-devices/device-auth.module.js +0 -25
- package/dist/local-devices/device-policy.service.d.ts +0 -213
- package/dist/local-devices/device-policy.service.js +0 -605
- package/dist/local-devices/instance-bindings.d.ts +0 -82
- package/dist/local-devices/instance-bindings.js +0 -307
- package/dist/local-devices/local-device-gateway.d.ts +0 -153
- package/dist/local-devices/local-device-provider.d.ts +0 -122
- package/dist/local-devices/local-device-provider.js +0 -326
- package/dist/local-devices/local-devices.module.d.ts +0 -31
- package/dist/local-devices/local-devices.module.js +0 -100
- package/dist/local-devices/machines.d.ts +0 -211
- package/dist/local-devices/machines.js +0 -766
- package/dist/local-devices/owner-report.d.ts +0 -81
- package/dist/local-devices/owner-report.js +0 -150
- package/dist/local-devices/owner-reports.d.ts +0 -48
- package/dist/local-devices/owner-reports.js +0 -208
- package/dist/local-devices/policy-op-jobs.d.ts +0 -15
- package/dist/local-devices/policy-op-jobs.js +0 -12
- package/dist/local-devices/policy-summary.d.ts +0 -102
- package/dist/local-devices/policy-summary.js +0 -155
- package/dist/local-devices/relay.d.ts +0 -166
- package/dist/local-devices/relay.js +0 -559
- package/dist/tools/device-op-resolver.d.ts +0 -34
- package/dist/tools/device-op-resolver.js +0 -120
- /package/dist/{local-devices → dial-in}/keys.d.ts +0 -0
- /package/dist/{local-devices → dial-in}/keys.js +0 -0
- /package/dist/{local-devices → sandbox}/network-grants.module.d.ts +0 -0
- /package/dist/{local-devices → sandbox}/network-grants.module.js +0 -0
|
@@ -8,7 +8,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { posix } from "node:path";
|
|
11
|
-
import { isSandboxPermissionUnsupportedError, isSandboxScopeDeniedError, parseSandboxBrowseScope, parseSandboxExecutionRef, parseSandboxOperationScope, parseSandboxPreparationScope, SandboxOperationOutcomeUnknownError, SandboxPermissionUnsupportedError, SandboxScopeDeniedError, } from "@capybara-hq/plugin-sdk";
|
|
11
|
+
import { isDeviceOfflineError, isSandboxPermissionUnsupportedError, isSandboxScopeDeniedError, parseSandboxBrowseScope, parseSandboxExecutionRef, parseSandboxOperationScope, parseSandboxPreparationScope, SandboxOperationOutcomeUnknownError, SandboxPermissionUnsupportedError, SandboxScopeDeniedError, } from "@capybara-hq/plugin-sdk";
|
|
12
12
|
import { runOutsideTransaction } from "../infra/database/transaction-host.js";
|
|
13
13
|
import { createHeldOperations, createLegacyHeldProvider, withKernelGeneration, } from "./held-operations.js";
|
|
14
14
|
import { SandboxOperationAuthority } from "./operation-authority.js";
|
|
@@ -34,12 +34,13 @@ const backgroundBinding = (args, instanceId) => ({
|
|
|
34
34
|
});
|
|
35
35
|
import { randomUUID } from "node:crypto";
|
|
36
36
|
import { isFileSystemGoneError, isSandboxGoneError, isSandboxOperationOutcomeUnknownError, rootsOf, } from "@capybara-hq/plugin-sdk";
|
|
37
|
-
import { Inject, Injectable } from "@nestjs/common";
|
|
37
|
+
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
38
38
|
import { sql, } from "kysely";
|
|
39
39
|
import { MANAGED_STOP_GRACE_MS } from "../background/managed.js";
|
|
40
40
|
import { deviceInstanceForeign, deviceUnavailable } from "../devices/access.js";
|
|
41
41
|
import { DeviceProviderSelection } from "../devices/device-provider-selection.js";
|
|
42
42
|
import { deviceNotFound } from "../devices/errors.js";
|
|
43
|
+
import { DialInRelay } from "../dial-in/relay.js";
|
|
43
44
|
import { ApiError } from "../errors.js";
|
|
44
45
|
import { readSandboxLimitOverride } from "../identity/settings.js";
|
|
45
46
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
@@ -53,12 +54,12 @@ import { CloudPermissionSnapshots, } from "./cloud-permission-snapshot.js";
|
|
|
53
54
|
import { DeviceReports } from "./device-reports.js";
|
|
54
55
|
import { isKernelReadMethod, KernelReadNotAdmitted, KernelReadUnsupported, } from "./kernel-read.js";
|
|
55
56
|
import { SandboxLeases, SandboxLockLostError, sandboxBusy, } from "./leases.js";
|
|
56
|
-
import {
|
|
57
|
+
import { isKnownProvider, LegacyRetirementStore } from "./legacy-retirement.js";
|
|
57
58
|
import { ManagedDeviceContextFailed } from "./managed-device-context.js";
|
|
58
59
|
import { appliedOf, appliedWider, instanceLimitsJson, orgEffectiveHosts, providerLimits, readInstanceLimits, sameApplied, sameAppliedExact, sameAppliedExactly, } from "./modes.js";
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import { DeviceProviders,
|
|
60
|
+
import { PermissionFacts } from "./permission-facts.js";
|
|
61
|
+
import { reportOwed, supportOf } from "./permission-runtime-reports.js";
|
|
62
|
+
import { DeviceProviders, servesDialIn } from "./providers.js";
|
|
62
63
|
import { isDeviceRequestNotSent } from "./request-not-sent.js";
|
|
63
64
|
import { SandboxProviderUnreachableError } from "./unreachable.js";
|
|
64
65
|
export { deviceNotFound } from "../devices/errors.js";
|
|
@@ -115,13 +116,10 @@ const opSignal = (lease) => AbortSignal.any([lease.signal, AbortSignal.timeout(S
|
|
|
115
116
|
/** The provider-side name of a device's file system and instance. */
|
|
116
117
|
export const deviceResourceName = (deviceId) => `cap-device-${deviceId}`;
|
|
117
118
|
/**
|
|
118
|
-
* The device's file system is gone at the provider (409); never replaced silently
|
|
119
|
-
*
|
|
120
|
-
* owner's: `capybara-device logout`, then `login` into the device, recreates it (ruling R24).
|
|
119
|
+
* The device's file system is gone at the provider (409); never replaced silently: the device's
|
|
120
|
+
* page resets its files where its provider offers that (its report's `reset`).
|
|
121
121
|
*/
|
|
122
|
-
export const deviceFilesLost = (
|
|
123
|
-
? new ApiError("device.files_lost", "The local device's directory is gone from its machine; run capybara-device logout, then capybara-device login into this device, on that machine to recreate it.", [{ source: "local" }])
|
|
124
|
-
: new ApiError("device.files_lost", "The device's files are gone; reset its files from the devices page to start with an empty workspace.");
|
|
122
|
+
export const deviceFilesLost = () => new ApiError("device.files_lost", "The device's files are gone; reset its files from the devices page to start with an empty workspace.");
|
|
125
123
|
/**
|
|
126
124
|
* A cloud sandbox provider refused to make (or move) an instance with the open public network
|
|
127
125
|
* (409; auto mode spec §4.2): a provider that cannot or is set not to offer it. The text is
|
|
@@ -141,12 +139,12 @@ export const sandboxCreateFailed = () => new ApiError("sandbox.create_failed", "
|
|
|
141
139
|
* tools handle them); any other error is logged (warn, redacted) and replaced by
|
|
142
140
|
* {@link sandboxOpenNetworkRefused} when `limits` ask for the open public network (the only
|
|
143
141
|
* network a provider's config refuses), else (a create) by {@link sandboxCreateFailed}; a failed
|
|
144
|
-
* `update` below the open network stays as it is. A
|
|
145
|
-
*
|
|
142
|
+
* `update` below the open network stays as it is. A dial-in device that is offline keeps its
|
|
143
|
+
* error (the tools tell the person to connect its machine).
|
|
146
144
|
*/
|
|
147
145
|
function providerRefusal(log, err, facts, limits, signal) {
|
|
148
146
|
if (signal.aborted ||
|
|
149
|
-
|
|
147
|
+
isDeviceOfflineError(err) ||
|
|
150
148
|
isSandboxGoneError(err) ||
|
|
151
149
|
isFileSystemGoneError(err) ||
|
|
152
150
|
err instanceof SandboxProviderUnreachableError ||
|
|
@@ -249,23 +247,12 @@ export class RetirementPendingError extends ApiError {
|
|
|
249
247
|
name = "RetirementPendingError";
|
|
250
248
|
}
|
|
251
249
|
export const retirementPending = () => new RetirementPendingError("device.unavailable", "This device is unavailable: background work started by an earlier version may still run on its previous instance, and that instance has not been confirmed destroyed. A cloud device becomes usable once its provider confirms the old instance destroyed.");
|
|
252
|
-
/**
|
|
253
|
-
* A local machine's old instance may still run legacy work, and a later boot of that machine is
|
|
254
|
-
* the evidence that ends it (503, 8.5): the person restarts the computer.
|
|
255
|
-
*/
|
|
256
|
-
export const restartRequired = () => new RetirementPendingError("device.restart_required", "Background work started by an earlier version may still be running on this computer. Restart this computer to finish the upgrade, then try again.");
|
|
257
250
|
/**
|
|
258
251
|
* A cloud device's earlier instance may still run legacy work and no evidence the kernel can get
|
|
259
252
|
* will ever cover it (an incarnation replaced without a recorded confirmed destruction, or an
|
|
260
253
|
* unknown one it cannot clear) (503, 8.5): the owner deletes the device and creates it again.
|
|
261
254
|
*/
|
|
262
255
|
export const recreateRequired = () => new RetirementPendingError("device.recreate_required", "Background work started by an earlier version may still be running on an earlier instance of this device, and that instance can no longer be verified as destroyed. Delete this device and create it again.");
|
|
263
|
-
/**
|
|
264
|
-
* A local machine's old instance may still run legacy work, and the computer never reported a
|
|
265
|
-
* boot identity, so not even a restart can prove it ended (503, 8.5): the owner replaces the
|
|
266
|
-
* device. A deleted device's obligations never block a new one.
|
|
267
|
-
*/
|
|
268
|
-
export const replaceRequired = () => new RetirementPendingError("device.replace_required", "Background work started by an earlier version may still be running on this computer, and it cannot prove a restart. Delete this device and connect the computer again as a new device.");
|
|
269
256
|
const isRetirementPending = (err) => err instanceof RetirementPendingError;
|
|
270
257
|
const abortReason = (signal) => signal.reason ?? new DOMException("This operation was aborted", "AbortError");
|
|
271
258
|
function sleep(ms, signal) {
|
|
@@ -320,6 +307,7 @@ let SandboxService = class SandboxService {
|
|
|
320
307
|
retirement;
|
|
321
308
|
snapshots;
|
|
322
309
|
reports;
|
|
310
|
+
relay;
|
|
323
311
|
constructor(db,
|
|
324
312
|
/** The record of the instance each holder last used (`capk:sandbox-seen:…`). */
|
|
325
313
|
redis, leases,
|
|
@@ -332,7 +320,12 @@ let SandboxService = class SandboxService {
|
|
|
332
320
|
/** The cloud snapshot writer's reconcile, for the lifecycle reconcile of marked devices (B-12). */
|
|
333
321
|
snapshots,
|
|
334
322
|
/** The stored device report, refreshed after a create or a resume (never fails the use). */
|
|
335
|
-
reports
|
|
323
|
+
reports,
|
|
324
|
+
/**
|
|
325
|
+
* The dial-in relay: a dial-in provider's device whose machine is not connected refuses a new
|
|
326
|
+
* operation before its dispatch is recorded (absent in hand-built services: not checked).
|
|
327
|
+
*/
|
|
328
|
+
relay) {
|
|
336
329
|
this.db = db;
|
|
337
330
|
this.redis = redis;
|
|
338
331
|
this.leases = leases;
|
|
@@ -347,6 +340,7 @@ let SandboxService = class SandboxService {
|
|
|
347
340
|
this.retirement = retirement;
|
|
348
341
|
this.snapshots = snapshots;
|
|
349
342
|
this.reports = reports;
|
|
343
|
+
this.relay = relay;
|
|
350
344
|
}
|
|
351
345
|
/** Poll interval while waiting for a lease (the leases' own). */
|
|
352
346
|
get pollMs() {
|
|
@@ -354,7 +348,7 @@ let SandboxService = class SandboxService {
|
|
|
354
348
|
}
|
|
355
349
|
/**
|
|
356
350
|
* Whether the device of `orgId` can be used now: its provider is loaded and on in the org
|
|
357
|
-
* ({@link DeviceProviderSelection.isOnInOrg}
|
|
351
|
+
* ({@link DeviceProviderSelection.isOnInOrg}). A missing device, one of
|
|
358
352
|
* another org or one without a provider is not.
|
|
359
353
|
*/
|
|
360
354
|
async availableFor(deviceId, orgId) {
|
|
@@ -362,7 +356,7 @@ let SandboxService = class SandboxService {
|
|
|
362
356
|
return provider != null && (await this.selection.isOnInOrg(orgId, provider));
|
|
363
357
|
}
|
|
364
358
|
/**
|
|
365
|
-
* Whether the provider the device is bound to is loaded here
|
|
359
|
+
* Whether the provider the device is bound to is loaded here, whatever
|
|
366
360
|
* its org says: for lifecycle work that goes on while the org has the provider off (owed
|
|
367
361
|
* revocations, cleanup).
|
|
368
362
|
*/
|
|
@@ -423,8 +417,8 @@ let SandboxService = class SandboxService {
|
|
|
423
417
|
}
|
|
424
418
|
/**
|
|
425
419
|
* The effective device policy of a device (auto mode spec §4.3): the platform's switch and the
|
|
426
|
-
* org's settings with the device's own mode (a
|
|
427
|
-
*
|
|
420
|
+
* org's settings with the device's own mode (a missing device has none). Without `deviceId`:
|
|
421
|
+
* an org-level policy with no choice.
|
|
428
422
|
*/
|
|
429
423
|
async devicePolicy(device) {
|
|
430
424
|
return this.facts.devicePolicy(device);
|
|
@@ -433,46 +427,26 @@ let SandboxService = class SandboxService {
|
|
|
433
427
|
async hostGrantCeiling(device) {
|
|
434
428
|
return (await this.facts.readDevice(device.orgId, device.deviceId)).hostCeiling;
|
|
435
429
|
}
|
|
436
|
-
/** The device's source (`local` for a connected machine, else `cloud`); cloud when unknown. */
|
|
437
|
-
async deviceSource(device) {
|
|
438
|
-
if (device.deviceId === undefined)
|
|
439
|
-
return "cloud";
|
|
440
|
-
const row = await this.db
|
|
441
|
-
.selectFrom("devices")
|
|
442
|
-
.select("source")
|
|
443
|
-
.where("id", "=", device.deviceId)
|
|
444
|
-
.where("org_id", "=", device.orgId)
|
|
445
|
-
.executeTakeFirst();
|
|
446
|
-
return row?.source === "local" ? "local" : "cloud";
|
|
447
|
-
}
|
|
448
430
|
/**
|
|
449
|
-
* The device's effective sandbox limits (spec §8.4; auto mode spec §4.2)
|
|
450
|
-
* `sandbox.limits` resources, cpu / memory per the super admin's org
|
|
451
|
-
* M16), the effective mode and the device sandbox network
|
|
452
|
-
*
|
|
453
|
-
*
|
|
431
|
+
* The device's effective sandbox limits (spec §8.4; auto mode spec §4.2), the same for every
|
|
432
|
+
* provider: the deployment's `sandbox.limits` resources, cpu / memory per the super admin's org
|
|
433
|
+
* override (C19 / Ruling M16), the effective mode and the device's sandbox network
|
|
434
|
+
* ({@link devicePolicy}: its own `devices.network_*` within the platform's and the org's
|
|
435
|
+
* ceilings). An operation-boundary provider also gets each operation's network in its scope.
|
|
436
|
+
* `opts.policy`: what the caller already read (avoids the policy queries).
|
|
454
437
|
*/
|
|
455
438
|
async deviceLimits(device, opts = {}) {
|
|
456
439
|
const cfg = this.config.get().sandbox;
|
|
457
|
-
const [policy, override
|
|
440
|
+
const [policy, override] = await Promise.all([
|
|
458
441
|
opts.policy ?? this.devicePolicy(device),
|
|
459
442
|
readSandboxLimitOverride(this.db.db, device.orgId),
|
|
460
|
-
opts.source ?? this.deviceSource(device),
|
|
461
443
|
]);
|
|
462
|
-
const local = source === "local";
|
|
463
|
-
// a local device's commands carry its device sandbox network (under the machine's current
|
|
464
|
-
// runtime report, as admission reads it); the machine intersects it with its owner's ceiling
|
|
465
|
-
const network = local && device.deviceId !== undefined
|
|
466
|
-
? networkOfSandbox(await this.facts.deviceSandbox(device.orgId, device.deviceId))
|
|
467
|
-
: policy.network;
|
|
468
444
|
return effectiveSandboxLimits({
|
|
469
445
|
cpu: cfg.limits.cpu,
|
|
470
446
|
memoryMb: cfg.limits.memoryMb,
|
|
471
447
|
diskMb: cfg.limits.diskMb,
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
mode: local ? policy.allowedMode : policy.mode,
|
|
475
|
-
network: { kind: network.kind, hosts: [...network.hosts] },
|
|
448
|
+
mode: policy.mode,
|
|
449
|
+
network: { kind: policy.network.kind, hosts: [...policy.network.hosts] },
|
|
476
450
|
}, override);
|
|
477
451
|
}
|
|
478
452
|
/**
|
|
@@ -501,11 +475,12 @@ let SandboxService = class SandboxService {
|
|
|
501
475
|
}
|
|
502
476
|
/**
|
|
503
477
|
* Why a per-call host grant for each host is unavailable on the device, naming who can add it
|
|
504
|
-
* (`hostGrantRefusal`; null: grantable): a network ask is made only for a grantable host
|
|
478
|
+
* (`hostGrantRefusal`; null: grantable): a network ask is made only for a grantable host, and
|
|
479
|
+
* only on a device whose provider enforces an allowlist (`allowlist`, from its support).
|
|
505
480
|
*/
|
|
506
481
|
async hostRefusal(device) {
|
|
507
482
|
const facts = await this.facts.deviceSandboxFacts(device.orgId, device.deviceId);
|
|
508
|
-
return { refusal: facts.refusal, box: facts.box };
|
|
483
|
+
return { refusal: facts.refusal, box: facts.box, allowlist: facts.allowlist };
|
|
509
484
|
}
|
|
510
485
|
/**
|
|
511
486
|
* The limits state of a device's instance for its page (auto mode spec §4.2), read without a
|
|
@@ -514,8 +489,7 @@ let SandboxService = class SandboxService {
|
|
|
514
489
|
* `pendingNextUse`: a cloud instance exists and differs; its next use applies the new limits
|
|
515
490
|
* (files kept). `pendingFilesReset`: the provider fixes limits at its file system
|
|
516
491
|
* (`limitsApplyAt: "fileSystem"`) and cannot `update` them, so only a file reset applies them.
|
|
517
|
-
*
|
|
518
|
-
* its `applied` is null. `opts.policy`: the device's effective policy when the caller already
|
|
492
|
+
* `opts.policy`: the device's effective policy when the caller already
|
|
519
493
|
* read it ({@link devicePolicy}).
|
|
520
494
|
*/
|
|
521
495
|
async limitsState(device, opts = {}) {
|
|
@@ -533,7 +507,7 @@ let SandboxService = class SandboxService {
|
|
|
533
507
|
mode: policy.mode,
|
|
534
508
|
network: policy.network,
|
|
535
509
|
});
|
|
536
|
-
if (p === undefined ||
|
|
510
|
+
if (p === undefined || row === undefined) {
|
|
537
511
|
return { applied: null, effective, pendingNextUse: false, pendingFilesReset: false };
|
|
538
512
|
}
|
|
539
513
|
const rec = readInstanceLimits(row.instance_limits);
|
|
@@ -563,12 +537,9 @@ let SandboxService = class SandboxService {
|
|
|
563
537
|
* widening still reaches instances created afterwards), unless only a file reset could apply it
|
|
564
538
|
* ({@link fsBound}). A provider bound to its file system still goes through the exclusive lease
|
|
565
539
|
* once for a narrowing, so `applyLimits` records it as `unapplied` (the device is then unprobed
|
|
566
|
-
* until the reset, never silently supported).
|
|
567
|
-
* with each command).
|
|
540
|
+
* until the reset, never silently supported).
|
|
568
541
|
*/
|
|
569
542
|
mustApply(row, p, want) {
|
|
570
|
-
if (want === null)
|
|
571
|
-
return false;
|
|
572
543
|
const rec = readInstanceLimits(row.instance_limits);
|
|
573
544
|
const target = appliedOf(want);
|
|
574
545
|
const wider = appliedWider(rec.applied, target);
|
|
@@ -660,10 +631,6 @@ let SandboxService = class SandboxService {
|
|
|
660
631
|
// admission there; only exact-ref managed drains go on (I1)
|
|
661
632
|
if (!instance.exactRef && (await this.retirement.hasUnresolved(env)))
|
|
662
633
|
throw retirementPending();
|
|
663
|
-
// staged owner browse never reaches an instance whose binding is not installed (B-8): the
|
|
664
|
-
// device admits nothing there, and only a use's exclusive holder binds it
|
|
665
|
-
if (use && !(await this.bound(p, env)))
|
|
666
|
-
return { kind: "not_running", status: row.status };
|
|
667
634
|
// the instance this check saw: its handle plus `created_at` (never `generation`, which
|
|
668
635
|
// every lease bumps)
|
|
669
636
|
const want = { handle: row.handle, createdAt: row.created_at.getTime() };
|
|
@@ -804,7 +771,7 @@ let SandboxService = class SandboxService {
|
|
|
804
771
|
* owner browse ({@link withBrowse}) of a device that may be stopped: the owner, membership and
|
|
805
772
|
* browsing ceiling checks of the browse first (`resolveBrowse`), then the lifecycle `enter` a
|
|
806
773
|
* use takes (the exclusive lease creates or resumes the instance through the retirement gate,
|
|
807
|
-
* the B-11 reconcile marker,
|
|
774
|
+
* the B-11 reconcile marker, `maxRunningSandboxes` and fencing), and the lease
|
|
808
775
|
* is left at once. No conversation holds it and nothing runs in it; what the start caused is
|
|
809
776
|
* not marked seen, so each conversation's next use still learns of it.
|
|
810
777
|
*/
|
|
@@ -817,7 +784,7 @@ let SandboxService = class SandboxService {
|
|
|
817
784
|
holderConversationId: OWNER_START_HOLDER,
|
|
818
785
|
actor: { accountId: ctx.accountId, conversationId: OWNER_START_HOLDER },
|
|
819
786
|
};
|
|
820
|
-
const e = await this.enter(use, p, signal, null, () => this.wantedLimits(use
|
|
787
|
+
const e = await this.enter(use, p, signal, null, () => this.wantedLimits(use));
|
|
821
788
|
await this.leave(ctx.deviceId, e);
|
|
822
789
|
}
|
|
823
790
|
/**
|
|
@@ -829,7 +796,7 @@ let SandboxService = class SandboxService {
|
|
|
829
796
|
*/
|
|
830
797
|
async ensureRunning(use, signal) {
|
|
831
798
|
const p = await this.require(use.deviceId, use.orgId);
|
|
832
|
-
const e = await this.enter(use, p, signal, null, () => this.wantedLimits(use
|
|
799
|
+
const e = await this.enter(use, p, signal, null, () => this.wantedLimits(use));
|
|
833
800
|
try {
|
|
834
801
|
await this.deferNotice(use.deviceId, use.holderConversationId, e);
|
|
835
802
|
}
|
|
@@ -868,7 +835,7 @@ let SandboxService = class SandboxService {
|
|
|
868
835
|
const holder = ctx.holderConversationId;
|
|
869
836
|
// decides the shared fast path only (read again before each shared lease is used): the
|
|
870
837
|
// exclusive path reads it again under the lease
|
|
871
|
-
const want = () => this.wantedLimits(ctx
|
|
838
|
+
const want = () => this.wantedLimits(ctx);
|
|
872
839
|
const seen = (x) => ctx.silent ? this.deferNotice(env, holder, x) : this.seenBy(env, holder, x);
|
|
873
840
|
let e = await seen(await this.enter(ctx, p, signal, null, want));
|
|
874
841
|
let left = false;
|
|
@@ -930,15 +897,12 @@ let SandboxService = class SandboxService {
|
|
|
930
897
|
}
|
|
931
898
|
}
|
|
932
899
|
/**
|
|
933
|
-
* The limits a
|
|
934
|
-
*
|
|
935
|
-
*
|
|
900
|
+
* The limits a device's instance must run with for this use (auto mode spec §4.2), read fresh,
|
|
901
|
+
* the same for every provider. A scheduled run has no separate mode grant: the effective policy
|
|
902
|
+
* applies to it as to any use.
|
|
936
903
|
*/
|
|
937
|
-
async wantedLimits(
|
|
938
|
-
|
|
939
|
-
return null;
|
|
940
|
-
const policy = await this.devicePolicy(_ctx);
|
|
941
|
-
return await this.deviceLimits(_ctx, { policy, source: "cloud" });
|
|
904
|
+
async wantedLimits(ctx) {
|
|
905
|
+
return await this.deviceLimits(ctx);
|
|
942
906
|
}
|
|
943
907
|
/**
|
|
944
908
|
* Ruling R24: an operation on the held instance `e` found its file system gone. Records
|
|
@@ -965,7 +929,7 @@ let SandboxService = class SandboxService {
|
|
|
965
929
|
catch (err) {
|
|
966
930
|
this.log.warn("cannot record lost device files", { deviceId: env, err });
|
|
967
931
|
}
|
|
968
|
-
return deviceFilesLost(
|
|
932
|
+
return deviceFilesLost();
|
|
969
933
|
}
|
|
970
934
|
/**
|
|
971
935
|
* A silent use ({@link SandboxUseContext.silent}) of `holder`: the seen record is left alone, so
|
|
@@ -1061,8 +1025,8 @@ let SandboxService = class SandboxService {
|
|
|
1061
1025
|
if (kernelRead)
|
|
1062
1026
|
return fn(e.handle, this.kernelReadProvider(e, ctx, p, kernelRead, sig), { ...e.info, roots: rootsOf(e.handle) }, sig);
|
|
1063
1027
|
let ordinal = 0;
|
|
1064
|
-
// a
|
|
1065
|
-
const held =
|
|
1028
|
+
// a provider's background starts are told the held instance's kernel generation
|
|
1029
|
+
const held = withKernelGeneration(p.impl, String(e.createdAt));
|
|
1066
1030
|
const impl = invocation
|
|
1067
1031
|
? createHeldOperations(held, e.handle, sig, async (method, input, invoke, preflight) => {
|
|
1068
1032
|
const identity = { ...invocation, ordinal: ordinal++ };
|
|
@@ -1108,7 +1072,12 @@ let SandboxService = class SandboxService {
|
|
|
1108
1072
|
throw error;
|
|
1109
1073
|
}
|
|
1110
1074
|
}
|
|
1111
|
-
const
|
|
1075
|
+
const reconciling = ["dispatching", "started-or-unknown"].includes(pending.state);
|
|
1076
|
+
// a dial-in device's machine must be connected before a new dispatch is recorded: its
|
|
1077
|
+
// typed answer (offline, machine revoked, device deleted) proves nothing was sent
|
|
1078
|
+
if (!reconciling && current.state === "admitted" && this.relay && servesDialIn(p))
|
|
1079
|
+
await this.relay.connection(env);
|
|
1080
|
+
const admitted = reconciling
|
|
1112
1081
|
? await runOutsideTransaction(() => this.operationIntents.claimReconciliation(ctx, identity, {
|
|
1113
1082
|
provider: p.plugin,
|
|
1114
1083
|
providerVersion: p.version,
|
|
@@ -1248,29 +1217,17 @@ let SandboxService = class SandboxService {
|
|
|
1248
1217
|
}
|
|
1249
1218
|
async readHeldContextEvidence(ctx, p, e) {
|
|
1250
1219
|
const instanceGeneration = String(e.createdAt);
|
|
1251
|
-
//
|
|
1252
|
-
//
|
|
1253
|
-
// desired; otherwise the device is unavailable for managed work, not a
|
|
1254
|
-
|
|
1255
|
-
const applied =
|
|
1256
|
-
|
|
1257
|
-
:
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
return undefined;
|
|
1263
|
-
const binding = applied
|
|
1264
|
-
? { binding_id: applied.bindingId }
|
|
1265
|
-
: await this.db
|
|
1266
|
-
.selectFrom("device_instance_bindings")
|
|
1267
|
-
.select("binding_id")
|
|
1268
|
-
.where("device_id", "=", ctx.deviceId)
|
|
1269
|
-
.where("instance_generation", "=", instanceGeneration)
|
|
1270
|
-
.where("provider", "=", p.plugin)
|
|
1271
|
-
.where("status", "=", "installed")
|
|
1272
|
-
.executeTakeFirst();
|
|
1273
|
-
if (!binding)
|
|
1220
|
+
// the instance is named by its installed environment as the managed writer reads it under the
|
|
1221
|
+
// authority locks (B-15), the same for every provider: current evidence, nothing unapplied,
|
|
1222
|
+
// nothing wider than desired; otherwise the device is unavailable for managed work, not a
|
|
1223
|
+
// stale retry
|
|
1224
|
+
const applied = await this.facts.readHeldEnvironment({
|
|
1225
|
+
orgId: ctx.orgId,
|
|
1226
|
+
deviceId: ctx.deviceId,
|
|
1227
|
+
});
|
|
1228
|
+
if (applied === null ||
|
|
1229
|
+
applied.provider !== p.plugin ||
|
|
1230
|
+
applied.instanceGeneration !== instanceGeneration)
|
|
1274
1231
|
return undefined;
|
|
1275
1232
|
let workingRoot;
|
|
1276
1233
|
try {
|
|
@@ -1291,7 +1248,7 @@ let SandboxService = class SandboxService {
|
|
|
1291
1248
|
provider: p.plugin,
|
|
1292
1249
|
instanceId: e.handle.id,
|
|
1293
1250
|
instanceGeneration,
|
|
1294
|
-
|
|
1251
|
+
revision: applied.revision,
|
|
1295
1252
|
roots: { workspace: roots.workspace, skills: roots.skills, tmp: roots.tmp },
|
|
1296
1253
|
workingRoot,
|
|
1297
1254
|
};
|
|
@@ -1320,11 +1277,8 @@ let SandboxService = class SandboxService {
|
|
|
1320
1277
|
// an instance whose mode or network must change goes through the exclusive lease
|
|
1321
1278
|
const ready = (r) => this.usable(r, p, gone) && !this.mustApply(r, p, want);
|
|
1322
1279
|
// a device with an unresolved retirement obligation is only entered through the
|
|
1323
|
-
// exclusive lease, whose gate retires the old incarnation or refuses (8.5)
|
|
1324
|
-
|
|
1325
|
-
if (!(await this.retirement.hasUnresolved(env)) &&
|
|
1326
|
-
ready(row) &&
|
|
1327
|
-
(await this.bound(p, env))) {
|
|
1280
|
+
// exclusive lease, whose gate retires the old incarnation or refuses (8.5)
|
|
1281
|
+
if (!(await this.retirement.hasUnresolved(env)) && ready(row)) {
|
|
1328
1282
|
const lease = await this.leases.tryShared(env, this.cap, token);
|
|
1329
1283
|
if (lease) {
|
|
1330
1284
|
if (intent)
|
|
@@ -1368,16 +1322,11 @@ let SandboxService = class SandboxService {
|
|
|
1368
1322
|
}
|
|
1369
1323
|
}
|
|
1370
1324
|
/**
|
|
1371
|
-
* Whether this
|
|
1372
|
-
*
|
|
1373
|
-
* installed binding instead.
|
|
1325
|
+
* Whether the lifecycle records this provider's instances' evidence (B-15): a provider (with a
|
|
1326
|
+
* known version) that reads its own permission support, the same for every device.
|
|
1374
1327
|
*/
|
|
1375
|
-
|
|
1376
|
-
return
|
|
1377
|
-
!p.binder &&
|
|
1378
|
-
p.version !== undefined &&
|
|
1379
|
-
typeof p.impl.permissionSupport === "function" &&
|
|
1380
|
-
(await this.deviceSource(ctx)) === "cloud");
|
|
1328
|
+
recordsSupport(p) {
|
|
1329
|
+
return p.version !== undefined && typeof p.impl.permissionSupport === "function";
|
|
1381
1330
|
}
|
|
1382
1331
|
/**
|
|
1383
1332
|
* The provider's permission support of the held instance `handle`, read under the caller's
|
|
@@ -1393,7 +1342,7 @@ let SandboxService = class SandboxService {
|
|
|
1393
1342
|
let failure;
|
|
1394
1343
|
try {
|
|
1395
1344
|
const sig = AbortSignal.any([signal, AbortSignal.timeout(PERMISSION_SUPPORT_TIMEOUT_MS)]);
|
|
1396
|
-
const report =
|
|
1345
|
+
const report = supportOf(await read(handle, sig));
|
|
1397
1346
|
if (report)
|
|
1398
1347
|
return { provider: p.plugin, version: p.version, report };
|
|
1399
1348
|
failure = { message: "cloud provider returned an invalid permission support report" };
|
|
@@ -1432,9 +1381,9 @@ let SandboxService = class SandboxService {
|
|
|
1432
1381
|
*/
|
|
1433
1382
|
async refreshCloudSupport(ctx, p, e, signal, force) {
|
|
1434
1383
|
try {
|
|
1435
|
-
if (!
|
|
1384
|
+
if (!this.recordsSupport(p))
|
|
1436
1385
|
return;
|
|
1437
|
-
if (!force && !(await
|
|
1386
|
+
if (!force && !(await reportOwed(this.db.db, ctx.deviceId, p.plugin, p.version)))
|
|
1438
1387
|
return;
|
|
1439
1388
|
const row = await this.db
|
|
1440
1389
|
.selectFrom("device_instances")
|
|
@@ -1446,9 +1395,9 @@ let SandboxService = class SandboxService {
|
|
|
1446
1395
|
const held = { ...e, limits: row.instance_limits };
|
|
1447
1396
|
const support = await this.cloudSupport(ctx.deviceId, p, e.handle, signal, String(e.createdAt));
|
|
1448
1397
|
if (support)
|
|
1449
|
-
await runOutsideTransaction(() => this.instanceWrites.
|
|
1398
|
+
await runOutsideTransaction(() => this.instanceWrites.recordSupport(ctx.orgId, ctx.deviceId, held, support, signal));
|
|
1450
1399
|
else if (force && !signal.aborted)
|
|
1451
|
-
await runOutsideTransaction(() => this.instanceWrites.
|
|
1400
|
+
await runOutsideTransaction(() => this.instanceWrites.clearSupport(ctx.orgId, ctx.deviceId, held, p.plugin));
|
|
1452
1401
|
}
|
|
1453
1402
|
catch (err) {
|
|
1454
1403
|
if (!signal.aborted)
|
|
@@ -1459,10 +1408,6 @@ let SandboxService = class SandboxService {
|
|
|
1459
1408
|
});
|
|
1460
1409
|
}
|
|
1461
1410
|
}
|
|
1462
|
-
/** No binder (protocol 2), or the current generation's binding is installed (B-8). */
|
|
1463
|
-
async bound(p, env) {
|
|
1464
|
-
return !p.binder || (await p.binder.status(env)) === "installed";
|
|
1465
|
-
}
|
|
1466
1411
|
async clearIntent(env, token) {
|
|
1467
1412
|
await this.leases
|
|
1468
1413
|
.clearIntent(env, token)
|
|
@@ -1507,9 +1452,7 @@ let SandboxService = class SandboxService {
|
|
|
1507
1452
|
/**
|
|
1508
1453
|
* Checked under the lease (which the B1 snapshot writer's exclusive lease excludes) before
|
|
1509
1454
|
* anything is revoked or bumped: `reconciled` and `use` refuse a device carrying the
|
|
1510
|
-
* reconcile marker (B-11)
|
|
1511
|
-
* while the instance's binding is not installed, so the caller binds it exclusively (B-8).
|
|
1512
|
-
* `none` for background polls, stops and drains.
|
|
1455
|
+
* reconcile marker (B-11). `none` for background polls, stops and drains.
|
|
1513
1456
|
*/
|
|
1514
1457
|
check = "none") {
|
|
1515
1458
|
const env = ctx.deviceId;
|
|
@@ -1521,10 +1464,6 @@ let SandboxService = class SandboxService {
|
|
|
1521
1464
|
}
|
|
1522
1465
|
if (check !== "none")
|
|
1523
1466
|
await this.facts.assertCloudReconciled(ctx.orgId, env);
|
|
1524
|
-
if (check === "use" && !(await this.bound(p, env))) {
|
|
1525
|
-
await lease.release();
|
|
1526
|
-
return null;
|
|
1527
|
-
}
|
|
1528
1467
|
// Bump the fence as every acquisition did before phase C: an exclusive holder whose lease
|
|
1529
1468
|
// expired unnoticed (a stalled sweep) then fails its next write instead of suspending or
|
|
1530
1469
|
// destroying the instance under this holder. Shared holders never compare it.
|
|
@@ -1569,25 +1508,15 @@ let SandboxService = class SandboxService {
|
|
|
1569
1508
|
// the dead holders' records are forgotten only after their revocation is owed (on a fresh
|
|
1570
1509
|
// instance too: their intents still name them); a resume delivers what `ensure` revoked
|
|
1571
1510
|
await this.takeOver(env, { provider: p.plugin, generation: String(s.createdAt) }, s.handle, p, signal, lease, s.resumed === true);
|
|
1572
|
-
//
|
|
1573
|
-
//
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
// lease and outside any transaction; a failure keeps the stored one and never fails the use
|
|
1577
|
-
if (s.info.fresh || s.resumed === true)
|
|
1511
|
+
// a resumed instance: the provider's report is stored again (a new one stored it at its
|
|
1512
|
+
// create), still under the exclusive lease and outside any transaction, before the support
|
|
1513
|
+
// whose identity names its revision; a failure keeps the stored one and never fails the use
|
|
1514
|
+
if (s.resumed === true)
|
|
1578
1515
|
await runOutsideTransaction(() => this.reports.refresh(p, { deviceId: env, orgId: ctx.orgId, handle: s.handle }, sig));
|
|
1579
|
-
//
|
|
1580
|
-
//
|
|
1581
|
-
//
|
|
1582
|
-
|
|
1583
|
-
// outside any transaction; a failure releases the lease.
|
|
1584
|
-
const binder = p.binder;
|
|
1585
|
-
if (binder)
|
|
1586
|
-
await runOutsideTransaction(() => binder.bind(env, sig)).catch((err) => {
|
|
1587
|
-
// the caller's answer may be generic: the device's own refusal is kept for ops here
|
|
1588
|
-
this.log.warn("cannot bind the device's instance", { deviceId: env, err });
|
|
1589
|
-
throw err;
|
|
1590
|
-
});
|
|
1516
|
+
// B-15: a resumed instance reads its permission support again; any other instance whose
|
|
1517
|
+
// recorded evidence is stale (a limits change, a provider version change, a new report
|
|
1518
|
+
// revision) too
|
|
1519
|
+
await this.refreshCloudSupport(ctx, p, s, sig, s.resumed === true);
|
|
1591
1520
|
const shared = await lease.downgrade();
|
|
1592
1521
|
await this.register(env, shared.token);
|
|
1593
1522
|
return {
|
|
@@ -1771,9 +1700,9 @@ let SandboxService = class SandboxService {
|
|
|
1771
1700
|
*/
|
|
1772
1701
|
async suspendIdle(now) {
|
|
1773
1702
|
let n = 0;
|
|
1774
|
-
// each
|
|
1775
|
-
//
|
|
1776
|
-
for (const p of this.providers.
|
|
1703
|
+
// each provider over its own rows only; rows of a provider that is not loaded are left as
|
|
1704
|
+
// they are
|
|
1705
|
+
for (const p of this.providers.all())
|
|
1777
1706
|
n += await this.suspendIdleOf(p, now);
|
|
1778
1707
|
return n;
|
|
1779
1708
|
}
|
|
@@ -1818,24 +1747,19 @@ let SandboxService = class SandboxService {
|
|
|
1818
1747
|
* (the instance only; the file system is kept and the next use builds a new instance on it); an
|
|
1819
1748
|
* device that was deleted, or whose org was deleted, loses its instance and its file system
|
|
1820
1749
|
* and its row is deleted (as {@link destroyDevice} does). Devices with any holder are
|
|
1821
|
-
* skipped.
|
|
1822
|
-
*
|
|
1823
|
-
* hourly by the `sandbox-destroy-inactive` cron.
|
|
1750
|
+
* skipped. Each provider sweeps its own rows the same way. Returns how many it destroyed.
|
|
1751
|
+
* Called hourly by the `sandbox-destroy-inactive` cron.
|
|
1824
1752
|
*/
|
|
1825
1753
|
async destroyInactive(now) {
|
|
1826
|
-
const
|
|
1827
|
-
const local = this.providers.forDevice(LOCAL_PROVIDER);
|
|
1754
|
+
const providers = this.providers.all();
|
|
1828
1755
|
let n = 0;
|
|
1829
|
-
// Gone devices (deleted, or of a deleted org), each provider over its own rows
|
|
1830
|
-
//
|
|
1831
|
-
|
|
1832
|
-
for (const p of local ? [...loaded, local] : loaded) {
|
|
1756
|
+
// Gone devices (deleted, or of a deleted org), each provider over its own rows; rows of a
|
|
1757
|
+
// provider that is not loaded wait, untouched.
|
|
1758
|
+
for (const p of providers) {
|
|
1833
1759
|
n += await this.sweepRows(p, (eb) => this.deviceGone(eb), "device");
|
|
1834
1760
|
}
|
|
1835
|
-
// inactivity destroys instances of loaded extension providers only: `@local` instances are
|
|
1836
|
-
// never swept
|
|
1837
1761
|
const due = this.instanceDue(now);
|
|
1838
|
-
for (const p of
|
|
1762
|
+
for (const p of providers)
|
|
1839
1763
|
n += await this.sweepRows(p, due, "instance");
|
|
1840
1764
|
return n;
|
|
1841
1765
|
}
|
|
@@ -2039,7 +1963,6 @@ let SandboxService = class SandboxService {
|
|
|
2039
1963
|
!fence ||
|
|
2040
1964
|
!p ||
|
|
2041
1965
|
!update ||
|
|
2042
|
-
p.plugin === LOCAL_PROVIDER ||
|
|
2043
1966
|
row.provider !== p.plugin ||
|
|
2044
1967
|
device.provider !== p.plugin ||
|
|
2045
1968
|
row.fs_status !== "ready" ||
|
|
@@ -2048,7 +1971,7 @@ let SandboxService = class SandboxService {
|
|
|
2048
1971
|
const handle = row.handle;
|
|
2049
1972
|
// the effective limits with their resources, read under the lease: exactly the target, or
|
|
2050
1973
|
// the authority moved since the reconcile (the next round sees it)
|
|
2051
|
-
const want = await this.deviceLimits({ orgId, deviceId }
|
|
1974
|
+
const want = await this.deviceLimits({ orgId, deviceId });
|
|
2052
1975
|
if (!sameAppliedExactly(appliedOf(want), before.target))
|
|
2053
1976
|
return before;
|
|
2054
1977
|
const sig = AbortSignal.any([signal, opSignal(lease)]);
|
|
@@ -2121,7 +2044,6 @@ let SandboxService = class SandboxService {
|
|
|
2121
2044
|
.selectFrom("devices as d")
|
|
2122
2045
|
.innerJoin("device_instances as i", "i.device_id", "d.id")
|
|
2123
2046
|
.select("d.id")
|
|
2124
|
-
.where("d.source", "=", "cloud")
|
|
2125
2047
|
.where("d.deleted_at", "is", null)
|
|
2126
2048
|
.where("d.permission_reconcile_required", "=", true)
|
|
2127
2049
|
.where("d.provider", "=", p.plugin)
|
|
@@ -2175,12 +2097,11 @@ let SandboxService = class SandboxService {
|
|
|
2175
2097
|
* before the instance is used, resumed, rebuilt, switched to another provider, bound or
|
|
2176
2098
|
* downgraded to shared use: every unresolved obligation of the device is settled here or the
|
|
2177
2099
|
* device is unavailable ({@link retirementPending}).
|
|
2178
|
-
* - The obligation names the **current** incarnation (provider and exact generation):
|
|
2179
|
-
*
|
|
2180
|
-
* kept), the confirmed destruction is recorded and the row reads
|
|
2181
|
-
* creates a fresh instance; a failed destroy keeps the obligation.
|
|
2182
|
-
*
|
|
2183
|
-
* - B-22: a **suspended** current cloud incarnation whose members are all revoked managed starts
|
|
2100
|
+
* - The obligation names the **current** incarnation (provider and exact generation): it is
|
|
2101
|
+
* destroyed whole by its provider, whatever the provider (never resumed, never `killAll`ed,
|
|
2102
|
+
* the file system kept), the confirmed destruction is recorded and the row reads
|
|
2103
|
+
* `destroyed`, so the use creates a fresh instance; a failed destroy keeps the obligation.
|
|
2104
|
+
* - B-22: a **suspended** current incarnation whose members are all revoked managed starts
|
|
2184
2105
|
* is not destroyed whole (its other tasks would be lost): each revoked ref gets its exact stop
|
|
2185
2106
|
* (persisted while suspended), the instance is resumed, each stop is confirmed (`stopped` or
|
|
2186
2107
|
* `already-exited`), and the obligation resolves as `exact-cancelled`. Any failure is noted on
|
|
@@ -2195,21 +2116,16 @@ let SandboxService = class SandboxService {
|
|
|
2195
2116
|
async retireIncarnations(id, held, row, fence, signal,
|
|
2196
2117
|
/** A use's holder: a gate that resumed the instance (B-22) leaves it running and says so. */
|
|
2197
2118
|
resumed) {
|
|
2198
|
-
// the device's own candidates first: the gate never depends on the worker having scanned
|
|
2199
|
-
// (C1); then a later boot an authenticated hello already reported settles local ones
|
|
2119
|
+
// the device's own candidates first: the gate never depends on the worker having scanned (C1)
|
|
2200
2120
|
await this.retirement.scanUntilStable(5, id);
|
|
2201
|
-
await this.retirement.settleRebooted(id);
|
|
2202
2121
|
const open = await this.retirement.unresolved(id);
|
|
2203
2122
|
let now = row;
|
|
2204
2123
|
// every obligation is tried (one that stays never hides another that can resolve); the
|
|
2205
2124
|
// device is refused at the end while any stays, with the answer that tells what would help:
|
|
2206
|
-
// a failed or impossible destroy now → unavailable (a retry may succeed);
|
|
2207
|
-
//
|
|
2208
|
-
// a boot → replace the device; else only a restart of the computer is missing
|
|
2125
|
+
// a failed or impossible destroy now → unavailable (a retry may succeed); an incarnation no
|
|
2126
|
+
// evidence can ever cover → recreate the device
|
|
2209
2127
|
let pending = false;
|
|
2210
2128
|
let failed = false;
|
|
2211
|
-
let cloudPermanent = false;
|
|
2212
|
-
let unknownBoot = false;
|
|
2213
2129
|
const isLive = (r) => r !== undefined &&
|
|
2214
2130
|
r.handle !== null &&
|
|
2215
2131
|
(r.status === "running" || r.status === "suspended" || r.status === "creating");
|
|
@@ -2227,7 +2143,7 @@ let SandboxService = class SandboxService {
|
|
|
2227
2143
|
* reason is noted, the destroy follows).
|
|
2228
2144
|
*/
|
|
2229
2145
|
const cancelOnResume = async (o, live) => {
|
|
2230
|
-
if (live.status !== "suspended" || !
|
|
2146
|
+
if (live.status !== "suspended" || !isKnownProvider(o.provider))
|
|
2231
2147
|
return "skip";
|
|
2232
2148
|
const impl = this.providers.forDevice(o.provider)?.impl;
|
|
2233
2149
|
const background = impl?.background;
|
|
@@ -2320,7 +2236,7 @@ let SandboxService = class SandboxService {
|
|
|
2320
2236
|
*/
|
|
2321
2237
|
const destroyLive = async (o, live) => {
|
|
2322
2238
|
const provider = live.provider ?? "unknown";
|
|
2323
|
-
const impl =
|
|
2239
|
+
const impl = isKnownProvider(provider) ? this.providers.forDevice(provider)?.impl : undefined;
|
|
2324
2240
|
if (!impl) {
|
|
2325
2241
|
await this.retirement.noteFailure(o.id, `provider ${provider} is not loaded`);
|
|
2326
2242
|
return false;
|
|
@@ -2372,7 +2288,7 @@ let SandboxService = class SandboxService {
|
|
|
2372
2288
|
*/
|
|
2373
2289
|
const destroyNamed = async (o, row) => {
|
|
2374
2290
|
const provider = row.provider ?? "unknown";
|
|
2375
|
-
const impl =
|
|
2291
|
+
const impl = isKnownProvider(provider) ? this.providers.forDevice(provider)?.impl : undefined;
|
|
2376
2292
|
if (!impl) {
|
|
2377
2293
|
await this.retirement.noteFailure(o.id, `provider ${provider} is not loaded`);
|
|
2378
2294
|
return false;
|
|
@@ -2416,18 +2332,8 @@ let SandboxService = class SandboxService {
|
|
|
2416
2332
|
try {
|
|
2417
2333
|
for (const o of open) {
|
|
2418
2334
|
const gen = o.instanceGeneration;
|
|
2419
|
-
const local = isInternalProvider(o.provider);
|
|
2420
2335
|
const current = isLive(now) && now.provider === o.provider && String(now.created_at.getTime()) === gen;
|
|
2421
2336
|
if (current && isLive(now)) {
|
|
2422
|
-
if (local) {
|
|
2423
|
-
await this.retirement.quarantine(o.id, o.bootId === null
|
|
2424
|
-
? "local instance: no boot identity was reported, so no restart can prove its legacy work ended"
|
|
2425
|
-
: "local instance: waiting for a restart of the computer (a later boot identity)");
|
|
2426
|
-
if (o.bootId === null)
|
|
2427
|
-
unknownBoot = true;
|
|
2428
|
-
pending = true;
|
|
2429
|
-
continue;
|
|
2430
|
-
}
|
|
2431
2337
|
let cancel = await cancelOnResume(o, now);
|
|
2432
2338
|
if (cancel !== "skip" && "cancelled" in cancel) {
|
|
2433
2339
|
// resolved only while no member outside the stopped refs exists (a concurrent scan's)
|
|
@@ -2457,13 +2363,13 @@ let SandboxService = class SandboxService {
|
|
|
2457
2363
|
now.provider === o.provider &&
|
|
2458
2364
|
String(now.created_at.getTime()) === gen &&
|
|
2459
2365
|
now.prev_handle === null &&
|
|
2460
|
-
|
|
2366
|
+
isKnownProvider(o.provider);
|
|
2461
2367
|
if (destroyedHere || (await this.retirement.destructionRecorded(id, o.provider, gen))) {
|
|
2462
2368
|
await this.retirement.resolveDestroyed(o.id);
|
|
2463
2369
|
continue;
|
|
2464
2370
|
}
|
|
2465
|
-
if (
|
|
2466
|
-
// R1-I1 (b):
|
|
2371
|
+
if (gen === "unknown" || o.provider === "unknown") {
|
|
2372
|
+
// R1-I1 (b): an incarnation the kernel cannot name. Every incarnation the device had
|
|
2467
2373
|
// stopped being current through a kernel destroy, a provider `gone` or a kept
|
|
2468
2374
|
// `prev_handle`; so once the device's current incarnation is destroyed with
|
|
2469
2375
|
// confirmation, nothing earlier is kept (`prev_handle`) and the obligation was recorded
|
|
@@ -2510,19 +2416,10 @@ let SandboxService = class SandboxService {
|
|
|
2510
2416
|
}
|
|
2511
2417
|
await this.retirement.quarantine(o.id, reason ??
|
|
2512
2418
|
"an unknown cloud incarnation and no confirmed destruction of the current one");
|
|
2513
|
-
cloudPermanent = true;
|
|
2514
2419
|
pending = true;
|
|
2515
2420
|
continue;
|
|
2516
2421
|
}
|
|
2517
|
-
await this.retirement.quarantine(o.id,
|
|
2518
|
-
? o.bootId === null
|
|
2519
|
-
? "local instance: no boot identity was reported, so no restart can prove its legacy work ended"
|
|
2520
|
-
: "local instance: waiting for a restart of the computer (a later boot identity)"
|
|
2521
|
-
: "the old instance was replaced without a recorded confirmed destruction");
|
|
2522
|
-
if (!local)
|
|
2523
|
-
cloudPermanent = true;
|
|
2524
|
-
else if (o.bootId === null)
|
|
2525
|
-
unknownBoot = true;
|
|
2422
|
+
await this.retirement.quarantine(o.id, "the old instance was replaced without a recorded confirmed destruction");
|
|
2526
2423
|
pending = true;
|
|
2527
2424
|
}
|
|
2528
2425
|
}
|
|
@@ -2542,13 +2439,7 @@ let SandboxService = class SandboxService {
|
|
|
2542
2439
|
else if (still !== null && resumed !== undefined)
|
|
2543
2440
|
resumed.resumed = true;
|
|
2544
2441
|
if (pending)
|
|
2545
|
-
throw failed
|
|
2546
|
-
? retirementPending()
|
|
2547
|
-
: cloudPermanent
|
|
2548
|
-
? recreateRequired()
|
|
2549
|
-
: unknownBoot
|
|
2550
|
-
? replaceRequired()
|
|
2551
|
-
: restartRequired();
|
|
2442
|
+
throw failed ? retirementPending() : recreateRequired();
|
|
2552
2443
|
return now;
|
|
2553
2444
|
}
|
|
2554
2445
|
/**
|
|
@@ -2680,7 +2571,7 @@ let SandboxService = class SandboxService {
|
|
|
2680
2571
|
const row = (await this.retireIncarnations(id, held, read, fence, undefined, gate)) ?? read;
|
|
2681
2572
|
try {
|
|
2682
2573
|
if (row.fs_status === "lost")
|
|
2683
|
-
throw deviceFilesLost(
|
|
2574
|
+
throw deviceFilesLost();
|
|
2684
2575
|
// a device is bound to its provider for life: an instance row of another provider (never
|
|
2685
2576
|
// written by this kernel) is refused as it is, never taken over
|
|
2686
2577
|
if (row.provider !== null && row.provider !== p.plugin) {
|
|
@@ -2688,7 +2579,7 @@ let SandboxService = class SandboxService {
|
|
|
2688
2579
|
}
|
|
2689
2580
|
// read under the lease, after the fence moved: a value read before the wait may be stale
|
|
2690
2581
|
// (another replica may have changed the mode meanwhile)
|
|
2691
|
-
const want = await this.wantedLimits(ctx
|
|
2582
|
+
const want = await this.wantedLimits(ctx);
|
|
2692
2583
|
const handle = row.handle;
|
|
2693
2584
|
const createdAt = row.created_at.getTime();
|
|
2694
2585
|
const fsResets = row.fs_resets;
|
|
@@ -2696,21 +2587,8 @@ let SandboxService = class SandboxService {
|
|
|
2696
2587
|
const created = await this.create(ctx, p, held, row, fence, signal, want);
|
|
2697
2588
|
return { ...created, fsResets, info: { fresh: true, restarted: true }, fence };
|
|
2698
2589
|
}
|
|
2699
|
-
// the staged path's activation (B-8): an instance committed before the binder existed has no
|
|
2700
|
-
// binding for its generation and never can get one; past the retirement gate above, a new
|
|
2701
|
-
// generation is created (and committed with its binding) in its place
|
|
2702
|
-
if (handle &&
|
|
2703
|
-
p.binder &&
|
|
2704
|
-
(row.status === "running" || row.status === "suspended") &&
|
|
2705
|
-
(await p.binder.status(id)) === null) {
|
|
2706
|
-
this.log.info("instance without a committed binding; creating a bound generation", {
|
|
2707
|
-
deviceId: id,
|
|
2708
|
-
});
|
|
2709
|
-
const created = await this.create(ctx, p, held, row, fence, signal, want);
|
|
2710
|
-
return { ...created, fsResets, info: { fresh: true, restarted: true }, fence };
|
|
2711
|
-
}
|
|
2712
2590
|
if (handle && row.status === "running") {
|
|
2713
|
-
if (
|
|
2591
|
+
if (this.mustApply(row, p, want)) {
|
|
2714
2592
|
const created = await this.applyLimits(ctx, p, held, row, handle, fence, signal, want);
|
|
2715
2593
|
if (created)
|
|
2716
2594
|
return { ...created, fsResets, info: { fresh: true, restarted: true }, fence };
|
|
@@ -2723,7 +2601,7 @@ let SandboxService = class SandboxService {
|
|
|
2723
2601
|
if (r === "resumed") {
|
|
2724
2602
|
const incarnation = { provider: p.plugin, generation: String(createdAt) };
|
|
2725
2603
|
// the new limits first: the row says running only once the instance runs with them
|
|
2726
|
-
if (
|
|
2604
|
+
if (this.mustApply(row, p, want)) {
|
|
2727
2605
|
let created;
|
|
2728
2606
|
try {
|
|
2729
2607
|
created = await this.applyLimits(ctx, p, held, row, handle, fence, signal, want);
|
|
@@ -2803,9 +2681,8 @@ let SandboxService = class SandboxService {
|
|
|
2803
2681
|
const id = ctx.deviceId;
|
|
2804
2682
|
const name = deviceResourceName(id);
|
|
2805
2683
|
// the roots the device's authority was last committed with; a device that never had an
|
|
2806
|
-
// instance has none yet (NULL)
|
|
2807
|
-
//
|
|
2808
|
-
// a local machine never uses: its first start is no roots change (no consent reset, no revoke)
|
|
2684
|
+
// instance has none yet (NULL): its first commit is no roots change (no consent reset, no
|
|
2685
|
+
// revoke)
|
|
2809
2686
|
const committedRoots = row.permission_roots ?? (row.handle ? rootsOf(row.handle) : null);
|
|
2810
2687
|
await this.fenced(held, id, fence, {
|
|
2811
2688
|
org_id: ctx.orgId,
|
|
@@ -2821,10 +2698,7 @@ let SandboxService = class SandboxService {
|
|
|
2821
2698
|
});
|
|
2822
2699
|
// the device's effective limits apply at creation (a changed mode or network kind is applied
|
|
2823
2700
|
// on use, see applyLimits; other changes reach only instances created afterwards)
|
|
2824
|
-
const wanted = want
|
|
2825
|
-
(await this.deviceLimits(ctx, {
|
|
2826
|
-
source: p.plugin === LOCAL_PROVIDER ? "local" : "cloud",
|
|
2827
|
-
}));
|
|
2701
|
+
const wanted = want;
|
|
2828
2702
|
// the record says what is in force: a provider whose limits are fixed at its file system
|
|
2829
2703
|
// records them with the file system, any other with the instance (spec §7.1)
|
|
2830
2704
|
const record = instanceLimitsJson(appliedOf(wanted));
|
|
@@ -2871,14 +2745,18 @@ let SandboxService = class SandboxService {
|
|
|
2871
2745
|
provider: p.plugin,
|
|
2872
2746
|
});
|
|
2873
2747
|
await this.fenced(held, id, fence, { fs_status: "lost", status: "none" });
|
|
2874
|
-
throw deviceFilesLost(
|
|
2748
|
+
throw deviceFilesLost();
|
|
2875
2749
|
}
|
|
2876
2750
|
let createdAt;
|
|
2877
2751
|
try {
|
|
2878
|
-
//
|
|
2879
|
-
//
|
|
2880
|
-
//
|
|
2881
|
-
|
|
2752
|
+
// the new instance's device report first, still under the lease and outside any
|
|
2753
|
+
// transaction: its revision is part of the identity the support below is recorded with (a
|
|
2754
|
+
// failure keeps the stored report and never fails the create)
|
|
2755
|
+
await runOutsideTransaction(() => this.reports.refresh(p, { deviceId: id, orgId: ctx.orgId, handle }, signal));
|
|
2756
|
+
// B-15: the instance's permission support, read from it under the lease and recorded with
|
|
2757
|
+
// the handle commit (an unread report never fails the create: the instance stays unprobed
|
|
2758
|
+
// until a later use records it)
|
|
2759
|
+
const support = this.recordsSupport(p)
|
|
2882
2760
|
? await this.cloudSupport(id, p, handle, signal)
|
|
2883
2761
|
: undefined;
|
|
2884
2762
|
createdAt = await runOutsideTransaction(() => this.instanceWrites.commitHandle(ctx.orgId, id, fence.gen, rootsOf(handle), {
|
|
@@ -3085,9 +2963,9 @@ let SandboxService = class SandboxService {
|
|
|
3085
2963
|
const fence = { gen: row.generation };
|
|
3086
2964
|
const signal = opSignal(held);
|
|
3087
2965
|
const prev = await this.destroyInstance(row, p, signal);
|
|
3088
|
-
// the provider's destroy resolved: confirmed destruction of exactly this
|
|
3089
|
-
//
|
|
3090
|
-
if (row.handle &&
|
|
2966
|
+
// the provider's destroy resolved: confirmed destruction of exactly this incarnation (8.5
|
|
2967
|
+
// evidence), the same for every provider
|
|
2968
|
+
if (row.handle && isKnownProvider(p.plugin))
|
|
3091
2969
|
await this.retirement.recordDestruction(id, p.plugin, String(row.created_at.getTime()));
|
|
3092
2970
|
if (mode === "device")
|
|
3093
2971
|
await this.destroyFiles(row, p, signal);
|
|
@@ -3168,6 +3046,8 @@ SandboxService = __decorate([
|
|
|
3168
3046
|
__param(10, Inject(PermissionInstanceWrites)),
|
|
3169
3047
|
__param(11, Inject(LegacyRetirementStore)),
|
|
3170
3048
|
__param(12, Inject(CloudPermissionSnapshots)),
|
|
3171
|
-
__param(13, Inject(DeviceReports))
|
|
3049
|
+
__param(13, Inject(DeviceReports)),
|
|
3050
|
+
__param(14, Optional()),
|
|
3051
|
+
__param(14, Inject(DialInRelay))
|
|
3172
3052
|
], SandboxService);
|
|
3173
3053
|
export { SandboxService };
|