@ironbee-ai/cli 0.30.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/analytics/claude/emit.js +1 -1
  3. package/dist/analytics/claude/state.js +1 -1
  4. package/dist/analytics/codex/events-emit.js +2 -2
  5. package/dist/analytics/codex/subagent-transcripts.js +3 -3
  6. package/dist/clients/claude/agents/ironbee-scenario.md +4 -1
  7. package/dist/clients/claude/agents/ironbee-verifier.md +21 -3
  8. package/dist/clients/claude/hooks/activity-end.js +1 -1
  9. package/dist/clients/claude/hooks/activity-start.js +1 -1
  10. package/dist/clients/claude/hooks/clear-verdict.js +1 -1
  11. package/dist/clients/claude/hooks/require-verdict.js +2 -2
  12. package/dist/clients/claude/hooks/require-verification.js +4 -4
  13. package/dist/clients/claude/hooks/session-end.js +1 -1
  14. package/dist/clients/claude/hooks/session-start.js +4 -4
  15. package/dist/clients/claude/hooks/session-status.js +2 -2
  16. package/dist/clients/claude/hooks/subagent-start.js +1 -1
  17. package/dist/clients/claude/hooks/subagent-stop.js +1 -1
  18. package/dist/clients/claude/hooks/track-action-monitor.js +1 -1
  19. package/dist/clients/claude/hooks/track-action.js +1 -1
  20. package/dist/clients/claude/hooks/verify-gate.js +4 -4
  21. package/dist/clients/claude/index.js +4 -4
  22. package/dist/clients/claude/platforms/scenario.android.md +1 -0
  23. package/dist/clients/claude/platforms/scenario.terminal.md +26 -0
  24. package/dist/clients/claude/platforms/skill.android.md +4 -0
  25. package/dist/clients/claude/platforms/skill.browser.md +1 -1
  26. package/dist/clients/claude/platforms/skill.terminal.md +62 -0
  27. package/dist/clients/claude/process-analytics.js +1 -1
  28. package/dist/clients/claude/statusline-toggle.js +2 -2
  29. package/dist/clients/codex/agents/ironbee-scenario.md +3 -0
  30. package/dist/clients/codex/agents/ironbee-verifier.md +20 -2
  31. package/dist/clients/codex/commands/ironbee-manage-scenario/SKILL.main.md +3 -0
  32. package/dist/clients/codex/commands/ironbee-search-scenario/SKILL.main.md +3 -0
  33. package/dist/clients/codex/commands/ironbee-sync-scenario/SKILL.main.md +3 -0
  34. package/dist/clients/codex/commands/ironbee-verify/SKILL.main.md +3 -0
  35. package/dist/clients/codex/hooks/activity-end.js +1 -1
  36. package/dist/clients/codex/hooks/activity-start.js +1 -1
  37. package/dist/clients/codex/hooks/clear-verdict.js +3 -3
  38. package/dist/clients/codex/hooks/require-verdict.js +2 -2
  39. package/dist/clients/codex/hooks/require-verification.js +3 -3
  40. package/dist/clients/codex/hooks/session-start.js +3 -3
  41. package/dist/clients/codex/hooks/subagent-start.js +1 -1
  42. package/dist/clients/codex/hooks/subagent-stop.js +1 -1
  43. package/dist/clients/codex/hooks/track-action-monitor.js +1 -1
  44. package/dist/clients/codex/hooks/track-action-pre.js +1 -1
  45. package/dist/clients/codex/hooks/track-action.js +1 -1
  46. package/dist/clients/codex/hooks/verify-gate.js +1 -1
  47. package/dist/clients/codex/index.js +2 -2
  48. package/dist/clients/codex/platforms/command-verify.android.md +1 -0
  49. package/dist/clients/codex/platforms/command-verify.terminal.md +61 -0
  50. package/dist/clients/codex/platforms/rule.android.md +2 -1
  51. package/dist/clients/codex/platforms/rule.terminal.md +31 -0
  52. package/dist/clients/codex/platforms/scenario.android.md +1 -0
  53. package/dist/clients/codex/platforms/scenario.terminal.md +36 -0
  54. package/dist/clients/codex/platforms/skill.android.md +4 -0
  55. package/dist/clients/codex/platforms/skill.browser.md +1 -1
  56. package/dist/clients/codex/platforms/skill.terminal.md +57 -0
  57. package/dist/clients/codex/process-analytics.js +2 -2
  58. package/dist/clients/codex/rules/ironbee-verification.main.md +3 -0
  59. package/dist/clients/codex/skills/ironbee-verification.main.md +3 -0
  60. package/dist/clients/codex/thread-map.js +1 -1
  61. package/dist/clients/codex/util.js +44 -31
  62. package/dist/clients/cursor/commands/ironbee-manage-scenario/SKILL.md +3 -0
  63. package/dist/clients/cursor/commands/ironbee-search-scenario/SKILL.md +3 -0
  64. package/dist/clients/cursor/commands/ironbee-sync-scenario/SKILL.md +3 -0
  65. package/dist/clients/cursor/commands/ironbee-verify/SKILL.md +3 -0
  66. package/dist/clients/cursor/hooks/activity-end.js +1 -1
  67. package/dist/clients/cursor/hooks/activity-start.js +1 -1
  68. package/dist/clients/cursor/hooks/clear-verdict.js +1 -1
  69. package/dist/clients/cursor/hooks/require-verdict.js +2 -2
  70. package/dist/clients/cursor/hooks/require-verification.js +3 -3
  71. package/dist/clients/cursor/hooks/session-end.js +1 -1
  72. package/dist/clients/cursor/hooks/session-start.js +4 -4
  73. package/dist/clients/cursor/hooks/track-action-monitor.js +1 -1
  74. package/dist/clients/cursor/hooks/track-action.js +1 -1
  75. package/dist/clients/cursor/hooks/verify-gate.js +1 -1
  76. package/dist/clients/cursor/index.js +1 -1
  77. package/dist/clients/cursor/platforms/command-verify.android.md +1 -0
  78. package/dist/clients/cursor/platforms/command-verify.terminal.md +61 -0
  79. package/dist/clients/cursor/platforms/rule.android.md +2 -1
  80. package/dist/clients/cursor/platforms/rule.terminal.md +31 -0
  81. package/dist/clients/cursor/platforms/scenario.android.md +1 -0
  82. package/dist/clients/cursor/platforms/scenario.terminal.md +29 -0
  83. package/dist/clients/cursor/platforms/skill.android.md +4 -0
  84. package/dist/clients/cursor/platforms/skill.browser.md +1 -1
  85. package/dist/clients/cursor/platforms/skill.terminal.md +54 -0
  86. package/dist/clients/cursor/rules/ironbee-verification.mdc +3 -0
  87. package/dist/clients/cursor/skills/ironbee-verification.md +9 -0
  88. package/dist/commands/config.js +2 -2
  89. package/dist/commands/hook.js +10 -10
  90. package/dist/commands/import.js +3 -3
  91. package/dist/commands/install.js +1 -1
  92. package/dist/commands/process-job-file.js +1 -1
  93. package/dist/commands/queue.js +16 -16
  94. package/dist/commands/scenario.js +1 -1
  95. package/dist/commands/status.js +1 -1
  96. package/dist/commands/terminal.js +1 -0
  97. package/dist/commands/uninstall.js +1 -1
  98. package/dist/commands/verify.js +2 -2
  99. package/dist/hooks/core/actions.js +7 -7
  100. package/dist/hooks/core/session-state.js +1 -1
  101. package/dist/hooks/core/verification-context.js +19 -15
  102. package/dist/hooks/core/verify-gate.js +25 -20
  103. package/dist/import/claude/events/tool-call.js +1 -1
  104. package/dist/import/codex/events/tool-call.js +1 -1
  105. package/dist/import/marker.js +2 -2
  106. package/dist/import/skip.js +1 -1
  107. package/dist/index.js +1 -1
  108. package/dist/lib/config.js +1 -1
  109. package/dist/lib/install-version.js +1 -1
  110. package/dist/lib/platform-section.js +5 -4
  111. package/dist/lib/runtime-paths.js +1 -0
  112. package/dist/lib/scenario-staleness.js +1 -1
  113. package/dist/otel/claude/daemon/process.js +1 -1
  114. package/dist/otel/claude/daemon/reprocess.js +1 -1
  115. package/dist/otel/claude/daemon/response-usage.js +2 -2
  116. package/dist/queue/drain.js +1 -1
  117. package/dist/queue/flush.js +1 -1
  118. package/dist/queue/paths.js +1 -1
  119. package/dist/queue/process-file.js +2 -2
  120. package/dist/queue/spawn.js +1 -1
  121. package/dist/tui/config/schema.js +1 -1
  122. package/dist/tui/platforms/area.js +2 -2
  123. package/dist/tui/queue/read.js +4 -4
  124. package/dist/tui/sessions/read.js +2 -2
  125. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";var S=Object.create;var g=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var h=(e,t)=>g(e,"name",{value:t,configurable:!0});var R=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},p=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $(t))!j.call(e,i)&&i!==r&&g(e,i,{get:()=>t[i],enumerable:!(s=C(t,i))||s.enumerable});return e};var N=(e,t,r)=>(r=e!=null?S(y(e)):{},p(t||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),O=e=>p(g({},"__esModule",{value:!0}),e);var x={};R(x,{scenarioCommand:()=>m});module.exports=O(x);var b=require("commander"),u=require("path"),n=N(require("picocolors")),d=require("../lib/scenario-staleness"),w=require("../lib/git"),c=require("../lib/config");function F(e){return e==="fresh"?n.default.green("fresh "):e==="stale"?n.default.yellow("stale "):n.default.dim("unknown")}h(F,"stateLabel");function k(e){const t=(0,u.resolve)(e.project??process.cwd()),r=(0,d.checkScenarioFreshness)(t);if(e.json===!0){const o=e.stale===!0?r.filter(l=>l.state==="stale"):r;console.log(JSON.stringify(o,null,2)),e.stale===!0&&o.length>0&&(process.exitCode=1);return}if(r.length===0){console.log(n.default.dim("No saved scenarios found (.ironbee/scenarios/)."));return}const s=r.filter(o=>o.state==="stale");if(e.stale===!0){if(s.length===0){console.log(n.default.green("\u2713 No stale scenarios."));return}for(const o of s)v(o);console.log(""),console.log(n.default.yellow(`${s.length} stale scenario(s) \u2014 re-validate with /ironbee-sync-scenario or /ironbee-verify scenario:<name>.`)),process.exitCode=1;return}for(const o of r)v(o);const i=r.filter(o=>o.state==="fresh").length,f=r.filter(o=>o.state==="unknown").length;console.log(""),console.log(`${r.length} scenario(s): ${n.default.green(`${i} fresh`)}, ${n.default.yellow(`${s.length} stale`)}, ${n.default.dim(`${f} unknown`)}.`),s.length>0&&console.log(n.default.dim("Re-validate stale ones with /ironbee-sync-scenario or /ironbee-verify scenario:<name>."))}h(k,"runStatus");function v(e){if(console.log(`${F(e.state)} ${n.default.bold(e.name)} ${n.default.dim(`[${e.platform}]`)} \u2014 ${e.reason}`),e.changedCoveredPaths.length>0){const t=e.changedCoveredPaths.slice(0,5);for(const r of t)console.log(` ${n.default.dim("\xB7")} ${r}`);e.changedCoveredPaths.length>t.length&&console.log(` ${n.default.dim(`\xB7 +${e.changedCoveredPaths.length-t.length} more`)}`)}}h(v,"printRow");function D(e){const t=(0,u.resolve)(e.project??process.cwd()),r=(0,c.loadConfig)(t);let s=(0,c.getVerificationContextCommitDepth)(r);if(e.commitDepth!==void 0){const a=Number.parseInt(e.commitDepth,10);Number.isFinite(a)&&a>=0&&(s=a)}const i=(0,w.getChangedPathsRelative)(t,s);if(i===null){if(e.json===!0){console.log(JSON.stringify({available:!1,reason:"not a git repository",scenarioCount:0,covered:[],gaps:[],changed:[]},null,2));return}console.log(n.default.dim("Not a git repository \u2014 cannot compute the changed set."));return}const f=i.filter(a=>(0,c.requiresVerification)(a,r)),o=(0,d.coverageGaps)(t,f);if(e.json===!0){console.log(JSON.stringify(o,null,2));return}if(o.changed.length===0){console.log(n.default.dim("No verification-relevant changed files in the current window (working tree + recent commits)."));return}if(o.scenarioCount===0){console.log(n.default.yellow(`No saved scenarios \u2014 all ${o.changed.length} verification-relevant changed file(s) are uncovered.`)),console.log(n.default.dim("Author one with /ironbee-manage-scenario."));return}if(o.gaps.length===0){console.log(n.default.green(`\u2713 All ${o.changed.length} verification-relevant changed file(s) are covered by a saved scenario.`));return}console.log(n.default.yellow(`${o.gaps.length} of ${o.changed.length} verification-relevant changed file(s) covered by NO scenario:`));const l=o.gaps.slice(0,30);for(const a of l)console.log(` ${n.default.dim("\xB7")} ${a}`);o.gaps.length>l.length&&console.log(` ${n.default.dim(`\xB7 +${o.gaps.length-l.length} more`)}`),console.log(""),console.log(n.default.dim("Author a scenario for an uncovered area with /ironbee-manage-scenario. (Advisory \u2014 coveredPaths is author-declared, so a gap can be a false positive.)"))}h(D,"runCoverage");const m=new b.Command("scenario").description("Inspect saved verification scenarios (.ironbee/scenarios/)");m.command("status").description("Show freshness (fresh / stale / unknown) of saved scenarios vs the current code").option("-p, --project <dir>","project directory (default: cwd)").option("--stale","show only stale scenarios; exit non-zero when any exist (CI gate)").option("--json","machine-readable JSON output").action(e=>{k(e)}),m.command("coverage").description("Show changed files (working tree + recent commits) covered by NO saved scenario (the inverse of status)").option("-p, --project <dir>","project directory (default: cwd)").option("--commit-depth <n>","commits back to include beyond the working tree (default: verificationContext.commitDepth)").option("--json","machine-readable JSON output").action(e=>{D(e)});0&&(module.exports={scenarioCommand});
