coderifts 8.0.0 → 8.0.1

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/cli.js CHANGED
@@ -3028,7 +3028,7 @@ var require_package = __commonJS({
3028
3028
  "package.json"(exports2, module2) {
3029
3029
  module2.exports = {
3030
3030
  name: "coderifts",
3031
- version: "8.0.0",
3031
+ version: "8.0.1",
3032
3032
  description: "Detect breaking API changes from the command line. Works locally or with the CodeRifts cloud API.",
3033
3033
  author: "CodeRifts <hello@coderifts.com>",
3034
3034
  license: "MIT",
@@ -3068,13 +3068,13 @@ var require_package = __commonJS({
3068
3068
  },
3069
3069
  scripts: {
3070
3070
  build: "node scripts/copy-corpus.js && node scripts/build.js",
3071
- prepublishOnly: "node scripts/assert-guard-major.js && node scripts/assert-changelog-version.js && bash ../../scripts/freeze-gate.sh && npm run build",
3071
+ prepublishOnly: "node scripts/assert-guard-major.js && node scripts/assert-changelog-version.js && bash ../../scripts/freeze-gate.sh && npm run build && bash ../../scripts/release-check.sh .",
3072
3072
  "assert-guard-major": "node scripts/assert-guard-major.js",
3073
3073
  postinstall: "node scripts/postinstall.js",
3074
3074
  test: "node --test test/*.test.js"
3075
3075
  },
3076
3076
  dependencies: {
3077
- "@coderifts/agent-guard": "^15.0.0",
3077
+ "@coderifts/agent-guard": "^15.1.0",
3078
3078
  chalk: "^4.1.2",
3079
3079
  "cli-table3": "^0.6.4",
3080
3080
  commander: "^12.0.0",
@@ -68128,7 +68128,7 @@ var require_client = __commonJS({
68128
68128
  this.timeout = options.timeout || DEFAULT_TIMEOUT;
68129
68129
  }
68130
68130
  // ─── Internal HTTP helper ──────────────────────────────────────────────
68131
- async request(method, path, body) {
68131
+ async request(method, path, body, extraHeaders) {
68132
68132
  const url = `${this.baseUrl}${path}`;
68133
68133
  const controller = new AbortController();
68134
68134
  const timer = setTimeout(() => controller.abort(), this.timeout);
@@ -68137,7 +68137,8 @@ var require_client = __commonJS({
68137
68137
  method,
68138
68138
  headers: {
68139
68139
  "Content-Type": "application/json",
68140
- Authorization: `Bearer ${this.apiKey}`
68140
+ Authorization: `Bearer ${this.apiKey}`,
68141
+ ...extraHeaders || {}
68141
68142
  },
68142
68143
  body: body ? JSON.stringify(body) : void 0,
68143
68144
  signal: controller.signal
@@ -68340,8 +68341,12 @@ var require_client = __commonJS({
68340
68341
  * `decision` / `safe_for_agent` (authorize) or `analysis_outcome` (analyze). Call
68341
68342
  * `analyzeChangeSet` / `authorizeChangeSet` instead to get an already-narrowed type.
68342
68343
  */
68343
- async preflightChangeSet(req) {
68344
- return this.request("POST", "/api/v1/preflight", req);
68344
+ async preflightChangeSet(req, opts) {
68345
+ const extra = {};
68346
+ const token = opts && typeof opts.scmToken === "string" ? opts.scmToken.trim() : "";
68347
+ if (token)
68348
+ extra["X-Coderifts-Scm-Token"] = token;
68349
+ return this.request("POST", "/api/v1/preflight", req, extra);
68345
68350
  }
68346
68351
  /**
68347
68352
  * Risk-only preflight (`preflight_mode: 'analyze'`). Informational — not permission;
@@ -68350,11 +68355,11 @@ var require_client = __commonJS({
68350
68355
  * The mode is fixed by this method, so the analyze branch is returned directly — there is no
68351
68356
  * `decision` / `execution_action` / `safe_for_agent` on it, by protocol.
68352
68357
  */
68353
- async analyzeChangeSet(req) {
68358
+ async analyzeChangeSet(req, opts) {
68354
68359
  return this.preflightChangeSet({
68355
68360
  ...req,
68356
68361
  preflight_mode: "analyze"
68357
- });
68362
+ }, opts);
68358
68363
  }
68359
68364
  /**
68360
68365
  * Operation-bound authorize preflight (`preflight_mode: 'authorize'`).
@@ -68364,11 +68369,11 @@ var require_client = __commonJS({
68364
68369
  * The mode is fixed by this method, so the authorize branch is returned directly:
68365
68370
  * `decision`, `execution_action` and `safe_for_agent` are present without narrowing.
68366
68371
  */
68367
- async authorizeChangeSet(req) {
68372
+ async authorizeChangeSet(req, opts) {
68368
68373
  return this.preflightChangeSet({
68369
68374
  ...req,
68370
68375
  preflight_mode: "authorize"
68371
- });
68376
+ }, opts);
68372
68377
  }
68373
68378
  // ─── 9. verifyReceipt ──────────────────────────────────────────────────
68374
68379
  /**
@@ -68581,7 +68586,7 @@ var require_execution_grant = __commonJS({
68581
68586
  "node_modules/@coderifts/sdk/dist/cjs/execution-grant.js"(exports2) {
68582
68587
  "use strict";
68583
68588
  Object.defineProperty(exports2, "__esModule", { value: true });
68584
- exports2.CLOCK_SKEW_LEEWAY_MS = exports2.GRANT_SIGNING_PREFIX = exports2.GRANT_VERSION = void 0;
68589
+ exports2.CLOCK_SKEW_LEEWAY_MS = exports2.GRANT_SIGNING_PREFIX = exports2.GRANT_VERSION_V2 = exports2.GRANT_VERSION = void 0;
68585
68590
  exports2.afterPayloadCanonical = afterPayloadCanonical;
68586
68591
  exports2.computeScopeHash = computeScopeHash;
68587
68592
  exports2.receiptDigest = receiptDigest;
@@ -68592,6 +68597,7 @@ var require_execution_grant = __commonJS({
68592
68597
  return leeway_js_1.CLOCK_SKEW_LEEWAY_MS;
68593
68598
  } });
68594
68599
  exports2.GRANT_VERSION = "cr.exec.v1";
68600
+ exports2.GRANT_VERSION_V2 = "cr.exec.v2";
68595
68601
  exports2.GRANT_SIGNING_PREFIX = "crexec.v1";
68596
68602
  var NUL = "";
68597
68603
  var SIGNED_FIELDS = [
@@ -69226,7 +69232,7 @@ var require_cjs3 = __commonJS({
69226
69232
  "node_modules/@coderifts/sdk/dist/cjs/index.js"(exports2) {
69227
69233
  "use strict";
69228
69234
  Object.defineProperty(exports2, "__esModule", { value: true });
69229
- exports2.MONITOR_ATTEST_ENVELOPE_TAG = exports2.MONITOR_ATTEST_SIGNING_PREFIX = exports2.MONITOR_ATTEST_VERSION = exports2.monitorAttestSigningInput = exports2.verifyMonitoringAttestation = exports2.ATTEST_ENVELOPE_TAG = exports2.ATTEST_SIGNING_PREFIX = exports2.ATTEST_VERSION = exports2.attestSigningInput = exports2.verifyExecutionAttestation = exports2.GRANT_SIGNING_PREFIX = exports2.GRANT_VERSION = exports2.receiptDigest = exports2.afterPayloadCanonical = exports2.computeScopeHash = exports2.verifyExecutionGrant = exports2.isIssuedInFuture = exports2.isReceiptExpired = exports2.declaresDestructiveProduction = exports2.expiryLeewayMs = exports2.CLOCK_SKEW_LEEWAY_MS = exports2.readDecision = exports2.AuthError = exports2.RateLimitError = exports2.TimeoutError = exports2.ApiError = exports2.CodeRiftsError = exports2.resetPolicyWarnForTests = exports2.warnPolicyAbsentOnce = exports2.observePolicyPresence = exports2.detectPolicyPresence = exports2.policyPresenceOf = exports2.withPolicy = exports2.POLICY_ABSENT_WARN = exports2.POLICY_MARKER = exports2.CODERIFTS_POLICY = exports2.CodeRifts = void 0;
69235
+ exports2.MONITOR_ATTEST_ENVELOPE_TAG = exports2.MONITOR_ATTEST_SIGNING_PREFIX = exports2.MONITOR_ATTEST_VERSION = exports2.monitorAttestSigningInput = exports2.verifyMonitoringAttestation = exports2.ATTEST_ENVELOPE_TAG = exports2.ATTEST_SIGNING_PREFIX = exports2.ATTEST_VERSION = exports2.attestSigningInput = exports2.verifyExecutionAttestation = exports2.GRANT_SIGNING_PREFIX = exports2.GRANT_VERSION_V2 = exports2.GRANT_VERSION = exports2.receiptDigest = exports2.afterPayloadCanonical = exports2.computeScopeHash = exports2.verifyExecutionGrant = exports2.isIssuedInFuture = exports2.isReceiptExpired = exports2.declaresDestructiveProduction = exports2.expiryLeewayMs = exports2.CLOCK_SKEW_LEEWAY_MS = exports2.readDecision = exports2.AuthError = exports2.RateLimitError = exports2.TimeoutError = exports2.ApiError = exports2.CodeRiftsError = exports2.resetPolicyWarnForTests = exports2.warnPolicyAbsentOnce = exports2.observePolicyPresence = exports2.detectPolicyPresence = exports2.policyPresenceOf = exports2.withPolicy = exports2.POLICY_ABSENT_WARN = exports2.POLICY_MARKER = exports2.CODERIFTS_POLICY = exports2.CodeRifts = void 0;
69230
69236
  var client_js_1 = require_client();
69231
69237
  Object.defineProperty(exports2, "CodeRifts", { enumerable: true, get: function() {
69232
69238
  return client_js_1.CodeRifts;
@@ -69311,6 +69317,9 @@ var require_cjs3 = __commonJS({
69311
69317
  Object.defineProperty(exports2, "GRANT_VERSION", { enumerable: true, get: function() {
69312
69318
  return execution_grant_js_1.GRANT_VERSION;
69313
69319
  } });
69320
+ Object.defineProperty(exports2, "GRANT_VERSION_V2", { enumerable: true, get: function() {
69321
+ return execution_grant_js_1.GRANT_VERSION_V2;
69322
+ } });
69314
69323
  Object.defineProperty(exports2, "GRANT_SIGNING_PREFIX", { enumerable: true, get: function() {
69315
69324
  return execution_grant_js_1.GRANT_SIGNING_PREFIX;
69316
69325
  } });
@@ -70168,6 +70177,35 @@ var require_deny_remedy = __commonJS({
70168
70177
  }
70169
70178
  });
70170
70179
 
70180
+ // node_modules/@coderifts/agent-guard/dist/cjs/next-agent-step.js
70181
+ var require_next_agent_step = __commonJS({
70182
+ "node_modules/@coderifts/agent-guard/dist/cjs/next-agent-step.js"(exports2) {
70183
+ "use strict";
70184
+ Object.defineProperty(exports2, "__esModule", { value: true });
70185
+ exports2.NEXT_STEP_NOTE = exports2.NEXT_AGENT_ACTIONS = void 0;
70186
+ exports2.readNextAgentStep = readNextAgentStep;
70187
+ exports2.NEXT_AGENT_ACTIONS = [
70188
+ "re_preflight",
70189
+ "revert",
70190
+ "migrate",
70191
+ "escalate",
70192
+ "await_approval"
70193
+ ];
70194
+ function readNextAgentStep(envelope) {
70195
+ if (!envelope || typeof envelope !== "object")
70196
+ return null;
70197
+ const raw = envelope.next_agent_step;
70198
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
70199
+ return null;
70200
+ const step = raw;
70201
+ if (typeof step.action !== "string" || step.action.length === 0)
70202
+ return null;
70203
+ return step;
70204
+ }
70205
+ exports2.NEXT_STEP_NOTE = "This is the decision's remediation suggestion, not permission; branch on execution_action.";
70206
+ }
70207
+ });
70208
+
70171
70209
  // node_modules/@coderifts/agent-guard/dist/cjs/execution-grant.js
70172
70210
  var require_execution_grant2 = __commonJS({
70173
70211
  "node_modules/@coderifts/agent-guard/dist/cjs/execution-grant.js"(exports2) {
@@ -70315,6 +70353,7 @@ var require_guard = __commonJS({
70315
70353
  var monitoring_attestation_js_1 = require_monitoring_attestation2();
70316
70354
  var policy_js_1 = require_policy2();
70317
70355
  var deny_remedy_js_1 = require_deny_remedy();
70356
+ var next_agent_step_js_1 = require_next_agent_step();
70318
70357
  var execution_grant_js_1 = require_execution_grant2();
70319
70358
  var breakers = /* @__PURE__ */ new WeakMap();
70320
70359
  var nowMs = () => Date.now();
@@ -70494,6 +70533,7 @@ var require_guard = __commonJS({
70494
70533
  const base = { executionAttempted: false, executed: false, enforced: false, verdict, preflighted };
70495
70534
  const cov = coverageSnap(config);
70496
70535
  const cause = "cause" in verdict ? verdict.cause : null;
70536
+ const nextStep = "envelope" in verdict && "receiptVerified" in verdict && verdict.receiptVerified === true ? (0, next_agent_step_js_1.readNextAgentStep)(verdict.envelope) : null;
70497
70537
  const remedy = call ? (0, deny_remedy_js_1.buildDenyRemedy)({
70498
70538
  error: (0, deny_remedy_js_1.denyErrorForReason)(cause),
70499
70539
  target: call.toolName || null,
@@ -70518,7 +70558,8 @@ var require_guard = __commonJS({
70518
70558
  ...monitoring_attestation ? { monitoring_attestation } : {},
70519
70559
  ...coverageOutcomeFieldsFrom(cov),
70520
70560
  ...grantObs ? { execution_grant: grantObs } : {},
70521
- ...remedy ? { remedy } : {}
70561
+ ...remedy ? { remedy } : {},
70562
+ ...nextStep ? { next_step: nextStep } : {}
70522
70563
  };
70523
70564
  return attachPolicyPresence(out, config);
70524
70565
  }
@@ -73582,6 +73623,7 @@ var require_deploy_receipt_token = __commonJS({
73582
73623
  Object.defineProperty(exports2, "__esModule", { value: true });
73583
73624
  exports2.CHAIN_SIGNING_PREFIX = void 0;
73584
73625
  exports2.verifyDeployReceiptToken = verifyDeployReceiptToken;
73626
+ var next_agent_step_js_1 = require_next_agent_step();
73585
73627
  var node_crypto_1 = require("node:crypto");
73586
73628
  var sdk_1 = require_cjs3();
73587
73629
  var receipt_binding_js_1 = require_receipt_binding();
@@ -73714,7 +73756,12 @@ var require_deploy_receipt_token = __commonJS({
73714
73756
  bound_artifact_id: artifact == null ? null : String(artifact),
73715
73757
  verdict_fingerprint: typeof envelope.fingerprint === "string" ? envelope.fingerprint : typeof payload.fp === "string" ? payload.fp : void 0,
73716
73758
  body_hash: typeof payload.bh === "string" ? payload.bh : void 0,
73717
- target_id: envelope.target_id == null ? void 0 : String(envelope.target_id)
73759
+ target_id: envelope.target_id == null ? void 0 : String(envelope.target_id),
73760
+ // Read from the envelope the caller supplied. On the currently_authorized path the
73761
+ // body hash has already bound it; on the expired / retired-key paths the signature
73762
+ // was authentic too. Every path that did NOT authenticate returns through fail(),
73763
+ // which sets view: null — so this field cannot carry an unsigned step.
73764
+ next_agent_step: (0, next_agent_step_js_1.readNextAgentStep)(envelope)
73718
73765
  };
73719
73766
  }
73720
73767
  function verifyDeployReceiptToken(input, _intended = {}, nowMs) {
@@ -73847,6 +73894,7 @@ var require_deploy_gate = __commonJS({
73847
73894
  exports2.isVerifiedDeployReceiptView = isVerifiedDeployReceiptView;
73848
73895
  exports2.deployGate = deployGate;
73849
73896
  var deploy_receipt_token_js_1 = require_deploy_receipt_token();
73897
+ var next_agent_step_js_1 = require_next_agent_step();
73850
73898
  exports2.DEPLOY_RECEIPT_VIEW_SPEC = "deploy-receipt-view.v1";
73851
73899
  function asVerifiedDeployReceiptView(view, verify_status = "VERIFIED_CURRENT") {
73852
73900
  return {
@@ -73908,16 +73956,21 @@ var require_deploy_gate = __commonJS({
73908
73956
  bound_artifact_id: r && r.bound_artifact_id != null ? norm(r.bound_artifact_id) : null,
73909
73957
  operation: r && r.operation != null ? String(r.operation) : null
73910
73958
  });
73911
- const deny = (state, reason) => ({
73912
- deploy_allowed: false,
73913
- state,
73914
- reason,
73915
- enforcement_state,
73916
- inescapable_deploy: false,
73917
- residuals: [],
73918
- detail: detailOf(receipt),
73919
- verification
73920
- });
73959
+ const nextStepOf = (r) => verification.mode === "token" ? (0, next_agent_step_js_1.readNextAgentStep)(r) : null;
73960
+ const deny = (state, reason) => {
73961
+ const step = nextStepOf(receipt);
73962
+ return {
73963
+ deploy_allowed: false,
73964
+ state,
73965
+ reason,
73966
+ enforcement_state,
73967
+ inescapable_deploy: false,
73968
+ residuals: [],
73969
+ detail: detailOf(receipt),
73970
+ verification,
73971
+ ...step ? { next_step: step } : {}
73972
+ };
73973
+ };
73921
73974
  if (!target.environment || String(target.environment).trim() === "" || !target.artifact_id || String(target.artifact_id).trim() === "") {
73922
73975
  return deny(allowPending ? "pending" : "failure", "inputs_incomplete");
73923
73976
  }
@@ -74562,9 +74615,10 @@ var require_with_coderifts = __commonJS({
74562
74615
  "node_modules/@coderifts/agent-guard/dist/cjs/with-coderifts.js"(exports2) {
74563
74616
  "use strict";
74564
74617
  Object.defineProperty(exports2, "__esModule", { value: true });
74565
- exports2.PROFILE_ENFORCING_ATOMIC_V2 = exports2.PROFILE_ENFORCING_ATOMIC_V1 = exports2.PROFILE_ENFORCING_STRICT_V1 = void 0;
74618
+ exports2.UNVERSIONED_PROFILE_NOTICE = exports2.PROFILE_ENFORCING_ATOMIC_V2 = exports2.PROFILE_ENFORCING_ATOMIC_V1 = exports2.PROFILE_ENFORCING_STRICT_V1 = void 0;
74566
74619
  exports2.foldTableSettledCalls = foldTableSettledCalls;
74567
74620
  exports2.guardedFractionAmongRoutes = guardedFractionAmongRoutes;
74621
+ exports2._resetUnversionedProfileNoticeForTest = _resetUnversionedProfileNoticeForTest;
74568
74622
  exports2.withCodeRifts = withCodeRifts;
74569
74623
  var tool_registry_js_1 = require_tool_registry();
74570
74624
  var execution_grant_js_1 = require_execution_grant2();
@@ -74625,6 +74679,19 @@ var require_with_coderifts = __commonJS({
74625
74679
  function isEnforcingStrict(input) {
74626
74680
  return input.profile === "ENFORCING_STRICT" || input.profile === exports2.PROFILE_ENFORCING_STRICT_V1;
74627
74681
  }
74682
+ exports2.UNVERSIONED_PROFILE_NOTICE = "ENFORCING_STRICT is the unversioned spelling of ENFORCING_STRICT_V1; prefer the versioned name.";
74683
+ var noticedUnversionedProfile = false;
74684
+ function _resetUnversionedProfileNoticeForTest() {
74685
+ noticedUnversionedProfile = false;
74686
+ }
74687
+ function noticeUnversionedProfileOnce(profile) {
74688
+ if (profile !== "ENFORCING_STRICT")
74689
+ return;
74690
+ if (noticedUnversionedProfile)
74691
+ return;
74692
+ noticedUnversionedProfile = true;
74693
+ console.warn(exports2.UNVERSIONED_PROFILE_NOTICE);
74694
+ }
74628
74695
  function enforcingStrictExecutionChainProblems(input) {
74629
74696
  const grant = input.executionGrant;
74630
74697
  const enabled = !!(grant && grant.enabled === true);
@@ -74855,6 +74922,7 @@ var require_with_coderifts = __commonJS({
74855
74922
  if (!input || typeof input !== "object") {
74856
74923
  throw new Error("withCodeRifts: input object is required");
74857
74924
  }
74925
+ noticeUnversionedProfileOnce(input.profile);
74858
74926
  const problems = [];
74859
74927
  if (typeof input.operation !== "string" || input.operation.trim() === "") {
74860
74928
  problems.push("`operation` is required and must be a non-empty string (receipts bind to an operation; merge != deploy, so there is no safe default)");
@@ -75525,6 +75593,110 @@ var require_gemini = __commonJS({
75525
75593
  }
75526
75594
  });
75527
75595
 
75596
+ // node_modules/@coderifts/agent-guard/dist/cjs/adapters/langchain.js
75597
+ var require_langchain = __commonJS({
75598
+ "node_modules/@coderifts/agent-guard/dist/cjs/adapters/langchain.js"(exports2) {
75599
+ "use strict";
75600
+ Object.defineProperty(exports2, "__esModule", { value: true });
75601
+ exports2.LANGCHAIN_ARTIFACT_SPEC = void 0;
75602
+ exports2.defaultSerializeLangChainToolResult = defaultSerializeLangChainToolResult;
75603
+ exports2.bindLangChainToolOutcome = bindLangChainToolOutcome;
75604
+ var final_answer_proof_js_1 = require_final_answer_proof();
75605
+ var gate_refusal_js_1 = require_gate_refusal();
75606
+ function defaultSerializeLangChainToolResult(result) {
75607
+ if (typeof result === "string")
75608
+ return result;
75609
+ if (typeof result === "number" || typeof result === "boolean" || typeof result === "bigint" || result === null || result === void 0) {
75610
+ return String(result);
75611
+ }
75612
+ try {
75613
+ return JSON.stringify(result);
75614
+ } catch {
75615
+ return String(result);
75616
+ }
75617
+ }
75618
+ exports2.LANGCHAIN_ARTIFACT_SPEC = "coderifts-guard-artifact.v1";
75619
+ function bindLangChainToolOutcome(outcome, args) {
75620
+ const serialize = args.serialize ?? defaultSerializeLangChainToolResult;
75621
+ let body;
75622
+ if (outcome.executed === true) {
75623
+ body = serialize(outcome.result);
75624
+ } else if (outcome.executionAttempted === false) {
75625
+ body = (0, gate_refusal_js_1.formatGateRefusalBody)(outcome);
75626
+ } else {
75627
+ const err = "error" in outcome ? outcome.error : void 0;
75628
+ const kind = (0, gate_refusal_js_1.verdictKind)(outcome);
75629
+ body = `Tool execution failed after gate decision (verdict: ${kind}): ${(0, gate_refusal_js_1.formatGuardError)(err)}`;
75630
+ }
75631
+ const content = args.attachProof === false ? body : (0, final_answer_proof_js_1.attachProofToAgentResponse)(body, outcome.proof);
75632
+ const out = {
75633
+ content,
75634
+ artifact: {
75635
+ artifact_spec: exports2.LANGCHAIN_ARTIFACT_SPEC,
75636
+ final_answer_proof: outcome.proof,
75637
+ executed: outcome.executed === true,
75638
+ enforced: outcome.enforced === true,
75639
+ verdict: (0, gate_refusal_js_1.verdictKind)(outcome)
75640
+ },
75641
+ tool_call_id: args.tool_call_id
75642
+ };
75643
+ if (args.name != null && args.name !== "") {
75644
+ out.name = args.name;
75645
+ }
75646
+ return out;
75647
+ }
75648
+ }
75649
+ });
75650
+
75651
+ // node_modules/@coderifts/agent-guard/dist/cjs/adapters/crewai.js
75652
+ var require_crewai = __commonJS({
75653
+ "node_modules/@coderifts/agent-guard/dist/cjs/adapters/crewai.js"(exports2) {
75654
+ "use strict";
75655
+ Object.defineProperty(exports2, "__esModule", { value: true });
75656
+ exports2.defaultSerializeCrewAIToolResult = defaultSerializeCrewAIToolResult;
75657
+ exports2.bindCrewAIToolOutcome = bindCrewAIToolOutcome;
75658
+ var final_answer_proof_js_1 = require_final_answer_proof();
75659
+ var gate_refusal_js_1 = require_gate_refusal();
75660
+ function defaultSerializeCrewAIToolResult(result) {
75661
+ if (typeof result === "string")
75662
+ return result;
75663
+ if (typeof result === "number" || typeof result === "boolean" || typeof result === "bigint" || result === null || result === void 0) {
75664
+ return String(result);
75665
+ }
75666
+ try {
75667
+ return JSON.stringify(result);
75668
+ } catch {
75669
+ return String(result);
75670
+ }
75671
+ }
75672
+ function bindCrewAIToolOutcome(outcome, args) {
75673
+ const serialize = args.serialize ?? defaultSerializeCrewAIToolResult;
75674
+ let body;
75675
+ let resultAsAnswer;
75676
+ if (outcome.executed === true) {
75677
+ body = serialize(outcome.result);
75678
+ resultAsAnswer = false;
75679
+ } else if (outcome.executionAttempted === false) {
75680
+ body = (0, gate_refusal_js_1.formatGateRefusalBody)(outcome);
75681
+ resultAsAnswer = true;
75682
+ } else {
75683
+ const err = "error" in outcome ? outcome.error : void 0;
75684
+ const kind = (0, gate_refusal_js_1.verdictKind)(outcome);
75685
+ body = `Tool execution failed after gate decision (verdict: ${kind}): ${(0, gate_refusal_js_1.formatGuardError)(err)}`;
75686
+ resultAsAnswer = true;
75687
+ }
75688
+ const result = args.attachProof === false ? body : (0, final_answer_proof_js_1.attachProofToAgentResponse)(body, outcome.proof);
75689
+ const out = {
75690
+ result,
75691
+ result_as_answer: resultAsAnswer,
75692
+ tool_name: args.tool_name,
75693
+ final_answer_proof: outcome.proof
75694
+ };
75695
+ return out;
75696
+ }
75697
+ }
75698
+ });
75699
+
75528
75700
  // node_modules/@coderifts/agent-guard/dist/cjs/adapters/vercel.js
75529
75701
  var require_vercel = __commonJS({
75530
75702
  "node_modules/@coderifts/agent-guard/dist/cjs/adapters/vercel.js"(exports2) {
@@ -76221,9 +76393,9 @@ var require_cjs4 = __commonJS({
76221
76393
  Object.defineProperty(exports2, "__esModule", { value: true });
76222
76394
  exports2.monitorAttestSigningInput = exports2.kidFromMonitoringAttestation = exports2.tryIssueMonitoringAttestation = exports2.DEFAULT_MONITORING_SINK_TIMEOUT_MS = exports2.ackBytes = exports2.verifyAckHmac = exports2.monitoringDeliveryFailClosed = exports2.formatMonitoringDeliveryLine = exports2.deliverMonitoring = exports2.hashObservedContent = exports2.observeCommit = exports2.deriveKeySignal = exports2.pathClass = exports2.classifyCommand = exports2.projectState = exports2.emptySessionState = exports2.computeTainted = exports2.evaluate = exports2.updateSession = exports2.SESSION_TAINT_VERSION = exports2.SessionTaintTracker = exports2.readDecision = exports2.EXECUTION_TIME_FP_REASONS = exports2.EXECUTION_STATE_UNMEASURABLE_NOTE = exports2.isUnmeasurableExecutionStateReason = exports2.computeCanonicalBundleFingerprint = exports2.authorizedFingerprintFromEnvelope = exports2.checkExecutionTimeFingerprint = exports2.computeBundleFingerprint = exports2.computeArtifactDigest = exports2.evaluateEnvelope = exports2.RECEIPT_PREV_NULL = exports2.decodeReceiptBodyPrev = exports2.previousReceiptCommitment = exports2.verifyReceiptChainLinkage = exports2.canonicalJson = exports2.computeBodyHash = exports2.bindReceiptToEnvelope = exports2.DETECTOR_VERSION = exports2.builtinDetector = exports2.resetPolicyWarnForTests = exports2.warnPolicyAbsentOnce = exports2.observePolicyPresence = exports2.detectPolicyPresence = exports2.policyPresenceOf = exports2.withPolicy = exports2.POLICY_ABSENT_WARN = exports2.POLICY_MARKER = exports2.CODERIFTS_POLICY = exports2.guardToolCall = void 0;
76223
76395
  exports2.createDbVersionToken = exports2.API_ABSENT_TOKEN = exports2.API_VERSION_TOKEN_PREFIX = exports2.apiTokenRaw = exports2.writeApiIfUnchanged = exports2.createApiVersionToken = exports2.identitiesEqual = exports2.fsObjectIdentity = exports2.UnsafeCasPathError = exports2.assertSafeCasPath = exports2.FS_ABSENT_TOKEN = exports2.FS_VERSION_TOKEN_PREFIX = exports2.fsTokenContentHash = exports2.createFsPriorContentResolver = exports2.writeFileIfUnchanged = exports2.readVersionedFile = exports2.createFsVersionToken = exports2.StaleVersionTokenAbort = exports2.executeIfUnchanged = exports2.RESIDUAL_UNCONDITIONAL_WRITE = exports2.conditionalWriteResidual = exports2.tokensEqual = exports2.buildConditionalWriteBasis = exports2.buildFreshnessBasis = exports2.collectFreshnessCallContext = exports2.artifactIdsForResolve = exports2.isMutatingCall = exports2.isWriteStyleCall = exports2.freshnessAllowsEnforce = exports2.computePathSetTreeHash = exports2.contentByteIdentical = exports2.assessWriteStylePrior = exports2.assessFreshness = exports2.deriveProofBanner = exports2.attachProofToAgentResponse = exports2.renderFinalAnswerProof = exports2.EXECUTION_PROOF_SPEC = exports2.assertEnforcedReceiptInvariant = exports2.hashExecutionResult = exports2.buildExecutionProof = exports2.COVERAGE_ATTEST_ENVELOPE_TAG = exports2.COVERAGE_ATTEST_SIGNING_PREFIX = exports2.COVERAGE_ATTEST_VERSION = exports2.coverageAttestSigningInput = exports2.kidFromCoverageAttestation = exports2.tryIssueCoverageAttestation = exports2.MONITOR_ATTEST_ENVELOPE_TAG = exports2.MONITOR_ATTEST_SIGNING_PREFIX = exports2.MONITOR_ATTEST_VERSION = exports2.receiptDigestOfToken = void 0;
76224
- exports2.guardedFractionAmongRoutes = exports2.foldTableSettledCalls = exports2.withCodeRifts = exports2.AUTO_DERIVE_READ_TIMEOUT_MS = exports2.AUTO_DERIVE_SOURCE = exports2.defaultFsReader = exports2.normalizeAutoDerive = exports2.runAutoDerive = exports2.AUTO_RECHECK_MAX_CAP = exports2.clampMaxAttempts = exports2.normalizeAutoRecheck = exports2.runAutoRecheckLoop = exports2.coverageReport = exports2.DEPLOY_REPAIRABLE_REASONS = exports2.bindDeploy = exports2.verifyDeployReceiptToken = exports2.DEPLOY_RECEIPT_VIEW_SPEC = exports2.isVerifiedDeployReceiptView = exports2.asVerifiedDeployReceiptView = exports2.deployGate = exports2.gateDecision = exports2.RegistryConstructionError = exports2.guardToolRegistry = exports2.globToRegExp = exports2.matchGlob = exports2.blobMapKey = exports2.classifyByName = exports2.resolveArtifacts = exports2.REMEDIATION_LOOP_ATTESTATION_SPEC = exports2.isCasAttestation = exports2.readPriorBlockRemediation = exports2.readRemediationTransaction = exports2.buildRemediationLoopAttestation = exports2.COMMIT_EVIDENCE_MISSING = exports2.CAS_ATTESTATION_SPEC = exports2.strictCommitObservation = exports2.extractExecutorAttestationToken = exports2.evaluateCasEvidence = exports2.isExecuteIfUnchangedOutcome = exports2.isGuardExecutionProof = exports2.buildCasAttestation = exports2.REGISTRY_ABSENT_TOKEN = exports2.REGISTRY_VERSION_TOKEN_PREFIX = exports2.registryTokenRaw = exports2.writeRegistryIfUnchanged = exports2.createRegistryVersionToken = exports2.DB_ABSENT_TOKEN = exports2.DB_VERSION_TOKEN_PREFIX = exports2.dbTokenRaw = exports2.writeDbIfUnchanged = void 0;
76225
- exports2.withCodeRiftsGemini = exports2.measureFsAuthorizationToken = exports2.measureFsAuthorization = exports2.wrapWriteWithFsCas = exports2.inferFullFileWriteContent = exports2.inferFsPathFromArgs = exports2.FRESHNESS_RESOLVER_FIX = exports2.freshnessRefusalTeaching = exports2.formatGateRefusalBody = exports2.defaultSerializeLangGraphToolResult = exports2.bindLangGraphGuardOutcome = exports2.LangGraphToolsNotStructuredError = exports2.isLangGraphReactAgentTool = exports2.bindLangGraphTools = exports2.protectedToolToLangGraph = exports2.toLangGraphTools = exports2.langGraphToolAdapter = exports2.withCodeRiftsLangGraph = exports2.defaultSerializeAnthropicToolResult = exports2.bindAnthropicGuardOutcome = exports2.protectedToolToAnthropic = exports2.toAnthropicTools = exports2.anthropicToolAdapter = exports2.withCodeRiftsAnthropic = exports2.defaultSerializeOpenAIToolResult = exports2.bindOpenAIGuardOutcome = exports2.protectedToolToOpenAI = exports2.toOpenAITools = exports2.openAIToolAdapter = exports2.withCodeRiftsOpenAI = exports2.formatCoverageObservedLine = exports2.freezeCoverageObserved = exports2.createCoverageObserver = exports2.readExecutionGrantToken = exports2.isExecutionGrantEnabled = exports2.POSTURE_CLOCK_SKEW_TOLERANCE_MS = exports2.POSTURE_RECEIPT_V = exports2.verifyPostureReceipt = exports2.ATOMIC_V2_MAX_AGE_MS_CAP = exports2.CREDENTIAL_BOUNDARY_BARE_REJECTED = exports2.atomicConstructionProblems = exports2.isEnforcingAtomicV2 = exports2.PROFILE_ENFORCING_ATOMIC_V2 = exports2.isEnforcingAtomic = exports2.atomicOutcome = exports2.ATOMIC_PROFILE_UNSATISFIED = exports2.ATOMIC_INVARIANTS = exports2.createMutatorRegister = exports2.PROFILE_ENFORCING_ATOMIC_V1 = exports2.PROFILE_ENFORCING_STRICT_V1 = void 0;
76226
- exports2.kidFromToolsetAttestation = exports2.tryIssueToolsetAttestation = exports2.toolsetAttestSigningInput = exports2.declarationEntriesFromTools = exports2.computeToolsetDigest = exports2.TOOLSET_ATTEST_STATEMENT = exports2.TOOLSET_ATTEST_ENVELOPE_TAG = exports2.TOOLSET_ATTEST_SIGNING_PREFIX = exports2.TOOLSET_ATTEST_VERSION = exports2.surfaceEnvelopeFields = exports2.isGuardOutcome = exports2.executeVercelToolCall = exports2.executeLangGraphToolCall = exports2.executeGeminiToolCall = exports2.executeAnthropicToolCall = exports2.executeOpenAIToolCall = exports2.executeProtectedTool = exports2.defaultSerializeVercelToolResult = exports2.bindVercelGuardOutcome = exports2.protectedToolToVercel = exports2.toVercelTools = exports2.vercelToolAdapter = exports2.withCodeRiftsVercel = exports2.defaultSerializeGeminiToolResult = exports2.bindGeminiGuardOutcome = exports2.protectedToolToFunctionDeclaration = exports2.toGeminiTools = exports2.geminiToolAdapter = void 0;
76396
+ exports2.AUTO_DERIVE_READ_TIMEOUT_MS = exports2.AUTO_DERIVE_SOURCE = exports2.defaultFsReader = exports2.normalizeAutoDerive = exports2.runAutoDerive = exports2.AUTO_RECHECK_MAX_CAP = exports2.clampMaxAttempts = exports2.normalizeAutoRecheck = exports2.runAutoRecheckLoop = exports2.coverageReport = exports2.DEPLOY_REPAIRABLE_REASONS = exports2.bindDeploy = exports2.NEXT_STEP_NOTE = exports2.NEXT_AGENT_ACTIONS = exports2.readNextAgentStep = exports2.verifyDeployReceiptToken = exports2.DEPLOY_RECEIPT_VIEW_SPEC = exports2.isVerifiedDeployReceiptView = exports2.asVerifiedDeployReceiptView = exports2.deployGate = exports2.gateDecision = exports2.RegistryConstructionError = exports2.guardToolRegistry = exports2.globToRegExp = exports2.matchGlob = exports2.blobMapKey = exports2.classifyByName = exports2.resolveArtifacts = exports2.REMEDIATION_LOOP_ATTESTATION_SPEC = exports2.isCasAttestation = exports2.readPriorBlockRemediation = exports2.readRemediationTransaction = exports2.buildRemediationLoopAttestation = exports2.COMMIT_EVIDENCE_MISSING = exports2.CAS_ATTESTATION_SPEC = exports2.strictCommitObservation = exports2.extractExecutorAttestationToken = exports2.evaluateCasEvidence = exports2.isExecuteIfUnchangedOutcome = exports2.isGuardExecutionProof = exports2.buildCasAttestation = exports2.REGISTRY_ABSENT_TOKEN = exports2.REGISTRY_VERSION_TOKEN_PREFIX = exports2.registryTokenRaw = exports2.writeRegistryIfUnchanged = exports2.createRegistryVersionToken = exports2.DB_ABSENT_TOKEN = exports2.DB_VERSION_TOKEN_PREFIX = exports2.dbTokenRaw = exports2.writeDbIfUnchanged = void 0;
76397
+ exports2.inferFsPathFromArgs = exports2.FRESHNESS_RESOLVER_FIX = exports2.freshnessRefusalTeaching = exports2.formatGateRefusalBody = exports2.defaultSerializeLangGraphToolResult = exports2.bindLangGraphGuardOutcome = exports2.LangGraphToolsNotStructuredError = exports2.isLangGraphReactAgentTool = exports2.bindLangGraphTools = exports2.protectedToolToLangGraph = exports2.toLangGraphTools = exports2.langGraphToolAdapter = exports2.withCodeRiftsLangGraph = exports2.defaultSerializeAnthropicToolResult = exports2.bindAnthropicGuardOutcome = exports2.protectedToolToAnthropic = exports2.toAnthropicTools = exports2.anthropicToolAdapter = exports2.withCodeRiftsAnthropic = exports2.defaultSerializeOpenAIToolResult = exports2.bindOpenAIGuardOutcome = exports2.protectedToolToOpenAI = exports2.toOpenAITools = exports2.openAIToolAdapter = exports2.withCodeRiftsOpenAI = exports2.formatCoverageObservedLine = exports2.freezeCoverageObserved = exports2.createCoverageObserver = exports2.readExecutionGrantToken = exports2.isExecutionGrantEnabled = exports2.POSTURE_CLOCK_SKEW_TOLERANCE_MS = exports2.POSTURE_RECEIPT_V = exports2.verifyPostureReceipt = exports2.ATOMIC_V2_MAX_AGE_MS_CAP = exports2.CREDENTIAL_BOUNDARY_BARE_REJECTED = exports2.atomicConstructionProblems = exports2.isEnforcingAtomicV2 = exports2.PROFILE_ENFORCING_ATOMIC_V2 = exports2.isEnforcingAtomic = exports2.atomicOutcome = exports2.ATOMIC_PROFILE_UNSATISFIED = exports2.ATOMIC_INVARIANTS = exports2.createMutatorRegister = exports2._resetUnversionedProfileNoticeForTest = exports2.UNVERSIONED_PROFILE_NOTICE = exports2.PROFILE_ENFORCING_ATOMIC_V1 = exports2.PROFILE_ENFORCING_STRICT_V1 = exports2.guardedFractionAmongRoutes = exports2.foldTableSettledCalls = exports2.withCodeRifts = void 0;
76398
+ exports2.kidFromToolsetAttestation = exports2.tryIssueToolsetAttestation = exports2.toolsetAttestSigningInput = exports2.declarationEntriesFromTools = exports2.computeToolsetDigest = exports2.TOOLSET_ATTEST_STATEMENT = exports2.TOOLSET_ATTEST_ENVELOPE_TAG = exports2.TOOLSET_ATTEST_SIGNING_PREFIX = exports2.TOOLSET_ATTEST_VERSION = exports2.surfaceEnvelopeFields = exports2.isGuardOutcome = exports2.executeVercelToolCall = exports2.executeLangGraphToolCall = exports2.executeGeminiToolCall = exports2.executeAnthropicToolCall = exports2.executeOpenAIToolCall = exports2.executeProtectedTool = exports2.defaultSerializeVercelToolResult = exports2.bindVercelGuardOutcome = exports2.protectedToolToVercel = exports2.toVercelTools = exports2.vercelToolAdapter = exports2.withCodeRiftsVercel = exports2.defaultSerializeCrewAIToolResult = exports2.bindCrewAIToolOutcome = exports2.LANGCHAIN_ARTIFACT_SPEC = exports2.defaultSerializeLangChainToolResult = exports2.bindLangChainToolOutcome = exports2.defaultSerializeGeminiToolResult = exports2.bindGeminiGuardOutcome = exports2.protectedToolToFunctionDeclaration = exports2.toGeminiTools = exports2.geminiToolAdapter = exports2.withCodeRiftsGemini = exports2.measureFsAuthorizationToken = exports2.measureFsAuthorization = exports2.wrapWriteWithFsCas = exports2.inferFullFileWriteContent = void 0;
76227
76399
  var guard_js_1 = require_guard();
76228
76400
  Object.defineProperty(exports2, "guardToolCall", { enumerable: true, get: function() {
76229
76401
  return guard_js_1.guardToolCall;
@@ -76658,6 +76830,16 @@ var require_cjs4 = __commonJS({
76658
76830
  Object.defineProperty(exports2, "verifyDeployReceiptToken", { enumerable: true, get: function() {
76659
76831
  return deploy_receipt_token_js_1.verifyDeployReceiptToken;
76660
76832
  } });
76833
+ var next_agent_step_js_1 = require_next_agent_step();
76834
+ Object.defineProperty(exports2, "readNextAgentStep", { enumerable: true, get: function() {
76835
+ return next_agent_step_js_1.readNextAgentStep;
76836
+ } });
76837
+ Object.defineProperty(exports2, "NEXT_AGENT_ACTIONS", { enumerable: true, get: function() {
76838
+ return next_agent_step_js_1.NEXT_AGENT_ACTIONS;
76839
+ } });
76840
+ Object.defineProperty(exports2, "NEXT_STEP_NOTE", { enumerable: true, get: function() {
76841
+ return next_agent_step_js_1.NEXT_STEP_NOTE;
76842
+ } });
76661
76843
  var deploy_bind_js_1 = require_deploy_bind();
76662
76844
  Object.defineProperty(exports2, "bindDeploy", { enumerable: true, get: function() {
76663
76845
  return deploy_bind_js_1.bindDeploy;
@@ -76714,6 +76896,12 @@ var require_cjs4 = __commonJS({
76714
76896
  Object.defineProperty(exports2, "PROFILE_ENFORCING_ATOMIC_V1", { enumerable: true, get: function() {
76715
76897
  return with_coderifts_js_1.PROFILE_ENFORCING_ATOMIC_V1;
76716
76898
  } });
76899
+ Object.defineProperty(exports2, "UNVERSIONED_PROFILE_NOTICE", { enumerable: true, get: function() {
76900
+ return with_coderifts_js_1.UNVERSIONED_PROFILE_NOTICE;
76901
+ } });
76902
+ Object.defineProperty(exports2, "_resetUnversionedProfileNoticeForTest", { enumerable: true, get: function() {
76903
+ return with_coderifts_js_1._resetUnversionedProfileNoticeForTest;
76904
+ } });
76717
76905
  var atomic_profile_js_1 = require_atomic_profile();
76718
76906
  Object.defineProperty(exports2, "createMutatorRegister", { enumerable: true, get: function() {
76719
76907
  return atomic_profile_js_1.createMutatorRegister;
@@ -76883,6 +77071,23 @@ var require_cjs4 = __commonJS({
76883
77071
  Object.defineProperty(exports2, "defaultSerializeGeminiToolResult", { enumerable: true, get: function() {
76884
77072
  return gemini_js_1.defaultSerializeGeminiToolResult;
76885
77073
  } });
77074
+ var langchain_js_1 = require_langchain();
77075
+ Object.defineProperty(exports2, "bindLangChainToolOutcome", { enumerable: true, get: function() {
77076
+ return langchain_js_1.bindLangChainToolOutcome;
77077
+ } });
77078
+ Object.defineProperty(exports2, "defaultSerializeLangChainToolResult", { enumerable: true, get: function() {
77079
+ return langchain_js_1.defaultSerializeLangChainToolResult;
77080
+ } });
77081
+ Object.defineProperty(exports2, "LANGCHAIN_ARTIFACT_SPEC", { enumerable: true, get: function() {
77082
+ return langchain_js_1.LANGCHAIN_ARTIFACT_SPEC;
77083
+ } });
77084
+ var crewai_js_1 = require_crewai();
77085
+ Object.defineProperty(exports2, "bindCrewAIToolOutcome", { enumerable: true, get: function() {
77086
+ return crewai_js_1.bindCrewAIToolOutcome;
77087
+ } });
77088
+ Object.defineProperty(exports2, "defaultSerializeCrewAIToolResult", { enumerable: true, get: function() {
77089
+ return crewai_js_1.defaultSerializeCrewAIToolResult;
77090
+ } });
76886
77091
  var vercel_js_1 = require_vercel();
76887
77092
  Object.defineProperty(exports2, "withCodeRiftsVercel", { enumerable: true, get: function() {
76888
77093
  return vercel_js_1.withCodeRiftsVercel;
@@ -180784,6 +180989,32 @@ var require_comment_renderer = __commonJS({
180784
180989
  lines.push("");
180785
180990
  return lines.join("\n");
180786
180991
  }
180992
+ var BREAKING_HIGHLIGHTS_TOP_N = 5;
180993
+ function renderBreakingHighlights(results, topN = BREAKING_HIGHLIGHTS_TOP_N) {
180994
+ if (!Array.isArray(results) || results.length === 0) return "";
180995
+ const rows = [];
180996
+ for (const r of results) {
180997
+ const file = r && typeof r.schemaPath === "string" ? r.schemaPath : "";
180998
+ for (const d of r && Array.isArray(r.breaking) ? r.breaking : []) {
180999
+ const raw = extractRawLocation(d);
181000
+ const pointer = raw && raw !== "N/A" ? raw : "";
181001
+ if (!file && !pointer) continue;
181002
+ rows.push({ file, pointer, code: d && d.code ? String(d.code) : "" });
181003
+ }
181004
+ }
181005
+ if (rows.length === 0) return "";
181006
+ const shown = rows.slice(0, topN);
181007
+ const lines = ["## \u{1F3AF} Breaking elements\n"];
181008
+ for (const row of shown) {
181009
+ const where = row.file && row.pointer ? `\`${escapeMd(row.file)}\` \xB7 \`${escapeMd(row.pointer)}\`` : `\`${escapeMd(row.file || row.pointer)}\``;
181010
+ lines.push(`- ${where}${row.code ? ` \u2014 \`${escapeMd(row.code)}\`` : ""}`);
181011
+ }
181012
+ if (rows.length > shown.length) {
181013
+ lines.push(`- \u2026and ${rows.length - shown.length} more \u2014 see **Raw diff details** below.`);
181014
+ }
181015
+ lines.push("");
181016
+ return lines.join("\n");
181017
+ }
180787
181018
  function renderAgentImpactHeadline(options) {
180788
181019
  const n = (options.omegaAgentPatterns || []).length;
180789
181020
  if (n === 0) return "";
@@ -181033,6 +181264,10 @@ var require_comment_renderer = __commonJS({
181033
181264
  const changeList = renderCanonicalChangeList(options.detectedPatterns || []);
181034
181265
  if (changeList) lines.push(changeList);
181035
181266
  }
181267
+ {
181268
+ const highlights = renderBreakingHighlights(results);
181269
+ if (highlights) lines.push(highlights);
181270
+ }
181036
181271
  {
181037
181272
  const agentLine = renderAgentImpactHeadline(options);
181038
181273
  if (agentLine) lines.push(agentLine);
@@ -181515,6 +181750,8 @@ ${body}` : poison;
181515
181750
  renderBlockReason,
181516
181751
  renderUnblockActions,
181517
181752
  renderCanonicalChangeList,
181753
+ renderBreakingHighlights,
181754
+ BREAKING_HIGHLIGHTS_TOP_N,
181518
181755
  renderAgentImpactHeadline,
181519
181756
  renderEconomicHeadline,
181520
181757
  renderPoisonGateSection,
@@ -203274,6 +203511,83 @@ var require_remediation_taxonomy = __commonJS({
203274
203511
  }
203275
203512
  });
203276
203513
 
203514
+ // ../../src/next-agent-step.js
203515
+ var require_next_agent_step2 = __commonJS({
203516
+ "../../src/next-agent-step.js"(exports2, module2) {
203517
+ "use strict";
203518
+ var NEXT_AGENT_ACTIONS = Object.freeze([
203519
+ "re_preflight",
203520
+ "revert",
203521
+ "migrate",
203522
+ "escalate",
203523
+ "await_approval"
203524
+ ]);
203525
+ var NEXT_AGENT_ACTION_SET = new Set(NEXT_AGENT_ACTIONS);
203526
+ function mapChoiceIdToNextAction(id) {
203527
+ const s = String(id == null ? "" : id);
203528
+ if (s === "re_preflight" || s === "re_preflight_deploy") return "re_preflight";
203529
+ if (s === "fix_input") return "re_preflight";
203530
+ if (s === "revert") return "revert";
203531
+ if (s === "migrate") return "migrate";
203532
+ if (s === "escalate") return "escalate";
203533
+ if (s === "obtain_human_approval") return "await_approval";
203534
+ return null;
203535
+ }
203536
+ function projectNextAgentStep(executionAction, requiredAction) {
203537
+ const ea = executionAction != null ? String(executionAction) : "";
203538
+ if (ea === "CONTINUE" || ea === "CONTINUE_WITH_MONITORING") return null;
203539
+ if (ea !== "STOP" && ea !== "REQUEST_APPROVAL") return null;
203540
+ const raObj = requiredAction && typeof requiredAction === "object" ? requiredAction : null;
203541
+ const raStr = typeof requiredAction === "string" ? requiredAction : null;
203542
+ const reason = raObj && raObj.reason_code != null && String(raObj.reason_code) || raObj && raObj.type != null && String(raObj.type) || raStr && raStr.slice(0, 200) || (ea === "REQUEST_APPROVAL" ? "request_approval" : "remediate_or_revert");
203543
+ const resume_condition = raObj && typeof raObj.resume_condition === "string" ? raObj.resume_condition : raStr || "";
203544
+ let action = null;
203545
+ if (ea === "REQUEST_APPROVAL") {
203546
+ action = "await_approval";
203547
+ } else {
203548
+ const choices = raObj && Array.isArray(raObj.choices) ? raObj.choices : [];
203549
+ for (const c of choices) {
203550
+ const id = typeof c === "string" ? c : c && c.id != null ? c.id : null;
203551
+ const mapped = mapChoiceIdToNextAction(id);
203552
+ if (mapped && NEXT_AGENT_ACTION_SET.has(mapped) && mapped !== "await_approval") {
203553
+ action = mapped;
203554
+ break;
203555
+ }
203556
+ }
203557
+ if (!action) {
203558
+ const t = raObj && raObj.type != null ? String(raObj.type) : "";
203559
+ if (t === "re_preflight" || t === "remediate_or_revert" || t === "fix_coverage" || t === "revert") {
203560
+ action = t === "revert" ? "revert" : "re_preflight";
203561
+ } else if (raStr || ea === "STOP") {
203562
+ action = "re_preflight";
203563
+ }
203564
+ }
203565
+ }
203566
+ if (!action || !NEXT_AGENT_ACTION_SET.has(action)) return null;
203567
+ let then_call = null;
203568
+ if (action === "re_preflight" || action === "revert" || action === "migrate") {
203569
+ then_call = "preflight_change_set";
203570
+ } else if (action === "await_approval") {
203571
+ then_call = null;
203572
+ } else if (action === "escalate") {
203573
+ then_call = null;
203574
+ }
203575
+ return {
203576
+ action,
203577
+ reason: String(reason),
203578
+ resume_condition: String(resume_condition),
203579
+ then_call
203580
+ };
203581
+ }
203582
+ module2.exports = {
203583
+ NEXT_AGENT_ACTIONS,
203584
+ NEXT_AGENT_ACTION_SET,
203585
+ mapChoiceIdToNextAction,
203586
+ projectNextAgentStep
203587
+ };
203588
+ }
203589
+ });
203590
+
203277
203591
  // ../../src/response-envelope.js
203278
203592
  var require_response_envelope = __commonJS({
203279
203593
  "../../src/response-envelope.js"(exports2, module2) {
@@ -203517,70 +203831,10 @@ var require_response_envelope = __commonJS({
203517
203831
  function buildEnforcementDescriptor() {
203518
203832
  return { ...ENFORCEMENT_DESCRIPTOR };
203519
203833
  }
203520
- var NEXT_AGENT_ACTIONS = Object.freeze([
203521
- "re_preflight",
203522
- "revert",
203523
- "migrate",
203524
- "escalate",
203525
- "await_approval"
203526
- ]);
203527
- var NEXT_AGENT_ACTION_SET = new Set(NEXT_AGENT_ACTIONS);
203528
- function mapChoiceIdToNextAction(id) {
203529
- const s = String(id == null ? "" : id);
203530
- if (s === "re_preflight" || s === "re_preflight_deploy") return "re_preflight";
203531
- if (s === "fix_input") return "re_preflight";
203532
- if (s === "revert") return "revert";
203533
- if (s === "migrate") return "migrate";
203534
- if (s === "escalate") return "escalate";
203535
- if (s === "obtain_human_approval") return "await_approval";
203536
- return null;
203537
- }
203538
- function projectNextAgentStep(executionAction, requiredAction) {
203539
- const ea = executionAction != null ? String(executionAction) : "";
203540
- if (ea === "CONTINUE" || ea === "CONTINUE_WITH_MONITORING") return null;
203541
- if (ea !== "STOP" && ea !== "REQUEST_APPROVAL") return null;
203542
- const raObj = requiredAction && typeof requiredAction === "object" ? requiredAction : null;
203543
- const raStr = typeof requiredAction === "string" ? requiredAction : null;
203544
- const reason = raObj && raObj.reason_code != null && String(raObj.reason_code) || raObj && raObj.type != null && String(raObj.type) || raStr && raStr.slice(0, 200) || (ea === "REQUEST_APPROVAL" ? "request_approval" : "remediate_or_revert");
203545
- const resume_condition = raObj && typeof raObj.resume_condition === "string" ? raObj.resume_condition : raStr || "";
203546
- let action = null;
203547
- if (ea === "REQUEST_APPROVAL") {
203548
- action = "await_approval";
203549
- } else {
203550
- const choices = raObj && Array.isArray(raObj.choices) ? raObj.choices : [];
203551
- for (const c of choices) {
203552
- const id = typeof c === "string" ? c : c && c.id != null ? c.id : null;
203553
- const mapped = mapChoiceIdToNextAction(id);
203554
- if (mapped && NEXT_AGENT_ACTION_SET.has(mapped) && mapped !== "await_approval") {
203555
- action = mapped;
203556
- break;
203557
- }
203558
- }
203559
- if (!action) {
203560
- const t = raObj && raObj.type != null ? String(raObj.type) : "";
203561
- if (t === "re_preflight" || t === "remediate_or_revert" || t === "fix_coverage" || t === "revert") {
203562
- action = t === "revert" ? "revert" : "re_preflight";
203563
- } else if (raStr || ea === "STOP") {
203564
- action = "re_preflight";
203565
- }
203566
- }
203567
- }
203568
- if (!action || !NEXT_AGENT_ACTION_SET.has(action)) return null;
203569
- let then_call = null;
203570
- if (action === "re_preflight" || action === "revert" || action === "migrate") {
203571
- then_call = "preflight_change_set";
203572
- } else if (action === "await_approval") {
203573
- then_call = null;
203574
- } else if (action === "escalate") {
203575
- then_call = null;
203576
- }
203577
- return {
203578
- action,
203579
- reason: String(reason),
203580
- resume_condition: String(resume_condition),
203581
- then_call
203582
- };
203583
- }
203834
+ var {
203835
+ NEXT_AGENT_ACTIONS,
203836
+ projectNextAgentStep
203837
+ } = require_next_agent_step2();
203584
203838
  function buildControlEnvelope(verdict, authzContext) {
203585
203839
  const receipt_view = projectReceipt(verdict, authzContext);
203586
203840
  let safeForAgent = verdict.safe_for_agent;
@@ -205272,6 +205526,48 @@ var require_decision_result_v1_producer = __commonJS({
205272
205526
  }
205273
205527
  }
205274
205528
  },
205529
+ next_agent_step: {
205530
+ type: [
205531
+ "object",
205532
+ "null"
205533
+ ],
205534
+ additionalProperties: false,
205535
+ required: [
205536
+ "action",
205537
+ "reason",
205538
+ "resume_condition",
205539
+ "then_call"
205540
+ ],
205541
+ description: "Additive (I-1288). The decision's own remediation SUGGESTION, projected at issuance from execution_action + required_action_core \u2014 the identical pure function that fills control_envelope.next_agent_step (src/next-agent-step.js). One projection, two placements, never two rules. INSIDE the envelope it is covered by decision_body_hash, so the signed receipt covers the suggestion along with the decision that produced it: a consumer handed only the envelope (k8s-admission, gateway-verifier, agent-guard deployGate) can render the next step without a second call to the issuer, and a tampered step no longer verifies. NOT PERMISSION and NOT a control-flow override \u2014 branch on execution_action. null on the allow class (CONTINUE / CONTINUE_WITH_MONITORING) is the correct value, not a missing measurement; null also on legacy non-additive envelopes, which never carry the field.",
205542
+ properties: {
205543
+ action: {
205544
+ type: "string",
205545
+ enum: [
205546
+ "re_preflight",
205547
+ "revert",
205548
+ "migrate",
205549
+ "escalate",
205550
+ "await_approval"
205551
+ ],
205552
+ description: "Closed set \u2014 src/next-agent-step.js NEXT_AGENT_ACTIONS."
205553
+ },
205554
+ reason: {
205555
+ type: "string",
205556
+ description: "required_action reason_code / type, or the display string when that is all the issuance path had."
205557
+ },
205558
+ resume_condition: {
205559
+ type: "string",
205560
+ description: "What must hold before the caller retries. Projected from the FROZEN required_action_core, which carries no receipt-authz overlay, so this is the one subfield that may be thinner than control_envelope.next_agent_step.resume_condition (the live surface projects from deriveRequiredAction, which has the overlay and can name the approval receipt it wants). Signing the overlay text would sign a fact the envelope deliberately excludes. Empty string when the frozen core supplied none \u2014 not an error."
205561
+ },
205562
+ then_call: {
205563
+ type: [
205564
+ "string",
205565
+ "null"
205566
+ ],
205567
+ description: "Tool to call after the step, or null when the next move is a human one."
205568
+ }
205569
+ }
205570
+ },
205275
205571
  remediation_transaction: {
205276
205572
  type: [
205277
205573
  "object",
@@ -205966,6 +206262,174 @@ var require_decision_result_validator = __commonJS({
205966
206262
  }
205967
206263
  });
205968
206264
 
206265
+ // ../../schemas/execution-grant-request.v2.producer.json
206266
+ var require_execution_grant_request_v2_producer = __commonJS({
206267
+ "../../schemas/execution-grant-request.v2.producer.json"(exports2, module2) {
206268
+ module2.exports = {
206269
+ $schema: "https://json-schema.org/draft/2020-12/schema",
206270
+ $id: "https://coderifts.com/schemas/execution-grant-request.v2.producer.json",
206271
+ title: "CodeRifts Execution Grant Request v2 \u2014 PRODUCER schema",
206272
+ description: "Execution-grant REQUEST v2 \u2014 the fields the authorize handler actually reads when minting a cr.exec.v2 grant. Measured from src/change-set.js:1209-1285 (the wantGrant/wantV2 block) plus the operation / audience / environment reads that same handler already performs, and pinned field-by-field by test/fixtures/v2-grant-field-matrix.json. PRODUCER-ONLY, DELIBERATELY. The pairing convention in schemas/ is not universal: decision-result.v1 and preflight-response.v2 have consumer twins because a GENERATOR derives one from the other (scripts/generate-consumer-schema.js), while control-envelope.v1 and verify-receipt.v1 are producer-only. No generator derives a request consumer, and the only thing a consumer twin would say differently is `additionalProperties`, which is stated here directly. A second hand-maintained file whose sole difference is one keyword is a drift risk, not a contract. ROLES ARE INVERTED relative to the response schemas: on a REQUEST the CLIENT is the producer and the SERVER is the consumer. `additionalProperties` is therefore TRUE, and that is a measurement of current behaviour, not an aspiration \u2014 the handler reads named fields off `input` and ignores everything else, so a client sending an extra key is accepted today. Validation is advisory by default (EXECUTION_GRANT_REQUEST_VALIDATOR_MODE=log); nothing in this schema starts rejecting a request that works now. NOT REQUEST FIELDS \u2014 MINTED BY THE ISSUER, and excluded on purpose: `jti`, `expires_at` / `expiry`, `after_payload_digest` (plus `kid`, `grant_id`, `receipt_hash`, `nonce_hash`, `not_before`, `max_attempts`). src/verdict-core/execution-grant-v2.js:110-154 derives every one of them from the signed receipt and the change set. A caller cannot supply them and the handler would not read them; listing them here would describe a request surface that does not exist. BOUND SINCE 1206 VARIANT A \u2014 `policy_hash` and `audience_hash`: both are now carried into the signed grant. `policy_hash` is forwarded by the authorize handler (src/change-set.js:1323) into the issuer, which binds it at src/verdict-core/execution-grant-v2.js:149; a verifier that states `intended.policy_hash` gets a GRANT_UNBOUND/policy_mismatch on a mismatch. `audience_hash` is NOT a request field of its own: it is derived from `audience` (execution-grant-v2.js:150) and was already enforced (:227-234), so sending it separately has no effect and it stays out of this schema. Before this change policy_hash was accepted on the wire and dropped at the handler, which minted every grant under the sha256('') default \u2014 a field that looked bound and was not.",
206273
+ type: "object",
206274
+ additionalProperties: true,
206275
+ required: [
206276
+ "include_execution_grant"
206277
+ ],
206278
+ properties: {
206279
+ include_execution_grant: {
206280
+ type: "boolean",
206281
+ description: 'Gates the whole grant path. src/change-set.js:1209 \u2014 strictly `=== true`, so any other value (including the string "true") mints no grant.'
206282
+ },
206283
+ grant_version: {
206284
+ type: "string",
206285
+ enum: [
206286
+ "v1",
206287
+ "v2"
206288
+ ],
206289
+ description: "src/change-set.js:1268 \u2014 `v2` selects the cr.exec.v2 issuer. Absent or any other value takes the v1 branch. `grantVersion` (camelCase) is accepted as an alias at the same line; both are listed so neither reads as undeclared."
206290
+ },
206291
+ grantVersion: {
206292
+ type: "string",
206293
+ enum: [
206294
+ "v1",
206295
+ "v2"
206296
+ ],
206297
+ description: "camelCase alias of grant_version, read at src/change-set.js:1268. Declared because the handler reads it, not because it is recommended."
206298
+ },
206299
+ tenant_id: {
206300
+ type: "string",
206301
+ minLength: 1,
206302
+ description: "src/change-set.js:1279 \u2014 `input.tenant_id || context.tenant_id || 'default'`. The default is a real value, not an absence: an unset tenant is issued as `default`, it is not left unbound."
206303
+ },
206304
+ executor_id: {
206305
+ type: "string",
206306
+ minLength: 1,
206307
+ description: "src/change-set.js:1277 \u2014 `input.executor_id || context.executor_id || 'local'`."
206308
+ },
206309
+ adapter_id: {
206310
+ type: "string",
206311
+ minLength: 1,
206312
+ description: "src/change-set.js:1278 \u2014 `input.adapter_id || context.adapter_id || 'fs'`."
206313
+ },
206314
+ target_uri: {
206315
+ type: "string",
206316
+ minLength: 1,
206317
+ description: "src/change-set.js:1276 \u2014 `input.target_uri || context.target_uri`, else a derived `git://{context.repository||'local/repo'}@{context.head_sha||'unknown'}`. The derived form is a fallback, not a binding the caller asked for."
206318
+ },
206319
+ state_nonce: {
206320
+ type: "string",
206321
+ minLength: 1,
206322
+ description: "src/change-set.js:1265-1267 \u2014 non-empty string only; anything else becomes null and the grant is issued without a nonce."
206323
+ },
206324
+ expected_state_token: {
206325
+ type: "string",
206326
+ description: "src/change-set.js:1281 \u2014 `nonEmptyStr(input.expected_state_token) || ''`. Empty string is the issued value when absent; there is no unbound state."
206327
+ },
206328
+ audience: {
206329
+ type: "string",
206330
+ pattern: "^v:[0-9a-f]{12}$",
206331
+ description: "src/change-set.js:1120-1124 \u2014 ONLY the measured `v:<12 hex>` form is accepted; any other string is discarded to null rather than trusted as identity. A free-form caller-supplied name is never an audience."
206332
+ },
206333
+ policy_hash: {
206334
+ type: "string",
206335
+ minLength: 1,
206336
+ description: "src/change-set.js:1305 \u2014 the policy identity this request is made under, bound into the signed grant (execution-grant-v2.js:149). A value already prefixed `sha256:` is carried through; anything else is hashed. Absent \u2192 the issuer's sha256('') default, which is what every grant carried before 1206 variant A. Enforced only by a verifier that states intended.policy_hash \u2014 binding is not by itself a check."
206337
+ },
206338
+ context: {
206339
+ type: "object",
206340
+ additionalProperties: true,
206341
+ description: "The request context object (src/change-set.js:806). Only the keys the grant path reads are declared; the handler reads many others for unrelated purposes and tolerates the rest, so additionalProperties stays true here for the same reason it does at the root.",
206342
+ properties: {
206343
+ operation: {
206344
+ type: "string",
206345
+ minLength: 1,
206346
+ description: "src/change-set.js:807-812 \u2014 REQUIRED for preflight_mode=authorize; the handler throws a typed input error without one. Authorization asks permission for a named operation."
206347
+ },
206348
+ environment: {
206349
+ type: "string",
206350
+ description: "src/change-set.js:1159 \u2014 carried onto the envelope. Not a grant field; read by the same handler on the same request."
206351
+ },
206352
+ target_id: {
206353
+ type: "string",
206354
+ description: "src/change-set.js:1264 \u2014 v1 grant target fallback; the v2 branch uses target_uri instead."
206355
+ },
206356
+ target_uri: {
206357
+ type: "string",
206358
+ description: "src/change-set.js:1276 \u2014 fallback when input.target_uri is absent."
206359
+ },
206360
+ executor_id: {
206361
+ type: "string",
206362
+ description: "src/change-set.js:1277 \u2014 fallback when input.executor_id is absent."
206363
+ },
206364
+ adapter_id: {
206365
+ type: "string",
206366
+ description: "src/change-set.js:1278 \u2014 fallback when input.adapter_id is absent."
206367
+ },
206368
+ tenant_id: {
206369
+ type: "string",
206370
+ description: "src/change-set.js:1279 \u2014 fallback when input.tenant_id is absent."
206371
+ },
206372
+ repository: {
206373
+ type: "string",
206374
+ description: "src/change-set.js:1276 \u2014 feeds the DERIVED target_uri when no explicit one was supplied."
206375
+ },
206376
+ head_sha: {
206377
+ type: "string",
206378
+ description: "src/change-set.js:1276 \u2014 feeds the DERIVED target_uri when no explicit one was supplied."
206379
+ }
206380
+ }
206381
+ }
206382
+ },
206383
+ $comment: "Field set pinned by test/fixtures/v2-grant-field-matrix.json (schema column) and test/execution-grant-request-schema.test.js. Adding a property here without adding the matching matrix cell fails the drift gate."
206384
+ };
206385
+ }
206386
+ });
206387
+
206388
+ // ../../src/execution-grant-request-validator.js
206389
+ var require_execution_grant_request_validator = __commonJS({
206390
+ "../../src/execution-grant-request-validator.js"(exports2, module2) {
206391
+ "use strict";
206392
+ var Ajv2020 = require__();
206393
+ var requestSchema = require_execution_grant_request_v2_producer();
206394
+ var ajv = new Ajv2020({ strict: false, allErrors: true });
206395
+ var _validate = ajv.compile(requestSchema);
206396
+ function isV2GrantRequest(input) {
206397
+ if (!input || typeof input !== "object") return false;
206398
+ if (input.include_execution_grant !== true) return false;
206399
+ return input.grant_version === "v2" || input.grantVersion === "v2";
206400
+ }
206401
+ function validateExecutionGrantRequest(input) {
206402
+ const valid = _validate(input);
206403
+ return { valid: !!valid, errors: valid ? [] : _validate.errors || [] };
206404
+ }
206405
+ function validatorMode() {
206406
+ return process.env.EXECUTION_GRANT_REQUEST_VALIDATOR_MODE === "enforce" ? "enforce" : "log";
206407
+ }
206408
+ function guardExecutionGrantRequest(input, { logger } = {}) {
206409
+ if (!isV2GrantRequest(input)) return { ok: true, skipped: true };
206410
+ const { valid, errors } = validateExecutionGrantRequest(input);
206411
+ if (valid) return { ok: true };
206412
+ const error = { code: "GRANT_REQUEST_SCHEMA_VALIDATION_FAILED", errors };
206413
+ if (validatorMode() === "enforce") {
206414
+ return { ok: false, error };
206415
+ }
206416
+ if (logger && typeof logger.warn === "function") {
206417
+ logger.warn(
206418
+ { severity: "MEDIUM", event: "execution_grant_request_schema_violation", errors },
206419
+ "v2 execution-grant request failed producer-schema validation (log mode \u2014 the request proceeds unchanged)"
206420
+ );
206421
+ }
206422
+ return { ok: true };
206423
+ }
206424
+ module2.exports = {
206425
+ validateExecutionGrantRequest,
206426
+ guardExecutionGrantRequest,
206427
+ isV2GrantRequest,
206428
+ validatorMode
206429
+ };
206430
+ }
206431
+ });
206432
+
205969
206433
  // ../../src/source-binding-gate.js
205970
206434
  var require_source_binding_gate = __commonJS({
205971
206435
  "../../src/source-binding-gate.js"(exports2, module2) {
@@ -206968,6 +207432,13 @@ var require_execution_grant_v2 = __commonJS({
206968
207432
  if (intended.audience_hash != null && String(intended.audience_hash).length > 0 && payload.audience_hash !== String(intended.audience_hash)) {
206969
207433
  return { valid: false, status: "GRANT_UNBOUND", reason: "audience_mismatch", payload };
206970
207434
  }
207435
+ if (intended.policy_hash != null && String(intended.policy_hash).length > 0) {
207436
+ const wantPolicy = String(intended.policy_hash);
207437
+ const norm = wantPolicy.startsWith("sha256:") ? wantPolicy : sha256pref(wantPolicy);
207438
+ if (payload.policy_hash !== norm) {
207439
+ return { valid: false, status: "GRANT_UNBOUND", reason: "policy_mismatch", payload };
207440
+ }
207441
+ }
206971
207442
  if (intended.after_payload != null) {
206972
207443
  if (payload.after_payload_hash !== sha256pref(intended.after_payload)) {
206973
207444
  return { valid: false, status: "GRANT_UNBOUND", reason: "after_payload_mismatch", payload };
@@ -207404,6 +207875,7 @@ var require_change_set = __commonJS({
207404
207875
  var { buildDecisionResultV1 } = require_decision_result();
207405
207876
  var { deriveRequiredAction } = require_response_envelope();
207406
207877
  var { guardDecisionResult } = require_decision_result_validator();
207878
+ var { guardExecutionGrantRequest } = require_execution_grant_request_validator();
207407
207879
  var { issueReceipt, isConfigured, sha256hex } = require_chain_attestation();
207408
207880
  var { getPatternConfigHash } = require_omega_scoring();
207409
207881
  var { computeBlastRadiusCounts } = require_blast_radius_counts();
@@ -208275,6 +208747,16 @@ var require_change_set = __commonJS({
208275
208747
  }
208276
208748
  const authorizeAction = preflightMode === "authorize" ? deriveExecutionAction(core.decision) : null;
208277
208749
  const allowClass = authorizeAction === "CONTINUE" || authorizeAction === "CONTINUE_WITH_MONITORING";
208750
+ if (preflightMode === "authorize" && wantGrant) {
208751
+ const reqGuard = guardExecutionGrantRequest(input, { logger });
208752
+ if (!reqGuard.ok) {
208753
+ throw typedError(
208754
+ reqGuard.error.code,
208755
+ "execution-grant request failed producer-schema validation",
208756
+ { errors: reqGuard.error.errors }
208757
+ );
208758
+ }
208759
+ }
208278
208760
  if (preflightMode === "authorize" && wantGrant && allowClass && typeof receipt === "string" && receipt.length > 0) {
208279
208761
  try {
208280
208762
  const {
@@ -208296,7 +208778,25 @@ var require_change_set = __commonJS({
208296
208778
  adapter_id: nonEmptyStr(input.adapter_id) || nonEmptyStr(context.adapter_id) || "fs",
208297
208779
  tenant_id: nonEmptyStr(input.tenant_id) || nonEmptyStr(context.tenant_id) || "default",
208298
208780
  nonce: stateNonce,
208299
- expected_state_token: nonEmptyStr(input.expected_state_token) || ""
208781
+ expected_state_token: nonEmptyStr(input.expected_state_token) || "",
208782
+ // 1206 variant A — the caller's claimed policy identity, BOUND into the signed grant.
208783
+ //
208784
+ // It was the one v2 field a client could send and the server would drop: the issuer
208785
+ // has always read args.policy_hash (verdict-core/execution-grant-v2.js:132) and the
208786
+ // wire has always carried a policy_hash slot, but this handler never forwarded it, so
208787
+ // every grant was minted with the sha256('') default. A field that looks bound and is
208788
+ // not is worse than an absent one — a reader of the token cannot tell the difference.
208789
+ //
208790
+ // AUDIENCE NEEDS NO LINE HERE: `audience` is already passed at the top of this call
208791
+ // and the issuer derives audience_hash from it (:150), which the verifier already
208792
+ // enforces (:227-234). Only policy_hash was missing.
208793
+ //
208794
+ // This binds what the CALLER CLAIMS, which is the whole point: the grant becomes
208795
+ // tamper-evident about the policy it was issued under, and a verifier that knows which
208796
+ // policy it expects can refuse a mismatch (intended.policy_hash, added symmetrically
208797
+ // to the existing intended.audience_hash check). Absent → the issuer's sha256('')
208798
+ // default, exactly as before.
208799
+ policy_hash: nonEmptyStr(input.policy_hash) || void 0
208300
208800
  } : {
208301
208801
  target_id: grantTarget,
208302
208802
  ...stateNonce ? { state_nonce: stateNonce } : {}
@@ -225661,6 +226161,7 @@ var require_decision_result = __commonJS({
225661
226161
  } = require_policy_pin();
225662
226162
  var { sha256hex } = require_chain_attestation();
225663
226163
  var { canonicalJson } = require_canonical_json();
226164
+ var { projectNextAgentStep } = require_next_agent_step2();
225664
226165
  var {
225665
226166
  buildRemediationTransaction,
225666
226167
  blockRequiredActionCore
@@ -225877,8 +226378,27 @@ var require_decision_result = __commonJS({
225877
226378
  // RT-P-20 — fingerprint rebind expected bit (SERVER-authored; under body_hash).
225878
226379
  // true = gate must rebind; null/absent on legacy = not_expected (wire compat residual).
225879
226380
  // Caller cannot set/delete this — author only in change-set issuance path.
225880
- fingerprint_binding_expected: null
226381
+ fingerprint_binding_expected: null,
225881
226382
  // true | false | null (legacy)
226383
+ // I-1288 — the decision's own remediation SUGGESTION, INSIDE the signed envelope.
226384
+ //
226385
+ // WHY IT MOVED IN. The identical projection has always been on the response root, at
226386
+ // control_envelope.next_agent_step. But k8s-admission, gateway-verifier and the guard's
226387
+ // deployGate are handed the ENVELOPE and nothing else: they could verify the decision and
226388
+ // still not say what to do about it without a second network call to the issuer. A field
226389
+ // that only exists next to the envelope is not available to the parties the envelope was
226390
+ // built for. Placed here it is covered by decision_body_hash, so the receipt signs the
226391
+ // suggestion along with the decision that produced it — a tampered next step no longer
226392
+ // verifies.
226393
+ //
226394
+ // STILL NOT PERMISSION. Being signed makes it authentic, not authoritative: agents branch
226395
+ // on execution_action, exactly as before. Null on the allow class (CONTINUE /
226396
+ // CONTINUE_WITH_MONITORING) is the correct value, not an absent measurement.
226397
+ //
226398
+ // ADDITIVE, so spec_version stays decision-result.v1.1 (producer ENVELOPE COMPATIBILITY
226399
+ // rule 5: additive optional fields do not bump the major). control_envelope keeps emitting
226400
+ // its copy from the same pure function — one projection, two placements, never two rules.
226401
+ next_agent_step: null
225882
226402
  });
225883
226403
  var SOURCE_SLOTS = Object.freeze([
225884
226404
  "repository",
@@ -226044,6 +226564,10 @@ var require_decision_result = __commonJS({
226044
226564
  if (hasAdditive && decision === "BLOCK" && additive.required_action_core == null) {
226045
226565
  additive.required_action_core = blockRequiredActionCore(reasonCode(context, breakingCount));
226046
226566
  }
226567
+ if (hasAdditive) {
226568
+ const raForStep = additive.required_action_core != null && typeof additive.required_action_core === "object" ? additive.required_action_core : required_action;
226569
+ additive.next_agent_step = projectNextAgentStep(execution_action, raForStep);
226570
+ }
226047
226571
  if (hasAdditive) {
226048
226572
  if (remediation_transaction) {
226049
226573
  additive.remediation_transaction = remediation_transaction;
@@ -227959,10 +228483,10 @@ var require_gate_pin = __commonJS({
227959
228483
  "src/generated/gate-pin.json"(exports2, module2) {
227960
228484
  module2.exports = {
227961
228485
  repo: "coderifts/contract-gate",
227962
- sha: "90de4be6641bbbc76b647d55bdec1e9019fd1d20",
227963
- tag: "v0.7.0",
228486
+ sha: "1fae5d2bb2b52e1e1b745e649eab8834eac45645",
228487
+ tag: "v0.8.0",
227964
228488
  resolved_from: "https://github.com/coderifts/contract-gate refs/tags/v0",
227965
- resolved_at: "2026-09-01T13:10:37Z",
228489
+ resolved_at: "2026-09-02T07:25:19Z",
227966
228490
  note: "STRICT template pins this full commit SHA (GitHub: only a full SHA is immutable). v0 is a tag we move on every release, so it is NOT a pin. Re-run scripts/generate-gate-pin.js on each gate release; Dependabot bumps adopters."
227967
228491
  };
227968
228492
  }
@@ -229638,13 +230162,13 @@ var require_agent_host_files_embedded = __commonJS({
229638
230162
  ".cursor/hooks.json"
229639
230163
  ]);
229640
230164
  var AGENT_HOST_FILES = Object.freeze({
229641
- "AGENTS.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts agent rules\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
229642
- "CLAUDE.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
229643
- ".cursor/rules/coderifts.mdc": '---\ndescription: CodeRifts API governance \u2014 when to preflight and how to branch\nglobs:\nalwaysApply: true\n---\n\n<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
229644
- ".github/copilot-instructions.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts instructions for GitHub Copilot\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
229645
- "coderifts-langgraph-policy.js": '// GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js\n// System policy string for a LangGraph (or similar) agent. Content is generated;\n// identical rule sentences to AGENTS.md / other formats.\n\'use strict\';\n\nmodule.exports = "Call `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\\n\\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\\n\\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\\n\\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\\n\\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\\n\\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not \\"proceed with caution\\" without monitoring.\\n\\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\\n\\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\\n\\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\\n\\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\\n\\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\\n\\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\\n\\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\\n\\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\\n\\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\\n\\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\\n\\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\\n\\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\\n\\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\\n\\nWith a proven tenant\u2194repo binding you may request `derivation:\\"server\\"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\\n\\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say \\"authorized, commit not proven\\".";\n',
229646
- "openai-agent-instructions.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts agent instructions\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
229647
- "skills/api-governance/SKILL.md": '---\nname: api-governance\ndescription: Before merging or shipping any API or tool-contract change: preflight the change set, then branch on execution_action.\n---\n\n# CodeRifts API Governance\n\n<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
230165
+ "AGENTS.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts agent rules\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nVersions you may meet elsewhere: `cr.exec.v2` is the issued-token version for atomic execution, and `ENFORCING_STRICT_V1` is the versioned spelling of the strict profile. Neither is the default and neither is required by these rules \u2014 see `docs/grant-versions.md`.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
230166
+ "CLAUDE.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nVersions you may meet elsewhere: `cr.exec.v2` is the issued-token version for atomic execution, and `ENFORCING_STRICT_V1` is the versioned spelling of the strict profile. Neither is the default and neither is required by these rules \u2014 see `docs/grant-versions.md`.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
230167
+ ".cursor/rules/coderifts.mdc": '---\ndescription: CodeRifts API governance \u2014 when to preflight and how to branch\nglobs:\nalwaysApply: true\n---\n\n<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nVersions you may meet elsewhere: `cr.exec.v2` is the issued-token version for atomic execution, and `ENFORCING_STRICT_V1` is the versioned spelling of the strict profile. Neither is the default and neither is required by these rules \u2014 see `docs/grant-versions.md`.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
230168
+ ".github/copilot-instructions.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts instructions for GitHub Copilot\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nVersions you may meet elsewhere: `cr.exec.v2` is the issued-token version for atomic execution, and `ENFORCING_STRICT_V1` is the versioned spelling of the strict profile. Neither is the default and neither is required by these rules \u2014 see `docs/grant-versions.md`.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
230169
+ "coderifts-langgraph-policy.js": '// GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js\n// System policy string for a LangGraph (or similar) agent. Content is generated;\n// identical rule sentences to AGENTS.md / other formats.\n\'use strict\';\n\nmodule.exports = "Call `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\\n\\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\\n\\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\\n\\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\\n\\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\\n\\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not \\"proceed with caution\\" without monitoring.\\n\\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\\n\\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\\n\\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\\n\\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\\n\\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\\n\\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\\n\\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\\n\\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\\n\\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\\n\\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\\n\\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\\n\\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\\n\\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\\n\\nVersions you may meet elsewhere: `cr.exec.v2` is the issued-token version for atomic execution, and `ENFORCING_STRICT_V1` is the versioned spelling of the strict profile. Neither is the default and neither is required by these rules \u2014 see `docs/grant-versions.md`.\\n\\nWith a proven tenant\u2194repo binding you may request `derivation:\\"server\\"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\\n\\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say \\"authorized, commit not proven\\".";\n',
230170
+ "openai-agent-instructions.md": '<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\n# CodeRifts agent instructions\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nVersions you may meet elsewhere: `cr.exec.v2` is the issued-token version for atomic execution, and `ENFORCING_STRICT_V1` is the versioned spelling of the strict profile. Neither is the default and neither is required by these rules \u2014 see `docs/grant-versions.md`.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
230171
+ "skills/api-governance/SKILL.md": '---\nname: api-governance\ndescription: Before merging or shipping any API or tool-contract change: preflight the change set, then branch on execution_action.\n---\n\n# CodeRifts API Governance\n\n<!-- GENERATED from CodeRifts agent-host-rule (single source). Do not edit rule sentences by hand; run: node scripts/generate-agent-host-files.js -->\n\nCall `preflight_change_set` before merge, deploy, publish, or tool registration when a contract artifact changed (OpenAPI/Swagger, GraphQL, gRPC/protobuf, AsyncAPI, MCP manifest, or agent tool schemas).\n\nSend the complete base-to-head change set: every changed contract artifact with full before and after content. Do not send a single-file subset when other contract files also change.\n\nBranch on `execution_action` only. Do not branch on `decision` and do not branch on `safe_for_agent` (not_for_control_flow_use_execution_action). Canonical `execution_action` values: CONTINUE, CONTINUE_WITH_MONITORING, REQUEST_APPROVAL, STOP.\n\nAn unrecognised `execution_action` is not permission: fail closed (halt or re-preflight). Well-known code: `not_permission_fail_closed`.\n\nWhen `execution_action` is REQUEST_APPROVAL or STOP, surface the detected patterns and the blast radius, and propose the safer path \u2014 deprecate-then-remove, an additive change, or a new version \u2014 rather than shipping the break.\n\n`CONTINUE_WITH_MONITORING` requires a wired monitoring sink (`monitoringSinkWired`). It is not "proceed with caution" without monitoring.\n\nDo not call `preflight_change_set` for: a documentation-only change (README, guides, comments) with no contract artifact content change; a static readiness score (a different capability, not a change-set decision); or to verify a receipt you already hold (that is `verify_receipt` \u2014 see the companion-tools rule).\n\nIf you already hold a chain receipt and only need authenticity/lifecycle: `verify_receipt`. If you need a past decision by id: `get_decision_details`. Neither replaces preflight for a new change set.\n\nThe CodeRifts MCP server exposes exactly three tools \u2014 `preflight_change_set`, `verify_receipt`, `get_decision_details`. Do not invent or assume others.\n\nA receipt authorizes ONE operation: a merge receipt does not authorize a deploy. Before a different operation (deploy, publish), call `preflight_change_set` with `context.operation` set to that operation \u2014 reusing a differently-scoped receipt is not permitted and will fail at the gate.\n\nA stale or superseded receipt on a changed head requires a NEW preflight \u2014 `verify_receipt` cannot re-diff.\n\nFor mutating tools, put only the guarded version in the agent\'s tool table; keep the raw handler host-only and unreachable from that table. How you name tools is yours \u2014 this is a reachability property, not a product rename of host tools. CodeRifts cannot see or stop a raw call the host makes outside the table it returns; adopt this as a host convention, not as a guarantee from the package.\n\nCodeRifts reports a governance decision and `execution_action`; it does not by itself block merges. Blocking requires separate repository configuration (required status checks, enforcement) that this rule file does not set.\n\nTo act (mutate a contract, merge, deploy, or publish): call `preflight_change_set` with `preflight_mode` authorize. Analyze is informational \u2014 risk only, `may_execute` is always false \u2014 and is not permission. Read `execution_action` on the `decision_result` envelope.\n\nBefore acting under a held receipt: call `verify_receipt` with the intended `context` (operation, environment, repository, branch, pull_request) for THIS attempt. Do not act on a receipt whose scope does not match.\n\nAct only when `currently_authorized` is true (`control_envelope.receipt_view.currently_authorized`). A valid-looking token is not permission if `currently_authorized` is false or omitted.\n\nCommit / CAS evidence is a separate measurement (`commit_observation` on GuardOutcome). It is not a substitute for authorize + `currently_authorized`. Production hosts that want the fail-closed conjunction lock it with `profile: ENFORCING_STRICT` on withCodeRifts.\n\nIf the host requests an execution grant (opt-in `include_execution_grant`), the grant is bound to operation + target + after-payload (`scope_hash`) and is short-lived \u2014 never reuse it after the after-payload changes.\n\nAn ATOMIC-profile grant carries `state_nonce` and is single-use at the executor \u2014 if the executor has consumed the nonce, re-preflight; do not retry the same grant.\n\nVersions you may meet elsewhere: `cr.exec.v2` is the issued-token version for atomic execution, and `ENFORCING_STRICT_V1` is the versioned spelling of the strict profile. Neither is the default and neither is required by these rules \u2014 see `docs/grant-versions.md`.\n\nWith a proven tenant\u2194repo binding you may request `derivation:"server"` instead of assembling `artifacts[]` yourself (`context.repository` + `context.base` + `context.head` required; caller-supplied artifacts are rejected on that path).\n\nA commit is only proven when an executor attestation verifies (customer-held executor key, `cas_evidence: executor_attested`); otherwise say "authorized, commit not proven".\n',
229648
230172
  ".claude/settings.json": '{\n "hooks": {\n "PreToolUse": [\n {\n "matcher": "Write|Edit|MultiEdit",\n "hooks": [\n {\n "type": "command",\n "command": "coderifts claude-hook",\n "timeout": 60\n }\n ]\n }\n ]\n }\n}\n',
229649
230173
  ".cursor/hooks.json": '{\n "version": 1,\n "hooks": {\n "preToolUse": [\n {\n "command": "coderifts cursor-hook",\n "matcher": "Write|Delete",\n "timeout": 60,\n "failClosed": true\n }\n ]\n }\n}\n'
229650
230174
  });
@@ -258366,9 +258890,22 @@ var require_enforce_check = __commonJS({
258366
258890
  );
258367
258891
  }
258368
258892
  }
258893
+ const requireBinding = options.requireWorkflowBinding === true;
258894
+ const bindingGrantsPass = report.workflow_binding && report.workflow_binding.grants_pass === true;
258895
+ const bindingExit = requireBinding && !bindingGrantsPass ? 1 : 0;
258896
+ if (bindingExit !== 0) {
258897
+ const wb = report.workflow_binding || {};
258898
+ errLog(chalk.red(
258899
+ `--require-workflow-binding: the required workflow is not sha-pinned to this head (status ${wb.status || "UNKNOWN"}${wb.reason_code ? `, ${wb.reason_code}` : ""}).`
258900
+ ));
258901
+ if (wb.reason) errLog(chalk.dim(` ${wb.reason}`));
258902
+ errLog(chalk.dim(
258903
+ " This is the CLI audit verdict on the Action path, not a merge block \u2014 the App-path clamp is a separate control."
258904
+ ));
258905
+ }
258369
258906
  if (options.json) log(JSON.stringify(report, null, 2));
258370
258907
  else log(renderHuman(report));
258371
- return { exitCode: 0, report };
258908
+ return { exitCode: bindingExit, report };
258372
258909
  }
258373
258910
  module2.exports = {
258374
258911
  runEnforceCheck,
@@ -258461,7 +258998,7 @@ var require_enforce = __commonJS({
258461
258998
  return { exitCode: 1, error: "check_apply_conflict", outcomes: [] };
258462
258999
  }
258463
259000
  const { runEnforceCheck } = require_enforce_check();
258464
- return runEnforceCheck(options, deps);
259001
+ return runEnforceCheck({ ...options, requireWorkflowBinding: options.requireWorkflowBinding === true }, deps);
258465
259002
  }
258466
259003
  const apply = options.apply === true;
258467
259004
  const getKey = deps.getApiKey || getApiKey;