oc-pilot 0.109.0 → 0.111.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/dist/mcp.js CHANGED
@@ -1475,6 +1475,52 @@ const TOOLS = [
1475
1475
  },
1476
1476
  },
1477
1477
  },
1478
+ {
1479
+ name: "beacon",
1480
+ description: "Create, verify and render a signed verification beacon for HEAD: commit, tree, tool version, agent, model, checks, commands and digest. Supports HMAC and ssh-keygen signatures; verify detects tampering and unattributed manifests. Actions: stamp, verify, render, clear. stamp/clear write and need --allow-write.",
1481
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
1482
+ inputSchema: {
1483
+ type: "object",
1484
+ additionalProperties: false,
1485
+ required: ["action"],
1486
+ properties: {
1487
+ action: { type: "string", enum: ["stamp", "verify", "render", "clear"] },
1488
+ checks: { type: "array", description: "Checks as name=pass|warn|fail|skip", items: { type: "string" } },
1489
+ commands: { type: "array", description: "Commands that produced the checks", items: { type: "string" } },
1490
+ agent: { type: "string" },
1491
+ model: { type: "string" },
1492
+ prompt_hash: { type: "string" },
1493
+ key: { type: "string", description: "HMAC key file for stamp/verify" },
1494
+ ssh_key: { type: "string", description: "ssh-keygen key file for stamp" },
1495
+ allowed_signers: { type: "string", description: "allowed_signers file for SSH verify" },
1496
+ identity: { type: "string", description: "Signer identity for SSH verify" },
1497
+ require_signature: { type: "boolean", description: "Fail verify on an unsigned beacon" },
1498
+ markdown: { type: "boolean", description: "Render as a PR comment" },
1499
+ force: { type: "boolean", description: "Confirm clear" },
1500
+ ...RESULT_PROPERTIES,
1501
+ },
1502
+ },
1503
+ },
1504
+ {
1505
+ name: "quarantine",
1506
+ description: "Track flaky tests with an owner and expiry in .oc-pilot/quarantine.json. check fails with [QUARANTINE EXPIRED] so suppression cannot become permanent. Actions: add, list, check, remove, clear. add/remove/clear write and need --allow-write.",
1507
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
1508
+ inputSchema: {
1509
+ type: "object",
1510
+ additionalProperties: false,
1511
+ required: ["action"],
1512
+ properties: {
1513
+ action: { type: "string", enum: ["add", "list", "check", "remove", "clear"] },
1514
+ test: { type: "string", description: "Test name for add/remove" },
1515
+ owner: { type: "string", description: "Who owns the quarantine" },
1516
+ reason: { type: "string", description: "Why the test is quarantined" },
1517
+ days: { type: "integer", minimum: 1, maximum: 365 },
1518
+ issue: { type: "string", description: "Issue URL" },
1519
+ force: { type: "boolean", description: "Confirm clear" },
1520
+ ...RESULT_PROPERTIES,
1521
+ },
1522
+ },
1523
+ },
1478
1524
  {
1479
1525
  name: "apoptosis",
1480
1526
  description: "Scan functions marked /* @lifespan: 30d */ and report [Senescent] when the marker is older than the lifespan and the symbol has no references. With action=apply and confirm=true, comment the senescent functions out in a shadow git worktree, run tests and land the diff only if the suite is green. Apply writes files and needs --allow-write.",
@@ -1767,6 +1813,22 @@ const PROMPTS = [
1767
1813
  { name: "context", description: "Why the file is under review", required: false },
1768
1814
  ],
1769
1815
  },
