failproofai 1.0.2-beta.4 → 1.0.2-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +5 -5
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
  6. package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
  11. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +6 -6
  12. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
  13. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
  15. package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.rsc +14 -14
  20. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  21. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +13 -13
  22. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/standalone/.next/server/app/api/audit/invite/route.js.nft.json +1 -1
  24. package/.next/standalone/.next/server/app/api/audit/run/route.js +4 -4
  25. package/.next/standalone/.next/server/app/api/audit/run/route.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/api/audit/status/route.js.nft.json +1 -1
  27. package/.next/standalone/.next/server/app/api/auth/login-request/route.js.nft.json +1 -1
  28. package/.next/standalone/.next/server/app/api/auth/login-verify/route.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/api/auth/logout/route.js.nft.json +1 -1
  30. package/.next/standalone/.next/server/app/api/auth/status/route.js.nft.json +1 -1
  31. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js +1 -1
  32. package/.next/standalone/.next/server/app/api/download/[project]/[session]/route.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/audit/page/build-manifest.json +2 -2
  34. package/.next/standalone/.next/server/app/audit/page/server-reference-manifest.json +2 -2
  35. package/.next/standalone/.next/server/app/audit/page.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  37. package/.next/standalone/.next/server/app/index.html +1 -1
  38. package/.next/standalone/.next/server/app/index.rsc +14 -14
  39. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +13 -13
  40. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +14 -14
  41. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  42. package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
  43. package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
  44. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  45. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  46. package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
  47. package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +14 -14
  48. package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
  49. package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
  50. package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
  51. package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
  52. package/.next/standalone/.next/server/app/project/[name]/page.js +2 -2
  53. package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
  55. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
  56. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
  57. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
  58. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +2 -2
  59. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
  62. package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
  63. package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
  64. package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
  65. package/.next/standalone/.next/server/app/settings/page/build-manifest.json +2 -2
  66. package/.next/standalone/.next/server/app/settings/page/server-reference-manifest.json +4 -4
  67. package/.next/standalone/.next/server/app/settings/page.js.nft.json +1 -1
  68. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  69. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03r-lqq._.js +3 -0
  70. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0o07qi9._.js +1 -1
  71. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12021ot._.js +3 -0
  72. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1le9jqc._.js +3 -0
  73. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__0clqfab._.js → [root-of-the-server]__1zkek3z._.js} +2 -2
  74. package/.next/standalone/.next/server/chunks/_0lxbzdq._.js +1 -1
  75. package/.next/standalone/.next/server/chunks/{_1lbh81u._.js → _12moi5-._.js} +1 -1
  76. package/.next/standalone/.next/server/chunks/_1ek68ln._.js +5 -5
  77. package/.next/standalone/.next/server/chunks/_1zuiiy3._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_1nxcc4v._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__1m84s36._.js → [root-of-the-server]__00-s7h8._.js} +1 -1
  80. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__013jr2b._.js +2 -2
  81. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__01wy8d-._.js +2 -2
  82. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__02npjtd._.js +2 -2
  83. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__07gm3zl._.js +3 -3
  84. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da85px._.js +2 -2
  85. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ftmoxc._.js +2 -2
  86. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0oa1lav._.js +1 -1
  87. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p-5p8u._.js +2 -2
  88. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0s740oi._.js +2 -2
  89. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__14muoc4._.js → [root-of-the-server]__0stn0gx._.js} +2 -2
  90. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0jzbk4_._.js → [root-of-the-server]__190won8._.js} +1 -1
  91. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ctpynv._.js +1 -1
  92. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1p2otjt._.js +2 -2
  93. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0rsd3ll._.js → [root-of-the-server]__1sc84bb._.js} +2 -2
  94. package/.next/standalone/.next/server/chunks/ssr/_08x1r5t._.js +1 -1
  95. package/.next/standalone/.next/server/chunks/ssr/_1ddpc5g._.js +1 -1
  96. package/.next/standalone/.next/server/chunks/ssr/{_1db3-8n._.js → _1if9ixi._.js} +2 -2
  97. package/.next/standalone/.next/server/chunks/ssr/{_1dkh76z._.js → _1kesqs-._.js} +2 -2
  98. package/.next/standalone/.next/server/chunks/ssr/{_0ovx4lz._.js → _1km9-gn._.js} +1 -1
  99. package/.next/standalone/.next/server/chunks/ssr/_1u8-lu2._.js +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/_1zopuov._.js +1 -1
  101. package/.next/standalone/.next/server/chunks/ssr/app_audit__components_audit-dashboard_tsx_0p9ud47._.js +1 -1
  102. package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_1kp6l3x._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_19dqvpc._.js +1 -1
  104. package/.next/standalone/.next/server/chunks/ssr/app_settings_settings-client_tsx_20lq-mq._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/lib_1cf5ya2._.js +3 -0
  106. package/.next/standalone/.next/server/chunks/ssr/lib_opencode-projects_ts_15bjxkm._.js +1 -1
  107. package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
  108. package/.next/standalone/.next/server/pages/404.html +1 -1
  109. package/.next/standalone/.next/server/pages/500.html +1 -1
  110. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  111. package/.next/standalone/.next/server/server-reference-manifest.json +19 -19
  112. package/.next/standalone/.next/static/chunks/{0lshnlpy1m6bc.js → 0tyt-3a5rtzy8.js} +1 -1
  113. package/.next/standalone/.next/static/chunks/{0ds64uculrze8.js → 21r7iw3rmixf5.js} +1 -1
  114. package/.next/standalone/.next/static/chunks/{07j2u70_3qsx8.js → 26lfjhb2kzzgb.js} +1 -1
  115. package/.next/standalone/.next/static/chunks/{2dbi_x0c8n8fi.js → 2_27jraat038x.js} +1 -1
  116. package/.next/standalone/.next/static/chunks/{0d_re32wscs0b.js → 2hwc8e923g5df.js} +1 -1
  117. package/.next/standalone/.next/static/chunks/{1q76jk_1_wgjq.js → 33np9nrh1mvj9.js} +1 -1
  118. package/.next/standalone/.next/static/chunks/{0k_yvjc1yz0pq.js → 36-8i_vbkh85w.js} +1 -1
  119. package/.next/standalone/.next/static/chunks/{1o0ahew9568ls.js → 391tpdqcas7rq.js} +1 -1
  120. package/.next/standalone/.next/static/chunks/{00_t-xvc59tkb.js → 3_b73tc78jwsq.js} +1 -1
  121. package/.next/standalone/.next/static/chunks/{1oz0svxwt9574.js → 3i8rg2fv9nd6e.js} +2 -2
  122. package/.next/standalone/.next/static/chunks/{2817_8e94ah9z.js → 3jqm8ubpv3i-4.js} +1 -1
  123. package/.next/standalone/.next/static/chunks/{turbopack-17utl_jw0wj11.js → turbopack-2x-o099q64i8h.js} +1 -1
  124. package/.next/standalone/lib/opencode-db.ts +77 -0
  125. package/.next/standalone/lib/opencode-projects.ts +37 -41
  126. package/.next/standalone/lib/opencode-sessions.ts +59 -36
  127. package/.next/standalone/package.json +9 -9
  128. package/.next/standalone/server.js +1 -1
  129. package/bin/failproofai.mjs +24 -9
  130. package/dist/cli.mjs +734 -382
  131. package/dist/worker.mjs +179 -164
  132. package/lib/opencode-db.ts +77 -0
  133. package/lib/opencode-projects.ts +37 -41
  134. package/lib/opencode-sessions.ts +59 -36
  135. package/package.json +9 -9
  136. package/src/audit/cache.ts +167 -11
  137. package/src/audit/cli-adapters/claude.ts +111 -1
  138. package/src/audit/cli-adapters/index.ts +31 -1
  139. package/src/audit/index.ts +131 -11
  140. package/src/hooks/manager.ts +50 -3
  141. package/src/hooks/pack-cli.ts +237 -11
  142. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1l-khtb._.js +0 -3
  143. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1mhmdzs._.js +0 -3
  144. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qxztj-._.js +0 -3
  145. /package/.next/standalone/.next/static/{0iNzkTsP6rh14Rj5WL17o → 59jsH11LoyXu9UBoHvgGM}/_buildManifest.js +0 -0
  146. /package/.next/standalone/.next/static/{0iNzkTsP6rh14Rj5WL17o → 59jsH11LoyXu9UBoHvgGM}/_clientMiddlewareManifest.js +0 -0
  147. /package/.next/standalone/.next/static/{0iNzkTsP6rh14Rj5WL17o → 59jsH11LoyXu9UBoHvgGM}/_ssgManifest.js +0 -0
@@ -22,7 +22,7 @@ ${h}
22
22
  ${c}`:c;else if(d||a.directives.docStart||!e)a.commentBefore=c;else if(h.isCollection(e)&&!e.flow&&e.items.length>0){let a=e.items[0];h.isPair(a)&&(a=a.key);let b=a.commentBefore;a.commentBefore=b?`${c}
23
23
  ${b}`:c}else{let a=e.commentBefore;e.commentBefore=a?`${c}
24
24
  ${a}`:c}}if(b){for(let b=0;b<this.errors.length;++b)a.errors.push(this.errors[b]);for(let b=0;b<this.warnings.length;++b)a.warnings.push(this.warnings[b])}else a.errors=this.errors,a.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:l(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(a,b=!1,c=-1){for(let b of a)yield*this.next(b);yield*this.end(b,c)}*next(a){switch(d.env.LOG_STREAM&&console.dir(a,{depth:null}),a.type){case"directive":this.directives.add(a.source,(b,c,d)=>{let e=k(a);e[0]+=b,this.onError(e,"BAD_DIRECTIVE",c,d)}),this.prelude.push(a.source),this.atDirectives=!0;break;case"document":{let b=i.composeDoc(this.options,this.directives,a,this.onError);this.atDirectives&&!b.directives.docStart&&this.onError(a,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(b,!1),this.doc&&(yield this.doc),this.doc=b,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(a.source);break;case"error":{let b=a.source?`${a.message}: ${JSON.stringify(a.source)}`:a.message,c=new g.YAMLParseError(k(a),"UNEXPECTED_TOKEN",b);this.atDirectives||!this.doc?this.errors.push(c):this.doc.errors.push(c);break}case"doc-end":{if(!this.doc){this.errors.push(new g.YAMLParseError(k(a),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let b=j.resolveEnd(a.end,a.offset+a.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),b.comment){let a=this.doc.comment;this.doc.comment=a?`${a}
