@capybara-hq/plugin-sdk 0.1.0-rc.6 → 0.1.0-rc.61

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 (136) hide show
  1. package/README.md +1 -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 +7 -1
  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 +2 -0
  9. package/agent-docs/extension-points/model-provider.md +3 -1
  10. package/agent-docs/extension-points/object-store.md +2 -0
  11. package/agent-docs/extension-points/push-provider.md +17 -0
  12. package/agent-docs/extensions.md +29 -3
  13. package/agent-docs/plugin-format.md +52 -2
  14. package/agent-docs/setup.md +54 -0
  15. package/dist/agent-template.d.ts +15 -6
  16. package/dist/agent-template.js +32 -13
  17. package/dist/avatar-presets.d.ts +8 -0
  18. package/dist/avatar-presets.js +17 -0
  19. package/dist/bootstrap.d.ts +109 -1
  20. package/dist/bootstrap.js +185 -2
  21. package/dist/cards.d.ts +67 -13
  22. package/dist/cards.js +91 -21
  23. package/dist/channel.d.ts +148 -48
  24. package/dist/channel.js +10 -5
  25. package/dist/client-css.d.ts +36 -0
  26. package/dist/client-css.js +326 -0
  27. package/dist/client-section.d.ts +35 -0
  28. package/dist/client-section.js +133 -0
  29. package/dist/config-ui.d.ts +22 -0
  30. package/dist/config-ui.js +64 -4
  31. package/dist/connector-auth.d.ts +15 -2
  32. package/dist/connector-auth.js +97 -8
  33. package/dist/connector.d.ts +74 -32
  34. package/dist/context.d.ts +40 -0
  35. package/dist/context.js +2 -0
  36. package/dist/ctx.d.ts +132 -29
  37. package/dist/define-extension.d.ts +26 -12
  38. package/dist/define-extension.js +12 -5
  39. package/dist/device-denied-paths.d.ts +18 -0
  40. package/dist/device-denied-paths.js +84 -0
  41. package/dist/device-operation.d.ts +333 -0
  42. package/dist/device-operation.js +312 -0
  43. package/dist/device-protocol.d.ts +285 -50
  44. package/dist/device-protocol.js +755 -90
  45. package/dist/device-provider.d.ts +503 -0
  46. package/dist/device-provider.js +302 -0
  47. package/dist/dial-in.d.ts +176 -0
  48. package/dist/dial-in.js +115 -0
  49. package/dist/extension-point.d.ts +2 -0
  50. package/dist/extension-point.js +6 -2
  51. package/dist/file-preview.d.ts +23 -6
  52. package/dist/git-hosts.d.ts +53 -0
  53. package/dist/git-hosts.js +98 -0
  54. package/dist/hooks.d.ts +125 -20
  55. package/dist/hooks.js +5 -0
  56. package/dist/http-access.d.ts +62 -0
  57. package/dist/http-access.js +12 -0
  58. package/dist/identity.d.ts +38 -9
  59. package/dist/identity.js +21 -1
  60. package/dist/index.d.ts +29 -3
  61. package/dist/index.js +29 -3
  62. package/dist/marketplace.d.ts +26 -0
  63. package/dist/marketplace.js +43 -1
  64. package/dist/model-params.d.ts +41 -22
  65. package/dist/model-params.js +28 -15
  66. package/dist/model.d.ts +206 -71
  67. package/dist/model.js +152 -19
  68. package/dist/net.d.ts +52 -0
  69. package/dist/net.js +34 -0
  70. package/dist/network-classes.d.ts +98 -0
  71. package/dist/network-classes.js +291 -0
  72. package/dist/permissions.d.ts +54 -22
  73. package/dist/permissions.js +119 -43
  74. package/dist/plugin-manifest.d.ts +45 -5
  75. package/dist/plugin-manifest.js +174 -6
  76. package/dist/plugin-package.d.ts +82 -38
  77. package/dist/plugin-package.js +61 -29
  78. package/dist/push.d.ts +75 -0
  79. package/dist/push.js +87 -0
  80. package/dist/sandbox-linux-runtime-source.d.ts +1 -0
  81. package/dist/sandbox-linux-runtime-source.js +2318 -0
  82. package/dist/sandbox-native-runtime-source.d.ts +10 -0
  83. package/dist/sandbox-native-runtime-source.js +476 -0
  84. package/dist/sandbox-runtime-source.d.ts +19 -0
  85. package/dist/sandbox-runtime-source.js +28 -0
  86. package/dist/sandbox-write-denies.d.ts +139 -0
  87. package/dist/sandbox-write-denies.js +869 -0
  88. package/dist/secret.d.ts +4 -1
  89. package/dist/secret.js +4 -1
  90. package/dist/setup-check.d.ts +128 -0
  91. package/dist/setup-check.js +142 -0
  92. package/dist/setup-guide-parse.d.ts +121 -0
  93. package/dist/setup-guide-parse.js +356 -0
  94. package/dist/setup-guide-render.d.ts +45 -0
  95. package/dist/setup-guide-render.js +351 -0
  96. package/dist/setup-guide.d.ts +108 -0
  97. package/dist/setup-guide.js +367 -0
  98. package/dist/shell-capabilities.d.ts +211 -0
  99. package/dist/shell-capabilities.js +44 -0
  100. package/dist/shell-environment.d.ts +57 -0
  101. package/dist/shell-environment.js +21 -0
  102. package/dist/skill.d.ts +27 -17
  103. package/dist/skill.js +40 -26
  104. package/dist/storage.d.ts +52 -25
  105. package/dist/svg-viewbox.d.ts +10 -0
  106. package/dist/svg-viewbox.js +24 -0
  107. package/dist/theme-assets.d.ts +55 -0
  108. package/dist/theme-assets.js +489 -0
  109. package/dist/theme-readability.d.ts +37 -0
  110. package/dist/theme-readability.js +145 -0
  111. package/dist/theme-tokens.generated.d.ts +299 -0
  112. package/dist/theme-tokens.generated.js +184 -0
  113. package/dist/theme.d.ts +190 -0
  114. package/dist/theme.js +471 -0
  115. package/dist/tool.d.ts +99 -26
  116. package/dist/tool.js +29 -9
  117. package/dist/ui-parts.d.ts +23 -0
  118. package/dist/ui-parts.js +385 -0
  119. package/dist/ui-resolve.d.ts +35 -0
  120. package/dist/ui-resolve.js +42 -0
  121. package/dist/ui-slots.d.ts +65 -0
  122. package/dist/ui-slots.js +261 -0
  123. package/dist/ui.d.ts +212 -76
  124. package/dist/ui.js +101 -27
  125. package/dist/url.d.ts +4 -1
  126. package/dist/url.js +4 -1
  127. package/package.json +13 -1
  128. package/schemas/bootstrap-extra.v1.schema.json +186 -0
  129. package/schemas/bootstrap.v1.schema.json +20 -0
  130. package/schemas/connector-template.v1.schema.json +35 -0
  131. package/schemas/marketplace.v1.schema.json +14 -0
  132. package/schemas/plugin.v1.schema.json +122 -3
  133. package/schemas/theme.v1.schema.json +302 -0
  134. package/agent-docs/extension-points/sandbox.md +0 -15
  135. package/dist/sandbox.d.ts +0 -254
  136. package/dist/sandbox.js +0 -153
