@capybara-hq/kernel 0.1.0-rc.77 → 0.1.0-rc.79
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 +6 -6
- package/dist/admin/outbox-dead.service.js +4 -1
- package/dist/agents/admin-agents.js +2 -0
- package/dist/agents/agent-lookup.js +4 -0
- package/dist/agents/agent-profile.service.js +3 -0
- package/dist/agents/agents.service.js +7 -0
- package/dist/agents/org-templates.js +1 -0
- package/dist/agents/pending-connector-requests.js +6 -0
- package/dist/agents/pending-connectors.service.js +2 -0
- package/dist/agents/readiness.service.d.ts +9 -3
- package/dist/agents/readiness.service.js +3 -3
- package/dist/agents/templates.js +1 -0
- package/dist/background/finish.js +3 -0
- package/dist/background/stop.js +2 -0
- package/dist/background/store.js +44 -0
- package/dist/background/tasks.service.js +3 -2
- package/dist/background/wake-rules.js +1 -0
- package/dist/catalog/admin-catalog.controller.d.ts +6 -0
- package/dist/catalog/admin-catalog.controller.js +13 -0
- package/dist/catalog/catalog-content.d.ts +9 -0
- package/dist/catalog/catalog-content.js +3 -1
- package/dist/catalog/catalog-items.js +4 -0
- package/dist/catalog/catalog-scope.service.js +4 -1
- package/dist/catalog/component-promotion.js +2 -0
- package/dist/catalog/component-scope.controller.d.ts +9 -15
- package/dist/catalog/component-scope.controller.js +14 -9
- package/dist/catalog/component-scope.service.js +5 -0
- package/dist/catalog/component-state.d.ts +4 -1
- package/dist/catalog/component-state.js +4 -2
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplace-fetch.js +1 -1
- package/dist/catalog/marketplaces.service.d.ts +6 -1
- package/dist/catalog/marketplaces.service.js +8 -3
- package/dist/catalog/org-catalog.controller.d.ts +9 -0
- package/dist/catalog/org-catalog.controller.js +18 -0
- package/dist/catalog/org-catalog.schemas.d.ts +2 -4
- package/dist/catalog/org-catalog.schemas.js +2 -3
- package/dist/catalog/org-catalog.service.d.ts +10 -1
- package/dist/catalog/org-catalog.service.js +34 -23
- package/dist/catalog/org-extension-switch.d.ts +3 -10
- package/dist/catalog/org-extension-switch.js +14 -60
- package/dist/catalog/org-extension.controller.d.ts +6 -7
- package/dist/catalog/org-extension.controller.js +4 -4
- package/dist/catalog/org-extension.schemas.d.ts +1 -2
- package/dist/catalog/org-extension.schemas.js +1 -3
- package/dist/catalog/owned-items.js +10 -1
- package/dist/catalog/ownership.js +2 -0
- package/dist/catalog/plugin-import.d.ts +3 -0
- package/dist/catalog/plugin-import.js +10 -1
- package/dist/catalog/plugin-install.d.ts +1 -4
- package/dist/catalog/plugin-install.js +11 -12
- package/dist/catalog/plugin-upgrade.js +4 -1
- package/dist/catalog/request-rules.js +6 -0
- package/dist/catalog/requests.service.js +4 -0
- package/dist/catalog/scope-orgs.js +1 -0
- package/dist/catalog/scope-sync.d.ts +8 -5
- package/dist/catalog/scope-sync.js +21 -23
- package/dist/catalog/template-description.d.ts +17 -0
- package/dist/catalog/template-description.js +18 -0
- package/dist/catalog/unshare.js +3 -0
- package/dist/channels/connections.service.js +1 -0
- package/dist/channels/inbound.js +1 -0
- package/dist/channels/jobs.js +1 -0
- package/dist/channels/outbound.js +6 -0
- package/dist/channels/supervisor.js +1 -0
- package/dist/channels/threads.js +1 -0
- package/dist/client/client-reports.service.js +1 -0
- package/dist/config/fields.js +20 -4
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +13 -13
- package/dist/conversations/access.js +1 -0
- package/dist/conversations/attachments.service.js +16 -4
- package/dist/conversations/conversations.service.js +17 -3
- package/dist/conversations/event-log.js +2 -0
- package/dist/conversations/events.d.ts +1 -0
- package/dist/conversations/events.js +3 -1
- package/dist/conversations/files.js +3 -2
- package/dist/conversations/permission-profiles.service.js +1 -0
- package/dist/conversations/prompt-suggestions.js +2 -0
- package/dist/conversations/queue.js +8 -0
- package/dist/conversations/queue.service.js +6 -2
- package/dist/conversations/source.js +2 -0
- package/dist/conversations/titles.js +10 -2
- package/dist/conversations/tree.js +6 -0
- package/dist/db/kernel-schema.d.ts +5 -1
- package/dist/devices/conversation-devices.js +3 -0
- package/dist/devices/device-projects.service.js +2 -0
- package/dist/devices/devices.service.js +5 -0
- package/dist/devices/legacy-cleanup.job.js +5 -2
- package/dist/dial-in/handlers.js +2 -0
- package/dist/dial-in/machines.js +11 -2
- package/dist/dial-in/targets.d.ts +0 -2
- package/dist/dial-in/targets.js +0 -10
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/evals/budget.js +14 -1
- package/dist/evals/run-replay.js +4 -0
- package/dist/evals/runs.service.js +13 -7
- package/dist/evals/sets.service.js +23 -8
- package/dist/evals/trajectory.service.d.ts +1 -1
- package/dist/evals/trajectory.service.js +1 -0
- package/dist/evals/worker.js +5 -1
- package/dist/extensions/admin-ops.js +1 -0
- package/dist/extensions/admin-view.js +3 -1
- package/dist/extensions/bootstrap-packages.d.ts +12 -1
- package/dist/extensions/bootstrap-packages.js +49 -9
- package/dist/extensions/bootstrap.d.ts +17 -2
- package/dist/extensions/bootstrap.js +41 -9
- package/dist/extensions/config-json-schema.d.ts +2 -2
- package/dist/extensions/config-json-schema.js +1 -3
- package/dist/extensions/deployment-config.d.ts +5 -3
- package/dist/extensions/deployment-config.js +3 -3
- package/dist/extensions/effective-config.d.ts +8 -7
- package/dist/extensions/effective-config.js +8 -7
- package/dist/extensions/enabled.js +1 -0
- package/dist/extensions/host.d.ts +4 -3
- package/dist/extensions/host.js +11 -12
- package/dist/extensions/instance.d.ts +1 -1
- package/dist/extensions/instance.js +17 -2
- package/dist/extensions/org-config.d.ts +35 -97
- package/dist/extensions/org-config.js +48 -315
- package/dist/extensions/org-levels.d.ts +22 -9
- package/dist/extensions/org-levels.js +100 -20
- package/dist/extensions/org-overrides.d.ts +14 -15
- package/dist/extensions/org-overrides.js +20 -20
- package/dist/extensions/package.js +1 -1
- package/dist/extensions/permission-set.d.ts +1 -3
- package/dist/extensions/permission-set.js +3 -7
- package/dist/extensions/permission-view.d.ts +3 -1
- package/dist/extensions/permission-view.js +5 -4
- package/dist/extensions/plugin-icons.d.ts +80 -1
- package/dist/extensions/plugin-icons.js +211 -2
- package/dist/extensions/point-defaults.d.ts +17 -18
- package/dist/extensions/point-defaults.js +25 -28
- package/dist/git/gateway.js +1 -1
- package/dist/git/identity.d.ts +1 -1
- package/dist/git/identity.js +2 -2
- package/dist/identity/accounts.js +6 -0
- package/dist/identity/api-tokens.js +8 -0
- package/dist/infra/outbox/outbox.dispatcher.js +4 -1
- package/dist/infra/outbox/outbox.service.js +2 -0
- package/dist/net/public-address.d.ts +3 -3
- package/dist/net/public-address.js +3 -3
- package/dist/orgs/directory-sync.d.ts +9 -6
- package/dist/orgs/directory-sync.js +15 -12
- package/dist/orgs/invitations.service.js +2 -0
- package/dist/orgs/members.service.js +2 -0
- package/dist/orgs/offboarding.js +2 -0
- package/dist/packages/npm.d.ts +10 -2
- package/dist/packages/npm.js +38 -6
- package/dist/platform/exclusions.js +20 -0
- package/dist/platform/ops/admin-items.ops.js +1 -0
- package/dist/platform/ops/agents.ops.js +1 -0
- package/dist/platform/ops/connectors.ops.js +7 -1
- package/dist/platform/ops/extensions.ops.d.ts +6 -8
- package/dist/platform/ops/extensions.ops.js +18 -97
- package/dist/platform/ops/org-plugins.ops.d.ts +3 -6
- package/dist/platform/ops/org-plugins.ops.js +14 -65
- package/dist/platform/ops/outbox.ops.js +1 -0
- package/dist/platform/ops/person-inputs.d.ts +0 -4
- package/dist/platform/ops/person-inputs.js +0 -8
- package/dist/platform/ops/plugins.ops.d.ts +4 -1
- package/dist/platform/ops/plugins.ops.js +27 -34
- package/dist/platform/person-fields.d.ts +1 -1
- package/dist/platform/person-fields.js +1 -1
- package/dist/platform/sealed-reveals.js +2 -0
- package/dist/push/recipients.js +9 -2
- package/dist/runtime/permission-context.service.js +1 -0
- package/dist/runtime/plugin-context.service.js +1 -0
- package/dist/runtime/project/knowledge.service.js +1 -0
- package/dist/runtime/run-context.service.js +1 -0
- package/dist/runtime/run-deletion.js +4 -0
- package/dist/runtime/run-execution.js +2 -0
- package/dist/runtime/run-finish.js +3 -0
- package/dist/runtime/run-jobs.js +3 -0
- package/dist/runtime/run-orphan-check.job.js +7 -0
- package/dist/runtime/run-queue.js +21 -2
- package/dist/runtime/run-worker.js +5 -0
- package/dist/runtime/step-log.js +1 -0
- package/dist/runtime/subagents/child.js +2 -0
- package/dist/runtime/subagents/deliveries.js +3 -0
- package/dist/runtime/subagents/dispatch.js +5 -1
- package/dist/runtime/subagents/messages.js +2 -0
- package/dist/runtime/subagents/org-agents.d.ts +1 -1
- package/dist/runtime/subagents/org-agents.js +2 -1
- package/dist/runtime/usage-report-jobs.js +1 -0
- package/dist/runtime/usage-report.js +3 -0
- package/dist/runtime/waits.js +5 -0
- package/dist/sandbox/cloud-permission-snapshot.js +9 -3
- package/dist/sandbox/device-reports.js +3 -0
- package/dist/sandbox/legacy-retirement.js +5 -1
- package/dist/sandbox/managed-device-context.js +1 -0
- package/dist/sandbox/modes.d.ts +5 -2
- package/dist/sandbox/modes.js +8 -4
- package/dist/sandbox/network-grants.js +2 -0
- package/dist/sandbox/operation-intents.js +58 -0
- package/dist/sandbox/operation-reconcile.job.js +2 -0
- package/dist/sandbox/permission-authority-lock.js +12 -6
- package/dist/sandbox/permission-call-grants.js +6 -0
- package/dist/sandbox/permission-ceiling-writes.js +5 -0
- package/dist/sandbox/permission-config-publication.js +5 -0
- package/dist/sandbox/permission-instance-writes.js +4 -0
- package/dist/sandbox/permission-runtime-reports.js +10 -1
- package/dist/sandbox/permission-transitions.js +3 -0
- package/dist/sandbox/review/review.service.js +8 -5
- package/dist/sandbox/sandbox.service.d.ts +14 -0
- package/dist/sandbox/sandbox.service.js +195 -29
- package/dist/sandbox/unreachable.js +4 -1
- package/dist/schedules/fire.js +9 -3
- package/dist/schedules/pause.js +2 -0
- package/dist/schedules/run-tracker.js +16 -1
- package/dist/schedules/scheduled-tasks.service.js +4 -2
- package/dist/schedules/store.js +8 -0
- package/dist/schedules/unattended.js +4 -0
- package/dist/setup/setup-checks.service.d.ts +1 -10
- package/dist/setup/setup-checks.service.js +19 -29
- package/dist/shares/share-open.service.js +1 -0
- package/dist/shares/shares.service.js +2 -0
- package/dist/skills/agent-skills.service.d.ts +1 -1
- package/dist/skills/agent-skills.service.js +13 -2
- package/dist/skills/catalog.js +3 -0
- package/dist/skills/changes.service.js +10 -2
- package/dist/skills/conversation-catalog.js +1 -0
- package/dist/skills/skills.service.js +4 -0
- package/dist/tools/approvals.service.js +40 -0
- package/dist/tools/builtins/schedules.js +11 -6
- package/dist/tools/builtins/web/fetch.js +1 -1
- package/dist/tools/builtins/web/search.js +1 -1
- package/dist/tools/connector-account-policies.js +3 -0
- package/dist/tools/connectors.controller.d.ts +37 -9
- package/dist/tools/connectors.controller.js +47 -12
- package/dist/tools/connectors.schemas.d.ts +4 -0
- package/dist/tools/connectors.schemas.js +13 -1
- package/dist/tools/connectors.service.d.ts +17 -0
- package/dist/tools/connectors.service.js +36 -2
- package/dist/tools/drift.js +5 -0
- package/dist/tools/git-push-policy.js +3 -0
- package/dist/tools/oauth/discovery.d.ts +2 -2
- package/dist/tools/oauth/discovery.js +2 -2
- package/dist/tools/oauth/flow.js +1 -0
- package/dist/tools/outputs.js +2 -0
- package/dist/tools/permission-approval-jobs.js +3 -0
- package/dist/tools/pipeline.js +2 -0
- package/dist/tools/policy.js +3 -0
- package/dist/tools/questions.service.js +13 -0
- package/package.json +3 -3
- package/src/migrations/0181_connector_description.sql +3 -0
|
@@ -450,6 +450,8 @@ export async function marketplaceLatest(db, config, items, versions) {
|
|
|
450
450
|
/** Org install counts per item (see {@link CatalogItemView.installs}). */
|
|
451
451
|
export async function countInstalls(db, items, versions) {
|
|
452
452
|
const orgs = new Map(items.map((i) => [i.id, new Set()]));
|
|
453
|
+
// org-filter: the platform catalog's install count per item (super admin's catalog view): it
|
|
454
|
+
// counts the orgs on purpose and returns no org row
|
|
453
455
|
const installed = await db
|
|
454
456
|
.selectFrom("plugin_installs")
|
|
455
457
|
.select(["item_id", "org_id"])
|
|
@@ -585,6 +587,8 @@ export async function itemScopeFacts(db, items, confirmations) {
|
|
|
585
587
|
return out;
|
|
586
588
|
const ids = items.map((i) => i.id);
|
|
587
589
|
// one after the other: `db` may be a transaction's single connection
|
|
590
|
+
// org-filter: the platform catalog's scope facts per item (super admin's catalog and import
|
|
591
|
+
// views): the named orgs of each item are listed across orgs on purpose
|
|
588
592
|
const listed = await db
|
|
589
593
|
.selectFrom("catalog_item_scope_orgs")
|
|
590
594
|
.select(["item_id", "org_id"])
|
|
@@ -1240,7 +1240,10 @@ __decorate([
|
|
|
1240
1240
|
Transactional({ propagation: "mandatory" })
|
|
1241
1241
|
], CatalogScopeService.prototype, "enqueue", null);
|
|
1242
1242
|
CatalogScopeService = __decorate([
|
|
1243
|
-
Injectable()
|
|
1243
|
+
Injectable()
|
|
1244
|
+
// org-filter: super admin's platform plugin scope: an item's scope list, org switches and installs
|
|
1245
|
+
// span every org by design (keyed by the platform item id)
|
|
1246
|
+
,
|
|
1244
1247
|
__param(0, Inject(KernelDb)),
|
|
1245
1248
|
__param(1, Inject(SuperAdminLock)),
|
|
1246
1249
|
__param(2, Inject(CatalogService)),
|
|
@@ -205,6 +205,7 @@ let ComponentPromotion = class ComponentPromotion {
|
|
|
205
205
|
.updateTable("skills")
|
|
206
206
|
.set({ platform_skill_id: p.platformId, updated_at: sql `now()` })
|
|
207
207
|
.where("id", "=", row.id)
|
|
208
|
+
.where("org_id", "=", row.orgId)
|
|
208
209
|
.execute();
|
|
209
210
|
}
|
|
210
211
|
else {
|
|
@@ -245,6 +246,7 @@ let ComponentPromotion = class ComponentPromotion {
|
|
|
245
246
|
.updateTable("agent_templates")
|
|
246
247
|
.set({ platform_template_id: p.platformId, updated_at: new Date() })
|
|
247
248
|
.where("id", "=", row.id)
|
|
249
|
+
.where("org_id", "=", row.orgId)
|
|
248
250
|
.execute();
|
|
249
251
|
}
|
|
250
252
|
await this.db
|
|
@@ -3,7 +3,7 @@ import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
|
3
3
|
import { type Principal } from "../identity/principal.js";
|
|
4
4
|
import { type OrgContext } from "../orgs/org.guard.js";
|
|
5
5
|
import { ComponentParams, ComponentDisabledSchema as DisabledBody, ComponentIdSchema as IdParams, ComponentListQuery as ListQuery, OrgComponentListQuery, ComponentScopePreviewSchema as PreviewBody, ComponentScopeSchema as ScopeBody, ComponentShownSchema as ShownBody, ComponentSwitchBody as SwitchBody, ComponentTemplateVersionSchema as TemplateVersionBody } from "./component-scope.schemas.js";
|
|
6
|
-
import { type ComponentScopePreview, ComponentScopeService, type ComponentVersionView, type ComponentView, type OrgComponentView, type OrgOfferedComponentView } from "./component-scope.service.js";
|
|
6
|
+
import { type ComponentScopePreview, ComponentScopeService, type ComponentSwitchResult, type ComponentVersionView, type ComponentView, type OrgComponentView, type OrgOfferedComponentView } from "./component-scope.service.js";
|
|
7
7
|
import { PlatformComponents, type UploadedComponentVersion } from "./platform-components.js";
|
|
8
8
|
/**
|
|
9
9
|
* Platform components (`/api/v1/admin/components/*`, super admins; plugin scope phase 2, Task 6):
|
|
@@ -30,7 +30,8 @@ export declare class AdminComponentsController {
|
|
|
30
30
|
uploadAgentTemplateVersion(principal: Principal, p: z.infer<typeof IdParams>, body: z.infer<typeof TemplateVersionBody>): Promise<UploadedComponentVersion>;
|
|
31
31
|
/**
|
|
32
32
|
* `GET ?kind=`: every platform component of the kind (plugin, owner, scope, version, orgs on),
|
|
33
|
-
* each with its display name and
|
|
33
|
+
* each with its display name and `icon` (a connector template's own icon, else its plugin's, on
|
|
34
|
+
* the admin routes; null without one).
|
|
34
35
|
*/
|
|
35
36
|
list(q: z.infer<typeof ListQuery>): Promise<{
|
|
36
37
|
components: (ComponentView & {
|
|
@@ -78,8 +79,9 @@ export declare class OrgComponentsController {
|
|
|
78
79
|
* The platform components offered to the org (`?kind=`, `?itemId=`: only those; Task 10): each
|
|
79
80
|
* with its state in the org (`on`, `locked` for `all`, the org's `switch`) and whether an org
|
|
80
81
|
* admin may switch it. Members read it (the workspace pages are read-only for them). Each has
|
|
81
|
-
* its display name and `icon`, its plugin's
|
|
82
|
-
* or when the org's catalog does not show the plugin to the reader:
|
|
82
|
+
* its display name and `icon`, a connector template's own icon, else its plugin's, on the org's
|
|
83
|
+
* routes (null without one, or when the org's catalog does not show the plugin to the reader:
|
|
84
|
+
* the share gate holds).
|
|
83
85
|
*/
|
|
84
86
|
list(org: OrgContext, q: z.infer<typeof OrgComponentListQuery>): Promise<{
|
|
85
87
|
components: (OrgOfferedComponentView & {
|
|
@@ -88,15 +90,7 @@ export declare class OrgComponentsController {
|
|
|
88
90
|
}>;
|
|
89
91
|
setSwitch(principal: Principal, org: OrgContext, p: z.infer<typeof ComponentParams>, body: z.infer<typeof SwitchBody>): Promise<{
|
|
90
92
|
component: OrgComponentView;
|
|
91
|
-
} | {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
id: string;
|
|
95
|
-
name: string;
|
|
96
|
-
refs: string[];
|
|
97
|
-
}[];
|
|
98
|
-
connectorsKept: number;
|
|
99
|
-
};
|
|
100
|
-
confirm: string;
|
|
101
|
-
}>;
|
|
93
|
+
} | Omit<Extract<ComponentSwitchResult, {
|
|
94
|
+
kind: "preview";
|
|
95
|
+
}>, "kind">>;
|
|
102
96
|
}
|
|
@@ -38,14 +38,17 @@ class ComponentShownBody extends createZodDto(ShownBody, "ComponentShownBody") {
|
|
|
38
38
|
class ComponentSwitchBody extends createZodDto(SwitchBody, "ComponentSwitchBody") {
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* Each component with `icon
|
|
42
|
-
*
|
|
43
|
-
*
|
|
41
|
+
* Each component with `icon` on the reader's route: a connector template's own icon, else its
|
|
42
|
+
* plugin's icon (maintainer decision 2026-11-09: a connector template without an icon of its own
|
|
43
|
+
* shows its plugin's); null without one, for a component without a plugin, or when the reader may
|
|
44
|
+
* not see the plugin.
|
|
44
45
|
*/
|
|
45
46
|
async function withIcons(icons, rows, scope) {
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const urls = await icons.ofTemplatesOrItems(rows.map((r) => ({
|
|
48
|
+
templateId: r.kind === "connector_template" ? r.id : null,
|
|
49
|
+
itemId: r.itemId,
|
|
50
|
+
})), scope);
|
|
51
|
+
return rows.map((r, i) => ({ ...r, icon: urls[i] ?? null }));
|
|
49
52
|
}
|
|
50
53
|
const actorOpts = (actor) => {
|
|
51
54
|
const tokenId = patTokenId(actor);
|
|
@@ -88,7 +91,8 @@ let AdminComponentsController = class AdminComponentsController {
|
|
|
88
91
|
}
|
|
89
92
|
/**
|
|
90
93
|
* `GET ?kind=`: every platform component of the kind (plugin, owner, scope, version, orgs on),
|
|
91
|
-
* each with its display name and
|
|
94
|
+
* each with its display name and `icon` (a connector template's own icon, else its plugin's, on
|
|
95
|
+
* the admin routes; null without one).
|
|
92
96
|
*/
|
|
93
97
|
async list(q) {
|
|
94
98
|
return {
|
|
@@ -217,8 +221,9 @@ let OrgComponentsController = class OrgComponentsController {
|
|
|
217
221
|
* The platform components offered to the org (`?kind=`, `?itemId=`: only those; Task 10): each
|
|
218
222
|
* with its state in the org (`on`, `locked` for `all`, the org's `switch`) and whether an org
|
|
219
223
|
* admin may switch it. Members read it (the workspace pages are read-only for them). Each has
|
|
220
|
-
* its display name and `icon`, its plugin's
|
|
221
|
-
* or when the org's catalog does not show the plugin to the reader:
|
|
224
|
+
* its display name and `icon`, a connector template's own icon, else its plugin's, on the org's
|
|
225
|
+
* routes (null without one, or when the org's catalog does not show the plugin to the reader:
|
|
226
|
+
* the share gate holds).
|
|
222
227
|
*/
|
|
223
228
|
async list(org, q) {
|
|
224
229
|
const rows = await this.scope.orgList(org.orgId, {
|
|
@@ -331,6 +331,7 @@ let ComponentScopeService = class ComponentScopeService {
|
|
|
331
331
|
* (ruling P2-11): listed read-only, on in their org only. Connector templates have none; an
|
|
332
332
|
* org's own theme is a platform_themes row with its org as owner, listed with the platform ones.
|
|
333
333
|
*/
|
|
334
|
+
// org-filter: super admin's component list: every org's own skills and templates are listed
|
|
334
335
|
async orgOwned(kind, orgs) {
|
|
335
336
|
if (kind === "connector_template" || kind === "theme")
|
|
336
337
|
return [];
|
|
@@ -676,6 +677,8 @@ let ComponentScopeService = class ComponentScopeService {
|
|
|
676
677
|
})
|
|
677
678
|
.where("id", "=", id)
|
|
678
679
|
.execute();
|
|
680
|
+
// org-filter: super admin's scope change (adminLock above) replaces the platform component's
|
|
681
|
+
// whole named list, which spans orgs by design
|
|
679
682
|
await this.db
|
|
680
683
|
.deleteFrom("component_scope_orgs")
|
|
681
684
|
.where("kind", "=", kind)
|
|
@@ -883,6 +886,7 @@ let ComponentScopeService = class ComponentScopeService {
|
|
|
883
886
|
* The scope that offers the component now: its own (`listed`: its own list), or for `follow` its
|
|
884
887
|
* plugin's (`all` for a builtin or deleted plugin: the widest, so nothing counts as widening).
|
|
885
888
|
*/
|
|
889
|
+
// org-filter: a platform plugin's named org list, keyed by its platform item id (spans orgs)
|
|
886
890
|
async effectiveScope(c, listed) {
|
|
887
891
|
if (c.scopeMode === "own" || c.itemId === null)
|
|
888
892
|
return { scope: c.scope, orgs: listed };
|
|
@@ -902,6 +906,7 @@ let ComponentScopeService = class ComponentScopeService {
|
|
|
902
906
|
return { scope: item.scope, orgs: rows.map((r) => r.org_id) };
|
|
903
907
|
}
|
|
904
908
|
/** The component's own `named` list, sorted. */
|
|
909
|
+
// org-filter: a platform component's named org list, keyed by its platform id (spans orgs)
|
|
905
910
|
async listed(kind, id) {
|
|
906
911
|
const rows = await this.db
|
|
907
912
|
.selectFrom("component_scope_orgs")
|
|
@@ -68,7 +68,10 @@ export interface ComponentRow extends ComponentScopeFacts {
|
|
|
68
68
|
/** The current version (a connector template: the catalog version that last changed it). */
|
|
69
69
|
version: string;
|
|
70
70
|
description: string | null;
|
|
71
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* The description's Chinese text (a theme's or skill's `description.zh`, a connector template's
|
|
73
|
+
* `description.zh`); null without one.
|
|
74
|
+
*/
|
|
72
75
|
descriptionZh: string | null;
|
|
73
76
|
/**
|
|
74
77
|
* A connector template's localized display name (its file's `displayName`); null for skills and
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LIVE_INSTALL_STATUSES } from "./install-status.js";
|
|
2
2
|
import { visibleTo, wantedOn } from "./scope.js";
|
|
3
|
+
import { templateDescription } from "./template-description.js";
|
|
3
4
|
/** The kinds the scope, switch, ownership and preview flows (and the component routes) walk. */
|
|
4
5
|
export const COMPONENT_KINDS = [
|
|
5
6
|
"skill",
|
|
@@ -119,8 +120,7 @@ export async function loadComponents(db, kind, filter = {}) {
|
|
|
119
120
|
name: r.template_id,
|
|
120
121
|
plugin: r.item_name,
|
|
121
122
|
version: r.current_version,
|
|
122
|
-
|
|
123
|
-
descriptionZh: null,
|
|
123
|
+
...templateDescription(file?.description),
|
|
124
124
|
displayName: localizedName(file?.displayName),
|
|
125
125
|
originOrgId: null,
|
|
126
126
|
};
|
|
@@ -180,6 +180,8 @@ const groupBy = (rows, key, value) => {
|
|
|
180
180
|
return out;
|
|
181
181
|
};
|
|
182
182
|
/** Reads the {@link ScopeState} of `comps` (all of one kind), one query after the other. */
|
|
183
|
+
// org-filter: the scope state of platform components and their plugins for every org (named lists,
|
|
184
|
+
// installs, switches keyed by platform ids); callers pick their own org out of it
|
|
183
185
|
export async function loadScopeState(db, kind, comps) {
|
|
184
186
|
const itemIds = [...new Set(comps.map((c) => c.itemId).filter((x) => x !== null))];
|
|
185
187
|
const ids = comps.map((c) => c.id);
|
|
@@ -8,7 +8,7 @@ import { type LookupFn, NetDeniedError, type NetPolicy } from "../net/public-add
|
|
|
8
8
|
* - https only (`allowInsecureLoopback`, tests only, allows http on loopback addresses), no user
|
|
9
9
|
* info in the URL;
|
|
10
10
|
* - every request goes through `net/safeFetch`: the host must resolve to public addresses (or be
|
|
11
|
-
* exempt by `
|
|
11
|
+
* exempt by `net.allowPrivateHosts` / the npm registry origin) and the connection is
|
|
12
12
|
* pinned to the checked address;
|
|
13
13
|
* - redirects are not followed (a 3xx fails): one redirect could otherwise send the request (and the
|
|
14
14
|
* token) elsewhere;
|
|
@@ -22,7 +22,7 @@ export function marketplaceNetCode(e) {
|
|
|
22
22
|
export function marketplaceNetPolicy(config) {
|
|
23
23
|
return {
|
|
24
24
|
allowInsecureLoopback: config.marketplaces.allowInsecureLoopback,
|
|
25
|
-
allowPrivateHosts: config.
|
|
25
|
+
allowPrivateHosts: config.net.allowPrivateHosts,
|
|
26
26
|
trustedOrigins: [new URL(config.packages.npmRegistry).origin],
|
|
27
27
|
...(config.net.httpsProxy !== undefined && {
|
|
28
28
|
proxy: { url: config.net.httpsProxy, noProxy: config.net.noProxy },
|
|
@@ -33,6 +33,11 @@ export type MarketplaceForm = "http" | "git";
|
|
|
33
33
|
/** 一个清单来源(后台列表)。令牌不回显,只给 `hasToken`。 */
|
|
34
34
|
export interface MarketplaceView {
|
|
35
35
|
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* The label: the official marketplace's is "Capybara"; a config-managed one shows its
|
|
38
|
+
* marketplace.json `owner.name` (its config name before a refresh read one); a custom one, the
|
|
39
|
+
* name the admin gave it.
|
|
40
|
+
*/
|
|
36
41
|
name: string;
|
|
37
42
|
url: string;
|
|
38
43
|
form: MarketplaceForm;
|
|
@@ -203,7 +208,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
|
|
|
203
208
|
/** The host versions (an entry's `minKernel` is judged against them). */
|
|
204
209
|
export declare const HOST_VERSIONS: {
|
|
205
210
|
readonly kernel: string;
|
|
206
|
-
readonly sdk: "0.1.0-rc.
|
|
211
|
+
readonly sdk: "0.1.0-rc.65";
|
|
207
212
|
};
|
|
208
213
|
/** Whether this deployment satisfies the entry's `minKernel`. */
|
|
209
214
|
export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
|
|
@@ -35,8 +35,11 @@ import { withoutRemovedManifestFields } from "./plugin-package.js";
|
|
|
35
35
|
import { compareVersions, newestFirst, sameRelease } from "./versions.js";
|
|
36
36
|
/** 官方清单来源的 id。 */
|
|
37
37
|
export const OFFICIAL_MARKETPLACE_ID = "official";
|
|
38
|
-
/**
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* The official marketplace lists the upstream project's plugins, so it carries the project's name
|
|
40
|
+
* under any platform name.
|
|
41
|
+
*/
|
|
42
|
+
const OFFICIAL_MARKETPLACE_NAME = "Capybara";
|
|
40
43
|
/** 企业清单的可选令牌:secrets 的 namespace `kernel`、org `_deployment`、键 `catalog-token:<id>`(preflight #65)。 */
|
|
41
44
|
const SECRETS_NAMESPACE = "kernel";
|
|
42
45
|
const tokenKey = (id) => `catalog-token:${id}`;
|
|
@@ -1673,7 +1676,9 @@ let MarketplacesService = class MarketplacesService {
|
|
|
1673
1676
|
const count = new Map(counts.map((c) => [c.source_id, Number(c.n)]));
|
|
1674
1677
|
return rows.map((r) => ({
|
|
1675
1678
|
id: r.id,
|
|
1676
|
-
name
|
|
1679
|
+
// A config-managed row's name is the manifest's key (`config:<name>`, the token's env name):
|
|
1680
|
+
// it shows the owner its marketplace.json names once a refresh read it
|
|
1681
|
+
name: r.managed === "config" ? (r.owner_name ?? r.name) : r.name,
|
|
1677
1682
|
url: r.url,
|
|
1678
1683
|
form: r.form,
|
|
1679
1684
|
ref: r.ref,
|
|
@@ -94,6 +94,15 @@ export declare class OrgCatalogController {
|
|
|
94
94
|
* -> 404 `catalog.icon_not_found`; members do not see disabled items.
|
|
95
95
|
*/
|
|
96
96
|
icon(org: OrgContext, itemId: string, reply: FastifyReply): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* A platform connector template's own icon (svg or png, same response headers as the item icon,
|
|
99
|
+
* see {@link sendCatalogIcon}); the connector pages show it for the template's cards and the
|
|
100
|
+
* connectors made from it (`PluginIcons.ofTemplatesOrItems`), so guests, who read connectors,
|
|
101
|
+
* may load it. A template the org's catalog does not show (its plugin hidden from the org, or
|
|
102
|
+
* another org's template behind the share gate) -> 404 `component.not_found`; no icon of its own
|
|
103
|
+
* -> 404 `catalog.icon_not_found`.
|
|
104
|
+
*/
|
|
105
|
+
templateIcon(org: OrgContext, templateId: string, reply: FastifyReply): Promise<void>;
|
|
97
106
|
/**
|
|
98
107
|
* A setup guide of the item, rendered for this org (spec 2026-11-09-setup-guides-v2-design.md
|
|
99
108
|
* §7.2): the document's blocks with the place's variables filled in, its modes, audiences and
|
|
@@ -118,6 +118,17 @@ let OrgCatalogController = class OrgCatalogController {
|
|
|
118
118
|
const icon = await this.catalog.icon(itemId, roleAtLeast(org.role, "admin"), org.orgId);
|
|
119
119
|
await sendCatalogIcon(reply, icon);
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* A platform connector template's own icon (svg or png, same response headers as the item icon,
|
|
123
|
+
* see {@link sendCatalogIcon}); the connector pages show it for the template's cards and the
|
|
124
|
+
* connectors made from it (`PluginIcons.ofTemplatesOrItems`), so guests, who read connectors,
|
|
125
|
+
* may load it. A template the org's catalog does not show (its plugin hidden from the org, or
|
|
126
|
+
* another org's template behind the share gate) -> 404 `component.not_found`; no icon of its own
|
|
127
|
+
* -> 404 `catalog.icon_not_found`.
|
|
128
|
+
*/
|
|
129
|
+
async templateIcon(org, templateId, reply) {
|
|
130
|
+
await sendCatalogIcon(reply, await this.icons.readTemplateIcon(templateId, orgIconScope(org)));
|
|
131
|
+
}
|
|
121
132
|
/**
|
|
122
133
|
* A setup guide of the item, rendered for this org (spec 2026-11-09-setup-guides-v2-design.md
|
|
123
134
|
* §7.2): the document's blocks with the place's variables filled in, its modes, audiences and
|
|
@@ -248,6 +259,13 @@ __decorate([
|
|
|
248
259
|
__param(1, Param("itemId")),
|
|
249
260
|
__param(2, Res())
|
|
250
261
|
], OrgCatalogController.prototype, "icon", null);
|
|
262
|
+
__decorate([
|
|
263
|
+
Get("connector-templates/:templateId/icon"),
|
|
264
|
+
OrgAction("connectors.use"),
|
|
265
|
+
__param(0, CurrentOrg()),
|
|
266
|
+
__param(1, Param("templateId")),
|
|
267
|
+
__param(2, Res())
|
|
268
|
+
], OrgCatalogController.prototype, "templateIcon", null);
|
|
251
269
|
__decorate([
|
|
252
270
|
Get("catalog/:itemId/guides/:guideId"),
|
|
253
271
|
OrgAction("catalog.read"),
|
|
@@ -43,8 +43,8 @@ export declare const CatalogConnectorInput: z.ZodObject<{
|
|
|
43
43
|
}, z.core.$strict>>;
|
|
44
44
|
}, z.core.$strict>;
|
|
45
45
|
/**
|
|
46
|
-
* The org install body: template input
|
|
47
|
-
*
|
|
46
|
+
* The org install body: template input. No version: an org installs the platform version (one per
|
|
47
|
+
* deployment, ruling P2-17).
|
|
48
48
|
*/
|
|
49
49
|
export declare const OrgPluginInstallBody: z.ZodObject<{
|
|
50
50
|
connectors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -57,7 +57,6 @@ export declare const OrgPluginInstallBody: z.ZodObject<{
|
|
|
57
57
|
clientSecret: z.ZodOptional<z.ZodString>;
|
|
58
58
|
}, z.core.$strict>>;
|
|
59
59
|
}, z.core.$strict>>>;
|
|
60
|
-
extensionConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
61
60
|
}, z.core.$strict>;
|
|
62
61
|
/**
|
|
63
62
|
* `POST …/catalog/:itemId/connectors` (ruling P2-10): the input of missing connectors, by template
|
|
@@ -111,7 +110,6 @@ export declare const OrgPluginSwitchBody: z.ZodObject<{
|
|
|
111
110
|
clientSecret: z.ZodOptional<z.ZodString>;
|
|
112
111
|
}, z.core.$strict>>;
|
|
113
112
|
}, z.core.$strict>>>;
|
|
114
|
-
extensionConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
115
113
|
}, z.core.$strict>>;
|
|
116
114
|
confirm: z.ZodOptional<z.ZodString>;
|
|
117
115
|
}, z.core.$strict>;
|
|
@@ -70,13 +70,12 @@ export const CatalogConnectorInput = z
|
|
|
70
70
|
})
|
|
71
71
|
.strict();
|
|
72
72
|
/**
|
|
73
|
-
* The org install body: template input
|
|
74
|
-
*
|
|
73
|
+
* The org install body: template input. No version: an org installs the platform version (one per
|
|
74
|
+
* deployment, ruling P2-17).
|
|
75
75
|
*/
|
|
76
76
|
export const OrgPluginInstallBody = z
|
|
77
77
|
.object({
|
|
78
78
|
connectors: z.record(z.string(), CatalogConnectorInput).optional(),
|
|
79
|
-
extensionConfig: z.record(z.string(), z.unknown()).optional(),
|
|
80
79
|
})
|
|
81
80
|
.strict();
|
|
82
81
|
/**
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EffectiveConfigs } from "../extensions/effective-config.js";
|
|
2
|
+
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
1
3
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
2
4
|
import { ExtensionAvailability } from "../extensions/unavailable.js";
|
|
3
5
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
@@ -38,11 +40,16 @@ export declare class OrgCatalogService {
|
|
|
38
40
|
readonly txHost: TransactionHost;
|
|
39
41
|
/** Why a plugin's extension cannot run (the `unavailable` state's reason). */
|
|
40
42
|
private readonly availability;
|
|
43
|
+
/** The effective config of an extension for the org: a wanted plugin whose config is not valid needs input. */
|
|
44
|
+
private readonly effective;
|
|
45
|
+
private readonly icons;
|
|
41
46
|
constructor(kdb: KernelDb,
|
|
42
47
|
/** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
|
|
43
48
|
orgLock: OrgLock, storage: StorageService, registry: ExtensionRegistry, pluginInstaller: PluginInstaller, log: KernelLogger, txHost: TransactionHost,
|
|
44
49
|
/** Why a plugin's extension cannot run (the `unavailable` state's reason). */
|
|
45
|
-
availability: ExtensionAvailability
|
|
50
|
+
availability: ExtensionAvailability,
|
|
51
|
+
/** The effective config of an extension for the org: a wanted plugin whose config is not valid needs input. */
|
|
52
|
+
effective: Pick<EffectiveConfigs, "get">, icons: PluginIcons);
|
|
46
53
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
47
54
|
private get db();
|
|
48
55
|
/**
|
|
@@ -57,6 +64,8 @@ export declare class OrgCatalogService {
|
|
|
57
64
|
* connector templates (endpoint preset, editable paths, auth preset), dependencies, skills and
|
|
58
65
|
* agent templates.
|
|
59
66
|
*/
|
|
67
|
+
/** The account is an admin (or owner) of the org. */
|
|
68
|
+
private isOrgAdmin;
|
|
60
69
|
detail(orgId: string, accountId: string, itemId: string): Promise<OrgCatalogDetail>;
|
|
61
70
|
/**
|
|
62
71
|
* The item's icon; members don't see disabled items, nobody outside its list sees a hidden
|
|
@@ -9,7 +9,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { ApiError } from "../errors.js";
|
|
12
|
+
import { EffectiveConfigs } from "../extensions/effective-config.js";
|
|
12
13
|
import { templateGuideOf } from "../extensions/plugin-guides.js";
|
|
14
|
+
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
13
15
|
import { ExtensionRegistry } from "../extensions/registry.js";
|
|
14
16
|
import { ExtensionAvailability } from "../extensions/unavailable.js";
|
|
15
17
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
@@ -51,11 +53,15 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
51
53
|
log;
|
|
52
54
|
txHost;
|
|
53
55
|
availability;
|
|
56
|
+
effective;
|
|
57
|
+
icons;
|
|
54
58
|
constructor(kdb,
|
|
55
59
|
/** The org row lock (orgs/org-lock.ts): joins the caller's transaction. */
|
|
56
60
|
orgLock, storage, registry, pluginInstaller, log, txHost,
|
|
57
61
|
/** Why a plugin's extension cannot run (the `unavailable` state's reason). */
|
|
58
|
-
availability
|
|
62
|
+
availability,
|
|
63
|
+
/** The effective config of an extension for the org: a wanted plugin whose config is not valid needs input. */
|
|
64
|
+
effective, icons) {
|
|
59
65
|
this.kdb = kdb;
|
|
60
66
|
this.orgLock = orgLock;
|
|
61
67
|
this.storage = storage;
|
|
@@ -64,6 +70,8 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
64
70
|
this.log = log;
|
|
65
71
|
this.txHost = txHost;
|
|
66
72
|
this.availability = availability;
|
|
73
|
+
this.effective = effective;
|
|
74
|
+
this.icons = icons;
|
|
67
75
|
}
|
|
68
76
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
69
77
|
get db() {
|
|
@@ -75,13 +83,7 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
75
83
|
* and absent for members. Each item carries the org's pending request for it.
|
|
76
84
|
*/
|
|
77
85
|
async list(orgId, accountId, itemId) {
|
|
78
|
-
const
|
|
79
|
-
.selectFrom("memberships")
|
|
80
|
-
.select("role")
|
|
81
|
-
.where("org_id", "=", orgId)
|
|
82
|
-
.where("account_id", "=", accountId)
|
|
83
|
-
.executeTakeFirst();
|
|
84
|
-
const isAdmin = m !== undefined && roleAtLeast(m.role, "admin");
|
|
86
|
+
const isAdmin = await this.isOrgAdmin(orgId, accountId);
|
|
85
87
|
let q = this.db
|
|
86
88
|
.selectFrom("catalog_items")
|
|
87
89
|
.selectAll()
|
|
@@ -116,7 +118,7 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
116
118
|
return [];
|
|
117
119
|
const sw = new Map(switches.map((r) => [r.item_id, r.enabled]));
|
|
118
120
|
const ids = items.map((i) => i.id);
|
|
119
|
-
const [versions, pluginInstalls,
|
|
121
|
+
const [versions, pluginInstalls, requests] = await Promise.all([
|
|
120
122
|
this.db
|
|
121
123
|
.selectFrom("catalog_item_versions")
|
|
122
124
|
.select([
|
|
@@ -138,12 +140,6 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
138
140
|
.where("org_id", "=", orgId)
|
|
139
141
|
.where("status", "in", [...LIVE_INSTALL_STATUSES])
|
|
140
142
|
.execute(),
|
|
141
|
-
this.db
|
|
142
|
-
.selectFrom("extension_org_configs")
|
|
143
|
-
.select("plugin")
|
|
144
|
-
.where("org_id", "=", orgId)
|
|
145
|
-
.where("config", "is not", null)
|
|
146
|
-
.execute(),
|
|
147
143
|
this.db
|
|
148
144
|
.selectFrom("catalog_requests")
|
|
149
145
|
.select(["id", "item_id", "kind", "created_at"])
|
|
@@ -162,7 +158,6 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
162
158
|
const v = versions.find((x) => x.item_id === i.id && x.version === i.latest_version);
|
|
163
159
|
return v ? [v] : [];
|
|
164
160
|
}));
|
|
165
|
-
const configured = new Set(configs.map((c) => c.plugin));
|
|
166
161
|
const owners = await ownersOf(this.db, items.flatMap((i) => (i.owner_org_id === null ? [] : [i.owner_org_id])));
|
|
167
162
|
const loaded = new Map(this.registry.manifests().map((x) => [x.name, x]));
|
|
168
163
|
// the extensions of the latest versions that are not loaded: why (the `unavailable` reason)
|
|
@@ -222,9 +217,8 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
222
217
|
const templateIds = (m?.connectorTemplates ?? []).map((t) => templateIdOfPath(t.path));
|
|
223
218
|
const needsInputs = (await connectorTemplatesOn(this.db, orgId, i.id, templateIds)).size > 0 ||
|
|
224
219
|
(m?.extension !== undefined &&
|
|
225
|
-
ext
|
|
226
|
-
!
|
|
227
|
-
!configured.has(m.name));
|
|
220
|
+
ext !== undefined &&
|
|
221
|
+
!(await this.effective.get(orgId, m.name)).ok);
|
|
228
222
|
// Wanted but not installed and needing nothing: the sync has not installed it (yet, or its
|
|
229
223
|
// install failed); `off`, so an org admin can switch it on (the worker start retries it)
|
|
230
224
|
state = needsInputs ? "needs_config" : "off";
|
|
@@ -258,6 +252,16 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
258
252
|
* connector templates (endpoint preset, editable paths, auth preset), dependencies, skills and
|
|
259
253
|
* agent templates.
|
|
260
254
|
*/
|
|
255
|
+
/** The account is an admin (or owner) of the org. */
|
|
256
|
+
async isOrgAdmin(orgId, accountId) {
|
|
257
|
+
const m = await this.db
|
|
258
|
+
.selectFrom("memberships")
|
|
259
|
+
.select("role")
|
|
260
|
+
.where("org_id", "=", orgId)
|
|
261
|
+
.where("account_id", "=", accountId)
|
|
262
|
+
.executeTakeFirst();
|
|
263
|
+
return m !== undefined && roleAtLeast(m.role, "admin");
|
|
264
|
+
}
|
|
261
265
|
async detail(orgId, accountId, itemId) {
|
|
262
266
|
if (!UUID_RE.test(itemId))
|
|
263
267
|
throw itemNotFound();
|
|
@@ -293,6 +297,12 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
293
297
|
return [];
|
|
294
298
|
throw e;
|
|
295
299
|
});
|
|
300
|
+
const missing = item.installed !== null && item.state === "needs_config"
|
|
301
|
+
? ((await this.pluginInstaller.missingConnectors(orgId, itemId))?.templates ?? [])
|
|
302
|
+
: [];
|
|
303
|
+
// Each template's icon on the org's routes (its own, else the plugin's)
|
|
304
|
+
const icons = await this.icons.ofItemTemplates(itemId, [...templates, ...missing].map((t) => t.id), { kind: "org", orgId, isAdmin: await this.isOrgAdmin(orgId, accountId) });
|
|
305
|
+
const iconOf = (templateId) => icons.get(templateId) ?? null;
|
|
296
306
|
return {
|
|
297
307
|
item,
|
|
298
308
|
hasIcon: m.icon !== undefined,
|
|
@@ -301,6 +311,7 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
301
311
|
guide: guideOf(t.id),
|
|
302
312
|
on: on.has(t.id),
|
|
303
313
|
connected: connected.has(t.id),
|
|
314
|
+
icon: iconOf(t.id),
|
|
304
315
|
})),
|
|
305
316
|
dependencies: [
|
|
306
317
|
...(m.dependencies ?? []).map((d) => ({ name: d.name, range: d.version })),
|
|
@@ -308,9 +319,7 @@ let OrgCatalogService = class OrgCatalogService {
|
|
|
308
319
|
],
|
|
309
320
|
skills: (m.skills ?? []).map((s) => packagePath(s.path)),
|
|
310
321
|
agents: (m.agents ?? []).map((a) => packagePath(a.path)),
|
|
311
|
-
missingTemplates:
|
|
312
|
-
? ((await this.pluginInstaller.missingConnectors(orgId, itemId))?.templates ?? []).map((t) => orgTemplateView(t.id, t.file, { guide: guideOf(t.id), on: true }))
|
|
313
|
-
: [],
|
|
322
|
+
missingTemplates: missing.map((t) => orgTemplateView(t.id, t.file, { guide: guideOf(t.id), on: true, icon: iconOf(t.id) })),
|
|
314
323
|
};
|
|
315
324
|
}
|
|
316
325
|
/**
|
|
@@ -603,6 +612,8 @@ OrgCatalogService = __decorate([
|
|
|
603
612
|
__param(4, Inject(PluginInstaller)),
|
|
604
613
|
__param(5, Inject(KERNEL_LOGGER)),
|
|
605
614
|
__param(6, Inject(TransactionHost)),
|
|
606
|
-
__param(7, Inject(ExtensionAvailability))
|
|
615
|
+
__param(7, Inject(ExtensionAvailability)),
|
|
616
|
+
__param(8, Inject(EffectiveConfigs)),
|
|
617
|
+
__param(9, Inject(PluginIcons))
|
|
607
618
|
], OrgCatalogService);
|
|
608
619
|
export { OrgCatalogService };
|
|
@@ -15,15 +15,9 @@ export type OrgExtensionPutResult = {
|
|
|
15
15
|
* `PUT orgs/:orgId/extensions/:extension`: for an extension that ships in a catalog plugin, `enabled`
|
|
16
16
|
* is the plugin's org switch ({@link OrgCatalogService.setSwitch}); anything else is the direct
|
|
17
17
|
* {@link OrgExtensionConfigs.put}. Lives in the catalog module because the catalog depends on the
|
|
18
|
-
* extensions, not the other way round. No in-process state.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* before the plugin switches with the plain 400 `extension.config_invalid`. Switching on validates
|
|
22
|
-
* the effective config (the stored one with its secrets, or the given `config` merged with them),
|
|
23
|
-
* and the install receives the given `config` as its `extensionConfig`, so the extension is enabled
|
|
24
|
-
* with it. A config write that fails for another reason after the switch succeeded returns that
|
|
25
|
-
* error in the same transaction as the switch, so the switch stays as it was (a fresh install is the
|
|
26
|
-
* exception: it commits on its own and carries the config itself).
|
|
18
|
+
* extensions, not the other way round. No in-process state. Switching never checks a config: an
|
|
19
|
+
* extension whose effective config is not valid in the org is switched on and reported
|
|
20
|
+
* `needsConfig` (spec A §6).
|
|
27
21
|
*/
|
|
28
22
|
export declare class OrgExtensionSwitch {
|
|
29
23
|
readonly txHost: TransactionHost;
|
|
@@ -36,7 +30,6 @@ export declare class OrgExtensionSwitch {
|
|
|
36
30
|
* source items) -> 409 `plugin.scope_locked` (an `all` one may go off, layering spec §4).
|
|
37
31
|
* - A required bootstrap plugin, a config-declared extension and one sourced from several items
|
|
38
32
|
* keep the direct write.
|
|
39
|
-
* - `config` is always written directly, after the switch.
|
|
40
33
|
*/
|
|
41
34
|
put(orgId: string, actor: string, extension: string, body: OrgExtensionInput & {
|
|
42
35
|
confirm?: string | undefined;
|