@capybara-hq/kernel 0.1.0-rc.78 → 0.1.0-rc.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/catalog-content.d.ts +3 -0
- package/dist/catalog/catalog-content.js +2 -1
- package/dist/catalog/component-state.d.ts +4 -1
- package/dist/catalog/component-state.js +2 -2
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplace-fetch.js +1 -1
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/plugin-import.d.ts +3 -0
- package/dist/catalog/plugin-import.js +2 -1
- package/dist/catalog/template-description.d.ts +17 -0
- package/dist/catalog/template-description.js +18 -0
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +13 -13
- package/dist/db/kernel-schema.d.ts +2 -0
- package/dist/extensions/plugin-icons.d.ts +8 -0
- package/dist/extensions/plugin-icons.js +17 -0
- package/dist/git/gateway.js +1 -1
- package/dist/git/identity.d.ts +1 -1
- package/dist/git/identity.js +2 -2
- package/dist/net/public-address.d.ts +3 -3
- package/dist/net/public-address.js +3 -3
- package/dist/packages/npm.d.ts +1 -1
- package/dist/packages/npm.js +1 -1
- package/dist/platform/ops/connectors.ops.js +7 -1
- package/dist/tools/connectors.controller.d.ts +19 -3
- package/dist/tools/connectors.controller.js +20 -3
- package/dist/tools/connectors.schemas.d.ts +4 -0
- package/dist/tools/connectors.schemas.js +13 -1
- package/dist/tools/connectors.service.d.ts +9 -0
- package/dist/tools/connectors.service.js +15 -1
- package/dist/tools/oauth/discovery.d.ts +2 -2
- package/dist/tools/oauth/discovery.js +2 -2
- package/package.json +2 -2
- package/src/migrations/0181_connector_description.sql +3 -0
|
@@ -65,7 +65,10 @@ export interface OrgCatalogItem extends Omit<CatalogItemView, "installs" | "mark
|
|
|
65
65
|
export interface OrgCatalogTemplate {
|
|
66
66
|
id: string;
|
|
67
67
|
displayName: LocalizedName | null;
|
|
68
|
+
/** The English text, or the one text of a plain-string description ("" without one). */
|
|
68
69
|
description: string;
|
|
70
|
+
/** The Chinese text of a `{ zh, en }` description; null: `description` serves both languages. */
|
|
71
|
+
descriptionZh: string | null;
|
|
69
72
|
plugin: string;
|
|
70
73
|
connector: string;
|
|
71
74
|
endpoint: Record<string, unknown>;
|
|
@@ -10,6 +10,7 @@ import { packagePath } from "../packages/tgz.js";
|
|
|
10
10
|
import { checkSkillFiles, SkillArchiveError } from "../skills/package.js";
|
|
11
11
|
import { readDisplayFiles } from "./catalog-files.js";
|
|
12
12
|
import { iconProblem, pluginThemeError, themeApiError } from "./plugin-package.js";
|
|
13
|
+
import { templateDescriptionText } from "./template-description.js";
|
|
13
14
|
import { satisfiesRange } from "./versions.js";
|
|
14
15
|
/**
|
|
15
16
|
* A connector template as an org sees it (the install wizard and the upgrade preview's inputs):
|
|
@@ -20,7 +21,7 @@ export function orgTemplateView(id, file, o = {}) {
|
|
|
20
21
|
return {
|
|
21
22
|
id,
|
|
22
23
|
displayName: file.displayName,
|
|
23
|
-
|
|
24
|
+
...templateDescriptionText(file.description),
|
|
24
25
|
plugin: t.plugin,
|
|
25
26
|
connector: t.connector,
|
|
26
27
|
endpoint: t.endpoint,
|
|
@@ -68,7 +68,10 @@ export interface ComponentRow extends ComponentScopeFacts {
|
|
|
68
68
|
/** The current version (a connector template: the catalog version that last changed it). */
|
|
69
69
|
version: string;
|
|
70
70
|
description: string | null;
|
|
71
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* The description's Chinese text (a theme's or skill's `description.zh`, a connector template's
|
|
73
|
+
* `description.zh`); null without one.
|
|
74
|
+
*/
|
|
72
75
|
descriptionZh: string | null;
|
|
73
76
|
/**
|
|
74
77
|
* A connector template's localized display name (its file's `displayName`); null for skills and
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LIVE_INSTALL_STATUSES } from "./install-status.js";
|
|
2
2
|
import { visibleTo, wantedOn } from "./scope.js";
|
|
3
|
+
import { templateDescription } from "./template-description.js";
|
|
3
4
|
/** The kinds the scope, switch, ownership and preview flows (and the component routes) walk. */
|
|
4
5
|
export const COMPONENT_KINDS = [
|
|
5
6
|
"skill",
|
|
@@ -119,8 +120,7 @@ export async function loadComponents(db, kind, filter = {}) {
|
|
|
119
120
|
name: r.template_id,
|
|
120
121
|
plugin: r.item_name,
|
|
121
122
|
version: r.current_version,
|
|
122
|
-
|
|
123
|
-
descriptionZh: null,
|
|
123
|
+
...templateDescription(file?.description),
|
|
124
124
|
displayName: localizedName(file?.displayName),
|
|
125
125
|
originOrgId: null,
|
|
126
126
|
};
|
|
@@ -8,7 +8,7 @@ import { type LookupFn, NetDeniedError, type NetPolicy } from "../net/public-add
|
|
|
8
8
|
* - https only (`allowInsecureLoopback`, tests only, allows http on loopback addresses), no user
|
|
9
9
|
* info in the URL;
|
|
10
10
|
* - every request goes through `net/safeFetch`: the host must resolve to public addresses (or be
|
|
11
|
-
* exempt by `
|
|
11
|
+
* exempt by `net.allowPrivateHosts` / the npm registry origin) and the connection is
|
|
12
12
|
* pinned to the checked address;
|
|
13
13
|
* - redirects are not followed (a 3xx fails): one redirect could otherwise send the request (and the
|
|
14
14
|
* token) elsewhere;
|
|
@@ -22,7 +22,7 @@ export function marketplaceNetCode(e) {
|
|
|
22
22
|
export function marketplaceNetPolicy(config) {
|
|
23
23
|
return {
|
|
24
24
|
allowInsecureLoopback: config.marketplaces.allowInsecureLoopback,
|
|
25
|
-
allowPrivateHosts: config.
|
|
25
|
+
allowPrivateHosts: config.net.allowPrivateHosts,
|
|
26
26
|
trustedOrigins: [new URL(config.packages.npmRegistry).origin],
|
|
27
27
|
...(config.net.httpsProxy !== undefined && {
|
|
28
28
|
proxy: { url: config.net.httpsProxy, noProxy: config.net.noProxy },
|
|
@@ -208,7 +208,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
|
|
|
208
208
|
/** The host versions (an entry's `minKernel` is judged against them). */
|
|
209
209
|
export declare const HOST_VERSIONS: {
|
|
210
210
|
readonly kernel: string;
|
|
211
|
-
readonly sdk: "0.1.0-rc.
|
|
211
|
+
readonly sdk: "0.1.0-rc.65";
|
|
212
212
|
};
|
|
213
213
|
/** Whether this deployment satisfies the entry's `minKernel`. */
|
|
214
214
|
export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
|
|
@@ -127,7 +127,10 @@ export interface PluginReviewClient {
|
|
|
127
127
|
export interface PluginReviewTemplate {
|
|
128
128
|
id: string;
|
|
129
129
|
displayName: LocalizedName;
|
|
130
|
+
/** The English text, or the one text of a plain-string description ("" without one). */
|
|
130
131
|
description: string;
|
|
132
|
+
/** The Chinese text of a `{ zh, en }` description; null: `description` serves both languages. */
|
|
133
|
+
descriptionZh: string | null;
|
|
131
134
|
plugin: string;
|
|
132
135
|
connector: string;
|
|
133
136
|
endpoint: Record<string, unknown>;
|
|
@@ -57,6 +57,7 @@ import { hasImportRequests, importRequestOf, resolveImportRequests } from "./req
|
|
|
57
57
|
import { assertNameNotReserved } from "./reserved-names.js";
|
|
58
58
|
import { oweScopeItem } from "./scope-jobs.js";
|
|
59
59
|
import { addScopeOrg } from "./scope-orgs.js";
|
|
60
|
+
import { templateDescriptionText } from "./template-description.js";
|
|
60
61
|
import { maxSatisfying, satisfiesRange } from "./versions.js";
|
|
61
62
|
/**
|
|
62
63
|
* Platform import of a plugin (package ecosystem spec §4.3): one review for every plugin, whatever
|
|
@@ -1533,7 +1534,7 @@ let PluginImport = class PluginImport {
|
|
|
1533
1534
|
return {
|
|
1534
1535
|
id: c.id,
|
|
1535
1536
|
displayName: c.file.displayName,
|
|
1536
|
-
|
|
1537
|
+
...templateDescriptionText(c.file.description),
|
|
1537
1538
|
plugin: t.plugin,
|
|
1538
1539
|
connector: t.connector,
|
|
1539
1540
|
endpoint: t.endpoint,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A connector template's description as the API returns it: the text for every language and the Chinese one. */
|
|
2
|
+
export interface TemplateDescription {
|
|
3
|
+
/** The English text, or the one text a plain-string description has; null without one. */
|
|
4
|
+
description: string | null;
|
|
5
|
+
/** The Chinese text of a `{ zh, en }` description; null: `description` serves both languages. */
|
|
6
|
+
descriptionZh: string | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Splits a template file's `description` (a string, or `{ zh, en }`; read from stored JSON, so any
|
|
10
|
+
* other shape counts as none) into the API's `description` / `descriptionZh` pair.
|
|
11
|
+
*/
|
|
12
|
+
export declare function templateDescription(v: unknown): TemplateDescription;
|
|
13
|
+
/** {@link templateDescription} with "" rather than null without one (the wizard and the review). */
|
|
14
|
+
export declare function templateDescriptionText(v: unknown): {
|
|
15
|
+
description: string;
|
|
16
|
+
descriptionZh: string | null;
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a template file's `description` (a string, or `{ zh, en }`; read from stored JSON, so any
|
|
3
|
+
* other shape counts as none) into the API's `description` / `descriptionZh` pair.
|
|
4
|
+
*/
|
|
5
|
+
export function templateDescription(v) {
|
|
6
|
+
if (typeof v === "string")
|
|
7
|
+
return { description: v === "" ? null : v, descriptionZh: null };
|
|
8
|
+
const d = v;
|
|
9
|
+
if (typeof d?.en === "string" && typeof d.zh === "string") {
|
|
10
|
+
return { description: d.en, descriptionZh: d.zh };
|
|
11
|
+
}
|
|
12
|
+
return { description: null, descriptionZh: null };
|
|
13
|
+
}
|
|
14
|
+
/** {@link templateDescription} with "" rather than null without one (the wizard and the review). */
|
|
15
|
+
export function templateDescriptionText(v) {
|
|
16
|
+
const d = templateDescription(v);
|
|
17
|
+
return { description: d.description ?? "", descriptionZh: d.descriptionZh };
|
|
18
|
+
}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -108,11 +108,11 @@ export declare const KernelConfigSchema: z.ZodObject<{
|
|
|
108
108
|
refreshIntervalMinutes: z.ZodDefault<z.ZodNumber>;
|
|
109
109
|
maxIndexBytes: z.ZodDefault<z.ZodNumber>;
|
|
110
110
|
allowInsecureLoopback: z.ZodDefault<z.ZodBoolean>;
|
|
111
|
-
allowPrivateHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
112
111
|
allowedHosts: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
113
112
|
}, z.core.$strict>>;
|
|
114
113
|
net: z.ZodPrefault<z.ZodObject<{
|
|
115
114
|
allowInsecureLoopback: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
+
allowPrivateHosts: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
116
116
|
httpsProxy: z.ZodOptional<z.ZodString>;
|
|
117
117
|
noProxy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
118
118
|
}, z.core.$strict>>;
|
package/dist/config/schema.js
CHANGED
|
@@ -538,17 +538,6 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
538
538
|
.meta(meta({
|
|
539
539
|
description: "Testing only: allow plain http for marketplace and tarball URLs on loopback addresses",
|
|
540
540
|
})),
|
|
541
|
-
allowPrivateHosts: z
|
|
542
|
-
.array(z.string().superRefine((entry, ctx) => {
|
|
543
|
-
const problem = privateHostEntryProblem(entry);
|
|
544
|
-
if (problem !== null)
|
|
545
|
-
ctx.addIssue({ code: "custom", message: problem });
|
|
546
|
-
}))
|
|
547
|
-
.max(100)
|
|
548
|
-
.default([])
|
|
549
|
-
.meta(meta({
|
|
550
|
-
description: "Hosts or CIDRs that marketplace and git downloads may reach although they resolve to private addresses, e.g. an internal GitLab mirror. CIDR and IP entries match IP-literal hosts only; list internal DNS names as hostnames. Link-local addresses (169.254.0.0/16, fe80::/10) are always refused",
|
|
551
|
-
})),
|
|
552
541
|
allowedHosts: z
|
|
553
542
|
.array(z
|
|
554
543
|
.string()
|
|
@@ -575,6 +564,17 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
575
564
|
.meta(meta({
|
|
576
565
|
description: "Testing only: lift every loopback and unspecified-address refusal for extensions' ctx.net.fetch (127.0.0.0/8, ::1, 0.0.0.0/8, ::), including plain http to them (fake servers in test stacks). Link-local and cloud metadata addresses stay refused. Never set it in production",
|
|
577
566
|
})),
|
|
567
|
+
allowPrivateHosts: z
|
|
568
|
+
.array(z.string().superRefine((entry, ctx) => {
|
|
569
|
+
const problem = privateHostEntryProblem(entry);
|
|
570
|
+
if (problem !== null)
|
|
571
|
+
ctx.addIssue({ code: "custom", message: problem });
|
|
572
|
+
}))
|
|
573
|
+
.max(100)
|
|
574
|
+
.default([])
|
|
575
|
+
.meta(meta({
|
|
576
|
+
description: "Hosts or CIDRs that the kernel's own outbound requests may reach although they resolve to private addresses, e.g. an internal GitLab mirror or identity provider: marketplace, archive and git downloads, npm registry downloads (packages, provenance, bootstrap plugins), OAuth requests (discovery, registration, token endpoints) and git identity checks. CIDR and IP entries match IP-literal hosts only; list internal DNS names as hostnames. Link-local addresses (169.254.0.0/16, fe80::/10) are always refused. Extensions' ctx.net.fetch requests use an organization's allowed internal endpoints instead",
|
|
577
|
+
})),
|
|
578
578
|
httpsProxy: z
|
|
579
579
|
.string()
|
|
580
580
|
.superRefine((value, ctx) => {
|
|
@@ -585,7 +585,7 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
585
585
|
.optional()
|
|
586
586
|
.meta(meta({
|
|
587
587
|
secret: true,
|
|
588
|
-
description: "HTTP(S) egress proxy for marketplace, archive and git downloads, npm registry downloads (packages, provenance, bootstrap plugins) OAuth requests (discovery, registration, token endpoints) and extensions' ctx.net.fetch requests (person-supplied URLs such as connector endpoints), e.g. http://user:password@proxy.internal:3128. https downloads tunnel through it with CONNECT and the kernel no longer resolves their hosts: the proxy does, so blocking private and internal addresses becomes the proxy's job, including for organizations' ctx.net requests (IP-literal URLs are still checked against
|
|
588
|
+
description: "HTTP(S) egress proxy for marketplace, archive and git downloads, npm registry downloads (packages, provenance, bootstrap plugins) OAuth requests (discovery, registration, token endpoints) and extensions' ctx.net.fetch requests (person-supplied URLs such as connector endpoints), e.g. http://user:password@proxy.internal:3128. https downloads tunnel through it with CONNECT and the kernel no longer resolves their hosts: the proxy does, so blocking private and internal addresses becomes the proxy's job, including for organizations' ctx.net requests (IP-literal URLs are still checked against net.allowPrivateHosts, or for ctx.net against the organization's allowed internal endpoints). Loopback hosts never use it, nor does an http:// npm registry; list an internal https registry in net.noProxy, and likewise every internal https host an organization's allowed internal endpoints name (with a proxy set the proxy resolves it, so the organization's allowances do not apply unless the host is in net.noProxy). HTTPS_PROXY / NODE_USE_ENV_PROXY are not read. Credentials in the URL are sent as Basic Proxy-Authorization and never logged",
|
|
589
589
|
})),
|
|
590
590
|
noProxy: z
|
|
591
591
|
.array(z
|
|
@@ -600,7 +600,7 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
600
600
|
.max(100)
|
|
601
601
|
.default([])
|
|
602
602
|
.meta(meta({
|
|
603
|
-
description: "Hostnames or IP addresses that bypass net.httpsProxy (an entry also matches its subdomains; a leading dot is allowed). These hosts are resolved locally and must resolve to public addresses unless listed in
|
|
603
|
+
description: "Hostnames or IP addresses that bypass net.httpsProxy (an entry also matches its subdomains; a leading dot is allowed). These hosts are resolved locally and must resolve to public addresses unless listed in net.allowPrivateHosts (the kernel's own requests) or in an organization's allowed internal endpoints (ctx.net.fetch). List an organization's allowed internal https hosts here when net.httpsProxy is set, otherwise the proxy resolves them and the allowances do not apply",
|
|
604
604
|
})),
|
|
605
605
|
})
|
|
606
606
|
.prefault({}),
|
|
@@ -650,6 +650,8 @@ export interface ConnectorsTable {
|
|
|
650
650
|
* re-enables exactly the connectors it disabled.
|
|
651
651
|
*/
|
|
652
652
|
disabled_by_plugin_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
653
|
+
/** 0181: the connector's own description, set by an org admin (null: none). */
|
|
654
|
+
description: ColumnType<string | null, string | null | undefined, string | null>;
|
|
653
655
|
}
|
|
654
656
|
/**
|
|
655
657
|
* 0104: a member's own policy for one tool of a personal-credential connector, for calls made with
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CatalogIcon } from "../catalog/catalog-content.js";
|
|
2
2
|
import { type PluginScope } from "../catalog/scope.js";
|
|
3
|
+
import { type TemplateDescription } from "../catalog/template-description.js";
|
|
3
4
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
4
5
|
import { type OrgRole } from "../orgs/roles.js";
|
|
5
6
|
/** Who reads the icons: the super admin (admin routes) or one org (its routes, its visibility). */
|
|
@@ -94,6 +95,13 @@ export declare class PluginIcons {
|
|
|
94
95
|
})[], scope: Extract<PluginIconScope, {
|
|
95
96
|
kind: "org";
|
|
96
97
|
}>): Promise<(string | null)[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Platform connector template id -> its description (the template file's current version,
|
|
100
|
+
* {@link templateDescription}), for the templates the reader may see under the same gate as
|
|
101
|
+
* their own icons ({@link ofTemplates}); templates without one, or hidden, are absent. The
|
|
102
|
+
* connector pages show it for connectors made from a template.
|
|
103
|
+
*/
|
|
104
|
+
templateDescriptions(ids: string[], scope: PluginIconScope): Promise<Map<string, TemplateDescription>>;
|
|
97
105
|
/**
|
|
98
106
|
* Reads the icon a connector shows ({@link ofConnectors}); the caller has checked that the
|
|
99
107
|
* connector is the org's. No icon the reader may see -> `catalog.icon_not_found`.
|
|
@@ -12,6 +12,7 @@ import { sql } from "kysely";
|
|
|
12
12
|
import { readCatalogDisplayFiles, readCatalogIcon, } from "../catalog/catalog-content.js";
|
|
13
13
|
import { iconProblem } from "../catalog/plugin-package.js";
|
|
14
14
|
import { requestable } from "../catalog/scope.js";
|
|
15
|
+
import { templateDescription } from "../catalog/template-description.js";
|
|
15
16
|
import { ApiError } from "../errors.js";
|
|
16
17
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
17
18
|
import { roleAtLeast } from "../orgs/roles.js";
|
|
@@ -136,6 +137,21 @@ let PluginIcons = class PluginIcons {
|
|
|
136
137
|
return `/api/v1/orgs/${enc(scope.orgId)}/connectors/${enc(r.id)}/icon?v=${enc(v)}`;
|
|
137
138
|
});
|
|
138
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Platform connector template id -> its description (the template file's current version,
|
|
142
|
+
* {@link templateDescription}), for the templates the reader may see under the same gate as
|
|
143
|
+
* their own icons ({@link ofTemplates}); templates without one, or hidden, are absent. The
|
|
144
|
+
* connector pages show it for connectors made from a template.
|
|
145
|
+
*/
|
|
146
|
+
async templateDescriptions(ids, scope) {
|
|
147
|
+
const out = new Map();
|
|
148
|
+
for (const r of await this.visibleTemplates(await this.templateRows(ids), scope)) {
|
|
149
|
+
const d = templateDescription(r.description);
|
|
150
|
+
if (d.description !== null)
|
|
151
|
+
out.set(r.templateId, d);
|
|
152
|
+
}
|
|
153
|
+
return out;
|
|
154
|
+
}
|
|
139
155
|
/**
|
|
140
156
|
* Reads the icon a connector shows ({@link ofConnectors}); the caller has checked that the
|
|
141
157
|
* connector is the org's. No icon the reader may see -> `catalog.icon_not_found`.
|
|
@@ -225,6 +241,7 @@ let PluginIcons = class PluginIcons {
|
|
|
225
241
|
"t.shareable as template_shareable",
|
|
226
242
|
"t.current_version",
|
|
227
243
|
sql `t.file->>'icon'`.as("icon"),
|
|
244
|
+
sql `t.file->'description'`.as("description"),
|
|
228
245
|
"v.files",
|
|
229
246
|
"i.id",
|
|
230
247
|
"i.scope",
|
package/dist/git/gateway.js
CHANGED
|
@@ -600,7 +600,7 @@ let GitGateway = class GitGateway {
|
|
|
600
600
|
signal: ac.signal,
|
|
601
601
|
},
|
|
602
602
|
// the same rules as the commit identity lookup: the deployment's egress proxy and its
|
|
603
|
-
// private host allowance (`
|
|
603
|
+
// private host allowance (`net.allowPrivateHosts`, e.g. an internal GitHub
|
|
604
604
|
// Enterprise host), never a redirect
|
|
605
605
|
gitNetPolicy(this.config.get()));
|
|
606
606
|
};
|
package/dist/git/identity.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type GitIdentityApiBase = (host: string) => string | null;
|
|
|
36
36
|
export declare function gitIdentityApiBase(host: string): string | null;
|
|
37
37
|
/**
|
|
38
38
|
* The kernel's outbound rules for git hosts and their APIs: the deployment's egress proxy, its
|
|
39
|
-
* private host exemptions (`
|
|
39
|
+
* private host exemptions (`net.allowPrivateHosts`) and loopback http only under
|
|
40
40
|
* `tools.oauthAllowInsecureLoopback` (tests), as for OAuth URLs. Redirects are never followed.
|
|
41
41
|
*/
|
|
42
42
|
export declare function gitNetPolicy(config: KernelConfig): NetPolicy;
|
package/dist/git/identity.js
CHANGED
|
@@ -36,13 +36,13 @@ export function gitIdentityApiBase(host) {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* The kernel's outbound rules for git hosts and their APIs: the deployment's egress proxy, its
|
|
39
|
-
* private host exemptions (`
|
|
39
|
+
* private host exemptions (`net.allowPrivateHosts`) and loopback http only under
|
|
40
40
|
* `tools.oauthAllowInsecureLoopback` (tests), as for OAuth URLs. Redirects are never followed.
|
|
41
41
|
*/
|
|
42
42
|
export function gitNetPolicy(config) {
|
|
43
43
|
return {
|
|
44
44
|
allowInsecureLoopback: config.tools.oauthAllowInsecureLoopback,
|
|
45
|
-
allowPrivateHosts: config.
|
|
45
|
+
allowPrivateHosts: config.net.allowPrivateHosts,
|
|
46
46
|
trustedOrigins: [],
|
|
47
47
|
...(config.net.httpsProxy !== undefined && {
|
|
48
48
|
proxy: { url: config.net.httpsProxy, noProxy: config.net.noProxy },
|
|
@@ -16,7 +16,7 @@ export type NetPolicy = {
|
|
|
16
16
|
/** Testing only: plain http and loopback addresses for loopback hosts. */
|
|
17
17
|
allowInsecureLoopback: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* `
|
|
19
|
+
* `net.allowPrivateHosts`: a hostname entry (exact, case-insensitive) exempts that host's
|
|
20
20
|
* resolved addresses; an IP or CIDR entry exempts IP-literal URL hosts inside it only, never a DNS
|
|
21
21
|
* name that resolves there (an attacker's name could point into the range).
|
|
22
22
|
*/
|
|
@@ -68,11 +68,11 @@ export declare const MIN_CIDR_PREFIX: {
|
|
|
68
68
|
/** A syntactically valid `addr/prefix` CIDR as [address, prefix, family], else undefined. */
|
|
69
69
|
export declare function parseCidr(s: string): [string, number, "ipv4" | "ipv6"] | undefined;
|
|
70
70
|
/**
|
|
71
|
-
* Why a `
|
|
71
|
+
* Why a `net.allowPrivateHosts` entry is invalid (English), or null when it is a hostname,
|
|
72
72
|
* an IP address or a CIDR no broader than /8 (IPv4) or /16 (IPv6).
|
|
73
73
|
*/
|
|
74
74
|
export declare function privateHostEntryProblem(entry: string): string | null;
|
|
75
|
-
/** A valid `
|
|
75
|
+
/** A valid `net.allowPrivateHosts` entry (see {@link privateHostEntryProblem}). */
|
|
76
76
|
export declare function isPrivateHostEntry(entry: string): boolean;
|
|
77
77
|
/**
|
|
78
78
|
* Whether a host entry of `policy.allowPrivateHosts` (a hostname, a `*.domain` wildcard, an IP or a
|
|
@@ -193,7 +193,7 @@ export function parseCidr(s) {
|
|
|
193
193
|
}
|
|
194
194
|
const HOSTNAME = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/;
|
|
195
195
|
/**
|
|
196
|
-
* Why a `
|
|
196
|
+
* Why a `net.allowPrivateHosts` entry is invalid (English), or null when it is a hostname,
|
|
197
197
|
* an IP address or a CIDR no broader than /8 (IPv4) or /16 (IPv6).
|
|
198
198
|
*/
|
|
199
199
|
export function privateHostEntryProblem(entry) {
|
|
@@ -210,7 +210,7 @@ export function privateHostEntryProblem(entry) {
|
|
|
210
210
|
return null;
|
|
211
211
|
return "must be a hostname, an IP address or a CIDR such as 10.1.0.0/16";
|
|
212
212
|
}
|
|
213
|
-
/** A valid `
|
|
213
|
+
/** A valid `net.allowPrivateHosts` entry (see {@link privateHostEntryProblem}). */
|
|
214
214
|
export function isPrivateHostEntry(entry) {
|
|
215
215
|
return privateHostEntryProblem(entry) === null;
|
|
216
216
|
}
|
|
@@ -320,7 +320,7 @@ export async function resolvePublic(host, policy, lookup = defaultLookup, origin
|
|
|
320
320
|
(isLinkLocalAddress(a) || ownHost(a) || (!ex.all && !allowedBy(ex.cidrs, a)));
|
|
321
321
|
if (addrs.some(refused)) {
|
|
322
322
|
const hint = policy.extension?.privateHint ??
|
|
323
|
-
"add the hostname to
|
|
323
|
+
"add the hostname to net.allowPrivateHosts to allow an internal host";
|
|
324
324
|
throw new NetDeniedError("net.private_address", h, addrs.some(isLinkLocalAddress)
|
|
325
325
|
? `Access to ${h} is refused: it resolves to a link-local or cloud metadata address, which is never allowed.`
|
|
326
326
|
: addrs.some(ownHost)
|
package/dist/packages/npm.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type LookupFn, type NetPolicy } from "../net/public-address.js";
|
|
|
4
4
|
* the config (trusted), but whatever it returns is external input:
|
|
5
5
|
* - every request goes through `packages/kernel/src/net` ({@link safeFetch}) under `cfg.net`
|
|
6
6
|
* (the kernel passes `marketplaceNetPolicy`: the registry's origin is trusted, any other host
|
|
7
|
-
* must resolve to public addresses unless `
|
|
7
|
+
* must resolve to public addresses unless `net.allowPrivateHosts` exempts it, https
|
|
8
8
|
* tunnels through `net.httpsProxy`, and the connection is pinned to the checked address);
|
|
9
9
|
* - redirects are never followed (a 3xx fails): one registry redirect could otherwise send the
|
|
10
10
|
* download (and the token) anywhere;
|
package/dist/packages/npm.js
CHANGED
|
@@ -8,7 +8,7 @@ import { safeFetch } from "../net/safe-fetch.js";
|
|
|
8
8
|
* the config (trusted), but whatever it returns is external input:
|
|
9
9
|
* - every request goes through `packages/kernel/src/net` ({@link safeFetch}) under `cfg.net`
|
|
10
10
|
* (the kernel passes `marketplaceNetPolicy`: the registry's origin is trusted, any other host
|
|
11
|
-
* must resolve to public addresses unless `
|
|
11
|
+
* must resolve to public addresses unless `net.allowPrivateHosts` exempts it, https
|
|
12
12
|
* tunnels through `net.httpsProxy`, and the connection is pinned to the checked address);
|
|
13
13
|
* - redirects are never followed (a 3xx fails): one registry redirect could otherwise send the
|
|
14
14
|
* download (and the token) anywhere;
|
|
@@ -116,6 +116,7 @@ const summary = (c) => ({
|
|
|
116
116
|
},
|
|
117
117
|
status: c.status,
|
|
118
118
|
platformTemplateId: c.platformTemplateId,
|
|
119
|
+
description: c.description,
|
|
119
120
|
updatedAt: c.updatedAt,
|
|
120
121
|
});
|
|
121
122
|
/** A connector's detail: its tools (name, description, state, default policy) and your credential state. */
|
|
@@ -483,7 +484,7 @@ let ConnectorsOperations = class ConnectorsOperations {
|
|
|
483
484
|
}),
|
|
484
485
|
defineOperation({
|
|
485
486
|
id: "connectors.update",
|
|
486
|
-
description: "Edit a connector (org admins): rename it, switch it off or on (status), or use an org-credential connector that declares git hosts for git in sandboxes (useForGit; pushes are then the bot's). Its endpoint and credential are not edited here (credentials: connectors.set-org-credential); per-tool state and default policies stay on the connector's web page.",
|
|
487
|
+
description: "Edit a connector (org admins): rename it, set or clear its own description (description; null clears it), switch it off or on (status), or use an org-credential connector that declares git hosts for git in sandboxes (useForGit; pushes are then the bot's). Its endpoint and credential are not edited here (credentials: connectors.set-org-credential); per-tool state and default policies stay on the connector's web page.",
|
|
487
488
|
input: UpdateInput,
|
|
488
489
|
example: { connectorId: EXAMPLE_ID, name: "Docs (staging)" },
|
|
489
490
|
authz: { orgAction: "connectors.manage" },
|
|
@@ -511,6 +512,11 @@ let ConnectorsOperations = class ConnectorsOperations {
|
|
|
511
512
|
zh.push(i.status === "active" ? "启用" : "停用");
|
|
512
513
|
en.push(i.status === "active" ? "switch it on" : "switch it off");
|
|
513
514
|
}
|
|
515
|
+
if (i.description !== undefined) {
|
|
516
|
+
const text = i.description?.trim() ?? "";
|
|
517
|
+
zh.push(text === "" ? "清除说明" : `说明改为「${named(text)}」`);
|
|
518
|
+
en.push(text === "" ? "clear its description" : `set its description to "${named(text)}"`);
|
|
519
|
+
}
|
|
514
520
|
if (i.useForGit !== undefined) {
|
|
515
521
|
zh.push(i.useForGit ? "用于沙箱中的 git" : "不再用于沙箱中的 git");
|
|
516
522
|
en.push(i.useForGit ? "use it for git in sandboxes" : "stop using it for git");
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import type { FastifyReply } from "fastify";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
+
/**
|
|
4
|
+
* The description of the platform connector template a connector was made from (its current
|
|
5
|
+
* version; both null for a custom connector or a template the reader may not see). The
|
|
6
|
+
* connector's own `description` comes first on the pages; this is the fallback.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConnectorTemplateDescription {
|
|
9
|
+
/** The template's English or only text. */
|
|
10
|
+
templateDescription: string | null;
|
|
11
|
+
/** The template's Chinese text; null: `templateDescription` serves both languages. */
|
|
12
|
+
templateDescriptionZh: string | null;
|
|
13
|
+
}
|
|
3
14
|
import type { ConnectionGuideState } from "../extensions/plugin-guides.js";
|
|
4
15
|
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
5
16
|
import { type Principal } from "../identity/principal.js";
|
|
@@ -78,6 +89,7 @@ declare const CreateBody: z.ZodObject<{
|
|
|
78
89
|
}, z.core.$strict>], "type">;
|
|
79
90
|
credential: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
80
91
|
git: z.ZodOptional<z.ZodType<import("@capybara-hq/plugin-sdk").GitSource, unknown, z.core.$ZodTypeInternals<import("@capybara-hq/plugin-sdk").GitSource, unknown>>>;
|
|
92
|
+
description: z.ZodOptional<z.ZodString>;
|
|
81
93
|
}, z.core.$strict>;
|
|
82
94
|
declare const PreviewBody: z.ZodObject<{
|
|
83
95
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -168,6 +180,7 @@ declare const UpdateBody: z.ZodObject<{
|
|
|
168
180
|
}, z.core.$strict>>>;
|
|
169
181
|
allowUnannotated: z.ZodOptional<z.ZodBoolean>;
|
|
170
182
|
useForGit: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
171
184
|
}, z.core.$strict>;
|
|
172
185
|
declare const ReviewBody: z.ZodObject<{
|
|
173
186
|
action: z.ZodEnum<{
|
|
@@ -182,10 +195,11 @@ interface MemberPolicySheet {
|
|
|
182
195
|
}
|
|
183
196
|
/**
|
|
184
197
|
* A connector as the org's pages show it: with its template's or plugin's icon (`icon`, see
|
|
185
|
-
* `withIcons`), its template's
|
|
198
|
+
* `withIcons`), its platform template's description (`templateDescription` /
|
|
199
|
+
* `templateDescriptionZh`, null for a custom connector; its own `description` comes first), its template's setup guide and the drift since it was set up (`setupGuide`,
|
|
186
200
|
* `guideDrift`; spec 2026-11-09-setup-guides-v2-design.md §9.3, §11).
|
|
187
201
|
*/
|
|
188
|
-
export type ConnectorPage<T extends ConnectorSummary = ConnectorDetail> = T & ConnectionGuideState & {
|
|
202
|
+
export type ConnectorPage<T extends ConnectorSummary = ConnectorDetail> = T & ConnectionGuideState & ConnectorTemplateDescription & {
|
|
189
203
|
icon: string | null;
|
|
190
204
|
/** The one-connector read of an `oauth_code` connector, for managers: its redirect URI. */
|
|
191
205
|
oauthCallbackUrl?: string | null;
|
|
@@ -206,7 +220,9 @@ export declare class ConnectorsController {
|
|
|
206
220
|
* load it too): the own icon of the platform connector template it was made from (its current
|
|
207
221
|
* version, the platform's one version of the template), else the icon of the plugin its template
|
|
208
222
|
* came from, else null (a custom connector, no icon, or one the reader's catalog does not show:
|
|
209
|
-
* the share gate holds; maintainer decision 2026-11-09).
|
|
223
|
+
* the share gate holds; maintainer decision 2026-11-09). Also `templateDescription` /
|
|
224
|
+
* `templateDescriptionZh`: that platform template's description under the same gate (null for
|
|
225
|
+
* a custom connector).
|
|
210
226
|
*/
|
|
211
227
|
private withIcons;
|
|
212
228
|
/**
|
|
@@ -80,11 +80,28 @@ let ConnectorsController = class ConnectorsController {
|
|
|
80
80
|
* load it too): the own icon of the platform connector template it was made from (its current
|
|
81
81
|
* version, the platform's one version of the template), else the icon of the plugin its template
|
|
82
82
|
* came from, else null (a custom connector, no icon, or one the reader's catalog does not show:
|
|
83
|
-
* the share gate holds; maintainer decision 2026-11-09).
|
|
83
|
+
* the share gate holds; maintainer decision 2026-11-09). Also `templateDescription` /
|
|
84
|
+
* `templateDescriptionZh`: that platform template's description under the same gate (null for
|
|
85
|
+
* a custom connector).
|
|
84
86
|
*/
|
|
85
87
|
async withIcons(org, rows) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
+
const scope = orgIconScope(org);
|
|
89
|
+
const templateIds = rows.flatMap((r) => (r.platformTemplateId ? [r.platformTemplateId] : []));
|
|
90
|
+
const [urls, descriptions] = await Promise.all([
|
|
91
|
+
this.icons.ofConnectors(rows.map((r) => ({ id: r.id, templateId: r.platformTemplateId, itemId: r.catalogItemId })), scope),
|
|
92
|
+
this.icons.templateDescriptions(templateIds, scope),
|
|
93
|
+
]);
|
|
94
|
+
return rows.map((r, i) => {
|
|
95
|
+
const d = r.platformTemplateId
|
|
96
|
+
? descriptions.get(r.platformTemplateId)
|
|
97
|
+
: undefined;
|
|
98
|
+
return {
|
|
99
|
+
...r,
|
|
100
|
+
templateDescription: d?.description ?? null,
|
|
101
|
+
templateDescriptionZh: d?.descriptionZh ?? null,
|
|
102
|
+
icon: urls[i] ?? null,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
88
105
|
}
|
|
89
106
|
/**
|
|
90
107
|
* The icon the connector shows (svg or png, the catalog icon response headers): its template's
|
|
@@ -27,6 +27,8 @@ export declare const GitPushPolicyBody: z.ZodObject<{
|
|
|
27
27
|
}>;
|
|
28
28
|
}, z.core.$strict>;
|
|
29
29
|
/** `POST …/connectors`: a custom connector with its endpoint, auth method and credential. */
|
|
30
|
+
/** Upper bound on a connector's own description, in characters (as a template's, per text). */
|
|
31
|
+
export declare const CONNECTOR_DESCRIPTION_MAX: 1024;
|
|
30
32
|
export declare const ConnectorCreateSchema: z.ZodObject<{
|
|
31
33
|
name: z.ZodString;
|
|
32
34
|
slug: z.ZodOptional<z.ZodString>;
|
|
@@ -97,6 +99,7 @@ export declare const ConnectorCreateSchema: z.ZodObject<{
|
|
|
97
99
|
}, z.core.$strict>], "type">;
|
|
98
100
|
credential: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
99
101
|
git: z.ZodOptional<z.ZodType<import("@capybara-hq/plugin-sdk").GitSource, unknown, z.core.$ZodTypeInternals<import("@capybara-hq/plugin-sdk").GitSource, unknown>>>;
|
|
102
|
+
description: z.ZodOptional<z.ZodString>;
|
|
100
103
|
}, z.core.$strict>;
|
|
101
104
|
/**
|
|
102
105
|
* `POST …/connectors/preview` (ruling A20): the create's connector, endpoint, auth and credential;
|
|
@@ -195,6 +198,7 @@ export declare const ConnectorUpdateSchema: z.ZodObject<{
|
|
|
195
198
|
}, z.core.$strict>>>;
|
|
196
199
|
allowUnannotated: z.ZodOptional<z.ZodBoolean>;
|
|
197
200
|
useForGit: z.ZodOptional<z.ZodBoolean>;
|
|
201
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
198
202
|
}, z.core.$strict>;
|
|
199
203
|
export declare const CONNECTOR_ROUTES: readonly RouteSchemas[];
|
|
200
204
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectorAuthSchema, GitSourceSchema, secret } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import { CONNECTOR_TEMPLATE_LIMITS, ConnectorAuthSchema, GitSourceSchema, secret, } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
/**
|
|
4
4
|
* A credential value: `Credentials.validate` checks its shape by auth method (values are never
|
|
@@ -21,6 +21,14 @@ export const ConnectorPathParams = z.object({ connectorId: z.string().min(1) });
|
|
|
21
21
|
*/
|
|
22
22
|
export const GitPushPolicyBody = z.object({ policy: z.enum(["allow", "ask", "deny"]) }).strict();
|
|
23
23
|
/** `POST …/connectors`: a custom connector with its endpoint, auth method and credential. */
|
|
24
|
+
/** Upper bound on a connector's own description, in characters (as a template's, per text). */
|
|
25
|
+
export const CONNECTOR_DESCRIPTION_MAX = CONNECTOR_TEMPLATE_LIMITS.descriptionChars;
|
|
26
|
+
/** A connector's own description: plain text an org admin typed, trimmed (blank means none). */
|
|
27
|
+
const ConnectorDescription = z
|
|
28
|
+
.string()
|
|
29
|
+
.trim()
|
|
30
|
+
.max(CONNECTOR_DESCRIPTION_MAX)
|
|
31
|
+
.describe("The connector's own description, plain text shown on the connector pages.");
|
|
24
32
|
export const ConnectorCreateSchema = z
|
|
25
33
|
.object({
|
|
26
34
|
name: z.string().trim().min(1).max(80),
|
|
@@ -31,6 +39,8 @@ export const ConnectorCreateSchema = z
|
|
|
31
39
|
credential: CredentialValue.optional(),
|
|
32
40
|
/** The git hosts the credential serves in sandboxes (sandbox git credentials spec §6.1). */
|
|
33
41
|
git: GitSourceSchema.optional(),
|
|
42
|
+
/** The connector's own description (plain text; blank: none). */
|
|
43
|
+
description: ConnectorDescription.optional(),
|
|
34
44
|
})
|
|
35
45
|
.strict();
|
|
36
46
|
/**
|
|
@@ -68,6 +78,8 @@ export const ConnectorUpdateSchema = z
|
|
|
68
78
|
allowUnannotated: z.boolean().optional(),
|
|
69
79
|
/** Use an org-credential connector for git in sandboxes (spec 2026-11-12 §6.2). */
|
|
70
80
|
useForGit: z.boolean().optional(),
|
|
81
|
+
/** The connector's own description; null or blank removes it. */
|
|
82
|
+
description: ConnectorDescription.nullable().optional(),
|
|
71
83
|
})
|
|
72
84
|
.strict();
|
|
73
85
|
export const CONNECTOR_ROUTES = [
|
|
@@ -86,6 +86,11 @@ export interface ConnectorSummary {
|
|
|
86
86
|
* the virtual tool `git_push`; sandbox git credentials spec §7); meaningful only with `git`.
|
|
87
87
|
*/
|
|
88
88
|
gitPushPolicy: ToolPolicy;
|
|
89
|
+
/**
|
|
90
|
+
* Its own description, set by an org admin (`connectors.description`); null: none (the pages
|
|
91
|
+
* then show its template's, `templateDescription` on the connector routes).
|
|
92
|
+
*/
|
|
93
|
+
description: string | null;
|
|
89
94
|
createdBy: string;
|
|
90
95
|
createdAt: Date;
|
|
91
96
|
updatedAt: Date;
|
|
@@ -110,6 +115,8 @@ export interface CreateConnectorInput {
|
|
|
110
115
|
* create body's; validated by the SDK's `GitSourceSchema`), stored in `connectors.git_hosts`.
|
|
111
116
|
*/
|
|
112
117
|
git?: GitSource | undefined;
|
|
118
|
+
/** The connector's own description (`connectors.description`; blank or absent: none). */
|
|
119
|
+
description?: string | undefined;
|
|
113
120
|
/**
|
|
114
121
|
* Install from a platform catalog connector template (T26, filled in by the catalog service,
|
|
115
122
|
* not accepted over HTTP): the connector records its source item and version, the item policy is
|
|
@@ -221,6 +228,8 @@ export interface UpdateConnectorInput {
|
|
|
221
228
|
* an org-ownership connector that declares git hosts; pushes are then the bot's.
|
|
222
229
|
*/
|
|
223
230
|
useForGit?: boolean | undefined;
|
|
231
|
+
/** The connector's own description; null or blank removes it. */
|
|
232
|
+
description?: string | null | undefined;
|
|
224
233
|
}
|
|
225
234
|
/** OAuth 安装准备的结果:要存的客户端,以及(客户端凭据流)安装时取到的组织 token。 */
|
|
226
235
|
export interface OAuthSetup {
|
|
@@ -36,6 +36,11 @@ import { OAuthGrantError, OAuthUnavailable, tokenRequest, } from "./oauth/tokens
|
|
|
36
36
|
import { stricter } from "./policy.js";
|
|
37
37
|
import { policyFromAnnotations, ToolRegistry } from "./registry.js";
|
|
38
38
|
import { recordToolSpecs } from "./specs.js";
|
|
39
|
+
/** A connector's own description as stored: trimmed, blank or absent as null. */
|
|
40
|
+
function ownDescription(v) {
|
|
41
|
+
const text = v?.trim() ?? "";
|
|
42
|
+
return text === "" ? null : text;
|
|
43
|
+
}
|
|
39
44
|
/** 预览时没给 slug、也推导不出时,拼 key 用的占位 slug。 */
|
|
40
45
|
const PREVIEW_SLUG = "app";
|
|
41
46
|
/** 预览里 inspect 失败的说明里带上的 ToolError 消息最多字符数。 */
|
|
@@ -463,6 +468,7 @@ let ConnectorsService = class ConnectorsService {
|
|
|
463
468
|
endpoint: JSON.stringify(endpoint),
|
|
464
469
|
auth: JSON.stringify(auth),
|
|
465
470
|
git_hosts: input.git !== undefined ? JSON.stringify(input.git.hosts) : null,
|
|
471
|
+
description: ownDescription(input.description),
|
|
466
472
|
created_by: actorAccountId,
|
|
467
473
|
catalog_item_id: input.template?.itemId ?? null,
|
|
468
474
|
catalog_version: input.template?.version ?? null,
|
|
@@ -819,6 +825,7 @@ let ConnectorsService = class ConnectorsService {
|
|
|
819
825
|
git: r.git_hosts !== null && r.git_hosts.length > 0 ? { hosts: r.git_hosts } : null,
|
|
820
826
|
useForGit: r.use_for_git,
|
|
821
827
|
gitPushPolicy: r.git_push_policy,
|
|
828
|
+
description: r.description ?? null,
|
|
822
829
|
createdBy: r.created_by,
|
|
823
830
|
createdAt: r.created_at,
|
|
824
831
|
updatedAt: r.updated_at,
|
|
@@ -1067,7 +1074,12 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1067
1074
|
throw new ApiError("validation_failed", "Request validation failed", problems);
|
|
1068
1075
|
}
|
|
1069
1076
|
const gitChanged = patch.useForGit !== undefined && patch.useForGit !== app.use_for_git;
|
|
1070
|
-
|
|
1077
|
+
const description = patch.description !== undefined ? ownDescription(patch.description) : undefined;
|
|
1078
|
+
const descriptionChanged = description !== undefined && description !== app.description;
|
|
1079
|
+
if (patch.name !== undefined ||
|
|
1080
|
+
patch.status !== undefined ||
|
|
1081
|
+
gitChanged ||
|
|
1082
|
+
descriptionChanged) {
|
|
1071
1083
|
await t
|
|
1072
1084
|
.updateTable("connectors")
|
|
1073
1085
|
.set({
|
|
@@ -1079,6 +1091,7 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1079
1091
|
disabled_by_plugin_id: null,
|
|
1080
1092
|
}),
|
|
1081
1093
|
...(gitChanged && { use_for_git: patch.useForGit === true }),
|
|
1094
|
+
...(descriptionChanged && { description }),
|
|
1082
1095
|
updated_at: sql `now()`,
|
|
1083
1096
|
})
|
|
1084
1097
|
.where("id", "=", connectorId)
|
|
@@ -1131,6 +1144,7 @@ let ConnectorsService = class ConnectorsService {
|
|
|
1131
1144
|
...(patch.name !== undefined && { name: { from: app.name, to: patch.name } }),
|
|
1132
1145
|
...(patch.status !== undefined && { status: { from: app.status, to: patch.status } }),
|
|
1133
1146
|
...(gitChanged && { useForGit: { from: app.use_for_git, to: patch.useForGit } }),
|
|
1147
|
+
...(descriptionChanged && { description: { from: app.description, to: description } }),
|
|
1134
1148
|
...(toolChanges.length > 0 && { tools: Object.fromEntries(toolChanges) }),
|
|
1135
1149
|
...(allowed.length > 0 && { allowedUnannotated: allowed }),
|
|
1136
1150
|
},
|
|
@@ -15,7 +15,7 @@ import type { OAuthClientRecord, TokenAuthMethod } from "./tokens.js";
|
|
|
15
15
|
* `OAuthClientProvider` and would pull the MCP SDK into a protocol-agnostic kernel.
|
|
16
16
|
*
|
|
17
17
|
* Every round trip goes through `packages/kernel/src/net` ({@link safeFetch}): the host must
|
|
18
|
-
* resolve to public addresses (or be exempt by `
|
|
18
|
+
* resolve to public addresses (or be exempt by `net.allowPrivateHosts`), the connection is
|
|
19
19
|
* pinned to the checked address, `net.httpsProxy` tunnels https, and redirects are never followed.
|
|
20
20
|
*/
|
|
21
21
|
export interface OAuthHttpOptions {
|
|
@@ -28,7 +28,7 @@ export interface OAuthHttpOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* The network rules of every OAuth round trip (discovery, registration, token endpoint, the setup
|
|
30
30
|
* check's token probe): the deployment's egress proxy (`net.httpsProxy` / `net.noProxy`), its
|
|
31
|
-
* private host exemptions (`
|
|
31
|
+
* private host exemptions (`net.allowPrivateHosts`, the one list of internal hosts the
|
|
32
32
|
* kernel may reach) and loopback http only under `tools.oauthAllowInsecureLoopback` (tests).
|
|
33
33
|
*/
|
|
34
34
|
export declare function oauthNetPolicy(cfg: KernelConfig): NetPolicy;
|
|
@@ -3,13 +3,13 @@ import { NetBodyTooLargeError, safeFetch } from "../../net/safe-fetch.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* The network rules of every OAuth round trip (discovery, registration, token endpoint, the setup
|
|
5
5
|
* check's token probe): the deployment's egress proxy (`net.httpsProxy` / `net.noProxy`), its
|
|
6
|
-
* private host exemptions (`
|
|
6
|
+
* private host exemptions (`net.allowPrivateHosts`, the one list of internal hosts the
|
|
7
7
|
* kernel may reach) and loopback http only under `tools.oauthAllowInsecureLoopback` (tests).
|
|
8
8
|
*/
|
|
9
9
|
export function oauthNetPolicy(cfg) {
|
|
10
10
|
return {
|
|
11
11
|
allowInsecureLoopback: cfg.tools.oauthAllowInsecureLoopback,
|
|
12
|
-
allowPrivateHosts: cfg.
|
|
12
|
+
allowPrivateHosts: cfg.net.allowPrivateHosts,
|
|
13
13
|
trustedOrigins: [],
|
|
14
14
|
...(cfg.net.httpsProxy !== undefined && {
|
|
15
15
|
proxy: { url: cfg.net.httpsProxy, noProxy: cfg.net.noProxy },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/kernel",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.79",
|
|
4
4
|
"description": "Capybara kernel: config, database, plugin host and HTTP API of the Capybara agent platform",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yaml": "^2.9.1",
|
|
67
67
|
"yauzl": "3.4.0",
|
|
68
68
|
"zod": "^4.6.7",
|
|
69
|
-
"@capybara-hq/plugin-sdk": "^0.1.0-rc.
|
|
69
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.65"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@langchain/langgraph-checkpoint-validation": "^1.2.0",
|