loopctl-mcp-server 3.36.0 → 3.37.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 +61 -0
- package/lib/snapshots.js +50 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -588,6 +588,7 @@ Key distribution for the dispatch pattern (Epic 26): per-dispatch ephemeral keys
|
|
|
588
588
|
| `review_round_status` | **Read a branch's review rounds** (`GET /api/v1/review_rounds?repo_url=&branch=`, US-52.53): `{rounds: [{round_id, round, diff_kind, head_sha, attested, voided, actor_holder_id, inserted_at}], count, diff_kind, normal, ceiling, security, inherited, capped}`, `count` excluding voided rounds; `security` lists the item's /security-review records (not rounds); with `ancestor_shas`, `inherited` names the capped parent the branch descends from, else null; `capped` lists the project's other items capped in the last 7 days (`{branch, capped_at, heads, ceiling_heads, released}`, at most 20) for the carry-over check (claude-config#812); optional `diff_kind` picks the limits. With `ancestor_shas` (at most 500) the tool sends `POST /api/v1/review_rounds/status`, the same read with the list in a JSON body, since 500 shas pass the server's 10,000-byte request line; it writes nothing. Any agent key. `400 repo_and_branch_required`, `404 work_item_not_found`, `409 ambiguous_project`, `422 invalid_diff_kind`/`invalid_ancestor_shas`. |
|
|
589
589
|
| `intake_pause` | **Pause a project's intake** (`POST /api/v1/projects/:id/intake/pause`, US-52.33): new issues stay `pending_triage` and get no triage. 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`, `409 ambiguous_intake_source`, `403` on an agent-rooted tenant. Session's own key. |
|
|
590
590
|
| `intake_resume` | **Resume a project's intake** (`POST /api/v1/projects/:id/intake/resume`, US-52.33): the minute promotion run picks up what arrived while paused. Same scope, refusals and idempotency as `intake_pause`. |
|
|
591
|
+
| `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`. |
|
|
591
592
|
| `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. |
|
|
592
593
|
| `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. |
|
|
593
594
|
| `work_item_cancel` | **Cancel a work item** (`POST /api/v1/stories/:id/cancel`, US-52.32): to `failed` over `:cancelled` from detected, triaged, queued, escalated or in flight. The linked issue is left open. `409 already_landed` (merged, deployed, verified), `409 already_finished` (done, failed). |
|
package/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
resumeIntake,
|
|
38
38
|
} from "./lib/factory.js";
|
|
39
39
|
import { readFactoryPolicy } from "./lib/factory-policy.js";
|
|
40
|
+
import { snapshotUrls } from "./lib/snapshots.js";
|
|
40
41
|
import {
|
|
41
42
|
openReviewRound,
|
|
42
43
|
readReviewRoundStatus,
|
|
@@ -1103,6 +1104,11 @@ function pinnedApiCall(hint) {
|
|
|
1103
1104
|
const orchestratorPinnedApiCall = pinnedApiCall(epicWriteKeyHint);
|
|
1104
1105
|
// The deletes: LOOPCTL_USER_KEY (`deleteKeyHint`).
|
|
1105
1106
|
const userKeyApiCall = pinnedApiCall(deleteKeyHint);
|
|
1107
|
+
// snapshot_urls put (US-52.57): LOOPCTL_ORCH_KEY when set. As a plain override a global
|
|
1108
|
+
// LOOPCTL_API_KEY of a lesser role would take its place and the put would be refused 403.
|
|
1109
|
+
const snapshotPutApiCall = pinnedApiCall(() =>
|
|
1110
|
+
process.env.LOOPCTL_ORCH_KEY ? "LOOPCTL_ORCH_KEY" : undefined,
|
|
1111
|
+
);
|
|
1106
1112
|
|
|
1107
1113
|
async function listEpics(args) {
|
|
1108
1114
|
return toContent(await listEpicsRequest(args, { apiCall }));
|
|
@@ -3265,6 +3271,20 @@ async function intakeResumeTool(args) {
|
|
|
3265
3271
|
);
|
|
3266
3272
|
}
|
|
3267
3273
|
|
|
3274
|
+
// US-52.57: presigned snapshot URLs. A get is `role: :agent`, so the session's own key; a put
|
|
3275
|
+
// needs `:orchestrator` (hierarchical, not a custody gate), so LOOPCTL_ORCH_KEY, sent VERBATIM
|
|
3276
|
+
// when set (`snapshotPutApiCall`).
|
|
3277
|
+
async function snapshotUrlsTool(args) {
|
|
3278
|
+
return toContent(
|
|
3279
|
+
await snapshotUrls(args, {
|
|
3280
|
+
apiCall: (method, path, body, op) =>
|
|
3281
|
+
op === "put"
|
|
3282
|
+
? snapshotPutApiCall(method, path, body)
|
|
3283
|
+
: apiCall(method, path, body, agentKey()),
|
|
3284
|
+
}),
|
|
3285
|
+
);
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3268
3288
|
// US-52.24: this session's inbox, acks first, on the session's own key: both routes answer
|
|
3269
3289
|
// only a holder credential (lib/inbox.js).
|
|
3270
3290
|
async function inboxTool(args) {
|
|
@@ -9223,6 +9243,44 @@ const TOOLS = [
|
|
|
9223
9243
|
},
|
|
9224
9244
|
},
|
|
9225
9245
|
|
|
9246
|
+
{
|
|
9247
|
+
name: "snapshot_urls",
|
|
9248
|
+
description:
|
|
9249
|
+
"PRESIGNED URLS FOR BUILD SNAPSHOT OBJECTS (POST /api/v1/projects/:id/snapshots/urls, " +
|
|
9250
|
+
"US-52.57): one URL per named object, valid 900 s, for <tenant_id>/<project_id>/<name> " +
|
|
9251
|
+
"in loopctl's snapshot bucket, so no machine holds a bucket credential. A name is " +
|
|
9252
|
+
"index/<40 lowercase hex>.json or <64 lowercase hex>.tar.zst; 1 to 64 per call. " +
|
|
9253
|
+
'op "get" needs an agent key (the session\'s own). op "put" needs an orchestrator key ' +
|
|
9254
|
+
"(LOOPCTL_ORCH_KEY): an agent key is refused 403 insufficient_role. Each PUT URL signs " +
|
|
9255
|
+
"if-none-match: *, so the uploader must send that header (the answer's `headers`), the " +
|
|
9256
|
+
"store answers 412 to a second write of a name, and a published object is never " +
|
|
9257
|
+
"overwritten; every put answer is audited (snapshot_publish_authorized). Refusals: " +
|
|
9258
|
+
"422 invalid_snapshot_object (a bad name, an empty list or more than 64; the message " +
|
|
9259
|
+
"names the first bad name), 422 invalid_snapshot_op, 404 when the project is not this " +
|
|
9260
|
+
"tenant's, 403 custody_tier_required on an agent-rooted tenant, " +
|
|
9261
|
+
"503 snapshot_store_unconfigured when the server has no bucket configured.",
|
|
9262
|
+
inputSchema: {
|
|
9263
|
+
type: "object",
|
|
9264
|
+
properties: {
|
|
9265
|
+
project_id: { type: "string", description: "The project's UUID." },
|
|
9266
|
+
op: {
|
|
9267
|
+
type: "string",
|
|
9268
|
+
enum: ["get", "put"],
|
|
9269
|
+
description: "get (agent key) or put (orchestrator key).",
|
|
9270
|
+
},
|
|
9271
|
+
objects: {
|
|
9272
|
+
type: "array",
|
|
9273
|
+
items: { type: "string" },
|
|
9274
|
+
minItems: 1,
|
|
9275
|
+
maxItems: 64,
|
|
9276
|
+
description:
|
|
9277
|
+
"Object names: index/<40 lowercase hex>.json or <64 lowercase hex>.tar.zst.",
|
|
9278
|
+
},
|
|
9279
|
+
},
|
|
9280
|
+
required: ["project_id", "op", "objects"],
|
|
9281
|
+
},
|
|
9282
|
+
},
|
|
9283
|
+
|
|
9226
9284
|
{
|
|
9227
9285
|
name: "inbox",
|
|
9228
9286
|
description:
|
|
@@ -12003,6 +12061,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
12003
12061
|
case "intake_resume":
|
|
12004
12062
|
return await intakeResumeTool(args);
|
|
12005
12063
|
|
|
12064
|
+
case "snapshot_urls":
|
|
12065
|
+
return await snapshotUrlsTool(args);
|
|
12066
|
+
|
|
12006
12067
|
case "inbox":
|
|
12007
12068
|
return await inboxTool(args);
|
|
12008
12069
|
|
package/lib/snapshots.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `snapshot_urls` (loopctl US-52.57): `POST /api/v1/projects/:id/snapshots/urls`, presigned URLs
|
|
3
|
+
* for named build snapshot objects in loopctl's object store, so no machine holds a bucket
|
|
4
|
+
* credential. `op: "get"` runs on the session's agent key; `op: "put"` needs an orchestrator
|
|
5
|
+
* key, and each PUT URL signs `if-none-match: *`, which the uploader must send.
|
|
6
|
+
*
|
|
7
|
+
* The shape is checked here so an obvious mistake costs no round trip; the server owns the
|
|
8
|
+
* name rules and the 1..64 bound and answers 422 invalid_snapshot_object naming the first bad
|
|
9
|
+
* name.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { uuid } from "./delivery-loop.js";
|
|
13
|
+
|
|
14
|
+
export const SNAPSHOT_OPS = ["get", "put"];
|
|
15
|
+
export const MAX_SNAPSHOT_OBJECTS = 64;
|
|
16
|
+
|
|
17
|
+
export function snapshotUrlsPath(projectId) {
|
|
18
|
+
return `/api/v1/projects/${encodeURIComponent(projectId)}/snapshots/urls`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function refuse(body) {
|
|
22
|
+
return { error: true, status: 0, body };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* `apiCall(method, path, body, op)` gets the op as its fourth argument so the caller picks the
|
|
27
|
+
* key: `get` on the agent key, `put` on the orchestrator key.
|
|
28
|
+
*/
|
|
29
|
+
export async function snapshotUrls({ project_id, op, objects } = {}, { apiCall } = {}) {
|
|
30
|
+
const bad = uuid(project_id, "project_id");
|
|
31
|
+
if (bad) return bad;
|
|
32
|
+
|
|
33
|
+
if (!SNAPSHOT_OPS.includes(op)) {
|
|
34
|
+
return refuse('`op` must be "get" (agent key) or "put" (orchestrator key).');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (
|
|
38
|
+
!Array.isArray(objects) ||
|
|
39
|
+
objects.length < 1 ||
|
|
40
|
+
objects.length > MAX_SNAPSHOT_OBJECTS ||
|
|
41
|
+
!objects.every((name) => typeof name === "string" && name !== "")
|
|
42
|
+
) {
|
|
43
|
+
return refuse(
|
|
44
|
+
`\`objects\` must be a list of 1 to ${MAX_SNAPSHOT_OBJECTS} object names, each ` +
|
|
45
|
+
"`index/<40 lowercase hex>.json` or `<64 lowercase hex>.tar.zst`.",
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return apiCall("POST", snapshotUrlsPath(project_id), { op, objects }, op);
|
|
50
|
+
}
|