25
- ${b.comment}`:b.comment}this.doc.range[2]=b.offset;break}default:this.errors.push(new g.YAMLParseError(k(a),"UNEXPECTED_TOKEN",`Unsupported token ${a.type}`))}}*end(a=!1,b=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(a){let a=Object.assign({_directives:this.directives},this.options),c=new f.Document(void 0,a);this.atDirectives&&this.onError(b,"MISSING_CHAR","Missing directives-end indicator line"),c.range=[0,b,b],this.decorate(c,!1),yield c}}}},86888,(a,b,c)=>{"use strict";var d=a.r(71014),e=a.r(21525),f=a.r(25717),g=a.r(88583);function h(a,b){if(b)for(let c of b)switch(c.type){case"space":case"comment":a.push(c);break;case"newline":return a.push(c),!0}return!1}function i(a,b,c){switch(a.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":a.type=c,a.source=b;break;case"block-scalar":{let d=a.props.slice(1),e=b.length;for(let b of("block-scalar-header"===a.props[0].type&&(e-=a.props[0].source.length),d))b.offset+=e;delete a.props,Object.assign(a,{type:c,source:b,end:d});break}case"block-map":case"block-seq":{let d={type:"newline",offset:a.offset+b.length,indent:a.indent,source:"\n"};delete a.items,Object.assign(a,{type:c,source:b,end:[d]});break}default:{let d="indent"in a?a.indent:-1,e="end"in a&&Array.isArray(a.end)?a.end.filter(a=>"space"===a.type||"comment"===a.type||"newline"===a.type):[];for(let b of Object.keys(a))"type"!==b&&"offset"!==b&&delete a[b];Object.assign(a,{type:c,indent:d,source:b,end:e})}}}c.createScalarToken=function(a,b){let{implicitKey:c=!1,indent:d,inFlow:e=!1,offset:f=-1,type:i="PLAIN"}=b,j=g.stringifyString({type:i,value:a},{implicitKey:c,indent:d>0?" ".repeat(d):"",inFlow:e,options:{blockQuote:!0,lineWidth:-1}}),k=b.end??[{type:"newline",offset:-1,indent:d,source:"\n"}];switch(j[0]){case"|":case">":{let a=j.indexOf("\n"),b=j.substring(0,a),c=j.substring(a+1)+"\n",e=[{type:"block-scalar-header",offset:f,indent:d,source:b}];return h(e,k)||e.push({type:"newline",offset:-1,indent:d,source:"\n"}),{type:"block-scalar",offset:f,indent:d,props:e,source:c}}case'"':return{type:"double-quoted-scalar",offset:f,indent:d,source:j,end:k};case"'":return{type:"single-quoted-scalar",offset:f,indent:d,source:j,end:k};default:return{type:"scalar",offset:f,indent:d,source:j,end:k}}},c.resolveAsScalar=function(a,b=!0,c){if(a){let g=(a,b,d)=>{let e="number"==typeof a?a:Array.isArray(a)?a[0]:a.offset;if(c)c(e,b,d);else throw new f.YAMLParseError([e,e+1],b,d)};switch(a.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return e.resolveFlowScalar(a,b,g);case"block-scalar":return d.resolveBlockScalar({options:{strict:b}},a,g)}}return null},c.setScalarValue=function(a,b,c={}){let{afterKey:d=!1,implicitKey:e=!1,inFlow:f=!1,type:j}=c,k="indent"in a?a.indent:null;if(d&&"number"==typeof k&&(k+=2),!j)switch(a.type){case"single-quoted-scalar":j="QUOTE_SINGLE";break;case"double-quoted-scalar":j="QUOTE_DOUBLE";break;case"block-scalar":{let b=a.props[0];if("block-scalar-header"!==b.type)throw Error("Invalid block scalar header");j=">"===b.source[0]?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:j="PLAIN"}let l=g.stringifyString({type:j,value:b},{implicitKey:e||null===k,indent:null!==k&&k>0?" ".repeat(k):"",inFlow:f,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":!function(a,b){let c=b.indexOf("\n"),d=b.substring(0,c),e=b.substring(c+1)+"\n";if("block-scalar"===a.type){let b=a.props[0];if("block-scalar-header"!==b.type)throw Error("Invalid block scalar header");b.source=d,a.source=e}else{let{offset:b}=a,c="indent"in a?a.indent:-1,f=[{type:"block-scalar-header",offset:b,indent:c,source:d}];for(let b of(h(f,"end"in a?a.end:void 0)||f.push({type:"newline",offset:-1,indent:c,source:"\n"}),Object.keys(a)))"type"!==b&&"offset"!==b&&delete a[b];Object.assign(a,{type:"block-scalar",indent:c,props:f,source:e})}}(a,l);break;case'"':i(a,l,"double-quoted-scalar");break;case"'":i(a,l,"single-quoted-scalar");break;default:i(a,l,"scalar")}}},25449,(a,b,c)=>{"use strict";function d(a){switch(a.type){case"block-scalar":{let b="";for(let c of a.props)b+=d(c);return b+a.source}case"block-map":case"block-seq":{let b="";for(let c of a.items)b+=e(c);return b}case"flow-collection":{let b=a.start.source;for(let c of a.items)b+=e(c);for(let c of a.end)b+=c.source;return b}case"document":{let b=e(a);if(a.end)for(let c of a.end)b+=c.source;return b}default:{let b=a.source;if("end"in a&&a.end)for(let c of a.end)b+=c.source;return b}}}function e({start:a,key:b,sep:c,value:f}){let g="";for(let b of a)g+=b.source;if(b&&(g+=d(b)),c)for(let a of c)g+=a.source;return f&&(g+=d(f)),g}c.stringify=a=>"type"in a?d(a):e(a)},2135,(a,b,c)=>{"use strict";let d=Symbol("break visit"),e=Symbol("skip children"),f=Symbol("remove item");function g(a,b){"type"in a&&"document"===a.type&&(a={start:a.start,value:a.value}),function a(b,c,e){let g=e(c,b);if("symbol"==typeof g)return g;for(let h of["key","value"]){let i=c[h];if(i&&"items"in i){for(let c=0;c<i.items.length;++c){let g=a(Object.freeze(b.concat([[h,c]])),i.items[c],e);if("number"==typeof g)c=g-1;else{if(g===d)return d;g===f&&(i.items.splice(c,1),c-=1)}}"function"==typeof g&&"key"===h&&(g=g(c,b))}}return"function"==typeof g?g(c,b):g}(Object.freeze([]),a,b)}g.BREAK=d,g.SKIP=e,g.REMOVE=f,g.itemAtPath=(a,b)=>{let c=a;for(let[a,d]of b){let b=c?.[a];if(!b||!("items"in b))return;c=b.items[d]}return c},g.parentCollection=(a,b)=>{let c=g.itemAtPath(a,b.slice(0,-1)),d=b[b.length-1][0],e=c?.[d];if(e&&"items"in e)return e;throw Error("Parent collection not found")},c.visit=g},2704,(a,b,c)=>{"use strict";var d=a.r(86888),e=a.r(25449),f=a.r(2135);c.createScalarToken=d.createScalarToken,c.resolveAsScalar=d.resolveAsScalar,c.setScalarValue=d.setScalarValue,c.stringify=e.stringify,c.visit=f.visit,c.BOM="\uFEFF",c.DOCUMENT="\x02",c.FLOW_END="\x18",c.SCALAR="\x1f",c.isCollection=a=>!!a&&"items"in a,c.isScalar=a=>!!a&&("scalar"===a.type||"single-quoted-scalar"===a.type||"double-quoted-scalar"===a.type||"block-scalar"===a.type),c.prettyToken=function(a){switch(a){case"\uFEFF":return"<BOM>";case"\x02":return"<DOC>";case"\x18":return"<FLOW_END>";case"\x1f":return"<SCALAR>";default:return JSON.stringify(a)}},c.tokenType=function(a){switch(a){case"\uFEFF":return"byte-order-mark";case"\x02":return"doc-mode";case"\x18":return"flow-error-end";case"\x1f":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(a[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}},66326,(a,b,c)=>{"use strict";var d=a.r(2704);function e(a){switch(a){case void 0:case" ":case"\n":case"\r":case" ":return!0;default:return!1}}let f=new Set("0123456789ABCDEFabcdef"),g=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),h=new Set(",[]{}"),i=new Set(" ,[]{}\n\r "),j=a=>!a||i.has(a);c.Lexer=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(a,b=!1){if(a){if("string"!=typeof a)throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+a:a,this.lineEndPos=null}this.atEnd=!b;let c=this.next??"stream";for(;c&&(b||this.hasChars(1));)c=yield*this.parseNext(c)}atLineEnd(){let a=this.pos,b=this.buffer[a];for(;" "===b||" "===b;)b=this.buffer[++a];return!b||"#"===b||"\n"===b||"\r"===b&&"\n"===this.buffer[a+1]}charAt(a){return this.buffer[this.pos+a]}continueScalar(a){let b=this.buffer[a];if(this.indentNext>0){let c=0;for(;" "===b;)b=this.buffer[++c+a];if("\r"===b){let b=this.buffer[c+a+1];if("\n"===b||!b&&!this.atEnd)return a+c+1}return"\n"!==b&&!(c>=this.indentNext)&&(b||this.atEnd)?-1:a+c}if("-"===b||"."===b){let b=this.buffer.substr(a,3);if(("---"===b||"..."===b)&&e(this.buffer[a+3]))return -1}return a}getLine(){let a=this.lineEndPos;return(("number"!=typeof a||-1!==a&&a<this.pos)&&(a=this.buffer.indexOf("\n",this.pos),this.lineEndPos=a),-1===a)?this.atEnd?this.buffer.substring(this.pos):null:("\r"===this.buffer[a-1]&&(a-=1),this.buffer.substring(this.pos,a))}hasChars(a){return this.pos+a<=this.buffer.length}setNext(a){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=a,null}peek(a){return this.buffer.substr(this.pos,a)}*parseNext(a){switch(a){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let a=this.getLine();if(null===a)return this.setNext("stream");if(a[0]===d.BOM&&(yield*this.pushCount(1),a=a.substring(1)),"%"===a[0]){let b=a.length,c=a.indexOf("#");for(;-1!==c;){let d=a[c-1];if(" "===d||" "===d){b=c-1;break}c=a.indexOf("#",c+1)}for(;;){let c=a[b-1];if(" "===c||" "===c)b-=1;else break}let d=(yield*this.pushCount(b))+(yield*this.pushSpaces(!0));return yield*this.pushCount(a.length-d),this.pushNewline(),"stream"}if(this.atLineEnd()){let b=yield*this.pushSpaces(!0);return yield*this.pushCount(a.length-b),yield*this.pushNewline(),"stream"}return yield d.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let a=this.charAt(0);if(!a&&!this.atEnd)return this.setNext("line-start");if("-"===a||"."===a){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let a=this.peek(3);if(("---"===a||"..."===a)&&e(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"---"===a?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!e(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[a,b]=this.peek(2);if(!b&&!this.atEnd)return this.setNext("block-start");if(("-"===a||"?"===a||":"===a)&&e(b)){let a=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=a,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let a=this.getLine();if(null===a)return this.setNext("doc");let b=yield*this.pushIndicators();switch(a[b]){case"#":yield*this.pushCount(a.length-b);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(j),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return b+=yield*this.parseBlockScalarHeader(),b+=yield*this.pushSpaces(!0),yield*this.pushCount(a.length-b),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let a,b,c=-1;do(a=yield*this.pushNewline())>0?(b=yield*this.pushSpaces(!1),this.indentValue=c=b):b=0,b+=yield*this.pushSpaces(!0);while(a+b>0)let f=this.getLine();if(null===f)return this.setNext("flow");if((-1!==c&&c<this.indentNext&&"#"!==f[0]||0===c&&(f.startsWith("---")||f.startsWith("..."))&&e(f[3]))&&(c!==this.indentNext-1||1!==this.flowLevel||"]"!==f[0]&&"}"!==f[0]))return this.flowLevel=0,yield d.FLOW_END,yield*this.parseLineStart();let g=0;for(;","===f[g];)g+=yield*this.pushCount(1),g+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(f[g+=yield*this.pushIndicators()]){case void 0:return"flow";case"#":return yield*this.pushCount(f.length-g),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(j),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||e(a)||","===a)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let a=this.charAt(0),b=this.buffer.indexOf(a,this.pos+1);if("'"===a)for(;-1!==b&&"'"===this.buffer[b+1];)b=this.buffer.indexOf("'",b+2);else for(;-1!==b;){let a=0;for(;"\\"===this.buffer[b-1-a];)a+=1;if(a%2==0)break;b=this.buffer.indexOf('"',b+1)}let c=this.buffer.substring(0,b),d=c.indexOf("\n",this.pos);if(-1!==d){for(;-1!==d;){let a=this.continueScalar(d+1);if(-1===a)break;d=c.indexOf("\n",a)}-1!==d&&(b=d-("\r"===c[d-1]?2:1))}if(-1===b){if(!this.atEnd)return this.setNext("quoted-scalar");b=this.buffer.length}return yield*this.pushToIndex(b+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let a=this.pos;for(;;){let b=this.buffer[++a];if("+"===b)this.blockScalarKeep=!0;else if(b>"0"&&b<="9")this.blockScalarIndent=Number(b)-1;else if("-"!==b)break}return yield*this.pushUntil(a=>e(a)||"#"===a)}*parseBlockScalar(){let a,b=this.pos-1,c=0;a:for(let d=this.pos;a=this.buffer[d];++d)switch(a){case" ":c+=1;break;case"\n":b=d,c=0;break;case"\r":{let a=this.buffer[d+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if("\n"===a)break}default:break a}if(!a&&!this.atEnd)return this.setNext("block-scalar");if(c>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=c:this.indentNext=this.blockScalarIndent+(0===this.indentNext?1:this.indentNext);do{let a=this.continueScalar(b+1);if(-1===a)break;b=this.buffer.indexOf("\n",a)}while(-1!==b)if(-1===b){if(!this.atEnd)return this.setNext("block-scalar");b=this.buffer.length}}let e=b+1;for(a=this.buffer[e];" "===a;)a=this.buffer[++e];if(" "===a){for(;" "===a||" "===a||"\r"===a||"\n"===a;)a=this.buffer[++e];b=e-1}else if(!this.blockScalarKeep)for(;;){let a=b-1,d=this.buffer[a];"\r"===d&&(d=this.buffer[--a]);let e=a;for(;" "===d;)d=this.buffer[--a];if("\n"===d&&a>=this.pos&&a+1+c>e)b=a;else break}return yield d.SCALAR,yield*this.pushToIndex(b+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let a,b=this.flowLevel>0,c=this.pos-1,f=this.pos-1;for(;a=this.buffer[++f];)if(":"===a){let a=this.buffer[f+1];if(e(a)||b&&h.has(a))break;c=f}else if(e(a)){let d=this.buffer[f+1];if("\r"===a&&("\n"===d?(f+=1,a="\n",d=this.buffer[f+1]):c=f),"#"===d||b&&h.has(d))break;if("\n"===a){let a=this.continueScalar(f+1);if(-1===a)break;f=Math.max(f,a-2)}}else{if(b&&h.has(a))break;c=f}return a||this.atEnd?(yield d.SCALAR,yield*this.pushToIndex(c+1,!0),b?"flow":"doc"):this.setNext("plain-scalar")}*pushCount(a){return a>0?(yield this.buffer.substr(this.pos,a),this.pos+=a,a):0}*pushToIndex(a,b){let c=this.buffer.slice(this.pos,a);return c?(yield c,this.pos+=c.length,c.length):(b&&(yield""),0)}*pushIndicators(){let a=0;for(;;){switch(this.charAt(0)){case"!":a+=yield*this.pushTag(),a+=yield*this.pushSpaces(!0);continue;case"&":a+=yield*this.pushUntil(j),a+=yield*this.pushSpaces(!0);continue;case"-":case"?":case":":{let b=this.flowLevel>0,c=this.charAt(1);if(e(c)||b&&h.has(c)){b?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0);continue}}}break}return a}*pushTag(){if("<"===this.charAt(1)){let a=this.pos+2,b=this.buffer[a];for(;!e(b)&&">"!==b;)b=this.buffer[++a];return yield*this.pushToIndex(">"===b?a+1:a,!1)}{let a=this.pos+1,b=this.buffer[a];for(;b;)if(g.has(b))b=this.buffer[++a];else if("%"===b&&f.has(this.buffer[a+1])&&f.has(this.buffer[a+2]))b=this.buffer[a+=3];else break;return yield*this.pushToIndex(a,!1)}}*pushNewline(){let a=this.buffer[this.pos];return"\n"===a?yield*this.pushCount(1):"\r"===a&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(a){let b,c=this.pos-1;do b=this.buffer[++c];while(" "===b||a&&" "===b)let d=c-this.pos;return d>0&&(yield this.buffer.substr(this.pos,d),this.pos=c),d}*pushUntil(a){let b=this.pos,c=this.buffer[b];for(;!a(c);)c=this.buffer[++b];return yield*this.pushToIndex(b,!1)}}},46987,(a,b,c)=>{"use strict";c.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=a=>this.lineStarts.push(a),this.linePos=a=>{let b=0,c=this.lineStarts.length;for(;b<c;){let d=b+c>>1;this.lineStarts[d]<a?b=d+1:c=d}if(this.lineStarts[b]===a)return{line:b+1,col:1};if(0===b)return{line:0,col:a};let d=this.lineStarts[b-1];return{line:b,col:a-d+1}}}}},9575,(a,b,c)=>{"use strict";var d=a.r(5365),e=a.r(2704),f=a.r(66326);function g(a,b){for(let c=0;c<a.length;++c)if(a[c].type===b)return!0;return!1}function h(a){for(let b=0;b<a.length;++b)switch(a[b].type){case"space":case"comment":case"newline":break;default:return b}return -1}function i(a){switch(a?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function j(a){switch(a.type){case"document":return a.start;case"block-map":{let b=a.items[a.items.length-1];return b.sep??b.start}case"block-seq":return a.items[a.items.length-1].start;default:return[]}}function k(a){if(0===a.length)return[];let b=a.length;a:for(;--b>=0;)switch(a[b].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break a}for(;a[++b]?.type==="space";);return a.splice(b,a.length)}function l(a,b){if(b.length<1e5)Array.prototype.push.apply(a,b);else for(let c=0;c<b.length;++c)a.push(b[c])}function m(a){if("flow-seq-start"===a.start.type)for(let b of a.items)!b.sep||b.value||g(b.start,"explicit-key-ind")||g(b.sep,"map-value-ind")||(b.key&&(b.value=b.key),delete b.key,i(b.value)?b.value.end?l(b.value.end,b.sep):b.value.end=b.sep:l(b.start,b.sep),delete b.sep)}c.Parser=class{constructor(a){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new f.Lexer,this.onNewLine=a}*parse(a,b=!1){for(let c of(this.onNewLine&&0===this.offset&&this.onNewLine(0),this.lexer.lex(a,b)))yield*this.next(c);b||(yield*this.end())}*next(a){if(this.source=a,d.env.LOG_TOKENS&&console.log("|",e.prettyToken(a)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=a.length;return}let b=e.tokenType(a);if(b)if("scalar"===b)this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=b,yield*this.step(),b){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+a.length);break;case"space":this.atNewLine&&" "===a[0]&&(this.indent+=a.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=a.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=a.length}else{let b=`Not a YAML token: ${a}`;yield*this.pop({type:"error",offset:this.offset,message:b,source:a}),this.offset+=a.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let a=this.peek(1);if("doc-end"===this.type&&a?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!a)return yield*this.stream();switch(a.type){case"document":return yield*this.document(a);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(a);case"block-scalar":return yield*this.blockScalar(a);case"block-map":return yield*this.blockMap(a);case"block-seq":return yield*this.blockSequence(a);case"flow-collection":return yield*this.flowCollection(a);case"doc-end":return yield*this.documentEnd(a)}yield*this.pop()}peek(a){return this.stack[this.stack.length-a]}*pop(a){let b=a??this.stack.pop();if(b)if(0===this.stack.length)yield b;else{let a=this.peek(1);switch("block-scalar"===b.type?b.indent="indent"in a?a.indent:0:"flow-collection"===b.type&&"document"===a.type&&(b.indent=0),"flow-collection"===b.type&&m(b),a.type){case"document":a.value=b;break;case"block-scalar":a.props.push(b);break;case"block-map":{let c=a.items[a.items.length-1];if(c.value){a.items.push({start:[],key:b,sep:[]}),this.onKeyLine=!0;return}if(c.sep)c.value=b;else{Object.assign(c,{key:b,sep:[]}),this.onKeyLine=!c.explicitKey;return}break}case"block-seq":{let c=a.items[a.items.length-1];c.value?a.items.push({start:[],value:b}):c.value=b;break}case"flow-collection":{let c=a.items[a.items.length-1];!c||c.value?a.items.push({start:[],key:b,sep:[]}):c.sep?c.value=b:Object.assign(c,{key:b,sep:[]});return}default:yield*this.pop(),yield*this.pop(b)}if(("document"===a.type||"block-map"===a.type||"block-seq"===a.type)&&("block-map"===b.type||"block-seq"===b.type)){let c=b.items[b.items.length-1];c&&!c.sep&&!c.value&&c.start.length>0&&-1===h(c.start)&&(0===b.indent||c.start.every(a=>"comment"!==a.type||a.indent<b.indent))&&("document"===a.type?a.end=c.start:a.items.push({start:c.start}),b.items.splice(-1,1))}}else yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let a={type:"document",offset:this.offset,start:[]};"doc-start"===this.type&&a.start.push(this.sourceToken),this.stack.push(a);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(a){if(a.value)return yield*this.lineEnd(a);switch(this.type){case"doc-start":-1!==h(a.start)?(yield*this.pop(),yield*this.step()):a.start.push(this.sourceToken);return;case"anchor":case"tag":case"space":case"comment":case"newline":a.start.push(this.sourceToken);return}let b=this.startBlockValue(a);b?this.stack.push(b):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(a){if("map-value-ind"===this.type){let b,c=k(j(this.peek(2)));a.end?((b=a.end).push(this.sourceToken),delete a.end):b=[this.sourceToken];let d={type:"block-map",offset:a.offset,indent:a.indent,items:[{start:c,key:a,sep:b}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=d}else yield*this.lineEnd(a)}*blockScalar(a){switch(this.type){case"space":case"comment":case"newline":a.props.push(this.sourceToken);return;case"scalar":if(a.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let a=this.source.indexOf("\n")+1;for(;0!==a;)this.onNewLine(this.offset+a),a=this.source.indexOf("\n",a)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(a){let b=a.items[a.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,b.value){let c="end"in b.value?b.value.end:void 0,d=Array.isArray(c)?c[c.length-1]:void 0;d?.type==="comment"?c?.push(this.sourceToken):a.items.push({start:[this.sourceToken]})}else b.sep?b.sep.push(this.sourceToken):b.start.push(this.sourceToken);return;case"space":case"comment":if(b.value)a.items.push({start:[this.sourceToken]});else if(b.sep)b.sep.push(this.sourceToken);else{if(this.atIndentedComment(b.start,a.indent)){let c=a.items[a.items.length-2],d=c?.value?.end;if(Array.isArray(d)){l(d,b.start),d.push(this.sourceToken),a.items.pop();return}}b.start.push(this.sourceToken)}return}if(this.indent>=a.indent){let c=!this.onKeyLine&&this.indent===a.indent,d=c&&(b.sep||b.explicitKey)&&"seq-item-ind"!==this.type,e=[];if(d&&b.sep&&!b.value){let c=[];for(let d=0;d<b.sep.length;++d){let e=b.sep[d];switch(e.type){case"newline":c.push(d);break;case"space":break;case"comment":e.indent>a.indent&&(c.length=0);break;default:c.length=0}}c.length>=2&&(e=b.sep.splice(c[1]))}switch(this.type){case"anchor":case"tag":d||b.value?(e.push(this.sourceToken),a.items.push({start:e}),this.onKeyLine=!0):b.sep?b.sep.push(this.sourceToken):b.start.push(this.sourceToken);return;case"explicit-key-ind":b.sep||b.explicitKey?d||b.value?(e.push(this.sourceToken),a.items.push({start:e,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(b.start.push(this.sourceToken),b.explicitKey=!0),this.onKeyLine=!0;return;case"map-value-ind":if(b.explicitKey)if(b.sep)if(b.value)a.items.push({start:[],key:null,sep:[this.sourceToken]});else if(g(b.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]});else if(i(b.key)&&!g(b.sep,"newline")){let a=k(b.start),c=b.key,d=b.sep;d.push(this.sourceToken),delete b.key,delete b.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:c,sep:d}]})}else e.length>0?b.sep=b.sep.concat(e,this.sourceToken):b.sep.push(this.sourceToken);else if(g(b.start,"newline"))Object.assign(b,{key:null,sep:[this.sourceToken]});else{let a=k(b.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else b.sep?b.value||d?a.items.push({start:e,key:null,sep:[this.sourceToken]}):g(b.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):b.sep.push(this.sourceToken):Object.assign(b,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let c=this.flowScalar(this.type);d||b.value?(a.items.push({start:e,key:c,sep:[]}),this.onKeyLine=!0):b.sep?this.stack.push(c):(Object.assign(b,{key:c,sep:[]}),this.onKeyLine=!0);return}default:{let d=this.startBlockValue(a);if(d){if("block-seq"===d.type){if(!b.explicitKey&&b.sep&&!g(b.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else c&&a.items.push({start:e});this.stack.push(d);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(a){let b=a.items[a.items.length-1];switch(this.type){case"newline":if(b.value){let c="end"in b.value?b.value.end:void 0,d=Array.isArray(c)?c[c.length-1]:void 0;d?.type==="comment"?c?.push(this.sourceToken):a.items.push({start:[this.sourceToken]})}else b.start.push(this.sourceToken);return;case"space":case"comment":if(b.value)a.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(b.start,a.indent)){let c=a.items[a.items.length-2],d=c?.value?.end;if(Array.isArray(d)){l(d,b.start),d.push(this.sourceToken),a.items.pop();return}}b.start.push(this.sourceToken)}return;case"anchor":case"tag":if(b.value||this.indent<=a.indent)break;b.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==a.indent)break;b.value||g(b.start,"seq-item-ind")?a.items.push({start:[this.sourceToken]}):b.start.push(this.sourceToken);return}if(this.indent>a.indent){let b=this.startBlockValue(a);if(b)return void this.stack.push(b)}yield*this.pop(),yield*this.step()}*flowCollection(a){let b=a.items[a.items.length-1];if("flow-error-end"===this.type){let a;do yield*this.pop(),a=this.peek(1);while(a?.type==="flow-collection")}else if(0===a.end.length){switch(this.type){case"comma":case"explicit-key-ind":!b||b.sep?a.items.push({start:[this.sourceToken]}):b.start.push(this.sourceToken);return;case"map-value-ind":!b||b.value?a.items.push({start:[],key:null,sep:[this.sourceToken]}):b.sep?b.sep.push(this.sourceToken):Object.assign(b,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!b||b.value?a.items.push({start:[this.sourceToken]}):b.sep?b.sep.push(this.sourceToken):b.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let c=this.flowScalar(this.type);!b||b.value?a.items.push({start:[],key:c,sep:[]}):b.sep?this.stack.push(c):Object.assign(b,{key:c,sep:[]});return}case"flow-map-end":case"flow-seq-end":a.end.push(this.sourceToken);return}let c=this.startBlockValue(a);c?this.stack.push(c):(yield*this.pop(),yield*this.step())}else{let b=this.peek(2);if("block-map"!==b.type||("map-value-ind"!==this.type||b.indent!==a.indent)&&("newline"!==this.type||b.items[b.items.length-1].sep))if("map-value-ind"===this.type&&"flow-collection"!==b.type){let c=k(j(b));m(a);let d=a.end.splice(1,a.end.length);d.push(this.sourceToken);let e={type:"block-map",offset:a.offset,indent:a.indent,items:[{start:c,key:a,sep:d}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=e}else yield*this.lineEnd(a);else yield*this.pop(),yield*this.step()}}flowScalar(a){if(this.onNewLine){let a=this.source.indexOf("\n")+1;for(;0!==a;)this.onNewLine(this.offset+a),a=this.source.indexOf("\n",a)+1}return{type:a,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(a){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let b=k(j(a));return b.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:b,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let b=k(j(a));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:b,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(a,b){return"comment"===this.type&&!(this.indent<=b)&&a.every(a=>"newline"===a.type||"space"===a.type)}*documentEnd(a){"doc-mode"!==this.type&&(a.end?a.end.push(this.sourceToken):a.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop()))}*lineEnd(a){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:a.end?a.end.push(this.sourceToken):a.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop())}}}},5013,(a,b,c)=>{"use strict";var d=a.r(19662),e=a.r(85774),f=a.r(25717),g=a.r(18114),h=a.r(27267),i=a.r(46987),j=a.r(9575);function k(a){let b=!1!==a.prettyErrors;return{lineCounter:a.lineCounter||b&&new i.LineCounter||null,prettyErrors:b}}function l(a,b={}){let{lineCounter:c,prettyErrors:e}=k(b),g=new j.Parser(c?.addNewLine),h=new d.Composer(b),i=null;for(let b of h.compose(g.parse(a),!0,a.length))if(i){if("silent"!==i.options.logLevel){i.errors.push(new f.YAMLParseError(b.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else i=b;return e&&c&&(i.errors.forEach(f.prettifyError(a,c)),i.warnings.forEach(f.prettifyError(a,c))),i}c.parse=function(a,b,c){let d;"function"==typeof b?d=b:void 0===c&&b&&"object"==typeof b&&(c=b);let e=l(a,c);if(!e)return null;if(e.warnings.forEach(a=>g.warn(e.options.logLevel,a)),e.errors.length>0)if("silent"!==e.options.logLevel)throw e.errors[0];else e.errors=[];return e.toJS(Object.assign({reviver:d},c))},c.parseAllDocuments=function(a,b={}){let{lineCounter:c,prettyErrors:e}=k(b),g=new j.Parser(c?.addNewLine),h=new d.Composer(b),i=Array.from(h.compose(g.parse(a)));if(e&&c)for(let b of i)b.errors.forEach(f.prettifyError(a,c)),b.warnings.forEach(f.prettifyError(a,c));return i.length>0?i:Object.assign([],{empty:!0},h.streamInfo())},c.parseDocument=l,c.stringify=function(a,b,c){let d=null;if("function"==typeof b||Array.isArray(b)?d=b:void 0===c&&b&&(c=b),"string"==typeof c&&(c=c.length),"number"==typeof c){let a=Math.round(c);c=a<1?void 0:a>8?{indent:8}:{indent:a}}if(void 0===a){let{keepUndefined:a}=c??b??{};if(!a)return}return h.isDocument(a)&&!d?a.toString(c):new e.Document(a,d,c).toString(c)}},22650,(a,b,c)=>{"use strict";var d=a.r(19662),e=a.r(85774),f=a.r(98027),g=a.r(25717),h=a.r(21562),i=a.r(27267),j=a.r(17602),k=a.r(27853),l=a.r(47544),m=a.r(7621),n=a.r(2704),o=a.r(66326),p=a.r(46987),q=a.r(9575),r=a.r(5013),s=a.r(85927);c.Composer=d.Composer,c.Document=e.Document,c.Schema=f.Schema,c.YAMLError=g.YAMLError,c.YAMLParseError=g.YAMLParseError,c.YAMLWarning=g.YAMLWarning,c.Alias=h.Alias,c.isAlias=i.isAlias,c.isCollection=i.isCollection,c.isDocument=i.isDocument,c.isMap=i.isMap,c.isNode=i.isNode,c.isPair=i.isPair,c.isScalar=i.isScalar,c.isSeq=i.isSeq,c.Pair=j.Pair,c.Scalar=k.Scalar,c.YAMLMap=l.YAMLMap,c.YAMLSeq=m.YAMLSeq,c.CST=n,c.Lexer=o.Lexer,c.LineCounter=p.LineCounter,c.Parser=q.Parser,c.parse=r.parse,c.parseAllDocuments=r.parseAllDocuments,c.parseDocument=r.parseDocument,c.stringify=r.stringify,c.visit=s.visit,c.visitAsync=s.visitAsync},73338,a=>{"use strict";var b=a.i(36359),c=a.i(7292),d=a.i(37936),e=a.i(2157),f=a.i(66680),g=a.i(50227);a.i(8674),a.i(1144);var h=a.i(75818),i=a.i(13095);async function j(){return function(a=Date.now()){let b,c,d=(c=process.env.FAILPROOFAI_STATE_DIR)?(0,g.resolve)(c,"sessions"):(0,h.sessionPauseDir)();if(!(0,e.existsSync)(d))return[];let f=[];try{b=(0,e.readdirSync)(d)}catch{return[]}for(let c of b)if(c.endsWith(".json"))try{let b=function(a){if(!a||"object"!=typeof a||1!==a.schemaVersion||"string"!=typeof a.sessionId||0===a.sessionId.length||!Number.isFinite(a.pausedAt)||!Number.isFinite(a.expiresAt))return null;let b=a.pausedAt,c=Number.isFinite(a.firstPausedAt)?a.firstPausedAt:b;return{schemaVersion:1,sessionId:a.sessionId,pausedAt:b,firstPausedAt:c,expiresAt:Math.min(a.expiresAt,c+288e5),setBy:"string"==typeof a.setBy?a.setBy:"unknown",..."string"==typeof a.cwd?{cwd:a.cwd}:{}}}(JSON.parse((0,e.readFileSync)((0,g.join)(d,c),"utf8")));if(!b||b.expiresAt<=a)continue;let{schemaVersion:h,...i}=b;f.push(i)}catch{}return f.sort((a,b)=>b.pausedAt-a.pausedAt)}()}(0,i.ensureServerEntryExports)([j]),(0,d.registerServerReference)(j,"00a6cfb4effad813a70cb6f60834a43a78f7cd1705",null);var k=a.i(28120),l=a.i(74533),m=a.i(60526);let n=["user","project","local"],o=["claude","codex","copilot","cursor","opencode","pi","hermes","openclaw","factory","devin","antigravity","goose"],p=["session_start","pre_tool_use","permission_request","post_tool_use","user_prompt_submit","stop","subagent_start","pre_compact","post_compact","subagent_stop"],q={session_start:"SessionStart",pre_tool_use:"PreToolUse",permission_request:"PermissionRequest",post_tool_use:"PostToolUse",user_prompt_submit:"UserPromptSubmit",stop:"Stop",subagent_start:"SubagentStart",pre_compact:"PreCompact",post_compact:"PostCompact",subagent_stop:"SubagentStop"},r=["pre_tool_call","post_tool_call","on_session_start","on_session_end","subagent_stop"],s=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PostToolUse","Stop","SubagentStop","PostToolUseFailure","ErrorOccurred","PreCompact","PermissionRequest","Notification"],t=["sessionStart","sessionEnd","beforeSubmitPrompt","preToolUse","postToolUse","stop","subagentStop"],u=["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","Notification","Stop","SubagentStop","PreCompact","SessionEnd"],v=["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","PermissionRequest","Stop","SessionEnd"],w=["PreToolUse","PostToolUse","PreInvocation","Stop"],x=["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","SessionEnd"],y=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PermissionRequest","PermissionDenied","PostToolUse","PostToolUseFailure","Notification","SubagentStart","SubagentStop","TaskCreated","TaskCompleted","Stop","StopFailure","TeammateIdle","InstructionsLoaded","ConfigChange","CwdChanged","FileChanged","WorktreeCreate","WorktreeRemove","PreCompact","PostCompact","Elicitation","ElicitationResult","UserPromptExpansion","PostToolBatch","Setup"].filter(a=>"WorktreeCreate"!==a),z="__failproofai_hook__";var A=a.i(57764),B=a.i(22650),C=a.i(43600),D={get url(){return a.F("src/hooks/integrations.ts")},env:{DEV:!1,PROD:!0,MODE:"production",BASE_URL:"/",SSR:!0}};function E(a){return(0,e.existsSync)(a)?JSON.parse((0,e.readFileSync)(a,"utf8")):{}}function F(a,b){(0,e.mkdirSync)((0,g.dirname)(a),{recursive:!0}),(0,e.writeFileSync)(a,JSON.stringify(b,null,2)+"\n","utf8")}function G(a){try{return(0,e.existsSync)(a)?(0,B.parseDocument)((0,e.readFileSync)(a,"utf8")):(0,B.parseDocument)("")}catch{return(0,B.parseDocument)("")}}function H(a,b){(0,e.mkdirSync)((0,g.dirname)(a),{recursive:!0}),(0,e.writeFileSync)(a,b.toString(),"utf8")}function I(a){if(!a||"object"!=typeof a)return!1;if(!0===a[z])return!0;let b="string"==typeof a.command?a.command:"";return b.includes("failproofai")&&b.includes("--hook")}function J(a){return"version"in a&&(delete a.version,!0)}function K(a){try{let b=`which ${a}`;return(0,l.execSync)(b,{encoding:"utf8",stdio:"pipe"}),!0}catch{return!1}}function L(a,b,c){let d=a.getSettingsPaths?.(b,c);return d&&d.length>0?d:[a.getSettingsPath(b,c)]}let M={id:"claude",displayName:"Claude Code",scopes:n,eventTypes:y,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".claude","settings.json");case"project":return(0,g.resolve)(c,".claude","settings.json");case"local":return(0,g.resolve)(c,".claude","settings.local.json")}},readSettings:a=>E(a),writeSettings(a,b){F(a,b)},buildHookEntry:(a,b,c)=>({type:"command",command:"project"===c?`npx -y failproofai --hook ${b}`:`"${a}" --hook ${b}`,timeout:60,[z]:!0}),isFailproofaiHook:I,writeHookEntries(a,b,c){a.hooks||(a.hooks={});let d=new Set(y);for(let b of Object.keys(a.hooks)){if(d.has(b))continue;let c=a.hooks[b];if(!Array.isArray(c))continue;let e=[];for(let a of c){if(!a||!Array.isArray(a.hooks)){a&&e.push(a);continue}let b=a.hooks.length;a.hooks=a.hooks.filter(a=>!I(a)),0===a.hooks.length&&b>0||e.push(a)}a.hooks[b]=e,0===e.length&&delete a.hooks[b]}for(let d of y){let e=this.buildHookEntry(b,d,c);a.hooks[d]||(a.hooks[d]=[]);let f=a.hooks[d],g=!1;for(let a of f){if(!a.hooks)continue;let b=a.hooks.findIndex(a=>I(a));if(b>=0){a.hooks[b]=e,g=!0;break}}g||f.push({hooks:[e]})}},removeHooksFromFile(a){let b=this.readSettings(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(Array.isArray(d)){for(let a=d.length-1;a>=0;a--){let b=d[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!I(a)),c+=e-b.hooks.length,0===b.hooks.length&&d.splice(a,1)}0===d.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,this.writeSettings(a,b),c},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)){for(let a of b)if(a.hooks&&a.hooks.some(a=>I(a)))return!0}}catch{}return!1},detectInstalled:()=>K("claude")||K("claude-code")};function N(a){if(!0===a[z])return!0;for(let b of["string"==typeof a.bash?a.bash:"","string"==typeof a.powershell?a.powershell:""])if(b.includes("failproofai")&&b.includes("--hook"))return!0;return!1}let O="./plugins/failproofai.mjs";function P(a){return(0,g.resolve)((0,g.dirname)(a),"plugins","failproofai.mjs")}function Q(){let a=process.env.FAILPROOFAI_PACKAGE_ROOT;return a?(0,g.resolve)(a,"pi-extension"):(0,g.resolve)((0,A.fileURLToPath)(D.url),"..","..","..","pi-extension")}function R(a){return"string"==typeof a&&(!!/(?:^|\/)pi-extension\/?$/.test(a)||a.includes("pi-extension")&&a.includes("failproofai"))}let S="failproofai";function T(){let a=process.env.FAILPROOFAI_PACKAGE_ROOT;return a?(0,g.resolve)(a,"openclaw-plugin"):(0,g.resolve)((0,A.fileURLToPath)(D.url),"..","..","..","openclaw-plugin")}function U(a){return"string"==typeof a&&(/(?:^|\/)openclaw-plugin\/?$/.test(a)||a.includes("openclaw-plugin")&&a.includes("failproofai"))}let V="failproofai",W=new Set(["PreToolUse","PostToolUse"]);function X(a){if(!a||"object"!=typeof a)return!1;let b=a.command;return"string"==typeof b&&b.includes("failproofai")&&b.includes("--cli goose")}let Y={claude:M,codex:{id:"codex",displayName:"OpenAI Codex",scopes:["user","project"],eventTypes:p,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".codex","hooks.json");case"project":case"local":return(0,g.resolve)(c,".codex","hooks.json")}},readSettings:a=>E(a),writeSettings(a,b){F(a,b)},buildHookEntry:(a,b,c)=>({type:"command",command:"project"===c?`npx -y failproofai --hook ${b} --cli codex`:`"${a}" --hook ${b} --cli codex`,timeout:60,[z]:!0}),isFailproofaiHook:I,writeHookEntries(a,b,c){for(let d of(J(a),a.hooks||(a.hooks={}),p)){let e=q[d],f=this.buildHookEntry(b,d,c);a.hooks[e]||(a.hooks[e]=[]);let g=a.hooks[e],h=!1;for(let a of g){if(!a.hooks)continue;let b=a.hooks.findIndex(a=>I(a));if(b>=0){a.hooks[b]=f,h=!0;break}}h||g.push({hooks:[f]})}},removeHooksFromFile(a){let b=this.readSettings(a),c=J(b);if(!b.hooks)return c&&this.writeSettings(a,b),0;let d=0;for(let a of Object.keys(b.hooks)){let c=b.hooks[a];if(Array.isArray(c)){for(let a=c.length-1;a>=0;a--){let b=c[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!I(a)),d+=e-b.hooks.length,0===b.hooks.length&&c.splice(a,1)}0===c.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,(d>0||c)&&this.writeSettings(a,b),d},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)){for(let a of b)if(a.hooks&&a.hooks.some(a=>I(a)))return!0}}catch{}return!1},detectInstalled:()=>K("codex")},copilot:{id:"copilot",displayName:"GitHub Copilot",scopes:["user","project"],eventTypes:s,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".copilot","hooks","failproofai.json");case"project":case"local":return(0,g.resolve)(c,".github","hooks","failproofai.json")}},readSettings(a){let b=E(a);return void 0===b.version&&(b.version=1),b},writeSettings(a,b){F(a,b)},buildHookEntry(a,b,c){let d="project"===c?`npx -y failproofai --hook ${b} --cli copilot`:`"${a}" --hook ${b} --cli copilot`;return{type:"command",bash:d,powershell:d,timeoutSec:60,[z]:!0}},isFailproofaiHook:N,writeHookEntries(a,b,c){for(let d of(void 0===a.version&&(a.version=1),a.hooks||(a.hooks={}),s)){let e=this.buildHookEntry(b,d,c);a.hooks[d]||(a.hooks[d]=[]);let f=a.hooks[d],g=!1;for(let a of f){if(!a.hooks)continue;let b=a.hooks.findIndex(a=>N(a));if(b>=0){a.hooks[b]=e,g=!0;break}}g||f.push({hooks:[e]})}},removeHooksFromFile(a){let b=this.readSettings(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(Array.isArray(d)){for(let a=d.length-1;a>=0;a--){let b=d[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!N(a)),c+=e-b.hooks.length,0===b.hooks.length&&d.splice(a,1)}0===d.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,this.writeSettings(a,b),c},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)){for(let a of b)if(a.hooks&&a.hooks.some(a=>N(a)))return!0}}catch{}return!1},detectInstalled:()=>K("copilot")},cursor:{id:"cursor",displayName:"Cursor Agent",scopes:["user","project"],eventTypes:t,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".cursor","hooks.json");case"project":case"local":return(0,g.resolve)(c,".cursor","hooks.json")}},readSettings(a){let b=E(a);return void 0===b.version&&(b.version=1),b},writeSettings(a,b){F(a,b)},buildHookEntry:(a,b,c)=>({type:"command",command:"project"===c?`npx -y failproofai --hook ${b} --cli cursor`:`"${a}" --hook ${b} --cli cursor`,timeout:60,[z]:!0}),isFailproofaiHook:I,writeHookEntries(a,b,c){for(let d of(void 0===a.version&&(a.version=1),a.hooks||(a.hooks={}),t)){let e=this.buildHookEntry(b,d,c),f=a.hooks[d],g=f??[];f||(a.hooks[d]=g);let h=g.findIndex(a=>I(a));h>=0?g[h]=e:g.push(e)}},removeHooksFromFile(a){let b=this.readSettings(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(!Array.isArray(d))continue;let e=d.length,f=d.filter(a=>!I(a));c+=e-f.length,0===f.length?delete b.hooks[a]:b.hooks[a]=f}return 0===Object.keys(b.hooks).length&&delete b.hooks,this.writeSettings(a,b),c},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)&&b.some(a=>I(a)))return!0}catch{}return!1},detectInstalled:()=>K("cursor-agent")||K("agent")},opencode:{id:"opencode",displayName:"OpenCode",scopes:["user","project"],eventTypes:["tool.execute.before","tool.execute.after","session.created","session.deleted","session.idle","message.updated","permission.ask"],getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".config","opencode","opencode.json");case"project":case"local":return(0,g.resolve)(c,".opencode","opencode.json")}},readSettings:a=>E(a),writeSettings(a,b){F(a,b)},buildHookEntry(a,b,c){if("user"===c){let a=(0,g.resolve)((0,m.homedir)(),".config","opencode","plugins","failproofai.mjs");return{spec:`file://${a}`,[z]:!0}}return{spec:O,[z]:!0}},isFailproofaiHook:a=>"string"==typeof a?a.includes("failproofai.mjs"):!!Array.isArray(a)&&"string"==typeof a[0]&&a[0].includes("failproofai.mjs"),writeHookEntries(a,b,c){let d,f,h=c??"project",i=P("user"===h?(0,g.resolve)((0,m.homedir)(),".config","opencode","opencode.json"):(0,g.resolve)(process.cwd(),".opencode","opencode.json"));(0,e.mkdirSync)((0,g.dirname)(i),{recursive:!0}),(0,e.writeFileSync)(i,(f=(d="project"===h)?'""':JSON.stringify(b),`// AUTO-GENERATED by failproofai. ${z}
25
+ ${b.comment}`:b.comment}this.doc.range[2]=b.offset;break}default:this.errors.push(new g.YAMLParseError(k(a),"UNEXPECTED_TOKEN",`Unsupported token ${a.type}`))}}*end(a=!1,b=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(a){let a=Object.assign({_directives:this.directives},this.options),c=new f.Document(void 0,a);this.atDirectives&&this.onError(b,"MISSING_CHAR","Missing directives-end indicator line"),c.range=[0,b,b],this.decorate(c,!1),yield c}}}},86888,(a,b,c)=>{"use strict";var d=a.r(71014),e=a.r(21525),f=a.r(25717),g=a.r(88583);function h(a,b){if(b)for(let c of b)switch(c.type){case"space":case"comment":a.push(c);break;case"newline":return a.push(c),!0}return!1}function i(a,b,c){switch(a.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":a.type=c,a.source=b;break;case"block-scalar":{let d=a.props.slice(1),e=b.length;for(let b of("block-scalar-header"===a.props[0].type&&(e-=a.props[0].source.length),d))b.offset+=e;delete a.props,Object.assign(a,{type:c,source:b,end:d});break}case"block-map":case"block-seq":{let d={type:"newline",offset:a.offset+b.length,indent:a.indent,source:"\n"};delete a.items,Object.assign(a,{type:c,source:b,end:[d]});break}default:{let d="indent"in a?a.indent:-1,e="end"in a&&Array.isArray(a.end)?a.end.filter(a=>"space"===a.type||"comment"===a.type||"newline"===a.type):[];for(let b of Object.keys(a))"type"!==b&&"offset"!==b&&delete a[b];Object.assign(a,{type:c,indent:d,source:b,end:e})}}}c.createScalarToken=function(a,b){let{implicitKey:c=!1,indent:d,inFlow:e=!1,offset:f=-1,type:i="PLAIN"}=b,j=g.stringifyString({type:i,value:a},{implicitKey:c,indent:d>0?" ".repeat(d):"",inFlow:e,options:{blockQuote:!0,lineWidth:-1}}),k=b.end??[{type:"newline",offset:-1,indent:d,source:"\n"}];switch(j[0]){case"|":case">":{let a=j.indexOf("\n"),b=j.substring(0,a),c=j.substring(a+1)+"\n",e=[{type:"block-scalar-header",offset:f,indent:d,source:b}];return h(e,k)||e.push({type:"newline",offset:-1,indent:d,source:"\n"}),{type:"block-scalar",offset:f,indent:d,props:e,source:c}}case'"':return{type:"double-quoted-scalar",offset:f,indent:d,source:j,end:k};case"'":return{type:"single-quoted-scalar",offset:f,indent:d,source:j,end:k};default:return{type:"scalar",offset:f,indent:d,source:j,end:k}}},c.resolveAsScalar=function(a,b=!0,c){if(a){let g=(a,b,d)=>{let e="number"==typeof a?a:Array.isArray(a)?a[0]:a.offset;if(c)c(e,b,d);else throw new f.YAMLParseError([e,e+1],b,d)};switch(a.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return e.resolveFlowScalar(a,b,g);case"block-scalar":return d.resolveBlockScalar({options:{strict:b}},a,g)}}return null},c.setScalarValue=function(a,b,c={}){let{afterKey:d=!1,implicitKey:e=!1,inFlow:f=!1,type:j}=c,k="indent"in a?a.indent:null;if(d&&"number"==typeof k&&(k+=2),!j)switch(a.type){case"single-quoted-scalar":j="QUOTE_SINGLE";break;case"double-quoted-scalar":j="QUOTE_DOUBLE";break;case"block-scalar":{let b=a.props[0];if("block-scalar-header"!==b.type)throw Error("Invalid block scalar header");j=">"===b.source[0]?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:j="PLAIN"}let l=g.stringifyString({type:j,value:b},{implicitKey:e||null===k,indent:null!==k&&k>0?" ".repeat(k):"",inFlow:f,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":!function(a,b){let c=b.indexOf("\n"),d=b.substring(0,c),e=b.substring(c+1)+"\n";if("block-scalar"===a.type){let b=a.props[0];if("block-scalar-header"!==b.type)throw Error("Invalid block scalar header");b.source=d,a.source=e}else{let{offset:b}=a,c="indent"in a?a.indent:-1,f=[{type:"block-scalar-header",offset:b,indent:c,source:d}];for(let b of(h(f,"end"in a?a.end:void 0)||f.push({type:"newline",offset:-1,indent:c,source:"\n"}),Object.keys(a)))"type"!==b&&"offset"!==b&&delete a[b];Object.assign(a,{type:"block-scalar",indent:c,props:f,source:e})}}(a,l);break;case'"':i(a,l,"double-quoted-scalar");break;case"'":i(a,l,"single-quoted-scalar");break;default:i(a,l,"scalar")}}},25449,(a,b,c)=>{"use strict";function d(a){switch(a.type){case"block-scalar":{let b="";for(let c of a.props)b+=d(c);return b+a.source}case"block-map":case"block-seq":{let b="";for(let c of a.items)b+=e(c);return b}case"flow-collection":{let b=a.start.source;for(let c of a.items)b+=e(c);for(let c of a.end)b+=c.source;return b}case"document":{let b=e(a);if(a.end)for(let c of a.end)b+=c.source;return b}default:{let b=a.source;if("end"in a&&a.end)for(let c of a.end)b+=c.source;return b}}}function e({start:a,key:b,sep:c,value:f}){let g="";for(let b of a)g+=b.source;if(b&&(g+=d(b)),c)for(let a of c)g+=a.source;return f&&(g+=d(f)),g}c.stringify=a=>"type"in a?d(a):e(a)},2135,(a,b,c)=>{"use strict";let d=Symbol("break visit"),e=Symbol("skip children"),f=Symbol("remove item");function g(a,b){"type"in a&&"document"===a.type&&(a={start:a.start,value:a.value}),function a(b,c,e){let g=e(c,b);if("symbol"==typeof g)return g;for(let h of["key","value"]){let i=c[h];if(i&&"items"in i){for(let c=0;c<i.items.length;++c){let g=a(Object.freeze(b.concat([[h,c]])),i.items[c],e);if("number"==typeof g)c=g-1;else{if(g===d)return d;g===f&&(i.items.splice(c,1),c-=1)}}"function"==typeof g&&"key"===h&&(g=g(c,b))}}return"function"==typeof g?g(c,b):g}(Object.freeze([]),a,b)}g.BREAK=d,g.SKIP=e,g.REMOVE=f,g.itemAtPath=(a,b)=>{let c=a;for(let[a,d]of b){let b=c?.[a];if(!b||!("items"in b))return;c=b.items[d]}return c},g.parentCollection=(a,b)=>{let c=g.itemAtPath(a,b.slice(0,-1)),d=b[b.length-1][0],e=c?.[d];if(e&&"items"in e)return e;throw Error("Parent collection not found")},c.visit=g},2704,(a,b,c)=>{"use strict";var d=a.r(86888),e=a.r(25449),f=a.r(2135);c.createScalarToken=d.createScalarToken,c.resolveAsScalar=d.resolveAsScalar,c.setScalarValue=d.setScalarValue,c.stringify=e.stringify,c.visit=f.visit,c.BOM="\uFEFF",c.DOCUMENT="\x02",c.FLOW_END="\x18",c.SCALAR="\x1f",c.isCollection=a=>!!a&&"items"in a,c.isScalar=a=>!!a&&("scalar"===a.type||"single-quoted-scalar"===a.type||"double-quoted-scalar"===a.type||"block-scalar"===a.type),c.prettyToken=function(a){switch(a){case"\uFEFF":return"<BOM>";case"\x02":return"<DOC>";case"\x18":return"<FLOW_END>";case"\x1f":return"<SCALAR>";default:return JSON.stringify(a)}},c.tokenType=function(a){switch(a){case"\uFEFF":return"byte-order-mark";case"\x02":return"doc-mode";case"\x18":return"flow-error-end";case"\x1f":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(a[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}},66326,(a,b,c)=>{"use strict";var d=a.r(2704);function e(a){switch(a){case void 0:case" ":case"\n":case"\r":case" ":return!0;default:return!1}}let f=new Set("0123456789ABCDEFabcdef"),g=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),h=new Set(",[]{}"),i=new Set(" ,[]{}\n\r "),j=a=>!a||i.has(a);c.Lexer=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(a,b=!1){if(a){if("string"!=typeof a)throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+a:a,this.lineEndPos=null}this.atEnd=!b;let c=this.next??"stream";for(;c&&(b||this.hasChars(1));)c=yield*this.parseNext(c)}atLineEnd(){let a=this.pos,b=this.buffer[a];for(;" "===b||" "===b;)b=this.buffer[++a];return!b||"#"===b||"\n"===b||"\r"===b&&"\n"===this.buffer[a+1]}charAt(a){return this.buffer[this.pos+a]}continueScalar(a){let b=this.buffer[a];if(this.indentNext>0){let c=0;for(;" "===b;)b=this.buffer[++c+a];if("\r"===b){let b=this.buffer[c+a+1];if("\n"===b||!b&&!this.atEnd)return a+c+1}return"\n"!==b&&!(c>=this.indentNext)&&(b||this.atEnd)?-1:a+c}if("-"===b||"."===b){let b=this.buffer.substr(a,3);if(("---"===b||"..."===b)&&e(this.buffer[a+3]))return -1}return a}getLine(){let a=this.lineEndPos;return(("number"!=typeof a||-1!==a&&a<this.pos)&&(a=this.buffer.indexOf("\n",this.pos),this.lineEndPos=a),-1===a)?this.atEnd?this.buffer.substring(this.pos):null:("\r"===this.buffer[a-1]&&(a-=1),this.buffer.substring(this.pos,a))}hasChars(a){return this.pos+a<=this.buffer.length}setNext(a){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=a,null}peek(a){return this.buffer.substr(this.pos,a)}*parseNext(a){switch(a){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let a=this.getLine();if(null===a)return this.setNext("stream");if(a[0]===d.BOM&&(yield*this.pushCount(1),a=a.substring(1)),"%"===a[0]){let b=a.length,c=a.indexOf("#");for(;-1!==c;){let d=a[c-1];if(" "===d||" "===d){b=c-1;break}c=a.indexOf("#",c+1)}for(;;){let c=a[b-1];if(" "===c||" "===c)b-=1;else break}let d=(yield*this.pushCount(b))+(yield*this.pushSpaces(!0));return yield*this.pushCount(a.length-d),this.pushNewline(),"stream"}if(this.atLineEnd()){let b=yield*this.pushSpaces(!0);return yield*this.pushCount(a.length-b),yield*this.pushNewline(),"stream"}return yield d.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let a=this.charAt(0);if(!a&&!this.atEnd)return this.setNext("line-start");if("-"===a||"."===a){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let a=this.peek(3);if(("---"===a||"..."===a)&&e(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"---"===a?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!e(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[a,b]=this.peek(2);if(!b&&!this.atEnd)return this.setNext("block-start");if(("-"===a||"?"===a||":"===a)&&e(b)){let a=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=a,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let a=this.getLine();if(null===a)return this.setNext("doc");let b=yield*this.pushIndicators();switch(a[b]){case"#":yield*this.pushCount(a.length-b);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(j),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return b+=yield*this.parseBlockScalarHeader(),b+=yield*this.pushSpaces(!0),yield*this.pushCount(a.length-b),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let a,b,c=-1;do(a=yield*this.pushNewline())>0?(b=yield*this.pushSpaces(!1),this.indentValue=c=b):b=0,b+=yield*this.pushSpaces(!0);while(a+b>0)let f=this.getLine();if(null===f)return this.setNext("flow");if((-1!==c&&c<this.indentNext&&"#"!==f[0]||0===c&&(f.startsWith("---")||f.startsWith("..."))&&e(f[3]))&&(c!==this.indentNext-1||1!==this.flowLevel||"]"!==f[0]&&"}"!==f[0]))return this.flowLevel=0,yield d.FLOW_END,yield*this.parseLineStart();let g=0;for(;","===f[g];)g+=yield*this.pushCount(1),g+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(f[g+=yield*this.pushIndicators()]){case void 0:return"flow";case"#":return yield*this.pushCount(f.length-g),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(j),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let a=this.charAt(1);if(this.flowKey||e(a)||","===a)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let a=this.charAt(0),b=this.buffer.indexOf(a,this.pos+1);if("'"===a)for(;-1!==b&&"'"===this.buffer[b+1];)b=this.buffer.indexOf("'",b+2);else for(;-1!==b;){let a=0;for(;"\\"===this.buffer[b-1-a];)a+=1;if(a%2==0)break;b=this.buffer.indexOf('"',b+1)}let c=this.buffer.substring(0,b),d=c.indexOf("\n",this.pos);if(-1!==d){for(;-1!==d;){let a=this.continueScalar(d+1);if(-1===a)break;d=c.indexOf("\n",a)}-1!==d&&(b=d-("\r"===c[d-1]?2:1))}if(-1===b){if(!this.atEnd)return this.setNext("quoted-scalar");b=this.buffer.length}return yield*this.pushToIndex(b+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let a=this.pos;for(;;){let b=this.buffer[++a];if("+"===b)this.blockScalarKeep=!0;else if(b>"0"&&b<="9")this.blockScalarIndent=Number(b)-1;else if("-"!==b)break}return yield*this.pushUntil(a=>e(a)||"#"===a)}*parseBlockScalar(){let a,b=this.pos-1,c=0;a:for(let d=this.pos;a=this.buffer[d];++d)switch(a){case" ":c+=1;break;case"\n":b=d,c=0;break;case"\r":{let a=this.buffer[d+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if("\n"===a)break}default:break a}if(!a&&!this.atEnd)return this.setNext("block-scalar");if(c>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=c:this.indentNext=this.blockScalarIndent+(0===this.indentNext?1:this.indentNext);do{let a=this.continueScalar(b+1);if(-1===a)break;b=this.buffer.indexOf("\n",a)}while(-1!==b)if(-1===b){if(!this.atEnd)return this.setNext("block-scalar");b=this.buffer.length}}let e=b+1;for(a=this.buffer[e];" "===a;)a=this.buffer[++e];if(" "===a){for(;" "===a||" "===a||"\r"===a||"\n"===a;)a=this.buffer[++e];b=e-1}else if(!this.blockScalarKeep)for(;;){let a=b-1,d=this.buffer[a];"\r"===d&&(d=this.buffer[--a]);let e=a;for(;" "===d;)d=this.buffer[--a];if("\n"===d&&a>=this.pos&&a+1+c>e)b=a;else break}return yield d.SCALAR,yield*this.pushToIndex(b+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let a,b=this.flowLevel>0,c=this.pos-1,f=this.pos-1;for(;a=this.buffer[++f];)if(":"===a){let a=this.buffer[f+1];if(e(a)||b&&h.has(a))break;c=f}else if(e(a)){let d=this.buffer[f+1];if("\r"===a&&("\n"===d?(f+=1,a="\n",d=this.buffer[f+1]):c=f),"#"===d||b&&h.has(d))break;if("\n"===a){let a=this.continueScalar(f+1);if(-1===a)break;f=Math.max(f,a-2)}}else{if(b&&h.has(a))break;c=f}return a||this.atEnd?(yield d.SCALAR,yield*this.pushToIndex(c+1,!0),b?"flow":"doc"):this.setNext("plain-scalar")}*pushCount(a){return a>0?(yield this.buffer.substr(this.pos,a),this.pos+=a,a):0}*pushToIndex(a,b){let c=this.buffer.slice(this.pos,a);return c?(yield c,this.pos+=c.length,c.length):(b&&(yield""),0)}*pushIndicators(){let a=0;for(;;){switch(this.charAt(0)){case"!":a+=yield*this.pushTag(),a+=yield*this.pushSpaces(!0);continue;case"&":a+=yield*this.pushUntil(j),a+=yield*this.pushSpaces(!0);continue;case"-":case"?":case":":{let b=this.flowLevel>0,c=this.charAt(1);if(e(c)||b&&h.has(c)){b?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0);continue}}}break}return a}*pushTag(){if("<"===this.charAt(1)){let a=this.pos+2,b=this.buffer[a];for(;!e(b)&&">"!==b;)b=this.buffer[++a];return yield*this.pushToIndex(">"===b?a+1:a,!1)}{let a=this.pos+1,b=this.buffer[a];for(;b;)if(g.has(b))b=this.buffer[++a];else if("%"===b&&f.has(this.buffer[a+1])&&f.has(this.buffer[a+2]))b=this.buffer[a+=3];else break;return yield*this.pushToIndex(a,!1)}}*pushNewline(){let a=this.buffer[this.pos];return"\n"===a?yield*this.pushCount(1):"\r"===a&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(a){let b,c=this.pos-1;do b=this.buffer[++c];while(" "===b||a&&" "===b)let d=c-this.pos;return d>0&&(yield this.buffer.substr(this.pos,d),this.pos=c),d}*pushUntil(a){let b=this.pos,c=this.buffer[b];for(;!a(c);)c=this.buffer[++b];return yield*this.pushToIndex(b,!1)}}},46987,(a,b,c)=>{"use strict";c.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=a=>this.lineStarts.push(a),this.linePos=a=>{let b=0,c=this.lineStarts.length;for(;b<c;){let d=b+c>>1;this.lineStarts[d]<a?b=d+1:c=d}if(this.lineStarts[b]===a)return{line:b+1,col:1};if(0===b)return{line:0,col:a};let d=this.lineStarts[b-1];return{line:b,col:a-d+1}}}}},9575,(a,b,c)=>{"use strict";var d=a.r(5365),e=a.r(2704),f=a.r(66326);function g(a,b){for(let c=0;c<a.length;++c)if(a[c].type===b)return!0;return!1}function h(a){for(let b=0;b<a.length;++b)switch(a[b].type){case"space":case"comment":case"newline":break;default:return b}return -1}function i(a){switch(a?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function j(a){switch(a.type){case"document":return a.start;case"block-map":{let b=a.items[a.items.length-1];return b.sep??b.start}case"block-seq":return a.items[a.items.length-1].start;default:return[]}}function k(a){if(0===a.length)return[];let b=a.length;a:for(;--b>=0;)switch(a[b].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break a}for(;a[++b]?.type==="space";);return a.splice(b,a.length)}function l(a,b){if(b.length<1e5)Array.prototype.push.apply(a,b);else for(let c=0;c<b.length;++c)a.push(b[c])}function m(a){if("flow-seq-start"===a.start.type)for(let b of a.items)!b.sep||b.value||g(b.start,"explicit-key-ind")||g(b.sep,"map-value-ind")||(b.key&&(b.value=b.key),delete b.key,i(b.value)?b.value.end?l(b.value.end,b.sep):b.value.end=b.sep:l(b.start,b.sep),delete b.sep)}c.Parser=class{constructor(a){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new f.Lexer,this.onNewLine=a}*parse(a,b=!1){for(let c of(this.onNewLine&&0===this.offset&&this.onNewLine(0),this.lexer.lex(a,b)))yield*this.next(c);b||(yield*this.end())}*next(a){if(this.source=a,d.env.LOG_TOKENS&&console.log("|",e.prettyToken(a)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=a.length;return}let b=e.tokenType(a);if(b)if("scalar"===b)this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=b,yield*this.step(),b){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+a.length);break;case"space":this.atNewLine&&" "===a[0]&&(this.indent+=a.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=a.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=a.length}else{let b=`Not a YAML token: ${a}`;yield*this.pop({type:"error",offset:this.offset,message:b,source:a}),this.offset+=a.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let a=this.peek(1);if("doc-end"===this.type&&a?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!a)return yield*this.stream();switch(a.type){case"document":return yield*this.document(a);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(a);case"block-scalar":return yield*this.blockScalar(a);case"block-map":return yield*this.blockMap(a);case"block-seq":return yield*this.blockSequence(a);case"flow-collection":return yield*this.flowCollection(a);case"doc-end":return yield*this.documentEnd(a)}yield*this.pop()}peek(a){return this.stack[this.stack.length-a]}*pop(a){let b=a??this.stack.pop();if(b)if(0===this.stack.length)yield b;else{let a=this.peek(1);switch("block-scalar"===b.type?b.indent="indent"in a?a.indent:0:"flow-collection"===b.type&&"document"===a.type&&(b.indent=0),"flow-collection"===b.type&&m(b),a.type){case"document":a.value=b;break;case"block-scalar":a.props.push(b);break;case"block-map":{let c=a.items[a.items.length-1];if(c.value){a.items.push({start:[],key:b,sep:[]}),this.onKeyLine=!0;return}if(c.sep)c.value=b;else{Object.assign(c,{key:b,sep:[]}),this.onKeyLine=!c.explicitKey;return}break}case"block-seq":{let c=a.items[a.items.length-1];c.value?a.items.push({start:[],value:b}):c.value=b;break}case"flow-collection":{let c=a.items[a.items.length-1];!c||c.value?a.items.push({start:[],key:b,sep:[]}):c.sep?c.value=b:Object.assign(c,{key:b,sep:[]});return}default:yield*this.pop(),yield*this.pop(b)}if(("document"===a.type||"block-map"===a.type||"block-seq"===a.type)&&("block-map"===b.type||"block-seq"===b.type)){let c=b.items[b.items.length-1];c&&!c.sep&&!c.value&&c.start.length>0&&-1===h(c.start)&&(0===b.indent||c.start.every(a=>"comment"!==a.type||a.indent<b.indent))&&("document"===a.type?a.end=c.start:a.items.push({start:c.start}),b.items.splice(-1,1))}}else yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let a={type:"document",offset:this.offset,start:[]};"doc-start"===this.type&&a.start.push(this.sourceToken),this.stack.push(a);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(a){if(a.value)return yield*this.lineEnd(a);switch(this.type){case"doc-start":-1!==h(a.start)?(yield*this.pop(),yield*this.step()):a.start.push(this.sourceToken);return;case"anchor":case"tag":case"space":case"comment":case"newline":a.start.push(this.sourceToken);return}let b=this.startBlockValue(a);b?this.stack.push(b):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(a){if("map-value-ind"===this.type){let b,c=k(j(this.peek(2)));a.end?((b=a.end).push(this.sourceToken),delete a.end):b=[this.sourceToken];let d={type:"block-map",offset:a.offset,indent:a.indent,items:[{start:c,key:a,sep:b}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=d}else yield*this.lineEnd(a)}*blockScalar(a){switch(this.type){case"space":case"comment":case"newline":a.props.push(this.sourceToken);return;case"scalar":if(a.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let a=this.source.indexOf("\n")+1;for(;0!==a;)this.onNewLine(this.offset+a),a=this.source.indexOf("\n",a)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(a){let b=a.items[a.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,b.value){let c="end"in b.value?b.value.end:void 0,d=Array.isArray(c)?c[c.length-1]:void 0;d?.type==="comment"?c?.push(this.sourceToken):a.items.push({start:[this.sourceToken]})}else b.sep?b.sep.push(this.sourceToken):b.start.push(this.sourceToken);return;case"space":case"comment":if(b.value)a.items.push({start:[this.sourceToken]});else if(b.sep)b.sep.push(this.sourceToken);else{if(this.atIndentedComment(b.start,a.indent)){let c=a.items[a.items.length-2],d=c?.value?.end;if(Array.isArray(d)){l(d,b.start),d.push(this.sourceToken),a.items.pop();return}}b.start.push(this.sourceToken)}return}if(this.indent>=a.indent){let c=!this.onKeyLine&&this.indent===a.indent,d=c&&(b.sep||b.explicitKey)&&"seq-item-ind"!==this.type,e=[];if(d&&b.sep&&!b.value){let c=[];for(let d=0;d<b.sep.length;++d){let e=b.sep[d];switch(e.type){case"newline":c.push(d);break;case"space":break;case"comment":e.indent>a.indent&&(c.length=0);break;default:c.length=0}}c.length>=2&&(e=b.sep.splice(c[1]))}switch(this.type){case"anchor":case"tag":d||b.value?(e.push(this.sourceToken),a.items.push({start:e}),this.onKeyLine=!0):b.sep?b.sep.push(this.sourceToken):b.start.push(this.sourceToken);return;case"explicit-key-ind":b.sep||b.explicitKey?d||b.value?(e.push(this.sourceToken),a.items.push({start:e,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(b.start.push(this.sourceToken),b.explicitKey=!0),this.onKeyLine=!0;return;case"map-value-ind":if(b.explicitKey)if(b.sep)if(b.value)a.items.push({start:[],key:null,sep:[this.sourceToken]});else if(g(b.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]});else if(i(b.key)&&!g(b.sep,"newline")){let a=k(b.start),c=b.key,d=b.sep;d.push(this.sourceToken),delete b.key,delete b.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:c,sep:d}]})}else e.length>0?b.sep=b.sep.concat(e,this.sourceToken):b.sep.push(this.sourceToken);else if(g(b.start,"newline"))Object.assign(b,{key:null,sep:[this.sourceToken]});else{let a=k(b.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else b.sep?b.value||d?a.items.push({start:e,key:null,sep:[this.sourceToken]}):g(b.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):b.sep.push(this.sourceToken):Object.assign(b,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let c=this.flowScalar(this.type);d||b.value?(a.items.push({start:e,key:c,sep:[]}),this.onKeyLine=!0):b.sep?this.stack.push(c):(Object.assign(b,{key:c,sep:[]}),this.onKeyLine=!0);return}default:{let d=this.startBlockValue(a);if(d){if("block-seq"===d.type){if(!b.explicitKey&&b.sep&&!g(b.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else c&&a.items.push({start:e});this.stack.push(d);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(a){let b=a.items[a.items.length-1];switch(this.type){case"newline":if(b.value){let c="end"in b.value?b.value.end:void 0,d=Array.isArray(c)?c[c.length-1]:void 0;d?.type==="comment"?c?.push(this.sourceToken):a.items.push({start:[this.sourceToken]})}else b.start.push(this.sourceToken);return;case"space":case"comment":if(b.value)a.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(b.start,a.indent)){let c=a.items[a.items.length-2],d=c?.value?.end;if(Array.isArray(d)){l(d,b.start),d.push(this.sourceToken),a.items.pop();return}}b.start.push(this.sourceToken)}return;case"anchor":case"tag":if(b.value||this.indent<=a.indent)break;b.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==a.indent)break;b.value||g(b.start,"seq-item-ind")?a.items.push({start:[this.sourceToken]}):b.start.push(this.sourceToken);return}if(this.indent>a.indent){let b=this.startBlockValue(a);if(b)return void this.stack.push(b)}yield*this.pop(),yield*this.step()}*flowCollection(a){let b=a.items[a.items.length-1];if("flow-error-end"===this.type){let a;do yield*this.pop(),a=this.peek(1);while(a?.type==="flow-collection")}else if(0===a.end.length){switch(this.type){case"comma":case"explicit-key-ind":!b||b.sep?a.items.push({start:[this.sourceToken]}):b.start.push(this.sourceToken);return;case"map-value-ind":!b||b.value?a.items.push({start:[],key:null,sep:[this.sourceToken]}):b.sep?b.sep.push(this.sourceToken):Object.assign(b,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!b||b.value?a.items.push({start:[this.sourceToken]}):b.sep?b.sep.push(this.sourceToken):b.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let c=this.flowScalar(this.type);!b||b.value?a.items.push({start:[],key:c,sep:[]}):b.sep?this.stack.push(c):Object.assign(b,{key:c,sep:[]});return}case"flow-map-end":case"flow-seq-end":a.end.push(this.sourceToken);return}let c=this.startBlockValue(a);c?this.stack.push(c):(yield*this.pop(),yield*this.step())}else{let b=this.peek(2);if("block-map"!==b.type||("map-value-ind"!==this.type||b.indent!==a.indent)&&("newline"!==this.type||b.items[b.items.length-1].sep))if("map-value-ind"===this.type&&"flow-collection"!==b.type){let c=k(j(b));m(a);let d=a.end.splice(1,a.end.length);d.push(this.sourceToken);let e={type:"block-map",offset:a.offset,indent:a.indent,items:[{start:c,key:a,sep:d}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=e}else yield*this.lineEnd(a);else yield*this.pop(),yield*this.step()}}flowScalar(a){if(this.onNewLine){let a=this.source.indexOf("\n")+1;for(;0!==a;)this.onNewLine(this.offset+a),a=this.source.indexOf("\n",a)+1}return{type:a,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(a){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let b=k(j(a));return b.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:b,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let b=k(j(a));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:b,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(a,b){return"comment"===this.type&&!(this.indent<=b)&&a.every(a=>"newline"===a.type||"space"===a.type)}*documentEnd(a){"doc-mode"!==this.type&&(a.end?a.end.push(this.sourceToken):a.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop()))}*lineEnd(a){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:a.end?a.end.push(this.sourceToken):a.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop())}}}},5013,(a,b,c)=>{"use strict";var d=a.r(19662),e=a.r(85774),f=a.r(25717),g=a.r(18114),h=a.r(27267),i=a.r(46987),j=a.r(9575);function k(a){let b=!1!==a.prettyErrors;return{lineCounter:a.lineCounter||b&&new i.LineCounter||null,prettyErrors:b}}function l(a,b={}){let{lineCounter:c,prettyErrors:e}=k(b),g=new j.Parser(c?.addNewLine),h=new d.Composer(b),i=null;for(let b of h.compose(g.parse(a),!0,a.length))if(i){if("silent"!==i.options.logLevel){i.errors.push(new f.YAMLParseError(b.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else i=b;return e&&c&&(i.errors.forEach(f.prettifyError(a,c)),i.warnings.forEach(f.prettifyError(a,c))),i}c.parse=function(a,b,c){let d;"function"==typeof b?d=b:void 0===c&&b&&"object"==typeof b&&(c=b);let e=l(a,c);if(!e)return null;if(e.warnings.forEach(a=>g.warn(e.options.logLevel,a)),e.errors.length>0)if("silent"!==e.options.logLevel)throw e.errors[0];else e.errors=[];return e.toJS(Object.assign({reviver:d},c))},c.parseAllDocuments=function(a,b={}){let{lineCounter:c,prettyErrors:e}=k(b),g=new j.Parser(c?.addNewLine),h=new d.Composer(b),i=Array.from(h.compose(g.parse(a)));if(e&&c)for(let b of i)b.errors.forEach(f.prettifyError(a,c)),b.warnings.forEach(f.prettifyError(a,c));return i.length>0?i:Object.assign([],{empty:!0},h.streamInfo())},c.parseDocument=l,c.stringify=function(a,b,c){let d=null;if("function"==typeof b||Array.isArray(b)?d=b:void 0===c&&b&&(c=b),"string"==typeof c&&(c=c.length),"number"==typeof c){let a=Math.round(c);c=a<1?void 0:a>8?{indent:8}:{indent:a}}if(void 0===a){let{keepUndefined:a}=c??b??{};if(!a)return}return h.isDocument(a)&&!d?a.toString(c):new e.Document(a,d,c).toString(c)}},22650,(a,b,c)=>{"use strict";var d=a.r(19662),e=a.r(85774),f=a.r(98027),g=a.r(25717),h=a.r(21562),i=a.r(27267),j=a.r(17602),k=a.r(27853),l=a.r(47544),m=a.r(7621),n=a.r(2704),o=a.r(66326),p=a.r(46987),q=a.r(9575),r=a.r(5013),s=a.r(85927);c.Composer=d.Composer,c.Document=e.Document,c.Schema=f.Schema,c.YAMLError=g.YAMLError,c.YAMLParseError=g.YAMLParseError,c.YAMLWarning=g.YAMLWarning,c.Alias=h.Alias,c.isAlias=i.isAlias,c.isCollection=i.isCollection,c.isDocument=i.isDocument,c.isMap=i.isMap,c.isNode=i.isNode,c.isPair=i.isPair,c.isScalar=i.isScalar,c.isSeq=i.isSeq,c.Pair=j.Pair,c.Scalar=k.Scalar,c.YAMLMap=l.YAMLMap,c.YAMLSeq=m.YAMLSeq,c.CST=n,c.Lexer=o.Lexer,c.LineCounter=p.LineCounter,c.Parser=q.Parser,c.parse=r.parse,c.parseAllDocuments=r.parseAllDocuments,c.parseDocument=r.parseDocument,c.stringify=r.stringify,c.visit=s.visit,c.visitAsync=s.visitAsync},73338,a=>{"use strict";var b=a.i(36359),c=a.i(7292),d=a.i(37936),e=a.i(2157),f=a.i(66680),g=a.i(50227);a.i(8674),a.i(1144);var h=a.i(75818),i=a.i(13095);async function j(){return function(a=Date.now()){let b,c,d=(c=process.env.FAILPROOFAI_STATE_DIR)?(0,g.resolve)(c,"sessions"):(0,h.sessionPauseDir)();if(!(0,e.existsSync)(d))return[];let f=[];try{b=(0,e.readdirSync)(d)}catch{return[]}for(let c of b)if(c.endsWith(".json"))try{let b=function(a){if(!a||"object"!=typeof a||1!==a.schemaVersion||"string"!=typeof a.sessionId||0===a.sessionId.length||!Number.isFinite(a.pausedAt)||!Number.isFinite(a.expiresAt))return null;let b=a.pausedAt,c=Number.isFinite(a.firstPausedAt)?a.firstPausedAt:b;return{schemaVersion:1,sessionId:a.sessionId,pausedAt:b,firstPausedAt:c,expiresAt:Math.min(a.expiresAt,c+288e5),setBy:"string"==typeof a.setBy?a.setBy:"unknown",..."string"==typeof a.cwd?{cwd:a.cwd}:{}}}(JSON.parse((0,e.readFileSync)((0,g.join)(d,c),"utf8")));if(!b||b.expiresAt<=a)continue;let{schemaVersion:h,...i}=b;f.push(i)}catch{}return f.sort((a,b)=>b.pausedAt-a.pausedAt)}()}(0,i.ensureServerEntryExports)([j]),(0,d.registerServerReference)(j,"00a77fbb22f30bdca788ea0e80d3737f1b19287752",null);var k=a.i(28120),l=a.i(74533),m=a.i(60526);let n=["user","project","local"],o=["claude","codex","copilot","cursor","opencode","pi","hermes","openclaw","factory","devin","antigravity","goose"],p=["session_start","pre_tool_use","permission_request","post_tool_use","user_prompt_submit","stop","subagent_start","pre_compact","post_compact","subagent_stop"],q={session_start:"SessionStart",pre_tool_use:"PreToolUse",permission_request:"PermissionRequest",post_tool_use:"PostToolUse",user_prompt_submit:"UserPromptSubmit",stop:"Stop",subagent_start:"SubagentStart",pre_compact:"PreCompact",post_compact:"PostCompact",subagent_stop:"SubagentStop"},r=["pre_tool_call","post_tool_call","on_session_start","on_session_end","subagent_stop"],s=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PostToolUse","Stop","SubagentStop","PostToolUseFailure","ErrorOccurred","PreCompact","PermissionRequest","Notification"],t=["sessionStart","sessionEnd","beforeSubmitPrompt","preToolUse","postToolUse","stop","subagentStop"],u=["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","Notification","Stop","SubagentStop","PreCompact","SessionEnd"],v=["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","PermissionRequest","Stop","SessionEnd"],w=["PreToolUse","PostToolUse","PreInvocation","Stop"],x=["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","SessionEnd"],y=["SessionStart","SessionEnd","UserPromptSubmit","PreToolUse","PermissionRequest","PermissionDenied","PostToolUse","PostToolUseFailure","Notification","SubagentStart","SubagentStop","TaskCreated","TaskCompleted","Stop","StopFailure","TeammateIdle","InstructionsLoaded","ConfigChange","CwdChanged","FileChanged","WorktreeCreate","WorktreeRemove","PreCompact","PostCompact","Elicitation","ElicitationResult","UserPromptExpansion","PostToolBatch","Setup"].filter(a=>"WorktreeCreate"!==a),z="__failproofai_hook__";var A=a.i(57764),B=a.i(22650),C=a.i(43600),D={get url(){return a.F("src/hooks/integrations.ts")},env:{DEV:!1,PROD:!0,MODE:"production",BASE_URL:"/",SSR:!0}};function E(a){return(0,e.existsSync)(a)?JSON.parse((0,e.readFileSync)(a,"utf8")):{}}function F(a,b){(0,e.mkdirSync)((0,g.dirname)(a),{recursive:!0}),(0,e.writeFileSync)(a,JSON.stringify(b,null,2)+"\n","utf8")}function G(a){try{return(0,e.existsSync)(a)?(0,B.parseDocument)((0,e.readFileSync)(a,"utf8")):(0,B.parseDocument)("")}catch{return(0,B.parseDocument)("")}}function H(a,b){(0,e.mkdirSync)((0,g.dirname)(a),{recursive:!0}),(0,e.writeFileSync)(a,b.toString(),"utf8")}function I(a){if(!a||"object"!=typeof a)return!1;if(!0===a[z])return!0;let b="string"==typeof a.command?a.command:"";return b.includes("failproofai")&&b.includes("--hook")}function J(a){return"version"in a&&(delete a.version,!0)}function K(a){try{let b=`which ${a}`;return(0,l.execSync)(b,{encoding:"utf8",stdio:"pipe"}),!0}catch{return!1}}function L(a,b,c){let d=a.getSettingsPaths?.(b,c);return d&&d.length>0?d:[a.getSettingsPath(b,c)]}let M={id:"claude",displayName:"Claude Code",scopes:n,eventTypes:y,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".claude","settings.json");case"project":return(0,g.resolve)(c,".claude","settings.json");case"local":return(0,g.resolve)(c,".claude","settings.local.json")}},readSettings:a=>E(a),writeSettings(a,b){F(a,b)},buildHookEntry:(a,b,c)=>({type:"command",command:"project"===c?`npx -y failproofai --hook ${b}`:`"${a}" --hook ${b}`,timeout:60,[z]:!0}),isFailproofaiHook:I,writeHookEntries(a,b,c){a.hooks||(a.hooks={});let d=new Set(y);for(let b of Object.keys(a.hooks)){if(d.has(b))continue;let c=a.hooks[b];if(!Array.isArray(c))continue;let e=[];for(let a of c){if(!a||!Array.isArray(a.hooks)){a&&e.push(a);continue}let b=a.hooks.length;a.hooks=a.hooks.filter(a=>!I(a)),0===a.hooks.length&&b>0||e.push(a)}a.hooks[b]=e,0===e.length&&delete a.hooks[b]}for(let d of y){let e=this.buildHookEntry(b,d,c);a.hooks[d]||(a.hooks[d]=[]);let f=a.hooks[d],g=!1;for(let a of f){if(!a.hooks)continue;let b=a.hooks.findIndex(a=>I(a));if(b>=0){a.hooks[b]=e,g=!0;break}}g||f.push({hooks:[e]})}},removeHooksFromFile(a){let b=this.readSettings(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(Array.isArray(d)){for(let a=d.length-1;a>=0;a--){let b=d[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!I(a)),c+=e-b.hooks.length,0===b.hooks.length&&d.splice(a,1)}0===d.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,this.writeSettings(a,b),c},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)){for(let a of b)if(a.hooks&&a.hooks.some(a=>I(a)))return!0}}catch{}return!1},detectInstalled:()=>K("claude")||K("claude-code")};function N(a){if(!0===a[z])return!0;for(let b of["string"==typeof a.bash?a.bash:"","string"==typeof a.powershell?a.powershell:""])if(b.includes("failproofai")&&b.includes("--hook"))return!0;return!1}let O="./plugins/failproofai.mjs";function P(a){return(0,g.resolve)((0,g.dirname)(a),"plugins","failproofai.mjs")}function Q(){let a=process.env.FAILPROOFAI_PACKAGE_ROOT;return a?(0,g.resolve)(a,"pi-extension"):(0,g.resolve)((0,A.fileURLToPath)(D.url),"..","..","..","pi-extension")}function R(a){return"string"==typeof a&&(!!/(?:^|\/)pi-extension\/?$/.test(a)||a.includes("pi-extension")&&a.includes("failproofai"))}let S="failproofai";function T(){let a=process.env.FAILPROOFAI_PACKAGE_ROOT;return a?(0,g.resolve)(a,"openclaw-plugin"):(0,g.resolve)((0,A.fileURLToPath)(D.url),"..","..","..","openclaw-plugin")}function U(a){return"string"==typeof a&&(/(?:^|\/)openclaw-plugin\/?$/.test(a)||a.includes("openclaw-plugin")&&a.includes("failproofai"))}let V="failproofai",W=new Set(["PreToolUse","PostToolUse"]);function X(a){if(!a||"object"!=typeof a)return!1;let b=a.command;return"string"==typeof b&&b.includes("failproofai")&&b.includes("--cli goose")}let Y={claude:M,codex:{id:"codex",displayName:"OpenAI Codex",scopes:["user","project"],eventTypes:p,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".codex","hooks.json");case"project":case"local":return(0,g.resolve)(c,".codex","hooks.json")}},readSettings:a=>E(a),writeSettings(a,b){F(a,b)},buildHookEntry:(a,b,c)=>({type:"command",command:"project"===c?`npx -y failproofai --hook ${b} --cli codex`:`"${a}" --hook ${b} --cli codex`,timeout:60,[z]:!0}),isFailproofaiHook:I,writeHookEntries(a,b,c){for(let d of(J(a),a.hooks||(a.hooks={}),p)){let e=q[d],f=this.buildHookEntry(b,d,c);a.hooks[e]||(a.hooks[e]=[]);let g=a.hooks[e],h=!1;for(let a of g){if(!a.hooks)continue;let b=a.hooks.findIndex(a=>I(a));if(b>=0){a.hooks[b]=f,h=!0;break}}h||g.push({hooks:[f]})}},removeHooksFromFile(a){let b=this.readSettings(a),c=J(b);if(!b.hooks)return c&&this.writeSettings(a,b),0;let d=0;for(let a of Object.keys(b.hooks)){let c=b.hooks[a];if(Array.isArray(c)){for(let a=c.length-1;a>=0;a--){let b=c[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!I(a)),d+=e-b.hooks.length,0===b.hooks.length&&c.splice(a,1)}0===c.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,(d>0||c)&&this.writeSettings(a,b),d},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)){for(let a of b)if(a.hooks&&a.hooks.some(a=>I(a)))return!0}}catch{}return!1},detectInstalled:()=>K("codex")},copilot:{id:"copilot",displayName:"GitHub Copilot",scopes:["user","project"],eventTypes:s,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".copilot","hooks","failproofai.json");case"project":case"local":return(0,g.resolve)(c,".github","hooks","failproofai.json")}},readSettings(a){let b=E(a);return void 0===b.version&&(b.version=1),b},writeSettings(a,b){F(a,b)},buildHookEntry(a,b,c){let d="project"===c?`npx -y failproofai --hook ${b} --cli copilot`:`"${a}" --hook ${b} --cli copilot`;return{type:"command",bash:d,powershell:d,timeoutSec:60,[z]:!0}},isFailproofaiHook:N,writeHookEntries(a,b,c){for(let d of(void 0===a.version&&(a.version=1),a.hooks||(a.hooks={}),s)){let e=this.buildHookEntry(b,d,c);a.hooks[d]||(a.hooks[d]=[]);let f=a.hooks[d],g=!1;for(let a of f){if(!a.hooks)continue;let b=a.hooks.findIndex(a=>N(a));if(b>=0){a.hooks[b]=e,g=!0;break}}g||f.push({hooks:[e]})}},removeHooksFromFile(a){let b=this.readSettings(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(Array.isArray(d)){for(let a=d.length-1;a>=0;a--){let b=d[a];if(!b.hooks)continue;let e=b.hooks.length;b.hooks=b.hooks.filter(a=>!N(a)),c+=e-b.hooks.length,0===b.hooks.length&&d.splice(a,1)}0===d.length&&delete b.hooks[a]}}return 0===Object.keys(b.hooks).length&&delete b.hooks,this.writeSettings(a,b),c},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)){for(let a of b)if(a.hooks&&a.hooks.some(a=>N(a)))return!0}}catch{}return!1},detectInstalled:()=>K("copilot")},cursor:{id:"cursor",displayName:"Cursor Agent",scopes:["user","project"],eventTypes:t,getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".cursor","hooks.json");case"project":case"local":return(0,g.resolve)(c,".cursor","hooks.json")}},readSettings(a){let b=E(a);return void 0===b.version&&(b.version=1),b},writeSettings(a,b){F(a,b)},buildHookEntry:(a,b,c)=>({type:"command",command:"project"===c?`npx -y failproofai --hook ${b} --cli cursor`:`"${a}" --hook ${b} --cli cursor`,timeout:60,[z]:!0}),isFailproofaiHook:I,writeHookEntries(a,b,c){for(let d of(void 0===a.version&&(a.version=1),a.hooks||(a.hooks={}),t)){let e=this.buildHookEntry(b,d,c),f=a.hooks[d],g=f??[];f||(a.hooks[d]=g);let h=g.findIndex(a=>I(a));h>=0?g[h]=e:g.push(e)}},removeHooksFromFile(a){let b=this.readSettings(a);if(!b.hooks)return 0;let c=0;for(let a of Object.keys(b.hooks)){let d=b.hooks[a];if(!Array.isArray(d))continue;let e=d.length,f=d.filter(a=>!I(a));c+=e-f.length,0===f.length?delete b.hooks[a]:b.hooks[a]=f}return 0===Object.keys(b.hooks).length&&delete b.hooks,this.writeSettings(a,b),c},hooksInstalledInSettings(a,b){let c=this.getSettingsPath(a,b);if(!(0,e.existsSync)(c))return!1;try{let a=this.readSettings(c);if(!a.hooks)return!1;for(let b of Object.values(a.hooks))if(Array.isArray(b)&&b.some(a=>I(a)))return!0}catch{}return!1},detectInstalled:()=>K("cursor-agent")||K("agent")},opencode:{id:"opencode",displayName:"OpenCode",scopes:["user","project"],eventTypes:["tool.execute.before","tool.execute.after","session.created","session.deleted","session.idle","message.updated","permission.ask"],getSettingsPath(a,b){let c=b?(0,g.resolve)(b):process.cwd();switch(a){case"user":return(0,g.resolve)((0,m.homedir)(),".config","opencode","opencode.json");case"project":case"local":return(0,g.resolve)(c,".opencode","opencode.json")}},readSettings:a=>E(a),writeSettings(a,b){F(a,b)},buildHookEntry(a,b,c){if("user"===c){let a=(0,g.resolve)((0,m.homedir)(),".config","opencode","plugins","failproofai.mjs");return{spec:`file://${a}`,[z]:!0}}return{spec:O,[z]:!0}},isFailproofaiHook:a=>"string"==typeof a?a.includes("failproofai.mjs"):!!Array.isArray(a)&&"string"==typeof a[0]&&a[0].includes("failproofai.mjs"),writeHookEntries(a,b,c){let d,f,h=c??"project",i=P("user"===h?(0,g.resolve)((0,m.homedir)(),".config","opencode","opencode.json"):(0,g.resolve)(process.cwd(),".opencode","opencode.json"));(0,e.mkdirSync)((0,g.dirname)(i),{recursive:!0}),(0,e.writeFileSync)(i,(f=(d="project"===h)?'""':JSON.stringify(b),`// AUTO-GENERATED by failproofai. ${z}
26
26
  // Re-generate via: failproofai policies --install --cli opencode
