@capybara-hq/kernel 0.1.0-rc.13 → 0.1.0-rc.15
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.schemas.d.ts +5 -13
- package/dist/catalog/admin-catalog.controller.d.ts +39 -5
- package/dist/catalog/admin-catalog.controller.js +75 -6
- package/dist/catalog/admin-catalog.schemas.d.ts +10 -0
- package/dist/catalog/admin-catalog.schemas.js +7 -0
- package/dist/catalog/appearance.schemas.d.ts +10 -0
- package/dist/catalog/appearance.schemas.js +20 -0
- package/dist/catalog/appearance.service.d.ts +105 -0
- package/dist/catalog/appearance.service.js +306 -0
- package/dist/catalog/catalog-content.d.ts +9 -1
- package/dist/catalog/catalog-content.js +2 -1
- package/dist/catalog/catalog-files.d.ts +3 -2
- package/dist/catalog/catalog-files.js +8 -5
- package/dist/catalog/catalog-import.module.js +3 -0
- package/dist/catalog/catalog-items.d.ts +11 -0
- package/dist/catalog/catalog-items.js +21 -0
- package/dist/catalog/catalog-scope.service.d.ts +7 -0
- package/dist/catalog/catalog-scope.service.js +55 -15
- package/dist/catalog/catalog.service.js +10 -2
- package/dist/catalog/cli.js +3 -0
- package/dist/catalog/component-scope.service.d.ts +14 -1
- package/dist/catalog/component-scope.service.js +12 -2
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.controller.d.ts +5 -4
- package/dist/catalog/org-catalog.controller.js +5 -4
- package/dist/catalog/org-catalog.schemas.d.ts +18 -2
- package/dist/catalog/org-catalog.schemas.js +16 -2
- package/dist/catalog/org-catalog.service.js +8 -2
- package/dist/catalog/org-extension.controller.d.ts +27 -7
- package/dist/catalog/org-extension.controller.js +48 -6
- package/dist/catalog/plugin-import.d.ts +28 -4
- package/dist/catalog/plugin-import.js +96 -20
- package/dist/catalog/plugin-package.d.ts +4 -2
- package/dist/catalog/plugin-package.js +66 -12
- package/dist/catalog/plugin-upgrade.d.ts +15 -1
- package/dist/catalog/plugin-upgrade.js +18 -5
- package/dist/channels/connections.controller.d.ts +1 -1
- package/dist/channels/connections.controller.js +1 -1
- package/dist/channels/connections.service.d.ts +22 -5
- package/dist/channels/connections.service.js +56 -10
- package/dist/channels/webhook.d.ts +21 -1
- package/dist/channels/webhook.js +39 -4
- package/dist/client/client-access.service.d.ts +101 -0
- package/dist/client/client-access.service.js +294 -0
- package/dist/client/client-builds.service.d.ts +109 -0
- package/dist/client/client-builds.service.js +229 -0
- package/dist/client/client-delivery.controller.d.ts +25 -0
- package/dist/client/client-delivery.controller.js +66 -0
- package/dist/client/client-files.d.ts +48 -0
- package/dist/client/client-files.js +136 -0
- package/dist/client/client-reports.cron.d.ts +13 -0
- package/dist/client/client-reports.cron.js +42 -0
- package/dist/client/client-reports.service.d.ts +30 -0
- package/dist/client/client-reports.service.js +102 -0
- package/dist/client/client.controller.d.ts +45 -0
- package/dist/client/client.controller.js +121 -0
- package/dist/client/client.module.d.ts +7 -0
- package/dist/client/client.module.js +26 -0
- package/dist/client/client.schemas.d.ts +55 -0
- package/dist/client/client.schemas.js +27 -0
- package/dist/ctx/create-ctx.d.ts +19 -4
- package/dist/ctx/create-ctx.js +51 -3
- package/dist/db/kernel-schema.d.ts +58 -2
- package/dist/errors.d.ts +33 -0
- package/dist/errors.js +33 -0
- package/dist/extensions/admin-ops.d.ts +4 -1
- package/dist/extensions/admin-ops.js +22 -1
- package/dist/extensions/admin-view.d.ts +8 -0
- package/dist/extensions/admin-view.js +78 -0
- package/dist/extensions/blobs.d.ts +14 -1
- package/dist/extensions/blobs.js +48 -5
- package/dist/extensions/guide-places.d.ts +66 -0
- package/dist/extensions/guide-places.js +152 -0
- package/dist/extensions/host.d.ts +6 -1
- package/dist/extensions/host.js +23 -12
- package/dist/extensions/instance.d.ts +5 -1
- package/dist/extensions/instance.js +8 -0
- package/dist/extensions/ledger.d.ts +1 -1
- package/dist/extensions/package.d.ts +4 -3
- package/dist/extensions/package.js +5 -1
- package/dist/extensions/permission-set.d.ts +35 -5
- package/dist/extensions/permission-set.js +36 -5
- package/dist/extensions/permission-view.d.ts +38 -7
- package/dist/extensions/permission-view.js +27 -8
- package/dist/extensions/plugin-guides.d.ts +207 -54
- package/dist/extensions/plugin-guides.js +436 -165
- package/dist/extensions/sources.d.ts +6 -0
- package/dist/extensions/sources.js +2 -0
- package/dist/extensions/state.module.js +9 -1
- package/dist/http/api.module.js +16 -0
- package/dist/identity/settings.d.ts +41 -26
- package/dist/identity/settings.js +87 -4
- package/dist/infra/lock/lock.service.d.ts +8 -0
- package/dist/infra/lock/lock.service.js +27 -0
- package/dist/infra/throttler/named-throttlers.d.ts +8 -1
- package/dist/infra/throttler/named-throttlers.js +30 -1
- package/dist/infra/throttler/throttler.guard.js +1 -1
- package/dist/kernel.module.js +3 -0
- package/dist/orgs/settings.service.d.ts +2 -26
- package/dist/overrides.d.ts +3 -1
- package/dist/overrides.js +2 -0
- package/dist/platform/exclusions.js +37 -6
- package/dist/platform/operation.js +4 -0
- package/dist/platform/ops/admin.ops.js +17 -2
- package/dist/platform/ops/catalog-admin.ops.d.ts +19 -1
- package/dist/platform/ops/catalog-admin.ops.js +85 -2
- package/dist/platform/ops/connectors.ops.js +2 -0
- package/dist/platform/ops/org-plugins.ops.d.ts +7 -1
- package/dist/platform/ops/org-plugins.ops.js +63 -4
- package/dist/platform/ops/org-settings.ops.js +2 -2
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/platform/ops/setup.ops.d.ts +24 -0
- package/dist/platform/ops/setup.ops.js +212 -0
- package/dist/platform/ops/ui.ops.js +1 -1
- package/dist/platform/platform-ops.module.d.ts +2 -1
- package/dist/platform/platform-ops.module.js +7 -0
- package/dist/platform/route-schemas.js +8 -0
- package/dist/roles/worker.module.js +4 -0
- package/dist/setup/kernel-checks.d.ts +91 -0
- package/dist/setup/kernel-checks.js +295 -0
- package/dist/setup/oauth-token-probe.d.ts +47 -0
- package/dist/setup/oauth-token-probe.js +108 -0
- package/dist/setup/redact-check.d.ts +18 -0
- package/dist/setup/redact-check.js +46 -0
- package/dist/setup/setup-check-registry.d.ts +86 -0
- package/dist/setup/setup-check-registry.js +75 -0
- package/dist/setup/setup-checks.controller.d.ts +28 -0
- package/dist/setup/setup-checks.controller.js +78 -0
- package/dist/setup/setup-checks.schemas.d.ts +38 -0
- package/dist/setup/setup-checks.schemas.js +43 -0
- package/dist/setup/setup-checks.service.d.ts +144 -0
- package/dist/setup/setup-checks.service.js +683 -0
- package/dist/setup/setup-guides.controller.d.ts +18 -0
- package/dist/setup/setup-guides.controller.js +48 -0
- package/dist/setup/setup-guides.schemas.d.ts +10 -0
- package/dist/setup/setup-guides.schemas.js +6 -0
- package/dist/setup/setup-guides.service.d.ts +126 -0
- package/dist/setup/setup-guides.service.js +315 -0
- package/dist/setup/setup.module.d.ts +8 -0
- package/dist/setup/setup.module.js +31 -0
- package/dist/themes/render-css.d.ts +2 -1
- package/dist/themes/render-css.js +5 -2
- package/dist/themes/theme-delivery.service.d.ts +4 -2
- package/dist/themes/theme-delivery.service.js +8 -3
- package/dist/themes/theme-state.d.ts +28 -7
- package/dist/themes/theme-state.js +24 -6
- package/dist/themes/themes-public.controller.d.ts +7 -2
- package/dist/themes/themes-public.controller.js +11 -5
- package/dist/themes/themes.service.js +2 -2
- package/dist/tools/connectors.controller.d.ts +28 -11
- package/dist/tools/connectors.controller.js +49 -14
- package/dist/tools/connectors.schemas.d.ts +4 -0
- package/dist/tools/connectors.schemas.js +4 -0
- package/dist/tools/connectors.service.d.ts +30 -2
- package/dist/tools/connectors.service.js +98 -3
- package/dist/tools/credentials.d.ts +20 -0
- package/dist/tools/credentials.js +90 -1
- package/dist/tools/oauth/tokens.d.ts +20 -0
- package/dist/tools/oauth/tokens.js +49 -24
- package/dist/tools/pipeline.d.ts +3 -2
- package/dist/ui/arrangement.d.ts +41 -50
- package/dist/ui/arrangement.js +88 -15
- package/dist/ui/registry.d.ts +13 -3
- package/dist/ui/registry.js +15 -4
- package/dist/ui/ui.schemas.d.ts +4 -0
- package/dist/ui/views.d.ts +36 -9
- package/dist/ui/views.js +58 -28
- package/package.json +3 -3
- package/src/migrations/0106_setup_guides_v2.sql +10 -0
- package/src/migrations/0107_extension_client_builds.sql +50 -0
|
@@ -0,0 +1,212 @@
|
|
|
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 { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { CatalogGuidePathParams, CatalogGuideQuery } from "../../catalog/org-catalog.schemas.js";
|
|
12
|
+
import { ApiError } from "../../errors.js";
|
|
13
|
+
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
14
|
+
import { SetupCheckPathParams, SetupCheckRunBody, SetupChecksQuery, SetupGuidePathParams, } from "../../setup/setup-checks.schemas.js";
|
|
15
|
+
import { SetupChecksService } from "../../setup/setup-checks.service.js";
|
|
16
|
+
import { SetupGuidesQuery } from "../../setup/setup-guides.schemas.js";
|
|
17
|
+
import { SetupGuidesService } from "../../setup/setup-guides.service.js";
|
|
18
|
+
import { defineOperation } from "../operation.js";
|
|
19
|
+
import { PlatformOperations } from "../registry.js";
|
|
20
|
+
import { roleOf } from "./role.js";
|
|
21
|
+
const ITEM = "00000000-0000-4000-8000-000000000000";
|
|
22
|
+
const CONNECTION = "00000000-0000-4000-8000-000000000001";
|
|
23
|
+
/**
|
|
24
|
+
* Setup guide operations of the `Platform` tool (spec 2026-11-09-setup-guides-v2-design.md §12),
|
|
25
|
+
* the `setup` domain: the guides a person may see, one guide rendered as Markdown, the cached check
|
|
26
|
+
* states of a guide and running one check. All are reads (a check never writes anywhere; its cost
|
|
27
|
+
* is bounded by the cache, the cooldown and the org's concurrency cap) and use the routes'
|
|
28
|
+
* services, so a guide carries no secret (§6.3) and check results only the fixed, redacted fields.
|
|
29
|
+
* Entering a secret, OAuth consent and the guide ack stay with the person on the web (`human-only`
|
|
30
|
+
* and `secret` exclusions); no setup operation takes a value.
|
|
31
|
+
*/
|
|
32
|
+
let SetupOperations = class SetupOperations {
|
|
33
|
+
registry;
|
|
34
|
+
checks;
|
|
35
|
+
guides;
|
|
36
|
+
kdb;
|
|
37
|
+
constructor(registry, checks, guides, kdb) {
|
|
38
|
+
this.registry = registry;
|
|
39
|
+
this.checks = checks;
|
|
40
|
+
this.guides = guides;
|
|
41
|
+
this.kdb = kdb;
|
|
42
|
+
}
|
|
43
|
+
/** The actor as the routes see a caller: the org, their role there now and their account. */
|
|
44
|
+
async caller(ctx) {
|
|
45
|
+
const role = await roleOf(this.kdb.db, ctx.orgId, ctx.actorAccountId);
|
|
46
|
+
if (role === null)
|
|
47
|
+
throw new ApiError("forbidden", "Insufficient organization role");
|
|
48
|
+
return { orgId: ctx.orgId, role, accountId: ctx.actorAccountId };
|
|
49
|
+
}
|
|
50
|
+
onModuleInit() {
|
|
51
|
+
this.registry.register([
|
|
52
|
+
defineOperation({
|
|
53
|
+
id: "setup.guides",
|
|
54
|
+
description: "List the plugin setup guides this person may help with in the org: per guide its targets (channel connections, connectors made from a template, templates switched on without a connector yet), whether the guide changed since a target was set up (drift), a count of the cached check states and the web page where the person does the setup. Org admins get the admin guides; members get the guides for connecting their own account. Read a guide with setup.read.",
|
|
55
|
+
input: SetupGuidesQuery,
|
|
56
|
+
example: {},
|
|
57
|
+
authz: { orgAction: "catalog.read" },
|
|
58
|
+
mirrors: ["GET /api/v1/orgs/:orgId/setup-guides"],
|
|
59
|
+
confirm: "read",
|
|
60
|
+
run: async (input, ctx) => ({
|
|
61
|
+
guides: await this.guides.list(await this.caller(ctx), input),
|
|
62
|
+
}),
|
|
63
|
+
}),
|
|
64
|
+
defineOperation({
|
|
65
|
+
id: "setup.read",
|
|
66
|
+
description: "Read one plugin setup guide rendered for a target as a Markdown document: the steps, the app manifest and URLs to paste at the third-party platform, and the checks as '- [check <id>] <label>' lines (run them with setup.check), with the modes, the variables that have no value yet and why, and the web page of the target. Explain the step the person is on. Secrets are never in the guide: ask the person to paste each token or secret into its field on the returned webPath, never into the conversation.",
|
|
67
|
+
input: CatalogGuidePathParams.extend(CatalogGuideQuery.shape).strict(),
|
|
68
|
+
example: { itemId: ITEM, guideId: "slack-app", connectionId: CONNECTION },
|
|
69
|
+
authz: { orgAction: "catalog.read" },
|
|
70
|
+
mirrors: ["GET /api/v1/orgs/:orgId/catalog/:itemId/guides/:guideId"],
|
|
71
|
+
confirm: "read",
|
|
72
|
+
errors: [
|
|
73
|
+
{
|
|
74
|
+
code: "catalog.item_not_found",
|
|
75
|
+
next: "The plugin is not in this org's catalog; list the guides with setup.guides.",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
code: "catalog.guide_not_found",
|
|
79
|
+
next: "The plugin has no setup guide with that id; list the guides with setup.guides.",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
code: "channel.not_found",
|
|
83
|
+
next: "No channel connection with that id in this org; list the targets with setup.guides.",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
code: "connector.not_found",
|
|
87
|
+
next: "No connector made from this guide's template with that id in this org; list the targets with setup.guides.",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
code: "validation_failed",
|
|
91
|
+
next: "Pass a mode and audience the guide has (setup.guides lists the audience) and the target of its place: connectionId for a channel guide, connectorId for a connector template guide.",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
code: "forbidden",
|
|
95
|
+
next: {
|
|
96
|
+
member: "Only org admins read the admin guides; members read the member section of a connector template guide (audience member).",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
run: async (input, ctx) => {
|
|
101
|
+
const { itemId, guideId, ...q } = input;
|
|
102
|
+
return { guide: await this.guides.read(await this.caller(ctx), itemId, guideId, q) };
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
defineOperation({
|
|
106
|
+
id: "setup.status",
|
|
107
|
+
description: "Read the cached state of every check of a plugin's setup guide for one target (a channel connection or a connector made from a template), by check id: ok, failing, unknown, running or not_run, with the reason and fix to show the person. Runs nothing; run a check with setup.check.",
|
|
108
|
+
input: SetupGuidePathParams.extend(SetupChecksQuery.shape).strict(),
|
|
109
|
+
example: { itemId: ITEM, guideId: "slack-app", connectionId: CONNECTION },
|
|
110
|
+
authz: { orgAction: "catalog.read" },
|
|
111
|
+
mirrors: ["GET /api/v1/orgs/:orgId/catalog/:itemId/guides/:guideId/checks"],
|
|
112
|
+
confirm: "read",
|
|
113
|
+
errors: [
|
|
114
|
+
{
|
|
115
|
+
code: "catalog.item_not_found",
|
|
116
|
+
next: "The plugin is not in this org's catalog; check the item id on the plugin's page.",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
code: "catalog.guide_not_found",
|
|
120
|
+
next: "The plugin has no setup guide with that id; read the guide id from the connection or connector page.",
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
code: "channel.not_found",
|
|
124
|
+
next: "No channel connection with that id in this org; list the targets with setup.guides.",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
code: "connector.not_found",
|
|
128
|
+
next: "No connector made from this guide's template with that id in this org; list the targets with setup.guides.",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
code: "validation_failed",
|
|
132
|
+
next: "Checks need a saved target: pass connectionId for a channel guide or connectorId for a connector template guide, and a mode and audience the guide has.",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
code: "forbidden",
|
|
136
|
+
next: {
|
|
137
|
+
member: "Only org admins run the admin checks of a guide; members run the member checks (audience member).",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
run: async (input, ctx) => {
|
|
142
|
+
const { itemId, guideId, ...q } = input;
|
|
143
|
+
return { results: await this.checks.states(await this.caller(ctx), itemId, guideId, q) };
|
|
144
|
+
},
|
|
145
|
+
}),
|
|
146
|
+
defineOperation({
|
|
147
|
+
id: "setup.check",
|
|
148
|
+
description: "Run one check of a plugin's setup guide for one target (a channel connection or a connector made from a template) and return its state: ok, failing (with a reason and a fix to explain), unknown, or running (try again in a moment). A fresh cached result is returned as is; force reruns it, at most once per 10 seconds per check and target. A check only reads; run it after the person says they finished a step.",
|
|
149
|
+
input: SetupCheckPathParams.extend(SetupCheckRunBody.shape).strict(),
|
|
150
|
+
example: {
|
|
151
|
+
itemId: ITEM,
|
|
152
|
+
guideId: "slack-app",
|
|
153
|
+
checkId: "bot-token",
|
|
154
|
+
connectionId: CONNECTION,
|
|
155
|
+
},
|
|
156
|
+
authz: { orgAction: "catalog.read" },
|
|
157
|
+
mirrors: ["POST /api/v1/orgs/:orgId/catalog/:itemId/guides/:guideId/checks/:checkId/run"],
|
|
158
|
+
confirm: "read",
|
|
159
|
+
errors: [
|
|
160
|
+
{
|
|
161
|
+
code: "catalog.item_not_found",
|
|
162
|
+
next: "The plugin is not in this org's catalog; check the item id on the plugin's page.",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
code: "catalog.guide_not_found",
|
|
166
|
+
next: "The plugin has no setup guide with that id; read the guide id from the connection or connector page.",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
code: "channel.not_found",
|
|
170
|
+
next: "No channel connection with that id in this org; list the targets with setup.guides.",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
code: "connector.not_found",
|
|
174
|
+
next: "No connector made from this guide's template with that id in this org; list the targets with setup.guides.",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
code: "validation_failed",
|
|
178
|
+
next: "Checks need a saved target: pass connectionId for a channel guide or connectorId for a connector template guide, and a mode and audience the guide has.",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
code: "forbidden",
|
|
182
|
+
next: {
|
|
183
|
+
member: "Only org admins run the admin checks of a guide; members run the member checks (audience member).",
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
code: "catalog.check_not_found",
|
|
188
|
+
next: "That check is not in the guide for this mode and audience; read the check ids with setup.status.",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
code: "rate_limited",
|
|
192
|
+
next: "This person ran 30 checks in the last minute; wait a minute before running another, and read the cached states with setup.status meanwhile.",
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
run: async (input, ctx) => {
|
|
196
|
+
const { itemId, guideId, checkId, ...body } = input;
|
|
197
|
+
return {
|
|
198
|
+
result: await this.checks.run(await this.caller(ctx), itemId, guideId, checkId, body),
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
}),
|
|
202
|
+
]);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
SetupOperations = __decorate([
|
|
206
|
+
Injectable(),
|
|
207
|
+
__param(0, Inject(PlatformOperations)),
|
|
208
|
+
__param(1, Inject(SetupChecksService)),
|
|
209
|
+
__param(2, Inject(SetupGuidesService)),
|
|
210
|
+
__param(3, Inject(KernelDb))
|
|
211
|
+
], SetupOperations);
|
|
212
|
+
export { SetupOperations };
|
|
@@ -22,7 +22,7 @@ let UiOperations = class UiOperations {
|
|
|
22
22
|
this.registry.register([
|
|
23
23
|
defineOperation({
|
|
24
24
|
id: "ui.slots",
|
|
25
|
-
description: "List the UI slots an extension can contribute to (id, version, where it is, scope and args, accepted kinds view / embed, minimum role, anchors). Use a slot id as a ui contribution's `slot` in a plugin manifest.",
|
|
25
|
+
description: "List the UI slots an extension can contribute to (id, version, where it is, scope and args, accepted kinds view / embed / component, cardinality list or single, minimum role, anchors). Use a slot id as a ui contribution's `slot` in a plugin manifest.",
|
|
26
26
|
input: z.object({}).strict(),
|
|
27
27
|
example: {},
|
|
28
28
|
// any signed-in person may call the route; every run's actor is a member of this org
|
|
@@ -24,6 +24,7 @@ import { PlatformOperationsProvider } from "./ops/platform.ops.js";
|
|
|
24
24
|
import { PluginsOperations } from "./ops/plugins.ops.js";
|
|
25
25
|
import { PreviewersOperations } from "./ops/previewers.ops.js";
|
|
26
26
|
import { RequestsOperations } from "./ops/requests.ops.js";
|
|
27
|
+
import { SetupOperations } from "./ops/setup.ops.js";
|
|
27
28
|
import { SkillsOperations } from "./ops/skills.ops.js";
|
|
28
29
|
import { ThemesOperations } from "./ops/themes.ops.js";
|
|
29
30
|
import { UiOperations } from "./ops/ui.ops.js";
|
|
@@ -31,7 +32,7 @@ import { UiOperations } from "./ops/ui.ops.js";
|
|
|
31
32
|
* One provider per domain, each taking `PlatformOperations` as its first constructor argument:
|
|
32
33
|
* the parity test in `tools/checks` builds the operations from it without a Nest app.
|
|
33
34
|
*/
|
|
34
|
-
export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof DevicesOperations, typeof AgentSkillsOperations, typeof ThemesOperations, typeof UiOperations];
|
|
35
|
+
export declare const PLATFORM_OPERATION_PROVIDERS: readonly [typeof PlatformOperationsProvider, typeof SkillsOperations, typeof AgentsOperations, typeof AgentTemplatesOperations, typeof PluginsOperations, typeof MarketplacesOperations, typeof RequestsOperations, typeof ConnectorsOperations, typeof ExtensionsOperations, typeof ConversationsOperations, typeof ComponentsOperations, typeof AccountsOperations, typeof OrgsOperations, typeof AdminOperations, typeof CatalogAdminOperations, typeof OrgPluginsOperations, typeof ExtensionsAdminOperations, typeof ModelsOperations, typeof InboxOperations, typeof ApprovalsOperations, typeof ChannelsOperations, typeof OrgSettingsOperations, typeof EvalsOperations, typeof BackgroundOperations, typeof PreviewersOperations, typeof DevicesOperations, typeof AgentSkillsOperations, typeof ThemesOperations, typeof SetupOperations, typeof UiOperations];
|
|
35
36
|
/**
|
|
36
37
|
* The `Platform` tool's operations (ruling P2): one provider per domain, each registering its
|
|
37
38
|
* operations into `PlatformOperations` from `onModuleInit`. It imports the domain modules, which
|
|
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { Module } from "@nestjs/common";
|
|
8
8
|
import { AgentsModule } from "../agents/agents.module.js";
|
|
9
9
|
import { BackgroundModule } from "../background/background.module.js";
|
|
10
|
+
import { AppearanceModule } from "../catalog/appearance.service.js";
|
|
10
11
|
import { CatalogModule } from "../catalog/catalog.module.js";
|
|
11
12
|
import { ChannelsModule } from "../channels/channels.module.js";
|
|
12
13
|
import { ConversationsModule } from "../conversations/conversations.module.js";
|
|
@@ -19,6 +20,7 @@ import { InboxModule } from "../inbox/inbox.module.js";
|
|
|
19
20
|
import { ModelsModule } from "../models/models.module.js";
|
|
20
21
|
import { OrgsModule } from "../orgs/orgs.module.js";
|
|
21
22
|
import { ProvidersModule } from "../runtime/providers.js";
|
|
23
|
+
import { SetupModule } from "../setup/setup.module.js";
|
|
22
24
|
import { SkillsModule } from "../skills/skills.module.js";
|
|
23
25
|
import { ThemesModule } from "../themes/themes.module.js";
|
|
24
26
|
import { ToolsModule } from "../tools/tools.module.js";
|
|
@@ -48,6 +50,7 @@ import { PlatformOperationsProvider } from "./ops/platform.ops.js";
|
|
|
48
50
|
import { PluginsOperations } from "./ops/plugins.ops.js";
|
|
49
51
|
import { PreviewersOperations } from "./ops/previewers.ops.js";
|
|
50
52
|
import { RequestsOperations } from "./ops/requests.ops.js";
|
|
53
|
+
import { SetupOperations } from "./ops/setup.ops.js";
|
|
51
54
|
import { SkillsOperations } from "./ops/skills.ops.js";
|
|
52
55
|
import { ThemesOperations } from "./ops/themes.ops.js";
|
|
53
56
|
import { UiOperations } from "./ops/ui.ops.js";
|
|
@@ -92,6 +95,8 @@ export const PLATFORM_OPERATION_PROVIDERS = [
|
|
|
92
95
|
AgentSkillsOperations,
|
|
93
96
|
// themes (themes spec §9)
|
|
94
97
|
ThemesOperations,
|
|
98
|
+
// setup guide checks (setup guides v2 §12; plan task 13 adds the rest of the domain)
|
|
99
|
+
SetupOperations,
|
|
95
100
|
// UI slot catalog (UI slots spec §3)
|
|
96
101
|
UiOperations,
|
|
97
102
|
];
|
|
@@ -110,6 +115,7 @@ PlatformOpsModule = __decorate([
|
|
|
110
115
|
AgentsModule,
|
|
111
116
|
OrgsModule,
|
|
112
117
|
CatalogModule,
|
|
118
|
+
AppearanceModule,
|
|
113
119
|
ExtensionsModule,
|
|
114
120
|
ToolsModule,
|
|
115
121
|
ConversationsModule,
|
|
@@ -123,6 +129,7 @@ PlatformOpsModule = __decorate([
|
|
|
123
129
|
BackgroundModule,
|
|
124
130
|
FilesModule,
|
|
125
131
|
ThemesModule,
|
|
132
|
+
SetupModule,
|
|
126
133
|
],
|
|
127
134
|
providers: [...PLATFORM_OPERATION_PROVIDERS],
|
|
128
135
|
})
|
|
@@ -4,6 +4,7 @@ import { AGENT_ROUTES } from "../agents/agents.schemas.js";
|
|
|
4
4
|
import { AGENT_TEMPLATE_ROUTES } from "../agents/templates.schemas.js";
|
|
5
5
|
import { BACKGROUND_ROUTES } from "../background/background.schemas.js";
|
|
6
6
|
import { ADMIN_CATALOG_ROUTES } from "../catalog/admin-catalog.schemas.js";
|
|
7
|
+
import { APPEARANCE_ROUTES } from "../catalog/appearance.schemas.js";
|
|
7
8
|
import { COMPONENT_SCOPE_ROUTES } from "../catalog/component-scope.schemas.js";
|
|
8
9
|
import { MARKETPLACE_ROUTES } from "../catalog/marketplaces.schemas.js";
|
|
9
10
|
import { ORG_CATALOG_ROUTES } from "../catalog/org-catalog.schemas.js";
|
|
@@ -19,6 +20,8 @@ import { ME_ROUTES } from "../identity/me.schemas.js";
|
|
|
19
20
|
import { INBOX_ROUTES } from "../inbox/inbox.schemas.js";
|
|
20
21
|
import { ORG_MODEL_ROUTES } from "../models/org-models.schemas.js";
|
|
21
22
|
import { ORG_ROUTES, ORG_SETTINGS_ROUTES } from "../orgs/orgs.schemas.js";
|
|
23
|
+
import { SETUP_CHECK_ROUTES } from "../setup/setup-checks.schemas.js";
|
|
24
|
+
import { SETUP_GUIDE_ROUTES } from "../setup/setup-guides.schemas.js";
|
|
22
25
|
import { SKILL_ROUTES } from "../skills/skills.schemas.js";
|
|
23
26
|
import { THEME_ROUTES } from "../themes/themes.schemas.js";
|
|
24
27
|
import { APPROVAL_ROUTES } from "../tools/approvals.schemas.js";
|
|
@@ -64,6 +67,11 @@ export const ROUTE_SCHEMAS = [
|
|
|
64
67
|
...ME_ROUTES,
|
|
65
68
|
// themes (themes spec §9)
|
|
66
69
|
...THEME_ROUTES,
|
|
70
|
+
// a plugin's suggested appearance (client extensions spec §6.5)
|
|
71
|
+
...APPEARANCE_ROUTES,
|
|
72
|
+
// setup guide checks (setup guides v2 §10.3, §12)
|
|
73
|
+
...SETUP_CHECK_ROUTES,
|
|
74
|
+
...SETUP_GUIDE_ROUTES,
|
|
67
75
|
// UI slots (UI slots spec §3)
|
|
68
76
|
...UI_ROUTES,
|
|
69
77
|
];
|
|
@@ -14,6 +14,8 @@ import { PlatformMigration } from "../catalog/platform-migration.js";
|
|
|
14
14
|
import { PluginScopeWorkersModule } from "../catalog/scope-sync-workers.js";
|
|
15
15
|
import { ChannelsModule, ChannelWorkersModule } from "../channels/channels.module.js";
|
|
16
16
|
import { GatewayCheckJob } from "../channels/supervisor.js";
|
|
17
|
+
import { ClientModule } from "../client/client.module.js";
|
|
18
|
+
import { ClientReportsCron } from "../client/client-reports.cron.js";
|
|
17
19
|
import { AttachmentsModule } from "../conversations/attachments.module.js";
|
|
18
20
|
import { AttachmentCleanupJob } from "../conversations/attachments.service.js";
|
|
19
21
|
import { EventLogModule } from "../conversations/event-log.js";
|
|
@@ -55,6 +57,7 @@ let WorkerModule = WorkerModule_1 = class WorkerModule {
|
|
|
55
57
|
module: WorkerModule_1,
|
|
56
58
|
imports: [
|
|
57
59
|
KernelScheduleModule,
|
|
60
|
+
ClientModule,
|
|
58
61
|
// the queue consumers (their worker options come from the startup config)
|
|
59
62
|
RuntimeWorkersModule.forRoot(config),
|
|
60
63
|
EvalWorkersModule.forRoot(config),
|
|
@@ -87,6 +90,7 @@ let WorkerModule = WorkerModule_1 = class WorkerModule {
|
|
|
87
90
|
BackgroundTaskPollJob,
|
|
88
91
|
ToolJobs,
|
|
89
92
|
InitialPasswordCleanupJob,
|
|
93
|
+
ClientReportsCron,
|
|
90
94
|
CatalogJobs,
|
|
91
95
|
PlatformMigration,
|
|
92
96
|
DirectoryScanJob,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { type SetupCheckResult, type SetupCheckText } from "@capybara-hq/plugin-sdk";
|
|
2
|
+
import { type OnModuleInit } from "@nestjs/common";
|
|
3
|
+
import type { Redis } from "ioredis";
|
|
4
|
+
import { webhookBase } from "../channels/webhook-url.js";
|
|
5
|
+
import type { KernelConfig } from "../config/schema.js";
|
|
6
|
+
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
7
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
8
|
+
import { Credentials } from "../tools/credentials.js";
|
|
9
|
+
import { SetupCheckRegistry } from "./setup-check-registry.js";
|
|
10
|
+
/** The fixed texts of the kernel checks (only `last_error` and a time are ever interpolated). */
|
|
11
|
+
export declare const KERNEL_CHECK_TEXTS: {
|
|
12
|
+
readonly publicUrlSet: SetupCheckText;
|
|
13
|
+
readonly publicUrlMissing: SetupCheckText;
|
|
14
|
+
readonly publicUrlFix: SetupCheckText;
|
|
15
|
+
readonly webhookPublic: SetupCheckText;
|
|
16
|
+
readonly webhookBaseMissing: SetupCheckText;
|
|
17
|
+
readonly webhookBaseFix: SetupCheckText;
|
|
18
|
+
readonly webhookNone: SetupCheckText;
|
|
19
|
+
readonly connectionGone: SetupCheckText;
|
|
20
|
+
readonly connectionDisabled: SetupCheckText;
|
|
21
|
+
readonly connectionEnableFix: SetupCheckText;
|
|
22
|
+
readonly connectionFailed: SetupCheckText;
|
|
23
|
+
readonly connectionFix: SetupCheckText;
|
|
24
|
+
readonly connectionPending: SetupCheckText;
|
|
25
|
+
readonly connectionActive: SetupCheckText;
|
|
26
|
+
readonly connectorGone: SetupCheckText;
|
|
27
|
+
readonly notOAuthCode: SetupCheckText;
|
|
28
|
+
readonly dcr: SetupCheckText;
|
|
29
|
+
readonly clientStored: SetupCheckText;
|
|
30
|
+
readonly clientMissing: SetupCheckText;
|
|
31
|
+
readonly clientFix: SetupCheckText;
|
|
32
|
+
readonly noClient: SetupCheckText;
|
|
33
|
+
readonly toolsRead: SetupCheckText;
|
|
34
|
+
readonly toolsPending: SetupCheckText;
|
|
35
|
+
readonly connected: SetupCheckText;
|
|
36
|
+
readonly notConnected: SetupCheckText;
|
|
37
|
+
readonly connectFix: SetupCheckText;
|
|
38
|
+
readonly publicUrlFirst: SetupCheckText;
|
|
39
|
+
};
|
|
40
|
+
/** `capybara:public-url`: `http.publicUrl` is set. */
|
|
41
|
+
export declare function publicUrlCheck(config: Pick<KernelConfig, "http">): SetupCheckResult;
|
|
42
|
+
/**
|
|
43
|
+
* `capybara:webhook-public`: webhook callback URLs have a usable https base. The kernel builds
|
|
44
|
+
* them from `channels.webhookBaseUrl` only (`webhook-url.ts`), never from `http.publicUrl`, so
|
|
45
|
+
* that is what is checked; a loopback http base (tests only) is not public.
|
|
46
|
+
*/
|
|
47
|
+
export declare function webhookPublicCheck(config: Parameters<typeof webhookBase>[0]): SetupCheckResult;
|
|
48
|
+
/** `capybara:webhook-received`: the marker the gateway sets on an accepted webhook, or none. */
|
|
49
|
+
export declare function webhookReceivedResult(seenAt: string | null): SetupCheckResult;
|
|
50
|
+
/**
|
|
51
|
+
* `capybara:connection-active`: active with a bot identity and no recorded error is ok. A recorded
|
|
52
|
+
* `last_error` (status `error`, or a failure an active connection keeps retrying) is failing with
|
|
53
|
+
* that text, redacted by every secret the result is redacted by and kept only when the result
|
|
54
|
+
* with it passes the result validation (control, bidi and lone surrogate rules, length);
|
|
55
|
+
* otherwise the reason leaves it out. The kernel pipeline validates and redacts the result again.
|
|
56
|
+
*/
|
|
57
|
+
export declare function connectionActiveResult(row: {
|
|
58
|
+
status: string;
|
|
59
|
+
botUserId: string | null;
|
|
60
|
+
lastError: string | null;
|
|
61
|
+
} | undefined, secrets: readonly string[]): SetupCheckResult;
|
|
62
|
+
/**
|
|
63
|
+
* Registers the kernel checks on module init (static code, the same on every replica). Each reads
|
|
64
|
+
* only the target the service resolved (ids of the caller's org, after authorization) and never
|
|
65
|
+
* writes; `capybara:oauth-token-endpoint` is the only one that leaves the kernel (§10.6).
|
|
66
|
+
*/
|
|
67
|
+
export declare class KernelChecks implements OnModuleInit {
|
|
68
|
+
private readonly registry;
|
|
69
|
+
private readonly config;
|
|
70
|
+
private readonly db;
|
|
71
|
+
private readonly redis;
|
|
72
|
+
private readonly credentials;
|
|
73
|
+
constructor(registry: SetupCheckRegistry, config: Pick<KernelConfigService, "get">, db: KernelDb, redis: Pick<Redis, "get">, credentials: Pick<Credentials, "oauthClient" | "status">);
|
|
74
|
+
onModuleInit(): void;
|
|
75
|
+
private webhookReceived;
|
|
76
|
+
private connectionActive;
|
|
77
|
+
/** The connector's auth settings (a live connector of the caller's org), or undefined. */
|
|
78
|
+
private connectorAuth;
|
|
79
|
+
private oauthClient;
|
|
80
|
+
private connectorTools;
|
|
81
|
+
/** The caller's own credential (cached per account, as every kernel check). */
|
|
82
|
+
private connectorConnected;
|
|
83
|
+
/**
|
|
84
|
+
* The token endpoint probe for a manual OAuth client (`oauth-token-probe.ts`): the stored
|
|
85
|
+
* client record is the connect flow's (its `tokenEndpoint` came from discovery or the
|
|
86
|
+
* template's `tokenUrl` at install, its auth method from `tokenAuthMethod`), the redirect URI
|
|
87
|
+
* is the connect flow's callback URL. Runs per admin (kernel checks are cached per account);
|
|
88
|
+
* each run is one token request, inside the per-account rate limit and the org's cap.
|
|
89
|
+
*/
|
|
90
|
+
private tokenEndpoint;
|
|
91
|
+
}
|