@capybara-hq/plugin-sdk 0.1.0-rc.9 → 0.1.0-rc.90
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 +3 -1
- package/agent-docs/agent-templates.md +14 -2
- package/agent-docs/concepts.md +14 -5
- package/agent-docs/connector-templates.md +11 -3
- package/agent-docs/extension-points/channel.md +1 -1
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/device-provider.md +15 -0
- package/agent-docs/extension-points/file-preview.md +3 -1
- package/agent-docs/extension-points/identity-source.md +2 -0
- package/agent-docs/extension-points/model-provider.md +5 -1
- package/agent-docs/extension-points/object-store.md +2 -0
- package/agent-docs/extension-points/push-provider.md +17 -0
- package/agent-docs/extension-points/trigger-source.md +19 -0
- package/agent-docs/extensions.md +98 -4
- package/agent-docs/plugin-format.md +45 -10
- package/agent-docs/setup.md +54 -0
- package/api/plugin-sdk.api.md +5983 -0
- package/dist/agent-template.d.ts +15 -6
- package/dist/agent-template.js +32 -13
- package/dist/agents-ctx.d.ts +116 -0
- package/dist/agents-ctx.js +22 -0
- package/dist/avatar-presets.d.ts +8 -0
- package/dist/avatar-presets.js +17 -0
- package/dist/bootstrap.d.ts +109 -1
- package/dist/bootstrap.js +185 -2
- package/dist/cards.d.ts +121 -13
- package/dist/cards.js +161 -19
- package/dist/channel.d.ts +133 -47
- 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 +28 -6
- package/dist/config-ui.js +88 -25
- package/dist/config-url-fetch.d.ts +19 -0
- package/dist/config-url-fetch.js +43 -0
- package/dist/connector-auth.d.ts +13 -2
- package/dist/connector-auth.js +82 -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 +344 -31
- package/dist/ctx.js +9 -1
- package/dist/define-extension.d.ts +18 -12
- package/dist/define-extension.js +18 -5
- package/dist/device-denied-paths.d.ts +20 -0
- package/dist/device-denied-paths.js +118 -0
- package/dist/device-operation.d.ts +348 -0
- package/dist/device-operation.js +312 -0
- package/dist/device-protocol.d.ts +286 -49
- package/dist/device-protocol.js +766 -89
- package/dist/device-provider.d.ts +820 -0
- package/dist/device-provider.js +432 -0
- package/dist/device-service.d.ts +204 -0
- package/dist/device-service.js +291 -0
- package/dist/dial-in.d.ts +286 -0
- package/dist/dial-in.js +213 -0
- package/dist/directory.d.ts +15 -12
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +8 -3
- package/dist/field-meta.d.ts +19 -0
- package/dist/field-meta.js +54 -0
- package/dist/file-preview.d.ts +46 -9
- package/dist/git-hosts.d.ts +53 -0
- package/dist/git-hosts.js +98 -0
- package/dist/hooks.d.ts +185 -22
- package/dist/hooks.js +6 -0
- package/dist/http-access.d.ts +71 -0
- package/dist/http-access.js +12 -0
- package/dist/identity.d.ts +70 -9
- package/dist/identity.js +46 -1
- package/dist/inbox.d.ts +103 -0
- package/dist/inbox.js +173 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.js +30 -4
- package/dist/model-params.d.ts +41 -22
- package/dist/model-params.js +28 -15
- package/dist/model.d.ts +295 -77
- package/dist/model.js +249 -21
- package/dist/native-failure.d.ts +13 -0
- package/dist/native-failure.js +31 -0
- package/dist/net.d.ts +52 -0
- package/dist/net.js +34 -0
- package/dist/network-classes.d.ts +98 -0
- package/dist/network-classes.js +291 -0
- package/dist/permissions.d.ts +95 -25
- package/dist/permissions.js +175 -54
- package/dist/platform-only.d.ts +27 -0
- package/dist/platform-only.js +35 -0
- package/dist/plugin-manifest.d.ts +30 -6
- package/dist/plugin-manifest.js +147 -55
- package/dist/plugin-package.d.ts +82 -39
- package/dist/plugin-package.js +68 -41
- package/dist/push.d.ts +75 -0
- package/dist/push.js +87 -0
- package/dist/sandbox-linux-runtime-source.d.ts +1 -0
- package/dist/sandbox-linux-runtime-source.js +2343 -0
- package/dist/sandbox-native-runtime-source.d.ts +10 -0
- package/dist/sandbox-native-runtime-source.js +480 -0
- package/dist/sandbox-runtime-source.d.ts +47 -0
- package/dist/sandbox-runtime-source.js +73 -0
- package/dist/sandbox-write-denies.d.ts +139 -0
- package/dist/sandbox-write-denies.js +869 -0
- package/dist/secret.d.ts +8 -2
- package/dist/secret.js +11 -4
- package/dist/setup-check.d.ts +128 -0
- package/dist/setup-check.js +142 -0
- package/dist/setup-guide-parse.d.ts +121 -0
- package/dist/setup-guide-parse.js +356 -0
- package/dist/setup-guide-render.d.ts +45 -0
- package/dist/setup-guide-render.js +351 -0
- package/dist/setup-guide.d.ts +86 -72
- package/dist/setup-guide.js +340 -108
- package/dist/shell-capabilities.d.ts +216 -0
- package/dist/shell-capabilities.js +44 -0
- package/dist/shell-environment.d.ts +57 -0
- package/dist/shell-environment.js +21 -0
- package/dist/skill-invocation.d.ts +5 -0
- package/dist/skill-invocation.js +4 -3
- package/dist/skill.d.ts +27 -17
- package/dist/skill.js +40 -26
- package/dist/storage.d.ts +52 -25
- package/dist/svg-viewbox.d.ts +10 -0
- package/dist/svg-viewbox.js +24 -0
- package/dist/theme-assets.d.ts +25 -9
- package/dist/theme-assets.js +87 -47
- package/dist/theme-tokens.generated.d.ts +40 -12
- package/dist/theme-tokens.generated.js +36 -8
- package/dist/theme.d.ts +56 -10
- package/dist/theme.js +117 -23
- package/dist/tool.d.ts +242 -28
- package/dist/tool.js +135 -13
- package/dist/trigger-source.d.ts +35 -0
- package/dist/trigger-source.js +2 -0
- package/dist/triggers.d.ts +88 -0
- package/dist/triggers.js +71 -0
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +374 -0
- package/dist/ui-resolve.d.ts +2 -7
- package/dist/ui-resolve.js +7 -19
- package/dist/ui-slots.d.ts +27 -5
- package/dist/ui-slots.js +112 -19
- package/dist/ui.d.ts +203 -64
- package/dist/ui.js +117 -23
- package/dist/url.d.ts +4 -1
- package/dist/url.js +4 -1
- package/dist/web.d.ts +26 -20
- package/package.json +13 -1
- package/schemas/bootstrap-extra.v1.schema.json +186 -0
- package/schemas/bootstrap.v1.schema.json +20 -0
- package/schemas/connector-template.v1.schema.json +62 -4
- package/schemas/plugin.v1.schema.json +74 -143
- package/schemas/theme.v1.schema.json +77 -0
- package/agent-docs/extension-points/sandbox.md +0 -15
- package/dist/org-access.d.ts +0 -27
- package/dist/org-access.js +0 -35
- package/dist/sandbox.d.ts +0 -254
- package/dist/sandbox.js +0 -153
package/dist/agent-template.d.ts
CHANGED
|
@@ -19,10 +19,14 @@ export interface AgentTemplate {
|
|
|
19
19
|
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
20
20
|
/** Step limit (the kernel caps it at `runtime.maxSteps`). */
|
|
21
21
|
maxSteps?: number;
|
|
22
|
-
/** Skill names
|
|
22
|
+
/** Skill names the sub-agent is told to load with `Skill` before it starts (Claude Code's field). */
|
|
23
23
|
skills?: string[];
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Skills turned off for the agent (every skill on in the org is on otherwise):
|
|
26
|
+
* `<plugin>:<name>`, `<plugin>:*` (the whole plugin, skills it gains later included) or a bare
|
|
27
|
+
* `<name>` (an org skill without a plugin).
|
|
28
|
+
*/
|
|
29
|
+
disallowedSkills?: string[];
|
|
26
30
|
/** Connectors the agent needs: a connector template of the plugin, or a described need. */
|
|
27
31
|
connectors?: AgentTemplateConnector[];
|
|
28
32
|
/** The sub-agents the agent gets in its roster. */
|
|
@@ -85,12 +89,12 @@ export declare const AGENT_TEMPLATE_LIMITS: {
|
|
|
85
89
|
readonly descriptionChars: 4096;
|
|
86
90
|
/** Templates in one plugin. */
|
|
87
91
|
readonly perPlugin: 64;
|
|
88
|
-
/**
|
|
92
|
+
/** Skills the sub-agent loads first. */
|
|
89
93
|
readonly skills: 3;
|
|
90
94
|
/** Entries of `tools` and of `disallowedTools`. */
|
|
91
95
|
readonly tools: 200;
|
|
92
|
-
/** Entries of `
|
|
93
|
-
readonly
|
|
96
|
+
/** Entries of `disallowedSkills`. */
|
|
97
|
+
readonly disallowedSkills: 64;
|
|
94
98
|
/** Entries of `connectors`. */
|
|
95
99
|
readonly connectors: 16;
|
|
96
100
|
/** `subagents.types` plus `subagents.inline`. */
|
|
@@ -119,6 +123,11 @@ export interface AgentTemplateField {
|
|
|
119
123
|
export declare const AGENT_TEMPLATE_FIELDS: readonly AgentTemplateField[];
|
|
120
124
|
/** The name rule of a template (the catalog item name rule). */
|
|
121
125
|
export declare const AGENT_TEMPLATE_NAME_RE: RegExp;
|
|
126
|
+
/**
|
|
127
|
+
* A `disallowedSkills` entry: `<plugin>:<name>`, `<plugin>:*` (the whole plugin) or a bare skill
|
|
128
|
+
* `<name>` (an org skill without a plugin).
|
|
129
|
+
*/
|
|
130
|
+
export declare function isDisallowedSkillRef(v: unknown): v is string;
|
|
122
131
|
/** The name rule of an instruction file (the agent's rule, mirrored). */
|
|
123
132
|
export declare const AGENT_TEMPLATE_INSTRUCTION_FILE_NAME_RE: RegExp;
|
|
124
133
|
/**
|
package/dist/agent-template.js
CHANGED
|
@@ -13,12 +13,12 @@ export const AGENT_TEMPLATE_LIMITS = {
|
|
|
13
13
|
descriptionChars: 4096,
|
|
14
14
|
/** Templates in one plugin. */
|
|
15
15
|
perPlugin: 64,
|
|
16
|
-
/**
|
|
16
|
+
/** Skills the sub-agent loads first. */
|
|
17
17
|
skills: 3,
|
|
18
18
|
/** Entries of `tools` and of `disallowedTools`. */
|
|
19
19
|
tools: 200,
|
|
20
|
-
/** Entries of `
|
|
21
|
-
|
|
20
|
+
/** Entries of `disallowedSkills`. */
|
|
21
|
+
disallowedSkills: 64,
|
|
22
22
|
/** Entries of `connectors`. */
|
|
23
23
|
connectors: 16,
|
|
24
24
|
/** `subagents.types` plus `subagents.inline`. */
|
|
@@ -89,13 +89,13 @@ export const AGENT_TEMPLATE_FIELDS = [
|
|
|
89
89
|
name: "skills",
|
|
90
90
|
type: "array of skill names",
|
|
91
91
|
required: false,
|
|
92
|
-
description: "At most 3
|
|
92
|
+
description: "At most 3; the sub-agent is told to load them with `Skill` before it starts.",
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
name: "
|
|
96
|
-
type: "array of skill
|
|
95
|
+
name: "disallowedSkills",
|
|
96
|
+
type: "array of skill references",
|
|
97
97
|
required: false,
|
|
98
|
-
description: "At most
|
|
98
|
+
description: "At most 64 skills turned off (all others on in the org are on): `<plugin>:<name>`, `<plugin>:*` (the whole plugin, later skills included) or a bare `<name>` (an org skill without a plugin).",
|
|
99
99
|
},
|
|
100
100
|
{
|
|
101
101
|
name: "connectors",
|
|
@@ -139,6 +139,21 @@ const TOOL_KEY_RE = /^[a-zA-Z0-9_-]{1,64}$/;
|
|
|
139
139
|
const distinct = (v) => new Set(v).size === v.length;
|
|
140
140
|
const NAME_REF_RE = /^[a-z0-9][a-z0-9-]{0,63}(:[a-z0-9][a-z0-9-]{0,63})?$/;
|
|
141
141
|
const MODEL_REF_RE = /^[^/\s]+\/\S+$/;
|
|
142
|
+
const PLUGIN_REF_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
143
|
+
/**
|
|
144
|
+
* A `disallowedSkills` entry: `<plugin>:<name>`, `<plugin>:*` (the whole plugin) or a bare skill
|
|
145
|
+
* `<name>` (an org skill without a plugin).
|
|
146
|
+
*/
|
|
147
|
+
export function isDisallowedSkillRef(v) {
|
|
148
|
+
if (typeof v !== "string")
|
|
149
|
+
return false;
|
|
150
|
+
const i = v.indexOf(":");
|
|
151
|
+
if (i < 0)
|
|
152
|
+
return isSkillName(v);
|
|
153
|
+
const plugin = v.slice(0, i);
|
|
154
|
+
const name = v.slice(i + 1);
|
|
155
|
+
return PLUGIN_REF_RE.test(plugin) && (name === "*" || isSkillName(name));
|
|
156
|
+
}
|
|
142
157
|
/** The name rule of an instruction file (the agent's rule, mirrored). */
|
|
143
158
|
export const AGENT_TEMPLATE_INSTRUCTION_FILE_NAME_RE = /^[^/\\]{1,64}\.md$/;
|
|
144
159
|
const chars = (s) => [...s].length;
|
|
@@ -233,13 +248,17 @@ export function parseAgentTemplate(text) {
|
|
|
233
248
|
else
|
|
234
249
|
errors.push(`skills must list at most ${L.skills} skill names`);
|
|
235
250
|
}
|
|
236
|
-
if (fm.
|
|
237
|
-
const s = fm.
|
|
238
|
-
if (Array.isArray(s) &&
|
|
239
|
-
|
|
251
|
+
if (fm.disallowedSkills !== undefined) {
|
|
252
|
+
const s = fm.disallowedSkills;
|
|
253
|
+
if (Array.isArray(s) &&
|
|
254
|
+
s.length <= L.disallowedSkills &&
|
|
255
|
+
s.every(isDisallowedSkillRef) &&
|
|
256
|
+
distinct(s)) {
|
|
257
|
+
out.disallowedSkills = s;
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
errors.push(`disallowedSkills must list at most ${L.disallowedSkills} distinct entries, each <plugin>:<name>, <plugin>:* or <name>`);
|
|
240
261
|
}
|
|
241
|
-
else
|
|
242
|
-
errors.push(`selectedSkills must list at most ${L.selectedSkills} skill names`);
|
|
243
262
|
}
|
|
244
263
|
if (fm.connectors !== undefined) {
|
|
245
264
|
const c = readConnectors(fm.connectors, errors);
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only org facts an extension needs to build people-facing pages (collaboration spec): the
|
|
3
|
+
* agents a member may use, the conversations that serve one of the extension's own subjects, and
|
|
4
|
+
* the members' names and avatars. Each member of `ctx` sits behind its own permission key
|
|
5
|
+
* (`permissions.agents`, `permissions.conversations`, `permissions.people`); every call names the
|
|
6
|
+
* org and runs in its scope, and the extension must be enabled there.
|
|
7
|
+
*/
|
|
8
|
+
import type { BuiltinAvatarPresetId } from "./avatar-presets.js";
|
|
9
|
+
/**
|
|
10
|
+
* An avatar a page can draw, structurally the same as the design system's `AvatarValue` (what
|
|
11
|
+
* `Avatar` and `PrincipalPicker` take; the type is copied because the SDK imports no design
|
|
12
|
+
* package): a built-in preset, an image (`src` is a path the web app serves, such as
|
|
13
|
+
* `/api/v1/accounts/<id>/avatar?v=…`, or an absolute URL), or none (the initial is drawn).
|
|
14
|
+
*/
|
|
15
|
+
export type AvatarValue = {
|
|
16
|
+
kind: "preset";
|
|
17
|
+
id: BuiltinAvatarPresetId;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "image";
|
|
20
|
+
src: string;
|
|
21
|
+
} | null;
|
|
22
|
+
/** The most account ids one {@link PeopleCtx.get} call takes. */
|
|
23
|
+
export declare const PEOPLE_GET_MAX = 200;
|
|
24
|
+
/** The most results one {@link PeopleCtx.search} call returns (a larger `limit` is clamped). */
|
|
25
|
+
export declare const PEOPLE_SEARCH_MAX = 50;
|
|
26
|
+
/** The most conversations one {@link ConversationsCtx.bySubject} call returns (newest first). */
|
|
27
|
+
export declare const CONVERSATIONS_BY_SUBJECT_MAX = 200;
|
|
28
|
+
/** An agent a member may use. */
|
|
29
|
+
export interface UsableAgent {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
/** A preset stays a preset; an upload, an external image or a theme preset is an image. */
|
|
33
|
+
avatar: AvatarValue;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `ctx.agents` (requires `permissions.agents: { read: true }`).
|
|
37
|
+
*/
|
|
38
|
+
export interface AgentsCtx {
|
|
39
|
+
/**
|
|
40
|
+
* The agents `accountId` may use in the org (their own, the org's and those shared with them).
|
|
41
|
+
* An account that is not an active member of the org gets `[]`.
|
|
42
|
+
*/
|
|
43
|
+
usableBy(args: {
|
|
44
|
+
orgId: string;
|
|
45
|
+
accountId: string;
|
|
46
|
+
}): Promise<UsableAgent[]>;
|
|
47
|
+
}
|
|
48
|
+
/** What a conversation of a subject is doing now. */
|
|
49
|
+
export type SubjectConversationState = "idle" | "running" | "waiting";
|
|
50
|
+
/** A conversation serving a subject: metadata only, never its content. */
|
|
51
|
+
export interface SubjectConversation {
|
|
52
|
+
id: string;
|
|
53
|
+
ownerAccountId: string;
|
|
54
|
+
agentId: string;
|
|
55
|
+
/** From the latest run: queued or running is `running`, waiting on something is `waiting`. */
|
|
56
|
+
state: SubjectConversationState;
|
|
57
|
+
/** ISO time of the conversation's last activity. */
|
|
58
|
+
lastActivityAt: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `ctx.conversations` (requires `permissions.conversations: { subjects: true }`).
|
|
62
|
+
*/
|
|
63
|
+
export interface ConversationsCtx {
|
|
64
|
+
/**
|
|
65
|
+
* The live conversations of the org whose subject is `{ source: this extension, kind, id }`
|
|
66
|
+
* (set by `subject`-mode event automations), newest activity first, at most
|
|
67
|
+
* {@link CONVERSATIONS_BY_SUBJECT_MAX}. Another extension's subjects are never returned.
|
|
68
|
+
*/
|
|
69
|
+
bySubject(args: {
|
|
70
|
+
orgId: string;
|
|
71
|
+
subject: {
|
|
72
|
+
kind: string;
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
75
|
+
}): Promise<SubjectConversation[]>;
|
|
76
|
+
}
|
|
77
|
+
/** A member as {@link PeopleCtx.get} returns it: no email or other profile field. */
|
|
78
|
+
export interface PersonView {
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
avatar: AvatarValue;
|
|
82
|
+
/** False once the account is disabled (it is still a member until removed). */
|
|
83
|
+
active: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* `ctx.people` (requires `permissions.people: { read: true }`): members of the org only.
|
|
87
|
+
*/
|
|
88
|
+
export interface PeopleCtx {
|
|
89
|
+
/**
|
|
90
|
+
* The given accounts that are members of the org (others are dropped), at most
|
|
91
|
+
* {@link PEOPLE_GET_MAX} ids.
|
|
92
|
+
*/
|
|
93
|
+
get(args: {
|
|
94
|
+
orgId: string;
|
|
95
|
+
accountIds: string[];
|
|
96
|
+
}): Promise<PersonView[]>;
|
|
97
|
+
/**
|
|
98
|
+
* Active members whose display name contains `query` (case-insensitive), by name; an empty
|
|
99
|
+
* `query` returns active members up to the limit. `limit` defaults to 20 and is clamped to
|
|
100
|
+
* {@link PEOPLE_SEARCH_MAX}.
|
|
101
|
+
*/
|
|
102
|
+
search(args: {
|
|
103
|
+
orgId: string;
|
|
104
|
+
query: string;
|
|
105
|
+
limit?: number;
|
|
106
|
+
}): Promise<Pick<PersonView, "id" | "name" | "avatar">[]>;
|
|
107
|
+
}
|
|
108
|
+
/** Why a read of `ctx.agents`, `ctx.conversations` or `ctx.people` was refused. */
|
|
109
|
+
export type CtxReadErrorCode = "invalid_args" | "org_disabled";
|
|
110
|
+
/** A call of `ctx.agents` / `ctx.conversations` / `ctx.people` was refused. */
|
|
111
|
+
export declare class CtxReadError extends Error {
|
|
112
|
+
readonly code: CtxReadErrorCode;
|
|
113
|
+
constructor(code: CtxReadErrorCode, message: string, opts?: {
|
|
114
|
+
cause?: unknown;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read-only org facts an extension needs to build people-facing pages (collaboration spec): the
|
|
3
|
+
* agents a member may use, the conversations that serve one of the extension's own subjects, and
|
|
4
|
+
* the members' names and avatars. Each member of `ctx` sits behind its own permission key
|
|
5
|
+
* (`permissions.agents`, `permissions.conversations`, `permissions.people`); every call names the
|
|
6
|
+
* org and runs in its scope, and the extension must be enabled there.
|
|
7
|
+
*/
|
|
8
|
+
/** The most account ids one {@link PeopleCtx.get} call takes. */
|
|
9
|
+
export const PEOPLE_GET_MAX = 200;
|
|
10
|
+
/** The most results one {@link PeopleCtx.search} call returns (a larger `limit` is clamped). */
|
|
11
|
+
export const PEOPLE_SEARCH_MAX = 50;
|
|
12
|
+
/** The most conversations one {@link ConversationsCtx.bySubject} call returns (newest first). */
|
|
13
|
+
export const CONVERSATIONS_BY_SUBJECT_MAX = 200;
|
|
14
|
+
/** A call of `ctx.agents` / `ctx.conversations` / `ctx.people` was refused. */
|
|
15
|
+
export class CtxReadError extends Error {
|
|
16
|
+
code;
|
|
17
|
+
constructor(code, message, opts) {
|
|
18
|
+
super(message, opts && "cause" in opts ? { cause: opts.cause } : undefined);
|
|
19
|
+
this.name = "CtxReadError";
|
|
20
|
+
this.code = code;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ten built-in pixel-animal agent avatars (drawn by `@capybara-hq/design`), in the picker's
|
|
3
|
+
* order. A theme may hide them (`hideAvatarPresets`) and may not reuse their ids for its own
|
|
4
|
+
* presets (`avatars`). The kernel's preset ids are this list; the design package keeps a copy.
|
|
5
|
+
*/
|
|
6
|
+
export declare const BUILTIN_AVATAR_PRESET_IDS: readonly ["capybara", "black-bear", "panda", "elephant", "fox", "owl", "penguin", "rabbit", "turtle", "whale"];
|
|
7
|
+
/** One of {@link BUILTIN_AVATAR_PRESET_IDS}. */
|
|
8
|
+
export type BuiltinAvatarPresetId = (typeof BUILTIN_AVATAR_PRESET_IDS)[number];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ten built-in pixel-animal agent avatars (drawn by `@capybara-hq/design`), in the picker's
|
|
3
|
+
* order. A theme may hide them (`hideAvatarPresets`) and may not reuse their ids for its own
|
|
4
|
+
* presets (`avatars`). The kernel's preset ids are this list; the design package keeps a copy.
|
|
5
|
+
*/
|
|
6
|
+
export const BUILTIN_AVATAR_PRESET_IDS = [
|
|
7
|
+
"capybara",
|
|
8
|
+
"black-bear",
|
|
9
|
+
"panda",
|
|
10
|
+
"elephant",
|
|
11
|
+
"fox",
|
|
12
|
+
"owl",
|
|
13
|
+
"penguin",
|
|
14
|
+
"rabbit",
|
|
15
|
+
"turtle",
|
|
16
|
+
"whale",
|
|
17
|
+
];
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -9,11 +9,26 @@ import { z } from "zod";
|
|
|
9
9
|
* the official plugins are published: `path` is packed with `packages/plugin-tools`, which is
|
|
10
10
|
* byte-reproducible, and `integrity` is that pack's sha512).
|
|
11
11
|
*
|
|
12
|
+
* `required` and `builtin` are two different promises. A required entry is imported in the first
|
|
13
|
+
* pass, before the extensions load, and the start fails without it (so it can ship no skills or
|
|
14
|
+
* templates: those need object storage, which is not running then). A `builtin` entry is imported
|
|
15
|
+
* once the extensions have loaded (object storage available), so it may ship skills; its failure
|
|
16
|
+
* is logged and retried on the next start. Both give the plugin a builtin catalog item (scope
|
|
17
|
+
* `all`, on in every org, not switchable) and are imported again when missing. An entry is never
|
|
18
|
+
* both.
|
|
19
|
+
*
|
|
20
|
+
* An optional preinstall (neither) may carry `scope: "all"`: its catalog item is then created with
|
|
21
|
+
* scope `all` (on in every org, an org admin may switch it off) instead of `optional` (off until
|
|
22
|
+
* switched on). The scope is read only at the first import; a later change in the manifest never
|
|
23
|
+
* rewrites the item, the super admin owns it after that. `scope` on a required or builtin entry
|
|
24
|
+
* is refused.
|
|
25
|
+
*
|
|
12
26
|
* Objects are strict (unknown keys rejected, `$schema` allowed): the manifest ships with core, so
|
|
13
27
|
* there is no older reader to stay compatible with and a misspelt key is a mistake. The committed
|
|
14
28
|
* JSON Schema (`schemas/bootstrap.v1.schema.json`) is generated from {@link BootstrapManifestSchema}
|
|
15
29
|
* by `pnpm gen:package-schemas`; the cross-field rules (unique names, `marketplace` required with an
|
|
16
|
-
* npm entry
|
|
30
|
+
* npm entry, not both `required` and `builtin`, `scope` only on an optional preinstall) are
|
|
31
|
+
* decided only by {@link parseBootstrapManifest}.
|
|
17
32
|
*/
|
|
18
33
|
/** Manifest format version. */
|
|
19
34
|
export declare const BOOTSTRAP_MANIFEST_SCHEMA_VERSION = 1;
|
|
@@ -30,6 +45,18 @@ export type BootstrapEntry = {
|
|
|
30
45
|
integrity: string;
|
|
31
46
|
/** Enabled in every org and neither disableable nor uninstallable. */
|
|
32
47
|
required: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Builtin but not required: imported after the extensions loaded (it may ship skills), its
|
|
50
|
+
* catalog item builtin; a failure does not stop the start. Never together with `required`.
|
|
51
|
+
*/
|
|
52
|
+
builtin?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Only for an optional preinstall (neither `required` nor `builtin`): the scope its catalog
|
|
55
|
+
* item gets when first imported (default `optional`: off in every org until switched on).
|
|
56
|
+
* `all` is on in every org and an org admin may switch it off. Read only at the first
|
|
57
|
+
* import: a later change here never rewrites the item (the super admin owns it then).
|
|
58
|
+
*/
|
|
59
|
+
scope?: "all" | "optional";
|
|
33
60
|
} | {
|
|
34
61
|
name: string;
|
|
35
62
|
source: "workspace";
|
|
@@ -38,6 +65,14 @@ export type BootstrapEntry = {
|
|
|
38
65
|
version: string;
|
|
39
66
|
integrity: string;
|
|
40
67
|
required: boolean;
|
|
68
|
+
builtin?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Only for an optional preinstall (neither `required` nor `builtin`): the scope its catalog
|
|
71
|
+
* item gets when first imported (default `optional`: off in every org until switched on).
|
|
72
|
+
* `all` is on in every org and an org admin may switch it off. Read only at the first
|
|
73
|
+
* import: a later change here never rewrites the item (the super admin owns it then).
|
|
74
|
+
*/
|
|
75
|
+
scope?: "all" | "optional";
|
|
41
76
|
};
|
|
42
77
|
/** `bootstrap.json`. */
|
|
43
78
|
export interface BootstrapManifest {
|
|
@@ -65,3 +100,76 @@ export declare function parseBootstrapManifest(json: unknown): BootstrapManifest
|
|
|
65
100
|
};
|
|
66
101
|
/** The file name of an entry's tgz in the bootstrap directory: `<name>-<version>.tgz`. */
|
|
67
102
|
export declare function bootstrapFileName(e: BootstrapEntry): string;
|
|
103
|
+
/** Extra manifest format version. */
|
|
104
|
+
export declare const BOOTSTRAP_EXTRA_MANIFEST_SCHEMA_VERSION = 1;
|
|
105
|
+
/** A `git` entry: a plugin directory of a declared marketplace at a pinned commit. */
|
|
106
|
+
export interface BootstrapGitEntry {
|
|
107
|
+
/** Catalog item name. */
|
|
108
|
+
name: string;
|
|
109
|
+
source: "git";
|
|
110
|
+
/** A name from the manifest's `marketplaces`. */
|
|
111
|
+
marketplace: string;
|
|
112
|
+
/** 40-hex commit the tree is read at (never a branch). */
|
|
113
|
+
commit: string;
|
|
114
|
+
/** The plugin directory inside the repository: `./<path>`, or `.` / `./` for its root. */
|
|
115
|
+
path: string;
|
|
116
|
+
/** Exact semver. */
|
|
117
|
+
version: string;
|
|
118
|
+
/** `sha512-<base64>` of the kernel's canonical pack of the tree. */
|
|
119
|
+
integrity: string;
|
|
120
|
+
required?: boolean;
|
|
121
|
+
builtin?: boolean;
|
|
122
|
+
/** As on {@link BootstrapEntry}: only for an optional preinstall. */
|
|
123
|
+
scope?: "all" | "optional";
|
|
124
|
+
}
|
|
125
|
+
/** An entry of the extra manifest: npm (`required` optional) or git. */
|
|
126
|
+
export type BootstrapExtraEntry = (Omit<Extract<BootstrapEntry, {
|
|
127
|
+
source: "npm";
|
|
128
|
+
}>, "required"> & {
|
|
129
|
+
required?: boolean;
|
|
130
|
+
}) | BootstrapGitEntry;
|
|
131
|
+
/** A marketplace the extra manifest declares for its `git` entries. */
|
|
132
|
+
export interface BootstrapExtraMarketplace {
|
|
133
|
+
/** `^[a-z0-9][a-z0-9-]{0,63}$`, unique, not `official`. */
|
|
134
|
+
name: string;
|
|
135
|
+
/** An https URL without userinfo. */
|
|
136
|
+
url: string;
|
|
137
|
+
ref?: string;
|
|
138
|
+
/** HTTP basic username of the credential (`^[A-Za-z0-9._-]{1,64}$`). */
|
|
139
|
+
username?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The extra bootstrap manifest (`bootstrap-extra.v1`): a second manifest a distribution supplies (the file
|
|
143
|
+
* `bootstrap.extraManifest` points at), merged into the built-in one (spec 2026-11-20-bootstrap-extra-manifest §2). It adds
|
|
144
|
+
* `marketplaces` the entries can name, `git` entries (a plugin directory of such a marketplace at
|
|
145
|
+
* a pinned commit) and an optional `defaultTheme`. `required` is optional here (default `false`).
|
|
146
|
+
* Objects are strict. The committed JSON Schema (`schemas/bootstrap-extra.v1.schema.json`) is
|
|
147
|
+
* generated from {@link BootstrapExtraManifestSchema}; the cross-field rules (unique names, a
|
|
148
|
+
* declared marketplace, `defaultTheme` naming a builtin entry, not both `required` and `builtin`)
|
|
149
|
+
* are decided only by {@link parseBootstrapExtraManifest}.
|
|
150
|
+
*/
|
|
151
|
+
export interface BootstrapExtraManifest {
|
|
152
|
+
$schema?: string;
|
|
153
|
+
schemaVersion: 1;
|
|
154
|
+
marketplaces: BootstrapExtraMarketplace[];
|
|
155
|
+
plugins: BootstrapExtraEntry[];
|
|
156
|
+
/** The platform default theme: `plugin` is a builtin entry of this manifest. */
|
|
157
|
+
defaultTheme?: {
|
|
158
|
+
plugin: string;
|
|
159
|
+
theme: string;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The zod schema of the extra manifest (strict objects). The JSON Schema is generated with
|
|
164
|
+
* `z.toJSONSchema(BootstrapExtraManifestSchema, { io: "input" })`.
|
|
165
|
+
*/
|
|
166
|
+
export declare const BootstrapExtraManifestSchema: z.ZodType<BootstrapExtraManifest>;
|
|
167
|
+
/**
|
|
168
|
+
* Validates and parses the extra manifest. Invalid input returns `{ errors }` (`<path>: <reason>`,
|
|
169
|
+
* at most 50); never throws.
|
|
170
|
+
*/
|
|
171
|
+
export declare function parseBootstrapExtraManifest(json: unknown): {
|
|
172
|
+
manifest: BootstrapExtraManifest;
|
|
173
|
+
} | {
|
|
174
|
+
errors: string[];
|
|
175
|
+
};
|
package/dist/bootstrap.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { GIT_USERNAME_RE } from "./git-hosts.js";
|
|
3
|
+
import { CATALOG_ITEM_NAME_RE, isSafePackagePath, NPM_PACKAGE_NAME_RE, SEMVER_VERSION_RE, SHA512_INTEGRITY_RE, } from "./plugin-package.js";
|
|
3
4
|
/**
|
|
4
5
|
* The bootstrap manifest `packages/kernel/bootstrap.json` (package ecosystem spec §7): the plugins
|
|
5
6
|
* a deployment installs at init, each pinned to an exact version and the sha512 of its tgz. The
|
|
@@ -10,15 +11,31 @@ import { CATALOG_ITEM_NAME_RE, NPM_PACKAGE_NAME_RE, SEMVER_VERSION_RE, SHA512_IN
|
|
|
10
11
|
* the official plugins are published: `path` is packed with `packages/plugin-tools`, which is
|
|
11
12
|
* byte-reproducible, and `integrity` is that pack's sha512).
|
|
12
13
|
*
|
|
14
|
+
* `required` and `builtin` are two different promises. A required entry is imported in the first
|
|
15
|
+
* pass, before the extensions load, and the start fails without it (so it can ship no skills or
|
|
16
|
+
* templates: those need object storage, which is not running then). A `builtin` entry is imported
|
|
17
|
+
* once the extensions have loaded (object storage available), so it may ship skills; its failure
|
|
18
|
+
* is logged and retried on the next start. Both give the plugin a builtin catalog item (scope
|
|
19
|
+
* `all`, on in every org, not switchable) and are imported again when missing. An entry is never
|
|
20
|
+
* both.
|
|
21
|
+
*
|
|
22
|
+
* An optional preinstall (neither) may carry `scope: "all"`: its catalog item is then created with
|
|
23
|
+
* scope `all` (on in every org, an org admin may switch it off) instead of `optional` (off until
|
|
24
|
+
* switched on). The scope is read only at the first import; a later change in the manifest never
|
|
25
|
+
* rewrites the item, the super admin owns it after that. `scope` on a required or builtin entry
|
|
26
|
+
* is refused.
|
|
27
|
+
*
|
|
13
28
|
* Objects are strict (unknown keys rejected, `$schema` allowed): the manifest ships with core, so
|
|
14
29
|
* there is no older reader to stay compatible with and a misspelt key is a mistake. The committed
|
|
15
30
|
* JSON Schema (`schemas/bootstrap.v1.schema.json`) is generated from {@link BootstrapManifestSchema}
|
|
16
31
|
* by `pnpm gen:package-schemas`; the cross-field rules (unique names, `marketplace` required with an
|
|
17
|
-
* npm entry
|
|
32
|
+
* npm entry, not both `required` and `builtin`, `scope` only on an optional preinstall) are
|
|
33
|
+
* decided only by {@link parseBootstrapManifest}.
|
|
18
34
|
*/
|
|
19
35
|
/** Manifest format version. */
|
|
20
36
|
export const BOOTSTRAP_MANIFEST_SCHEMA_VERSION = 1;
|
|
21
37
|
const MAX_ERRORS = 50;
|
|
38
|
+
const SCOPE_MESSAGE = "scope applies only to optional preinstalls";
|
|
22
39
|
const URL_CHARS = 2000;
|
|
23
40
|
const COMMIT_RE = /^[0-9a-f]{40}$/;
|
|
24
41
|
const HTTPS_URL_RE = /^https:\/\/\S+$/;
|
|
@@ -35,6 +52,8 @@ const common = {
|
|
|
35
52
|
.string()
|
|
36
53
|
.regex(SHA512_INTEGRITY_RE, { message: "integrity must be sha512-<86 base64 chars>==" }),
|
|
37
54
|
required: z.boolean(),
|
|
55
|
+
builtin: z.boolean().optional(),
|
|
56
|
+
scope: z.enum(["all", "optional"]).optional(),
|
|
38
57
|
};
|
|
39
58
|
const entry = z.discriminatedUnion("source", [
|
|
40
59
|
z.strictObject({
|
|
@@ -74,6 +93,20 @@ const schema = z
|
|
|
74
93
|
});
|
|
75
94
|
}
|
|
76
95
|
seen.add(e.name);
|
|
96
|
+
if (e.required && e.builtin === true) {
|
|
97
|
+
ctx.addIssue({
|
|
98
|
+
code: "custom",
|
|
99
|
+
path: ["plugins", i, "builtin"],
|
|
100
|
+
message: "an entry is either required or builtin, not both",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (e.scope !== undefined && (e.required || e.builtin === true)) {
|
|
104
|
+
ctx.addIssue({
|
|
105
|
+
code: "custom",
|
|
106
|
+
path: ["plugins", i, "scope"],
|
|
107
|
+
message: SCOPE_MESSAGE,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
77
110
|
});
|
|
78
111
|
if (m.marketplace === undefined && m.plugins.some((e) => e.source === "npm")) {
|
|
79
112
|
ctx.addIssue({
|
|
@@ -107,3 +140,153 @@ export function parseBootstrapManifest(json) {
|
|
|
107
140
|
export function bootstrapFileName(e) {
|
|
108
141
|
return `${e.name}-${e.version}.tgz`;
|
|
109
142
|
}
|
|
143
|
+
/** Extra manifest format version. */
|
|
144
|
+
export const BOOTSTRAP_EXTRA_MANIFEST_SCHEMA_VERSION = 1;
|
|
145
|
+
const RESERVED_MARKETPLACE_NAME = "official";
|
|
146
|
+
const extraCommon = {
|
|
147
|
+
name: common.name,
|
|
148
|
+
version: common.version,
|
|
149
|
+
integrity: common.integrity,
|
|
150
|
+
required: z.boolean().optional(),
|
|
151
|
+
builtin: common.builtin,
|
|
152
|
+
scope: common.scope,
|
|
153
|
+
};
|
|
154
|
+
const extraEntry = z.discriminatedUnion("source", [
|
|
155
|
+
z.strictObject({
|
|
156
|
+
...extraCommon,
|
|
157
|
+
source: z.literal("npm"),
|
|
158
|
+
npm: z
|
|
159
|
+
.string()
|
|
160
|
+
.max(214)
|
|
161
|
+
.regex(NPM_PACKAGE_NAME_RE, { message: "npm must be an npm package name" }),
|
|
162
|
+
}),
|
|
163
|
+
z.strictObject({
|
|
164
|
+
...extraCommon,
|
|
165
|
+
source: z.literal("git"),
|
|
166
|
+
marketplace: common.name,
|
|
167
|
+
commit: z.string().regex(COMMIT_RE, { message: "commit must be 40 hex characters" }),
|
|
168
|
+
path: z
|
|
169
|
+
.string()
|
|
170
|
+
.max(512)
|
|
171
|
+
// "." / "./": the repository root (a single-plugin repository)
|
|
172
|
+
.refine((p) => p === "." || p === "./" || (p.startsWith("./") && isSafePackagePath(p.slice(2))), {
|
|
173
|
+
message: 'path must be "." (the repository root) or start with "./" and stay inside the repository',
|
|
174
|
+
}),
|
|
175
|
+
}),
|
|
176
|
+
]);
|
|
177
|
+
const extraMarketplace = z.strictObject({
|
|
178
|
+
name: common.name,
|
|
179
|
+
url: z
|
|
180
|
+
.string()
|
|
181
|
+
.max(URL_CHARS)
|
|
182
|
+
.regex(HTTPS_URL_RE, { message: "url must be an https URL" })
|
|
183
|
+
.refine((s) => {
|
|
184
|
+
try {
|
|
185
|
+
const u = new URL(s);
|
|
186
|
+
return u.username === "" && u.password === "";
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
}, { message: "url must be a valid URL without userinfo" }),
|
|
192
|
+
ref: z.string().min(1).max(256).optional(),
|
|
193
|
+
username: z
|
|
194
|
+
.string()
|
|
195
|
+
.regex(GIT_USERNAME_RE, { message: "username must match ^[A-Za-z0-9._-]{1,64}$" })
|
|
196
|
+
.optional(),
|
|
197
|
+
});
|
|
198
|
+
const extraSchema = z
|
|
199
|
+
.strictObject({
|
|
200
|
+
$schema: z.string().max(URL_CHARS).optional(),
|
|
201
|
+
schemaVersion: z.literal(BOOTSTRAP_EXTRA_MANIFEST_SCHEMA_VERSION),
|
|
202
|
+
marketplaces: z.array(extraMarketplace).max(50),
|
|
203
|
+
plugins: z.array(extraEntry).max(500),
|
|
204
|
+
defaultTheme: z
|
|
205
|
+
.strictObject({
|
|
206
|
+
plugin: common.name,
|
|
207
|
+
theme: z.string().min(1).max(256),
|
|
208
|
+
})
|
|
209
|
+
.optional(),
|
|
210
|
+
})
|
|
211
|
+
.superRefine((m, ctx) => {
|
|
212
|
+
const marketplaces = new Set();
|
|
213
|
+
m.marketplaces.forEach((mk, i) => {
|
|
214
|
+
if (mk.name === RESERVED_MARKETPLACE_NAME) {
|
|
215
|
+
ctx.addIssue({
|
|
216
|
+
code: "custom",
|
|
217
|
+
path: ["marketplaces", i, "name"],
|
|
218
|
+
message: `the name ${RESERVED_MARKETPLACE_NAME} is reserved`,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
if (marketplaces.has(mk.name)) {
|
|
222
|
+
ctx.addIssue({
|
|
223
|
+
code: "custom",
|
|
224
|
+
path: ["marketplaces", i, "name"],
|
|
225
|
+
message: `duplicate marketplace ${mk.name}`,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
marketplaces.add(mk.name);
|
|
229
|
+
});
|
|
230
|
+
const seen = new Set();
|
|
231
|
+
m.plugins.forEach((e, i) => {
|
|
232
|
+
if (seen.has(e.name)) {
|
|
233
|
+
ctx.addIssue({
|
|
234
|
+
code: "custom",
|
|
235
|
+
path: ["plugins", i, "name"],
|
|
236
|
+
message: `duplicate entry ${e.name}`,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
seen.add(e.name);
|
|
240
|
+
if (e.required === true && e.builtin === true) {
|
|
241
|
+
ctx.addIssue({
|
|
242
|
+
code: "custom",
|
|
243
|
+
path: ["plugins", i, "builtin"],
|
|
244
|
+
message: "an entry is either required or builtin, not both",
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
if (e.scope !== undefined && (e.required === true || e.builtin === true)) {
|
|
248
|
+
ctx.addIssue({
|
|
249
|
+
code: "custom",
|
|
250
|
+
path: ["plugins", i, "scope"],
|
|
251
|
+
message: SCOPE_MESSAGE,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
if (e.source === "git" && !marketplaces.has(e.marketplace)) {
|
|
255
|
+
ctx.addIssue({
|
|
256
|
+
code: "custom",
|
|
257
|
+
path: ["plugins", i, "marketplace"],
|
|
258
|
+
message: `marketplace "${e.marketplace}" is not declared`,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
if (m.defaultTheme !== undefined) {
|
|
263
|
+
const target = m.plugins.find((e) => e.name === m.defaultTheme?.plugin);
|
|
264
|
+
if (target === undefined || target.builtin !== true) {
|
|
265
|
+
ctx.addIssue({
|
|
266
|
+
code: "custom",
|
|
267
|
+
path: ["defaultTheme", "plugin"],
|
|
268
|
+
message: "must name an entry of this manifest with builtin: true",
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
/**
|
|
274
|
+
* The zod schema of the extra manifest (strict objects). The JSON Schema is generated with
|
|
275
|
+
* `z.toJSONSchema(BootstrapExtraManifestSchema, { io: "input" })`.
|
|
276
|
+
*/
|
|
277
|
+
export const BootstrapExtraManifestSchema = extraSchema;
|
|
278
|
+
/**
|
|
279
|
+
* Validates and parses the extra manifest. Invalid input returns `{ errors }` (`<path>: <reason>`,
|
|
280
|
+
* at most 50); never throws.
|
|
281
|
+
*/
|
|
282
|
+
export function parseBootstrapExtraManifest(json) {
|
|
283
|
+
const r = BootstrapExtraManifestSchema.safeParse(json);
|
|
284
|
+
if (r.success)
|
|
285
|
+
return { manifest: r.data };
|
|
286
|
+
return {
|
|
287
|
+
errors: r.error.issues.slice(0, MAX_ERRORS).map((i) => {
|
|
288
|
+
const path = i.path.map(String).join(".");
|
|
289
|
+
return path ? `${path}: ${i.message}` : i.message;
|
|
290
|
+
}),
|
|
291
|
+
};
|
|
292
|
+
}
|