Skip to content

Companion SDK

软件包@consenger/[email protected]
Protocolcompanion.plugin.v1
运行环境Vifu Web iframe / iOS WKWebView
状态公开 alpha

@consenger/companion-sdk 是面向 companion-native agentic game 的 browser SDK。游戏可以把安全的 gameplay context 暴露给 Vifu host,并接收 companion 触发的 command。

生产范围会刻意保持收敛:只支持由 Vifu Web 加载的 browser game,以及 iOS WKWebView runtime。Node.js 和任意 backend 集成不属于这个 SDK 的公开契约。

兼容性

PackageProtocolCapabilityRuntime
@consenger/[email protected]companion.plugin.v1companion.plugin.v1Vifu Web iframe、iOS WKWebView

基本模型

  • Context 是可读取的游戏状态,例如当前题目、score、选中的单词或 scene。
  • Command 是游戏自己拥有的动作,companion 可以请求游戏执行。
  • Observation 是游戏上报的简短 event 或 fact。
  • Signal 是游戏明确希望 companion 关注的少量关键 moment。
  • Reaction 是 signal 或 command 之后由游戏本地展示的 feedback。

传给 companion 的数据应该保持简短,并且只包含 player-facing 的内容。不要暴露 access token、隐藏答案、private user note 或实现细节状态。

后续页面