@capybara-hq/plugin-sdk 0.1.0-rc.43 → 0.1.0-rc.44

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.
@@ -101,6 +101,14 @@ export interface LegacyDeviceHello {
101
101
  * A malformed value is dropped by the parser.
102
102
  */
103
103
  bootId?: string;
104
+ /**
105
+ * The identity of this run of the program: random, chosen once when the process starts and
106
+ * the same on every connection it makes (never the OS pid). The results a program keeps for a
107
+ * reconnect live in its memory, so a value that differs from the one a request was sent to
108
+ * proves that request's result can no longer arrive: the kernel ends its wait at once instead of
109
+ * at the deadline. Same format as {@link bootId}; a malformed value is dropped by the parser.
110
+ */
111
+ programRunId?: string;
104
112
  }
105
113
  /** A hello's `bootId`: 1 to 128 characters of letters, digits, `.`, `_`, `:` and `-`. */
106
114
  export declare const DEVICE_BOOT_ID_RE: RegExp;
@@ -278,6 +278,8 @@ function optionalHelloFields(o) {
278
278
  }
279
279
  if (isDeviceBootId(o.bootId))
280
280
  out.bootId = o.bootId;
281
+ if (isDeviceBootId(o.programRunId))
282
+ out.programRunId = o.programRunId;
281
283
  return { ...out, ...optionalPolicy(o.policy) };
282
284
  }
283
285
  /** A summary field that is dropped when absent or unreadable. */
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "0.1.0-rc.43";
1
+ export declare const SDK_VERSION = "0.1.0-rc.44";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./bootstrap.js";
4
4
  export * from "./cards.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = "0.1.0-rc.43";
1
+ export const SDK_VERSION = "0.1.0-rc.44";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./bootstrap.js";
4
4
  export * from "./cards.js";
@@ -6,10 +6,14 @@
6
6
  */
7
7
  /** Capability keys, `name@major`; each value is a key of `SHELL_CAPABILITIES`. */
8
8
  export declare const SHELL_CAPABILITY_KEYS: {
9
+ readonly chrome: "chrome@1";
9
10
  readonly device: "device@1";
10
11
  readonly notify: "notify@1";
11
12
  readonly openExternal: "openExternal@1";
12
13
  readonly signIn: "signIn@1";
14
+ readonly haptics: "haptics@1";
15
+ readonly share: "share@1";
16
+ readonly menu: "menu@1";
13
17
  };
14
18
  export type KeepAwakeMode = "off" | "while-busy" | "connected";
15
19
  export type DeviceConnection = "starting" | "online" | "offline" | "draining" | "stopped";
