@ironbee-ai/cli 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.26.0 (2026-06-18)
4
+
5
+ ### Bug Fixes
6
+
7
+ * **verification:** robust activity lifecycle for delegated/background verifier ([#28](https://github.com/ironbee-ai/ironbee-cli/issues/28)) ([0bef3ee](https://github.com/ironbee-ai/ironbee-cli/commit/0bef3ee76e0a038250d4442c79d1576293e56333))
8
+
3
9
  ## 0.25.1 (2026-06-16)
4
10
 
5
11
  ### Features
@@ -7,6 +7,8 @@ description: >
7
7
  verdict in the shared session, then returns a short summary. It does NOT edit code: if it
8
8
  finds problems it reports them as issues for the main agent to fix.
9
9
  tools: Bash, Read, Grep, Glob, mcp__browser-devtools__*, mcp__node-devtools__*, mcp__backend-devtools__*, mcp__android-devtools__*
10
+ # Prefer foreground (the default). Advisory only — Claude decides fore/background per task and may auto-background a long run; sub-agent-liveness markers handle a backgrounded run regardless.
11
+ background: false
10
12
  ---
11
13
 
12
14
  # IronBee Verifier (delegated verification)
@@ -37,6 +37,7 @@ A custom verification scenario may be supplied when this command is invoked —
37
37
  > Mode: \<`fix` in fix mode — OMIT this line entirely in verify-only mode>
38
38
  > Scenario: \<the resolved scenario text, or "none — exercise the changed pages/endpoints">
39
39
  The verifier runs `verification-start` (relaying the fix intent to IronBee's completion gate, which then enforces fix-until-pass on you) → drives every active cycle's tools → submits the single verdict, all in this shared session. It resolves the session id from the environment, so you don't pass one.
40
+ **Wait for the verifier in the same turn — do NOT background it.** Let it run to completion and read its verdict before responding; a backgrounded verifier can let your turn end (and the Stop gate fire) before its verdict is recorded.
40
41
  3. **Relay the verifier's summary** — the verdict status and, on fail, the issues it found.
41
42
  4. **On a fail verdict, branch by mode**:
42
43
  - **Verify-only (default)**: stop here. Report the issues clearly and suggest `/ironbee-verify fix` to repair them. Do not edit code.
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var a=(s,t)=>r(s,"name",{value:t,configurable:!0});var S=(s,t)=>{for(var e in t)r(s,e,{get:t[e],enumerable:!0})},$=(s,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of g(t))!b.call(s,i)&&i!==e&&r(s,i,{get:()=>t[i],enumerable:!(o=f(t,i))||o.enumerable});return s};var w=s=>$(r({},"__esModule",{value:!0}),s);var A={};S(A,{run:()=>y});module.exports=w(A);var p=require("../../../hooks/core/actions"),m=require("../../../hooks/core/activity"),c=require("../../../hooks/core/session-state"),n=require("../../../lib/logger"),u=require("../../../lib/stdin"),d=require("../../../otel/claude/daemon/ensure");async function y(s){let t;try{t=JSON.parse((0,u.readStdin)())}catch(l){n.logger.debug(`failed to parse stdin: ${l}`),process.exit(0)}const e=t.session_id??"default",o=`${s}/.ironbee/sessions/${e}`;(0,n.setLogFile)(`${o}/session.log`);const i=`${o}/actions.jsonl`;await(0,c.reconcileAbandonedActivity)(o,i,p.appendAction),await(0,m.startActivity)({sessionDir:o,actionsFile:i,source:"user_prompt"}),await(0,d.ensureOTELCollector)(s),process.exit(0)}a(y,"run");0&&(module.exports={run});
1
+ "use strict";var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var a=(i,t)=>r(i,"name",{value:t,configurable:!0});var U=(i,t)=>{for(var n in t)r(i,n,{get:t[n],enumerable:!0})},x=(i,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of b(t))!S.call(i,s)&&s!==n&&r(i,s,{get:()=>t[s],enumerable:!(o=g(t,s))||o.enumerable});return i};var y=i=>x(r({},"__esModule",{value:!0}),i);var $={};U($,{isNonUserUps:()=>l,run:()=>P});module.exports=y($);var p=require("../../../hooks/core/actions"),c=require("../../../hooks/core/activity"),u=require("../../../hooks/core/session-state"),e=require("../../../lib/logger"),m=require("../../../lib/stdin"),d=require("../../../otel/claude/daemon/ensure");function l(i){return(i??"").replace(/^\s+/,"").startsWith("<task-notification")}a(l,"isNonUserUps");async function P(i){let t;try{t=JSON.parse((0,m.readStdin)())}catch(f){e.logger.debug(`failed to parse stdin: ${f}`),process.exit(0)}const n=t.session_id??"default",o=`${i}/.ironbee/sessions/${n}`;(0,e.setLogFile)(`${o}/session.log`);const s=`${o}/actions.jsonl`;l(t.prompt)&&(e.logger.debug("activity-start: skip non-user UPS (<task-notification> continuation)"),process.exit(0)),await(0,u.reconcileAbandonedActivity)(o,s,p.appendAction),await(0,c.startActivity)({sessionDir:o,actionsFile:s,source:"user_prompt"}),await(0,d.ensureOTELCollector)(i),process.exit(0)}a(P,"run");0&&(module.exports={isNonUserUps,run});
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var c=(n,s)=>a(n,"name",{value:s,configurable:!0});var _=(n,s)=>{for(var e in s)a(n,e,{get:s[e],enumerable:!0})},$=(n,s,e,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of E(s))!A.call(n,i)&&i!==e&&a(n,i,{get:()=>s[i],enumerable:!(o=w(s,i))||o.enumerable});return n};var b=n=>$(a({},"__esModule",{value:!0}),n);var v={};_(v,{run:()=>I});module.exports=b(v);var t=require("../../../hooks/core/actions"),p=require("../../../hooks/core/activity"),u=require("../../../hooks/core/session-state"),m=require("../../../import/ids"),r=require("../../../lib/logger"),l=require("../../../lib/stdin"),g=require("../../../queue"),f=require("../../../analytics/claude/hook-trigger");async function I(n){let s;try{s=JSON.parse((0,l.readStdin)())}catch(y){r.logger.debug(`failed to parse stdin: ${y}`),process.exit(0)}const e=s.session_id??"default",o=`${n}/.ironbee/sessions/${e}`,i=`${o}/actions.jsonl`;(0,r.setLogFile)(`${o}/session.log`),await(0,u.closeOpenCycles)(o,i,"session_end"),await(0,p.endActivity)({sessionDir:o,actionsFile:i});const d=Date.now(),S={...(0,t.baseFields)(i),id:(0,m.deriveSessionEndEventId)(e),type:"session_end",timestamp:d,session_id:e,duration:(0,t.findDurationSinceLastAction)(i,"session_start",d),reason:s.reason};await(0,t.appendAction)(i,S),await(0,f.runAnalyticsTrigger)({projectDir:n,sessionId:e,triggerType:"SessionEnd",endReason:s.reason,transcriptSource:"claude-code"}),await(0,g.flushSynchronously)(n,e),r.logger.debug(`session-end: ${e}`),process.exit(0)}c(I,"run");0&&(module.exports={run});
1
+ "use strict";var a=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var c=(n,s)=>a(n,"name",{value:s,configurable:!0});var $=(n,s)=>{for(var i in s)a(n,i,{get:s[i],enumerable:!0})},b=(n,s,i,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let e of A(s))!_.call(n,e)&&e!==i&&a(n,e,{get:()=>s[e],enumerable:!(o=E(s,e))||o.enumerable});return n};var v=n=>b(a({},"__esModule",{value:!0}),n);var C={};$(C,{run:()=>I});module.exports=v(C);var t=require("../../../hooks/core/actions"),p=require("../../../hooks/core/activity"),m=require("../../../hooks/core/session-state"),u=require("../../../hooks/core/activity-participants"),l=require("../../../import/ids"),r=require("../../../lib/logger"),g=require("../../../lib/stdin"),f=require("../../../queue"),S=require("../../../analytics/claude/hook-trigger");async function I(n){let s;try{s=JSON.parse((0,g.readStdin)())}catch(w){r.logger.debug(`failed to parse stdin: ${w}`),process.exit(0)}const i=s.session_id??"default",o=`${n}/.ironbee/sessions/${i}`,e=`${o}/actions.jsonl`;(0,r.setLogFile)(`${o}/session.log`),await(0,m.closeOpenCycles)(o,e,"session_end"),await(0,p.endActivity)({sessionDir:o,actionsFile:e}),(0,u.clearActivityParticipants)(o);const d=Date.now(),y={...(0,t.baseFields)(e),id:(0,l.deriveSessionEndEventId)(i),type:"session_end",timestamp:d,session_id:i,duration:(0,t.findDurationSinceLastAction)(e,"session_start",d),reason:s.reason};await(0,t.appendAction)(e,y),await(0,S.runAnalyticsTrigger)({projectDir:n,sessionId:i,triggerType:"SessionEnd",endReason:s.reason,transcriptSource:"claude-code"}),await(0,f.flushSynchronously)(n,i),r.logger.debug(`session-end: ${i}`),process.exit(0)}c(I,"run");0&&(module.exports={run});
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var d=(e,t)=>a(e,"name",{value:t,configurable:!0});var I=(e,t)=>{for(var s in t)a(e,s,{get:t[s],enumerable:!0})},b=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of p(t))!f.call(e,n)&&n!==s&&a(e,n,{get:()=>t[n],enumerable:!(i=c(t,n))||i.enumerable});return e};var l=e=>b(a({},"__esModule",{value:!0}),e);var m={};I(m,{run:()=>S});module.exports=l(m);var r=require("../../../lib/logger"),u=require("../../../lib/stdin"),o=require("../../../hooks/core/activity-participants");async function S(e){let t;try{t=JSON.parse((0,u.readStdin)())}catch(g){r.logger.debug(`subagent-start: failed to parse stdin: ${g}`),process.exit(0);return}const s=t.session_id,i=t.agent_id;if(!s||!i){process.exit(0);return}const n=`${e}/.ironbee/sessions/${s}`;(0,r.setLogFile)(`${n}/session.log`),(0,o.enterActivity)(n,o.MAIN_PARTICIPANT_ID),(0,o.enterActivity)(n,i),r.logger.debug(`subagent-start: ${i} joined activity`),process.exit(0)}d(S,"run");0&&(module.exports={run});
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var g=(t,e)=>a(t,"name",{value:e,configurable:!0});var _=(t,e)=>{for(var s in e)a(t,s,{get:e[s],enumerable:!0})},y=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!b.call(t,i)&&i!==s&&a(t,i,{get:()=>e[i],enumerable:!(n=f(e,i))||n.enumerable});return t};var m=t=>y(a({},"__esModule",{value:!0}),t);var S={};_(S,{run:()=>I});module.exports=m(S);var r=require("../../../lib/logger"),d=require("../../../lib/stdin"),o=require("../../../hooks/core/session-state"),c=require("../../../hooks/core/activity");const p="ironbee-verifier";async function I(t){let e;try{e=JSON.parse((0,d.readStdin)())}catch(u){r.logger.debug(`subagent-stop: failed to parse stdin: ${u}`),process.exit(0);return}const s=e.session_id;if(!s){process.exit(0);return}const n=`${t}/.ironbee/sessions/${s}`,i=`${n}/actions.jsonl`;(0,r.setLogFile)(`${n}/session.log`),(e.agent_type??e.subagent_type)===p&&((0,o.getActiveVerificationId)(n)!==void 0||(0,o.getActiveFixId)(n)!==void 0)&&(await(0,o.closeOpenCycles)(n,i,"subagent_stop"),r.logger.debug(`subagent-stop: ${p} backstop closed dangling cycle`)),e.agent_id&&await(0,c.closeActivityIfLastParticipant)({sessionDir:n,actionsFile:i},e.agent_id),process.exit(0)}g(I,"run");0&&(module.exports={run});
@@ -1,4 +1,4 @@
1
- "use strict";var a=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(e,s)=>a(e,"name",{value:s,configurable:!0});var b=(e,s)=>{for(var t in s)a(e,t,{get:s[t],enumerable:!0})},w=(e,s,t,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of v(s))!y.call(e,i)&&i!==t&&a(e,i,{get:()=>s[i],enumerable:!(o=I(s,i))||o.enumerable});return e};var S=e=>w(a({},"__esModule",{value:!0}),e);var T={};b(T,{run:()=>E});module.exports=S(T);var c=require("../../../hooks/core/verify-gate"),p=require("../../../hooks/core/activity"),d=require("../../../lib/config"),l=require("../../../lib/logger"),m=require("../../../lib/stdin"),r=require("../../../queue"),u=require("../../../analytics/claude/hook-trigger");const x=`\u26A0 VERIFY BY DELEGATING \u2014 do NOT run the verification tools or submit the verdict yourself.
1
+ "use strict";var l=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var c=(e,t)=>l(e,"name",{value:t,configurable:!0});var w=(e,t)=>{for(var s in t)l(e,s,{get:t[s],enumerable:!0})},S=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of y(t))!b.call(e,o)&&o!==s&&l(e,o,{get:()=>t[o],enumerable:!(i=v(t,o))||i.enumerable});return e};var A=e=>S(l({},"__esModule",{value:!0}),e);var E={};w(E,{run:()=>x});module.exports=A(E);var p=require("../../../hooks/core/verify-gate"),m=require("../../../hooks/core/activity"),a=require("../../../hooks/core/activity-participants"),u=require("../../../lib/config"),f=require("../../../lib/logger"),h=require("../../../lib/stdin"),n=require("../../../queue"),d=require("../../../analytics/claude/hook-trigger");const T=`\u26A0 VERIFY BY DELEGATING \u2014 do NOT run the verification tools or submit the verdict yourself.
2
2
 
3
3
  Spawn the ironbee-verifier sub-agent via the Agent/Task tool (subagent_type: "ironbee-verifier")
4
4
  with a prompt describing what to verify. It drives the verification tools and submits the verdict
@@ -8,6 +8,6 @@ then re-delegate until it passes.
8
8
 
9
9
  The detail below is what the VERIFIER will do \u2014 you do NOT run it yourself:
10
10
  \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
