@capybara-hq/plugin-sdk 0.1.0-rc.7 → 0.1.0-rc.71
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 +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/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/extensions.md +77 -4
- package/agent-docs/plugin-format.md +51 -12
- 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 +109 -1
- package/dist/bootstrap.js +185 -2
- package/dist/cards.d.ts +60 -13
- package/dist/cards.js +88 -18
- package/dist/channel.d.ts +128 -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 +210 -30
- package/dist/ctx.js +9 -1
- package/dist/define-extension.d.ts +23 -13
- package/dist/define-extension.js +19 -5
- package/dist/device-denied-paths.d.ts +20 -0
- package/dist/device-denied-paths.js +118 -0
- package/dist/device-operation.d.ts +339 -0
- package/dist/device-operation.js +312 -0
- package/dist/device-protocol.d.ts +285 -50
- package/dist/device-protocol.js +755 -90
- package/dist/device-provider.d.ts +708 -0
- package/dist/device-provider.js +325 -0
- package/dist/device-service.d.ts +52 -0
- package/dist/device-service.js +105 -0
- package/dist/dial-in.d.ts +239 -0
- package/dist/dial-in.js +155 -0
- package/dist/directory.d.ts +15 -12
- package/dist/extension-point.d.ts +2 -0
- package/dist/extension-point.js +7 -3
- package/dist/field-meta.d.ts +19 -0
- package/dist/field-meta.js +54 -0
- package/dist/file-preview.d.ts +43 -10
- 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 +71 -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 +31 -4
- package/dist/index.js +31 -4
- package/dist/model-params.d.ts +41 -22
- package/dist/model-params.js +28 -15
- package/dist/model.d.ts +210 -75
- 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 +65 -22
- package/dist/permissions.js +139 -43
- package/dist/platform-only.d.ts +27 -0
- package/dist/platform-only.js +35 -0
- package/dist/plugin-manifest.d.ts +40 -9
- package/dist/plugin-manifest.js +171 -60
- 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 +476 -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 +211 -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.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 +55 -0
- package/dist/theme-assets.js +489 -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 +104 -30
- package/dist/tool.js +29 -9
- package/dist/ui-parts.d.ts +23 -0
- package/dist/ui-parts.js +385 -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 +232 -77
- package/dist/ui.js +104 -27
- 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 +93 -143
- package/schemas/theme.v1.schema.json +302 -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
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { PushPlatform } from "./push.js";
|
|
2
|
+
/**
|
|
3
|
+
* Desktop shell capabilities (desktop client spec §8): the shapes of the objects a desktop shell
|
|
4
|
+
* puts in `window.capybaraShell.capabilities` under the keys of `SHELL_CAPABILITY_KEYS`. Types and
|
|
5
|
+
* key constants only; `capybara-hq/clients` implements them. A rejected call carries
|
|
6
|
+
* `{ code: ShellCallError }`.
|
|
7
|
+
*/
|
|
8
|
+
/** Capability keys, `name@major`; each value is a key of `SHELL_CAPABILITIES`. */
|
|
9
|
+
export declare const SHELL_CAPABILITY_KEYS: {
|
|
10
|
+
readonly chrome: "chrome@1";
|
|
11
|
+
readonly notify: "notify@1";
|
|
12
|
+
readonly openExternal: "openExternal@1";
|
|
13
|
+
readonly signIn: "signIn@1";
|
|
14
|
+
readonly haptics: "haptics@1";
|
|
15
|
+
readonly share: "share@1";
|
|
16
|
+
readonly menu: "menu@1";
|
|
17
|
+
readonly nav: "nav@1";
|
|
18
|
+
readonly profiles: "profiles@1";
|
|
19
|
+
readonly push: "push@1";
|
|
20
|
+
};
|
|
21
|
+
/** The `code` of a rejected shell call. */
|
|
22
|
+
export type ShellCallError = "busy" | "no_activation" | "cancelled" | "failed";
|
|
23
|
+
/** `notify@1`: a native notification; `path` is the in-app path opened on click. */
|
|
24
|
+
export interface NotifyCapabilityV1 {
|
|
25
|
+
notify(input: {
|
|
26
|
+
title: string;
|
|
27
|
+
body: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/** `openExternal@1`: open a URL in the system browser. */
|
|
32
|
+
export interface OpenExternalCapabilityV1 {
|
|
33
|
+
open(url: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/** `signIn@1`: sign in through the system browser (desktop client spec §6.5). */
|
|
36
|
+
export interface SignInCapabilityV1 {
|
|
37
|
+
start(): Promise<"signedIn" | "cancelled">;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The page's main color tokens (the computed `--cb-bg`, `--cb-panel`, `--cb-ink`, `--cb-muted`,
|
|
41
|
+
* `--cb-line`, `--cb-accent`, `--cb-on-accent`), each a CSS hex or `rgb()` / `rgba()` color. The
|
|
42
|
+
* shell validates them and uses them only as custom properties of its own pages, never as markup.
|
|
43
|
+
*/
|
|
44
|
+
export interface ShellChromeTokens {
|
|
45
|
+
bg: string;
|
|
46
|
+
panel: string;
|
|
47
|
+
ink: string;
|
|
48
|
+
muted: string;
|
|
49
|
+
line: string;
|
|
50
|
+
accent: string;
|
|
51
|
+
onAccent: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `chrome@1` (mobile layout spec §9.2): the native chrome (window background, title bar, the
|
|
55
|
+
* shell's own pages) follows the page's theme. `tokens` is sent only when all seven are colors;
|
|
56
|
+
* `singleScheme` is true under a UI theme with one scheme (no light / dark toggle on either side).
|
|
57
|
+
*/
|
|
58
|
+
export interface ChromeCapabilityV1 {
|
|
59
|
+
setAppearance(input: {
|
|
60
|
+
scheme: "light" | "dark";
|
|
61
|
+
background: string;
|
|
62
|
+
tokens?: ShellChromeTokens;
|
|
63
|
+
singleScheme?: boolean;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
/** The web's first paint is done (mobile app spec §5.2); a shell may leave it out. */
|
|
66
|
+
ready?(): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
export type HapticKind = "selection" | "light" | "success" | "warning";
|
|
69
|
+
/** `haptics@1`: a haptic impact (mobile app spec §5.2). */
|
|
70
|
+
export interface HapticsCapabilityV1 {
|
|
71
|
+
impact(kind: HapticKind): Promise<void>;
|
|
72
|
+
}
|
|
73
|
+
export interface ShareInputV1 {
|
|
74
|
+
title?: string;
|
|
75
|
+
text?: string;
|
|
76
|
+
url?: string;
|
|
77
|
+
}
|
|
78
|
+
/** `share@1`: the system share sheet; resolves whether shared or dismissed. */
|
|
79
|
+
export interface ShareCapabilityV1 {
|
|
80
|
+
share(input: ShareInputV1): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
export interface MenuItemV1 {
|
|
83
|
+
id: string;
|
|
84
|
+
label: string;
|
|
85
|
+
destructive?: boolean;
|
|
86
|
+
disabled?: boolean;
|
|
87
|
+
}
|
|
88
|
+
export interface MenuInputV1 {
|
|
89
|
+
title?: string;
|
|
90
|
+
items: MenuItemV1[];
|
|
91
|
+
/** A rect in CSS px from the web view's top-left corner. */
|
|
92
|
+
anchor?: {
|
|
93
|
+
x: number;
|
|
94
|
+
y: number;
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** `menu@1`: a native menu; resolves the chosen item id, or null when dismissed. */
|
|
100
|
+
export interface MenuCapabilityV1 {
|
|
101
|
+
show(input: MenuInputV1): Promise<string | null>;
|
|
102
|
+
}
|
|
103
|
+
/** The shell validates every input against these (and the web keeps within them). */
|
|
104
|
+
export declare const MOBILE_SHELL_LIMITS: {
|
|
105
|
+
readonly menuItems: 12;
|
|
106
|
+
readonly menuLabel: 64;
|
|
107
|
+
readonly menuTitle: 128;
|
|
108
|
+
readonly shareTitle: 256;
|
|
109
|
+
readonly shareText: 4000;
|
|
110
|
+
readonly url: 2048;
|
|
111
|
+
/** `nav@1`: an item or action label is 1..32 characters. */
|
|
112
|
+
readonly navLabel: 32;
|
|
113
|
+
/** `nav@1`: a badge count is an integer 0..9999 (`countMore` says there are more). */
|
|
114
|
+
readonly navCount: 9999;
|
|
115
|
+
/** `nav@1`: the account's name is 1..64 characters (its initial 1..2). */
|
|
116
|
+
readonly navAccountName: 64;
|
|
117
|
+
};
|
|
118
|
+
/** The menu item id pattern, checked on `menu@1.show` (the shell validates every input). */
|
|
119
|
+
export declare const MENU_ITEM_ID: RegExp;
|
|
120
|
+
/**
|
|
121
|
+
* The strip's items: the four sections and, last, `search` (opens the web's command palette; never
|
|
122
|
+
* `current`).
|
|
123
|
+
*/
|
|
124
|
+
export type NavSectionId = "chats" | "inbox" | "agents" | "schedules" | "search";
|
|
125
|
+
/** The strip's items in display order. */
|
|
126
|
+
export declare const NAV_SECTION_ORDER: readonly NavSectionId[];
|
|
127
|
+
export interface NavBadgeV1 {
|
|
128
|
+
count?: number;
|
|
129
|
+
countMore?: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface NavItemV1 extends NavBadgeV1 {
|
|
132
|
+
id: NavSectionId;
|
|
133
|
+
label: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The pill's top item, accent-filled: the page's primary action, else the new conversation
|
|
137
|
+
* (`id` matches MENU_ITEM_ID, `label` 1..navLabel; the shell draws its own glyph per `icon`).
|
|
138
|
+
*/
|
|
139
|
+
export interface NavActionV1 {
|
|
140
|
+
id: string;
|
|
141
|
+
label: string;
|
|
142
|
+
icon: "plus" | "square-pen";
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The account avatar under the strip's status: the image at `avatarUrl` (an absolute https URL
|
|
146
|
+
* or one on the profile's origin), else `initial` in a circle; `badge` a count 0..navCount.
|
|
147
|
+
*/
|
|
148
|
+
export interface NavAccountV1 {
|
|
149
|
+
name: string;
|
|
150
|
+
avatarUrl?: string | null;
|
|
151
|
+
initial: string;
|
|
152
|
+
badge?: number;
|
|
153
|
+
}
|
|
154
|
+
export interface NavStateV1 {
|
|
155
|
+
/** The items the person sees, in NAV_SECTION_ORDER (a guest has no `schedules`). */
|
|
156
|
+
items: NavItemV1[];
|
|
157
|
+
/**
|
|
158
|
+
* The section of the page on screen; `null`: no section is selected and the shell clears its
|
|
159
|
+
* highlight (the new-conversation home, a page outside the sections). Never `search`.
|
|
160
|
+
*/
|
|
161
|
+
current: NavSectionId | null;
|
|
162
|
+
/** The pill's top item: the page's primary, else the new conversation (no menu button, D12). */
|
|
163
|
+
action: NavActionV1;
|
|
164
|
+
/** The avatar under the status (absent: the shell shows none). */
|
|
165
|
+
account?: NavAccountV1;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* `nav@1`: offered only while the window has a strip (mobile app spec §6.1): presence is
|
|
169
|
+
* visibility. `side` is the edge the strip is on (right unless the app is the left one of a
|
|
170
|
+
* split), reported with the capability and updated with the envelope's `change`. The shell and
|
|
171
|
+
* the web ship this shape in lockstep (no older-shell path before 0.1.0): the shell's nav@1
|
|
172
|
+
* minor version of 2026-11-22 ships with or before the web that sends it.
|
|
173
|
+
*/
|
|
174
|
+
export interface NavCapabilityV1 {
|
|
175
|
+
set(state: NavStateV1): Promise<void>;
|
|
176
|
+
onSelect(listener: (id: NavSectionId) => void): () => void;
|
|
177
|
+
/** The pill's top item was tapped: the web runs the action. */
|
|
178
|
+
onAction(listener: () => void): () => void;
|
|
179
|
+
/** The account avatar was tapped: the web opens its account sheet. */
|
|
180
|
+
onAccount(listener: () => void): () => void;
|
|
181
|
+
readonly side?: "left" | "right";
|
|
182
|
+
}
|
|
183
|
+
/** `profiles@1`: the native profile switcher. */
|
|
184
|
+
export interface ProfilesCapabilityV1 {
|
|
185
|
+
/** Opens the native profile switcher; resolves when it closes, with nothing. */
|
|
186
|
+
show(): Promise<void>;
|
|
187
|
+
}
|
|
188
|
+
export type PushPermission = "granted" | "denied" | "prompt";
|
|
189
|
+
export interface PushStatus {
|
|
190
|
+
permission: PushPermission;
|
|
191
|
+
/** The server-side registration id this install holds, or null. */
|
|
192
|
+
registrationId: string | null;
|
|
193
|
+
/** The OS token differs from the one last registered. */
|
|
194
|
+
tokenChanged: boolean;
|
|
195
|
+
}
|
|
196
|
+
/** What the shell hands the web app to register with the deployment. */
|
|
197
|
+
export interface PushRegistration {
|
|
198
|
+
platform: PushPlatform;
|
|
199
|
+
appId: string;
|
|
200
|
+
provider: string;
|
|
201
|
+
token: string;
|
|
202
|
+
}
|
|
203
|
+
/** `push@1`: native push registration (mobile shells). */
|
|
204
|
+
export interface PushCapabilityV1 {
|
|
205
|
+
status(): Promise<PushStatus>;
|
|
206
|
+
/** User activation only when permission is "prompt"; rejects { code: "cancelled" } when denied. */
|
|
207
|
+
register(): Promise<PushRegistration>;
|
|
208
|
+
/** Tells the shell the deployment's registration id for this install. */
|
|
209
|
+
registered(id: string): Promise<void>;
|
|
210
|
+
unregister(): Promise<void>;
|
|
211
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desktop shell capabilities (desktop client spec §8): the shapes of the objects a desktop shell
|
|
3
|
+
* puts in `window.capybaraShell.capabilities` under the keys of `SHELL_CAPABILITY_KEYS`. Types and
|
|
4
|
+
* key constants only; `capybara-hq/clients` implements them. A rejected call carries
|
|
5
|
+
* `{ code: ShellCallError }`.
|
|
6
|
+
*/
|
|
7
|
+
/** Capability keys, `name@major`; each value is a key of `SHELL_CAPABILITIES`. */
|
|
8
|
+
export const SHELL_CAPABILITY_KEYS = {
|
|
9
|
+
chrome: "chrome@1",
|
|
10
|
+
notify: "notify@1",
|
|
11
|
+
openExternal: "openExternal@1",
|
|
12
|
+
signIn: "signIn@1",
|
|
13
|
+
haptics: "haptics@1",
|
|
14
|
+
share: "share@1",
|
|
15
|
+
menu: "menu@1",
|
|
16
|
+
nav: "nav@1",
|
|
17
|
+
profiles: "profiles@1",
|
|
18
|
+
push: "push@1",
|
|
19
|
+
};
|
|
20
|
+
/** The shell validates every input against these (and the web keeps within them). */
|
|
21
|
+
export const MOBILE_SHELL_LIMITS = {
|
|
22
|
+
menuItems: 12,
|
|
23
|
+
menuLabel: 64,
|
|
24
|
+
menuTitle: 128,
|
|
25
|
+
shareTitle: 256,
|
|
26
|
+
shareText: 4000,
|
|
27
|
+
url: 2048,
|
|
28
|
+
/** `nav@1`: an item or action label is 1..32 characters. */
|
|
29
|
+
navLabel: 32,
|
|
30
|
+
/** `nav@1`: a badge count is an integer 0..9999 (`countMore` says there are more). */
|
|
31
|
+
navCount: 9999,
|
|
32
|
+
/** `nav@1`: the account's name is 1..64 characters (its initial 1..2). */
|
|
33
|
+
navAccountName: 64,
|
|
34
|
+
};
|
|
35
|
+
/** The menu item id pattern, checked on `menu@1.show` (the shell validates every input). */
|
|
36
|
+
export const MENU_ITEM_ID = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
37
|
+
/** The strip's items in display order. */
|
|
38
|
+
export const NAV_SECTION_ORDER = [
|
|
39
|
+
"chats",
|
|
40
|
+
"inbox",
|
|
41
|
+
"agents",
|
|
42
|
+
"schedules",
|
|
43
|
+
"search",
|
|
44
|
+
];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell environment (mobile layout spec §9, desktop client spec): the contract of the global a
|
|
3
|
+
* native shell injects as `window.capybaraShell`, only into the top frame of the deployment's
|
|
4
|
+
* origin. Types and the capability registry only; `capybara-hq/clients` implements it.
|
|
5
|
+
*/
|
|
6
|
+
export interface CapybaraShell {
|
|
7
|
+
/** The envelope version; bumped only on an incompatible change of this shape. */
|
|
8
|
+
readonly version: 1;
|
|
9
|
+
/** Which shell: drives nothing but the shell attributes. */
|
|
10
|
+
readonly kind: "desktop" | "mobile";
|
|
11
|
+
/** The operating system, for platform conventions only (traffic lights, back gesture). */
|
|
12
|
+
readonly platform: "macos" | "windows" | "linux" | "ios" | "android";
|
|
13
|
+
/** The shell's own version, for reports and diagnostics; never parsed for features. */
|
|
14
|
+
readonly shellVersion: string;
|
|
15
|
+
/**
|
|
16
|
+
* CSS px the shell's own chrome covers at each edge of the web view, beyond the OS safe areas
|
|
17
|
+
* (macOS traffic lights with `titleBarStyle: hiddenInset`, a native title bar overlay).
|
|
18
|
+
*/
|
|
19
|
+
readonly insets: {
|
|
20
|
+
top: number;
|
|
21
|
+
right: number;
|
|
22
|
+
bottom: number;
|
|
23
|
+
left: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The rectangle the shell's window controls occupy over the web view, in CSS px from the web
|
|
27
|
+
* view's top-left corner (macOS traffic lights, a Windows caption-button overlay at the right);
|
|
28
|
+
* null when there are none or they are hidden (fullscreen). Modelled on Window Controls
|
|
29
|
+
* Overlay's `titlebar-area-*`. Optional: a shell without overlaid controls omits it.
|
|
30
|
+
*/
|
|
31
|
+
readonly controls?: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
} | null;
|
|
37
|
+
/** Capabilities by `name@major` (as extension points are named, `channel@1`). */
|
|
38
|
+
readonly capabilities: Readonly<Record<string, object>>;
|
|
39
|
+
/**
|
|
40
|
+
* Insets, controls or capabilities changed (fullscreen hides the traffic lights; a capability
|
|
41
|
+
* appears after load). Returns unsubscribe.
|
|
42
|
+
*/
|
|
43
|
+
on(event: "change", listener: () => void): () => void;
|
|
44
|
+
}
|
|
45
|
+
declare global {
|
|
46
|
+
interface Window {
|
|
47
|
+
capybaraShell?: CapybaraShell;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The registry of capability names (mobile layout spec §9.2). A new capability is added here
|
|
52
|
+
* (key, owner) by the spec that defines it; the owner names the spec holding its functions.
|
|
53
|
+
*/
|
|
54
|
+
export declare const SHELL_CAPABILITIES: readonly {
|
|
55
|
+
key: string;
|
|
56
|
+
owner: string;
|
|
57
|
+
}[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell environment (mobile layout spec §9, desktop client spec): the contract of the global a
|
|
3
|
+
* native shell injects as `window.capybaraShell`, only into the top frame of the deployment's
|
|
4
|
+
* origin. Types and the capability registry only; `capybara-hq/clients` implements it.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The registry of capability names (mobile layout spec §9.2). A new capability is added here
|
|
8
|
+
* (key, owner) by the spec that defines it; the owner names the spec holding its functions.
|
|
9
|
+
*/
|
|
10
|
+
export const SHELL_CAPABILITIES = [
|
|
11
|
+
{ key: "notify@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
|
|
12
|
+
{ key: "openExternal@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
|
|
13
|
+
{ key: "signIn@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md), §6.5" },
|
|
14
|
+
{ key: "chrome@1", owner: "mobile layout spec (2026-11-19-mobile-layout-design.md)" },
|
|
15
|
+
{ key: "haptics@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
16
|
+
{ key: "share@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
17
|
+
{ key: "menu@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
18
|
+
{ key: "nav@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
19
|
+
{ key: "profiles@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
|
|
20
|
+
{ key: "push@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2 and §9" },
|
|
21
|
+
];
|
package/dist/skill.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Limits of a skill package. */
|
|
2
2
|
export declare const SKILL_LIMITS: {
|
|
3
3
|
readonly nameMaxChars: 64;
|
|
4
4
|
readonly descriptionMaxChars: 1024;
|
|
5
5
|
readonly compatibilityMaxChars: 500;
|
|
6
|
-
/**
|
|
6
|
+
/** Upper bound of a single file after extraction (bytes). */
|
|
7
7
|
readonly fileBytes: number;
|
|
8
|
-
/**
|
|
8
|
+
/** Upper bound of the total of all files after extraction (bytes). */
|
|
9
9
|
readonly totalBytes: number;
|
|
10
|
-
/**
|
|
10
|
+
/** Upper bound on the number of files. */
|
|
11
11
|
readonly maxFiles: 1000;
|
|
12
|
-
/**
|
|
12
|
+
/** Upper bound on the length of a relative path inside the package (characters). */
|
|
13
13
|
readonly pathMaxChars: 512;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Upper bound on the length of the frontmatter (between the two `---` lines) in characters; above
|
|
16
|
+
* it no YAML parsing is done.
|
|
17
|
+
*/
|
|
15
18
|
readonly frontmatterMaxChars: number;
|
|
16
19
|
};
|
|
17
20
|
/** Limits of the invocation keys of a SKILL.md (see `SkillInvocation`). */
|
|
@@ -28,14 +31,14 @@ export declare const SKILL_INVOCATION_LIMITS: {
|
|
|
28
31
|
*/
|
|
29
32
|
readonly renderedMaxChars: 200000;
|
|
30
33
|
};
|
|
31
|
-
/**
|
|
34
|
+
/** The skill entry file (package root, case-sensitive). */
|
|
32
35
|
export declare const SKILL_ENTRY_FILE = "SKILL.md";
|
|
33
36
|
/**
|
|
34
37
|
* The sandbox root for skills: each skill version is copied (read-only to commands) to
|
|
35
38
|
* `/skills/<name>@<digest>/` ({@link skillSandboxDir}).
|
|
36
39
|
*/
|
|
37
40
|
export declare const SKILLS_SANDBOX_ROOT = "/skills";
|
|
38
|
-
/**
|
|
41
|
+
/** Whether it is a valid skill name (see the specification at the top of the file). */
|
|
39
42
|
export declare function isSkillName(s: unknown): s is string;
|
|
40
43
|
/**
|
|
41
44
|
* The digest of a skill version's file manifest: the first 12 hex digits of the sha256 of its
|
|
@@ -56,12 +59,12 @@ export declare function skillDigest(files: {
|
|
|
56
59
|
export declare function skillSandboxDir(name: string, digest: string, root?: string): string;
|
|
57
60
|
/** A skill file's path in the sandbox: `<root>/<name>@<digest>/<path>` ({@link skillSandboxDir}). */
|
|
58
61
|
export declare function skillSandboxPath(name: string, digest: string, path: string, root?: string): string;
|
|
59
|
-
/** {@link parseSkillMd}
|
|
62
|
+
/** The result of a successful {@link parseSkillMd}. */
|
|
60
63
|
export interface ParsedSkillMd {
|
|
61
64
|
name: string;
|
|
62
|
-
/**
|
|
65
|
+
/** Trimmed of leading and trailing whitespace. */
|
|
63
66
|
description: string;
|
|
64
|
-
/**
|
|
67
|
+
/** The Markdown body after the frontmatter. */
|
|
65
68
|
body: string;
|
|
66
69
|
/**
|
|
67
70
|
* The parsed YAML frontmatter mapping: every key, values unchanged (e.g. Claude Code's
|
|
@@ -79,17 +82,24 @@ export interface ParseSkillMdOptions {
|
|
|
79
82
|
invocationKeys?: boolean;
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
85
|
+
* Parses SKILL.md: it starts with YAML frontmatter wrapped in `---` lines, followed by the body.
|
|
86
|
+
* Tolerates BOM and CRLF (CRLF in the body becomes LF).
|
|
87
|
+
* Returns name / description / body, or all problems (in English, directly showable to a model or
|
|
88
|
+
* an admin).
|
|
84
89
|
*/
|
|
85
90
|
export declare function parseSkillMd(text: string, options?: ParseSkillMdOptions): ParsedSkillMd | {
|
|
86
91
|
errors: string[];
|
|
87
92
|
};
|
|
88
93
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
94
|
+
* Validates a skill package's file list (paths relative to the package root, files only, no
|
|
95
|
+
* directory entries):
|
|
96
|
+
* the root must have `SKILL.md`; single file ≤ {@link SKILL_LIMITS.fileBytes}; total ≤ {@link
|
|
97
|
+
* SKILL_LIMITS.totalBytes};
|
|
98
|
+
* file count ≤ {@link SKILL_LIMITS.maxFiles}; paths must not escape (absolute paths, `..`,
|
|
99
|
+
* backslashes, drive letters, control characters), must not repeat
|
|
100
|
+
* (differing only in case also counts as repeating: they would overwrite each other on
|
|
101
|
+
* case-insensitive file systems), and a file must not share a name with a directory. Returns the
|
|
102
|
+
* list of problems; an empty array means valid.
|
|
93
103
|
*/
|
|
94
104
|
export declare function validateSkillPackage(files: {
|
|
95
105
|
path: string;
|
package/dist/skill.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Pure parsing and validation functions for skills (Agent Skills format): used when the kernel
|
|
3
|
+
* uploads a skill package and when an agent proposes a skill change.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
* - Agent Skills
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
5
|
+
* Format sources (verified 2026-10-21):
|
|
6
|
+
* - Agent Skills specification https://agentskills.io/specification : `name` is required, 1–64
|
|
7
|
+
* characters, only lowercase letters, digits and
|
|
8
|
+
* hyphens, must not start or end with a hyphen, no consecutive hyphens, and must match its
|
|
9
|
+
* directory name; `description` is required, 1–1024 characters;
|
|
10
|
+
* optional `license`, `compatibility` (1–500 characters), `metadata`, `allowed-tools`.
|
|
11
|
+
* - Anthropic docs https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview :
|
|
12
|
+
* `name` and `description` must not contain XML tags (there are also reserved words "anthropic" /
|
|
13
|
+
* "claude", which are Anthropic's own platform rules and
|
|
14
|
+
* are not adopted here).
|
|
11
15
|
*
|
|
12
16
|
* Choices: the description goes into the model's system prompt, so XML tags are refused as Anthropic
|
|
13
17
|
* does (no forged prompt structure). Keys outside the specification are allowed and ignored, so
|
|
@@ -19,24 +23,27 @@
|
|
|
19
23
|
* `/skills/<name>@<digest>/` ({@link skillSandboxDir}, {@link skillDigest}).
|
|
20
24
|
*/
|
|
21
25
|
import { createHash } from "node:crypto";
|
|
26
|
+
import { validateSandboxPath } from "./device-provider.js";
|
|
22
27
|
import { readFrontmatter } from "./frontmatter.js";
|
|
23
28
|
import { hasControlChars } from "./model.js";
|
|
24
|
-
import { validateSandboxPath } from "./sandbox.js";
|
|
25
29
|
import { argumentHintText, SKILL_ARGUMENT_NAME_RE } from "./skill-keys.js";
|
|
26
|
-
/**
|
|
30
|
+
/** Limits of a skill package. */
|
|
27
31
|
export const SKILL_LIMITS = {
|
|
28
32
|
nameMaxChars: 64,
|
|
29
33
|
descriptionMaxChars: 1024,
|
|
30
34
|
compatibilityMaxChars: 500,
|
|
31
|
-
/**
|
|
35
|
+
/** Upper bound of a single file after extraction (bytes). */
|
|
32
36
|
fileBytes: 10 * 1024 * 1024,
|
|
33
|
-
/**
|
|
37
|
+
/** Upper bound of the total of all files after extraction (bytes). */
|
|
34
38
|
totalBytes: 50 * 1024 * 1024,
|
|
35
|
-
/**
|
|
39
|
+
/** Upper bound on the number of files. */
|
|
36
40
|
maxFiles: 1000,
|
|
37
|
-
/**
|
|
41
|
+
/** Upper bound on the length of a relative path inside the package (characters). */
|
|
38
42
|
pathMaxChars: 512,
|
|
39
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Upper bound on the length of the frontmatter (between the two `---` lines) in characters; above
|
|
45
|
+
* it no YAML parsing is done.
|
|
46
|
+
*/
|
|
40
47
|
frontmatterMaxChars: 64 * 1024,
|
|
41
48
|
};
|
|
42
49
|
/** Limits of the invocation keys of a SKILL.md (see `SkillInvocation`). */
|
|
@@ -53,7 +60,7 @@ export const SKILL_INVOCATION_LIMITS = {
|
|
|
53
60
|
*/
|
|
54
61
|
renderedMaxChars: 200_000,
|
|
55
62
|
};
|
|
56
|
-
/**
|
|
63
|
+
/** The skill entry file (package root, case-sensitive). */
|
|
57
64
|
export const SKILL_ENTRY_FILE = "SKILL.md";
|
|
58
65
|
/**
|
|
59
66
|
* The sandbox root for skills: each skill version is copied (read-only to commands) to
|
|
@@ -63,7 +70,7 @@ export const SKILLS_SANDBOX_ROOT = "/skills";
|
|
|
63
70
|
const NAME_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
64
71
|
const XML_TAG_RE = /<\/?[A-Za-z][^<>]*>/;
|
|
65
72
|
const DRIVE_RE = /^[A-Za-z]:/;
|
|
66
|
-
/**
|
|
73
|
+
/** Whether it is a valid skill name (see the specification at the top of the file). */
|
|
67
74
|
export function isSkillName(s) {
|
|
68
75
|
return typeof s === "string" && s.length <= SKILL_LIMITS.nameMaxChars && NAME_RE.test(s);
|
|
69
76
|
}
|
|
@@ -94,8 +101,10 @@ export function skillSandboxPath(name, digest, path, root = SKILLS_SANDBOX_ROOT)
|
|
|
94
101
|
}
|
|
95
102
|
const chars = (s) => [...s].length;
|
|
96
103
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
104
|
+
* Parses SKILL.md: it starts with YAML frontmatter wrapped in `---` lines, followed by the body.
|
|
105
|
+
* Tolerates BOM and CRLF (CRLF in the body becomes LF).
|
|
106
|
+
* Returns name / description / body, or all problems (in English, directly showable to a model or
|
|
107
|
+
* an admin).
|
|
99
108
|
*/
|
|
100
109
|
export function parseSkillMd(text, options = {}) {
|
|
101
110
|
const read = readFrontmatter(text, "SKILL.md", SKILL_LIMITS.frontmatterMaxChars);
|
|
@@ -178,9 +187,9 @@ function invocationKeyErrors(fm) {
|
|
|
178
187
|
}
|
|
179
188
|
return errors;
|
|
180
189
|
}
|
|
181
|
-
/**
|
|
190
|
+
/** A path for humans to read: JSON-escaped when it contains control characters. */
|
|
182
191
|
const show = (p) => (hasControlChars(p) || p === "" ? JSON.stringify(p) : p);
|
|
183
|
-
/**
|
|
192
|
+
/** The problem of a single relative path (the first one), null when valid. */
|
|
184
193
|
function pathProblem(p) {
|
|
185
194
|
if (typeof p !== "string" || p === "")
|
|
186
195
|
return "path must be a non-empty string";
|
|
@@ -203,15 +212,20 @@ function pathProblem(p) {
|
|
|
203
212
|
if (seg === "." || seg === "..")
|
|
204
213
|
return "path must not contain '.' or '..' segments";
|
|
205
214
|
}
|
|
206
|
-
//
|
|
215
|
+
// Then check again against the sandbox path rules (percent-encoded `..` etc.)
|
|
207
216
|
const errs = validateSandboxPath(skillSandboxPath("skill", "000000000000", p));
|
|
208
217
|
return errs[0] ?? null;
|
|
209
218
|
}
|
|
210
219
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
220
|
+
* Validates a skill package's file list (paths relative to the package root, files only, no
|
|
221
|
+
* directory entries):
|
|
222
|
+
* the root must have `SKILL.md`; single file ≤ {@link SKILL_LIMITS.fileBytes}; total ≤ {@link
|
|
223
|
+
* SKILL_LIMITS.totalBytes};
|
|
224
|
+
* file count ≤ {@link SKILL_LIMITS.maxFiles}; paths must not escape (absolute paths, `..`,
|
|
225
|
+
* backslashes, drive letters, control characters), must not repeat
|
|
226
|
+
* (differing only in case also counts as repeating: they would overwrite each other on
|
|
227
|
+
* case-insensitive file systems), and a file must not share a name with a directory. Returns the
|
|
228
|
+
* list of problems; an empty array means valid.
|
|
215
229
|
*/
|
|
216
230
|
export function validateSkillPackage(files) {
|
|
217
231
|
if (files.length > SKILL_LIMITS.maxFiles) {
|