openapi: 3.1.0 info: title: aiman gateway version: 0.3.0 description: > HTTP and WebSocket surface in front of `aiman serve`. Every request needs a bearer token except GET /v1/health and POST /v1/pair. The token is the host token (full access, used by the TUI) or a device token minted by POST /v1/pair. Device tokens pass a method allowlist on /v1/rpc, deny by default; destructive methods, the terminal WebSocket and to-do edits that close, drop, rename or remove a gate item also need the device's allow_destructive flag. Every request also passes the tailnet identity check. POST /v1/rpc is the whole API; REST reads are conveniences over the same socket methods. servers: - url: / security: - bearerAuth: [] tags: - name: health - name: rpc - name: sessions - name: events - name: terminal - name: pairing - name: devices paths: /v1/health: get: tags: [health] security: [] operationId: health summary: Unauthenticated liveness. No version, no session data. responses: "200": description: Process is up content: application/json: schema: $ref: "#/components/schemas/Health" /v1/pair: post: tags: [pairing] security: [] operationId: pair summary: > Redeem a pairing code from `aiman-gateway pair` for a device token. Needs no bearer token but still the tailnet identity check. The code is single use and valid 5 minutes. More than 5 failed codes in a minute lock pairing for the rest of that minute. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PairRequest" responses: "200": description: Code consumed; the token is shown only here content: application/json: schema: $ref: "#/components/schemas/PairResponse" "400": description: Invalid JSON (invalid_params) content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "401": description: Unknown, used or expired code (invalid_code) content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "403": description: No tailnet identity, or login not on the allow-list (forbidden) content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "429": description: Pairing locked after too many failed codes (locked) content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "503": description: Pairing is not configured on this gateway (unavailable) content: application/json: schema: $ref: "#/components/schemas/RpcResponse" /v1/devices: get: tags: [devices] operationId: listDevices summary: Paired devices. Token hashes are never returned. responses: "200": description: Device list content: application/json: schema: $ref: "#/components/schemas/DeviceList" "401": description: unauthorized "403": description: forbidden /v1/devices/{id}: delete: tags: [devices] operationId: revokeDevice summary: > Revoke a device; its token stops working at once. A device token may revoke itself; revoking another device takes the host token or allow_destructive. parameters: - in: path name: id required: true schema: type: string responses: "204": description: Revoked "401": description: unauthorized "403": description: Revoking another device without allow_destructive (forbidden) content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "404": description: No such device (not_found) content: application/json: schema: $ref: "#/components/schemas/RpcResponse" /v1/rpc: post: tags: [rpc] operationId: rpc summary: JSON-RPC-shaped proxy onto the unix socket, plus gateway-owned push methods. requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/RpcRequest" responses: "200": description: Socket result content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "400": description: Invalid JSON, missing method, streaming method used over RPC, or socket-level error content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "401": description: Missing or wrong bearer token "403": description: > Tailnet WhoIs failed, login not on the allow-list, a device token calling a method outside its allowlist, or a device without allow_destructive closing, dropping, renaming or removing a gate to-do through todo.update or todo.remove "502": description: Unix socket call failed /v1/sessions: get: tags: [sessions] operationId: listSessions summary: session.list over GET. parameters: - in: query name: group schema: type: string responses: "200": description: session.list result wrapped in RpcResponse content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "401": description: unauthorized "403": description: forbidden /v1/sessions/{id}: get: tags: [sessions] operationId: getSession summary: session.get over GET. parameters: - $ref: "#/components/parameters/SessionId" responses: "200": description: session.get result wrapped in RpcResponse content: application/json: schema: $ref: "#/components/schemas/RpcResponse" "401": description: unauthorized /v1/sessions/{id}/terminal: get: tags: [terminal] operationId: attachTerminal summary: > WebSocket bridge of pty.attach. A device token needs allow_destructive. Phone UI is deferred. parameters: - $ref: "#/components/parameters/SessionId" - in: query name: cols schema: type: integer default: 80 - in: query name: rows schema: type: integer default: 24 - $ref: "#/components/parameters/AccessToken" responses: "101": description: Switching protocols "401": description: unauthorized "403": description: Tailnet identity check failed, or a device without allow_destructive (forbidden) /v1/events: get: tags: [events] operationId: sessionEvents summary: > WebSocket of SessionEvent objects, one JSON text frame per event. Events are changes, not snapshots. Expect a keepalive roughly every 20s. parameters: - $ref: "#/components/parameters/AccessToken" responses: "101": description: Switching protocols "401": description: unauthorized components: securitySchemes: bearerAuth: type: http scheme: bearer parameters: AccessToken: in: query name: access_token required: false description: > Bearer token for WebSocket clients that cannot set a header. URLs carrying it are never logged. schema: type: string SessionId: in: path name: id required: true schema: type: string schemas: Health: type: object required: [ok] properties: ok: type: boolean AgentState: type: string enum: - waiting_input - working - waiting_background - idle - exited - errored - unknown StateConfidence: type: string enum: [high, low] Session: type: object required: [id, name, group, self] properties: limits: $ref: "#/components/schemas/LimitsReading" description: > What is left at the provider behind this session's agent. Only session.get fills it. Absent when the agent has no source, or until its source finishes a first run; ask again on the next poll. id: type: string name: type: string group: type: string pinned: type: boolean description: > The operator pinned the session (session.pin). Absent from an older serve, which stores no pin. parent_id: type: string description: The session that created this one; empty for a top-level session. role: type: string description: > Empty for an ordinary session. reviewer, handover and consult are aiman's hidden helpers: session.restart and session.terminate refuse them. fixer is visible: it pushes fixes to a PR. fix_pr: type: string description: owner/repo#n for a fixer session; empty otherwise. issue_key: type: string branch: type: string base_branch: type: string description: The ref the session's branch was cut from. repo_name: type: string repos: type: array description: > A workspace session's member repositories, in order; absent for a single-repo session. items: type: object required: [repo] properties: repo: type: string branch: type: string base_branch: type: string worktree_path: type: string tmux_session: type: string description: Terminal name; key kept for compatibility. worktree_path: type: string working_directory: type: string agent_name: type: string launch_model: type: string description: Model this session launches with; empty is the agent's default. launch_effort: type: string agent_session_id: type: string agent_session_path: type: string title: type: string description: Agent-set terminal title; the one-line "what is it doing". status: type: string state: $ref: "#/components/schemas/AgentState" state_confidence: $ref: "#/components/schemas/StateConfidence" state_message: type: string state_source: type: string ended: type: boolean self: type: boolean RpcError: type: object required: [code, message] properties: code: type: string description: > Serve's codes, plus invalid_code, locked, forbidden and internal, which the gateway returns itself. unavailable comes from either; from serve it means repo.list failed with nothing cached. worktree_dirty refuses session.terminate while removing the worktree would lose work, and data says what. needs_operator refuses a session's call to session.restart or session.terminate. land_parent_diverged, land_conflict (data lists files) and land_busy refuse session.land, which is not a device method. session_scope refuses a session's pty.create, pty.input, pty.run, pty.kill, pty.forget, session.prompt, session.forget or steer.send on anything but itself, a descendant or its own helper pty, except that session.prompt and steer.send (mode note) to a visible session outside the tree are queued as a peer note while sessions.peer_notes is on; the ledger records session.peer_note on both sessions. peer_queue_full refuses a peer note while the target holds 8 undelivered peer notes from the sender or 16 from anyone. legacy_terminal refuses both on a legacy tmux row. A serve older than this spec answers a method it does not have with invalid_params and the message "unknown method "; an older gateway answers a method missing from its allowlist with forbidden. The review.fix, review.push, review.assess and review.approve methods are not on the device allowlist. Their refusals: review_fix_fork (the PR is from a fork), review_fix_running (a fixer is running), review_fix_limit (three rounds used), review_fix_incomplete and review_fix_scope (review.push: missing commits, report or a path outside the findings' files), review_own_pr (the gh login opened the PR), review_blocking_open, review_not_assessed, review_assessment_rejected and review_already_approved (review.approve), plus review_not_ready, review_incomplete, review_head_moved and gate_needs_operator (gate:approve is closed only by an operator todo.update). aws.login_start refuses with aws_no_sso (the delegation has no SSO facts), aws_rate_limited (too many pending logins or recent starts), invalid_params (the profile is not delegated) and needs_operator (a session caller). aws.login_status answers not_found for a login id serve no longer holds. aws.log answers needs_operator for a session caller. ci.local, ci.status, ci.gate and ci.ready (the local CI gate) are not on the device allowlist; they answer unavailable on a serve without the gate, and ci.local refuses ci_running (a run for the session is queued or running), ci_dirty (uncommitted or untracked files) and ci_no_list (no .aiman/ci-local.yaml at HEAD and no repos..ci.local). A run waits in a FIFO host queue (host.load.ci_parallel, default 2, and the pressure gate): its record status is queued, then running, then pass or fail, and ci.status carries queue_position (1 is next) while it is queued. ci.ready refuses ci_not_ready until the tree is clean, HEAD is the open PR's head, the gate passed for HEAD and verify passed when before_pr is on; then serve runs gh pr ready. Until their handlers land, the aws.* methods answer unavailable. session.transcript, session.transcript_item and session.process_output answer unavailable on a serve with no transcript reader, not_found for an unknown session, item or process, session_scope for a session caller outside its own tree, and serve's own forbidden when a process output path resolves outside the session's directories. session.file answers unavailable for a session with no worktree or working directory, forbidden for a path outside them, under a .git directory or named like a secret, not_found for a missing file, invalid_params for a directory, and session_scope for a session caller outside its own tree. Any method may answer server_busy (no free slot within 50ms) or rate_limited (a session over its per-minute budget); both carry data.retry_after_ms, and the CLI retries once after it. session.create, review.run, review.coverage, review.fix and review.assess answer host_under_pressure while the host pressure gate is closed, with data.retry_after_ms (30000), memory_full_avg10, memory_some_avg10 and since; the CLI does not retry it, and a caller waits at least retry_after_ms before trying again. harness.up joins them, and force passes the gate for the operator only. The harness.* methods answer unavailable on a serve without the harness (harness.enabled false, or no docker). Their refusals: harness_no_file (no .aiman/harness.yaml at the commit and no repos..harness), harness_invalid (data.errors), harness_unknown_scenario, harness_submodule (data.path), harness_too_large (the run's memory sum is over harness.run_memory; data.sum and data.limit in bytes), harness_dirty (uncommitted or untracked files without dirty; data.paths), harness_image_missing (only with image vetting off: an image not in harness.allowed_images or not on the host; data.image), harness_running (the session already has a live run), harness_busy (harness.max_runs live runs on the host), harness_not_running (no run, or the run is not ready) and harness_service_failed (data.service and data.tail). With image vetting on, harness.up refuses a run whose image is not approved yet with harness_image_pending (data.digest, data.ref, data.stage of queued, fetch, cve, static, review, awaiting_approval or load, and data.retry_after_ms 15000), a blocked, failed or stale image with harness_image_blocked (data.digest, data.ref, data.state, data.reasons, data.critical, data.static_hits, data.verdict), a ref the registry does not resolve with harness_image_resolve_failed (data.ref), and an image over harness.images.max_size with harness_image_too_large (data.size, data.limit, before any fetch). harness.image_approve answers harness_image_not_pending (data.digest, data.state) for a digest that is not pending_approval without accept_risk, gate_needs_operator for a session that holds no open gate for the digest, needs_operator for a session's accept_risk, and invalid_params for a session's empty quote or the operator's accept_risk without a reason. harness.up with debug answers harness_invalid when the file has no app.debug or app.run cannot be started under the debugger, and harness_debug_unsupported (data.lang) for an app.debug.lang with no adapter on the host (go, node, bun and python have one). harness.debug answers needs_operator for a session's take or release. harness.check with debug answers needs_operator for a session caller, invalid_params on a run that is not a debug run or for a check with no debug block, harness_debug_unsupported (reason check_lang) for a go check, and harness_debug_busy (data.target app or check:) while another debug check runs or, without take, while a client holds the app's debugger. harness.verdict answers needs_operator for a session caller, and every harness method answers session_scope for a session outside the caller's tree. enum: - invalid_params - not_found - name_taken - server_not_running - already_running - agent_blocked - timeout - create_failed - publish_failed - jira_unavailable - protocol_mismatch - no_reviewer_agent - no_preferred_agent - legacy_terminal - gate_needs_operator - design_not_approved - consult_needs_smart - overview_running - review_exists - review_not_ready - review_incomplete - review_head_moved - review_already_posted - review_no_coverage - review_fix_fork - review_fix_running - review_fix_limit - review_fix_incomplete - review_fix_scope - review_own_pr - review_blocking_open - review_not_assessed - review_assessment_rejected - review_already_approved - worktree_dirty - needs_operator - session_scope - aws_no_sso - aws_rate_limited - ci_running - ci_dirty - ci_no_list - harness_no_file - harness_invalid - harness_unknown_scenario - harness_submodule - harness_too_large - harness_dirty - harness_image_missing - harness_running - harness_busy - harness_not_running - harness_service_failed - harness_image_pending - harness_image_blocked - harness_image_resolve_failed - harness_image_too_large - harness_image_not_pending - harness_debug_unsupported - harness_debug_busy - server_busy - rate_limited - host_under_pressure - unavailable - invalid_code - locked - forbidden - internal message: type: string data: description: The refusal's detail, for the codes that have one. oneOf: - $ref: "#/components/schemas/WorktreeDirtyData" - $ref: "#/components/schemas/RetryAfterData" - $ref: "#/components/schemas/NeedsDestructiveData" - $ref: "#/components/schemas/HostUnderPressureData" - $ref: "#/components/schemas/HarnessRefusalData" HostUnderPressureData: type: object description: The detail of host_under_pressure, the gate when it answered. required: [retry_after_ms, memory_full_avg10, memory_some_avg10, since] properties: retry_after_ms: type: integer description: Wait at least this long; 30000. memory_full_avg10: type: number memory_some_avg10: type: number since: type: string format: date-time description: When the gate closed. reason: type: string enum: [memory_full, harness_budget] description: Why the gate closed. harness_held_bytes: type: integer description: > Memory the harness runs held when the gate closed; set only for reason harness_budget. HarnessGate: type: object description: > Memory held (anon plus shmem) by the containers of every harness run, grouped by compose project. The containers run under Docker, outside the user slice, so the gate counts them against the slice's memory.high: over_budget is true when slice_held_bytes plus held_bytes reaches budget_bytes, and that closes the gate (reason harness_budget) until the sum stays under 90% of it for the hold. budget_bytes is absent when the slice has no finite memory.high; the memory is then reported only. required: [held_bytes, over_budget] properties: held_bytes: type: integer slice_held_bytes: type: integer budget_bytes: type: integer over_budget: type: boolean source: type: string enum: [cgroup, stats, mixed] description: Where the values came from, cgroup files or docker stats. error: type: string description: The last failed read; the values are then the last good read. runs: type: array items: type: object required: [run, project, held_bytes, containers] properties: run: type: string project: type: string description: The compose project, harness-. held_bytes: type: integer containers: type: integer PressureGate: type: object description: > The host pressure gate. It closes when the user slice's memory full avg10 reaches host.load.pressure_gate.memory_full_avg10 (default 20) and opens after hold (30s) in a row below reopen_full_avg10 (10). some and slice_over_high are reported and never close it. Harness memory also closes it (see HarnessGate). While closed, serve refuses new sessions, helper spawns and review runs with host_under_pressure and CI runs wait. required: [closed, since, memory_some_avg10, memory_full_avg10, slice_over_high] properties: closed: type: boolean since: type: string format: date-time description: When the gate last closed or opened; zero before the first change. memory_some_avg10: type: number memory_full_avg10: type: number slice_over_high: type: boolean description: The user slice is at or above its memory.high. reason: type: string enum: [memory_full, harness_budget] description: Why a closed gate closed; absent while open. harness: $ref: "#/components/schemas/HarnessGate" NeedsDestructiveData: type: object description: > The detail of the gateway's 403 forbidden when a device token lacks allow_destructive: for a method in the destructive set, the terminal WebSocket (method pty.attach), a gate change through todo.update or todo.remove, and revoking another device (no method). A method outside the device allowlist entirely gets forbidden with no data, as does any refusal from a gateway older than this field. required: [needs] properties: method: type: string needs: type: string const: allow_destructive RetryAfterData: type: object description: The detail of server_busy and rate_limited. required: [retry_after_ms] properties: retry_after_ms: type: integer description: How long to wait before trying again. WorktreeDirtyData: type: object description: > What removing the worktree would lose. aiman's own scaffolding (.aiman_* files, the bundled skill, graphify-out, its .gitignore rule) does not count, and neither do files the repository ignores, which removal also deletes. required: [session, changed_files, paths, unpushed_commits] properties: session: type: string description: > The session whose worktree it is: the target, or a descendant that would be terminated with it. changed_files: type: integer description: Uncommitted and untracked files, all of them. paths: type: array maxItems: 20 description: Up to 20 of the changed files. items: type: string unpushed_commits: type: integer description: Commits on HEAD that no remote-tracking ref contains. RpcRequest: type: object required: [method] properties: id: type: string method: type: string description: > Every method serve answers on its socket, plus push.register, push.unregister and gateway.restart_serve, which the gateway answers itself. Device tokens reach only the allowlisted subset; the rest return 403. enum: - ping - session.list - session.get - session.read - session.transcript - session.transcript_item - session.process_output - session.file - session.log - session.replay - session.prompt - session.wait - session.create - session.rename - session.move - session.pin - session.forget - session.restart - session.terminate - session.land - repo.list - host.stats - host.version - host.update - host.daemons - host.logs - host.restart - resources.get - session.limits - session.adopt_scope - session.register - session.report_agent_session - notify.since - session.events_since - verify.start - verify.status - ci.get - ci.watch - ci.local - ci.status - ci.gate - ci.ready - context.put - context.get - context.list - context.find - context.pack - context.stats - context.verify - usage.get - limits.get - aws.status - aws.login_start - aws.login_status - aws.log - agents.status - agents.update - agents.move_prefix - agents.models - overview.run - overview.get - overview.list - feed.status - feed.actions - feed.batches - feed.events - feed.memory - feed.act - harness.up - harness.check - harness.status - harness.result - harness.down - harness.logs - harness.verdict - harness.list - harness.image_status - harness.image_approve - harness.debug - harness.files - harness.file - harness.evm_txs - harness.evm_trace - harness.db - harness.capture - harness.aws_plan - harness.aws - harness.aws_calls - harness.aws_write - harness.share - harness.unshare - harness.share_get - gateway.announce - design.publish - artifact.publish - artifact.list - artifact.get - artifact.share - artifact.unshare - artifact.delete - review.reveal - review.post - review.refresh - review.run - review.debug - review.coverage - review.fix - review.push - review.assess - review.approve - handover.write - handover.point - memory.jobs - memory.done - todo.get - todo.summary - todo.add - todo.update - todo.move - todo.remove - todo.mirror - todo.ensure_done - todo.mark_met - todo.gate - todo.approve_design - todo.approve_review - steer.send - pty.create - pty.list - pty.get - pty.input - pty.run - pty.wait-output - pty.capture - pty.resize - pty.kill - pty.forget - push.register - push.unregister - gateway.restart_serve params: $ref: "#/components/schemas/RpcParams" StreamMethod: type: string description: > Socket methods that take over the connection instead of answering once. /v1/rpc refuses them; pty.attach is reached through /v1/sessions/{id}/terminal and session.events through /v1/events. enum: - pty.attach - session.events RpcParams: type: object additionalProperties: true properties: id: type: string group: type: string pinned: type: boolean description: session.pin; true pins the session, false unpins it. Operator only. lines: type: integer description: host.logs and harness.logs; default 200, at most 1000. daemon: type: string enum: [serve, gateway, trigger] description: Target of host.logs and host.restart. refresh: type: boolean description: Read again instead of answering from a cache (host.daemons, limits.get, agents.status). text: type: string force: type: boolean description: > Override the default refusal. Phone UX confirms before sending force true. Against today's unix socket, answering a waiting_input session also requires force true. On session.create, review.run, review.coverage, review.fix, review.assess and harness.up it passes a closed pressure gate; only the operator may send it there (a session gets needs_operator). token: type: string description: Expo push token. Never log this value. session: type: string description: > Target of session.restart and session.terminate (id or name). Every method that takes id also takes session; id wins when both are sent, except on session.transcript_item and session.process_output, where session names the session and id the item or process. The harness.* methods take session (default: the caller) and run. subagent: type: string description: > session.transcript, session.transcript_item and session.process_output: a sub-agent id from a subagent item; empty reads the parent conversation. before: type: string description: > session.transcript: an opaque cursor from a reply's before; returns the page above it. Exclusive with after (invalid_params). after: type: string description: > session.transcript: an opaque cursor from a reply's after; returns new items, changed items and removed ids past it. A reply cut by the limit or the 2 MiB cap stops short of the end: call again with its after until a reply is empty. after_id: type: integer format: int64 description: > harness.capture: a flow id from a reply's next; returns the flows above it. Default 0. limit: type: integer description: > session.transcript page size; default 50, maximum 200. aws.log: the most rows to return; 0 or absent is the ledger's default. session.file and harness.file: the most bytes of data; default 65536, capped at 262144. harness.db: the most rows; default and maximum harness.db.row_limit (200). harness.capture: the most flows; default 50, maximum 200. path: type: string description: > session.file, required. Absolute, or relative to the session's working directory. Served only inside the session's worktree or working directory after symlinks; never a path with a .git element or a base name .env, .env.*, *.pem, *.key, id_rsa*, id_ed25519* or credentials (forbidden). harness.file, required: relative to the run's exported tree, or a container path under /src as a debugger's stack frame names it; the same rules apply inside that tree. offset: type: integer format: int64 description: > session.file and harness.file: byte offset to read from; default 0. Past the end answers empty data with eof true. The next page starts at the reply's offset plus the byte length of its data. since_seq: type: integer format: int64 description: aws.log, the rows after this ledger seq; absent starts at the first. tail: type: integer description: > session.log: read the newest tail events (oldest of them first) instead of paging from since_seq; it goes without since_seq and limit. since: type: integer format: int64 description: > session.process_output: byte offset to read from; absent reads the last 256 KiB. discard: type: boolean description: > session.terminate: remove a linked worktree even though it holds uncommitted changes or unpushed commits (git worktree remove --force). The branch is never deleted. Send it only after showing the worktree_dirty data and confirming. keep_children: type: boolean description: > session.terminate: leave the session's visible descendants running with no parent, listed in children_left. By default every descendant is terminated with it. agent: type: string description: > session.create: agent command from agents.status; empty picks from the model tiers. session.restart: required; a different agent than the session's is a switch, which clears the launch model, effort and vendor identity, and an agent not installed is invalid_params. model: type: string description: > Launch model for session.create and session.restart. Needs agent on create. On a same-agent restart, empty keeps the session's model. effort: type: string description: Launch effort, with the same rules as model. repo: type: string description: session.create, owner/name from repo.list. Required unless quick or repos. repos: type: array minItems: 2 maxItems: 8 description: > session.create, a workspace session over 2 to 8 repositories with one worktree each on the same branch. Repos are unique ignoring case. Exclusive with repo, quick, review, consult, existing_branch and dir; any of those, or a bad repo or base, is invalid_params. items: type: object required: [repo] properties: repo: type: string description: owner/name. base: type: string description: Ref to cut this repo's branch from; empty is its default branch. branch: type: string description: session.create. Empty derives it from name, adding a suffix if that worktree exists. A branch or a name is required unless quick. existing_branch: type: boolean description: session.create starts from this existing branch instead of cutting one. base: type: string description: session.create, the ref to cut the branch from. quick: type: boolean description: session.create, an ad-hoc session with no repository or worktree. prompt: type: string description: session.create, the agent's first prompt, delivered before create answers. name: type: string description: > Free text. session.create or session.rename; session.create uses the branch when empty, and q1, q2 and so on for quick. harness.check: the one check to run; empty runs every check. Required with debug. run: type: string description: > harness.status, harness.result, harness.check, harness.logs, harness.capture, harness.down and harness.verdict: the run id. Absent takes the session's live run, and for status, result, logs, capture and verdict its newest kept run when none is live. scenario: type: string description: harness.up, required. A scenario id from harness.list. dirty: type: boolean description: > harness.up: run the working tree with its uncommitted and untracked files. The run and its verdicts record HEAD plus a sha256 of the changes. debug: type: boolean description: > harness.up: run the app under the debug adapter of app.debug.lang (go: dlv dap from the pinned, host-built Delve) on the run's debug network; the edge relays it as the port named dap. With no app.debug, a scenario with debug checks gets a run that debugs only its checks. harness.check: run the named check as the run's debug target (operator only; see HarnessCheckResult). debug_checks: type: boolean description: > harness.up: a debug run that debugs only the scenario's checks; the app runs plainly whatever app.debug says (the fallback when the app's runtime cannot be debugged). take: type: boolean description: > harness.check with debug: close a client holding the app's debugger instead of answering harness_debug_busy. op: type: string enum: [status, take, release, tables, rows, query] description: > harness.debug (status, take, release); default status. take and release close every connection of the current debugger lease, operator only. harness.db (tables, rows, query), required: list the tables, read the rows of table, or run sql. table: type: string description: > harness.db with op rows, required: schema.table for postgres (no dot is the search path), the table name for SQLite. sql: type: string description: > harness.db with op query, required, at most 16 KiB. A read is one statement: a single trailing semicolon is dropped, any other semicolon and the words COPY, INTO and SET are refused with harness_db_refused, and SQLite also refuses ATTACH, DETACH and PRAGMA. write: type: boolean description: > harness.db: run sql as the database's owner instead of the read role. Operator only (needs_operator for a session caller); serve records harness.db_write with the statement's sha256, never its text. wait: type: boolean description: "harness.up: hold the call up to 20s for the run to leave starting." service: type: string description: > harness.logs, required: app, edge or a service name of the scenario. harness.db, required: a scenario service with a postgres or sqlite database (the run's databases). harness.evm_txs and harness.evm_trace: an evm service of the run; absent names the run's only one. tx: type: string description: "harness.evm_trace, required: a transaction hash, 0x and 64 hex digits." blocks: type: integer description: harness.evm_txs; how many recent blocks to scan, default 20, at most 64. step: type: integer description: harness.verdict; 0 or absent is the whole scenario, 1 and up a step. result: type: string enum: [pass, fail, skip] description: harness.verdict, required. note: type: string description: harness.verdict; the first line of a fail's note becomes the to-do text. tester: type: string description: "harness.verdict; the login of a shared console's tester. The ledger actor becomes tester:." console_port: type: integer description: gateway.announce, required; the port the gateway's console listens on. scheme: type: string enum: [http, https] description: gateway.announce, required. pid: type: integer description: gateway.announce; the gateway's process id. digest: type: string description: > harness.image_status (or ref) and harness.image_approve, required for approve: the platform manifest digest, sha256:. ref: type: string description: harness.image_status, an image ref; the newest record for it. quote: type: string description: > harness.image_approve from a session: the operator's words, as todo.approve_design takes them. Required and non-empty. accept_risk: type: boolean description: > harness.image_approve, operator only: approve a blocked, failed or stale digest. Needs reason. reason: type: string description: harness.image_approve with accept_risk, required. tier: type: string enum: [smart, worker] description: session.create, exclusive with agent. A session the user starts defaults to smart. dir: type: string description: session.create, the subdirectory the agent starts in. issue: type: string description: session.create, the JIRA key. check: type: boolean description: > aws.status: also confirm each credential works with get-caller-identity. profile: type: string description: aws.login_start, required. The delegated AWS profile to sign in. login_id: type: string description: aws.login_status, required. From the aws.login_start result. device_id: type: string states: type: array items: $ref: "#/components/schemas/AgentState" RpcResponse: type: object properties: id: type: string result: oneOf: - $ref: "#/components/schemas/PongResult" - $ref: "#/components/schemas/SessionListResult" - $ref: "#/components/schemas/SessionGetResult" - $ref: "#/components/schemas/PaneReadResult" - $ref: "#/components/schemas/TranscriptPage" - $ref: "#/components/schemas/TranscriptItemResult" - $ref: "#/components/schemas/ProcessOutputResult" - $ref: "#/components/schemas/FileResult" - $ref: "#/components/schemas/PromptResult" - $ref: "#/components/schemas/PushRegisterResult" - $ref: "#/components/schemas/PushUnregisterResult" - $ref: "#/components/schemas/RepoListResult" - $ref: "#/components/schemas/SessionTerminatedResult" - $ref: "#/components/schemas/HostStatsResult" - $ref: "#/components/schemas/HostVersionResult" - $ref: "#/components/schemas/HostUpdateResult" - $ref: "#/components/schemas/HostDaemonsResult" - $ref: "#/components/schemas/HostLogsResult" - $ref: "#/components/schemas/HostRestartResult" - $ref: "#/components/schemas/GatewayRestartServeResult" - $ref: "#/components/schemas/ResourcesResult" - $ref: "#/components/schemas/SessionLimitsResult" - $ref: "#/components/schemas/SessionScopeResult" - $ref: "#/components/schemas/LimitsResult" - $ref: "#/components/schemas/AWSStatusResult" - $ref: "#/components/schemas/AWSLoginResult" - $ref: "#/components/schemas/AWSLogResult" - $ref: "#/components/schemas/AgentsStatusResult" - $ref: "#/components/schemas/OverviewRunResult" - $ref: "#/components/schemas/OverviewRunsResult" - $ref: "#/components/schemas/ReviewFixResult" - $ref: "#/components/schemas/ReviewPushResult" - $ref: "#/components/schemas/ReviewAssessResult" - $ref: "#/components/schemas/ReviewApprovedResult" - $ref: "#/components/schemas/HarnessRunResult" - $ref: "#/components/schemas/HarnessListResult" - $ref: "#/components/schemas/HarnessResultResult" - $ref: "#/components/schemas/HarnessCheckResult" - $ref: "#/components/schemas/HarnessLogsResult" - $ref: "#/components/schemas/HarnessDBResult" - $ref: "#/components/schemas/HarnessVerdictResult" - $ref: "#/components/schemas/HarnessDebugResult" - $ref: "#/components/schemas/HarnessFilesResult" - $ref: "#/components/schemas/HarnessFileResult" - $ref: "#/components/schemas/HarnessEVMTxsResult" - $ref: "#/components/schemas/HarnessEVMTraceResult" - $ref: "#/components/schemas/HarnessCaptureResult" - $ref: "#/components/schemas/HarnessImageResult" - $ref: "#/components/schemas/HarnessImagesResult" error: $ref: "#/components/schemas/RpcError" PongResult: type: object required: [type] properties: type: type: string const: pong version: type: string protocol: type: integer SessionListResult: type: object required: [type, sessions] properties: type: type: string const: session_list sessions: type: array items: $ref: "#/components/schemas/Session" OverviewRun: type: object description: > One overview run: a hidden smart-tier agent that read every visible session on the host (facts, to-do list, transcript tail) and wrote what is in progress, what needs the operator, what comes next and the risks. overview.list leaves markdown and report out. required: [id, agent, state, started_at, sessions] properties: id: type: string session: type: string description: The hidden session that ran it; gone once the run ended. agent: type: string model: type: string state: type: string enum: [starting, running, done, failed] started_at: type: string format: date-time ended_at: type: string format: date-time error: type: string description: 'Why a failed run failed: ": " when a step failed.' needs_you: type: integer description: How many Needs you bullets the report has, set when the run is done. steps: type: array description: > The run's steps in order (collect, bundle, start_agent, report, cleanup), all pending when the run is created. A failed step fails the run and the later steps stay pending. items: $ref: "#/components/schemas/OverviewStep" sessions: type: integer description: Sessions the bundle held in full. names_only: type: array description: Sessions past the bundle cap, listed by name only. items: type: string markdown: type: string description: The report as written, on a done run. report: type: object description: The report's four sections, one entry per bullet. required: [in_progress, needs_you, next, risks] properties: in_progress: type: array items: type: string needs_you: type: array items: type: string next: type: array items: type: string risks: type: array items: type: string OverviewStep: type: object description: One phase of an overview run. required: [name, label, state] properties: name: type: string enum: [collect, bundle, start_agent, report, cleanup] description: Stable token. label: type: string description: Text a client shows (collect sessions, write bundle, start agent, write report, clean up). state: type: string enum: [pending, running, done, failed] started_at: type: string format: date-time ended_at: type: string format: date-time detail: type: string description: > What the step did (12 sessions, 412 KiB, claude (fable), 4 sections, 3 need you), or reminded: while the report step waits for a valid report. error: type: string description: Why a failed step failed. OverviewRunResult: type: object description: > overview.run answers at once with the run just created (starting, every step pending) and does the work in the background; the run's steps and the overview hub event report progress. overview.get answers the named run, else the running one, else the newest done run, plus latest. overview.get {summary: true} answers latest only, with no run, and no latest when there has never been a run. overview.run needs the operator, waits at the pressure gate, and answers overview_running while a run is in progress; on the gateway it needs allow_destructive. required: [type] properties: type: type: string const: overview_run run: $ref: "#/components/schemas/OverviewRun" running: type: string description: The id of a run still in progress when overview.get answered an older one. latest: allOf: - $ref: "#/components/schemas/OverviewRun" description: > overview.get only: the newest run of any state (a newer failure is never hidden behind an older done run), without markdown and report, with needs_you, steps, error and times. FeedStatusResult: type: object description: > feed.status. With the feed off only type, enabled, collector (state off) and settings are set. collector.state is not_started (no feed.db yet), starting, ok, stale (no poll in 10 minutes) or error. required: [type, enabled, collector] properties: type: type: string const: feed_status enabled: type: boolean collector: type: object properties: state: type: string error: type: string health: type: array items: type: object properties: source: {type: string} last_poll: {type: string, format: date-time} last_ok: {type: string, format: date-time} error: {type: string} calls: {type: integer} high_water: type: integer format: int64 pending: type: integer description: Events above the high-water mark (counted up to 1000). open_actions: type: integer high_actions: type: integer last_batch: $ref: "#/components/schemas/FeedBatch" batches_today: type: integer settings: type: object description: The feed config block serve read. FeedBatch: type: object properties: id: {type: integer, format: int64} event_ids: {type: array, items: {type: integer, format: int64}} up_to_event_id: {type: integer, format: int64} state: {type: string, enum: [running, done, failed]} attempts: {type: integer} agent: {type: string} model: {type: string} summary: {type: string} error: {type: string} started_at: {type: string, format: date-time} ended_at: {type: string, format: date-time} FeedAction: type: object description: > One proposed action. options holds 1 to 4 choices; option numbers are 0-based on the wire. trace is the timeline serve built. properties: id: {type: integer, format: int64} batch_id: {type: integer, format: int64} kind: {type: string} rationale: {type: string} priority: {type: string, enum: [high, normal, low]} answers: {type: array, items: {type: integer, format: int64}} options: type: array items: type: object properties: label: {type: string} kind: {type: string} params: {type: object} why: {type: string} trace: type: array items: type: object properties: kind: {type: string, enum: [event, context, memory, decision, batch]} ref: {type: string} at: {type: string, format: date-time} role: {type: string, enum: [answers, cause, context]} excerpt: {type: string} url: {type: string} state: {type: string, enum: [proposed, approved, running, done, failed, dismissed, expired, snoozed]} chosen: {type: integer} chosen_params: {type: object} result: {type: string} decided_by: {type: string} dismissal: type: object properties: reason: {type: string} note: {type: string} until: {type: string, format: date-time} created_at: {type: string, format: date-time} decided_at: {type: string, format: date-time} expires_at: {type: string, format: date-time} FeedActionsResult: type: object description: feed.actions {state?, id?, limit?}; high priority first, then newest. required: [type, actions] properties: type: type: string const: feed_actions actions: type: array items: $ref: "#/components/schemas/FeedAction" FeedBatchesResult: type: object description: > feed.batches {limit?, before?}; newest first. limit defaults to 20 and is clamped to 200; before is a batch id. next_before is the last id returned when the page is full, else 0. required: [type, batches, next_before] properties: type: type: string const: feed_batches batches: type: array items: allOf: - $ref: "#/components/schemas/FeedBatch" - type: object properties: actions: type: integer description: Actions the batch produced. next_before: {type: integer, format: int64} FeedActionResult: type: object description: feed.act approve and dismiss (piece P8). required: [type, action] properties: type: type: string const: feed_action action: $ref: "#/components/schemas/FeedAction" FeedEventsResult: type: object description: > feed.events {batch?, ids?, digest?, limit?}. Negative ids are channel digests. With digest true: the newest batches' events no action answered, and every event of a batch that failed twice; the agent's digest line, when it wrote one, is the title. required: [type, events] properties: type: type: string const: feed_events events: type: array items: type: object properties: id: {type: integer, format: int64} source: {type: string} external_id: {type: string} at: {type: string, format: date-time} actor: {type: string} actor_name: {type: string} kind: {type: string} title: {type: string} body: {type: string} url: {type: string} thread_key: {type: string} class: {type: string} urgent: {type: boolean} own: {type: boolean} enrichment: {type: string} channel: {type: string} FeedMemoryResult: type: object description: feed.memory, and feed.act forget_memory and unmute. required: [type, bullets, mutes] properties: type: type: string const: feed_memory bullets: type: array items: type: object properties: id: {type: string} text: {type: string} at: {type: string, format: date-time} mutes: type: array items: type: object properties: scope: {type: string, enum: [thread, sender, channel]} key: {type: string} until: {type: string, format: date-time} action_id: {type: integer, format: int64} OverviewRunsResult: type: object description: overview.list, the kept runs newest first (at most 20 finished). required: [type, runs] properties: type: type: string const: overview_runs runs: type: array items: $ref: "#/components/schemas/OverviewRun" AgentsStatusResult: type: object required: [type, host, mode, window, agents] properties: type: type: string const: agents host: type: string mode: type: string window: type: string agents: type: array items: type: object required: [agent, status] properties: agent: type: string description: The command session.create and session.restart take. status: type: string models: type: array description: > The agent's launch catalog. Absent for an agent with no fixed list, such as Pi, which lists its models at run time. items: type: string RepoListResult: type: object description: > Cached for 5 minutes. A failed refresh serves the last list; a failure with nothing cached is unavailable. required: [type, repos] properties: type: type: string const: repos repos: type: array items: type: object required: [slug, last_activity_at] properties: slug: type: string description: owner/name last_activity_at: type: string description: RFC3339, or empty when unknown. ReviewFixResult: type: object description: > review.fix {session, file, findings?}, from the review session or the operator. Starts a fixer for the findings (all that are not Call: disagree when findings is omitted). required: [type, session, fixer, findings, start_sha, round] properties: type: type: string const: review_fix session: type: string description: The review session's id. fixer: $ref: "#/components/schemas/Session" findings: type: array items: type: string start_sha: type: string description: The staged PR head the fixer starts from. round: type: integer description: 1 to 3. ReviewPushResult: type: object description: > review.push {}, from a fixer only; it takes no params. Serve checks the commits, the report and the scope, pushes without force, then stops the fixer. required: [type, sha] properties: type: type: string const: review_push sha: type: string description: The pushed commit. ReviewAssessResult: type: object description: > review.assess {session, file}. Starts a consult that serve briefs itself; a brief param is ignored. required: [type, session, consult, head_sha] properties: type: type: string const: review_assess session: type: string consult: $ref: "#/components/schemas/Session" head_sha: type: string ReviewApprovedResult: type: object description: > review.approve {session, file}. The first call after an approving assessment opens gate:approve and is refused with gate_needs_operator; the operator closes it, then a second call submits APPROVE at the assessed head. required: [type, session, head_sha, decision, counts] properties: type: type: string const: review_approved session: type: string head_sha: type: string decision: type: string description: GitHub's reviewDecision after the post, for example APPROVED. counts: type: boolean description: > True only when the decision is APPROVED. False is not an error: the approval was posted but does not count, and the operator must be told. SessionTerminatedResult: type: object required: [type, session, worktree_removed, branch] properties: type: type: string const: session_terminated session: type: string worktree_removed: type: boolean description: > True only for the session's own linked worktree. A main checkout, a worktree another session uses, or no worktree stays and is false. branch: type: string description: The branch, which is never deleted; empty on a detached HEAD with no recorded branch. worktree_note: type: string description: Why the worktree stayed, when it did. children_left: type: array description: > With keep_children, the running child sessions left with no parent. Without it every visible descendant is terminated (children_terminated) and this is absent. items: type: string children_terminated: type: array description: > Descendant sessions terminated with this one, deepest first. Every visible descendant goes with its parent; warn before confirming (session.list has parent_id). items: type: string AWSStatusResult: type: object description: > aws.status {check?}. One row per profile in the union of this host's delegations and the sections of its ~/.aws/credentials. Credential values never appear here. A device token may call it; a session may too. required: [type, profiles] properties: type: type: string const: aws_status profiles: type: array items: $ref: "#/components/schemas/AWSProfileStatus" AWSProfileStatus: type: object required: [profile, status, sso_ready] properties: profile: type: string status: type: string description: > not_pushed is a delegated profile with no section on the host; unmanaged is a section with no delegation and no recorded expiry. enum: [valid, expired, not_pushed, unmanaged] expires_at: type: string format: date-time expiry_approx: type: boolean description: expires_at is estimated from the file's age; do not show it as exact. sso_ready: type: boolean description: > False when the profile has no delegation or its delegation lacks SSO facts. aws.login_start answers invalid_params for the first and aws_no_sso for the second. AWSLoginResult: type: object description: > aws.login_start {profile} needs allow_destructive on a device token and is refused for a session caller. aws.login_status {login_id} is a read. A start for a profile with a pending login returns that login. required: [type, login] properties: type: type: string const: aws_login login: $ref: "#/components/schemas/AWSLogin" AWSLogin: type: object required: [login_id, profile, state] properties: login_id: type: string profile: type: string state: type: string enum: [pending, approved, minting, done, denied, expired, failed] failure: type: string description: Set when state is failed. enum: [sso_role_denied, write_failed, other] expires_at: type: string format: date-time description: When the device code expires. aws.login_start and aws.login_status. user_code: type: string description: aws.login_start only; aws.login_status never returns it. verification_uri_complete: type: string description: The approval URL. aws.login_start only; aws.login_status never returns it. expires_in: type: integer description: Seconds until the device code expires. aws.login_start only. AWSLogResult: type: object description: > aws.log {since_seq?, limit?}. The AWS sign-in ledger, oldest first: an aws.login_started row per started login and an aws.login_finished row per login that ended while serve ran. Rows hold the profile, state and failure, never a login id, code, URL or token. A device token may call it; a session caller gets needs_operator. required: [type, events] properties: type: type: string const: aws_log events: type: array items: $ref: "#/components/schemas/AWSLogEvent" AWSLogEvent: type: object required: [session_id, seq, at, actor, kind] properties: session_id: type: string description: Always aws-login, the ledger id no session owns. seq: type: integer format: int64 description: Ledger sequence; pass the last one as since_seq to read on. at: type: string format: date-time actor: type: string kind: type: string enum: [aws.login_started, aws.login_finished] payload: type: object description: '{profile, state} plus failure when the login failed.' properties: profile: type: string state: type: string failure: type: string hash: type: string description: sha256 of the payload. LimitsResult: type: object description: > limits.get {refresh}. Answers from the cache at once and starts whatever is due; refresh skips the age check. Poll while refreshing is true. Device tokens cannot call it; they read a session's own provider from Session.limits. A serve with no limits manager answers unavailable. required: [type, readings, refreshing] properties: type: type: string const: limits readings: type: array description: One per source that has finished a run; empty on a fresh serve. items: $ref: "#/components/schemas/LimitsReading" refreshing: type: boolean LimitsReading: type: object required: [provider, state] properties: provider: type: string plan: type: string windows: type: array items: type: object required: [label, used_percent] properties: label: type: string used_percent: type: number description: Zero once reset is true. resets_at: type: string format: date-time resets_text: type: string description: A reset the provider shows without a year or zone, as printed. reset: type: boolean description: resets_at has passed, so the old percent no longer applies. balances: type: array items: type: object required: [amount, currency] properties: amount: type: string currency: type: string spend: type: string description: Money spent, not a limit. state: type: string enum: [ok, unknown, unavailable] description: > unknown means the source ran and could not read the answer; any numbers are from the last good read, aged by observed_at. unavailable means it does not apply on this host; an empty reason means the tool is not installed. reason: type: string observed_at: type: string format: date-time description: When the provider said it, not when serve asked. source: type: string HostVersionResult: type: object description: > host.version: the aiman release this host's serve runs and what its self-update knows. Any caller may read it. With updates off, mode is off, status held and latest empty. status describes serve only; the gateway block describes the host's aiman-gateway. required: [type, host, version, protocol, latest, latest_ready, mode, status, checked_at, attempt] properties: type: type: string const: host_version host: type: string version: type: string description: The running serve's release, or dev for a local build. protocol: type: integer description: ProtocolVersion, the same integer ping returns. latest: type: string description: Latest GitHub release tag serve has seen; empty when none. latest_ready: type: boolean description: The latest release has checksums.txt and can be installed. mode: type: string enum: ["off", notify, auto] status: type: string enum: [current, available, not_ready, deferred, updating, failed, held, unknown] checked_at: type: string description: RFC3339 time of the last poll, or empty when never polled. attempt: description: The last install attempt, or null when there is none. oneOf: - type: "null" - $ref: "#/components/schemas/HostUpdateAttempt" gateway: $ref: "#/components/schemas/HostGateway" HostGateway: type: object description: > The host's aiman-gateway against serve, read live with a 5 second cache. Absent when the host has no self-update manager. behind means strictly older than serve; a newer gateway is current. unknown is a read that failed or a version that does not parse, never behind. required: [installed, version, running, status] properties: installed: type: boolean version: type: string description: The gateway's version, empty when not installed or unread. running: type: boolean status: type: string enum: [current, behind, updating, failed, unknown, not_installed] HostUpdateAttempt: type: object required: [at, from, to, status, exit, error, kind] properties: kind: type: string enum: [serve, gateway] description: > serve is a serve install (its lockstep also updates the gateway); gateway is a gateway-only repair, whose from is the gateway's version and to serve's tag. at: type: string description: RFC3339 time the attempt started. from: type: string to: type: string status: type: string enum: [started, ok, failed] exit: type: integer description: The update script's exit code once it ended. error: type: string description: Why a failed attempt failed; empty otherwise. HostUpdateResult: type: object description: > host.update: an operator request to install the latest ready release now. The install runs in the background and restarts serve and the gateway; host.version and the host_update notification report the outcome. When serve is already at the latest release and the gateway is behind (or its last update failed), it repairs the gateway alone: accepted with reason gateway and target serve's tag. While that repair runs it is refused, saying the gateway update is running. Needs allow_destructive on a device token; a session caller gets needs_operator. required: [type, accepted, reason, target] properties: type: type: string const: host_update accepted: type: boolean reason: type: string description: > Why the request was refused; empty when a serve install was accepted, gateway when a gateway repair was accepted. target: type: string description: The release tag being installed when accepted. HostDaemonsResult: type: object description: > host.daemons {refresh?}: this host's aiman daemons (serve, gateway, trigger), one row each. Any caller may read it. Rows are cached 5 seconds; refresh true reads again (the phone passes it on pull to refresh and while polling after a restart). The restart block is read fresh on every call. required: [type, host, daemons] properties: type: type: string const: host_daemons host: type: string daemons: type: array items: $ref: "#/components/schemas/DaemonState" DaemonState: type: object description: > One daemon. A daemon that is not installed has installed false and no pid, version or start time; that is not an error. required: [kind, installed, driver, active, version, pid, rss_bytes] properties: kind: type: string enum: [serve, gateway, trigger] installed: type: boolean driver: type: string enum: [systemd, nohup, none] active: type: string description: systemd's ActiveState under systemd; active or activating under the nohup supervisor. version: type: string pid: type: integer description: The daemon's own process, 0 when none runs. started_at: type: string format: date-time description: When the process started; absent when unknown. rss_bytes: type: integer restart: $ref: "#/components/schemas/DaemonRestart" DaemonRestart: type: object description: The daemon's last restart through host.restart; absent when none. required: [name, status, at, exit] properties: name: type: string enum: [restart-serve, restart-gateway, restart-trigger] status: type: string enum: [started, ok, failed] at: type: string format: date-time exit: type: integer description: The restart script's exit code once it ended. HostLogsResult: type: object description: > host.logs {daemon, lines?}: the last lines (default 200, at most 1000) of a daemon's user journal, or of its nohup log when it has no unit. Every line passes serve's redaction (tokens, keys, webhook paths, passwords, URL credentials, PEM blocks, the gateway token); each hit reads [redacted] and redacted counts them. A line is cut at 2 KiB and the oldest lines are dropped past 256 KiB. Needs allow_destructive on a device token; a session caller gets needs_operator; daemon outside serve, gateway and trigger is invalid_params. required: [type, daemon, source, lines, redacted] properties: type: type: string const: host_logs daemon: type: string enum: [serve, gateway, trigger] source: type: string enum: [journal, file] lines: type: array items: type: string description: Oldest first, newest at the end. redacted: type: integer HostRestartResult: type: object description: > host.restart {daemon, force?}: restart a daemon in place through a detached script (systemctl --user restart, or the nohup supervisor), which outlives serve. Refused with reason busy while long calls, AWS logins, handover starts or agent updates run, unless force; with reason running while another restart or a host update is running. The outcome shows up in host.daemons' restart block. Needs allow_destructive on a device token; a session caller gets needs_operator. required: [type, accepted, reason, daemon] properties: type: type: string const: host_restart accepted: type: boolean reason: type: string description: Empty when accepted; busy, running, or a message otherwise. daemon: type: string enum: [serve, gateway, trigger] HarnessRefusalData: type: object description: > The detail of a harness refusal. harness_invalid carries errors (every problem in the harness file), harness_submodule path, harness_too_large sum and limit (bytes), harness_dirty paths, harness_image_missing image, harness_service_failed service and tail (the end of the failed step's output), and harness_debug_busy target (app, or check:), and harness_debug_unsupported lang, plus reason when the language has an adapter that cannot debug this app (check_lang for a go check, musl, bun_version for a Bun of another minor version than the host's Bun adapter, python_version for an image with no CPython 3.9 or later, or debugpy for an interpreter that cannot import the mounted debugpy). properties: lang: type: string reason: type: string target: type: string errors: type: array items: type: string path: type: string sum: type: integer format: int64 limit: type: integer format: int64 paths: type: array items: type: string image: type: string service: type: string tail: type: string HarnessRunPort: type: object description: > A relayed app port. The edge publishes it on the host's 127.0.0.1 at host_port; aiman harness console forwards it to the laptop. required: [name, service, host_port] properties: name: type: string service: type: string host_port: type: integer HarnessStep: type: object description: One step for the tester, with its latest verdict. n counts from 1. required: [n, do] properties: n: type: integer do: type: string expect: type: string result: type: string enum: [pass, fail, skip] note: type: string HarnessCheck: type: object description: > One scenario check and its latest result. exit is absent until it ran; 0 is a pass. output is the redacted tail (60 lines). debug_lang is the lang of the check's debug block. debug marks a result of a debug check and debugging is set while one runs; error_code harness_debug_timeout (with error) is a debug check no debugger attached to in time, which has no exit. required: [name, run] properties: name: type: string run: type: string description: The command, as the harness file has it. image: type: string description: > The check's own image ref (checks[].image); absent when it runs in the app's image. exit: type: integer at: type: string format: date-time output: type: string debug_lang: type: string debug: type: boolean debugging: type: boolean error_code: type: string error: type: string HarnessDebugCheck: type: object description: > The check a debug run's debugger targets while it runs. state is waiting until a debugger client holds the dap relay, then attached; launch is the DAP request for it; attach_by is when it is stopped if nobody attached (harness.debug.attach_timeout, default 10m). required: [name, lang, state, launch, started_at, attach_by] properties: name: type: string lang: type: string state: type: string enum: [waiting, attached] launch: $ref: "#/components/schemas/HarnessDebugLaunch" started_at: type: string format: date-time attach_by: type: string format: date-time HarnessVerdict: type: object description: > A tester's pass, fail or skip for a step (0 is the whole scenario). sha, dirty and diff_sha256 name the tree it judged. required: [run, step, result, sha, dirty, at] properties: run: type: string step: type: integer result: type: string enum: [pass, fail, skip] note: type: string by: type: string sha: type: string dirty: type: boolean diff_sha256: type: string at: type: string format: date-time HarnessRun: type: object description: > One start of one scenario at one commit for one session. A dirty run ran the working tree: sha is HEAD and diff_sha256 hashes the changes and untracked files. source is config when repos..harness replaced the repository file. failed_step, failed_service and error explain a failed run; error_code is the refusal code when a step refused it (harness_debug_unsupported from the debug probe). last_used is the last call that touched the run; harness.idle_timeout counts from it. required: [id, session, scenario, sha, dirty, source, network, state, debug, ports, steps, checks, started_at, last_used] properties: id: type: string session: type: string scenario: type: string title: type: string sha: type: string dirty: type: boolean diff_sha256: type: string source: type: string enum: [file, config] network: type: string enum: [offline, online] description: > offline (harness.network, else review.sandbox.network, unset, none or offline): the edge proxy answers external calls from the scenario's stubs or 502. online: it forwards them. Either way the app and services reach the outside only through the proxy. state: type: string enum: [starting, ready, failed, stopped] debug: type: boolean debug_launch: $ref: "#/components/schemas/HarnessDebugLaunch" debug_checks: type: boolean description: The run debugs only its checks; it has no debug_launch. debug_check: $ref: "#/components/schemas/HarnessDebugCheck" failed_step: type: string failed_service: type: string error: type: string error_code: type: string ports: type: array items: $ref: "#/components/schemas/HarnessRunPort" steps: type: array items: $ref: "#/components/schemas/HarnessStep" checks: type: array items: $ref: "#/components/schemas/HarnessCheck" result: type: string enum: [pass, fail, skip] description: The verdict on the whole scenario (step 0). verdicts: type: array items: $ref: "#/components/schemas/HarnessVerdict" services: type: array items: type: string images: type: object additionalProperties: type: string description: Each container's image ID. databases: type: array description: The scenario's services the database browser (harness.db) reads. items: type: object required: [service, kind] properties: service: type: string kind: type: string enum: [postgres, sqlite] inner_subnet: type: string outer_subnet: type: string started_at: type: string format: date-time ready_at: type: string format: date-time stopped_at: type: string format: date-time stop_reason: type: string enum: [down, idle, session_gone, serve_restart] last_used: type: string format: date-time browser_sourcemaps: $ref: "#/components/schemas/HarnessBrowserSourcemaps" evm: type: array description: The scenario's evm services (services with evm set), which harness.evm_txs and harness.evm_trace read. items: type: string HarnessBrowserSourcemaps: type: object description: > Whether the app's frontend JavaScript names source maps a browser can load, for debugging in the tester's own DevTools through the forwarded app port. Serve sets it shortly after the run turns ready and leaves it out until then. It reads up to 4 app ports' page at / through the edge and up to 4 same-origin scripts of each (a SourceMap header, or a sourceMappingURL comment whose map answers 2xx or is a data URL), never following a redirect or another origin; when no page answers it reads the end of each .js file under a dist, build or out directory of the exported tree. Every read is capped and the whole check takes at most 20s. method is http or scan; port is the app port read (http); hidden marks .map files no script names; files are up to 3 scripts the answer rests on. required: [state] properties: state: type: string enum: [present, absent, unknown] method: type: string enum: [http, scan] port: type: string hidden: type: boolean files: type: array items: type: string detail: type: string HarnessRunResult: type: object description: > harness.up {session?, scenario, dirty?, force?, wait?}, harness.status {session? | run?} and harness.down {session? | run?}. session defaults to the caller. harness.up answers a starting run; with wait it holds the call up to 20s for the run to leave starting and answers harness_service_failed when a service did not become ready. harness.status takes the run named, else the session's live run, else its newest kept run. harness.down takes the live run down and removes its volumes; the result files stay. harness.status is a device read method; harness.up and harness.down are off the device allowlist. required: [type, run] properties: type: type: string const: harness_run run: $ref: "#/components/schemas/HarnessRun" HarnessResultResult: type: object description: > harness.result {session? | run?}: the run with its verdicts and checks, live or kept (serve keeps the newest 5 runs per session). A device read method. required: [type, run] properties: type: type: string const: harness_result run: $ref: "#/components/schemas/HarnessRun" HarnessScenario: type: object description: One scenario of the harness file. required: [id] properties: id: type: string title: type: string services: type: array items: type: string setup: type: array items: type: object properties: run: type: string fixtures: type: array items: type: object properties: sql: type: string sqlite: type: string script: type: string into: type: string steps: type: array items: type: object required: [do] properties: do: type: string expect: type: string checks: type: array items: type: object required: [name, run] properties: name: type: string run: type: string image: type: string description: An image the check runs in instead of the app's; vetted like every image. stubs: type: array items: type: object properties: host: type: string path: type: string status: type: integer body: type: string body_file: type: string HarnessListResult: type: object description: > harness.list {session?, dirty?}: the scenarios of the session's harness at HEAD (a review session's PR head), or in the working tree with dirty (then dirty and diff_sha256 are set; a review session refuses dirty), and the session's runs, newest first. A missing or broken harness file leaves scenarios empty and sets file_error; the runs are still listed. A device read method. required: [type, session, runs, scenarios] properties: type: type: string const: harness_list session: type: string source: type: string enum: [file, config] sha: type: string dirty: type: boolean diff_sha256: type: string scenarios: type: array items: $ref: "#/components/schemas/HarnessScenario" runs: type: array items: $ref: "#/components/schemas/HarnessRun" file_error: type: object required: [code, message] description: Why the harness file could not be read; code is a harness refusal code or invalid_params. properties: code: type: string message: type: string data: $ref: "#/components/schemas/HarnessRefusalData" HarnessCheckResult: type: object description: > harness.check {session? | run?, name?}: run the scenario's checks, or only the one named, each in a fresh app container on the inner network, on a ready run (else harness_not_running). Up to 5 minutes per check and 10 in all. Off the device allowlist. harness.check {run?, name, debug: true, take?} (operator only) runs the named check as a ready debug run's debug target: a fresh app container on the debug network at the check's own address, under its debug block's adapter (a node check has the pinned Node first on PATH), with the dap relay pointed at it. It answers once the check started, with debug true, the check (debugging) and debug_check; the result lands in the run's checks when the check ends, and the relay points back at the app. required: [type, run, checks] properties: type: type: string const: harness_check run: type: string debug: type: boolean debug_check: $ref: "#/components/schemas/HarnessDebugCheck" checks: type: array items: $ref: "#/components/schemas/HarnessCheck" HarnessLogsResult: type: object description: > harness.logs {session? | run?, service, lines?}: the last lines (default 200, at most 1000) of one container's output, live or saved when the run stopped. Lines pass serve's redaction, as for host.logs. Off the device allowlist. required: [type, run, service, lines, redacted] properties: type: type: string const: harness_logs run: type: string service: type: string lines: type: array items: type: string redacted: type: integer HarnessDBResult: type: object description: > harness.db {session? | run?, service, op, table?, sql?, limit?, write?}: the database browser on a ready run. Postgres reads connect through the edge relay as aiman_ro (pg_read_all_data, not a superuser) with the run's password, over the simple query protocol, inside BEGIN READ ONLY on a read-only session with statement_timeout 5s, then ROLLBACK. SQLite reads run in a one-shot container with no network that mounts the service's data volume read-only and opens the file mode=ro and query_only. Every cell, table name and output line passes serve's redaction, and every value of a column whose name matches password, secret, token or api_key is [redacted]. A write (write true) runs as the owner (psql in the postgres container, or the SQLite reader with the volume read-write) and is the operator's. Refusals: harness_db_unsupported (the service holds no postgres or sqlite database), harness_db_refused, needs_operator, harness_not_running, session_scope, invalid_params (a bad op, table or service, or the database's own refusal of the statement). Off the device allowlist. required: [type, run, service, kind, op, role, limit, truncated, redacted] properties: type: type: string const: harness_db run: type: string service: type: string kind: type: string enum: [postgres, sqlite] op: type: string enum: [tables, rows, query] role: type: string enum: [aiman_ro, read_only, owner] description: aiman_ro for a postgres read, read_only for a SQLite read, owner for a write. write: type: boolean limit: type: integer tables: type: array description: op tables; schema.table for postgres. items: type: string columns: type: array items: type: string rows: type: array description: Cells as text, cut at 4 KiB; null is SQL NULL. items: type: array items: type: [string, "null"] truncated: type: boolean description: More rows existed than limit, or the reply reached 1 MiB. redacted: type: integer redacted_columns: type: array items: type: string output: type: array description: A write's output lines (psql's command tags). items: type: string tag: type: string description: A write's last command tag, such as UPDATE 1. ArtifactPublishResult: type: object description: > artifact.publish {session?, page, files? [{path?, from}], title?, id?, expect_version?, theme?}: publishes page as index.html (and each file at path, else its path relative to the page's directory) as a new version on aiman.fyi. Every file must resolve, symlinks followed, inside the session's working directory or worktree. Records artifact.published. Refusals: artifact_conflict (stale expect_version or a concurrent write), invalid_params (a path outside the session's directory, no page, over 255 files, 25 MiB a file or 64 MiB in all), session_scope (another session's artifact), not_found, unavailable (not configured on this host). Off the device allowlist. required: [type, artifact] properties: type: type: string const: artifact artifact: type: object required: [id, version, url] properties: id: type: string description: 20 lower-case base32 characters. version: type: integer url: type: string description: https:///a//, the latest version. ArtifactListResult: type: object description: > artifact.list {}: the host's artifacts not deleted, newest first. artifact.get {id} answers {type: artifact_info, artifact} with the same fields plus versions [{n, session, created, url, files [{path, sha256, size, type}]}] and share {emails, domains}. Both are off the device allowlist. required: [type, artifacts] properties: type: type: string enum: [artifacts, artifact_info] artifacts: type: array items: type: object properties: id: type: string title: type: string session: type: string latest: type: integer url: type: string shared: type: boolean created: type: string format: date-time ArtifactShareResult: type: object description: > Operator only (needs_operator for a session). artifact.share {id, emails?, domains?} and artifact.unshare {id, emails?, domains?, all?} answer {type: artifact_share, share: {emails, domains}}; artifact.delete {id} answers {type: artifact_deleted, id}. An unknown id is not_found. Each success records artifact.shared (id, action, counts; never addresses) or artifact.deleted (id) on the ledger id artifacts. Share writes meta.json only; Access admits only the viewers aiman artifact setup gave it. Off the device allowlist. required: [type] properties: type: type: string enum: [artifact_share, artifact_deleted] id: type: string share: type: object properties: emails: type: array items: type: string domains: type: array items: type: string HarnessShareResult: type: object description: > harness.share {session? , run?}: a link for a tester to the session's ready run through the gateway. It revokes the session's earlier shares and records harness.shared. harness_not_running unless the run is ready; unavailable ("gateway is not running") when the gateway's announce is missing or older than 3 minutes. harness.unshare answers {type: harness_unshared, revoked}; harness.share_get {id} (operator only) answers {type: harness_share_state, share, session, run, state} with state live or ended. gateway.announce {base, console_port, scheme, pid} (operator only) answers {type: gateway_announced}. All four are off the device allowlist. required: [type, url, share, run] properties: type: type: string const: harness_share url: type: string share: type: string description: The share id, 43 base64url characters. run: type: string HarnessVerdictResult: type: object description: > harness.verdict {session? | run?, step?, result, note?}: the operator's verdict on a step (step 0 or absent is the whole scenario) of a live or kept run. A session caller gets needs_operator. A fail adds or rewrites the to-do "Harness: step : " (Ref harness::, or harness::all for step 0) on the run's session, returns its id in todo, and steers a note to its agent. Off the device allowlist. required: [type, verdict, run] properties: type: type: string const: harness_verdict verdict: $ref: "#/components/schemas/HarnessVerdict" run: $ref: "#/components/schemas/HarnessRun" todo: type: string description: The to-do a fail opened or rewrote; absent for pass and skip, empty when the session is gone. HarnessDebugLaunch: type: object description: > A debug run's DAP start request: a client sends request (launch for go, attach for node, bun and python) with arguments, unchanged. source_root is the container path of the run's exported tree, for mapping stack frame paths. children is true when the adapter opens child sessions with the startDebugging reverse request (js-debug, debugpy for Python subprocesses): the client connects again for each, under the same lease, and sends the request and configuration that startDebugging names. required: [lang, adapter, request, arguments, source_root] properties: lang: type: string adapter: type: string request: type: string enum: [launch, attach] children: type: boolean arguments: type: object additionalProperties: true source_root: type: string DAPHolder: type: object description: > The client holding a debugger lease: the clientID and clientName its first initialize request sent (labels, not proof of identity), when it took the lease, and how many connections the lease holds (child sessions join with the same lease token, at most 8). required: [remote, since, connections] properties: client_id: type: string client_name: type: string remote: type: string since: type: string format: date-time connections: type: integer HarnessDebugState: type: object required: [run, holder, launch, host_port, refused] properties: run: type: string holder: oneOf: - $ref: "#/components/schemas/DAPHolder" - type: "null" dropped: $ref: "#/components/schemas/DAPHolder" target: type: string enum: [app, check, ""] description: > What the debugger serves now; empty in a run that debugs only its checks while none runs. launch is that target's request. check: type: string launch: $ref: "#/components/schemas/HarnessDebugLaunch" host_port: type: integer description: The host 127.0.0.1 port the edge publishes the dap relay on. refused: type: integer description: DAP clients turned away while the lease was held. HarnessDebugResult: type: object description: > harness.debug {session? | run?, op?}: a ready debug run's debugger. status is any in-scope caller's; take and release close every connection of the current lease (the adapter then restarts for the next client) and are the operator's: a session gets needs_operator. take and release record harness.debug. A run that is not a debug run is invalid_params. Off the device allowlist. required: [type, debug] properties: type: type: string const: harness_debug debug: $ref: "#/components/schemas/HarnessDebugState" HarnessFilesResult: type: object description: > harness.files {session? | run?}: the regular files of the run's exported tree, relative to it, at most 5000 (truncated then true), never under .git or named like a secret. root is the tree's path in the app container. A kept run whose tree serve pruned is harness_not_running. Off the device allowlist. required: [type, run, root, files, truncated] properties: type: type: string const: harness_files run: type: string root: type: string files: type: array items: type: string truncated: type: boolean HarnessFileResult: type: object description: > harness.file {session? | run?, path, offset?, limit?}: one page of a file of the run's exported tree, under session.file's rules. path is the file relative to the tree. Off the device allowlist. required: [type, run, path, size, offset, data, eof, binary] properties: type: type: string const: harness_file run: type: string path: type: string size: type: integer format: int64 offset: type: integer format: int64 data: type: string eof: type: boolean binary: type: boolean HarnessCaptureResult: type: object description: > harness.capture {session? | run?, after_id?, limit?}: the HTTP calls the run's app and services made through the edge proxy, oldest first, with an id above after_id: from the edge's memory (the newest 1000) while the run is live, else from the flows saved when it stopped (harness_not_running when none were). A session caller is held to its scope. Serve redacts every flow again before it answers: Authorization, Cookie, Set-Cookie, Proxy-Authorization, X-Api-Key and any header, query parameter or JSON key matching password|secret|token|api_key. Each body keeps its first harness.capture.body_bytes (64 KiB). Off the device allowlist. required: [type, run, network, state, flows, next, more, total, dropped, redacted] properties: type: type: string const: harness_capture run: type: string network: type: string enum: [offline, online] state: type: string enum: [starting, ready, failed, stopped] flows: type: array items: $ref: "#/components/schemas/HarnessFlow" next: type: integer format: int64 description: The after_id of the next call. A pending flow holds it for a minute, so the next call returns that flow again once it ends. more: type: boolean description: Flows past next exist already; call again at once. total: type: integer format: int64 description: Calls since the edge started. dropped: type: integer format: int64 description: Oldest calls that fell out of the edge's store. redacted: type: integer description: Values serve replaced in this reply. HarnessFlow: type: object description: One request through the edge proxy and its response. required: [id, start, duration_ms, method, url, host, tls, outcome, request_body_bytes, response_body_bytes] properties: id: type: integer format: int64 start: type: string format: date-time duration_ms: type: number client: type: string description: The container's inner address. method: type: string description: CONNECT for a tunnel that never carried a request (a failed TLS handshake, a protocol other than TLS). url: type: string host: type: string proto: type: string tls: type: boolean description: Read inside a CONNECT tunnel, with a leaf signed by the run CA. status: type: integer outcome: type: string enum: [upstream, stub, offline, refused, error, pending] description: > upstream: an online run forwarded it. stub: a scenario stub answered. offline: no stub, answered 502. refused: an address that is not public, or a tunnel that did not start TLS. error: the handshake (a client that does not trust the run CA, such as a pinned one), the upstream or the body failed. pending: not finished yet. error: type: string request_headers: type: object additionalProperties: type: array items: type: string request_body: type: string request_body_bytes: type: integer format: int64 request_truncated: type: boolean request_binary: type: boolean description: The body is not UTF-8 text and is left out. response_headers: type: object additionalProperties: type: array items: type: string response_body: type: string description: Decoded when the response was gzip or deflate. response_body_bytes: type: integer format: int64 response_truncated: type: boolean response_binary: type: boolean redacted: type: integer HarnessImage: type: object description: > One image digest in serve's host-wide image store. digest is the platform manifest digest, the store key; index_digest the multi-platform index the ref resolved through. state is vetting, pending_approval, approved, blocked, failed or stale; stage tells where a vetting is. approved_by is session, operator, config (a clean listed image) or operator_run (clean scans on the operator's own run). The quote and the override reason stay in the store and the ledger and are never in this object. required: [digest, ref, state, scan, at] properties: digest: type: string ref: type: string repo: type: string index_digest: type: string config_digest: type: string platform: type: string size: type: integer format: int64 state: type: string enum: [vetting, pending_approval, approved, blocked, failed, stale] stage: type: string enum: [queued, fetch, cve, static, review, awaiting_approval, load] allowed: type: boolean description: The ref matched harness.allowed_images. requesters: type: array items: type: object properties: session: type: string operator: type: boolean scan: type: object properties: trivy_db: type: string critical: type: array items: type: string high: type: array items: type: string static_hits: type: array items: type: string mal_ids: type: array items: type: string model_verdict: type: string description: clean, suspicious or malicious; absent when no review ran. review_agent: type: string review_model: type: string independent: type: boolean description: false when the review fell back to the asking session's model family; absent when no review ran. review_report: type: string review_findings: type: array description: counts of high, medium and low review findings. items: type: integer report: type: string sbom: type: string signature: type: string enum: [absent, present, unknown] description: A cosign signature in the registry. Shown only; it never skips a scan or blocks. reasons: type: array items: type: string approved_by: type: string approver: type: string accepted_highs: type: array items: type: string accept_risk: type: boolean image_id: type: string local_name: type: string at: type: string format: date-time rescanned_at: type: string format: date-time HarnessEVMTx: type: object required: [hash, block, index, from, status, gas_used] properties: hash: type: string block: type: integer index: type: integer from: type: string to: type: string description: Absent for a contract creation. contract: type: string description: The address a creation made. value: type: string description: Wei in decimal; absent for zero. selector: type: string description: The first 4 bytes of a call's input. status: type: string enum: [success, reverted, unknown] gas_used: type: integer HarnessEVMTxsResult: type: object description: > harness.evm_txs {session? | run?, service?, blocks?}: the newest transactions (at most 100, newest first) of the last blocks blocks of a ready run's evm service, with their receipts. Serve reads the node through the edge's evm relay, which admits only eth_blockNumber, eth_chainId, eth_getBlockByNumber, eth_getTransactionByHash, eth_getTransactionReceipt and debug_traceTransaction; nothing signs, sends or changes state. A run with no evm service, an unknown service or a bad blocks is invalid_params; a run that is not ready is harness_not_running. Any in-scope caller; off the device allowlist. required: [type, evm] properties: type: type: string const: harness_evm_txs evm: type: object required: [run, service, chain_id, head, blocks, txs, truncated] properties: run: type: string service: type: string chain_id: type: integer head: type: integer blocks: type: integer txs: type: array items: $ref: "#/components/schemas/HarnessEVMTx" truncated: type: boolean HarnessEVMRevert: type: object description: > A decoded revert reason. kind is error (Error(string), message is its text), panic (Panic(uint256): code and its meaning), custom (a custom error: selector), raw (under 4 bytes) or empty (no data). data is the raw revert data in hex, cut at 4096 bytes; bytes is its full length. required: [kind, bytes] properties: kind: type: string enum: [error, panic, custom, raw, empty] message: type: string code: type: string selector: type: string data: type: string bytes: type: integer HarnessEVMCall: type: object description: > One call frame from the node's callTracer. input and output are hex cut at 4096 bytes (input_bytes and output_bytes are the full lengths); error is the node's word for a failed frame and revert decodes its output. required: [type, from, gas, gas_used, input_bytes, output_bytes] properties: type: type: string from: type: string to: type: string value: type: string gas: type: integer gas_used: type: integer selector: type: string input: type: string input_bytes: type: integer output: type: string output_bytes: type: integer error: type: string revert: $ref: "#/components/schemas/HarnessEVMRevert" calls: type: array items: $ref: "#/components/schemas/HarnessEVMCall" HarnessEVMTraceResult: type: object description: > harness.evm_trace {session? | run?, service?, tx}: one mined transaction replayed under the callTracer through the edge's read-only evm relay: its receipt facts and call tree, at most 5000 frames (truncated then true), with revert reasons decoded. revert is the top frame's. An unknown or malformed hash is invalid_params. Any in-scope caller; off the device allowlist. required: [type, trace] properties: type: type: string const: harness_evm_trace trace: type: object required: [run, service, tx, block, status, gas_used, root, frames, truncated] properties: run: type: string service: type: string tx: type: string block: type: integer status: type: string enum: [success, reverted, unknown] gas_used: type: integer contract: type: string root: $ref: "#/components/schemas/HarnessEVMCall" revert: $ref: "#/components/schemas/HarnessEVMRevert" frames: type: integer truncated: type: boolean HarnessImageResult: type: object description: > harness.image_status {digest | ref} or harness.image_approve: one image record. harness.image_status is a device read method; harness.image_approve is off the device allowlist. required: [type, image] properties: type: type: string const: harness_image image: $ref: "#/components/schemas/HarnessImage" HarnessImagesResult: type: object description: harness.image_status with no digest or ref; every record, newest first. required: [type, images] properties: type: type: string const: harness_images images: type: array items: $ref: "#/components/schemas/HarnessImage" RPCCount: type: object required: [name, count, avg_us] properties: name: type: string count: type: integer avg_us: type: integer description: Mean duration in microseconds. RPCStats: type: object description: > serve's requests over the last window_seconds (60). inflight and waiting are now; the rest are counts in the window. by_method and by_caller list the top 10 by count. A caller is the session whose pty holder runs the calling process, else the caller the request names, else operator. required: [window_seconds, total, inflight, waiting, rejected, limited, sweep_skipped, by_method, by_caller] properties: window_seconds: type: integer total: type: integer inflight: type: integer description: Requests holding a slot now. waiting: type: integer description: Waits between their checks, holding no slot. rejected: type: integer description: server_busy answers. limited: type: integer description: rate_limited answers. sweep_skipped: type: integer by_method: type: array items: $ref: "#/components/schemas/RPCCount" by_caller: type: array items: $ref: "#/components/schemas/RPCCount" ResourceUsage: type: object description: > One cgroup's use. Sizes are bytes; a limit of -1 is "no limit" and an absent one was not read. required: [memory_current, anon, shmem, memory_pressure, cpu_percent, pids] properties: memory_current: type: integer memory_high: type: integer description: Above this the cgroup is throttled. memory_max: type: integer description: Above this the kernel kills processes in the cgroup. anon: type: integer shmem: type: integer description: tmpfs files and shared memory, charged until deleted. memory_pressure: type: number description: Percent of the last 10 seconds some task stalled on memory. cpu_percent: type: number description: Percent of one core over the last sample interval. pids: type: integer oom_kills: type: integer ResourceLimits: type: object description: Limits of one session scope; an absent field is unset. properties: memory_high: type: integer memory_max: type: integer memory_swap_max: type: integer cpu_weight: type: integer io_weight: type: integer tasks_max: type: integer ResourcesResult: type: object description: > Read-only, from a sample serve takes every 10 seconds. Pass session to get one session. A host without per-session scopes (no user systemd) answers supported false with no sessions; hide the readout there. required: [type, resources] properties: type: type: string const: resources resources: type: object required: [supported, host, sessions, limits, tmpdir] properties: supported: type: boolean at: type: string format: date-time host: type: object description: Percent of the last 10 seconds some task on the host stalled. required: [memory, cpu, io] properties: memory: type: number cpu: type: number io: type: number user_slice: $ref: "#/components/schemas/ResourceUsage" sessions_slice: $ref: "#/components/schemas/ResourceUsage" gate: $ref: "#/components/schemas/PressureGate" serve_unit: description: > Serve's own cgroup. Memory an adopted session charged before it moved stays here. $ref: "#/components/schemas/ResourceUsage" unscoped: type: array description: > Running sessions whose holder is outside every session scope, so they run without limits. Serve moves them in on its own (30s after start, then every 5 minutes) unless it runs outside the user manager. items: type: object required: [id] properties: id: type: string name: type: string sessions: type: array items: allOf: - $ref: "#/components/schemas/ResourceUsage" - type: object required: [id] properties: id: type: string name: type: string limits: $ref: "#/components/schemas/ResourceLimits" slice_memory_high: type: integer tmpdir: type: boolean missing: type: string description: > The session asked for, when it has no scope: it runs without limits until its terminal is restarted. SessionLimitsResult: type: object description: > session.limits with memory_high or memory_max ("12G", "infinity") stores the session's override and applies it to a running scope; with neither it reports. Setting is the operator's (needs_operator for a session) and is not a device method. required: [type, session, limits, applied, scoped] properties: type: type: string const: session_limits session: type: string name: type: string limits: $ref: "#/components/schemas/ResourceLimits" applied: type: boolean scoped: type: boolean SessionScopeResult: type: object description: > session.adopt_scope {session} moves a running session that has no scope into aiman-session-.scope with its limits: its holders, what they run and their descendants. moved is 0 when every process was already inside. The session's TMPDIR does not change. It is the operator's (needs_operator for a session), unavailable without a user systemd, and not a device method. required: [type, session, scope, moved, limits] properties: type: type: string const: session_scope session: type: string name: type: string scope: type: string moved: type: integer limits: $ref: "#/components/schemas/ResourceLimits" warning: type: string description: Why some processes stayed outside the scope. HostStatsResult: type: object description: > Read-only. Every size is in bytes and every CPU value is a percent. Linux reads /proc; elsewhere the fields are empty. Refresh every few seconds. required: [type, host, uptime_seconds, load, cpu_count, cpu_percent, memory, swap, disks, processes, sessions, rpc, scratch, gate, aiman_procs] properties: type: type: string const: host_stats gate: $ref: "#/components/schemas/PressureGate" aiman_procs: type: object description: > Census of processes whose comm is aiman, outside serve and the pty holders, read from /proc//stat only. required: [total, by_state, parents] properties: total: type: integer by_state: type: object description: Count per state letter (R, S, D, ...). additionalProperties: type: integer parents: type: array description: Top 5 parents by count, then by pid. items: type: object required: [pid, name, count] properties: pid: type: integer name: type: string count: type: integer rpc: $ref: "#/components/schemas/RPCStats" scratch: type: object description: > The scratch janitor's last pass over ~/.aiman/tmp and the size of /tmp/claude-, which the janitor never touches. Bytes. required: [freed_bytes, last_run, legacy_bytes] properties: freed_bytes: type: integer last_run: type: string format: date-time legacy_bytes: type: integer host: type: string uptime_seconds: type: integer load: type: array description: 1, 5 and 15 minute load averages. minItems: 3 maxItems: 3 items: type: number cpu_count: type: integer cpu_percent: type: number description: The whole host, 0 to 100. memory: type: object description: Bytes. required: [total, used, available] properties: total: type: integer used: type: integer available: type: integer swap: type: object description: Bytes. required: [total, used] properties: total: type: integer used: type: integer disks: type: array description: Real local filesystems, one per device. Sizes in bytes. items: type: object required: [mount, total, used] properties: mount: type: string total: type: integer used: type: integer processes: type: array description: Top 15 by CPU and top 15 by RSS, merged, busiest first. Names only, never arguments. items: type: object required: [pid, user, name, cpu_percent, rss] properties: pid: type: integer user: type: string name: type: string cpu_percent: type: number description: Of one core, so it can pass 100. rss: type: integer description: Bytes. sessions: type: array description: > Each running session with its agent's process tree. aiman's hidden helpers are left out. A session whose process cannot be confirmed reports zeros. items: type: object required: [session, name, cpu_percent, rss, processes] properties: session: type: string name: type: string cpu_percent: type: number description: Of one core, across the tree. rss: type: integer description: Bytes. processes: type: integer SessionGetResult: type: object required: [type, session] properties: type: type: string const: session session: $ref: "#/components/schemas/Session" PaneReadResult: type: object required: [type, text] properties: type: type: string const: pane_read session: $ref: "#/components/schemas/Session" text: type: string TranscriptPage: type: object description: > One page of session.transcript. Items are newest-last. On a call with after, items are new (append), changed are items first seen at or before the cursor whose rev moved (replace by id only when loaded), and removed are ids that left the active branch; apply removed before items. reset means drop the cache: the file was replaced or rewritten. A session with no transcript answers source pane with one pane item holding the current screen. required: [type, session, source, capabilities, items, before, after, reset] properties: type: type: string const: transcript session: type: string subagent: type: string source: type: string enum: [transcript, pane] capabilities: $ref: "#/components/schemas/TranscriptCapabilities" items: type: array items: $ref: "#/components/schemas/TranscriptItem" changed: type: array items: $ref: "#/components/schemas/TranscriptItem" removed: type: array items: type: string before: type: [string, "null"] description: Opaque cursor for the page above; null at the top. after: type: string description: > Opaque cursor to resume from. A reply to a before call carries the end of the file: keep the after of the newest page instead. reset: type: boolean TranscriptCapabilities: type: object required: [agent, scrollback, tool_results, thinking, subagents, processes] properties: agent: type: string scrollback: type: string enum: [transcript, pane] tool_results: type: boolean thinking: type: string enum: [full, summary, none] subagents: type: boolean processes: type: string enum: [file, inline, none] TranscriptItem: type: object description: > One normalised transcript entry. rev is the position of the last line that changed it. text, tool_call.input and tool_call.result are cut at 64 KiB in a page and 1 MiB in session.transcript_item, with truncated set. required: [id, kind, at, rev, text, truncated] properties: id: type: string kind: type: string enum: [user, assistant, thinking, tool_call, subagent, process, system, pane] at: type: string format: date-time rev: type: integer format: int64 text: type: string truncated: type: boolean hidden: type: boolean description: A thinking block whose text the vendor redacted. tool_call: $ref: "#/components/schemas/TranscriptToolCall" subagent: $ref: "#/components/schemas/TranscriptSubagent" process: $ref: "#/components/schemas/TranscriptProcess" TranscriptToolCall: type: object required: [tool_id, name, summary, input, result, status] properties: tool_id: type: string name: type: string summary: type: string input: type: string result: type: string status: type: string enum: [running, ok, error, denied] duration_ms: type: integer format: int64 subagent_id: type: string process_id: type: string TranscriptSubagent: type: object required: [id, name, description, state, item_count] properties: id: type: string name: type: string description: type: string state: type: string enum: [running, done, failed, unknown] item_count: type: integer started_at: type: string format: date-time ended_at: type: string format: date-time TranscriptProcess: type: object required: [id, command, state, output] properties: id: type: string description: The process id session.process_output takes. command: type: string state: type: string enum: [running, exited, unknown] exit_code: type: integer output: type: string enum: [file, inline] TranscriptItemResult: type: object required: [type, item] properties: type: type: string const: transcript_item item: $ref: "#/components/schemas/TranscriptItem" ProcessOutputResult: type: object description: > At most 256 KiB of a background process's output, from since or the tail. A file not created yet answers empty data and state running. Codex output is inline: data comes from the process item. required: [type, data, offset, size, state, exit_code, truncated] properties: type: type: string const: process_output data: type: string offset: type: integer format: int64 description: Byte offset of data in the output. size: type: integer format: int64 description: The output's size when read. state: type: string enum: [running, exited, unknown] exit_code: type: [integer, "null"] truncated: type: boolean description: More output lies before or after data. FileResult: type: object description: > session.file {session, path, offset?, limit?}: one page of a file in the session's worktree or working directory. Data is cut on a UTF-8 boundary, so a client appends pages. A file whose first 8 KiB holds a NUL is binary: data is empty and eof true. required: [type, session, path, size, offset, data, eof, binary] properties: type: type: string const: file session: type: string description: The session id. path: type: string description: The absolute path read, after symlinks. size: type: integer format: int64 description: The file's size in bytes when read. offset: type: integer format: int64 description: Byte offset this page starts at. data: type: string eof: type: boolean description: Data runs to the end of the file. binary: type: boolean PromptResult: type: object required: [type, sent] properties: type: type: string const: prompt_result sent: type: boolean description: > False with delivered_as note is success: the text was queued as a peer note, not typed. state: $ref: "#/components/schemas/AgentState" queued: type: boolean description: True when the text was queued as a peer note. delivered_as: type: string enum: [note] description: > note: a session outside the target's tree sent it; it arrives at the target's next prompt as [peer session ] . steer: $ref: "#/components/schemas/SteerStatus" SteerStatus: type: object required: [queued] properties: queued: type: integer last_delivered_at: type: string format: date-time last_error: type: string held: type: string description: Why the last delivery waited (working, dialog, ended, unknown, legacy_terminal). pending: type: array items: $ref: "#/components/schemas/SteerNote" SteerNote: type: object required: [session_id, author, text] properties: session_id: type: string author: type: string enum: [user, aiman, verifier, peer] from: type: string description: The sending session of a peer note; absent otherwise. text: type: string GatewayRestartServeResult: type: object description: > gateway.restart_serve {}: answered by the gateway without calling serve, for a serve that is alive but not answering. It runs serve's in-place restart script detached (systemctl --user restart, or the nohup supervisor). Refused with reason cooldown within 60s of the last accepted call. A failure to start the script is an RPC error (internal). Needs the host token or allow_destructive on a device. required: [type, accepted] properties: type: type: string const: gateway_restart_serve accepted: type: boolean reason: type: string description: Empty when accepted; cooldown otherwise. PushRegisterResult: type: object required: [type, registered] properties: type: type: string const: push_registered registered: type: boolean PushUnregisterResult: type: object required: [type] properties: type: type: string const: push_unregistered SessionEvent: type: object required: [type] properties: type: type: string description: > session_activity, session_gone and session_created come from the stream's own poll; todo_changed, steer, usage, usage.budget, notify and verify are published by request handlers; overview is published when an overview run or one of its steps changes, with id the run, status its state and step the step that changed (a signal to read overview.get again); feed is published when a feed batch or action is added or changes state, with batch or action the id and state its new state (state memory after a memory bullet or mute was removed), a signal to read feed.actions again; harness_share is published when a harness share becomes live or ends, with id the share and state live or ended; session_forgotten is published when serve drops a session's row (terminate, forget, a landed child the coordinator tracker ended), and clients remove it from their lists; transcript comes from the stream's poll when a transcript file read within the last 2 minutes (or a session's recorded transcript path) changes size or mtime, at most once a second per session and sub-agent, and means call session.transcript with after; keepalive is sent when nothing else was. enum: - session_activity - session_gone - session_forgotten - overview - feed - harness_share - session_created - todo_changed - steer - usage - usage.budget - notify - verify - transcript - keepalive id: type: string title: type: string last_output: type: string format: date-time title_changed_at: type: string format: date-time output_bytes: type: integer format: int64 status: type: string state: $ref: "#/components/schemas/AgentState" description: > On session_activity, the agent state serve last sampled every 2s, from a fresh hook report or the screen rules, and absent until the first sample and for hidden helper sessions. The review status on verify, and the budget state on usage.budget. The phone merges it when present and otherwise keeps the last list/get value. state_confidence: $ref: "#/components/schemas/StateConfidence" description: Sent beside state on session_activity. session: $ref: "#/components/schemas/Session" description: The new or changed session on session_created. rev: type: integer format: int64 description: > To-do list revision on todo_changed; on transcript, the changed file's size, a hint only (compare nothing to it). subagent: type: string description: On transcript, the sub-agent whose file moved; absent for the parent. action: type: integer format: int64 description: On feed, the action that was added or changed. batch: type: integer format: int64 description: On feed, the batch that was cut or changed. step: type: string description: On overview, the step that changed (collect, bundle, start_agent, report, cleanup); absent at create. queued: type: integer description: Steering notes still waiting on steer. delivered_at: type: string format: date-time description: Set on steer once a note reached the agent. kind: type: string description: Notification kind on notify. text: type: string description: > The notification's formatted text on notify, for example "serve updated v0.34.0 → v0.35.0 on remote1". It never holds terminal text. PairRequest: type: object required: [code] properties: code: type: string description: The 10-character code from the pairing QR. Never log it. device_name: type: string PairResponse: type: object required: [device_id, token] properties: device_id: type: string token: type: string description: > Device bearer token, 32 random bytes as hex. The gateway keeps only its sha256. Never log this value. Device: type: object required: [id, name, created_at, allow_destructive] properties: id: type: string name: type: string created_at: type: string format: date-time last_seen: type: string format: date-time login: type: string description: Tailnet login that paired the device. allow_destructive: type: boolean description: > Lets the device call pty.input, pty.create, pty.run, pty.kill, pty.forget, session.create, session.restart, session.forget, review.post, agents.update, agents.move_prefix and aws.login_start, open the terminal WebSocket, and close, drop, rename or remove a to-do whose ref starts with gate:. Other to-do edits, session.prompt and steer.send do not need it. DeviceList: type: object required: [devices] properties: devices: type: array items: $ref: "#/components/schemas/Device" PairingQR: type: object description: > Output of `aiman-gateway pair --json` on the host. Not served over HTTP; `uri` is the QR payload the phone scans. required: [target, host, code, expires_at, uri] properties: target: type: string description: tsnet target, `:`. host: type: string code: type: string expires_at: type: string format: date-time uri: type: string description: "`aimanphone://pair?target=&host=&code=`" PushData: type: object description: The `data` object of every push notification. required: [session, host, url] properties: session: type: string description: Empty for a feed_action push. host: type: string url: type: string description: >- Deep link `aimanphone://h//s/`; for kind feed_action, whose session is empty, `aimanphone://h//feed` (the Feed tab).