loopctl-mcp-server 3.34.0 → 3.35.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
@@ -580,6 +580,7 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
580
580
  | `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 Mark moves it. 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` when the item's holder (or, unheld, its last mover or claimer) or the target holder is an interactive session and the caller is not Mark's own user key (fleet_dash; US-52.45), except the holder answering a move Mark requested with his `move_id`, his target and its own `checkpoint_id`; a key with no holder omits `checkpoint_id`; and `403` without the human anchor. |
581
581
  | `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. |
582
582
  | `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 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. |
583
+ | `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`. |
583
584
  | `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. |
584
585
  | `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. |
585
586
  | `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` (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`. |
package/index.js CHANGED
@@ -30,7 +30,12 @@ import { listWorkItemNotes, readWorkItemTimeline, writeWorkItemNote } from "./li
30
30
  import { readCheckpoints, recordCheckpoint, resolveCheckpoint } from "./lib/checkpoints.js";
31
31
  import { moveWorkItem } from "./lib/work-item-move.js";
32
32
  import { pullWorkItem } from "./lib/work-item-pull.js";
33
- import { pauseIntake, readFactoryOverview, resumeIntake } from "./lib/factory.js";
33
+ import {
34
+ pauseIntake,
35
+ readDecisions,
36
+ readFactoryOverview,
37
+ resumeIntake,
38
+ } from "./lib/factory.js";
34
39
  import { readFactoryPolicy } from "./lib/factory-policy.js";
35
40
  import {
36
41
  openReviewRound,
@@ -3196,6 +3201,15 @@ async function factoryOverviewTool(args) {
3196
3201
  );
3197
3202
  }
3198
3203
 
3204
+ // The decided-on-default notes, read on the session's own key (any key reads them).
3205
+ async function decisionsTool(args) {
3206
+ return toContent(
3207
+ await readDecisions(args, {
3208
+ apiCall: (method, path, body) => apiCall(method, path, body, agentKey()),
3209
+ }),
3210
+ );
3211
+ }
3212
+
3199
3213
  // US-52.51: the factory policy, read on the session's own key (any key reads it).
3200
3214
  async function factoryPolicyTool(args) {
3201
3215
  return toContent(
@@ -8994,6 +9008,29 @@ const TOOLS = [
8994
9008
  },
8995
9009
  },
8996
9010
 
9011
+ {
9012
+ name: "decisions",
9013
+ description:
9014
+ "READ THE DECIDED-ON-DEFAULT NOTES (GET /api/v1/decisions): live messages whose " +
9015
+ "idempotency_key starts `decision-default:` (sent with message_send to name a default " +
9016
+ "the owner may overrule), on a repo channel or a work item thread, never a DM, newest " +
9017
+ "first. Expired, quarantined and superseded messages are left out. Each row: id, " +
9018
+ "idempotency_key, project_id, story_id (null on a channel), agent_id, session_id, host, " +
9019
+ "a bounded body_preview with truncated, inserted_at, untrusted: true. `has_more` says " +
9020
+ "the limit cut the list. Optional `since` (ISO 8601 instant, default 48 hours ago) and " +
9021
+ "`limit` (1..100, default 25). READ-ONLY on any key. 400 for a bad since or limit.",
9022
+ inputSchema: {
9023
+ type: "object",
9024
+ properties: {
9025
+ since: {
9026
+ type: "string",
9027
+ description: "Optional: ISO 8601 instant; only messages posted after it.",
9028
+ },
9029
+ limit: { type: "integer", description: "Optional: rows, 1..100 (default 25)." },
9030
+ },
9031
+ },
9032
+ },
9033
+
8997
9034
  {
8998
9035
  name: "factory_policy",
8999
9036
  description:
@@ -11946,6 +11983,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
11946
11983
  return await workItemTimelineTool(args);
11947
11984
  case "factory_overview":
11948
11985
  return await factoryOverviewTool(args);
11986
+ case "decisions":
11987
+ return await decisionsTool(args);
11949
11988
  case "factory_policy":
11950
11989
  return await factoryPolicyTool(args);
11951
11990
  case "review_round_open":
package/lib/factory.js CHANGED
@@ -40,6 +40,36 @@ export async function readFactoryOverview({ project_id, window_days } = {}, { ap
40
40
  return apiCall("GET", overviewPath() + (qs ? `?${qs}` : ""), null);
41
41
  }
42
42
 
43
+ /**
44
+ * `decisions`: `GET /api/v1/decisions`, the tenant's decided-on-default notes (messages whose
45
+ * idempotency_key starts `decision-default:`) on channels and work item threads, newest first.
46
+ * `limit` (1..100) is checked here for shape; `since` is passed through for the server to parse.
47
+ */
48
+ export function decisionsPath() {
49
+ return `/api/v1/decisions`;
50
+ }
51
+
52
+ export async function readDecisions({ since, limit } = {}, { apiCall } = {}) {
53
+ if (
54
+ limit !== undefined &&
55
+ limit !== null &&
56
+ !(Number.isInteger(limit) && limit >= 1 && limit <= 100)
57
+ ) {
58
+ return refuse("`limit` must be an integer from 1 to 100.");
59
+ }
60
+
61
+ if (since !== undefined && since !== null && typeof since !== "string") {
62
+ return refuse("`since` must be an ISO 8601 instant string.");
63
+ }
64
+
65
+ const query = new URLSearchParams();
66
+ if (typeof since === "string" && since !== "") query.set("since", since);
67
+ if (Number.isInteger(limit)) query.set("limit", String(limit));
68
+
69
+ const qs = query.toString();
70
+ return apiCall("GET", decisionsPath() + (qs ? `?${qs}` : ""), null);
71
+ }
72
+
43
73
  /**
44
74
  * `intake_pause` / `intake_resume` (loopctl US-52.33): `POST /api/v1/projects/:id/intake/pause`
45
75
  * and `/resume` on the project's one live intake source. A pause stops PROMOTION and TRIAGE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopctl-mcp-server",
3
- "version": "3.34.0",
3
+ "version": "3.35.0",
4
4
  "description": "MCP server for loopctl — structural trust for AI development loops",
5
5
  "type": "module",
6
6
  "main": "index.js",