loopctl-mcp-server 3.44.0 → 3.46.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 +41 -1
- package/index.js +1140 -9
- package/lib/agents.js +110 -0
- package/lib/anomaly-resolution.js +57 -0
- package/lib/api-keys.js +138 -29
- package/lib/audit-inclusion.js +46 -0
- package/lib/bulk-verdicts.js +125 -0
- package/lib/channel-quarantine.js +157 -0
- package/lib/cost-analytics.js +141 -0
- package/lib/secret-file.js +40 -0
- package/lib/story-claims.js +90 -0
- package/lib/tenant-admin.js +139 -0
- package/lib/token-budgets.js +131 -0
- package/lib/token-usage-admin.js +78 -0
- package/lib/webhooks.js +281 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -52,6 +52,17 @@ import {
|
|
|
52
52
|
removeEpicDependency,
|
|
53
53
|
removeStoryDependency,
|
|
54
54
|
} from "./lib/dependencies.js";
|
|
55
|
+
import { bulkClaimStories, unclaimStory } from "./lib/story-claims.js";
|
|
56
|
+
import { bulkRejectStories, bulkVerifyStories } from "./lib/bulk-verdicts.js";
|
|
57
|
+
import { getAgent, listAgents, registerAgent } from "./lib/agents.js";
|
|
58
|
+
import { listQuarantinedPosts, releaseQuarantinedPost } from "./lib/channel-quarantine.js";
|
|
59
|
+
import { auditInclusionProof } from "./lib/audit-inclusion.js";
|
|
60
|
+
import {
|
|
61
|
+
listAuthenticators,
|
|
62
|
+
listTrustedEndpoints,
|
|
63
|
+
renameAuthenticator,
|
|
64
|
+
updateTenant,
|
|
65
|
+
} from "./lib/tenant-admin.js";
|
|
55
66
|
import { readCheckpoints, recordCheckpoint, resolveCheckpoint } from "./lib/checkpoints.js";
|
|
56
67
|
import { moveWorkItem } from "./lib/work-item-move.js";
|
|
57
68
|
import { pullWorkItem } from "./lib/work-item-pull.js";
|
|
@@ -63,7 +74,24 @@ import {
|
|
|
63
74
|
} from "./lib/factory.js";
|
|
64
75
|
import { readFactoryPolicy } from "./lib/factory-policy.js";
|
|
65
76
|
import { snapshotUrls } from "./lib/snapshots.js";
|
|
66
|
-
import { apiKeyCreate } from "./lib/api-keys.js";
|
|
77
|
+
import { apiKeyCreate, apiKeyList, apiKeyRotate } from "./lib/api-keys.js";
|
|
78
|
+
import {
|
|
79
|
+
webhookCreate,
|
|
80
|
+
webhookDeliveries,
|
|
81
|
+
webhookDelete,
|
|
82
|
+
webhookList,
|
|
83
|
+
webhookTest,
|
|
84
|
+
webhookUpdate,
|
|
85
|
+
} from "./lib/webhooks.js";
|
|
86
|
+
import {
|
|
87
|
+
tokenBudgetDelete,
|
|
88
|
+
tokenBudgetGet,
|
|
89
|
+
tokenBudgetList,
|
|
90
|
+
tokenBudgetUpdate,
|
|
91
|
+
} from "./lib/token-budgets.js";
|
|
92
|
+
import { tokenUsageCorrect, tokenUsageDelete } from "./lib/token-usage-admin.js";
|
|
93
|
+
import { costAnomalyResolve, ingestionAnomalyUpdate } from "./lib/anomaly-resolution.js";
|
|
94
|
+
import { agentModelProfile, costTrends, modelMix } from "./lib/cost-analytics.js";
|
|
67
95
|
import {
|
|
68
96
|
openReviewRound,
|
|
69
97
|
readReviewRoundStatus,
|
|
@@ -416,9 +444,12 @@ async function sendRequest(
|
|
|
416
444
|
const key = exactKey ? keyOverride : resolveKey(keyOverride);
|
|
417
445
|
|
|
418
446
|
if (!key) {
|
|
447
|
+
// `not_sent` tells a caller that reads status 0 as "the request may have landed" (a create
|
|
448
|
+
// that holds a secret, e.g. lib/webhooks.js) that nothing reached loopctl.
|
|
419
449
|
return {
|
|
420
450
|
error: true,
|
|
421
451
|
status: 0,
|
|
452
|
+
not_sent: true,
|
|
422
453
|
body: exactKey
|
|
423
454
|
? // `keyHint` names the env var THIS site is pinned to. Without it the message
|
|
424
455
|
// below talks about LLM configuration, which is right for set_llm_config and
|
|
@@ -1284,6 +1315,166 @@ async function storyDependencyListTool(args) {
|
|
|
1284
1315
|
return toContent(await listStoryDependencies(args, { apiCall: ownKeyApiCall }));
|
|
1285
1316
|
}
|
|
1286
1317
|
|
|
1318
|
+
// loopctl #872, batch 2. bulk_claim, unclaim_story and register_agent are `exact_role: :agent`:
|
|
1319
|
+
// the session's own key, never the orchestrator or user key, which those gates refuse.
|
|
1320
|
+
// bulk_verify and bulk_reject are `exact_role: :orchestrator` custody verdicts, so they select
|
|
1321
|
+
// their key through `orchestratorKeyArgs` exactly as verify_story and bulk_mark_complete do.
|
|
1322
|
+
// list_agents and get_agent are `role: :orchestrator` reads (`orchestratorPinnedApiCall`).
|
|
1323
|
+
// The api-key, quarantine, authenticator and tenant-update routes are `role: :user`
|
|
1324
|
+
// (`userKeyApiCall`). The trusted-endpoint list has no role plug (the session's own key), and the
|
|
1325
|
+
// inclusion proof is a public route (`publicApiCall`, no key at all).
|
|
1326
|
+
|
|
1327
|
+
async function bulkClaimTool(args) {
|
|
1328
|
+
return toContent(await bulkClaimStories(args, { apiCall: ownKeyApiCall }));
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
async function unclaimStoryTool(args) {
|
|
1332
|
+
return toContent(withUnreachableNotice(await unclaimStory(args, { apiCall: ownKeyApiCall })));
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
async function bulkVerifyTool(args) {
|
|
1336
|
+
const orch = orchestratorKeyArgs();
|
|
1337
|
+
|
|
1338
|
+
return toContent(
|
|
1339
|
+
await bulkVerifyStories(args, {
|
|
1340
|
+
apiCall: (method, path, body) => apiCall(method, path, body, orch.override, orch.options),
|
|
1341
|
+
}),
|
|
1342
|
+
);
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
async function bulkRejectTool(args) {
|
|
1346
|
+
const orch = orchestratorKeyArgs();
|
|
1347
|
+
|
|
1348
|
+
return toContent(
|
|
1349
|
+
await bulkRejectStories(args, {
|
|
1350
|
+
apiCall: (method, path, body) => apiCall(method, path, body, orch.override, orch.options),
|
|
1351
|
+
}),
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
async function registerAgentTool(args) {
|
|
1356
|
+
return toContent(await registerAgent(args, { apiCall: ownKeyApiCall }));
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
async function listAgentsTool(args) {
|
|
1360
|
+
return toContent(await listAgents(args, { apiCall: orchestratorPinnedApiCall }));
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
async function getAgentTool(args) {
|
|
1364
|
+
return toContent(await getAgent(args, { apiCall: orchestratorPinnedApiCall }));
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
async function apiKeyListTool(args) {
|
|
1368
|
+
return toContent(await apiKeyList(args, { apiCall: userKeyApiCall }));
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
async function apiKeyRotateTool(args) {
|
|
1372
|
+
return toContent(await apiKeyRotate(args, { apiCall: userKeyApiCall }));
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
async function channelQuarantinedTool(args) {
|
|
1376
|
+
return toContent(await listQuarantinedPosts(args, { apiCall: userKeyApiCall }));
|
|
1377
|
+
}
|
|
1378
|
+
|
|
1379
|
+
async function channelReleaseTool(args) {
|
|
1380
|
+
return toContent(await releaseQuarantinedPost(args, { apiCall: userKeyApiCall }));
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
async function auditInclusionProofTool(args) {
|
|
1384
|
+
return toContent(await auditInclusionProof(args, { apiCall: publicApiCall }));
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
async function listTrustedEndpointsTool(args) {
|
|
1388
|
+
return toContent(await listTrustedEndpoints(args, { apiCall: ownKeyApiCall }));
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
async function listAuthenticatorsTool(args) {
|
|
1392
|
+
return toContent(await listAuthenticators(args, { apiCall: userKeyApiCall }));
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
async function renameAuthenticatorTool(args) {
|
|
1396
|
+
return toContent(await renameAuthenticator(args, { apiCall: userKeyApiCall }));
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
async function updateTenantTool(args) {
|
|
1400
|
+
return toContent(await updateTenant(args, { apiCall: userKeyApiCall }));
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
// loopctl #872, batch 3. Every webhook action is `role: :user` (`userKeyApiCall`); create's
|
|
1404
|
+
// signing secret goes to `secret_file`, never the result. The token-budget reads are
|
|
1405
|
+
// `role: :agent` (the session's own key), the budget update `role: :orchestrator`
|
|
1406
|
+
// (`orchestratorPinnedApiCall`) and the budget delete `role: :user`. The token-usage delete and
|
|
1407
|
+
// correction and both anomaly resolutions are `role: :user` (`userKeyApiCall`). The three
|
|
1408
|
+
// analytics reads are `role: :orchestrator` (`orchestratorPinnedApiCall`).
|
|
1409
|
+
|
|
1410
|
+
async function webhookCreateTool(args) {
|
|
1411
|
+
return toContent(await webhookCreate(args, { apiCall: userKeyApiCall }));
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
async function webhookListTool(args) {
|
|
1415
|
+
return toContent(await webhookList(args, { apiCall: userKeyApiCall }));
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
async function webhookUpdateTool(args) {
|
|
1419
|
+
return toContent(await webhookUpdate(args, { apiCall: userKeyApiCall }));
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
async function webhookDeleteTool(args) {
|
|
1423
|
+
return toContent(await webhookDelete(args, { apiCall: userKeyApiCall }));
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
async function webhookTestTool(args) {
|
|
1427
|
+
return toContent(await webhookTest(args, { apiCall: userKeyApiCall }));
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
async function webhookDeliveriesTool(args) {
|
|
1431
|
+
return toContent(await webhookDeliveries(args, { apiCall: userKeyApiCall }));
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
async function tokenBudgetListTool(args) {
|
|
1435
|
+
return toContent(await tokenBudgetList(args, { apiCall: ownKeyApiCall }));
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
async function tokenBudgetGetTool(args) {
|
|
1439
|
+
return toContent(await tokenBudgetGet(args, { apiCall: ownKeyApiCall }));
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
async function tokenBudgetUpdateTool(args) {
|
|
1443
|
+
return toContent(await tokenBudgetUpdate(args, { apiCall: orchestratorPinnedApiCall }));
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
async function tokenBudgetDeleteTool(args) {
|
|
1447
|
+
return toContent(await tokenBudgetDelete(args, { apiCall: userKeyApiCall }));
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
async function tokenUsageDeleteTool(args) {
|
|
1451
|
+
return toContent(await tokenUsageDelete(args, { apiCall: userKeyApiCall }));
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
async function tokenUsageCorrectTool(args) {
|
|
1455
|
+
return toContent(await tokenUsageCorrect(args, { apiCall: userKeyApiCall }));
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
async function costAnomalyResolveTool(args) {
|
|
1459
|
+
return toContent(await costAnomalyResolve(args, { apiCall: userKeyApiCall }));
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
async function ingestionAnomalyUpdateTool(args) {
|
|
1463
|
+
return toContent(await ingestionAnomalyUpdate(args, { apiCall: userKeyApiCall }));
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
async function costTrendsTool(args) {
|
|
1467
|
+
return toContent(await costTrends(args, { apiCall: orchestratorPinnedApiCall }));
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
async function modelMixTool(args) {
|
|
1471
|
+
return toContent(await modelMix(args, { apiCall: orchestratorPinnedApiCall }));
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
async function agentModelProfileTool(args) {
|
|
1475
|
+
return toContent(await agentModelProfile(args, { apiCall: orchestratorPinnedApiCall }));
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1287
1478
|
// --- Workflow Tools (agent key) ---
|
|
1288
1479
|
|
|
1289
1480
|
async function contractStory({ story_id, story_title, ac_count }) {
|
|
@@ -3942,7 +4133,7 @@ async function escalationPlaybook(args) {
|
|
|
3942
4133
|
|
|
3943
4134
|
// #846: force-unclaim is `exact_role: :orchestrator`
|
|
3944
4135
|
// (`story_verification_controller.ex:30-31`), so this is the one delivery-loop verb that wants
|
|
3945
|
-
// the ORCH key. Same selection as the other
|
|
4136
|
+
// the ORCH key. Same selection as the other custody verbs: when LOOPCTL_ORCH_KEY is set it
|
|
3946
4137
|
// is sent EXACTLY, because `resolveKey` (`index.js:132-138`) would otherwise discard it for a
|
|
3947
4138
|
// global LOOPCTL_API_KEY on the one call it was set for; when it is not set, a global key still
|
|
3948
4139
|
// goes, because an orchestrator-role LOOPCTL_API_KEY was a documented, working configuration
|
|
@@ -5680,28 +5871,30 @@ const TOOLS = [
|
|
|
5680
5871
|
{
|
|
5681
5872
|
name: "set_token_budget",
|
|
5682
5873
|
description:
|
|
5683
|
-
"Set a token budget for a scope (project, epic
|
|
5684
|
-
"Requires orchestrator or user role. Uses the ORCH key."
|
|
5874
|
+
"Set a token budget for a scope (project, epic or story). " +
|
|
5875
|
+
"Requires orchestrator or user role. Uses the ORCH key. 409 when the scope already " +
|
|
5876
|
+
"has a budget (change it with token_budget_update), 404 for a scope entity that is " +
|
|
5877
|
+
"not this tenant's, 422 for a malformed scope_id or a value out of range.",
|
|
5685
5878
|
inputSchema: {
|
|
5686
5879
|
type: "object",
|
|
5687
5880
|
properties: {
|
|
5688
5881
|
scope_type: {
|
|
5689
5882
|
type: "string",
|
|
5690
|
-
enum: ["project", "epic", "story"
|
|
5883
|
+
enum: ["project", "epic", "story"],
|
|
5691
5884
|
description: "The type of scope to apply the budget to.",
|
|
5692
5885
|
},
|
|
5693
5886
|
scope_id: {
|
|
5694
5887
|
type: "string",
|
|
5695
|
-
description: "The UUID of the scoped resource (project_id, epic_id
|
|
5888
|
+
description: "The UUID of the scoped resource (project_id, epic_id or story_id).",
|
|
5696
5889
|
},
|
|
5697
5890
|
budget_millicents: {
|
|
5698
5891
|
type: "integer",
|
|
5699
5892
|
description: "Maximum allowed cost in millicents (1/1000 of a cent).",
|
|
5700
5893
|
},
|
|
5701
5894
|
alert_threshold_pct: {
|
|
5702
|
-
type: "
|
|
5703
|
-
description: "Optional: percentage of budget at which to trigger an alert (
|
|
5704
|
-
minimum:
|
|
5895
|
+
type: "integer",
|
|
5896
|
+
description: "Optional: percentage of budget at which to trigger an alert (1–100).",
|
|
5897
|
+
minimum: 1,
|
|
5705
5898
|
maximum: 100,
|
|
5706
5899
|
},
|
|
5707
5900
|
},
|
|
@@ -9771,6 +9964,878 @@ const TOOLS = [
|
|
|
9771
9964
|
},
|
|
9772
9965
|
},
|
|
9773
9966
|
|
|
9967
|
+
// loopctl #872, batch 2.
|
|
9968
|
+
{
|
|
9969
|
+
name: "bulk_claim",
|
|
9970
|
+
description:
|
|
9971
|
+
"CLAIM SEVERAL STORIES AT ONCE (POST /api/v1/stories/bulk/claim): each `contracted` " +
|
|
9972
|
+
"story in `story_ids` (1..50) is claimed for this session's agent and holder in one " +
|
|
9973
|
+
"transaction, with partial success: 200 with `results` when any story was claimed, 422 " +
|
|
9974
|
+
"with `results` when none was. Each result is `{story_id, status, reason}`; a story's " +
|
|
9975
|
+
"refusal (not in contracted, `story_held`, `dependencies_not_met`, `Story not found`) is " +
|
|
9976
|
+
"its `reason`. Unlike `claim_story` it mints NO start capability and returns no claim " +
|
|
9977
|
+
"epoch: `start_story` recovers the capability through recover-cap. Sent on this " +
|
|
9978
|
+
"session's own key. The gate is `exact_role: :agent` with NO hierarchy: an orchestrator, " +
|
|
9979
|
+
"user or superadmin key is 403 insufficient_role. Whole-batch refusals: 403 " +
|
|
9980
|
+
"custody_tier_required on an agent-rooted tenant, 409 chg_root_review_only for a key " +
|
|
9981
|
+
"descending from an intake source's chg root, 422 for an empty or oversized batch, 503 " +
|
|
9982
|
+
"tenant_halted under a custody halt. Refused by the tool, sending nothing: an empty or " +
|
|
9983
|
+
"oversized batch, an id that is not a UUID, and an id named twice.",
|
|
9984
|
+
inputSchema: {
|
|
9985
|
+
type: "object",
|
|
9986
|
+
properties: {
|
|
9987
|
+
story_ids: {
|
|
9988
|
+
type: "array",
|
|
9989
|
+
items: { type: "string" },
|
|
9990
|
+
description: "The UUIDs of the stories to claim, 1 to 50, each once.",
|
|
9991
|
+
},
|
|
9992
|
+
},
|
|
9993
|
+
required: ["story_ids"],
|
|
9994
|
+
},
|
|
9995
|
+
},
|
|
9996
|
+
{
|
|
9997
|
+
name: "unclaim_story",
|
|
9998
|
+
description:
|
|
9999
|
+
"GIVE BACK A STORY THIS SESSION CLAIMED (POST /api/v1/stories/:id/unclaim): the claim " +
|
|
10000
|
+
"is released and the story returns to pending. A DELIVERY story does not stay pending: " +
|
|
10001
|
+
"giving it back spent an attempt, so it is re-contracted below the retry ceiling and its " +
|
|
10002
|
+
"stage row escalated over `attempts_exhausted` at it; the answer is the story as the " +
|
|
10003
|
+
"release left it, with `next_actions`. Sent on this session's own key. The gate is " +
|
|
10004
|
+
"`exact_role: :agent` with NO hierarchy: an orchestrator, user or superadmin key is 403 " +
|
|
10005
|
+
"insufficient_role; to take back a story another agent holds, use `force_unclaim_story`. " +
|
|
10006
|
+
"403 when this key's agent is not the story's assignee, 403 custody_tier_required on an " +
|
|
10007
|
+
"agent-rooted tenant, 404 for a story that is not this tenant's, 409 for a story in no " +
|
|
10008
|
+
"state a claim can leave, 409 held_by_other_holder when another session holds it (even " +
|
|
10009
|
+
"one with this agent key), 422 when the release's write or audit entry was rejected, 500 " +
|
|
10010
|
+
"audit_chain_append_failed when the escalation's chain entry was refused (the whole " +
|
|
10011
|
+
"release rolled back, the story is unchanged), 503 tenant_halted under a custody halt. A " +
|
|
10012
|
+
"`story_id` that is not a UUID is refused by the tool, sending nothing.",
|
|
10013
|
+
inputSchema: {
|
|
10014
|
+
type: "object",
|
|
10015
|
+
properties: {
|
|
10016
|
+
story_id: { type: "string", description: "The UUID of the story to give back." },
|
|
10017
|
+
},
|
|
10018
|
+
required: ["story_id"],
|
|
10019
|
+
},
|
|
10020
|
+
},
|
|
10021
|
+
{
|
|
10022
|
+
name: "bulk_verify",
|
|
10023
|
+
description:
|
|
10024
|
+
"VERIFY SEVERAL REPORTED STORIES AT ONCE (POST /api/v1/stories/bulk/verify): each entry " +
|
|
10025
|
+
"of `stories` (1..50) is `{story_id, summary, review_type, findings}`, the last three " +
|
|
10026
|
+
"optional (defaults: `Verified via bulk operation`, `bulk_verify`, {}). Every story runs " +
|
|
10027
|
+
"the same gates `verify_story` runs, its custody lineage comparison included, in one " +
|
|
10028
|
+
"transaction with partial success: 200 with `results` when any story was verified, 422 " +
|
|
10029
|
+
"with `results` when none was; a story's refusal (`self_verify_blocked`, " +
|
|
10030
|
+
"`caller_lineage_required`, not reported_done, a missing review, a chg landed-review or " +
|
|
10031
|
+
"trunk-evidence refusal, ...) is its `reason`. Needs an ORCHESTRATOR-role key, chosen as " +
|
|
10032
|
+
"`verify_story` chooses it: LOOPCTL_ORCH_KEY sent exactly when set, else LOOPCTL_API_KEY. " +
|
|
10033
|
+
"The gate is `exact_role: :orchestrator` with NO hierarchy, so a user or superadmin key " +
|
|
10034
|
+
"is 403 insufficient_role like an agent key. Whole-batch refusals: 400 when the " +
|
|
10035
|
+
"orchestrator key is linked to no agent, 401 bulk_signature_unsupported (or 403 " +
|
|
10036
|
+
"agent_enrollment_required) for an enrolled caller under the LCP-1 signed profile, which " +
|
|
10037
|
+
"a set cannot satisfy, 403 custody_tier_required on an agent-rooted tenant, 409 " +
|
|
10038
|
+
"chg_root_cannot_verify for a chg-rooted key, 422 for an empty or oversized batch, 503 " +
|
|
10039
|
+
"tenant_halted under a custody halt. Refused by the tool, sending nothing: a bad batch, " +
|
|
10040
|
+
"a story_id that is not a UUID or is named twice (loopctl would keep only the last " +
|
|
10041
|
+
"entry's fields), and a non-string `summary`/`review_type` or non-object `findings` " +
|
|
10042
|
+
"(loopctl would verify the story and silently record no verification result).",
|
|
10043
|
+
inputSchema: {
|
|
10044
|
+
type: "object",
|
|
10045
|
+
properties: {
|
|
10046
|
+
stories: {
|
|
10047
|
+
type: "array",
|
|
10048
|
+
description: "The stories to verify, 1 to 50, each once.",
|
|
10049
|
+
items: {
|
|
10050
|
+
type: "object",
|
|
10051
|
+
properties: {
|
|
10052
|
+
story_id: { type: "string", description: "The UUID of the story." },
|
|
10053
|
+
summary: { type: "string", description: "Optional verification summary." },
|
|
10054
|
+
review_type: { type: "string", description: "Optional review type label." },
|
|
10055
|
+
findings: { type: "object", description: "Optional structured findings." },
|
|
10056
|
+
},
|
|
10057
|
+
required: ["story_id"],
|
|
10058
|
+
},
|
|
10059
|
+
},
|
|
10060
|
+
},
|
|
10061
|
+
required: ["stories"],
|
|
10062
|
+
},
|
|
10063
|
+
},
|
|
10064
|
+
{
|
|
10065
|
+
name: "bulk_reject",
|
|
10066
|
+
description:
|
|
10067
|
+
"REJECT SEVERAL REPORTED STORIES AT ONCE (POST /api/v1/stories/bulk/reject): each entry " +
|
|
10068
|
+
"of `stories` (1..50) is `{story_id, reason, review_type, findings}`, `reason` " +
|
|
10069
|
+
"required. Each story runs the same gates `reject_story` runs, in one transaction with " +
|
|
10070
|
+
"partial success: 200 with `results` when any story was rejected, 422 with `results` " +
|
|
10071
|
+
"when none was; a story's refusal (not reported_done, `self_verify_blocked`, " +
|
|
10072
|
+
"`caller_lineage_required` on a pull-request-route story for a key no dispatch minted, " +
|
|
10073
|
+
"...) is its `reason`. A rejected story's claim is released, and a delivery story is " +
|
|
10074
|
+
"re-contracted or escalated in the same transaction. Needs an ORCHESTRATOR-role key, " +
|
|
10075
|
+
"chosen as `reject_story` chooses it: LOOPCTL_ORCH_KEY sent exactly when set, else " +
|
|
10076
|
+
"LOOPCTL_API_KEY. The gate is `exact_role: :orchestrator` with NO hierarchy, so a user or " +
|
|
10077
|
+
"superadmin key is 403 insufficient_role like an agent key. Whole-batch refusals: 400 " +
|
|
10078
|
+
"when the orchestrator key is linked to no agent, 403 custody_tier_required on an " +
|
|
10079
|
+
"agent-rooted tenant, 409 chg_root_cannot_verify for a chg-rooted key, 422 for an empty " +
|
|
10080
|
+
"or oversized batch, 500 audit_chain_append_failed when a release's escalation could not " +
|
|
10081
|
+
"append its chain entry (the WHOLE batch rolled back), 503 tenant_halted under a custody " +
|
|
10082
|
+
"halt. Refused by the tool, sending nothing: a bad batch, a story_id that is not a UUID " +
|
|
10083
|
+
"or is named twice, a missing or blank `reason`, and a non-string `reason`/`review_type` " +
|
|
10084
|
+
"or non-object `findings` (loopctl would reject the story and silently record no result).",
|
|
10085
|
+
inputSchema: {
|
|
10086
|
+
type: "object",
|
|
10087
|
+
properties: {
|
|
10088
|
+
stories: {
|
|
10089
|
+
type: "array",
|
|
10090
|
+
description: "The stories to reject, 1 to 50, each once.",
|
|
10091
|
+
items: {
|
|
10092
|
+
type: "object",
|
|
10093
|
+
properties: {
|
|
10094
|
+
story_id: { type: "string", description: "The UUID of the story." },
|
|
10095
|
+
reason: { type: "string", description: "Required: why it is rejected." },
|
|
10096
|
+
review_type: { type: "string", description: "Optional review type label." },
|
|
10097
|
+
findings: { type: "object", description: "Optional structured findings." },
|
|
10098
|
+
},
|
|
10099
|
+
required: ["story_id", "reason"],
|
|
10100
|
+
},
|
|
10101
|
+
},
|
|
10102
|
+
},
|
|
10103
|
+
required: ["stories"],
|
|
10104
|
+
},
|
|
10105
|
+
},
|
|
10106
|
+
{
|
|
10107
|
+
name: "register_agent",
|
|
10108
|
+
description:
|
|
10109
|
+
"REGISTER THIS KEY'S AGENT (POST /api/v1/agents/register): creates an agent row named " +
|
|
10110
|
+
"`name` of type `agent_type` (orchestrator or implementer), with optional `metadata`, " +
|
|
10111
|
+
"and links the CALLING key to it; 201 with `agent`. Sent on this session's own key. The " +
|
|
10112
|
+
"gate is `exact_role: :agent` with NO hierarchy: an orchestrator, user or superadmin key " +
|
|
10113
|
+
"is 403 insufficient_role. 409 when the key already carries an agent (a holder " +
|
|
10114
|
+
"credential always does), 422 without `name` or `agent_type`, for a taken name, or for a " +
|
|
10115
|
+
"name starting `system:` (any case), which loopctl reserves for its own agents. Refused " +
|
|
10116
|
+
"by the tool, sending nothing: a blank `name`, an `agent_type` outside the enum, and a " +
|
|
10117
|
+
"`metadata` that is not an object.",
|
|
10118
|
+
inputSchema: {
|
|
10119
|
+
type: "object",
|
|
10120
|
+
properties: {
|
|
10121
|
+
name: { type: "string", description: "The agent's name." },
|
|
10122
|
+
agent_type: {
|
|
10123
|
+
type: "string",
|
|
10124
|
+
enum: ["orchestrator", "implementer"],
|
|
10125
|
+
description: "The agent's type.",
|
|
10126
|
+
},
|
|
10127
|
+
metadata: { type: "object", description: "Optional: any structured detail." },
|
|
10128
|
+
},
|
|
10129
|
+
required: ["name", "agent_type"],
|
|
10130
|
+
},
|
|
10131
|
+
},
|
|
10132
|
+
{
|
|
10133
|
+
name: "list_agents",
|
|
10134
|
+
description:
|
|
10135
|
+
"LIST THE TENANT'S AGENTS (GET /api/v1/agents): each with `id`, `name`, `agent_type`, " +
|
|
10136
|
+
"`status`, `last_seen_at` and `metadata`, plus `total`, `page` and `page_size`. Filters " +
|
|
10137
|
+
"`agent_type` (orchestrator, implementer) and `status` (active, idle, deactivated); " +
|
|
10138
|
+
"`sort_by` one of name, agent_type, status, last_seen_at, inserted_at (default name); " +
|
|
10139
|
+
"`page` and `page_size` (1..100, default 20). Needs an ORCHESTRATOR-role key or higher " +
|
|
10140
|
+
"(`role: :orchestrator` with the hierarchy), sent on LOOPCTL_ORCH_KEY verbatim, else " +
|
|
10141
|
+
"LOOPCTL_USER_KEY, else the default key; an agent key is 403 insufficient_role. Refused " +
|
|
10142
|
+
"by the tool, sending nothing: a filter or sort outside its enum and a bad page, because " +
|
|
10143
|
+
"loopctl DROPS an unknown filter or bad number and would answer every agent.",
|
|
10144
|
+
inputSchema: {
|
|
10145
|
+
type: "object",
|
|
10146
|
+
properties: {
|
|
10147
|
+
agent_type: {
|
|
10148
|
+
type: "string",
|
|
10149
|
+
enum: ["orchestrator", "implementer"],
|
|
10150
|
+
description: "Optional agent_type filter.",
|
|
10151
|
+
},
|
|
10152
|
+
status: {
|
|
10153
|
+
type: "string",
|
|
10154
|
+
enum: ["active", "idle", "deactivated"],
|
|
10155
|
+
description: "Optional status filter.",
|
|
10156
|
+
},
|
|
10157
|
+
sort_by: {
|
|
10158
|
+
type: "string",
|
|
10159
|
+
enum: ["name", "agent_type", "status", "last_seen_at", "inserted_at"],
|
|
10160
|
+
description: "Optional sort field (default name).",
|
|
10161
|
+
},
|
|
10162
|
+
page: { type: "integer", description: "Optional page number (default 1)." },
|
|
10163
|
+
page_size: { type: "integer", description: "Optional page size, 1..100 (default 20)." },
|
|
10164
|
+
},
|
|
10165
|
+
required: [],
|
|
10166
|
+
},
|
|
10167
|
+
},
|
|
10168
|
+
{
|
|
10169
|
+
name: "get_agent",
|
|
10170
|
+
description:
|
|
10171
|
+
"READ ONE AGENT (GET /api/v1/agents/:id): its `name`, `agent_type`, `status`, " +
|
|
10172
|
+
"`last_seen_at` and `metadata`. Needs an ORCHESTRATOR-role key or higher (`role: " +
|
|
10173
|
+
":orchestrator` with the hierarchy), sent on LOOPCTL_ORCH_KEY verbatim, else " +
|
|
10174
|
+
"LOOPCTL_USER_KEY, else the default key; an agent key is 403 insufficient_role. 404 for " +
|
|
10175
|
+
"an agent that is not this tenant's. An `agent_id` that is not a UUID is refused by the " +
|
|
10176
|
+
"tool, sending nothing.",
|
|
10177
|
+
inputSchema: {
|
|
10178
|
+
type: "object",
|
|
10179
|
+
properties: {
|
|
10180
|
+
agent_id: { type: "string", description: "The UUID of the agent." },
|
|
10181
|
+
},
|
|
10182
|
+
required: ["agent_id"],
|
|
10183
|
+
},
|
|
10184
|
+
},
|
|
10185
|
+
{
|
|
10186
|
+
name: "api_key_list",
|
|
10187
|
+
description:
|
|
10188
|
+
"LIST THE TENANT'S API KEYS (GET /api/v1/api_keys): each with `id`, `name`, " +
|
|
10189
|
+
"`key_prefix`, `role`, `last_used_at`, `expires_at`, `revoked_at` and " +
|
|
10190
|
+
"`snapshot_project_id` — never a raw key or hash. Revoked keys are left out unless " +
|
|
10191
|
+
"`include_revoked` is true; an expired agent-linked agent or orchestrator key is revoked " +
|
|
10192
|
+
"by a sweep within minutes of expiring. Needs a USER-role key (`role: :user` with the " +
|
|
10193
|
+
"hierarchy), sent on LOOPCTL_USER_KEY verbatim when set, else the default key; an agent " +
|
|
10194
|
+
"or orchestrator key is 403 insufficient_role. A non-boolean `include_revoked` is " +
|
|
10195
|
+
"refused by the tool, sending nothing.",
|
|
10196
|
+
inputSchema: {
|
|
10197
|
+
type: "object",
|
|
10198
|
+
properties: {
|
|
10199
|
+
include_revoked: {
|
|
10200
|
+
type: "boolean",
|
|
10201
|
+
description: "Optional: true lists revoked keys too.",
|
|
10202
|
+
},
|
|
10203
|
+
},
|
|
10204
|
+
required: [],
|
|
10205
|
+
},
|
|
10206
|
+
},
|
|
10207
|
+
{
|
|
10208
|
+
name: "api_key_rotate",
|
|
10209
|
+
description:
|
|
10210
|
+
"ROTATE AN API KEY (POST /api/v1/api_keys/:id/rotate): mints a replacement with the old " +
|
|
10211
|
+
"key's name, role, agent and snapshot scope, and puts the old key on an expiry " +
|
|
10212
|
+
"`grace_period_hours` from now (default 24, from 1 to 168). " +
|
|
10213
|
+
"The new raw key is written to `key_file` (absolute, must not exist, created 0600 " +
|
|
10214
|
+
"before anything is sent) and is never in the result, which carries `new_key` (id, " +
|
|
10215
|
+
"prefix, role, name, expiry, scope) and `old_key_expires_at`. Needs a USER-role key that " +
|
|
10216
|
+
"no dispatch minted, sent on LOOPCTL_USER_KEY verbatim when set, else the default key: " +
|
|
10217
|
+
"an agent or orchestrator key is 403 insufficient_role, a dispatch-minted key 403 " +
|
|
10218
|
+
"api_key_mint_forbidden. 404 for a key that is not this tenant's, 422 `Cannot rotate a " +
|
|
10219
|
+
"revoked key`, 422 for a runner's key (revoke and re-enroll the runner). Rotating " +
|
|
10220
|
+
"LOOPCTL_USER_KEY itself is allowed: move the new key into place before the grace period " +
|
|
10221
|
+
"ends. Refused by the tool, sending nothing: an `api_key_id` that is not a UUID, a " +
|
|
10222
|
+
"`grace_period_hours` that is not an integer from 1 to 168 (loopctl would clamp a larger one " +
|
|
10223
|
+
"silently), and a `key_file` that is not absolute or already exists.",
|
|
10224
|
+
inputSchema: {
|
|
10225
|
+
type: "object",
|
|
10226
|
+
properties: {
|
|
10227
|
+
api_key_id: { type: "string", description: "The UUID of the key to rotate." },
|
|
10228
|
+
grace_period_hours: {
|
|
10229
|
+
type: "integer",
|
|
10230
|
+
description: "Optional: hours the old key keeps working, 1 to 168 (default 24); 0 or less is refused, because expiring the old key at once can lock out the caller.",
|
|
10231
|
+
},
|
|
10232
|
+
key_file: {
|
|
10233
|
+
type: "string",
|
|
10234
|
+
description: "Absolute path, not existing yet, where the new raw key is written.",
|
|
10235
|
+
},
|
|
10236
|
+
},
|
|
10237
|
+
required: ["api_key_id", "key_file"],
|
|
10238
|
+
},
|
|
10239
|
+
},
|
|
10240
|
+
{
|
|
10241
|
+
name: "channel_quarantine_list",
|
|
10242
|
+
description:
|
|
10243
|
+
"REVIEW QUARANTINED COORDINATION POSTS (GET /api/v1/channel/posts/quarantined): the " +
|
|
10244
|
+
"posts the secret rescan hid as suspected credentials, newest quarantine first, with " +
|
|
10245
|
+
"`meta` (`count`, `limit`). The FULL rows are written to `rows_file` (absolute, must not " +
|
|
10246
|
+
"exist, created 0600) and NOT returned: the result lists each post with its scanned " +
|
|
10247
|
+
"fields (body, key, session_id, host, to_host, to_capability, idempotency_key, refs) " +
|
|
10248
|
+
"removed, and `quarantine_reason` names the ones that tripped. Read the file, judge, " +
|
|
10249
|
+
"then `channel_delete` a real credential or `channel_quarantine_release` a false positive, and " +
|
|
10250
|
+
"delete the file. Optional `project_id` (an id, slug or repo name; one that names no " +
|
|
10251
|
+
"project answers an empty list) and `limit` (1..100, default 25). Needs a USER-role key " +
|
|
10252
|
+
"on a human-anchored tenant (`role: :user` with the hierarchy), sent on LOOPCTL_USER_KEY " +
|
|
10253
|
+
"verbatim when set, else the default key: an agent or orchestrator key is 403 " +
|
|
10254
|
+
"insufficient_role, an agent-rooted tenant 403 custody_tier_required. Refused by the " +
|
|
10255
|
+
"tool, sending nothing: a `limit` outside 1..100 (loopctl would silently clamp or default " +
|
|
10256
|
+
"it) and a `rows_file` that is not absolute or already exists.",
|
|
10257
|
+
inputSchema: {
|
|
10258
|
+
type: "object",
|
|
10259
|
+
properties: {
|
|
10260
|
+
project_id: {
|
|
10261
|
+
type: "string",
|
|
10262
|
+
description: "Optional: one project's channel (its id, slug or repo name).",
|
|
10263
|
+
},
|
|
10264
|
+
limit: { type: "integer", description: "Optional: at most this many, 1..100 (default 25)." },
|
|
10265
|
+
rows_file: {
|
|
10266
|
+
type: "string",
|
|
10267
|
+
description: "Absolute path, not existing yet, where the full rows are written.",
|
|
10268
|
+
},
|
|
10269
|
+
},
|
|
10270
|
+
required: ["rows_file"],
|
|
10271
|
+
},
|
|
10272
|
+
},
|
|
10273
|
+
{
|
|
10274
|
+
name: "channel_quarantine_release",
|
|
10275
|
+
description:
|
|
10276
|
+
"RELEASE A QUARANTINED COORDINATION POST (POST /api/v1/channel/posts/:id/release): the " +
|
|
10277
|
+
"false-positive exoneration, the counterpart to `channel_delete`. The post is readable " +
|
|
10278
|
+
"on its channel again and is exempt from the rescan for the current denylist revision; " +
|
|
10279
|
+
"the release is audited. Answers `released: true` and the post with its scanned fields " +
|
|
10280
|
+
"removed (read it with `channel_get`). Needs a USER-role key on a human-anchored tenant, " +
|
|
10281
|
+
"sent on LOOPCTL_USER_KEY verbatim when set, else the default key: an agent or " +
|
|
10282
|
+
"orchestrator key is 403 insufficient_role, an agent-rooted tenant 403 " +
|
|
10283
|
+
"custody_tier_required. 404, identical for each, when the post is missing, another " +
|
|
10284
|
+
"tenant's or not quarantined; 500 audit_write_failed when the audit entry could not be " +
|
|
10285
|
+
"written (nothing was released). A `post_id` that is not a UUID is refused by the tool, " +
|
|
10286
|
+
"sending nothing.",
|
|
10287
|
+
inputSchema: {
|
|
10288
|
+
type: "object",
|
|
10289
|
+
properties: {
|
|
10290
|
+
post_id: { type: "string", description: "The UUID of the quarantined post." },
|
|
10291
|
+
},
|
|
10292
|
+
required: ["post_id"],
|
|
10293
|
+
},
|
|
10294
|
+
},
|
|
10295
|
+
{
|
|
10296
|
+
name: "audit_inclusion_proof",
|
|
10297
|
+
description:
|
|
10298
|
+
"PROVE AN AUDIT ENTRY IS IN THE SIGNED LOG (GET " +
|
|
10299
|
+
"/api/v1/audit/sth/:tenant_id/inclusion/:position): the merkle audit path from the entry " +
|
|
10300
|
+
"at `position` up to the signed tree head that covers it, as `leaf_index`, `leaf_hash`, " +
|
|
10301
|
+
"`tree_size`, `audit_path` and `sth` (hashes URL-safe base64, no padding). Fold the leaf " +
|
|
10302
|
+
"up the path, compare with `sth.merkle_root`, and check `sth.signature` against the " +
|
|
10303
|
+
"tenant's public audit key. PUBLIC: sent with no key, so it works for any tenant and in " +
|
|
10304
|
+
"a session whose keys fail. 400 invalid_tenant_id, 404 for a position with no entry, 409 " +
|
|
10305
|
+
"not_yet_included when no signed tree head covers the entry yet (retry after the next " +
|
|
10306
|
+
"one), 429 past the per-IP proof budget (wait for the retry-after). Refused by the tool, " +
|
|
10307
|
+
"sending nothing: a `tenant_id` that is not a UUID and a `position` that is not a " +
|
|
10308
|
+
"non-negative integer (loopctl would answer the same 404 as a missing entry).",
|
|
10309
|
+
inputSchema: {
|
|
10310
|
+
type: "object",
|
|
10311
|
+
properties: {
|
|
10312
|
+
tenant_id: { type: "string", description: "The UUID of the tenant." },
|
|
10313
|
+
position: {
|
|
10314
|
+
type: "integer",
|
|
10315
|
+
description: "The entry's chain_position, as a custody claim or audit entry names it.",
|
|
10316
|
+
},
|
|
10317
|
+
},
|
|
10318
|
+
required: ["tenant_id", "position"],
|
|
10319
|
+
},
|
|
10320
|
+
},
|
|
10321
|
+
{
|
|
10322
|
+
name: "list_trusted_endpoints",
|
|
10323
|
+
description:
|
|
10324
|
+
"LIST THE TENANT'S DECLARED TRUSTED ENDPOINTS (GET /api/v1/egress/trusted-endpoints): " +
|
|
10325
|
+
"each host the tenant declared with its purposes, and `locality_label`. Every entry is " +
|
|
10326
|
+
"an UNVERIFIED tenant attestation, not network locality: loopctl does not prove the " +
|
|
10327
|
+
"tenant owns the host. Read-only, on this session's own key; the route has no role " +
|
|
10328
|
+
"plug, so any key of the tenant reads it. Declare with `declare_trusted_endpoint`, " +
|
|
10329
|
+
"revoke with `revoke_trusted_endpoint` (both need the user key).",
|
|
10330
|
+
inputSchema: { type: "object", properties: {}, required: [] },
|
|
10331
|
+
},
|
|
10332
|
+
{
|
|
10333
|
+
name: "list_authenticators",
|
|
10334
|
+
description:
|
|
10335
|
+
"LIST THE TENANT'S ENROLLED WEBAUTHN AUTHENTICATORS (GET " +
|
|
10336
|
+
"/api/v1/tenants/:id/authenticators): each one's `id` (what `rename_authenticator` and " +
|
|
10337
|
+
"`revoke_authenticator` take), `friendly_name`, `credential_fingerprint`, " +
|
|
10338
|
+
"`attestation_format`, `inserted_at` and `last_used_at`, never credential material. " +
|
|
10339
|
+
"Confirm a revoke against the FINGERPRINT: the label is rewritable by any user key. No " +
|
|
10340
|
+
"WebAuthn assertion is needed. Needs a USER-role key of THIS tenant, sent on " +
|
|
10341
|
+
"LOOPCTL_USER_KEY verbatim when set, else the default key: 403 insufficient_role below " +
|
|
10342
|
+
"user, 403 Forbidden when `tenant_id` is not the key's own tenant (`get_tenant` gives " +
|
|
10343
|
+
"it). A `tenant_id` that is not a UUID is refused by the tool, sending nothing; one in " +
|
|
10344
|
+
"upper case is sent lower case, since loopctl compares it as text.",
|
|
10345
|
+
inputSchema: {
|
|
10346
|
+
type: "object",
|
|
10347
|
+
properties: {
|
|
10348
|
+
tenant_id: { type: "string", description: "The UUID of your tenant." },
|
|
10349
|
+
},
|
|
10350
|
+
required: ["tenant_id"],
|
|
10351
|
+
},
|
|
10352
|
+
},
|
|
10353
|
+
{
|
|
10354
|
+
name: "rename_authenticator",
|
|
10355
|
+
description:
|
|
10356
|
+
"RELABEL AN ENROLLED AUTHENTICATOR (PATCH /api/v1/tenants/:id/authenticators/:auth_id): " +
|
|
10357
|
+
"only `friendly_name` changes (trimmed, not blank, at most 120 bytes); no credential " +
|
|
10358
|
+
"material, and no WebAuthn assertion is needed. The old and new label are recorded in " +
|
|
10359
|
+
"the audit chain against the calling key. Needs a USER-role key of THIS tenant, sent on " +
|
|
10360
|
+
"LOOPCTL_USER_KEY verbatim when set, else the default key: 403 insufficient_role below " +
|
|
10361
|
+
"user, 403 Forbidden for another tenant's id. 400 without a string `friendly_name`, 404 " +
|
|
10362
|
+
"for an unknown authenticator, 422 friendly_name_blank, friendly_name_invalid or " +
|
|
10363
|
+
"friendly_name_too_long, 429 past the tenant's rename budget (300 an hour), 500 when the " +
|
|
10364
|
+
"rename or its audit entry could not be written. Refused by the tool, sending nothing: a " +
|
|
10365
|
+
"non-UUID id and a blank or over-long `friendly_name`.",
|
|
10366
|
+
inputSchema: {
|
|
10367
|
+
type: "object",
|
|
10368
|
+
properties: {
|
|
10369
|
+
tenant_id: { type: "string", description: "The UUID of your tenant." },
|
|
10370
|
+
authenticator_id: {
|
|
10371
|
+
type: "string",
|
|
10372
|
+
description: "The authenticator's `id` from list_authenticators.",
|
|
10373
|
+
},
|
|
10374
|
+
friendly_name: { type: "string", description: "The new label, at most 120 bytes." },
|
|
10375
|
+
},
|
|
10376
|
+
required: ["tenant_id", "authenticator_id", "friendly_name"],
|
|
10377
|
+
},
|
|
10378
|
+
},
|
|
10379
|
+
{
|
|
10380
|
+
name: "update_tenant",
|
|
10381
|
+
description:
|
|
10382
|
+
"UPDATE THE TENANT'S OWN PROFILE (PATCH /api/v1/tenants/me): any of `name`, `email`, " +
|
|
10383
|
+
"`settings`, `default_story_budget_millicents` and `token_data_retention_days`; answers " +
|
|
10384
|
+
"the updated `tenant`. `settings` is MERGED into the stored map key by key (a key you " +
|
|
10385
|
+
"leave out keeps its value). Needs a USER-role key (`role: :user` with the hierarchy), " +
|
|
10386
|
+
"sent on LOOPCTL_USER_KEY verbatim when set, else the default key; an agent or " +
|
|
10387
|
+
"orchestrator key is 403 insufficient_role. 422 for a malformed or taken email, a " +
|
|
10388
|
+
"settings value loopctl types (knowledge_auto_extract, kb_curation_log) that is not a " +
|
|
10389
|
+
"boolean, a budget that is not above 0, or a retention that is not an integer of at " +
|
|
10390
|
+
"least 30 days (null turns retention off). The slug is immutable and is not a " +
|
|
10391
|
+
"parameter: loopctl would ignore one and answer 200 with it unchanged, so a call " +
|
|
10392
|
+
"carrying `slug`, or carrying no field at all, is refused by the tool, sending nothing. " +
|
|
10393
|
+
"Read the tenant with `get_tenant`.",
|
|
10394
|
+
inputSchema: {
|
|
10395
|
+
type: "object",
|
|
10396
|
+
properties: {
|
|
10397
|
+
name: { type: "string", description: "Optional: the tenant's display name." },
|
|
10398
|
+
email: { type: "string", description: "Optional: the tenant's contact email." },
|
|
10399
|
+
settings: {
|
|
10400
|
+
type: "object",
|
|
10401
|
+
description: "Optional: settings keys to merge into the stored settings.",
|
|
10402
|
+
},
|
|
10403
|
+
default_story_budget_millicents: {
|
|
10404
|
+
type: "integer",
|
|
10405
|
+
description: "Optional: the default per-story budget, above 0.",
|
|
10406
|
+
},
|
|
10407
|
+
token_data_retention_days: {
|
|
10408
|
+
type: ["integer", "null"],
|
|
10409
|
+
description: "Optional: days of token data kept, at least 30; null turns it off.",
|
|
10410
|
+
},
|
|
10411
|
+
},
|
|
10412
|
+
required: [],
|
|
10413
|
+
},
|
|
10414
|
+
},
|
|
10415
|
+
{
|
|
10416
|
+
name: "webhook_create",
|
|
10417
|
+
description:
|
|
10418
|
+
"SUBSCRIBE A URL TO LOOPCTL EVENTS (POST /api/v1/webhooks): `url` (https or http), " +
|
|
10419
|
+
"`events` (a non-empty list such as story.verified, story.status_changed, " +
|
|
10420
|
+
"token.budget_exceeded, webhook.test) and optional `project_id` (UUID, slug or repo " +
|
|
10421
|
+
"name; omitted = every project). Deliveries are signed `X-Webhook-Signature: " +
|
|
10422
|
+
"t=<unix>,v1=<hmac_sha256>` over `<t>.<raw_body>` with the subscription's signing " +
|
|
10423
|
+
"secret, which loopctl returns ONCE. THIS TOOL NEVER RETURNS IT: it is written to " +
|
|
10424
|
+
"`secret_file` (an absolute path that must not exist yet, created 0600 before the " +
|
|
10425
|
+
"request) and the result carries the subscription without it. Needs a USER-role key " +
|
|
10426
|
+
"(`role: :user` with the hierarchy), sent on LOOPCTL_USER_KEY verbatim when set, else " +
|
|
10427
|
+
"the default key; an agent or orchestrator key is 403 insufficient_role. 422 for an " +
|
|
10428
|
+
"unknown event type, a malformed URL, a destination the egress guard refuses (private, " +
|
|
10429
|
+
"loopback, link-local and similar addresses unless the operator allowlist carves them " +
|
|
10430
|
+
"out for webhook delivery; the message names which), or the tenant's webhook limit; " +
|
|
10431
|
+
"429 past the rate limit. Refused by the tool, sending nothing: a blank url, empty or " +
|
|
10432
|
+
"non-string events, a blank project_id, and a secret_file that is not absolute, exists " +
|
|
10433
|
+
"already or sits in a missing directory.",
|
|
10434
|
+
inputSchema: {
|
|
10435
|
+
type: "object",
|
|
10436
|
+
properties: {
|
|
10437
|
+
url: { type: "string", description: "The URL deliveries are POSTed to." },
|
|
10438
|
+
events: {
|
|
10439
|
+
type: "array",
|
|
10440
|
+
items: { type: "string" },
|
|
10441
|
+
description: "The event types to deliver, e.g. [\"story.verified\"].",
|
|
10442
|
+
},
|
|
10443
|
+
project_id: {
|
|
10444
|
+
type: "string",
|
|
10445
|
+
description: "Optional: limit deliveries to one project (UUID, slug or repo name).",
|
|
10446
|
+
},
|
|
10447
|
+
secret_file: {
|
|
10448
|
+
type: "string",
|
|
10449
|
+
description:
|
|
10450
|
+
"REQUIRED. Absolute path, which must not exist yet, the signing secret is written " +
|
|
10451
|
+
"to (mode 0600). Move it where the receiver reads it, then delete the file.",
|
|
10452
|
+
},
|
|
10453
|
+
},
|
|
10454
|
+
required: ["url", "events", "secret_file"],
|
|
10455
|
+
},
|
|
10456
|
+
},
|
|
10457
|
+
{
|
|
10458
|
+
name: "webhook_list",
|
|
10459
|
+
description:
|
|
10460
|
+
"LIST THE TENANT'S WEBHOOK SUBSCRIPTIONS (GET /api/v1/webhooks), newest first: each " +
|
|
10461
|
+
"with `id`, `url`, `events`, `project_id`, `active`, `consecutive_failures` and " +
|
|
10462
|
+
"`last_delivery_at` (never the signing secret), plus `meta` paging. `page` and " +
|
|
10463
|
+
"`page_size` (1..100, default 20). Needs a USER-role key, keyed as webhook_create; an " +
|
|
10464
|
+
"agent or orchestrator key is 403 insufficient_role. A bad page or page_size is " +
|
|
10465
|
+
"refused by the tool, sending nothing: loopctl would clamp or drop it.",
|
|
10466
|
+
inputSchema: {
|
|
10467
|
+
type: "object",
|
|
10468
|
+
properties: {
|
|
10469
|
+
page: { type: "integer", description: "Optional page number (default 1)." },
|
|
10470
|
+
page_size: { type: "integer", description: "Optional page size, 1..100 (default 20)." },
|
|
10471
|
+
},
|
|
10472
|
+
required: [],
|
|
10473
|
+
},
|
|
10474
|
+
},
|
|
10475
|
+
{
|
|
10476
|
+
name: "webhook_update",
|
|
10477
|
+
description:
|
|
10478
|
+
"EDIT A WEBHOOK SUBSCRIPTION (PATCH /api/v1/webhooks/:id): any of `url`, `events`, " +
|
|
10479
|
+
"`project_id` and `active` (false pauses it; true re-activates it and resets " +
|
|
10480
|
+
"`consecutive_failures`). A change of url or project, or a re-activation, is vetted " +
|
|
10481
|
+
"against the egress guard as webhook_create is. Needs a USER-role key, keyed as " +
|
|
10482
|
+
"webhook_create; an agent or orchestrator key is 403 insufficient_role. 404 for a " +
|
|
10483
|
+
"subscription that is not this tenant's; 422 for an unknown event type, a malformed " +
|
|
10484
|
+
"URL or a refused destination. A subscription's project cannot be cleared. Refused by " +
|
|
10485
|
+
"the tool, sending nothing: a non-UUID `webhook_id`, a call naming no field (loopctl " +
|
|
10486
|
+
"would answer 200 unchanged), a null or blank project_id, empty or non-string events, " +
|
|
10487
|
+
"and a non-boolean active.",
|
|
10488
|
+
inputSchema: {
|
|
10489
|
+
type: "object",
|
|
10490
|
+
properties: {
|
|
10491
|
+
webhook_id: { type: "string", description: "The UUID of the subscription." },
|
|
10492
|
+
url: { type: "string", description: "Optional: the new delivery URL." },
|
|
10493
|
+
events: {
|
|
10494
|
+
type: "array",
|
|
10495
|
+
items: { type: "string" },
|
|
10496
|
+
description: "Optional: the full new list of event types (replaces the old list).",
|
|
10497
|
+
},
|
|
10498
|
+
project_id: {
|
|
10499
|
+
type: "string",
|
|
10500
|
+
description: "Optional: the project to deliver for (UUID, slug or repo name).",
|
|
10501
|
+
},
|
|
10502
|
+
active: { type: "boolean", description: "Optional: false pauses, true re-activates." },
|
|
10503
|
+
},
|
|
10504
|
+
required: ["webhook_id"],
|
|
10505
|
+
},
|
|
10506
|
+
},
|
|
10507
|
+
{
|
|
10508
|
+
name: "webhook_delete",
|
|
10509
|
+
description:
|
|
10510
|
+
"DELETE A WEBHOOK SUBSCRIPTION (DELETE /api/v1/webhooks/:id) and every delivery still " +
|
|
10511
|
+
"pending for it; audited; answers 204. Needs a USER-role key, keyed as webhook_create; " +
|
|
10512
|
+
"an agent or orchestrator key is 403 insufficient_role. 404 for a subscription that is " +
|
|
10513
|
+
"not this tenant's. A non-UUID `webhook_id` is refused by the tool, sending nothing.",
|
|
10514
|
+
inputSchema: {
|
|
10515
|
+
type: "object",
|
|
10516
|
+
properties: {
|
|
10517
|
+
webhook_id: { type: "string", description: "The UUID of the subscription." },
|
|
10518
|
+
},
|
|
10519
|
+
required: ["webhook_id"],
|
|
10520
|
+
},
|
|
10521
|
+
},
|
|
10522
|
+
{
|
|
10523
|
+
name: "webhook_test",
|
|
10524
|
+
description:
|
|
10525
|
+
"SEND A TEST EVENT TO A WEBHOOK (POST /api/v1/webhooks/:id/test): enqueues one " +
|
|
10526
|
+
"`webhook.test` delivery, even to an inactive subscription, and answers its " +
|
|
10527
|
+
"`webhook_event_id` with status pending. Read the outcome with webhook_deliveries. " +
|
|
10528
|
+
"Needs a USER-role key, keyed as webhook_create; an agent or orchestrator key is 403 " +
|
|
10529
|
+
"insufficient_role. 404 for a subscription that is not this tenant's. A non-UUID " +
|
|
10530
|
+
"`webhook_id` is refused by the tool, sending nothing.",
|
|
10531
|
+
inputSchema: {
|
|
10532
|
+
type: "object",
|
|
10533
|
+
properties: {
|
|
10534
|
+
webhook_id: { type: "string", description: "The UUID of the subscription." },
|
|
10535
|
+
},
|
|
10536
|
+
required: ["webhook_id"],
|
|
10537
|
+
},
|
|
10538
|
+
},
|
|
10539
|
+
{
|
|
10540
|
+
name: "webhook_deliveries",
|
|
10541
|
+
description:
|
|
10542
|
+
"LIST A WEBHOOK'S RECENT DELIVERY ATTEMPTS (GET /api/v1/webhooks/:id/deliveries), " +
|
|
10543
|
+
"newest first: each with `event_type`, `status`, `attempts`, `delivered_at` and " +
|
|
10544
|
+
"`error`. A failed attempt's error carries the HTTP status and response content-type, " +
|
|
10545
|
+
"never the receiver's response body. `page` and `page_size` (1..100, default 25). " +
|
|
10546
|
+
"Needs a USER-role key, keyed as webhook_create; an agent or orchestrator key is 403 " +
|
|
10547
|
+
"insufficient_role. 404 for a subscription that is not this tenant's. Refused by the " +
|
|
10548
|
+
"tool, sending nothing: a non-UUID `webhook_id` and a bad page or page_size.",
|
|
10549
|
+
inputSchema: {
|
|
10550
|
+
type: "object",
|
|
10551
|
+
properties: {
|
|
10552
|
+
webhook_id: { type: "string", description: "The UUID of the subscription." },
|
|
10553
|
+
page: { type: "integer", description: "Optional page number (default 1)." },
|
|
10554
|
+
page_size: { type: "integer", description: "Optional page size, 1..100 (default 25)." },
|
|
10555
|
+
},
|
|
10556
|
+
required: ["webhook_id"],
|
|
10557
|
+
},
|
|
10558
|
+
},
|
|
10559
|
+
{
|
|
10560
|
+
name: "token_budget_list",
|
|
10561
|
+
description:
|
|
10562
|
+
"LIST THE TENANT'S TOKEN BUDGETS (GET /api/v1/token-budgets), newest first: each with " +
|
|
10563
|
+
"`scope_type`, `scope_id`, `budget_millicents`, token limits, `alert_threshold_pct`, " +
|
|
10564
|
+
"and the live `current_spend_millicents`, `remaining_millicents` and " +
|
|
10565
|
+
"`utilization_pct`, plus `meta` paging. Filters `scope_type` (project, epic, story) " +
|
|
10566
|
+
"and `scope_id` (UUID); `page` and `page_size` (1..100, default 20). Any key: " +
|
|
10567
|
+
"`role: :agent`, sent as the session's own. Refused by the tool, sending nothing: an " +
|
|
10568
|
+
"unknown scope_type (loopctl would answer an empty list), a non-UUID scope_id, and a " +
|
|
10569
|
+
"bad page or page_size.",
|
|
10570
|
+
inputSchema: {
|
|
10571
|
+
type: "object",
|
|
10572
|
+
properties: {
|
|
10573
|
+
scope_type: {
|
|
10574
|
+
type: "string",
|
|
10575
|
+
enum: ["project", "epic", "story"],
|
|
10576
|
+
description: "Optional scope_type filter.",
|
|
10577
|
+
},
|
|
10578
|
+
scope_id: { type: "string", description: "Optional: the scoped entity's UUID." },
|
|
10579
|
+
page: { type: "integer", description: "Optional page number (default 1)." },
|
|
10580
|
+
page_size: { type: "integer", description: "Optional page size, 1..100 (default 20)." },
|
|
10581
|
+
},
|
|
10582
|
+
required: [],
|
|
10583
|
+
},
|
|
10584
|
+
},
|
|
10585
|
+
{
|
|
10586
|
+
name: "token_budget_get",
|
|
10587
|
+
description:
|
|
10588
|
+
"READ ONE TOKEN BUDGET (GET /api/v1/token-budgets/:id) with its live spend, remaining " +
|
|
10589
|
+
"and utilization, plus `effective_budget_millicents` and `budget_source` (the budget " +
|
|
10590
|
+
"that actually governs the scope after inheritance from epic, project or the tenant " +
|
|
10591
|
+
"default). Any key: `role: :agent`, sent as the session's own. 404 for a budget that " +
|
|
10592
|
+
"is not this tenant's. A non-UUID `budget_id` is refused by the tool, sending nothing.",
|
|
10593
|
+
inputSchema: {
|
|
10594
|
+
type: "object",
|
|
10595
|
+
properties: {
|
|
10596
|
+
budget_id: { type: "string", description: "The UUID of the budget." },
|
|
10597
|
+
},
|
|
10598
|
+
required: ["budget_id"],
|
|
10599
|
+
},
|
|
10600
|
+
},
|
|
10601
|
+
{
|
|
10602
|
+
name: "token_budget_update",
|
|
10603
|
+
description:
|
|
10604
|
+
"CHANGE A TOKEN BUDGET (PATCH /api/v1/token-budgets/:id): any of " +
|
|
10605
|
+
"`budget_millicents` (above 0), `budget_input_tokens` and `budget_output_tokens` (0 or " +
|
|
10606
|
+
"more, null clears), `alert_threshold_pct` (1..100) and `metadata` (replaces the " +
|
|
10607
|
+
"stored map). Changing the amount or threshold re-arms the warning and exceeded " +
|
|
10608
|
+
"alerts. The scope is fixed: delete and re-create to move a budget. Needs an " +
|
|
10609
|
+
"ORCHESTRATOR-role key or higher (`role: :orchestrator` with the hierarchy), sent on " +
|
|
10610
|
+
"LOOPCTL_ORCH_KEY verbatim, else LOOPCTL_USER_KEY, else the default key; an agent key " +
|
|
10611
|
+
"is 403 insufficient_role, and an agent-rooted tenant is 403 custody_tier_required. " +
|
|
10612
|
+
"404 for a budget that is not this tenant's; 422 for a value out of range. Refused by " +
|
|
10613
|
+
"the tool, sending nothing: a non-UUID `budget_id`, a call naming no field or naming " +
|
|
10614
|
+
"scope_type or scope_id (loopctl would ignore them and answer 200 unchanged), and a " +
|
|
10615
|
+
"metadata that is not an object.",
|
|
10616
|
+
inputSchema: {
|
|
10617
|
+
type: "object",
|
|
10618
|
+
properties: {
|
|
10619
|
+
budget_id: { type: "string", description: "The UUID of the budget." },
|
|
10620
|
+
budget_millicents: {
|
|
10621
|
+
type: "integer",
|
|
10622
|
+
description: "Optional: the budget in millicents (1/1000 of a cent), above 0.",
|
|
10623
|
+
},
|
|
10624
|
+
budget_input_tokens: {
|
|
10625
|
+
type: ["integer", "null"],
|
|
10626
|
+
description: "Optional: an input-token limit, 0 or more; null clears it.",
|
|
10627
|
+
},
|
|
10628
|
+
budget_output_tokens: {
|
|
10629
|
+
type: ["integer", "null"],
|
|
10630
|
+
description: "Optional: an output-token limit, 0 or more; null clears it.",
|
|
10631
|
+
},
|
|
10632
|
+
alert_threshold_pct: {
|
|
10633
|
+
type: "integer",
|
|
10634
|
+
minimum: 1,
|
|
10635
|
+
maximum: 100,
|
|
10636
|
+
description: "Optional: the percentage of the budget that fires the warning.",
|
|
10637
|
+
},
|
|
10638
|
+
metadata: { type: "object", description: "Optional: replaces the stored metadata." },
|
|
10639
|
+
},
|
|
10640
|
+
required: ["budget_id"],
|
|
10641
|
+
},
|
|
10642
|
+
},
|
|
10643
|
+
{
|
|
10644
|
+
name: "token_budget_delete",
|
|
10645
|
+
description:
|
|
10646
|
+
"DELETE A TOKEN BUDGET (DELETE /api/v1/token-budgets/:id); audited. Its usage reports " +
|
|
10647
|
+
"stay, and the scope falls back to an inherited budget. Needs a USER-role key " +
|
|
10648
|
+
"(`role: :user` with the hierarchy), sent on LOOPCTL_USER_KEY verbatim when set, else " +
|
|
10649
|
+
"the default key; an agent or orchestrator key is 403 insufficient_role, and an " +
|
|
10650
|
+
"agent-rooted tenant is 403 custody_tier_required. 404 for a budget that is not this " +
|
|
10651
|
+
"tenant's. A non-UUID `budget_id` is refused by the tool, sending nothing.",
|
|
10652
|
+
inputSchema: {
|
|
10653
|
+
type: "object",
|
|
10654
|
+
properties: {
|
|
10655
|
+
budget_id: { type: "string", description: "The UUID of the budget." },
|
|
10656
|
+
},
|
|
10657
|
+
required: ["budget_id"],
|
|
10658
|
+
},
|
|
10659
|
+
},
|
|
10660
|
+
{
|
|
10661
|
+
name: "token_usage_delete",
|
|
10662
|
+
description:
|
|
10663
|
+
"SOFT-DELETE A TOKEN USAGE REPORT (DELETE /api/v1/token-usage/:id): the report leaves " +
|
|
10664
|
+
"every total and analytics read, and budget warning flags reset when spend drops back " +
|
|
10665
|
+
"below them; audited. To adjust a report rather than remove it, use " +
|
|
10666
|
+
"token_usage_correct. Needs a USER-role key (`role: :user` with the hierarchy), sent on " +
|
|
10667
|
+
"LOOPCTL_USER_KEY verbatim when set, else the default key; an agent or orchestrator " +
|
|
10668
|
+
"key is 403 insufficient_role, and an agent-rooted tenant is 403 " +
|
|
10669
|
+
"custody_tier_required. 404 for a report that is missing, another tenant's or already " +
|
|
10670
|
+
"deleted. A non-UUID `report_id` is refused by the tool, sending nothing.",
|
|
10671
|
+
inputSchema: {
|
|
10672
|
+
type: "object",
|
|
10673
|
+
properties: {
|
|
10674
|
+
report_id: { type: "string", description: "The UUID of the token usage report." },
|
|
10675
|
+
},
|
|
10676
|
+
required: ["report_id"],
|
|
10677
|
+
},
|
|
10678
|
+
},
|
|
10679
|
+
{
|
|
10680
|
+
name: "token_usage_correct",
|
|
10681
|
+
description:
|
|
10682
|
+
"CORRECT A TOKEN USAGE REPORT (POST /api/v1/token-usage/:id/correction): records a NEW " +
|
|
10683
|
+
"report that references the original and carries signed deltas, so negative " +
|
|
10684
|
+
"`input_tokens`, `output_tokens` and `cost_millicents` subtract from the story's " +
|
|
10685
|
+
"totals. All three are required (0 for no change). Optional `model_name` and `phase` " +
|
|
10686
|
+
"(planning, implementing, reviewing, other) default to the original's; optional " +
|
|
10687
|
+
"`session_id`, `skill_version_id` and `metadata`. Answers 201 with the correction. " +
|
|
10688
|
+
"Needs a USER-role key, keyed as token_usage_delete; an agent or orchestrator key is " +
|
|
10689
|
+
"403 insufficient_role, and an agent-rooted tenant is 403 custody_tier_required. 404 " +
|
|
10690
|
+
"for an original that is missing, another tenant's or deleted; 422 when the " +
|
|
10691
|
+
"correction would drive any total below 0, when the original is itself a correction, " +
|
|
10692
|
+
"for an unknown phase, or for a skill_version_id that is not this tenant's. Refused by " +
|
|
10693
|
+
"the tool, sending nothing: a non-UUID `report_id` or skill_version_id, a delta that " +
|
|
10694
|
+
"is missing or not an integer, and a metadata that is not an object.",
|
|
10695
|
+
inputSchema: {
|
|
10696
|
+
type: "object",
|
|
10697
|
+
properties: {
|
|
10698
|
+
report_id: { type: "string", description: "The UUID of the report to correct." },
|
|
10699
|
+
input_tokens: { type: "integer", description: "Input-token delta (negative subtracts)." },
|
|
10700
|
+
output_tokens: { type: "integer", description: "Output-token delta (negative subtracts)." },
|
|
10701
|
+
cost_millicents: { type: "integer", description: "Cost delta in millicents." },
|
|
10702
|
+
model_name: { type: "string", description: "Optional: defaults to the original's." },
|
|
10703
|
+
phase: {
|
|
10704
|
+
type: "string",
|
|
10705
|
+
enum: ["planning", "implementing", "reviewing", "other"],
|
|
10706
|
+
description: "Optional: defaults to the original's.",
|
|
10707
|
+
},
|
|
10708
|
+
session_id: { type: "string", description: "Optional session id." },
|
|
10709
|
+
skill_version_id: { type: "string", description: "Optional: a skill version UUID." },
|
|
10710
|
+
metadata: { type: "object", description: "Optional structured detail." },
|
|
10711
|
+
},
|
|
10712
|
+
required: ["report_id", "input_tokens", "output_tokens", "cost_millicents"],
|
|
10713
|
+
},
|
|
10714
|
+
},
|
|
10715
|
+
{
|
|
10716
|
+
name: "cost_anomaly_resolve",
|
|
10717
|
+
description:
|
|
10718
|
+
"RESOLVE A COST ANOMALY (PATCH /api/v1/cost-anomalies/:id): marks it resolved; " +
|
|
10719
|
+
"audited. Answers its `id`, `resolved` and `updated_at`. List them with " +
|
|
10720
|
+
"get_cost_anomalies. Needs a USER-role key (`role: :user` with the hierarchy), sent on " +
|
|
10721
|
+
"LOOPCTL_USER_KEY verbatim when set, else the default key; an agent or orchestrator " +
|
|
10722
|
+
"key is 403 insufficient_role, and an agent-rooted tenant is 403 " +
|
|
10723
|
+
"custody_tier_required. 404 for an anomaly that is not this tenant's. A non-UUID " +
|
|
10724
|
+
"`anomaly_id` is refused by the tool, sending nothing.",
|
|
10725
|
+
inputSchema: {
|
|
10726
|
+
type: "object",
|
|
10727
|
+
properties: {
|
|
10728
|
+
anomaly_id: { type: "string", description: "The UUID of the cost anomaly." },
|
|
10729
|
+
},
|
|
10730
|
+
required: ["anomaly_id"],
|
|
10731
|
+
},
|
|
10732
|
+
},
|
|
10733
|
+
{
|
|
10734
|
+
name: "ingestion_anomaly_update",
|
|
10735
|
+
description:
|
|
10736
|
+
"RESOLVE, ARCHIVE OR UN-ARCHIVE AN INGESTION ANOMALY (PATCH " +
|
|
10737
|
+
"/api/v1/ingestion-anomalies/:id): `action` resolve (the default) marks it resolved; " +
|
|
10738
|
+
"archive hides it from the default list and suppresses re-detection, for a retired " +
|
|
10739
|
+
"source_type; unarchive restores monitoring. Audited. Answers its `id`, `resolved`, " +
|
|
10740
|
+
"`archived` and `updated_at`. List them with get_ingestion_anomalies. Needs a " +
|
|
10741
|
+
"USER-role key, keyed as cost_anomaly_resolve; an agent or orchestrator key is 403 " +
|
|
10742
|
+
"insufficient_role, and an agent-rooted tenant is 403 custody_tier_required. 404 for " +
|
|
10743
|
+
"an anomaly that is not this tenant's. Refused by the tool, sending nothing: a " +
|
|
10744
|
+
"non-UUID `anomaly_id` and an unknown action.",
|
|
10745
|
+
inputSchema: {
|
|
10746
|
+
type: "object",
|
|
10747
|
+
properties: {
|
|
10748
|
+
anomaly_id: { type: "string", description: "The UUID of the ingestion anomaly." },
|
|
10749
|
+
action: {
|
|
10750
|
+
type: "string",
|
|
10751
|
+
enum: ["resolve", "archive", "unarchive"],
|
|
10752
|
+
description: "Optional: resolve (default), archive or unarchive.",
|
|
10753
|
+
},
|
|
10754
|
+
},
|
|
10755
|
+
required: ["anomaly_id"],
|
|
10756
|
+
},
|
|
10757
|
+
},
|
|
10758
|
+
{
|
|
10759
|
+
name: "cost_trends",
|
|
10760
|
+
description:
|
|
10761
|
+
"READ THE COST TREND (GET /api/v1/analytics/trends): token and cost totals per day, or " +
|
|
10762
|
+
"per week with `granularity` weekly, with paging `meta`. Optional `project_id` (UUID, " +
|
|
10763
|
+
"slug or repo name), `since` and `until` (YYYY-MM-DD), `page` and `page_size` (1..100, " +
|
|
10764
|
+
"default 20). Needs an ORCHESTRATOR-role key or higher (`role: :orchestrator` with the " +
|
|
10765
|
+
"hierarchy), sent on LOOPCTL_ORCH_KEY verbatim, else LOOPCTL_USER_KEY, else the " +
|
|
10766
|
+
"default key; an agent key is 403 insufficient_role. 422 for a project_id naming no " +
|
|
10767
|
+
"project. Refused by the tool, sending nothing: a granularity other than daily or " +
|
|
10768
|
+
"weekly (loopctl would answer daily), a date that is not a real YYYY-MM-DD (loopctl " +
|
|
10769
|
+
"would drop it and answer for all time), and a bad page or page_size.",
|
|
10770
|
+
inputSchema: {
|
|
10771
|
+
type: "object",
|
|
10772
|
+
properties: {
|
|
10773
|
+
granularity: {
|
|
10774
|
+
type: "string",
|
|
10775
|
+
enum: ["daily", "weekly"],
|
|
10776
|
+
description: "Optional: daily (default) or weekly.",
|
|
10777
|
+
},
|
|
10778
|
+
project_id: {
|
|
10779
|
+
type: "string",
|
|
10780
|
+
description: "Optional: one project (UUID, slug or repo name).",
|
|
10781
|
+
},
|
|
10782
|
+
since: { type: "string", description: "Optional start date, YYYY-MM-DD." },
|
|
10783
|
+
until: { type: "string", description: "Optional end date, YYYY-MM-DD." },
|
|
10784
|
+
page: { type: "integer", description: "Optional page number (default 1)." },
|
|
10785
|
+
page_size: { type: "integer", description: "Optional page size, 1..100 (default 20)." },
|
|
10786
|
+
},
|
|
10787
|
+
required: [],
|
|
10788
|
+
},
|
|
10789
|
+
},
|
|
10790
|
+
{
|
|
10791
|
+
name: "model_mix",
|
|
10792
|
+
description:
|
|
10793
|
+
"READ THE MODEL-MIX MATRIX (GET /api/v1/analytics/model-mix): token and cost totals, " +
|
|
10794
|
+
"story counts and verification outcomes per (model_name, phase), plus a comparison of " +
|
|
10795
|
+
"agents that mix models against agents that use one. Optional `project_id` (UUID, slug " +
|
|
10796
|
+
"or repo name), `agent_id` (UUID), `since` and `until` (YYYY-MM-DD). Needs an " +
|
|
10797
|
+
"ORCHESTRATOR-role key or higher, keyed as cost_trends; an agent key is 403 " +
|
|
10798
|
+
"insufficient_role. 422 for a project_id naming no project. Refused by the tool, " +
|
|
10799
|
+
"sending nothing: a non-UUID agent_id and a date that is not a real YYYY-MM-DD.",
|
|
10800
|
+
inputSchema: {
|
|
10801
|
+
type: "object",
|
|
10802
|
+
properties: {
|
|
10803
|
+
project_id: {
|
|
10804
|
+
type: "string",
|
|
10805
|
+
description: "Optional: one project (UUID, slug or repo name).",
|
|
10806
|
+
},
|
|
10807
|
+
agent_id: { type: "string", description: "Optional: one agent's UUID." },
|
|
10808
|
+
since: { type: "string", description: "Optional start date, YYYY-MM-DD." },
|
|
10809
|
+
until: { type: "string", description: "Optional end date, YYYY-MM-DD." },
|
|
10810
|
+
},
|
|
10811
|
+
required: [],
|
|
10812
|
+
},
|
|
10813
|
+
},
|
|
10814
|
+
{
|
|
10815
|
+
name: "agent_model_profile",
|
|
10816
|
+
description:
|
|
10817
|
+
"READ ONE AGENT'S MODEL PROFILE (GET /api/v1/analytics/agents/:id/model-profile): the " +
|
|
10818
|
+
"models it used across phases, `model_count` and `is_model_blender` (more than one " +
|
|
10819
|
+
"model). Optional `project_id` (UUID, slug or repo name), `since` and `until` " +
|
|
10820
|
+
"(YYYY-MM-DD). Needs an ORCHESTRATOR-role key or higher, keyed as cost_trends; an " +
|
|
10821
|
+
"agent key is 403 insufficient_role. 404 for an agent that is not this tenant's, 422 " +
|
|
10822
|
+
"for a project_id naming no project. Refused by the tool, sending nothing: a non-UUID " +
|
|
10823
|
+
"`agent_id` and a date that is not a real YYYY-MM-DD.",
|
|
10824
|
+
inputSchema: {
|
|
10825
|
+
type: "object",
|
|
10826
|
+
properties: {
|
|
10827
|
+
agent_id: { type: "string", description: "The agent's UUID." },
|
|
10828
|
+
project_id: {
|
|
10829
|
+
type: "string",
|
|
10830
|
+
description: "Optional: one project (UUID, slug or repo name).",
|
|
10831
|
+
},
|
|
10832
|
+
since: { type: "string", description: "Optional start date, YYYY-MM-DD." },
|
|
10833
|
+
until: { type: "string", description: "Optional end date, YYYY-MM-DD." },
|
|
10834
|
+
},
|
|
10835
|
+
required: ["agent_id"],
|
|
10836
|
+
},
|
|
10837
|
+
},
|
|
10838
|
+
|
|
9774
10839
|
{
|
|
9775
10840
|
name: "factory_overview",
|
|
9776
10841
|
description:
|
|
@@ -12997,6 +14062,72 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
12997
14062
|
return await storyDependencyRemoveTool(args);
|
|
12998
14063
|
case "story_dependency_list":
|
|
12999
14064
|
return await storyDependencyListTool(args);
|
|
14065
|
+
case "bulk_claim":
|
|
14066
|
+
return await bulkClaimTool(args);
|
|
14067
|
+
case "unclaim_story":
|
|
14068
|
+
return await unclaimStoryTool(args);
|
|
14069
|
+
case "bulk_verify":
|
|
14070
|
+
return await bulkVerifyTool(args);
|
|
14071
|
+
case "bulk_reject":
|
|
14072
|
+
return await bulkRejectTool(args);
|
|
14073
|
+
case "register_agent":
|
|
14074
|
+
return await registerAgentTool(args);
|
|
14075
|
+
case "list_agents":
|
|
14076
|
+
return await listAgentsTool(args);
|
|
14077
|
+
case "get_agent":
|
|
14078
|
+
return await getAgentTool(args);
|
|
14079
|
+
case "api_key_list":
|
|
14080
|
+
return await apiKeyListTool(args);
|
|
14081
|
+
case "api_key_rotate":
|
|
14082
|
+
return await apiKeyRotateTool(args);
|
|
14083
|
+
case "channel_quarantine_list":
|
|
14084
|
+
return await channelQuarantinedTool(args);
|
|
14085
|
+
case "channel_quarantine_release":
|
|
14086
|
+
return await channelReleaseTool(args);
|
|
14087
|
+
case "audit_inclusion_proof":
|
|
14088
|
+
return await auditInclusionProofTool(args);
|
|
14089
|
+
case "list_trusted_endpoints":
|
|
14090
|
+
return await listTrustedEndpointsTool(args);
|
|
14091
|
+
case "list_authenticators":
|
|
14092
|
+
return await listAuthenticatorsTool(args);
|
|
14093
|
+
case "rename_authenticator":
|
|
14094
|
+
return await renameAuthenticatorTool(args);
|
|
14095
|
+
case "update_tenant":
|
|
14096
|
+
return await updateTenantTool(args);
|
|
14097
|
+
case "webhook_create":
|
|
14098
|
+
return await webhookCreateTool(args);
|
|
14099
|
+
case "webhook_list":
|
|
14100
|
+
return await webhookListTool(args);
|
|
14101
|
+
case "webhook_update":
|
|
14102
|
+
return await webhookUpdateTool(args);
|
|
14103
|
+
case "webhook_delete":
|
|
14104
|
+
return await webhookDeleteTool(args);
|
|
14105
|
+
case "webhook_test":
|
|
14106
|
+
return await webhookTestTool(args);
|
|
14107
|
+
case "webhook_deliveries":
|
|
14108
|
+
return await webhookDeliveriesTool(args);
|
|
14109
|
+
case "token_budget_list":
|
|
14110
|
+
return await tokenBudgetListTool(args);
|
|
14111
|
+
case "token_budget_get":
|
|
14112
|
+
return await tokenBudgetGetTool(args);
|
|
14113
|
+
case "token_budget_update":
|
|
14114
|
+
return await tokenBudgetUpdateTool(args);
|
|
14115
|
+
case "token_budget_delete":
|
|
14116
|
+
return await tokenBudgetDeleteTool(args);
|
|
14117
|
+
case "token_usage_delete":
|
|
14118
|
+
return await tokenUsageDeleteTool(args);
|
|
14119
|
+
case "token_usage_correct":
|
|
14120
|
+
return await tokenUsageCorrectTool(args);
|
|
14121
|
+
case "cost_anomaly_resolve":
|
|
14122
|
+
return await costAnomalyResolveTool(args);
|
|
14123
|
+
case "ingestion_anomaly_update":
|
|
14124
|
+
return await ingestionAnomalyUpdateTool(args);
|
|
14125
|
+
case "cost_trends":
|
|
14126
|
+
return await costTrendsTool(args);
|
|
14127
|
+
case "model_mix":
|
|
14128
|
+
return await modelMixTool(args);
|
|
14129
|
+
case "agent_model_profile":
|
|
14130
|
+
return await agentModelProfileTool(args);
|
|
13000
14131
|
case "factory_overview":
|
|
13001
14132
|
return await factoryOverviewTool(args);
|
|
13002
14133
|
case "decisions":
|