@ironbee-ai/cli 0.26.0 → 0.28.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 +8 -0
- package/dist/clients/claude/agents/ironbee-verifier.md +31 -0
- package/dist/clients/claude/platforms/skill.android.md +2 -0
- package/dist/clients/claude/platforms/skill.backend.md +2 -0
- package/dist/clients/claude/platforms/skill.browser.md +2 -0
- package/dist/clients/claude/platforms/skill.node.md +2 -0
- package/dist/clients/claude/rules/ironbee-verification.md +1 -1
- package/dist/clients/codex/agents/ironbee-verifier.md +75 -26
- package/dist/clients/codex/cli.js +1 -1
- package/dist/clients/codex/commands/ironbee-verify/SKILL.main.md +114 -0
- package/dist/clients/codex/commands/ironbee-verify/SKILL.md +38 -61
- package/dist/clients/codex/index.js +2 -2
- package/dist/clients/codex/platforms/skill.android.md +2 -0
- package/dist/clients/codex/platforms/skill.backend.md +2 -0
- package/dist/clients/codex/platforms/skill.browser.md +2 -0
- package/dist/clients/codex/platforms/skill.node.md +2 -0
- package/dist/clients/codex/rules/ironbee-verification.main.md +39 -0
- package/dist/clients/codex/rules/ironbee-verification.md +10 -27
- package/dist/clients/codex/skills/ironbee-verification.main.md +110 -0
- package/dist/clients/codex/skills/ironbee-verification.md +40 -68
- package/dist/clients/codex/util.js +32 -22
- package/dist/clients/codex/verifier.js +2 -0
- package/dist/clients/cursor/platforms/skill.android.md +2 -0
- package/dist/clients/cursor/platforms/skill.backend.md +2 -0
- package/dist/clients/cursor/platforms/skill.browser.md +2 -0
- package/dist/clients/cursor/platforms/skill.node.md +2 -0
- package/dist/clients/cursor/skills/ironbee-verification.md +21 -0
- package/dist/commands/config.js +1 -1
- package/dist/commands/install.js +1 -1
- package/dist/commands/mode-select.js +2 -2
- package/dist/commands/verification-toggle.js +1 -1
- package/dist/hooks/core/activity-end.js +1 -1
- package/dist/hooks/core/session-state.js +1 -1
- package/dist/hooks/core/submit-verdict.js +3 -3
- package/dist/hooks/core/verification-lifecycle.js +1 -1
- package/dist/hooks/core/verify-gate.js +11 -11
- package/dist/lib/config.js +1 -1
- package/dist/lib/install-version.js +1 -1
- package/dist/lib/platform-section.js +3 -3
- package/dist/tui/config/schema.js +1 -1
- package/package.json +1 -1
package/dist/commands/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var l=(e,o)=>m(e,"name",{value:o,configurable:!0});var L=(e,o)=>{for(var n in o)m(e,n,{get:o[n],enumerable:!0})},M=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of V(o))!q.call(e,i)&&i!==n&&m(e,i,{get:()=>o[i],enumerable:!(r=K(o,i))||r.enumerable});return e};var Y=e=>M(m({},"__esModule",{value:!0}),e);var ie={};L(ie,{configCommand:()=>u,runGet:()=>U,runList:()=>W,runPath:()=>_,runSet:()=>F,runUnset:()=>B});module.exports=Y(ie);var D=require("commander"),g=require("fs"),N=require("os"),d=require("path"),f=require("../clients/registry"),I=require("./install"),b=require("../lib/config"),G=require("../lib/gitignore"),k=require("../lib/logger"),t=require("../lib/output"),h=require("../lib/prompt"),J=require("../lib/projects-registry");const z=new Set(["verification","collector","browser","node","backend","android","browserDevTools","nodeDevTools","backendDevTools","androidDevTools","telemetry","privacy","statusLine","otel"]);function C(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.json")}l(C,"projectConfigPath");function S(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.local.json")}l(S,"projectLocalConfigPath");function O(){return(0,d.join)((0,N.homedir)(),".ironbee","config.json")}l(O,"globalConfigPath");function w(e){if(!(0,g.existsSync)(e))return{};try{const o=(0,g.readFileSync)(e,"utf-8");return o.trim().length===0?{}:JSON.parse(o)}catch(o){throw k.logger.debug(`failed to read ${e}: ${o}`),new Error(`Config at ${e} is not valid JSON: ${o instanceof Error?o.message:o}`)}}l(w,"readConfigFile");function j(e,o){(0,g.mkdirSync)((0,d.join)(e,".."),{recursive:!0}),(0,g.writeFileSync)(e,JSON.stringify(o,null,2)+`
|
|
1
|
+
"use strict";var m=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var l=(e,o)=>m(e,"name",{value:o,configurable:!0});var L=(e,o)=>{for(var n in o)m(e,n,{get:o[n],enumerable:!0})},M=(e,o,n,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of V(o))!q.call(e,i)&&i!==n&&m(e,i,{get:()=>o[i],enumerable:!(r=K(o,i))||r.enumerable});return e};var Y=e=>M(m({},"__esModule",{value:!0}),e);var ie={};L(ie,{configCommand:()=>u,runGet:()=>U,runList:()=>W,runPath:()=>_,runSet:()=>F,runUnset:()=>B});module.exports=Y(ie);var D=require("commander"),g=require("fs"),N=require("os"),d=require("path"),f=require("../clients/registry"),I=require("./install"),b=require("../lib/config"),G=require("../lib/gitignore"),k=require("../lib/logger"),t=require("../lib/output"),h=require("../lib/prompt"),J=require("../lib/projects-registry");const z=new Set(["verification","collector","browser","node","backend","android","browserDevTools","nodeDevTools","backendDevTools","androidDevTools","telemetry","privacy","statusLine","otel","codex"]);function C(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.json")}l(C,"projectConfigPath");function S(e){return(0,d.join)((0,d.resolve)(e),".ironbee","config.local.json")}l(S,"projectLocalConfigPath");function O(){return(0,d.join)((0,N.homedir)(),".ironbee","config.json")}l(O,"globalConfigPath");function w(e){if(!(0,g.existsSync)(e))return{};try{const o=(0,g.readFileSync)(e,"utf-8");return o.trim().length===0?{}:JSON.parse(o)}catch(o){throw k.logger.debug(`failed to read ${e}: ${o}`),new Error(`Config at ${e} is not valid JSON: ${o instanceof Error?o.message:o}`)}}l(w,"readConfigFile");function j(e,o){(0,g.mkdirSync)((0,d.join)(e,".."),{recursive:!0}),(0,g.writeFileSync)(e,JSON.stringify(o,null,2)+`
|
|
2
2
|
`)}l(j,"writeConfigFile");function H(e){const o=e.indexOf(".");return o===-1?e:e.slice(0,o)}l(H,"topKey");function $(e){return z.has(H(e))}l($,"affectsArtifacts");function Q(e,o){if(o.length===0)return e;const n=o.split(".");let r=e;for(const i of n){if(r==null||typeof r!="object"||Array.isArray(r))return;r=r[i]}return r}l(Q,"getAtPath");function X(e,o,n){if(o.length===0)throw new Error("Cannot set the root config \u2014 pass a dotted key (e.g. `collector.url`).");const r=o.split(".");let i=e;for(let a=0;a<r.length-1;a++){const s=r[a],c=i[s];(c==null||typeof c!="object"||Array.isArray(c))&&(i[s]={}),i=i[s]}i[r[r.length-1]]=n}l(X,"setAtPath");function Z(e,o){if(o.length===0)return!1;const n=o.split(".");let r=e;for(let a=0;a<n.length-1;a++){const s=n[a],c=r[s];if(c==null||typeof c!="object"||Array.isArray(c))return!1;r=c}const i=n[n.length-1];return Object.prototype.hasOwnProperty.call(r,i)?(delete r[i],!0):!1}l(Z,"unsetAtPath");function ee(e,o){if(o)try{return JSON.parse(e)}catch(n){throw new Error(`--json was set but value is not valid JSON: ${n instanceof Error?n.message:n}`)}try{return JSON.parse(e)}catch{return e}}l(ee,"parseValue");function v(e){if(e.global===!0&&e.local===!0)throw new Error("Pass at most one of --global / --local.");if(e.global===!0)return{path:O(),label:"global",useGlobal:!0};const o=e.projectDir??process.cwd();return e.local===!0?{path:S(o),label:"local",useGlobal:!1}:{path:C(o),label:"project",useGlobal:!1}}l(v,"resolveWriteTarget");function A(e){if((e.global===!0?1:0)+(e.project===!0?1:0)+(e.local===!0?1:0)>1)throw new Error("Pass at most one of --global / --project / --local.");if(e.global===!0)return{label:"global",path:O()};const n=e.projectDir??process.cwd();return e.project===!0?{label:"project",path:C(n)}:e.local===!0?{label:"local",path:S(n)}:{label:"merged",path:n}}l(A,"resolveReadTarget");function P(e){return e.label==="merged"?(0,b.loadConfig)(e.path):w(e.path)}l(P,"readForGet");function oe(e){return e===void 0?"(unset)":typeof e=="string"?e:JSON.stringify(e,null,2)}l(oe,"formatValue");function ne(e,o){const n=(0,f.detectClients)(e);if(o===void 0&&n.length===0)return console.log(` ${t.pc.dim("\xB7")} ${t.pc.dim("no clients detected in")} ${t.pc.dim(e)} ${t.pc.dim("\u2014 skipping artifact rerender")}`),[];const r=(0,b.loadConfig)(e),i=(0,f.resolveTargetClients)(e,o);for(const a of i)a.install(e,r);return(0,G.ensureIronBeeGitignored)(e),i.map(a=>a.name)}l(ne,"rerenderArtifacts");function E(e,o,n,r){const i=(0,g.existsSync)(e)?(0,g.readFileSync)(e,"utf-8"):null;j(e,o);try{return ne(n,r)}catch(a){try{i===null?(0,g.existsSync)(e)&&(0,g.unlinkSync)(e):(0,g.writeFileSync)(e,i)}catch(s){k.logger.debug(`config rollback failed: ${s}`)}throw a}}l(E,"writeAndRerender");const R=10;function te(e){const o=(0,f.listActiveProjects)(),n=(0,J.canonicalizePath)(e);return o.filter(r=>r.path!==n)}l(te,"listOtherProjects");function re(e){const o=e.length===1?"other project":"other projects";console.log(` ${t.pc.yellow("\u26A0")} ${t.pc.bold(String(e.length))} ${o} registered in the inventory still on the prior state:`);const n=e.slice(0,R);for(const r of n)console.log(` ${t.pc.dim("\xB7")} ${t.pc.dim(r.path)}`);e.length>R&&console.log(` ${t.pc.dim("\u2026and")} ${t.pc.bold(String(e.length-R))} ${t.pc.dim("more")}`)}l(re,"printOtherProjectsBanner");async function T(e,o,n){if(!o)return;const r=te(e);if(r.length===0)return;re(r);let i;if(n===!0)i=!0;else if(n===!1){console.log(` ${t.pc.dim("Run")} ${t.pc.cyan("ironbee install --all")} ${t.pc.dim("later to apply, or")} ${t.pc.cyan("ironbee install")} ${t.pc.dim("in selected projects.")}`);return}else if((0,h.isInteractive)()){const a=r.length===1?"this project":`these ${r.length} projects`;i=await(0,h.promptYesNo)(` Apply this change to ${a} now?`,!0)}else{console.log(` ${t.pc.dim("Run")} ${t.pc.cyan("ironbee install --all")} ${t.pc.dim("to apply everywhere, or pass")} ${t.pc.cyan("--apply-all")} ${t.pc.dim("to skip this prompt.")}`);return}if(!i){console.log(` ${t.pc.dim("Skipped. Run")} ${t.pc.cyan("ironbee install --all")} ${t.pc.dim("later to apply.")}`);return}console.log(),await(0,I.runInstallAll)({})}l(T,"maybeApplyToOtherProjects");async function F(e,o,n){if(e.length===0)throw new Error("Key is required (dotted path, e.g. `collector.url`).");const r=v(n),i=ee(o,n.json===!0),a=w(r.path),s=JSON.parse(JSON.stringify(a));X(s,e,i);const c=n.projectDir??process.cwd(),p=n.rerender!==!1&&$(e);let y=[];p?y=E(r.path,s,c,n.client):j(r.path,s),console.log(`${t.pc.green("\u2713")} Set ${t.pc.cyan(e)} = ${t.pc.bold(oe(i))} in ${r.label} config (${t.pc.dim(r.path)}).`),p?y.length>0&&(console.log(` ${t.pc.dim("Re-rendered artifacts for:")} ${t.pc.bold(y.join(", "))}`),console.log(` ${t.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)):n.rerender===!1&&$(e)&&console.log(` ${t.pc.yellow("\u26A0")} --no-rerender set: artifacts may now be out of sync with config. Run ${t.pc.cyan("ironbee install")} to resync.`),x(e),r.useGlobal&&await T(c,p,n.applyAll)}l(F,"runSet");function x(e){const o=(0,b.findActiveEnvOverride)(e);o!==void 0&&console.log(` ${t.pc.yellow("\u26A0")} ${t.pc.cyan(o.envVar)} is set in this shell \u2014 env overrides file config, so ${t.pc.cyan(e)} reads will return the env value until ${t.pc.cyan(o.envVar)} is unset.`)}l(x,"warnIfEnvShadowed");async function B(e,o){if(e.length===0)throw new Error("Key is required (dotted path, e.g. `collector.url`).");const n=v(o),r=w(n.path),i=JSON.parse(JSON.stringify(r));if(!Z(i,e)){console.log(`${t.pc.dim("\xB7")} ${t.pc.cyan(e)} not present in ${n.label} config (${t.pc.dim(n.path)}). No-op.`);return}const s=o.projectDir??process.cwd(),c=o.rerender!==!1&&$(e);let p=[];c?p=E(n.path,i,s,o.client):j(n.path,i),console.log(`${t.pc.green("\u2713")} Unset ${t.pc.cyan(e)} in ${n.label} config (${t.pc.dim(n.path)}).`),c&&p.length>0&&(console.log(` ${t.pc.dim("Re-rendered artifacts for:")} ${t.pc.bold(p.join(", "))}`),console.log(` ${t.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)),x(e),n.useGlobal&&await T(s,c,o.applyAll)}l(B,"runUnset");function U(e,o){const n=A(o),r=P(n),i=Q(r,e);i===void 0&&(console.error(`${t.pc.dim("\xB7")} ${t.pc.cyan(e)} ${t.pc.dim("not set in")} ${n.label} ${t.pc.dim("config")}`),process.exit(1)),console.log(typeof i=="string"?i:JSON.stringify(i,null,2))}l(U,"runGet");function W(e){const o=A(e),n=P(o);console.log(JSON.stringify(n,null,2))}l(W,"runList");function _(e){const o=v(e);console.log(o.path)}l(_,"runPath");const u=new D.Command("config").description("Read or write IronBee configuration values (project or global). Smart re-render: artifact-affecting keys auto-update installed client files.");u.command("get <key>").description("Print the value at a dotted path. Default: merged effective value (global + project + local). --global / --project / --local narrow to one source.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Read from global config only (~/.ironbee/config.json).").option("--project","Read from project config only (<project>/.ironbee/config.json).").option("--local","Read from project-local config only (<project>/.ironbee/config.local.json \u2014 gitignored).").action((e,o)=>{try{U(e,o)}catch(n){console.error(`${t.pc.red("\u2717")} ${n instanceof Error?n.message:n}`),process.exit(1)}}),u.command("set <key> <value>").description("Set a config value. Type-coerces (true/42/[\u2026]/{\u2026}) unless --json forces strict parsing. Re-renders client artifacts when the top-level key affects them. After a global write (`-g`) on an artifact-affecting key, prompts whether to apply the change to every other registered project. Use --local to write to the gitignored personal-override layer instead of the committed project config.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Write to global config (~/.ironbee/config.json).").option("--local","Write to the gitignored project-local override (<project>/.ironbee/config.local.json) instead of the committed project config. Mutually exclusive with --global.").option("--client <name>",`Filter clients for artifact rerender (${(0,f.clientNames)()}), or "all". Default: detected clients.`).option("--no-rerender","Skip artifact rerender even when the key normally triggers it.").option("--json","Require value to parse as strict JSON (no string fallback).").option("--apply-all","After a global write on an artifact-affecting key, apply the change to every registered project without prompting.").option("--no-apply-all","After a global write on an artifact-affecting key, do NOT apply to other registered projects (suppress the prompt).").action(async(e,o,n)=>{try{await F(e,o,n)}catch(r){console.error(`${t.pc.red("\u2717")} ${r instanceof Error?r.message:r}`),process.exit(1)}}),u.command("unset <key>").description("Remove a config key. Idempotent \u2014 no-op when the key is absent. Re-renders client artifacts when the top-level key affects them. After a global unset (`-g`) on an artifact-affecting key, prompts whether to apply the change to every other registered project. Use --local to remove from the gitignored personal-override layer instead of the committed project config.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Write to global config (~/.ironbee/config.json).").option("--local","Write to the gitignored project-local override (<project>/.ironbee/config.local.json) instead of the committed project config. Mutually exclusive with --global.").option("--client <name>",`Filter clients for artifact rerender (${(0,f.clientNames)()}), or "all". Default: detected clients.`).option("--no-rerender","Skip artifact rerender even when the key normally triggers it.").option("--apply-all","After a global unset on an artifact-affecting key, apply the change to every registered project without prompting.").option("--no-apply-all","After a global unset on an artifact-affecting key, do NOT apply to other registered projects (suppress the prompt).").action(async(e,o)=>{try{await B(e,o)}catch(n){console.error(`${t.pc.red("\u2717")} ${n instanceof Error?n.message:n}`),process.exit(1)}}),u.command("list").description("Print the entire config. Default: merged effective config; --global / --project / --local narrow to one source.").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Read from global config only.").option("--project","Read from project config only.").option("--local","Read from project-local config only (<project>/.ironbee/config.local.json \u2014 gitignored).").action(e=>{try{W(e)}catch(o){console.error(`${t.pc.red("\u2717")} ${o instanceof Error?o.message:o}`),process.exit(1)}}),u.command("path").description("Print the on-disk path of the targeted config file (project by default; --global for global, --local for the gitignored personal-override layer).").option("-p, --project-dir <dir>","Project directory (default: cwd).").option("-g, --global","Print global config path (~/.ironbee/config.json).").option("--local","Print project-local config path (<project>/.ironbee/config.local.json).").action(e=>{try{_(e)}catch(o){console.error(`${t.pc.red("\u2717")} ${o instanceof Error?o.message:o}`),process.exit(1)}});0&&(module.exports={configCommand,runGet,runList,runPath,runSet,runUnset});
|
package/dist/commands/install.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var u=(i,e)=>y(i,"name",{value:e,configurable:!0});var T=(i,e)=>{for(var o in e)y(i,o,{get:e[o],enumerable:!0})},R=(i,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of A(e))!N.call(i,r)&&r!==o&&y(i,r,{get:()=>e[r],enumerable:!(a=V(e,r))||a.enumerable});return i};var B=i=>R(y({},"__esModule",{value:!0}),i);var q={};T(q,{CYCLE_HINTS:()=>D,installCommand:()=>F,runInstallAll:()=>v,syncSchemaIfChanged:()=>W});module.exports=B(q);var $=require("commander"),P=require("fs"),x=require("path"),c=require("../clients/registry"),M=require("../clients/claude"),m=require("../lib/config"),t=require("../lib/output"),j=require("../lib/projects-registry"),f=require("../lib/prompt"),w=require("../lib/telemetry"),S=require("../lib/install-version"),p=require("../lib/schema-sync"),C=require("./cycle-toggle"),l=require("./mode-select");const D={browser:"web UI \xB7 DOM \xB7 console \xB7 a11y \xB7 screenshots \xB7 recording",node:"Node.js runtime \xB7 tracepoints \xB7 logpoints \xB7 exceptions \xB7 variables \xB7 logs",backend:"HTTP \xB7 gRPC \xB7 GraphQL \xB7 WebSocket \xB7 DB \xB7 logs"};async function _(i,e){if(e!==void 0)return e;if(!(0,f.isInteractive)())return;const o=(0,l.resolveInstallDefaultMode)(i),a=Math.max(0,l.ALL_MODES.indexOf(o)),r=l.ALL_MODES.map(d=>({label:l.MODE_LABELS[d],hint:l.MODE_HINTS[d]})),s=await(0,f.promptSelect)("Which verification mode?",r,a);return l.ALL_MODES[s]}u(_,"resolveModeSelection");function k(i,e){if(e===void 0)return;const a=(0,l.applyModeToLayer)(i,"project",e)?"":t.pc.dim(" (unchanged)");t.log.info(`Mode: ${t.pc.bold(l.MODE_LABELS[e])}${a}`)}u(k,"applyModeSelection");async function O(i,e,o){if(e!==void 0)return e;const a=(0,m.loadConfig)(i);if((o??(0,m.getVerificationMode)(a))==="monitor"||!(0,f.isInteractive)())return;const s=m.ALL_CYCLES.map(n=>({label:n,hint:D[n]})),d=m.ALL_CYCLES.map((n,g)=>(0,m.isCyclePatternsActive)(a,n)?g:-1).filter(n=>n>=0);return(await(0,f.promptMultiSelect)("Which platforms should require verification?",s,d)).map(n=>m.ALL_CYCLES[n])}u(O,"resolvePlatformSelection");function E(i,e){if(e===void 0)return;const o=(0,C.reconcileCyclesInLayer)(i,"project",e,!0),a=e.length>0?t.pc.bold(e.join(", ")):t.pc.dim("none (monitoring tools only)"),r=o.length>0?t.pc.dim(` \u2014 updated: ${o.join(", ")}`):"";t.log.info(`Platforms: ${a}${r}`)}u(E,"applyPlatformSelection");function H(i,e){return e!==void 0?(0,c.resolveTargetClients)(i.path,e):(0,c.detectClients)(i.path)}u(H,"clientsForBatchEntry");async function v(i){const e=(0,c.listActiveProjects)();if(e.length===0)return t.log.info("No registered projects to install. Run `ironbee install` somewhere first."),{failures:0,total:0};t.log.info(`Installing across ${t.pc.bold(String(e.length))} registered project(s)\u2026`),t.log.blank();let o=0;const a=[];for(const s of e)try{const d=H(s,i.client);if(d.length===0){t.log.warn(`Skipping ${s.path} \u2014 no resolvable clients`);continue}const h=d.map(n=>n.name);t.log.label("project",t.pc.dim(s.path)),t.log.step(`installing ${t.pc.bold(h.join(", "))}`),(0,M.prepareIronBeeDir)(s.path),k(s.path,i.mode),E(s.path,i.platforms);for(const n of d)n.install(s.path);(0,j.upsertProject)(s.path),a.push(...h)}catch(d){o++,t.log.error(` ${s.path}: ${d instanceof Error?d.message:String(d)}`)}t.log.blank(),o===0?t.log.success(`Installed across ${e.length} project(s). ${t.pc.dim("Restart your AI coding client(s) to apply.")}`):t.log.warn(`Completed with ${o} failure(s) \u2014 see above.`);const r=Array.from(new Set(a));return r.length>0&&await(0,w.trackInstall)(r),{failures:o,total:e.length}}u(v,"runInstallAll");async function W(){try{if((0,p.isAutoRerenderDisabled)()||(0,p.readSyncedSchemaVersion)()>=S.INSTALL_SCHEMA_VERSION)return!1;const e=(0,c.listActiveProjects)();if(e.length===0)return(0,p.writeSyncedSchemaVersion)(S.INSTALL_SCHEMA_VERSION),!1;if(!(0,f.isInteractive)())return!1;t.log.blank(),t.log.warn(`IronBee's installed setup structure changed in this version \u2014 re-rendering ${t.pc.bold(String(e.length))} registered project(s):`);for(const o of e.slice(0,10))t.log.label("project",t.pc.dim(o.path));return e.length>10&&t.log.info(t.pc.dim(` \u2026and ${e.length-10} more`)),await(0,f.promptAcknowledge)(t.pc.dim(" Press Enter to update them now\u2026 ")),await v({}),(0,p.writeSyncedSchemaVersion)(S.INSTALL_SCHEMA_VERSION),!0}catch(i){return t.log.blank(),t.log.warn(`IronBee schema sync skipped: ${i instanceof Error?i.message:String(i)}`),!1}}u(W,"syncSchemaIfChanged");const F=new $.Command("install").description("Install IronBee hooks and guidance files into a project. Use --all to install across every registered project (e.g. after a global config change).").argument("[project-dir]","target project directory",".").option("--client <name>",`client to install for (${(0,c.clientNames)()}), or "all"`).option("--all","Install across every project in the user-home inventory (~/.ironbee/projects.json) instead of just one. The [project-dir] argument is ignored when --all is set.").option("--platforms <list>",`comma-separated platforms to enable (${m.ALL_CYCLES.join(", ")}); skips the interactive picker. Empty ("") disables all. Default: interactive picker (pre-checked from current config), browser-only on a fresh non-interactive install.`).option("--mode <mode>",`verification mode (${l.ALL_MODES.join(", ")}); skips the interactive picker. enforce = full enforcement
|
|
1
|
+
"use strict";var y=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var u=(i,e)=>y(i,"name",{value:e,configurable:!0});var T=(i,e)=>{for(var o in e)y(i,o,{get:e[o],enumerable:!0})},R=(i,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of A(e))!N.call(i,r)&&r!==o&&y(i,r,{get:()=>e[r],enumerable:!(a=V(e,r))||a.enumerable});return i};var B=i=>R(y({},"__esModule",{value:!0}),i);var q={};T(q,{CYCLE_HINTS:()=>D,installCommand:()=>F,runInstallAll:()=>v,syncSchemaIfChanged:()=>W});module.exports=B(q);var $=require("commander"),P=require("fs"),x=require("path"),c=require("../clients/registry"),M=require("../clients/claude"),m=require("../lib/config"),t=require("../lib/output"),j=require("../lib/projects-registry"),f=require("../lib/prompt"),w=require("../lib/telemetry"),S=require("../lib/install-version"),p=require("../lib/schema-sync"),C=require("./cycle-toggle"),l=require("./mode-select");const D={browser:"web UI \xB7 DOM \xB7 console \xB7 a11y \xB7 screenshots \xB7 recording",node:"Node.js runtime \xB7 tracepoints \xB7 logpoints \xB7 exceptions \xB7 variables \xB7 logs",backend:"HTTP \xB7 gRPC \xB7 GraphQL \xB7 WebSocket \xB7 DB \xB7 logs"};async function _(i,e){if(e!==void 0)return e;if(!(0,f.isInteractive)())return;const o=(0,l.resolveInstallDefaultMode)(i),a=Math.max(0,l.ALL_MODES.indexOf(o)),r=l.ALL_MODES.map(d=>({label:l.MODE_LABELS[d],hint:l.MODE_HINTS[d]})),s=await(0,f.promptSelect)("Which verification mode?",r,a);return l.ALL_MODES[s]}u(_,"resolveModeSelection");function k(i,e){if(e===void 0)return;const a=(0,l.applyModeToLayer)(i,"project",e)?"":t.pc.dim(" (unchanged)");t.log.info(`Mode: ${t.pc.bold(l.MODE_LABELS[e])}${a}`)}u(k,"applyModeSelection");async function O(i,e,o){if(e!==void 0)return e;const a=(0,m.loadConfig)(i);if((o??(0,m.getVerificationMode)(a))==="monitor"||!(0,f.isInteractive)())return;const s=m.ALL_CYCLES.map(n=>({label:n,hint:D[n]})),d=m.ALL_CYCLES.map((n,g)=>(0,m.isCyclePatternsActive)(a,n)?g:-1).filter(n=>n>=0);return(await(0,f.promptMultiSelect)("Which platforms should require verification?",s,d)).map(n=>m.ALL_CYCLES[n])}u(O,"resolvePlatformSelection");function E(i,e){if(e===void 0)return;const o=(0,C.reconcileCyclesInLayer)(i,"project",e,!0),a=e.length>0?t.pc.bold(e.join(", ")):t.pc.dim("none (monitoring tools only)"),r=o.length>0?t.pc.dim(` \u2014 updated: ${o.join(", ")}`):"";t.log.info(`Platforms: ${a}${r}`)}u(E,"applyPlatformSelection");function H(i,e){return e!==void 0?(0,c.resolveTargetClients)(i.path,e):(0,c.detectClients)(i.path)}u(H,"clientsForBatchEntry");async function v(i){const e=(0,c.listActiveProjects)();if(e.length===0)return t.log.info("No registered projects to install. Run `ironbee install` somewhere first."),{failures:0,total:0};t.log.info(`Installing across ${t.pc.bold(String(e.length))} registered project(s)\u2026`),t.log.blank();let o=0;const a=[];for(const s of e)try{const d=H(s,i.client);if(d.length===0){t.log.warn(`Skipping ${s.path} \u2014 no resolvable clients`);continue}const h=d.map(n=>n.name);t.log.label("project",t.pc.dim(s.path)),t.log.step(`installing ${t.pc.bold(h.join(", "))}`),(0,M.prepareIronBeeDir)(s.path),k(s.path,i.mode),E(s.path,i.platforms);for(const n of d)n.install(s.path);(0,j.upsertProject)(s.path),a.push(...h)}catch(d){o++,t.log.error(` ${s.path}: ${d instanceof Error?d.message:String(d)}`)}t.log.blank(),o===0?t.log.success(`Installed across ${e.length} project(s). ${t.pc.dim("Restart your AI coding client(s) to apply.")}`):t.log.warn(`Completed with ${o} failure(s) \u2014 see above.`);const r=Array.from(new Set(a));return r.length>0&&await(0,w.trackInstall)(r),{failures:o,total:e.length}}u(v,"runInstallAll");async function W(){try{if((0,p.isAutoRerenderDisabled)()||(0,p.readSyncedSchemaVersion)()>=S.INSTALL_SCHEMA_VERSION)return!1;const e=(0,c.listActiveProjects)();if(e.length===0)return(0,p.writeSyncedSchemaVersion)(S.INSTALL_SCHEMA_VERSION),!1;if(!(0,f.isInteractive)())return!1;t.log.blank(),t.log.warn(`IronBee's installed setup structure changed in this version \u2014 re-rendering ${t.pc.bold(String(e.length))} registered project(s):`);for(const o of e.slice(0,10))t.log.label("project",t.pc.dim(o.path));return e.length>10&&t.log.info(t.pc.dim(` \u2026and ${e.length-10} more`)),await(0,f.promptAcknowledge)(t.pc.dim(" Press Enter to update them now\u2026 ")),await v({}),(0,p.writeSyncedSchemaVersion)(S.INSTALL_SCHEMA_VERSION),!0}catch(i){return t.log.blank(),t.log.warn(`IronBee schema sync skipped: ${i instanceof Error?i.message:String(i)}`),!1}}u(W,"syncSchemaIfChanged");const F=new $.Command("install").description("Install IronBee hooks and guidance files into a project. Use --all to install across every registered project (e.g. after a global config change).").argument("[project-dir]","target project directory",".").option("--client <name>",`client to install for (${(0,c.clientNames)()}), or "all"`).option("--all","Install across every project in the user-home inventory (~/.ironbee/projects.json) instead of just one. The [project-dir] argument is ignored when --all is set.").option("--platforms <list>",`comma-separated platforms to enable (${m.ALL_CYCLES.join(", ")}); skips the interactive picker. Empty ("") disables all. Default: interactive picker (pre-checked from current config), browser-only on a fresh non-interactive install.`).option("--mode <mode>",`verification mode (${l.ALL_MODES.join(", ")}); skips the interactive picker. enforce = full enforcement, assist = tools installed but not enforced (default), monitor = monitoring-only. Default: interactive picker (pre-selecting the current mode), untouched on a non-interactive install.`).action(async(i,e)=>{let o;if(e.platforms!==void 0)try{o=(0,C.parsePlatformsFlag)(e.platforms)}catch(n){t.log.error(n instanceof Error?n.message:String(n)),process.exit(1)}let a;if(e.mode!==void 0)try{a=(0,l.parseModeFlag)(e.mode)}catch(n){t.log.error(n instanceof Error?n.message:String(n)),process.exit(1)}if(e.all===!0){(await v({client:e.client,platforms:o,mode:a})).failures>0&&process.exit(1);return}const r=(0,x.resolve)(i);(0,P.existsSync)(r)||(t.log.error(`Directory not found: ${r}`),process.exit(1));let s;if(e.client!==void 0)try{s=(0,c.resolveTargetClients)(r,e.client)}catch(n){t.log.error(n instanceof Error?n.message:String(n)),process.exit(1)}else{const n=(0,c.detectClients)(r);if(n.length>0){s=n;const g=n.map(I=>I.name).join(", ");t.log.info(`Detected client(s): ${t.pc.bold(g)}`)}else if((0,f.isInteractive)()){const g=[...c.REGISTERED_CLIENTS.map(b=>b.name),"all"],I=g.map(b=>({label:b,hint:b==="all"?"every registered client":void 0}));t.log.warn(`No client detected in ${t.pc.dim(r)}.`);const L=await(0,f.promptSelect)("Which client(s) to install for?",I,0);s=(0,c.resolveTargetClients)(r,g[L])}else t.log.warn(`No client detected. Defaulting to: ${c.REGISTERED_CLIENTS[0].name}`),s=[c.REGISTERED_CLIENTS[0]]}const d=await _(r,a),h=await O(r,o,d);t.log.blank(),(0,M.prepareIronBeeDir)(r),k(r,d),E(r,h);for(const n of s)n.install(r);(0,j.upsertProject)(r),t.log.blank(),t.log.label("project",t.pc.dim(r)),t.log.blank(),t.log.success(`IronBee installed. ${t.pc.dim("Restart your AI coding client to activate the hooks.")}`),await(0,w.trackInstall)(s.map(n=>n.name),r)});0&&(module.exports={CYCLE_HINTS,installCommand,runInstallAll,syncSchemaIfChanged});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var t=(o,e)=>f(o,"name",{value:e,configurable:!0});var v=(o,e)=>{for(var n in e)f(o,n,{get:e[n],enumerable:!0})},M=(o,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!V.call(o,i)&&i!==n&&f(o,i,{get:()=>e[i],enumerable:!(a=m(e,i))||a.enumerable});return o};var w=o=>M(f({},"__esModule",{value:!0}),o);var E={};v(E,{ALL_MODES:()=>g,MODE_HINTS:()=>C,MODE_LABELS:()=>L,applyModeToLayer:()=>O,buildVerificationBlockForMode:()=>y,parseModeFlag:()=>S,resolveInstallDefaultMode:()=>x});module.exports=w(E);var r=require("fs"),u=require("path"),c=require("../lib/config"),d=require("../lib/logger");const g=["enforce","assist","monitor"],L={enforce:"auto verify (enforce)",assist:"assist",monitor:"monitor only"},C={enforce:"block task completion until changes are verified \u2014 full enforcement
|
|
2
|
-
`)}t(B,"writeLayerConfig");function l(o){const e=o.verification;if(e&&typeof e=="object"&&!Array.isArray(e))return e}t(l,"readVerificationBlock");function x(o){let e,n;for(const a of["project","local"]){const i=l(s((0,c.getTargetConfigPath)(a,o)));i!==void 0&&(typeof i.enable=="boolean"&&(e=i.enable),typeof i.auto=="boolean"&&(n=i.auto))}return e===!1?"monitor":n===!
|
|
1
|
+
"use strict";var f=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var t=(o,e)=>f(o,"name",{value:e,configurable:!0});var v=(o,e)=>{for(var n in e)f(o,n,{get:e[n],enumerable:!0})},M=(o,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!V.call(o,i)&&i!==n&&f(o,i,{get:()=>e[i],enumerable:!(a=m(e,i))||a.enumerable});return o};var w=o=>M(f({},"__esModule",{value:!0}),o);var E={};v(E,{ALL_MODES:()=>g,MODE_HINTS:()=>C,MODE_LABELS:()=>L,applyModeToLayer:()=>O,buildVerificationBlockForMode:()=>y,parseModeFlag:()=>S,resolveInstallDefaultMode:()=>x});module.exports=w(E);var r=require("fs"),u=require("path"),c=require("../lib/config"),d=require("../lib/logger");const g=["enforce","assist","monitor"],L={enforce:"auto verify (enforce)",assist:"assist",monitor:"monitor only"},C={enforce:"block task completion until changes are verified \u2014 full enforcement",assist:"tools installed but not enforced \u2014 the agent verifies manually via /ironbee-verify (default)",monitor:"no enforcement \u2014 only track sessions / activity / tools for analytics"};function S(o){const e=o.trim().toLowerCase();if(e==="enforce"||e==="assist"||e==="monitor")return e;throw new Error(`Unknown mode '${o}'. Available: ${g.join(", ")}.`)}t(S,"parseModeFlag");function s(o){if(!(0,r.existsSync)(o))return{};try{return JSON.parse((0,r.readFileSync)(o,"utf-8"))}catch(e){throw d.logger.debug(`failed to read ${o}: ${e}`),new Error(`Config at ${o} is not valid JSON: ${e instanceof Error?e.message:e}`)}}t(s,"readLayerConfig");function B(o,e){(0,r.mkdirSync)((0,u.join)(o,".."),{recursive:!0}),(0,r.writeFileSync)(o,JSON.stringify(e,null,2)+`
|
|
2
|
+
`)}t(B,"writeLayerConfig");function l(o){const e=o.verification;if(e&&typeof e=="object"&&!Array.isArray(e))return e}t(l,"readVerificationBlock");function x(o){let e,n;for(const a of["project","local"]){const i=l(s((0,c.getTargetConfigPath)(a,o)));i!==void 0&&(typeof i.enable=="boolean"&&(e=i.enable),typeof i.auto=="boolean"&&(n=i.auto))}return e===!1?"monitor":n===!0?"enforce":"assist"}t(x,"resolveInstallDefaultMode");function y(o,e){const n={...o??{}};switch(e){case"enforce":n.enable=!0,n.auto=!0,n.strict=n.strict??!1;break;case"assist":n.enable=!0,n.auto=!1,n.strict=n.strict??!1;break;case"monitor":n.enable=!1,delete n.auto,delete n.strict;break}return n}t(y,"buildVerificationBlockForMode");function O(o,e,n){const a=(0,c.getTargetConfigPath)(e,o),i=s(a),b=JSON.stringify(i.verification??null);i.verification=y(l(i),n);const k=JSON.stringify(i.verification);return b===k?!1:(B(a,i),!0)}t(O,"applyModeToLayer");0&&(module.exports={ALL_MODES,MODE_HINTS,MODE_LABELS,applyModeToLayer,buildVerificationBlockForMode,parseModeFlag,resolveInstallDefaultMode});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";var k=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var c=(o,n)=>k(o,"name",{value:n,configurable:!0});var S=(o,n)=>{for(var i in n)k(o,i,{get:n[i],enumerable:!0})},W=(o,n,i,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of M(n))!O.call(o,t)&&t!==i&&k(o,t,{get:()=>n[t],enumerable:!(l=F(n,t))||l.enumerable});return o};var _=o=>W(k({},"__esModule",{value:!0}),o);var Y={};S(Y,{applyAutoVerifyToggle:()=>J,applyStrictVerifyToggle:()=>U,applyVerificationToggle:()=>G});module.exports=_(Y);var v=require("fs"),P=require("path"),B=require("../clients/registry"),r=require("../lib/config"),E=require("../lib/gitignore"),x=require("../lib/logger"),e=require("../lib/output");function p(o){if(!(0,v.existsSync)(o))return{};try{return JSON.parse((0,v.readFileSync)(o,"utf-8"))}catch(n){throw x.logger.debug(`failed to read ${o}: ${n}`),new Error(`Config at ${o} is not valid JSON: ${n instanceof Error?n.message:n}`)}}c(p,"readConfigFile");function N(o,n){(0,v.mkdirSync)((0,P.join)(o,".."),{recursive:!0}),(0,v.writeFileSync)(o,JSON.stringify(n,null,2)+`
|
|
2
|
-
`)}c(N,"writeConfigFile");function V(o,n){const i={global:void 0,project:void 0,local:void 0};for(const l of r.CONFIG_TARGETS_BY_PRECEDENCE){const t=(0,r.getTargetConfigPath)(l,o);if(!(0,v.existsSync)(t))continue;const C=p(t).verification?.[n];typeof C=="boolean"&&(i[l]=C)}return i}c(V,"readVerificationFieldByLayer");function L(o,n){const i=r.CONFIG_TARGETS_BY_PRECEDENCE,l=i.indexOf(o);for(let t=i.length-1;t>l;t--){const a=i[t];if(n[a]!==void 0)return a}return null}c(L,"detectOverridingLayer");function G(o,n,i,l){const t=(0,r.getTargetConfigPath)(i,n),a=p(t),d=(typeof a.verification?.enable=="boolean"?a.verification.enable:void 0)!==!1,m=(0,r.loadConfig)(n),g=(0,r.getVerificationEnabled)(m),R=o?"enabled":"disabled";if(d===o&&g===o){console.log(`${e.pc.dim("\xB7")} Verification already ${R} in ${i} config (${e.pc.dim(t)}). No-op.`);return}if(d===o&&g!==o){const h=V(n,"enable"),b=L(i,h),y=g?"enabled":"disabled";console.log(`${e.pc.yellow("\u26A0")} ${i} config already has verification.enable: ${o}, but the ${e.pc.bold(b??"another")} layer overrides it \u2014 effective state is ${e.pc.bold(y)}.`),b!==null&&console.log(` ${e.pc.dim("Run")} ${e.pc.cyan(`ironbee config unset verification.enable --${b}`)} ${e.pc.dim("to drop the override, or run this command with")} ${e.pc.cyan(`--${b}`)} ${e.pc.dim("to flip the layer that's actually winning.")}`);return}const w=(0,r.loadConfig)(n);w.verification={enable:o};const f=(0,B.resolveTargetClients)(n,l);l===void 0&&f.length===1&&!f[0].detect(n)&&console.log(`${e.pc.yellow("\u26A0")} No clients detected in ${e.pc.dim(n)} \u2014 applying to ${e.pc.bold(f[0].name)} as fallback.`);for(const h of f)h.install(n,w);i!=="global"&&(0,E.ensureIronBeeGitignored)(n);const u={...a,verification:{enable:o}};N(t,u);const s=o?"Enabled":"Disabled",T=o?"Full enforcement set installed (skill, rule, /ironbee-verify, MCP servers, all hooks).":"Monitoring-only mode \u2014 only session/activity/tool_call hooks are installed.";console.log(`${e.pc.green("\u2713")} ${s} verification in ${i} config (${e.pc.dim(t)}).`),console.log(` ${e.pc.dim(T)}`),console.log(` ${e.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)}c(G,"applyVerificationToggle");function J(o,n,i,l){const t=(0,r.getTargetConfigPath)(i,n),a=p(t),d=(typeof a.verification?.auto=="boolean"?a.verification.auto:void 0)
|
|
2
|
+
`)}c(N,"writeConfigFile");function V(o,n){const i={global:void 0,project:void 0,local:void 0};for(const l of r.CONFIG_TARGETS_BY_PRECEDENCE){const t=(0,r.getTargetConfigPath)(l,o);if(!(0,v.existsSync)(t))continue;const C=p(t).verification?.[n];typeof C=="boolean"&&(i[l]=C)}return i}c(V,"readVerificationFieldByLayer");function L(o,n){const i=r.CONFIG_TARGETS_BY_PRECEDENCE,l=i.indexOf(o);for(let t=i.length-1;t>l;t--){const a=i[t];if(n[a]!==void 0)return a}return null}c(L,"detectOverridingLayer");function G(o,n,i,l){const t=(0,r.getTargetConfigPath)(i,n),a=p(t),d=(typeof a.verification?.enable=="boolean"?a.verification.enable:void 0)!==!1,m=(0,r.loadConfig)(n),g=(0,r.getVerificationEnabled)(m),R=o?"enabled":"disabled";if(d===o&&g===o){console.log(`${e.pc.dim("\xB7")} Verification already ${R} in ${i} config (${e.pc.dim(t)}). No-op.`);return}if(d===o&&g!==o){const h=V(n,"enable"),b=L(i,h),y=g?"enabled":"disabled";console.log(`${e.pc.yellow("\u26A0")} ${i} config already has verification.enable: ${o}, but the ${e.pc.bold(b??"another")} layer overrides it \u2014 effective state is ${e.pc.bold(y)}.`),b!==null&&console.log(` ${e.pc.dim("Run")} ${e.pc.cyan(`ironbee config unset verification.enable --${b}`)} ${e.pc.dim("to drop the override, or run this command with")} ${e.pc.cyan(`--${b}`)} ${e.pc.dim("to flip the layer that's actually winning.")}`);return}const w=(0,r.loadConfig)(n);w.verification={enable:o};const f=(0,B.resolveTargetClients)(n,l);l===void 0&&f.length===1&&!f[0].detect(n)&&console.log(`${e.pc.yellow("\u26A0")} No clients detected in ${e.pc.dim(n)} \u2014 applying to ${e.pc.bold(f[0].name)} as fallback.`);for(const h of f)h.install(n,w);i!=="global"&&(0,E.ensureIronBeeGitignored)(n);const u={...a,verification:{enable:o}};N(t,u);const s=o?"Enabled":"Disabled",T=o?"Full enforcement set installed (skill, rule, /ironbee-verify, MCP servers, all hooks).":"Monitoring-only mode \u2014 only session/activity/tool_call hooks are installed.";console.log(`${e.pc.green("\u2713")} ${s} verification in ${i} config (${e.pc.dim(t)}).`),console.log(` ${e.pc.dim(T)}`),console.log(` ${e.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)}c(G,"applyVerificationToggle");function J(o,n,i,l){const t=(0,r.getTargetConfigPath)(i,n),a=p(t),d=(typeof a.verification?.auto=="boolean"?a.verification.auto:void 0)===!0,m=(0,r.loadConfig)(n),g=(0,r.getAutoVerifyEnabled)(m),R=(0,r.getVerificationEnabled)(m),w=o?"enabled":"disabled",f=c(()=>{R||console.log(` ${e.pc.yellow("\u26A0")} verification.enable is false (monitoring-only) \u2014 auto-verify has no effect until you run ${e.pc.cyan("ironbee verification enable")}.`)},"inertNote");if(d===o&&g===o){console.log(`${e.pc.dim("\xB7")} Auto-verify already ${w} in ${i} config (${e.pc.dim(t)}). No-op.`),f();return}if(d===o&&g!==o){const y=V(n,"auto"),$=L(i,y),I=g?"enabled":"disabled";console.log(`${e.pc.yellow("\u26A0")} ${i} config already has verification.auto: ${o}, but the ${e.pc.bold($??"another")} layer overrides it \u2014 effective auto-verify is ${e.pc.bold(I)}.`),$!==null&&console.log(` ${e.pc.dim("Run")} ${e.pc.cyan(`ironbee config unset verification.auto --${$}`)} ${e.pc.dim("to drop the override, or run this command with")} ${e.pc.cyan(`--${$}`)} ${e.pc.dim("to flip the layer that's actually winning.")}`);return}const u=(0,r.loadConfig)(n);u.verification={...u.verification,auto:o};const s=(0,B.resolveTargetClients)(n,l);l===void 0&&s.length===1&&!s[0].detect(n)&&console.log(`${e.pc.yellow("\u26A0")} No clients detected in ${e.pc.dim(n)} \u2014 applying to ${e.pc.bold(s[0].name)} as fallback.`);for(const y of s)y.install(n,u);i!=="global"&&(0,E.ensureIronBeeGitignored)(n);const T={...a,verification:{...a.verification,auto:o}};N(t,T);const h=o?"Enabled":"Disabled",b=o?"Enforce mode \u2014 blocking verify-gate + skill/rule/command + MCP servers installed.":"Assist mode \u2014 /ironbee-verify command + MCP servers installed; PreToolUse hooks run non-blocking, Stop never gates, skill/rule omitted.";console.log(`${e.pc.green("\u2713")} ${h} auto-verify in ${i} config (${e.pc.dim(t)}).`),console.log(` ${e.pc.dim(b)}`),f(),console.log(` ${e.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)}c(J,"applyAutoVerifyToggle");function U(o,n,i,l){const t=(0,r.getTargetConfigPath)(i,n),a=p(t),C=a.verification?.strict===!0,d=(0,r.loadConfig)(n),m=(0,r.getVerificationStrict)(d),g=(0,r.getVerificationEnabled)(d),R=(0,r.getAutoVerifyEnabled)(d),w=o?"enabled":"disabled",f=c(()=>{g?R||console.log(` ${e.pc.yellow("\u26A0")} verification.auto is false (assist mode) \u2014 the Stop gate never runs, so strict has no effect until you run ${e.pc.cyan("ironbee verification auto enable")}.`):console.log(` ${e.pc.yellow("\u26A0")} verification.enable is false (monitoring-only) \u2014 strict has no effect until you run ${e.pc.cyan("ironbee verification enable")}.`)},"inertNote");if(C===o&&m===o){console.log(`${e.pc.dim("\xB7")} Strict mode already ${w} in ${i} config (${e.pc.dim(t)}). No-op.`),f();return}if(C===o&&m!==o){const y=V(n,"strict"),$=L(i,y),I=m?"enabled":"disabled";console.log(`${e.pc.yellow("\u26A0")} ${i} config already has verification.strict: ${o}, but the ${e.pc.bold($??"another")} layer overrides it \u2014 effective strict is ${e.pc.bold(I)}.`),$!==null&&console.log(` ${e.pc.dim("Run")} ${e.pc.cyan(`ironbee config unset verification.strict --${$}`)} ${e.pc.dim("to drop the override, or run this command with")} ${e.pc.cyan(`--${$}`)} ${e.pc.dim("to flip the layer that's actually winning.")}`);return}const u=(0,r.loadConfig)(n);u.verification={...u.verification,strict:o};const s=(0,B.resolveTargetClients)(n,l);l===void 0&&s.length===1&&!s[0].detect(n)&&console.log(`${e.pc.yellow("\u26A0")} No clients detected in ${e.pc.dim(n)} \u2014 applying to ${e.pc.bold(s[0].name)} as fallback.`);for(const y of s)y.install(n,u);i!=="global"&&(0,E.ensureIronBeeGitignored)(n);const T={...a,verification:{...a.verification,strict:o}};N(t,T);const h=o?"Enabled":"Disabled",b=o?"Strict mode \u2014 the verify-gate refuses N/A verdicts (global + per-platform); every active cycle must produce real tool evidence.":"N/A accepted \u2014 the agent may declare a change (or a specific cycle) has no runtime surface; the gate allows it, recorded + observable.";console.log(`${e.pc.green("\u2713")} ${h} strict mode in ${i} config (${e.pc.dim(t)}).`),console.log(` ${e.pc.dim(b)}`),f(),console.log(` ${e.pc.yellow("\u26A0")} Restart your editor / agent session for the change to take effect.`)}c(U,"applyStrictVerifyToggle");0&&(module.exports={applyAutoVerifyToggle,applyStrictVerifyToggle,applyVerificationToggle});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var l=(t,i)=>c(t,"name",{value:i,configurable:!0});var v=(t,i)=>{for(var r in i)c(t,r,{get:i[r],enumerable:!0})},A=(t,i,r,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of y(i))!I.call(t,n)&&n!==r&&c(t,n,{get:()=>i[n],enumerable:!(o=m(i,n))||o.enumerable});return t};var b=t=>A(c({},"__esModule",{value:!0}),t);var x={};v(x,{runActivityEnd:()=>P});module.exports=b(x);var u=require("./activity"),s=require("./activity-participants"),e=require("./session-state"),a=require("../../queue"),d=require("../../lib/logger");async function P(t){const{sessionDir:i,actionsFile:r,projectDir:o,sessionId:n}=t;if((0,e.isActive)(i)){const p=(0,s.anyNonMainParticipants)(i),g=(0,e.getLastVerdictStatus)(i)==="fail"&&(0,e.getVerifyIntent)(i)==="fix";if(p||g)return d.logger.debug(`assist activity-grouping defer (verifierRunning=${p} fixOwed=${g}) \u2014 keeping activity open, heartbeating main participant`),(0,s.enterActivity)(i,s.MAIN_PARTICIPANT_ID),(0,a.flushInBackground)(o,n),(0,a.flushStragglersInBackground)(o,n),!1}const f=await(0,u.closeActivityIfLastParticipant)({sessionDir:i,actionsFile:r},s.MAIN_PARTICIPANT_ID,()=>(0,e.closeOpenCycles)(i,r,"stop"));return f&&(0,e.clearVerifyIntent)(i),(0,a.flushInBackground)(o,n),(0,a.flushStragglersInBackground)(o,n),f}l(P,"runActivityEnd");0&&(module.exports={runActivityEnd});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var a=(i,e)=>v(i,"name",{value:e,configurable:!0});var _=(i,e)=>{for(var n in e)v(i,n,{get:e[n],enumerable:!0})},V=(i,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!h.call(i,r)&&r!==n&&v(i,r,{get:()=>e[r],enumerable:!(t=A(e,r))||t.enumerable});return i};var b=i=>V(v({},"__esModule",{value:!0}),i);var yt={};_(yt,{addPendingFixes:()=>rt,clearActiveActivity:()=>ft,clearActiveFix:()=>C,clearActiveVerification:()=>F,clearPendingFixes:()=>at,clearVerifyIntent:()=>ot,closeOpenCycles:()=>lt,generateTraceId:()=>T,getActiveActivityId:()=>H,getActiveFixId:()=>k,getActiveTraceId:()=>E,getActiveVerificationId:()=>w,getChainedStatusLine:()=>D,getContextInjectedVerificationId:()=>et,getLastVerdictStatus:()=>q,getPendingFixes:()=>nt,getPhase:()=>N,getRetries:()=>R,getUsagePlan:()=>Y,getUsageType:()=>X,getUserEmail:()=>K,getVerifyIntent:()=>ct,incrementRetries:()=>$,isActive:()=>W,isFailLikeVerdictStatus:()=>dt,isRecordingActive:()=>B,isRecordingRequired:()=>O,readState:()=>c,reconcileAbandonedActivity:()=>vt,reconcileForCompact:()=>pt,reconcileSessionState:()=>gt,resetRetries:()=>L,setActive:()=>G,setActiveActivity:()=>ut,setActiveFix:()=>U,setActiveVerification:()=>P,setChainedStatusLine:()=>tt,setContextInjectedVerificationId:()=>it,setLastVerdictStatus:()=>j,setPhase:()=>z,setRecordingActive:()=>M,setRecordingRequired:()=>J,setUsage:()=>Z,setUserEmail:()=>Q,setVerifyIntent:()=>st,writeState:()=>u});module.exports=b(yt);var x=require("crypto"),l=require("fs"),y=require("path"),f=require("../../lib/logger"),g=require("./activity-participants"),p=require("../../lib/atomic"),d=require("./actions");const I="state.json",S={retries:0,activeVerificationId:null,activeTraceId:null,lastVerdictStatus:null,activeFixId:null,activeActivityId:null,phase:null,recordingRequired:!1,recordingActive:!1,active:!1,userEmail:null,usageType:null,usagePlan:null,chainedStatusLine:null,contextInjectedVerificationId:null,pendingFixes:[],verifyIntent:null};function T(){return(0,x.randomBytes)(16).toString("hex")}a(T,"generateTraceId");function c(i){const e=(0,y.join)(i,I);if(!(0,l.existsSync)(e))return{...S};try{const n=(0,l.readFileSync)(e,"utf-8"),t=JSON.parse(n),r=["coding","verifying","fixing"],s=["api","subscription"];return{retries:typeof t.retries=="number"?t.retries:0,activeVerificationId:typeof t.activeVerificationId=="string"?t.activeVerificationId:null,activeTraceId:typeof t.activeTraceId=="string"?t.activeTraceId:null,lastVerdictStatus:typeof t.lastVerdictStatus=="string"?t.lastVerdictStatus:null,activeFixId:typeof t.activeFixId=="string"?t.activeFixId:null,activeActivityId:typeof t.activeActivityId=="string"?t.activeActivityId:null,phase:typeof t.phase=="string"&&r.includes(t.phase)?t.phase:null,recordingRequired:typeof t.recordingRequired=="boolean"?t.recordingRequired:!1,recordingActive:typeof t.recordingActive=="boolean"?t.recordingActive:!1,active:typeof t.active=="boolean"?t.active:!1,userEmail:typeof t.userEmail=="string"?t.userEmail:null,usageType:typeof t.usageType=="string"&&s.includes(t.usageType)?t.usageType:null,usagePlan:typeof t.usagePlan=="string"&&t.usagePlan.length>0?t.usagePlan:null,chainedStatusLine:typeof t.chainedStatusLine=="string"&&t.chainedStatusLine.length>0?t.chainedStatusLine:null,contextInjectedVerificationId:typeof t.contextInjectedVerificationId=="string"?t.contextInjectedVerificationId:null,pendingFixes:Array.isArray(t.pendingFixes)?t.pendingFixes.filter(o=>typeof o=="string"&&o.length>0):[],verifyIntent:typeof t.verifyIntent=="string"&&t.verifyIntent.length>0?t.verifyIntent:null}}catch(n){return f.logger.debug(`failed to read state from ${e}: ${n}`),{...S}}}a(c,"readState");function u(i,e){const n=(0,y.join)(i,I);try{(0,l.mkdirSync)(i,{recursive:!0});const t=`${n}.tmp.${process.pid}.${Date.now()}`,r=JSON.stringify(e,null,2);try{(0,l.writeFileSync)(t,r),(0,p.renameWithRetry)(t,n)}catch(s){try{(0,l.existsSync)(t)&&(0,l.unlinkSync)(t)}catch{}throw s}(0,p.sweepStaleTmpFiles)(n)}catch(t){f.logger.debug(`failed to write state to ${n}: ${t}`)}}a(u,"writeState");function w(i){return c(i).activeVerificationId??void 0}a(w,"getActiveVerificationId");function P(i,e,n){const t=c(i);t.activeVerificationId=e,t.activeTraceId=n,t.phase="verifying",u(i,t)}a(P,"setActiveVerification");function E(i){return c(i).activeTraceId??void 0}a(E,"getActiveTraceId");function F(i){const e=c(i);e.activeVerificationId=null,e.activeTraceId=null,e.phase="coding",u(i,e)}a(F,"clearActiveVerification");function R(i){return c(i).retries}a(R,"getRetries");function $(i){const e=c(i);return e.retries=e.retries+1,u(i,e),e.retries}a($,"incrementRetries");function L(i){const e=c(i);e.retries=0,u(i,e)}a(L,"resetRetries");function q(i){return c(i).lastVerdictStatus??void 0}a(q,"getLastVerdictStatus");function j(i,e){const n=c(i);n.lastVerdictStatus=e,u(i,n)}a(j,"setLastVerdictStatus");function U(i,e){const n=c(i);n.activeFixId=e,u(i,n)}a(U,"setActiveFix");function k(i){return c(i).activeFixId??void 0}a(k,"getActiveFixId");function C(i){const e=c(i);e.activeFixId=null,u(i,e)}a(C,"clearActiveFix");function z(i,e){const n=c(i);n.phase=e,u(i,n)}a(z,"setPhase");function N(i){return c(i).phase}a(N,"getPhase");function O(i){return c(i).recordingRequired}a(O,"isRecordingRequired");function J(i,e){const n=c(i);n.recordingRequired=e,u(i,n)}a(J,"setRecordingRequired");function B(i){return c(i).recordingActive}a(B,"isRecordingActive");function M(i,e){const n=c(i);n.recordingActive=e,u(i,n)}a(M,"setRecordingActive");function W(i){return c(i).active}a(W,"isActive");function G(i,e){const n=c(i);n.active=e,e||(n.activeActivityId=null),u(i,n)}a(G,"setActive");function H(i){return c(i).activeActivityId??void 0}a(H,"getActiveActivityId");function K(i){return c(i).userEmail??void 0}a(K,"getUserEmail");function Q(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.userEmail!==n&&(t.userEmail=n,u(i,t))}a(Q,"setUserEmail");function X(i){return c(i).usageType??void 0}a(X,"getUsageType");function Y(i){return c(i).usagePlan??void 0}a(Y,"getUsagePlan");function Z(i,e){const n=e.usage_type==="api"||e.usage_type==="subscription"?e.usage_type:null,t=typeof e.usage_plan=="string"&&e.usage_plan.length>0?e.usage_plan:null,r=c(i);r.usageType===n&&r.usagePlan===t||(r.usageType=n,r.usagePlan=t,u(i,r))}a(Z,"setUsage");function D(i){return c(i).chainedStatusLine??void 0}a(D,"getChainedStatusLine");function tt(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.chainedStatusLine!==n&&(t.chainedStatusLine=n,u(i,t))}a(tt,"setChainedStatusLine");function et(i){return c(i).contextInjectedVerificationId??void 0}a(et,"getContextInjectedVerificationId");function it(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.contextInjectedVerificationId!==n&&(t.contextInjectedVerificationId=n,u(i,t))}a(it,"setContextInjectedVerificationId");function nt(i){return c(i).pendingFixes}a(nt,"getPendingFixes");function rt(i,e){const n=e.filter(o=>typeof o=="string"&&o.length>0);if(n.length===0)return;const t=c(i),r=new Set(t.pendingFixes),s=[...t.pendingFixes];for(const o of n)r.has(o)||(r.add(o),s.push(o));s.length!==t.pendingFixes.length&&(t.pendingFixes=s,u(i,t))}a(rt,"addPendingFixes");function at(i){const e=c(i);e.pendingFixes.length!==0&&(e.pendingFixes=[],u(i,e))}a(at,"clearPendingFixes");function ct(i){return c(i).verifyIntent}a(ct,"getVerifyIntent");function st(i,e){const n=c(i);n.verifyIntent!==e&&(n.verifyIntent=e,u(i,n))}a(st,"setVerifyIntent");function ot(i){const e=c(i);e.verifyIntent!==null&&(e.verifyIntent=null,u(i,e))}a(ot,"clearVerifyIntent");function dt(i){return i==="fail"||i==="fail_reported"}a(dt,"isFailLikeVerdictStatus");function ut(i,e){const n=c(i);n.activeActivityId=e,n.active=!0,u(i,n)}a(ut,"setActiveActivity");function ft(i){const e=c(i);e.activeActivityId=null,e.active=!1,u(i,e)}a(ft,"clearActiveActivity");async function lt(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:n};await(0,d.appendAction)(e,o),f.logger.debug(`close-open-cycles: ended verification ${t.activeVerificationId} (${n})`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:n};await(0,d.appendAction)(e,o),f.logger.debug(`close-open-cycles: ended fix ${t.activeFixId} (${n})`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(lt,"closeOpenCycles");async function gt(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"session_reconcile"};await n(e,o),f.logger.debug(`reconcile: ended abandoned verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"session_reconcile"};await n(e,o),f.logger.debug(`reconcile: ended abandoned fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"session_reconcile"};await n(e,o),f.logger.debug(`reconcile: ended abandoned activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(gt,"reconcileSessionState");async function vt(i,e,n){const t=c(i);if(!t.active&&!t.activeVerificationId&&!t.activeFixId&&t.verifyIntent===null||!(0,g.isParticipantPresent)(i,g.MAIN_PARTICIPANT_ID)&&(0,g.anyActiveParticipants)(i))return;let r=!1;const s=(0,d.findLastActionTimestamp)(e)??Date.now();if(t.activeVerificationId){const o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"interrupt_inferred"};await n(e,o),f.logger.debug(`interrupt-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"interrupt_inferred"};await n(e,o),f.logger.debug(`interrupt-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"interrupt_inferred"};await n(e,o),f.logger.debug(`interrupt-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(vt,"reconcileAbandonedActivity");async function pt(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"compact"};await n(e,o),f.logger.debug(`compact-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"compact"};await n(e,o),f.logger.debug(`compact-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"compact"};await n(e,o),f.logger.debug(`compact-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(pt,"reconcileForCompact");0&&(module.exports={addPendingFixes,clearActiveActivity,clearActiveFix,clearActiveVerification,clearPendingFixes,clearVerifyIntent,closeOpenCycles,generateTraceId,getActiveActivityId,getActiveFixId,getActiveTraceId,getActiveVerificationId,getChainedStatusLine,getContextInjectedVerificationId,getLastVerdictStatus,getPendingFixes,getPhase,getRetries,getUsagePlan,getUsageType,getUserEmail,getVerifyIntent,incrementRetries,isActive,isFailLikeVerdictStatus,isRecordingActive,isRecordingRequired,readState,reconcileAbandonedActivity,reconcileForCompact,reconcileSessionState,resetRetries,setActive,setActiveActivity,setActiveFix,setActiveVerification,setChainedStatusLine,setContextInjectedVerificationId,setLastVerdictStatus,setPhase,setRecordingActive,setRecordingRequired,setUsage,setUserEmail,setVerifyIntent,writeState});
|
|
1
|
+
"use strict";var v=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var a=(i,e)=>v(i,"name",{value:e,configurable:!0});var h=(i,e)=>{for(var n in e)v(i,n,{get:e[n],enumerable:!0})},_=(i,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!V.call(i,r)&&r!==n&&v(i,r,{get:()=>e[r],enumerable:!(t=A(e,r))||t.enumerable});return i};var b=i=>_(v({},"__esModule",{value:!0}),i);var St={};h(St,{addPendingFixes:()=>ct,clearActiveActivity:()=>gt,clearActiveFix:()=>z,clearActiveVerification:()=>F,clearPendingFixes:()=>st,clearVerifyIntent:()=>ut,closeOpenCycles:()=>vt,generateTraceId:()=>T,getActiveActivityId:()=>Q,getActiveFixId:()=>C,getActiveTraceId:()=>E,getActiveVerificationId:()=>w,getChainedStatusLine:()=>et,getContextInjectedVerificationId:()=>nt,getLastVerdictHadIssues:()=>U,getLastVerdictStatus:()=>q,getPendingFixes:()=>at,getPhase:()=>O,getRetries:()=>R,getUsagePlan:()=>D,getUsageType:()=>Z,getUserEmail:()=>X,getVerifyIntent:()=>ot,incrementRetries:()=>L,isActive:()=>G,isFailLikeVerdictStatus:()=>lt,isRecordingActive:()=>M,isRecordingRequired:()=>J,readState:()=>c,reconcileAbandonedActivity:()=>yt,reconcileForCompact:()=>It,reconcileSessionState:()=>pt,resetRetries:()=>$,setActive:()=>K,setActiveActivity:()=>ft,setActiveFix:()=>k,setActiveVerification:()=>P,setChainedStatusLine:()=>it,setContextInjectedVerificationId:()=>rt,setLastVerdictHadIssues:()=>H,setLastVerdictStatus:()=>j,setPhase:()=>N,setRecordingActive:()=>W,setRecordingRequired:()=>B,setUsage:()=>tt,setUserEmail:()=>Y,setVerifyIntent:()=>dt,writeState:()=>u});module.exports=b(St);var x=require("crypto"),f=require("fs"),y=require("path"),l=require("../../lib/logger"),g=require("./activity-participants"),p=require("../../lib/atomic"),d=require("./actions");const I="state.json",S={retries:0,activeVerificationId:null,activeTraceId:null,lastVerdictStatus:null,lastVerdictHadIssues:!1,activeFixId:null,activeActivityId:null,phase:null,recordingRequired:!1,recordingActive:!1,active:!1,userEmail:null,usageType:null,usagePlan:null,chainedStatusLine:null,contextInjectedVerificationId:null,pendingFixes:[],verifyIntent:null};function T(){return(0,x.randomBytes)(16).toString("hex")}a(T,"generateTraceId");function c(i){const e=(0,y.join)(i,I);if(!(0,f.existsSync)(e))return{...S};try{const n=(0,f.readFileSync)(e,"utf-8"),t=JSON.parse(n),r=["coding","verifying","fixing"],s=["api","subscription"];return{retries:typeof t.retries=="number"?t.retries:0,activeVerificationId:typeof t.activeVerificationId=="string"?t.activeVerificationId:null,activeTraceId:typeof t.activeTraceId=="string"?t.activeTraceId:null,lastVerdictStatus:typeof t.lastVerdictStatus=="string"?t.lastVerdictStatus:null,lastVerdictHadIssues:typeof t.lastVerdictHadIssues=="boolean"?t.lastVerdictHadIssues:!1,activeFixId:typeof t.activeFixId=="string"?t.activeFixId:null,activeActivityId:typeof t.activeActivityId=="string"?t.activeActivityId:null,phase:typeof t.phase=="string"&&r.includes(t.phase)?t.phase:null,recordingRequired:typeof t.recordingRequired=="boolean"?t.recordingRequired:!1,recordingActive:typeof t.recordingActive=="boolean"?t.recordingActive:!1,active:typeof t.active=="boolean"?t.active:!1,userEmail:typeof t.userEmail=="string"?t.userEmail:null,usageType:typeof t.usageType=="string"&&s.includes(t.usageType)?t.usageType:null,usagePlan:typeof t.usagePlan=="string"&&t.usagePlan.length>0?t.usagePlan:null,chainedStatusLine:typeof t.chainedStatusLine=="string"&&t.chainedStatusLine.length>0?t.chainedStatusLine:null,contextInjectedVerificationId:typeof t.contextInjectedVerificationId=="string"?t.contextInjectedVerificationId:null,pendingFixes:Array.isArray(t.pendingFixes)?t.pendingFixes.filter(o=>typeof o=="string"&&o.length>0):[],verifyIntent:typeof t.verifyIntent=="string"&&t.verifyIntent.length>0?t.verifyIntent:null}}catch(n){return l.logger.debug(`failed to read state from ${e}: ${n}`),{...S}}}a(c,"readState");function u(i,e){const n=(0,y.join)(i,I);try{(0,f.mkdirSync)(i,{recursive:!0});const t=`${n}.tmp.${process.pid}.${Date.now()}`,r=JSON.stringify(e,null,2);try{(0,f.writeFileSync)(t,r),(0,p.renameWithRetry)(t,n)}catch(s){try{(0,f.existsSync)(t)&&(0,f.unlinkSync)(t)}catch{}throw s}(0,p.sweepStaleTmpFiles)(n)}catch(t){l.logger.debug(`failed to write state to ${n}: ${t}`)}}a(u,"writeState");function w(i){return c(i).activeVerificationId??void 0}a(w,"getActiveVerificationId");function P(i,e,n){const t=c(i);t.activeVerificationId=e,t.activeTraceId=n,t.phase="verifying",u(i,t)}a(P,"setActiveVerification");function E(i){return c(i).activeTraceId??void 0}a(E,"getActiveTraceId");function F(i){const e=c(i);e.activeVerificationId=null,e.activeTraceId=null,e.phase="coding",u(i,e)}a(F,"clearActiveVerification");function R(i){return c(i).retries}a(R,"getRetries");function L(i){const e=c(i);return e.retries=e.retries+1,u(i,e),e.retries}a(L,"incrementRetries");function $(i){const e=c(i);e.retries=0,u(i,e)}a($,"resetRetries");function q(i){return c(i).lastVerdictStatus??void 0}a(q,"getLastVerdictStatus");function j(i,e){const n=c(i);n.lastVerdictStatus=e,u(i,n)}a(j,"setLastVerdictStatus");function U(i){return c(i).lastVerdictHadIssues===!0}a(U,"getLastVerdictHadIssues");function H(i,e){const n=c(i);n.lastVerdictHadIssues=e,u(i,n)}a(H,"setLastVerdictHadIssues");function k(i,e){const n=c(i);n.activeFixId=e,u(i,n)}a(k,"setActiveFix");function C(i){return c(i).activeFixId??void 0}a(C,"getActiveFixId");function z(i){const e=c(i);e.activeFixId=null,u(i,e)}a(z,"clearActiveFix");function N(i,e){const n=c(i);n.phase=e,u(i,n)}a(N,"setPhase");function O(i){return c(i).phase}a(O,"getPhase");function J(i){return c(i).recordingRequired}a(J,"isRecordingRequired");function B(i,e){const n=c(i);n.recordingRequired=e,u(i,n)}a(B,"setRecordingRequired");function M(i){return c(i).recordingActive}a(M,"isRecordingActive");function W(i,e){const n=c(i);n.recordingActive=e,u(i,n)}a(W,"setRecordingActive");function G(i){return c(i).active}a(G,"isActive");function K(i,e){const n=c(i);n.active=e,e||(n.activeActivityId=null),u(i,n)}a(K,"setActive");function Q(i){return c(i).activeActivityId??void 0}a(Q,"getActiveActivityId");function X(i){return c(i).userEmail??void 0}a(X,"getUserEmail");function Y(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.userEmail!==n&&(t.userEmail=n,u(i,t))}a(Y,"setUserEmail");function Z(i){return c(i).usageType??void 0}a(Z,"getUsageType");function D(i){return c(i).usagePlan??void 0}a(D,"getUsagePlan");function tt(i,e){const n=e.usage_type==="api"||e.usage_type==="subscription"?e.usage_type:null,t=typeof e.usage_plan=="string"&&e.usage_plan.length>0?e.usage_plan:null,r=c(i);r.usageType===n&&r.usagePlan===t||(r.usageType=n,r.usagePlan=t,u(i,r))}a(tt,"setUsage");function et(i){return c(i).chainedStatusLine??void 0}a(et,"getChainedStatusLine");function it(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.chainedStatusLine!==n&&(t.chainedStatusLine=n,u(i,t))}a(it,"setChainedStatusLine");function nt(i){return c(i).contextInjectedVerificationId??void 0}a(nt,"getContextInjectedVerificationId");function rt(i,e){const n=typeof e=="string"&&e.length>0?e:null,t=c(i);t.contextInjectedVerificationId!==n&&(t.contextInjectedVerificationId=n,u(i,t))}a(rt,"setContextInjectedVerificationId");function at(i){return c(i).pendingFixes}a(at,"getPendingFixes");function ct(i,e){const n=e.filter(o=>typeof o=="string"&&o.length>0);if(n.length===0)return;const t=c(i),r=new Set(t.pendingFixes),s=[...t.pendingFixes];for(const o of n)r.has(o)||(r.add(o),s.push(o));s.length!==t.pendingFixes.length&&(t.pendingFixes=s,u(i,t))}a(ct,"addPendingFixes");function st(i){const e=c(i);e.pendingFixes.length!==0&&(e.pendingFixes=[],u(i,e))}a(st,"clearPendingFixes");function ot(i){return c(i).verifyIntent}a(ot,"getVerifyIntent");function dt(i,e){const n=c(i);n.verifyIntent!==e&&(n.verifyIntent=e,u(i,n))}a(dt,"setVerifyIntent");function ut(i){const e=c(i);e.verifyIntent!==null&&(e.verifyIntent=null,u(i,e))}a(ut,"clearVerifyIntent");function lt(i){return i==="fail"||i==="fail_reported"}a(lt,"isFailLikeVerdictStatus");function ft(i,e){const n=c(i);n.activeActivityId=e,n.active=!0,u(i,n)}a(ft,"setActiveActivity");function gt(i){const e=c(i);e.activeActivityId=null,e.active=!1,u(i,e)}a(gt,"clearActiveActivity");async function vt(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:n};await(0,d.appendAction)(e,o),l.logger.debug(`close-open-cycles: ended verification ${t.activeVerificationId} (${n})`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:n};await(0,d.appendAction)(e,o),l.logger.debug(`close-open-cycles: ended fix ${t.activeFixId} (${n})`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(vt,"closeOpenCycles");async function pt(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"session_reconcile"};await n(e,o),l.logger.debug(`reconcile: ended abandoned verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"session_reconcile"};await n(e,o),l.logger.debug(`reconcile: ended abandoned fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"session_reconcile"};await n(e,o),l.logger.debug(`reconcile: ended abandoned activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(pt,"reconcileSessionState");async function yt(i,e,n){const t=c(i);if(!t.active&&!t.activeVerificationId&&!t.activeFixId&&t.verifyIntent===null||!(0,g.isParticipantPresent)(i,g.MAIN_PARTICIPANT_ID)&&(0,g.anyActiveParticipants)(i))return;let r=!1;const s=(0,d.findLastActionTimestamp)(e)??Date.now();if(t.activeVerificationId){const o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"interrupt_inferred"};await n(e,o),l.logger.debug(`interrupt-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"interrupt_inferred"};await n(e,o),l.logger.debug(`interrupt-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"interrupt_inferred"};await n(e,o),l.logger.debug(`interrupt-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(yt,"reconcileAbandonedActivity");async function It(i,e,n){const t=c(i);let r=!1;if(t.activeVerificationId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"verification_end",timestamp:s,verification_id:t.activeVerificationId,activity_id:t.activeActivityId,trace_id:t.activeTraceId,duration:(0,d.findDurationSinceLastAction)(e,"verification_start",s),reason:"compact"};await n(e,o),l.logger.debug(`compact-reconcile: ended verification ${t.activeVerificationId}`),t.activeVerificationId=null,t.activeTraceId=null,t.contextInjectedVerificationId=null,r=!0}if(t.activeFixId){const s=Date.now(),o={...(0,d.baseFields)(e),type:"fix_end",timestamp:s,fix_id:t.activeFixId,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"fix_start",s),reason:"compact"};await n(e,o),l.logger.debug(`compact-reconcile: ended fix ${t.activeFixId}`),t.activeFixId=null,t.pendingFixes.length>0&&(t.pendingFixes=[]),r=!0}if(t.active){const s=Date.now(),o={...(0,d.baseFields)(e),type:"activity_end",timestamp:s,activity_id:t.activeActivityId,duration:(0,d.findDurationSinceLastAction)(e,"activity_start",s),reason:"compact"};await n(e,o),l.logger.debug(`compact-reconcile: ended activity ${t.activeActivityId??""}`),t.active=!1,t.activeActivityId=null,(0,g.clearActivityParticipants)(i),r=!0}(t.recordingRequired||t.recordingActive)&&(t.recordingRequired=!1,t.recordingActive=!1,r=!0),t.phase!=="coding"&&(t.phase="coding",r=!0),t.verifyIntent!==null&&(t.verifyIntent=null,r=!0),r&&u(i,t)}a(It,"reconcileForCompact");0&&(module.exports={addPendingFixes,clearActiveActivity,clearActiveFix,clearActiveVerification,clearPendingFixes,clearVerifyIntent,closeOpenCycles,generateTraceId,getActiveActivityId,getActiveFixId,getActiveTraceId,getActiveVerificationId,getChainedStatusLine,getContextInjectedVerificationId,getLastVerdictHadIssues,getLastVerdictStatus,getPendingFixes,getPhase,getRetries,getUsagePlan,getUsageType,getUserEmail,getVerifyIntent,incrementRetries,isActive,isFailLikeVerdictStatus,isRecordingActive,isRecordingRequired,readState,reconcileAbandonedActivity,reconcileForCompact,reconcileSessionState,resetRetries,setActive,setActiveActivity,setActiveFix,setActiveVerification,setChainedStatusLine,setContextInjectedVerificationId,setLastVerdictHadIssues,setLastVerdictStatus,setPhase,setRecordingActive,setRecordingRequired,setUsage,setUserEmail,setVerifyIntent,writeState});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var _=(c,r)=>m(c,"name",{value:r,configurable:!0});var $=(c,r)=>{for(var i in r)m(c,i,{get:r[i],enumerable:!0})},S=(c,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of I(r))!F.call(c,n)&&n!==i&&m(c,n,{get:()=>r[n],enumerable:!(o=T(r,n))||o.enumerable});return c};var J=c=>S(m({},"__esModule",{value:!0}),c);var L={};$(L,{runSubmitVerdict:()=>N});module.exports=J(L);var y=require("fs"),w=require("path"),l=require("../../lib/logger"),u=require("../../lib/config"),x=require("../../lib/recording-tools"),V=require("../../lib/telemetry"),a=require("./actions"),e=require("./session-state");function k(c,r){const i=(0,e.getPendingFixes)(c);if(i.length>0)return i;const o=(0,a.summarizeFixFileChanges)((0,a.getFileChangesSinceLastFailVerdict)(r));return o.length>0?o:["re-verified after a prior failure (no tracked code changes in this fix cycle)"]}_(k,"deriveFixes");async function N(c){const{sessionId:r,sessionDir:i,verdictFile:o,actionsFile:n,verdictJson:C,projectDir:v}=c;let t;try{t=JSON.parse(C)}catch(s){return l.logger.debug(`submit-verdict: invalid JSON: ${s}`),{success:!1,message:"REJECTED: verdict is not valid JSON."}}if((0,e.getActiveVerificationId)(i)===void 0)return l.logger.debug("submit-verdict: no active verification cycle \u2014 rejecting spurious/duplicate submit"),{success:!1,message:"REJECTED: no active verification cycle. A verdict is recorded by the verification cycle that submitted it; this submit has none \u2014 the cycle already closed (the verdict was already recorded), or none was ever opened. If you are the MAIN agent relaying a delegated verifier's verdict, do NOT submit it yourself and do NOT open a new cycle \u2014 just report the verdict the verifier already recorded."};if(t.status!=="pass"&&t.status!=="fail"&&t.status!=="not_applicable")return{success:!1,message:`REJECTED: status must be "pass", "fail", or "not_applicable", got "${t.status}".`};const f=t.status==="not_applicable",g=Array.isArray(t.not_applicable_cycles)?t.not_applicable_cycles:[],b=g.length>0;if(f&&b)return{success:!1,message:'REJECTED: do not combine not_applicable_cycles with status "not_applicable" (global N/A already exempts every cycle). Use status "not_applicable" for the whole change, OR a pass/fail status with not_applicable_cycles for a subset.'};if(b){const s=g.filter(d=>!u.ALL_CYCLES.includes(d));if(s.length>0)return{success:!1,message:`REJECTED: unknown cycle name(s) in not_applicable_cycles: ${s.join(", ")}. Valid: ${u.ALL_CYCLES.join(" / ")}.`}}if(f||b){if((0,e.isFailLikeVerdictStatus)((0,e.getLastVerdictStatus)(i)))return{success:!1,message:"REJECTED: you reported a fail \u2014 N/A cannot reclassify it. Fix the issues and re-verify, or report the fail again."};if(!Array.isArray(t.reason)||t.reason.length===0)return{success:!1,message:`REJECTED: ${f?'status "not_applicable"':"not_applicable_cycles"} requires a non-empty "reason" array explaining why there is no runtime surface to verify.`};if(v!==void 0&&(0,u.getVerificationStrict)((0,u.loadConfig)(v)))return{success:!1,message:"REJECTED: strict mode \u2014 N/A is not accepted. Verify the change with the required tools, or report a fail."}}if(!f&&(!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,e.isFailLikeVerdictStatus)((0,e.getLastVerdictStatus)(i))&&(!Array.isArray(t.fixes)||t.fixes.length===0)&&(t.fixes=k(i,n)),(0,e.isRecordingRequired)(i)&&(0,e.isRecordingActive)(i))return{success:!1,message:`REJECTED: recording is still active.
|
|
2
2
|
|
|
3
3
|
1. Stop recording first:
|
|
4
|
-
${(0,x.listRecordingCycleTools)().map(
|
|
4
|
+
${(0,x.listRecordingCycleTools)().map(d=>` ${d.stopTool} (${d.cycle} cycle)`).join(`
|
|
5
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 devtools tools, stop before submit-verdict.`};try{(0,y.mkdirSync)((0,w.dirname)(o),{recursive:!0}),(0,y.writeFileSync)(o,JSON.stringify(t,null,2))}catch(s){return
|
|
8
|
+
Recording start/stop must bracket the verification flow \u2014 start before devtools tools, stop before submit-verdict.`};try{(0,y.mkdirSync)((0,w.dirname)(o),{recursive:!0}),(0,y.writeFileSync)(o,JSON.stringify(t,null,2))}catch(s){return l.logger.debug(`submit-verdict: failed to write ${o}: ${s}`),{success:!1,message:`REJECTED: failed to write verdict file: ${s}`}}(0,e.setLastVerdictStatus)(i,t.status),(0,e.setLastVerdictHadIssues)(i,t.status==="pass"&&Array.isArray(t.issues)&&t.issues.length>0),(0,e.clearPendingFixes)(i),(0,e.isRecordingRequired)(i)&&(0,e.setRecordingRequired)(i,!1);const E=(0,e.getActiveActivityId)(i),h=(0,e.getActiveFixId)(i);if(h){const s=Date.now(),d={...(0,a.baseFields)(n),type:"fix_end",timestamp:s,fix_id:h,activity_id:E,duration:(0,a.findDurationSinceLastAction)(n,"fix_start",s)};await(0,a.appendAction)(n,d),(0,e.clearActiveFix)(i),(0,e.setPhase)(i,"coding"),l.logger.debug(`fix-end (verdict): ${h}`)}const p=(0,e.getActiveVerificationId)(i),A=(0,e.getActiveTraceId)(i);if(p){const s=Date.now(),d={...(0,a.baseFields)(n),type:"verification_end",timestamp:s,verification_id:p,activity_id:E,trace_id:A,duration:(0,a.findDurationSinceLastAction)(n,"verification_start",s),status:t.status};await(0,a.appendAction)(n,d),(0,e.clearActiveVerification)(i),l.logger.debug(`verification-end (auto): ${p} trace=${A}`)}const R=t,D={...(0,a.baseFields)(n),type:"verdict_write",timestamp:Date.now(),verification_id:p,activity_id:E,trace_id:A,verdict:R};if(await(0,a.appendAction)(n,D),await(0,V.trackVerdictWrite)(r,t.status,v),l.logger.debug(`submit-verdict: session=${r} status=${t.status}`),t.status==="pass"){const s=t.fixes?.length?` Fixes: ${t.fixes.join(", ")}`:"";return{success:!0,message:`VERDICT ACCEPTED: pass.${g.length>0?` (N/A cycles: ${g.join(", ")})`:""}${s}`}}return t.status==="not_applicable"?{success:!0,message:`VERDICT ACCEPTED: not_applicable. ${(t.reason??[]).join(", ")}`}:{success:!0,message:`VERDICT ACCEPTED: fail. Issues: ${(t.issues??[]).join(", ")}. Fix and re-verify.`}}_(N,"runSubmitVerdict");0&&(module.exports={runSubmitVerdict});
|
|
@@ -1 +1 @@
|
|
|
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:()=>
|
|
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:()=>b,openFixCycleIfFixing:()=>w,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.getLastVerdictStatus)(t)!=="fail"&&(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 w(n){const{sessionDir:t,actionsFile:e}=n;if(!(0,i.isFailLikeVerdictStatus)((0,i.getLastVerdictStatus)(t))&&!(0,i.getLastVerdictHadIssues)(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 / pass-with-issues): ${c}`),c}x(w,"openFixCycleIfFixing");async function b(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(b,"endVerification");0&&(module.exports={endVerification,openFixCycleIfFixing,startVerification});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var T=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var u=(e,t)=>T(e,"name",{value:t,configurable:!0});var W=(e,t)=>{for(var i in t)T(e,i,{get:t[i],enumerable:!0})},X=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!K.call(e,s)&&s!==i&&T(e,s,{get:()=>t[s],enumerable:!(o=Q(t,s))||o.enumerable});return e};var Z=e=>X(T({},"__esModule",{value:!0}),e);var ge={};W(ge,{runVerifyGate:()=>fe});module.exports=Z(ge);var
|
|
1
|
+
"use strict";var T=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var u=(e,t)=>T(e,"name",{value:t,configurable:!0});var W=(e,t)=>{for(var i in t)T(e,i,{get:t[i],enumerable:!0})},X=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!K.call(e,s)&&s!==i&&T(e,s,{get:()=>t[s],enumerable:!(o=Q(t,s))||o.enumerable});return e};var Z=e=>X(T({},"__esModule",{value:!0}),e);var ge={};W(ge,{runVerifyGate:()=>fe});module.exports=Z(ge);var b=require("fs"),d=require("../../lib/logger"),V=require("../../lib/telemetry"),h=require("./actions"),r=require("./session-state"),B=require("./activity-participants"),p=require("../../lib/config"),M=require("./required-tools");const ee=3,te=1;function ie(e){const t=p.CYCLE_TO_SERVER[e];if(t===void 0)throw new Error(`No MCP server registered for cycle '${e}'.`);return t}u(ie,"mcpServerForCycle");function _(e){return JSON.stringify({session_id:e,status:"pass",checks:["form submits successfully","new item appears in list","no console errors"]})}u(_,"verdictExamplePass");function q(e){return JSON.stringify({session_id:e,status:"fail",checks:["form renders","submit button unresponsive"],issues:["button click handler not firing","TypeError in console"]})}u(q,"verdictExampleFail");function k(...e){for(const t of e)try{(0,b.existsSync)(t)&&(0,b.unlinkSync)(t)}catch(i){d.logger.debug(`failed to cleanup ${t}: ${i}`)}}u(k,"cleanup");function oe(e){if(!(0,b.existsSync)(e))return null;try{return JSON.parse((0,b.readFileSync)(e,"utf-8"))}catch{return null}}u(oe,"readVerdictQuietly");function re(e,t){const i=(0,h.getFileChangesSinceLastVerification)(e),o=new Set;for(const f of i)for(const a of(0,p.getActiveCycles)(f.file_path,t))o.add(a);const s=[];o.has("browser")&&s.push("browser");for(const f of p.OPTIONAL_CYCLES)o.has(f)&&s.push(f);return s}u(re,"computeActiveCycles");function ne(e,t,i){const o=ie(e),s=new Set(t.filter(a=>a.tool_type==="mcp"&&a.mcp_server===o).map(a=>a.tool_name)),f=(0,p.getRequiredToolsConfig)(i,e);return{cycle:e,result:(0,M.satisfyRequiredTools)(s,f),config:f,usedCount:s.size}}u(ne,"checkCycleTools");function se(e){return{cycle:"browser",valid:!0,passCriteriaMet:!0}}u(se,"checkBrowserEvidence");function ae(e){return{cycle:"node",valid:!0,passCriteriaMet:!0}}u(ae,"checkNodeEvidence");function ce(e){return{cycle:"backend",valid:!0,passCriteriaMet:!0}}u(ce,"checkBackendEvidence");function le(e){return{cycle:"android",valid:!0,passCriteriaMet:!0}}u(le,"checkAndroidEvidence");function de(e,t){if(!Array.isArray(t.checks)||t.checks.length===0)return{cycle:e,valid:!1,reason:"missing checks"};if(e==="browser")return se(t);if(e==="node")return ae(t);if(e==="backend")return ce(t);if(e==="android")return le(t);throw new Error(`No evidence checker registered for cycle '${e}'.`)}u(de,"checkCycleEvidence");function ue(e){const t=e.cycle.charAt(0).toUpperCase()+e.cycle.slice(1);if(e.result.missing.length===0)return`${t} cycle: ok.`;const i=e.result.missing.map(o=>` - ${o}`).join(`
|
|
2
2
|
`);return e.config.evidencePaths.length>0&&e.result.pathName!==void 0?`${t} cycle: incomplete (closest path "${e.result.pathName}", tried [${e.result.triedPaths.join(", ")}]):
|
|
3
3
|
${i}`:`${t} cycle: missing required tools:
|
|
4
|
-
${i}`}u(ue,"describeMissingTools");async function fe(e){const{sessionId:t,sessionDir:i,actionsFile:o,verdictFile:s,maxRetries:f}=e,a=f??ee,C=e.config??(0,p.loadConfig)(e.projectDir);if(d.logger.debug(`verify-gate: session=${t} verdictExists=${(0,
|
|
4
|
+
${i}`}u(ue,"describeMissingTools");async function fe(e){const{sessionId:t,sessionDir:i,actionsFile:o,verdictFile:s,maxRetries:f}=e,a=f??ee,C=e.config??(0,p.loadConfig)(e.projectDir);if(d.logger.debug(`verify-gate: session=${t} verdictExists=${(0,b.existsSync)(s)}`),(0,B.anyNonMainParticipants)(i)&&((0,r.getActiveVerificationId)(i)!==void 0||!(0,b.existsSync)(s)))return d.logger.debug("verifier sub-agent still running \u2014 allowing the main Stop, deferring activity close to the verifier (silent): verifier_running"),{action:"allow",reason:"verifier_running",message:"Verification is still running (delegated to the ironbee-verifier sub-agent). It continues in the background; you'll be re-invoked with its verdict when it finishes \u2014 do NOT claim completion yet, and do NOT spawn another verifier. A PASS completes the work; a FAIL means fix the reported issues and re-verify."};if(!(0,h.hasFileChangesSinceLastVerification)(o)){if((0,r.getLastVerdictStatus)(i)==="fail"){if((0,r.getVerifyIntent)(i)!=="fix")return d.logger.debug("fail verdict with no code changes in window \u2014 status report, allowing"),(0,r.setLastVerdictStatus)(i,"fail_reported"),await l(o,i,t,"allow","fail_verdict_reported",[],e.projectDir),{action:"allow"};const n=(0,r.incrementRetries)(i);return n>=a?(d.logger.debug(`fix intent declared but retries exhausted (${n}/${a}) \u2014 releasing`),(0,r.resetRetries)(i),await(0,r.closeOpenCycles)(i,o,"max_retries_exceeded"),await l(o,i,t,"allow","max_retries_exceeded",[],e.projectDir),{action:"allow",message:`VERIFICATION FAILED ${a} TIMES. Allowing completion.
|
|
5
5
|
|
|
6
6
|
The fail verdict was never resolved. Report the unresolved issues in your final response.`}):(d.logger.debug(`fix intent declared, fail verdict not addressed \u2014 blocking (unaddressed, attempt ${n}/${a})`),await l(o,i,t,"block","fail_verdict_unaddressed",[],e.projectDir),{action:"block",message:`VERIFICATION FAILED \u2014 unaddressed (attempt ${n}/${a}).
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ You submitted a fail verdict but did not address the reported issues. Either:
|
|
|
13
13
|
|
|
14
14
|
2. Or \u2014 if the issues genuinely cannot be fixed \u2014 re-verify (keep the --intent fix flag)
|
|
15
15
|
to confirm the failure: each blocked stop counts toward maxRetries; once exhausted,
|
|
16
|
-
the gate will allow completion with the issues reported.`})}return d.logger.debug("no code changes detected, allowing completion"),await l(o,i,t,"allow","no_edits",[],e.projectDir),{action:"allow"}}const c=re(o,C);if(c.length===0)return d.logger.debug("file changes match no cycle pattern, allowing completion"),await l(o,i,t,"allow","no_cycle_active",[],e.projectDir),{action:"allow"};const S=(0,p.getVerificationStrict)(C),U=(0,r.isFailLikeVerdictStatus)((0,r.getLastVerdictStatus)(i)),y=oe(s),x=!S&&!U&&y!==null&&Array.isArray(y.reason)&&y.reason.length>0;if(x&&y.status==="not_applicable")return d.logger.debug("global N/A verdict, allowing completion"),(0,r.resetRetries)(i),(0,r.setLastVerdictStatus)(i,"not_applicable"),await l(o,i,t,"allow","verdict_not_applicable",c,e.projectDir),{action:"allow"};let
|
|
16
|
+
the gate will allow completion with the issues reported.`})}return d.logger.debug("no code changes detected, allowing completion"),await l(o,i,t,"allow","no_edits",[],e.projectDir),{action:"allow"}}const c=re(o,C);if(c.length===0)return d.logger.debug("file changes match no cycle pattern, allowing completion"),await l(o,i,t,"allow","no_cycle_active",[],e.projectDir),{action:"allow"};const S=(0,p.getVerificationStrict)(C),U=(0,r.isFailLikeVerdictStatus)((0,r.getLastVerdictStatus)(i)),y=oe(s),x=!S&&!U&&y!==null&&Array.isArray(y.reason)&&y.reason.length>0;if(x&&y.status==="not_applicable")return d.logger.debug("global N/A verdict, allowing completion"),(0,r.resetRetries)(i),(0,r.setLastVerdictStatus)(i,"not_applicable"),await l(o,i,t,"allow","verdict_not_applicable",c,e.projectDir),{action:"allow"};let v=c;if(x&&Array.isArray(y.not_applicable_cycles)&&y.not_applicable_cycles.length>0){const n=new Set(y.not_applicable_cycles.filter(g=>c.includes(g)));if(v=c.filter(g=>!n.has(g)),v.length===0)return d.logger.debug("per-platform N/A exempted every active cycle \u2014 treating as global N/A"),(0,r.resetRetries)(i),(0,r.setLastVerdictStatus)(i,"not_applicable"),await l(o,i,t,"allow","verdict_not_applicable",c,e.projectDir),{action:"allow"};d.logger.debug(`per-platform N/A: exempt=[${[...n].join(",")}] enforced=[${v.join(",")}]`)}const J=(0,h.getToolCallsSinceLastFileChange)(o),N=v.map(n=>ne(n,J,C)),D=N.filter(n=>!n.result.satisfied);if(D.length>0){const n=N.every(m=>m.usedCount===0),g=(0,r.incrementRetries)(i),$=!(0,h.hasVerifierEverEngaged)(o),G=$&&g>te,Y=g>=a;if(G||Y){const m=$?"verifier_unavailable":"max_retries_exceeded";d.logger.debug(`tool-presence loop releasing (attempt ${g}/${a}, neverEngaged=${$}) \u2014 ${m}`),(0,r.resetRetries)(i),await(0,r.closeOpenCycles)(i,o,m),await l(o,i,t,"allow",m,c,e.projectDir);const A=c.join(", ");return $?{action:"allow",message:`VERIFICATION UNAVAILABLE \u2014 allowing completion.
|
|
17
17
|
|
|
18
18
|
The ${A} verification cycle could not run this session: no verification was ever started and no verification tool was recorded across the whole session. This points to an environment/setup problem rather than a skipped step. Check:
|
|
19
19
|
- the devtools MCP server is installed and loads (try \`npx -y @ironbee-ai/devtools\`);
|
|
@@ -26,7 +26,7 @@ The ${A} verification cycle was attempted but its required tools were not all co
|
|
|
26
26
|
|
|
27
27
|
You made code changes but did not verify them.
|
|
28
28
|
|
|
29
|
-
${
|
|
29
|
+
${v.includes("browser")?`Browser cycle (UI verification):
|
|
30
30
|
1. Build and start the application if not already running
|
|
31
31
|
2. Navigate to the affected page(s)
|
|
32
32
|
3. Functionally test your changes \u2014 click, type, submit, interact with the UI to confirm the code works
|
|
@@ -34,18 +34,18 @@ ${b.includes("browser")?`Browser cycle (UI verification):
|
|
|
34
34
|
5. Take an accessibility snapshot to verify page structure
|
|
35
35
|
6. Check console for errors
|
|
36
36
|
7. Stop the dev server when done
|
|
37
|
-
`:""}${
|
|
37
|
+
`:""}${v.includes("node")?`Node cycle (Node.js runtime debug):
|
|
38
38
|
1. Connect to the running Node process via ndt_debug_connect
|
|
39
39
|
2. Set probes (tracepoint / logpoint / exceptionpoint) at the changed code paths
|
|
40
40
|
3. Exercise the code path so probes fire
|
|
41
41
|
4. Read snapshots via ndt_debug_get-probe-snapshots, OR inspect runtime errors via ndt_debug_get-logs
|
|
42
|
-
`:""}${
|
|
42
|
+
`:""}${v.includes("backend")?`Backend cycle (runtime-agnostic service verification \u2014 pick ONE or more evidence paths):
|
|
43
43
|
1. Identify the backend layer affected by your change (HTTP / gRPC / GraphQL / WebSocket endpoint, log output, or database state)
|
|
44
44
|
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
|
|
45
45
|
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
|
|
46
46
|
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
|
|
47
47
|
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.
|
|
48
|
-
`:""}${
|
|
48
|
+
`:""}${v.includes("android")?`Android cycle (mobile device / emulator verification \u2014 pick ONE evidence path):
|
|
49
49
|
1. Connect to a running device or emulator: adt_device_connect
|
|
50
50
|
2a. Device-evidence path: drive the app UI (adt_device_launch-app / adt_interaction_tap / adt_interaction_input-text / adt_interaction_swipe), then capture BOTH a screenshot (adt_content_take-screenshot) AND a UI snapshot (adt_a11y_take-ui-snapshot) to confirm the visual + structural result
|
|
51
51
|
2b. Log-evidence path: read Logcat output for the changed code path (adt_o11y_log-read / adt_o11y_log-follow) and confirm expected log lines / absence of errors
|
|
@@ -62,15 +62,15 @@ ${H}
|
|
|
62
62
|
|
|
63
63
|
Run the missing tools, functionally test your changes, then submit your verdict:
|
|
64
64
|
Pass: echo '${_(t)}' | ironbee hook submit-verdict
|
|
65
|
-
Fail: echo '${q(t)}' | ironbee hook submit-verdict`}}if(!(0,
|
|
65
|
+
Fail: echo '${q(t)}' | ironbee hook submit-verdict`}}if(!(0,b.existsSync)(s))return await l(o,i,t,"block","no_verdict",c,e.projectDir),{action:"block",message:`VERDICT MISSING.
|
|
66
66
|
|
|
67
67
|
You ran the verification tools but did not submit a verdict.${(0,r.isRecordingActive)(i)?`
|
|
68
68
|
\u26A0 Recording is still active \u2014 call mcp__browser-devtools__bdt_content_stop-recording BEFORE submit-verdict (otherwise it will reject with "recording is still active").`:""}
|
|
69
69
|
|
|
70
70
|
Submit your verdict via:
|
|
71
|
-
echo '${_(t)}' | ironbee hook submit-verdict`};let w;try{w=JSON.parse((0,
|
|
72
|
-
echo '${_(t)}' | ironbee hook submit-verdict`}}if(w.status==="not_applicable")return k(s),await l(o,i,t,"block","not_applicable_rejected",
|
|
73
|
-
echo '${_(t)}' | ironbee hook submit-verdict`};const F=
|
|
71
|
+
echo '${_(t)}' | ironbee hook submit-verdict`};let w;try{w=JSON.parse((0,b.readFileSync)(s,"utf-8"))}catch(n){return d.logger.debug(`failed to parse verdict ${s}: ${n}`),k(s),await l(o,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`INVALID VERDICT JSON. Re-submit valid JSON:
|
|
72
|
+
echo '${_(t)}' | ironbee hook submit-verdict`}}if(w.status==="not_applicable")return k(s),await l(o,i,t,"block","not_applicable_rejected",v,e.projectDir),{action:"block",message:`VERDICT REJECTED: ${S?"N/A is not accepted in strict mode \u2014 verify the change with the required tools.":"N/A is not honored here \u2014 verify the change with the required tools, or report a fail."}
|
|
73
|
+
echo '${_(t)}' | ironbee hook submit-verdict`};const F=v.map(n=>de(n,w)),j=F.filter(n=>!n.valid);if(j.length>0)return k(s),await l(o,i,t,"block","invalid_verdict",c,e.projectDir),{action:"block",message:`VERDICT REJECTED:
|
|
74
74
|
${j.map(g=>` - ${g.cycle} cycle: ${g.reason}`).join(`
|
|
75
75
|
`)}
|
|
76
76
|
|
package/dist/lib/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var o=(n,e)=>y(n,"name",{value:e,configurable:!0});var de=(n,e)=>{for(var t in e)y(n,t,{get:e[t],enumerable:!0})},pe=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fe(e))!ge.call(n,i)&&i!==t&&y(n,i,{get:()=>e[i],enumerable:!(r=ue(e,i))||r.enumerable});return n};var be=n=>pe(y({},"__esModule",{value:!0}),n);var hn={};de(hn,{ALL_CYCLES:()=>Ee,CONFIG_TARGETS_BY_PRECEDENCE:()=>je,CYCLES_ENABLED_BY_DEFAULT:()=>P,CYCLE_DEFAULT_VERIFY_PATTERNS:()=>$,CYCLE_TOOL_PREFIXES:()=>_e,CYCLE_TO_SERVER:()=>ye,DEFAULT_ANDROID_ALWAYS_REQUIRED:()=>W,DEFAULT_ANDROID_EVIDENCE_PATHS:()=>Q,DEFAULT_ANDROID_VERIFY_PATTERNS:()=>U,DEFAULT_BACKEND_ALWAYS_REQUIRED:()=>H,DEFAULT_BACKEND_EVIDENCE_PATHS:()=>G,DEFAULT_BACKEND_VERIFY_PATTERNS:()=>V,DEFAULT_BROWSER_ALWAYS_REQUIRED:()=>K,DEFAULT_BROWSER_VERIFY_PATTERNS:()=>M,DEFAULT_IGNORED_VERIFY_PATTERNS:()=>q,DEFAULT_NODE_ALWAYS_REQUIRED:()=>Y,DEFAULT_NODE_EVIDENCE_PATHS:()=>X,DEFAULT_NODE_VERIFY_PATTERNS:()=>F,DEFAULT_OAUTH_USAGE_TTL_SECONDS:()=>ee,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS:()=>re,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS:()=>oe,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS:()=>te,DEFAULT_OTEL_PORT:()=>ne,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH:()=>ae,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES:()=>se,ENV_OVERRIDES:()=>j,OPTIONAL_CYCLES:()=>T,applyEnvOverrides:()=>z,findActiveEnvOverride:()=>ke,getActiveCycles:()=>J,getAnalyticsEmitOnStopMinIntervalSeconds:()=>xn,getAndroidDevToolsMcpEntry:()=>Je,getAutoVerifyEnabled:()=>ie,getBackendDevToolsMcpEntry:()=>ze,getCaptureFileChangeset:()=>vn,getClaudeOauthAccessEnabled:()=>sn,getClaudeOauthAccessUsageTtlSeconds:()=>cn,getConfigLayerPaths:()=>x,getMaxChangesetBytes:()=>In,getMaxRetries:()=>Ze,getMcpServerEntry:()=>We,getNodeDevToolsMcpEntry:()=>Qe,getOTELEmitMinIntervalSeconds:()=>dn,getOTELEnsureMinIntervalSeconds:()=>gn,getOTELIdleTimeoutSeconds:()=>fn,getOTELPort:()=>un,getPrivacyEnabled:()=>le,getRequiredToolsConfig:()=>Ne,getStatusLineEmitMinIntervalSeconds:()=>rn,getStatusLineRefreshInterval:()=>pn,getStatusLineRenderDefault:()=>on,getTargetConfigPath:()=>Re,getTelemetryEnabled:()=>ce,getVerificationContextCommitDepth:()=>_n,getVerificationContextEnabled:()=>En,getVerificationContextMaxBytes:()=>Cn,getVerificationContextSource:()=>yn,getVerificationEnabled:()=>O,getVerificationMode:()=>An,getVerificationModel:()=>Ae,getVerificationStrict:()=>bn,isAnalyticsApiRequestEventsEnabled:()=>On,isAnalyticsEmitOnStopEnabled:()=>wn,isAnalyticsEnabled:()=>Tn,isAnalyticsStepEventsEnabled:()=>Rn,isAnalyticsTurnEventsEnabled:()=>jn,isAutoModeAllowlistEnabled:()=>an,isCollectorConfigured:()=>R,isCycleEnabled:()=>De,isCyclePatternsActive:()=>Z,isIgnoredVerifyPath:()=>mn,isJobQueueEnabled:()=>en,isOTELEnabled:()=>ln,isRecordingEnabled:()=>nn,isSessionStatusEnabled:()=>tn,loadConfig:()=>c,requiresVerification:()=>Le,resolveConfigTargetFromFlags:()=>Oe,resolveIgnoredVerifyPatterns:()=>w});module.exports=be(hn);var E=require("fs"),b=require("path"),I=require("os"),N=require("./logger");const T=["node","backend","android"],Ee=["browser",...T],P=new Set(["browser"]),ye={browser:"browser-devtools",node:"node-devtools",backend:"backend-devtools",android:"android-devtools"},_e={browser:"bdt_",node:"ndt_",backend:"bedt_",android:"adt_"},M=["*.ts","*.tsx","*.js","*.jsx","*.mjs","*.cjs","*.vue","*.svelte","*.html","*.htm","*.css","*.scss","*.sass","*.less","*.styl","*.py","*.rb","*.erb","*.go","*.rs","*.java","*.kt","*.kts","*.swift","*.c","*.cpp","*.h","*.hpp","*.cs","*.php","*.dart","*.ex","*.exs","*.erl","*.lua","*.r","*.R","*.scala","*.clj","*.cljs","*.zig","*.nim","*.hbs","*.ejs","*.pug","*.jade","*.astro"],F=["server/**/*.{ts,js,mjs,cjs}","src/server/**/*.{ts,js,mjs,cjs}","backend/**/*.{ts,js,mjs,cjs}","api/**/*.{ts,js,mjs,cjs}","src/api/**/*.{ts,js,mjs,cjs}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs}","**/server.{ts,js,mjs,cjs}"],V=["server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","backend/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","controllers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","handlers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","services/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/server.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/main.{go,py,java,rb,kt,scala}"],U=["android/**/*.{kt,java}","app/src/**/*.{kt,java}","mobile/**/*.{kt,java}","src/main/kotlin/**/*.kt","src/main/java/**/*.java","**/*.{kt,java}","**/res/**/*.xml","**/AndroidManifest.xml"],$={browser:M,node:F,backend:V,android:U},q=["**/*.spec.*","**/*.test.*","**/__tests__/**","**/__mocks__/**"];function w(n){const e=n.ignoredVerifyPatterns??[];return[...q,...e]}o(w,"resolveIgnoredVerifyPatterns");const K=["bdt_navigation_go-to","bdt_content_take-screenshot","bdt_a11y_take-aria-snapshot","bdt_o11y_get-console-messages"],Y=["ndt_debug_connect"],X=[{name:"probe",allOf:[{anyOf:["ndt_debug_put-tracepoint","ndt_debug_put-logpoint","ndt_debug_put-exceptionpoint"]},"ndt_debug_get-probe-snapshots"]},{name:"log",allOf:["ndt_debug_get-logs"]}],H=[],G=[{name:"protocol-call",allOf:[{anyOf:["bedt_request_http","bedt_request_grpc","bedt_request_graphql","bedt_request_websocket-open","bedt_request_replay"]}]},{name:"log-evidence",allOf:["bedt_log_register-source",{anyOf:["bedt_log_read","bedt_log_read-multi","bedt_log_follow"]}]},{name:"db-evidence",allOf:["bedt_db_connect",{anyOf:["bedt_db_query","bedt_db_describe-table","bedt_db_list-tables","bedt_db_snapshot","bedt_db_diff","bedt_db_get-changes"]}]}],W=["adt_device_connect"],Q=[{name:"device-evidence",allOf:[{anyOf:["adt_device_launch-app","adt_interaction_tap","adt_interaction_double-tap","adt_interaction_long-press","adt_interaction_input-text","adt_interaction_swipe","adt_interaction_scroll","adt_interaction_press-key","adt_interaction_deep-link"]},"adt_content_take-screenshot","adt_a11y_take-ui-snapshot"]},{name:"log-evidence",allOf:[{anyOf:["adt_o11y_log-read","adt_o11y_log-follow"]}]}],Ce=3;function k(n){if(!(0,E.existsSync)(n))return{};try{return JSON.parse((0,E.readFileSync)(n,"utf-8"))}catch(e){return N.logger.debug(`failed to parse config ${n}: ${e}`),{}}}o(k,"loadJsonFile");function me(n,e){if(!Object.prototype.hasOwnProperty.call(n,"verification"))return;const t=n.verification;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'verification' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.enable' must be boolean. Got ${typeof r.enable}.`);if(Object.prototype.hasOwnProperty.call(r,"auto")&&typeof r.auto!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.auto' must be boolean. Got ${typeof r.auto}.`);if(Object.prototype.hasOwnProperty.call(r,"strict")&&typeof r.strict!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.strict' must be boolean. Got ${typeof r.strict}.`);if(Object.prototype.hasOwnProperty.call(r,"model")){const i=r.model,s=typeof i=="string",l=i!==null&&typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(a=>typeof a=="string");if(!s&&!l)throw new Error(`Invalid IronBee config in ${e}: 'verification.model' must be a string (applies to all clients) or an object of string values (per-client, e.g. { "claude": "sonnet", "codex": "gpt-5.5" }). Got ${Array.isArray(i)?"array":typeof i}.`)}}o(me,"assertVerificationShape");function Ae(n,e){const t=n.verification?.model;if(typeof t=="string")return t.length>0?t:void 0;if(t&&typeof t=="object"){const r=t[e];return typeof r=="string"&&r.length>0?r:void 0}}o(Ae,"getVerificationModel");function ve(n,e){if(!Object.prototype.hasOwnProperty.call(n,"telemetry"))return;const t=n.telemetry;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'telemetry' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'telemetry.enable' must be boolean. Got ${typeof r.enable}.`)}o(ve,"assertTelemetryShape");function Ie(n,e){if(!Object.prototype.hasOwnProperty.call(n,"privacy"))return;const t=n.privacy;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'privacy' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'privacy.enable' must be boolean. Got ${typeof r.enable}.`)}o(Ie,"assertPrivacyShape");function _(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(_,"mergeCycleConfig");function B(n,e){const t={...n,...e};return t.browser=_(n.browser,e.browser),t.node=_(n.node,e.node),t.backend=_(n.backend,e.backend),t.android=_(n.android,e.android),t.claude=xe(n.claude,e.claude),t.verification=we(n.verification,e.verification),t.verificationContext=Te(n.verificationContext,e.verificationContext),t}o(B,"mergeConfigLayers");function Te(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(Te,"mergeVerificationContextConfig");function we(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(we,"mergeVerificationConfig");function xe(n,e){if(n===void 0&&e===void 0)return;const t={...n??{},...e??{}};return(n?.oauthAccess!==void 0||e?.oauthAccess!==void 0)&&(t.oauthAccess={...n?.oauthAccess??{},...e?.oauthAccess??{}}),(n?.autoModeAllowlist!==void 0||e?.autoModeAllowlist!==void 0)&&(t.autoModeAllowlist={...n?.autoModeAllowlist??{},...e?.autoModeAllowlist??{}}),t}o(xe,"mergeClaudeConfig");function x(n){return{global:(0,b.join)((0,I.homedir)(),".ironbee","config.json"),project:n?(0,b.join)(n,".ironbee","config.json"):void 0,local:n?(0,b.join)(n,".ironbee","config.local.json"):void 0}}o(x,"getConfigLayerPaths");const je=["global","project","local"];function Re(n,e){const t=x(e);if(n==="global")return t.global;if(n==="project"){if(t.project===void 0)throw new Error("Project layer requested but no projectDir was provided.");return t.project}if(t.local===void 0)throw new Error("Local layer requested but no projectDir was provided.");return t.local}o(Re,"getTargetConfigPath");function Oe(n){if(n.global===!0&&n.local===!0)throw new Error("Pass at most one of --global / --local.");return n.global===!0?"global":n.local===!0?"local":"project"}o(Oe,"resolveConfigTargetFromFlags");function A(n){const e=k(n);return(0,E.existsSync)(n)&&(me(e,n),ve(e,n),Ie(e,n)),e}o(A,"loadAndValidateLayer");const j=[{envVar:"IRONBEE_API_KEY",configPath:"collector.apiKey"},{envVar:"IRONBEE_OAUTH_TOKEN",configPath:"collector.oauthToken"}];function he(n,e,t){const r=e.split(".");let i=n;for(let s=0;s<r.length-1;s++){const l=r[s],a=i[l];a!=null&&typeof a=="object"&&!Array.isArray(a)?i[l]={...a}:i[l]={},i=i[l]}i[r[r.length-1]]=t}o(he,"setAtConfigPath");function z(n){let e;for(const t of j){const r=process.env[t.envVar];if(r===void 0||r.length===0)continue;e===void 0&&(e={...n});const i=t.coerce?t.coerce(r):r;he(e,t.configPath,i)}return e??n}o(z,"applyEnvOverrides");function ke(n){for(const e of j){if(e.configPath!==n)continue;const t=process.env[e.envVar];if(t!==void 0&&t.length>0)return e}}o(ke,"findActiveEnvOverride");function c(n){const e=x(n),t=A(e.global),r=e.project?A(e.project):{},i=e.local?A(e.local):{},s=B(B(t,r),i);return z(s)}o(c,"loadConfig");function Be(n){let e=n.replace(/\{([^}]+)\}/g,(t,r)=>`(${r.split(",").map(i=>i.trim()).join("|")})`);return e=e.replace(/\*\*\//g,"\0DSS\0").replace(/\*\*/g,"\0DS\0").replace(/\*/g,"\0SS\0").replace(/\?/g,"\0QM\0"),e=e.replace(/[.+^$\\[\]]/g,"\\$&"),e=e.replace(/\x00DSS\x00/g,"(?:.*/)?").replace(/\x00DS\x00/g,".*").replace(/\x00SS\x00/g,"[^/]*").replace(/\x00QM\x00/g,"[^/]"),new RegExp(`(^|/)${e}$`)}o(Be,"globToRegExp");function C(n,e){const t=n.replace(/\\/g,"/");for(const r of e)if(Be(r).test(t))return!0;return!1}o(C,"matchesAny");function Se(n,e){if(e==="browser")return n.browser;if(e==="node")return n.node;if(e==="backend")return n.backend;if(e==="android")return n.android}o(Se,"getCycleBlock");function v(n,e){const t=Se(n,e);if(t!==void 0&&t.enable===!1)return[];const r=$[e]??[];if(t===void 0)return P.has(e)?[...r]:[];if(Array.isArray(t.verifyPatterns)&&t.verifyPatterns.length===0)return[];const i=t.verifyPatterns??r,s=t.additionalVerifyPatterns??[];return[...i,...s]}o(v,"getCyclePatterns");function J(n,e){const t=w(e);if(t.length>0&&C(n,t))return[];const r=[];C(n,v(e,"browser"))&&r.push("browser");for(const i of T){const s=v(e,i);s.length>0&&C(n,s)&&r.push(i)}return r}o(J,"getActiveCycles");function Le(n,e){return J(n,e).length>0}o(Le,"requiresVerification");function De(n,e){return O(n)?Z(n,e):!1}o(De,"isCycleEnabled");function Z(n,e){return v(n,e).length>0}o(Z,"isCyclePatternsActive");function Ne(n,e){let t,r;if(e==="browser"?(t=n.browser?.alwaysRequired??K,r=n.browser?.evidencePaths??[]):e==="node"?(t=n.node?.alwaysRequired??Y,r=n.node?.evidencePaths??X):e==="backend"?(t=n.backend?.alwaysRequired??H,r=n.backend?.evidencePaths??G):e==="android"?(t=n.android?.alwaysRequired??W,r=n.android?.evidencePaths??Q):(t=[],r=[]),t.length===0&&r.length===0)throw new Error(`Invalid required-tools config for cycle '${e}': both 'alwaysRequired' and 'evidencePaths' are empty. At least one must specify required tools.`);return{alwaysRequired:t,evidencePaths:r}}o(Ne,"getRequiredToolsConfig");const S="npx",Pe="^0.12.0",L=["-y",`@ironbee-ai/devtools@${Pe}`],Me={TOOL_NAME_PREFIX:"bdt_",TOOL_INPUT_METADATA_ENABLE:"true"},Fe={PLATFORM:"node",TOOL_NAME_PREFIX:"ndt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ve={PLATFORM:"backend",TOOL_NAME_PREFIX:"bedt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ue={PLATFORM:"android",TOOL_NAME_PREFIX:"adt_",TOOL_INPUT_METADATA_ENABLE:"true"},$e={BROWSER_DEVTOOLS_INSTALL_CHROMIUM:"true"},qe={},Ke={},Ye={};function Xe(n){return ce(n)?{}:{TELEMETRY_ENABLE:"false"}}o(Xe,"buildTelemetryEnv");function He(n){return le(n)?{COLLECTOR_EVENTS_TOOL_DETAILS_ENABLE:"false",COLLECTOR_ARTIFACTS_ENABLE:"false"}:{}}o(He,"buildPrivacyEnv");function Ge(n,e){if(!R(n))return{};const t=n.collector,i=k((0,b.join)((0,I.homedir)(),".ironbee","config.json")).collector??{},s=typeof i.oauthToken=="string"&&i.oauthToken.length>0,l=typeof i.apiKey=="string"&&i.apiKey.length>0;let a;t.oauthToken?a=s?"X-OAuth-Token=${file:~/.ironbee/config.json#collector.oauthToken}":`X-OAuth-Token=${t.oauthToken}`:a=l?"X-API-Key=${file:~/.ironbee/config.json#collector.apiKey}":`X-API-Key=${t.apiKey}`;const u={OTEL_ENABLE:"true",OTEL_EXPORTER_HTTP_URL:t.url,OTEL_EXPORTER_HTTP_HEADERS:a,OTEL_EXPORTER_TYPE:"otlp/http-protobuf"};return e==="browser"&&(u.OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS="change,input,click",u.BROWSER_HEADLESS_ENABLE="true"),u}o(Ge,"buildOTELEnv");function m(n,e,t,r,i){const s=Ge(n,i),l=Xe(n),a=He(n),u=n[e];if(u&&typeof u=="object"&&!Array.isArray(u)){const f=u;if(f.mcp&&typeof f.mcp=="object"&&!Array.isArray(f.mcp)){const g={...f.mcp},d={...s,...l,...a,...g.env??{},...t};return g.env=d,g}const h={};if(f.env&&typeof f.env=="object"&&!Array.isArray(f.env)){const g=f.env;for(const d of Object.keys(g))typeof g[d]=="string"&&(h[d]=g[d])}return{command:S,args:[...L],env:{...r,...s,...l,...a,...h,...t}}}return{command:S,args:[...L],env:{...r,...s,...l,...a,...t}}}o(m,"buildMcpEntry");function We(n){const e=c(n);return m(e,"browserDevTools",Me,$e,"browser")}o(We,"getMcpServerEntry");function Qe(n){const e=c(n);return m(e,"nodeDevTools",Fe,qe,"node")}o(Qe,"getNodeDevToolsMcpEntry");function ze(n){const e=c(n);return m(e,"backendDevTools",Ve,Ke,"backend")}o(ze,"getBackendDevToolsMcpEntry");function Je(n){const e=c(n);return m(e,"androidDevTools",Ue,Ye,"android")}o(Je,"getAndroidDevToolsMcpEntry");function Ze(n){return typeof n.maxRetries=="number"&&n.maxRetries>0?n.maxRetries:Ce}o(Ze,"getMaxRetries");function R(n){if(process.env.IRONBEE_COLLECTOR==="false")return!1;const e=n.collector;if(!e||e.enable===!1||typeof e.url!="string"||e.url.length===0)return!1;const t=typeof e.oauthToken=="string"&&e.oauthToken.length>0,r=typeof e.apiKey=="string"&&e.apiKey.length>0;return!(!t&&!r)}o(R,"isCollectorConfigured");function en(n){const e=c(n);return p(e,e.jobQueue)}o(en,"isJobQueueEnabled");function nn(n){const e=c(n);return p(e,e.recording)}o(nn,"isRecordingEnabled");function tn(n){return p(n,n.statusLine)}o(tn,"isSessionStatusEnabled");function on(n){const e=n.statusLine;return e!==void 0&&e.renderDefault===!0}o(on,"getStatusLineRenderDefault");function rn(n){const e=n.statusLine?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:10}o(rn,"getStatusLineEmitMinIntervalSeconds");const ee=60;function sn(n){return n.claude?.oauthAccess?.enable!==!1}o(sn,"getClaudeOauthAccessEnabled");function an(n){return n.claude?.autoModeAllowlist?.enable!==!1}o(an,"isAutoModeAllowlistEnabled");function cn(n){const e=n.claude?.oauthAccess?.usageTtlSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:ee}o(cn,"getClaudeOauthAccessUsageTtlSeconds");const ne=15986,te=600,oe=30,re=0;function ln(n){return p(n,n.otel)}o(ln,"isOTELEnabled");function un(n){const e=n.otel?.port;return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<65536?e:ne}o(un,"getOTELPort");function fn(n){const e=n.otel?.idleTimeoutSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:te}o(fn,"getOTELIdleTimeoutSeconds");function gn(n){const e=n.otel?.ensureMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:oe}o(gn,"getOTELEnsureMinIntervalSeconds");function dn(n){const e=n.otel?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:re}o(dn,"getOTELEmitMinIntervalSeconds");function pn(n){const e=n.statusLine?.refreshInterval;if(typeof e=="number"&&Number.isFinite(e)&&e>=1)return e}o(pn,"getStatusLineRefreshInterval");function p(n,e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e.enable!==!1:R(n)}o(p,"isFeatureEnabledWithCollectorAutoEnable");function Bn(n){return n==null||typeof n!="object"||Array.isArray(n)?!1:n.enable!==!1}o(Bn,"isPresenceEnabled");function O(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(O,"getVerificationEnabled");function ie(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.auto!==!1}o(ie,"getAutoVerifyEnabled");function bn(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.strict===!0}o(bn,"getVerificationStrict");const se=65536,ae=1;function En(n){const e=n.verificationContext;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(En,"getVerificationContextEnabled");function yn(n){return n.verificationContext?.source==="actions"?"actions":"git"}o(yn,"getVerificationContextSource");function _n(n){const e=n.verificationContext?.commitDepth;return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):ae}o(_n,"getVerificationContextCommitDepth");function Cn(n){const e=n.verificationContext?.maxBytes;return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):se}o(Cn,"getVerificationContextMaxBytes");function mn(n,e){const t=w(n);return t.length>0&&C(e,t)}o(mn,"isIgnoredVerifyPath");function An(n){return O(n)?ie(n)?"enforce":"assist":"monitor"}o(An,"getVerificationMode");function ce(n){const e=n.telemetry;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(ce,"getTelemetryEnabled");function le(n){const e=n.privacy;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.enable===!0}o(le,"getPrivacyEnabled");const D=65536;function vn(n){const e=n.fileChange;return!e||typeof e!="object"||Array.isArray(e)?!1:e.captureChangeset===!0}o(vn,"getCaptureFileChangeset");function In(n){const e=n.fileChange;if(!e||typeof e!="object"||Array.isArray(e))return D;const t=e.maxChangesetBytes;return typeof t!="number"||!Number.isFinite(t)||t<=0?D:Math.floor(t)}o(In,"getMaxChangesetBytes");function Tn(n){const e=c(n);return p(e,e.analytics)}o(Tn,"isAnalyticsEnabled");function wn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitOnStop!==!1}o(wn,"isAnalyticsEmitOnStopEnabled");function xn(n){const t=c(n).analytics;if(t===null||typeof t!="object"||Array.isArray(t))return 0;const r=t.emitOnStopMinIntervalSeconds;return typeof r=="number"&&r>=0?r:0}o(xn,"getAnalyticsEmitOnStopMinIntervalSeconds");function jn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitTurnEvents===!0}o(jn,"isAnalyticsTurnEventsEnabled");function Rn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitStepEvents===!0}o(Rn,"isAnalyticsStepEventsEnabled");function On(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitApiRequestEvents!==!1}o(On,"isAnalyticsApiRequestEventsEnabled");0&&(module.exports={ALL_CYCLES,CONFIG_TARGETS_BY_PRECEDENCE,CYCLES_ENABLED_BY_DEFAULT,CYCLE_DEFAULT_VERIFY_PATTERNS,CYCLE_TOOL_PREFIXES,CYCLE_TO_SERVER,DEFAULT_ANDROID_ALWAYS_REQUIRED,DEFAULT_ANDROID_EVIDENCE_PATHS,DEFAULT_ANDROID_VERIFY_PATTERNS,DEFAULT_BACKEND_ALWAYS_REQUIRED,DEFAULT_BACKEND_EVIDENCE_PATHS,DEFAULT_BACKEND_VERIFY_PATTERNS,DEFAULT_BROWSER_ALWAYS_REQUIRED,DEFAULT_BROWSER_VERIFY_PATTERNS,DEFAULT_IGNORED_VERIFY_PATTERNS,DEFAULT_NODE_ALWAYS_REQUIRED,DEFAULT_NODE_EVIDENCE_PATHS,DEFAULT_NODE_VERIFY_PATTERNS,DEFAULT_OAUTH_USAGE_TTL_SECONDS,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS,DEFAULT_OTEL_PORT,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES,ENV_OVERRIDES,OPTIONAL_CYCLES,applyEnvOverrides,findActiveEnvOverride,getActiveCycles,getAnalyticsEmitOnStopMinIntervalSeconds,getAndroidDevToolsMcpEntry,getAutoVerifyEnabled,getBackendDevToolsMcpEntry,getCaptureFileChangeset,getClaudeOauthAccessEnabled,getClaudeOauthAccessUsageTtlSeconds,getConfigLayerPaths,getMaxChangesetBytes,getMaxRetries,getMcpServerEntry,getNodeDevToolsMcpEntry,getOTELEmitMinIntervalSeconds,getOTELEnsureMinIntervalSeconds,getOTELIdleTimeoutSeconds,getOTELPort,getPrivacyEnabled,getRequiredToolsConfig,getStatusLineEmitMinIntervalSeconds,getStatusLineRefreshInterval,getStatusLineRenderDefault,getTargetConfigPath,getTelemetryEnabled,getVerificationContextCommitDepth,getVerificationContextEnabled,getVerificationContextMaxBytes,getVerificationContextSource,getVerificationEnabled,getVerificationMode,getVerificationModel,getVerificationStrict,isAnalyticsApiRequestEventsEnabled,isAnalyticsEmitOnStopEnabled,isAnalyticsEnabled,isAnalyticsStepEventsEnabled,isAnalyticsTurnEventsEnabled,isAutoModeAllowlistEnabled,isCollectorConfigured,isCycleEnabled,isCyclePatternsActive,isIgnoredVerifyPath,isJobQueueEnabled,isOTELEnabled,isRecordingEnabled,isSessionStatusEnabled,loadConfig,requiresVerification,resolveConfigTargetFromFlags,resolveIgnoredVerifyPatterns});
|
|
1
|
+
"use strict";var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var o=(n,e)=>y(n,"name",{value:e,configurable:!0});var de=(n,e)=>{for(var t in e)y(n,t,{get:e[t],enumerable:!0})},pe=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of fe(e))!ge.call(n,i)&&i!==t&&y(n,i,{get:()=>e[i],enumerable:!(r=ue(e,i))||r.enumerable});return n};var be=n=>pe(y({},"__esModule",{value:!0}),n);var Bn={};de(Bn,{ALL_CYCLES:()=>Ee,CONFIG_TARGETS_BY_PRECEDENCE:()=>Re,CYCLES_ENABLED_BY_DEFAULT:()=>P,CYCLE_DEFAULT_VERIFY_PATTERNS:()=>$,CYCLE_TOOL_PREFIXES:()=>_e,CYCLE_TO_SERVER:()=>ye,DEFAULT_ANDROID_ALWAYS_REQUIRED:()=>W,DEFAULT_ANDROID_EVIDENCE_PATHS:()=>Q,DEFAULT_ANDROID_VERIFY_PATTERNS:()=>U,DEFAULT_BACKEND_ALWAYS_REQUIRED:()=>H,DEFAULT_BACKEND_EVIDENCE_PATHS:()=>G,DEFAULT_BACKEND_VERIFY_PATTERNS:()=>V,DEFAULT_BROWSER_ALWAYS_REQUIRED:()=>K,DEFAULT_BROWSER_VERIFY_PATTERNS:()=>M,DEFAULT_IGNORED_VERIFY_PATTERNS:()=>q,DEFAULT_NODE_ALWAYS_REQUIRED:()=>Y,DEFAULT_NODE_EVIDENCE_PATHS:()=>X,DEFAULT_NODE_VERIFY_PATTERNS:()=>F,DEFAULT_OAUTH_USAGE_TTL_SECONDS:()=>ee,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS:()=>re,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS:()=>oe,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS:()=>te,DEFAULT_OTEL_PORT:()=>ne,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH:()=>ae,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES:()=>se,ENV_OVERRIDES:()=>j,OPTIONAL_CYCLES:()=>T,applyEnvOverrides:()=>z,findActiveEnvOverride:()=>Be,getActiveCycles:()=>J,getAnalyticsEmitOnStopMinIntervalSeconds:()=>Rn,getAndroidDevToolsMcpEntry:()=>Ze,getAutoVerifyEnabled:()=>ie,getBackendDevToolsMcpEntry:()=>Je,getCaptureFileChangeset:()=>Tn,getClaudeOauthAccessEnabled:()=>an,getClaudeOauthAccessUsageTtlSeconds:()=>un,getCodexVerifierMode:()=>cn,getConfigLayerPaths:()=>w,getMaxChangesetBytes:()=>xn,getMaxRetries:()=>en,getMcpServerEntry:()=>Qe,getNodeDevToolsMcpEntry:()=>ze,getOTELEmitMinIntervalSeconds:()=>bn,getOTELEnsureMinIntervalSeconds:()=>pn,getOTELIdleTimeoutSeconds:()=>dn,getOTELPort:()=>gn,getPrivacyEnabled:()=>le,getRequiredToolsConfig:()=>Pe,getStatusLineEmitMinIntervalSeconds:()=>sn,getStatusLineRefreshInterval:()=>En,getStatusLineRenderDefault:()=>rn,getTargetConfigPath:()=>Oe,getTelemetryEnabled:()=>ce,getVerificationContextCommitDepth:()=>mn,getVerificationContextEnabled:()=>_n,getVerificationContextMaxBytes:()=>An,getVerificationContextSource:()=>Cn,getVerificationEnabled:()=>O,getVerificationMode:()=>In,getVerificationModel:()=>Ae,getVerificationStrict:()=>yn,isAnalyticsApiRequestEventsEnabled:()=>kn,isAnalyticsEmitOnStopEnabled:()=>jn,isAnalyticsEnabled:()=>wn,isAnalyticsStepEventsEnabled:()=>hn,isAnalyticsTurnEventsEnabled:()=>On,isAutoModeAllowlistEnabled:()=>ln,isCollectorConfigured:()=>R,isCycleEnabled:()=>De,isCyclePatternsActive:()=>Z,isIgnoredVerifyPath:()=>vn,isJobQueueEnabled:()=>nn,isOTELEnabled:()=>fn,isRecordingEnabled:()=>tn,isSessionStatusEnabled:()=>on,loadConfig:()=>c,requiresVerification:()=>Ne,resolveConfigTargetFromFlags:()=>he,resolveIgnoredVerifyPatterns:()=>x});module.exports=be(Bn);var E=require("fs"),b=require("path"),I=require("os"),D=require("./logger");const T=["node","backend","android"],Ee=["browser",...T],P=new Set(["browser"]),ye={browser:"browser-devtools",node:"node-devtools",backend:"backend-devtools",android:"android-devtools"},_e={browser:"bdt_",node:"ndt_",backend:"bedt_",android:"adt_"},M=["*.ts","*.tsx","*.js","*.jsx","*.mjs","*.cjs","*.vue","*.svelte","*.html","*.htm","*.css","*.scss","*.sass","*.less","*.styl","*.py","*.rb","*.erb","*.go","*.rs","*.java","*.kt","*.kts","*.swift","*.c","*.cpp","*.h","*.hpp","*.cs","*.php","*.dart","*.ex","*.exs","*.erl","*.lua","*.r","*.R","*.scala","*.clj","*.cljs","*.zig","*.nim","*.hbs","*.ejs","*.pug","*.jade","*.astro"],F=["server/**/*.{ts,js,mjs,cjs}","src/server/**/*.{ts,js,mjs,cjs}","backend/**/*.{ts,js,mjs,cjs}","api/**/*.{ts,js,mjs,cjs}","src/api/**/*.{ts,js,mjs,cjs}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs}","**/server.{ts,js,mjs,cjs}"],V=["server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/server/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","backend/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","src/api/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","pages/api/**/*.{ts,js,mjs,cjs}","app/api/**/*.{ts,js,mjs,cjs}","routes/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","controllers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","handlers/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","services/**/*.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/server.{ts,js,mjs,cjs,py,go,java,rb,cs,rs,kt,scala,ex,exs,php,clj}","**/main.{go,py,java,rb,kt,scala}"],U=["android/**/*.{kt,java}","app/src/**/*.{kt,java}","mobile/**/*.{kt,java}","src/main/kotlin/**/*.kt","src/main/java/**/*.java","**/*.{kt,java}","**/res/**/*.xml","**/AndroidManifest.xml"],$={browser:M,node:F,backend:V,android:U},q=["**/*.spec.*","**/*.test.*","**/__tests__/**","**/__mocks__/**"];function x(n){const e=n.ignoredVerifyPatterns??[];return[...q,...e]}o(x,"resolveIgnoredVerifyPatterns");const K=["bdt_navigation_go-to","bdt_content_take-screenshot","bdt_a11y_take-aria-snapshot","bdt_o11y_get-console-messages"],Y=["ndt_debug_connect"],X=[{name:"probe",allOf:[{anyOf:["ndt_debug_put-tracepoint","ndt_debug_put-logpoint","ndt_debug_put-exceptionpoint"]},"ndt_debug_get-probe-snapshots"]},{name:"log",allOf:["ndt_debug_get-logs"]}],H=[],G=[{name:"protocol-call",allOf:[{anyOf:["bedt_request_http","bedt_request_grpc","bedt_request_graphql","bedt_request_websocket-open","bedt_request_replay"]}]},{name:"log-evidence",allOf:["bedt_log_register-source",{anyOf:["bedt_log_read","bedt_log_read-multi","bedt_log_follow"]}]},{name:"db-evidence",allOf:["bedt_db_connect",{anyOf:["bedt_db_query","bedt_db_describe-table","bedt_db_list-tables","bedt_db_snapshot","bedt_db_diff","bedt_db_get-changes"]}]}],W=["adt_device_connect"],Q=[{name:"device-evidence",allOf:[{anyOf:["adt_device_launch-app","adt_interaction_tap","adt_interaction_double-tap","adt_interaction_long-press","adt_interaction_input-text","adt_interaction_swipe","adt_interaction_scroll","adt_interaction_press-key","adt_interaction_deep-link"]},"adt_content_take-screenshot","adt_a11y_take-ui-snapshot"]},{name:"log-evidence",allOf:[{anyOf:["adt_o11y_log-read","adt_o11y_log-follow"]}]}],Ce=3;function k(n){if(!(0,E.existsSync)(n))return{};try{return JSON.parse((0,E.readFileSync)(n,"utf-8"))}catch(e){return D.logger.debug(`failed to parse config ${n}: ${e}`),{}}}o(k,"loadJsonFile");function me(n,e){if(!Object.prototype.hasOwnProperty.call(n,"verification"))return;const t=n.verification;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'verification' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.enable' must be boolean. Got ${typeof r.enable}.`);if(Object.prototype.hasOwnProperty.call(r,"auto")&&typeof r.auto!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.auto' must be boolean. Got ${typeof r.auto}.`);if(Object.prototype.hasOwnProperty.call(r,"strict")&&typeof r.strict!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'verification.strict' must be boolean. Got ${typeof r.strict}.`);if(Object.prototype.hasOwnProperty.call(r,"model")){const i=r.model,s=typeof i=="string",l=i!==null&&typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(a=>typeof a=="string");if(!s&&!l)throw new Error(`Invalid IronBee config in ${e}: 'verification.model' must be a string (applies to all clients) or an object of string values (per-client, e.g. { "claude": "sonnet", "codex": "gpt-5.5" }). Got ${Array.isArray(i)?"array":typeof i}.`)}}o(me,"assertVerificationShape");function Ae(n,e){const t=n.verification?.model;if(typeof t=="string")return t.length>0?t:void 0;if(t&&typeof t=="object"){const r=t[e];return typeof r=="string"&&r.length>0?r:void 0}}o(Ae,"getVerificationModel");function ve(n,e){if(!Object.prototype.hasOwnProperty.call(n,"telemetry"))return;const t=n.telemetry;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'telemetry' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'telemetry.enable' must be boolean. Got ${typeof r.enable}.`)}o(ve,"assertTelemetryShape");function Ie(n,e){if(!Object.prototype.hasOwnProperty.call(n,"privacy"))return;const t=n.privacy;if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`Invalid IronBee config in ${e}: 'privacy' must be an object. Expected shape: { "enable": boolean }.`);const r=t;if(Object.prototype.hasOwnProperty.call(r,"enable")&&typeof r.enable!="boolean")throw new Error(`Invalid IronBee config in ${e}: 'privacy.enable' must be boolean. Got ${typeof r.enable}.`)}o(Ie,"assertPrivacyShape");function _(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(_,"mergeCycleConfig");function B(n,e){const t={...n,...e};return t.browser=_(n.browser,e.browser),t.node=_(n.node,e.node),t.backend=_(n.backend,e.backend),t.android=_(n.android,e.android),t.claude=we(n.claude,e.claude),t.codex=je(n.codex,e.codex),t.verification=xe(n.verification,e.verification),t.verificationContext=Te(n.verificationContext,e.verificationContext),t}o(B,"mergeConfigLayers");function Te(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(Te,"mergeVerificationContextConfig");function xe(n,e){if(!(n===void 0&&e===void 0))return{...n??{},...e??{}}}o(xe,"mergeVerificationConfig");function we(n,e){if(n===void 0&&e===void 0)return;const t={...n??{},...e??{}};return(n?.oauthAccess!==void 0||e?.oauthAccess!==void 0)&&(t.oauthAccess={...n?.oauthAccess??{},...e?.oauthAccess??{}}),(n?.autoModeAllowlist!==void 0||e?.autoModeAllowlist!==void 0)&&(t.autoModeAllowlist={...n?.autoModeAllowlist??{},...e?.autoModeAllowlist??{}}),t}o(we,"mergeClaudeConfig");function je(n,e){if(n===void 0&&e===void 0)return;const t={...n??{},...e??{}};return(n?.verifier!==void 0||e?.verifier!==void 0)&&(t.verifier={...n?.verifier??{},...e?.verifier??{}}),t}o(je,"mergeCodexConfig");function w(n){return{global:(0,b.join)((0,I.homedir)(),".ironbee","config.json"),project:n?(0,b.join)(n,".ironbee","config.json"):void 0,local:n?(0,b.join)(n,".ironbee","config.local.json"):void 0}}o(w,"getConfigLayerPaths");const Re=["global","project","local"];function Oe(n,e){const t=w(e);if(n==="global")return t.global;if(n==="project"){if(t.project===void 0)throw new Error("Project layer requested but no projectDir was provided.");return t.project}if(t.local===void 0)throw new Error("Local layer requested but no projectDir was provided.");return t.local}o(Oe,"getTargetConfigPath");function he(n){if(n.global===!0&&n.local===!0)throw new Error("Pass at most one of --global / --local.");return n.global===!0?"global":n.local===!0?"local":"project"}o(he,"resolveConfigTargetFromFlags");function A(n){const e=k(n);return(0,E.existsSync)(n)&&(me(e,n),ve(e,n),Ie(e,n)),e}o(A,"loadAndValidateLayer");const j=[{envVar:"IRONBEE_API_KEY",configPath:"collector.apiKey"},{envVar:"IRONBEE_OAUTH_TOKEN",configPath:"collector.oauthToken"}];function ke(n,e,t){const r=e.split(".");let i=n;for(let s=0;s<r.length-1;s++){const l=r[s],a=i[l];a!=null&&typeof a=="object"&&!Array.isArray(a)?i[l]={...a}:i[l]={},i=i[l]}i[r[r.length-1]]=t}o(ke,"setAtConfigPath");function z(n){let e;for(const t of j){const r=process.env[t.envVar];if(r===void 0||r.length===0)continue;e===void 0&&(e={...n});const i=t.coerce?t.coerce(r):r;ke(e,t.configPath,i)}return e??n}o(z,"applyEnvOverrides");function Be(n){for(const e of j){if(e.configPath!==n)continue;const t=process.env[e.envVar];if(t!==void 0&&t.length>0)return e}}o(Be,"findActiveEnvOverride");function c(n){const e=w(n),t=A(e.global),r=e.project?A(e.project):{},i=e.local?A(e.local):{},s=B(B(t,r),i);return z(s)}o(c,"loadConfig");function Se(n){let e=n.replace(/\{([^}]+)\}/g,(t,r)=>`(${r.split(",").map(i=>i.trim()).join("|")})`);return e=e.replace(/\*\*\//g,"\0DSS\0").replace(/\*\*/g,"\0DS\0").replace(/\*/g,"\0SS\0").replace(/\?/g,"\0QM\0"),e=e.replace(/[.+^$\\[\]]/g,"\\$&"),e=e.replace(/\x00DSS\x00/g,"(?:.*/)?").replace(/\x00DS\x00/g,".*").replace(/\x00SS\x00/g,"[^/]*").replace(/\x00QM\x00/g,"[^/]"),new RegExp(`(^|/)${e}$`)}o(Se,"globToRegExp");function C(n,e){const t=n.replace(/\\/g,"/");for(const r of e)if(Se(r).test(t))return!0;return!1}o(C,"matchesAny");function Le(n,e){if(e==="browser")return n.browser;if(e==="node")return n.node;if(e==="backend")return n.backend;if(e==="android")return n.android}o(Le,"getCycleBlock");function v(n,e){const t=Le(n,e);if(t!==void 0&&t.enable===!1)return[];const r=$[e]??[];if(t===void 0)return P.has(e)?[...r]:[];if(Array.isArray(t.verifyPatterns)&&t.verifyPatterns.length===0)return[];const i=t.verifyPatterns??r,s=t.additionalVerifyPatterns??[];return[...i,...s]}o(v,"getCyclePatterns");function J(n,e){const t=x(e);if(t.length>0&&C(n,t))return[];const r=[];C(n,v(e,"browser"))&&r.push("browser");for(const i of T){const s=v(e,i);s.length>0&&C(n,s)&&r.push(i)}return r}o(J,"getActiveCycles");function Ne(n,e){return J(n,e).length>0}o(Ne,"requiresVerification");function De(n,e){return O(n)?Z(n,e):!1}o(De,"isCycleEnabled");function Z(n,e){return v(n,e).length>0}o(Z,"isCyclePatternsActive");function Pe(n,e){let t,r;if(e==="browser"?(t=n.browser?.alwaysRequired??K,r=n.browser?.evidencePaths??[]):e==="node"?(t=n.node?.alwaysRequired??Y,r=n.node?.evidencePaths??X):e==="backend"?(t=n.backend?.alwaysRequired??H,r=n.backend?.evidencePaths??G):e==="android"?(t=n.android?.alwaysRequired??W,r=n.android?.evidencePaths??Q):(t=[],r=[]),t.length===0&&r.length===0)throw new Error(`Invalid required-tools config for cycle '${e}': both 'alwaysRequired' and 'evidencePaths' are empty. At least one must specify required tools.`);return{alwaysRequired:t,evidencePaths:r}}o(Pe,"getRequiredToolsConfig");const S="npx",Me="^0.12.0",L=["-y",`@ironbee-ai/devtools@${Me}`],Fe={TOOL_NAME_PREFIX:"bdt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ve={PLATFORM:"node",TOOL_NAME_PREFIX:"ndt_",TOOL_INPUT_METADATA_ENABLE:"true"},Ue={PLATFORM:"backend",TOOL_NAME_PREFIX:"bedt_",TOOL_INPUT_METADATA_ENABLE:"true"},$e={PLATFORM:"android",TOOL_NAME_PREFIX:"adt_",TOOL_INPUT_METADATA_ENABLE:"true"},qe={BROWSER_DEVTOOLS_INSTALL_CHROMIUM:"true"},Ke={},Ye={},Xe={};function He(n){return ce(n)?{}:{TELEMETRY_ENABLE:"false"}}o(He,"buildTelemetryEnv");function Ge(n){return le(n)?{COLLECTOR_EVENTS_TOOL_DETAILS_ENABLE:"false",COLLECTOR_ARTIFACTS_ENABLE:"false"}:{}}o(Ge,"buildPrivacyEnv");function We(n,e){if(!R(n))return{};const t=n.collector,i=k((0,b.join)((0,I.homedir)(),".ironbee","config.json")).collector??{},s=typeof i.oauthToken=="string"&&i.oauthToken.length>0,l=typeof i.apiKey=="string"&&i.apiKey.length>0;let a;t.oauthToken?a=s?"X-OAuth-Token=${file:~/.ironbee/config.json#collector.oauthToken}":`X-OAuth-Token=${t.oauthToken}`:a=l?"X-API-Key=${file:~/.ironbee/config.json#collector.apiKey}":`X-API-Key=${t.apiKey}`;const u={OTEL_ENABLE:"true",OTEL_EXPORTER_HTTP_URL:t.url,OTEL_EXPORTER_HTTP_HEADERS:a,OTEL_EXPORTER_TYPE:"otlp/http-protobuf"};return e==="browser"&&(u.OTEL_INSTRUMENTATION_USER_INTERACTION_EVENTS="change,input,click",u.BROWSER_HEADLESS_ENABLE="true"),u}o(We,"buildOTELEnv");function m(n,e,t,r,i){const s=We(n,i),l=He(n),a=Ge(n),u=n[e];if(u&&typeof u=="object"&&!Array.isArray(u)){const f=u;if(f.mcp&&typeof f.mcp=="object"&&!Array.isArray(f.mcp)){const g={...f.mcp},d={...s,...l,...a,...g.env??{},...t};return g.env=d,g}const h={};if(f.env&&typeof f.env=="object"&&!Array.isArray(f.env)){const g=f.env;for(const d of Object.keys(g))typeof g[d]=="string"&&(h[d]=g[d])}return{command:S,args:[...L],env:{...r,...s,...l,...a,...h,...t}}}return{command:S,args:[...L],env:{...r,...s,...l,...a,...t}}}o(m,"buildMcpEntry");function Qe(n){const e=c(n);return m(e,"browserDevTools",Fe,qe,"browser")}o(Qe,"getMcpServerEntry");function ze(n){const e=c(n);return m(e,"nodeDevTools",Ve,Ke,"node")}o(ze,"getNodeDevToolsMcpEntry");function Je(n){const e=c(n);return m(e,"backendDevTools",Ue,Ye,"backend")}o(Je,"getBackendDevToolsMcpEntry");function Ze(n){const e=c(n);return m(e,"androidDevTools",$e,Xe,"android")}o(Ze,"getAndroidDevToolsMcpEntry");function en(n){return typeof n.maxRetries=="number"&&n.maxRetries>0?n.maxRetries:Ce}o(en,"getMaxRetries");function R(n){if(process.env.IRONBEE_COLLECTOR==="false")return!1;const e=n.collector;if(!e||e.enable===!1||typeof e.url!="string"||e.url.length===0)return!1;const t=typeof e.oauthToken=="string"&&e.oauthToken.length>0,r=typeof e.apiKey=="string"&&e.apiKey.length>0;return!(!t&&!r)}o(R,"isCollectorConfigured");function nn(n){const e=c(n);return p(e,e.jobQueue)}o(nn,"isJobQueueEnabled");function tn(n){const e=c(n);return p(e,e.recording)}o(tn,"isRecordingEnabled");function on(n){return p(n,n.statusLine)}o(on,"isSessionStatusEnabled");function rn(n){const e=n.statusLine;return e!==void 0&&e.renderDefault===!0}o(rn,"getStatusLineRenderDefault");function sn(n){const e=n.statusLine?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:10}o(sn,"getStatusLineEmitMinIntervalSeconds");const ee=60;function an(n){return n.claude?.oauthAccess?.enable!==!1}o(an,"getClaudeOauthAccessEnabled");function cn(n){return n.codex?.verifier?.mode==="main-agent"?"main-agent":"sub-agent"}o(cn,"getCodexVerifierMode");function ln(n){return n.claude?.autoModeAllowlist?.enable!==!1}o(ln,"isAutoModeAllowlistEnabled");function un(n){const e=n.claude?.oauthAccess?.usageTtlSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:ee}o(un,"getClaudeOauthAccessUsageTtlSeconds");const ne=15986,te=600,oe=30,re=0;function fn(n){return p(n,n.otel)}o(fn,"isOTELEnabled");function gn(n){const e=n.otel?.port;return typeof e=="number"&&Number.isInteger(e)&&e>0&&e<65536?e:ne}o(gn,"getOTELPort");function dn(n){const e=n.otel?.idleTimeoutSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:te}o(dn,"getOTELIdleTimeoutSeconds");function pn(n){const e=n.otel?.ensureMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:oe}o(pn,"getOTELEnsureMinIntervalSeconds");function bn(n){const e=n.otel?.emitMinIntervalSeconds;return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:re}o(bn,"getOTELEmitMinIntervalSeconds");function En(n){const e=n.statusLine?.refreshInterval;if(typeof e=="number"&&Number.isFinite(e)&&e>=1)return e}o(En,"getStatusLineRefreshInterval");function p(n,e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e.enable!==!1:R(n)}o(p,"isFeatureEnabledWithCollectorAutoEnable");function Ln(n){return n==null||typeof n!="object"||Array.isArray(n)?!1:n.enable!==!1}o(Ln,"isPresenceEnabled");function O(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(O,"getVerificationEnabled");function ie(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.auto===!0}o(ie,"getAutoVerifyEnabled");function yn(n){const e=n.verification;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.strict===!0}o(yn,"getVerificationStrict");const se=65536,ae=1;function _n(n){const e=n.verificationContext;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(_n,"getVerificationContextEnabled");function Cn(n){return n.verificationContext?.source==="actions"?"actions":"git"}o(Cn,"getVerificationContextSource");function mn(n){const e=n.verificationContext?.commitDepth;return typeof e=="number"&&Number.isFinite(e)&&e>=0?Math.floor(e):ae}o(mn,"getVerificationContextCommitDepth");function An(n){const e=n.verificationContext?.maxBytes;return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):se}o(An,"getVerificationContextMaxBytes");function vn(n,e){const t=x(n);return t.length>0&&C(e,t)}o(vn,"isIgnoredVerifyPath");function In(n){return O(n)?ie(n)?"enforce":"assist":"monitor"}o(In,"getVerificationMode");function ce(n){const e=n.telemetry;return e==null||typeof e!="object"||Array.isArray(e)?!0:e.enable!==!1}o(ce,"getTelemetryEnabled");function le(n){const e=n.privacy;return e==null||typeof e!="object"||Array.isArray(e)?!1:e.enable===!0}o(le,"getPrivacyEnabled");const N=65536;function Tn(n){const e=n.fileChange;return!e||typeof e!="object"||Array.isArray(e)?!1:e.captureChangeset===!0}o(Tn,"getCaptureFileChangeset");function xn(n){const e=n.fileChange;if(!e||typeof e!="object"||Array.isArray(e))return N;const t=e.maxChangesetBytes;return typeof t!="number"||!Number.isFinite(t)||t<=0?N:Math.floor(t)}o(xn,"getMaxChangesetBytes");function wn(n){const e=c(n);return p(e,e.analytics)}o(wn,"isAnalyticsEnabled");function jn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitOnStop!==!1}o(jn,"isAnalyticsEmitOnStopEnabled");function Rn(n){const t=c(n).analytics;if(t===null||typeof t!="object"||Array.isArray(t))return 0;const r=t.emitOnStopMinIntervalSeconds;return typeof r=="number"&&r>=0?r:0}o(Rn,"getAnalyticsEmitOnStopMinIntervalSeconds");function On(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitTurnEvents===!0}o(On,"isAnalyticsTurnEventsEnabled");function hn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!1:t.emitStepEvents===!0}o(hn,"isAnalyticsStepEventsEnabled");function kn(n){const t=c(n).analytics;return t===null||typeof t!="object"||Array.isArray(t)?!0:t.emitApiRequestEvents!==!1}o(kn,"isAnalyticsApiRequestEventsEnabled");0&&(module.exports={ALL_CYCLES,CONFIG_TARGETS_BY_PRECEDENCE,CYCLES_ENABLED_BY_DEFAULT,CYCLE_DEFAULT_VERIFY_PATTERNS,CYCLE_TOOL_PREFIXES,CYCLE_TO_SERVER,DEFAULT_ANDROID_ALWAYS_REQUIRED,DEFAULT_ANDROID_EVIDENCE_PATHS,DEFAULT_ANDROID_VERIFY_PATTERNS,DEFAULT_BACKEND_ALWAYS_REQUIRED,DEFAULT_BACKEND_EVIDENCE_PATHS,DEFAULT_BACKEND_VERIFY_PATTERNS,DEFAULT_BROWSER_ALWAYS_REQUIRED,DEFAULT_BROWSER_VERIFY_PATTERNS,DEFAULT_IGNORED_VERIFY_PATTERNS,DEFAULT_NODE_ALWAYS_REQUIRED,DEFAULT_NODE_EVIDENCE_PATHS,DEFAULT_NODE_VERIFY_PATTERNS,DEFAULT_OAUTH_USAGE_TTL_SECONDS,DEFAULT_OTEL_EMIT_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_ENSURE_MIN_INTERVAL_SECONDS,DEFAULT_OTEL_IDLE_TIMEOUT_SECONDS,DEFAULT_OTEL_PORT,DEFAULT_VERIFICATION_CONTEXT_COMMIT_DEPTH,DEFAULT_VERIFICATION_CONTEXT_MAX_BYTES,ENV_OVERRIDES,OPTIONAL_CYCLES,applyEnvOverrides,findActiveEnvOverride,getActiveCycles,getAnalyticsEmitOnStopMinIntervalSeconds,getAndroidDevToolsMcpEntry,getAutoVerifyEnabled,getBackendDevToolsMcpEntry,getCaptureFileChangeset,getClaudeOauthAccessEnabled,getClaudeOauthAccessUsageTtlSeconds,getCodexVerifierMode,getConfigLayerPaths,getMaxChangesetBytes,getMaxRetries,getMcpServerEntry,getNodeDevToolsMcpEntry,getOTELEmitMinIntervalSeconds,getOTELEnsureMinIntervalSeconds,getOTELIdleTimeoutSeconds,getOTELPort,getPrivacyEnabled,getRequiredToolsConfig,getStatusLineEmitMinIntervalSeconds,getStatusLineRefreshInterval,getStatusLineRenderDefault,getTargetConfigPath,getTelemetryEnabled,getVerificationContextCommitDepth,getVerificationContextEnabled,getVerificationContextMaxBytes,getVerificationContextSource,getVerificationEnabled,getVerificationMode,getVerificationModel,getVerificationStrict,isAnalyticsApiRequestEventsEnabled,isAnalyticsEmitOnStopEnabled,isAnalyticsEnabled,isAnalyticsStepEventsEnabled,isAnalyticsTurnEventsEnabled,isAutoModeAllowlistEnabled,isCollectorConfigured,isCycleEnabled,isCyclePatternsActive,isIgnoredVerifyPath,isJobQueueEnabled,isOTELEnabled,isRecordingEnabled,isSessionStatusEnabled,loadConfig,requiresVerification,resolveConfigTargetFromFlags,resolveIgnoredVerifyPatterns});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var L=(e,S)=>{for(var o in S)r(e,o,{get:S[o],enumerable:!0})},N=(e,S,o,t)=>{if(S&&typeof S=="object"||typeof S=="function")for(let n of E(S))!I.call(e,n)&&n!==o&&r(e,n,{get:()=>S[n],enumerable:!(t=A(S,n))||t.enumerable});return e};var _=e=>N(r({},"__esModule",{value:!0}),e);var c={};L(c,{INSTALL_SCHEMA_VERSION:()=>b});module.exports=_(c);const b=
|
|
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=8;0&&(module.exports={INSTALL_SCHEMA_VERSION});
|