@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.
Files changed (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/client/chunk-UGYIAPAN.js +869 -0
  3. package/docs/README.md +1 -0
  4. package/docs/backend.md +4 -10
  5. package/docs/blog-templates.md +7 -6
  6. package/docs/document-body.md +2 -0
  7. package/docs/getting-started.md +2 -14
  8. package/docs/plugin-basics.md +1 -1
  9. package/docs/portability.md +25 -2
  10. package/docs/skills.md +10 -12
  11. package/docs/task-data.md +338 -0
  12. package/docs/user-data.md +12 -17
  13. package/package.js +1 -1
  14. package/package.json +5 -1
  15. package/portable.js +3 -2
  16. package/publish-artifacts.js +36 -19
  17. package/types/packages/plugins/src/data-changes.d.ts +51 -0
  18. package/types/packages/plugins/src/data.d.ts +112 -7
  19. package/types/packages/plugins/src/errors.d.ts +7 -0
  20. package/types/packages/plugins/src/index.d.ts +1 -1
  21. package/types/packages/plugins/src/package.d.ts +7 -2
  22. package/types/packages/plugins/src/portable.d.ts +5 -2
  23. package/types/packages/plugins/src/skills.d.ts +16 -0
  24. package/types/packages/plugins/src/template.d.ts +101 -0
  25. package/types/packages/plugins/src/unified.d.ts +60 -0
  26. package/types/packages/plugins/src/version.d.ts +5 -0
  27. package/types/packages/shared/src/task-assistant/contracts.d.ts +15 -0
  28. package/types/packages/shared/src/task-assistant/occurrence-state.d.ts +7 -0
  29. package/types/packages/shared/src/task-assistant/schema.d.ts +3 -0
  30. package/types/packages/shared/task-assistant.d.ts +1 -0
  31. package/types/packages/ui/src/hooks/useEdgeFade.d.ts +1 -1
  32. package/types/packages/ui/src/primitives/AnchoredPanel.d.ts +3 -1
  33. package/types/packages/ui/src/primitives/anchoredPosition.d.ts +8 -0
  34. package/unified.js +21 -0
  35. package/client/chunk-6XAEU7BJ.js +0 -330
  36. package/client/chunk-PRE35AOA.js +0 -185
package/docs/user-data.md CHANGED
@@ -139,25 +139,16 @@ const chats = await context.data.chats.query({ updatedAfter: weekAgo });
139
139
 
140
140
  ### 待办与日程
141
141
 
142
+ `context.data.todos` 读取普通待办、重复系列和正文里的勾选项,`context.data.calendar` 读取日程。两者都提供 get 和分页 query;目录、提醒、重复规则、实例状态及备注的完整用法见[待办与日程](task-data.md)。
143
+
142
144
  ```ts
143
145
  const todos = await context.data.todos.query({ completed: false, limit: 20 });
144
- const events = await context.data.calendar.query({ start: "2026-10-19", end: "2026-10-26" });
146
+ const events = await context.data.calendar.query({ start: "2026-12-01", end: "2026-12-07" });
145
147
  ```
146
148
 
147
- `todos.query` 的参数:
148
-
149
- | 参数 | 说明 |
150
- | ----------------- | ----------------------------------------------------------------------------------------------- |
151
- | `view` | `tasks`(默认)返回待办与周期系列;`occurrences` 返回周期待办的每一次,必须同时给 `start`、`end` |
152
- | `source` | `all`(默认)、`todo`(独立的待办)、`document`(正文里的勾选项) |
153
- | `completed` | 按完成状态筛选 |
154
- | `keyword` | 按关键词筛选 |
155
- | `start`、`end` | 按截止日期筛选,格式 `YYYY-MM-DD` |
156
- | `limit`、`cursor` | 分页,每页最多 100 条,默认 50 |
149
+ ### 按游标读取变化
157
150
 
158
- - 来自正文勾选项的待办带有 `source`,指明它在哪篇卡片、文章、项目文档或日记里。用户在 Tau 里把勾选项排除出待办、或提升为独立待办后,它不再作为正文待办返回;对正文待办的修改会回到原文的那一行,不会另建一条独立待办。
159
- - 周期待办用 `view: "occurrences"` 查询时,返回的每一项是某一天的那一次,`id` 固定对应那一天,改期后也不变,不要解析或自己拼接它。对这一次可以标记完成、改期(`dueAt: null` 取消改期)和删除(即跳过这一次),都只影响这一次,不会改动整个系列。标题跟随系列,要改标题用 `view: "tasks"` 返回的系列 ID。周期规则本身由用户在 Tau 中设置,插件不能创建或修改。
160
- - `calendar.query` 的 `start`、`end` 必填,可以是 `YYYY-MM-DD` 或带时区的 ISO 时间,每页最多 100 条。由待办安排出的日程带 `todoId`。
151
+ 需要离线续读或发现删除时,使用 `context.data.changes.query`。处理成功后再保存游标,完整流程和失败处理见[待办与日程 · 按游标读取变化](task-data.md#按游标读取变化)。
161
152
 
162
153
  ## 修改与删除
163
154
 
@@ -185,9 +176,9 @@ try {
185
176
  | `documents.move(id, { projectId, from, to, index }, ...)` | 在同一项目内移动,见[项目目录](#项目目录) |
186
177
  | `whiteboards.create` / `whiteboards.update` | `title`(新建时必填)、`description`、`tags`;新建的白板带一张空白画板页 |
187
178
  | `projects.create` / `projects.update` | 新建:`title`(必填),得到空项目;修改:`title`、`archived`、`pinned` |
188
- | `todos.create` / `todos.update` | `title`、`dueAt`(`YYYY-MM-DD`、带时区的 ISO 时间或 `null`) |
179
+ | `todos.create` / `todos.update` | 标题、截止日期、待办项目与提醒,见[待办与日程](task-data.md#创建带提醒的待办) |
189
180
  | `todos.setCompleted(id, completed, ...)` | 标记完成或未完成 |
190
- | `calendar.create` / `calendar.update` | `title`、`start`、`end`、`allDay`、`calendarId`(省略时为默认日历) |
181
+ | `calendar.create` / `calendar.update` | 时段、日历、提醒与备注,见[安排日程与编辑备注](task-data.md#安排日程与编辑备注) |
191
182
  | `*.delete(id, ...)` | 删除卡片、文章、白板、项目、项目文档、待办、日程,限制见下 |
192
183
 
193
184
  - `content` 是新建时的正文,写法见[正文输入](document-body.md#正文输入);修改已有正文用 [`context.content.edit`](document-body.md#修改)。
@@ -195,11 +186,15 @@ try {
195
186
  - 有截止日期的待办会在日历里显示为一条日程。这类日程只能通过待办接口修改:`calendar.update` 不能改它的标题,也不能把它移到别的日历。
196
187
  - 全天日程的 `start`、`end` 用 `YYYY-MM-DD`,且 `end` 不包含当天:一个只占 10 月 21 日的全天日程,`end` 是 `2026-10-22`。定时日程用带时区的 ISO 时间。
197
188
 
189
+ ### 待办项目、日历与完整字段
190
+
191
+ 待办项目、日历发现、提醒、重复与实例、日程备注以及创建请求重试,见[待办与日程](task-data.md)。
192
+
198
193
  ### 用 revision 避免覆盖别人的修改
199
194
 
200
195
  每一项数据都带有 `revision`。修改和删除时必须把读到的 `revision` 作为 `expectedRevision` 传回。如果这期间用户或其他插件改过这一项,调用会抛出 `PluginConflictError`,而不是悄悄覆盖。遇到冲突时重新读取,再决定是否重试。修改返回的新对象带有新的 `revision`,连续修改时用它。
201
196
 
202
- 修改正文不会改变实体的 `revision`,正文有自己的版本,见[正文](document-body.md#修改)。
197
+ 卡片、文章和项目文档的正文有独立版本,修改正文不改变它们的元数据 revision,见[正文](document-body.md#修改)。日程的聚合 revision 还覆盖备注正文和完整提醒列表;版本只用于比较相等,不能按大小或时间戳选择覆盖哪一方。
203
198
 
204
199
  ### 写入后
205
200
 
package/package.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  isPluginPermission,
13
13
  validateBackendManifest,
14
14
  validatePluginManifest
15
- } from "./client/chunk-6XAEU7BJ.js";
15
+ } from "./client/chunk-UGYIAPAN.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.60.0",
3
+ "version": "0.61.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,6 +26,10 @@
26
26
  "types": "./types/packages/plugins/src/portable.d.ts",
27
27
  "default": "./portable.js"
28
28
  },
29
+ "./unified": {
30
+ "types": "./types/packages/plugins/src/unified.d.ts",
31
+ "default": "./unified.js"
32
+ },
29
33
  "./backend": {
30
34
  "types": "./types/packages/plugins/src/backend.d.ts",
31
35
  "default": "./runtime.js"
package/portable.js CHANGED
@@ -7,12 +7,12 @@ import {
7
7
  MOBILE_SPEECH_PERMISSIONS,
8
8
  PORTABLE_PLATFORMS,
9
9
  PORTABLE_SHARED_MODULES,
10
+ assertMobilePermissions,
10
11
  assertPortablePluginCompatibility,
11
12
  buildPortablePluginManifest,
12
13
  validatePortableDistributionManifest,
13
14
  validatePortablePluginManifest
14
- } from "./client/chunk-PRE35AOA.js";
15
- import "./client/chunk-6XAEU7BJ.js";
15
+ } from "./client/chunk-UGYIAPAN.js";
16
16
  import "./client/chunk-UTVEXGFI.js";
17
17
  export {
18
18
  MOBILE_AI_MIN_VERSION,
@@ -23,6 +23,7 @@ export {
23
23
  MOBILE_SPEECH_PERMISSIONS,
24
24
  PORTABLE_PLATFORMS,
25
25
  PORTABLE_SHARED_MODULES,
26
+ assertMobilePermissions,
26
27
  assertPortablePluginCompatibility,
27
28
  buildPortablePluginManifest,
28
29
  validatePortableDistributionManifest,
@@ -1,11 +1,9 @@
1
- import {
2
- PORTABLE_SHARED_MODULES,
3
- validatePortablePluginManifest
4
- } from "./client/chunk-PRE35AOA.js";
5
1
  import {
6
2
  PLUGIN_SHARED_MODULES,
7
- validatePluginManifest
8
- } from "./client/chunk-6XAEU7BJ.js";
3
+ PORTABLE_SHARED_MODULES,
4
+ isWebPluginManifest,
5
+ readApplicationPluginManifest
6
+ } from "./client/chunk-UGYIAPAN.js";
9
7
  import {
10
8
  __commonJS,
11
9
  __toESM
@@ -5395,7 +5393,7 @@ function useScrollState(el) {
5395
5393
  const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measureOnRaf);
5396
5394
  resizeObserver?.observe(el);
5397
5395
  const mutationObserver = typeof MutationObserver === "undefined" ? null : new MutationObserver(measureOnRaf);
5398
- mutationObserver?.observe(el, { childList: true, subtree: true });
5396
+ mutationObserver?.observe(el, { childList: true, subtree: true, characterData: true });
5399
5397
  return () => {
5400
5398
  cancelAnimationFrame(rafId);
5401
5399
  el.removeEventListener("scroll", measureSync);
@@ -7090,6 +7088,16 @@ var VIEWPORT_PAD = 8;
7090
7088
  var ARROW_MARGIN = 10;
7091
7089
  var ARROW_SIZE = 8;
7092
7090
  var ARROW_TIP_OFFSET = 5;
7091
+ function fitVerticalPreview(anchor, placement, viewportHeight, gap = 8) {
7092
+ if (!placement.startsWith("top") && !placement.startsWith("bottom")) return;
7093
+ const above = anchor.top - VIEWPORT_PAD - gap;
7094
+ const below = viewportHeight - VIEWPORT_PAD - gap - anchor.bottom;
7095
+ const side = above === below ? placement.split("-")[0] : above > below ? "top" : "bottom";
7096
+ return {
7097
+ placement: placement.replace(/^(top|bottom)/, side),
7098
+ maxHeight: Math.max(0, Math.floor(Math.max(above, below)))
7099
+ };
7100
+ }
7093
7101
  function computeAnchoredPosition(anchor, pop, placement, opts) {
7094
7102
  const GAP2 = opts?.gap ?? 8;
7095
7103
  const [side0, align = "center"] = placement.split("-");
@@ -7204,6 +7212,7 @@ function useAnchoredPosition({
7204
7212
  popRef,
7205
7213
  placement,
7206
7214
  gap,
7215
+ fitVerticalSpace = false,
7207
7216
  pollAnchor = false,
7208
7217
  onPlace
7209
7218
  }) {
@@ -7215,13 +7224,16 @@ function useAnchoredPosition({
7215
7224
  if (!open) return;
7216
7225
  const pop = popRef.current;
7217
7226
  if (!pop) return;
7227
+ const originalMaxHeight = pop.style.maxHeight;
7218
7228
  const place = () => {
7219
7229
  const anchor = getAnchorRef.current();
7220
7230
  if (!anchor) return;
7231
+ const fit = fitVerticalSpace && fitVerticalPreview(anchor, placement, window.innerHeight, gap);
7232
+ if (fit) pop.style.maxHeight = `${fit.maxHeight}px`;
7221
7233
  const pos = computeAnchoredPosition(
7222
7234
  anchor,
7223
7235
  pop,
7224
- placement,
7236
+ fit ? fit.placement : placement,
7225
7237
  gap !== void 0 ? { gap } : void 0
7226
7238
  );
7227
7239
  pop.style.left = `${pos.x}px`;
@@ -7230,12 +7242,11 @@ function useAnchoredPosition({
7230
7242
  };
7231
7243
  place();
7232
7244
  place();
7233
- let queued = false;
7245
+ let frame = 0;
7234
7246
  const schedule = () => {
7235
- if (queued) return;
7236
- queued = true;
7237
- requestAnimationFrame(() => {
7238
- queued = false;
7247
+ if (frame) return;
7248
+ frame = requestAnimationFrame(() => {
7249
+ frame = 0;
7239
7250
  place();
7240
7251
  });
7241
7252
  };
@@ -7261,9 +7272,11 @@ function useAnchoredPosition({
7261
7272
  window.removeEventListener("scroll", schedule, true);
7262
7273
  window.removeEventListener("resize", schedule);
7263
7274
  ro?.disconnect();
7275
+ cancelAnimationFrame(frame);
7276
+ if (fitVerticalSpace) pop.style.maxHeight = originalMaxHeight;
7264
7277
  cancelAnimationFrame(raf);
7265
7278
  };
7266
- }, [open, placement, gap, pollAnchor]);
7279
+ }, [open, placement, gap, pollAnchor, fitVerticalSpace]);
7267
7280
  }
7268
7281
 
7269
7282
  // packages/ui/src/primitives/Tooltip.tsx
@@ -7601,6 +7614,7 @@ function MenuSurface({
7601
7614
  "aria-activedescendant": nav.current ?? void 0,
7602
7615
  "data-open": open,
7603
7616
  onKeyDown,
7617
+ onClick: (e2) => e2.stopPropagation(),
7604
7618
  className: cn(
7605
7619
  "bg-surface border-line-1 shadow-float rounded-tau-lg border p-[6px]",
7606
7620
  "fixed left-0 top-0 z-[250] flex w-max min-w-[160px] max-w-[min(320px,calc(100vw-16px))] flex-col overflow-hidden",
@@ -7956,6 +7970,7 @@ var PanelHasHeaderContext = (0, import_react32.createContext)(null);
7956
7970
  function AnchoredPanel({
7957
7971
  anchor,
7958
7972
  placement = "bottom-start",
7973
+ fitVerticalSpace = false,
7959
7974
  open,
7960
7975
  arrow = false,
7961
7976
  className,
@@ -7971,6 +7986,7 @@ function AnchoredPanel({
7971
7986
  getAnchor: () => anchor?.getBoundingClientRect() ?? null,
7972
7987
  popRef,
7973
7988
  placement,
7989
+ fitVerticalSpace,
7974
7990
  onPlace: (pos, pop) => {
7975
7991
  pop.dataset.side = pos.side;
7976
7992
  if (arrow) applyArrowPosition(pos, pop);
@@ -7993,6 +8009,7 @@ function AnchoredPanel({
7993
8009
  !visible && "data-[side=top]:-translate-y-[4px]",
7994
8010
  !visible && "data-[side=left]:-translate-x-[4px]",
7995
8011
  !visible && "data-[side=right]:translate-x-[4px]",
8012
+ fitVerticalSpace && "overflow-y-auto",
7996
8013
  className
7997
8014
  ),
7998
8015
  children: [
@@ -9412,11 +9429,11 @@ function normalizePluginEditorExtension(extension) {
9412
9429
  // packages/plugins/src/rendering.ts
9413
9430
  var PLUGIN_RENDER_VERSION = 1;
9414
9431
  function readPublishedPluginManifest(value) {
9415
- return value?.formatVersion === 3 ? validatePortablePluginManifest(value) : validatePluginManifest(value);
9432
+ return readApplicationPluginManifest(value);
9416
9433
  }
9417
9434
  function evaluatePublishedPluginPackage(artifact, modules) {
9418
9435
  const manifest = readPublishedPluginManifest(artifact.manifest);
9419
- if (manifest.formatVersion !== 3)
9436
+ if (!isWebPluginManifest(manifest))
9420
9437
  return evaluatePluginPackage({ ...artifact, manifest }, modules);
9421
9438
  if (!manifest.targets.desktop) throw new Error("\u535A\u5BA2\u6E32\u67D3\u9700\u8981\u684C\u9762\u76EE\u6807");
9422
9439
  const definition = evaluateModule(manifest, artifact.code, modules, PORTABLE_SHARED_MODULES);
@@ -9428,7 +9445,7 @@ function evaluatePluginPackage(artifact, modules) {
9428
9445
  manifest,
9429
9446
  artifact.code,
9430
9447
  modules,
9431
- manifest.formatVersion === 3 ? PORTABLE_SHARED_MODULES : PLUGIN_SHARED_MODULES
9448
+ isWebPluginManifest(manifest) ? PORTABLE_SHARED_MODULES : PLUGIN_SHARED_MODULES
9432
9449
  );
9433
9450
  }
9434
9451
  function evaluateModule(manifest, code, modules, allowed) {
@@ -9453,9 +9470,9 @@ function evaluateModule(manifest, code, modules, allowed) {
9453
9470
  function validatePluginDefinition(manifest, definition) {
9454
9471
  if (!definition || typeof definition.create !== "function" || definition.id !== manifest.id || definition.name !== manifest.name || definition.version !== manifest.version || definition.apiVersion !== manifest.apiVersion)
9455
9472
  throw new Error("\u63D2\u4EF6\u5165\u53E3\u5B9A\u4E49\u4E0E\u6E05\u5355\u4E0D\u4E00\u81F4");
9456
- if (manifest.formatVersion !== 3 && Boolean(definition.editorExtensions?.length) !== Boolean(manifest.editor))
9473
+ if (manifest.formatVersion === 2 && Boolean(definition.editorExtensions?.length) !== Boolean(manifest.editor))
9457
9474
  throw new Error("\u7F16\u8F91\u5668\u8D21\u732E\u5FC5\u987B\u4E0E manifest.editor \u58F0\u660E\u4E00\u81F4");
9458
- if (manifest.formatVersion !== 3 && Boolean(definition.whiteboardExtensions?.length) !== Boolean(manifest.whiteboard))
9475
+ if (manifest.formatVersion === 2 && Boolean(definition.whiteboardExtensions?.length) !== Boolean(manifest.whiteboard))
9459
9476
  throw new Error("\u767D\u677F\u8D21\u732E\u5FC5\u987B\u4E0E manifest.whiteboard \u58F0\u660E\u4E00\u81F4");
9460
9477
  definition = {
9461
9478
  ...definition,
@@ -0,0 +1,51 @@
1
+ export declare const DATA_CHANGE_DOMAINS: readonly ["todo", "todo-list", "event", "calendar"];
2
+ export type PluginChangeDomain = (typeof DATA_CHANGE_DOMAINS)[number];
3
+ export interface PluginChangesQuery {
4
+ domains: PluginChangeDomain[];
5
+ /** 缺省只读独立待办;all 包含正文待办。 */
6
+ todoSource?: "todo" | "document" | "all";
7
+ cursor?: string;
8
+ limit?: number;
9
+ }
10
+ export interface PluginDataChange {
11
+ domain: PluginChangeDomain;
12
+ id: string;
13
+ operation: "upsert" | "delete";
14
+ }
15
+ export interface PluginChangesPage {
16
+ mode: "snapshot" | "changes";
17
+ items: PluginDataChange[];
18
+ cursor: string;
19
+ hasMore: boolean;
20
+ /** 只在本轮完整结束时提供;插件处理成功后才能保存。 */
21
+ checkpoint?: string;
22
+ }
23
+ /** 宿主数据层原语;每次调用在一个短事务内返回水位与分页结果。 */
24
+ export interface DataChangesReadRequest {
25
+ todoSource?: "todo" | "document" | "all";
26
+ phase: "snapshot" | "changes";
27
+ domains: PluginChangeDomain[];
28
+ afterDomain: string;
29
+ afterKey: number;
30
+ afterSeq: number;
31
+ through?: number;
32
+ limit: number;
33
+ }
34
+ export interface DataChangesReadPage {
35
+ todoSource?: "todo" | "document" | "all";
36
+ scope: string;
37
+ protocol: number;
38
+ head: number;
39
+ floor: number;
40
+ through: number;
41
+ items: (PluginDataChange & {
42
+ key?: number;
43
+ seq?: number;
44
+ })[];
45
+ hasMore: boolean;
46
+ }
47
+ export declare function normalizeChangesQuery(query: PluginChangesQuery): PluginChangesQuery & {
48
+ limit: number;
49
+ };
50
+ /** 两端共用状态机;SQL、连接、清理和本机代次由各自数据层负责。 */
51
+ export declare function queryDataChanges(query: PluginChangesQuery, ownerBinding: string, read: (request: DataChangesReadRequest) => Promise<DataChangesReadPage>): Promise<PluginChangesPage>;
@@ -1,8 +1,11 @@
1
+ import type { PluginChangesQuery, PluginChangesPage } from "./data-changes";
2
+ export type { PluginChangesQuery, PluginChangesPage, PluginDataChange, PluginChangeDomain, } from "./data-changes";
1
3
  /**
2
4
  * 业务数据接口。ID 与 ContentRef 都是不透明字符串:只用于传回宿主,不要解析其格式。
3
5
  * 每次调用前宿主按 manifest.permissions 与用户授权校验,未获准抛出 PluginPermissionError。
4
6
  * 修改与删除要传读到的 revision,数据已被别处修改时抛出 PluginConflictError。
5
7
  */
8
+ import type { TaskRecurrenceRule, TaskRecurrenceSegment, TaskOccurrenceState } from "../../shared/task-assistant";
6
9
  import type { Descendant } from "slate";
7
10
  import type { PluginContentInput } from "./content-input";
8
11
  import type { PluginEntityRef } from "./app";
@@ -223,12 +226,66 @@ export interface PluginEntityWriter<T, Input, Patch> extends PluginEntityReader<
223
226
  update(id: string, patch: Patch, options: PluginWriteOptions): Promise<T>;
224
227
  delete(id: string, options: PluginWriteOptions): Promise<void>;
225
228
  }
229
+ export interface PluginCreateOptions {
230
+ /** 同一插件内稳定的创建请求 ID;重试复用,同 ID 不得更换参数。 */
231
+ requestId?: string;
232
+ }
233
+ export interface PluginDirectoryQuery {
234
+ archived?: boolean;
235
+ limit?: number;
236
+ cursor?: string;
237
+ }
238
+ export interface PluginTodoList {
239
+ id: string;
240
+ revision: string;
241
+ title: string;
242
+ archived: boolean;
243
+ writable: boolean;
244
+ readonlyReason?: string;
245
+ }
246
+ export interface PluginCalendar extends PluginTodoList {
247
+ color: string;
248
+ visible: boolean;
249
+ }
250
+ export interface PluginReminder {
251
+ /** 基准时刻减提醒时刻,单位毫秒;全天日程的基准为当天零点。 */
252
+ offsetMs: number;
253
+ }
254
+ export type PluginTodoReminder = PluginReminder | {
255
+ at: string;
256
+ };
257
+ export interface PluginTodoRecurrenceChange {
258
+ effectiveFrom: string;
259
+ rule: TaskRecurrenceRule | null;
260
+ }
261
+ export interface PluginTodoOccurrencePatch {
262
+ completed?: boolean;
263
+ skipped?: boolean;
264
+ scheduledAt?: string | null;
265
+ }
266
+ export interface PluginTodoOccurrenceQuery {
267
+ taskId: string;
268
+ limit?: number;
269
+ cursor?: string;
270
+ }
271
+ export interface PluginTodoOccurrenceState {
272
+ taskId: string;
273
+ seriesId: string;
274
+ originalDate: string;
275
+ state: TaskOccurrenceState;
276
+ active: boolean;
277
+ }
278
+ export type PluginTodoOccurrencePage = PluginPage<PluginTodoOccurrenceState> & {
279
+ taskRevision: string;
280
+ };
226
281
  export interface PluginTodoQuery {
227
282
  /** tasks 返回系列/普通任务;occurrences 返回原始日期标识的周期实例,须给 start/end。 */
228
283
  view?: "tasks" | "occurrences";
229
284
  /** 缺省为全部:独立待办与正文里的勾选项 */
230
285
  source?: "all" | "todo" | "document";
231
286
  completed?: boolean;
287
+ archived?: boolean;
288
+ listId?: string;
232
289
  keyword?: string;
233
290
  /** YYYY-MM-DD,按截止日期筛选 */
234
291
  start?: string;
@@ -238,6 +295,20 @@ export interface PluginTodoQuery {
238
295
  cursor?: string;
239
296
  }
240
297
  export interface PluginTodo {
298
+ listId: string | null;
299
+ /** null 表示此来源尚未开放提醒列表;空数组才表示没有提醒。 */
300
+ reminders: PluginTodoReminder[] | null;
301
+ recurrence: {
302
+ segments: TaskRecurrenceSegment[];
303
+ } | null;
304
+ occurrence?: {
305
+ taskId: string;
306
+ seriesId: string;
307
+ originalDate: string;
308
+ state: TaskOccurrenceState;
309
+ };
310
+ writable: boolean;
311
+ readonlyReason?: string;
241
312
  id: string;
242
313
  revision: string;
243
314
  title: string;
@@ -253,14 +324,22 @@ export interface PluginTodo {
253
324
  };
254
325
  }
255
326
  export interface PluginCalendarQuery {
256
- /** YYYY-MM-DD 或带时区的 ISO 时间,必填 */
257
- start: string;
258
- end: string;
327
+ /** YYYY-MM-DD 或带时区的 ISO 时间;display 查询必填,stored 可省略。 */
328
+ start?: string;
329
+ end?: string;
330
+ /** display(默认)须给时间窗口;stored 只列真实持久日程,可不提供窗口。 */
331
+ view?: "display" | "stored";
332
+ calendarIds?: string[];
259
333
  /** 1–100,默认 50 */
260
334
  limit?: number;
261
335
  cursor?: string;
262
336
  }
263
337
  export interface PluginCalendarEvent {
338
+ reminders: PluginReminder[];
339
+ notesRef: PluginContentRef | null;
340
+ kind: "event" | "todo-schedule" | "virtual";
341
+ writable: boolean;
342
+ readonlyReason?: string;
264
343
  id: string;
265
344
  revision: string;
266
345
  title: string;
@@ -272,15 +351,22 @@ export interface PluginCalendarEvent {
272
351
  todoId?: string;
273
352
  }
274
353
  export interface PluginTodoInput {
354
+ recurrence?: TaskRecurrenceRule;
355
+ listId?: string;
356
+ reminders?: PluginTodoReminder[];
275
357
  title: string;
276
358
  /** YYYY-MM-DD 或带时区的 ISO 时间 */
277
359
  dueAt?: string | null;
278
360
  }
279
361
  export interface PluginTodoPatch {
362
+ listId?: string;
363
+ reminders?: PluginTodoReminder[];
280
364
  title?: string;
281
365
  dueAt?: string | null;
282
366
  }
283
367
  export interface PluginCalendarInput {
368
+ notes?: PluginContentInput;
369
+ reminders?: PluginReminder[];
284
370
  title: string;
285
371
  /** 全天日程用 YYYY-MM-DD,结束日期不含当天(当天全天的 end 为次日);定时日程用带时区的 ISO 时间 */
286
372
  start: string;
@@ -289,8 +375,11 @@ export interface PluginCalendarInput {
289
375
  /** 缺省为默认日历 */
290
376
  calendarId?: string;
291
377
  }
292
- export type PluginCalendarPatch = Partial<PluginCalendarInput>;
378
+ export type PluginCalendarPatch = Partial<Omit<PluginCalendarInput, "notes">>;
293
379
  export interface PluginData {
380
+ readonly changes: {
381
+ query(query: PluginChangesQuery): Promise<PluginChangesPage>;
382
+ };
294
383
  readonly cards: PluginEntityWriter<PluginCard, PluginCardInput, PluginCardPatch>;
295
384
  readonly articles: PluginEntityWriter<PluginArticle, PluginArticleInput, PluginArticlePatch>;
296
385
  /** 白板的信息;画板内容不开放读写,用户在 Tau 中编辑 */
@@ -328,17 +417,34 @@ export interface PluginData {
328
417
  readonly materials: PluginEntityReader<PluginMaterial>;
329
418
  /** AI 对话的信息,不含消息内容;query 不支持 tag */
330
419
  readonly chats: PluginEntityReader<PluginChatSession>;
420
+ readonly todoLists: {
421
+ get(id: string): Promise<PluginTodoList | null>;
422
+ query(query?: PluginDirectoryQuery): Promise<PluginPage<PluginTodoList>>;
423
+ };
424
+ readonly calendars: {
425
+ get(id: string): Promise<PluginCalendar | null>;
426
+ query(query?: PluginDirectoryQuery): Promise<PluginPage<PluginCalendar>>;
427
+ };
331
428
  readonly todos: {
429
+ setRecurrence(id: string, change: PluginTodoRecurrenceChange, options: PluginWriteOptions): Promise<PluginTodo>;
430
+ setOccurrenceState(id: string, patch: PluginTodoOccurrencePatch, options: PluginWriteOptions): Promise<PluginTodo>;
431
+ readonly occurrenceStates: {
432
+ query(query: PluginTodoOccurrenceQuery): Promise<PluginTodoOccurrencePage>;
433
+ };
434
+ get(id: string): Promise<PluginTodo | null>;
332
435
  query(query?: PluginTodoQuery): Promise<PluginPage<PluginTodo>>;
333
- create(input: PluginTodoInput): Promise<PluginTodo>;
436
+ create(input: PluginTodoInput, options?: PluginCreateOptions): Promise<PluginTodo>;
334
437
  update(id: string, patch: PluginTodoPatch, options: PluginWriteOptions): Promise<PluginTodo>;
335
438
  setCompleted(id: string, completed: boolean, options: PluginWriteOptions): Promise<PluginTodo>;
336
439
  /** 有子待办时拒绝删除 */
337
440
  delete(id: string, options: PluginWriteOptions): Promise<void>;
338
441
  };
339
442
  readonly calendar: {
443
+ /** 为尚无备注的日程建立空正文;已有备注保持原样。 */
444
+ ensureNotes(id: string, options: PluginWriteOptions): Promise<PluginCalendarEvent>;
445
+ get(id: string): Promise<PluginCalendarEvent | null>;
340
446
  query(query: PluginCalendarQuery): Promise<PluginPage<PluginCalendarEvent>>;
341
- create(input: PluginCalendarInput): Promise<PluginCalendarEvent>;
447
+ create(input: PluginCalendarInput, options?: PluginCreateOptions): Promise<PluginCalendarEvent>;
342
448
  update(id: string, patch: PluginCalendarPatch, options: PluginWriteOptions): Promise<PluginCalendarEvent>;
343
449
  delete(id: string, options: PluginWriteOptions): Promise<void>;
344
450
  };
@@ -391,4 +497,3 @@ export interface PluginContent {
391
497
  revision: string;
392
498
  }>;
393
499
  }
394
- export {};
@@ -3,3 +3,10 @@ export declare class PluginConflictError extends Error {
3
3
  readonly name = "PluginConflictError";
4
4
  constructor(message?: string);
5
5
  }
6
+ export type PluginSyncResetReason = "invalid-cursor" | "query-changed" | "scope-changed" | "history-expired" | "history-replaced" | "protocol-changed";
7
+ /** 游标不再覆盖当前数据范围;保留映射并重新全量,不能将失败当作空结果。 */
8
+ export declare class PluginSyncResetRequiredError extends Error {
9
+ readonly reason: PluginSyncResetReason;
10
+ readonly name = "PluginSyncResetRequiredError";
11
+ constructor(reason: PluginSyncResetReason);
12
+ }
@@ -43,7 +43,7 @@ export type * from "./records";
43
43
  export type * from "./links";
44
44
  export type * from "./transaction";
45
45
  export type { PluginFieldCondition, PluginIndexes, PluginIndexType, PluginIndexValue, PluginOrderBy, PluginWhere, } from "./query";
46
- export { PluginConflictError } from "./errors";
46
+ export { PluginConflictError, PluginSyncResetRequiredError, type PluginSyncResetReason, } from "./errors";
47
47
  export { PLUGIN_ENTITY_KINDS, PLUGIN_ENTITY_READ_PERMISSIONS, PLUGIN_APP_ACTIONS, PLUGIN_EXPORT_FORMATS, PLUGIN_NOTEBOOK_FROM_KINDS, PLUGIN_CHAT_CONTEXT_KINDS, } from "./app";
48
48
  export type { PluginNotifications, PluginNotificationOptions, PluginNotificationMode, PluginNotificationAction, } from "./notifications";
49
49
  export type { PluginSpeech, PluginSpeechSession, PluginSpeechStartOptions } from "./speech";
@@ -8,7 +8,7 @@ export { PLUGIN_CATEGORIES, isPluginCategory, type PluginCategory } from "./cate
8
8
  export { PLUGIN_PERMISSIONS, isPluginPermission, type PluginPermission } from "./permissions";
9
9
  export { PLUGIN_AI_CAPABILITIES, isPluginAICapability } from "./ai";
10
10
  export declare const PLUGIN_SHARED_MODULES: readonly ["@tau/plugins", "@tau/plugins/whiteboard", "@tau/plugins/sync", "@tau/ui", "react", "react-dom", "react-dom/client", "react/jsx-runtime", "react/jsx-dev-runtime"];
11
- export interface PluginManifest {
11
+ export interface LegacyPluginManifest {
12
12
  formatVersion: 2;
13
13
  id: string;
14
14
  name: string;
@@ -33,6 +33,7 @@ export interface PluginManifest {
33
33
  skills?: readonly string[];
34
34
  integrity: Record<string, string>;
35
35
  }
36
+ export type PluginManifest = LegacyPluginManifest | import("./unified").UnifiedDesktopPluginManifest;
36
37
  /** 宿主内部传输的已读取产物,不属于作者运行时 API。 */
37
38
  export interface DevelopmentPluginPackage {
38
39
  manifest: PluginManifest | import("./portable").PortablePluginManifest;
@@ -42,4 +43,8 @@ export interface DevelopmentPluginPackage {
42
43
  /** 按实际使用的包字段解析身份、权限、入口和摘要。 */
43
44
  export declare function validatePluginManifest(value: unknown): PluginManifest;
44
45
  /** 静态内容贡献在启动时固定,启停与更新需要重启。 */
45
- export declare const isContentPlugin: (manifest: Pick<PluginManifest, "editor" | "whiteboard">) => boolean;
46
+ export declare const isContentPlugin: (manifest: {
47
+ id: string;
48
+ editor?: true;
49
+ whiteboard?: true;
50
+ }) => boolean;
@@ -1,4 +1,5 @@
1
- import { type PluginManifest } from "./package";
1
+ import { type PluginManifest, type LegacyPluginManifest } from "./package";
2
+ import { type UnifiedWebPluginManifest } from "./unified";
2
3
  import type { PluginEnvironment } from "./environment";
3
4
  import { type PackagePlatform, type PackageTarget } from "./package-targets";
4
5
  export declare const MOBILE_DATA_MIN_VERSION = "0.2.13";
@@ -8,17 +9,19 @@ export declare const MOBILE_DATA_PERMISSIONS: readonly ["cards:read", "cards:wri
8
9
  /** 语音输入与首页面板随同一客户端版本开放 */
9
10
  export declare const MOBILE_SPEECH_MIN_VERSION = "0.2.16";
10
11
  export declare const MOBILE_SPEECH_PERMISSIONS: readonly ["speech:input"];
12
+ export declare function assertMobilePermissions(manifest: Pick<PortablePluginManifest, "permissions" | "targets">): void;
11
13
  export declare const PORTABLE_PLATFORMS: readonly ["desktop", "android", "ios"];
12
14
  export type PortablePlatform = PackagePlatform;
13
15
  export declare const PORTABLE_SHARED_MODULES: readonly ["@tau/plugins", "@tau/plugins/whiteboard", "@tau/ui", "react", "react-dom", "react-dom/client", "react/jsx-runtime", "react/jsx-dev-runtime"];
14
16
  export type PortablePluginTarget = PackageTarget;
15
- export interface PortablePluginManifest extends Omit<PluginManifest, "formatVersion" | "platform" | "backend" | "minAppVersion" | "editor" | "whiteboard"> {
17
+ export interface LegacyPortablePluginManifest extends Omit<LegacyPluginManifest, "formatVersion" | "platform" | "backend" | "minAppVersion" | "editor" | "whiteboard"> {
16
18
  readonly formatVersion: 3;
17
19
  readonly platform: "portable";
18
20
  readonly profile: "web-v1";
19
21
  readonly description?: string;
20
22
  readonly targets: Readonly<Partial<Record<PortablePlatform, PortablePluginTarget>>>;
21
23
  }
24
+ export type PortablePluginManifest = LegacyPortablePluginManifest | UnifiedWebPluginManifest;
22
25
  export interface PluginAuthorManifest extends Pick<PluginManifest, "id" | "name" | "version" | "categories" | "keywords" | "permissions"> {
23
26
  readonly description?: string;
24
27
  readonly targets: Readonly<Partial<Record<PortablePlatform, PortablePluginTarget>>>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 包内 Skill:`skills/<id>/` 是一份标准 Agent Skills 目录(SKILL.md + 附件 + scripts/),
3
+ * manifest 的 `skills` 列出目录 ID,目录内全部文件进入 integrity。名称、描述与调用方式
4
+ * 取自 SKILL.md 的 front matter,manifest 不重复声明。
5
+ */
6
+ export declare const SKILL_ROOT = "skills";
7
+ export declare const SKILL_README = "SKILL.md";
8
+ /** 读取 manifest.skills;缺省返回 undefined,空数组视为未声明。 */
9
+ export declare function readSkillsField(value: unknown): readonly string[] | undefined;
10
+ /** 校验 integrity 中的 Skill 文件:都落在已声明目录内,且每个目录都有 SKILL.md。 */
11
+ export declare function readSkillFiles(skills: readonly string[] | undefined, integrity: Record<string, unknown>): Record<string, string>;
12
+ /** 包内 Skill 是否带可执行脚本;带脚本的版本与本机后台一样需要人工审核。 */
13
+ export declare function hasSkillScripts(manifest: {
14
+ skills?: readonly string[];
15
+ integrity: Record<string, string>;
16
+ }): boolean;