oc-pilot 0.96.1 → 0.98.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
@@ -1168,6 +1168,62 @@ const TOOLS = [
1168
1168
  },
1169
1169
  },
1170
1170
  },
1171
+ {
1172
+ name: "antibody",
1173
+ description: "Learn SAST findings as reusable signatures in .oc-pilot/antibodies.json, then scan added diff lines for the same vulnerability pattern. Actions: learn, scan, list, forget, clear. Offline and deterministic; learn/forget/clear write files and need --allow-write.",
1174
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
1175
+ inputSchema: {
1176
+ type: "object",
1177
+ additionalProperties: false,
1178
+ required: ["action"],
1179
+ properties: {
1180
+ action: { type: "string", enum: ["learn", "scan", "list", "forget", "clear"] },
1181
+ id: { type: "string", description: "Signature id for forget" },
1182
+ force: { type: "boolean", description: "Confirm clear" },
1183
+ diff: { type: "string", description: "Unified diff text; omit to use the project's git diff" },
1184
+ base: { type: "string" },
1185
+ staged: { type: "boolean" },
1186
+ unstaged: { type: "boolean" },
1187
+ include_untracked: { type: "boolean" },
1188
+ ...RESULT_PROPERTIES,
1189
+ },
1190
+ },
1191
+ },
1192
+ {
1193
+ name: "polygraph",
1194
+ description: "Verify the claims in a commit message or PR body against the real diff. The model extracts falsifiable claims and deterministic checks mark each one supported, contradicted or unverifiable. Model-backed, read-only and limited to what the diff can prove.",
1195
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
1196
+ inputSchema: {
1197
+ type: "object",
1198
+ additionalProperties: false,
1199
+ properties: {
1200
+ commit: { type: "string", description: "Commit ref; uses its message and its own diff" },
1201
+ message: { type: "string", description: "Commit message or PR body" },
1202
+ message_file: { type: "string", description: "Repository-relative file with the message" },
1203
+ claims: {
1204
+ type: "array",
1205
+ description: "Pre-extracted claims; skips the model call",
1206
+ items: {
1207
+ type: "object",
1208
+ required: ["kind", "text"],
1209
+ properties: {
1210
+ kind: { type: "string", enum: ["test-added", "file-added", "file-removed", "api-change", "dependency", "docs", "security", "behavior", "refactor", "other"] },
1211
+ text: { type: "string" },
1212
+ polarity: { type: "string", enum: ["positive", "negative"] },
1213
+ },
1214
+ },
1215
+ },
1216
+ diff: { type: "string", description: "Unified diff text; omit to use the project's git diff" },
1217
+ base: { type: "string" },
1218
+ staged: { type: "boolean" },
1219
+ unstaged: { type: "boolean" },
1220
+ include_untracked: { type: "boolean" },
1221
+ fail_on: { type: "string", enum: ["contradicted", "unverifiable"] },
1222
+ strict: { type: "boolean", description: "Fail on unverifiable claims too" },
1223
+ ...RESULT_PROPERTIES,
1224
+ },
1225
+ },
1226
+ },
1171
1227
  {
1172
1228
  name: "apoptosis",
1173
1229
  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.",
@@ -1348,6 +1404,22 @@ const PROMPTS = [
1348
1404
  { name: "context", description: "What the change is supposed to do", required: false },
1349
1405
  ],
1350
1406
  },
1407
+ {
1408
+ name: "raise-antibodies",
1409
+ title: "Raise antibodies for known vulnerabilities",
1410
+ description: "Learn the repository's SAST findings as signatures, then scan a diff for the same vulnerability pattern and stop on [ANTIBODY MATCH].",
1411
+ arguments: [
1412
+ { name: "context", description: "What the change is supposed to do", required: false },
1413
+ ],
1414
+ },
1415
+ {
1416
+ name: "cross-examine-the-claim",
1417
+ title: "Cross-examine the commit claim",
1418
+ description: "Extract the claims from a commit message or PR body, check each one against the diff and stop on [CLAIM CONTRADICTED].",
1419
+ arguments: [
1420
+ { name: "context", description: "What the change is supposed to do", required: false },
1421
+ ],
1422
+ },
1351
1423
  {
1352
1424
  name: "prune-senescent-code",
1353
1425
  title: "Prune senescent AI code",
@@ -3196,6 +3268,73 @@ async function callSkeptic(input, cwd) {
3196
3268
  temp.cleanup();
3197
3269
  }
3198
3270
  }
