@capybara-hq/kernel 0.1.0-rc.68 → 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/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/marketplaces.service.d.ts +1 -1
- 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/network-asks.d.ts +19 -22
- package/dist/tools/network-asks.js +15 -21
- 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
package/dist/http/api.module.js
CHANGED
|
@@ -43,6 +43,8 @@ import { ConversationsModule } from "../conversations/conversations.module.js";
|
|
|
43
43
|
import { PermissionProfilesController } from "../conversations/permission-profiles.controller.js";
|
|
44
44
|
import { DevicesController } from "../devices/devices.controller.js";
|
|
45
45
|
import { DevicesModule } from "../devices/devices.module.js";
|
|
46
|
+
import { DialInAuthController } from "../dial-in/auth.controller.js";
|
|
47
|
+
import { DialInAuthModule } from "../dial-in/auth.module.js";
|
|
46
48
|
import { EvalsModule } from "../evals/evals.module.js";
|
|
47
49
|
import { EvalRunsController } from "../evals/runs.controller.js";
|
|
48
50
|
import { EvalSetsController } from "../evals/sets.controller.js";
|
|
@@ -64,8 +66,6 @@ import { MeController } from "../identity/me.controller.js";
|
|
|
64
66
|
import { BindController, MeIdentitiesController, SsoController, } from "../identity/sso.controller.js";
|
|
65
67
|
import { InboxModule } from "../inbox/inbox.module.js";
|
|
66
68
|
import { PlatformInboxController } from "../inbox/platform-inbox.controller.js";
|
|
67
|
-
import { DeviceAuthController } from "../local-devices/device-auth.controller.js";
|
|
68
|
-
import { DeviceAuthModule } from "../local-devices/device-auth.module.js";
|
|
69
69
|
import { ModelEnablementController } from "../models/enablement.controller.js";
|
|
70
70
|
import { ModelsModule } from "../models/models.module.js";
|
|
71
71
|
import { ModelPurposesController } from "../models/purposes.controller.js";
|
|
@@ -202,7 +202,7 @@ const CONTROLLERS = [
|
|
|
202
202
|
PlatformThemeController,
|
|
203
203
|
PlatformIconController,
|
|
204
204
|
PlatformIconPublicController,
|
|
205
|
-
|
|
205
|
+
DialInAuthController,
|
|
206
206
|
ClientDeliveryController,
|
|
207
207
|
OrgClientController,
|
|
208
208
|
AdminClientController,
|
|
@@ -238,7 +238,7 @@ ApiModule = __decorate([
|
|
|
238
238
|
ConversationsModule,
|
|
239
239
|
BackgroundModule,
|
|
240
240
|
DevicesModule,
|
|
241
|
-
|
|
241
|
+
DialInAuthModule,
|
|
242
242
|
RuntimeModule,
|
|
243
243
|
ChannelsModule,
|
|
244
244
|
EvalsModule,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Logger } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { FastifyInstance } from "fastify";
|
|
3
3
|
import type { ChannelWebhooks } from "../channels/webhook.js";
|
|
4
|
-
import { type DeviceRoutesOptions } from "../
|
|
4
|
+
import { type DeviceRoutesOptions } from "../dial-in/routes.js";
|
|
5
5
|
/** What the gateway role serves over HTTP besides health and plugin routes. */
|
|
6
6
|
export interface GatewayRoutes {
|
|
7
7
|
webhooks: Pick<ChannelWebhooks, "handle">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { registerChannelWebhookRoute } from "../channels/webhook.controller.js";
|
|
2
|
-
import { registerDeviceConnectRoute
|
|
2
|
+
import { registerDeviceConnectRoute } from "../dial-in/routes.js";
|
|
3
3
|
/**
|
|
4
4
|
* Registers the gateway role's HTTP routes (`serveGateway = roles.includes("gateway")`): the
|
|
5
5
|
* channel webhook and the device connection WebSocket. These are raw Fastify routes, not a Nest
|
|
@@ -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 { DEVICE_PROTOCOL_VERSION } from "@capybara-hq/plugin-sdk";
|
|
10
|
+
import { DEVICE_PROTOCOL_VERSION } from "@capybara-hq/plugin-sdk/device-protocol";
|
|
11
11
|
import { Controller, Get, Header, Inject } from "@nestjs/common";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
import { Public } from "../identity/principal.js";
|
|
@@ -340,7 +340,7 @@ export declare class SettingsService {
|
|
|
340
340
|
/** The settings with the platform's device sandbox settings and attribution defaults in effect. */
|
|
341
341
|
view(): Promise<DeploymentSettingsView>;
|
|
342
342
|
private attributionView;
|
|
343
|
-
/** The
|
|
343
|
+
/** The devices following the platform's network default (their org sets none). */
|
|
344
344
|
private devicesFollowingPlatformDefault;
|
|
345
345
|
/**
|
|
346
346
|
* The refusals of a `devicesOutsideSandbox` / `devicesNetwork` change against the stored choice
|
|
@@ -20,7 +20,7 @@ import { TransactionHost, withOrderedLocks } from "../infra/database/transaction
|
|
|
20
20
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
21
21
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
22
22
|
import { applyDevicesNetworkPatch, applyDevicesOutsideSandboxPatch, configuredDeviceSandbox, DEVICES_NETWORK_PATCH, DEVICES_NETWORK_SETTING, DEVICES_OUTSIDE_SANDBOX_PATCH, DEVICES_OUTSIDE_SANDBOX_SETTING, legacyPermissionFor, legacyPlatformKeysStored, legacyPlatformValue, orgDeviceSandboxOf, readDeviceSandboxSettingsView, readStoredDeviceSandbox, resolveDeviceSandboxSettings, } from "../sandbox/device-sandbox-settings.js";
|
|
23
|
-
import {
|
|
23
|
+
import { devicesFollowingDefault, needsFullCeiling, needsOpenNetwork, PermissionCeilingWrites, } from "../sandbox/permission-ceiling-writes.js";
|
|
24
24
|
import { EXTERNAL_SHARING_SETTING, ExternalSharingValue, HTML_CDN_ALLOWLIST_DEFAULT, HtmlCdnAllowlistSchema, readExternalSharing, readHtmlCdnAllowlist, readShareMaxExpiry, SHARE_MAX_EXPIRY_DEFAULT, SHARE_MAX_EXPIRY_SETTING, ShareMaxExpiryDays, } from "../shares/settings.js";
|
|
25
25
|
import { assertPlatformDefaultEligible, lockThemeShared } from "../themes/theme-state.js";
|
|
26
26
|
import { mergeArrangement, UiArrangementPatchSchema, UiArrangementSchema, } from "../ui/arrangement.js";
|
|
@@ -554,9 +554,9 @@ let SettingsService = class SettingsService {
|
|
|
554
554
|
sources,
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
/** The
|
|
557
|
+
/** The devices following the platform's network default (their org sets none). */
|
|
558
558
|
async devicesFollowingPlatformDefault() {
|
|
559
|
-
const devices = await
|
|
559
|
+
const devices = await devicesFollowingDefault(this.db.db);
|
|
560
560
|
const orgs = await this.db.selectFrom("orgs").select(["id", "settings"]).execute();
|
|
561
561
|
const ownDefault = new Set(orgs
|
|
562
562
|
.filter((o) => orgDeviceSandboxOf(o.settings).deviceNetwork?.default !== undefined)
|
|
@@ -891,23 +891,21 @@ let SettingsService = class SettingsService {
|
|
|
891
891
|
const networkChanged = r.before.network.default !== r.after.network.default ||
|
|
892
892
|
r.before.network.ceiling !== r.after.network.ceiling;
|
|
893
893
|
if (outsideChanged || networkChanged) {
|
|
894
|
-
const machineRoots = outsideOff ? await localMachineRoots(this.db.db) : null;
|
|
895
894
|
// a network ceiling narrowed to the allowlist takes running open-network work
|
|
896
895
|
const networkNarrowed = r.before.network.ceiling === "open" && r.after.network.ceiling === "allowlist";
|
|
897
|
-
// a default narrowed to the allowlist takes it from the
|
|
896
|
+
// a default narrowed to the allowlist takes it from the devices that follow it
|
|
898
897
|
// (their org sets no default of its own)
|
|
899
898
|
const following = !networkNarrowed &&
|
|
900
899
|
r.before.network.default === "open" &&
|
|
901
900
|
r.after.network.default === "allowlist"
|
|
902
901
|
? await this.devicesFollowingPlatformDefault()
|
|
903
902
|
: null;
|
|
904
|
-
const narrows =
|
|
903
|
+
const narrows = outsideOff || networkNarrowed || following !== null;
|
|
905
904
|
await this.ceilings.publishLocked({}, "platform", !narrows
|
|
906
905
|
? false
|
|
907
906
|
: (scope, row) => (needsOpenNetwork(scope) &&
|
|
908
907
|
(networkNarrowed || following?.has(row.device_id) === true)) ||
|
|
909
|
-
(
|
|
910
|
-
needsWiderDeviceCeiling(scope, machineRoots.get(row.device_id))),
|
|
908
|
+
(outsideOff && needsFullCeiling(scope)),
|
|
911
909
|
// only a widening resets Full consent: a narrowing keeps what it covered
|
|
912
910
|
(r.before.outsideSandbox.permission === "off" &&
|
|
913
911
|
r.after.outsideSandbox.permission === "allowed") ||
|
|
@@ -63,8 +63,8 @@ const HOT_APPLIERS = {
|
|
|
63
63
|
"devices.defaultProvider": () => { },
|
|
64
64
|
// The devices service reads the personal limit at every create.
|
|
65
65
|
"devices.maxPersonal": () => { },
|
|
66
|
-
// The
|
|
67
|
-
"devices.
|
|
66
|
+
// The dial-in gateway and relay read the reconnect grace at every disconnect and token response.
|
|
67
|
+
"devices.dialIn.reconnectGraceSeconds": () => { },
|
|
68
68
|
// Sub-agent limits are read at every dispatch, child step and tool resolution.
|
|
69
69
|
"subagents.maxDepth": () => { },
|
|
70
70
|
"subagents.maxConcurrentPerConversation": () => { },
|
|
@@ -340,20 +340,6 @@ export declare const OUTBOX_JOBS: {
|
|
|
340
340
|
readonly removeOnFail: true;
|
|
341
341
|
};
|
|
342
342
|
};
|
|
343
|
-
readonly "device-op-resolve": {
|
|
344
|
-
readonly queue: "cap-kernel-maintenance";
|
|
345
|
-
readonly idempotent: "resolving an op whose entry is gone is a no-op (the entry is read under the machine row's lock, and under the network ask's lock for an op that answers one, so the ask is decided at most once); the resolver only reads the device, never sends a change";
|
|
346
|
-
readonly processedIn: "packages/kernel/src/runtime/maintenance.ts";
|
|
347
|
-
readonly opts: {
|
|
348
|
-
readonly attempts: 5;
|
|
349
|
-
readonly backoff: {
|
|
350
|
-
readonly type: "exponential";
|
|
351
|
-
readonly delay: 5000;
|
|
352
|
-
};
|
|
353
|
-
readonly removeOnComplete: true;
|
|
354
|
-
readonly removeOnFail: true;
|
|
355
|
-
};
|
|
356
|
-
};
|
|
357
343
|
readonly "bg-wake": {
|
|
358
344
|
readonly queue: "cap-kernel-maintenance";
|
|
359
345
|
readonly idempotent: "the wake only calls ensureRun, which decides from the conversation's state under its row lock, so a wake with nothing unconsumed or an active run starts nothing";
|
|
@@ -302,21 +302,6 @@ export const OUTBOX_JOBS = {
|
|
|
302
302
|
removeOnFail: true,
|
|
303
303
|
},
|
|
304
304
|
},
|
|
305
|
-
// `local-devices/policy-op-jobs.ts` DEVICE_OP_RESOLVE_JOB: owed by a device policy op's intent
|
|
306
|
-
// transaction under `deviceOpResolveJobId` with `runAt` = when the op can no longer reach the
|
|
307
|
-
// machine, and by a hello that reported the op's outcome under `deviceOpReportedJobId` (spec §7)
|
|
308
|
-
"device-op-resolve": {
|
|
309
|
-
queue: "cap-kernel-maintenance",
|
|
310
|
-
idempotent: "resolving an op whose entry is gone is a no-op (the entry is read under the machine row's lock, and under the network ask's lock for an op that answers one, so the ask is decided at most once); the resolver only reads the device, never sends a change",
|
|
311
|
-
processedIn: "packages/kernel/src/runtime/maintenance.ts",
|
|
312
|
-
// retried while PG or the device is briefly unreachable; removed once done
|
|
313
|
-
opts: {
|
|
314
|
-
attempts: 5,
|
|
315
|
-
backoff: { type: "exponential", delay: 5_000 },
|
|
316
|
-
removeOnComplete: true,
|
|
317
|
-
removeOnFail: true,
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
305
|
// `background/wake-rules.ts` BG_WAKE_JOB: owed by the `ensureRun` transaction that finds a
|
|
321
306
|
// conversation's wake inside its wake window, under `bgWakeJobId`, with `runAt` = the window's
|
|
322
307
|
// end (background Bash spec §3)
|
|
@@ -27,7 +27,7 @@ export interface NamedThrottler {
|
|
|
27
27
|
* | `PUT /api/v1/me/password` | `change-password`, `change-password-ip` |
|
|
28
28
|
* | `POST /api/v1/setup` | `setup-token`, `setup-ip` |
|
|
29
29
|
* | `POST /api/v1/invitations/:token/accept` | `invitation`, `invitation-ip` |
|
|
30
|
-
* | `GET /api/v1/device/pending/:userCode`, `POST /api/v1/device/confirm`, `POST /api/v1/device/deny` | `device-code-account` |
|
|
30
|
+
* | `GET /api/v1/device/pending/:userCode`, `GET /api/v1/device/providers`, `POST /api/v1/device/confirm`, `POST /api/v1/device/deny` | `device-code-account` |
|
|
31
31
|
* | `GET /api/v1/s/:code`, `…/content`, `…/text`, `…/inline`, `…/html`, `POST …/embed-token/:plugin/:previewerId`, `GET …/previews/:plugin/:previewerId` | `share-open` |
|
|
32
32
|
*
|
|
33
33
|
* `POST /api/v1/orgs/:orgId/ui/client/reports` and `POST /api/v1/admin/ui/client/reports` opt in to
|
|
@@ -28,7 +28,7 @@ const LOGIN_MSG = "Too many failed login attempts; try again later";
|
|
|
28
28
|
* | `PUT /api/v1/me/password` | `change-password`, `change-password-ip` |
|
|
29
29
|
* | `POST /api/v1/setup` | `setup-token`, `setup-ip` |
|
|
30
30
|
* | `POST /api/v1/invitations/:token/accept` | `invitation`, `invitation-ip` |
|
|
31
|
-
* | `GET /api/v1/device/pending/:userCode`, `POST /api/v1/device/confirm`, `POST /api/v1/device/deny` | `device-code-account` |
|
|
31
|
+
* | `GET /api/v1/device/pending/:userCode`, `GET /api/v1/device/providers`, `POST /api/v1/device/confirm`, `POST /api/v1/device/deny` | `device-code-account` |
|
|
32
32
|
* | `GET /api/v1/s/:code`, `…/content`, `…/text`, `…/inline`, `…/html`, `POST …/embed-token/:plugin/:previewerId`, `GET …/previews/:plugin/:previewerId` | `share-open` |
|
|
33
33
|
*
|
|
34
34
|
* `POST /api/v1/orgs/:orgId/ui/client/reports` and `POST /api/v1/admin/ui/client/reports` opt in to
|
package/dist/kernel.module.js
CHANGED
|
@@ -37,7 +37,6 @@ import { KERNEL_POOL, REDIS } from "./infra/tokens.js";
|
|
|
37
37
|
import { ValidationModule } from "./infra/validation/validation.module.js";
|
|
38
38
|
import { KernelLifecycle } from "./lifecycle/kernel-lifecycle.js";
|
|
39
39
|
import { KERNEL_APP_OPTIONS } from "./lifecycle/tokens.js";
|
|
40
|
-
import { LocalDevicesModule } from "./local-devices/local-devices.module.js";
|
|
41
40
|
import { createConfiguredLogger } from "./log-config.js";
|
|
42
41
|
import { KERNEL_OVERRIDE_TOKENS } from "./overrides.js";
|
|
43
42
|
import { PlatformModule } from "./platform/platform.module.js";
|
|
@@ -129,8 +128,6 @@ let KernelModule = KernelModule_1 = class KernelModule {
|
|
|
129
128
|
PluginRouteAccessModule,
|
|
130
129
|
// client extensions: the client builds stored with extension packages
|
|
131
130
|
ClientModule,
|
|
132
|
-
// the @local sandbox provider, registered on every role (any replica may relay to a machine)
|
|
133
|
-
LocalDevicesModule,
|
|
134
131
|
// the Platform tool's operation registry and actor facts
|
|
135
132
|
PlatformModule,
|
|
136
133
|
// its operations (skills, agents, ...), registered at start on every role
|
|
@@ -24,7 +24,7 @@ import { hostGrantable, hostGrantCeiling, } from "../sandbox/device-sandbox.js";
|
|
|
24
24
|
import { keepOrgLegacyKeysInStep, orgDeviceSandboxOf, readDeviceSandboxSettingsView, } from "../sandbox/device-sandbox-settings.js";
|
|
25
25
|
import { coversHost, orgCloudMode, orgEffectiveHosts, orgHostOutsideCeiling, } from "../sandbox/modes.js";
|
|
26
26
|
import { PermissionAuthorityModule } from "../sandbox/permission-authority.module.js";
|
|
27
|
-
import {
|
|
27
|
+
import { devicesFollowingDefault, hostsNarrowed, needsFullCeiling, needsOpenNetwork, PermissionCeilingWrites, } from "../sandbox/permission-ceiling-writes.js";
|
|
28
28
|
import { readExternalSharing, readShareMaxExpiry, } from "../shares/settings.js";
|
|
29
29
|
import { assertThemeOnIn } from "../themes/theme-state.js";
|
|
30
30
|
import { IanaTimeZone } from "../time-zone.js";
|
|
@@ -796,27 +796,22 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
796
796
|
const resetConsent = (effOutside(before) === "off" && effOutside(reread) === "allowed") ||
|
|
797
797
|
effectiveNetworkWidens(prevNet, nextNet) !== null ||
|
|
798
798
|
deviceNetworkHostsWiden(before.deviceNetwork, reread.deviceNetwork);
|
|
799
|
-
const machineRoots = await localMachineRoots(this.db.db, orgId);
|
|
800
799
|
// a network ceiling narrowed to the allowlist takes running open-network work; a default
|
|
801
|
-
// narrowed to the allowlist takes it from the
|
|
800
|
+
// narrowed to the allowlist takes it from the devices that follow the default
|
|
802
801
|
const networkNarrowed = prevNet.ceiling === "open" && nextNet.ceiling === "allowlist";
|
|
803
802
|
const following = !networkNarrowed && prevNet.default === "open" && nextNet.default === "allowlist"
|
|
804
|
-
? await
|
|
803
|
+
? await devicesFollowingDefault(this.db.db, orgId)
|
|
805
804
|
: null;
|
|
806
805
|
// the per-call hosts the org's new ceiling still allows (its hard allowlist ceiling and its
|
|
807
806
|
// exclusions): an independent grant keeps a removed host only within it
|
|
808
807
|
const lim = this.config.get().sandbox.limits;
|
|
809
|
-
const grantCeiling = hostGrantCeiling({ boundary: "operation", networkMode: "allowlist", networkCeiling: nextNet.ceiling }, lim, reread.deviceNetwork === undefined ? {} : { deviceNetwork: reread.deviceNetwork }
|
|
808
|
+
const grantCeiling = hostGrantCeiling({ boundary: "operation", networkMode: "allowlist", networkCeiling: nextNet.ceiling }, lim, reread.deviceNetwork === undefined ? {} : { deviceNetwork: reread.deviceNetwork });
|
|
810
809
|
const orgHosts = orgEffectiveHosts(lim, reread.deviceNetwork);
|
|
811
810
|
await this.ceilings.publishLocked({ orgId }, "org", (scope, row) => {
|
|
812
811
|
if (needsOpenNetwork(scope) &&
|
|
813
812
|
(networkNarrowed || following?.has(row.device_id) === true))
|
|
814
813
|
return true;
|
|
815
|
-
// outside off takes escalated work
|
|
816
|
-
// anything else still goes through the host check below
|
|
817
|
-
if (after.outsideSandbox === "off" &&
|
|
818
|
-
needsWiderDeviceCeiling(scope, machineRoots.get(row.device_id)))
|
|
819
|
-
return true;
|
|
814
|
+
// outside off takes escalated work; anything else still goes through the host check
|
|
820
815
|
if (needsFullCeiling(scope))
|
|
821
816
|
return after.outsideSandbox === "off";
|
|
822
817
|
return hostsNarrowed(scope, row, orgHosts, (host) => hostGrantable(grantCeiling, host));
|
package/dist/overrides.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ import { OUTBOX_DISPATCH_FAILS } from "./infra/outbox/outbox.dispatcher.js";
|
|
|
18
18
|
import { OUTBOX_FAST_PATH_SETTLED } from "./infra/outbox/outbox.module.js";
|
|
19
19
|
import { PRESENCE_INTERVAL_MS } from "./infra/presence/replica-presence.js";
|
|
20
20
|
import type { KernelQueueName } from "./infra/queue/queue-names.js";
|
|
21
|
-
import { DEVICE_POLICY_AFTER_CALL } from "./local-devices/device-policy.service.js";
|
|
22
21
|
import { PUSH_SEND_TIMEOUT_MS } from "./push/delivery.js";
|
|
23
22
|
import { PROJECT_KNOWLEDGE_TIMEOUT } from "./runtime/project/knowledge.service.js";
|
|
24
23
|
import { LIST_MODELS_TIMEOUT } from "./runtime/providers.js";
|
|
@@ -58,8 +57,6 @@ import { EMBED_TOKEN_CLOCK } from "./ui/embed-token.js";
|
|
|
58
57
|
* - `OUTBOX_FAST_PATH_SETTLED`: receives each detached outbox fast-path pass (a test awaits them);
|
|
59
58
|
* - `ENSURE_RUN_FAILS`: returns true to make `RunQueue.ensureRun` throw (Redis unreachable, or the
|
|
60
59
|
* direct call after a commit skipped by a crash);
|
|
61
|
-
* - `DEVICE_POLICY_AFTER_CALL`: called after a device policy op's call, before its outcome is
|
|
62
|
-
* recorded (throwing stands for a crash between the call and the resolve transaction);
|
|
63
60
|
* - `PROJECT_KNOWLEDGE_TIMEOUT`: the run-start read of a bound project's time limit, read at every
|
|
64
61
|
* read (a test shortens it for one run);
|
|
65
62
|
* - `PUSH_SEND_TIMEOUT_MS`: one push send's time limit, read at every send (a test shortens it
|
|
@@ -105,7 +102,6 @@ interface KernelSeams {
|
|
|
105
102
|
[PROMPT_SUGGESTION_TIMEOUT]: () => number;
|
|
106
103
|
[PUSH_SEND_TIMEOUT_MS]: () => number;
|
|
107
104
|
[PLUGIN_PUBLIC_WRITE_LIMIT]: number;
|
|
108
|
-
[DEVICE_POLICY_AFTER_CALL]: (opId: string) => void;
|
|
109
105
|
[EXTENSION_NET_SEAMS]: ExtensionNetSeams;
|
|
110
106
|
[APP_INTERCEPTOR]: NestInterceptor;
|
|
111
107
|
[PERMISSION_CONTEXT_ACTIVATION]: boolean;
|
package/dist/overrides.js
CHANGED
|
@@ -15,7 +15,6 @@ import { PLUGIN_PUBLIC_WRITE_LIMIT } from "./http/plugin-route-access.js";
|
|
|
15
15
|
import { OUTBOX_DISPATCH_FAILS } from "./infra/outbox/outbox.dispatcher.js";
|
|
16
16
|
import { OUTBOX_FAST_PATH_SETTLED } from "./infra/outbox/outbox.module.js";
|
|
17
17
|
import { PRESENCE_INTERVAL_MS } from "./infra/presence/replica-presence.js";
|
|
18
|
-
import { DEVICE_POLICY_AFTER_CALL } from "./local-devices/device-policy.service.js";
|
|
19
18
|
import { PUSH_SEND_TIMEOUT_MS } from "./push/delivery.js";
|
|
20
19
|
import { PROJECT_KNOWLEDGE_TIMEOUT } from "./runtime/project/knowledge.service.js";
|
|
21
20
|
import { LIST_MODELS_TIMEOUT } from "./runtime/providers.js";
|
|
@@ -58,7 +57,6 @@ const SEAM_TOKENS = [
|
|
|
58
57
|
PROMPT_SUGGESTION_TIMEOUT,
|
|
59
58
|
PUSH_SEND_TIMEOUT_MS,
|
|
60
59
|
PLUGIN_PUBLIC_WRITE_LIMIT,
|
|
61
|
-
DEVICE_POLICY_AFTER_CALL,
|
|
62
60
|
EXTENSION_NET_SEAMS,
|
|
63
61
|
APP_INTERCEPTOR,
|
|
64
62
|
PERMISSION_CONTEXT_ACTIVATION,
|
|
@@ -242,11 +242,6 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
242
242
|
category: "human-only",
|
|
243
243
|
reason: "Disconnects a person's own machine (revokes its credential); a trust decision taken on the device's page",
|
|
244
244
|
},
|
|
245
|
-
{
|
|
246
|
-
route: "POST /api/v1/orgs/:orgId/devices/:id/policy",
|
|
247
|
-
category: "human-only",
|
|
248
|
-
reason: "A person narrows their own machine's sandbox (hosts, network, running outside the sandbox) on its device page; widening happens on the machine, never through an agent",
|
|
249
|
-
},
|
|
250
245
|
{
|
|
251
246
|
route: "POST /api/v1/device/authorize",
|
|
252
247
|
category: "transport",
|
|
@@ -262,6 +257,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
262
257
|
category: "human-only",
|
|
263
258
|
reason: "Shows the machine behind a code the person read off their own machine",
|
|
264
259
|
},
|
|
260
|
+
{
|
|
261
|
+
route: "GET /api/v1/device/providers",
|
|
262
|
+
category: "human-only",
|
|
263
|
+
reason: "Lists the providers that may take the machine behind a code the person read off their own machine, for the confirmation page",
|
|
264
|
+
},
|
|
265
265
|
{
|
|
266
266
|
route: "POST /api/v1/device/confirm",
|
|
267
267
|
category: "human-only",
|
|
@@ -170,7 +170,7 @@ let AdminOperations = class AdminOperations {
|
|
|
170
170
|
}),
|
|
171
171
|
defineOperation({
|
|
172
172
|
id: "admin.health",
|
|
173
|
-
description: 'How the platform runs right now (super admin), to answer "is the worker up, is the run queue backing up": kernel.version; replicas (live kernel processes: id, roles, version, startedAt) and roles (live replicas per role: api serves requests, worker runs conversations and jobs, gateway holds channel and device connections; 0 workers means no run starts); queues (per kernel queue, e.g. cap-kernel-runs: waiting, active, delayed, failed and failedLastDay, counts only); channels (online, offline: active long connections no replica holds, webhook, disabled, error); devices (online
|
|
173
|
+
description: 'How the platform runs right now (super admin), to answer "is the worker up, is the run queue backing up": kernel.version; replicas (live kernel processes: id, roles, version, startedAt) and roles (live replicas per role: api serves requests, worker runs conversations and jobs, gateway holds channel and device connections; 0 workers means no run starts); queues (per kernel queue, e.g. cap-kernel-runs: waiting, active, delayed, failed and failedLastDay, counts only); channels (online, offline: active long connections no replica holds, webhook, disabled, error); devices (online: devices whose machine a replica holds now; dialIn: devices of providers a machine signs in to; byProvider: live devices per provider); sandboxes (running, suspended, running per provider). unavailable names a source that did not answer (redis or database); its numbers are then null. Failure details are in the kernel logs, not here.',
|
|
174
174
|
input: z.object({}).strict(),
|
|
175
175
|
example: {},
|
|
176
176
|
authz: { superAdmin: true },
|
|
@@ -29,6 +29,7 @@ const row = (c) => ({
|
|
|
29
29
|
name: c.title ?? "Untitled",
|
|
30
30
|
state: c.activity ?? (c.archivedAt === null ? "idle" : "archived"),
|
|
31
31
|
agentId: c.agentId,
|
|
32
|
+
agent: c.agent,
|
|
32
33
|
updatedAt: c.updatedAt,
|
|
33
34
|
});
|
|
34
35
|
/**
|
|
@@ -74,7 +75,7 @@ let ConversationsOperations = class ConversationsOperations {
|
|
|
74
75
|
this.registry.register([
|
|
75
76
|
defineOperation({
|
|
76
77
|
id: "conversations.list",
|
|
77
|
-
description: "List your own conversations, most recently updated first: id, name, state (running, waiting, idle or archived), agent id and update time. Pages by 50: pass the returned next as params.after. Filter by title text q, by agentId, by state (running or waiting), or pass archived 1 for the archived ones.",
|
|
78
|
+
description: "List your own conversations, most recently updated first: id, name, state (running, waiting, idle or archived), agent (id, name, profile; null when no longer visible) and update time. Pages by 50: pass the returned next as params.after; the first page (no after) also returns total, the count of all matches. Filter by title text q, by agentId, by state (running or waiting), or pass archived 1 for the archived ones.",
|
|
78
79
|
input: ListQuery.pick({
|
|
79
80
|
q: true,
|
|
80
81
|
state: true,
|
|
@@ -89,8 +90,9 @@ let ConversationsOperations = class ConversationsOperations {
|
|
|
89
90
|
omits: ["limit"],
|
|
90
91
|
confirm: "read",
|
|
91
92
|
run: async (input, ctx) => {
|
|
92
|
-
const rows = await this.conversations.listMine(ctx.orgId, ctx.actorAccountId, {
|
|
93
|
+
const { conversations: rows, total } = await this.conversations.listMine(ctx.orgId, ctx.actorAccountId, {
|
|
93
94
|
limit: PAGE + 1,
|
|
95
|
+
total: input.after === undefined,
|
|
94
96
|
...(input.after !== undefined && { after: input.after }),
|
|
95
97
|
...(input.agentId !== undefined && { agentId: input.agentId }),
|
|
96
98
|
...(input.q !== undefined && { q: input.q }),
|
|
@@ -101,6 +103,7 @@ let ConversationsOperations = class ConversationsOperations {
|
|
|
101
103
|
return {
|
|
102
104
|
conversations: items.map(row),
|
|
103
105
|
next: rows.length > PAGE ? (items.at(-1)?.id ?? null) : null,
|
|
106
|
+
...(total !== undefined && { total }),
|
|
104
107
|
};
|
|
105
108
|
},
|
|
106
109
|
}),
|
|
@@ -31,18 +31,13 @@ function stateOf(e) {
|
|
|
31
31
|
next: "Ask an org admin to switch its provider back on; use another device meanwhile.",
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
if (e.filesLost && e.source === "local") {
|
|
35
|
-
return {
|
|
36
|
-
state: "files_lost",
|
|
37
|
-
reason: "Its directory is gone from the connected machine.",
|
|
38
|
-
next: "Ask the person to run capybara-device logout, then capybara-device login into this device, on that machine.",
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
34
|
if (e.filesLost) {
|
|
42
35
|
return {
|
|
43
36
|
state: "files_lost",
|
|
44
37
|
reason: "Its file system is gone at the provider.",
|
|
45
|
-
next:
|
|
38
|
+
next: e.report?.reset === false
|
|
39
|
+
? "Its provider offers no file reset: ask the person to set the device up again where its provider keeps its files, or use another device."
|
|
40
|
+
: "Wipe its files with devices.reset-files to use it again.",
|
|
46
41
|
};
|
|
47
42
|
}
|
|
48
43
|
if (e.reconcileRequired) {
|
|
@@ -59,8 +54,8 @@ const row = (e) => ({
|
|
|
59
54
|
name: labelOf(e),
|
|
60
55
|
...stateOf(e),
|
|
61
56
|
isDefault: e.isDefault,
|
|
62
|
-
source: e.source,
|
|
63
57
|
provider: e.provider,
|
|
58
|
+
dialIn: e.dialIn,
|
|
64
59
|
online: e.online,
|
|
65
60
|
machine: e.machine && {
|
|
66
61
|
name: e.machine.name,
|
|
@@ -119,7 +114,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
119
114
|
this.registry.register([
|
|
120
115
|
defineOperation({
|
|
121
116
|
id: "devices.list",
|
|
122
|
-
description: "List your own devices in this org: one compact row each (name, state, whether it is the default,
|
|
117
|
+
description: "List your own devices in this org: one compact row each (name, state, whether it is the default, provider, whether it is a dial-in device signed in from a machine, whether that machine is online and which it is, last use), plus the default and last used ids, the device providers on in this org (a new device may name one) and the default provider (null: a new device must name one). The default device is shown as Personal. A device stays on the provider it was created on; while that provider is off it is unavailable.",
|
|
123
118
|
input: z.object({}).strict(),
|
|
124
119
|
example: {},
|
|
125
120
|
authz: { orgAction: "agents.use" },
|
|
@@ -138,7 +133,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
138
133
|
}),
|
|
139
134
|
defineOperation({
|
|
140
135
|
id: "devices.get",
|
|
141
|
-
description: "Read one of your devices with its
|
|
136
|
+
description: "Read one of your devices with its provider, whether it is a dial-in device (its machine and whether that is online), state, instance, its provider's report (a description of what it allows, its home, its own limits, whether it offers a file reset), limits, its sandbox (the network in effect and its ceiling: open, allowlist or none, with the allowlist hosts; the device's own network setting and host list; whether a call may run outside the sandbox; which layer set each ceiling; a pending change that applies on its next use; its recent setting changes), and creation time. Takes the id from devices.list. Its network can be narrowed with devices.set-network.",
|
|
142
137
|
input: DeviceId,
|
|
143
138
|
example: { deviceId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20" },
|
|
144
139
|
authz: { orgAction: "agents.use" },
|
|
@@ -261,7 +256,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
261
256
|
},
|
|
262
257
|
{
|
|
263
258
|
code: "device.files_on_device",
|
|
264
|
-
next: "Its
|
|
259
|
+
next: "Its provider does not reset its files (the message says what it is): use another device, or ask the person to set this one up again.",
|
|
265
260
|
},
|
|
266
261
|
{
|
|
267
262
|
code: "device.unavailable",
|
|
@@ -319,7 +314,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
319
314
|
}),
|
|
320
315
|
defineOperation({
|
|
321
316
|
id: "devices.set-network",
|
|
322
|
-
description: "Narrow the sandbox network of one of your
|
|
317
|
+
description: "Narrow the sandbox network of one of your devices: mode allowlist (its organization's allowed hosts, optionally narrowed to hosts: a device's list never adds a host) or none (no network). Only narrowing is allowed here, in its stored setting and in effect: opening the network, adding a host, dropping its own host list or following the organization again (mode null) is refused and needs the person on the device's page. Takes the id from devices.list; devices.get shows the network in effect.",
|
|
323
318
|
input: DeviceId.extend({ network: DeviceNetworkBody }).strict(),
|
|
324
319
|
example: {
|
|
325
320
|
deviceId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20",
|
|
@@ -339,10 +334,6 @@ let DevicesOperations = class DevicesOperations {
|
|
|
339
334
|
code: "device.network_not_allowed",
|
|
340
335
|
next: "Through this tool a device's network may only narrow, within its organization's hosts: pick allowlist or none, or hosts its organization allows (devices.get shows them). To open it, ask the person to change it on the device's page; a host outside the organization's list needs an org admin.",
|
|
341
336
|
},
|
|
342
|
-
{
|
|
343
|
-
code: "device.ceiling_on_machine",
|
|
344
|
-
next: "This is a local device: its network is kept on its machine. Ask the person to narrow it on the device's page or on the machine.",
|
|
345
|
-
},
|
|
346
337
|
],
|
|
347
338
|
precheck: (i, ctx) => precheckBy(() => this.devices.checkNetwork(ctx.orgId, ctx.actorAccountId, i.deviceId, i.network, true)),
|
|
348
339
|
summary: async (i, ctx) => {
|
|
@@ -416,11 +407,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
416
407
|
},
|
|
417
408
|
{
|
|
418
409
|
code: "device.offline",
|
|
419
|
-
next: "
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
code: "device.project_home_unknown",
|
|
423
|
-
next: "Ask the person to update capybara-device on that machine and reconnect it.",
|
|
410
|
+
next: "The machine serving it is offline: ask the person to connect that machine again, then call again.",
|
|
424
411
|
},
|
|
425
412
|
],
|
|
426
413
|
run: (input, ctx) => this.projects.candidates(ctx.orgId, ctx.actorAccountId, input.deviceId),
|
|
@@ -469,11 +456,11 @@ let DevicesOperations = class DevicesOperations {
|
|
|
469
456
|
},
|
|
470
457
|
{
|
|
471
458
|
code: "device.projects_unsupported",
|
|
472
|
-
next: "This device offers no projects: work without one
|
|
459
|
+
next: "This device's provider offers no projects: work without one.",
|
|
473
460
|
},
|
|
474
461
|
{
|
|
475
462
|
code: "device.offline",
|
|
476
|
-
next: "
|
|
463
|
+
next: "The machine serving it is offline: ask the person to connect that machine again, then call again.",
|
|
477
464
|
},
|
|
478
465
|
],
|
|
479
466
|
precheck: (i, ctx) => precheckBy(() => this.projects.checkAdd(ctx.orgId, ctx.actorAccountId, i.deviceId, i.name)),
|
|
@@ -111,7 +111,7 @@ function orgRow(i) {
|
|
|
111
111
|
case "schedule_attention": {
|
|
112
112
|
const a = i.attention;
|
|
113
113
|
const summary = a.reason === "missing_grants"
|
|
114
|
-
? `Scheduled task "${a.name}" ran without: ${a.missing.join(", ")}.${a.needsRole.length > 0 ? ` Needing a higher role than the owner has (cannot be pre-approved): ${a.needsRole.join(", ")}.` : ""}${a.needsAdmin.length > 0 ? ` Outside the organization's network allowlist (only an org admin can add them): ${a.needsAdmin.join(", ")}.` : ""}
|
|
114
|
+
? `Scheduled task "${a.name}" ran without: ${a.missing.join(", ")}.${a.needsRole.length > 0 ? ` Needing a higher role than the owner has (cannot be pre-approved): ${a.needsRole.join(", ")}.` : ""}${a.needsAdmin.length > 0 ? ` Outside the organization's network allowlist (only an org admin can add them): ${a.needsAdmin.join(", ")}.` : ""}`
|
|
115
115
|
: a.reason === "failed"
|
|
116
116
|
? `Scheduled task "${a.name}"'s latest run failed${a.error ? `: ${a.error}` : ""}.`
|
|
117
117
|
: `Scheduled task "${a.name}" is paused (${a.reason}${a.pausedBy ? ` by ${a.pausedBy.name || a.pausedBy.id}` : ""}).`;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ExtensionContext } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { ChannelSupervisor } from "../channels/supervisor.js";
|
|
3
3
|
import { ChannelWebhooks } from "../channels/webhook.js";
|
|
4
|
+
import { DialInGateway } from "../dial-in/gateway.js";
|
|
4
5
|
import { ExtensionHost } from "../extensions/host.js";
|
|
5
6
|
import type { GatewayRoutes } from "../http/gateway-routes.js";
|
|
6
7
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
7
|
-
import { LocalDeviceGateway } from "../local-devices/local-device-gateway.js";
|
|
8
8
|
/**
|
|
9
9
|
* The gateway role's parts, driven by `KernelLifecycle` at fixed points of its start order and
|
|
10
10
|
* stop phases: the channel long-connection supervisor (leader election and share) and the webhook
|
|
11
11
|
* inbound (its raw Fastify route, {@link routes}, and its runtime cache's invalidation), and the
|
|
12
|
-
* device connections ({@link
|
|
12
|
+
* device connections ({@link DialInGateway}, `GET /device/connect`). Provided
|
|
13
13
|
* only by `GatewayModule`, so a process without the gateway role has none of them.
|
|
14
14
|
*/
|
|
15
15
|
export declare class GatewayRole {
|
|
@@ -26,7 +26,7 @@ export declare class GatewayRole {
|
|
|
26
26
|
private unsubscribeWebhooks;
|
|
27
27
|
/** The supervisor was started: the runs phase stops it. */
|
|
28
28
|
private supervisorStarted;
|
|
29
|
-
constructor(config: KernelConfigService, host: ExtensionHost, bus: Pick<ExtensionContext["bus"], "subscribe">, supervisor: ChannelSupervisor, webhooks: ChannelWebhooks, devices:
|
|
29
|
+
constructor(config: KernelConfigService, host: ExtensionHost, bus: Pick<ExtensionContext["bus"], "subscribe">, supervisor: ChannelSupervisor, webhooks: ChannelWebhooks, devices: DialInGateway);
|
|
30
30
|
/**
|
|
31
31
|
* The gateway role's HTTP routes (the channel webhook, the device connection), registered when
|
|
32
32
|
* the app is built.
|
|
@@ -11,15 +11,15 @@ import { Inject, Injectable } from "@nestjs/common";
|
|
|
11
11
|
import { CHANNEL_CHANGED_TOPIC } from "../channels/connections.service.js";
|
|
12
12
|
import { ChannelSupervisor } from "../channels/supervisor.js";
|
|
13
13
|
import { ChannelWebhooks } from "../channels/webhook.js";
|
|
14
|
+
import { DialInGateway } from "../dial-in/gateway.js";
|
|
14
15
|
import { ExtensionHost } from "../extensions/host.js";
|
|
15
16
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
16
17
|
import { KERNEL_BUS } from "../infra/tokens.js";
|
|
17
|
-
import { LocalDeviceGateway } from "../local-devices/local-device-gateway.js";
|
|
18
18
|
/**
|
|
19
19
|
* The gateway role's parts, driven by `KernelLifecycle` at fixed points of its start order and
|
|
20
20
|
* stop phases: the channel long-connection supervisor (leader election and share) and the webhook
|
|
21
21
|
* inbound (its raw Fastify route, {@link routes}, and its runtime cache's invalidation), and the
|
|
22
|
-
* device connections ({@link
|
|
22
|
+
* device connections ({@link DialInGateway}, `GET /device/connect`). Provided
|
|
23
23
|
* only by `GatewayModule`, so a process without the gateway role has none of them.
|
|
24
24
|
*/
|
|
25
25
|
let GatewayRole = class GatewayRole {
|
|
@@ -55,7 +55,7 @@ let GatewayRole = class GatewayRole {
|
|
|
55
55
|
webhookMaxBodyBytes: config.channels.webhookMaxBodyBytes,
|
|
56
56
|
devices: {
|
|
57
57
|
gateway: this.devices,
|
|
58
|
-
maxFrameBytes: config.devices.
|
|
58
|
+
maxFrameBytes: config.devices.dialIn.maxFrameBytes,
|
|
59
59
|
},
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -121,6 +121,6 @@ GatewayRole = __decorate([
|
|
|
121
121
|
__param(2, Inject(KERNEL_BUS)),
|
|
122
122
|
__param(3, Inject(ChannelSupervisor)),
|
|
123
123
|
__param(4, Inject(ChannelWebhooks)),
|
|
124
|
-
__param(5, Inject(
|
|
124
|
+
__param(5, Inject(DialInGateway))
|
|
125
125
|
], GatewayRole);
|
|
126
126
|
export { GatewayRole };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The gateway role (nest kernel spec §2), imported by `KernelModule` only when `roles` includes
|
|
3
3
|
* `gateway`: the channel long-connection supervisor, the webhook inbound (served as a raw Fastify
|
|
4
|
-
* route, `http/gateway-routes.ts`), the device connections ({@link
|
|
4
|
+
* route, `http/gateway-routes.ts`), the device connections ({@link DialInGateway}, `GET
|
|
5
5
|
* /device/connect`) and {@link GatewayRole}, which `KernelLifecycle` drives. It runs
|
|
6
6
|
* no cron and no queue consumer (those are the worker role's).
|
|
7
7
|
*/
|
|
@@ -8,14 +8,14 @@ import { Module } from "@nestjs/common";
|
|
|
8
8
|
import { ChannelsModule } from "../channels/channels.module.js";
|
|
9
9
|
import { ChannelSupervisor } from "../channels/supervisor.js";
|
|
10
10
|
import { ChannelWebhooks } from "../channels/webhook.js";
|
|
11
|
+
import { DialInModule } from "../dial-in/dial-in.module.js";
|
|
12
|
+
import { DialInGateway } from "../dial-in/gateway.js";
|
|
11
13
|
import { ExtensionsModule } from "../extensions/extensions.module.js";
|
|
12
|
-
import { LocalDeviceGateway } from "../local-devices/local-device-gateway.js";
|
|
13
|
-
import { LocalDevicesModule } from "../local-devices/local-devices.module.js";
|
|
14
14
|
import { GatewayRole } from "./gateway-role.js";
|
|
15
15
|
/**
|
|
16
16
|
* The gateway role (nest kernel spec §2), imported by `KernelModule` only when `roles` includes
|
|
17
17
|
* `gateway`: the channel long-connection supervisor, the webhook inbound (served as a raw Fastify
|
|
18
|
-
* route, `http/gateway-routes.ts`), the device connections ({@link
|
|
18
|
+
* route, `http/gateway-routes.ts`), the device connections ({@link DialInGateway}, `GET
|
|
19
19
|
* /device/connect`) and {@link GatewayRole}, which `KernelLifecycle` drives. It runs
|
|
20
20
|
* no cron and no queue consumer (those are the worker role's).
|
|
21
21
|
*/
|
|
@@ -23,8 +23,8 @@ let GatewayModule = class GatewayModule {
|
|
|
23
23
|
};
|
|
24
24
|
GatewayModule = __decorate([
|
|
25
25
|
Module({
|
|
26
|
-
imports: [ChannelsModule, ExtensionsModule,
|
|
27
|
-
providers: [ChannelSupervisor, ChannelWebhooks,
|
|
26
|
+
imports: [ChannelsModule, ExtensionsModule, DialInModule],
|
|
27
|
+
providers: [ChannelSupervisor, ChannelWebhooks, DialInGateway, GatewayRole],
|
|
28
28
|
exports: [GatewayRole],
|
|
29
29
|
})
|
|
30
30
|
], GatewayModule);
|