@capybara-hq/kernel 0.1.0-rc.135 → 0.1.0-rc.137
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin.module.js +3 -0
- package/dist/admin/audit-log.service.d.ts +96 -12
- package/dist/admin/audit-log.service.js +508 -44
- package/dist/admin/audit-targets.d.ts +17 -0
- package/dist/admin/audit-targets.js +84 -0
- package/dist/admin/audit.controller.d.ts +12 -9
- package/dist/admin/audit.controller.js +29 -8
- package/dist/admin/audit.schemas.d.ts +20 -4
- package/dist/admin/audit.schemas.js +42 -17
- package/dist/admin/health.service.d.ts +2 -2
- package/dist/admin/health.service.js +6 -2
- package/dist/agents/templates.js +3 -10
- package/dist/app.d.ts +3 -1
- package/dist/app.js +1 -0
- package/dist/automations/automations.service.js +4 -5
- package/dist/catalog/catalog-content.d.ts +1 -1
- package/dist/catalog/catalog-content.js +17 -22
- package/dist/catalog/catalog-items.d.ts +5 -10
- package/dist/catalog/catalog-items.js +27 -51
- package/dist/catalog/catalog-scope.service.d.ts +4 -2
- package/dist/catalog/catalog-scope.service.js +105 -141
- package/dist/catalog/catalog.module.js +2 -0
- package/dist/catalog/catalog.service.d.ts +3 -3
- package/dist/catalog/catalog.service.js +33 -8
- package/dist/catalog/cli.js +17 -0
- package/dist/catalog/component-promotion.js +8 -4
- package/dist/catalog/component-scope.service.d.ts +3 -1
- package/dist/catalog/component-scope.service.js +101 -140
- package/dist/catalog/component-state.d.ts +10 -8
- package/dist/catalog/component-state.js +42 -30
- package/dist/catalog/dependency-edges.d.ts +25 -0
- package/dist/catalog/dependency-edges.js +125 -0
- package/dist/catalog/install-status.d.ts +2 -3
- package/dist/catalog/install-status.js +2 -3
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.d.ts +3 -1
- package/dist/catalog/org-catalog.service.js +33 -94
- package/dist/catalog/org-intent.d.ts +43 -0
- package/dist/catalog/org-intent.js +184 -0
- package/dist/catalog/owned-items.d.ts +1 -1
- package/dist/catalog/owned-items.js +9 -29
- package/dist/catalog/ownership.d.ts +2 -3
- package/dist/catalog/ownership.js +10 -28
- package/dist/catalog/platform-components.d.ts +3 -1
- package/dist/catalog/platform-components.js +9 -1
- package/dist/catalog/plugin-import.js +12 -16
- package/dist/catalog/plugin-install.d.ts +3 -4
- package/dist/catalog/plugin-install.js +25 -49
- package/dist/catalog/plugin-upgrade.d.ts +2 -2
- package/dist/catalog/plugin-upgrade.js +18 -34
- package/dist/catalog/request-rules.js +20 -8
- package/dist/catalog/scope-orgs.js +2 -7
- package/dist/catalog/scope-state.d.ts +6 -6
- package/dist/catalog/scope-state.js +24 -43
- package/dist/catalog/scope-sync.d.ts +0 -2
- package/dist/catalog/scope-sync.js +11 -39
- package/dist/catalog/scope-writer.d.ts +78 -0
- package/dist/catalog/scope-writer.js +181 -0
- package/dist/catalog/unshare.js +8 -41
- package/dist/channels/connections.service.js +6 -6
- package/dist/channels/supervisor.js +3 -7
- package/dist/client/client-access.service.js +2 -12
- package/dist/config/schema.d.ts +6 -0
- package/dist/config/schema.js +29 -1
- package/dist/conversations/access.d.ts +15 -7
- package/dist/conversations/access.js +59 -10
- package/dist/conversations/conversation-agent.d.ts +18 -0
- package/dist/conversations/conversation-agent.js +23 -0
- package/dist/conversations/conversation-ref.d.ts +3 -2
- package/dist/conversations/conversation-ref.js +6 -1
- package/dist/conversations/conversations.controller.d.ts +28 -5
- package/dist/conversations/conversations.controller.js +99 -10
- package/dist/conversations/conversations.module.js +10 -0
- package/dist/conversations/conversations.schemas.d.ts +6 -0
- package/dist/conversations/conversations.schemas.js +15 -0
- package/dist/conversations/conversations.service.d.ts +125 -21
- package/dist/conversations/conversations.service.js +260 -90
- package/dist/conversations/event-log.d.ts +9 -1
- package/dist/conversations/event-log.js +2 -0
- package/dist/conversations/events.d.ts +57 -0
- package/dist/conversations/events.js +73 -1
- package/dist/conversations/external/external-calls.d.ts +75 -0
- package/dist/conversations/external/external-calls.js +91 -0
- package/dist/conversations/external/external-calls.processor.d.ts +45 -0
- package/dist/conversations/external/external-calls.processor.js +144 -0
- package/dist/conversations/external/external-conversations.service.d.ts +266 -0
- package/dist/conversations/external/external-conversations.service.js +1138 -0
- package/dist/conversations/external/external.schemas.d.ts +63 -0
- package/dist/conversations/external/external.schemas.js +52 -0
- package/dist/conversations/external/token.d.ts +6 -0
- package/dist/conversations/external/token.js +6 -0
- package/dist/conversations/permission-profile-store.d.ts +4 -1
- package/dist/conversations/permission-profiles.controller.d.ts +33 -9
- package/dist/conversations/permission-profiles.controller.js +86 -6
- package/dist/conversations/prompt-suggestions.js +2 -1
- package/dist/conversations/queue.js +2 -1
- package/dist/conversations/titles.js +4 -3
- package/dist/ctx/create-ctx.d.ts +9 -2
- package/dist/ctx/create-ctx.js +47 -62
- package/dist/ctx/guard-db.d.ts +6 -0
- package/dist/ctx/guard-db.js +55 -0
- package/dist/db/extension-handoff-schema.d.ts +1 -1
- package/dist/db/extension-handoff-schema.js +48 -10
- package/dist/db/extension-schema-transfer.js +5 -2
- package/dist/db/kernel-schema.d.ts +42 -5
- package/dist/device-access/host-services.d.ts +2 -2
- package/dist/device-access/host-services.js +8 -8
- package/dist/device-access/person-handles.d.ts +16 -7
- package/dist/device-access/person-handles.js +14 -9
- package/dist/devices/conversation-devices.d.ts +5 -0
- package/dist/devices/conversation-devices.js +16 -0
- package/dist/erasure/org-catalog.js +2 -2
- package/dist/erasure/org-rules.js +5 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.js +34 -0
- package/dist/evals/snapshot.js +3 -1
- package/dist/evals/trajectory.service.d.ts +2 -2
- package/dist/evals/trajectory.service.js +11 -7
- package/dist/extensions/admin-ops.d.ts +9 -5
- package/dist/extensions/admin-ops.js +52 -8
- package/dist/extensions/admin-view.js +1 -4
- package/dist/extensions/bootstrap.js +4 -1
- package/dist/extensions/cli.js +1 -0
- package/dist/extensions/effective-config.js +1 -4
- package/dist/extensions/enabled.d.ts +23 -29
- package/dist/extensions/enabled.js +141 -62
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +71 -45
- package/dist/extensions/host.js +454 -128
- package/dist/extensions/installs.d.ts +9 -0
- package/dist/extensions/installs.js +23 -0
- package/dist/extensions/isolated/admission.d.ts +10 -0
- package/dist/extensions/isolated/admission.js +206 -0
- package/dist/extensions/isolated/authorization.d.ts +37 -0
- package/dist/extensions/isolated/authorization.js +146 -0
- package/dist/extensions/isolated/broker.d.ts +15 -0
- package/dist/extensions/isolated/broker.js +452 -0
- package/dist/extensions/isolated/child-protocol.d.ts +84 -0
- package/dist/extensions/isolated/child-protocol.js +21 -0
- package/dist/extensions/isolated/child-registration.d.ts +22 -0
- package/dist/extensions/isolated/child-registration.js +152 -0
- package/dist/extensions/isolated/child-session.d.ts +6 -0
- package/dist/extensions/isolated/child-session.js +343 -0
- package/dist/extensions/isolated/child-streams.d.ts +4 -0
- package/dist/extensions/isolated/child-streams.js +142 -0
- package/dist/extensions/isolated/child.d.ts +1 -0
- package/dist/extensions/isolated/child.js +10 -0
- package/dist/extensions/isolated/configured-package.d.ts +15 -0
- package/dist/extensions/isolated/configured-package.js +73 -0
- package/dist/extensions/isolated/lanes.d.ts +100 -0
- package/dist/extensions/isolated/lanes.js +699 -0
- package/dist/extensions/isolated/postgres-gate.d.ts +14 -0
- package/dist/extensions/isolated/postgres-gate.js +255 -0
- package/dist/extensions/isolated/revision.d.ts +32 -0
- package/dist/extensions/isolated/revision.js +358 -0
- package/dist/extensions/isolated/rpc-frame.d.ts +50 -0
- package/dist/extensions/isolated/rpc-frame.js +193 -0
- package/dist/extensions/isolated/rpc.d.ts +66 -0
- package/dist/extensions/isolated/rpc.js +314 -0
- package/dist/extensions/isolated/sandbox.d.ts +35 -0
- package/dist/extensions/isolated/sandbox.js +372 -0
- package/dist/extensions/isolated/tier.d.ts +6 -0
- package/dist/extensions/isolated/tier.js +45 -0
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/lifecycle-topics.d.ts +1 -0
- package/dist/extensions/lifecycle-topics.js +1 -0
- package/dist/extensions/lifecycle.d.ts +3 -1
- package/dist/extensions/lifecycle.js +32 -5
- package/dist/extensions/locks.d.ts +2 -0
- package/dist/extensions/locks.js +7 -0
- package/dist/extensions/org-config.d.ts +17 -27
- package/dist/extensions/org-config.js +114 -129
- package/dist/extensions/permission-view.d.ts +3 -1
- package/dist/extensions/permission-view.js +4 -1
- package/dist/extensions/plugin-guides.d.ts +5 -10
- package/dist/extensions/plugin-guides.js +18 -37
- package/dist/extensions/plugin-icons.d.ts +3 -21
- package/dist/extensions/plugin-icons.js +9 -44
- package/dist/extensions/plugin-items.d.ts +10 -30
- package/dist/extensions/plugin-items.js +32 -73
- package/dist/extensions/point-defaults.d.ts +13 -21
- package/dist/extensions/point-defaults.js +32 -72
- package/dist/extensions/point-serving.d.ts +56 -0
- package/dist/extensions/point-serving.js +120 -0
- package/dist/extensions/source-intent.d.ts +14 -0
- package/dist/extensions/source-intent.js +77 -0
- package/dist/inbox/inbox-items.service.d.ts +11 -0
- package/dist/inbox/inbox-items.service.js +39 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/infra/database/database.module.js +6 -1
- package/dist/infra/database/kernel-db.d.ts +3 -1
- package/dist/infra/database/kernel-db.js +4 -0
- package/dist/infra/outbox/registry.d.ts +70 -0
- package/dist/infra/outbox/registry.js +44 -0
- package/dist/infra/paging/paged-read.d.ts +56 -0
- package/dist/infra/paging/paged-read.js +78 -0
- package/dist/infra/queue/queue-names.d.ts +1 -1
- package/dist/infra/queue/queue-names.js +1 -0
- package/dist/kernel.d.ts +3 -2
- package/dist/kernel.js +21 -2
- package/dist/kernel.module.js +4 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
- package/dist/lifecycle/kernel-lifecycle.js +22 -12
- package/dist/lifecycle/tokens.d.ts +8 -0
- package/dist/lifecycle/tokens.js +2 -0
- package/dist/orgs/directory-sync.js +1 -4
- package/dist/platform/exclusions.js +10 -0
- package/dist/platform/ops/admin.ops.js +14 -3
- package/dist/platform/ops/conversations.ops.d.ts +8 -1
- package/dist/platform/ops/conversations.ops.js +52 -14
- package/dist/platform/ops/orgs.ops.js +13 -3
- package/dist/plugin-reads/plugin-reads.service.js +4 -1
- package/dist/push/recipients.js +5 -2
- package/dist/retention/worker.js +2 -1
- package/dist/roles/worker-role.d.ts +3 -1
- package/dist/roles/worker-role.js +8 -2
- package/dist/roles/worker.module.js +3 -0
- package/dist/runtime/context/build.js +8 -0
- package/dist/runtime/context/compaction.js +7 -0
- package/dist/runtime/idle-arm.js +3 -1
- package/dist/runtime/idle-compaction.js +2 -1
- package/dist/runtime/run-finish.js +2 -1
- package/dist/runtime/run-jobs.js +2 -1
- package/dist/runtime/run-queue.js +4 -2
- package/dist/runtime/run-worker.js +5 -2
- package/dist/runtime/stream.js +10 -0
- package/dist/runtime/usage-report.js +2 -1
- package/dist/runtime/waits.js +2 -1
- package/dist/setup/setup-checks.service.js +3 -2
- package/dist/skills/usable.js +41 -30
- package/dist/themes/theme-state.js +3 -3
- package/dist/tools/approvals.service.js +6 -2
- package/dist/tools/builtins/skill-load.js +3 -2
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +1 -1
- package/dist/tools/tool-watch.service.js +3 -1
- package/package.json +3 -3
- package/src/migrations/0227_external_conversations.sql +33 -0
- package/src/migrations/0228_extension_org_switches.sql +56 -0
- package/src/migrations/0229_catalog_dependency_edges.sql +17 -0
- package/src/migrations/0230_audit_filter_idx.sql +18 -0
|
@@ -11,6 +11,7 @@ var TrajectoryService_1;
|
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
13
|
import { isAgentVisibleTo } from "../agents/agent-lookup.js";
|
|
14
|
+
import { agentIdOf, agentKindOf, } from "../conversations/conversation-agent.js";
|
|
14
15
|
import { EventLog } from "../conversations/event-log.js";
|
|
15
16
|
import { peopleOfEvents } from "../conversations/event-people.js";
|
|
16
17
|
import { ApiError } from "../errors.js";
|
|
@@ -147,7 +148,7 @@ let TrajectoryService = TrajectoryService_1 = class TrajectoryService {
|
|
|
147
148
|
const run = byConv.get(r.id);
|
|
148
149
|
return {
|
|
149
150
|
conversationId: r.id,
|
|
150
|
-
agentId: r
|
|
151
|
+
agentId: agentIdOf(r),
|
|
151
152
|
agentName: r.agent_name ?? "",
|
|
152
153
|
accountId: r.account_id,
|
|
153
154
|
title: r.title,
|
|
@@ -184,16 +185,19 @@ let TrajectoryService = TrajectoryService_1 = class TrajectoryService {
|
|
|
184
185
|
const authAgentId = conv?.kind === "subagent"
|
|
185
186
|
? await this.rootAgentId(orgId, conv.parent_conversation_id)
|
|
186
187
|
: conv?.agent_id;
|
|
187
|
-
|
|
188
|
+
// an external conversation has no agent and no runs: it has no trajectory
|
|
189
|
+
if (!conv || conv.kind === "external" || authAgentId === null || authAgentId === undefined) {
|
|
188
190
|
throw notFound();
|
|
191
|
+
}
|
|
192
|
+
const agentId = agentIdOf(conv);
|
|
189
193
|
if (!(await this.canView(orgId, accountId, authAgentId)))
|
|
190
194
|
throw notFound();
|
|
191
195
|
// an org agent child also needs that agent to be visible to a non-admin viewer, as on the
|
|
192
196
|
// conversation read path (batch 9 ruling; final review m3)
|
|
193
|
-
if (conv.kind === "subagent" &&
|
|
197
|
+
if (conv.kind === "subagent" && agentId !== authAgentId) {
|
|
194
198
|
const role = await this.role(orgId, accountId);
|
|
195
199
|
if ((role === null || !roleAtLeast(role, "admin")) &&
|
|
196
|
-
!(await isAgentVisibleTo(this.db.db,
|
|
200
|
+
!(await isAgentVisibleTo(this.db.db, agentId, accountId))) {
|
|
197
201
|
throw notFound();
|
|
198
202
|
}
|
|
199
203
|
}
|
|
@@ -241,15 +245,15 @@ let TrajectoryService = TrajectoryService_1 = class TrajectoryService {
|
|
|
241
245
|
orgId,
|
|
242
246
|
action: "trajectory.viewed",
|
|
243
247
|
target: conversationId,
|
|
244
|
-
detail: { agentId
|
|
248
|
+
detail: { agentId },
|
|
245
249
|
});
|
|
246
250
|
return {
|
|
247
251
|
conversation: {
|
|
248
252
|
id: conv.id,
|
|
249
|
-
agentId
|
|
253
|
+
agentId,
|
|
250
254
|
accountId: conv.account_id,
|
|
251
255
|
title: conv.title,
|
|
252
|
-
kind: conv.kind,
|
|
256
|
+
kind: agentKindOf(conv.kind),
|
|
253
257
|
...(parent !== undefined && { parent }),
|
|
254
258
|
},
|
|
255
259
|
runs: buildTrajectory(events),
|
|
@@ -45,6 +45,13 @@ export interface ExtensionOpsOwner {
|
|
|
45
45
|
export type InstallView = AdminExtensionView & {
|
|
46
46
|
leftDisabled?: SingleProviderNote;
|
|
47
47
|
};
|
|
48
|
+
type InstallOptions = {
|
|
49
|
+
catalogItemId?: string;
|
|
50
|
+
liveItem?: true;
|
|
51
|
+
owner?: ExtensionOpsOwner;
|
|
52
|
+
/** Selects a verified bootstrap installation, including restoration during rollback. */
|
|
53
|
+
bootstrap?: true;
|
|
54
|
+
};
|
|
48
55
|
export declare class ExtensionAdminOps {
|
|
49
56
|
private readonly kdb;
|
|
50
57
|
readonly txHost: TransactionHost;
|
|
@@ -142,11 +149,7 @@ export declare class ExtensionAdminOps {
|
|
|
142
149
|
* the result's `leftDisabled` says why (the shape of `enableUnlessOccupied`'s refusal). Checked
|
|
143
150
|
* under the point's lock after the install lock (the enable's order).
|
|
144
151
|
*/
|
|
145
|
-
install(name: string, sha256: string, actor: string | null, actorTokenId?: string, opts?:
|
|
146
|
-
catalogItemId?: string;
|
|
147
|
-
liveItem?: true;
|
|
148
|
-
owner?: ExtensionOpsOwner;
|
|
149
|
-
}): Promise<InstallView>;
|
|
152
|
+
install(name: string, sha256: string, actor: string | null, actorTokenId?: string, opts?: InstallOptions): Promise<InstallView>;
|
|
150
153
|
private writeInstall;
|
|
151
154
|
/**
|
|
152
155
|
* Enable on the deployment (audit `extension.enabled`); no change when already enabled. Org
|
|
@@ -205,3 +208,4 @@ export declare class ExtensionAdminOps {
|
|
|
205
208
|
/** 提交后通知各副本;发布失败只告警(周期 reconcile 兜底),本副本自己先 reconcile。 */
|
|
206
209
|
private notify;
|
|
207
210
|
}
|
|
211
|
+
export {};
|
|
@@ -37,8 +37,10 @@ import { ExtensionLifecycle, PLUGINS_CHANGED_TOPIC } from "./lifecycle.js";
|
|
|
37
37
|
import { PluginInstallLock } from "./locks.js";
|
|
38
38
|
import { unrunMigrations } from "./migrate-lock.js";
|
|
39
39
|
import { ExtensionPackageError, extensionPackageApiError, readExtensionPackage, } from "./package.js";
|
|
40
|
+
import { extensionSourcesQuery } from "./plugin-items.js";
|
|
40
41
|
import { ExtensionRegistry } from "./registry.js";
|
|
41
42
|
import { isSingleProviderCode, SingleProviderGuard, singleProviderNote, } from "./single-provider.js";
|
|
43
|
+
import { captureSourceIntent, restoreSourceIntent } from "./source-intent.js";
|
|
42
44
|
let ExtensionAdminOps = class ExtensionAdminOps {
|
|
43
45
|
kdb;
|
|
44
46
|
txHost;
|
|
@@ -193,8 +195,35 @@ let ExtensionAdminOps = class ExtensionAdminOps {
|
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
const row = await this.lockRow(name);
|
|
198
|
+
// Blob metadata records the first upload of these bytes. Admission follows this install
|
|
199
|
+
// and, for a catalog install, the exact catalog revision selected by its caller.
|
|
200
|
+
const catalogRevision = opts.catalogItemId === undefined
|
|
201
|
+
? undefined
|
|
202
|
+
: await db
|
|
203
|
+
.selectFrom("catalog_item_versions")
|
|
204
|
+
.select("source")
|
|
205
|
+
.where("item_id", "=", opts.catalogItemId)
|
|
206
|
+
.where("version", "=", pkg.version)
|
|
207
|
+
.where("extension_sha256", "=", sha256)
|
|
208
|
+
.executeTakeFirst();
|
|
209
|
+
const source = opts.bootstrap || catalogRevision?.source === "bootstrap"
|
|
210
|
+
? "bootstrap"
|
|
211
|
+
: catalogRevision
|
|
212
|
+
? "catalog"
|
|
213
|
+
: pkg.source === "npm"
|
|
214
|
+
? "npm"
|
|
215
|
+
: "file";
|
|
196
216
|
// 不经目录重装时保留原来的来源条目(不清空,C22)
|
|
197
217
|
const catalogItemId = opts.catalogItemId ?? row?.catalog_item_id ?? null;
|
|
218
|
+
const sourceIntent = row &&
|
|
219
|
+
opts.catalogItemId !== undefined &&
|
|
220
|
+
!(await db
|
|
221
|
+
.selectFrom(extensionSourcesQuery(db, name).as("source"))
|
|
222
|
+
.select("item_id")
|
|
223
|
+
.where("item_id", "=", opts.catalogItemId)
|
|
224
|
+
.executeTakeFirst())
|
|
225
|
+
? await captureSourceIntent(db, name, "add")
|
|
226
|
+
: undefined;
|
|
198
227
|
if (opts.catalogItemId !== undefined) {
|
|
199
228
|
await db
|
|
200
229
|
.insertInto("extension_catalog_sources")
|
|
@@ -229,17 +258,24 @@ let ExtensionAdminOps = class ExtensionAdminOps {
|
|
|
229
258
|
if (owner.package_name !== pkg.package_name) {
|
|
230
259
|
throw new ApiError("extension.name_conflict", `Extension name ${name} was previously used by package ${owner.package_name}; its data, secrets and permission approval are retained for that package, so package ${pkg.package_name} cannot take over the name`);
|
|
231
260
|
}
|
|
232
|
-
//
|
|
261
|
+
// The same bytes can be selected through a different source.
|
|
233
262
|
if (row?.sha256 === sha256) {
|
|
234
|
-
if (row.catalog_item_id !== catalogItemId) {
|
|
235
|
-
// 包没变、只有来源条目变了:照样留审计(来源变化影响 T26 的目录策略约束)
|
|
263
|
+
if (row.catalog_item_id !== catalogItemId || row.source !== source) {
|
|
236
264
|
await db
|
|
237
265
|
.updateTable("extension_installs")
|
|
238
|
-
.set({ catalog_item_id: catalogItemId })
|
|
266
|
+
.set({ catalog_item_id: catalogItemId, source })
|
|
239
267
|
.where("name", "=", name)
|
|
240
268
|
.execute();
|
|
241
|
-
await this.audit(actor, actorTokenId, "extension.install_source_changed", name, pkg.version, sha256, {
|
|
269
|
+
await this.audit(actor, actorTokenId, "extension.install_source_changed", name, pkg.version, sha256, {
|
|
270
|
+
catalogItemId,
|
|
271
|
+
previousCatalogItemId: row.catalog_item_id,
|
|
272
|
+
source,
|
|
273
|
+
previousSource: row.source,
|
|
274
|
+
});
|
|
275
|
+
afterCommit(() => this.notify(name));
|
|
242
276
|
}
|
|
277
|
+
if (sourceIntent)
|
|
278
|
+
await restoreSourceIntent(db, name, sourceIntent, actor);
|
|
243
279
|
return { changed: false, state: row.desired_state };
|
|
244
280
|
}
|
|
245
281
|
if (row && isDowngrade(pkg.version, row.version)) {
|
|
@@ -274,7 +310,7 @@ let ExtensionAdminOps = class ExtensionAdminOps {
|
|
|
274
310
|
name,
|
|
275
311
|
sha256,
|
|
276
312
|
version: pkg.version,
|
|
277
|
-
source
|
|
313
|
+
source,
|
|
278
314
|
desired_state: "disabled",
|
|
279
315
|
installed_by: actor,
|
|
280
316
|
updated_by: actor,
|
|
@@ -283,12 +319,14 @@ let ExtensionAdminOps = class ExtensionAdminOps {
|
|
|
283
319
|
.onConflict((oc) => oc.column("name").doUpdateSet({
|
|
284
320
|
sha256,
|
|
285
321
|
version: pkg.version,
|
|
286
|
-
source
|
|
322
|
+
source,
|
|
287
323
|
updated_by: actor,
|
|
288
324
|
catalog_item_id: catalogItemId,
|
|
289
325
|
updated_at: sql `now()`,
|
|
290
326
|
}))
|
|
291
327
|
.execute();
|
|
328
|
+
if (sourceIntent)
|
|
329
|
+
await restoreSourceIntent(db, name, sourceIntent, actor);
|
|
292
330
|
if (leftDisabled !== undefined ||
|
|
293
331
|
target.section.manifest.permissions?.deviceAccess?.siteAccess !== true) {
|
|
294
332
|
await revokeSiteGrantsOfExtensionEverywhere(db, name);
|
|
@@ -474,6 +512,7 @@ let ExtensionAdminOps = class ExtensionAdminOps {
|
|
|
474
512
|
.select([
|
|
475
513
|
"extension_installs.sha256",
|
|
476
514
|
"extension_installs.version",
|
|
515
|
+
"extension_installs.source",
|
|
477
516
|
"extension_installs.desired_state",
|
|
478
517
|
"extension_installs.catalog_item_id",
|
|
479
518
|
"extension_installs.required",
|
|
@@ -608,7 +647,12 @@ async function hasRetainedData(db, name) {
|
|
|
608
647
|
.select(sql `1`.as("x"))
|
|
609
648
|
.where("plugin", "=", name))
|
|
610
649
|
.union(db
|
|
611
|
-
.selectFrom("
|
|
650
|
+
.selectFrom("component_org_switches")
|
|
651
|
+
.select(sql `1`.as("x"))
|
|
652
|
+
.where("kind", "=", "extension")
|
|
653
|
+
.where("component_id", "=", name))
|
|
654
|
+
.union(db
|
|
655
|
+
.selectFrom("extension_org_overrides")
|
|
612
656
|
.select(sql `1`.as("x"))
|
|
613
657
|
.where("plugin", "=", name))
|
|
614
658
|
.limit(1)
|
|
@@ -387,11 +387,8 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
387
387
|
blocked.set(s.name, block);
|
|
388
388
|
}
|
|
389
389
|
const counts = new Map((await this.db
|
|
390
|
-
.selectFrom(enabledExtensionsByOrg(this.db).as("en"))
|
|
391
|
-
.innerJoin("orgs", "orgs.id", "en.org_id")
|
|
390
|
+
.selectFrom(enabledExtensionsByOrg(this.db, names).as("en"))
|
|
392
391
|
.select(["en.plugin", (eb) => eb.fn.countAll().as("n")])
|
|
393
|
-
.where("orgs.deleted_at", "is", null)
|
|
394
|
-
.where("en.plugin", "in", names)
|
|
395
392
|
.groupBy("en.plugin")
|
|
396
393
|
.execute()).map((r) => [r.plugin, Number(r.n)]));
|
|
397
394
|
const { clients, reports } = await this.clientsOf(subjects, rows);
|
|
@@ -776,7 +776,10 @@ let BootstrapService = class BootstrapService {
|
|
|
776
776
|
.where("owner_org_id", "is", null)
|
|
777
777
|
.where("deleted_at", "is", null)
|
|
778
778
|
.executeTakeFirst();
|
|
779
|
-
const installed = await this.ops.install(e.name, review.sha256, null, undefined,
|
|
779
|
+
const installed = await this.ops.install(e.name, review.sha256, null, undefined, {
|
|
780
|
+
bootstrap: true,
|
|
781
|
+
...(item && { catalogItemId: item.id }),
|
|
782
|
+
});
|
|
780
783
|
// An upgrade newly providing a held single-provider point is left disabled by the install
|
|
781
784
|
if (installed.leftDisabled !== undefined)
|
|
782
785
|
return this.leftDisabled(e, installed.leftDisabled);
|
package/dist/extensions/cli.js
CHANGED
|
@@ -36,6 +36,7 @@ export function parseDeploymentConfig(schema, stored, fileValue) {
|
|
|
36
36
|
*/
|
|
37
37
|
export async function openExtensionCli(config, log, opts = {}) {
|
|
38
38
|
const inspected = await ExtensionHost.inspect(config.extensions, {
|
|
39
|
+
maxPackageBytes: config.packages.maxBytes,
|
|
39
40
|
...(opts.resolveFrom !== undefined && { resolveFrom: opts.resolveFrom }),
|
|
40
41
|
});
|
|
41
42
|
const app = await openKernelCli(config, {
|
|
@@ -302,12 +302,9 @@ let EffectiveConfigs = class EffectiveConfigs {
|
|
|
302
302
|
if (!this.registry.current(plugin))
|
|
303
303
|
return 0;
|
|
304
304
|
const rows = await this.db
|
|
305
|
-
.selectFrom(enabledExtensionsByOrg(this.db).as("en"))
|
|
306
|
-
.innerJoin("orgs", "orgs.id", "en.org_id")
|
|
305
|
+
.selectFrom(enabledExtensionsByOrg(this.db, [plugin]).as("en"))
|
|
307
306
|
.leftJoin("extension_org_overrides as ov", (j) => j.onRef("ov.org_id", "=", "en.org_id").onRef("ov.plugin", "=", "en.plugin"))
|
|
308
307
|
.select(["en.org_id as orgId", "ov.org_id as copyOrg"])
|
|
309
|
-
.where("orgs.deleted_at", "is", null)
|
|
310
|
-
.where("en.plugin", "=", plugin)
|
|
311
308
|
.execute();
|
|
312
309
|
let n = 0;
|
|
313
310
|
let following;
|
|
@@ -1,46 +1,39 @@
|
|
|
1
|
+
import { type Expression } from "kysely";
|
|
1
2
|
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
2
|
-
|
|
3
|
-
* Which extensions an organization has enabled. Two sources, and every reader goes through these
|
|
4
|
-
* helpers so none of them misses one:
|
|
5
|
-
* - `extension_org_configs.enabled` (the org's own switch);
|
|
6
|
-
* - every always-on extension ({@link alwaysOnExtensionsQuery}): enabled in every org, existing and
|
|
7
|
-
* future, without an org config row, whatever such a row says. That is a required bootstrap
|
|
8
|
-
* plugin (`extension_installs.required`, package ecosystem spec §7) and an extension shipped in a
|
|
9
|
-
* builtin platform plugin (a live `catalog_items` row with `builtin`, recorded on its install or in
|
|
10
|
-
* `extension_catalog_sources`; a `builtin: true` bootstrap entry is builtin without being
|
|
11
|
-
* required). A builtin plugin is on in every org and its org switch is locked (`wantedOn`,
|
|
12
|
-
* `itemLocked`), so its extension must be on too: the scope sync leaves builtin items alone.
|
|
13
|
-
* Neither checks that the extension is loaded on this replica or enabled on the deployment; callers
|
|
14
|
-
* that need that check it themselves, as before. Plain SQL read on every call (no cache), so every
|
|
15
|
-
* replica sees a change at once. `db` may be a transaction.
|
|
16
|
-
*/
|
|
3
|
+
type Key = string | Expression<string>;
|
|
17
4
|
/**
|
|
18
5
|
* The names of the always-on extensions (a subquery with one column, `plugin`): required bootstrap
|
|
19
6
|
* plugins and the extensions of live builtin platform plugins (see the file header).
|
|
20
7
|
*/
|
|
21
|
-
export declare function alwaysOnExtensionsQuery(db: KernelSchemaDb): import("kysely").SelectQueryBuilder<import("../db/kernel-schema.js").KernelDatabase & {
|
|
8
|
+
export declare function alwaysOnExtensionsQuery(db: KernelSchemaDb, plugin?: string | Expression<string>): import("kysely").SelectQueryBuilder<import("../db/kernel-schema.js").KernelDatabase & {
|
|
22
9
|
ri: import("../db/kernel-schema.js").ExtensionInstallsTable;
|
|
23
10
|
}, "ri", {
|
|
24
11
|
plugin: string;
|
|
25
12
|
}>;
|
|
26
|
-
/** The
|
|
27
|
-
export declare function
|
|
28
|
-
|
|
29
|
-
}, "
|
|
13
|
+
/** The stored choice for this extension. An absent choice follows its source or default. */
|
|
14
|
+
export declare function extensionSwitch(db: KernelSchemaDb, orgId: Key, plugin: Key): import("kysely").SelectQueryBuilder<import("../db/kernel-schema.js").KernelDatabase & {
|
|
15
|
+
extension_switch: import("../db/kernel-schema.js").ComponentOrgSwitchesTable;
|
|
16
|
+
}, "extension_switch", {
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
/** The same intent predicate for point, org-list and membership-correlated reads. */
|
|
20
|
+
export declare function extensionIntent(db: KernelSchemaDb, orgId: Key, plugin: Key, proposedChoice?: boolean): import("kysely").RawBuilder<boolean>;
|
|
21
|
+
/** The names enabled in an org, optionally narrowed to one extension in the outer query. */
|
|
22
|
+
export declare function enabledExtensionsQuery(db: KernelSchemaDb, orgId: Key, plugin?: Key): import("kysely").SelectQueryBuilder<import("../db/kernel-schema.js").KernelDatabase, never, {
|
|
30
23
|
plugin: string;
|
|
31
24
|
}>;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, "
|
|
25
|
+
/** Test only the requested extension names when a deployment-wide reader needs org pairs. */
|
|
26
|
+
export declare function enabledExtensionsByOrg(db: KernelSchemaDb, plugins: readonly string[]): import("kysely").SelectQueryBuilder<import("../db/kernel-schema.js").KernelDatabase & {
|
|
27
|
+
enabled_org: import("../db/kernel-schema.js").OrgsTable;
|
|
28
|
+
} & {
|
|
29
|
+
requested: {
|
|
30
|
+
plugin: string;
|
|
31
|
+
};
|
|
32
|
+
}, "enabled_org" | "requested", {
|
|
40
33
|
org_id: string;
|
|
41
34
|
plugin: string;
|
|
42
35
|
}>;
|
|
43
|
-
/** Whether
|
|
36
|
+
/** Whether the extension has committed intent in the org. Execution checks remain at the caller. */
|
|
44
37
|
export declare function isExtensionEnabled(db: KernelSchemaDb, orgId: string, plugin: string): Promise<boolean>;
|
|
45
38
|
/**
|
|
46
39
|
* The names of the required bootstrap plugins (installed with `required`): the ones that refuse
|
|
@@ -49,3 +42,4 @@ export declare function isExtensionEnabled(db: KernelSchemaDb, orgId: string, pl
|
|
|
49
42
|
export declare function requiredExtensions(db: KernelSchemaDb): Promise<Set<string>>;
|
|
50
43
|
/** The names of the always-on extensions ({@link alwaysOnExtensionsQuery}). */
|
|
51
44
|
export declare function alwaysOnExtensions(db: KernelSchemaDb): Promise<Set<string>>;
|
|
45
|
+
export {};
|
|
@@ -1,78 +1,157 @@
|
|
|
1
1
|
import { sql } from "kysely";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* helpers so none of them misses one:
|
|
5
|
-
* - `extension_org_configs.enabled` (the org's own switch);
|
|
6
|
-
* - every always-on extension ({@link alwaysOnExtensionsQuery}): enabled in every org, existing and
|
|
7
|
-
* future, without an org config row, whatever such a row says. That is a required bootstrap
|
|
8
|
-
* plugin (`extension_installs.required`, package ecosystem spec §7) and an extension shipped in a
|
|
9
|
-
* builtin platform plugin (a live `catalog_items` row with `builtin`, recorded on its install or in
|
|
10
|
-
* `extension_catalog_sources`; a `builtin: true` bootstrap entry is builtin without being
|
|
11
|
-
* required). A builtin plugin is on in every org and its org switch is locked (`wantedOn`,
|
|
12
|
-
* `itemLocked`), so its extension must be on too: the scope sync leaves builtin items alone.
|
|
13
|
-
* Neither checks that the extension is loaded on this replica or enabled on the deployment; callers
|
|
14
|
-
* that need that check it themselves, as before. Plain SQL read on every call (no cache), so every
|
|
15
|
-
* replica sees a change at once. `db` may be a transaction.
|
|
16
|
-
*/
|
|
2
|
+
import { orgUsable } from "../catalog/org-intent.js";
|
|
3
|
+
import { extensionSourcesQuery } from "./plugin-items.js";
|
|
17
4
|
/**
|
|
18
5
|
* The names of the always-on extensions (a subquery with one column, `plugin`): required bootstrap
|
|
19
6
|
* plugins and the extensions of live builtin platform plugins (see the file header).
|
|
20
7
|
*/
|
|
21
|
-
export function alwaysOnExtensionsQuery(db) {
|
|
22
|
-
|
|
8
|
+
export function alwaysOnExtensionsQuery(db, plugin) {
|
|
9
|
+
const required = db
|
|
23
10
|
.selectFrom("extension_installs as ri")
|
|
24
11
|
.select("ri.name as plugin")
|
|
25
|
-
.where("ri.required", "=", true)
|
|
26
|
-
|
|
27
|
-
.selectFrom(
|
|
28
|
-
.innerJoin("catalog_items as
|
|
29
|
-
.select("
|
|
30
|
-
.where("
|
|
31
|
-
.where("
|
|
32
|
-
.where("
|
|
33
|
-
.where("
|
|
34
|
-
|
|
35
|
-
.selectFrom("extension_catalog_sources as cs")
|
|
36
|
-
.innerJoin("catalog_items as si", "si.id", "cs.item_id")
|
|
37
|
-
.select("cs.plugin as plugin")
|
|
38
|
-
.where("si.builtin", "=", true)
|
|
39
|
-
.where("si.disabled", "=", false)
|
|
40
|
-
.where("si.deleted_at", "is", null)
|
|
41
|
-
.where("si.owner_org_id", "is", null));
|
|
12
|
+
.where("ri.required", "=", true);
|
|
13
|
+
const builtin = db
|
|
14
|
+
.selectFrom(extensionSourcesQuery(db, plugin).as("source"))
|
|
15
|
+
.innerJoin("catalog_items as item", "item.id", "source.item_id")
|
|
16
|
+
.select("source.plugin")
|
|
17
|
+
.where("item.builtin", "=", true)
|
|
18
|
+
.where("item.disabled", "=", false)
|
|
19
|
+
.where("item.deleted_at", "is", null)
|
|
20
|
+
.where("item.owner_org_id", "is", null);
|
|
21
|
+
return (plugin === undefined ? required : required.where("ri.name", "=", plugin)).union(builtin);
|
|
42
22
|
}
|
|
43
|
-
/** The
|
|
44
|
-
export function
|
|
23
|
+
/** The stored choice for this extension. An absent choice follows its source or default. */
|
|
24
|
+
export function extensionSwitch(db, orgId, plugin) {
|
|
45
25
|
return db
|
|
46
|
-
.selectFrom("
|
|
47
|
-
.select("
|
|
48
|
-
.where("
|
|
49
|
-
.where("
|
|
50
|
-
.
|
|
26
|
+
.selectFrom("component_org_switches as extension_switch")
|
|
27
|
+
.select("extension_switch.enabled")
|
|
28
|
+
.where("extension_switch.kind", "=", "extension")
|
|
29
|
+
.where("extension_switch.org_id", "=", orgId)
|
|
30
|
+
.where("extension_switch.component_id", "=", plugin);
|
|
51
31
|
}
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
32
|
+
/** The same intent predicate for point, org-list and membership-correlated reads. */
|
|
33
|
+
export function extensionIntent(db, orgId, plugin, proposedChoice) {
|
|
34
|
+
const org = db
|
|
35
|
+
.selectFrom("orgs")
|
|
36
|
+
.select("id")
|
|
37
|
+
.where("id", "=", orgId)
|
|
38
|
+
.where("deleted_at", "is", null);
|
|
39
|
+
const required = db
|
|
40
|
+
.selectFrom("extension_installs")
|
|
41
|
+
.select("name")
|
|
42
|
+
.where("name", "=", plugin)
|
|
43
|
+
.where("required", "=", true);
|
|
44
|
+
const sources = db
|
|
45
|
+
.selectFrom(extensionSourcesQuery(db, plugin).as("source"))
|
|
46
|
+
.crossJoinLateral((eb) => db
|
|
47
|
+
.selectFrom("catalog_items")
|
|
48
|
+
.select([
|
|
49
|
+
"id",
|
|
50
|
+
"deleted_at",
|
|
51
|
+
"disabled",
|
|
52
|
+
"owner_org_id",
|
|
53
|
+
"shareable",
|
|
54
|
+
"scope",
|
|
55
|
+
"builtin",
|
|
56
|
+
"latest_version",
|
|
57
|
+
])
|
|
58
|
+
.where("id", "=", eb.ref("source.item_id"))
|
|
59
|
+
.limit(1)
|
|
60
|
+
.as("source_item"))
|
|
61
|
+
.leftJoin("catalog_item_scope_orgs as source_org", (join) => join.onRef("source_org.item_id", "=", "source.item_id").on("source_org.org_id", "=", orgId))
|
|
62
|
+
.select((eb) => [
|
|
63
|
+
eb("source_item.deleted_at", "is", null).as("live"),
|
|
64
|
+
eb
|
|
65
|
+
.and([
|
|
66
|
+
eb("source_item.builtin", "=", true),
|
|
67
|
+
eb("source_item.disabled", "=", false),
|
|
68
|
+
eb("source_item.owner_org_id", "is", null),
|
|
69
|
+
])
|
|
70
|
+
.as("builtin"),
|
|
71
|
+
eb
|
|
72
|
+
.and([
|
|
73
|
+
eb("source_item.disabled", "=", false),
|
|
74
|
+
eb.or([
|
|
75
|
+
eb("source_item.owner_org_id", "is", null),
|
|
76
|
+
eb("source_item.owner_org_id", "=", orgId),
|
|
77
|
+
eb.and([
|
|
78
|
+
eb("source_item.shareable", "=", true),
|
|
79
|
+
eb.exists(eb
|
|
80
|
+
.selectFrom("catalog_item_versions as published")
|
|
81
|
+
.select("published.item_id")
|
|
82
|
+
.whereRef("published.item_id", "=", "source_item.id")
|
|
83
|
+
.whereRef("published.version", "=", "source_item.latest_version")
|
|
84
|
+
.where("published.applied_at", "is not", null)),
|
|
85
|
+
]),
|
|
86
|
+
]),
|
|
87
|
+
eb.or([eb("source_item.scope", "!=", "named"), eb("source_org.item_id", "is not", null)]),
|
|
88
|
+
])
|
|
89
|
+
.as("authorized"),
|
|
90
|
+
orgUsable(db, orgId, eb.ref("source.item_id")).as("follows"),
|
|
91
|
+
]);
|
|
92
|
+
const choice = proposedChoice === undefined
|
|
93
|
+
? extensionSwitch(db, orgId, plugin)
|
|
94
|
+
: db.selectNoFrom(sql `${proposedChoice}::boolean`.as("enabled"));
|
|
95
|
+
return sql `
|
|
96
|
+
exists (${org}) AND (
|
|
97
|
+
exists (${required})
|
|
98
|
+
OR (
|
|
99
|
+
SELECT CASE
|
|
100
|
+
WHEN summary.builtin THEN true
|
|
101
|
+
WHEN summary.all_sources = 0 THEN choice.enabled IS TRUE
|
|
102
|
+
WHEN summary.live_sources = 1 THEN summary.follows AND choice.enabled IS NOT FALSE
|
|
103
|
+
WHEN summary.live_sources > 1 THEN summary.authorized AND choice.enabled IS TRUE
|
|
104
|
+
ELSE false
|
|
105
|
+
END
|
|
106
|
+
FROM (
|
|
107
|
+
SELECT count(*) AS all_sources,
|
|
108
|
+
count(*) FILTER (WHERE live) AS live_sources,
|
|
109
|
+
bool_or(builtin) FILTER (WHERE live) AS builtin,
|
|
110
|
+
bool_or(follows) FILTER (WHERE live) AS follows,
|
|
111
|
+
bool_and(authorized) FILTER (WHERE live) AS authorized
|
|
112
|
+
FROM (${sources}) AS source_intent
|
|
113
|
+
) AS summary
|
|
114
|
+
LEFT JOIN (${choice}) AS choice ON true
|
|
115
|
+
)
|
|
116
|
+
)`;
|
|
117
|
+
}
|
|
118
|
+
/** The names enabled in an org, optionally narrowed to one extension in the outer query. */
|
|
119
|
+
export function enabledExtensionsQuery(db, orgId, plugin) {
|
|
120
|
+
if (plugin !== undefined) {
|
|
121
|
+
return db
|
|
122
|
+
.selectNoFrom(sql `${plugin}`.as("plugin"))
|
|
123
|
+
.where(extensionIntent(db, orgId, plugin));
|
|
124
|
+
}
|
|
125
|
+
const installed = db.selectFrom("extension_installs").select("name as plugin");
|
|
126
|
+
const sources = db.selectFrom("extension_catalog_sources").select("plugin");
|
|
127
|
+
const switches = db
|
|
128
|
+
.selectFrom("component_org_switches")
|
|
129
|
+
.select("component_id as plugin")
|
|
130
|
+
.where("kind", "=", "extension")
|
|
131
|
+
.where("org_id", "=", orgId);
|
|
132
|
+
return db
|
|
133
|
+
.selectFrom(installed.union(sources).union(switches).as("candidate"))
|
|
134
|
+
.select("candidate.plugin")
|
|
135
|
+
.where((eb) => extensionIntent(db, orgId, eb.ref("candidate.plugin")));
|
|
136
|
+
}
|
|
137
|
+
/** Test only the requested extension names when a deployment-wide reader needs org pairs. */
|
|
138
|
+
export function enabledExtensionsByOrg(db, plugins) {
|
|
139
|
+
const requested = db
|
|
140
|
+
.selectNoFrom(sql `unnest(${[...new Set(plugins)]}::text[])`.as("plugin"))
|
|
141
|
+
.as("requested");
|
|
59
142
|
return db
|
|
60
|
-
.selectFrom("
|
|
61
|
-
.
|
|
62
|
-
.
|
|
63
|
-
.
|
|
64
|
-
.
|
|
65
|
-
.innerJoin(alwaysOnExtensionsQuery(db).as("ao"), (j) => j.onTrue())
|
|
66
|
-
.select(["ro.id as org_id", "ao.plugin as plugin"]));
|
|
143
|
+
.selectFrom("orgs as enabled_org")
|
|
144
|
+
.crossJoin(requested)
|
|
145
|
+
.select(["enabled_org.id as org_id", "requested.plugin"])
|
|
146
|
+
.where("enabled_org.deleted_at", "is", null)
|
|
147
|
+
.where(({ exists, ref }) => exists(enabledExtensionsQuery(db, ref("enabled_org.id"), ref("requested.plugin"))));
|
|
67
148
|
}
|
|
68
|
-
/** Whether
|
|
149
|
+
/** Whether the extension has committed intent in the org. Execution checks remain at the caller. */
|
|
69
150
|
export async function isExtensionEnabled(db, orgId, plugin) {
|
|
70
|
-
const
|
|
71
|
-
.
|
|
72
|
-
.
|
|
73
|
-
|
|
74
|
-
.executeTakeFirst();
|
|
75
|
-
return row !== undefined;
|
|
151
|
+
const { enabled } = await db
|
|
152
|
+
.selectNoFrom(extensionIntent(db, orgId, plugin).as("enabled"))
|
|
153
|
+
.executeTakeFirstOrThrow();
|
|
154
|
+
return enabled;
|
|
76
155
|
}
|
|
77
156
|
/**
|
|
78
157
|
* The names of the required bootstrap plugins (installed with `required`): the ones that refuse
|
|
@@ -32,6 +32,7 @@ import { OrgOverrides } from "./org-overrides.js";
|
|
|
32
32
|
import { PluginGuides } from "./plugin-guides.js";
|
|
33
33
|
import { PluginIcons } from "./plugin-icons.js";
|
|
34
34
|
import { ExtensionPointDefaults } from "./point-defaults.js";
|
|
35
|
+
import { ExtensionPointServingModule } from "./point-serving.js";
|
|
35
36
|
import { ExtensionRegistryModule } from "./registry.js";
|
|
36
37
|
import { SingleProviderGuard } from "./single-provider.js";
|
|
37
38
|
import { ReplicaStatusStore } from "./sources.js";
|
|
@@ -50,6 +51,8 @@ ExtensionsModule = __decorate([
|
|
|
50
51
|
Module({
|
|
51
52
|
imports: [
|
|
52
53
|
ExtensionRegistryModule,
|
|
54
|
+
// one provider's candidacy for a point, shared with the conversation access check
|
|
55
|
+
ExtensionPointServingModule,
|
|
53
56
|
TriggerEventsModule,
|
|
54
57
|
InboxItemsModule,
|
|
55
58
|
SuperAdminLockModule,
|