oc-pilot 0.98.0 → 0.100.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
@@ -1224,6 +1224,55 @@ const TOOLS = [
1224
1224
  },
1225
1225
  },
1226
1226
  },
1227
+ {
1228
+ name: "passport",
1229
+ description: "Record and verify a provenance manifest for a commit or the current worktree: commit, tree, file hashes, agent, model and recorded checks, bound by a digest. Actions: write, verify, show, clear. write/clear write files and need --allow-write.",
1230
+ annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },
1231
+ inputSchema: {
1232
+ type: "object",
1233
+ additionalProperties: false,
1234
+ required: ["action"],
1235
+ properties: {
1236
+ action: { type: "string", enum: ["write", "verify", "show", "clear"] },
1237
+ commit: { type: "string", description: "Commit ref for an immutable commit passport" },
1238
+ agent: { type: "string", description: "Who produced the change" },
1239
+ model: { type: "string", description: "Model used for the change" },
1240
+ prompt_hash: { type: "string", description: "Hash of the prompt or session" },
1241
+ checks: {
1242
+ type: "array",
1243
+ description: "Recorded checks as name=pass|warn|fail|skip",
1244
+ items: { type: "string" },
1245
+ },
1246
+ include_untracked: { type: "boolean" },
1247
+ markdown: { type: "boolean", description: "Render show as Markdown for a PR" },
1248
+ force: { type: "boolean", description: "Confirm clear" },
1249
+ ...RESULT_PROPERTIES,
1250
+ },
1251
+ },
1252
+ },
1253
+ {
1254
+ name: "oracle",
1255
+ description: "Run the same input corpus against clean HEAD and the proposed diff in two shadow worktrees, then compare stdout and exit codes. Deterministic and model-free; the command must contain {input}, replaced by a JSON file with one case.",
1256
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
1257
+ inputSchema: {
1258
+ type: "object",
1259
+ additionalProperties: false,
1260
+ required: ["command"],
1261
+ properties: {
1262
+ command: { type: "string", description: "Harness command with {input}, e.g. node harness.mjs {input}" },
1263
+ input_file: { type: "string", description: "Repository-relative JSON corpus file" },
1264
+ cases: { type: "array", description: "Inline corpus; each item is a JSON value or {id,input}", items: {} },
1265
+ case_timeout_ms: { type: "integer", minimum: 1000, maximum: 300000 },
1266
+ max_cases: { type: "integer", minimum: 1, maximum: 200 },
1267
+ diff: { type: "string", description: "Unified diff text; omit to use the project's git diff" },
1268
+ base: { type: "string" },
1269
+ staged: { type: "boolean" },
1270
+ unstaged: { type: "boolean" },
1271
+ include_untracked: { type: "boolean" },
1272
+ ...RESULT_PROPERTIES,
1273
+ },
1274
+ },
1275
+ },
1227
1276
  {
1228
1277
  name: "apoptosis",
1229
1278
  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.",
@@ -1420,6 +1469,22 @@ const PROMPTS = [
1420
1469
  { name: "context", description: "What the change is supposed to do", required: false },
1421
1470
  ],
1422
1471
  },
1472
+ {
1473
+ name: "stamp-the-passport",
1474
+ title: "Stamp the provenance passport",
1475
+ description: "Record the commit, file hashes, agent, model and real verification checks in a digest-bound manifest, then verify that the tree still matches.",
1476
+ arguments: [
1477
+ { name: "context", description: "What the change is supposed to do", required: false },
1478
+ ],
1479
+ },
1480
+ {
1481
+ name: "compare-the-behavior",
1482
+ title: "Compare behavior before and after",
1483
+ description: "Run one corpus on clean HEAD and on the diff, compare stdout and exit codes, and report every [BEHAVIOR CHANGED] case with its input.",
1484
+ arguments: [
1485
+ { name: "context", description: "What the change is supposed to do", required: false },
1486
+ ],
1487
+ },
1423
1488
  {
1424
1489
  name: "prune-senescent-code",
1425
1490
  title: "Prune senescent AI code",
@@ -3335,6 +3400,73 @@ async function callPolygraph(input, cwd) {
3335
3400
  temp.cleanup();
3336
3401
  }
3337
3402
  }
