loopctl-mcp-server 3.44.0 → 3.46.0

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 CHANGED
@@ -186,6 +186,7 @@ tool parameter.
186
186
  | Tool | Description |
187
187
  |---|---|
188
188
  | `get_tenant` | Get current tenant info. Use to verify connectivity, and to read `capabilities` — which surfaces your `trust_tier` includes — before attempting a write. |
189
+ | `update_tenant` | **Update the tenant's own profile** (`PATCH /api/v1/tenants/me`): any of `name`, `email`, `settings`, `default_story_budget_millicents`, `token_data_retention_days`. `settings` is MERGED key by key into the stored map. User role: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user). `422` for a malformed or taken email, a non-boolean `knowledge_auto_extract`/`kb_curation_log` setting, a budget not above 0, or a retention that is not an integer of at least 30 (null turns it off). The slug is immutable and loopctl would ignore one with a 200, so a call carrying `slug`, or naming no field, is refused locally. |
189
190
  | `list_projects` | List all projects in the current tenant. |
190
191
  | `get_project` | **Read one project** (`GET /api/v1/projects/:id`) with its `epic_count` and `story_count`. Any key, sent as the session's own. `404` for another tenant's project. The path takes an id only (a slug would answer the same 404), so a non-UUID `project_id` is refused locally: resolve a repo to its id with `resolve_project`. |
191
192
  | `resolve_project` | Resolve a repo to its `project_id` in one cheap call — provide any of `slug`, `repo_url` (`git@github.com:owner/repo.git`, `https://github.com/owner/repo`, and bare `owner/repo` all match), or `name`. Precedence `slug > repo_url > name`, first match wins. Use the returned `id` to scope captures/recall (`memory_*`, `recall_context`). `404` `not_found` if nothing matches, `422` `no_identifier` if none supplied, `409` if a fuzzy identifier matches more than one active project. |
@@ -225,6 +226,8 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
225
226
  | `channel_unlock` | Release YOUR OWN advisory file soft-lock. Addressed by your `(tenant, project, agent, session)` slot: a lock you do not hold / another AGENT's / one under a different session id / cross-tenant / nonexistent returns a byte-identical 404. The enforced scope is per-AGENT, not per-session (`session_id` is client-supplied and published by `channel_locks`) — accepted for advisory hint data. Best-effort housekeeping — a lock also self-expires. Required: `project_id`, `target`. |
226
227
  | `channel_locks` | List the LIVE advisory file soft-locks on a channel — read it BEFORE editing. A SEPARATE, PINNED set: the read to trust for lock visibility, while `channel_recent` admits only the newest few locks (and does not count suppressed ones in its `has_more`). Each row carries `target`, `agent_id`, `session_id`, `host`, `expires_at`, `inserted_at`. Fairness-bounded per AGENT (server-stamped, so rotating `session_id` does not escape it): at most 20 rows per page. Check BOTH `meta.overflow` (page cap) and `meta.holders_truncated` (fairness cap) — either true means live locks were dropped from the page. ADVISORY: a lock is information, not a prohibition. Oracle-safe: a foreign/nonexistent project_id returns an empty set. Optional `limit` (default 100, max 200). Required: `project_id`. |
227
228
  | `channel_graduate` | Graduate a coordination post into the durable Knowledge wiki (Epic 40, US-40.E1). CONTENT-SELECTIVE — ONLY for a genuinely REUSABLE finding with no external tracker, worth another agent reading later; a transient directive should be LEFT TO EXPIRE on its TTL, never graduated. No automatic graduation. Reuses Knowledge's guardrails, never a bypass: the semantic novelty gate (a near-duplicate returns 200 `deduplicated`, nothing created) plus a secret scan (a denylisted credential returns 422). Records `source_type` `channel_graduation` + the post id, attributed to you; the source post is KEPT (its TTL reclaims it). Project-scoped by membership. Optional `tags`, `category` (default `finding`). Required: `post_id`, `title`. |
