@vetta-org/plugin-sdk 0.3.11 → 0.3.13
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.
- package/dist/command.d.ts +6 -0
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js.map +1 -1
- package/dist/host-bridge.d.ts +4 -0
- package/dist/host-bridge.d.ts.map +1 -1
- package/dist/host-bridge.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest-schema.d.ts +2 -2
- package/dist/manifest-schema.d.ts.map +1 -1
- package/dist/model-picker.d.ts +47 -0
- package/dist/model-picker.d.ts.map +1 -0
- package/dist/model-picker.js +13 -0
- package/dist/model-picker.js.map +1 -0
- package/dist/official.d.ts +0 -1
- package/dist/official.d.ts.map +1 -1
- package/dist/official.js.map +1 -1
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +1 -0
- package/dist/permissions.js.map +1 -1
- package/dist/ui.d.ts +98 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/docs/README.md +2 -0
- package/docs/ai.md +37 -1
- package/docs/conversation-and-agent.md +4 -0
- package/docs/permissions.md +1 -0
- package/docs/styling-and-pitfalls.md +67 -1
- package/docs/ui-slots.md +109 -0
- package/package.json +1 -1
- package/dist/quickjs.d.ts +0 -147
- package/dist/quickjs.d.ts.map +0 -1
- package/dist/quickjs.js +0 -2
- package/dist/quickjs.js.map +0 -1
|
@@ -176,11 +176,39 @@ vettaPluginFederation({
|
|
|
176
176
|
|
|
177
177
|
默认路径仍是:自写 JSX + 语义 class(`bg-background` / `text-foreground`…)。`@vetta-org/ui` 适合按钮、开关、对话框等控件统一,不是强制。未导入它的插件不要开启 `hostUi`,也不要声明该依赖。
|
|
178
178
|
|
|
179
|
+
### 可用组件速查
|
|
180
|
+
|
|
181
|
+
| 组件 | 用途 |
|
|
182
|
+
| --- | --- |
|
|
183
|
+
| `Button` | 按钮。`variant`:`default` / `primary` / `outline` / `secondary` / `ghost` / `destructive` / `link`,以及 **`field`**(设置页里设置项右侧的操作按钮:muted 底、无边框、12px,与下拉 / 输入框同皮);`size`:`xs` / `sm` / `default` / `lg` / `icon-xs` / `icon-sm` / `icon` / `icon-lg` |
|
|
184
|
+
| `ButtonGroup` + `ButtonGroupItem` | **按钮组**:半透明胶囊里并排若干操作按钮,用于悬浮在内容之上的工具条(如页头右上角)。`ButtonGroup` 属性:`shape`(`"pill"` 胶囊,默认 / `"square"` 圆角方形)、`blur`(背景模糊,默认开;贴在纯色背景上可关)。`ButtonGroupItem` 属性:`icon`、`label`(不传即纯图标按钮,须配 `title` / `aria-label`)、`badge`(数字计数,超过 99 显示 `99+`;`true` 为小红点;也可传节点)、`active`(选中态,同时设 `aria-pressed`),其余同原生 `button`。选中项两侧的分隔线会自动隐藏 |
|
|
185
|
+
| `SessionTopItem` / `SessionTopGroup` | 宿主内部用的顶栏按钮:`ButtonGroupItem` 外观,点击向下弹出气泡(`popoverContent`)或下拉菜单(`menuItems`)。插件**不用**它来做顶栏动作——`registerHeaderAction` 是声明式的,宿主统一渲染并管理收纳与排序,详见 [ui-slots](./ui-slots.md#会话页顶栏动作-registerheaderaction);它仍可用于你自己页面里的同款按钮 |
|
|
186
|
+
| `DropdownMenu*` | 菜单(`DropdownMenuTrigger` / `Content` / `Item` / `Separator` / `RadioGroup` / `Sub` …) |
|
|
187
|
+
| `Select*`、`SELECT_TRIGGER_CLASS`、`SELECT_PANEL_CLASS` | 下拉选择(Radix);后两个常量是设置页下拉的触发器 / 面板皮肤,自拼触发器时用 |
|
|
188
|
+
| `Popover*` / `Dialog*` / `Drawer*` / `Switch` / `Slider` / `StepSlider` / `Input` / `Calendar` / `DatePicker` / `Spin` / `cn` | 其余基础控件 |
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { Button, ButtonGroup, ButtonGroupItem } from "@vetta-org/ui";
|
|
192
|
+
|
|
193
|
+
function Toolbar({ unread, panelOpen, onRun, onTogglePanel }: Props) {
|
|
194
|
+
return (
|
|
195
|
+
<ButtonGroup>
|
|
196
|
+
<ButtonGroupItem icon={<PlayIcon />} title="运行" onClick={onRun} />
|
|
197
|
+
<ButtonGroupItem icon={<BellIcon />} label="通知" badge={unread} />
|
|
198
|
+
<ButtonGroupItem icon={<SidebarIcon />} title="面板" active={panelOpen} onClick={onTogglePanel} />
|
|
199
|
+
</ButtonGroup>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 设置项右侧的操作按钮
|
|
204
|
+
<Button variant="field" onClick={onExport}>导出</Button>
|
|
205
|
+
```
|
|
206
|
+
|
|
179
207
|
顶层不要对 `@vetta-org/ui` 做立即求值(与 React 相同,见上文「MF 顶层 JSX 陷阱」)——在组件函数内使用即可。
|
|
180
208
|
|
|
181
209
|
## 按需:`@vetta-org/theme-ui/plugin-ui` 宿主成品 UI
|
|
182
210
|
|
|
183
|
-
|
|
211
|
+
少量经过明确审核的宿主成品组件(模型选择器视图、`MotionSelect`、`SettingSection` / `SettingRow` / `SettingHeading`、供应商图标等)会从窄入口 `@vetta-org/theme-ui/plugin-ui` 开放。
|
|
184
212
|
它不是默认共享依赖;只有实际使用这些组件的插件才应开启:
|
|
185
213
|
|
|
186
214
|
```ts
|
|
@@ -195,6 +223,44 @@ vettaPluginFederation({
|
|
|
195
223
|
打进插件 bundle。不要为了消除构建警告给未使用该入口的插件增加依赖;也不要把
|
|
196
224
|
`@vetta-org/theme-ui` 的其它业务入口当作插件公共 API。
|
|
197
225
|
|
|
226
|
+
### 设置页同款组件
|
|
227
|
+
|
|
228
|
+
下列组件与桌面端设置页是同一份,用来在插件的设置面板里做出一致的外观。全部是纯展示组件,
|
|
229
|
+
文案与数据都由调用方经 props 传入:
|
|
230
|
+
|
|
231
|
+
| 组件 | 用途 |
|
|
232
|
+
| --- | --- |
|
|
233
|
+
| `MotionSelect` | 设置页下拉:`value` / `onValueChange` / `options`(`{ value, label, disabled?, title? }`)/ `placeholder` / `disabled` / `triggerClassName`。面板宽度随选项内容撑开,有轻量淡入;视觉与 `@vetta-org/ui` 的 `Select` 一致,但关闭后触发器文案不会丢 |
|
|
234
|
+
| `SettingSection` | 设置分组卡片:可选标题 / 说明 + 圆角边框容器。`section` 传 `{ id, title? }`,`id` 用作锚点 |
|
|
235
|
+
| `SettingRow` | 分组卡片里的一行设置项卡片:左侧 `title` / `description`,右侧放控件(`children`);`border={false}` 去掉底部分隔线(最后一行) |
|
|
236
|
+
| `SettingHeading` | 与分组同款的 15px 小节标题 |
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
import { Button } from "@vetta-org/ui";
|
|
240
|
+
import { MotionSelect, SettingRow, SettingSection } from "@vetta-org/theme-ui/plugin-ui";
|
|
241
|
+
|
|
242
|
+
<SettingSection section={{ id: "my-plugin-general", title: "常规" }}>
|
|
243
|
+
<SettingRow title="输出格式" description="导出时使用的默认格式">
|
|
244
|
+
<MotionSelect
|
|
245
|
+
value={format}
|
|
246
|
+
onValueChange={setFormat}
|
|
247
|
+
options={[
|
|
248
|
+
{ value: "md", label: "Markdown" },
|
|
249
|
+
{ value: "pdf", label: "PDF" },
|
|
250
|
+
]}
|
|
251
|
+
/>
|
|
252
|
+
</SettingRow>
|
|
253
|
+
<SettingRow title="立即导出" border={false}>
|
|
254
|
+
<Button variant="field" onClick={onExport}>导出</Button>
|
|
255
|
+
</SettingRow>
|
|
256
|
+
</SettingSection>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
只是要让用户选一个模型时,不要用这里的 `ModelSelectorView` 自己拼数据,直接用
|
|
260
|
+
`@vetta-org/plugin-sdk` 的 `ModelPicker`(见 [ai](./ai.md#让用户选模型modelpicker)):
|
|
261
|
+
数据和行为都由宿主提供,与输入栏的模型选择器完全一致,也不需要开启 `hostThemeUi`。
|
|
262
|
+
`ModelSelectorView` 只留给需要完全自定义清单的场景。
|
|
263
|
+
|
|
198
264
|
## 缓存刷新
|
|
199
265
|
|
|
200
266
|
插件 bundle 经 `vetta-plugin://` 协议加载,**Chromium 会缓存 `remoteEntry.js`**——你改了代码重装,**重启 App 也未必清掉旧缓存**,表现为「改动不生效」。
|
package/docs/ui-slots.md
CHANGED
|
@@ -676,6 +676,115 @@ interface PluginNewSessionContext {
|
|
|
676
676
|
|
|
677
677
|
团队会话与单智能体会话一样会把**工作区**与**轮次开始**报给插件,因此本区里挂的东西(附件、插入的文本)在团队会话里同样有去处。
|
|
678
678
|
|
|
679
|
+
## 会话页顶栏动作 registerHeaderAction
|
|
680
|
+
|
|
681
|
+
在会话页顶栏右侧的**宿主统一按钮组**里加一格,例如「用外部应用打开」。
|
|
682
|
+
|
|
683
|
+
- 权限:`ui.slot.header-action`(缺权限 = warn + noop)
|
|
684
|
+
- 需要 Plugin API `^2.9.0`
|
|
685
|
+
- 当前只出现在会话页顶栏
|
|
686
|
+
|
|
687
|
+
### 它是声明式的:你只决定「是什么」,不决定「长什么样」
|
|
688
|
+
|
|
689
|
+
顶栏右侧是**一个**按钮组,内置按钮(导出 / 置顶 / 终端 / 底部面板)和所有插件动作排在同一组里。外观、间距、弹层皮肤全部由宿主渲染,插件**不能**传 `className` / `style`,也不能替换按钮本身,更不能在顶栏里画自己的控件。你能给的只有:
|
|
690
|
+
|
|
691
|
+
| 字段 | 说明 |
|
|
692
|
+
| --- | --- |
|
|
693
|
+
| `title`(必填) | 悬浮提示与无障碍名称。**按钮上没有文字**,用户靠图标 + 这条提示认出它;最长 40 字,超出截断 |
|
|
694
|
+
| `icon`(必填) | 图标节点。宿主放进 16px 固定方框、忽略指针事件,建议用 iconify:`<span className="icon-[solar--folder-linear]" />` |
|
|
695
|
+
| `badge` | 数字(≥ 1,超过 99 显示 `99+`)或 `true`(红点);其它值被忽略 |
|
|
696
|
+
| `active` / `disabled` | 选中态 / 禁用态 |
|
|
697
|
+
| `onClick` / `menuItems` / `popover` | **三选一**的点击行为,见下 |
|
|
698
|
+
|
|
699
|
+
三种点击行为按 `menuItems` > `popover` > `onClick` 取第一个存在的;一个都没有,这个动作不显示并在控制台打一条 warn。
|
|
700
|
+
|
|
701
|
+
- `menuItems`:下拉菜单,最多 20 项,`{ id, label, icon?, onSelect, disabled?, destructive?, separatorBefore? }`,`id` 在菜单内唯一,非法项被丢弃;
|
|
702
|
+
- `popover`:一个 React 组件(props `{ close }`),**这是唯一允许自定义内容的地方**。气泡的背景、圆角、投影由宿主固定,宽高随内容自适应(最大约 32rem,超出滚动);
|
|
703
|
+
- `onClick`:点击直接执行。
|
|
704
|
+
|
|
705
|
+
### 注册:`useAction` 是一个 hook
|
|
706
|
+
|
|
707
|
+
```ts
|
|
708
|
+
interface PluginHeaderActionContribution {
|
|
709
|
+
id: string; // 本插件内唯一,≤ 64 字符;用户布局按 `${pluginId}:${id}` 记忆,别随意改名
|
|
710
|
+
order?: number; // 只决定「用户没调整过时」的初始位置,小的靠左
|
|
711
|
+
useAction: () => PluginHeaderActionState | null; // 返回 null = 此刻不适用,不显示、不占名额
|
|
712
|
+
}
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
宿主在会话页顶栏挂载期间一直调用 `useAction`,所以里面可以用任意 hook(`useActiveConversation()`、`useTranslation()`、你自己的 store),数据变化就自然重新声明:
|
|
716
|
+
|
|
717
|
+
```tsx
|
|
718
|
+
import { useActiveConversation, useTranslation } from "@vetta-org/plugin-sdk";
|
|
719
|
+
|
|
720
|
+
function useOpenInApp() {
|
|
721
|
+
const { t } = useTranslation();
|
|
722
|
+
const { cwd } = useActiveConversation();
|
|
723
|
+
if (!cwd) return null; // 没有项目目录:不显示
|
|
724
|
+
return {
|
|
725
|
+
title: t("action.title"),
|
|
726
|
+
icon: <span className="icon-[solar--square-arrow-right-up-linear]" />,
|
|
727
|
+
menuItems: [
|
|
728
|
+
{ id: "finder", label: "Finder", onSelect: () => openIn("Finder", cwd) },
|
|
729
|
+
{ id: "vscode", label: "VS Code", onSelect: () => openIn("Visual Studio Code", cwd) },
|
|
730
|
+
],
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
// activate 里注册
|
|
735
|
+
ctx.ui.registerHeaderAction({ id: "open-in-app", order: 100, useAction: useOpenInApp });
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
带气泡的例子:
|
|
739
|
+
|
|
740
|
+
```tsx
|
|
741
|
+
function useHistory() {
|
|
742
|
+
const unread = useUnreadCount();
|
|
743
|
+
return {
|
|
744
|
+
title: "历史",
|
|
745
|
+
icon: <span className="icon-[solar--history-linear]" />,
|
|
746
|
+
badge: unread,
|
|
747
|
+
popover: ({ close }: { close: () => void }) => <HistoryList onPick={close} />,
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
`useAction` 的约束(违反时只会让**你这一项**消失,不会影响别的动作):
|
|
753
|
+
|
|
754
|
+
- 渲染期必须是纯计算:不要在里面发请求、起定时器,这类副作用放 `useEffect`;
|
|
755
|
+
- 抛错由宿主错误边界吞掉,该项消失并在控制台记录;
|
|
756
|
+
- 每次渲染可以返回新对象,宿主不依赖引用相等,也不要求你 `useMemo`;
|
|
757
|
+
- `onClick` / `onSelect` 抛错或返回的 Promise 被拒绝,宿主只记日志;
|
|
758
|
+
- 声明不合法(缺 `title` / `icon`、没有任何点击行为):该项不显示,控制台 warn 一次。
|
|
759
|
+
|
|
760
|
+
### 宿主怎么摆放:你不能假定自己在顶栏上
|
|
761
|
+
|
|
762
|
+
- 顶栏最多显示 **7 格**(不含最右侧固定的「活动面板」开关),**内置与插件共用**这 7 个名额;
|
|
763
|
+
- 超出的、以及用户主动收起的动作进入**收纳**:鼠标悬浮在按钮组上时,组下方出现一条小白条,点开是收纳托盘。托盘里只有图标,点一下直接使用;
|
|
764
|
+
- 打开托盘即进入编辑状态:按钮组里没被占用的席位显示为虚线方框;把托盘里的图标拖进按钮组就上栏,把按钮组里的按钮拖进托盘就收纳,组内也能拖动换序。这份布局按 `${pluginId}:${id}` 记在本机;
|
|
765
|
+
- **默认布局**:用户从没调整过时,顶栏只显示「终端」、「底部面板」、「导出」,按这个顺序(连系统插件「从外部应用打开」也在收纳里),**其余动作(包括你的插件)默认都在收纳里**,需要用户自己拖到顶栏。所以不要指望用户一装上就在顶栏看到你的按钮;
|
|
766
|
+
- 用户调整过之后以他存下来的布局为准。此后新装插件的动作:顶栏还有空位就按 `order` 排进去,没有空位进收纳,**不会挤走用户已有的布局**;
|
|
767
|
+
- 被收纳的动作带角标时,宿主会把小白条变红,角标不会被藏起来;
|
|
768
|
+
- 被收纳的菜单 / 气泡动作点击后在托盘旁弹出,内容与在顶栏时一致。
|
|
769
|
+
|
|
770
|
+
所以:不要依赖自己在顶栏上的位置,不要依赖相邻的是谁,也不要在文案里写「左边的按钮」。
|
|
771
|
+
|
|
772
|
+
### 工程上的限制一览
|
|
773
|
+
|
|
774
|
+
| 项 | 限制 |
|
|
775
|
+
| --- | --- |
|
|
776
|
+
| 贡献 id | 本插件内唯一,≤ 64 字符,重复注册抛错 |
|
|
777
|
+
| `title` | 必填,≤ 40 字 |
|
|
778
|
+
| `icon` | 必填,16px 固定方框,忽略指针事件 |
|
|
779
|
+
| `menuItems` | ≤ 20 项,id 不重复,`label` ≤ 40 字 |
|
|
780
|
+
| `badge` | 数字 ≥ 1 或 `true` |
|
|
781
|
+
| 点击行为 | `menuItems` / `popover` / `onClick` 三选一 |
|
|
782
|
+
| 样式 | 不可自定义(仅 `popover` 组件内部自由) |
|
|
783
|
+
| 顶栏名额 | 7 格,内置与插件共用 |
|
|
784
|
+
| 出现位置 | 仅会话页 |
|
|
785
|
+
|
|
786
|
+
官方示例:`packages/plugins/presets/open-in-app`。
|
|
787
|
+
|
|
679
788
|
## 工具行内渲染 registerToolCallSlot
|
|
680
789
|
|
|
681
790
|
按 **toolName** 替换宿主默认的工具调用行内 UI(transcript 内嵌渲染)。**首个注册胜**。
|
package/package.json
CHANGED
package/dist/quickjs.d.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { ConversationScenario } from "./scenario.js";
|
|
2
|
-
import type { PluginNetworkRequest, PluginNetworkResponse } from "./network.js";
|
|
3
|
-
import type { PluginPutBlobInput, PluginStoredBlob, PluginStoredBlobRef } from "./storage.js";
|
|
4
|
-
import type { PluginActivityTabRetention } from "./ui.js";
|
|
5
|
-
export type PluginDeclarativeTextTone = "default" | "muted" | "success" | "warning" | "danger";
|
|
6
|
-
export interface PluginDeclarativeStack {
|
|
7
|
-
type: "stack";
|
|
8
|
-
direction?: "vertical" | "horizontal";
|
|
9
|
-
gap?: "small" | "medium" | "large";
|
|
10
|
-
children: PluginDeclarativeNode[];
|
|
11
|
-
}
|
|
12
|
-
export interface PluginDeclarativeSection {
|
|
13
|
-
type: "section";
|
|
14
|
-
title?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
children: PluginDeclarativeNode[];
|
|
17
|
-
}
|
|
18
|
-
export interface PluginDeclarativeText {
|
|
19
|
-
type: "text";
|
|
20
|
-
text: string;
|
|
21
|
-
style?: "body" | "heading" | "caption" | "code";
|
|
22
|
-
tone?: PluginDeclarativeTextTone;
|
|
23
|
-
}
|
|
24
|
-
export interface PluginDeclarativeButton {
|
|
25
|
-
type: "button";
|
|
26
|
-
label: string;
|
|
27
|
-
action: string;
|
|
28
|
-
variant?: "primary" | "secondary" | "outline" | "destructive";
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface PluginDeclarativeInput {
|
|
32
|
-
type: "input";
|
|
33
|
-
action: string;
|
|
34
|
-
label?: string;
|
|
35
|
-
value?: string;
|
|
36
|
-
placeholder?: string;
|
|
37
|
-
inputType?: "text" | "password" | "number";
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface PluginDeclarativeTextarea {
|
|
41
|
-
type: "textarea";
|
|
42
|
-
action: string;
|
|
43
|
-
label?: string;
|
|
44
|
-
value?: string;
|
|
45
|
-
placeholder?: string;
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface PluginDeclarativeSelectOption {
|
|
49
|
-
value: string;
|
|
50
|
-
label: string;
|
|
51
|
-
}
|
|
52
|
-
export interface PluginDeclarativeSelect {
|
|
53
|
-
type: "select";
|
|
54
|
-
action: string;
|
|
55
|
-
label?: string;
|
|
56
|
-
value?: string;
|
|
57
|
-
placeholder?: string;
|
|
58
|
-
options: PluginDeclarativeSelectOption[];
|
|
59
|
-
disabled?: boolean;
|
|
60
|
-
}
|
|
61
|
-
export interface PluginDeclarativeSwitch {
|
|
62
|
-
type: "switch";
|
|
63
|
-
action: string;
|
|
64
|
-
label: string;
|
|
65
|
-
checked?: boolean;
|
|
66
|
-
disabled?: boolean;
|
|
67
|
-
}
|
|
68
|
-
export interface PluginDeclarativeDivider {
|
|
69
|
-
type: "divider";
|
|
70
|
-
}
|
|
71
|
-
/** Serializable UI rendered exclusively with host-owned components. */
|
|
72
|
-
export type PluginDeclarativeNode = PluginDeclarativeStack | PluginDeclarativeSection | PluginDeclarativeText | PluginDeclarativeButton | PluginDeclarativeInput | PluginDeclarativeTextarea | PluginDeclarativeSelect | PluginDeclarativeSwitch | PluginDeclarativeDivider;
|
|
73
|
-
export interface PluginQuickJsActivityTab {
|
|
74
|
-
id: string;
|
|
75
|
-
label: string;
|
|
76
|
-
view: PluginDeclarativeNode;
|
|
77
|
-
scope_use?: readonly ConversationScenario[];
|
|
78
|
-
initiallyVisible?: boolean;
|
|
79
|
-
/** Defaults to `"warm"`; see PluginActivityTabContribution. */
|
|
80
|
-
retention?: PluginActivityTabRetention;
|
|
81
|
-
}
|
|
82
|
-
export interface PluginDeclarativeActionEvent {
|
|
83
|
-
tabId: string;
|
|
84
|
-
action: string;
|
|
85
|
-
kind: "press" | "change";
|
|
86
|
-
value?: string | number | boolean;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Public contract exposed as the frozen `vetta` global inside a QuickJS plugin.
|
|
90
|
-
* QuickJS entry scripts are classic scripts and must not import host modules.
|
|
91
|
-
*/
|
|
92
|
-
export interface PluginQuickJsApi {
|
|
93
|
-
activate(handler: (context: PluginQuickJsContext) => void): void;
|
|
94
|
-
deactivate(handler: () => void): void;
|
|
95
|
-
}
|
|
96
|
-
export interface PluginQuickJsContext {
|
|
97
|
-
plugin: {
|
|
98
|
-
id: string;
|
|
99
|
-
version: string;
|
|
100
|
-
iconUrl?: string;
|
|
101
|
-
};
|
|
102
|
-
permissions: {
|
|
103
|
-
has(permission: string): boolean;
|
|
104
|
-
};
|
|
105
|
-
ui: {
|
|
106
|
-
registerActivityTab(contribution: PluginQuickJsActivityTab): void;
|
|
107
|
-
updateActivityTab(tabId: string, view: PluginDeclarativeNode): void;
|
|
108
|
-
onAction(action: string, handler: (event: PluginDeclarativeActionEvent) => void | Promise<void>): void;
|
|
109
|
-
openActivityTab(tabId: string, options?: {
|
|
110
|
-
width?: number | "max";
|
|
111
|
-
cwd?: string;
|
|
112
|
-
}): void;
|
|
113
|
-
setActivityTabVisible(tabId: string, visible: boolean, options?: {
|
|
114
|
-
cwd?: string;
|
|
115
|
-
}): void;
|
|
116
|
-
notify(options: {
|
|
117
|
-
message: string;
|
|
118
|
-
title?: string;
|
|
119
|
-
variant?: "info" | "success" | "warning" | "error";
|
|
120
|
-
durationMs?: number;
|
|
121
|
-
}): void;
|
|
122
|
-
};
|
|
123
|
-
network: {
|
|
124
|
-
request<T = unknown>(request: PluginNetworkRequest): Promise<PluginNetworkResponse<T>>;
|
|
125
|
-
};
|
|
126
|
-
storage: {
|
|
127
|
-
readJson<T = unknown>(key: string): Promise<T | null>;
|
|
128
|
-
writeJson(key: string, value: unknown): Promise<void>;
|
|
129
|
-
list(prefix?: string): Promise<string[]>;
|
|
130
|
-
readFile(path: string): Promise<string | null>;
|
|
131
|
-
writeFile(path: string, data: string): Promise<void>;
|
|
132
|
-
putBlob(input: PluginPutBlobInput): Promise<PluginStoredBlobRef>;
|
|
133
|
-
readBlob(id: string): Promise<PluginStoredBlob | null>;
|
|
134
|
-
getBlobRef(id: string): Promise<PluginStoredBlobRef | null>;
|
|
135
|
-
};
|
|
136
|
-
settings: {
|
|
137
|
-
get<T = unknown>(key: string): T | undefined;
|
|
138
|
-
getAll(): Record<string, unknown>;
|
|
139
|
-
onChange(handler: (values: Record<string, unknown>) => void): void;
|
|
140
|
-
};
|
|
141
|
-
i18n: {
|
|
142
|
-
locale: string;
|
|
143
|
-
t(key: string, params?: Record<string, string | number>): Promise<string>;
|
|
144
|
-
onChange(handler: (locale: string) => void): void;
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
//# sourceMappingURL=quickjs.d.ts.map
|
package/dist/quickjs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quickjs.d.ts","sourceRoot":"","sources":["../src/quickjs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,yBAAyB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/F,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACtC,GAAG,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACnC,QAAQ,EAAE,qBAAqB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAA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,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1E,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAAC;KAClD,CAAC;CACF","sourcesContent":["import type { ConversationScenario } from \"./scenario.js\";\nimport type { PluginNetworkRequest, PluginNetworkResponse } from \"./network.js\";\nimport type { PluginPutBlobInput, PluginStoredBlob, PluginStoredBlobRef } from \"./storage.js\";\nimport type { PluginActivityTabRetention } from \"./ui.js\";\n\nexport type PluginDeclarativeTextTone = \"default\" | \"muted\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface PluginDeclarativeStack {\n\ttype: \"stack\";\n\tdirection?: \"vertical\" | \"horizontal\";\n\tgap?: \"small\" | \"medium\" | \"large\";\n\tchildren: PluginDeclarativeNode[];\n}\n\nexport interface PluginDeclarativeSection {\n\ttype: \"section\";\n\ttitle?: string;\n\tdescription?: string;\n\tchildren: PluginDeclarativeNode[];\n}\n\nexport interface PluginDeclarativeText {\n\ttype: \"text\";\n\ttext: string;\n\tstyle?: \"body\" | \"heading\" | \"caption\" | \"code\";\n\ttone?: PluginDeclarativeTextTone;\n}\n\nexport interface PluginDeclarativeButton {\n\ttype: \"button\";\n\tlabel: string;\n\taction: string;\n\tvariant?: \"primary\" | \"secondary\" | \"outline\" | \"destructive\";\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeInput {\n\ttype: \"input\";\n\taction: string;\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\tinputType?: \"text\" | \"password\" | \"number\";\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeTextarea {\n\ttype: \"textarea\";\n\taction: string;\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeSelectOption {\n\tvalue: string;\n\tlabel: string;\n}\n\nexport interface PluginDeclarativeSelect {\n\ttype: \"select\";\n\taction: string;\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\toptions: PluginDeclarativeSelectOption[];\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeSwitch {\n\ttype: \"switch\";\n\taction: string;\n\tlabel: string;\n\tchecked?: boolean;\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeDivider {\n\ttype: \"divider\";\n}\n\n/** Serializable UI rendered exclusively with host-owned components. */\nexport type PluginDeclarativeNode =\n\t| PluginDeclarativeStack\n\t| PluginDeclarativeSection\n\t| PluginDeclarativeText\n\t| PluginDeclarativeButton\n\t| PluginDeclarativeInput\n\t| PluginDeclarativeTextarea\n\t| PluginDeclarativeSelect\n\t| PluginDeclarativeSwitch\n\t| PluginDeclarativeDivider;\n\nexport interface PluginQuickJsActivityTab {\n\tid: string;\n\tlabel: string;\n\tview: PluginDeclarativeNode;\n\tscope_use?: readonly ConversationScenario[];\n\tinitiallyVisible?: boolean;\n\t/** Defaults to `\"warm\"`; see PluginActivityTabContribution. */\n\tretention?: PluginActivityTabRetention;\n}\n\nexport interface PluginDeclarativeActionEvent {\n\ttabId: string;\n\taction: string;\n\tkind: \"press\" | \"change\";\n\tvalue?: string | number | boolean;\n}\n\n/**\n * Public contract exposed as the frozen `vetta` global inside a QuickJS plugin.\n * QuickJS entry scripts are classic scripts and must not import host modules.\n */\nexport interface PluginQuickJsApi {\n\tactivate(handler: (context: PluginQuickJsContext) => void): void;\n\tdeactivate(handler: () => void): void;\n}\n\nexport interface PluginQuickJsContext {\n\tplugin: { id: string; version: string; iconUrl?: string };\n\tpermissions: { has(permission: string): boolean };\n\tui: {\n\t\tregisterActivityTab(contribution: PluginQuickJsActivityTab): void;\n\t\tupdateActivityTab(tabId: string, view: PluginDeclarativeNode): void;\n\t\tonAction(action: string, handler: (event: PluginDeclarativeActionEvent) => void | Promise<void>): void;\n\t\topenActivityTab(tabId: string, options?: { width?: number | \"max\"; cwd?: string }): void;\n\t\tsetActivityTabVisible(tabId: string, visible: boolean, options?: { cwd?: string }): void;\n\t\tnotify(options: {\n\t\t\tmessage: string;\n\t\t\ttitle?: string;\n\t\t\tvariant?: \"info\" | \"success\" | \"warning\" | \"error\";\n\t\t\tdurationMs?: number;\n\t\t}): void;\n\t};\n\tnetwork: {\n\t\trequest<T = unknown>(request: PluginNetworkRequest): Promise<PluginNetworkResponse<T>>;\n\t};\n\tstorage: {\n\t\treadJson<T = unknown>(key: string): Promise<T | null>;\n\t\twriteJson(key: string, value: unknown): Promise<void>;\n\t\tlist(prefix?: string): Promise<string[]>;\n\t\treadFile(path: string): Promise<string | null>;\n\t\twriteFile(path: string, data: string): Promise<void>;\n\t\tputBlob(input: PluginPutBlobInput): Promise<PluginStoredBlobRef>;\n\t\treadBlob(id: string): Promise<PluginStoredBlob | null>;\n\t\tgetBlobRef(id: string): Promise<PluginStoredBlobRef | null>;\n\t};\n\tsettings: {\n\t\tget<T = unknown>(key: string): T | undefined;\n\t\tgetAll(): Record<string, unknown>;\n\t\tonChange(handler: (values: Record<string, unknown>) => void): void;\n\t};\n\ti18n: {\n\t\tlocale: string;\n\t\tt(key: string, params?: Record<string, string | number>): Promise<string>;\n\t\tonChange(handler: (locale: string) => void): void;\n\t};\n}\n"]}
|
package/dist/quickjs.js
DELETED
package/dist/quickjs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quickjs.js","sourceRoot":"","sources":["../src/quickjs.ts"],"names":[],"mappings":"","sourcesContent":["import type { ConversationScenario } from \"./scenario.js\";\nimport type { PluginNetworkRequest, PluginNetworkResponse } from \"./network.js\";\nimport type { PluginPutBlobInput, PluginStoredBlob, PluginStoredBlobRef } from \"./storage.js\";\nimport type { PluginActivityTabRetention } from \"./ui.js\";\n\nexport type PluginDeclarativeTextTone = \"default\" | \"muted\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface PluginDeclarativeStack {\n\ttype: \"stack\";\n\tdirection?: \"vertical\" | \"horizontal\";\n\tgap?: \"small\" | \"medium\" | \"large\";\n\tchildren: PluginDeclarativeNode[];\n}\n\nexport interface PluginDeclarativeSection {\n\ttype: \"section\";\n\ttitle?: string;\n\tdescription?: string;\n\tchildren: PluginDeclarativeNode[];\n}\n\nexport interface PluginDeclarativeText {\n\ttype: \"text\";\n\ttext: string;\n\tstyle?: \"body\" | \"heading\" | \"caption\" | \"code\";\n\ttone?: PluginDeclarativeTextTone;\n}\n\nexport interface PluginDeclarativeButton {\n\ttype: \"button\";\n\tlabel: string;\n\taction: string;\n\tvariant?: \"primary\" | \"secondary\" | \"outline\" | \"destructive\";\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeInput {\n\ttype: \"input\";\n\taction: string;\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\tinputType?: \"text\" | \"password\" | \"number\";\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeTextarea {\n\ttype: \"textarea\";\n\taction: string;\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeSelectOption {\n\tvalue: string;\n\tlabel: string;\n}\n\nexport interface PluginDeclarativeSelect {\n\ttype: \"select\";\n\taction: string;\n\tlabel?: string;\n\tvalue?: string;\n\tplaceholder?: string;\n\toptions: PluginDeclarativeSelectOption[];\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeSwitch {\n\ttype: \"switch\";\n\taction: string;\n\tlabel: string;\n\tchecked?: boolean;\n\tdisabled?: boolean;\n}\n\nexport interface PluginDeclarativeDivider {\n\ttype: \"divider\";\n}\n\n/** Serializable UI rendered exclusively with host-owned components. */\nexport type PluginDeclarativeNode =\n\t| PluginDeclarativeStack\n\t| PluginDeclarativeSection\n\t| PluginDeclarativeText\n\t| PluginDeclarativeButton\n\t| PluginDeclarativeInput\n\t| PluginDeclarativeTextarea\n\t| PluginDeclarativeSelect\n\t| PluginDeclarativeSwitch\n\t| PluginDeclarativeDivider;\n\nexport interface PluginQuickJsActivityTab {\n\tid: string;\n\tlabel: string;\n\tview: PluginDeclarativeNode;\n\tscope_use?: readonly ConversationScenario[];\n\tinitiallyVisible?: boolean;\n\t/** Defaults to `\"warm\"`; see PluginActivityTabContribution. */\n\tretention?: PluginActivityTabRetention;\n}\n\nexport interface PluginDeclarativeActionEvent {\n\ttabId: string;\n\taction: string;\n\tkind: \"press\" | \"change\";\n\tvalue?: string | number | boolean;\n}\n\n/**\n * Public contract exposed as the frozen `vetta` global inside a QuickJS plugin.\n * QuickJS entry scripts are classic scripts and must not import host modules.\n */\nexport interface PluginQuickJsApi {\n\tactivate(handler: (context: PluginQuickJsContext) => void): void;\n\tdeactivate(handler: () => void): void;\n}\n\nexport interface PluginQuickJsContext {\n\tplugin: { id: string; version: string; iconUrl?: string };\n\tpermissions: { has(permission: string): boolean };\n\tui: {\n\t\tregisterActivityTab(contribution: PluginQuickJsActivityTab): void;\n\t\tupdateActivityTab(tabId: string, view: PluginDeclarativeNode): void;\n\t\tonAction(action: string, handler: (event: PluginDeclarativeActionEvent) => void | Promise<void>): void;\n\t\topenActivityTab(tabId: string, options?: { width?: number | \"max\"; cwd?: string }): void;\n\t\tsetActivityTabVisible(tabId: string, visible: boolean, options?: { cwd?: string }): void;\n\t\tnotify(options: {\n\t\t\tmessage: string;\n\t\t\ttitle?: string;\n\t\t\tvariant?: \"info\" | \"success\" | \"warning\" | \"error\";\n\t\t\tdurationMs?: number;\n\t\t}): void;\n\t};\n\tnetwork: {\n\t\trequest<T = unknown>(request: PluginNetworkRequest): Promise<PluginNetworkResponse<T>>;\n\t};\n\tstorage: {\n\t\treadJson<T = unknown>(key: string): Promise<T | null>;\n\t\twriteJson(key: string, value: unknown): Promise<void>;\n\t\tlist(prefix?: string): Promise<string[]>;\n\t\treadFile(path: string): Promise<string | null>;\n\t\twriteFile(path: string, data: string): Promise<void>;\n\t\tputBlob(input: PluginPutBlobInput): Promise<PluginStoredBlobRef>;\n\t\treadBlob(id: string): Promise<PluginStoredBlob | null>;\n\t\tgetBlobRef(id: string): Promise<PluginStoredBlobRef | null>;\n\t};\n\tsettings: {\n\t\tget<T = unknown>(key: string): T | undefined;\n\t\tgetAll(): Record<string, unknown>;\n\t\tonChange(handler: (values: Record<string, unknown>) => void): void;\n\t};\n\ti18n: {\n\t\tlocale: string;\n\t\tt(key: string, params?: Record<string, string | number>): Promise<string>;\n\t\tonChange(handler: (locale: string) => void): void;\n\t};\n}\n"]}
|