@@ -0,0 +1,385 @@
1
+ /** Every part name of the catalog, in catalog order. */
2
+ export const UI_PART_NAMES = [
3
+ "shell",
4
+ "sidebar",
5
+ "sidebar.brand",
6
+ "sidebar.item",
7
+ "title-bar",
8
+ "page-header",
9
+ "thread",
10
+ "message.user",
11
+ "message.user.bubble",
12
+ "message.assistant",
13
+ "tool-row",
14
+ "composer",
15
+ "composer.box",
16
+ "composer.options",
17
+ "composer.send",
18
+ "properties-panel",
19
+ "section",
20
+ "right-panel",
21
+ "status-bar",
22
+ "button",
23
+ "button.primary",
24
+ "card",
25
+ "input",
26
+ "dialog",
27
+ "code-block",
28
+ "menu",
29
+ "segmented",
30
+ "stat-card",
31
+ "switch",
32
+ "switch.knob",
33
+ "org-avatar",
34
+ "agent-chip",
35
+ "image-placeholder",
36
+ ];
37
+ export const UI_PARTS = [
38
+ {
39
+ name: "shell",
40
+ version: 1,
41
+ owner: ["packages/design/src/shell/app-shell.tsx"],
42
+ states: [],
43
+ description: {
44
+ en: "The App Shell root.",
45
+ zh: "应用外壳的根节点。",
46
+ },
47
+ },
48
+ {
49
+ name: "sidebar",
50
+ version: 1,
51
+ owner: ["packages/design/src/shell/sidebar.tsx"],
52
+ states: [],
53
+ description: {
54
+ en: "The left sidebar.",
55
+ zh: "左侧边栏。",
56
+ },
57
+ },
58
+ {
59
+ name: "sidebar.brand",
60
+ version: 1,
61
+ owner: ["packages/design/src/shell/sidebar.tsx"],
62
+ states: [],
63
+ description: {
64
+ en: "The brand row of the sidebar.",
65
+ zh: "侧边栏的品牌行。",
66
+ },
67
+ },
68
+ {
69
+ name: "sidebar.item",
70
+ version: 1,
71
+ owner: [
72
+ "packages/design/src/shell/sidebar.tsx",
73
+ "packages/design/src/shell/sidebar-conversations.tsx",
74
+ ],
75
+ states: ["aria-current"],
76
+ description: {
77
+ en: "A navigation or conversation row of the sidebar.",
78
+ zh: "侧边栏的导航行或对话行。",
79
+ },
80
+ },
81
+ {
82
+ name: "title-bar",
83
+ version: 1,
84
+ owner: ["packages/design/src/conversation/title-bar.tsx"],
85
+ states: [],
86
+ description: {
87
+ en: "The conversation title bar.",
88
+ zh: "对话标题栏。",
89
+ },
90
+ },
91
+ {
92
+ name: "page-header",
93
+ version: 1,
94
+ owner: ["packages/design/src/shell/page-header.tsx"],
95
+ states: [],
96
+ description: {
97
+ en: "The header of a page.",
98
+ zh: "页面头部。",
99
+ },
100
+ },
101
+ {
102
+ name: "thread",
103
+ version: 1,
104
+ owner: ["packages/design/src/templates/conversation-page.tsx"],
105
+ states: ["aria-busy"],
106
+ description: {
107
+ en: "The conversation stream.",
108
+ zh: "对话消息流。",
109
+ },
110
+ },
111
+ {
112
+ name: "message.user",
113
+ version: 1,
114
+ owner: ["packages/design/src/conversation/bubble.tsx"],
115
+ states: [],
116
+ description: {
117
+ en: "A person's message.",
118
+ zh: "用户发出的消息。",
119
+ },
120
+ },
121
+ {
122
+ name: "message.user.bubble",
123
+ version: 1,
124
+ owner: ["packages/design/src/conversation/bubble.tsx"],
125
+ states: [],
126
+ description: {
127
+ en: "The bubble of a person's message (inside the full-width `message.user` row).",
128
+ zh: "用户消息的气泡本身(在占满宽度的 message.user 行之内)。",
129
+ },
130
+ },
131
+ {
132
+ name: "message.assistant",
133
+ version: 1,
134
+ owner: ["apps/web/src/components/conversation/Thread.tsx"],
135
+ states: ["aria-busy"],
136
+ description: {
137
+ en: "An assistant turn; `aria-busy` while its text is still streaming (the live reply).",
138
+ zh: "智能体的一轮回复;正在流式输出时带 aria-busy(正在生成的回复)。",
139
+ },
140
+ },
141
+ {
142
+ name: "tool-row",
143
+ version: 1,
144
+ owner: ["packages/design/src/conversation/tool-row.tsx"],
145
+ states: ["aria-expanded"],
146
+ description: {
147
+ en: "A tool call line.",
148
+ zh: "工具调用行。",
149
+ },
150
+ },
151
+ {
152
+ name: "composer",
153
+ version: 1,
154
+ owner: ["packages/design/src/conversation/composer.tsx"],
155
+ states: ["aria-busy"],
156
+ description: {
157
+ en: "The whole composer: the token warning, the attachments, the text box and the control row. From 600 up with a fine pointer it is the box; in the mobile form (below 600, or a touch device at any width) it draws nothing and `composer.box` is the floating pill, the control row around it.",
158
+ zh: "整个输入框:令牌提醒、附件、文本框与控件行。600 及以上且为精确指针时它就是那个框;移动形态(600 以下,或任意宽度的触屏设备)下它不画任何东西,`composer.box` 是浮动的胶囊,控件行在其上下。",
159
+ },
160
+ },
161
+ {
162
+ name: "composer.box",
163
+ version: 1,
164
+ owner: ["packages/design/src/conversation/composer.tsx"],
165
+ states: [],
166
+ description: {
167
+ en: "The composer's text box: the text with the attach and send buttons. In the mobile form it is the floating pill (round ends, `:focus-within` while the text or one of its buttons has focus, never for the control row); from 600 up with a fine pointer it draws no box of its own (`display: contents`).",
168
+ zh: "输入框的文本框:文字与添加、发送按钮。移动形态下它是浮动胶囊(圆头;文字或其中按钮获得焦点时 `:focus-within`,控件行获得焦点时不会);600 及以上且为精确指针时它不画自己的框(`display: contents`)。",
169
+ },
170
+ },
171
+ {
172
+ name: "composer.options",
173
+ version: 1,
174
+ owner: ["packages/design/src/conversation/composer-options.tsx"],
175
+ states: ["aria-expanded"],
176
+ description: {
177
+ en: "The composer's settings chip (model, effort, device, permission) opening the options sheet: in the mobile form only, above the pill.",
178
+ zh: "输入框的设置胶囊(模型、推理强度、设备、权限),打开选项面板:仅移动形态,位于胶囊上方。",
179
+ },
180
+ },
181
+ {
182
+ name: "composer.send",
183
+ version: 1,
184
+ owner: ["packages/design/src/conversation/composer.tsx"],
185
+ states: ["disabled", "aria-busy"],
186
+ description: {
187
+ en: "The composer's send button, and the stop button in its place while a run is going (its `aria-label` tells them apart). In the mobile form a round button inside `composer.box`.",
188
+ zh: "输入框的发送按钮,运行中同一位置的停止按钮(以 `aria-label` 区分)。移动形态下是 `composer.box` 内的圆形按钮。",
189
+ },
190
+ },
191
+ {
192
+ name: "properties-panel",
193
+ version: 1,
194
+ owner: ["packages/design/src/conversation/panels.tsx"],
195
+ states: [],
196
+ description: {
197
+ en: "The conversation properties panel.",
198
+ zh: "对话属性面板。",
199
+ },
200
+ },
201
+ {
202
+ name: "section",
203
+ version: 1,
204
+ owner: [
205
+ "packages/design/src/conversation/panels.tsx",
206
+ "packages/design/src/templates/form-page.tsx",
207
+ ],
208
+ states: [],
209
+ description: {
210
+ en: "A property section or form section.",
211
+ zh: "属性分区或表单分区。",
212
+ },
213
+ },
214
+ {
215
+ name: "right-panel",
216
+ version: 1,
217
+ owner: ["packages/design/src/conversation/panels.tsx"],
218
+ states: [],
219
+ description: {
220
+ en: "A full-height right pane.",
221
+ zh: "占满高度的右侧窗格。",
222
+ },
223
+ },
224
+ {
225
+ name: "status-bar",
226
+ version: 1,
227
+ owner: ["packages/design/src/shell/status-bar.tsx"],
228
+ states: [],
229
+ description: {
230
+ en: "The status bar.",
231
+ zh: "状态栏。",
232
+ },
233
+ },
234
+ {
235
+ name: "button",
236
+ version: 1,
237
+ owner: [
238
+ "packages/design/src/controls/button.tsx",
239
+ "packages/design/src/conversation/composer.tsx",
240
+ "packages/design/src/conversation/composer-options.tsx",
241
+ ],
242
+ states: ["disabled"],
243
+ description: {
244
+ en: "Every button.",
245
+ zh: "所有按钮。",
246
+ },
247
+ },
248
+ {
249
+ name: "button.primary",
250
+ version: 1,
251
+ owner: ["packages/design/src/controls/button.tsx"],
252
+ states: ["disabled"],
253
+ description: {
254
+ en: "A primary button (carried together with `button`).",
255
+ zh: "主按钮(与 button 同时出现)。",
256
+ },
257
+ },
258
+ {
259
+ name: "card",
260
+ version: 1,
261
+ owner: [
262
+ "packages/design/src/layout/index.tsx",
263
+ "packages/design/src/conversation/panels.tsx",
264
+ "packages/design/src/display/card-grid.tsx",
265
+ ],
266
+ states: [],
267
+ description: {
268
+ en: "A card, inline card or object card.",
269
+ zh: "卡片、行内卡片或对象卡片。",
270
+ },
271
+ },
272
+ {
273
+ name: "input",
274
+ version: 1,
275
+ owner: ["packages/design/src/controls/inputs.tsx", "packages/design/src/controls/select.tsx"],
276
+ states: ["disabled"],
277
+ description: {
278
+ en: "Text inputs, textareas and selects.",
279
+ zh: "文本框、多行文本框和下拉选择。",
280
+ },
281
+ },
282
+ {
283
+ name: "dialog",
284
+ version: 1,
285
+ owner: ["packages/design/src/overlays/dialog.tsx", "packages/design/src/overlays/sheet.tsx"],
286
+ states: [],
287
+ description: {
288
+ en: "A dialog or sheet.",
289
+ zh: "对话框或抽屉。",
290
+ },
291
+ },
292
+ {
293
+ name: "code-block",
294
+ version: 1,
295
+ owner: ["packages/design/src/display/chat.tsx"],
296
+ states: [],
297
+ description: {
298
+ en: "A code block (Markdown code, setup guides, diffs).",
299
+ zh: "代码块(Markdown 代码、设置指引、差异)。",
300
+ },
301
+ },
302
+ {
303
+ name: "menu",
304
+ version: 1,
305
+ owner: ["packages/design/src/overlays/menus.tsx", "packages/design/src/conversation/menu.tsx"],
306
+ states: [],
307
+ description: {
308
+ en: "A menu, submenu, popover or the composer's menus.",
309
+ zh: "菜单、子菜单、弹出层或输入框的菜单。",
310
+ },
311
+ },
312
+ {
313
+ name: "segmented",
314
+ version: 1,
315
+ owner: ["packages/design/src/display/tabs.tsx"],
316
+ states: [],
317
+ description: {
318
+ en: "A segmented control (its segments are radios with `aria-checked`).",
319
+ zh: "分段控件(各段是带 aria-checked 的单选项)。",
320
+ },
321
+ },
322
+ {
323
+ name: "stat-card",
324
+ version: 1,
325
+ owner: ["packages/design/src/display/stat-cards.tsx"],
326
+ states: [],
327
+ description: {
328
+ en: "A metric card of a StatCards row.",
329
+ zh: "指标卡片行里的一张指标卡。",
330
+ },
331
+ },
332
+ {
333
+ name: "switch",
334
+ version: 1,
335
+ owner: ["packages/design/src/controls/toggles.tsx"],
336
+ states: ["aria-checked", "disabled"],
337
+ description: {
338
+ en: "A switch; `aria-checked` says on or off.",
339
+ zh: "开关;aria-checked 表示开或关。",
340
+ },
341
+ },
342
+ {
343
+ name: "switch.knob",
344
+ version: 1,
345
+ owner: ["packages/design/src/controls/toggles.tsx"],
346
+ states: [],
347
+ description: {
348
+ en: "The knob inside a `switch` (style it from the switch's state).",
349
+ zh: "开关里的滑块(按所在开关的状态设置样式)。",
350
+ },
351
+ },
352
+ {
353
+ name: "org-avatar",
354
+ version: 1,
355
+ owner: ["packages/design/src/shell/sidebar.tsx"],
356
+ states: [],
357
+ description: {
358
+ en: "The org's initial block in the sidebar's org switcher.",
359
+ zh: "侧边栏组织切换器里的组织首字方块。",
360
+ },
361
+ },
362
+ {
363
+ name: "agent-chip",
364
+ version: 1,
365
+ owner: ["packages/design/src/conversation/agent-row.tsx"],
366
+ states: ["aria-pressed"],
367
+ description: {
368
+ en: "An agent chip of the new conversation's agents row; `aria-pressed` on the selected one.",
369
+ zh: "新会话智能体行里的智能体标签;选中的那个带 aria-pressed。",
370
+ },
371
+ },
372
+ {
373
+ name: "image-placeholder",
374
+ version: 1,
375
+ owner: ["packages/design/src/conversation/files.tsx"],
376
+ states: ["aria-busy"],
377
+ description: {
378
+ en: "A generating image's placeholder in the conversation.",
379
+ zh: "对话中正在生成的图片的占位框。",
380
+ },
381
+ },
382
+ ];
383
+ export function uiPart(name) {
384
+ return UI_PARTS.find((p) => p.name === name);
385
+ }
@@ -0,0 +1,35 @@
1
+ import type { UiContribution } from "./ui.js";
2
+ import { type UiSlotSpec } from "./ui-slots.js";
3
+ /** A contribution whose slot the catalog knows at the version it names (UI slots spec §3.2). */
4
+ export interface ResolvedUiContribution {
5
+ contribution: UiContribution;
6
+ slot: UiSlotSpec;
7
+ version: number;
8
+ /**
9
+ * For a slot with anchors: the anchor it goes after (the contribution's own `after` when it is one
10
+ * of the slot's anchors, else the slot's first anchor). Absent for a slot without anchors.
11
+ */
12
+ after?: string;
13
+ }
14
+ /** Why a contribution was dropped: its slot is not in the catalog, or not at that version. */
15
+ export type UiDropReason = "unknown-slot" | "unsupported-version";
16
+ /** A contribution left out of the loaded extension; `ref` is the slot reference it names. */
17
+ export interface DroppedUiContribution {
18
+ id: string;
19
+ ref: string;
20
+ reason: UiDropReason;
21
+ }
22
+ /**
23
+ * Resolves the slots of a manifest's `ui` against the catalog (UI slots spec §3.2). Assumes
24
+ * `validateUiContributions` passed; never throws. A contribution to an unknown slot or to a version
25
+ * other than the slot's is dropped; an `after` that is not an anchor of the slot is listed in
26
+ * `unknownAnchors` and the contribution keeps the slot's default position. Both lists keep manifest order.
27
+ */
28
+ export declare function resolveUiSlots(ui: readonly UiContribution[] | undefined): {
29
+ resolved: ResolvedUiContribution[];
30
+ dropped: DroppedUiContribution[];
31
+ unknownAnchors: {
32
+ id: string;
33
+ after: string;
34
+ }[];
35
+ };
@@ -0,0 +1,42 @@
1
+ import { parseSlotRef, uiSlot } from "./ui-slots.js";
2
+ /**
3
+ * Resolves the slots of a manifest's `ui` against the catalog (UI slots spec §3.2). Assumes
4
+ * `validateUiContributions` passed; never throws. A contribution to an unknown slot or to a version
5
+ * other than the slot's is dropped; an `after` that is not an anchor of the slot is listed in
6
+ * `unknownAnchors` and the contribution keeps the slot's default position. Both lists keep manifest order.
7
+ */
8
+ export function resolveUiSlots(ui) {
9
+ const list = ui ?? [];
10
+ const own = new Map();
11
+ for (const c of list) {
12
+ const ref = parseSlotRef(c.slot);
13
+ const slot = ref === null ? undefined : uiSlot(ref.id);
14
+ own.set(c.id, ref === null || slot === undefined
15
+ ? { ok: false, reason: "unknown-slot" }
16
+ : ref.version !== slot.version
17
+ ? { ok: false, reason: "unsupported-version" }
18
+ : { ok: true, slot, version: ref.version });
19
+ }
20
+ const resolved = [];
21
+ const dropped = [];
22
+ const unknownAnchors = [];
23
+ for (const c of list) {
24
+ const r = own.get(c.id);
25
+ if (!r.ok) {
26
+ dropped.push({ id: c.id, ref: c.slot, reason: r.reason });
27
+ continue;
28
+ }
29
+ const anchors = r.slot.anchors ?? [];
30
+ if (c.after !== undefined && !anchors.includes(c.after)) {
31
+ unknownAnchors.push({ id: c.id, after: c.after });
32
+ }
33
+ const after = c.after !== undefined && anchors.includes(c.after) ? c.after : anchors[0];
34
+ resolved.push({
35
+ contribution: c,
36
+ slot: r.slot,
37
+ version: r.version,
38
+ ...(anchors.length > 0 && { after }),
39
+ });
40
+ }
41
+ return { resolved, dropped, unknownAnchors };
42
+ }
@@ -0,0 +1,65 @@
1
+ import type { UiKind } from "./ui.js";
2
+ export type UiSlotScope = "conversation" | "agent" | "org" | "platform" | "file";
3
+ export type UiSlotRole = "guest" | "member" | "admin" | "superAdmin";
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", "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;
16
+ export type UiSlotId = (typeof UI_SLOT_IDS)[number];
17
+ /** One slot of the catalog: where extension UI may go and what it receives (UI slots spec §3.1). */
18
+ export interface UiSlotSpec {
19
+ id: UiSlotId;
20
+ /** Bumped only on an incompatible change of the slot's contract. */
21
+ version: number;
22
+ /** Path relative to `apps/web/src` of the component that renders the slot. */
23
+ owner: string;
24
+ scope: UiSlotScope;
25
+ accepts: readonly UiKind[];
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
+ };
35
+ minRole: UiSlotRole;
36
+ /** Context ids passed to render (`conversationId`, `agentId`, …). */
37
+ args: readonly string[];
38
+ density: "dense" | "regular";
39
+ icon: "required" | "optional" | "none";
40
+ /** The slot's form on a compact screen (mobile layout spec §5.6). */
41
+ compact: CompactForm;
42
+ /** Built-in parts a contribution may be placed after; the first is the default. */
43
+ anchors?: readonly string[];
44
+ limits?: {
45
+ maxShown?: number;
46
+ };
47
+ description: {
48
+ en: string;
49
+ zh: string;
50
+ };
51
+ }
52
+ export declare const UI_SLOTS: readonly UiSlotSpec[];
53
+ export declare function uiSlot(id: string): UiSlotSpec | undefined;
54
+ /** Reads `<id>` or `<id>@<version>` (version 1 when omitted); does not check the catalog. */
55
+ export declare function parseSlotRef(ref: string): {
56
+ id: string;
57
+ version: number;
58
+ } | null;
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[];
64
+ export declare const UI_CONTRIBUTION_KEY_RE: RegExp;
65
+ export declare function uiContributionKey(plugin: string, id: string): string;