229
+ | `channel_quarantine_list` | **Review quarantined posts** (`GET /api/v1/channel/posts/quarantined`), the ones the secret rescan hid as suspected credentials. The FULL rows go to `rows_file` (absolute, must not exist, created 0600) and are not returned: the result lists each post with its scanned fields removed, and `quarantine_reason` names the ones that tripped. Optional `project_id` (id, slug or repo name; one naming no project answers an empty list) and `limit` (1..100, default 25; loopctl would clamp, so out-of-range is refused locally). **User key** on a human-anchored tenant: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403 custody_tier_required` on an agent-rooted tenant). |
230
+ | `channel_quarantine_release` | **Release a quarantined post** (`POST /api/v1/channel/posts/:id/release`), the false-positive counterpart to `channel_delete`; audited. The answer's post has its scanned fields removed (read it with `channel_get`). **User key** on a human-anchored tenant, as `channel_quarantine_list`. `404`, identical for each, when the post is missing, another tenant's or not quarantined; `500 audit_write_failed` (nothing released). A non-UUID `post_id` is refused locally. |
228
231
 
229
232
  ### Story Tools
230
233
 
@@ -259,6 +262,8 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
259
262
  |---|---|
260
263
  | `contract_story` | Agent acknowledges a story's acceptance criteria. Transitions pending -> contracted. Refused 409 `story_held` when the story's delivery stage is `escalated`, `done` or `failed` — it is not available to agents even when it reads `pending`; an escalated story becomes available again only after `resolve_escalation` sends it to `queued`. |
261
264
  | `claim_story` | Agent claims a contracted story with pessimistic locking. Transitions contracted -> assigned. On a loopctl with claim leases the result leads with the claim's `claim_epoch` and `claimed_until`; keep the epoch for `renew_story_claim`. Both are absent on an older server. Refused 409 `story_held` when the story's delivery stage is `escalated`, `done` or `failed` — even when it reads `pending` or `contracted`; an escalated story is claimable again only after `resolve_escalation` sends it to `queued`, a done or failed one never is. Refused 409 `chg_root_review_only` when the key descends from an intake source's `chg_root_dispatch_id`: chg-server's keys may only review. A claim by a holder credential takes the holder's `lease_until` and no cap (US-52.19); `409 holder_lease_expired` when that lease has run out or the holder ended. |
265
+ | `bulk_claim` | **Claim up to 50 contracted stories at once** (`POST /api/v1/stories/bulk/claim`) for this session's agent and holder, in one transaction with partial success: 200 with `results` when any was claimed, 422 with `results` when none was; each story's refusal is its `reason`. Mints no start capability (`start_story` recovers one). Sent on the session's own key: `exact_role: :agent`, so an orchestrator, user or superadmin key is `403 insufficient_role`. `403 custody_tier_required` on an agent-rooted tenant, `409 chg_root_review_only` for a chg-rooted key, `503 tenant_halted` under a custody halt. An empty or oversized batch, a non-UUID id and an id named twice are refused locally. |
266
+ | `unclaim_story` | **Give back a story this session claimed** (`POST /api/v1/stories/:id/unclaim`): back to pending; a delivery story is re-contracted below the retry ceiling and escalated over `attempts_exhausted` at it. Sent on the session's own key: `exact_role: :agent`, so an orchestrator, user or superadmin key is `403 insufficient_role` (another agent's story: `force_unclaim_story`). `403` when this agent is not the assignee, `403 custody_tier_required`, `404` for another tenant's story, `409` for a story no claim can leave, `409 held_by_other_holder`, `422` when the release write was rejected, `500 audit_chain_append_failed` (the whole release rolled back), `503 tenant_halted`. A non-UUID `story_id` is refused locally. |
262
267
  | `renew_story_claim` | Renew your claim's lease (`POST /stories/:id/renew-claim`, agent key). A claim not renewed before `claimed_until` (default 24 hours, `STORY_CLAIM_LEASE_SECONDS`) is released back to `pending` under you, so renew well inside it on any story held longer. A driver-placed claim — one a placement took for a runner dispatch — is capped at its dispatch deadline (`claim_lease_cap`: placed_at + `wall_clock_seconds` + `DISPATCH_LEASE_GRACE_SECONDS` at the claim, sent to the runner as `deadline_at`; moved forward to a resume's time or the runner's acceptance + `wall_clock_seconds` + the grace, only while the claim is live; never earlier than a `deadline_at` already sent), and its `claimed_until` already IS that cap: renewing it writes nothing and returns the claim as it stands, never moving `claimed_until` past it. Required: `story_id`, `claim_epoch` (from the claim). Refusals pass through: 400 epoch missing or malformed, 422 `not_claimed`, 409 `stale_claim_epoch` (the claim has ended: stop working it), 409 `not_claimant`, 409 `lease_cap_reached` (a driver-placed claim already at its cap: nothing is renewed, stop working it). A claim taken by a holder credential (US-52.19) lives by the holder's lease instead: renewing it writes the holder's `lease_until`, and the heartbeat already moves it; `409 holder_lease_expired` when the holder has lapsed. Needs a loopctl server with claim leases. |
263
268
  | `escalate_story` | Park a story you hold for a HUMAN and stop (`POST /stories/:id/escalate`, agent key). This is what an unattended session calls INSTEAD of asking a question — a headless run has no way to ask, so escalating is the affordance. Use it when the request contradicts an existing story, KB decision or documented behaviour, when it inverts or removes behaviour a previous story deliberately added, when it is a workflow change rather than a defect fix, or when it needs a business call — not for an ordinary blocker. ONE-WAY from your side: only a human moves the story off `escalated`, so on success STOP and report. Required: `story_id`, `claim_epoch`, `reason` (verbatim, treated as untrusted data, length capped by the server in codepoints — a 400 names the bound); optional `payload` object. Idempotent under the same epoch. Refusals pass through: 409 `stale_claim_epoch`, 409 `not_claimant`, 404 `unknown_story_stage`, 400 for a malformed epoch or reason. An orchestrator or user key is 403'd on purpose. |
264
269
  | `start_story` | Agent starts work on a claimed story. Transitions assigned -> implementing. |
@@ -284,6 +289,8 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
284
289
  |---|---|
285
290
  | `bulk_mark_complete` | **Backfill-only.** Bulk-marks pre-existing, never-dispatched stories (pending, unassigned, no dispatch lineage) as complete in a single call. Dispatched stories are refused — they must go through the normal report → review → verify flow. Refused 409 `chg_root_cannot_verify` for the whole batch for a chg-rooted key (loopctl US-47.5). |
286
291
  | `verify_all_in_epic` | Bulk verify all reported_done, unverified stories in an epic. Refused 409 `chg_root_cannot_verify` for the whole epic for a chg-rooted key (loopctl US-47.5). |
292
+ | `bulk_verify` | **Verify up to 50 reported stories at once** (`POST /api/v1/stories/bulk/verify`); each entry `{story_id, summary, review_type, findings}`, the last three optional. Each story runs `verify_story`'s gates, its lineage comparison included, with partial success (200 / 422 with `results`; a story's custody refusal is its `reason`). Key chosen as `verify_story` chooses it: `LOOPCTL_ORCH_KEY` exactly when set, else `LOOPCTL_API_KEY`; `exact_role: :orchestrator`, so a user or superadmin key is `403 insufficient_role`. `400` for an orchestrator key linked to no agent, `401 bulk_signature_unsupported` / `403 agent_enrollment_required` for an enrolled caller under the signed profile, `403 custody_tier_required`, `409 chg_root_cannot_verify`, `503 tenant_halted`. Refused locally: a bad batch, a non-UUID or repeated story id (loopctl keeps only the last entry), and a non-string `summary`/`review_type` or non-object `findings` (loopctl would verify and silently record no result). |
293
+ | `bulk_reject` | **Reject up to 50 reported stories at once** (`POST /api/v1/stories/bulk/reject`); each entry `{story_id, reason, review_type, findings}`, `reason` required. Each story runs `reject_story`'s gates with partial success (200 / 422 with `results`); a rejected story's claim is released and a delivery story re-contracted or escalated. Same key and role gate as `bulk_verify`. `400` for an orchestrator key linked to no agent, `403 custody_tier_required`, `409 chg_root_cannot_verify`, `500 audit_chain_append_failed` (the whole batch rolled back), `503 tenant_halted`. Refused locally: a bad batch, a non-UUID or repeated story id, a blank `reason`, and a non-string `reason`/`review_type` or non-object `findings`. |
287
294
 
288
295
  ### Token Efficiency Tools
289
296
 
@@ -294,7 +301,31 @@ Epic 39 Repo Coordination Bus — a lightweight, tenant-isolated channel for age
294
301
  | `get_story_token_usage` | orch | Get all token usage records for a single story. |
295
302
  | `get_cost_anomalies` | orch | Get cost anomaly alerts — stories or agents exceeding expected budgets. Optionally filter by project. |
296
303
  | `get_ingestion_anomalies` | orch | Get ingestion-health anomalies — capture_silence (a source_type stopped producing articles), high_reject_rate (writes rejected at high rate, persisting no article row), and sweep_stalled (the channel-post retention sweep is no longer enforcing retention, under the reserved source_type `channel_post_sweep`). Check whether knowledge capture is still landing AND being accepted, and whether coordination-bus retention is still enforced. |
297
- | `set_token_budget` | orch | Set a token budget (in millicents) for a project, epic, story, or agent scope. Requires orchestrator role. |
304
+ | `set_token_budget` | orch | Set a token budget (in millicents) for a project, epic or story scope. Requires orchestrator role. `409` when the scope already has one (`token_budget_update` changes it), `404` for a scope entity that is not this tenant's, `422` for a malformed scope id or an out-of-range value. |
305
+ | `token_budget_list` | agent | **List the tenant's token budgets** (`GET /api/v1/token-budgets`) with live spend, remaining and utilization; filters `scope_type` (project, epic, story) and `scope_id`, paged by `page`/`page_size` (1..100). Any key (`role: :agent`), sent as the session's own. Refused locally: an unknown `scope_type` (loopctl would answer an empty list), a non-UUID `scope_id`, a bad page. |
306
+ | `token_budget_get` | agent | **Read one token budget** (`GET /api/v1/token-budgets/:id`) with live spend and the `effective_budget_millicents` / `budget_source` that govern its scope after inheritance. Any key, sent as the session's own. `404` for another tenant's budget; a non-UUID `budget_id` is refused locally. |
307
+ | `token_budget_update` | orch | **Change a token budget** (`PATCH /api/v1/token-budgets/:id`): `budget_millicents`, `budget_input_tokens`, `budget_output_tokens` (null clears), `alert_threshold_pct` (1..100), `metadata`. Orchestrator role or higher: `LOOPCTL_ORCH_KEY` verbatim, else `LOOPCTL_USER_KEY`, else the default key (`403 insufficient_role` for an agent key, `403 custody_tier_required` on an agent-rooted tenant). `404` for another tenant's budget, `422` out of range. Refused locally: a non-UUID id, no field, or `scope_type`/`scope_id` (loopctl would ignore them with a 200), non-object `metadata`. |
308
+ | `token_budget_delete` | user | **Delete a token budget** (`DELETE /api/v1/token-budgets/:id`); its usage reports stay. User role: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403 custody_tier_required` on an agent-rooted tenant). `404` for another tenant's budget; a non-UUID `budget_id` is refused locally. |
309
+ | `token_usage_delete` | user | **Soft-delete a token usage report** (`DELETE /api/v1/token-usage/:id`): it leaves every total and analytics read; budget flags reset when spend drops back. User role on a human-anchored tenant, keyed as `token_budget_delete`. `404` for a missing, foreign or already deleted report; a non-UUID `report_id` is refused locally. |
310
+ | `token_usage_correct` | user | **Correct a token usage report** (`POST /api/v1/token-usage/:id/correction`): a new report carrying signed deltas `input_tokens`, `output_tokens`, `cost_millicents` (all required, negative subtracts), optional `model_name`, `phase`, `session_id`, `skill_version_id`, `metadata`. User role on a human-anchored tenant, keyed as `token_budget_delete`. `404` for a missing, foreign or deleted original; `422` when a total would go below 0, the original is a correction, or the phase or skill version is invalid. Refused locally: non-UUID ids, a missing or non-integer delta, non-object `metadata`. |
311
+ | `cost_anomaly_resolve` | user | **Resolve a cost anomaly** (`PATCH /api/v1/cost-anomalies/:id`); audited. User role on a human-anchored tenant: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403 custody_tier_required` on an agent-rooted tenant). `404` for another tenant's anomaly; a non-UUID `anomaly_id` is refused locally. |
312
+ | `ingestion_anomaly_update` | user | **Resolve, archive or un-archive an ingestion anomaly** (`PATCH /api/v1/ingestion-anomalies/:id`, `action` resolve by default, archive → `?archived=true`, unarchive → `?archived=false`). Archive suppresses re-detection for a retired source_type. Keyed and gated as `cost_anomaly_resolve`. `404` for another tenant's anomaly; a non-UUID id or unknown `action` is refused locally. |
313
+ | `cost_trends` | orch | **Read the daily or weekly cost trend** (`GET /api/v1/analytics/trends`), filtered by `project_id` (UUID, slug or repo name), `since`/`until` (YYYY-MM-DD), paged by `page`/`page_size`. Orchestrator role or higher, keyed as `token_budget_update` (`403 insufficient_role` for an agent key). `422` for a project naming none. Refused locally: an unknown `granularity` (loopctl would answer daily), a date that is not real (loopctl would drop it and answer for all time), a bad page. |
314
+ | `model_mix` | orch | **Read the model-mix matrix** (`GET /api/v1/analytics/model-mix`): totals and verification outcomes per (model, phase), and mixed-model against single-model agents. Filters `project_id`, `agent_id`, `since`, `until`. Keyed as `cost_trends`. Refused locally: a non-UUID `agent_id`, a date that is not real. |
315
+ | `agent_model_profile` | orch | **Read one agent's model profile** (`GET /api/v1/analytics/agents/:id/model-profile`): models per phase, `model_count`, `is_model_blender`. Filters `project_id`, `since`, `until`. Keyed as `cost_trends`. `404` for another tenant's agent; a non-UUID `agent_id` or unreal date is refused locally. |
316
+
317
+ ### Webhook Tools (user key)
318
+
319
+ Every webhook action is `role: :user` with the hierarchy: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` for an agent or orchestrator key).
320
+
321
+ | Tool | Auth Key | Description |
322
+ |---|---|---|
323
+ | `webhook_create` | user | **Subscribe a URL to loopctl events** (`POST /api/v1/webhooks`): `url`, `events`, optional `project_id`. The signing secret loopctl returns once is written to `secret_file` (absolute, must not exist, created 0600 before the request) and never returned. `422` for an unknown event type, a malformed URL, a destination the egress guard refuses, or the tenant's webhook limit. Refused locally: a blank url, empty or non-string events, a bad `secret_file`. |
324
+ | `webhook_list` | user | **List webhook subscriptions** (`GET /api/v1/webhooks`), never with a secret; `page`/`page_size` (1..100). A bad page is refused locally (loopctl would clamp it). |
325
+ | `webhook_update` | user | **Edit a subscription** (`PATCH /api/v1/webhooks/:id`): `url`, `events`, `project_id`, `active` (true re-activates and resets failures). A url, project or re-activation change is re-vetted by the egress guard. `404` for another tenant's subscription, `422` as on create. Refused locally: a non-UUID id, no field (loopctl would answer 200 unchanged), a null `project_id` (it cannot be cleared), bad `events` or `active`. The `PUT` twin is served and unused. |
326
+ | `webhook_delete` | user | **Delete a subscription** (`DELETE /api/v1/webhooks/:id`) and its pending deliveries; `204`. `404` for another tenant's; a non-UUID id is refused locally. |
327
+ | `webhook_test` | user | **Send a test event** (`POST /api/v1/webhooks/:id/test`): one `webhook.test` delivery, even to an inactive subscription. `404` for another tenant's; a non-UUID id is refused locally. |
328
+ | `webhook_deliveries` | user | **List a subscription's recent delivery attempts** (`GET /api/v1/webhooks/:id/deliveries`): status, attempts, error (HTTP status and content-type, never the response body); `page`/`page_size` (1..100, default 25). `404` for another tenant's; a non-UUID id or bad page is refused locally. |
298
329
 
