@xiongtao.xt/tau-plugins 0.41.0 → 0.43.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 +13 -0
- package/client/{chunk-FZTR4KOY.js → chunk-M3YEVDN4.js} +118 -138
- package/client/{chunk-TOYS6GBE.js → chunk-X6MBLKAL.js} +34 -64
- package/docs/README.md +2 -1
- package/docs/ai.md +3 -0
- package/docs/api-support.md +7 -1
- package/docs/backend.md +2 -2
- package/docs/getting-started.md +5 -1
- package/docs/plugin-basics.md +2 -2
- package/docs/portability.md +8 -2
- package/docs/providers/README.md +3 -1
- package/docs/providers/asr.md +41 -0
- package/docs/release.md +1 -1
- package/docs/site-data.md +1 -1
- package/docs/skills.md +0 -1
- package/docs/storage-and-network.md +4 -0
- package/docs/websocket.md +39 -0
- package/package.js +1 -5
- package/package.json +1 -1
- package/portable.js +2 -2
- package/publish-artifacts.js +16 -24
- package/types/packages/asr/src/capture.d.ts +11 -0
- package/types/packages/asr/src/errors.d.ts +9 -0
- package/types/packages/asr/src/index.d.ts +8 -0
- package/types/packages/asr/src/input.d.ts +30 -0
- package/types/packages/asr/src/reducer.d.ts +14 -0
- package/types/packages/asr/src/refinement.d.ts +21 -0
- package/types/packages/asr/src/stream.d.ts +12 -0
- package/types/packages/asr/src/task.d.ts +2 -0
- package/types/packages/asr/src/types.d.ts +108 -0
- package/types/packages/plugins/src/ai.d.ts +3 -0
- package/types/packages/plugins/src/asr.d.ts +13 -0
- package/types/packages/plugins/src/categories.d.ts +2 -8
- package/types/packages/plugins/src/contract.d.ts +4 -0
- package/types/packages/plugins/src/editor-fields.d.ts +2 -5
- package/types/packages/plugins/src/index.d.ts +2 -0
- package/types/packages/plugins/src/package.d.ts +5 -7
- package/types/packages/plugins/src/permissions.d.ts +3 -3
- package/types/packages/plugins/src/portable.d.ts +0 -1
- package/types/packages/plugins/src/rendering.d.ts +1 -8
- package/types/packages/plugins/src/settings.d.ts +6 -1
- package/types/packages/plugins/src/websocket.d.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# 更新记录
|
|
2
2
|
|
|
3
|
+
## 0.43.0
|
|
4
|
+
|
|
5
|
+
- 新增统一 ASR 提供方契约、流式会话、取消与最终结果规则。
|
|
6
|
+
- 新增标准事件与状态语义的 WebSocket,支持鉴权头、生命周期回收及宿主背压。
|
|
7
|
+
- 新增语音识别账号表单与语音输入整理模型用途,桌面和移动共享插件接口。
|
|
8
|
+
|
|
9
|
+
## 0.42.0
|
|
10
|
+
|
|
11
|
+
- 元数据按协议提取,多余属性不再阻止构建、安装或宿主请求。
|
|
12
|
+
- 编辑器只接收公开字段,保留权限、身份、文件与资源完整性检查。
|
|
13
|
+
- 共享身份、文件和元数据解析,移除重复校验、无用途的构建依赖声明与任意文案、列表限制。
|
|
14
|
+
- SDK、模板和官方插件共用同一规则,插件接口与业务数据保持。
|
|
15
|
+
|
|
3
16
|
## 0.41.0
|
|
4
17
|
|
|
5
18
|
- 插件功能直接使用统一 API 或注册实际扩展,不再填写宿主能力列表、正文节点等级或贡献标记。
|
|
@@ -36,6 +36,62 @@ function comparePluginVersions(left, right) {
|
|
|
36
36
|
return 0;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// packages/plugins/src/backend-manifest.ts
|
|
40
|
+
var PLUGIN_SYSTEM_ACCESS = ["filesystem", "network", "process"];
|
|
41
|
+
function validateBackendManifest(value) {
|
|
42
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
43
|
+
throw new Error("\u540E\u53F0\u58F0\u660E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
44
|
+
const item = value;
|
|
45
|
+
if (typeof item.entry !== "string" || !/^[\w./-]+\.js$/.test(item.entry) || item.entry.split("/").some((part) => !part || part === "." || part === ".."))
|
|
46
|
+
throw new Error("\u540E\u53F0\u5165\u53E3\u5FC5\u987B\u662F\u5305\u5185 JS \u6587\u4EF6");
|
|
47
|
+
if (item.runtime !== "node" || item.apiVersion !== 1)
|
|
48
|
+
throw new Error("\u540E\u53F0\u8FD0\u884C\u65F6\u6216\u534F\u8BAE\u7248\u672C\u4E0D\u517C\u5BB9");
|
|
49
|
+
if (item.scope !== "application" && item.scope !== "workspace") throw new Error("\u540E\u53F0\u4F5C\u7528\u57DF\u65E0\u6548");
|
|
50
|
+
if (item.activation !== "on-demand" && item.activation !== "app-ready" && item.activation !== "workspace-ready")
|
|
51
|
+
throw new Error("\u540E\u53F0\u6FC0\u6D3B\u65F6\u673A\u65E0\u6548");
|
|
52
|
+
if (item.activation !== "on-demand" && item.activation !== (item.scope === "application" ? "app-ready" : "workspace-ready"))
|
|
53
|
+
throw new Error("\u540E\u53F0\u6FC0\u6D3B\u65F6\u673A\u4E0E\u4F5C\u7528\u57DF\u4E0D\u5339\u914D");
|
|
54
|
+
if (item.lifetime !== "idle" && item.lifetime !== "persistent")
|
|
55
|
+
throw new Error("\u540E\u53F0\u751F\u547D\u5468\u671F\u65E0\u6548");
|
|
56
|
+
if (typeof item.reason !== "string" || !item.reason.trim()) throw new Error("\u540E\u53F0\u7528\u9014\u4E0D\u80FD\u4E3A\u7A7A");
|
|
57
|
+
if (!Array.isArray(item.systemAccess) || item.systemAccess.some((value2) => !PLUGIN_SYSTEM_ACCESS.includes(value2)))
|
|
58
|
+
throw new Error("\u540E\u53F0\u7CFB\u7EDF\u7528\u9014\u5206\u7C7B\u65E0\u6548");
|
|
59
|
+
let tools;
|
|
60
|
+
if (item.tools !== void 0) {
|
|
61
|
+
if (!Array.isArray(item.tools) || !item.systemAccess.includes("process"))
|
|
62
|
+
throw new Error("\u5916\u90E8\u5DE5\u5177\u987B\u58F0\u660E process \u7528\u9014");
|
|
63
|
+
const ids = /* @__PURE__ */ new Set();
|
|
64
|
+
tools = Object.freeze(
|
|
65
|
+
item.tools.map((tool) => {
|
|
66
|
+
if (!tool || typeof tool !== "object" || Array.isArray(tool))
|
|
67
|
+
throw new Error("\u5916\u90E8\u5DE5\u5177\u58F0\u660E\u65E0\u6548");
|
|
68
|
+
const value2 = tool;
|
|
69
|
+
if (typeof value2.id !== "string" || !/^[a-z][\w.-]*$/.test(value2.id) || ids.has(value2.id) || typeof value2.command !== "string" || !value2.command.trim() || value2.command.includes("\0"))
|
|
70
|
+
throw new Error("\u5916\u90E8\u5DE5\u5177\u8EAB\u4EFD\u6216\u547D\u4EE4\u65E0\u6548");
|
|
71
|
+
ids.add(value2.id);
|
|
72
|
+
if (value2.args !== void 0 && (!Array.isArray(value2.args) || value2.args.some((arg) => typeof arg !== "string" || arg.includes("\0"))))
|
|
73
|
+
throw new Error("\u5916\u90E8\u5DE5\u5177\u53C2\u6570\u65E0\u6548");
|
|
74
|
+
return Object.freeze({
|
|
75
|
+
id: value2.id,
|
|
76
|
+
command: value2.command,
|
|
77
|
+
...value2.args ? { args: Object.freeze([...value2.args]) } : {}
|
|
78
|
+
});
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
return Object.freeze({
|
|
83
|
+
...tools ? { tools } : {},
|
|
84
|
+
entry: item.entry,
|
|
85
|
+
runtime: "node",
|
|
86
|
+
apiVersion: 1,
|
|
87
|
+
scope: item.scope,
|
|
88
|
+
activation: item.activation,
|
|
89
|
+
lifetime: item.lifetime,
|
|
90
|
+
reason: item.reason.trim(),
|
|
91
|
+
systemAccess: Object.freeze([...new Set(item.systemAccess)])
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
39
95
|
// packages/plugins/src/categories.ts
|
|
40
96
|
var PLUGIN_CATEGORIES = [
|
|
41
97
|
{ id: "sync", label: "\u540C\u6B65" },
|
|
@@ -50,36 +106,25 @@ var PLUGIN_CATEGORIES = [
|
|
|
50
106
|
{ id: "video", label: "\u89C6\u9891" },
|
|
51
107
|
{ id: "page", label: "\u9875\u9762" }
|
|
52
108
|
];
|
|
53
|
-
var PLUGIN_KEYWORD_LIMIT = 5;
|
|
54
|
-
var PLUGIN_KEYWORD_MAX_LENGTH = 20;
|
|
55
109
|
var categoryIds = new Set(PLUGIN_CATEGORIES.map((item) => item.id));
|
|
56
110
|
var isPluginCategory = (value) => typeof value === "string" && categoryIds.has(value);
|
|
57
|
-
function readCatalogFields(item
|
|
58
|
-
const fail = (message) => {
|
|
59
|
-
if (strict) throw new Error(message);
|
|
60
|
-
};
|
|
111
|
+
function readCatalogFields(item) {
|
|
61
112
|
const list = (value, name) => {
|
|
62
113
|
if (value === void 0) return [];
|
|
63
114
|
if (Array.isArray(value)) return value;
|
|
64
|
-
|
|
65
|
-
return [];
|
|
115
|
+
throw new Error(`${name} \u5FC5\u987B\u662F\u6570\u7EC4`);
|
|
66
116
|
};
|
|
67
117
|
const categories = [];
|
|
68
118
|
for (const value of list(item.categories, "categories")) {
|
|
69
|
-
if (!isPluginCategory(value))
|
|
119
|
+
if (!isPluginCategory(value)) throw new Error(`\u672A\u77E5\u63D2\u4EF6\u5206\u7C7B\uFF1A${String(value)}`);
|
|
70
120
|
else if (!categories.includes(value)) categories.push(value);
|
|
71
121
|
}
|
|
72
122
|
const keywords = [];
|
|
73
123
|
for (const value of list(item.keywords, "keywords")) {
|
|
74
124
|
const keyword = typeof value === "string" ? value.trim() : "";
|
|
75
|
-
if (!keyword
|
|
76
|
-
fail(`\u5173\u952E\u8BCD\u5FC5\u987B\u4E3A 1 \u81F3 ${PLUGIN_KEYWORD_MAX_LENGTH} \u5B57`);
|
|
125
|
+
if (!keyword) throw new Error("\u5173\u952E\u8BCD\u5FC5\u987B\u662F\u975E\u7A7A\u6587\u672C");
|
|
77
126
|
else if (!keywords.includes(keyword)) keywords.push(keyword);
|
|
78
127
|
}
|
|
79
|
-
if (keywords.length > PLUGIN_KEYWORD_LIMIT) {
|
|
80
|
-
fail(`\u5173\u952E\u8BCD\u6700\u591A ${PLUGIN_KEYWORD_LIMIT} \u4E2A`);
|
|
81
|
-
keywords.length = PLUGIN_KEYWORD_LIMIT;
|
|
82
|
-
}
|
|
83
128
|
return {
|
|
84
129
|
...categories.length ? { categories: Object.freeze(categories) } : {},
|
|
85
130
|
...keywords.length ? { keywords: Object.freeze(keywords) } : {}
|
|
@@ -95,6 +140,7 @@ var PLUGIN_AI_CAPABILITIES = {
|
|
|
95
140
|
flashcardGeneration: { name: "\u95EA\u5361\u5236\u4F5C" },
|
|
96
141
|
aiJudgement: { name: "\u7B54\u6848\u8BC4\u5224" },
|
|
97
142
|
transcriptionOptimization: { name: "\u8F6C\u5F55\u65AD\u53E5\u4F18\u5316" },
|
|
143
|
+
speechInputRefinement: { name: "\u8BED\u97F3\u8F93\u5165\u6574\u7406" },
|
|
98
144
|
videoSummary: { name: "\u89C6\u9891\u603B\u7ED3" },
|
|
99
145
|
videoEbookRewrite: { name: "\u89C6\u9891\u7535\u5B50\u4E66\u91CD\u5199" },
|
|
100
146
|
vibeLearningImageDescription: { name: "\u56FE\u7247\u7406\u89E3" },
|
|
@@ -138,108 +184,30 @@ var PLUGIN_PERMISSIONS = [
|
|
|
138
184
|
];
|
|
139
185
|
var permissionIds = new Set(PLUGIN_PERMISSIONS);
|
|
140
186
|
var isPluginPermission = (value) => typeof value === "string" && permissionIds.has(value);
|
|
141
|
-
function readPermissionsField(item
|
|
142
|
-
const fail = (message) => {
|
|
143
|
-
if (strict) throw new Error(message);
|
|
144
|
-
};
|
|
187
|
+
function readPermissionsField(item) {
|
|
145
188
|
if (item.permissions === void 0) return {};
|
|
146
189
|
if (!Array.isArray(item.permissions)) {
|
|
147
|
-
|
|
148
|
-
return {};
|
|
190
|
+
throw new Error("permissions \u5FC5\u987B\u662F\u6570\u7EC4");
|
|
149
191
|
}
|
|
150
192
|
const permissions = [];
|
|
151
193
|
for (const value of item.permissions) {
|
|
152
|
-
if (!isPluginPermission(value))
|
|
194
|
+
if (!isPluginPermission(value)) throw new Error(`\u672A\u77E5\u63D2\u4EF6\u6743\u9650\uFF1A${String(value)}`);
|
|
153
195
|
else if (!permissions.includes(value)) permissions.push(value);
|
|
154
196
|
}
|
|
155
197
|
return permissions.length ? { permissions: Object.freeze(permissions) } : {};
|
|
156
198
|
}
|
|
157
199
|
|
|
158
|
-
// packages/plugins/src/backend-manifest.ts
|
|
159
|
-
var PLUGIN_SYSTEM_ACCESS = ["filesystem", "network", "process"];
|
|
160
|
-
function validateBackendManifest(value) {
|
|
161
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
162
|
-
throw new Error("\u540E\u53F0\u58F0\u660E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
163
|
-
const item = value;
|
|
164
|
-
const keys = [
|
|
165
|
-
"entry",
|
|
166
|
-
"runtime",
|
|
167
|
-
"apiVersion",
|
|
168
|
-
"scope",
|
|
169
|
-
"activation",
|
|
170
|
-
"lifetime",
|
|
171
|
-
"reason",
|
|
172
|
-
"systemAccess",
|
|
173
|
-
"tools"
|
|
174
|
-
];
|
|
175
|
-
if (Object.keys(item).some((key) => !keys.includes(key))) throw new Error("\u540E\u53F0\u58F0\u660E\u5305\u542B\u672A\u77E5\u5B57\u6BB5");
|
|
176
|
-
if (typeof item.entry !== "string" || !/^[\w./-]+\.js$/.test(item.entry) || item.entry.split("/").some((part) => !part || part === "." || part === ".."))
|
|
177
|
-
throw new Error("\u540E\u53F0\u5165\u53E3\u5FC5\u987B\u662F\u5305\u5185 JS \u6587\u4EF6");
|
|
178
|
-
if (item.runtime !== "node" || item.apiVersion !== 1)
|
|
179
|
-
throw new Error("\u540E\u53F0\u8FD0\u884C\u65F6\u6216\u534F\u8BAE\u7248\u672C\u4E0D\u517C\u5BB9");
|
|
180
|
-
if (item.scope !== "application" && item.scope !== "workspace") throw new Error("\u540E\u53F0\u4F5C\u7528\u57DF\u65E0\u6548");
|
|
181
|
-
if (item.activation !== "on-demand" && item.activation !== "app-ready" && item.activation !== "workspace-ready")
|
|
182
|
-
throw new Error("\u540E\u53F0\u6FC0\u6D3B\u65F6\u673A\u65E0\u6548");
|
|
183
|
-
if (item.activation !== "on-demand" && item.activation !== (item.scope === "application" ? "app-ready" : "workspace-ready"))
|
|
184
|
-
throw new Error("\u540E\u53F0\u6FC0\u6D3B\u65F6\u673A\u4E0E\u4F5C\u7528\u57DF\u4E0D\u5339\u914D");
|
|
185
|
-
if (item.lifetime !== "idle" && item.lifetime !== "persistent")
|
|
186
|
-
throw new Error("\u540E\u53F0\u751F\u547D\u5468\u671F\u65E0\u6548");
|
|
187
|
-
if (typeof item.reason !== "string" || !item.reason.trim() || item.reason.length > 500)
|
|
188
|
-
throw new Error("\u540E\u53F0\u7528\u9014\u5FC5\u987B\u4E3A 1 \u81F3 500 \u5B57");
|
|
189
|
-
if (!Array.isArray(item.systemAccess) || new Set(item.systemAccess).size !== item.systemAccess.length || item.systemAccess.some((value2) => !PLUGIN_SYSTEM_ACCESS.includes(value2)))
|
|
190
|
-
throw new Error("\u540E\u53F0\u7CFB\u7EDF\u7528\u9014\u5206\u7C7B\u65E0\u6548");
|
|
191
|
-
let tools;
|
|
192
|
-
if (item.tools !== void 0) {
|
|
193
|
-
if (!Array.isArray(item.tools) || item.tools.length > 32 || !item.systemAccess.includes("process"))
|
|
194
|
-
throw new Error("\u5916\u90E8\u5DE5\u5177\u987B\u58F0\u660E process \u7528\u9014\uFF0C\u6700\u591A 32 \u9879");
|
|
195
|
-
const ids = /* @__PURE__ */ new Set();
|
|
196
|
-
tools = Object.freeze(
|
|
197
|
-
item.tools.map((tool) => {
|
|
198
|
-
if (!tool || typeof tool !== "object" || Array.isArray(tool))
|
|
199
|
-
throw new Error("\u5916\u90E8\u5DE5\u5177\u58F0\u660E\u65E0\u6548");
|
|
200
|
-
const value2 = tool;
|
|
201
|
-
if (Object.keys(value2).some((key) => !["id", "command", "args"].includes(key)) || typeof value2.id !== "string" || !/^[a-z][\w.-]{0,63}$/.test(value2.id) || ids.has(value2.id) || typeof value2.command !== "string" || !value2.command.trim() || value2.command.length > 1024 || /[\0\r\n]/.test(value2.command))
|
|
202
|
-
throw new Error("\u5916\u90E8\u5DE5\u5177\u8EAB\u4EFD\u6216\u547D\u4EE4\u65E0\u6548");
|
|
203
|
-
ids.add(value2.id);
|
|
204
|
-
if (value2.args !== void 0 && (!Array.isArray(value2.args) || value2.args.length > 64 || value2.args.some(
|
|
205
|
-
(arg) => typeof arg !== "string" || arg.length > 4096 || arg.includes("\0")
|
|
206
|
-
)))
|
|
207
|
-
throw new Error("\u5916\u90E8\u5DE5\u5177\u53C2\u6570\u65E0\u6548");
|
|
208
|
-
return Object.freeze({
|
|
209
|
-
id: value2.id,
|
|
210
|
-
command: value2.command,
|
|
211
|
-
...value2.args ? { args: Object.freeze([...value2.args]) } : {}
|
|
212
|
-
});
|
|
213
|
-
})
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
return Object.freeze({
|
|
217
|
-
...tools ? { tools } : {},
|
|
218
|
-
entry: item.entry,
|
|
219
|
-
runtime: "node",
|
|
220
|
-
apiVersion: 1,
|
|
221
|
-
scope: item.scope,
|
|
222
|
-
activation: item.activation,
|
|
223
|
-
lifetime: item.lifetime,
|
|
224
|
-
reason: item.reason.trim(),
|
|
225
|
-
systemAccess: Object.freeze([...item.systemAccess])
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
200
|
// packages/plugins/src/skills.ts
|
|
230
201
|
var SKILL_ROOT = "skills";
|
|
231
202
|
var SKILL_README = "SKILL.md";
|
|
232
|
-
var SKILL_LIMITS = { skills: 32 };
|
|
233
203
|
var skillDirectory = (id) => `${SKILL_ROOT}/${id}`;
|
|
234
204
|
function readSkillsField(value) {
|
|
235
205
|
if (value === void 0) return void 0;
|
|
236
|
-
if (!Array.isArray(value)
|
|
237
|
-
throw new Error(`skills \u5FC5\u987B\u662F\u6700\u591A ${SKILL_LIMITS.skills} \u9879\u7684\u6570\u7EC4`);
|
|
206
|
+
if (!Array.isArray(value)) throw new Error("skills \u5FC5\u987B\u662F\u6570\u7EC4");
|
|
238
207
|
const ids = /* @__PURE__ */ new Set();
|
|
239
208
|
for (const id of value) {
|
|
240
209
|
if (typeof id !== "string") throw new Error("Skill ID \u65E0\u6548");
|
|
241
210
|
assertLocalId(id);
|
|
242
|
-
if (ids.has(id)) throw new Error(`Skill ID \u91CD\u590D\uFF1A${id}`);
|
|
243
211
|
ids.add(id);
|
|
244
212
|
}
|
|
245
213
|
return ids.size ? Object.freeze([...ids]) : void 0;
|
|
@@ -262,6 +230,43 @@ function readSkillFiles(skills, integrity) {
|
|
|
262
230
|
return files;
|
|
263
231
|
}
|
|
264
232
|
|
|
233
|
+
// packages/plugins/src/package-fields.ts
|
|
234
|
+
function readPluginIdentity(item) {
|
|
235
|
+
const { id, name, version } = item;
|
|
236
|
+
if (typeof id !== "string") throw new Error("\u63D2\u4EF6 ID \u65E0\u6548");
|
|
237
|
+
assertLocalId(id);
|
|
238
|
+
if (typeof name !== "string" || !name.trim() || typeof version !== "string")
|
|
239
|
+
throw new Error("\u63D2\u4EF6\u540D\u79F0\u6216\u7248\u672C\u65E0\u6548");
|
|
240
|
+
comparePluginVersions(version, version);
|
|
241
|
+
return { id, name, version };
|
|
242
|
+
}
|
|
243
|
+
function readPluginMetadata(item) {
|
|
244
|
+
return { ...readPluginIdentity(item), ...readCatalogFields(item), ...readPermissionsField(item) };
|
|
245
|
+
}
|
|
246
|
+
function readPluginFilePath(input, extension) {
|
|
247
|
+
if (typeof input !== "string" || !/^[\w./-]+$/.test(input) || input.split("/").some((part) => !part || part === "." || part === "..") || !input.endsWith(extension))
|
|
248
|
+
throw new Error("\u63D2\u4EF6\u5165\u53E3\u6216\u6837\u5F0F\u8DEF\u5F84\u65E0\u6548");
|
|
249
|
+
return input;
|
|
250
|
+
}
|
|
251
|
+
function readPluginFiles(item, entries) {
|
|
252
|
+
if (!item.integrity || typeof item.integrity !== "object" || Array.isArray(item.integrity))
|
|
253
|
+
throw new Error("\u63D2\u4EF6\u4EA7\u7269\u7F3A\u5C11\u5B8C\u6574\u6027\u6458\u8981\u6E05\u5355");
|
|
254
|
+
const source = item.integrity;
|
|
255
|
+
const integrity = {};
|
|
256
|
+
for (const name of entries) {
|
|
257
|
+
const hash = source[name];
|
|
258
|
+
if (typeof hash !== "string" || !/^[a-f0-9]{64}$/.test(hash))
|
|
259
|
+
throw new Error("\u63D2\u4EF6\u4EA7\u7269\u7F3A\u5C11\u6709\u6548\u7684\u5B8C\u6574\u6027\u6458\u8981");
|
|
260
|
+
integrity[name] = hash;
|
|
261
|
+
}
|
|
262
|
+
const skills = readSkillsField(item.skills);
|
|
263
|
+
Object.assign(integrity, readSkillFiles(skills, source));
|
|
264
|
+
return {
|
|
265
|
+
...skills ? { skills } : {},
|
|
266
|
+
integrity: Object.freeze(integrity)
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
265
270
|
// packages/plugins/src/package.ts
|
|
266
271
|
var PLUGIN_SHARED_MODULES = [
|
|
267
272
|
"@tau/plugins",
|
|
@@ -274,22 +279,14 @@ var PLUGIN_SHARED_MODULES = [
|
|
|
274
279
|
"react/jsx-runtime",
|
|
275
280
|
"react/jsx-dev-runtime"
|
|
276
281
|
];
|
|
277
|
-
function validatePluginManifest(value
|
|
282
|
+
function validatePluginManifest(value) {
|
|
278
283
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
279
284
|
throw new Error("\u63D2\u4EF6\u6E05\u5355\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
280
285
|
const item = value;
|
|
281
286
|
if (item.formatVersion !== 1 && item.formatVersion !== 2 || item.apiVersion !== 1 || item.platform !== "desktop" || item.format !== "cjs")
|
|
282
287
|
throw new Error("\u63D2\u4EF6\u5305\u683C\u5F0F\u3001API \u7248\u672C\u6216\u5E73\u53F0\u4E0D\u517C\u5BB9");
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (typeof item.name !== "string" || !item.name.trim() || typeof item.version !== "string" || !/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(item.version))
|
|
286
|
-
throw new Error("\u63D2\u4EF6\u540D\u79F0\u6216\u7248\u672C\u65E0\u6548");
|
|
287
|
-
const file = (input, extension) => {
|
|
288
|
-
if (typeof input !== "string" || !/^[\w./-]+$/.test(input) || input.split("/").some((part) => !part || part === "." || part === "..") || !input.endsWith(extension))
|
|
289
|
-
throw new Error("\u63D2\u4EF6\u5165\u53E3\u6216\u6837\u5F0F\u8DEF\u5F84\u65E0\u6548");
|
|
290
|
-
return input;
|
|
291
|
-
};
|
|
292
|
-
const main = file(item.main, ".js");
|
|
288
|
+
const metadata = readPluginMetadata(item);
|
|
289
|
+
const main = readPluginFilePath(item.main, ".js");
|
|
293
290
|
const backend = item.backend === void 0 ? void 0 : validateBackendManifest(item.backend);
|
|
294
291
|
if (item.formatVersion === 2 !== Boolean(backend))
|
|
295
292
|
throw new Error("\u540E\u53F0\u58F0\u660E\u5FC5\u987B\u4F7F\u7528\u5305\u683C\u5F0F 2\uFF0C\u666E\u901A\u63D2\u4EF6\u4F7F\u7528\u683C\u5F0F 1");
|
|
@@ -300,30 +297,15 @@ function validatePluginManifest(value, options = {}) {
|
|
|
300
297
|
if (typeof item.minAppVersion !== "string") throw new Error("\u6700\u4F4E\u5BA2\u6237\u7AEF\u7248\u672C\u65E0\u6548");
|
|
301
298
|
comparePluginVersions(item.minAppVersion, item.minAppVersion);
|
|
302
299
|
}
|
|
303
|
-
const styles = item.styles === void 0 ? void 0 :
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
const integrity = {};
|
|
310
|
-
for (const name of [main, ...styles ? [styles] : [], ...backend ? [backend.entry] : []]) {
|
|
311
|
-
const hash = item.integrity && typeof item.integrity === "object" ? item.integrity[name] : void 0;
|
|
312
|
-
if (typeof hash !== "string" || !/^[a-f0-9]{64}$/.test(hash))
|
|
313
|
-
throw new Error("\u63D2\u4EF6\u4EA7\u7269\u7F3A\u5C11\u6709\u6548\u7684\u5B8C\u6574\u6027\u6458\u8981");
|
|
314
|
-
integrity[name] = hash;
|
|
315
|
-
}
|
|
316
|
-
const skills = readSkillsField(item.skills);
|
|
317
|
-
if (skills)
|
|
318
|
-
Object.assign(
|
|
319
|
-
integrity,
|
|
320
|
-
readSkillFiles(skills, item.integrity ?? {})
|
|
321
|
-
);
|
|
300
|
+
const styles = item.styles === void 0 ? void 0 : readPluginFilePath(item.styles, ".css");
|
|
301
|
+
const files = readPluginFiles(item, [
|
|
302
|
+
main,
|
|
303
|
+
...styles ? [styles] : [],
|
|
304
|
+
...backend ? [backend.entry] : []
|
|
305
|
+
]);
|
|
322
306
|
return Object.freeze({
|
|
323
307
|
formatVersion: item.formatVersion,
|
|
324
|
-
|
|
325
|
-
name: item.name,
|
|
326
|
-
version: item.version,
|
|
308
|
+
...metadata,
|
|
327
309
|
...typeof item.minAppVersion === "string" ? { minAppVersion: item.minAppVersion } : {},
|
|
328
310
|
apiVersion: 1,
|
|
329
311
|
platform: "desktop",
|
|
@@ -332,10 +314,7 @@ function validatePluginManifest(value, options = {}) {
|
|
|
332
314
|
...backend ? { backend } : {},
|
|
333
315
|
...item.editor === true ? { editor: true } : {},
|
|
334
316
|
...item.whiteboard === true ? { whiteboard: true } : {},
|
|
335
|
-
...
|
|
336
|
-
...permissions,
|
|
337
|
-
...skills ? { skills } : {},
|
|
338
|
-
integrity: Object.freeze(integrity),
|
|
317
|
+
...files,
|
|
339
318
|
...styles === void 0 ? {} : { styles }
|
|
340
319
|
});
|
|
341
320
|
}
|
|
@@ -344,16 +323,17 @@ var isContentPlugin = (manifest) => manifest.editor === true || manifest.whitebo
|
|
|
344
323
|
export {
|
|
345
324
|
assertLocalId,
|
|
346
325
|
comparePluginVersions,
|
|
326
|
+
PLUGIN_SYSTEM_ACCESS,
|
|
327
|
+
validateBackendManifest,
|
|
347
328
|
PLUGIN_CATEGORIES,
|
|
348
|
-
PLUGIN_KEYWORD_LIMIT,
|
|
349
|
-
PLUGIN_KEYWORD_MAX_LENGTH,
|
|
350
329
|
isPluginCategory,
|
|
351
330
|
PLUGIN_AI_CAPABILITIES,
|
|
352
331
|
isPluginAICapability,
|
|
353
332
|
PLUGIN_PERMISSIONS,
|
|
354
333
|
isPluginPermission,
|
|
355
|
-
|
|
356
|
-
|
|
334
|
+
readPluginMetadata,
|
|
335
|
+
readPluginFilePath,
|
|
336
|
+
readPluginFiles,
|
|
357
337
|
PLUGIN_SHARED_MODULES,
|
|
358
338
|
validatePluginManifest,
|
|
359
339
|
isContentPlugin
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
comparePluginVersions,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
readPluginFilePath,
|
|
4
|
+
readPluginFiles,
|
|
5
|
+
readPluginMetadata
|
|
6
|
+
} from "./chunk-M3YEVDN4.js";
|
|
5
7
|
|
|
6
8
|
// packages/plugins/src/portable.ts
|
|
7
9
|
var PORTABLE_PLATFORMS = ["desktop", "android", "ios"];
|
|
@@ -15,45 +17,32 @@ var PORTABLE_SHARED_MODULES = [
|
|
|
15
17
|
"react/jsx-runtime",
|
|
16
18
|
"react/jsx-dev-runtime"
|
|
17
19
|
];
|
|
18
|
-
function assertKeys(item, keys, label) {
|
|
19
|
-
if (Object.keys(item).some((key) => !keys.includes(key))) throw new Error(`${label}\u5305\u542B\u672A\u77E5\u5B57\u6BB5`);
|
|
20
|
-
}
|
|
21
20
|
function buildPortablePluginManifest(value, output) {
|
|
22
21
|
const item = record(value, "\u4F5C\u8005\u6E05\u5355");
|
|
23
22
|
const files = record(output, "\u6784\u5EFA\u6587\u4EF6\u4FE1\u606F");
|
|
24
|
-
assertKeys(files, ["main", "styles", "integrity", "skills", "imports"], "\u6784\u5EFA\u6587\u4EF6\u4FE1\u606F");
|
|
25
|
-
const imports = files.imports ?? [];
|
|
26
|
-
if (!Array.isArray(imports) || imports.some((name) => !PORTABLE_SHARED_MODULES.includes(name)))
|
|
27
|
-
throw new Error("\u6784\u5EFA\u6A21\u5757\u4F9D\u8D56\u65E0\u6548");
|
|
28
|
-
const { imports: _imports, ...buildFiles } = files;
|
|
29
|
-
assertKeys(
|
|
30
|
-
item,
|
|
31
|
-
["id", "name", "version", "description", "categories", "keywords", "permissions", "targets"],
|
|
32
|
-
"\u4F5C\u8005\u6E05\u5355"
|
|
33
|
-
);
|
|
34
|
-
const targets = record(item.targets, "\u76EE\u6807\u5E73\u53F0");
|
|
35
|
-
const normalized = Object.fromEntries(
|
|
36
|
-
Object.entries(targets).map(([platform, input]) => {
|
|
37
|
-
const target = record(input, "\u5E73\u53F0\u914D\u7F6E");
|
|
38
|
-
assertKeys(target, ["minAppVersion"], "\u5E73\u53F0\u914D\u7F6E");
|
|
39
|
-
return [platform, { minAppVersion: target.minAppVersion }];
|
|
40
|
-
})
|
|
41
|
-
);
|
|
42
|
-
const { targets: _targets, ...metadata } = item;
|
|
43
23
|
return validatePortableDistributionManifest({
|
|
44
|
-
|
|
24
|
+
id: item.id,
|
|
25
|
+
name: item.name,
|
|
26
|
+
version: item.version,
|
|
27
|
+
description: item.description,
|
|
28
|
+
categories: item.categories,
|
|
29
|
+
keywords: item.keywords,
|
|
30
|
+
permissions: item.permissions,
|
|
45
31
|
formatVersion: 3,
|
|
46
32
|
apiVersion: 1,
|
|
47
33
|
platform: "portable",
|
|
48
34
|
profile: "web-v1",
|
|
49
35
|
format: "cjs",
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
main: files.main,
|
|
37
|
+
styles: files.styles,
|
|
38
|
+
skills: files.skills,
|
|
39
|
+
integrity: files.integrity,
|
|
40
|
+
targets: item.targets
|
|
52
41
|
});
|
|
53
42
|
}
|
|
54
43
|
function record(value, label) {
|
|
55
|
-
if (!value || typeof value !== "object" || Array.isArray(value)
|
|
56
|
-
throw new Error(`${label}\u5FC5\u987B\u662F\
|
|
44
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
45
|
+
throw new Error(`${label}\u5FC5\u987B\u662F\u5BF9\u8C61`);
|
|
57
46
|
return value;
|
|
58
47
|
}
|
|
59
48
|
function validatePortablePluginManifest(value) {
|
|
@@ -62,63 +51,44 @@ function validatePortablePluginManifest(value) {
|
|
|
62
51
|
var readPortablePluginManifest = validatePortablePluginManifest;
|
|
63
52
|
function validatePortableDistributionManifest(value) {
|
|
64
53
|
const manifest = validatePortablePluginManifest(value);
|
|
65
|
-
if (/[-+]/.test(manifest.version)) throw new Error("\u6B63\u5F0F\u8DE8\u7AEF\u5305\u7248\u672C\u4E0D\u80FD\u542B\u9884\u53D1\u5E03\u6216\u6784\u5EFA\u6807\u8BC6");
|
|
66
54
|
if ((manifest.targets.android || manifest.targets.ios) && manifest.permissions?.length)
|
|
67
55
|
throw new Error("\u79FB\u52A8\u7AEF\u5C1A\u672A\u63A5\u5165\u4E1A\u52A1\u6570\u636E\u6388\u6743\uFF0C\u4E0D\u80FD\u53D1\u5E03\u58F0\u660E\u8FD9\u4E9B\u6743\u9650\u7684\u79FB\u52A8\u76EE\u6807");
|
|
68
56
|
return manifest;
|
|
69
57
|
}
|
|
70
58
|
function parsePortablePluginManifest(value) {
|
|
71
59
|
const item = record(value, "\u8DE8\u7AEF\u6E05\u5355");
|
|
72
|
-
const keys = /* @__PURE__ */ new Set([
|
|
73
|
-
"formatVersion",
|
|
74
|
-
"apiVersion",
|
|
75
|
-
"id",
|
|
76
|
-
"name",
|
|
77
|
-
"description",
|
|
78
|
-
"version",
|
|
79
|
-
"platform",
|
|
80
|
-
"profile",
|
|
81
|
-
"targets",
|
|
82
|
-
"format",
|
|
83
|
-
"main",
|
|
84
|
-
"styles",
|
|
85
|
-
"categories",
|
|
86
|
-
"keywords",
|
|
87
|
-
"permissions",
|
|
88
|
-
"integrity",
|
|
89
|
-
"skills"
|
|
90
|
-
]);
|
|
91
|
-
if (Object.keys(item).some((key) => !keys.has(key))) throw new Error("\u8DE8\u7AEF\u6E05\u5355\u5305\u542B\u672A\u652F\u6301\u5B57\u6BB5");
|
|
92
60
|
if (item.formatVersion !== 3 || item.platform !== "portable" || item.profile !== "web-v1")
|
|
93
61
|
throw new Error("\u8DE8\u7AEF\u5305\u683C\u5F0F\u6216\u8FD0\u884C\u914D\u7F6E\u4E0D\u517C\u5BB9");
|
|
94
|
-
if (item.
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
62
|
+
if (item.apiVersion !== 1 || item.format !== "cjs") throw new Error("\u63D2\u4EF6 API \u6216\u5165\u53E3\u683C\u5F0F\u4E0D\u517C\u5BB9");
|
|
63
|
+
const metadata = readPluginMetadata(item);
|
|
64
|
+
const main = readPluginFilePath(item.main, ".js");
|
|
65
|
+
const styles = item.styles === void 0 ? void 0 : readPluginFilePath(item.styles, ".css");
|
|
66
|
+
const files = readPluginFiles(item, [main, ...styles ? [styles] : []]);
|
|
100
67
|
const rawTargets = record(item.targets, "\u76EE\u6807\u5E73\u53F0");
|
|
101
|
-
if (!Object.keys(rawTargets).length || Object.keys(rawTargets).some((key) => !PORTABLE_PLATFORMS.some((platform) => platform === key)))
|
|
102
|
-
throw new Error("\u76EE\u6807\u5E73\u53F0\u4E3A\u7A7A\u6216\u5305\u542B\u672A\u77E5\u5E73\u53F0");
|
|
103
68
|
const targets = {};
|
|
104
69
|
for (const platform of PORTABLE_PLATFORMS) {
|
|
105
70
|
if (!Object.hasOwn(rawTargets, platform)) continue;
|
|
106
71
|
const target = record(rawTargets[platform], "\u5E73\u53F0\u914D\u7F6E");
|
|
107
|
-
assertKeys(target, ["minAppVersion"], "\u5E73\u53F0\u914D\u7F6E");
|
|
108
72
|
if (typeof target.minAppVersion !== "string") throw new Error("\u5E73\u53F0\u7F3A\u5C11\u6700\u4F4E\u5BA2\u6237\u7AEF\u7248\u672C");
|
|
109
73
|
comparePluginVersions(target.minAppVersion, target.minAppVersion);
|
|
110
74
|
targets[platform] = Object.freeze({ minAppVersion: target.minAppVersion });
|
|
111
75
|
}
|
|
112
|
-
|
|
113
|
-
|
|
76
|
+
if (!Object.keys(targets).length) throw new Error("\u9700\u8981\u81F3\u5C11\u4E00\u4E2A\u652F\u6301\u7684\u76EE\u6807\u5E73\u53F0");
|
|
77
|
+
const declaredFiles = item.integrity;
|
|
78
|
+
if (Object.keys(declaredFiles).some((file) => !Object.hasOwn(files.integrity, file)))
|
|
114
79
|
throw new Error("\u8DE8\u7AEF\u5305\u5305\u542B\u672A\u58F0\u660E\u6587\u4EF6");
|
|
115
|
-
for (const file of Object.keys(files)) {
|
|
116
|
-
if (file ===
|
|
80
|
+
for (const file of Object.keys(files.integrity)) {
|
|
81
|
+
if (file === main || file === styles) continue;
|
|
117
82
|
if (!file.endsWith(".md") || file.split("/").includes("scripts") || file.includes("\\"))
|
|
118
83
|
throw new Error("\u8DE8\u7AEF Skill \u4EC5\u652F\u6301\u7EAF Markdown \u6587\u6863\uFF0C\u4E0D\u652F\u6301\u811A\u672C\u6216\u9644\u4EF6");
|
|
119
84
|
}
|
|
120
85
|
return Object.freeze({
|
|
121
|
-
...
|
|
86
|
+
...metadata,
|
|
87
|
+
apiVersion: 1,
|
|
88
|
+
format: "cjs",
|
|
89
|
+
main,
|
|
90
|
+
...styles ? { styles } : {},
|
|
91
|
+
...files,
|
|
122
92
|
formatVersion: 3,
|
|
123
93
|
platform: "portable",
|
|
124
94
|
profile: "web-v1",
|
package/docs/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tau 插件开发文档
|
|
2
2
|
|
|
3
|
-
默认模板使用 SDK 0.
|
|
3
|
+
默认模板使用 SDK 0.43.0、UI 0.5.0,生成格式 3 的同一插件包。中心 v2 支持上传待审,格式 3 普通提交人工批准,具审核权限的作者本人经已绑定仓库 CI 发布可自动批准;平台测试由作者负责,不要求审核者测试或填写验证记录。Android/iOS 正式安装要求客户端至少 0.2.4,并通过中心兼容选版。先读 [API 支持矩阵](api-support.md)、[跨端契约](portability.md)与[快速开始](getting-started.md)。下文桌面领域接口不表示移动端可用。
|
|
4
4
|
|
|
5
5
|
Tau 插件用 TypeScript 和 React 编写,打包成一个 ZIP,按声明在兼容的 Tau 宿主运行。插件可以给 Tau 加页面和侧边栏入口,在文档里放自定义块,给 AI 提供工具,接入第三方存储、语音、视频等服务,或者读写用户的卡片和待办。
|
|
6
6
|
|
|
@@ -31,6 +31,7 @@ Tau 插件用 TypeScript 和 React 编写,打包成一个 ZIP,按声明在
|
|
|
31
31
|
| 创建闪卡、打开制卡窗口 | [闪卡](flashcards.md) |
|
|
32
32
|
| 编译 Tailwind、转换 Markdown、处理音视频 | [编译与转换服务](services.md) |
|
|
33
33
|
| 运行 Node.js 代码、调用本机程序 | [本机后台](backend.md) |
|
|
34
|
+
| 接入语音识别 | [语音识别](providers/asr.md) |
|
|
34
35
|
| 接入同步存储、图床、语音、图片生成、视频网站、博客发布目标 | [服务提供方](providers/README.md) |
|
|
35
36
|
| 开发独立博客站点,读取 Tau 发布的数据 | [站点数据](site-data.md) |
|
|
36
37
|
|
package/docs/ai.md
CHANGED
|
@@ -44,6 +44,7 @@ console.log(result.text);
|
|
|
44
44
|
| `flashcardGeneration` | 闪卡制作 |
|
|
45
45
|
| `aiJudgement` | 答案评判 |
|
|
46
46
|
| `transcriptionOptimization` | 转录断句优化 |
|
|
47
|
+
| `speechInputRefinement` | 语音输入整理 |
|
|
47
48
|
| `videoSummary` | 视频总结 |
|
|
48
49
|
| `videoEbookRewrite` | 视频电子书重写 |
|
|
49
50
|
| `vibeLearningImageDescription` | 图片理解 |
|
|
@@ -167,3 +168,5 @@ for await (const event of model.stream({
|
|
|
167
168
|
通过 `signal` 取消时,也可能抛出标准的 `AbortError`。
|
|
168
169
|
|
|
169
170
|
遇到额度不足、拒绝授权这类错误后,不要自动循环重试。不要在模块顶层调用 AI;在 `activate` 中也不要等待 AI 请求完成,以免拖慢插件启用。
|
|
171
|
+
|
|
172
|
+
`speechInputRefinement`(SDK 0.43.0 / 桌面 0.59.5)引用应用分配的语音整理模型,不是发起录音的接口。宿主听写整理本身不依赖插件,也不向整理模型授予工具;移动端尚未接入这一 LLM 执行能力。
|
package/docs/api-support.md
CHANGED
|
@@ -35,7 +35,13 @@
|
|
|
35
35
|
| `context.notifications` | 已接 | 未接 | 未接 | 不承诺移动系统通知或后台通知 |
|
|
36
36
|
| `context.sync`、`context.upload` | 领域提供方已接 | 同一注册与配置 API 已接 | 同 Android | 宿主负责流程与选用,插件实现远端存储;账号独立,不做统一共享 |
|
|
37
37
|
| `context.tts`、`context.images`、`context.video`、`context.publish` | 领域提供方已接 | 未接 | 未接 | 本轮不扩大其他业务领域 |
|
|
38
|
-
| `context.backend` | 格式 2 独立后台与授权已接 | 格式 3 不支持 | 格式 3 不支持 | Node
|
|
38
|
+
| `context.backend` | 格式 2 独立后台与授权已接 | 格式 3 不支持 | 格式 3 不支持 | Node、子进程、本机程序使用独立的桌面后台包 |
|
|
39
|
+
|
|
40
|
+
## ASR 与 WebSocket
|
|
41
|
+
|
|
42
|
+
SDK 0.43.0 的 `context.asr`、`context.websocket` 与 `settings target: "asr"` 已接桌面 0.59.5、Android/iOS 0.2.7 宿主源码。移动插件使用同一注册、配置和事件接口,音频由宿主采集,插件不访问麦克风。设备与真实云端账号验收单独记录;Windows 原生识别仍待验证,不影响插件契约。
|
|
43
|
+
|
|
44
|
+
ASR 支持能力探测、可取消的流式会话与可选文件任务;提供方必须真实声明能力,Seed 当前仅流式。WebSocket 的工厂仅扩展鉴权头和 signal,连接保留标准事件、状态、同步 send/close;详见 [WebSocket 契约](websocket.md)。聊天和搜索只在最终结果后写入草稿;桌面可选 AI 整理复用现有模型配置,移动暂使用原文。
|
|
39
45
|
|
|
40
46
|
## 正文、UI 与交互
|
|
41
47
|
|
package/docs/backend.md
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
| `scope` | `application`:整个应用一个后台;`workspace`:每个工作区一个后台 |
|
|
38
38
|
| `activation` | 什么时候启动,见下表 |
|
|
39
39
|
| `lifetime` | `idle`:空闲一段时间后停止,有调用时再启动;`persistent`:一直运行到作用域结束,意外退出时自动重启 |
|
|
40
|
-
| `reason` |
|
|
40
|
+
| `reason` | 向用户说明后台用来做什么,填写非空用途说明,用户授权时会看到它 |
|
|
41
41
|
| `systemAccess` | 后台会用到的系统能力:`filesystem`(文件)、`network`(网络)、`process`(启动程序),用于告知用户和审核 |
|
|
42
42
|
| `tools` | 需要启动外部程序时声明,见[调用外部程序](#调用外部程序) |
|
|
43
43
|
|
|
@@ -135,7 +135,7 @@ const os = await context.backend.call("system.platform", null, { signal });
|
|
|
135
135
|
| `command` | 程序名或绝对路径 |
|
|
136
136
|
| `args` | 可选。固定的前置参数,每次调用都会带上 |
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
声明工具后,在后台中调用:
|
|
139
139
|
|
|
140
140
|
```ts
|
|
141
141
|
const result = await ctx.process.run("git", ["status", "--short"], { signal: request.signal });
|
package/docs/getting-started.md
CHANGED
|
@@ -12,7 +12,7 @@ pnpm install --frozen-lockfile
|
|
|
12
12
|
pnpm build
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
SDK 0.
|
|
15
|
+
SDK 0.43.0 已发布到 npm,直接使用上述冻结安装与构建命令,无需本地 tarball。SDK 发布不代表插件或 APP 已发布;客户端要求以清单和支持矩阵为准。
|
|
16
16
|
|
|
17
17
|
3. 构建生成 `dist/<插件ID>-<版本>.zip`;再次安装可用 `pnpm install --frozen-lockfile`。
|
|
18
18
|
4. 在目标宿主验证后按发布指南上传待审;格式 3 普通提交人工审核,具审核权限的作者本人通过已绑定仓库 CI 发布可自动批准。移动用户从应用内中心安装,首次安装保存启用意图,重开应用生效;桌面 0.59.1 支持格式 3 中心安装,首次安装后需在已安装页启用并重启。install:local 不把格式 3 写进旧桌面正式目录。
|
|
@@ -40,3 +40,7 @@ SDK 0.41.0 已发布到 npm,直接使用上述冻结安装与构建命令,
|
|
|
40
40
|
4. 更新 README,构建后在目标宿主验收启用、保存、停用与恢复。
|
|
41
41
|
|
|
42
42
|
契约见[跨端开发](portability.md),生命周期见[插件组成](plugin-basics.md)。仓库外构建只证明作者闭环,不替代宿主和真机验收。
|
|
43
|
+
|
|
44
|
+
## 开发语音识别插件
|
|
45
|
+
|
|
46
|
+
ASR 与标准 WebSocket 需要 SDK 0.43.0、桌面 0.59.5 或移动 0.2.7。模板已使用 npm 的 SDK 0.43.0;冻结安装、构建后再在目标宿主验证。接口见 [语音识别](providers/asr.md) 与 [WebSocket](websocket.md)。SDK 可安装不代表客户端已经发行,最低客户端版本与平台分发仍由插件清单控制。
|
package/docs/plugin-basics.md
CHANGED
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
| ------------- | ----------------------------------------------------------------------------------------------- |
|
|
38
38
|
| `id` | 插件的唯一标识,由小写字母、数字组成,用点或连字符分段,例如 `yourname.counter`。发布后不要再改 |
|
|
39
39
|
| `name` | 插件名称,显示在插件页和插件中心 |
|
|
40
|
-
| `description` |
|
|
40
|
+
| `description` | 一句话简介,非空文本 |
|
|
41
41
|
| `version` | 插件版本,格式为 `主版本.次版本.修订号`,可带预发布后缀,如 `1.2.0-beta.1` |
|
|
42
42
|
| `targets` | 各平台最低应用版本;填写完整版本号,不写范围。省略平台表示不支持安装 |
|
|
43
43
|
| `categories` | 插件中心的分类,可多选,也可以不写,见下表 |
|
|
44
|
-
| `keywords` |
|
|
44
|
+
| `keywords` | 插件中心的搜索词,用于搜索的文本。例如 S3 插件可以写 `MinIO`、`R2` |
|
|
45
45
|
| `permissions` | 插件可能申请的用户数据权限,见[用户数据 · 权限](user-data.md#权限)和 [AI](ai.md) |
|
|
46
46
|
| `backend` | 需要本机后台时填写,同时把 `formatVersion` 改为 `2`,见[本机后台](backend.md) |
|
|
47
47
|
|