@capybara-hq/plugin-sdk 0.1.0-rc.9 → 0.1.0-rc.90

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 (159) hide show
  1. package/README.md +3 -1
  2. package/agent-docs/agent-templates.md +14 -2
  3. package/agent-docs/concepts.md +14 -5
  4. package/agent-docs/connector-templates.md +11 -3
  5. package/agent-docs/extension-points/channel.md +1 -1
  6. package/agent-docs/extension-points/context.md +15 -0
  7. package/agent-docs/extension-points/device-provider.md +15 -0
  8. package/agent-docs/extension-points/file-preview.md +3 -1
  9. package/agent-docs/extension-points/identity-source.md +2 -0
  10. package/agent-docs/extension-points/model-provider.md +5 -1
  11. package/agent-docs/extension-points/object-store.md +2 -0
  12. package/agent-docs/extension-points/push-provider.md +17 -0
  13. package/agent-docs/extension-points/trigger-source.md +19 -0
  14. package/agent-docs/extensions.md +98 -4
  15. package/agent-docs/plugin-format.md +45 -10
  16. package/agent-docs/setup.md +54 -0
  17. package/api/plugin-sdk.api.md +5983 -0
  18. package/dist/agent-template.d.ts +15 -6
  19. package/dist/agent-template.js +32 -13
  20. package/dist/agents-ctx.d.ts +116 -0
  21. package/dist/agents-ctx.js +22 -0
  22. package/dist/avatar-presets.d.ts +8 -0
  23. package/dist/avatar-presets.js +17 -0
  24. package/dist/bootstrap.d.ts +109 -1
  25. package/dist/bootstrap.js +185 -2
  26. package/dist/cards.d.ts +121 -13
  27. package/dist/cards.js +161 -19
  28. package/dist/channel.d.ts +133 -47
  29. package/dist/channel.js +10 -5
  30. package/dist/client-css.d.ts +36 -0
  31. package/dist/client-css.js +326 -0
  32. package/dist/client-section.d.ts +35 -0
  33. package/dist/client-section.js +133 -0
  34. package/dist/config-ui.d.ts +28 -6
  35. package/dist/config-ui.js +88 -25
  36. package/dist/config-url-fetch.d.ts +19 -0
  37. package/dist/config-url-fetch.js +43 -0
  38. package/dist/connector-auth.d.ts +13 -2
  39. package/dist/connector-auth.js +82 -8
  40. package/dist/connector.d.ts +74 -32
  41. package/dist/context.d.ts +40 -0
  42. package/dist/context.js +2 -0
  43. package/dist/ctx.d.ts +344 -31
  44. package/dist/ctx.js +9 -1
  45. package/dist/define-extension.d.ts +18 -12
  46. package/dist/define-extension.js +18 -5
  47. package/dist/device-denied-paths.d.ts +20 -0
  48. package/dist/device-denied-paths.js +118 -0
  49. package/dist/device-operation.d.ts +348 -0
  50. package/dist/device-operation.js +312 -0
  51. package/dist/device-protocol.d.ts +286 -49
  52. package/dist/device-protocol.js +766 -89
  53. package/dist/device-provider.d.ts +820 -0
  54. package/dist/device-provider.js +432 -0
  55. package/dist/device-service.d.ts +204 -0
  56. package/dist/device-service.js +291 -0
  57. package/dist/dial-in.d.ts +286 -0
  58. package/dist/dial-in.js +213 -0
  59. package/dist/directory.d.ts +15 -12
  60. package/dist/extension-point.d.ts +2 -0
  61. package/dist/extension-point.js +8 -3
  62. package/dist/field-meta.d.ts +19 -0
  63. package/dist/field-meta.js +54 -0
  64. package/dist/file-preview.d.ts +46 -9
  65. package/dist/git-hosts.d.ts +53 -0
  66. package/dist/git-hosts.js +98 -0
  67. package/dist/hooks.d.ts +185 -22
  68. package/dist/hooks.js +6 -0
  69. package/dist/http-access.d.ts +71 -0
  70. package/dist/http-access.js +12 -0
  71. package/dist/identity.d.ts +70 -9
  72. package/dist/identity.js +46 -1
  73. package/dist/inbox.d.ts +103 -0
  74. package/dist/inbox.js +173 -0
  75. package/dist/index.d.ts +30 -4
  76. package/dist/index.js +30 -4
  77. package/dist/model-params.d.ts +41 -22
  78. package/dist/model-params.js +28 -15
  79. package/dist/model.d.ts +295 -77
  80. package/dist/model.js +249 -21
  81. package/dist/native-failure.d.ts +13 -0
  82. package/dist/native-failure.js +31 -0
  83. package/dist/net.d.ts +52 -0
  84. package/dist/net.js +34 -0
  85. package/dist/network-classes.d.ts +98 -0
  86. package/dist/network-classes.js +291 -0
  87. package/dist/permissions.d.ts +95 -25
  88. package/dist/permissions.js +175 -54
  89. package/dist/platform-only.d.ts +27 -0
  90. package/dist/platform-only.js +35 -0
  91. package/dist/plugin-manifest.d.ts +30 -6
  92. package/dist/plugin-manifest.js +147 -55
  93. package/dist/plugin-package.d.ts +82 -39
  94. package/dist/plugin-package.js +68 -41
  95. package/dist/push.d.ts +75 -0
  96. package/dist/push.js +87 -0
  97. package/dist/sandbox-linux-runtime-source.d.ts +1 -0
  98. package/dist/sandbox-linux-runtime-source.js +2343 -0
  99. package/dist/sandbox-native-runtime-source.d.ts +10 -0
  100. package/dist/sandbox-native-runtime-source.js +480 -0
  101. package/dist/sandbox-runtime-source.d.ts +47 -0
  102. package/dist/sandbox-runtime-source.js +73 -0
  103. package/dist/sandbox-write-denies.d.ts +139 -0
  104. package/dist/sandbox-write-denies.js +869 -0
  105. package/dist/secret.d.ts +8 -2
  106. package/dist/secret.js +11 -4
  107. package/dist/setup-check.d.ts +128 -0
  108. package/dist/setup-check.js +142 -0
  109. package/dist/setup-guide-parse.d.ts +121 -0
  110. package/dist/setup-guide-parse.js +356 -0
  111. package/dist/setup-guide-render.d.ts +45 -0
  112. package/dist/setup-guide-render.js +351 -0
  113. package/dist/setup-guide.d.ts +86 -72
  114. package/dist/setup-guide.js +340 -108
  115. package/dist/shell-capabilities.d.ts +216 -0
  116. package/dist/shell-capabilities.js +44 -0
  117. package/dist/shell-environment.d.ts +57 -0
  118. package/dist/shell-environment.js +21 -0
  119. package/dist/skill-invocation.d.ts +5 -0
  120. package/dist/skill-invocation.js +4 -3
  121. package/dist/skill.d.ts +27 -17
  122. package/dist/skill.js +40 -26
  123. package/dist/storage.d.ts +52 -25
  124. package/dist/svg-viewbox.d.ts +10 -0
  125. package/dist/svg-viewbox.js +24 -0
  126. package/dist/theme-assets.d.ts +25 -9
  127. package/dist/theme-assets.js +87 -47
  128. package/dist/theme-tokens.generated.d.ts +40 -12
  129. package/dist/theme-tokens.generated.js +36 -8
  130. package/dist/theme.d.ts +56 -10
  131. package/dist/theme.js +117 -23
  132. package/dist/tool.d.ts +242 -28
  133. package/dist/tool.js +135 -13
  134. package/dist/trigger-source.d.ts +35 -0
  135. package/dist/trigger-source.js +2 -0
  136. package/dist/triggers.d.ts +88 -0
  137. package/dist/triggers.js +71 -0
  138. package/dist/ui-parts.d.ts +23 -0
  139. package/dist/ui-parts.js +374 -0
  140. package/dist/ui-resolve.d.ts +2 -7
  141. package/dist/ui-resolve.js +7 -19
  142. package/dist/ui-slots.d.ts +27 -5
  143. package/dist/ui-slots.js +112 -19
  144. package/dist/ui.d.ts +203 -64
  145. package/dist/ui.js +117 -23
  146. package/dist/url.d.ts +4 -1
  147. package/dist/url.js +4 -1
  148. package/dist/web.d.ts +26 -20
  149. package/package.json +13 -1
  150. package/schemas/bootstrap-extra.v1.schema.json +186 -0
  151. package/schemas/bootstrap.v1.schema.json +20 -0
  152. package/schemas/connector-template.v1.schema.json +62 -4
  153. package/schemas/plugin.v1.schema.json +74 -143
  154. package/schemas/theme.v1.schema.json +77 -0
  155. package/agent-docs/extension-points/sandbox.md +0 -15
  156. package/dist/org-access.d.ts +0 -27
  157. package/dist/org-access.js +0 -35
  158. package/dist/sandbox.d.ts +0 -254
  159. package/dist/sandbox.js +0 -153