299
330
  ### Knowledge Wiki Tools (agent key)
300
331
 
@@ -445,6 +476,7 @@ nothing changes until a scope opts in.
445
476
  | `clear_local_only` | **WIDEN**: remove a scope's `local_only` marking. Requires your **user** key (`LOOPCTL_USER_KEY`) — deliberately not available to an agent or orchestrator, because clearing is the self-widening move an automated key must never make one call before a harvest. Audited with actor + scope. |
446
477
  | `declare_trusted_endpoint` | Declare a host you attest is YOUR OWN so a `local_only` scope can reach it. **This is an unverified tenant attestation, not network locality** — labelled as such everywhere. Three enforced constraints: PUBLIC addresses only (write time AND pin time), PURPOSE-SCOPED (`inference` / `webhook` / `ingest`), vendor hosts excluded. Carves nothing out of the SSRF denylist. Requires **user** key. |
447
478
  | `revoke_trusted_endpoint` | Revoke a declaration. Invalidation is IMMEDIATE and cluster-wide — a revoked declaration does not keep working for the remainder of the pin TTL. Requires **user** key. |
479
+ | `list_trusted_endpoints` | **List the tenant's declared trusted endpoints** (`GET /api/v1/egress/trusted-endpoints`) with their purposes and `locality_label`. Every entry is an unverified tenant attestation, not network locality. Any key (the route has no role plug), sent as the session's own. |
448
480
  | `egress_repin` | Recover from a `:pin_stale` error (your box got a new DHCP lease and the pinned address set changed — DISTINCT from `egress_blocked`). Re-resolves and re-pins the host. **Agent** key by design: requiring a human user-role write to recover would contradict loopctl's agent-native, no-UI design. |
