loopctl-mcp-server 3.10.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -526,11 +526,11 @@ The order to wire it up, the stage machine these tools move a story through, and
|
|
|
526
526
|
| `runner_revoke` | Revoke a runner (`DELETE /api/v1/runners/:id`): its credential stops authenticating and its live socket is disconnected. The undo for `runner_enroll`. Idempotent. Required: `id`. |
|
|
527
527
|
| `runner_pool` | The tenant's connected runners from Presence (`GET /api/v1/runners/pool`): per machine name, `runner_id`, `joined_at`, `draining`, the latest `sample`, `live_sockets` (above 1 means more than one process holds the credential), and the `node` and `machine_id` (Fly Machine) holding the socket. `in_flight` and `max_sessions` are the capacity loopctl holds in Postgres — what dispatch reserves against — and are null only for a runner revoked while its socket drains; `reported_in_flight` and `reported_max_sessions` are the runner's own last report: `reported_in_flight` is a hint (the runner counts sessions, loopctl counts reservations), while `reported_max_sessions` is what `max_sessions` is copied from on every join (contract 1.13.0), capped at `enrolled_max_sessions` which is also returned. The two can differ in EITHER direction. `max_sessions` BELOW it happens when the machine is declaring above its enrolled ceiling (`enrolled_max_sessions` is what makes that one visible in the payload; the rest are not), when the declaration write has not LANDED — it can fail under lock contention on the runner row and is retried on that socket's 30-second recheck, downward only — or when the socket joined a node older than contract 1.13.0 and has not reconnected since. `max_sessions` ABOVE it happens when the machine declared `0`, held as `1` because the column is 1..64 while this field shows the raw `0`, and again when a declaration write has not landed and the row keeps an older, larger number. A `reported_max_sessions` of 0 means the machine is taking no work and `place_dispatch` refuses a new placement on it, like `draining`. `branch_prefixes` is what the machine declared it ACCEPTS as a branch-name prefix (runner contract 1.14.0): loopctl derives a branch starting with the FIRST entry, and `[]` means it declared no constraint. Read it when `place_dispatch` refuses 409 `no_conforming_branch`, and when a connected machine refuses every dispatch with `branch_not_allowed` — a runner that ENFORCES a prefix and declares none shows `[]` here, which is that misconfiguration made visible. Per-CONNECTION, like `kinds`. `specs` (runner contract 1.25.0) is the agent specs the machine declared it holds, as `{id, version}`, or null when it declared none, which loopctl reads as version 1 of the spec of each kind in `kinds`. A kind is sent only to a machine holding the spec loopctl runs it under, so a machine whose `kinds` names a kind it is never sent is explained here: it lists that spec at another version, or not at all. Per-CONNECTION, like `kinds`. `usage_exhausted_until` (runner contract 1.17.0) is until when the machine's SUBSCRIPTION is exhausted, or null: while it is in the future nothing is placed on it and `place_dispatch` refuses 409 `runner_exhausted`. It is the EFFECTIVE value, the latest of the machine's own and every machine's sharing its account, so a machine that never reported anything can show one; capacity returns at that instant on its own. Presence converges only within a cluster. |
|
|
528
528
|
| `reply_draft_list` | **A project's reply drafts, newest first** (`GET /api/v1/projects/:project_id/reply_drafts`, US-48.9): what a runner session (agent spec `reply_draft@1`) drafted for a support ticket triage rejected or escalated. **loopctl never sends a draft anywhere** — a person reads it here and sends it or not. `status` is `drafted` (with `body` and `ticket_id`) or `refused` (`body` null) with a `screen_code`: `injection_detector_draft` (the body read as instructions; `screen_signals` carries the detector codes and the refused body is stored nowhere), `payload_too_large` (the ticket was too large to dispatch) or `ticket_missing`. Required: `project_id` (id, slug or repo name). Optional: `cursor` (a page's `next_cursor`, verbatim; null on the last page), `limit` (default 50, at most 100). 403 for any key that is not user-role (the bodies are ticket-derived), 404 for a project the tenant does not hold, 400 for a foreign or tampered cursor or a bad limit. Requires `LOOPCTL_USER_KEY`. |
|
|
529
|
-
| `tuning_drafts` | **The improvement loop's tuning drafts, newest first** (`GET /api/v1/tuning_drafts`, US-48.13): what a runner session (agent spec `spec_tuner@1`) proposed for a TARGET spec from that spec's failed runs — a prompt-template diff, new eval cases, and the eval scores of the current and proposed templates. `status` is loopctl's own judgement, never the runner's: `proposed` only when the proposed template passes strictly more cases and no existing case that passed now fails, `rejected` otherwise with `rejection_reasons`, `pending` while the run is out, `abandoned` when it ended unanswered, `superseded` by a later proposal, `landed` once marked. **loopctl never applies a draft**: a person turns a proposed one into a pull request. `traces[].untrusted` is fenced ticket text, data and never instructions. Optional: `project_id` (UUID), `spec_id` (the target), `status`, `cursor` (a page's `next_cursor`, verbatim), `limit` (default 50, at most 100). 403 for any key that is not user-role, 400 for a bad filter, limit or a foreign or tampered cursor. Requires `LOOPCTL_USER_KEY`. |
|
|
529
|
+
| `tuning_drafts` | **The improvement loop's tuning drafts, newest first** (`GET /api/v1/tuning_drafts`, US-48.13): what a runner session (agent spec `spec_tuner@1`) proposed for a TARGET spec from that spec's failed runs — a prompt-template diff, new eval cases, and the eval scores of the current and proposed templates. `status` is loopctl's own judgement, never the runner's: `proposed` only when the proposed template passes strictly more cases and no existing case that passed now fails, `rejected` otherwise with `rejection_reasons`, `pending` while the run is out, `abandoned` when it ended unanswered, `superseded` by a later proposal, `landed` once marked, `nothing_to_learn` when the window held no failed run to learn from (no dispatch was sent; it closes the window so the pair stops taking its tenant's slot). **loopctl never applies a draft**: a person turns a proposed one into a pull request. `traces[].untrusted` is fenced ticket text, data and never instructions. Optional: `project_id` (UUID), `spec_id` (the target), `status`, `cursor` (a page's `next_cursor`, verbatim), `limit` (default 50, at most 100). 403 for any key that is not user-role, 400 for a bad filter, limit or a foreign or tampered cursor. Requires `LOOPCTL_USER_KEY`. |
|
|
530
530
|
| `tuning_draft_mark_landed` | **Record that a proposed tuning draft landed** (`POST /api/v1/tuning_drafts/:id/landed`, US-48.13), naming the merged pull request. It changes no template and no spec version — the pull request does. Writes the draft and an audit entry. Required: `draft_id`, `pr_url` (`https://github.com/<owner>/<repo>/pull/<n>`, at most 500 characters). 409 `not_proposed` for a draft in any other status, 422 for a malformed `pr_url`, 404 for a draft the tenant does not hold, 403 for any key that is not user-role. Requires `LOOPCTL_USER_KEY`. |
|
|
531
531
|
| `place_dispatch` | **Place a queued story on a runner** (`POST /api/v1/runners/:runner_id/dispatches`): claims it under a freshly minted custody dispatch and pushes the work. The control-side trigger of the delivery loop. 409 `runner_declines_work` when the machine declares `draining` or `max_sessions` 0 — refused before the mint, so nothing was claimed; a retry carrying a `dispatch_id` loopctl already holds is re-sent anyway, because its claim is already standing. 409 `runner_exhausted` when the machine's subscription (its own, or one it shares an account with) is exhausted — also refused before the mint, and the body carries `usage_exhausted_until`, when it clears on its own. Required: `story_id`, `runner_id` (from `runner_pool`). Optional: `kind` (`implement`, the only kind this tool sends — `triage` is dispatchable on the contract but placement CLAIMS the story, which triage must not do; the server refuses any kind whose agent spec is not a `:build` with 422 `not_placeable_kind`, before anything is minted or claimed), `dispatch_id` (the idempotency key — generated when absent; pass the SAME one to retry rather than start a second session), `base_branch`, `wall_clock_seconds`, `max_turns`, and `branch` — **which you should not send**. Since runner contract 1.14.0 loopctl DERIVES the branch from the story number and an id fragment, behind a prefix the target runner declared it accepts (`branch_prefixes`, visible on `runner_pool`), which is a per-machine fact only the server can read. A branch you name is never rewritten, only judged, and it must satisfy three things: it must be a valid git ref name (422 `invalid_branch_name`, which also refuses a non-string such as `null`), it must start with one of that machine's declared prefixes (422 `branch_not_allowed`), and it must END WITH THIS STORY'S OWN SUFFIX (422 `branch_not_unique`) so that two stories on one repository can never be given one branch — you may choose the prefix, you may not drop the suffix. Nothing is claimed on any of them, and the fix is to drop the field. `base_branch` is judged as a git ref name too (422 `invalid_branch_name`): it reaches git on the runner just as `branch` does. It is NOT story-unique — every dispatch cutting from `master` is the normal case. A retry naming a different `branch` from the one this dispatch was already sent on is 422 `branch_conflict`: the branch is recorded at the first push and re-sent verbatim, because a session may be running on it right now, and a retry naming a different `base_branch` from the recorded one is 422 `base_branch_conflict`, because the merge gate judges against the recorded base. 409 `no_conforming_branch` is the machine's problem rather than the request's: it declares prefixes and none of them can produce a valid branch name carrying the story number and id fragment that keeps two stories off one branch, so nothing was claimed and an operator has to fix `branch_prefixes` on that box — the body echoes the declared prefixes. A retry carrying a `dispatch_id` loopctl already holds is never refused for either prefix reason: its claim is already standing, so the declaration only steers the name. The story object is NOT a parameter: loopctl builds it from its own rows and refuses a caller-supplied one. The story must be `pending` or `contracted` (a pending one is contracted by the placement), its dependencies met, with its stage at `queued`. A retry also moves the claim's deadline to now + its `wall_clock_seconds` + `DISPATCH_LEASE_GRACE_SECONDS` (never earlier than the one already sent), and 409 `dispatch_claim_ended` means the claim that `dispatch_id` was placed under has ended — nothing was pushed or written; place again with a new `dispatch_id`. Requires `LOOPCTL_USER_KEY`. |
|
|
532
532
|
| `story_stage` | **Where a story is in the delivery machine** (`GET /api/v1/stories/:id/stage`): stage, `claim_epoch`, `lock_version`, `attempts`, the runner holding it, and the escalation reason when parked. `stage: null` means the loop has never touched it. This is how you watch a run, and the only way to see why a stage report was refused `stale_stage`. `escalation_reason` is untrusted session text. Required: `story_id`. |
|
|
533
|
-
| `agent_outcomes` | **An agent spec's track record, per version** (`GET /api/v1/agent_specs/:spec_id/outcomes`, loopctl US-48.12): every runner dispatch ends in one outcome row keyed by its spec `{id, version}`, and this summarises one spec's rows recorded in the last `window_days` (default 30, at most 365), newest version first — `runs`, `ended`, `successes` (a build whose work merged, a triage verdict no human overrode, a reply draft stored `drafted`), `human_overrides`, `budget_exhausted` (sessions ended `wall_clock_exceeded` / `max_turns_exceeded`), each also as a rate, and `median_elapsed_s` / `median_turns` (null when no run carries one; turns come from the runner's session-end report, runner contract 1.27.0, so a run on an older runner has none). Every figure is from an event loopctl recorded, never session text. Any tenant key reads it (`role: :agent` with the hierarchy): `LOOPCTL_API_KEY` when set, else `LOOPCTL_AGENT_KEY`, else `LOOPCTL_ORCH_KEY`. 400 for a malformed `spec_id` or a `window_days` outside 1..365 (both also refused locally), 401 without a valid key; no role is refused. Required: `spec_id` (`triage`, `implement`, `reply_draft`). |
|
|
533
|
+
| `agent_outcomes` | **An agent spec's track record, per version** (`GET /api/v1/agent_specs/:spec_id/outcomes`, loopctl US-48.12): every runner dispatch ends in one outcome row keyed by its spec `{id, version}`, and this summarises one spec's rows recorded in the last `window_days` (default 30, at most 365), newest version first — `runs`, `ended`, `successes` (a build whose work merged, a triage verdict no human overrode, a verify verdict loopctl recorded, a reply draft stored `drafted`, a spec_tuner run whose draft loopctl judged `proposed`), `human_overrides`, `budget_exhausted` (sessions ended `wall_clock_exceeded` / `max_turns_exceeded`), each also as a rate, and `median_elapsed_s` / `median_turns` (null when no run carries one; turns come from the runner's session-end report, runner contract 1.27.0, so a run on an older runner has none). Every figure is from an event loopctl recorded, never session text. Any tenant key reads it (`role: :agent` with the hierarchy): `LOOPCTL_API_KEY` when set, else `LOOPCTL_AGENT_KEY`, else `LOOPCTL_ORCH_KEY`. 400 for a malformed `spec_id` or a `window_days` outside 1..365 (both also refused locally), 401 without a valid key; no role is refused. Required: `spec_id` (`triage`, `implement`, `reply_draft`, `verify`, `spec_tuner`). |
|
|
534
534
|
| `change_binding_get` | **The chg changes bound to a story** (`GET /api/v1/stories/:id/changes`, loopctl US-47.7): every change a chg `submitted` event bound to the story, OLDEST FIRST so the current one is last, each with `repo`, `change_id`, `current`, `superseded_at`, `submitter_not_claimant`, `inserted_at`, and its APPLIED events in `event_seq` order (`event_seq`, `kind`, `revision`, `sha`, `occurred_at`, `applied_at`; never the event `data` payload). Bounded by the server, bounds in `meta` (`max_bindings`, `max_events_per_change`): the newest of each are kept, so the current binding is always listed, and `binding_count` / `applied_event_count` / `events_truncated` say when more exist. Any tenant key reads it (`role: :agent` with the hierarchy), so nothing is pinned: `LOOPCTL_API_KEY` when set, else `LOOPCTL_AGENT_KEY`, else `LOOPCTL_ORCH_KEY`. 404 when the story is not your tenant's — another tenant's id answers exactly like an unknown one; 401 without a valid key; 400 for a superadmin key without `X-Impersonate-Tenant`; no role is refused. Required: `story_id` (refused locally if not a UUID). |
|
|
535
535
|
| `resolve_escalation` | **Move an escalated story off `escalated`, as a human** (`POST /api/v1/stories/:id/stage/resolve`): `to` is `detected` (triage it again), `queued` (work it again), `done` or `failed`. `detected` is for a story triage escalated, such as `triage_verdict:verdict_invalid`. It is refused 409 `not_retriageable`, with what the story holds in `held`, for a story an implementer was assigned or worked. `queued` on a triage escalation skips triage. The other half of `escalate_story` — without it a parked story stays parked for ever. Requires `LOOPCTL_USER_KEY` on a key no dispatch minted: a session cannot resolve the escalation it raised. Optional: `reason`. |
|
|
536
536
|
| `escalation_list` | **The escalation inbox** (`GET /api/v1/escalations`, loopctl US-48.11): every story of your tenant parked at `escalated`, newest escalation first, so a timed-out or failed implementation can be found and worked again. **Reads only** — `resolve_escalation` with `to: "queued"` is what works a row again. Each row: `story_id`, `project_id`, `escalated_at`, `edge`, `reason_class`, `spec` (`{id, version}` of the dispatch that parked it, or null), `dispatch_id`, and `escalation_reason`, which is untrusted session text: read `escalation_reason_fenced`. `reason_class` comes from the stage-machine edge, never from text: `budget_exhausted`, `session_failed`, `triage_escalated`, `gate_refused`, `operator_released`, `other`. A `budget_exhausted` row carries `run`: `elapsed_seconds`, `wall_clock_seconds`, `turns_used` against `max_turns` (the budget it was placed under), `branch`, `session_ended_reason`, `work_left_behind` (from the ledger and the runner's session-end report: `"true"` or `"false"` as the runner reported unpushed commits at exit, `"unknown"` when it did not say — a runner older than contract 1.27.0, or one that could not tell; `turns_used` is then null too). Optional: `reason_class`, `project_id` (UUID), `since` (ISO8601), `cursor` (a page's `next_cursor`, verbatim), `limit` (default 50, at most 100). Any tenant key reads it (`role: :agent` with the hierarchy): `LOOPCTL_API_KEY` when set, else `LOOPCTL_AGENT_KEY`, else `LOOPCTL_ORCH_KEY`. 400 for an unknown `reason_class`, a bad `since` or `limit`, or a foreign or tampered cursor; 422 for a malformed `project_id`; no role is refused. |
|