@@ -1,8 +1,18 @@
1
- import type { UiKind, UiPlace } from "./ui.js";
1
+ import type { UiKind } from "./ui.js";
2
2
  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
- 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"];
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 {
@@ -13,12 +23,22 @@ export interface UiSlotSpec {
13
23
  owner: string;
14
24
  scope: UiSlotScope;
15
25
  accepts: readonly UiKind[];
16
- cardinality: "list";
26
+ /** `single`: one winner replaces the built-in; `list`: every contribution is shown. */
27
+ cardinality: "list" | "single";
28
+ /** A single slot replaces a built-in block (client extensions spec §6.1). */
29
+ replaceable?: true;
30
+ /** What a replaceable slot shows without a winner. */
31
+ builtin?: {
32
+ en: string;
33
+ zh: string;
34
+ };
17
35
  minRole: UiSlotRole;
18
36
  /** Context ids passed to render (`conversationId`, `agentId`, …). */
19
37
  args: readonly string[];
20
38
  density: "dense" | "regular";
21
39
  icon: "required" | "optional" | "none";
40
+ /** The slot's form on a compact screen (mobile layout spec §5.6). */
41
+ compact: CompactForm;
22
42
  /** Built-in parts a contribution may be placed after; the first is the default. */
23
43
  anchors?: readonly string[];
24
44
  limits?: {
@@ -36,8 +56,10 @@ export declare function parseSlotRef(ref: string): {
36
56
  id: string;
37
57
  version: number;
38
58
  } | null;
39
- /** @deprecated step A of the UI slots spec §4 */
40
- export declare const PLACE_SLOTS: Readonly<Record<UiPlace, UiSlotId>>;
41
59
  export declare const UI_ARRANGEABLE_SLOTS: readonly UiSlotId[];
60
+ /** Slots with one winner that replaces a built-in block. */
61
+ export declare const UI_SINGLE_SLOTS: readonly UiSlotId[];
62
+ /** Slots that accept the `component` kind. */
63
+ export declare const UI_COMPONENT_SLOTS: readonly UiSlotId[];
42
64
  export declare const UI_CONTRIBUTION_KEY_RE: RegExp;
43
65
  export declare function uiContributionKey(plugin: string, id: string): string;
package/dist/ui-slots.js CHANGED
@@ -8,19 +8,35 @@ export const UI_SLOT_IDS = [
8
8
  "agent.detail.section",
9
9
  "org.settings.section",
10
10
  "platform.page",
11
+ "shell.brand",
12
+ "shell.overlay",
13
+ "conversation.empty",
14
+ "conversation.composer.frame",
11
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
+ }
12
27
  const SLOT_DATA = [
13
28
  {
14
29
  id: "conversation.panel",
15
30
  version: 1,
16
31
  owner: "components/conversation/RightArea.tsx",
17
32
  scope: "conversation",
18
- accepts: ["view", "embed"],
33
+ accepts: ["view", "embed", "component"],
19
34
  cardinality: "list",
20
35
  minRole: "guest",
21
36
  args: ["conversationId", "item"],
22
37
  density: "regular",
23
38
  icon: "optional",
39
+ compact: "drawer",
24
40
  description: {
25
41
  en: "A panel beside the conversation, opened from the right area.",
26
42
  zh: "对话旁的面板,从右侧区域打开。",
@@ -31,12 +47,13 @@ const SLOT_DATA = [
31
47
  version: 1,
32
48
  owner: "components/conversation/PropertiesSections.tsx",
33
49
  scope: "conversation",
34
- accepts: ["view", "embed"],
50
+ accepts: ["view", "embed", "component"],
35
51
  cardinality: "list",
36
52
  minRole: "guest",
37
53
  args: ["conversationId"],
38
54
  density: "dense",
39
55
  icon: "optional",
56
+ compact: "kept",
40
57
  anchors: ["context", "files", "background"],
41
58
  description: {
42
59
  en: "A section in the conversation properties list.",
@@ -48,12 +65,13 @@ const SLOT_DATA = [
48
65
  version: 1,
49
66
  owner: "components/conversation/RightArea.tsx",
50
67
  scope: "conversation",
51
- accepts: ["view", "embed"],
68
+ accepts: ["view", "embed", "component"],
52
69
  cardinality: "list",
53
70
  minRole: "guest",
54
71
  args: ["conversationId", "card"],
55
72
  density: "regular",
56
73
  icon: "optional",
74
+ compact: "kept",
57
75
  description: {
58
76
  en: "A card a tool result opens in the conversation.",
59
77
  zh: "工具结果在对话中打开的卡片。",
@@ -64,15 +82,16 @@ const SLOT_DATA = [
64
82
  version: 1,
65
83
  owner: "app/(app)/p/[plugin]/[id]/view.tsx",
66
84
  scope: "org",
67
- accepts: ["view", "embed"],
85
+ accepts: ["view", "embed", "component"],
68
86
  cardinality: "list",
69
87
  minRole: "member",
70
- args: [],
88
+ args: ["params"],
71
89
  density: "regular",
72
90
  icon: "optional",
91
+ compact: "kept",
73
92
  description: {
74
- en: "A full page in the organization navigation.",
75
- zh: "组织导航中的完整页面。",
93
+ en: "A full page in the organization navigation. Only component contributions receive `params` (the page query string); views and embeds do not.",
94
+ zh: "组织导航中的完整页面。只有 component 贡献会收到 `params`(页面查询串),view 与 embed 不会。",
76
95
  },
77
96
  },
78
97
  {
@@ -86,6 +105,7 @@ const SLOT_DATA = [
86
105
  args: ["conversationId", "fileId"],
87
106
  density: "regular",
88
107
  icon: "optional",
108
+ compact: "kept",
89
109
  description: {
90
110
  en: "A previewer for a file of the conversation.",
91
111
  zh: "对话中文件的预览器。",
@@ -96,12 +116,13 @@ const SLOT_DATA = [
96
116
  version: 1,
97
117
  owner: "components/agent/AgentPage.tsx",
98
118
  scope: "agent",
99
- accepts: ["view", "embed"],
119
+ accepts: ["view", "embed", "component"],
100
120
  cardinality: "list",
101
121
  minRole: "guest",
102
122
  args: ["agentId"],
103
123
  density: "regular",
104
124
  icon: "optional",
125
+ compact: "kept",
105
126
  description: {
106
127
  en: "A section on the detail page of an agent.",
107
128
  zh: "智能体详情页中的一个分区。",
@@ -112,12 +133,13 @@ const SLOT_DATA = [
112
133
  version: 1,
113
134
  owner: "app/(app)/settings/organization/view.tsx",
114
135
  scope: "org",
115
- accepts: ["view", "embed"],
136
+ accepts: ["view", "embed", "component"],
116
137
  cardinality: "list",
117
138
  minRole: "admin",
118
139
  args: [],
119
140
  density: "regular",
120
141
  icon: "optional",
142
+ compact: "kept",
121
143
  description: {
122
144
  en: "A section on the organization settings page.",
123
145
  zh: "组织设置页中的一个分区。",
@@ -128,17 +150,93 @@ const SLOT_DATA = [
128
150
  version: 1,
129
151
  owner: "app/(app)/admin/p/[plugin]/[id]/view.tsx",
130
152
  scope: "platform",
131
- accepts: ["view", "embed"],
153
+ accepts: ["view", "embed", "component"],
132
154
  cardinality: "list",
133
155
  minRole: "superAdmin",
134
156
  args: [],
135
157
  density: "regular",
136
158
  icon: "optional",
159
+ compact: "kept",
137
160
  description: {
138
161
  en: "A full page in the platform administration.",
139
162
  zh: "平台管理中的完整页面。",
140
163
  },
141
164
  },
165
+ {
166
+ id: "shell.brand",
167
+ version: 1,
168
+ owner: "components/shell/AppFrame.tsx",
169
+ scope: "org",
170
+ accepts: ["component"],
171
+ cardinality: "single",
172
+ replaceable: true,
173
+ builtin: { en: "The logo and wordmark in the sidebar.", zh: "侧边栏中的标志与字标。" },
174
+ minRole: "guest",
175
+ args: [],
176
+ density: "regular",
177
+ icon: "none",
178
+ compact: "hidden",
179
+ description: {
180
+ en: "The brand row of the sidebar (the mark of the collapsed rail).",
181
+ zh: "侧边栏的品牌行(收起后的窄栏标记)。",
182
+ },
183
+ },
184
+ {
185
+ id: "shell.overlay",
186
+ version: 1,
187
+ owner: "components/shell/AppFrame.tsx",
188
+ scope: "org",
189
+ accepts: ["component"],
190
+ cardinality: "list",
191
+ minRole: "guest",
192
+ args: [],
193
+ density: "regular",
194
+ icon: "none",
195
+ compact: "kept",
196
+ limits: { maxShown: 4 },
197
+ description: {
198
+ en: "A full-viewport layer over the workspace shell.",
199
+ zh: "覆盖工作区外壳的全视口图层。",
200
+ },
201
+ },
202
+ {
203
+ id: "conversation.empty",
204
+ version: 1,
205
+ owner: "components/conversation/NewConversation.tsx",
206
+ scope: "org",
207
+ accepts: ["component"],
208
+ cardinality: "single",
209
+ replaceable: true,
210
+ builtin: { en: "The greeting of the new-conversation page.", zh: "新对话页的问候区。" },
211
+ minRole: "guest",
212
+ args: [],
213
+ density: "regular",
214
+ icon: "none",
215
+ compact: "kept",
216
+ description: {
217
+ en: "The hero of the new-conversation page.",
218
+ zh: "新对话页的主视觉区。",
219
+ },
220
+ },
221
+ {
222
+ id: "conversation.composer.frame",
223
+ version: 1,
224
+ owner: "components/conversation/ComposerBar.tsx",
225
+ scope: "org",
226
+ accepts: ["component"],
227
+ cardinality: "single",
228
+ replaceable: true,
229
+ builtin: { en: "The frame around the message composer.", zh: "消息输入框外的边框。" },
230
+ minRole: "guest",
231
+ args: [],
232
+ density: "regular",
233
+ icon: "none",
234
+ compact: "kept",
235
+ description: {
236
+ en: "The frame around the composer, on the new-conversation and conversation pages.",
237
+ zh: "新对话页与对话页中输入框外的边框。",
238
+ },
239
+ },
142
240
  ];
143
241
  export const UI_SLOTS = SLOT_DATA;
144
242
  export function uiSlot(id) {
@@ -152,16 +250,11 @@ export function parseSlotRef(ref) {
152
250
  return null;
153
251
  return { id: m[1], version: m[2] === undefined ? 1 : Number(m[2]) };
154
252
  }
155
- /** @deprecated step A of the UI slots spec §4 */
156
- export const PLACE_SLOTS = {
157
- panel: "conversation.panel",
158
- conversation: "conversation.panel",
159
- section: "conversation.properties.section",
160
- inline: "conversation.tool-result.card",
161
- page: "org.page",
162
- "file-preview": "file.preview",
163
- };
164
253
  export const UI_ARRANGEABLE_SLOTS = UI_SLOT_IDS.filter((id) => id !== "file.preview");
254
+ /** Slots with one winner that replaces a built-in block. */
255
+ export const UI_SINGLE_SLOTS = UI_SLOTS.filter((s) => s.cardinality === "single").map((s) => s.id);
256
+ /** Slots that accept the `component` kind. */
257
+ export const UI_COMPONENT_SLOTS = UI_SLOTS.filter((s) => s.accepts.includes("component")).map((s) => s.id);
165
258
  export const UI_CONTRIBUTION_KEY_RE = /^[a-z][a-z0-9-]{1,40}\/[a-z][a-z0-9-]{0,39}$/;
166
259
  export function uiContributionKey(plugin, id) {
167
260
  return `${plugin}/${id}`;