@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
|
@@ -61,7 +61,7 @@ export function launchRefusedText(kind) {
|
|
|
61
61
|
case "denied":
|
|
62
62
|
return "the command or its output file is outside what this conversation may use on the device; choose a working directory this conversation may write to";
|
|
63
63
|
case "unsupported":
|
|
64
|
-
return "the device refused it because it cannot enforce its sandbox limits; ask the device's owner to update
|
|
64
|
+
return "the device refused it because it cannot enforce its sandbox limits; ask the device's owner to update its device program (or a super admin to update its device plugin), or continue without the device";
|
|
65
65
|
default:
|
|
66
66
|
return "the device refused the start; check that the device is connected, then retry the call";
|
|
67
67
|
}
|
|
@@ -1246,7 +1246,10 @@ let SandboxOperationIntents = class SandboxOperationIntents {
|
|
|
1246
1246
|
/**
|
|
1247
1247
|
* A disconnected or still-pending revoke remains owed; every retry is a new deterministic
|
|
1248
1248
|
* persisted attempt, backing off (30 s doubling, at most an hour) so an obligation that only
|
|
1249
|
-
* retirement can resolve (a lost or replaced instance) never spins.
|
|
1249
|
+
* retirement can resolve (a lost or replaced instance) never spins. Retries stop once the
|
|
1250
|
+
* device or its org is deleted: nothing can reach its instance any more, the revoke stays
|
|
1251
|
+
* unacknowledged (no cleanup is claimed) and the retirement settles it from the device's
|
|
1252
|
+
* recorded destruction, if any.
|
|
1250
1253
|
*/
|
|
1251
1254
|
async deferRevocation(id) {
|
|
1252
1255
|
const row = await this.db
|
|
@@ -1255,6 +1258,12 @@ let SandboxOperationIntents = class SandboxOperationIntents {
|
|
|
1255
1258
|
.where("operation_id", "=", id)
|
|
1256
1259
|
.where("state", "=", "revoked")
|
|
1257
1260
|
.where("revoke_acknowledged", "=", false)
|
|
1261
|
+
.where(({ exists, selectFrom }) => exists(selectFrom("devices as d")
|
|
1262
|
+
.innerJoin("orgs as o", "o.id", "d.org_id")
|
|
1263
|
+
.select("d.id")
|
|
1264
|
+
.whereRef("d.id", "=", "sandbox_operation_intents.device_id")
|
|
1265
|
+
.where("d.deleted_at", "is", null)
|
|
1266
|
+
.where("o.deleted_at", "is", null)))
|
|
1258
1267
|
.returning(["org_id", "reconcile_attempt"])
|
|
1259
1268
|
.executeTakeFirst();
|
|
1260
1269
|
if (row)
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { isSandboxPermissionUnsupportedError, isSandboxScopeDeniedError, parseSandboxExecutionRef, parseSandboxOperationScope, SandboxOperationOutcomeUnknownError, SandboxPermissionUnsupportedError, } from "@capybara-hq/plugin-sdk";
|
|
10
|
+
import { isDeviceRequestNotSent, isSandboxPermissionUnsupportedError, isSandboxScopeDeniedError, parseSandboxExecutionRef, parseSandboxOperationScope, SandboxOperationOutcomeUnknownError, SandboxPermissionUnsupportedError, } from "@capybara-hq/plugin-sdk";
|
|
11
11
|
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
12
12
|
import { MANAGED_STOP_GRACE_MS, ManagedInstanceMismatchError } from "../background/managed.js";
|
|
13
13
|
import { BackgroundTaskStopper } from "../background/stop.js";
|
|
@@ -15,7 +15,6 @@ import { BackgroundTaskStore } from "../background/store.js";
|
|
|
15
15
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
16
16
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
17
17
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
18
|
-
import { isDeviceRequestNotSent } from "../local-devices/relay.js";
|
|
19
18
|
import { checkManagedStart } from "./held-operations.js";
|
|
20
19
|
import { SandboxOperationIntents } from "./operation-intents.js";
|
|
21
20
|
import { DeviceProviders } from "./providers.js";
|
|
@@ -126,8 +125,7 @@ let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
|
|
|
126
125
|
return {
|
|
127
126
|
ref: await background.start(h, scope, {
|
|
128
127
|
...input,
|
|
129
|
-
|
|
130
|
-
...(!entry.binder && { instanceGeneration: claimed.instance_generation }),
|
|
128
|
+
instanceGeneration: claimed.instance_generation,
|
|
131
129
|
signal,
|
|
132
130
|
}),
|
|
133
131
|
instanceId: h.id,
|
|
@@ -48,17 +48,16 @@ export declare function permissionAvailabilityFor(provider: {
|
|
|
48
48
|
version?: string;
|
|
49
49
|
} | undefined): PermissionAvailability;
|
|
50
50
|
/**
|
|
51
|
-
* Why a recorded runtime report cannot run permission-scoped work on
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* boundary only runs outside its sandbox.
|
|
51
|
+
* Why a recorded runtime report cannot run permission-scoped work on its device, or null when it
|
|
52
|
+
* can: the one rule admission's withheld scope and the people's view both apply (the "one
|
|
53
|
+
* verdict" rule, B-16), the same for every provider. A runtime without a restricted mode and
|
|
54
|
+
* without an instance boundary only runs outside its sandbox.
|
|
56
55
|
*/
|
|
57
|
-
export declare function runtimeReportVerdict(report: SandboxPermissionSupport
|
|
56
|
+
export declare function runtimeReportVerdict(report: SandboxPermissionSupport): string | null;
|
|
58
57
|
/**
|
|
59
58
|
* The availability of device work as people see it (the HTTP views): a supported report that
|
|
60
59
|
* {@link runtimeReportVerdict} refuses reads `unsupported` with the runtime cause, as admission
|
|
61
60
|
* refuses it. Kernel readers keep the raw availability (its report decides the provider layer and
|
|
62
61
|
* the kernel read route).
|
|
63
62
|
*/
|
|
64
|
-
export declare function deviceWorkAvailability(availability: PermissionAvailability
|
|
63
|
+
export declare function deviceWorkAvailability(availability: PermissionAvailability): PermissionAvailability;
|
|
@@ -45,15 +45,12 @@ export function permissionAvailabilityFor(provider) {
|
|
|
45
45
|
return unprobedPermissionAvailability();
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Why a recorded runtime report cannot run permission-scoped work on
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* boundary only runs outside its sandbox.
|
|
48
|
+
* Why a recorded runtime report cannot run permission-scoped work on its device, or null when it
|
|
49
|
+
* can: the one rule admission's withheld scope and the people's view both apply (the "one
|
|
50
|
+
* verdict" rule, B-16), the same for every provider. A runtime without a restricted mode and
|
|
51
|
+
* without an instance boundary only runs outside its sandbox.
|
|
53
52
|
*/
|
|
54
|
-
export function runtimeReportVerdict(report
|
|
55
|
-
if (report.boundary === "instance" && location === "local")
|
|
56
|
-
return "A local device cannot report an instance boundary";
|
|
53
|
+
export function runtimeReportVerdict(report) {
|
|
57
54
|
if (report.restricted === null && !instanceSupported(report))
|
|
58
55
|
return report.unavailableReason ?? "This device's runtime cannot enforce its sandbox";
|
|
59
56
|
return null;
|
|
@@ -64,10 +61,10 @@ export function runtimeReportVerdict(report, location) {
|
|
|
64
61
|
* refuses it. Kernel readers keep the raw availability (its report decides the provider layer and
|
|
65
62
|
* the kernel read route).
|
|
66
63
|
*/
|
|
67
|
-
export function deviceWorkAvailability(availability
|
|
64
|
+
export function deviceWorkAvailability(availability) {
|
|
68
65
|
if (availability.state !== "supported")
|
|
69
66
|
return availability;
|
|
70
|
-
const reason = runtimeReportVerdict(availability.report
|
|
67
|
+
const reason = runtimeReportVerdict(availability.report);
|
|
71
68
|
return reason === null
|
|
72
69
|
? availability
|
|
73
70
|
: { state: "unsupported", reason, cause: { kind: "runtime" } };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type SandboxOperationScope } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
import type { DeviceExecGrants } from "@capybara-hq/plugin-sdk/device-protocol";
|
|
2
3
|
import type { Selectable } from "kysely";
|
|
3
4
|
import { PermissionProfileStore } from "../conversations/permission-profile-store.js";
|
|
4
5
|
import type { PermissionCallGrantsTable } from "../db/kernel-schema.js";
|
|
@@ -154,7 +154,6 @@ let PermissionCallGrants = class PermissionCallGrants {
|
|
|
154
154
|
(escalation
|
|
155
155
|
? typeof candidate.escalation?.justification !== "string" ||
|
|
156
156
|
candidate.escalation.justification.trim() === "" ||
|
|
157
|
-
candidate.permissionScope.readDirectories.length > 0 ||
|
|
158
157
|
candidate.permissionScope.writeDirectories.length > 0 ||
|
|
159
158
|
candidate.permissionScope.hosts.length > 0 ||
|
|
160
159
|
candidate.targetPath !== undefined
|
|
@@ -185,7 +184,7 @@ let PermissionCallGrants = class PermissionCallGrants {
|
|
|
185
184
|
const root = await this.profiles.readOwnedRoot(b.orgId, b.conversationId, b.accountId);
|
|
186
185
|
const view = await this.facts.view(b.orgId, b.accountId, root);
|
|
187
186
|
if (escalation) {
|
|
188
|
-
// the outside-sandbox ceiling:
|
|
187
|
+
// the outside-sandbox ceiling: platform, org and the provider's support for running outside
|
|
189
188
|
if (b.toolKey !== "Bash" ||
|
|
190
189
|
!view.outsideSandboxCeiling ||
|
|
191
190
|
view.availability.state !== "supported" ||
|
|
@@ -204,10 +203,6 @@ let PermissionCallGrants = class PermissionCallGrants {
|
|
|
204
203
|
// `hostGrantCeiling`): the one rule the candidate builder and admission read, so Full access
|
|
205
204
|
// never auto-grants beyond it
|
|
206
205
|
const { sandbox, hostCeiling, hostRefusal } = await this.facts.readDevice(b.orgId, b.deviceId);
|
|
207
|
-
if (!view.broadProjectReach &&
|
|
208
|
-
(candidate.permissionScope.readDirectories.length ||
|
|
209
|
-
candidate.permissionScope.writeDirectories.length))
|
|
210
|
-
throw new ApiError("forbidden", "Permission proposal exceeds the device owner's project reach");
|
|
211
206
|
const refused = candidate.permissionScope.hosts.flatMap((host) => hostGrantable(hostCeiling, host)
|
|
212
207
|
? []
|
|
213
208
|
: [`${host}: ${hostRefusal(host) ?? "it is beyond the device's network limits"}`]);
|
|
@@ -215,7 +210,6 @@ let PermissionCallGrants = class PermissionCallGrants {
|
|
|
215
210
|
throw new ApiError("forbidden", `Permission proposal exceeds the device's per-call host ceiling (${refused.join("; ")})`);
|
|
216
211
|
const baseRoot = root.project_path ?? working.workspace;
|
|
217
212
|
const normalized = normalizePermissionExpansion(candidate.permissionScope, {
|
|
218
|
-
baseReadDirectories: [baseRoot],
|
|
219
213
|
baseWriteDirectories: [baseRoot],
|
|
220
214
|
baseHosts: sandbox.networkMode === "allowlist" ? sandbox.hosts : [],
|
|
221
215
|
});
|
|
@@ -7,8 +7,11 @@ export type PermissionCallRef = {
|
|
|
7
7
|
runId: string;
|
|
8
8
|
callId: string;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* What a per-call grant adds to an operation's base scope: write roots and hosts. Reads are never
|
|
12
|
+
* granted: what a sandboxed operation may read is its device provider's rule.
|
|
13
|
+
*/
|
|
10
14
|
export type PermissionExpansion = Readonly<{
|
|
11
|
-
readDirectories: readonly string[];
|
|
12
15
|
writeDirectories: readonly string[];
|
|
13
16
|
hosts: readonly string[];
|
|
14
17
|
}>;
|
|
@@ -94,7 +97,6 @@ export type PermissionCandidateResult = {
|
|
|
94
97
|
message: string;
|
|
95
98
|
};
|
|
96
99
|
export type PermissionReviewSnapshot = Readonly<Omit<PermissionCallBinding, "toolKey" | "specHash" | "callInputHash" | "resolvedInputHash"> & {
|
|
97
|
-
baseReadDirectories: readonly string[];
|
|
98
100
|
baseWriteDirectories: readonly string[];
|
|
99
101
|
baseHosts: readonly string[];
|
|
100
102
|
workingRoot: string;
|
|
@@ -111,8 +113,6 @@ export type PermissionReviewSnapshot = Readonly<Omit<PermissionCallBinding, "too
|
|
|
111
113
|
/** The provider's boundary; absent reads as `operation`. */
|
|
112
114
|
boundary?: "operation" | "instance";
|
|
113
115
|
outsideSandboxCeiling: boolean;
|
|
114
|
-
/** Restricted directory expansions beyond the working root (B2 broad project reach). */
|
|
115
|
-
broadProjectReach: boolean;
|
|
116
116
|
unattended: boolean;
|
|
117
117
|
fullConsent: boolean;
|
|
118
118
|
/** An `unsupported` state carries its cause (R9), from which admission renders the text. */
|
|
@@ -22,11 +22,6 @@ export declare class PermissionCeilingWrites {
|
|
|
22
22
|
publishLocked(subject: AuthoritySubject, level: "platform" | "org" | "device" | "root", revoke?: boolean | ((scope: SandboxOperationScope | SandboxBrowseScope, row: Selectable<SandboxOperationIntentsTable>) => boolean), invalidateFullConsent?: boolean): Promise<void>;
|
|
23
23
|
private resetRoot;
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* The active local machines' reported roots by device (one org, or all): what the Full-off writers
|
|
27
|
-
* compare running restricted scopes against (B2 reach narrowing). Cloud devices have none.
|
|
28
|
-
*/
|
|
29
|
-
export declare function localMachineRoots(db: KernelSchemaDb, orgId?: string): Promise<Map<string, string[]>>;
|
|
30
25
|
/**
|
|
31
26
|
* The narrowings a ceiling write publishes (approval-only profiles design, "Ceiling writes"), each
|
|
32
27
|
* bumping its epoch and revoking, in the same transaction, the admitted or started work it takes:
|
|
@@ -40,31 +35,20 @@ export declare function localMachineRoots(db: KernelSchemaDb, orgId?: string): P
|
|
|
40
35
|
export type CeilingNarrowing = "outside-sandbox-off" | "network-allowlist" | "hosts-removed";
|
|
41
36
|
/** Work on the open public network: what a network ceiling narrowed to `allowlist` takes away. */
|
|
42
37
|
export declare const needsOpenNetwork: (scope: SandboxOperationScope | SandboxBrowseScope) => boolean;
|
|
43
|
-
/**
|
|
44
|
-
* What a platform or org Full ceiling turning off takes away (B2, same split as the owner writer):
|
|
45
|
-
* Full execution, broad browsing, and running restricted work outside the machine's roots, since
|
|
46
|
-
* the effective restricted reach narrows to the workspace.
|
|
47
|
-
*/
|
|
48
|
-
export declare const needsWiderDeviceCeiling: (scope: SandboxOperationScope | SandboxBrowseScope, machineRoots: readonly string[] | undefined) => boolean;
|
|
49
38
|
/** Running outside the sandbox: an escalated call (`outside-sandbox-off` takes it). */
|
|
50
39
|
export declare const requiresFullExecution: (scope: SandboxOperationScope | SandboxBrowseScope) => boolean;
|
|
51
40
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
export declare const requiresBroadProjectReach: (scope: SandboxOperationScope | SandboxBrowseScope) => boolean;
|
|
56
|
-
/**
|
|
57
|
-
* What a platform or org outside-sandbox ceiling turning off takes away: escalated work and, as
|
|
58
|
-
* before, the wider device ceiling restricted reach depended on.
|
|
41
|
+
* What a platform or org outside-sandbox ceiling turning off takes away: escalated work (what a
|
|
42
|
+
* sandboxed operation reaches is its provider's rule, which no kernel ceiling widens).
|
|
59
43
|
*/
|
|
60
44
|
export declare const needsFullCeiling: (scope: SandboxOperationScope | SandboxBrowseScope) => boolean;
|
|
61
45
|
/**
|
|
62
|
-
* The
|
|
63
|
-
*
|
|
64
|
-
* or an org's `deviceNetwork.default`, open to allowlist) moves to the
|
|
65
|
-
* open-network work is revoked.
|
|
46
|
+
* The devices that follow their org's network default (no network choice of their own and no B1
|
|
47
|
+
* allowlist snapshot), with their org, whatever their provider: what narrowing a default
|
|
48
|
+
* (`devices.network.default` or an org's `deviceNetwork.default`, open to allowlist) moves to the
|
|
49
|
+
* allowlist, so their running open-network work is revoked.
|
|
66
50
|
*/
|
|
67
|
-
export declare function
|
|
51
|
+
export declare function devicesFollowingDefault(db: KernelSchemaDb, orgId?: string): Promise<Map<string, string>>;
|
|
68
52
|
/**
|
|
69
53
|
* Whether an allowlist execution names a host the new ceilings no longer allow (`hosts-removed`):
|
|
70
54
|
* a host neither in the org's effective hosts nor held by an independent run or task grant the new
|
|
@@ -12,7 +12,6 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
12
12
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
13
13
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
14
14
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
15
|
-
import { machineRootList, outsideMachineRoots } from "../local-devices/owner-report.js";
|
|
16
15
|
import { coversHost } from "./modes.js";
|
|
17
16
|
import { isExecutionMethod, isFullExecutionScope, usesOpenNetwork, } from "./operation-authority-types.js";
|
|
18
17
|
import { PermissionAuthorityEpochStore } from "./permission-authority-epochs.js";
|
|
@@ -191,51 +190,25 @@ PermissionCeilingWrites = __decorate([
|
|
|
191
190
|
__param(5, Inject(OutboxService))
|
|
192
191
|
], PermissionCeilingWrites);
|
|
193
192
|
export { PermissionCeilingWrites };
|
|
194
|
-
/**
|
|
195
|
-
* The active local machines' reported roots by device (one org, or all): what the Full-off writers
|
|
196
|
-
* compare running restricted scopes against (B2 reach narrowing). Cloud devices have none.
|
|
197
|
-
*/
|
|
198
|
-
export async function localMachineRoots(db, orgId) {
|
|
199
|
-
let q = db
|
|
200
|
-
.selectFrom("device_machines")
|
|
201
|
-
.select(["device_id", "roots"])
|
|
202
|
-
.where("revoked_at", "is", null);
|
|
203
|
-
if (orgId !== undefined)
|
|
204
|
-
q = q.where("org_id", "=", orgId);
|
|
205
|
-
const rows = await q.execute();
|
|
206
|
-
return new Map(rows.map((r) => [r.device_id, machineRootList(r.roots)]));
|
|
207
|
-
}
|
|
208
193
|
/** Work on the open public network: what a network ceiling narrowed to `allowlist` takes away. */
|
|
209
194
|
export const needsOpenNetwork = (scope) => usesOpenNetwork(scope);
|
|
210
|
-
/**
|
|
211
|
-
* What a platform or org Full ceiling turning off takes away (B2, same split as the owner writer):
|
|
212
|
-
* Full execution, broad browsing, and running restricted work outside the machine's roots, since
|
|
213
|
-
* the effective restricted reach narrows to the workspace.
|
|
214
|
-
*/
|
|
215
|
-
export const needsWiderDeviceCeiling = (scope, machineRoots) => needsFullCeiling(scope) || outsideMachineRoots(scope, machineRoots);
|
|
216
195
|
/** Running outside the sandbox: an escalated call (`outside-sandbox-off` takes it). */
|
|
217
196
|
export const requiresFullExecution = (scope) => isFullExecutionScope(scope);
|
|
218
197
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*/
|
|
222
|
-
export const requiresBroadProjectReach = (scope) => !("profile" in scope) && scope.readRoots.includes("/");
|
|
223
|
-
/**
|
|
224
|
-
* What a platform or org outside-sandbox ceiling turning off takes away: escalated work and, as
|
|
225
|
-
* before, the wider device ceiling restricted reach depended on.
|
|
198
|
+
* What a platform or org outside-sandbox ceiling turning off takes away: escalated work (what a
|
|
199
|
+
* sandboxed operation reaches is its provider's rule, which no kernel ceiling widens).
|
|
226
200
|
*/
|
|
227
|
-
export const needsFullCeiling = (scope) => requiresFullExecution(scope)
|
|
201
|
+
export const needsFullCeiling = (scope) => requiresFullExecution(scope);
|
|
228
202
|
/**
|
|
229
|
-
* The
|
|
230
|
-
*
|
|
231
|
-
* or an org's `deviceNetwork.default`, open to allowlist) moves to the
|
|
232
|
-
* open-network work is revoked.
|
|
203
|
+
* The devices that follow their org's network default (no network choice of their own and no B1
|
|
204
|
+
* allowlist snapshot), with their org, whatever their provider: what narrowing a default
|
|
205
|
+
* (`devices.network.default` or an org's `deviceNetwork.default`, open to allowlist) moves to the
|
|
206
|
+
* allowlist, so their running open-network work is revoked.
|
|
233
207
|
*/
|
|
234
|
-
export async function
|
|
208
|
+
export async function devicesFollowingDefault(db, orgId) {
|
|
235
209
|
let q = db
|
|
236
210
|
.selectFrom("devices")
|
|
237
211
|
.select(["id", "org_id", "outer_network"])
|
|
238
|
-
.where("source", "=", "cloud")
|
|
239
212
|
.where("network_mode", "is", null)
|
|
240
213
|
.where("deleted_at", "is", null);
|
|
241
214
|
if (orgId !== undefined)
|
|
@@ -109,7 +109,15 @@ export declare class PermissionConfigPublication {
|
|
|
109
109
|
assertCurrent(): Promise<void>;
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Locks the device rows a publication's conversion may write (`network_mode` still NULL: the
|
|
113
|
+
* snapshot copy and the network pins only touch those), in id order, before the platform
|
|
114
|
+
* authority writer lock: a device writer locks its row and then its authority (device row ->
|
|
115
|
+
* permission locks), so the publication must never hold the platform lock while it waits for a
|
|
116
|
+
* device row.
|
|
117
|
+
*/
|
|
118
|
+
export declare function lockDevicesFollowingTheirOrg(db: KernelSchemaDb): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Copies a device's B1 snapshot network into its own sandbox network while it has none
|
|
113
121
|
* (migrations 0165 and 0167, the snapshot writer): an allowlist with a non-empty list of strings
|
|
114
122
|
* stays that allowlist, an empty or unreadable one ran closed and becomes `none`; an open snapshot
|
|
115
123
|
* follows the org. Idempotent: only rows still following the org are written.
|
|
@@ -20,7 +20,7 @@ import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
|
20
20
|
import { hostGrantable, hostGrantCeiling } from "./device-sandbox.js";
|
|
21
21
|
import { convertStoredPermissionKeys, lockOrgsWithStoredPermissionKeys, orgDeviceSandboxOf, readStoredDeviceSandbox, resolveDeviceSandboxSettings, } from "./device-sandbox-settings.js";
|
|
22
22
|
import { cloudChosenMode, coversHost, effectiveDevicePolicy, orgEffectiveHosts, } from "./modes.js";
|
|
23
|
-
import {
|
|
23
|
+
import { devicesFollowingDefault, hostsNarrowed, needsFullCeiling, needsOpenNetwork, PermissionCeilingWrites, } from "./permission-ceiling-writes.js";
|
|
24
24
|
/** Whether a field comes from the startup config (with its value) or the deployment setting. */
|
|
25
25
|
const SettingSource = (value) => z.discriminatedUnion("kind", [
|
|
26
26
|
z.object({ kind: z.literal("deployment-setting") }).strict(),
|
|
@@ -216,8 +216,10 @@ let PermissionConfigPublication = class PermissionConfigPublication {
|
|
|
216
216
|
return this.txHost.run(initialize, { propagation: "requires_new" });
|
|
217
217
|
}
|
|
218
218
|
async initializeLocked(projection, activation) {
|
|
219
|
-
// the org rows a key conversion writes,
|
|
219
|
+
// the org rows a key conversion writes, then the device rows a conversion may pin, before the
|
|
220
|
+
// platform lock (org row -> device row -> permission locks, the writers' order)
|
|
220
221
|
await lockOrgsWithStoredPermissionKeys(this.db.db);
|
|
222
|
+
await lockDevicesFollowingTheirOrg(this.db.db);
|
|
221
223
|
await this.ceilings.lock({}, "platform");
|
|
222
224
|
const candidateHash = permissionProjectionFingerprint(projection);
|
|
223
225
|
const row = await this.db
|
|
@@ -269,6 +271,7 @@ let PermissionConfigPublication = class PermissionConfigPublication {
|
|
|
269
271
|
/** CAS publication precedes exposing the new local config. Same-next replicas converge idempotently. */
|
|
270
272
|
async publish(before, next) {
|
|
271
273
|
await lockOrgsWithStoredPermissionKeys(this.db.db);
|
|
274
|
+
await lockDevicesFollowingTheirOrg(this.db.db);
|
|
272
275
|
await this.ceilings.lock({}, "platform");
|
|
273
276
|
try {
|
|
274
277
|
await this.publishLocked(permissionConfigFingerprint(before), permissionConfigProjection(next));
|
|
@@ -331,7 +334,6 @@ let PermissionConfigPublication = class PermissionConfigPublication {
|
|
|
331
334
|
const devices = await this.db
|
|
332
335
|
.selectFrom("devices")
|
|
333
336
|
.select(["id", "org_id", "mode", "owner_full_access", "outer_network"])
|
|
334
|
-
.where("source", "=", "cloud")
|
|
335
337
|
.where("network_mode", "is", null)
|
|
336
338
|
.where("deleted_at", "is", null)
|
|
337
339
|
.orderBy("id")
|
|
@@ -400,21 +402,18 @@ let PermissionConfigPublication = class PermissionConfigPublication {
|
|
|
400
402
|
(beforeView.network.default === "allowlist" && nextView.network.default === "open");
|
|
401
403
|
const orgs = await this.db.selectFrom("orgs").select(["id", "settings"]).execute();
|
|
402
404
|
const settings = new Map(orgs.map((org) => [org.id, orgDeviceSandboxOf(org.settings).deviceNetwork]));
|
|
403
|
-
|
|
404
|
-
const machineRoots = await localMachineRoots(this.db.db);
|
|
405
|
-
const sources = new Map(devices.map((device) => [device.id, device.source]));
|
|
406
|
-
// the kill switch lifted is a widening for every cloud device (closing it only narrows)
|
|
405
|
+
// the kill switch lifted is a widening for every device (closing it only narrows)
|
|
407
406
|
if (before.egress === "none" && next.egress !== "none")
|
|
408
|
-
await this.ceilings.invalidateDeviceConsentUnderPlatform(
|
|
407
|
+
await this.ceilings.invalidateDeviceConsentUnderPlatform((await this.db.selectFrom("devices").select("id").execute()).map((device) => device.id));
|
|
409
408
|
// a network ceiling narrowed to the allowlist, or closed by the kill switch, takes running
|
|
410
409
|
// open-network work
|
|
411
410
|
const networkNarrowed = (beforeView.network.ceiling === "open" && nextView.network.ceiling === "allowlist") ||
|
|
412
411
|
(before.egress !== "none" && next.egress === "none");
|
|
413
|
-
// a default narrowed to the allowlist takes it from the
|
|
412
|
+
// a default narrowed to the allowlist takes it from the devices following it
|
|
414
413
|
const following = !networkNarrowed &&
|
|
415
414
|
beforeView.network.default === "open" &&
|
|
416
415
|
nextView.network.default === "allowlist"
|
|
417
|
-
? new Set([...(await
|
|
416
|
+
? new Set([...(await devicesFollowingDefault(this.db.db))]
|
|
418
417
|
.filter(([, org]) => settings.get(org)?.default === undefined)
|
|
419
418
|
.map(([id]) => id))
|
|
420
419
|
: null;
|
|
@@ -427,20 +426,14 @@ let PermissionConfigPublication = class PermissionConfigPublication {
|
|
|
427
426
|
const ceiling = nextView.network.ceiling === "allowlist" || org?.ceiling === "allowlist"
|
|
428
427
|
? "allowlist"
|
|
429
428
|
: "open";
|
|
430
|
-
return hostGrantable(hostGrantCeiling({ boundary: "operation", networkMode: "allowlist", networkCeiling: ceiling }, next, org === undefined ? {} : { deviceNetwork: org }
|
|
429
|
+
return hostGrantable(hostGrantCeiling({ boundary: "operation", networkMode: "allowlist", networkCeiling: ceiling }, next, org === undefined ? {} : { deviceNetwork: org }), host);
|
|
431
430
|
};
|
|
432
431
|
await this.ceilings.publishLocked({}, "platform", (scope, row) => {
|
|
433
432
|
if (needsOpenNetwork(scope) && (networkNarrowed || following?.has(row.device_id) === true))
|
|
434
433
|
return true;
|
|
435
|
-
//
|
|
436
|
-
// outside a machine's roots goes with Full work, as the owner writer decides
|
|
437
|
-
if (nextMode === "off" && needsWiderDeviceCeiling(scope, machineRoots.get(row.device_id)))
|
|
438
|
-
return true;
|
|
434
|
+
// escalated work goes with the outside-sandbox switch, and with the kill switch closing
|
|
439
435
|
if (needsFullCeiling(scope))
|
|
440
|
-
return
|
|
441
|
-
(sources.get(row.device_id) === "cloud" &&
|
|
442
|
-
before.egress !== "none" &&
|
|
443
|
-
next.egress === "none"));
|
|
436
|
+
return nextMode === "off" || (before.egress !== "none" && next.egress === "none");
|
|
444
437
|
return hostsNarrowed(scope, row, orgEffectiveHosts(next, settings.get(row.org_id)), (host) => next.egress !== "none" && grantable(row.org_id, host));
|
|
445
438
|
},
|
|
446
439
|
// only a widening resets Full consent: a narrowing keeps what the consent covered
|
|
@@ -483,7 +476,23 @@ PermissionConfigPublication = __decorate([
|
|
|
483
476
|
], PermissionConfigPublication);
|
|
484
477
|
export { PermissionConfigPublication };
|
|
485
478
|
/**
|
|
486
|
-
*
|
|
479
|
+
* Locks the device rows a publication's conversion may write (`network_mode` still NULL: the
|
|
480
|
+
* snapshot copy and the network pins only touch those), in id order, before the platform
|
|
481
|
+
* authority writer lock: a device writer locks its row and then its authority (device row ->
|
|
482
|
+
* permission locks), so the publication must never hold the platform lock while it waits for a
|
|
483
|
+
* device row.
|
|
484
|
+
*/
|
|
485
|
+
export async function lockDevicesFollowingTheirOrg(db) {
|
|
486
|
+
await db
|
|
487
|
+
.selectFrom("devices")
|
|
488
|
+
.select("id")
|
|
489
|
+
.where("network_mode", "is", null)
|
|
490
|
+
.orderBy("id")
|
|
491
|
+
.forNoKeyUpdate()
|
|
492
|
+
.execute();
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Copies a device's B1 snapshot network into its own sandbox network while it has none
|
|
487
496
|
* (migrations 0165 and 0167, the snapshot writer): an allowlist with a non-empty list of strings
|
|
488
497
|
* stays that allowlist, an empty or unreadable one ran closed and becomes `none`; an open snapshot
|
|
489
498
|
* follows the org. Idempotent: only rows still following the org are written.
|
|
@@ -503,7 +512,6 @@ export async function copyCloudSnapshotNetworks(db) {
|
|
|
503
512
|
network_hosts: sql `CASE WHEN ${readable} THEN outer_network -> 'hosts'
|
|
504
513
|
ELSE '[]'::jsonb END`,
|
|
505
514
|
})
|
|
506
|
-
.where("source", "=", "cloud")
|
|
507
515
|
.where("network_mode", "is", null)
|
|
508
516
|
.where(sql `outer_network ->> 'kind' = 'allowlist'`)
|
|
509
517
|
.execute();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SandboxRoots } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import type { SandboxBoundary, SandboxRoots } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { PermissionContextV2 } from "../conversations/events.js";
|
|
3
3
|
/**
|
|
4
4
|
* The complete identity a recorded permission context is read for: the calling conversation, its
|
|
@@ -13,32 +13,39 @@ export interface PermissionContextSubject {
|
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* What a managed operation entry already holds for the device it entered (Task 8 producer): the
|
|
16
|
-
* installed instance incarnation and
|
|
17
|
-
* facts. Never read from model or tool input, never cached across operations.
|
|
16
|
+
* installed instance incarnation and the revision of its evidence, its roots and the working root
|
|
17
|
+
* of the shared base facts. Never read from model or tool input, never cached across operations.
|
|
18
18
|
*/
|
|
19
19
|
export interface HeldDeviceContextEvidence {
|
|
20
20
|
deviceId: string;
|
|
21
21
|
provider: string;
|
|
22
22
|
instanceId: string;
|
|
23
23
|
instanceGeneration: string;
|
|
24
|
-
|
|
24
|
+
/** {@link AppliedEnvironment.revision} of the instance it entered. */
|
|
25
|
+
revision: string;
|
|
25
26
|
roots: SandboxRoots;
|
|
26
27
|
workingRoot: string;
|
|
27
28
|
}
|
|
28
29
|
/** The outer boundary a recorded context reports, as the applied environment proves it. */
|
|
29
30
|
export type AppliedOuterNetwork = NonNullable<PermissionContextV2["scope"]>["outerNetwork"];
|
|
30
31
|
/**
|
|
31
|
-
* The installed environment of a device's current instance, proved by its
|
|
32
|
-
*
|
|
33
|
-
* unprobed and carries no scope.
|
|
32
|
+
* The installed environment of a device's current instance, proved by its provider's current
|
|
33
|
+
* runtime report recorded with the kernel-built identity (B1 adapter, B-15; the same for every
|
|
34
|
+
* provider). Null from the reader means unproved: the context is unprobed and carries no scope.
|
|
34
35
|
*/
|
|
35
36
|
export interface AppliedEnvironment {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The identity hash of the current runtime report: it names the provider and its version, the
|
|
39
|
+
* instance handle and generation, the applied limits and the device's report revision, so any of
|
|
40
|
+
* them changing names another environment.
|
|
41
|
+
*/
|
|
42
|
+
revision: string;
|
|
43
|
+
/** The provider's boundary as its current report states it. */
|
|
44
|
+
boundary: SandboxBoundary;
|
|
45
|
+
/** The provider of the installed instance (its row and the device agree). */
|
|
38
46
|
provider: string;
|
|
39
47
|
instanceId: string;
|
|
40
48
|
instanceGeneration: string;
|
|
41
|
-
bindingId: string;
|
|
42
49
|
roots: SandboxRoots;
|
|
43
50
|
outerNetwork: AppliedOuterNetwork;
|
|
44
51
|
}
|