1
+ "use strict";var S=Object.create;var g=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var h=(e,t)=>g(e,"name",{value:t,configurable:!0});var R=(e,t)=>{for(var r in t)g(e,r,{get:t[r],enumerable:!0})},p=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of C(t))!j.call(e,i)&&i!==r&&g(e,i,{get:()=>t[i],enumerable:!(s=$(t,i))||s.enumerable});return e};var N=(e,t,r)=>(r=e!=null?S(y(e)):{},p(t||!e||!e.__esModule?g(r,"default",{value:e,enumerable:!0}):r,e)),O=e=>p(g({},"__esModule",{value:!0}),e);var x={};R(x,{scenarioCommand:()=>m});module.exports=O(x);var b=require("commander"),u=require("path"),n=N(require("picocolors")),d=require("../lib/scenario-staleness"),w=require("../lib/git"),c=require("../lib/config");function F(e){return e==="fresh"?n.default.green("fresh "):e==="stale"?n.default.yellow("stale "):n.default.dim("unknown")}h(F,"stateLabel");function k(e){const t=(0,u.resolve)(e.project??process.cwd()),r=(0,d.checkScenarioFreshness)(t);if(e.json===!0){const o=e.stale===!0?r.filter(l=>l.state==="stale"):r;console.log(JSON.stringify(o,null,2)),e.stale===!0&&o.length>0&&(process.exitCode=1);return}if(r.length===0){console.log(n.default.dim("No saved scenarios found (.ironbee/scenarios/)."));return}const s=r.filter(o=>o.state==="stale");if(e.stale===!0){if(s.length===0){console.log(n.default.green("\u2713 No stale scenarios."));return}for(const o of s)v(o);console.log(""),console.log(n.default.yellow(`${s.length} stale scenario(s) \u2014 re-validate with /ironbee-sync-scenario or /ironbee-verify scenario:<name>.`)),process.exitCode=1;return}for(const o of r)v(o);const i=r.filter(o=>o.state==="fresh").length,f=r.filter(o=>o.state==="unknown").length;console.log(""),console.log(`${r.length} scenario(s): ${n.default.green(`${i} fresh`)}, ${n.default.yellow(`${s.length} stale`)}, ${n.default.dim(`${f} unknown`)}.`),s.length>0&&console.log(n.default.dim("Re-validate stale ones with /ironbee-sync-scenario or /ironbee-verify scenario:<name>."))}h(k,"runStatus");function v(e){if(console.log(`${F(e.state)} ${n.default.bold(e.name)} ${n.default.dim(`[${e.platform}]`)} \u2014 ${e.reason}`),e.changedCoveredPaths.length>0){const t=e.changedCoveredPaths.slice(0,5);for(const r of t)console.log(` ${n.default.dim("\xB7")} ${r}`);e.changedCoveredPaths.length>t.length&&console.log(` ${n.default.dim(`\xB7 +${e.changedCoveredPaths.length-t.length} more`)}`)}}h(v,"printRow");function D(e){const t=(0,u.resolve)(e.project??process.cwd()),r=(0,c.loadConfig)(t);let s=(0,c.getVerificationContextCommitDepth)(r);if(e.commitDepth!==void 0){const a=Number.parseInt(e.commitDepth,10);Number.isFinite(a)&&a>=0&&(s=a)}const i=(0,w.getChangedPathsRelative)(t,s);if(i===null){if(e.json===!0){console.log(JSON.stringify({available:!1,reason:"not a git repository",scenarioCount:0,covered:[],gaps:[],changed:[]},null,2));return}console.log(n.default.dim("Not a git repository \u2014 cannot compute the changed set."));return}const f=i.filter(a=>(0,c.requiresVerification)(a,r)),o=(0,d.coverageGaps)(t,f);if(e.json===!0){console.log(JSON.stringify(o,null,2));return}if(o.changed.length===0){console.log(n.default.dim("No verification-relevant changed files in the current window (working tree + recent commits)."));return}if(o.scenarioCount===0){console.log(n.default.yellow(`No saved scenarios \u2014 all ${o.changed.length} verification-relevant changed file(s) are uncovered.`)),console.log(n.default.dim("Author one with /ironbee-manage-scenario."));return}if(o.gaps.length===0){console.log(n.default.green(`\u2713 All ${o.changed.length} verification-relevant changed file(s) are covered by a saved scenario.`));return}console.log(n.default.yellow(`${o.gaps.length} of ${o.changed.length} verification-relevant changed file(s) covered by NO scenario:`));const l=o.gaps.slice(0,30);for(const a of l)console.log(` ${n.default.dim("\xB7")} ${a}`);o.gaps.length>l.length&&console.log(` ${n.default.dim(`\xB7 +${o.gaps.length-l.length} more`)}`),console.log(""),console.log(n.default.dim("Author a scenario for an uncovered area with /ironbee-manage-scenario. (Advisory \u2014 coveredPaths is author-declared, so a gap can be a false positive.)"))}h(D,"runCoverage");const m=new b.Command("scenario").description("Inspect saved verification scenarios (.ironbee/scenarios/)");m.command("status").description("Show freshness (fresh / stale / unknown) of saved scenarios vs the current code").option("-p, --project <dir>","project directory (default: cwd)").option("--stale","show only stale scenarios; exit non-zero when any exist (CI gate)").option("--json","machine-readable JSON output").action(e=>{k(e)}),m.command("coverage").description("Show changed files (working tree + recent commits) covered by NO saved scenario (the inverse of status)").option("-p, --project <dir>","project directory (default: cwd)").option("--commit-depth <n>","commits back to include beyond the working tree (default: verification.context.commitDepth)").option("--json","machine-readable JSON output").action(e=>{D(e)});0&&(module.exports={scenarioCommand});
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var m=(o,n)=>d(o,"name",{value:n,configurable:!0});var k=(o,n)=>{for(var e in n)d(o,e,{get:n[e],enumerable:!0})},S=(o,n,e,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of v(n))!h.call(o,t)&&t!==e&&d(o,t,{get:()=>n[t],enumerable:!(l=b(n,t))||l.enumerable});return o};var w=o=>S(d({},"__esModule",{value:!0}),o);var C={};k(C,{statusCommand:()=>_});module.exports=w(C);var y=require("commander"),i=require("fs"),c=require("path"),s=require("../lib/output");function j(o){const n=(0,c.join)(o,"actions.jsonl");if(!(0,i.existsSync)(n))return!1;let e;try{e=(0,i.readFileSync)(n,"utf-8")}catch{return!1}return e.includes('"type":"verification_requested"')||e.includes('"type": "verification_requested"')?!1:e.includes('"type":"session_start"')||e.includes('"type": "session_start"')}m(j,"isMonitoringOnlySession");const _=new y.Command("status").description("Show verification status for all active sessions").argument("[project-dir]","target project directory",".").action(o=>{const n=(0,c.resolve)(o),e=(0,c.join)(n,".ironbee","sessions");if(!(0,i.existsSync)(e)){s.log.warn("No .ironbee/sessions/ directory found. Run `ironbee install` first.");return}const l=(0,i.readdirSync)(e).filter(t=>(0,i.statSync)((0,c.join)(e,t)).isDirectory());if(l.length===0){s.log.dim(" .ironbee/sessions/ (no active sessions)");return}s.log.info(`Sessions in ${s.pc.dim(e)}`),s.log.blank();for(const t of l){const g=(0,c.join)(e,t,"verdict.json"),u=(0,c.join)(e,t,"retries"),a=(0,i.existsSync)(u)&&parseInt((0,i.readFileSync)(u,"utf-8"),10)||0;if(!(0,i.existsSync)(g)){console.log(` ${s.pc.bold(s.pc.cyan(t))}`),j((0,c.join)(e,t))?console.log(` ${s.pc.dim("verdict")} : ${s.pc.dim("none (monitoring-only session)")}`):console.log(` ${s.pc.dim("verdict")} : ${s.pc.yellow("missing")}`),a>0&&console.log(` ${s.pc.dim("retries")} : ${s.pc.yellow(`${a}/3`)}`),s.log.blank();continue}let r;try{r=JSON.parse((0,i.readFileSync)(g,"utf-8"))}catch{console.log(` ${s.pc.bold(s.pc.cyan(t))}`),console.log(` ${s.pc.dim("verdict")} : ${s.pc.red("invalid JSON")}`),s.log.blank();continue}const f=Array.isArray(r.checks)?r.checks.length:0,$=r.status==="pass"?s.pc.green:r.status==="not_applicable"?s.pc.dim:s.pc.red;if(console.log(` ${s.pc.bold(s.pc.cyan(t))}`),console.log(` ${s.pc.dim("status")} : ${$(r.status)}`),console.log(` ${s.pc.dim("checks")} : ${f>0?s.pc.green(String(f)):s.pc.yellow("0")}`),a>0&&console.log(` ${s.pc.dim("retries")} : ${s.pc.yellow(`${a}/3`)}`),r.status==="fail"&&r.issues?.length){console.log(` ${s.pc.dim("issues")} :`);for(const p of r.issues)console.log(` ${s.pc.red("\u2022")} ${p}`)}s.log.blank()}});0&&(module.exports={statusCommand});
1
+ "use strict";var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var m=(n,t)=>d(n,"name",{value:t,configurable:!0});var S=(n,t)=>{for(var e in t)d(n,e,{get:t[e],enumerable:!0})},w=(n,t,e,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of h(t))!k.call(n,o)&&o!==e&&d(n,o,{get:()=>t[o],enumerable:!(l=v(t,o))||l.enumerable});return n};var j=n=>w(d({},"__esModule",{value:!0}),n);var D={};S(D,{statusCommand:()=>C});module.exports=j(D);var y=require("commander"),i=require("fs"),c=require("path"),s=require("../lib/output"),$=require("../lib/runtime-paths");function _(n){const t=(0,c.join)(n,"actions.jsonl");if(!(0,i.existsSync)(t))return!1;let e;try{e=(0,i.readFileSync)(t,"utf-8")}catch{return!1}return e.includes('"type":"verification_requested"')||e.includes('"type": "verification_requested"')?!1:e.includes('"type":"session_start"')||e.includes('"type": "session_start"')}m(_,"isMonitoringOnlySession");const C=new y.Command("status").description("Show verification status for all active sessions").argument("[project-dir]","target project directory",".").action(n=>{const t=(0,c.resolve)(n),e=(0,$.sessionsRoot)(t);if(!(0,i.existsSync)(e)){s.log.warn("No .ironbee/sessions/ directory found. Run `ironbee install` first.");return}const l=(0,i.readdirSync)(e).filter(o=>(0,i.statSync)((0,c.join)(e,o)).isDirectory());if(l.length===0){s.log.dim(" .ironbee/sessions/ (no active sessions)");return}s.log.info(`Sessions in ${s.pc.dim(e)}`),s.log.blank();for(const o of l){const g=(0,c.join)(e,o,"verdict.json"),u=(0,c.join)(e,o,"retries"),a=(0,i.existsSync)(u)&&parseInt((0,i.readFileSync)(u,"utf-8"),10)||0;if(!(0,i.existsSync)(g)){console.log(` ${s.pc.bold(s.pc.cyan(o))}`),_((0,c.join)(e,o))?console.log(` ${s.pc.dim("verdict")} : ${s.pc.dim("none (monitoring-only session)")}`):console.log(` ${s.pc.dim("verdict")} : ${s.pc.yellow("missing")}`),a>0&&console.log(` ${s.pc.dim("retries")} : ${s.pc.yellow(`${a}/3`)}`),s.log.blank();continue}let r;try{r=JSON.parse((0,i.readFileSync)(g,"utf-8"))}catch{console.log(` ${s.pc.bold(s.pc.cyan(o))}`),console.log(` ${s.pc.dim("verdict")} : ${s.pc.red("invalid JSON")}`),s.log.blank();continue}const f=Array.isArray(r.checks)?r.checks.length:0,p=r.status==="pass"?s.pc.green:r.status==="not_applicable"?s.pc.dim:s.pc.red;if(console.log(` ${s.pc.bold(s.pc.cyan(o))}`),console.log(` ${s.pc.dim("status")} : ${p(r.status)}`),console.log(` ${s.pc.dim("checks")} : ${f>0?s.pc.green(String(f)):s.pc.yellow("0")}`),a>0&&console.log(` ${s.pc.dim("retries")} : ${s.pc.yellow(`${a}/3`)}`),r.status==="fail"&&r.issues?.length){console.log(` ${s.pc.dim("issues")} :`);for(const b of r.issues)console.log(` ${s.pc.red("\u2022")} ${b}`)}s.log.blank()}});0&&(module.exports={statusCommand});
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var m=(o,e)=>n(o,"name",{value:e,configurable:!0});var C=(o,e)=>{for(var t in e)n(o,t,{get:e[t],enumerable:!0})},u=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of b(e))!h.call(o,i)&&i!==t&&n(o,i,{get:()=>e[i],enumerable:!(s=y(e,i))||s.enumerable});return o};var v=o=>u(n({},"__esModule",{value:!0}),o);var j={};C(j,{terminalCommand:()=>w,terminalDisableCommand:()=>f,terminalEnableCommand:()=>p});module.exports=v(j);var r=require("commander"),g=require("../clients/registry"),l=require("../lib/config"),c=require("../lib/output"),a=require("./cycle-toggle");function d(o){return o.option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Write to the global config (~/.ironbee/config.json) instead of the project.").option("--local","Write to the gitignored project-local override (<project>/.ironbee/config.local.json). Mutually exclusive with --global.").option("--client <name>",`Only update guidance md files for this client (${(0,g.clientNames)()}), or "all". Default: every registered client (per-file existsSync gate skips uninstalled ones).`)}m(d,"attachToggleOptions");const p=d(new r.Command("enable")).description('Enable the terminal interaction verification cycle. Writes a minimal `{ "terminal": {} }` block \u2014 code defaults (cli/** / cmd/** / bin/** / shell scripts) flow in at runtime; `config.json` stays minimal. Refuses (warn + no-op) when the cycle is already enabled at this layer.').action(o=>{try{const e=o.projectDir??process.cwd(),t=(0,l.resolveConfigTargetFromFlags)(o);(0,a.applyEnableCycle)("terminal",e,t,o.client)}catch(e){console.error(`${c.pc.red("\u2717")} ${e instanceof Error?e.message:e}`),process.exit(1)}}),f=d(new r.Command("disable")).description("Disable the terminal interaction verification cycle. With no customizations + no lower-layer override, drops the entire `terminal` block. Otherwise writes `verifyPatterns: []` (load-bearing hard kill; preserves `alwaysRequired` / `evidencePaths` / `additionalVerifyPatterns`).").action(o=>{try{const e=o.projectDir??process.cwd(),t=(0,l.resolveConfigTargetFromFlags)(o);(0,a.applyDisableCycle)("terminal",e,t,o.client)}catch(e){console.error(`${c.pc.red("\u2717")} ${e instanceof Error?e.message:e}`),process.exit(1)}}),w=new r.Command("terminal").description("Manage the terminal interaction verification cycle (CLI / REPL / TUI driving via the `terminal-devtools` MCP, `tdt_*` tools).").addCommand(p).addCommand(f);0&&(module.exports={terminalCommand,terminalDisableCommand,terminalEnableCommand});
@@ -1 +1 @@
1
- "use strict";var h=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var d=(t,n)=>h(t,"name",{value:n,configurable:!0});var k=(t,n)=>{for(var r in n)h(t,r,{get:n[r],enumerable:!0})},x=(t,n,r,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of A(n))!N.call(t,i)&&i!==r&&h(t,i,{get:()=>n[i],enumerable:!(o=S(n,i))||o.enumerable});return t};var U=t=>x(h({},"__esModule",{value:!0}),t);var T={};k(T,{runUninstallAll:()=>P,uninstallCommand:()=>R});module.exports=U(T);var I=require("commander"),f=require("fs"),p=require("path"),l=require("../clients/registry"),e=require("../lib/output"),y=require("../lib/prompt"),u=require("../lib/projects-registry"),$=require("../lib/telemetry");function C(){return l.REGISTERED_CLIENTS.map(n=>n.name).join(", ")}d(C,"clientNames");const b=10;function v(t,n){for(const i of n)i.uninstall(t);const r=n.map(i=>i.name);(0,u.removeProject)(t);const o=(0,p.join)(t,".ironbee");return(0,f.existsSync)(o)&&(0,f.rmSync)(o,{recursive:!0,force:!0}),r}d(v,"uninstallOne");function w(t){if(t===void 0||t==="all")return l.REGISTERED_CLIENTS;const n=(0,l.findClient)(t);if(n===void 0)throw new Error(`Unknown client: '${t}'. Available: ${C()}.`);return[n]}d(w,"resolveClientsForUninstall");async function P(t){const n=(0,u.listProjects)();if(n.length===0)return e.log.info("No registered projects. Nothing to uninstall."),{failures:0,total:0};const r=[],o=[];for(const s of n)((0,l.isProjectActive)(s)?r:o).push(s);if(r.length===0){if(e.log.info("No active registered projects to uninstall from."),o.length>0){for(const s of o)(0,u.removeProject)(s.path);e.log.step(`Pruned ${e.pc.bold(String(o.length))} stale registry entr${o.length===1?"y":"ies"}.`)}return{failures:0,total:0}}e.log.warn(`About to uninstall ironbee from ${e.pc.bold(String(r.length))} project(s):`);const i=r.slice(0,b);for(const s of i)console.log(` ${e.pc.dim("\xB7")} ${e.pc.dim(s.path)}`);r.length>b&&console.log(` ${e.pc.dim("\u2026and")} ${e.pc.bold(String(r.length-b))} ${e.pc.dim("more")}`),o.length>0&&e.log.dim(`(${o.length} stale registry entr${o.length===1?"y":"ies"} will also be pruned)`);let m;if(t.yes===!0?m=!0:(0,y.isInteractive)()?m=await(0,y.promptYesNo)("Continue?",!1):(e.log.error("Refusing to batch-uninstall without --yes in a non-interactive context."),process.exit(1)),!m)return e.log.info("Aborted."),{failures:0,total:0};e.log.blank();let c=0;const a=[];for(const s of r)try{e.log.label("project",e.pc.dim(s.path));const g=w(t.client),E=v(s.path,g);a.push(...E)}catch(g){c++,e.log.error(` ${s.path}: ${g instanceof Error?g.message:String(g)}`)}for(const s of o)(0,u.removeProject)(s.path);e.log.blank(),c===0?e.log.success(`Uninstalled from ${r.length} project(s).${o.length>0?` Pruned ${o.length} stale entr${o.length===1?"y":"ies"}.`:""} ${e.pc.dim("Restart your AI coding client(s) to apply.")}`):e.log.warn(`Completed with ${c} failure(s) \u2014 see above.`);const j=Array.from(new Set(a));return j.length>0&&await(0,$.trackUninstall)(j),{failures:c,total:r.length}}d(P,"runUninstallAll");const R=new I.Command("uninstall").description("Remove IronBee hooks and guidance files from a project. Use --all to uninstall across every registered project (destructive \u2014 confirms before acting).").argument("[project-dir]","target project directory",".").option("--client <name>",`client to uninstall for (${C()}), or "all"`).option("--all","Uninstall across every project in the user-home inventory (~/.ironbee/projects.json). The [project-dir] argument is ignored when --all is set. Prompts before acting unless --yes is also passed.").option("-y, --yes","Skip the confirmation prompt for --all (required in non-interactive contexts).").action(async(t,n)=>{if(n.all===!0){(await P({client:n.client,yes:n.yes})).failures>0&&process.exit(1);return}const r=(0,p.resolve)(t);(0,f.existsSync)(r)||(e.log.error(`Directory not found: ${r}`),process.exit(1));let o;if(n.client!==void 0)try{o=w(n.client)}catch(a){e.log.error(a instanceof Error?a.message:String(a)),process.exit(1)}else if(o=(0,l.detectClients)(r),o.length===0){e.log.info("No client detected. Nothing to uninstall.");return}const i=(0,p.join)(r,".ironbee"),m=(0,f.existsSync)(i),c=v(r,o);m&&e.log.step(`Removed ${e.pc.dim(i)}`),e.log.blank(),e.log.success(`IronBee removed. ${e.pc.dim("Restart your AI coding client to apply changes.")}`),await(0,$.trackUninstall)(c,r)});0&&(module.exports={runUninstallAll,uninstallCommand});
1
+ "use strict";var h=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var u=(n,t)=>h(n,"name",{value:t,configurable:!0});var k=(n,t)=>{for(var r in t)h(n,r,{get:t[r],enumerable:!0})},U=(n,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of A(t))!N.call(n,i)&&i!==r&&h(n,i,{get:()=>t[i],enumerable:!(o=S(t,i))||o.enumerable});return n};var T=n=>U(h({},"__esModule",{value:!0}),n);var _={};k(_,{runUninstallAll:()=>x,uninstallCommand:()=>D});module.exports=T(_);var E=require("commander"),a=require("fs"),p=require("path"),l=require("../clients/registry"),e=require("../lib/output"),y=require("../lib/prompt"),m=require("../lib/projects-registry"),P=require("../lib/runtime-paths"),v=require("../lib/telemetry");function C(){return l.REGISTERED_CLIENTS.map(t=>t.name).join(", ")}u(C,"clientNames");const b=10;function $(n){const t=(0,P.externalRuntimeRoot)(n);(0,a.existsSync)(t)&&(0,a.rmSync)(t,{recursive:!0,force:!0})}u($,"pruneExternalRuntimeRoot");function w(n,t){for(const i of t)i.uninstall(n);const r=t.map(i=>i.name);(0,m.removeProject)(n);const o=(0,p.join)(n,".ironbee");return(0,a.existsSync)(o)&&(0,a.rmSync)(o,{recursive:!0,force:!0}),$(n),r}u(w,"uninstallOne");function I(n){if(n===void 0||n==="all")return l.REGISTERED_CLIENTS;const t=(0,l.findClient)(n);if(t===void 0)throw new Error(`Unknown client: '${n}'. Available: ${C()}.`);return[t]}u(I,"resolveClientsForUninstall");async function x(n){const t=(0,m.listProjects)();if(t.length===0)return e.log.info("No registered projects. Nothing to uninstall."),{failures:0,total:0};const r=[],o=[];for(const s of t)((0,l.isProjectActive)(s)?r:o).push(s);if(r.length===0){if(e.log.info("No active registered projects to uninstall from."),o.length>0){for(const s of o)$(s.path),(0,m.removeProject)(s.path);e.log.step(`Pruned ${e.pc.bold(String(o.length))} stale registry entr${o.length===1?"y":"ies"}.`)}return{failures:0,total:0}}e.log.warn(`About to uninstall ironbee from ${e.pc.bold(String(r.length))} project(s):`);const i=r.slice(0,b);for(const s of i)console.log(` ${e.pc.dim("\xB7")} ${e.pc.dim(s.path)}`);r.length>b&&console.log(` ${e.pc.dim("\u2026and")} ${e.pc.bold(String(r.length-b))} ${e.pc.dim("more")}`),o.length>0&&e.log.dim(`(${o.length} stale registry entr${o.length===1?"y":"ies"} will also be pruned)`);let g;if(n.yes===!0?g=!0:(0,y.isInteractive)()?g=await(0,y.promptYesNo)("Continue?",!1):(e.log.error("Refusing to batch-uninstall without --yes in a non-interactive context."),process.exit(1)),!g)return e.log.info("Aborted."),{failures:0,total:0};e.log.blank();let f=0;const c=[];for(const s of r)try{e.log.label("project",e.pc.dim(s.path));const d=I(n.client),R=w(s.path,d);c.push(...R)}catch(d){f++,e.log.error(` ${s.path}: ${d instanceof Error?d.message:String(d)}`)}for(const s of o)$(s.path),(0,m.removeProject)(s.path);e.log.blank(),f===0?e.log.success(`Uninstalled from ${r.length} project(s).${o.length>0?` Pruned ${o.length} stale entr${o.length===1?"y":"ies"}.`:""} ${e.pc.dim("Restart your AI coding client(s) to apply.")}`):e.log.warn(`Completed with ${f} failure(s) \u2014 see above.`);const j=Array.from(new Set(c));return j.length>0&&await(0,v.trackUninstall)(j),{failures:f,total:r.length}}u(x,"runUninstallAll");const D=new E.Command("uninstall").description("Remove IronBee hooks and guidance files from a project. Use --all to uninstall across every registered project (destructive \u2014 confirms before acting).").argument("[project-dir]","target project directory",".").option("--client <name>",`client to uninstall for (${C()}), or "all"`).option("--all","Uninstall across every project in the user-home inventory (~/.ironbee/projects.json). The [project-dir] argument is ignored when --all is set. Prompts before acting unless --yes is also passed.").option("-y, --yes","Skip the confirmation prompt for --all (required in non-interactive contexts).").action(async(n,t)=>{if(t.all===!0){(await x({client:t.client,yes:t.yes})).failures>0&&process.exit(1);return}const r=(0,p.resolve)(n);(0,a.existsSync)(r)||(e.log.error(`Directory not found: ${r}`),process.exit(1));let o;if(t.client!==void 0)try{o=I(t.client)}catch(c){e.log.error(c instanceof Error?c.message:String(c)),process.exit(1)}else if(o=(0,l.detectClients)(r),o.length===0){e.log.info("No client detected. Nothing to uninstall.");return}const i=(0,p.join)(r,".ironbee"),g=(0,a.existsSync)(i),f=w(r,o);g&&e.log.step(`Removed ${e.pc.dim(i)}`),e.log.blank(),e.log.success(`IronBee removed. ${e.pc.dim("Restart your AI coding client to apply changes.")}`),await(0,v.trackUninstall)(f,r)});0&&(module.exports={runUninstallAll,uninstallCommand});
@@ -1,4 +1,4 @@
1
- "use strict";var p=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var c=(s,i)=>p(s,"name",{value:i,configurable:!0});var w=(s,i)=>{for(var n in i)p(s,n,{get:i[n],enumerable:!0})},A=(s,i,n,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of v(i))!_.call(s,t)&&t!==n&&p(s,t,{get:()=>i[t],enumerable:!(o=k(i,t))||o.enumerable});return s};var S=s=>A(p({},"__esModule",{value:!0}),s);var C={};w(C,{verifyCommand:()=>x});module.exports=S(C);var h=require("commander"),r=require("fs"),l=require("path"),e=require("../lib/output");function a(s){console.log(` ${e.pc.green("\u2713")} ${s}`)}c(a,"pass");function f(s,i){console.log(` ${e.pc.red("\u2717")} ${s}: ${e.pc.dim(i)}`)}c(f,"fail");function N(s){let i=!0;const n=s.status==="not_applicable",o=Array.isArray(s.not_applicable_cycles)?s.not_applicable_cycles:[];if(["pass","fail","not_applicable"].includes(s.status)?a(`status: ${s.status}`):(f("status",`unknown value "${s.status}" \u2014 must be "pass", "fail", or "not_applicable"`),i=!1),!n){const t=s.checks;Array.isArray(t)&&t.length>0?a(`checks (${t.length} item(s))`):(f("checks","checks is missing or empty"),i=!1)}return(n||o.length>0)&&(Array.isArray(s.reason)&&s.reason.length>0?a(`reason (${s.reason.length} item(s))`):(f("reason","required for N/A (global status or not_applicable_cycles)"),i=!1)),o.length>0&&a(`not_applicable_cycles: ${o.join(", ")}`),s.status==="fail"&&(!Array.isArray(s.issues)||s.issues.length===0?(f("issues",'required when status is "fail"'),i=!1):a(`errors (${s.issues.length} item(s))`)),i}c(N,"checkVerdict");function j(s){const i=(0,l.join)(s,"actions.jsonl");if(!(0,r.existsSync)(i))return!1;let n;try{n=(0,r.readFileSync)(i,"utf-8")}catch{return!1}return n.includes('"type":"verification_requested"')||n.includes('"type": "verification_requested"')?!1:n.includes('"type":"session_start"')||n.includes('"type": "session_start"')}c(j,"isMonitoringOnlySession");function D(s,i){if(i)return i;const n=(0,r.readdirSync)(s).filter(o=>(0,r.statSync)((0,l.join)(s,o)).isDirectory());return n.length===1?n[0]:null}c(D,"resolveSession");const x=new h.Command("verify").description("Validate a session verdict file (dry-run of the Stop hook checks)").argument("[session-id]","session ID to verify (auto-detected if only one active session)").option("-p, --project-dir <dir>","target project directory",".").action((s,i)=>{const n=(0,l.resolve)(i.projectDir),o=(0,l.join)(n,".ironbee","sessions");(0,r.existsSync)(o)||(e.log.error("No .ironbee/sessions/ directory found. Run `ironbee install` first."),process.exit(1));const t=D(o,s);if(!t){const g=(0,r.readdirSync)(o).filter($=>(0,r.statSync)((0,l.join)(o,$)).isDirectory());if(g.length===0){e.log.info("No sessions found. No verification has been written yet.");return}e.log.error(`Multiple sessions found. Specify a session ID:
1
+ "use strict";var p=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var c=(s,i)=>p(s,"name",{value:i,configurable:!0});var A=(s,i)=>{for(var n in i)p(s,n,{get:i[n],enumerable:!0})},S=(s,i,n,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of _(i))!w.call(s,t)&&t!==n&&p(s,t,{get:()=>i[t],enumerable:!(o=v(i,t))||o.enumerable});return s};var N=s=>S(p({},"__esModule",{value:!0}),s);var O={};A(O,{verifyCommand:()=>C});module.exports=N(O);var h=require("commander"),r=require("fs"),l=require("path"),e=require("../lib/output"),$=require("../lib/runtime-paths");function a(s){console.log(` ${e.pc.green("\u2713")} ${s}`)}c(a,"pass");function f(s,i){console.log(` ${e.pc.red("\u2717")} ${s}: ${e.pc.dim(i)}`)}c(f,"fail");function j(s){let i=!0;const n=s.status==="not_applicable",o=Array.isArray(s.not_applicable_cycles)?s.not_applicable_cycles:[];if(["pass","fail","not_applicable"].includes(s.status)?a(`status: ${s.status}`):(f("status",`unknown value "${s.status}" \u2014 must be "pass", "fail", or "not_applicable"`),i=!1),!n){const t=s.checks;Array.isArray(t)&&t.length>0?a(`checks (${t.length} item(s))`):(f("checks","checks is missing or empty"),i=!1)}return(n||o.length>0)&&(Array.isArray(s.reason)&&s.reason.length>0?a(`reason (${s.reason.length} item(s))`):(f("reason","required for N/A (global status or not_applicable_cycles)"),i=!1)),o.length>0&&a(`not_applicable_cycles: ${o.join(", ")}`),s.status==="fail"&&(!Array.isArray(s.issues)||s.issues.length===0?(f("issues",'required when status is "fail"'),i=!1):a(`errors (${s.issues.length} item(s))`)),i}c(j,"checkVerdict");function D(s){const i=(0,l.join)(s,"actions.jsonl");if(!(0,r.existsSync)(i))return!1;let n;try{n=(0,r.readFileSync)(i,"utf-8")}catch{return!1}return n.includes('"type":"verification_requested"')||n.includes('"type": "verification_requested"')?!1:n.includes('"type":"session_start"')||n.includes('"type": "session_start"')}c(D,"isMonitoringOnlySession");function x(s,i){if(i)return i;const n=(0,r.readdirSync)(s).filter(o=>(0,r.statSync)((0,l.join)(s,o)).isDirectory());return n.length===1?n[0]:null}c(x,"resolveSession");const C=new h.Command("verify").description("Validate a session verdict file (dry-run of the Stop hook checks)").argument("[session-id]","session ID to verify (auto-detected if only one active session)").option("-p, --project-dir <dir>","target project directory",".").action((s,i)=>{const n=(0,l.resolve)(i.projectDir),o=(0,$.sessionsRoot)(n);(0,r.existsSync)(o)||(e.log.error("No .ironbee/sessions/ directory found. Run `ironbee install` first."),process.exit(1));const t=x(o,s);if(!t){const g=(0,r.readdirSync)(o).filter(k=>(0,r.statSync)((0,l.join)(o,k)).isDirectory());if(g.length===0){e.log.info("No sessions found. No verification has been written yet.");return}e.log.error(`Multiple sessions found. Specify a session ID:
2
2
  ${g.join(`
3
- `)}`),process.exit(1)}const d=(0,l.join)(o,t,"verdict.json"),m=(0,l.join)(o,t,"retries");if(e.log.info(`Verifying session: ${e.pc.bold(e.pc.cyan(t))}`),e.log.blank(),!(0,r.existsSync)(d)){const g=(0,l.join)(o,t);if(j(g)){e.log.info(`${e.pc.dim("\xB7")} No verdict found \u2014 this session ran in ${e.pc.bold("monitoring-only mode")} (verification.enable: false).`),e.log.dim(" Nothing to validate. Toggle on with `ironbee verification enable` if you want enforcement.");return}f("verdict file",`not found at ${e.pc.dim(d)}`),e.log.blank(),console.log(` ${e.pc.bold(e.pc.red("\u2717 FAIL"))} ${e.pc.dim("\u2014 no verdict written yet.")}`),process.exit(1)}a(`verdict file exists: ${e.pc.dim(d)}`);let u;try{u=JSON.parse((0,r.readFileSync)(d,"utf-8"))}catch{f("verdict file","invalid JSON"),e.log.blank(),console.log(` ${e.pc.bold(e.pc.red("\u2717 FAIL"))} ${e.pc.dim("\u2014 verdict is not valid JSON.")}`),process.exit(1)}a("verdict is valid JSON"),e.log.blank();const y=N(u),b=(0,r.existsSync)(m)&&parseInt((0,r.readFileSync)(m,"utf-8"),10)||0;b>0&&console.log(`
3
+ `)}`),process.exit(1)}const d=(0,l.join)(o,t,"verdict.json"),m=(0,l.join)(o,t,"retries");if(e.log.info(`Verifying session: ${e.pc.bold(e.pc.cyan(t))}`),e.log.blank(),!(0,r.existsSync)(d)){const g=(0,l.join)(o,t);if(D(g)){e.log.info(`${e.pc.dim("\xB7")} No verdict found \u2014 this session ran in ${e.pc.bold("monitoring-only mode")} (verification.enable: false).`),e.log.dim(" Nothing to validate. Toggle on with `ironbee verification enable` if you want enforcement.");return}f("verdict file",`not found at ${e.pc.dim(d)}`),e.log.blank(),console.log(` ${e.pc.bold(e.pc.red("\u2717 FAIL"))} ${e.pc.dim("\u2014 no verdict written yet.")}`),process.exit(1)}a(`verdict file exists: ${e.pc.dim(d)}`);let u;try{u=JSON.parse((0,r.readFileSync)(d,"utf-8"))}catch{f("verdict file","invalid JSON"),e.log.blank(),console.log(` ${e.pc.bold(e.pc.red("\u2717 FAIL"))} ${e.pc.dim("\u2014 verdict is not valid JSON.")}`),process.exit(1)}a("verdict is valid JSON"),e.log.blank();const y=j(u),b=(0,r.existsSync)(m)&&parseInt((0,r.readFileSync)(m,"utf-8"),10)||0;b>0&&console.log(`
4
4
  ${e.pc.dim("retries:")} ${e.pc.yellow(`${b}/3`)}`),e.log.blank(),y&&u.status==="pass"?console.log(` ${e.pc.bold(e.pc.green("\u2713 PASS"))} ${e.pc.dim("\u2014 hook would allow completion.")}`):y&&u.status==="not_applicable"?console.log(` ${e.pc.bold(e.pc.green("\u2713 N/A"))} ${e.pc.dim("\u2014 no runtime surface; hook would allow (unless strict mode / fail-like prior verdict).")}`):y&&u.status==="fail"?console.log(` ${e.pc.bold(e.pc.red("\u2717 BLOCKED"))} ${e.pc.dim("\u2014 verdict status is fail. Fix issues and re-verify.")}`):console.log(` ${e.pc.bold(e.pc.red("\u2717 BLOCKED"))} ${e.pc.dim("\u2014 verdict has schema errors.")}`)});0&&(module.exports={verifyCommand});
