{"openapi":"3.1.0","info":{"title":"Koidog API","version":"v1","description":"One API for every client of Koidog: the dashboard, the CLI and other apps and services.\n\n**Credentials.** Send an API key as `Authorization: Bearer kdk_...`. Keys are created by the founder with explicit scopes (`x-koidog-scopes` on each operation says which it needs; a key needs all of them): `read`, `crews` (launch and control), `config` (projects, connections, nodes, settings, webhooks) and `approve` (merging, deciding approvals, raising budget limits, destructive operations). The dashboard's session cookie is also accepted and then needs an allowed `Origin` on anything but a GET.\n\n**Errors.** Every non-2xx answer is `{\"error\": {\"type\", \"code\", \"message\", \"requestId\", \"details\"?}}`. Branch on `type` (invalid_request, authentication, permission, not_found, conflict, rate_limited, not_built, upstream, internal); `code` is the stable reason.\n\n**Lists.** Every collection answers `{\"data\": [...], \"nextCursor\": string|null, \"hasMore\": boolean}` and takes `limit`, `cursor` and `order`. Filters are query parameters named after the field; enum filters take comma-separated values. Unknown query parameters are refused.\n\n**Idempotency.** Every POST accepts `Idempotency-Key`. The same key with the same request returns the first answer (`Idempotency-Replayed: true`) and does nothing else; with a different request it is refused. Use one on every create and on anything that spends or merges.\n\n**Long-running actions.** An action answers with the resource in its new state; what follows is on the timeline (`GET /events/stream`). There is no separate operation resource.\n\n**Rate limits.** Per key, per minute. Answers carry `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`; over the limit is 429 with `Retry-After`.\n\n**Ids, time, money.** Ids are opaque prefixed strings. Timestamps are ISO-8601 UTC in fields ending `At`. Money is a number of US dollars in fields ending `Usd`.\n\n**Counts.** Requested workers, agents and VMs are three separate numbers in every answer and are never added together.\n\n**Stability.** `x-koidog-stability` is `stable`, `experimental` (may change inside v1) or `not_built` (answers 501 and does nothing). Stable routes change only by addition; anything else needs /api/v2 with at least 90 days of notice through `Deprecation` and `Sunset` headers. Ignore fields and event kinds you do not know.\n\nEvery answer carries `X-Request-Id` and `Koidog-Api-Version`.","x-koidog-server-version":"0.1.0"},"servers":[{"url":"https://app.koi.dog/api/v1"}],"tags":[{"name":"Meta"},{"name":"Session"},{"name":"Overview"},{"name":"Projects"},{"name":"Connections"},{"name":"Crews"},{"name":"Tasks"},{"name":"Agents"},{"name":"Runs"},{"name":"Nodes"},{"name":"Cloud"},{"name":"Pull requests"},{"name":"Approvals"},{"name":"Events"},{"name":"Artifacts"},{"name":"Costs and settings"},{"name":"Previews"},{"name":"API keys"},{"name":"Webhooks"},{"name":"Automations"},{"name":"Invitations"}],"paths":{"/":{"get":{"operationId":"getApiInfo","tags":["Meta"],"summary":"What this server is","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","const":"Koidog"},"apiVersion":{"type":"string","const":"v1"},"serverVersion":{"type":"string"},"openapi":{"type":"string"}},"required":["name","apiVersion","serverVersion","openapi"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[],"x-koidog-stability":"stable","x-koidog-access":"public","x-koidog-scopes":[]}},"/openapi.json":{"get":{"operationId":"getOpenApi","tags":["Meta"],"summary":"This description","description":"OpenAPI 3.1, generated from the same schemas the server validates with.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[],"x-koidog-stability":"stable","x-koidog-access":"public","x-koidog-scopes":[]}},"/whoami":{"get":{"operationId":"getWhoAmI","tags":["Meta"],"summary":"The credential in use, its scopes and its rate limit","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"credential":{"type":"string","enum":["session","api_key"]},"scopes":{"type":"array","items":{"type":"string","enum":["read","crews","config","approve"]}},"apiKey":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"}},"required":["id","name","prefix"]},{"type":"null"}]},"rateLimit":{"anyOf":[{"type":"object","properties":{"limitPerMinute":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"remaining":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"resetSeconds":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["limitPerMinute","remaining","resetSeconds"]},{"type":"null"}]},"installId":{"type":"string"},"serverVersion":{"type":"string"}},"required":["credential","scopes","apiKey","rateLimit","installId","serverVersion"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"any","x-koidog-scopes":[]}},"/session":{"get":{"operationId":"getSession","tags":["Session"],"summary":"Whether the dashboard is signed in","description":"For the dashboard. An API key does not use sessions. `auth` says how this install signs in (`passphrase` or `clerk`), with the Clerk publishable key when it is Clerk. With Clerk, a signed-in user who is not allowed into this install gets `403 not_allowed`.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"authenticated":{"type":"boolean"},"setupRequired":{"type":"boolean"},"installId":{"type":"string"},"version":{"type":"string"},"auth":{"type":"string","enum":["passphrase","clerk"]},"clerkPublishableKey":{"type":["string","null"]}},"required":["authenticated","setupRequired","installId","version","auth","clerkPublishableKey"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[],"x-koidog-stability":"stable","x-koidog-access":"public","x-koidog-scopes":[]}},"/session/setup":{"post":{"operationId":"setupSession","tags":["Session"],"summary":"Set the founder's passphrase (first run only)","description":"For the dashboard. Sets the session cookie. Needs an allowed Origin. An install that signs in with Clerk has no passphrase and answers `409 passphrase_disabled`.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"passphrase":{"type":"string","minLength":10}},"required":["passphrase"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"authenticated":{"type":"boolean"},"setupRequired":{"type":"boolean"},"installId":{"type":"string"},"version":{"type":"string"},"auth":{"type":"string","enum":["passphrase","clerk"]},"clerkPublishableKey":{"type":["string","null"]}},"required":["authenticated","setupRequired","installId","version","auth","clerkPublishableKey"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[],"x-koidog-stability":"stable","x-koidog-access":"public","x-koidog-scopes":[]}},"/session/login":{"post":{"operationId":"loginSession","tags":["Session"],"summary":"Sign the dashboard in","description":"For the dashboard. Sets the session cookie. Needs an allowed Origin. Rate limited after repeated failures. An install that signs in with Clerk answers `409 passphrase_disabled`.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"passphrase":{"type":"string"}},"required":["passphrase"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"authenticated":{"type":"boolean"},"setupRequired":{"type":"boolean"},"installId":{"type":"string"},"version":{"type":"string"},"auth":{"type":"string","enum":["passphrase","clerk"]},"clerkPublishableKey":{"type":["string","null"]}},"required":["authenticated","setupRequired","installId","version","auth","clerkPublishableKey"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[],"x-koidog-stability":"stable","x-koidog-access":"public","x-koidog-scopes":[]}},"/session/logout":{"post":{"operationId":"logoutSession","tags":["Session"],"summary":"Sign the dashboard out","description":"Ends the passphrase session and clears its cookie. With Clerk it changes nothing and answers `ok`: Clerk's browser code signs out.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"session","x-koidog-scopes":[]}},"/overview":{"get":{"operationId":"getOverview","tags":["Overview"],"summary":"Fleet, agents, budget and recent crews in one answer","description":"Shaped for the dashboard's home page. `requestedWorkers`, `agents` and `fleet.vms` are three separate counts.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"fleet":{"type":"object","properties":{"nodes":{"type":"object","properties":{"online":{"type":"number"},"offline":{"type":"number"},"disabled":{"type":"number"},"total":{"type":"number"}},"required":["online","offline","disabled","total"]},"slots":{"type":"object","properties":{"total":{"type":"number"},"busy":{"type":"number"}},"required":["total","busy"]},"vms":{"type":"object","propertyNames":{"type":"string","enum":["intended","creating","booting","online","draining","deleting","deleted","failed","lost"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["intended","creating","booting","online","draining","deleting","deleted","failed","lost"]}},"required":["nodes","slots","vms"]},"agents":{"type":"object","propertyNames":{"type":"string","enum":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"requestedWorkers":{"type":"number"},"budget":{"$ref":"#/components/schemas/Budget"},"cloud":{"$ref":"#/components/schemas/CloudLimits"},"activeBase":{"type":["string","null"]},"crews":{"type":"array","items":{"$ref":"#/components/schemas/CrewSummary"}},"projects":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"pendingApprovals":{"type":"number"},"features":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"status":{"type":"string","enum":["live","limited","blocked","planned"]},"note":{"default":"","type":"string"}},"required":["key","title","status","note"]}}},"required":["fleet","agents","requestedWorkers","budget","cloud","activeBase","crews","projects","pendingApprovals","features"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/projects":{"get":{"operationId":"listProjects","tags":["Projects"],"summary":"List projects","description":"Archived projects are left out unless `archived` is `include` or `only`.","parameters":[{"name":"archived","in":"query","required":false,"schema":{"default":"exclude","type":"string","enum":["exclude","include","only"]}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"post":{"operationId":"createProject","tags":["Projects"],"summary":"Create a project","description":"`repo` is a GitHub `owner/name`, or null for a project that only exists in Koidog's own mirror (no pull requests are opened). `validation` holds the commands a node runs on the committed result (`install`, `build`, `test`, `lint`).","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"repo":{"anyOf":[{"type":"string","pattern":"^[\\w.-]+\\/[\\w.-]+$"},{"type":"null"}]},"defaultBranch":{"default":"main","type":"string"},"instructions":{"default":"","type":"string"},"validation":{"default":{},"type":"object","properties":{"install":{"type":"string"},"build":{"type":"string"},"test":{"type":"string"},"lint":{"type":"string"},"preview":{"type":"object","properties":{"command":{"type":"string","minLength":1},"port":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ready":{"type":"object","properties":{"path":{"type":"string","format":"starts_with","pattern":"^\\/.*"},"timeoutSeconds":{"type":"integer","minimum":5,"maximum":1800}}}},"required":["command"]},"commands":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,30}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":2000}}}}},"required":["name","repo"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/projects/{id}":{"get":{"operationId":"getProject","tags":["Projects"],"summary":"Read a project","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"patch":{"operationId":"updateProject","tags":["Projects"],"summary":"Change a project","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"repo":{"anyOf":[{"type":"string","pattern":"^[\\w.-]+\\/[\\w.-]+$"},{"type":"null"}]},"defaultBranch":{"type":"string","minLength":1},"instructions":{"type":"string"},"validation":{"type":"object","properties":{"install":{"type":"string"},"build":{"type":"string"},"test":{"type":"string"},"lint":{"type":"string"},"preview":{"type":"object","properties":{"command":{"type":"string","minLength":1},"port":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ready":{"type":"object","properties":{"path":{"type":"string","format":"starts_with","pattern":"^\\/.*"},"timeoutSeconds":{"type":"integer","minimum":5,"maximum":1800}}}},"required":["command"]},"commands":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,30}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":2000}}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/projects/{id}/archive":{"post":{"operationId":"archiveProject","tags":["Projects"],"summary":"Archive a project","description":"Not a delete: its crews, pull requests and evidence keep pointing at it and can still be read. An archived project is left out of `GET /projects` unless asked for, and launching a crew on it is refused (`409 launch_blocked`) until it is unarchived. Crews already running on it are not stopped. Archiving an archived project changes nothing.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/projects/{id}/unarchive":{"post":{"operationId":"unarchiveProject","tags":["Projects"],"summary":"Unarchive a project","description":"Crews can be launched on it again. Unarchiving an active project changes nothing.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Project"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/connections":{"get":{"operationId":"listConnections","tags":["Connections"],"summary":"List model connections","description":"A connection never carries its secret; `hasSecret` says whether one is stored.","parameters":[{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Connection"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"post":{"operationId":"createConnection","tags":["Connections"],"summary":"Add a model connection","description":"Starts `untested`. Store its credential with `PUT /connections/{id}/secret`, then test it.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"provider":{"type":"string","enum":["anthropic","morph","openai","custom"]},"model":{"type":"string","minLength":1},"auth":{"type":"string","enum":["local_login","oauth_token","api_key","boat_profile"]},"baseUrl":{"type":"string","format":"uri"},"scope":{"type":"string","enum":["local","cloud","both"]},"metering":{"type":"string","enum":["subscription","metered"]},"maxConcurrent":{"type":"integer","minimum":1,"maximum":100},"defaultOptions":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["name","harness","provider","model","auth","scope","metering","maxConcurrent"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/connections/{id}":{"get":{"operationId":"getConnection","tags":["Connections"],"summary":"Read a connection","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"patch":{"operationId":"updateConnection","tags":["Connections"],"summary":"Change a connection","description":"Changing the harness, model, auth or base URL marks it `untested` again.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"provider":{"type":"string","enum":["anthropic","morph","openai","custom"]},"model":{"type":"string","minLength":1},"auth":{"type":"string","enum":["local_login","oauth_token","api_key","boat_profile"]},"baseUrl":{"type":"string","format":"uri"},"scope":{"type":"string","enum":["local","cloud","both"]},"metering":{"type":"string","enum":["subscription","metered"]},"maxConcurrent":{"type":"integer","minimum":1,"maximum":100},"defaultOptions":{"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]},"delete":{"operationId":"deleteConnection","tags":["Connections"],"summary":"Delete a connection and its stored credential","description":"Refused while agents still use it. Destructive, so a key needs `approve` as well as `config`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Done; no content"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config","approve"],"x-koidog-audited":true}},"/connections/{id}/secret":{"put":{"operationId":"setConnectionSecret","tags":["Connections"],"summary":"Store or replace the connection's credential","description":"Write-only. The value is encrypted at rest and is never returned, logged or put in an event.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"string","minLength":1,"maxLength":20000}},"required":["value"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/connections/{id}/test":{"post":{"operationId":"testConnection","tags":["Connections"],"summary":"Test a connection with one real model turn","description":"Waits for the result, up to 90 seconds. Needs a paired machine online that can run the harness.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/models":{"get":{"operationId":"listModels","tags":["Connections"],"summary":"The models each connection can run","description":"One catalogue per connection, read from the provider's own list where it has one. `error` says plainly why a live list could not be read. Answers in one page.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ModelCatalog"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/connections/{id}/models/refresh":{"post":{"operationId":"refreshConnectionModels","tags":["Connections"],"summary":"Read a connection's model list from its provider now","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelCatalog"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/crews":{"get":{"operationId":"listCrews","tags":["Crews"],"summary":"List crews","parameters":[{"name":"projectId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["planning","running","paused","completed","failed","canceled"]}}},{"name":"mode","in":"query","required":false,"schema":{"type":"string","enum":["direct","managed"]}},{"name":"automationId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/CrewSummary"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"post":{"operationId":"launchCrew","tags":["Crews"],"summary":"Launch a crew","description":"Writes the crew and its tasks, then schedules agents. `mode: \"direct\"` runs the tasks you list (or `repeatGoal: true` runs the goal `requestedSize` times); `mode: \"managed\"` lets a manager plan the tasks and merge them into one pull request. `profiles.builder` is the connection id the builders use. `placement.allowLocal` and `allowCloud` choose paired machines, cloud VMs or both. `limits.budgetUsd` and `limits.maxVms` are hard caps on cloud compute for this crew. Refused with `409 launch_blocked` (every blocker in `details`) when the forecast has blockers. Send an `Idempotency-Key`: without one a retried request launches a second crew. The crew then runs on its own: follow `GET /events/stream?crewId=` and read `GET /crews/{id}`.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}}}},"required":["title","instructions"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}}},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}}}},"required":["budgetUsd","maxVms","timeoutMinutes"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","profiles","limits"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrewView"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"],"x-koidog-audited":true}},"/crews/forecast":{"post":{"operationId":"forecastCrew","tags":["Crews"],"summary":"What a launch would do and cost, without launching","description":"Takes the same body as a launch and creates nothing. `blockers` lists everything that would refuse the launch; `cloud` is the worst-case cloud cost; `needsApproval` says when the crew would wait for the founder before any VM starts.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}}}},"required":["title","instructions"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}}},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}}}},"required":["budgetUsd","maxVms","timeoutMinutes"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","profiles","limits"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Forecast"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/crews/{id}":{"get":{"operationId":"getCrew","tags":["Crews"],"summary":"Read a crew","description":"`crew.requestedSize` and `crew.maxAgents` (requested workers), `agents` (a count per agent state) and `vmsRunning` are separate numbers. `include` adds the crew's tasks, agents, VMs, approvals and artifacts to the answer.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"include","in":"query","required":false,"description":"Lists to return with the crew, comma-separated: tasks, agents, vms, approvals, artifacts.","style":"form","explode":false,"schema":{"type":"array","items":{"type":"string","enum":["tasks","agents","vms","approvals","artifacts"]}}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrewView"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/crews/{id}/cancel":{"post":{"operationId":"cancelCrew","tags":["Crews"],"summary":"Cancel a crew and stop every agent","description":"Answers at once with the crew `canceled`; each agent turns `canceled` when its machine confirms.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrewView"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/crews/{id}/pause":{"post":{"operationId":"pauseCrew","tags":["Crews"],"summary":"Stop starting new agents; running ones continue","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrewView"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/crews/{id}/resume":{"post":{"operationId":"resumeCrew","tags":["Crews"],"summary":"Resume a paused crew","description":"Also retries the last step of a managed crew that failed after every task was merged, and puts the latest plan to the founder again for a crew stopped on its plan revision bound (`limits.review.planRevisions`).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrewView"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/crews/{id}/retry-failed":{"post":{"operationId":"retryFailedAgents","tags":["Crews"],"summary":"Run every failed agent of a crew again","description":"In one step, retries every failed or stopped agent of the crew that `POST /agents/{id}/retry` would accept: either all of them are queued (and a crew that had ended is reopened once, with its time limit started again), or nothing changes. Agents it leaves are in `skipped` with the reason, in the same words the agent route refuses with (a managed crew's merge step whose task is already merged, a task a re-plan or steer dropped). Optional `guidance` has the same meaning and limits as on the agent route and is given to each agent retried. One `notice` (`data.code: agents_retried`) says who retried how many; each agent then has its own state event. Answers `409 nothing_to_retry` when there is nothing to retry (the crew was canceled, no agent has failed, or none that failed can be retried); `CrewView.canRetryFailed` says the same in advance.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"guidance":{"type":"string","minLength":1,"maxLength":4000}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"crew":{"$ref":"#/components/schemas/Crew"},"projectName":{"type":"string"},"agents":{"type":"object","propertyNames":{"type":"string","enum":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"tasks":{"type":"object","properties":{"total":{"type":"number"},"done":{"type":"number"},"failed":{"type":"number"},"blocked":{"type":"number"}},"required":["total","done","failed","blocked"]},"vmsRunning":{"type":"number"},"spentUsd":{"type":"number"},"reservedUsd":{"type":"number"},"managerNote":{"type":["string","null"]},"taskList":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"agentList":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"vmList":{"type":"array","items":{"$ref":"#/components/schemas/Vm"}},"approvals":{"type":"array","items":{"$ref":"#/components/schemas/Approval"}},"artifacts":{"type":"array","items":{"$ref":"#/components/schemas/Artifact"}},"moves":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]}},"review":{"type":"object","properties":{"settings":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]},"reviewerOn":{"type":"boolean"},"followUpRounds":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["used","max"]},"replans":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["used","max"]},"addedTasks":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["used","max"]},"turns":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["review","replan","reviewer"]},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]},"sha":{"type":["string","null"]},"forTaskId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"decision":{"anyOf":[{"type":"string","enum":["accept","follow_up","not_achievable","replace","drop","stop","approve","changes_requested"]},{"type":"null"}]},"note":{"type":["string","null"]},"reason":{"type":["string","null"]},"addedTaskIds":{"type":"array","items":{"type":"string","minLength":5}},"bound":{"type":["string","null"]},"at":{"type":"string"}},"required":["taskId","kind","state","sha","forTaskId","decision","note","reason","addedTaskIds","bound","at"]}},"reviewer":{"anyOf":[{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"sha":{"type":"string"},"verdict":{"type":"string","enum":["approve","changes_requested"]},"summary":{"type":"string"},"findings":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string","minLength":1,"maxLength":500},"line":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"severity":{"type":"string","enum":["blocking","major","minor","nit"]},"title":{"type":"string","minLength":1,"maxLength":200},"explanation":{"type":"string","minLength":1,"maxLength":4000}},"required":["file","line","severity","title","explanation"]}},"checked":{"type":"array","items":{"type":"string"}},"blocking":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"model":{"type":["string","null"]},"connection":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":["string","null"]}},"required":["id","name"]},{"type":"null"}]},"at":{"type":"string"}},"required":["taskId","runId","sha","verdict","summary","findings","checked","blocking","model","at"]},{"type":"null"}]}},"required":["settings","reviewerOn","followUpRounds","replans","addedTasks","turns","reviewer"]},"planApproval":{"type":"object","properties":{"state":{"type":"string","enum":["planning","waiting","replanning","applying","approved","rejected","stopped"]},"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"revisionsUsed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxRevisions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approvalId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"clockPaused":{"type":"boolean"},"pausedMinutes":{"type":"number"},"deadline":{"type":["string","null"]},"summary":{"type":"string"},"revisions":{"type":"array","items":{"type":"object","properties":{"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"taskId":{"type":"string","minLength":5},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]},"askedChanges":{"anyOf":[{"type":"object","properties":{"note":{"type":"string"},"by":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},{"type":"null"}]},"at":{"type":"string"}},"required":["note","by","at"]},{"type":"null"}]},"plan":{"anyOf":[{"type":"object","properties":{"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"note":{"type":"string"},"tasks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"role":{"type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"deps":{"type":"array","items":{"type":"string"}},"owns":{"type":"array","items":{"type":"string"}},"instructions":{"type":"string"},"acceptance":{"type":"string"}},"required":["key","title","role","deps","owns","instructions","acceptance"]}},"width":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"commit":{"type":"string"},"runId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"outcome":{"anyOf":[{"type":"string","enum":["approved","changes_requested","rejected"]},{"type":"null"}]}},"required":["revision","note","tasks","width","commit","runId","taskId","outcome"]},{"type":"null"}]},"approvalIds":{"type":"array","items":{"type":"string","minLength":5}}},"required":["revision","taskId","runId","state","askedChanges","plan","approvalIds"]}}},"required":["state","revision","revisionsUsed","maxRevisions","approvalId","clockPaused","pausedMinutes","deadline","summary","revisions"]},"steering":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"canSteer":{"type":"object","properties":{"ok":{"type":"boolean"},"reason":{"type":"string"}},"required":["ok"]},"steers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"message":{"type":"string"},"by":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"at":{"type":"string"},"state":{"type":"string","enum":["pending","applied","not_applied"]},"status":{"type":"string"},"taskId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"explanation":{"type":["string","null"]},"changes":{"anyOf":[{"type":"object","properties":{"added":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}},"dropped":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"},"reason":{"type":"string"},"stopped":{"type":"boolean"}},"required":["taskId","key","title","reason","stopped"]}},"changed":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"},"fields":{"type":"array","items":{"type":"string","enum":["title","instructions","acceptance","dependencies"]}}},"required":["taskId","key","title","fields"]}},"order":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}},{"type":"null"}]},"orderSkipped":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}}},"required":["added","dropped","changed","order","orderSkipped"]},{"type":"null"}]},"endedAt":{"type":["string","null"]}},"required":["id","crewId","message","by","at","state","status","taskId","runId","explanation","changes","endedAt"]}}},"required":["used","max","canSteer","steers"]},"canResume":{"type":"object","properties":{"ok":{"type":"boolean"},"reason":{"type":"string"},"code":{"type":"string","enum":["not_paused","ended","nothing_to_resume"]}},"required":["ok"]},"canRetryFailed":{"type":"object","properties":{"ok":{"type":"boolean"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"reason":{"type":"string"}},"required":["ok","count"]},"stopKind":{"type":"string","enum":["timeout","plan_failed","plan_revision_bound","integration_failed","step_failed","review_bound","not_achievable","manager_stopped","tasks_failed","merge_failed","delivery_failed","delivery_declined"]},"deliveredPastReview":{"type":"object","properties":{"delivered":{"type":"boolean"},"reason":{"type":"string"}},"required":["delivered","reason"]},"retried":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5}},"required":["agentId","taskId"]}},"skipped":{"type":"array","items":{"type":"object","properties":{"agentId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"reason":{"type":"string"}},"required":["agentId","taskId","reason"]}}},"required":["crew","projectName","agents","tasks","vmsRunning","spentUsd","managerNote","retried","skipped"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/crews/{id}/resize":{"post":{"operationId":"resizeCrew","tags":["Crews"],"summary":"Change how many agents may run at once","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"maxAgents":{"type":"integer","minimum":1,"maximum":100}},"required":["maxAgents"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrewView"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/crews/{id}/steer":{"post":{"operationId":"steerCrew","tags":["Crews"],"summary":"Steer a managed crew: send its manager a message","description":"Records the message at once with who sent it (`steer.received`) and re-engages the manager, which answers with one decision Koidog checks and applies in a single step: change the order in which tasks that have not started are picked up, add tasks (within `limits.review.maxAddedTasks`), drop tasks that have not finished, and change the instructions or dependencies of tasks that have not started, with an explanation of the impact. The answer carries the recorded `steer` (state `pending`); its outcome is on the crew's `steering.steers` and on the events `steer.started`, `steer.applied` and `steer.not_applied`. Builders already working carry on unless the decision drops their task. The message has the founder's authority over priorities only: it cannot raise the budget, the time limit, the VM or agent counts, change placement, models or the review bounds, or ask for a merge, a deployment or a deletion. A decision that does not check out goes back to the manager within the crew's `maxRetries`; after that the steer ends `not_applied` and the crew carries on unchanged. Answers `409 conflict` for a direct crew, a crew that has ended, a plan waiting for the founder's approval (answer the approval instead), while an earlier steer is still pending, and once the crew's `limits.review.steers` (default 10) are used. While the manager is still writing its first plan the message goes straight to that run and no `steer` is returned.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":4000}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"steer":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"message":{"type":"string"},"by":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"at":{"type":"string"},"state":{"type":"string","enum":["pending","applied","not_applied"]},"status":{"type":"string"},"taskId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"explanation":{"type":["string","null"]},"changes":{"anyOf":[{"type":"object","properties":{"added":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}},"dropped":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"},"reason":{"type":"string"},"stopped":{"type":"boolean"}},"required":["taskId","key","title","reason","stopped"]}},"changed":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"},"fields":{"type":"array","items":{"type":"string","enum":["title","instructions","acceptance","dependencies"]}}},"required":["taskId","key","title","fields"]}},"order":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}},{"type":"null"}]},"orderSkipped":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}}},"required":["added","dropped","changed","order","orderSkipped"]},{"type":"null"}]},"endedAt":{"type":["string","null"]}},"required":["id","crewId","message","by","at","state","status","taskId","runId","explanation","changes","endedAt"]}},"required":["ok"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"],"x-koidog-audited":true}},"/crews/{id}/tasks":{"post":{"operationId":"addCrewTask","tags":["Crews"],"summary":"Add a task to a running or paused crew","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}}}},"required":["title","instructions"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/tasks":{"get":{"operationId":"listTasks","tags":["Tasks"],"summary":"List tasks","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/tasks/{id}":{"get":{"operationId":"getTask","tags":["Tasks"],"summary":"Read a task","description":"`pr` is the task's pull request as last read from GitHub, once Koidog has opened one.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/tasks/{id}/diff":{"get":{"operationId":"getTaskDiff","tags":["Tasks"],"summary":"The task branch against the project's default branch","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"base":{"type":"string"},"head":{"type":"string"},"files":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"status":{"type":"string","enum":["added","modified","deleted","renamed"]},"additions":{"type":"number"},"deletions":{"type":"number"},"patch":{"type":"string"}},"required":["path","status","additions","deletions","patch"]}},"truncated":{"type":"boolean"}},"required":["base","head","files","truncated"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/agents":{"get":{"operationId":"listAgents","tags":["Agents"],"summary":"List agents","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"taskId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"nodeId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/agents/{id}":{"get":{"operationId":"getAgent","tags":["Agents"],"summary":"Read an agent with its task and runs","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"},"task":{"$ref":"#/components/schemas/Task"},"runs":{"type":"array","items":{"$ref":"#/components/schemas/Run"}},"nodeName":{"type":["string","null"]},"moves":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]}}},"required":["agent","task","runs","nodeName"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/agents/{id}/steer":{"post":{"operationId":"steerAgent","tags":["Agents"],"summary":"Send a message to a running agent","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/agents/{id}/interrupt":{"post":{"operationId":"interruptAgent","tags":["Agents"],"summary":"Interrupt the agent's current turn","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/agents/{id}/cancel":{"post":{"operationId":"cancelAgent","tags":["Agents"],"summary":"Cancel an agent","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/agents/{id}/retry":{"post":{"operationId":"retryAgent","tags":["Agents"],"summary":"Run a failed agent again from its task branch","description":"Optional `guidance` (up to 4000 characters) is added to the next run's prompt as the founder's guidance for this attempt, after the task's instructions. It is recorded on the agent and on each later run (`guidance`, with who gave it) and stays with the agent, through automatic retries and recoveries, until a later retry replaces it. Without a body the agent keeps the guidance it had. An agent that is not failed or stopped answers `409 conflict`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"guidance":{"type":"string","minLength":1,"maxLength":4000}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/agents/{id}/move-options":{"get":{"operationId":"getAgentMoveOptions","tags":["Agents"],"summary":"Where an agent could move now, and with which model","description":"Creates nothing. Judges every target (stay where it is, a cloud worker, each paired machine) for the model choice in the query (default: the agent's own) and says for each whether it can take the agent now and why or why not: machine online with a free slot and the harness, the connection's scope and concurrency, and for the cloud the planner's caps, budget, start gates and base image. `movable` says whether the agent can be moved at all right now; `inProgress` is a move already under way.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"connectionId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"model","in":"query","required":false,"schema":{"type":"string","minLength":1}},{"name":"effort","in":"query","required":false,"schema":{"type":"string","enum":["low","medium","high","xhigh","max"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agentId":{"type":"string"},"movable":{"type":"object","properties":{"ok":{"type":"boolean"},"reason":{"type":"string"}},"required":["ok","reason"]},"current":{"type":"object","properties":{"nodeId":{"type":["string","null"]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"connectionId":{"type":"string"},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["nodeId","nodeName","machine","connectionId","harness","model","options"]},"choice":{"type":"object","properties":{"connectionId":{"type":"string"},"connectionName":{"type":"string"},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"problem":{"type":["string","null"]}},"required":["connectionId","connectionName","harness","model","options","problem"]},"targets":{"type":"array","items":{"type":"object","properties":{"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"label":{"type":"string"},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"ok":{"type":"boolean"},"reason":{"type":"string"}},"required":["target","label","machine","ok","reason"]}},"inProgress":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]},{"type":"null"}]}},"required":["agentId","movable","current","choice","targets","inProgress"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/agents/{id}/move":{"post":{"operationId":"moveAgent","tags":["Agents"],"summary":"Move an agent's work to another machine and/or switch its model","description":"One mechanism for a Mac to Boat handoff, a Boat to Mac handoff and a model, connection or harness switch. The same agent continues; no second agent is created. A working agent keeps working while its work (uncommitted changes too) is copied onto the task branch; then its turn is stopped at a safe point, what it left is saved, and its next run continues from that commit and is told it is taking over. `target` defaults to `{\"kind\": \"stay\"}` (a switch only); `connectionId`, `model` and `options` default to the agent's own. A move to the cloud goes through the planner like a launch: it reserves budget, honours the crew's and the install's caps and the start gates, and may start a VM. Refused with `409 conflict` and the reason, changing nothing, when the agent or the target cannot do it now (read `GET /agents/{id}/move-options` first). Follow it with `agent.move` events or `GET /agents/{id}/moves`. Send an `Idempotency-Key`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"target":{"default":{"kind":"stay"},"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"connectionId":{"type":"string","minLength":5},"model":{"type":"string","minLength":1},"options":{"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"},"move":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]}},"required":["agent","move"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"],"x-koidog-audited":true}},"/agents/{id}/handoff":{"post":{"operationId":"handoffAgent","tags":["Agents"],"summary":"Move an agent's work to the cloud, to a paired machine, or to the best paired machine","description":"A shorthand for `POST /agents/{id}/move` with only a target and the agent's own model: `\"cloud\"`, a node id, or `\"local\"` for the first paired machine (not a cloud worker) that can take it now. Refused with `409 conflict` and the reason for each machine when none can.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"target":{"anyOf":[{"type":"string","const":"cloud"},{"type":"string","const":"local"},{"type":"string","minLength":5}]}},"required":["target"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"},"move":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]}},"required":["agent","move"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"],"x-koidog-audited":true}},"/agents/{id}/moves":{"get":{"operationId":"listAgentMoves","tags":["Agents"],"summary":"An agent's moves and model switches, newest first","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/runs":{"get":{"operationId":"listRuns","tags":["Runs"],"summary":"List runs","description":"One run is one attempt by an agent on a node.","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"agentId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"taskId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"nodeId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Run"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/runs/{id}":{"get":{"operationId":"getRun","tags":["Runs"],"summary":"Read a run with its evidence and usage","description":"`evidence` is what Koidog verified: commits on the branch, every check command the node ran with its exit code, whether the branch was pushed, the pull request. A run's `outcome` is `success` only on that evidence.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Run"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/runs/{id}/log":{"get":{"operationId":"listRunLog","tags":["Runs"],"summary":"A run's log lines","description":"Oldest first. Secrets are scrubbed when lines are stored.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"asc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"number"},"ts":{"type":"string"},"stream":{"type":"string","enum":["stdout","stderr","node","agent","tool"]},"text":{"type":"string"}},"required":["seq","ts","stream","text"]}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/nodes":{"get":{"operationId":"listNodes","tags":["Nodes"],"summary":"List machines running the Koidog node","description":"Revoked nodes are left out unless `state` asks for them.","parameters":[{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["pending","online","offline","disabled","revoked"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Node"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/nodes/{id}":{"get":{"operationId":"getNode","tags":["Nodes"],"summary":"Read a node","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Node"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"patch":{"operationId":"updateNode","tags":["Nodes"],"summary":"Rename a node, cap its agents or stop it accepting tasks","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1},"maxAgents":{"type":"integer","minimum":0,"maximum":32},"acceptsTasks":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Node"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/nodes/pairing-codes":{"post":{"operationId":"createPairingCode","tags":["Nodes"],"summary":"Create a one-time code to pair a machine","description":"The code is valid for 10 minutes and works once. Whoever holds it can add a machine.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"expiresAt":{"type":"string"},"command":{"type":"string"}},"required":["code","expiresAt","command"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/nodes/{id}/diagnose":{"post":{"operationId":"diagnoseNode","tags":["Nodes"],"summary":"Ask a connected node to check itself","description":"Waits up to 20 seconds for the node's answer.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"nodeId":{"type":"string"},"at":{"type":"string"},"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"ok":{"type":"boolean"},"detail":{"type":"string"}},"required":["name","ok","detail"]}}},"required":["nodeId","at","checks"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/nodes/{id}/revoke":{"post":{"operationId":"revokeNode","tags":["Nodes"],"summary":"Unpair a node; its token stops working","description":"Destructive, so a key needs `approve` as well as `config`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Node"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config","approve"],"x-koidog-audited":true}},"/cloud":{"get":{"operationId":"getCloud","tags":["Cloud"],"summary":"The cloud provider: connection, limits, budget, VMs and base templates","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","const":"boat"},"connected":{"type":"boolean"},"status":{"type":"string"},"limits":{"$ref":"#/components/schemas/CloudLimits"},"budget":{"$ref":"#/components/schemas/Budget"},"vms":{"type":"array","items":{"$ref":"#/components/schemas/Vm"}},"templates":{"type":"array","items":{"$ref":"#/components/schemas/BaseTemplate"}},"activeBase":{"type":["string","null"]},"region":{"type":"string"}},"required":["provider","connected","status","limits","budget","vms","templates","activeBase","region"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/vms":{"get":{"operationId":"listVms","tags":["Cloud"],"summary":"List cloud VMs Koidog created","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["intended","creating","booting","online","draining","deleting","deleted","failed","lost"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Vm"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/vms/{id}":{"get":{"operationId":"getVm","tags":["Cloud"],"summary":"Read a VM","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vm"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/cloud/stop-all":{"post":{"operationId":"stopAllCloud","tags":["Cloud"],"summary":"Emergency stop: cancel cloud runs, delete every VM, verify","description":"Allowed to anyone who can control crews. Waits until the provider has been listed again and answers the report; `verifiedClean` is true only when the provider lists no VM of this install afterwards.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"at":{"type":"string"},"runsCanceled":{"type":"number"},"vms":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"providerId":{"type":["string","null"]},"result":{"type":"string","enum":["deleted","already_gone","failed"]},"detail":{"type":"string"}},"required":["id","providerId","result","detail"]}},"verifiedClean":{"type":"boolean"}},"required":["at","runsCanceled","vms","verifiedClean"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"],"x-koidog-audited":true}},"/cloud/templates":{"get":{"operationId":"listTemplates","tags":["Cloud"],"summary":"List base templates (worker images)","description":"Answers in one page.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BaseTemplate"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/cloud/templates/build":{"post":{"operationId":"buildTemplate","tags":["Cloud"],"summary":"Build a new base template","description":"Not automated yet: the server answers `409 not_automated` with the steps to build one by hand (cloud/base/provision.sh on a build VM, save the snapshot, then activate it). When built it will start a VM, need budget headroom, and answer at once with progress on the timeline.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"202":{"description":"Accepted; the work continues and is reported on the timeline","content":{"application/json":{"schema":{"type":"object","properties":{"started":{"type":"boolean","const":true}},"required":["started"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/cloud/templates/{name}/activate":{"post":{"operationId":"activateTemplate","tags":["Cloud"],"summary":"Make a base template the one new VMs start from","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","const":"boat"},"connected":{"type":"boolean"},"status":{"type":"string"},"limits":{"$ref":"#/components/schemas/CloudLimits"},"budget":{"$ref":"#/components/schemas/Budget"},"vms":{"type":"array","items":{"$ref":"#/components/schemas/Vm"}},"templates":{"type":"array","items":{"$ref":"#/components/schemas/BaseTemplate"}},"activeBase":{"type":["string","null"]},"region":{"type":"string"}},"required":["provider","connected","status","limits","budget","vms","templates","activeBase","region"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/cloud/api-key":{"put":{"operationId":"setCloudApiKey","tags":["Cloud"],"summary":"Store or replace the cloud provider's API key","description":"Write-only. Koidog reads the account with it at once; `GET /cloud` then says whether the provider accepted it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"value":{"type":"string","minLength":1,"maxLength":20000}},"required":["value"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/pull-requests":{"get":{"operationId":"listPullRequests","tags":["Pull requests"],"summary":"List the pull requests Koidog opened","description":"As last read from GitHub; this call does not contact GitHub.","parameters":[{"name":"projectId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["unknown","open","merged","closed"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"pr":{"$ref":"#/components/schemas/PullRequest"},"project":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"crew":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"goal":{"type":"string"},"state":{"type":"string","enum":["planning","running","paused","completed","failed","canceled"]},"mode":{"type":"string","enum":["direct","managed"]}},"required":["id","goal","state","mode"]},{"type":"null"}]},"task":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"title":{"type":"string"},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]}},"required":["id","key","title","state"]},{"type":"null"}]}},"required":["pr","project","crew","task"]}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/pull-requests/{id}":{"get":{"operationId":"getPullRequest","tags":["Pull requests"],"summary":"Read a pull request as last read from GitHub","description":"`mergeBlockers` lists why Koidog would refuse to merge it now; empty means it may be merged.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PullRequest"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/pull-requests/{id}/refresh":{"post":{"operationId":"refreshPullRequest","tags":["Pull requests"],"summary":"Read a pull request from GitHub now","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PullRequest"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/pull-requests/{id}/review":{"get":{"operationId":"getPullRequestReview","tags":["Pull requests"],"summary":"Everything needed to review a pull request","description":"Reads GitHub now: changed files, commits and GitHub's checks, beside Koidog's own evidence from the run that produced the branch. A part GitHub did not answer is `available: false` with the reason, never a guess.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"pr":{"$ref":"#/components/schemas/PullRequest"},"project":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"crew":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"goal":{"type":"string"}},"required":["id","goal"]},{"type":"null"}]},"task":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"key":{"type":"string"},"title":{"type":"string"},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]},"branch":{"type":["string","null"]}},"required":["id","key","title","state","branch"]},{"type":"null"}]},"files":{"anyOf":[{"type":"object","properties":{"available":{"type":"boolean","const":true},"items":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"status":{"type":"string","enum":["added","modified","deleted","renamed","copied","changed"]},"additions":{"type":"number"},"deletions":{"type":"number"}},"required":["path","status","additions","deletions"]}},"additions":{"type":"number"},"deletions":{"type":"number"},"changedFiles":{"type":"number"},"truncated":{"type":"boolean"}},"required":["available","items","additions","deletions","changedFiles","truncated"]},{"type":"object","properties":{"available":{"type":"boolean","const":false},"reason":{"type":"string"}},"required":["available","reason"]}]},"commits":{"anyOf":[{"type":"object","properties":{"available":{"type":"boolean","const":true},"items":{"type":"array","items":{"type":"object","properties":{"sha":{"type":"string"},"headline":{"type":"string"},"authoredAt":{"type":["string","null"]},"authors":{"type":"array","items":{"type":"string"}}},"required":["sha","headline","authoredAt","authors"]}}},"required":["available","items"]},{"type":"object","properties":{"available":{"type":"boolean","const":false},"reason":{"type":"string"}},"required":["available","reason"]}]},"evidence":{"anyOf":[{"type":"object","properties":{"available":{"type":"boolean","const":true},"runId":{"type":"string"},"agentId":{"type":["string","null"]},"attempt":{"type":"number"},"commits":{"type":"number"},"filesChanged":{"type":"number"},"additions":{"type":"integer","minimum":0,"maximum":9007199254740991},"deletions":{"type":"integer","minimum":0,"maximum":9007199254740991},"branchPushed":{"type":"boolean"},"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"command":{"type":"string"},"exitCode":{"type":"number"},"durationMs":{"type":"number"},"log":{"anyOf":[{"type":"object","properties":{"artifactId":{"type":"string"},"title":{"type":"string"},"bytes":{"type":["number","null"]}},"required":["artifactId","title","bytes"]},{"type":"null"}]}},"required":["name","command","exitCode","durationMs","log"]}}},"required":["available","runId","agentId","attempt","commits","filesChanged","branchPushed","checks"]},{"type":"object","properties":{"available":{"type":"boolean","const":false},"reason":{"type":"string"}},"required":["available","reason"]}]},"githubChecks":{"anyOf":[{"type":"object","properties":{"available":{"type":"boolean","const":true},"summary":{"type":"string","enum":["none","pending","passing","failing"]},"items":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"state":{"type":"string","enum":["pending","passing","failing","skipped","neutral"]},"detail":{"default":"","type":"string"},"url":{"type":"string"}},"required":["name","state","detail"]}}},"required":["available","summary","items"]},{"type":"object","properties":{"available":{"type":"boolean","const":false},"reason":{"type":"string"}},"required":["available","reason"]}]},"crewEvidence":{"anyOf":[{"type":"object","properties":{"available":{"type":"boolean","const":true},"integrationBranch":{"type":"string"},"headSha":{"type":["string","null"]},"tasks":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string"},"key":{"type":"string"},"title":{"type":"string"},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]},"integration":{"type":"string","enum":["none","queued","merged","conflict","failed_checks"]},"branch":{"type":["string","null"]},"headSha":{"type":["string","null"]},"mergedSha":{"type":["string","null"]},"merge":{"type":"string"},"runId":{"type":["string","null"]},"commits":{"type":"number"},"filesChanged":{"type":"number"},"additions":{"type":"integer","minimum":0,"maximum":9007199254740991},"deletions":{"type":"integer","minimum":0,"maximum":9007199254740991},"checks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"command":{"type":"string"},"exitCode":{"type":"number"},"durationMs":{"type":"number"},"log":{"anyOf":[{"type":"object","properties":{"artifactId":{"type":"string"},"title":{"type":"string"},"bytes":{"type":["number","null"]}},"required":["artifactId","title","bytes"]},{"type":"null"}]}},"required":["name","command","exitCode","durationMs","log"]}},"integrationChecks":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"command":{"type":"string"},"exitCode":{"type":"number"},"durationMs":{"type":"number"},"log":{"anyOf":[{"type":"object","properties":{"artifactId":{"type":"string"},"title":{"type":"string"},"bytes":{"type":["number","null"]}},"required":["artifactId","title","bytes"]},{"type":"null"}]}},"required":["name","command","exitCode","durationMs","log"]}},"integrationChecksBy":{"type":"string"}},"required":["taskId","key","title","state","integration","branch","headSha","mergedSha","merge","runId","commits","filesChanged","checks","integrationChecks","integrationChecksBy"]}}},"required":["available","integrationBranch","headSha","tasks"]},{"type":"object","properties":{"available":{"type":"boolean","const":false},"reason":{"type":"string"}},"required":["available","reason"]}]},"reviewer":{"anyOf":[{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"sha":{"type":"string"},"verdict":{"type":"string","enum":["approve","changes_requested"]},"summary":{"type":"string"},"findings":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string","minLength":1,"maxLength":500},"line":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"severity":{"type":"string","enum":["blocking","major","minor","nit"]},"title":{"type":"string","minLength":1,"maxLength":200},"explanation":{"type":"string","minLength":1,"maxLength":4000}},"required":["file","line","severity","title","explanation"]}},"checked":{"type":"array","items":{"type":"string"}},"blocking":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"model":{"type":["string","null"]},"connection":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":["string","null"]}},"required":["id","name"]},{"type":"null"}]},"at":{"type":"string"}},"required":["taskId","runId","sha","verdict","summary","findings","checked","blocking","model","at"]},{"type":"object","properties":{"available":{"type":"boolean","const":false},"reason":{"type":"string"}},"required":["available","reason"]}]},"manager":{"anyOf":[{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["review","replan"]},"decision":{"type":"string","enum":["accept","follow_up","not_achievable","replace","drop","stop"]},"note":{"type":["string","null"]},"sha":{"type":["string","null"]},"at":{"type":"string"}},"required":["taskId","kind","decision","note","sha","at"]},{"type":"null"}]},"readAt":{"type":"string"}},"required":["pr","project","crew","task","files","commits","evidence","githubChecks","readAt"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/pull-requests/{id}/merge":{"post":{"operationId":"mergePullRequest","tags":["Pull requests"],"summary":"Merge a pull request","description":"An approval action: the session, or a key the founder gave `approve`. `headSha` is the head commit that was reviewed; the merge is refused if the pull request has moved since. Reads GitHub first and answers `409 not_mergeable` (the reasons in `details`) unless it is open, not a draft, mergeable and its checks are neither failing nor pending. Merges with a merge commit and records the approval and who gave it. Idempotent: an already merged pull request answers `merged: true, alreadyMerged: true`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"approve":{"type":"boolean","const":true},"headSha":{"type":"string","pattern":"^[0-9a-f]{40}$"}},"required":["approve","headSha"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"merged":{"type":"boolean"},"alreadyMerged":{"type":"boolean"},"pr":{"$ref":"#/components/schemas/PullRequest"}},"required":["merged","alreadyMerged","pr"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["approve"],"x-koidog-audited":true}},"/approvals":{"get":{"operationId":"listApprovals","tags":["Approvals"],"summary":"List approvals, pending and decided","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["pending","approved","denied","expired"]}}},{"name":"kind","in":"query","required":false,"description":"One or more values, comma-separated. For events: exact kinds or prefixes such as `run.*`.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["merge","deploy","public_preview","budget","destructive","load_test","question","plan"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Approval"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/approvals/{id}":{"get":{"operationId":"getApproval","tags":["Approvals"],"summary":"Read an approval","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Approval"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/approvals/{id}/decide":{"post":{"operationId":"decideApproval","tags":["Approvals"],"summary":"Approve or deny a pending approval","description":"An approval action. Deciding one that is no longer pending answers `409 conflict`. A `plan` approval (a managed crew launched with `limits.review.planApproval`) takes three answers: `approve: true` starts its tasks; `approve: false, changes: true` with a `note` sends the note to the manager, which plans again (within the crew's `planRevisions`); `approve: false` alone cancels the crew with the note as the reason. `changes` on any other approval answers `400`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"approve":{"type":"boolean"},"note":{"default":"","type":"string"},"changes":{"type":"boolean"}},"required":["approve"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Approval"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["approve"],"x-koidog-audited":true}},"/events":{"get":{"operationId":"listEvents","tags":["Events"],"summary":"Page through the timeline","description":"Oldest first by default. Filter by the ids an event concerns, by `kind` (exact kinds or prefixes such as `run.*`), by `level`, and with `after` for events later than a `seq`.","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"taskId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"agentId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"runId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"nodeId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"vmId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"kind","in":"query","required":false,"description":"One or more values, comma-separated. For events: exact kinds or prefixes such as `run.*`.","style":"form","explode":false,"schema":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"string","maxLength":60}}},{"name":"level","in":"query","required":false,"description":"One or more levels, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["info","warn","error"]}}},{"name":"after","in":"query","required":false,"description":"Only events with a `seq` greater than this.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"automationId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"asc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/events/stream":{"get":{"operationId":"streamEvents","tags":["Events"],"summary":"Follow the timeline live (server-sent events)","description":"Each message has `id: <seq>`, `event: event` and the timeline event as JSON in `data`. Takes the same filters as `GET /events`. Reconnect with the `Last-Event-ID` header (or `after=<seq>`) to replay everything missed, in order, before going live; without either the stream starts at now. A comment line every 15 seconds keeps the connection open. A key may hold 8 streams at once.","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"taskId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"agentId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"runId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"nodeId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"vmId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"kind","in":"query","required":false,"description":"One or more values, comma-separated. For events: exact kinds or prefixes such as `run.*`.","style":"form","explode":false,"schema":{"minItems":1,"maxItems":30,"type":"array","items":{"type":"string","maxLength":60}}},{"name":"level","in":"query","required":false,"description":"One or more levels, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["info","warn","error"]}}},{"name":"after","in":"query","required":false,"description":"Only events with a `seq` greater than this.","schema":{"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"signals","in":"query","required":false,"description":"Experimental, for the dashboard: also send `changed` messages naming a record to refetch.","schema":{"default":false,"type":"boolean"}},{"name":"Last-Event-ID","in":"header","required":false,"description":"The `seq` of the last event received; everything after it is replayed.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"text/event-stream":{"schema":{"type":"string","description":"Server-sent events; each `data` line is an Event as JSON."}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/artifacts":{"get":{"operationId":"listArtifacts","tags":["Artifacts"],"summary":"List what runs produced: branches, pull request links, logs","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"agentId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"runId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"kind","in":"query","required":false,"description":"One or more values, comma-separated. For events: exact kinds or prefixes such as `run.*`.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["branch","pr","patch","log","preview","build","screenshot","summary","bundle"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Artifact"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/artifacts/{id}":{"get":{"operationId":"getArtifact","tags":["Artifacts"],"summary":"Read an artifact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Artifact"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/artifacts/{id}/content":{"get":{"operationId":"getArtifactContent","tags":["Artifacts"],"summary":"The text of a log artifact","description":"Plain text, at most 2 MB; `X-Koidog-Truncated` carries the full size when it was cut. Only log artifacts have content.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"type":"string"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/budget":{"get":{"operationId":"getBudget","tags":["Costs and settings"],"summary":"The cloud compute cap, what is spent and what is reserved","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Budget"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/costs":{"get":{"operationId":"getCosts","tags":["Costs and settings"],"summary":"Cloud compute cost by day, crew and VM","description":"Model use is billed by your provider, on your own plan, and is never given a dollar figure here; `notes` says what is and is not counted.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"budget":{"$ref":"#/components/schemas/Budget"},"byDay":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"computeUsd":{"type":"number"},"vmHours":{"type":"number"},"starts":{"type":"number"}},"required":["day","computeUsd","vmHours","starts"]}},"byCrew":{"type":"array","items":{"type":"object","properties":{"crewId":{"type":"string"},"goal":{"type":"string"},"computeUsd":{"type":"number"},"vmHours":{"type":"number"},"inference":{"type":"string"}},"required":["crewId","goal","computeUsd","vmHours","inference"]}},"byVm":{"type":"array","items":{"type":"object","properties":{"vmId":{"type":"string"},"type":{"type":"string"},"state":{"type":"string","enum":["intended","creating","booting","online","draining","deleting","deleted","failed","lost"]},"hours":{"type":"number"},"usd":{"type":"number"},"source":{"type":"string","enum":["estimate","provider"]}},"required":["vmId","type","state","hours","usd","source"]}},"notes":{"type":"array","items":{"type":"string"}}},"required":["budget","byDay","byCrew","byVm","notes"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/settings":{"get":{"operationId":"getSettings","tags":["Costs and settings"],"summary":"Read install-wide settings","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"cloudBudgetCapUsd":{"type":"number"},"maxVms":{"type":"number"},"defaultVmType":{"type":"string","enum":["small","default","large"]},"agentsPerVm":{"type":"number"},"agentsPerVmMax":{"type":"number"},"defaultTimeoutMinutes":{"type":"number"},"loadTestApprovalThreshold":{"type":"number"},"publicUrl":{"type":["string","null"]},"favoriteModels":{"type":"array","items":{"type":"string"}}},"required":["cloudBudgetCapUsd","maxVms","defaultVmType","agentsPerVm","agentsPerVmMax","defaultTimeoutMinutes","loadTestApprovalThreshold","publicUrl","favoriteModels"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"patch":{"operationId":"updateSettings","tags":["Costs and settings"],"summary":"Change install-wide settings","description":"Raising `cloudBudgetCapUsd`, `maxVms` or `loadTestApprovalThreshold` lets more be spent, so a key needs `approve` as well as `config` for that; lowering them needs only `config`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cloudBudgetCapUsd":{"type":"number","minimum":0,"maximum":10000},"maxVms":{"type":"integer","minimum":0,"maximum":100},"defaultVmType":{"type":"string","enum":["small","default","large"]},"agentsPerVm":{"type":"integer","minimum":1,"maximum":32},"agentsPerVmMax":{"type":"integer","minimum":1,"maximum":32},"defaultTimeoutMinutes":{"type":"integer","minimum":1,"maximum":1440},"loadTestApprovalThreshold":{"type":"integer","minimum":1,"maximum":100},"favoriteModels":{"maxItems":200,"type":"array","items":{"type":"string","maxLength":400,"pattern":"^[^:\\s]+:\\S.*$"}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"cloudBudgetCapUsd":{"type":"number"},"maxVms":{"type":"number"},"defaultVmType":{"type":"string","enum":["small","default","large"]},"agentsPerVm":{"type":"number"},"agentsPerVmMax":{"type":"number"},"defaultTimeoutMinutes":{"type":"number"},"loadTestApprovalThreshold":{"type":"number"},"publicUrl":{"type":["string","null"]},"favoriteModels":{"type":"array","items":{"type":"string"}}},"required":["cloudBudgetCapUsd","maxVms","defaultVmType","agentsPerVm","agentsPerVmMax","defaultTimeoutMinutes","loadTestApprovalThreshold","publicUrl","favoriteModels"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/previews":{"get":{"operationId":"listPreviews","tags":["Previews"],"summary":"List live previews","description":"A private preview's `url` carries the host's access token and is given to the dashboard session only: for an API key it is `null`, and `origin` is the address without the token. A public preview has no token, so its `url` is given to both.","parameters":[{"name":"crewId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"taskId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["pending_approval","starting","up","stopping","stopped","failed"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Preview"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"post":{"operationId":"createPreview","tags":["Previews"],"summary":"Start a live preview of a branch Koidog produced","description":"A task's branch (`taskId`), or a managed crew's integration branch (`crewId` alone). Starts or reuses a cloud VM under the crew's budget and limits, so it can cost money. Asking again for the same commit answers the same preview. `access: \"public\"` does not start anything: it creates an approval (`public_preview`) that the founder, or a key with `approve`, decides. Refused with `409` and the reason when it cannot run (no preview command on the project, cloud not connected, a Mac-only crew, the budget).","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"crewId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"access":{"default":"private","type":"string","enum":["private","public"]},"ttlMinutes":{"default":30,"type":"integer","minimum":5,"maximum":240}},"required":["crewId"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Preview"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"],"x-koidog-audited":true}},"/previews/availability":{"get":{"operationId":"getPreviewAvailability","tags":["Previews"],"summary":"Where a preview can run today, and why not where it cannot","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"boat":{"type":"object","properties":{"available":{"type":"boolean"},"reason":{"type":"string"}},"required":["available","reason"]},"mac":{"type":"object","properties":{"available":{"type":"boolean","const":false},"status":{"type":"string","const":"planned"},"reason":{"type":"string"}},"required":["available","status","reason"]}},"required":["boat","mac"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"experimental","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/previews/{id}":{"get":{"operationId":"getPreview","tags":["Previews"],"summary":"Read a preview","description":"`state` is `up` only after a real readiness check through its URL. `cleanup` says whether the process and the URL were seen gone.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Preview"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/previews/{id}/stop":{"post":{"operationId":"stopPreview","tags":["Previews"],"summary":"Stop a preview","description":"Answers the preview `stopping`; it is `stopped` once the machine confirms.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Preview"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"]}},"/api-keys":{"get":{"operationId":"listApiKeys","tags":["API keys"],"summary":"List API keys","description":"Session only. Never includes a token.","parameters":[{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"session","x-koidog-scopes":[]},"post":{"operationId":"createApiKey","tags":["API keys"],"summary":"Create an API key","description":"Session only: a key cannot create keys. `scopes` must be listed; a key has `approve` only when it is in that list. The answer carries the token once; Koidog keeps only its hash.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"scopes":{"minItems":1,"type":"array","items":{"type":"string","enum":["read","crews","config","approve"]}},"rateLimitPerMinute":{"default":600,"type":"integer","minimum":1,"maximum":6000},"expiresAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}},"required":["name","scopes"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"$ref":"#/components/schemas/ApiKey"},"token":{"type":"string"}},"required":["key","token"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"session","x-koidog-scopes":[]}},"/api-keys/{id}":{"get":{"operationId":"getApiKey","tags":["API keys"],"summary":"Read an API key","description":"Session only.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"session","x-koidog-scopes":[]}},"/api-keys/{id}/revoke":{"post":{"operationId":"revokeApiKey","tags":["API keys"],"summary":"Revoke an API key","description":"Session only. Takes effect at once and cannot be undone.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKey"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"session","x-koidog-scopes":[]}},"/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List webhook endpoints","description":"A key without `config` gets each `url` cut to its origin and path (`urlShortened` says when that removed something): a query can carry the receiver's own token.","parameters":[{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Register a webhook endpoint","description":"Koidog POSTs matching timeline events to `url` (https, not a private address). `events` lists kinds, prefixes such as `run.*`, or `*`. The answer carries the signing secret once. Each delivery has `Koidog-Timestamp` and `Koidog-Signature: v1=<hex HMAC-SHA256 of \"<timestamp>.<raw body>\">`. A failed delivery is retried for about 21 hours. Koidog switches an endpoint off after 50 failed attempts in a row, or after 24 hours in which every attempt failed, with a `webhook.disabled` event; `PATCH /webhooks/{id}` with `enabled: true` switches it on again.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"default":"","type":"string","maxLength":200},"events":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","maxLength":60}},"projectId":{"default":null,"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"enabled":{"default":true,"type":"boolean"}},"required":["url","events"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"},"secret":{"type":"string"}},"required":["webhook","secret"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/webhooks/{id}":{"get":{"operationId":"getWebhook","tags":["Webhooks"],"summary":"Read a webhook endpoint","description":"The full `url` needs `config` (or the session); otherwise it is cut to its origin and path and `urlShortened` is true when that removed something.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"patch":{"operationId":"updateWebhook","tags":["Webhooks"],"summary":"Change a webhook endpoint, or switch it on or off","description":"Switching a disabled endpoint on starts it from now; events from the time it was off are not sent.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"description":{"type":"string","maxLength":200},"events":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","maxLength":60}},"projectId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true},"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Delete a webhook endpoint and its pending deliveries","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Done; no content"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/webhooks/{id}/rotate-secret":{"post":{"operationId":"rotateWebhookSecret","tags":["Webhooks"],"summary":"Replace the signing secret","description":"The answer carries the new secret once. The old one stops signing at once.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"},"secret":{"type":"string"}},"required":["webhook","secret"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/webhooks/{id}/test":{"post":{"operationId":"testWebhook","tags":["Webhooks"],"summary":"Send a signed `webhook.test` delivery now","description":"Waits for the endpoint (up to 10 seconds) and answers the delivery with its outcome. It is not retried and does not count toward disabling.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/webhooks/{id}/deliveries":{"get":{"operationId":"listWebhookDeliveries","tags":["Webhooks"],"summary":"The delivery log of an endpoint","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["pending","succeeded","failed"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/WebhookDelivery"}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/webhooks/{id}/deliveries/{deliveryId}":{"get":{"operationId":"getWebhookDelivery","tags":["Webhooks"],"summary":"Read one delivery with every attempt","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/webhooks/{id}/deliveries/{deliveryId}/redeliver":{"post":{"operationId":"redeliverWebhookDelivery","tags":["Webhooks"],"summary":"Queue a delivery again","description":"Sends the same body under the same delivery id.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"202":{"description":"Accepted; the work continues and is reported on the timeline","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"]}},"/automations":{"get":{"operationId":"listAutomations","tags":["Automations"],"summary":"List automations","description":"Saved launches that start on a schedule or when an outside program calls their trigger address.","parameters":[{"name":"projectId","in":"query","required":false,"schema":{"type":"string","minLength":5}},{"name":"kind","in":"query","required":false,"description":"One or more values, comma-separated. For events: exact kinds or prefixes such as `run.*`.","schema":{"type":"string","enum":["schedule","trigger"]}},{"name":"state","in":"query","required":false,"description":"One or more states, comma-separated.","style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["active","paused","disabled"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"description":{"type":"string"},"projectId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["schedule","trigger"]},"state":{"type":"string","enum":["active","paused","disabled"]},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]}},"required":["title","instructions","role","requires"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","tasks","repeatGoal","profiles","models","placement","limits"]},"schedule":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron","timeZone"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},{"type":"null"}]},"trigger":{"anyOf":[{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","url","secretPrefix","secretSetAt"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event","actions"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","events","labels","branches","url","secretPrefix","secretSetAt"]}]},{"type":"null"}]},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}},"required":["maxRunsPerDay","overlap","disableAfterFailures","missedWindowMinutes","maxInputChars"]},"nextRunAt":{"type":["string","null"]},"nextRuns":{"maxItems":5,"type":"array","items":{"type":"string"}},"runsLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeCrewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"createdBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","projectId","kind","state","disabledReason","disabledAt","launch","schedule","trigger","inputs","guards","nextRunAt","runsLast24h","consecutiveFailures","activeCrewId","lastRun","createdBy","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"post":{"operationId":"createAutomation","tags":["Automations"],"summary":"Save an automation","description":"A saved launch (`launch`, exactly what `POST /crews` takes, with its budget and time limit) plus what starts it: a `schedule` (cron in an IANA time zone, or an interval) or a `trigger` (an address outside programs POST to). Every start goes through the same checks as `POST /crews`: forecast, blockers, budget cap, load-test approval, archived projects. An automation never approves anything. For a trigger the answer carries its secret once (`kdt_...`).","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"default":"","type":"string","maxLength":500},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}}}},"required":["title","instructions"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}}},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}}}},"required":["budgetUsd","maxVms","timeoutMinutes"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","profiles","limits"]},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},"trigger":{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"}},"required":["sender"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}}},"required":["sender","events"]}]},"inputs":{"default":{},"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_.]{0,39}$"},"additionalProperties":{"type":"string","maxLength":200,"pattern":"^[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+|\\[\\d{1,4}\\])*$"}},"guards":{"default":{"maxRunsPerDay":4,"overlap":"skip","disableAfterFailures":3,"missedWindowMinutes":60,"maxInputChars":2000},"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}}},"enabled":{"default":true,"type":"boolean"}},"required":["name","launch"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"automation":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"description":{"type":"string"},"projectId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["schedule","trigger"]},"state":{"type":"string","enum":["active","paused","disabled"]},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]}},"required":["title","instructions","role","requires"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","tasks","repeatGoal","profiles","models","placement","limits"]},"schedule":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron","timeZone"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},{"type":"null"}]},"trigger":{"anyOf":[{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","url","secretPrefix","secretSetAt"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event","actions"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","events","labels","branches","url","secretPrefix","secretSetAt"]}]},{"type":"null"}]},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}},"required":["maxRunsPerDay","overlap","disableAfterFailures","missedWindowMinutes","maxInputChars"]},"nextRunAt":{"type":["string","null"]},"nextRuns":{"maxItems":5,"type":"array","items":{"type":"string"}},"runsLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeCrewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"createdBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","projectId","kind","state","disabledReason","disabledAt","launch","schedule","trigger","inputs","guards","nextRunAt","runsLast24h","consecutiveFailures","activeCrewId","lastRun","createdBy","createdAt","updatedAt"]},"secret":{"type":["string","null"]}},"required":["automation","secret"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/automations/{id}":{"get":{"operationId":"getAutomation","tags":["Automations"],"summary":"Read an automation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"description":{"type":"string"},"projectId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["schedule","trigger"]},"state":{"type":"string","enum":["active","paused","disabled"]},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]}},"required":["title","instructions","role","requires"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","tasks","repeatGoal","profiles","models","placement","limits"]},"schedule":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron","timeZone"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},{"type":"null"}]},"trigger":{"anyOf":[{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","url","secretPrefix","secretSetAt"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event","actions"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","events","labels","branches","url","secretPrefix","secretSetAt"]}]},{"type":"null"}]},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}},"required":["maxRunsPerDay","overlap","disableAfterFailures","missedWindowMinutes","maxInputChars"]},"nextRunAt":{"type":["string","null"]},"nextRuns":{"maxItems":5,"type":"array","items":{"type":"string"}},"runsLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeCrewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"createdBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","projectId","kind","state","disabledReason","disabledAt","launch","schedule","trigger","inputs","guards","nextRunAt","runsLast24h","consecutiveFailures","activeCrewId","lastRun","createdBy","createdAt","updatedAt"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]},"patch":{"operationId":"updateAutomation","tags":["Automations"],"summary":"Change an automation","description":"A new schedule takes effect from now. A schedule cannot become a trigger or the other way round.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":500},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}}}},"required":["title","instructions"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}}},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}}}},"required":["budgetUsd","maxVms","timeoutMinutes"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","profiles","limits"]},"schedule":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},"trigger":{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"}},"required":["sender"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}}},"required":["sender","events"]}]},"inputs":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9_.]{0,39}$"},"additionalProperties":{"type":"string","maxLength":200,"pattern":"^[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+|\\[\\d{1,4}\\])*$"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"type":"integer","minimum":1,"maximum":48},"overlap":{"type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"type":"integer","minimum":1,"maximum":8000}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"description":{"type":"string"},"projectId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["schedule","trigger"]},"state":{"type":"string","enum":["active","paused","disabled"]},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]}},"required":["title","instructions","role","requires"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","tasks","repeatGoal","profiles","models","placement","limits"]},"schedule":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron","timeZone"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},{"type":"null"}]},"trigger":{"anyOf":[{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","url","secretPrefix","secretSetAt"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event","actions"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","events","labels","branches","url","secretPrefix","secretSetAt"]}]},{"type":"null"}]},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}},"required":["maxRunsPerDay","overlap","disableAfterFailures","missedWindowMinutes","maxInputChars"]},"nextRunAt":{"type":["string","null"]},"nextRuns":{"maxItems":5,"type":"array","items":{"type":"string"}},"runsLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeCrewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"createdBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","projectId","kind","state","disabledReason","disabledAt","launch","schedule","trigger","inputs","guards","nextRunAt","runsLast24h","consecutiveFailures","activeCrewId","lastRun","createdBy","createdAt","updatedAt"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true},"delete":{"operationId":"deleteAutomation","tags":["Automations"],"summary":"Delete an automation and its run history","description":"Crews it launched keep running and keep saying who launched them.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Done; no content"},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/automations/{id}/pause":{"post":{"operationId":"pauseAutomation","tags":["Automations"],"summary":"Pause an automation","description":"Nothing starts until it is resumed; its trigger address answers `409 automation_paused`.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"description":{"type":"string"},"projectId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["schedule","trigger"]},"state":{"type":"string","enum":["active","paused","disabled"]},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]}},"required":["title","instructions","role","requires"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","tasks","repeatGoal","profiles","models","placement","limits"]},"schedule":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron","timeZone"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},{"type":"null"}]},"trigger":{"anyOf":[{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","url","secretPrefix","secretSetAt"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event","actions"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","events","labels","branches","url","secretPrefix","secretSetAt"]}]},{"type":"null"}]},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}},"required":["maxRunsPerDay","overlap","disableAfterFailures","missedWindowMinutes","maxInputChars"]},"nextRunAt":{"type":["string","null"]},"nextRuns":{"maxItems":5,"type":"array","items":{"type":"string"}},"runsLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeCrewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"createdBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","projectId","kind","state","disabledReason","disabledAt","launch","schedule","trigger","inputs","guards","nextRunAt","runsLast24h","consecutiveFailures","activeCrewId","lastRun","createdBy","createdAt","updatedAt"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/automations/{id}/resume":{"post":{"operationId":"resumeAutomation","tags":["Automations"],"summary":"Resume a paused or switched-off automation","description":"Clears the refusals in a row. A schedule continues from now: run times that passed while it was off are not run.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"description":{"type":"string"},"projectId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["schedule","trigger"]},"state":{"type":"string","enum":["active","paused","disabled"]},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]}},"required":["title","instructions","role","requires"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","tasks","repeatGoal","profiles","models","placement","limits"]},"schedule":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron","timeZone"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},{"type":"null"}]},"trigger":{"anyOf":[{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","url","secretPrefix","secretSetAt"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event","actions"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","events","labels","branches","url","secretPrefix","secretSetAt"]}]},{"type":"null"}]},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}},"required":["maxRunsPerDay","overlap","disableAfterFailures","missedWindowMinutes","maxInputChars"]},"nextRunAt":{"type":["string","null"]},"nextRuns":{"maxItems":5,"type":"array","items":{"type":"string"}},"runsLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeCrewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"createdBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","projectId","kind","state","disabledReason","disabledAt","launch","schedule","trigger","inputs","guards","nextRunAt","runsLast24h","consecutiveFailures","activeCrewId","lastRun","createdBy","createdAt","updatedAt"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/automations/{id}/run":{"post":{"operationId":"runAutomation","tags":["Automations"],"summary":"Start an automation now","description":"Launches its saved crew now, through the same checks and guards as a scheduled start (runs per day, overlap), and answers the run with its outcome. Placeholders are empty: there is no incoming body.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["crews"],"x-koidog-audited":true}},"/automations/{id}/rotate-secret":{"post":{"operationId":"rotateAutomationSecret","tags":["Automations"],"summary":"Replace a trigger's secret","description":"The answer carries the new secret once; the old one stops working at once. Update the sender (for GitHub: the webhook's secret).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"automation":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"description":{"type":"string"},"projectId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["schedule","trigger"]},"state":{"type":"string","enum":["active","paused","disabled"]},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"launch":{"type":"object","properties":{"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"tasks":{"default":[],"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1},"instructions":{"type":"string","minLength":1},"role":{"default":"builder","type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]}},"required":["title","instructions","role","requires"]}},"repeatGoal":{"default":false,"type":"boolean"},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"default":{"policy":"lowest_cost","deniedNodeIds":[],"allowCloud":true,"allowLocal":true},"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"}},"required":["projectId","goal","mode","requestedSize","tasks","repeatGoal","profiles","models","placement","limits"]},"schedule":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"cron"},"cron":{"type":"string","minLength":9,"maxLength":120},"timeZone":{"default":"UTC","type":"string","minLength":1,"maxLength":64}},"required":["kind","cron","timeZone"]},{"type":"object","properties":{"kind":{"type":"string","const":"interval"},"everyMinutes":{"type":"integer","minimum":5,"maximum":10080}},"required":["kind","everyMinutes"]}]},{"type":"null"}]},"trigger":{"anyOf":[{"oneOf":[{"type":"object","properties":{"sender":{"type":"string","const":"koidog"},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","url","secretPrefix","secretSetAt"]},{"type":"object","properties":{"sender":{"type":"string","const":"github"},"events":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"object","properties":{"event":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"},"actions":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100,"pattern":"^[\\w.-]+$"}}},"required":["event","actions"]}},"labels":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":100}},"branches":{"default":[],"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"url":{"type":"string"},"secretPrefix":{"type":"string"},"secretSetAt":{"type":"string"}},"required":["sender","events","labels","branches","url","secretPrefix","secretSetAt"]}]},{"type":"null"}]},"inputs":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"guards":{"type":"object","properties":{"maxRunsPerDay":{"default":4,"type":"integer","minimum":1,"maximum":48},"overlap":{"default":"skip","type":"string","enum":["skip","queue_one"]},"disableAfterFailures":{"default":3,"type":"integer","minimum":1,"maximum":20},"missedWindowMinutes":{"default":60,"type":"integer","minimum":0,"maximum":1440},"maxInputChars":{"default":2000,"type":"integer","minimum":1,"maximum":8000}},"required":["maxRunsPerDay","overlap","disableAfterFailures","missedWindowMinutes","maxInputChars"]},"nextRunAt":{"type":["string","null"]},"nextRuns":{"maxItems":5,"type":"array","items":{"type":"string"}},"runsLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"activeCrewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"lastRun":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"createdBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","projectId","kind","state","disabledReason","disabledAt","launch","schedule","trigger","inputs","guards","nextRunAt","runsLast24h","consecutiveFailures","activeCrewId","lastRun","createdBy","createdAt","updatedAt"]},"secret":{"type":["string","null"]}},"required":["automation","secret"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["config"],"x-koidog-audited":true}},"/automations/{id}/runs":{"get":{"operationId":"listAutomationRuns","tags":["Automations"],"summary":"An automation's runs: when, why, outcome and crew","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"outcome","in":"query","required":false,"style":"form","explode":false,"schema":{"minItems":1,"type":"array","items":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]}}},{"name":"limit","in":"query","required":false,"description":"How many items to return, 1 to 200. Default 50.","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `nextCursor` of the previous page. Only valid with the same filters and order.","schema":{"type":"string","minLength":1}},{"name":"order","in":"query","required":false,"description":"`desc` is newest first; `asc` is oldest first. Collections sort by creation time, then id.","schema":{"default":"desc","type":"string","enum":["asc","desc"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["read"]}},"/invites":{"get":{"operationId":"listInviteRequests","tags":["Invitations"],"summary":"Invite requests from koi.dog, with what Clerk says of each","description":"Every address that asked on koi.dog/invite/ (the koidog-site list) or was sent a Clerk invitation, newest first, each with its `state`: `requested`, `invited` (Clerk's invitation is pending), `accepted`, `revoked` or `expired`. Reads both sources on each call. An approval action, because inviting lets a person in. `409 not_configured` names each server variable that is missing; `502` (`clerk_error`, `invite_list_error`) passes on what Clerk or the list answered. Answers in one page.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"state":{"type":"string","enum":["requested","invited","accepted","revoked","expired"]},"requestedAt":{"type":["string","null"]},"requestState":{"type":["string","null"]},"invitation":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"expiresAt":{"type":["string","null"]}},"required":["id","status","createdAt","updatedAt","expiresAt"]},{"type":"null"}]}},"required":["email","state","requestedAt","requestState","invitation"]}},"nextCursor":{"type":["string","null"]},"hasMore":{"type":"boolean"}},"required":["data","nextCursor","hasMore"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["approve"]},"post":{"operationId":"sendInvite","tags":["Invitations"],"summary":"Invite an address to sign up","description":"Creates a Clerk invitation (Clerk emails the person a sign-up link to `KOIDOG_INVITE_REDIRECT_URL`) and marks the request invited on the koidog-site list. An address that already has a pending or accepted invitation answers that one with `sent: false` and nothing is sent. A list that could not be marked answers `marked: false` and the reason; the invitation stands. Records `invite.sent` with who sent it. `422` for an address the koi.dog form would not take; `409 not_configured` and `502` as for the list.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","minLength":1,"maxLength":254}},"required":["email"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"invite":{"type":"object","properties":{"email":{"type":"string"},"state":{"type":"string","enum":["requested","invited","accepted","revoked","expired"]},"requestedAt":{"type":["string","null"]},"requestState":{"type":["string","null"]},"invitation":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"expiresAt":{"type":["string","null"]}},"required":["id","status","createdAt","updatedAt","expiresAt"]},{"type":"null"}]}},"required":["email","state","requestedAt","requestState","invitation"]},"sent":{"type":"boolean"},"marked":{"type":"boolean"},"markError":{"type":["string","null"]}},"required":["invite","sent","marked","markError"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["approve"],"x-koidog-audited":true}},"/invites/{id}/revoke":{"post":{"operationId":"revokeInvite","tags":["Invitations"],"summary":"Revoke a pending invitation","description":"`id` is Clerk's invitation id (`inv_...`). The sign-up link stops working. Clerk refuses an invitation that was accepted or already revoked, and that refusal is passed on as `502 clerk_error` with Clerk's reason. Records `invite.revoked` with who revoked it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"invite":{"type":"object","properties":{"email":{"type":"string"},"state":{"type":"string","enum":["requested","invited","accepted","revoked","expired"]},"requestedAt":{"type":["string","null"]},"requestState":{"type":["string","null"]},"invitation":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","accepted","revoked","expired"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"expiresAt":{"type":["string","null"]}},"required":["id","status","createdAt","updatedAt","expiresAt"]},{"type":"null"}]}},"required":["email","state","requestedAt","requestState","invitation"]},"marked":{"type":"boolean"},"markError":{"type":["string","null"]}},"required":["invite","marked","markError"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[{"apiKey":[]},{"session":[]}],"x-koidog-stability":"stable","x-koidog-access":"scopes","x-koidog-scopes":["approve"],"x-koidog-audited":true}},"/automations/{id}/trigger":{"post":{"operationId":"triggerAutomation","tags":["Automations"],"summary":"The trigger address an outside program calls","description":"Needs no session or API key: it is authenticated only by the automation's own secret. A `koidog` trigger takes `Authorization: Bearer kdt_...`, or `Koidog-Timestamp` and `Koidog-Signature: v1=<hex HMAC-SHA256 of \"<timestamp>.<raw body>\">` (five minutes either way). A `github` trigger takes GitHub's `X-Hub-Signature-256`, `X-GitHub-Event` and `X-GitHub-Delivery`. A delivery id already seen is refused (`409 replayed`). Bodies over 256 KB are refused (`413`), and each automation takes at most 30 calls a minute. Answers at once with the run it recorded (`202`); the crew is launched after. An event its filter does not take (and GitHub's `ping`) answers `202` with `ignored` and records nothing. Text from the body reaches the agents only through declared placeholders, cut to length and marked as outside text.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"202":{"description":"Accepted; the work continues and is reported on the timeline","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"automationId":{"type":"string","minLength":5},"cause":{"type":"string","enum":["schedule","trigger","manual"]},"why":{"type":"string"},"scheduledFor":{"type":["string","null"]},"deliveryId":{"type":["string","null"]},"outcome":{"type":"string","enum":["pending","queued","launched","refused","skipped","missed","failed"]},"reason":{"type":["string","null"]},"crewId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"inputs":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},{"type":"null"}]},"createdAt":{"type":"string"},"finishedAt":{"type":["string","null"]}},"required":["id","automationId","cause","why","scheduledFor","deliveryId","outcome","reason","crewId","inputs","createdAt","finishedAt"]},{"type":"null"}]},"ignored":{"type":["string","null"]}},"required":["run","ignored"]}}}},"default":{"$ref":"#/components/responses/Error"}},"security":[],"x-koidog-stability":"stable","x-koidog-access":"public","x-koidog-scopes":[]}}},"webhooks":{"event":{"post":{"summary":"A delivery to a registered webhook endpoint","description":"Sent for every timeline event that matches the endpoint's filters, and for `webhook.test`. Verify `Koidog-Signature` (`v1=` and the hex HMAC-SHA256 of `<Koidog-Timestamp>.<raw body>` under the endpoint's secret) and refuse old timestamps. Answer any 2xx within 10 seconds; anything else is retried. `Koidog-Delivery-Id` is the same across retries.","parameters":[{"name":"Koidog-Signature","in":"header","required":true,"schema":{"type":"string"}},{"name":"Koidog-Timestamp","in":"header","required":true,"schema":{"type":"string"}},{"name":"Koidog-Delivery-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Koidog-Webhook-Id","in":"header","required":true,"schema":{"type":"string"}},{"name":"Koidog-Attempt","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookPayload"}}}},"responses":{"2XX":{"description":"Received."}}}}},"components":{"schemas":{"Project":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string","minLength":1},"repo":{"type":["string","null"]},"defaultBranch":{"default":"main","type":"string"},"instructions":{"default":"","type":"string"},"validation":{"default":{},"type":"object","properties":{"install":{"type":"string"},"build":{"type":"string"},"test":{"type":"string"},"lint":{"type":"string"},"preview":{"type":"object","properties":{"command":{"type":"string","minLength":1},"port":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ready":{"type":"object","properties":{"path":{"type":"string","format":"starts_with","pattern":"^\\/.*"},"timeoutSeconds":{"type":"integer","minimum":5,"maximum":1800}}}},"required":["command"]},"commands":{"type":"object","propertyNames":{"type":"string","pattern":"^[a-z][a-z0-9-]{0,30}$"},"additionalProperties":{"type":"string","minLength":1,"maxLength":2000}}}},"createdAt":{"type":"string"},"archivedAt":{"default":null,"type":["string","null"]}},"required":["id","name","repo","defaultBranch","instructions","validation","createdAt","archivedAt"]},"Connection":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"provider":{"type":"string","enum":["anthropic","morph","openai","custom"]},"model":{"type":"string"},"auth":{"type":"string","enum":["local_login","oauth_token","api_key","boat_profile"]},"baseUrl":{"type":"string"},"scope":{"type":"string","enum":["local","cloud","both"]},"metering":{"type":"string","enum":["subscription","metered"]},"maxConcurrent":{"default":4,"type":"integer","minimum":1,"maximum":9007199254740991},"status":{"type":"string","enum":["untested","ready","failing","throttled"]},"defaultOptions":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"statusDetail":{"default":"","type":"string"},"testedAt":{"type":"string"},"throttledUntil":{"type":"string"},"refusedAt":{"type":"string"},"hasSecret":{"default":false,"type":"boolean"}},"required":["id","name","harness","provider","model","auth","scope","metering","maxConcurrent","status","defaultOptions","statusDetail","hasSecret"]},"Crew":{"type":"object","properties":{"id":{"type":"string","minLength":5},"projectId":{"type":"string","minLength":5},"goal":{"type":"string","minLength":1},"mode":{"type":"string","enum":["direct","managed"]},"requestedSize":{"anyOf":[{"type":"integer","minimum":1,"maximum":100},{"type":"string","const":"auto"}]},"maxAgents":{"type":"integer","minimum":1,"maximum":100},"state":{"type":"string","enum":["planning","running","paused","completed","failed","canceled"]},"profiles":{"type":"object","properties":{"manager":{"type":"string","minLength":5},"builder":{"type":"string","minLength":5},"reviewer":{"type":"string","minLength":5}},"required":["builder"]},"models":{"default":{},"type":"object","properties":{"manager":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"builder":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]},"reviewer":{"type":"object","properties":{"model":{"type":"string","minLength":1},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}}},"required":["model","options"]}}},"placement":{"type":"object","properties":{"policy":{"default":"lowest_cost","type":"string","enum":["lowest_cost","fastest","pinned"]},"pinnedNodeId":{"type":"string","minLength":5},"deniedNodeIds":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"allowCloud":{"default":true,"type":"boolean"},"allowLocal":{"default":true,"type":"boolean"}},"required":["policy","deniedNodeIds","allowCloud","allowLocal"]},"limits":{"type":"object","properties":{"budgetUsd":{"type":"number","minimum":0},"maxVms":{"type":"integer","minimum":0,"maximum":100},"timeoutMinutes":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"maxRetries":{"default":1,"type":"integer","minimum":0,"maximum":5},"review":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]}},"required":["budgetUsd","maxVms","timeoutMinutes","maxRetries"]},"preset":{"type":"string"},"integrationBranch":{"type":"string"},"finalPrUrl":{"type":"string"},"pr":{"$ref":"#/components/schemas/PullRequest"},"stateReason":{"default":"","type":"string"},"launchedBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"automationId":{"type":"string","minLength":5},"createdAt":{"type":"string"},"endedAt":{"type":"string"},"reopenedAt":{"type":"string"}},"required":["id","projectId","goal","mode","requestedSize","maxAgents","state","profiles","models","placement","limits","stateReason","createdAt"]},"Task":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"key":{"type":"string"},"parentId":{"type":"string","minLength":5},"title":{"type":"string","minLength":1},"instructions":{"type":"string"},"acceptance":{"default":"","type":"string"},"role":{"type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"requires":{"default":{"tools":[]},"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"xcode":{"type":"boolean"},"tools":{"default":[],"type":"array","items":{"type":"string"}}},"required":["tools"]},"dependsOn":{"default":[],"type":"array","items":{"type":"string","minLength":5}},"owns":{"default":[],"type":"array","items":{"type":"string"}},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]},"blockedReason":{"type":"string"},"agentId":{"type":"string","minLength":5},"branch":{"type":"string"},"prUrl":{"type":"string"},"pr":{"$ref":"#/components/schemas/PullRequest"},"integration":{"default":"none","type":"string","enum":["none","queued","merged","conflict","failed_checks"]},"system":{"type":"boolean"},"stepKind":{"type":"string","enum":["plan","check","resolve","review","replan","reviewer","steer"]},"dropped":{"type":"object","properties":{"by":{"type":"string","enum":["replan","steer"]},"stepId":{"type":"string","minLength":5},"reason":{"type":"string"}},"required":["by","stepId","reason"]},"checks":{"type":"object","properties":{"passed":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["passed","failed"]},"mergeChecks":{"type":"object","properties":{"passed":{"type":"integer","minimum":0,"maximum":9007199254740991},"failed":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["passed","failed"]},"createdAt":{"type":"string"}},"required":["id","crewId","key","title","instructions","acceptance","role","requires","dependsOn","owns","state","integration","createdAt"]},"Agent":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"role":{"type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"state":{"type":"string","enum":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"stateReason":{"default":"","type":"string"},"placementReason":{"default":"","type":"string"},"nodeId":{"type":"string","minLength":5},"vmId":{"type":"string","minLength":5},"branch":{"type":"string"},"runId":{"type":"string","minLength":5},"attempts":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"move":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]},"guidance":{"type":"object","properties":{"text":{"type":"string"},"by":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"at":{"type":"string"}},"required":["text","by","at"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","crewId","taskId","role","connectionId","harness","model","options","state","stateReason","placementReason","attempts","createdAt","updatedAt"]},"Run":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"nodeId":{"type":"string","minLength":5},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sessionId":{"type":"string"},"outcome":{"type":"string","enum":["success","failed","canceled","interrupted","lost"]},"error":{"type":"string"},"summary":{"type":"string"},"evidence":{"type":"object","properties":{"commits":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"filesChanged":{"default":[],"type":"array","items":{"type":"string"}},"additions":{"type":"integer","minimum":0,"maximum":9007199254740991},"deletions":{"type":"integer","minimum":0,"maximum":9007199254740991},"checks":{"default":[],"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"command":{"type":"string"},"exitCode":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"durationMs":{"type":"number"},"logArtifactId":{"type":"string","minLength":5}},"required":["name","command","exitCode","durationMs"]}},"branchPushed":{"default":false,"type":"boolean"},"prUrl":{"type":"string"},"prMerged":{"default":false,"type":"boolean"},"previewUrl":{"type":"string"},"producedBy":{"type":"array","items":{"type":"object","properties":{"runId":{"type":"string","minLength":5},"attempt":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"nodeId":{"type":"string","minLength":5},"nodeName":{"type":"string"},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"ended":{"type":"string","enum":["handed_off","finished"]},"headSha":{"type":["string","null"]}},"required":["runId","attempt","nodeId","nodeName","machine","harness","model","ended","headSha"]}}},"required":["commits","filesChanged","checks","branchPushed","prMerged"]},"usage":{"type":"object","properties":{"inputTokens":{"default":0,"type":"number"},"outputTokens":{"default":0,"type":"number"},"cacheTokens":{"default":0,"type":"number"},"costUsdEstimate":{"default":null,"type":["number","null"]},"turns":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["inputTokens","outputTokens","cacheTokens","costUsdEstimate","turns"]},"startedAt":{"type":"string"},"endedAt":{"type":"string"},"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"nodeName":{"type":"string"},"handedOffBy":{"type":"string","minLength":5},"startedByMove":{"type":"string","minLength":5},"interruptRequestedAt":{"type":"string"},"loss":{"type":"string","enum":["node_restart","machine_lost","rate_limit"]},"lossCounted":{"type":"boolean"},"failure":{"type":"string","enum":["credential_refused"]},"recovers":{"type":"string","minLength":5},"recovery":{"type":"object","properties":{"sha":{"type":["string","null"]},"via":{"type":"string","enum":["final","checkpoint","snapshot","branch","none"]},"commits":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"note":{"type":"string"}},"required":["sha","via"]},"guidance":{"type":"object","properties":{"text":{"type":"string"},"by":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"at":{"type":"string"}},"required":["text","by","at"]}},"required":["id","agentId","taskId","nodeId","attempt","startedAt"]},"Node":{"type":"object","properties":{"id":{"type":"string","minLength":5},"kind":{"type":"string","enum":["mac","linux","boat"]},"name":{"type":"string"},"state":{"type":"string","enum":["pending","online","offline","disabled","revoked"]},"capabilities":{"type":"object","properties":{"os":{"type":"string","enum":["macos","linux"]},"osVersion":{"type":"string"},"arch":{"type":"string"},"cpuCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"memBytes":{"type":"number"},"xcode":{"type":["string","null"]},"simulators":{"default":[],"type":"array","items":{"type":"string"}},"tools":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"harnesses":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"harnessModels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"family":{"default":"","type":"string"},"contextWindow":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"efforts":{"default":[],"type":"array","items":{"type":"string","enum":["low","medium","high","xhigh","max"]}},"defaultEffort":{"type":"string","enum":["low","medium","high","xhigh","max"]},"source":{"type":"string","enum":["provider","harness","manual"]}},"required":["id","name","family","efforts","source"]}}},"features":{"type":"array","items":{"type":"string"}}},"required":["os","osVersion","arch","cpuCount","memBytes","xcode","simulators","tools","harnesses"]},"load":{"type":"object","properties":{"memFreeBytes":{"type":"number"},"load1":{"type":"number"},"cpuBusyPct":{"type":"number"},"agents":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["memFreeBytes","load1","cpuBusyPct","agents"]},"maxAgents":{"type":"integer","minimum":0,"maximum":9007199254740991},"acceptsTasks":{"type":"boolean"},"workspaceRoot":{"type":"string"},"version":{"type":"string"},"vmId":{"type":"string","minLength":5},"pairedAt":{"type":"string"},"connectedAt":{"type":"string"},"lastSeenAt":{"type":"string"}},"required":["id","kind","name","state","maxAgents","acceptsTasks","workspaceRoot","pairedAt"]},"Vm":{"type":"object","properties":{"id":{"type":"string","minLength":5},"provider":{"type":"string","const":"boat"},"providerId":{"type":["string","null"]},"state":{"type":"string","enum":["intended","creating","booting","online","draining","deleting","deleted","failed","lost"]},"type":{"type":"string","enum":["small","default","large"]},"baseTemplate":{"type":"string"},"projectId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"hourlyUsd":{"type":"number"},"accruedUsd":{"default":0,"type":"number"},"costSource":{"default":"estimate","type":"string","enum":["estimate","provider"]},"stateReason":{"default":"","type":"string"},"createdAt":{"type":"string"},"onlineAt":{"type":"string"},"deletedAt":{"type":"string"}},"required":["id","provider","providerId","state","type","baseTemplate","hourlyUsd","accruedUsd","costSource","stateReason","createdAt"]},"Approval":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["merge","deploy","public_preview","budget","destructive","load_test","question","plan"]},"title":{"type":"string"},"detail":{"type":"string"},"state":{"type":"string","enum":["pending","approved","denied","expired"]},"decision":{"type":"string"},"createdAt":{"type":"string"},"decidedAt":{"type":"string"},"decidedBy":{"default":null,"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},{"type":"null"}]},"plan":{"type":"object","properties":{"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"note":{"type":"string"},"tasks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"role":{"type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"deps":{"type":"array","items":{"type":"string"}},"owns":{"type":"array","items":{"type":"string"}},"instructions":{"type":"string"},"acceptance":{"type":"string"}},"required":["key","title","role","deps","owns","instructions","acceptance"]}},"width":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"commit":{"type":"string"},"runId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"outcome":{"anyOf":[{"type":"string","enum":["approved","changes_requested","rejected"]},{"type":"null"}]}},"required":["revision","note","tasks","width","commit","runId","taskId","outcome"]}},"required":["id","kind","title","detail","state","createdAt","decidedBy"]},"PullRequest":{"type":"object","properties":{"id":{"type":"string","minLength":5},"url":{"type":"string"},"repo":{"type":"string"},"number":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["unknown","open","merged","closed"]},"draft":{"default":null,"type":["boolean","null"]},"mergeable":{"default":null,"anyOf":[{"type":"string","enum":["mergeable","conflicting","unknown"]},{"type":"null"}]},"mergeState":{"default":null,"type":["string","null"]},"reviewDecision":{"default":null,"anyOf":[{"type":"string","enum":["approved","changes_requested","review_required","none"]},{"type":"null"}]},"checks":{"default":[],"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"state":{"type":"string","enum":["pending","passing","failing","skipped","neutral"]},"detail":{"default":"","type":"string"},"url":{"type":"string"}},"required":["name","state","detail"]}},"checksSummary":{"default":null,"anyOf":[{"type":"string","enum":["none","pending","passing","failing"]},{"type":"null"}]},"title":{"default":null,"type":["string","null"]},"headBranch":{"default":null,"type":["string","null"]},"headSha":{"default":null,"type":["string","null"]},"baseBranch":{"default":null,"type":["string","null"]},"mergedAt":{"default":null,"type":["string","null"]},"mergedBy":{"default":null,"type":["string","null"]},"mergeSha":{"default":null,"type":["string","null"]},"closedAt":{"default":null,"type":["string","null"]},"readAt":{"default":null,"type":["string","null"]},"error":{"default":null,"type":["string","null"]},"nextCheckAt":{"default":null,"type":["string","null"]},"mergeBlockers":{"default":[],"type":"array","items":{"type":"string"}},"kind":{"default":"task","type":"string","enum":["task","crew"]},"crewId":{"default":null,"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"taskId":{"default":null,"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"mergeApproval":{"default":null,"anyOf":[{"type":"object","properties":{"approvalId":{"type":"string","minLength":5},"decidedBy":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"decidedAt":{"type":"string"}},"required":["approvalId","decidedBy","decidedAt"]},{"type":"null"}]}},"required":["id","url","repo","number","state","draft","mergeable","mergeState","reviewDecision","checks","checksSummary","title","headBranch","headSha","baseBranch","mergedAt","mergedBy","mergeSha","closedAt","readAt","error","nextCheckAt","mergeBlockers","kind","crewId","taskId","mergeApproval"]},"Preview":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"projectId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"branch":{"type":"string"},"sha":{"type":"string"},"where":{"type":"string","enum":["boat"]},"access":{"type":"string","enum":["private","public"]},"state":{"type":"string","enum":["pending_approval","starting","up","stopping","stopped","failed"]},"stateReason":{"default":"","type":"string"},"stage":{"default":null,"type":["string","null"]},"url":{"default":null,"type":["string","null"]},"origin":{"default":null,"type":["string","null"]},"vmId":{"default":null,"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"port":{"default":null,"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"upSince":{"default":null,"type":["string","null"]},"readiness":{"default":[],"type":"array","items":{"type":"object","properties":{"checkedAt":{"type":"string"},"status":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"path":{"type":"string"},"via":{"type":"string","enum":["node","url"]}},"required":["checkedAt","status","path","via"]}},"expiresAt":{"type":"string"},"cost":{"type":"object","properties":{"hourlyUsd":{"type":["number","null"]},"billedBy":{"type":"string","const":"boat"},"note":{"type":"string"}},"required":["hourlyUsd","billedBy","note"]},"logTail":{"default":null,"type":["string","null"]},"cleanup":{"type":"object","properties":{"state":{"type":"string","enum":["not_needed","pending","verified"]},"detail":{"type":"string"}},"required":["state","detail"]},"createdAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","crewId","projectId","branch","sha","where","access","state","stateReason","stage","url","origin","vmId","port","upSince","readiness","expiresAt","cost","logTail","cleanup","createdAt","endedAt"]},"Event":{"type":"object","properties":{"seq":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ts":{"type":"string"},"kind":{"type":"string","enum":["crew.created","crew.state","plan.created","plan.revised","review.decided","plan.waiting","plan.approved","plan.changes_requested","plan.rejected","task.created","task.state","agent.created","agent.state","agent.placed","agent.move","run.started","run.message","run.tool","run.check","run.command","run.rate_limit","run.result","run.recovered","steer.sent","steer.received","steer.started","steer.applied","steer.not_applied","approval.requested","approval.decided","scale.decision","vm.state","node.state","artifact.created","pr.state","preview.state","budget.threshold","notice","api_key.created","api_key.used","api_key.revoked","webhook.created","webhook.updated","webhook.deleted","webhook.disabled","automation.created","automation.updated","automation.deleted","automation.disabled","automation.run","invite.sent","invite.revoked"]},"summary":{"type":"string"},"crewId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"runId":{"type":"string","minLength":5},"nodeId":{"type":"string","minLength":5},"vmId":{"type":"string","minLength":5},"level":{"default":"info","type":"string","enum":["info","warn","error"]},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["seq","ts","kind","summary","level"]},"Artifact":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"runId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["branch","pr","patch","log","preview","build","screenshot","summary","bundle"]},"title":{"type":"string"},"url":{"type":"string"},"meta":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"contentUrl":{"type":["string","null"]}},"required":["id","crewId","kind","title","meta","createdAt","contentUrl"]},"CrewSummary":{"type":"object","properties":{"crew":{"$ref":"#/components/schemas/Crew"},"projectName":{"type":"string"},"agents":{"type":"object","propertyNames":{"type":"string","enum":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"tasks":{"type":"object","properties":{"total":{"type":"number"},"done":{"type":"number"},"failed":{"type":"number"},"blocked":{"type":"number"}},"required":["total","done","failed","blocked"]},"vmsRunning":{"type":"number"},"spentUsd":{"type":"number"},"reservedUsd":{"type":"number"}},"required":["crew","projectName","agents","tasks","vmsRunning","spentUsd"]},"CrewView":{"type":"object","properties":{"crew":{"$ref":"#/components/schemas/Crew"},"projectName":{"type":"string"},"agents":{"type":"object","propertyNames":{"type":"string","enum":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["created","queued","provisioning","ready","running","waiting_input","waiting_dependency","waiting_rate_limit","validating","review","disconnected","machine_stopped","completed","failed","canceled"]},"tasks":{"type":"object","properties":{"total":{"type":"number"},"done":{"type":"number"},"failed":{"type":"number"},"blocked":{"type":"number"}},"required":["total","done","failed","blocked"]},"vmsRunning":{"type":"number"},"spentUsd":{"type":"number"},"reservedUsd":{"type":"number"},"managerNote":{"type":["string","null"]},"taskList":{"type":"array","items":{"$ref":"#/components/schemas/Task"}},"agentList":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"vmList":{"type":"array","items":{"$ref":"#/components/schemas/Vm"}},"approvals":{"type":"array","items":{"$ref":"#/components/schemas/Approval"}},"artifacts":{"type":"array","items":{"$ref":"#/components/schemas/Artifact"}},"moves":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"agentId":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"state":{"type":"string","enum":["capturing","stopping","placing","done","failed","canceled","superseded"]},"reason":{"default":"","type":"string"},"target":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"stay"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"cloud"}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","const":"node"},"nodeId":{"type":"string","minLength":5}},"required":["kind","nodeId"]}]},"from":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"to":{"type":"object","properties":{"connectionId":{"type":"string","minLength":5},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"model":{"type":"string"},"options":{"default":{},"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"nodeId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"nodeName":{"type":["string","null"]},"machine":{"anyOf":[{"type":"string","enum":["mac","linux","boat"]},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]}},"required":["connectionId","harness","model","options","nodeId","nodeName","machine","runId"]},"savedSha":{"default":null,"type":["string","null"]},"savedVia":{"default":null,"anyOf":[{"type":"string","enum":["handoff","snapshot","stored_bundle","branch","none"]},{"type":"null"}]},"savedUncommitted":{"default":false,"type":"boolean"},"requestedAt":{"type":"string"},"updatedAt":{"type":"string"},"endedAt":{"default":null,"type":["string","null"]}},"required":["id","agentId","crewId","state","reason","target","from","to","savedSha","savedVia","savedUncommitted","requestedAt","updatedAt","endedAt"]}},"review":{"type":"object","properties":{"settings":{"type":"object","properties":{"managerReview":{"default":true,"type":"boolean"},"reviewer":{"default":"auto","type":"string","enum":["auto","on","off"]},"followUpRounds":{"default":2,"type":"integer","minimum":0,"maximum":5},"replans":{"default":1,"type":"integer","minimum":0,"maximum":3},"maxAddedTasks":{"default":5,"type":"integer","minimum":0,"maximum":20},"planApproval":{"type":"boolean"},"planRevisions":{"type":"integer","minimum":0,"maximum":10},"steers":{"type":"integer","minimum":0,"maximum":50}},"required":["managerReview","reviewer","followUpRounds","replans","maxAddedTasks"]},"reviewerOn":{"type":"boolean"},"followUpRounds":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["used","max"]},"replans":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["used","max"]},"addedTasks":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["used","max"]},"turns":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"kind":{"type":"string","enum":["review","replan","reviewer"]},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]},"sha":{"type":["string","null"]},"forTaskId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"decision":{"anyOf":[{"type":"string","enum":["accept","follow_up","not_achievable","replace","drop","stop","approve","changes_requested"]},{"type":"null"}]},"note":{"type":["string","null"]},"reason":{"type":["string","null"]},"addedTaskIds":{"type":"array","items":{"type":"string","minLength":5}},"bound":{"type":["string","null"]},"at":{"type":"string"}},"required":["taskId","kind","state","sha","forTaskId","decision","note","reason","addedTaskIds","bound","at"]}},"reviewer":{"anyOf":[{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"sha":{"type":"string"},"verdict":{"type":"string","enum":["approve","changes_requested"]},"summary":{"type":"string"},"findings":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string","minLength":1,"maxLength":500},"line":{"anyOf":[{"type":"integer","minimum":1,"maximum":9007199254740991},{"type":"null"}]},"severity":{"type":"string","enum":["blocking","major","minor","nit"]},"title":{"type":"string","minLength":1,"maxLength":200},"explanation":{"type":"string","minLength":1,"maxLength":4000}},"required":["file","line","severity","title","explanation"]}},"checked":{"type":"array","items":{"type":"string"}},"blocking":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"model":{"type":["string","null"]},"connection":{"anyOf":[{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":["string","null"]}},"required":["id","name"]},{"type":"null"}]},"at":{"type":"string"}},"required":["taskId","runId","sha","verdict","summary","findings","checked","blocking","model","at"]},{"type":"null"}]}},"required":["settings","reviewerOn","followUpRounds","replans","addedTasks","turns","reviewer"]},"planApproval":{"type":"object","properties":{"state":{"type":"string","enum":["planning","waiting","replanning","applying","approved","rejected","stopped"]},"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"revisionsUsed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"maxRevisions":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"approvalId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"clockPaused":{"type":"boolean"},"pausedMinutes":{"type":"number"},"deadline":{"type":["string","null"]},"summary":{"type":"string"},"revisions":{"type":"array","items":{"type":"object","properties":{"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"taskId":{"type":"string","minLength":5},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"state":{"type":"string","enum":["pending","ready","assigned","done","failed","blocked","canceled"]},"askedChanges":{"anyOf":[{"type":"object","properties":{"note":{"type":"string"},"by":{"anyOf":[{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},{"type":"null"}]},"at":{"type":"string"}},"required":["note","by","at"]},{"type":"null"}]},"plan":{"anyOf":[{"type":"object","properties":{"revision":{"type":"integer","minimum":1,"maximum":9007199254740991},"note":{"type":"string"},"tasks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"role":{"type":"string","enum":["manager","builder","tester","reviewer","researcher","integrator"]},"deps":{"type":"array","items":{"type":"string"}},"owns":{"type":"array","items":{"type":"string"}},"instructions":{"type":"string"},"acceptance":{"type":"string"}},"required":["key","title","role","deps","owns","instructions","acceptance"]}},"width":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"commit":{"type":"string"},"runId":{"type":"string","minLength":5},"taskId":{"type":"string","minLength":5},"outcome":{"anyOf":[{"type":"string","enum":["approved","changes_requested","rejected"]},{"type":"null"}]}},"required":["revision","note","tasks","width","commit","runId","taskId","outcome"]},{"type":"null"}]},"approvalIds":{"type":"array","items":{"type":"string","minLength":5}}},"required":["revision","taskId","runId","state","askedChanges","plan","approvalIds"]}}},"required":["state","revision","revisionsUsed","maxRevisions","approvalId","clockPaused","pausedMinutes","deadline","summary","revisions"]},"steering":{"type":"object","properties":{"used":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"max":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"canSteer":{"type":"object","properties":{"ok":{"type":"boolean"},"reason":{"type":"string"}},"required":["ok"]},"steers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":5},"crewId":{"type":"string","minLength":5},"message":{"type":"string"},"by":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"session"},"session":{"type":"string"},"label":{"type":"string"}},"required":["kind","session","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"api_key"},"keyId":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"label":{"type":"string"}},"required":["kind","keyId","name","prefix","label"]},{"type":"object","properties":{"kind":{"type":"string","const":"automation"},"automationId":{"type":"string","minLength":5},"name":{"type":"string"},"runId":{"type":"string","minLength":5},"cause":{"type":"string"},"label":{"type":"string"}},"required":["kind","automationId","name","runId","cause","label"]}]},"at":{"type":"string"},"state":{"type":"string","enum":["pending","applied","not_applied"]},"status":{"type":"string"},"taskId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"runId":{"anyOf":[{"type":"string","minLength":5},{"type":"null"}]},"explanation":{"type":["string","null"]},"changes":{"anyOf":[{"type":"object","properties":{"added":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}},"dropped":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"},"reason":{"type":"string"},"stopped":{"type":"boolean"}},"required":["taskId","key","title","reason","stopped"]}},"changed":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"},"fields":{"type":"array","items":{"type":"string","enum":["title","instructions","acceptance","dependencies"]}}},"required":["taskId","key","title","fields"]}},"order":{"anyOf":[{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}},{"type":"null"}]},"orderSkipped":{"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":5},"key":{"type":"string"},"title":{"type":"string"}},"required":["taskId","key","title"]}}},"required":["added","dropped","changed","order","orderSkipped"]},{"type":"null"}]},"endedAt":{"type":["string","null"]}},"required":["id","crewId","message","by","at","state","status","taskId","runId","explanation","changes","endedAt"]}}},"required":["used","max","canSteer","steers"]},"canResume":{"type":"object","properties":{"ok":{"type":"boolean"},"reason":{"type":"string"},"code":{"type":"string","enum":["not_paused","ended","nothing_to_resume"]}},"required":["ok"]},"canRetryFailed":{"type":"object","properties":{"ok":{"type":"boolean"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"reason":{"type":"string"}},"required":["ok","count"]},"stopKind":{"type":"string","enum":["timeout","plan_failed","plan_revision_bound","integration_failed","step_failed","review_bound","not_achievable","manager_stopped","tasks_failed","merge_failed","delivery_failed","delivery_declined"]},"deliveredPastReview":{"type":"object","properties":{"delivered":{"type":"boolean"},"reason":{"type":"string"}},"required":["delivered","reason"]}},"required":["crew","projectName","agents","tasks","vmsRunning","spentUsd","managerNote"]},"Budget":{"type":"object","properties":{"capUsd":{"type":"number"},"spentUsd":{"type":"number"},"reservedUsd":{"type":"number"},"burnUsdPerHour":{"type":"number"},"basis":{"type":"string"}},"required":["capUsd","spentUsd","reservedUsd","burnUsdPerHour","basis"]},"CloudLimits":{"type":"object","properties":{"activeSandboxes":{"anyOf":[{"type":"object","properties":{"used":{"type":"number"},"limit":{"type":"number"}},"required":["used","limit"]},{"type":"null"}]},"starts":{"anyOf":[{"type":"object","properties":{"minute":{"type":"object","properties":{"used":{"type":"number"},"limit":{"type":"number"}},"required":["used","limit"]},"hour":{"type":"object","properties":{"used":{"type":"number"},"limit":{"type":"number"}},"required":["used","limit"]},"day":{"type":"object","properties":{"used":{"type":"number"},"limit":{"type":"number"}},"required":["used","limit"]}},"required":["minute","hour","day"]},{"type":"null"}]},"walletUsd":{"type":["number","null"]},"nextStartUsd":{"type":["number","null"]},"readAt":{"type":["string","null"]},"error":{"type":["string","null"]}},"required":["activeSandboxes","starts","walletUsd","nextStartUsd","readAt","error"]},"Forecast":{"type":"object","properties":{"blockers":{"type":"array","items":{"type":"string"}},"blockerItems":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string"},"taskIndexes":{"type":"array","items":{"type":"integer","minimum":0,"maximum":9007199254740991}}},"required":["text","taskIndexes"]}},"warnings":{"type":"array","items":{"type":"string"}},"agentsPlanned":{"anyOf":[{"type":"number"},{"type":"string","const":"auto"}]},"local":{"type":"array","items":{"type":"object","properties":{"nodeName":{"type":"string"},"slots":{"type":"number"}},"required":["nodeName","slots"]}},"cloud":{"anyOf":[{"type":"object","properties":{"vms":{"type":"number"},"vmType":{"type":"string"},"agentsPerVm":{"type":"number"},"rolloutSeconds":{"type":"number"},"hourlyUsd":{"type":"number"},"reservedUsd":{"type":"number"},"startFeesUsd":{"type":"number"}},"required":["vms","vmType","agentsPerVm","rolloutSeconds","hourlyUsd","reservedUsd","startFeesUsd"]},{"type":"null"}]},"connection":{"type":"object","properties":{"name":{"type":"string"},"maxConcurrent":{"type":"number"},"metering":{"type":"string","enum":["subscription","metered"]},"note":{"type":"string"}},"required":["name","maxConcurrent","metering","note"]},"budgetAfterUsd":{"type":"number"},"needsApproval":{"type":["string","null"]},"tasks":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"place":{"type":"string","enum":["local","cloud","waits","never"]},"machine":{"type":["string","null"]},"reason":{"type":"string"}},"required":["title","place","machine","reason"]}}},"required":["blockers","warnings","agentsPlanned","local","cloud","connection","budgetAfterUsd","needsApproval","tasks"]},"ModelCatalog":{"type":"object","properties":{"connectionId":{"type":"string"},"connectionName":{"type":"string"},"harness":{"type":"string","enum":["claude-code","pi","codex"]},"provider":{"type":"string","enum":["anthropic","morph","openai","custom"]},"status":{"type":"string","enum":["untested","ready","failing","throttled"]},"scope":{"type":"string","enum":["local","cloud","both"]},"defaultModel":{"type":"string"},"defaultOptions":{"type":"object","properties":{"effort":{"type":"string","enum":["low","medium","high","xhigh","max"]}}},"models":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"family":{"default":"","type":"string"},"contextWindow":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"efforts":{"default":[],"type":"array","items":{"type":"string","enum":["low","medium","high","xhigh","max"]}},"defaultEffort":{"type":"string","enum":["low","medium","high","xhigh","max"]},"source":{"type":"string","enum":["provider","harness","manual"]}},"required":["id","name","family","efforts","source"]}},"source":{"type":"string","enum":["provider","harness","none"]},"fetchedAt":{"type":["string","null"]},"error":{"type":["string","null"]}},"required":["connectionId","connectionName","harness","provider","status","scope","defaultModel","defaultOptions","models","source","fetchedAt","error"]},"BaseTemplate":{"type":"object","properties":{"name":{"type":"string"},"state":{"type":"string","enum":["building","candidate","active","retired","failed"]},"createdAt":{"type":"string"},"nodeVersion":{"type":"string"},"notes":{"type":"string"},"health":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"ok":{"type":"boolean"},"detail":{"type":"string"}},"required":["name","ok","detail"]}}},"required":["name","state","createdAt","nodeVersion","notes","health"]},"ApiKey":{"type":"object","properties":{"id":{"type":"string","minLength":5},"name":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["read","crews","config","approve"]}},"rateLimitPerMinute":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"state":{"type":"string","enum":["active","revoked","expired"]},"createdAt":{"type":"string"},"lastUsedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]}},"required":["id","name","prefix","scopes","rateLimitPerMinute","state","createdAt","lastUsedAt","expiresAt","revokedAt"]},"Webhook":{"type":"object","properties":{"id":{"type":"string","minLength":5},"url":{"type":"string"},"urlShortened":{"type":"boolean"},"description":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"projectId":{"type":["string","null"]},"enabled":{"type":"boolean"},"disabledReason":{"type":["string","null"]},"disabledAt":{"type":["string","null"]},"secretPrefix":{"type":"string"},"consecutiveFailures":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastSuccessAt":{"type":["string","null"]},"lastFailureAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","url","urlShortened","description","events","projectId","enabled","disabledReason","disabledAt","secretPrefix","consecutiveFailures","lastSuccessAt","lastFailureAt","createdAt"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","minLength":5},"webhookId":{"type":"string","minLength":5},"type":{"type":"string"},"eventSeq":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"state":{"type":"string","enum":["pending","succeeded","failed"]},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"nextAttemptAt":{"type":["string","null"]},"attemptLog":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"status":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"error":{"type":["string","null"]},"durationMs":{"type":"number"}},"required":["at","status","error","durationMs"]}},"payload":{"$ref":"#/components/schemas/WebhookPayload"},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","webhookId","type","eventSeq","state","attempts","nextAttemptAt","attemptLog","payload","createdAt","completedAt"]},"WebhookPayload":{"type":"object","properties":{"id":{"type":"string","minLength":5},"type":{"type":"string"},"createdAt":{"type":"string"},"apiVersion":{"type":"string","const":"v1"},"webhookId":{"type":"string","minLength":5},"event":{"anyOf":[{"$ref":"#/components/schemas/Event"},{"type":"null"}]}},"required":["id","type","createdAt","apiVersion","webhookId","event"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string","enum":["invalid_request","authentication","permission","not_found","conflict","rate_limited","not_built","upstream","internal"]},"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}},"required":["type","code","message","requestId"]}},"required":["error"]}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Makes a retry safe: the same key with the same request returns the first answer and does nothing else.","schema":{"type":"string","maxLength":200}}},"responses":{"Error":{"description":"Any error, in the one envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotBuilt":{"description":"This is not built. Nothing was done.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key (`kdk_...`) created by the founder with explicit scopes."},"session":{"type":"apiKey","in":"cookie","name":"koidog_session","description":"The dashboard's session cookie. Mutating requests also need an allowed Origin."}}}}