loopctl-mcp-server 3.47.0 → 3.49.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
@@ -572,6 +572,7 @@ Two modes, pinned at creation:
572
572
  | Tool | Description |
573
573
  |---|---|
574
574
  | `list_routes` | List all available API routes on the loopctl server. |
575
+ | `api_index` | The server's welcome document (`GET /api/v1`): its name, the app `version` the running release was built as, and the paths of its other entry points (OpenAPI docs, Swagger UI, health, `/.well-known/loopctl`, the route list, the wiki). Public, sent with no key, so it answers when a key is missing or no longer authenticates. No arguments, refuses nothing. |
575
576
  | `mcp_version` | **Which version of this MCP server you are running, and which one loopctl ships.** Returns `running`, `expected`, a `status` of `current` / `behind` / `ahead` / `unknown`, and the remedy. Takes no API key: it reads loopctl's unauthenticated discovery document (`GET /.well-known/loopctl`), so it answers in a session where nothing else does. MCP binds its tool list at session start, so from inside a session "this tool does not exist" and "this tool exists and my process is older than it" look identical — this is the discriminator. At `current`, a tool you cannot see genuinely is not in this version. At `behind`, the remedy is `/mcp` or a session restart, **never a retry**: the tool list is fixed for the life of the process. `expected` is the version in the tree the deployment you are pointed at was built from, not a registry lookup — so `behind` can briefly precede the npm publish, and `ahead` is normal when running this package from a checkout. If this tool is itself missing from your surface, that is the answer: your process predates 2.99.0. |
576
577
  | `get_system_articles` | List or fetch system-scoped (global, cross-tenant) wiki articles. Public — no auth required. Optional: `slug` (fetch one), `category`. |
577
578
 
@@ -665,6 +666,7 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
665
666
  | `work_item_move` | **Move a work item** to a host, a holder, the cloud or the loop (`POST /api/v1/stories/:id/move`, US-52.43), on this session's own key; the server picks the path from who calls. The holder (live lease) names its own `checkpoint_id` at the current epoch and the claim is released at once over the uncounted `:moved` edge: `200 released`. Anyone else REQUESTS it: the holder is told on the item's thread and has `MOVE_RELEASE_SECONDS` to answer with the same `move_id`, after which the deadline worker releases it: `202 requested`. An unheld item is released at once: `200`. While reserved only the target claims it (`409 reserved_for_move`); a move to a host, holder or the cloud unpulled after `MOVE_PULL_SECONDS` expires to the loop, and a move to the loop never expires: implement@1 places it with the move's checkpoint as `resume`, on a runner of contract 1.40.0 or later (US-52.46). An item an interactive session released is reserved for any interactive session until someone moves it on. A move to a host whose runner joined on contract 1.40.0 or later is placed there and resumes from the move's checkpoint (US-52.44); a runner session holding the item is asked over its runner's socket. The same `move_id` and target answers the first result. `400 move_id_required`/`reason_required`/`invalid_reason`, `404` (incl. `unknown_story_stage`), `409 holder_ended`/`item_closed`/`item_escalated`/`move_pending`/`item_changed`, `422 invalid_target`/`unknown_host`/`unknown_holder`/`holder_cannot_pull` (a runner_session holder claims nothing after its own placement: move to its host)/`target_unavailable`/`already_held_by_target`/`checkpoint_not_current`, `403 boundary_move_needs_mark` only when ANOTHER session holds the item on a live lease, the move crosses the interactive boundary (that holder or the target holder is an interactive session), and the caller is not Mark's own user key (fleet_dash; US-52.45): a holder moves its own item anywhere, the loop included, and an item nobody is working is anyone's to move on; a key with no holder omits `checkpoint_id`; and `403` without the human anchor. |