3271
+ async function callAntibody(input, cwd) {
3272
+ const temp = new TempFiles();
3273
+ try {
3274
+ const action = stringArg(input, "action", true);
3275
+ const args = ["antibody", action, "--json"];
3276
+ const diff = stringArg(input, "diff");
3277
+ if (diff)
3278
+ args.push("--diff", temp.write("antibody.diff", diff));
3279
+ const base = baseArg(input);
3280
+ if (base)
3281
+ args.push("--base", base);
3282
+ if (booleanArg(input, "staged"))
3283
+ args.push("--staged");
3284
+ if (booleanArg(input, "unstaged"))
3285
+ args.push("--unstaged");
3286
+ if (booleanArg(input, "include_untracked"))
3287
+ args.push("--include-untracked");
3288
+ const id = stringArg(input, "id");
3289
+ if (id)
3290
+ args.push("--id", id);
3291
+ if (booleanArg(input, "force"))
3292
+ args.push("--force");
3293
+ return toToolResult(await runCli(args, cwd));
3294
+ }
3295
+ finally {
3296
+ temp.cleanup();
3297
+ }
3298
+ }
3299
+ async function callPolygraph(input, cwd) {
3300
+ const temp = new TempFiles();
3301
+ try {
3302
+ const args = ["polygraph", "--json"];
3303
+ const commit = stringArg(input, "commit");
3304
+ if (commit)
3305
+ args.push("--commit", commit);
3306
+ const message = stringArg(input, "message");
3307
+ if (message)
3308
+ args.push("--message", message);
3309
+ const messageFile = stringArg(input, "message_file");
3310
+ if (messageFile)
3311
+ args.push("--message-file", messageFile);
3312
+ if (Array.isArray(input.claims)) {
3313
+ args.push("--claims", temp.write("polygraph-claims.json", JSON.stringify({ claims: input.claims })));
3314
+ }
3315
+ const diff = stringArg(input, "diff");
3316
+ if (diff)
3317
+ args.push("--diff", temp.write("polygraph.diff", diff));
3318
+ const base = baseArg(input);
3319
+ if (base)
3320
+ args.push("--base", base);
3321
+ if (booleanArg(input, "staged"))
3322
+ args.push("--staged");
3323
+ if (booleanArg(input, "unstaged"))
3324
+ args.push("--unstaged");
3325
+ if (booleanArg(input, "include_untracked"))
3326
+ args.push("--include-untracked");
3327
+ const failOn = stringArg(input, "fail_on");
3328
+ if (failOn)
3329
+ args.push("--fail-on", failOn);
3330
+ if (booleanArg(input, "strict"))
3331
+ args.push("--strict");
3332
+ return toToolResult(await runCli(args, cwd));
3333
+ }
3334
+ finally {
3335
+ temp.cleanup();
3336
+ }
3337
+ }
3199
3338
  async function callApoptosis(input, cwd) {
3200
3339
  const action = stringArg(input, "action") ?? "scan";
3201
3340
  const args = ["apoptosis", action, "--json"];
@@ -3408,6 +3547,9 @@ async function dispatchTool(name, input, cwd, readOnly) {
3408
3547
  if (name === "deps" && (booleanArg(input, "fix") || stringArg(input, "sbom"))) {
3409
3548
  throw new ToolInputError("deps fix and sbom write files and are disabled in read-only mode; start the MCP server with --allow-write");
3410
3549
  }
3550
+ if (name === "antibody" && ["learn", "forget", "clear"].includes(stringArg(input, "action") ?? "")) {
3551
+ throw new ToolInputError("antibody learn/forget/clear write .oc-pilot/antibodies.json and are disabled in read-only mode; start the MCP server with --allow-write");
3552
+ }
3411
3553
  if (name === "honeypot" && (stringArg(input, "action") === "deploy" || stringArg(input, "action") === "remove")) {
3412
3554
  throw new ToolInputError("honeypot deploy/remove writes files and is disabled in read-only mode; start the MCP server with --allow-write");
3413
3555
  }
@@ -3519,6 +3661,10 @@ async function dispatchTool(name, input, cwd, readOnly) {
3519
3661
  return callBlindfold(input, cwd);
3520
3662
  case "skeptic":
3521
3663
  return callSkeptic(input, cwd);
3664
+ case "antibody":
3665
+ return callAntibody(input, cwd);
3666
+ case "polygraph":
3667
+ return callPolygraph(input, cwd);
3522
3668
  case "apoptosis":
3523
3669
  return callApoptosis(input, cwd);
3524
3670
  case "scan_injection":
@@ -3598,6 +3744,19 @@ function summarizeResult(value) {
3598
3744
  if (typeof value.status === "string" && Array.isArray(value.removed) && typeof value.summary === "string") {
3599
3745
  return `oc-pilot: apoptosis ${value.status}, ${String(value.removed.length)} removed`;
3600
3746
  }
3747
+ if (typeof value.status === "string" && Array.isArray(value.claims) && value.counts && typeof value.counts === "object") {
3748
+ const counts = value.counts;
3749
+ return `oc-pilot: polygraph ${value.status}, ${String(counts.contradicted ?? 0)} contradicted, ${String(counts.unverifiable ?? 0)} unverifiable`;
3750
+ }
3751
+ if (typeof value.signatures === "number" && Array.isArray(value.matches)) {
3752
+ return `oc-pilot: antibody ${String(value.matches.length)} match(es), ${String(value.signatures)} signature(s)`;
3753
+ }
3754
+ if (typeof value.total === "number" && typeof value.added === "number") {
3755
+ return `oc-pilot: antibody learned ${String(value.added)}, total ${String(value.total)}`;
3756
+ }
3757
+ if (Array.isArray(value.signatures)) {
3758
+ return `oc-pilot: antibody ${String(value.signatures.length)} signature(s)`;
3759
+ }
3601
3760
  if (typeof value.status === "string" && typeof value.summary === "string" && typeof value.durationMs === "number" && value.hypothesis) {
3602
3761
  return `oc-pilot: skeptic ${value.status}`;
3603
3762
  }
@@ -3862,6 +4021,10 @@ function promptBody(name, args) {
3862
4021
  return `Call the oc-pilot "blindfold" tool on the added diff lines, or pass file when the change is one file. Read the obfuscated code and the verdict. If it reports [BLINDFOLD REJECTED], stop: the model could not reconstruct the logic, found a concrete vulnerability or stayed below min_confidence. Quote the explanation and fix the real code path; do not reveal the original names to the model, do not raise min_confidence to force a pass and do not add comments that explain the logic to the model. If it passes, say that the verdict is a blind review, not a mathematical proof of safety. Use dry_run only to inspect the mapping and never send the mapping to the model.${suffix}`;
3863
4022
  case "falsify-the-diff":
3864
4023
  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}`;
4024
+ case "cross-examine-the-claim":
4025
+ return `Call the oc-pilot "polygraph" tool on the commit or PR message and the proposed diff. Read every claim and its status. If it returns [CLAIM CONTRADICTED], stop and quote the contradicted claim with its evidence: the message asserts something the diff does not do. Fix the code or rewrite the message so it matches reality; never rewrite the message to hide a buggy diff and never delete a claim. If it returns [POLYGRAPH VERIFIED], say that the claims are consistent with the diff, not that the code is correct. If it returns [POLYGRAPH INCONCLUSIVE], list the unverifiable claims and explain what evidence would settle them. Model-backed and read-only.${suffix}`;
4026
+ case "raise-antibodies":
4027
+ return `Call the oc-pilot "antibody" tool with action=learn first, then action=scan on the proposed diff. Read the learned signature count and every [ANTIBODY MATCH] entry with rule, file:line and evidence. If a match is reported, stop: the diff reintroduced a vulnerability pattern that the repository already fixed. Fix the code path and rescan; do not delete the signature, do not suppress the line and do not clear the store to force a pass. If the scan is clean, say that no learned pattern matched, not that the code is safe. learn/forget/clear write files and need --allow-write; clear requires explicit user approval and force=true.${suffix}`;
3865
4028
  case "prune-senescent-code":
3866
4029
  return `Call the oc-pilot "apoptosis" tool with action=scan first. Report every [Senescent] entry with file, symbol, age and reference count, and explain that an expired marker plus zero references is the only reason it is a candidate. Do not delete anything without explicit user approval. If approved, call action=apply with confirm=true and the project test command; apply runs in a shadow worktree and lands the diff only if tests pass. If tests fail, report the failure and keep the working tree unchanged. Never remove a function that still has references, never shorten the lifespan to force a candidate, and never claim that deletion is safe without the green test run.${suffix}`;
3867
4030
  case "scan-for-injection":