449
481
  | `custody_claim` | The recorded **egress custody claim** for one article or memory row: the append-only sequence of per-operation postures (create, each embed, each re-embed, each classification, each merge) with the endpoints resolved for THAT operation and their verdicts, plus the aggregate. Rides the existing hash-chained audit log + signed tree heads — each entry carries a `chain_position` and the leaf's `chain_entry_hash`, so `GET /api/v1/audit/sth/{tenant_id}/inclusion/{position}` proves inclusion of *that* leaf, and the leaf's payload names this row by a recomputable `posture_digest`. THREE states, only one an attestation: `no_claim_recorded`, `claim_pending`, `claim_recorded` (`complete` / `partial_history` / `incomplete`). Completeness is measured against a persisted per-row high-water mark, so losing the tail of a sequence is a gap, not a clean claim. `third_party_egress_on_covered_paths` is `false` only for NETWORK-local endpoints; a tenant-declared (unverified) endpoint yields `"tenant_declared_unverified"`. Attests ONLY to the endpoints loopctl called on the paths in `coverage` — never to what those endpoints did afterwards. **Agent** key. |
450
482
  | `custody_failures` | Custody posture entries whose chain append was DROPPED after exhausting retries, plus `stale_pending` entries stranded by a flush that died outside its own final-attempt branch. Surfaced rather than silently absent: each `data` entry degrades its row's claim to `incomplete`, and a stranded entry would otherwise read as an in-flight claim forever. **Agent** key. |
