loopctl-mcp-server 3.48.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 +1 -0
- package/index.js +35 -0
- package/lib/factory.js +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -666,6 +666,7 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
|
|
|
666
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. |
|
|
667
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. |
|
|
668
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. |
|
|
669
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`. |
|
|
670
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. |
|
|
671
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";
|
|
@@ -3771,6 +3772,15 @@ async function decisionsTool(args) {
|
|
|
3771
3772
|
);
|
|
3772
3773
|
}
|
|
3773
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
|
+
|
|
3774
3784
|
// US-52.51: the factory policy, read on the session's own key (any key reads it).
|
|
3775
3785
|
async function factoryPolicyTool(args) {
|
|
3776
3786
|
return toContent(
|
|
@@ -11732,6 +11742,29 @@ const TOOLS = [
|
|
|
11732
11742
|
},
|
|
11733
11743
|
},
|
|
11734
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
|
+
|
|
11735
11768
|
{
|
|
11736
11769
|
name: "factory_policy",
|
|
11737
11770
|
description:
|
|
@@ -15060,6 +15093,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
15060
15093
|
return await factoryOverviewTool(args);
|
|
15061
15094
|
case "decisions":
|
|
15062
15095
|
return await decisionsTool(args);
|
|
15096
|
+
case "holder_list":
|
|
15097
|
+
return await holderListTool(args);
|
|
15063
15098
|
case "factory_policy":
|
|
15064
15099
|
return await factoryPolicyTool(args);
|
|
15065
15100
|
case "review_round_open":
|
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
|