TauriTavern/docs/API
2026-08-10 00:19:16 -04:00
..
Agent.md feat(mcp): add tool execution to legacy generation 2026-08-10 00:19:16 -04:00
Chat.md feat(chat): persist tool calls as first-class messages 2026-08-06 00:11:16 -04:00
ChatSurface.md perf(chat): tune managed runtime geometry and budgets 2026-07-27 19:19:14 -04:00
Dev.md feat(agent): surface reasoning in model turns and logs 2026-05-05 18:26:38 -04:00
Extension.md feat(extension-store): add tryGetJson optional JSON lookup 2026-05-04 15:47:56 -04:00
Layout.md fix (mobilelayout): Fix scroll reachability for fixed-shell panels (Prompt Manager). 2026-04-17 19:59:17 -04:00
LlmConnections.md fix(agent): refresh model target LLM connections before runs 2026-06-19 22:07:41 +08:00
MCP.md feat(mcp): add tool execution to legacy generation 2026-08-10 00:19:16 -04:00
Migration.md refactor(chat): remove windowed mode and restore full-history semantics 2026-07-19 20:57:41 -04:00
README.md feat(mcp): add tool execution to legacy generation 2026-08-10 00:19:16 -04:00
Skill.md feat(skills): support batch ZIP and folder imports #153 2026-08-07 00:05:23 -04:00
WorldInfo.md feat (API): Expose WorldInfo and Dev APIs 2026-03-27 23:48:14 -04:00

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-surface taxonomy 实现少量 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