@capybara-hq/plugin-sdk 0.1.0-rc.3 → 0.1.0-rc.31
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/agent-docs/agent-templates.md +15 -3
- package/agent-docs/concepts.md +5 -0
- package/agent-docs/connector-templates.md +2 -1
- package/agent-docs/extension-points/channel.md +1 -1
- package/agent-docs/extension-points/config-source.md +1 -1
- package/agent-docs/extension-points/connector.md +1 -1
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/counter.md +1 -1
- package/agent-docs/extension-points/directory.md +1 -1
- package/agent-docs/extension-points/file-preview.md +1 -1
- package/agent-docs/extension-points/identity-source.md +1 -1
- package/agent-docs/extension-points/model-provider.md +4 -2
- package/agent-docs/extension-points/object-store.md +3 -1
- package/agent-docs/extension-points/sandbox.md +3 -3
- package/agent-docs/extension-points/secret-store.md +1 -1
- package/agent-docs/extension-points/web-fetch.md +1 -1
- package/agent-docs/extension-points/web-search.md +1 -1
- package/agent-docs/extensions.md +29 -4
- package/agent-docs/plugin-format.md +43 -3
- package/agent-docs/setup.md +46 -0
- package/agent-docs/skills.md +1 -1
- package/agent-docs/tool-naming.md +1 -1
- package/dist/agent-template.d.ts +15 -6
- package/dist/agent-template.js +32 -13
- package/dist/bootstrap.d.ts +15 -1
- package/dist/bootstrap.js +17 -1
- package/dist/cards.d.ts +56 -13
- package/dist/cards.js +90 -20
- package/dist/channel.d.ts +111 -48
- package/dist/channel.js +10 -5
- 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 +22 -0
- package/dist/config-ui.js +64 -4
- package/dist/connector-auth.d.ts +7 -2
- package/dist/connector-auth.js +29 -8
- package/dist/connector.d.ts +74 -32
- package/dist/context.d.ts +40 -0
- package/dist/context.js +2 -0
- package/dist/ctx.d.ts +135 -26
- package/dist/define-extension.d.ts +26 -12
- package/dist/define-extension.js +11 -4
- package/dist/device-protocol-v3.d.ts +117 -0
- package/dist/device-protocol-v3.js +409 -0
- package/dist/device-protocol.d.ts +330 -0
- package/dist/device-protocol.js +567 -0
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +5 -2
- package/dist/file-preview.d.ts +1 -1
- package/dist/git-hosts.d.ts +44 -0
- package/dist/git-hosts.js +81 -0
- package/dist/hooks.d.ts +111 -21
- package/dist/hooks.js +5 -0
- package/dist/http-access.d.ts +52 -0
- package/dist/http-access.js +12 -0
- package/dist/identity.d.ts +22 -9
- package/dist/index.d.ts +23 -1
- package/dist/index.js +24 -1
- package/dist/marketplace.d.ts +26 -0
- package/dist/marketplace.js +43 -1
- package/dist/model-params.d.ts +41 -22
- package/dist/model-params.js +28 -15
- package/dist/model.d.ts +180 -71
- package/dist/model.js +71 -19
- package/dist/net.d.ts +52 -0
- package/dist/net.js +34 -0
- package/dist/permissions.d.ts +42 -20
- package/dist/permissions.js +97 -40
- package/dist/plugin-manifest.d.ts +45 -5
- package/dist/plugin-manifest.js +169 -6
- package/dist/plugin-package.d.ts +82 -38
- package/dist/plugin-package.js +61 -29
- package/dist/sandbox-linux-runtime-source.d.ts +1 -0
- package/dist/sandbox-linux-runtime-source.js +1886 -0
- package/dist/sandbox-native-runtime-source.d.ts +8 -0
- package/dist/sandbox-native-runtime-source.js +325 -0
- package/dist/sandbox-operation.d.ts +248 -0
- package/dist/sandbox-operation.js +245 -0
- package/dist/sandbox-runtime-source.d.ts +19 -0
- package/dist/sandbox-runtime-source.js +28 -0
- package/dist/sandbox-write-denies.d.ts +60 -0
- package/dist/sandbox-write-denies.js +630 -0
- package/dist/sandbox.d.ts +201 -16
- package/dist/sandbox.js +89 -14
- package/dist/secret.d.ts +4 -1
- package/dist/secret.js +4 -1
- 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 +4 -3
- package/dist/skill-invocation.js +5 -4
- package/dist/skill.d.ts +34 -21
- package/dist/skill.js +48 -31
- package/dist/storage.d.ts +52 -25
- 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 +279 -0
- package/dist/theme-tokens.generated.js +174 -0
- package/dist/theme.d.ts +152 -0
- package/dist/theme.js +392 -0
- package/dist/tool.d.ts +69 -26
- package/dist/tool.js +29 -9
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +337 -0
- package/dist/ui-resolve.d.ts +35 -0
- package/dist/ui-resolve.js +42 -0
- package/dist/ui-slots.d.ts +53 -0
- package/dist/ui-slots.js +238 -0
- package/dist/ui.d.ts +191 -79
- package/dist/ui.js +101 -27
- package/dist/url.d.ts +4 -1
- package/dist/url.js +4 -1
- package/package.json +7 -1
- package/schemas/bootstrap.v1.schema.json +6 -0
- package/schemas/connector-template.v1.schema.json +35 -0
- package/schemas/marketplace.v1.schema.json +14 -0
- package/schemas/plugin.v1.schema.json +115 -3
- package/schemas/theme.v1.schema.json +225 -0
package/dist/marketplace.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { CATALOG_ITEM_NAME_RE, isSafePackagePath, NPM_PACKAGE_NAME_RE, SEMVER_VERSION_RE, SHA512_INTEGRITY_RE, } from "./plugin-package.js";
|
|
2
|
+
import { CATALOG_ITEM_NAME_RE, CONNECTOR_TEMPLATE_LIMITS, isSafePackagePath, NPM_PACKAGE_NAME_RE, SEMVER_VERSION_RE, SHA512_INTEGRITY_RE, } from "./plugin-package.js";
|
|
3
3
|
/**
|
|
4
4
|
* The marketplace manifest `marketplace.json` (package ecosystem spec §5.2): a list of plugins,
|
|
5
5
|
* each with one source. One entry is one version. `capybara-plugin marketplace --write` lists one
|
|
@@ -29,6 +29,8 @@ export const MARKETPLACE_LIMITS = {
|
|
|
29
29
|
plugins: 5000,
|
|
30
30
|
permissionKeys: 500,
|
|
31
31
|
urlChars: 2000,
|
|
32
|
+
/** Bytes of an entry icon (the plugin icon limit, {@link CONNECTOR_TEMPLATE_LIMITS}). */
|
|
33
|
+
iconBytes: CONNECTOR_TEMPLATE_LIMITS.iconBytes,
|
|
32
34
|
};
|
|
33
35
|
const M = MARKETPLACE_LIMITS;
|
|
34
36
|
const MAX_ERRORS = 50;
|
|
@@ -37,6 +39,13 @@ const PERMISSION_KEY_RE = /^[a-z][a-z.]{0,62}(?::[^\r\n]{1,256})?$/;
|
|
|
37
39
|
const SHA256_INTEGRITY_RE = /^sha256-[A-Za-z0-9+/]{43}=$/;
|
|
38
40
|
const COMMIT_RE = /^[0-9a-f]{40}$/;
|
|
39
41
|
const HTTPS_URL_RE = /^https:\/\/\S+$/;
|
|
42
|
+
/** An entry icon's file extension (of the URL's path, or of the repository path). */
|
|
43
|
+
export const MARKETPLACE_ICON_RE = /\.(?:svg|png)$/i;
|
|
44
|
+
// Spelled without the `i` flag so the generated JSON Schema keeps the rule
|
|
45
|
+
const ICON_EXT = "\\.(?:[sS][vV][gG]|[pP][nN][gG])";
|
|
46
|
+
const ICON_URL_RE = new RegExp(`^https://[^\\s?#]+${ICON_EXT}(?:\\?[^\\s#]*)?$`);
|
|
47
|
+
const ICON_URL_OR_LOOPBACK_RE = new RegExp(`^(?:https://[^\\s?#]+|http://(?:127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|localhost|\\[::1\\])(?::\\d{1,5})?/[^\\s?#]*)${ICON_EXT}(?:\\?[^\\s#]*)?$`);
|
|
48
|
+
const ICON_PATH_RE = new RegExp(`^\\./[^\\s?#]+${ICON_EXT}$`);
|
|
40
49
|
const HTTPS_OR_LOOPBACK_RE = /^(?:https:\/\/\S+|http:\/\/(?:127\.\d{1,3}\.\d{1,3}\.\d{1,3}|localhost|\[::1\])(?::\d{1,5})?(?:\/\S*)?)$/;
|
|
41
50
|
const urlString = (re) => z
|
|
42
51
|
.string()
|
|
@@ -55,6 +64,15 @@ const exactVersion = (what) => z
|
|
|
55
64
|
.string()
|
|
56
65
|
.max(256)
|
|
57
66
|
.regex(SEMVER_VERSION_RE, { message: `${what} must be an exact semver version` });
|
|
67
|
+
/** The path of a URL (empty when it does not parse). */
|
|
68
|
+
const urlPathname = (s) => {
|
|
69
|
+
try {
|
|
70
|
+
return new URL(s).pathname;
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return "";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
58
76
|
/** `./<safe path>` inside the marketplace repo. */
|
|
59
77
|
const repoPath = z
|
|
60
78
|
.string()
|
|
@@ -144,6 +162,12 @@ function buildSchema(opts) {
|
|
|
144
162
|
})
|
|
145
163
|
.optional(),
|
|
146
164
|
homepage: urlString(HTTPS_URL_RE).optional(),
|
|
165
|
+
icon: z
|
|
166
|
+
.union([
|
|
167
|
+
urlString(opts.allowInsecureLoopback ? ICON_URL_OR_LOOPBACK_RE : ICON_URL_RE).refine((s) => MARKETPLACE_ICON_RE.test(urlPathname(s)), { message: "an icon URL's path must end in .svg or .png" }),
|
|
168
|
+
repoPath.regex(ICON_PATH_RE, { message: "icon must be a .svg or .png file" }),
|
|
169
|
+
])
|
|
170
|
+
.optional(),
|
|
147
171
|
deprecated: z
|
|
148
172
|
.union([
|
|
149
173
|
z.boolean(),
|
|
@@ -248,6 +272,14 @@ const SOURCE_FORMS = ["path", "git", "npm", "archive"];
|
|
|
248
272
|
* form the source uses instead, or that it must use exactly one form.
|
|
249
273
|
*/
|
|
250
274
|
function explainSource(json, issue) {
|
|
275
|
+
if (issue.code === "invalid_union" && issue.path[issue.path.length - 1] === "icon") {
|
|
276
|
+
return [
|
|
277
|
+
{
|
|
278
|
+
path: issue.path,
|
|
279
|
+
message: 'icon must be an https URL whose path ends in .svg or .png, or a "./" path inside the repository ending in .svg or .png',
|
|
280
|
+
},
|
|
281
|
+
];
|
|
282
|
+
}
|
|
251
283
|
if (issue.code !== "invalid_union" || issue.path[issue.path.length - 1] !== "source") {
|
|
252
284
|
return [issue];
|
|
253
285
|
}
|
|
@@ -272,6 +304,16 @@ export function marketplaceEntryVersion(e) {
|
|
|
272
304
|
return e.source.npm.version;
|
|
273
305
|
return null;
|
|
274
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* The entry's icon (see {@link MarketplaceEntry.icon}): `{ url }` for an absolute URL, `{ path }`
|
|
309
|
+
* (normalized, without the leading `./`) for a path inside the marketplace's repository, `null`
|
|
310
|
+
* without one.
|
|
311
|
+
*/
|
|
312
|
+
export function marketplaceEntryIcon(e) {
|
|
313
|
+
if (e.icon === undefined)
|
|
314
|
+
return null;
|
|
315
|
+
return e.icon.startsWith("./") ? { path: e.icon.slice(2) } : { url: e.icon };
|
|
316
|
+
}
|
|
275
317
|
/**
|
|
276
318
|
* The entry's deprecation (see {@link MarketplaceEntry.deprecated}): `null` when it is not
|
|
277
319
|
* deprecated (absent or `false`), else its reason (`null` without one).
|
package/dist/model-params.d.ts
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `model-provider@2`
|
|
3
|
-
*
|
|
2
|
+
* Parameter declarations and validation for `model-provider@2` (pure functions; issues / error
|
|
3
|
+
* messages are in English, for logs and API responses).
|
|
4
|
+
* Each model declares in `ModelInfo.parameters` the parameters it supports; value constraints are a
|
|
5
|
+
* restricted JSON Schema subset.
|
|
4
6
|
*/
|
|
5
7
|
export type Effort = "low" | "medium" | "high" | "xhigh" | "max";
|
|
6
8
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - `thinking
|
|
10
|
-
*
|
|
11
|
-
* - `
|
|
9
|
+
* Standard knobs: uniform platform semantics, rendered specially by the UI, with semantics that
|
|
10
|
+
* carry over when switching models or falling back; the plugin maps them to native parameters.
|
|
11
|
+
* - `effort`: thinking depth, `{ type: "string", enum }`, values a subset of
|
|
12
|
+
* `low|medium|high|xhigh|max`;
|
|
13
|
+
* - `thinking`: thinking mode, `{ type: "string", enum }`, values a subset of `off|on|summarized`;
|
|
14
|
+
* - `temperature`: `{ type: "number" }` (may carry a range);
|
|
15
|
+
* - `maxOutputTokens`: maximum output tokens, `{ type: "integer" }` (may carry a range).
|
|
12
16
|
*/
|
|
13
17
|
export type StandardKnob = "effort" | "thinking" | "temperature" | "maxOutputTokens";
|
|
14
18
|
export declare const STANDARD_KNOBS: readonly StandardKnob[];
|
|
15
|
-
/** `effort`
|
|
19
|
+
/** The full set of values the `effort` knob allows. */
|
|
16
20
|
export declare const EFFORT_VALUES: readonly Effort[];
|
|
17
|
-
/** `thinking`
|
|
21
|
+
/** The full set of values the `thinking` knob allows. */
|
|
18
22
|
export declare const THINKING_VALUES: readonly string[];
|
|
19
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Parameter value constraints: a restricted JSON Schema subset (serializable for the UI; the kernel
|
|
25
|
+
* validates it itself, without ajv).
|
|
26
|
+
*/
|
|
20
27
|
export type ParamSchema = {
|
|
21
28
|
type: "string";
|
|
22
29
|
enum: string[];
|
|
@@ -31,14 +38,20 @@ export type ParamSchema = {
|
|
|
31
38
|
maximum?: number;
|
|
32
39
|
};
|
|
33
40
|
export type ParamValue = string | number | boolean;
|
|
34
|
-
/**
|
|
41
|
+
/** One parameter a model declares. */
|
|
35
42
|
export interface ModelParameter {
|
|
36
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* A standard knob name (see {@link StandardKnob}), or a vendor-specific parameter `"<plugin
|
|
45
|
+
* name>.<name>"`.
|
|
46
|
+
*/
|
|
37
47
|
key: string;
|
|
38
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Required when key is a standard knob and must equal key; vendor-specific parameters must not
|
|
50
|
+
* set it.
|
|
51
|
+
*/
|
|
39
52
|
standard?: StandardKnob;
|
|
40
53
|
schema: ParamSchema;
|
|
41
|
-
/**
|
|
54
|
+
/** The value used when unset; must satisfy the schema. */
|
|
42
55
|
default?: ParamValue;
|
|
43
56
|
label: {
|
|
44
57
|
zh: string;
|
|
@@ -53,11 +66,13 @@ export interface ParamIssue {
|
|
|
53
66
|
key: string;
|
|
54
67
|
message: string;
|
|
55
68
|
}
|
|
56
|
-
/**
|
|
69
|
+
/** Returns an English reason when the value does not satisfy the schema, undefined when it does. */
|
|
57
70
|
export declare function checkParamValue(schema: ParamSchema, v: unknown): string | undefined;
|
|
58
71
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
72
|
+
* Strict validation (used when saving an agent): unknown keys, type mismatches, enum violations and
|
|
73
|
+
* out-of-range values are all errors, reported per key.
|
|
74
|
+
* On success `value` is the input parameters, with no defaults filled in; a key whose value is
|
|
75
|
+
* undefined counts as unset.
|
|
61
76
|
*/
|
|
62
77
|
export declare function validateParams(decl: ModelParameter[], params: Record<string, unknown>): {
|
|
63
78
|
ok: true;
|
|
@@ -67,16 +82,20 @@ export declare function validateParams(decl: ModelParameter[], params: Record<st
|
|
|
67
82
|
issues: ParamIssue[];
|
|
68
83
|
};
|
|
69
84
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
85
|
+
* The lenient variant (used at runtime): drops unknown or invalid entries (their keys go into
|
|
86
|
+
* `dropped`), then fills defaults for declared parameters that are unset.
|
|
87
|
+
* For the case where saved parameters are no longer valid after a plugin upgrade, so that the whole
|
|
88
|
+
* run does not fail.
|
|
72
89
|
*/
|
|
73
90
|
export declare function sanitizeParams(decl: ModelParameter[], params: Record<string, unknown>): {
|
|
74
91
|
value: Record<string, ParamValue>;
|
|
75
92
|
dropped: string[];
|
|
76
93
|
};
|
|
77
94
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
95
|
+
* Validates the parameters a plugin declares for a model: the key is a standard knob or
|
|
96
|
+
* `<plugin>.<name>`, `standard` agrees with the key,
|
|
97
|
+
* the schema belongs to the supported subset, standard knobs satisfy the value conventions,
|
|
98
|
+
* defaults satisfy the schema, copy is complete, keys do not repeat.
|
|
99
|
+
* Throws when there is a problem, with a message naming the plugin and each key (in English).
|
|
81
100
|
*/
|
|
82
101
|
export declare function assertValidDeclarations(plugin: string, decl: ModelParameter[]): void;
|
package/dist/model-params.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `model-provider@2`
|
|
3
|
-
*
|
|
2
|
+
* Parameter declarations and validation for `model-provider@2` (pure functions; issues / error
|
|
3
|
+
* messages are in English, for logs and API responses).
|
|
4
|
+
* Each model declares in `ModelInfo.parameters` the parameters it supports; value constraints are a
|
|
5
|
+
* restricted JSON Schema subset.
|
|
4
6
|
*/
|
|
5
7
|
export const STANDARD_KNOBS = [
|
|
6
8
|
"effort",
|
|
@@ -8,13 +10,13 @@ export const STANDARD_KNOBS = [
|
|
|
8
10
|
"temperature",
|
|
9
11
|
"maxOutputTokens",
|
|
10
12
|
];
|
|
11
|
-
/** `effort`
|
|
13
|
+
/** The full set of values the `effort` knob allows. */
|
|
12
14
|
export const EFFORT_VALUES = ["low", "medium", "high", "xhigh", "max"];
|
|
13
|
-
/** `thinking`
|
|
15
|
+
/** The full set of values the `thinking` knob allows. */
|
|
14
16
|
export const THINKING_VALUES = ["off", "on", "summarized"];
|
|
15
17
|
const isStandardKnob = (k) => STANDARD_KNOBS.includes(k);
|
|
16
18
|
const VENDOR_NAME = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
17
|
-
/**
|
|
19
|
+
/** Returns an English reason when the value does not satisfy the schema, undefined when it does. */
|
|
18
20
|
export function checkParamValue(schema, v) {
|
|
19
21
|
switch (schema.type) {
|
|
20
22
|
case "boolean":
|
|
@@ -45,11 +47,16 @@ export function checkParamValue(schema, v) {
|
|
|
45
47
|
return `has unsupported schema type ${JSON.stringify(schema.type)}`;
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Looks up a declaration by key (uses a Map so that prototype properties such as `constructor` are
|
|
52
|
+
* not mistaken for declared keys).
|
|
53
|
+
*/
|
|
49
54
|
const declMap = (decl) => new Map(decl.map((d) => [d.key, d]));
|
|
50
55
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
56
|
+
* Strict validation (used when saving an agent): unknown keys, type mismatches, enum violations and
|
|
57
|
+
* out-of-range values are all errors, reported per key.
|
|
58
|
+
* On success `value` is the input parameters, with no defaults filled in; a key whose value is
|
|
59
|
+
* undefined counts as unset.
|
|
53
60
|
*/
|
|
54
61
|
export function validateParams(decl, params) {
|
|
55
62
|
const byKey = declMap(decl);
|
|
@@ -72,8 +79,10 @@ export function validateParams(decl, params) {
|
|
|
72
79
|
return issues.length > 0 ? { ok: false, issues } : { ok: true, value };
|
|
73
80
|
}
|
|
74
81
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
82
|
+
* The lenient variant (used at runtime): drops unknown or invalid entries (their keys go into
|
|
83
|
+
* `dropped`), then fills defaults for declared parameters that are unset.
|
|
84
|
+
* For the case where saved parameters are no longer valid after a plugin upgrade, so that the whole
|
|
85
|
+
* run does not fail.
|
|
77
86
|
*/
|
|
78
87
|
export function sanitizeParams(decl, params) {
|
|
79
88
|
const byKey = declMap(decl);
|
|
@@ -143,7 +152,9 @@ function schemaProblems(schema) {
|
|
|
143
152
|
return [`unsupported schema type ${JSON.stringify(s.type)}`];
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
|
-
/**
|
|
155
|
+
/**
|
|
156
|
+
* The value conventions of standard knobs (checked only when the schema itself is already valid).
|
|
157
|
+
*/
|
|
147
158
|
function knobProblems(key, schema) {
|
|
148
159
|
const values = schema.type === "string" && "enum" in schema ? schema.enum : undefined;
|
|
149
160
|
switch (key) {
|
|
@@ -178,7 +189,7 @@ function textProblems(d) {
|
|
|
178
189
|
}
|
|
179
190
|
return out;
|
|
180
191
|
}
|
|
181
|
-
/**
|
|
192
|
+
/** All problems of one parameter declaration; an empty array when there are none. */
|
|
182
193
|
function declarationProblems(plugin, d) {
|
|
183
194
|
if (typeof d !== "object" || d === null)
|
|
184
195
|
return ["declaration must be an object"];
|
|
@@ -198,9 +209,11 @@ function declarationProblems(plugin, d) {
|
|
|
198
209
|
return out;
|
|
199
210
|
}
|
|
200
211
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
212
|
+
* Validates the parameters a plugin declares for a model: the key is a standard knob or
|
|
213
|
+
* `<plugin>.<name>`, `standard` agrees with the key,
|
|
214
|
+
* the schema belongs to the supported subset, standard knobs satisfy the value conventions,
|
|
215
|
+
* defaults satisfy the schema, copy is complete, keys do not repeat.
|
|
216
|
+
* Throws when there is a problem, with a message naming the plugin and each key (in English).
|
|
204
217
|
*/
|
|
205
218
|
export function assertValidDeclarations(plugin, decl) {
|
|
206
219
|
if (!Array.isArray(decl)) {
|