1816
+ {
1817
+ name: "stamp-the-beacon",
1818
+ title: "Stamp a signed verification beacon",
1819
+ description: "Record the commit, tool version, agent, model, commands and real checks in a digest-bound beacon, sign it and verify the signature before sharing it.",
1820
+ arguments: [
1821
+ { name: "context", description: "What the verification covers", required: false },
1822
+ ],
1823
+ },
1824
+ {
1825
+ name: "quarantine-the-flake",
1826
+ title: "Quarantine a flaky test with an expiry",
1827
+ description: "Put a flaky test under an owner and a deadline, then fail the gate when the deadline passes instead of suppressing it forever.",
1828
+ arguments: [
1829
+ { name: "context", description: "Why the test is flaky", required: false },
1830
+ ],
1831
+ },
1770
1832
  {
1771
1833
  name: "prune-senescent-code",
1772
1834
  title: "Prune senescent AI code",
@@ -4043,6 +4105,72 @@ async function callChronos(input, cwd) {
4043
4105
  args.push("--fail-on-hotspot");
4044
4106
  return toToolResult(await runCli(args, cwd));
4045
4107
  }
4108
+ async function callBeacon(input, cwd) {
4109
+ const action = stringArg(input, "action", true);
4110
+ const args = ["beacon", action, "--json"];
4111
+ if (Array.isArray(input.checks)) {
4112
+ for (const check of input.checks) {
4113
+ if (typeof check === "string")
4114
+ args.push("--check", check);
4115
+ }
4116
+ }
4117
+ if (Array.isArray(input.commands)) {
4118
+ for (const command of input.commands) {
4119
+ if (typeof command === "string")
4120
+ args.push("--command", command);
4121
+ }
4122
+ }
4123
+ const agent = stringArg(input, "agent");
4124
+ if (agent)
4125
+ args.push("--agent", agent);
4126
+ const model = stringArg(input, "model");
4127
+ if (model)
4128
+ args.push("--model", model);
4129
+ const promptHash = stringArg(input, "prompt_hash");
4130
+ if (promptHash)
4131
+ args.push("--prompt-hash", promptHash);
4132
+ const key = stringArg(input, "key");
4133
+ if (key)
4134
+ args.push("--key", key);
4135
+ const sshKey = stringArg(input, "ssh_key");
4136
+ if (sshKey)
4137
+ args.push("--ssh-key", sshKey);
4138
+ const allowedSigners = stringArg(input, "allowed_signers");
4139
+ if (allowedSigners)
4140
+ args.push("--allowed-signers", allowedSigners);
4141
+ const identity = stringArg(input, "identity");
4142
+ if (identity)
4143
+ args.push("--identity", identity);
4144
+ if (booleanArg(input, "require_signature"))
4145
+ args.push("--require-signature");
4146
+ if (booleanArg(input, "markdown"))
4147
+ args.push("--markdown");
4148
+ if (booleanArg(input, "force"))
4149
+ args.push("--force");
4150
+ return toToolResult(await runCli(args, cwd));
4151
+ }
4152
+ async function callQuarantine(input, cwd) {
4153
+ const action = stringArg(input, "action", true);
4154
+ const args = ["quarantine", action, "--json"];
4155
+ const test = stringArg(input, "test");
4156
+ if (test)
4157
+ args.push("--test", test);
4158
+ const owner = stringArg(input, "owner");
4159
+ if (owner)
4160
+ args.push("--owner", owner);
4161
+ const reason = stringArg(input, "reason");
4162
+ if (reason)
4163
+ args.push("--reason", reason);
4164
+ const days = integerArg(input, "days");
4165
+ if (days !== undefined)
4166
+ args.push("--days", String(days));
4167
+ const issue = stringArg(input, "issue");
4168
+ if (issue)
4169
+ args.push("--issue", issue);
4170
+ if (booleanArg(input, "force"))
4171
+ args.push("--force");
4172
+ return toToolResult(await runCli(args, cwd));
4173
+ }
4046
4174
  async function callApoptosis(input, cwd) {
4047
4175
  const action = stringArg(input, "action") ?? "scan";
4048
4176
  const args = ["apoptosis", action, "--json"];
@@ -4273,6 +4401,12 @@ async function dispatchTool(name, input, cwd, readOnly) {
4273
4401
  if (name === "mayday" && stringArg(input, "action") === "rollback") {
4274
4402
  throw new ToolInputError("mayday rollback creates a branch and is disabled in read-only mode; start the MCP server with --allow-write");
4275
4403
  }
4404
+ if (name === "beacon" && ["stamp", "clear"].includes(stringArg(input, "action") ?? "")) {
4405
+ throw new ToolInputError("beacon stamp/clear write .oc-pilot/beacon.json and are disabled in read-only mode; start the MCP server with --allow-write");
4406
+ }
4407
+ if (name === "quarantine" && ["add", "remove", "clear"].includes(stringArg(input, "action") ?? "")) {
4408
+ throw new ToolInputError("quarantine add/remove/clear write .oc-pilot/quarantine.json and are disabled in read-only mode; start the MCP server with --allow-write");
4409
+ }
4276
4410
  if (name === "honeypot" && (stringArg(input, "action") === "deploy" || stringArg(input, "action") === "remove")) {
4277
4411
  throw new ToolInputError("honeypot deploy/remove writes files and is disabled in read-only mode; start the MCP server with --allow-write");
4278
4412
  }
@@ -4410,6 +4544,10 @@ async function dispatchTool(name, input, cwd, readOnly) {
4410
4544
  return callCuckoo(input, cwd);
4411
4545
  case "chronos":
4412
4546
  return callChronos(input, cwd);
4547
+ case "beacon":
4548
+ return callBeacon(input, cwd);
4549
+ case "quarantine":
4550
+ return callQuarantine(input, cwd);
4413
4551
  case "apoptosis":
4414
4552
  return callApoptosis(input, cwd);
4415
4553
  case "scan_injection":
@@ -4489,6 +4627,23 @@ function summarizeResult(value) {
4489
4627
  if (typeof value.status === "string" && Array.isArray(value.removed) && typeof value.summary === "string") {
4490
4628
  return `oc-pilot: apoptosis ${value.status}, ${String(value.removed.length)} removed`;
4491
4629
  }
4630
+ if (typeof value.status === "string" && Array.isArray(value.expired) && typeof value.summary === "string") {
4631
+ return `oc-pilot: quarantine ${value.status}, ${String(value.expired.length)} expired`;
4632
+ }
4633
+ if (Array.isArray(value.entries) && Array.isArray(value.expired) && Array.isArray(value.active)) {
4634
+ return `oc-pilot: quarantine ${String(value.entries.length)} test(s), ${String(value.expired.length)} expired`;
4635
+ }
4636
+ if (typeof value.test === "string" && typeof value.owner === "string" && typeof value.expiresAt === "string") {
4637
+ return `oc-pilot: quarantine ${value.test} until ${value.expiresAt}`;
4638
+ }
4639
+ if (typeof value.status === "string" &&
4640
+ ["valid", "unsigned", "tampered", "unattributed", "missing", "error"].includes(value.status) &&
4641
+ typeof value.summary === "string") {
4642
+ return `oc-pilot: beacon ${value.status}`;
4643
+ }
4644
+ if (typeof value.verdict === "string" && Array.isArray(value.checks) && typeof value.commit === "string") {
4645
+ return `oc-pilot: beacon ${value.verdict}, ${String(value.checks.length)} check(s)`;
4646
+ }
4492
4647
  if (typeof value.score === "number" && typeof value.hotspot === "boolean" && value.totals && typeof value.totals === "object") {
4493
4648
  return `oc-pilot: chronos ${String(value.score)}, ${value.hotspot ? "hotspot" : "stable"}`;
4494
4649
  }
@@ -4831,6 +4986,10 @@ function promptBody(name, args) {
4831
4986
  return `Call the oc-pilot "skeptic" tool on the proposed diff. Read the hypothesis reason and the exact status. If it returns bug, stop and quote the failing test output: the generated test fails on the diff and passes on HEAD, so the change is falsified. Fix the code or the test expectation, then rerun; do not delete the test, do not weaken the assertion and do not claim a bug from a test that also fails on HEAD. If it returns clean, say that the hypothesis was rejected, not that the code is proven correct. If it returns unfalsifiable, explain that the test did not distinguish the diff from HEAD. If it returns error, report the infrastructure failure instead of guessing.${suffix}`;
4832
4987
  case "stamp-the-passport":
4833
4988
  return `Call the oc-pilot "passport" tool with action=write after the checks you actually ran, then action=verify. Record only real checks as name=pass|warn|fail|skip, the real agent/model and the commit. If verify returns [PASSPORT STALE] or [PASSPORT TAMPERED], stop: the manifest no longer matches the tree; rewrite it from the current state or investigate the change. Never mark a check as pass without running it, never edit the manifest by hand to hide a mismatch, and never claim that a passport proves correctness: it proves what was recorded and that the files still match. write/clear need --allow-write.${suffix}`;
4989
+ case "quarantine-the-flake":
4990
+ return `Call the oc-pilot "quarantine" tool with action=add and a real test name, owner, reason and a short expiry (14 days or less). Read the expiry and tell the user who owns the fix and when the gate will fail. Use action=check in CI; if it returns [QUARANTINE EXPIRED], fix or delete the test instead of extending the deadline silently. Never quarantine a test without an owner and never make the expiry permanent. add/remove/clear need --allow-write.${suffix}`;
4991
+ case "stamp-the-beacon":
4992
+ return `Call the oc-pilot "beacon" tool with action=stamp after the checks you actually ran, then action=verify with the same key or allowed_signers. Record only real checks, the real agent/model and the commands. If verify returns [BEACON TAMPERED] or [UNATTRIBUTED], stop: do not share or merge the beacon; re-stamp from the current state or investigate the signature. Never mark an unrun check as pass, never edit the manifest by hand and never claim that a beacon proves correctness: it proves what was recorded and who signed it. stamp/clear need --allow-write.${suffix}`;
4834
4993
  case "read-the-chronicle":
4835
4994
  return `Call the oc-pilot "chronos" tool on the file. Read the fix, revert, incident and security counts, the antibodies and vaccines, and the hotspot score. If it returns [HOTSPOT], treat the file as high-risk: inspect the recent fixes and reverts before changing it, add or run a vaccine, and do not refactor it without tests. A low score is not proof that the file is safe. Offline and read-only.${suffix}`;
4836
4995
  case "audit-the-cuckoo":