@xiongtao.xt/tau-plugins 0.60.0 → 0.61.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 +12 -0
- package/client/chunk-UGYIAPAN.js +869 -0
- package/docs/README.md +1 -0
- package/docs/backend.md +4 -10
- package/docs/blog-templates.md +7 -6
- package/docs/document-body.md +2 -0
- package/docs/getting-started.md +2 -14
- package/docs/plugin-basics.md +1 -1
- package/docs/portability.md +25 -2
- package/docs/skills.md +10 -12
- package/docs/task-data.md +338 -0
- package/docs/user-data.md +12 -17
- package/package.js +1 -1
- package/package.json +5 -1
- package/portable.js +3 -2
- package/publish-artifacts.js +36 -19
- package/types/packages/plugins/src/data-changes.d.ts +51 -0
- package/types/packages/plugins/src/data.d.ts +112 -7
- package/types/packages/plugins/src/errors.d.ts +7 -0
- package/types/packages/plugins/src/index.d.ts +1 -1
- package/types/packages/plugins/src/package.d.ts +7 -2
- package/types/packages/plugins/src/portable.d.ts +5 -2
- package/types/packages/plugins/src/skills.d.ts +16 -0
- package/types/packages/plugins/src/template.d.ts +101 -0
- package/types/packages/plugins/src/unified.d.ts +60 -0
- package/types/packages/plugins/src/version.d.ts +5 -0
- package/types/packages/shared/src/task-assistant/contracts.d.ts +15 -0
- package/types/packages/shared/src/task-assistant/occurrence-state.d.ts +7 -0
- package/types/packages/shared/src/task-assistant/schema.d.ts +3 -0
- package/types/packages/shared/task-assistant.d.ts +1 -0
- package/types/packages/ui/src/hooks/useEdgeFade.d.ts +1 -1
- package/types/packages/ui/src/primitives/AnchoredPanel.d.ts +3 -1
- package/types/packages/ui/src/primitives/anchoredPosition.d.ts +8 -0
- package/unified.js +21 -0
- package/client/chunk-6XAEU7BJ.js +0 -330
- package/client/chunk-PRE35AOA.js +0 -185
package/client/chunk-PRE35AOA.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PLUGIN_AI_CAPABILITIES,
|
|
3
|
-
comparePluginVersions,
|
|
4
|
-
readPluginFilePath,
|
|
5
|
-
readPluginFiles,
|
|
6
|
-
readPluginMetadata
|
|
7
|
-
} from "./chunk-6XAEU7BJ.js";
|
|
8
|
-
|
|
9
|
-
// packages/plugins/src/package-targets.ts
|
|
10
|
-
var PACKAGE_PLATFORMS = ["desktop", "android", "ios"];
|
|
11
|
-
function readPackageTargets(value) {
|
|
12
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
13
|
-
throw new Error("\u76EE\u6807\u5E73\u53F0\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
14
|
-
const targets = {};
|
|
15
|
-
for (const platform of PACKAGE_PLATFORMS) {
|
|
16
|
-
if (!Object.hasOwn(value, platform)) continue;
|
|
17
|
-
const target = value[platform];
|
|
18
|
-
if (!target || typeof target !== "object" || Array.isArray(target) || typeof target.minAppVersion !== "string")
|
|
19
|
-
throw new Error("\u5E73\u53F0\u7F3A\u5C11\u6700\u4F4E\u5BA2\u6237\u7AEF\u7248\u672C");
|
|
20
|
-
const minimum = target.minAppVersion;
|
|
21
|
-
comparePluginVersions(minimum, minimum);
|
|
22
|
-
targets[platform] = Object.freeze({ minAppVersion: minimum });
|
|
23
|
-
}
|
|
24
|
-
if (!Object.keys(targets).length) throw new Error("\u9700\u8981\u81F3\u5C11\u4E00\u4E2A\u652F\u6301\u7684\u76EE\u6807\u5E73\u53F0");
|
|
25
|
-
return Object.freeze(targets);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// packages/plugins/src/portable.ts
|
|
29
|
-
var MOBILE_DATA_MIN_VERSION = "0.2.13";
|
|
30
|
-
var MOBILE_AI_MIN_VERSION = "0.2.13";
|
|
31
|
-
var MOBILE_AI_PERMISSIONS = Object.freeze(
|
|
32
|
-
Object.keys(PLUGIN_AI_CAPABILITIES).map(
|
|
33
|
-
(capability) => `ai:${capability}`
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
var MOBILE_DATA_PERMISSIONS = [
|
|
37
|
-
"cards:read",
|
|
38
|
-
"cards:write",
|
|
39
|
-
"cards:delete",
|
|
40
|
-
"articles:read",
|
|
41
|
-
"articles:write",
|
|
42
|
-
"articles:delete",
|
|
43
|
-
"projects:read",
|
|
44
|
-
"projects:write",
|
|
45
|
-
"projects:delete",
|
|
46
|
-
"documents:read",
|
|
47
|
-
"documents:write",
|
|
48
|
-
"documents:delete",
|
|
49
|
-
"todos:read",
|
|
50
|
-
"todos:write",
|
|
51
|
-
"todos:delete",
|
|
52
|
-
"calendar:read",
|
|
53
|
-
"calendar:write",
|
|
54
|
-
"calendar:delete",
|
|
55
|
-
"flashcards:read",
|
|
56
|
-
"flashcards:write"
|
|
57
|
-
];
|
|
58
|
-
var MOBILE_SPEECH_MIN_VERSION = "0.2.16";
|
|
59
|
-
var MOBILE_SPEECH_PERMISSIONS = ["speech:input"];
|
|
60
|
-
function assertMobilePermissions(manifest) {
|
|
61
|
-
if (!manifest.permissions?.length) return;
|
|
62
|
-
for (const platform of ["android", "ios"]) {
|
|
63
|
-
const target = manifest.targets[platform];
|
|
64
|
-
if (!target) continue;
|
|
65
|
-
if (manifest.permissions.some(
|
|
66
|
-
(permission) => !MOBILE_DATA_PERMISSIONS.includes(permission) && !MOBILE_AI_PERMISSIONS.includes(permission) && !MOBILE_SPEECH_PERMISSIONS.includes(permission)
|
|
67
|
-
))
|
|
68
|
-
throw new Error("\u79FB\u52A8\u7AEF\u5C1A\u672A\u5F00\u653E\u6B64\u4E1A\u52A1\u6743\u9650");
|
|
69
|
-
if (manifest.permissions.some(
|
|
70
|
-
(permission) => MOBILE_DATA_PERMISSIONS.includes(permission)
|
|
71
|
-
) && comparePluginVersions(target.minAppVersion, MOBILE_DATA_MIN_VERSION) < 0)
|
|
72
|
-
throw new Error(`\u79FB\u52A8\u7AEF\u4E1A\u52A1\u6570\u636E\u6388\u6743\u8981\u6C42\u6700\u4F4E\u5BA2\u6237\u7AEF\u7248\u672C ${MOBILE_DATA_MIN_VERSION}`);
|
|
73
|
-
if (manifest.permissions.some(
|
|
74
|
-
(permission) => MOBILE_AI_PERMISSIONS.includes(permission)
|
|
75
|
-
) && comparePluginVersions(target.minAppVersion, MOBILE_AI_MIN_VERSION) < 0)
|
|
76
|
-
throw new Error(`\u79FB\u52A8\u7AEF AI \u6388\u6743\u8981\u6C42\u6700\u4F4E\u5BA2\u6237\u7AEF\u7248\u672C ${MOBILE_AI_MIN_VERSION}`);
|
|
77
|
-
if (manifest.permissions.some(
|
|
78
|
-
(permission) => MOBILE_SPEECH_PERMISSIONS.includes(permission)
|
|
79
|
-
) && comparePluginVersions(target.minAppVersion, MOBILE_SPEECH_MIN_VERSION) < 0)
|
|
80
|
-
throw new Error(`\u79FB\u52A8\u7AEF\u8BED\u97F3\u8F93\u5165\u6388\u6743\u8981\u6C42\u6700\u4F4E\u5BA2\u6237\u7AEF\u7248\u672C ${MOBILE_SPEECH_MIN_VERSION}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
var PORTABLE_PLATFORMS = PACKAGE_PLATFORMS;
|
|
84
|
-
var PORTABLE_SHARED_MODULES = [
|
|
85
|
-
"@tau/plugins",
|
|
86
|
-
"@tau/plugins/whiteboard",
|
|
87
|
-
"@tau/ui",
|
|
88
|
-
"react",
|
|
89
|
-
"react-dom",
|
|
90
|
-
"react-dom/client",
|
|
91
|
-
"react/jsx-runtime",
|
|
92
|
-
"react/jsx-dev-runtime"
|
|
93
|
-
];
|
|
94
|
-
function buildPortablePluginManifest(value, output) {
|
|
95
|
-
const item = record(value, "\u4F5C\u8005\u6E05\u5355");
|
|
96
|
-
const files = record(output, "\u6784\u5EFA\u6587\u4EF6\u4FE1\u606F");
|
|
97
|
-
return validatePortableDistributionManifest({
|
|
98
|
-
id: item.id,
|
|
99
|
-
name: item.name,
|
|
100
|
-
version: item.version,
|
|
101
|
-
description: item.description,
|
|
102
|
-
categories: item.categories,
|
|
103
|
-
keywords: item.keywords,
|
|
104
|
-
permissions: item.permissions,
|
|
105
|
-
formatVersion: 3,
|
|
106
|
-
apiVersion: 1,
|
|
107
|
-
platform: "portable",
|
|
108
|
-
profile: "web-v1",
|
|
109
|
-
format: "cjs",
|
|
110
|
-
main: files.main,
|
|
111
|
-
styles: files.styles,
|
|
112
|
-
skills: files.skills,
|
|
113
|
-
integrity: files.integrity,
|
|
114
|
-
targets: item.targets
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
function record(value, label) {
|
|
118
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
119
|
-
throw new Error(`${label}\u5FC5\u987B\u662F\u5BF9\u8C61`);
|
|
120
|
-
return value;
|
|
121
|
-
}
|
|
122
|
-
function validatePortableDistributionManifest(value) {
|
|
123
|
-
const manifest = validatePortablePluginManifest(value);
|
|
124
|
-
assertMobilePermissions(manifest);
|
|
125
|
-
return manifest;
|
|
126
|
-
}
|
|
127
|
-
function validatePortablePluginManifest(value) {
|
|
128
|
-
const item = record(value, "\u8DE8\u7AEF\u6E05\u5355");
|
|
129
|
-
if (item.formatVersion !== 3 || item.platform !== "portable" || item.profile !== "web-v1")
|
|
130
|
-
throw new Error("\u8DE8\u7AEF\u5305\u683C\u5F0F\u6216\u8FD0\u884C\u914D\u7F6E\u4E0D\u517C\u5BB9");
|
|
131
|
-
if (item.apiVersion !== 1 || item.format !== "cjs") throw new Error("\u63D2\u4EF6 API \u6216\u5165\u53E3\u683C\u5F0F\u4E0D\u517C\u5BB9");
|
|
132
|
-
const metadata = readPluginMetadata(item);
|
|
133
|
-
const main = readPluginFilePath(item.main, ".js");
|
|
134
|
-
const styles = item.styles === void 0 ? void 0 : readPluginFilePath(item.styles, ".css");
|
|
135
|
-
const files = readPluginFiles(item, [main, ...styles ? [styles] : []]);
|
|
136
|
-
const targets = readPackageTargets(item.targets);
|
|
137
|
-
const declaredFiles = item.integrity;
|
|
138
|
-
if (Object.keys(declaredFiles).some((file) => !Object.hasOwn(files.integrity, file)))
|
|
139
|
-
throw new Error("\u8DE8\u7AEF\u5305\u5305\u542B\u672A\u58F0\u660E\u6587\u4EF6");
|
|
140
|
-
for (const file of Object.keys(files.integrity)) {
|
|
141
|
-
if (file === main || file === styles) continue;
|
|
142
|
-
if (!file.endsWith(".md") || file.split("/").includes("scripts") || file.includes("\\"))
|
|
143
|
-
throw new Error("\u8DE8\u7AEF Skill \u4EC5\u652F\u6301\u7EAF Markdown \u6587\u6863\uFF0C\u4E0D\u652F\u6301\u811A\u672C\u6216\u9644\u4EF6");
|
|
144
|
-
}
|
|
145
|
-
return Object.freeze({
|
|
146
|
-
...metadata,
|
|
147
|
-
apiVersion: 1,
|
|
148
|
-
format: "cjs",
|
|
149
|
-
main,
|
|
150
|
-
...styles ? { styles } : {},
|
|
151
|
-
...files,
|
|
152
|
-
formatVersion: 3,
|
|
153
|
-
platform: "portable",
|
|
154
|
-
profile: "web-v1",
|
|
155
|
-
...typeof item.description === "string" ? { description: item.description } : {},
|
|
156
|
-
targets: Object.freeze(targets)
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
function assertPortablePluginCompatibility(manifest, host) {
|
|
160
|
-
if (!host.profiles.includes(manifest.profile)) throw new Error("\u5BBF\u4E3B\u672A\u63A5\u5165\u8DE8\u7AEF\u8FD0\u884C\u914D\u7F6E");
|
|
161
|
-
const platform = host.environment.platform;
|
|
162
|
-
if (!PORTABLE_PLATFORMS.some((value) => value === platform))
|
|
163
|
-
throw new Error("\u5F53\u524D\u5E73\u53F0\u4E0D\u80FD\u6FC0\u6D3B\u8DE8\u7AEF\u5E94\u7528\u63D2\u4EF6");
|
|
164
|
-
const target = manifest.targets[platform];
|
|
165
|
-
if (!target) throw new Error("\u63D2\u4EF6\u4E0D\u652F\u6301\u5F53\u524D\u5E73\u53F0");
|
|
166
|
-
if (platform === "android" || platform === "ios") assertMobilePermissions(manifest);
|
|
167
|
-
if (comparePluginVersions(host.appVersion, target.minAppVersion) < 0)
|
|
168
|
-
throw new Error("\u5BA2\u6237\u7AEF\u7248\u672C\u4F4E\u4E8E\u63D2\u4EF6\u8981\u6C42");
|
|
169
|
-
return target;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export {
|
|
173
|
-
MOBILE_DATA_MIN_VERSION,
|
|
174
|
-
MOBILE_AI_MIN_VERSION,
|
|
175
|
-
MOBILE_AI_PERMISSIONS,
|
|
176
|
-
MOBILE_DATA_PERMISSIONS,
|
|
177
|
-
MOBILE_SPEECH_MIN_VERSION,
|
|
178
|
-
MOBILE_SPEECH_PERMISSIONS,
|
|
179
|
-
PORTABLE_PLATFORMS,
|
|
180
|
-
PORTABLE_SHARED_MODULES,
|
|
181
|
-
buildPortablePluginManifest,
|
|
182
|
-
validatePortableDistributionManifest,
|
|
183
|
-
validatePortablePluginManifest,
|
|
184
|
-
assertPortablePluginCompatibility
|
|
185
|
-
};
|