666
667
  | `work_item_pull` | **Pull a work item into a git worktree here**, then claim it (US-52.46). Reads the item's newest unfenced checkpoint and its unresolved fenced ones, fetches the checkpoint's branch and `head_sha` from origin, adds a worktree on that branch at `head_sha` (default `.claude/worktrees/<branch with / replaced by ->` under the repository's top level), checks then applies the diff with `git apply --binary`, and only then claims the item (`POST /api/v1/stories/:id/claim`) on this session's own key. git runs through `execFile`. Returns `path`, `branch`, `head_sha`, `checkpoint_id`, `applied_files`, `fenced_checkpoint_ids` and the claim. Refuses `path_not_empty` before any git write, `no_checkpoint`, `head_not_found`, `local_branch_differs` (a local branch of that name is never moved), `diff_does_not_apply` naming the rejected files (worktree removed, nothing claimed), `diff_apply_failed` when the check passed but writing the diff failed (worktree and any branch it created removed, nothing claimed), `worktree_add_failed`, and returns the claim's own refusal (`409 reserved_for_move`, `held_by_other_holder`) with the worktree removed. |
667
668
  | `work_item_timeline` | **Read a work item's timeline** (`GET /api/v1/stories/:id/timeline`): `item` (stage and its age, holder, lease, issue, PR, runner, newest 20 CI runs, newest 20 runner dispatches (`dispatch_id`, `kind`, `runner_id`, `status`), thread count and newest 20 messages, and `triage_escalation`: null when triage never escalated the item, else its newest triage escalation at any stage: `verdict`, `escalation_reasons` and `missing_information` (`untrusted: true`, fenced in `fenced`), `escalated_at`, and `current`, true while the item is still escalated in it) and one page of `events`, the event log and audit log merged oldest first. Optional `cursor` (a page's `next_cursor`) and `limit` (default 100, max 500). Read-only on any key; never moves a thread cursor. Every reason and message body is untrusted session text, flagged `untrusted: true`. `404` for another tenant's story, `400` for a bad limit or cursor. |
669
+ | `holder_list` | **List the holders and what each holds** (`GET /api/v1/holders`, #1297): the tenant's live session holders, newest `last_seen_at` first, each with `id`, `agent_id`, `kind`, `host`, `session_id`, `worktree`, `registered_at`, `last_heartbeat_at`, `lease_expires_at`, `ended_at`, `ended_reason` and `items` (the work items it holds now: `story_id`, `number`, `project_id`, `title`, `stage`, `branch`, `pr_number`). Join a live session to its holder on `session_id`. A holder whose lease ran out but the sweep has not ended yet is still listed. Optional `include_ended: true` adds the holders that ended in the last day. At most 200 holders; `truncated: true` says there were more. Read-only on any key: no heartbeat, no lease move, never a credential. |
668
670
  | `decisions` | **Read the decided-on-default notes** (`GET /api/v1/decisions`): live messages whose `idempotency_key` starts `decision-default:`, on a repo channel or a work item thread (never a DM), newest first, without expired, quarantined or superseded ones. Each row carries `idempotency_key`, `project_id`, `story_id`, `host`, a bounded `body_preview` and `untrusted: true`; `has_more` says the limit cut the list. Optional `since` (ISO 8601, default 48 hours ago) and `limit` (1..100, default 25). Read-only on any key. `400` for a bad `since` or `limit`. |
669
671
  | `factory_overview` | **Read the factory overview** (`GET /api/v1/factory/overview`): per project and summed for the fleet, `in_flight` counts per stage (claimed through verified), `waiting` counts (detected, triaged, queued, and escalated per reason class) with the oldest item's age, `throughput` over the window (done count, median seconds opened to done) and `failure_classes` (moves into escalated or failed, by edge). Counts come from the stage machine; drill into an item with `work_item_timeline`. Optional `project_id` and `window_days` (default 7, 1..30). Read-only on any key. `400` for a bad window, `404` for another tenant's project, `503` when the read times out. |
670
672
  | `factory_policy` | **Read the factory policy** (`GET /api/v1/factory/policy`, US-52.51): every delivery-loop rule value, compiled into loopctl from `factory/policy.toml` — review-round `normal` and `ceiling` per diff kind (`prose`, `code`), `open_prs_per_session`, `epics_open_per_repo`, `pr_body.required_sections`, `review.default_level` and `review.max_level`, `epic_merge.new_tip_seconds`, `protected_branches`. Returns `{schema, version, rules}`; `version` is the file's sha256 (the endpoint's ETag, so a client that kept a copy gets `304` on `If-None-Match`). The same for every tenant. Any tenant key; refuses nothing else (`401` only without a valid key). No arguments. |