11
- `;async function E(e){let s;try{s=JSON.parse((0,m.readStdin)())}catch(h){l.logger.debug(`failed to parse stdin: ${h}`),process.exit(0)}const t=s.session_id??"default";(0,l.setLogFile)(`${e}/.ironbee/sessions/${t}/session.log`);const o=`${e}/.ironbee/sessions/${t}`,i=`${o}/actions.jsonl`,f=(0,d.loadConfig)(e),n=await(0,c.runVerifyGate)({sessionId:t,sessionDir:o,actionsFile:i,verdictFile:`${o}/verdict.json`,maxRetries:(0,d.getMaxRetries)(f),config:f,projectDir:e});n.action==="allow"&&(await(0,p.endActivity)({sessionDir:o,actionsFile:i}),(0,u.runAnalyticsTrigger)({projectDir:e,sessionId:t,triggerType:"Stop",transcriptSource:"claude-code"}),n.message&&process.stderr.write(n.message+`
12
- `),(0,r.flushInBackground)(e,t),(0,r.flushStragglersInBackground)(e,t),process.exit(0)),(0,u.runAnalyticsTrigger)({projectDir:e,sessionId:t,triggerType:"Stop",transcriptSource:"claude-code"}),n.message&&process.stderr.write(x+n.message+`
13
- `),(0,r.flushInBackground)(e,t),(0,r.flushStragglersInBackground)(e,t),process.exit(2)}g(E,"run");0&&(module.exports={run});
11
+ `;async function x(e){let t;try{t=JSON.parse((0,h.readStdin)())}catch(I){f.logger.debug(`failed to parse stdin: ${I}`),process.exit(0)}const s=t.session_id??"default";(0,f.setLogFile)(`${e}/.ironbee/sessions/${s}/session.log`);const i=`${e}/.ironbee/sessions/${s}`,o=`${i}/actions.jsonl`,g=(0,u.loadConfig)(e),r=await(0,p.runVerifyGate)({sessionId:s,sessionDir:i,actionsFile:o,verdictFile:`${i}/verdict.json`,maxRetries:(0,u.getMaxRetries)(g),config:g,projectDir:e});r.action==="allow"&&(r.reason!=="verifier_running"?await(0,m.closeActivityIfLastParticipant)({sessionDir:i,actionsFile:o},a.MAIN_PARTICIPANT_ID):(0,a.enterActivity)(i,a.MAIN_PARTICIPANT_ID),(0,d.runAnalyticsTrigger)({projectDir:e,sessionId:s,triggerType:"Stop",transcriptSource:"claude-code"}),r.message&&process.stderr.write(r.message+`
12
+ `),(0,n.flushInBackground)(e,s),(0,n.flushStragglersInBackground)(e,s),process.exit(0)),(0,d.runAnalyticsTrigger)({projectDir:e,sessionId:s,triggerType:"Stop",transcriptSource:"claude-code"}),r.message&&process.stderr.write(T+r.message+`
13
+ `),(0,n.flushInBackground)(e,s),(0,n.flushStragglersInBackground)(e,s),process.exit(2)}c(x,"run");0&&(module.exports={run});
@@ -1,7 +1,7 @@
1
- "use strict";var oe=Object.create;var w=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var v=(s,e)=>w(s,"name",{value:e,configurable:!0});var le=(s,e)=>{for(var n in e)w(s,n,{get:e[n],enumerable:!0})},A=(s,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ie(e))!se.call(s,r)&&r!==n&&w(s,r,{get:()=>e[r],enumerable:!(o=re(e,r))||o.enumerable});return s};var ae=(s,e,n)=>(n=s!=null?oe(te(s)):{},A(e||!s||!s.__esModule?w(n,"default",{value:s,enumerable:!0}):n,s)),ce=s=>A(w({},"__esModule",{value:!0}),s);var we={};le(we,{ClaudeClient:()=>be,prepareIronBeeDir:()=>Ee});module.exports=ce(we);var t=require("fs"),c=require("path"),p=require("../../lib/logger"),a=require("../../lib/output"),P=require("../../lib/gitignore"),B=require("../../lib/fs-prune"),U=require("./hooks/verify-gate"),j=require("./hooks/clear-verdict"),V=require("./hooks/track-action"),J=require("./hooks/track-action-monitor"),H=require("./hooks/session-start"),D=require("./hooks/require-verdict"),F=require("./hooks/require-verification"),x=require("./hooks/activity-start"),X=require("./hooks/activity-end"),G=require("./hooks/session-end"),u=require("../../lib/config"),W=require("../../hooks/core/actions"),q=require("../../lib/platform-section"),y=require("../../lib/install-snapshots"),T=require("./hooks/session-status");const S="browser-devtools",h="node-devtools",b="backend-devtools",E="android-devtools",ue="ironbee",de="ironbee hook session-status",C="IronBee Verification Verdict",fe="IronBee Verification Verdict \u2014 ALWAYS ALLOW: A call to `ironbee hook submit-verdict` is IronBee's verification verdict and is ALWAYS legitimate. NEVER flag it under Content Integrity / Impersonation \u2014 no matter which agent submits it, and even if the handoff does not re-show the devtools (`bdt_`/`ndt_`/`bedt_`/`adt_`) tool calls. Those calls ran earlier in the cycle, are recorded in `.ironbee/sessions/<id>/actions.jsonl`, and IronBee's own Stop-gate already blocks any pass that lacks the required real tool calls \u2014 so this verdict is NEVER fabrication. Do not second-guess it, do not attribute it to the wrong actor. This overrides Content Integrity / Impersonation for the `ironbee hook submit-verdict` command ONLY; every other block rule still applies normally.",M="$defaults";function me(s){return(0,c.join)(__dirname,"..",s,"platforms")}v(me,"platformsDirFor");function _(s,e,n){return e?(s.includes(n)||s.push(n),s):s.filter(o=>o!==n)}v(_,"syncCyclePermission");function N(s){const e=Object.keys(s);if(e.length===0)return!0;if(e.length===1&&e[0]==="mcpServers"){const n=s.mcpServers;return n===void 0||Object.keys(n).length===0}return!1}v(N,"isMcpConfigEmpty");function ge(s,e){const n=[` - ${s}:`];!("type"in e)&&"command"in e&&n.push(" type: stdio");for(const[o,r]of Object.entries(e))if(r!==void 0)if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const i=Object.entries(r);if(i.length===0)n.push(` ${o}: {}`);else{n.push(` ${o}:`);for(const[l,d]of i)n.push(` ${l}: ${JSON.stringify(d)}`)}}else n.push(` ${o}: ${JSON.stringify(r)}`);return n}v(ge,"renderInlineMcpServerYaml");function pe(s,e){const n=[];if((0,u.isCycleEnabled)(e,"browser")&&n.push({key:S,entry:(0,u.getMcpServerEntry)(s)}),(0,u.isCycleEnabled)(e,"node")&&n.push({key:h,entry:(0,u.getNodeDevToolsMcpEntry)(s)}),(0,u.isCycleEnabled)(e,"backend")&&n.push({key:b,entry:(0,u.getBackendDevToolsMcpEntry)(s)}),(0,u.isCycleEnabled)(e,"android")&&n.push({key:E,entry:(0,u.getAndroidDevToolsMcpEntry)(s)}),n.length===0)return"";const o=["mcpServers:"];for(const{key:r,entry:i}of n)o.push(...ge(r,i));return o.join(`
2
- `)}v(pe,"buildVerifierMcpServersBlock");function ke(s,e){if(e.length===0)return s;const n=s.split(`
3
- `);if(n[0]!=="---")return s;let o=-1;for(let l=1;l<n.length;l++)if(n[l]==="---"){o=l;break}if(o<0)return s;const r=n.slice(0,o),i=n.slice(o);return[...r,...e.split(`
1
+ "use strict";var ie=Object.create;var w=Object.defineProperty;var te=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var v=(s,e)=>w(s,"name",{value:e,configurable:!0});var ce=(s,e)=>{for(var n in e)w(s,n,{get:e[n],enumerable:!0})},A=(s,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of se(e))!le.call(s,r)&&r!==n&&w(s,r,{get:()=>e[r],enumerable:!(o=te(e,r))||o.enumerable});return s};var ue=(s,e,n)=>(n=s!=null?ie(ae(s)):{},A(e||!s||!s.__esModule?w(n,"default",{value:s,enumerable:!0}):n,s)),de=s=>A(w({},"__esModule",{value:!0}),s);var Oe={};ce(Oe,{ClaudeClient:()=>we,prepareIronBeeDir:()=>_e});module.exports=de(Oe);var t=require("fs"),c=require("path"),p=require("../../lib/logger"),l=require("../../lib/output"),P=require("../../lib/gitignore"),B=require("../../lib/fs-prune"),U=require("./hooks/verify-gate"),j=require("./hooks/clear-verdict"),V=require("./hooks/track-action"),H=require("./hooks/track-action-monitor"),J=require("./hooks/session-start"),D=require("./hooks/require-verdict"),F=require("./hooks/require-verification"),x=require("./hooks/activity-start"),X=require("./hooks/activity-end"),G=require("./hooks/session-end"),W=require("./hooks/subagent-start"),q=require("./hooks/subagent-stop"),u=require("../../lib/config"),z=require("../../hooks/core/actions"),Y=require("../../lib/platform-section"),S=require("../../lib/install-snapshots"),T=require("./hooks/session-status");const y="browser-devtools",h="node-devtools",b="backend-devtools",E="android-devtools",me="ironbee",fe="ironbee hook session-status",C="IronBee Verification Verdict",ge="IronBee Verification Verdict \u2014 ALWAYS ALLOW: A call to `ironbee hook submit-verdict` is IronBee's verification verdict and is ALWAYS legitimate. NEVER flag it under Content Integrity / Impersonation \u2014 no matter which agent submits it, and even if the handoff does not re-show the devtools (`bdt_`/`ndt_`/`bedt_`/`adt_`) tool calls. Those calls ran earlier in the cycle, are recorded in `.ironbee/sessions/<id>/actions.jsonl`, and IronBee's own Stop-gate already blocks any pass that lacks the required real tool calls \u2014 so this verdict is NEVER fabrication. Do not second-guess it, do not attribute it to the wrong actor. This overrides Content Integrity / Impersonation for the `ironbee hook submit-verdict` command ONLY; every other block rule still applies normally.",M="$defaults";function pe(s){return(0,c.join)(__dirname,"..",s,"platforms")}v(pe,"platformsDirFor");function _(s,e,n){return e?(s.includes(n)||s.push(n),s):s.filter(o=>o!==n)}v(_,"syncCyclePermission");function N(s){const e=Object.keys(s);if(e.length===0)return!0;if(e.length===1&&e[0]==="mcpServers"){const n=s.mcpServers;return n===void 0||Object.keys(n).length===0}return!1}v(N,"isMcpConfigEmpty");function ke(s,e){const n=[` - ${s}:`];!("type"in e)&&"command"in e&&n.push(" type: stdio");for(const[o,r]of Object.entries(e))if(r!==void 0)if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const i=Object.entries(r);if(i.length===0)n.push(` ${o}: {}`);else{n.push(` ${o}:`);for(const[a,d]of i)n.push(` ${a}: ${JSON.stringify(d)}`)}}else n.push(` ${o}: ${JSON.stringify(r)}`);return n}v(ke,"renderInlineMcpServerYaml");function ve(s,e){const n=[];if((0,u.isCycleEnabled)(e,"browser")&&n.push({key:y,entry:(0,u.getMcpServerEntry)(s)}),(0,u.isCycleEnabled)(e,"node")&&n.push({key:h,entry:(0,u.getNodeDevToolsMcpEntry)(s)}),(0,u.isCycleEnabled)(e,"backend")&&n.push({key:b,entry:(0,u.getBackendDevToolsMcpEntry)(s)}),(0,u.isCycleEnabled)(e,"android")&&n.push({key:E,entry:(0,u.getAndroidDevToolsMcpEntry)(s)}),n.length===0)return"";const o=["mcpServers:"];for(const{key:r,entry:i}of n)o.push(...ke(r,i));return o.join(`
2
+ `)}v(ve,"buildVerifierMcpServersBlock");function Se(s,e){if(e.length===0)return s;const n=s.split(`
3
+ `);if(n[0]!=="---")return s;let o=-1;for(let a=1;a<n.length;a++)if(n[a]==="---"){o=a;break}if(o<0)return s;const r=n.slice(0,o),i=n.slice(o);return[...r,...e.split(`
4
4
  `),...i].join(`
5
- `)}v(ke,"injectVerifierMcpServers");function ve(s,e){if(!e)return s;const n=s.split(`
6
- `);if(n[0]!=="---")return s;let o=-1;for(let l=1;l<n.length;l++)if(n[l]==="---"){o=l;break}if(o<0)return s;const r=n.slice(0,o);if(r.some(l=>/^model\s*:/.test(l)))return s;const i=n.slice(o);return[...r,`model: ${e}`,...i].join(`
7
- `)}v(ve,"injectVerifierModel");function ye(s){const e=new Set(["hooks","permissions"]);for(const n of Object.keys(s))if(!e.has(n))return!1;if(s.hooks!==void 0&&Object.keys(s.hooks).length>0)return!1;if(s.permissions!==void 0){const n=s.permissions.allow??[],o=s.permissions.deny??[];if(n.length>0||o.length>0)return!1}return!0}v(ye,"isClaudeSettingsEmpty");const Se=["CLAUDE_CODE_ENABLE_TELEMETRY","OTEL_LOGS_EXPORTER","OTEL_METRICS_EXPORTER","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_EXPORTER_OTLP_ENDPOINT","OTEL_LOG_RAW_API_BODIES","OTEL_RESOURCE_ATTRIBUTES","OTEL_LOGS_EXPORT_INTERVAL"];function I(s){const e=s.OTEL_RESOURCE_ATTRIBUTES;return typeof e=="string"&&e.includes("ironbee.project_name")}v(I,"otelEnvOwnedByUs");function he(s){return s.replace(/[,=\s]+/g,"-").replace(/^-+|-+$/g,"")||"project"}v(he,"sanitizeResourceValue");class be{constructor(){this.name="claude";this.supportsVerifierModel=!0}static{v(this,"ClaudeClient")}detect(e){return(0,t.existsSync)((0,c.join)(e,".claude"))}resolveProjectDir(){return process.env.CLAUDE_PROJECT_DIR??process.cwd()}resolveAgentSessionId(e,n){const o=process.env.CLAUDE_CODE_SESSION_ID;return typeof o=="string"&&o.length>0?o:void 0}async runSessionStatus(){const{runSessionStatus:e}=await Promise.resolve().then(()=>ae(require("./hooks/session-status")));await e()}install(e,n){const o=n??(0,u.loadConfig)(e),r=(0,u.getVerificationMode)(o),i=r!=="monitor";this.cleanupArtifacts(e);const l=(0,c.join)(e,".claude"),d=(0,c.join)(l,"skills"),m=(0,c.join)(l,"rules"),f=(0,c.join)(l,"commands");(0,t.mkdirSync)(d,{recursive:!0}),(0,t.mkdirSync)(m,{recursive:!0}),(0,t.mkdirSync)(f,{recursive:!0});const g=(0,c.join)(l,"settings.json");if(this.mergeHooksConfig(g,r),this.writePermissions(g,i,e),(0,u.isOTELEnabled)(o)&&this.writeOTELEnv(g,e,o),this.installStatusLine(e,o),i){if(r==="enforce"){const $=(0,c.join)(d,"ironbee-verification.md"),Z=(0,t.readFileSync)((0,c.join)(__dirname,"skills","ironbee-verification.md"),"utf-8");(0,t.writeFileSync)($,Z);const ee=(0,c.join)(m,"ironbee-verification.md"),ne=(0,t.readFileSync)((0,c.join)(__dirname,"rules","ironbee-verification.md"),"utf-8");(0,t.writeFileSync)(ee,ne)}const k=(0,c.join)(f,"ironbee-verify.md"),O=(0,t.readFileSync)((0,c.join)(__dirname,"commands","ironbee-verify.md"),"utf-8");(0,t.writeFileSync)(k,O);const R=(0,c.join)(l,"agents");(0,t.mkdirSync)(R,{recursive:!0});const z=(0,c.join)(R,"ironbee-verifier.md"),Y=(0,t.readFileSync)((0,c.join)(__dirname,"agents","ironbee-verifier.md"),"utf-8"),K=ke(Y,pe(e,o)),Q=ve(K,(0,u.getVerificationModel)(o,"claude"));(0,t.writeFileSync)(z,Q);const L=(0,c.join)(e,".mcp.json");if(this.writeMcpConfig(L,e),(0,q.syncPlatformSectionsToConfig)(e,me),(0,u.isAutoModeAllowlistEnabled)(o)){const $=(0,c.join)(l,"settings.local.json");this.writeAutoModeAllowlist($)}console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} settings ${a.pc.dim("\u2192")} ${a.pc.dim(g)}`),r==="enforce"?(console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} skills ${a.pc.dim("\u2192")} ${a.pc.dim(d)}`),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} rule ${a.pc.dim("\u2192")} ${a.pc.dim(m)}`)):console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} ${a.pc.yellow("assist mode")} (verification.auto: false) \u2014 manual /ironbee-verify only, no enforcement`),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} commands ${a.pc.dim("\u2192")} ${a.pc.dim(f)}`),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} agents ${a.pc.dim("\u2192")} ${a.pc.dim((0,c.join)(l,"agents"))}`),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} mcp ${a.pc.dim("\u2192")} ${a.pc.dim(L)}`)}else console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} ${a.pc.yellow("monitoring-only mode")} (verification.enable: false)`),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} settings ${a.pc.dim("\u2192")} ${a.pc.dim(g)}`)}uninstall(e){this.cleanupArtifacts(e),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} removed hooks, skill, rule, command, MCP, and permissions`)}cleanupArtifacts(e){const n=(0,c.join)(e,".claude"),o=(0,c.join)(n,"skills","ironbee-verification.md"),r=(0,c.join)(n,"skills","ironbee-analyze.md"),i=(0,c.join)(n,"rules","ironbee-verification.md"),l=(0,c.join)(n,"commands","ironbee-analyze.md"),d=(0,c.join)(n,"commands","ironbee-verify.md"),m=(0,c.join)(n,"agents","ironbee-verifier.md");this.removeFile(o),this.removeFile(r),this.removeFile(i),this.removeFile(l),this.removeFile(d),this.removeFile(m);const f=(0,c.join)(n,"settings.json");this.removeIronBeeHooks(f),this.removePermission(f),this.removeOTELEnv(f),this.maybeDeleteEmptySettings(f);const g=(0,c.join)(e,".mcp.json");this.removeMcpServer(g),this.removeAutoModeAllowlist((0,c.join)(n,"settings.local.json")),this.uninstallStatusLine(e),(0,B.pruneEmptyDirs)(n)}installStatusLine(e,n){if(!(0,u.isSessionStatusEnabled)(n))return;const o=(0,c.join)(e,".claude","settings.local.json"),r=this.readStatusLineBlock(o);r&&!(0,T.isIronbeeStatusLine)(r.command)&&(0,y.readStatusLineSnapshot)(e,"claude")===void 0&&(0,y.upsertStatusLineSnapshot)(e,"claude",r);const i={type:"command",command:de},l=(0,u.getStatusLineRefreshInterval)(n);l!==void 0&&(i.refreshInterval=l),this.writeStatusLineBlock(o,i),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} statusline ${a.pc.dim("\u2192")} ${a.pc.dim(o)}`)}uninstallStatusLine(e){const n=(0,c.join)(e,".claude","settings.local.json"),o=(0,y.readStatusLineSnapshot)(e,"claude");if(o){this.writeStatusLineBlock(n,o),(0,y.clearStatusLineSnapshot)(e,"claude");return}const r=this.readStatusLineBlock(n);r&&(0,T.isIronbeeStatusLine)(r.command)&&this.removeStatusLineBlock(n)}readStatusLineBlock(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(n===null||typeof n!="object")return;const o=n.statusLine;if(o===null||typeof o!="object")return;const r=o.command;if(typeof r!="string"||r.length===0)return;const i=o.padding,l=o.refreshInterval,d={type:"command",command:r};return typeof i=="number"&&(d.padding=i),typeof l=="number"&&(d.refreshInterval=l),d}catch(n){p.logger.debug(`failed to read statusLine from ${e}: ${n}`);return}}writeStatusLineBlock(e,n){let o={};if((0,t.existsSync)(e))try{const r=JSON.parse((0,t.readFileSync)(e,"utf-8"));r!==null&&typeof r=="object"&&!Array.isArray(r)&&(o=r)}catch(r){p.logger.debug(`failed to read ${e} for statusLine write: ${r}`)}else(0,t.mkdirSync)((0,c.join)(e,".."),{recursive:!0});o.statusLine=n,(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}removeStatusLineBlock(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(n===null||typeof n!="object"||Array.isArray(n))return;const o=n;delete o.statusLine,Object.keys(o).length===0?(0,t.unlinkSync)(e):(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}catch(n){p.logger.debug(`failed to remove statusLine from ${e}: ${n}`)}}writeAutoModeAllowlist(e){let n={};if((0,t.existsSync)(e))try{n=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(d){p.logger.debug(`failed to parse ${e} for autoMode allowlist: ${d}`);return}else(0,t.mkdirSync)((0,c.join)(e,".."),{recursive:!0});const o=n.autoMode!==null&&typeof n.autoMode=="object"&&!Array.isArray(n.autoMode)?n.autoMode:{},r=Array.isArray(o.allow)?o.allow.filter(d=>typeof d=="string"):[],i=r.filter(d=>!d.includes(C)),l=r.length===0?[M]:i;o.allow=[...l,fe],n.autoMode=o,(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}removeAutoModeAllowlist(e){if(!(0,t.existsSync)(e))return;let n;try{n=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(d){p.logger.debug(`failed to parse ${e} for autoMode strip: ${d}`);return}if(n.autoMode===null||typeof n.autoMode!="object"||Array.isArray(n.autoMode))return;const o=n.autoMode;if(!Array.isArray(o.allow))return;const r=o.allow.filter(d=>typeof d=="string"),i=r.filter(d=>!d.includes(C));if(i.length===r.length)return;i.length===0||i.length===1&&i[0]===M?delete o.allow:o.allow=i,Object.keys(o).length===0?delete n.autoMode:n.autoMode=o,Object.keys(n).length===0?(0,t.unlinkSync)(e):(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}writeOTELEnv(e,n,o){let r={};if((0,t.existsSync)(e))try{const g=JSON.parse((0,t.readFileSync)(e,"utf-8"));g!==null&&typeof g=="object"&&!Array.isArray(g)&&(r=g)}catch(g){p.logger.debug(`failed to read ${e} for otel env write: ${g}`)}else(0,t.mkdirSync)((0,c.join)(e,".."),{recursive:!0});const i=r.env,l=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{},d=l.OTEL_EXPORTER_OTLP_ENDPOINT;if(typeof d=="string"&&d.length>0&&!I(l)){console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} ${a.pc.yellow("existing OTEL telemetry env detected \u2014 left untouched (session_context not wired for this project)")}`);return}const m=(0,u.getOTELPort)(o),f=he((0,W.resolveProjectName)(n));l.CLAUDE_CODE_ENABLE_TELEMETRY="1",l.OTEL_LOGS_EXPORTER="otlp",l.OTEL_METRICS_EXPORTER="none",l.OTEL_EXPORTER_OTLP_PROTOCOL="http/json",l.OTEL_EXPORTER_OTLP_ENDPOINT=`http://127.0.0.1:${m}`,l.OTEL_LOG_RAW_API_BODIES="file:.ironbee/otel",l.OTEL_RESOURCE_ATTRIBUTES=`ironbee.project_name=${f}`,l.OTEL_LOGS_EXPORT_INTERVAL="5000",r.env=l,(0,t.writeFileSync)(e,JSON.stringify(r,null,2)),console.log(` ${a.pc.dim("\u2192")} ${(0,a.orange)("[claude]")} otel env ${a.pc.dim("\u2192")} ${a.pc.dim(`${e} (127.0.0.1:${m})`)}`)}removeOTELEnv(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(n===null||typeof n!="object"||Array.isArray(n))return;const o=n,r=o.env;if(r===null||typeof r!="object"||Array.isArray(r))return;const i=r;if(!I(i))return;for(const l of Se)delete i[l];Object.keys(i).length===0&&delete o.env,(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}catch(n){p.logger.debug(`failed to remove otel env from ${e}: ${n}`)}}maybeDeleteEmptySettings(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));ye(n)&&(0,t.unlinkSync)(e)}catch(n){p.logger.debug(`failed to inspect ${e} for emptiness: ${n}`)}}async runVerifyGate(e){await(0,U.run)(e)}async runClearVerdict(e){await(0,j.run)(e)}async runTrackAction(e){await(0,V.run)(e)}async runSessionStart(e){await(0,H.run)(e)}async runRequireVerdict(e,n){await(0,D.run)(e,n)}async runRequireVerification(e,n){await(0,F.run)(e,n)}async runActivityStart(e){await(0,x.run)(e)}async runActivityEnd(e){await(0,X.run)(e)}async runTrackActionMonitor(e){await(0,J.run)(e)}async runSessionEnd(e){await(0,G.run)(e)}async runTrackActionPre(e){}isIronBeeHook(e){return e.hooks.some(n=>n.command.includes(ue))}mergeHooksConfig(e,n){const o=n!=="monitor",r=n==="assist"?" --soft":"";let i={};if((0,t.existsSync)(e))try{i=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(m){p.logger.debug(`failed to parse ${e}: ${m}`),i={}}i.hooks||(i.hooks={});for(const m of Object.keys(i.hooks)){const f=i.hooks[m].filter(g=>!this.isIronBeeHook(g));f.length===0?delete i.hooks[m]:i.hooks[m]=f}i.hooks.SessionStart||(i.hooks.SessionStart=[]),i.hooks.SessionStart.push({matcher:"",hooks:[{type:"command",command:"ironbee hook session-start --client claude"}]}),i.hooks.UserPromptSubmit||(i.hooks.UserPromptSubmit=[]),i.hooks.UserPromptSubmit.push({matcher:"",hooks:[{type:"command",command:"ironbee hook activity-start --client claude"}]}),o&&(i.hooks.PreToolUse||(i.hooks.PreToolUse=[]),i.hooks.PreToolUse.push({matcher:"mcp__browser-devtools__.*|mcp__node-devtools__.*|mcp__backend-devtools__.*|mcp__android-devtools__.*",hooks:[{type:"command",command:`ironbee hook require-verification --client claude${r}`}]}),i.hooks.PreToolUse.push({matcher:"Write|Edit",hooks:[{type:"command",command:`ironbee hook require-verdict --client claude${r}`}]}),i.hooks.PostToolUse||(i.hooks.PostToolUse=[]),i.hooks.PostToolUse.push({matcher:"Write|Edit",hooks:[{type:"command",command:"ironbee hook clear-verdict --client claude"}]})),i.hooks.PostToolUse||(i.hooks.PostToolUse=[]);const l=o?"ironbee hook track-action --client claude":"ironbee hook track-action-monitor --client claude";i.hooks.PostToolUse.push({matcher:"",hooks:[{type:"command",command:l}]}),i.hooks.PostToolUseFailure||(i.hooks.PostToolUseFailure=[]),i.hooks.PostToolUseFailure.push({matcher:"",hooks:[{type:"command",command:l}]}),i.hooks.Stop||(i.hooks.Stop=[]);const d=n==="enforce"?"ironbee hook verify-gate --client claude":"ironbee hook activity-end --client claude";i.hooks.Stop.push({matcher:"",hooks:[{type:"command",command:d}]}),i.hooks.SessionEnd||(i.hooks.SessionEnd=[]),i.hooks.SessionEnd.push({matcher:"",hooks:[{type:"command",command:"ironbee hook session-end --client claude"}]}),(0,t.writeFileSync)(e,JSON.stringify(i,null,2))}removeIronBeeHooks(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(!n.hooks)return;for(const o of Object.keys(n.hooks)){const r=n.hooks[o].filter(i=>!this.isIronBeeHook(i));r.length===0?delete n.hooks[o]:n.hooks[o]=r}(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}catch(n){p.logger.debug(`failed to remove hooks from ${e}: ${n}`)}}removeMcpServer(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));let o=!1;n.mcpServers&&n.mcpServers[S]&&(delete n.mcpServers[S],o=!0),n.mcpServers&&n.mcpServers[h]&&(delete n.mcpServers[h],o=!0),n.mcpServers&&n.mcpServers[b]&&(delete n.mcpServers[b],o=!0),n.mcpServers&&n.mcpServers[E]&&(delete n.mcpServers[E],o=!0),N(n)?(0,t.unlinkSync)(e):o&&(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}catch(n){p.logger.debug(`failed to remove MCP server from ${e}: ${n}`)}}removePermission(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8")),o=`mcp__${S}__*`,r=`mcp__${h}__*`,i=`mcp__${b}__*`,l=`mcp__${E}__*`,d="Bash(ironbee *)",m="Bash(ironbee analyze)";n.permissions?.allow&&(n.permissions.allow=n.permissions.allow.filter(f=>f!==o&&f!==r&&f!==i&&f!==l&&f!==d&&f!==m),(0,t.writeFileSync)(e,JSON.stringify(n,null,2)))}catch(n){p.logger.debug(`failed to remove permission from ${e}: ${n}`)}}removeFile(e){(0,t.existsSync)(e)&&(0,t.unlinkSync)(e)}writeMcpConfig(e,n){let o={mcpServers:{}};if((0,t.existsSync)(e))try{o=JSON.parse((0,t.readFileSync)(e,"utf-8")),o.mcpServers||(o.mcpServers={})}catch(r){p.logger.debug(`failed to parse ${e}: ${r}`),o={mcpServers:{}}}if(delete o.mcpServers[S],delete o.mcpServers[h],delete o.mcpServers[b],delete o.mcpServers[E],N(o)){try{(0,t.rmSync)(e,{force:!0})}catch(r){p.logger.debug(`failed to remove empty ${e}: ${r}`)}return}(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}writePermissions(e,n,o){let r={};if((0,t.existsSync)(e))try{r=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(k){p.logger.debug(`failed to parse ${e}: ${k}`),r={}}r.permissions||(r.permissions={allow:[],deny:[]}),r.permissions.allow||(r.permissions.allow=[]);const i=`mcp__${S}__*`,l=`mcp__${h}__*`,d=`mcp__${b}__*`,m=`mcp__${E}__*`,f="Bash(ironbee *)",g="Bash(ironbee analyze)";if(n){const k=(0,u.loadConfig)(o);r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"browser"),i),r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"node"),l),r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"backend"),d),r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"android"),m),r.permissions.allow=r.permissions.allow.filter(O=>O!==g),r.permissions.allow.includes(f)||r.permissions.allow.push(f)}else r.permissions.allow=r.permissions.allow.filter(k=>k!==i&&k!==l&&k!==d&&k!==m&&k!==f&&k!==g);(0,t.writeFileSync)(e,JSON.stringify(r,null,2))}}function Ee(s){(0,t.mkdirSync)((0,c.join)(s,".ironbee"),{recursive:!0}),(0,P.ensureIronBeeGitignored)(s)}v(Ee,"prepareIronBeeDir");0&&(module.exports={ClaudeClient,prepareIronBeeDir});
5
+ `)}v(Se,"injectVerifierMcpServers");function ye(s,e){if(!e)return s;const n=s.split(`
6
+ `);if(n[0]!=="---")return s;let o=-1;for(let a=1;a<n.length;a++)if(n[a]==="---"){o=a;break}if(o<0)return s;const r=n.slice(0,o);if(r.some(a=>/^model\s*:/.test(a)))return s;const i=n.slice(o);return[...r,`model: ${e}`,...i].join(`
7
+ `)}v(ye,"injectVerifierModel");function he(s){const e=new Set(["hooks","permissions"]);for(const n of Object.keys(s))if(!e.has(n))return!1;if(s.hooks!==void 0&&Object.keys(s.hooks).length>0)return!1;if(s.permissions!==void 0){const n=s.permissions.allow??[],o=s.permissions.deny??[];if(n.length>0||o.length>0)return!1}return!0}v(he,"isClaudeSettingsEmpty");const be=["CLAUDE_CODE_ENABLE_TELEMETRY","OTEL_LOGS_EXPORTER","OTEL_METRICS_EXPORTER","OTEL_EXPORTER_OTLP_PROTOCOL","OTEL_EXPORTER_OTLP_ENDPOINT","OTEL_LOG_RAW_API_BODIES","OTEL_RESOURCE_ATTRIBUTES","OTEL_LOGS_EXPORT_INTERVAL"];function I(s){const e=s.OTEL_RESOURCE_ATTRIBUTES;return typeof e=="string"&&e.includes("ironbee.project_name")}v(I,"otelEnvOwnedByUs");function Ee(s){return s.replace(/[,=\s]+/g,"-").replace(/^-+|-+$/g,"")||"project"}v(Ee,"sanitizeResourceValue");class we{constructor(){this.name="claude";this.supportsVerifierModel=!0}static{v(this,"ClaudeClient")}detect(e){return(0,t.existsSync)((0,c.join)(e,".claude"))}resolveProjectDir(){return process.env.CLAUDE_PROJECT_DIR??process.cwd()}resolveAgentSessionId(e,n){const o=process.env.CLAUDE_CODE_SESSION_ID;return typeof o=="string"&&o.length>0?o:void 0}async runSessionStatus(){const{runSessionStatus:e}=await Promise.resolve().then(()=>ue(require("./hooks/session-status")));await e()}install(e,n){const o=n??(0,u.loadConfig)(e),r=(0,u.getVerificationMode)(o),i=r!=="monitor";this.cleanupArtifacts(e);const a=(0,c.join)(e,".claude"),d=(0,c.join)(a,"skills"),f=(0,c.join)(a,"rules"),m=(0,c.join)(a,"commands");(0,t.mkdirSync)(d,{recursive:!0}),(0,t.mkdirSync)(f,{recursive:!0}),(0,t.mkdirSync)(m,{recursive:!0});const g=(0,c.join)(a,"settings.json");if(this.mergeHooksConfig(g,r),this.writePermissions(g,i,e),(0,u.isOTELEnabled)(o)&&this.writeOTELEnv(g,e,o),this.installStatusLine(e,o),i){if(r==="enforce"){const $=(0,c.join)(d,"ironbee-verification.md"),ne=(0,t.readFileSync)((0,c.join)(__dirname,"skills","ironbee-verification.md"),"utf-8");(0,t.writeFileSync)($,ne);const oe=(0,c.join)(f,"ironbee-verification.md"),re=(0,t.readFileSync)((0,c.join)(__dirname,"rules","ironbee-verification.md"),"utf-8");(0,t.writeFileSync)(oe,re)}const k=(0,c.join)(m,"ironbee-verify.md"),O=(0,t.readFileSync)((0,c.join)(__dirname,"commands","ironbee-verify.md"),"utf-8");(0,t.writeFileSync)(k,O);const R=(0,c.join)(a,"agents");(0,t.mkdirSync)(R,{recursive:!0});const K=(0,c.join)(R,"ironbee-verifier.md"),Q=(0,t.readFileSync)((0,c.join)(__dirname,"agents","ironbee-verifier.md"),"utf-8"),Z=Se(Q,ve(e,o)),ee=ye(Z,(0,u.getVerificationModel)(o,"claude"));(0,t.writeFileSync)(K,ee);const L=(0,c.join)(e,".mcp.json");if(this.writeMcpConfig(L,e),(0,Y.syncPlatformSectionsToConfig)(e,pe),(0,u.isAutoModeAllowlistEnabled)(o)){const $=(0,c.join)(a,"settings.local.json");this.writeAutoModeAllowlist($)}console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} settings ${l.pc.dim("\u2192")} ${l.pc.dim(g)}`),r==="enforce"?(console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} skills ${l.pc.dim("\u2192")} ${l.pc.dim(d)}`),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} rule ${l.pc.dim("\u2192")} ${l.pc.dim(f)}`)):console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} ${l.pc.yellow("assist mode")} (verification.auto: false) \u2014 manual /ironbee-verify only, no enforcement`),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} commands ${l.pc.dim("\u2192")} ${l.pc.dim(m)}`),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} agents ${l.pc.dim("\u2192")} ${l.pc.dim((0,c.join)(a,"agents"))}`),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} mcp ${l.pc.dim("\u2192")} ${l.pc.dim(L)}`)}else console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} ${l.pc.yellow("monitoring-only mode")} (verification.enable: false)`),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} settings ${l.pc.dim("\u2192")} ${l.pc.dim(g)}`)}uninstall(e){this.cleanupArtifacts(e),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} removed hooks, skill, rule, command, MCP, and permissions`)}cleanupArtifacts(e){const n=(0,c.join)(e,".claude"),o=(0,c.join)(n,"skills","ironbee-verification.md"),r=(0,c.join)(n,"skills","ironbee-analyze.md"),i=(0,c.join)(n,"rules","ironbee-verification.md"),a=(0,c.join)(n,"commands","ironbee-analyze.md"),d=(0,c.join)(n,"commands","ironbee-verify.md"),f=(0,c.join)(n,"agents","ironbee-verifier.md");this.removeFile(o),this.removeFile(r),this.removeFile(i),this.removeFile(a),this.removeFile(d),this.removeFile(f);const m=(0,c.join)(n,"settings.json");this.removeIronBeeHooks(m),this.removePermission(m),this.removeOTELEnv(m),this.maybeDeleteEmptySettings(m);const g=(0,c.join)(e,".mcp.json");this.removeMcpServer(g),this.removeAutoModeAllowlist((0,c.join)(n,"settings.local.json")),this.uninstallStatusLine(e),(0,B.pruneEmptyDirs)(n)}installStatusLine(e,n){if(!(0,u.isSessionStatusEnabled)(n))return;const o=(0,c.join)(e,".claude","settings.local.json"),r=this.readStatusLineBlock(o);r&&!(0,T.isIronbeeStatusLine)(r.command)&&(0,S.readStatusLineSnapshot)(e,"claude")===void 0&&(0,S.upsertStatusLineSnapshot)(e,"claude",r);const i={type:"command",command:fe},a=(0,u.getStatusLineRefreshInterval)(n);a!==void 0&&(i.refreshInterval=a),this.writeStatusLineBlock(o,i),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} statusline ${l.pc.dim("\u2192")} ${l.pc.dim(o)}`)}uninstallStatusLine(e){const n=(0,c.join)(e,".claude","settings.local.json"),o=(0,S.readStatusLineSnapshot)(e,"claude");if(o){this.writeStatusLineBlock(n,o),(0,S.clearStatusLineSnapshot)(e,"claude");return}const r=this.readStatusLineBlock(n);r&&(0,T.isIronbeeStatusLine)(r.command)&&this.removeStatusLineBlock(n)}readStatusLineBlock(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(n===null||typeof n!="object")return;const o=n.statusLine;if(o===null||typeof o!="object")return;const r=o.command;if(typeof r!="string"||r.length===0)return;const i=o.padding,a=o.refreshInterval,d={type:"command",command:r};return typeof i=="number"&&(d.padding=i),typeof a=="number"&&(d.refreshInterval=a),d}catch(n){p.logger.debug(`failed to read statusLine from ${e}: ${n}`);return}}writeStatusLineBlock(e,n){let o={};if((0,t.existsSync)(e))try{const r=JSON.parse((0,t.readFileSync)(e,"utf-8"));r!==null&&typeof r=="object"&&!Array.isArray(r)&&(o=r)}catch(r){p.logger.debug(`failed to read ${e} for statusLine write: ${r}`)}else(0,t.mkdirSync)((0,c.join)(e,".."),{recursive:!0});o.statusLine=n,(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}removeStatusLineBlock(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(n===null||typeof n!="object"||Array.isArray(n))return;const o=n;delete o.statusLine,Object.keys(o).length===0?(0,t.unlinkSync)(e):(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}catch(n){p.logger.debug(`failed to remove statusLine from ${e}: ${n}`)}}writeAutoModeAllowlist(e){let n={};if((0,t.existsSync)(e))try{n=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(d){p.logger.debug(`failed to parse ${e} for autoMode allowlist: ${d}`);return}else(0,t.mkdirSync)((0,c.join)(e,".."),{recursive:!0});const o=n.autoMode!==null&&typeof n.autoMode=="object"&&!Array.isArray(n.autoMode)?n.autoMode:{},r=Array.isArray(o.allow)?o.allow.filter(d=>typeof d=="string"):[],i=r.filter(d=>!d.includes(C)),a=r.length===0?[M]:i;o.allow=[...a,ge],n.autoMode=o,(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}removeAutoModeAllowlist(e){if(!(0,t.existsSync)(e))return;let n;try{n=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(d){p.logger.debug(`failed to parse ${e} for autoMode strip: ${d}`);return}if(n.autoMode===null||typeof n.autoMode!="object"||Array.isArray(n.autoMode))return;const o=n.autoMode;if(!Array.isArray(o.allow))return;const r=o.allow.filter(d=>typeof d=="string"),i=r.filter(d=>!d.includes(C));if(i.length===r.length)return;i.length===0||i.length===1&&i[0]===M?delete o.allow:o.allow=i,Object.keys(o).length===0?delete n.autoMode:n.autoMode=o,Object.keys(n).length===0?(0,t.unlinkSync)(e):(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}writeOTELEnv(e,n,o){let r={};if((0,t.existsSync)(e))try{const g=JSON.parse((0,t.readFileSync)(e,"utf-8"));g!==null&&typeof g=="object"&&!Array.isArray(g)&&(r=g)}catch(g){p.logger.debug(`failed to read ${e} for otel env write: ${g}`)}else(0,t.mkdirSync)((0,c.join)(e,".."),{recursive:!0});const i=r.env,a=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{},d=a.OTEL_EXPORTER_OTLP_ENDPOINT;if(typeof d=="string"&&d.length>0&&!I(a)){console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} ${l.pc.yellow("existing OTEL telemetry env detected \u2014 left untouched (session_context not wired for this project)")}`);return}const f=(0,u.getOTELPort)(o),m=Ee((0,z.resolveProjectName)(n));a.CLAUDE_CODE_ENABLE_TELEMETRY="1",a.OTEL_LOGS_EXPORTER="otlp",a.OTEL_METRICS_EXPORTER="none",a.OTEL_EXPORTER_OTLP_PROTOCOL="http/json",a.OTEL_EXPORTER_OTLP_ENDPOINT=`http://127.0.0.1:${f}`,a.OTEL_LOG_RAW_API_BODIES="file:.ironbee/otel",a.OTEL_RESOURCE_ATTRIBUTES=`ironbee.project_name=${m}`,a.OTEL_LOGS_EXPORT_INTERVAL="5000",r.env=a,(0,t.writeFileSync)(e,JSON.stringify(r,null,2)),console.log(` ${l.pc.dim("\u2192")} ${(0,l.orange)("[claude]")} otel env ${l.pc.dim("\u2192")} ${l.pc.dim(`${e} (127.0.0.1:${f})`)}`)}removeOTELEnv(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(n===null||typeof n!="object"||Array.isArray(n))return;const o=n,r=o.env;if(r===null||typeof r!="object"||Array.isArray(r))return;const i=r;if(!I(i))return;for(const a of be)delete i[a];Object.keys(i).length===0&&delete o.env,(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}catch(n){p.logger.debug(`failed to remove otel env from ${e}: ${n}`)}}maybeDeleteEmptySettings(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));he(n)&&(0,t.unlinkSync)(e)}catch(n){p.logger.debug(`failed to inspect ${e} for emptiness: ${n}`)}}async runVerifyGate(e){await(0,U.run)(e)}async runClearVerdict(e){await(0,j.run)(e)}async runTrackAction(e){await(0,V.run)(e)}async runSessionStart(e){await(0,J.run)(e)}async runSubagentStart(e){await(0,W.run)(e)}async runSubagentStop(e){await(0,q.run)(e)}async runRequireVerdict(e,n){await(0,D.run)(e,n)}async runRequireVerification(e,n){await(0,F.run)(e,n)}async runActivityStart(e){await(0,x.run)(e)}async runActivityEnd(e){await(0,X.run)(e)}async runTrackActionMonitor(e){await(0,H.run)(e)}async runSessionEnd(e){await(0,G.run)(e)}async runTrackActionPre(e){}isIronBeeHook(e){return e.hooks.some(n=>n.command.includes(me))}mergeHooksConfig(e,n){const o=n!=="monitor",r=n==="assist"?" --soft":"";let i={};if((0,t.existsSync)(e))try{i=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(f){p.logger.debug(`failed to parse ${e}: ${f}`),i={}}i.hooks||(i.hooks={});for(const f of Object.keys(i.hooks)){const m=i.hooks[f].filter(g=>!this.isIronBeeHook(g));m.length===0?delete i.hooks[f]:i.hooks[f]=m}i.hooks.SessionStart||(i.hooks.SessionStart=[]),i.hooks.SessionStart.push({matcher:"",hooks:[{type:"command",command:"ironbee hook session-start --client claude"}]}),i.hooks.UserPromptSubmit||(i.hooks.UserPromptSubmit=[]),i.hooks.UserPromptSubmit.push({matcher:"",hooks:[{type:"command",command:"ironbee hook activity-start --client claude"}]}),o&&(i.hooks.PreToolUse||(i.hooks.PreToolUse=[]),i.hooks.PreToolUse.push({matcher:"mcp__browser-devtools__.*|mcp__node-devtools__.*|mcp__backend-devtools__.*|mcp__android-devtools__.*",hooks:[{type:"command",command:`ironbee hook require-verification --client claude${r}`}]}),i.hooks.PreToolUse.push({matcher:"Write|Edit",hooks:[{type:"command",command:`ironbee hook require-verdict --client claude${r}`}]}),i.hooks.PostToolUse||(i.hooks.PostToolUse=[]),i.hooks.PostToolUse.push({matcher:"Write|Edit",hooks:[{type:"command",command:"ironbee hook clear-verdict --client claude"}]})),i.hooks.PostToolUse||(i.hooks.PostToolUse=[]);const a=o?"ironbee hook track-action --client claude":"ironbee hook track-action-monitor --client claude";i.hooks.PostToolUse.push({matcher:"",hooks:[{type:"command",command:a}]}),i.hooks.PostToolUseFailure||(i.hooks.PostToolUseFailure=[]),i.hooks.PostToolUseFailure.push({matcher:"",hooks:[{type:"command",command:a}]}),i.hooks.Stop||(i.hooks.Stop=[]);const d=n==="enforce"?"ironbee hook verify-gate --client claude":"ironbee hook activity-end --client claude";i.hooks.Stop.push({matcher:"",hooks:[{type:"command",command:d}]}),i.hooks.SubagentStart||(i.hooks.SubagentStart=[]),i.hooks.SubagentStart.push({matcher:"",hooks:[{type:"command",command:"ironbee hook subagent-start --client claude"}]}),i.hooks.SubagentStop||(i.hooks.SubagentStop=[]),i.hooks.SubagentStop.push({matcher:"",hooks:[{type:"command",command:"ironbee hook subagent-stop --client claude"}]}),i.hooks.SessionEnd||(i.hooks.SessionEnd=[]),i.hooks.SessionEnd.push({matcher:"",hooks:[{type:"command",command:"ironbee hook session-end --client claude"}]}),(0,t.writeFileSync)(e,JSON.stringify(i,null,2))}removeIronBeeHooks(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));if(!n.hooks)return;for(const o of Object.keys(n.hooks)){const r=n.hooks[o].filter(i=>!this.isIronBeeHook(i));r.length===0?delete n.hooks[o]:n.hooks[o]=r}(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}catch(n){p.logger.debug(`failed to remove hooks from ${e}: ${n}`)}}removeMcpServer(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8"));let o=!1;n.mcpServers&&n.mcpServers[y]&&(delete n.mcpServers[y],o=!0),n.mcpServers&&n.mcpServers[h]&&(delete n.mcpServers[h],o=!0),n.mcpServers&&n.mcpServers[b]&&(delete n.mcpServers[b],o=!0),n.mcpServers&&n.mcpServers[E]&&(delete n.mcpServers[E],o=!0),N(n)?(0,t.unlinkSync)(e):o&&(0,t.writeFileSync)(e,JSON.stringify(n,null,2))}catch(n){p.logger.debug(`failed to remove MCP server from ${e}: ${n}`)}}removePermission(e){if((0,t.existsSync)(e))try{const n=JSON.parse((0,t.readFileSync)(e,"utf-8")),o=`mcp__${y}__*`,r=`mcp__${h}__*`,i=`mcp__${b}__*`,a=`mcp__${E}__*`,d="Bash(ironbee *)",f="Bash(ironbee analyze)";n.permissions?.allow&&(n.permissions.allow=n.permissions.allow.filter(m=>m!==o&&m!==r&&m!==i&&m!==a&&m!==d&&m!==f),(0,t.writeFileSync)(e,JSON.stringify(n,null,2)))}catch(n){p.logger.debug(`failed to remove permission from ${e}: ${n}`)}}removeFile(e){(0,t.existsSync)(e)&&(0,t.unlinkSync)(e)}writeMcpConfig(e,n){let o={mcpServers:{}};if((0,t.existsSync)(e))try{o=JSON.parse((0,t.readFileSync)(e,"utf-8")),o.mcpServers||(o.mcpServers={})}catch(r){p.logger.debug(`failed to parse ${e}: ${r}`),o={mcpServers:{}}}if(delete o.mcpServers[y],delete o.mcpServers[h],delete o.mcpServers[b],delete o.mcpServers[E],N(o)){try{(0,t.rmSync)(e,{force:!0})}catch(r){p.logger.debug(`failed to remove empty ${e}: ${r}`)}return}(0,t.writeFileSync)(e,JSON.stringify(o,null,2))}writePermissions(e,n,o){let r={};if((0,t.existsSync)(e))try{r=JSON.parse((0,t.readFileSync)(e,"utf-8"))}catch(k){p.logger.debug(`failed to parse ${e}: ${k}`),r={}}r.permissions||(r.permissions={allow:[],deny:[]}),r.permissions.allow||(r.permissions.allow=[]);const i=`mcp__${y}__*`,a=`mcp__${h}__*`,d=`mcp__${b}__*`,f=`mcp__${E}__*`,m="Bash(ironbee *)",g="Bash(ironbee analyze)";if(n){const k=(0,u.loadConfig)(o);r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"browser"),i),r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"node"),a),r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"backend"),d),r.permissions.allow=_(r.permissions.allow,(0,u.isCycleEnabled)(k,"android"),f),r.permissions.allow=r.permissions.allow.filter(O=>O!==g),r.permissions.allow.includes(m)||r.permissions.allow.push(m)}else r.permissions.allow=r.permissions.allow.filter(k=>k!==i&&k!==a&&k!==d&&k!==f&&k!==m&&k!==g);(0,t.writeFileSync)(e,JSON.stringify(r,null,2))}}function _e(s){(0,t.mkdirSync)((0,c.join)(s,".ironbee"),{recursive:!0}),(0,P.ensureIronBeeGitignored)(s)}v(_e,"prepareIronBeeDir");0&&(module.exports={ClaudeClient,prepareIronBeeDir});
@@ -1,6 +1,6 @@
1
1
  You MUST verify all code changes before completing any task — by DELEGATING to the `ironbee-verifier` sub-agent. You do not have the verification tools; the verifier does. Never verify inline.
2
2
 
3
- After editing code, before reporting completion: spawn the `ironbee-verifier` sub-agent via the Agent/Task tool (`subagent_type: "ironbee-verifier"`) with a prompt describing what to verify. It drives the verification tools, exercises every active cycle (browser / runtime / backend, as wired up for this project), and submits the single verdict in this shared session — then returns a summary. Relay it.
3
+ After editing code, before reporting completion: spawn the `ironbee-verifier` sub-agent via the Agent/Task tool (`subagent_type: "ironbee-verifier"`) with a prompt describing what to verify. It drives the verification tools, exercises every active cycle (browser / runtime / backend, as wired up for this project), and submits the single verdict in this shared session — then returns a summary. Relay it. **Wait for the verifier in the same turn — do NOT background it; if it is backgrounded your turn can end before its verdict is recorded, leaving your changes unverified.**
4
4
 
5
5
  If verification FAILS: fix the issues the verifier reported, optionally record what you fixed (`echo '{"fixes":["what you repaired"]}' | ironbee hook record-fix`), then re-delegate until it passes. Every code edit (Write/Edit) clears the verdict, requiring re-delegation.
6
6
 
@@ -12,3 +12,4 @@ The Stop gate blocks completion until a verdict exists for your changes — dele
12
12
  - Reporting a task complete without delegating verification of your changes.
13
13
  - Submitting a verdict based on assumptions, code reading, or prior knowledge — the verifier verifies through real tools.
14
14
  - Writing `verdict.json` directly.
15
+ - Backgrounding the verifier sub-agent, or ending your turn before it returns its verdict — wait for it in the same turn.
@@ -21,6 +21,9 @@ relay its verdict; on fail, fix the reported issues and re-delegate until it pas
21
21
  prompt like *"Verify the recent changes"* (optionally describe what changed, or pass a
22
22
  scenario). It drives the verification tools, exercises every active cycle, and submits the
23
23
  single verdict in this **shared session** — then returns a short summary.
24
+ **Wait for it in the same turn — do NOT background the verifier.** Let it run to completion
25
+ and read its verdict before you respond. If the verifier is backgrounded, your turn can end
26
+ (and the Stop gate fire) before its verdict is recorded, leaving your changes unverified.
24
27
  3. **Relay the verdict.** If it FAILED: fix the issues it reported. Optionally record what you
25
28
  fixed so the next pass verdict can describe it:
26
29
  ```
@@ -36,6 +39,8 @@ you can't verify inline, delegation is the only path forward.
36
39
  `ironbee hook verification-start` / `submit-verdict` — those are the verifier's job. Delegate.
37
40
  - Reporting a task complete without delegating verification of your changes.
38
41
  - Claiming verification passed based on code reading, assumptions, or prior knowledge.
42
+ - Backgrounding the verifier sub-agent (or ending your turn before it returns its verdict) —
43
+ wait for it to finish in the same turn.
39
44
 
40
45
  ## Subagent teams
41
46
  - Implementation subagents write code; they do NOT verify.
@@ -11,6 +11,8 @@ After you edit code (or whenever asked to "verify"), **spawn the `ironbee-verifi
11
11
 
12
12
  You (the main agent) do **not** have the devtools tools and must not try to drive them. Your job is to edit code, spawn the verifier to verify, and — if it reports a fail — fix the issues and re-spawn it.
13
13
 
14
+ **Wait for the verifier in the same turn — do NOT background it.** Let it run to completion and read its verdict before you respond; a backgrounded verifier can let your turn end (and the Stop gate fire) before its verdict is recorded, leaving your changes unverified.
15
+
14
16
  ## After a fail → fix → record → re-verify
15
17
 
16
18
  1. The verifier returns a fail verdict with `issues`.
@@ -25,6 +27,7 @@ You (the main agent) do **not** have the devtools tools and must not try to driv
25
27
 
26
28
  - Verifying inline / driving devtools tools yourself — always delegate to the `ironbee-verifier` custom agent.
27
29
  - "Act as ironbee-verifier" free-text spawns — spawn the custom agent by `agent_type` so it loads its tools.
30
+ - Backgrounding the verifier, or ending your turn before it returns its verdict — wait for it in the same turn.
28
31
  - Writing `verdict.json` directly, or completing a task with unverified code changes.
29
32
 
30
33
  The Stop gate blocks completion until the verifier has exercised every active cycle's tools and submitted a verdict with non-empty `checks`. Every code edit clears the prior verdict, requiring a fresh verification.
@@ -1,24 +1,24 @@
1
- "use strict";var g=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(i,e)=>g(i,"name",{value:e,configurable:!0});var x=(i,e)=>{for(var t in e)g(i,t,{get:e[t],enumerable:!0})},P=(i,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of j(e))!C.call(i,n)&&n!==t&&g(i,n,{get:()=>e[n],enumerable:!(o=N(e,n))||o.enumerable});return i};var D=i=>P(g({},"__esModule",{value:!0}),i);var _={};x(_,{hookCommand:()=>r});module.exports=D(_);var w=require("commander"),h=require("../clients/registry"),k=require("../hooks/core/submit-verdict"),y=require("../hooks/core/verification-lifecycle"),u=require("../lib/config"),l=require("../lib/logger"),d=require("../lib/output"),m=require("../lib/stdin"),S=require("../hooks/core/session-state"),f=require("../clients/session-id"),v=require("../clients/agent-project-dir");function p(i,e){return(0,u.getVerificationEnabled)((0,u.loadConfig)(i))?!1:(l.logger.debug(`${e}: verification is disabled \u2014 silent no-op`),!0)}b(p,"isVerificationDisabled");function s(i){const e=i??process.env.IRONBEE_CLIENT;e||(process.stderr.write(`Error: client not specified. Use --client <name> or set IRONBEE_CLIENT env var.
2
- `),process.exit(1));const t=(0,h.findClient)(e);return t||(process.stderr.write(`Error: unknown client "${e}". Run \`ironbee install\` to set up.
3
- `),process.exit(1)),t}b(s,"resolveClient");const r=new w.Command("hook").description("Internal hook runners (invoked by the AI coding client)");r.command("verify-gate").description("Stop hook \u2014 gates task completion until browser verification passes").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runVerifyGate(t)}),r.command("clear-verdict").description("PostToolUse hook \u2014 clears stale verdict after code edits").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runClearVerdict(t)}),r.command("track-action").description("PostToolUse hook \u2014 tracks browser-devtools tool calls in actions.jsonl").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runTrackAction(t)}),r.command("track-action-monitor").description("PostToolUse hook (monitoring-only mode) \u2014 submits send_event jobs for non-devtools tools and falls back to starting an activity if needed").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runTrackActionMonitor(t)}),r.command("track-action-pre").description("Codex PreToolUse hook \u2014 stashes a hrtime timestamp keyed by tool_use_id so the matching PostToolUse can derive tool_call.duration (Codex hook stdin does not carry duration_ms). No-op on Claude/Cursor \u2014 their hosts provide duration natively.").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runTrackActionPre(t)}),r.command("subagent-start").description("Codex SubagentStart hook \u2014 writes the agent_id \u2192 parent session_id bridge (codex-threads.json) so a delegated verifier sub-agent's agent-Bash commands resolve the session from CODEX_THREAD_ID. Codex-only.").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSubagentStart?.(t)}),r.command("subagent-stop").description("Codex SubagentStop hook \u2014 prunes the thread map entry and records the sub-agent's agent_transcript_path for the analytics sub-agent fold. Codex-only.").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSubagentStop?.(t)}),r.command("activity-end").description("Stop hook (monitoring-only mode) \u2014 closes the active activity and triggers a background queue flush").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runActivityEnd(t)}),r.command("session-start").description("SessionStart hook \u2014 records session start in actions.jsonl").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSessionStart(t)}),r.command("session-status").description("Statusline command (Claude) \u2014 emits a session_status event and chains the user's original statusline").action(async()=>{await(0,h.findClient)("claude")?.runSessionStatus?.()}),r.command("require-verdict").description("PreToolUse hook \u2014 blocks file edits until verdict is submitted after browser tool usage").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").option("--soft","non-blocking assist-mode variant: stash file_change state but never block the edit").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runRequireVerdict(t,{soft:i.soft===!0})}),r.command("session-end").description("SessionEnd hook \u2014 records session end in actions.jsonl").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSessionEnd(t)}),r.command("activity-start").description("UserPromptSubmit/beforeSubmitPrompt hook \u2014 starts activity tracking on each agent turn").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runActivityStart(t)}),r.command("require-verification").description("PreToolUse hook \u2014 blocks browser tools until verification-start is called").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").option("--soft","non-blocking assist-mode variant: inject _metadata but never block the devtools call").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runRequireVerification(t,{soft:i.soft===!0})}),r.command("verification-start").description(`Start a verification cycle (called by agent via Bash). Optional --intent flag: "fix" arms the verify-gate's fix-until-pass backstop (a fail verdict keeps blocking even in a zero-edit window); "report" or omitted = verify-only run (clears any stale intent \u2014 "report" is a tolerated alias of omitting the flag, mirroring the command's mode token).`).option("--intent <mode>",'declared intent of this verification run: "fix" or "report"').action(async i=>{const e=(0,v.resolveAgentProjectDir)();if(p(e,"verification-start")){(0,d.writeAndExit)(JSON.stringify({message:"verification is disabled in this project; ignoring"})+`
1
+ "use strict";var p=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var b=(i,e)=>p(i,"name",{value:e,configurable:!0});var P=(i,e)=>{for(var t in e)p(i,t,{get:e[t],enumerable:!0})},x=(i,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of N(e))!C.call(i,n)&&n!==t&&p(i,n,{get:()=>e[n],enumerable:!(o=j(e,n))||o.enumerable});return i};var D=i=>x(p({},"__esModule",{value:!0}),i);var _={};P(_,{hookCommand:()=>r});module.exports=D(_);var I=require("commander"),E=require("../clients/registry"),S=require("../hooks/core/submit-verdict"),h=require("../hooks/core/verification-lifecycle"),u=require("../lib/config"),l=require("../lib/logger"),d=require("../lib/output"),m=require("../lib/stdin"),k=require("../hooks/core/session-state"),v=require("../clients/session-id"),f=require("../clients/agent-project-dir");function g(i,e){return(0,u.getVerificationEnabled)((0,u.loadConfig)(i))?!1:(l.logger.debug(`${e}: verification is disabled \u2014 silent no-op`),!0)}b(g,"isVerificationDisabled");function s(i){const e=i??process.env.IRONBEE_CLIENT;e||(process.stderr.write(`Error: client not specified. Use --client <name> or set IRONBEE_CLIENT env var.
2
+ `),process.exit(1));const t=(0,E.findClient)(e);return t||(process.stderr.write(`Error: unknown client "${e}". Run \`ironbee install\` to set up.
3
+ `),process.exit(1)),t}b(s,"resolveClient");const r=new I.Command("hook").description("Internal hook runners (invoked by the AI coding client)");r.command("verify-gate").description("Stop hook \u2014 gates task completion until browser verification passes").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runVerifyGate(t)}),r.command("clear-verdict").description("PostToolUse hook \u2014 clears stale verdict after code edits").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runClearVerdict(t)}),r.command("track-action").description("PostToolUse hook \u2014 tracks browser-devtools tool calls in actions.jsonl").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runTrackAction(t)}),r.command("track-action-monitor").description("PostToolUse hook (monitoring-only mode) \u2014 submits send_event jobs for non-devtools tools and falls back to starting an activity if needed").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runTrackActionMonitor(t)}),r.command("track-action-pre").description("Codex PreToolUse hook \u2014 stashes a hrtime timestamp keyed by tool_use_id so the matching PostToolUse can derive tool_call.duration (Codex hook stdin does not carry duration_ms). No-op on Claude/Cursor \u2014 their hosts provide duration natively.").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runTrackActionPre(t)}),r.command("subagent-start").description("SubagentStart hook \u2014 dispatched per client via IClient.runSubagentStart. Codex: writes the agent_id \u2192 parent session_id bridge (codex-threads.json). Claude: joins the sub-agent as an activity participant so the activity closes only when the last participant (main + all sub-agents) leaves.").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSubagentStart?.(t)}),r.command("subagent-stop").description("SubagentStop hook \u2014 dispatched per client via IClient.runSubagentStop. Codex: prune the thread map + record the sub-agent's agent_transcript_path for the analytics fold. Claude: backstop that closes a verifier-owned activity/cycle the sub-agent left open without a verdict.").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSubagentStop?.(t)}),r.command("activity-end").description("Stop hook (monitoring-only mode) \u2014 closes the active activity and triggers a background queue flush").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runActivityEnd(t)}),r.command("session-start").description("SessionStart hook \u2014 records session start in actions.jsonl").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSessionStart(t)}),r.command("session-status").description("Statusline command (Claude) \u2014 emits a session_status event and chains the user's original statusline").action(async()=>{await(0,E.findClient)("claude")?.runSessionStatus?.()}),r.command("require-verdict").description("PreToolUse hook \u2014 blocks file edits until verdict is submitted after browser tool usage").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").option("--soft","non-blocking assist-mode variant: stash file_change state but never block the edit").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runRequireVerdict(t,{soft:i.soft===!0})}),r.command("session-end").description("SessionEnd hook \u2014 records session end in actions.jsonl").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runSessionEnd(t)}),r.command("activity-start").description("UserPromptSubmit/beforeSubmitPrompt hook \u2014 starts activity tracking on each agent turn").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runActivityStart(t)}),r.command("require-verification").description("PreToolUse hook \u2014 blocks browser tools until verification-start is called").option("--client <name>","client name (overrides IRONBEE_CLIENT env var)").option("--soft","non-blocking assist-mode variant: inject _metadata but never block the devtools call").action(async i=>{const e=s(i.client);if(!e)return;const t=e.resolveProjectDir();await e.runRequireVerification(t,{soft:i.soft===!0})}),r.command("verification-start").description(`Start a verification cycle (called by agent via Bash). Optional --intent flag: "fix" arms the verify-gate's fix-until-pass backstop (a fail verdict keeps blocking even in a zero-edit window); "report" or omitted = verify-only run (clears any stale intent \u2014 "report" is a tolerated alias of omitting the flag, mirroring the command's mode token).`).option("--intent <mode>",'declared intent of this verification run: "fix" or "report"').action(async i=>{const e=(0,f.resolveAgentProjectDir)();if(g(e,"verification-start")){(0,d.writeAndExit)(JSON.stringify({message:"verification is disabled in this project; ignoring"})+`
4
4
  `,0);return}i.intent!==void 0&&i.intent!=="fix"&&i.intent!=="report"&&(process.stderr.write(`Error: --intent must be "fix" or "report".
