oc-pilot 0.98.0 → 0.99.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,32 @@ 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
+ },
1227
1253
  {
1228
1254
  name: "apoptosis",
1229
1255
  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 +1446,14 @@ const PROMPTS = [
1420
1446
  { name: "context", description: "What the change is supposed to do", required: false },
1421
1447
  ],
1422
1448
  },
1449
+ {
1450
+ name: "stamp-the-passport",
1451
+ title: "Stamp the provenance passport",
1452
+ description: "Record the commit, file hashes, agent, model and real verification checks in a digest-bound manifest, then verify that the tree still matches.",
1453
+ arguments: [
1454
+ { name: "context", description: "What the change is supposed to do", required: false },
1455
+ ],
1456
+ },
1423
1457
  {
1424
1458
  name: "prune-senescent-code",
1425
1459
  title: "Prune senescent AI code",
@@ -3335,6 +3369,35 @@ async function callPolygraph(input, cwd) {
3335
3369
  temp.cleanup();
3336
3370
  }
3337
3371
  }
3372
+ async function callPassport(input, cwd) {
3373
+ const action = stringArg(input, "action", true);
3374
+ const args = ["passport", action, "--json"];
3375
+ const commit = stringArg(input, "commit");
3376
+ if (commit)
3377
+ args.push("--commit", commit);
3378
+ const agent = stringArg(input, "agent");
3379
+ if (agent)
3380
+ args.push("--agent", agent);
3381
+ const model = stringArg(input, "model");
3382
+ if (model)
3383
+ args.push("--model", model);
3384
+ const promptHash = stringArg(input, "prompt_hash");
3385
+ if (promptHash)
3386
+ args.push("--prompt-hash", promptHash);
3387
+ if (Array.isArray(input.checks)) {
3388
+ for (const check of input.checks) {
3389
+ if (typeof check === "string")
3390
+ args.push("--check", check);
3391
+ }
3392
+ }
3393
+ if (booleanArg(input, "include_untracked"))
3394
+ args.push("--include-untracked");
3395
+ if (booleanArg(input, "markdown"))
3396
+ args.push("--markdown");
3397
+ if (booleanArg(input, "force"))
3398
+ args.push("--force");
3399
+ return toToolResult(await runCli(args, cwd));
3400
+ }
3338
3401
  async function callApoptosis(input, cwd) {
3339
3402
  const action = stringArg(input, "action") ?? "scan";
3340
3403
  const args = ["apoptosis", action, "--json"];
@@ -3550,6 +3613,9 @@ async function dispatchTool(name, input, cwd, readOnly) {
3550
3613
  if (name === "antibody" && ["learn", "forget", "clear"].includes(stringArg(input, "action") ?? "")) {
3551
3614
  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
3615
  }
3616
+ if (name === "passport" && ["write", "clear"].includes(stringArg(input, "action") ?? "")) {
3617
+ 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");
3618
+ }
3553
3619
  if (name === "honeypot" && (stringArg(input, "action") === "deploy" || stringArg(input, "action") === "remove")) {
3554
3620
  throw new ToolInputError("honeypot deploy/remove writes files and is disabled in read-only mode; start the MCP server with --allow-write");
3555
3621
  }
@@ -3665,6 +3731,8 @@ async function dispatchTool(name, input, cwd, readOnly) {
3665
3731
  return callAntibody(input, cwd);
3666
3732
  case "polygraph":
3667
3733
  return callPolygraph(input, cwd);
3734
+ case "passport":
3735
+ return callPassport(input, cwd);
3668
3736
  case "apoptosis":
3669
3737
  return callApoptosis(input, cwd);
3670
3738
  case "scan_injection":
@@ -3744,6 +3812,12 @@ function summarizeResult(value) {
3744
3812
  if (typeof value.status === "string" && Array.isArray(value.removed) && typeof value.summary === "string") {
3745
3813
  return `oc-pilot: apoptosis ${value.status}, ${String(value.removed.length)} removed`;
3746
3814
  }
3815
+ if (typeof value.status === "string" && Array.isArray(value.changed)) {
3816
+ return `oc-pilot: passport ${value.status}`;
3817
+ }
3818
+ if (value.tool === "oc-pilot" && typeof value.verdict === "string" && Array.isArray(value.files)) {
3819
+ return `oc-pilot: passport ${value.verdict}, ${String(value.files.length)} file(s)`;
3820
+ }
3747
3821
  if (typeof value.status === "string" && Array.isArray(value.claims) && value.counts && typeof value.counts === "object") {
3748
3822
  const counts = value.counts;
3749
3823
  return `oc-pilot: polygraph ${value.status}, ${String(counts.contradicted ?? 0)} contradicted, ${String(counts.unverifiable ?? 0)} unverifiable`;
@@ -4021,6 +4095,8 @@ function promptBody(name, args) {
4021
4095
  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
4096
  case "falsify-the-diff":
4023
4097
  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}`;
4098
+ case "stamp-the-passport":
4099
+ 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}`;
4024
4100
  case "cross-examine-the-claim":
4025
4101
  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
4102
  case "raise-antibodies":