package/index.js CHANGED
@@ -70,6 +70,7 @@ import {
70
70
  pauseIntake,
71
71
  readDecisions,
72
72
  readFactoryOverview,
73
+ readHolders,
73
74
  resumeIntake,
74
75
  } from "./lib/factory.js";
75
76
  import { readFactoryPolicy } from "./lib/factory-policy.js";
@@ -161,6 +162,7 @@ import {
161
162
  } from "./lib/ui-tests.js";
162
163
  import { projectExport } from "./lib/project-export.js";
163
164
  import { corpusGet } from "./lib/corpus-get.js";
165
+ import { apiIndex } from "./lib/api-index.js";
164
166
  import {
165
167
  knowledgeExport as downloadKnowledgeExport,
166
168
  knowledgePipeline,
@@ -3543,6 +3545,11 @@ async function listRoutes() {
3543
3545
  return toContent(result);
3544
3546
  }
3545
3547
 
3548
+ // #872: the public welcome document, read with no key (lib/api-index.js).
3549
+ async function apiIndexTool(args) {
3550
+ return toContent(await apiIndex(args, { publicApiCall }));
3551
+ }
3552
+
3546
3553
  // US-26.2.3: Dispatch lineage tool. LCP-1 §9.2: optionally enroll an agent key
3547
3554
  // (agent_pubkey + alg) with an owner/parent attestation over it.
3548
3555
  async function createDispatch({
@@ -3765,6 +3772,15 @@ async function decisionsTool(args) {
3765
3772
  );
3766
3773
  }
3767
3774
 
3775
+ // #1297: the holder list, read on the session's own key (any key reads it).
3776
+ async function holderListTool(args) {
3777
+ return toContent(
3778
+ await readHolders(args, {
3779
+ apiCall: (method, path, body) => apiCall(method, path, body, agentKey()),
3780
+ }),
3781
+ );
3782
+ }
3783
+
3768
3784
  // US-52.51: the factory policy, read on the session's own key (any key reads it).
3769
3785
  async function factoryPolicyTool(args) {
3770
3786
  return toContent(
@@ -9441,6 +9457,18 @@ const TOOLS = [
9441
9457
  required: [],
9442
9458
  },
9443
9459
  },
9460
+ {
9461
+ name: "api_index",
9462
+ description:
9463
+ "READ THE SERVER'S WELCOME DOCUMENT (GET /api/v1, loopctl #872): its name, the app " +
9464
+ "version the running release was built as, and the paths of its other entry points " +
9465
+ "(OpenAPI docs, Swagger UI, health, the /.well-known/loopctl discovery document, the " +
9466
+ "route list, the wiki) plus this MCP server's npm package. Public: sent with NO key, so " +
9467
+ "it answers when a key is missing or no longer authenticates. Takes no arguments and " +
9468
+ "refuses nothing; an error is the network's or the server's. For the full route table " +
9469
+ "use list_routes; for whether this MCP package is older than the deployment, mcp_version.",
9470
+ inputSchema: { type: "object", properties: {}, required: [] },
9471
+ },
9444
9472
  {
9445
9473
  name: "mcp_version",
9446
9474
  description:
@@ -11714,6 +11742,29 @@ const TOOLS = [
11714
11742
  },
11715
11743
  },
11716
11744
 
11745
+ {
11746
+ name: "holder_list",
11747
+ description:
11748
+ "LIST THE HOLDERS AND WHAT EACH HOLDS (GET /api/v1/holders): the tenant's live session " +
11749
+ "holders, newest last_seen_at first, each with id, agent_id, kind (interactive, " +
11750
+ "runner_session, cloud), host, session_id, worktree, registered_at, last_heartbeat_at, " +
11751
+ "lease_expires_at, ended_at, ended_reason, and items: the work items it holds now " +
11752
+ "(story_id, number, project_id, title, stage, branch, pr_number). Join a live Claude " +
11753
+ "session to its holder on session_id. A holder whose lease ran out but the sweep has not " +
11754
+ "ended yet is still listed. Optional include_ended: true adds the holders that ended in " +
11755
+ "the last day. At most 200 holders; truncated: true says there were more. READ-ONLY on " +
11756
+ "any key: it sends no heartbeat and moves no lease. Never returns a credential.",
11757
+ inputSchema: {
11758
+ type: "object",
11759
+ properties: {
11760
+ include_ended: {
11761
+ type: "boolean",
11762
+ description: "Optional: also the holders that ended in the last day (default false).",
11763
+ },
11764
+ },
11765
+ },
11766
+ },
11767
+
11717
11768
  {
11718
11769
  name: "factory_policy",
11719
11770
  description:
@@ -14853,6 +14904,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
14853
14904
  case "list_routes":
14854
14905
  return await listRoutes();
14855
14906
 
14907
+ case "api_index":
14908
+ return await apiIndexTool(args);
14909
+
14856
14910
  case "mcp_version":
14857
14911
  return await mcpVersion(args);
14858
14912
 
@@ -15039,6 +15093,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
15039
15093
  return await factoryOverviewTool(args);
15040
15094
  case "decisions":
15041
15095
  return await decisionsTool(args);
15096
+ case "holder_list":
15097
+ return await holderListTool(args);
15042
15098
  case "factory_policy":
15043
15099
  return await factoryPolicyTool(args);
15044
15100
  case "review_round_open":
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `api_index` — `GET /api/v1` (`WelcomeController.index`), loopctl #872.
3
+ *
4
+ * KEY: none. The route is public, so the request goes out through `publicApiCall`, which sends no
5
+ * Authorization header; a session with no key, or a key that no longer authenticates, still reads
6
+ * it. That is the point of reaching it: it answers "is this the loopctl I think it is, and which
7
+ * release is it running" when nothing else will.
8
+ *
9
+ * The answer is the server's `name`, its running app `version`, and the paths of its other entry
10
+ * points (`docs`, `swagger_ui`, `health`, `discovery`, `routes`, `wiki`) plus the npm package of this
11
+ * MCP server. It takes no arguments and refuses nothing; a failure is the transport's.
12
+ */
13
+
14
+ export async function apiIndex(_args = {}, { publicApiCall } = {}) {
15
+ return publicApiCall("GET", "/api/v1");
16
+ }
package/lib/factory.js CHANGED
@@ -70,6 +70,24 @@ export async function readDecisions({ since, limit } = {}, { apiCall } = {}) {
70
70
  return apiCall("GET", decisionsPath() + (qs ? `?${qs}` : ""), null);
71
71
  }
72
72
 
73
+ /**
74
+ * `holder_list` (loopctl #1297): `GET /api/v1/holders`, the tenant's live holders, each with the
75
+ * work items it holds now. `include_ended` (a boolean) adds the holders that ended in the last
76
+ * day. Read-only on the server: it writes no heartbeat and moves no lease.
77
+ */
78
+ export function holdersPath() {
79
+ return `/api/v1/holders`;
80
+ }
81
+
82
+ export async function readHolders({ include_ended } = {}, { apiCall } = {}) {
83
+ if (include_ended !== undefined && include_ended !== null && typeof include_ended !== "boolean") {
84
+ return refuse("`include_ended` must be a boolean.");
85
+ }
86
+
87
+ const qs = include_ended === true ? "?include_ended=true" : "";
88
+ return apiCall("GET", holdersPath() + qs, null);
89
+ }
90
+
73
91
  /**
74
92
  * `intake_pause` / `intake_resume` (loopctl US-52.33): `POST /api/v1/projects/:id/intake/pause`
75
93
  * and `/resume` on ONE intake source of the project: the one `source_id` names (US-54.4), else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopctl-mcp-server",
3
- "version": "3.47.0",
3
+ "version": "3.49.0",
4
4
  "description": "MCP server for loopctl — structural trust for AI development loops",
5
5
  "type": "module",
6
6
  "main": "index.js",