@capybara-hq/plugin-sdk 0.1.0-rc.2 → 0.1.0-rc.21
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/README.md +1 -1
- package/agent-docs/agent-templates.md +59 -0
- package/agent-docs/concepts.md +63 -0
- package/agent-docs/connector-templates.md +48 -0
- package/agent-docs/extension-points/channel.md +15 -0
- package/agent-docs/extension-points/config-source.md +15 -0
- package/agent-docs/extension-points/connector.md +15 -0
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/counter.md +15 -0
- package/agent-docs/extension-points/directory.md +15 -0
- package/agent-docs/extension-points/file-preview.md +15 -0
- package/agent-docs/extension-points/identity-source.md +15 -0
- package/agent-docs/extension-points/model-provider.md +15 -0
- package/agent-docs/extension-points/object-store.md +15 -0
- package/agent-docs/extension-points/sandbox.md +15 -0
- package/agent-docs/extension-points/secret-store.md +15 -0
- package/agent-docs/extension-points/web-fetch.md +15 -0
- package/agent-docs/extension-points/web-search.md +15 -0
- package/agent-docs/extensions.md +88 -0
- package/agent-docs/plugin-format.md +100 -0
- package/agent-docs/setup.md +46 -0
- package/agent-docs/skills.md +44 -0
- package/agent-docs/tool-naming.md +21 -0
- package/dist/agent-template.d.ts +96 -2
- package/dist/agent-template.js +381 -3
- package/dist/bootstrap.d.ts +15 -1
- package/dist/bootstrap.js +17 -1
- package/dist/cards.d.ts +39 -5
- package/dist/cards.js +70 -11
- package/dist/channel.d.ts +20 -1
- package/dist/client-css.d.ts +36 -0
- package/dist/client-css.js +326 -0
- package/dist/client-section.d.ts +35 -0
- package/dist/client-section.js +133 -0
- package/dist/config-ui.d.ts +24 -1
- package/dist/config-ui.js +89 -11
- package/dist/connector-auth.d.ts +2 -0
- package/dist/connector-auth.js +15 -0
- package/dist/context.d.ts +40 -0
- package/dist/context.js +2 -0
- package/dist/ctx.d.ts +86 -4
- package/dist/define-extension.d.ts +5 -1
- package/dist/define-extension.js +1 -0
- package/dist/dev-hosts.d.ts +6 -0
- package/dist/dev-hosts.js +48 -0
- package/dist/device-protocol.d.ts +260 -0
- package/dist/device-protocol.js +496 -0
- package/dist/directory.d.ts +11 -2
- package/dist/extension-point.d.ts +6 -0
- package/dist/extension-point.js +19 -14
- package/dist/file-preview.d.ts +9 -1
- package/dist/git-hosts.d.ts +44 -0
- package/dist/git-hosts.js +81 -0
- package/dist/hooks.d.ts +111 -15
- package/dist/hooks.js +5 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.js +19 -1
- package/dist/marketplace.d.ts +55 -2
- package/dist/marketplace.js +73 -3
- package/dist/model.d.ts +60 -2
- package/dist/model.js +22 -0
- package/dist/org-access.d.ts +27 -0
- package/dist/org-access.js +35 -0
- package/dist/permissions.d.ts +33 -8
- package/dist/permissions.js +89 -22
- package/dist/plugin-manifest.d.ts +60 -7
- package/dist/plugin-manifest.js +180 -7
- package/dist/plugin-package.d.ts +3 -0
- package/dist/plugin-package.js +4 -0
- package/dist/sandbox.d.ts +239 -62
- package/dist/sandbox.js +99 -14
- package/dist/setup-check.d.ts +115 -0
- package/dist/setup-check.js +142 -0
- package/dist/setup-guide-parse.d.ts +121 -0
- package/dist/setup-guide-parse.js +350 -0
- package/dist/setup-guide-render.d.ts +45 -0
- package/dist/setup-guide-render.js +351 -0
- package/dist/setup-guide.d.ts +94 -0
- package/dist/setup-guide.js +336 -0
- package/dist/skill-invocation.d.ts +9 -5
- package/dist/skill-invocation.js +18 -8
- package/dist/skill.d.ts +23 -3
- package/dist/skill.js +31 -6
- package/dist/theme-assets.d.ts +39 -0
- package/dist/theme-assets.js +449 -0
- package/dist/theme-readability.d.ts +37 -0
- package/dist/theme-readability.js +145 -0
- package/dist/theme-tokens.generated.d.ts +275 -0
- package/dist/theme-tokens.generated.js +172 -0
- package/dist/theme.d.ts +152 -0
- package/dist/theme.js +392 -0
- package/dist/tool.d.ts +26 -3
- package/dist/tool.js +8 -0
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +337 -0
- package/dist/ui-resolve.d.ts +40 -0
- package/dist/ui-resolve.js +54 -0
- package/dist/ui-slots.d.ts +55 -0
- package/dist/ui-slots.js +247 -0
- package/dist/ui.d.ts +143 -37
- package/dist/ui.js +65 -5
- package/dist/web.d.ts +30 -5
- package/package.json +10 -2
- package/schemas/bootstrap.v1.schema.json +6 -0
- package/schemas/connector-template.v1.schema.json +35 -0
- package/schemas/marketplace.v1.schema.json +50 -0
- package/schemas/plugin.v1.schema.json +144 -7
- package/schemas/theme.v1.schema.json +225 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The client section of a plugin's extension (client extensions spec §4.1): the browser bundle, CSS
|
|
3
|
+
* files and assets under `./dist/client/`, each pinned by a sha384 integrity. Written by the packer.
|
|
4
|
+
*/
|
|
5
|
+
export interface PluginClientSection {
|
|
6
|
+
/** `./dist/client/client.mjs`; absent for CSS-only decoration. */
|
|
7
|
+
entry?: string;
|
|
8
|
+
/** `./dist/client/styles/<name>.css`, in injection order. */
|
|
9
|
+
styles?: string[];
|
|
10
|
+
/** `./dist/client/assets/<path>`. */
|
|
11
|
+
assets?: string[];
|
|
12
|
+
/** sha384 of every file above, keyed by its path: `sha384-<base64>`. */
|
|
13
|
+
integrity: Record<string, string>;
|
|
14
|
+
/** {@link CLIENT_API_VERSION} the bundle was built against. */
|
|
15
|
+
apiVersion: number;
|
|
16
|
+
}
|
|
17
|
+
/** The client API version the host provides (`@capybara-hq/plugin-client` carries the same number). */
|
|
18
|
+
export declare const CLIENT_API_VERSION = 1;
|
|
19
|
+
/** Limits of client code (client extensions spec §4.1, §10). */
|
|
20
|
+
export declare const CLIENT_LIMITS: {
|
|
21
|
+
readonly entryBytes: 1048576;
|
|
22
|
+
readonly styleFiles: 8;
|
|
23
|
+
readonly styleBytes: 262144;
|
|
24
|
+
readonly assetFiles: 64;
|
|
25
|
+
readonly assetBytes: 2097152;
|
|
26
|
+
readonly totalBytes: 8388608;
|
|
27
|
+
readonly loadTimeoutMs: 10000;
|
|
28
|
+
readonly pendingMs: 1500;
|
|
29
|
+
readonly crashBudget: 3;
|
|
30
|
+
};
|
|
31
|
+
/** Allowed asset extensions and the content type each is served with. */
|
|
32
|
+
export declare const CLIENT_ASSET_TYPES: Readonly<Record<string, string>>;
|
|
33
|
+
export declare const CLIENT_ENTRY_PATH = "./dist/client/client.mjs";
|
|
34
|
+
/** Checks a client section (`parsePluginManifest` and the packer use it); returns the problems. */
|
|
35
|
+
export declare function validateClientSection(s: unknown): string[];
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { isSafePackagePath } from "./plugin-package.js";
|
|
2
|
+
/** The client API version the host provides (`@capybara-hq/plugin-client` carries the same number). */
|
|
3
|
+
export const CLIENT_API_VERSION = 1;
|
|
4
|
+
/** Limits of client code (client extensions spec §4.1, §10). */
|
|
5
|
+
export const CLIENT_LIMITS = {
|
|
6
|
+
entryBytes: 1048576,
|
|
7
|
+
styleFiles: 8,
|
|
8
|
+
styleBytes: 262144,
|
|
9
|
+
assetFiles: 64,
|
|
10
|
+
assetBytes: 2097152,
|
|
11
|
+
totalBytes: 8388608,
|
|
12
|
+
loadTimeoutMs: 10000,
|
|
13
|
+
pendingMs: 1500,
|
|
14
|
+
crashBudget: 3,
|
|
15
|
+
};
|
|
16
|
+
/** Allowed asset extensions and the content type each is served with. */
|
|
17
|
+
export const CLIENT_ASSET_TYPES = {
|
|
18
|
+
".png": "image/png",
|
|
19
|
+
".webp": "image/webp",
|
|
20
|
+
".svg": "image/svg+xml",
|
|
21
|
+
".woff2": "font/woff2",
|
|
22
|
+
".mp3": "audio/mpeg",
|
|
23
|
+
".ogg": "audio/ogg",
|
|
24
|
+
".wav": "audio/wav",
|
|
25
|
+
};
|
|
26
|
+
export const CLIENT_ENTRY_PATH = "./dist/client/client.mjs";
|
|
27
|
+
const STYLE_RE = /^\.\/dist\/client\/styles\/[A-Za-z0-9][A-Za-z0-9._-]*\.css$/;
|
|
28
|
+
const ASSET_PREFIX = "./dist/client/assets/";
|
|
29
|
+
/** One segment of an asset path: URL-safe characters only (the kernel's delivery key charset). */
|
|
30
|
+
const ASSET_SEGMENT_RE = /^[A-Za-z0-9._-]+$/;
|
|
31
|
+
const INTEGRITY_RE = /^sha384-[A-Za-z0-9+/]{64}$/;
|
|
32
|
+
const isStringArray = (v) => Array.isArray(v) && v.every((x) => typeof x === "string");
|
|
33
|
+
/** Checks a client section (`parsePluginManifest` and the packer use it); returns the problems. */
|
|
34
|
+
export function validateClientSection(s) {
|
|
35
|
+
if (s === null || typeof s !== "object" || Array.isArray(s))
|
|
36
|
+
return ["client must be an object"];
|
|
37
|
+
const o = s;
|
|
38
|
+
const errs = [];
|
|
39
|
+
for (const k of Object.keys(o)) {
|
|
40
|
+
if (!["entry", "styles", "assets", "integrity", "apiVersion"].includes(k)) {
|
|
41
|
+
errs.push(`client.${k} is not a known field`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const listed = [];
|
|
45
|
+
if (o.entry !== undefined) {
|
|
46
|
+
if (o.entry !== CLIENT_ENTRY_PATH)
|
|
47
|
+
errs.push(`client.entry must be ${CLIENT_ENTRY_PATH}`);
|
|
48
|
+
else
|
|
49
|
+
listed.push(o.entry);
|
|
50
|
+
}
|
|
51
|
+
let styleCount = 0;
|
|
52
|
+
if (o.styles !== undefined) {
|
|
53
|
+
if (!isStringArray(o.styles))
|
|
54
|
+
errs.push("client.styles must be an array of strings");
|
|
55
|
+
else {
|
|
56
|
+
styleCount = o.styles.length;
|
|
57
|
+
if (styleCount > CLIENT_LIMITS.styleFiles) {
|
|
58
|
+
errs.push(`client.styles has ${styleCount} files; the limit is ${CLIENT_LIMITS.styleFiles}`);
|
|
59
|
+
}
|
|
60
|
+
for (const p of o.styles) {
|
|
61
|
+
if (!STYLE_RE.test(p)) {
|
|
62
|
+
errs.push(`client.styles: ${p} must be ./dist/client/styles/<name>.css`);
|
|
63
|
+
}
|
|
64
|
+
else if (listed.includes(p))
|
|
65
|
+
errs.push(`client.styles: duplicate ${p}`);
|
|
66
|
+
else
|
|
67
|
+
listed.push(p);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (o.assets !== undefined) {
|
|
72
|
+
if (!isStringArray(o.assets))
|
|
73
|
+
errs.push("client.assets must be an array of strings");
|
|
74
|
+
else {
|
|
75
|
+
if (o.assets.length > CLIENT_LIMITS.assetFiles) {
|
|
76
|
+
errs.push(`client.assets has ${o.assets.length} files; the limit is ${CLIENT_LIMITS.assetFiles}`);
|
|
77
|
+
}
|
|
78
|
+
for (const p of o.assets) {
|
|
79
|
+
const rest = p.startsWith(ASSET_PREFIX) ? p.slice(ASSET_PREFIX.length) : null;
|
|
80
|
+
if (rest === null || !isSafePackagePath(rest)) {
|
|
81
|
+
errs.push(`client.assets: ${p} must be a safe path under ${ASSET_PREFIX}`);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
// the kernel looks a file up by its exact key, never decoding the URL (`%2e%2e` names no
|
|
85
|
+
// file there), so every segment uses the URL-safe characters only
|
|
86
|
+
if (!rest.split("/").every((seg) => ASSET_SEGMENT_RE.test(seg))) {
|
|
87
|
+
errs.push(`client.assets: ${p} must use letters, digits, . _ - in each path segment`);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const name = rest.slice(rest.lastIndexOf("/") + 1);
|
|
91
|
+
const dot = name.lastIndexOf(".");
|
|
92
|
+
if (dot === 0) {
|
|
93
|
+
errs.push(`client.assets: ${p} needs a file name before the extension`);
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const ext = dot < 0 ? "" : name.slice(dot).toLowerCase();
|
|
97
|
+
if (!Object.hasOwn(CLIENT_ASSET_TYPES, ext)) {
|
|
98
|
+
errs.push(`client.assets: ${p} has an unsupported type; allowed: ${Object.keys(CLIENT_ASSET_TYPES).join(" ")}`);
|
|
99
|
+
}
|
|
100
|
+
else if (listed.includes(p))
|
|
101
|
+
errs.push(`client.assets: duplicate ${p}`);
|
|
102
|
+
else
|
|
103
|
+
listed.push(p);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (o.entry === undefined && styleCount === 0) {
|
|
108
|
+
errs.push("client needs an entry or at least one style file");
|
|
109
|
+
}
|
|
110
|
+
const integ = o.integrity;
|
|
111
|
+
if (integ === null || typeof integ !== "object" || Array.isArray(integ)) {
|
|
112
|
+
errs.push("client.integrity must be an object");
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const map = integ;
|
|
116
|
+
for (const p of listed) {
|
|
117
|
+
const v = map[p];
|
|
118
|
+
if (v === undefined)
|
|
119
|
+
errs.push(`client.integrity: missing entry for ${p}`);
|
|
120
|
+
else if (typeof v !== "string" || !INTEGRITY_RE.test(v)) {
|
|
121
|
+
errs.push(`client.integrity: ${p} must be sha384-<base64>`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const p of Object.keys(map)) {
|
|
125
|
+
if (!listed.includes(p))
|
|
126
|
+
errs.push(`client.integrity: ${p} is not a listed file`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (typeof o.apiVersion !== "number" || !Number.isInteger(o.apiVersion) || o.apiVersion < 1) {
|
|
130
|
+
errs.push("client.apiVersion must be a positive integer");
|
|
131
|
+
}
|
|
132
|
+
return errs;
|
|
133
|
+
}
|
package/dist/config-ui.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ import type { LocalizedName } from "./plugin-package.js";
|
|
|
10
10
|
export type JsonSchema = Record<string, unknown>;
|
|
11
11
|
/** The input widget of a field. */
|
|
12
12
|
export type ConfigWidget = "text" | "textarea" | "url" | "number" | "select" | "radio" | "switch" | "checkbox" | "tristate" | "tags" | "json";
|
|
13
|
+
/** How a channel connection receives events: a long connection (default) or webhooks. */
|
|
14
|
+
export type ChannelInboundMode = "long_connection" | "webhook";
|
|
15
|
+
/** Every channel inbound mode, in the order forms list them. */
|
|
16
|
+
export declare const CHANNEL_INBOUND_MODES: readonly ChannelInboundMode[];
|
|
13
17
|
/** A labelled value of an enum (or boolean) field. */
|
|
14
18
|
export interface ConfigUiOption {
|
|
15
19
|
value: string | number | boolean;
|
|
@@ -73,6 +77,13 @@ export interface ConfigUiHints {
|
|
|
73
77
|
sections?: ConfigUiSection[];
|
|
74
78
|
/** Root only: localized messages for custom issues (`params: { ui: key }`). */
|
|
75
79
|
messages?: Record<string, LocalizedName>;
|
|
80
|
+
/**
|
|
81
|
+
* Channel connection config only, top-level fields only: the inbound modes the field belongs to.
|
|
82
|
+
* Forms draw it only in those modes and require it there; the kernel refuses a connection whose
|
|
83
|
+
* mode requires it without a value (channel inbound mode fields spec §2, §3). The zod schema keeps
|
|
84
|
+
* the field optional, since the other modes do not use it.
|
|
85
|
+
*/
|
|
86
|
+
inboundModes?: ChannelInboundMode[];
|
|
76
87
|
}
|
|
77
88
|
/** Limits of config UI hints and of the JSON Schemas a plugin package carries. */
|
|
78
89
|
export declare const CONFIG_UI_LIMITS: {
|
|
@@ -105,7 +116,8 @@ export declare function ui<T extends z.ZodTypeAny>(schema: T, hints: ConfigUiHin
|
|
|
105
116
|
/**
|
|
106
117
|
* An extension config schema as a JSON Schema for forms (the input side, defaults included, no
|
|
107
118
|
* `$schema`):
|
|
108
|
-
* - meta `secret: true` becomes `"x-secret": true`, `hot: true` becomes `"x-hot": true`, `
|
|
119
|
+
* - meta `secret: true` becomes `"x-secret": true`, `hot: true` becomes `"x-hot": true`, `org`
|
|
120
|
+
* (`orgAccess`) becomes `"x-org"`, `ui`
|
|
109
121
|
* becomes `"x-ui"` (a JSON copy of the hints); `title` / `description` are filled from
|
|
110
122
|
* `x-ui.label.en` / `x-ui.help.en` when the node has none;
|
|
111
123
|
* - unrepresentable types become `{ "x-unsupported": true }` instead of throwing;
|
|
@@ -128,3 +140,14 @@ export interface ConfigUiProblem {
|
|
|
128
140
|
* problem (empty = valid); never throws. Problem paths are dot paths of the node holding the hint.
|
|
129
141
|
*/
|
|
130
142
|
export declare function validateConfigUi(schema: JsonSchema, level: "deployment" | "org" | "connection"): ConfigUiProblem[];
|
|
143
|
+
/**
|
|
144
|
+
* The top-level fields of a connection config's JSON Schema ({@link configJsonSchema}) that carry
|
|
145
|
+
* an `inboundModes` hint, with their modes (unknown modes dropped). Pure; fields without the hint
|
|
146
|
+
* belong to every mode and are not listed.
|
|
147
|
+
*/
|
|
148
|
+
export declare function inboundModeFields(schema: JsonSchema): Record<string, ChannelInboundMode[]>;
|
|
149
|
+
/**
|
|
150
|
+
* The fields `mode` requires ({@link inboundModeFields}) for which `has(field)` is false, in schema
|
|
151
|
+
* order: what the kernel refuses on a channel connection create or config / mode change.
|
|
152
|
+
*/
|
|
153
|
+
export declare function missingInboundModeFields(schema: JsonSchema, mode: ChannelInboundMode, has: (field: string) => boolean): string[];
|
package/dist/config-ui.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** Every channel inbound mode, in the order forms list them. */
|
|
3
|
+
export const CHANNEL_INBOUND_MODES = ["long_connection", "webhook"];
|
|
2
4
|
/** Limits of config UI hints and of the JSON Schemas a plugin package carries. */
|
|
3
5
|
export const CONFIG_UI_LIMITS = {
|
|
4
6
|
/** Characters per language of a `label` (also `unit`, `item.addLabel`). */
|
|
@@ -48,7 +50,8 @@ const isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
|
48
50
|
/**
|
|
49
51
|
* An extension config schema as a JSON Schema for forms (the input side, defaults included, no
|
|
50
52
|
* `$schema`):
|
|
51
|
-
* - meta `secret: true` becomes `"x-secret": true`, `hot: true` becomes `"x-hot": true`, `
|
|
53
|
+
* - meta `secret: true` becomes `"x-secret": true`, `hot: true` becomes `"x-hot": true`, `org`
|
|
54
|
+
* (`orgAccess`) becomes `"x-org"`, `ui`
|
|
52
55
|
* becomes `"x-ui"` (a JSON copy of the hints); `title` / `description` are filled from
|
|
53
56
|
* `x-ui.label.en` / `x-ui.help.en` when the node has none;
|
|
54
57
|
* - unrepresentable types become `{ "x-unsupported": true }` instead of throwing;
|
|
@@ -68,6 +71,9 @@ export function configJsonSchema(schema) {
|
|
|
68
71
|
if (js.hot === true)
|
|
69
72
|
js["x-hot"] = true;
|
|
70
73
|
delete js.hot;
|
|
74
|
+
if (js.org !== undefined)
|
|
75
|
+
js["x-org"] = js.org;
|
|
76
|
+
delete js.org;
|
|
71
77
|
if ("ui" in js) {
|
|
72
78
|
// A JSON copy: hints are data, and the scrub must never mutate the schema's meta.
|
|
73
79
|
const hints = JSON.parse(JSON.stringify(js.ui ?? null));
|
|
@@ -159,9 +165,18 @@ const HINT_KEYS = new Set([
|
|
|
159
165
|
"secrets",
|
|
160
166
|
"sections",
|
|
161
167
|
"messages",
|
|
168
|
+
"inboundModes",
|
|
162
169
|
]);
|
|
163
170
|
/** The only hints a secret node may carry. */
|
|
164
|
-
const SECRET_HINT_KEYS = new Set([
|
|
171
|
+
const SECRET_HINT_KEYS = new Set([
|
|
172
|
+
"label",
|
|
173
|
+
"help",
|
|
174
|
+
"placeholder",
|
|
175
|
+
"order",
|
|
176
|
+
"section",
|
|
177
|
+
"advanced",
|
|
178
|
+
"inboundModes",
|
|
179
|
+
]);
|
|
165
180
|
const ITEM_KEYS = new Set(["title", "subtitle", "addLabel", "reorder"]);
|
|
166
181
|
const utf8Bytes = (s) => new TextEncoder().encode(s).length;
|
|
167
182
|
/** The JSON types a node accepts (`type`, a type list, or the branches of a nullable `anyOf`). */
|
|
@@ -275,8 +290,21 @@ export function validateConfigUi(schema, level) {
|
|
|
275
290
|
}
|
|
276
291
|
return node;
|
|
277
292
|
};
|
|
278
|
-
const visit = (node, path, isRoot) => {
|
|
293
|
+
const visit = (node, path, isRoot, depth) => {
|
|
279
294
|
const report = (message) => problems.push({ path, message });
|
|
295
|
+
if (node["x-org"] !== undefined) {
|
|
296
|
+
const org = node["x-org"];
|
|
297
|
+
if (level !== "deployment")
|
|
298
|
+
report(`x-org is only allowed at the deployment level, not ${level}`);
|
|
299
|
+
else if (depth !== 1)
|
|
300
|
+
report("x-org is only allowed on a top-level field of the config");
|
|
301
|
+
else if (org !== "readonly" && org !== "override") {
|
|
302
|
+
report(`x-org must be "readonly" or "override", not ${JSON.stringify(org)}`);
|
|
303
|
+
}
|
|
304
|
+
else if (org === "readonly" && node["x-secret"] === true) {
|
|
305
|
+
report('x-org "readonly" on a secret field: an org never sees a secret, so there is nothing to show');
|
|
306
|
+
}
|
|
307
|
+
}
|
|
280
308
|
const text = (value, what, max, plainOk = false) => {
|
|
281
309
|
if (value === undefined)
|
|
282
310
|
return;
|
|
@@ -309,23 +337,24 @@ export function validateConfigUi(schema, level) {
|
|
|
309
337
|
if (!isObj(raw))
|
|
310
338
|
report("x-ui must be an object");
|
|
311
339
|
else
|
|
312
|
-
checkHints(raw, node, isRoot, report, text);
|
|
340
|
+
checkHints(raw, node, isRoot, depth, report, text);
|
|
313
341
|
}
|
|
314
342
|
const shape = shapeOf(node);
|
|
315
343
|
const props = shape.properties;
|
|
316
344
|
if (isObj(props)) {
|
|
317
345
|
for (const [k, child] of Object.entries(props)) {
|
|
318
346
|
if (isObj(child))
|
|
319
|
-
visit(child, path === "" ? k : `${path}.${k}`, false);
|
|
347
|
+
visit(child, path === "" ? k : `${path}.${k}`, false, depth + 1);
|
|
320
348
|
}
|
|
321
349
|
}
|
|
322
|
-
if (isObj(shape.items))
|
|
323
|
-
visit(shape.items, path === "" ? "items" : `${path}.items`, false);
|
|
350
|
+
if (isObj(shape.items)) {
|
|
351
|
+
visit(shape.items, path === "" ? "items" : `${path}.items`, false, depth + 1);
|
|
352
|
+
}
|
|
324
353
|
if (isObj(shape.additionalProperties)) {
|
|
325
|
-
visit(shape.additionalProperties, path === "" ? "additionalProperties" : `${path}.additionalProperties`, false);
|
|
354
|
+
visit(shape.additionalProperties, path === "" ? "additionalProperties" : `${path}.additionalProperties`, false, depth + 1);
|
|
326
355
|
}
|
|
327
356
|
};
|
|
328
|
-
const checkHints = (h, node, isRoot, report, text) => {
|
|
357
|
+
const checkHints = (h, node, isRoot, depth, report, text) => {
|
|
329
358
|
const shape = shapeOf(node);
|
|
330
359
|
const types = typesOf(node);
|
|
331
360
|
const isArray = types.has("array");
|
|
@@ -338,7 +367,7 @@ export function validateConfigUi(schema, level) {
|
|
|
338
367
|
if (node["x-secret"] === true) {
|
|
339
368
|
const bad = Object.keys(h).filter((k) => HINT_KEYS.has(k) && !SECRET_HINT_KEYS.has(k));
|
|
340
369
|
if (bad.length > 0) {
|
|
341
|
-
report(`a secret field allows only label, help, placeholder, order, section and
|
|
370
|
+
report(`a secret field allows only label, help, placeholder, order, section, advanced and inboundModes hints, not ${bad.join(", ")}`);
|
|
342
371
|
}
|
|
343
372
|
}
|
|
344
373
|
text(h.label, "label", L.labelChars);
|
|
@@ -351,6 +380,28 @@ export function validateConfigUi(schema, level) {
|
|
|
351
380
|
if (h.advanced !== undefined && typeof h.advanced !== "boolean") {
|
|
352
381
|
report("advanced must be a boolean");
|
|
353
382
|
}
|
|
383
|
+
if (h.inboundModes !== undefined) {
|
|
384
|
+
const modes = h.inboundModes;
|
|
385
|
+
if (level !== "connection") {
|
|
386
|
+
report(`inboundModes is only allowed at the connection level, not ${level}`);
|
|
387
|
+
}
|
|
388
|
+
else if (depth !== 1) {
|
|
389
|
+
report("inboundModes is only allowed on a top-level field of the config");
|
|
390
|
+
}
|
|
391
|
+
else if (!Array.isArray(modes) || modes.length === 0) {
|
|
392
|
+
report("inboundModes must be a non-empty array");
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
modes.forEach((m, i) => {
|
|
396
|
+
if (!CHANNEL_INBOUND_MODES.includes(m)) {
|
|
397
|
+
report(`inboundModes[${i}] must be one of ${CHANNEL_INBOUND_MODES.join(", ")}`);
|
|
398
|
+
}
|
|
399
|
+
else if (modes.indexOf(m) !== i) {
|
|
400
|
+
report(`inboundModes[${i}] "${String(m)}" is listed twice`);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}
|
|
354
405
|
if (h.section !== undefined) {
|
|
355
406
|
if (typeof h.section !== "string" || !sectionIds.has(h.section)) {
|
|
356
407
|
report(`section "${String(h.section)}" is not an id of the root's sections`);
|
|
@@ -573,7 +624,7 @@ export function validateConfigUi(schema, level) {
|
|
|
573
624
|
});
|
|
574
625
|
}
|
|
575
626
|
};
|
|
576
|
-
visit(schema, "", true);
|
|
627
|
+
visit(schema, "", true, 0);
|
|
577
628
|
if (hintsBytes > L.hintsBytes) {
|
|
578
629
|
problems.push({
|
|
579
630
|
path: "",
|
|
@@ -582,3 +633,30 @@ export function validateConfigUi(schema, level) {
|
|
|
582
633
|
}
|
|
583
634
|
return problems;
|
|
584
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* The top-level fields of a connection config's JSON Schema ({@link configJsonSchema}) that carry
|
|
638
|
+
* an `inboundModes` hint, with their modes (unknown modes dropped). Pure; fields without the hint
|
|
639
|
+
* belong to every mode and are not listed.
|
|
640
|
+
*/
|
|
641
|
+
export function inboundModeFields(schema) {
|
|
642
|
+
const out = {};
|
|
643
|
+
for (const [key, node] of Object.entries(properties(schema))) {
|
|
644
|
+
const hints = isObj(node) ? node["x-ui"] : undefined;
|
|
645
|
+
const modes = isObj(hints) ? hints.inboundModes : undefined;
|
|
646
|
+
if (!Array.isArray(modes))
|
|
647
|
+
continue;
|
|
648
|
+
const known = CHANNEL_INBOUND_MODES.filter((m) => modes.includes(m));
|
|
649
|
+
if (known.length > 0)
|
|
650
|
+
out[key] = known;
|
|
651
|
+
}
|
|
652
|
+
return out;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* The fields `mode` requires ({@link inboundModeFields}) for which `has(field)` is false, in schema
|
|
656
|
+
* order: what the kernel refuses on a channel connection create or config / mode change.
|
|
657
|
+
*/
|
|
658
|
+
export function missingInboundModeFields(schema, mode, has) {
|
|
659
|
+
return Object.entries(inboundModeFields(schema))
|
|
660
|
+
.filter(([key, modes]) => modes.includes(mode) && !has(key))
|
|
661
|
+
.map(([key]) => key);
|
|
662
|
+
}
|
package/dist/connector-auth.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export declare const ConnectorAuthSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
50
50
|
client_secret_basic: "client_secret_basic";
|
|
51
51
|
client_secret_post: "client_secret_post";
|
|
52
52
|
}>>;
|
|
53
|
+
tokenTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
54
|
}, z.core.$strict>, z.ZodObject<{
|
|
54
55
|
type: z.ZodLiteral<"oauth_client">;
|
|
55
56
|
ownership: z.ZodLiteral<"org">;
|
|
@@ -59,6 +60,7 @@ export declare const ConnectorAuthSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
59
60
|
client_secret_basic: "client_secret_basic";
|
|
60
61
|
client_secret_post: "client_secret_post";
|
|
61
62
|
}>>;
|
|
63
|
+
tokenTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
64
|
}, z.core.$strict>], "type">;
|
|
63
65
|
/** 认证预设({@link ConnectorAuthSchema} 的输出)。 */
|
|
64
66
|
export type ConnectorAuthPreset = z.infer<typeof ConnectorAuthSchema>;
|
package/dist/connector-auth.js
CHANGED
|
@@ -23,6 +23,19 @@ const Scopes = z
|
|
|
23
23
|
.max(200)
|
|
24
24
|
.regex(/^[\x21\x23-\x5B\x5D-\x7E]+$/, "Invalid scope"))
|
|
25
25
|
.max(50);
|
|
26
|
+
/**
|
|
27
|
+
* More `token_type` values the token endpoint may return for a bearer token (case-insensitive;
|
|
28
|
+
* `Bearer` and Slack's `user` are always accepted). The token is still sent as
|
|
29
|
+
* `Authorization: Bearer`. Never `DPoP`: such a token is bound to a key the kernel does not hold.
|
|
30
|
+
*/
|
|
31
|
+
const TokenTypes = z
|
|
32
|
+
.array(z
|
|
33
|
+
.string()
|
|
34
|
+
.min(1)
|
|
35
|
+
.max(32)
|
|
36
|
+
.regex(/^[A-Za-z][A-Za-z0-9_.-]*$/, "Invalid token type")
|
|
37
|
+
.refine((t) => t.toLowerCase() !== "dpop", "DPoP tokens are not bearer tokens"))
|
|
38
|
+
.max(5);
|
|
26
39
|
/** 认证方式:只有类型与非密钥字段;凭据值走内核的 `credential` / 凭据接口。 */
|
|
27
40
|
export const ConnectorAuthSchema = z.discriminatedUnion("type", [
|
|
28
41
|
z.object({ type: z.literal("none") }).strict(),
|
|
@@ -57,6 +70,7 @@ export const ConnectorAuthSchema = z.discriminatedUnion("type", [
|
|
|
57
70
|
scopes: Scopes.optional(),
|
|
58
71
|
client: z.enum(["dcr", "manual"]),
|
|
59
72
|
tokenAuthMethod: TokenAuthMethod.optional(),
|
|
73
|
+
tokenTypes: TokenTypes.optional(),
|
|
60
74
|
})
|
|
61
75
|
.strict()
|
|
62
76
|
.superRefine((a, ctx) => {
|
|
@@ -91,6 +105,7 @@ export const ConnectorAuthSchema = z.discriminatedUnion("type", [
|
|
|
91
105
|
tokenUrl: OAuthUrl,
|
|
92
106
|
scopes: Scopes.optional(),
|
|
93
107
|
tokenAuthMethod: TokenAuthMethod.optional(),
|
|
108
|
+
tokenTypes: TokenTypes.optional(),
|
|
94
109
|
})
|
|
95
110
|
.strict(),
|
|
96
111
|
]);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ConversationSource } from "./tool.js";
|
|
2
|
+
/**
|
|
3
|
+
* What the kernel passes to a `context@1` provider at the start of a run. The provider returns the
|
|
4
|
+
* text it wants the model to see, or null.
|
|
5
|
+
*/
|
|
6
|
+
export interface ContextRequest {
|
|
7
|
+
orgId: string;
|
|
8
|
+
/** The run's trigger account (the person whose message started the run). */
|
|
9
|
+
accountId: string;
|
|
10
|
+
agentId: string;
|
|
11
|
+
agentName: string;
|
|
12
|
+
conversationId: string;
|
|
13
|
+
runId: string;
|
|
14
|
+
/** Where the conversation comes from. */
|
|
15
|
+
source: ConversationSource;
|
|
16
|
+
/** The trigger account's role in the org. */
|
|
17
|
+
role: "owner" | "admin" | "member" | "guest";
|
|
18
|
+
/** The conversation's owner (`conversations.account_id`); `accountId` is the run's trigger account. */
|
|
19
|
+
ownerAccountId: string;
|
|
20
|
+
ownerName: string;
|
|
21
|
+
/** Keys of the tools the agent has in this run. */
|
|
22
|
+
tools: string[];
|
|
23
|
+
/** The provider's effective config for the org. */
|
|
24
|
+
config: unknown;
|
|
25
|
+
/** Aborts when the call runs past {@link CONTEXT_LIMITS}.timeoutMs or the run is aborted. */
|
|
26
|
+
signal: AbortSignal;
|
|
27
|
+
}
|
|
28
|
+
/** The text a provider adds to the model's context, or null for nothing. */
|
|
29
|
+
export type ContextResult = {
|
|
30
|
+
text: string;
|
|
31
|
+
} | null;
|
|
32
|
+
/** The `context@1` contract: an extension that adds text to the model's context at run start. */
|
|
33
|
+
export interface ContextProvider {
|
|
34
|
+
provide(req: ContextRequest): Promise<ContextResult>;
|
|
35
|
+
}
|
|
36
|
+
/** Limits on one `provide` call: the time it may take and the bytes of text the kernel keeps. */
|
|
37
|
+
export declare const CONTEXT_LIMITS: {
|
|
38
|
+
readonly timeoutMs: 2000;
|
|
39
|
+
readonly maxBytes: 32768;
|
|
40
|
+
};
|
package/dist/context.js
ADDED
package/dist/ctx.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Kysely } from "kysely";
|
|
2
2
|
import type { ExtensionPointRef } from "./extension-point.js";
|
|
3
3
|
import type { AvailableHook, HookHandler, HookOptions } from "./hooks.js";
|
|
4
|
+
import type { ModelEmbeddingInfo, ModelKind } from "./model.js";
|
|
5
|
+
import type { SetupCheckDefinition } from "./setup-check.js";
|
|
4
6
|
import type { ObjectHead, PresignedUpload, PresignGetOptions } from "./storage.js";
|
|
5
7
|
import type { ToolHandler, ToolSpec } from "./tool.js";
|
|
6
8
|
import type { EmbedClaims, UiActionArgs, UiActionResult, UiRenderArgs, UiView } from "./ui.js";
|
|
@@ -58,6 +60,65 @@ export interface ExtensionStorage {
|
|
|
58
60
|
ttlSeconds: number;
|
|
59
61
|
}): Promise<PresignedUpload>;
|
|
60
62
|
}
|
|
63
|
+
/** A `ctx.models.embed` request: texts embedded for one org with the model mapped to a purpose. */
|
|
64
|
+
export interface ExtensionEmbedRequest {
|
|
65
|
+
orgId: string;
|
|
66
|
+
/** A purpose this extension declared in `permissions.models` with `kind: "embedding"`. */
|
|
67
|
+
purpose: string;
|
|
68
|
+
/** The texts, one vector each; split into batches by the model's `maxBatch` by the kernel. */
|
|
69
|
+
input: string[];
|
|
70
|
+
/** One of the model's `embedding.dimensions`; the model's default when absent. */
|
|
71
|
+
dimensions?: number;
|
|
72
|
+
inputType?: "query" | "document";
|
|
73
|
+
/**
|
|
74
|
+
* Aborts this call (e.g. the tool call's `signal`); combined with `ctx.signal`. Batches not yet
|
|
75
|
+
* sent are not sent; batches already answered are still recorded as usage.
|
|
76
|
+
*/
|
|
77
|
+
signal?: AbortSignal;
|
|
78
|
+
}
|
|
79
|
+
/** A `ctx.models.embed` result. */
|
|
80
|
+
export interface ExtensionEmbedResult {
|
|
81
|
+
/** One vector per input, in input order. */
|
|
82
|
+
vectors: number[][];
|
|
83
|
+
/** The model that made them (a changed model invalidates stored vectors). */
|
|
84
|
+
model: {
|
|
85
|
+
provider: string;
|
|
86
|
+
id: string;
|
|
87
|
+
};
|
|
88
|
+
dimensions: number;
|
|
89
|
+
}
|
|
90
|
+
/** The model a purpose maps to in an org (`ctx.models.describe`). */
|
|
91
|
+
export interface ExtensionModelTarget {
|
|
92
|
+
provider: string;
|
|
93
|
+
id: string;
|
|
94
|
+
kind: ModelKind;
|
|
95
|
+
/** Present for an embedding model. */
|
|
96
|
+
embedding?: ModelEmbeddingInfo;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Models by purpose (`permissions.models`): the purpose → model mapping is chosen by org admins
|
|
100
|
+
* (and the deployment default by the super admin), never by the extension. Only purposes this
|
|
101
|
+
* extension declared with `kind: "embedding"` are accepted (`model.purpose_unknown` otherwise), and
|
|
102
|
+
* only for an org that enabled the extension (`extension.not_enabled`). Usage is recorded by the
|
|
103
|
+
* kernel and reported through `usage.report` (purpose `embedding`).
|
|
104
|
+
*/
|
|
105
|
+
export interface ExtensionModels {
|
|
106
|
+
/**
|
|
107
|
+
* Embeds `input` with the org's effective model for `purpose`. Rejects with `model.unconfigured`
|
|
108
|
+
* when the purpose maps to no model the org can use, `validation_failed` for dimensions the model
|
|
109
|
+
* lacks, and a `ModelError` when the provider fails (a result of the wrong count or dimension is a
|
|
110
|
+
* `ModelError` of kind `server`). Not retried by the kernel. Each call fires the `model.request`
|
|
111
|
+
* hook first (`purpose: "embedding"`, every text of the call): when a policy hook denies it, the
|
|
112
|
+
* call rejects with an error whose `code` is `model.hook_denied` (HTTP 403 if it escapes an
|
|
113
|
+
* extension route), and nothing is sent or billed.
|
|
114
|
+
*/
|
|
115
|
+
embed(req: ExtensionEmbedRequest): Promise<ExtensionEmbedResult>;
|
|
116
|
+
/** The org's effective model for `purpose`, or null when it maps to no model the org can use. */
|
|
117
|
+
describe(req: {
|
|
118
|
+
orgId: string;
|
|
119
|
+
purpose: string;
|
|
120
|
+
}): Promise<ExtensionModelTarget | null>;
|
|
121
|
+
}
|
|
61
122
|
/** 传给插件 `setup` 的上下文。不提供定时器与进程内共享状态;kv 写入必须带 TTL。 */
|
|
62
123
|
export interface ExtensionContext {
|
|
63
124
|
kv: {
|
|
@@ -94,6 +155,8 @@ export interface ExtensionContext {
|
|
|
94
155
|
};
|
|
95
156
|
/** 对象存储(需 `permissions.storage`,见 {@link ExtensionStorage})。 */
|
|
96
157
|
storage: ExtensionStorage;
|
|
158
|
+
/** Models by purpose (requires `permissions.models`, see {@link ExtensionModels}). */
|
|
159
|
+
models: ExtensionModels;
|
|
97
160
|
/** 已切到本插件 schema(withSchema)的 Kysely 实例。 */
|
|
98
161
|
db: Kysely<any>;
|
|
99
162
|
http: {
|
|
@@ -109,7 +172,9 @@ export interface ExtensionContext {
|
|
|
109
172
|
* manifest's `requires` / `optional`. Without `orgId` it is the deployment-level view and returns
|
|
110
173
|
* synchronously; with `orgId` it returns a Promise, and orgScoped extension points (such as
|
|
111
174
|
* `channel`, `directory`) are filtered by that org's enablement (queried every time, not cached);
|
|
112
|
-
* `
|
|
175
|
+
* with `orgId`, a provider whose effective config is not valid in that org is excluded too;
|
|
176
|
+
* `get` rejects with `ExtensionPointUnavailableError` when the provider is not enabled in that
|
|
177
|
+
* org or its config is not valid there.
|
|
113
178
|
* When there is no provider, `get` throws `ExtensionPointUnavailableError` and `list` returns an
|
|
114
179
|
* empty list.
|
|
115
180
|
*/
|
|
@@ -134,20 +199,37 @@ export interface ExtensionContext {
|
|
|
134
199
|
* 界面贡献的运行时(清单 `ui` + `permissions.ui`):
|
|
135
200
|
* - `view` / `action`:只能在 `setup` 期间注册,id 是清单里 kind view 的贡献 id;
|
|
136
201
|
* `action` 收到视图里按钮或表单提交(`args.actionId` 区分是哪一个);
|
|
137
|
-
* - `invalidate`:告诉内核「这个贡献变了」,打开着它的网页会重新取视图(经 bus,跨副本);
|
|
202
|
+
* - `invalidate`:告诉内核「这个贡献变了」,打开着它的网页会重新取视图(经 bus,跨副本);a
|
|
203
|
+
* `platform.page` contribution takes no `orgId` (it refreshes the admin console), every other
|
|
204
|
+
* contribution requires one;
|
|
138
205
|
* - `verifyEmbedToken`:校验 embed 页面拿到的嵌入令牌,只认签给本插件、未过期的,且此刻插件仍在该组织启用、
|
|
139
|
-
* 调用者仍是 active
|
|
206
|
+
* 调用者仍是 active 成员,角色仍满足位置的 minRole,否则返回 null;返回的 `role` 是此刻的角色。A
|
|
207
|
+
* platform-scope token (`scope: "platform"`, no `orgId`) verifies only for a `platform.page`
|
|
208
|
+
* contribution while the account is still an active super admin.
|
|
140
209
|
*/
|
|
141
210
|
ui: {
|
|
142
211
|
view(id: string, render: (args: UiRenderArgs) => Promise<UiView>): void;
|
|
143
212
|
action(id: string, handler: (args: UiActionArgs) => Promise<UiActionResult>): void;
|
|
144
213
|
invalidate(target: {
|
|
145
|
-
|
|
214
|
+
/** Required, except for a `platform.page` contribution, where it must be omitted. */
|
|
215
|
+
orgId?: string;
|
|
146
216
|
conversationId?: string;
|
|
147
217
|
contribution: string;
|
|
148
218
|
}): Promise<void>;
|
|
149
219
|
verifyEmbedToken(token: string): Promise<EmbedClaims | null>;
|
|
150
220
|
};
|
|
221
|
+
/**
|
|
222
|
+
* Setup checks (`permissions.setupChecks`): the live rows of the plugin's setup guides.
|
|
223
|
+
* `check` is only allowed during `setup`; `id` must be listed in `permissions.setupChecks`
|
|
224
|
+
* (else `ExtensionPermissionError`); registering an id twice throws. The kernel runs a check only
|
|
225
|
+
* when a person or an agent asks, only for targets of this plugin and of `def.place`, aborts
|
|
226
|
+
* `signal` after `SETUP_CHECK_LIMITS.timeoutMs`, and redacts and bounds the result. A check never
|
|
227
|
+
* writes, passes `signal` to every request, does not retry and never puts a secret in `reason`
|
|
228
|
+
* or `fix`. It never receives an OAuth client secret or a member's token.
|
|
229
|
+
*/
|
|
230
|
+
setup: {
|
|
231
|
+
check(id: string, def: SetupCheckDefinition): void;
|
|
232
|
+
};
|
|
151
233
|
/**
|
|
152
234
|
* Hooks (`permissions.hooks`): observe model and tool calls, or deny them with a policy hook.
|
|
153
235
|
* `on` is only allowed during `setup`; the mount point must be declared in `permissions.hooks` and be
|
|
@@ -14,7 +14,11 @@ export interface ExtensionManifest {
|
|
|
14
14
|
optional?: ExtensionPointRef[];
|
|
15
15
|
/** 权限清单(治理而非沙箱)。 */
|
|
16
16
|
permissions?: ExtensionPermissions;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* UI contributions, each in a slot of `UI_SLOTS`; every id is also listed in `permissions.ui`.
|
|
19
|
+
* Kept exactly as written: structural problems fail the extension, while a contribution to an
|
|
20
|
+
* unknown slot or version is only dropped when the host resolves the slots (`resolveUiSlots`).
|
|
21
|
+
*/
|
|
18
22
|
ui?: UiContribution[];
|
|
19
23
|
config?: {
|
|
20
24
|
deployment?: z.ZodTypeAny;
|
package/dist/define-extension.js
CHANGED
|
@@ -78,6 +78,7 @@ export function defineExtension(m) {
|
|
|
78
78
|
if (errs.length > 0)
|
|
79
79
|
fail(`invalid permissions: ${errs.join("; ")}`);
|
|
80
80
|
}
|
|
81
|
+
// structural ui problems only; slot resolution never fails the extension (UI slots spec §3.2)
|
|
81
82
|
const uiErrs = validateUiContributions(m.ui, m.permissions);
|
|
82
83
|
if (uiErrs.length > 0)
|
|
83
84
|
fail(`invalid ui: ${uiErrs.join("; ")}`);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dev hosts preset: common package registries, source hosts and tool downloads the `dev`
|
|
3
|
+
* sandbox tier adds to the org's allowlist. The kernel's `sandbox.limits.devHosts` defaults to it;
|
|
4
|
+
* the device and the sandbox plugins read the same list. Every entry passes `validateAllowHost`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEV_HOSTS: readonly string[];
|