@xiongtao.xt/tau-plugins 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# 更新记录
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
- 新增独立 `usePluginServices()`,由插件渲染运行时提供已有编译与转换服务;博客及无服务的宿主返回 undefined。
|
|
6
|
+
- 服务按当前窗口和工作区绑定取消与失效保护,静态编辑器组件无需调用 activate;原有 context.services 保持不变。
|
|
7
|
+
- 不修改 useSourceBlock、EditorKit、文档节点协议或编译接口;保留 TTS、上传、聊天工具展示及 TikZ 服务删除边界。
|
|
8
|
+
|
|
3
9
|
## 0.15.0
|
|
4
10
|
|
|
5
11
|
- 新增 `context.chat.registerToolRenderer`,按本插件 MCP ID 与原始工具名异步登记 React 工具渲染器,激活成功后发布,停用、重载或切库时回收。
|
package/SERVICES.md
CHANGED
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
| `ffmpeg.probe(file, options?)` | `{ name, data: Blob }` | `{ format, streams }` |
|
|
17
17
|
| `ffmpeg.run(input, options?)` | `{ files, args, outputs }` | `{ files, log }` |
|
|
18
18
|
|
|
19
|
+
## 在静态组件中获取服务
|
|
20
|
+
|
|
21
|
+
SDK 0.16.0 的 `usePluginServices()` 返回当前插件可用的同一组服务,类型为 `PluginServices | undefined`。服务由插件运行时提供,独立编辑窗口无需 activate;博客和未包裹的普通组件返回 undefined,组件应显示已保存结果或源码。它不属于源码块或 EditorKit,不要将服务存入模块全局变量。
|
|
22
|
+
|
|
23
|
+
组件需用自己的 AbortSignal 取消过期或卸载的调用,宿主同时处理窗口与工作区失效。内容插件的启停按现有重启生效规则处理;写入启停意图不会提前拆掉当前窗口已生效的贡献。
|
|
24
|
+
|
|
19
25
|
## 取消与错误
|
|
20
26
|
|
|
21
27
|
第二个参数均支持 `{ signal: AbortSignal }`。插件停用会自动取消本实例的任务,不必重复传入 `context.signal`。用户主动取消可使用单次任务的 `AbortController`。
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ export type { SourceBlockEditorProps, PluginRuntimeStyleCompiler } from "./sourc
|
|
|
9
9
|
export * from "./sidebar";
|
|
10
10
|
export type * from "./excerpts";
|
|
11
11
|
export type * from "./services";
|
|
12
|
+
export { usePluginServices } from "./service-access";
|
|
12
13
|
export type { PluginSkill } from "./skills";
|
|
13
14
|
export type { PluginMCP, PluginMCPDefinition, PluginMCPTool, PluginMCPTransport } from "./mcp";
|
|
14
15
|
export type { PluginMCPToolResult } from "./mcp";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginServices } from "./services";
|
|
2
|
+
declare let useServices: () => PluginServices | undefined;
|
|
3
|
+
/** 宿主绑定 React 上下文,作者只消费 usePluginServices。 */
|
|
4
|
+
export declare function configurePluginServiceAccess(read: typeof useServices): void;
|
|
5
|
+
/** 当前插件渲染作用域的服务;博客和无界面宿主不提供服务。 */
|
|
6
|
+
export declare function usePluginServices(): PluginServices | undefined;
|
|
7
|
+
export {};
|