@capybara-hq/kernel 0.1.0-rc.125 → 0.1.0-rc.127
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 +3 -3
- package/dist/catalog/catalog.module.js +0 -3
- package/dist/catalog/org-catalog.service.d.ts +0 -2
- package/dist/catalog/org-catalog.service.js +0 -4
- package/dist/catalog/org-extension.controller.d.ts +5 -9
- package/dist/catalog/org-extension.controller.js +22 -22
- package/dist/catalog/org-extension.schemas.d.ts +0 -1
- package/dist/catalog/org-extension.schemas.js +0 -2
- package/dist/catalog/plugin-install.d.ts +4 -1
- package/dist/catalog/plugin-install.js +4 -1
- package/dist/conversations/events.d.ts +10 -154
- package/dist/conversations/events.js +8 -83
- package/dist/db/kernel-schema.d.ts +7 -107
- package/dist/devices/conversation-devices.d.ts +1 -2
- package/dist/devices/devices.service.d.ts +8 -1
- package/dist/devices/devices.service.js +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +5 -0
- package/dist/evals/recorded-permission-context.js +1 -3
- package/dist/evals/recorded-tools.d.ts +3 -4
- package/dist/evals/recorded-tools.js +6 -7
- package/dist/extensions/org-config.d.ts +35 -8
- package/dist/extensions/org-config.js +61 -14
- package/dist/extensions/plugin-items.d.ts +16 -0
- package/dist/extensions/plugin-items.js +35 -0
- package/dist/platform/operation.d.ts +0 -2
- package/dist/platform/ops/extensions.ops.d.ts +4 -6
- package/dist/platform/ops/extensions.ops.js +17 -34
- package/dist/runtime/context/build.d.ts +1 -1
- package/dist/runtime/context/build.js +1 -10
- package/dist/runtime/context/device-paths.d.ts +5 -82
- package/dist/runtime/context/device-paths.js +3 -174
- package/dist/runtime/context/permission-profile.d.ts +3 -13
- package/dist/runtime/context/permission-profile.js +9 -26
- package/dist/runtime/permission-context.service.js +3 -4
- package/dist/runtime/run-worker.js +6 -5
- package/package.json +1 -1
- package/src/migrations/0210_normalize_conversation_history.sql +1012 -0
- package/src/migrations/0211_pre_release_cleanup.sql +154 -0
- package/dist/catalog/org-extension-switch.d.ts +0 -41
- package/dist/catalog/org-extension-switch.js +0 -123
|
@@ -3,7 +3,6 @@ import type { ColumnType, Generated, Kysely } from "kysely";
|
|
|
3
3
|
import type { ModelRef } from "../agents/definition.js";
|
|
4
4
|
import type { AutomationChat, AutomationEventMarker, AutomationMode, AutomationOrigin, AutomationPauseReason, AutomationPrincipal, AutomationStatus, AutomationTrigger, AutomationUnattendedAsk, ScheduleMarker, TaskRunSkipReason, TaskRunStatus } from "../automations/types.js";
|
|
5
5
|
import type { AccountAvatar } from "../identity/account-avatar.js";
|
|
6
|
-
import type { DeviceNetwork } from "../sandbox/modes.js";
|
|
7
6
|
import type { StartingExecutionGrants } from "../sandbox/operation-authority-types.js";
|
|
8
7
|
import type { AuthorityEpochVector } from "../sandbox/permission-authority-epochs.js";
|
|
9
8
|
import type { PermissionEscalation, PermissionExpansion, PermissionGrantSource, PermissionScopeKind } from "../sandbox/permission-call-types.js";
|
|
@@ -958,13 +957,13 @@ export interface AttachmentsTable {
|
|
|
958
957
|
pages: number | null;
|
|
959
958
|
created_at: Ts;
|
|
960
959
|
expires_at: TsNullable;
|
|
961
|
-
/**
|
|
962
|
-
purpose:
|
|
960
|
+
/** Attachment purposes are explicit on insert. */
|
|
961
|
+
purpose: AttachmentPurpose;
|
|
963
962
|
/** 0068: the agent whose profile uses this avatar upload (set once, when it is saved). */
|
|
964
963
|
agent_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
965
964
|
}
|
|
966
965
|
/**
|
|
967
|
-
* What an attachment row is for: a
|
|
966
|
+
* What an attachment row is for: a skill package zip, an agent avatar image, or
|
|
968
967
|
* (0163) an image the builtin Read stored with the calling conversation.
|
|
969
968
|
*/
|
|
970
969
|
export type AttachmentPurpose = "skill-package" | "agent-avatar" | "read";
|
|
@@ -1074,11 +1073,6 @@ export interface BackgroundTasksTable {
|
|
|
1074
1073
|
trigger_account_id: string;
|
|
1075
1074
|
description: string;
|
|
1076
1075
|
command: string;
|
|
1077
|
-
/**
|
|
1078
|
-
* A legacy row's session id (0071); NULL on every managed row. Never written after insert: no
|
|
1079
|
-
* launch records a SID any more (permission activation W5-P2), so updates are refused by type.
|
|
1080
|
-
*/
|
|
1081
|
-
sid: ColumnType<string | null, string | null | undefined, never>;
|
|
1082
1076
|
output_path: string;
|
|
1083
1077
|
status: ColumnType<"running" | "completed" | "failed" | "stopped" | "timed_out" | "lost", string | undefined, string>;
|
|
1084
1078
|
lost_reason: ColumnType<string | null, string | null | undefined, string | null>;
|
|
@@ -1088,14 +1082,13 @@ export interface BackgroundTasksTable {
|
|
|
1088
1082
|
deadline_at: Date | string;
|
|
1089
1083
|
/** NULL while the launch is reserved but not started (0071). */
|
|
1090
1084
|
sandbox_created_at: Date | string | null;
|
|
1091
|
-
kill_pending: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1092
1085
|
read_offset: ColumnType<string, number | string | undefined, number | string>;
|
|
1093
1086
|
/** Set while a stop is under way (0072); the poller skips such a task. */
|
|
1094
1087
|
stopping_at: ColumnType<Date | null, Date | string | null | undefined, Date | string | null>;
|
|
1095
1088
|
/** 0088, renamed in 0105: the device the task runs in. */
|
|
1096
1089
|
device_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1097
|
-
/** 0152: the durable launch state of a managed task
|
|
1098
|
-
launch_state:
|
|
1090
|
+
/** 0152: the durable launch state of a managed task. */
|
|
1091
|
+
launch_state: BackgroundLaunchState;
|
|
1099
1092
|
operation_id: NullableText;
|
|
1100
1093
|
input_digest: NullableText;
|
|
1101
1094
|
run_execution_id: NullableText;
|
|
@@ -1120,42 +1113,9 @@ export interface BackgroundTasksTable {
|
|
|
1120
1113
|
cancel_failure: ColumnType<"unreachable" | "failed" | null, "unreachable" | "failed" | null | undefined, "unreachable" | "failed" | null>;
|
|
1121
1114
|
/** 0184: that failure's message, clipped. */
|
|
1122
1115
|
cancel_failure_detail: NullableText;
|
|
1123
|
-
/** 0157: the exact incarnation a legacy dispatch was admitted for; null on historical rows. */
|
|
1124
|
-
legacy_dispatch_provider: NullableText;
|
|
1125
|
-
legacy_dispatch_generation: NullableText;
|
|
1126
|
-
/** 0157: whether a legacy launch may have dispatched its command (see the migration). */
|
|
1127
|
-
legacy_dispatch: ColumnType<"unknown" | "reserved" | "dispatched", "unknown" | "reserved" | "dispatched" | undefined, "unknown" | "reserved" | "dispatched">;
|
|
1128
|
-
}
|
|
1129
|
-
/** 0152: see the migration for the meaning of each state. */
|
|
1130
|
-
export type BackgroundLaunchState = "legacy" | "pending" | "dispatched" | "acknowledged" | "cancel-pending" | "terminal";
|
|
1131
|
-
/** 0023_sandboxes.sql: the legacy per-conversation sandbox; kept only for the cleanup job (0088). */
|
|
1132
|
-
export interface LegacySandboxesTable {
|
|
1133
|
-
conversation_id: string;
|
|
1134
|
-
org_id: string;
|
|
1135
|
-
provider: string;
|
|
1136
|
-
/** 提供方的 `SandboxHandle`;creating 时为 NULL。 */
|
|
1137
|
-
handle: ColumnType<{
|
|
1138
|
-
id: string;
|
|
1139
|
-
[k: string]: unknown;
|
|
1140
|
-
} | null, string | null | undefined, string | null>;
|
|
1141
|
-
status: "creating" | "running" | "suspended" | "destroyed";
|
|
1142
|
-
last_used_at: Ts;
|
|
1143
|
-
running_since: TsNullable;
|
|
1144
|
-
created_at: Ts;
|
|
1145
|
-
suspended_at: TsNullable;
|
|
1146
|
-
destroyed_at: TsNullable;
|
|
1147
|
-
/** 防护号:锁内的每次 status / handle 写入都按它比较并加一。 */
|
|
1148
|
-
generation: ColumnType<number, number | undefined, number>;
|
|
1149
|
-
/** 曾经成功创建过实例(只会置 true)。 */
|
|
1150
|
-
had_instance: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1151
|
-
/** 换提供方时留下的旧实例。 */
|
|
1152
|
-
prev_provider: string | null;
|
|
1153
|
-
prev_handle: ColumnType<{
|
|
1154
|
-
id: string;
|
|
1155
|
-
[k: string]: unknown;
|
|
1156
|
-
} | null, string | null | undefined, string | null>;
|
|
1157
|
-
sweep_failed_at: TsNullable;
|
|
1158
1116
|
}
|
|
1117
|
+
/** 0152: see the migration for the meaning of each managed launch state. */
|
|
1118
|
+
export type BackgroundLaunchState = "pending" | "dispatched" | "acknowledged" | "cancel-pending" | "terminal";
|
|
1159
1119
|
type InstanceHandle = ColumnType<{
|
|
1160
1120
|
id: string;
|
|
1161
1121
|
[k: string]: unknown;
|
|
@@ -1176,14 +1136,6 @@ export interface DevicesTable {
|
|
|
1176
1136
|
demoted_from_provider: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1177
1137
|
/** 0131: a cloud device's narrowing switch (`sandbox`); null follows the platform and the org. */
|
|
1178
1138
|
mode: ColumnType<"sandbox" | null, "sandbox" | null | undefined, "sandbox" | null>;
|
|
1179
|
-
/** 0154: a cloud device's owner Full ceiling (B1 snapshot); null: not snapshotted yet. */
|
|
1180
|
-
owner_full_access: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
|
|
1181
|
-
/** 0154: a cloud device's outer network (B1 snapshot); null: not snapshotted yet. */
|
|
1182
|
-
outer_network: ColumnType<DeviceNetwork | null, string | null | undefined, string | null>;
|
|
1183
|
-
/** 0154: the provenance of the B1 snapshot. */
|
|
1184
|
-
permission_migration: ColumnType<unknown, string | null | undefined, string | null>;
|
|
1185
|
-
/** 0154: the applied limits must be established before any operation is admitted. */
|
|
1186
|
-
permission_reconcile_required: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1187
1139
|
/** 0165: a cloud device's sandbox network choice; null follows the org, `none` is closed. */
|
|
1188
1140
|
network_mode: ColumnType<"open" | "allowlist" | "none" | null, "open" | "allowlist" | "none" | null | undefined, "open" | "allowlist" | "none" | null>;
|
|
1189
1141
|
/** 0165: a cloud device's allowlist hosts (a JSON array), used while the mode is `allowlist`. */
|
|
@@ -1937,50 +1889,6 @@ export interface DeviceGenerationHighWaterTable {
|
|
|
1937
1889
|
high_water_ms: ColumnType<string, string | number, string | number>;
|
|
1938
1890
|
updated_at: Ts;
|
|
1939
1891
|
}
|
|
1940
|
-
export interface LegacyLaunchFreezeTable {
|
|
1941
|
-
id: "platform";
|
|
1942
|
-
frozen_at: Generated<Date>;
|
|
1943
|
-
frozen_by: string;
|
|
1944
|
-
/** Migration 0158: when the freeze's enumeration last completed stable; null before. */
|
|
1945
|
-
enumerated_at: TsNullable;
|
|
1946
|
-
}
|
|
1947
|
-
export interface DeviceRetirementObligationsTable {
|
|
1948
|
-
id: Generated<string>;
|
|
1949
|
-
device_id: string;
|
|
1950
|
-
org_id: string;
|
|
1951
|
-
provider: string;
|
|
1952
|
-
instance_generation: string;
|
|
1953
|
-
state: ColumnType<"open" | "quarantined" | "resolved" | "abandoned", "open" | "quarantined" | "resolved" | "abandoned" | undefined, "open" | "quarantined" | "resolved" | "abandoned">;
|
|
1954
|
-
/** When the obligation was abandoned with its deleted device (never evidence). */
|
|
1955
|
-
abandoned_at: TsNullable;
|
|
1956
|
-
/** `exact-cancelled`: every member was a revoked start cancelled by its exact ref (B-22). */
|
|
1957
|
-
resolution: ColumnType<"provider-destroyed" | "host-rebooted" | "exact-cancelled" | null, "provider-destroyed" | "host-rebooted" | "exact-cancelled" | null | undefined, "provider-destroyed" | "host-rebooted" | "exact-cancelled" | null>;
|
|
1958
|
-
/** A local incarnation: the machine and its boot identity when recorded (null: none). */
|
|
1959
|
-
boot_machine_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1960
|
-
boot_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1961
|
-
reason: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1962
|
-
attempts: ColumnType<number, number | undefined, number>;
|
|
1963
|
-
last_attempt_at: TsNullable;
|
|
1964
|
-
last_error: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1965
|
-
created_at: Generated<Date>;
|
|
1966
|
-
resolved_at: TsNullable;
|
|
1967
|
-
}
|
|
1968
|
-
export interface DeviceRetirementMembersTable {
|
|
1969
|
-
obligation_id: string;
|
|
1970
|
-
kind: "legacy-task" | "revoked-start";
|
|
1971
|
-
ref_id: string;
|
|
1972
|
-
settled: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1973
|
-
created_at: Generated<Date>;
|
|
1974
|
-
}
|
|
1975
|
-
/** 0204: the exact local provider identity of a committed kernel incarnation. */
|
|
1976
|
-
export interface DeviceInstanceRetirementIdentitiesTable {
|
|
1977
|
-
org_id: string;
|
|
1978
|
-
device_id: string;
|
|
1979
|
-
provider: string;
|
|
1980
|
-
instance_generation: string;
|
|
1981
|
-
provider_generation: string;
|
|
1982
|
-
attested_at: TsNullable;
|
|
1983
|
-
}
|
|
1984
1892
|
export interface DeviceInstanceDestructionsTable {
|
|
1985
1893
|
confirmed: Generated<boolean>;
|
|
1986
1894
|
device_id: string;
|
|
@@ -2007,15 +1915,8 @@ export interface KernelDatabase {
|
|
|
2007
1915
|
device_permission_reports: DevicePermissionReportsTable;
|
|
2008
1916
|
/** Migration 0155: per-device generation high-water mark; outlives instance rows. */
|
|
2009
1917
|
device_generation_high_water: DeviceGenerationHighWaterTable;
|
|
2010
|
-
/** Migration 0157: the durable legacy-launch freeze (one row, never removed). */
|
|
2011
|
-
legacy_launch_freeze: LegacyLaunchFreezeTable;
|
|
2012
|
-
/** Migration 0157: the physical no-reuse obligation of one old instance incarnation. */
|
|
2013
|
-
device_retirement_obligations: DeviceRetirementObligationsTable;
|
|
2014
|
-
/** Migration 0157: what put a retirement obligation there. */
|
|
2015
|
-
device_retirement_members: DeviceRetirementMembersTable;
|
|
2016
1918
|
/** Migration 0157: provider-confirmed destruction of a cloud instance incarnation. */
|
|
2017
1919
|
device_instance_destructions: DeviceInstanceDestructionsTable;
|
|
2018
|
-
device_instance_retirement_identities: DeviceInstanceRetirementIdentitiesTable;
|
|
2019
1920
|
sandbox_operation_intents: SandboxOperationIntentsTable;
|
|
2020
1921
|
sandbox_operation_payload_chunks: SandboxOperationPayloadChunksTable;
|
|
2021
1922
|
permission_config_publication: PermissionConfigPublicationTable;
|
|
@@ -2072,7 +1973,6 @@ export interface KernelDatabase {
|
|
|
2072
1973
|
org_anonymous_accounts: OrgAnonymousAccountsTable;
|
|
2073
1974
|
directory_exclusions: DirectoryExclusionsTable;
|
|
2074
1975
|
attachments: AttachmentsTable;
|
|
2075
|
-
sandboxes: LegacySandboxesTable;
|
|
2076
1976
|
devices: DevicesTable;
|
|
2077
1977
|
device_instances: DeviceInstancesTable;
|
|
2078
1978
|
device_defaults: DeviceDefaultsTable;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ApiError } from "../errors.js";
|
|
2
2
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
3
3
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
|
-
import type { DeviceModeLevel } from "../runtime/context/device-paths.js";
|
|
5
4
|
import type { SandboxMode } from "../sandbox/modes.js";
|
|
6
5
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
7
6
|
import { PermissionFacts, type WorkingFacts } from "../sandbox/permission-facts.js";
|
|
8
7
|
import { DeviceAccess } from "./access.js";
|
|
9
8
|
import { DeviceProviderSelection } from "./device-provider-selection.js";
|
|
10
|
-
import { DevicesService } from "./devices.service.js";
|
|
9
|
+
import { type DeviceModeLevel, DevicesService } from "./devices.service.js";
|
|
11
10
|
import { type WorkingProject } from "./working-root.js";
|
|
12
11
|
export type { WorkingFacts } from "../sandbox/permission-facts.js";
|
|
13
12
|
/** `details[0].reason` of the error an anonymous IM conversation's sandbox call gets. */
|
|
@@ -13,10 +13,10 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
13
13
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
14
14
|
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
15
15
|
import type { OrgRole } from "../orgs/roles.js";
|
|
16
|
-
import type { DeviceModeLevel } from "../runtime/context/device-paths.js";
|
|
17
16
|
import { DeviceReports } from "../sandbox/device-reports.js";
|
|
18
17
|
import type { DeviceSandbox, DeviceSandboxLayer, HostGrantCeiling } from "../sandbox/device-sandbox.js";
|
|
19
18
|
import { SandboxJobs } from "../sandbox/jobs.js";
|
|
19
|
+
import { type DeviceNetwork, type SandboxMode } from "../sandbox/modes.js";
|
|
20
20
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
21
21
|
import { PermissionFacts } from "../sandbox/permission-facts.js";
|
|
22
22
|
import { DeviceProviders } from "../sandbox/providers.js";
|
|
@@ -24,6 +24,13 @@ import { SandboxService } from "../sandbox/sandbox.service.js";
|
|
|
24
24
|
import { DeviceAccess } from "./access.js";
|
|
25
25
|
import { DeviceProviderSelection } from "./device-provider-selection.js";
|
|
26
26
|
/** A device as its owner sees it (`GET /orgs/:orgId/devices`). */
|
|
27
|
+
/** The effective mode and network of a device, with its provider's boundary. */
|
|
28
|
+
export interface DeviceModeLevel {
|
|
29
|
+
mode: SandboxMode;
|
|
30
|
+
allowedMode: SandboxMode;
|
|
31
|
+
network: DeviceNetwork;
|
|
32
|
+
local: boolean;
|
|
33
|
+
}
|
|
27
34
|
export interface DeviceView {
|
|
28
35
|
id: string;
|
|
29
36
|
/** null for the default device (shown as the localized "Personal"). */
|
|
@@ -29,7 +29,7 @@ import { DeviceReports } from "../sandbox/device-reports.js";
|
|
|
29
29
|
import { deviceSideLayer, hostGrantable } from "../sandbox/device-sandbox.js";
|
|
30
30
|
import { oweDeviceDestroy, SandboxJobs } from "../sandbox/jobs.js";
|
|
31
31
|
import { revokeLoopbackGrantsOfDevice } from "../sandbox/loopback-grant-records.js";
|
|
32
|
-
import { coversHost } from "../sandbox/modes.js";
|
|
32
|
+
import { coversHost, } from "../sandbox/modes.js";
|
|
33
33
|
import { assertAuthorityWriteHeld } from "../sandbox/permission-authority-lock.js";
|
|
34
34
|
import { hostsNarrowed, needsOpenNetwork, PermissionCeilingWrites, } from "../sandbox/permission-ceiling-writes.js";
|
|
35
35
|
import { ownNetwork, PermissionFacts } from "../sandbox/permission-facts.js";
|
package/dist/errors.d.ts
CHANGED
|
@@ -141,6 +141,11 @@ export declare const ERROR_CODES: {
|
|
|
141
141
|
readonly "extension.package_too_large": 413;
|
|
142
142
|
readonly "extension.config_declared": 409;
|
|
143
143
|
readonly "extension.required": 409;
|
|
144
|
+
/**
|
|
145
|
+
* Switching on an extension whose plugin is not installed in the org (details
|
|
146
|
+
* `[{ itemId, plugin }]`): the plugin's switch on the Plugins page installs it first.
|
|
147
|
+
*/
|
|
148
|
+
readonly "extension.plugin_not_installed": 409;
|
|
144
149
|
readonly "extension.name_conflict": 409;
|
|
145
150
|
readonly "extension.approval_stale": 409;
|
|
146
151
|
readonly "extension.not_pending": 409;
|
package/dist/errors.js
CHANGED
|
@@ -141,6 +141,11 @@ export const ERROR_CODES = {
|
|
|
141
141
|
"extension.package_too_large": 413,
|
|
142
142
|
"extension.config_declared": 409,
|
|
143
143
|
"extension.required": 409,
|
|
144
|
+
/**
|
|
145
|
+
* Switching on an extension whose plugin is not installed in the org (details
|
|
146
|
+
* `[{ itemId, plugin }]`): the plugin's switch on the Plugins page installs it first.
|
|
147
|
+
*/
|
|
148
|
+
"extension.plugin_not_installed": 409,
|
|
144
149
|
"extension.name_conflict": 409,
|
|
145
150
|
"extension.approval_stale": 409,
|
|
146
151
|
"extension.not_pending": 409,
|
|
@@ -6,9 +6,7 @@ const invalid = (message) => new ApiError("eval.snapshot_invalid", message);
|
|
|
6
6
|
/** Whether the recording holds any v1 permission marker (event, managed path or metadata). */
|
|
7
7
|
export function hasPermissionMarkers(events) {
|
|
8
8
|
return events.some((e) => e.type === "permission_context" ||
|
|
9
|
-
|
|
10
|
-
e.payload.permissionContextVersion !==
|
|
11
|
-
undefined) ||
|
|
9
|
+
e.type === "device_paths" ||
|
|
12
10
|
(e.type === "model_call" &&
|
|
13
11
|
e.payload.request.permissionContext !== undefined));
|
|
14
12
|
}
|
|
@@ -24,13 +24,12 @@ export interface RecordedCall {
|
|
|
24
24
|
/** 原 `tool_call_started` 的定义指纹(没有开始事件的调用为空串)。 */
|
|
25
25
|
specHash: string;
|
|
26
26
|
/**
|
|
27
|
-
* The payload
|
|
27
|
+
* The payload of the latest `device_paths` event
|
|
28
28
|
* the original run had logged by this call's step (environments spec §13.1, ruling R22): set on
|
|
29
29
|
* every recorded call from the step where an event was logged onward. A replay that matches the
|
|
30
30
|
* call writes the event when the eval conversation's latest one differs, so a candidate whose
|
|
31
|
-
* first sandbox call lands in another step still gets the line, once.
|
|
32
|
-
*
|
|
33
|
-
* keep their roots-and-level shape and change semantics.
|
|
31
|
+
* first sandbox call lands in another step still gets the line, once. The managed payload is
|
|
32
|
+
* copied whole (permission context replay spec B4).
|
|
34
33
|
*/
|
|
35
34
|
devicePaths?: DevicePathsPayload;
|
|
36
35
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReviewRecordSchema } from "../conversations/events.js";
|
|
1
|
+
import { ManagedDevicePathsV1Schema, ReviewRecordSchema, } from "../conversations/events.js";
|
|
2
2
|
import { ApiError } from "../errors.js";
|
|
3
|
-
import { devicePathsChangeFromPayload,
|
|
3
|
+
import { devicePathsChangeFromPayload, } from "../runtime/context/device-paths.js";
|
|
4
4
|
import { assistantIdemKey } from "../runtime/model-call.js";
|
|
5
5
|
import { MATCH_IGNORED_FIELDS } from "../tools/builtin-names.js";
|
|
6
6
|
import { RUN_STOPPED_TEXT } from "../tools/pipeline.js";
|
|
@@ -58,11 +58,10 @@ export function recordedCalls(s) {
|
|
|
58
58
|
for (; next < own.length && own[next].seq < end; next++) {
|
|
59
59
|
const e = own[next];
|
|
60
60
|
if (e.type === "device_paths" && e.seq > a) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
: { roots: p.roots, ...devicePathsLevel(p) };
|
|
61
|
+
const parsed = ManagedDevicePathsV1Schema.safeParse(e.payload);
|
|
62
|
+
if (!parsed.success)
|
|
63
|
+
throw new ApiError("eval.snapshot_invalid", `Invalid recorded device_paths at seq ${e.seq}`);
|
|
64
|
+
current = parsed.data;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
if (current !== undefined)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PluginScope } from "../catalog/scope.js";
|
|
2
2
|
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
3
|
+
import { ApiError } from "../errors.js";
|
|
3
4
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
4
5
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
5
6
|
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
@@ -52,8 +53,17 @@ export interface OrgExtensionView {
|
|
|
52
53
|
itemId: string;
|
|
53
54
|
scope: PluginScope;
|
|
54
55
|
} | null;
|
|
55
|
-
/** The org admin can switch it
|
|
56
|
+
/** The org admin can switch it: never for a required one or a builtin plugin's. */
|
|
56
57
|
switchable: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the plugin that brings the extension is installed in the org: `installed` /
|
|
60
|
+
* `not_installed` for an extension with a plugin path (one catalog plugin, not builtin, not
|
|
61
|
+
* required), null without one (required, config-declared, several sources, builtin). The org's
|
|
62
|
+
* Extensions and Models pages list an extension unless it is `not_installed` and off
|
|
63
|
+
* ({@link listedInOrg}); its switch starts or stops the extension only, and switching on needs
|
|
64
|
+
* the plugin installed (`extension.plugin_not_installed`; extension switch spec 2026-12-02).
|
|
65
|
+
*/
|
|
66
|
+
pluginInstall: "installed" | "not_installed" | null;
|
|
57
67
|
/**
|
|
58
68
|
* The two-level deployment config (spec A §5.3, §5.4): `following` the platform, a `copy` of the
|
|
59
69
|
* overridable fields, or `none` (the extension has no overridable field, or is unavailable).
|
|
@@ -65,6 +75,13 @@ export interface OrgExtensionView {
|
|
|
65
75
|
*/
|
|
66
76
|
needsConfig: boolean;
|
|
67
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Whether the org's lists of its extensions (the Extensions page, the Models page's model services,
|
|
80
|
+
* `extensions.list`) show the extension: everything except one whose plugin is not installed in
|
|
81
|
+
* the org and that is off (the Plugins page installs it; one left on shows, so it can be stopped).
|
|
82
|
+
* The web applies the same rule (`apps/web/src/lib/extensions.ts`).
|
|
83
|
+
*/
|
|
84
|
+
export declare function listedInOrg(view: Pick<OrgExtensionView, "pluginInstall" | "enabled">): boolean;
|
|
68
85
|
/** The extension points an extension provides, from its permission list's `provides` group. */
|
|
69
86
|
export declare function providesOf(view: Pick<OrgExtensionView, "permissions">): string[];
|
|
70
87
|
/** The input of `put`: enablement only. */
|
|
@@ -161,18 +178,19 @@ export declare class OrgExtensionConfigs {
|
|
|
161
178
|
*/
|
|
162
179
|
private listSnapshot;
|
|
163
180
|
/**
|
|
164
|
-
* How an `enabled` write of this extension is handled
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
181
|
+
* How an `enabled` write of this extension in the org is handled, read before the write (the
|
|
182
|
+
* Platform tool's precheck; {@link put} repeats every rule under the org row lock): `direct`, a
|
|
183
|
+
* write of the extension's own switch (a required bootstrap plugin keeps `extension.required`;
|
|
184
|
+
* the plugin stays installed either way, extension switch spec 2026-12-02 §3.1), `locked` (a live
|
|
185
|
+
* item is builtin and the write switches off: `plugin.scope_locked`), or `not_installed` (switching
|
|
186
|
+
* on an extension whose plugin is not installed in the org: `extension.plugin_not_installed`).
|
|
169
187
|
*/
|
|
170
|
-
switchPlan(plugin: string, enabled: boolean): Promise<{
|
|
188
|
+
switchPlan(orgId: string, plugin: string, enabled: boolean): Promise<{
|
|
171
189
|
kind: "direct";
|
|
172
190
|
} | {
|
|
173
191
|
kind: "locked";
|
|
174
192
|
} | {
|
|
175
|
-
kind: "
|
|
193
|
+
kind: "not_installed";
|
|
176
194
|
itemId: string;
|
|
177
195
|
}>;
|
|
178
196
|
/**
|
|
@@ -180,6 +198,10 @@ export declare class OrgExtensionConfigs {
|
|
|
180
198
|
* `org.extensions.manage`).
|
|
181
199
|
* - Extension not loaded -> `extension.not_found`; `enabled: false` for a required bootstrap
|
|
182
200
|
* plugin -> `extension.required` (it stays enabled in every org).
|
|
201
|
+
* - Switches the extension only, never its plugin (extension switch spec 2026-12-02 §3.1): with a
|
|
202
|
+
* plugin path ({@link pluginPathItem}) switching on needs the plugin installed in the org
|
|
203
|
+
* (`extension.plugin_not_installed`; the install itself passes `viaItem`), and switching off an
|
|
204
|
+
* extension that is off already while its plugin is not installed writes nothing.
|
|
183
205
|
* - Enabling never checks a config: an extension whose effective config is not valid for the org
|
|
184
206
|
* is enabled and reported `needsConfig` (spec A §6: it gets no org-bound call until then).
|
|
185
207
|
*/
|
|
@@ -234,3 +256,8 @@ export declare class OrgExtensionConfigs {
|
|
|
234
256
|
* `db` may be a transaction.
|
|
235
257
|
*/
|
|
236
258
|
export declare function extensionVisibleTo(db: KernelSchemaDb, orgId: string, plugin: string): Promise<boolean>;
|
|
259
|
+
/**
|
|
260
|
+
* `extension.plugin_not_installed`: switching on an extension whose plugin is not installed in the
|
|
261
|
+
* org. Names the plugin (details `[{ itemId, plugin }]`). `db` may be a transaction.
|
|
262
|
+
*/
|
|
263
|
+
export declare function pluginNotInstalledError(db: KernelSchemaDb, extension: string, itemId: string): Promise<ApiError>;
|
|
@@ -27,8 +27,17 @@ import { ExtensionHost } from "./host.js";
|
|
|
27
27
|
import { ExtensionInstalls } from "./installs.js";
|
|
28
28
|
import { fieldLevels } from "./org-levels.js";
|
|
29
29
|
import { permissionGroups, } from "./permission-view.js";
|
|
30
|
-
import { itemLocked, itemsVisible, offeredToOrg, pluginItemsOf, scopeListedFor, } from "./plugin-items.js";
|
|
30
|
+
import { itemLocked, itemsVisible, liveInstalledItems, offeredToOrg, pluginInstallOf, pluginItemsOf, pluginPathItem, scopeListedFor, } from "./plugin-items.js";
|
|
31
31
|
import { ExtensionAvailability } from "./unavailable.js";
|
|
32
|
+
/**
|
|
33
|
+
* Whether the org's lists of its extensions (the Extensions page, the Models page's model services,
|
|
34
|
+
* `extensions.list`) show the extension: everything except one whose plugin is not installed in
|
|
35
|
+
* the org and that is off (the Plugins page installs it; one left on shows, so it can be stopped).
|
|
36
|
+
* The web applies the same rule (`apps/web/src/lib/extensions.ts`).
|
|
37
|
+
*/
|
|
38
|
+
export function listedInOrg(view) {
|
|
39
|
+
return view.pluginInstall !== "not_installed" || view.enabled;
|
|
40
|
+
}
|
|
32
41
|
/** The extension points an extension provides, from its permission list's `provides` group. */
|
|
33
42
|
export function providesOf(view) {
|
|
34
43
|
return view.permissions.filter((g) => g.category === "provides").flatMap((g) => g.items);
|
|
@@ -165,6 +174,7 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
165
174
|
// An extension the org is not offered (a `named` plugin without it, or one off here whose
|
|
166
175
|
// item the super admin disabled) is absent: the rule readiness shares
|
|
167
176
|
const listed = await scopeListedFor(t, orgId);
|
|
177
|
+
const live = await liveInstalledItems(t, orgId);
|
|
168
178
|
const seen = (name) => offeredToOrg({
|
|
169
179
|
required: required.has(name),
|
|
170
180
|
enabled: on.has(name) || (rows.find((r) => r.plugin === name)?.enabled ?? false),
|
|
@@ -173,7 +183,7 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
173
183
|
});
|
|
174
184
|
const views = loaded
|
|
175
185
|
.filter((m) => seen(m.name))
|
|
176
|
-
.map((m) => this.view(m, rows.find((r) => r.plugin === m.name), required.has(m.name), items.get(m.name), on.has(m.name)));
|
|
186
|
+
.map((m) => this.view(m, rows.find((r) => r.plugin === m.name), required.has(m.name), items.get(m.name), on.has(m.name), live));
|
|
177
187
|
const names = new Set(loaded.map((m) => m.name));
|
|
178
188
|
const unavailable = installed
|
|
179
189
|
.filter((i) => !names.has(i.name) && seen(i.name))
|
|
@@ -190,35 +200,46 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
190
200
|
reason: "loading",
|
|
191
201
|
required: required.has(i.name),
|
|
192
202
|
...scopeFields(items.get(i.name), required.has(i.name)),
|
|
203
|
+
pluginInstall: pluginInstallOf(items.get(i.name), required.has(i.name), live),
|
|
193
204
|
overrideState: "none",
|
|
194
205
|
needsConfig: false,
|
|
195
206
|
}));
|
|
196
207
|
return [...views, ...unavailable];
|
|
197
208
|
}
|
|
198
209
|
/**
|
|
199
|
-
* How an `enabled` write of this extension is handled
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
210
|
+
* How an `enabled` write of this extension in the org is handled, read before the write (the
|
|
211
|
+
* Platform tool's precheck; {@link put} repeats every rule under the org row lock): `direct`, a
|
|
212
|
+
* write of the extension's own switch (a required bootstrap plugin keeps `extension.required`;
|
|
213
|
+
* the plugin stays installed either way, extension switch spec 2026-12-02 §3.1), `locked` (a live
|
|
214
|
+
* item is builtin and the write switches off: `plugin.scope_locked`), or `not_installed` (switching
|
|
215
|
+
* on an extension whose plugin is not installed in the org: `extension.plugin_not_installed`).
|
|
204
216
|
*/
|
|
205
|
-
async switchPlan(plugin, enabled) {
|
|
217
|
+
async switchPlan(orgId, plugin, enabled) {
|
|
206
218
|
const t = this.db;
|
|
207
|
-
|
|
219
|
+
const required = (await requiredExtensions(t)).has(plugin);
|
|
220
|
+
if (required)
|
|
208
221
|
return { kind: "direct" };
|
|
209
222
|
const items = (await pluginItemsOf(t, [plugin])).get(plugin);
|
|
210
223
|
if (!items)
|
|
211
224
|
return { kind: "direct" };
|
|
212
225
|
if (!enabled && items.some(itemLocked))
|
|
213
226
|
return { kind: "locked" };
|
|
214
|
-
const
|
|
215
|
-
|
|
227
|
+
const itemId = pluginPathItem(items, required);
|
|
228
|
+
if (!enabled || itemId === null)
|
|
229
|
+
return { kind: "direct" };
|
|
230
|
+
return (await liveInstalledItems(t, orgId)).has(itemId)
|
|
231
|
+
? { kind: "direct" }
|
|
232
|
+
: { kind: "not_installed", itemId };
|
|
216
233
|
}
|
|
217
234
|
/**
|
|
218
235
|
* Writes enablement. The actor's role is re-read under the org row lock (needs
|
|
219
236
|
* `org.extensions.manage`).
|
|
220
237
|
* - Extension not loaded -> `extension.not_found`; `enabled: false` for a required bootstrap
|
|
221
238
|
* plugin -> `extension.required` (it stays enabled in every org).
|
|
239
|
+
* - Switches the extension only, never its plugin (extension switch spec 2026-12-02 §3.1): with a
|
|
240
|
+
* plugin path ({@link pluginPathItem}) switching on needs the plugin installed in the org
|
|
241
|
+
* (`extension.plugin_not_installed`; the install itself passes `viaItem`), and switching off an
|
|
242
|
+
* extension that is off already while its plugin is not installed writes nothing.
|
|
222
243
|
* - Enabling never checks a config: an extension whose effective config is not valid for the org
|
|
223
244
|
* is enabled and reported `needsConfig` (spec A §6: it gets no org-bound call until then).
|
|
224
245
|
*/
|
|
@@ -246,9 +267,19 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
246
267
|
throw requiredError(plugin);
|
|
247
268
|
if (on && input.enabled === false)
|
|
248
269
|
throw scopeLockedError();
|
|
270
|
+
// The org's live installs matter only to an extension with a plugin path
|
|
271
|
+
const pathItem = pluginPathItem(item, required);
|
|
272
|
+
const live = pathItem === null ? new Set() : await liveInstalledItems(t, orgId);
|
|
249
273
|
if (opts.ifDisabled && (row?.enabled === true || on)) {
|
|
250
274
|
opts.ifDisabled.skipped = true;
|
|
251
|
-
return this.view(manifest, row, required, item, on);
|
|
275
|
+
return this.view(manifest, row, required, item, on, live);
|
|
276
|
+
}
|
|
277
|
+
// Not the install itself (`viaItem`): a plugin path needs the plugin installed here
|
|
278
|
+
if (opts.viaItem === undefined && !on && pathItem !== null && !live.has(pathItem)) {
|
|
279
|
+
if (input.enabled === true)
|
|
280
|
+
throw await pluginNotInstalledError(t, plugin, pathItem);
|
|
281
|
+
if (row?.enabled !== true)
|
|
282
|
+
return this.view(manifest, row, required, item, on, live);
|
|
252
283
|
}
|
|
253
284
|
// An always-on extension is enabled whatever the row said (it may predate `required` / builtin)
|
|
254
285
|
const enabled = on || (input.enabled ?? row?.enabled ?? false);
|
|
@@ -282,7 +313,7 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
282
313
|
...opts.auditDetail,
|
|
283
314
|
},
|
|
284
315
|
});
|
|
285
|
-
const view = this.view(manifest, { enabled }, required, item, on);
|
|
316
|
+
const view = this.view(manifest, { enabled }, required, item, on, live);
|
|
286
317
|
// Only once the root transaction committed (an outer caller's too): a rolled-back write
|
|
287
318
|
// disconnects nothing
|
|
288
319
|
afterCommit(async () => {
|
|
@@ -463,7 +494,9 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
463
494
|
}
|
|
464
495
|
view(m, row, required, items,
|
|
465
496
|
/** Always on in every org (enabled.ts): required, or its plugin is builtin. */
|
|
466
|
-
alwaysOn
|
|
497
|
+
alwaysOn,
|
|
498
|
+
/** The items with a live install in the org ({@link liveInstalledItems}). */
|
|
499
|
+
liveItems) {
|
|
467
500
|
const configurable = [...fieldLevels(m.config?.deployment).values()].includes("override");
|
|
468
501
|
return {
|
|
469
502
|
plugin: m.name,
|
|
@@ -475,6 +508,7 @@ let OrgExtensionConfigs = class OrgExtensionConfigs {
|
|
|
475
508
|
status: "enabled",
|
|
476
509
|
required,
|
|
477
510
|
...scopeFields(items, required),
|
|
511
|
+
pluginInstall: pluginInstallOf(items, required, liveItems),
|
|
478
512
|
// filled in by `withLayers` (the copy rows and the effective config)
|
|
479
513
|
overrideState: configurable ? "following" : "none",
|
|
480
514
|
needsConfig: false,
|
|
@@ -530,4 +564,17 @@ export async function extensionVisibleTo(db, orgId, plugin) {
|
|
|
530
564
|
return itemsVisible(items, listed);
|
|
531
565
|
}
|
|
532
566
|
const scopeLockedError = () => new ApiError("plugin.scope_locked", "This plugin is built in: it is on for every organization and cannot be switched off here");
|
|
567
|
+
/**
|
|
568
|
+
* `extension.plugin_not_installed`: switching on an extension whose plugin is not installed in the
|
|
569
|
+
* org. Names the plugin (details `[{ itemId, plugin }]`). `db` may be a transaction.
|
|
570
|
+
*/
|
|
571
|
+
export async function pluginNotInstalledError(db, extension, itemId) {
|
|
572
|
+
const item = await db
|
|
573
|
+
.selectFrom("catalog_items")
|
|
574
|
+
.select("name")
|
|
575
|
+
.where("id", "=", itemId)
|
|
576
|
+
.executeTakeFirst();
|
|
577
|
+
const name = item?.name ?? extension;
|
|
578
|
+
return new ApiError("extension.plugin_not_installed", `Extension ${extension} comes with the plugin ${name}, which is not installed in this organization: enable the plugin ${name} on the Plugins page first`, [{ itemId, plugin: name }]);
|
|
579
|
+
}
|
|
533
580
|
const requiredError = (plugin) => new ApiError("extension.required", `Extension ${plugin} is required by this deployment (a bootstrap plugin): it is enabled in every organization and cannot be disabled`);
|
|
@@ -19,6 +19,22 @@ export declare function pluginItemsOf(db: KernelSchemaDb, names: readonly string
|
|
|
19
19
|
* one, layering spec §4): its switch cannot go off.
|
|
20
20
|
*/
|
|
21
21
|
export declare const itemLocked: (i: ExtensionPluginItem) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The catalog item whose org install brings the extension into an org, or null when the
|
|
24
|
+
* extension has no such plugin path: a required bootstrap plugin, a config-declared extension (no
|
|
25
|
+
* live item), one several live items bring, and one whose item is builtin (on in every org without
|
|
26
|
+
* an install). With a plugin path the extension's org switch needs that plugin installed in the
|
|
27
|
+
* org (extension switch spec 2026-12-02 §3.1).
|
|
28
|
+
*/
|
|
29
|
+
export declare function pluginPathItem(items: readonly ExtensionPluginItem[] | undefined, required: boolean): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the extension's plugin is installed in the org, as the org's lists read it:
|
|
32
|
+
* `installed` / `not_installed` for an extension with a plugin path ({@link pluginPathItem}), null
|
|
33
|
+
* without one. `liveItems`: the items with a live install in the org ({@link liveInstalledItems}).
|
|
34
|
+
*/
|
|
35
|
+
export declare function pluginInstallOf(items: readonly ExtensionPluginItem[] | undefined, required: boolean, liveItems: ReadonlySet<string>): "installed" | "not_installed" | null;
|
|
36
|
+
/** The ids of the catalog items with a live install (installing or installed) in the org. */
|
|
37
|
+
export declare function liveInstalledItems(db: KernelSchemaDb, orgId: string): Promise<Set<string>>;
|
|
22
38
|
/**
|
|
23
39
|
* Whether an org may see an extension with these live catalog items (`listed`: the items whose
|
|
24
40
|
* `named` list has the org): one visible item is enough; without an item (config-declared, or its
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LIVE_INSTALL_STATUSES } from "../catalog/install-status.js";
|
|
1
2
|
import { visibleTo } from "../catalog/scope.js";
|
|
2
3
|
/**
|
|
3
4
|
* The live catalog items of each extension in `names`, the one recorded on its install
|
|
@@ -41,6 +42,40 @@ export async function pluginItemsOf(db, names) {
|
|
|
41
42
|
* one, layering spec §4): its switch cannot go off.
|
|
42
43
|
*/
|
|
43
44
|
export const itemLocked = (i) => i.builtin;
|
|
45
|
+
/**
|
|
46
|
+
* The catalog item whose org install brings the extension into an org, or null when the
|
|
47
|
+
* extension has no such plugin path: a required bootstrap plugin, a config-declared extension (no
|
|
48
|
+
* live item), one several live items bring, and one whose item is builtin (on in every org without
|
|
49
|
+
* an install). With a plugin path the extension's org switch needs that plugin installed in the
|
|
50
|
+
* org (extension switch spec 2026-12-02 §3.1).
|
|
51
|
+
*/
|
|
52
|
+
export function pluginPathItem(items, required) {
|
|
53
|
+
if (required || items === undefined || items.length !== 1)
|
|
54
|
+
return null;
|
|
55
|
+
const [only] = items;
|
|
56
|
+
return only === undefined || itemLocked(only) ? null : only.id;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Whether the extension's plugin is installed in the org, as the org's lists read it:
|
|
60
|
+
* `installed` / `not_installed` for an extension with a plugin path ({@link pluginPathItem}), null
|
|
61
|
+
* without one. `liveItems`: the items with a live install in the org ({@link liveInstalledItems}).
|
|
62
|
+
*/
|
|
63
|
+
export function pluginInstallOf(items, required, liveItems) {
|
|
64
|
+
const item = pluginPathItem(items, required);
|
|
65
|
+
if (item === null)
|
|
66
|
+
return null;
|
|
67
|
+
return liveItems.has(item) ? "installed" : "not_installed";
|
|
68
|
+
}
|
|
69
|
+
/** The ids of the catalog items with a live install (installing or installed) in the org. */
|
|
70
|
+
export async function liveInstalledItems(db, orgId) {
|
|
71
|
+
const rows = await db
|
|
72
|
+
.selectFrom("plugin_installs")
|
|
73
|
+
.select("item_id")
|
|
74
|
+
.where("org_id", "=", orgId)
|
|
75
|
+
.where("status", "in", [...LIVE_INSTALL_STATUSES])
|
|
76
|
+
.execute();
|
|
77
|
+
return new Set(rows.map((r) => r.item_id));
|
|
78
|
+
}
|
|
44
79
|
/**
|
|
45
80
|
* Whether an org may see an extension with these live catalog items (`listed`: the items whose
|
|
46
81
|
* `named` list has the org): one visible item is enough; without an item (config-declared, or its
|