@capybara-hq/kernel 0.1.0-rc.58 → 0.1.0-rc.59
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/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.controller.d.ts +0 -5
- package/dist/catalog/org-catalog.controller.js +3 -17
- package/dist/catalog/org-catalog.schemas.d.ts +43 -0
- package/dist/catalog/org-catalog.schemas.js +43 -2
- package/dist/catalog/plugin-install.d.ts +2 -0
- package/dist/catalog/plugin-install.js +3 -3
- package/dist/channels/channels.schemas.d.ts +3 -0
- package/dist/channels/channels.schemas.js +8 -0
- package/dist/channels/connections.service.d.ts +17 -2
- package/dist/channels/connections.service.js +30 -5
- package/dist/channels/outbound.js +17 -0
- package/dist/conversations/events.d.ts +34 -0
- package/dist/conversations/events.js +24 -0
- package/dist/ctx/secrets.d.ts +8 -1
- package/dist/ctx/secrets.js +14 -1
- package/dist/db/kernel-schema.d.ts +19 -0
- package/dist/devices/working-root.d.ts +2 -3
- package/dist/errors.d.ts +10 -0
- package/dist/errors.js +10 -0
- package/dist/http/api.module.js +6 -0
- package/dist/identity/initial-passwords.job.d.ts +3 -3
- package/dist/identity/initial-passwords.job.js +7 -5
- package/dist/orgs/invitations.controller.d.ts +3 -11
- package/dist/orgs/invitations.controller.js +9 -10
- package/dist/orgs/invitations.service.d.ts +12 -2
- package/dist/orgs/invitations.service.js +14 -7
- package/dist/orgs/members.service.d.ts +12 -2
- package/dist/orgs/members.service.js +10 -8
- package/dist/orgs/orgs.controller.d.ts +4 -12
- package/dist/orgs/orgs.controller.js +10 -10
- package/dist/orgs/orgs.schemas.d.ts +26 -0
- package/dist/orgs/orgs.schemas.js +22 -0
- package/dist/platform/connector-person-fields.d.ts +67 -0
- package/dist/platform/connector-person-fields.js +129 -0
- package/dist/platform/exclusions.js +5 -100
- package/dist/platform/operation.d.ts +31 -0
- package/dist/platform/operation.js +3 -3
- package/dist/platform/ops/accounts.ops.js +1 -0
- package/dist/platform/ops/channels.ops.d.ts +10 -3
- package/dist/platform/ops/channels.ops.js +223 -5
- package/dist/platform/ops/connectors.ops.d.ts +22 -4
- package/dist/platform/ops/connectors.ops.js +664 -13
- package/dist/platform/ops/org-plugins.ops.d.ts +15 -2
- package/dist/platform/ops/org-plugins.ops.js +323 -4
- package/dist/platform/ops/orgs.ops.d.ts +40 -3
- package/dist/platform/ops/orgs.ops.js +293 -12
- package/dist/platform/ops/person-inputs.d.ts +30 -0
- package/dist/platform/ops/person-inputs.js +50 -0
- package/dist/platform/ops/plugins.ops.d.ts +1 -1
- package/dist/platform/ops/plugins.ops.js +6 -6
- package/dist/platform/parity.d.ts +3 -2
- package/dist/platform/parity.js +40 -15
- package/dist/platform/person-fields.d.ts +20 -4
- package/dist/platform/person-fields.js +27 -5
- package/dist/platform/platform.module.d.ts +2 -1
- package/dist/platform/platform.module.js +5 -3
- package/dist/platform/route-schemas.js +2 -0
- package/dist/platform/sealed-reveals.controller.d.ts +20 -0
- package/dist/platform/sealed-reveals.controller.js +48 -0
- package/dist/platform/sealed-reveals.d.ts +52 -0
- package/dist/platform/sealed-reveals.js +153 -0
- package/dist/runtime/project/knowledge.js +24 -19
- package/dist/sandbox/permission-facts.d.ts +5 -1
- package/dist/sandbox/permission-facts.js +8 -2
- package/dist/setup/setup-guides.service.d.ts +5 -0
- package/dist/setup/setup-guides.service.js +2 -1
- package/dist/tools/approvals.service.js +1 -1
- package/dist/tools/builtins/platform.js +48 -8
- package/dist/tools/connectors.controller.d.ts +6 -7
- package/dist/tools/connectors.controller.js +4 -44
- package/dist/tools/connectors.schemas.d.ts +170 -1
- package/dist/tools/connectors.schemas.js +82 -3
- package/dist/tools/connectors.service.d.ts +16 -6
- package/dist/tools/connectors.service.js +39 -24
- package/dist/tools/oauth/oauth.controller.d.ts +3 -6
- package/dist/tools/oauth/oauth.controller.js +3 -12
- package/dist/tools/oauth/oauth.schemas.d.ts +14 -0
- package/dist/tools/oauth/oauth.schemas.js +27 -0
- package/dist/tools/pipeline.d.ts +7 -0
- package/dist/tools/pipeline.js +13 -4
- package/dist/tools/policy.d.ts +3 -2
- package/dist/tools/policy.js +4 -2
- package/dist/tools/registry.d.ts +7 -0
- package/package.json +4 -4
- package/src/migrations/0170_platform_sealed_reveals.sql +27 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/** The fixed card labels of connector credentials. */
|
|
2
|
+
const LABELS = {
|
|
3
|
+
token: { zh: "令牌", en: "Token" },
|
|
4
|
+
username: { zh: "用户名", en: "Username" },
|
|
5
|
+
password: { zh: "密码", en: "Password" },
|
|
6
|
+
clientSecret: { zh: "客户端密钥", en: "Client secret" },
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The person fields of a connector (platform web parity ruling R3). Credentials are not in a
|
|
10
|
+
* connector's `endpointSchema` (`endpointCredentialIssues` refuses them there), so the secret
|
|
11
|
+
* fields come from the auth method (`tools/credentials.ts`), by the paths of the create body:
|
|
12
|
+
* - `bearer` / `api_key`: `credential.token`;
|
|
13
|
+
* - `basic`: `credential.username`, `credential.password`;
|
|
14
|
+
* - `oauth_client`, `oauth_code` with a manual client: `client.clientSecret` (the client id stays
|
|
15
|
+
* a param; required for the client credentials flow, optional for a public code client).
|
|
16
|
+
*
|
|
17
|
+
* `none`, a dynamically registered client and custom `headers` have none: header names come from
|
|
18
|
+
* the auth preset (text an admin or the model wrote), never a card label, so header credentials
|
|
19
|
+
* are entered on the web. Labels are fixed, in both languages; every schema is a non-empty string.
|
|
20
|
+
*/
|
|
21
|
+
export function connectorPersonFields(auth, stored) {
|
|
22
|
+
const field = (path, label, required, maxLength) => ({
|
|
23
|
+
path,
|
|
24
|
+
label,
|
|
25
|
+
multiline: false,
|
|
26
|
+
required,
|
|
27
|
+
isSet: stored.has(path),
|
|
28
|
+
schema: { type: "string", minLength: 1, ...(maxLength !== undefined && { maxLength }) },
|
|
29
|
+
});
|
|
30
|
+
switch (auth.type) {
|
|
31
|
+
case "bearer":
|
|
32
|
+
case "api_key":
|
|
33
|
+
return [field("credential.token", LABELS.token, true)];
|
|
34
|
+
case "basic":
|
|
35
|
+
return [
|
|
36
|
+
field("credential.username", LABELS.username, true),
|
|
37
|
+
field("credential.password", LABELS.password, true),
|
|
38
|
+
];
|
|
39
|
+
case "oauth_client":
|
|
40
|
+
// the bound of the create's OAuth client parse (`OAuthClientCredential`)
|
|
41
|
+
return [field("client.clientSecret", LABELS.clientSecret, true, 4000)];
|
|
42
|
+
case "oauth_code":
|
|
43
|
+
return auth.client === "manual"
|
|
44
|
+
? [field("client.clientSecret", LABELS.clientSecret, false, 4000)]
|
|
45
|
+
: [];
|
|
46
|
+
default:
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The credential value the create, credential and install bodies take, from the person's entered
|
|
52
|
+
* values (by the paths of {@link connectorPersonFields}, under `prefix`) and the model's client
|
|
53
|
+
* id: `{ token }`, `{ username, password }`, or the OAuth client `{ clientId, clientSecret? }`.
|
|
54
|
+
* Undefined when nothing was entered and no client given (the body then carries none).
|
|
55
|
+
*/
|
|
56
|
+
export function connectorCredential(auth, entered, clientId, prefix = "") {
|
|
57
|
+
const at = (p) => entered[`${prefix}${p}`];
|
|
58
|
+
if (auth.type === "oauth_client" || auth.type === "oauth_code") {
|
|
59
|
+
if (clientId === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
const secret = at("client.clientSecret");
|
|
62
|
+
return { clientId, ...(secret !== undefined && { clientSecret: secret }) };
|
|
63
|
+
}
|
|
64
|
+
if (auth.type === "bearer" || auth.type === "api_key") {
|
|
65
|
+
const token = at("credential.token");
|
|
66
|
+
return token === undefined ? undefined : { token };
|
|
67
|
+
}
|
|
68
|
+
if (auth.type === "basic") {
|
|
69
|
+
const username = at("credential.username");
|
|
70
|
+
const password = at("credential.password");
|
|
71
|
+
if (username === undefined && password === undefined)
|
|
72
|
+
return undefined;
|
|
73
|
+
return {
|
|
74
|
+
...(username !== undefined && { username }),
|
|
75
|
+
...(password !== undefined && { password }),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The person fields of connectors made from templates (the catalog install, the missing
|
|
82
|
+
* connectors of an installed plugin): each template's {@link connectorPersonFields} under
|
|
83
|
+
* `connectors.<templateId>.`, labelled `<template name>: <label>`.
|
|
84
|
+
*/
|
|
85
|
+
export function templatePersonFields(templates) {
|
|
86
|
+
return templates.flatMap((t) => connectorPersonFields(t.auth, new Set()).map((f) => ({
|
|
87
|
+
...f,
|
|
88
|
+
path: `connectors.${t.id}.${f.path}`,
|
|
89
|
+
label: { zh: `${t.name.zh}:${f.label.zh}`, en: `${t.name.en}: ${f.label.en}` },
|
|
90
|
+
})));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* One template's connector input as the install and configure bodies take it
|
|
94
|
+
* (`CatalogConnectorInput`): the model's params with the person's entered values (under
|
|
95
|
+
* `connectors.<templateId>.`) as `credential` or the OAuth client's `clientSecret`.
|
|
96
|
+
*/
|
|
97
|
+
export function templateConnectorInput(t, params, entered) {
|
|
98
|
+
const { client, ...rest } = params ?? {};
|
|
99
|
+
const value = connectorCredential(t.auth, entered, client?.clientId, `connectors.${t.id}.`);
|
|
100
|
+
const oauth = t.auth.type === "oauth_client" || t.auth.type === "oauth_code";
|
|
101
|
+
return {
|
|
102
|
+
...rest,
|
|
103
|
+
...(value !== undefined && (oauth ? { client: value } : { credential: value })),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Why a write cannot ask the person for a connector's credential on the card, or null: custom
|
|
108
|
+
* header credentials (their names come from the auth preset) are entered on the web.
|
|
109
|
+
*/
|
|
110
|
+
export function headersWebOnly(auth, where) {
|
|
111
|
+
return auth.type === "headers"
|
|
112
|
+
? `${where} authenticates with custom headers, whose values the confirmation card cannot ask for; the person enters them on the web.`
|
|
113
|
+
: null;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Why a write's OAuth client param does not fit the auth method, or null: an OAuth client the
|
|
117
|
+
* person enters a secret for (oauth_client, oauth_code with a manual client) needs its id in
|
|
118
|
+
* `client`; any other auth method takes no client (refused rather than ignored).
|
|
119
|
+
*/
|
|
120
|
+
export function clientProblem(auth, client, where) {
|
|
121
|
+
const needs = auth.type === "oauth_client" || (auth.type === "oauth_code" && auth.client === "manual");
|
|
122
|
+
if (needs && client === undefined) {
|
|
123
|
+
return `${where} uses an OAuth client: pass its id in client (the person enters the client secret on the confirmation card)`;
|
|
124
|
+
}
|
|
125
|
+
if (!needs && client !== undefined) {
|
|
126
|
+
return `${where} takes no OAuth client (auth ${auth.type}${auth.type === "oauth_code" ? " with a registered client" : ""}); leave client out`;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
@@ -165,21 +165,6 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
165
165
|
category: "transport",
|
|
166
166
|
reason: "Serves icon image bytes",
|
|
167
167
|
},
|
|
168
|
-
{
|
|
169
|
-
route: "POST /api/v1/orgs/:orgId/catalog/:itemId/install",
|
|
170
|
-
category: "secret",
|
|
171
|
-
reason: "Install body carries connector credentials, client secrets and extension config entered by a person",
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
route: "POST /api/v1/orgs/:orgId/catalog/:itemId/connectors",
|
|
175
|
-
category: "secret",
|
|
176
|
-
reason: "Body carries connector credentials and client secrets entered by a person",
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
route: "POST /api/v1/orgs/:orgId/connector-templates/:templateId/connectors",
|
|
180
|
-
category: "secret",
|
|
181
|
-
reason: "Body carries connector credentials and client secrets entered by a person",
|
|
182
|
-
},
|
|
183
168
|
{
|
|
184
169
|
route: "POST /api/v1/orgs/:orgId/catalog-requests/network",
|
|
185
170
|
category: "human-only",
|
|
@@ -212,21 +197,6 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
212
197
|
reason: "Confirms an upload review, an approval decision",
|
|
213
198
|
},
|
|
214
199
|
// channels
|
|
215
|
-
{
|
|
216
|
-
route: "GET /api/v1/orgs/:orgId/channels/schema/:plugin",
|
|
217
|
-
category: "internal",
|
|
218
|
-
reason: "The config form schema of the create and credential routes, which stay on the web; an agent has no use for it",
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
route: "POST /api/v1/orgs/:orgId/channels",
|
|
222
|
-
category: "secret",
|
|
223
|
-
reason: "Creates a channel connection with app secrets",
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
route: "POST /api/v1/orgs/:orgId/channels/:connectionId/guide-ack",
|
|
227
|
-
category: "human-only",
|
|
228
|
-
reason: "A person confirms they updated the app on the third-party platform after a setup guide changed; only that person knows it was done",
|
|
229
|
-
},
|
|
230
200
|
// attachments
|
|
231
201
|
{
|
|
232
202
|
route: "GET /api/v1/orgs/:orgId/attachments/limits",
|
|
@@ -448,6 +418,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
448
418
|
category: "secret",
|
|
449
419
|
reason: "Returns a generated initial password once, on the web, to the person who approved the account creation",
|
|
450
420
|
},
|
|
421
|
+
{
|
|
422
|
+
route: "POST /api/v1/orgs/:orgId/approvals/:approvalId/invitation-link",
|
|
423
|
+
category: "secret",
|
|
424
|
+
reason: "Returns an invitation link once, on the web, to the person who approved the orgs.invite call",
|
|
425
|
+
},
|
|
451
426
|
{ route: "POST /api/v1/auth/login", category: "human-only", reason: "Password login" },
|
|
452
427
|
{ route: "POST /api/v1/auth/refresh", category: "human-only", reason: "Rotates a refresh token" },
|
|
453
428
|
{ route: "POST /api/v1/auth/logout", category: "human-only", reason: "Ends the login session" },
|
|
@@ -526,21 +501,6 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
526
501
|
category: "human-only",
|
|
527
502
|
reason: "Adds and removes org members from the directory; only an admin, by hand, starts it",
|
|
528
503
|
},
|
|
529
|
-
{
|
|
530
|
-
route: "POST /api/v1/orgs/:orgId/invitations",
|
|
531
|
-
category: "human-only",
|
|
532
|
-
reason: "Invites a person into the org",
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
route: "GET /api/v1/orgs/:orgId/invitations",
|
|
536
|
-
category: "human-only",
|
|
537
|
-
reason: "Lists invitations with their tokens",
|
|
538
|
-
},
|
|
539
|
-
{
|
|
540
|
-
route: "DELETE /api/v1/orgs/:orgId/invitations/:id",
|
|
541
|
-
category: "human-only",
|
|
542
|
-
reason: "Revokes an invitation",
|
|
543
|
-
},
|
|
544
504
|
{
|
|
545
505
|
route: "GET /api/v1/invitations/:token",
|
|
546
506
|
category: "human-only",
|
|
@@ -572,16 +532,6 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
572
532
|
category: "human-only",
|
|
573
533
|
reason: "Removes the caller from the org",
|
|
574
534
|
},
|
|
575
|
-
{
|
|
576
|
-
route: "PATCH /api/v1/orgs/:orgId/members/:accountId",
|
|
577
|
-
category: "human-only",
|
|
578
|
-
reason: "Changes a member's role",
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
route: "DELETE /api/v1/orgs/:orgId/members/:accountId",
|
|
582
|
-
category: "human-only",
|
|
583
|
-
reason: "Removes a member from the org",
|
|
584
|
-
},
|
|
585
535
|
{
|
|
586
536
|
route: "POST /api/v1/orgs/:orgId/service-tokens",
|
|
587
537
|
category: "human-only",
|
|
@@ -661,46 +611,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
661
611
|
category: "internal",
|
|
662
612
|
reason: "Renders a remote server's prompt into text for the web input box, for the person to send; it calls the server with the person's own credential",
|
|
663
613
|
},
|
|
664
|
-
{
|
|
665
|
-
route: "GET /api/v1/orgs/:orgId/connectors/kinds",
|
|
666
|
-
category: "internal",
|
|
667
|
-
reason: "The protocols the web's create-connector form offers; creating a connector stays on the web (secret credentials)",
|
|
668
|
-
},
|
|
669
|
-
{
|
|
670
|
-
route: "POST /api/v1/orgs/:orgId/connectors",
|
|
671
|
-
category: "secret",
|
|
672
|
-
reason: "Creates a connector whose endpoint config can carry credentials",
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
route: "POST /api/v1/orgs/:orgId/connectors/preview",
|
|
676
|
-
category: "secret",
|
|
677
|
-
reason: "Preview body carries a connector credential entered by a person",
|
|
678
|
-
},
|
|
679
|
-
{
|
|
680
|
-
route: "PATCH /api/v1/orgs/:orgId/connectors/:connectorId",
|
|
681
|
-
category: "secret",
|
|
682
|
-
reason: "Edits connector endpoint config that can carry credentials",
|
|
683
|
-
},
|
|
684
|
-
{
|
|
685
|
-
route: "POST /api/v1/orgs/:orgId/connectors/:connectorId/guide-ack",
|
|
686
|
-
category: "human-only",
|
|
687
|
-
reason: "A person confirms they updated the app on the third-party platform after a connector template's setup guide changed; only that person knows it was done",
|
|
688
|
-
},
|
|
689
614
|
{
|
|
690
615
|
route: "POST /api/v1/orgs/:orgId/connectors/:connectorId/tools/:name/review",
|
|
691
616
|
category: "human-only",
|
|
692
617
|
reason: "Reviews a connector tool change, an approval decision",
|
|
693
618
|
},
|
|
694
|
-
{
|
|
695
|
-
route: "PUT /api/v1/orgs/:orgId/connectors/:connectorId/credentials/org",
|
|
696
|
-
category: "secret",
|
|
697
|
-
reason: "Writes the org's connector credentials",
|
|
698
|
-
},
|
|
699
|
-
{
|
|
700
|
-
route: "PUT /api/v1/orgs/:orgId/connectors/:connectorId/credentials/me",
|
|
701
|
-
category: "secret",
|
|
702
|
-
reason: "Writes the caller's connector credentials",
|
|
703
|
-
},
|
|
704
619
|
{
|
|
705
620
|
route: "GET /api/v1/orgs/:orgId/connectors/:connectorId/tool-policies/me",
|
|
706
621
|
category: "internal",
|
|
@@ -711,21 +626,11 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
711
626
|
category: "human-only",
|
|
712
627
|
reason: "A member's own tool policies decide what agents may call with their connection without asking; an agent must never loosen them for itself",
|
|
713
628
|
},
|
|
714
|
-
{
|
|
715
|
-
route: "DELETE /api/v1/orgs/:orgId/connectors/:connectorId/credentials/me",
|
|
716
|
-
category: "secret",
|
|
717
|
-
reason: "Deletes the caller's connector credentials",
|
|
718
|
-
},
|
|
719
629
|
{
|
|
720
630
|
route: "GET /api/v1/orgs/:orgId/tools/extensions",
|
|
721
631
|
category: "internal",
|
|
722
632
|
reason: "Display list of the agent form's tools picker; extensions.tools gives an agent the same facts",
|
|
723
633
|
},
|
|
724
|
-
{
|
|
725
|
-
route: "POST /api/v1/orgs/:orgId/connectors/:connectorId/connect",
|
|
726
|
-
category: "secret",
|
|
727
|
-
reason: "Starts a connector OAuth flow",
|
|
728
|
-
},
|
|
729
634
|
{
|
|
730
635
|
route: "GET /api/v1/oauth/callback",
|
|
731
636
|
category: "secret",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
+
import type { ToolView } from "../conversations/events.js";
|
|
2
3
|
import type { OrgAction } from "../orgs/roles.js";
|
|
3
4
|
import type { ErrorRole } from "./errors.js";
|
|
4
5
|
import type { PersonFieldTarget } from "./person-fields.js";
|
|
@@ -88,6 +89,16 @@ export type PrecheckResult = {
|
|
|
88
89
|
message: string;
|
|
89
90
|
next?: OperationErrorNext;
|
|
90
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* A link card the conversation pops up after an operation (platform web parity spec §4.4, §6): the
|
|
94
|
+
* write's decision stays with a person on a web page (an import review, an OAuth connect), and the
|
|
95
|
+
* card names what waits for them with one button. `link` opens a relative web path (the tool also
|
|
96
|
+
* puts it in the result text as `reviewUrl`); `connect` starts a connector's OAuth flow from the
|
|
97
|
+
* person's web session. Display only (`tool_result.view`): never model-visible.
|
|
98
|
+
*/
|
|
99
|
+
export type HandoffView = Extract<ToolView, {
|
|
100
|
+
kind: "handoff";
|
|
101
|
+
}>;
|
|
91
102
|
/** How long a precheck may take before the tool skips it (spec §14.2 item 2). */
|
|
92
103
|
export declare const PRECHECK_TIMEOUT_MS = 2000;
|
|
93
104
|
/** One operation of the `Platform` tool (spec §7), defined next to its domain. */
|
|
@@ -132,6 +143,13 @@ export interface PlatformOperation<I = unknown> {
|
|
|
132
143
|
* such as deleting a conversation). Static; absent: remembered only for the class `personal`.
|
|
133
144
|
*/
|
|
134
145
|
rememberable?: false;
|
|
146
|
+
/**
|
|
147
|
+
* `true`: the write's result is shown once, on the web, to the person who approves the call (an
|
|
148
|
+
* invitation link, a generated initial password), so only the person the run works for may
|
|
149
|
+
* confirm it: the call always asks them (never a grant, an `allow`, a role escalation) and is
|
|
150
|
+
* refused in an unattended run (`CallPolicy.personOnly`, like person fields, ruling R6).
|
|
151
|
+
*/
|
|
152
|
+
revealsToApprover?: true;
|
|
135
153
|
/**
|
|
136
154
|
* The class of one call when it depends on the target (read at confirmation time): e.g.
|
|
137
155
|
* `agents.update` is `personal` only on a private agent the actor owns and `org` otherwise, so a
|
|
@@ -161,6 +179,13 @@ export interface PlatformOperation<I = unknown> {
|
|
|
161
179
|
* make the call always ask the person, once, on the web. Absent: the write has no person fields.
|
|
162
180
|
*/
|
|
163
181
|
personFields?(input: I, ctx: OperationContext): Promise<PersonFieldTarget>;
|
|
182
|
+
/**
|
|
183
|
+
* Why the operation takes none of its mirrored route's secret fields (`secret()` meta, left in
|
|
184
|
+
* `omits`) and asks the person for none, e.g. a preview without the credential, or a switch that
|
|
185
|
+
* refuses a plugin needing input (`plugins.install` takes it). Rule `platform-op-secret-param`
|
|
186
|
+
* otherwise requires {@link personFields}.
|
|
187
|
+
*/
|
|
188
|
+
withoutSecrets?: string;
|
|
164
189
|
/**
|
|
165
190
|
* The bilingual card summary of a write, rendered from the input and kernel reads (names of
|
|
166
191
|
* the targets, preview counts), never from model text; required unless `confirm` is `read`.
|
|
@@ -175,6 +200,12 @@ export interface PlatformOperation<I = unknown> {
|
|
|
175
200
|
en: string;
|
|
176
201
|
}>;
|
|
177
202
|
run(input: I, ctx: OperationContext): Promise<unknown>;
|
|
203
|
+
/**
|
|
204
|
+
* The link card to pop up after a successful `run` (platform web parity spec §6), built from the
|
|
205
|
+
* input and the result, never from model text; null: none for this result. A throw leaves the
|
|
206
|
+
* card out (the result stands).
|
|
207
|
+
*/
|
|
208
|
+
handoff?(input: I, result: unknown, ctx: OperationContext): HandoffView | null;
|
|
178
209
|
}
|
|
179
210
|
/** Identity helper that types an operation's handler and summary from its input schema. */
|
|
180
211
|
export declare function defineOperation<I>(op: PlatformOperation<I>): PlatformOperation<I>;
|
|
@@ -25,7 +25,7 @@ export const PLATFORM_DOMAINS = [
|
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
id: "plugins",
|
|
28
|
-
description: "Plugins in the org and on the platform: list, read, enable, disable, update, scope, import, the org's own uploads.",
|
|
28
|
+
description: "Plugins in the org and on the platform: list, read, install with inputs, enable, disable, update, scope, import, the org's own uploads.",
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
id: "marketplaces",
|
|
@@ -37,7 +37,7 @@ export const PLATFORM_DOMAINS = [
|
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
id: "connectors",
|
|
40
|
-
description: "Connectors and connector templates: list
|
|
40
|
+
description: "Connectors and connector templates: list, read, preview, create (custom or from a template), edit, credentials (the person enters them on the card), OAuth connect (a Connect button for the person), guide acknowledgement, refresh tools, delete.",
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
id: "extensions",
|
|
@@ -49,7 +49,7 @@ export const PLATFORM_DOMAINS = [
|
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
id: "orgs",
|
|
52
|
-
description: "This org (read, rename, members, its audit log) and, for the super admin, every org and its limits.",
|
|
52
|
+
description: "This org (read, rename, members and invitations, its audit log) and, for the super admin, every org and its limits.",
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
id: "accounts",
|
|
@@ -190,6 +190,7 @@ let AccountsOperations = class AccountsOperations {
|
|
|
190
190
|
// the password is generated by the kernel; the super-admin flag is a role change (human-only)
|
|
191
191
|
omits: ["password", "superAdmin"],
|
|
192
192
|
confirm: "platform",
|
|
193
|
+
revealsToApprover: true,
|
|
193
194
|
errors: [
|
|
194
195
|
{
|
|
195
196
|
code: "account.login_taken",
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { type OnModuleInit } from "@nestjs/common";
|
|
2
2
|
import { ChannelConnections } from "../../channels/connections.service.js";
|
|
3
|
+
import { PluginGuides } from "../../extensions/plugin-guides.js";
|
|
4
|
+
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
3
5
|
import { PlatformOperations } from "../registry.js";
|
|
4
6
|
/**
|
|
5
7
|
* Channel connection operations of the `Platform` tool (spec §14): read a connection and change
|
|
6
8
|
* its binding (which agent answers, what happens to unbound people, on / off, inbound mode),
|
|
7
|
-
* or remove it. Creating a connection
|
|
8
|
-
*
|
|
9
|
+
* or remove it. Creating a connection takes the channel's secrets as person fields (the person types
|
|
10
|
+
* them on the confirmation card; platform web parity spec §4, §7.2); changing the credentials or
|
|
11
|
+
* the config of a connection stays on the web.
|
|
9
12
|
*/
|
|
10
13
|
export declare class ChannelsOperations implements OnModuleInit {
|
|
11
14
|
private readonly registry;
|
|
12
15
|
private readonly channels;
|
|
13
|
-
|
|
16
|
+
private readonly guides;
|
|
17
|
+
private readonly kdb;
|
|
18
|
+
constructor(registry: PlatformOperations, channels: ChannelConnections, guides: PluginGuides, kdb: KernelDb);
|
|
19
|
+
/** The actor's org role (the guide reads and the ack take it), `forbidden` when not a member. */
|
|
20
|
+
private org;
|
|
14
21
|
private nameOf;
|
|
15
22
|
onModuleInit(): void;
|
|
16
23
|
}
|