@capybara-hq/kernel 0.1.0-rc.84 → 0.1.0-rc.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/admin.module.js +5 -0
- package/dist/admin/health.service.d.ts +2 -2
- package/dist/admin/health.service.js +10 -2
- package/dist/catalog/admin-catalog.controller.d.ts +2 -1
- package/dist/catalog/admin-catalog.controller.js +2 -1
- package/dist/catalog/catalog-content.d.ts +5 -15
- package/dist/catalog/catalog-content.js +5 -56
- package/dist/catalog/catalog-scope.service.d.ts +3 -3
- package/dist/catalog/catalog-scope.service.js +4 -3
- package/dist/catalog/catalog.module.d.ts +3 -1
- package/dist/catalog/catalog.module.js +14 -1
- package/dist/catalog/component-scope.service.d.ts +6 -1
- package/dist/catalog/component-scope.service.js +16 -2
- package/dist/catalog/job-ids.d.ts +29 -0
- package/dist/catalog/job-ids.js +29 -0
- package/dist/catalog/jobs.d.ts +12 -3
- package/dist/catalog/jobs.js +28 -7
- package/dist/catalog/org-catalog.controller.d.ts +2 -30
- package/dist/catalog/org-catalog.controller.js +3 -29
- package/dist/catalog/org-catalog.schemas.d.ts +9 -46
- package/dist/catalog/org-catalog.schemas.js +9 -23
- package/dist/catalog/org-catalog.service.js +14 -23
- package/dist/catalog/plugin-import.d.ts +21 -0
- package/dist/catalog/plugin-import.js +33 -3
- package/dist/catalog/plugin-install.d.ts +69 -76
- package/dist/catalog/plugin-install.js +156 -234
- package/dist/catalog/plugin-upgrade.d.ts +71 -11
- package/dist/catalog/plugin-upgrade.js +222 -43
- package/dist/catalog/scope-sync.d.ts +22 -20
- package/dist/catalog/scope-sync.js +57 -42
- package/dist/catalog/template-connector-ensure.d.ts +100 -0
- package/dist/catalog/template-connector-ensure.js +285 -0
- package/dist/catalog/template-connector-jobs.d.ts +28 -0
- package/dist/catalog/template-connector-jobs.js +54 -0
- package/dist/catalog/template-connector-reconcile.d.ts +44 -0
- package/dist/catalog/template-connector-reconcile.js +114 -0
- package/dist/catalog/template-connectors.processor.d.ts +32 -0
- package/dist/catalog/template-connectors.processor.js +101 -0
- package/dist/db/kernel-schema.d.ts +2 -1
- package/dist/extensions/org-config.d.ts +6 -1
- package/dist/extensions/org-config.js +15 -2
- package/dist/git/gateway.js +3 -1
- package/dist/infra/outbox/registry.d.ts +28 -0
- package/dist/infra/outbox/registry.js +33 -0
- package/dist/infra/queue/queue-names.d.ts +1 -1
- package/dist/infra/queue/queue-names.js +2 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +8 -1
- package/dist/lifecycle/kernel-lifecycle.js +37 -11
- package/dist/orgs/org-owner.d.ts +7 -0
- package/dist/orgs/org-owner.js +16 -0
- package/dist/platform/operation.d.ts +3 -4
- package/dist/platform/ops/connectors.ops.js +8 -1
- package/dist/platform/ops/org-plugins.ops.d.ts +0 -9
- package/dist/platform/ops/org-plugins.ops.js +18 -235
- package/dist/platform/ops/plugins.ops.d.ts +0 -1
- package/dist/platform/ops/plugins.ops.js +3 -31
- package/dist/roles/worker-role.d.ts +9 -4
- package/dist/roles/worker-role.js +18 -5
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +8 -1
- package/dist/setup/setup-guides.service.d.ts +9 -1
- package/dist/setup/setup-guides.service.js +38 -8
- package/dist/tools/admin-connectors.d.ts +3 -2
- package/dist/tools/admin-connectors.js +5 -4
- package/dist/tools/connector-setup.d.ts +28 -0
- package/dist/tools/connector-setup.js +33 -0
- package/dist/tools/connector-tools-jobs.d.ts +35 -0
- package/dist/tools/connector-tools-jobs.js +40 -0
- package/dist/tools/connector-tools.processor.d.ts +32 -0
- package/dist/tools/connector-tools.processor.js +97 -0
- package/dist/tools/connectors.controller.d.ts +1 -0
- package/dist/tools/connectors.schemas.d.ts +1 -0
- package/dist/tools/connectors.schemas.js +5 -0
- package/dist/tools/connectors.service.d.ts +138 -14
- package/dist/tools/connectors.service.js +410 -50
- package/dist/tools/credentials.d.ts +35 -0
- package/dist/tools/credentials.js +89 -1
- package/dist/tools/drift.d.ts +5 -0
- package/dist/tools/drift.js +21 -2
- package/dist/tools/editable-endpoint.d.ts +23 -0
- package/dist/tools/editable-endpoint.js +92 -0
- package/dist/tools/oauth/flow.d.ts +1 -1
- package/dist/tools/oauth/flow.js +3 -2
- package/dist/tools/pipeline.js +14 -5
- package/dist/tools/registry.d.ts +14 -2
- package/dist/tools/registry.js +27 -6
- package/dist/tools/tools.module.js +4 -0
- package/package.json +2 -2
- package/src/migrations/0183_connectors_created_by_nullable.sql +5 -0
|
@@ -11,7 +11,7 @@ import { Inject, Injectable } from "@nestjs/common";
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { AppearanceService } from "../../catalog/appearance.service.js";
|
|
13
13
|
import { CatalogScopeService } from "../../catalog/catalog-scope.service.js";
|
|
14
|
-
import {
|
|
14
|
+
import { CatalogItemPathParams, OrgPluginInstallBody, PluginInstallPathParams, } from "../../catalog/org-catalog.schemas.js";
|
|
15
15
|
import { OrgCatalogService } from "../../catalog/org-catalog.service.js";
|
|
16
16
|
import { OrgExtensionParams } from "../../catalog/org-extension.schemas.js";
|
|
17
17
|
import { OrgPluginUploads } from "../../catalog/org-plugin-uploads.js";
|
|
@@ -22,102 +22,24 @@ import { ApiError } from "../../errors.js";
|
|
|
22
22
|
import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
23
23
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
24
24
|
import { ThemesService } from "../../themes/themes.service.js";
|
|
25
|
-
import { clientProblem, headersWebOnly, templateConnectorInput, templatePersonFields, } from "../connector-person-fields.js";
|
|
26
25
|
import { FileRefSchema } from "../file-ref.js";
|
|
27
|
-
import { defineOperation
|
|
28
|
-
import { personFieldParams } from "../person-fields.js";
|
|
26
|
+
import { defineOperation } from "../operation.js";
|
|
29
27
|
import { PlatformOperations } from "../registry.js";
|
|
30
28
|
import { appearanceSummary, reviewBrief } from "./catalog-admin.ops.js";
|
|
31
29
|
import { precheckBy, viaAgent } from "./errors.js";
|
|
32
30
|
import { Cursor, pageOf, startOf } from "./paging.js";
|
|
33
|
-
import { afterTaken, takePersonInputs } from "./person-inputs.js";
|
|
34
31
|
import { localized, named, orElse } from "./summary.js";
|
|
35
32
|
const InstallId = PluginInstallPathParams.shape.installId.max(100);
|
|
36
33
|
/** An org-owned plugin's catalog item id (`:id` of the owned-plugins routes). */
|
|
37
34
|
const OwnedId = OrgOwnedPluginParams.shape.id;
|
|
38
35
|
const EXAMPLE_ID = "3f1c2a9e-5b7d-4e21-9c0a-1d2e3f4a5b6c";
|
|
39
36
|
const ItemId = CatalogItemPathParams.shape.itemId.max(100);
|
|
40
|
-
/**
|
|
41
|
-
* The model's input for one connector template (the install's and configure's `connectors` entry
|
|
42
|
-
* without its secrets): name, slug, the endpoint fields the template lets the org edit, and an
|
|
43
|
-
* OAuth client's id. The credential and the client secret are person fields.
|
|
44
|
-
*/
|
|
45
|
-
const TemplateInput = CatalogConnectorInput.pick({ name: true, slug: true, endpoint: true })
|
|
46
|
-
.extend({
|
|
47
|
-
client: z
|
|
48
|
-
.object({ clientId: z.string().min(1).max(500) })
|
|
49
|
-
.strict()
|
|
50
|
-
.optional(),
|
|
51
|
-
})
|
|
52
|
-
.strict();
|
|
53
|
-
const Templates = z
|
|
54
|
-
.record(z.string().min(1).max(100), TemplateInput)
|
|
55
|
-
.refine((v) => Object.keys(v).length <= 50, { message: "Too many connector templates" });
|
|
56
37
|
const InstallInput = z
|
|
57
38
|
.object({
|
|
58
39
|
itemId: ItemId,
|
|
59
|
-
|
|
60
|
-
templatesOn: OrgPluginInstallBody.shape.templatesOn.describe("The connector template ids to switch on with the install (the web wizard's choose step): exactly these make connectors, the plugin's other templates are switched off in the org and stay available on the connectors page. Omit to take the templates on in the org now (default-on ones, and default-off ones an admin switched on)."),
|
|
61
|
-
askPerson: personFieldParams.askPerson,
|
|
62
|
-
})
|
|
63
|
-
.strict();
|
|
64
|
-
const ConfigureInput = z
|
|
65
|
-
.object({
|
|
66
|
-
itemId: ItemId,
|
|
67
|
-
templates: Templates.describe("Per missing connector template id (plugins.get shows the plugin needs_config), the connector's name, slug, endpoint fields and OAuth client id; never a credential. Name every template to create, even with {}."),
|
|
68
|
-
askPerson: personFieldParams.askPerson,
|
|
40
|
+
templatesOn: OrgPluginInstallBody.shape.templatesOn.describe("The connector template ids to switch on with the install: exactly these make connectors, the plugin's other templates are switched off in the org and stay available on the connectors page. Omit to take the templates on in the org now (default-on ones, and default-off ones an admin switched on)."),
|
|
69
41
|
})
|
|
70
42
|
.strict();
|
|
71
|
-
/** The card's person-field paths, from the plan (`personAsk`). */
|
|
72
|
-
const entersText = (ctx) => {
|
|
73
|
-
const ask = ctx.personAsk ?? [];
|
|
74
|
-
return ask.length === 0
|
|
75
|
-
? { zh: "", en: "" }
|
|
76
|
-
: { zh: `;由本人填写 ${ask.join("、")}`, en: `; the person enters ${ask.join(", ")}` };
|
|
77
|
-
};
|
|
78
|
-
/** A template as the person-field helpers take it. */
|
|
79
|
-
const targetOf = (t) => ({
|
|
80
|
-
id: t.id,
|
|
81
|
-
name: {
|
|
82
|
-
zh: named(t.displayName?.zh ?? t.displayName?.en ?? t.id),
|
|
83
|
-
en: named(t.displayName?.en ?? t.id),
|
|
84
|
-
},
|
|
85
|
-
auth: t.auth,
|
|
86
|
-
});
|
|
87
|
-
/**
|
|
88
|
-
* The refusal of a template input the card cannot complete, or ok: a credential the card cannot
|
|
89
|
-
* ask for (custom headers), an OAuth client without its id, or a client for a template that takes
|
|
90
|
-
* none.
|
|
91
|
-
*/
|
|
92
|
-
function templatesRefusal(templates, params) {
|
|
93
|
-
for (const t of templates) {
|
|
94
|
-
const where = `Connector template ${t.name.en} (${t.id})`;
|
|
95
|
-
const why = headersWebOnly(t.auth, where);
|
|
96
|
-
if (why !== null)
|
|
97
|
-
return { ok: false, code: "platform.secret_record_web_only", message: why };
|
|
98
|
-
const client = clientProblem(t.auth, params?.[t.id]?.client, where);
|
|
99
|
-
if (client !== null)
|
|
100
|
-
return { ok: false, code: "validation_failed", message: client };
|
|
101
|
-
}
|
|
102
|
-
return { ok: true };
|
|
103
|
-
}
|
|
104
|
-
/** The `connectors` body of the install and configure routes: params plus entered values. */
|
|
105
|
-
function connectorInputs(templates, params, entered) {
|
|
106
|
-
const out = {};
|
|
107
|
-
for (const t of templates) {
|
|
108
|
-
const given = params?.[t.id];
|
|
109
|
-
const hasEntered = Object.keys(entered).some((p) => p.startsWith(`connectors.${t.id}.`));
|
|
110
|
-
if (given === undefined && !hasEntered)
|
|
111
|
-
continue;
|
|
112
|
-
out[t.id] = templateConnectorInput(t, given, entered);
|
|
113
|
-
}
|
|
114
|
-
// a template the plan does not know (not on here) goes to the service as given: it refuses it
|
|
115
|
-
for (const [id, given] of Object.entries(params ?? {})) {
|
|
116
|
-
if (!(id in out) && !templates.some((t) => t.id === id))
|
|
117
|
-
out[id] = { ...given };
|
|
118
|
-
}
|
|
119
|
-
return Object.keys(out).length === 0 ? undefined : out;
|
|
120
|
-
}
|
|
121
43
|
/** One of the org's plugin installs as `plugins.installs` shows it: a compact row. */
|
|
122
44
|
const installRow = (i) => ({
|
|
123
45
|
id: i.id,
|
|
@@ -176,41 +98,6 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
176
98
|
this.themes = themes;
|
|
177
99
|
this.config = config;
|
|
178
100
|
}
|
|
179
|
-
/**
|
|
180
|
-
* What installing a plugin asks the person for (platform web parity spec §7.2): the connector
|
|
181
|
-
* templates whose connector the install creates (on in the org, none kept from an earlier
|
|
182
|
-
* switch-off, as the install wizard asks). The extension's config for the org is its copy of the
|
|
183
|
-
* overridable fields, saved apart (`extensions.save-org-config`).
|
|
184
|
-
*/
|
|
185
|
-
async installTargets(ctx, itemId, templatesOn) {
|
|
186
|
-
const d = await this.orgCatalog.detail(ctx.orgId, ctx.actorAccountId, itemId);
|
|
187
|
-
const templates = d.templates
|
|
188
|
-
.filter((t) => (templatesOn === undefined ? t.on : templatesOn.includes(t.id)))
|
|
189
|
-
.filter((t) => !t.connected)
|
|
190
|
-
.map(targetOf);
|
|
191
|
-
return {
|
|
192
|
-
item: d.item,
|
|
193
|
-
templates,
|
|
194
|
-
target: {
|
|
195
|
-
target: {
|
|
196
|
-
zh: `插件「${localized(d.item.displayName, d.item.name).zh}」的安装`,
|
|
197
|
-
en: `${localized(d.item.displayName, d.item.name).en}: install`,
|
|
198
|
-
},
|
|
199
|
-
fields: templatePersonFields(templates),
|
|
200
|
-
recordOnly: [],
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
/** The missing connectors of an installed plugin that a configure call names. */
|
|
205
|
-
async configureTargets(ctx, itemId, named) {
|
|
206
|
-
const missing = await this.installer.missingConnectors(ctx.orgId, itemId);
|
|
207
|
-
if (missing === undefined) {
|
|
208
|
-
throw new ApiError("plugin.install_not_found", "The plugin is not installed in this org");
|
|
209
|
-
}
|
|
210
|
-
return missing.templates
|
|
211
|
-
.filter((t) => named.includes(t.id))
|
|
212
|
-
.map((t) => targetOf({ id: t.id, displayName: t.file.displayName, auth: t.file.template.auth }));
|
|
213
|
-
}
|
|
214
101
|
/** The display name of the live plugin of `extension`, or the name when it cannot be read. */
|
|
215
102
|
pluginNames(extension) {
|
|
216
103
|
return orElse(async () => {
|
|
@@ -584,20 +471,13 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
584
471
|
}),
|
|
585
472
|
defineOperation({
|
|
586
473
|
id: "plugins.install",
|
|
587
|
-
description: "Install a plugin in this org
|
|
474
|
+
description: "Install a plugin in this org (org admins), optionally choosing which of its connector templates to switch on (templatesOn). It asks for no input: each connector template on becomes a connector, and one that needs an org credential or OAuth client waits as needs_config until an org admin configures it on the connectors page (connectors.list shows setup). The extension's config for the org is its copy of the overridable fields (extensions.save-org-config). plugins.set-enabled switches a plugin on with the templates on in the org now.",
|
|
588
475
|
input: InstallInput,
|
|
589
|
-
example: {
|
|
590
|
-
itemId: EXAMPLE_ID,
|
|
591
|
-
templates: { github: { endpoint: { url: "https://api.githubcopilot.com/mcp/" } } },
|
|
592
|
-
askPerson: ["connectors.github.credential.token"],
|
|
593
|
-
},
|
|
476
|
+
example: { itemId: EXAMPLE_ID },
|
|
594
477
|
// the route needs catalog.read; the service re-checks the plugin's component actions
|
|
595
478
|
authz: { orgAction: "org.extensions.manage" },
|
|
596
479
|
authzNote: "service-enforced",
|
|
597
480
|
mirrors: ["POST /api/v1/orgs/:orgId/catalog/:itemId/install"],
|
|
598
|
-
// the route's connectors carry credentials: templates holds the rest, secrets are person fields
|
|
599
|
-
omits: ["connectors"],
|
|
600
|
-
extras: ["templates", "askPerson"],
|
|
601
481
|
confirm: "org",
|
|
602
482
|
errors: [
|
|
603
483
|
{ code: "catalog.item_not_found", next: "Check the plugin id with plugins.list." },
|
|
@@ -607,7 +487,7 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
607
487
|
},
|
|
608
488
|
{
|
|
609
489
|
code: "plugin.install_failed",
|
|
610
|
-
next: "The install failed at the step its details name and was rolled back;
|
|
490
|
+
next: "The install failed at the step its details name and was rolled back; tell the person what failed.",
|
|
611
491
|
},
|
|
612
492
|
{
|
|
613
493
|
code: "catalog.not_deployed",
|
|
@@ -615,126 +495,29 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
615
495
|
},
|
|
616
496
|
{
|
|
617
497
|
code: "validation_failed",
|
|
618
|
-
next: "The error's details name the
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
code: "platform.secret_record_web_only",
|
|
622
|
-
next: "Tell the person to finish this on the Plugins page on the web.",
|
|
498
|
+
next: "The error's details name the field (templatesOn); correct the params and call again.",
|
|
623
499
|
},
|
|
624
500
|
],
|
|
625
|
-
precheck: async (i, ctx) => {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
});
|
|
630
|
-
if (!read.ok || r === undefined)
|
|
631
|
-
return read;
|
|
632
|
-
if (r.item.installed !== null) {
|
|
633
|
-
return {
|
|
634
|
-
ok: false,
|
|
635
|
-
code: "plugin.already_installed",
|
|
636
|
-
message: `Plugin ${r.item.name} is installed in this org already`,
|
|
637
|
-
};
|
|
501
|
+
precheck: async (i, ctx) => precheckBy(async () => {
|
|
502
|
+
const d = await this.orgCatalog.detail(ctx.orgId, ctx.actorAccountId, i.itemId);
|
|
503
|
+
if (d.item.installed !== null) {
|
|
504
|
+
throw new ApiError("plugin.already_installed", `Plugin ${d.item.name} is installed in this org already`);
|
|
638
505
|
}
|
|
639
|
-
|
|
640
|
-
},
|
|
641
|
-
personFields: async (i, ctx) => (await this.installTargets(ctx, i.itemId, i.templatesOn)).target,
|
|
506
|
+
}),
|
|
642
507
|
summary: async (i, ctx) => {
|
|
643
|
-
const
|
|
644
|
-
const n = localized(item.displayName, item.name);
|
|
645
|
-
const
|
|
508
|
+
const d = await this.orgCatalog.detail(ctx.orgId, ctx.actorAccountId, i.itemId);
|
|
509
|
+
const n = localized(d.item.displayName, d.item.name);
|
|
510
|
+
const templates = d.templates.filter((t) => i.templatesOn === undefined ? t.on : i.templatesOn.includes(t.id)).length;
|
|
646
511
|
return {
|
|
647
|
-
zh: `在本组织安装插件「${n.zh}」${item.latestVersion}(${templates
|
|
648
|
-
en: `Install plugin "${n.en}" ${item.latestVersion} in the org (${templates
|
|
512
|
+
zh: `在本组织安装插件「${n.zh}」${d.item.latestVersion}(${templates} 个连接器)`,
|
|
513
|
+
en: `Install plugin "${n.en}" ${d.item.latestVersion} in the org (${templates} connectors)`,
|
|
649
514
|
};
|
|
650
515
|
},
|
|
651
516
|
run: async (input, ctx) => {
|
|
652
|
-
const
|
|
653
|
-
// the install runs steps in transactions of their own under the org row lock, so the
|
|
654
|
-
// values are taken first (takePersonInputs)
|
|
655
|
-
const { entered, auditDetail } = await takePersonInputs("plugins.install", ctx);
|
|
656
|
-
const connectors = connectorInputs(templates, input.templates, entered);
|
|
657
|
-
const r = await this.orgCatalog
|
|
658
|
-
.install(ctx.orgId, ctx.actorAccountId, input.itemId, {
|
|
659
|
-
...(connectors !== undefined && { connectors }),
|
|
660
|
-
...(input.templatesOn !== undefined && { templatesOn: input.templatesOn }),
|
|
661
|
-
}, undefined, auditDetail)
|
|
662
|
-
.catch((e) => {
|
|
663
|
-
throw afterTaken(e, entered);
|
|
664
|
-
});
|
|
517
|
+
const r = await this.orgCatalog.install(ctx.orgId, ctx.actorAccountId, input.itemId, input.templatesOn !== undefined ? { templatesOn: input.templatesOn } : {}, undefined, viaAgent("plugins.install", ctx));
|
|
665
518
|
return { installed: r.installed, install: installRow(r.install) };
|
|
666
519
|
},
|
|
667
520
|
}),
|
|
668
|
-
defineOperation({
|
|
669
|
-
id: "plugins.configure-connectors",
|
|
670
|
-
description: "Create the connectors an installed plugin is missing (org admins; the plugin shows needs_config, e.g. after a platform update added a connector template): per missing template its name, slug, endpoint fields and OAuth client id (templates). Credentials are never params: the person enters them in a secure input request at connectors.<templateId>.credential.token (or .credential.username / .credential.password, .client.clientSecret). Required ones are asked even when not listed in askPerson.",
|
|
671
|
-
input: ConfigureInput,
|
|
672
|
-
example: {
|
|
673
|
-
itemId: EXAMPLE_ID,
|
|
674
|
-
templates: { github: {} },
|
|
675
|
-
askPerson: ["connectors.github.credential.token"],
|
|
676
|
-
},
|
|
677
|
-
authz: { orgAction: "connectors.manage" },
|
|
678
|
-
mirrors: ["POST /api/v1/orgs/:orgId/catalog/:itemId/connectors"],
|
|
679
|
-
// the route's inputs.connectors carry credentials: templates holds the rest
|
|
680
|
-
omits: ["inputs"],
|
|
681
|
-
extras: ["templates", "askPerson"],
|
|
682
|
-
confirm: "org",
|
|
683
|
-
errors: [
|
|
684
|
-
{
|
|
685
|
-
code: "plugin.install_not_found",
|
|
686
|
-
next: "The plugin is not installed in this org; install it with plugins.install.",
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
code: "validation_failed",
|
|
690
|
-
next: "The error's details name the fields (connectors.<templateId>.…); correct the params and call again.",
|
|
691
|
-
},
|
|
692
|
-
{
|
|
693
|
-
code: "platform.secret_record_web_only",
|
|
694
|
-
next: "Tell the person to finish this on the Plugins page on the web.",
|
|
695
|
-
},
|
|
696
|
-
],
|
|
697
|
-
precheck: async (i, ctx) => {
|
|
698
|
-
let templates = [];
|
|
699
|
-
const read = await precheckBy(async () => {
|
|
700
|
-
templates = await this.configureTargets(ctx, i.itemId, Object.keys(i.templates));
|
|
701
|
-
});
|
|
702
|
-
return read.ok ? templatesRefusal(templates, i.templates) : read;
|
|
703
|
-
},
|
|
704
|
-
personFields: async (i, ctx) => {
|
|
705
|
-
const templates = await this.configureTargets(ctx, i.itemId, Object.keys(i.templates));
|
|
706
|
-
return {
|
|
707
|
-
target: { zh: "插件缺少的连接器", en: "Plugin: missing connectors" },
|
|
708
|
-
fields: templatePersonFields(templates),
|
|
709
|
-
};
|
|
710
|
-
},
|
|
711
|
-
summary: async (i, ctx) => {
|
|
712
|
-
const n = await orElse(async () => {
|
|
713
|
-
const d = await this.orgCatalog.detail(ctx.orgId, ctx.actorAccountId, i.itemId);
|
|
714
|
-
return localized(d.item.displayName, d.item.name);
|
|
715
|
-
}, { zh: named(i.itemId), en: named(i.itemId) });
|
|
716
|
-
const ids = Object.keys(i.templates).map(named).join(", ");
|
|
717
|
-
const e = entersText(ctx);
|
|
718
|
-
return {
|
|
719
|
-
zh: `为插件「${n.zh}」创建缺少的连接器 ${ids}${e.zh}`,
|
|
720
|
-
en: `Create the missing connectors ${ids} of plugin "${n.en}"${e.en}`,
|
|
721
|
-
};
|
|
722
|
-
},
|
|
723
|
-
run: async (input, ctx) => {
|
|
724
|
-
const templates = await this.configureTargets(ctx, input.itemId, Object.keys(input.templates));
|
|
725
|
-
// each connector is created and recorded in transactions of its own (as the route)
|
|
726
|
-
const { entered, auditDetail } = await takePersonInputs("plugins.configure-connectors", ctx);
|
|
727
|
-
return {
|
|
728
|
-
connectors: await this.installer
|
|
729
|
-
.configureConnectors(ctx.orgId, ctx.actorAccountId, input.itemId, {
|
|
730
|
-
connectors: connectorInputs(templates, input.templates, entered) ?? {},
|
|
731
|
-
}, { auditDetail })
|
|
732
|
-
.catch((e) => {
|
|
733
|
-
throw afterTaken(e, entered);
|
|
734
|
-
}),
|
|
735
|
-
};
|
|
736
|
-
},
|
|
737
|
-
}),
|
|
738
521
|
]);
|
|
739
522
|
}
|
|
740
523
|
};
|
|
@@ -8,7 +8,6 @@ import { ExtensionAvailability } from "../../extensions/unavailable.js";
|
|
|
8
8
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
9
9
|
import { PlatformOperations } from "../registry.js";
|
|
10
10
|
export { OTHER_ORG } from "./other-orgs.js";
|
|
11
|
-
export declare const NEEDS_INPUT = "This plugin needs connector input (endpoints, credentials): install it with plugins.install, or for an installed plugin missing connectors create them with plugins.configure-connectors; the person enters the credentials in a secure input request.";
|
|
12
11
|
/**
|
|
13
12
|
* What `plugins.set-enabled` adds to its result when the plugin is on but its extension's
|
|
14
13
|
* effective config for the org is not valid yet (switching on never waits for it, as on the web).
|
|
@@ -40,7 +40,6 @@ export { OTHER_ORG } from "./other-orgs.js";
|
|
|
40
40
|
const LOCKED = "This plugin is on for every org (or shipped with the platform) and cannot be switched off in one org.";
|
|
41
41
|
/** The confirm value of switching off a plugin with nothing installed in the org. */
|
|
42
42
|
const NOTHING_INSTALLED = "nothing-installed";
|
|
43
|
-
export const NEEDS_INPUT = "This plugin needs connector input (endpoints, credentials): install it with plugins.install, or for an installed plugin missing connectors create them with plugins.configure-connectors; the person enters the credentials in a secure input request.";
|
|
44
43
|
/**
|
|
45
44
|
* What `plugins.set-enabled` adds to its result when the plugin is on but its extension's
|
|
46
45
|
* effective config for the org is not valid yet (switching on never waits for it, as on the web).
|
|
@@ -84,19 +83,6 @@ const row = (i, role) => ({
|
|
|
84
83
|
switchable: i.switchable,
|
|
85
84
|
request: i.request,
|
|
86
85
|
});
|
|
87
|
-
/**
|
|
88
|
-
* Why switching the plugin on needs input first, as the `plugin.needs_input` message, or null:
|
|
89
|
-
* connector input only (an installed plugin whose connector template misses its connector, or a
|
|
90
|
-
* plugin not installed yet that has connector templates: `plugins.install`,
|
|
91
|
-
* `plugins.configure-connectors`). Its extension's config never blocks the switch, as on the web
|
|
92
|
-
* and the route: the plugin goes on and its extension stays `needsConfig` until the org's copy
|
|
93
|
-
* (or the platform config) is valid ({@link configStillNeeded}).
|
|
94
|
-
*/
|
|
95
|
-
function needsInput(item) {
|
|
96
|
-
if (item.installed !== null)
|
|
97
|
-
return item.state === "needs_config" ? NEEDS_INPUT : null;
|
|
98
|
-
return item.componentCounts.connectorTemplates > 0 ? NEEDS_INPUT : null;
|
|
99
|
-
}
|
|
100
86
|
/** The note for a plugin switched on whose extension's effective config is not valid, or null. */
|
|
101
87
|
function configStillNeeded(item, extensions) {
|
|
102
88
|
const own = extensions.find((e) => e.catalogItem?.itemId === item.id);
|
|
@@ -213,7 +199,7 @@ let PluginsOperations = class PluginsOperations {
|
|
|
213
199
|
}),
|
|
214
200
|
defineOperation({
|
|
215
201
|
id: "plugins.set-enabled",
|
|
216
|
-
description: "Switch a plugin on or off in this org. Switching on installs it
|
|
202
|
+
description: "Switch a plugin on or off in this org. Switching on installs it without asking for input: each connector template on becomes a connector, and one that needs an org credential or OAuth client waits as needs_config until an org admin configures it on the connectors page. A plugin whose extension has no valid config for the org yet is switched on anyway, and the result's configNeeded says how to fill in the org's copy (extensions.save-org-config). Switching off removes what the plugin brought and needs confirm: the value plugins.disable-preview returned with the preview the person saw.",
|
|
217
203
|
input: z.discriminatedUnion("enabled", [
|
|
218
204
|
z.object({ itemId: ItemId, enabled: z.literal(true) }).strict(),
|
|
219
205
|
z.object({ itemId: ItemId, enabled: z.literal(false), confirm: Confirm }).strict(),
|
|
@@ -224,8 +210,8 @@ let PluginsOperations = class PluginsOperations {
|
|
|
224
210
|
authz: { orgAction: "org.extensions.manage" },
|
|
225
211
|
authzNote: "service-enforced",
|
|
226
212
|
mirrors: ["PUT /api/v1/orgs/:orgId/catalog/:itemId/switch"],
|
|
213
|
+
// the route's inputs choose the connector templates: plugins.install takes that choice
|
|
227
214
|
omits: ["inputs"],
|
|
228
|
-
withoutSecrets: "a plugin that needs install inputs is refused here; plugins.install takes them, its secrets entered by the person on the card",
|
|
229
215
|
loosens: {
|
|
230
216
|
confirm: "also takes `nothing-installed` (plugins.disable-preview's value when nothing is installed), which the route's hash pattern rejects; the service checks confirm only when something is installed",
|
|
231
217
|
},
|
|
@@ -251,10 +237,6 @@ let PluginsOperations = class PluginsOperations {
|
|
|
251
237
|
code: "catalog.item_not_found",
|
|
252
238
|
next: "Check the plugin id with plugins.list.",
|
|
253
239
|
},
|
|
254
|
-
{
|
|
255
|
-
code: "plugin.needs_input",
|
|
256
|
-
next: "The plugin needs connector input: install it with plugins.install (or plugins.configure-connectors once installed), the person entering the credentials on the card.",
|
|
257
|
-
},
|
|
258
240
|
{
|
|
259
241
|
code: "catalog.approval_required",
|
|
260
242
|
next: "The plugin is not offered to this org: create an access request with requests.create.",
|
|
@@ -273,8 +255,7 @@ let PluginsOperations = class PluginsOperations {
|
|
|
273
255
|
},
|
|
274
256
|
],
|
|
275
257
|
// what is known to fail before the card: an unknown plugin, switching off a locked one,
|
|
276
|
-
// switching on one whose extension cannot run (with the role's next step naming it)
|
|
277
|
-
// that needs a person's input
|
|
258
|
+
// switching on one whose extension cannot run (with the role's next step naming it)
|
|
278
259
|
precheck: async (i, ctx) => {
|
|
279
260
|
const [item] = UUID_RE.test(i.itemId)
|
|
280
261
|
? await this.orgCatalog.list(ctx.orgId, ctx.actorAccountId, i.itemId)
|
|
@@ -294,9 +275,6 @@ let PluginsOperations = class PluginsOperations {
|
|
|
294
275
|
next: unavailableNext(item.reason, name),
|
|
295
276
|
};
|
|
296
277
|
}
|
|
297
|
-
const missing = i.enabled ? needsInput(item) : null;
|
|
298
|
-
if (missing !== null)
|
|
299
|
-
return { ok: false, code: "plugin.needs_input", message: missing };
|
|
300
278
|
return { ok: true };
|
|
301
279
|
},
|
|
302
280
|
summary: async (i, ctx) => {
|
|
@@ -322,12 +300,6 @@ let PluginsOperations = class PluginsOperations {
|
|
|
322
300
|
};
|
|
323
301
|
},
|
|
324
302
|
run: async (input, ctx) => {
|
|
325
|
-
if (input.enabled) {
|
|
326
|
-
const [item] = await this.orgCatalog.list(ctx.orgId, ctx.actorAccountId, input.itemId);
|
|
327
|
-
const missing = item ? needsInput(item) : null;
|
|
328
|
-
if (missing !== null)
|
|
329
|
-
throw new ToolError(missing);
|
|
330
|
-
}
|
|
331
303
|
const r = await this.orgCatalog.setSwitch(ctx.orgId, ctx.actorAccountId, input.itemId, input.enabled ? { enabled: true } : { enabled: false, confirm: input.confirm }, undefined, viaAgent("plugins.set-enabled", ctx));
|
|
332
304
|
if (r.kind === "done") {
|
|
333
305
|
const configNeeded = input.enabled
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PluginScopeSyncProcessor } from "../catalog/scope-sync-workers.js";
|
|
2
|
+
import { TemplateConnectorsProcessor } from "../catalog/template-connectors.processor.js";
|
|
2
3
|
import { ChannelsProcessor } from "../channels/channels.module.js";
|
|
3
4
|
import { ChannelOutbound } from "../channels/outbound.js";
|
|
4
5
|
import { PromptSuggestionQueue } from "../conversations/prompt-suggestions.js";
|
|
@@ -15,11 +16,12 @@ import { MaintenanceProcessor } from "../runtime/maintenance.js";
|
|
|
15
16
|
import { PromptSuggestionProcessor, RunsProcessor, SubagentRunsProcessor, TitleProcessor, UsageReportProcessor } from "../runtime/run-processors.js";
|
|
16
17
|
import { RunWorker } from "../runtime/run-worker.js";
|
|
17
18
|
import { UsageReporter } from "../runtime/usage-report.js";
|
|
19
|
+
import { ConnectorToolsProcessor } from "../tools/connector-tools.processor.js";
|
|
18
20
|
/**
|
|
19
21
|
* The worker role's parts, driven by `KernelLifecycle` at fixed points of its start order and stop
|
|
20
22
|
* phases (so they stay ordered after the extension load and before the extension host closes): the
|
|
21
23
|
* queue consumers (runs, sub-agent runs, evals, maintenance, the plugin scope sync, lifecycle
|
|
22
|
-
* hook deliveries, push deliveries, channel deliveries, `usage.report`, titles, prompt suggestions) and the schedulers of the `@LockedCron` / `@LockedInterval` jobs. Provided only by
|
|
24
|
+
* hook deliveries, push deliveries, connector tool listings, template connector ensures, channel deliveries, `usage.report`, titles, prompt suggestions) and the schedulers of the `@LockedCron` / `@LockedInterval` jobs. Provided only by
|
|
23
25
|
* `WorkerModule`, so a process without the worker role has none of them.
|
|
24
26
|
*/
|
|
25
27
|
export declare class WorkerRole {
|
|
@@ -43,13 +45,15 @@ export declare class WorkerRole {
|
|
|
43
45
|
private readonly scopeProcessor;
|
|
44
46
|
private readonly lifecycleProcessor;
|
|
45
47
|
private readonly pushProcessor;
|
|
48
|
+
private readonly connectorToolsProcessor;
|
|
49
|
+
private readonly templateConnectorsProcessor;
|
|
46
50
|
/** The startup config (the roles). */
|
|
47
51
|
private readonly config;
|
|
48
52
|
/** The run worker was started: the runs phase drains it. */
|
|
49
53
|
private runsStarted;
|
|
50
54
|
/** The eval worker was started: the runs phase drains it. */
|
|
51
55
|
private evalsStarted;
|
|
52
|
-
constructor(config: KernelConfigService, log: KernelLogger, intervals: LockedIntervalScheduler, scheduledRuns: ScheduledRuns, runWorker: RunWorker, evalWorker: EvalWorker, usageReport: UsageReporter, titles: TitleQueue, suggestions: PromptSuggestionQueue, channelOutbound: ChannelOutbound, runsProcessor: RunsProcessor, subagentRunsProcessor: SubagentRunsProcessor, usageProcessor: UsageReportProcessor, titleProcessor: TitleProcessor, suggestionProcessor: PromptSuggestionProcessor, channelsProcessor: ChannelsProcessor, evalsProcessor: EvalsProcessor, maintenanceProcessor: MaintenanceProcessor, scopeProcessor: PluginScopeSyncProcessor, lifecycleProcessor: LifecycleHooksProcessor, pushProcessor: PushProcessor);
|
|
56
|
+
constructor(config: KernelConfigService, log: KernelLogger, intervals: LockedIntervalScheduler, scheduledRuns: ScheduledRuns, runWorker: RunWorker, evalWorker: EvalWorker, usageReport: UsageReporter, titles: TitleQueue, suggestions: PromptSuggestionQueue, channelOutbound: ChannelOutbound, runsProcessor: RunsProcessor, subagentRunsProcessor: SubagentRunsProcessor, usageProcessor: UsageReportProcessor, titleProcessor: TitleProcessor, suggestionProcessor: PromptSuggestionProcessor, channelsProcessor: ChannelsProcessor, evalsProcessor: EvalsProcessor, maintenanceProcessor: MaintenanceProcessor, scopeProcessor: PluginScopeSyncProcessor, lifecycleProcessor: LifecycleHooksProcessor, pushProcessor: PushProcessor, connectorToolsProcessor: ConnectorToolsProcessor, templateConnectorsProcessor: TemplateConnectorsProcessor);
|
|
53
57
|
/**
|
|
54
58
|
* Starts the queue consumers (after the extension load), then opens the schedules' start gate:
|
|
55
59
|
* the cron and interval timers were armed at application bootstrap, but every tick before this
|
|
@@ -68,8 +72,9 @@ export declare class WorkerRole {
|
|
|
68
72
|
drainEvals(budgetMs: number): Promise<void> | undefined;
|
|
69
73
|
/**
|
|
70
74
|
* Closes the maintenance queue's worker, the plugin scope sync's (it stops between pairs), the
|
|
71
|
-
* lifecycle hook deliveries' (calls in flight are aborted and retried)
|
|
72
|
-
* (sends in flight finish, each bounded by the send time limit)
|
|
75
|
+
* lifecycle hook deliveries' (calls in flight are aborted and retried), the push deliveries'
|
|
76
|
+
* (sends in flight finish, each bounded by the send time limit) and the connector tool
|
|
77
|
+
* listings' (each bounded by the tool timeout).
|
|
73
78
|
*/
|
|
74
79
|
closeMaintenance(): Promise<void>;
|
|
75
80
|
}
|
|
@@ -9,6 +9,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { PluginScopeSyncProcessor } from "../catalog/scope-sync-workers.js";
|
|
12
|
+
import { TemplateConnectorsProcessor } from "../catalog/template-connectors.processor.js";
|
|
12
13
|
import { ChannelsProcessor } from "../channels/channels.module.js";
|
|
13
14
|
import { ChannelOutbound } from "../channels/outbound.js";
|
|
14
15
|
import { PromptSuggestionQueue } from "../conversations/prompt-suggestions.js";
|
|
@@ -25,11 +26,12 @@ import { MaintenanceProcessor } from "../runtime/maintenance.js";
|
|
|
25
26
|
import { PromptSuggestionProcessor, RunsProcessor, SubagentRunsProcessor, TitleProcessor, UsageReportProcessor, } from "../runtime/run-processors.js";
|
|
26
27
|
import { RunWorker } from "../runtime/run-worker.js";
|
|
27
28
|
import { UsageReporter } from "../runtime/usage-report.js";
|
|
29
|
+
import { ConnectorToolsProcessor } from "../tools/connector-tools.processor.js";
|
|
28
30
|
/**
|
|
29
31
|
* The worker role's parts, driven by `KernelLifecycle` at fixed points of its start order and stop
|
|
30
32
|
* phases (so they stay ordered after the extension load and before the extension host closes): the
|
|
31
33
|
* queue consumers (runs, sub-agent runs, evals, maintenance, the plugin scope sync, lifecycle
|
|
32
|
-
* hook deliveries, push deliveries, channel deliveries, `usage.report`, titles, prompt suggestions) and the schedulers of the `@LockedCron` / `@LockedInterval` jobs. Provided only by
|
|
34
|
+
* hook deliveries, push deliveries, connector tool listings, template connector ensures, channel deliveries, `usage.report`, titles, prompt suggestions) and the schedulers of the `@LockedCron` / `@LockedInterval` jobs. Provided only by
|
|
33
35
|
* `WorkerModule`, so a process without the worker role has none of them.
|
|
34
36
|
*/
|
|
35
37
|
let WorkerRole = class WorkerRole {
|
|
@@ -53,13 +55,15 @@ let WorkerRole = class WorkerRole {
|
|
|
53
55
|
scopeProcessor;
|
|
54
56
|
lifecycleProcessor;
|
|
55
57
|
pushProcessor;
|
|
58
|
+
connectorToolsProcessor;
|
|
59
|
+
templateConnectorsProcessor;
|
|
56
60
|
/** The startup config (the roles). */
|
|
57
61
|
config;
|
|
58
62
|
/** The run worker was started: the runs phase drains it. */
|
|
59
63
|
runsStarted = false;
|
|
60
64
|
/** The eval worker was started: the runs phase drains it. */
|
|
61
65
|
evalsStarted = false;
|
|
62
|
-
constructor(config, log, intervals, scheduledRuns, runWorker, evalWorker, usageReport, titles, suggestions, channelOutbound, runsProcessor, subagentRunsProcessor, usageProcessor, titleProcessor, suggestionProcessor, channelsProcessor, evalsProcessor, maintenanceProcessor, scopeProcessor, lifecycleProcessor, pushProcessor) {
|
|
66
|
+
constructor(config, log, intervals, scheduledRuns, runWorker, evalWorker, usageReport, titles, suggestions, channelOutbound, runsProcessor, subagentRunsProcessor, usageProcessor, titleProcessor, suggestionProcessor, channelsProcessor, evalsProcessor, maintenanceProcessor, scopeProcessor, lifecycleProcessor, pushProcessor, connectorToolsProcessor, templateConnectorsProcessor) {
|
|
63
67
|
this.log = log;
|
|
64
68
|
this.intervals = intervals;
|
|
65
69
|
this.scheduledRuns = scheduledRuns;
|
|
@@ -80,6 +84,8 @@ let WorkerRole = class WorkerRole {
|
|
|
80
84
|
this.scopeProcessor = scopeProcessor;
|
|
81
85
|
this.lifecycleProcessor = lifecycleProcessor;
|
|
82
86
|
this.pushProcessor = pushProcessor;
|
|
87
|
+
this.connectorToolsProcessor = connectorToolsProcessor;
|
|
88
|
+
this.templateConnectorsProcessor = templateConnectorsProcessor;
|
|
83
89
|
this.config = config.get();
|
|
84
90
|
}
|
|
85
91
|
/**
|
|
@@ -99,6 +105,8 @@ let WorkerRole = class WorkerRole {
|
|
|
99
105
|
this.scopeProcessor.start();
|
|
100
106
|
this.lifecycleProcessor.start();
|
|
101
107
|
this.pushProcessor.start();
|
|
108
|
+
this.connectorToolsProcessor.start();
|
|
109
|
+
this.templateConnectorsProcessor.start();
|
|
102
110
|
this.channelOutbound.startWorker(this.channelsProcessor.worker);
|
|
103
111
|
this.usageReport.startWorker(this.usageProcessor.worker);
|
|
104
112
|
this.titles.startWorker(this.titleProcessor.worker);
|
|
@@ -127,8 +135,9 @@ let WorkerRole = class WorkerRole {
|
|
|
127
135
|
}
|
|
128
136
|
/**
|
|
129
137
|
* Closes the maintenance queue's worker, the plugin scope sync's (it stops between pairs), the
|
|
130
|
-
* lifecycle hook deliveries' (calls in flight are aborted and retried)
|
|
131
|
-
* (sends in flight finish, each bounded by the send time limit)
|
|
138
|
+
* lifecycle hook deliveries' (calls in flight are aborted and retried), the push deliveries'
|
|
139
|
+
* (sends in flight finish, each bounded by the send time limit) and the connector tool
|
|
140
|
+
* listings' (each bounded by the tool timeout).
|
|
132
141
|
*/
|
|
133
142
|
async closeMaintenance() {
|
|
134
143
|
await Promise.all([
|
|
@@ -136,6 +145,8 @@ let WorkerRole = class WorkerRole {
|
|
|
136
145
|
this.scopeProcessor.close(),
|
|
137
146
|
this.lifecycleProcessor.close(),
|
|
138
147
|
this.pushProcessor.close(),
|
|
148
|
+
this.connectorToolsProcessor.close(),
|
|
149
|
+
this.templateConnectorsProcessor.close(),
|
|
139
150
|
]);
|
|
140
151
|
}
|
|
141
152
|
};
|
|
@@ -161,6 +172,8 @@ WorkerRole = __decorate([
|
|
|
161
172
|
__param(17, Inject(MaintenanceProcessor)),
|
|
162
173
|
__param(18, Inject(PluginScopeSyncProcessor)),
|
|
163
174
|
__param(19, Inject(LifecycleHooksProcessor)),
|
|
164
|
-
__param(20, Inject(PushProcessor))
|
|
175
|
+
__param(20, Inject(PushProcessor)),
|
|
176
|
+
__param(21, Inject(ConnectorToolsProcessor)),
|
|
177
|
+
__param(22, Inject(TemplateConnectorsProcessor))
|
|
165
178
|
], WorkerRole);
|
|
166
179
|
export { WorkerRole };
|
|
@@ -5,7 +5,7 @@ import type { KernelConfig } from "../config/schema.js";
|
|
|
5
5
|
* `worker`: the cron scheduler and the `@LockedInterval` scheduler (`KernelScheduleModule`, the one
|
|
6
6
|
* place `ScheduleModule.forRoot` is imported), every fixed-period job (`@LockedCron` /
|
|
7
7
|
* `@LockedInterval`, each once per tick across replicas), every queue consumer (`@Processor`: runs,
|
|
8
|
-
* sub-agent runs, `usage.report`, titles, evals, maintenance, channel deliveries, the plugin scope sync, push deliveries) and
|
|
8
|
+
* sub-agent runs, `usage.report`, titles, evals, maintenance, channel deliveries, the plugin scope sync, push deliveries, connector tool listings) and
|
|
9
9
|
* {@link WorkerRole}, which `KernelLifecycle` drives. A process without the worker role runs no cron
|
|
10
10
|
* and no BullMQ worker (the queues' producers exist on every role).
|
|
11
11
|
*/
|
|
@@ -12,6 +12,7 @@ import { RetireLegacyTasksJob } from "../background/retire-legacy-tasks.job.js";
|
|
|
12
12
|
import { CatalogModule } from "../catalog/catalog.module.js";
|
|
13
13
|
import { CatalogJobs } from "../catalog/jobs.js";
|
|
14
14
|
import { PluginScopeWorkersModule } from "../catalog/scope-sync-workers.js";
|
|
15
|
+
import { TemplateConnectorsWorkersModule } from "../catalog/template-connectors.processor.js";
|
|
15
16
|
import { ChannelsModule, ChannelWorkersModule } from "../channels/channels.module.js";
|
|
16
17
|
import { GatewayCheckJob } from "../channels/supervisor.js";
|
|
17
18
|
import { ClientModule } from "../client/client.module.js";
|
|
@@ -48,6 +49,7 @@ import { ShareObjectsModule } from "../shares/share-objects.js";
|
|
|
48
49
|
import { ShareSweepJob } from "../shares/sweep.job.js";
|
|
49
50
|
import { StoragePurgeJob } from "../storage/purge.js";
|
|
50
51
|
import { StorageModule } from "../storage/storage.module.js";
|
|
52
|
+
import { ConnectorToolsWorkersModule } from "../tools/connector-tools.processor.js";
|
|
51
53
|
import { ToolJobs } from "../tools/jobs.js";
|
|
52
54
|
import { ToolsModule } from "../tools/tools.module.js";
|
|
53
55
|
import { WorkerRole } from "./worker-role.js";
|
|
@@ -56,7 +58,7 @@ import { WorkerRole } from "./worker-role.js";
|
|
|
56
58
|
* `worker`: the cron scheduler and the `@LockedInterval` scheduler (`KernelScheduleModule`, the one
|
|
57
59
|
* place `ScheduleModule.forRoot` is imported), every fixed-period job (`@LockedCron` /
|
|
58
60
|
* `@LockedInterval`, each once per tick across replicas), every queue consumer (`@Processor`: runs,
|
|
59
|
-
* sub-agent runs, `usage.report`, titles, evals, maintenance, channel deliveries, the plugin scope sync, push deliveries) and
|
|
61
|
+
* sub-agent runs, `usage.report`, titles, evals, maintenance, channel deliveries, the plugin scope sync, push deliveries, connector tool listings) and
|
|
60
62
|
* {@link WorkerRole}, which `KernelLifecycle` drives. A process without the worker role runs no cron
|
|
61
63
|
* and no BullMQ worker (the queues' producers exist on every role).
|
|
62
64
|
*/
|
|
@@ -78,6 +80,11 @@ let WorkerModule = WorkerModule_1 = class WorkerModule {
|
|
|
78
80
|
LifecycleHookWorkersModule,
|
|
79
81
|
// push deliveries (`cap-push-deliver`) and the daily stale registration prune
|
|
80
82
|
PushWorkersModule,
|
|
83
|
+
// connector tool listings owed after a create or a setup (`cap-connector-tools`)
|
|
84
|
+
ConnectorToolsWorkersModule,
|
|
85
|
+
// template connectors an org never had, owed by installs and extension switch-ons
|
|
86
|
+
// (`cap-template-connectors`)
|
|
87
|
+
TemplateConnectorsWorkersModule,
|
|
81
88
|
// the domains the fixed-period jobs call
|
|
82
89
|
RuntimeModule,
|
|
83
90
|
RunJobsModule,
|
|
@@ -82,7 +82,10 @@ export declare const setupWebPath: {
|
|
|
82
82
|
connector: (id: string) => string;
|
|
83
83
|
/** A member's connector section: the connector's row on their connections page (§9.3). */
|
|
84
84
|
memberConnections: () => string;
|
|
85
|
-
|
|
85
|
+
/** A connector's configure page: its credentials tab (the guide, editable endpoint fields, credential). */
|
|
86
|
+
configure: (id: string) => string;
|
|
87
|
+
/** The connectors page: a template on in the org without a connector shows its card there. */
|
|
88
|
+
connectors: () => string;
|
|
86
89
|
};
|
|
87
90
|
/**
|
|
88
91
|
* The blocks of a rendered guide as one Markdown document (checks as `- [check <id>]` lines).
|
|
@@ -124,6 +127,11 @@ export declare class SetupGuidesService {
|
|
|
124
127
|
* in the org that have a guide and no connector yet.
|
|
125
128
|
*/
|
|
126
129
|
private connectors;
|
|
130
|
+
/**
|
|
131
|
+
* The oldest live connector of the org made from one of the item's platform connector templates
|
|
132
|
+
* `templates` (a template id, or the ids a guide covers), if any.
|
|
133
|
+
*/
|
|
134
|
+
private templateConnector;
|
|
127
135
|
/**
|
|
128
136
|
* One guide rendered for the caller as a Markdown document (`setup.read`): the guide route's
|
|
129
137
|
* rendering (`PluginGuides.render`, its visibility, action and target rules), joined, with the
|