@xiongtao.xt/tau-plugins 0.51.0 → 0.52.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 +6 -0
- package/client/{chunk-TCJBY6GL.js → chunk-7ZRTRNIF.js} +1 -1
- package/client/{chunk-5GHRRBYH.js → chunk-M4KRTX2I.js} +1 -12
- package/docs/ai.md +12 -23
- package/docs/providers/video.md +22 -6
- package/docs/services.md +16 -21
- package/package.js +1 -1
- package/package.json +1 -1
- package/portable.js +2 -2
- package/publish-artifacts.js +2 -2
- package/types/packages/plugins/src/ai.d.ts +0 -33
- package/types/packages/plugins/src/permissions.d.ts +1 -1
- package/types/packages/plugins/src/portable.d.ts +1 -1
- package/types/packages/plugins/src/services.d.ts +5 -1
- package/types/packages/plugins/src/video.d.ts +12 -0
- package/types/packages/ui/src/primitives/Toast.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# 更新记录
|
|
2
2
|
|
|
3
|
+
## 0.52.0
|
|
4
|
+
|
|
5
|
+
- 插件可申请的内置 AI 能力按当前宿主契约收敛为 `chat` 与 `flashcardGeneration`,相应 `ai:*` 权限同步收敛;其他需求通过插件自定义 AI 功能声明。
|
|
6
|
+
- 视频实例新增可选 `getCaptions(ref, signal)`,返回 `VideoCaptions | null`;字幕片段使用毫秒时间戳,无可用字幕返回 null。视频笔记优先读取字幕,已有结果保留,用户仍可手动重新转录。
|
|
7
|
+
- `context.services.videoExtractor.getCaptions(url, { proxy?, signal? })` 通过宿主解析器读取一条平台字幕,优先人工字幕与原语言,支持代理、取消与临时文件回收;目前支持 JSON3 字幕轨。该服务只在已接入字幕能力的桌面客户端提供。
|
|
8
|
+
|
|
3
9
|
## 0.51.0
|
|
4
10
|
|
|
5
11
|
- 新增 `context.speech` 语音输入:`unavailableReason()` 判断能否录音,`start({ signal, onPreview })` 返回 `{ result, stop, cancel }`,识别方式沿用应用的语音输入设置。需要在 manifest 声明新权限 `speech:input`,首次调用时询问用户;宿主未接入时 `start` 抛 `SPEECH_UNAVAILABLE`。新增宿主接口 `SpeechAdapter`。
|
|
@@ -134,18 +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
|
-
|
|
138
|
-
webClip: { name: "\u7F51\u9875\u526A\u85CF" },
|
|
139
|
-
podcastGeneration: { name: "\u64AD\u5BA2\u751F\u6210" },
|
|
140
|
-
flashcardGeneration: { name: "\u95EA\u5361\u5236\u4F5C" },
|
|
141
|
-
aiJudgement: { name: "\u7B54\u6848\u8BC4\u5224" },
|
|
142
|
-
transcriptionOptimization: { name: "\u8F6C\u5F55\u65AD\u53E5\u4F18\u5316" },
|
|
143
|
-
speechInputRefinement: { name: "\u8BED\u97F3\u8F93\u5165\u6574\u7406" },
|
|
144
|
-
videoSummary: { name: "\u89C6\u9891\u603B\u7ED3" },
|
|
145
|
-
videoEbookRewrite: { name: "\u89C6\u9891\u7535\u5B50\u4E66\u91CD\u5199" },
|
|
146
|
-
vibeLearningImageDescription: { name: "\u56FE\u7247\u7406\u89E3" },
|
|
147
|
-
contentMetadata: { name: "\u7B14\u8BB0\u5143\u4FE1\u606F" },
|
|
148
|
-
contentInsights: { name: "AI \u6D1E\u89C1" }
|
|
137
|
+
flashcardGeneration: { name: "\u95EA\u5361\u5236\u4F5C" }
|
|
149
138
|
};
|
|
150
139
|
var isPluginAICapability = (value) => typeof value === "string" && Object.hasOwn(PLUGIN_AI_CAPABILITIES, value);
|
|
151
140
|
|
package/docs/ai.md
CHANGED
|
@@ -4,29 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
移动端尚未提供自定义 AI 的配置界面及用量统计页面,由宿主管理接口配置和读取账本;未接入打开回调时,`openSettings()` 抛出 `AI_SETTINGS_UNAVAILABLE`。优先使用已有模型分配,不依赖手机上的配置入口完成首次设置。
|
|
6
6
|
|
|
7
|
-
| 用法 | 适合
|
|
8
|
-
| --------------------------------------------------- |
|
|
9
|
-
| [使用 Tau 已有的模型分配](#使用-tau-已有的模型分配) |
|
|
10
|
-
| [自定义 AI 功能](#自定义-ai-功能) | 插件特有的功能,需要用户单独选择模型
|
|
7
|
+
| 用法 | 适合 | 用户需要做什么 |
|
|
8
|
+
| --------------------------------------------------- | ------------------------------------ | -------------------------------- |
|
|
9
|
+
| [使用 Tau 已有的模型分配](#使用-tau-已有的模型分配) | 使用聊天或闪卡生成的模型分配 | 首次使用时授权 |
|
|
10
|
+
| [自定义 AI 功能](#自定义-ai-功能) | 插件特有的功能,需要用户单独选择模型 | 在插件设置里为功能选择模型并开启 |
|
|
11
11
|
|
|
12
12
|
大多数插件用第一种就够了,不需要用户额外配置。
|
|
13
13
|
|
|
14
14
|
## 使用 Tau 已有的模型分配
|
|
15
15
|
|
|
16
|
-
Tau
|
|
16
|
+
插件只可以申请沿用 Tau 的聊天和闪卡生成模型分配,其他内置 AI 用途不对插件开放。
|
|
17
17
|
|
|
18
18
|
### 1. 在 manifest 中声明
|
|
19
19
|
|
|
20
20
|
```json
|
|
21
|
-
{ "permissions": ["ai:
|
|
21
|
+
{ "permissions": ["ai:chat"] }
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
### 2. 申请并调用
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
|
-
const model = await context.ai.requestCapability("
|
|
27
|
+
const model = await context.ai.requestCapability("chat");
|
|
28
28
|
const result = await model.chat({
|
|
29
|
-
messages: [{ role: "user", content: "
|
|
29
|
+
messages: [{ role: "user", content: "概括这段文字的主要内容:……" }],
|
|
30
30
|
});
|
|
31
31
|
console.log(result.text);
|
|
32
32
|
```
|
|
@@ -35,21 +35,10 @@ console.log(result.text);
|
|
|
35
35
|
|
|
36
36
|
可以申请的能力(也可以从 `PLUGIN_AI_CAPABILITIES` 导入):
|
|
37
37
|
|
|
38
|
-
| 能力名
|
|
39
|
-
|
|
|
40
|
-
| `chat`
|
|
41
|
-
| `
|
|
42
|
-
| `webClip` | 网页剪藏 |
|
|
43
|
-
| `podcastGeneration` | 播客生成 |
|
|
44
|
-
| `flashcardGeneration` | 闪卡制作 |
|
|
45
|
-
| `aiJudgement` | 答案评判 |
|
|
46
|
-
| `transcriptionOptimization` | 转录断句优化 |
|
|
47
|
-
| `speechInputRefinement` | 语音输入整理 |
|
|
48
|
-
| `videoSummary` | 视频总结 |
|
|
49
|
-
| `videoEbookRewrite` | 视频电子书重写 |
|
|
50
|
-
| `vibeLearningImageDescription` | 图片理解 |
|
|
51
|
-
| `contentMetadata` | 笔记元信息 |
|
|
52
|
-
| `contentInsights` | AI 洞见 |
|
|
38
|
+
| 能力名 | 沿用的模型分配 |
|
|
39
|
+
| --------------------- | -------------- |
|
|
40
|
+
| `chat` | 对话功能 |
|
|
41
|
+
| `flashcardGeneration` | 闪卡制作 |
|
|
53
42
|
|
|
54
43
|
这里只是借用模型,不会执行 Tau 对应功能的业务流程,也不会自动读取用户数据。提示词和输入由你的插件提供。用户没有为这项能力分配模型时,调用会明确失败,不会自动换成其他模型。
|
|
55
44
|
|
package/docs/providers/video.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
2. Tau 调用 `matches(url)` 确认链接属于你的插件,再调用 `resolve(url)` 获取标题和可选清晰度。
|
|
13
13
|
3. 用户选择清晰度,Tau 把这个清晰度的 `ref` 保存到文档中。
|
|
14
14
|
4. 需要下载时,Tau 调用 `getPlayback(ref)` 获取当前可用的流地址,下载并缓存。之后离线也能播放。
|
|
15
|
+
5. 打开尚无转录的视频笔记时,Tau 优先调用可选的 `getCaptions(ref, signal)`;有结果就保存并展示,没有结果或用户不满意时可手动转录音频。
|
|
15
16
|
|
|
16
17
|
## 注册
|
|
17
18
|
|
|
@@ -22,19 +23,19 @@ context.video.register({
|
|
|
22
23
|
id: context.pluginId,
|
|
23
24
|
name: "我的视频站",
|
|
24
25
|
create: (config): VideoInstance => ({
|
|
25
|
-
matches:
|
|
26
|
+
matches: url => /^https:\/\/video\.example\.com\/v\//.test(url),
|
|
26
27
|
async resolve(url, signal) {
|
|
27
28
|
const info = await fetchVideoInfo(context, url, signal);
|
|
28
29
|
return {
|
|
29
30
|
title: info.title,
|
|
30
31
|
cover: info.cover,
|
|
31
|
-
variants: info.qualities.map(
|
|
32
|
+
variants: info.qualities.map(quality => ({
|
|
32
33
|
label: quality.label,
|
|
33
34
|
ref: { videoId: info.id, quality: quality.id },
|
|
34
35
|
})),
|
|
35
36
|
};
|
|
36
37
|
},
|
|
37
|
-
cacheKey:
|
|
38
|
+
cacheKey: ref => `${ref.videoId}:${ref.quality}`,
|
|
38
39
|
async getPlayback(ref, signal) {
|
|
39
40
|
const stream = await fetchStreamUrl(context, ref, signal);
|
|
40
41
|
return {
|
|
@@ -55,9 +56,24 @@ context.video.register({
|
|
|
55
56
|
| `resolve(url, signal)` | 返回 `{ title, cover?, variants, defaultVariant? }`。`variants` 是可选清晰度,至少一项,每项 `{ label, hint?, ref }`;`defaultVariant` 是默认项的下标,从 0 开始 |
|
|
56
57
|
| `cacheKey(ref)` | 返回稳定的缓存标识,应包含清晰度。已缓存的视频不会再调用 `getPlayback` |
|
|
57
58
|
| `getPlayback(ref, signal)` | 每次下载前调用,返回当前可用的播放源,可以是会过期的地址 |
|
|
59
|
+
| `getCaptions(ref, signal)` | 可选,返回 `{ language?, segments: [{ text, start, end }] }` 或 `null`,start/end 是相对于视频起点的毫秒时间戳 |
|
|
58
60
|
|
|
59
61
|
链接属于其他已启用插件时,Tau 会提示用户改用对应的入口。
|
|
60
62
|
|
|
63
|
+
## 平台字幕
|
|
64
|
+
|
|
65
|
+
字幕接口在 SDK 0.52.0 中新增。直接读取来源提供的 CC 或自动字幕,保留原字幕的时间戳;没有可用字幕时返回 `null`,也可以省略该方法。网络或认证失败可以抛出错误,宿主保留手动转录入口。实现须响应 `signal`;停用插件、取消或切库后不提交迟到结果。
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
async getCaptions(ref, signal) {
|
|
69
|
+
const captions = await fetchCaptions(context, ref, signal);
|
|
70
|
+
if (!captions?.length) return null;
|
|
71
|
+
return { language: "zh-CN", segments: captions };
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
宿主只自动填充尚无字幕或转录的笔记,已保存内容不会因重新打开而被替换。字幕不要求本地转录模型;用户的「重新转录」始终使用音频识别。
|
|
76
|
+
|
|
61
77
|
## ref:可以长期保存的视频引用
|
|
62
78
|
|
|
63
79
|
用户选中的 `ref` 会原样写进文档和数据库,以后只能靠它找回视频。所以:
|
|
@@ -91,6 +107,8 @@ const probe = await context.services.videoExtractor.probe(url, { signal });
|
|
|
91
107
|
|
|
92
108
|
根据 `formats` 组织清晰度,`getPlayback` 时返回 `{ kind: "extract", url, videoFormat, audioFormat }`。插件不能自己启动外部程序下载视频。
|
|
93
109
|
|
|
110
|
+
同一解析器可读取字幕:`context.services.videoExtractor.getCaptions(url, { proxy, signal })` 返回 `VideoCaptions | null`。它只下载一条 JSON3 字幕轨,优先人工字幕、同类优先原语言,无轨道时返回 null,不下载视频或调用转录模型。代理与本次调用一致;只有接入该服务的桌面客户端支持,较早客户端不会调用新字幕接口。
|
|
111
|
+
|
|
94
112
|
## 配置表单
|
|
95
113
|
|
|
96
114
|
账号、Cookie、代理等通过配置表单让用户填写:
|
|
@@ -104,9 +122,7 @@ context.settings.register({
|
|
|
104
122
|
groups: [
|
|
105
123
|
{
|
|
106
124
|
title: "连接",
|
|
107
|
-
fields: [
|
|
108
|
-
{ key: "proxy", label: "代理地址", type: "url", optional: true },
|
|
109
|
-
],
|
|
125
|
+
fields: [{ key: "proxy", label: "代理地址", type: "url", optional: true }],
|
|
110
126
|
},
|
|
111
127
|
],
|
|
112
128
|
},
|
package/docs/services.md
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
把 Tailwind 编译、Markdown 转换、音视频处理交给 Tau 执行,插件不需要自己打包这些工具。`context.services` 目前只在桌面可用:
|
|
4
4
|
|
|
5
|
-
| 服务
|
|
6
|
-
|
|
|
7
|
-
| `tailwind.compile`
|
|
8
|
-
| `markdown.deserialize`
|
|
9
|
-
| `markdown.serialize`
|
|
10
|
-
| `markdown.render`
|
|
11
|
-
| `ffmpeg.run`
|
|
12
|
-
| `videoExtractor.probe`
|
|
13
|
-
| `
|
|
5
|
+
| 服务 | 用途 |
|
|
6
|
+
| ---------------------------- | ---------------------------------------------------------------------------------------- |
|
|
7
|
+
| `tailwind.compile` | 从源码中提取 Tailwind 类名,生成 CSS |
|
|
8
|
+
| `markdown.deserialize` | Markdown → 编辑器节点 |
|
|
9
|
+
| `markdown.serialize` | 编辑器节点 → Markdown |
|
|
10
|
+
| `markdown.render` | Markdown → HTML |
|
|
11
|
+
| `ffmpeg.run` | 用 FFmpeg 处理音视频 |
|
|
12
|
+
| `videoExtractor.probe` | 查询视频网页的标题与可下载格式,见[视频提供方](providers/video.md) |
|
|
13
|
+
| `videoExtractor.getCaptions` | 读取一条平台字幕或返回 null,支持代理和取消,见[视频提供方](providers/video.md#平台字幕) |
|
|
14
|
+
| `git.publishSnapshot` 等 | 博客发布用的 Git 服务,见[发布提供方](providers/publish.md) |
|
|
14
15
|
|
|
15
16
|
这些服务只处理你传入的数据并返回结果:不读写用户的笔记,不弹出文件选择,也不会自动把样式注入页面。
|
|
16
17
|
|
|
@@ -23,7 +24,7 @@ const controller = new AbortController();
|
|
|
23
24
|
try {
|
|
24
25
|
const { css } = await context.services.tailwind.compile(
|
|
25
26
|
{ source: '<div class="p-4">Hello</div>', language: "html" },
|
|
26
|
-
{ signal: controller.signal }
|
|
27
|
+
{ signal: controller.signal }
|
|
27
28
|
);
|
|
28
29
|
} catch (error) {
|
|
29
30
|
if (error instanceof Error && error.name === "AbortError") return;
|
|
@@ -39,8 +40,7 @@ try {
|
|
|
39
40
|
|
|
40
41
|
```ts
|
|
41
42
|
const { css } = await context.services.tailwind.compile({
|
|
42
|
-
source:
|
|
43
|
-
'<section class="p-4 rounded-tau-md bg-surface text-ink-1">Hello</section>',
|
|
43
|
+
source: '<section class="p-4 rounded-tau-md bg-surface text-ink-1">Hello</section>',
|
|
44
44
|
language: "html",
|
|
45
45
|
});
|
|
46
46
|
```
|
|
@@ -58,8 +58,7 @@ const { css } = await context.services.tailwind.compile({
|
|
|
58
58
|
```ts
|
|
59
59
|
import type { Descendant } from "@tau/plugins";
|
|
60
60
|
|
|
61
|
-
const parsed =
|
|
62
|
-
await context.services.markdown.deserialize("# 标题\n\n- [x] 已完成");
|
|
61
|
+
const parsed = await context.services.markdown.deserialize("# 标题\n\n- [x] 已完成");
|
|
63
62
|
const nodes: Descendant[] = parsed.nodes;
|
|
64
63
|
|
|
65
64
|
const { markdown } = await context.services.markdown.serialize(nodes);
|
|
@@ -115,7 +114,7 @@ const result = await context.services.ffmpeg.run(
|
|
|
115
114
|
},
|
|
116
115
|
{
|
|
117
116
|
onProgress: ({ time }) => console.log("已处理", time, "秒"),
|
|
118
|
-
}
|
|
117
|
+
}
|
|
119
118
|
);
|
|
120
119
|
const output = result.files[0].data;
|
|
121
120
|
```
|
|
@@ -151,16 +150,12 @@ function Preview({ source }: { source: string }) {
|
|
|
151
150
|
const controller = new AbortController();
|
|
152
151
|
services.markdown
|
|
153
152
|
.render(source, { signal: controller.signal })
|
|
154
|
-
.then(
|
|
153
|
+
.then(result => setHtml(result.html))
|
|
155
154
|
.catch(() => undefined);
|
|
156
155
|
return () => controller.abort();
|
|
157
156
|
}, [services, source]);
|
|
158
157
|
|
|
159
|
-
return html ?
|
|
160
|
-
<div dangerouslySetInnerHTML={{ __html: html }} />
|
|
161
|
-
) : (
|
|
162
|
-
<pre>{source}</pre>
|
|
163
|
-
);
|
|
158
|
+
return html ? <div dangerouslySetInnerHTML={{ __html: html }} /> : <pre>{source}</pre>;
|
|
164
159
|
}
|
|
165
160
|
```
|
|
166
161
|
|
package/package.js
CHANGED
package/package.json
CHANGED
package/portable.js
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
buildPortablePluginManifest,
|
|
12
12
|
validatePortableDistributionManifest,
|
|
13
13
|
validatePortablePluginManifest
|
|
14
|
-
} from "./client/chunk-
|
|
15
|
-
import "./client/chunk-
|
|
14
|
+
} from "./client/chunk-7ZRTRNIF.js";
|
|
15
|
+
import "./client/chunk-M4KRTX2I.js";
|
|
16
16
|
import "./client/chunk-UTVEXGFI.js";
|
|
17
17
|
export {
|
|
18
18
|
MOBILE_AI_MIN_VERSION,
|
package/publish-artifacts.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PORTABLE_SHARED_MODULES,
|
|
3
3
|
validatePortablePluginManifest
|
|
4
|
-
} from "./client/chunk-
|
|
4
|
+
} from "./client/chunk-7ZRTRNIF.js";
|
|
5
5
|
import {
|
|
6
6
|
PLUGIN_SHARED_MODULES,
|
|
7
7
|
validatePluginManifest
|
|
8
|
-
} from "./client/chunk-
|
|
8
|
+
} from "./client/chunk-M4KRTX2I.js";
|
|
9
9
|
import {
|
|
10
10
|
__commonJS,
|
|
11
11
|
__toESM
|
|
@@ -7,42 +7,9 @@ export declare const PLUGIN_AI_CAPABILITIES: {
|
|
|
7
7
|
readonly chat: {
|
|
8
8
|
readonly name: "对话功能";
|
|
9
9
|
};
|
|
10
|
-
readonly titleSummary: {
|
|
11
|
-
readonly name: "标题总结";
|
|
12
|
-
};
|
|
13
|
-
readonly webClip: {
|
|
14
|
-
readonly name: "网页剪藏";
|
|
15
|
-
};
|
|
16
|
-
readonly podcastGeneration: {
|
|
17
|
-
readonly name: "播客生成";
|
|
18
|
-
};
|
|
19
10
|
readonly flashcardGeneration: {
|
|
20
11
|
readonly name: "闪卡制作";
|
|
21
12
|
};
|
|
22
|
-
readonly aiJudgement: {
|
|
23
|
-
readonly name: "答案评判";
|
|
24
|
-
};
|
|
25
|
-
readonly transcriptionOptimization: {
|
|
26
|
-
readonly name: "转录断句优化";
|
|
27
|
-
};
|
|
28
|
-
readonly speechInputRefinement: {
|
|
29
|
-
readonly name: "语音输入整理";
|
|
30
|
-
};
|
|
31
|
-
readonly videoSummary: {
|
|
32
|
-
readonly name: "视频总结";
|
|
33
|
-
};
|
|
34
|
-
readonly videoEbookRewrite: {
|
|
35
|
-
readonly name: "视频电子书重写";
|
|
36
|
-
};
|
|
37
|
-
readonly vibeLearningImageDescription: {
|
|
38
|
-
readonly name: "图片理解";
|
|
39
|
-
};
|
|
40
|
-
readonly contentMetadata: {
|
|
41
|
-
readonly name: "笔记元信息";
|
|
42
|
-
};
|
|
43
|
-
readonly contentInsights: {
|
|
44
|
-
readonly name: "AI 洞见";
|
|
45
|
-
};
|
|
46
13
|
};
|
|
47
14
|
export type PluginAICapability = keyof typeof PLUGIN_AI_CAPABILITIES;
|
|
48
15
|
export declare const isPluginAICapability: (value: unknown) => value is PluginAICapability;
|
|
@@ -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:
|
|
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")[]];
|
|
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:本次运行已拒绝或已被阻止 */
|
|
@@ -3,7 +3,7 @@ import type { PluginEnvironment } from "./environment";
|
|
|
3
3
|
import { type PackagePlatform, type PackageTarget } from "./package-targets";
|
|
4
4
|
export declare const MOBILE_DATA_MIN_VERSION = "0.2.13";
|
|
5
5
|
export declare const MOBILE_AI_MIN_VERSION = "0.2.13";
|
|
6
|
-
export declare const MOBILE_AI_PERMISSIONS: readonly ("ai:chat" | "ai:
|
|
6
|
+
export declare const MOBILE_AI_PERMISSIONS: readonly ("ai:chat" | "ai:flashcardGeneration")[];
|
|
7
7
|
export declare const MOBILE_DATA_PERMISSIONS: readonly ["cards:read", "cards:write", "cards:delete", "articles:read", "articles:write", "articles:delete", "projects:read", "projects:write", "projects:delete", "documents:read", "documents:write", "documents:delete", "todos:read", "todos:write", "todos:delete", "calendar:read", "calendar:write", "calendar:delete", "flashcards:read", "flashcards:write"];
|
|
8
8
|
/** 语音输入与首页面板随同一客户端版本开放 */
|
|
9
9
|
export declare const MOBILE_SPEECH_MIN_VERSION = "0.2.16";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Descendant } from "slate";
|
|
2
2
|
import type { MarkdownCodec } from "../../markdown/src/index";
|
|
3
3
|
import type { GitSnapshotRequest, GitCacheDirectory } from "./publish";
|
|
4
|
+
import type { VideoCaptions } from "./video";
|
|
4
5
|
export type { Descendant } from "slate";
|
|
5
6
|
export interface ServiceOptions {
|
|
6
7
|
signal?: AbortSignal;
|
|
@@ -89,11 +90,14 @@ export interface PluginServices {
|
|
|
89
90
|
log: string;
|
|
90
91
|
}>;
|
|
91
92
|
};
|
|
92
|
-
/** 宿主视频解析器(yt-dlp
|
|
93
|
+
/** 宿主视频解析器(yt-dlp);视频下载经播放源交给宿主。 */
|
|
93
94
|
videoExtractor: {
|
|
94
95
|
probe(url: string, options?: ServiceOptions & {
|
|
95
96
|
proxy?: string;
|
|
96
97
|
}): Promise<VideoProbeResult>;
|
|
98
|
+
getCaptions(url: string, options?: ServiceOptions & {
|
|
99
|
+
proxy?: string;
|
|
100
|
+
}): Promise<VideoCaptions | null>;
|
|
97
101
|
};
|
|
98
102
|
}
|
|
99
103
|
/** 每个调用同时受调用方与插件实例生命周期约束。 */
|
|
@@ -39,6 +39,16 @@ export interface ResolvedVideo {
|
|
|
39
39
|
variants: readonly VideoVariant[];
|
|
40
40
|
defaultVariant?: number;
|
|
41
41
|
}
|
|
42
|
+
export interface VideoCaptionSegment {
|
|
43
|
+
text: string;
|
|
44
|
+
/** 相对于视频起点的毫秒时间戳。 */
|
|
45
|
+
start: number;
|
|
46
|
+
end: number;
|
|
47
|
+
}
|
|
48
|
+
export interface VideoCaptions {
|
|
49
|
+
language?: string;
|
|
50
|
+
segments: readonly VideoCaptionSegment[];
|
|
51
|
+
}
|
|
42
52
|
export interface VideoInstance {
|
|
43
53
|
/** 同步识别链接是否属于本提供方,不发网络请求。 */
|
|
44
54
|
matches(url: string): boolean;
|
|
@@ -46,6 +56,8 @@ export interface VideoInstance {
|
|
|
46
56
|
/** 稳定的缓存身份(应包含清晰度);已缓存时宿主不再调用 getPlayback。 */
|
|
47
57
|
cacheKey(ref: VideoRef): string;
|
|
48
58
|
getPlayback(ref: VideoRef, signal: AbortSignal): Promise<VideoPlaybackSource>;
|
|
59
|
+
/** 读取平台字幕;无字幕返回 null。不提供此能力时可省略,用户仍可手动转录。 */
|
|
60
|
+
getCaptions?(ref: VideoRef, signal: AbortSignal): Promise<VideoCaptions | null>;
|
|
49
61
|
}
|
|
50
62
|
export interface VideoProviderDefinition {
|
|
51
63
|
id: string;
|
|
@@ -79,7 +79,7 @@ export declare function ToastHost({ variant, zoneClassName, }?: {
|
|
|
79
79
|
/** 覆盖停靠区的位置与层级(如移动端顶栏下方、低于系统层) */
|
|
80
80
|
zoneClassName?: string;
|
|
81
81
|
}): import("react/jsx-runtime").JSX.Element;
|
|
82
|
-
export declare function ToastPill({ item, variant }: {
|
|
82
|
+
export declare function ToastPill({ item, variant, }: {
|
|
83
83
|
item: ToastItem;
|
|
84
84
|
variant?: ToastVariant;
|
|
85
85
|
}): import("react/jsx-runtime").JSX.Element;
|