@@ -489,6 +521,7 @@ Two modes, pinned at creation:
489
521
  |---|---|
490
522
  | `changes_since` | **Poll the change feed** (`GET /api/v1/changes`): the tenant's audit entries after a position, oldest first, with `has_more`, `next_cursor` and `next_since`. The first page needs `since` (ISO 8601); later pages take the previous `next_cursor` as `cursor` (drift-free; it wins over `since`). Optional `project_id` (id, slug or repo name), `entity_type`, `action`, `limit` (1..1000, default 1000). Any key, sent as the session's own; an agent-role key does not see entries for articles it cannot read. `400` without `since`/`cursor` (also refused locally), `400` for a bad `since` or a cursor not issued to this tenant, `422` for a `project_id` naming no project. States and metadata are untrusted session text. |
491
523
  | `audit_log` | **Search the tenant audit log** (`GET /api/v1/audit`), newest first, with `old_state` and `actor_id`: filters `entity_type`, `entity_id`, `action`, `actor_type`, `actor_id`, `project_id`, `from`, `to`; paged by `page` and `page_size` (1..100, default 20). User role: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` for an agent or orchestrator key). `422` for a `project_id` naming no project. Refused locally: a non-UUID `entity_id`/`actor_id`, and a `from`/`to` that is not an ISO 8601 date-time with seconds and an offset, because loopctl drops a bound it cannot parse and answers the wider window. |
524
+ | `audit_inclusion_proof` | **Prove an audit entry is in the signed log** (`GET /api/v1/audit/sth/:tenant_id/inclusion/:position`): the merkle path from the entry at `position` to the signed tree head covering it (`leaf_index`, `leaf_hash`, `tree_size`, `audit_path`, `sth`). Public, sent with no key. `400 invalid_tenant_id`, `404` for a position with no entry, `409 not_yet_included` (no STH covers it yet), `429` past the per-IP proof budget. A non-UUID `tenant_id` or a `position` that is not a non-negative integer is refused locally. |
492
525
 
493
526
  ### Discovery Tools
494
527
 
@@ -597,6 +630,11 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
597
630
  | `intake_pause` | **Pause one intake source of a project** (`POST /api/v1/projects/:id/intake/pause`, US-52.33, US-54.4): that source's new issues stay `pending_triage` and get no triage. Optional `source_id` names the source; without it the pause acts on the project's primary (unlabelled) source, so a sibling source (e2e) keeps running. Stops promotion and triage ONLY: never in-flight work and never the webhook, which keeps recording. `reason` required; `intervention_id` generated when absent (a repeat writes nothing). `404 no_intake_source` (a `source_id` that is not a live source of this project, or no primary source), `403` on an agent-rooted tenant. Session's own key. |
598
631
  | `intake_resume` | **Resume one intake source of a project** (`POST /api/v1/projects/:id/intake/resume`, US-52.33, US-54.4): the minute promotion run picks up what arrived while paused. Same `source_id` default (the primary source), scope, refusals and idempotency as `intake_pause`. |
599
632
  | `api_key_create` | **Mint an API key** (`POST /api/v1/api_keys`, US-54.14) on `LOOPCTL_USER_KEY`. The raw key is written to `key_file` (absolute, must not exist, mode 0600) and is never in the result, which carries id, prefix, role, name and `snapshot_project_id`. `snapshot_project_id` mints a snapshot-scoped orchestrator key that authenticates only `POST /api/v1/projects/<id>/snapshots/urls` (401 everywhere else, sockets included); `422 invalid_snapshot_scope` for another role, an `agent_id` or another tenant's project. `403 insufficient_role` below user, `403 api_key_mint_forbidden` for a dispatch-minted caller. |
633
+ | `api_key_list` | **List the tenant's API keys** (`GET /api/v1/api_keys`): id, name, prefix, role, last use, expiry, revocation and `snapshot_project_id`, never a raw key. Revoked keys only with `include_revoked: true`. User role: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user). |
634
+ | `api_key_rotate` | **Rotate an API key** (`POST /api/v1/api_keys/:id/rotate`): a replacement with the old key's name, role, agent and scope; the old key expires `grace_period_hours` later (default 24, at most 168 — above that loopctl would clamp silently, so it is refused locally). The new raw key goes to `key_file` exactly as `api_key_create`'s does, never into the result. User role on a key no dispatch minted: `403 insufficient_role` below user, `403 api_key_mint_forbidden` for a dispatch-minted caller. `404` for another tenant's key, `422` for a revoked key or a runner's key. |
635
+ | `register_agent` | **Register this key's agent** (`POST /api/v1/agents/register`): creates an agent `name` of `agent_type` (orchestrator or implementer), optional `metadata`, and links the CALLING key to it. Sent on the session's own key: `exact_role: :agent`, so an orchestrator, user or superadmin key is `403 insufficient_role`. `409` when the key already has an agent (a holder credential always does), `422` for a missing field, a taken name, or a name starting `system:`. |
636
+ | `list_agents` | **List the tenant's agents** (`GET /api/v1/agents`), filtered by `agent_type` and `status`, sorted by `sort_by`, paged by `page`/`page_size` (1..100). Orchestrator role or higher: `LOOPCTL_ORCH_KEY` verbatim, else `LOOPCTL_USER_KEY`, else the default key (`403 insufficient_role` for an agent key). An unknown filter or sort, or a bad page, is refused locally: loopctl drops it and would answer every agent. |
637
+ | `get_agent` | **Read one agent** (`GET /api/v1/agents/:id`). Orchestrator role or higher, keyed as `list_agents`. `404` for another tenant's agent; a non-UUID `agent_id` is refused locally. |
600
638
  | `snapshot_urls` | **Presigned URLs for build snapshot objects** (`POST /api/v1/projects/:id/snapshots/urls`, US-52.57): one URL per name, valid 900 s, for `<tenant_id>/<project_id>/<name>` in loopctl's snapshot bucket; a name is `index/<40 lowercase hex>.json` or `<64 lowercase hex>.tar.zst`, 1 to 64 per call. `op: "get"` on the session's agent key; `op: "put"` on `LOOPCTL_ORCH_KEY` (an agent key is `403 insufficient_role`), each PUT URL signing `if-none-match: *` so a published object is never overwritten, and audited. `422 invalid_snapshot_object` / `invalid_snapshot_op`, `404` for another tenant's project, `403 custody_tier_required` on an agent-rooted tenant, `503 snapshot_store_unconfigured`. |
601
639
  | `work_item_requeue` | **Requeue a work item** (`POST /api/v1/stories/:id/requeue`, US-52.32): an escalated item goes back to `queued` over this holder's resolution edge (`409 self_resolve_blocked` / `review_missing_unreviewed` as for `resolve_escalation`); an in-flight item is released, uncounted, its dispatch revoked, and re-contracted. Any other stage is `409 not_requeueable`. The linked issue is not touched. |
602
640
  | `work_item_retriage` | **Re-triage a work item** (`POST /api/v1/stories/:id/retriage`, US-52.32): an item no implementer touched, at `escalated` or `queued`, goes back to `detected`; its triage is discarded and its triage dispatches superseded. `409 not_retriageable` names what a touched item holds, or the stage. The linked issue is not touched. |
@@ -619,6 +657,8 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
619
657
  | `enroll_authenticator` | Step 2 of the WebAuthn trust-tier upgrade ceremony: completes enrollment with the attestation produced by `navigator.credentials.create()` against the challenge from `request_authenticator_challenge`. On a tenant's first enrollment the tenant is promoted to `human_anchored`. |
620
658
  | `request_authenticator_revoke_challenge` | Issues a fresh-assertion challenge to authorize revoking one of a tenant's enrolled WebAuthn authenticators. Requires an interactive WebAuthn client + human touch to produce the assertion `revoke_authenticator` needs. |
621
659
  | `revoke_authenticator` | Revokes an enrolled authenticator using the assertion from `request_authenticator_revoke_challenge` (`navigator.credentials.get()` against an existing authenticator — human touch required). Refuses (409 `last_authenticator`) when it would leave a human-anchored tenant with no authenticators. |
660
+ | `list_authenticators` | **List the tenant's enrolled authenticators** (`GET /api/v1/tenants/:id/authenticators`): `id`, `friendly_name`, `credential_fingerprint`, format and timestamps, never credential material. Confirm a revoke against the fingerprint: any user key can rewrite a label. No assertion needed. User key of THIS tenant: `LOOPCTL_USER_KEY` verbatim when set, else the default key (`403 insufficient_role` below user, `403` for another tenant's id). A non-UUID `tenant_id` is refused locally; an upper-case one is sent lower case. |
661
+ | `rename_authenticator` | **Relabel an authenticator** (`PATCH /api/v1/tenants/:id/authenticators/:auth_id`): only `friendly_name` (trimmed, not blank, at most 120 bytes); audited; no assertion needed. Keyed as `list_authenticators`. `400` without a string label, `404` for an unknown authenticator, `422 friendly_name_blank` / `friendly_name_invalid` / `friendly_name_too_long`, `429` past 300 renames an hour, `500` when the rename or its audit entry failed. Non-UUID ids and a blank or over-long label are refused locally. |
622
662
 
623
663
  ## Wiki Attribution
624
664