5
5
  `),process.exit(1));const t=i.intent;let o;try{o=JSON.parse((0,m.readStdin)())}catch{process.stderr.write(`Error: no JSON provided via stdin.
6
- `),process.exit(1)}const n=(0,f.resolveAgentSessionId)(o,e);n||(process.stderr.write(`Error: JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
7
- `),process.exit(1));const c=`${e}/.ironbee/sessions/${n}`;(0,l.setLogFile)(`${c}/session.log`);const a=(0,u.isRecordingEnabled)(e),I=await(0,y.startVerification)({sessionId:n,sessionDir:c,actionsFile:`${c}/actions.jsonl`,recordingEnabled:a,intent:t}),E={verification_id:I.verificationId,trace_id:I.traceId};a&&(E.recording_required=!0,E.message="Recording is required. Call bdt_content_start-recording BEFORE using any other browser tools."),(0,d.writeAndExit)(JSON.stringify(E)+`
8
- `,0)}),r.command("verification-end").description("End a verification cycle (called by agent via Bash)").action(async()=>{const i=(0,v.resolveAgentProjectDir)();if(p(i,"verification-end")){(0,d.writeAndExit)(JSON.stringify({message:"verification is disabled in this project; ignoring"})+`
6
+ `),process.exit(1)}const n=(0,v.resolveAgentSessionId)(o,e);n||(process.stderr.write(`Error: JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
7
+ `),process.exit(1));const c=`${e}/.ironbee/sessions/${n}`;(0,l.setLogFile)(`${c}/session.log`);const a=(0,u.isRecordingEnabled)(e),w=await(0,h.startVerification)({sessionId:n,sessionDir:c,actionsFile:`${c}/actions.jsonl`,recordingEnabled:a,intent:t}),y={verification_id:w.verificationId,trace_id:w.traceId};a&&(y.recording_required=!0,y.message="Recording is required. Call bdt_content_start-recording BEFORE using any other browser tools."),(0,d.writeAndExit)(JSON.stringify(y)+`
8
+ `,0)}),r.command("verification-end").description("End a verification cycle (called by agent via Bash)").action(async()=>{const i=(0,f.resolveAgentProjectDir)();if(g(i,"verification-end")){(0,d.writeAndExit)(JSON.stringify({message:"verification is disabled in this project; ignoring"})+`
9
9
  `,0);return}let e;try{e=JSON.parse((0,m.readStdin)())}catch{process.stderr.write(`Error: no JSON provided via stdin.
10
- `),process.exit(1)}const t=(0,f.resolveAgentSessionId)(e,i);t||(process.stderr.write(`Error: JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
11
- `),process.exit(1));const o=`${i}/.ironbee/sessions/${t}`;(0,l.setLogFile)(`${o}/session.log`);const n=await(0,y.endVerification)({sessionId:t,sessionDir:o,actionsFile:`${o}/actions.jsonl`});n.success?(0,d.writeAndExit)(JSON.stringify({verification_id:n.verificationId,trace_id:n.traceId})+`
10
+ `),process.exit(1)}const t=(0,v.resolveAgentSessionId)(e,i);t||(process.stderr.write(`Error: JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
11
+ `),process.exit(1));const o=`${i}/.ironbee/sessions/${t}`;(0,l.setLogFile)(`${o}/session.log`);const n=await(0,h.endVerification)({sessionId:t,sessionDir:o,actionsFile:`${o}/actions.jsonl`});n.success?(0,d.writeAndExit)(JSON.stringify({verification_id:n.verificationId,trace_id:n.traceId})+`
12
12
  `,0):(process.stderr.write(n.message+`
13
- `),process.exit(1))}),r.command("submit-verdict").description("Submit verification verdict (called by agent via Bash)").option("--project-dir <dir>","project directory (overrides env vars)").action(async i=>{const e=(0,v.resolveAgentProjectDir)(i.projectDir);if(p(e,"submit-verdict")){(0,d.writeAndExit)(`verification is disabled in this project; verdict ignored
13
+ `),process.exit(1))}),r.command("submit-verdict").description("Submit verification verdict (called by agent via Bash)").option("--project-dir <dir>","project directory (overrides env vars)").action(async i=>{const e=(0,f.resolveAgentProjectDir)(i.projectDir);if(g(e,"submit-verdict")){(0,d.writeAndExit)(`verification is disabled in this project; verdict ignored
14
14
  `,0);return}let t;try{t=(0,m.readStdin)()}catch{process.stderr.write(`Error: no verdict JSON provided via stdin.
15
15
  `),process.exit(1)}let o;try{o=JSON.parse(t)}catch{process.stderr.write(`Error: verdict is not valid JSON.
16
- `),process.exit(1)}const n=(0,f.resolveAgentSessionId)(o,e);n||(process.stderr.write(`Error: verdict JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
17
- `),process.exit(1));const c=`${e}/.ironbee/sessions/${n}`;(0,l.setLogFile)(`${c}/session.log`);const a=await(0,k.runSubmitVerdict)({sessionId:n,sessionDir:c,verdictFile:`${c}/verdict.json`,actionsFile:`${c}/actions.jsonl`,verdictJson:t,projectDir:e});a.success?(0,d.writeAndExit)(a.message+`
16
+ `),process.exit(1)}const n=(0,v.resolveAgentSessionId)(o,e);n||(process.stderr.write(`Error: verdict JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
17
+ `),process.exit(1));const c=`${e}/.ironbee/sessions/${n}`;(0,l.setLogFile)(`${c}/session.log`);const a=await(0,S.runSubmitVerdict)({sessionId:n,sessionDir:c,verdictFile:`${c}/verdict.json`,actionsFile:`${c}/actions.jsonl`,verdictJson:t,projectDir:e});a.success?(0,d.writeAndExit)(a.message+`
18
18
  `,0):(process.stderr.write(a.message+`
19
- `),process.exit(1))}),r.command("record-fix").description("Record what was fixed after a fail verdict (called by agent via Bash). Stashed locally in state.json; merged into the next pass verdict's fixes. Emits no collector event.").action(async()=>{const i=(0,v.resolveAgentProjectDir)();if(p(i,"record-fix")){(0,d.writeAndExit)(JSON.stringify({message:"verification is disabled in this project; ignoring"})+`
19
+ `),process.exit(1))}),r.command("record-fix").description("Record what was fixed after a fail verdict (called by agent via Bash). Stashed locally in state.json; merged into the next pass verdict's fixes. Emits no collector event.").action(async()=>{const i=(0,f.resolveAgentProjectDir)();if(g(i,"record-fix")){(0,d.writeAndExit)(JSON.stringify({message:"verification is disabled in this project; ignoring"})+`
20
20
  `,0);return}let e;try{e=JSON.parse((0,m.readStdin)())}catch{process.stderr.write(`Error: no JSON provided via stdin.
21
- `),process.exit(1)}const t=(0,f.resolveAgentSessionId)(e,i);t||(process.stderr.write(`Error: JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
21
+ `),process.exit(1)}const t=(0,v.resolveAgentSessionId)(e,i);t||(process.stderr.write(`Error: JSON must include a "session_id" field, or run as a delegated sub-agent (your client resolves the session automatically).
22
22
  `),process.exit(1));const o=e.fixes,n=Array.isArray(o)?o.filter(a=>typeof a=="string"&&a.length>0):[];n.length===0&&(process.stderr.write(`Error: JSON must include a non-empty "fixes" array of strings.