@@ -86,3 +90,78 @@ export interface OpenExternalCapabilityV1 {
86
90
  export interface SignInCapabilityV1 {
87
91
  start(): Promise<"signedIn" | "cancelled">;
88
92
  }
93
+ /**
94
+ * The page's main color tokens (the computed `--cb-bg`, `--cb-panel`, `--cb-ink`, `--cb-muted`,
95
+ * `--cb-line`, `--cb-accent`, `--cb-on-accent`), each a CSS hex or `rgb()` / `rgba()` color. The
96
+ * shell validates them and uses them only as custom properties of its own pages, never as markup.
97
+ */
98
+ export interface ShellChromeTokens {
99
+ bg: string;
100
+ panel: string;
101
+ ink: string;
102
+ muted: string;
103
+ line: string;
104
+ accent: string;
105
+ onAccent: string;
106
+ }
107
+ /**
108
+ * `chrome@1` (mobile layout spec §9.2): the native chrome (window background, title bar, the
109
+ * shell's own pages) follows the page's theme. `tokens` is sent only when all seven are colors;
110
+ * `singleScheme` is true under a UI theme with one scheme (no light / dark toggle on either side).
111
+ */
112
+ export interface ChromeCapabilityV1 {
113
+ setAppearance(input: {
114
+ scheme: "light" | "dark";
115
+ background: string;
116
+ tokens?: ShellChromeTokens;
117
+ singleScheme?: boolean;
118
+ }): Promise<void>;
119
+ /** The web's first paint is done (mobile app spec §5.2); a shell may leave it out. */
120
+ ready?(): Promise<void>;
121
+ }
122
+ export type HapticKind = "selection" | "light" | "success" | "warning";
123
+ /** `haptics@1`: a haptic impact (mobile app spec §5.2). */
124
+ export interface HapticsCapabilityV1 {
125
+ impact(kind: HapticKind): Promise<void>;
126
+ }
127
+ export interface ShareInputV1 {
128
+ title?: string;
129
+ text?: string;
130
+ url?: string;
131
+ }
132
+ /** `share@1`: the system share sheet; resolves whether shared or dismissed. */
133
+ export interface ShareCapabilityV1 {
134
+ share(input: ShareInputV1): Promise<void>;
135
+ }
136
+ export interface MenuItemV1 {
137
+ id: string;
138
+ label: string;
139
+ destructive?: boolean;
140
+ disabled?: boolean;
141
+ }
142
+ export interface MenuInputV1 {
143
+ title?: string;
144
+ items: MenuItemV1[];
145
+ /** A rect in CSS px from the web view's top-left corner. */
146
+ anchor?: {
147
+ x: number;
148
+ y: number;
149
+ width: number;
150
+ height: number;
151
+ };
152
+ }
153
+ /** `menu@1`: a native menu; resolves the chosen item id, or null when dismissed. */
154
+ export interface MenuCapabilityV1 {
155
+ show(input: MenuInputV1): Promise<string | null>;
156
+ }
157
+ /** The shell validates every input against these (and the web keeps within them). */
158
+ export declare const MOBILE_SHELL_LIMITS: {
159
+ readonly menuItems: 12;
160
+ readonly menuLabel: 64;
161
+ readonly menuTitle: 128;
162
+ readonly shareTitle: 256;
163
+ readonly shareText: 4000;
164
+ readonly url: 2048;
165
+ };
166
+ /** The menu item id pattern, checked on `menu@1.show` (the shell validates every input). */
167
+ export declare const MENU_ITEM_ID: RegExp;
@@ -6,8 +6,23 @@
6
6
  */
7
7
  /** Capability keys, `name@major`; each value is a key of `SHELL_CAPABILITIES`. */
8
8
  export const SHELL_CAPABILITY_KEYS = {
9
+ chrome: "chrome@1",
9
10
  device: "device@1",
10
11
  notify: "notify@1",
11
12
  openExternal: "openExternal@1",
12
13
  signIn: "signIn@1",
14
+ haptics: "haptics@1",
15
+ share: "share@1",
16
+ menu: "menu@1",
13
17
  };
18
+ /** The shell validates every input against these (and the web keeps within them). */
19
+ export const MOBILE_SHELL_LIMITS = {
20
+ menuItems: 12,
21
+ menuLabel: 64,
22
+ menuTitle: 128,
23
+ shareTitle: 256,
24
+ shareText: 4000,
25
+ url: 2048,
26
+ };
27
+ /** The menu item id pattern, checked on `menu@1.show` (the shell validates every input). */
28
+ export const MENU_ITEM_ID = /^[A-Za-z0-9_.-]{1,64}$/;
@@ -13,4 +13,7 @@ export const SHELL_CAPABILITIES = [
13
13
  { key: "openExternal@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
14
14
  { key: "signIn@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md), §6.5" },
15
15
  { key: "chrome@1", owner: "mobile layout spec (2026-11-19-mobile-layout-design.md)" },
16
+ { key: "haptics@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
17
+ { key: "share@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
18
+ { key: "menu@1", owner: "mobile app spec (2026-11-20-mobile-app-design.md), §5.2" },
16
19
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.43",
3
+ "version": "0.1.0-rc.44",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {