@capybara-hq/kernel 0.1.0-rc.54 → 0.1.0-rc.55
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/dist/admin/admin.schemas.d.ts +11 -1
- package/dist/catalog/catalog.module.js +1 -1
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/requests.service.d.ts +5 -5
- package/dist/catalog/requests.service.js +9 -9
- package/dist/channels/cards.d.ts +4 -3
- package/dist/channels/cards.js +25 -16
- package/dist/channels/phrases.d.ts +15 -4
- package/dist/channels/phrases.js +15 -1
- package/dist/config/load.d.ts +26 -7
- package/dist/config/load.js +60 -9
- package/dist/config/permission-migration.d.ts +17 -9
- package/dist/config/permission-migration.js +60 -9
- package/dist/config/schema.d.ts +11 -1
- package/dist/config/schema.js +37 -11
- package/dist/conversations/events.d.ts +247 -5
- package/dist/conversations/events.js +127 -16
- package/dist/conversations/permission-profiles.controller.d.ts +12 -2
- package/dist/conversations/permission-profiles.service.d.ts +12 -2
- package/dist/conversations/permission-profiles.service.js +11 -4
- package/dist/db/kernel-schema.d.ts +8 -2
- package/dist/devices/device-projects.service.d.ts +1 -1
- package/dist/devices/device-projects.service.js +6 -6
- package/dist/devices/devices.controller.d.ts +10 -8
- package/dist/devices/devices.controller.js +14 -18
- package/dist/devices/devices.schemas.d.ts +5 -5
- package/dist/devices/devices.schemas.js +5 -5
- package/dist/devices/devices.service.d.ts +188 -175
- package/dist/devices/devices.service.js +284 -292
- package/dist/devices/dto.d.ts +43 -23
- package/dist/devices/dto.js +45 -49
- package/dist/devices/project-rules.d.ts +0 -10
- package/dist/devices/project-rules.js +0 -5
- package/dist/errors.d.ts +24 -19
- package/dist/errors.js +24 -19
- package/dist/evals/reconstruct.d.ts +12 -3
- package/dist/evals/reconstruct.js +10 -6
- package/dist/evals/recorded-permission-context.d.ts +6 -4
- package/dist/evals/recorded-permission-context.js +15 -9
- package/dist/evals/run-replay.d.ts +6 -1
- package/dist/evals/run-replay.js +7 -2
- package/dist/evals/worker.js +3 -1
- package/dist/identity/settings.d.ts +45 -18
- package/dist/identity/settings.js +151 -51
- package/dist/infra/config/kernel-config.service.d.ts +1 -1
- package/dist/infra/config/kernel-config.service.js +17 -5
- package/dist/local-devices/device-auth.controller.d.ts +1 -1
- package/dist/local-devices/device-auth.controller.js +1 -1
- package/dist/local-devices/device-auth.d.ts +4 -4
- package/dist/local-devices/device-auth.js +1 -1
- package/dist/local-devices/device-policy.service.d.ts +18 -9
- package/dist/local-devices/device-policy.service.js +21 -61
- package/dist/local-devices/device-routes.d.ts +3 -1
- package/dist/local-devices/device-routes.js +15 -4
- package/dist/local-devices/instance-bindings.js +5 -2
- package/dist/local-devices/local-device-gateway.d.ts +2 -2
- package/dist/local-devices/local-device-gateway.js +3 -3
- package/dist/local-devices/local-device-provider.d.ts +4 -4
- package/dist/local-devices/local-device-provider.js +23 -9
- package/dist/local-devices/local-devices.module.d.ts +1 -1
- package/dist/local-devices/local-devices.module.js +1 -1
- package/dist/local-devices/machines.d.ts +40 -16
- package/dist/local-devices/machines.js +89 -61
- package/dist/local-devices/owner-report.d.ts +16 -14
- package/dist/local-devices/owner-report.js +24 -30
- package/dist/local-devices/owner-reports.js +26 -8
- package/dist/local-devices/policy-summary.d.ts +25 -44
- package/dist/local-devices/policy-summary.js +26 -71
- package/dist/local-devices/relay.d.ts +6 -6
- package/dist/local-devices/relay.js +10 -8
- package/dist/net/public-address.d.ts +1 -1
- package/dist/net/public-address.js +5 -2
- package/dist/orgs/device-network-setting.d.ts +82 -0
- package/dist/orgs/device-network-setting.js +142 -0
- package/dist/orgs/settings.service.d.ts +103 -66
- package/dist/orgs/settings.service.js +201 -137
- package/dist/overrides.d.ts +5 -1
- package/dist/overrides.js +2 -0
- package/dist/platform/exclusions.js +1 -1
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/admin.ops.js +20 -11
- package/dist/platform/ops/devices.ops.js +70 -5
- package/dist/platform/ops/org-settings.ops.js +10 -6
- package/dist/platform/ops/orgs.ops.js +2 -1
- package/dist/runtime/context/permission-profile.d.ts +17 -8
- package/dist/runtime/context/permission-profile.js +126 -45
- package/dist/runtime/permission-context.service.d.ts +1 -1
- package/dist/runtime/permission-context.service.js +5 -3
- package/dist/runtime/project/knowledge.d.ts +5 -4
- package/dist/runtime/project/knowledge.js +2 -1
- package/dist/runtime/project/knowledge.service.js +16 -13
- package/dist/sandbox/cloud-permission-snapshot.js +22 -3
- package/dist/sandbox/device-sandbox-settings.d.ts +230 -0
- package/dist/sandbox/device-sandbox-settings.js +470 -0
- package/dist/sandbox/device-sandbox.d.ts +187 -0
- package/dist/sandbox/device-sandbox.js +236 -0
- package/dist/sandbox/held-operations.js +15 -7
- package/dist/sandbox/modes.d.ts +49 -24
- package/dist/sandbox/modes.js +27 -19
- package/dist/sandbox/operation-authority-types.d.ts +6 -5
- package/dist/sandbox/operation-authority-types.js +7 -8
- package/dist/sandbox/operation-authority.d.ts +23 -9
- package/dist/sandbox/operation-authority.js +179 -97
- package/dist/sandbox/permission-auto-grants.d.ts +42 -0
- package/dist/sandbox/permission-auto-grants.js +145 -0
- package/dist/sandbox/permission-call-grants.d.ts +12 -4
- package/dist/sandbox/permission-call-grants.js +84 -35
- package/dist/sandbox/permission-call-grants.module.js +10 -3
- package/dist/sandbox/permission-call-types.d.ts +39 -5
- package/dist/sandbox/permission-ceiling-writes.d.ts +29 -3
- package/dist/sandbox/permission-ceiling-writes.js +38 -4
- package/dist/sandbox/permission-config-publication.d.ts +44 -2
- package/dist/sandbox/permission-config-publication.js +230 -59
- package/dist/sandbox/permission-context-types.d.ts +2 -2
- package/dist/sandbox/permission-facts.d.ts +144 -15
- package/dist/sandbox/permission-facts.js +258 -70
- package/dist/sandbox/permission-runtime-reports.d.ts +5 -4
- package/dist/sandbox/permission-runtime-reports.js +19 -29
- package/dist/sandbox/review/classifier.d.ts +8 -0
- package/dist/sandbox/review/classifier.js +10 -0
- package/dist/sandbox/review/permission-candidate.d.ts +69 -5
- package/dist/sandbox/review/permission-candidate.js +153 -30
- package/dist/sandbox/review/review.service.d.ts +19 -3
- package/dist/sandbox/review/review.service.js +59 -11
- package/dist/sandbox/review/rules.js +23 -3
- package/dist/sandbox/sandbox.service.d.ts +29 -11
- package/dist/sandbox/sandbox.service.js +51 -26
- package/dist/skills/invoke.js +3 -2
- package/dist/tools/approvals.service.d.ts +26 -116
- package/dist/tools/approvals.service.js +42 -346
- package/dist/tools/builtins/sandbox/bash.d.ts +16 -3
- package/dist/tools/builtins/sandbox/bash.js +80 -28
- package/dist/tools/builtins/sandbox/common.d.ts +39 -14
- package/dist/tools/builtins/sandbox/common.js +47 -24
- package/dist/tools/builtins/sandbox/deliver.js +7 -4
- package/dist/tools/builtins/skill-load.d.ts +2 -2
- package/dist/tools/builtins/skill-load.js +4 -3
- package/dist/tools/device-op-resolver.d.ts +4 -10
- package/dist/tools/device-op-resolver.js +8 -19
- package/dist/tools/network-asks.d.ts +52 -15
- package/dist/tools/network-asks.js +55 -25
- package/dist/tools/pipeline.d.ts +26 -14
- package/dist/tools/pipeline.js +144 -61
- package/dist/tools/registry.d.ts +6 -0
- package/dist/tools/tools.module.js +1 -1
- package/package.json +4 -4
- package/src/migrations/0165_device_network_columns.sql +50 -0
- package/src/migrations/0166_permission_grant_full_access.sql +17 -0
- package/src/migrations/0167_device_network_backfill.sql +32 -0
- package/src/migrations/0168_binding_installed_connection.sql +6 -0
- package/dist/orgs/cloud-network-setting.d.ts +0 -33
- package/dist/orgs/cloud-network-setting.js +0 -47
- package/dist/sandbox/platform-full-access.d.ts +0 -110
- package/dist/sandbox/platform-full-access.js +0 -198
|
@@ -5,7 +5,9 @@ import { type DeviceProjectScope } from "../devices/project-rules.js";
|
|
|
5
5
|
import { type WorkingProject } from "../devices/working-root.js";
|
|
6
6
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
7
7
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
8
|
+
import { type ConsentReach, type DeviceSandbox, type HostGrantCeiling } from "./device-sandbox.js";
|
|
8
9
|
import { type DeviceNetwork, type EffectiveDevicePolicy } from "./modes.js";
|
|
10
|
+
import { type PermissionAvailability } from "./permission-availability.js";
|
|
9
11
|
import type { AppliedEnvironment, AppliedOuterNetwork } from "./permission-context-types.js";
|
|
10
12
|
import { SandboxProviders } from "./providers.js";
|
|
11
13
|
type Scope = DeviceProjectScope;
|
|
@@ -32,23 +34,84 @@ export declare class PermissionFacts {
|
|
|
32
34
|
private readonly providers;
|
|
33
35
|
private readonly devices;
|
|
34
36
|
constructor(db: KernelDb, config: Pick<KernelConfigService, "get" | "fieldSource">, providers: Pick<SandboxProviders, "cloud" | "forName">, devices: Pick<DeviceAccess, "usable">);
|
|
35
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Current policy, the device sandbox and persisted owner roots; access is checked by the caller.
|
|
39
|
+
* `sandbox` is the device sandbox under the device's current runtime report (the provider layer
|
|
40
|
+
* assumed before one is recorded), the same under every permission profile.
|
|
41
|
+
*/
|
|
36
42
|
readDevice(orgId: string, deviceId: string): Promise<{
|
|
37
43
|
policy: EffectiveDevicePolicy;
|
|
38
44
|
owner: {
|
|
39
|
-
state: "blocked" | "
|
|
40
|
-
|
|
45
|
+
state: "blocked" | "report";
|
|
46
|
+
outsideSandbox: boolean;
|
|
41
47
|
restrictedProjectReach: import("../local-devices/owner-report.js").RestrictedProjectReach;
|
|
48
|
+
network: "allowlist" | "open";
|
|
42
49
|
allowedDomains: string[];
|
|
43
50
|
} | null;
|
|
51
|
+
sandbox: DeviceSandbox;
|
|
52
|
+
hostCeiling: HostGrantCeiling;
|
|
53
|
+
hostRefusal: (host: string) => string | null;
|
|
54
|
+
reach: {
|
|
55
|
+
outsideSandbox: boolean;
|
|
56
|
+
networkCeiling: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
57
|
+
networkMode: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
58
|
+
restrictedProjectReach: "os-user" | "workspace";
|
|
59
|
+
hostCeiling: HostGrantCeiling;
|
|
60
|
+
};
|
|
44
61
|
roots: {} | null;
|
|
45
62
|
home: string | null;
|
|
46
63
|
}>;
|
|
64
|
+
/**
|
|
65
|
+
* The effective device sandbox (approval-only profiles design, "Settings model"): the platform,
|
|
66
|
+
* org, device and provider layers read live and combined by {@link effectiveDeviceSandbox}. A
|
|
67
|
+
* local device's layer is its owner's authenticated report (missing or blocked: fail closed,
|
|
68
|
+
* nothing outside and the allowlist); a cloud device's is its stored network choice.
|
|
69
|
+
*/
|
|
70
|
+
deviceSandbox(orgId: string, deviceId: string, availability?: PermissionAvailability): Promise<DeviceSandbox>;
|
|
71
|
+
/**
|
|
72
|
+
* {@link deviceSandbox} with the layers a per-call host grant is checked against: its ceiling
|
|
73
|
+
* ({@link hostGrantCeiling}), why a host is unavailable ({@link hostGrantRefusal}) and the
|
|
74
|
+
* crossing ceilings a Full access consent covers ({@link ConsentReach}).
|
|
75
|
+
*/
|
|
76
|
+
deviceSandboxFacts(orgId: string, deviceId: string, availability?: PermissionAvailability,
|
|
77
|
+
/** A cloud device's network as it would be stored (a change checked before it is written). */
|
|
78
|
+
pendingCloud?: {
|
|
79
|
+
networkMode: "open" | "allowlist" | "none" | null;
|
|
80
|
+
networkHosts: string[];
|
|
81
|
+
}): Promise<{
|
|
82
|
+
box: DeviceSandbox;
|
|
83
|
+
hostCeiling: HostGrantCeiling;
|
|
84
|
+
/** The org's effective hosts: what a device's own host list may narrow, never add to. */
|
|
85
|
+
orgHosts: string[];
|
|
86
|
+
refusal: (host: string) => string | null;
|
|
87
|
+
reach: {
|
|
88
|
+
outsideSandbox: boolean;
|
|
89
|
+
networkCeiling: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
90
|
+
networkMode: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
91
|
+
restrictedProjectReach: "os-user" | "workspace";
|
|
92
|
+
hostCeiling: HostGrantCeiling;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* The per-call host ceiling of an org, with no device (`hostGrantCeiling` under the platform and
|
|
97
|
+
* org layers alone): what a standing grant that may reach any of the org's devices (a scheduled
|
|
98
|
+
* task's network grant, a network approval) is checked against. A device's own layers only
|
|
99
|
+
* narrow it further.
|
|
100
|
+
*/
|
|
101
|
+
orgHostGrantCeiling(orgId: string): Promise<HostGrantCeiling>;
|
|
47
102
|
/** Stored binding only; projectScope supplies the live owner and deletion checks. */
|
|
48
103
|
readProject(orgId: string, deviceId: string, name: string): Promise<{
|
|
49
104
|
name: string;
|
|
50
105
|
path: string;
|
|
51
106
|
} | null>;
|
|
107
|
+
/**
|
|
108
|
+
* The device's lifecycle policy: the kernel-internal mode tier (`auto` / `sandbox`, recorded with
|
|
109
|
+
* a cloud instance's applied limits and deciding the working root's reach) and the network a
|
|
110
|
+
* cloud instance is created with. A cloud device's network is its device sandbox network
|
|
111
|
+
* ({@link deviceSandbox}); the B1 snapshot's `outer_network` is no longer read: migrations 0165
|
|
112
|
+
* and 0167 and the snapshot writer copy an allowlist snapshot into the device's own network
|
|
113
|
+
* choice (`network_mode`, `network_hosts`).
|
|
114
|
+
*/
|
|
52
115
|
devicePolicy(device: {
|
|
53
116
|
orgId: string;
|
|
54
117
|
deviceId?: string;
|
|
@@ -67,12 +130,18 @@ export declare class PermissionFacts {
|
|
|
67
130
|
*/
|
|
68
131
|
assertOwnerReportUsable(orgId: string, deviceId: string): Promise<void>;
|
|
69
132
|
/**
|
|
70
|
-
* The mode a device chose: a local device's derived one (`
|
|
71
|
-
*
|
|
72
|
-
* (`
|
|
73
|
-
* org.
|
|
133
|
+
* The mode tier a device chose: a local device's derived one (`ownerModeOf`: `auto` only when
|
|
134
|
+
* its owner allows running outside the sandbox); a cloud device's narrower of its old switch and
|
|
135
|
+
* its B1 owner snapshot (`cloudChosenMode`), or null for a cloud device that follows the
|
|
136
|
+
* platform and the org. The tier is kernel-internal (instance limits, reach): a cloud device
|
|
137
|
+
* never runs outside its sandbox.
|
|
74
138
|
*/
|
|
75
139
|
private deviceChosenMode;
|
|
140
|
+
/**
|
|
141
|
+
* The device's current permission availability: the provider's capability shape, then the
|
|
142
|
+
* runtime report recorded for its current identity. No probe or provider call.
|
|
143
|
+
*/
|
|
144
|
+
private availability;
|
|
76
145
|
readWorkingFacts({ orgId, rootConversationId, holderConversationId: conversationId, deviceId, }: {
|
|
77
146
|
orgId: string;
|
|
78
147
|
rootConversationId: string;
|
|
@@ -103,16 +172,34 @@ export declare class PermissionFacts {
|
|
|
103
172
|
deviceId: string;
|
|
104
173
|
project: string | null;
|
|
105
174
|
scopeRevision: string;
|
|
106
|
-
|
|
107
|
-
|
|
175
|
+
consentIdentity: string;
|
|
176
|
+
consentReach: {
|
|
177
|
+
outsideSandbox: boolean;
|
|
178
|
+
networkCeiling: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
179
|
+
networkMode: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
180
|
+
restrictedProjectReach: "os-user" | "workspace";
|
|
181
|
+
hostCeiling: HostGrantCeiling;
|
|
182
|
+
};
|
|
183
|
+
availability: PermissionAvailability;
|
|
184
|
+
sandbox: DeviceSandbox;
|
|
185
|
+
outsideSandboxCeiling: boolean;
|
|
108
186
|
broadProjectReach: boolean;
|
|
109
187
|
}>;
|
|
110
188
|
preview(orgId: string, accountId: string, deviceId: string, project?: string): Promise<{
|
|
111
189
|
deviceId: string;
|
|
112
190
|
project: string | null;
|
|
113
191
|
scopeRevision: string;
|
|
114
|
-
|
|
115
|
-
|
|
192
|
+
consentIdentity: string;
|
|
193
|
+
consentReach: {
|
|
194
|
+
outsideSandbox: boolean;
|
|
195
|
+
networkCeiling: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
196
|
+
networkMode: "none" | import("./device-sandbox.js").DeviceNetworkMode;
|
|
197
|
+
restrictedProjectReach: "os-user" | "workspace";
|
|
198
|
+
hostCeiling: HostGrantCeiling;
|
|
199
|
+
};
|
|
200
|
+
availability: PermissionAvailability;
|
|
201
|
+
sandbox: DeviceSandbox;
|
|
202
|
+
outsideSandboxCeiling: boolean;
|
|
116
203
|
broadProjectReach: boolean;
|
|
117
204
|
}>;
|
|
118
205
|
view(orgId: string, accountId: string, row: PermissionRoot): Promise<{
|
|
@@ -125,9 +212,10 @@ export declare class PermissionFacts {
|
|
|
125
212
|
scopeRevision: string;
|
|
126
213
|
} | null;
|
|
127
214
|
scopeRevision: string | null;
|
|
128
|
-
availability:
|
|
129
|
-
|
|
215
|
+
availability: PermissionAvailability;
|
|
216
|
+
outsideSandboxCeiling: boolean;
|
|
130
217
|
broadProjectReach: boolean;
|
|
218
|
+
sandbox: DeviceSandbox | null;
|
|
131
219
|
startingWorkNotice: string;
|
|
132
220
|
}>;
|
|
133
221
|
/**
|
|
@@ -147,9 +235,10 @@ export declare class PermissionFacts {
|
|
|
147
235
|
scopeRevision: string;
|
|
148
236
|
} | null;
|
|
149
237
|
scopeRevision: string | null;
|
|
150
|
-
availability:
|
|
151
|
-
|
|
238
|
+
availability: PermissionAvailability;
|
|
239
|
+
outsideSandboxCeiling: boolean;
|
|
152
240
|
broadProjectReach: boolean;
|
|
241
|
+
sandbox: DeviceSandbox | null;
|
|
153
242
|
startingWorkNotice: string;
|
|
154
243
|
};
|
|
155
244
|
}>;
|
|
@@ -203,4 +292,44 @@ export declare function cloudOuterNetwork(network: DeviceNetwork): AppliedOuterN
|
|
|
203
292
|
* names it. A local device's host environment keeps every host.
|
|
204
293
|
*/
|
|
205
294
|
export declare function hostsWithinOuter(hosts: readonly string[], outer: AppliedOuterNetwork | undefined): string[];
|
|
295
|
+
/**
|
|
296
|
+
* The network a device sandbox gives a cloud instance's outer boundary: the open public internet,
|
|
297
|
+
* or its allowlist (empty under the kill switch, which closes it).
|
|
298
|
+
*/
|
|
299
|
+
export declare function networkOfSandbox(box: DeviceSandbox): DeviceNetwork;
|
|
300
|
+
/**
|
|
301
|
+
* A cloud device's own sandbox network: its stored choice (`network_mode`, `network_hosts`; null
|
|
302
|
+
* follows the org). A B1 snapshot is copied into it by migrations 0165 and 0167, the snapshot
|
|
303
|
+
* writer and every publication (`copyCloudSnapshotNetworks`), never read here.
|
|
304
|
+
*/
|
|
305
|
+
export declare function cloudOwnNetwork(row: {
|
|
306
|
+
network_mode?: unknown;
|
|
307
|
+
network_hosts?: unknown;
|
|
308
|
+
} | undefined): {
|
|
309
|
+
networkMode: "open" | "allowlist" | "none" | null;
|
|
310
|
+
networkHosts: string[];
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* A stored Full access consent (`conversations.permission_consent`): the displayed scope revision
|
|
314
|
+
* the person confirmed, and what it covered, so a narrowing keeps it and only a widening needs a new
|
|
315
|
+
* one (approval-only profiles design, "Profiles" and "Consent fingerprint").
|
|
316
|
+
*/
|
|
317
|
+
export interface StoredConsent {
|
|
318
|
+
deviceId: string;
|
|
319
|
+
scopeRevision: string;
|
|
320
|
+
/** The device, project binding and widening epochs it is bound to. */
|
|
321
|
+
identity?: string;
|
|
322
|
+
/** The crossing ceilings it covered. */
|
|
323
|
+
reach?: ConsentReach;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Whether a stored consent still covers the device's current crossing ceilings: the same device,
|
|
327
|
+
* and either the exact scope it confirmed or the same identity with every ceiling within what it
|
|
328
|
+
* covered (a narrowing never drops Full access to Approve for me).
|
|
329
|
+
*/
|
|
330
|
+
export declare function consentHolds(consent: StoredConsent | null, deviceId: string | null, preview: {
|
|
331
|
+
scopeRevision: string;
|
|
332
|
+
consentIdentity: string;
|
|
333
|
+
consentReach: ConsentReach;
|
|
334
|
+
}): boolean;
|
|
206
335
|
export {};
|