Version 1.4.0 (current)
End-to-end example — device-report
Run three read-only probes from the registry and distinguish complete success from partial failure.
After your first device tool, use this example to learn extension registration and partial-failure handling. It reads system, display, and existing-task metadata directly, without creating an app or submitting a model task.
Prerequisites
Requires the system source
This example runs from the taku-os repository root. Clone taku-os first.
Run from the system repository root with Node.js 20+, ADB, and an explicitly selected device running Taku OS. Use adb devices -l to confirm the target is device, then replace the example serial emulator-5582 with that target.
system.info and displays.status require the relevant shell-query privileges. tasks.status additionally needs UID 0 or 1000. Reading existing tasks also depends on directory and file access. An ordinary shell can therefore produce a partial failure. An allowed UID may receive an empty task list when no readable task records exist.
Steps
Discover the extension
node sdk/cli/taku.mjs call extensions.listConfirm that the registry contains device-report with entry point examples/extensions/device-report/index.mjs. This reads local metadata without connecting to a device.
Run it on the selected device
node sdk/cli/taku.mjs extension device-report --transport adb --serial emulator-5582
echo $?Run echo $? immediately after the command to see its exit code. If ADB is not on PATH, add --adb /path/to/android-sdk/platform-tools/adb to the first command.
Complete success: exit code 0, result.extension equal to device-report, all three keys (system.info, displays.status, tasks.status) present in result.observations, and empty result.errors. generatedAt is the execution time, not a build or release version. A successful tasks.status with tasks:[] means no readable task entries were returned; it does not prove that the system task service is installed or that a historical task exists.
A development device may return API 36, ARM64, UID 0, Enforcing, display 0 plus a dynamic background display, and existing completed task metadata. Values differ by device, so check your actual readback and do not turn them into assertions.
Check partial failures
If an ordinary shell cannot read the task directory, the report preserves other successful observations and records code, message, and retryable in result.errors["tasks.status"]. Any error makes the CLI exit with 1.
Do not check only outer ok:true: it means the extension function returned a report, which may still contain failed probes. A failure in the outer process, such as loading the extension, produces ok:false with a top-level error instead.
A nonexistent serial should leave a transport failure, not select another device. Unknown or undeclared methods should be rejected without an implicit Root Shell fallback. Confirm the target and identity, then follow the error reference; do not remove errors to turn partial data into a pass.
Use it as a new-extension template
Turn working business code into export async function run(client), declare its methods in the same registry, then invoke it through the existing CLI. See the extension contract for fields. The passed client restricts SDK methods, but the module remains trusted local code without process sandboxing.
Reuse existing probes and task metadata instead of adding a separate queue. When submitting a reproduction scenario, retain only necessary reproduction details; do not export prompts, result bodies, or authentication directories.
Research preview · Current availability
Report an issue or give feedback
Delivery to the maintenance queue does not mean it has been handled. Feedback is retained for 90 days.
Built with Fumadocs
Extension format and lifecycle
Use the device-report declaration to register a trusted local extension, define its call scope and Android permissions, and learn the community plugin format.
Reuse system AI in an Android app
Make one real text request through the source client and per-app user authorization.