loopctl-mcp-server 3.60.0 → 3.61.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
@@ -676,6 +676,7 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
676
676
  | `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. |
677
677
  | `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`. |
678
678
  | `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), `reserved` (queue items a released move reserves for one host, holder or the cloud, with the oldest age and `by_kind`, not counted again under `waiting`; a released move to the loop stays under `waiting`) and `interactive` (`in_flight` items an interactive holder holds, a subset of `in_flight`, and `waiting` items reserved for an interactive session after a lapsed claim, with the oldest age), and `detected_blocked` (the `waiting.detected` items split by why each is still there, under the first reason that holds: `no_intake_record`, `issue_closed`, `no_triage_source`, `intake_paused`, `ticket_required`, `triaging` (a triage dispatch is in flight), `no_runner_for_repo` (no live connected runner takes triage for the repository without a config refusal), `runners_busy`, `triage_due`; each a count and oldest age, summing to `waiting.detected.count`). 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. |
679
+ | `work_item_list` | **List the waiting work items** (`GET /api/v1/work_items`, #1359): every item at detected, triaged or queued, one row each, oldest first by when it entered its stage, keyset paged (`cursor` is a page's `meta.next_cursor`). Each row: `story_id`, `project_id`, `project_slug`, `number`, `title`, `stage`, `entered_stage_at`, `age_seconds`, `source` (the intake issue's `kind`, `number`, `url`, `state`, or null), `reserved_for` (a released move's `kind`, `target`, `move_id`, `released_at`, or null) and `blocked` (null or `{code, text}`). Codes: `reserved`; at detected the reasons `factory_overview`'s `detected_blocked` counts; at queued `issue_closed`, `no_source`, `status_not_pending`, `dependencies_unmet`, `interactive_item`, `no_runner_for_repo`, `runners_busy`, `dispatch_due`; a triaged item is null. `meta`: `total`, `next_cursor`, `limit`, `dispatch` (`triage` and `implement`, each `ok`, `dispatch_off` or `budget_unset`). Act on a row with `work_item_move`, `work_item_requeue`, `work_item_retriage`, `work_item_cancel`, `work_item_close` or `resolve_escalation`. Optional `stage` (a list, default all three), `project_id`, `cursor`, `limit` (default 50, 1..200). Read-only on any key. `400` for a bad stage, limit or cursor, `404` for another tenant's project, `503` when the read times out. |
679
680
  | `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. |
680
681
  | `review_round_open` | **Open a review round** (`POST /api/v1/review_rounds`, US-52.53): counts one round on the work item for `repo_url` and `branch` and answers from the factory policy's `review_rounds.<diff_kind>` limits — `201 {round_id, round, normal, ceiling, verdict, message, attested}`, `verdict` `allow` while round <= normal and `warn` up to the ceiling. A repeated `round_id` counts nothing and answers `200` with the first answer. `attested: true` with a `reason` counts a review the hook could not see. `kind: "security"` with a `head_sha` records a /security-review at that head instead (`201 {round_id, kind, head_sha, message, attested}`), never counted against the ceiling. `ancestor_shas` (the branch's commits outside the base, at most 500) refuses a round whose branch carries another unmerged item's ceiling-round head (claude-config#810). Holder credential (the round's actor is its holder). `409 review_ceiling_reached` (nothing counted; the session decides a redesign or a narrower merge), `409 inherited_ceiling_reached` (`parent_branch`, `head_sha`, `round_count`, `ceiling`), `422 attestation_reason_required`, `422 head_sha_required`, `404 work_item_not_found` (no item, or only ended items your holder never held: open one with `work_item_open`), `403 holder_credential_required`, `400 repo_and_branch_required`, `409 ambiguous_project`, `422 invalid_round_id`/`invalid_kind`/`invalid_diff_kind`/`invalid_head_sha`/`invalid_ancestor_shas`/`invalid_branch`, `503 busy`. |
681
682
  | `review_round_void` | **Void a review round** that did not review (`POST /api/v1/review_rounds/:round_id/void`, US-52.53): it stops counting on its item. `201 {round_id, voided, round, count}`; a second void is `200`. Holder credential. `404 review_round_not_found`, `409 ambiguous_round_id`, `403 holder_credential_required`, `422 invalid_reason`, `503 busy`. |
package/index.js CHANGED
@@ -81,6 +81,7 @@ import {
81
81
  readDecisions,
82
82
  readFactoryOverview,
83
83
  readHolders,
84
+ readWorkItemList,
84
85
  resumeIntake,
85
86
  } from "./lib/factory.js";
86
87
  import { readFactoryPolicy } from "./lib/factory-policy.js";
@@ -3786,6 +3787,15 @@ async function factoryOverviewTool(args) {
3786
3787
  );
3787
3788
  }
3788
3789
 
3790
+ // #1359: the waiting work items one row each, read on the session's own key (any key reads it).
3791
+ async function workItemListTool(args) {
3792
+ return toContent(
3793
+ await readWorkItemList(args, {
3794
+ apiCall: (method, path, body) => apiCall(method, path, body, agentKey()),
3795
+ }),
3796
+ );
3797
+ }
3798
+
3789
3799
  // The decided-on-default notes, read on the session's own key (any key reads them).
3790
3800
  async function decisionsTool(args) {
3791
3801
  return toContent(
@@ -11915,6 +11925,45 @@ const TOOLS = [
11915
11925
  },
11916
11926
  },
11917
11927
 
11928
+ {
11929
+ name: "work_item_list",
11930
+ description:
11931
+ "LIST THE WAITING WORK ITEMS (GET /api/v1/work_items, loopctl #1359): every item at " +
11932
+ "detected, triaged or queued, one row each, oldest first by when it entered its stage, " +
11933
+ "keyset paged. factory_overview counts them; this names them. Each row: `story_id`, " +
11934
+ "`project_id`, `project_slug`, `number`, `title`, `stage`, `entered_stage_at`, " +
11935
+ "`age_seconds`, `source` (the intake issue: `kind`, `number`, `url`, `state`; null for " +
11936
+ "an authored story), `reserved_for` (a released move's `kind`, `target`, `move_id`, " +
11937
+ "`released_at`; null when no move reserves it) and `blocked` (null, or `{code, text}`, " +
11938
+ "the one reason it is still waiting). Codes: `reserved` (only the move's target claims " +
11939
+ "it); at detected the same reasons factory_overview's `detected_blocked` counts " +
11940
+ "(`no_intake_record`, `issue_closed`, `no_triage_source`, `intake_paused`, " +
11941
+ "`ticket_required`, `triaging`, `no_runner_for_repo`, `runners_busy`, `triage_due`); " +
11942
+ "at queued the implement pass's (`issue_closed`, `no_source`, `status_not_pending`, " +
11943
+ "`dependencies_unmet`, `interactive_item`, `no_runner_for_repo`, `runners_busy`, " +
11944
+ "`dispatch_due`). A triaged item is null: triage's verdict moves it on. `meta`: " +
11945
+ "`total`, `next_cursor` (null on the last page), `limit`, `dispatch` (`triage` and " +
11946
+ "`implement`, each `ok`, `dispatch_off` or `budget_unset`: a pass that is off holds " +
11947
+ "every item of its stage whatever the row says). Act on a row with work_item_move, " +
11948
+ "work_item_requeue, work_item_retriage, work_item_cancel, work_item_close or " +
11949
+ "resolve_escalation; drill into one with work_item_timeline. READ-ONLY on any key. 400 " +
11950
+ "for an unknown stage, a limit outside 1..200 or a cursor this read did not produce; " +
11951
+ "404 for a project that is not this tenant's; 503 when the read outruns its timeout.",
11952
+ inputSchema: {
11953
+ type: "object",
11954
+ properties: {
11955
+ stage: {
11956
+ type: "array",
11957
+ items: { type: "string", enum: ["detected", "triaged", "queued"] },
11958
+ description: "Optional: the stages to list (default all three).",
11959
+ },
11960
+ project_id: { type: "string", description: "Optional: one project's UUID." },
11961
+ cursor: { type: "string", description: "Optional: a page's meta.next_cursor, verbatim." },
11962
+ limit: { type: "integer", description: "Optional: rows per page (default 50, 1..200)." },
11963
+ },
11964
+ },
11965
+ },
11966
+
11918
11967
  {
11919
11968
  name: "decisions",
11920
11969
  description:
@@ -13230,7 +13279,10 @@ const TOOLS = [
13230
13279
  "`chg`/`gate`, counts per verdict), `fallbacks` (checks that ran mode all, the rate, " +
13231
13280
  "the top reasons), `selection` (stats, plus misses: a chg check that passed on a " +
13232
13281
  "commit whose gate failed), `phase_times` (hydrate, static, affected, tests, " +
13233
- "lock_wait: rows, mean and max ms), `flaky`, `runner_samples`, `review_outcomes` " +
13282
+ "lock_wait: rows, mean and max ms, shadow and gate-mode checks together), " +
13283
+ "`gate_checks` (gate-mode checks split into `at_build` and `live_tree`, each with " +
13284
+ "its median push wait in ms; a check by a chg that does not record hydrate_ms on " +
13285
+ "gate rows counts as live_tree), `flaky`, `runner_samples`, `review_outcomes` " +
13234
13286
  "(merged PRs' findings by severity and disposition, and how many merged without a " +
13235
13287
  "counted review round), `attention` (changes flagged gap or stale). Lists are capped " +
13236
13288
  "at 50 rows. A panel whose read was shed under load is the string `unavailable`; " +
@@ -15468,6 +15520,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
15468
15520
  return await agentModelProfileTool(args);
15469
15521
  case "factory_overview":
15470
15522
  return await factoryOverviewTool(args);
15523
+ case "work_item_list":
15524
+ return await workItemListTool(args);
15471
15525
  case "decisions":
15472
15526
  return await decisionsTool(args);
15473
15527
  case "holder_list":
package/lib/factory.js CHANGED
@@ -40,6 +40,60 @@ export async function readFactoryOverview({ project_id, window_days } = {}, { ap
40
40
  return apiCall("GET", overviewPath() + (qs ? `?${qs}` : ""), null);
41
41
  }
42
42
 
43
+ /**
44
+ * `work_item_list` (loopctl #1359): `GET /api/v1/work_items`, the waiting work items one row
45
+ * each (detected, triaged, queued), oldest first, each with `blocked` (why it is still
46
+ * waiting) and `reserved_for`. `stage` (an array of those stage names), `limit` (1..200) and
47
+ * `project_id` are checked here for shape; `cursor` is a page's `meta.next_cursor`, passed
48
+ * through for the server to judge.
49
+ */
50
+ export const WAITING_STAGES = ["detected", "triaged", "queued"];
51
+
52
+ export function workItemListPath() {
53
+ return `/api/v1/work_items`;
54
+ }
55
+
56
+ export async function readWorkItemList(
57
+ { stage, project_id, cursor, limit } = {},
58
+ { apiCall } = {},
59
+ ) {
60
+ if (stage !== undefined && stage !== null) {
61
+ if (
62
+ !Array.isArray(stage) ||
63
+ stage.length === 0 ||
64
+ !stage.every((s) => WAITING_STAGES.includes(s))
65
+ ) {
66
+ return refuse(`\`stage\` must be a non-empty list of: ${WAITING_STAGES.join(", ")}.`);
67
+ }
68
+ }
69
+
70
+ if (project_id !== undefined && project_id !== null) {
71
+ const bad = uuid(project_id, "project_id");
72
+ if (bad) return bad;
73
+ }
74
+
75
+ if (
76
+ limit !== undefined &&
77
+ limit !== null &&
78
+ !(Number.isInteger(limit) && limit >= 1 && limit <= 200)
79
+ ) {
80
+ return refuse("`limit` must be an integer from 1 to 200.");
81
+ }
82
+
83
+ if (cursor !== undefined && cursor !== null && typeof cursor !== "string") {
84
+ return refuse("`cursor` must be a page's `meta.next_cursor`, verbatim.");
85
+ }
86
+
87
+ const query = new URLSearchParams();
88
+ if (Array.isArray(stage)) query.set("stage", [...new Set(stage)].join(","));
89
+ if (typeof project_id === "string") query.set("project_id", project_id);
90
+ if (typeof cursor === "string" && cursor !== "") query.set("cursor", cursor);
91
+ if (Number.isInteger(limit)) query.set("limit", String(limit));
92
+
93
+ const qs = query.toString();
94
+ return apiCall("GET", workItemListPath() + (qs ? `?${qs}` : ""), null);
95
+ }
96
+
43
97
  /**
44
98
  * `decisions`: `GET /api/v1/decisions`, the tenant's decided-on-default notes (messages whose
45
99
  * idempotency_key starts `decision-default:`) on channels and work item threads, newest first.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopctl-mcp-server",
3
- "version": "3.60.0",
3
+ "version": "3.61.0",
4
4
  "description": "MCP server for loopctl — structural trust for AI development loops",
5
5
  "type": "module",
6
6
  "main": "index.js",