@capybara-hq/device 0.1.0-rc.17 → 0.1.0-rc.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +79 -0
  2. package/dist/activity.d.ts +31 -0
  3. package/dist/activity.js +62 -0
  4. package/dist/args.d.ts +18 -2
  5. package/dist/args.js +56 -8
  6. package/dist/cli.js +13 -2
  7. package/dist/commands/ceiling.js +22 -0
  8. package/dist/commands/keep-awake.d.ts +19 -0
  9. package/dist/commands/keep-awake.js +77 -0
  10. package/dist/commands/login.js +29 -16
  11. package/dist/commands/service.d.ts +3 -1
  12. package/dist/commands/service.js +35 -2
  13. package/dist/commands/start.d.ts +7 -0
  14. package/dist/commands/start.js +120 -1
  15. package/dist/commands/status.d.ts +8 -1
  16. package/dist/commands/status.js +50 -2
  17. package/dist/control/client.d.ts +12 -0
  18. package/dist/control/client.js +63 -0
  19. package/dist/control/protocol.d.ts +58 -0
  20. package/dist/control/protocol.js +16 -0
  21. package/dist/control/server.d.ts +28 -0
  22. package/dist/control/server.js +254 -0
  23. package/dist/exec/mac-operation-backend.d.ts +5 -0
  24. package/dist/exec/mac-operation-backend.js +1 -0
  25. package/dist/exec/operation-supervisor.d.ts +6 -0
  26. package/dist/exec/operation-supervisor.js +10 -0
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +1 -0
  29. package/dist/keep-awake.d.ts +39 -0
  30. package/dist/keep-awake.js +104 -0
  31. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/index.d.ts +3 -1
  32. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/index.js +3 -1
  33. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/permissions.js +3 -1
  34. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/shell-capabilities.d.ts +80 -0
  35. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/shell-capabilities.js +13 -0
  36. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/shell-environment.d.ts +57 -0
  37. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/shell-environment.js +16 -0
  38. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/ui-slots.d.ts +12 -0
  39. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/ui-slots.js +23 -0
  40. package/dist/node_modules/@capybara-hq/plugin-sdk/dist/ui.d.ts +6 -1
  41. package/dist/node_modules/@capybara-hq/plugin-sdk/package.json +1 -1
  42. package/dist/runtime-manifest.json +1 -1
  43. package/dist/server-ops.d.ts +3 -0
  44. package/dist/server-ops.js +33 -0
  45. package/dist/service/launchd.d.ts +2 -0
  46. package/dist/service/launchd.js +10 -4
  47. package/dist/service/manager.d.ts +2 -0
  48. package/dist/service/manager.js +16 -2
  49. package/dist/service/systemd.d.ts +2 -0
  50. package/dist/service/systemd.js +8 -2
  51. package/dist/staged-connect.d.ts +9 -0
  52. package/dist/staged-connect.js +24 -2
  53. package/dist/staged-device.js +6 -0
  54. package/dist/state.d.ts +9 -0
  55. package/dist/state.js +9 -1
  56. package/dist/wake.d.ts +23 -0
  57. package/dist/wake.js +29 -0
  58. package/package.json +2 -2
@@ -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,16 @@
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: "device@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
12
+ { key: "notify@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
13
+ { key: "openExternal@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md)" },
14
+ { key: "signIn@1", owner: "desktop client spec (2026-11-07-desktop-client-design.md), §6.5" },
15
+ { key: "chrome@1", owner: "mobile layout spec (2026-11-19-mobile-layout-design.md)" },
16
+ ];
@@ -3,6 +3,16 @@ export type UiSlotScope = "conversation" | "agent" | "org" | "platform" | "file"
3
3
  export type UiSlotRole = "guest" | "member" | "admin" | "superAdmin";
4
4
  /** Every slot id of the catalog, in catalog order (UI slots spec §3). */
