@capybara-hq/plugin-sdk 0.1.0-rc.1 → 0.1.0-rc.10
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 +47 -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/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 +87 -0
- package/agent-docs/plugin-format.md +99 -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 +85 -0
- package/dist/agent-template.js +361 -2
- package/dist/cards.d.ts +7 -0
- package/dist/cards.js +4 -4
- package/dist/channel.d.ts +20 -1
- package/dist/config-ui.d.ts +131 -0
- package/dist/config-ui.js +602 -0
- package/dist/connector-auth.d.ts +2 -0
- package/dist/connector-auth.js +15 -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/device-protocol.d.ts +118 -0
- package/dist/device-protocol.js +276 -0
- package/dist/directory.d.ts +11 -2
- package/dist/extension-point.d.ts +9 -0
- package/dist/extension-point.js +17 -12
- package/dist/file-preview.d.ts +9 -1
- package/dist/hooks.d.ts +76 -16
- package/dist/index.d.ts +15 -1
- package/dist/index.js +15 -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 +20 -5
- package/dist/permissions.js +51 -15
- package/dist/plugin-manifest.d.ts +48 -5
- package/dist/plugin-manifest.js +93 -6
- package/dist/sandbox.d.ts +164 -62
- package/dist/sandbox.js +71 -14
- package/dist/secret.d.ts +4 -1
- package/dist/secret.js +5 -2
- 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 +167 -0
- package/dist/theme.d.ts +152 -0
- package/dist/theme.js +392 -0
- package/dist/tool.d.ts +11 -3
- package/dist/ui-resolve.d.ts +40 -0
- package/dist/ui-resolve.js +54 -0
- package/dist/ui-slots.d.ts +43 -0
- package/dist/ui-slots.js +168 -0
- package/dist/ui.d.ts +114 -31
- package/dist/ui.js +0 -4
- package/dist/web.d.ts +105 -0
- package/dist/web.js +135 -0
- package/package.json +10 -2
- package/schemas/connector-template.v1.schema.json +3 -0
- package/schemas/marketplace.v1.schema.json +50 -0
- package/schemas/plugin.v1.schema.json +97 -4
- package/schemas/theme.v1.schema.json +225 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { LocalizedName } from "./plugin-package.js";
|
|
3
|
+
/**
|
|
4
|
+
* Config UI hints (extension config forms spec §3): declarative presentation hints attached to an
|
|
5
|
+
* extension's config schema with {@link ui}, serialized as `x-ui` into the JSON Schema
|
|
6
|
+
* ({@link configJsonSchema}) and drawn by one generic renderer in the web app. Hints never change
|
|
7
|
+
* what validates: the zod schema stays the single source of truth for shape and validation.
|
|
8
|
+
*/
|
|
9
|
+
/** A JSON Schema object (as produced by {@link configJsonSchema}). */
|
|
10
|
+
export type JsonSchema = Record<string, unknown>;
|
|
11
|
+
/** The input widget of a field. */
|
|
12
|
+
export type ConfigWidget = "text" | "textarea" | "url" | "number" | "select" | "radio" | "switch" | "checkbox" | "tristate" | "tags" | "json";
|
|
13
|
+
/** A labelled value of an enum (or boolean) field. */
|
|
14
|
+
export interface ConfigUiOption {
|
|
15
|
+
value: string | number | boolean;
|
|
16
|
+
label: LocalizedName;
|
|
17
|
+
help?: LocalizedName;
|
|
18
|
+
}
|
|
19
|
+
/** A root-level section that fields join with `section`. */
|
|
20
|
+
export interface ConfigUiSection {
|
|
21
|
+
id: string;
|
|
22
|
+
label: LocalizedName;
|
|
23
|
+
help?: LocalizedName;
|
|
24
|
+
}
|
|
25
|
+
/** A prefilled item offered when adding an item to an array of objects. */
|
|
26
|
+
export interface ConfigUiPreset {
|
|
27
|
+
id: string;
|
|
28
|
+
label: LocalizedName;
|
|
29
|
+
help?: LocalizedName;
|
|
30
|
+
/** Prefilled item fields; never a secret. */
|
|
31
|
+
values: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
/** A secret drawn inside each item of an array, stored at a fixed record path keyed by an item field. */
|
|
34
|
+
export interface ConfigUiItemSecret {
|
|
35
|
+
/** Dot path, from the schema root, of a `secret(z.record(z.string(), z.string()))` field. */
|
|
36
|
+
path: string;
|
|
37
|
+
/** The item's string field whose value is the record key (e.g. `name`). */
|
|
38
|
+
keyBy: string;
|
|
39
|
+
label: LocalizedName;
|
|
40
|
+
help?: LocalizedName;
|
|
41
|
+
placeholder?: string | LocalizedName;
|
|
42
|
+
/** The item field the input is drawn after (default: last). */
|
|
43
|
+
after?: string;
|
|
44
|
+
}
|
|
45
|
+
/** Presentation hints of one config schema node (zod meta `ui`, JSON Schema `x-ui`). */
|
|
46
|
+
export interface ConfigUiHints {
|
|
47
|
+
label?: LocalizedName;
|
|
48
|
+
help?: LocalizedName;
|
|
49
|
+
placeholder?: string | LocalizedName;
|
|
50
|
+
/** Shown after a number input ("tokens", "ms"). */
|
|
51
|
+
unit?: LocalizedName;
|
|
52
|
+
/** Sort key among siblings (default: declaration order). */
|
|
53
|
+
order?: number;
|
|
54
|
+
/** Root-level section id (`sections` on the root). */
|
|
55
|
+
section?: string;
|
|
56
|
+
/** Collapsed under "Advanced" in its object or item. */
|
|
57
|
+
advanced?: boolean;
|
|
58
|
+
widget?: ConfigWidget;
|
|
59
|
+
options?: ConfigUiOption[];
|
|
60
|
+
/** Objects (and array items): fields stacked (default) or one compact row. */
|
|
61
|
+
layout?: "stack" | "row";
|
|
62
|
+
/** Arrays: how each item is drawn and added. */
|
|
63
|
+
item?: {
|
|
64
|
+
/** `{field}` template from the item's own scalar fields, e.g. "{name}". */
|
|
65
|
+
title?: string;
|
|
66
|
+
subtitle?: string;
|
|
67
|
+
addLabel?: LocalizedName;
|
|
68
|
+
reorder?: boolean;
|
|
69
|
+
};
|
|
70
|
+
presets?: ConfigUiPreset[];
|
|
71
|
+
secrets?: ConfigUiItemSecret[];
|
|
72
|
+
/** Root only. */
|
|
73
|
+
sections?: ConfigUiSection[];
|
|
74
|
+
/** Root only: localized messages for custom issues (`params: { ui: key }`). */
|
|
75
|
+
messages?: Record<string, LocalizedName>;
|
|
76
|
+
}
|
|
77
|
+
/** Limits of config UI hints and of the JSON Schemas a plugin package carries. */
|
|
78
|
+
export declare const CONFIG_UI_LIMITS: {
|
|
79
|
+
/** Characters per language of a `label` (also `unit`, `item.addLabel`). */
|
|
80
|
+
readonly labelChars: 100;
|
|
81
|
+
/** Characters per language of a `help` (also `messages` values). */
|
|
82
|
+
readonly helpChars: 500;
|
|
83
|
+
/** Characters (per language) of a `placeholder`. */
|
|
84
|
+
readonly placeholderChars: 200;
|
|
85
|
+
/** UTF-8 bytes of all `x-ui` JSON of one schema. */
|
|
86
|
+
readonly hintsBytes: number;
|
|
87
|
+
/** Options per node. */
|
|
88
|
+
readonly options: 200;
|
|
89
|
+
/** Presets per node. */
|
|
90
|
+
readonly presets: 20;
|
|
91
|
+
/** Root sections. */
|
|
92
|
+
readonly sections: 20;
|
|
93
|
+
/**
|
|
94
|
+
* UTF-8 bytes of each JSON Schema in `plugin.json` `extension.configSchemas` (96 KiB: two of
|
|
95
|
+
* them must fit in the 256 KiB `plugin.json` text with the rest of the manifest).
|
|
96
|
+
*/
|
|
97
|
+
readonly configSchemaBytes: number;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Attaches config UI hints to a schema (zod meta `ui`), merging with existing meta (`secret`,
|
|
101
|
+
* `hot`, `description`). Returns the same schema type. Convention: put `ui()` outermost, after
|
|
102
|
+
* `.default()` / `.optional()`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function ui<T extends z.ZodTypeAny>(schema: T, hints: ConfigUiHints): T;
|
|
105
|
+
/**
|
|
106
|
+
* An extension config schema as a JSON Schema for forms (the input side, defaults included, no
|
|
107
|
+
* `$schema`):
|
|
108
|
+
* - meta `secret: true` becomes `"x-secret": true`, `hot: true` becomes `"x-hot": true`, `org`
|
|
109
|
+
* (`orgAccess`) becomes `"x-org"`, `ui`
|
|
110
|
+
* becomes `"x-ui"` (a JSON copy of the hints); `title` / `description` are filled from
|
|
111
|
+
* `x-ui.label.en` / `x-ui.help.en` when the node has none;
|
|
112
|
+
* - unrepresentable types become `{ "x-unsupported": true }` instead of throwing;
|
|
113
|
+
* - under a secret node no value is published: `default` / `examples` / `const` / `enum` and
|
|
114
|
+
* `x-ui.options` / `x-ui.presets` are removed from it and all its descendants.
|
|
115
|
+
*/
|
|
116
|
+
export declare function configJsonSchema(schema: z.ZodTypeAny): JsonSchema;
|
|
117
|
+
/** One problem of the hints of a config schema. */
|
|
118
|
+
export interface ConfigUiProblem {
|
|
119
|
+
/**
|
|
120
|
+
* Dot path of the node holding the hint: property names, with `items` / `additionalProperties`
|
|
121
|
+
* for array items and record values (`endpoints.items.models`); `""` is the root.
|
|
122
|
+
*/
|
|
123
|
+
path: string;
|
|
124
|
+
message: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Validates the `x-ui` hints of a JSON Schema produced by {@link configJsonSchema} (spec §3.3) at
|
|
128
|
+
* a config level. Pure; used by the packer, `capybara-plugin check` and the kernel. Returns every
|
|
129
|
+
* problem (empty = valid); never throws. Problem paths are dot paths of the node holding the hint.
|
|
130
|
+
*/
|
|
131
|
+
export declare function validateConfigUi(schema: JsonSchema, level: "deployment" | "org" | "connection"): ConfigUiProblem[];
|