27
27
  // Plugin shim that bridges OpenCode's plugin API to the failproofai binary.
28
28
  // See: https://opencode.ai/docs/plugins/
@@ -236,7 +236,7 @@ Name the one you mean:
236
236
  Name the one you mean:
237
237
  `+i.map(a=>` ${a.packId}:${a.name}`).join("\n"));d.push(e)}if(d.length>0){let a=e.flatMap(a=>a.policies.map(b=>`${a.id}:${b.name}`));throw new ak(`Unknown policy name(s): ${d.join(", ")}
238
238
  Valid policies: ${[...aV].join(", ")}`+(a.length>0?`
239
- From installed packs: ${a.join(", ")}`:""))}return{builtins:b,packs:c}}function aY(a,b,c,d){if(0!==a.length){for(let c of a){let a=aT(c.packId,c.name,b);if(!a.ok)throw new ak(`Could not ${b?"enable":"disable"} ${c.name}: ${a.reason}`)}if(b){let b=(0,k.readScopedHooksConfig)(c,d),e=new Set(a.map(a=>a.disabledKey)),f=(b.disabledCustomPolicies??[]).filter(a=>!e.has(a));if(f.length!==(b.disabledCustomPolicies??[]).length){let a={...b,disabledCustomPolicies:f};0===f.length&&delete a.disabledCustomPolicies,(0,k.writeScopedHooksConfig)(a,c,d)}}for(let c of a)console.log(`${b?"Enabled":"Disabled"} ${c.name} from pack ${c.packId}@${c.packVersion}.`)}}function aZ(a,b){return o.some(c=>{try{return Z(c).hooksInstalledInSettings(a,b)}catch{return!1}})}async function a$(a,b="user",c,d=!1,e,f,g=!1,h,i={}){let{replace:j=!1,quiet:k=!1}=i;if(!k)return a_(a,b,c,d,e,f,g,h,j);let l=console.log;console.log=()=>{};try{return await a_(a,b,c,d,e,f,g,h,j)}finally{console.log=l}}async function a_(a,b="user",c,d=!1,f,h,i=!1,j,o=!1){let p,q;if(void 0!==a&&a.length>0){let d=a.filter(a=>"all"!==a);if(d.length>0){let e=aX(d);if(aY(e.packs,!0,b,c),e.packs.length>0&&0===(a=a.filter(a=>"all"===a||e.builtins.includes(a))).length)return}if(a.includes("all")&&d.length>0)throw new ak(`"all" cannot be combined with specific policy names.
239
+ From installed packs: ${a.join(", ")}`:""))}return{builtins:b,packs:c}}function aY(a,b,c,d){if(0!==a.length){for(let c of a){let a=aT(c.packId,c.name,b);if(!a.ok)throw new ak(`Could not ${b?"enable":"disable"} ${c.name}: ${a.reason}`)}if(b){let b=(0,k.readScopedHooksConfig)(c,d),e=new Set(a.map(a=>a.disabledKey)),f=(b.disabledCustomPolicies??[]).filter(a=>!e.has(a));if(f.length!==(b.disabledCustomPolicies??[]).length){let a={...b,disabledCustomPolicies:f};0===f.length&&delete a.disabledCustomPolicies,(0,k.writeScopedHooksConfig)(a,c,d)}}for(let c of a)console.log(`${b?"Enabled":"Disabled"} ${c.name} from pack ${c.packId}@${c.packVersion}.`)}}function aZ(a,b){var c,d;return(c=a,d=b,o.filter(a=>{try{let b=Z(a);if(!b.scopes.includes(c)||!b.hooksInstalledInSettings(c,d))return!1;let e=b.getSettingsPath(c,d);return!n.some(a=>a!==c&&n.indexOf(a)<n.indexOf(c)&&b.scopes.includes(a)&&function(a,b,c){try{return a.getSettingsPath(b,c)}catch{return null}}(b,a,d)===e)}catch{return!1}})).length>0}async function a$(a,b="user",c,d=!1,e,f,g=!1,h,i={}){let{replace:j=!1,quiet:k=!1}=i;if(!k)return a_(a,b,c,d,e,f,g,h,j);let l=console.log;console.log=()=>{};try{return await a_(a,b,c,d,e,f,g,h,j)}finally{console.log=l}}async function a_(a,b="user",c,d=!1,f,h,i=!1,j,o=!1){let p,q;if(void 0!==a&&a.length>0){let d=a.filter(a=>"all"!==a);if(d.length>0){let e=aX(d);if(aY(e.packs,!0,b,c),e.packs.length>0&&0===(a=a.filter(a=>"all"===a||e.builtins.includes(a))).length)return}if(a.includes("all")&&d.length>0)throw new ak(`"all" cannot be combined with specific policy names.
240
240
  Use either: --install all or --install block-sudo sanitize-jwt ...`)}let r=j&&j.length>0?[...new Set(j)]:["claude"];for(let a of r){let c=Z(a);if(!c.scopes.includes(b)){try{await (0,ag.trackHookEvent)((0,ah.getInstanceId)(),"scope_validation_failed",{cli:a,scope:b,supported_scopes:c.scopes})}catch{}throw new ak(`Scope "${b}" is not supported by ${c.displayName}. Valid scopes: ${c.scopes.join(", ")}`)}}let s=function(){let a=process.env.FAILPROOFAI_BINARY_OVERRIDE;if(a&&a.trim())return a.trim();try{return(0,l.execSync)("which failproofai",{encoding:"utf8"}).trim().split("\n")[0].trim()}catch{throw new ak("failproofai binary not found in PATH.\nInstall it globally first: npm install -g failproofai")}}(),t=(0,k.readScopedHooksConfig)(b,c),u=new Set(t.enabledPolicies);if(void 0!==a){let b;b=1===a.length&&"all"===a[0]?af.BUILTIN_POLICIES.filter(a=>d||!a.beta).map(a=>a.name):a,p=o?[...new Set(b)]:[...new Set([...t.enabledPolicies,...b])]}else{let a=t.enabledPolicies.length>0?t.enabledPolicies:void 0;p=await ai(a,{includeBeta:d})}let v={...t,enabledPolicies:p};if(i)delete v.customPoliciesPath,delete v.customPoliciesPaths;else if(h&&("string"==typeof h||h.length>0)){let a=("string"==typeof h?[h]:h).map(a=>(0,g.resolve)(a)),c=(t.customPoliciesPaths??(t.customPoliciesPath?[t.customPoliciesPath]:[])).map(a=>(0,g.resolve)(a)).filter(a=>!!(0,e.existsSync)(a)||(console.log(`Dropping custom policies path (file no longer exists): ${a}`),!1));for(let d of(v.customPoliciesPaths=o?[...new Set(a)]:[...new Set([...c,...a])],delete v.customPoliciesPath,a)){let a=[];try{a=await (0,aj.loadCustomHooks)(d,{strict:!0})}catch(c){let a=c instanceof Error?c.message:String(c);try{await (0,ag.trackHookEvent)((0,ah.getInstanceId)(),"custom_policy_validation_failed",{scope:b,error_type:/not found/i.test(a)?"file_not_found":"load_error"})}catch{}console.error(`Error: ${a}`),process.exit(1)}if(0===a.length){try{await (0,ag.trackHookEvent)((0,ah.getInstanceId)(),"custom_policy_validation_failed",{scope:b,error_type:"no_hooks_registered"})}catch{}console.error(`Error: no hooks registered in ${d}. Make sure your file calls customPolicies.add(...) at least once.`),process.exit(1)}console.log(`
