@capybara-hq/plugin-sdk 0.1.0-rc.70 → 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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  <!-- generated:extension-point -->
4
4
  - Name: `file-preview` (a ref is `file-preview@<major>`)
5
- - Renders previews of files of given types in the conversation UI.
5
+ - Renders previews of files of given types: conversation files, shared files and skill files.
6
6
  - Providers: several
7
7
  - Enabled per org: yes
8
8
  - Brokered by the platform: no
@@ -12,6 +12,6 @@ Contract: FilePreviewProvider (`file-preview.ts`)
12
12
 
13
13
  Declare which file types you can preview and render them through schema views or an approved embed. Enabled per org.
14
14
 
15
- `render` args are a union on `source`: `"conversation"` (org, account, conversation) or `"share"` (org and share id; `file.id` is the share id; no account or conversation). A previewer that needs the conversation declines `source: "share"` by throwing; the kernel reports the failure and the share page falls to the next previewer. A share token is valid only for the `file.preview` slot, never for `/api`.
15
+ `render` args are a union on `source`: `"conversation"` (org, account, conversation), `"share"` (org and share id; `file.id` is the share id; no account or conversation) or `"skill"` (a skill version's file on the skill page: org, account, `skillId`, `version` and `path`; `file.id` is `<skillId>@<version>/<path>`; no conversation). An embed previewer of a skill file gets an org token whose claims carry `skillFile: { skillId, version, path }` instead of `conversationId` / `fileId`; that token reaches every `embed` route of the extension, so an embed route must not treat an org caller without `conversationId` as entitled to conversation data, and should serve a `caller.skillFile` caller only that file. A previewer that needs the conversation declines any `source` other than `"conversation"` by throwing; the kernel reports the failure and the page (a share page, a skill page) falls to the next previewer. A share token is valid only for the `file.preview` slot, never for `/api`.
16
16
 
17
17
  See `extensions` for the rules every extension follows.
@@ -125,7 +125,7 @@ look like `channel@1`: name and major version. The registered points:
125
125
  | `directory` | multi | yes | Syncs members and departments from an external company directory. |
126
126
  | `counter` | multi | no | Counts usage so quotas and reports can be built on it. |
127
127
  | `connector` | multi | no | Speaks one protocol (MCP, OpenAPI) to external systems and exposes their tools to agents. |
128
- | `file-preview` | multi | yes | Renders previews of files of given types in the conversation UI. |
128
+ | `file-preview` | multi | yes | Renders previews of files of given types: conversation files, shared files and skill files. |
129
129
  | `web-search` | multi | yes | Searches the web for the WebSearch tool; each org picks a default provider. |
130
130
  | `context` | multi | yes | Adds text to the model's context at run start in conversations of orgs that enable it. |
131
131
  | `web-fetch` | multi | yes | Fetches and extracts web pages for the WebFetch tool; each org picks a default provider. |
@@ -18,7 +18,7 @@ export const EXTENSION_POINTS = {
18
18
  directory: info([1], "Syncs members and departments from an external company directory.", "multi", false, true),
19
19
  counter: info([1], "Counts usage so quotas and reports can be built on it.", "multi"),
20
20
  connector: info([1], "Speaks one protocol (MCP, OpenAPI) to external systems and exposes their tools to agents.", "multi", true),
21
- "file-preview": info([1], "Renders previews of files of given types in the conversation UI.", "multi", false, true),
21
+ "file-preview": info([1], "Renders previews of files of given types: conversation files, shared files and skill files.", "multi", false, true),
22
22
  "web-search": info([1], "Searches the web for the WebSearch tool; each org picks a default provider.", "multi", true, true, "org-default"),
23
23
  context: info([1], "Adds text to the model's context at run start in conversations of orgs that enable it.", "multi", true, true),
24
24
  "web-fetch": info([1], "Fetches and extracts web pages for the WebFetch tool; each org picks a default provider.", "multi", true, true, "org-default"),
@@ -39,7 +39,10 @@ export interface FilePreviewArgsBase {
39
39
  locale: Locale;
40
40
  /** Aborted at the kernel's time limit: stop reading and rendering. */
41
41
  signal: AbortSignal;
42
- /** In the share variant `file.id` is the share id. */
42
+ /**
43
+ * In the share variant `file.id` is the share id; in the skill variant it is
44
+ * `<skillId>@<version>/<path>`.
45
+ */
43
46
  file: {
44
47
  id: string;
45
48
  name: string;
@@ -76,8 +79,22 @@ export interface FilePreviewShareArgs extends FilePreviewArgsBase {
76
79
  orgId: string;
77
80
  shareId: string;
78
81
  }
82
+ /**
83
+ * A file of a skill version, previewed on the skill's page: the person who opened it (`accountId`),
84
+ * the skill, the version and the file's path in it (a path of the version's manifest). There is no
85
+ * conversation. `file.id` is `<skillId>@<version>/<path>`. A previewer that needs the conversation
86
+ * declines this variant by throwing, as it does a share.
87
+ */
88
+ export interface FilePreviewSkillArgs extends FilePreviewArgsBase {
89
+ source: "skill";
90
+ orgId: string;
91
+ accountId: string;
92
+ skillId: string;
93
+ version: number;
94
+ path: string;
95
+ }
79
96
  /** Arguments of {@link FilePreviewer.render}: narrow on `source`. */
80
- export type FilePreviewArgs = FilePreviewConversationArgs | FilePreviewShareArgs;
97
+ export type FilePreviewArgs = FilePreviewConversationArgs | FilePreviewShareArgs | FilePreviewSkillArgs;
81
98
  /** Checks a `file-preview@1` provider; returns the problems (empty = valid). */
82
99
  export declare function validateFilePreviewProvider(p: unknown): string[];
83
100
  /** Whether a previewer takes this file: its type or extension is accepted and it is within `maxBytes`. */
@@ -32,6 +32,15 @@ export type RouteCaller = {
32
32
  role: UiRole;
33
33
  contribution: string;
34
34
  conversationId?: string;
35
+ /**
36
+ * A skill file previewer's token (`OrgEmbedClaims.skillFile`): the skill, version and path;
37
+ * no conversation.
38
+ */
39
+ skillFile?: {
40
+ skillId: string;
41
+ version: number;
42
+ path: string;
43
+ };
35
44
  /** The token's expiry (Unix seconds): a long-lived response (SSE) ends by then. */
36
45
  exp: number;
37
46
  config: unknown;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const SDK_VERSION = "0.1.0-rc.70";
1
+ export declare const SDK_VERSION = "0.1.0-rc.71";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./avatar-presets.js";
4
4
  export * from "./bootstrap.js";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = "0.1.0-rc.70";
1
+ export const SDK_VERSION = "0.1.0-rc.71";
2
2
  export * from "./agent-template.js";
3
3
  export * from "./avatar-presets.js";
4
4
  export * from "./bootstrap.js";
package/dist/ui.d.ts CHANGED
@@ -295,6 +295,15 @@ export interface OrgEmbedClaims extends EmbedClaimsBase {
295
295
  agentId?: string;
296
296
  /** Only a `file-preview` embed's token: the one file (of `conversationId`) it previews. */
297
297
  fileId?: string;
298
+ /**
299
+ * Only a `file-preview` embed's token for a skill file (no `conversationId`, `agentId` or
300
+ * `fileId`): the skill, the version and the file's path in it.
301
+ */
302
+ skillFile?: {
303
+ skillId: string;
304
+ version: number;
305
+ path: string;
306
+ };
298
307
  }
299
308
  /** A `platform.page` embed token's claims: a super admin's, with no org, conversation, agent or file. */
300
309
  export interface PlatformEmbedClaims extends EmbedClaimsBase {
@@ -305,6 +314,7 @@ export interface PlatformEmbedClaims extends EmbedClaimsBase {
305
314
  conversationId?: undefined;
306
315
  agentId?: undefined;
307
316
  fileId?: undefined;
317
+ skillFile?: undefined;
308
318
  }
309
319
  /**
310
320
  * A share page's `file.preview` embed token's claims: no account and no role, only the org, the
@@ -320,6 +330,7 @@ export interface ShareEmbedClaims extends EmbedClaimsBase {
320
330
  conversationId?: undefined;
321
331
  agentId?: undefined;
322
332
  fileId?: undefined;
333
+ skillFile?: undefined;
323
334
  }
324
335
  /**
325
336
  * Claims in an embed token (trustworthy after validation by `ctx.ui.verifyEmbedToken`): narrow on
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-sdk",
3
- "version": "0.1.0-rc.70",
3
+ "version": "0.1.0-rc.71",
4
4
  "description": "Capybara plugin SDK: the types and pure functions plugins are written against",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {