@ironbee-ai/cli 0.21.2 → 0.22.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 +6 -0
- package/dist/clients/claude/agents/ironbee-verifier.md +12 -2
- package/dist/clients/claude/commands/ironbee-verify.md +28 -15
- package/dist/clients/claude/hooks/activity-start.js +1 -1
- package/dist/clients/claude/hooks/require-verdict.js +2 -2
- package/dist/clients/claude/hooks/require-verification.js +7 -7
- package/dist/clients/claude/hooks/track-action.js +1 -1
- package/dist/clients/claude/index.js +4 -4
- package/dist/clients/claude/platforms/skill.android.md +65 -0
- package/dist/clients/codex/agents/ironbee-verifier.md +11 -1
- package/dist/clients/codex/commands/ironbee-verify/SKILL.md +24 -5
- package/dist/clients/codex/hooks/require-verification.js +7 -7
- package/dist/clients/codex/hooks/track-action.js +1 -1
- package/dist/clients/codex/index.js +2 -2
- package/dist/clients/codex/platforms/command-verify.android.md +61 -0
- package/dist/clients/codex/platforms/rule.android.md +32 -0
- package/dist/clients/codex/platforms/skill.android.md +55 -0
- package/dist/clients/codex/skills/ironbee-verification.md +3 -0
- package/dist/clients/codex/util.js +11 -11
- package/dist/clients/cursor/commands/ironbee-verify/SKILL.md +21 -4
- package/dist/clients/cursor/hooks/require-verdict.js +1 -1
- package/dist/clients/cursor/hooks/require-verification.js +6 -6
- package/dist/clients/cursor/hooks/track-action.js +1 -1
- package/dist/clients/cursor/index.js +1 -1
- package/dist/clients/cursor/platforms/command-verify.android.md +61 -0
- package/dist/clients/cursor/platforms/rule.android.md +32 -0
- package/dist/clients/cursor/platforms/skill.android.md +55 -0
- package/dist/clients/cursor/rules/ironbee-verification.mdc +3 -0
- package/dist/clients/cursor/skills/ironbee-verification.md +3 -0
- package/dist/commands/android.js +1 -0
- package/dist/commands/config.js +2 -2
- package/dist/commands/cycle-toggle.js +4 -4
- package/dist/commands/hook.js +16 -15
- package/dist/commands/install.js +1 -1
- package/dist/commands/mode-select.js +2 -0
- package/dist/hooks/core/actions.js +6 -5
- package/dist/hooks/core/session-state.js +1 -1
- package/dist/hooks/core/submit-verdict.js +4 -4
- package/dist/hooks/core/verification-lifecycle.js +1 -1
- package/dist/hooks/core/verify-gate.js +29 -23
- package/dist/import/claude/events/tool-call.js +1 -1
- package/dist/import/codex/events/tool-call.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/install-version.js +1 -0
- package/dist/lib/platform-section.js +4 -3
- package/dist/lib/prompt.js +4 -4
- package/dist/lib/recording-tools.js +1 -0
- package/dist/lib/schema-sync.js +2 -0
- package/dist/lib/version.js +1 -1
- package/dist/scripts/postinstall.js +1 -1
- package/dist/tui/config/schema.js +1 -1
- package/dist/tui/platforms/area.js +2 -2
- package/dist/tui/projects/area.js +4 -4
- package/dist/tui/sessions/area.js +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var a=(i,e)=>f(i,"name",{value:e,configurable:!0});var h=(i,e)=>{for(var n in e)f(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&&f(i,r,{get:()=>e[r],enumerable:!(t=I(e,r))||t.enumerable});return i};var V=i=>_(f({},"__esModule",{value:!0}),i);var gt={};h(gt,{addPendingFixes:()=>nt,clearActiveActivity:()=>ct,clearActiveFix:()=>k,clearActiveVerification:()=>P,clearPendingFixes:()=>rt,closeOpenCycles:()=>st,generateTraceId:()=>b,getActiveActivityId:()=>H,getActiveFixId:()=>U,getActiveTraceId:()=>E,getActiveVerificationId:()=>w,getChainedStatusLine:()=>Z,getContextInjectedVerificationId:()=>tt,getLastVerdictStatus:()=>q,getPendingFixes:()=>it,getPhase:()=>z,getRetries:()=>F,getUsagePlan:()=>X,getUsageType:()=>Q,getUserEmail:()=>K,incrementRetries:()=>R,isActive:()=>W,isRecordingActive:()=>N,isRecordingRequired:()=>O,readState:()=>s,reconcileAbandonedActivity:()=>dt,reconcileForCompact:()=>ut,reconcileSessionState:()=>ot,resetRetries:()=>$,setActive:()=>G,setActiveActivity:()=>at,setActiveFix:()=>L,setActiveVerification:()=>T,setChainedStatusLine:()=>D,setContextInjectedVerificationId:()=>et,setLastVerdictStatus:()=>j,setPhase:()=>C,setRecordingActive:()=>B,setRecordingRequired:()=>J,setUsage:()=>Y,setUserEmail:()=>M,writeState:()=>u});module.exports=V(gt);var x=require("crypto"),l=require("fs"),p=require("path"),g=require("../../lib/logger"),v=require("../../lib/atomic"),d=require("./actions");const y="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:[]};function b(){return(0,x.randomBytes)(16).toString("hex")}a(b,"generateTraceId");function s(i){const e=(0,p.join)(i,y);if(!(0,l.existsSync)(e))return{...S};try{const n=(0,l.readFileSync)(e,"utf-8"),t=JSON.parse(n),r=["coding","verifying","fixing"],c=["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"&&c.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):[]}}catch(n){return g.logger.debug(`failed to read state from ${e}: ${n}`),{...S}}}a(s,"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(c){try{(0,l.existsSync)(t)&&(0,l.unlinkSync)(t)}catch{}throw c}(0,v.sweepStaleTmpFiles)(n)}catch(t){g.logger.debug(`failed to write state to ${n}: ${t}`)}}a(u,"writeState");function w(i){return s(i).activeVerificationId??void 0}a(w,"getActiveVerificationId");function T(i,e,n){const t=s(i);t.activeVerificationId=e,t.activeTraceId=n,t.phase="verifying",u(i,t)}a(T,"setActiveVerification");function E(i){return s(i).activeTraceId??void 0}a(E,"getActiveTraceId");function P(i){const e=s(i);e.activeVerificationId=null,e.activeTraceId=null,e.phase="coding",u(i,e)}a(P,"clearActiveVerification");function F(i){return s(i).retries}a(F,"getRetries");function R(i){const e=s(i);return e.retries=e.retries+1,u(i,e),e.retries}a(R,"incrementRetries");function $(i){const e=s(i);e.retries=0,u(i,e)}a($,"resetRetries");function q(i){return s(i).lastVerdictStatus??void 0}a(q,"getLastVerdictStatus");function j(i,e){const n=s(i);n.lastVerdictStatus=e,u(i,n)}a(j,"setLastVerdictStatus");function L(i,e){const n=s(i);n.activeFixId=e,u(i,n)}a(L,"setActiveFix");function U(i){return s(i).activeFixId??void 0}a(U,"getActiveFixId");function k(i){const e=s(i);e.activeFixId=null,u(i,e)}a(k,"clearActiveFix");function C(i,e){const n=s(i);n.phase=e,u(i,n)}a(C,"setPhase");function z(i){return s(i).phase}a(z,"getPhase");function O(i){return s(i).recordingRequired}a(O,"isRecordingRequired");function J(i,e){const n=s(i);n.recordingRequired=e,u(i,n)}a(J,"setRecordingRequired");function N(i){return s(i).recordingActive}a(N,"isRecordingActive");function B(i,e){const n=s(i);n.recordingActive=e,u(i,n)}a(B,"setRecordingActive");function W(i){return s(i).active}a(W,"isActive");function G(i,e){const n=s(i);n.active=e,e||(n.activeActivityId=null),u(i,n)}a(G,"setActive");function H(i){return s(i).activeActivityId??void 0}a(H,"getActiveActivityId");function K(i){return s(i).userEmail??void 0}a(K,"getUserEmail");function M(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=s(i);t.userEmail!==n&&(t.userEmail=n,u(i,t))}a(M,"setUserEmail");function Q(i){return s(i).usageType??void 0}a(Q,"getUsageType");function X(i){return s(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=s(i);r.usageType===n&&r.usagePlan===t||(r.usageType=n,r.usagePlan=t,u(i,r))}a(Y,"setUsage");function Z(i){return s(i).chainedStatusLine??void 0}a(Z,"getChainedStatusLine");function D(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=s(i);t.chainedStatusLine!==n&&(t.chainedStatusLine=n,u(i,t))}a(D,"setChainedStatusLine");function tt(i){return s(i).contextInjectedVerificationId??void 0}a(tt,"getContextInjectedVerificationId");function et(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=s(i);t.contextInjectedVerificationId!==n&&(t.contextInjectedVerificationId=n,u(i,t))}a(et,"setContextInjectedVerificationId");function it(i){return s(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=s(i),r=new Set(t.pendingFixes),c=[...t.pendingFixes];for(const o of n)r.has(o)||(r.add(o),c.push(o));c.length!==t.pendingFixes.length&&(t.pendingFixes=c,u(i,t))}a(nt,"addPendingFixes");function rt(i){const e=s(i);e.pendingFixes.length!==0&&(e.pendingFixes=[],u(i,e))}a(rt,"clearPendingFixes");function at(i,e){const n=s(i);n.activeActivityId=e,n.active=!0,u(i,n)}a(at,"setActiveActivity");function ct(i){const e=s(i);e.activeActivityId=null,e.active=!1,u(i,e)}a(ct,"clearActiveActivity");async function st(i,e,n){const t=s(i);let r=!1;if(t.activeVerificationId){const c=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:c,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",c),reason:n};await(0,d.appendAction)(e,o),g.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 c=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:c,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",c),reason:n};await(0,d.appendAction)(e,o),g.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),r&&u(i,t)}a(st,"closeOpenCycles");async function ot(i,e,n){const t=s(i);let r=!1;if(t.activeVerificationId){const c=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:c,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",c),reason:"session_reconcile"};await n(e,o),g.logger.debug(`reconcile: ended abandoned verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const c=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:c,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",c),reason:"session_reconcile"};await n(e,o),g.logger.debug(`reconcile: ended abandoned fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const c=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:c,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",c),reason:"session_reconcile"};await n(e,o),g.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),r&&u(i,t)}a(ot,"reconcileSessionState");async function dt(i,e,n){const t=s(i);if(!t.active&&!t.activeVerificationId&&!t.activeFixId)return;let r=!1;if(t.activeVerificationId){const c=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:c,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",c),reason:"interrupt_inferred"};await n(e,o),g.logger.debug(`interrupt-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const c=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:c,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",c),reason:"interrupt_inferred"};await n(e,o),g.logger.debug(`interrupt-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const c=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:c,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",c),reason:"interrupt_inferred"};await n(e,o),g.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),r&&u(i,t)}a(dt,"reconcileAbandonedActivity");async function ut(i,e,n){const t=s(i);let r=!1;if(t.activeVerificationId){const c=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:c,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",c),reason:"compact"};await n(e,o),g.logger.debug(`compact-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const c=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:c,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",c),reason:"compact"};await n(e,o),g.logger.debug(`compact-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const c=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:c,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",c),reason:"compact"};await n(e,o),g.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),r&&u(i,t)}a(ut,"reconcileForCompact");0&&(module.exports={addPendingFixes,clearActiveActivity,clearActiveFix,clearActiveVerification,clearPendingFixes,closeOpenCycles,generateTraceId,getActiveActivityId,getActiveFixId,getActiveTraceId,getActiveVerificationId,getChainedStatusLine,getContextInjectedVerificationId,getLastVerdictStatus,getPendingFixes,getPhase,getRetries,getUsagePlan,getUsageType,getUserEmail,incrementRetries,isActive,isRecordingActive,isRecordingRequired,readState,reconcileAbandonedActivity,reconcileForCompact,reconcileSessionState,resetRetries,setActive,setActiveActivity,setActiveFix,setActiveVerification,setChainedStatusLine,setContextInjectedVerificationId,setLastVerdictStatus,setPhase,setRecordingActive,setRecordingRequired,setUsage,setUserEmail,writeState});
|
|
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,8 +1,8 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var y=(c,s)=>g(c,"name",{value:s,configurable:!0});var D=(c,s)=>{for(var e in s)g(c,e,{get:s[e],enumerable:!0})},C=(c,s,e,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of R(s))!S.call(c,r)&&r!==e&&g(c,r,{get:()=>s[r],enumerable:!(o=F(s,r))||o.enumerable});return c};var I=c=>C(g({},"__esModule",{value:!0}),c);var k={};D(k,{runSubmitVerdict:()=>$});module.exports=I(k);var l=require("fs"),E=require("path"),u=require("../../lib/logger"),x=require("../../lib/recording-tools"),b=require("../../lib/telemetry"),n=require("./actions"),i=require("./session-state");function T(c,s){const e=(0,i.getPendingFixes)(c);if(e.length>0)return e;const o=(0,n.summarizeFixFileChanges)((0,n.getFileChangesSinceLastFailVerdict)(s));return o.length>0?o:["re-verified after a prior failure (no tracked code changes in this fix cycle)"]}y(T,"deriveFixes");async function $(c){const{sessionId:s,sessionDir:e,verdictFile:o,actionsFile:r,verdictJson:V,projectDir:h}=c;let t;try{t=JSON.parse(V)}catch(a){return u.logger.debug(`submit-verdict: invalid JSON: ${a}`),{success:!1,message:"REJECTED: verdict is not valid JSON."}}if(t.status!=="pass"&&t.status!=="fail")return{success:!1,message:`REJECTED: status must be "pass" or "fail", got "${t.status}".`};if(!Array.isArray(t.checks)||t.checks.length===0)return{success:!1,message:"REJECTED: checks must be a non-empty array describing what you functionally tested."};if(t.status==="fail"&&(!Array.isArray(t.issues)||t.issues.length===0))return{success:!1,message:'REJECTED: when status is "fail", issues must be a non-empty array describing what failed.'};if(t.status==="pass"&&(0,i.isFailLikeVerdictStatus)((0,i.getLastVerdictStatus)(e))&&(!Array.isArray(t.fixes)||t.fixes.length===0)&&(t.fixes=T(e,r)),(0,i.isRecordingRequired)(e)&&(0,i.isRecordingActive)(e))return{success:!1,message:`REJECTED: recording is still active.
|
|
2
2
|
|
|
3
3
|
1. Stop recording first:
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
${(0,x.listRecordingCycleTools)().map(d=>` ${d.stopTool} (${d.cycle} cycle)`).join(`
|
|
5
|
+
`)}
|
|
6
6
|
2. Then re-run the same submit-verdict command.
|
|
7
7
|
|
|
8
|
-
Recording start/stop must bracket the verification flow \u2014 start before
|
|
8
|
+
Recording start/stop must bracket the verification flow \u2014 start before devtools tools, stop before submit-verdict.`};try{(0,l.mkdirSync)((0,E.dirname)(o),{recursive:!0}),(0,l.writeFileSync)(o,JSON.stringify(t,null,2))}catch(a){return u.logger.debug(`submit-verdict: failed to write ${o}: ${a}`),{success:!1,message:`REJECTED: failed to write verdict file: ${a}`}}(0,i.setLastVerdictStatus)(e,t.status),(0,i.clearPendingFixes)(e),(0,i.isRecordingRequired)(e)&&(0,i.setRecordingRequired)(e,!1);const m=(0,i.getActiveActivityId)(e),v=(0,i.getActiveFixId)(e);if(v){const a=Date.now(),d={...(0,n.baseFields)(r),type:"fix_end",timestamp:a,fix_id:v,activity_id:m,duration:(0,n.findDurationSinceLastAction)(r,"fix_start",a)};await(0,n.appendAction)(r,d),(0,i.clearActiveFix)(e),(0,i.setPhase)(e,"coding"),u.logger.debug(`fix-end (verdict): ${v}`)}const f=(0,i.getActiveVerificationId)(e),p=(0,i.getActiveTraceId)(e);if(f){const a=Date.now(),d={...(0,n.baseFields)(r),type:"verification_end",timestamp:a,verification_id:f,activity_id:m,trace_id:p,duration:(0,n.findDurationSinceLastAction)(r,"verification_start",a),status:t.status};await(0,n.appendAction)(r,d),(0,i.clearActiveVerification)(e),u.logger.debug(`verification-end (auto): ${f} trace=${p}`)}const A=t,w={...(0,n.baseFields)(r),type:"verdict_write",timestamp:Date.now(),verification_id:f,activity_id:m,trace_id:p,verdict:A};return await(0,n.appendAction)(r,w),await(0,b.trackVerdictWrite)(s,t.status,h),u.logger.debug(`submit-verdict: session=${s} status=${t.status}`),t.status==="pass"?{success:!0,message:`VERDICT ACCEPTED: pass.${t.fixes?.length?` Fixes: ${t.fixes.join(", ")}`:""}`}:{success:!0,message:`VERDICT ACCEPTED: fail. Issues: ${(t.issues??[]).join(", ")}. Fix and re-verify.`}}y($,"runSubmitVerdict");0&&(module.exports={runSubmitVerdict});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var x=(n,t)=>v(n,"name",{value:t,configurable:!0});var A=(n,t)=>{for(var e in t)v(n,e,{get:t[e],enumerable:!0})},_=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of y(t))!V.call(n,a)&&a!==e&&v(n,a,{get:()=>t[a],enumerable:!(s=p(t,a))||s.enumerable});return n};var F=n=>_(v({},"__esModule",{value:!0}),n);var D={};A(D,{endVerification:()=>w,openFixCycleIfFixing:()=>b,startVerification:()=>E});module.exports=F(D);var I=require("crypto"),f=require("../../lib/logger"),r=require("./actions"),i=require("./session-state");async function E(n){const{sessionDir:t,actionsFile:e}=n,s=(0,i.getActiveActivityId)(t),a=(0,i.getActiveFixId)(t);if(a){const g=Date.now(),u={...(0,r.baseFields)(e),type:"fix_end",timestamp:g,fix_id:a,activity_id:s,duration:(0,r.findDurationSinceLastAction)(e,"fix_start",g)};await(0,r.appendAction)(e,u),(0,i.clearActiveFix)(t),f.logger.debug(`fix-end: ${a} (starting new verification)`)}const c=(0,i.getActiveVerificationId)(t);if(c){const g=(0,i.getActiveTraceId)(t);f.logger.debug(`ending previous verification ${c} before starting new one`);const u=Date.now(),l={...(0,r.baseFields)(e),type:"verification_end",timestamp:u,verification_id:c,activity_id:s,trace_id:g,duration:(0,r.findDurationSinceLastAction)(e,"verification_start",u)};await(0,r.appendAction)(e,l),(0,i.clearActiveVerification)(t)}const o=(0,I.randomUUID)(),d=(0,i.generateTraceId)(),m={...(0,r.baseFields)(e),type:"verification_start",timestamp:Date.now(),verification_id:o,activity_id:s,trace_id:d};return await(0,r.appendAction)(e,m),(0,i.setActiveVerification)(t,o,d),n.recordingEnabled&&((0,i.setRecordingRequired)(t,!0),(0,i.setRecordingActive)(t,!1)),n.intent==="fix"?(0,i.setVerifyIntent)(t,"fix"):(0,i.clearVerifyIntent)(t),f.logger.debug(`verification-start: ${o} trace=${d} recording=${!!n.recordingEnabled} intent=${n.intent??"-"}`),{verificationId:o,traceId:d}}x(E,"startVerification");async function b(n){const{sessionDir:t,actionsFile:e}=n;if(!(0,i.isFailLikeVerdictStatus)((0,i.getLastVerdictStatus)(t)))return;const s=(0,i.getActiveFixId)(t);if(s)return s;const a=(0,i.getActiveActivityId)(t),c=(0,I.randomUUID)(),o={...(0,r.baseFields)(e),type:"fix_start",timestamp:Date.now(),fix_id:c,activity_id:a};return await(0,r.appendAction)(e,o),(0,i.setActiveFix)(t,c),(0,i.setPhase)(t,"fixing"),f.logger.debug(`fix-start (edit after fail): ${c}`),c}x(b,"openFixCycleIfFixing");async function w(n){const{sessionDir:t,actionsFile:e}=n,s=(0,i.getActiveVerificationId)(t);if(!s)return{success:!1,message:"No active verification to end."};const a=(0,i.getActiveTraceId)(t),c=(0,i.getActiveActivityId)(t),o=Date.now(),d={...(0,r.baseFields)(e),type:"verification_end",timestamp:o,verification_id:s,activity_id:c,trace_id:a,duration:(0,r.findDurationSinceLastAction)(e,"verification_start",o)};return await(0,r.appendAction)(e,d),(0,i.clearActiveVerification)(t),f.logger.debug(`verification-end: ${s} trace=${a}`),{success:!0,verificationId:s,traceId:a,message:`Verification ${s} ended.`}}x(w,"endVerification");0&&(module.exports={endVerification,openFixCycleIfFixing,startVerification});
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
"use strict";var w=Object.defineProperty;var
|
|
1
|
+
"use strict";var w=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var l=(e,t)=>w(e,"name",{value:t,configurable:!0});var B=(e,t)=>{for(var i in t)w(e,i,{get:t[i],enumerable:!0})},M=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of P(t))!q.call(e,n)&&n!==i&&w(e,n,{get:()=>t[n],enumerable:!(o=L(t,n))||o.enumerable});return e};var U=e=>M(w({},"__esModule",{value:!0}),e);var te={};B(te,{runVerifyGate:()=>ee});module.exports=U(te);var p=require("fs"),f=require("../../lib/logger"),F=require("../../lib/telemetry"),g=require("./actions"),s=require("./session-state"),h=require("../../lib/config"),N=require("./required-tools");const G=3;function J(e){const t=h.CYCLE_TO_SERVER[e];if(t===void 0)throw new Error(`No MCP server registered for cycle '${e}'.`);return t}l(J,"mcpServerForCycle");function b(e){return JSON.stringify({session_id:e,status:"pass",checks:["form submits successfully","new item appears in list","no console errors"]})}l(b,"verdictExamplePass");function D(e){return JSON.stringify({session_id:e,status:"fail",checks:["form renders","submit button unresponsive"],issues:["button click handler not firing","TypeError in console"]})}l(D,"verdictExampleFail");function _(...e){for(const t of e)try{(0,p.existsSync)(t)&&(0,p.unlinkSync)(t)}catch(i){f.logger.debug(`failed to cleanup ${t}: ${i}`)}}l(_,"cleanup");function Y(e,t){const i=(0,g.getFileChangesSinceLastVerification)(e),o=new Set;for(const u of i)for(const c of(0,h.getActiveCycles)(u.file_path,t))o.add(c);const n=[];o.has("browser")&&n.push("browser");for(const u of h.OPTIONAL_CYCLES)o.has(u)&&n.push(u);return n}l(Y,"computeActiveCycles");function H(e,t,i){const o=J(e),n=new Set(t.filter(c=>c.tool_type==="mcp"&&c.mcp_server===o).map(c=>c.tool_name)),u=(0,h.getRequiredToolsConfig)(i,e);return{cycle:e,result:(0,N.satisfyRequiredTools)(n,u),config:u,usedCount:n.size}}l(H,"checkCycleTools");function Q(e){return{cycle:"browser",valid:!0,passCriteriaMet:!0}}l(Q,"checkBrowserEvidence");function z(e){return{cycle:"node",valid:!0,passCriteriaMet:!0}}l(z,"checkNodeEvidence");function W(e){return{cycle:"backend",valid:!0,passCriteriaMet:!0}}l(W,"checkBackendEvidence");function X(e){return{cycle:"android",valid:!0,passCriteriaMet:!0}}l(X,"checkAndroidEvidence");function K(e,t){if(!Array.isArray(t.checks)||t.checks.length===0)return{cycle:e,valid:!1,reason:"missing checks"};if(e==="browser")return Q(t);if(e==="node")return z(t);if(e==="backend")return W(t);if(e==="android")return X(t);throw new Error(`No evidence checker registered for cycle '${e}'.`)}l(K,"checkCycleEvidence");function Z(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}`}
|
|
4
|
+
${i}`}l(Z,"describeMissingTools");async function ee(e){const{sessionId:t,sessionDir:i,actionsFile:o,verdictFile:n,maxRetries:u}=e,c=u??G,k=e.config??(0,h.loadConfig)(e.projectDir);if(f.logger.debug(`verify-gate: session=${t} verdictExists=${(0,p.existsSync)(n)}`),!(0,g.hasFileChangesSinceLastVerification)(o)){if((0,s.getLastVerdictStatus)(i)==="fail"){if((0,s.getVerifyIntent)(i)!=="fix")return f.logger.debug("fail verdict with no code changes in window \u2014 status report, allowing"),(0,s.setLastVerdictStatus)(i,"fail_reported"),await d(o,i,t,"allow","fail_verdict_reported",[],e.projectDir),{action:"allow"};const r=(0,s.incrementRetries)(i);return r>=c?(f.logger.debug(`fix intent declared but retries exhausted (${r}/${c}) \u2014 releasing`),(0,s.resetRetries)(i),await(0,s.closeOpenCycles)(i,o,"max_retries_exceeded"),await d(o,i,t,"allow","max_retries_exceeded",[],e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${c} TIMES. Allowing completion.
|
|
5
|
+
|
|
6
|
+
The fail verdict was never resolved. Report the unresolved issues in your final response.`}):(f.logger.debug(`fix intent declared, fail verdict not addressed \u2014 blocking (unaddressed, attempt ${r}/${c})`),await d(o,i,t,"block","fail_verdict_unaddressed",[],e.projectDir),{action:"block",message:`VERIFICATION FAILED \u2014 unaddressed (attempt ${r}/${c}).
|
|
5
7
|
|
|
6
8
|
You submitted a fail verdict but did not address the reported issues. Either:
|
|
7
9
|
|
|
8
10
|
1. Fix the failing issues in code, then run a fresh verification cycle:
|
|
9
|
-
echo '{"session_id":"${t}"}' | ironbee hook verification-start
|
|
11
|
+
echo '{"session_id":"${t}"}' | ironbee hook verification-start --intent fix
|
|
10
12
|
... rerun the relevant verification tools and submit a pass verdict ...
|
|
11
13
|
|
|
12
|
-
2. Or \u2014 if the issues genuinely cannot be fixed \u2014
|
|
13
|
-
confirm the failure
|
|
14
|
-
will allow completion with the issues reported
|
|
14
|
+
2. Or \u2014 if the issues genuinely cannot be fixed \u2014 re-verify (keep the --intent fix flag)
|
|
15
|
+
to confirm the failure: each blocked stop counts toward maxRetries; once exhausted,
|
|
16
|
+
the gate will allow completion with the issues reported.`})}return f.logger.debug("no code changes detected, allowing completion"),await d(o,i,t,"allow","no_edits",[],e.projectDir),{action:"allow"}}const a=Y(o,k);if(a.length===0)return f.logger.debug("file changes match no cycle pattern, allowing completion"),await d(o,i,t,"allow","no_cycle_active",[],e.projectDir),{action:"allow"};const j=(0,g.getToolCallsSinceLastFileChange)(o),T=a.map(r=>H(r,j,k)),$=T.filter(r=>!r.result.satisfied);if($.length>0){if(T.every(C=>C.usedCount===0)){await d(o,i,t,"block","no_tools",a,e.projectDir);const C=` echo '${b(t)}' | ironbee hook submit-verdict`,O=` On fail: echo '${D(t)}' | ironbee hook submit-verdict`;return{action:"block",message:`VERIFICATION REQUIRED.
|
|
15
17
|
|
|
16
18
|
You made code changes but did not verify them.
|
|
17
19
|
|
|
18
|
-
${
|
|
20
|
+
${a.includes("browser")?`Browser cycle (UI verification):
|
|
19
21
|
1. Build and start the application if not already running
|
|
20
22
|
2. Navigate to the affected page(s)
|
|
21
23
|
3. Functionally test your changes \u2014 click, type, submit, interact with the UI to confirm the code works
|
|
@@ -23,53 +25,57 @@ ${n.includes("browser")?`Browser cycle (UI verification):
|
|
|
23
25
|
5. Take an accessibility snapshot to verify page structure
|
|
24
26
|
6. Check console for errors
|
|
25
27
|
7. Stop the dev server when done
|
|
26
|
-
`:""}${
|
|
28
|
+
`:""}${a.includes("node")?`Node cycle (Node.js runtime debug):
|
|
27
29
|
1. Connect to the running Node process via ndt_debug_connect
|
|
28
30
|
2. Set probes (tracepoint / logpoint / exceptionpoint) at the changed code paths
|
|
29
31
|
3. Exercise the code path so probes fire
|
|
30
32
|
4. Read snapshots via ndt_debug_get-probe-snapshots, OR inspect runtime errors via ndt_debug_get-logs
|
|
31
|
-
`:""}${
|
|
33
|
+
`:""}${a.includes("backend")?`Backend cycle (runtime-agnostic service verification \u2014 pick ONE or more evidence paths):
|
|
32
34
|
1. Identify the backend layer affected by your change (HTTP / gRPC / GraphQL / WebSocket endpoint, log output, or database state)
|
|
33
35
|
2a. Protocol-call path: make a real call against the running service (bedt_request_http / bedt_request_grpc / bedt_request_graphql / bedt_request_websocket-open / bedt_request_replay), inspect status / body / traceId, chain follow-ups to verify side effects
|
|
34
36
|
2b. Log-evidence path (for when something else drives the request): bedt_log_register-source (file / docker / kubernetes), then bedt_log_read / bedt_log_read-multi / bedt_log_follow
|
|
35
37
|
2c. DB-evidence path (for schema / migration / seed / query-regression changes): bedt_db_connect (named, readonly by default), then bedt_db_query / bedt_db_describe-table / bedt_db_list-tables / bedt_db_snapshot / bedt_db_diff / bedt_db_get-changes
|
|
36
38
|
3. (Optional) Pin a correlation trace id for the run via bedt_o11y_new-trace-id / bedt_o11y_set-trace-context \u2014 IronBee already injects an active verification traceId, so the o11y pin only matters when you want a fresh root for log searches.
|
|
39
|
+
`:""}${a.includes("android")?`Android cycle (mobile device / emulator verification \u2014 pick ONE evidence path):
|
|
40
|
+
1. Connect to a running device or emulator: adt_device_connect
|
|
41
|
+
2a. Device-evidence path: drive the app UI (adt_device_launch-app / adt_interaction_tap / adt_interaction_input-text / adt_interaction_swipe), then capture BOTH a screenshot (adt_content_take-screenshot) AND a UI snapshot (adt_a11y_take-ui-snapshot) to confirm the visual + structural result
|
|
42
|
+
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
|
|
37
43
|
`:""}
|
|
38
44
|
Then submit your verdict (single verdict covers every active cycle):
|
|
39
45
|
${C}
|
|
40
46
|
${O}
|
|
41
|
-
If failed, fix the code and re-verify until it passes.`}}return await
|
|
47
|
+
If failed, fix the code and re-verify until it passes.`}}return await d(o,i,t,"block","incomplete_tools",a,e.projectDir),{action:"block",message:`INCOMPLETE VERIFICATION.
|
|
42
48
|
|
|
43
49
|
You used the IronBee verification tools but skipped required checks:
|
|
44
50
|
|
|
45
|
-
${
|
|
51
|
+
${$.map(C=>Z(C)).join(`
|
|
46
52
|
`)}
|
|
47
53
|
|
|
48
54
|
Run the missing tools, functionally test your changes, then submit your verdict:
|
|
49
|
-
Pass: echo '${
|
|
50
|
-
Fail: echo '${
|
|
55
|
+
Pass: echo '${b(t)}' | ironbee hook submit-verdict
|
|
56
|
+
Fail: echo '${D(t)}' | ironbee hook submit-verdict`}}if(!(0,p.existsSync)(n))return await d(o,i,t,"block","no_verdict",a,e.projectDir),{action:"block",message:`VERDICT MISSING.
|
|
51
57
|
|
|
52
|
-
You ran the verification tools but did not submit a verdict.${(0,
|
|
58
|
+
You ran the verification tools but did not submit a verdict.${(0,s.isRecordingActive)(i)?`
|
|
53
59
|
\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").`:""}
|
|
54
60
|
|
|
55
61
|
Submit your verdict via:
|
|
56
|
-
echo '${
|
|
57
|
-
echo '${
|
|
62
|
+
echo '${b(t)}' | ironbee hook submit-verdict`};let v;try{v=JSON.parse((0,p.readFileSync)(n,"utf-8"))}catch(r){return f.logger.debug(`failed to parse verdict ${n}: ${r}`),_(n),await d(o,i,t,"block","invalid_verdict",a,e.projectDir),{action:"block",message:`INVALID VERDICT JSON. Re-submit valid JSON:
|
|
63
|
+
echo '${b(t)}' | ironbee hook submit-verdict`}}const R=a.map(r=>K(r,v)),A=R.filter(r=>!r.valid);if(A.length>0)return _(n),await d(o,i,t,"block","invalid_verdict",a,e.projectDir),{action:"block",message:`VERDICT REJECTED:
|
|
58
64
|
${A.map(I=>` - ${I.cycle} cycle: ${I.reason}`).join(`
|
|
59
65
|
`)}
|
|
60
66
|
|
|
61
67
|
Re-submit:
|
|
62
|
-
echo '${
|
|
63
|
-
echo '${
|
|
64
|
-
- `);return
|
|
68
|
+
echo '${b(t)}' | ironbee hook submit-verdict`};const m=v.status;if(m!=="pass"&&m!=="fail")return _(n),await d(o,i,t,"block","invalid_verdict",a,e.projectDir),{action:"block",message:`INVALID VERDICT STATUS: "${m}". Status must be "pass" or "fail".
|
|
69
|
+
echo '${b(t)}' | ironbee hook submit-verdict`};const E=R.filter(r=>r.passCriteriaMet===!1),S=m==="pass"&&E.length===0?"pass":"fail";if(m==="pass"&&S==="fail"&&f.logger.debug(`verify-gate: status=pass overridden to fail by cycle pass-criteria: ${E.map(r=>r.cycle).join(",")}`),S==="pass")return f.logger.debug("verdict passed, allowing completion"),(0,s.resetRetries)(i),await d(o,i,t,"allow","verdict_pass",a,e.projectDir),{action:"allow"};const x=(0,s.incrementRetries)(i),y=[];if(Array.isArray(v.issues))for(const r of v.issues)y.push(String(r));for(const r of E)y.push(`[${r.cycle}] ${r.passReason??"pass criteria not met"}`);y.length===0&&y.push("unknown");const V=y.join(`
|
|
70
|
+
- `);return x>=c?(_(n),(0,s.resetRetries)(i),await(0,s.closeOpenCycles)(i,o,"max_retries_exceeded"),await d(o,i,t,"allow","max_retries_exceeded",a,e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${c} TIMES. Allowing completion.
|
|
65
71
|
|
|
66
72
|
Unresolved issues:
|
|
67
|
-
- ${
|
|
73
|
+
- ${V}
|
|
68
74
|
|
|
69
|
-
Report these issues in your final response.`}):(
|
|
75
|
+
Report these issues in your final response.`}):(_(n),await d(o,i,t,"block","verdict_fail",a,e.projectDir),{action:"block",message:`VERIFICATION FAILED (attempt ${x}/${c}).
|
|
70
76
|
|
|
71
77
|
Issues found:
|
|
72
|
-
- ${
|
|
78
|
+
- ${V}
|
|
73
79
|
|
|
74
80
|
Fix the issues, rebuild if needed, re-test functionally, and re-verify.
|
|
75
|
-
Submit verdict: echo '<verdict-json>' | ironbee hook submit-verdict`})}
|
|
81
|
+
Submit verdict: echo '<verdict-json>' | ironbee hook submit-verdict`})}l(ee,"runVerifyGate");async function d(e,t,i,o,n,u,c){o==="allow"&&(0,s.clearVerifyIntent)(t);const k={...(0,g.baseFields)(e),type:"verification_requested",timestamp:Date.now(),activity_id:(0,s.getActiveActivityId)(t),action:o,reason:n,modes:u.length>0?u:void 0};await(0,g.appendAction)(e,k),await(0,F.trackVerificationRequested)(i,o,n,c)}l(d,"recordMarker");0&&(module.exports={runVerifyGate});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var a=(t,n)=>c(t,"name",{value:n,configurable:!0});var O=(t,n)=>{for(var e in n)c(t,e,{get:n[e],enumerable:!0})},U=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of M(n))!N.call(t,i)&&i!==e&&c(t,i,{get:()=>n[i],enumerable:!(r=j(n,i))||r.enumerable});return t};var A=t=>U(c({},"__esModule",{value:!0}),t);var L={};O(L,{buildToolCall:()=>D});module.exports=A(L);var p=require("../../../clients/claude/util"),R=require("../../ids");const g=new Set(["browser-devtools","node-devtools","backend-devtools"]);function D(t){const{sessionId:n,projectName:e,activityId:r,timestamp:i,toolUse:s,toolResult:l}=t,o=(0,p.classifyTool)(s.name,s.input),I=z(n,o,s),C=o.tool_type==="mcp"&&o.mcp_server!==null&&g.has(o.mcp_server)?B(s.input):(0,p.extractClaudeToolInput)(s.name,s.input),x=
|
|
1
|
+
"use strict";var c=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var a=(t,n)=>c(t,"name",{value:n,configurable:!0});var O=(t,n)=>{for(var e in n)c(t,e,{get:n[e],enumerable:!0})},U=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of M(n))!N.call(t,i)&&i!==e&&c(t,i,{get:()=>n[i],enumerable:!(r=j(n,i))||r.enumerable});return t};var A=t=>U(c({},"__esModule",{value:!0}),t);var L={};O(L,{buildToolCall:()=>D});module.exports=A(L);var p=require("../../../clients/claude/util"),R=require("../../ids");const g=new Set(["browser-devtools","node-devtools","backend-devtools","android-devtools"]);function D(t){const{sessionId:n,projectName:e,activityId:r,timestamp:i,toolUse:s,toolResult:l}=t,o=(0,p.classifyTool)(s.name,s.input),I=z(n,o,s),C=o.tool_type==="mcp"&&o.mcp_server!==null&&g.has(o.mcp_server)?B(s.input):(0,p.extractClaudeToolInput)(s.name,s.input),x=k(s.input),d=l!==null&&l.is_error?F(l.content):void 0,S=d!==void 0&&/\[Request interrupted by user(?:[^\]]*)?\]/.test(d),w=d!==void 0?S?`interrupted: ${d}`:d:void 0,h=l!==null&&!l.is_error?k(l.content):0,y=Date.parse(i),T=t.resultTimestamp!==void 0&&t.resultTimestamp!==null?Date.parse(t.resultTimestamp):NaN,E=Number.isFinite(T)?T:Number.isFinite(y)?y:Date.now(),u={id:I,type:"tool_call",timestamp:E,session_id:n,project_name:e,activity_id:r,tool_name:o.tool_name,tool_use_id:s.id,tool_input:C,tool_input_size:x,tool_response_size:h,duration:t.durationMs??null};if(o.tool_type!==null&&(u.tool_type=o.tool_type),o.mcp_server!==null&&(u.mcp_server=o.mcp_server),w!==void 0&&(u.error=w),o.tool_type==="mcp"&&o.mcp_server!==null&&g.has(o.mcp_server)){const f=s.input._metadata;if(f!==null&&typeof f=="object"){const v=f,m=v.verificationId;typeof m=="string"&&b.test(m)&&(u.verification_id=m);const _=v.traceId;typeof _=="string"&&_.length>0&&(u.trace_id=_)}}return u}a(D,"buildToolCall");const b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function z(t,n,e){if(n.tool_type==="mcp"&&n.mcp_server!==null&&g.has(n.mcp_server)){const r=e.input._metadata;if(r!==null&&typeof r=="object"){const i=r.toolCallId;if(typeof i=="string"&&b.test(i))return i}}return(0,R.deriveToolCallEventIdFromToolUseId)(t,e.id)}a(z,"resolveEventId");function B(t){if(!("_metadata"in t))return t;const{_metadata:n,...e}=t;return e}a(B,"stripMetadata");function k(t){if(t==null)return 0;try{const n=typeof t=="string"?t:JSON.stringify(t);return n===void 0?0:Buffer.byteLength(n,"utf-8")}catch{return 0}}a(k,"byteLengthOf");function F(t){if(typeof t=="string")return t;if(Array.isArray(t)){const n=[];for(const e of t)if(e!==null&&typeof e=="object"){const r=e.text;typeof r=="string"&&n.push(r)}return n.join(`
|
|
2
2
|
`)}try{return JSON.stringify(t)}catch{return String(t)}}a(F,"extractErrorMessage");0&&(module.exports={buildToolCall});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var c=(e,t)=>d(e,"name",{value:t,configurable:!0});var O=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},h=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of N(t))!S.call(e,o)&&o!==n&&d(e,o,{get:()=>t[o],enumerable:!(i=E(t,o))||i.enumerable});return e};var j=e=>h(d({},"__esModule",{value:!0}),e);var A={};O(A,{buildCodexToolCall:()=>D});module.exports=j(A);var p=require("../../../clients/codex/util"),w=require("../../ids");const v=new Set(["browser-devtools","node-devtools","backend-devtools","android-devtools"]);function D(e){const{sessionId:t,projectName:n,activityId:i,call:o,output:s}=e,r=(0,p.classifyCodexTool)(o.name),y=F(t,r,o),I=(0,p.extractCodexToolInput)(o.name,o.args),x=z(o.args),T=s!==null&&!s.isError?Buffer.byteLength(s.output,"utf-8"):0,C=s!==null&&s.isError?s.output.slice(0,500):void 0,a=Date.parse(o.timestamp),u=s!==null?Date.parse(s.timestamp):NaN,k=Number.isFinite(a)&&Number.isFinite(u)&&u>=a?u-a:null,R=Number.isFinite(u)?u:Number.isFinite(a)?a:Date.now(),l={id:y,type:"tool_call",timestamp:R,session_id:t,project_name:n,activity_id:i,tool_name:r.tool_name,tool_use_id:o.callId,tool_input:I,tool_input_size:x,tool_response_size:T,duration:k};if(r.tool_type!==null&&(l.tool_type=r.tool_type),r.mcp_server!==null&&(l.mcp_server=r.mcp_server),C!==void 0&&(l.error=C),r.tool_type==="mcp"&&r.mcp_server!==null&&v.has(r.mcp_server)){const m=o.args._metadata;if(m!==null&&typeof m=="object"){const _=m,f=_.verificationId;typeof f=="string"&&b.test(f)&&(l.verification_id=f);const g=_.traceId;typeof g=="string"&&g.length>0&&(l.trace_id=g)}}return l}c(D,"buildCodexToolCall");const b=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function F(e,t,n){if(t.tool_type==="mcp"&&t.mcp_server!==null&&v.has(t.mcp_server)){const i=n.args._metadata;if(i!==null&&typeof i=="object"){const o=i.toolCallId;if(typeof o=="string"&&b.test(o))return o}}return(0,w.deriveToolCallEventIdFromToolUseId)(e,n.callId)}c(F,"resolveEventId");function z(e){if(e==null)return 0;try{return Buffer.byteLength(JSON.stringify(e),"utf-8")}catch{return 0}}c(z,"byteLengthOf");0&&(module.exports={buildCodexToolCall});
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var M=Object.defineProperty;var
|
|
2
|
+
"use strict";var M=Object.defineProperty;var t=(r,n)=>M(r,"name",{value:n,configurable:!0});var i=require("commander"),c=require("fs"),l=require("path"),s=require("./commands/install"),g=require("./commands/uninstall"),p=require("./commands/update"),f=require("./commands/hook"),C=require("./commands/status"),u=require("./commands/verify"),b=require("./commands/queue"),v=require("./commands/process-job-file"),y=require("./clients/codex/cli"),h=require("./commands/browser"),$=require("./commands/node"),j=require("./commands/backend"),w=require("./commands/android"),I=require("./commands/verification"),k=require("./commands/telemetry"),B=require("./commands/privacy"),F=require("./commands/config"),T=require("./tui"),q=require("./commands/register"),A=require("./commands/unregister"),L=require("./commands/import"),R=require("./clients/claude/cli"),S=require("./commands/login"),U=require("./queue"),x=require("./lib/icon"),m=require("./lib/version"),e=require("./lib/output");const d=JSON.parse((0,c.readFileSync)((0,l.join)(__dirname,"../package.json"),"utf-8"));(0,U.registerQueueHandlers)();const o=new i.Command;o.name("ironbee").description(d.description).version(d.version),o.addCommand(S.loginCommand),o.addCommand(s.installCommand),o.addCommand(g.uninstallCommand),o.addCommand(p.updateCommand),o.addCommand(C.statusCommand),o.addCommand(u.verifyCommand),o.addCommand(b.queueCommand),o.addCommand(h.browserCommand),o.addCommand($.nodeCommand),o.addCommand(j.backendCommand),o.addCommand(w.androidCommand),o.addCommand(I.verificationCommand),o.addCommand(k.telemetryCommand),o.addCommand(B.privacyCommand),o.addCommand(R.claudeCommand),o.addCommand(y.codexCommand),o.addCommand(F.configCommand),o.addCommand(T.tuiCommand),o.addCommand(q.registerCommand),o.addCommand(A.unregisterCommand),o.addCommand(L.importCommand),o.addCommand(v.processJobFileCommand),o.addCommand(f.hookCommand);const N=process.argv[2]==="hook"||process.argv[2]==="process-job-file"||process.argv[2]==="claude"&&process.argv[3]==="process-analytics"||process.argv[2]==="codex"&&process.argv[3]==="process-analytics"||process.argv[2]==="claude"&&process.argv[3]==="otel"&&process.argv[4]==="run";if(process.argv.length===2){(0,x.printBanner)(),console.log(),console.log(` ${e.pc.bold("IronBee CLI")} ${e.pc.dim(`v${(0,m.getLocalVersion)()}`)}`),console.log(` ${e.pc.dim(d.description)}`),console.log(),console.log(` ${e.pc.bold(e.pc.cyan("Usage:"))} ${e.pc.green("ironbee")} ${e.pc.dim("<command> [options]")}`),console.log(),console.log(` ${e.pc.bold(e.pc.cyan("Commands:"))}`);const r=[{name:"install",args:"[project-dir]",desc:"Install hooks + guidance files into a project (--all: every registered project)"},{name:"uninstall",args:"[project-dir]",desc:"Remove IronBee from a project (--all: every registered project)"},{name:"update",args:"",desc:"Update IronBee CLI to the latest version"},{name:"tui",args:"[area]",desc:"Interactive full-screen UI (config \xB7 platforms \xB7 projects \xB7 sessions \xB7 queue \xB7 import)"},{name:"status",args:"[project-dir]",desc:"Show verification status for active sessions"},{name:"verify",args:"[session-id]",desc:"Dry-run verdict validation"},{name:"browser",args:"<enable|disable>",desc:"Toggle the browser verification cycle (default-on)"},{name:"node",args:"<enable|disable>",desc:"Toggle the Node.js runtime debug cycle (opt-in)"},{name:"backend",args:"<enable|disable>",desc:"Toggle the backend protocol cycle (opt-in)"},{name:"android",args:"<enable|disable>",desc:"Toggle the Android mobile verification cycle (opt-in)"},{name:"verification",args:"<enable|disable>",desc:"Master toggle (enable = enforce; disable = monitoring-only)"},{name:"telemetry",args:"<enable|disable>",desc:"Anonymous PostHog telemetry toggle"},{name:"privacy",args:"<enable|disable>",desc:"Privacy mode \u2014 redact devtools tool detail / screenshots / recordings from collector"},{name:"claude statusline",args:"<enable|disable>",desc:"Claude statusline integration (Claude-only)"},{name:"claude otel",args:"<run|status|stop|retry>",desc:"Claude OTEL collector daemon (Claude-only)"},{name:"config",args:"<get|set|unset|list>",desc:"Read or write project / global / local config"},{name:"register",args:"[-p <dir>]",desc:"Add a project to the user-home inventory (no artifact writes)"},{name:"unregister",args:"[-p <dir>]",desc:"Remove a project from the inventory (no artifact writes)"},{name:"queue",args:"<status|drain|\u2026>",desc:"Inspect / drain the background job queue"},{name:"import",args:"",desc:"Import historical Claude sessions to the collector"}],n=t(a=>a.args.length>0?`${a.name} ${a.args}`:a.name,"term"),P=Math.max(...r.map(a=>n(a).length));for(const a of r){const H=a.args.length>0?`${e.pc.green(a.name)} ${e.pc.dim(a.args)}`:e.pc.green(a.name),J=" ".repeat(P-n(a).length);console.log(` ${H}${J} ${a.desc}`)}console.log(),console.log(` ${e.pc.dim("Run")} ${e.pc.cyan("ironbee <command> --help")} ${e.pc.dim("for more info on a command.")}`),console.log()}else N?o.parse(process.argv):(async()=>{await o.parseAsync(process.argv),(0,m.checkForUpdates)().catch(()=>{});const r=process.argv[2];r==="install"||r==="uninstall"||r==="update"||await(0,s.syncSchemaIfChanged)()})();
|
package/dist/lib/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var E=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var se=Object.prototype.hasOwnProperty;var r=(n,e)=>E(n,"name",{value:e,configurable:!0});var ae=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},ce=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ie(e))!se.call(n,i)&&i!==t&&E(n,i,{get:()=>e[i],enumerable:!(o=oe(e,i))||o.enumerable});return n};var ue=n=>ce(E({},"__esModule",{value:!0}),n);var mn={};ae(mn,{ALL_CYCLES:()=>le,CONFIG_TARGETS_BY_PRECEDENCE:()=>ve,CYCLES_ENABLED_BY_DEFAULT:()=>N,CYCLE_DEFAULT_VERIFY_PATTERNS:()=>F,CYCLE_TO_SERVER:()=>fe,DEFAULT_BACKEND_ALWAYS_REQUIRED:()=>$,DEFAULT_BACKEND_EVIDENCE_PATHS:()=>Y,DEFAULT_BACKEND_VERIFY_PATTERNS:()=>M,DEFAULT_BROWSER_ALWAYS_REQUIRED:()=>V,DEFAULT_BROWSER_VERIFY_PATTERNS:()=>P,DEFAULT_NODE_ALWAYS_REQUIRED:()=>U,DEFAULT_NODE_EVIDENCE_PATHS:()=>q,DEFAULT_NODE_VERIFY_PATTERNS:()=>D,DEFAULT_OAUTH_USAGE_TTL_SECONDS:()=>H,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS:()=>J,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS:()=>z,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS:()=>Q,DEFAULT_OTEL_PORT:()=>W,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH:()=>ne,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES:()=>ee,ENV_OVERRIDES:()=>T,OPTIONAL_CYCLES:()=>I,applyEnvOverrides:()=>K,findActiveEnvOverride:()=>Te,getActiveCycles:()=>X,getAnalyticsEmitOnStopMinIntervalSeconds:()=>pn,getAutoVerifyEnabled:()=>Z,getBackendDevToolsMcpEntry:()=>$e,getCaptureFileChangeset:()=>fn,getClaudeOauthAccessEnabled:()=>Qe,getClaudeOauthAccessUsageTtlSeconds:()=>ze,getConfigLayerPaths:()=>x,getMaxChangesetBytes:()=>gn,getMaxRetries:()=>Ye,getMcpServerEntry:()=>Ue,getNodeDevToolsMcpEntry:()=>qe,getOTELEmitMinIntervalSeconds:()=>tn,getOTELEnsureMinIntervalSeconds:()=>nn,getOTELIdleTimeoutSeconds:()=>en,getOTELPort:()=>Ze,getPrivacyEnabled:()=>re,getRequiredToolsConfig:()=>Oe,getStatusLineEmitMinIntervalSeconds:()=>We,getStatusLineRefreshInterval:()=>rn,getStatusLineRenderDefault:()=>He,getTargetConfigPath:()=>Ae,getTelemetryEnabled:()=>te,getVerificationContextCommitDepth:()=>an,getVerificationContextEnabled:()=>on,getVerificationContextMaxBytes:()=>cn,getVerificationContextSource:()=>sn,getVerificationEnabled:()=>w,getVerificationMode:()=>ln,getVerificationModel:()=>pe,isAnalyticsApiRequestEventsEnabled:()=>Cn,isAnalyticsEmitOnStopEnabled:()=>bn,isAnalyticsEnabled:()=>dn,isAnalyticsStepEventsEnabled:()=>yn,isAnalyticsTurnEventsEnabled:()=>En,isCollectorConfigured:()=>j,isCycleEnabled:()=>Re,isCyclePatternsActive:()=>G,isIgnoredVerifyPath:()=>un,isJobQueueEnabled:()=>Ke,isOTELEnabled:()=>Je,isRecordingEnabled:()=>Xe,isSessionStatusEnabled:()=>Ge,loadConfig:()=>a,requiresVerification:()=>Be,resolveConfigTargetFromFlags:()=>Ie});module.exports=ue(mn);var b=require("fs"),C=require("path"),S=require("os"),L=require("./logger");const I=["node","backend"],le=["browser",...I],N=new Set(["browser"]),fe={browser:"browser-devtools",node:"node-devtools",backend:"backend-devtools"},P=["*.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"],D=["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}"],M=["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}"],F={browser:P,node:D,backend:M},V=["bdt_navigation_go-to","bdt_content_take-screenshot","bdt_a11y_take-aria-snapshot","bdt_o11y_get-console-messages"],U=["ndt_debug_connect"],q=[{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"]}],$=[],Y=[{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"]}]}],ge=3;function de(n){if(!(0,b.existsSync)(n))return{};try{return JSON.parse((0,b.readFileSync)(n,"utf-8"))}catch(e){return L.logger.debug(`failed to parse config ${n}: ${e}`),{}}}r(de,"loadJsonFile");function be(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 o=t;if(Object.prototype.hasOwnProperty.call(o,"enable")&&typeof o.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.enable' must be boolean. Got ${typeof o.enable}.`);if(Object.prototype.hasOwnProperty.call(o,"auto")&&typeof o.auto!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.auto' must be boolean. Got ${typeof o.auto}.`);if(Object.prototype.hasOwnProperty.call(o,"model")){const i=o.model,s=typeof i=="string",u=i!==null&&typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(c=>typeof c=="string");if(!s&&!u)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}.`)}}r(be,"assertVerificationShape");function pe(n,e){const t=n.verification?.model;if(typeof t=="string")return t.length>0?t:void 0;if(t&&typeof t=="object"){const o=t[e];return typeof o=="string"&&o.length>0?o:void 0}}r(pe,"getVerificationModel");function Ee(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 o=t;if(Object.prototype.hasOwnProperty.call(o,"enable")&&typeof o.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'telemetry.enable' must be boolean. Got ${typeof o.enable}.`)}r(Ee,"assertTelemetryShape");function ye(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 o=t;if(Object.prototype.hasOwnProperty.call(o,"enable")&&typeof o.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'privacy.enable' must be boolean. Got ${typeof o.enable}.`)}r(ye,"assertPrivacyShape");function m(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}r(m,"mergeCycleConfig");function R(n,e){const t={...n,...e};return t.browser=m(n.browser,e.browser),t.node=m(n.node,e.node),t.backend=m(n.backend,e.backend),t.claude=_e(n.claude,e.claude),t.verification=me(n.verification,e.verification),t.verificationContext=Ce(n.verificationContext,e.verificationContext),t}r(R,"mergeConfigLayers");function Ce(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}r(Ce,"mergeVerificationContextConfig");function me(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}r(me,"mergeVerificationConfig");function _e(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??{}}),t}r(_e,"mergeClaudeConfig");function x(n){return{global:(0,C.join)((0,S.homedir)(),".ironbee","config.json"),project:n?(0,C.join)(n,".ironbee","config.json"):void 0,local:n?(0,C.join)(n,".ironbee","config.local.json"):void 0}}r(x,"getConfigLayerPaths");const ve=["global","project","local"];function Ae(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}r(Ae,"getTargetConfigPath");function Ie(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"}r(Ie,"resolveConfigTargetFromFlags");function _(n){const e=de(n);return(0,b.existsSync)(n)&&(be(e,n),Ee(e,n),ye(e,n)),e}r(_,"loadAndValidateLayer");const T=[{envVar:"IRONBEE_API_KEY",configPath:"collector.apiKey"}];function xe(n,e,t){const o=e.split(".");let i=n;for(let s=0;s<o.length-1;s++){const u=o[s],c=i[u];c!=null&&typeof c=="object"&&!Array.isArray(c)?i[u]={...c}:i[u]={},i=i[u]}i[o[o.length-1]]=t}r(xe,"setAtConfigPath");function K(n){let e;for(const t of T){const o=process.env[t.envVar];if(o===void 0||o.length===0)continue;e===void 0&&(e={...n});const i=t.coerce?t.coerce(o):o;xe(e,t.configPath,i)}return e??n}r(K,"applyEnvOverrides");function Te(n){for(const e of T){if(e.configPath!==n)continue;const t=process.env[e.envVar];if(t!==void 0&&t.length>0)return e}}r(Te,"findActiveEnvOverride");function a(n){const e=x(n),t=_(e.global),o=e.project?_(e.project):{},i=e.local?_(e.local):{},s=R(R(t,o),i);return K(s)}r(a,"loadConfig");function je(n){let e=n.replace(/\{([^}]+)\}/g,(t,o)=>`(${o.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}$`)}r(je,"globToRegExp");function y(n,e){const t=n.replace(/\\/g,"/");for(const o of e)if(je(o).test(t))return!0;return!1}r(y,"matchesAny");function we(n,e){if(e==="browser")return n.browser;if(e==="node")return n.node;if(e==="backend")return n.backend}r(we,"getCycleBlock");function v(n,e){const t=we(n,e);if(t!==void 0&&t.enable===!1)return[];const o=F[e]??[];if(t===void 0)return N.has(e)?[...o]:[];if(Array.isArray(t.verifyPatterns)&&t.verifyPatterns.length===0)return[];const i=t.verifyPatterns??o,s=t.additionalVerifyPatterns??[];return[...i,...s]}r(v,"getCyclePatterns");function X(n,e){const t=e.ignoredVerifyPatterns??[];if(t.length>0&&y(n,t))return[];const o=[];y(n,v(e,"browser"))&&o.push("browser");for(const i of I){const s=v(e,i);s.length>0&&y(n,s)&&o.push(i)}return o}r(X,"getActiveCycles");function Be(n,e){return X(n,e).length>0}r(Be,"requiresVerification");function Re(n,e){return w(n)?G(n,e):!1}r(Re,"isCycleEnabled");function G(n,e){return v(n,e).length>0}r(G,"isCyclePatternsActive");function Oe(n,e){let t,o;if(e==="browser"?(t=n.browser?.alwaysRequired??V,o=n.browser?.evidencePaths??[]):e==="node"?(t=n.node?.alwaysRequired??U,o=n.node?.evidencePaths??q):e==="backend"?(t=n.backend?.alwaysRequired??$,o=n.backend?.evidencePaths??Y):(t=[],o=[]),t.length===0&&o.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:o}}r(Oe,"getRequiredToolsConfig");const O="npx",he="^0.10.7",h=["-y",`@ironbee-ai/devtools@${he}`],ke={TOOL_NAME_PREFIX:"bdt_",TOOL_INPUT_METADATA_ENABLE:"true"},Se={PLATFORM:"node",TOOL_NAME_PREFIX:"ndt_",TOOL_INPUT_METADATA_ENABLE:"true"},Le={PLATFORM:"backend",TOOL_NAME_PREFIX:"bedt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ne={BROWSER_DEVTOOLS_INSTALL_CHROMIUM:"true"},Pe={},De={};function Me(n){return te(n)?{}:{TELEMETRY_ENABLE:"false"}}r(Me,"buildTelemetryEnv");function Fe(n){return re(n)?{COLLECTOR_EVENTS_TOOL_DETAILS_ENABLE:"false",COLLECTOR_ARTIFACTS_ENABLE:"false"}:{}}r(Fe,"buildPrivacyEnv");function Ve(n,e){if(!j(n))return{};const o={OTEL_ENABLE:"true",OTEL_EXPORTER_HTTP_URL:n.collector.url,OTEL_EXPORTER_HTTP_HEADERS:"X-API-Key=${file:~/.ironbee/config.json#collector.apiKey}",OTEL_EXPORTER_TYPE:"otlp/http-protobuf"};return e==="browser"&&(o.OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS="change,input,click",o.BROWSER_HEADLESS_ENABLE="true"),o}r(Ve,"buildOTELEnv");function A(n,e,t,o,i){const s=Ve(n,i),u=Me(n),c=Fe(n),p=n[e];if(p&&typeof p=="object"&&!Array.isArray(p)){const l=p;if(l.mcp&&typeof l.mcp=="object"&&!Array.isArray(l.mcp)){const f={...l.mcp},g={...s,...u,...c,...f.env??{},...t};return f.env=g,f}const B={};if(l.env&&typeof l.env=="object"&&!Array.isArray(l.env)){const f=l.env;for(const g of Object.keys(f))typeof f[g]=="string"&&(B[g]=f[g])}return{command:O,args:[...h],env:{...o,...s,...u,...c,...B,...t}}}return{command:O,args:[...h],env:{...o,...s,...u,...c,...t}}}r(A,"buildMcpEntry");function Ue(n){const e=a(n);return A(e,"browserDevTools",ke,Ne,"browser")}r(Ue,"getMcpServerEntry");function qe(n){const e=a(n);return A(e,"nodeDevTools",Se,Pe,"node")}r(qe,"getNodeDevToolsMcpEntry");function $e(n){const e=a(n);return A(e,"backendDevTools",Le,De,"backend")}r($e,"getBackendDevToolsMcpEntry");function Ye(n){return typeof n.maxRetries=="number"&&n.maxRetries>0?n.maxRetries:ge}r(Ye,"getMaxRetries");function j(n){if(process.env.IRONBEE_COLLECTOR==="false")return!1;const e=n.collector;return!(!e||e.enable===!1||typeof e.url!="string"||e.url.length===0||typeof e.apiKey!="string"||e.apiKey.length===0)}r(j,"isCollectorConfigured");function Ke(n){const e=a(n);return d(e,e.jobQueue)}r(Ke,"isJobQueueEnabled");function Xe(n){const e=a(n);return d(e,e.recording)}r(Xe,"isRecordingEnabled");function Ge(n){return d(n,n.statusLine)}r(Ge,"isSessionStatusEnabled");function He(n){const e=n.statusLine;return e!==void 0&&e.renderDefault===!0}r(He,"getStatusLineRenderDefault");function We(n){const e=n.statusLine?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:10}r(We,"getStatusLineEmitMinIntervalSeconds");const H=60;function Qe(n){return n.claude?.oauthAccess?.enable!==!1}r(Qe,"getClaudeOauthAccessEnabled");function ze(n){const e=n.claude?.oauthAccess?.usageTtlSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:H}r(ze,"getClaudeOauthAccessUsageTtlSeconds");const W=15986,Q=600,z=30,J=0;function Je(n){return d(n,n.otel)}r(Je,"isOTELEnabled");function Ze(n){const e=n.otel?.port;return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<65536?e:W}r(Ze,"getOTELPort");function en(n){const e=n.otel?.idleTimeoutSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:Q}r(en,"getOTELIdleTimeoutSeconds");function nn(n){const e=n.otel?.ensureMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:z}r(nn,"getOTELEnsureMinIntervalSeconds");function tn(n){const e=n.otel?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:J}r(tn,"getOTELEmitMinIntervalSeconds");function rn(n){const e=n.statusLine?.refreshInterval;if(typeof e=="number"&&Number.isFinite(e)&&e>=1)return e}r(rn,"getStatusLineRefreshInterval");function d(n,e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e.enable!==!1:j(n)}r(d,"isFeatureEnabledWithCollectorAutoEnable");function vn(n){return n==null||typeof n!="object"||Array.isArray(n)?!1:n.enable!==!1}r(vn,"isPresenceEnabled");function w(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}r(w,"getVerificationEnabled");function Z(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.auto!==!1}r(Z,"getAutoVerifyEnabled");const ee=65536,ne=1;function on(n){const e=n.verificationContext;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}r(on,"getVerificationContextEnabled");function sn(n){return n.verificationContext?.source==="actions"?"actions":"git"}r(sn,"getVerificationContextSource");function an(n){const e=n.verificationContext?.commitDepth;return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):ne}r(an,"getVerificationContextCommitDepth");function cn(n){const e=n.verificationContext?.maxBytes;return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):ee}r(cn,"getVerificationContextMaxBytes");function un(n,e){const t=n.ignoredVerifyPatterns??[];return t.length>0&&y(e,t)}r(un,"isIgnoredVerifyPath");function ln(n){return w(n)?Z(n)?"enforce":"assist":"monitor"}r(ln,"getVerificationMode");function te(n){const e=n.telemetry;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}r(te,"getTelemetryEnabled");function re(n){const e=n.privacy;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.enable===!0}r(re,"getPrivacyEnabled");const k=65536;function fn(n){const e=n.fileChange;return!e||typeof e!="object"||Array.isArray(e)?!1:e.captureChangeset===!0}r(fn,"getCaptureFileChangeset");function gn(n){const e=n.fileChange;if(!e||typeof e!="object"||Array.isArray(e))return k;const t=e.maxChangesetBytes;return typeof t!="number"||!Number.isFinite(t)||t<=0?k:Math.floor(t)}r(gn,"getMaxChangesetBytes");function dn(n){const e=a(n);return d(e,e.analytics)}r(dn,"isAnalyticsEnabled");function bn(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitOnStop!==!1}r(bn,"isAnalyticsEmitOnStopEnabled");function pn(n){const t=a(n).analytics;if(t===null||typeof t!="object"||Array.isArray(t))return 0;const o=t.emitOnStopMinIntervalSeconds;return typeof o=="number"&&o>=0?o:0}r(pn,"getAnalyticsEmitOnStopMinIntervalSeconds");function En(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitTurnEvents===!0}r(En,"isAnalyticsTurnEventsEnabled");function yn(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitStepEvents===!0}r(yn,"isAnalyticsStepEventsEnabled");function Cn(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitApiRequestEvents!==!1}r(Cn,"isAnalyticsApiRequestEventsEnabled");0&&(module.exports={ALL_CYCLES,CONFIG_TARGETS_BY_PRECEDENCE,CYCLES_ENABLED_BY_DEFAULT,CYCLE_DEFAULT_VERIFY_PATTERNS,CYCLE_TO_SERVER,DEFAULT_BACKEND_ALWAYS_REQUIRED,DEFAULT_BACKEND_EVIDENCE_PATHS,DEFAULT_BACKEND_VERIFY_PATTERNS,DEFAULT_BROWSER_ALWAYS_REQUIRED,DEFAULT_BROWSER_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,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,isAnalyticsApiRequestEventsEnabled,isAnalyticsEmitOnStopEnabled,isAnalyticsEnabled,isAnalyticsStepEventsEnabled,isAnalyticsTurnEventsEnabled,isCollectorConfigured,isCycleEnabled,isCyclePatternsActive,isIgnoredVerifyPath,isJobQueueEnabled,isOTELEnabled,isRecordingEnabled,isSessionStatusEnabled,loadConfig,requiresVerification,resolveConfigTargetFromFlags});
|
|
1
|
+
"use strict";var E=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var ce=Object.getOwnPropertyNames;var le=Object.prototype.hasOwnProperty;var r=(n,e)=>E(n,"name",{value:e,configurable:!0});var ue=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},fe=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ce(e))!le.call(n,i)&&i!==t&&E(n,i,{get:()=>e[i],enumerable:!(o=ae(e,i))||o.enumerable});return n};var ge=n=>fe(E({},"__esModule",{value:!0}),n);var jn={};ue(jn,{ALL_CYCLES:()=>de,CONFIG_TARGETS_BY_PRECEDENCE:()=>xe,CYCLES_ENABLED_BY_DEFAULT:()=>D,CYCLE_DEFAULT_VERIFY_PATTERNS:()=>V,CYCLE_TOOL_PREFIXES:()=>be,CYCLE_TO_SERVER:()=>pe,DEFAULT_ANDROID_ALWAYS_REQUIRED:()=>X,DEFAULT_ANDROID_EVIDENCE_PATHS:()=>G,DEFAULT_ANDROID_VERIFY_PATTERNS:()=>F,DEFAULT_BACKEND_ALWAYS_REQUIRED:()=>Y,DEFAULT_BACKEND_EVIDENCE_PATHS:()=>K,DEFAULT_BACKEND_VERIFY_PATTERNS:()=>M,DEFAULT_BROWSER_ALWAYS_REQUIRED:()=>U,DEFAULT_BROWSER_VERIFY_PATTERNS:()=>N,DEFAULT_NODE_ALWAYS_REQUIRED:()=>q,DEFAULT_NODE_EVIDENCE_PATHS:()=>$,DEFAULT_NODE_VERIFY_PATTERNS:()=>P,DEFAULT_OAUTH_USAGE_TTL_SECONDS:()=>z,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS:()=>ne,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS:()=>ee,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS:()=>Z,DEFAULT_OTEL_PORT:()=>J,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH:()=>oe,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES:()=>re,ENV_OVERRIDES:()=>x,OPTIONAL_CYCLES:()=>I,applyEnvOverrides:()=>H,findActiveEnvOverride:()=>Oe,getActiveCycles:()=>W,getAnalyticsEmitOnStopMinIntervalSeconds:()=>An,getAndroidDevToolsMcpEntry:()=>Qe,getAutoVerifyEnabled:()=>te,getBackendDevToolsMcpEntry:()=>We,getCaptureFileChangeset:()=>_n,getClaudeOauthAccessEnabled:()=>rn,getClaudeOauthAccessUsageTtlSeconds:()=>on,getConfigLayerPaths:()=>T,getMaxChangesetBytes:()=>Cn,getMaxRetries:()=>ze,getMcpServerEntry:()=>Ge,getNodeDevToolsMcpEntry:()=>He,getOTELEmitMinIntervalSeconds:()=>un,getOTELEnsureMinIntervalSeconds:()=>ln,getOTELIdleTimeoutSeconds:()=>cn,getOTELPort:()=>an,getPrivacyEnabled:()=>se,getRequiredToolsConfig:()=>Se,getStatusLineEmitMinIntervalSeconds:()=>tn,getStatusLineRefreshInterval:()=>fn,getStatusLineRenderDefault:()=>nn,getTargetConfigPath:()=>je,getTelemetryEnabled:()=>ie,getVerificationContextCommitDepth:()=>pn,getVerificationContextEnabled:()=>gn,getVerificationContextMaxBytes:()=>bn,getVerificationContextSource:()=>dn,getVerificationEnabled:()=>w,getVerificationMode:()=>yn,getVerificationModel:()=>Ce,isAnalyticsApiRequestEventsEnabled:()=>xn,isAnalyticsEmitOnStopEnabled:()=>vn,isAnalyticsEnabled:()=>mn,isAnalyticsStepEventsEnabled:()=>Tn,isAnalyticsTurnEventsEnabled:()=>In,isCollectorConfigured:()=>j,isCycleEnabled:()=>Le,isCyclePatternsActive:()=>Q,isIgnoredVerifyPath:()=>En,isJobQueueEnabled:()=>Je,isOTELEnabled:()=>sn,isRecordingEnabled:()=>Ze,isSessionStatusEnabled:()=>en,loadConfig:()=>a,requiresVerification:()=>ke,resolveConfigTargetFromFlags:()=>we});module.exports=ge(jn);var p=require("fs"),m=require("path"),L=require("os"),S=require("./logger");const I=["node","backend","android"],de=["browser",...I],D=new Set(["browser"]),pe={browser:"browser-devtools",node:"node-devtools",backend:"backend-devtools",android:"android-devtools"},be={browser:"bdt_",node:"ndt_",backend:"bedt_",android:"adt_"},N=["*.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"],P=["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}"],M=["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}"],F=["android/**/*.{kt,java}","app/src/**/*.{kt,java}","mobile/**/*.{kt,java}","src/main/kotlin/**/*.kt","src/main/java/**/*.java","**/*.{kt,java}","**/res/**/*.xml","**/AndroidManifest.xml"],V={browser:N,node:P,backend:M,android:F},U=["bdt_navigation_go-to","bdt_content_take-screenshot","bdt_a11y_take-aria-snapshot","bdt_o11y_get-console-messages"],q=["ndt_debug_connect"],$=[{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"]}],Y=[],K=[{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"]}]}],X=["adt_device_connect"],G=[{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"]}]}],Ee=3;function ye(n){if(!(0,p.existsSync)(n))return{};try{return JSON.parse((0,p.readFileSync)(n,"utf-8"))}catch(e){return S.logger.debug(`failed to parse config ${n}: ${e}`),{}}}r(ye,"loadJsonFile");function _e(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 o=t;if(Object.prototype.hasOwnProperty.call(o,"enable")&&typeof o.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.enable' must be boolean. Got ${typeof o.enable}.`);if(Object.prototype.hasOwnProperty.call(o,"auto")&&typeof o.auto!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.auto' must be boolean. Got ${typeof o.auto}.`);if(Object.prototype.hasOwnProperty.call(o,"model")){const i=o.model,s=typeof i=="string",l=i!==null&&typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(c=>typeof c=="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}.`)}}r(_e,"assertVerificationShape");function Ce(n,e){const t=n.verification?.model;if(typeof t=="string")return t.length>0?t:void 0;if(t&&typeof t=="object"){const o=t[e];return typeof o=="string"&&o.length>0?o:void 0}}r(Ce,"getVerificationModel");function me(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 o=t;if(Object.prototype.hasOwnProperty.call(o,"enable")&&typeof o.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'telemetry.enable' must be boolean. Got ${typeof o.enable}.`)}r(me,"assertTelemetryShape");function ve(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 o=t;if(Object.prototype.hasOwnProperty.call(o,"enable")&&typeof o.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'privacy.enable' must be boolean. Got ${typeof o.enable}.`)}r(ve,"assertPrivacyShape");function y(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}r(y,"mergeCycleConfig");function O(n,e){const t={...n,...e};return t.browser=y(n.browser,e.browser),t.node=y(n.node,e.node),t.backend=y(n.backend,e.backend),t.android=y(n.android,e.android),t.claude=Te(n.claude,e.claude),t.verification=Ie(n.verification,e.verification),t.verificationContext=Ae(n.verificationContext,e.verificationContext),t}r(O,"mergeConfigLayers");function Ae(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}r(Ae,"mergeVerificationContextConfig");function Ie(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}r(Ie,"mergeVerificationConfig");function Te(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??{}}),t}r(Te,"mergeClaudeConfig");function T(n){return{global:(0,m.join)((0,L.homedir)(),".ironbee","config.json"),project:n?(0,m.join)(n,".ironbee","config.json"):void 0,local:n?(0,m.join)(n,".ironbee","config.local.json"):void 0}}r(T,"getConfigLayerPaths");const xe=["global","project","local"];function je(n,e){const t=T(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}r(je,"getTargetConfigPath");function we(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"}r(we,"resolveConfigTargetFromFlags");function v(n){const e=ye(n);return(0,p.existsSync)(n)&&(_e(e,n),me(e,n),ve(e,n)),e}r(v,"loadAndValidateLayer");const x=[{envVar:"IRONBEE_API_KEY",configPath:"collector.apiKey"}];function Re(n,e,t){const o=e.split(".");let i=n;for(let s=0;s<o.length-1;s++){const l=o[s],c=i[l];c!=null&&typeof c=="object"&&!Array.isArray(c)?i[l]={...c}:i[l]={},i=i[l]}i[o[o.length-1]]=t}r(Re,"setAtConfigPath");function H(n){let e;for(const t of x){const o=process.env[t.envVar];if(o===void 0||o.length===0)continue;e===void 0&&(e={...n});const i=t.coerce?t.coerce(o):o;Re(e,t.configPath,i)}return e??n}r(H,"applyEnvOverrides");function Oe(n){for(const e of x){if(e.configPath!==n)continue;const t=process.env[e.envVar];if(t!==void 0&&t.length>0)return e}}r(Oe,"findActiveEnvOverride");function a(n){const e=T(n),t=v(e.global),o=e.project?v(e.project):{},i=e.local?v(e.local):{},s=O(O(t,o),i);return H(s)}r(a,"loadConfig");function Be(n){let e=n.replace(/\{([^}]+)\}/g,(t,o)=>`(${o.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}$`)}r(Be,"globToRegExp");function _(n,e){const t=n.replace(/\\/g,"/");for(const o of e)if(Be(o).test(t))return!0;return!1}r(_,"matchesAny");function he(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}r(he,"getCycleBlock");function A(n,e){const t=he(n,e);if(t!==void 0&&t.enable===!1)return[];const o=V[e]??[];if(t===void 0)return D.has(e)?[...o]:[];if(Array.isArray(t.verifyPatterns)&&t.verifyPatterns.length===0)return[];const i=t.verifyPatterns??o,s=t.additionalVerifyPatterns??[];return[...i,...s]}r(A,"getCyclePatterns");function W(n,e){const t=e.ignoredVerifyPatterns??[];if(t.length>0&&_(n,t))return[];const o=[];_(n,A(e,"browser"))&&o.push("browser");for(const i of I){const s=A(e,i);s.length>0&&_(n,s)&&o.push(i)}return o}r(W,"getActiveCycles");function ke(n,e){return W(n,e).length>0}r(ke,"requiresVerification");function Le(n,e){return w(n)?Q(n,e):!1}r(Le,"isCycleEnabled");function Q(n,e){return A(n,e).length>0}r(Q,"isCyclePatternsActive");function Se(n,e){let t,o;if(e==="browser"?(t=n.browser?.alwaysRequired??U,o=n.browser?.evidencePaths??[]):e==="node"?(t=n.node?.alwaysRequired??q,o=n.node?.evidencePaths??$):e==="backend"?(t=n.backend?.alwaysRequired??Y,o=n.backend?.evidencePaths??K):e==="android"?(t=n.android?.alwaysRequired??X,o=n.android?.evidencePaths??G):(t=[],o=[]),t.length===0&&o.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:o}}r(Se,"getRequiredToolsConfig");const B="npx",De="^0.11.0",h=["-y",`@ironbee-ai/devtools@${De}`],Ne={TOOL_NAME_PREFIX:"bdt_",TOOL_INPUT_METADATA_ENABLE:"true"},Pe={PLATFORM:"node",TOOL_NAME_PREFIX:"ndt_",TOOL_INPUT_METADATA_ENABLE:"true"},Me={PLATFORM:"backend",TOOL_NAME_PREFIX:"bedt_",TOOL_INPUT_METADATA_ENABLE:"true"},Fe={PLATFORM:"android",TOOL_NAME_PREFIX:"adt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ve={BROWSER_DEVTOOLS_INSTALL_CHROMIUM:"true"},Ue={},qe={},$e={};function Ye(n){return ie(n)?{}:{TELEMETRY_ENABLE:"false"}}r(Ye,"buildTelemetryEnv");function Ke(n){return se(n)?{COLLECTOR_EVENTS_TOOL_DETAILS_ENABLE:"false",COLLECTOR_ARTIFACTS_ENABLE:"false"}:{}}r(Ke,"buildPrivacyEnv");function Xe(n,e){if(!j(n))return{};const o={OTEL_ENABLE:"true",OTEL_EXPORTER_HTTP_URL:n.collector.url,OTEL_EXPORTER_HTTP_HEADERS:"X-API-Key=${file:~/.ironbee/config.json#collector.apiKey}",OTEL_EXPORTER_TYPE:"otlp/http-protobuf"};return e==="browser"&&(o.OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS="change,input,click",o.BROWSER_HEADLESS_ENABLE="true"),o}r(Xe,"buildOTELEnv");function C(n,e,t,o,i){const s=Xe(n,i),l=Ye(n),c=Ke(n),b=n[e];if(b&&typeof b=="object"&&!Array.isArray(b)){const u=b;if(u.mcp&&typeof u.mcp=="object"&&!Array.isArray(u.mcp)){const f={...u.mcp},g={...s,...l,...c,...f.env??{},...t};return f.env=g,f}const R={};if(u.env&&typeof u.env=="object"&&!Array.isArray(u.env)){const f=u.env;for(const g of Object.keys(f))typeof f[g]=="string"&&(R[g]=f[g])}return{command:B,args:[...h],env:{...o,...s,...l,...c,...R,...t}}}return{command:B,args:[...h],env:{...o,...s,...l,...c,...t}}}r(C,"buildMcpEntry");function Ge(n){const e=a(n);return C(e,"browserDevTools",Ne,Ve,"browser")}r(Ge,"getMcpServerEntry");function He(n){const e=a(n);return C(e,"nodeDevTools",Pe,Ue,"node")}r(He,"getNodeDevToolsMcpEntry");function We(n){const e=a(n);return C(e,"backendDevTools",Me,qe,"backend")}r(We,"getBackendDevToolsMcpEntry");function Qe(n){const e=a(n);return C(e,"androidDevTools",Fe,$e,"android")}r(Qe,"getAndroidDevToolsMcpEntry");function ze(n){return typeof n.maxRetries=="number"&&n.maxRetries>0?n.maxRetries:Ee}r(ze,"getMaxRetries");function j(n){if(process.env.IRONBEE_COLLECTOR==="false")return!1;const e=n.collector;return!(!e||e.enable===!1||typeof e.url!="string"||e.url.length===0||typeof e.apiKey!="string"||e.apiKey.length===0)}r(j,"isCollectorConfigured");function Je(n){const e=a(n);return d(e,e.jobQueue)}r(Je,"isJobQueueEnabled");function Ze(n){const e=a(n);return d(e,e.recording)}r(Ze,"isRecordingEnabled");function en(n){return d(n,n.statusLine)}r(en,"isSessionStatusEnabled");function nn(n){const e=n.statusLine;return e!==void 0&&e.renderDefault===!0}r(nn,"getStatusLineRenderDefault");function tn(n){const e=n.statusLine?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:10}r(tn,"getStatusLineEmitMinIntervalSeconds");const z=60;function rn(n){return n.claude?.oauthAccess?.enable!==!1}r(rn,"getClaudeOauthAccessEnabled");function on(n){const e=n.claude?.oauthAccess?.usageTtlSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:z}r(on,"getClaudeOauthAccessUsageTtlSeconds");const J=15986,Z=600,ee=30,ne=0;function sn(n){return d(n,n.otel)}r(sn,"isOTELEnabled");function an(n){const e=n.otel?.port;return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<65536?e:J}r(an,"getOTELPort");function cn(n){const e=n.otel?.idleTimeoutSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:Z}r(cn,"getOTELIdleTimeoutSeconds");function ln(n){const e=n.otel?.ensureMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:ee}r(ln,"getOTELEnsureMinIntervalSeconds");function un(n){const e=n.otel?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:ne}r(un,"getOTELEmitMinIntervalSeconds");function fn(n){const e=n.statusLine?.refreshInterval;if(typeof e=="number"&&Number.isFinite(e)&&e>=1)return e}r(fn,"getStatusLineRefreshInterval");function d(n,e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e.enable!==!1:j(n)}r(d,"isFeatureEnabledWithCollectorAutoEnable");function Rn(n){return n==null||typeof n!="object"||Array.isArray(n)?!1:n.enable!==!1}r(Rn,"isPresenceEnabled");function w(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}r(w,"getVerificationEnabled");function te(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.auto!==!1}r(te,"getAutoVerifyEnabled");const re=65536,oe=1;function gn(n){const e=n.verificationContext;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}r(gn,"getVerificationContextEnabled");function dn(n){return n.verificationContext?.source==="actions"?"actions":"git"}r(dn,"getVerificationContextSource");function pn(n){const e=n.verificationContext?.commitDepth;return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):oe}r(pn,"getVerificationContextCommitDepth");function bn(n){const e=n.verificationContext?.maxBytes;return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):re}r(bn,"getVerificationContextMaxBytes");function En(n,e){const t=n.ignoredVerifyPatterns??[];return t.length>0&&_(e,t)}r(En,"isIgnoredVerifyPath");function yn(n){return w(n)?te(n)?"enforce":"assist":"monitor"}r(yn,"getVerificationMode");function ie(n){const e=n.telemetry;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}r(ie,"getTelemetryEnabled");function se(n){const e=n.privacy;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.enable===!0}r(se,"getPrivacyEnabled");const k=65536;function _n(n){const e=n.fileChange;return!e||typeof e!="object"||Array.isArray(e)?!1:e.captureChangeset===!0}r(_n,"getCaptureFileChangeset");function Cn(n){const e=n.fileChange;if(!e||typeof e!="object"||Array.isArray(e))return k;const t=e.maxChangesetBytes;return typeof t!="number"||!Number.isFinite(t)||t<=0?k:Math.floor(t)}r(Cn,"getMaxChangesetBytes");function mn(n){const e=a(n);return d(e,e.analytics)}r(mn,"isAnalyticsEnabled");function vn(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitOnStop!==!1}r(vn,"isAnalyticsEmitOnStopEnabled");function An(n){const t=a(n).analytics;if(t===null||typeof t!="object"||Array.isArray(t))return 0;const o=t.emitOnStopMinIntervalSeconds;return typeof o=="number"&&o>=0?o:0}r(An,"getAnalyticsEmitOnStopMinIntervalSeconds");function In(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitTurnEvents===!0}r(In,"isAnalyticsTurnEventsEnabled");function Tn(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitStepEvents===!0}r(Tn,"isAnalyticsStepEventsEnabled");function xn(n){const t=a(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitApiRequestEvents!==!1}r(xn,"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_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,isAnalyticsApiRequestEventsEnabled,isAnalyticsEmitOnStopEnabled,isAnalyticsEnabled,isAnalyticsStepEventsEnabled,isAnalyticsTurnEventsEnabled,isCollectorConfigured,isCycleEnabled,isCyclePatternsActive,isIgnoredVerifyPath,isJobQueueEnabled,isOTELEnabled,isRecordingEnabled,isSessionStatusEnabled,loadConfig,requiresVerification,resolveConfigTargetFromFlags});
|
|
@@ -0,0 +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=2;0&&(module.exports={INSTALL_SCHEMA_VERSION});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var p=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var l=(e,n)=>p(e,"name",{value:n,configurable:!0});var O=(e,n)=>{for(var t in n)p(e,t,{get:n[t],enumerable:!0})},j=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of E(n))!T.call(e,r)&&r!==t&&p(e,r,{get:()=>n[r],enumerable:!(i=F(n,r))||i.enumerable});return e};var B=e=>j(p({},"__esModule",{value:!0}),e);var _={};O(_,{PLATFORM_TARGETS:()=>v,applyPlatformSection:()=>R,applyPlatformToProjectFiles:()=>P,fragmentFilename:()=>$,readFragment:()=>A,syncPlatformSectionsToConfig:()=>C,togglePlatformSectionInFile:()=>w});module.exports=B(_);var c=require("fs"),y=require("./logger"),h=require("./config");const S={browser:["<!-- Browser cycle verification is OFF for this project."," - To verify frontend / UI changes by driving a real browser (DOM, console,"," screenshots, accessibility, network): run `ironbee browser enable` to enable."," This file will be auto-updated with the browser-cycle guidance."," - When OFF, do NOT invoke any `bdt_*` tools voluntarily \u2014 there is no"," active browser-cycle gate, so calling them only wastes cycles. -->"].join(`
|
|
2
2
|
`),node:["<!-- Node.js runtime debug verification is OFF for this project."," - If your backend is Node.js and you want non-blocking debugger probes:"," run `ironbee node enable` to enable. This file will be auto-updated"," with the node-cycle guidance."," - If your backend isn't Node.js (Java / Python / Go / Rust / .NET / Ruby / PHP / Elixir / \u2026):"," leave this OFF \u2014 `ndt_*` tools only attach to V8/Node processes and will fail elsewhere."," - When OFF, do NOT invoke any `ndt_*` tools voluntarily. -->"].join(`
|
|
3
3
|
`),backend:["<!-- Backend protocol verification is OFF for this project."," - To verify backend services by driving real protocol calls (HTTP / gRPC /"," GraphQL / WebSocket) \u2014 runtime- and language-agnostic \u2014 run `ironbee"," backend enable`. This file will be auto-updated with the backend-cycle"," guidance."," - When OFF, do NOT invoke any `bedt_*` tools voluntarily. -->"].join(`
|
|
4
|
-
`)
|
|
4
|
+
`),android:["<!-- Android mobile verification is OFF for this project."," - To verify Android app changes by driving a real device or emulator (UI"," interactions, Logcat, screenshots): run `ironbee android enable`."," This file will be auto-updated with the android-cycle guidance."," - When OFF, do NOT invoke any `adt_*` tools voluntarily. -->"].join(`
|
|
5
|
+
`)};function I(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}l(I,"escapeRegex");function L(e){return new RegExp(`<!--IRONBEE:PLATFORM:${I(e)}(?::([\\w-]+))?-->`,"g")}l(L,"startMarkerRegex");function M(e,n){return n.length>0?`<!--/IRONBEE:PLATFORM:${e}:${n}-->`:`<!--/IRONBEE:PLATFORM:${e}-->`}l(M,"endMarkerFor");function N(e,n,t){const i=L(n),r=[],d=new Set;let s=i.exec(e);for(;s!==null;){const o=s[1]??"",a=s.index+s[0].length,f=M(n,o),b=e.indexOf(f,a);if(b===-1){const g=t?` in ${t}`:"",u=o.length>0?`${n}:${o}`:n;y.logger.debug(`platform-section ${u}: start marker found without matching end marker${g}`),s=i.exec(e);continue}if(d.has(o)){const g=t?` in ${t}`:"",u=o.length>0?`${n}:${o}`:n;y.logger.warn(`platform-section ${u}: multiple marker blocks with the same key${g} \u2014 only the first will be updated. Either consolidate the blocks or use distinct keys (\`IRONBEE:PLATFORM:${n}:<key>\`) per position.`),s=i.exec(e);continue}d.add(o),r.push({key:o,startEnd:a,endIdx:b}),s=i.exec(e)}return r}l(N,"findMarkerBlocks");function R(e,n,t,i){const r=typeof t=="function"?t:()=>t,d=N(e,n,i);if(d.length===0)return e;const s=S[n];if(s===void 0)throw new Error(`No placeholder registered for platform '${n}'.`);let o=e;for(let a=d.length-1;a>=0;a--){const f=d[a],b=r(f.key)??s,g=o.substring(0,f.startEnd),u=o.substring(f.endIdx);o=`${g}
|
|
5
6
|
${b}
|
|
6
|
-
${u}`}return o}
|
|
7
|
+
${u}`}return o}l(R,"applyPlatformSection");function $(e,n,t){return t.length>0?`${e}.${n}.${t}.md`:`${e}.${n}.md`}l($,"fragmentFilename");function A(e,n){const t=`${e}/${n}`;if(!(0,c.existsSync)(t))throw new Error(`Platform fragment not found: ${t}`);return(0,c.readFileSync)(t,"utf-8").trimEnd()}l(A,"readFragment");function w(e,n,t){if(!(0,c.existsSync)(e))return!1;const i=(0,c.readFileSync)(e,"utf-8"),r=R(i,n,t,e);return r===i?!1:((0,c.writeFileSync)(e,r),!0)}l(w,"togglePlatformSectionInFile");const v={claude:[{projectRelativePath:".claude/agents/ironbee-verifier.md",fragmentBase:"skill"}],cursor:[{projectRelativePath:".cursor/skills/ironbee-verification.md",fragmentBase:"skill"},{projectRelativePath:".cursor/rules/ironbee-verification.mdc",fragmentBase:"rule"},{projectRelativePath:".cursor/skills/ironbee-verify/SKILL.md",fragmentBase:"command-verify"}],codex:[{projectRelativePath:".agents/skills/ironbee-verification/SKILL.md",fragmentBase:"skill"},{projectRelativePath:".agents/skills/ironbee-verify/SKILL.md",fragmentBase:"command-verify"}]};function P(e,n,t,i,r){const d=[],s=Object.keys(v),o=r===void 0?s:s.filter(a=>r.includes(a));for(const a of o){const f=v[a],b=i(a);for(const g of f){const u=`${e}/${g.projectRelativePath}`;if(!(0,c.existsSync)(u))continue;w(u,n,t?m=>{const k=`${b}/${$(g.fragmentBase,n,m)}`;if(!(0,c.existsSync)(k)){const x=m.length>0?`${n}:${m}`:n;return y.logger.warn(`platform-section ${x}: missing fragment ${k} for ${g.projectRelativePath} \u2014 falling back to placeholder.`),null}return(0,c.readFileSync)(k,"utf-8").trimEnd()}:null)&&d.push(g.projectRelativePath)}}return d}l(P,"applyPlatformToProjectFiles");function C(e,n){const t=(0,h.loadConfig)(e);for(const i of h.ALL_CYCLES){const r=(0,h.isCycleEnabled)(t,i);P(e,i,r,n)}}l(C,"syncPlatformSectionsToConfig");0&&(module.exports={PLATFORM_TARGETS,applyPlatformSection,applyPlatformToProjectFiles,fragmentFilename,readFragment,syncPlatformSectionsToConfig,togglePlatformSectionInFile});
|
package/dist/lib/prompt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var l=(e,n)=>f(e,"name",{value:n,configurable:!0});var K=(e,n)=>{for(var o in n)f(e,o,{get:n[o],enumerable:!0})},P=(e,n,o,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of $(n))!A.call(e,i)&&i!==o&&f(e,i,{get:()=>n[i],enumerable:!(r=C(n,i))||r.enumerable});return e};var E=e=>P(f({},"__esModule",{value:!0}),e);var I={};K(I,{isInteractive:()=>h,keyToMultiSelectAction:()=>v,promptAcknowledge:()=>T,promptChoice:()=>N,promptMultiSelect:()=>j,promptSelect:()=>k,promptYesNo:()=>L,reduceMultiSelect:()=>y,renderMultiSelect:()=>M,renderSelect:()=>x});module.exports=E(I);var p=require("readline"),c=require("./output");function h(){return!!process.stdin.isTTY&&!!process.stdout.isTTY}l(h,"isInteractive");function N(e,n,o=0){const i=[e,...n.map((t,u)=>{const d=u===o?" (default)":"";return` ${u+1}) ${t}${d}`})].join(`
|
|
2
2
|
`)+`
|
|
3
|
-
> `,s=(0,p.createInterface)({input:process.stdin,output:process.stdout});return new Promise(t=>{s.question(i,u=>{s.close();const
|
|
3
|
+
> `,s=(0,p.createInterface)({input:process.stdin,output:process.stdout});return new Promise(t=>{s.question(i,u=>{s.close();const d=u.trim();if(d.length===0){t(o);return}const m=Number.parseInt(d,10);if(!Number.isNaN(m)&&m>=1&&m<=n.length){t(m-1);return}const a=n.findIndex(b=>b.toLowerCase()===d.toLowerCase());if(a!==-1){t(a);return}t(o)})})}l(N,"promptChoice");function L(e,n){const o=n?" [Y/n] ":" [y/N] ",r=(0,p.createInterface)({input:process.stdin,output:process.stdout});return new Promise(i=>{r.question(e+o,s=>{r.close();const t=s.trim().toLowerCase();if(t.length===0){i(n);return}if(t==="y"||t==="yes"){i(!0);return}if(t==="n"||t==="no"){i(!1);return}i(n)})})}l(L,"promptYesNo");function T(e){const n=(0,p.createInterface)({input:process.stdin,output:process.stdout});return new Promise(o=>{let r=!1;const i=l(()=>{r||(r=!0,n.close(),o())},"done");n.question(e,()=>i()),n.on("close",()=>i())})}l(T,"promptAcknowledge");function v(e){if(e.ctrl===!0&&e.name==="c")return"cancel";switch(e.name){case"up":case"k":return"up";case"down":case"j":return"down";case"space":return"toggle";case"a":return"toggleAll";case"return":case"enter":return"submit";case"escape":return"cancel";default:return"none"}}l(v,"keyToMultiSelectAction");function y(e,n){if(e.n<=0)return!1;switch(n){case"up":return e.cursor=(e.cursor-1+e.n)%e.n,!0;case"down":return e.cursor=(e.cursor+1)%e.n,!0;case"toggle":return e.selected.has(e.cursor)?e.selected.delete(e.cursor):e.selected.add(e.cursor),!0;case"toggleAll":if(e.selected.size===e.n)e.selected.clear();else for(let o=0;o<e.n;o++)e.selected.add(o);return!0;default:return!1}}l(y,"reduceMultiSelect");function g(e,n,o){return`${o(c.pc.bold(e))} ${c.pc.dim(n)}`}l(g,"keyHint");const w=c.pc.dim(" \xB7 ");function M(e,n,o){const r=n.reduce((t,u)=>Math.max(t,u.label.length),0),i=" "+[g("\u2191/\u2193","move",c.pc.cyan),g("space","select",c.pc.yellow),g("a","all",c.pc.magenta),g("enter","confirm",c.pc.green)].join(w),s=[e,i];return n.forEach((t,u)=>{const d=u===o.cursor,m=d?c.pc.cyan(">"):" ",a=o.selected.has(u)?c.pc.yellow("[x]"):"[ ]",b=d?c.pc.bold(t.label.padEnd(r)):t.label.padEnd(r),R=t.hint?" "+c.pc.dim(t.hint):"";s.push(`${m} ${a} ${b}${R}`)}),s}l(M,"renderMultiSelect");function j(e,n,o){const r=o.filter(s=>s>=0&&s<n.length).sort((s,t)=>s-t);if(n.length===0)return Promise.resolve([...r]);const i={cursor:0,selected:new Set(r),n:n.length};return new Promise(s=>{S(()=>M(e,n,i),u=>u==="cancel"?"cancel":u==="submit"?"submit":y(i,u)?"redraw":"ignore",()=>s([...i.selected].sort((u,d)=>u-d)))||s([...r])})}l(j,"promptMultiSelect");function x(e,n,o){const r=n.reduce((t,u)=>Math.max(t,u.label.length),0),i=" "+[g("\u2191/\u2193","move",c.pc.cyan),g("enter","select",c.pc.green)].join(w),s=[e,i];return n.forEach((t,u)=>{const d=u===o,m=d?c.pc.cyan(">"):" ",a=d?c.pc.bold(t.label.padEnd(r)):t.label.padEnd(r),b=t.hint?" "+c.pc.dim(t.hint):"";s.push(`${m} ${a}${b}`)}),s}l(x,"renderSelect");function k(e,n,o=0){if(n.length===0)return Promise.resolve(o);let r=o>=0&&o<n.length?o:0;return new Promise(i=>{S(()=>x(e,n,r),t=>t==="cancel"?"cancel":t==="submit"?"submit":t==="up"?(r=(r-1+n.length)%n.length,"redraw"):t==="down"?(r=(r+1)%n.length,"redraw"):"ignore",()=>i(r))||i(o)})}l(k,"promptSelect");function S(e,n,o){const r=process.stdin;if(!h()||typeof r.setRawMode!="function")return!1;const i=process.stdout;let s=0;const t=l(m=>{!m&&s>0&&i.write(`\x1B[${s}A`),i.write("\x1B[0J");const a=e();i.write(a.join(`
|
|
4
4
|
`)+`
|
|
5
|
-
`),s=
|
|
6
|
-
`),process.exit(130);return}if(b==="submit"){u(),o();return}b==="redraw"&&t(!1)},"onKey");return(0,p.emitKeypressEvents)(r),r.setRawMode(!0),r.resume(),r.on("keypress",
|
|
5
|
+
`),s=a.length},"draw"),u=l(()=>{r.removeListener("keypress",d),typeof r.setRawMode=="function"&&r.setRawMode(!1),r.pause()},"cleanup"),d=l((m,a)=>{if(!a)return;const b=n(v(a));if(b==="cancel"){u(),i.write(`
|
|
6
|
+
`),process.exit(130);return}if(b==="submit"){u(),o();return}b==="redraw"&&t(!1)},"onKey");return(0,p.emitKeypressEvents)(r),r.setRawMode(!0),r.resume(),r.on("keypress",d),t(!0),!0}l(S,"runRawKeypressUI");0&&(module.exports={isInteractive,keyToMultiSelectAction,promptAcknowledge,promptChoice,promptMultiSelect,promptSelect,promptYesNo,reduceMultiSelect,renderMultiSelect,renderSelect});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var i=(o,r)=>l(o,"name",{value:r,configurable:!0});var u=(o,r)=>{for(var t in r)l(o,t,{get:r[t],enumerable:!0})},R=(o,r,t,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of T(r))!C.call(o,e)&&e!==t&&l(o,e,{get:()=>r[e],enumerable:!(c=d(r,e))||c.enumerable});return o};var a=o=>R(l({},"__esModule",{value:!0}),o);var y={};u(y,{RECORDING_CYCLES:()=>g,listRecordingCycleTools:()=>s,recordingToolsForBareTool:()=>f,recordingToolsForServer:()=>p});module.exports=a(y);var n=require("./config");const g=["browser","android"];function s(){return g.map(o=>({cycle:o,server:n.CYCLE_TO_SERVER[o],startTool:`${n.CYCLE_TOOL_PREFIXES[o]}content_start-recording`,stopTool:`${n.CYCLE_TOOL_PREFIXES[o]}content_stop-recording`}))}i(s,"listRecordingCycleTools");function p(o){return o?s().find(r=>r.server===o)??null:null}i(p,"recordingToolsForServer");function f(o){return s().find(r=>o.startsWith(n.CYCLE_TOOL_PREFIXES[r.cycle]))??null}i(f,"recordingToolsForBareTool");0&&(module.exports={RECORDING_CYCLES,listRecordingCycleTools,recordingToolsForBareTool,recordingToolsForServer});
|