API
Machines and fleet
Routes for joined machines, the agent host, the local fleet, owner checkouts, runtime updates and moving Clankie to another machine.
On this page
- Machines
- List access refusals
- Read the joined-machine shell audit
- Joining a machine
- Read join settings
- Change join settings
- Start a join
- Read join status
- Approve a join
- Joined machine channel
- Agent host and runtime connections
- Read the Herdr binding
- List runtime connections
- Inspect a remote connection's harnesses
- Fleet
- List harness processes
- Read fleet health metrics
- Read fleet resources
- List simulators
- Read machine setup context
- Checkouts
- Report checkouts
- Sync checkouts
- Updates
- Read update status
- Request an update
- Cancel a batched update
- Read the canary
- Change the canary policy
- Manage deploy holds
- Moving Clankie to another machine
- Read move status
- Move steps
This page covers the routes that describe the machines Clankie runs on and the fleet of agents working there: joining another machine, the agent host and its connections, fleet capacity, the owner's checkouts, runtime updates, and moving Clankie to another machine. Most routes take the operator token. Routes that touch owner secrets also accept a device session with Take Control. A few routes are called by another machine's own client and take no bearer.
Machines
Read-only reports about what Clankie was refused on a machine and what it ran in a joined machine's shell.
List access refusals
GET /v1/machines/access-refusals
Lists the times Clankie needed more access on a machine than the owner allows. A refusal stops appearing once the owner raises that machine's access to the level it needed.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
refusals |
object[] | Refusals the current access settings still refuse. |
refusals[].machine |
string | Machine ID (local for this machine). |
refusals[].accessLevel |
string | Access the machine had: portal, workers, shell or screen. |
refusals[].required |
string | Access the refused action needed, same values. |
refusals[].observedAt |
string | ISO 8601 time of the refusal. |
refusals[].fix |
string | The owner command that would allow it. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS http://127.0.0.1:4310/v1/machines/access-refusals \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Read the joined-machine shell audit
GET /v1/machines/shell-audit
Returns the 50 most recent shell commands Clankie sent to joined machines, with their outcome. Commands are recorded only as a SHA-256 digest.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
entries |
object[] | Oldest first, at most 50. |
entries[].id |
string | UUID of the call. |
entries[].requestedAt |
string | ISO 8601 time it was sent. |
entries[].finishedAt |
string | ISO 8601 time it finished. Absent while dispatched. |
entries[].lane |
string | The lane the command came from. |
entries[].origin |
string | owner or autonomous. |
entries[].conversationId |
string | Conversation the command came from. |
entries[].machineId |
string | Joined machine ID (join-<uuid>). |
entries[].directory |
string | Directory it ran in. |
entries[].commandSha256 |
string | SHA-256 hex digest of the command. |
entries[].outcome |
string | dispatched, completed, refused, failed or unknown. unknown means Clankie stopped waiting and the command may or may not have run. |
entries[].exitCode |
integer | Exit code the joined machine reported. |
entries[].error |
string | Error text, when there was one. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS http://127.0.0.1:4310/v1/machines/shell-audit \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Joining a machine
Another machine joins Clankie with a short-lived join request that the owner approves with a code. The joining machine starts the request and polls its status. The owner approves it and chooses the access level and directories.
Read join settings
GET /v1/machine-joins/settings
Reports whether new machines may start a join.
Auth: Operator token, or device session with Take Control.
Response 200
| Field | Type | Description |
|---|---|---|
enabled |
boolean | true when POST /v1/machine-joins/start accepts new joins. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control. |
curl -sS http://127.0.0.1:4310/v1/machine-joins/settings \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Change join settings
PATCH /v1/machine-joins/settings
Turns new joins on or off. Returns the saved setting.
Auth: Operator token, or device session with Take Control.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
enabled |
boolean | Yes | The only field allowed. |
Response 200
| Field | Type | Description |
|---|---|---|
enabled |
boolean | The saved setting. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | malformed |
The request is not exactly {"enabled": <boolean>}. |
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control. |
| 409 | join_settings_conflict |
The setting could not be saved, or the caller's authority changed during the write. |
curl -sS -X PATCH http://127.0.0.1:4310/v1/machine-joins/settings \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"enabled": true}'Start a join
POST /v1/machine-joins/start
Called by the joining machine. Opens a join request that expires after five minutes and returns its ID.
Auth: None (called by the joining machine).
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Display name for the machine, 1 to 100 characters. |
platform |
string | Yes | darwin, win32 or linux. |
directories |
string[] | Yes | Directories the machine offers, at most 32. |
claimSecret |
string | Yes | A 43-character base64url secret the machine keeps; it reads the status with it. |
approvalHash |
string | Yes | SHA-256 hex digest of the approval code shown to the owner. |
Response 200
| Field | Type | Description |
|---|---|---|
joinId |
string | UUID of the join request. |
expiresAt |
string | ISO 8601 expiry time. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | legacy_joins_disabled |
The owner has turned new joins off. Includes detail. |
| 400 | join_refused |
The request is invalid, or too many joins are pending or registered. |
curl -sS -X POST http://127.0.0.1:4310/v1/machine-joins/start \
-H "Content-Type: application/json" \
-d '{"name": "studio-pc", "platform": "win32", "directories": ["C:\\work"], "claimSecret": "'"$CLAIM_SECRET"'", "approvalHash": "'"$APPROVAL_HASH"'"}'Read join status
POST /v1/machine-joins/status
Called by the joining machine to learn whether the owner has approved it.
Auth: The join's claim secret as the bearer: Authorization: Bearer $CLAIM_SECRET.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
joinId |
string | Yes | The ID from start. The only field allowed. |
Response 200
| Field | Type | Description |
|---|---|---|
state |
string | pending, approved, expired or revoked. An unknown ID or wrong claim secret also reads expired. |
sealedLease |
string | Present when approved: the machine's encrypted credentials and granted access. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | malformed |
joinId is missing or not a UUID, or other fields are present. |
curl -sS -X POST http://127.0.0.1:4310/v1/machine-joins/status \
-H "Authorization: Bearer $CLAIM_SECRET" \
-H "Content-Type: application/json" \
-d '{"joinId": "'"$JOIN_ID"'"}'Approve a join
POST /v1/machine-joins/approve
The owner approves a pending join with the code the joining machine shows, and sets its access level and directories.
Auth: Operator token, or device session with Take Control.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
code |
string | Yes | The 43-character approval code from the joining machine. |
accessLevel |
string | Yes | portal, workers, shell or screen. This becomes the machine's access ceiling. |
directories |
string[] | Yes | Directories to allow, at most 32. Each must be one the machine offered. |
Response 200
| Field | Type | Description |
|---|---|---|
ok |
boolean | Always true. |
machineId |
string | The new joined machine ID (join-<uuid>). |
accessLevel |
string | The granted access level. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | join_refused |
Invalid request, no pending join for the code, a directory the machine did not offer, the join expired, or too many machines. |
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control. |
curl -sS -X POST http://127.0.0.1:4310/v1/machine-joins/approve \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"code": "'"$APPROVAL_CODE"'", "accessLevel": "workers", "directories": ["C:\\work"]}'Joined machine channel
Once joined, the machine talks to Clankie over three routes of its own. They are not for owner clients.
| Method | Path | Purpose | Caller |
|---|---|---|---|
POST |
/v1/joined-machines/challenge |
Start an exchange. | Called by the joined machine's own client. |
POST |
/v1/joined-machines/channel |
Receive work and return results. | Called by the joined machine's own client. |
POST |
/v1/joined-machines/leave |
Leave Clankie. | Called by the joined machine's own client. |
Agent host and runtime connections
Clankie runs agents in an agent host. Herdr is the supported terminal agent host. These routes report which Herdr session the service is bound to and the other connections it can run agents on.
Read the Herdr binding
GET /v1/herdr
Returns the Herdr session and socket the service uses, or those of a named connection.
Auth: Operator token.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
connection |
string | No | A connection ID. default is the service's own Herdr. Other IDs answer only for an enabled local connection whose socket responds. |
Response 200
| Field | Type | Description |
|---|---|---|
runtime |
string | bundled (Clankie's own Herdr) or external. |
session |
string | Herdr session name. |
socketPath |
string | Absolute path of the Herdr socket. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | herdr_binding_unavailable |
Herdr is not healthy, or the named connection is unknown, disabled, remote or not answering. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS http://127.0.0.1:4310/v1/herdr \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"List runtime connections
GET /v1/runtime-connections
Lists the service's own Herdr (default) followed by each configured connection, with its capacity and current state. Local sockets are probed, and SSH connections are checked over SSH, on every call.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
connections |
object[] | default first, then the configured connections. |
connections[].id |
string | Connection ID. |
connections[].machine |
string | Machine ID. local for default; may be absent on other connections. |
connections[].kind |
string | Always herdr. |
connections[].session |
string | Herdr session name. |
connections[].socketPath |
string | Local socket path, when there is one. |
connections[].ssh |
object | SSH route for a remote Herdr: host and shell (posix or powershell). |
connections[].transport |
string | ssh for SSH connections. |
connections[].state |
string | For default: starting, healthy, recovering, stopped, unavailable or disabled. For others: healthy, unavailable, unreachable, disabled, or changed if settings changed during the check. |
connections[].enabled |
boolean | For default, whether Herdr is bound. For others, the saved setting (false when changed). |
connections[].capabilities |
string[] | Kinds of work the connection takes, such as code, review, research. |
connections[].capacity |
integer or null | Agent limit. null means unlimited. |
connections[].capacitySource |
string | default (16), owner or unlimited. |
connections[].workspaces |
object[] | Allowed workspaces, each kind (repository or directory) and path. |
connections[].lastSeenAt |
string | SSH only: ISO 8601 time the remote Herdr last answered. |
connections[].configured |
object | default only: the saved Herdr settings (runtime, session, socketPath). |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS http://127.0.0.1:4310/v1/runtime-connections \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Inspect a remote connection's harnesses
GET /v1/runtime-connections/:id/harnesses
Runs the worker plugin's harness inspector on an SSH connection's machine and reports what it finds, including whether each worker bridge there serves every tool Clankie expects. Nothing on the remote machine is changed.
Auth: Operator token, or device session with Take Control.
Path parameters
| Name | Type | Description |
|---|---|---|
id |
string | ID of an enabled SSH connection. |
Response 200
| Field | Type | Description |
|---|---|---|
machine |
string | The connection ID. |
harnesses |
object | The remote inspector's report (open-ended), plus catalog. |
harnesses.catalog.expected |
string[] | Tool names every worker bridge must serve. |
harnesses.catalog.claude |
object | reported (boolean) and missing (string[]) for the Claude bridge. |
harnesses.catalog.codex |
object or null | Same for the Codex bridge; null when the Codex plugin is not installed. |
harnesses.catalog.refreshNeeded |
boolean | true when a bridge lacks tools or does not report them. |
harnesses.catalog.reason |
string | Present when a refresh is needed: what is missing and the command to fix it. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control. |
| 503 | harness_inspection_unavailable |
No enabled SSH connection has that ID, the machine is unreachable, or the inspector is not installed there. Includes detail. |
curl -sS http://127.0.0.1:4310/v1/runtime-connections/$CONNECTION_ID/harnesses \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Fleet
The fleet is the set of agents Clankie runs on this machine. These routes report agent processes, health counters, shared resource capacity and the policy that applies to machine setup.
List harness processes
GET /v1/fleet/processes
Lists every Claude, Codex and Codex helper process running as the same user on this machine, and the Herdr pane each one runs under.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
schemaVersion |
integer | Always 1. |
observedAt |
string | ISO 8601 time of the census. |
censusComplete |
boolean | Whether every process could be attributed. |
gaps |
string[] | What the census could not observe, such as complete_pane_census_unavailable. |
counts |
object | codex, claude, helper, live, verified and reportOnly counts. |
processes |
object[] | One per process. |
processes[].pid |
integer | Process ID. |
processes[].parent |
integer | Parent process ID. |
processes[].executable |
string | Executable path. |
processes[].harness |
string | codex, claude or helper. |
processes[].cwd |
string or null | Working directory. |
processes[].started |
string | Start time as the OS reports it. |
processes[].startedAt |
string or null | ISO 8601 start time, when it can be parsed. |
processes[].lastActivity |
string or null | Last activity time. |
processes[].lastActivitySource |
string | Where lastActivity came from. |
processes[].liveOwners |
object[] | Panes the process runs under: paneId, seatId. |
processes[].eligibility |
string | live when a pane owns it, otherwise report-only. |
processes[].reason |
string | live_pane_or_thread or original_launch_unattributed. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | harness_process_observation_unavailable |
The process census failed. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS http://127.0.0.1:4310/v1/fleet/processes \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Read fleet health metrics
GET /v1/fleet/metrics
Returns counters for seat identity checks and worker report deliveries since the service started, overall and over the last 5 and 60 minutes. A restart starts the counters again.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
schemaVersion |
integer | Always 1. |
startedAt |
string | ISO 8601 time counting began. |
observedAt |
string | ISO 8601 time of this snapshot. |
totals |
object | Counters since startedAt (fields below). |
totals.proof |
object | Seat identity checks: attempts, refusals, byReason (counts keyed by refusal reason). |
totals.reports |
object | Worker report deliveries: attempts, failures, byReason. |
totals.nativeDiagnostics |
object | Counts keyed by native diagnostic reason. |
totals.transportDiagnostics |
object | Counts keyed by transport reason (queue_full, cancelled, timeout, helper_unavailable, protocol_invalid). |
windows |
object[] | Two windows: 5 minutes, then 60 minutes. |
windows[].minutes |
integer | 5 or 60. |
windows[].proof, .reports, .nativeDiagnostics, .transportDiagnostics |
object | The same counters for the window. |
windows[].proofRefusalRate |
number | Refusals divided by attempts, 0 to 1. |
windows[].proofRefusalsPerMinute |
number | Refusals per minute. |
windows[].reportFailureRate |
number | Report failures divided by attempts, 0 to 1. |
windows[].reportFailuresPerMinute |
number | Report failures per minute. |
callers |
object[] | Per pane, when present: claimedPane (the pane the request named, a label only) and window. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS http://127.0.0.1:4310/v1/fleet/metrics \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Read fleet resources
GET /v1/operator/fleet-resources
Returns this machine's shared resource registry: the policy, slot capacity, current leases and queues for heavy commands, light checks, long-running servers and simulators. The snapshot is cached and refreshed every few seconds.
Auth: Operator token, or device session with Take Control.
Response 200
| Field | Type | Description |
|---|---|---|
schemaVersion |
integer | Always 1. |
policy |
object | Owner policy: heavySlots, simulatorSlots (each integer or null for automatic), simulatorIdleMs, and disk warning thresholds warnFreeDiskGb, warnFreeDiskPercent, plus older pressure fields. |
capacity |
object | heavySlots, simulatorSlots, used, simulatorUsed, lightSlots, lightUsed, serverSlots, serverUsed, serverCpuCores. |
pressure |
object | Machine reading: sampledAtMs, loadRatio, availableMemoryMb, freeDiskGb, totalDiskGb, diskWarning, healthy, and more. |
leases |
object[] | Heavy and simulator leases: id, kind (heavy or simulator), state, seatId, holderId, pid, executable, createdAtMs, lastUsedAtMs, deviceId, usage, processUsage. |
queue |
object[] | Waiting heavy and simulator requests: id, kind, seatId, queuedAtMs, position, estimatedWaitMs, and device fields. |
lightLeases |
object[] | Light-lane leases. |
lightQueue |
object[] | Light-lane waits. |
serverLeases |
object[] | Long-running server leases, each with cpuCores. |
serverQueue |
object[] | Server waits. |
holderAlerts |
object[] | Leases held a long time or by a server: id, lane, reason (server or long-held), executable, createdAtMs. |
consumers |
object[] | The heaviest processes, when reported. |
loadRetryAfterMs |
integer | Present under load: how long until the load is expected to clear. |
Times ending in Ms are Unix epoch milliseconds.
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control, or lost it during the read. |
| 503 | fleet_resources_unavailable |
The first registry read has not finished, or a machine query parameter was given. |
curl -sS http://127.0.0.1:4310/v1/operator/fleet-resources \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"List simulators
GET /v1/operator/fleet-resources/simulators
Returns the simulator leases agents hold and any booted simulators no lease owns.
Auth: Operator token, or device session with Take Control.
Response 200
| Field | Type | Description |
|---|---|---|
schemaVersion |
integer | Always 1. |
leases |
object[] | Simulator leases (fields below). |
leases[].id |
string | Lease ID. |
leases[].seatId, .holderId, .occupantId |
string | Who holds it. holderId is optional. |
leases[].fleet |
string | Fleet the seat belongs to, when not local. |
leases[].phase |
string | Lease phase. |
leases[].createdAtMs, .lastUsedAtMs |
integer | Epoch milliseconds. |
leases[].deviceId, .deviceName, .deviceType, .runtime |
string | The leased device. |
leases[].origin |
string | created or existing. |
leases[].requestedDeviceType |
string | Present when a close model stood in for the requested type. |
leases[].usage |
object | Measured CPU and memory of the simulator. |
inventory |
string | available or unavailable. |
externalActive |
integer or null | Booted simulators no lease owns. |
external |
object[] | Those simulators: udid, name, state, runtime, deviceType, holders (pid, executable, seatId, pane), usage. |
simulatorSlots |
integer | The simulator limit. |
hint |
string | Advice text, when there is some. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control, or lost it during the read. |
curl -sS http://127.0.0.1:4310/v1/operator/fleet-resources/simulators \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Read machine setup context
GET /v1/operator/fleet-settings/context
Resolves the autonomy policy that applies to a working directory (global, or its project's) and whether the target machine is linked. Machine setup reads this before it changes anything.
Auth: Operator token, or device session with Take Control.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
workingDirectory |
string | Yes | Absolute path of an existing directory. |
machine |
string | Yes | local, default, a connection ID or a machine ID. |
projectId |
string | No | The project you expect the directory to belong to. |
Response 200
| Field | Type | Description |
|---|---|---|
schemaVersion |
integer | Always 1. |
effective |
object | Effective policy: closure, machineSetup, commit, push (lead or owner), release (mode: lead, owner or time_rule with rule), verification, reportingStyle, and gates everydayWork, leavesMac, hardToUndo (allow, lead or owner) and moneyAndAccounts (owner). |
workingPreferences |
boolean | Always true. |
fleetGates |
boolean | Always true. |
projectId |
string | The project the directory belongs to, when any. |
machine.id |
string | Resolved machine ID. |
machine.linked |
boolean | Whether the machine is linked. |
machine.targetRevision |
string | SHA-256 hex revision of the resolved target. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | invalid_fleet_settings_context |
Missing or invalid query parameters. |
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control. |
| 409 | fleet_settings_context_unavailable |
The directory is missing, its project is ambiguous or does not match projectId, the machine is not registered, or settings changed during the read. Includes detail. |
curl -sS -G http://127.0.0.1:4310/v1/operator/fleet-settings/context \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
--data-urlencode "workingDirectory=$PWD" \
--data-urlencode "machine=local"Checkouts
The owner's checkouts are the local repositories registered in project settings. clankie doctor reads this report.
Report checkouts
GET /v1/checkouts
Reports each registered checkout against its cached origin/main, and lists linked worktrees that hold work missing from main.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
observedAt |
string | ISO 8601 time of the report. |
refFreshness |
string | Always cached-origin/main: compared with the last fetched main, without fetching. |
checkouts |
object[] | One per checkout. |
checkouts[].path |
string | Checkout path. |
checkouts[].outcome |
string | observed or unavailable. |
checkouts[].branch, .head, .remoteMain |
string | Current branch, HEAD and cached main commit. |
checkouts[].ahead, .behind |
integer | Commits ahead of and behind main. |
checkouts[].dirty |
boolean | Whether there are uncommitted changes. |
checkouts[].linkedWorktrees, .staleWorktrees |
integer | Linked and stale worktree counts. |
checkouts[].unreconciled |
object[] | Worktrees with unlanded commits or uncommitted files, oldest first. |
checkouts[].unreconciled[].path, .branch, .head |
string | The worktree. |
checkouts[].unreconciled[].state |
string | reconciled, unreconciled or unknown. |
checkouts[].unreconciled[].unlandedCommits, .dirtyFiles |
integer | Work not on main. |
checkouts[].unreconciled[].lastActivityAt |
string | ISO 8601 time of last activity. |
checkouts[].unreconciled[].ageSeconds |
integer | Seconds since last activity. |
checkouts[].unreconciled[].owner |
string | Quoted names of the agents working there, or unattributed. |
checkouts[].unreconciled[].reason |
string | Why the state is what it is, when given. |
checkouts[].reason |
string | Why a checkout is unavailable. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | operator_authentication_required |
No valid operator token. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS http://127.0.0.1:4310/v1/checkouts \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Sync checkouts
POST /v1/checkouts/sync
Brings registered checkouts up to date with main. Without repository, syncs every registered checkout.
Auth: Operator token.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
repository |
string | No | Path of one registered checkout. |
Response 200
An array with one object per checkout:
| Field | Type | Description |
|---|---|---|
path |
string | Checkout path. |
outcome |
string | current, updated, blocked or unavailable. |
before, after |
string | Commit before and after. |
reason |
string | Why it was blocked or unavailable. |
blockers |
object[] | What blocked it: path, ageSeconds. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | invalid_request |
The request is not JSON or has unknown fields. |
| 401 | operator_authentication_required |
No valid operator token. |
| 409 | refused |
repository is not a registered checkout, or the sync failed. Includes message. |
| 503 | operator_authentication_unavailable |
The operator credential could not be checked. |
curl -sS -X POST http://127.0.0.1:4310/v1/checkouts/sync \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'Updates
A Clankie installation that runs from a source checkout updates itself in place. These routes read and request updates, manage the post-update canary, and place deploy holds that keep an update from restarting the service while work is in flight. Installations that cannot update in place answer 503 runtime_updates_unavailable on the update routes.
Read update status
GET /v1/runtime-update
Returns the running runtime, the latest update and its phase, any batched update waiting to apply, deploy holds and canary results.
Auth: Operator token.
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
ref |
string | No | A git ref to preview. Adds target to the response. |
Response 200
| Field | Type | Description |
|---|---|---|
runtime |
object | The running service: root, commit, instanceId, pid. |
phase |
string | Phase of the latest update: scheduled, installing, stopping, activating, restarting, healthy, refused, failed, rolled-back, stop-unconfirmed, canary-pending or canary-failed. |
latest |
object | The latest update: id, ref, oldCommit, newCommit, phase, updatedAt, healthy, reason, error, resolvedRef, warning, initiator, canary, serviceReceipts, ownerCheckoutSync, and more. |
pending |
string | ID of the update in progress. |
deferred |
object | A batched update waiting to apply: ref (main), firstRequestedAt, lastRequestedAt, dueAt, requests, initiator. |
canary |
object | Canary result: state (pending, passed, failed), samples, cpuMeanPercent, healthP95Ms, startedAt, completedAt, error, and more. |
canaryPolicy |
object | Canary policy (see the canary routes). |
canaryCpu |
object or null | CPU of this runtime compared with the previous one. |
holds |
object[] | Current deploy holds (see deploy holds). |
target |
object | With ref: ref, newCommit, resolvedRef, commitCount, summary (string[]), warning. |
retention |
object | Last cleanup of old runtimes: outcome, at, removedCount, retainedCount, removed, retained. |
needsReconciliation |
boolean | true when the last update's outcome is uncertain. |
blockedReason |
string | update-in-progress or runtime-maintenance-busy. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | operator_required |
No valid operator token. |
| 403 | operator_revoked |
The operator token stopped being valid during the request. |
| 503 | runtime_updates_unavailable |
This installation cannot update in place. |
| 503 | update_status_unavailable |
Status or the preview could not be read. Includes needsReconciliation: true. |
curl -sS http://127.0.0.1:4310/v1/runtime-update \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Request an update
POST /v1/runtime-update
Asks the service to update to a ref (default main). An update that follows main may join a batch and apply later; pass now to apply at once. Deploy holds refuse the update unless the request overrides them.
Auth: Operator token.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
ref |
string | No | Git ref, 1 to 256 characters. Default main. |
now |
boolean | No | Apply at once instead of joining a batch. |
overrides |
object[] | No | Up to 32 holds to override, each holdId (UUID), actor and reason. |
overrideHolds |
boolean | No | Override every hold. Requires reason and no overrides. |
reason |
string | With overrideHolds |
Why every hold is overridden. Not allowed otherwise. |
Response 202 when accepted or batched, 200 when already up to date, 409 when not accepted
The update status (as in Read update status) plus:
| Field | Type | Description |
|---|---|---|
accepted |
boolean | Whether the update started. |
deferred |
object | Present when the update joined a batch. |
upToDate |
boolean | true when the runtime already runs the ref. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | invalid_update_request |
Invalid request, or overrideHolds and reason do not match. |
| 409 | update_refused |
A deploy hold refused it, or the update failed to start. Includes detail; a hold refusal also includes the status and holds. |
| 403 | operator_required |
No valid operator token. |
| 403 | override_owner_identity_required |
Overrides need an operator identity the token did not give. |
| 403 | operator_revoked |
The operator token stopped being valid during the request. |
| 503 | runtime_updates_unavailable |
This installation cannot update in place. |
curl -sS -X POST http://127.0.0.1:4310/v1/runtime-update \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"ref": "main", "now": true}'Cancel a batched update
DELETE /v1/runtime-update/deferred
Drops a batched update before it applies.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
cancelled |
boolean | false when there was no batched update. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | operator_required |
No valid operator token. |
| 403 | operator_revoked |
The operator token stopped being valid during the request. |
| 503 | update_batching_unavailable |
This installation has no update batching. |
curl -sS -X DELETE http://127.0.0.1:4310/v1/runtime-update/deferred \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Read the canary
GET /v1/runtime-update/canary
After an update, a canary samples the new runtime's health latency and CPU for a window before the update counts as healthy. This returns the canary policy and the latest result.
Auth: Operator token.
Response 200
| Field | Type | Description |
|---|---|---|
policy.windowMs |
integer | How long the canary samples. Default 300000. |
policy.sampleIntervalMs |
integer | Time between samples. Default 10000. |
policy.cpuPercent |
number | Advisory CPU level, reported beside the previous runtime's. Default 10. |
policy.healthLatencyMs |
number | Health latency limit. Default 250. |
canary |
object or null | The latest canary result: state (pending, passed, failed), samples, cpuMeanPercent, healthP95Ms, startedAt, completedAt, pressure, error, and more. |
cpu |
object or null | commit, cpuMeanPercent, advisoryPercent, aboveAdvisory, previous (commit, cpuMeanPercent, updateId), ratioToPrevious. |
Errors
| Status | error |
When |
|---|---|---|
| 403 | operator_required |
No valid operator token. |
| 403 | operator_revoked |
The operator token stopped being valid during the request. |
| 503 | runtime_canary_unavailable |
No canary is running for this boot. |
curl -sS http://127.0.0.1:4310/v1/runtime-update/canary \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Change the canary policy
PUT /v1/runtime-update/canary
Changes one or more canary policy values. The change applies to the next canary.
Auth: Operator token.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
windowMs |
integer | No | 1000 to 86400000. Must be at least two sample intervals and at most 3600 samples. |
sampleIntervalMs |
integer | No | 50 to 60000. |
cpuPercent |
number | No | Greater than 0, up to 10000. |
healthLatencyMs |
number | No | Greater than 0, up to 60000. |
Response 200
| Field | Type | Description |
|---|---|---|
policy |
object | The saved policy, all four fields. |
appliesTo |
string | Always next_canary. |
Errors
| Status | error |
When |
|---|---|---|
| 400 | invalid_canary_policy |
Unknown field or value out of range. |
| 403 | operator_required |
No valid operator token. |
| 403 | operator_revoked |
The operator token stopped being valid during the request. |
| 503 | runtime_canary_unavailable |
No canary is running for this boot. |
curl -sS -X PUT http://127.0.0.1:4310/v1/runtime-update/canary \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"windowMs": 600000}'Manage deploy holds
POST /v1/deploy-holds
Lists, places or releases deploy holds. A hold keeps updates from restarting the service for up to 60 minutes. The action field picks the operation.
Auth: Operator token.
Request body (JSON)
| Field | Type | Required | Description |
|---|---|---|---|
action |
string | Yes | list, hold or release. |
id |
string | hold, release |
UUID of the hold. For hold, chosen by the caller. |
holder |
string | hold |
Who holds it, 1 to 512 characters. |
reason |
string | hold, release |
Why, 1 to 512 characters. |
minutes |
integer | hold |
1 to 60. |
pane |
string | No | hold only: the pane holding it. |
seat |
string | No | hold only: the seat holding it. |
actor |
string | release |
Who releases it. |
list takes only action. Each action rejects fields it does not take.
Response 200
| Field | Type | Description |
|---|---|---|
ok |
boolean | true. |
holds |
object[] | Current holds: id, holder, reason, createdAt, expiresAt, pane, seat, presence (present, gone, unknown or person). |
receipts |
object[] | list and release: records of holds that ended, each action (release, override, expire), hold, actor, reason, at, operation. |
Errors
Error bodies carry ok: false.
| Status | error |
When |
|---|---|---|
| 400 | invalid_deploy_hold_request |
Invalid request. |
| 403 | operator_required |
No valid operator token. |
| 409 | (message) | The hold could not be placed or released; error carries the reason as text. |
curl -sS -X POST http://127.0.0.1:4310/v1/deploy-holds \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"action": "hold", "id": "'"$(uuidgen | tr A-Z a-z)"'", "holder": "release check", "reason": "running the release checks", "minutes": 30}'Moving Clankie to another machine
Clankie is active on one machine at a time. The CLI and app move it to another machine by stepping through the routes below on both machines. While Clankie is on another machine, this service answers only /health, these routes and device sign-in; every other route answers 503 with error: "body_dormant".
Read move status
GET /v1/body-transfer/status
Reports whether Clankie is active on this machine, where it went if it moved away, and every move this machine has taken part in.
Auth: Operator token, or device session with Take Control.
Response 200
| Field | Type | Description |
|---|---|---|
state |
string | active, frozen (handing over) or released (moved away). |
dormant |
boolean | true when Clankie is not running on this machine. |
epoch |
integer | Move counter; increases with each move. |
selfId |
string | UUID of this Clankie. Absent before the first move. |
transferId |
string | UUID of the move that set the current state. |
releasedTo |
object | While released: peer (where Clankie went), epoch, at. |
bodyIdentity |
object | This machine's public keys: signingKey, encryptionKey. |
proof |
object | Present on a machine that received Clankie by a completed move: a signed statement that it is active. |
transfers |
object | Every move this machine took part in, keyed by transfer UUID (fields below). |
transfers.<id>.role |
string | source or destination. |
transfers.<id>.outcome |
string | frozen, released, aborted, staged, applying, applied or burned. |
transfers.<id>.epoch |
integer | Epoch of the move. |
transfers.<id>.peer |
string | The other machine. |
transfers.<id>.at |
string | ISO 8601 time of the last step. |
transfers.<id>.destinationMachineId |
string | Source only: the destination's machine ID. |
transfers.<id>.replace |
boolean | Destination only: the move replaced existing history. |
bootError |
string | Present when a staged move could not be applied at startup. |
Errors
| Status | error |
When |
|---|---|---|
| 401 | authentication_required |
No valid operator token or device session. |
| 403 | forbidden |
The device lacks Take Control. |
curl -sS http://127.0.0.1:4310/v1/body-transfer/status \
-H "Authorization: Bearer $CLANKIE_OPERATOR_TOKEN"Move steps
The CLI and app call these during a move. Each route checks this machine's state and refuses a step that does not fit it.
| Method | Path | Purpose | Credential |
|---|---|---|---|
POST |
/v1/body-transfer/prepare |
Issue a short-lived ticket the other machine uses to verify this one. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/freeze |
On the source: stop Clankie and hand it to a named destination. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/bundle |
On the source: download the move bundle in chunks. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/stage-chunk |
On the destination: upload one bundle chunk. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/stage |
On the destination: check the uploaded bundle and stage it. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/apply |
On the destination: apply the staged move and restart. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/release |
On the source: confirm the destination is active. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/discard |
On the destination: cancel a move that was not applied. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/abort |
On the source: take Clankie back after the destination discarded the move. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/reclaim |
Force this machine to run Clankie again, with a stated reason. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/rebind |
On the destination: point moved workspaces at the source machine once it has joined. | Operator token, or device session with Take Control |
POST |
/v1/body-transfer/peer |
Answer the other machine's verification request. | None (called by the other machine) |