版本 1.4.0(当前)
SDK 方法与协议
查询方法、调用格式、返回和错误,下载原始规范。
这页用于查阅方法与协议。若你还没有运行过调用,先看第一次调用。
最小调用
在系统源码目录,使用 Node.js 20+ 读取方法列表;不需要连接设备:
node sdk/cli/taku.mjs call methods.list成功时 ok 为 true,result 包含方法数组。设备方法通过相同入口调用,但另需目标设备与相应权限。
当前实现的方法
下表列出锁定规范注册的全部方法。methods.list、capabilities.list、extensions.list 返回元数据;其他方法读取或操作设备,需要表中所列权限。
| 方法 | 实现 | 权限 | 状态 | 修改状态 |
|---|---|---|---|---|
system.info | device-probe | Android shell tools | implemented | 否 |
displays.status | device-probe | shell/system/root for cmd display; optional root state path | implemented | 否 |
tasks.status | device-probe | root/system UID plus filesystem access under current SELinux policy | implemented | 否 |
methods.list | core | none | implemented | 否 |
capabilities.list | inventory | none | implemented | 否 |
extensions.list | registry | none | implemented | 否 |
audio.capabilities | audio-engine | authorized adb/device bridge and visible microphone host; native caller policy | implemented | 否 |
audio.session.open | audio-engine | authorized adb/device bridge and visible microphone host; native caller policy | implemented | 是 |
audio.session.finish | audio-engine | authorized adb/device bridge and visible microphone host; native caller policy | implemented | 是 |
audio.session.close | audio-engine | authorized adb/device bridge and visible microphone host; native caller policy | implemented | 是 |
audio.session.status | audio-engine | authorized adb/device bridge and visible microphone host; native caller policy | implemented | 否 |
audio.session.append | audio-engine | session owner; SPEAK only | implemented | 是 |
完整方法注册字段见 methods.json。
请求与错误协议
Request: {"protocol":"taku/0.1","type":"request","id":"req-1","method":"system.info","params":{}}.
Success: {"protocol":"taku/0.1","type":"response","id":"req-1","ok":true,"result":{}}. Each method defines its own result.
Failure: {"protocol":"taku/0.1","type":"response","id":"req-1","ok":false,"error":{"code":"PERMISSION_DENIED","message":"...","retryable":false}}. The CLI prints one complete JSON document per run. Exit code 0 means success, and 1, 2 or other codes mean failure. The SDK throws TakuError on failure. If device-report partly fails, it keeps errors and exits non-zero.
INVALID_REQUEST / INVALID_PARAMS / METHOD_NOT_FOUND / DEVICE_REQUIRED / INVALID_TRANSPORT / TRANSPORT_ERROR / TIMEOUT / INVALID_RESPONSE / PERMISSION_DENIED / UNSUPPORTED_PLATFORM / INVENTORY_UNAVAILABLE / EXTENSION_NOT_FOUND / CAPABILITY_NOT_DECLARED. Retry only when retryable:true. Do not hide a permission error behind endless retries.
Current methods
| Method | Input | Output | Entry point and limits |
|---|---|---|---|
methods.list | {} | Array of the methods this repository implements | No device. Separate from the research capability list |
capabilities.list | {} | The capability list as stored | Includes research, emulator and physical-device status. Not every listed capability is a callable method |
extensions.list | {} | Registry array | Currently only the trusted local device-report |
system.info | {} | model/manufacturer/androidRelease/apiLevel/securityPatch/abi/buildType/selinux/callerUid strings | getprop, getenforce, id. Does not read unique device identifiers |
displays.status | {} | displayIds:number[]; background:{displayId,active} or null | cmd display. active requires that the dynamic ID still exists |
tasks.status | {} | tasks:{id,state}[]; source/includesPrompts/includesResults | The existing task service state.json. Needs root or system UID and a readable filesystem path |
No current method accepts extra parameters. The SDK schema defines only the transport shape, and core validates business parameters. Android version support depends on the capability list and tested devices. These shell probes have been tested only on API 36 userdebug, so do not assume they behave the same on any stock phone.
For Android API detail, see the API reference.
Events
Reserved: {"protocol":"taku/0.1","type":"event","event":"task.state.changed","timestamp":"ISO8601","requestId":"optional","data":{}}. The schema defines the shape, but subscriptions, ordering, cursor recovery and deduplication are not implemented. tasks.status is a snapshot query, not a live event. Events would come only from the existing task service, with no second queue.
Type-free JS example
import {TakuClient} from '../sdk/client.mjs';
const client = new TakuClient({transport:'adb',serial:'emulator-5582'});
const device = await client.call('system.info');Permissions come from the real transport: the process UID, SELinux and the approved ADB connection. An extension declaration in the protocol does not grant any Android permission. After a new extension is registered, its capabilities limit which SDK methods it can call. The current trusted-process model is not a sandbox.
原始规范下载
版本与来源
本页由 Taku OS 规范 0.1.0 生成,原始命令和字段保持来源值。目录状态记录于 2026-10-10,后续设备支持见当前进度。
Android 原生组件契约
上面的 CLI 方法登记与 Android 组件 API 分开。以下 Surfaces Schema 从同一锁定提交逐字节复制;签名要求见展示组件接入,逐应用授权见系统 AI 客户端。这些接口不增加 CLI 方法计数。