@@ -1,7 +1,7 @@
1
- "use strict";var v=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var c=(t,e)=>v(t,"name",{value:e,configurable:!0});var j=(t,e)=>{for(var i in e)v(t,i,{get:e[i],enumerable:!0})},P=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of R(e))!N.call(t,r)&&r!==i&&v(t,r,{get:()=>e[r],enumerable:!(n=F(e,r))||n.enumerable});return t};var L=t=>P(v({},"__esModule",{value:!0}),t);var te={};j(te,{ActivityAwareEvent:()=>d.ActivityAwareEvent,Event:()=>d.Event,EventType:()=>d.EventType,EventTypeValue:()=>d.EventTypeValue,FixAwareEvent:()=>d.FixAwareEvent,VerificationAwareEvent:()=>d.VerificationAwareEvent,appendAction:()=>I,baseFields:()=>T,deterministicSessionEndId:()=>D,findDurationSinceLastAction:()=>G,findLastActionTimestamp:()=>W,getFileChangesSinceLastFailVerdict:()=>X,getFileChangesSinceLastVerification:()=>H,getToolCallsSinceLastFileChange:()=>K,getToolCallsSinceLastVerification:()=>z,hasFileChangesSinceLastVerification:()=>Q,hasToolCallsSinceLastVerdict:()=>B,hasVerifierEverEngaged:()=>Z,readActionsSinceLastMarker:()=>$,resolveProjectName:()=>V,summarizeFixFileChanges:()=>ee});module.exports=L(te);var l=require("fs"),y=require("crypto"),a=require("path"),f=require("../../lib/logger"),b=require("../../lib/collector"),w=require("../../lib/config"),k=require("../../queue/submit"),C=require("../../queue/types"),S=require("../../queue/register-handlers"),d=require("../../lib/event");function V(t){let e=t,i;for(;;){const n=(0,a.join)(e,".git");if((0,l.existsSync)(n)){const s=M(n);if(s==="directory"){const o=E(n);return o||(0,a.basename)(e)}if(s==="linked-pointer"){const o=_(n),u=o!==void 0?E(o):void 0;return u||(0,a.basename)(e)}s==="worktree-pointer"&&i===void 0&&(i=U(n))}const r=(0,a.dirname)(e);if(r===e)break;e=r}return i??(0,a.basename)(t)}c(V,"resolveProjectName");function M(t){try{const e=(0,l.statSync)(t);if(e.isDirectory())return"directory";if(!e.isFile())return"other";const i=_(t);return i===void 0?"other":(0,l.existsSync)((0,a.join)(i,"commondir"))?"worktree-pointer":"linked-pointer"}catch(e){return f.logger.debug(`resolveProjectName: stat failed for ${t}: ${e instanceof Error?e.message:e}`),"other"}}c(M,"classifyGitEntry");function _(t){try{const i=(0,l.readFileSync)(t,"utf-8").trim().match(/^gitdir:\s*(.+)$/m);if(!i)return;const n=i[1].trim();return(0,a.isAbsolute)(n)?n:(0,a.resolve)((0,a.dirname)(t),n)}catch(e){f.logger.debug(`resolveProjectName: pointer at ${t} unreadable: ${e instanceof Error?e.message:e}`);return}}c(_,"readGitdirPointer");function E(t){try{const e=(0,a.join)(t,"config");if(!(0,l.existsSync)(e))return;const i=q((0,l.readFileSync)(e,"utf-8"));return i?O(i):void 0}catch(e){f.logger.debug(`resolveProjectName: failed to read git config at ${t}: ${e instanceof Error?e.message:e}`);return}}c(E,"repoNameFromGitConfig");function U(t){const e=_(t);if(e===void 0)return;const i=(0,a.join)(e,"commondir");let n;try{if((0,l.existsSync)(i)){const o=(0,l.readFileSync)(i,"utf-8").trim();n=(0,a.isAbsolute)(o)?o:(0,a.resolve)(e,o)}else n=e}catch(o){f.logger.debug(`resolveProjectName: commondir at ${i} unreadable: ${o instanceof Error?o.message:o}`);return}const r=E(n);if(r)return r;const s=(0,a.basename)(n)===".git"?(0,a.basename)((0,a.dirname)(n)):(0,a.basename)(n);return s.length>0?s:void 0}c(U,"repoNameFromWorktreePointer");function q(t){const e=t.split(/\r?\n/);let i=null,n=null,r,s;for(const o of e){const u=o.trim();if(u.length===0||u.startsWith("#")||u.startsWith(";"))continue;const p=u.match(/^\[([^\s\]]+)(?:\s+"([^"]*)")?\]$/);if(p){i=p[1].toLowerCase(),n=p[2]??null;continue}if(i!=="remote"||n===null)continue;const m=u.match(/^url\s*=\s*(.+?)\s*$/i);if(!m)continue;const g=m[1];n==="origin"&&(r=g),s===void 0&&(s=g)}return r??s}c(q,"readFirstRemoteUrl");function O(t){let e=t.trim();if(e.length===0)return;const i=e.match(/^[^/@]+@[^/:]+:(.+)$/);if(i?e=i[1]:e=e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*\//i,""),e=e.replace(/[?#].*$/,"").replace(/\/+$/,""),e.length===0)return;const r=(e.split("/").pop()??"").replace(/\.git$/i,"");return r.length>0?r:void 0}c(O,"repoNameFromRemoteUrl");function T(t){const e=(0,a.basename)((0,a.dirname)(t)),i=(0,a.dirname)((0,a.dirname)((0,a.dirname)((0,a.dirname)(t)))),n=(0,a.dirname)(t),{getUserEmail:r,getUsageType:s,getUsagePlan:o}=require("./session-state"),u=r(n),p=s(n),m=o(n),g={id:(0,y.randomUUID)(),session_id:e,project_name:V(i)};return u&&(g.user_email=u),p&&(g.usage_type=p),m&&(g.usage_plan=m),g}c(T,"baseFields");function D(t){const e=(0,y.createHash)("sha256").update("session_end:"+t).digest("hex");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20,32)}`}c(D,"deterministicSessionEndId");async function I(t,e){const i=T(t);e.id||(e.id=i.id),e.session_id||(e.session_id=i.session_id),e.project_name||(e.project_name=i.project_name);try{(0,l.mkdirSync)((0,a.dirname)(t),{recursive:!0}),(0,l.appendFileSync)(t,JSON.stringify(e)+`
2
- `)}catch(n){f.logger.debug(`failed to append action to ${t}: ${n}`)}if(e.type!=="tool_call"){const n=(0,a.basename)((0,a.dirname)(t)),r=(0,a.dirname)((0,a.dirname)((0,a.dirname)((0,a.dirname)(t))));try{await(0,b.sendToCollector)(e,n,r)}catch(s){s instanceof b.RetriableCollectorError?J(r,n,e,s):f.logger.debug(`failed to send action to collector: ${s}`)}}}c(I,"appendAction");function J(t,e,i,n){if(!(0,w.isJobQueueEnabled)(t)){f.logger.debug(`collector fallback: jobQueue disabled, dropping type=${i.type} id=${i.id} (cause: ${n.message})`);return}try{(0,k.submit)(t,e,S.SEND_EVENT_TYPE,i),f.logger.debug(`collector fallback: enqueued type=${i.type} id=${i.id} as send_event (cause: ${n.message})`)}catch(r){if(r instanceof C.JobTooLargeError){f.logger.debug(`collector fallback: event too large for queue (${r.sizeBytes} bytes), dropping type=${i.type} id=${i.id}`);return}f.logger.debug(`collector fallback: queue submit failed for type=${i.type} id=${i.id}: ${r}`)}}c(J,"enqueueCollectorFallback");function G(t,e,i){if((0,l.existsSync)(t))try{const r=(0,l.readFileSync)(t,"utf-8").trim().split(`
3
- `).filter(s=>s.length>0);for(let s=r.length-1;s>=0;s--)try{const o=JSON.parse(r[s]);if(o.type===e&&typeof o.timestamp=="number")return i-o.timestamp}catch{}}catch(n){f.logger.debug(`failed to find duration for ${e}: ${n}`)}}c(G,"findDurationSinceLastAction");function $(t,e){return h(t,i=>i.type===e)}c($,"readActionsSinceLastMarker");function W(t){if((0,l.existsSync)(t))try{const i=(0,l.readFileSync)(t,"utf-8").trim().split(`
4
- `).filter(n=>n.length>0);for(let n=i.length-1;n>=0;n--)try{const r=JSON.parse(i[n]);if(typeof r.timestamp=="number")return r.timestamp}catch{}}catch(e){f.logger.debug(`failed to read last action timestamp from ${t}: ${e}`)}}c(W,"findLastActionTimestamp");function h(t,e){if(!(0,l.existsSync)(t))return[];try{const n=(0,l.readFileSync)(t,"utf-8").trim().split(`
5
- `).filter(o=>o.length>0);let r=-1;const s=[];for(let o=0;o<n.length;o++)try{const u=JSON.parse(n[o]);s.push(u),e(u)&&(r=o)}catch{}return s.slice(r+1)}catch(i){return f.logger.debug(`failed to read actions from ${t}: ${i}`),[]}}c(h,"readActionsSinceMatch");function A(t){return t.type!=="verification_requested"?!1:t.action==="allow"}c(A,"isAllowVerificationRequested");function x(t){if(t.type!=="tool_call")return!1;const e=t.verification_id;return typeof e=="string"&&e.length>0}c(x,"isVerificationScopedToolCall");function z(t){return h(t,A).filter(x)}c(z,"getToolCallsSinceLastVerification");function K(t){return $(t,"file_change").filter(x)}c(K,"getToolCallsSinceLastFileChange");function B(t){return $(t,"verdict_write").some(x)}c(B,"hasToolCallsSinceLastVerdict");function Q(t){return h(t,A).some(i=>i.type==="file_change")}c(Q,"hasFileChangesSinceLastVerification");function H(t){return h(t,A).filter(i=>i.type==="file_change")}c(H,"getFileChangesSinceLastVerification");function Y(t){return t.type!=="verdict_write"?!1:t.verdict?.status==="fail"}c(Y,"isFailVerdictWrite");function X(t){if(!(0,l.existsSync)(t))return[];try{const n=(0,l.readFileSync)(t,"utf-8").trim().split(`
6
- `).filter(o=>o.length>0).map(o=>{try{return JSON.parse(o)}catch{return null}});let r=-1;for(let o=0;o<n.length;o++){const u=n[o];u!==null&&Y(u)&&(r=o)}if(r<0)return[];const s=[];for(let o=r+1;o<n.length;o++){const u=n[o];u!==null&&u.type==="file_change"&&s.push(u)}return s}catch(e){return f.logger.debug(`failed to read file changes since last fail verdict: ${e}`),[]}}c(X,"getFileChangesSinceLastFailVerdict");function Z(t){if(!(0,l.existsSync)(t))return!1;try{const i=(0,l.readFileSync)(t,"utf-8").trim().split(`
7
- `).filter(n=>n.length>0);for(const n of i){let r;try{r=JSON.parse(n)}catch{continue}if(r.type==="verification_start")return!0;if(r.type==="tool_call"){const s=r;if(s.tool_type==="mcp"&&typeof s.mcp_server=="string"&&s.mcp_server.endsWith("-devtools"))return!0}}return!1}catch(e){return f.logger.debug(`failed to scan verifier engagement in ${t}: ${e}`),!1}}c(Z,"hasVerifierEverEngaged");function ee(t){if(t.length===0)return[];const e=new Map,i=[];for(const n of t){const r=n.file_path;let s=e.get(r);s||(s={op:n.operation,added:0,removed:0},e.set(r,s),i.push(r)),s.op=s.op==="create"||n.operation==="create"?"create":n.operation,s.added+=typeof n.lines_added=="number"?n.lines_added:0,s.removed+=typeof n.lines_removed=="number"?n.lines_removed:0}return i.map(n=>{const r=e.get(n);return`${r.op} ${n} (+${r.added}/-${r.removed})`})}c(ee,"summarizeFixFileChanges");0&&(module.exports={ActivityAwareEvent,Event,EventType,EventTypeValue,FixAwareEvent,VerificationAwareEvent,appendAction,baseFields,deterministicSessionEndId,findDurationSinceLastAction,findLastActionTimestamp,getFileChangesSinceLastFailVerdict,getFileChangesSinceLastVerification,getToolCallsSinceLastFileChange,getToolCallsSinceLastVerification,hasFileChangesSinceLastVerification,hasToolCallsSinceLastVerdict,hasVerifierEverEngaged,readActionsSinceLastMarker,resolveProjectName,summarizeFixFileChanges});
1
+ "use strict";var h=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var c=(t,e)=>h(t,"name",{value:e,configurable:!0});var N=(t,e)=>{for(var i in e)h(t,i,{get:e[i],enumerable:!0})},D=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of P(e))!R.call(t,r)&&r!==i&&h(t,r,{get:()=>e[r],enumerable:!(n=j(e,r))||n.enumerable});return t};var q=t=>D(h({},"__esModule",{value:!0}),t);var ne={};N(ne,{ActivityAwareEvent:()=>d.ActivityAwareEvent,Event:()=>d.Event,EventType:()=>d.EventType,EventTypeValue:()=>d.EventTypeValue,FixAwareEvent:()=>d.FixAwareEvent,VerificationAwareEvent:()=>d.VerificationAwareEvent,appendAction:()=>J,baseFields:()=>T,deterministicSessionEndId:()=>I,findDurationSinceLastAction:()=>W,findLastActionTimestamp:()=>z,getFileChangesSinceLastFailVerdict:()=>Z,getFileChangesSinceLastVerification:()=>Y,getToolCallsSinceLastFileChange:()=>B,getToolCallsSinceLastVerification:()=>K,hasFileChangesSinceLastVerification:()=>H,hasToolCallsSinceLastVerdict:()=>Q,hasVerifierEverEngaged:()=>ee,readActionsSinceLastMarker:()=>w,resolveProjectName:()=>F,summarizeFixFileChanges:()=>te});module.exports=q(ne);var l=require("fs"),b=require("crypto"),a=require("path"),f=require("../../lib/logger"),_=require("../../lib/collector"),k=require("../../lib/config"),C=require("../../queue/submit"),S=require("../../queue/types"),V=require("../../queue/register-handlers"),d=require("../../lib/event");function F(t){let e=t,i;for(;;){const n=(0,a.join)(e,".git");if((0,l.existsSync)(n)){const s=L(n);if(s==="directory"){const o=A(n);return o||(0,a.basename)(e)}if(s==="linked-pointer"){const o=E(n),u=o!==void 0?A(o):void 0;return u||(0,a.basename)(e)}s==="worktree-pointer"&&i===void 0&&(i=M(n))}const r=(0,a.dirname)(e);if(r===e)break;e=r}return i??(0,a.basename)(t)}c(F,"resolveProjectName");function L(t){try{const e=(0,l.statSync)(t);if(e.isDirectory())return"directory";if(!e.isFile())return"other";const i=E(t);return i===void 0?"other":(0,l.existsSync)((0,a.join)(i,"commondir"))?"worktree-pointer":"linked-pointer"}catch(e){return f.logger.debug(`resolveProjectName: stat failed for ${t}: ${e instanceof Error?e.message:e}`),"other"}}c(L,"classifyGitEntry");function E(t){try{const i=(0,l.readFileSync)(t,"utf-8").trim().match(/^gitdir:\s*(.+)$/m);if(!i)return;const n=i[1].trim();return(0,a.isAbsolute)(n)?n:(0,a.resolve)((0,a.dirname)(t),n)}catch(e){f.logger.debug(`resolveProjectName: pointer at ${t} unreadable: ${e instanceof Error?e.message:e}`);return}}c(E,"readGitdirPointer");function A(t){try{const e=(0,a.join)(t,"config");if(!(0,l.existsSync)(e))return;const i=U((0,l.readFileSync)(e,"utf-8"));return i?O(i):void 0}catch(e){f.logger.debug(`resolveProjectName: failed to read git config at ${t}: ${e instanceof Error?e.message:e}`);return}}c(A,"repoNameFromGitConfig");function M(t){const e=E(t);if(e===void 0)return;const i=(0,a.join)(e,"commondir");let n;try{if((0,l.existsSync)(i)){const o=(0,l.readFileSync)(i,"utf-8").trim();n=(0,a.isAbsolute)(o)?o:(0,a.resolve)(e,o)}else n=e}catch(o){f.logger.debug(`resolveProjectName: commondir at ${i} unreadable: ${o instanceof Error?o.message:o}`);return}const r=A(n);if(r)return r;const s=(0,a.basename)(n)===".git"?(0,a.basename)((0,a.dirname)(n)):(0,a.basename)(n);return s.length>0?s:void 0}c(M,"repoNameFromWorktreePointer");function U(t){const e=t.split(/\r?\n/);let i=null,n=null,r,s;for(const o of e){const u=o.trim();if(u.length===0||u.startsWith("#")||u.startsWith(";"))continue;const g=u.match(/^\[([^\s\]]+)(?:\s+"([^"]*)")?\]$/);if(g){i=g[1].toLowerCase(),n=g[2]??null;continue}if(i!=="remote"||n===null)continue;const p=u.match(/^url\s*=\s*(.+?)\s*$/i);if(!p)continue;const m=p[1];n==="origin"&&(r=m),s===void 0&&(s=m)}return r??s}c(U,"readFirstRemoteUrl");function O(t){let e=t.trim();if(e.length===0)return;const i=e.match(/^[^/@]+@[^/:]+:(.+)$/);if(i?e=i[1]:e=e.replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*\//i,""),e=e.replace(/[?#].*$/,"").replace(/\/+$/,""),e.length===0)return;const r=(e.split("/").pop()??"").replace(/\.git$/i,"");return r.length>0?r:void 0}c(O,"repoNameFromRemoteUrl");function T(t){const e=(0,a.basename)((0,a.dirname)(t)),i=(0,a.dirname)(t),{getUserEmail:n,getUsageType:r,getUsagePlan:s,getProjectDir:o}=require("./session-state"),u=o(i)??(0,a.dirname)((0,a.dirname)((0,a.dirname)(i))),g=n(i),p=r(i),m=s(i),v={id:(0,b.randomUUID)(),session_id:e,project_name:F(u)};return g&&(v.user_email=g),p&&(v.usage_type=p),m&&(v.usage_plan=m),v}c(T,"baseFields");function I(t){const e=(0,b.createHash)("sha256").update("session_end:"+t).digest("hex");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20,32)}`}c(I,"deterministicSessionEndId");async function J(t,e){const i=T(t);e.id||(e.id=i.id),e.session_id||(e.session_id=i.session_id),e.project_name||(e.project_name=i.project_name);try{(0,l.mkdirSync)((0,a.dirname)(t),{recursive:!0}),(0,l.appendFileSync)(t,JSON.stringify(e)+`
2
+ `)}catch(n){f.logger.debug(`failed to append action to ${t}: ${n}`)}if(e.type!=="tool_call"){const n=(0,a.dirname)(t),r=(0,a.basename)(n),{getProjectDir:s}=require("./session-state"),o=s(n)??(0,a.dirname)((0,a.dirname)((0,a.dirname)(n)));try{await(0,_.sendToCollector)(e,r,o)}catch(u){u instanceof _.RetriableCollectorError?G(o,r,e,u):f.logger.debug(`failed to send action to collector: ${u}`)}}}c(J,"appendAction");function G(t,e,i,n){if(!(0,k.isJobQueueEnabled)(t)){f.logger.debug(`collector fallback: jobQueue disabled, dropping type=${i.type} id=${i.id} (cause: ${n.message})`);return}try{(0,C.submit)(t,e,V.SEND_EVENT_TYPE,i),f.logger.debug(`collector fallback: enqueued type=${i.type} id=${i.id} as send_event (cause: ${n.message})`)}catch(r){if(r instanceof S.JobTooLargeError){f.logger.debug(`collector fallback: event too large for queue (${r.sizeBytes} bytes), dropping type=${i.type} id=${i.id}`);return}f.logger.debug(`collector fallback: queue submit failed for type=${i.type} id=${i.id}: ${r}`)}}c(G,"enqueueCollectorFallback");function W(t,e,i){if((0,l.existsSync)(t))try{const r=(0,l.readFileSync)(t,"utf-8").trim().split(`
3
+ `).filter(s=>s.length>0);for(let s=r.length-1;s>=0;s--)try{const o=JSON.parse(r[s]);if(o.type===e&&typeof o.timestamp=="number")return i-o.timestamp}catch{}}catch(n){f.logger.debug(`failed to find duration for ${e}: ${n}`)}}c(W,"findDurationSinceLastAction");function w(t,e){return y(t,i=>i.type===e)}c(w,"readActionsSinceLastMarker");function z(t){if((0,l.existsSync)(t))try{const i=(0,l.readFileSync)(t,"utf-8").trim().split(`
4
+ `).filter(n=>n.length>0);for(let n=i.length-1;n>=0;n--)try{const r=JSON.parse(i[n]);if(typeof r.timestamp=="number")return r.timestamp}catch{}}catch(e){f.logger.debug(`failed to read last action timestamp from ${t}: ${e}`)}}c(z,"findLastActionTimestamp");function y(t,e){if(!(0,l.existsSync)(t))return[];try{const n=(0,l.readFileSync)(t,"utf-8").trim().split(`
5
+ `).filter(o=>o.length>0);let r=-1;const s=[];for(let o=0;o<n.length;o++)try{const u=JSON.parse(n[o]);s.push(u),e(u)&&(r=o)}catch{}return s.slice(r+1)}catch(i){return f.logger.debug(`failed to read actions from ${t}: ${i}`),[]}}c(y,"readActionsSinceMatch");function x(t){return t.type!=="verification_requested"?!1:t.action==="allow"}c(x,"isAllowVerificationRequested");function $(t){if(t.type!=="tool_call")return!1;const e=t.verification_id;return typeof e=="string"&&e.length>0}c($,"isVerificationScopedToolCall");function K(t){return y(t,x).filter($)}c(K,"getToolCallsSinceLastVerification");function B(t){return w(t,"file_change").filter($)}c(B,"getToolCallsSinceLastFileChange");function Q(t){return w(t,"verdict_write").some($)}c(Q,"hasToolCallsSinceLastVerdict");function H(t){return y(t,x).some(i=>i.type==="file_change")}c(H,"hasFileChangesSinceLastVerification");function Y(t){return y(t,x).filter(i=>i.type==="file_change")}c(Y,"getFileChangesSinceLastVerification");function X(t){return t.type!=="verdict_write"?!1:t.verdict?.status==="fail"}c(X,"isFailVerdictWrite");function Z(t){if(!(0,l.existsSync)(t))return[];try{const n=(0,l.readFileSync)(t,"utf-8").trim().split(`
6
+ `).filter(o=>o.length>0).map(o=>{try{return JSON.parse(o)}catch{return null}});let r=-1;for(let o=0;o<n.length;o++){const u=n[o];u!==null&&X(u)&&(r=o)}if(r<0)return[];const s=[];for(let o=r+1;o<n.length;o++){const u=n[o];u!==null&&u.type==="file_change"&&s.push(u)}return s}catch(e){return f.logger.debug(`failed to read file changes since last fail verdict: ${e}`),[]}}c(Z,"getFileChangesSinceLastFailVerdict");function ee(t){if(!(0,l.existsSync)(t))return!1;try{const i=(0,l.readFileSync)(t,"utf-8").trim().split(`
7
+ `).filter(n=>n.length>0);for(const n of i){let r;try{r=JSON.parse(n)}catch{continue}if(r.type==="verification_start")return!0;if(r.type==="tool_call"){const s=r;if(s.tool_type==="mcp"&&typeof s.mcp_server=="string"&&s.mcp_server.endsWith("-devtools"))return!0}}return!1}catch(e){return f.logger.debug(`failed to scan verifier engagement in ${t}: ${e}`),!1}}c(ee,"hasVerifierEverEngaged");function te(t){if(t.length===0)return[];const e=new Map,i=[];for(const n of t){const r=n.file_path;let s=e.get(r);s||(s={op:n.operation,added:0,removed:0},e.set(r,s),i.push(r)),s.op=s.op==="create"||n.operation==="create"?"create":n.operation,s.added+=typeof n.lines_added=="number"?n.lines_added:0,s.removed+=typeof n.lines_removed=="number"?n.lines_removed:0}return i.map(n=>{const r=e.get(n);return`${r.op} ${n} (+${r.added}/-${r.removed})`})}c(te,"summarizeFixFileChanges");0&&(module.exports={ActivityAwareEvent,Event,EventType,EventTypeValue,FixAwareEvent,VerificationAwareEvent,appendAction,baseFields,deterministicSessionEndId,findDurationSinceLastAction,findLastActionTimestamp,getFileChangesSinceLastFailVerdict,getFileChangesSinceLastVerification,getToolCallsSinceLastFileChange,getToolCallsSinceLastVerification,hasFileChangesSinceLastVerification,hasToolCallsSinceLastVerdict,hasVerifierEverEngaged,readActionsSinceLastMarker,resolveProjectName,summarizeFixFileChanges});
@@ -1 +1 @@
1
- "use strict";var v=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var a=(i,e)=>v(i,"name",{value:e,configurable:!0});var h=(i,e)=>{for(var n in e)v(i,n,{get:e[n],enumerable:!0})},_=(i,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!V.call(i,r)&&r!==n&&v(i,r,{get:()=>e[r],enumerable:!(t=A(e,r))||t.enumerable});return i};var b=i=>_(v({},"__esModule",{value:!0}),i);var St={};h(St,{addPendingFixes:()=>ct,clearActiveActivity:()=>gt,clearActiveFix:()=>z,clearActiveVerification:()=>F,clearPendingFixes:()=>st,clearVerifyIntent:()=>ut,closeOpenCycles:()=>vt,generateTraceId:()=>T,getActiveActivityId:()=>Q,getActiveFixId:()=>C,getActiveTraceId:()=>E,getActiveVerificationId:()=>w,getChainedStatusLine:()=>et,getContextInjectedVerificationId:()=>nt,getLastVerdictHadIssues:()=>U,getLastVerdictStatus:()=>q,getPendingFixes:()=>at,getPhase:()=>O,getRetries:()=>R,getUsagePlan:()=>D,getUsageType:()=>Z,getUserEmail:()=>X,getVerifyIntent:()=>ot,incrementRetries:()=>L,isActive:()=>G,isFailLikeVerdictStatus:()=>lt,isRecordingActive:()=>M,isRecordingRequired:()=>J,readState:()=>c,reconcileAbandonedActivity:()=>yt,reconcileForCompact:()=>It,reconcileSessionState:()=>pt,resetRetries:()=>$,setActive:()=>K,setActiveActivity:()=>ft,setActiveFix:()=>k,setActiveVerification:()=>P,setChainedStatusLine:()=>it,setContextInjectedVerificationId:()=>rt,setLastVerdictHadIssues:()=>H,setLastVerdictStatus:()=>j,setPhase:()=>N,setRecordingActive:()=>W,setRecordingRequired:()=>B,setUsage:()=>tt,setUserEmail:()=>Y,setVerifyIntent:()=>dt,writeState:()=>u});module.exports=b(St);var x=require("crypto"),f=require("fs"),y=require("path"),l=require("../../lib/logger"),g=require("./activity-participants"),p=require("../../lib/atomic"),d=require("./actions");const I="state.json",S={retries:0,activeVerificationId:null,activeTraceId:null,lastVerdictStatus:null,lastVerdictHadIssues:!1,activeFixId:null,activeActivityId:null,phase:null,recordingRequired:!1,recordingActive:!1,active:!1,userEmail:null,usageType:null,usagePlan:null,chainedStatusLine:null,contextInjectedVerificationId:null,pendingFixes:[],verifyIntent:null};function T(){return(0,x.randomBytes)(16).toString("hex")}a(T,"generateTraceId");function c(i){const e=(0,y.join)(i,I);if(!(0,f.existsSync)(e))return{...S};try{const n=(0,f.readFileSync)(e,"utf-8"),t=JSON.parse(n),r=["coding","verifying","fixing"],s=["api","subscription"];return{retries:typeof t.retries=="number"?t.retries:0,activeVerificationId:typeof t.activeVerificationId=="string"?t.activeVerificationId:null,activeTraceId:typeof t.activeTraceId=="string"?t.activeTraceId:null,lastVerdictStatus:typeof t.lastVerdictStatus=="string"?t.lastVerdictStatus:null,lastVerdictHadIssues:typeof t.lastVerdictHadIssues=="boolean"?t.lastVerdictHadIssues:!1,activeFixId:typeof t.activeFixId=="string"?t.activeFixId:null,activeActivityId:typeof t.activeActivityId=="string"?t.activeActivityId:null,phase:typeof t.phase=="string"&&r.includes(t.phase)?t.phase:null,recordingRequired:typeof t.recordingRequired=="boolean"?t.recordingRequired:!1,recordingActive:typeof t.recordingActive=="boolean"?t.recordingActive:!1,active:typeof t.active=="boolean"?t.active:!1,userEmail:typeof t.userEmail=="string"?t.userEmail:null,usageType:typeof t.usageType=="string"&&s.includes(t.usageType)?t.usageType:null,usagePlan:typeof t.usagePlan=="string"&&t.usagePlan.length>0?t.usagePlan:null,chainedStatusLine:typeof t.chainedStatusLine=="string"&&t.chainedStatusLine.length>0?t.chainedStatusLine:null,contextInjectedVerificationId:typeof t.contextInjectedVerificationId=="string"?t.contextInjectedVerificationId:null,pendingFixes:Array.isArray(t.pendingFixes)?t.pendingFixes.filter(o=>typeof o=="string"&&o.length>0):[],verifyIntent:typeof t.verifyIntent=="string"&&t.verifyIntent.length>0?t.verifyIntent:null}}catch(n){return l.logger.debug(`failed to read state from ${e}: ${n}`),{...S}}}a(c,"readState");function u(i,e){const n=(0,y.join)(i,I);try{(0,f.mkdirSync)(i,{recursive:!0});const t=`${n}.tmp.${process.pid}.${Date.now()}`,r=JSON.stringify(e,null,2);try{(0,f.writeFileSync)(t,r),(0,p.renameWithRetry)(t,n)}catch(s){try{(0,f.existsSync)(t)&&(0,f.unlinkSync)(t)}catch{}throw s}(0,p.sweepStaleTmpFiles)(n)}catch(t){l.logger.debug(`failed to write state to ${n}: ${t}`)}}a(u,"writeState");function w(i){return c(i).activeVerificationId??void 0}a(w,"getActiveVerificationId");function P(i,e,n){const t=c(i);t.activeVerificationId=e,t.activeTraceId=n,t.phase="verifying",u(i,t)}a(P,"setActiveVerification");function E(i){return c(i).activeTraceId??void 0}a(E,"getActiveTraceId");function F(i){const e=c(i);e.activeVerificationId=null,e.activeTraceId=null,e.phase="coding",u(i,e)}a(F,"clearActiveVerification");function R(i){return c(i).retries}a(R,"getRetries");function L(i){const e=c(i);return e.retries=e.retries+1,u(i,e),e.retries}a(L,"incrementRetries");function $(i){const e=c(i);e.retries=0,u(i,e)}a($,"resetRetries");function q(i){return c(i).lastVerdictStatus??void 0}a(q,"getLastVerdictStatus");function j(i,e){const n=c(i);n.lastVerdictStatus=e,u(i,n)}a(j,"setLastVerdictStatus");function U(i){return c(i).lastVerdictHadIssues===!0}a(U,"getLastVerdictHadIssues");function H(i,e){const n=c(i);n.lastVerdictHadIssues=e,u(i,n)}a(H,"setLastVerdictHadIssues");function k(i,e){const n=c(i);n.activeFixId=e,u(i,n)}a(k,"setActiveFix");function C(i){return c(i).activeFixId??void 0}a(C,"getActiveFixId");function z(i){const e=c(i);e.activeFixId=null,u(i,e)}a(z,"clearActiveFix");function N(i,e){const n=c(i);n.phase=e,u(i,n)}a(N,"setPhase");function O(i){return c(i).phase}a(O,"getPhase");function J(i){return c(i).recordingRequired}a(J,"isRecordingRequired");function B(i,e){const n=c(i);n.recordingRequired=e,u(i,n)}a(B,"setRecordingRequired");function M(i){return c(i).recordingActive}a(M,"isRecordingActive");function W(i,e){const n=c(i);n.recordingActive=e,u(i,n)}a(W,"setRecordingActive");function G(i){return c(i).active}a(G,"isActive");function K(i,e){const n=c(i);n.active=e,e||(n.activeActivityId=null),u(i,n)}a(K,"setActive");function Q(i){return c(i).activeActivityId??void 0}a(Q,"getActiveActivityId");function X(i){return c(i).userEmail??void 0}a(X,"getUserEmail");function Y(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.userEmail!==n&&(t.userEmail=n,u(i,t))}a(Y,"setUserEmail");function Z(i){return c(i).usageType??void 0}a(Z,"getUsageType");function D(i){return c(i).usagePlan??void 0}a(D,"getUsagePlan");function tt(i,e){const n=e.usage_type==="api"||e.usage_type==="subscription"?e.usage_type:null,t=typeof e.usage_plan=="string"&&e.usage_plan.length>0?e.usage_plan:null,r=c(i);r.usageType===n&&r.usagePlan===t||(r.usageType=n,r.usagePlan=t,u(i,r))}a(tt,"setUsage");function et(i){return c(i).chainedStatusLine??void 0}a(et,"getChainedStatusLine");function it(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.chainedStatusLine!==n&&(t.chainedStatusLine=n,u(i,t))}a(it,"setChainedStatusLine");function nt(i){return c(i).contextInjectedVerificationId??void 0}a(nt,"getContextInjectedVerificationId");function rt(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.contextInjectedVerificationId!==n&&(t.contextInjectedVerificationId=n,u(i,t))}a(rt,"setContextInjectedVerificationId");function at(i){return c(i).pendingFixes}a(at,"getPendingFixes");function ct(i,e){const n=e.filter(o=>typeof o=="string"&&o.length>0);if(n.length===0)return;const t=c(i),r=new Set(t.pendingFixes),s=[...t.pendingFixes];for(const o of n)r.has(o)||(r.add(o),s.push(o));s.length!==t.pendingFixes.length&&(t.pendingFixes=s,u(i,t))}a(ct,"addPendingFixes");function st(i){const e=c(i);e.pendingFixes.length!==0&&(e.pendingFixes=[],u(i,e))}a(st,"clearPendingFixes");function ot(i){return c(i).verifyIntent}a(ot,"getVerifyIntent");function dt(i,e){const n=c(i);n.verifyIntent!==e&&(n.verifyIntent=e,u(i,n))}a(dt,"setVerifyIntent");function ut(i){const e=c(i);e.verifyIntent!==null&&(e.verifyIntent=null,u(i,e))}a(ut,"clearVerifyIntent");function lt(i){return i==="fail"||i==="fail_reported"}a(lt,"isFailLikeVerdictStatus");function ft(i,e){const n=c(i);n.activeActivityId=e,n.active=!0,u(i,n)}a(ft,"setActiveActivity");function gt(i){const e=c(i);e.activeActivityId=null,e.active=!1,u(i,e)}a(gt,"clearActiveActivity");async function vt(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:n};await(0,d.appendAction)(e,o),l.logger.debug(`close-open-cycles: ended verification ${t.activeVerificationId} (${n})`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:n};await(0,d.appendAction)(e,o),l.logger.debug(`close-open-cycles: ended fix ${t.activeFixId} (${n})`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(vt,"closeOpenCycles");async function pt(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"session_reconcile"};await n(e,o),l.logger.debug(`reconcile: ended abandoned verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"session_reconcile"};await n(e,o),l.logger.debug(`reconcile: ended abandoned fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"session_reconcile"};await n(e,o),l.logger.debug(`reconcile: ended abandoned activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(pt,"reconcileSessionState");async function yt(i,e,n){const t=c(i);if(!t.active&&!t.activeVerificationId&&!t.activeFixId&&t.verifyIntent===null||!(0,g.isParticipantPresent)(i,g.MAIN_PARTICIPANT_ID)&&(0,g.anyActiveParticipants)(i))return;let r=!1;const s=(0,d.findLastActionTimestamp)(e)??Date.now();if(t.activeVerificationId){const o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"interrupt_inferred"};await n(e,o),l.logger.debug(`interrupt-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"interrupt_inferred"};await n(e,o),l.logger.debug(`interrupt-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"interrupt_inferred"};await n(e,o),l.logger.debug(`interrupt-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(yt,"reconcileAbandonedActivity");async function It(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"compact"};await n(e,o),l.logger.debug(`compact-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"compact"};await n(e,o),l.logger.debug(`compact-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"compact"};await n(e,o),l.logger.debug(`compact-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(It,"reconcileForCompact");0&&(module.exports={addPendingFixes,clearActiveActivity,clearActiveFix,clearActiveVerification,clearPendingFixes,clearVerifyIntent,closeOpenCycles,generateTraceId,getActiveActivityId,getActiveFixId,getActiveTraceId,getActiveVerificationId,getChainedStatusLine,getContextInjectedVerificationId,getLastVerdictHadIssues,getLastVerdictStatus,getPendingFixes,getPhase,getRetries,getUsagePlan,getUsageType,getUserEmail,getVerifyIntent,incrementRetries,isActive,isFailLikeVerdictStatus,isRecordingActive,isRecordingRequired,readState,reconcileAbandonedActivity,reconcileForCompact,reconcileSessionState,resetRetries,setActive,setActiveActivity,setActiveFix,setActiveVerification,setChainedStatusLine,setContextInjectedVerificationId,setLastVerdictHadIssues,setLastVerdictStatus,setPhase,setRecordingActive,setRecordingRequired,setUsage,setUserEmail,setVerifyIntent,writeState});
1
+ "use strict";var v=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var r=(i,e)=>v(i,"name",{value:e,configurable:!0});var V=(i,e)=>{for(var n in e)v(i,n,{get:e[n],enumerable:!0})},_=(i,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of m(e))!h.call(i,a)&&a!==n&&v(i,a,{get:()=>e[a],enumerable:!(t=A(e,a))||t.enumerable});return i};var b=i=>_(v({},"__esModule",{value:!0}),i);var At={};V(At,{addPendingFixes:()=>ot,clearActiveActivity:()=>pt,clearActiveFix:()=>z,clearActiveVerification:()=>F,clearPendingFixes:()=>dt,clearVerifyIntent:()=>lt,closeOpenCycles:()=>yt,generateTraceId:()=>T,getActiveActivityId:()=>Q,getActiveFixId:()=>C,getActiveTraceId:()=>E,getActiveVerificationId:()=>w,getChainedStatusLine:()=>nt,getContextInjectedVerificationId:()=>at,getLastVerdictHadIssues:()=>U,getLastVerdictStatus:()=>$,getPendingFixes:()=>st,getPhase:()=>O,getProjectDir:()=>Z,getRetries:()=>j,getUsagePlan:()=>et,getUsageType:()=>tt,getUserEmail:()=>X,getVerifyIntent:()=>ut,incrementRetries:()=>R,isActive:()=>G,isFailLikeVerdictStatus:()=>gt,isRecordingActive:()=>M,isRecordingRequired:()=>J,readState:()=>c,reconcileAbandonedActivity:()=>St,reconcileForCompact:()=>xt,reconcileSessionState:()=>It,resetRetries:()=>L,setActive:()=>K,setActiveActivity:()=>vt,setActiveFix:()=>k,setActiveVerification:()=>P,setChainedStatusLine:()=>rt,setContextInjectedVerificationId:()=>ct,setLastVerdictHadIssues:()=>H,setLastVerdictStatus:()=>q,setPhase:()=>N,setProjectDir:()=>D,setRecordingActive:()=>W,setRecordingRequired:()=>B,setUsage:()=>it,setUserEmail:()=>Y,setVerifyIntent:()=>ft,writeState:()=>u});module.exports=b(At);var x=require("crypto"),l=require("fs"),y=require("path"),f=require("../../lib/logger"),g=require("./activity-participants"),p=require("../../lib/atomic"),d=require("./actions");const I="state.json",S={retries:0,activeVerificationId:null,activeTraceId:null,lastVerdictStatus:null,lastVerdictHadIssues:!1,activeFixId:null,activeActivityId:null,phase:null,recordingRequired:!1,recordingActive:!1,active:!1,userEmail:null,usageType:null,usagePlan:null,chainedStatusLine:null,contextInjectedVerificationId:null,pendingFixes:[],verifyIntent:null};function T(){return(0,x.randomBytes)(16).toString("hex")}r(T,"generateTraceId");function c(i){const e=(0,y.join)(i,I);if(!(0,l.existsSync)(e))return{...S};try{const n=(0,l.readFileSync)(e,"utf-8"),t=JSON.parse(n),a=["coding","verifying","fixing"],s=["api","subscription"];return{retries:typeof t.retries=="number"?t.retries:0,activeVerificationId:typeof t.activeVerificationId=="string"?t.activeVerificationId:null,activeTraceId:typeof t.activeTraceId=="string"?t.activeTraceId:null,lastVerdictStatus:typeof t.lastVerdictStatus=="string"?t.lastVerdictStatus:null,lastVerdictHadIssues:typeof t.lastVerdictHadIssues=="boolean"?t.lastVerdictHadIssues:!1,activeFixId:typeof t.activeFixId=="string"?t.activeFixId:null,activeActivityId:typeof t.activeActivityId=="string"?t.activeActivityId:null,phase:typeof t.phase=="string"&&a.includes(t.phase)?t.phase:null,recordingRequired:typeof t.recordingRequired=="boolean"?t.recordingRequired:!1,recordingActive:typeof t.recordingActive=="boolean"?t.recordingActive:!1,active:typeof t.active=="boolean"?t.active:!1,userEmail:typeof t.userEmail=="string"?t.userEmail:null,usageType:typeof t.usageType=="string"&&s.includes(t.usageType)?t.usageType:null,usagePlan:typeof t.usagePlan=="string"&&t.usagePlan.length>0?t.usagePlan:null,projectDir:typeof t.projectDir=="string"&&t.projectDir.length>0?t.projectDir:void 0,chainedStatusLine:typeof t.chainedStatusLine=="string"&&t.chainedStatusLine.length>0?t.chainedStatusLine:null,contextInjectedVerificationId:typeof t.contextInjectedVerificationId=="string"?t.contextInjectedVerificationId:null,pendingFixes:Array.isArray(t.pendingFixes)?t.pendingFixes.filter(o=>typeof o=="string"&&o.length>0):[],verifyIntent:typeof t.verifyIntent=="string"&&t.verifyIntent.length>0?t.verifyIntent:null}}catch(n){return f.logger.debug(`failed to read state from ${e}: ${n}`),{...S}}}r(c,"readState");function u(i,e){const n=(0,y.join)(i,I);try{(0,l.mkdirSync)(i,{recursive:!0});const t=`${n}.tmp.${process.pid}.${Date.now()}`,a=JSON.stringify(e,null,2);try{(0,l.writeFileSync)(t,a),(0,p.renameWithRetry)(t,n)}catch(s){try{(0,l.existsSync)(t)&&(0,l.unlinkSync)(t)}catch{}throw s}(0,p.sweepStaleTmpFiles)(n)}catch(t){f.logger.debug(`failed to write state to ${n}: ${t}`)}}r(u,"writeState");function w(i){return c(i).activeVerificationId??void 0}r(w,"getActiveVerificationId");function P(i,e,n){const t=c(i);t.activeVerificationId=e,t.activeTraceId=n,t.phase="verifying",u(i,t)}r(P,"setActiveVerification");function E(i){return c(i).activeTraceId??void 0}r(E,"getActiveTraceId");function F(i){const e=c(i);e.activeVerificationId=null,e.activeTraceId=null,e.phase="coding",u(i,e)}r(F,"clearActiveVerification");function j(i){return c(i).retries}r(j,"getRetries");function R(i){const e=c(i);return e.retries=e.retries+1,u(i,e),e.retries}r(R,"incrementRetries");function L(i){const e=c(i);e.retries=0,u(i,e)}r(L,"resetRetries");function $(i){return c(i).lastVerdictStatus??void 0}r($,"getLastVerdictStatus");function q(i,e){const n=c(i);n.lastVerdictStatus=e,u(i,n)}r(q,"setLastVerdictStatus");function U(i){return c(i).lastVerdictHadIssues===!0}r(U,"getLastVerdictHadIssues");function H(i,e){const n=c(i);n.lastVerdictHadIssues=e,u(i,n)}r(H,"setLastVerdictHadIssues");function k(i,e){const n=c(i);n.activeFixId=e,u(i,n)}r(k,"setActiveFix");function C(i){return c(i).activeFixId??void 0}r(C,"getActiveFixId");function z(i){const e=c(i);e.activeFixId=null,u(i,e)}r(z,"clearActiveFix");function N(i,e){const n=c(i);n.phase=e,u(i,n)}r(N,"setPhase");function O(i){return c(i).phase}r(O,"getPhase");function J(i){return c(i).recordingRequired}r(J,"isRecordingRequired");function B(i,e){const n=c(i);n.recordingRequired=e,u(i,n)}r(B,"setRecordingRequired");function M(i){return c(i).recordingActive}r(M,"isRecordingActive");function W(i,e){const n=c(i);n.recordingActive=e,u(i,n)}r(W,"setRecordingActive");function G(i){return c(i).active}r(G,"isActive");function K(i,e){const n=c(i);n.active=e,e||(n.activeActivityId=null),u(i,n)}r(K,"setActive");function Q(i){return c(i).activeActivityId??void 0}r(Q,"getActiveActivityId");function X(i){return c(i).userEmail??void 0}r(X,"getUserEmail");function Y(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.userEmail!==n&&(t.userEmail=n,u(i,t))}r(Y,"setUserEmail");function Z(i){const e=c(i);return typeof e.projectDir=="string"&&e.projectDir.length>0?e.projectDir:void 0}r(Z,"getProjectDir");function D(i,e){const n=typeof e=="string"&&e.length>0?e:void 0;if(n===void 0)return;const t=c(i);t.projectDir!==n&&(t.projectDir=n,u(i,t))}r(D,"setProjectDir");function tt(i){return c(i).usageType??void 0}r(tt,"getUsageType");function et(i){return c(i).usagePlan??void 0}r(et,"getUsagePlan");function it(i,e){const n=e.usage_type==="api"||e.usage_type==="subscription"?e.usage_type:null,t=typeof e.usage_plan=="string"&&e.usage_plan.length>0?e.usage_plan:null,a=c(i);a.usageType===n&&a.usagePlan===t||(a.usageType=n,a.usagePlan=t,u(i,a))}r(it,"setUsage");function nt(i){return c(i).chainedStatusLine??void 0}r(nt,"getChainedStatusLine");function rt(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.chainedStatusLine!==n&&(t.chainedStatusLine=n,u(i,t))}r(rt,"setChainedStatusLine");function at(i){return c(i).contextInjectedVerificationId??void 0}r(at,"getContextInjectedVerificationId");function ct(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.contextInjectedVerificationId!==n&&(t.contextInjectedVerificationId=n,u(i,t))}r(ct,"setContextInjectedVerificationId");function st(i){return c(i).pendingFixes}r(st,"getPendingFixes");function ot(i,e){const n=e.filter(o=>typeof o=="string"&&o.length>0);if(n.length===0)return;const t=c(i),a=new Set(t.pendingFixes),s=[...t.pendingFixes];for(const o of n)a.has(o)||(a.add(o),s.push(o));s.length!==t.pendingFixes.length&&(t.pendingFixes=s,u(i,t))}r(ot,"addPendingFixes");function dt(i){const e=c(i);e.pendingFixes.length!==0&&(e.pendingFixes=[],u(i,e))}r(dt,"clearPendingFixes");function ut(i){return c(i).verifyIntent}r(ut,"getVerifyIntent");function ft(i,e){const n=c(i);n.verifyIntent!==e&&(n.verifyIntent=e,u(i,n))}r(ft,"setVerifyIntent");function lt(i){const e=c(i);e.verifyIntent!==null&&(e.verifyIntent=null,u(i,e))}r(lt,"clearVerifyIntent");function gt(i){return i==="fail"||i==="fail_reported"}r(gt,"isFailLikeVerdictStatus");function vt(i,e){const n=c(i);n.activeActivityId=e,n.active=!0,u(i,n)}r(vt,"setActiveActivity");function pt(i){const e=c(i);e.activeActivityId=null,e.active=!1,u(i,e)}r(pt,"clearActiveActivity");async function yt(i,e,n){const t=c(i);let a=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:n};await(0,d.appendAction)(e,o),f.logger.debug(`close-open-cycles: ended verification ${t.activeVerificationId} (${n})`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,a=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:n};await(0,d.appendAction)(e,o),f.logger.debug(`close-open-cycles: ended fix ${t.activeFixId} (${n})`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),a=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,a=!0),t.phase!=="coding"&&(t.phase="coding",a=!0),t.verifyIntent!==null&&(t.verifyIntent=null,a=!0),a&&u(i,t)}r(yt,"closeOpenCycles");async function It(i,e,n){const t=c(i);let a=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"session_reconcile"};await n(e,o),f.logger.debug(`reconcile: ended abandoned verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,a=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"session_reconcile"};await n(e,o),f.logger.debug(`reconcile: ended abandoned fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),a=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"session_reconcile"};await n(e,o),f.logger.debug(`reconcile: ended abandoned activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),a=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,a=!0),t.phase!=="coding"&&(t.phase="coding",a=!0),t.verifyIntent!==null&&(t.verifyIntent=null,a=!0),a&&u(i,t)}r(It,"reconcileSessionState");async function St(i,e,n){const t=c(i);if(!t.active&&!t.activeVerificationId&&!t.activeFixId&&t.verifyIntent===null||!(0,g.isParticipantPresent)(i,g.MAIN_PARTICIPANT_ID)&&(0,g.anyActiveParticipants)(i))return;let a=!1;const s=(0,d.findLastActionTimestamp)(e)??Date.now();if(t.activeVerificationId){const o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"interrupt_inferred"};await n(e,o),f.logger.debug(`interrupt-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,a=!0}if(t.activeFixId){const o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"interrupt_inferred"};await n(e,o),f.logger.debug(`interrupt-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),a=!0}if(t.active){const o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"interrupt_inferred"};await n(e,o),f.logger.debug(`interrupt-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),a=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,a=!0),t.phase!=="coding"&&(t.phase="coding",a=!0),t.verifyIntent!==null&&(t.verifyIntent=null,a=!0),a&&u(i,t)}r(St,"reconcileAbandonedActivity");async function xt(i,e,n){const t=c(i);let a=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"compact"};await n(e,o),f.logger.debug(`compact-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,a=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"compact"};await n(e,o),f.logger.debug(`compact-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),a=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"compact"};await n(e,o),f.logger.debug(`compact-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),a=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,a=!0),t.phase!=="coding"&&(t.phase="coding",a=!0),t.verifyIntent!==null&&(t.verifyIntent=null,a=!0),a&&u(i,t)}r(xt,"reconcileForCompact");0&&(module.exports={addPendingFixes,clearActiveActivity,clearActiveFix,clearActiveVerification,clearPendingFixes,clearVerifyIntent,closeOpenCycles,generateTraceId,getActiveActivityId,getActiveFixId,getActiveTraceId,getActiveVerificationId,getChainedStatusLine,getContextInjectedVerificationId,getLastVerdictHadIssues,getLastVerdictStatus,getPendingFixes,getPhase,getProjectDir,getRetries,getUsagePlan,getUsageType,getUserEmail,getVerifyIntent,incrementRetries,isActive,isFailLikeVerdictStatus,isRecordingActive,isRecordingRequired,readState,reconcileAbandonedActivity,reconcileForCompact,reconcileSessionState,resetRetries,setActive,setActiveActivity,setActiveFix,setActiveVerification,setChainedStatusLine,setContextInjectedVerificationId,setLastVerdictHadIssues,setLastVerdictStatus,setPhase,setProjectDir,setRecordingActive,setRecordingRequired,setUsage,setUserEmail,setVerifyIntent,writeState});
@@ -1,16 +1,20 @@
1
- "use strict";var y=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var g=(t,n)=>y(t,"name",{value:n,configurable:!0});var U=(t,n)=>{for(var i in n)y(t,i,{get:n[i],enumerable:!0})},W=(t,n,i,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let e of M(n))!H.call(t,e)&&e!==i&&y(t,e,{get:()=>n[e],enumerable:!(r=L(n,e))||r.enumerable});return t};var z=t=>W(y({},"__esModule",{value:!0}),t);var tt={};U(tt,{VERIFICATION_DOC_DIR:()=>b,VERIFICATION_DOC_FILE:()=>v,buildVerificationContext:()=>N,buildVerificationContextForSession:()=>j,buildVerificationContextOnceForCycle:()=>Z,collectChangedPaths:()=>A,renderChangedPathsBlock:()=>T,resolveContextFiles:()=>P});module.exports=z(tt);var D=require("fs"),o=require("path"),f=require("../../lib/config"),S=require("../../lib/git"),h=require("../../lib/logger"),O=require("./session-state"),w=require("./actions");const b=".ironbee",v="VERIFICATION.md",G=`===== IRONBEE \u2014 PROJECT VERIFICATION INSTRUCTIONS (path-scoped) =====
2
- `,J=`The following areas changed this cycle. Follow this guidance IN ADDITION to the standard verification flow.
3
- `,k=`====================================================================
4
- `;function C(t){return Buffer.byteLength(t,"utf-8")}g(C,"byteLen");function q(t){try{return(0,D.realpathSync)(t)}catch{return(0,o.resolve)(t)}}g(q,"canonicalDir");function K(t){const n=(0,o.resolve)(t),i=[];let r=n;for(;;)try{const e=(0,D.realpathSync)(r);return i.length>0?(0,o.join)(e,...i):e}catch{const e=(0,o.dirname)(r);if(e===r)return n;i.unshift((0,o.basename)(r)),r=e}}g(K,"canonicalizePath");function Q(t,n){const i=(0,o.relative)(t,n);return i.length>0&&!i.startsWith("..")&&!(0,o.isAbsolute)(i)}g(Q,"isUnderDir");function F(t){try{return(0,w.getFileChangesSinceLastVerification)(t).map(n=>n.file_path).filter(n=>typeof n=="string"&&n.length>0)}catch(n){return h.logger.debug(`verification-context: actions fallback failed: ${n instanceof Error?n.message:n}`),[]}}g(F,"changedFromActions");function A(t,n,i){let r;if(i.source==="actions")r=F(n);else{const s=(0,S.getChangedPaths)(t,i.commitDepth);r=s===null?F(n):s}const e=new Set;for(const s of r){const l=K((0,o.isAbsolute)(s)?s:(0,o.resolve)(t,s)),c=(0,o.relative)(t,l);c.length===0||c.startsWith("..")||(0,o.isAbsolute)(c)||c.split(o.sep).includes(b)||e.add(l)}return[...e]}g(A,"collectChangedPaths");function P(t,n){const i=new Map;for(const r of n){let e=(0,o.dirname)(r);if(!(e!==t&&!Q(t,e)))for(;;){const s=(0,o.join)(e,b,v);if(!i.has(s)&&(0,D.existsSync)(s))try{const c=(0,D.readFileSync)(s,"utf-8"),m=(0,o.relative)(t,e),d=m.length===0?"":m.split(o.sep).join("/"),u=d.length===0?0:d.split("/").length;i.set(s,{absPath:s,relDir:d,depth:u,content:c})}catch(c){h.logger.debug(`verification-context: failed to read ${s}: ${c instanceof Error?c.message:c}`)}if(e===t)break;const l=(0,o.dirname)(e);if(l===e)break;e=l}}return[...i.values()].sort((r,e)=>r.depth-e.depth||r.relDir.localeCompare(e.relDir))}g(P,"resolveContextFiles");function X(t){return t.relDir.length===0?{label:"(repo root)",path:`${b}/${v}`}:{label:`${t.relDir}/`,path:`${t.relDir}/${b}/${v}`}}g(X,"provenance");function E(t){const n=X(t);return`
5
- ## ${n.label} \u2014 ${n.path}
1
+ "use strict";var y=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var l=(t,e)=>y(t,"name",{value:e,configurable:!0});var Y=(t,e)=>{for(var r in e)y(t,r,{get:e[r],enumerable:!0})},Z=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of K(e))!Q.call(t,n)&&n!==r&&y(t,n,{get:()=>e[n],enumerable:!(i=q(e,n))||i.enumerable});return t};var tt=t=>Z(y({},"__esModule",{value:!0}),t);var at={};Y(at,{VERIFICATION_DOC_DIR:()=>x,VERIFICATION_DOC_FILE:()=>I,buildVerificationContext:()=>H,buildVerificationContextForSession:()=>U,buildVerificationContextOnceForCycle:()=>lt,collectChangedPaths:()=>_,renderChangedPathsBlock:()=>L,renderMessageBlock:()=>G,resolveContextFiles:()=>j,resolveVerificationMessage:()=>W});module.exports=tt(at);var b=require("fs"),w=require("os"),s=require("path"),P=require("../../lib/runtime-paths"),u=require("../../lib/config"),N=require("../../lib/git"),m=require("../../lib/logger"),E=require("./session-state"),M=require("./actions");const x=".ironbee",I="VERIFICATION.md",nt=`===== IRONBEE \u2014 PROJECT VERIFICATION INSTRUCTIONS (path-scoped) =====
2
+ `,et=`The following areas changed this cycle. Follow this guidance IN ADDITION to the standard verification flow.
3
+ `,S=`====================================================================
4
+ `,rt=`===== IRONBEE \u2014 PROJECT VERIFICATION INSTRUCTIONS (always-on) =====
5
+ `,O=64*1024;function $(t){return Buffer.byteLength(t,"utf-8")}l($,"byteLen");function it(t){try{return(0,b.realpathSync)(t)}catch{return(0,s.resolve)(t)}}l(it,"canonicalDir");function st(t){const e=(0,s.resolve)(t),r=[];let i=e;for(;;)try{const n=(0,b.realpathSync)(i);return r.length>0?(0,s.join)(n,...r):n}catch{const n=(0,s.dirname)(i);if(n===i)return e;r.unshift((0,s.basename)(i)),i=n}}l(st,"canonicalizePath");function ot(t,e){const r=(0,s.relative)(t,e);return r.length>0&&!r.startsWith("..")&&!(0,s.isAbsolute)(r)}l(ot,"isUnderDir");function T(t){try{return(0,M.getFileChangesSinceLastVerification)(t).map(e=>e.file_path).filter(e=>typeof e=="string"&&e.length>0)}catch(e){return m.logger.debug(`verification-context: actions fallback failed: ${e instanceof Error?e.message:e}`),[]}}l(T,"changedFromActions");function _(t,e,r){let i;if(r.source==="actions")i=T(e);else{const o=(0,N.getChangedPaths)(t,r.commitDepth);i=o===null?T(e):o}const n=new Set;for(const o of i){const g=st((0,s.isAbsolute)(o)?o:(0,s.resolve)(t,o)),c=(0,s.relative)(t,g);c.length===0||c.startsWith("..")||(0,s.isAbsolute)(c)||c.split(s.sep).includes(x)||n.add(g)}return[...n]}l(_,"collectChangedPaths");function j(t,e){const r=new Map;for(const i of e){let n=(0,s.dirname)(i);if(!(n!==t&&!ot(t,n)))for(;;){const o=(0,s.join)(n,x,I);if(!r.has(o)&&(0,b.existsSync)(o))try{const c=(0,b.readFileSync)(o,"utf-8"),f=(0,s.relative)(t,n),h=f.length===0?"":f.split(s.sep).join("/"),d=h.length===0?0:h.split("/").length;r.set(o,{absPath:o,relDir:h,depth:d,content:c})}catch(c){m.logger.debug(`verification-context: failed to read ${o}: ${c instanceof Error?c.message:c}`)}if(n===t)break;const g=(0,s.dirname)(n);if(g===n)break;n=g}}return[...r.values()].sort((i,n)=>i.depth-n.depth||i.relDir.localeCompare(n.relDir))}l(j,"resolveContextFiles");function ct(t){return t.relDir.length===0?{label:"(repo root)",path:`${x}/${I}`}:{label:`${t.relDir}/`,path:`${t.relDir}/${x}/${I}`}}l(ct,"provenance");function V(t){const e=ct(t);return`
6
+ ## ${e.label} \u2014 ${e.path}
6
7
  ${t.content.trimEnd()}
7
- `}g(E,"renderBlock");const V=100;function T(t,n){if(n.length===0)return"";const i=n.map(s=>(0,o.relative)(t,s).split(o.sep).join("/")).sort(),r=i.slice(0,V),e=i.length>V?`
8
- - \u2026 +${i.length-V} more`:"";return`
9
- ## Changed files this cycle (${i.length})
10
- ${r.map(s=>`- ${s}`).join(`
11
- `)}${e}
12
- `}g(T,"renderChangedPathsBlock");function N(t,n){const i=n.changedPathsBlock??"";if(t.length===0&&i.length===0)return"";const r=[...t].sort((a,$)=>a.depth-$.depth||a.relDir.localeCompare($.relDir)),e=G+J+i,s=Math.max(0,n.maxBytes-C(e)-C(k)),l=[];let c=0;for(let a=r.length-1;a>=0;a--){const $=E(r[a]),x=C($);if(c+x<=s)l.push(r[a]),c+=x;else if(l.length===0){const I=Y(r[a],s);l.push(I);break}else break}const m=l.reverse(),d=r.length-m.length,u=[e];for(const a of m)u.push(E(a));return d>0&&u.push(`
13
- [${d} less-specific VERIFICATION.md file(s) omitted to fit the ${n.maxBytes}-byte cap]
14
- `),u.push(k),u.join("")}g(N,"buildVerificationContext");function Y(t,n){const i=`
15
- ... (truncated)`,r=E({...t,content:""}),e=Math.max(0,n-C(r)-C(i)),s=Buffer.from(t.content,"utf-8").subarray(0,e).toString("utf-8");return{...t,content:s+i}}g(Y,"hardTruncate");function j(t,n,i){if(!(0,f.getVerificationContextEnabled)(i))return"";try{const r=q(t),e=(0,o.join)(r,".ironbee","sessions",n,"actions.jsonl"),s=(0,f.getVerificationContextSource)(i),l=A(r,e,{source:s,commitDepth:(0,f.getVerificationContextCommitDepth)(i)}),c=l.filter(p=>!(0,f.isIgnoredVerifyPath)(i,p)),m=l.length-c.length,d=new Set;for(const p of c){const R=(0,o.relative)(r,(0,o.dirname)(p)).split(o.sep).join("/");d.add(R.length===0?"(root)":R)}const u=[...d].sort(),a=50,$=u.slice(0,a),x=u.length>a?` [+${u.length-a} more]`:"";h.logger.debug(`verification-context: source=${s} changed in ${u.length} dir(s)`+(m>0?` (${m} ignored)`:"")+`: ${$.join(", ")}${x}`);const I=P(r,c);for(const p of I){const R=p.relDir.length>0?`${p.relDir}/${b}/${v}`:`${b}/${v}`,B=p.content.replace(/\s+/g," ").trim(),_=B.length>100?`${B.slice(0,100)}...`:B;h.logger.debug(`verification-context: \u2022 ${R} \u2014 ${C(p.content)} bytes :: ${_}`)}return N(I,{maxBytes:(0,f.getVerificationContextMaxBytes)(i),changedPathsBlock:T(r,c)})}catch(r){return h.logger.debug(`verification-context: build failed: ${r instanceof Error?r.message:r}`),""}}g(j,"buildVerificationContextForSession");function Z(t){const{projectDir:n,sessionId:i,sessionDir:r,activeVerificationId:e,config:s}=t;if(!e||!(0,f.getVerificationContextEnabled)(s)||(0,O.getContextInjectedVerificationId)(r)===e)return"";let l="";try{l=j(n,i,s)}catch(c){h.logger.debug(`verification-context: once-for-cycle build failed: ${c instanceof Error?c.message:c}`),l=""}if(l.length>0){const c=l.split(`
16
- ## `).length-1;h.logger.debug(`verification-context: injected ${Buffer.byteLength(l,"utf-8")} bytes, ${c} area(s) for cycle ${e}`)}else h.logger.debug(`verification-context: nothing to inject (no changed paths) for cycle ${e}`);return(0,O.setContextInjectedVerificationId)(r,e),l}g(Z,"buildVerificationContextOnceForCycle");0&&(module.exports={VERIFICATION_DOC_DIR,VERIFICATION_DOC_FILE,buildVerificationContext,buildVerificationContextForSession,buildVerificationContextOnceForCycle,collectChangedPaths,renderChangedPathsBlock,resolveContextFiles});
8
+ `}l(V,"renderBlock");const F=100;function L(t,e){if(e.length===0)return"";const r=e.map(o=>(0,s.relative)(t,o).split(s.sep).join("/")).sort(),i=r.slice(0,F),n=r.length>F?`
9
+ - \u2026 +${r.length-F} more`:"";return`
10
+ ## Changed files this cycle (${r.length})
11
+ ${i.map(o=>`- ${o}`).join(`
12
+ `)}${n}
13
+ `}l(L,"renderChangedPathsBlock");function W(t,e){const r=t.trim();if(r.length===0)return"";const i="file:";if(!r.startsWith(i))return r;let n=r.slice(i.length).trim();if(n.length===0)return"";(n==="~"||n.startsWith("~/")||n.startsWith("~\\"))&&(n=(0,s.join)((0,w.homedir)(),n.slice(1).replace(/^[/\\]+/,"")));const o=(0,s.isAbsolute)(n)?n:(0,s.resolve)(e,n);try{const g=(0,b.readFileSync)(o,"utf-8"),c=Buffer.from(g,"utf-8");if(c.length>O){let f=O;for(;f>0&&(c[f]&192)===128;)f--;return`${c.subarray(0,f).toString("utf-8")}
14
+ ... (truncated, message file exceeds ${O} bytes)
15
+ `}return g.trimEnd()}catch(g){return m.logger.debug(`verification-context: failed to read message file ${o}: ${g instanceof Error?g.message:g}`),""}}l(W,"resolveVerificationMessage");function G(t){return`${rt}${t.trimEnd()}
16
+ ${S}`}l(G,"renderMessageBlock");function H(t,e){const r=e.changedPathsBlock??"";if(t.length===0&&r.length===0)return"";const i=[...t].sort((a,D)=>a.depth-D.depth||a.relDir.localeCompare(D.relDir)),n=nt+et+r,o=Math.max(0,e.maxBytes-$(n)-$(S)),g=[];let c=0;for(let a=i.length-1;a>=0;a--){const D=V(i[a]),C=$(D);if(c+C<=o)g.push(i[a]),c+=C;else if(g.length===0){const v=gt(i[a],o);g.push(v);break}else break}const f=g.reverse(),h=i.length-f.length,d=[n];for(const a of f)d.push(V(a));return h>0&&d.push(`
17
+ [${h} less-specific VERIFICATION.md file(s) omitted to fit the ${e.maxBytes}-byte cap]
18
+ `),d.push(S),d.join("")}l(H,"buildVerificationContext");function gt(t,e){const r=`
19
+ ... (truncated)`,i=V({...t,content:""}),n=Math.max(0,e-$(i)-$(r)),o=Buffer.from(t.content,"utf-8").subarray(0,n).toString("utf-8");return{...t,content:o+r}}l(gt,"hardTruncate");function U(t,e,r){if(!(0,u.getVerificationContextEnabled)(r))return"";try{const i=it(t),n=(0,s.join)((0,P.sessionDir)(i,e),"actions.jsonl"),o=(0,u.getVerificationContextSource)(r),g=_(i,n,{source:o,commitDepth:(0,u.getVerificationContextCommitDepth)(r)}),c=g.filter(p=>!(0,u.isIgnoredVerifyPath)(r,p)),f=g.length-c.length,h=new Set;for(const p of c){const R=(0,s.relative)(i,(0,s.dirname)(p)).split(s.sep).join("/");h.add(R.length===0?"(root)":R)}const d=[...h].sort(),a=50,D=d.slice(0,a),C=d.length>a?` [+${d.length-a} more]`:"";m.logger.debug(`verification-context: source=${o} changed in ${d.length} dir(s)`+(f>0?` (${f} ignored)`:"")+`: ${D.join(", ")}${C}`);const v=j(i,c);for(const p of v){const R=p.relDir.length>0?`${p.relDir}/${x}/${I}`:`${x}/${I}`,B=p.content.replace(/\s+/g," ").trim(),X=B.length>100?`${B.slice(0,100)}...`:B;m.logger.debug(`verification-context: \u2022 ${R} \u2014 ${$(p.content)} bytes :: ${X}`)}const k=W((0,u.getVerificationContextMessage)(r),i),A=k.length>0?G(k):"",J=Math.max(0,(0,u.getVerificationContextMaxBytes)(r)-$(A)),z=H(v,{maxBytes:J,changedPathsBlock:L(i,c)});return A+z}catch(i){return m.logger.debug(`verification-context: build failed: ${i instanceof Error?i.message:i}`),""}}l(U,"buildVerificationContextForSession");function lt(t){const{projectDir:e,sessionId:r,sessionDir:i,activeVerificationId:n,config:o}=t;if(!n||!(0,u.getVerificationContextEnabled)(o)||(0,E.getContextInjectedVerificationId)(i)===n)return"";let g="";try{g=U(e,r,o)}catch(c){m.logger.debug(`verification-context: once-for-cycle build failed: ${c instanceof Error?c.message:c}`),g=""}if(g.length>0){const c=g.split(`
20
+ ## `).length-1;m.logger.debug(`verification-context: injected ${Buffer.byteLength(g,"utf-8")} bytes, ${c} section(s) for cycle ${n}`)}else m.logger.debug(`verification-context: nothing to inject (no message, no changed paths) for cycle ${n}`);return(0,E.setContextInjectedVerificationId)(i,n),g}l(lt,"buildVerificationContextOnceForCycle");0&&(module.exports={VERIFICATION_DOC_DIR,VERIFICATION_DOC_FILE,buildVerificationContext,buildVerificationContextForSession,buildVerificationContextOnceForCycle,collectChangedPaths,renderChangedPathsBlock,renderMessageBlock,resolveContextFiles,resolveVerificationMessage});
@@ -1,9 +1,9 @@
1
- "use strict";var T=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var u=(e,t)=>T(e,"name",{value:t,configurable:!0});var W=(e,t)=>{for(var i in t)T(e,i,{get:t[i],enumerable:!0})},X=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!K.call(e,s)&&s!==i&&T(e,s,{get:()=>t[s],enumerable:!(o=Q(t,s))||o.enumerable});return e};var Z=e=>X(T({},"__esModule",{value:!0}),e);var ge={};W(ge,{runVerifyGate:()=>fe});module.exports=Z(ge);var b=require("fs"),d=require("../../lib/logger"),V=require("../../lib/telemetry"),h=require("./actions"),r=require("./session-state"),B=require("./activity-participants"),p=require("../../lib/config"),M=require("./required-tools");const ee=3,te=1;function ie(e){const t=p.CYCLE_TO_SERVER[e];if(t===void 0)throw new Error(`No MCP server registered for cycle '${e}'.`);return t}u(ie,"mcpServerForCycle");function _(e){return JSON.stringify({session_id:e,status:"pass",checks:["form submits successfully","new item appears in list","no console errors"]})}u(_,"verdictExamplePass");function q(e){return JSON.stringify({session_id:e,status:"fail",checks:["form renders","submit button unresponsive"],issues:["button click handler not firing","TypeError in console"]})}u(q,"verdictExampleFail");function k(...e){for(const t of e)try{(0,b.existsSync)(t)&&(0,b.unlinkSync)(t)}catch(i){d.logger.debug(`failed to cleanup ${t}: ${i}`)}}u(k,"cleanup");function oe(e){if(!(0,b.existsSync)(e))return null;try{return JSON.parse((0,b.readFileSync)(e,"utf-8"))}catch{return null}}u(oe,"readVerdictQuietly");function re(e,t){const i=(0,h.getFileChangesSinceLastVerification)(e),o=new Set;for(const f of i)for(const a of(0,p.getActiveCycles)(f.file_path,t))o.add(a);const s=[];o.has("browser")&&s.push("browser");for(const f of p.OPTIONAL_CYCLES)o.has(f)&&s.push(f);return s}u(re,"computeActiveCycles");function ne(e,t,i){const o=ie(e),s=new Set(t.filter(a=>a.tool_type==="mcp"&&a.mcp_server===o).map(a=>a.tool_name)),f=(0,p.getRequiredToolsConfig)(i,e);return{cycle:e,result:(0,M.satisfyRequiredTools)(s,f),config:f,usedCount:s.size}}u(ne,"checkCycleTools");function se(e){return{cycle:"browser",valid:!0,passCriteriaMet:!0}}u(se,"checkBrowserEvidence");function ae(e){return{cycle:"node",valid:!0,passCriteriaMet:!0}}u(ae,"checkNodeEvidence");function ce(e){return{cycle:"backend",valid:!0,passCriteriaMet:!0}}u(ce,"checkBackendEvidence");function le(e){return{cycle:"android",valid:!0,passCriteriaMet:!0}}u(le,"checkAndroidEvidence");function de(e,t){if(!Array.isArray(t.checks)||t.checks.length===0)return{cycle:e,valid:!1,reason:"missing checks"};if(e==="browser")return se(t);if(e==="node")return ae(t);if(e==="backend")return ce(t);if(e==="android")return le(t);throw new Error(`No evidence checker registered for cycle '${e}'.`)}u(de,"checkCycleEvidence");function ue(e){const t=e.cycle.charAt(0).toUpperCase()+e.cycle.slice(1);if(e.result.missing.length===0)return`${t} cycle: ok.`;const i=e.result.missing.map(o=>` - ${o}`).join(`
1
+ "use strict";var A=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var d=(e,t)=>A(e,"name",{value:t,configurable:!0});var W=(e,t)=>{for(var i in t)A(e,i,{get:t[i],enumerable:!0})},X=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!K.call(e,s)&&s!==i&&A(e,s,{get:()=>t[s],enumerable:!(r=Q(t,s))||r.enumerable});return e};var Z=e=>X(A({},"__esModule",{value:!0}),e);var he={};W(he,{runVerifyGate:()=>ge});module.exports=Z(he);var b=require("fs"),u=require("../../lib/logger"),V=require("../../lib/telemetry"),h=require("./actions"),o=require("./session-state"),M=require("./activity-participants"),p=require("../../lib/config"),B=require("./required-tools");const ee=3,te=1;function ie(e){const t=p.CYCLE_TO_SERVER[e];if(t===void 0)throw new Error(`No MCP server registered for cycle '${e}'.`);return t}d(ie,"mcpServerForCycle");function _(e){return JSON.stringify({session_id:e,status:"pass",checks:["form submits successfully","new item appears in list","no console errors"]})}d(_,"verdictExamplePass");function q(e){return JSON.stringify({session_id:e,status:"fail",checks:["form renders","submit button unresponsive"],issues:["button click handler not firing","TypeError in console"]})}d(q,"verdictExampleFail");function k(...e){for(const t of e)try{(0,b.existsSync)(t)&&(0,b.unlinkSync)(t)}catch(i){u.logger.debug(`failed to cleanup ${t}: ${i}`)}}d(k,"cleanup");function re(e){if(!(0,b.existsSync)(e))return null;try{return JSON.parse((0,b.readFileSync)(e,"utf-8"))}catch{return null}}d(re,"readVerdictQuietly");function oe(e,t){const i=(0,h.getFileChangesSinceLastVerification)(e),r=new Set;for(const f of i)for(const a of(0,p.getActiveCycles)(f.file_path,t))r.add(a);const s=[];r.has("browser")&&s.push("browser");for(const f of p.OPTIONAL_CYCLES)r.has(f)&&s.push(f);return s}d(oe,"computeActiveCycles");function ne(e,t,i){const r=ie(e),s=new Set(t.filter(a=>a.tool_type==="mcp"&&a.mcp_server===r).map(a=>a.tool_name)),f=(0,p.getRequiredToolsConfig)(i,e);return{cycle:e,result:(0,B.satisfyRequiredTools)(s,f),config:f,usedCount:s.size}}d(ne,"checkCycleTools");function se(e){return{cycle:"browser",valid:!0,passCriteriaMet:!0}}d(se,"checkBrowserEvidence");function ae(e){return{cycle:"node",valid:!0,passCriteriaMet:!0}}d(ae,"checkNodeEvidence");function ce(e){return{cycle:"backend",valid:!0,passCriteriaMet:!0}}d(ce,"checkBackendEvidence");function le(e){return{cycle:"android",valid:!0,passCriteriaMet:!0}}d(le,"checkAndroidEvidence");function de(e){return{cycle:"terminal",valid:!0,passCriteriaMet:!0}}d(de,"checkTerminalEvidence");function ue(e,t){if(!Array.isArray(t.checks)||t.checks.length===0)return{cycle:e,valid:!1,reason:"missing checks"};if(e==="browser")return se(t);if(e==="node")return ae(t);if(e==="backend")return ce(t);if(e==="android")return le(t);if(e==="terminal")return de(t);throw new Error(`No evidence checker registered for cycle '${e}'.`)}d(ue,"checkCycleEvidence");function fe(e){const t=e.cycle.charAt(0).toUpperCase()+e.cycle.slice(1);if(e.result.missing.length===0)return`${t} cycle: ok.`;const i=e.result.missing.map(r=>` - ${r}`).join(`
2
2
  `);return e.config.evidencePaths.length>0&&e.result.pathName!==void 0?`${t} cycle: incomplete (closest path "${e.result.pathName}", tried [${e.result.triedPaths.join(", ")}]):
3
3
  ${i}`:`${t} cycle: missing required tools:
4
- ${i}`}u(ue,"describeMissingTools");async function fe(e){const{sessionId:t,sessionDir:i,actionsFile:o,verdictFile:s,maxRetries:f}=e,a=f??ee,C=e.config??(0,p.loadConfig)(e.projectDir);if(d.logger.debug(`verify-gate: session=${t} verdictExists=${(0,b.existsSync)(s)}`),(0,B.anyNonMainParticipants)(i)&&((0,r.getActiveVerificationId)(i)!==void 0||!(0,b.existsSync)(s)))return d.logger.debug("verifier sub-agent still running \u2014 allowing the main Stop, deferring activity close to the verifier (silent): verifier_running"),{action:"allow",reason:"verifier_running",message:"Verification is still running (delegated to the ironbee-verifier sub-agent). It continues in the background; you'll be re-invoked with its verdict when it finishes \u2014 do NOT claim completion yet, and do NOT spawn another verifier. A PASS completes the work; a FAIL means fix the reported issues and re-verify."};if(!(0,h.hasFileChangesSinceLastVerification)(o)){if((0,r.getLastVerdictStatus)(i)==="fail"){if((0,r.getVerifyIntent)(i)!=="fix")return d.logger.debug("fail verdict with no code changes in window \u2014 status report, allowing"),(0,r.setLastVerdictStatus)(i,"fail_reported"),await l(o,i,t,"allow","fail_verdict_reported",[],e.projectDir),{action:"allow"};const n=(0,r.incrementRetries)(i);return n>=a?(d.logger.debug(`fix intent declared but retries exhausted (${n}/${a}) \u2014 releasing`),(0,r.resetRetries)(i),await(0,r.closeOpenCycles)(i,o,"max_retries_exceeded"),await l(o,i,t,"allow","max_retries_exceeded",[],e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${a} TIMES. Allowing completion.
4
+ ${i}`}d(fe,"describeMissingTools");async function ge(e){const{sessionId:t,sessionDir:i,actionsFile:r,verdictFile:s,maxRetries:f}=e,a=f??ee,C=e.config??(0,p.loadConfig)(e.projectDir);if(u.logger.debug(`verify-gate: session=${t} verdictExists=${(0,b.existsSync)(s)}`),(0,M.anyNonMainParticipants)(i)&&((0,o.getActiveVerificationId)(i)!==void 0||!(0,b.existsSync)(s)))return u.logger.debug("verifier sub-agent still running \u2014 allowing the main Stop, deferring activity close to the verifier (silent): verifier_running"),{action:"allow",reason:"verifier_running",message:"Verification is still running (delegated to the ironbee-verifier sub-agent). It continues in the background; you'll be re-invoked with its verdict when it finishes \u2014 do NOT claim completion yet, and do NOT spawn another verifier. A PASS completes the work; a FAIL means fix the reported issues and re-verify."};if(!(0,h.hasFileChangesSinceLastVerification)(r)){if((0,o.getLastVerdictStatus)(i)==="fail"){if((0,o.getVerifyIntent)(i)!=="fix")return u.logger.debug("fail verdict with no code changes in window \u2014 status report, allowing"),(0,o.setLastVerdictStatus)(i,"fail_reported"),await l(r,i,t,"allow","fail_verdict_reported",[],e.projectDir),{action:"allow"};const n=(0,o.incrementRetries)(i);return n>=a?(u.logger.debug(`fix intent declared but retries exhausted (${n}/${a}) \u2014 releasing`),(0,o.resetRetries)(i),await(0,o.closeOpenCycles)(i,r,"max_retries_exceeded"),await l(r,i,t,"allow","max_retries_exceeded",[],e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${a} TIMES. Allowing completion.
5
5
 
6
- The fail verdict was never resolved. Report the unresolved issues in your final response.`}):(d.logger.debug(`fix intent declared, fail verdict not addressed \u2014 blocking (unaddressed, attempt ${n}/${a})`),await l(o,i,t,"block","fail_verdict_unaddressed",[],e.projectDir),{action:"block",message:`VERIFICATION FAILED \u2014 unaddressed (attempt ${n}/${a}).
6
+ The fail verdict was never resolved. Report the unresolved issues in your final response.`}):(u.logger.debug(`fix intent declared, fail verdict not addressed \u2014 blocking (unaddressed, attempt ${n}/${a})`),await l(r,i,t,"block","fail_verdict_unaddressed",[],e.projectDir),{action:"block",message:`VERIFICATION FAILED \u2014 unaddressed (attempt ${n}/${a}).
7
7
 
8
8
  You submitted a fail verdict but did not address the reported issues. Either:
9
9
 
@@ -13,16 +13,16 @@ You submitted a fail verdict but did not address the reported issues. Either:
13
13
 
14
14
  2. Or \u2014 if the issues genuinely cannot be fixed \u2014 re-verify (keep the --intent fix flag)
15
15
  to confirm the failure: each blocked stop counts toward maxRetries; once exhausted,
16
- the gate will allow completion with the issues reported.`})}return d.logger.debug("no code changes detected, allowing completion"),await l(o,i,t,"allow","no_edits",[],e.projectDir),{action:"allow"}}const c=re(o,C);if(c.length===0)return d.logger.debug("file changes match no cycle pattern, allowing completion"),await l(o,i,t,"allow","no_cycle_active",[],e.projectDir),{action:"allow"};const S=(0,p.getVerificationStrict)(C),U=(0,r.isFailLikeVerdictStatus)((0,r.getLastVerdictStatus)(i)),y=oe(s),x=!S&&!U&&y!==null&&Array.isArray(y.reason)&&y.reason.length>0;if(x&&y.status==="not_applicable")return d.logger.debug("global N/A verdict, allowing completion"),(0,r.resetRetries)(i),(0,r.setLastVerdictStatus)(i,"not_applicable"),await l(o,i,t,"allow","verdict_not_applicable",c,e.projectDir),{action:"allow"};let v=c;if(x&&Array.isArray(y.not_applicable_cycles)&&y.not_applicable_cycles.length>0){const n=new Set(y.not_applicable_cycles.filter(g=>c.includes(g)));if(v=c.filter(g=>!n.has(g)),v.length===0)return d.logger.debug("per-platform N/A exempted every active cycle \u2014 treating as global N/A"),(0,r.resetRetries)(i),(0,r.setLastVerdictStatus)(i,"not_applicable"),await l(o,i,t,"allow","verdict_not_applicable",c,e.projectDir),{action:"allow"};d.logger.debug(`per-platform N/A: exempt=[${[...n].join(",")}] enforced=[${v.join(",")}]`)}const J=(0,h.getToolCallsSinceLastFileChange)(o),N=v.map(n=>ne(n,J,C)),D=N.filter(n=>!n.result.satisfied);if(D.length>0){const n=N.every(m=>m.usedCount===0),g=(0,r.incrementRetries)(i),$=!(0,h.hasVerifierEverEngaged)(o),G=$&&g>te,Y=g>=a;if(G||Y){const m=$?"verifier_unavailable":"max_retries_exceeded";d.logger.debug(`tool-presence loop releasing (attempt ${g}/${a}, neverEngaged=${$}) \u2014 ${m}`),(0,r.resetRetries)(i),await(0,r.closeOpenCycles)(i,o,m),await l(o,i,t,"allow",m,c,e.projectDir);const A=c.join(", ");return $?{action:"allow",message:`VERIFICATION UNAVAILABLE \u2014 allowing completion.
16
+ the gate will allow completion with the issues reported.`})}return u.logger.debug("no code changes detected, allowing completion"),await l(r,i,t,"allow","no_edits",[],e.projectDir),{action:"allow"}}const c=oe(r,C);if(c.length===0)return u.logger.debug("file changes match no cycle pattern, allowing completion"),await l(r,i,t,"allow","no_cycle_active",[],e.projectDir),{action:"allow"};const x=(0,p.getVerificationStrict)(C),U=(0,o.isFailLikeVerdictStatus)((0,o.getLastVerdictStatus)(i)),y=re(s),N=!x&&!U&&y!==null&&Array.isArray(y.reason)&&y.reason.length>0;if(N&&y.status==="not_applicable")return u.logger.debug("global N/A verdict, allowing completion"),(0,o.resetRetries)(i),(0,o.setLastVerdictStatus)(i,"not_applicable"),await l(r,i,t,"allow","verdict_not_applicable",c,e.projectDir),{action:"allow"};let v=c;if(N&&Array.isArray(y.not_applicable_cycles)&&y.not_applicable_cycles.length>0){const n=new Set(y.not_applicable_cycles.filter(g=>c.includes(g)));if(v=c.filter(g=>!n.has(g)),v.length===0)return u.logger.debug("per-platform N/A exempted every active cycle \u2014 treating as global N/A"),(0,o.resetRetries)(i),(0,o.setLastVerdictStatus)(i,"not_applicable"),await l(r,i,t,"allow","verdict_not_applicable",c,e.projectDir),{action:"allow"};u.logger.debug(`per-platform N/A: exempt=[${[...n].join(",")}] enforced=[${v.join(",")}]`)}const J=(0,h.getToolCallsSinceLastFileChange)(r),S=v.map(n=>ne(n,J,C)),D=S.filter(n=>!n.result.satisfied);if(D.length>0){const n=S.every(m=>m.usedCount===0),g=(0,o.incrementRetries)(i),$=!(0,h.hasVerifierEverEngaged)(r),G=$&&g>te,H=g>=a;if(G||H){const m=$?"verifier_unavailable":"max_retries_exceeded";u.logger.debug(`tool-presence loop releasing (attempt ${g}/${a}, neverEngaged=${$}) \u2014 ${m}`),(0,o.resetRetries)(i),await(0,o.closeOpenCycles)(i,r,m),await l(r,i,t,"allow",m,c,e.projectDir);const T=c.join(", ");return $?{action:"allow",message:`VERIFICATION UNAVAILABLE \u2014 allowing completion.
17
17
 
18
- The ${A} verification cycle could not run this session: no verification was ever started and no verification tool was recorded across the whole session. This points to an environment/setup problem rather than a skipped step. Check:
18
+ The ${T} verification cycle could not run this session: no verification was ever started and no verification tool was recorded across the whole session. This points to an environment/setup problem rather than a skipped step. Check:
19
19
  - the devtools MCP server is installed and loads (try \`npx -y @ironbee-ai/devtools\`);
20
20
  - on Codex: the verifier sub-agent's model resolves (set \`verification.model\` or a config.toml model) and hooks are approved (\`/hooks\`);
21
21
  - the verification delegation actually spawns the ironbee-verifier sub-agent.
22
22
 
23
23
  Report this change as UNVERIFIED in your final response.`}:{action:"allow",message:`VERIFICATION NOT COMPLETED after ${a} attempts. Allowing completion.
24
24
 
25
- The ${A} verification cycle was attempted but its required tools were not all completed within ${a} attempts. If the change has no runtime surface to verify (e.g. a test-only or config change) or the verification tools are unavailable in this environment, say so in your final response; otherwise report the unresolved verification gap.`}}if(n){await l(o,i,t,"block","no_tools",c,e.projectDir);const m=` echo '${_(t)}' | ironbee hook submit-verdict`,A=` On fail: echo '${q(t)}' | ironbee hook submit-verdict`;return{action:"block",message:`VERIFICATION REQUIRED (attempt ${g}/${a}).
25
+ The ${T} verification cycle was attempted but its required tools were not all completed within ${a} attempts. If the change has no runtime surface to verify (e.g. a test-only or config change) or the verification tools are unavailable in this environment, say so in your final response; otherwise report the unresolved verification gap.`}}if(n){await l(r,i,t,"block","no_tools",c,e.projectDir);const m=` echo '${_(t)}' | ironbee hook submit-verdict`,T=` On fail: echo '${q(t)}' | ironbee hook submit-verdict`;return{action:"block",message:`VERIFICATION REQUIRED (attempt ${g}/${a}).
26
26
 
27
27
  You made code changes but did not verify them.
28
28
 
@@ -49,43 +49,48 @@ ${v.includes("browser")?`Browser cycle (UI verification):
49
49
  1. Connect to a running device or emulator: adt_device_connect
50
50
  2a. Device-evidence path: drive the app UI (adt_device_launch-app / adt_interaction_tap / adt_interaction_input-text / adt_interaction_swipe), then capture BOTH a screenshot (adt_content_take-screenshot) AND a UI snapshot (adt_a11y_take-ui-snapshot) to confirm the visual + structural result
51
51
  2b. Log-evidence path: read Logcat output for the changed code path (adt_o11y_log-read / adt_o11y_log-follow) and confirm expected log lines / absence of errors
52
+ 2c. Network-evidence path: capture the app's outgoing HTTP traffic (adt_o11y_get-http-requests \u2014 forward-looking: start capture, drive the app to trigger traffic, read again) and confirm the expected request(s) / response status
53
+ `:""}${v.includes("terminal")?`Terminal cycle (CLI / REPL / TUI verification \u2014 pick ONE evidence path):
54
+ 1a. Run-evidence path: run the affected command one-shot via tdt_pty_run and confirm its output + exit code
55
+ 1b. Interactive-evidence path: spawn a pane (tdt_pty_start), drive input (tdt_interaction_send-keys / tdt_interaction_send-text), and read the emitted output (tdt_content_capture); use tdt_sync_wait-for to block until expected output appears rather than guessing with delays
56
+ 2. Confirm the output reflects your change (expected lines present, no errors / unexpected exit code)
52
57
  `:""}
53
58
  Then submit your verdict (single verdict covers every active cycle):
54
59
  ${m}
55
- ${A}
56
- If failed, fix the code and re-verify until it passes.`}}await l(o,i,t,"block","incomplete_tools",c,e.projectDir);const H=D.map(m=>ue(m)).join(`
60
+ ${T}
61
+ If failed, fix the code and re-verify until it passes.`}}await l(r,i,t,"block","incomplete_tools",c,e.projectDir);const Y=D.map(m=>fe(m)).join(`
57
62
  `);return{action:"block",message:`INCOMPLETE VERIFICATION (attempt ${g}/${a}).
58
63
 
59
64
  You used the IronBee verification tools but skipped required checks:
60
65
 
61
- ${H}
66
+ ${Y}
62
67
 
63
68
  Run the missing tools, functionally test your changes, then submit your verdict:
64
69
  Pass: echo '${_(t)}' | ironbee hook submit-verdict
65
- Fail: echo '${q(t)}' | ironbee hook submit-verdict`}}if(!(0,b.existsSync)(s))return await l(o,i,t,"block","no_verdict",c,e.projectDir),{action:"block",message:`VERDICT MISSING.
70
+ Fail: echo '${q(t)}' | ironbee hook submit-verdict`}}if(!(0,b.existsSync)(s))return await l(r,i,t,"block","no_verdict",c,e.projectDir),{action:"block",message:`VERDICT MISSING.
66
71
 
67
- You ran the verification tools but did not submit a verdict.${(0,r.isRecordingActive)(i)?`
72
+ You ran the verification tools but did not submit a verdict.${(0,o.isRecordingActive)(i)?`
68
73
  \u26A0 Recording is still active \u2014 call mcp__browser-devtools__bdt_content_stop-recording BEFORE submit-verdict (otherwise it will reject with "recording is still active").`:""}
69
74
 
70
75
  Submit your verdict via:
71
- echo '${_(t)}' | ironbee hook submit-verdict`};let w;try{w=JSON.parse((0,b.readFileSync)(s,"utf-8"))}catch(n){return d.logger.debug(`failed to parse verdict ${s}: ${n}`),k(s),await l(o,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`INVALID VERDICT JSON. Re-submit valid JSON:
72
- echo '${_(t)}' | ironbee hook submit-verdict`}}if(w.status==="not_applicable")return k(s),await l(o,i,t,"block","not_applicable_rejected",v,e.projectDir),{action:"block",message:`VERDICT REJECTED: ${S?"N/A is not accepted in strict mode \u2014 verify the change with the required tools.":"N/A is not honored here \u2014 verify the change with the required tools, or report a fail."}
73
- echo '${_(t)}' | ironbee hook submit-verdict`};const F=v.map(n=>de(n,w)),j=F.filter(n=>!n.valid);if(j.length>0)return k(s),await l(o,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`VERDICT REJECTED:
74
- ${j.map(g=>` - ${g.cycle} cycle: ${g.reason}`).join(`
76
+ echo '${_(t)}' | ironbee hook submit-verdict`};let w;try{w=JSON.parse((0,b.readFileSync)(s,"utf-8"))}catch(n){return u.logger.debug(`failed to parse verdict ${s}: ${n}`),k(s),await l(r,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`INVALID VERDICT JSON. Re-submit valid JSON:
77
+ echo '${_(t)}' | ironbee hook submit-verdict`}}if(w.status==="not_applicable")return k(s),await l(r,i,t,"block","not_applicable_rejected",v,e.projectDir),{action:"block",message:`VERDICT REJECTED: ${x?"N/A is not accepted in strict mode \u2014 verify the change with the required tools.":"N/A is not honored here \u2014 verify the change with the required tools, or report a fail."}
78
+ echo '${_(t)}' | ironbee hook submit-verdict`};const F=v.map(n=>ue(n,w)),L=F.filter(n=>!n.valid);if(L.length>0)return k(s),await l(r,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`VERDICT REJECTED:
79
+ ${L.map(g=>` - ${g.cycle} cycle: ${g.reason}`).join(`
75
80
  `)}
76
81
 
77
82
  Re-submit:
78
- echo '${_(t)}' | ironbee hook submit-verdict`};const E=w.status;if(E!=="pass"&&E!=="fail")return k(s),await l(o,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`INVALID VERDICT STATUS: "${E}". Status must be "pass" or "fail".
79
- echo '${_(t)}' | ironbee hook submit-verdict`};const R=F.filter(n=>n.passCriteriaMet===!1),L=E==="pass"&&R.length===0?"pass":"fail";if(E==="pass"&&L==="fail"&&d.logger.debug(`verify-gate: status=pass overridden to fail by cycle pass-criteria: ${R.map(n=>n.cycle).join(",")}`),L==="pass")return d.logger.debug("verdict passed, allowing completion"),(0,r.resetRetries)(i),await l(o,i,t,"allow","verdict_pass",c,e.projectDir),{action:"allow"};const O=(0,r.incrementRetries)(i),I=[];if(Array.isArray(w.issues))for(const n of w.issues)I.push(String(n));for(const n of R)I.push(`[${n.cycle}] ${n.passReason??"pass criteria not met"}`);I.length===0&&I.push("unknown");const P=I.join(`
80
- - `);return O>=a?(k(s),(0,r.resetRetries)(i),await(0,r.closeOpenCycles)(i,o,"max_retries_exceeded"),await l(o,i,t,"allow","max_retries_exceeded",c,e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${a} TIMES. Allowing completion.
83
+ echo '${_(t)}' | ironbee hook submit-verdict`};const E=w.status;if(E!=="pass"&&E!=="fail")return k(s),await l(r,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`INVALID VERDICT STATUS: "${E}". Status must be "pass" or "fail".
84
+ echo '${_(t)}' | ironbee hook submit-verdict`};const R=F.filter(n=>n.passCriteriaMet===!1),j=E==="pass"&&R.length===0?"pass":"fail";if(E==="pass"&&j==="fail"&&u.logger.debug(`verify-gate: status=pass overridden to fail by cycle pass-criteria: ${R.map(n=>n.cycle).join(",")}`),j==="pass")return u.logger.debug("verdict passed, allowing completion"),(0,o.resetRetries)(i),await l(r,i,t,"allow","verdict_pass",c,e.projectDir),{action:"allow"};const O=(0,o.incrementRetries)(i),I=[];if(Array.isArray(w.issues))for(const n of w.issues)I.push(String(n));for(const n of R)I.push(`[${n.cycle}] ${n.passReason??"pass criteria not met"}`);I.length===0&&I.push("unknown");const P=I.join(`
85
+ - `);return O>=a?(k(s),(0,o.resetRetries)(i),await(0,o.closeOpenCycles)(i,r,"max_retries_exceeded"),await l(r,i,t,"allow","max_retries_exceeded",c,e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${a} TIMES. Allowing completion.
81
86
 
82
87
  Unresolved issues:
83
88
  - ${P}
84
89
 
85
- Report these issues in your final response.`}):(k(s),await l(o,i,t,"block","verdict_fail",c,e.projectDir),{action:"block",message:`VERIFICATION FAILED (attempt ${O}/${a}).
90
+ Report these issues in your final response.`}):(k(s),await l(r,i,t,"block","verdict_fail",c,e.projectDir),{action:"block",message:`VERIFICATION FAILED (attempt ${O}/${a}).
86
91
 
87
92
  Issues found:
88
93
  - ${P}
89
94
 
90
95
  Fix the issues, rebuild if needed, re-test functionally, and re-verify.
91
- Submit verdict: echo '<verdict-json>' | ironbee hook submit-verdict`})}u(fe,"runVerifyGate");async function l(e,t,i,o,s,f,a){o==="allow"&&(0,r.clearVerifyIntent)(t);const C=(0,r.getActiveActivityId)(t);if(!C){d.logger.debug(`verification_requested ${o}/${s} skipped \u2014 no active activity (would orphan)`),await(0,V.trackVerificationRequested)(i,o,s,a);return}const c={...(0,h.baseFields)(e),type:"verification_requested",timestamp:Date.now(),activity_id:C,action:o,reason:s,modes:f.length>0?f:void 0};await(0,h.appendAction)(e,c),await(0,V.trackVerificationRequested)(i,o,s,a)}u(l,"recordMarker");0&&(module.exports={runVerifyGate});
96
+ Submit verdict: echo '<verdict-json>' | ironbee hook submit-verdict`})}d(ge,"runVerifyGate");async function l(e,t,i,r,s,f,a){r==="allow"&&(0,o.clearVerifyIntent)(t);const C=(0,o.getActiveActivityId)(t);if(!C){u.logger.debug(`verification_requested ${r}/${s} skipped \u2014 no active activity (would orphan)`),await(0,V.trackVerificationRequested)(i,r,s,a);return}const c={...(0,h.baseFields)(e),type:"verification_requested",timestamp:Date.now(),activity_id:C,action:r,reason:s,modes:f.length>0?f:void 0};await(0,h.appendAction)(e,c),await(0,V.trackVerificationRequested)(i,r,s,a)}d(l,"recordMarker");0&&(module.exports={runVerifyGate});
@@ -1,2 +1,2 @@
1
- "use strict";var c=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var a=(t,n)=>c(t,"name",{value:n,configurable:!0});var O=(t,n)=>{for(var e in n)c(t,e,{get:n[e],enumerable:!0})},U=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of M(n))!N.call(t,i)&&i!==e&&c(t,i,{get:()=>n[i],enumerable:!(r=j(n,i))||r.enumerable});return t};var A=t=>U(c({},"__esModule",{value:!0}),t);var L={};O(L,{buildToolCall:()=>D});module.exports=A(L);var p=require("../../../clients/claude/util"),R=require("../../ids");const g=new Set(["browser-devtools","node-devtools","backend-devtools","android-devtools"]);function D(t){const{sessionId:n,projectName:e,activityId:r,timestamp:i,toolUse:s,toolResult:l}=t,o=(0,p.classifyTool)(s.name,s.input),I=z(n,o,s),C=o.tool_type==="mcp"&&o.mcp_server!==null&&g.has(o.mcp_server)?B(s.input):(0,p.extractClaudeToolInput)(s.name,s.input),x=k(s.input),d=l!==null&&l.is_error?F(l.content):void 0,S=d!==void 0&&/\[Request interrupted by user(?:[^\]]*)?\]/.test(d),w=d!==void 0?S?`interrupted: ${d}`:d:void 0,h=l!==null&&!l.is_error?k(l.content):0,y=Date.parse(i),T=t.resultTimestamp!==void 0&&t.resultTimestamp!==null?Date.parse(t.resultTimestamp):NaN,E=Number.isFinite(T)?T:Number.isFinite(y)?y:Date.now(),u={id:I,type:"tool_call",timestamp:E,session_id:n,project_name:e,activity_id:r,tool_name:o.tool_name,tool_use_id:s.id,tool_input:C,tool_input_size:x,tool_response_size:h,duration:t.durationMs??null};if(o.tool_type!==null&&(u.tool_type=o.tool_type),o.mcp_server!==null&&(u.mcp_server=o.mcp_server),w!==void 0&&(u.error=w),o.tool_type==="mcp"&&o.mcp_server!==null&&g.has(o.mcp_server)){const f=s.input._metadata;if(f!==null&&typeof f=="object"){const v=f,m=v.verificationId;typeof m=="string"&&b.test(m)&&(u.verification_id=m);const _=v.traceId;typeof _=="string"&&_.length>0&&(u.trace_id=_)}}return u}a(D,"buildToolCall");const b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function z(t,n,e){if(n.tool_type==="mcp"&&n.mcp_server!==null&&g.has(n.mcp_server)){const r=e.input._metadata;if(r!==null&&typeof r=="object"){const i=r.toolCallId;if(typeof i=="string"&&b.test(i))return i}}return(0,R.deriveToolCallEventIdFromToolUseId)(t,e.id)}a(z,"resolveEventId");function B(t){if(!("_metadata"in t))return t;const{_metadata:n,...e}=t;return e}a(B,"stripMetadata");function k(t){if(t==null)return 0;try{const n=typeof t=="string"?t:JSON.stringify(t);return n===void 0?0:Buffer.byteLength(n,"utf-8")}catch{return 0}}a(k,"byteLengthOf");function F(t){if(typeof t=="string")return t;if(Array.isArray(t)){const n=[];for(const e of t)if(e!==null&&typeof e=="object"){const r=e.text;typeof r=="string"&&n.push(r)}return n.join(`
1
+ "use strict";var c=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var a=(t,n)=>c(t,"name",{value:n,configurable:!0});var O=(t,n)=>{for(var e in n)c(t,e,{get:n[e],enumerable:!0})},U=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of M(n))!N.call(t,i)&&i!==e&&c(t,i,{get:()=>n[i],enumerable:!(r=j(n,i))||r.enumerable});return t};var A=t=>U(c({},"__esModule",{value:!0}),t);var L={};O(L,{buildToolCall:()=>D});module.exports=A(L);var p=require("../../../clients/claude/util"),R=require("../../ids");const g=new Set(["browser-devtools","node-devtools","backend-devtools","android-devtools","terminal-devtools"]);function D(t){const{sessionId:n,projectName:e,activityId:r,timestamp:i,toolUse:s,toolResult:l}=t,o=(0,p.classifyTool)(s.name,s.input),I=z(n,o,s),C=o.tool_type==="mcp"&&o.mcp_server!==null&&g.has(o.mcp_server)?B(s.input):(0,p.extractClaudeToolInput)(s.name,s.input),x=k(s.input),d=l!==null&&l.is_error?F(l.content):void 0,S=d!==void 0&&/\[Request interrupted by user(?:[^\]]*)?\]/.test(d),w=d!==void 0?S?`interrupted: ${d}`:d:void 0,h=l!==null&&!l.is_error?k(l.content):0,y=Date.parse(i),T=t.resultTimestamp!==void 0&&t.resultTimestamp!==null?Date.parse(t.resultTimestamp):NaN,E=Number.isFinite(T)?T:Number.isFinite(y)?y:Date.now(),u={id:I,type:"tool_call",timestamp:E,session_id:n,project_name:e,activity_id:r,tool_name:o.tool_name,tool_use_id:s.id,tool_input:C,tool_input_size:x,tool_response_size:h,duration:t.durationMs??null};if(o.tool_type!==null&&(u.tool_type=o.tool_type),o.mcp_server!==null&&(u.mcp_server=o.mcp_server),w!==void 0&&(u.error=w),o.tool_type==="mcp"&&o.mcp_server!==null&&g.has(o.mcp_server)){const f=s.input._metadata;if(f!==null&&typeof f=="object"){const v=f,m=v.verificationId;typeof m=="string"&&b.test(m)&&(u.verification_id=m);const _=v.traceId;typeof _=="string"&&_.length>0&&(u.trace_id=_)}}return u}a(D,"buildToolCall");const b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function z(t,n,e){if(n.tool_type==="mcp"&&n.mcp_server!==null&&g.has(n.mcp_server)){const r=e.input._metadata;if(r!==null&&typeof r=="object"){const i=r.toolCallId;if(typeof i=="string"&&b.test(i))return i}}return(0,R.deriveToolCallEventIdFromToolUseId)(t,e.id)}a(z,"resolveEventId");function B(t){if(!("_metadata"in t))return t;const{_metadata:n,...e}=t;return e}a(B,"stripMetadata");function k(t){if(t==null)return 0;try{const n=typeof t=="string"?t:JSON.stringify(t);return n===void 0?0:Buffer.byteLength(n,"utf-8")}catch{return 0}}a(k,"byteLengthOf");function F(t){if(typeof t=="string")return t;if(Array.isArray(t)){const n=[];for(const e of t)if(e!==null&&typeof e=="object"){const r=e.text;typeof r=="string"&&n.push(r)}return n.join(`
2
2
  `)}try{return JSON.stringify(t)}catch{return String(t)}}a(F,"extractErrorMessage");0&&(module.exports={buildToolCall});
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var c=(e,t)=>d(e,"name",{value:t,configurable:!0});var O=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of N(t))!S.call(e,o)&&o!==n&&d(e,o,{get:()=>t[o],enumerable:!(i=E(t,o))||i.enumerable});return e};var j=e=>h(d({},"__esModule",{value:!0}),e);var A={};O(A,{buildCodexToolCall:()=>D});module.exports=j(A);var p=require("../../../clients/codex/util"),w=require("../../ids");const v=new Set(["browser-devtools","node-devtools","backend-devtools","android-devtools"]);function D(e){const{sessionId:t,projectName:n,activityId:i,call:o,output:s}=e,r=(0,p.classifyCodexTool)(o.name),y=F(t,r,o),I=(0,p.extractCodexToolInput)(o.name,o.args),x=z(o.args),T=s!==null&&!s.isError?Buffer.byteLength(s.output,"utf-8"):0,C=s!==null&&s.isError?s.output.slice(0,500):void 0,a=Date.parse(o.timestamp),u=s!==null?Date.parse(s.timestamp):NaN,k=Number.isFinite(a)&&Number.isFinite(u)&&u>=a?u-a:null,R=Number.isFinite(u)?u:Number.isFinite(a)?a:Date.now(),l={id:y,type:"tool_call",timestamp:R,session_id:t,project_name:n,activity_id:i,tool_name:r.tool_name,tool_use_id:o.callId,tool_input:I,tool_input_size:x,tool_response_size:T,duration:k};if(r.tool_type!==null&&(l.tool_type=r.tool_type),r.mcp_server!==null&&(l.mcp_server=r.mcp_server),C!==void 0&&(l.error=C),r.tool_type==="mcp"&&r.mcp_server!==null&&v.has(r.mcp_server)){const m=o.args._metadata;if(m!==null&&typeof m=="object"){const _=m,f=_.verificationId;typeof f=="string"&&b.test(f)&&(l.verification_id=f);const g=_.traceId;typeof g=="string"&&g.length>0&&(l.trace_id=g)}}return l}c(D,"buildCodexToolCall");const b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function F(e,t,n){if(t.tool_type==="mcp"&&t.mcp_server!==null&&v.has(t.mcp_server)){const i=n.args._metadata;if(i!==null&&typeof i=="object"){const o=i.toolCallId;if(typeof o=="string"&&b.test(o))return o}}return(0,w.deriveToolCallEventIdFromToolUseId)(e,n.callId)}c(F,"resolveEventId");function z(e){if(e==null)return 0;try{return Buffer.byteLength(JSON.stringify(e),"utf-8")}catch{return 0}}c(z,"byteLengthOf");0&&(module.exports={buildCodexToolCall});
1
+ "use strict";var d=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var c=(e,t)=>d(e,"name",{value:t,configurable:!0});var O=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of N(t))!S.call(e,o)&&o!==n&&d(e,o,{get:()=>t[o],enumerable:!(i=E(t,o))||i.enumerable});return e};var j=e=>h(d({},"__esModule",{value:!0}),e);var A={};O(A,{buildCodexToolCall:()=>D});module.exports=j(A);var p=require("../../../clients/codex/util"),w=require("../../ids");const v=new Set(["browser-devtools","node-devtools","backend-devtools","android-devtools","terminal-devtools"]);function D(e){const{sessionId:t,projectName:n,activityId:i,call:o,output:l}=e,r=(0,p.classifyCodexTool)(o.name),y=F(t,r,o),I=(0,p.extractCodexToolInput)(o.name,o.args),x=z(o.args),T=l!==null&&!l.isError?Buffer.byteLength(l.output,"utf-8"):0,C=l!==null&&l.isError?l.output.slice(0,500):void 0,a=Date.parse(o.timestamp),u=l!==null?Date.parse(l.timestamp):NaN,k=Number.isFinite(a)&&Number.isFinite(u)&&u>=a?u-a:null,R=Number.isFinite(u)?u:Number.isFinite(a)?a:Date.now(),s={id:y,type:"tool_call",timestamp:R,session_id:t,project_name:n,activity_id:i,tool_name:r.tool_name,tool_use_id:o.callId,tool_input:I,tool_input_size:x,tool_response_size:T,duration:k};if(r.tool_type!==null&&(s.tool_type=r.tool_type),r.mcp_server!==null&&(s.mcp_server=r.mcp_server),C!==void 0&&(s.error=C),r.tool_type==="mcp"&&r.mcp_server!==null&&v.has(r.mcp_server)){const m=o.args._metadata;if(m!==null&&typeof m=="object"){const _=m,f=_.verificationId;typeof f=="string"&&b.test(f)&&(s.verification_id=f);const g=_.traceId;typeof g=="string"&&g.length>0&&(s.trace_id=g)}}return s}c(D,"buildCodexToolCall");const b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function F(e,t,n){if(t.tool_type==="mcp"&&t.mcp_server!==null&&v.has(t.mcp_server)){const i=n.args._metadata;if(i!==null&&typeof i=="object"){const o=i.toolCallId;if(typeof o=="string"&&b.test(o))return o}}return(0,w.deriveToolCallEventIdFromToolUseId)(e,n.callId)}c(F,"resolveEventId");function z(e){if(e==null)return 0;try{return Buffer.byteLength(JSON.stringify(e),"utf-8")}catch{return 0}}c(z,"byteLengthOf");0&&(module.exports={buildCodexToolCall});
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var a=(r,t)=>s(r,"name",{value:t,configurable:!0});var M=(r,t)=>{for(var e in t)s(r,e,{get:t[e],enumerable:!0})},w=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of I(t))!S.call(r,i)&&i!==e&&s(r,i,{get:()=>t[i],enumerable:!(n=d(t,i))||n.enumerable});return r};var x=r=>w(s({},"__esModule",{value:!0}),r);var _={};M(_,{MARKER_SCHEMA_VERSION:()=>k,markerPath:()=>c,readImportMarker:()=>E,writeImportMarker:()=>y});module.exports=x(_);var o=require("fs"),u=require("path"),m=require("../lib/logger"),f=require("../lib/gitignore");const k="1.0";function c(r,t){return(0,u.join)(r,".ironbee","sessions",t,"imported.json")}a(c,"markerPath");function y(r,t,e,n,i){if(!(0,o.existsSync)(r))return m.logger.debug(`import marker: projectDir ${r} does not exist \u2014 skipping marker write`),!1;(0,f.ensureIronBeeGitignored)(r);const p=c(r,t),l={imported_at:new Date().toISOString(),transcript_path:e,transcript_offset:n,events_sent:i,schema_version:k};try{return(0,o.mkdirSync)((0,u.dirname)(p),{recursive:!0}),(0,o.writeFileSync)(p,JSON.stringify(l,null,2)+`
2
- `),!0}catch(g){return m.logger.debug(`import marker: write ${p} failed: ${g instanceof Error?g.message:g}`),!1}}a(y,"writeImportMarker");function E(r,t){const e=c(r,t);if(!(0,o.existsSync)(e))return null;try{const n=(0,o.readFileSync)(e,"utf-8");return JSON.parse(n)}catch(n){return m.logger.debug(`import marker: read ${e} failed: ${n instanceof Error?n.message:n}`),null}}a(E,"readImportMarker");0&&(module.exports={MARKER_SCHEMA_VERSION,markerPath,readImportMarker,writeImportMarker});
1
+ "use strict";var s=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var a=(r,t)=>s(r,"name",{value:t,configurable:!0});var w=(r,t)=>{for(var e in t)s(r,e,{get:t[e],enumerable:!0})},x=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of S(t))!M.call(r,i)&&i!==e&&s(r,i,{get:()=>t[i],enumerable:!(n=I(t,i))||n.enumerable});return r};var y=r=>x(s({},"__esModule",{value:!0}),r);var v={};w(v,{MARKER_SCHEMA_VERSION:()=>k,markerPath:()=>f,readImportMarker:()=>_,writeImportMarker:()=>E});module.exports=y(v);var o=require("fs"),p=require("path"),m=require("../lib/logger"),c=require("../lib/gitignore"),l=require("../lib/runtime-paths");const k="1.0";function f(r,t){return(0,p.join)((0,l.sessionDir)(r,t),"imported.json")}a(f,"markerPath");function E(r,t,e,n,i){if(!(0,o.existsSync)(r))return m.logger.debug(`import marker: projectDir ${r} does not exist \u2014 skipping marker write`),!1;(0,c.ensureIronBeeGitignored)(r);const u=f(r,t),d={imported_at:new Date().toISOString(),transcript_path:e,transcript_offset:n,events_sent:i,schema_version:k};try{return(0,o.mkdirSync)((0,p.dirname)(u),{recursive:!0}),(0,o.writeFileSync)(u,JSON.stringify(d,null,2)+`
2
+ `),!0}catch(g){return m.logger.debug(`import marker: write ${u} failed: ${g instanceof Error?g.message:g}`),!1}}a(E,"writeImportMarker");function _(r,t){const e=f(r,t);if(!(0,o.existsSync)(e))return null;try{const n=(0,o.readFileSync)(e,"utf-8");return JSON.parse(n)}catch(n){return m.logger.debug(`import marker: read ${e} failed: ${n instanceof Error?n.message:n}`),null}}a(_,"readImportMarker");0&&(module.exports={MARKER_SCHEMA_VERSION,markerPath,readImportMarker,writeImportMarker});
@@ -1 +1 @@
1
- "use strict";var e=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var t=(n,o)=>e(n,"name",{value:o,configurable:!0});var a=(n,o)=>{for(var s in o)e(n,s,{get:o[s],enumerable:!0})},b=(n,o,s,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of p(o))!u.call(n,i)&&i!==s&&e(n,i,{get:()=>o[i],enumerable:!(r=m(o,i))||r.enumerable});return n};var c=n=>b(e({},"__esModule",{value:!0}),n);var x={};a(x,{shouldSkip:()=>g});module.exports=c(x);var f=require("fs"),l=require("path");function g(n,o,s){if(s)return!1;const r=(0,l.join)(n,".ironbee","sessions",o);return(0,f.existsSync)(r)}t(g,"shouldSkip");0&&(module.exports={shouldSkip});
1
+ "use strict";var e=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var t=(r,o)=>e(r,"name",{value:o,configurable:!0});var u=(r,o)=>{for(var s in o)e(r,s,{get:o[s],enumerable:!0})},c=(r,o,s,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of p(o))!a.call(r,i)&&i!==s&&e(r,i,{get:()=>o[i],enumerable:!(n=l(o,i))||n.enumerable});return r};var g=r=>c(e({},"__esModule",{value:!0}),r);var S={};u(S,{shouldSkip:()=>D});module.exports=g(S);var f=require("fs"),m=require("../lib/runtime-paths");function D(r,o,s){if(s)return!1;const n=(0,m.sessionDir)(r,o);return(0,f.existsSync)(n)}t(D,"shouldSkip");0&&(module.exports={shouldSkip});