@capybara-hq/kernel 0.1.0-rc.6 → 0.1.0-rc.8
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 +27 -3
- package/dist/admin/admin.controller.d.ts +8 -72
- package/dist/admin/admin.controller.js +21 -46
- package/dist/admin/admin.schemas.d.ts +57 -0
- package/dist/admin/admin.schemas.js +50 -0
- package/dist/admin/extensions.controller.d.ts +10 -0
- package/dist/admin/extensions.controller.js +18 -0
- package/dist/admin/extensions.schemas.d.ts +7 -0
- package/dist/admin/extensions.schemas.js +10 -0
- package/dist/admin/limit-defaults.d.ts +20 -0
- package/dist/admin/limit-defaults.js +10 -0
- package/dist/agents/agent-profile.service.d.ts +7 -5
- package/dist/agents/agent-profile.service.js +14 -9
- package/dist/agents/agents.controller.d.ts +7 -287
- package/dist/agents/agents.controller.js +7 -67
- package/dist/agents/agents.schemas.d.ts +389 -0
- package/dist/agents/agents.schemas.js +126 -0
- package/dist/agents/agents.service.d.ts +13 -5
- package/dist/agents/agents.service.js +67 -13
- package/dist/agents/definition.d.ts +47 -19
- package/dist/agents/definition.js +119 -38
- package/dist/agents/from-template.d.ts +2 -2
- package/dist/agents/from-template.js +76 -45
- package/dist/agents/from-template.service.d.ts +12 -0
- package/dist/agents/from-template.service.js +20 -3
- package/dist/agents/models.controller.d.ts +1 -2
- package/dist/agents/models.controller.js +1 -1
- package/dist/agents/org-templates.d.ts +13 -3
- package/dist/agents/org-templates.js +69 -28
- package/dist/agents/pending-connector-requests.d.ts +2 -0
- package/dist/agents/pending-connector-requests.js +1 -1
- package/dist/agents/pending-connectors.controller.d.ts +1 -1
- package/dist/agents/pending-connectors.controller.js +2 -2
- package/dist/agents/pending-connectors.service.d.ts +2 -2
- package/dist/agents/pending-connectors.service.js +19 -19
- package/dist/agents/profile.d.ts +18 -0
- package/dist/agents/profile.js +5 -1
- package/dist/agents/templates.controller.d.ts +8 -17
- package/dist/agents/templates.controller.js +13 -31
- package/dist/agents/templates.schemas.d.ts +20 -0
- package/dist/agents/templates.schemas.js +45 -0
- package/dist/background/background.controller.js +3 -2
- package/dist/background/background.schemas.d.ts +10 -0
- package/dist/background/background.schemas.js +16 -0
- package/dist/background/tasks.service.d.ts +1 -1
- package/dist/background/tasks.service.js +7 -2
- package/dist/catalog/admin-catalog.controller.d.ts +4 -57
- package/dist/catalog/admin-catalog.controller.js +8 -45
- package/dist/catalog/admin-catalog.schemas.d.ts +72 -0
- package/dist/catalog/admin-catalog.schemas.js +92 -0
- package/dist/catalog/catalog-content.d.ts +12 -2
- package/dist/catalog/catalog-scope.service.js +8 -2
- package/dist/catalog/catalog.service.d.ts +2 -0
- package/dist/catalog/catalog.service.js +3 -0
- package/dist/catalog/component-scope.controller.d.ts +3 -65
- package/dist/catalog/component-scope.controller.js +3 -56
- package/dist/catalog/component-scope.schemas.d.ts +114 -0
- package/dist/catalog/component-scope.schemas.js +97 -0
- package/dist/catalog/component-scope.service.d.ts +28 -4
- package/dist/catalog/component-scope.service.js +55 -3
- package/dist/catalog/component-state.d.ts +9 -2
- package/dist/catalog/component-state.js +22 -13
- package/dist/catalog/marketplaces.controller.d.ts +5 -35
- package/dist/catalog/marketplaces.controller.js +6 -34
- package/dist/catalog/marketplaces.schemas.d.ts +48 -0
- package/dist/catalog/marketplaces.schemas.js +53 -0
- package/dist/catalog/marketplaces.service.d.ts +15 -1
- package/dist/catalog/marketplaces.service.js +22 -1
- package/dist/catalog/org-catalog.controller.d.ts +6 -62
- package/dist/catalog/org-catalog.controller.js +12 -66
- package/dist/catalog/org-catalog.schemas.d.ts +79 -0
- package/dist/catalog/org-catalog.schemas.js +82 -0
- package/dist/catalog/org-catalog.service.d.ts +9 -2
- package/dist/catalog/org-catalog.service.js +38 -5
- package/dist/catalog/org-extension.controller.d.ts +1 -12
- package/dist/catalog/org-extension.controller.js +1 -10
- package/dist/catalog/org-extension.schemas.d.ts +15 -0
- package/dist/catalog/org-extension.schemas.js +22 -0
- package/dist/catalog/org-plugin-uploads.controller.d.ts +2 -19
- package/dist/catalog/org-plugin-uploads.controller.js +15 -28
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +20 -0
- package/dist/catalog/org-plugin-uploads.schemas.js +32 -0
- package/dist/catalog/owned-items.d.ts +6 -2
- package/dist/catalog/owned-items.js +16 -4
- package/dist/catalog/platform-components.d.ts +2 -0
- package/dist/catalog/platform-components.js +2 -0
- package/dist/catalog/plugin-import.js +1 -0
- package/dist/catalog/plugin-install.js +1 -1
- package/dist/catalog/requests.service.d.ts +2 -1
- package/dist/catalog/requests.service.js +6 -2
- package/dist/channels/channels.schemas.d.ts +33 -0
- package/dist/channels/channels.schemas.js +34 -0
- package/dist/channels/connections.controller.d.ts +2 -29
- package/dist/channels/connections.controller.js +1 -23
- package/dist/channels/connections.service.d.ts +8 -2
- package/dist/channels/connections.service.js +23 -5
- package/dist/channels/inbound.js +4 -0
- package/dist/conversations/conversations.controller.d.ts +16 -37
- package/dist/conversations/conversations.controller.js +16 -56
- package/dist/conversations/conversations.schemas.d.ts +52 -0
- package/dist/conversations/conversations.schemas.js +79 -0
- package/dist/conversations/conversations.service.d.ts +9 -1
- package/dist/conversations/conversations.service.js +23 -18
- package/dist/conversations/events.d.ts +80 -6
- package/dist/conversations/events.js +60 -5
- package/dist/conversations/message-context.d.ts +28 -0
- package/dist/conversations/message-context.js +56 -0
- package/dist/conversations/queue.d.ts +2 -1
- package/dist/conversations/queue.js +11 -2
- package/dist/db/kernel-schema.d.ts +20 -0
- package/dist/environments/environments.schemas.d.ts +3 -0
- package/dist/environments/environments.schemas.js +14 -0
- package/dist/environments/environments.service.d.ts +16 -4
- package/dist/environments/environments.service.js +58 -13
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +3 -0
- package/dist/evals/evals.schemas.d.ts +110 -0
- package/dist/evals/evals.schemas.js +107 -0
- package/dist/evals/reconstruct.js +18 -11
- package/dist/evals/recorded-tools.d.ts +2 -1
- package/dist/evals/recorded-tools.js +11 -3
- package/dist/evals/run-replay.d.ts +8 -1
- package/dist/evals/run-replay.js +13 -0
- package/dist/evals/runs.controller.d.ts +2 -57
- package/dist/evals/runs.controller.js +1 -42
- package/dist/evals/runs.service.d.ts +6 -6
- package/dist/evals/runs.service.js +32 -18
- package/dist/evals/sets.controller.d.ts +2 -28
- package/dist/evals/sets.controller.js +1 -31
- package/dist/evals/sets.service.d.ts +7 -7
- package/dist/evals/sets.service.js +23 -17
- package/dist/evals/snapshot.d.ts +3 -2
- package/dist/evals/snapshot.js +17 -4
- package/dist/extensions/admin-ops.d.ts +5 -3
- package/dist/extensions/admin-ops.js +17 -12
- package/dist/extensions/deployment-config.d.ts +16 -1
- package/dist/extensions/deployment-config.js +83 -0
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +33 -2
- package/dist/extensions/host.js +107 -1
- package/dist/extensions/installs.d.ts +5 -0
- package/dist/extensions/installs.js +12 -0
- package/dist/extensions/org-config.d.ts +17 -2
- package/dist/extensions/org-config.js +23 -4
- package/dist/extensions/point-defaults.controller.d.ts +2 -8
- package/dist/extensions/point-defaults.controller.js +1 -3
- package/dist/extensions/point-defaults.d.ts +3 -1
- package/dist/extensions/point-defaults.js +4 -2
- package/dist/extensions/point-defaults.schemas.d.ts +9 -0
- package/dist/extensions/point-defaults.schemas.js +14 -0
- package/dist/extensions/unavailable.d.ts +49 -0
- package/dist/extensions/unavailable.js +113 -0
- package/dist/files/previewers.controller.js +2 -3
- package/dist/files/previewers.d.ts +1 -1
- package/dist/files/previewers.js +4 -4
- package/dist/files/previewers.schemas.d.ts +10 -0
- package/dist/files/previewers.schemas.js +9 -0
- package/dist/http/api.module.js +2 -0
- package/dist/identity/accounts.d.ts +43 -4
- package/dist/identity/accounts.js +74 -6
- package/dist/identity/auth.guard.js +10 -1
- package/dist/identity/cookies.d.ts +6 -0
- package/dist/identity/cookies.js +14 -0
- package/dist/identity/identity.module.js +3 -0
- package/dist/identity/initial-passwords.controller.d.ts +22 -0
- package/dist/identity/initial-passwords.controller.js +49 -0
- package/dist/identity/initial-passwords.d.ts +61 -0
- package/dist/identity/initial-passwords.job.d.ts +16 -0
- package/dist/identity/initial-passwords.job.js +46 -0
- package/dist/identity/initial-passwords.js +159 -0
- package/dist/identity/me.controller.d.ts +12 -0
- package/dist/identity/me.controller.js +31 -1
- package/dist/identity/me.schemas.d.ts +14 -0
- package/dist/identity/me.schemas.js +17 -0
- package/dist/identity/principal.d.ts +8 -0
- package/dist/identity/principal.js +8 -0
- package/dist/identity/settings.d.ts +3 -1
- package/dist/identity/settings.js +6 -4
- package/dist/inbox/inbox.schemas.d.ts +8 -0
- package/dist/inbox/inbox.schemas.js +11 -0
- package/dist/inbox/platform-inbox.controller.d.ts +1 -1
- package/dist/inbox/platform-inbox.controller.js +2 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/lifecycle/kernel-lifecycle.js +4 -0
- package/dist/models/enablement.d.ts +2 -0
- package/dist/models/enablement.js +1 -0
- package/dist/models/org-models.schemas.d.ts +8 -0
- package/dist/models/org-models.schemas.js +22 -0
- package/dist/models/prices.d.ts +3 -1
- package/dist/models/prices.js +7 -5
- package/dist/models/purposes.d.ts +12 -2
- package/dist/models/purposes.js +22 -8
- package/dist/orgs/orgs.controller.d.ts +2 -5
- package/dist/orgs/orgs.controller.js +3 -6
- package/dist/orgs/orgs.schemas.d.ts +8 -0
- package/dist/orgs/orgs.schemas.js +16 -0
- package/dist/orgs/orgs.service.d.ts +3 -1
- package/dist/orgs/orgs.service.js +6 -4
- package/dist/orgs/settings.service.d.ts +9 -1
- package/dist/orgs/settings.service.js +20 -5
- package/dist/overrides.d.ts +4 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/errors.d.ts +21 -4
- package/dist/platform/errors.js +45 -6
- package/dist/platform/exclusions.d.ts +2 -3
- package/dist/platform/exclusions.js +58 -849
- package/dist/platform/method.js +1 -1
- package/dist/platform/operation.d.ts +82 -5
- package/dist/platform/operation.js +63 -8
- package/dist/platform/ops/accounts.ops.d.ts +32 -0
- package/dist/platform/ops/accounts.ops.js +291 -0
- package/dist/platform/ops/admin.ops.d.ts +36 -0
- package/dist/platform/ops/admin.ops.js +389 -0
- package/dist/platform/ops/agent-skills.ops.d.ts +24 -0
- package/dist/platform/ops/agent-skills.ops.js +226 -0
- package/dist/platform/ops/agent-templates.ops.d.ts +4 -1
- package/dist/platform/ops/agent-templates.ops.js +194 -14
- package/dist/platform/ops/agents.ops.d.ts +19 -1
- package/dist/platform/ops/agents.ops.js +481 -58
- package/dist/platform/ops/approvals.ops.d.ts +30 -0
- package/dist/platform/ops/approvals.ops.js +116 -0
- package/dist/platform/ops/background.ops.d.ts +14 -0
- package/dist/platform/ops/background.ops.js +134 -0
- package/dist/platform/ops/catalog-admin.ops.d.ts +74 -0
- package/dist/platform/ops/catalog-admin.ops.js +587 -0
- package/dist/platform/ops/channels.ops.d.ts +16 -0
- package/dist/platform/ops/channels.ops.js +195 -0
- package/dist/platform/ops/components.ops.d.ts +46 -0
- package/dist/platform/ops/components.ops.js +853 -0
- package/dist/platform/ops/connectors.ops.d.ts +4 -2
- package/dist/platform/ops/connectors.ops.js +68 -6
- package/dist/platform/ops/conversations.ops.d.ts +30 -0
- package/dist/platform/ops/conversations.ops.js +470 -0
- package/dist/platform/ops/environments.ops.d.ts +26 -0
- package/dist/platform/ops/environments.ops.js +289 -0
- package/dist/platform/ops/errors.d.ts +10 -5
- package/dist/platform/ops/errors.js +19 -11
- package/dist/platform/ops/evals.ops.d.ts +28 -0
- package/dist/platform/ops/evals.ops.js +783 -0
- package/dist/platform/ops/extensions-admin.ops.d.ts +25 -0
- package/dist/platform/ops/extensions-admin.ops.js +344 -0
- package/dist/platform/ops/extensions.ops.d.ts +7 -1
- package/dist/platform/ops/extensions.ops.js +248 -17
- package/dist/platform/ops/inbox.ops.d.ts +25 -0
- package/dist/platform/ops/inbox.ops.js +378 -0
- package/dist/platform/ops/marketplaces.ops.d.ts +7 -1
- package/dist/platform/ops/marketplaces.ops.js +326 -17
- package/dist/platform/ops/models.ops.d.ts +25 -0
- package/dist/platform/ops/models.ops.js +232 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +29 -0
- package/dist/platform/ops/org-plugins.ops.js +329 -0
- package/dist/platform/ops/org-settings.ops.d.ts +16 -0
- package/dist/platform/ops/org-settings.ops.js +102 -0
- package/dist/platform/ops/orgs.ops.d.ts +28 -0
- package/dist/platform/ops/orgs.ops.js +295 -0
- package/dist/platform/ops/other-orgs.d.ts +20 -0
- package/dist/platform/ops/other-orgs.js +72 -0
- package/dist/platform/ops/platform.ops.d.ts +11 -6
- package/dist/platform/ops/platform.ops.js +73 -27
- package/dist/platform/ops/plugins.ops.d.ts +10 -8
- package/dist/platform/ops/plugins.ops.js +176 -77
- package/dist/platform/ops/previewers.ops.d.ts +14 -0
- package/dist/platform/ops/previewers.ops.js +109 -0
- package/dist/platform/ops/requests.ops.js +57 -19
- package/dist/platform/ops/skills.ops.d.ts +5 -1
- package/dist/platform/ops/skills.ops.js +129 -11
- package/dist/platform/ops/unavailable.d.ts +23 -0
- package/dist/platform/ops/unavailable.js +111 -0
- package/dist/platform/parity.d.ts +33 -0
- package/dist/platform/parity.js +272 -0
- package/dist/platform/platform-ops.module.d.ts +32 -0
- package/dist/platform/platform-ops.module.js +78 -11
- package/dist/platform/route-schemas.d.ts +18 -0
- package/dist/platform/route-schemas.js +63 -0
- package/dist/roles/worker.module.js +2 -0
- package/dist/runtime/context/build.d.ts +2 -0
- package/dist/runtime/context/build.js +28 -2
- package/dist/runtime/context/compaction.js +10 -1
- package/dist/runtime/context/run-context.d.ts +65 -0
- package/dist/runtime/context/run-context.js +215 -0
- package/dist/runtime/model-call.js +2 -1
- package/dist/runtime/providers.js +8 -1
- package/dist/runtime/run-context.service.d.ts +65 -0
- package/dist/runtime/run-context.service.js +220 -0
- package/dist/runtime/run-worker.d.ts +5 -0
- package/dist/runtime/run-worker.js +31 -6
- package/dist/runtime/runtime.module.js +2 -0
- package/dist/runtime/subagents/definition.d.ts +15 -15
- package/dist/runtime/subagents/definition.js +46 -115
- package/dist/skills/changes.controller.js +2 -1
- package/dist/skills/changes.service.d.ts +1 -1
- package/dist/skills/changes.service.js +4 -4
- package/dist/skills/invocable.controller.d.ts +1 -1
- package/dist/skills/invocable.controller.js +2 -2
- package/dist/skills/invoke.d.ts +2 -2
- package/dist/skills/invoke.js +8 -1
- package/dist/skills/skills.controller.d.ts +4 -13
- package/dist/skills/skills.controller.js +8 -24
- package/dist/skills/skills.schemas.d.ts +48 -0
- package/dist/skills/skills.schemas.js +61 -0
- package/dist/skills/skills.service.d.ts +11 -1
- package/dist/skills/skills.service.js +37 -14
- package/dist/time-zone.d.ts +5 -0
- package/dist/time-zone.js +19 -0
- package/dist/tools/approvals.controller.js +2 -3
- package/dist/tools/approvals.schemas.d.ts +21 -0
- package/dist/tools/approvals.schemas.js +15 -0
- package/dist/tools/builtin-names.d.ts +10 -8
- package/dist/tools/builtin-names.js +16 -11
- package/dist/tools/builtins/builtin-tools.d.ts +3 -1
- package/dist/tools/builtins/builtin-tools.js +15 -3
- package/dist/tools/builtins/current-time.d.ts +26 -0
- package/dist/tools/builtins/current-time.js +99 -0
- package/dist/tools/builtins/platform.d.ts +19 -2
- package/dist/tools/builtins/platform.js +105 -16
- package/dist/tools/connectors.controller.d.ts +1 -2
- package/dist/tools/connectors.controller.js +1 -4
- package/dist/tools/connectors.schemas.d.ts +12 -0
- package/dist/tools/connectors.schemas.js +19 -0
- package/dist/tools/connectors.service.d.ts +5 -2
- package/dist/tools/connectors.service.js +7 -5
- package/dist/tools/org-tool-switches.d.ts +16 -2
- package/dist/tools/org-tool-switches.js +26 -9
- package/dist/tools/pipeline.js +3 -1
- package/dist/tools/registry.d.ts +48 -51
- package/dist/tools/registry.js +222 -233
- package/package.json +3 -3
- package/src/migrations/0090_initial_passwords.sql +27 -0
- package/src/migrations/0091_account_time_zone.sql +4 -0
- package/src/migrations/0092_tools_default_on.sql +27 -0
- package/dist/platform/redact-orgs.d.ts +0 -7
- package/dist/platform/redact-orgs.js +0 -52
|
@@ -0,0 +1,853 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { ToolError } from "@capybara-hq/plugin-sdk";
|
|
11
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
import { ComponentDisabledSchema, ComponentParams, ComponentScopeFields, ComponentScopePreviewFields, ComponentShownSchema, ComponentTemplateVersionSchema, componentScopeRules, } from "../../catalog/component-scope.schemas.js";
|
|
14
|
+
import { ComponentScopeService, } from "../../catalog/component-scope.service.js";
|
|
15
|
+
import { PlatformComponents } from "../../catalog/platform-components.js";
|
|
16
|
+
import { ApiError } from "../../errors.js";
|
|
17
|
+
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
18
|
+
import { defineOperation } from "../operation.js";
|
|
19
|
+
import { PlatformOperations } from "../registry.js";
|
|
20
|
+
import { precheckBy, viaAgent } from "./errors.js";
|
|
21
|
+
import { Cursor, pageOf, startOf } from "./paging.js";
|
|
22
|
+
import { named, orElse } from "./summary.js";
|
|
23
|
+
/** Entries per page of the paged lists (the tool caps a bare list at 50). */
|
|
24
|
+
const PAGE = 50;
|
|
25
|
+
/** The confirm value of switching off a component that is not on in the org. */
|
|
26
|
+
const ALREADY_OFF = "already-off";
|
|
27
|
+
const EXAMPLE_ID = "3f1c2a9e-5b7d-4e21-9c0a-1d2e3f4a5b6c";
|
|
28
|
+
const Id = ComponentParams.shape.id;
|
|
29
|
+
const Confirm = z.string().min(1).max(64);
|
|
30
|
+
/** What each kind is called in card summaries, and the message of each switch refusal. */
|
|
31
|
+
const LABEL = {
|
|
32
|
+
skill: { en: "platform skill", zh: "平台技能" },
|
|
33
|
+
agent_template: { en: "platform agent template", zh: "平台智能体模板" },
|
|
34
|
+
connector_template: { en: "platform connector template", zh: "平台连接器模板" },
|
|
35
|
+
};
|
|
36
|
+
const REFUSED = {
|
|
37
|
+
"plugin.disabled": "This component is disabled by the super admin and cannot be switched on",
|
|
38
|
+
"plugin.scope_locked": "This component belongs to a built-in plugin: it cannot be switched off in one org",
|
|
39
|
+
"plugin.switch_stale": "What switching this component off affects has changed, or the confirm value is not the preview's",
|
|
40
|
+
};
|
|
41
|
+
const OTHER_ORG_COMPONENT = "This component belongs to another org; its owner manages it, and the admin console shows it.";
|
|
42
|
+
/** The refusal text of a name clash when the clashing orgs cannot be read again. */
|
|
43
|
+
const CLASH = "Other orgs already use this component's name, so the change is refused.";
|
|
44
|
+
/**
|
|
45
|
+
* The refusal text of a name clash, one part per org: the org is named (platform data, spec
|
|
46
|
+
* §14.5 item 1), the clashing skills, templates and plugins are counted, never named (they may be
|
|
47
|
+
* that org's own).
|
|
48
|
+
*/
|
|
49
|
+
const clashText = (cs) => cs.length === 0
|
|
50
|
+
? CLASH
|
|
51
|
+
: `The change would offer a name twice, so it is refused: ${cs
|
|
52
|
+
.map((c) => `"${c.name}" is already used in org ${c.orgName} (${c.skills.length} item(s), ${c.plugins.length} plugin(s))`)
|
|
53
|
+
.join("; ")}`;
|
|
54
|
+
const stateOf = (c) => (c.disabled || c.pluginStopped ? "disabled" : "on");
|
|
55
|
+
/**
|
|
56
|
+
* A platform component as the super admin's writes return it: the orgs it is on in and the orgs
|
|
57
|
+
* its named scope lists are named (admin data in full, spec §14.5.1; another org's own component
|
|
58
|
+
* never gets here, see `assertNotOtherOrgs`).
|
|
59
|
+
*/
|
|
60
|
+
const brief = (c, names) => {
|
|
61
|
+
const ref = (orgId) => ({ orgId, orgName: names.get(orgId) ?? orgId });
|
|
62
|
+
return {
|
|
63
|
+
id: c.id,
|
|
64
|
+
name: c.name,
|
|
65
|
+
kind: c.kind,
|
|
66
|
+
state: stateOf(c),
|
|
67
|
+
plugin: c.plugin,
|
|
68
|
+
scope: c.scope,
|
|
69
|
+
scopeMode: c.scopeMode,
|
|
70
|
+
...(c.scope === "named" && { scopeOrgs: c.orgs.map(ref) }),
|
|
71
|
+
shownToOthers: c.shownToOthers,
|
|
72
|
+
version: c.version,
|
|
73
|
+
onIn: c.onIn.map(ref),
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
/** The scope as card summaries say it. */
|
|
77
|
+
const scopeText = (t) => t.scope === undefined
|
|
78
|
+
? { zh: "跟随所属插件的范围", en: "follow its plugin's scope" }
|
|
79
|
+
: t.scope === "named"
|
|
80
|
+
? {
|
|
81
|
+
zh: `指定组织(${t.orgs?.length ?? 0} 个)`,
|
|
82
|
+
en: `named (${t.orgs?.length ?? 0} orgs)`,
|
|
83
|
+
}
|
|
84
|
+
: t.scope === "all"
|
|
85
|
+
? { zh: "所有组织", en: "all orgs" }
|
|
86
|
+
: { zh: "可选", en: "optional" };
|
|
87
|
+
const previewTarget = (i) => i.scope !== undefined
|
|
88
|
+
? { scope: i.scope, ...(i.orgs !== undefined && { orgs: i.orgs }) }
|
|
89
|
+
: i.disabled === true
|
|
90
|
+
? { disabled: true }
|
|
91
|
+
: { follow: true };
|
|
92
|
+
const scopeTarget = (i) => i.scope !== undefined
|
|
93
|
+
? { scope: i.scope, ...(i.orgs !== undefined && { orgs: i.orgs }) }
|
|
94
|
+
: { follow: true };
|
|
95
|
+
const scopeBody = (i) => i.scope !== undefined
|
|
96
|
+
? {
|
|
97
|
+
scope: i.scope,
|
|
98
|
+
scopeHash: i.scopeHash,
|
|
99
|
+
...(i.orgs !== undefined && { orgs: i.orgs }),
|
|
100
|
+
}
|
|
101
|
+
: { follow: true, scopeHash: i.scopeHash };
|
|
102
|
+
/** A platform component as the `available` lists show it: a compact row. */
|
|
103
|
+
function row(c) {
|
|
104
|
+
return {
|
|
105
|
+
id: c.id,
|
|
106
|
+
name: c.name,
|
|
107
|
+
state: c.on ? "on" : "off",
|
|
108
|
+
...(!c.on &&
|
|
109
|
+
!c.pluginOn && {
|
|
110
|
+
reason: "Its plugin is off in the org.",
|
|
111
|
+
next: "Switch its plugin on first (plugins.set-enabled, org admins).",
|
|
112
|
+
}),
|
|
113
|
+
plugin: c.plugin,
|
|
114
|
+
switchable: c.switchable,
|
|
115
|
+
version: c.version,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The org's switches of platform components (spec §7, rule 5): for each kind (skill, agent
|
|
120
|
+
* template, connector template) the platform components offered to the org, the read-only preview
|
|
121
|
+
* of switching one off, and the switch itself; plus the super admin's read-only component list and
|
|
122
|
+
* version history, and the admin console's component writes (scope, disable, visibility, template
|
|
123
|
+
* versions; class `platform`). The operations
|
|
124
|
+
* of the three kinds are written out (the `platform-op-*` checks read literals); their logic is
|
|
125
|
+
* shared below.
|
|
126
|
+
*/
|
|
127
|
+
let ComponentsOperations = class ComponentsOperations {
|
|
128
|
+
registry;
|
|
129
|
+
components;
|
|
130
|
+
platformComponents;
|
|
131
|
+
kdb;
|
|
132
|
+
constructor(registry, components, platformComponents, kdb) {
|
|
133
|
+
this.registry = registry;
|
|
134
|
+
this.components = components;
|
|
135
|
+
this.platformComponents = platformComponents;
|
|
136
|
+
this.kdb = kdb;
|
|
137
|
+
}
|
|
138
|
+
/** A component as a write returns it, with its orgs named (see {@link brief}). */
|
|
139
|
+
async withOrgNames(c) {
|
|
140
|
+
const ids = [...new Set([...c.onIn, ...c.orgs])];
|
|
141
|
+
const rows = ids.length === 0
|
|
142
|
+
? []
|
|
143
|
+
: await this.kdb.db
|
|
144
|
+
.selectFrom("orgs")
|
|
145
|
+
.select(["id", "name"])
|
|
146
|
+
.where("id", "in", ids)
|
|
147
|
+
.where("deleted_at", "is", null)
|
|
148
|
+
.execute();
|
|
149
|
+
return brief(c, new Map(rows.map((r) => [r.id, r.name])));
|
|
150
|
+
}
|
|
151
|
+
/** Refuses a super-admin operation on a component another org owns (spec section 6.1). */
|
|
152
|
+
async assertNotOtherOrgs(kind, id, orgId) {
|
|
153
|
+
const c = (await this.components.list(kind)).find((x) => x.id === id);
|
|
154
|
+
if (c !== undefined && c.owner.kind === "org" && c.owner.orgId !== orgId) {
|
|
155
|
+
throw new ToolError(OTHER_ORG_COMPONENT);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async adminName(kind, id) {
|
|
159
|
+
return orElse(async () => {
|
|
160
|
+
const c = (await this.components.list(kind)).find((x) => x.id === id);
|
|
161
|
+
if (c === undefined)
|
|
162
|
+
throw new Error("unknown");
|
|
163
|
+
return named(c.name);
|
|
164
|
+
}, id);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Runs a governance write; a name clash the service reports (it names the clashing items, which
|
|
168
|
+
* may be another org's own) is rethrown with {@link clashText} of the current preview, so a race
|
|
169
|
+
* past the precheck never puts another org's private item in the log.
|
|
170
|
+
*/
|
|
171
|
+
async withoutItemNames(kind, id, target, write) {
|
|
172
|
+
try {
|
|
173
|
+
return await write();
|
|
174
|
+
}
|
|
175
|
+
catch (e) {
|
|
176
|
+
if (e instanceof ApiError &&
|
|
177
|
+
(e.code === "plugin.skill_conflict" || e.code === "agent_template.name_taken")) {
|
|
178
|
+
const conflicts = await orElse(async () => (await this.components.preview(kind, id, target)).conflicts, []);
|
|
179
|
+
throw new ApiError(e.code, clashText(conflicts));
|
|
180
|
+
}
|
|
181
|
+
throw e;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* What a scope change or disable would touch, as the admin console shows it (orgs named, spec
|
|
186
|
+
* §14.5 item 1); each org's agents and the clashing items are counted (they are that org's own).
|
|
187
|
+
*/
|
|
188
|
+
async previewBrief(kind, id, target) {
|
|
189
|
+
const p = await this.components.preview(kind, id, target);
|
|
190
|
+
return {
|
|
191
|
+
affected: p.affected.map((a) => ({
|
|
192
|
+
orgId: a.orgId,
|
|
193
|
+
orgName: a.orgName,
|
|
194
|
+
agents: a.agents.length,
|
|
195
|
+
connectorsKept: a.connectorsKept,
|
|
196
|
+
})),
|
|
197
|
+
affectedOrgs: p.affected.length,
|
|
198
|
+
affectedAgents: p.affected.reduce((n, a) => n + a.agents.length, 0),
|
|
199
|
+
connectorsKept: p.affected.reduce((n, a) => n + a.connectorsKept, 0),
|
|
200
|
+
conflicts: p.conflicts.map((c) => ({
|
|
201
|
+
orgId: c.orgId,
|
|
202
|
+
orgName: c.orgName,
|
|
203
|
+
name: c.name,
|
|
204
|
+
items: c.skills.length,
|
|
205
|
+
plugins: c.plugins.length,
|
|
206
|
+
})),
|
|
207
|
+
scopeHash: p.scopeHash,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/** The precheck of a scope change or disable: another org's component, a stale hash, a name clash. */
|
|
211
|
+
precheckTarget(kind, id, target, hash, orgId) {
|
|
212
|
+
return precheckBy(async () => {
|
|
213
|
+
await this.assertNotOtherOrgs(kind, id, orgId);
|
|
214
|
+
const p = await this.components.preview(kind, id, target);
|
|
215
|
+
if (hash !== undefined && p.scopeHash !== hash) {
|
|
216
|
+
throw new ApiError("plugin.scope_stale", "The scope preview is out of date; preview again and use its new scopeHash");
|
|
217
|
+
}
|
|
218
|
+
if (p.conflicts.length > 0) {
|
|
219
|
+
throw new ApiError(kind === "skill" ? "plugin.skill_conflict" : "agent_template.name_taken", clashText(p.conflicts));
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
async available(kind, cursor, orgId) {
|
|
224
|
+
const all = await this.components.orgList(orgId, { kind });
|
|
225
|
+
return pageOf(all.map(row), startOf(cursor), PAGE);
|
|
226
|
+
}
|
|
227
|
+
nameOf(orgId, kind, id) {
|
|
228
|
+
return orElse(async () => {
|
|
229
|
+
const found = (await this.components.orgList(orgId, { kind })).find((c) => c.id === id);
|
|
230
|
+
if (found === undefined)
|
|
231
|
+
throw new Error("not offered");
|
|
232
|
+
return named(found.name);
|
|
233
|
+
}, id);
|
|
234
|
+
}
|
|
235
|
+
async disablePreview(kind, id, orgId) {
|
|
236
|
+
const r = await this.components.switchPreview(orgId, kind, id);
|
|
237
|
+
if (r.component.locked)
|
|
238
|
+
return { component: r.component, locked: true, confirm: null };
|
|
239
|
+
if (!r.component.on) {
|
|
240
|
+
return {
|
|
241
|
+
component: r.component,
|
|
242
|
+
preview: null,
|
|
243
|
+
confirm: ALREADY_OFF,
|
|
244
|
+
next: "It is not on in this org, so switching off changes nothing; pass this confirm value.",
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
return { component: r.component, preview: r.preview, confirm: r.confirm };
|
|
248
|
+
}
|
|
249
|
+
precheckSwitch(kind, id, input, orgId) {
|
|
250
|
+
return precheckBy(async () => {
|
|
251
|
+
const r = await this.components.switchPreview(orgId, kind, id);
|
|
252
|
+
const code = input.enabled
|
|
253
|
+
? r.stopped && !r.component.on
|
|
254
|
+
? "plugin.disabled"
|
|
255
|
+
: null
|
|
256
|
+
: r.component.locked
|
|
257
|
+
? "plugin.scope_locked"
|
|
258
|
+
: r.confirm !== null && r.confirm !== input.confirm
|
|
259
|
+
? "plugin.switch_stale"
|
|
260
|
+
: null;
|
|
261
|
+
if (code !== null)
|
|
262
|
+
throw new ApiError(code, REFUSED[code]);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
async switchSummary(kind, id, enabled, orgId) {
|
|
266
|
+
const n = await this.nameOf(orgId, kind, id);
|
|
267
|
+
const l = LABEL[kind];
|
|
268
|
+
if (enabled) {
|
|
269
|
+
return { zh: `在本组织启用${l.zh}「${n}」`, en: `Switch on ${l.en} "${n}" in the org` };
|
|
270
|
+
}
|
|
271
|
+
const p = await orElse(() => this.components.switchPreview(orgId, kind, id), null);
|
|
272
|
+
const agents = p?.preview?.agents.length ?? 0;
|
|
273
|
+
return {
|
|
274
|
+
zh: `在本组织停用${l.zh}「${n}」:${agents} 个智能体在用`,
|
|
275
|
+
en: `Switch off ${l.en} "${n}" in the org: ${agents} agents use it`,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
async switchRun(kind, id, input, operation, ctx) {
|
|
279
|
+
const confirm = !input.enabled && input.confirm !== undefined && input.confirm !== ALREADY_OFF
|
|
280
|
+
? { confirm: input.confirm }
|
|
281
|
+
: {};
|
|
282
|
+
const r = await this.components.setSwitch(ctx.orgId, ctx.actorAccountId, kind, id, { enabled: input.enabled, ...confirm }, undefined, viaAgent(operation, ctx));
|
|
283
|
+
// a switch-off of a component that is on always carries its confirm, so `preview` is a race
|
|
284
|
+
return r.kind === "done"
|
|
285
|
+
? { component: r.component }
|
|
286
|
+
: { preview: r.preview, confirm: r.confirm };
|
|
287
|
+
}
|
|
288
|
+
onModuleInit() {
|
|
289
|
+
this.registry.register([
|
|
290
|
+
defineOperation({
|
|
291
|
+
id: "skills.available",
|
|
292
|
+
description: "List the platform skills offered to this org with whether each is on here. Each entry has an id, name, state, whether an org admin can switch it and its plugin. Pages by 50: pass the returned next as params.cursor.",
|
|
293
|
+
input: z.object({ cursor: Cursor.optional() }).strict(),
|
|
294
|
+
example: {},
|
|
295
|
+
authz: { orgAction: "catalog.read" },
|
|
296
|
+
mirrors: ["GET /api/v1/orgs/:orgId/components"],
|
|
297
|
+
omits: ["kind", "itemId"],
|
|
298
|
+
extras: ["cursor"],
|
|
299
|
+
confirm: "read",
|
|
300
|
+
run: async (input, ctx) => this.available("skill", input.cursor, ctx.orgId),
|
|
301
|
+
}),
|
|
302
|
+
defineOperation({
|
|
303
|
+
id: "skills.disable-preview",
|
|
304
|
+
description: "Preview switching a platform skill off in this org (org admins): the agents that lose it and the confirm value skills.set-enabled needs to switch it off. Show the preview to the person first.",
|
|
305
|
+
input: z.object({ skillId: Id }).strict(),
|
|
306
|
+
example: { skillId: EXAMPLE_ID },
|
|
307
|
+
authz: { orgAction: "skills.manage" },
|
|
308
|
+
// a computed preview (the web gets it from the switch route's reply): no route of its own
|
|
309
|
+
mirrors: [],
|
|
310
|
+
confirm: "read",
|
|
311
|
+
errors: [
|
|
312
|
+
{
|
|
313
|
+
code: "component.not_found",
|
|
314
|
+
next: "Check the id with skills.available; only components offered to the org can be switched.",
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
code: "plugin.scope_locked",
|
|
318
|
+
next: "This platform skill belongs to a built-in plugin: it is on for every org and cannot be switched off in one org.",
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
code: "plugin.disabled",
|
|
322
|
+
next: {
|
|
323
|
+
superAdmin: "The component is disabled on the platform: enable it again in the admin console under Components, then call again.",
|
|
324
|
+
orgAdmin: "The super admin disabled this component on the platform; ask them.",
|
|
325
|
+
member: "The super admin disabled this component on the platform; ask an org admin.",
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
code: "plugin.switch_stale",
|
|
330
|
+
next: "What switching it off affects changed: call skills.disable-preview again, show it to the person, and call again with the new confirm value.",
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
code: "plugin.skill_conflict",
|
|
334
|
+
next: "An org skill has this skill's name: rename or delete the org skill first.",
|
|
335
|
+
},
|
|
336
|
+
],
|
|
337
|
+
run: async (input, ctx) => this.disablePreview("skill", input.skillId, ctx.orgId),
|
|
338
|
+
}),
|
|
339
|
+
defineOperation({
|
|
340
|
+
id: "skills.set-enabled",
|
|
341
|
+
description: "Switch a platform skill on or off in this org (org admins). Switching off needs confirm: the value skills.disable-preview returned with the preview the person saw. A component of a plugin that is off is switched on with the plugin.",
|
|
342
|
+
input: z.discriminatedUnion("enabled", [
|
|
343
|
+
z.object({ skillId: Id, enabled: z.literal(true) }).strict(),
|
|
344
|
+
z.object({ skillId: Id, enabled: z.literal(false), confirm: Confirm }).strict(),
|
|
345
|
+
]),
|
|
346
|
+
example: { skillId: EXAMPLE_ID, enabled: true },
|
|
347
|
+
authz: { orgAction: "skills.manage" },
|
|
348
|
+
// the route needs catalog.read; the service requires the kind's manage action
|
|
349
|
+
authzNote: "service-enforced",
|
|
350
|
+
mirrors: ["PUT /api/v1/orgs/:orgId/components/:kind/:id/switch"],
|
|
351
|
+
omits: ["kind"],
|
|
352
|
+
renames: { skillId: "id" },
|
|
353
|
+
loosens: {
|
|
354
|
+
confirm: "also takes `already-off` (skills.disable-preview's value when the component is not on), which the route's hash pattern rejects; the service checks confirm only when it is on",
|
|
355
|
+
},
|
|
356
|
+
confirm: "org",
|
|
357
|
+
errors: [
|
|
358
|
+
{
|
|
359
|
+
code: "component.not_found",
|
|
360
|
+
next: "Check the id with skills.available; only components offered to the org can be switched.",
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
code: "plugin.scope_locked",
|
|
364
|
+
next: "This platform skill belongs to a built-in plugin: it is on for every org and cannot be switched off in one org.",
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
code: "plugin.disabled",
|
|
368
|
+
next: {
|
|
369
|
+
superAdmin: "The component is disabled on the platform: enable it again in the admin console under Components, then call again.",
|
|
370
|
+
orgAdmin: "The super admin disabled this component on the platform; ask them.",
|
|
371
|
+
member: "The super admin disabled this component on the platform; ask an org admin.",
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
code: "plugin.switch_stale",
|
|
376
|
+
next: "What switching it off affects changed: call skills.disable-preview again, show it to the person, and call again with the new confirm value.",
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
code: "plugin.skill_conflict",
|
|
380
|
+
next: "An org skill has this skill's name: rename or delete the org skill first.",
|
|
381
|
+
},
|
|
382
|
+
],
|
|
383
|
+
precheck: (i, ctx) => this.precheckSwitch("skill", i.skillId, i, ctx.orgId),
|
|
384
|
+
summary: (i, ctx) => this.switchSummary("skill", i.skillId, i.enabled, ctx.orgId),
|
|
385
|
+
run: async (i, ctx) => this.switchRun("skill", i.skillId, i, "skills.set-enabled", ctx),
|
|
386
|
+
}),
|
|
387
|
+
defineOperation({
|
|
388
|
+
id: "agent-templates.available",
|
|
389
|
+
description: "List the platform agent templates offered to this org with whether each is on here. Each entry has an id, name, state, whether an org admin can switch it and its plugin. Pages by 50: pass the returned next as params.cursor.",
|
|
390
|
+
input: z.object({ cursor: Cursor.optional() }).strict(),
|
|
391
|
+
example: {},
|
|
392
|
+
authz: { orgAction: "catalog.read" },
|
|
393
|
+
mirrors: ["GET /api/v1/orgs/:orgId/components"],
|
|
394
|
+
omits: ["kind", "itemId"],
|
|
395
|
+
extras: ["cursor"],
|
|
396
|
+
confirm: "read",
|
|
397
|
+
run: async (input, ctx) => this.available("agent_template", input.cursor, ctx.orgId),
|
|
398
|
+
}),
|
|
399
|
+
defineOperation({
|
|
400
|
+
id: "agent-templates.disable-preview",
|
|
401
|
+
description: "Preview switching a platform agent template off in this org (org admins): the agents that lose it and the confirm value agent-templates.set-enabled needs to switch it off. Show the preview to the person first.",
|
|
402
|
+
input: z.object({ templateId: Id }).strict(),
|
|
403
|
+
example: { templateId: EXAMPLE_ID },
|
|
404
|
+
authz: { orgAction: "agents.manage" },
|
|
405
|
+
// a computed preview (the web gets it from the switch route's reply): no route of its own
|
|
406
|
+
mirrors: [],
|
|
407
|
+
confirm: "read",
|
|
408
|
+
errors: [
|
|
409
|
+
{
|
|
410
|
+
code: "component.not_found",
|
|
411
|
+
next: "Check the id with agent-templates.available; only components offered to the org can be switched.",
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
code: "plugin.scope_locked",
|
|
415
|
+
next: "This platform agent template belongs to a built-in plugin: it is on for every org and cannot be switched off in one org.",
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
code: "plugin.disabled",
|
|
419
|
+
next: {
|
|
420
|
+
superAdmin: "The component is disabled on the platform: enable it again in the admin console under Components, then call again.",
|
|
421
|
+
orgAdmin: "The super admin disabled this component on the platform; ask them.",
|
|
422
|
+
member: "The super admin disabled this component on the platform; ask an org admin.",
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
code: "plugin.switch_stale",
|
|
427
|
+
next: "What switching it off affects changed: call agent-templates.disable-preview again, show it to the person, and call again with the new confirm value.",
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
code: "agent_template.name_taken",
|
|
431
|
+
next: "An org template already uses this template's type: rename or delete that one first.",
|
|
432
|
+
},
|
|
433
|
+
],
|
|
434
|
+
run: async (input, ctx) => this.disablePreview("agent_template", input.templateId, ctx.orgId),
|
|
435
|
+
}),
|
|
436
|
+
defineOperation({
|
|
437
|
+
id: "agent-templates.set-enabled",
|
|
438
|
+
description: "Switch a platform agent template on or off in this org (org admins). Switching off needs confirm: the value agent-templates.disable-preview returned with the preview the person saw. A component of a plugin that is off is switched on with the plugin.",
|
|
439
|
+
input: z.discriminatedUnion("enabled", [
|
|
440
|
+
z.object({ templateId: Id, enabled: z.literal(true) }).strict(),
|
|
441
|
+
z.object({ templateId: Id, enabled: z.literal(false), confirm: Confirm }).strict(),
|
|
442
|
+
]),
|
|
443
|
+
example: { templateId: EXAMPLE_ID, enabled: true },
|
|
444
|
+
authz: { orgAction: "agents.manage" },
|
|
445
|
+
// the route needs catalog.read; the service requires the kind's manage action
|
|
446
|
+
authzNote: "service-enforced",
|
|
447
|
+
mirrors: ["PUT /api/v1/orgs/:orgId/components/:kind/:id/switch"],
|
|
448
|
+
omits: ["kind"],
|
|
449
|
+
renames: { templateId: "id" },
|
|
450
|
+
loosens: {
|
|
451
|
+
confirm: "also takes `already-off` (agent-templates.disable-preview's value when the component is not on), which the route's hash pattern rejects; the service checks confirm only when it is on",
|
|
452
|
+
},
|
|
453
|
+
confirm: "org",
|
|
454
|
+
errors: [
|
|
455
|
+
{
|
|
456
|
+
code: "component.not_found",
|
|
457
|
+
next: "Check the id with agent-templates.available; only components offered to the org can be switched.",
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
code: "plugin.scope_locked",
|
|
461
|
+
next: "This platform agent template belongs to a built-in plugin: it is on for every org and cannot be switched off in one org.",
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
code: "plugin.disabled",
|
|
465
|
+
next: {
|
|
466
|
+
superAdmin: "The component is disabled on the platform: enable it again in the admin console under Components, then call again.",
|
|
467
|
+
orgAdmin: "The super admin disabled this component on the platform; ask them.",
|
|
468
|
+
member: "The super admin disabled this component on the platform; ask an org admin.",
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
code: "plugin.switch_stale",
|
|
473
|
+
next: "What switching it off affects changed: call agent-templates.disable-preview again, show it to the person, and call again with the new confirm value.",
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
code: "agent_template.name_taken",
|
|
477
|
+
next: "An org template already uses this template's type: rename or delete that one first.",
|
|
478
|
+
},
|
|
479
|
+
],
|
|
480
|
+
precheck: (i, ctx) => this.precheckSwitch("agent_template", i.templateId, i, ctx.orgId),
|
|
481
|
+
summary: (i, ctx) => this.switchSummary("agent_template", i.templateId, i.enabled, ctx.orgId),
|
|
482
|
+
run: async (i, ctx) => this.switchRun("agent_template", i.templateId, i, "agent-templates.set-enabled", ctx),
|
|
483
|
+
}),
|
|
484
|
+
defineOperation({
|
|
485
|
+
id: "connectors.template-disable-preview",
|
|
486
|
+
description: "Preview switching a platform connector template off in this org (org admins): the agents that lose it and the confirm value connectors.set-template-enabled needs to switch it off. Show the preview to the person first.",
|
|
487
|
+
input: z.object({ templateId: Id }).strict(),
|
|
488
|
+
example: { templateId: EXAMPLE_ID },
|
|
489
|
+
authz: { orgAction: "connectors.manage" },
|
|
490
|
+
// a computed preview (the web gets it from the switch route's reply): no route of its own
|
|
491
|
+
mirrors: [],
|
|
492
|
+
confirm: "read",
|
|
493
|
+
errors: [
|
|
494
|
+
{
|
|
495
|
+
code: "component.not_found",
|
|
496
|
+
next: "Check the id with connectors.templates; only components offered to the org can be switched.",
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
code: "plugin.scope_locked",
|
|
500
|
+
next: "This platform connector template belongs to a built-in plugin: it is on for every org and cannot be switched off in one org.",
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
code: "plugin.disabled",
|
|
504
|
+
next: {
|
|
505
|
+
superAdmin: "The component is disabled on the platform: enable it again in the admin console under Components, then call again.",
|
|
506
|
+
orgAdmin: "The super admin disabled this component on the platform; ask them.",
|
|
507
|
+
member: "The super admin disabled this component on the platform; ask an org admin.",
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
code: "plugin.switch_stale",
|
|
512
|
+
next: "What switching it off affects changed: call connectors.template-disable-preview again, show it to the person, and call again with the new confirm value.",
|
|
513
|
+
},
|
|
514
|
+
],
|
|
515
|
+
run: async (input, ctx) => this.disablePreview("connector_template", input.templateId, ctx.orgId),
|
|
516
|
+
}),
|
|
517
|
+
defineOperation({
|
|
518
|
+
id: "connectors.set-template-enabled",
|
|
519
|
+
description: "Switch a platform connector template on or off in this org (org admins). Switching off needs confirm: the value connectors.template-disable-preview returned with the preview the person saw. A component of a plugin that is off is switched on with the plugin.",
|
|
520
|
+
input: z.discriminatedUnion("enabled", [
|
|
521
|
+
z.object({ templateId: Id, enabled: z.literal(true) }).strict(),
|
|
522
|
+
z.object({ templateId: Id, enabled: z.literal(false), confirm: Confirm }).strict(),
|
|
523
|
+
]),
|
|
524
|
+
example: { templateId: EXAMPLE_ID, enabled: true },
|
|
525
|
+
authz: { orgAction: "connectors.manage" },
|
|
526
|
+
// the route needs catalog.read; the service requires the kind's manage action
|
|
527
|
+
authzNote: "service-enforced",
|
|
528
|
+
mirrors: ["PUT /api/v1/orgs/:orgId/components/:kind/:id/switch"],
|
|
529
|
+
omits: ["kind"],
|
|
530
|
+
renames: { templateId: "id" },
|
|
531
|
+
loosens: {
|
|
532
|
+
confirm: "also takes `already-off` (connectors.template-disable-preview's value when the component is not on), which the route's hash pattern rejects; the service checks confirm only when it is on",
|
|
533
|
+
},
|
|
534
|
+
confirm: "org",
|
|
535
|
+
errors: [
|
|
536
|
+
{
|
|
537
|
+
code: "component.not_found",
|
|
538
|
+
next: "Check the id with connectors.templates; only components offered to the org can be switched.",
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
code: "plugin.scope_locked",
|
|
542
|
+
next: "This platform connector template belongs to a built-in plugin: it is on for every org and cannot be switched off in one org.",
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
code: "plugin.disabled",
|
|
546
|
+
next: {
|
|
547
|
+
superAdmin: "The component is disabled on the platform: enable it again in the admin console under Components, then call again.",
|
|
548
|
+
orgAdmin: "The super admin disabled this component on the platform; ask them.",
|
|
549
|
+
member: "The super admin disabled this component on the platform; ask an org admin.",
|
|
550
|
+
},
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
code: "plugin.switch_stale",
|
|
554
|
+
next: "What switching it off affects changed: call connectors.template-disable-preview again, show it to the person, and call again with the new confirm value.",
|
|
555
|
+
},
|
|
556
|
+
],
|
|
557
|
+
precheck: (i, ctx) => this.precheckSwitch("connector_template", i.templateId, i, ctx.orgId),
|
|
558
|
+
summary: (i, ctx) => this.switchSummary("connector_template", i.templateId, i.enabled, ctx.orgId),
|
|
559
|
+
run: async (i, ctx) => this.switchRun("connector_template", i.templateId, i, "connectors.set-template-enabled", ctx),
|
|
560
|
+
}),
|
|
561
|
+
defineOperation({
|
|
562
|
+
id: "plugins.components",
|
|
563
|
+
description: "List the platform's components of one kind (super admin): skills, agent templates or connector templates with their plugin, scope, disabled state and how many orgs they are on in (another org's own components are only counted). Pages by 50: pass the returned next as params.cursor. Scope, disable and visibility are changed in the admin console.",
|
|
564
|
+
input: z.object({ kind: ComponentParams.shape.kind, cursor: Cursor.optional() }).strict(),
|
|
565
|
+
example: { kind: "skill" },
|
|
566
|
+
authz: { superAdmin: true },
|
|
567
|
+
mirrors: ["GET /api/v1/admin/components"],
|
|
568
|
+
extras: ["cursor"],
|
|
569
|
+
confirm: "read",
|
|
570
|
+
run: async (input, ctx) => {
|
|
571
|
+
const all = await this.components.list(input.kind);
|
|
572
|
+
// another org's own rows are only counted
|
|
573
|
+
const visible = all.filter((c) => c.owner.kind !== "org" || c.owner.orgId === ctx.orgId);
|
|
574
|
+
const rows = visible.map((c) => ({
|
|
575
|
+
id: c.id,
|
|
576
|
+
name: c.name,
|
|
577
|
+
state: stateOf(c),
|
|
578
|
+
plugin: c.plugin,
|
|
579
|
+
scope: c.scope,
|
|
580
|
+
onIn: c.onIn.length,
|
|
581
|
+
}));
|
|
582
|
+
return {
|
|
583
|
+
...pageOf(rows, startOf(input.cursor), PAGE),
|
|
584
|
+
otherOrgComponents: all.length - visible.length,
|
|
585
|
+
};
|
|
586
|
+
},
|
|
587
|
+
}),
|
|
588
|
+
defineOperation({
|
|
589
|
+
id: "plugins.component-scope-preview",
|
|
590
|
+
description: "Preview a platform component's scope change, deployment-level disable or return to its plugin's scope (super admin): the orgs affected (with how many agents in each), name clashes (the org named, its clashing items counted), and the scopeHash plugins.set-component-scope or plugins.set-component-disabled takes. Send exactly one of scope (with orgs for named), disabled: true or follow: true.",
|
|
591
|
+
input: ComponentScopePreviewFields.extend({
|
|
592
|
+
kind: ComponentParams.shape.kind,
|
|
593
|
+
componentId: Id,
|
|
594
|
+
})
|
|
595
|
+
.strict()
|
|
596
|
+
.refine(componentScopeRules.exactlyOnePreviewTarget, {
|
|
597
|
+
message: "send exactly one of scope (with orgs for named), disabled: true or follow: true",
|
|
598
|
+
})
|
|
599
|
+
.refine(componentScopeRules.orgsNeedScope, {
|
|
600
|
+
message: "orgs: only allowed with scope named",
|
|
601
|
+
path: ["orgs"],
|
|
602
|
+
}),
|
|
603
|
+
example: { kind: "skill", componentId: EXAMPLE_ID, scope: "optional" },
|
|
604
|
+
authz: { superAdmin: true },
|
|
605
|
+
mirrors: ["POST /api/v1/admin/components/:kind/:id/scope/preview"],
|
|
606
|
+
renames: { componentId: "id" },
|
|
607
|
+
confirm: "read",
|
|
608
|
+
errors: [
|
|
609
|
+
{
|
|
610
|
+
code: "component.not_found",
|
|
611
|
+
next: "Check the component id and kind with plugins.components.",
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
code: "plugin.builtin",
|
|
615
|
+
next: "The component belongs to a built-in plugin: it is on in every org and its scope cannot be changed.",
|
|
616
|
+
},
|
|
617
|
+
],
|
|
618
|
+
run: async (i, ctx) => {
|
|
619
|
+
await this.assertNotOtherOrgs(i.kind, i.componentId, ctx.orgId);
|
|
620
|
+
const p = await this.previewBrief(i.kind, i.componentId, previewTarget(i));
|
|
621
|
+
return p;
|
|
622
|
+
},
|
|
623
|
+
}),
|
|
624
|
+
defineOperation({
|
|
625
|
+
id: "plugins.set-component-scope",
|
|
626
|
+
description: "Give a platform component its own scope (all, optional or named with orgs), or make it follow its plugin's scope again (super admin), for every org at once: pass the scopeHash plugins.component-scope-preview returned. A stale preview or an org whose own skill has the component's name is refused.",
|
|
627
|
+
input: ComponentScopeFields.extend({
|
|
628
|
+
kind: ComponentParams.shape.kind,
|
|
629
|
+
componentId: Id,
|
|
630
|
+
})
|
|
631
|
+
.strict()
|
|
632
|
+
.refine(componentScopeRules.scopeXorFollow, {
|
|
633
|
+
message: "send either scope (with orgs for named) or follow: true",
|
|
634
|
+
})
|
|
635
|
+
.refine(componentScopeRules.orgsNeedScope, {
|
|
636
|
+
message: "orgs: only allowed with scope named",
|
|
637
|
+
path: ["orgs"],
|
|
638
|
+
}),
|
|
639
|
+
example: {
|
|
640
|
+
kind: "skill",
|
|
641
|
+
componentId: EXAMPLE_ID,
|
|
642
|
+
scope: "optional",
|
|
643
|
+
scopeHash: "abc123",
|
|
644
|
+
},
|
|
645
|
+
authz: { superAdmin: true },
|
|
646
|
+
mirrors: ["PUT /api/v1/admin/components/:kind/:id/scope"],
|
|
647
|
+
renames: { componentId: "id" },
|
|
648
|
+
confirm: "platform",
|
|
649
|
+
errors: [
|
|
650
|
+
{
|
|
651
|
+
code: "component.not_found",
|
|
652
|
+
next: "Check the component id and kind with plugins.components.",
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
code: "plugin.scope_stale",
|
|
656
|
+
next: "Call plugins.component-scope-preview again and use its new scopeHash.",
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
code: "plugin.skill_conflict",
|
|
660
|
+
next: "An org's own skill has this skill's name: that org renames or deletes it first.",
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
code: "plugin.builtin",
|
|
664
|
+
next: "The component belongs to a built-in plugin: its scope cannot be changed.",
|
|
665
|
+
},
|
|
666
|
+
],
|
|
667
|
+
precheck: (i, ctx) => this.precheckTarget(i.kind, i.componentId, scopeTarget(i), i.scopeHash, ctx.orgId),
|
|
668
|
+
summary: async (i) => {
|
|
669
|
+
const kind = i.kind;
|
|
670
|
+
const n = await this.adminName(kind, i.componentId);
|
|
671
|
+
const sc = scopeText(i);
|
|
672
|
+
const p = await orElse(() => this.previewBrief(kind, i.componentId, scopeTarget(i)), null);
|
|
673
|
+
const tail = p === null
|
|
674
|
+
? { zh: "", en: "" }
|
|
675
|
+
: {
|
|
676
|
+
zh: `;影响 ${p.affectedOrgs} 个组织、${p.affectedAgents} 个智能体`,
|
|
677
|
+
en: `; ${p.affectedOrgs} orgs and ${p.affectedAgents} agents affected`,
|
|
678
|
+
};
|
|
679
|
+
return {
|
|
680
|
+
zh: `把${LABEL[kind].zh}「${n}」的范围设为${sc.zh}${tail.zh}`,
|
|
681
|
+
en: `Set the scope of ${LABEL[kind].en} "${n}" to ${sc.en}${tail.en}`,
|
|
682
|
+
};
|
|
683
|
+
},
|
|
684
|
+
run: async (i, ctx) => {
|
|
685
|
+
await this.assertNotOtherOrgs(i.kind, i.componentId, ctx.orgId);
|
|
686
|
+
return {
|
|
687
|
+
component: await this.withOrgNames(await this.withoutItemNames(i.kind, i.componentId, scopeTarget(i), () => this.components.setScope(ctx.actorAccountId, i.kind, i.componentId, scopeBody(i), { auditDetail: viaAgent("plugins.set-component-scope", ctx) }))),
|
|
688
|
+
};
|
|
689
|
+
},
|
|
690
|
+
}),
|
|
691
|
+
defineOperation({
|
|
692
|
+
id: "plugins.set-component-disabled",
|
|
693
|
+
description: "Disable a platform component on the whole deployment, or enable it again (super admin). Disabling needs the scopeHash of plugins.component-scope-preview called with disabled: true; enabling needs none. Orgs keep their own switches.",
|
|
694
|
+
input: ComponentDisabledSchema.extend({
|
|
695
|
+
kind: ComponentParams.shape.kind,
|
|
696
|
+
componentId: Id,
|
|
697
|
+
}).strict(),
|
|
698
|
+
example: { kind: "skill", componentId: EXAMPLE_ID, disabled: true, scopeHash: "abc123" },
|
|
699
|
+
authz: { superAdmin: true },
|
|
700
|
+
mirrors: ["PUT /api/v1/admin/components/:kind/:id/disabled"],
|
|
701
|
+
renames: { componentId: "id" },
|
|
702
|
+
confirm: "platform",
|
|
703
|
+
errors: [
|
|
704
|
+
{
|
|
705
|
+
code: "component.not_found",
|
|
706
|
+
next: "Check the component id and kind with plugins.components.",
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
code: "plugin.scope_stale",
|
|
710
|
+
next: "Call plugins.component-scope-preview with disabled: true again and use its new scopeHash.",
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
code: "validation_failed",
|
|
714
|
+
next: "Disabling needs scopeHash from plugins.component-scope-preview with disabled: true.",
|
|
715
|
+
},
|
|
716
|
+
],
|
|
717
|
+
precheck: (i, ctx) => i.disabled && i.scopeHash === undefined
|
|
718
|
+
? Promise.resolve({
|
|
719
|
+
ok: false,
|
|
720
|
+
code: "validation_failed",
|
|
721
|
+
message: "scopeHash: required when disabling",
|
|
722
|
+
})
|
|
723
|
+
: this.precheckTarget(i.kind, i.componentId, { disabled: i.disabled }, i.disabled ? i.scopeHash : undefined, ctx.orgId),
|
|
724
|
+
summary: async (i) => {
|
|
725
|
+
const kind = i.kind;
|
|
726
|
+
const n = await this.adminName(kind, i.componentId);
|
|
727
|
+
return i.disabled
|
|
728
|
+
? {
|
|
729
|
+
zh: `在整个平台停用${LABEL[kind].zh}「${n}」`,
|
|
730
|
+
en: `Disable ${LABEL[kind].en} "${n}" on the whole platform`,
|
|
731
|
+
}
|
|
732
|
+
: {
|
|
733
|
+
zh: `在整个平台重新启用${LABEL[kind].zh}「${n}」`,
|
|
734
|
+
en: `Enable ${LABEL[kind].en} "${n}" on the platform again`,
|
|
735
|
+
};
|
|
736
|
+
},
|
|
737
|
+
run: async (i, ctx) => {
|
|
738
|
+
await this.assertNotOtherOrgs(i.kind, i.componentId, ctx.orgId);
|
|
739
|
+
return {
|
|
740
|
+
component: await this.withOrgNames(await this.withoutItemNames(i.kind, i.componentId, { disabled: i.disabled }, () => this.components.setDisabled(ctx.actorAccountId, i.kind, i.componentId, {
|
|
741
|
+
disabled: i.disabled,
|
|
742
|
+
...(i.scopeHash !== undefined && { scopeHash: i.scopeHash }),
|
|
743
|
+
}, { auditDetail: viaAgent("plugins.set-component-disabled", ctx) }))),
|
|
744
|
+
};
|
|
745
|
+
},
|
|
746
|
+
}),
|
|
747
|
+
defineOperation({
|
|
748
|
+
id: "plugins.set-component-shown",
|
|
749
|
+
description: "Show a platform component to orgs outside its named list, or hide it from them (super admin). Showing does not make it usable there; those orgs' admins can then switch it on.",
|
|
750
|
+
input: ComponentShownSchema.extend({
|
|
751
|
+
kind: ComponentParams.shape.kind,
|
|
752
|
+
componentId: Id,
|
|
753
|
+
}).strict(),
|
|
754
|
+
example: { kind: "skill", componentId: EXAMPLE_ID, shownToOthers: true },
|
|
755
|
+
authz: { superAdmin: true },
|
|
756
|
+
mirrors: ["PUT /api/v1/admin/components/:kind/:id/shown"],
|
|
757
|
+
renames: { componentId: "id" },
|
|
758
|
+
confirm: "platform",
|
|
759
|
+
errors: [
|
|
760
|
+
{
|
|
761
|
+
code: "component.not_found",
|
|
762
|
+
next: "Check the component id and kind with plugins.components.",
|
|
763
|
+
},
|
|
764
|
+
],
|
|
765
|
+
precheck: (i, ctx) => precheckBy(() => this.assertNotOtherOrgs(i.kind, i.componentId, ctx.orgId)),
|
|
766
|
+
summary: async (i) => {
|
|
767
|
+
const kind = i.kind;
|
|
768
|
+
const n = await this.adminName(kind, i.componentId);
|
|
769
|
+
return i.shownToOthers
|
|
770
|
+
? {
|
|
771
|
+
zh: `向其他组织展示${LABEL[kind].zh}「${n}」`,
|
|
772
|
+
en: `Show ${LABEL[kind].en} "${n}" to other orgs`,
|
|
773
|
+
}
|
|
774
|
+
: {
|
|
775
|
+
zh: `对其他组织隐藏${LABEL[kind].zh}「${n}」`,
|
|
776
|
+
en: `Hide ${LABEL[kind].en} "${n}" from other orgs`,
|
|
777
|
+
};
|
|
778
|
+
},
|
|
779
|
+
run: async (i, ctx) => {
|
|
780
|
+
await this.assertNotOtherOrgs(i.kind, i.componentId, ctx.orgId);
|
|
781
|
+
return {
|
|
782
|
+
component: await this.withOrgNames(await this.components.setShown(ctx.actorAccountId, i.kind, i.componentId, i.shownToOthers, { auditDetail: viaAgent("plugins.set-component-shown", ctx) })),
|
|
783
|
+
};
|
|
784
|
+
},
|
|
785
|
+
}),
|
|
786
|
+
defineOperation({
|
|
787
|
+
id: "plugins.update-agent-template",
|
|
788
|
+
description: "Publish a new version of a platform agent template on its own (super admin): content is the template markdown file, which must keep the template's name. It serves in orgs at once. Takes the template id from plugins.components with kind agent_template.",
|
|
789
|
+
input: ComponentTemplateVersionSchema.extend({ templateId: Id }).strict(),
|
|
790
|
+
example: {
|
|
791
|
+
templateId: EXAMPLE_ID,
|
|
792
|
+
content: "---\nname: support-triage\n---\nTriage requests.",
|
|
793
|
+
},
|
|
794
|
+
authz: { superAdmin: true },
|
|
795
|
+
mirrors: ["POST /api/v1/admin/components/agent_template/:id/versions"],
|
|
796
|
+
renames: { templateId: "id" },
|
|
797
|
+
confirm: "platform",
|
|
798
|
+
errors: [
|
|
799
|
+
{
|
|
800
|
+
code: "component.not_found",
|
|
801
|
+
next: "Check the component id and kind with plugins.components.",
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
code: "validation_failed",
|
|
805
|
+
next: "Fix the template file as the message says; it must keep the template's name.",
|
|
806
|
+
},
|
|
807
|
+
],
|
|
808
|
+
precheck: (i, ctx) => precheckBy(() => this.assertNotOtherOrgs("agent_template", i.templateId, ctx.orgId)),
|
|
809
|
+
summary: async (i) => {
|
|
810
|
+
const n = await this.adminName("agent_template", i.templateId);
|
|
811
|
+
return {
|
|
812
|
+
zh: `发布平台智能体模板「${n}」的新版本`,
|
|
813
|
+
en: `Publish a new version of platform agent template "${n}"`,
|
|
814
|
+
};
|
|
815
|
+
},
|
|
816
|
+
run: async (i, ctx) => {
|
|
817
|
+
await this.assertNotOtherOrgs("agent_template", i.templateId, ctx.orgId);
|
|
818
|
+
return this.platformComponents.uploadAgentTemplateVersion({
|
|
819
|
+
accountId: ctx.actorAccountId,
|
|
820
|
+
auditDetail: viaAgent("plugins.update-agent-template", ctx),
|
|
821
|
+
}, i.templateId, i.content);
|
|
822
|
+
},
|
|
823
|
+
}),
|
|
824
|
+
defineOperation({
|
|
825
|
+
id: "plugins.component-versions",
|
|
826
|
+
description: "List a platform component's versions, newest first (super admin): version, the plugin version it came from, and whether it was updated on its own. A connector template keeps only its current version. Takes the component id from plugins.components.",
|
|
827
|
+
input: z.object({ kind: ComponentParams.shape.kind, componentId: Id }).strict(),
|
|
828
|
+
example: { kind: "skill", componentId: EXAMPLE_ID },
|
|
829
|
+
authz: { superAdmin: true },
|
|
830
|
+
mirrors: ["GET /api/v1/admin/components/:kind/:id/versions"],
|
|
831
|
+
renames: { componentId: "id" },
|
|
832
|
+
confirm: "read",
|
|
833
|
+
errors: [
|
|
834
|
+
{
|
|
835
|
+
code: "component.not_found",
|
|
836
|
+
next: "Check the component id and kind with plugins.components.",
|
|
837
|
+
},
|
|
838
|
+
],
|
|
839
|
+
run: async (input) => ({
|
|
840
|
+
versions: await this.components.versions(input.kind, input.componentId),
|
|
841
|
+
}),
|
|
842
|
+
}),
|
|
843
|
+
]);
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
ComponentsOperations = __decorate([
|
|
847
|
+
Injectable(),
|
|
848
|
+
__param(0, Inject(PlatformOperations)),
|
|
849
|
+
__param(1, Inject(ComponentScopeService)),
|
|
850
|
+
__param(2, Inject(PlatformComponents)),
|
|
851
|
+
__param(3, Inject(KernelDb))
|
|
852
|
+
], ComponentsOperations);
|
|
853
|
+
export { ComponentsOperations };
|