3403
+ async function callPassport(input, cwd) {
3404
+ const action = stringArg(input, "action", true);
3405
+ const args = ["passport", action, "--json"];
3406
+ const commit = stringArg(input, "commit");
3407
+ if (commit)
3408
+ args.push("--commit", commit);
3409
+ const agent = stringArg(input, "agent");
3410
+ if (agent)
3411
+ args.push("--agent", agent);
3412
+ const model = stringArg(input, "model");
3413
+ if (model)
3414
+ args.push("--model", model);
3415
+ const promptHash = stringArg(input, "prompt_hash");
3416
+ if (promptHash)
3417
+ args.push("--prompt-hash", promptHash);
3418
+ if (Array.isArray(input.checks)) {
3419
+ for (const check of input.checks) {
3420
+ if (typeof check === "string")
3421
+ args.push("--check", check);
3422
+ }
3423
+ }
3424
+ if (booleanArg(input, "include_untracked"))
3425
+ args.push("--include-untracked");
3426
+ if (booleanArg(input, "markdown"))
3427
+ args.push("--markdown");
3428
+ if (booleanArg(input, "force"))
3429
+ args.push("--force");
3430
+ return toToolResult(await runCli(args, cwd));
3431
+ }
3432
+ async function callOracle(input, cwd) {
3433
+ const temp = new TempFiles();
3434
+ try {
3435
+ const command = stringArg(input, "command", true);
3436
+ const args = ["oracle", "--json", "--command", command];
3437
+ const inputFile = stringArg(input, "input_file");
3438
+ if (inputFile)
3439
+ args.push("--input", inputFile);
3440
+ else if (Array.isArray(input.cases)) {
3441
+ args.push("--input", temp.write("oracle-cases.json", JSON.stringify({ cases: input.cases })));
3442
+ }
3443
+ else {
3444
+ throw new ToolInputError("oracle needs input_file or cases");
3445
+ }
3446
+ const diff = stringArg(input, "diff");
3447
+ if (diff)
3448
+ args.push("--diff", temp.write("oracle.diff", diff));
3449
+ const base = baseArg(input);
3450
+ if (base)
3451
+ args.push("--base", base);
3452
+ if (booleanArg(input, "staged"))
3453
+ args.push("--staged");
3454
+ if (booleanArg(input, "unstaged"))
3455
+ args.push("--unstaged");
3456
+ if (booleanArg(input, "include_untracked"))
3457
+ args.push("--include-untracked");
3458
+ const timeout = integerArg(input, "case_timeout_ms");
3459
+ if (timeout !== undefined)
3460
+ args.push("--case-timeout", String(Math.max(1, Math.round(timeout / 1000))) + "s");
3461
+ const maxCases = integerArg(input, "max_cases");
3462
+ if (maxCases !== undefined)
3463
+ args.push("--max-cases", String(maxCases));
3464
+ return toToolResult(await runCli(args, cwd));
3465
+ }
3466
+ finally {
3467
+ temp.cleanup();
3468
+ }
3469
+ }
3338
3470
  async function callApoptosis(input, cwd) {
3339
3471
  const action = stringArg(input, "action") ?? "scan";
3340
3472
  const args = ["apoptosis", action, "--json"];
@@ -3550,6 +3682,9 @@ async function dispatchTool(name, input, cwd, readOnly) {
3550
3682
  if (name === "antibody" && ["learn", "forget", "clear"].includes(stringArg(input, "action") ?? "")) {
3551
3683
  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
3684
  }
3685
+ if (name === "passport" && ["write", "clear"].includes(stringArg(input, "action") ?? "")) {
3686
+ throw new ToolInputError("passport write/clear write .oc-pilot/passport.json and are disabled in read-only mode; start the MCP server with --allow-write");
3687
+ }
3553
3688
  if (name === "honeypot" && (stringArg(input, "action") === "deploy" || stringArg(input, "action") === "remove")) {
3554
3689
  throw new ToolInputError("honeypot deploy/remove writes files and is disabled in read-only mode; start the MCP server with --allow-write");
3555
3690
  }
@@ -3665,6 +3800,10 @@ async function dispatchTool(name, input, cwd, readOnly) {
3665
3800
  return callAntibody(input, cwd);
3666
3801
  case "polygraph":
3667
3802
  return callPolygraph(input, cwd);
3803
+ case "passport":
3804
+ return callPassport(input, cwd);
3805
+ case "oracle":
3806
+ return callOracle(input, cwd);
3668
3807
  case "apoptosis":
3669
3808
  return callApoptosis(input, cwd);
3670
3809
  case "scan_injection":
@@ -3744,6 +3883,15 @@ function summarizeResult(value) {
3744
3883
  if (typeof value.status === "string" && Array.isArray(value.removed) && typeof value.summary === "string") {
3745
3884
  return `oc-pilot: apoptosis ${value.status}, ${String(value.removed.length)} removed`;
3746
3885
  }
3886
+ if (typeof value.status === "string" && typeof value.changed === "number" && Array.isArray(value.results)) {
3887
+ return `oc-pilot: oracle ${value.status}, ${String(value.changed)} changed of ${String(value.cases)}`;
3888
+ }
3889
+ if (typeof value.status === "string" && Array.isArray(value.changed)) {
3890
+ return `oc-pilot: passport ${value.status}`;
3891
+ }
3892
+ if (value.tool === "oc-pilot" && typeof value.verdict === "string" && Array.isArray(value.files)) {
3893
+ return `oc-pilot: passport ${value.verdict}, ${String(value.files.length)} file(s)`;
3894
+ }
3747
3895
  if (typeof value.status === "string" && Array.isArray(value.claims) && value.counts && typeof value.counts === "object") {
3748
3896
  const counts = value.counts;
3749
3897
  return `oc-pilot: polygraph ${value.status}, ${String(counts.contradicted ?? 0)} contradicted, ${String(counts.unverifiable ?? 0)} unverifiable`;
@@ -4021,6 +4169,10 @@ function promptBody(name, args) {
4021
4169
  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}`;
4022
4170
  case "falsify-the-diff":
4023
4171
  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}`;
4172
+ case "stamp-the-passport":
4173
+ 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}`;
4174
+ case "compare-the-behavior":
4175
+ return `Call the oc-pilot "oracle" tool with a deterministic command that reads the {input} JSON file, a corpus of real cases and the proposed diff. Read every [BEHAVIOR CHANGED] case with its input and before/after output. If behavior changed, decide whether it was intended: update the corpus or expectations only for intended changes, and fix unintended ones. Do not delete failing cases, do not shrink the corpus to hide a difference, and do not claim behavioral equivalence from a corpus that does not cover the change. A same result is evidence for the supplied inputs, not a proof for all inputs. Model-free and read-only.${suffix}`;
4024
4176
  case "cross-examine-the-claim":
4025
4177
  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
4178
  case "raise-antibodies":