@capybara-hq/plugin-sdk 0.1.0-rc.1 → 0.1.0-rc.11

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.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/agent-docs/agent-templates.md +47 -0
  3. package/agent-docs/concepts.md +63 -0
  4. package/agent-docs/connector-templates.md +48 -0
  5. package/agent-docs/extension-points/channel.md +15 -0
  6. package/agent-docs/extension-points/config-source.md +15 -0
  7. package/agent-docs/extension-points/connector.md +15 -0
  8. package/agent-docs/extension-points/counter.md +15 -0
  9. package/agent-docs/extension-points/directory.md +15 -0
  10. package/agent-docs/extension-points/file-preview.md +15 -0
  11. package/agent-docs/extension-points/identity-source.md +15 -0
  12. package/agent-docs/extension-points/model-provider.md +15 -0
  13. package/agent-docs/extension-points/object-store.md +15 -0
  14. package/agent-docs/extension-points/sandbox.md +15 -0
  15. package/agent-docs/extension-points/secret-store.md +15 -0
  16. package/agent-docs/extension-points/web-fetch.md +15 -0
  17. package/agent-docs/extension-points/web-search.md +15 -0
  18. package/agent-docs/extensions.md +87 -0
  19. package/agent-docs/plugin-format.md +100 -0
  20. package/agent-docs/setup.md +46 -0
  21. package/agent-docs/skills.md +44 -0
  22. package/agent-docs/tool-naming.md +21 -0
  23. package/dist/agent-template.d.ts +85 -0
  24. package/dist/agent-template.js +361 -2
  25. package/dist/cards.d.ts +7 -0
  26. package/dist/cards.js +4 -4
  27. package/dist/channel.d.ts +20 -1
  28. package/dist/client-css.d.ts +36 -0
  29. package/dist/client-css.js +326 -0
  30. package/dist/client-section.d.ts +35 -0
  31. package/dist/client-section.js +133 -0
  32. package/dist/config-ui.d.ts +131 -0
  33. package/dist/config-ui.js +602 -0
  34. package/dist/connector-auth.d.ts +2 -0
  35. package/dist/connector-auth.js +15 -0
  36. package/dist/ctx.d.ts +86 -4
  37. package/dist/define-extension.d.ts +5 -1
  38. package/dist/define-extension.js +1 -0
  39. package/dist/device-protocol.d.ts +118 -0
  40. package/dist/device-protocol.js +276 -0
  41. package/dist/directory.d.ts +11 -2
  42. package/dist/extension-point.d.ts +9 -0
  43. package/dist/extension-point.js +17 -12
  44. package/dist/file-preview.d.ts +9 -1
  45. package/dist/hooks.d.ts +76 -16
  46. package/dist/index.d.ts +18 -1
  47. package/dist/index.js +18 -1
  48. package/dist/marketplace.d.ts +55 -2
  49. package/dist/marketplace.js +73 -3
  50. package/dist/model.d.ts +60 -2
  51. package/dist/model.js +22 -0
  52. package/dist/org-access.d.ts +27 -0
  53. package/dist/org-access.js +35 -0
  54. package/dist/permissions.d.ts +32 -7
  55. package/dist/permissions.js +86 -22
  56. package/dist/plugin-manifest.d.ts +70 -5
  57. package/dist/plugin-manifest.js +186 -6
  58. package/dist/sandbox.d.ts +164 -62
  59. package/dist/sandbox.js +71 -14
  60. package/dist/secret.d.ts +4 -1
  61. package/dist/secret.js +5 -2
  62. package/dist/setup-check.d.ts +115 -0
  63. package/dist/setup-check.js +142 -0
  64. package/dist/setup-guide-parse.d.ts +121 -0
  65. package/dist/setup-guide-parse.js +350 -0
  66. package/dist/setup-guide-render.d.ts +45 -0
  67. package/dist/setup-guide-render.js +351 -0
  68. package/dist/setup-guide.d.ts +94 -0
  69. package/dist/setup-guide.js +336 -0
  70. package/dist/skill-invocation.d.ts +9 -5
  71. package/dist/skill-invocation.js +18 -8
  72. package/dist/skill.d.ts +23 -3
  73. package/dist/skill.js +31 -6
  74. package/dist/theme-assets.d.ts +39 -0
  75. package/dist/theme-assets.js +449 -0
  76. package/dist/theme-readability.d.ts +37 -0
  77. package/dist/theme-readability.js +145 -0
  78. package/dist/theme-tokens.generated.d.ts +275 -0
  79. package/dist/theme-tokens.generated.js +167 -0
  80. package/dist/theme.d.ts +152 -0
  81. package/dist/theme.js +392 -0
  82. package/dist/tool.d.ts +11 -3
  83. package/dist/ui-parts.d.ts +23 -0
  84. package/dist/ui-parts.js +238 -0
  85. package/dist/ui-resolve.d.ts +40 -0
  86. package/dist/ui-resolve.js +54 -0
  87. package/dist/ui-slots.d.ts +55 -0
  88. package/dist/ui-slots.js +247 -0
  89. package/dist/ui.d.ts +143 -37
  90. package/dist/ui.js +65 -5
  91. package/dist/web.d.ts +105 -0
  92. package/dist/web.js +135 -0
  93. package/package.json +10 -2
  94. package/schemas/connector-template.v1.schema.json +3 -0
  95. package/schemas/marketplace.v1.schema.json +50 -0
  96. package/schemas/plugin.v1.schema.json +164 -4
  97. package/schemas/theme.v1.schema.json +225 -0