241
241
  Validated ${a.length} custom hook(s) from ${d}: ${a.map(a=>a.name).join(", ")}`)}}(0,k.writeScopedHooksConfig)(v,b,c);let w=new Set(af.BUILTIN_POLICIES.filter(a=>a.alwaysOn).map(a=>a.name)),x=p.filter(a=>!w.has(a));if(x.length>0){if(!function(){try{let a=JSON.parse((0,e.readFileSync)(as(),"utf8"));return Array.isArray(a.packs)&&a.packs.length>0}catch{return!1}}())try{await aS(aL,{only:x})}catch(a){console.log(`
242
242
  Warning: could not fetch the policy pack (${a instanceof Error?a.message:String(a)}).
@@ -244,6 +244,6 @@ Run \`failproofai policies add core\` once you are online.`)}else for(let a of x
244
244
  Enabled ${p.length} policy(ies): ${p.join(", ")}
245
245
  `),i)console.log("Custom hooks path cleared.");else if(v.customPoliciesPaths?.length||v.customPoliciesPath){let a=v.customPoliciesPaths??[v.customPoliciesPath];console.log(`Custom hooks paths: ${a.join(", ")}`)}let y=[];for(let a of r){let d=Z(a),e=L(d,b,c);try{for(let c of e){let e=d.readSettings(c);d.writeHookEntries(e,s,b),d.writeSettings(c,e),y.push({cli:a,path:c})}}catch(d){let c=d instanceof Error&&/EACCES|EPERM/.test(d.message)?"permission_denied":d instanceof Error&&/ENOENT|ENOTDIR/.test(d.message)?"path_not_found":"write_error";try{await (0,ag.trackHookEvent)((0,ah.getInstanceId)(),"hook_write_failed",{cli:a,scope:b,error_type:c})}catch{}throw d}}try{let a=new Set(p),c=p.filter(a=>!u.has(a)),e=[...u].filter(b=>!a.has(b)),g=(0,ah.getInstanceId)();if(await (0,ag.trackHookEvent)(g,"hooks_installed",{scope:b,cli:r,cli_count:r.length,policies:p,policy_count:p.length,policies_added:c,policies_removed:e,...f?{source:f}:{},platform:(0,m.platform)(),arch:(0,m.arch)(),os_release:(0,m.release)(),hostname_hash:(0,ah.hashToId)((0,m.hostname)()),has_custom_hooks_path:!!(v.customPoliciesPaths?.length||v.customPoliciesPath),has_policy_params:!!(v.policyParams&&Object.keys(v.policyParams).length>0),param_policy_names:v.policyParams?Object.keys(v.policyParams):[],command_format:"project"===b?"npx":"absolute"}),d){let a=new Set(af.BUILTIN_POLICIES.filter(a=>a.beta).map(a=>a.name)),c=p.filter(b=>a.has(b));c.length>0&&await (0,ag.trackHookEvent)(g,"beta_policies_installed",{scope:b,cli:r,beta_count:c.length,beta_policy_names:c,...f?{source:f}:{}})}}catch{}for(let{cli:a,path:c}of y){let d=Z(a);console.log(`Failproof AI hooks installed for ${d.displayName} (${d.eventTypes.length} event types, scope: ${b}).`),console.log(`Settings: ${c}`)}"project"===b?(console.log("Command: npx -y failproofai"),console.log(`
246
246
  This file can be committed to git — no machine-specific paths.`)):console.log(`Binary: ${s}`);let z=(q=new Set,n.filter(a=>{let b=aW(a,c);return!q.has(b)&&(q.add(b),!0)})).filter(a=>a!==b).filter(a=>aZ(a,c));if(z.length>0){let a=z.map(a=>`${a} (${function(a){switch(a){case"user":return"~/.claude/settings.json";case"project":return"{cwd}/.claude/settings.json";case"local":return"{cwd}/.claude/settings.local.json"}}(a)})`).join(", ");console.log(),console.log(`\x1b[33mWarning: Failproof AI hooks are also installed at ${a}.\x1b[0m`),console.log("Having hooks in multiple scopes may cause duplicate policy evaluation."),console.log(`Use \`failproofai policies --uninstall --scope ${z[0]}\` to remove the other installation,`),console.log("or `failproofai policies` to see all scopes.");try{await (0,ag.trackHookEvent)((0,ah.getInstanceId)(),"multi_scope_warning_shown",{new_scope:b,existing_scopes:z,cli:r})}catch{}}}async function a0(a,b="user",c,d){let f="all"===b?"user":b,g=d?.cli&&d.cli.length>0?[...new Set(d.cli)]:["claude"];if(d?.removeCustomHooks){let a=(0,k.readScopedHooksConfig)(f,c);delete a.customPoliciesPath,delete a.customPoliciesPaths,(0,k.writeScopedHooksConfig)(a,f,c),console.log("Custom hooks path cleared.")}if(a&&a.length>0&&(1!==a.length||"all"!==a[0])){let b=aX(a);aY(b.packs,!1,f,c);var h=a=b.builtins;let d=new Set(af.BUILTIN_POLICIES.filter(a=>a.alwaysOn).map(a=>a.name)),e=h.filter(a=>d.has(a));if(e.length>0)throw new ak(`Cannot disable: ${e.join(", ")}
247
- This policy stops an agent from switching off failproofai itself, so it is always on and ships with the package. A guard the agent can disable by the means it is meant to prevent is not a guard.`);if(b.packs.length>0&&0===a.length)return}if(a&&a.length>0&&(1!==a.length||"all"!==a[0])){let e=(0,k.readScopedHooksConfig)(f,c),h=new Set(a),i=e.enabledPolicies.filter(a=>!h.has(a)),j=a.filter(a=>!e.enabledPolicies.includes(a));j.length>0&&console.log(`Warning: policy(ies) not currently enabled: ${j.join(", ")}`);let{policyParams:l,...n}=e,o=l?Object.fromEntries(Object.entries(l).filter(([a])=>!h.has(a))):null,p={...n,enabledPolicies:i,...o&&Object.keys(o).length>0?{policyParams:o}:{}};(0,k.writeScopedHooksConfig)(p,f,c);try{let c=(0,ah.getInstanceId)(),f=a.filter(a=>e.enabledPolicies.includes(a));await (0,ag.trackHookEvent)(c,"hooks_removed",{scope:b,cli:g,removal_mode:d?.betaOnly?"beta_policies":"policies",beta_only:d?.betaOnly??!1,policies_removed:f,removed_count:f.length,...d?.source?{source:d.source}:{},platform:(0,m.platform)(),arch:(0,m.arch)(),os_release:(0,m.release)(),hostname_hash:(0,ah.hashToId)((0,m.hostname)())})}catch{}console.log(`Disabled ${a.length-j.length} policy(ies).`),console.log(`Remaining: ${i.length>0?i.join(", "):"(none)"}`);return}let i=(0,k.readScopedHooksConfig)(f,c),j=0,l=!1;for(let a of g){let d=Z(a);for(let a of"all"===b?[...d.scopes]:d.scopes.includes(b)?[b]:[]){let f=L(d,a,c).filter(a=>(0,e.existsSync)(a));if(0===f.length){"all"!==b&&1===g.length&&(console.log("No settings file found. Nothing to remove."),l=!0);continue}let h=0;for(let a of f){let c=d.removeHooksFromFile(a);h+=c,c>0&&"all"!==b&&(console.log(`Removed ${c} failproofai hook(s) from ${d.displayName} settings.`),console.log(`Settings: ${a}`))}if(0===h&&"all"!==b&&1===g.length){console.log("No hooks found in settings. Nothing to remove."),l=!0;continue}j+=h}}if(!l||0!==j){if("all"===b)for(let a of(console.log(`Removed ${j} failproofai hook(s) from all scopes.`),g)){let b=Z(a);for(let a of b.scopes)for(let d of L(b,a,c))console.log(` ${b.displayName} / ${a}: ${d}`)}try{let a=(0,ah.getInstanceId)();await (0,ag.trackHookEvent)(a,"hooks_removed",{scope:b,cli:g,removal_mode:"hooks",policies_removed:i.enabledPolicies,removed_count:j,...d?.source?{source:d.source}:{},platform:(0,m.platform)(),arch:(0,m.arch)(),os_release:(0,m.release)(),hostname_hash:(0,ah.hashToId)((0,m.hostname)())})}catch{}if("all"===b)for(let a of n){let b=(0,k.readScopedHooksConfig)(a,c);if(b.enabledPolicies.length>0||b.customPoliciesPaths?.length||b.customPoliciesPath||b.policyParams){let{customPoliciesPath:d,customPoliciesPaths:e,policyParams:f,...g}=b;(0,k.writeScopedHooksConfig)({...g,enabledPolicies:[]},a,c)}}else if(!n.some(a=>aZ(a,c))){let{customPoliciesPath:a,customPoliciesPaths:b,policyParams:d,...e}=(0,k.readScopedHooksConfig)(f,c);(0,k.writeScopedHooksConfig)({...e,enabledPolicies:[]},f,c)}}}var a1=a.i(24282),a2=a.i(12714);async function a3(a,b){let c=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),d=(0,g.resolve)((0,k.findProjectConfigDir)(c),".failproofai","policies"),e=(0,h.customPoliciesDir)(),f=[];for(let{scope:c,dir:h}of[{scope:"project",dir:d},...e===d?[]:[{scope:"user",dir:e}]]){let d=[];try{d=(0,aj.discoverPolicyFiles)(h)}catch{continue}for(let e of d){if(b.has(e))continue;let d=[];try{d=(await a4(e)).map(b=>{let d=(0,aj.conventionPolicyId)(c,(0,g.basename)(e),b.name);return{...b,id:d,enabled:!a.has(d)}})}catch{}f.push({scope:c,file:(0,g.basename)(e),path:e,policies:d})}}return f}async function a4(a){if(!(0,e.existsSync)(a))return[];let b=await (0,a2.readFile)(a,"utf-8"),c=[],d=b.split(/customPolicies\.add\s*\(/);for(let a=1;a<d.length;a++){let b=d[a],e=b.match(/name:\s*["'`]([^"'`]+)["'`]/);if(!e)continue;let f=b.match(/description:\s*["'`]([^"'`]+)["'`]/),g=b.match(/events:\s*\[([^\]]+)\]/),h=g?g[1].replace(/["'`\s]/g,"").split(",").filter(Boolean).join(", "):void 0;c.push({name:e[1],description:f?.[1],eventScope:h,id:"",enabled:!0})}return c}async function a5(){let a=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),b=(0,k.readMergedHooksConfig)(a),c=new Set(b.disabledCustomPolicies??[]),d=n.filter(a=>aZ(a)),e=aW(d[0]??"user"),f=o.map(a=>Y[a]).filter(a=>void 0!==a).map(a=>({id:a.id,label:(0,a1.getCliLabel)(a.id),installed:a.hooksInstalledInSettings("user"),settingsPath:a.getSettingsPath("user"),detected:a.detectInstalled()})),h=[],i=[];try{let a=au();h=a.packs,i=a.errors}catch{}let j=[];for(let a of h){let d=a.enabled??a.policies.map(a=>a.name);for(let e of a.policies)j.push({name:e.name,description:e.description,category:e.category,defaultEnabled:e.defaultEnabled,beta:!1,enabled:d.includes(e.name)&&!c.has(`pack:${a.id}@${a.version}:${e.name}`),eventScope:function(a){let b=a.events?.join(", ")??"",c=a.toolNames?` \xb7 ${a.toolNames.join(", ")}`:"";return`${b}${c}`}(e.match),packId:a.id,packVersion:a.version,...e.params?{params:Object.fromEntries(Object.entries(e.params).map(([a,b])=>[a,{type:b.type,description:b.description,default:b.default}])),currentParams:b.policyParams?.[e.name]??{}}:{}})}let l=(0,k.configuredCustomPolicyPaths)(b),m=(0,k.findProjectConfigDir)(a),p=l.map(a=>(0,g.resolve)(m,a)),q=(await Promise.all(p.map(async a=>{try{return(await a4(a)).map(b=>{let d=(0,aj.customPolicyId)(a,b.name);return{...b,id:d,enabled:!c.has(d)}})}catch{return[]}}))).flat(),r=await a3(c,new Set(p)),s=h.map(a=>{let b=a.enabled??a.policies.map(a=>a.name);return{id:a.id,version:a.version,source:a.source,effect:a.effect,policies:a.policies.map(d=>({name:d.name,description:d.description,category:d.category,enabled:b.includes(d.name)&&!c.has(`pack:${a.id}@${a.version}:${d.name}`)}))}});for(let a of i)s.push({id:a.id??"(unnamed pack)",version:"",source:"",effect:"enforce",policies:[],error:a.reason});return{enabledPolicies:b.enabledPolicies,installedScopes:d,settingsPath:e,clis:f,policies:j,customPoliciesPaths:l.length?l:void 0,customPoliciesPath:1===l.length?l[0]:void 0,customPolicies:q.length?q:void 0,conventionPolicies:r,packs:s}}async function a6(a,b){let c=(0,k.readHooksConfig)(),d=new Set(c.enabledPolicies);b?d.add(a):d.delete(a),(0,k.writeHooksConfig)({...c,enabledPolicies:[...d]});try{let c=(0,ah.getInstanceId)();await (0,ag.trackHookEvent)(c,"policy_toggled",{policy_name:a,enabled:b,action:b?"enable":"disable",source:"web"})}catch{}}async function a7(a,b){if(!a.startsWith("custom:")&&!a.startsWith("convention:"))throw Error("Invalid custom policy ID");let c=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd();if(b){for(let b of n){let d=(0,k.readScopedHooksConfig)(b,c);if(!d.disabledCustomPolicies?.includes(a))continue;let e=d.disabledCustomPolicies.filter(b=>b!==a),f={...d,disabledCustomPolicies:e};e.length||delete f.disabledCustomPolicies,(0,k.writeScopedHooksConfig)(f,b,c)}return}let d=(0,k.readHooksConfig)(),e=new Set(d.disabledCustomPolicies??[]);e.add(a);let f={...d,disabledCustomPolicies:[...e]};e.size||delete f.disabledCustomPolicies,(0,k.writeHooksConfig)(f)}async function a8(a,b){let c=a.trim();if(!c)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await aN(c,b??{});return{ok:!0,id:a.id,version:a.version,enabled:a.enabled,available:a.available}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function a9(){try{let a=await aS(aL);return{ok:!0,id:a.id,version:a.version,enabled:a.enabled,available:a.available}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function ba(a){return!function(a){let b,c=(0,g.resolve)(aq(),"installed.json");if(!(0,e.existsSync)(c))return!1;try{b=JSON.parse((0,e.readFileSync)(c,"utf8"))}catch{return!1}let d=Array.isArray(b.packs)?b.packs:[],f=d.filter(b=>b?.id!==a);return f.length!==d.length&&(aK(c,JSON.stringify({schemaVersion:1,packs:f},null,2)+"\n"),!0)}(a)?{ok:!1,error:`No installed pack with id ${a}`}:{ok:!0,id:a}}async function bb(a,b,c){let d=aT(a,b,c);if(!d.ok)return{ok:!1,error:d.reason};if(c){let c=au().packs.find(b=>b.id===a);if(c){let a=`pack:${c.id}@${c.version}:${b}`,d=(0,k.readHooksConfig)(),e=(d.disabledCustomPolicies??[]).filter(b=>b!==a);if(e.length!==(d.disabledCustomPolicies??[]).length){let{disabledCustomPolicies:a,...b}=d;(0,k.writeHooksConfig)(e.length>0?{...b,disabledCustomPolicies:e}:b)}}}return{ok:!0,id:a}}async function bc(a){let b=a.trim();if(!b)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await aO(b);return{ok:!0,id:a.id,version:a.version,source:a.source,effect:a.effect,policies:a.policies.map(a=>({name:a.name,description:a.description,category:a.category,defaultEnabled:a.defaultEnabled}))}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function bd(a="user",b){let c=(0,k.readHooksConfig)(),d=c.enabledPolicies.length>0?c.enabledPolicies:af.BUILTIN_POLICIES.filter(a=>a.defaultEnabled&&!a.beta).map(a=>a.name),e=b&&b.length>0?b:$(),f=e.length>0?e:["claude"];await a$(d,a,void 0,!1,"web",void 0,!1,f)}async function be(a="user",b){let c=b&&b.length>0?b:$(),d=c.length>0?c:["claude"];await a0(void 0,a,void 0,{source:"web",cli:d})}async function bf(a,b){let c=(0,k.readHooksConfig)(),d={...c.policyParams??{},[a]:b};(0,k.writeHooksConfig)({...c,policyParams:d});try{let c=(0,ah.getInstanceId)();await (0,ag.trackHookEvent)(c,"policy_params_updated",{policy_name:a,param_keys:Object.keys(b),source:"web"})}catch{}}(0,i.ensureServerEntryExports)([a5]),(0,d.registerServerReference)(a5,"003297badd24a9944221b0fba23674e9b89487010f",null),(0,i.ensureServerEntryExports)([a6,a7]),(0,d.registerServerReference)(a6,"6076fdd0eb8fa2dbeb6e0a83f45bad2b35706f2478",null),(0,d.registerServerReference)(a7,"604a95b84cb52409fe60ec68e6518a8befa0d1a6d5",null),(0,i.ensureServerEntryExports)([a8,a9,ba,bb,bc]),(0,d.registerServerReference)(a8,"607947eac0639b5303b2237da33be8ee31a8794a4b",null),(0,d.registerServerReference)(a9,"00c1935ca923e9073259a95ee9446fbfed237d03b6",null),(0,d.registerServerReference)(ba,"40a4ce84314ef96c57841e751407a3acd137b47d3a",null),(0,d.registerServerReference)(bb,"705adef3e39b513091a0a38ed064578e03bd357cbe",null),(0,d.registerServerReference)(bc,"401e6e1a298250dca32e90923d38fe51e5fb824c19",null),(0,i.ensureServerEntryExports)([bd,be]),(0,d.registerServerReference)(bd,"60c535f4daca6a6727aa84c50fd49f57585a49f076",null),(0,d.registerServerReference)(be,"60f548e708e181ff81efa80d899e841972ead4b6af",null),(0,i.ensureServerEntryExports)([bf]),(0,d.registerServerReference)(bf,"60ede6e5abf3f1e14676809d0c5114cf4bb004a27e",null),a.s([],96801),a.i(96801),a.s(["00213500077768bfc8f313b5ae5d18754761a82d8c",()=>b.getTelemetryConfig,"003297badd24a9944221b0fba23674e9b89487010f",0,a5,"00a6cfb4effad813a70cb6f60834a43a78f7cd1705",0,j,"00c1935ca923e9073259a95ee9446fbfed237d03b6",0,a9,"401e6e1a298250dca32e90923d38fe51e5fb824c19",0,bc,"408bbf9b4a399025824267ac9a5c0411449992c6ef",()=>c.getHookActivityAction,"40a4ce84314ef96c57841e751407a3acd137b47d3a",0,ba,"604a95b84cb52409fe60ec68e6518a8befa0d1a6d5",0,a7,"607947eac0639b5303b2237da33be8ee31a8794a4b",0,a8,"60c535f4daca6a6727aa84c50fd49f57585a49f076",0,bd,"60da74c75441f29c23cee213f1b70f5e566b56c5f9",()=>c.searchHookActivityAction,"60ede6e5abf3f1e14676809d0c5114cf4bb004a27e",0,bf,"60f548e708e181ff81efa80d899e841972ead4b6af",0,be,"705adef3e39b513091a0a38ed064578e03bd357cbe",0,bb],73338)}];
247
+ This policy stops an agent from switching off failproofai itself, so it is always on and ships with the package. A guard the agent can disable by the means it is meant to prevent is not a guard.`);if(b.packs.length>0&&0===a.length)return}if(a&&a.length>0&&(1!==a.length||"all"!==a[0])){let e=(0,k.readScopedHooksConfig)(f,c),h=new Set(a),i=e.enabledPolicies.filter(a=>!h.has(a)),j=a.filter(a=>!e.enabledPolicies.includes(a));j.length>0&&console.log(`Warning: policy(ies) not currently enabled: ${j.join(", ")}`);let{policyParams:l,...n}=e,o=l?Object.fromEntries(Object.entries(l).filter(([a])=>!h.has(a))):null,p={...n,enabledPolicies:i,...o&&Object.keys(o).length>0?{policyParams:o}:{}};(0,k.writeScopedHooksConfig)(p,f,c);try{let c=(0,ah.getInstanceId)(),f=a.filter(a=>e.enabledPolicies.includes(a));await (0,ag.trackHookEvent)(c,"hooks_removed",{scope:b,cli:g,removal_mode:d?.betaOnly?"beta_policies":"policies",beta_only:d?.betaOnly??!1,policies_removed:f,removed_count:f.length,...d?.source?{source:d.source}:{},platform:(0,m.platform)(),arch:(0,m.arch)(),os_release:(0,m.release)(),hostname_hash:(0,ah.hashToId)((0,m.hostname)())})}catch{}console.log(`Disabled ${a.length-j.length} policy(ies).`),console.log(`Remaining: ${i.length>0?i.join(", "):"(none)"}`);return}let i=(0,k.readScopedHooksConfig)(f,c),j=0,l=!1;for(let a of g){let d=Z(a);for(let a of"all"===b?[...d.scopes]:d.scopes.includes(b)?[b]:[]){let f=L(d,a,c).filter(a=>(0,e.existsSync)(a));if(0===f.length){"all"!==b&&1===g.length&&(console.log("No settings file found. Nothing to remove."),l=!0);continue}let h=0;for(let a of f){let c=d.removeHooksFromFile(a);h+=c,c>0&&"all"!==b&&(console.log(`Removed ${c} failproofai hook(s) from ${d.displayName} settings.`),console.log(`Settings: ${a}`))}if(0===h&&"all"!==b&&1===g.length){console.log("No hooks found in settings. Nothing to remove."),l=!0;continue}j+=h}}if(!l||0!==j){if("all"===b)for(let a of(console.log(`Removed ${j} failproofai hook(s) from all scopes.`),g)){let b=Z(a);for(let a of b.scopes)for(let d of L(b,a,c))console.log(` ${b.displayName} / ${a}: ${d}`)}try{let a=(0,ah.getInstanceId)();await (0,ag.trackHookEvent)(a,"hooks_removed",{scope:b,cli:g,removal_mode:"hooks",policies_removed:i.enabledPolicies,removed_count:j,...d?.source?{source:d.source}:{},platform:(0,m.platform)(),arch:(0,m.arch)(),os_release:(0,m.release)(),hostname_hash:(0,ah.hashToId)((0,m.hostname)())})}catch{}if("all"===b)for(let a of n){let b=(0,k.readScopedHooksConfig)(a,c);if(b.enabledPolicies.length>0||b.customPoliciesPaths?.length||b.customPoliciesPath||b.policyParams){let{customPoliciesPath:d,customPoliciesPaths:e,policyParams:f,...g}=b;(0,k.writeScopedHooksConfig)({...g,enabledPolicies:[]},a,c)}}else if(!n.some(a=>aZ(a,c))){let{customPoliciesPath:a,customPoliciesPaths:b,policyParams:d,...e}=(0,k.readScopedHooksConfig)(f,c);(0,k.writeScopedHooksConfig)({...e,enabledPolicies:[]},f,c)}}}var a1=a.i(24282),a2=a.i(12714);async function a3(a,b){let c=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),d=(0,g.resolve)((0,k.findProjectConfigDir)(c),".failproofai","policies"),e=(0,h.customPoliciesDir)(),f=[];for(let{scope:c,dir:h}of[{scope:"project",dir:d},...e===d?[]:[{scope:"user",dir:e}]]){let d=[];try{d=(0,aj.discoverPolicyFiles)(h)}catch{continue}for(let e of d){if(b.has(e))continue;let d=[];try{d=(await a4(e)).map(b=>{let d=(0,aj.conventionPolicyId)(c,(0,g.basename)(e),b.name);return{...b,id:d,enabled:!a.has(d)}})}catch{}f.push({scope:c,file:(0,g.basename)(e),path:e,policies:d})}}return f}async function a4(a){if(!(0,e.existsSync)(a))return[];let b=await (0,a2.readFile)(a,"utf-8"),c=[],d=b.split(/customPolicies\.add\s*\(/);for(let a=1;a<d.length;a++){let b=d[a],e=b.match(/name:\s*["'`]([^"'`]+)["'`]/);if(!e)continue;let f=b.match(/description:\s*["'`]([^"'`]+)["'`]/),g=b.match(/events:\s*\[([^\]]+)\]/),h=g?g[1].replace(/["'`\s]/g,"").split(",").filter(Boolean).join(", "):void 0;c.push({name:e[1],description:f?.[1],eventScope:h,id:"",enabled:!0})}return c}async function a5(){let a=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd(),b=(0,k.readMergedHooksConfig)(a),c=new Set(b.disabledCustomPolicies??[]),d=n.filter(a=>aZ(a)),e=aW(d[0]??"user"),f=o.map(a=>Y[a]).filter(a=>void 0!==a).map(a=>({id:a.id,label:(0,a1.getCliLabel)(a.id),installed:a.hooksInstalledInSettings("user"),settingsPath:a.getSettingsPath("user"),detected:a.detectInstalled()})),h=[],i=[];try{let a=au();h=a.packs,i=a.errors}catch{}let j=[];for(let a of h){let d=a.enabled??a.policies.map(a=>a.name);for(let e of a.policies)j.push({name:e.name,description:e.description,category:e.category,defaultEnabled:e.defaultEnabled,beta:!1,enabled:d.includes(e.name)&&!c.has(`pack:${a.id}@${a.version}:${e.name}`),eventScope:function(a){let b=a.events?.join(", ")??"",c=a.toolNames?` \xb7 ${a.toolNames.join(", ")}`:"";return`${b}${c}`}(e.match),packId:a.id,packVersion:a.version,...e.params?{params:Object.fromEntries(Object.entries(e.params).map(([a,b])=>[a,{type:b.type,description:b.description,default:b.default}])),currentParams:b.policyParams?.[e.name]??{}}:{}})}let l=(0,k.configuredCustomPolicyPaths)(b),m=(0,k.findProjectConfigDir)(a),p=l.map(a=>(0,g.resolve)(m,a)),q=(await Promise.all(p.map(async a=>{try{return(await a4(a)).map(b=>{let d=(0,aj.customPolicyId)(a,b.name);return{...b,id:d,enabled:!c.has(d)}})}catch{return[]}}))).flat(),r=await a3(c,new Set(p)),s=h.map(a=>{let b=a.enabled??a.policies.map(a=>a.name);return{id:a.id,version:a.version,source:a.source,effect:a.effect,policies:a.policies.map(d=>({name:d.name,description:d.description,category:d.category,enabled:b.includes(d.name)&&!c.has(`pack:${a.id}@${a.version}:${d.name}`)}))}});for(let a of i)s.push({id:a.id??"(unnamed pack)",version:"",source:"",effect:"enforce",policies:[],error:a.reason});return{enabledPolicies:b.enabledPolicies,installedScopes:d,settingsPath:e,clis:f,policies:j,customPoliciesPaths:l.length?l:void 0,customPoliciesPath:1===l.length?l[0]:void 0,customPolicies:q.length?q:void 0,conventionPolicies:r,packs:s}}async function a6(a,b){let c=(0,k.readHooksConfig)(),d=new Set(c.enabledPolicies);b?d.add(a):d.delete(a),(0,k.writeHooksConfig)({...c,enabledPolicies:[...d]});try{let c=(0,ah.getInstanceId)();await (0,ag.trackHookEvent)(c,"policy_toggled",{policy_name:a,enabled:b,action:b?"enable":"disable",source:"web"})}catch{}}async function a7(a,b){if(!a.startsWith("custom:")&&!a.startsWith("convention:"))throw Error("Invalid custom policy ID");let c=process.env.FAILPROOFAI_LAUNCH_CWD||process.cwd();if(b){for(let b of n){let d=(0,k.readScopedHooksConfig)(b,c);if(!d.disabledCustomPolicies?.includes(a))continue;let e=d.disabledCustomPolicies.filter(b=>b!==a),f={...d,disabledCustomPolicies:e};e.length||delete f.disabledCustomPolicies,(0,k.writeScopedHooksConfig)(f,b,c)}return}let d=(0,k.readHooksConfig)(),e=new Set(d.disabledCustomPolicies??[]);e.add(a);let f={...d,disabledCustomPolicies:[...e]};e.size||delete f.disabledCustomPolicies,(0,k.writeHooksConfig)(f)}async function a8(a,b){let c=a.trim();if(!c)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await aN(c,b??{});return{ok:!0,id:a.id,version:a.version,enabled:a.enabled,available:a.available}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function a9(){try{let a=await aS(aL);return{ok:!0,id:a.id,version:a.version,enabled:a.enabled,available:a.available}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function ba(a){return!function(a){let b,c=(0,g.resolve)(aq(),"installed.json");if(!(0,e.existsSync)(c))return!1;try{b=JSON.parse((0,e.readFileSync)(c,"utf8"))}catch{return!1}let d=Array.isArray(b.packs)?b.packs:[],f=d.filter(b=>b?.id!==a);return f.length!==d.length&&(aK(c,JSON.stringify({schemaVersion:1,packs:f},null,2)+"\n"),!0)}(a)?{ok:!1,error:`No installed pack with id ${a}`}:{ok:!0,id:a}}async function bb(a,b,c){let d=aT(a,b,c);if(!d.ok)return{ok:!1,error:d.reason};if(c){let c=au().packs.find(b=>b.id===a);if(c){let a=`pack:${c.id}@${c.version}:${b}`,d=(0,k.readHooksConfig)(),e=(d.disabledCustomPolicies??[]).filter(b=>b!==a);if(e.length!==(d.disabledCustomPolicies??[]).length){let{disabledCustomPolicies:a,...b}=d;(0,k.writeHooksConfig)(e.length>0?{...b,disabledCustomPolicies:e}:b)}}}return{ok:!0,id:a}}async function bc(a){let b=a.trim();if(!b)return{ok:!1,error:"Enter a pack source, for example acme/ops"};try{let a=await aO(b);return{ok:!0,id:a.id,version:a.version,source:a.source,effect:a.effect,policies:a.policies.map(a=>({name:a.name,description:a.description,category:a.category,defaultEnabled:a.defaultEnabled}))}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}async function bd(a="user",b){let c=(0,k.readHooksConfig)(),d=c.enabledPolicies.length>0?c.enabledPolicies:af.BUILTIN_POLICIES.filter(a=>a.defaultEnabled&&!a.beta).map(a=>a.name),e=b&&b.length>0?b:$(),f=e.length>0?e:["claude"];await a$(d,a,void 0,!1,"web",void 0,!1,f)}async function be(a="user",b){let c=b&&b.length>0?b:$(),d=c.length>0?c:["claude"];await a0(void 0,a,void 0,{source:"web",cli:d})}async function bf(a,b){let c=(0,k.readHooksConfig)(),d={...c.policyParams??{},[a]:b};(0,k.writeHooksConfig)({...c,policyParams:d});try{let c=(0,ah.getInstanceId)();await (0,ag.trackHookEvent)(c,"policy_params_updated",{policy_name:a,param_keys:Object.keys(b),source:"web"})}catch{}}(0,i.ensureServerEntryExports)([a5]),(0,d.registerServerReference)(a5,"0098d5ae3358ac3d9cec20de6688dc54f9cf99b9c3",null),(0,i.ensureServerEntryExports)([a6,a7]),(0,d.registerServerReference)(a6,"601345efa3b6c135b289f347ea8d197fc4e64f3c77",null),(0,d.registerServerReference)(a7,"60b228eb5269dc7f4333b17a6d6ead07205b6efe0c",null),(0,i.ensureServerEntryExports)([a8,a9,ba,bb,bc]),(0,d.registerServerReference)(a8,"60d0c7a6a63c1b07a64757a4b5204441ee8402662d",null),(0,d.registerServerReference)(a9,"00ec88df0edac24beb35471d60af91817e46653adf",null),(0,d.registerServerReference)(ba,"40e00773e032ee04f42d5438cad06f330dad966c06",null),(0,d.registerServerReference)(bb,"70a6ae270d351d6b2d5f244497a571dc5764dc2c2f",null),(0,d.registerServerReference)(bc,"40919111c2d197a403665b66249dfd0dd1c8e34988",null),(0,i.ensureServerEntryExports)([bd,be]),(0,d.registerServerReference)(bd,"60908f761a8a53d56f2da659c2508ad8e59aee4a1f",null),(0,d.registerServerReference)(be,"605c87dd9accbdedd9db815642d6dc78e84825357d",null),(0,i.ensureServerEntryExports)([bf]),(0,d.registerServerReference)(bf,"60610c234a9eb5344f40bceda1ad7ccf5ed0b0de37",null),a.s([],96801),a.i(96801),a.s(["006487fe2670b9ef41bc27d2197289301f434e40f2",()=>b.getTelemetryConfig,"0098d5ae3358ac3d9cec20de6688dc54f9cf99b9c3",0,a5,"00a77fbb22f30bdca788ea0e80d3737f1b19287752",0,j,"00ec88df0edac24beb35471d60af91817e46653adf",0,a9,"403b6996611007a0397763f5057ed399c5dd17509f",()=>c.getHookActivityAction,"40919111c2d197a403665b66249dfd0dd1c8e34988",0,bc,"40e00773e032ee04f42d5438cad06f330dad966c06",0,ba,"605c87dd9accbdedd9db815642d6dc78e84825357d",0,be,"60610c234a9eb5344f40bceda1ad7ccf5ed0b0de37",0,bf,"60908f761a8a53d56f2da659c2508ad8e59aee4a1f",0,bd,"60b228eb5269dc7f4333b17a6d6ead07205b6efe0c",0,a7,"60d0c7a6a63c1b07a64757a4b5204441ee8402662d",0,a8,"60edf232c907aa5a89901b45da38cd4fccb6ea5326",()=>c.searchHookActivityAction,"70a6ae270d351d6b2d5f244497a571dc5764dc2c2f",0,bb],73338)}];
248
248
 
249
249
  //# sourceMappingURL=%5Broot-of-the-server%5D__07gm3zl._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},26035,a=>{"use strict";var b=a.i(36359);a.s([],19459),a.i(19459),a.s(["00213500077768bfc8f313b5ae5d18754761a82d8c",()=>b.getTelemetryConfig],26035)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"00213500077768bfc8f313b5ae5d18754761a82d8c",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
- Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0vmspq5._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js"].map(b=>a.l(b))).then(()=>b(74493)))},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.2-beta.4",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.120.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.2.0","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.11"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.2-beta.4","@failproofai/failproofaid-linux-arm64":"1.0.2-beta.4","@failproofai/failproofaid-darwin-x64":"1.0.2-beta.4","@failproofai/failproofaid-darwin-arm64":"1.0.2-beta.4"},failproofaidBinaries:{"linux-x64":"08bc00a7f8d7c80bf898471ce59c57f4e96c1420080009cc933b2ddeb4f23750","linux-arm64":"1167d809628cff04c38efbc0eaa83ca26ab8de2878bed0ef59ca43054173eea7","darwin-x64":"6ed32db21af6869c4475e753e524ad8e128436674209ad778421b240a4bd5c53","darwin-arm64":"3843de034c9d6b11f77c1f423e6201ad6a77b7eff3b3d4460ba324c5aeb62021"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
1
+ module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},26035,a=>{"use strict";var b=a.i(36359);a.s([],19459),a.i(19459),a.s(["006487fe2670b9ef41bc27d2197289301f434e40f2",()=>b.getTelemetryConfig],26035)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"006487fe2670b9ef41bc27d2197289301f434e40f2",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
+ Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0vmspq5._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js"].map(b=>a.l(b))).then(()=>b(74493)))},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.2-beta.5",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.120.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.2.0","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.11"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.2-beta.5","@failproofai/failproofaid-linux-arm64":"1.0.2-beta.5","@failproofai/failproofaid-darwin-x64":"1.0.2-beta.5","@failproofai/failproofaid-darwin-arm64":"1.0.2-beta.5"},failproofaidBinaries:{"linux-x64":"e19a1cf9a254df830f205fac024b8a229c162c93ae73851b985d2794e09da035","linux-arm64":"fafcff01e4cce00809b5cd9ff2822705d7373acbab79444e0384cb058b6da921","darwin-x64":"d7bd609387e13f5e75287674d948c69d739bac8d6963aa731b93111d1bdd2ea2","darwin-arm64":"9a57c8eb0f23ed25328e0f7b06638a6ab7f51e1deebf479bac2c779bf9912941"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
3
3
 
4
4
  //# sourceMappingURL=%5Broot-of-the-server%5D__0da85px._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"00213500077768bfc8f313b5ae5d18754761a82d8c",null),a.s(["getTelemetryConfig",0,f])},8674,a=>{"use strict";var b=a.i(2157),c=a.i(50227),d=a.i(66680);a.s(["writeJsonAtomically",0,function(a,e,f={}){let g=f.mode??384,h=f.dirMode??448,i=(0,c.dirname)(a);(0,b.existsSync)(i)||(0,b.mkdirSync)(i,{recursive:!0,mode:h});let j=`${a}.${process.pid}.${(0,d.randomBytes)(6).toString("hex")}.tmp`;try{(0,b.writeFileSync)(j,JSON.stringify(e,null,2),{mode:g});try{(63&(0,b.statSync)(j).mode)!=0&&(0,b.chmodSync)(j,g)}catch{}(0,b.renameSync)(j,a);try{(63&(0,b.statSync)(a).mode)!=0&&(0,b.chmodSync)(a,g)}catch{}}catch(a){try{(0,b.rmSync)(j,{force:!0})}catch{}throw a}}])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
- Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.2-beta.4",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.120.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.2.0","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.11"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.2-beta.4","@failproofai/failproofaid-linux-arm64":"1.0.2-beta.4","@failproofai/failproofaid-darwin-x64":"1.0.2-beta.4","@failproofai/failproofaid-darwin-arm64":"1.0.2-beta.4"},failproofaidBinaries:{"linux-x64":"08bc00a7f8d7c80bf898471ce59c57f4e96c1420080009cc933b2ddeb4f23750","linux-arm64":"1167d809628cff04c38efbc0eaa83ca26ab8de2878bed0ef59ca43054173eea7","darwin-x64":"6ed32db21af6869c4475e753e524ad8e128436674209ad778421b240a4bd5c53","darwin-arm64":"3843de034c9d6b11f77c1f423e6201ad6a77b7eff3b3d4460ba324c5aeb62021"}}},15501,a=>{"use strict";var b=a.i(2157);a.i(8674);var c=a.i(75818);function d(){return(0,c.auditDashboardFile)()}a.s(["readDashboardCache",0,function(){let a=d();if(!(0,b.existsSync)(a))return null;try{let c=(0,b.readFileSync)(a,"utf-8"),d=JSON.parse(c);if(!d||"object"!=typeof d||"string"!=typeof d.cachedAt||!d.params||"object"!=typeof d.params||!d.result||"object"!=typeof d.result||2!==d.schemaVersion||function(a,b=30){let c=new Date(a).getTime();return!!Number.isNaN(c)||Date.now()-c>6e4*b}(d.cachedAt,10080))return null;return d}catch{return null}},"readDashboardCacheMeta",0,function(){let a=d();if(!(0,b.existsSync)(a))return null;try{let c=(0,b.readFileSync)(a,"utf-8"),d=JSON.parse(c);if(!d||2!==d.schemaVersion||"string"!=typeof d.cachedAt||Number.isNaN(new Date(d.cachedAt).getTime()))return null;let e=d.result,f=a=>"number"==typeof a&&Number.isFinite(a)?a:null;return{cachedAt:d.cachedAt,findings:f(e?.totals?.hits),sessionsScanned:f(e?.transcripts?.scanned),eventsScanned:f(e?.eventsScanned)}}catch{return null}}])},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
1
+ module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"006487fe2670b9ef41bc27d2197289301f434e40f2",null),a.s(["getTelemetryConfig",0,f])},8674,a=>{"use strict";var b=a.i(2157),c=a.i(50227),d=a.i(66680);a.s(["writeJsonAtomically",0,function(a,e,f={}){let g=f.mode??384,h=f.dirMode??448,i=(0,c.dirname)(a);(0,b.existsSync)(i)||(0,b.mkdirSync)(i,{recursive:!0,mode:h});let j=`${a}.${process.pid}.${(0,d.randomBytes)(6).toString("hex")}.tmp`;try{(0,b.writeFileSync)(j,JSON.stringify(e,null,2),{mode:g});try{(63&(0,b.statSync)(j).mode)!=0&&(0,b.chmodSync)(j,g)}catch{}(0,b.renameSync)(j,a);try{(63&(0,b.statSync)(a).mode)!=0&&(0,b.chmodSync)(a,g)}catch{}}catch(a){try{(0,b.rmSync)(j,{force:!0})}catch{}throw a}}])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
+ Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.2-beta.5",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.120.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.2.0","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.11"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.2-beta.5","@failproofai/failproofaid-linux-arm64":"1.0.2-beta.5","@failproofai/failproofaid-darwin-x64":"1.0.2-beta.5","@failproofai/failproofaid-darwin-arm64":"1.0.2-beta.5"},failproofaidBinaries:{"linux-x64":"e19a1cf9a254df830f205fac024b8a229c162c93ae73851b985d2794e09da035","linux-arm64":"fafcff01e4cce00809b5cd9ff2822705d7373acbab79444e0384cb058b6da921","darwin-x64":"d7bd609387e13f5e75287674d948c69d739bac8d6963aa731b93111d1bdd2ea2","darwin-arm64":"9a57c8eb0f23ed25328e0f7b06638a6ab7f51e1deebf479bac2c779bf9912941"}}},15501,a=>{"use strict";var b=a.i(2157);a.i(8674);var c=a.i(75818);function d(){return(0,c.auditDashboardFile)()}a.s(["readDashboardCache",0,function(){let a=d();if(!(0,b.existsSync)(a))return null;try{let c=(0,b.readFileSync)(a,"utf-8"),d=JSON.parse(c);if(!d||"object"!=typeof d||"string"!=typeof d.cachedAt||!d.params||"object"!=typeof d.params||!d.result||"object"!=typeof d.result||2!==d.schemaVersion||function(a,b=30){let c=new Date(a).getTime();return!!Number.isNaN(c)||Date.now()-c>6e4*b}(d.cachedAt,10080))return null;return d}catch{return null}},"readDashboardCacheMeta",0,function(){let a=d();if(!(0,b.existsSync)(a))return null;try{let c=(0,b.readFileSync)(a,"utf-8"),d=JSON.parse(c);if(!d||2!==d.schemaVersion||"string"!=typeof d.cachedAt||Number.isNaN(new Date(d.cachedAt).getTime()))return null;let e=d.result,f=a=>"number"==typeof a&&Number.isFinite(a)?a:null;return{cachedAt:d.cachedAt,findings:f(e?.totals?.hits),sessionsScanned:f(e?.transcripts?.scanned),eventsScanned:f(e?.eventsScanned)}}catch{return null}}])},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
3
3
 
4
4
  //# sourceMappingURL=%5Broot-of-the-server%5D__0ftmoxc._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[44376,(a,b,c)=>{b.exports=a.x("node:module",()=>require("node:module"))},36119,81243,a=>{"use strict";var b=a.i(37936),c=a.i(21572),d=a.i(2157),e=a.i(75818),f=a.i(60526),g=a.i(50227),h=a.i(74533);function i(){return(0,f.userInfo)().username}function j(a=i()){return`failproofaid@${a}.service`}function k(a=i()){return(0,g.resolve)(process.env.FAILPROOFAI_SYSTEMD_DIR||"/etc/systemd/system",j(a))}function l(){try{var a;return a=(0,h.execFileSync)("systemctl",["show",j(),"--property=ConditionResult","--value"],{stdio:["ignore","pipe","ignore"],timeout:1e4}).toString(),"no"===a.trim()?"condition-failed":"stopped"}catch{return"stopped"}}a.i(10695),a.i(66680),a.i(44376),a.i(27028);var m=a.i(15501),n=a.i(8674),o=a.i(93328);function p(){return(process.env.FAILPROOF_API_URL??process.env.FAILPROOFAI_API_URL??"https://api.befailproof.ai").replace(/\/+$/,"")}class q extends Error{status;code;retryAfterSecs;constructor(a,b,c,d){super(c),this.status=a,this.code=b,this.retryAfterSecs=d,this.name="AuthApiError"}}async function r(a){let b={};try{b=await a.json()}catch{}let c=b.code??`http_${a.status}`,d=b.message??b.detail??a.statusText??"request failed",e=b.retry_after_secs;if(void 0===e){let b=a.headers.get("retry-after");if(b){let a=Number(b);Number.isFinite(a)&&(e=a)}}return void 0!==e&&(e=Math.max(0,Math.min(86400,e))),new q(a.status,c,d,e)}async function s(a,b){try{return await fetch(a,{...b,signal:function(a){let b=AbortSignal.timeout(1e4);if(!a)return b;let c=AbortSignal.any;if(c)return c([b,a]);let d=new AbortController;if(b.aborted)d.abort(b.reason);else b.addEventListener("abort",()=>d.abort(b.reason),{once:!0});if(a.aborted)d.abort(a.reason);else a.addEventListener("abort",()=>d.abort(a.reason),{once:!0});return d.signal}(b.signal??void 0)})}catch(d){let c=function(a){if(null===a||"object"!=typeof a)return!1;let b=a.name;return"AbortError"===b||"TimeoutError"===b}(d);if((0,o.trackEvent)("api_server_unreachable",{kind:c?"timeout":"network",path:function(a){try{return new URL(a).pathname}catch{return a}}(a),method:"string"==typeof b.method?b.method:"GET"}),c)throw new q(0,"timeout",`request to ${a} timed out after 10000ms`);throw d}}async function t(a,b,c){let d={"content-type":"application/json"};c?.accessToken&&(d.authorization=`Bearer ${c.accessToken}`);let e=await s(`${p()}${a}`,{method:"POST",headers:d,body:JSON.stringify(b)});if(204!==e.status){if(!e.ok)throw await r(e);return await e.json()}}async function u(a,b){let c=await s(`${p()}${a}`,{method:"GET",headers:{authorization:`Bearer ${b}`}});if(!c.ok)throw await r(c);return await c.json()}async function v(a){return t("/v0/auth/token/refresh",{refresh_token:a})}async function w(a){return u("/v0/auth/me",a)}function x(){let a=process.env.FAILPROOFAI_AUTH_DIR;return a?(0,g.join)(a,"session.json"):(0,e.auditSessionFile)()}function y(){let a=x();if(!(0,d.existsSync)(a))return null;try{let b=(0,d.readFileSync)(a,"utf-8"),c=JSON.parse(b);if("string"!=typeof c.access_token||"string"!=typeof c.refresh_token||"number"!=typeof c.access_expires_at||"object"!=typeof c.user||!c.user||"string"!=typeof c.user.id||"string"!=typeof c.user.email)return null;return{access_token:c.access_token,refresh_token:c.refresh_token,access_expires_at:c.access_expires_at,refresh_expires_at:"number"==typeof c.refresh_expires_at?c.refresh_expires_at:c.access_expires_at,user:{id:c.user.id,email:c.user.email}}}catch{return null}}function z(){let a=x();(0,d.existsSync)(a)&&(0,d.rmSync)(a,{force:!0});try{let a=(0,e.migrationsDir)();if(!(0,d.existsSync)(a))return;for(let b of(0,d.readdirSync)(a)){if(!b.startsWith("backup-layout"))continue;let c=(0,g.resolve)(a,b,"auth.json");(0,d.existsSync)(c)&&(0,d.rmSync)(c,{force:!0})}}catch{}}let A=new Map;async function B(a){let b=A.get(a.refresh_token);if(b)return b;let c=(async()=>{let b=function(a,b){let c=Math.floor(Date.now()/1e3),d=a.user??b;if(!d)throw Error("authFromTokenResponse: missing user identity");return{access_token:a.access_token,refresh_token:a.refresh_token,access_expires_at:c+a.access_expires_in,refresh_expires_at:c+a.refresh_expires_in,user:d}}(await v(a.refresh_token),a.user);return(0,n.writeJsonAtomically)(x(),b),b})();A.set(a.refresh_token,c);try{return await c}finally{A.delete(a.refresh_token)}}async function C(){let a=y();if(!a)return null;let b=Math.floor(Date.now()/1e3);if(a.access_expires_at-b>60)return a;try{return await B(a)}catch(a){return a instanceof q&&401===a.status&&z(),null}}async function D(){let a=await C();if(!a)return null;try{return{me:await w(a.access_token),auth:a}}catch(a){if(a instanceof q&&401===a.status){let a=y();if(!a)return null;try{let b=await B(a);return{me:await w(b.access_token),auth:b}}catch(a){a instanceof q&&401===a.status&&z()}}return null}}async function E(){let a=(0,c.readConfig)(),b=function(){let a,b;try{a=(0,d.readFileSync)((0,e.auditScheduleFile)(void 0),"utf8")}catch{return null}try{b=JSON.parse(a)}catch{return null}if(!b||"object"!=typeof b||Array.isArray(b))return null;let c=b,f=a=>"number"==typeof a&&Number.isFinite(a)?a:null,g=f(c.schema);return{schema:g,nextDueAtMs:f(c.next_due_at_ms),lastAttemptAtMs:f(c.last_attempt_at_ms),lastRunAtMs:f(c.last_run_at_ms),lastExitCode:f(c.last_exit_code),schemaAhead:null!==g&&g>1}}(),f=(0,m.readDashboardCacheMeta)(),g=y(),i=function(){if("linux"!==process.platform&&process.platform,!(0,d.existsSync)(k()))return"not-installed";try{let a=(0,h.execFileSync)("systemctl",["is-active",j()],{stdio:["ignore","pipe","ignore"],timeout:1e4}).toString().trim();return"active"===a?"running":l()}catch{return l()}}();return{auto:a.audit.auto,intervalDays:a.audit.intervalDays,signedInAs:g?{id:g.user.id,email:g.user.email}:null,daemon:i,schedule:b?{nextDueAtMs:b.nextDueAtMs,lastAttemptAtMs:b.lastAttemptAtMs,lastRunAtMs:b.lastRunAtMs,lastExitCode:b.lastExitCode,schemaAhead:b.schemaAhead}:null,lastResultAt:f?.cachedAt??null,lastScan:f?{finishedAt:f.cachedAt,findings:f.findings,sessionsScanned:f.sessionsScanned,eventsScanned:f.eventsScanned}:null,daemonStartedAtMs:"running"===i?function(){if(!(0,d.existsSync)(k()))return null;try{let a=(0,h.execFileSync)("systemctl",["show",j(),"-p","ActiveEnterTimestampMonotonic","--value"],{stdio:["ignore","pipe","ignore"],timeout:1e4}).toString().trim();return function(a,b,c){if(!Number.isFinite(a)||a<=0||!Number.isFinite(b)||b<=0)return null;let d=(b-a)/1e3;return d<0?null:Math.round(c-d)}(Number(a),Math.floor(Number(process.hrtime.bigint())/1e3),Date.now())}catch{return null}}():null}}a.s(["readAuth",0,y,"whoAmI",0,D],81243),(0,a.i(13095).ensureServerEntryExports)([E]),(0,b.registerServerReference)(E,"003d9aeb810430a002eab302235d38ce9df9d775e3",null),a.s(["getScheduledAuditAction",0,E],36119)}];
1
+ module.exports=[44376,(a,b,c)=>{b.exports=a.x("node:module",()=>require("node:module"))},36119,81243,a=>{"use strict";var b=a.i(37936),c=a.i(21572),d=a.i(2157),e=a.i(75818),f=a.i(60526),g=a.i(50227),h=a.i(74533);function i(){return(0,f.userInfo)().username}function j(a=i()){return`failproofaid@${a}.service`}function k(a=i()){return(0,g.resolve)(process.env.FAILPROOFAI_SYSTEMD_DIR||"/etc/systemd/system",j(a))}function l(){try{var a;return a=(0,h.execFileSync)("systemctl",["show",j(),"--property=ConditionResult","--value"],{stdio:["ignore","pipe","ignore"],timeout:1e4}).toString(),"no"===a.trim()?"condition-failed":"stopped"}catch{return"stopped"}}a.i(10695),a.i(66680),a.i(44376),a.i(27028);var m=a.i(15501),n=a.i(8674),o=a.i(93328);function p(){return(process.env.FAILPROOF_API_URL??process.env.FAILPROOFAI_API_URL??"https://api.befailproof.ai").replace(/\/+$/,"")}class q extends Error{status;code;retryAfterSecs;constructor(a,b,c,d){super(c),this.status=a,this.code=b,this.retryAfterSecs=d,this.name="AuthApiError"}}async function r(a){let b={};try{b=await a.json()}catch{}let c=b.code??`http_${a.status}`,d=b.message??b.detail??a.statusText??"request failed",e=b.retry_after_secs;if(void 0===e){let b=a.headers.get("retry-after");if(b){let a=Number(b);Number.isFinite(a)&&(e=a)}}return void 0!==e&&(e=Math.max(0,Math.min(86400,e))),new q(a.status,c,d,e)}async function s(a,b){try{return await fetch(a,{...b,signal:function(a){let b=AbortSignal.timeout(1e4);if(!a)return b;let c=AbortSignal.any;if(c)return c([b,a]);let d=new AbortController;if(b.aborted)d.abort(b.reason);else b.addEventListener("abort",()=>d.abort(b.reason),{once:!0});if(a.aborted)d.abort(a.reason);else a.addEventListener("abort",()=>d.abort(a.reason),{once:!0});return d.signal}(b.signal??void 0)})}catch(d){let c=function(a){if(null===a||"object"!=typeof a)return!1;let b=a.name;return"AbortError"===b||"TimeoutError"===b}(d);if((0,o.trackEvent)("api_server_unreachable",{kind:c?"timeout":"network",path:function(a){try{return new URL(a).pathname}catch{return a}}(a),method:"string"==typeof b.method?b.method:"GET"}),c)throw new q(0,"timeout",`request to ${a} timed out after 10000ms`);throw d}}async function t(a,b,c){let d={"content-type":"application/json"};c?.accessToken&&(d.authorization=`Bearer ${c.accessToken}`);let e=await s(`${p()}${a}`,{method:"POST",headers:d,body:JSON.stringify(b)});if(204!==e.status){if(!e.ok)throw await r(e);return await e.json()}}async function u(a,b){let c=await s(`${p()}${a}`,{method:"GET",headers:{authorization:`Bearer ${b}`}});if(!c.ok)throw await r(c);return await c.json()}async function v(a){return t("/v0/auth/token/refresh",{refresh_token:a})}async function w(a){return u("/v0/auth/me",a)}function x(){let a=process.env.FAILPROOFAI_AUTH_DIR;return a?(0,g.join)(a,"session.json"):(0,e.auditSessionFile)()}function y(){let a=x();if(!(0,d.existsSync)(a))return null;try{let b=(0,d.readFileSync)(a,"utf-8"),c=JSON.parse(b);if("string"!=typeof c.access_token||"string"!=typeof c.refresh_token||"number"!=typeof c.access_expires_at||"object"!=typeof c.user||!c.user||"string"!=typeof c.user.id||"string"!=typeof c.user.email)return null;return{access_token:c.access_token,refresh_token:c.refresh_token,access_expires_at:c.access_expires_at,refresh_expires_at:"number"==typeof c.refresh_expires_at?c.refresh_expires_at:c.access_expires_at,user:{id:c.user.id,email:c.user.email}}}catch{return null}}function z(){let a=x();(0,d.existsSync)(a)&&(0,d.rmSync)(a,{force:!0});try{let a=(0,e.migrationsDir)();if(!(0,d.existsSync)(a))return;for(let b of(0,d.readdirSync)(a)){if(!b.startsWith("backup-layout"))continue;let c=(0,g.resolve)(a,b,"auth.json");(0,d.existsSync)(c)&&(0,d.rmSync)(c,{force:!0})}}catch{}}let A=new Map;async function B(a){let b=A.get(a.refresh_token);if(b)return b;let c=(async()=>{let b=function(a,b){let c=Math.floor(Date.now()/1e3),d=a.user??b;if(!d)throw Error("authFromTokenResponse: missing user identity");return{access_token:a.access_token,refresh_token:a.refresh_token,access_expires_at:c+a.access_expires_in,refresh_expires_at:c+a.refresh_expires_in,user:d}}(await v(a.refresh_token),a.user);return(0,n.writeJsonAtomically)(x(),b),b})();A.set(a.refresh_token,c);try{return await c}finally{A.delete(a.refresh_token)}}async function C(){let a=y();if(!a)return null;let b=Math.floor(Date.now()/1e3);if(a.access_expires_at-b>60)return a;try{return await B(a)}catch(a){return a instanceof q&&401===a.status&&z(),null}}async function D(){let a=await C();if(!a)return null;try{return{me:await w(a.access_token),auth:a}}catch(a){if(a instanceof q&&401===a.status){let a=y();if(!a)return null;try{let b=await B(a);return{me:await w(b.access_token),auth:b}}catch(a){a instanceof q&&401===a.status&&z()}}return null}}async function E(){let a=(0,c.readConfig)(),b=function(){let a,b;try{a=(0,d.readFileSync)((0,e.auditScheduleFile)(void 0),"utf8")}catch{return null}try{b=JSON.parse(a)}catch{return null}if(!b||"object"!=typeof b||Array.isArray(b))return null;let c=b,f=a=>"number"==typeof a&&Number.isFinite(a)?a:null,g=f(c.schema);return{schema:g,nextDueAtMs:f(c.next_due_at_ms),lastAttemptAtMs:f(c.last_attempt_at_ms),lastRunAtMs:f(c.last_run_at_ms),lastExitCode:f(c.last_exit_code),schemaAhead:null!==g&&g>1}}(),f=(0,m.readDashboardCacheMeta)(),g=y(),i=function(){if("linux"!==process.platform&&process.platform,!(0,d.existsSync)(k()))return"not-installed";try{let a=(0,h.execFileSync)("systemctl",["is-active",j()],{stdio:["ignore","pipe","ignore"],timeout:1e4}).toString().trim();return"active"===a?"running":l()}catch{return l()}}();return{auto:a.audit.auto,intervalDays:a.audit.intervalDays,signedInAs:g?{id:g.user.id,email:g.user.email}:null,daemon:i,schedule:b?{nextDueAtMs:b.nextDueAtMs,lastAttemptAtMs:b.lastAttemptAtMs,lastRunAtMs:b.lastRunAtMs,lastExitCode:b.lastExitCode,schemaAhead:b.schemaAhead}:null,lastResultAt:f?.cachedAt??null,lastScan:f?{finishedAt:f.cachedAt,findings:f.findings,sessionsScanned:f.sessionsScanned,eventsScanned:f.eventsScanned}:null,daemonStartedAtMs:"running"===i?function(){if(!(0,d.existsSync)(k()))return null;try{let a=(0,h.execFileSync)("systemctl",["show",j(),"-p","ActiveEnterTimestampMonotonic","--value"],{stdio:["ignore","pipe","ignore"],timeout:1e4}).toString().trim();return function(a,b,c){if(!Number.isFinite(a)||a<=0||!Number.isFinite(b)||b<=0)return null;let d=(b-a)/1e3;return d<0?null:Math.round(c-d)}(Number(a),Math.floor(Number(process.hrtime.bigint())/1e3),Date.now())}catch{return null}}():null}}a.s(["readAuth",0,y,"whoAmI",0,D],81243),(0,a.i(13095).ensureServerEntryExports)([E]),(0,b.registerServerReference)(E,"005a7d154a644cead2fefc93ebef6691aee3b31d61",null),a.s(["getScheduledAuditAction",0,E],36119)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0oa1lav._.js.map
@@ -1,4 +1,4 @@
1
- module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},24190,a=>{"use strict";var b=a.i(36359);a.s([],40488),a.i(40488),a.s(["00213500077768bfc8f313b5ae5d18754761a82d8c",()=>b.getTelemetryConfig],24190)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"00213500077768bfc8f313b5ae5d18754761a82d8c",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
- Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0vmspq5._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js"].map(b=>a.l(b))).then(()=>b(74493)))},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.2-beta.4",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.120.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.2.0","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.11"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.2-beta.4","@failproofai/failproofaid-linux-arm64":"1.0.2-beta.4","@failproofai/failproofaid-darwin-x64":"1.0.2-beta.4","@failproofai/failproofaid-darwin-arm64":"1.0.2-beta.4"},failproofaidBinaries:{"linux-x64":"08bc00a7f8d7c80bf898471ce59c57f4e96c1420080009cc933b2ddeb4f23750","linux-arm64":"1167d809628cff04c38efbc0eaa83ca26ab8de2878bed0ef59ca43054173eea7","darwin-x64":"6ed32db21af6869c4475e753e524ad8e128436674209ad778421b240a4bd5c53","darwin-arm64":"3843de034c9d6b11f77c1f423e6201ad6a77b7eff3b3d4460ba324c5aeb62021"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
1
+ module.exports=[74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},24190,a=>{"use strict";var b=a.i(36359);a.s([],40488),a.i(40488),a.s(["006487fe2670b9ef41bc27d2197289301f434e40f2",()=>b.getTelemetryConfig],24190)},36359,a=>{"use strict";var b=a.i(37936),c=a.i(69839);a.i(93328);var d=a.i(31920),e=a.i(12072);async function f(){let a=(0,d.isTelemetryEnabled)();return{enabled:a,distinctId:a?(0,c.getInstanceId)():"",apiKey:process.env.FAILPROOFAI_POSTHOG_KEY??"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX",host:process.env.FAILPROOFAI_POSTHOG_HOST??"https://us.i.posthog.com",version:e.version}}(0,a.i(13095).ensureServerEntryExports)([f]),(0,b.registerServerReference)(f,"006487fe2670b9ef41bc27d2197289301f434e40f2",null),a.s(["getTelemetryConfig",0,f])},31920,a=>{"use strict";var b=a.i(21572);a.s(["isTelemetryEnabled",0,function(){if("1"===process.env.FAILPROOFAI_TELEMETRY_DISABLED)return!1;try{return(0,b.readConfig)().telemetry.enabled}catch{return!0}}])},69839,a=>{"use strict";let b;var c=a.i(2157),d=a.i(50227),e=a.i(60526),f=a.i(66680);a.i(74533);var g=a.i(75818);let h=d.default.join(e.default.homedir(),".failproofai"),i=d.default.join(h,"instance-id");function j(a){return f.default.createHmac("sha256","failproofai-telemetry-v1").update(a).digest("hex")}function k(a){let b;try{if(b=(0,g.telemetryIdFile)(),c.default.readFileSync(b,"utf-8").trim()===a)return}catch{try{b=(0,g.telemetryIdFile)()}catch{return}}try{c.default.mkdirSync(d.default.dirname(b),{recursive:!0});let e=`${b}.${process.pid}.tmp`;c.default.writeFileSync(e,a,{encoding:"utf-8",mode:384}),c.default.renameSync(e,b)}catch{}}a.s(["getInstanceId",0,function(){if(b)return b;let a=function(){try{for(let a of(e.default.platform(),["/etc/machine-id","/var/lib/dbus/machine-id"]))try{let b=c.default.readFileSync(a,"utf-8").trim();if(b)return b}catch{}}catch{}}();if(a)return k(b=j(a)),b;let d=[e.default.hostname(),e.default.homedir(),e.default.platform(),e.default.arch(),e.default.cpus()[0]?.model??""].join(":");return d?k(b=j(d)):k(b=function(){try{let a=c.default.readFileSync(i,"utf-8").trim();if(a)return a}catch{}let a=f.default.randomUUID();try{c.default.mkdirSync(h,{recursive:!0}),c.default.writeFileSync(i,a,"utf-8")}catch{}return a}()),b},"hashToId",0,j])},93328,a=>{"use strict";var b=a.i(69839),c=a.i(31920),d=a.i(12072),e=a.i(79779);e.POSTHOG_API_KEY,a.s(["trackEvent",0,function(a,f){if(!(0,c.isTelemetryEnabled)())return;let g=globalThis.__FAILPROOFAI_POSTHOG__;g&&g.capture({distinctId:(0,b.getInstanceId)(),event:a,properties:{...f,$lib:"failproofai",failproofai_version:d.version,product:e.POSTHOG_PRODUCT}})}])},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
2
+ Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__0vmspq5._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_11bnuzn._.js"].map(b=>a.l(b))).then(()=>b(74493)))},12072,(a,b,c)=>{b.exports={name:"failproofai",version:"1.0.2-beta.5",description:"Observability and enforcement for AI agent harnesses. 39 built-in policies hooked into 12 of them — Claude Code, Codex, Cursor, Hermes, OpenClaw and more — blocking the tool call before it runs. Local dashboard included, no account needed.",bin:{failproofai:"./dist/cli.mjs",failproofaid:"./bin/failproofaid-shim.mjs"},files:["bin/","src/","scripts/","lib/","pi-extension/","openclaw-plugin/",".next/standalone/","dist/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{predev:"bun run build:cli && bun link",dev:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/dev.ts --port 8020","build:cli":"bun build --target=node --format=esm --outfile=dist/cli.mjs bin/failproofai.mjs --external posthog-node --external sql.js && node -e \"const fs=require('fs');const c=fs.readFileSync('dist/cli.mjs','utf8');fs.writeFileSync('dist/cli.mjs',c.replace('#!/usr/bin/env bun','#!/usr/bin/env node').replace('// @bun\\n',''))\"","build:worker":"bun build --target=node --format=esm --outfile=dist/worker.mjs bin/failproofai-worker.mjs --external posthog-node --external sql.js",build:"bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts && bun run build:cli && bun run build:worker && bun --bun next build && node -e \"const {cpSync}=require('fs');cpSync('.next/static','.next/standalone/.next/static',{recursive:true});\" && node scripts/prune-standalone.mjs",prestart:"bun run build:cli && bun link",start:"FAILPROOFAI_TELEMETRY_DISABLED=1 bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepare:"bun run build","test:e2e":"vitest run --config vitest.config.e2e.mts","test:e2e:watch":"vitest --config vitest.config.e2e.mts",translate:"bun scripts/translate-docs/cli.ts","translate:readme":"bun scripts/translate-docs/cli.ts --readme-only","translate:docs":"bun scripts/translate-docs/cli.ts --docs-only","translate:dry-run":"bun scripts/translate-docs/cli.ts --dry-run","translate:validate":"bun scripts/translate-docs/cli.ts --validate","validate:mdx":"bun scripts/validate-mdx.ts","docs:audit":"bun scripts/docs-audit.ts","build:pack":"bun scripts/build-policy-pack.mjs"},keywords:["agent-observability","llm-observability","agent-tracing","agent-monitoring","agent-harness","guardrails","enforcement","policies","evals","ai-agent","autonomous-agent","agent-reliability","failure-prevention","claude-code","codex","hermes","openclaw","cli","local-first","hooks"],author:"ExosphereHost Inc. <failproofai@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://github.com/FailproofAI/failproofai",repository:{type:"git",url:"https://github.com/FailproofAI/failproofai.git"},bugs:{url:"https://github.com/FailproofAI/failproofai/issues"},publishConfig:{access:"public"},devDependencies:{"@anthropic-ai/sdk":"^0.120.0","@mdx-js/mdx":"^3.1.1","@tailwindcss/postcss":"^4.3.1","@tanstack/react-virtual":"^3.14.10","@testing-library/jest-dom":"^7.0.0","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.5","@types/node":"26.2.0","@types/react":"19.2.18","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.1.0",clsx:"^2.1.1",eslint:"^10.9.0","eslint-config-next":"^16.3.2",jsdom:"^30.0.1","lucide-react":"^1.33.0",next:"^16.3.2",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.3.1",typescript:"6.0.3",vitest:"^4.1.11"},dependencies:{"html-to-image":"^1.11.13","posthog-node":"^5.50.0","sql.js":"^1.14.1",yaml:"^2.9.0"},overrides:{nanoid:"3.3.18",postcss:"8.5.26","eslint-plugin-react-hooks":"7.0.1",vite:"8.0.16",undici:"7.29.0","brace-expansion":"5.0.9",sharp:"0.35.0"},optionalDependencies:{"@failproofai/failproofaid-linux-x64":"1.0.2-beta.5","@failproofai/failproofaid-linux-arm64":"1.0.2-beta.5","@failproofai/failproofaid-darwin-x64":"1.0.2-beta.5","@failproofai/failproofaid-darwin-arm64":"1.0.2-beta.5"},failproofaidBinaries:{"linux-x64":"e19a1cf9a254df830f205fac024b8a229c162c93ae73851b985d2794e09da035","linux-arm64":"fafcff01e4cce00809b5cd9ff2822705d7373acbab79444e0384cb058b6da921","darwin-x64":"d7bd609387e13f5e75287674d948c69d739bac8d6963aa731b93111d1bdd2ea2","darwin-arm64":"9a57c8eb0f23ed25328e0f7b06638a6ab7f51e1deebf479bac2c779bf9912941"}}},79779,a=>{"use strict";a.s(["POSTHOG_API_KEY",0,"phc_Ac1Ww1GqKc0z1SyrRWbmatEeQdlOQIsDEEdP8l8JRgX","POSTHOG_PRODUCT",0,"failproofai-oss"])}];
3
3
 
4
4
  //# sourceMappingURL=%5Broot-of-the-server%5D__0p-5p8u._.js.map