@capybara-hq/plugin-sdk 0.1.0-rc.5 → 0.1.0-rc.50
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 +14 -2
- package/agent-docs/concepts.md +14 -5
- package/agent-docs/connector-templates.md +4 -1
- package/agent-docs/extension-points/channel.md +1 -1
- package/agent-docs/extension-points/context.md +15 -0
- package/agent-docs/extension-points/file-preview.md +2 -0
- package/agent-docs/extension-points/model-provider.md +3 -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/sandbox.md +2 -2
- package/agent-docs/extensions.md +29 -3
- package/agent-docs/plugin-format.md +48 -2
- package/agent-docs/setup.md +54 -0
- package/dist/agent-template.d.ts +15 -6
- package/dist/agent-template.js +32 -13
- package/dist/avatar-presets.d.ts +8 -0
- package/dist/avatar-presets.js +17 -0
- package/dist/bootstrap.d.ts +86 -1
- package/dist/bootstrap.js +161 -2
- package/dist/cards.d.ts +67 -13
- package/dist/cards.js +91 -21
- package/dist/channel.d.ts +148 -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 +120 -29
- package/dist/define-extension.d.ts +26 -12
- package/dist/define-extension.js +11 -4
- package/dist/device-denied-paths.d.ts +14 -0
- package/dist/device-denied-paths.js +41 -0
- package/dist/device-protocol.d.ts +489 -0
- package/dist/device-protocol.js +1116 -0
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +6 -2
- package/dist/file-preview.d.ts +23 -6
- package/dist/git-hosts.d.ts +53 -0
- package/dist/git-hosts.js +98 -0
- package/dist/hooks.d.ts +125 -20
- package/dist/hooks.js +5 -0
- package/dist/http-access.d.ts +62 -0
- package/dist/http-access.js +12 -0
- package/dist/identity.d.ts +38 -9
- package/dist/identity.js +21 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +28 -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 +206 -71
- package/dist/model.js +152 -19
- 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 +41 -21
- package/dist/permissions.js +101 -42
- 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/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 +2318 -0
- package/dist/sandbox-native-runtime-source.d.ts +10 -0
- package/dist/sandbox-native-runtime-source.js +476 -0
- package/dist/sandbox-operation.d.ts +298 -0
- package/dist/sandbox-operation.js +282 -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 +139 -0
- package/dist/sandbox-write-denies.js +869 -0
- package/dist/sandbox.d.ts +190 -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 +128 -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 +96 -0
- package/dist/setup-guide.js +348 -0
- package/dist/shell-capabilities.d.ts +231 -0
- package/dist/shell-capabilities.js +37 -0
- package/dist/shell-environment.d.ts +57 -0
- package/dist/shell-environment.js +22 -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 +55 -0
- package/dist/theme-assets.js +507 -0
- package/dist/theme-readability.d.ts +37 -0
- package/dist/theme-readability.js +145 -0
- package/dist/theme-tokens.generated.d.ts +299 -0
- package/dist/theme-tokens.generated.js +184 -0
- package/dist/theme.d.ts +190 -0
- package/dist/theme.js +471 -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 +348 -0
- package/dist/ui-resolve.d.ts +35 -0
- package/dist/ui-resolve.js +42 -0
- package/dist/ui-slots.d.ts +65 -0
- package/dist/ui-slots.js +261 -0
- package/dist/ui.d.ts +212 -76
- package/dist/ui.js +101 -27
- package/dist/url.d.ts +4 -1
- package/dist/url.js +4 -1
- package/package.json +8 -1
- package/schemas/bootstrap-extra.v1.schema.json +172 -0
- 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 +116 -3
- package/schemas/theme.v1.schema.json +302 -0
|
@@ -30,8 +30,8 @@ You are a careful researcher. ...
|
|
|
30
30
|
| `model` | `inherit` \| `fast` \| `standard` \| `capable` | no | A purpose tier, never a model id; default `inherit`. |
|
|
31
31
|
| `effort` | `low` \| `medium` \| `high` \| `xhigh` \| `max` | no | Reasoning effort. |
|
|
32
32
|
| `maxSteps` | integer | no | Step limit; the kernel caps it. |
|
|
33
|
-
| `skills` | array of skill names | no | At most 3
|
|
34
|
-
| `
|
|
33
|
+
| `skills` | array of skill names | no | At most 3; the sub-agent is told to load them with `Skill` before it starts. |
|
|
34
|
+
| `disallowedSkills` | array of skill references | no | 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). |
|
|
35
35
|
| `connectors` | array of objects | no | At most 16: `{ template, tools?, policies? }` for a connector template (`<id>` or `<plugin>:<id>`), or `{ needs: { protocol, endpoint, tools, label }, policies? }` for a described need. |
|
|
36
36
|
| `subagents` | object | no | `{ general?, types?, inline? }`: the sub-agents in its roster (at most 16 types plus inline). |
|
|
37
37
|
| `modelRef` | string | no | `provider/model`; set on org templates saved from an agent. |
|
|
@@ -41,6 +41,18 @@ You are a careful researcher. ...
|
|
|
41
41
|
|
|
42
42
|
Unknown keys are ignored. The body is at most 100,000 characters.
|
|
43
43
|
|
|
44
|
+
## Skills
|
|
45
|
+
|
|
46
|
+
An agent has every skill that is on in its org; nothing is pinned into its context. A template
|
|
47
|
+
only turns skills off, with `disallowedSkills`: `<plugin>:<name>` for one skill of a plugin,
|
|
48
|
+
`<plugin>:*` for the whole plugin (skills it gains later included) or a bare `<name>` for an org
|
|
49
|
+
skill without a plugin. Saving an agent as an org template writes its off-list here.
|
|
50
|
+
|
|
51
|
+
`skills` keeps Claude Code's meaning for sub-agent use: when the template runs as a sub-agent, the
|
|
52
|
+
child is told to load these skills with `Skill` before it starts. When a member creates an agent
|
|
53
|
+
from the template, each name in `skills` (and in its sub-agents' `skills`) is reported as carried
|
|
54
|
+
or as unavailable in the org; it narrows nothing.
|
|
55
|
+
|
|
44
56
|
## Creating an agent from a template
|
|
45
57
|
|
|
46
58
|
A connector the org does not have becomes a pending entry, and a setup request goes to the org
|
package/agent-docs/concepts.md
CHANGED
|
@@ -5,6 +5,7 @@ Read this first. It explains the vocabulary the other topics use.
|
|
|
5
5
|
The other topics are for *authoring*: writing an extension, building a plugin, skills, templates,
|
|
6
6
|
connector templates, tool naming and extension points. To *use* the platform (install, switch on,
|
|
7
7
|
configure, manage), use the operations: `browse`, `search`, `describe` and `call`.
|
|
8
|
+
To help a person through a plugin's setup guide, read `setup` first.
|
|
8
9
|
|
|
9
10
|
## Platform and org
|
|
10
11
|
|
|
@@ -51,12 +52,20 @@ When a person cannot do something themselves (install a plugin that is not on in
|
|
|
51
52
|
approve extension permissions), they file a **request**. Org admins or the super admin decide it
|
|
52
53
|
on the web. Agents can file requests but never decide them.
|
|
53
54
|
|
|
54
|
-
##
|
|
55
|
+
## Devices
|
|
55
56
|
|
|
56
|
-
Agents run commands and keep files
|
|
57
|
-
|
|
57
|
+
Agents run commands and keep files on a **device**: one instance plus a file system that is kept
|
|
58
|
+
until the device is deleted. A device is a cloud sandbox (from the deployment's sandbox provider)
|
|
59
|
+
or a machine connected with `capybara-device`, and the conversations that use it share its files.
|
|
60
|
+
A device runs in one of two modes: auto (the environment's own capability) or sandbox (an OS
|
|
61
|
+
sandbox with an allowlist network). Skill files are read-only in the device's skills directory;
|
|
62
|
+
each conversation is told the device's directories, mode and network. Sandbox limits and the
|
|
63
|
+
cloud network are set per org by admins.
|
|
58
64
|
|
|
59
65
|
## What agents may not do
|
|
60
66
|
|
|
61
|
-
Deciding approvals and requests, confirming extension permissions, managing tokens
|
|
62
|
-
|
|
67
|
+
Deciding approvals and requests, confirming extension permissions, managing tokens, changing
|
|
68
|
+
roles. A secret an operation writes (an extension's API key in its config, say) is never a param:
|
|
69
|
+
list its field in `askPerson` and the person types it on the confirmation card on the web. Never ask
|
|
70
|
+
for a secret in the conversation; a secret that appeared there counts as leaked, so tell the person
|
|
71
|
+
to rotate it. Operations whose secrets the card cannot take refuse and point to the web page.
|
|
@@ -30,6 +30,7 @@ The file is strict. Top-level fields:
|
|
|
30
30
|
| `displayName` | object | yes |
|
|
31
31
|
| `description` | string | no |
|
|
32
32
|
| `icon` | string | no |
|
|
33
|
+
| `defaultEnabled` | boolean | no |
|
|
33
34
|
| `template` | object | yes |
|
|
34
35
|
<!-- /generated -->
|
|
35
36
|
|
|
@@ -44,4 +45,6 @@ Fields of `template`:
|
|
|
44
45
|
`oauth_code` or `oauth_client`, plus `ownership` (`org` or per member).
|
|
45
46
|
- `defaultToolPolicies`: tool name to `allow`, `ask` or `deny`. When unsure, do not write `allow`.
|
|
46
47
|
|
|
47
|
-
Credentials and secret config are entered by
|
|
48
|
+
Credentials and secret config are entered by the person on the `Platform` confirmation card (name
|
|
49
|
+
their paths in `askPerson`), never typed by an agent; only what the card cannot take (secret
|
|
50
|
+
records, custom header credentials) is entered on the web page.
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
Contract: Channel (`channel.ts`)
|
|
12
12
|
|
|
13
|
-
Normalize inbound events (messageId, threadId, tenantId, the bot mention stripped) and acknowledge only after the kernel's `onEvent` resolves. Long connections are held only by the gateway role. Replies use the card spec (`validateChannelCard`).
|
|
13
|
+
Normalize inbound events (messageId, threadId, tenantId, the bot mention stripped) and acknowledge only after the kernel's `onEvent` resolves. Long connections are held only by the gateway role. Replies use the card spec (`validateChannelCard`). Files: implement the optional `sendFile` and declare `features.files` (the platform's bot limits); the kernel sends each conversation artifact as one message and falls back to a link line without it.
|
|
14
14
|
|
|
15
15
|
See `extensions` for the rules every extension follows.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Authoring: extension point context
|
|
2
|
+
|
|
3
|
+
<!-- generated:extension-point -->
|
|
4
|
+
- Name: `context` (a ref is `context@<major>`)
|
|
5
|
+
- Adds text to the model's context at run start in conversations of orgs that enable it.
|
|
6
|
+
- Providers: several
|
|
7
|
+
- Enabled per org: yes
|
|
8
|
+
- Brokered by the platform: yes (extensions use it only through `ctx`)
|
|
9
|
+
<!-- /generated -->
|
|
10
|
+
|
|
11
|
+
Contract: ContextProvider (`context.ts`)
|
|
12
|
+
|
|
13
|
+
Return the text the model should see at the start of a run, or null. The kernel calls every provider enabled in the org once per run, only in `chat` conversations (not evals or sub-agents), with the run's source, the trigger account and its org role, the conversation owner and the tool keys. A call is limited to 2 seconds and 32 KB of text and fails open: a timeout or error adds nothing and the run goes on. The text is recorded in the conversation log only when its hash changes.
|
|
14
|
+
|
|
15
|
+
See `extensions` for the rules every extension follows.
|
|
@@ -12,4 +12,6 @@ Contract: FilePreviewProvider (`file-preview.ts`)
|
|
|
12
12
|
|
|
13
13
|
Declare which file types you can preview and render them through schema views or an approved embed. Enabled per org.
|
|
14
14
|
|
|
15
|
+
`render` args are a union on `source`: `"conversation"` (org, account, conversation) or `"share"` (org and share id; `file.id` is the share id; no account or conversation). A previewer that needs the conversation declines `source: "share"` by throwing; the kernel reports the failure and the share page falls to the next previewer. A share token is valid only for the `file.preview` slot, never for `/api`.
|
|
16
|
+
|
|
15
17
|
See `extensions` for the rules every extension follows.
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
- Brokered by the platform: yes (extensions use it only through `ctx`)
|
|
9
9
|
<!-- /generated -->
|
|
10
10
|
|
|
11
|
-
Contract: ModelProvider (`model.ts`);
|
|
11
|
+
Contract: ModelProvider (`model.ts`); ref `model-provider@2`
|
|
12
12
|
|
|
13
13
|
Map the kernel's messages and tools to the vendor API and stream the result. Do not retry inside the extension; return a `ModelError` with the right kind and let the kernel degrade. History sent to the model is append-only. Declare parameters and media support.
|
|
14
14
|
|
|
15
|
+
Messages may carry an `image` or a `document` block, gated by `capabilities.vision` and `capabilities.documents`; the kernel replaces a block the model cannot take with an English placeholder and never sends the bytes. A `file` block is an attachment the model can only reference (an xlsx, say): the kernel resolves it to text before the request, so a provider never receives one. Resolve any block you do not recognize by skipping it. The `size` on an attachment block is display metadata (the UI chip, the reference line) and is never sent to a provider.
|
|
16
|
+
|
|
15
17
|
See `extensions` for the rules every extension follows.
|
|
@@ -12,4 +12,6 @@ Contract: ObjectStore (`storage.ts`)
|
|
|
12
12
|
|
|
13
13
|
Return `null` for a missing key, reject keys containing `${`, and enforce the size of presigned uploads in the store itself. The kernel adds key prefixes; extensions consume it as `ctx.storage`.
|
|
14
14
|
|
|
15
|
+
Optionally implement `uri(key)`: the store's canonical identifier for a key, such as `s3://bucket/key`. It is unsigned, stable and carries no credentials, and is never a presigned URL — the kernel may record it in an event log and show it to a model. A store with no notion of URIs simply leaves it out.
|
|
16
|
+
|
|
15
17
|
See `extensions` for the rules every extension follows.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Authoring: extension point push-provider
|
|
2
|
+
|
|
3
|
+
<!-- generated:extension-point -->
|
|
4
|
+
- Name: `push-provider` (a ref is `push-provider@<major>`)
|
|
5
|
+
- Delivers push notifications to people's mobile apps through one channel (APNs, FCM, an aggregator).
|
|
6
|
+
- Providers: several
|
|
7
|
+
- Enabled per org: no
|
|
8
|
+
- Brokered by the platform: yes (extensions use it only through `ctx`)
|
|
9
|
+
<!-- /generated -->
|
|
10
|
+
|
|
11
|
+
Contract: PushProvider (`push.ts`)
|
|
12
|
+
|
|
13
|
+
`send` answers one `PushResult` per registration (`checkPushResults`); a thrown `PushError` applies to every registration of the call. No retries inside: the kernel's queue retries `transient` and `rate_limited`, deletes an `unregistered` registration and tells the platform about `auth`. `apps()` is synchronous and derived from deployment config.
|
|
14
|
+
|
|
15
|
+
Map the channel-neutral `PushMessage` to the channel's payload: `title` and `body` as the alert, `path` and `origin` as data for the app, `threadId` as the grouping key (APNs `thread-id`), and `collapseId` as the channel's collapse key (APNs `apns-collapse-id`, FCM `collapse_key`): it is the same for every send of one event to one device, so a resend after a crash or a timeout replaces the notification. Never log a token.
|
|
16
|
+
|
|
17
|
+
See `extensions` for the rules every extension follows.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- generated:extension-point -->
|
|
4
4
|
- Name: `sandbox` (a ref is `sandbox@<major>`)
|
|
5
|
-
- Runs
|
|
5
|
+
- Runs a device's instance and keeps its files for agents' commands (Docker, E2B).
|
|
6
6
|
- Providers: one at a time
|
|
7
7
|
- Enabled per org: no
|
|
8
8
|
- Brokered by the platform: yes (extensions use it only through `ctx`)
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
Contract: SandboxProvider (`sandbox.ts`)
|
|
12
12
|
|
|
13
|
-
The kernel accepts only `sandbox@2`.
|
|
13
|
+
The kernel accepts only `sandbox@2`. A device is one instance plus a file system that outlives it. Implement the file system (`createFileSystem`, `destroyFileSystem`, `destroyFileSystemByName`), the instance on it (`create`, which throws `FileSystemGoneError` when the file system is gone instead of making an empty one; `resume`, `suspend`; `destroy` and `destroyByName`, which drop the instance and keep the files), and the instance's `exec`, `readFile`, `writeFile`, `stat`, `killAll` and `killTagged` (`concurrentExec` is required: several conversations share one instance). Aborting a command must kill it. Locking, suspension timing and destruction are the kernel's job, not yours.
|
|
14
14
|
|
|
15
15
|
See `extensions` for the rules every extension follows.
|
package/agent-docs/extensions.md
CHANGED
|
@@ -32,10 +32,34 @@ The platform runs several replicas, so:
|
|
|
32
32
|
and periodic work) and `ctx.bus`.
|
|
33
33
|
- Queue names and job ids contain no `:`.
|
|
34
34
|
- Migrations are plain SQL under `migrations/`, in the schema `plugin_<name>`, expand-only.
|
|
35
|
-
- Declare every capability you use (`ctx.secrets`, `ctx.storage`, `ctx.tools`, `ctx.ui`, hooks
|
|
36
|
-
in `permissions`. `capybara-plugin check`
|
|
35
|
+
- Declare every capability you use (`ctx.secrets`, `ctx.storage`, `ctx.tools`, `ctx.ui`, hooks,
|
|
36
|
+
`ctx.setup.check` ids in `permissions.setupChecks`) in `permissions`. `capybara-plugin check`
|
|
37
|
+
verifies this.
|
|
37
38
|
- Hooks observe or deny; they never rewrite.
|
|
38
39
|
|
|
40
|
+
## Setup checks
|
|
41
|
+
|
|
42
|
+
A setup guide's `::check <id> <label>` line (see `plugin-format`) runs a check of the plugin's
|
|
43
|
+
extension:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
ctx.setup.check("bot-token", {
|
|
47
|
+
place: "channel-connection",
|
|
48
|
+
run: async ({ target, config, mode, signal }) => {
|
|
49
|
+
// one or two read calls, passing signal; return ok, failing (with reason and fix) or unknown
|
|
50
|
+
return { status: "ok", reason: { en: "The platform accepted the token." } };
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Register in `setup` and list each id in `permissions.setupChecks` (`^[a-z0-9][a-z0-9-]{0,47}$`).
|
|
56
|
+
- A check never writes (at the third party or in the platform), never retries, and never puts a
|
|
57
|
+
secret in its `reason` or `fix` (plain text, `{ en, zh? }`, at most 300 / 500 characters).
|
|
58
|
+
- A channel connection target carries the connection config; a connector target carries ids and a
|
|
59
|
+
manual OAuth client id, never the client secret or a member's token.
|
|
60
|
+
- The platform runs checks only when a person or an agent asks, caches results for five minutes,
|
|
61
|
+
times a run out after 10 seconds and redacts known secrets from results.
|
|
62
|
+
|
|
39
63
|
## Extension points
|
|
40
64
|
|
|
41
65
|
An extension *provides* a point (`provides`) or *consumes* one (`requires`, or `optional`). Refs
|
|
@@ -44,7 +68,7 @@ look like `channel@1`: name and major version. The registered points:
|
|
|
44
68
|
<!-- generated:extension-points -->
|
|
45
69
|
| Extension point | Providers | Per org | What it is |
|
|
46
70
|
|---|---|---|---|
|
|
47
|
-
| `sandbox` | single | no | Runs
|
|
71
|
+
| `sandbox` | single | no | Runs a device's instance and keeps its files for agents' commands (Docker, E2B). |
|
|
48
72
|
| `config-source` | single | no | Supplies deployment configuration from an external store such as Nacos. |
|
|
49
73
|
| `secret-store` | single | no | Stores and resolves secrets (connector credentials, secret config) outside the database. |
|
|
50
74
|
| `object-store` | single | no | Stores files and artifacts in S3-compatible object storage, with presigned uploads. |
|
|
@@ -56,7 +80,9 @@ look like `channel@1`: name and major version. The registered points:
|
|
|
56
80
|
| `connector` | multi | no | Speaks one protocol (MCP, OpenAPI) to external systems and exposes their tools to agents. |
|
|
57
81
|
| `file-preview` | multi | yes | Renders previews of files of given types in the conversation UI. |
|
|
58
82
|
| `web-search` | multi | yes | Searches the web for the WebSearch tool; each org picks a default provider. |
|
|
83
|
+
| `context` | multi | yes | Adds text to the model's context at run start in conversations of orgs that enable it. |
|
|
59
84
|
| `web-fetch` | multi | yes | Fetches and extracts web pages for the WebFetch tool; each org picks a default provider. |
|
|
85
|
+
| `push-provider` | multi | no | Delivers push notifications to people's mobile apps through one channel (APNs, FCM, an aggregator). |
|
|
60
86
|
<!-- /generated -->
|
|
61
87
|
|
|
62
88
|
Read `extension-points/<name>` for each one. Which points a deployment actually has loaded, and
|
|
@@ -10,11 +10,12 @@ A plugin is a directory, packed into a `.tgz` with `capybara-plugin pack` (the p
|
|
|
10
10
|
skills/<name>/SKILL.md skills (scanned unless plugin.json lists them)
|
|
11
11
|
connectors/<id>.json connector templates (scanned unless listed)
|
|
12
12
|
agents/<name>.md agent templates (scanned unless listed)
|
|
13
|
+
themes/<id>.json themes (scanned unless listed)
|
|
13
14
|
src/index.ts the extension (optional; bundled by the packer)
|
|
14
15
|
migrations/*.sql, ui/** extension migrations and UI files (optional)
|
|
15
16
|
```
|
|
16
17
|
|
|
17
|
-
A plugin without `src/index.ts` is declarative: skills and
|
|
18
|
+
A plugin without `src/index.ts` is declarative: skills, templates and themes only, no code runs.
|
|
18
19
|
|
|
19
20
|
## plugin.json
|
|
20
21
|
|
|
@@ -37,6 +38,9 @@ file is strict: an unknown key is an error. Fields (agent templates are listed u
|
|
|
37
38
|
| `skills` | array of object | no |
|
|
38
39
|
| `connectorTemplates` | array of object | no |
|
|
39
40
|
| `agents` | array of object | no |
|
|
41
|
+
| `themes` | array of object | no |
|
|
42
|
+
| `setupGuides` | array of object | no |
|
|
43
|
+
| `suggestedAppearance` | object | no |
|
|
40
44
|
| `extension` | object | no |
|
|
41
45
|
<!-- /generated -->
|
|
42
46
|
|
|
@@ -47,12 +51,54 @@ Rules that the schema cannot show:
|
|
|
47
51
|
release candidates, ranges on official packages are written `^0.1.0-rc.0`.
|
|
48
52
|
- `description` is a string or `{ en, zh? }`; `displayName` is `{ zh, en }`.
|
|
49
53
|
- `icon` is a `./` path to an `.svg` or `.png` inside the plugin.
|
|
50
|
-
- `skills`, `connectorTemplates`, `agents` list paths starting with `./` that stay inside the plugin.
|
|
54
|
+
- `skills`, `connectorTemplates`, `agents`, `themes` list paths starting with `./` that stay inside the plugin.
|
|
51
55
|
Omit them to scan the default folders. Names and ids are unique within the plugin.
|
|
52
56
|
- `dependencies`: plugin name plus semver range; no self-dependency.
|
|
53
57
|
- `agents`: at most 64 templates (see `agent-templates`).
|
|
58
|
+
- `themes`: at most 10 `<id>.json` files; the id is the file's base name. A theme file is checked
|
|
59
|
+
by `parseThemeFile` (schema `https://capybarahq.com/schemas/theme.v1.schema.json`).
|
|
60
|
+
Besides schemes and `fonts`, it may set `logo` (`mark`, `wordmark`, `favicon`, `illustration`,
|
|
61
|
+
`appIcon`, `appIconMaskable`), `decoration` (`dither` or `none`), `avatars` (at most 12 presets) and
|
|
62
|
+
`hideAvatarPresets`; every file it names is checked and packed, and nothing else is served.
|
|
63
|
+
- `setupGuides` (at most 8): `{ id, place, template? }`. Each guide is a Markdown document at
|
|
64
|
+
`guides/<id>.md` (English, required) and `guides/<id>.zh.md` (Chinese, optional), shown where a
|
|
65
|
+
person sets up what the plugin brings. `place` is `channel-connection` (New channel and the channel
|
|
66
|
+
detail; the extension must provide `channel@1`; one per plugin), `connector-template`
|
|
67
|
+
(`template` names one of the plugin's `connectors/<id>.json`; one per template) or
|
|
68
|
+
`extension-deployment` (the super admin's page of the extension; its checks get the extension's
|
|
69
|
+
platform deployment config and `orgId: null`, for credentials such as a push provider's key). See
|
|
70
|
+
"Setup guides" below.
|
|
54
71
|
- `extension` is written by the packer; never write it by hand.
|
|
55
72
|
|
|
73
|
+
## Setup guides
|
|
74
|
+
|
|
75
|
+
A guide is CommonMark + GFM:
|
|
76
|
+
|
|
77
|
+
- It starts with exactly one `# Title` (the guide's title, at most 100 characters); use `##` to
|
|
78
|
+
`####` below it.
|
|
79
|
+
- `{{name}}` variables come from the place, and none is ever a secret: everywhere `publicUrl`,
|
|
80
|
+
`orgName`, `pluginName`, `pluginVersion`, `mode`; `channel-connection` adds `webhookUrl`,
|
|
81
|
+
`signInCallbackUrl`, `connectionName`; `connector-template` adds `oauthCallbackUrl`,
|
|
82
|
+
`signInCallbackUrl`, `templateId`, `templateName`, `connectorName`; `extension-deployment` adds
|
|
83
|
+
none (no modes, admin audience only). In `yaml` / `json` code put a
|
|
84
|
+
variable inside double quotes. Directive lines and fence info strings hold no variables.
|
|
85
|
+
- Sections: a line `::: mode webhook` (modes `long_connection`, `webhook`; channel guides) or
|
|
86
|
+
`::: audience member` (audiences `admin`, `member`; connector template guides) opens one, `:::`
|
|
87
|
+
closes it, both in column 0. Only a mode section may sit inside an audience section. Text outside
|
|
88
|
+
every section applies to all.
|
|
89
|
+
- Checks: a line `::check <id> <label>` is a live status row. `<id>` is one of the extension's own
|
|
90
|
+
checks (registered with `ctx.setup.check` and listed in `permissions.setupChecks`; see
|
|
91
|
+
`extensions`) or a platform check `capybara:<id>` (`public-url`, `webhook-public`,
|
|
92
|
+
`webhook-received`, `connection-active`, `oauth-client`, `connector-tools`,
|
|
93
|
+
`connector-connected`, `oauth-token-endpoint`). The label is plain text, at most 80 characters.
|
|
94
|
+
- Code fences: `<language> title="<text>"`; every block gets a copy button. Indented code blocks are
|
|
95
|
+
refused. Raw HTML shows as text, images are never loaded, and only `https:` links stay links.
|
|
96
|
+
- The zh document has the same sections, the same check ids and byte-equal code blocks.
|
|
97
|
+
- Limits: 64 KiB per document, 24 code blocks, 16 checks, 16 sections.
|
|
98
|
+
|
|
99
|
+
`capybara-plugin pack` and `check` validate the documents; `capybara-plugin guide <id> [--locale zh]
|
|
100
|
+
[--mode m] [--audience a] [--var name=value]` prints a guide as an admin will see it.
|
|
101
|
+
|
|
56
102
|
## Importing
|
|
57
103
|
|
|
58
104
|
Plugins reach a deployment through a marketplace (npm, archive, git or path sources) or a direct
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Helping with plugin setup
|
|
2
|
+
|
|
3
|
+
Read this before helping a person set up a channel connection or a connector from a plugin's
|
|
4
|
+
setup guide. The `setup` operations do the reading and checking; everything that needs a secret or
|
|
5
|
+
the person's own decision stays with the person on the web.
|
|
6
|
+
|
|
7
|
+
## The flow
|
|
8
|
+
|
|
9
|
+
1. **List** the guides you may help with: `call setup.guides`. Each guide has its targets (a
|
|
10
|
+
channel connection, a connector made from a template, or a template switched on without a
|
|
11
|
+
connector yet), a drift entry when the plugin changed the guide since the target was set up, a
|
|
12
|
+
count of the cached check states, and the `webPath` of the page where the person does the
|
|
13
|
+
setup. Org admins get the admin guides; members get the guides for connecting their own
|
|
14
|
+
account (audience `member`).
|
|
15
|
+
2. **Read** the guide for the target: `call setup.read` with `itemId`, `guideId` and the target
|
|
16
|
+
(`connectionId` for a channel guide, `connectorId` for a connector template guide; `audience`
|
|
17
|
+
`member` for a member guide). It returns the guide as Markdown, with each check as a
|
|
18
|
+
`- [check <id>] <label>` line, the modes (for example `long_connection` or `webhook`), the
|
|
19
|
+
variables that have no value yet with the reason, and the `webPath`.
|
|
20
|
+
3. **Explain the step the person is on**, in their language: what to open at the third-party
|
|
21
|
+
platform, what to paste there (the app manifest and URLs come from the guide), what to copy
|
|
22
|
+
back.
|
|
23
|
+
4. **Run a check after the person says they did a step**: `call setup.check` with the check id
|
|
24
|
+
from the guide. A fresh cached result comes back as is; `force: true` reruns it, at most once
|
|
25
|
+
every 10 seconds per check and target. `call setup.status` reads every check's cached state
|
|
26
|
+
without running anything.
|
|
27
|
+
5. **Explain a failing check** with its `reason` and `fix`, then wait for the person to fix it and
|
|
28
|
+
say so before running it again. `running` means another run is in progress: read the state
|
|
29
|
+
again in a moment. `unknown` means the check could not answer; its reason says why.
|
|
30
|
+
|
|
31
|
+
## What stays with the person
|
|
32
|
+
|
|
33
|
+
- **Secrets.** Bot tokens, app tokens, signing secrets and OAuth client secrets are typed by the
|
|
34
|
+
person, never by you. A write that stores one (a connector credential or OAuth client secret, a
|
|
35
|
+
channel secret, an extension config secret) takes it as a person field: name its path in
|
|
36
|
+
`askPerson` and the person types the value on the `Platform` confirmation card. What the card
|
|
37
|
+
cannot take (secret records, custom header credentials) the person enters on the `webPath` page.
|
|
38
|
+
Never ask for a secret in the conversation and never repeat one; if the person pastes one
|
|
39
|
+
anyway, it counts as leaked: tell them to rotate it at the third-party platform. The guide and
|
|
40
|
+
the check results never contain secret values, and no setup operation takes one.
|
|
41
|
+
- **Connecting a personal account** (OAuth consent) happens in the person's browser: call
|
|
42
|
+
`connectors.connect`, which shows the person a Connect button in the conversation, then check
|
|
43
|
+
`connectors.get` for the connection state.
|
|
44
|
+
- **Confirming the app was updated** after a guide changed (the drift notice) is the person's
|
|
45
|
+
confirmation: only they know they changed the app at the third party. For a connector,
|
|
46
|
+
`connectors.guide-ack` puts that statement on its confirmation card (the hash `connectors.get`
|
|
47
|
+
shows under `setupGuide`); for a channel connection, `channels.guide-ack` does (the `hash` of
|
|
48
|
+
`setup.read` for the connection, audience admin, its inbound mode). A stale hash is refused
|
|
49
|
+
before the card: read the guide again and walk the person through the change.
|
|
50
|
+
- **Creating the app** at the third-party platform is outside Capybara: explain it, the person
|
|
51
|
+
does it.
|
|
52
|
+
|
|
53
|
+
Switching a channel connection's inbound mode is an ordinary confirmed operation
|
|
54
|
+
(`channels.update`); the person approves the card.
|
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,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,19 @@ 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
|
+
*
|
|
12
20
|
* Objects are strict (unknown keys rejected, `$schema` allowed): the manifest ships with core, so
|
|
13
21
|
* there is no older reader to stay compatible with and a misspelt key is a mistake. The committed
|
|
14
22
|
* JSON Schema (`schemas/bootstrap.v1.schema.json`) is generated from {@link BootstrapManifestSchema}
|
|
15
23
|
* by `pnpm gen:package-schemas`; the cross-field rules (unique names, `marketplace` required with an
|
|
16
|
-
* npm entry) are decided only by {@link parseBootstrapManifest}.
|
|
24
|
+
* npm entry, not both `required` and `builtin`) are decided only by {@link parseBootstrapManifest}.
|
|
17
25
|
*/
|
|
18
26
|
/** Manifest format version. */
|
|
19
27
|
export declare const BOOTSTRAP_MANIFEST_SCHEMA_VERSION = 1;
|
|
@@ -30,6 +38,11 @@ export type BootstrapEntry = {
|
|
|
30
38
|
integrity: string;
|
|
31
39
|
/** Enabled in every org and neither disableable nor uninstallable. */
|
|
32
40
|
required: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Builtin but not required: imported after the extensions loaded (it may ship skills), its
|
|
43
|
+
* catalog item builtin; a failure does not stop the start. Never together with `required`.
|
|
44
|
+
*/
|
|
45
|
+
builtin?: boolean;
|
|
33
46
|
} | {
|
|
34
47
|
name: string;
|
|
35
48
|
source: "workspace";
|
|
@@ -38,6 +51,7 @@ export type BootstrapEntry = {
|
|
|
38
51
|
version: string;
|
|
39
52
|
integrity: string;
|
|
40
53
|
required: boolean;
|
|
54
|
+
builtin?: boolean;
|
|
41
55
|
};
|
|
42
56
|
/** `bootstrap.json`. */
|
|
43
57
|
export interface BootstrapManifest {
|
|
@@ -65,3 +79,74 @@ export declare function parseBootstrapManifest(json: unknown): BootstrapManifest
|
|
|
65
79
|
};
|
|
66
80
|
/** The file name of an entry's tgz in the bootstrap directory: `<name>-<version>.tgz`. */
|
|
67
81
|
export declare function bootstrapFileName(e: BootstrapEntry): string;
|
|
82
|
+
/** Extra manifest format version. */
|
|
83
|
+
export declare const BOOTSTRAP_EXTRA_MANIFEST_SCHEMA_VERSION = 1;
|
|
84
|
+
/** A `git` entry: a plugin directory of a declared marketplace at a pinned commit. */
|
|
85
|
+
export interface BootstrapGitEntry {
|
|
86
|
+
/** Catalog item name. */
|
|
87
|
+
name: string;
|
|
88
|
+
source: "git";
|
|
89
|
+
/** A name from the manifest's `marketplaces`. */
|
|
90
|
+
marketplace: string;
|
|
91
|
+
/** 40-hex commit the tree is read at (never a branch). */
|
|
92
|
+
commit: string;
|
|
93
|
+
/** The plugin directory inside the repository: `./<path>`, or `.` / `./` for its root. */
|
|
94
|
+
path: string;
|
|
95
|
+
/** Exact semver. */
|
|
96
|
+
version: string;
|
|
97
|
+
/** `sha512-<base64>` of the kernel's canonical pack of the tree. */
|
|
98
|
+
integrity: string;
|
|
99
|
+
required?: boolean;
|
|
100
|
+
builtin?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** An entry of the extra manifest: npm (`required` optional) or git. */
|
|
103
|
+
export type BootstrapExtraEntry = (Omit<Extract<BootstrapEntry, {
|
|
104
|
+
source: "npm";
|
|
105
|
+
}>, "required"> & {
|
|
106
|
+
required?: boolean;
|
|
107
|
+
}) | BootstrapGitEntry;
|
|
108
|
+
/** A marketplace the extra manifest declares for its `git` entries. */
|
|
109
|
+
export interface BootstrapExtraMarketplace {
|
|
110
|
+
/** `^[a-z0-9][a-z0-9-]{0,63}$`, unique, not `official`. */
|
|
111
|
+
name: string;
|
|
112
|
+
/** An https URL without userinfo. */
|
|
113
|
+
url: string;
|
|
114
|
+
ref?: string;
|
|
115
|
+
/** HTTP basic username of the credential (`^[A-Za-z0-9._-]{1,64}$`). */
|
|
116
|
+
username?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The extra bootstrap manifest (`bootstrap-extra.v1`): a second manifest a distribution supplies (the file
|
|
120
|
+
* `bootstrap.extraManifest` points at), merged into the built-in one (spec 2026-11-20-bootstrap-extra-manifest §2). It adds
|
|
121
|
+
* `marketplaces` the entries can name, `git` entries (a plugin directory of such a marketplace at
|
|
122
|
+
* a pinned commit) and an optional `defaultTheme`. `required` is optional here (default `false`).
|
|
123
|
+
* Objects are strict. The committed JSON Schema (`schemas/bootstrap-extra.v1.schema.json`) is
|
|
124
|
+
* generated from {@link BootstrapExtraManifestSchema}; the cross-field rules (unique names, a
|
|
125
|
+
* declared marketplace, `defaultTheme` naming a builtin entry, not both `required` and `builtin`)
|
|
126
|
+
* are decided only by {@link parseBootstrapExtraManifest}.
|
|
127
|
+
*/
|
|
128
|
+
export interface BootstrapExtraManifest {
|
|
129
|
+
$schema?: string;
|
|
130
|
+
schemaVersion: 1;
|
|
131
|
+
marketplaces: BootstrapExtraMarketplace[];
|
|
132
|
+
plugins: BootstrapExtraEntry[];
|
|
133
|
+
/** The platform default theme: `plugin` is a builtin entry of this manifest. */
|
|
134
|
+
defaultTheme?: {
|
|
135
|
+
plugin: string;
|
|
136
|
+
theme: string;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The zod schema of the extra manifest (strict objects). The JSON Schema is generated with
|
|
141
|
+
* `z.toJSONSchema(BootstrapExtraManifestSchema, { io: "input" })`.
|
|
142
|
+
*/
|
|
143
|
+
export declare const BootstrapExtraManifestSchema: z.ZodType<BootstrapExtraManifest>;
|
|
144
|
+
/**
|
|
145
|
+
* Validates and parses the extra manifest. Invalid input returns `{ errors }` (`<path>: <reason>`,
|
|
146
|
+
* at most 50); never throws.
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseBootstrapExtraManifest(json: unknown): {
|
|
149
|
+
manifest: BootstrapExtraManifest;
|
|
150
|
+
} | {
|
|
151
|
+
errors: string[];
|
|
152
|
+
};
|