23
- `),process.exit(1));const c=`${i}/.ironbee/sessions/${t}`;(0,l.setLogFile)(`${c}/session.log`),(0,S.addPendingFixes)(c,n),l.logger.debug(`record-fix: session=${t} recorded ${n.length} fix note(s)`),(0,d.writeAndExit)(JSON.stringify({recorded:n.length})+`
23
+ `),process.exit(1));const c=`${i}/.ironbee/sessions/${t}`;(0,l.setLogFile)(`${c}/session.log`),(0,k.addPendingFixes)(c,n),l.logger.debug(`record-fix: session=${t} recorded ${n.length} fix note(s)`),(0,d.writeAndExit)(JSON.stringify({recorded:n.length})+`
24
24
  `,0)});0&&(module.exports={hookCommand});
@@ -1 +1 @@
1
- "use strict";var P=Object.create;var c=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var o=(t,n)=>c(t,"name",{value:n,configurable:!0});var T=(t,n)=>{for(var e in n)c(t,e,{get:n[e],enumerable:!0})},h=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of C(n))!k.call(t,a)&&a!==e&&c(t,a,{get:()=>n[a],enumerable:!(i=$(n,a))||i.enumerable});return t};var S=(t,n,e)=>(e=t!=null?P(A(t)):{},h(n||!t||!t.__esModule?c(e,"default",{value:t,enumerable:!0}):e,t)),B=t=>h(c({},"__esModule",{value:!0}),t);var E={};T(E,{deriveInstallPrefix:()=>d,derivePrefixFromBinary:()=>x,detectPrefixMismatch:()=>y,detectShadowOnPath:()=>v,updateCommand:()=>_});module.exports=B(E);var w=require("commander"),g=require("child_process"),l=require("fs"),s=S(require("path")),r=require("../lib/output"),f=require("../lib/version");function d(t){let n=t;for(;;){const e=s.dirname(n);if(e===n)return null;if(s.basename(n)==="node_modules")return s.basename(e)==="lib"?s.dirname(e):e;n=e}}o(d,"deriveInstallPrefix");function M(){try{const n=((0,g.execSync)("npm config get prefix",{encoding:"utf-8",stdio:["ignore","pipe","ignore"]})??"").toString().trim();return n.length>0?n:null}catch{return null}}o(M,"getNpmConfiguredPrefix");function u(t){let n;try{n=(0,l.realpathSync)(t)}catch{n=s.resolve(t)}for(;n.length>1&&(n.endsWith("/")||n.endsWith(s.sep));)n=n.slice(0,-1);return process.platform==="win32"?n.toLowerCase():n}o(u,"normalizeForCompare");function y(t,n){const e=d(t);return!e||!n||u(e)===u(n)?null:{running:e,npm:n}}o(y,"detectPrefixMismatch");function x(t){if(!t)return null;const n=s.dirname(t);return process.platform!=="win32"&&s.basename(n)==="bin"?s.dirname(n):n}o(x,"derivePrefixFromBinary");function I(t){const n=process.env.PATH??"";if(n.length===0)return null;const e=process.platform==="win32"?";":":",i=n.split(e),a=process.platform==="win32"?(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";"):[""];for(const p of i)if(p.length!==0)for(const b of a){const m=s.join(p,t+b);try{return(0,l.accessSync)(m,l.constants.X_OK),m}catch{}}return null}o(I,"findFirstPathBinary");function v(t,n){const e=d(t);if(!e||!n)return null;const i=x(n);return!i||u(e)===u(i)?null:{shadowBinary:n,shadowPrefix:i,runningPrefix:e}}o(v,"detectShadowOnPath");function O(t){const n=process.platform==="win32"?`del "${t.shadowBinary}"`:`rm "${t.shadowBinary}"`;r.log.blank(),r.log.warn(r.pc.bold("Another IronBee install is earlier on your PATH")),r.log.warn(` PATH-resolved binary: ${r.pc.cyan(t.shadowBinary)}`),r.log.warn(` This update is for: ${r.pc.cyan(t.runningPrefix)}`),r.log.warn("After install, your shell will keep resolving the OLDER one."),r.log.warn("To fix, either:"),r.log.warn(` 1) Remove the shadow: ${r.pc.cyan(n)}`),r.log.warn(" 2) Or install to the shadow's location:"),r.log.warn(` ${r.pc.cyan(`npm install -g --prefix "${t.shadowPrefix}" @ironbee-ai/cli@latest`)}`),r.log.blank()}o(O,"warnPathShadow");function L(t){r.log.blank(),r.log.warn(r.pc.bold("Install location mismatch detected")),r.log.warn(` Active IronBee runs from: ${r.pc.cyan(t.running)}`),r.log.warn(` npm install will write to: ${r.pc.cyan(t.npm)}`),r.log.warn("After install, your shell may keep resolving the OLD version on PATH."),r.log.warn("To make the new version take effect, either:"),r.log.warn(` 1) Align npm prefix: ${r.pc.cyan(`npm config set prefix "${t.running}"`)}`),r.log.warn(" 2) Or install directly to the active location:"),r.log.warn(` ${r.pc.cyan(`npm install -g --prefix "${t.running}" @ironbee-ai/cli@latest`)}`),r.log.blank()}o(L,"warnPrefixMismatch");const _=new w.Command("update").description("Update IronBee CLI to the latest version").action(async()=>{const t=(0,f.getLocalVersion)();r.log.info(`Current version: ${r.pc.bold(t)}`),r.log.step("Checking npm registry...");const n=await(0,f.fetchLatestVersion)();if(n||(r.log.error("Could not reach npm registry. Check your internet connection."),process.exit(1)),n===t){r.log.success(`Already on the latest version (${r.pc.bold(t)})`);return}r.log.info(`New version available: ${r.pc.dim(t)} ${r.pc.yellow("\u2192")} ${r.pc.green(r.pc.bold(n))}`);const e=y(__dirname,M());e&&L(e);const i=v(__dirname,I("ironbee"));i&&O(i),r.log.step(`Running ${r.pc.cyan("npm install -g @ironbee-ai/cli@latest")}...`);try{(0,g.execSync)("npm install -g @ironbee-ai/cli@latest",{stdio:"inherit"}),r.log.blank(),r.log.success(`Updated to ${r.pc.green(r.pc.bold(n))}`),r.log.step("Restart your AI coding client to use the new version.")}catch{r.log.blank(),r.log.error("Update failed. Try running manually:"),console.log(` ${r.pc.cyan("npm install -g @ironbee-ai/cli@latest")}`),process.exit(1)}});0&&(module.exports={deriveInstallPrefix,derivePrefixFromBinary,detectPrefixMismatch,detectShadowOnPath,updateCommand});
1
+ "use strict";var P=Object.create;var c=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var o=(t,n)=>c(t,"name",{value:n,configurable:!0});var T=(t,n)=>{for(var e in n)c(t,e,{get:n[e],enumerable:!0})},h=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of C(n))!k.call(t,a)&&a!==e&&c(t,a,{get:()=>n[a],enumerable:!(i=$(n,a))||i.enumerable});return t};var S=(t,n,e)=>(e=t!=null?P(A(t)):{},h(n||!t||!t.__esModule?c(e,"default",{value:t,enumerable:!0}):e,t)),B=t=>h(c({},"__esModule",{value:!0}),t);var E={};T(E,{deriveInstallPrefix:()=>d,derivePrefixFromBinary:()=>x,detectPrefixMismatch:()=>y,detectShadowOnPath:()=>v,updateCommand:()=>_});module.exports=B(E);var w=require("commander"),g=require("child_process"),l=require("fs"),s=S(require("path")),r=require("../lib/output"),f=require("../lib/version");function d(t){let n=t;for(;;){const e=s.dirname(n);if(e===n)return null;if(s.basename(n)==="node_modules")return s.basename(e)==="lib"?s.dirname(e):e;n=e}}o(d,"deriveInstallPrefix");function M(){try{const n=((0,g.execSync)("npm config get prefix",{encoding:"utf-8",stdio:["ignore","pipe","ignore"]})??"").toString().trim();return n.length>0?n:null}catch{return null}}o(M,"getNpmConfiguredPrefix");function u(t){let n;try{n=(0,l.realpathSync)(t)}catch{n=s.resolve(t)}for(;n.length>1&&(n.endsWith("/")||n.endsWith(s.sep));)n=n.slice(0,-1);return process.platform==="win32"?n.toLowerCase():n}o(u,"normalizeForCompare");function y(t,n){const e=d(t);return!e||!n||u(e)===u(n)?null:{running:e,npm:n}}o(y,"detectPrefixMismatch");function x(t){if(!t)return null;const n=s.dirname(t);return process.platform!=="win32"&&s.basename(n)==="bin"?s.dirname(n):n}o(x,"derivePrefixFromBinary");function I(t){const n=process.env.PATH??"";if(n.length===0)return null;const e=process.platform==="win32"?";":":",i=n.split(e),a=process.platform==="win32"?(process.env.PATHEXT??".COM;.EXE;.BAT;.CMD").split(";"):[""];for(const p of i)if(p.length!==0)for(const b of a){const m=s.join(p,t+b);try{return(0,l.accessSync)(m,l.constants.X_OK),m}catch{}}return null}o(I,"findFirstPathBinary");function v(t,n){const e=d(t);if(!e||!n)return null;const i=x(n);return!i||u(e)===u(i)?null:{shadowBinary:n,shadowPrefix:i,runningPrefix:e}}o(v,"detectShadowOnPath");function O(t){const n=process.platform==="win32"?`del "${t.shadowBinary}"`:`rm "${t.shadowBinary}"`;r.log.blank(),r.log.warn(r.pc.bold("Another IronBee install is earlier on your PATH")),r.log.warn(` PATH-resolved binary: ${r.pc.cyan(t.shadowBinary)}`),r.log.warn(` This update is for: ${r.pc.cyan(t.runningPrefix)}`),r.log.warn("After install, your shell will keep resolving the OLDER one."),r.log.warn("To fix, either:"),r.log.warn(` 1) Remove the shadow: ${r.pc.cyan(n)}`),r.log.warn(" 2) Or install to the shadow's location:"),r.log.warn(` ${r.pc.cyan(`npm install -g --foreground-scripts --prefix "${t.shadowPrefix}" @ironbee-ai/cli@latest`)}`),r.log.blank()}o(O,"warnPathShadow");function L(t){r.log.blank(),r.log.warn(r.pc.bold("Install location mismatch detected")),r.log.warn(` Active IronBee runs from: ${r.pc.cyan(t.running)}`),r.log.warn(` npm install will write to: ${r.pc.cyan(t.npm)}`),r.log.warn("After install, your shell may keep resolving the OLD version on PATH."),r.log.warn("To make the new version take effect, either:"),r.log.warn(` 1) Align npm prefix: ${r.pc.cyan(`npm config set prefix "${t.running}"`)}`),r.log.warn(" 2) Or install directly to the active location:"),r.log.warn(` ${r.pc.cyan(`npm install -g --foreground-scripts --prefix "${t.running}" @ironbee-ai/cli@latest`)}`),r.log.blank()}o(L,"warnPrefixMismatch");const _=new w.Command("update").description("Update IronBee CLI to the latest version").action(async()=>{const t=(0,f.getLocalVersion)();r.log.info(`Current version: ${r.pc.bold(t)}`),r.log.step("Checking npm registry...");const n=await(0,f.fetchLatestVersion)();if(n||(r.log.error("Could not reach npm registry. Check your internet connection."),process.exit(1)),n===t){r.log.success(`Already on the latest version (${r.pc.bold(t)})`);return}r.log.info(`New version available: ${r.pc.dim(t)} ${r.pc.yellow("\u2192")} ${r.pc.green(r.pc.bold(n))}`);const e=y(__dirname,M());e&&L(e);const i=v(__dirname,I("ironbee"));i&&O(i),r.log.step(`Running ${r.pc.cyan("npm install -g --foreground-scripts @ironbee-ai/cli@latest")}...`);try{(0,g.execSync)("npm install -g --foreground-scripts @ironbee-ai/cli@latest",{stdio:"inherit"}),r.log.blank(),r.log.success(`Updated to ${r.pc.green(r.pc.bold(n))}`),r.log.step("Restart your AI coding client to use the new version.")}catch{r.log.blank(),r.log.error("Update failed. Try running manually:"),console.log(` ${r.pc.cyan("npm install -g --foreground-scripts @ironbee-ai/cli@latest")}`),process.exit(1)}});0&&(module.exports={deriveInstallPrefix,derivePrefixFromBinary,detectPrefixMismatch,detectShadowOnPath,updateCommand});
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var c=(t,i)=>r(t,"name",{value:i,configurable:!0});var f=(t,i)=>{for(var o in i)r(t,o,{get:i[o],enumerable:!0})},m=(t,i,o,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of u(i))!g.call(t,n)&&n!==o&&r(t,n,{get:()=>i[n],enumerable:!(s=d(i,n))||s.enumerable});return t};var y=t=>m(r({},"__esModule",{value:!0}),t);var v={};f(v,{runActivityEnd:()=>I});module.exports=y(v);var a=require("./activity"),p=require("./session-state"),e=require("../../queue");async function I(t){const{sessionDir:i,actionsFile:o,projectDir:s,sessionId:n}=t;await(0,p.closeOpenCycles)(i,o,"stop");const l=await(0,a.endActivity)({sessionDir:i,actionsFile:o});return(0,e.flushInBackground)(s,n),(0,e.flushStragglersInBackground)(s,n),l}c(I,"runActivityEnd");0&&(module.exports={runActivityEnd});
1
+ "use strict";var r=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var c=(t,i)=>r(t,"name",{value:i,configurable:!0});var u=(t,i)=>{for(var s in i)r(t,s,{get:i[s],enumerable:!0})},g=(t,i,s,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of d(i))!f.call(t,o)&&o!==s&&r(t,o,{get:()=>i[o],enumerable:!(n=m(i,o))||n.enumerable});return t};var y=t=>g(r({},"__esModule",{value:!0}),t);var v={};u(v,{runActivityEnd:()=>A});module.exports=y(v);var a=require("./activity"),p=require("./activity-participants"),l=require("./session-state"),e=require("../../queue");async function A(t){const{sessionDir:i,actionsFile:s,projectDir:n,sessionId:o}=t,I=await(0,a.closeActivityIfLastParticipant)({sessionDir:i,actionsFile:s},p.MAIN_PARTICIPANT_ID,()=>(0,l.closeOpenCycles)(i,s,"stop"));return(0,e.flushInBackground)(n,o),(0,e.flushStragglersInBackground)(n,o),I}c(A,"runActivityEnd");0&&(module.exports={runActivityEnd});
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var e=(t,n)=>g(t,"name",{value:n,configurable:!0});var A=(t,n)=>{for(var r in n)g(t,r,{get:n[r],enumerable:!0})},P=(t,n,r,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of w(n))!$.call(t,o)&&o!==r&&g(t,o,{get:()=>n[o],enumerable:!(c=h(n,o))||c.enumerable});return t};var x=t=>P(g({},"__esModule",{value:!0}),t);var R={};A(R,{MAIN_PARTICIPANT_ID:()=>b,PARTICIPANT_TTL_MS:()=>l,anyActiveParticipants:()=>C,anyNonMainParticipants:()=>N,claimActivityClose:()=>D,clearActivityParticipants:()=>I,enterActivity:()=>T,isParticipantPresent:()=>_,leaveActivity:()=>k,releaseActivityClose:()=>M});module.exports=x(R);var i=require("fs"),u=require("path"),s=require("../../lib/logger");const S="activity",f=".participant",p="closing-",b="main",l=900*1e3;function a(t){return(0,u.join)(t,S)}e(a,"activityDir");function d(t){return t.replace(/[^a-zA-Z0-9_-]/g,"_")}e(d,"sanitize");function m(t,n){return(0,u.join)(a(t),`${d(n)}${f}`)}e(m,"participantPath");function v(t,n){return(0,u.join)(a(t),`${p}${d(n)}`)}e(v,"closingPath");function T(t,n){if(n)try{(0,i.mkdirSync)(a(t),{recursive:!0}),(0,i.writeFileSync)(m(t,n),String(Date.now()))}catch(r){s.logger.debug(`enter-activity failed for ${n}: ${r}`)}}e(T,"enterActivity");function k(t,n){if(n)try{const r=m(t,n);(0,i.existsSync)(r)&&(0,i.unlinkSync)(r)}catch(r){s.logger.debug(`leave-activity failed for ${n}: ${r}`)}}e(k,"leaveActivity");function _(t,n,r=l){const c=m(t,n);if(!(0,i.existsSync)(c))return!1;try{return Date.now()-(0,i.statSync)(c).mtimeMs<=r}catch{return!1}}e(_,"isParticipantPresent");function C(t,n=l){const r=a(t);if(!(0,i.existsSync)(r))return!1;try{const c=Date.now();for(const o of(0,i.readdirSync)(r))if(o.endsWith(f))try{if(c-(0,i.statSync)((0,u.join)(r,o)).mtimeMs<=n)return!0}catch{}return!1}catch(c){return s.logger.debug(`any-active-participants failed: ${c}`),!1}}e(C,"anyActiveParticipants");function N(t,n=l){const r=a(t);if(!(0,i.existsSync)(r))return!1;const c=`${d(b)}${f}`;try{const o=Date.now();for(const y of(0,i.readdirSync)(r))if(!(!y.endsWith(f)||y===c))try{if(o-(0,i.statSync)((0,u.join)(r,y)).mtimeMs<=n)return!0}catch{}return!1}catch(o){return s.logger.debug(`any-non-main-participants failed: ${o}`),!1}}e(N,"anyNonMainParticipants");function D(t,n){if(!n)return!1;try{return(0,i.mkdirSync)(a(t),{recursive:!0}),(0,i.writeFileSync)(v(t,n),String(Date.now()),{flag:"wx"}),!0}catch(r){return s.logger.debug(`claim-activity-close not won for ${n}: ${r?.code??r}`),!1}}e(D,"claimActivityClose");function M(t,n){if(n)try{const r=v(t,n);(0,i.existsSync)(r)&&(0,i.unlinkSync)(r)}catch(r){s.logger.debug(`release-activity-close failed for ${n}: ${r}`)}}e(M,"releaseActivityClose");function I(t){const n=a(t);if((0,i.existsSync)(n))try{for(const r of(0,i.readdirSync)(n))if(r.endsWith(f)||r.startsWith(p))try{(0,i.unlinkSync)((0,u.join)(n,r))}catch{}}catch(r){s.logger.debug(`clear-activity-participants failed: ${r}`)}}e(I,"clearActivityParticipants");0&&(module.exports={MAIN_PARTICIPANT_ID,PARTICIPANT_TTL_MS,anyActiveParticipants,anyNonMainParticipants,claimActivityClose,clearActivityParticipants,enterActivity,isParticipantPresent,leaveActivity,releaseActivityClose});
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var y=(i,t)=>a(i,"name",{value:t,configurable:!0});var f=(i,t)=>{for(var e in t)a(i,e,{get:t[e],enumerable:!0})},g=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of p(t))!m.call(i,n)&&n!==e&&a(i,n,{get:()=>t[n],enumerable:!(r=A(t,n))||r.enumerable});return i};var l=i=>g(a({},"__esModule",{value:!0}),i);var w={};f(w,{endActivity:()=>I,startActivity:()=>D});module.exports=l(w);var d=require("crypto"),v=require("../../lib/logger"),c=require("./session-state"),o=require("./actions");async function D(i){const{sessionDir:t,actionsFile:e,source:r}=i;if((0,c.isActive)(t))return;const n=(0,d.randomUUID)();(0,c.setActiveActivity)(t,n);const s={...(0,o.baseFields)(e),type:"activity_start",timestamp:Date.now(),activity_id:n,source:r};await(0,o.appendAction)(e,s),v.logger.debug(`activity-start: ${n} source=${r??"unknown"}`)}y(D,"startActivity");async function I(i){const{sessionDir:t,actionsFile:e}=i;if(!(0,c.isActive)(t))return!1;const r=(0,c.getActiveActivityId)(t);(0,c.clearActiveActivity)(t);const n=Date.now(),s=(0,o.findDurationSinceLastAction)(e,"activity_start",n),u={...(0,o.baseFields)(e),type:"activity_end",timestamp:n,activity_id:r,duration:s};return await(0,o.appendAction)(e,u),v.logger.debug(`activity-end: ${r??""} duration=${s??"unknown"}`),!0}y(I,"endActivity");0&&(module.exports={endActivity,startActivity});
1
+ "use strict";var y=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var A=(n,t)=>y(n,"name",{value:t,configurable:!0});var I=(n,t)=>{for(var e in t)y(n,e,{get:t[e],enumerable:!0})},D=(n,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of l(t))!g.call(n,r)&&r!==e&&y(n,r,{get:()=>t[r],enumerable:!(i=m(t,r))||i.enumerable});return n};var w=n=>D(y({},"__esModule",{value:!0}),n);var _={};I(_,{closeActivityIfLastParticipant:()=>P,endActivity:()=>f,startActivity:()=>b});module.exports=w(_);var u=require("crypto"),d=require("../../lib/logger"),o=require("./session-state"),c=require("./activity-participants"),a=require("./actions");async function b(n){const{sessionDir:t,actionsFile:e,source:i}=n,r=(0,o.isActive)(t);if((i==="user_prompt"||!r)&&(0,c.enterActivity)(t,c.MAIN_PARTICIPANT_ID),r)return;const s=(0,u.randomUUID)();(0,o.setActiveActivity)(t,s);const v={...(0,a.baseFields)(e),type:"activity_start",timestamp:Date.now(),activity_id:s,source:i};await(0,a.appendAction)(e,v),d.logger.debug(`activity-start: ${s} source=${i??"unknown"}`)}A(b,"startActivity");async function P(n,t,e){const{sessionDir:i}=n;if((0,c.leaveActivity)(i,t),(0,c.anyActiveParticipants)(i)||!(0,o.isActive)(i))return!1;const r=(0,o.getActiveActivityId)(i);if(!(0,c.claimActivityClose)(i,r))return!1;e&&await e();const s=await f(n);return s&&(0,c.releaseActivityClose)(i,r),s}A(P,"closeActivityIfLastParticipant");async function f(n,t){const{sessionDir:e,actionsFile:i}=n;if(!(0,o.isActive)(e))return!1;const r=(0,o.getActiveActivityId)(e);(0,o.clearActiveActivity)(e);const s=Date.now(),v=(0,a.findDurationSinceLastAction)(i,"activity_start",s),p={...(0,a.baseFields)(i),type:"activity_end",timestamp:s,activity_id:r,duration:v,...t?{reason:t}:{}};return await(0,a.appendAction)(i,p),d.logger.debug(`activity-end: ${r??""} duration=${v??"unknown"}${t?` reason=${t}`:""}`),!0}A(f,"endActivity");0&&(module.exports={closeActivityIfLastParticipant,endActivity,startActivity});
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var a=(i,e)=>g(i,"name",{value:e,configurable:!0});var h=(i,e)=>{for(var n in e)g(i,n,{get:e[n],enumerable:!0})},_=(i,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of A(e))!m.call(i,r)&&r!==n&&g(i,r,{get:()=>e[r],enumerable:!(t=x(e,r))||t.enumerable});return i};var V=i=>_(g({},"__esModule",{value:!0}),i);var pt={};h(pt,{addPendingFixes:()=>nt,clearActiveActivity:()=>ut,clearActiveFix:()=>k,clearActiveVerification:()=>P,clearPendingFixes:()=>rt,clearVerifyIntent:()=>st,closeOpenCycles:()=>ft,generateTraceId:()=>b,getActiveActivityId:()=>H,getActiveFixId:()=>U,getActiveTraceId:()=>E,getActiveVerificationId:()=>T,getChainedStatusLine:()=>Z,getContextInjectedVerificationId:()=>tt,getLastVerdictStatus:()=>L,getPendingFixes:()=>it,getPhase:()=>z,getRetries:()=>F,getUsagePlan:()=>X,getUsageType:()=>Q,getUserEmail:()=>K,getVerifyIntent:()=>at,incrementRetries:()=>R,isActive:()=>W,isFailLikeVerdictStatus:()=>ot,isRecordingActive:()=>N,isRecordingRequired:()=>O,readState:()=>c,reconcileAbandonedActivity:()=>gt,reconcileForCompact:()=>vt,reconcileSessionState:()=>lt,resetRetries:()=>$,setActive:()=>G,setActiveActivity:()=>dt,setActiveFix:()=>j,setActiveVerification:()=>w,setChainedStatusLine:()=>D,setContextInjectedVerificationId:()=>et,setLastVerdictStatus:()=>q,setPhase:()=>C,setRecordingActive:()=>B,setRecordingRequired:()=>J,setUsage:()=>Y,setUserEmail:()=>M,setVerifyIntent:()=>ct,writeState:()=>u});module.exports=V(pt);var S=require("crypto"),l=require("fs"),p=require("path"),f=require("../../lib/logger"),v=require("../../lib/atomic"),d=require("./actions");const y="state.json",I={retries:0,activeVerificationId:null,activeTraceId:null,lastVerdictStatus:null,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 b(){return(0,S.randomBytes)(16).toString("hex")}a(b,"generateTraceId");function c(i){const e=(0,p.join)(i,y);if(!(0,l.existsSync)(e))return{...I};try{const n=(0,l.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,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 f.logger.debug(`failed to read state from ${e}: ${n}`),{...I}}}a(c,"readState");function u(i,e){const n=(0,p.join)(i,y);try{(0,l.mkdirSync)(i,{recursive:!0});const t=`${n}.tmp.${process.pid}.${Date.now()}`,r=JSON.stringify(e,null,2);try{(0,l.writeFileSync)(t,r),(0,v.renameWithRetry)(t,n)}catch(s){try{(0,l.existsSync)(t)&&(0,l.unlinkSync)(t)}catch{}throw s}(0,v.sweepStaleTmpFiles)(n)}catch(t){f.logger.debug(`failed to write state to ${n}: ${t}`)}}a(u,"writeState");function T(i){return c(i).activeVerificationId??void 0}a(T,"getActiveVerificationId");function w(i,e,n){const t=c(i);t.activeVerificationId=e,t.activeTraceId=n,t.phase="verifying",u(i,t)}a(w,"setActiveVerification");function E(i){return c(i).activeTraceId??void 0}a(E,"getActiveTraceId");function P(i){const e=c(i);e.activeVerificationId=null,e.activeTraceId=null,e.phase="coding",u(i,e)}a(P,"clearActiveVerification");function F(i){return c(i).retries}a(F,"getRetries");function R(i){const e=c(i);return e.retries=e.retries+1,u(i,e),e.retries}a(R,"incrementRetries");function $(i){const e=c(i);e.retries=0,u(i,e)}a($,"resetRetries");function L(i){return c(i).lastVerdictStatus??void 0}a(L,"getLastVerdictStatus");function q(i,e){const n=c(i);n.lastVerdictStatus=e,u(i,n)}a(q,"setLastVerdictStatus");function j(i,e){const n=c(i);n.activeFixId=e,u(i,n)}a(j,"setActiveFix");function U(i){return c(i).activeFixId??void 0}a(U,"getActiveFixId");function k(i){const e=c(i);e.activeFixId=null,u(i,e)}a(k,"clearActiveFix");function C(i,e){const n=c(i);n.phase=e,u(i,n)}a(C,"setPhase");function z(i){return c(i).phase}a(z,"getPhase");function O(i){return c(i).recordingRequired}a(O,"isRecordingRequired");function J(i,e){const n=c(i);n.recordingRequired=e,u(i,n)}a(J,"setRecordingRequired");function N(i){return c(i).recordingActive}a(N,"isRecordingActive");function B(i,e){const n=c(i);n.recordingActive=e,u(i,n)}a(B,"setRecordingActive");function W(i){return c(i).active}a(W,"isActive");function G(i,e){const n=c(i);n.active=e,e||(n.activeActivityId=null),u(i,n)}a(G,"setActive");function H(i){return c(i).activeActivityId??void 0}a(H,"getActiveActivityId");function K(i){return c(i).userEmail??void 0}a(K,"getUserEmail");function M(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(M,"setUserEmail");function Q(i){return c(i).usageType??void 0}a(Q,"getUsageType");function X(i){return c(i).usagePlan??void 0}a(X,"getUsagePlan");function Y(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(Y,"setUsage");function Z(i){return c(i).chainedStatusLine??void 0}a(Z,"getChainedStatusLine");function D(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(D,"setChainedStatusLine");function tt(i){return c(i).contextInjectedVerificationId??void 0}a(tt,"getContextInjectedVerificationId");function et(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(et,"setContextInjectedVerificationId");function it(i){return c(i).pendingFixes}a(it,"getPendingFixes");function nt(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(nt,"addPendingFixes");function rt(i){const e=c(i);e.pendingFixes.length!==0&&(e.pendingFixes=[],u(i,e))}a(rt,"clearPendingFixes");function at(i){return c(i).verifyIntent}a(at,"getVerifyIntent");function ct(i,e){const n=c(i);n.verifyIntent!==e&&(n.verifyIntent=e,u(i,n))}a(ct,"setVerifyIntent");function st(i){const e=c(i);e.verifyIntent!==null&&(e.verifyIntent=null,u(i,e))}a(st,"clearVerifyIntent");function ot(i){return i==="fail"||i==="fail_reported"}a(ot,"isFailLikeVerdictStatus");function dt(i,e){const n=c(i);n.activeActivityId=e,n.active=!0,u(i,n)}a(dt,"setActiveActivity");function ut(i){const e=c(i);e.activeActivityId=null,e.active=!1,u(i,e)}a(ut,"clearActiveActivity");async function ft(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),f.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),f.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(ft,"closeOpenCycles");async function lt(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),f.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),f.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),f.logger.debug(`reconcile: ended abandoned activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,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(lt,"reconcileSessionState");async function gt(i,e,n){const t=c(i);if(!t.active&&!t.activeVerificationId&&!t.activeFixId&&t.verifyIntent===null)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),f.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),f.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),f.logger.debug(`interrupt-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,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(gt,"reconcileAbandonedActivity");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:"compact"};await n(e,o),f.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),f.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),f.logger.debug(`compact-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,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,"reconcileForCompact");0&&(module.exports={addPendingFixes,clearActiveActivity,clearActiveFix,clearActiveVerification,clearPendingFixes,clearVerifyIntent,closeOpenCycles,generateTraceId,getActiveActivityId,getActiveFixId,getActiveTraceId,getActiveVerificationId,getChainedStatusLine,getContextInjectedVerificationId,getLastVerdictStatus,getPendingFixes,getPhase,getRetries,getUsagePlan,getUsageType,getUserEmail,getVerifyIntent,incrementRetries,isActive,isFailLikeVerdictStatus,isRecordingActive,isRecordingRequired,readState,reconcileAbandonedActivity,reconcileForCompact,reconcileSessionState,resetRetries,setActive,setActiveActivity,setActiveFix,setActiveVerification,setChainedStatusLine,setContextInjectedVerificationId,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 a=(i,e)=>v(i,"name",{value:e,configurable:!0});var _=(i,e)=>{for(var n in e)v(i,n,{get:e[n],enumerable:!0})},V=(i,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!h.call(i,r)&&r!==n&&v(i,r,{get:()=>e[r],enumerable:!(t=A(e,r))||t.enumerable});return i};var b=i=>V(v({},"__esModule",{value:!0}),i);var yt={};_(yt,{addPendingFixes:()=>rt,clearActiveActivity:()=>ft,clearActiveFix:()=>C,clearActiveVerification:()=>F,clearPendingFixes:()=>at,clearVerifyIntent:()=>ot,closeOpenCycles:()=>lt,generateTraceId:()=>T,getActiveActivityId:()=>H,getActiveFixId:()=>k,getActiveTraceId:()=>E,getActiveVerificationId:()=>w,getChainedStatusLine:()=>D,getContextInjectedVerificationId:()=>et,getLastVerdictStatus:()=>q,getPendingFixes:()=>nt,getPhase:()=>N,getRetries:()=>R,getUsagePlan:()=>Y,getUsageType:()=>X,getUserEmail:()=>K,getVerifyIntent:()=>ct,incrementRetries:()=>$,isActive:()=>W,isFailLikeVerdictStatus:()=>dt,isRecordingActive:()=>B,isRecordingRequired:()=>O,readState:()=>c,reconcileAbandonedActivity:()=>vt,reconcileForCompact:()=>pt,reconcileSessionState:()=>gt,resetRetries:()=>L,setActive:()=>G,setActiveActivity:()=>ut,setActiveFix:()=>U,setActiveVerification:()=>P,setChainedStatusLine:()=>tt,setContextInjectedVerificationId:()=>it,setLastVerdictStatus:()=>j,setPhase:()=>z,setRecordingActive:()=>M,setRecordingRequired:()=>J,setUsage:()=>Z,setUserEmail:()=>Q,setVerifyIntent:()=>st,writeState:()=>u});module.exports=b(yt);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,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,l.existsSync)(e))return{...S};try{const n=(0,l.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,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 f.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,l.mkdirSync)(i,{recursive:!0});const t=`${n}.tmp.${process.pid}.${Date.now()}`,r=JSON.stringify(e,null,2);try{(0,l.writeFileSync)(t,r),(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}`)}}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 $(i){const e=c(i);return e.retries=e.retries+1,u(i,e),e.retries}a($,"incrementRetries");function L(i){const e=c(i);e.retries=0,u(i,e)}a(L,"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,e){const n=c(i);n.activeFixId=e,u(i,n)}a(U,"setActiveFix");function k(i){return c(i).activeFixId??void 0}a(k,"getActiveFixId");function C(i){const e=c(i);e.activeFixId=null,u(i,e)}a(C,"clearActiveFix");function z(i,e){const n=c(i);n.phase=e,u(i,n)}a(z,"setPhase");function N(i){return c(i).phase}a(N,"getPhase");function O(i){return c(i).recordingRequired}a(O,"isRecordingRequired");function J(i,e){const n=c(i);n.recordingRequired=e,u(i,n)}a(J,"setRecordingRequired");function B(i){return c(i).recordingActive}a(B,"isRecordingActive");function M(i,e){const n=c(i);n.recordingActive=e,u(i,n)}a(M,"setRecordingActive");function W(i){return c(i).active}a(W,"isActive");function G(i,e){const n=c(i);n.active=e,e||(n.activeActivityId=null),u(i,n)}a(G,"setActive");function H(i){return c(i).activeActivityId??void 0}a(H,"getActiveActivityId");function K(i){return c(i).userEmail??void 0}a(K,"getUserEmail");function Q(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(Q,"setUserEmail");function X(i){return c(i).usageType??void 0}a(X,"getUsageType");function Y(i){return c(i).usagePlan??void 0}a(Y,"getUsagePlan");function Z(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(Z,"setUsage");function D(i){return c(i).chainedStatusLine??void 0}a(D,"getChainedStatusLine");function tt(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(tt,"setChainedStatusLine");function et(i){return c(i).contextInjectedVerificationId??void 0}a(et,"getContextInjectedVerificationId");function it(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(it,"setContextInjectedVerificationId");function nt(i){return c(i).pendingFixes}a(nt,"getPendingFixes");function rt(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(rt,"addPendingFixes");function at(i){const e=c(i);e.pendingFixes.length!==0&&(e.pendingFixes=[],u(i,e))}a(at,"clearPendingFixes");function ct(i){return c(i).verifyIntent}a(ct,"getVerifyIntent");function st(i,e){const n=c(i);n.verifyIntent!==e&&(n.verifyIntent=e,u(i,n))}a(st,"setVerifyIntent");function ot(i){const e=c(i);e.verifyIntent!==null&&(e.verifyIntent=null,u(i,e))}a(ot,"clearVerifyIntent");function dt(i){return i==="fail"||i==="fail_reported"}a(dt,"isFailLikeVerdictStatus");function ut(i,e){const n=c(i);n.activeActivityId=e,n.active=!0,u(i,n)}a(ut,"setActiveActivity");function ft(i){const e=c(i);e.activeActivityId=null,e.active=!1,u(i,e)}a(ft,"clearActiveActivity");async function lt(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),f.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),f.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(lt,"closeOpenCycles");async function gt(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),f.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),f.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),f.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(gt,"reconcileSessionState");async function vt(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),f.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),f.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),f.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(vt,"reconcileAbandonedActivity");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:"compact"};await n(e,o),f.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),f.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),f.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(pt,"reconcileForCompact");0&&(module.exports={addPendingFixes,clearActiveActivity,clearActiveFix,clearActiveVerification,clearPendingFixes,clearVerifyIntent,closeOpenCycles,generateTraceId,getActiveActivityId,getActiveFixId,getActiveTraceId,getActiveVerificationId,getChainedStatusLine,getContextInjectedVerificationId,getLastVerdictStatus,getPendingFixes,getPhase,getRetries,getUsagePlan,getUsageType,getUserEmail,getVerifyIntent,incrementRetries,isActive,isFailLikeVerdictStatus,isRecordingActive,isRecordingRequired,readState,reconcileAbandonedActivity,reconcileForCompact,reconcileSessionState,resetRetries,setActive,setActiveActivity,setActiveFix,setActiveVerification,setChainedStatusLine,setContextInjectedVerificationId,setLastVerdictStatus,setPhase,setRecordingActive,setRecordingRequired,setUsage,setUserEmail,setVerifyIntent,writeState});
@@ -1,9 +1,9 @@
1
- "use strict";var T=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var d=(e,t)=>T(e,"name",{value:t,configurable:!0});var K=(e,t)=>{for(var i in t)T(e,i,{get:t[i],enumerable:!0})},W=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Q(t))!z.call(e,s)&&s!==i&&T(e,s,{get:()=>t[s],enumerable:!(o=H(t,s))||o.enumerable});return e};var X=e=>W(T({},"__esModule",{value:!0}),e);var fe={};K(fe,{runVerifyGate:()=>ue});module.exports=X(fe);var v=require("fs"),u=require("../../lib/logger"),q=require("../../lib/telemetry"),h=require("./actions"),r=require("./session-state"),p=require("../../lib/config"),B=require("./required-tools");const Z=3,ee=1;function te(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(te,"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 P(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(P,"verdictExampleFail");function w(...e){for(const t of e)try{(0,v.existsSync)(t)&&(0,v.unlinkSync)(t)}catch(i){u.logger.debug(`failed to cleanup ${t}: ${i}`)}}d(w,"cleanup");function ie(e){if(!(0,v.existsSync)(e))return null;try{return JSON.parse((0,v.readFileSync)(e,"utf-8"))}catch{return null}}d(ie,"readVerdictQuietly");function oe(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}d(oe,"computeActiveCycles");function re(e,t,i){const o=te(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,B.satisfyRequiredTools)(s,f),config:f,usedCount:s.size}}d(re,"checkCycleTools");function ne(e){return{cycle:"browser",valid:!0,passCriteriaMet:!0}}d(ne,"checkBrowserEvidence");function se(e){return{cycle:"node",valid:!0,passCriteriaMet:!0}}d(se,"checkNodeEvidence");function ae(e){return{cycle:"backend",valid:!0,passCriteriaMet:!0}}d(ae,"checkBackendEvidence");function ce(e){return{cycle:"android",valid:!0,passCriteriaMet:!0}}d(ce,"checkAndroidEvidence");function le(e,t){if(!Array.isArray(t.checks)||t.checks.length===0)return{cycle:e,valid:!1,reason:"missing checks"};if(e==="browser")return ne(t);if(e==="node")return se(t);if(e==="backend")return ae(t);if(e==="android")return ce(t);throw new Error(`No evidence checker registered for cycle '${e}'.`)}d(le,"checkCycleEvidence");function de(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 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 v=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,v.existsSync)(t)&&(0,v.unlinkSync)(t)}catch(i){d.logger.debug(`failed to cleanup ${t}: ${i}`)}}u(k,"cleanup");function oe(e){if(!(0,v.existsSync)(e))return null;try{return JSON.parse((0,v.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(`
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}`}d(de,"describeMissingTools");async function ue(e){const{sessionId:t,sessionDir:i,actionsFile:o,verdictFile:s,maxRetries:f}=e,a=f??Z,k=e.config??(0,p.loadConfig)(e.projectDir);if(u.logger.debug(`verify-gate: session=${t} verdictExists=${(0,v.existsSync)(s)}`),!(0,h.hasFileChangesSinceLastVerification)(o)){if((0,r.getLastVerdictStatus)(i)==="fail"){if((0,r.getVerifyIntent)(i)!=="fix")return u.logger.debug("fail verdict with no code changes in window \u2014 status report, allowing"),(0,r.setLastVerdictStatus)(i,"fail_reported"),await c(o,i,t,"allow","fail_verdict_reported",[],e.projectDir),{action:"allow"};const n=(0,r.incrementRetries)(i);return n>=a?(u.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 c(o,i,t,"allow","max_retries_exceeded",[],e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${a} TIMES. Allowing completion.
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,v.existsSync)(s)}`),(0,B.anyNonMainParticipants)(i)&&(0,r.getActiveVerificationId)(i)!==void 0)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.
5
5
 
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 c(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.`}):(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}).
7
7
 
8
8
  You submitted a fail verdict but did not address the reported issues. Either:
9
9
 
@@ -13,7 +13,7 @@ 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 u.logger.debug("no code changes detected, allowing completion"),await c(o,i,t,"allow","no_edits",[],e.projectDir),{action:"allow"}}const l=oe(o,k);if(l.length===0)return u.logger.debug("file changes match no cycle pattern, allowing completion"),await c(o,i,t,"allow","no_cycle_active",[],e.projectDir),{action:"allow"};const V=(0,p.getVerificationStrict)(k),M=(0,r.isFailLikeVerdictStatus)((0,r.getLastVerdictStatus)(i)),m=ie(s),x=!V&&!M&&m!==null&&Array.isArray(m.reason)&&m.reason.length>0;if(x&&m.status==="not_applicable")return u.logger.debug("global N/A verdict, allowing completion"),(0,r.resetRetries)(i),(0,r.setLastVerdictStatus)(i,"not_applicable"),await c(o,i,t,"allow","verdict_not_applicable",l,e.projectDir),{action:"allow"};let b=l;if(x&&Array.isArray(m.not_applicable_cycles)&&m.not_applicable_cycles.length>0){const n=new Set(m.not_applicable_cycles.filter(g=>l.includes(g)));if(b=l.filter(g=>!n.has(g)),b.length===0)return u.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 c(o,i,t,"allow","verdict_not_applicable",l,e.projectDir),{action:"allow"};u.logger.debug(`per-platform N/A: exempt=[${[...n].join(",")}] enforced=[${b.join(",")}]`)}const U=(0,h.getToolCallsSinceLastFileChange)(o),S=b.map(n=>re(n,U,k)),D=S.filter(n=>!n.result.satisfied);if(D.length>0){const n=S.every(y=>y.usedCount===0),g=(0,r.incrementRetries)(i),$=!(0,h.hasVerifierEverEngaged)(o),J=$&&g>ee,G=g>=a;if(J||G){const y=$?"verifier_unavailable":"max_retries_exceeded";u.logger.debug(`tool-presence loop releasing (attempt ${g}/${a}, neverEngaged=${$}) \u2014 ${y}`),(0,r.resetRetries)(i),await(0,r.closeOpenCycles)(i,o,y),await c(o,i,t,"allow",y,l,e.projectDir);const A=l.join(", ");return $?{action:"allow",message:`VERIFICATION UNAVAILABLE \u2014 allowing completion.
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 b=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(b=c.filter(g=>!n.has(g)),b.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=[${b.join(",")}]`)}const J=(0,h.getToolCallsSinceLastFileChange)(o),N=b.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.
17
17
 
18
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:
19
19
  - the devtools MCP server is installed and loads (try \`npx -y @ironbee-ai/devtools\`);
@@ -22,7 +22,7 @@ The ${A} verification cycle could not run this session: no verification was ever
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 c(o,i,t,"block","no_tools",l,e.projectDir);const y=` echo '${_(t)}' | ironbee hook submit-verdict`,A=` On fail: echo '${P(t)}' | ironbee hook submit-verdict`;return{action:"block",message:`VERIFICATION REQUIRED (attempt ${g}/${a}).
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}).
26
26
 
