@capybara-hq/kernel 0.1.0-rc.65 → 0.1.0-rc.67
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 +0 -8
- package/dist/admin/admin.schemas.d.ts +3 -0
- package/dist/agents/admin-agents.d.ts +2 -2
- package/dist/agents/admin-agents.js +2 -1
- package/dist/agents/agent-lookup.js +2 -1
- package/dist/agents/agent-profile.service.d.ts +5 -2
- package/dist/agents/agent-profile.service.js +13 -2
- package/dist/agents/agents.controller.d.ts +4 -3
- package/dist/agents/agents.controller.js +7 -3
- package/dist/agents/agents.module.js +3 -0
- package/dist/agents/agents.schemas.d.ts +6 -6
- package/dist/agents/agents.service.d.ts +23 -2
- package/dist/agents/agents.service.js +61 -6
- package/dist/agents/avatar-view.d.ts +8 -0
- package/dist/agents/avatar-view.js +12 -0
- package/dist/agents/profile.d.ts +38 -13
- package/dist/agents/profile.js +31 -20
- package/dist/attribution/platform-attribution.d.ts +15 -6
- package/dist/attribution/platform-attribution.js +31 -14
- package/dist/background/poll.job.d.ts +1 -1
- package/dist/background/poll.job.js +8 -6
- package/dist/background/tasks.service.js +1 -1
- package/dist/catalog/catalog-content.d.ts +6 -3
- package/dist/catalog/catalog-content.js +7 -8
- package/dist/catalog/claude/translate.js +1 -1
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/marketplaces.service.js +2 -1
- package/dist/catalog/plugin-package.d.ts +3 -2
- package/dist/channels/file-delivery.d.ts +2 -0
- package/dist/channels/file-delivery.js +1 -1
- package/dist/channels/inbound.d.ts +8 -4
- package/dist/channels/inbound.js +14 -7
- package/dist/channels/outbound.js +11 -5
- package/dist/channels/phrases.d.ts +21 -13
- package/dist/channels/phrases.js +21 -14
- package/dist/client/client-files.js +1 -1
- package/dist/config/product-name.d.ts +8 -0
- package/dist/config/product-name.js +9 -0
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.js +17 -4
- package/dist/conversations/conversations.service.d.ts +4 -3
- package/dist/conversations/conversations.service.js +15 -2
- package/dist/ctx/create-ctx.js +5 -2
- package/dist/ctx/device-provider-check.d.ts +7 -0
- package/dist/ctx/device-provider-check.js +21 -0
- package/dist/db/kernel-schema.d.ts +7 -0
- package/dist/devices/access.d.ts +16 -46
- package/dist/devices/access.js +26 -62
- package/dist/devices/access.module.js +2 -2
- package/dist/devices/conversation-devices.d.ts +38 -18
- package/dist/devices/conversation-devices.js +69 -51
- package/dist/devices/default-provider-setting.d.ts +45 -0
- package/dist/devices/default-provider-setting.js +59 -0
- package/dist/devices/device-projects.service.js +7 -2
- package/dist/devices/device-provider-selection.d.ts +37 -0
- package/dist/devices/device-provider-selection.js +86 -0
- package/dist/devices/device-provider-selection.module.d.ts +3 -0
- package/dist/devices/device-provider-selection.module.js +22 -0
- package/dist/devices/devices.controller.d.ts +8 -5
- package/dist/devices/devices.controller.js +7 -4
- package/dist/devices/devices.module.js +3 -1
- package/dist/devices/devices.schemas.js +2 -2
- package/dist/devices/devices.service.d.ts +72 -83
- package/dist/devices/devices.service.js +139 -248
- package/dist/devices/dto.d.ts +9 -0
- package/dist/devices/dto.js +15 -2
- package/dist/devices/label.d.ts +3 -5
- package/dist/devices/label.js +3 -14
- package/dist/devices/legacy-cleanup.job.d.ts +2 -2
- package/dist/devices/legacy-cleanup.job.js +6 -6
- package/dist/errors.d.ts +15 -1
- package/dist/errors.js +15 -1
- package/dist/extensions/guide-places.d.ts +2 -1
- package/dist/extensions/guide-places.js +8 -2
- package/dist/extensions/locks.d.ts +1 -1
- package/dist/extensions/locks.js +1 -1
- package/dist/extensions/org-config.d.ts +20 -4
- package/dist/extensions/org-config.js +23 -6
- package/dist/extensions/permission-view.d.ts +2 -2
- package/dist/extensions/permission-view.js +2 -2
- package/dist/extensions/plugin-guides.d.ts +1 -1
- package/dist/extensions/plugin-guides.js +11 -3
- package/dist/extensions/point-defaults.d.ts +14 -0
- package/dist/extensions/point-defaults.js +70 -47
- package/dist/extensions/resolve.js +7 -2
- package/dist/git/gateway.d.ts +9 -0
- package/dist/git/gateway.js +36 -17
- package/dist/git/gateway.route.d.ts +1 -1
- package/dist/git/gateway.route.js +1 -3
- package/dist/http/app.d.ts +1 -1
- package/dist/identity/app-auth.d.ts +4 -3
- package/dist/identity/app-auth.js +7 -8
- package/dist/identity/settings.d.ts +8 -0
- package/dist/identity/settings.js +30 -3
- package/dist/identity/sso.d.ts +13 -7
- package/dist/identity/sso.js +21 -7
- package/dist/infra/config/kernel-config.service.js +3 -1
- package/dist/lifecycle/kernel-lifecycle.js +7 -6
- package/dist/local-devices/device-routes.d.ts +1 -1
- package/dist/local-devices/device-routes.js +2 -2
- package/dist/local-devices/local-device-provider.d.ts +14 -11
- package/dist/local-devices/local-device-provider.js +14 -0
- package/dist/local-devices/local-devices.module.d.ts +4 -4
- package/dist/local-devices/local-devices.module.js +5 -3
- package/dist/local-devices/owner-report.js +2 -1
- package/dist/local-devices/targets.d.ts +2 -0
- package/dist/local-devices/targets.js +10 -0
- package/dist/orgs/offboarding.js +9 -0
- package/dist/orgs/settings.service.d.ts +26 -1
- package/dist/orgs/settings.service.js +44 -3
- package/dist/platform/ops/admin.ops.js +8 -3
- package/dist/platform/ops/agents.ops.d.ts +6 -1
- package/dist/platform/ops/agents.ops.js +38 -11
- package/dist/platform/ops/devices.ops.js +25 -20
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/platform/ops/platform-icons.ops.js +4 -4
- package/dist/platform/ops/platform.ops.js +2 -1
- package/dist/platform/ops/themes.ops.js +1 -1
- package/dist/runtime/plugin-context.service.js +1 -12
- package/dist/sandbox/cloud-permission-snapshot.d.ts +2 -2
- package/dist/sandbox/cloud-permission-snapshot.js +3 -3
- package/dist/sandbox/device-reports.d.ts +50 -0
- package/dist/sandbox/device-reports.js +157 -0
- package/dist/sandbox/held-operations.d.ts +8 -8
- package/dist/sandbox/leases.d.ts +1 -1
- package/dist/sandbox/leases.js +1 -1
- package/dist/sandbox/operation-authority.d.ts +5 -2
- package/dist/sandbox/operation-authority.js +12 -11
- package/dist/sandbox/operation-reconcile.job.d.ts +2 -2
- package/dist/sandbox/operation-reconcile.job.js +5 -5
- package/dist/sandbox/permission-availability.d.ts +2 -2
- package/dist/sandbox/permission-call-types.d.ts +5 -0
- package/dist/sandbox/permission-facts.d.ts +2 -2
- package/dist/sandbox/permission-facts.js +5 -5
- package/dist/sandbox/providers.d.ts +23 -24
- package/dist/sandbox/providers.js +38 -46
- package/dist/sandbox/providers.module.js +3 -3
- package/dist/sandbox/review/classifier.d.ts +6 -0
- package/dist/sandbox/review/classifier.js +12 -1
- package/dist/sandbox/review/index.d.ts +1 -1
- package/dist/sandbox/review/index.js +1 -1
- package/dist/sandbox/sandbox.module.d.ts +1 -1
- package/dist/sandbox/sandbox.module.js +7 -2
- package/dist/sandbox/sandbox.service.d.ts +95 -68
- package/dist/sandbox/sandbox.service.js +212 -208
- package/dist/setup/setup-guides.service.d.ts +4 -1
- package/dist/setup/setup-guides.service.js +6 -1
- package/dist/themes/avatar-preset-key.d.ts +6 -0
- package/dist/themes/avatar-preset-key.js +9 -0
- package/dist/themes/platform-icon.service.js +1 -1
- package/dist/themes/theme-delivery.service.d.ts +10 -2
- package/dist/themes/theme-delivery.service.js +26 -11
- package/dist/themes/theme-state.d.ts +43 -2
- package/dist/themes/theme-state.js +61 -4
- package/dist/themes/themes-public.controller.d.ts +3 -3
- package/dist/themes/themes-public.controller.js +3 -3
- package/dist/themes/themes.service.d.ts +28 -1
- package/dist/themes/themes.service.js +36 -2
- package/dist/tools/builtins/image/generate.d.ts +3 -0
- package/dist/tools/builtins/image/generate.js +21 -11
- package/dist/tools/builtins/image/index.d.ts +1 -1
- package/dist/tools/builtins/image/index.js +1 -1
- package/dist/tools/builtins/platform.js +25 -17
- package/dist/tools/builtins/sandbox/common.d.ts +37 -13
- package/dist/tools/builtins/sandbox/common.js +63 -19
- package/dist/tools/builtins/sandbox/read.d.ts +5 -2
- package/dist/tools/builtins/sandbox/read.js +9 -6
- package/dist/tools/builtins/sandbox/task-output.d.ts +2 -2
- package/dist/tools/builtins/sandbox/task-output.js +6 -5
- package/dist/tools/builtins/skill-load.js +13 -4
- package/dist/tools/connectors.service.js +2 -1
- package/dist/tools/oauth/discovery.d.ts +2 -0
- package/dist/tools/oauth/discovery.js +3 -1
- package/dist/until-aborted.d.ts +5 -0
- package/dist/until-aborted.js +16 -0
- package/package.json +4 -4
- package/src/migrations/0176_device_report.sql +6 -0
|
@@ -20,7 +20,7 @@ import { KERNEL_CONFIG_INPUT, KERNEL_LOGGER } from "../tokens.js";
|
|
|
20
20
|
* takes effect" cannot happen.
|
|
21
21
|
*/
|
|
22
22
|
const HOT_APPLIERS = {
|
|
23
|
-
//
|
|
23
|
+
// The platform name is read at every use (productName(): meta, IM phrases, git gateway, …).
|
|
24
24
|
"platform.name": () => { },
|
|
25
25
|
"log.level": (k, v) => k.log.setLevel(String(v)),
|
|
26
26
|
// The runtime reads the concurrency cap through the config service on every quota request.
|
|
@@ -59,6 +59,8 @@ const HOT_APPLIERS = {
|
|
|
59
59
|
"devices.outsideSandbox": () => { },
|
|
60
60
|
"devices.network.default": () => { },
|
|
61
61
|
"devices.network.ceiling": () => { },
|
|
62
|
+
// The default device provider is read live at every default device creation and settings read.
|
|
63
|
+
"devices.defaultProvider": () => { },
|
|
62
64
|
// The devices service reads the personal limit at every create.
|
|
63
65
|
"devices.maxPersonal": () => { },
|
|
64
66
|
// The local device relay reads the reconnect grace at every disconnect and token response.
|
|
@@ -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 {
|
|
10
|
+
import { DEVICE_PROVIDER_EXTENSION_POINT } from "@capybara-hq/plugin-sdk";
|
|
11
11
|
import { Inject, Injectable, Optional, } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
13
|
import { MarketplacesService } from "../catalog/marketplaces.service.js";
|
|
@@ -287,11 +287,12 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
287
287
|
},
|
|
288
288
|
});
|
|
289
289
|
this.checkpoint();
|
|
290
|
-
const
|
|
291
|
-
.list("
|
|
292
|
-
.
|
|
293
|
-
|
|
294
|
-
|
|
290
|
+
const deviceProviders = this.host
|
|
291
|
+
.list("device-provider")
|
|
292
|
+
.filter((x) => x.capability === DEVICE_PROVIDER_EXTENSION_POINT)
|
|
293
|
+
.map((x) => x.plugin);
|
|
294
|
+
if (deviceProviders.length > 0) {
|
|
295
|
+
for (const w of sandboxConfigWarnings(cfg(), deviceProviders)) {
|
|
295
296
|
this.log[w.level](w.message);
|
|
296
297
|
}
|
|
297
298
|
}
|
|
@@ -26,7 +26,7 @@ export declare function isWebSocketUpgrade(req: FastifyRequest): boolean;
|
|
|
26
26
|
* `@fastify/websocket`: a raw Fastify route outside Nest, so neither the API's `AuthGuard` nor its
|
|
27
27
|
* CSRF check applies; the route checks the machine credential itself, before the upgrade (401
|
|
28
28
|
* `device.credential_invalid`), then the protocol header (426 `device.program_outdated`): only
|
|
29
|
-
* {@link DEVICE_PROTOCOL_VERSION} (
|
|
29
|
+
* {@link DEVICE_PROTOCOL_VERSION} (5) is served; an older program (protocol 4 among them) must
|
|
30
30
|
* update. A newer program reads the kernel's protocol in the message and asks for the deployment
|
|
31
31
|
* to be upgraded instead.
|
|
32
32
|
* Must be called before Nest `app.init()`, on the root instance.
|
|
@@ -37,7 +37,7 @@ function bearer(req) {
|
|
|
37
37
|
* `@fastify/websocket`: a raw Fastify route outside Nest, so neither the API's `AuthGuard` nor its
|
|
38
38
|
* CSRF check applies; the route checks the machine credential itself, before the upgrade (401
|
|
39
39
|
* `device.credential_invalid`), then the protocol header (426 `device.program_outdated`): only
|
|
40
|
-
* {@link DEVICE_PROTOCOL_VERSION} (
|
|
40
|
+
* {@link DEVICE_PROTOCOL_VERSION} (5) is served; an older program (protocol 4 among them) must
|
|
41
41
|
* update. A newer program reads the kernel's protocol in the message and asks for the deployment
|
|
42
42
|
* to be upgraded instead.
|
|
43
43
|
* Must be called before Nest `app.init()`, on the root instance.
|
|
@@ -82,7 +82,7 @@ export async function registerDeviceConnectRoute(fastify, opts) {
|
|
|
82
82
|
: "this capybara-device an older protocol";
|
|
83
83
|
// a newer program than this deployment: the deployment is the one to upgrade
|
|
84
84
|
const fix = number !== null && number > DEVICE_PROTOCOL_VERSION
|
|
85
|
-
? "This deployment is older than the program; ask the platform's super admin to upgrade
|
|
85
|
+
? "This deployment is older than the program; ask the platform's super admin to upgrade it, or install the capybara-device release that matches this deployment."
|
|
86
86
|
: "Update capybara-device on the machine (npm install -g @capybara-hq/device@next), then start it again.";
|
|
87
87
|
return reply
|
|
88
88
|
.code(426)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FileSystemHandle, SandboxHandle, SandboxLimits,
|
|
1
|
+
import type { DeviceProvider, DeviceRef, DeviceReport, FileSystemHandle, SandboxHandle, SandboxLimits, SandboxRoots } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { type DeviceOperation, type SandboxPermissionSupport } from "@capybara-hq/plugin-sdk";
|
|
3
3
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
4
4
|
import { PermissionCallGrants } from "../sandbox/permission-call-grants.js";
|
|
@@ -52,15 +52,18 @@ export declare const deviceIdOfName: (name: string) => string | undefined;
|
|
|
52
52
|
* The files on a machine are its owner's: `destroyFileSystem` (a files reset, the deletion sweep)
|
|
53
53
|
* does nothing; the deletion's `stop` comes from `MachinesService.revokeActive` (ruling R24).
|
|
54
54
|
*/
|
|
55
|
-
export declare class LocalDeviceProvider implements
|
|
55
|
+
export declare class LocalDeviceProvider implements DeviceProvider {
|
|
56
56
|
private readonly relay;
|
|
57
57
|
private readonly targets;
|
|
58
58
|
private readonly sandbox;
|
|
59
59
|
private readonly config;
|
|
60
60
|
private readonly callGrants?;
|
|
61
61
|
readonly concurrentExec: true;
|
|
62
|
+
readonly networkAllowlist: true;
|
|
62
63
|
readonly sessionIsolation = false;
|
|
63
|
-
|
|
64
|
+
/** What the kernel tells about a local device: fixed text, the machine's home, nothing to reset. */
|
|
65
|
+
report(device: DeviceRef, _signal: AbortSignal): Promise<DeviceReport>;
|
|
66
|
+
constructor(relay: LocalDeviceRelay, targets: Pick<DeviceTargets, "orgOf" | "machineRoots" | "machineHome">, sandbox: Pick<SandboxService, "devicePolicy" | "deviceLimits" | "hostGrantCeiling">, config: Pick<KernelConfigService, "get">, callGrants?: PermissionCallGrants | undefined);
|
|
64
67
|
/**
|
|
65
68
|
* The `@local` provider as the staged (protocol 4) registration hands it out
|
|
66
69
|
* (`LocalDevicesModule`): the protocol 2 lifecycle methods that send no frame (file system,
|
|
@@ -80,9 +83,9 @@ export declare class LocalDeviceProvider implements SandboxProvider {
|
|
|
80
83
|
* on an incarnation nobody else holds (a resume, a failed limits change, a quarantine), every
|
|
81
84
|
* started-or-unknown intent of that generation; the owed revokes are delivered by operation id.
|
|
82
85
|
*/
|
|
83
|
-
staged(transport: StagedDeviceTransport):
|
|
86
|
+
staged(transport: StagedDeviceTransport): DeviceProvider;
|
|
84
87
|
/** Dormant v3 adapter. It is not installed on the active v2 registered provider. */
|
|
85
|
-
stagedOperations(transport: StagedDeviceTransport): Required<Pick<
|
|
88
|
+
stagedOperations(transport: StagedDeviceTransport): Required<Pick<DeviceProvider, "operation" | "prepare" | "browse" | "permissionSupport" | "revokeOperation" | "background">>;
|
|
86
89
|
createFileSystem(args: {
|
|
87
90
|
name: string;
|
|
88
91
|
limits: SandboxLimits;
|
|
@@ -110,10 +113,10 @@ export declare class LocalDeviceProvider implements SandboxProvider {
|
|
|
110
113
|
/** A v3 machine has no broad kill (permission runtime cutover B-1): nothing is queued. */
|
|
111
114
|
killAll(_h: SandboxHandle, signal: AbortSignal): Promise<void>;
|
|
112
115
|
killTagged(_h: SandboxHandle, _tags: string[], signal: AbortSignal): Promise<void>;
|
|
113
|
-
readonly exec:
|
|
114
|
-
readonly readFile:
|
|
115
|
-
readonly writeFile:
|
|
116
|
-
readonly stat:
|
|
117
|
-
readonly list: NonNullable<
|
|
118
|
-
readonly scan: NonNullable<
|
|
116
|
+
readonly exec: DeviceProvider["exec"];
|
|
117
|
+
readonly readFile: DeviceProvider["readFile"];
|
|
118
|
+
readonly writeFile: DeviceProvider["writeFile"];
|
|
119
|
+
readonly stat: DeviceProvider["stat"];
|
|
120
|
+
readonly list: NonNullable<DeviceProvider["list"]>;
|
|
121
|
+
readonly scan: NonNullable<DeviceProvider["scan"]>;
|
|
119
122
|
}
|
|
@@ -61,7 +61,21 @@ let LocalDeviceProvider = class LocalDeviceProvider {
|
|
|
61
61
|
config;
|
|
62
62
|
callGrants;
|
|
63
63
|
concurrentExec = true;
|
|
64
|
+
networkAllowlist = true;
|
|
64
65
|
sessionIsolation = false;
|
|
66
|
+
/** What the kernel tells about a local device: fixed text, the machine's home, nothing to reset. */
|
|
67
|
+
async report(device, _signal) {
|
|
68
|
+
return {
|
|
69
|
+
revision: "local-1",
|
|
70
|
+
description: {
|
|
71
|
+
en: "Runs on a computer connected with capybara-device; the computer's owner limits it there.",
|
|
72
|
+
zh: "运行在用 capybara-device 连接的电脑上,电脑的主人在本机限制它。",
|
|
73
|
+
},
|
|
74
|
+
home: await this.targets.machineHome(device.deviceId),
|
|
75
|
+
limits: [],
|
|
76
|
+
reset: false,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
65
79
|
constructor(relay, targets, sandbox, config, callGrants) {
|
|
66
80
|
this.relay = relay;
|
|
67
81
|
this.targets = targets;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type OnModuleInit } from "@nestjs/common";
|
|
2
|
-
import { type
|
|
2
|
+
import { type DeviceProviderEntry, DeviceProviders } from "../sandbox/providers.js";
|
|
3
3
|
import { LocalInstanceBindings } from "./instance-bindings.js";
|
|
4
4
|
import { LocalDeviceProvider } from "./local-device-provider.js";
|
|
5
5
|
import { LocalDeviceRelay } from "./relay.js";
|
|
6
6
|
/**
|
|
7
7
|
* Connected machines (environments spec §6, §13): the caller side of the device relay and the
|
|
8
|
-
* kernel-internal `@local` sandbox provider, registered with {@link
|
|
8
|
+
* kernel-internal `@local` sandbox provider, registered with {@link DeviceProviders} on init, and
|
|
9
9
|
* the machines and their credentials ({@link MachinesService}), changes to a device's network
|
|
10
10
|
* policy ({@link DevicePolicyService}) and the run grants sent with each exec ({@link NetworkGrants}).
|
|
11
11
|
* Imported on every role: any replica may run a sandbox operation on a local device
|
|
@@ -16,7 +16,7 @@ export declare class LocalDevicesModule implements OnModuleInit {
|
|
|
16
16
|
private readonly provider;
|
|
17
17
|
private readonly relay;
|
|
18
18
|
private readonly bindings;
|
|
19
|
-
constructor(providers:
|
|
19
|
+
constructor(providers: DeviceProviders, provider: LocalDeviceProvider, relay: LocalDeviceRelay, bindings: LocalInstanceBindings);
|
|
20
20
|
onModuleInit(): void;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -28,4 +28,4 @@ export declare function localProviderEntry(deps: {
|
|
|
28
28
|
provider: LocalDeviceProvider;
|
|
29
29
|
relay: LocalDeviceRelay;
|
|
30
30
|
bindings: LocalInstanceBindings;
|
|
31
|
-
}):
|
|
31
|
+
}): DeviceProviderEntry;
|
|
@@ -9,9 +9,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Inject, Module } from "@nestjs/common";
|
|
11
11
|
import { PermissionCallGrantsModule } from "../sandbox/permission-call-grants.module.js";
|
|
12
|
-
import {
|
|
12
|
+
import { DeviceProviders, LOCAL_PROVIDER } from "../sandbox/providers.js";
|
|
13
13
|
import { SandboxProviderRegistryModule } from "../sandbox/providers.module.js";
|
|
14
14
|
import { SandboxModule } from "../sandbox/sandbox.module.js";
|
|
15
|
+
import { KERNEL_VERSION } from "../version.js";
|
|
15
16
|
import { DevicePolicyService } from "./device-policy.service.js";
|
|
16
17
|
import { LocalInstanceBindings } from "./instance-bindings.js";
|
|
17
18
|
import { LocalDeviceProvider } from "./local-device-provider.js";
|
|
@@ -23,7 +24,7 @@ import { LocalDeviceRelay } from "./relay.js";
|
|
|
23
24
|
import { DeviceTargets } from "./targets.js";
|
|
24
25
|
/**
|
|
25
26
|
* Connected machines (environments spec §6, §13): the caller side of the device relay and the
|
|
26
|
-
* kernel-internal `@local` sandbox provider, registered with {@link
|
|
27
|
+
* kernel-internal `@local` sandbox provider, registered with {@link DeviceProviders} on init, and
|
|
27
28
|
* the machines and their credentials ({@link MachinesService}), changes to a device's network
|
|
28
29
|
* policy ({@link DevicePolicyService}) and the run grants sent with each exec ({@link NetworkGrants}).
|
|
29
30
|
* Imported on every role: any replica may run a sandbox operation on a local device
|
|
@@ -75,7 +76,7 @@ LocalDevicesModule = __decorate([
|
|
|
75
76
|
OwnerReports,
|
|
76
77
|
],
|
|
77
78
|
}),
|
|
78
|
-
__param(0, Inject(
|
|
79
|
+
__param(0, Inject(DeviceProviders)),
|
|
79
80
|
__param(1, Inject(LocalDeviceProvider)),
|
|
80
81
|
__param(2, Inject(LocalDeviceRelay)),
|
|
81
82
|
__param(3, Inject(LocalInstanceBindings))
|
|
@@ -89,6 +90,7 @@ export { LocalDevicesModule };
|
|
|
89
90
|
export function localProviderEntry(deps) {
|
|
90
91
|
return {
|
|
91
92
|
plugin: LOCAL_PROVIDER,
|
|
93
|
+
version: KERNEL_VERSION,
|
|
92
94
|
impl: deps.provider.staged({
|
|
93
95
|
call: deps.relay.callV3.bind(deps.relay),
|
|
94
96
|
permissionSupport: (deviceId) => deps.bindings.permissionSupport(deviceId),
|
|
@@ -131,7 +131,8 @@ export function ownerReportRevokes(next, scope, method, grantedHosts, machineRoo
|
|
|
131
131
|
export function outsideMachineRoots(scope, machineRoots) {
|
|
132
132
|
if (machineRoots === undefined || !("profile" in scope) || scope.filesystem.kind !== "scoped")
|
|
133
133
|
return false;
|
|
134
|
-
|
|
134
|
+
const { projectRoot, writeRoots } = scope.filesystem;
|
|
135
|
+
return [...(projectRoot === null ? [] : [projectRoot]), ...writeRoots].some((r) => !machineRoots.some((m) => within(r, m)));
|
|
135
136
|
}
|
|
136
137
|
/** The machine's reported roots as a list (workspace, tmp, skills ...), or none. */
|
|
137
138
|
export function machineRootList(roots) {
|
|
@@ -52,6 +52,8 @@ export declare class DeviceTargets {
|
|
|
52
52
|
* active machine, or none reported yet).
|
|
53
53
|
*/
|
|
54
54
|
machineRoots(deviceId: string): Promise<SandboxRoots | null>;
|
|
55
|
+
/** The owner's home directory the active machine reported in its hello, or null. */
|
|
56
|
+
machineHome(deviceId: string): Promise<string | null>;
|
|
55
57
|
/**
|
|
56
58
|
* The features the device's active machine announced in its last hello (known ones only);
|
|
57
59
|
* empty without an active machine.
|
|
@@ -113,6 +113,16 @@ let DeviceTargets = class DeviceTargets {
|
|
|
113
113
|
return null;
|
|
114
114
|
return r;
|
|
115
115
|
}
|
|
116
|
+
/** The owner's home directory the active machine reported in its hello, or null. */
|
|
117
|
+
async machineHome(deviceId) {
|
|
118
|
+
const row = await this.db
|
|
119
|
+
.selectFrom("device_machines")
|
|
120
|
+
.select("home")
|
|
121
|
+
.where("device_id", "=", deviceId)
|
|
122
|
+
.where("revoked_at", "is", null)
|
|
123
|
+
.executeTakeFirst();
|
|
124
|
+
return row?.home ?? null;
|
|
125
|
+
}
|
|
116
126
|
/**
|
|
117
127
|
* The features the device's active machine announced in its last hello (known ones only);
|
|
118
128
|
* empty without an active machine.
|
package/dist/orgs/offboarding.js
CHANGED
|
@@ -465,6 +465,15 @@ let Offboarding = class Offboarding {
|
|
|
465
465
|
if (await ctl.abortIfOrphaned(data.conversationId, data.runId, null))
|
|
466
466
|
return;
|
|
467
467
|
await ctl.requestAbort(data.runId, null);
|
|
468
|
+
// the suspend handshake (`WaitsService.suspend`): a run that became `waiting` after the read
|
|
469
|
+
// above may have checked the marker before it was set; check `waiting` again after setting it
|
|
470
|
+
const now = await this.db
|
|
471
|
+
.selectFrom("runs")
|
|
472
|
+
.select("status")
|
|
473
|
+
.where("id", "=", data.runId)
|
|
474
|
+
.executeTakeFirst();
|
|
475
|
+
if (now?.status === "waiting")
|
|
476
|
+
await ctl.abortWaiting(data.conversationId, data.runId, null);
|
|
468
477
|
}
|
|
469
478
|
};
|
|
470
479
|
__decorate([
|
|
@@ -2,6 +2,7 @@ import type { SandboxLimits } from "@capybara-hq/plugin-sdk";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { type PlatformAttribution } from "../attribution/platform-attribution.js";
|
|
4
4
|
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
5
|
+
import type { ExtensionPointDefaults } from "../extensions/point-defaults.js";
|
|
5
6
|
import { type CompactionSettings } from "../identity/settings.js";
|
|
6
7
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
7
8
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
@@ -36,6 +37,10 @@ import { OrgLock } from "./org-lock.js";
|
|
|
36
37
|
* a default or ceiling above the platform's ceiling is refused.
|
|
37
38
|
* Old keys are read and kept in step until the permission configuration publication converts
|
|
38
39
|
* them ({@link orgDeviceSandboxOf}).
|
|
40
|
+
* - `deviceDefaultProvider`: the org's override of the platform's default device provider (the
|
|
41
|
+
* `device-provider@1` extension that makes a member's default device); absent follows the
|
|
42
|
+
* platform, an invalid stored value reads as absent. Only a provider that is on in the org may
|
|
43
|
+
* be set (400 `org.device_provider_not_available`).
|
|
39
44
|
* - `platformTool`: the `Platform` builtin for the whole org (Platform tool spec §3): `on`,
|
|
40
45
|
* `read-only` (writes listed as unavailable) or `off` (default `on`).
|
|
41
46
|
* - `timeZone`: the org's default time zone (IANA; absent = UTC) for senders without one of their
|
|
@@ -167,6 +172,7 @@ export declare const OrgSettingsSchema: z.ZodObject<{
|
|
|
167
172
|
extraHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
168
173
|
excludedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
169
174
|
}, z.core.$strict>>>;
|
|
175
|
+
deviceDefaultProvider: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
170
176
|
wakeOnBackgroundTask: z.ZodCatch<z.ZodOptional<z.ZodBoolean>>;
|
|
171
177
|
timeZone: z.ZodCatch<z.ZodOptional<z.ZodString>>;
|
|
172
178
|
theme: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
@@ -243,6 +249,7 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
|
|
|
243
249
|
on: "on";
|
|
244
250
|
"read-only": "read-only";
|
|
245
251
|
}>>;
|
|
252
|
+
deviceDefaultProvider: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
246
253
|
wakeOnBackgroundTask: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
247
254
|
outsideSandbox: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
248
255
|
allowed: "allowed";
|
|
@@ -440,12 +447,28 @@ export declare class OrgSettingsService {
|
|
|
440
447
|
private readonly config;
|
|
441
448
|
private readonly ceilings;
|
|
442
449
|
private readonly log?;
|
|
450
|
+
/**
|
|
451
|
+
* Finds {@link ExtensionPointDefaults} (`deviceDefaultProvider` is checked against the
|
|
452
|
+
* providers on in the org) at the time of use: the extensions module cannot be imported here
|
|
453
|
+
* without a module cycle.
|
|
454
|
+
*/
|
|
455
|
+
private readonly modules?;
|
|
443
456
|
constructor(db: KernelDb, txHost: TransactionHost, orgLock: OrgLock,
|
|
444
457
|
/**
|
|
445
458
|
* The deployment config: `sandbox.limits` and the platform's device sandbox settings
|
|
446
459
|
* (`devices.outsideSandbox`, `devices.network`; the org may follow them, never exceed them).
|
|
447
460
|
*/
|
|
448
|
-
config: Pick<KernelConfigService, "get" | "fieldSource">, ceilings: PermissionCeilingWrites, log?: KernelLogger | undefined
|
|
461
|
+
config: Pick<KernelConfigService, "get" | "fieldSource">, ceilings: PermissionCeilingWrites, log?: KernelLogger | undefined,
|
|
462
|
+
/**
|
|
463
|
+
* Finds {@link ExtensionPointDefaults} (`deviceDefaultProvider` is checked against the
|
|
464
|
+
* providers on in the org) at the time of use: the extensions module cannot be imported here
|
|
465
|
+
* without a module cycle.
|
|
466
|
+
*/
|
|
467
|
+
modules?: {
|
|
468
|
+
get(token: typeof ExtensionPointDefaults, opts: {
|
|
469
|
+
strict: false;
|
|
470
|
+
}): Pick<ExtensionPointDefaults, "providersFor">;
|
|
471
|
+
} | undefined);
|
|
449
472
|
/** Parses stored settings, warning when an invalid `outsideSandbox` narrows to `off`, an
|
|
450
473
|
* invalid `deviceNetwork` to an empty allowlist, or a security setting reads narrower
|
|
451
474
|
* ({@link logUnreadableSecuritySettings}, warn). */
|
|
@@ -487,6 +510,8 @@ export declare class OrgSettingsService {
|
|
|
487
510
|
opts?: {
|
|
488
511
|
onlyNarrows?: boolean;
|
|
489
512
|
}): Promise<OrgSettingsView>;
|
|
513
|
+
/** Refuses a `deviceDefaultProvider` that is not a `device-provider@1` extension on in the org. */
|
|
514
|
+
private assertDeviceProviderOn;
|
|
490
515
|
private lockFor;
|
|
491
516
|
/**
|
|
492
517
|
* Refuses a patch that widens the org's sandbox (only a person widens it, never the Platform tool
|
|
@@ -8,8 +8,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
10
|
import { Inject, Injectable, Module, Optional } from "@nestjs/common";
|
|
11
|
+
import { ModuleRef } from "@nestjs/core";
|
|
11
12
|
import { z } from "zod";
|
|
12
13
|
import { readPlatformAttribution, } from "../attribution/platform-attribution.js";
|
|
14
|
+
import { DeviceProviderName } from "../devices/default-provider-setting.js";
|
|
13
15
|
import { ApiError } from "../errors.js";
|
|
14
16
|
import { audit } from "../identity/audit.js";
|
|
15
17
|
import { COMPACTION_SETTINGS_PARTIAL, COMPACTION_SETTINGS_PATCH, readPlatformCompactionSettings, readPromptSuggestions, readSandboxLimitOverride, } from "../identity/settings.js";
|
|
@@ -52,6 +54,10 @@ import { OrgLock, OrgLockModule } from "./org-lock.js";
|
|
|
52
54
|
* a default or ceiling above the platform's ceiling is refused.
|
|
53
55
|
* Old keys are read and kept in step until the permission configuration publication converts
|
|
54
56
|
* them ({@link orgDeviceSandboxOf}).
|
|
57
|
+
* - `deviceDefaultProvider`: the org's override of the platform's default device provider (the
|
|
58
|
+
* `device-provider@1` extension that makes a member's default device); absent follows the
|
|
59
|
+
* platform, an invalid stored value reads as absent. Only a provider that is on in the org may
|
|
60
|
+
* be set (400 `org.device_provider_not_available`).
|
|
55
61
|
* - `platformTool`: the `Platform` builtin for the whole org (Platform tool spec §3): `on`,
|
|
56
62
|
* `read-only` (writes listed as unavailable) or `off` (default `on`).
|
|
57
63
|
* - `timeZone`: the org's default time zone (IANA; absent = UTC) for senders without one of their
|
|
@@ -157,6 +163,8 @@ export const OrgSettingsSchema = z.object({
|
|
|
157
163
|
outsideSandbox: OutsideSandboxSetting.optional().catch("off"),
|
|
158
164
|
/** The org's device sandbox network; absent follows the platform. */
|
|
159
165
|
deviceNetwork: DeviceNetworkSettingSchema.optional().catch(invalidDeviceNetwork),
|
|
166
|
+
/** The org's default device provider; absent follows the platform. */
|
|
167
|
+
deviceDefaultProvider: DeviceProviderName.optional().catch(undefined),
|
|
160
168
|
/** Overrides `runtime.wakeOnBackgroundTask`; absent follows the deployment. */
|
|
161
169
|
wakeOnBackgroundTask: z.boolean().optional().catch(undefined),
|
|
162
170
|
/** The org's default time zone (run context spec §3.3); absent = UTC. */
|
|
@@ -199,6 +207,11 @@ export const OrgSettingsPatchSchema = z
|
|
|
199
207
|
locale: z.enum(["zh", "en"]).optional(),
|
|
200
208
|
sandboxToolPolicy: z.enum(["allow", "ask"]).optional(),
|
|
201
209
|
platformTool: z.enum(["on", "read-only", "off"]).optional(),
|
|
210
|
+
/**
|
|
211
|
+
* The org's default device provider; null clears it (follow the platform). A provider that is
|
|
212
|
+
* not on in the org -> 400 `org.device_provider_not_available`.
|
|
213
|
+
*/
|
|
214
|
+
deviceDefaultProvider: DeviceProviderName.nullable().optional(),
|
|
202
215
|
/** null clears (follow the deployment again). */
|
|
203
216
|
wakeOnBackgroundTask: z.boolean().nullable().optional(),
|
|
204
217
|
/**
|
|
@@ -417,18 +430,26 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
417
430
|
config;
|
|
418
431
|
ceilings;
|
|
419
432
|
log;
|
|
433
|
+
modules;
|
|
420
434
|
constructor(db, txHost, orgLock,
|
|
421
435
|
/**
|
|
422
436
|
* The deployment config: `sandbox.limits` and the platform's device sandbox settings
|
|
423
437
|
* (`devices.outsideSandbox`, `devices.network`; the org may follow them, never exceed them).
|
|
424
438
|
*/
|
|
425
|
-
config, ceilings, log
|
|
439
|
+
config, ceilings, log,
|
|
440
|
+
/**
|
|
441
|
+
* Finds {@link ExtensionPointDefaults} (`deviceDefaultProvider` is checked against the
|
|
442
|
+
* providers on in the org) at the time of use: the extensions module cannot be imported here
|
|
443
|
+
* without a module cycle.
|
|
444
|
+
*/
|
|
445
|
+
modules) {
|
|
426
446
|
this.db = db;
|
|
427
447
|
this.txHost = txHost;
|
|
428
448
|
this.orgLock = orgLock;
|
|
429
449
|
this.config = config;
|
|
430
450
|
this.ceilings = ceilings;
|
|
431
451
|
this.log = log;
|
|
452
|
+
this.modules = modules;
|
|
432
453
|
}
|
|
433
454
|
/** Parses stored settings, warning when an invalid `outsideSandbox` narrows to `off`, an
|
|
434
455
|
* invalid `deviceNetwork` to an empty allowlist, or a security setting reads narrower
|
|
@@ -585,11 +606,27 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
585
606
|
*/
|
|
586
607
|
opts) {
|
|
587
608
|
await this.check(patch);
|
|
609
|
+
await this.assertDeviceProviderOn(orgId, patch);
|
|
588
610
|
// the org row, then (for a device sandbox change) the org's permission authority lock:
|
|
589
611
|
// the ordered prelude, so inside a run's fence (the Platform tool's `org-settings.update`) they
|
|
590
612
|
// precede the conversation rows; the patch decides the lock, so nothing can change it
|
|
591
613
|
return withOrderedLocks(() => this.lockFor(orgId, patch, actorAccountId), () => this.updateIn(orgId, patch, actorAccountId, actorTokenId, auditDetail, opts));
|
|
592
614
|
}
|
|
615
|
+
/** Refuses a `deviceDefaultProvider` that is not a `device-provider@1` extension on in the org. */
|
|
616
|
+
async assertDeviceProviderOn(orgId, patch) {
|
|
617
|
+
const name = patch.deviceDefaultProvider;
|
|
618
|
+
if (name === undefined || name === null)
|
|
619
|
+
return;
|
|
620
|
+
// loaded here, not at the top: the extension host imports this file's settings readers
|
|
621
|
+
const { ExtensionPointDefaults } = await import("../extensions/point-defaults.js");
|
|
622
|
+
const points = this.modules?.get(ExtensionPointDefaults, { strict: false });
|
|
623
|
+
const { providers } = (await points?.providersFor(orgId, "device-provider")) ?? {
|
|
624
|
+
providers: [],
|
|
625
|
+
};
|
|
626
|
+
if (providers.some((p) => p.extension === name))
|
|
627
|
+
return;
|
|
628
|
+
throw new ApiError("org.device_provider_not_available", `The device provider ${name} is not on in this organization; switch it on first or choose another`, [{ path: "deviceDefaultProvider", providers: providers.map((p) => p.extension) }]);
|
|
629
|
+
}
|
|
593
630
|
async lockFor(orgId, patch, actorAccountId) {
|
|
594
631
|
await this.orgLock.lockAndAuthorize(orgId, actorAccountId, "org.update");
|
|
595
632
|
if (patch.outsideSandbox !== undefined || patch.deviceNetwork !== undefined)
|
|
@@ -687,6 +724,8 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
687
724
|
delete after.outsideSandbox;
|
|
688
725
|
if (after.deviceNetwork === undefined)
|
|
689
726
|
delete after.deviceNetwork;
|
|
727
|
+
if (after.deviceDefaultProvider === undefined)
|
|
728
|
+
delete after.deviceDefaultProvider;
|
|
690
729
|
if (after.wakeOnBackgroundTask === undefined)
|
|
691
730
|
delete after.wakeOnBackgroundTask;
|
|
692
731
|
if (after.timeZone === undefined)
|
|
@@ -719,7 +758,7 @@ let OrgSettingsService = class OrgSettingsService {
|
|
|
719
758
|
}
|
|
720
759
|
// Merge with the stored value: keep the keys this version does not know (a cleared
|
|
721
760
|
// outsideSandbox / deviceNetwork is not kept; the old keys are rewritten in step)
|
|
722
|
-
const { autoMode: _legacyAutoMode, fullAccess: _legacyFullAccess, cloudNetwork: _legacyNetwork, outsideSandbox: _oldOutside, deviceNetwork: _oldNetwork, wakeOnBackgroundTask: _oldWake, timeZone: _oldZone, theme: _oldTheme, uiArrangement: _oldArrangement, scheduledTasks: _oldScheduled, compaction: _oldCompaction, externalSharing: _oldExternalSharing, promptSuggestions: _oldPromptSuggestions, ...rest } = stored;
|
|
761
|
+
const { autoMode: _legacyAutoMode, fullAccess: _legacyFullAccess, cloudNetwork: _legacyNetwork, outsideSandbox: _oldOutside, deviceNetwork: _oldNetwork, deviceDefaultProvider: _oldDeviceProvider, wakeOnBackgroundTask: _oldWake, timeZone: _oldZone, theme: _oldTheme, uiArrangement: _oldArrangement, scheduledTasks: _oldScheduled, compaction: _oldCompaction, externalSharing: _oldExternalSharing, promptSuggestions: _oldPromptSuggestions, ...rest } = stored;
|
|
723
762
|
const written = { ...rest, ...after };
|
|
724
763
|
keepOrgLegacyKeysInStep(written, stored);
|
|
725
764
|
// An unreadable forbiddenTools reads as [] for display only: a write that does not replace the
|
|
@@ -800,7 +839,9 @@ OrgSettingsService = __decorate([
|
|
|
800
839
|
__param(3, Inject(KernelConfigService)),
|
|
801
840
|
__param(4, Inject(PermissionCeilingWrites)),
|
|
802
841
|
__param(5, Optional()),
|
|
803
|
-
__param(5, Inject(KERNEL_LOGGER))
|
|
842
|
+
__param(5, Inject(KERNEL_LOGGER)),
|
|
843
|
+
__param(6, Optional()),
|
|
844
|
+
__param(6, Inject(ModuleRef))
|
|
804
845
|
], OrgSettingsService);
|
|
805
846
|
export { OrgSettingsService };
|
|
806
847
|
/**
|
|
@@ -45,6 +45,7 @@ const SettingsInput = DEPLOYMENT_SETTINGS_PATCH.pick({
|
|
|
45
45
|
clientExtensions: true,
|
|
46
46
|
devicesOutsideSandbox: true,
|
|
47
47
|
devicesNetwork: true,
|
|
48
|
+
devicesDefaultProvider: true,
|
|
48
49
|
attribution: true,
|
|
49
50
|
externalSharing: true,
|
|
50
51
|
shareMaxExpiryDays: true,
|
|
@@ -208,7 +209,7 @@ let AdminOperations = class AdminOperations {
|
|
|
208
209
|
}),
|
|
209
210
|
defineOperation({
|
|
210
211
|
id: "admin.settings",
|
|
211
|
-
description: "Read the deployment settings (super admin): who may create orgs (orgCreation), the price currency, whether orgs may create their own connectors and skills, whether org admins may browse the marketplaces, the per-org limit overrides keyed by org id (orgs.get reads one org's), the platform's device sandbox settings in effect (devicesOutsideSandbox: permission allowed or off, whether a device may be granted running a call outside its sandbox; devicesNetwork: default and ceiling, open for the public internet with private addresses closed or allowlist, the network a device gets and the widest an org or device may choose), the platform's attribution defaults for agent-created git commits and pull requests (attribution: commit, pr, sessionUrl), file sharing (externalSharing: value allow or deny, whether orgs may turn on public links to conversation files; shareMaxExpiryDays: value, the longest expiry a share may take in days), htmlRenderCdnAllowlist (the https origins a rendered HTML file may load libraries, styles, fonts and images from) and promptSuggestions (on or off, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too); the switches each with sources: env, file or nacos are set in the startup config and read-only, db chosen in the admin console, default.",
|
|
212
|
+
description: "Read the deployment settings (super admin): who may create orgs (orgCreation), the price currency, whether orgs may create their own connectors and skills, whether org admins may browse the marketplaces, the per-org limit overrides keyed by org id (orgs.get reads one org's), the platform's device sandbox settings in effect (devicesOutsideSandbox: permission allowed or off, whether a device may be granted running a call outside its sandbox; devicesNetwork: default and ceiling, open for the public internet with private addresses closed or allowlist, the network a device gets and the widest an org or device may choose), devicesDefaultProvider (provider: the device provider extension that makes a person's default device, null for none), the platform's attribution defaults for agent-created git commits and pull requests (attribution: commit, pr, sessionUrl), file sharing (externalSharing: value allow or deny, whether orgs may turn on public links to conversation files; shareMaxExpiryDays: value, the longest expiry a share may take in days), htmlRenderCdnAllowlist (the https origins a rendered HTML file may load libraries, styles, fonts and images from) and promptSuggestions (on or off, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too); the switches each with sources: env, file or nacos are set in the startup config and read-only, db chosen in the admin console, default.",
|
|
212
213
|
input: z.object({}).strict(),
|
|
213
214
|
example: {},
|
|
214
215
|
authz: { superAdmin: true },
|
|
@@ -218,7 +219,7 @@ let AdminOperations = class AdminOperations {
|
|
|
218
219
|
}),
|
|
219
220
|
defineOperation({
|
|
220
221
|
id: "admin.update-settings",
|
|
221
|
-
description: "Change deployment settings (super admin); give only the keys to change: orgCreation (anyone or super_admin), priceCurrency (ISO 4217 code), customConnectors / customSkills (allow or deny: whether orgs may create their own instead of installing from the catalog), orgMarketplaceBrowse (true or false), uiTheme ({ id }: the platform default theme, a platform theme whose scope is all, or null for the built-in theme; it is what every org falls back to and what the sign-in pages show), uiArrangement ({ <slot>: { hidden, order } } for a list slot, { <slot>: { use } } for a single slot: the platform default arrangement of UI slots, with contribution keys <extension>/<contribution>; hidden ones are not listed but still open by URL; use names the contribution that replaces the built-in, null for the built-in; null for a slot removes its entry), clientExtensions ({ enabled?, disabled? }: the kill switch of plugin client code; enabled false stops every plugin's interface code in every browser, disabled is the whole list of plugins whose interface code alone is stopped while their tools keep working; read the current list from admin.settings first), devicesOutsideSandbox ({ permission }: whether a device may be granted running a call outside its sandbox, allowed or off; null clears it back to the default, allowed; through this tool it may only be turned off, never allowed, and a value set in the startup config is read-only), devicesNetwork ({ default?, ceiling? }: the device sandbox network, open or allowlist; null clears a field back to the default, open; the default may not be above the ceiling; through this tool either may only be narrowed to allowlist, never opened, and a field set in the startup config is read-only), attribution ({ commit?, pr?, sessionUrl? }: the platform's defaults for agent-created git commits and pull requests; null clears a field back to its default, an empty string turns that line off, and fields set in the startup config are read-only), externalSharing (allow or deny: whether orgs may turn on public links to conversation files; null clears it back to the default, deny; externalSharing may only be turned off through this tool, and a value set in the startup config is read-only), shareMaxExpiryDays (1 to 365: the longest expiry a share may take, in days; null clears it back to 30; through this tool it may only be lowered, never raised, and it is read-only when set in the startup config), htmlRenderCdnAllowlist (the whole list of https origins, scheme and host with an optional port and nothing else, that a rendered HTML file may load from; at most 50; through this tool origins may only be removed, never added, so read the current list from admin.settings first and send it without the ones to drop). promptSuggestions (on or off; null clears it, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too) may be set either way. Per-org limits are orgs.set-limits.",
|
|
222
|
+
description: "Change deployment settings (super admin); give only the keys to change: orgCreation (anyone or super_admin), priceCurrency (ISO 4217 code), customConnectors / customSkills (allow or deny: whether orgs may create their own instead of installing from the catalog), orgMarketplaceBrowse (true or false), uiTheme ({ id }: the platform default theme, a platform theme whose scope is all, or null for the built-in theme; it is what every org falls back to and what the sign-in pages show), uiArrangement ({ <slot>: { hidden, order } } for a list slot, { <slot>: { use } } for a single slot: the platform default arrangement of UI slots, with contribution keys <extension>/<contribution>; hidden ones are not listed but still open by URL; use names the contribution that replaces the built-in, null for the built-in; null for a slot removes its entry), clientExtensions ({ enabled?, disabled? }: the kill switch of plugin client code; enabled false stops every plugin's interface code in every browser, disabled is the whole list of plugins whose interface code alone is stopped while their tools keep working; read the current list from admin.settings first), devicesOutsideSandbox ({ permission }: whether a device may be granted running a call outside its sandbox, allowed or off; null clears it back to the default, allowed; through this tool it may only be turned off, never allowed, and a value set in the startup config is read-only), devicesNetwork ({ default?, ceiling? }: the device sandbox network, open or allowlist; null clears a field back to the default, open; the default may not be above the ceiling; through this tool either may only be narrowed to allowlist, never opened, and a field set in the startup config is read-only), devicesDefaultProvider ({ provider }: the device provider extension that makes a person's default device; null clears it back to none; read-only when set in the startup config), attribution ({ commit?, pr?, sessionUrl? }: the platform's defaults for agent-created git commits and pull requests; null clears a field back to its default, an empty string turns that line off, and fields set in the startup config are read-only), externalSharing (allow or deny: whether orgs may turn on public links to conversation files; null clears it back to the default, deny; externalSharing may only be turned off through this tool, and a value set in the startup config is read-only), shareMaxExpiryDays (1 to 365: the longest expiry a share may take, in days; null clears it back to 30; through this tool it may only be lowered, never raised, and it is read-only when set in the startup config), htmlRenderCdnAllowlist (the whole list of https origins, scheme and host with an optional port and nothing else, that a rendered HTML file may load from; at most 50; through this tool origins may only be removed, never added, so read the current list from admin.settings first and send it without the ones to drop). promptSuggestions (on or off; null clears it, absent meaning on: whether the composer suggests the person's next message after a completed run; an org's own promptSuggestions must be on too) may be set either way. Per-org limits are orgs.set-limits.",
|
|
222
223
|
input: SettingsInput.refine((b) => Object.keys(b).length > 0, {
|
|
223
224
|
message: "at least one setting is required",
|
|
224
225
|
}),
|
|
@@ -276,11 +277,13 @@ let AdminOperations = class AdminOperations {
|
|
|
276
277
|
return precheckBy(async () => {
|
|
277
278
|
if (i.devicesOutsideSandbox !== undefined || i.devicesNetwork !== undefined)
|
|
278
279
|
await this.settings.checkDeviceSandbox(i, { onlyNarrows: true });
|
|
280
|
+
if (i.devicesDefaultProvider !== undefined)
|
|
281
|
+
this.settings.checkDefaultProvider(i.devicesDefaultProvider);
|
|
279
282
|
await this.settings.checkSharing(i, { onlyNarrows: true });
|
|
280
283
|
});
|
|
281
284
|
},
|
|
282
285
|
summary: async (i) => {
|
|
283
|
-
const { uiTheme, uiArrangement, clientExtensions, devicesOutsideSandbox, devicesNetwork, attribution, htmlRenderCdnAllowlist, ...rest } = i;
|
|
286
|
+
const { uiTheme, uiArrangement, clientExtensions, devicesOutsideSandbox, devicesNetwork, devicesDefaultProvider, attribution, htmlRenderCdnAllowlist, ...rest } = i;
|
|
284
287
|
const parts = Object.entries(rest).map(([k, v]) => `${k}=${String(v)}`);
|
|
285
288
|
if (htmlRenderCdnAllowlist !== undefined) {
|
|
286
289
|
parts.push(`htmlRenderCdnAllowlist=[${htmlRenderCdnAllowlist.join(", ")}]`);
|
|
@@ -293,6 +296,8 @@ let AdminOperations = class AdminOperations {
|
|
|
293
296
|
if (devicesNetwork[field] !== undefined)
|
|
294
297
|
parts.push(`devicesNetwork.${field}=${String(devicesNetwork[field])}`);
|
|
295
298
|
}
|
|
299
|
+
if (devicesDefaultProvider !== undefined)
|
|
300
|
+
parts.push(`devicesDefaultProvider=${String(devicesDefaultProvider.provider)}`);
|
|
296
301
|
const zh = [...parts];
|
|
297
302
|
const en = [...parts];
|
|
298
303
|
if (attribution !== undefined) {
|
|
@@ -8,6 +8,7 @@ import { ReadinessService } from "../../agents/readiness.service.js";
|
|
|
8
8
|
import { CatalogRequestsService } from "../../catalog/requests.service.js";
|
|
9
9
|
import { AttachmentsService } from "../../conversations/attachments.service.js";
|
|
10
10
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
11
|
+
import { ThemesService } from "../../themes/themes.service.js";
|
|
11
12
|
import { ConnectorsService } from "../../tools/connectors.service.js";
|
|
12
13
|
import { PlatformOperations } from "../registry.js";
|
|
13
14
|
/** Agent operations of the `Platform` tool (spec §7); visibility is the person's own agents. */
|
|
@@ -23,7 +24,11 @@ export declare class AgentsOperations implements OnModuleInit {
|
|
|
23
24
|
private readonly readiness;
|
|
24
25
|
private readonly kdb;
|
|
25
26
|
private readonly attachments;
|
|
26
|
-
|
|
27
|
+
/** The org's theme avatar presets: the card names a theme preset by its name. */
|
|
28
|
+
private readonly themes;
|
|
29
|
+
constructor(registry: PlatformOperations, agents: AgentsService, profiles: AgentProfileService, fromTemplate: AgentsFromTemplate, orgTemplates: OrgAgentTemplates, pending: PendingConnectorsService, requests: CatalogRequestsService, connectors: ConnectorsService, readiness: ReadinessService, kdb: KernelDb, attachments: AttachmentsService,
|
|
30
|
+
/** The org's theme avatar presets: the card names a theme preset by its name. */
|
|
31
|
+
themes: Pick<ThemesService, "avatarPresets">);
|
|
27
32
|
/**
|
|
28
33
|
* The edit rule the service enforces, read before the card: the agent is visible, and the actor
|
|
29
34
|
* owns it or is an org admin. Returns the agent too for the checks that follow.
|