@@ -22,7 +22,10 @@ export interface ExtensionPermissions {
22
22
  * on a replica, calls on these mount points fail closed there.
23
23
  */
24
24
  policyHooks?: PolicyHook[];
25
- /** 预留:模型用途,键须为 `<插件名>.<名称>`。 */
25
+ /**
26
+ * Model purposes (`ctx.models`): each key must be `<extension name>.<name>`; an org admin maps
27
+ * each to a model of its `kind`. `ctx.models.embed` / `describe` accept the `embedding` ones.
28
+ */
26
29
  models?: {
27
30
  purpose: string;
28
31
  kind: "chat" | "embedding";
@@ -36,13 +39,27 @@ export interface ExtensionPermissions {
36
39
  /** 访问的域名,只展示不拦截。 */
37
40
  network?: string[];
38
41
  /**
39
- * 界面贡献的 id(与清单 `ui` 一一对应):`views` 记入快照但不卡加载;
40
- * `embeds` 卡加载、需批准,并标为敏感项。
42
+ * Client code: the package's `client` section (a browser bundle the web app loads for the
43
+ * extension's orgs). Sensitive and blocking; required when `ui.components` lists anything.
44
+ */
45
+ client?: boolean;
46
+ /**
47
+ * The ids of the `ui` contributions, one list per kind (each id in exactly one list): `views`
48
+ * are recorded in the snapshot without blocking the load; `embeds` and `components` block the
49
+ * load until approved and are sensitive. `components` needs `client: true`.
41
50
  */
42
51
  ui?: {
43
52
  views?: string[];
44
53
  embeds?: string[];
54
+ components?: string[];
45
55
  };
56
+ /**
57
+ * Setup check ids registered with `ctx.setup.check` (each matches `SETUP_CHECK_ID_RE`, at most
58
+ * `SETUP_CHECK_LIMITS.idsPerExtension`). Recorded in the snapshot and shown at review as
59
+ * `setupCheck:<id>`, but never blocks loading: a check receives only data the extension already
60
+ * receives for the same target.
61
+ */
62
+ setupChecks?: string[];
46
63
  }
47
64
  /** hook 挂载点(封闭列表,见总设计 2.4)。 */
48
65
  export declare const HOOK_MOUNT_POINTS: readonly ["session.start", "session.end", "agent.preStep", "model.request", "model.response", "tool.preExecute", "tool.postExecute", "usage.report"];
@@ -59,9 +76,17 @@ export declare class ExtensionPointUnavailableError extends Error {
59
76
  /** 校验权限清单,返回错误列表(空表示合法)。 */
60
77
  export declare function validatePermissions(plugin: string, p: unknown): string[];
61
78
  /**
62
- * 校验清单 `ui` 并与权限清单交叉核对,返回错误列表(空表示合法):
63
- * 每个贡献的 id 恰好出现在 `permissions.ui.views`(kind view)或 `permissions.ui.embeds`(kind embed)里,
64
- * `permissions.ui` 里也不能有清单 `ui` 没有的 id;embed 的 path 以 `/ui/` 开头并在 `permissions.http` 中声明为 GET。
65
- * 假定 `permissions` 已经过 {@link validatePermissions}。
79
+ * Checks the structure of the manifest's `ui` and cross-checks it with the permission manifest;
80
+ * returns the problems (empty = valid). Only structural problems (UI slots spec §3.2, client
81
+ * extensions spec §5.1): each contribution's id is listed in the list of its kind,
82
+ * `permissions.ui.views` (view), `permissions.ui.embeds` (embed) or `permissions.ui.components`
83
+ * (component), an id is in at most one of the three, and `permissions.ui` lists no id the `ui`
84
+ * lacks; `permissions.ui.components` needs `permissions.client: true`; an embed's path starts with
85
+ * `/ui/` and is declared in `permissions.http` as GET, a view or component has no path; exactly one
86
+ * of `slot` (a well-formed slot reference) and `place` (a known place); for a slot the catalog
87
+ * knows at the version named, a kind it accepts and, unless an alias, the icon it requires. An
88
+ * unknown slot id or version is not a problem here: `resolveUiSlots` drops that contribution and
89
+ * the rest of the extension loads.
90
+ * Assumes `permissions` passed {@link validatePermissions}.
66
91
  */
67
92
  export declare function validateUiContributions(ui: unknown, permissions: unknown): string[];
@@ -1,5 +1,7 @@
1
1
  import { POLICY_HOOKS } from "./hooks.js";
2
+ import { SETUP_CHECK_ID_RE, SETUP_CHECK_LIMITS } from "./setup-check.js";
2
3
  import { UI_ICONS } from "./ui.js";
4
+ import { PLACE_SLOTS, parseSlotRef, uiSlot } from "./ui-slots.js";
3
5
  /** hook 挂载点(封闭列表,见总设计 2.4)。 */
4
6
  export const HOOK_MOUNT_POINTS = [
5
7
  "session.start",
@@ -36,6 +38,8 @@ const KEYS = new Set([
36
38
  "storage",
37
39
  "network",
38
40
  "ui",
41
+ "client",
42
+ "setupChecks",
39
43
  ]);
40
44
  const POLICY = new Set(POLICY_HOOKS);
41
45
  const METHODS = new Set(["GET", "POST", "PUT", "DELETE"]);
@@ -68,7 +72,7 @@ export function validatePermissions(plugin, p) {
68
72
  if (!KEYS.has(k))
69
73
  errs.push(`unknown permissions key "${k}"`);
70
74
  }
71
- for (const k of ["secrets", "storage"]) {
75
+ for (const k of ["secrets", "storage", "client"]) {
72
76
  if (p[k] !== undefined && typeof p[k] !== "boolean") {
73
77
  errs.push(`permissions.${k} must be a boolean`);
74
78
  }
@@ -126,9 +130,11 @@ export function validatePermissions(plugin, p) {
126
130
  errs.push("permissions.ui must be an object");
127
131
  else {
128
132
  for (const k of Object.keys(p.ui)) {
129
- if (k !== "views" && k !== "embeds")
133
+ if (k !== "views" && k !== "embeds" && k !== "components")
130
134
  errs.push(`unknown permissions.ui key "${k}"`);
131
135
  }
136
+ if (p.ui.components !== undefined)
137
+ strList("permissions.ui.components", p.ui.components, errs);
132
138
  const views = p.ui.views === undefined ? [] : strList("permissions.ui.views", p.ui.views, errs);
133
139
  const embeds = p.ui.embeds === undefined ? [] : strList("permissions.ui.embeds", p.ui.embeds, errs);
134
140
  for (const id of views) {
@@ -137,6 +143,17 @@ export function validatePermissions(plugin, p) {
137
143
  }
138
144
  }
139
145
  }
146
+ if (p.setupChecks !== undefined) {
147
+ const ids = strList("permissions.setupChecks", p.setupChecks, errs);
148
+ for (const id of ids) {
149
+ if (!SETUP_CHECK_ID_RE.test(id)) {
150
+ errs.push(`permissions.setupChecks id "${id}" must match ${SETUP_CHECK_ID_RE}`);
151
+ }
152
+ }
153
+ if (ids.length > SETUP_CHECK_LIMITS.idsPerExtension) {
154
+ errs.push(`permissions.setupChecks has more than ${SETUP_CHECK_LIMITS.idsPerExtension} ids`);
155
+ }
156
+ }
140
157
  if (p.models !== undefined) {
141
158
  if (!Array.isArray(p.models))
142
159
  errs.push("permissions.models must be an array");
@@ -168,20 +185,21 @@ export function validatePermissions(plugin, p) {
168
185
  }
169
186
  const UI_ID_RE = /^[a-z][a-z0-9-]{0,39}$/;
170
187
  const UI_TITLE_MAX = 100;
171
- const UI_PLACES = [
172
- "conversation",
173
- "panel",
174
- "section",
175
- "inline",
176
- "page",
177
- "file-preview",
178
- ];
188
+ const UI_PLACES = Object.keys(PLACE_SLOTS);
179
189
  const UI_EMBED_PREFIX = "/ui/";
180
190
  /**
181
- * 校验清单 `ui` 并与权限清单交叉核对,返回错误列表(空表示合法):
182
- * 每个贡献的 id 恰好出现在 `permissions.ui.views`(kind view)或 `permissions.ui.embeds`(kind embed)里,
183
- * `permissions.ui` 里也不能有清单 `ui` 没有的 id;embed 的 path 以 `/ui/` 开头并在 `permissions.http` 中声明为 GET。
184
- * 假定 `permissions` 已经过 {@link validatePermissions}。
191
+ * Checks the structure of the manifest's `ui` and cross-checks it with the permission manifest;
192
+ * returns the problems (empty = valid). Only structural problems (UI slots spec §3.2, client
193
+ * extensions spec §5.1): each contribution's id is listed in the list of its kind,
194
+ * `permissions.ui.views` (view), `permissions.ui.embeds` (embed) or `permissions.ui.components`
195
+ * (component), an id is in at most one of the three, and `permissions.ui` lists no id the `ui`
196
+ * lacks; `permissions.ui.components` needs `permissions.client: true`; an embed's path starts with
197
+ * `/ui/` and is declared in `permissions.http` as GET, a view or component has no path; exactly one
198
+ * of `slot` (a well-formed slot reference) and `place` (a known place); for a slot the catalog
199
+ * knows at the version named, a kind it accepts and, unless an alias, the icon it requires. An
200
+ * unknown slot id or version is not a problem here: `resolveUiSlots` drops that contribution and
201
+ * the rest of the extension loads.
202
+ * Assumes `permissions` passed {@link validatePermissions}.
185
203
  */
186
204
  export function validateUiContributions(ui, permissions) {
187
205
  const perms = isObj(permissions) ? permissions : {};
@@ -191,10 +209,21 @@ export function validateUiContributions(ui, permissions) {
191
209
  : [];
192
210
  const views = listed("views");
193
211
  const embeds = listed("embeds");
212
+ const components = listed("components");
213
+ // an id in more than one list is reported once, not again as a mismatch of each list
214
+ const multiListed = new Set();
215
+ for (const id of new Set([...views, ...embeds, ...components])) {
216
+ if ([views, embeds, components].filter((l) => l.includes(id)).length > 1)
217
+ multiListed.add(id);
218
+ }
194
219
  const gets = new Set((Array.isArray(perms.http) ? perms.http : [])
195
220
  .filter((r) => isObj(r) && r.method === "GET")
196
221
  .map((r) => r.path));
197
222
  const errs = [];
223
+ for (const id of multiListed)
224
+ errs.push(`ui "${id}" is listed in more than one of permissions.ui.views / embeds / components`);
225
+ if (components.length > 0 && perms.client !== true)
226
+ errs.push("permissions.ui.components needs permissions.client: true");
198
227
  const contributions = [];
199
228
  if (ui !== undefined) {
200
229
  if (!Array.isArray(ui))
@@ -219,29 +248,60 @@ export function validateUiContributions(ui, permissions) {
219
248
  if (!title ||
220
249
  [title.zh, title.en].some((t) => typeof t !== "string" || t === "" || t.length > UI_TITLE_MAX))
221
250
  errs.push(`ui "${id}" title needs non-empty zh and en of at most ${UI_TITLE_MAX} characters`);
222
- if (!UI_PLACES.includes(c.place))
251
+ // the slot it names, when the slot / place is well formed (known to the catalog or not)
252
+ let slotRef = null;
253
+ if ((c.slot === undefined) === (c.place === undefined)) {
254
+ errs.push(`ui "${id}" needs exactly one of slot and place`);
255
+ }
256
+ else if (c.slot !== undefined) {
257
+ slotRef = typeof c.slot === "string" ? parseSlotRef(c.slot) : null;
258
+ if (slotRef === null)
259
+ errs.push(`ui "${id}" slot must be a slot reference like "org.page" or "org.page@1"`);
260
+ }
261
+ else if (!UI_PLACES.includes(c.place)) {
223
262
  errs.push(`ui "${id}" place must be one of ${UI_PLACES.join(", ")}`);
224
- if (c.kind !== "view" && c.kind !== "embed") {
225
- errs.push(`ui "${id}" kind must be view or embed`);
263
+ }
264
+ else {
265
+ slotRef = { id: PLACE_SLOTS[c.place], version: 1 };
266
+ }
267
+ if (c.after !== undefined && typeof c.after !== "string")
268
+ errs.push(`ui "${id}" after must be a string`);
269
+ if (c.kind !== "view" && c.kind !== "embed" && c.kind !== "component") {
270
+ errs.push(`ui "${id}" kind must be view, embed or component`);
226
271
  return;
227
272
  }
228
273
  if (c.icon !== undefined && !UI_ICONS.includes(c.icon))
229
274
  errs.push(`ui "${id}" icon must be one of ${UI_ICONS.join(", ")}`);
275
+ // the slot checks describe only the catalog's version: another version is left to
276
+ // resolveUiSlots, which drops it (unsupported-version) without failing the extension
277
+ const known = slotRef === null ? undefined : uiSlot(slotRef.id);
278
+ const spec = known !== undefined && known.version === slotRef?.version ? known : undefined;
279
+ if (spec !== undefined) {
280
+ if (!spec.accepts.includes(c.kind))
281
+ errs.push(`ui "${id}" slot ${spec.id} does not accept kind ${c.kind}`);
282
+ if (spec.icon === "required" && c.icon === undefined && c.aliasOf === undefined)
283
+ errs.push(`ui "${id}" slot ${spec.id} needs an icon`);
284
+ }
230
285
  if (c.aliasOf !== undefined)
231
286
  aliases.push({ id, kind: c.kind, target: c.aliasOf });
232
287
  if (seen.has(id))
233
288
  errs.push(`ui has duplicate id "${id}"`);
234
289
  seen.set(id, c.kind);
235
290
  if (c.kind === "view") {
236
- if (c.place === "file-preview")
237
- errs.push(`ui "${id}" place file-preview is only allowed for kind embed`);
238
291
  if (c.path !== undefined)
239
292
  errs.push(`ui "${id}" path is only allowed for kind embed`);
240
- if (!views.includes(id))
293
+ if (!views.includes(id) && !multiListed.has(id))
241
294
  errs.push(`ui "${id}" (view) must be listed in permissions.ui.views`);
242
295
  return;
243
296
  }
244
- if (!embeds.includes(id))
297
+ if (c.kind === "component") {
298
+ if (c.path !== undefined)
299
+ errs.push(`ui "${id}" is a component and cannot have a path`);
300
+ if (!components.includes(id) && !multiListed.has(id))
301
+ errs.push(`ui "${id}" is a component; list it in permissions.ui.components`);
302
+ return;
303
+ }
304
+ if (!embeds.includes(id) && !multiListed.has(id))
245
305
  errs.push(`ui "${id}" (embed) must be listed in permissions.ui.embeds`);
246
306
  if (typeof c.path !== "string" || !c.path.startsWith(UI_EMBED_PREFIX)) {
247
307
  errs.push(`ui "${id}" (embed) path must start with "${UI_EMBED_PREFIX}"`);
@@ -263,9 +323,13 @@ export function validateUiContributions(ui, permissions) {
263
323
  ["embeds", "embed", embeds],
264
324
  ]) {
265
325
  for (const id of ids) {
266
- if (seen.get(id) !== kind)
326
+ if (seen.get(id) !== kind && !multiListed.has(id))
267
327
  errs.push(`permissions.ui.${k} entry "${id}" has no matching ${kind} contribution in ui`);
268
328
  }
269
329
  }
330
+ for (const id of components) {
331
+ if (seen.get(id) !== "component" && !multiListed.has(id))
332
+ errs.push(`permissions.ui.components lists "${id}", which is not a component contribution`);
333
+ }
270
334
  return errs;
271
335
  }
@@ -1,8 +1,13 @@
1
1
  import { z } from "zod";
2
+ import { type PluginClientSection } from "./client-section.js";
3
+ import { type JsonSchema } from "./config-ui.js";
2
4
  import { type ConnectorTemplateSpec, type LocalizedName, type StaticExtensionManifest } from "./plugin-package.js";
5
+ import { type PluginSetupGuide } from "./setup-guide.js";
6
+ import { type PluginThemeRef } from "./theme.js";
3
7
  /**
4
8
  * The plugin manifest `.capybara-plugin/plugin.json` (package ecosystem spec §4.1). A plugin is a
5
- * bundle of at most one extension, skills and connector templates, packed as an npm-pack tgz:
9
+ * bundle of at most one extension, skills, connector templates, agent templates and themes, packed as
10
+ * an npm-pack tgz:
6
11
  *
7
12
  * ```
8
13
  * package/package.json npm metadata; version equals plugin.json version
@@ -10,13 +15,14 @@ import { type ConnectorTemplateSpec, type LocalizedName, type StaticExtensionMan
10
15
  * package/skills/<name>/SKILL.md skills
11
16
  * package/connectors/<id>.json connector templates ({@link ConnectorTemplateFile})
12
17
  * package/agents/<name>.md agent templates (parsed by `parseAgentTemplate`)
18
+ * package/themes/<id>.json themes (parsed by `parseThemeFile`)
13
19
  * package/dist/index.mjs extension entry (only with an extension)
14
20
  * package/migrations/*.sql, package/ui/**
15
21
  * ```
16
22
  *
17
23
  * Paths start with `./` and stay inside the plugin root. Omitting `skills` / `connectorTemplates`
18
- * / `agents` means "scan `skills/*\/SKILL.md` / `connectors/*.json` / `agents/*.md`" (done by the
19
- * kernel when it reads the package). `extension` is written by the packer, never by hand.
24
+ * / `agents` / `themes` means "scan `skills/*\/SKILL.md` / `connectors/*.json` / `agents/*.md` /
25
+ * `themes/*.json`" (done by the kernel when it reads the package). `extension` is written by the packer, never by hand.
20
26
  *
21
27
  * The committed JSON Schema (`schemas/plugin.v1.schema.json`) is generated from
22
28
  * {@link PluginManifestSchema} by `pnpm gen:package-schemas` and drift-checked by
@@ -38,10 +44,14 @@ export declare const PLUGIN_MANIFEST_LIMITS: {
38
44
  readonly connectorTemplates: 20;
39
45
  /** Agent templates ({@link AGENT_TEMPLATE_LIMITS}`.perPlugin`). */
40
46
  readonly agents: 64;
47
+ /** Themes ({@link THEME_LIMITS}`.perPlugin`). */
48
+ readonly themes: 10;
41
49
  readonly descriptionChars: 1024;
42
50
  readonly publisherChars: 100;
43
51
  readonly displayNameChars: 100;
44
52
  readonly pathChars: 512;
53
+ /** Entries of `suggestedAppearance.replacements`. */
54
+ readonly appearanceReplacements: 8;
45
55
  };
46
56
  /** A plugin this one depends on: a plugin name and a semver range. */
47
57
  export interface PluginDependency {
@@ -74,7 +84,41 @@ export interface PluginExtensionSection {
74
84
  migrations?: string;
75
85
  /** `./ui`. */
76
86
  ui?: string;
87
+ /**
88
+ * The config JSON Schemas (`configJsonSchema`, with `x-ui` hints), written by the packer so an
89
+ * extension not loaded on a replica still gets its form; each ≤
90
+ * {@link CONFIG_UI_LIMITS}`.configSchemaBytes`. Not part of the `manifest_mismatch` comparison.
91
+ */
92
+ configSchemas?: {
93
+ deployment?: JsonSchema;
94
+ org?: JsonSchema;
95
+ };
96
+ /** Browser code, styles and assets (needs `permissions.client: true`); see {@link PluginClientSection}. */
97
+ client?: PluginClientSection;
77
98
  }
99
+ /**
100
+ * How the plugin suggests it should look when chosen (client extensions spec §6.5). Nothing applies
101
+ * on install; an admin applies it in one confirmed step.
102
+ */
103
+ export interface SuggestedAppearance {
104
+ /** A theme id (file base name) of this plugin. */
105
+ theme?: string;
106
+ /** Replaceable slot id → a `component` contribution id of this plugin's extension in that slot. */
107
+ replacements?: Record<string, string>;
108
+ }
109
+ /**
110
+ * A plugin's description: a string (English) or `{ en, zh? }`, each ≤ 1024 characters. Read it
111
+ * through {@link pluginDescription}.
112
+ */
113
+ export type PluginDescription = string | {
114
+ en: string;
115
+ zh?: string;
116
+ };
117
+ /** A plugin description as `{ en, zh? }` (a plain string is the English text). */
118
+ export declare function pluginDescription(d: PluginDescription): {
119
+ en: string;
120
+ zh?: string;
121
+ };
78
122
  /** `.capybara-plugin/plugin.json`. */
79
123
  export interface PluginManifest {
80
124
  $schema?: string;
@@ -84,8 +128,8 @@ export interface PluginManifest {
84
128
  /** Exact semver version. */
85
129
  version: string;
86
130
  publisher: string;
87
- /** ≤ 1024 characters. */
88
- description: string;
131
+ /** A string (English) or `{ en, zh? }`, each ≤ 1024 characters; see {@link pluginDescription}. */
132
+ description: PluginDescription;
89
133
  displayName?: LocalizedName;
90
134
  /** `./…` .svg / .png inside the plugin. */
91
135
  icon?: string;
@@ -100,6 +144,16 @@ export interface PluginManifest {
100
144
  connectorTemplates?: PluginConnectorTemplateRef[];
101
145
  /** Agent templates; omitted = scan `agents/*.md`. */
102
146
  agents?: PluginAgentRef[];
147
+ /** Themes; omitted = scan `themes/*.json`. */
148
+ themes?: PluginThemeRef[];
149
+ /**
150
+ * Setup guides (spec `2026-11-09-setup-guides-v2-design.md`): Markdown documents at
151
+ * `guides/<id>.md` (+ `guides/<id>.zh.md`) the kernel renders for a place; see
152
+ * {@link PluginSetupGuide}.
153
+ */
154
+ setupGuides?: PluginSetupGuide[];
155
+ /** See {@link SuggestedAppearance}. */
156
+ suggestedAppearance?: SuggestedAppearance;
103
157
  extension?: PluginExtensionSection;
104
158
  }
105
159
  /** A connector template file `connectors/<id>.json`; the template id is the file's base name. */
@@ -108,6 +162,12 @@ export interface ConnectorTemplateFile {
108
162
  description?: string;
109
163
  /** Safe path relative to the plugin root (an optional leading `./`), .svg / .png. */
110
164
  icon?: string;
165
+ /**
166
+ * `false`: the template starts switched off in every org, even where its plugin is on, until an
167
+ * org admin switches it on (it then needs no org input while off). Default `true`: on wherever
168
+ * its plugin is. Ignored for a builtin plugin.
169
+ */
170
+ defaultEnabled?: boolean;
111
171
  /** Validated by {@link validateConnectorTemplate}. */
112
172
  template: ConnectorTemplateSpec;
113
173
  }
@@ -139,3 +199,8 @@ export declare function parsePluginManifest(json: unknown): PluginManifest | {
139
199
  export declare function parseConnectorTemplateFile(json: unknown): ConnectorTemplateFile | {
140
200
  errors: string[];
141
201
  };
202
+ /**
203
+ * The theme check of `suggestedAppearance` after the themes are known (the manifest may omit
204
+ * `themes` and let the scan find them): shared by the packer and the kernel.
205
+ */
206
+ export declare function appearanceIssues(manifest: PluginManifest, themeIds: readonly string[]): string[];