The --json protocol
What an everyapp command prints with --json (NDJSON events), its exit codes, and what an agent does with each event, action and error.
Every command takes --json. With it, stdout is one JSON event per line, nothing prompts, and the exit code says how the run ended. Commands are on cli, codes on errors.
The stream
- Each line is
{ "v": 1, "ts": "<ISO time>", "type": "<type>", … }. Nothing else is written to stdout: child processes (pnpm, builds, git) write to a log under$TMPDIR/everyapp/, and a failure names that log. --jsonis read before the arguments are parsed, so an unknown command or flag is anerrorevent too.--helpand--versionprint text, not events.- Under Bun or Node older than 22.18 the run is one
error,UNSUPPORTED_RUNTIME.
Event types
type |
Fields | Meaning |
|---|---|---|
step |
step, status (start, ok, skip, fail), message?, data? |
A named piece of work (setup.gateway, app.register, app.migrations, app.live). |
progress |
step, message, data? |
A line while a step runs (waiting for a lease or a certificate). |
warning |
code, message, step?, data? |
Something to know; the run goes on. |
action_required |
action, message, step?, data? |
Only a person can go on (below). |
error |
code, message, retryable, step?, data? |
The run failed. Always last. |
done |
message?, data? |
The run finished. Always last. |
A message's first line is the headline; the lines after it are detail.
Without --json, a person sees a short form of the same result: what happened, then only what they must know or do next. When it holds detail back, its last line is More: --verbose, and the same command with --verbose prints the full account. That is the same with or without a terminal. --json always carries the full account (message, data), so an agent doesn't need --verbose for it.
Exit codes
| Code | When |
|---|---|
0 |
Ended with done. |
1 |
An error was emitted. A declined prompt is CANCELLED, exit 1. |
2 |
Stopped on an action_required (or ran out of time waiting for one). Do the action, then run data.rerun or one of data.choices. |
130 |
Ctrl-C. Running cf children are stopped and cleanups run. |
251 |
No such command (UNKNOWN_COMMAND, with data.didYouMean). |
252 |
Bad arguments: UNKNOWN_FLAG, INVALID_VALUE, MISSING_ARGUMENT, MISSING_FLAG_VALUE, TOO_MANY_ARGUMENTS, REPEATED_FLAG, with data.usage, data.help or data.didYouMean. |
What to do next: fix, rerun, authorize
On error and action_required events, data may carry:
fix: a remedy in words. Do it; there is no command.rerun: the exact command to run next,--jsonkept when this run had it. Run it as it is; never rebuild it.rerunNotesays when ("once it's done", "in a terminal").authorize: true:rerunadds a flag that takes something over. Show the error to the person and ask before running it. Never add these flags on your own:--force-dnsforDNS_RECORD_CONFLICT,DNS_UNREADABLEandCAA_BLOCKS_ISSUANCE;--allow-delete-durable-object-dataforDURABLE_OBJECT_REMOVED;--allow-delete-workflowsforWORKFLOW_REMOVED;--enable-email-routingforEMAIL_ROUTING_DISABLED;--replace-mxforEMAIL_MX_ELSEWHERE;--yesforCONFIRMATION_REQUIRED.
needsTerminal: true: only a person at a terminal can runrerun, so it has no--json. Hand it over; don't add--json.choices: instead ofrerun, when the way on is one of several commands. It's an array of{ rerun, label, … }. Pick one with the person.url: a page that helps.rollbackCommand: cf's command to put back a database this run migrated.stack: onUNEXPECTED.
retryable: true means the same rerun can succeed with nothing changed (NETWORK_ERROR, CF_TIMEOUT, LEASE_HELD, APP_CHANGING). Retry it a few times. retryable: false with a rerun means something must happen first.
Actions a person must take
action |
What the person does | Notes |
|---|---|---|
cloudflare_login |
Opens data.url and approves the Cloudflare login, entering data.code if asked. |
With data.waiting: true the run goes on by itself once approved. Unattended runs set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID instead. |
claim_owner |
Opens the one-time setup link (data.url) and creates the owner account. |
It waits up to 15 minutes. The link works once, expires in 24 hours and is a password. Rerun setup for a new one. Under CI the link is never shown: done with the warning OWNER_NOT_CLAIMED. |
upgrade_workers_paid |
Subscribes the account to Workers Paid at data.url. |
Then rerun. |
enable_r2 |
Turns on R2, Cloudflare's file storage, for the account at data.url (the first 10 GB a month is free). |
Then rerun. setup and update stop on it before anything is created or deployed. |
register_workers_subdomain |
Picks a workers.dev subdomain in the dashboard (data.url). |
Then rerun. |
add_domain |
Adds a domain to the account, or finishes activating one (data.url). |
Then rerun. |
choose_account |
Picks one of data.choices (several accounts or Gateways). |
Each choice's rerun adds --account-id or --gateway. |
install_gateway |
Runs everyapp setup: no account has a Gateway. |
data.accounts lists the accounts the login sees. |
rerun_interactive |
Runs data.rerun in a terminal to confirm replacing a Worker changed outside everyapp. |
needsTerminal: true; --yes doesn't skip it. |
composio_sign_in |
Opens data.url and approves the sign-in at Composio. |
provider link composio. data.waiting: true: the run goes on by itself once approved. Show the link to the person the run acts as and nobody else. Not approved by data.expiresAt: COMPOSIO_LINK_EXPIRED. |
Prompts under --json
Nothing prompts. A yes/no question is CONFIRMATION_REQUIRED (pass --yes once the person agrees). A choice is choose_account, or DOMAIN_REQUIRED for setup without --domain. A secret's value comes from --from-env <VAR> or stdin, never the command line (SECRET_VALUE_REQUIRED). configure <app> reads NAME=value lines on stdin or --from-env. teardown needs --confirm <account id>.
Results in done.data
data.durationMs is always there. data.next lists what to run next: command strings, or { command, note }. data.facts holds the labelled lines a person sees. The command's own result:
status: the whole report. It hasgatewayUrl,apps[](each withstatus,publicRoutesandsetup),access({ on }),fixes[]as{ code, severity, message, run, note?, fix? }(status) andnext[]as{ code, command?, url?, note, why }. The next-step codes areAI_KEY,PROVIDER_OFFER,PROVIDER_KEY,ACCESS_OFF,INVITE,CONNECT_AI,CREATE_APPandEMAIL_UNSET.db query:{ database, results: [[row, …] per statement], meta: [{ duration, changes }] }.secret list: names only, never values. The Gateway's names and settable names, and each app'ssetup.secret set:gateway.boundlists the provider rows (a remote MCP app's<id>-mcpamong them) whose key is now bound to their hosts.deploy:{ url, workerName, versionId, live, organization, publicRoutes, next }.workspace …,events …,ai show|default,call <tool>: the Gateway tool's answer. With no stored sign-in and noEVERYAPP_TOKEN, the run first emits agateway.signinprogress event whose URL the person opens, and waits. A tool's refusal isGATEWAY_TOOL_ERROR(data.code,data.tool); a refused credentialGATEWAY_REFUSED.workspace composio,provider link composio,provider unlink composio: the Gateway tool's answer too, by the same sign-in rule.provider link composioends with the person's link:composio(on or off),linked,accountandproviders(each with itsservicesand their accounts; null when Composio didn't answer).setupandupdate:{ gatewayUrl, adminUrl, organizationName, owner, release, gateway, accessOn, next }.gatewayisinstalled,upgraded,repairedorup-to-date.usageReportsis there when the run has something to say about the Gateway's daily usage report to Every App (usage reports):{ usageReports: "on", startsAt, notice: { headline, detail } }before the first report, or{ usageReports: "off", because: "no-telemetry" | "do-not-track" }when this run left them off. Show the personnotice.headlineandnotice.detailas they are, witheveryapp telemetry(the exact report) andeveryapp telemetry off. Turning reports on or off is their choice: don't do it for them unless they ask.mcp add:{ id, url, auth, credential, connect?, oauth?, verify?, probe, mcp, next }.credential.kindisnone,bearer,header,query,basic,oauthorprovider;connect.urlis where each member connects an OAuth server;verifyis the static key's check.create:{ appId, dir, next }.release:{ tarball, shown, version, sha256, next }.delete:{ appId, workerName, alreadyDeleted, purged }.
An app's setup state (status as apps[].setup, secret list as app.setup, configure as app.setup) is:
{ ready: boolean,
settings: Setting[], // every setting, in manifest order
unmet: Setting[], // the ones that keep the app closed ("Needs setup")
features: Feature[], // every feature, in manifest order
command: { command } | null } // "everyapp configure <app>"; null once ready
Setting = { kind: "provider" | "capability" | "secret" | "setting" | "ai-default" | "remote-mcp",
id, label, holder: "gateway" | "app", names: string[],
need: { kind: "required" | "optional" }, feature?, // the feature it belongs to
set: true | false | null, blocking: boolean,
why?, how?, generate?, file?, hint?, docs?, setup? } // setup: a Gateway setting's guide
Feature = { id, name, required, why?, steps: string[], capabilities: string[], providers: string[],
state: "off" | "incomplete" | "ready", settings: string[] } // its settings' idsconfigure's done.data.features (and SECRET_VALUE_REQUIRED's data.features) is each feature ready to act on:
{ id, name, required, why?, state: "off" | "incomplete" | "ready",
steps: string[], // Markdown, {appUrl} and {gatewayUrl} filled in
values: [{ name, kind: "secret" | "setting", how?, set, generate, file }],
needs: [{ kind, id, label, set, command? }], // Gateway settings; command when unset: "everyapp provider add <id>"
oneOf?: string[] } // the features, this one among them, of which the app needs one: ["dataforseo", "treg"]To set an app up, show the person each feature's steps and each value's how, and each Gateway setting's why, hint and setup guide (https://everyapp.com/docs/agent/setup/<name>.md). Then have the person run everyapp configure <app> at a terminal so values never pass through the chat. An agent that holds a value already pipes NAME=value lines in, or exports them and adds --from-env (a multi-line value such as a PEM is kept; a file value may be a path). Generated secrets without a how are made on the run; one with a how is made at a terminal, where it is shown once.
The loop an agent runs
- Run the command with
--json. Read each line as it comes and show the person themessageheadlines. - On
action_required: tell the person exactly what to do (the URL, the code). Ifwaiting, keep reading; otherwise wait for them, then rundata.rerun. - On
error: look up the code on errors. Dofix, or runrerun(ask first whenauthorize). Ifretryable, retry. - On
done: reportdata, and offerdata.next.