Skip to content
miblo

SDK

Install the Miblo SDK (TypeScript and Python) and get a token

Install @miblo/status or miblo-status, get the token with miblo sdk token, run your first program and let Miblo run it for you with miblo apps add.

Before you start

  • Miblo 1.30.0 or newer installed on the computer (with the app or the command line), with the miblo command in your terminal. Check with miblo sdk status; miblo update brings the newest. A Miblo on your desk needs 1.30.0 or newer too (the computer updates it).

  • Node.js 20+ for the TypeScript package, or Python 3.9+ for the Python package.

  • A Miblo on your desk is optional. With no gadget paired everything works, and actions answer delivered: 0, which is not an error: sessions still show in Miblo Hub and in Miblo Remote.

Install the package

The packages come only from miblo.ai, version 2.4.0. They are not on npm or PyPI: install straight from the address. Coming from an SDK 1.x? Install this one over it: Miblo 1.30.0 and newer refuse 1.x (upgrade). To update an SDK 2.x, install the package again from the same address; what each version brought is in What's new in the SDK.

TypeScript / Node.js

@miblo/status: ESM, typed (index.d.ts), no dependencies.

Terminal
npm install https://miblo.ai/dl/sdk/miblo-status-2.4.0.tgz

Python

miblo-status: standard library only.

Terminal
python3 -m venv .venv && . .venv/bin/activate   # a Python from Homebrew or a Linux distribution refuses a global pip install
pip install https://miblo.ai/dl/sdk/miblo_status-2.4.0-py3-none-any.whl

Check the download

Each file has its Ed25519 signature next to it (the same name with .sig), made with the key of Miblo's updates (public key LGtuUvDA506N8iD1tolbQzWAJBb9hUerW0OH4C2pBek=), and the signed SHA256SUMS lists every version. The checksum, then the signature (Node only, no other tool):

Terminal
curl -fLO https://miblo.ai/dl/sdk/miblo-status-2.4.0.tgz
curl -fsSL https://miblo.ai/dl/sdk/SHA256SUMS | shasum -a 256 -c --ignore-missing
curl -fLO https://miblo.ai/dl/sdk/miblo-status-2.4.0.tgz.sig
node -e 'const c=require("crypto"),fs=require("fs"),f=process.argv[1];const k=c.createPublicKey({key:{kty:"OKP",crv:"Ed25519",x:Buffer.from("LGtuUvDA506N8iD1tolbQzWAJBb9hUerW0OH4C2pBek=","base64").toString("base64url")},format:"jwk"});console.log(c.verify(null,fs.readFileSync(f),k,Buffer.from(fs.readFileSync(f+".sig","utf8").trim(),"base64"))?"signature ok":"BAD signature")' "$(basename https://miblo.ai/dl/sdk/miblo-status-2.4.0.tgz)"

The token

The Status API is off until you create its token. In your own terminal:

Terminal
export MIBLO_TOKEN=$(miblo sdk token)   # turns the API on; the token goes into the variable, not on screen

Prefer no terminal? In Miblo Hub → Programs (SDK) you turn the API on, copy the token and replace it.

  • The packages read the token from MIBLO_TOKEN (or take it as a parameter: new MibloStatus({ token }), MibloStatus(token=...)). Hand the token to your program on purpose; a program should not go looking for Miblo's files.

  • miblo sdk token --rotate replaces the token (and prints the new one): whoever held the old one is refused from then on (not_authorised), and your AI tools, the CLI and Miblo Remote are not affected. Programs Miblo runs for you (below) get the new token when they start again.

  • miblo sdk off deletes the token and turns the API off (sdk_off). miblo sdk status says whether it is on and where the file is.

  • The bridge must be running. Your AI tools start it, and so does miblo sdk start.

First program

Ten lines: the program shows up as a session, works, says it needs you and finishes.

// first.mjs, in the folder where you ran npm install; run: node first.mjs
import { MibloStatus } from '@miblo/status';