27
27
  You made code changes but did not verify them.
28
28
 
@@ -51,41 +51,41 @@ ${b.includes("browser")?`Browser cycle (UI verification):
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
52
  `:""}
53
53
  Then submit your verdict (single verdict covers every active cycle):
54
- ${y}
54
+ ${m}
55
55
  ${A}
56
- If failed, fix the code and re-verify until it passes.`}}await c(o,i,t,"block","incomplete_tools",l,e.projectDir);const Y=D.map(y=>de(y)).join(`
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(`
57
57
  `);return{action:"block",message:`INCOMPLETE VERIFICATION (attempt ${g}/${a}).
58
58
 
59
59
  You used the IronBee verification tools but skipped required checks:
60
60
 
61
- ${Y}
61
+ ${H}
62
62
 
63
63
  Run the missing tools, functionally test your changes, then submit your verdict:
64
64
  Pass: echo '${_(t)}' | ironbee hook submit-verdict
65
- Fail: echo '${P(t)}' | ironbee hook submit-verdict`}}if(!(0,v.existsSync)(s))return await c(o,i,t,"block","no_verdict",l,e.projectDir),{action:"block",message:`VERDICT MISSING.
65
+ Fail: echo '${q(t)}' | ironbee hook submit-verdict`}}if(!(0,v.existsSync)(s))return await l(o,i,t,"block","no_verdict",c,e.projectDir),{action:"block",message:`VERDICT MISSING.
66
66
 
67
67
  You ran the verification tools but did not submit a verdict.${(0,r.isRecordingActive)(i)?`
68
68
  \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
69
 
70
70
  Submit your verdict via:
71
- echo '${_(t)}' | ironbee hook submit-verdict`};let C;try{C=JSON.parse((0,v.readFileSync)(s,"utf-8"))}catch(n){return u.logger.debug(`failed to parse verdict ${s}: ${n}`),w(s),await c(o,i,t,"block","invalid_verdict",l,e.projectDir),{action:"block",message:`INVALID VERDICT JSON. Re-submit valid JSON:
72
- echo '${_(t)}' | ironbee hook submit-verdict`}}if(C.status==="not_applicable")return w(s),await c(o,i,t,"block","not_applicable_rejected",b,e.projectDir),{action:"block",message:`VERDICT REJECTED: ${V?"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 N=b.map(n=>le(n,C)),F=N.filter(n=>!n.valid);if(F.length>0)return w(s),await c(o,i,t,"block","invalid_verdict",l,e.projectDir),{action:"block",message:`VERDICT REJECTED:
74
- ${F.map(g=>` - ${g.cycle} cycle: ${g.reason}`).join(`
71
+ echo '${_(t)}' | ironbee hook submit-verdict`};let w;try{w=JSON.parse((0,v.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",b,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=b.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(`
75
75
  `)}
76
76
 
77
77
  Re-submit:
78
- echo '${_(t)}' | ironbee hook submit-verdict`};const E=C.status;if(E!=="pass"&&E!=="fail")return w(s),await c(o,i,t,"block","invalid_verdict",l,e.projectDir),{action:"block",message:`INVALID VERDICT STATUS: "${E}". Status must be "pass" or "fail".
79
- echo '${_(t)}' | ironbee hook submit-verdict`};const R=N.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,r.resetRetries)(i),await c(o,i,t,"allow","verdict_pass",l,e.projectDir),{action:"allow"};const L=(0,r.incrementRetries)(i),I=[];if(Array.isArray(C.issues))for(const n of C.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 O=I.join(`
80
- - `);return L>=a?(w(s),(0,r.resetRetries)(i),await(0,r.closeOpenCycles)(i,o,"max_retries_exceeded"),await c(o,i,t,"allow","max_retries_exceeded",l,e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${a} TIMES. Allowing completion.
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.
81
81
 
82
82
  Unresolved issues:
83
- - ${O}
83
+ - ${P}
84
84
 
85
- Report these issues in your final response.`}):(w(s),await c(o,i,t,"block","verdict_fail",l,e.projectDir),{action:"block",message:`VERIFICATION FAILED (attempt ${L}/${a}).
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}).
86
86
 
87
87
  Issues found:
88
- - ${O}
88
+ - ${P}
89
89
 
90
90
  Fix the issues, rebuild if needed, re-test functionally, and re-verify.
91
- Submit verdict: echo '<verdict-json>' | ironbee hook submit-verdict`})}d(ue,"runVerifyGate");async function c(e,t,i,o,s,f,a){o==="allow"&&(0,r.clearVerifyIntent)(t);const k={...(0,h.baseFields)(e),type:"verification_requested",timestamp:Date.now(),activity_id:(0,r.getActiveActivityId)(t),action:o,reason:s,modes:f.length>0?f:void 0};await(0,h.appendAction)(e,k),await(0,q.trackVerificationRequested)(i,o,s,a)}d(c,"recordMarker");0&&(module.exports={runVerifyGate});
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});
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var o=(n,e)=>y(n,"name",{value:e,configurable:!0});var de=(n,e)=>{for(var t in e)y(n,t,{get:e[t],enumerable:!0})},pe=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fe(e))!ge.call(n,i)&&i!==t&&y(n,i,{get:()=>e[i],enumerable:!(r=ue(e,i))||r.enumerable});return n};var be=n=>pe(y({},"__esModule",{value:!0}),n);var hn={};de(hn,{ALL_CYCLES:()=>Ee,CONFIG_TARGETS_BY_PRECEDENCE:()=>je,CYCLES_ENABLED_BY_DEFAULT:()=>P,CYCLE_DEFAULT_VERIFY_PATTERNS:()=>$,CYCLE_TOOL_PREFIXES:()=>_e,CYCLE_TO_SERVER:()=>ye,DEFAULT_ANDROID_ALWAYS_REQUIRED:()=>W,DEFAULT_ANDROID_EVIDENCE_PATHS:()=>Q,DEFAULT_ANDROID_VERIFY_PATTERNS:()=>U,DEFAULT_BACKEND_ALWAYS_REQUIRED:()=>H,DEFAULT_BACKEND_EVIDENCE_PATHS:()=>G,DEFAULT_BACKEND_VERIFY_PATTERNS:()=>V,DEFAULT_BROWSER_ALWAYS_REQUIRED:()=>K,DEFAULT_BROWSER_VERIFY_PATTERNS:()=>M,DEFAULT_IGNORED_VERIFY_PATTERNS:()=>q,DEFAULT_NODE_ALWAYS_REQUIRED:()=>Y,DEFAULT_NODE_EVIDENCE_PATHS:()=>X,DEFAULT_NODE_VERIFY_PATTERNS:()=>F,DEFAULT_OAUTH_USAGE_TTL_SECONDS:()=>ee,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS:()=>re,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS:()=>oe,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS:()=>te,DEFAULT_OTEL_PORT:()=>ne,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH:()=>ae,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES:()=>se,ENV_OVERRIDES:()=>j,OPTIONAL_CYCLES:()=>T,applyEnvOverrides:()=>z,findActiveEnvOverride:()=>ke,getActiveCycles:()=>J,getAnalyticsEmitOnStopMinIntervalSeconds:()=>xn,getAndroidDevToolsMcpEntry:()=>Je,getAutoVerifyEnabled:()=>ie,getBackendDevToolsMcpEntry:()=>ze,getCaptureFileChangeset:()=>vn,getClaudeOauthAccessEnabled:()=>sn,getClaudeOauthAccessUsageTtlSeconds:()=>cn,getConfigLayerPaths:()=>x,getMaxChangesetBytes:()=>In,getMaxRetries:()=>Ze,getMcpServerEntry:()=>We,getNodeDevToolsMcpEntry:()=>Qe,getOTELEmitMinIntervalSeconds:()=>dn,getOTELEnsureMinIntervalSeconds:()=>gn,getOTELIdleTimeoutSeconds:()=>fn,getOTELPort:()=>un,getPrivacyEnabled:()=>le,getRequiredToolsConfig:()=>Ne,getStatusLineEmitMinIntervalSeconds:()=>rn,getStatusLineRefreshInterval:()=>pn,getStatusLineRenderDefault:()=>on,getTargetConfigPath:()=>Re,getTelemetryEnabled:()=>ce,getVerificationContextCommitDepth:()=>_n,getVerificationContextEnabled:()=>En,getVerificationContextMaxBytes:()=>Cn,getVerificationContextSource:()=>yn,getVerificationEnabled:()=>O,getVerificationMode:()=>An,getVerificationModel:()=>Ae,getVerificationStrict:()=>bn,isAnalyticsApiRequestEventsEnabled:()=>On,isAnalyticsEmitOnStopEnabled:()=>wn,isAnalyticsEnabled:()=>Tn,isAnalyticsStepEventsEnabled:()=>Rn,isAnalyticsTurnEventsEnabled:()=>jn,isAutoModeAllowlistEnabled:()=>an,isCollectorConfigured:()=>R,isCycleEnabled:()=>De,isCyclePatternsActive:()=>Z,isIgnoredVerifyPath:()=>mn,isJobQueueEnabled:()=>en,isOTELEnabled:()=>ln,isRecordingEnabled:()=>nn,isSessionStatusEnabled:()=>tn,loadConfig:()=>c,requiresVerification:()=>Le,resolveConfigTargetFromFlags:()=>Oe,resolveIgnoredVerifyPatterns:()=>w});module.exports=be(hn);var E=require("fs"),b=require("path"),I=require("os"),N=require("./logger");const T=["node","backend","android"],Ee=["browser",...T],P=new Set(["browser"]),ye={browser:"browser-devtools",node:"node-devtools",backend:"backend-devtools",android:"android-devtools"},_e={browser:"bdt_",node:"ndt_",backend:"bedt_",android:"adt_"},M=["*.ts","*.tsx","*.js","*.jsx","*.mjs","*.cjs","*.vue","*.svelte","*.html","*.htm","*.css","*.scss","*.sass","*.less","*.styl","*.py","*.rb","*.erb","*.go","*.rs","*.java","*.kt","*.kts","*.swift","*.c","*.cpp","*.h","*.hpp","*.cs","*.php","*.dart","*.ex","*.exs","*.erl","*.lua","*.r","*.R","*.scala","*.clj","*.cljs","*.zig","*.nim","*.hbs","*.ejs","*.pug","*.jade","*.astro"],F=["server/**/*.{ts,js,mjs,cjs}","src/server/**/*.{ts,js,mjs,cjs}","backend/**/*.{ts,js,mjs,cjs}","api/**/*.{ts,js,mjs,cjs}","src/api/**/*.{ts,js,mjs,cjs}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs}","**/server.{ts,js,mjs,cjs}"],V=["server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","backend/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","controllers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","handlers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","services/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/server.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/main.{go,py,java,rb,kt,scala}"],U=["android/**/*.{kt,java}","app/src/**/*.{kt,java}","mobile/**/*.{kt,java}","src/main/kotlin/**/*.kt","src/main/java/**/*.java","**/*.{kt,java}","**/res/**/*.xml","**/AndroidManifest.xml"],$={browser:M,node:F,backend:V,android:U},q=["**/*.spec.*","**/*.test.*","**/__tests__/**","**/__mocks__/**"];function w(n){const e=n.ignoredVerifyPatterns??[];return[...q,...e]}o(w,"resolveIgnoredVerifyPatterns");const K=["bdt_navigation_go-to","bdt_content_take-screenshot","bdt_a11y_take-aria-snapshot","bdt_o11y_get-console-messages"],Y=["ndt_debug_connect"],X=[{name:"probe",allOf:[{anyOf:["ndt_debug_put-tracepoint","ndt_debug_put-logpoint","ndt_debug_put-exceptionpoint"]},"ndt_debug_get-probe-snapshots"]},{name:"log",allOf:["ndt_debug_get-logs"]}],H=[],G=[{name:"protocol-call",allOf:[{anyOf:["bedt_request_http","bedt_request_grpc","bedt_request_graphql","bedt_request_websocket-open","bedt_request_replay"]}]},{name:"log-evidence",allOf:["bedt_log_register-source",{anyOf:["bedt_log_read","bedt_log_read-multi","bedt_log_follow"]}]},{name:"db-evidence",allOf:["bedt_db_connect",{anyOf:["bedt_db_query","bedt_db_describe-table","bedt_db_list-tables","bedt_db_snapshot","bedt_db_diff","bedt_db_get-changes"]}]}],W=["adt_device_connect"],Q=[{name:"device-evidence",allOf:[{anyOf:["adt_device_launch-app","adt_interaction_tap","adt_interaction_double-tap","adt_interaction_long-press","adt_interaction_input-text","adt_interaction_swipe","adt_interaction_scroll","adt_interaction_press-key","adt_interaction_deep-link"]},"adt_content_take-screenshot","adt_a11y_take-ui-snapshot"]},{name:"log-evidence",allOf:[{anyOf:["adt_o11y_log-read","adt_o11y_log-follow"]}]}],Ce=3;function k(n){if(!(0,E.existsSync)(n))return{};try{return JSON.parse((0,E.readFileSync)(n,"utf-8"))}catch(e){return N.logger.debug(`failed to parse config ${n}: ${e}`),{}}}o(k,"loadJsonFile");function me(n,e){if(!Object.prototype.hasOwnProperty.call(n,"verification"))return;const t=n.verification;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'verification' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.enable' must be boolean. Got ${typeof r.enable}.`);if(Object.prototype.hasOwnProperty.call(r,"auto")&&typeof r.auto!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.auto' must be boolean. Got ${typeof r.auto}.`);if(Object.prototype.hasOwnProperty.call(r,"strict")&&typeof r.strict!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.strict' must be boolean. Got ${typeof r.strict}.`);if(Object.prototype.hasOwnProperty.call(r,"model")){const i=r.model,s=typeof i=="string",l=i!==null&&typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(a=>typeof a=="string");if(!s&&!l)throw new Error(`Invalid IronBee config in ${e}: 'verification.model' must be a string (applies to all clients) or an object of string values (per-client, e.g. { "claude": "sonnet", "codex": "gpt-5.5" }). Got ${Array.isArray(i)?"array":typeof i}.`)}}o(me,"assertVerificationShape");function Ae(n,e){const t=n.verification?.model;if(typeof t=="string")return t.length>0?t:void 0;if(t&&typeof t=="object"){const r=t[e];return typeof r=="string"&&r.length>0?r:void 0}}o(Ae,"getVerificationModel");function ve(n,e){if(!Object.prototype.hasOwnProperty.call(n,"telemetry"))return;const t=n.telemetry;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'telemetry' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'telemetry.enable' must be boolean. Got ${typeof r.enable}.`)}o(ve,"assertTelemetryShape");function Ie(n,e){if(!Object.prototype.hasOwnProperty.call(n,"privacy"))return;const t=n.privacy;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'privacy' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'privacy.enable' must be boolean. Got ${typeof r.enable}.`)}o(Ie,"assertPrivacyShape");function _(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(_,"mergeCycleConfig");function B(n,e){const t={...n,...e};return t.browser=_(n.browser,e.browser),t.node=_(n.node,e.node),t.backend=_(n.backend,e.backend),t.android=_(n.android,e.android),t.claude=xe(n.claude,e.claude),t.verification=we(n.verification,e.verification),t.verificationContext=Te(n.verificationContext,e.verificationContext),t}o(B,"mergeConfigLayers");function Te(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(Te,"mergeVerificationContextConfig");function we(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(we,"mergeVerificationConfig");function xe(n,e){if(n===void 0&&e===void 0)return;const t={...n??{},...e??{}};return(n?.oauthAccess!==void 0||e?.oauthAccess!==void 0)&&(t.oauthAccess={...n?.oauthAccess??{},...e?.oauthAccess??{}}),(n?.autoModeAllowlist!==void 0||e?.autoModeAllowlist!==void 0)&&(t.autoModeAllowlist={...n?.autoModeAllowlist??{},...e?.autoModeAllowlist??{}}),t}o(xe,"mergeClaudeConfig");function x(n){return{global:(0,b.join)((0,I.homedir)(),".ironbee","config.json"),project:n?(0,b.join)(n,".ironbee","config.json"):void 0,local:n?(0,b.join)(n,".ironbee","config.local.json"):void 0}}o(x,"getConfigLayerPaths");const je=["global","project","local"];function Re(n,e){const t=x(e);if(n==="global")return t.global;if(n==="project"){if(t.project===void 0)throw new Error("Project layer requested but no projectDir was provided.");return t.project}if(t.local===void 0)throw new Error("Local layer requested but no projectDir was provided.");return t.local}o(Re,"getTargetConfigPath");function Oe(n){if(n.global===!0&&n.local===!0)throw new Error("Pass at most one of --global / --local.");return n.global===!0?"global":n.local===!0?"local":"project"}o(Oe,"resolveConfigTargetFromFlags");function A(n){const e=k(n);return(0,E.existsSync)(n)&&(me(e,n),ve(e,n),Ie(e,n)),e}o(A,"loadAndValidateLayer");const j=[{envVar:"IRONBEE_API_KEY",configPath:"collector.apiKey"},{envVar:"IRONBEE_OAUTH_TOKEN",configPath:"collector.oauthToken"}];function he(n,e,t){const r=e.split(".");let i=n;for(let s=0;s<r.length-1;s++){const l=r[s],a=i[l];a!=null&&typeof a=="object"&&!Array.isArray(a)?i[l]={...a}:i[l]={},i=i[l]}i[r[r.length-1]]=t}o(he,"setAtConfigPath");function z(n){let e;for(const t of j){const r=process.env[t.envVar];if(r===void 0||r.length===0)continue;e===void 0&&(e={...n});const i=t.coerce?t.coerce(r):r;he(e,t.configPath,i)}return e??n}o(z,"applyEnvOverrides");function ke(n){for(const e of j){if(e.configPath!==n)continue;const t=process.env[e.envVar];if(t!==void 0&&t.length>0)return e}}o(ke,"findActiveEnvOverride");function c(n){const e=x(n),t=A(e.global),r=e.project?A(e.project):{},i=e.local?A(e.local):{},s=B(B(t,r),i);return z(s)}o(c,"loadConfig");function Be(n){let e=n.replace(/\{([^}]+)\}/g,(t,r)=>`(${r.split(",").map(i=>i.trim()).join("|")})`);return e=e.replace(/\*\*\//g,"\0DSS\0").replace(/\*\*/g,"\0DS\0").replace(/\*/g,"\0SS\0").replace(/\?/g,"\0QM\0"),e=e.replace(/[.+^$\\[\]]/g,"\\$&"),e=e.replace(/\x00DSS\x00/g,"(?:.*/)?").replace(/\x00DS\x00/g,".*").replace(/\x00SS\x00/g,"[^/]*").replace(/\x00QM\x00/g,"[^/]"),new RegExp(`(^|/)${e}$`)}o(Be,"globToRegExp");function C(n,e){const t=n.replace(/\\/g,"/");for(const r of e)if(Be(r).test(t))return!0;return!1}o(C,"matchesAny");function Se(n,e){if(e==="browser")return n.browser;if(e==="node")return n.node;if(e==="backend")return n.backend;if(e==="android")return n.android}o(Se,"getCycleBlock");function v(n,e){const t=Se(n,e);if(t!==void 0&&t.enable===!1)return[];const r=$[e]??[];if(t===void 0)return P.has(e)?[...r]:[];if(Array.isArray(t.verifyPatterns)&&t.verifyPatterns.length===0)return[];const i=t.verifyPatterns??r,s=t.additionalVerifyPatterns??[];return[...i,...s]}o(v,"getCyclePatterns");function J(n,e){const t=w(e);if(t.length>0&&C(n,t))return[];const r=[];C(n,v(e,"browser"))&&r.push("browser");for(const i of T){const s=v(e,i);s.length>0&&C(n,s)&&r.push(i)}return r}o(J,"getActiveCycles");function Le(n,e){return J(n,e).length>0}o(Le,"requiresVerification");function De(n,e){return O(n)?Z(n,e):!1}o(De,"isCycleEnabled");function Z(n,e){return v(n,e).length>0}o(Z,"isCyclePatternsActive");function Ne(n,e){let t,r;if(e==="browser"?(t=n.browser?.alwaysRequired??K,r=n.browser?.evidencePaths??[]):e==="node"?(t=n.node?.alwaysRequired??Y,r=n.node?.evidencePaths??X):e==="backend"?(t=n.backend?.alwaysRequired??H,r=n.backend?.evidencePaths??G):e==="android"?(t=n.android?.alwaysRequired??W,r=n.android?.evidencePaths??Q):(t=[],r=[]),t.length===0&&r.length===0)throw new Error(`Invalid required-tools config for cycle '${e}': both 'alwaysRequired' and 'evidencePaths' are empty. At least one must specify required tools.`);return{alwaysRequired:t,evidencePaths:r}}o(Ne,"getRequiredToolsConfig");const S="npx",Pe="^0.11.0",L=["-y",`@ironbee-ai/devtools@${Pe}`],Me={TOOL_NAME_PREFIX:"bdt_",TOOL_INPUT_METADATA_ENABLE:"true"},Fe={PLATFORM:"node",TOOL_NAME_PREFIX:"ndt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ve={PLATFORM:"backend",TOOL_NAME_PREFIX:"bedt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ue={PLATFORM:"android",TOOL_NAME_PREFIX:"adt_",TOOL_INPUT_METADATA_ENABLE:"true"},$e={BROWSER_DEVTOOLS_INSTALL_CHROMIUM:"true"},qe={},Ke={},Ye={};function Xe(n){return ce(n)?{}:{TELEMETRY_ENABLE:"false"}}o(Xe,"buildTelemetryEnv");function He(n){return le(n)?{COLLECTOR_EVENTS_TOOL_DETAILS_ENABLE:"false",COLLECTOR_ARTIFACTS_ENABLE:"false"}:{}}o(He,"buildPrivacyEnv");function Ge(n,e){if(!R(n))return{};const t=n.collector,i=k((0,b.join)((0,I.homedir)(),".ironbee","config.json")).collector??{},s=typeof i.oauthToken=="string"&&i.oauthToken.length>0,l=typeof i.apiKey=="string"&&i.apiKey.length>0;let a;t.oauthToken?a=s?"X-OAuth-Token=${file:~/.ironbee/config.json#collector.oauthToken}":`X-OAuth-Token=${t.oauthToken}`:a=l?"X-API-Key=${file:~/.ironbee/config.json#collector.apiKey}":`X-API-Key=${t.apiKey}`;const u={OTEL_ENABLE:"true",OTEL_EXPORTER_HTTP_URL:t.url,OTEL_EXPORTER_HTTP_HEADERS:a,OTEL_EXPORTER_TYPE:"otlp/http-protobuf"};return e==="browser"&&(u.OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS="change,input,click",u.BROWSER_HEADLESS_ENABLE="true"),u}o(Ge,"buildOTELEnv");function m(n,e,t,r,i){const s=Ge(n,i),l=Xe(n),a=He(n),u=n[e];if(u&&typeof u=="object"&&!Array.isArray(u)){const f=u;if(f.mcp&&typeof f.mcp=="object"&&!Array.isArray(f.mcp)){const g={...f.mcp},d={...s,...l,...a,...g.env??{},...t};return g.env=d,g}const h={};if(f.env&&typeof f.env=="object"&&!Array.isArray(f.env)){const g=f.env;for(const d of Object.keys(g))typeof g[d]=="string"&&(h[d]=g[d])}return{command:S,args:[...L],env:{...r,...s,...l,...a,...h,...t}}}return{command:S,args:[...L],env:{...r,...s,...l,...a,...t}}}o(m,"buildMcpEntry");function We(n){const e=c(n);return m(e,"browserDevTools",Me,$e,"browser")}o(We,"getMcpServerEntry");function Qe(n){const e=c(n);return m(e,"nodeDevTools",Fe,qe,"node")}o(Qe,"getNodeDevToolsMcpEntry");function ze(n){const e=c(n);return m(e,"backendDevTools",Ve,Ke,"backend")}o(ze,"getBackendDevToolsMcpEntry");function Je(n){const e=c(n);return m(e,"androidDevTools",Ue,Ye,"android")}o(Je,"getAndroidDevToolsMcpEntry");function Ze(n){return typeof n.maxRetries=="number"&&n.maxRetries>0?n.maxRetries:Ce}o(Ze,"getMaxRetries");function R(n){if(process.env.IRONBEE_COLLECTOR==="false")return!1;const e=n.collector;if(!e||e.enable===!1||typeof e.url!="string"||e.url.length===0)return!1;const t=typeof e.oauthToken=="string"&&e.oauthToken.length>0,r=typeof e.apiKey=="string"&&e.apiKey.length>0;return!(!t&&!r)}o(R,"isCollectorConfigured");function en(n){const e=c(n);return p(e,e.jobQueue)}o(en,"isJobQueueEnabled");function nn(n){const e=c(n);return p(e,e.recording)}o(nn,"isRecordingEnabled");function tn(n){return p(n,n.statusLine)}o(tn,"isSessionStatusEnabled");function on(n){const e=n.statusLine;return e!==void 0&&e.renderDefault===!0}o(on,"getStatusLineRenderDefault");function rn(n){const e=n.statusLine?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:10}o(rn,"getStatusLineEmitMinIntervalSeconds");const ee=60;function sn(n){return n.claude?.oauthAccess?.enable!==!1}o(sn,"getClaudeOauthAccessEnabled");function an(n){return n.claude?.autoModeAllowlist?.enable!==!1}o(an,"isAutoModeAllowlistEnabled");function cn(n){const e=n.claude?.oauthAccess?.usageTtlSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:ee}o(cn,"getClaudeOauthAccessUsageTtlSeconds");const ne=15986,te=600,oe=30,re=0;function ln(n){return p(n,n.otel)}o(ln,"isOTELEnabled");function un(n){const e=n.otel?.port;return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<65536?e:ne}o(un,"getOTELPort");function fn(n){const e=n.otel?.idleTimeoutSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:te}o(fn,"getOTELIdleTimeoutSeconds");function gn(n){const e=n.otel?.ensureMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:oe}o(gn,"getOTELEnsureMinIntervalSeconds");function dn(n){const e=n.otel?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:re}o(dn,"getOTELEmitMinIntervalSeconds");function pn(n){const e=n.statusLine?.refreshInterval;if(typeof e=="number"&&Number.isFinite(e)&&e>=1)return e}o(pn,"getStatusLineRefreshInterval");function p(n,e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e.enable!==!1:R(n)}o(p,"isFeatureEnabledWithCollectorAutoEnable");function Bn(n){return n==null||typeof n!="object"||Array.isArray(n)?!1:n.enable!==!1}o(Bn,"isPresenceEnabled");function O(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(O,"getVerificationEnabled");function ie(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.auto!==!1}o(ie,"getAutoVerifyEnabled");function bn(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.strict===!0}o(bn,"getVerificationStrict");const se=65536,ae=1;function En(n){const e=n.verificationContext;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(En,"getVerificationContextEnabled");function yn(n){return n.verificationContext?.source==="actions"?"actions":"git"}o(yn,"getVerificationContextSource");function _n(n){const e=n.verificationContext?.commitDepth;return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):ae}o(_n,"getVerificationContextCommitDepth");function Cn(n){const e=n.verificationContext?.maxBytes;return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):se}o(Cn,"getVerificationContextMaxBytes");function mn(n,e){const t=w(n);return t.length>0&&C(e,t)}o(mn,"isIgnoredVerifyPath");function An(n){return O(n)?ie(n)?"enforce":"assist":"monitor"}o(An,"getVerificationMode");function ce(n){const e=n.telemetry;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(ce,"getTelemetryEnabled");function le(n){const e=n.privacy;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.enable===!0}o(le,"getPrivacyEnabled");const D=65536;function vn(n){const e=n.fileChange;return!e||typeof e!="object"||Array.isArray(e)?!1:e.captureChangeset===!0}o(vn,"getCaptureFileChangeset");function In(n){const e=n.fileChange;if(!e||typeof e!="object"||Array.isArray(e))return D;const t=e.maxChangesetBytes;return typeof t!="number"||!Number.isFinite(t)||t<=0?D:Math.floor(t)}o(In,"getMaxChangesetBytes");function Tn(n){const e=c(n);return p(e,e.analytics)}o(Tn,"isAnalyticsEnabled");function wn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitOnStop!==!1}o(wn,"isAnalyticsEmitOnStopEnabled");function xn(n){const t=c(n).analytics;if(t===null||typeof t!="object"||Array.isArray(t))return 0;const r=t.emitOnStopMinIntervalSeconds;return typeof r=="number"&&r>=0?r:0}o(xn,"getAnalyticsEmitOnStopMinIntervalSeconds");function jn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitTurnEvents===!0}o(jn,"isAnalyticsTurnEventsEnabled");function Rn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitStepEvents===!0}o(Rn,"isAnalyticsStepEventsEnabled");function On(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitApiRequestEvents!==!1}o(On,"isAnalyticsApiRequestEventsEnabled");0&&(module.exports={ALL_CYCLES,CONFIG_TARGETS_BY_PRECEDENCE,CYCLES_ENABLED_BY_DEFAULT,CYCLE_DEFAULT_VERIFY_PATTERNS,CYCLE_TOOL_PREFIXES,CYCLE_TO_SERVER,DEFAULT_ANDROID_ALWAYS_REQUIRED,DEFAULT_ANDROID_EVIDENCE_PATHS,DEFAULT_ANDROID_VERIFY_PATTERNS,DEFAULT_BACKEND_ALWAYS_REQUIRED,DEFAULT_BACKEND_EVIDENCE_PATHS,DEFAULT_BACKEND_VERIFY_PATTERNS,DEFAULT_BROWSER_ALWAYS_REQUIRED,DEFAULT_BROWSER_VERIFY_PATTERNS,DEFAULT_IGNORED_VERIFY_PATTERNS,DEFAULT_NODE_ALWAYS_REQUIRED,DEFAULT_NODE_EVIDENCE_PATHS,DEFAULT_NODE_VERIFY_PATTERNS,DEFAULT_OAUTH_USAGE_TTL_SECONDS,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS,DEFAULT_OTEL_PORT,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES,ENV_OVERRIDES,OPTIONAL_CYCLES,applyEnvOverrides,findActiveEnvOverride,getActiveCycles,getAnalyticsEmitOnStopMinIntervalSeconds,getAndroidDevToolsMcpEntry,getAutoVerifyEnabled,getBackendDevToolsMcpEntry,getCaptureFileChangeset,getClaudeOauthAccessEnabled,getClaudeOauthAccessUsageTtlSeconds,getConfigLayerPaths,getMaxChangesetBytes,getMaxRetries,getMcpServerEntry,getNodeDevToolsMcpEntry,getOTELEmitMinIntervalSeconds,getOTELEnsureMinIntervalSeconds,getOTELIdleTimeoutSeconds,getOTELPort,getPrivacyEnabled,getRequiredToolsConfig,getStatusLineEmitMinIntervalSeconds,getStatusLineRefreshInterval,getStatusLineRenderDefault,getTargetConfigPath,getTelemetryEnabled,getVerificationContextCommitDepth,getVerificationContextEnabled,getVerificationContextMaxBytes,getVerificationContextSource,getVerificationEnabled,getVerificationMode,getVerificationModel,getVerificationStrict,isAnalyticsApiRequestEventsEnabled,isAnalyticsEmitOnStopEnabled,isAnalyticsEnabled,isAnalyticsStepEventsEnabled,isAnalyticsTurnEventsEnabled,isAutoModeAllowlistEnabled,isCollectorConfigured,isCycleEnabled,isCyclePatternsActive,isIgnoredVerifyPath,isJobQueueEnabled,isOTELEnabled,isRecordingEnabled,isSessionStatusEnabled,loadConfig,requiresVerification,resolveConfigTargetFromFlags,resolveIgnoredVerifyPatterns});
1
+ "use strict";var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var o=(n,e)=>y(n,"name",{value:e,configurable:!0});var de=(n,e)=>{for(var t in e)y(n,t,{get:e[t],enumerable:!0})},pe=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fe(e))!ge.call(n,i)&&i!==t&&y(n,i,{get:()=>e[i],enumerable:!(r=ue(e,i))||r.enumerable});return n};var be=n=>pe(y({},"__esModule",{value:!0}),n);var hn={};de(hn,{ALL_CYCLES:()=>Ee,CONFIG_TARGETS_BY_PRECEDENCE:()=>je,CYCLES_ENABLED_BY_DEFAULT:()=>P,CYCLE_DEFAULT_VERIFY_PATTERNS:()=>$,CYCLE_TOOL_PREFIXES:()=>_e,CYCLE_TO_SERVER:()=>ye,DEFAULT_ANDROID_ALWAYS_REQUIRED:()=>W,DEFAULT_ANDROID_EVIDENCE_PATHS:()=>Q,DEFAULT_ANDROID_VERIFY_PATTERNS:()=>U,DEFAULT_BACKEND_ALWAYS_REQUIRED:()=>H,DEFAULT_BACKEND_EVIDENCE_PATHS:()=>G,DEFAULT_BACKEND_VERIFY_PATTERNS:()=>V,DEFAULT_BROWSER_ALWAYS_REQUIRED:()=>K,DEFAULT_BROWSER_VERIFY_PATTERNS:()=>M,DEFAULT_IGNORED_VERIFY_PATTERNS:()=>q,DEFAULT_NODE_ALWAYS_REQUIRED:()=>Y,DEFAULT_NODE_EVIDENCE_PATHS:()=>X,DEFAULT_NODE_VERIFY_PATTERNS:()=>F,DEFAULT_OAUTH_USAGE_TTL_SECONDS:()=>ee,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS:()=>re,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS:()=>oe,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS:()=>te,DEFAULT_OTEL_PORT:()=>ne,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH:()=>ae,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES:()=>se,ENV_OVERRIDES:()=>j,OPTIONAL_CYCLES:()=>T,applyEnvOverrides:()=>z,findActiveEnvOverride:()=>ke,getActiveCycles:()=>J,getAnalyticsEmitOnStopMinIntervalSeconds:()=>xn,getAndroidDevToolsMcpEntry:()=>Je,getAutoVerifyEnabled:()=>ie,getBackendDevToolsMcpEntry:()=>ze,getCaptureFileChangeset:()=>vn,getClaudeOauthAccessEnabled:()=>sn,getClaudeOauthAccessUsageTtlSeconds:()=>cn,getConfigLayerPaths:()=>x,getMaxChangesetBytes:()=>In,getMaxRetries:()=>Ze,getMcpServerEntry:()=>We,getNodeDevToolsMcpEntry:()=>Qe,getOTELEmitMinIntervalSeconds:()=>dn,getOTELEnsureMinIntervalSeconds:()=>gn,getOTELIdleTimeoutSeconds:()=>fn,getOTELPort:()=>un,getPrivacyEnabled:()=>le,getRequiredToolsConfig:()=>Ne,getStatusLineEmitMinIntervalSeconds:()=>rn,getStatusLineRefreshInterval:()=>pn,getStatusLineRenderDefault:()=>on,getTargetConfigPath:()=>Re,getTelemetryEnabled:()=>ce,getVerificationContextCommitDepth:()=>_n,getVerificationContextEnabled:()=>En,getVerificationContextMaxBytes:()=>Cn,getVerificationContextSource:()=>yn,getVerificationEnabled:()=>O,getVerificationMode:()=>An,getVerificationModel:()=>Ae,getVerificationStrict:()=>bn,isAnalyticsApiRequestEventsEnabled:()=>On,isAnalyticsEmitOnStopEnabled:()=>wn,isAnalyticsEnabled:()=>Tn,isAnalyticsStepEventsEnabled:()=>Rn,isAnalyticsTurnEventsEnabled:()=>jn,isAutoModeAllowlistEnabled:()=>an,isCollectorConfigured:()=>R,isCycleEnabled:()=>De,isCyclePatternsActive:()=>Z,isIgnoredVerifyPath:()=>mn,isJobQueueEnabled:()=>en,isOTELEnabled:()=>ln,isRecordingEnabled:()=>nn,isSessionStatusEnabled:()=>tn,loadConfig:()=>c,requiresVerification:()=>Le,resolveConfigTargetFromFlags:()=>Oe,resolveIgnoredVerifyPatterns:()=>w});module.exports=be(hn);var E=require("fs"),b=require("path"),I=require("os"),N=require("./logger");const T=["node","backend","android"],Ee=["browser",...T],P=new Set(["browser"]),ye={browser:"browser-devtools",node:"node-devtools",backend:"backend-devtools",android:"android-devtools"},_e={browser:"bdt_",node:"ndt_",backend:"bedt_",android:"adt_"},M=["*.ts","*.tsx","*.js","*.jsx","*.mjs","*.cjs","*.vue","*.svelte","*.html","*.htm","*.css","*.scss","*.sass","*.less","*.styl","*.py","*.rb","*.erb","*.go","*.rs","*.java","*.kt","*.kts","*.swift","*.c","*.cpp","*.h","*.hpp","*.cs","*.php","*.dart","*.ex","*.exs","*.erl","*.lua","*.r","*.R","*.scala","*.clj","*.cljs","*.zig","*.nim","*.hbs","*.ejs","*.pug","*.jade","*.astro"],F=["server/**/*.{ts,js,mjs,cjs}","src/server/**/*.{ts,js,mjs,cjs}","backend/**/*.{ts,js,mjs,cjs}","api/**/*.{ts,js,mjs,cjs}","src/api/**/*.{ts,js,mjs,cjs}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs}","**/server.{ts,js,mjs,cjs}"],V=["server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","backend/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","controllers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","handlers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","services/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/server.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/main.{go,py,java,rb,kt,scala}"],U=["android/**/*.{kt,java}","app/src/**/*.{kt,java}","mobile/**/*.{kt,java}","src/main/kotlin/**/*.kt","src/main/java/**/*.java","**/*.{kt,java}","**/res/**/*.xml","**/AndroidManifest.xml"],$={browser:M,node:F,backend:V,android:U},q=["**/*.spec.*","**/*.test.*","**/__tests__/**","**/__mocks__/**"];function w(n){const e=n.ignoredVerifyPatterns??[];return[...q,...e]}o(w,"resolveIgnoredVerifyPatterns");const K=["bdt_navigation_go-to","bdt_content_take-screenshot","bdt_a11y_take-aria-snapshot","bdt_o11y_get-console-messages"],Y=["ndt_debug_connect"],X=[{name:"probe",allOf:[{anyOf:["ndt_debug_put-tracepoint","ndt_debug_put-logpoint","ndt_debug_put-exceptionpoint"]},"ndt_debug_get-probe-snapshots"]},{name:"log",allOf:["ndt_debug_get-logs"]}],H=[],G=[{name:"protocol-call",allOf:[{anyOf:["bedt_request_http","bedt_request_grpc","bedt_request_graphql","bedt_request_websocket-open","bedt_request_replay"]}]},{name:"log-evidence",allOf:["bedt_log_register-source",{anyOf:["bedt_log_read","bedt_log_read-multi","bedt_log_follow"]}]},{name:"db-evidence",allOf:["bedt_db_connect",{anyOf:["bedt_db_query","bedt_db_describe-table","bedt_db_list-tables","bedt_db_snapshot","bedt_db_diff","bedt_db_get-changes"]}]}],W=["adt_device_connect"],Q=[{name:"device-evidence",allOf:[{anyOf:["adt_device_launch-app","adt_interaction_tap","adt_interaction_double-tap","adt_interaction_long-press","adt_interaction_input-text","adt_interaction_swipe","adt_interaction_scroll","adt_interaction_press-key","adt_interaction_deep-link"]},"adt_content_take-screenshot","adt_a11y_take-ui-snapshot"]},{name:"log-evidence",allOf:[{anyOf:["adt_o11y_log-read","adt_o11y_log-follow"]}]}],Ce=3;function k(n){if(!(0,E.existsSync)(n))return{};try{return JSON.parse((0,E.readFileSync)(n,"utf-8"))}catch(e){return N.logger.debug(`failed to parse config ${n}: ${e}`),{}}}o(k,"loadJsonFile");function me(n,e){if(!Object.prototype.hasOwnProperty.call(n,"verification"))return;const t=n.verification;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'verification' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.enable' must be boolean. Got ${typeof r.enable}.`);if(Object.prototype.hasOwnProperty.call(r,"auto")&&typeof r.auto!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.auto' must be boolean. Got ${typeof r.auto}.`);if(Object.prototype.hasOwnProperty.call(r,"strict")&&typeof r.strict!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.strict' must be boolean. Got ${typeof r.strict}.`);if(Object.prototype.hasOwnProperty.call(r,"model")){const i=r.model,s=typeof i=="string",l=i!==null&&typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(a=>typeof a=="string");if(!s&&!l)throw new Error(`Invalid IronBee config in ${e}: 'verification.model' must be a string (applies to all clients) or an object of string values (per-client, e.g. { "claude": "sonnet", "codex": "gpt-5.5" }). Got ${Array.isArray(i)?"array":typeof i}.`)}}o(me,"assertVerificationShape");function Ae(n,e){const t=n.verification?.model;if(typeof t=="string")return t.length>0?t:void 0;if(t&&typeof t=="object"){const r=t[e];return typeof r=="string"&&r.length>0?r:void 0}}o(Ae,"getVerificationModel");function ve(n,e){if(!Object.prototype.hasOwnProperty.call(n,"telemetry"))return;const t=n.telemetry;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'telemetry' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'telemetry.enable' must be boolean. Got ${typeof r.enable}.`)}o(ve,"assertTelemetryShape");function Ie(n,e){if(!Object.prototype.hasOwnProperty.call(n,"privacy"))return;const t=n.privacy;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'privacy' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'privacy.enable' must be boolean. Got ${typeof r.enable}.`)}o(Ie,"assertPrivacyShape");function _(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(_,"mergeCycleConfig");function B(n,e){const t={...n,...e};return t.browser=_(n.browser,e.browser),t.node=_(n.node,e.node),t.backend=_(n.backend,e.backend),t.android=_(n.android,e.android),t.claude=xe(n.claude,e.claude),t.verification=we(n.verification,e.verification),t.verificationContext=Te(n.verificationContext,e.verificationContext),t}o(B,"mergeConfigLayers");function Te(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(Te,"mergeVerificationContextConfig");function we(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(we,"mergeVerificationConfig");function xe(n,e){if(n===void 0&&e===void 0)return;const t={...n??{},...e??{}};return(n?.oauthAccess!==void 0||e?.oauthAccess!==void 0)&&(t.oauthAccess={...n?.oauthAccess??{},...e?.oauthAccess??{}}),(n?.autoModeAllowlist!==void 0||e?.autoModeAllowlist!==void 0)&&(t.autoModeAllowlist={...n?.autoModeAllowlist??{},...e?.autoModeAllowlist??{}}),t}o(xe,"mergeClaudeConfig");function x(n){return{global:(0,b.join)((0,I.homedir)(),".ironbee","config.json"),project:n?(0,b.join)(n,".ironbee","config.json"):void 0,local:n?(0,b.join)(n,".ironbee","config.local.json"):void 0}}o(x,"getConfigLayerPaths");const je=["global","project","local"];function Re(n,e){const t=x(e);if(n==="global")return t.global;if(n==="project"){if(t.project===void 0)throw new Error("Project layer requested but no projectDir was provided.");return t.project}if(t.local===void 0)throw new Error("Local layer requested but no projectDir was provided.");return t.local}o(Re,"getTargetConfigPath");function Oe(n){if(n.global===!0&&n.local===!0)throw new Error("Pass at most one of --global / --local.");return n.global===!0?"global":n.local===!0?"local":"project"}o(Oe,"resolveConfigTargetFromFlags");function A(n){const e=k(n);return(0,E.existsSync)(n)&&(me(e,n),ve(e,n),Ie(e,n)),e}o(A,"loadAndValidateLayer");const j=[{envVar:"IRONBEE_API_KEY",configPath:"collector.apiKey"},{envVar:"IRONBEE_OAUTH_TOKEN",configPath:"collector.oauthToken"}];function he(n,e,t){const r=e.split(".");let i=n;for(let s=0;s<r.length-1;s++){const l=r[s],a=i[l];a!=null&&typeof a=="object"&&!Array.isArray(a)?i[l]={...a}:i[l]={},i=i[l]}i[r[r.length-1]]=t}o(he,"setAtConfigPath");function z(n){let e;for(const t of j){const r=process.env[t.envVar];if(r===void 0||r.length===0)continue;e===void 0&&(e={...n});const i=t.coerce?t.coerce(r):r;he(e,t.configPath,i)}return e??n}o(z,"applyEnvOverrides");function ke(n){for(const e of j){if(e.configPath!==n)continue;const t=process.env[e.envVar];if(t!==void 0&&t.length>0)return e}}o(ke,"findActiveEnvOverride");function c(n){const e=x(n),t=A(e.global),r=e.project?A(e.project):{},i=e.local?A(e.local):{},s=B(B(t,r),i);return z(s)}o(c,"loadConfig");function Be(n){let e=n.replace(/\{([^}]+)\}/g,(t,r)=>`(${r.split(",").map(i=>i.trim()).join("|")})`);return e=e.replace(/\*\*\//g,"\0DSS\0").replace(/\*\*/g,"\0DS\0").replace(/\*/g,"\0SS\0").replace(/\?/g,"\0QM\0"),e=e.replace(/[.+^$\\[\]]/g,"\\$&"),e=e.replace(/\x00DSS\x00/g,"(?:.*/)?").replace(/\x00DS\x00/g,".*").replace(/\x00SS\x00/g,"[^/]*").replace(/\x00QM\x00/g,"[^/]"),new RegExp(`(^|/)${e}$`)}o(Be,"globToRegExp");function C(n,e){const t=n.replace(/\\/g,"/");for(const r of e)if(Be(r).test(t))return!0;return!1}o(C,"matchesAny");function Se(n,e){if(e==="browser")return n.browser;if(e==="node")return n.node;if(e==="backend")return n.backend;if(e==="android")return n.android}o(Se,"getCycleBlock");function v(n,e){const t=Se(n,e);if(t!==void 0&&t.enable===!1)return[];const r=$[e]??[];if(t===void 0)return P.has(e)?[...r]:[];if(Array.isArray(t.verifyPatterns)&&t.verifyPatterns.length===0)return[];const i=t.verifyPatterns??r,s=t.additionalVerifyPatterns??[];return[...i,...s]}o(v,"getCyclePatterns");function J(n,e){const t=w(e);if(t.length>0&&C(n,t))return[];const r=[];C(n,v(e,"browser"))&&r.push("browser");for(const i of T){const s=v(e,i);s.length>0&&C(n,s)&&r.push(i)}return r}o(J,"getActiveCycles");function Le(n,e){return J(n,e).length>0}o(Le,"requiresVerification");function De(n,e){return O(n)?Z(n,e):!1}o(De,"isCycleEnabled");function Z(n,e){return v(n,e).length>0}o(Z,"isCyclePatternsActive");function Ne(n,e){let t,r;if(e==="browser"?(t=n.browser?.alwaysRequired??K,r=n.browser?.evidencePaths??[]):e==="node"?(t=n.node?.alwaysRequired??Y,r=n.node?.evidencePaths??X):e==="backend"?(t=n.backend?.alwaysRequired??H,r=n.backend?.evidencePaths??G):e==="android"?(t=n.android?.alwaysRequired??W,r=n.android?.evidencePaths??Q):(t=[],r=[]),t.length===0&&r.length===0)throw new Error(`Invalid required-tools config for cycle '${e}': both 'alwaysRequired' and 'evidencePaths' are empty. At least one must specify required tools.`);return{alwaysRequired:t,evidencePaths:r}}o(Ne,"getRequiredToolsConfig");const S="npx",Pe="^0.12.0",L=["-y",`@ironbee-ai/devtools@${Pe}`],Me={TOOL_NAME_PREFIX:"bdt_",TOOL_INPUT_METADATA_ENABLE:"true"},Fe={PLATFORM:"node",TOOL_NAME_PREFIX:"ndt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ve={PLATFORM:"backend",TOOL_NAME_PREFIX:"bedt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ue={PLATFORM:"android",TOOL_NAME_PREFIX:"adt_",TOOL_INPUT_METADATA_ENABLE:"true"},$e={BROWSER_DEVTOOLS_INSTALL_CHROMIUM:"true"},qe={},Ke={},Ye={};function Xe(n){return ce(n)?{}:{TELEMETRY_ENABLE:"false"}}o(Xe,"buildTelemetryEnv");function He(n){return le(n)?{COLLECTOR_EVENTS_TOOL_DETAILS_ENABLE:"false",COLLECTOR_ARTIFACTS_ENABLE:"false"}:{}}o(He,"buildPrivacyEnv");function Ge(n,e){if(!R(n))return{};const t=n.collector,i=k((0,b.join)((0,I.homedir)(),".ironbee","config.json")).collector??{},s=typeof i.oauthToken=="string"&&i.oauthToken.length>0,l=typeof i.apiKey=="string"&&i.apiKey.length>0;let a;t.oauthToken?a=s?"X-OAuth-Token=${file:~/.ironbee/config.json#collector.oauthToken}":`X-OAuth-Token=${t.oauthToken}`:a=l?"X-API-Key=${file:~/.ironbee/config.json#collector.apiKey}":`X-API-Key=${t.apiKey}`;const u={OTEL_ENABLE:"true",OTEL_EXPORTER_HTTP_URL:t.url,OTEL_EXPORTER_HTTP_HEADERS:a,OTEL_EXPORTER_TYPE:"otlp/http-protobuf"};return e==="browser"&&(u.OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS="change,input,click",u.BROWSER_HEADLESS_ENABLE="true"),u}o(Ge,"buildOTELEnv");function m(n,e,t,r,i){const s=Ge(n,i),l=Xe(n),a=He(n),u=n[e];if(u&&typeof u=="object"&&!Array.isArray(u)){const f=u;if(f.mcp&&typeof f.mcp=="object"&&!Array.isArray(f.mcp)){const g={...f.mcp},d={...s,...l,...a,...g.env??{},...t};return g.env=d,g}const h={};if(f.env&&typeof f.env=="object"&&!Array.isArray(f.env)){const g=f.env;for(const d of Object.keys(g))typeof g[d]=="string"&&(h[d]=g[d])}return{command:S,args:[...L],env:{...r,...s,...l,...a,...h,...t}}}return{command:S,args:[...L],env:{...r,...s,...l,...a,...t}}}o(m,"buildMcpEntry");function We(n){const e=c(n);return m(e,"browserDevTools",Me,$e,"browser")}o(We,"getMcpServerEntry");function Qe(n){const e=c(n);return m(e,"nodeDevTools",Fe,qe,"node")}o(Qe,"getNodeDevToolsMcpEntry");function ze(n){const e=c(n);return m(e,"backendDevTools",Ve,Ke,"backend")}o(ze,"getBackendDevToolsMcpEntry");function Je(n){const e=c(n);return m(e,"androidDevTools",Ue,Ye,"android")}o(Je,"getAndroidDevToolsMcpEntry");function Ze(n){return typeof n.maxRetries=="number"&&n.maxRetries>0?n.maxRetries:Ce}o(Ze,"getMaxRetries");function R(n){if(process.env.IRONBEE_COLLECTOR==="false")return!1;const e=n.collector;if(!e||e.enable===!1||typeof e.url!="string"||e.url.length===0)return!1;const t=typeof e.oauthToken=="string"&&e.oauthToken.length>0,r=typeof e.apiKey=="string"&&e.apiKey.length>0;return!(!t&&!r)}o(R,"isCollectorConfigured");function en(n){const e=c(n);return p(e,e.jobQueue)}o(en,"isJobQueueEnabled");function nn(n){const e=c(n);return p(e,e.recording)}o(nn,"isRecordingEnabled");function tn(n){return p(n,n.statusLine)}o(tn,"isSessionStatusEnabled");function on(n){const e=n.statusLine;return e!==void 0&&e.renderDefault===!0}o(on,"getStatusLineRenderDefault");function rn(n){const e=n.statusLine?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:10}o(rn,"getStatusLineEmitMinIntervalSeconds");const ee=60;function sn(n){return n.claude?.oauthAccess?.enable!==!1}o(sn,"getClaudeOauthAccessEnabled");function an(n){return n.claude?.autoModeAllowlist?.enable!==!1}o(an,"isAutoModeAllowlistEnabled");function cn(n){const e=n.claude?.oauthAccess?.usageTtlSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:ee}o(cn,"getClaudeOauthAccessUsageTtlSeconds");const ne=15986,te=600,oe=30,re=0;function ln(n){return p(n,n.otel)}o(ln,"isOTELEnabled");function un(n){const e=n.otel?.port;return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<65536?e:ne}o(un,"getOTELPort");function fn(n){const e=n.otel?.idleTimeoutSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:te}o(fn,"getOTELIdleTimeoutSeconds");function gn(n){const e=n.otel?.ensureMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:oe}o(gn,"getOTELEnsureMinIntervalSeconds");function dn(n){const e=n.otel?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:re}o(dn,"getOTELEmitMinIntervalSeconds");function pn(n){const e=n.statusLine?.refreshInterval;if(typeof e=="number"&&Number.isFinite(e)&&e>=1)return e}o(pn,"getStatusLineRefreshInterval");function p(n,e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e.enable!==!1:R(n)}o(p,"isFeatureEnabledWithCollectorAutoEnable");function Bn(n){return n==null||typeof n!="object"||Array.isArray(n)?!1:n.enable!==!1}o(Bn,"isPresenceEnabled");function O(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(O,"getVerificationEnabled");function ie(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.auto!==!1}o(ie,"getAutoVerifyEnabled");function bn(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.strict===!0}o(bn,"getVerificationStrict");const se=65536,ae=1;function En(n){const e=n.verificationContext;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(En,"getVerificationContextEnabled");function yn(n){return n.verificationContext?.source==="actions"?"actions":"git"}o(yn,"getVerificationContextSource");function _n(n){const e=n.verificationContext?.commitDepth;return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):ae}o(_n,"getVerificationContextCommitDepth");function Cn(n){const e=n.verificationContext?.maxBytes;return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):se}o(Cn,"getVerificationContextMaxBytes");function mn(n,e){const t=w(n);return t.length>0&&C(e,t)}o(mn,"isIgnoredVerifyPath");function An(n){return O(n)?ie(n)?"enforce":"assist":"monitor"}o(An,"getVerificationMode");function ce(n){const e=n.telemetry;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(ce,"getTelemetryEnabled");function le(n){const e=n.privacy;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.enable===!0}o(le,"getPrivacyEnabled");const D=65536;function vn(n){const e=n.fileChange;return!e||typeof e!="object"||Array.isArray(e)?!1:e.captureChangeset===!0}o(vn,"getCaptureFileChangeset");function In(n){const e=n.fileChange;if(!e||typeof e!="object"||Array.isArray(e))return D;const t=e.maxChangesetBytes;return typeof t!="number"||!Number.isFinite(t)||t<=0?D:Math.floor(t)}o(In,"getMaxChangesetBytes");function Tn(n){const e=c(n);return p(e,e.analytics)}o(Tn,"isAnalyticsEnabled");function wn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitOnStop!==!1}o(wn,"isAnalyticsEmitOnStopEnabled");function xn(n){const t=c(n).analytics;if(t===null||typeof t!="object"||Array.isArray(t))return 0;const r=t.emitOnStopMinIntervalSeconds;return typeof r=="number"&&r>=0?r:0}o(xn,"getAnalyticsEmitOnStopMinIntervalSeconds");function jn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitTurnEvents===!0}o(jn,"isAnalyticsTurnEventsEnabled");function Rn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitStepEvents===!0}o(Rn,"isAnalyticsStepEventsEnabled");function On(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitApiRequestEvents!==!1}o(On,"isAnalyticsApiRequestEventsEnabled");0&&(module.exports={ALL_CYCLES,CONFIG_TARGETS_BY_PRECEDENCE,CYCLES_ENABLED_BY_DEFAULT,CYCLE_DEFAULT_VERIFY_PATTERNS,CYCLE_TOOL_PREFIXES,CYCLE_TO_SERVER,DEFAULT_ANDROID_ALWAYS_REQUIRED,DEFAULT_ANDROID_EVIDENCE_PATHS,DEFAULT_ANDROID_VERIFY_PATTERNS,DEFAULT_BACKEND_ALWAYS_REQUIRED,DEFAULT_BACKEND_EVIDENCE_PATHS,DEFAULT_BACKEND_VERIFY_PATTERNS,DEFAULT_BROWSER_ALWAYS_REQUIRED,DEFAULT_BROWSER_VERIFY_PATTERNS,DEFAULT_IGNORED_VERIFY_PATTERNS,DEFAULT_NODE_ALWAYS_REQUIRED,DEFAULT_NODE_EVIDENCE_PATHS,DEFAULT_NODE_VERIFY_PATTERNS,DEFAULT_OAUTH_USAGE_TTL_SECONDS,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS,DEFAULT_OTEL_PORT,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES,ENV_OVERRIDES,OPTIONAL_CYCLES,applyEnvOverrides,findActiveEnvOverride,getActiveCycles,getAnalyticsEmitOnStopMinIntervalSeconds,getAndroidDevToolsMcpEntry,getAutoVerifyEnabled,getBackendDevToolsMcpEntry,getCaptureFileChangeset,getClaudeOauthAccessEnabled,getClaudeOauthAccessUsageTtlSeconds,getConfigLayerPaths,getMaxChangesetBytes,getMaxRetries,getMcpServerEntry,getNodeDevToolsMcpEntry,getOTELEmitMinIntervalSeconds,getOTELEnsureMinIntervalSeconds,getOTELIdleTimeoutSeconds,getOTELPort,getPrivacyEnabled,getRequiredToolsConfig,getStatusLineEmitMinIntervalSeconds,getStatusLineRefreshInterval,getStatusLineRenderDefault,getTargetConfigPath,getTelemetryEnabled,getVerificationContextCommitDepth,getVerificationContextEnabled,getVerificationContextMaxBytes,getVerificationContextSource,getVerificationEnabled,getVerificationMode,getVerificationModel,getVerificationStrict,isAnalyticsApiRequestEventsEnabled,isAnalyticsEmitOnStopEnabled,isAnalyticsEnabled,isAnalyticsStepEventsEnabled,isAnalyticsTurnEventsEnabled,isAutoModeAllowlistEnabled,isCollectorConfigured,isCycleEnabled,isCyclePatternsActive,isIgnoredVerifyPath,isJobQueueEnabled,isOTELEnabled,isRecordingEnabled,isSessionStatusEnabled,loadConfig,requiresVerification,resolveConfigTargetFromFlags,resolveIgnoredVerifyPatterns});
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var L=(e,S)=>{for(var o in S)r(e,o,{get:S[o],enumerable:!0})},N=(e,S,o,t)=>{if(S&&typeof S=="object"||typeof S=="function")for(let n of E(S))!I.call(e,n)&&n!==o&&r(e,n,{get:()=>S[n],enumerable:!(t=A(S,n))||t.enumerable});return e};var _=e=>N(r({},"__esModule",{value:!0}),e);var c={};L(c,{INSTALL_SCHEMA_VERSION:()=>b});module.exports=_(c);const b=4;0&&(module.exports={INSTALL_SCHEMA_VERSION});
1
+ "use strict";var r=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var L=(e,S)=>{for(var o in S)r(e,o,{get:S[o],enumerable:!0})},N=(e,S,o,t)=>{if(S&&typeof S=="object"||typeof S=="function")for(let n of E(S))!I.call(e,n)&&n!==o&&r(e,n,{get:()=>S[n],enumerable:!(t=A(S,n))||t.enumerable});return e};var _=e=>N(r({},"__esModule",{value:!0}),e);var c={};L(c,{INSTALL_SCHEMA_VERSION:()=>b});module.exports=_(c);const b=5;0&&(module.exports={INSTALL_SCHEMA_VERSION});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ironbee-ai/cli",
3
- "version": "0.25.1",
3
+ "version": "0.26.0",
4
4
  "description": "The CLI for IronBee — Verification and Intelligence Layer for Agentic Development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {