@xiongtao.xt/tau-plugins 0.53.0 → 0.55.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # 更新记录
2
2
 
3
+ ## 0.55.0
4
+
5
+ - 新增 `context.notebooks.registerOutput({ id, title, icon?, description?, kind, options?, view, prepare, complete, fail? })`:在 Notebook 的生成菜单里加一种产物。对话框、资料勾选与 AI 生成由 Tau 负责(走 Notebook 已有的生成流程与资料检索);`prepare` 建好产物占位并返回任务说明 `{ entity, title, instructions, reminders? }`,`complete` 收到最终正文与 `task`(`phase` / `progress`),`fail` 在失败或停止时调用。Tau 自动建立产物到 Notebook 的 `output` 关联。新增宿主接口 `NotebooksAdapter`,贡献类型 `notebook-output`。目前只有桌面支持。
6
+
7
+ ## 0.54.0
8
+
9
+ - 新增 `context.tts.open({ signal })` 朗读:沿用用户在「设置 › 语音」里选的服务与模型,返回会话 `{ providerName, textInstructions, getVoices, synthesize, close }`,插件停用时自动关闭;`unavailableReason()` 判断能否朗读。需要在 manifest 声明新权限 `tts:synthesize`,首次调用时询问用户;宿主未接入时 `open` 抛 `TTS_UNAVAILABLE`。新增宿主接口 `TTSSynthesisAdapter`。目前只有桌面支持。
10
+ - 新增 `context.upload.save(file, { signal })`:按用户当前的资源存储(本地库或资源上传插件)保存文件,返回可写入正文、可交给 `useResource` / `MediaAudio` 的地址。宿主上传适配器新增可选 `save`,未提供时抛 `UPLOAD_UNAVAILABLE`。目前只有桌面支持。
11
+
3
12
  ## 0.53.0
4
13
 
5
14
  - 新增 `useSettingsDraft({ dirty, errors?, changes?, save, reset, onInvalid?, saveLabel?, savingText? })`:插件设置组件报告草稿状态,Tau 在有改动时显示悬浮保存条(⌘S 保存),切换页面、标签、设置分组或关闭窗口前询问「保存并离开 / 继续编辑 / 放弃修改」。`save` 抛错时保存条显示错误;`errors` 大于 0 时不能保存。返回 `{ saving, save }`,不在 Tau 设置分区内时返回 null,组件需要自己提供保存入口。
@@ -134,7 +134,7 @@ function readCatalogFields(item) {
134
134
  // packages/plugins/src/ai.ts
135
135
  var PLUGIN_AI_CAPABILITIES = {
136
136
  chat: { name: "\u5BF9\u8BDD\u529F\u80FD" },
137
- flashcardGeneration: { name: "\u95EA\u5361\u5236\u4F5C" }
137
+ flashcardGeneration: { name: "\u95EA\u5361" }
138
138
  };
139
139
  var isPluginAICapability = (value) => typeof value === "string" && Object.hasOwn(PLUGIN_AI_CAPABILITIES, value);
140
140
 
@@ -170,6 +170,7 @@ var PLUGIN_PERMISSIONS = [
170
170
  "flashcards:read",
171
171
  "flashcards:write",
172
172
  "speech:input",
173
+ "tts:synthesize",
173
174
  ...aiPermissions
174
175
  ];
175
176
  var permissionIds = new Set(PLUGIN_PERMISSIONS);
@@ -4,7 +4,7 @@ import {
4
4
  readPluginFilePath,
5
5
  readPluginFiles,
6
6
  readPluginMetadata
7
- } from "./chunk-M4KRTX2I.js";
7
+ } from "./chunk-6XAEU7BJ.js";
8
8
 
9
9
  // packages/plugins/src/package-targets.ts
10
10
  var PACKAGE_PLATFORMS = ["desktop", "android", "ios"];
