mirror of
https://github.com/Darkatse/TauriTavern.git
synced 2026-10-19 15:45:12 +00:00
| .. | ||
| Agent.md | ||
| Chat.md | ||
| ChatSurface.md | ||
| Dev.md | ||
| Extension.md | ||
| Layout.md | ||
| LlmConnections.md | ||
| MCP.md | ||
| Migration.md | ||
| README.md | ||
| Skill.md | ||
| WorldInfo.md | ||
TauriTavern Extension APIs
TauriTavern 专属扩展 API 的统一入口是 window.__TAURITAVERN__.api。
这套 API 的目标不是把上游内部实现直接摊给扩展,而是把真正值得长期承诺的平台能力,整理成小而稳定的宿主 ABI。
入口
await (window.__TAURITAVERN__?.ready ?? window.__TAURITAVERN_MAIN_READY__);
const host = window.__TAURITAVERN__;
const api = host?.api;
API 分区
api.chat- 面向记忆类 / 数据库 / 检索类扩展。
- 提供跨窗口聊天访问、全文检索、per-chat store、metadata、历史分页等能力。
api.layout- 面向移动端 UI/面板/悬浮窗/iframe 等需要对齐 safe-area/viewport/IME 的扩展。
- 提供布局契约快照与订阅,并配合
data-tt-mobile-surfacetaxonomy 实现少量 opt-in 即稳定适配。
api.dev- 面向调试、诊断与开发工具。
- 提供前端日志、后端日志、LLM API 日志的统一宿主入口。
api.worldInfo- 面向角色卡作者与世界书相关扩展。
- 提供最近一次激活结果、实时订阅与 best-effort 条目跳转。
api.extension.store- 面向需要全局持久化的扩展(不绑定 chat)。
- 提供 Extension KV JSON + Blob 存储,支持多 table。
api.agent(已落地 canonical model IR、provider_state continuation、上下文只读工具、workspace 读改工具循环与 run history listing)- 面向 Agent Run / timeline / workspace / checkpoint / commit。
- 当前提供启动 run、列出历史 run、订阅/读取事件、取消、读取 workspace 文件、prepare/finalize/commit;模型侧内建 chat search/read、world info read、skill list/read 与 workspace list/read/write/patch/finish 工具由 Rust runtime 注册。
- approval、readDiff、rollback 仍是后续工作;当前入口显式 throw。
api.llmConnections- 面向 Agent Profile / 扩展侧的 LLM 连接定义管理。
- 当前提供 list、load、save、delete;Profile 通过
connectionRef + modelId引用连接,不直接依赖 Connection Manager 的 Model Target id。
api.skill(已落地)- 面向本地 Agent Skill 管理。
- 当前提供 scope-aware 的 list、previewImport、installImport、readFile、writeFile、move、export、delete;Agent run 内只能通过
skill.list/skill.search/skill.read工具消费已安装 Skill。
api.mcp- 面向 MCP registration、persistent tool catalog 与第一方 Manager user test call 的独立平台能力。
- 当前提供 Active/Paused、Off/Ask/Allow、显式 refresh、完整分页、diagnostics 与 typed one-shot call outcome,并支持 Agent/Legacy 模型工具调用。
文档
| 文档 | 内容 |
|---|---|
| Chat.md | api.chat 完整参考 |
| Layout.md | api.layout 完整参考(safe-area/viewport/IME) |
| Dev.md | api.dev 完整参考 |
| WorldInfo.md | api.worldInfo 完整参考 |
| ExtensionStore.md | api.extension.store 完整参考 |
| Agent.md | api.agent 当前参考(Agent Run / workspace / timeline) |
| LlmConnections.md | api.llmConnections 完整参考(Agent LLM 连接定义) |
| Skill.md | api.skill 完整参考(Skill 管理、导入导出、读取) |
| MCP.md | api.mcp 当前参考(registration、persistent catalog、user test call 与模型工具调用) |
| Migration.md | 从 SillyTavern 扩展迁移到 TauriTavern 的适配指南 |
契约说明
- API 类型定义见
src/types.d.ts - 宿主契约与稳定性边界见
docs/FrontendHostContract.md - Agent 已落地当前 Host ABI、canonical model IR、provider_state continuation、上下文只读工具、Skill tools 与 workspace 读改工具;真实边界见
docs/API/Agent.md、docs/CurrentState/AgentFramework.md与docs/CurrentState/AgentProviderState.md - LLM Connection 管理 API 真实边界见
docs/API/LlmConnections.md与docs/Agent/PromptAssembly.md - Skill 管理 API 真实边界见
docs/API/Skill.md与docs/Agent/Skill.md - MCP 当前边界见
docs/API/MCP.md与docs/CurrentState/MCP.md