const miblo = new MibloStatus();                          // reads MIBLO_TOKEN
const job = await miblo.session({ tool: 'first.mjs', title: 'Deploy', detail: 'building' });
await new Promise((r) => setTimeout(r, 5000));            // ...your work...
await job.needsYou('confirm the deploy');                 // Miblo alerts
await new Promise((r) => setTimeout(r, 10000));
await job.done('deployed');

What happens:

  1. session() registers the session Deploy on Miblo Desk, in Miblo Hub and in Miblo Remote, with the line first.mjs · building.

  2. needsYou() moves it to needs you: Miblo Desk gives the question alert and the "needs you" counter goes up. On Miblo Remote, the session shows as Other tool: first.mjs.

  3. done() shows it as finished, with the finished alert. When the process exits, the session goes by itself (the package sends its own process's pid).

Let Miblo run your program

For a program that is always on (a screen app, a watcher), let Miblo's supervisor look after it. In your own terminal (an AI agent cannot do this for you):

Terminal
miblo apps add "node steps.mjs" --cwd ~/code/steps --id steps
miblo apps enable steps        # starts it now and every time Miblo starts
miblo apps logs steps          # what the program printed
  • Miblo starts the program with MIBLO_TOKEN, MIBLO_PORT and MIBLO_APP_ID (the app's id), plus MIBLO_LANG (pt or en) and the system's basics (PATH, HOME, language, time zone, proxy). Nothing else from your environment goes along: keys in your shell never reach the program.

  • Without --id, the id comes from the file name (steps.mjs → steps); when that id is taken, Miblo adds -2, -3... (miblo apps add prints the id it chose). Use the same id the program declares in app.declare(). Without --cwd, it runs in the folder you added it from.

  • If the program exits, Miblo starts it again after 2 s, 10 s, 30 s, 2 min and then every 10 min; a program that stayed up for a minute counts as healthy and starts the waits over. While an app is on, the bridge stays up.

  • The log keeps the last 256 KB, and at most 64 KB every 10 seconds (the rest is dropped, with a line saying so).

  • miblo apps show <id> shows its state and how many times it restarted; miblo apps disable <id> turns it off; miblo apps remove <id> turns it off, takes its screen away and forgets the program and its settings.

  • miblo apps list shows them all (the official ones, yours and the community's). In Miblo Hub, the Desk apps tab does the same with a switch per app.

Start an app: two paths

For a store app (a screen, or alerts people turn on with one click), start from the ready-made template and watch it in the simulator, with or without a Miblo on your desk:

  • With Miblo installed: miblo apps new "My App" --page (the Miblo 1.45 page Desk app, the default way; without --page the template is the old, card one), then miblo apps dev my-app (the screen in your browser, reloaded on every save) and miblo apps check my-app (the Desk App Store's rules).

  • Without Miblo: download the starter https://miblo.ai/dl/extras/miblo-app-starter-1.48.0.zip and use node sim.mjs new | dev | check (Node 22.15+, 23.5+ or 24+; on another Node, point MIBLO_NODE at a suitable one).

The details are in Develop without a Miblo.

When something goes wrong

Every error is a MibloError with a stable code. The ones you meet while setting up:

codeWhat it meansWhat to do
upgradeThis SDK is older than Miblo accepts (an SDK 1.x on Miblo 1.30.0 or newer)Install the SDK above (2.4.0)
bridge_outdatedMiblo on the computer is older than this SDKmiblo update
no_tokenNo token in MIBLO_TOKEN or the parameterexport MIBLO_TOKEN=$(miblo sdk token)
sdk_offThe API is off on this computermiblo sdk token
bridge_unavailableNothing answers on Miblo's portmiblo sdk start (or open an AI tool)
not_authorisedWrong or rotated token, or a Miblo from before the SDK existedGet the token again; update Miblo
unverified_answerThe answer was not signed by MibloSomething took Miblo's port: restart the bridge
timeoutThe bridge did not answer in timeTry again; check miblo status

The other codes are in Sessions and status and The App screen.