@@ -141,9 +141,12 @@ create: () => ({
141
141
  | `home` | 注册首页面板 | [界面](ui.md#首页面板) |
142
142
  | `actions` | 在卡片、文章、项目文档的菜单里加动作 | [界面](ui.md#对象动作) |
143
143
  | `views` | 在卡片、文章、项目文档详情里放区块 | [界面](ui.md#详情区块) |
144
+ | `notebooks` | 在 Notebook 的生成菜单里加产物 | [界面](ui.md#notebook-输出) |
144
145
  | `settings` | 注册设置区域 | [界面](ui.md#设置) |
145
146
  | `notifications` | 发送通知 | [界面](ui.md#通知) |
146
147
  | `speech` | 语音输入,拿到识别文字 | [界面](ui.md#语音输入) |
148
+ | `tts.open` | 用用户选的语音服务朗读文字 | [界面](ui.md#朗读) |
149
+ | `upload.save` | 把文件存进用户的资源存储 | [用户数据](user-data.md#保存资源文件) |
147
150
  | `storage` | 插件私有存储 | [存储与网络](storage-and-network.md) |
148
151
  | `fetch` | 网络请求 | [存储与网络](storage-and-network.md#网络请求) |
149
152
  | `websocket` | WebSocket 连接 | [存储与网络](storage-and-network.md#websocket) |
@@ -37,7 +37,9 @@
37
37
  | `embeddings`、`video`、`publish` 提供方 | ✓ | | |
38
38
  | `home` | ✓ | ✓ | 手机 0.2.16 起,见[界面 · 首页面板](ui.md#首页面板) |
39
39
  | `speech` | | ✓ | 手机 0.2.16 起,见[界面 · 语音输入](ui.md#语音输入) |
40
+ | `tts.open`、`upload.save` | ✓ | | 见[界面 · 朗读](ui.md#朗读)与[用户数据 · 保存资源文件](user-data.md#保存资源文件) |
40
41
  | `sidebar`、`views`、`notifications` | ✓ | | 跨平台的入口用 `navigation` |
42
+ | `notebooks` | ✓ | | 见[界面 · Notebook 输出](ui.md#notebook-输出) |
41
43
  | `actions` | ✓ | 部分 | 手机只有卡片、文章、项目文档详情页的「更多」菜单,见[界面 · 对象动作](ui.md#对象动作) |
42
44
  | `permissions`、`data`、`content`、`events` | ✓ | 部分 | 手机 0.2.13 起支持卡片、文章、项目、项目文档、待办、日程,见[用户数据](user-data.md) |
43
45
  | `app` | ✓ | 部分 | 手机可以选择、描述和打开上述内容与插件内容;`run` 只有新建卡片、插入项目文档和协作共享,见[用户数据](user-data.md#选择并打开已有内容) |
@@ -91,6 +93,7 @@ context.settings.register({
91
93
 
92
94
  - 只是从别的页面打开的详情页,可以不注册入口。
93
95
  - 手机上没有命令面板,主要功能一定要有入口。
96
+ - 页面容器默认已避开系统安全区,布局与吸底规则见[手机页面的布局边界](ui.md#手机页面的布局边界)。
94
97
  - `@tau/ui` 的 `Dialog`、`Drawer` 在手机上会处理系统返回键和安全区,直接使用即可。
95
98
  - 手机系统可能随时结束应用进程,不保证调用离开守卫或 `deactivate`。数据在用户操作时就保存。
96
99
 
@@ -107,7 +107,7 @@ const probe = await context.services.videoExtractor.probe(url, { signal });
107
107
 
108
108
  根据 `formats` 组织清晰度,`getPlayback` 时返回 `{ kind: "extract", url, videoFormat, audioFormat }`。插件不能自己启动外部程序下载视频。
109
109
 
110
- 同一解析器可读取字幕:`context.services.videoExtractor.getCaptions(url, { proxy, signal })` 返回 `VideoCaptions | null`。它只下载一条 JSON3 字幕轨,优先人工字幕、同类优先原语言,无轨道时返回 null,不下载视频或调用转录模型。代理与本次调用一致;只有接入该服务的桌面客户端支持,较早客户端不会调用新字幕接口。
110
+ 同一解析器可读取字幕:`context.services.videoExtractor.getCaptions(url, { proxy, signal })` 返回 `VideoCaptions | null`。它支持 JSON3、WebVTT(VTT)和 SubRip(SRT),只下载一条字幕轨:优先人工字幕、同类优先原语言,同一语言按 JSON3 → VTT → SRT 选择格式。结果统一为纯文本与毫秒起止时间;没有受支持的字幕轨或有效片段时返回 null,不下载视频或调用转录模型。代理与本次调用一致;只有接入该服务的桌面客户端支持,较早客户端不会调用新字幕接口。
111
111
 
112
112
  ## 配置表单
113
113
 
package/docs/ui.md CHANGED
@@ -47,6 +47,15 @@ await stats.open();
47
47
 
48
48
  注册页面不会自动出现入口。用户要能找到它,再注册一个[功能入口](#功能入口)。
49
49
 
50
+ ### 手机页面的布局边界
51
+
52
+ 宿主提供的页面容器已经避开顶部导航和底部系统安全区,底部安全区固定在滚动区外;键盘弹出时,容器自动缩小到键盘上方,底部安全区预留归零。所有插件默认遵守这一边界,不需要额外注册选项。
53
+
54
+ - 普通内容由宿主滚动。页面根节点可用 `min-height: 100%` 铺满容器,需要吸底的操作条用 `position: sticky; bottom: 0`,放在页面内容末尾。
55
+ - 页面与底栏只添加自身的间距,不再读取 `env(safe-area-inset-bottom)`,也不追加系统安全区占位。
56
+ - 高度相对于宿主容器计算,不用 `100vh`、`100dvh` 或 `position: fixed` 把页面撑到整个屏幕。
57
+ - 全屏浮层不属于页面内容容器,优先使用 `@tau/ui` 的 `Dialog`、`Drawer`,由组件处理安全区和系统返回。
58
+
50
59
  ### 带参数的页面
51
60
 
52
61
  同一个页面需要展示不同对象(例如不同的书)时,使用 `match: "params"`:
@@ -478,7 +487,7 @@ context.home.registerPanel({
478
487
  - 正文渲染出错时,这块面板显示错误和「重试」,不影响首页其他内容。
479
488
  - 首页只在主窗口显示,打开首页时组件才会渲染;需要随时更新的数据在组件里订阅(如 `context.events`),卸载时取消。
480
489
 
481
- 手机上面板显示在「今天」页的问答条下面、日程上面,打开 App 第一屏就能看到。`compact` 面板两个一行排成小卡(约 160 × 130),`wide` 占整行;标题和 `action` 同样由 Tau 画在卡片顶部。小卡里放一个大数字加一两个按钮最合适,不要放输入框,记录类操作用按钮跳到插件页面。手机上没有「调整首页」,面板按插件启用顺序排列。
490
+ 手机上面板显示在「今天」页的问答条下面、日程上面,打开 App 第一屏就能看到。`compact` 面板两个一行排成小卡(约 160 × 130),`wide` 占整行;标题和 `action` 同样由 Tau 画在卡片顶部。声明 `action` 后,点击卡片标题、正文或空白处也会执行该入口;正文里的独立按钮、链接、输入控件和自绘浮层应在自身交互边界调用 `event.stopPropagation()`,避免同时触发卡片入口;Portal 浮层也会沿 React 组件树冒泡,需要同样处理。小卡里放一个大数字加一两个按钮最合适,不要放输入框,记录类操作用按钮跳到插件页面。手机上没有「调整首页」,面板按插件启用顺序排列。
482
491
 
483
492
  需要按平台显示不同的正文时,在组件里读 `usePluginEnvironment()`,见[多端适配](portability.md#读取运行环境)。面板里自己画的底部面板这类浮层,用 props 里的 `registerDismiss(close)` 登记,系统返回会先关浮层;它与页面的 `pageContext.registerDismiss` 用法相同,Tau 版本不支持时为 `undefined`。
484
493
 
@@ -563,6 +572,57 @@ context.views.registerEntityPanel({
563
572
  - 用户在详情页之间切换时,组件不会重新挂载,只换 `target`;按 `target` 取数据的 effect 要把它放进依赖。
564
573
  - 渲染出错时这一块显示错误和「重试」,不影响详情页其他内容。只在主窗口出现,独立编辑窗口不显示。
565
574
 
575
+ ## Notebook 输出
576
+
577
+ 在 Notebook 的「生成」菜单(产物组的 + 与资料页的「基于这份资料」)里加一种产物,例如播客。对话框、资料勾选、AI 生成和执行过程页都由 Tau 负责:AI 走 Notebook 已有的生成流程,会按需检索、补读用户勾选的资料。插件只说明要什么,拿到生成的正文后自己处理。目前只有桌面支持。
578
+
579
+ ```tsx
580
+ context.notebooks.registerOutput({
581
+ id: "podcast",
582
+ title: "播客",
583
+ icon: Podcast,
584
+ kind: "episode", // 产物对应的插件实体类型,须先 registerKind
585
+ options: PodcastOptions, // 放在对话框中间的选项区
586
+ view: EpisodeView, // 产物在 Notebook 阅读区里的显示
587
+ async prepare({ notebook, resources, userPrompt, options, signal }) {
588
+ const entity = await context.entities.create({ kind: "episode", key: crypto.randomUUID(), meta: {} });
589
+ return {
590
+ entity: entity.id,
591
+ title: "播客脚本",
592
+ instructions: "写一段约 5 分钟的双人对话……最终每行输出「说话人: 内容」",
593
+ reminders: ["不要输出标题或说明"],
594
+ };
595
+ },
596
+ async complete({ entity, text, task, signal }) {
597
+ task.phase("合成语音");
598
+ // …解析 text、合成、保存,task.progress(done, total) 更新进度
599
+ },
600
+ async fail({ entity, reason }) {
601
+ // 生成失败或用户停止:清理占位或标为失败
602
+ },
603
+ });
604
+ ```
605
+
606
+ | 字段 | 说明 |
607
+ | ------------- | ---------------------------------------------------------------------------------------- |
608
+ | `id` | 局部 ID |
609
+ | `title` | 菜单、对话框与执行过程页里的名称 |
610
+ | `icon` | 可选。图标组件(同[侧边栏图标](#图标)) |
611
+ | `description` | 可选。对话框标题下的一句话 |
612
+ | `kind` | 产物对应的插件实体类型 |
613
+ | `options` | 可选。选项区组件,收到 `{ context, target, value, onChange, setBlocker }` |
614
+ | `view` | 阅读区组件,收到 `{ context, entity, notebook }` |
615
+ | `prepare` | 用户点「开始生成」时调用:建好产物占位,返回 `{ entity, title, instructions, reminders? }` |
616
+ | `complete` | 生成完成后调用:收到最终正文 `text` 与 `task`(`phase(text)`、`progress(done, total)`) |
617
+ | `fail` | 可选。生成失败、`complete` 抛错或用户停止时调用,`reason` 为 `failed` 或 `cancelled` |
618
+
619
+ - `instructions` 只写这一种产物的要求与输出格式。资料清单、检索工具的用法和「先读资料再写」等通用规则由 Tau 补上,不要重复。
620
+ - 选项区的 `value` 由插件定义(JSON),Tau 原样保存并在 `prepare` 时交回;`setBlocker(原因)` 让「开始生成」不可用,并在对话框底部显示原因。
621
+ - 插件读不到资料内容,只拿到资料名称和生成的正文。用户在对话框里勾选资料并点「开始」即视为同意,不需要另外申请权限。
622
+ - `prepare` 返回后,Tau 建一条从产物指向这个 Notebook 的关联(角色 `output`),并把 Notebook 登记为插件选择过的引用;产物据此出现在 Notebook 的产物列表里,点开时显示 `view`。插件停用后,它的产物不在列表里显示。
623
+ - 生成用 Notebook 的模型分配,用量单独记在「Notebook · 插件名」名下,不占插件 AI 额度。
624
+ - 失败或停止时,Tau 等待 `fail` 完成后才允许重试。「重新生成」在产物实体仍存在时沿用任务说明并重跑生成与 `complete`;若插件已删除占位,则重新调用 `prepare`、建立 Notebook 关联并打开新产物。
625
+
566
626
  ## 语音输入
567
627
 
568
628
  插件可以让用户按住说话,拿到识别后的文字。目前只有手机支持(0.2.16 起)。识别方式沿用用户在 Tau「语音 › 语音输入」里的设置(系统识别或识别插件),插件不接触音频。在 manifest 的 `permissions` 里声明 `speech:input`,第一次调用 `start` 时 Tau 询问用户。
@@ -590,6 +650,36 @@ const text = await session.result;
590
650
  - 「按住说话、上滑取消」这类手势由插件自己实现;`unavailableReason` 可以在按下前判断,给出提示。
591
651
  - 桌面上 `unavailableReason` 返回不可用原因,`start` 抛出以 `SPEECH_UNAVAILABLE` 开头的错误;同时支持两端的插件先判断再显示按钮。
592
652
 
653
+ ## 朗读
654
+
655
+ 插件可以把文字念出来,拿到音频字节,例如把文章改写成对话后逐句合成。目前只有桌面支持。用的是用户在 Tau「设置 › 语音」里选的语音服务与模型,费用计入该服务;插件不接触账号。在 manifest 的 `permissions` 里声明 `tts:synthesize`,第一次调用 `open` 时 Tau 询问用户。
656
+
657
+ ```ts
658
+ const reason = context.tts.unavailableReason();
659
+ if (reason) return toast.info(reason);
660
+ const session = await context.tts.open({ signal });
661
+ try {
662
+ const voices = await session.getVoices({ signal });
663
+ const { audio, mime } = await session.synthesize({ text: "你好", voiceId: voices[0].id }, { signal });
664
+ } finally {
665
+ await session.close();
666
+ }
667
+ ```
668
+
669
+ | 接口 | 说明 |
670
+ | --------------------------------------------- | ----------------------------------------------------------------------- |
671
+ | `unavailableReason()` | 当前不能朗读的原因(如还没有选语音服务),可以朗读时为 `null`;不会询问授权 |
672
+ | `open({ signal })` | 打开一次会话,固定当时选的服务与模型 |
673
+ | `session.providerName` | 服务的显示名 |
674
+ | `session.textInstructions` | 可选。服务对朗读文字的要求(如可用的停顿标签),可以写进给 AI 的提示词 |
675
+ | `session.getVoices({ signal })` | 可用音色,含用户克隆的音色 |
676
+ | `session.synthesize({ text, voiceId, options })` | 合成一段,返回 `{ audio: Uint8Array, mime }`;`options` 可带 `speed`、`volume`、`pitch` |
677
+ | `session.close()` | 用完关闭;插件停用时会自动关闭 |
678
+
679
+ - 一次会话里连续合成多段,比每段都 `open` 快。用户在会话打开期间改了语音设置,已打开的会话仍用原来的服务。
680
+ - 音色克隆不对插件开放,引导用户到「设置 › 语音」克隆后,克隆的音色会出现在 `getVoices` 里。
681
+ - 宿主不支持时 `open` 抛出以 `TTS_UNAVAILABLE` 开头的错误。合成好的音频用[保存资源文件](user-data.md#保存资源文件)存进用户的笔记库。
682
+
593
683
  ## 通知
594
684
 
595
685
  ```ts
package/docs/user-data.md CHANGED
@@ -29,6 +29,7 @@
29
29
  | `chats:read` | 读取 AI 对话的信息,不含消息内容 |
30
30
  | `flashcards:read`、`flashcards:write` | 闪卡,见[闪卡](flashcards.md) |
31
31
  | `ai:<能力名>` | 使用 Tau 已配置的大模型,见 [AI](ai.md) |
32
+ | `speech:input`、`tts:synthesize` | 语音输入、朗读,见[界面](ui.md#语音输入) |
32
33
 
33
34
  ### 用户如何授权
34
35
 
@@ -670,6 +671,23 @@ const open = await context.entities.count({
670
671
  - 写入时,声明过的字段的值必须是声明的类型或 `null`,否则抛错。类型不符的旧数据(例如声明之前写入的)在查询里按没有值处理。
671
672
  - `indexes` 是 `meta` 的顶层字段,最多 16 个。声明只在插件运行时生效,修改声明不需要迁移数据。
672
673
 
674
+ ### 保存资源文件
675
+
676
+ 插件生成的音频、图片等文件用 `context.upload.save` 存进用户的资源存储:用户选的是本地库就存进笔记库的资源目录,选了资源上传插件就上传到那里,与在正文里插入图片走同一条路径。不需要权限。
677
+
678
+ ```ts
679
+ const url = await context.upload.save(
680
+ { name: "episode.mp3", mimeType: "audio/mpeg", content: bytes },
681
+ { signal }
682
+ );
683
+ await context.entities.update(id, { meta: { ...entity.meta, audioUrl: url } }, revision);
684
+ ```
685
+
686
+ - 返回的地址可以写进插件内容的 `meta` 或正文,播放、显示时交给 `useResource` 或 `MediaAudio`、`MediaImage`,由 Tau 解析成可加载的地址。
687
+ - 文件名由 Tau 改成不重名的名字,扩展名保留。
688
+ - 删除插件内容不会删除已保存的文件。
689
+ - 只有桌面支持,其他宿主抛出以 `UPLOAD_UNAVAILABLE` 开头的错误。
690
+
673
691
  ## 插件记录
674
692
 
675
693
  `context.records` 保存插件内部使用的结构化数据,例如分组、操作轨迹、看板的列。记录用户看不到,也不会出现在搜索里;需要用户能看见、能打开的内容,用上面的「插件内容」。**读写自己的记录不需要任何权限。**
package/package.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  isPluginPermission,
13
13
  validateBackendManifest,
14
14
  validatePluginManifest
15
- } from "./client/chunk-M4KRTX2I.js";
15
+ } from "./client/chunk-6XAEU7BJ.js";
16
16
  import "./client/chunk-UTVEXGFI.js";
17
17
  export {
18
18
  PLUGIN_AI_CAPABILITIES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiongtao.xt/tau-plugins",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
package/portable.js CHANGED
@@ -11,8 +11,8 @@ import {
11
11
  buildPortablePluginManifest,
12
12
  validatePortableDistributionManifest,
13
13
  validatePortablePluginManifest
14
- } from "./client/chunk-7ZRTRNIF.js";
15
- import "./client/chunk-M4KRTX2I.js";
14
+ } from "./client/chunk-PRE35AOA.js";
15
+ import "./client/chunk-6XAEU7BJ.js";
16
16
  import "./client/chunk-UTVEXGFI.js";
17
17
  export {
18
18
  MOBILE_AI_MIN_VERSION,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  PORTABLE_SHARED_MODULES,
3
3
  validatePortablePluginManifest
4
- } from "./client/chunk-7ZRTRNIF.js";
4
+ } from "./client/chunk-PRE35AOA.js";
5
5
  import {
6
6
  PLUGIN_SHARED_MODULES,
7
7
  validatePluginManifest
8
- } from "./client/chunk-M4KRTX2I.js";
8
+ } from "./client/chunk-6XAEU7BJ.js";
9
9
  import {
10
10
  __commonJS,
11
11
  __toESM
@@ -6888,12 +6888,21 @@ var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1);
6888
6888
  // packages/ui/src/primitives/IconButton.tsx
6889
6889
  var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1);
6890
6890
 
6891
- // packages/ui/src/primitives/Panel.tsx
6891
+ // packages/ui/src/primitives/Tag.tsx
6892
6892
  var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1);
6893
6893
 
6894
- // packages/ui/src/primitives/DocumentCard.tsx
6894
+ // packages/ui/src/primitives/ValueDisplay.tsx
6895
6895
  var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
6896
6896
 
6897
+ // packages/ui/src/primitives/ProgressStatus.tsx
6898
+ var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
6899
+
6900
+ // packages/ui/src/primitives/Panel.tsx
6901
+ var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
6902
+
6903
+ // packages/ui/src/primitives/DocumentCard.tsx
6904
+ var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
6905
+
6897
6906
  // packages/ui/src/primitives/Toast.tsx
6898
6907
  var import_react23 = __toESM(require_react(), 1);
6899
6908
 
@@ -6967,7 +6976,7 @@ var createImpl = (createState) => {
6967
6976
  var create = (createState) => createState ? createImpl(createState) : createImpl;
6968
6977
 
6969
6978
  // packages/ui/src/primitives/Toast.tsx
6970
- var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1);
6979
+ var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
6971
6980
  var MAX_VISIBLE = 4;
6972
6981
  var useToastStore = create()((set) => ({
6973
6982
  items: [],
@@ -6983,7 +6992,7 @@ var useToastStore = create()((set) => ({
6983
6992
 
6984
6993
  // packages/ui/src/primitives/Notification.tsx
6985
6994
  var import_react24 = __toESM(require_react(), 1);
6986
- var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
6995
+ var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
6987
6996
  var DEFAULT_DURATION = 8e3;
6988
6997
  var LEAVE_MS = 260;
6989
6998
  var useNotificationStore = create()((set, get) => ({
@@ -7106,9 +7115,9 @@ function applyArrowPosition({ side, arrowX, arrowY }, pop) {
7106
7115
  }
7107
7116
 
7108
7117
  // packages/ui/src/primitives/FloatingArrow.tsx
7109
- var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
7118
+ var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
7110
7119
  function FloatingArrow({ tone = "surface" }) {
7111
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7120
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7112
7121
  "span",
7113
7122
  {
7114
7123
  "aria-hidden": true,
@@ -7212,7 +7221,7 @@ function useAnchoredPosition({
7212
7221
  }
7213
7222
 
7214
7223
  // packages/ui/src/primitives/Tooltip.tsx
7215
- var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
7224
+ var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
7216
7225
 
7217
7226
  // packages/ui/src/primitives/Select.tsx
7218
7227
  var import_react29 = __toESM(require_react(), 1);
@@ -7360,7 +7369,7 @@ function useListNavigation(opts) {
7360
7369
  }
7361
7370
 
7362
7371
  // packages/ui/src/primitives/Select.tsx
7363
- var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
7372
+ var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
7364
7373
 
7365
7374
  // packages/ui/src/primitives/Menu.tsx
7366
7375
  var import_react31 = __toESM(require_react(), 1);
@@ -7395,7 +7404,7 @@ function useMenuTree({ open: openProp, onOpenChange, focusReturn }) {
7395
7404
  }
7396
7405
 
7397
7406
  // packages/ui/src/primitives/Menu.tsx
7398
- var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1);
7407
+ var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
7399
7408
  var GAP = 4;
7400
7409
  var SUBMENU_HOVER_MS = 260;
7401
7410
  var MenuRootContext = (0, import_react31.createContext)(null);
@@ -7535,7 +7544,7 @@ function MenuSurface({
7535
7544
  );
7536
7545
  }
7537
7546
  };
7538
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuLevelContext.Provider, { value: levelValue, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7547
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuLevelContext.Provider, { value: levelValue, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7539
7548
  "div",
7540
7549
  {
7541
7550
  ref: containerRef,
@@ -7556,14 +7565,14 @@ function MenuSurface({
7556
7565
  !open && "data-[dir=up]:-translate-y-[4px]",
7557
7566
  className
7558
7567
  ),
7559
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "min-h-0 overflow-y-auto pr-[6px]", children })
7568
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "min-h-0 overflow-y-auto pr-[6px]", children })
7560
7569
  }
7561
7570
  ) });
7562
7571
  }
7563
7572
  var kbdChipClass = "font-tau-mono border-line-1 bg-surface text-ink-2 rounded-[5px] border px-[6px] py-px text-[11px] leading-[1.5]";
7564
7573
  function MenuKbd({ kbd, hlDanger }) {
7565
7574
  if (!kbd) return null;
7566
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7575
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7567
7576
  "span",
7568
7577
  {
7569
7578
  className: cn(
@@ -7577,7 +7586,7 @@ function MenuKbd({ kbd, hlDanger }) {
7577
7586
  }
7578
7587
  function MenuIconSlot({ icon, hlDanger }) {
7579
7588
  if (!icon) return null;
7580
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7589
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7581
7590
  "span",
7582
7591
  {
7583
7592
  className: cn(
@@ -7596,7 +7605,7 @@ function MenuItem({ icon, kbd, danger, disabled, onSelect, children, className }
7596
7605
  const id = (0, import_react31.useId)();
7597
7606
  const isHl = level.hlId === id;
7598
7607
  const hlDanger = isHl && danger === true;
7599
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
7608
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7600
7609
  "div",
7601
7610
  {
7602
7611
  id,
@@ -7622,9 +7631,9 @@ function MenuItem({ icon, kbd, danger, disabled, onSelect, children, className }
7622
7631
  className
7623
7632
  ),
7624
7633
  children: [
7625
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuIconSlot, { icon, hlDanger }),
7626
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
7627
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuKbd, { kbd, hlDanger })
7634
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuIconSlot, { icon, hlDanger }),
7635
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
7636
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuKbd, { kbd, hlDanger })
7628
7637
  ]
7629
7638
  }
7630
7639
  );
@@ -7641,7 +7650,7 @@ function MenuCheckboxItem({
7641
7650
  const level = useMenuLevel();
7642
7651
  const id = (0, import_react31.useId)();
7643
7652
  const isHl = level.hlId === id;
7644
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
7653
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7645
7654
  "div",
7646
7655
  {
7647
7656
  id,
@@ -7662,7 +7671,7 @@ function MenuCheckboxItem({
7662
7671
  className
7663
7672
  ),
7664
7673
  children: [
7665
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7674
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7666
7675
  "span",
7667
7676
  {
7668
7677
  className: cn(
@@ -7671,7 +7680,7 @@ function MenuCheckboxItem({
7671
7680
  checked ? "border-accent bg-accent" : "border-ink-3",
7672
7681
  disabled === true && "opacity-50"
7673
7682
  ),
7674
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7683
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7675
7684
  Check,
7676
7685
  {
7677
7686
  className: cn(
@@ -7683,15 +7692,15 @@ function MenuCheckboxItem({
7683
7692
  )
7684
7693
  }
7685
7694
  ),
7686
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuIconSlot, { icon }),
7687
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
7688
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuKbd, { kbd })
7695
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuIconSlot, { icon }),
7696
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
7697
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuKbd, { kbd })
7689
7698
  ]
7690
7699
  }
7691
7700
  );
7692
7701
  }
7693
7702
  function MenuRadioGroup({ value, onValueChange, children }) {
7694
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(RadioGroupContext.Provider, { value: { value, onValueChange }, children });
7703
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RadioGroupContext.Provider, { value: { value, onValueChange }, children });
7695
7704
  }
7696
7705
  function MenuRadioItem({ value, icon, kbd, disabled, children, className }) {
7697
7706
  const group = (0, import_react31.useContext)(RadioGroupContext);
@@ -7699,7 +7708,7 @@ function MenuRadioItem({ value, icon, kbd, disabled, children, className }) {
7699
7708
  const id = (0, import_react31.useId)();
7700
7709
  const isHl = level.hlId === id;
7701
7710
  const checked = group?.value === value;
7702
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
7711
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7703
7712
  "div",
7704
7713
  {
7705
7714
  id,
@@ -7720,7 +7729,7 @@ function MenuRadioItem({ value, icon, kbd, disabled, children, className }) {
7720
7729
  className
7721
7730
  ),
7722
7731
  children: [
7723
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7732
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7724
7733
  "span",
7725
7734
  {
7726
7735
  className: cn(
@@ -7728,7 +7737,7 @@ function MenuRadioItem({ value, icon, kbd, disabled, children, className }) {
7728
7737
  checked ? "border-accent" : "border-ink-3",
7729
7738
  disabled === true && "opacity-50"
7730
7739
  ),
7731
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7740
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7732
7741
  "span",
7733
7742
  {
7734
7743
  className: cn(
@@ -7740,9 +7749,9 @@ function MenuRadioItem({ value, icon, kbd, disabled, children, className }) {
7740
7749
  )
7741
7750
  }
7742
7751
  ),
7743
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuIconSlot, { icon }),
7744
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
7745
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuKbd, { kbd })
7752
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuIconSlot, { icon }),
7753
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "min-w-0 flex-1 truncate", children }),
7754
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuKbd, { kbd })
7746
7755
  ]
7747
7756
  }
7748
7757
  );
@@ -7755,8 +7764,8 @@ function MenuSubmenu({ label, icon, disabled, children }) {
7755
7764
  const open = !disabled && level.activeSubId === id;
7756
7765
  const isHl = level.hlId === id;
7757
7766
  (0, import_react31.useEffect)(() => () => window.clearTimeout(hoverTimer.current), [disabled, open]);
7758
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
7759
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
7767
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
7768
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
7760
7769
  "div",
7761
7770
  {
7762
7771
  id,
@@ -7787,15 +7796,15 @@ function MenuSubmenu({ label, icon, disabled, children }) {
7787
7796
  "data-[disabled=true]:text-ink-3 data-[disabled=true]:pointer-events-none"
7788
7797
  ),
7789
7798
  children: [
7790
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuIconSlot, { icon }),
7791
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "min-w-0 flex-1 truncate", children: label }),
7792
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronRight, { className: "text-ink-3 ml-auto h-3 w-3 shrink-0", strokeWidth: 2 })
7799
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuIconSlot, { icon }),
7800
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "min-w-0 flex-1 truncate", children: label }),
7801
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ChevronRight, { className: "text-ink-3 ml-auto h-3 w-3 shrink-0", strokeWidth: 2 })
7793
7802
  ]
7794
7803
  }
7795
7804
  ),
7796
7805
  open && (0, import_react_dom4.createPortal)(
7797
7806
  // 子层瞬开(不做 160ms 进场):动态挂载的两帧动画换不来可感知收益,换来测试与时序复杂度
7798
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7807
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7799
7808
  MenuSurface,
7800
7809
  {
7801
7810
  open: true,
@@ -7813,10 +7822,10 @@ function MenuSubmenu({ label, icon, disabled, children }) {
7813
7822
  ] });
7814
7823
  }
7815
7824
  function MenuSeparator() {
7816
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { role: "separator", className: "bg-line-1 mx-1 my-1.5 h-px" });
7825
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { role: "separator", className: "bg-line-1 mx-1 my-1.5 h-px" });
7817
7826
  }
7818
7827
  function MenuGroup({ children }) {
7819
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "text-ink-3 text-tau-tiny px-2.5 pb-1 pt-2 font-semibold tracking-[0.03em] first:pt-1", children });
7828
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-ink-3 text-tau-tiny px-2.5 pb-1 pt-2 font-semibold tracking-[0.03em] first:pt-1", children });
7820
7829
  }
7821
7830
  function Menu({
7822
7831
  trigger,
@@ -7864,10 +7873,10 @@ function Menu({
7864
7873
  }
7865
7874
  }
7866
7875
  };
7867
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuRootContext.Provider, { value: rootValue, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(MenuFitContext.Provider, { value: fit, children: [
7876
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MenuRootContext.Provider, { value: rootValue, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(MenuFitContext.Provider, { value: fit, children: [
7868
7877
  cloneTrigger(triggerEl, injected),
7869
7878
  (0, import_react_dom4.createPortal)(
7870
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7879
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
7871
7880
  MenuSurface,
7872
7881
  {
7873
7882
  open,
@@ -7896,7 +7905,7 @@ Menu.Group = MenuGroup;
7896
7905
  // packages/ui/src/primitives/AnchoredPanel.tsx
7897
7906
  var import_react32 = __toESM(require_react(), 1);
7898
7907
  var import_react_dom5 = __toESM(require_react_dom(), 1);
7899
- var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1);
7908
+ var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
7900
7909
  var PanelHasHeaderContext = (0, import_react32.createContext)(null);
7901
7910
  function AnchoredPanel({
7902
7911
  anchor,
@@ -7923,7 +7932,7 @@ function AnchoredPanel({
7923
7932
  });
7924
7933
  if (!anchor) return null;
7925
7934
  return (0, import_react_dom5.createPortal)(
7926
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7935
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
7927
7936
  "div",
7928
7937
  {
7929
7938
  ref: mergeRefs(externalRef, popRef),
@@ -7941,7 +7950,7 @@ function AnchoredPanel({
7941
7950
  className
7942
7951
  ),
7943
7952
  children: [
7944
- arrow && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FloatingArrow, { tone: "surface" }),
7953
+ arrow && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FloatingArrow, { tone: "surface" }),
7945
7954
  children
7946
7955
  ]
7947
7956
  }
@@ -7953,7 +7962,7 @@ function AnchoredPanelBody({ children, className }) {
7953
7962
  const hasHeader = (0, import_react32.useContext)(PanelHasHeaderContext) ?? false;
7954
7963
  const [scrollEl, setScrollEl] = (0, import_react32.useState)(null);
7955
7964
  useEdgeFade(scrollEl);
7956
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7965
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
7957
7966
  "div",
7958
7967
  {
7959
7968
  ref: setScrollEl,
@@ -7969,7 +7978,7 @@ function AnchoredPanelBody({ children, className }) {
7969
7978
  );
7970
7979
  }
7971
7980
  function AnchoredPanelFooter({ children, className }) {
7972
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7981
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
7973
7982
  "div",
7974
7983
  {
7975
7984
  className: cn(
@@ -7986,21 +7995,21 @@ AnchoredPanel.Footer = AnchoredPanelFooter;
7986
7995
  // packages/ui/src/primitives/Dialog.tsx
7987
7996
  var import_react33 = __toESM(require_react(), 1);
7988
7997
  var import_react_dom6 = __toESM(require_react_dom(), 1);
7989
- var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1);
7998
+ var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
7990
7999
  var DialogContext = (0, import_react33.createContext)({ hasFooter: false });
7991
8000
 
7992
8001
  // packages/ui/src/primitives/ConfirmDialog.tsx
7993
8002
  var import_react34 = __toESM(require_react(), 1);
7994
- var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1);
8003
+ var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
7995
8004
 
7996
8005
  // packages/ui/src/primitives/Drawer.tsx
7997
8006
  var import_react35 = __toESM(require_react(), 1);
7998
8007
  var import_react_dom7 = __toESM(require_react_dom(), 1);
7999
- var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1);
8008
+ var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
8000
8009
 
8001
8010
  // packages/ui/src/primitives/Popover.tsx
8002
8011
  var import_react36 = __toESM(require_react(), 1);
8003
- var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1);
8012
+ var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
8004
8013
  var PopoverRootContext = (0, import_react36.createContext)(null);
8005
8014
  var usePopoverRoot = () => {
8006
8015
  const v2 = (0, import_react36.useContext)(PopoverRootContext);
@@ -8111,9 +8120,9 @@ function Popover({
8111
8120
  close(true);
8112
8121
  }
8113
8122
  };
8114
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
8123
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
8115
8124
  triggerEl && (0, import_react36.cloneElement)(triggerEl, injected),
8116
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
8125
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
8117
8126
  AnchoredPanel,
8118
8127
  {
8119
8128
  anchor: anchorEl,
@@ -8127,24 +8136,24 @@ function Popover({
8127
8136
  "aria-labelledby": hasHeader ? headerId : void 0,
8128
8137
  onKeyDown: onCardKeyDown,
8129
8138
  className,
8130
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PopoverRootContext.Provider, { value: { close, headerId }, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PanelHasHeaderContext.Provider, { value: hasHeader, children }) })
8139
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PopoverRootContext.Provider, { value: { close, headerId }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PanelHasHeaderContext.Provider, { value: hasHeader, children }) })
8131
8140
  }
8132
8141
  )
8133
8142
  ] });
8134
8143
  }
8135
8144
  function PopoverHeader({ icon, children }) {
8136
8145
  const root = usePopoverRoot();
8137
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2.5 px-4 pb-1 pt-3.5", children: [
8138
- icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "bg-accent-soft text-accent-text flex size-[26px] shrink-0 items-center justify-center rounded-[8px] [&>svg]:size-3.5", children: icon }),
8139
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h4", { id: root.headerId, className: "text-ink-1 flex-1 truncate text-[13.5px] font-[600]", children }),
8140
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
8146
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2.5 px-4 pb-1 pt-3.5", children: [
8147
+ icon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "bg-accent-soft text-accent-text flex size-[26px] shrink-0 items-center justify-center rounded-[8px] [&>svg]:size-3.5", children: icon }),
8148
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h4", { id: root.headerId, className: "text-ink-1 flex-1 truncate text-[13.5px] font-[600]", children }),
8149
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
8141
8150
  "button",
8142
8151
  {
8143
8152
  type: "button",
8144
8153
  "aria-label": "\u5173\u95ED",
8145
8154
  onClick: () => root.close(true),
8146
8155
  className: "text-ink-3 hover:bg-hover hover:text-ink-1 -mr-1 grid size-7 shrink-0 cursor-pointer place-items-center rounded-[8px] outline-none focus-visible:shadow-[var(--tau-focus-ring)]",
8147
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(X, { className: "size-[13px]", strokeWidth: 2 })
8156
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(X, { className: "size-[13px]", strokeWidth: 2 })
8148
8157
  }
8149
8158
  )
8150
8159
  ] });
@@ -8155,47 +8164,47 @@ Popover.Footer = AnchoredPanel.Footer;
8155
8164
 
8156
8165
  // packages/ui/src/primitives/YearHeatmap.tsx
8157
8166
  var import_react37 = __toESM(require_react(), 1);
8158
- var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
8167
+ var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
8159
8168
 
8160
8169
  // packages/ui/src/primitives/input/Input.tsx
8161
8170
  var import_react38 = __toESM(require_react(), 1);
8162
- var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1);
8171
+ var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
8163
8172
 
8164
8173
  // packages/ui/src/primitives/input/Textarea.tsx
8165
8174
  var import_react39 = __toESM(require_react(), 1);
8166
- var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1);
8175
+ var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
8167
8176
 
8168
8177
  // packages/ui/src/primitives/input/NumberInput.tsx
8169
8178
  var import_react40 = __toESM(require_react(), 1);
8170
- var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
8179
+ var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
8171
8180
 
8172
8181
  // packages/ui/src/patterns/FormRow.tsx
8173
8182
  var import_react41 = __toESM(require_react(), 1);
8174
- var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1);
8183
+ var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
8175
8184
 
8176
8185
  // packages/ui/src/patterns/SettingRow.tsx
8177
- var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
8186
+ var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
8178
8187
 
8179
8188
  // packages/ui/src/primitives/Checkbox.tsx
8180
8189
  var import_react42 = __toESM(require_react(), 1);
8181
- var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
8190
+ var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
8182
8191
 
8183
8192
  // packages/ui/src/primitives/Switch.tsx
8184
8193
  var import_react43 = __toESM(require_react(), 1);
8185
- var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1);
8194
+ var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
8186
8195
 
8187
8196
  // packages/ui/src/primitives/RadioGroup.tsx
8188
8197
  var import_react44 = __toESM(require_react(), 1);
8189
- var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1);
8198
+ var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
8190
8199
  var RadioGroupContext2 = (0, import_react44.createContext)(null);
8191
8200
 
8192
8201
  // packages/ui/src/primitives/Radio.tsx
8193
8202
  var import_react45 = __toESM(require_react(), 1);
8194
- var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1);
8203
+ var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
8195
8204
 
8196
8205
  // packages/ui/src/primitives/Segmented.tsx
8197
8206
  var import_react46 = __toESM(require_react(), 1);
8198
- var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
8207
+ var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
8199
8208
  var SegmentedContext = (0, import_react46.createContext)(null);
8200
8209
  function SegmentedRoot({
8201
8210
  label,
@@ -8211,7 +8220,7 @@ function SegmentedRoot({
8211
8220
  const autoName = (0, import_react46.useId)();
8212
8221
  const [internal, setInternal] = (0, import_react46.useState)(defaultValue);
8213
8222
  const value = valueProp ?? internal ?? null;
8214
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
8223
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8215
8224
  "div",
8216
8225
  {
8217
8226
  role: "radiogroup",
@@ -8221,7 +8230,7 @@ function SegmentedRoot({
8221
8230
  size === "md" && "rounded-[9px]",
8222
8231
  className
8223
8232
  ),
8224
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
8233
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8225
8234
  SegmentedContext.Provider,
8226
8235
  {
8227
8236
  value: {
@@ -8253,7 +8262,7 @@ function SegmentedItem({
8253
8262
  props.onChange?.(event);
8254
8263
  if (group && event.target.checked) group.onValueChange(value);
8255
8264
  };
8256
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
8265
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
8257
8266
  "label",
8258
8267
  {
8259
8268
  className: cn(
@@ -8272,7 +8281,7 @@ function SegmentedItem({
8272
8281
  className
8273
8282
  ),
8274
8283
  children: [
8275
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
8284
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8276
8285
  "input",
8277
8286
  {
8278
8287
  ...props,
@@ -8285,14 +8294,14 @@ function SegmentedItem({
8285
8294
  className: "peer absolute inset-0 cursor-pointer opacity-0 disabled:cursor-default"
8286
8295
  }
8287
8296
  ),
8288
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
8297
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8289
8298
  "span",
8290
8299
  {
8291
8300
  "aria-hidden": true,
8292
8301
  className: "pointer-events-none invisible absolute inset-[2px] rounded-[5px] shadow-[var(--tau-focus-ring)] peer-focus-visible:visible"
8293
8302
  }
8294
8303
  ),
8295
- Icon2 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
8304
+ Icon2 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
8296
8305
  Icon2,
8297
8306
  {
8298
8307
  size: label == null ? 15 : group?.size === "md" ? 14 : 13,
@@ -8300,7 +8309,7 @@ function SegmentedItem({
8300
8309
  className: "shrink-0"
8301
8310
  }
8302
8311
  ),
8303
- label != null && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "min-w-0 truncate", children: label })
8312
+ label != null && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "min-w-0 truncate", children: label })
8304
8313
  ]
8305
8314
  }
8306
8315
  );
@@ -8308,17 +8317,11 @@ function SegmentedItem({
8308
8317
  var Segmented = Object.assign(SegmentedRoot, { Item: SegmentedItem });
8309
8318
 
8310
8319
  // packages/ui/src/primitives/FilterPill.tsx
8311
- var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1);
8320
+ var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
8312
8321
 
8313
8322
  // packages/ui/src/primitives/ResizeHandle.tsx
8314
8323
  var import_react47 = __toESM(require_react(), 1);
8315
- var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
8316
-
8317
- // packages/ui/src/primitives/Tag.tsx
8318
- var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1);
8319
-
8320
- // packages/ui/src/primitives/ValueDisplay.tsx
8321
- var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1);
8324
+ var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
8322
8325
 
8323
8326
  // packages/ui/src/primitives/datepicker/DatePicker.tsx
8324
8327
  var import_react50 = __toESM(require_react(), 1);
@@ -8326,44 +8329,44 @@ var import_react_dom8 = __toESM(require_react_dom(), 1);
8326
8329
 
8327
8330
  // packages/ui/src/primitives/datepicker/CalendarPanel.tsx
8328
8331
  var import_react48 = __toESM(require_react(), 1);
8329
- var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1);
8332
+ var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
8330
8333
 
8331
8334
  // packages/ui/src/primitives/datepicker/TimeField.tsx
8332
8335
  var import_react49 = __toESM(require_react(), 1);
8333
- var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1);
8336
+ var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
8334
8337
 
8335
8338
  // packages/ui/src/primitives/datepicker/DatePicker.tsx
8336
- var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1);
8339
+ var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
8337
8340
 
8338
8341
  // packages/ui/src/primitives/datepicker/DateRangePicker.tsx
8339
8342
  var import_react51 = __toESM(require_react(), 1);
8340
8343
  var import_react_dom9 = __toESM(require_react_dom(), 1);
8341
- var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1);
8344
+ var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
8342
8345
 
8343
8346
  // packages/ui/src/primitives/ImagePreview.tsx
8344
- var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1);
8347
+ var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
8345
8348
 
8346
8349
  // packages/ui/src/primitives/Tabs.tsx
8347
8350
  var import_react52 = __toESM(require_react(), 1);
8348
- var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1);
8351
+ var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
8349
8352
 
8350
8353
  // packages/ui/src/primitives/FileDropZone.tsx
8351
8354
  var import_react53 = __toESM(require_react(), 1);
8352
- var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1);
8355
+ var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
8353
8356
 
8354
8357
  // packages/ui/src/primitives/Sortable.tsx
8355
8358
  var import_react54 = __toESM(require_react(), 1);
8356
- var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1);
8359
+ var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
8357
8360
 
8358
8361
  // packages/ui/src/primitives/LoadingOverlay.tsx
8359
- var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1);
8362
+ var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
8360
8363
 
8361
8364
  // packages/ui/src/patterns/ConfigurationPanel.tsx
8362
8365
  var import_react55 = __toESM(require_react(), 1);
8363
- var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1);
8366
+ var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
8364
8367
 
8365
8368
  // packages/whiteboard/src/chrome/index.tsx
8366
- var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1);
8369
+ var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
8367
8370
  var ToolbarContext = (0, import_react56.createContext)(false);
8368
8371
  var AttrBarContext = (0, import_react56.createContext)({ side: "top" });
8369
8372
 
@@ -9196,19 +9199,19 @@ var useThemeStore = defaultRuntime.useThemeStore;
9196
9199
  var initThemeRuntime = defaultRuntime.init;
9197
9200
 
9198
9201
  // packages/whiteboard/src/components/SketchPaths/index.tsx
9199
- var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1);
9202
+ var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
9200
9203
  var LINES_OPACITY = { light: 0.85, dark: 0.55 };
9201
9204
  var SketchPaths = (0, import_react57.memo)(({ paths, dashFlowDuration }) => {
9202
9205
  const isDark = useThemeStore((s2) => s2.mode) === "dark";
9203
9206
  const idPrefix = `sk${(0, import_react57.useId)().replace(/[^a-zA-Z0-9]/g, "")}`;
9204
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children: paths.map((path, index) => {
9207
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children: paths.map((path, index) => {
9205
9208
  const clipId = path.clip ? `${idPrefix}-c${index}` : void 0;
9206
9209
  const maskId = path.dashMask ? `${idPrefix}-m${index}` : void 0;
9207
9210
  const opacity = path.role === "lines" ? (path.opacity ?? 1) * (isDark ? LINES_OPACITY.dark : LINES_OPACITY.light) : path.opacity;
9208
9211
  const mask = path.dashMask;
9209
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("g", { children: [
9210
- clipId && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("path", { d: path.clip }) }),
9211
- mask && maskId && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
9212
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("g", { children: [
9213
+ clipId && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("path", { d: path.clip }) }),
9214
+ mask && maskId && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
9212
9215
  "mask",
9213
9216
  {
9214
9217
  id: maskId,
@@ -9217,7 +9220,7 @@ var SketchPaths = (0, import_react57.memo)(({ paths, dashFlowDuration }) => {
9217
9220
  y: -1e5,
9218
9221
  width: 2e5,
9219
9222
  height: 2e5,
9220
- children: mask.map((m2, maskIndex) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
9223
+ children: mask.map((m2, maskIndex) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
9221
9224
  "path",
9222
9225
  {
9223
9226
  d: m2.d,
@@ -9227,7 +9230,7 @@ var SketchPaths = (0, import_react57.memo)(({ paths, dashFlowDuration }) => {
9227
9230
  strokeLinecap: "round",
9228
9231
  strokeDasharray: `${m2.dash} ${m2.gap}`,
9229
9232
  strokeDashoffset: m2.offset,
9230
- children: dashFlowDuration && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
9233
+ children: dashFlowDuration && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
9231
9234
  "animate",
9232
9235
  {
9233
9236
  attributeName: "stroke-dashoffset",
@@ -9242,7 +9245,7 @@ var SketchPaths = (0, import_react57.memo)(({ paths, dashFlowDuration }) => {
9242
9245
  ))
9243
9246
  }
9244
9247
  ),
9245
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
9248
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
9246
9249
  "path",
9247
9250
  {
9248
9251
  d: path.d,
@@ -9258,7 +9261,7 @@ var SketchPaths = (0, import_react57.memo)(({ paths, dashFlowDuration }) => {
9258
9261
  var SketchPaths_default = SketchPaths;
9259
9262
 
9260
9263
  // packages/whiteboard/src/components/SketchPopover.tsx
9261
- var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1);
9264
+ var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1);
9262
9265
  var SketchGlyph = (0, import_react59.memo)(
9263
9266
  ({
9264
9267
  level,
@@ -9280,7 +9283,7 @@ var SketchGlyph = (0, import_react59.memo)(
9280
9283
  }),
9281
9284
  [level, seed, fillStyle, fill]
9282
9285
  );
9283
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("svg", { width: 38, height: 26, viewBox: "-4 -4 38 26", "aria-hidden": true, className: "overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SketchPaths_default, { paths }) });
9286
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("svg", { width: 38, height: 26, viewBox: "-4 -4 38 26", "aria-hidden": true, className: "overflow-visible", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SketchPaths_default, { paths }) });
9284
9287
  }
9285
9288
  );
9286
9289
 
@@ -20,7 +20,7 @@ export * from "./document-operations";
20
20
  export * from "./document-sync";
21
21
  export { exportWhiteboardTransfer, prepareWhiteboardTransfer, whiteboardTransferResources, } from "./whiteboard-transfer";
22
22
  export type { WhiteboardTransfer } from "./whiteboard-types";
23
- export { isSafeResource } from "./resource-policy";
23
+ export { isSafeResource, isVideoResource, imageMimeFromBytes, collaborationAssetMime, } from "./resource-policy";
24
24
  export * from "./whiteboard-baseline";
25
25
  export { assertPresenceBudget } from "./presence-budget";
26
26
  export * from "./whiteboard-presence";
@@ -68,6 +68,9 @@ export interface SourceBinding {
68
68
  contentDocumentId?: string;
69
69
  /** 本机缓存最后确认的主库投影修订,不随文档共享。 */
70
70
  projectionRevision?: string;
71
+ /** 本机会话的标题归属不随同步辅助状态的健康情况切换。 */
72
+ titleAuthority?: "database";
73
+ generation?: string;
71
74
  sourceType?: SourceType;
72
75
  sourceId?: number;
73
76
  sourceTitle?: string;
@@ -1 +1,5 @@
1
+ export declare function isVideoResource(name: string, mime: string): boolean;
2
+ /** 为缺少 MIME 的历史附件识别图片文件头,不按文件名猜测内容类型。 */
3
+ export declare function imageMimeFromBytes(bytes: Uint8Array): string | undefined;
4
+ export declare function collaborationAssetMime(declared: string, header: Uint8Array): string;
1
5
  export declare function isSafeResource(value: string, field?: string): boolean;
@@ -42,6 +42,16 @@ export declare const BUILTIN_CONTENT_RESOURCES: {
42
42
  readonly path: "localFilePath";
43
43
  readonly kind: "file";
44
44
  }];
45
+ readonly bookmark: readonly [{
46
+ readonly path: "meta.image";
47
+ readonly kind: "image";
48
+ }, {
49
+ readonly path: "meta.icon";
50
+ readonly kind: "image";
51
+ }, {
52
+ readonly path: "overrides.image";
53
+ readonly kind: "image";
54
+ }];
45
55
  };
46
56
  export declare const CONTENT_RESOURCE_LIMITS: Readonly<{
47
57
  specs: 16;
@@ -8,7 +8,7 @@ export declare const PLUGIN_AI_CAPABILITIES: {
8
8
  readonly name: "对话功能";
9
9
  };
10
10
  readonly flashcardGeneration: {
11
- readonly name: "闪卡制作";
11
+ readonly name: "闪卡";
12
12
  };
13
13
  };
14
14
  export type PluginAICapability = keyof typeof PLUGIN_AI_CAPABILITIES;
@@ -21,6 +21,7 @@ import type { PluginSidebar } from "./sidebar";
21
21
  import type { PluginHome } from "./home";
22
22
  import type { PluginActions } from "./actions";
23
23
  import type { PluginViews } from "./views";
24
+ import type { PluginNotebooks } from "./notebooks";
24
25
  import type { PluginExcerpts, PluginMaterials } from "./excerpts";
25
26
  import type { PluginMCP } from "./mcp";
26
27
  import type { PluginChat } from "./chat";
@@ -82,6 +83,8 @@ export interface PluginContext {
82
83
  readonly actions: PluginActions;
83
84
  /** 卡片、文章、项目文档详情里的区块 */
84
85
  readonly views: PluginViews;
86
+ /** Notebook 的生成菜单里加产物;只在桌面主窗口 */
87
+ readonly notebooks: PluginNotebooks;
85
88
  readonly excerpts: PluginExcerpts;
86
89
  readonly materials: PluginMaterials;
87
90
  readonly fetch: typeof globalThis.fetch;
@@ -23,7 +23,7 @@ export interface PluginHomePanelDefinition {
23
23
  component: ComponentType<PluginHomePanelProps>;
24
24
  /** 缺省为 wide */
25
25
  size?: PluginHomePanelSize;
26
- /** 可选,由宿主画在标题行右侧 */
26
+ /** 可选,由宿主画在标题行右侧;手机卡片主体点击也执行此入口,独立控件与浮层须自行阻止点击冒泡。 */
27
27
  action?: PluginHomePanelAction;
28
28
  }
29
29
  /** 宿主收到的定义:size 已补成缺省值,action 缺省为 null */
@@ -31,6 +31,7 @@ export type * from "./home";
31
31
  export type * from "./actions";
32
32
  export { PLUGIN_ACTION_TARGET_KINDS } from "./actions";
33
33
  export type * from "./views";
34
+ export type * from "./notebooks";
34
35
  export { PLUGIN_ENTITY_PANEL_KINDS } from "./views";
35
36
  export type * from "./excerpts";
36
37
  export type * from "./data";
@@ -0,0 +1,98 @@
1
+ import type { ComponentType } from "react";
2
+ import type { Disposable, PluginContext } from "./contract";
3
+ import type { PluginIcon } from "./icons";
4
+ import type { JsonValue } from "./json";
5
+ import type { PluginOwnEntity } from "./entities";
6
+ /**
7
+ * Notebook 输出:插件在 Notebook 的「生成」菜单里加一种产物。对话框、资料勾选、AI 生成与执行过程页
8
+ * 都由 Tau 负责,AI 走 Notebook 已有的生成流程与资料检索;插件只说明要什么(prepare),
9
+ * 拿到生成的正文后自己处理(complete)。
10
+ */
11
+ /** 用户勾选的一份资料(只有名称,插件读不到资料内容) */
12
+ export interface PluginNotebookOutputResource {
13
+ id: string;
14
+ name: string;
15
+ }
16
+ export interface PluginNotebookOutputTarget {
17
+ notebook: {
18
+ id: string;
19
+ title: string;
20
+ };
21
+ resources: readonly PluginNotebookOutputResource[];
22
+ }
23
+ /** 插件在对话框中间放的选项区:value 由插件定义,宿主原样保存并在 prepare 时交回 */
24
+ export interface PluginNotebookOutputOptionsProps {
25
+ readonly context: PluginContext;
26
+ readonly target: PluginNotebookOutputTarget;
27
+ readonly value: JsonValue | undefined;
28
+ onChange(value: JsonValue): void;
29
+ /** 传入原因时「开始生成」不可用,并在对话框底部显示原因;null 解除 */
30
+ setBlocker(reason: string | null): void;
31
+ }
32
+ export interface PluginNotebookOutputPrepareInput extends PluginNotebookOutputTarget {
33
+ /** 用户在「额外要求」里写的话,可能为空 */
34
+ userPrompt: string;
35
+ options: JsonValue | undefined;
36
+ signal: AbortSignal;
37
+ }
38
+ /** 交给 AI 的任务说明;资料清单、检索工具与通用生成规则由 Tau 补上 */
39
+ export interface PluginNotebookOutputPlan {
40
+ /** 这一次产物的插件实体 ID(插件先建好占位),类型须为 registerOutput 声明的 kind */
41
+ entity: string;
42
+ /** 执行过程页显示的标题 */
43
+ title: string;
44
+ /** 任务要求与输出格式:写什么、怎么写、最终只输出什么 */
45
+ instructions: string;
46
+ /** 补充提醒,按条列出 */
47
+ reminders?: readonly string[];
48
+ }
49
+ /** complete 期间向执行过程页报告进度 */
50
+ export interface PluginNotebookOutputTask {
51
+ /** 当前阶段的一句话,如「合成语音」 */
52
+ phase(text: string): void;
53
+ /** 分步进度;total 为 0 时不显示进度条 */
54
+ progress(done: number, total: number): void;
55
+ }
56
+ export interface PluginNotebookOutputCompleteInput {
57
+ entity: string;
58
+ /** AI 最终输出的正文 */
59
+ text: string;
60
+ task: PluginNotebookOutputTask;
61
+ signal: AbortSignal;
62
+ }
63
+ export interface PluginNotebookOutputFailInput {
64
+ entity: string;
65
+ /** cancelled:用户停止;failed:生成或 complete 出错 */
66
+ reason: "cancelled" | "failed";
67
+ message: string;
68
+ }
69
+ /** 产物在 Notebook 阅读区里的显示 */
70
+ export interface PluginNotebookOutputViewProps {
71
+ readonly context: PluginContext;
72
+ readonly entity: PluginOwnEntity;
73
+ readonly notebook: {
74
+ id: string;
75
+ title: string;
76
+ };
77
+ }
78
+ export interface PluginNotebookOutputDefinition {
79
+ /** 插件内唯一 */
80
+ id: string;
81
+ /** 菜单与执行过程页里的名称,如「播客」 */
82
+ title: string;
83
+ icon?: PluginIcon;
84
+ /** 一句话说明,显示在对话框标题下 */
85
+ description?: string;
86
+ /** 产物对应的插件实体类型(须先 entities.registerKind) */
87
+ kind: string;
88
+ options?: ComponentType<PluginNotebookOutputOptionsProps>;
89
+ view: ComponentType<PluginNotebookOutputViewProps>;
90
+ prepare(input: PluginNotebookOutputPrepareInput): Promise<PluginNotebookOutputPlan>;
91
+ complete(input: PluginNotebookOutputCompleteInput): Promise<void>;
92
+ /** 生成失败、complete 抛错或用户停止时调用;插件据此清理占位或标为失败 */
93
+ fail?(input: PluginNotebookOutputFailInput): Promise<void> | void;
94
+ }
95
+ export interface PluginNotebooks {
96
+ /** 只在主窗口的 Notebook 里出现;目前只有桌面支持 */
97
+ registerOutput(definition: PluginNotebookOutputDefinition): Disposable;
98
+ }
@@ -1,4 +1,4 @@
1
- export declare const PLUGIN_PERMISSIONS: readonly ["cards:read", "cards:write", "cards:delete", "articles:read", "articles:write", "articles:delete", "documents:read", "documents:write", "documents:delete", "whiteboards:read", "whiteboards:write", "whiteboards:delete", "projects:read", "projects:write", "projects:delete", "todos:read", "todos:write", "todos:delete", "calendar:read", "calendar:write", "calendar:delete", "notebooks:read", "materials:read", "chats:read", "flashcards:read", "flashcards:write", "speech:input", ...("ai:chat" | "ai:flashcardGeneration")[]];
1
+ export declare const PLUGIN_PERMISSIONS: readonly ["cards:read", "cards:write", "cards:delete", "articles:read", "articles:write", "articles:delete", "documents:read", "documents:write", "documents:delete", "whiteboards:read", "whiteboards:write", "whiteboards:delete", "projects:read", "projects:write", "projects:delete", "todos:read", "todos:write", "todos:delete", "calendar:read", "calendar:write", "calendar:delete", "notebooks:read", "materials:read", "chats:read", "flashcards:read", "flashcards:write", "speech:input", "tts:synthesize", ...("ai:chat" | "ai:flashcardGeneration")[]];
2
2
  export type PluginPermission = (typeof PLUGIN_PERMISSIONS)[number];
3
3
  export declare const isPluginPermission: (value: unknown) => value is PluginPermission;
4
4
  /** granted:可直接调用;prompt:调用时会询问用户;denied:本次运行已拒绝或已被阻止 */
@@ -37,6 +37,29 @@ export interface TTSProviderDefinition {
37
37
  /** 每次任务固定配置和模型,创建时不发网络请求。 */
38
38
  create(config: JsonValue, modelId: string): TTSInstance;
39
39
  }
40
+ /** 一次语音合成会话:固定打开时用户选的服务与模型,用完 close;插件停用时宿主自动关闭 */
41
+ export interface TTSSynthesisSession {
42
+ /** 用户所选服务的显示名,如「MiniMax 语音」 */
43
+ readonly providerName: string;
44
+ /** 服务对朗读文本的要求(如可用的停顿标签),写给 AI 的提示词可以带上 */
45
+ readonly textInstructions?: string;
46
+ getVoices(options?: {
47
+ signal?: AbortSignal;
48
+ }): Promise<TTSVoice[]>;
49
+ synthesize(request: TTSSynthesizeRequest, options?: {
50
+ signal?: AbortSignal;
51
+ }): Promise<TTSAudio>;
52
+ close(): Promise<void>;
53
+ }
40
54
  export interface PluginTTS {
41
55
  register(definition: TTSProviderDefinition): Disposable;
56
+ /** 当前不能合成的原因(如「还没有选择语音服务」),可用时为 null;不触发授权询问 */
57
+ unavailableReason(): string | null;
58
+ /**
59
+ * 用用户在 Tau「语音」设置里选的服务朗读文字。需要在 manifest 声明 tts:synthesize,第一次调用时
60
+ * Tau 询问用户;宿主不支持时抛 TTS_UNAVAILABLE 开头的错误。
61
+ */
62
+ open(options?: {
63
+ signal?: AbortSignal;
64
+ }): Promise<TTSSynthesisSession>;
42
65
  }
@@ -17,4 +17,11 @@ export interface PluginUpload {
17
17
  uploadRemote(file: UploadFile, options?: {
18
18
  signal?: AbortSignal;
19
19
  }): Promise<string>;
20
+ /**
21
+ * 按用户当前的资源存储(本地库或资源上传插件)保存文件,与正文里插入图片走同一条路径;返回的地址
22
+ * 可写入正文,或交给 useResource / MediaAudio 播放。宿主不支持时抛 UPLOAD_UNAVAILABLE 开头的错误。
23
+ */
24
+ save(file: UploadFile, options?: {
25
+ signal?: AbortSignal;
26
+ }): Promise<string>;
20
27
  }
@@ -13,6 +13,7 @@ export { UiHostProvider, type UiRegisterDismiss } from "./UiHostProvider";
13
13
  export * from "./primitives/Button";
14
14
  export * from "./primitives/IconButton";
15
15
  export * from "./primitives/Loading";
16
+ export * from "./primitives/ProgressStatus";
16
17
  export * from "./primitives/Panel";
17
18
  export * from "./primitives/DocumentCard";
18
19
  export * from "./primitives/Toast";
@@ -0,0 +1,5 @@
1
+ export declare function ProgressStatus({ value, label, className, }: {
2
+ value: number;
3
+ label: string;
4
+ className?: string;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -29,8 +29,6 @@ interface ResizeableAndHideableSidebarProps {
29
29
  showInternalExpandButtonWhenClosed?: boolean;
30
30
  /** 透传 WidthResizable:常驻淡分隔线标出拖拽边界 */
31
31
  showDivider?: boolean;
32
- /** 以 flex 铺满父级剩余空间,替代固定宽度(如视频笔记收起对话后材料栏独占) */
33
- fillRemaining?: boolean;
34
32
  }
35
33
  declare const ResizeableAndHideableSidebar: (props: ResizeableAndHideableSidebarProps) => import("react/jsx-runtime").JSX.Element;
36
34
  export default ResizeableAndHideableSidebar;