5
5
  export declare const UI_SLOT_IDS: readonly ["conversation.panel", "conversation.properties.section", "conversation.tool-result.card", "org.page", "file.preview", "agent.detail.section", "org.settings.section", "platform.page", "shell.brand", "shell.overlay", "conversation.empty", "conversation.composer.frame"];
6
+ /**
7
+ * What a slot (or a contribution) becomes on a compact screen (mobile layout spec §5.6): `kept` =
8
+ * rendered in its place, `drawer` = moved into a sheet or pushed page, `hidden` = not rendered.
9
+ * Order of narrowing: `kept` < `drawer` < `hidden`.
10
+ */
11
+ export type CompactForm = "kept" | "drawer" | "hidden";
12
+ /** True when `v` is one of the three compact forms (used to validate manifests). */
13
+ export declare function isCompactForm(v: unknown): v is CompactForm;
14
+ /** A contribution may narrow its slot's compact form, never widen it. */
15
+ export declare function effectiveCompact(slot: CompactForm, contribution?: CompactForm): CompactForm;
6
16
  export type UiSlotId = (typeof UI_SLOT_IDS)[number];
7
17
  /** One slot of the catalog: where extension UI may go and what it receives (UI slots spec §3.1). */
8
18
  export interface UiSlotSpec {
@@ -27,6 +37,8 @@ export interface UiSlotSpec {
27
37
  args: readonly string[];
28
38
  density: "dense" | "regular";
29
39
  icon: "required" | "optional" | "none";
40
+ /** The slot's form on a compact screen (mobile layout spec §5.6). */
41
+ compact: CompactForm;
30
42
  /** Built-in parts a contribution may be placed after; the first is the default. */
31
43
  anchors?: readonly string[];
32
44
  limits?: {
@@ -13,6 +13,17 @@ export const UI_SLOT_IDS = [
13
13
  "conversation.empty",
14
14
  "conversation.composer.frame",
15
15
  ];
16
+ const COMPACT_ORDER = ["kept", "drawer", "hidden"];
17
+ /** True when `v` is one of the three compact forms (used to validate manifests). */
18
+ export function isCompactForm(v) {
19
+ return typeof v === "string" && COMPACT_ORDER.includes(v);
20
+ }
21
+ /** A contribution may narrow its slot's compact form, never widen it. */
22
+ export function effectiveCompact(slot, contribution) {
23
+ if (contribution === undefined)
24
+ return slot;
25
+ return COMPACT_ORDER.indexOf(contribution) > COMPACT_ORDER.indexOf(slot) ? contribution : slot;
26
+ }
16
27
  const SLOT_DATA = [
17
28
  {
18
29
  id: "conversation.panel",
@@ -25,6 +36,7 @@ const SLOT_DATA = [
25
36
  args: ["conversationId", "item"],
26
37
  density: "regular",
27
38
  icon: "optional",
39
+ compact: "drawer",
28
40
  description: {
29
41
  en: "A panel beside the conversation, opened from the right area.",
30
42
  zh: "对话旁的面板,从右侧区域打开。",
@@ -41,6 +53,7 @@ const SLOT_DATA = [
41
53
  args: ["conversationId"],
42
54
  density: "dense",
43
55
  icon: "optional",
56
+ compact: "kept",
44
57
  anchors: ["context", "files", "background"],
45
58
  description: {
46
59
  en: "A section in the conversation properties list.",
@@ -58,6 +71,7 @@ const SLOT_DATA = [
58
71
  args: ["conversationId", "card"],
59
72
  density: "regular",
60
73
  icon: "optional",
74
+ compact: "kept",
61
75
  description: {
62
76
  en: "A card a tool result opens in the conversation.",
63
77
  zh: "工具结果在对话中打开的卡片。",
@@ -74,6 +88,7 @@ const SLOT_DATA = [
74
88
  args: [],
75
89
  density: "regular",
76
90
  icon: "optional",
91
+ compact: "kept",
77
92
  description: {
78
93
  en: "A full page in the organization navigation.",
79
94
  zh: "组织导航中的完整页面。",
@@ -90,6 +105,7 @@ const SLOT_DATA = [
90
105
  args: ["conversationId", "fileId"],
91
106
  density: "regular",
92
107
  icon: "optional",
108
+ compact: "kept",
93
109
  description: {
94
110
  en: "A previewer for a file of the conversation.",
95
111
  zh: "对话中文件的预览器。",
@@ -106,6 +122,7 @@ const SLOT_DATA = [
106
122
  args: ["agentId"],
107
123
  density: "regular",
108
124
  icon: "optional",
125
+ compact: "kept",
109
126
  description: {
110
127
  en: "A section on the detail page of an agent.",
111
128
  zh: "智能体详情页中的一个分区。",
@@ -122,6 +139,7 @@ const SLOT_DATA = [
122
139
  args: [],
123
140
  density: "regular",
124
141
  icon: "optional",
142
+ compact: "kept",
125
143
  description: {
126
144
  en: "A section on the organization settings page.",
127
145
  zh: "组织设置页中的一个分区。",
@@ -138,6 +156,7 @@ const SLOT_DATA = [
138
156
  args: [],
139
157
  density: "regular",
140
158
  icon: "optional",
159
+ compact: "kept",
141
160
  description: {
142
161
  en: "A full page in the platform administration.",
143
162
  zh: "平台管理中的完整页面。",
@@ -156,6 +175,7 @@ const SLOT_DATA = [
156
175
  args: [],
157
176
  density: "regular",
158
177
  icon: "none",
178
+ compact: "hidden",
159
179
  description: {
160
180
  en: "The brand row of the sidebar (the mark of the collapsed rail).",
161
181
  zh: "侧边栏的品牌行(收起后的窄栏标记)。",
@@ -172,6 +192,7 @@ const SLOT_DATA = [
172
192
  args: [],
173
193
  density: "regular",
174
194
  icon: "none",
195
+ compact: "kept",
175
196
  limits: { maxShown: 4 },
176
197
  description: {
177
198
  en: "A full-viewport layer over the workspace shell.",
@@ -191,6 +212,7 @@ const SLOT_DATA = [
191
212
  args: [],
192
213
  density: "regular",
193
214
  icon: "none",
215
+ compact: "kept",
194
216
  description: {
195
217
  en: "The hero of the new-conversation page.",
196
218
  zh: "新对话页的主视觉区。",
@@ -209,6 +231,7 @@ const SLOT_DATA = [
209
231
  args: [],
210
232
  density: "regular",
211
233
  icon: "none",
234
+ compact: "kept",
212
235
  description: {
213
236
  en: "The frame around the composer, on the new-conversation and conversation pages.",
214
237
  zh: "新对话页与对话页中输入框外的边框。",
@@ -1,6 +1,6 @@
1
1
  import type { Locale } from "./cards.js";
2
2
  import { type FormAnswer, type InputForm } from "./tool.js";
3
- import type { UiSlotId, UiSlotScope } from "./ui-slots.js";
3
+ import type { CompactForm, UiSlotId, UiSlotScope } from "./ui-slots.js";
4
4
  /**
5
5
  * Icons a contribution may use (design system icon names; `puzzle` is the default and is drawn as
6
6
  * the design `extension` icon). The title-bar button of a panel shows it.
@@ -50,6 +50,11 @@ export interface UiContribution {
50
50
  path?: string;
51
51
  /** Icon from {@link UI_ICONS}; default `puzzle`. */
52
52
  icon?: UiIcon;
53
+ /**
54
+ * The form on a compact screen; may only narrow the slot's own (`kept` -> `drawer` -> `hidden`),
55
+ * see `effectiveCompact`. Omitted = the slot's form.
56
+ */
57
+ compact?: CompactForm;
53
58
  }
54
59
  /**
55
60
  * Blocks of the render schema. Text is for humans and shown as is (the plugin decides the language
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.37",
3
+ "version": "0.1.0-rc.38",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {